Skip to content

Commit

Permalink
fix(legacy): MultiSelect empty line when non empty placeholder an…
Browse files Browse the repository at this point in the history
…d `valueContent`
  • Loading branch information
mdlufy committed Sep 20, 2024
1 parent d4099d2 commit c94f39c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions projects/legacy/components/input-tag/input-tag.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ export class TuiInputTagComponent
@ContentChild(TuiDataListDirective, {read: TemplateRef})
protected readonly datalist?: TemplateRef<TuiContext<TuiActiveZone>>;

@ContentChild('content')
protected readonly valueContent?: ElementRef<HTMLElement>;

@ViewChild('errorIcon')
protected readonly errorIconTemplate?: TemplateRef<Record<string, unknown>>;

Expand Down Expand Up @@ -219,6 +222,16 @@ export class TuiInputTagComponent
return tuiIsNativeFocusedIn(this.el) || !!this.dropdown?.tuiDropdownOpen;
}

public get tagsEmpty(): boolean {
return (
((!this.focused || this.inputHidden) &&
!this.value.length &&
!this.search?.trim()?.length &&
!this.placeholder) ||
!!this.valueContent
);
}

public onTagEdited(value: string, index: number): void {
this.focusInput(value === '');
this.value = this.filterValue(
Expand Down
2 changes: 1 addition & 1 deletion projects/legacy/components/input-tag/input-tag.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
overflow: hidden;
}

&_empty:not(.t-with-placeholder) {
&_empty {
block-size: 0;
}

Expand Down
3 changes: 1 addition & 2 deletions projects/legacy/components/input-tag/input-tag.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
>
<div
class="t-tags"
[class.t-tags_empty]="(!focused || inputHidden) && !value.length && !search?.trim()?.length"
[class.t-with-placeholder]="placeholder"
[class.t-tags_empty]="tagsEmpty"
>
<ng-container *ngIf="labelOutside; else text">
<tui-tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

<div
*ngIf="computedGroup"
#content
ngProjectAs="tuiContent"
class="t-content"
[class.t-content_fullsize]="inputTag.labelOutside"
Expand Down

0 comments on commit c94f39c

Please sign in to comment.