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 8fddac1 commit fd9f9f3
Show file tree
Hide file tree
Showing 4 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 @@ -243,6 +243,10 @@ export class TuiPrimitiveTextfieldComponent
return this.nativeFocusableElement?.id || '';
}

protected get isContextTable(): boolean {
return this.appearance === 'table';
}

@tuiPure
protected getIndent$(element: HTMLElement): Observable<number> {
return fromEvent(element, 'scroll').pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</div>
<div class="t-wrapper">
<label
*ngIf="hasPlaceholder"
*ngIf="isContextTable ? !value && !computedFocused : hasPlaceholder"
automation-id="tui-primitive-textfield__placeholder"
class="t-placeholder"
[class.t-placeholder_raised]="placeholderRaised"
Expand Down

0 comments on commit fd9f9f3

Please sign in to comment.