From 78ad2e01f9c7f90022e1c4b22127e810c91311a6 Mon Sep 17 00:00:00 2001 From: Vladimir Potekhin Date: Wed, 2 Oct 2024 16:39:26 +0300 Subject: [PATCH 1/5] fix(core): fix overriding default dropdown options --- .../components/textfield/textfield.component.ts | 10 ++++++---- .../utils/miscellaneous/override-options.ts | 14 ++++++++++++++ .../components/textfield/examples/3/index.html | 17 +++++++++++++++++ .../components/textfield/examples/3/index.ts | 3 ++- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/projects/core/components/textfield/textfield.component.ts b/projects/core/components/textfield/textfield.component.ts index ba624786e2a8..93860d32dc51 100644 --- a/projects/core/components/textfield/textfield.component.ts +++ b/projects/core/components/textfield/textfield.component.ts @@ -25,6 +25,7 @@ import type {TuiDataListHost} from '@taiga-ui/core/components/data-list'; import {tuiAsDataListHost} from '@taiga-ui/core/components/data-list'; import {TuiLabel} from '@taiga-ui/core/components/label'; import { + TUI_DROPDOWN_OPTIONS, TuiDropdownDirective, tuiDropdownOpen, tuiDropdownOptionsProvider, @@ -33,6 +34,7 @@ import { import {TuiWithIcons} from '@taiga-ui/core/directives/icons'; import {TUI_COMMON_ICONS} from '@taiga-ui/core/tokens'; import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types'; +import {tuiOverrideDefaultOptions} from '@taiga-ui/core/utils'; import type {PolymorpheusContent} from '@taiga-ui/polymorpheus'; import {PolymorpheusOutlet} from '@taiga-ui/polymorpheus'; @@ -48,10 +50,7 @@ import {TuiWithTextfieldDropdown} from './textfield-dropdown.directive'; styles: ['@import "@taiga-ui/core/styles/components/textfield.less";'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, - providers: [ - tuiAsDataListHost(TuiTextfieldComponent), - tuiDropdownOptionsProvider({limitWidth: 'fixed'}), - ], + providers: [tuiAsDataListHost(TuiTextfieldComponent), tuiDropdownOptionsProvider({})], hostDirectives: [ TuiDropdownDirective, TuiWithDropdownOpen, @@ -83,6 +82,9 @@ export class TuiTextfieldComponent implements TuiDataListHost { protected readonly control?: NgControl; protected readonly icons = inject(TUI_COMMON_ICONS); + protected readonly override = tuiOverrideDefaultOptions(TUI_DROPDOWN_OPTIONS, { + limitWidth: 'fixed', + }); protected computedFiller = computed(() => { const value = this.directive?.nativeValue() || ''; diff --git a/projects/core/utils/miscellaneous/override-options.ts b/projects/core/utils/miscellaneous/override-options.ts index 4c1527037df7..66f462ea1076 100644 --- a/projects/core/utils/miscellaneous/override-options.ts +++ b/projects/core/utils/miscellaneous/override-options.ts @@ -1,3 +1,6 @@ +import type {ProviderToken} from '@angular/core'; +import {inject} from '@angular/core'; + export function tuiOverrideOptions( override: Partial, fallback: T, @@ -13,3 +16,14 @@ export function tuiOverrideOptions( return result; }; } + +export function tuiOverrideDefaultOptions( + key: ProviderToken, + options: Partial, +): void { + const defaultOptions = inject(key, {self: true}); + + Object.keys(options).forEach((key) => { + (defaultOptions as Record)[key] = options[key as keyof T]; + }); +} diff --git a/projects/demo/src/modules/components/textfield/examples/3/index.html b/projects/demo/src/modules/components/textfield/examples/3/index.html index 1b35ebdaabb5..c68fed79d370 100644 --- a/projects/demo/src/modules/components/textfield/examples/3/index.html +++ b/projects/demo/src/modules/components/textfield/examples/3/index.html @@ -25,3 +25,20 @@ [items]="items" /> + + + + + + + diff --git a/projects/demo/src/modules/components/textfield/examples/3/index.ts b/projects/demo/src/modules/components/textfield/examples/3/index.ts index 8eda5ffc9120..fa595617c4fa 100644 --- a/projects/demo/src/modules/components/textfield/examples/3/index.ts +++ b/projects/demo/src/modules/components/textfield/examples/3/index.ts @@ -2,7 +2,7 @@ import {Component, inject} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {changeDetection} from '@demo/emulate/change-detection'; import {encapsulation} from '@demo/emulate/encapsulation'; -import {TuiIcon, TuiTextfield} from '@taiga-ui/core'; +import {TuiDropdownOptionsDirective, TuiIcon, TuiTextfield} from '@taiga-ui/core'; import { TuiChevron, TuiDataListWrapper, @@ -16,6 +16,7 @@ import { FormsModule, TuiChevron, TuiDataListWrapper, + TuiDropdownOptionsDirective, TuiFilterByInputPipe, TuiIcon, TuiTextfield, From 54c6bbd641887623f6eccd4f3a10fc846bf4bc17 Mon Sep 17 00:00:00 2001 From: Vladimir Potekhin Date: Fri, 4 Oct 2024 16:00:01 +0300 Subject: [PATCH 2/5] chore: micro host directive --- .../textfield/textfield.component.ts | 10 +++------ .../dropdown/dropdown-fixed.directive.ts | 21 +++++++++++++++++++ projects/core/directives/dropdown/index.ts | 1 + .../utils/miscellaneous/override-options.ts | 14 ------------- 4 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 projects/core/directives/dropdown/dropdown-fixed.directive.ts diff --git a/projects/core/components/textfield/textfield.component.ts b/projects/core/components/textfield/textfield.component.ts index 93860d32dc51..6c8bf06b0eed 100644 --- a/projects/core/components/textfield/textfield.component.ts +++ b/projects/core/components/textfield/textfield.component.ts @@ -25,16 +25,14 @@ import type {TuiDataListHost} from '@taiga-ui/core/components/data-list'; import {tuiAsDataListHost} from '@taiga-ui/core/components/data-list'; import {TuiLabel} from '@taiga-ui/core/components/label'; import { - TUI_DROPDOWN_OPTIONS, TuiDropdownDirective, + TuiDropdownFixed, tuiDropdownOpen, - tuiDropdownOptionsProvider, TuiWithDropdownOpen, } from '@taiga-ui/core/directives/dropdown'; import {TuiWithIcons} from '@taiga-ui/core/directives/icons'; import {TUI_COMMON_ICONS} from '@taiga-ui/core/tokens'; import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types'; -import {tuiOverrideDefaultOptions} from '@taiga-ui/core/utils'; import type {PolymorpheusContent} from '@taiga-ui/polymorpheus'; import {PolymorpheusOutlet} from '@taiga-ui/polymorpheus'; @@ -50,8 +48,9 @@ import {TuiWithTextfieldDropdown} from './textfield-dropdown.directive'; styles: ['@import "@taiga-ui/core/styles/components/textfield.less";'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, - providers: [tuiAsDataListHost(TuiTextfieldComponent), tuiDropdownOptionsProvider({})], + providers: [tuiAsDataListHost(TuiTextfieldComponent)], hostDirectives: [ + TuiDropdownFixed, TuiDropdownDirective, TuiWithDropdownOpen, TuiWithTextfieldDropdown, @@ -82,9 +81,6 @@ export class TuiTextfieldComponent implements TuiDataListHost { protected readonly control?: NgControl; protected readonly icons = inject(TUI_COMMON_ICONS); - protected readonly override = tuiOverrideDefaultOptions(TUI_DROPDOWN_OPTIONS, { - limitWidth: 'fixed', - }); protected computedFiller = computed(() => { const value = this.directive?.nativeValue() || ''; diff --git a/projects/core/directives/dropdown/dropdown-fixed.directive.ts b/projects/core/directives/dropdown/dropdown-fixed.directive.ts new file mode 100644 index 000000000000..335f9f9a8289 --- /dev/null +++ b/projects/core/directives/dropdown/dropdown-fixed.directive.ts @@ -0,0 +1,21 @@ +import {Directive, inject} from '@angular/core'; +import {tuiOverrideOptions} from '@taiga-ui/core/utils/miscellaneous'; + +import { + TUI_DROPDOWN_DEFAULT_OPTIONS, + TUI_DROPDOWN_OPTIONS, +} from './dropdown-options.directive'; + +@Directive({ + standalone: true, +}) +export class TuiDropdownFixed { + constructor() { + const override = tuiOverrideOptions( + {limitWidth: 'fixed'}, + TUI_DROPDOWN_DEFAULT_OPTIONS, + ); + + override(inject(TUI_DROPDOWN_OPTIONS), TUI_DROPDOWN_DEFAULT_OPTIONS); + } +} diff --git a/projects/core/directives/dropdown/index.ts b/projects/core/directives/dropdown/index.ts index b8d8363f2ccf..9a4ff85ca366 100644 --- a/projects/core/directives/dropdown/index.ts +++ b/projects/core/directives/dropdown/index.ts @@ -18,3 +18,4 @@ export * from './dropdown-position-sided.directive'; export * from './dropdown-selection.directive'; export * from './dropdowns.component'; export * from './with-dropdown-open.directive'; +export * from './dropdown-fixed.directive'; diff --git a/projects/core/utils/miscellaneous/override-options.ts b/projects/core/utils/miscellaneous/override-options.ts index 66f462ea1076..4c1527037df7 100644 --- a/projects/core/utils/miscellaneous/override-options.ts +++ b/projects/core/utils/miscellaneous/override-options.ts @@ -1,6 +1,3 @@ -import type {ProviderToken} from '@angular/core'; -import {inject} from '@angular/core'; - export function tuiOverrideOptions( override: Partial, fallback: T, @@ -16,14 +13,3 @@ export function tuiOverrideOptions( return result; }; } - -export function tuiOverrideDefaultOptions( - key: ProviderToken, - options: Partial, -): void { - const defaultOptions = inject(key, {self: true}); - - Object.keys(options).forEach((key) => { - (defaultOptions as Record)[key] = options[key as keyof T]; - }); -} From 5768cbb98deb7a598866c21a85672174318eef32 Mon Sep 17 00:00:00 2001 From: taiga-family-bot Date: Fri, 4 Oct 2024 13:09:44 +0000 Subject: [PATCH 3/5] chore: apply changes after linting [bot] --- projects/core/directives/dropdown/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/core/directives/dropdown/index.ts b/projects/core/directives/dropdown/index.ts index 9a4ff85ca366..de7c6e2448b2 100644 --- a/projects/core/directives/dropdown/index.ts +++ b/projects/core/directives/dropdown/index.ts @@ -6,6 +6,7 @@ export * from './dropdown.driver'; export * from './dropdown.providers'; export * from './dropdown.service'; export * from './dropdown-context.directive'; +export * from './dropdown-fixed.directive'; export * from './dropdown-hover.directive'; export * from './dropdown-hover.options'; export * from './dropdown-manual.directive'; @@ -18,4 +19,3 @@ export * from './dropdown-position-sided.directive'; export * from './dropdown-selection.directive'; export * from './dropdowns.component'; export * from './with-dropdown-open.directive'; -export * from './dropdown-fixed.directive'; From e848af77ffc8379f6d80fc6fc8d3853cc046ad27 Mon Sep 17 00:00:00 2001 From: Vladimir Potekhin Date: Fri, 4 Oct 2024 17:27:14 +0300 Subject: [PATCH 4/5] chore: add self, optional, fix legacy controls --- .../directives/dropdown/dropdown-fixed.directive.ts | 4 +++- .../legacy/components/combo-box/combo-box.component.ts | 5 ++--- .../input-phone-international.component.ts | 10 +++------- .../components/input-phone/input-phone.component.ts | 5 ++--- .../legacy/components/input-tag/input-tag.component.ts | 5 ++--- .../components/input-time/input-time.component.ts | 4 ++-- projects/legacy/components/input/input.component.ts | 5 ++--- .../components/multi-select/multi-select.component.ts | 5 ++--- projects/legacy/components/select/select.component.ts | 5 ++--- 9 files changed, 20 insertions(+), 28 deletions(-) diff --git a/projects/core/directives/dropdown/dropdown-fixed.directive.ts b/projects/core/directives/dropdown/dropdown-fixed.directive.ts index 335f9f9a8289..39438d3c55c5 100644 --- a/projects/core/directives/dropdown/dropdown-fixed.directive.ts +++ b/projects/core/directives/dropdown/dropdown-fixed.directive.ts @@ -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() { @@ -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); } } diff --git a/projects/legacy/components/combo-box/combo-box.component.ts b/projects/legacy/components/combo-box/combo-box.component.ts index ae24822c09c6..9920854addc3 100644 --- a/projects/legacy/components/combo-box/combo-box.component.ts +++ b/projects/legacy/components/combo-box/combo-box.component.ts @@ -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, @@ -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({ @@ -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', }, diff --git a/projects/legacy/components/input-phone-international/input-phone-international.component.ts b/projects/legacy/components/input-phone-international/input-phone-international.component.ts index 34d4273b96ea..4cc58c8d8ebe 100644 --- a/projects/legacy/components/input-phone-international/input-phone-international.component.ts +++ b/projects/legacy/components/input-phone-international/input-phone-international.component.ts @@ -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'; @@ -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'; @@ -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)', diff --git a/projects/legacy/components/input-phone/input-phone.component.ts b/projects/legacy/components/input-phone/input-phone.component.ts index c0eddd6366fc..d1a53c8098fe 100644 --- a/projects/legacy/components/input-phone/input-phone.component.ts +++ b/projects/legacy/components/input-phone/input-phone.component.ts @@ -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 { @@ -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', }, diff --git a/projects/legacy/components/input-tag/input-tag.component.ts b/projects/legacy/components/input-tag/input-tag.component.ts index a0e8dbe1790f..94e37c4abdca 100644 --- a/projects/legacy/components/input-tag/input-tag.component.ts +++ b/projects/legacy/components/input-tag/input-tag.component.ts @@ -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'; @@ -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'; @@ -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', diff --git a/projects/legacy/components/input-time/input-time.component.ts b/projects/legacy/components/input-time/input-time.component.ts index 9c871541e6b6..463f8fb36d93 100644 --- a/projects/legacy/components/input-time/input-time.component.ts +++ b/projects/legacy/components/input-time/input-time.component.ts @@ -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, @@ -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', diff --git a/projects/legacy/components/input/input.component.ts b/projects/legacy/components/input/input.component.ts index e9fbad0a2c34..330f107f7386 100644 --- a/projects/legacy/components/input/input.component.ts +++ b/projects/legacy/components/input/input.component.ts @@ -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'; @@ -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({ @@ -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', }, diff --git a/projects/legacy/components/multi-select/multi-select.component.ts b/projects/legacy/components/multi-select/multi-select.component.ts index 732b5de9de41..cca406be1f72 100644 --- a/projects/legacy/components/multi-select/multi-select.component.ts +++ b/projects/legacy/components/multi-select/multi-select.component.ts @@ -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'; @@ -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'; @@ -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', diff --git a/projects/legacy/components/select/select.component.ts b/projects/legacy/components/select/select.component.ts index 5a13989fb5db..3edf0ff91b08 100644 --- a/projects/legacy/components/select/select.component.ts +++ b/projects/legacy/components/select/select.component.ts @@ -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, @@ -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'; @@ -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', }, From 7ee936b1bc66a197e84f80ef2cc60f1a0e339e74 Mon Sep 17 00:00:00 2001 From: taiga-family-bot Date: Fri, 4 Oct 2024 14:33:57 +0000 Subject: [PATCH 5/5] chore: apply changes after linting [bot] --- projects/legacy/components/input-time/input-time.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/legacy/components/input-time/input-time.component.ts b/projects/legacy/components/input-time/input-time.component.ts index 463f8fb36d93..5ef16880288c 100644 --- a/projects/legacy/components/input-time/input-time.component.ts +++ b/projects/legacy/components/input-time/input-time.component.ts @@ -19,6 +19,7 @@ import {tuiIsNativeFocused} from '@taiga-ui/cdk/utils/focus'; import {tuiPure} from '@taiga-ui/cdk/utils/miscellaneous'; import type {TuiDataListHost} from '@taiga-ui/core/components/data-list'; import {tuiAsDataListHost, tuiAsOptionContent} from '@taiga-ui/core/components/data-list'; +import {TuiDropdownFixed} from '@taiga-ui/core/directives/dropdown'; import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types'; import {TUI_TIME_TEXTS, TUI_TIME_VALUE_TRANSFORMER} from '@taiga-ui/kit/tokens'; import {AbstractTuiNullableControl, tuiAsControl} from '@taiga-ui/legacy/classes'; @@ -32,7 +33,6 @@ 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,