Skip to content

Commit

Permalink
fix(legacy): wrong prefix placement in table context (#10045)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Dec 24, 2024
1 parent 2c14206 commit 99cb0bc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 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
14 changes: 11 additions & 3 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 @@ -21,9 +29,9 @@ export default class Example {
},
{
name: 'Roman Sedov',
balance: 423242,
balance: '',
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,13 @@ export class TuiPrimitiveTextfieldComponent
}

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

return this.appearance === 'table' &&
!this.nativeFocusableElement?.readOnly &&
(this.prefix || this.postfix)
? placeholder && !this.value && !this.computedFocused
: placeholder;
}

protected get placeholderRaised(): boolean {
Expand Down

0 comments on commit 99cb0bc

Please sign in to comment.