Skip to content

Commit

Permalink
chore: add self, optional, fix legacy controls
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin committed Oct 4, 2024
1 parent 5768cbb commit e848af7
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import {tuiOverrideOptions} from '@taiga-ui/core/utils/miscellaneous';
import {
TUI_DROPDOWN_DEFAULT_OPTIONS,
TUI_DROPDOWN_OPTIONS,
tuiDropdownOptionsProvider,
} from './dropdown-options.directive';

@Directive({
standalone: true,
providers: [tuiDropdownOptionsProvider({})],
})
export class TuiDropdownFixed {
constructor() {
Expand All @@ -16,6 +18,6 @@ export class TuiDropdownFixed {
TUI_DROPDOWN_DEFAULT_OPTIONS,
);

override(inject(TUI_DROPDOWN_OPTIONS), TUI_DROPDOWN_DEFAULT_OPTIONS);
override(inject(TUI_DROPDOWN_OPTIONS, {self: true, optional: true}), null);
}
}
5 changes: 2 additions & 3 deletions projects/legacy/components/combo-box/combo-box.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
tuiAsOptionContent,
TuiDataListDirective,
} from '@taiga-ui/core/components/data-list';
import {TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import {TuiDropdownFixed, TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import type {
TuiSizeL,
TuiSizeM,
Expand All @@ -40,7 +40,6 @@ import {TUI_SELECT_OPTION} from '@taiga-ui/legacy/components/select-option';
import {TUI_TEXTFIELD_SIZE} from '@taiga-ui/legacy/directives';
import type {TuiFocusableElementAccessor} from '@taiga-ui/legacy/tokens';
import {tuiAsFocusableItemAccessor} from '@taiga-ui/legacy/tokens';
import {FIXED_DROPDOWN_CONTROLLER_PROVIDER} from '@taiga-ui/legacy/utils';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';

@Component({
Expand All @@ -55,7 +54,7 @@ import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';
tuiAsControl(TuiComboBoxComponent),
tuiAsOptionContent(TUI_SELECT_OPTION),
],
viewProviders: [FIXED_DROPDOWN_CONTROLLER_PROVIDER],
hostDirectives: [TuiDropdownFixed],
host: {
'[attr.data-size]': 'size',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {tuiPure} from '@taiga-ui/cdk/utils/miscellaneous';
import {TuiButton} from '@taiga-ui/core/components/button';
import {TuiDataList} from '@taiga-ui/core/components/data-list';
import {TuiAppearance} from '@taiga-ui/core/directives/appearance';
import {TuiDropdown} from '@taiga-ui/core/directives/dropdown';
import {TuiDropdown, TuiDropdownFixed} from '@taiga-ui/core/directives/dropdown';
import {TuiGroup} from '@taiga-ui/core/directives/group';
import {TuiHint} from '@taiga-ui/core/directives/hint';
import {TuiFlagPipe} from '@taiga-ui/core/pipes/flag';
Expand All @@ -40,11 +40,7 @@ import {
import {TuiIsoToCountryCodePipe, TuiToCountryCodePipe} from '@taiga-ui/legacy/pipes';
import type {TuiFocusableElementAccessor} from '@taiga-ui/legacy/tokens';
import {TUI_COUNTRIES_MASKS, tuiAsFocusableItemAccessor} from '@taiga-ui/legacy/tokens';
import {
FIXED_DROPDOWN_CONTROLLER_PROVIDER,
tuiGetMaxAllowedPhoneLength,
tuiIsoToCountryCode,
} from '@taiga-ui/legacy/utils';
import {tuiGetMaxAllowedPhoneLength, tuiIsoToCountryCode} from '@taiga-ui/legacy/utils';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';
import {PolymorpheusOutlet, PolymorpheusTemplate} from '@taiga-ui/polymorpheus';

Expand Down Expand Up @@ -87,7 +83,7 @@ const MASK_SYMBOLS = /[ \-_()]/g;
tuiAsControl(TuiInputPhoneInternationalComponent),
TuiToCountryCodePipe,
],
viewProviders: [FIXED_DROPDOWN_CONTROLLER_PROVIDER],
hostDirectives: [TuiDropdownFixed],
host: {
'[attr.data-size]': 'size',
'(paste.capture.prevent.stop)': 'onPaste($event)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ import {
tuiAsDataListHost,
TuiDataListDirective,
} from '@taiga-ui/core/components/data-list';
import {TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import {TuiDropdownFixed, TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types';
import {AbstractTuiControl, tuiAsControl} from '@taiga-ui/legacy/classes';
import {TuiPrimitiveTextfieldComponent} from '@taiga-ui/legacy/components/primitive-textfield';
import {TUI_TEXTFIELD_CLEANER, TUI_TEXTFIELD_SIZE} from '@taiga-ui/legacy/directives';
import type {TuiFocusableElementAccessor} from '@taiga-ui/legacy/tokens';
import {tuiAsFocusableItemAccessor} from '@taiga-ui/legacy/tokens';
import {FIXED_DROPDOWN_CONTROLLER_PROVIDER} from '@taiga-ui/legacy/utils';

import {TUI_INPUT_PHONE_OPTIONS} from './input-phone.options';
import {
Expand All @@ -53,7 +52,7 @@ function isText(value: string): boolean {
tuiAsControl(TuiInputPhoneComponent),
tuiAsDataListHost(TuiInputPhoneComponent),
],
viewProviders: [FIXED_DROPDOWN_CONTROLLER_PROVIDER],
hostDirectives: [TuiDropdownFixed],
host: {
'[attr.data-size]': 'size',
},
Expand Down
5 changes: 2 additions & 3 deletions projects/legacy/components/input-tag/input-tag.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
TuiDataListDirective,
} from '@taiga-ui/core/components/data-list';
import {TuiScrollbar} from '@taiga-ui/core/components/scrollbar';
import {TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import {TuiDropdownFixed, TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import {TuiHintOptionsDirective} from '@taiga-ui/core/directives/hint';
import {TUI_COMMON_ICONS} from '@taiga-ui/core/tokens';
import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types';
Expand All @@ -44,7 +44,6 @@ import {
import type {TuiFocusableElementAccessor} from '@taiga-ui/legacy/tokens';
import {tuiAsFocusableItemAccessor} from '@taiga-ui/legacy/tokens';
import type {TuiStatus} from '@taiga-ui/legacy/utils';
import {FIXED_DROPDOWN_CONTROLLER_PROVIDER} from '@taiga-ui/legacy/utils';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';
import {PolymorpheusOutlet} from '@taiga-ui/polymorpheus';
import {timer} from 'rxjs';
Expand Down Expand Up @@ -75,7 +74,7 @@ const TAG_VERTICAL_SPACE_REM = 0.125;
tuiAsDataListHost(TuiInputTagComponent),
TEXTFIELD_CONTROLLER_PROVIDER,
],
viewProviders: [FIXED_DROPDOWN_CONTROLLER_PROVIDER],
hostDirectives: [TuiDropdownFixed],
host: {
'[attr.data-size]': 'size',
'[class._icon-start]': 'iconStart',
Expand Down
4 changes: 2 additions & 2 deletions projects/legacy/components/input-time/input-time.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import {TUI_SELECT_OPTION} from '@taiga-ui/legacy/components/select-option';
import {TUI_TEXTFIELD_SIZE} from '@taiga-ui/legacy/directives';
import type {TuiFocusableElementAccessor} from '@taiga-ui/legacy/tokens';
import {tuiAsFocusableItemAccessor} from '@taiga-ui/legacy/tokens';
import {FIXED_DROPDOWN_CONTROLLER_PROVIDER} from '@taiga-ui/legacy/utils';
import type {Observable} from 'rxjs';
import {map, timer} from 'rxjs';

import type {TuiInputTimeOptions} from './input-time.options';
import {TUI_INPUT_TIME_OPTIONS} from './input-time.options';
import {TuiDropdownFixed} from '@taiga-ui/core';

@Component({
standalone: false,
Expand All @@ -46,7 +46,7 @@ import {TUI_INPUT_TIME_OPTIONS} from './input-time.options';
tuiAsDataListHost(TuiInputTimeComponent),
tuiAsOptionContent(TUI_SELECT_OPTION),
],
viewProviders: [FIXED_DROPDOWN_CONTROLLER_PROVIDER],
hostDirectives: [TuiDropdownFixed],
host: {
'(click)': 'onClick()',
'[attr.data-size]': 'size',
Expand Down
5 changes: 2 additions & 3 deletions projects/legacy/components/input/input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
tuiAsDataListHost,
TuiDataListDirective,
} from '@taiga-ui/core/components/data-list';
import {TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import {TuiDropdownFixed, TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types';
import {AbstractTuiControl, tuiAsControl} from '@taiga-ui/legacy/classes';
import {TuiPrimitiveTextfieldComponent} from '@taiga-ui/legacy/components/primitive-textfield';
Expand All @@ -24,7 +24,6 @@ import {
} from '@taiga-ui/legacy/directives';
import type {TuiFocusableElementAccessor} from '@taiga-ui/legacy/tokens';
import {tuiAsFocusableItemAccessor} from '@taiga-ui/legacy/tokens';
import {FIXED_DROPDOWN_CONTROLLER_PROVIDER} from '@taiga-ui/legacy/utils';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';

@Component({
Expand All @@ -39,7 +38,7 @@ import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';
tuiAsDataListHost(TuiInputComponent),
tuiAsControl(TuiInputComponent),
],
viewProviders: [FIXED_DROPDOWN_CONTROLLER_PROVIDER],
viewProviders: [TuiDropdownFixed],
host: {
'[attr.data-size]': 'size',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
tuiAsDataListHost,
TuiDataListDirective,
} from '@taiga-ui/core/components/data-list';
import {TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import {TuiDropdownFixed, TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import type {TuiSizeL, TuiSizeM, TuiSizeS} from '@taiga-ui/core/types';
import type {TuiItemsHandlers} from '@taiga-ui/kit/tokens';
import {TUI_ITEMS_HANDLERS} from '@taiga-ui/kit/tokens';
Expand All @@ -46,7 +46,6 @@ import {
} from '@taiga-ui/legacy/directives';
import type {TuiFocusableElementAccessor} from '@taiga-ui/legacy/tokens';
import {tuiAsFocusableItemAccessor} from '@taiga-ui/legacy/tokens';
import {FIXED_DROPDOWN_CONTROLLER_PROVIDER} from '@taiga-ui/legacy/utils';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';

import type {TuiMultiSelectOptions} from './multi-select.options';
Expand All @@ -65,7 +64,7 @@ import {AbstractTuiNativeMultiSelect} from './native-multi-select/native-multi-s
tuiAsDataListHost(TuiMultiSelectComponent),
TEXTFIELD_CONTROLLER_PROVIDER,
],
viewProviders: [FIXED_DROPDOWN_CONTROLLER_PROVIDER],
hostDirectives: [TuiDropdownFixed],
host: {
'[attr.data-size]': 'size',
'[class._editable]': 'editable',
Expand Down
5 changes: 2 additions & 3 deletions projects/legacy/components/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
tuiAsOptionContent,
TuiDataListDirective,
} from '@taiga-ui/core/components/data-list';
import {TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import {TuiDropdownFixed, TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import type {
TuiSizeL,
TuiSizeM,
Expand All @@ -37,7 +37,6 @@ import {TUI_SELECT_OPTION} from '@taiga-ui/legacy/components/select-option';
import {TUI_TEXTFIELD_CLEANER, TUI_TEXTFIELD_SIZE} from '@taiga-ui/legacy/directives';
import type {TuiFocusableElementAccessor} from '@taiga-ui/legacy/tokens';
import {tuiAsFocusableItemAccessor} from '@taiga-ui/legacy/tokens';
import {FIXED_DROPDOWN_CONTROLLER_PROVIDER} from '@taiga-ui/legacy/utils';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';

import type {TuiSelectOptions} from './select.options';
Expand All @@ -55,7 +54,7 @@ import {TUI_SELECT_OPTIONS} from './select.options';
tuiAsDataListHost(TuiSelectComponent),
tuiAsOptionContent(TUI_SELECT_OPTION),
],
viewProviders: [FIXED_DROPDOWN_CONTROLLER_PROVIDER],
hostDirectives: [TuiDropdownFixed],
host: {
'[attr.data-size]': 'size',
},
Expand Down

0 comments on commit e848af7

Please sign in to comment.