@toolbox-web/grid 0.5.0 → 1.0.0
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/README.md +80 -27
- package/all.js +725 -1731
- package/all.js.map +1 -1
- package/index.js +1431 -2379
- package/index.js.map +1 -1
- package/lib/core/constants.d.ts +8 -0
- package/lib/core/constants.d.ts.map +1 -1
- package/lib/core/grid.d.ts +721 -55
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/config-manager.d.ts +3 -7
- package/lib/core/internal/config-manager.d.ts.map +1 -1
- package/lib/core/internal/dom-builder.d.ts +2 -10
- package/lib/core/internal/dom-builder.d.ts.map +1 -1
- package/lib/core/internal/event-delegation.d.ts +21 -0
- package/lib/core/internal/event-delegation.d.ts.map +1 -1
- package/lib/core/internal/inference.d.ts.map +1 -1
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/internal/render-scheduler.d.ts +2 -0
- package/lib/core/internal/render-scheduler.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts +10 -2
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts +41 -41
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +2 -15
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +33 -6
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +411 -68
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +89 -2
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.d.ts +2 -0
- package/lib/plugins/clipboard/index.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +24 -35
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +57 -2
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.d.ts +2 -0
- package/lib/plugins/column-virtualization/index.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +7 -17
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +75 -5
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.d.ts +3 -1
- package/lib/plugins/context-menu/index.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +15 -27
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +101 -9
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/editors.d.ts +9 -1
- package/lib/plugins/editing/editors.d.ts.map +1 -1
- package/lib/plugins/editing/index.d.ts +4 -2
- package/lib/plugins/editing/index.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +412 -279
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +88 -0
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/ExportPlugin.d.ts +73 -7
- package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
- package/lib/plugins/export/index.d.ts +2 -0
- package/lib/plugins/export/index.d.ts.map +1 -1
- package/lib/plugins/export/index.js +4 -19
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +98 -2
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.d.ts +2 -0
- package/lib/plugins/filtering/index.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +50 -58
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +80 -6
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.d.ts +2 -0
- package/lib/plugins/grouping-columns/index.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +10 -21
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +81 -5
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.d.ts +3 -1
- package/lib/plugins/grouping-rows/index.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +13 -21
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +90 -5
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.d.ts +2 -0
- package/lib/plugins/master-detail/index.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +11 -17
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +83 -2
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.d.ts +2 -0
- package/lib/plugins/multi-sort/index.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.js +11 -19
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +61 -2
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.d.ts +3 -1
- package/lib/plugins/pinned-columns/index.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +7 -17
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +71 -10
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.d.ts +3 -1
- package/lib/plugins/pinned-rows/index.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +5 -17
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/PivotPlugin.d.ts +81 -4
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.d.ts +2 -0
- package/lib/plugins/pivot/index.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +10 -17
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts +71 -3
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/index.d.ts +2 -0
- package/lib/plugins/reorder/index.d.ts.map +1 -1
- package/lib/plugins/reorder/index.js +8 -18
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/reorder/types.d.ts +0 -5
- package/lib/plugins/reorder/types.d.ts.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +84 -20
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +2 -1
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +70 -131
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +25 -4
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/ServerSidePlugin.d.ts +65 -4
- package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -1
- package/lib/plugins/server-side/index.d.ts +3 -1
- package/lib/plugins/server-side/index.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js +5 -17
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +89 -2
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.d.ts +3 -2
- package/lib/plugins/tree/index.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +59 -94
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +66 -3
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.d.ts +3 -1
- package/lib/plugins/undo-redo/index.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +5 -17
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +86 -2
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.d.ts +2 -0
- package/lib/plugins/visibility/index.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +6 -17
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +6 -6
- package/public.d.ts +72 -2
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +16 -16
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +9 -9
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/column-virtualization.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/export.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js.map +1 -1
- package/umd/plugins/reorder.umd.js +1 -1
- package/umd/plugins/reorder.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/server-side.umd.js.map +1 -1
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
- package/umd/plugins/undo-redo.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
|
@@ -2,25 +2,103 @@ import { BaseGridPlugin, CellClickEvent, GridElement, RowClickEvent } from '../.
|
|
|
2
2
|
import { ColumnConfig } from '../../core/types';
|
|
3
3
|
import { MasterDetailConfig } from './types';
|
|
4
4
|
/**
|
|
5
|
-
* Master
|
|
5
|
+
* Master-Detail Plugin for tbw-grid
|
|
6
|
+
*
|
|
7
|
+
* Creates expandable detail rows that reveal additional content beneath each master row.
|
|
8
|
+
* Perfect for order/line-item UIs, employee/department views, or any scenario where
|
|
9
|
+
* you need to show related data without navigating away.
|
|
10
|
+
*
|
|
11
|
+
* ## Installation
|
|
6
12
|
*
|
|
7
|
-
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { MasterDetailPlugin } from '@toolbox-web/grid/plugins/master-detail';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ## Configuration Options
|
|
18
|
+
*
|
|
19
|
+
* | Option | Type | Default | Description |
|
|
20
|
+
* |--------|------|---------|-------------|
|
|
21
|
+
* | `detailRenderer` | `(row) => HTMLElement \| string` | required | Render function for detail content |
|
|
22
|
+
* | `expandOnRowClick` | `boolean` | `false` | Expand when clicking the row |
|
|
23
|
+
* | `detailHeight` | `number \| 'auto'` | `'auto'` | Fixed height or auto-size |
|
|
24
|
+
* | `collapseOnClickOutside` | `boolean` | `false` | Collapse when clicking outside |
|
|
25
|
+
* | `showExpandColumn` | `boolean` | `true` | Show expand/collapse column |
|
|
26
|
+
* | `animation` | `false \| 'slide' \| 'fade'` | `'slide'` | Animation style |
|
|
27
|
+
*
|
|
28
|
+
* ## Programmatic API
|
|
29
|
+
*
|
|
30
|
+
* | Method | Signature | Description |
|
|
31
|
+
* |--------|-----------|-------------|
|
|
32
|
+
* | `expandRow` | `(rowIndex) => void` | Expand a specific row |
|
|
33
|
+
* | `collapseRow` | `(rowIndex) => void` | Collapse a specific row |
|
|
34
|
+
* | `toggleRow` | `(rowIndex) => void` | Toggle row expansion |
|
|
35
|
+
* | `expandAll` | `() => void` | Expand all rows |
|
|
36
|
+
* | `collapseAll` | `() => void` | Collapse all rows |
|
|
37
|
+
* | `isRowExpanded` | `(rowIndex) => boolean` | Check if row is expanded |
|
|
38
|
+
*
|
|
39
|
+
* ## CSS Custom Properties
|
|
40
|
+
*
|
|
41
|
+
* | Property | Default | Description |
|
|
42
|
+
* |----------|---------|-------------|
|
|
43
|
+
* | `--tbw-master-detail-bg` | `var(--tbw-color-row-alt)` | Detail row background |
|
|
44
|
+
* | `--tbw-master-detail-border` | `var(--tbw-color-border)` | Detail row border |
|
|
45
|
+
* | `--tbw-detail-padding` | `1em` | Detail content padding |
|
|
46
|
+
* | `--tbw-animation-duration` | `200ms` | Expand/collapse animation |
|
|
47
|
+
*
|
|
48
|
+
* @example Basic Master-Detail with HTML Template
|
|
49
|
+
* ```ts
|
|
50
|
+
* import '@toolbox-web/grid';
|
|
51
|
+
* import { MasterDetailPlugin } from '@toolbox-web/grid/plugins/master-detail';
|
|
52
|
+
*
|
|
53
|
+
* grid.gridConfig = {
|
|
54
|
+
* columns: [
|
|
55
|
+
* { field: 'orderId', header: 'Order ID' },
|
|
56
|
+
* { field: 'customer', header: 'Customer' },
|
|
57
|
+
* { field: 'total', header: 'Total', type: 'currency' },
|
|
58
|
+
* ],
|
|
59
|
+
* plugins: [
|
|
60
|
+
* new MasterDetailPlugin({
|
|
61
|
+
* detailRenderer: (row) => `
|
|
62
|
+
* <div class="order-details">
|
|
63
|
+
* <h4>Order Items</h4>
|
|
64
|
+
* <ul>${row.items.map(i => `<li>${i.name} - $${i.price}</li>`).join('')}</ul>
|
|
65
|
+
* </div>
|
|
66
|
+
* `,
|
|
67
|
+
* }),
|
|
68
|
+
* ],
|
|
69
|
+
* };
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example Nested Grid in Detail
|
|
8
73
|
* ```ts
|
|
9
74
|
* new MasterDetailPlugin({
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
75
|
+
* detailRenderer: (row) => {
|
|
76
|
+
* const childGrid = document.createElement('tbw-grid');
|
|
77
|
+
* childGrid.style.height = '200px';
|
|
78
|
+
* childGrid.gridConfig = { columns: [...] };
|
|
79
|
+
* childGrid.rows = row.items || [];
|
|
80
|
+
* return childGrid;
|
|
81
|
+
* },
|
|
13
82
|
* })
|
|
14
83
|
* ```
|
|
84
|
+
*
|
|
85
|
+
* @see {@link MasterDetailConfig} for all configuration options
|
|
86
|
+
* @see {@link DetailExpandDetail} for expand/collapse event details
|
|
87
|
+
*
|
|
88
|
+
* @internal Extends BaseGridPlugin
|
|
15
89
|
*/
|
|
16
90
|
export declare class MasterDetailPlugin extends BaseGridPlugin<MasterDetailConfig> {
|
|
17
91
|
#private;
|
|
92
|
+
/** @internal */
|
|
18
93
|
readonly name = "masterDetail";
|
|
94
|
+
/** @internal */
|
|
19
95
|
readonly styles: string;
|
|
96
|
+
/** @internal */
|
|
20
97
|
protected get defaultConfig(): Partial<MasterDetailConfig>;
|
|
21
98
|
/**
|
|
22
99
|
* Called when plugin is attached to the grid.
|
|
23
100
|
* Parses light DOM for `<tbw-grid-detail>` elements to configure detail templates.
|
|
101
|
+
* @internal
|
|
24
102
|
*/
|
|
25
103
|
attach(grid: GridElement): void;
|
|
26
104
|
/**
|
|
@@ -71,15 +149,22 @@ export declare class MasterDetailPlugin extends BaseGridPlugin<MasterDetailConfi
|
|
|
71
149
|
* Toggle a row's detail and emit event.
|
|
72
150
|
*/
|
|
73
151
|
private toggleAndEmit;
|
|
152
|
+
/** @internal */
|
|
74
153
|
detach(): void;
|
|
154
|
+
/** @internal */
|
|
75
155
|
processColumns(columns: readonly ColumnConfig[]): ColumnConfig[];
|
|
156
|
+
/** @internal */
|
|
76
157
|
onRowClick(event: RowClickEvent): boolean | void;
|
|
158
|
+
/** @internal */
|
|
77
159
|
onCellClick(event: CellClickEvent): boolean | void;
|
|
160
|
+
/** @internal */
|
|
78
161
|
onKeyDown(event: KeyboardEvent): boolean | void;
|
|
162
|
+
/** @internal */
|
|
79
163
|
afterRender(): void;
|
|
80
164
|
/**
|
|
81
165
|
* Called on scroll to sync detail elements with visible rows.
|
|
82
166
|
* Removes details for rows that scrolled out of view and reattaches for visible rows.
|
|
167
|
+
* @internal
|
|
83
168
|
*/
|
|
84
169
|
onScrollRender(): void;
|
|
85
170
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MasterDetailPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/master-detail/MasterDetailPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE3G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AASrD,OAAO,KAAK,EAA+C,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE/F
|
|
1
|
+
{"version":3,"file":"MasterDetailPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/master-detail/MasterDetailPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE3G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AASrD,OAAO,KAAK,EAA+C,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,qBAAa,kBAAmB,SAAQ,cAAc,CAAC,kBAAkB,CAAC;;IACxE,gBAAgB;IAChB,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,gBAAgB;IAChB,SAAkB,MAAM,SAAU;IAElC,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAQlE;IAID;;;;OAIG;IACM,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAKxC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,mBAAmB;IAqE3B;;;OAGG;IACH,OAAO,KAAK,cAAc,GAGzB;IAED;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;OAEG;IACH,OAAO,CAAC,eAAe;IAmBvB,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,cAAc,CAAoC;IAE1D,yDAAyD;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAO;IAEpD;;OAEG;IACH,OAAO,CAAC,eAAe;IAQvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB,gBAAgB;IACP,MAAM,IAAI,IAAI;IAQvB,gBAAgB;IACP,cAAc,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,EAAE;IA2CzE,gBAAgB;IACP,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI;IAMzD,gBAAgB;IACP,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,GAAG,IAAI;IAgB3D,gBAAgB;IACP,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI;IAsBxD,gBAAgB;IACP,WAAW,IAAI,IAAI;IAI5B;;;;OAIG;IACM,cAAc,IAAI,IAAI;IA2E/B;;;OAGG;IACM,cAAc,IAAI,MAAM;IAQjC;;;OAGG;IACM,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM;IAY7D;;;OAGG;IACM,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IA8CxF;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQhC;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ9B;;;;OAIG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAKrC;;OAEG;IACH,SAAS,IAAI,IAAI;IAOjB;;OAEG;IACH,WAAW,IAAI,IAAI;IAKnB;;;OAGG;IACH,eAAe,IAAI,MAAM,EAAE;IAS3B;;;;OAIG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAK3D;;;;;;OAMG;IACH,qBAAqB,IAAI,IAAI;CA0B9B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Master Detail Plugin Entry Point
|
|
3
3
|
* Re-exports plugin class and types for tree-shakeable imports.
|
|
4
|
+
*
|
|
5
|
+
* @module Plugins/Master-Detail
|
|
4
6
|
*/
|
|
5
7
|
export { MasterDetailPlugin } from './MasterDetailPlugin';
|
|
6
8
|
export type { ExpandCollapseAnimation, MasterDetailConfig } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/master-detail/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/master-detail/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -278,23 +278,6 @@ class T {
|
|
|
278
278
|
get gridElement() {
|
|
279
279
|
return this.grid;
|
|
280
280
|
}
|
|
281
|
-
/**
|
|
282
|
-
* Get the render root of the grid for DOM queries.
|
|
283
|
-
* @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
|
|
284
|
-
*
|
|
285
|
-
* With Shadow DOM removed, the grid element itself is the render root.
|
|
286
|
-
* All new code should use `this.gridElement` for DOM queries.
|
|
287
|
-
*
|
|
288
|
-
* @example
|
|
289
|
-
* // OLD (deprecated)
|
|
290
|
-
* const rows = this.shadowRoot?.querySelector('.rows');
|
|
291
|
-
*
|
|
292
|
-
* // NEW (preferred)
|
|
293
|
-
* const rows = this.gridElement.querySelector('.rows');
|
|
294
|
-
*/
|
|
295
|
-
get shadowRoot() {
|
|
296
|
-
return this.gridElement;
|
|
297
|
-
}
|
|
298
281
|
/**
|
|
299
282
|
* Get the disconnect signal for event listener cleanup.
|
|
300
283
|
* This signal is aborted when the grid disconnects from the DOM.
|
|
@@ -449,8 +432,11 @@ function M(n, e, t, i) {
|
|
|
449
432
|
}
|
|
450
433
|
const F = "@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}tbw-grid .master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}tbw-grid .master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center}tbw-grid .master-detail-toggle:hover{opacity:1}tbw-grid .master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}tbw-grid .master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}tbw-grid .master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
|
|
451
434
|
class w extends T {
|
|
435
|
+
/** @internal */
|
|
452
436
|
name = "masterDetail";
|
|
437
|
+
/** @internal */
|
|
453
438
|
styles = F;
|
|
439
|
+
/** @internal */
|
|
454
440
|
get defaultConfig() {
|
|
455
441
|
return {
|
|
456
442
|
detailHeight: "auto",
|
|
@@ -465,6 +451,7 @@ class w extends T {
|
|
|
465
451
|
/**
|
|
466
452
|
* Called when plugin is attached to the grid.
|
|
467
453
|
* Parses light DOM for `<tbw-grid-detail>` elements to configure detail templates.
|
|
454
|
+
* @internal
|
|
468
455
|
*/
|
|
469
456
|
attach(e) {
|
|
470
457
|
super.attach(e), this.parseLightDomDetail();
|
|
@@ -572,11 +559,13 @@ class w extends T {
|
|
|
572
559
|
}
|
|
573
560
|
// #endregion
|
|
574
561
|
// #region Lifecycle
|
|
562
|
+
/** @internal */
|
|
575
563
|
detach() {
|
|
576
564
|
this.expandedRows.clear(), this.detailElements.clear();
|
|
577
565
|
}
|
|
578
566
|
// #endregion
|
|
579
567
|
// #region Hooks
|
|
568
|
+
/** @internal */
|
|
580
569
|
processColumns(e) {
|
|
581
570
|
if (!this.config.detailRenderer || this.config.showExpandColumn === !1)
|
|
582
571
|
return [...e];
|
|
@@ -591,15 +580,18 @@ class w extends T {
|
|
|
591
580
|
return d.className = `master-detail-toggle${r ? " expanded" : ""}`, this.setIcon(d, this.resolveIcon(r ? "collapse" : "expand")), d.setAttribute("role", "button"), d.setAttribute("tabindex", "0"), d.setAttribute("aria-expanded", String(r)), d.setAttribute("aria-label", r ? "Collapse details" : "Expand details"), a.appendChild(d), a;
|
|
592
581
|
}, [s, ...t];
|
|
593
582
|
}
|
|
583
|
+
/** @internal */
|
|
594
584
|
onRowClick(e) {
|
|
595
585
|
if (!(!this.config.expandOnRowClick || !this.config.detailRenderer))
|
|
596
586
|
return this.toggleAndEmit(e.row, e.rowIndex), !1;
|
|
597
587
|
}
|
|
588
|
+
/** @internal */
|
|
598
589
|
onCellClick(e) {
|
|
599
590
|
if (e.originalEvent?.target?.classList.contains("master-detail-toggle"))
|
|
600
591
|
return this.toggleAndEmit(e.row, e.rowIndex), !0;
|
|
601
592
|
this.expandedRows.size > 0 && queueMicrotask(() => this.#e());
|
|
602
593
|
}
|
|
594
|
+
/** @internal */
|
|
603
595
|
onKeyDown(e) {
|
|
604
596
|
if (e.key !== " ") return;
|
|
605
597
|
const t = this.grid._focusCol, i = this.grid._focusRow, s = this.columns[t];
|
|
@@ -608,12 +600,14 @@ class w extends T {
|
|
|
608
600
|
if (l)
|
|
609
601
|
return e.preventDefault(), this.toggleAndEmit(l, i), this.requestRenderWithFocus(), !0;
|
|
610
602
|
}
|
|
603
|
+
/** @internal */
|
|
611
604
|
afterRender() {
|
|
612
605
|
this.#e();
|
|
613
606
|
}
|
|
614
607
|
/**
|
|
615
608
|
* Called on scroll to sync detail elements with visible rows.
|
|
616
609
|
* Removes details for rows that scrolled out of view and reattaches for visible rows.
|
|
610
|
+
* @internal
|
|
617
611
|
*/
|
|
618
612
|
onScrollRender() {
|
|
619
613
|
!this.config.detailRenderer || this.expandedRows.size === 0 || this.#e();
|