@toolbox-web/grid 0.6.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 +79 -26
- package/all.js +731 -1739
- package/all.js.map +1 -1
- package/index.js +1382 -2410
- 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.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 +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 +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 +1 -1
- package/public.d.ts +30 -2
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +19 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +11 -11
- 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
package/lib/core/grid.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CellMouseEvent } from './plugin';
|
|
2
2
|
import { BaseGridPlugin, PluginQuery } from './plugin/base-plugin';
|
|
3
|
-
import { ColumnConfig, ColumnConfigMap, ColumnInternal, FitMode, FrameworkAdapter, GridColumnState, GridConfig, HeaderContentDefinition, InternalGrid, ResizeController,
|
|
3
|
+
import { ColumnConfig, ColumnConfigMap, ColumnInternal, FitMode, FrameworkAdapter, GridColumnState, GridConfig, HeaderContentDefinition, InternalGrid, ResizeController, ToolbarContentDefinition, ToolPanelDefinition, UpdateSource, VirtualState } from './types';
|
|
4
4
|
export declare class DataGridElement<T = any> extends HTMLElement implements InternalGrid<T> {
|
|
5
5
|
#private;
|
|
6
6
|
static readonly tagName = "tbw-grid";
|
|
7
|
+
/** Version of the grid component, injected at build time from package.json */
|
|
7
8
|
static readonly version: string;
|
|
8
9
|
/**
|
|
9
10
|
* Registry of framework adapters that handle converting light DOM elements
|
|
@@ -23,29 +24,21 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
23
24
|
* // One-time setup in app
|
|
24
25
|
* GridElement.registerAdapter(new AngularGridAdapter(injector, appRef));
|
|
25
26
|
* ```
|
|
27
|
+
* @category Framework Adapters
|
|
26
28
|
*/
|
|
27
29
|
static registerAdapter(adapter: FrameworkAdapter): void;
|
|
28
30
|
/**
|
|
29
31
|
* Get all registered framework adapters.
|
|
30
32
|
* Used internally by light DOM parsing to find adapters that can handle templates.
|
|
33
|
+
* @category Framework Adapters
|
|
31
34
|
*/
|
|
32
35
|
static getAdapters(): readonly FrameworkAdapter[];
|
|
33
36
|
/**
|
|
34
37
|
* Clear all registered adapters (primarily for testing).
|
|
38
|
+
* @category Framework Adapters
|
|
35
39
|
*/
|
|
36
40
|
static clearAdapters(): void;
|
|
37
41
|
static get observedAttributes(): string[];
|
|
38
|
-
/**
|
|
39
|
-
* Access the grid's ShadowRoot.
|
|
40
|
-
*
|
|
41
|
-
* Note: The grid renders into its light DOM and does not attach a shadow root,
|
|
42
|
-
* so this getter returns `null`. Use `grid.querySelector()` directly for DOM queries.
|
|
43
|
-
*
|
|
44
|
-
* @deprecated This property returns `null` since Shadow DOM was removed.
|
|
45
|
-
* Use `grid.querySelector()` or `grid.querySelectorAll()` directly.
|
|
46
|
-
* @returns null (no shadow root is attached)
|
|
47
|
-
*/
|
|
48
|
-
get shadowRoot(): ShadowRoot | null;
|
|
49
42
|
_rows: T[];
|
|
50
43
|
get _columns(): ColumnInternal<T>[];
|
|
51
44
|
set _columns(value: ColumnInternal<T>[]);
|
|
@@ -80,25 +73,134 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
80
73
|
*/
|
|
81
74
|
__frameworkAdapter?: FrameworkAdapter;
|
|
82
75
|
__rowsBodyEl: HTMLElement | null;
|
|
76
|
+
/**
|
|
77
|
+
* Get or set the row data displayed in the grid.
|
|
78
|
+
*
|
|
79
|
+
* The getter returns processed rows (after filtering, sorting, grouping by plugins).
|
|
80
|
+
* The setter accepts new source data and triggers a re-render.
|
|
81
|
+
*
|
|
82
|
+
* @group Configuration
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* // Set initial data
|
|
86
|
+
* grid.rows = employees;
|
|
87
|
+
*
|
|
88
|
+
* // Update with new data (triggers re-render)
|
|
89
|
+
* grid.rows = [...employees, newEmployee];
|
|
90
|
+
*
|
|
91
|
+
* // Read current (processed) rows
|
|
92
|
+
* console.log(`Displaying ${grid.rows.length} rows`);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
83
95
|
get rows(): T[];
|
|
84
96
|
set rows(value: T[]);
|
|
85
97
|
/**
|
|
86
|
-
* Get the original unfiltered/unprocessed rows.
|
|
87
|
-
*
|
|
98
|
+
* Get the original unfiltered/unprocessed source rows.
|
|
99
|
+
*
|
|
100
|
+
* Use this when you need access to all source data regardless of active
|
|
101
|
+
* filters, sorting, or grouping applied by plugins. The `rows` property
|
|
102
|
+
* returns processed data, while `sourceRows` returns the original input.
|
|
103
|
+
*
|
|
104
|
+
* @group Configuration
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* // Get total count including filtered-out rows
|
|
108
|
+
* console.log(`${grid.rows.length} of ${grid.sourceRows.length} rows visible`);
|
|
109
|
+
*
|
|
110
|
+
* // Export all data, not just visible
|
|
111
|
+
* exportToCSV(grid.sourceRows);
|
|
112
|
+
* ```
|
|
88
113
|
*/
|
|
89
114
|
get sourceRows(): T[];
|
|
115
|
+
/**
|
|
116
|
+
* Get or set the column configurations.
|
|
117
|
+
*
|
|
118
|
+
* The getter returns processed columns (after plugin transformations).
|
|
119
|
+
* The setter accepts an array of column configs or a column config map.
|
|
120
|
+
*
|
|
121
|
+
* @group Configuration
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* // Set columns as array
|
|
125
|
+
* grid.columns = [
|
|
126
|
+
* { field: 'name', header: 'Name', width: 200 },
|
|
127
|
+
* { field: 'email', header: 'Email' },
|
|
128
|
+
* { field: 'role', header: 'Role', width: 120 }
|
|
129
|
+
* ];
|
|
130
|
+
*
|
|
131
|
+
* // Set columns as map (keyed by field)
|
|
132
|
+
* grid.columns = {
|
|
133
|
+
* name: { header: 'Name', width: 200 },
|
|
134
|
+
* email: { header: 'Email' },
|
|
135
|
+
* role: { header: 'Role', width: 120 }
|
|
136
|
+
* };
|
|
137
|
+
*
|
|
138
|
+
* // Read current columns
|
|
139
|
+
* grid.columns.forEach(col => {
|
|
140
|
+
* console.log(`${col.field}: ${col.width ?? 'auto'}`);
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
90
144
|
get columns(): ColumnConfig<T>[];
|
|
91
145
|
set columns(value: ColumnConfig<T>[] | ColumnConfigMap<T> | undefined);
|
|
146
|
+
/**
|
|
147
|
+
* Get or set the full grid configuration object.
|
|
148
|
+
*
|
|
149
|
+
* The getter returns the effective (merged) configuration.
|
|
150
|
+
* The setter accepts a new configuration and triggers a full re-render.
|
|
151
|
+
*
|
|
152
|
+
* @group Configuration
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* import { SelectionPlugin, SortingPlugin } from '@toolbox-web/grid/all';
|
|
156
|
+
*
|
|
157
|
+
* // Set full configuration
|
|
158
|
+
* grid.gridConfig = {
|
|
159
|
+
* columns: [
|
|
160
|
+
* { field: 'name', header: 'Name' },
|
|
161
|
+
* { field: 'status', header: 'Status' }
|
|
162
|
+
* ],
|
|
163
|
+
* fitMode: 'stretch',
|
|
164
|
+
* plugins: [
|
|
165
|
+
* new SelectionPlugin({ mode: 'row' }),
|
|
166
|
+
* new SortingPlugin()
|
|
167
|
+
* ]
|
|
168
|
+
* };
|
|
169
|
+
*
|
|
170
|
+
* // Read current configuration
|
|
171
|
+
* console.log('Fit mode:', grid.gridConfig.fitMode);
|
|
172
|
+
* console.log('Columns:', grid.gridConfig.columns?.length);
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
92
175
|
get gridConfig(): GridConfig<T>;
|
|
93
176
|
set gridConfig(value: GridConfig<T> | undefined);
|
|
177
|
+
/**
|
|
178
|
+
* Get or set the column sizing mode.
|
|
179
|
+
*
|
|
180
|
+
* - `'stretch'` (default): Columns stretch to fill available width
|
|
181
|
+
* - `'fixed'`: Columns use explicit widths; horizontal scroll if needed
|
|
182
|
+
* - `'auto'`: Columns auto-size to content on initial render
|
|
183
|
+
*
|
|
184
|
+
* @group Configuration
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* // Use fixed widths with horizontal scroll
|
|
188
|
+
* grid.fitMode = 'fixed';
|
|
189
|
+
*
|
|
190
|
+
* // Stretch columns to fill container
|
|
191
|
+
* grid.fitMode = 'stretch';
|
|
192
|
+
*
|
|
193
|
+
* // Auto-size columns based on content
|
|
194
|
+
* grid.fitMode = 'auto';
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
94
197
|
get fitMode(): FitMode;
|
|
95
198
|
set fitMode(value: FitMode | undefined);
|
|
96
|
-
get editOn(): string | boolean | undefined;
|
|
97
|
-
set editOn(value: string | boolean | undefined);
|
|
98
199
|
/**
|
|
99
200
|
* Effective config accessor for internal modules and plugins.
|
|
100
201
|
* Returns the merged config (single source of truth) before plugin processing.
|
|
101
202
|
* Use this when you need the raw merged config (e.g., for column definitions including hidden).
|
|
203
|
+
* @group State Access
|
|
102
204
|
* @internal Plugin API
|
|
103
205
|
*/
|
|
104
206
|
get effectiveConfig(): GridConfig<T>;
|
|
@@ -106,21 +208,27 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
106
208
|
* Get the disconnect signal for event listener cleanup.
|
|
107
209
|
* This signal is aborted when the grid disconnects from the DOM.
|
|
108
210
|
* Plugins and internal code can use this for automatic listener cleanup.
|
|
211
|
+
* @group State Access
|
|
109
212
|
* @internal Plugin API
|
|
110
213
|
* @example
|
|
111
214
|
* element.addEventListener('click', handler, { signal: this.grid.disconnectSignal });
|
|
112
215
|
*/
|
|
113
216
|
get disconnectSignal(): AbortSignal;
|
|
217
|
+
/**
|
|
218
|
+
* @internal Do not call directly. Use `createGrid()` or `document.createElement('tbw-grid')`.
|
|
219
|
+
*/
|
|
114
220
|
constructor();
|
|
115
221
|
/**
|
|
116
222
|
* Get a plugin instance by its class.
|
|
117
223
|
* Used by plugins for inter-plugin communication.
|
|
224
|
+
* @group Plugin Communication
|
|
118
225
|
* @internal Plugin API
|
|
119
226
|
*/
|
|
120
227
|
getPlugin<P extends BaseGridPlugin>(PluginClass: new (...args: any[]) => P): P | undefined;
|
|
121
228
|
/**
|
|
122
229
|
* Get a plugin instance by its name.
|
|
123
230
|
* Used for loose coupling between plugins (avoids static imports).
|
|
231
|
+
* @group Plugin Communication
|
|
124
232
|
* @internal Plugin API
|
|
125
233
|
*/
|
|
126
234
|
getPluginByName(name: string): BaseGridPlugin | undefined;
|
|
@@ -128,6 +236,7 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
128
236
|
* Request a full re-render of the grid.
|
|
129
237
|
* Called by plugins when they need the grid to update.
|
|
130
238
|
* Note: This does NOT reset plugin state - just re-processes rows/columns and renders.
|
|
239
|
+
* @group Rendering
|
|
131
240
|
* @internal Plugin API
|
|
132
241
|
*/
|
|
133
242
|
requestRender(): void;
|
|
@@ -135,33 +244,40 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
135
244
|
* Request a full re-render and restore focus styling afterward.
|
|
136
245
|
* Use this when a plugin action (like expand/collapse) triggers a render
|
|
137
246
|
* but needs to maintain keyboard navigation focus.
|
|
247
|
+
* @group Rendering
|
|
138
248
|
* @internal Plugin API
|
|
139
249
|
*/
|
|
140
250
|
requestRenderWithFocus(): void;
|
|
141
251
|
/**
|
|
142
252
|
* Update the grid's column template CSS.
|
|
143
253
|
* Called by resize controller during column resize operations.
|
|
144
|
-
* @
|
|
254
|
+
* @group Rendering
|
|
255
|
+
* @internal Plugin API
|
|
145
256
|
*/
|
|
146
257
|
updateTemplate(): void;
|
|
147
258
|
/**
|
|
148
259
|
* Request a lightweight style update without rebuilding DOM.
|
|
149
260
|
* Called by plugins when they only need to update CSS classes/styles.
|
|
150
261
|
* This runs all plugin afterRender hooks without rebuilding row/column DOM.
|
|
262
|
+
* @group Rendering
|
|
151
263
|
* @internal Plugin API
|
|
152
264
|
*/
|
|
153
265
|
requestAfterRender(): void;
|
|
266
|
+
/** @internal Web component lifecycle - not part of public API */
|
|
154
267
|
connectedCallback(): void;
|
|
268
|
+
/** @internal Web component lifecycle - not part of public API */
|
|
155
269
|
disconnectedCallback(): void;
|
|
156
270
|
/**
|
|
157
271
|
* Handle HTML attribute changes.
|
|
158
272
|
* Only processes attribute values when SET (non-null).
|
|
159
273
|
* Removing an attribute does NOT clear JS-set properties.
|
|
274
|
+
* @internal Web component lifecycle - not part of public API
|
|
160
275
|
*/
|
|
161
276
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
162
277
|
/**
|
|
163
278
|
* Find the header row element in the shadow DOM.
|
|
164
279
|
* Used by plugins that need to access header cells for styling or measurement.
|
|
280
|
+
* @group DOM Access
|
|
165
281
|
* @internal Plugin API
|
|
166
282
|
*/
|
|
167
283
|
findHeaderRow(): HTMLElement;
|
|
@@ -169,18 +285,28 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
169
285
|
* Find a rendered row element by its data row index.
|
|
170
286
|
* Returns null if the row is not currently rendered (virtualized out of view).
|
|
171
287
|
* Used by plugins that need to access specific row elements for styling or measurement.
|
|
288
|
+
* @group DOM Access
|
|
172
289
|
* @internal Plugin API
|
|
173
290
|
* @param rowIndex - The data row index (not the DOM position)
|
|
174
291
|
*/
|
|
175
292
|
findRenderedRowElement(rowIndex: number): HTMLElement | null;
|
|
176
293
|
/**
|
|
177
|
-
* Dispatch a cell click event to the plugin system.
|
|
178
|
-
*
|
|
294
|
+
* Dispatch a cell click event to the plugin system, then emit a public event.
|
|
295
|
+
* Plugins get first chance to handle the event. After plugins process it,
|
|
296
|
+
* a `cell-click` CustomEvent is dispatched for external listeners.
|
|
297
|
+
*
|
|
298
|
+
* @returns `true` if any plugin handled (consumed) the event, or if consumer canceled
|
|
299
|
+
* @fires cell-activate - Unified activation event (cancelable) - fires FIRST
|
|
300
|
+
* @fires cell-click - Emitted after plugins process the click, with full cell context
|
|
179
301
|
*/
|
|
180
302
|
_dispatchCellClick(event: MouseEvent, rowIndex: number, colIndex: number, cellEl: HTMLElement): boolean;
|
|
181
303
|
/**
|
|
182
|
-
* Dispatch a row click event to the plugin system.
|
|
183
|
-
*
|
|
304
|
+
* Dispatch a row click event to the plugin system, then emit a public event.
|
|
305
|
+
* Plugins get first chance to handle the event. After plugins process it,
|
|
306
|
+
* a `row-click` CustomEvent is dispatched for external listeners.
|
|
307
|
+
*
|
|
308
|
+
* @returns `true` if any plugin handled (consumed) the event
|
|
309
|
+
* @fires row-click - Emitted after plugins process the click, with full row context
|
|
184
310
|
*/
|
|
185
311
|
_dispatchRowClick(event: MouseEvent, rowIndex: number, row: any, rowEl: HTMLElement): boolean;
|
|
186
312
|
/**
|
|
@@ -206,6 +332,7 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
206
332
|
/**
|
|
207
333
|
* Query all plugins with a generic query and collect responses.
|
|
208
334
|
* This enables inter-plugin communication without the core knowing plugin-specific concepts.
|
|
335
|
+
* @group Plugin Communication
|
|
209
336
|
* @internal Plugin API
|
|
210
337
|
*
|
|
211
338
|
* @example
|
|
@@ -217,34 +344,233 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
217
344
|
/**
|
|
218
345
|
* Dispatch cell mouse events for drag operations.
|
|
219
346
|
* Returns true if any plugin started a drag.
|
|
347
|
+
* @group Event Dispatching
|
|
220
348
|
* @internal Plugin API - called by event-delegation.ts
|
|
221
349
|
*/
|
|
222
350
|
_dispatchCellMouseDown(event: CellMouseEvent): boolean;
|
|
223
351
|
/**
|
|
224
352
|
* Dispatch cell mouse move during drag.
|
|
353
|
+
* @group Event Dispatching
|
|
225
354
|
* @internal Plugin API - called by event-delegation.ts
|
|
226
355
|
*/
|
|
227
356
|
_dispatchCellMouseMove(event: CellMouseEvent): void;
|
|
228
357
|
/**
|
|
229
358
|
* Dispatch cell mouse up to end drag.
|
|
359
|
+
* @group Event Dispatching
|
|
230
360
|
* @internal Plugin API - called by event-delegation.ts
|
|
231
361
|
*/
|
|
232
362
|
_dispatchCellMouseUp(event: CellMouseEvent): void;
|
|
363
|
+
/**
|
|
364
|
+
* Wait for the grid to be ready.
|
|
365
|
+
* Resolves once the component has finished initial setup, including
|
|
366
|
+
* column inference, plugin initialization, and first render.
|
|
367
|
+
*
|
|
368
|
+
* @group Lifecycle
|
|
369
|
+
* @returns Promise that resolves when the grid is ready
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```typescript
|
|
373
|
+
* const grid = document.querySelector('tbw-grid');
|
|
374
|
+
* await grid.ready();
|
|
375
|
+
* console.log('Grid is ready, rows:', grid.rows.length);
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
233
378
|
ready(): Promise<void>;
|
|
379
|
+
/**
|
|
380
|
+
* Force a full layout/render cycle.
|
|
381
|
+
* Use this after programmatic changes that require re-measurement,
|
|
382
|
+
* such as container resize or dynamic style changes.
|
|
383
|
+
*
|
|
384
|
+
* @group Lifecycle
|
|
385
|
+
* @returns Promise that resolves when the render cycle completes
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* ```typescript
|
|
389
|
+
* // After resizing the container
|
|
390
|
+
* container.style.width = '800px';
|
|
391
|
+
* await grid.forceLayout();
|
|
392
|
+
* console.log('Grid re-rendered');
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
234
395
|
forceLayout(): Promise<void>;
|
|
235
396
|
/**
|
|
236
|
-
*
|
|
397
|
+
* Get a frozen snapshot of the current effective configuration.
|
|
398
|
+
* The returned object is read-only and reflects all merged config sources.
|
|
237
399
|
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
* the pool may have excess elements that consume memory unnecessarily.
|
|
400
|
+
* @group Configuration
|
|
401
|
+
* @returns Promise resolving to frozen configuration object
|
|
241
402
|
*
|
|
242
|
-
|
|
403
|
+
* @example
|
|
404
|
+
* ```typescript
|
|
405
|
+
* const config = await grid.getConfig();
|
|
406
|
+
* console.log('Columns:', config.columns?.length);
|
|
407
|
+
* console.log('Fit mode:', config.fitMode);
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
243
410
|
getConfig(): Promise<Readonly<GridConfig<T>>>;
|
|
411
|
+
/**
|
|
412
|
+
* Get the unique ID for a row.
|
|
413
|
+
* Uses the configured `getRowId` function or falls back to `row.id` / `row._id`.
|
|
414
|
+
*
|
|
415
|
+
* @group Data Management
|
|
416
|
+
* @param row - The row object
|
|
417
|
+
* @returns The row's unique identifier
|
|
418
|
+
* @throws Error if no ID can be determined
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```typescript
|
|
422
|
+
* const id = grid.getRowId(row);
|
|
423
|
+
* console.log('Row ID:', id);
|
|
424
|
+
* ```
|
|
425
|
+
*/
|
|
426
|
+
getRowId(row: T): string;
|
|
427
|
+
/**
|
|
428
|
+
* Get a row by its ID.
|
|
429
|
+
* O(1) lookup via internal Map.
|
|
430
|
+
*
|
|
431
|
+
* @group Data Management
|
|
432
|
+
* @param id - Row identifier (from getRowId)
|
|
433
|
+
* @returns The row object, or undefined if not found
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* ```typescript
|
|
437
|
+
* const row = grid.getRow('cargo-123');
|
|
438
|
+
* if (row) {
|
|
439
|
+
* console.log('Found:', row.name);
|
|
440
|
+
* }
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
getRow(id: string): T | undefined;
|
|
444
|
+
/**
|
|
445
|
+
* Update a row by ID.
|
|
446
|
+
* Mutates the row in-place and emits `cell-change` for each changed field.
|
|
447
|
+
*
|
|
448
|
+
* @group Data Management
|
|
449
|
+
* @param id - Row identifier (from getRowId)
|
|
450
|
+
* @param changes - Partial row data to merge
|
|
451
|
+
* @param source - Origin of update (default: 'api')
|
|
452
|
+
* @throws Error if row is not found
|
|
453
|
+
* @fires cell-change - For each field that changed
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```typescript
|
|
457
|
+
* // WebSocket update handler
|
|
458
|
+
* socket.on('cargo-update', (data) => {
|
|
459
|
+
* grid.updateRow(data.id, { status: data.status, eta: data.eta });
|
|
460
|
+
* });
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
updateRow(id: string, changes: Partial<T>, source?: UpdateSource): void;
|
|
464
|
+
/**
|
|
465
|
+
* Batch update multiple rows.
|
|
466
|
+
* More efficient than multiple `updateRow()` calls - single render cycle.
|
|
467
|
+
*
|
|
468
|
+
* @group Data Management
|
|
469
|
+
* @param updates - Array of { id, changes } objects
|
|
470
|
+
* @param source - Origin of updates (default: 'api')
|
|
471
|
+
* @throws Error if any row is not found
|
|
472
|
+
* @fires cell-change - For each field that changed on each row
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```typescript
|
|
476
|
+
* // Bulk status update
|
|
477
|
+
* grid.updateRows([
|
|
478
|
+
* { id: 'cargo-1', changes: { status: 'shipped' } },
|
|
479
|
+
* { id: 'cargo-2', changes: { status: 'shipped' } },
|
|
480
|
+
* ]);
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
updateRows(updates: Array<{
|
|
484
|
+
id: string;
|
|
485
|
+
changes: Partial<T>;
|
|
486
|
+
}>, source?: UpdateSource): void;
|
|
487
|
+
/**
|
|
488
|
+
* Show or hide a column by field name.
|
|
489
|
+
*
|
|
490
|
+
* @group Column Visibility
|
|
491
|
+
* @param field - The field name of the column to modify
|
|
492
|
+
* @param visible - Whether the column should be visible
|
|
493
|
+
* @returns `true` if the visibility changed, `false` if unchanged
|
|
494
|
+
* @fires column-state-change - Emitted when the visibility changes
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```typescript
|
|
498
|
+
* // Hide the email column
|
|
499
|
+
* grid.setColumnVisible('email', false);
|
|
500
|
+
*
|
|
501
|
+
* // Show it again
|
|
502
|
+
* grid.setColumnVisible('email', true);
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
244
505
|
setColumnVisible(field: string, visible: boolean): boolean;
|
|
506
|
+
/**
|
|
507
|
+
* Toggle a column's visibility.
|
|
508
|
+
*
|
|
509
|
+
* @group Column Visibility
|
|
510
|
+
* @param field - The field name of the column to toggle
|
|
511
|
+
* @returns The new visibility state (`true` = visible, `false` = hidden)
|
|
512
|
+
* @fires column-state-change - Emitted when the visibility changes
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```typescript
|
|
516
|
+
* // Toggle the notes column visibility
|
|
517
|
+
* const isNowVisible = grid.toggleColumnVisibility('notes');
|
|
518
|
+
* console.log(`Notes column is now ${isNowVisible ? 'visible' : 'hidden'}`);
|
|
519
|
+
* ```
|
|
520
|
+
*/
|
|
245
521
|
toggleColumnVisibility(field: string): boolean;
|
|
522
|
+
/**
|
|
523
|
+
* Check if a column is currently visible.
|
|
524
|
+
*
|
|
525
|
+
* @group Column Visibility
|
|
526
|
+
* @param field - The field name to check
|
|
527
|
+
* @returns `true` if the column is visible, `false` if hidden
|
|
528
|
+
*
|
|
529
|
+
* @example
|
|
530
|
+
* ```typescript
|
|
531
|
+
* if (grid.isColumnVisible('email')) {
|
|
532
|
+
* console.log('Email column is showing');
|
|
533
|
+
* }
|
|
534
|
+
* ```
|
|
535
|
+
*/
|
|
246
536
|
isColumnVisible(field: string): boolean;
|
|
537
|
+
/**
|
|
538
|
+
* Show all columns, resetting any hidden columns to visible.
|
|
539
|
+
*
|
|
540
|
+
* @group Column Visibility
|
|
541
|
+
* @fires column-state-change - Emitted when column visibility changes
|
|
542
|
+
* @example
|
|
543
|
+
* ```typescript
|
|
544
|
+
* // Reset button handler
|
|
545
|
+
* resetButton.onclick = () => grid.showAllColumns();
|
|
546
|
+
* ```
|
|
547
|
+
*/
|
|
247
548
|
showAllColumns(): void;
|
|
549
|
+
/**
|
|
550
|
+
* Get metadata for all columns including visibility state.
|
|
551
|
+
* Useful for building a column picker UI.
|
|
552
|
+
*
|
|
553
|
+
* @group Column Visibility
|
|
554
|
+
* @returns Array of column info objects
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```typescript
|
|
558
|
+
* // Build a column visibility menu
|
|
559
|
+
* const columns = grid.getAllColumns();
|
|
560
|
+
* columns.forEach(col => {
|
|
561
|
+
* if (!col.utility) { // Skip utility columns like selection checkbox
|
|
562
|
+
* const menuItem = document.createElement('label');
|
|
563
|
+
* menuItem.innerHTML = `
|
|
564
|
+
* <input type="checkbox" ${col.visible ? 'checked' : ''}>
|
|
565
|
+
* ${col.header}
|
|
566
|
+
* `;
|
|
567
|
+
* menuItem.querySelector('input').onchange = () =>
|
|
568
|
+
* grid.toggleColumnVisibility(col.field);
|
|
569
|
+
* menu.appendChild(menuItem);
|
|
570
|
+
* }
|
|
571
|
+
* });
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
248
574
|
getAllColumns(): Array<{
|
|
249
575
|
field: string;
|
|
250
576
|
header: string;
|
|
@@ -252,20 +578,80 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
252
578
|
lockVisible?: boolean;
|
|
253
579
|
utility?: boolean;
|
|
254
580
|
}>;
|
|
581
|
+
/**
|
|
582
|
+
* Set the display order of columns.
|
|
583
|
+
*
|
|
584
|
+
* @group Column Order
|
|
585
|
+
* @param order - Array of field names in desired order
|
|
586
|
+
* @fires column-state-change - Emitted when column order changes
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* ```typescript
|
|
590
|
+
* // Move 'status' column to first position
|
|
591
|
+
* const currentOrder = grid.getColumnOrder();
|
|
592
|
+
* const newOrder = ['status', ...currentOrder.filter(f => f !== 'status')];
|
|
593
|
+
* grid.setColumnOrder(newOrder);
|
|
594
|
+
* ```
|
|
595
|
+
*/
|
|
255
596
|
setColumnOrder(order: string[]): void;
|
|
597
|
+
/**
|
|
598
|
+
* Get the current column display order.
|
|
599
|
+
*
|
|
600
|
+
* @group Column Order
|
|
601
|
+
* @returns Array of field names in display order
|
|
602
|
+
*
|
|
603
|
+
* @example
|
|
604
|
+
* ```typescript
|
|
605
|
+
* const order = grid.getColumnOrder();
|
|
606
|
+
* console.log('Columns:', order.join(', '));
|
|
607
|
+
* ```
|
|
608
|
+
*/
|
|
256
609
|
getColumnOrder(): string[];
|
|
257
610
|
/**
|
|
258
|
-
* Get the current column state
|
|
259
|
-
* Returns a serializable object
|
|
611
|
+
* Get the current column state for persistence.
|
|
612
|
+
* Returns a serializable object including column order, widths, visibility,
|
|
613
|
+
* sort state, and any plugin-specific state.
|
|
614
|
+
*
|
|
615
|
+
* Use this to save user preferences to localStorage or a database.
|
|
616
|
+
*
|
|
617
|
+
* @group State Persistence
|
|
618
|
+
* @returns Serializable column state object
|
|
619
|
+
*
|
|
620
|
+
* @example
|
|
621
|
+
* ```typescript
|
|
622
|
+
* // Save state to localStorage
|
|
623
|
+
* const state = grid.getColumnState();
|
|
624
|
+
* localStorage.setItem('gridState', JSON.stringify(state));
|
|
625
|
+
*
|
|
626
|
+
* // Later, restore the state
|
|
627
|
+
* const saved = localStorage.getItem('gridState');
|
|
628
|
+
* if (saved) {
|
|
629
|
+
* grid.columnState = JSON.parse(saved);
|
|
630
|
+
* }
|
|
631
|
+
* ```
|
|
260
632
|
*/
|
|
261
633
|
getColumnState(): GridColumnState;
|
|
262
634
|
/**
|
|
263
|
-
* Set the column state, restoring
|
|
264
|
-
*
|
|
635
|
+
* Set the column state, restoring all saved preferences.
|
|
636
|
+
* Can be set before or after grid initialization.
|
|
637
|
+
*
|
|
638
|
+
* @group State Persistence
|
|
639
|
+
* @fires column-state-change - Emitted after state is applied (if grid is initialized)
|
|
640
|
+
* @example
|
|
641
|
+
* ```typescript
|
|
642
|
+
* // Restore saved state on page load
|
|
643
|
+
* const grid = document.querySelector('tbw-grid');
|
|
644
|
+
* const saved = localStorage.getItem('myGridState');
|
|
645
|
+
* if (saved) {
|
|
646
|
+
* grid.columnState = JSON.parse(saved);
|
|
647
|
+
* }
|
|
648
|
+
* ```
|
|
265
649
|
*/
|
|
266
650
|
set columnState(state: GridColumnState | undefined);
|
|
267
651
|
/**
|
|
268
652
|
* Get the current column state.
|
|
653
|
+
* Alias for `getColumnState()` for property-style access.
|
|
654
|
+
* @group State Persistence
|
|
269
655
|
*/
|
|
270
656
|
get columnState(): GridColumnState | undefined;
|
|
271
657
|
/**
|
|
@@ -273,54 +659,312 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
273
659
|
* Called internally after resize, reorder, visibility, or sort changes.
|
|
274
660
|
* Plugins should call this after changing their state.
|
|
275
661
|
* The event is debounced to avoid excessive events during drag operations.
|
|
662
|
+
* @group State Persistence
|
|
276
663
|
* @internal Plugin API
|
|
277
664
|
*/
|
|
278
665
|
requestStateChange(): void;
|
|
279
666
|
/**
|
|
280
667
|
* Reset column state to initial configuration.
|
|
281
|
-
* Clears all user modifications
|
|
668
|
+
* Clears all user modifications including order, widths, visibility, and sort.
|
|
669
|
+
*
|
|
670
|
+
* @group State Persistence
|
|
671
|
+
* @fires column-state-change - Emitted after state is reset
|
|
672
|
+
* @example
|
|
673
|
+
* ```typescript
|
|
674
|
+
* // Reset button handler
|
|
675
|
+
* resetBtn.onclick = () => {
|
|
676
|
+
* grid.resetColumnState();
|
|
677
|
+
* localStorage.removeItem('gridState');
|
|
678
|
+
* };
|
|
679
|
+
* ```
|
|
282
680
|
*/
|
|
283
681
|
resetColumnState(): void;
|
|
284
|
-
/**
|
|
682
|
+
/**
|
|
683
|
+
* Check if the tool panel sidebar is currently open.
|
|
684
|
+
*
|
|
685
|
+
* The tool panel is an accordion-based sidebar that contains sections
|
|
686
|
+
* registered by plugins or via `registerToolPanel()`.
|
|
687
|
+
*
|
|
688
|
+
* @group Tool Panel
|
|
689
|
+
* @example
|
|
690
|
+
* ```typescript
|
|
691
|
+
* // Conditionally show/hide a "toggle panel" button
|
|
692
|
+
* const isPanelOpen = grid.isToolPanelOpen;
|
|
693
|
+
* toggleButton.textContent = isPanelOpen ? 'Close Panel' : 'Open Panel';
|
|
694
|
+
* ```
|
|
695
|
+
*/
|
|
285
696
|
get isToolPanelOpen(): boolean;
|
|
286
697
|
/**
|
|
287
|
-
* Get the
|
|
288
|
-
*
|
|
698
|
+
* Get the IDs of currently expanded accordion sections in the tool panel.
|
|
699
|
+
*
|
|
700
|
+
* Multiple sections can be expanded simultaneously in the accordion view.
|
|
701
|
+
*
|
|
702
|
+
* @group Tool Panel
|
|
703
|
+
* @example
|
|
704
|
+
* ```typescript
|
|
705
|
+
* // Check which sections are expanded
|
|
706
|
+
* const expanded = grid.expandedToolPanelSections;
|
|
707
|
+
* console.log('Expanded sections:', expanded);
|
|
708
|
+
* // e.g., ['columnVisibility', 'filtering']
|
|
709
|
+
* ```
|
|
289
710
|
*/
|
|
290
|
-
get activeToolPanel(): string | null;
|
|
291
|
-
/** Get the IDs of expanded accordion sections. */
|
|
292
711
|
get expandedToolPanelSections(): string[];
|
|
293
|
-
/**
|
|
712
|
+
/**
|
|
713
|
+
* Open the tool panel sidebar.
|
|
714
|
+
*
|
|
715
|
+
* The tool panel displays an accordion view with all registered panel sections.
|
|
716
|
+
* Each section can be expanded/collapsed independently.
|
|
717
|
+
*
|
|
718
|
+
* @group Tool Panel
|
|
719
|
+
* @example
|
|
720
|
+
* ```typescript
|
|
721
|
+
* // Open the tool panel when a toolbar button is clicked
|
|
722
|
+
* settingsButton.addEventListener('click', () => {
|
|
723
|
+
* grid.openToolPanel();
|
|
724
|
+
* });
|
|
725
|
+
* ```
|
|
726
|
+
*/
|
|
294
727
|
openToolPanel(): void;
|
|
295
|
-
/**
|
|
728
|
+
/**
|
|
729
|
+
* Close the tool panel sidebar.
|
|
730
|
+
*
|
|
731
|
+
* @group Tool Panel
|
|
732
|
+
* @example
|
|
733
|
+
* ```typescript
|
|
734
|
+
* // Close the panel after user makes a selection
|
|
735
|
+
* grid.closeToolPanel();
|
|
736
|
+
* ```
|
|
737
|
+
*/
|
|
296
738
|
closeToolPanel(): void;
|
|
297
|
-
/**
|
|
739
|
+
/**
|
|
740
|
+
* Toggle the tool panel sidebar open or closed.
|
|
741
|
+
*
|
|
742
|
+
* @group Tool Panel
|
|
743
|
+
* @example
|
|
744
|
+
* ```typescript
|
|
745
|
+
* // Wire up a toggle button
|
|
746
|
+
* toggleButton.addEventListener('click', () => {
|
|
747
|
+
* grid.toggleToolPanel();
|
|
748
|
+
* });
|
|
749
|
+
* ```
|
|
750
|
+
*/
|
|
298
751
|
toggleToolPanel(): void;
|
|
299
|
-
/**
|
|
752
|
+
/**
|
|
753
|
+
* Toggle an accordion section expanded or collapsed within the tool panel.
|
|
754
|
+
*
|
|
755
|
+
* @group Tool Panel
|
|
756
|
+
* @param sectionId - The ID of the section to toggle (matches `ToolPanelDefinition.id`)
|
|
757
|
+
*
|
|
758
|
+
* @example
|
|
759
|
+
* ```typescript
|
|
760
|
+
* // Expand the column visibility section programmatically
|
|
761
|
+
* grid.openToolPanel();
|
|
762
|
+
* grid.toggleToolPanelSection('columnVisibility');
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
300
765
|
toggleToolPanelSection(sectionId: string): void;
|
|
301
|
-
/**
|
|
766
|
+
/**
|
|
767
|
+
* Get all registered tool panel definitions.
|
|
768
|
+
*
|
|
769
|
+
* Returns both plugin-registered panels and panels registered via `registerToolPanel()`.
|
|
770
|
+
*
|
|
771
|
+
* @group Tool Panel
|
|
772
|
+
* @returns Array of tool panel definitions
|
|
773
|
+
*
|
|
774
|
+
* @example
|
|
775
|
+
* ```typescript
|
|
776
|
+
* // List all available panels
|
|
777
|
+
* const panels = grid.getToolPanels();
|
|
778
|
+
* panels.forEach(panel => {
|
|
779
|
+
* console.log(`Panel: ${panel.title} (${panel.id})`);
|
|
780
|
+
* });
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
302
783
|
getToolPanels(): ToolPanelDefinition[];
|
|
303
|
-
/**
|
|
784
|
+
/**
|
|
785
|
+
* Register a custom tool panel section.
|
|
786
|
+
*
|
|
787
|
+
* Use this API to add custom UI sections to the tool panel sidebar
|
|
788
|
+
* without creating a full plugin. The panel will appear as an accordion
|
|
789
|
+
* section in the tool panel.
|
|
790
|
+
*
|
|
791
|
+
* @group Tool Panel
|
|
792
|
+
* @param panel - The tool panel definition
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```typescript
|
|
796
|
+
* // Register a custom "Export" panel
|
|
797
|
+
* grid.registerToolPanel({
|
|
798
|
+
* id: 'export',
|
|
799
|
+
* title: 'Export Options',
|
|
800
|
+
* icon: '📥',
|
|
801
|
+
* order: 50, // Lower order = higher in list
|
|
802
|
+
* render: (container) => {
|
|
803
|
+
* container.innerHTML = `
|
|
804
|
+
* <button id="export-csv">Export CSV</button>
|
|
805
|
+
* <button id="export-json">Export JSON</button>
|
|
806
|
+
* `;
|
|
807
|
+
* container.querySelector('#export-csv')?.addEventListener('click', () => {
|
|
808
|
+
* exportToCSV(grid.rows);
|
|
809
|
+
* });
|
|
810
|
+
* }
|
|
811
|
+
* });
|
|
812
|
+
* ```
|
|
813
|
+
*/
|
|
304
814
|
registerToolPanel(panel: ToolPanelDefinition): void;
|
|
305
|
-
/**
|
|
815
|
+
/**
|
|
816
|
+
* Unregister a custom tool panel section.
|
|
817
|
+
*
|
|
818
|
+
* @group Tool Panel
|
|
819
|
+
* @param panelId - The ID of the panel to remove
|
|
820
|
+
*
|
|
821
|
+
* @example
|
|
822
|
+
* ```typescript
|
|
823
|
+
* // Remove the export panel when no longer needed
|
|
824
|
+
* grid.unregisterToolPanel('export');
|
|
825
|
+
* ```
|
|
826
|
+
*/
|
|
306
827
|
unregisterToolPanel(panelId: string): void;
|
|
307
|
-
/**
|
|
828
|
+
/**
|
|
829
|
+
* Get all registered header content definitions.
|
|
830
|
+
*
|
|
831
|
+
* @group Header Content
|
|
832
|
+
* @returns Array of header content definitions
|
|
833
|
+
*
|
|
834
|
+
* @example
|
|
835
|
+
* ```typescript
|
|
836
|
+
* const contents = grid.getHeaderContents();
|
|
837
|
+
* console.log('Header sections:', contents.map(c => c.id));
|
|
838
|
+
* ```
|
|
839
|
+
*/
|
|
308
840
|
getHeaderContents(): HeaderContentDefinition[];
|
|
309
|
-
/**
|
|
841
|
+
/**
|
|
842
|
+
* Register custom header content.
|
|
843
|
+
*
|
|
844
|
+
* Header content appears in the grid's header bar area, which is displayed
|
|
845
|
+
* above the column headers. Use this for search boxes, filters, or other
|
|
846
|
+
* controls that should be prominently visible.
|
|
847
|
+
*
|
|
848
|
+
* @group Header Content
|
|
849
|
+
* @param content - The header content definition
|
|
850
|
+
*
|
|
851
|
+
* @example
|
|
852
|
+
* ```typescript
|
|
853
|
+
* // Add a global search box to the header
|
|
854
|
+
* grid.registerHeaderContent({
|
|
855
|
+
* id: 'global-search',
|
|
856
|
+
* order: 10,
|
|
857
|
+
* render: (container) => {
|
|
858
|
+
* const input = document.createElement('input');
|
|
859
|
+
* input.type = 'search';
|
|
860
|
+
* input.placeholder = 'Search all columns...';
|
|
861
|
+
* input.addEventListener('input', (e) => {
|
|
862
|
+
* const term = (e.target as HTMLInputElement).value;
|
|
863
|
+
* filterGrid(term);
|
|
864
|
+
* });
|
|
865
|
+
* container.appendChild(input);
|
|
866
|
+
* }
|
|
867
|
+
* });
|
|
868
|
+
* ```
|
|
869
|
+
*/
|
|
310
870
|
registerHeaderContent(content: HeaderContentDefinition): void;
|
|
311
|
-
/**
|
|
871
|
+
/**
|
|
872
|
+
* Unregister custom header content.
|
|
873
|
+
*
|
|
874
|
+
* @group Header Content
|
|
875
|
+
* @param contentId - The ID of the content to remove
|
|
876
|
+
*
|
|
877
|
+
* @example
|
|
878
|
+
* ```typescript
|
|
879
|
+
* grid.unregisterHeaderContent('global-search');
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
312
882
|
unregisterHeaderContent(contentId: string): void;
|
|
313
|
-
/**
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
883
|
+
/**
|
|
884
|
+
* Get all registered toolbar content definitions.
|
|
885
|
+
*
|
|
886
|
+
* @group Toolbar
|
|
887
|
+
* @returns Array of toolbar content definitions
|
|
888
|
+
*
|
|
889
|
+
* @example
|
|
890
|
+
* ```typescript
|
|
891
|
+
* const contents = grid.getToolbarContents();
|
|
892
|
+
* console.log('Toolbar items:', contents.map(c => c.id));
|
|
893
|
+
* ```
|
|
894
|
+
*/
|
|
895
|
+
getToolbarContents(): ToolbarContentDefinition[];
|
|
896
|
+
/**
|
|
897
|
+
* Register custom toolbar content.
|
|
898
|
+
*
|
|
899
|
+
* Toolbar content appears in the grid's toolbar area. Use this for action
|
|
900
|
+
* buttons, dropdowns, or other controls that should be easily accessible.
|
|
901
|
+
* Content is rendered in order of the `order` property (lower = first).
|
|
902
|
+
*
|
|
903
|
+
* @group Toolbar
|
|
904
|
+
* @param content - The toolbar content definition
|
|
905
|
+
*
|
|
906
|
+
* @example
|
|
907
|
+
* ```typescript
|
|
908
|
+
* // Add export buttons to the toolbar
|
|
909
|
+
* grid.registerToolbarContent({
|
|
910
|
+
* id: 'export-buttons',
|
|
911
|
+
* order: 100, // Position in toolbar (lower = first)
|
|
912
|
+
* render: (container) => {
|
|
913
|
+
* const csvBtn = document.createElement('button');
|
|
914
|
+
* csvBtn.textContent = 'Export CSV';
|
|
915
|
+
* csvBtn.className = 'dg-toolbar-btn';
|
|
916
|
+
* csvBtn.addEventListener('click', () => exportToCSV(grid.rows));
|
|
917
|
+
*
|
|
918
|
+
* const jsonBtn = document.createElement('button');
|
|
919
|
+
* jsonBtn.textContent = 'Export JSON';
|
|
920
|
+
* jsonBtn.className = 'dg-toolbar-btn';
|
|
921
|
+
* jsonBtn.addEventListener('click', () => exportToJSON(grid.rows));
|
|
922
|
+
*
|
|
923
|
+
* container.append(csvBtn, jsonBtn);
|
|
924
|
+
* }
|
|
925
|
+
* });
|
|
926
|
+
* ```
|
|
927
|
+
*
|
|
928
|
+
* @example
|
|
929
|
+
* ```typescript
|
|
930
|
+
* // Add a dropdown filter to the toolbar
|
|
931
|
+
* grid.registerToolbarContent({
|
|
932
|
+
* id: 'status-filter',
|
|
933
|
+
* order: 50,
|
|
934
|
+
* render: (container) => {
|
|
935
|
+
* const select = document.createElement('select');
|
|
936
|
+
* select.innerHTML = `
|
|
937
|
+
* <option value="">All Statuses</option>
|
|
938
|
+
* <option value="active">Active</option>
|
|
939
|
+
* <option value="inactive">Inactive</option>
|
|
940
|
+
* `;
|
|
941
|
+
* select.addEventListener('change', (e) => {
|
|
942
|
+
* const status = (e.target as HTMLSelectElement).value;
|
|
943
|
+
* applyStatusFilter(status);
|
|
944
|
+
* });
|
|
945
|
+
* container.appendChild(select);
|
|
946
|
+
* }
|
|
947
|
+
* });
|
|
948
|
+
* ```
|
|
949
|
+
*/
|
|
950
|
+
registerToolbarContent(content: ToolbarContentDefinition): void;
|
|
951
|
+
/**
|
|
952
|
+
* Unregister custom toolbar content.
|
|
953
|
+
*
|
|
954
|
+
* @group Toolbar
|
|
955
|
+
* @param contentId - The ID of the content to remove
|
|
956
|
+
*
|
|
957
|
+
* @example
|
|
958
|
+
* ```typescript
|
|
959
|
+
* // Remove export buttons when switching to read-only mode
|
|
960
|
+
* grid.unregisterToolbarContent('export-buttons');
|
|
961
|
+
* ```
|
|
962
|
+
*/
|
|
963
|
+
unregisterToolbarContent(contentId: string): void;
|
|
321
964
|
/**
|
|
322
965
|
* Re-parse light DOM shell elements and refresh shell header.
|
|
323
966
|
* Call this after dynamically modifying <tbw-grid-header> children.
|
|
967
|
+
* @internal Plugin API
|
|
324
968
|
*/
|
|
325
969
|
refreshShellHeader(): void;
|
|
326
970
|
/**
|
|
@@ -329,6 +973,7 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
329
973
|
*
|
|
330
974
|
* Uses adoptedStyleSheets for efficiency - styles survive shadow DOM rebuilds.
|
|
331
975
|
*
|
|
976
|
+
* @group Custom Styles
|
|
332
977
|
* @param id - Unique identifier for the style block (for removal/updates)
|
|
333
978
|
* @param css - CSS string to inject
|
|
334
979
|
*
|
|
@@ -350,18 +995,22 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
350
995
|
registerStyles(id: string, css: string): void;
|
|
351
996
|
/**
|
|
352
997
|
* Remove previously registered custom styles.
|
|
998
|
+
*
|
|
999
|
+
* @group Custom Styles
|
|
353
1000
|
* @param id - The ID used when registering the styles
|
|
354
1001
|
*/
|
|
355
1002
|
unregisterStyles(id: string): void;
|
|
356
1003
|
/**
|
|
357
1004
|
* Get list of registered custom style IDs.
|
|
1005
|
+
*
|
|
1006
|
+
* @group Custom Styles
|
|
358
1007
|
*/
|
|
359
1008
|
getRegisteredStyles(): string[];
|
|
360
1009
|
/**
|
|
361
1010
|
* Re-parse light DOM column elements and refresh the grid.
|
|
362
1011
|
* Call this after framework adapters have registered their templates.
|
|
363
1012
|
* Uses the render scheduler to batch with other pending updates.
|
|
364
|
-
* @
|
|
1013
|
+
* @category Framework Adapters
|
|
365
1014
|
*/
|
|
366
1015
|
refreshColumns(): void;
|
|
367
1016
|
/**
|