From 2408755bb38a3f200dd4df2cc31ed460027db20d 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 --- .cspell.json | 13 ++++++- .../components/table/th/th.component.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 + 6 files changed, 80 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/.cspell.json b/.cspell.json index 351458e2874b..6e5909793cd8 100644 --- a/.cspell.json +++ b/.cspell.json @@ -3,7 +3,18 @@ "import": ["@taiga-ui/cspell-config/cspell.config.js"], "files": ["*/*.*"], "ignorePaths": ["**/projects/i18n/languages/**", "**/addon-commerce/utils/get-currency-symbol.ts"], - "ignoreWords": ["Wachovia", "bottomsheet", "appbar", "qwertypgj_", "antialiasing", "xxxs", "significand"], + "ignoreWords": [ + "Wachovia", + "bottomsheet", + "appbar", + "qwertypgj_", + "antialiasing", + "xxxs", + "significand", + "undoubtable", + "Clintock", + "Bonorum" + ], "ignoreRegExpList": ["\\(https?://.*?\\)", "\\/{1}.+\\/{1}", "\\%2F.+", "\\%2C.+", "\\ɵ.+", "\\ыва.+"], "overrides": [ { 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/8/index.html b/projects/demo/src/modules/components/table/examples/8/index.html new file mode 100644 index 000000000000..5e3b698b120d --- /dev/null +++ b/projects/demo/src/modules/components/table/examples/8/index.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + +
+ Name + + Age + + Description +
{{ item.name }}{{ item.balance }} + {{ 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..f1c15f0c94b4 --- /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', + balance: 1323525, + description: 'Hello world', + }, + { + name: 'Roman Sedov', + balance: 423242, + 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..09791b8fa277 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 of a wide table', ]; }