Skip to content

Commit

Permalink
feat(cdk)!: rename TuiAbstractTextfieldHost to `AbstractTuiTextfiel…
Browse files Browse the repository at this point in the history
…dHost` (#2492)
  • Loading branch information
splincode committed Aug 30, 2022
1 parent 61e3876 commit 11d6e75
Show file tree
Hide file tree
Showing 26 changed files with 856 additions and 900 deletions.
1,632 changes: 783 additions & 849 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {AfterViewInit, Directive} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiInputCardComponent} from './input-card.component';

Expand All @@ -8,7 +8,7 @@ import {TuiInputCardComponent} from './input-card.component';
providers: [tuiAsTextfieldHost(TuiInputCardDirective)],
})
export class TuiInputCardDirective
extends TuiAbstractTextfieldHost<TuiInputCardComponent>
extends AbstractTuiTextfieldHost<TuiInputCardComponent>
implements AfterViewInit
{
onValueChange(value: string): void {
Expand Down
10 changes: 10 additions & 0 deletions projects/cdk/schematics/ng-update/constants/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,4 +432,14 @@ export const CONSTS_TO_REPLACE: ReplacementConst[] = [
moduleSpecifier: '@taiga-ui/kit',
},
},
{
from: {
name: 'TuiAbstractTextfieldHost',
moduleSpecifier: '@taiga-ui/core',
},
to: {
name: 'AbstractTuiTextfieldHost',
moduleSpecifier: '@taiga-ui/core',
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
TuiNotificationOptions,
TuiNotificationOptionsWithData,
AnotherType,
TuiAbstractTextfieldHost
} from '@taiga-ui/core';
import { InputCountOptions } from '@taiga-ui/kit/components';
import { ScrollIntoViewDirective, CodeComponent } from '@taiga-ui/addon-doc';
Expand All @@ -28,13 +29,13 @@ import { ButtonOptions, some, InputCountOptions, WithDateMaskPipeConfig } from '
import { InputPasswordOptions } from '@taiga-ui/kit/components/input-password';
import { TUI_INPUT_TIME_OPTIONS, InputTimeOptions, Country, RadioOptions } from '@taiga-ui/kit';
import {
TuiLanguage,
TuiLanguageCore,
TuiLanguageCommerce,
TuiLanguageEditor,
Language,
LanguageCore,
LanguageCommerce,
LanguageEditor,
LanguagePreview,
TuiLanguageTable,
TuiLanguageKit
LanguageTable,
LanguageKit
} from '@taiga-ui/i18n';
import { ToggleOptions } from '@taiga-ui/cdk';
const options: ButtonOptions = {};
Expand All @@ -44,13 +45,13 @@ const config: WithDateMaskPipeConfig = {}
const notificationOptions: TuiNotificationOptions = {};
const notificationOptionsWithData: TuiNotificationOptionsWithData<string> = {};
const COUNTRIES: Country[] = [];
const language: TuiLanguage
| TuiLanguageCore
| TuiLanguageCommerce
| TuiLanguageEditor
const language: Language
| LanguageCore
| LanguageCommerce
| LanguageEditor
| LanguagePreview
| TuiLanguageTable
| TuiLanguageKit
| LanguageTable
| LanguageKit
| null = null;
@Component({
Expand All @@ -72,14 +73,13 @@ export class AppComponent {
}
constructor(@Inject(TUI_INPUT_TIME_OPTIONS) readonly options: InputTimeOptions) {}
}
export class Textfield extends TuiAbstractTextfieldHost {}
`;

const AFTER = `
import { Component } from '@angular/core';
import {
TuiAlertOptions,
AnotherType,
} from '@taiga-ui/core';
import { TuiAlertOptions, AnotherType, AbstractTuiTextfieldHost } from '@taiga-ui/core';
import { TuiInputCountOptions } from '@taiga-ui/kit';
import { TuiScrollIntoViewLinkDirective, TuiCodeComponent } from '@taiga-ui/addon-doc';
import { TuiTableBar } from '@taiga-ui/addon-tablebars';
Expand Down Expand Up @@ -132,6 +132,8 @@ export class AppComponent {
}
constructor(@Inject(TUI_INPUT_TIME_OPTIONS) readonly options: TuiInputTimeOptions) {}
}
export class Textfield extends AbstractTuiTextfieldHost {}
`;

describe('ng-update', () => {
Expand Down
2 changes: 1 addition & 1 deletion projects/core/abstract/abstract-driver.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {TuiDriver} from './driver';
import {TuiVehicle} from './vehicle';

@Directive()
export class AbstractTuiDriverDirective {
export abstract class AbstractTuiDriverDirective {
constructor(
@Self() @Inject(TuiDestroyService) destroy$: Observable<unknown>,
@Inject(TuiDriver) driver$: Observable<boolean>,
Expand Down
2 changes: 1 addition & 1 deletion projects/core/abstract/abstract-textfield-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {AbstractTuiControl} from '@taiga-ui/cdk';
import {TuiTextfieldHost} from '@taiga-ui/core/interfaces';

@Directive()
export abstract class TuiAbstractTextfieldHost<T extends AbstractTuiControl<any>>
export abstract class AbstractTuiTextfieldHost<T extends AbstractTuiControl<any>>
implements TuiTextfieldHost
{
constructor(@Inject(AbstractTuiControl) protected readonly host: T) {}
Expand Down
1 change: 1 addition & 0 deletions projects/core/abstract/driver.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {ExistingProvider, Type} from '@angular/core';
import {Observable} from 'rxjs';

// eslint-disable-next-line @typescript-eslint/naming-convention
export abstract class TuiDriver extends Observable<boolean> {}

export function tuiAsDriver(useExisting: Type<TuiDriver>): ExistingProvider {
Expand Down
1 change: 1 addition & 0 deletions projects/core/abstract/position-accessor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {ExistingProvider, Type} from '@angular/core';
import {TuiPoint} from '@taiga-ui/core/types';

// eslint-disable-next-line @typescript-eslint/naming-convention
export abstract class TuiPositionAccessor {
abstract getPosition(rect: ClientRect): TuiPoint;
}
Expand Down
1 change: 1 addition & 0 deletions projects/core/abstract/rect-accessor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {ExistingProvider, Type} from '@angular/core';

// eslint-disable-next-line @typescript-eslint/naming-convention
export abstract class TuiRectAccessor {
abstract getClientRect(): ClientRect;
}
Expand Down
1 change: 1 addition & 0 deletions projects/core/abstract/vehicle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {ExistingProvider, Type} from '@angular/core';

// eslint-disable-next-line @typescript-eslint/naming-convention
export abstract class TuiVehicle {
abstract toggle(value: boolean): void;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Directive, Inject} from '@angular/core';
import {AbstractTuiControl} from '@taiga-ui/cdk';
import {TuiAbstractTextfieldHost} from '@taiga-ui/core/abstract';
import {AbstractTuiTextfieldHost} from '@taiga-ui/core/abstract';
import {tuiAsTextfieldHost} from '@taiga-ui/core/tokens';

import {TuiPrimitiveTextfieldComponent} from './primitive-textfield.component';
Expand All @@ -9,7 +9,7 @@ import {TuiPrimitiveTextfieldComponent} from './primitive-textfield.component';
selector: `tui-primitive-textfield`,
providers: [tuiAsTextfieldHost(TuiPrimitiveTextfieldDirective)],
})
export class TuiPrimitiveTextfieldDirective extends TuiAbstractTextfieldHost<any> {
export class TuiPrimitiveTextfieldDirective extends AbstractTuiTextfieldHost<any> {
constructor(
@Inject(TuiPrimitiveTextfieldComponent)
private readonly textfield: TuiPrimitiveTextfieldComponent,
Expand Down
4 changes: 2 additions & 2 deletions projects/kit/components/combo-box/combo-box.directive.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Directive} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiComboBoxComponent} from './combo-box.component';

@Directive({
selector: `tui-combo-box`,
providers: [tuiAsTextfieldHost(TuiComboBoxDirective)],
})
export class TuiComboBoxDirective extends TuiAbstractTextfieldHost<
export class TuiComboBoxDirective extends AbstractTuiTextfieldHost<
TuiComboBoxComponent<unknown>
> {
get value(): string {
Expand Down
4 changes: 2 additions & 2 deletions projects/kit/components/input-copy/input-copy.directive.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Directive} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiInputCopyComponent} from './input-copy.component';

@Directive({
selector: `tui-input-copy`,
providers: [tuiAsTextfieldHost(TuiInputCopyDirective)],
})
export class TuiInputCopyDirective extends TuiAbstractTextfieldHost<TuiInputCopyComponent> {
export class TuiInputCopyDirective extends AbstractTuiTextfieldHost<TuiInputCopyComponent> {
onValueChange(value: string): void {
this.host.onValueChange(value);
}
Expand Down
4 changes: 2 additions & 2 deletions projects/kit/components/input-count/input-count.directive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {AfterViewInit, Directive} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiInputCountComponent} from './input-count.component';

Expand All @@ -8,7 +8,7 @@ import {TuiInputCountComponent} from './input-count.component';
providers: [tuiAsTextfieldHost(TuiInputCountDirective)],
})
export class TuiInputCountDirective
extends TuiAbstractTextfieldHost<TuiInputCountComponent>
extends AbstractTuiTextfieldHost<TuiInputCountComponent>
implements AfterViewInit
{
onValueChange(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Directive} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiInputDateRangeComponent} from './input-date-range.component';

@Directive({
selector: `tui-input-date-range`,
providers: [tuiAsTextfieldHost(TuiInputDateRangeDirective)],
})
export class TuiInputDateRangeDirective extends TuiAbstractTextfieldHost<TuiInputDateRangeComponent> {
export class TuiInputDateRangeDirective extends AbstractTuiTextfieldHost<TuiInputDateRangeComponent> {
get value(): string {
return this.host.computedValue;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Directive} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiInputDateTimeComponent} from './input-date-time.component';

@Directive({
selector: `tui-input-date-time`,
providers: [tuiAsTextfieldHost(TuiInputDateTimeDirective)],
})
export class TuiInputDateTimeDirective extends TuiAbstractTextfieldHost<TuiInputDateTimeComponent> {
export class TuiInputDateTimeDirective extends AbstractTuiTextfieldHost<TuiInputDateTimeComponent> {
get value(): string {
return this.host.computedValue;
}
Expand Down
4 changes: 2 additions & 2 deletions projects/kit/components/input-date/input-date.directive.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Directive} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiInputDateComponent} from './input-date.component';

@Directive({
selector: `tui-input-date`,
providers: [tuiAsTextfieldHost(TuiInputDateDirective)],
})
export class TuiInputDateDirective extends TuiAbstractTextfieldHost<TuiInputDateComponent> {
export class TuiInputDateDirective extends AbstractTuiTextfieldHost<TuiInputDateComponent> {
get value(): string {
return this.host.computedValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TuiMonth,
TuiMonthRange,
} from '@taiga-ui/cdk';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {TUI_MONTH_FORMATTER} from '@taiga-ui/kit/tokens';
import {combineLatest, Observable, Subject} from 'rxjs';
import {distinctUntilChanged, switchMap, takeUntil} from 'rxjs/operators';
Expand All @@ -18,7 +18,7 @@ import {TuiInputMonthRangeComponent} from './input-month-range.component';
providers: [tuiAsTextfieldHost(TuiInputMonthRangeDirective), TuiDestroyService],
})
export class TuiInputMonthRangeDirective
extends TuiAbstractTextfieldHost<TuiInputMonthRangeComponent>
extends AbstractTuiTextfieldHost<TuiInputMonthRangeComponent>
implements DoCheck
{
private readonly value$ = new Subject<TuiMonthRange | null>();
Expand Down
4 changes: 2 additions & 2 deletions projects/kit/components/input-month/input-month.directive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Directive, DoCheck, Inject, Self} from '@angular/core';
import {AbstractTuiControl, TuiDestroyService, TuiHandler, TuiMonth} from '@taiga-ui/cdk';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {TUI_MONTH_FORMATTER} from '@taiga-ui/kit/tokens';
import {Observable, Subject} from 'rxjs';
import {distinctUntilChanged, switchMap, takeUntil} from 'rxjs/operators';
Expand All @@ -12,7 +12,7 @@ import {TuiInputMonthComponent} from './input-month.component';
providers: [tuiAsTextfieldHost(TuiInputMonthDirective), TuiDestroyService],
})
export class TuiInputMonthDirective
extends TuiAbstractTextfieldHost<TuiInputMonthComponent>
extends AbstractTuiTextfieldHost<TuiInputMonthComponent>
implements DoCheck
{
private readonly value$ = new Subject<TuiMonth | null>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, DoCheck} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiInputNumberComponent} from './input-number.component';

Expand All @@ -8,7 +8,7 @@ import {TuiInputNumberComponent} from './input-number.component';
providers: [tuiAsTextfieldHost(TuiInputNumberDirective)],
})
export class TuiInputNumberDirective
extends TuiAbstractTextfieldHost<TuiInputNumberComponent>
extends AbstractTuiTextfieldHost<TuiInputNumberComponent>
implements DoCheck
{
input?: HTMLInputElement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Directive, DoCheck} from '@angular/core';
import {tuiIsInput} from '@taiga-ui/cdk';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiInputPasswordComponent} from './input-password.component';

Expand All @@ -9,7 +9,7 @@ import {TuiInputPasswordComponent} from './input-password.component';
providers: [tuiAsTextfieldHost(TuiInputPasswordDirective)],
})
export class TuiInputPasswordDirective
extends TuiAbstractTextfieldHost<TuiInputPasswordComponent>
extends AbstractTuiTextfieldHost<TuiInputPasswordComponent>
implements DoCheck
{
input?: HTMLInputElement;
Expand Down
4 changes: 2 additions & 2 deletions projects/kit/components/input-phone/input-phone.directive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Directive, DoCheck} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiInputPhoneComponent} from './input-phone.component';

Expand All @@ -8,7 +8,7 @@ import {TuiInputPhoneComponent} from './input-phone.component';
providers: [tuiAsTextfieldHost(TuiInputPhoneDirective)],
})
export class TuiInputPhoneDirective
extends TuiAbstractTextfieldHost<TuiInputPhoneComponent>
extends AbstractTuiTextfieldHost<TuiInputPhoneComponent>
implements DoCheck
{
input?: HTMLInputElement;
Expand Down
4 changes: 2 additions & 2 deletions projects/kit/components/input/input.directive.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Directive} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiInputComponent} from './input.component';

@Directive({
selector: `tui-input`,
providers: [tuiAsTextfieldHost(TuiInputDirective)],
})
export class TuiInputDirective extends TuiAbstractTextfieldHost<TuiInputComponent> {
export class TuiInputDirective extends AbstractTuiTextfieldHost<TuiInputComponent> {
onValueChange(value: string): void {
this.host.onValueChange(value);
}
Expand Down
4 changes: 2 additions & 2 deletions projects/kit/components/select/select.directive.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Directive} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiSelectComponent} from './select.component';

@Directive({
selector: `tui-select`,
providers: [tuiAsTextfieldHost(TuiSelectDirective)],
})
export class TuiSelectDirective extends TuiAbstractTextfieldHost<
export class TuiSelectDirective extends AbstractTuiTextfieldHost<
TuiSelectComponent<unknown>
> {
get readOnly(): boolean {
Expand Down
4 changes: 2 additions & 2 deletions projects/kit/components/text-area/text-area.directive.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Directive} from '@angular/core';
import {TuiAbstractTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';
import {AbstractTuiTextfieldHost, tuiAsTextfieldHost} from '@taiga-ui/core';

import {TuiTextAreaComponent} from './text-area.component';

@Directive({
selector: `tui-text-area`,
providers: [tuiAsTextfieldHost(TuiTextAreaDirective)],
})
export class TuiTextAreaDirective extends TuiAbstractTextfieldHost<TuiTextAreaComponent> {
export class TuiTextAreaDirective extends AbstractTuiTextfieldHost<TuiTextAreaComponent> {
onValueChange(value: string): void {
this.host.onValueChange(value);
}
Expand Down
Loading

0 comments on commit 11d6e75

Please sign in to comment.