Skip to content

Commit

Permalink
fix(legacy): TuiMultiSelect fix arrow
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin committed Dec 24, 2024
1 parent a9a856b commit 8177ad2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
16 changes: 10 additions & 6 deletions projects/legacy/components/arrow/arrow.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {AsyncPipe, NgIf} from '@angular/common';
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
import {ChangeDetectionStrategy, Component, computed, inject} from '@angular/core';
import {toSignal} from '@angular/core/rxjs-interop';
import {TuiIcon} from '@taiga-ui/core/components/icon';
import {TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';
import {tuiSizeBigger} from '@taiga-ui/core/utils/miscellaneous';
Expand All @@ -11,6 +12,7 @@ import {
PolymorpheusOutlet,
PolymorpheusTemplate,
} from '@taiga-ui/polymorpheus';
import {of} from 'rxjs';

import {TUI_ARROW_OPTIONS} from './arrow.options';

Expand All @@ -25,19 +27,21 @@ import {TUI_ARROW_OPTIONS} from './arrow.options';
styleUrls: ['./arrow.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'[class._rotated]': 'rotated',
'[class._rotated]': 'rotated()',
'[class._small]': 'small',
},
})
export class TuiArrowComponent {
private readonly control: any = inject(AbstractTuiControl, {optional: true});

Check warning on line 35 in projects/legacy/components/arrow/arrow.component.ts

View check run for this annotation

codefactor.io / CodeFactor

projects/legacy/components/arrow/arrow.component.ts#L35

Unexpected any. Specify a different type. (@typescript-eslint/no-explicit-any)
private readonly textfieldSize = inject(TUI_TEXTFIELD_SIZE);
private readonly options = inject(TUI_ARROW_OPTIONS);
protected readonly directive = inject(TuiDropdownOpen, {optional: true});
protected readonly dropdownOpen = toSignal(
inject(TuiDropdownOpen, {optional: true})?.tuiDropdownOpenChange || of(false),
);

protected get rotated(): boolean {
return this.directive?.tuiDropdownOpen || !!this.control.pseudoOpen || false;
}
protected readonly rotated = computed(
() => this.dropdownOpen() || this.control.pseudoOpen?.(),
);

protected get small(): boolean {
return !tuiSizeBigger(this.textfieldSize.size);
Expand Down
1 change: 0 additions & 1 deletion projects/legacy/components/arrow/arrow.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
*polymorpheusOutlet="arrowIcon as src"
[icon]="src"
/>
<ng-container *ngIf="directive?.tuiDropdownOpenChange | async" />
17 changes: 11 additions & 6 deletions projects/legacy/components/input-tag/input-tag.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
inject,
Input,
Output,
signal,
TemplateRef,
ViewChild,
ViewChildren,
Expand Down Expand Up @@ -159,19 +160,15 @@ export class TuiInputTagComponent
@Input()
public removable = true;

/**
* @deprecated hack
*/
@Input()
public pseudoOpen = false;

@Input()
public disabledItemHandler: TuiBooleanHandler<TuiStringifiableItem<any> | string> =

Check warning on line 164 in projects/legacy/components/input-tag/input-tag.component.ts

View check run for this annotation

codefactor.io / CodeFactor

projects/legacy/components/input-tag/input-tag.component.ts#L164

Unexpected any. Specify a different type. (@typescript-eslint/no-explicit-any)
TUI_FALSE_HANDLER;

@Output()
public readonly searchChange = new EventEmitter<string>();

public pseudoOpen = signal(false);

@Input('pseudoFocused')
public set pseudoFocusedSetter(value: boolean | null) {
if (!value && !this.focused) {
Expand All @@ -181,6 +178,14 @@ export class TuiInputTagComponent
this.pseudoFocus = value;
}

/**
* @deprecated hack
*/
@Input('pseudoOpen')
public set setPseudoOpen(value: boolean) {
this.pseudoOpen.set(value);
}

public get labelOutside(): boolean {
const {size, labelOutside} = this.controller;

Expand Down

0 comments on commit 8177ad2

Please sign in to comment.