@ithouse-bd/ngx-table 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/DOCUMENTATION.md +176 -3
- package/README.md +72 -6
- package/THEMING.md +2 -0
- package/fesm2022/ithouse-bd-ngx-table.mjs +1108 -78
- package/fesm2022/ithouse-bd-ngx-table.mjs.map +1 -1
- package/index.d.ts +302 -12
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,99 @@ All notable changes to `@ithouse-bd/ngx-table` are documented here.
|
|
|
4
4
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [1.1.1] — 2026-11-29
|
|
8
|
+
|
|
9
|
+
Patch release: the 1.1.0 tarball on npm was built before the fixes below, so they ship here.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **The cell copy button ignored the first click.** It was `pointer-events: none` until hover,
|
|
14
|
+
so a click landed on the row and opened the row instead of copying. It is now clickable while
|
|
15
|
+
invisible, and stays visible on touch devices (`@media (hover: none)`).
|
|
16
|
+
- **Copy failed silently where `navigator.clipboard` is unavailable** (plain http, some
|
|
17
|
+
iframes, denied permission) and still showed a ✓. Writes now fall back to a hidden
|
|
18
|
+
textarea + `execCommand('copy')`, and the ✓ only appears when the text really reached the
|
|
19
|
+
clipboard.
|
|
20
|
+
- **Unpin did nothing on a column declared with `sticky: 'start' | 'end'`.** `pinned` now
|
|
21
|
+
stores an explicit `null` for unpinned columns and `pinOf()` respects it, so the declared
|
|
22
|
+
sticky can be turned off. `TablePresetState.pinned` is `Record<string, TablePin | null>`.
|
|
23
|
+
- **A saved view stayed "active" after the layout changed.** Pinning, hiding, resizing,
|
|
24
|
+
reordering or changing density now clears the highlight and `activeView`, so the Views menu
|
|
25
|
+
never claims the table still matches a view it no longer matches.
|
|
26
|
+
- **A preset was only restored on the first change detection**, so a `storageKey` bound later
|
|
27
|
+
(`[storageKey]="'table-' + userId"`) never restored the saved layout. The restore is now
|
|
28
|
+
keyed to the current `storageKey`.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- `DOCUMENTATION.md` now states exactly what a named view stores (`hidden`, `order`, `widths`,
|
|
33
|
+
`pinned`, `density` — not sort, filters, page or selection) and that views need a
|
|
34
|
+
`storageKey` to survive a reload.
|
|
35
|
+
|
|
36
|
+
## [1.1.0] — 2026-11-26
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- **Column header menu** (`showColumnMenu`, default on): sort ascending/descending, clear
|
|
41
|
+
sort, pin to left/right, unpin, fit to content and hide column, per column.
|
|
42
|
+
- **`resizable`** — drag a header edge to resize (minimum 56 px); `autosizeColumn(key)` fits a
|
|
43
|
+
column to its content.
|
|
44
|
+
- **`reorderable`** — drag headers to reorder columns; hidden columns keep their slot.
|
|
45
|
+
- **Named views** (`showViews`) — save, apply and delete named layouts next to the automatic
|
|
46
|
+
preset.
|
|
47
|
+
- **`columnStateChange`** — emits `TablePresetState` (`{ hidden, density, order, widths,
|
|
48
|
+
pinned }`) whenever the layout changes.
|
|
49
|
+
- **Filter chips** (`showFilterChips`) — removable chips for the search term and every column
|
|
50
|
+
filter, plus "Clear all".
|
|
51
|
+
- **Selection bar** (`selectionActions`, `selectionAction`) — bulk actions once rows are
|
|
52
|
+
selected.
|
|
53
|
+
- **Row detail** (`#ithTableRowDetail`, `rowDetailTrigger: 'button' | 'row' | 'none'`) —
|
|
54
|
+
full-width expandable panel under a row.
|
|
55
|
+
- **CSV and Excel export** — the Export button opens a two-item menu. `.xlsx` is a real
|
|
56
|
+
workbook (bold frozen header row, autofilter, sized columns) produced by a new dependency-free
|
|
57
|
+
ZIP + OOXML writer (`buildXlsxBlob()`, exported publicly); `.csv` keeps the UTF-8 BOM. API:
|
|
58
|
+
`toCsv()`, `toExcel()`, `downloadCsv()`, `downloadExcel()`, `exportAs(format)`, outputs
|
|
59
|
+
`csvExport` and the new `exportFile` (`{ format, fileName, blob, rows }`).
|
|
60
|
+
- **Footer totals** — `TableColumn.aggregate` with `sum`, `avg`, `min`, `max`, `count`, plus
|
|
61
|
+
`label` and `format` overrides, rendered in a `<tfoot>` row.
|
|
62
|
+
- **Keyboard grid** (`keyboardNavigation`, default on) — single tab stop, arrow/Home/End/
|
|
63
|
+
PageUp/PageDown movement, `Space` selection, `Ctrl/Cmd+C` copy.
|
|
64
|
+
- **Sticky header depth** — the header casts a shadow once the body is scrolled.
|
|
65
|
+
- **Dark mode polish** — new semantic tokens (`--_on-accent`, `--_toolbar-tint`,
|
|
66
|
+
`--_popover-bg`, `--_elevation`, `--_scroll-thumb`, `--_danger`): readable text on accent
|
|
67
|
+
fills, calmer brand-tinted header, raised popovers/menus with a hairline ring, lighter row
|
|
68
|
+
separators, visible soft scrollbars and a lighter danger red. Light mode is unchanged apart
|
|
69
|
+
from the shared tokens.
|
|
70
|
+
- New models: `TablePresetState`, `TableSelectionAction`, `TableSelectionActionEvent`,
|
|
71
|
+
`TableAggregate`, `TableAggregateType`, `TablePin`, `TableRowDetailContext` and the
|
|
72
|
+
`TableRowDetailDirective`.
|
|
73
|
+
|
|
74
|
+
### Fixed
|
|
75
|
+
|
|
76
|
+
- **Column preset did not restore.** The preset (and its toolbar popover) was read in the
|
|
77
|
+
constructor, before `storageKey` was bound, and the empty state then overwrote the stored
|
|
78
|
+
value. The preset is now restored once, after inputs are bound, and only persisted
|
|
79
|
+
afterwards. Stored layouts are versioned (`v: 2`) and old 1.0.0 values are still read.
|
|
80
|
+
- **The Columns popover was unusable.** It was clipped by the toolbar's `overflow: auto`
|
|
81
|
+
scroll box, so it could be opened but not seen or clicked. Popovers (columns, views, header
|
|
82
|
+
menu) are now `position: fixed` and anchored to their trigger inside the viewport.
|
|
83
|
+
- **A single row collapsed the table.** New `minRows` input (default `4`) keeps the body at a
|
|
84
|
+
stable height with empty space below the last row; rows never stretch.
|
|
85
|
+
- **Pinned columns only pinned the header.** A later `.ith-table-td { position: relative }`
|
|
86
|
+
rule (used by the copy button) overrode `position: sticky` on body cells, so the header
|
|
87
|
+
stuck while the cells scrolled away. Body, filter and totals cells now stay pinned with the
|
|
88
|
+
header (verified at full horizontal scroll).
|
|
89
|
+
- **Compact density did nothing visible.** The `dense`/`compact` modifiers set the public
|
|
90
|
+
`--ith-table-cell-padding` on `.ith-table`, but `--_cell-padding` had already been resolved
|
|
91
|
+
on `:host`, so rows never changed. The modifiers now re-declare the private tokens:
|
|
92
|
+
comfortable rows are 51 px, compact 41 px (header 46 → 40 px).
|
|
93
|
+
- The density control is a two-state segmented switch (Comfortable / Compact) instead of a
|
|
94
|
+
single toggle, and `setDensity(density)` sets it explicitly.
|
|
95
|
+
- Compact density now tokenises row/header heights (`--ith-table-row-height`,
|
|
96
|
+
`--ith-table-head-height`) so sticky offsets and the minimum height stay correct.
|
|
97
|
+
- Cell copy, clipboard fallback, explicit unpin, the Views highlight and the `storageKey`
|
|
98
|
+
restore landed after 1.1.0 was built; see [1.1.1].
|
|
99
|
+
|
|
7
100
|
## [1.0.0] — 2026-11-24
|
|
8
101
|
|
|
9
102
|
### Added
|
package/DOCUMENTATION.md
CHANGED
|
@@ -14,6 +14,13 @@ Complete reference for `<ith-table>`: every input, output, template slot and rec
|
|
|
14
14
|
- [Selection](#selection)
|
|
15
15
|
- [Row actions](#row-actions)
|
|
16
16
|
- [Custom templates](#custom-templates)
|
|
17
|
+
- [Copy, context menu & presets](#copy-context-menu--presets)
|
|
18
|
+
- [Header menu, resize and reorder](#header-menu-resize-and-reorder)
|
|
19
|
+
- [Named views](#named-views)
|
|
20
|
+
- [Row detail](#row-detail)
|
|
21
|
+
- [CSV and Excel export](#csv-and-excel-export)
|
|
22
|
+
- [Footer totals](#footer-totals)
|
|
23
|
+
- [Keyboard grid](#keyboard-grid)
|
|
17
24
|
- [Loading and empty states](#loading-and-empty-states)
|
|
18
25
|
- [Server-side mode](#server-side-mode)
|
|
19
26
|
- [Programmatic API](#programmatic-api)
|
|
@@ -465,10 +472,150 @@ Replaces the default summary **only**; pagination controls stay. Context adds `p
|
|
|
465
472
|
|
|
466
473
|
- The "Columns" popover toggles visibility without touching the column config; at least one
|
|
467
474
|
column always stays visible.
|
|
468
|
-
- With `storageKey`, the
|
|
469
|
-
|
|
475
|
+
- With `storageKey`, the whole layout is restored from `localStorage` on the next visit:
|
|
476
|
+
hidden columns, density, order, widths and pinning (the stored JSON is versioned, and an old
|
|
477
|
+
1.0.0 `{ hidden, density }` value is still read). Call `resetColumns()` to clear it.
|
|
470
478
|
- `dense` still forces compact rows; the toggle only switches the runtime density.
|
|
471
479
|
|
|
480
|
+
### Header menu, resize and reorder
|
|
481
|
+
|
|
482
|
+
```html
|
|
483
|
+
<ith-table [data]="rows" [columns]="columns"
|
|
484
|
+
[resizable]="true" [reorderable]="true"
|
|
485
|
+
[showColumnMenu]="true"
|
|
486
|
+
(columnStateChange)="save($event)"></ith-table>
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
- Every header shows a `⋮` button (on hover, or always on focus) opening a menu with sort
|
|
490
|
+
ascending/descending, clear sort, pin to left/right, unpin, fit to content and hide column.
|
|
491
|
+
Each item respects the column flags: `sortable`, `pinnable`, `hideable`.
|
|
492
|
+
- All popovers are rendered with `position: fixed` and positioned from the trigger's
|
|
493
|
+
rectangle, so the toolbar's horizontal scroll box and the table's `overflow` can never clip
|
|
494
|
+
them.
|
|
495
|
+
- `resizable` adds a pointer drag handle on the right edge of each header (minimum 56 px);
|
|
496
|
+
`autosizeColumn(key)` or "Fit to content" sizes a column from its widest rendered value.
|
|
497
|
+
- `reorderable` drags a header onto another header; hidden columns keep their slot.
|
|
498
|
+
- `columnStateChange` emits `TablePresetState` — `{ hidden, density, order, widths, pinned }` —
|
|
499
|
+
whenever the user changes the layout.
|
|
500
|
+
- Per-column opt-outs: `sticky: 'start' | 'end'` (initial pin), `pinnable: false`,
|
|
501
|
+
`hideable: false`.
|
|
502
|
+
|
|
503
|
+
### Named views
|
|
504
|
+
|
|
505
|
+
```html
|
|
506
|
+
<ith-table [data]="rows" [columns]="columns" [showViews]="true"
|
|
507
|
+
storageKey="orders-table"></ith-table>
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
The Views menu lists saved layouts ("Compact view", "Finance view" …), lets the user save the
|
|
511
|
+
current layout under a name, apply one with a click and delete one with `×`. Views live in the
|
|
512
|
+
same `storageKey` entry, and the applied view stays highlighted until the layout is changed by
|
|
513
|
+
hand (pin, hide, resize, reorder or density) — then the table no longer matches it and the
|
|
514
|
+
highlight is dropped.
|
|
515
|
+
|
|
516
|
+
A view stores the **layout only**: `hidden`, `order`, `widths`, `pinned` and `density`. Sort,
|
|
517
|
+
search, filters, page and the selection are not part of a view; persist those yourself if a
|
|
518
|
+
"saved report" needs them. Without a `storageKey` the views live in memory and are lost on
|
|
519
|
+
reload.
|
|
520
|
+
|
|
521
|
+
### Filter chips
|
|
522
|
+
|
|
523
|
+
When `search()` or any column filter is active, `.ith-table-chips` shows one removable chip per
|
|
524
|
+
filter plus "Clear all". `showFilterChips` (default `true`) disables the row; `removeChip()` and
|
|
525
|
+
`clearQuery()` are also available programmatically.
|
|
526
|
+
|
|
527
|
+
### Selection bar
|
|
528
|
+
|
|
529
|
+
```typescript
|
|
530
|
+
bulk: TableSelectionAction<Row>[] = [
|
|
531
|
+
{ id: 'export', label: 'Export selected' },
|
|
532
|
+
{ id: 'delete', label: 'Delete', class: 'is-danger' },
|
|
533
|
+
];
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
```html
|
|
537
|
+
<ith-table [data]="rows" [columns]="columns" selectionMode="multi"
|
|
538
|
+
[selectionActions]="bulk" (selectionAction)="run($event)"></ith-table>
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
As soon as one row is selected a bar appears above the table with the count, your actions and
|
|
542
|
+
"Clear selection". `(selectionAction)` emits `{ action, rows }`.
|
|
543
|
+
|
|
544
|
+
### Row detail
|
|
545
|
+
|
|
546
|
+
```html
|
|
547
|
+
<ith-table [data]="rows" [columns]="columns" rowDetailTrigger="button">
|
|
548
|
+
<ng-template ithTableRowDetail let-row let-close="close">
|
|
549
|
+
<dl class="detail">
|
|
550
|
+
<dt>Email</dt><dd>{{ row.email }}</dd>
|
|
551
|
+
</dl>
|
|
552
|
+
<button type="button" (click)="close()">Close</button>
|
|
553
|
+
</ng-template>
|
|
554
|
+
</ith-table>
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
- `rowDetailTrigger="button"` adds a chevron cell (rotates when open); `"row"` expands on row
|
|
558
|
+
click; `"none"` disables expansion.
|
|
559
|
+
- The panel renders on its own full-width row under the row, and the template receives
|
|
560
|
+
`{ $implicit, row, index, close }`.
|
|
561
|
+
|
|
562
|
+
### CSV and Excel export
|
|
563
|
+
|
|
564
|
+
```html
|
|
565
|
+
<ith-table [data]="rows" [columns]="columns" [showExport]="true"
|
|
566
|
+
exportFileName="orders"
|
|
567
|
+
(csvExport)="onCsv($event)"
|
|
568
|
+
(exportFile)="onFile($event)"></ith-table>
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
`showExport` renders one toolbar button that opens a two-item menu:
|
|
572
|
+
|
|
573
|
+
| Item | Method | Result |
|
|
574
|
+
| --- | --- | --- |
|
|
575
|
+
| **Excel** | `downloadExcel()` / `toExcel()` | `.xlsx` workbook: bold frozen header row, autofilter, sized columns |
|
|
576
|
+
| **CSV** | `downloadCsv()` / `toCsv()` | `.csv`, UTF-8 with BOM so Excel keeps the encoding |
|
|
577
|
+
|
|
578
|
+
- Both paths write the visible columns in the user's order and the formatted cell text, and
|
|
579
|
+
use the selected rows when there is a selection — otherwise every filtered row (not just the
|
|
580
|
+
current page).
|
|
581
|
+
- `toCsv()` returns the text, `toExcel()` returns a `Blob`; `exportAs('csv' | 'xlsx')` runs the
|
|
582
|
+
same logic as the menu. `(csvExport)` emits the CSV string, `(exportFile)` emits
|
|
583
|
+
`{ format, fileName, blob, rows }` for both formats (upload it to your API instead of saving).
|
|
584
|
+
- The `.xlsx` writer (`buildXlsxBlob()` from the package) is a small ZIP + OOXML writer with no
|
|
585
|
+
runtime dependency; it is exported separately in case you want to reuse it.
|
|
586
|
+
- CSV values containing `,` `;` `"` or a newline are quoted and escaped.
|
|
587
|
+
- Excel cells are written as text, so leading zeros in codes such as `260029` survive.
|
|
588
|
+
|
|
589
|
+
### Footer totals
|
|
590
|
+
|
|
591
|
+
```typescript
|
|
592
|
+
columns: TableColumn<Order>[] = [
|
|
593
|
+
{ key: 'customer', header: 'Customer' },
|
|
594
|
+
{ key: 'total', header: 'Total', align: 'right', aggregate: 'sum' },
|
|
595
|
+
{ key: 'qty', header: 'Qty', aggregate: { type: 'avg', label: 'Average' } },
|
|
596
|
+
{ key: 'id', header: '#', aggregate: 'count' },
|
|
597
|
+
];
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
`sum`, `avg`, `min`, `max` and `count` are computed over the filtered rows (the loaded page in
|
|
601
|
+
server mode) and rendered in a `<tfoot>` row that keeps the column alignment, sticky columns
|
|
602
|
+
and the density. `aggregate.label` renames the caption and `aggregate.format(value)` controls
|
|
603
|
+
the number formatting.
|
|
604
|
+
|
|
605
|
+
### Keyboard grid
|
|
606
|
+
|
|
607
|
+
`keyboardNavigation` (default `true`) gives the body a single tab stop and grid navigation:
|
|
608
|
+
|
|
609
|
+
| Key | Action |
|
|
610
|
+
| --- | --- |
|
|
611
|
+
| `↑` `↓` `←` `→` | Move one cell |
|
|
612
|
+
| `Home` / `End` | First / last cell of the row |
|
|
613
|
+
| `Ctrl+Home` / `Ctrl+End` | First cell / last cell of the page |
|
|
614
|
+
| `PageUp` / `PageDown` | Move one page of rows |
|
|
615
|
+
| `Space` | Toggle selection of the row |
|
|
616
|
+
| `Ctrl/Cmd+C` | Copy the focused cell (with `copyable`) |
|
|
617
|
+
| `Shift+F10` / context-menu key | Emit `rowContextMenu` |
|
|
618
|
+
|
|
472
619
|
### Sticky columns and tooltips
|
|
473
620
|
|
|
474
621
|
```typescript
|
|
@@ -571,6 +718,17 @@ Notes:
|
|
|
571
718
|
| `selectRow(row)` / `deselectRow(row)` / `clearSelection()` | Selection helpers |
|
|
572
719
|
| `isSelected(row)` / `rowKey(row)` | Selection inspection |
|
|
573
720
|
| `clearSearch()` / `clearFilters()` / `clearQuery()` | Reset search state |
|
|
721
|
+
| `setColumnVisible(key, visible)` / `canHide(key)` | Column visibility |
|
|
722
|
+
| `resetColumns()` | Restore the default layout |
|
|
723
|
+
| `pinColumn(key, 'start' \| 'end' \| null)` | Runtime pinning |
|
|
724
|
+
| `autosizeColumn(key)` | Fit a column to its content |
|
|
725
|
+
| `moveColumn(from, to)` | Reorder two columns |
|
|
726
|
+
| `setDensity(density)` / `toggleDensity()` | Comfortable vs compact rows |
|
|
727
|
+
| `toggleRowDetail(row)` / `isRowExpanded(row)` | Row detail panel |
|
|
728
|
+
| `toCsv()` / `toExcel()` | CSV text / `.xlsx` blob |
|
|
729
|
+
| `downloadCsv()` / `downloadExcel()` / `exportAs(format)` | Downloads |
|
|
730
|
+
| `saveView()` / `applyView(name)` / `deleteView(name, event)` | Named layouts |
|
|
731
|
+
| `toggleColumnPicker()` / `toggleViews()` | Open the toolbar popovers |
|
|
574
732
|
|
|
575
733
|
Expose `sort`, `search`, `page`, `pageSize`, `selected` and `filters` publicly to reset
|
|
576
734
|
them from the parent.
|
|
@@ -609,7 +767,7 @@ Component styles are scoped; do not set `encapsulation: ViewEncapsulation.None`
|
|
|
609
767
|
consumer and avoid `display: none` on the host. The table needs its host `display: block`.
|
|
610
768
|
|
|
611
769
|
**Angular budget warning for component styles**
|
|
612
|
-
The table stylesheet is ~
|
|
770
|
+
The table stylesheet is ~36 kB uncompressed (~6 kB gzipped). If your Angular project uses
|
|
613
771
|
the default `anyComponentStyle` budget (8 kB), raise it:
|
|
614
772
|
|
|
615
773
|
```json
|
|
@@ -685,8 +843,19 @@ Rows are compared by `keyField`; pass the same row objects (or at least the same
|
|
|
685
843
|
| `showDensityToggle` | `boolean` | `false` |
|
|
686
844
|
| `storageKey` | `string` | `''` |
|
|
687
845
|
| `skeletonRows` | `number` | `6` |
|
|
846
|
+
| `minRows` | `number` | `4` |
|
|
688
847
|
| `stickySelection` | `boolean` | `false` |
|
|
689
848
|
| `stickyActions` | `boolean` | `false` |
|
|
849
|
+
| `showFilterChips` | `boolean` | `true` |
|
|
850
|
+
| `selectionActions` | `TableSelectionAction<T>[]` | `[]` |
|
|
851
|
+
| `showColumnMenu` | `boolean` | `true` |
|
|
852
|
+
| `showExport` | `boolean` | `false` |
|
|
853
|
+
| `exportFileName` | `string` | `'table'` |
|
|
854
|
+
| `showViews` | `boolean` | `false` |
|
|
855
|
+
| `resizable` | `boolean` | `false` |
|
|
856
|
+
| `reorderable` | `boolean` | `false` |
|
|
857
|
+
| `keyboardNavigation` | `boolean` | `true` |
|
|
858
|
+
| `rowDetailTrigger` | `'button' \| 'row' \| 'none'` | `'button'` |
|
|
690
859
|
|
|
691
860
|
### Outputs
|
|
692
861
|
|
|
@@ -705,6 +874,10 @@ Rows are compared by `keyField`; pass the same row objects (or at least the same
|
|
|
705
874
|
| `rowContextMenu` | `TableRowMenuEvent<T>` (`{ row, index, x, y, event }`) |
|
|
706
875
|
| `columnsChange` | `string[]` (visible column keys) |
|
|
707
876
|
| `densityChange` | `'comfortable' \| 'compact'` |
|
|
877
|
+
| `columnStateChange` | `TablePresetState` (`{ hidden, density, order, widths, pinned }`) |
|
|
878
|
+
| `selectionAction` | `TableSelectionActionEvent<T>` (`{ action, rows }`) |
|
|
879
|
+
| `csvExport` | `string` (the generated CSV) |
|
|
880
|
+
| `exportFile` | `TableExportEvent<T>` (`{ format, fileName, blob, rows }`) |
|
|
708
881
|
|
|
709
882
|
## License
|
|
710
883
|
|
package/README.md
CHANGED
|
@@ -32,10 +32,20 @@ API-driven (server) data.
|
|
|
32
32
|
- **Copy** — hover a cell (or press Ctrl/Cmd+C on a focused cell) or copy a whole row
|
|
33
33
|
- **Context menu** — right-click / `Shift+F10` emits `rowContextMenu` and renders your
|
|
34
34
|
`ithTableRowMenu` template in a floating panel at the pointer
|
|
35
|
-
- **
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
- **Layout control** — Columns popover, per-column header menu (sort, pin, fit, hide),
|
|
36
|
+
drag-to-reorder headers and drag-to-resize edges; hidden columns, order, widths, pinning and
|
|
37
|
+
density are saved in `localStorage` through `storageKey`, plus named views
|
|
38
|
+
- **Filter chips** — the active search term and every column filter shown as removable chips
|
|
39
|
+
- **Selection bar** — bulk actions appear as soon as rows are selected
|
|
40
|
+
- **CSV & Excel export** — one toolbar menu with a real `.xlsx` (built without dependencies)
|
|
41
|
+
and `.csv`, plus `toCsv()` / `toExcel()` / `downloadCsv()` / `downloadExcel()`
|
|
42
|
+
- **Row detail** — an `#ithTableRowDetail` template expands underneath the row
|
|
43
|
+
- **Footer totals** — `sum`, `avg`, `min`, `max` and `count` per column
|
|
44
|
+
- **Keyboard grid** — one tab stop, arrow keys / Home / End / PageUp / PageDown, Space selects
|
|
45
|
+
- **Sticky columns** — stick the checkbox and actions columns, or pin any column at runtime
|
|
38
46
|
- **Cell tooltips** — full value on hover for truncated cells, opt out per column
|
|
47
|
+
- **Stable height** — `minRows` keeps the empty body space when a page returns fewer rows,
|
|
48
|
+
so a one-row result never collapses into a single line
|
|
39
49
|
- **Skeleton loading** — placeholder rows instead of a blank table, plus a toolbar
|
|
40
50
|
comfortable/compact density toggle
|
|
41
51
|
- **Presentation** — striped, bordered, dense, hover, sticky header, fixed max height, loading overlay
|
|
@@ -185,6 +195,52 @@ Other slots: `ithTableHeader="key"`, `ithTableFilter="key"`, `ithTableRowActions
|
|
|
185
195
|
|
|
186
196
|

|
|
187
197
|
|
|
198
|
+
## Layout control, export & row detail
|
|
199
|
+
|
|
200
|
+
```html
|
|
201
|
+
<ith-table
|
|
202
|
+
[data]="students"
|
|
203
|
+
[columns]="columns"
|
|
204
|
+
[showColumnPicker]="true"
|
|
205
|
+
[resizable]="true"
|
|
206
|
+
[reorderable]="true"
|
|
207
|
+
[showViews]="true"
|
|
208
|
+
[showExport]="true"
|
|
209
|
+
[showFilters]="true"
|
|
210
|
+
storageKey="students-table"
|
|
211
|
+
[selectionActions]="bulkActions"
|
|
212
|
+
(selectionAction)="bulk($event)"
|
|
213
|
+
(columnStateChange)="saveLayout($event)">
|
|
214
|
+
|
|
215
|
+
<ng-template ithTableRowDetail let-row>
|
|
216
|
+
<p>{{ row.email }} — {{ row.guardianMobile }}</p>
|
|
217
|
+
</ng-template>
|
|
218
|
+
</ith-table>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
- **Header menu** — hovering a header shows a `⋮` button with sort asc/desc, pin left/right,
|
|
222
|
+
unpin, fit to content and hide. `showColumnMenu` (default `true`) turns it off.
|
|
223
|
+
- **Resize & reorder** — `resizable` drags the column edge (minimum 56 px), `reorderable`
|
|
224
|
+
drags a header onto another. Both changes are stored in the preset.
|
|
225
|
+
- **Named views** — `showViews` adds a Views menu: save the current layout under a name and
|
|
226
|
+
apply it later. The layout itself is still restored automatically through `storageKey`.
|
|
227
|
+
- **Filter chips** — with an active search or filter the toolbar shows removable chips plus
|
|
228
|
+
"Clear all". `showFilterChips` (default `true`) hides them.
|
|
229
|
+
- **Selection bar** — pass `selectionActions` and the bar appears whenever rows are selected;
|
|
230
|
+
`(selectionAction)` emits `{ action, rows }`.
|
|
231
|
+
- **Row detail** — with an `#ithTableRowDetail` template each row gets a chevron
|
|
232
|
+
(`rowDetailTrigger="button"`), or expands on row click (`"row"`).
|
|
233
|
+
- **CSV & Excel export** — `showExport` renders the button with a two-item menu:
|
|
234
|
+
`.xlsx` (a real workbook with a bold frozen header row, autofilter and column widths,
|
|
235
|
+
generated in the browser without any dependency) and `.csv` (UTF-8 with BOM).
|
|
236
|
+
`toCsv()` / `toExcel()` return the data and `downloadCsv()` / `downloadExcel()` save it;
|
|
237
|
+
selected rows win over the whole filtered set.
|
|
238
|
+
- **Footer totals** — add `aggregate: 'sum'` (or `avg`/`min`/`max`/`count`) to a column, or
|
|
239
|
+
`aggregate: { type: 'avg', label: 'Average', format: (n) => n.toFixed(1) }`.
|
|
240
|
+
- **Keyboard** — the grid has a single tab stop: arrows move, `Home`/`End` jump within a row,
|
|
241
|
+
`Ctrl+Home`/`Ctrl+End` to the corners, `PageUp`/`PageDown` move a page, `Space` selects the
|
|
242
|
+
row and `Ctrl/Cmd+C` copies the focused cell.
|
|
243
|
+
|
|
188
244
|
## Row actions
|
|
189
245
|
|
|
190
246
|
```typescript
|
|
@@ -262,8 +318,8 @@ Light/dark/auto follows the same convention as `@ithouse-bd/ngx-dropdown`: set
|
|
|
262
318
|
`data-theme="light" | "dark" | "auto"` on `<html>` or `<body>`. All variables are listed
|
|
263
319
|
in the [theming guide](https://github.com/ithouse-bd/angular-libs/blob/main/libs/ngx-table/THEMING.md).
|
|
264
320
|
|
|
265
|
-
The component ships ~
|
|
266
|
-
Angular default `anyComponentStyle` budget (8 kB error), raise it to `
|
|
321
|
+
The component ships ~36 kB of scoped CSS (~6 kB gzipped). If your `angular.json` keeps the
|
|
322
|
+
Angular default `anyComponentStyle` budget (8 kB error), raise it to `32kb`/`40kb`.
|
|
267
323
|
|
|
268
324
|
## API at a glance
|
|
269
325
|
|
|
@@ -286,9 +342,19 @@ Angular default `anyComponentStyle` budget (8 kB error), raise it to `16kb`/`20k
|
|
|
286
342
|
| `loading` | `boolean` | `false` | Loading overlay |
|
|
287
343
|
| `striped` / `bordered` / `dense` / `hoverable` | `boolean` | `false` / `false` / `false` / `true` | Presentation modifiers |
|
|
288
344
|
| `stickyHeader` / `maxHeight` | `boolean` / `string` | `false` / `''` | Scroll container behaviour |
|
|
345
|
+
| `minRows` | `number` | `4` | Empty body space kept when there are fewer rows |
|
|
346
|
+
| `showColumnMenu` | `boolean` | `true` | Header `⋮` menu (sort, pin, fit, hide) |
|
|
347
|
+
| `resizable` / `reorderable` | `boolean` | `false` | Drag to resize / reorder columns |
|
|
348
|
+
| `showViews` | `boolean` | `false` | Named-layout menu |
|
|
349
|
+
| `showExport` / `exportFileName` | `boolean` / `string` | `false` / `'table'` | CSV export button |
|
|
350
|
+
| `showFilterChips` | `boolean` | `true` | Removable chips for active filters |
|
|
351
|
+
| `selectionActions` | `TableSelectionAction<T>[]` | `[]` | Bulk actions in the selection bar |
|
|
352
|
+
| `rowDetailTrigger` | `'button' \| 'row' \| 'none'` | `'button'` | How `#ithTableRowDetail` expands |
|
|
353
|
+
| `keyboardNavigation` | `boolean` | `true` | Single tab stop + arrow keys |
|
|
289
354
|
|
|
290
355
|
Outputs: `sortChange`, `searchChange`, `filterChange`, `pageChange`, `pageSizeChange`,
|
|
291
|
-
`selectedChange`, `actionClick`, `rowClick
|
|
356
|
+
`selectedChange`, `actionClick`, `rowClick`, `cellCopy`, `rowContextMenu`, `columnsChange`,
|
|
357
|
+
`densityChange`, `columnStateChange`, `selectionAction`, `csvExport`, `exportFile`.
|
|
292
358
|
|
|
293
359
|
Full reference, every template context and recipes:
|
|
294
360
|
**[DOCUMENTATION.md](https://github.com/ithouse-bd/angular-libs/blob/main/libs/ngx-table/DOCUMENTATION.md)**.
|
package/THEMING.md
CHANGED
|
@@ -149,6 +149,8 @@ them individually to opt out of the derivation.
|
|
|
149
149
|
| `--ith-table-cell-padding` | `12px 16px` | Body cell padding |
|
|
150
150
|
| `--ith-table-font-size` | `14px` | Body font size |
|
|
151
151
|
| `--ith-table-header-font-size` | `13px` | Header font size |
|
|
152
|
+
| `--ith-table-row-height` | `46px` | Row height used for sticky offsets and the `minRows` floor |
|
|
153
|
+
| `--ith-table-head-height` | `45px` | Header height used for the `minRows` floor |
|
|
152
154
|
|
|
153
155
|
## Ready-made themes
|
|
154
156
|
|