Skip to content

Commit

Permalink
refactor(kit,cdk)!: remove deprecated enums, input-file (#2087)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinkoff-bot authored and splincode committed Jul 11, 2022
1 parent 7a42256 commit 09505ac
Show file tree
Hide file tree
Showing 95 changed files with 127 additions and 2,304 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@angular/core';
import {IntersectionObserverService} from '@ng-web-apis/intersection-observer';
import {TuiComparator} from '@taiga-ui/addon-table/types';
import {TuiController, tuiDefaultProp} from '@taiga-ui/cdk';
import {AbstractTuiController, tuiDefaultProp} from '@taiga-ui/cdk';
import {TUI_MODE, TuiBrightness, TuiSizeL, TuiSizeS} from '@taiga-ui/core';
import {Observable} from 'rxjs';

Expand All @@ -25,7 +25,7 @@ import {TUI_TABLE_PROVIDERS} from '../providers/table.providers';
style: 'border-collapse: separate',
},
})
export class TuiTableDirective<T> extends TuiController {
export class TuiTableDirective<T> extends AbstractTuiController {
@Input()
@tuiDefaultProp()
columns: ReadonlyArray<keyof T | string> = [];
Expand Down
10 changes: 1 addition & 9 deletions projects/cdk/abstract/controller.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
/* eslint-disable @typescript-eslint/naming-convention */
import {Directive, OnChanges} from '@angular/core';
import {Subject} from 'rxjs';

/**
* @deprecated
* TODO: 3.0 replace with {@link AbstractTuiController}
*/
@Directive()
export abstract class TuiController implements OnChanges {
export abstract class AbstractTuiController implements OnChanges {
readonly change$ = new Subject<void>();

ngOnChanges(): void {
this.change$.next();
}
}

@Directive()
export abstract class AbstractTuiController extends TuiController {}
4 changes: 2 additions & 2 deletions projects/cdk/directives/input-mode/input-mode.directive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Attribute, Directive, HostBinding, Inject, Input} from '@angular/core';
import {TUI_IS_IOS} from '@taiga-ui/cdk/tokens';
import {TuiInputModeT} from '@taiga-ui/cdk/types';
import {TuiInputMode} from '@taiga-ui/cdk/types';

/**
* Abstraction over `inputMode` attribute
Expand All @@ -12,7 +12,7 @@ export class TuiInputModeDirective {
@Input('tuiInputMode')
@HostBinding('attr.inputmode')
@HostBinding('attr.x-inputmode')
mode: TuiInputModeT = 'text';
mode: TuiInputMode = 'text';

constructor(
@Attribute('pattern') private readonly pattern: string | null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Component, ElementRef, ViewChild} from '@angular/core';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {configureTestSuite} from '@taiga-ui/testing';

import {TuiInputModeT} from '../../../types/input-mode';
import {TuiInputMode} from '../../../types/input-mode';
import {TuiInputModeModule} from '../input-mode.module';

describe('TuiInputMode directive', () => {
Expand Down Expand Up @@ -34,7 +34,7 @@ describe('TuiInputMode directive', () => {
@ViewChild('inputWithPattern')
inputWithPattern!: ElementRef<HTMLInputElement>;

inputMode: TuiInputModeT = 'decimal';
inputMode: TuiInputMode = 'decimal';

default = true;
}
Expand Down
4 changes: 2 additions & 2 deletions projects/cdk/directives/overscroll/overscroll.directive.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Directive, ElementRef, HostBinding, Inject, Input, NgZone} from '@angular/core';
import {tuiZonefree, typedFromEvent} from '@taiga-ui/cdk/observables';
import {TuiDestroyService} from '@taiga-ui/cdk/services';
import {TuiEventWith, TuiOverscrollModeT} from '@taiga-ui/cdk/types';
import {TuiEventWith, TuiOverscrollMode} from '@taiga-ui/cdk/types';
import {canScroll, getScrollParent} from '@taiga-ui/cdk/utils/dom';
import {Observable} from 'rxjs';
import {filter, switchMap, takeUntil, tap} from 'rxjs/operators';
Expand All @@ -16,7 +16,7 @@ import {filter, switchMap, takeUntil, tap} from 'rxjs/operators';
})
export class TuiOverscrollDirective {
@Input('tuiOverscroll')
mode: TuiOverscrollModeT | '' = 'scroll';
mode: TuiOverscrollMode | '' = 'scroll';

constructor(
@Inject(ElementRef) {nativeElement}: ElementRef<HTMLElement>,
Expand Down
10 changes: 0 additions & 10 deletions projects/cdk/enums/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,7 @@ export const enum TuiCreditCardAutofillName {
CcNumber = 'cc-number',
CcCsc = 'cc-csc',
CcExpMonth = 'cc-exp-month',
/**
* @deprecated
* TODO: 3.0 replace with {@link CcExpMonth}
*/
CcExp_mounth = 'cc-exp-month',
CcExpYear = 'cc-exp-year',
/**
* @deprecated
* TODO: 3.0 replace with {@link CcExpYear}
*/
CcExp_year = 'cc-exp-year',
CcExp = 'cc-exp',
CcType = 'cc-type',
}
Expand Down
3 changes: 0 additions & 3 deletions projects/cdk/enums/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
export * from './autocomplete';
export * from './day-of-week';
export * from './input-mode';
export * from './input-type';
export * from './month-number';
export * from './overscroll-mode';
13 changes: 0 additions & 13 deletions projects/cdk/enums/input-mode.ts

This file was deleted.

10 changes: 0 additions & 10 deletions projects/cdk/enums/input-type.ts

This file was deleted.

13 changes: 0 additions & 13 deletions projects/cdk/enums/overscroll-mode.ts

This file was deleted.

10 changes: 10 additions & 0 deletions projects/cdk/schematics/ng-update/steps/miscellaneous.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ export function miscellaneousMigrations() {
from: 'HongKong_dollar',
to: 'HongKongDollar',
});
replaceEnumProperty({
enumName: 'TuiCreditCardAutofillName',
from: 'CcExp_mounth',
to: 'CcExpMonth',
});
replaceEnumProperty({
enumName: 'TuiCreditCardAutofillName',
from: 'CcExp_year',
to: 'CcExpYear',
});

addWarningToMethod(
'TuiDirectiveStylesService',
Expand Down
2 changes: 1 addition & 1 deletion projects/cdk/types/input-mode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type TuiInputModeT =
export type TuiInputMode =
| 'none'
| 'text'
| 'decimal'
Expand Down
2 changes: 1 addition & 1 deletion projects/cdk/types/input-type.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type TuiInputTypeT = 'text' | 'tel' | 'email' | 'url' | 'password';
export type TuiInputType = 'text' | 'tel' | 'email' | 'url' | 'password';
2 changes: 1 addition & 1 deletion projects/cdk/types/overscroll-mode.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type TuiOverscrollModeT = 'all' | 'scroll' | 'none';
export type TuiOverscrollMode = 'all' | 'scroll' | 'none';
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
tuiAssertIsHTMLElement,
TuiDestroyService,
TuiDropdownHostComponent,
TuiOverscrollModeT,
TuiOverscrollMode,
tuiPure,
tuiZonefree,
} from '@taiga-ui/cdk';
Expand Down Expand Up @@ -93,7 +93,7 @@ export class TuiDropdownBoxComponent implements AfterViewChecked {
});
}

get overscroll(): TuiOverscrollModeT {
get overscroll(): TuiOverscrollMode {
return this.inModal ? 'all' : 'scroll';
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, Input} from '@angular/core';
import {TuiController, tuiDefaultProp} from '@taiga-ui/cdk';
import {AbstractTuiController, tuiDefaultProp} from '@taiga-ui/cdk';
import {DEFAULT_MAX_HEIGHT, DEFAULT_MIN_HEIGHT} from '@taiga-ui/core/constants';
import {
TuiDropdownWidthT,
Expand All @@ -19,7 +19,7 @@ import {TUI_DROPDOWN_CONTROLLER} from './dropdown-controller.token';
},
],
})
export class TuiDropdownControllerDirective extends TuiController {
export class TuiDropdownControllerDirective extends AbstractTuiController {
@Input('tuiDropdownAlign')
@tuiDefaultProp()
align: TuiHorizontalDirection = 'right';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, Inject, Input} from '@angular/core';
import {TuiController, tuiDefaultProp} from '@taiga-ui/cdk';
import {AbstractTuiController, tuiDefaultProp} from '@taiga-ui/cdk';
import {TUI_HINT_OPTIONS, TuiHintOptions} from '@taiga-ui/core/directives/hint';
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';

Expand All @@ -15,7 +15,7 @@ import {TUI_HINT_CONTROLLER} from './hint-controller.token';
},
],
})
export class TuiHintControllerDirective extends TuiController {
export class TuiHintControllerDirective extends AbstractTuiController {
// TODO: 3.0 Remove null
@Input('tuiHintContent')
@tuiDefaultProp()
Expand Down
4 changes: 2 additions & 2 deletions projects/core/directives/mode/mode.directive.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Directive, Input} from '@angular/core';
import {TuiController} from '@taiga-ui/cdk';
import {AbstractTuiController} from '@taiga-ui/cdk';
import {TuiBrightness} from '@taiga-ui/core/types';

@Directive({
selector: '[tuiMode]',
})
export class TuiModeDirective extends TuiController {
export class TuiModeDirective extends AbstractTuiController {
@Input('tuiMode')
mode: TuiBrightness | null = null;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, InjectionToken, Input} from '@angular/core';
import {TuiAutofillFieldName, TuiController} from '@taiga-ui/cdk';
import {AbstractTuiController, TuiAutofillFieldName} from '@taiga-ui/cdk';

export const TUI_TEXTFIELD_AUTOCOMPLETE =
new InjectionToken<TuiTextfieldAutocompleteDirective>('tuiTextfieldAutocomplete', {
Expand All @@ -15,7 +15,7 @@ export const TUI_TEXTFIELD_AUTOCOMPLETE =
},
],
})
export class TuiTextfieldAutocompleteDirective extends TuiController {
export class TuiTextfieldAutocompleteDirective extends AbstractTuiController {
@Input('tuiTextfieldAutocomplete')
autocomplete: TuiAutofillFieldName | '' = '';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, InjectionToken, Input} from '@angular/core';
import {TuiController} from '@taiga-ui/cdk';
import {AbstractTuiController} from '@taiga-ui/cdk';

export const TUI_TEXTFIELD_CLEANER = new InjectionToken<TuiTextfieldCleanerDirective>(
'tuiTextfieldCleaner',
Expand All @@ -17,7 +17,7 @@ export const TUI_TEXTFIELD_CLEANER = new InjectionToken<TuiTextfieldCleanerDirec
},
],
})
export class TuiTextfieldCleanerDirective extends TuiController {
export class TuiTextfieldCleanerDirective extends AbstractTuiController {
@Input('tuiTextfieldCleaner')
cleaner = false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, InjectionToken, Input} from '@angular/core';
import {TuiController} from '@taiga-ui/cdk';
import {AbstractTuiController} from '@taiga-ui/cdk';
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';

export const TUI_TEXTFIELD_CUSTOM_CONTENT =
Expand All @@ -16,7 +16,7 @@ export const TUI_TEXTFIELD_CUSTOM_CONTENT =
},
],
})
export class TuiTextfieldCustomContentDirective extends TuiController {
export class TuiTextfieldCustomContentDirective extends AbstractTuiController {
// TODO: 3.0 Remove null
@Input('tuiTextfieldCustomContent')
customContent: PolymorpheusContent | null = '';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, InjectionToken, Input} from '@angular/core';
import {TuiController} from '@taiga-ui/cdk';
import {AbstractTuiController} from '@taiga-ui/cdk';

export const TUI_TEXTFIELD_EXAMPLE_TEXT =
new InjectionToken<TuiTextfieldExampleTextDirective>('tuiTextfieldExampleText', {
Expand All @@ -15,7 +15,7 @@ export const TUI_TEXTFIELD_EXAMPLE_TEXT =
},
],
})
export class TuiTextfieldExampleTextDirective extends TuiController {
export class TuiTextfieldExampleTextDirective extends AbstractTuiController {
@Input('tuiTextfieldExampleText')
exampleText = '';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, InjectionToken, Input} from '@angular/core';
import {TuiController, TuiInputModeT} from '@taiga-ui/cdk';
import {AbstractTuiController, TuiInputMode} from '@taiga-ui/cdk';

export const TUI_TEXTFIELD_INPUT_MODE =
new InjectionToken<TuiTextfieldInputModeDirective>('tuiTextfieldInputMode', {
Expand All @@ -15,9 +15,9 @@ export const TUI_TEXTFIELD_INPUT_MODE =
},
],
})
export class TuiTextfieldInputModeDirective extends TuiController {
export class TuiTextfieldInputModeDirective extends AbstractTuiController {
@Input('tuiTextfieldInputMode')
inputMode: TuiInputModeT = 'text';
inputMode: TuiInputMode = 'text';
}

// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, InjectionToken, Input} from '@angular/core';
import {TuiController} from '@taiga-ui/cdk';
import {AbstractTuiController} from '@taiga-ui/cdk';

export const TUI_TEXTFIELD_LABEL_OUTSIDE =
new InjectionToken<TuiTextfieldLabelOutsideDirective>('tuiTextfieldLabelOutside', {
Expand All @@ -15,7 +15,7 @@ export const TUI_TEXTFIELD_LABEL_OUTSIDE =
},
],
})
export class TuiTextfieldLabelOutsideDirective extends TuiController {
export class TuiTextfieldLabelOutsideDirective extends AbstractTuiController {
@Input('tuiTextfieldLabelOutside')
labelOutside = false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, InjectionToken, Input} from '@angular/core';
import {TuiController} from '@taiga-ui/cdk';
import {AbstractTuiController} from '@taiga-ui/cdk';

export const TUI_TEXTFIELD_MAX_LENGTH =
new InjectionToken<TuiTextfieldMaxLengthDirective>('tuiTextfieldMaxLength', {
Expand All @@ -15,7 +15,7 @@ export const TUI_TEXTFIELD_MAX_LENGTH =
},
],
})
export class TuiTextfieldMaxLengthDirective extends TuiController {
export class TuiTextfieldMaxLengthDirective extends AbstractTuiController {
@Input('tuiTextfieldMaxLength')
maxLength: number | null = null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, InjectionToken, Input} from '@angular/core';
import {TuiController} from '@taiga-ui/cdk';
import {AbstractTuiController} from '@taiga-ui/cdk';
import {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types';

export const TUI_TEXTFIELD_SIZE = new InjectionToken<TuiTextfieldSizeDirective>(
Expand All @@ -18,7 +18,7 @@ export const TUI_TEXTFIELD_SIZE = new InjectionToken<TuiTextfieldSizeDirective>(
},
],
})
export class TuiTextfieldSizeDirective extends TuiController {
export class TuiTextfieldSizeDirective extends AbstractTuiController {
@Input('tuiTextfieldSize')
size: TuiSizeS | TuiSizeL = 'l';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, forwardRef, InjectionToken, Input} from '@angular/core';
import {TuiController, TuiInputTypeT} from '@taiga-ui/cdk';
import {AbstractTuiController, TuiInputType} from '@taiga-ui/cdk';

export const TUI_TEXTFIELD_TYPE = new InjectionToken<TuiTextfieldTypeDirective>(
'tuiTextfieldType',
Expand All @@ -17,9 +17,9 @@ export const TUI_TEXTFIELD_TYPE = new InjectionToken<TuiTextfieldTypeDirective>(
},
],
})
export class TuiTextfieldTypeDirective extends TuiController {
export class TuiTextfieldTypeDirective extends AbstractTuiController {
@Input('tuiTextfieldType')
type: TuiInputTypeT = 'text';
type: TuiInputType = 'text';
}

// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down
Loading

0 comments on commit 09505ac

Please sign in to comment.