@toolbox-web/grid 0.6.0 → 1.1.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 +79 -26
- package/all.d.ts +1 -0
- package/all.d.ts.map +1 -1
- package/all.js +1899 -2696
- package/all.js.map +1 -1
- package/index.js +1498 -2489
- 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 +704 -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/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 +9 -1
- 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 +10 -0
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +103 -15
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/index.d.ts +1 -1
- package/lib/core/plugin/index.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 +376 -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 +46 -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 +55 -43
- 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 +76 -66
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +107 -10
- 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 +458 -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 +40 -33
- 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 +31 -17
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +86 -7
- 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 +57 -27
- 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 +35 -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 +33 -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 +33 -19
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +67 -3
- 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 +43 -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 +27 -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 +32 -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 +30 -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/responsive/ResponsivePlugin.d.ts +123 -0
- package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -0
- package/lib/plugins/responsive/index.d.ts +11 -0
- package/lib/plugins/responsive/index.d.ts.map +1 -0
- package/lib/plugins/responsive/index.js +589 -0
- package/lib/plugins/responsive/index.js.map +1 -0
- package/lib/plugins/responsive/types.d.ts +133 -0
- package/lib/plugins/responsive/types.d.ts.map +1 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts +90 -21
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +3 -2
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +125 -144
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +51 -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 +27 -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 +81 -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 +32 -22
- 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 +28 -17
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +30 -2
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +31 -25
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +21 -17
- 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 +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 +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/responsive.umd.js +2 -0
- package/umd/plugins/responsive.umd.js.map +1 -0
- package/umd/plugins/selection.umd.js +3 -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"}
|
|
@@ -119,6 +119,28 @@ class T {
|
|
|
119
119
|
* ```
|
|
120
120
|
*/
|
|
121
121
|
static dependencies;
|
|
122
|
+
/**
|
|
123
|
+
* Plugin manifest - declares owned properties, config rules, and hook priorities.
|
|
124
|
+
*
|
|
125
|
+
* This is read by the configuration validator to:
|
|
126
|
+
* - Validate that required plugins are loaded when their properties are used
|
|
127
|
+
* - Execute configRules to detect invalid/conflicting settings
|
|
128
|
+
* - Order hook execution based on priority
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* static override readonly manifest: PluginManifest<MyConfig> = {
|
|
133
|
+
* ownedProperties: [
|
|
134
|
+
* { property: 'myProp', level: 'column', description: 'the "myProp" column property' },
|
|
135
|
+
* ],
|
|
136
|
+
* configRules: [
|
|
137
|
+
* { id: 'myPlugin/conflict', severity: 'warn', message: '...', check: (c) => c.a && c.b },
|
|
138
|
+
* ],
|
|
139
|
+
* };
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
|
+
static manifest;
|
|
122
144
|
/**
|
|
123
145
|
* Plugin version - defaults to grid version for built-in plugins.
|
|
124
146
|
* Third-party plugins can override with their own semver.
|
|
@@ -278,23 +300,6 @@ class T {
|
|
|
278
300
|
get gridElement() {
|
|
279
301
|
return this.grid;
|
|
280
302
|
}
|
|
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
303
|
/**
|
|
299
304
|
* Get the disconnect signal for event listener cleanup.
|
|
300
305
|
* This signal is aborted when the grid disconnects from the DOM.
|
|
@@ -449,8 +454,11 @@ function M(n, e, t, i) {
|
|
|
449
454
|
}
|
|
450
455
|
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
456
|
class w extends T {
|
|
457
|
+
/** @internal */
|
|
452
458
|
name = "masterDetail";
|
|
459
|
+
/** @internal */
|
|
453
460
|
styles = F;
|
|
461
|
+
/** @internal */
|
|
454
462
|
get defaultConfig() {
|
|
455
463
|
return {
|
|
456
464
|
detailHeight: "auto",
|
|
@@ -465,6 +473,7 @@ class w extends T {
|
|
|
465
473
|
/**
|
|
466
474
|
* Called when plugin is attached to the grid.
|
|
467
475
|
* Parses light DOM for `<tbw-grid-detail>` elements to configure detail templates.
|
|
476
|
+
* @internal
|
|
468
477
|
*/
|
|
469
478
|
attach(e) {
|
|
470
479
|
super.attach(e), this.parseLightDomDetail();
|
|
@@ -572,11 +581,13 @@ class w extends T {
|
|
|
572
581
|
}
|
|
573
582
|
// #endregion
|
|
574
583
|
// #region Lifecycle
|
|
584
|
+
/** @internal */
|
|
575
585
|
detach() {
|
|
576
586
|
this.expandedRows.clear(), this.detailElements.clear();
|
|
577
587
|
}
|
|
578
588
|
// #endregion
|
|
579
589
|
// #region Hooks
|
|
590
|
+
/** @internal */
|
|
580
591
|
processColumns(e) {
|
|
581
592
|
if (!this.config.detailRenderer || this.config.showExpandColumn === !1)
|
|
582
593
|
return [...e];
|
|
@@ -591,15 +602,18 @@ class w extends T {
|
|
|
591
602
|
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
603
|
}, [s, ...t];
|
|
593
604
|
}
|
|
605
|
+
/** @internal */
|
|
594
606
|
onRowClick(e) {
|
|
595
607
|
if (!(!this.config.expandOnRowClick || !this.config.detailRenderer))
|
|
596
608
|
return this.toggleAndEmit(e.row, e.rowIndex), !1;
|
|
597
609
|
}
|
|
610
|
+
/** @internal */
|
|
598
611
|
onCellClick(e) {
|
|
599
612
|
if (e.originalEvent?.target?.classList.contains("master-detail-toggle"))
|
|
600
613
|
return this.toggleAndEmit(e.row, e.rowIndex), !0;
|
|
601
614
|
this.expandedRows.size > 0 && queueMicrotask(() => this.#e());
|
|
602
615
|
}
|
|
616
|
+
/** @internal */
|
|
603
617
|
onKeyDown(e) {
|
|
604
618
|
if (e.key !== " ") return;
|
|
605
619
|
const t = this.grid._focusCol, i = this.grid._focusRow, s = this.columns[t];
|
|
@@ -608,12 +622,14 @@ class w extends T {
|
|
|
608
622
|
if (l)
|
|
609
623
|
return e.preventDefault(), this.toggleAndEmit(l, i), this.requestRenderWithFocus(), !0;
|
|
610
624
|
}
|
|
625
|
+
/** @internal */
|
|
611
626
|
afterRender() {
|
|
612
627
|
this.#e();
|
|
613
628
|
}
|
|
614
629
|
/**
|
|
615
630
|
* Called on scroll to sync detail elements with visible rows.
|
|
616
631
|
* Removes details for rows that scrolled out of view and reattaches for visible rows.
|
|
632
|
+
* @internal
|
|
617
633
|
*/
|
|
618
634
|
onScrollRender() {
|
|
619
635
|
!this.config.detailRenderer || this.expandedRows.size === 0 || this.#e();
|