Skip to content

Commit

Permalink
feat(addon-table): allow resize more than 100% width of table
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Dec 16, 2024
1 parent 8374088 commit 603bd80
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 2 deletions.
2 changes: 2 additions & 0 deletions projects/addon-table/components/table/th/th.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
})
Expand Down
14 changes: 13 additions & 1 deletion projects/demo/src/modules/components/table/examples/1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
tuiTable
class="table"
[columns]="columns"
[style.table-layout]="'fixed'"
>
<thead>
<tr tuiThGroup>
Expand All @@ -11,7 +12,18 @@
>
Name
</th>
<th tuiTh>Balance</th>
<th
tuiTh
[resizable]="true"
>
Balance
</th>
<th
tuiTh
[resizable]="true"
>
Country
</th>
</tr>
</thead>
<tbody
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.table {
inline-size: 100%;
max-inline-size: 100%;
table-layout: fixed;
overflow: hidden;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ export default class Example {
{
name: 'Alex Inkin',
balance: 1323525,
country: 'UAE',
},
{
name: 'Roman Sedov',
balance: 423242,
country: 'Russia',
},
] as const;

Expand Down
36 changes: 36 additions & 0 deletions projects/demo/src/modules/components/table/examples/8/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<table tuiTable>
<thead>
<tr tuiThGroup>
<th
tuiTh
[resizable]="true"
>
Name
</th>
<th
tuiTh
[resizable]="true"
>
Age
</th>
<th
tuiTh
[resizable]="true"
>
Description
</th>
</tr>
</thead>
<tbody tuiTbody>
<tr *ngFor="let item of data">
<td tuiTd>{{ item.name }}</td>
<td tuiTd>{{ item.age }}</td>
<td
tuiTd
[style.white-space]="'nowrap'"
>
{{ item.description }}
</td>
</tr>
</tbody>
</table>
28 changes: 28 additions & 0 deletions projects/demo/src/modules/components/table/examples/8/index.ts
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion projects/demo/src/modules/components/table/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
Expand Down
1 change: 1 addition & 0 deletions projects/demo/src/modules/components/table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export default class Page {
'Virtual scroll',
'Dynamic columns',
'Footer',
'Resize columns',
];
}

0 comments on commit 603bd80

Please sign in to comment.