From 603bd805c851b2cdbae9b13bb5218b0c4eae9ec2 Mon Sep 17 00:00:00 2001 From: splincode Date: Tue, 10 Dec 2024 19:57:30 +0300 Subject: [PATCH] feat(addon-table): allow resize more than 100% width of table --- .../components/table/th/th.component.ts | 2 ++ .../components/table/examples/1/index.html | 14 +++++++- .../components/table/examples/1/index.less | 3 ++ .../components/table/examples/1/index.ts | 2 ++ .../components/table/examples/8/index.html | 36 +++++++++++++++++++ .../components/table/examples/8/index.ts | 28 +++++++++++++++ .../src/modules/components/table/index.html | 2 +- .../src/modules/components/table/index.ts | 1 + 8 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 projects/demo/src/modules/components/table/examples/8/index.html create mode 100644 projects/demo/src/modules/components/table/examples/8/index.ts diff --git a/projects/addon-table/components/table/th/th.component.ts b/projects/addon-table/components/table/th/th.component.ts index 3b6046f03514..ed2abab8a8a8 100644 --- a/projects/addon-table/components/table/th/th.component.ts +++ b/projects/addon-table/components/table/th/th.component.ts @@ -24,7 +24,9 @@ import {TUI_TABLE_OPTIONS, TuiSortDirection} from '../table.options'; styleUrls: ['./th.style.less'], changeDetection: ChangeDetectionStrategy.OnPush, host: { + '[style.min-width.px]': 'width', '[style.width.px]': 'width', + '[style.max-width.px]': 'width', '[class._sticky]': 'sticky', }, }) diff --git a/projects/demo/src/modules/components/table/examples/1/index.html b/projects/demo/src/modules/components/table/examples/1/index.html index b5078d141f55..ddf0423ed649 100644 --- a/projects/demo/src/modules/components/table/examples/1/index.html +++ b/projects/demo/src/modules/components/table/examples/1/index.html @@ -2,6 +2,7 @@ tuiTable class="table" [columns]="columns" + [style.table-layout]="'fixed'" > @@ -11,7 +12,18 @@ > Name - Balance + + Balance + + + Country + + + + + Name + + + Age + + + Description + + + + + + {{ item.name }} + {{ item.age }} + + {{ item.description }} + + + + diff --git a/projects/demo/src/modules/components/table/examples/8/index.ts b/projects/demo/src/modules/components/table/examples/8/index.ts new file mode 100644 index 000000000000..1ba66f8abf25 --- /dev/null +++ b/projects/demo/src/modules/components/table/examples/8/index.ts @@ -0,0 +1,28 @@ +import {NgForOf} from '@angular/common'; +import {Component} from '@angular/core'; +import {changeDetection} from '@demo/emulate/change-detection'; +import {encapsulation} from '@demo/emulate/encapsulation'; +import {TuiTable} from '@taiga-ui/addon-table'; + +@Component({ + standalone: true, + imports: [NgForOf, TuiTable], + templateUrl: './index.html', + encapsulation, + changeDetection, +}) +export default class Example { + protected readonly data = [ + { + name: 'Alex Inkin', + age: '25+', + description: 'Hello world', + }, + { + name: 'Roman Sedov', + age: '25+', + 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; +} diff --git a/projects/demo/src/modules/components/table/index.html b/projects/demo/src/modules/components/table/index.html index 5e45e7fc274f..7c54c905d155 100644 --- a/projects/demo/src/modules/components/table/index.html +++ b/projects/demo/src/modules/components/table/index.html @@ -11,7 +11,7 @@ [component]="index + 1 | tuiComponent" [content]="index + 1 | tuiExample" [description]="index === 4 ? cdkVirtualScrollDescription : null" - [fullsize]="index === 4 || index === 5" + [fullsize]="index === 0 || index === 4 || index === 5" [heading]="example" [id]="example | tuiKebab" > diff --git a/projects/demo/src/modules/components/table/index.ts b/projects/demo/src/modules/components/table/index.ts index dbe2ba8dd43a..4c4de75043a5 100644 --- a/projects/demo/src/modules/components/table/index.ts +++ b/projects/demo/src/modules/components/table/index.ts @@ -19,5 +19,6 @@ export default class Page { 'Virtual scroll', 'Dynamic columns', 'Footer', + 'Resize columns', ]; }