Skip to content

Commit

Permalink
fix(legacy): wrong prefix placement in table context
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Dec 23, 2024
1 parent 2c14206 commit a283c5f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@
<tbody tuiTbody>
<tr *ngFor="let item of data">
<td tuiTd>{{ item.name }}</td>
<td tuiTd>{{ item.balance }}</td>
<td tuiTd>
<tui-input
tuiTextfieldPrefix="$"
[(ngModel)]="item.balance"
>
Value
</tui-input>
</td>
<td
tuiTd
[style.white-space]="'nowrap'"
Expand Down
12 changes: 10 additions & 2 deletions projects/demo/src/modules/components/table/examples/8/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import {NgForOf} from '@angular/common';
import {Component} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiTable} from '@taiga-ui/addon-table';
import {TuiInputModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy';

@Component({
standalone: true,
imports: [NgForOf, TuiTable],
imports: [
FormsModule,
NgForOf,
TuiInputModule,
TuiTable,
TuiTextfieldControllerModule,
],
templateUrl: './index.html',
encapsulation,
changeDetection,
Expand All @@ -25,5 +33,5 @@ export default class Example {
description:
'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.',
},
] as const;
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ export class TuiPrimitiveTextfieldComponent
}

protected get hasPlaceholder(): boolean {
return this.placeholderRaisable || this.placeholderVisible;
const placeholder = this.placeholderRaisable || this.placeholderVisible;

return this.appearance === 'table'
? placeholder && !this.value && !this.computedFocused
: placeholder;
}

protected get placeholderRaised(): boolean {
Expand Down

0 comments on commit a283c5f

Please sign in to comment.