Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(legacy): TuiMultiSelect fix arrow #10050

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
PolymorpheusOutlet,
PolymorpheusTemplate,
} from '@taiga-ui/polymorpheus';
import {of} from 'rxjs';

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

Expand All @@ -25,19 +27,21 @@
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 @@
inject,
Input,
Output,
signal,
TemplateRef,
ViewChild,
ViewChildren,
Expand Down Expand Up @@ -159,19 +160,15 @@
@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 @@
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
Loading