@toolbox-web/grid 0.2.8 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -13
- package/all.d.ts +25 -5659
- package/all.d.ts.map +1 -0
- package/all.js +524 -450
- package/all.js.map +1 -1
- package/index.d.ts +8 -2678
- package/index.d.ts.map +1 -0
- package/index.js +3929 -25
- package/index.js.map +1 -1
- package/lib/core/constants.d.ts +114 -0
- package/lib/core/constants.d.ts.map +1 -0
- package/lib/core/grid.d.ts +337 -0
- package/lib/core/grid.d.ts.map +1 -0
- package/lib/core/internal/aggregators.d.ts +67 -0
- package/lib/core/internal/aggregators.d.ts.map +1 -0
- package/lib/core/internal/column-state.d.ts +124 -0
- package/lib/core/internal/column-state.d.ts.map +1 -0
- package/lib/core/internal/columns.d.ts +107 -0
- package/lib/core/internal/columns.d.ts.map +1 -0
- package/lib/core/internal/dom-builder.d.ts +115 -0
- package/lib/core/internal/dom-builder.d.ts.map +1 -0
- package/lib/core/internal/editing.d.ts +76 -0
- package/lib/core/internal/editing.d.ts.map +1 -0
- package/lib/core/internal/editors.d.ts +8 -0
- package/lib/core/internal/editors.d.ts.map +1 -0
- package/lib/core/internal/event-delegation.d.ts +11 -0
- package/lib/core/internal/event-delegation.d.ts.map +1 -0
- package/lib/core/internal/grid-internals.d.ts +83 -0
- package/lib/core/internal/grid-internals.d.ts.map +1 -0
- package/lib/core/internal/header.d.ts +7 -0
- package/lib/core/internal/header.d.ts.map +1 -0
- package/lib/core/internal/idle-scheduler.d.ts +65 -0
- package/lib/core/internal/idle-scheduler.d.ts.map +1 -0
- package/lib/core/internal/inference.d.ts +12 -0
- package/lib/core/internal/inference.d.ts.map +1 -0
- package/lib/core/internal/keyboard.d.ts +18 -0
- package/lib/core/internal/keyboard.d.ts.map +1 -0
- package/lib/core/internal/resize.d.ts +3 -0
- package/lib/core/internal/resize.d.ts.map +1 -0
- package/lib/core/internal/rows.d.ts +35 -0
- package/lib/core/internal/rows.d.ts.map +1 -0
- package/lib/core/internal/sanitize.d.ts +13 -0
- package/lib/core/internal/sanitize.d.ts.map +1 -0
- package/lib/core/internal/shell.d.ts +228 -0
- package/lib/core/internal/shell.d.ts.map +1 -0
- package/lib/core/internal/sorting.d.ts +24 -0
- package/lib/core/internal/sorting.d.ts.map +1 -0
- package/lib/core/internal/touch-scroll.d.ts +54 -0
- package/lib/core/internal/touch-scroll.d.ts.map +1 -0
- package/lib/core/internal/utils.d.ts +38 -0
- package/lib/core/internal/utils.d.ts.map +1 -0
- package/lib/core/internal/virtualization.d.ts +66 -0
- package/lib/core/internal/virtualization.d.ts.map +1 -0
- package/lib/core/plugin/base-plugin.d.ts +616 -0
- package/lib/core/plugin/base-plugin.d.ts.map +1 -0
- package/lib/core/plugin/index.d.ts +11 -0
- package/lib/core/plugin/index.d.ts.map +1 -0
- package/lib/core/plugin/plugin-manager.d.ts +183 -0
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -0
- package/lib/core/plugin/types.d.ts +196 -0
- package/lib/core/plugin/types.d.ts.map +1 -0
- package/lib/core/types.d.ts +841 -0
- package/lib/core/types.d.ts.map +1 -0
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +46 -0
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -0
- package/lib/plugins/clipboard/copy.d.ts +47 -0
- package/lib/plugins/clipboard/copy.d.ts.map +1 -0
- package/lib/plugins/clipboard/index.d.ts +7 -0
- package/lib/plugins/clipboard/index.d.ts.map +1 -0
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/paste.d.ts +25 -0
- package/lib/plugins/clipboard/paste.d.ts.map +1 -0
- package/lib/plugins/clipboard/types.d.ts +40 -0
- package/lib/plugins/clipboard/types.d.ts.map +1 -0
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +54 -0
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -0
- package/lib/plugins/column-virtualization/column-virtualization.d.ts +53 -0
- package/lib/plugins/column-virtualization/column-virtualization.d.ts.map +1 -0
- package/lib/plugins/column-virtualization/index.d.ts +7 -0
- package/lib/plugins/column-virtualization/index.d.ts.map +1 -0
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/column-virtualization/types.d.ts +41 -0
- package/lib/plugins/column-virtualization/types.d.ts.map +1 -0
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +52 -0
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -0
- package/lib/plugins/context-menu/index.d.ts +7 -0
- package/lib/plugins/context-menu/index.d.ts.map +1 -0
- package/lib/plugins/context-menu/index.js +24 -24
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/context-menu/menu.d.ts +38 -0
- package/lib/plugins/context-menu/menu.d.ts.map +1 -0
- package/lib/plugins/context-menu/types.d.ts +77 -0
- package/lib/plugins/context-menu/types.d.ts.map +1 -0
- package/lib/plugins/export/ExportPlugin.d.ts +53 -0
- package/lib/plugins/export/ExportPlugin.d.ts.map +1 -0
- package/lib/plugins/export/csv.d.ts +31 -0
- package/lib/plugins/export/csv.d.ts.map +1 -0
- package/lib/plugins/export/excel.d.ts +12 -0
- package/lib/plugins/export/excel.d.ts.map +1 -0
- package/lib/plugins/export/index.d.ts +7 -0
- package/lib/plugins/export/index.d.ts.map +1 -0
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/export/types.d.ts +57 -0
- package/lib/plugins/export/types.d.ts.map +1 -0
- package/lib/plugins/filtering/FilteringPlugin.d.ts +128 -0
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -0
- package/lib/plugins/filtering/filter-model.d.ts +38 -0
- package/lib/plugins/filtering/filter-model.d.ts.map +1 -0
- package/lib/plugins/filtering/index.d.ts +7 -0
- package/lib/plugins/filtering/index.d.ts.map +1 -0
- package/lib/plugins/filtering/index.js +5 -5
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/filtering/types.d.ts +157 -0
- package/lib/plugins/filtering/types.d.ts.map +1 -0
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +51 -0
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -0
- package/lib/plugins/grouping-columns/grouping-columns.d.ts +41 -0
- package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -0
- package/lib/plugins/grouping-columns/index.d.ts +7 -0
- package/lib/plugins/grouping-columns/index.d.ts.map +1 -0
- package/lib/plugins/grouping-columns/index.js +58 -42
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-columns/types.d.ts +91 -0
- package/lib/plugins/grouping-columns/types.d.ts.map +1 -0
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +120 -0
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -0
- package/lib/plugins/grouping-rows/grouping-rows.d.ts +51 -0
- package/lib/plugins/grouping-rows/grouping-rows.d.ts.map +1 -0
- package/lib/plugins/grouping-rows/index.d.ts +7 -0
- package/lib/plugins/grouping-rows/index.d.ts.map +1 -0
- package/lib/plugins/grouping-rows/index.js +51 -51
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/grouping-rows/types.d.ts +95 -0
- package/lib/plugins/grouping-rows/types.d.ts.map +1 -0
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +147 -0
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -0
- package/lib/plugins/master-detail/index.d.ts +7 -0
- package/lib/plugins/master-detail/index.d.ts.map +1 -0
- package/lib/plugins/master-detail/index.js +235 -78
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/master-detail/master-detail.d.ts +30 -0
- package/lib/plugins/master-detail/master-detail.d.ts.map +1 -0
- package/lib/plugins/master-detail/types.d.ts +40 -0
- package/lib/plugins/master-detail/types.d.ts.map +1 -0
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +58 -0
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -0
- package/lib/plugins/multi-sort/index.d.ts +7 -0
- package/lib/plugins/multi-sort/index.d.ts.map +1 -0
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/multi-sort/multi-sort.d.ts +51 -0
- package/lib/plugins/multi-sort/multi-sort.d.ts.map +1 -0
- package/lib/plugins/multi-sort/types.d.ts +25 -0
- package/lib/plugins/multi-sort/types.d.ts.map +1 -0
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +58 -0
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -0
- package/lib/plugins/pinned-columns/index.d.ts +7 -0
- package/lib/plugins/pinned-columns/index.d.ts.map +1 -0
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-columns/pinned-columns.d.ts +62 -0
- package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -0
- package/lib/plugins/pinned-columns/types.d.ts +20 -0
- package/lib/plugins/pinned-columns/types.d.ts.map +1 -0
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +64 -0
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -0
- package/lib/plugins/pinned-rows/index.d.ts +7 -0
- package/lib/plugins/pinned-rows/index.d.ts.map +1 -0
- package/lib/plugins/pinned-rows/index.js +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pinned-rows/pinned-rows.d.ts +43 -0
- package/lib/plugins/pinned-rows/pinned-rows.d.ts.map +1 -0
- package/lib/plugins/pinned-rows/types.d.ts +95 -0
- package/lib/plugins/pinned-rows/types.d.ts.map +1 -0
- package/lib/plugins/pivot/PivotPlugin.d.ts +94 -0
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -0
- package/lib/plugins/pivot/index.d.ts +7 -0
- package/lib/plugins/pivot/index.d.ts.map +1 -0
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/pivot/pivot-engine.d.ts +50 -0
- package/lib/plugins/pivot/pivot-engine.d.ts.map +1 -0
- package/lib/plugins/pivot/pivot-model.d.ts +6 -0
- package/lib/plugins/pivot/pivot-model.d.ts.map +1 -0
- package/lib/plugins/pivot/pivot-panel.d.ts +25 -0
- package/lib/plugins/pivot/pivot-panel.d.ts.map +1 -0
- package/lib/plugins/pivot/pivot-rows.d.ts +33 -0
- package/lib/plugins/pivot/pivot-rows.d.ts.map +1 -0
- package/lib/plugins/pivot/types.d.ts +62 -0
- package/lib/plugins/pivot/types.d.ts.map +1 -0
- package/lib/plugins/reorder/ReorderPlugin.d.ts +81 -0
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -0
- package/lib/plugins/reorder/column-drag.d.ts +41 -0
- package/lib/plugins/reorder/column-drag.d.ts.map +1 -0
- package/lib/plugins/reorder/index.d.ts +7 -0
- package/lib/plugins/reorder/index.d.ts.map +1 -0
- package/lib/plugins/reorder/index.js +51 -48
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/reorder/types.d.ts +54 -0
- package/lib/plugins/reorder/types.d.ts.map +1 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts +77 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -0
- package/lib/plugins/selection/index.d.ts +8 -0
- package/lib/plugins/selection/index.d.ts.map +1 -0
- package/lib/plugins/selection/index.js +86 -75
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/range-selection.d.ts +109 -0
- package/lib/plugins/selection/range-selection.d.ts.map +1 -0
- package/lib/plugins/selection/row-selection.d.ts +48 -0
- package/lib/plugins/selection/row-selection.d.ts.map +1 -0
- package/lib/plugins/selection/types.d.ts +80 -0
- package/lib/plugins/selection/types.d.ts.map +1 -0
- package/lib/plugins/server-side/ServerSidePlugin.d.ts +56 -0
- package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -0
- package/lib/plugins/server-side/cache.d.ts +14 -0
- package/lib/plugins/server-side/cache.d.ts.map +1 -0
- package/lib/plugins/server-side/datasource.d.ts +12 -0
- package/lib/plugins/server-side/datasource.d.ts.map +1 -0
- package/lib/plugins/server-side/index.d.ts +7 -0
- package/lib/plugins/server-side/index.d.ts.map +1 -0
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/server-side/types.d.ts +43 -0
- package/lib/plugins/server-side/types.d.ts.map +1 -0
- package/lib/plugins/tree/TreePlugin.d.ts +49 -0
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -0
- package/lib/plugins/tree/index.d.ts +8 -0
- package/lib/plugins/tree/index.d.ts.map +1 -0
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/tree/tree-data.d.ts +42 -0
- package/lib/plugins/tree/tree-data.d.ts.map +1 -0
- package/lib/plugins/tree/tree-detect.d.ts +24 -0
- package/lib/plugins/tree/tree-detect.d.ts.map +1 -0
- package/lib/plugins/tree/types.d.ts +61 -0
- package/lib/plugins/tree/types.d.ts.map +1 -0
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +68 -0
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -0
- package/lib/plugins/undo-redo/history.d.ts +64 -0
- package/lib/plugins/undo-redo/history.d.ts.map +1 -0
- package/lib/plugins/undo-redo/index.d.ts +7 -0
- package/lib/plugins/undo-redo/index.d.ts.map +1 -0
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/undo-redo/types.d.ts +41 -0
- package/lib/plugins/undo-redo/types.d.ts.map +1 -0
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +135 -0
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -0
- package/lib/plugins/visibility/index.d.ts +8 -0
- package/lib/plugins/visibility/index.d.ts.map +1 -0
- package/lib/plugins/visibility/index.js.map +1 -1
- package/lib/plugins/visibility/types.d.ts +33 -0
- package/lib/plugins/visibility/types.d.ts.map +1 -0
- package/lib/plugins/visibility/visibility.d.ts +30 -0
- package/lib/plugins/visibility/visibility.d.ts.map +1 -0
- package/package.json +6 -2
- package/public.d.ts +52 -0
- package/public.d.ts.map +1 -0
- package/umd/grid.all.umd.js +32 -74
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +22 -64
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +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 +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/index-YjW60MHD.js +0 -3235
- package/index-YjW60MHD.js.map +0 -1
package/index.d.ts
CHANGED
|
@@ -1,2678 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/** Available aggregation function types */
|
|
10
|
-
declare type AggFunc = 'sum' | 'avg' | 'count' | 'min' | 'max' | 'first' | 'last';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Aggregators Core Registry
|
|
14
|
-
*
|
|
15
|
-
* Provides a central registry for aggregator functions.
|
|
16
|
-
* Built-in aggregators are provided by default.
|
|
17
|
-
* Plugins can register additional aggregators.
|
|
18
|
-
*
|
|
19
|
-
* The registry is exposed as a singleton object that can be accessed:
|
|
20
|
-
* - By ES module imports: import { aggregatorRegistry } from '@toolbox-web/grid'
|
|
21
|
-
* - By UMD/CDN: TbwGrid.aggregatorRegistry
|
|
22
|
-
* - By plugins via context: ctx.aggregatorRegistry
|
|
23
|
-
*/
|
|
24
|
-
export declare type AggregatorFn = (rows: any[], field: string, column?: any) => any;
|
|
25
|
-
|
|
26
|
-
/** Map of field names to aggregator references */
|
|
27
|
-
declare type AggregatorMap = Record<string, AggregatorRef_2>;
|
|
28
|
-
|
|
29
|
-
export declare type AggregatorRef = string | ((rows: unknown[], field: string, column?: unknown) => unknown);
|
|
30
|
-
|
|
31
|
-
declare type AggregatorRef_2 = string | AggregatorFn;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The aggregator registry singleton.
|
|
35
|
-
* Plugins should access this through context or the global namespace.
|
|
36
|
-
*/
|
|
37
|
-
export declare const aggregatorRegistry: {
|
|
38
|
-
/**
|
|
39
|
-
* Register a custom aggregator function.
|
|
40
|
-
*/
|
|
41
|
-
register(name: string, fn: AggregatorFn): void;
|
|
42
|
-
/**
|
|
43
|
-
* Unregister a custom aggregator function.
|
|
44
|
-
*/
|
|
45
|
-
unregister(name: string): void;
|
|
46
|
-
/**
|
|
47
|
-
* Get an aggregator function by reference.
|
|
48
|
-
*/
|
|
49
|
-
get(ref: AggregatorRef_2 | undefined): AggregatorFn | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* Run an aggregator on a set of rows.
|
|
52
|
-
*/
|
|
53
|
-
run(ref: AggregatorRef_2 | undefined, rows: any[], field: string, column?: any): any;
|
|
54
|
-
/**
|
|
55
|
-
* Check if an aggregator exists.
|
|
56
|
-
*/
|
|
57
|
-
has(name: string): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* List all available aggregator names.
|
|
60
|
-
*/
|
|
61
|
-
list(): string[];
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Grid-wide animation configuration.
|
|
66
|
-
* Controls global animation behavior - individual plugins define their own animation styles.
|
|
67
|
-
* Duration and easing values set corresponding CSS variables on the grid element.
|
|
68
|
-
*/
|
|
69
|
-
export declare interface AnimationConfig {
|
|
70
|
-
/**
|
|
71
|
-
* Global animation mode.
|
|
72
|
-
* @default 'reduced-motion'
|
|
73
|
-
*/
|
|
74
|
-
mode?: AnimationMode;
|
|
75
|
-
/**
|
|
76
|
-
* Default animation duration in milliseconds.
|
|
77
|
-
* Sets `--tbw-animation-duration` CSS variable.
|
|
78
|
-
* @default 200
|
|
79
|
-
*/
|
|
80
|
-
duration?: number;
|
|
81
|
-
/**
|
|
82
|
-
* Default easing function.
|
|
83
|
-
* Sets `--tbw-animation-easing` CSS variable.
|
|
84
|
-
* @default 'ease-out'
|
|
85
|
-
*/
|
|
86
|
-
easing?: string;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Animation behavior mode.
|
|
91
|
-
* - `true` or `'on'`: Animations always enabled
|
|
92
|
-
* - `false` or `'off'`: Animations always disabled
|
|
93
|
-
* - `'reduced-motion'`: Respects `prefers-reduced-motion` media query (default)
|
|
94
|
-
*/
|
|
95
|
-
export declare type AnimationMode = boolean | 'on' | 'off' | 'reduced-motion';
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Animation style for visual transitions.
|
|
99
|
-
* - `'slide'`: Slide/transform animation (e.g., expand down, slide left/right)
|
|
100
|
-
* - `'fade'`: Opacity fade animation
|
|
101
|
-
* - `'flip'`: FLIP technique for position changes (First, Last, Invert, Play)
|
|
102
|
-
* - `false`: No animation for this specific feature
|
|
103
|
-
*/
|
|
104
|
-
export declare type AnimationStyle = 'slide' | 'fade' | 'flip' | false;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Base contract for a column. Public; kept intentionally lean so host apps can extend via intersection types.
|
|
108
|
-
* Prefer adding optional properties here only when broadly useful to most grids.
|
|
109
|
-
*/
|
|
110
|
-
export declare interface BaseColumnConfig<TRow = any, TValue = any> {
|
|
111
|
-
/** Unique field key referencing property in row objects */
|
|
112
|
-
field: keyof TRow & string;
|
|
113
|
-
/** Visible header label; defaults to capitalized field */
|
|
114
|
-
header?: string;
|
|
115
|
-
/** Column data type; inferred if omitted */
|
|
116
|
-
type?: PrimitiveColumnType;
|
|
117
|
-
/** Column width in pixels; fixed size (no flexibility) */
|
|
118
|
-
width?: string | number;
|
|
119
|
-
/** Minimum column width in pixels (stretch mode only); when set, column uses minmax(minWidth, 1fr) */
|
|
120
|
-
minWidth?: number;
|
|
121
|
-
/** Whether column can be sorted */
|
|
122
|
-
sortable?: boolean;
|
|
123
|
-
/** Whether column can be resized by user */
|
|
124
|
-
resizable?: boolean;
|
|
125
|
-
/** Optional custom comparator for sorting (a,b) -> number */
|
|
126
|
-
sortComparator?: (a: TValue, b: TValue, rowA: TRow, rowB: TRow) => number;
|
|
127
|
-
/** Whether the field is editable (enables editors) */
|
|
128
|
-
editable?: boolean;
|
|
129
|
-
/** Optional custom editor factory or element tag name */
|
|
130
|
-
editor?: ColumnEditorSpec<TRow, TValue>;
|
|
131
|
-
/** For select/typeahead types - available options */
|
|
132
|
-
options?: Array<{
|
|
133
|
-
label: string;
|
|
134
|
-
value: unknown;
|
|
135
|
-
}> | (() => Array<{
|
|
136
|
-
label: string;
|
|
137
|
-
value: unknown;
|
|
138
|
-
}>);
|
|
139
|
-
/** For select/typeahead - allow multi select */
|
|
140
|
-
multi?: boolean;
|
|
141
|
-
/** Optional formatter */
|
|
142
|
-
format?: (value: TValue, row: TRow) => string;
|
|
143
|
-
/** Arbitrary extra metadata */
|
|
144
|
-
meta?: Record<string, unknown>;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Abstract base class for all grid plugins.
|
|
149
|
-
*
|
|
150
|
-
* @template TConfig - Configuration type for the plugin
|
|
151
|
-
*/
|
|
152
|
-
export declare abstract class BaseGridPlugin<TConfig = unknown> implements GridPlugin {
|
|
153
|
-
/** Unique plugin identifier (derived from class name by default) */
|
|
154
|
-
abstract readonly name: string;
|
|
155
|
-
/** Plugin version - override in subclass if needed */
|
|
156
|
-
readonly version: string;
|
|
157
|
-
/** CSS styles to inject into the grid's shadow DOM */
|
|
158
|
-
readonly styles?: string;
|
|
159
|
-
/** Custom cell renderers keyed by type name */
|
|
160
|
-
readonly cellRenderers?: Record<string, CellRenderer>;
|
|
161
|
-
/** Custom header renderers keyed by type name */
|
|
162
|
-
readonly headerRenderers?: Record<string, HeaderRenderer>;
|
|
163
|
-
/** Custom cell editors keyed by type name */
|
|
164
|
-
readonly cellEditors?: Record<string, CellEditor>;
|
|
165
|
-
/** The grid instance this plugin is attached to */
|
|
166
|
-
protected grid: GridElement;
|
|
167
|
-
/** Plugin configuration - merged with defaults in attach() */
|
|
168
|
-
protected config: TConfig;
|
|
169
|
-
/** User-provided configuration from constructor */
|
|
170
|
-
protected readonly userConfig: Partial<TConfig>;
|
|
171
|
-
/**
|
|
172
|
-
* Default configuration - subclasses should override this getter.
|
|
173
|
-
* Note: This must be a getter (not property initializer) for proper inheritance
|
|
174
|
-
* since property initializers run after parent constructor.
|
|
175
|
-
*/
|
|
176
|
-
protected get defaultConfig(): Partial<TConfig>;
|
|
177
|
-
constructor(config?: Partial<TConfig>);
|
|
178
|
-
/**
|
|
179
|
-
* Called when the plugin is attached to a grid.
|
|
180
|
-
* Override to set up event listeners, initialize state, etc.
|
|
181
|
-
*/
|
|
182
|
-
attach(grid: GridElement): void;
|
|
183
|
-
/**
|
|
184
|
-
* Called when the plugin is detached from a grid.
|
|
185
|
-
* Override to clean up event listeners, timers, etc.
|
|
186
|
-
*/
|
|
187
|
-
detach(): void;
|
|
188
|
-
/**
|
|
189
|
-
* Get another plugin instance from the same grid.
|
|
190
|
-
* Use for inter-plugin communication.
|
|
191
|
-
*/
|
|
192
|
-
protected getPlugin<T extends BaseGridPlugin>(PluginClass: new (...args: any[]) => T): T | undefined;
|
|
193
|
-
/**
|
|
194
|
-
* Emit a custom event from the grid.
|
|
195
|
-
*/
|
|
196
|
-
protected emit<T>(eventName: string, detail: T): void;
|
|
197
|
-
/**
|
|
198
|
-
* Request a re-render of the grid.
|
|
199
|
-
*/
|
|
200
|
-
protected requestRender(): void;
|
|
201
|
-
/**
|
|
202
|
-
* Request a lightweight style update without rebuilding DOM.
|
|
203
|
-
* Use this instead of requestRender() when only CSS classes need updating.
|
|
204
|
-
*/
|
|
205
|
-
protected requestAfterRender(): void;
|
|
206
|
-
/**
|
|
207
|
-
* Get the current rows from the grid.
|
|
208
|
-
*/
|
|
209
|
-
protected get rows(): any[];
|
|
210
|
-
/**
|
|
211
|
-
* Get the original unfiltered/unprocessed rows from the grid.
|
|
212
|
-
* Use this when you need all source data regardless of active filters.
|
|
213
|
-
*/
|
|
214
|
-
protected get sourceRows(): any[];
|
|
215
|
-
/**
|
|
216
|
-
* Get the current columns from the grid.
|
|
217
|
-
*/
|
|
218
|
-
protected get columns(): ColumnConfig[];
|
|
219
|
-
/**
|
|
220
|
-
* Get only visible columns from the grid (excludes hidden).
|
|
221
|
-
* Use this for rendering that needs to match the grid template.
|
|
222
|
-
*/
|
|
223
|
-
protected get visibleColumns(): ColumnConfig[];
|
|
224
|
-
/**
|
|
225
|
-
* Get the shadow root of the grid.
|
|
226
|
-
*/
|
|
227
|
-
protected get shadowRoot(): ShadowRoot | null;
|
|
228
|
-
/**
|
|
229
|
-
* Get the disconnect signal for event listener cleanup.
|
|
230
|
-
* This signal is aborted when the grid disconnects from the DOM.
|
|
231
|
-
* Use this when adding event listeners that should be cleaned up automatically.
|
|
232
|
-
*
|
|
233
|
-
* Best for:
|
|
234
|
-
* - Document/window-level listeners added in attach()
|
|
235
|
-
* - Listeners on the grid element itself
|
|
236
|
-
* - Any listener that should persist across renders
|
|
237
|
-
*
|
|
238
|
-
* Not needed for:
|
|
239
|
-
* - Listeners on elements created in afterRender() (removed with element)
|
|
240
|
-
*
|
|
241
|
-
* @example
|
|
242
|
-
* element.addEventListener('click', handler, { signal: this.disconnectSignal });
|
|
243
|
-
* document.addEventListener('keydown', handler, { signal: this.disconnectSignal });
|
|
244
|
-
*/
|
|
245
|
-
protected get disconnectSignal(): AbortSignal;
|
|
246
|
-
/**
|
|
247
|
-
* Get the grid-level icons configuration.
|
|
248
|
-
* Returns merged icons (user config + defaults).
|
|
249
|
-
*/
|
|
250
|
-
protected get gridIcons(): typeof DEFAULT_GRID_ICONS;
|
|
251
|
-
/**
|
|
252
|
-
* Resolve an icon value to string or HTMLElement.
|
|
253
|
-
* Checks plugin config first, then grid-level icons, then defaults.
|
|
254
|
-
*
|
|
255
|
-
* @param iconKey - The icon key in GridIcons (e.g., 'expand', 'collapse')
|
|
256
|
-
* @param pluginOverride - Optional plugin-level override
|
|
257
|
-
* @returns The resolved icon value
|
|
258
|
-
*/
|
|
259
|
-
protected resolveIcon(iconKey: keyof typeof DEFAULT_GRID_ICONS, pluginOverride?: IconValue): IconValue;
|
|
260
|
-
/**
|
|
261
|
-
* Set an icon value on an element.
|
|
262
|
-
* Handles both string (text/HTML) and HTMLElement values.
|
|
263
|
-
*
|
|
264
|
-
* @param element - The element to set the icon on
|
|
265
|
-
* @param icon - The icon value (string or HTMLElement)
|
|
266
|
-
*/
|
|
267
|
-
protected setIcon(element: HTMLElement, icon: IconValue): void;
|
|
268
|
-
/**
|
|
269
|
-
* Log a warning message.
|
|
270
|
-
*/
|
|
271
|
-
protected warn(message: string): void;
|
|
272
|
-
/**
|
|
273
|
-
* Transform rows before rendering.
|
|
274
|
-
* Called during each render cycle before rows are rendered to the DOM.
|
|
275
|
-
* Use this to filter, sort, or add computed properties to rows.
|
|
276
|
-
*
|
|
277
|
-
* @param rows - The current rows array (readonly to encourage returning a new array)
|
|
278
|
-
* @returns The modified rows array to render
|
|
279
|
-
*
|
|
280
|
-
* @example
|
|
281
|
-
* ```ts
|
|
282
|
-
* processRows(rows: readonly any[]): any[] {
|
|
283
|
-
* // Filter out hidden rows
|
|
284
|
-
* return rows.filter(row => !row._hidden);
|
|
285
|
-
* }
|
|
286
|
-
* ```
|
|
287
|
-
*
|
|
288
|
-
* @example
|
|
289
|
-
* ```ts
|
|
290
|
-
* processRows(rows: readonly any[]): any[] {
|
|
291
|
-
* // Add computed properties
|
|
292
|
-
* return rows.map(row => ({
|
|
293
|
-
* ...row,
|
|
294
|
-
* _fullName: `${row.firstName} ${row.lastName}`
|
|
295
|
-
* }));
|
|
296
|
-
* }
|
|
297
|
-
* ```
|
|
298
|
-
*/
|
|
299
|
-
processRows?(rows: readonly any[]): any[];
|
|
300
|
-
/**
|
|
301
|
-
* Transform columns before rendering.
|
|
302
|
-
* Called during each render cycle before column headers and cells are rendered.
|
|
303
|
-
* Use this to add, remove, or modify column definitions.
|
|
304
|
-
*
|
|
305
|
-
* @param columns - The current columns array (readonly to encourage returning a new array)
|
|
306
|
-
* @returns The modified columns array to render
|
|
307
|
-
*
|
|
308
|
-
* @example
|
|
309
|
-
* ```ts
|
|
310
|
-
* processColumns(columns: readonly ColumnConfig[]): ColumnConfig[] {
|
|
311
|
-
* // Add a selection checkbox column
|
|
312
|
-
* return [
|
|
313
|
-
* { field: '_select', header: '', width: 40 },
|
|
314
|
-
* ...columns
|
|
315
|
-
* ];
|
|
316
|
-
* }
|
|
317
|
-
* ```
|
|
318
|
-
*/
|
|
319
|
-
processColumns?(columns: readonly ColumnConfig[]): ColumnConfig[];
|
|
320
|
-
/**
|
|
321
|
-
* Called before each render cycle begins.
|
|
322
|
-
* Use this to prepare state or cache values needed during rendering.
|
|
323
|
-
*
|
|
324
|
-
* @example
|
|
325
|
-
* ```ts
|
|
326
|
-
* beforeRender(): void {
|
|
327
|
-
* this.visibleRowCount = this.calculateVisibleRows();
|
|
328
|
-
* }
|
|
329
|
-
* ```
|
|
330
|
-
*/
|
|
331
|
-
beforeRender?(): void;
|
|
332
|
-
/**
|
|
333
|
-
* Called after each render cycle completes.
|
|
334
|
-
* Use this for DOM manipulation, adding event listeners to rendered elements,
|
|
335
|
-
* or applying visual effects like selection highlights.
|
|
336
|
-
*
|
|
337
|
-
* @example
|
|
338
|
-
* ```ts
|
|
339
|
-
* afterRender(): void {
|
|
340
|
-
* // Apply selection styling to rendered rows
|
|
341
|
-
* const rows = this.shadowRoot?.querySelectorAll('.data-row');
|
|
342
|
-
* rows?.forEach((row, i) => {
|
|
343
|
-
* row.classList.toggle('selected', this.selectedRows.has(i));
|
|
344
|
-
* });
|
|
345
|
-
* }
|
|
346
|
-
* ```
|
|
347
|
-
*/
|
|
348
|
-
afterRender?(): void;
|
|
349
|
-
/**
|
|
350
|
-
* Called after scroll-triggered row rendering completes.
|
|
351
|
-
* This is a lightweight hook for applying visual state to recycled DOM elements.
|
|
352
|
-
* Use this instead of afterRender when you need to reapply styling during scroll.
|
|
353
|
-
*
|
|
354
|
-
* Performance note: This is called frequently during scroll. Keep implementation fast.
|
|
355
|
-
*
|
|
356
|
-
* @example
|
|
357
|
-
* ```ts
|
|
358
|
-
* onScrollRender(): void {
|
|
359
|
-
* // Reapply selection state to visible cells
|
|
360
|
-
* this.applySelectionToVisibleCells();
|
|
361
|
-
* }
|
|
362
|
-
* ```
|
|
363
|
-
*/
|
|
364
|
-
onScrollRender?(): void;
|
|
365
|
-
/**
|
|
366
|
-
* Return extra height contributed by this plugin (e.g., expanded detail rows).
|
|
367
|
-
* Used to adjust scrollbar height calculations for virtualization.
|
|
368
|
-
*
|
|
369
|
-
* @returns Total extra height in pixels
|
|
370
|
-
*
|
|
371
|
-
* @example
|
|
372
|
-
* ```ts
|
|
373
|
-
* getExtraHeight(): number {
|
|
374
|
-
* return this.expandedRows.size * this.detailHeight;
|
|
375
|
-
* }
|
|
376
|
-
* ```
|
|
377
|
-
*/
|
|
378
|
-
getExtraHeight?(): number;
|
|
379
|
-
/**
|
|
380
|
-
* Return extra height that appears before a given row index.
|
|
381
|
-
* Used by virtualization to correctly calculate scroll positions when
|
|
382
|
-
* there's variable height content (like expanded detail rows) above the viewport.
|
|
383
|
-
*
|
|
384
|
-
* @param beforeRowIndex - The row index to calculate extra height before
|
|
385
|
-
* @returns Extra height in pixels that appears before this row
|
|
386
|
-
*
|
|
387
|
-
* @example
|
|
388
|
-
* ```ts
|
|
389
|
-
* getExtraHeightBefore(beforeRowIndex: number): number {
|
|
390
|
-
* let height = 0;
|
|
391
|
-
* for (const expandedRowIndex of this.expandedRowIndices) {
|
|
392
|
-
* if (expandedRowIndex < beforeRowIndex) {
|
|
393
|
-
* height += this.getDetailHeight(expandedRowIndex);
|
|
394
|
-
* }
|
|
395
|
-
* }
|
|
396
|
-
* return height;
|
|
397
|
-
* }
|
|
398
|
-
* ```
|
|
399
|
-
*/
|
|
400
|
-
getExtraHeightBefore?(beforeRowIndex: number): number;
|
|
401
|
-
/**
|
|
402
|
-
* Adjust the virtualization start index to render additional rows before the visible range.
|
|
403
|
-
* Use this when expanded content (like detail rows) needs its parent row to remain rendered
|
|
404
|
-
* even when the parent row itself has scrolled above the viewport.
|
|
405
|
-
*
|
|
406
|
-
* @param start - The calculated start row index
|
|
407
|
-
* @param scrollTop - The current scroll position
|
|
408
|
-
* @param rowHeight - The height of a single row
|
|
409
|
-
* @returns The adjusted start index (lower than or equal to original start)
|
|
410
|
-
*
|
|
411
|
-
* @example
|
|
412
|
-
* ```ts
|
|
413
|
-
* adjustVirtualStart(start: number, scrollTop: number, rowHeight: number): number {
|
|
414
|
-
* // If row 5 is expanded and scrolled partially, keep it rendered
|
|
415
|
-
* for (const expandedRowIndex of this.expandedRowIndices) {
|
|
416
|
-
* const expandedRowTop = expandedRowIndex * rowHeight;
|
|
417
|
-
* const expandedRowBottom = expandedRowTop + rowHeight + this.detailHeight;
|
|
418
|
-
* if (expandedRowBottom > scrollTop && expandedRowIndex < start) {
|
|
419
|
-
* return expandedRowIndex;
|
|
420
|
-
* }
|
|
421
|
-
* }
|
|
422
|
-
* return start;
|
|
423
|
-
* }
|
|
424
|
-
* ```
|
|
425
|
-
*/
|
|
426
|
-
adjustVirtualStart?(start: number, scrollTop: number, rowHeight: number): number;
|
|
427
|
-
/**
|
|
428
|
-
* Render a custom row, bypassing the default row rendering.
|
|
429
|
-
* Use this for special row types like group headers, detail rows, or footers.
|
|
430
|
-
*
|
|
431
|
-
* @param row - The row data object
|
|
432
|
-
* @param rowEl - The row DOM element to render into
|
|
433
|
-
* @param rowIndex - The index of the row in the data array
|
|
434
|
-
* @returns `true` if the plugin handled rendering (prevents default), `false`/`void` for default rendering
|
|
435
|
-
*
|
|
436
|
-
* @example
|
|
437
|
-
* ```ts
|
|
438
|
-
* renderRow(row: any, rowEl: HTMLElement, rowIndex: number): boolean | void {
|
|
439
|
-
* if (row._isGroupHeader) {
|
|
440
|
-
* rowEl.innerHTML = `<div class="group-header">${row._groupLabel}</div>`;
|
|
441
|
-
* return true; // Handled - skip default rendering
|
|
442
|
-
* }
|
|
443
|
-
* // Return void to let default rendering proceed
|
|
444
|
-
* }
|
|
445
|
-
* ```
|
|
446
|
-
*/
|
|
447
|
-
renderRow?(row: any, rowEl: HTMLElement, rowIndex: number): boolean | void;
|
|
448
|
-
/**
|
|
449
|
-
* Handle queries from other plugins.
|
|
450
|
-
* This is the generic mechanism for inter-plugin communication.
|
|
451
|
-
* Plugins can respond to well-known query types or define their own.
|
|
452
|
-
*
|
|
453
|
-
* @param query - The query object with type and context
|
|
454
|
-
* @returns Query-specific response, or undefined if not handling this query
|
|
455
|
-
*
|
|
456
|
-
* @example
|
|
457
|
-
* ```ts
|
|
458
|
-
* onPluginQuery(query: PluginQuery): unknown {
|
|
459
|
-
* switch (query.type) {
|
|
460
|
-
* case PLUGIN_QUERIES.CAN_MOVE_COLUMN:
|
|
461
|
-
* // Prevent moving pinned columns
|
|
462
|
-
* const column = query.context as ColumnConfig;
|
|
463
|
-
* if (column.sticky === 'left' || column.sticky === 'right') {
|
|
464
|
-
* return false;
|
|
465
|
-
* }
|
|
466
|
-
* break;
|
|
467
|
-
* case PLUGIN_QUERIES.GET_CONTEXT_MENU_ITEMS:
|
|
468
|
-
* const params = query.context as ContextMenuParams;
|
|
469
|
-
* return [{ id: 'my-action', label: 'My Action', action: () => {} }];
|
|
470
|
-
* }
|
|
471
|
-
* }
|
|
472
|
-
* ```
|
|
473
|
-
*/
|
|
474
|
-
onPluginQuery?(query: PluginQuery): unknown;
|
|
475
|
-
/**
|
|
476
|
-
* Handle keyboard events on the grid.
|
|
477
|
-
* Called when a key is pressed while the grid or a cell has focus.
|
|
478
|
-
*
|
|
479
|
-
* @param event - The native KeyboardEvent
|
|
480
|
-
* @returns `true` to prevent default behavior and stop propagation, `false`/`void` to allow default
|
|
481
|
-
*
|
|
482
|
-
* @example
|
|
483
|
-
* ```ts
|
|
484
|
-
* onKeyDown(event: KeyboardEvent): boolean | void {
|
|
485
|
-
* // Handle Ctrl+A for select all
|
|
486
|
-
* if (event.ctrlKey && event.key === 'a') {
|
|
487
|
-
* this.selectAllRows();
|
|
488
|
-
* return true; // Prevent default browser select-all
|
|
489
|
-
* }
|
|
490
|
-
* }
|
|
491
|
-
* ```
|
|
492
|
-
*/
|
|
493
|
-
onKeyDown?(event: KeyboardEvent): boolean | void;
|
|
494
|
-
/**
|
|
495
|
-
* Handle cell click events.
|
|
496
|
-
* Called when a data cell is clicked (not headers).
|
|
497
|
-
*
|
|
498
|
-
* @param event - Cell click event with row/column context
|
|
499
|
-
* @returns `true` to prevent default behavior and stop propagation, `false`/`void` to allow default
|
|
500
|
-
*
|
|
501
|
-
* @example
|
|
502
|
-
* ```ts
|
|
503
|
-
* onCellClick(event: CellClickEvent): boolean | void {
|
|
504
|
-
* if (event.field === '_select') {
|
|
505
|
-
* this.toggleRowSelection(event.rowIndex);
|
|
506
|
-
* return true; // Handled
|
|
507
|
-
* }
|
|
508
|
-
* }
|
|
509
|
-
* ```
|
|
510
|
-
*/
|
|
511
|
-
onCellClick?(event: CellClickEvent): boolean | void;
|
|
512
|
-
/**
|
|
513
|
-
* Handle row click events.
|
|
514
|
-
* Called when any part of a data row is clicked.
|
|
515
|
-
* Note: This is called in addition to onCellClick, not instead of.
|
|
516
|
-
*
|
|
517
|
-
* @param event - Row click event with row context
|
|
518
|
-
* @returns `true` to prevent default behavior and stop propagation, `false`/`void` to allow default
|
|
519
|
-
*
|
|
520
|
-
* @example
|
|
521
|
-
* ```ts
|
|
522
|
-
* onRowClick(event: RowClickEvent): boolean | void {
|
|
523
|
-
* if (this.config.mode === 'row') {
|
|
524
|
-
* this.selectRow(event.rowIndex, event.originalEvent);
|
|
525
|
-
* return true;
|
|
526
|
-
* }
|
|
527
|
-
* }
|
|
528
|
-
* ```
|
|
529
|
-
*/
|
|
530
|
-
onRowClick?(event: RowClickEvent): boolean | void;
|
|
531
|
-
/**
|
|
532
|
-
* Handle header click events.
|
|
533
|
-
* Called when a column header is clicked. Commonly used for sorting.
|
|
534
|
-
*
|
|
535
|
-
* @param event - Header click event with column context
|
|
536
|
-
* @returns `true` to prevent default behavior and stop propagation, `false`/`void` to allow default
|
|
537
|
-
*
|
|
538
|
-
* @example
|
|
539
|
-
* ```ts
|
|
540
|
-
* onHeaderClick(event: HeaderClickEvent): boolean | void {
|
|
541
|
-
* if (event.column.sortable !== false) {
|
|
542
|
-
* this.toggleSort(event.field);
|
|
543
|
-
* return true;
|
|
544
|
-
* }
|
|
545
|
-
* }
|
|
546
|
-
* ```
|
|
547
|
-
*/
|
|
548
|
-
onHeaderClick?(event: HeaderClickEvent): boolean | void;
|
|
549
|
-
/**
|
|
550
|
-
* Handle scroll events on the grid viewport.
|
|
551
|
-
* Called during scrolling. Note: This may be called frequently; debounce if needed.
|
|
552
|
-
*
|
|
553
|
-
* @param event - Scroll event with scroll position and viewport dimensions
|
|
554
|
-
*
|
|
555
|
-
* @example
|
|
556
|
-
* ```ts
|
|
557
|
-
* onScroll(event: ScrollEvent): void {
|
|
558
|
-
* // Update sticky column positions
|
|
559
|
-
* this.updateStickyPositions(event.scrollLeft);
|
|
560
|
-
* }
|
|
561
|
-
* ```
|
|
562
|
-
*/
|
|
563
|
-
onScroll?(event: ScrollEvent): void;
|
|
564
|
-
/**
|
|
565
|
-
* Handle cell mousedown events.
|
|
566
|
-
* Used for initiating drag operations like range selection or column resize.
|
|
567
|
-
*
|
|
568
|
-
* @param event - Mouse event with cell context
|
|
569
|
-
* @returns `true` to indicate drag started (prevents text selection), `false`/`void` otherwise
|
|
570
|
-
*
|
|
571
|
-
* @example
|
|
572
|
-
* ```ts
|
|
573
|
-
* onCellMouseDown(event: CellMouseEvent): boolean | void {
|
|
574
|
-
* if (event.rowIndex !== undefined && this.config.mode === 'range') {
|
|
575
|
-
* this.startDragSelection(event.rowIndex, event.colIndex);
|
|
576
|
-
* return true; // Prevent text selection
|
|
577
|
-
* }
|
|
578
|
-
* }
|
|
579
|
-
* ```
|
|
580
|
-
*/
|
|
581
|
-
onCellMouseDown?(event: CellMouseEvent): boolean | void;
|
|
582
|
-
/**
|
|
583
|
-
* Handle cell mousemove events during drag operations.
|
|
584
|
-
* Only called when a drag is in progress (after mousedown returned true).
|
|
585
|
-
*
|
|
586
|
-
* @param event - Mouse event with current cell context
|
|
587
|
-
* @returns `true` to continue handling the drag, `false`/`void` otherwise
|
|
588
|
-
*
|
|
589
|
-
* @example
|
|
590
|
-
* ```ts
|
|
591
|
-
* onCellMouseMove(event: CellMouseEvent): boolean | void {
|
|
592
|
-
* if (this.isDragging && event.rowIndex !== undefined) {
|
|
593
|
-
* this.extendSelection(event.rowIndex, event.colIndex);
|
|
594
|
-
* return true;
|
|
595
|
-
* }
|
|
596
|
-
* }
|
|
597
|
-
* ```
|
|
598
|
-
*/
|
|
599
|
-
onCellMouseMove?(event: CellMouseEvent): boolean | void;
|
|
600
|
-
/**
|
|
601
|
-
* Handle cell mouseup events to end drag operations.
|
|
602
|
-
*
|
|
603
|
-
* @param event - Mouse event with final cell context
|
|
604
|
-
* @returns `true` if drag was finalized, `false`/`void` otherwise
|
|
605
|
-
*
|
|
606
|
-
* @example
|
|
607
|
-
* ```ts
|
|
608
|
-
* onCellMouseUp(event: CellMouseEvent): boolean | void {
|
|
609
|
-
* if (this.isDragging) {
|
|
610
|
-
* this.finalizeDragSelection();
|
|
611
|
-
* this.isDragging = false;
|
|
612
|
-
* return true;
|
|
613
|
-
* }
|
|
614
|
-
* }
|
|
615
|
-
* ```
|
|
616
|
-
*/
|
|
617
|
-
onCellMouseUp?(event: CellMouseEvent): boolean | void;
|
|
618
|
-
/**
|
|
619
|
-
* Contribute plugin-specific state for a column.
|
|
620
|
-
* Called by the grid when collecting column state for serialization.
|
|
621
|
-
* Plugins can add their own properties to the column state.
|
|
622
|
-
*
|
|
623
|
-
* @param field - The field name of the column
|
|
624
|
-
* @returns Partial column state with plugin-specific properties, or undefined if no state to contribute
|
|
625
|
-
*
|
|
626
|
-
* @example
|
|
627
|
-
* ```ts
|
|
628
|
-
* getColumnState(field: string): Partial<ColumnState> | undefined {
|
|
629
|
-
* const filterModel = this.filterModels.get(field);
|
|
630
|
-
* if (filterModel) {
|
|
631
|
-
* // Uses module augmentation to add filter property to ColumnState
|
|
632
|
-
* return { filter: filterModel } as Partial<ColumnState>;
|
|
633
|
-
* }
|
|
634
|
-
* return undefined;
|
|
635
|
-
* }
|
|
636
|
-
* ```
|
|
637
|
-
*/
|
|
638
|
-
getColumnState?(field: string): Partial<ColumnState> | undefined;
|
|
639
|
-
/**
|
|
640
|
-
* Apply plugin-specific state to a column.
|
|
641
|
-
* Called by the grid when restoring column state from serialized data.
|
|
642
|
-
* Plugins should restore their internal state based on the provided state.
|
|
643
|
-
*
|
|
644
|
-
* @param field - The field name of the column
|
|
645
|
-
* @param state - The column state to apply (may contain plugin-specific properties)
|
|
646
|
-
*
|
|
647
|
-
* @example
|
|
648
|
-
* ```ts
|
|
649
|
-
* applyColumnState(field: string, state: ColumnState): void {
|
|
650
|
-
* // Check for filter property added via module augmentation
|
|
651
|
-
* const filter = (state as any).filter;
|
|
652
|
-
* if (filter) {
|
|
653
|
-
* this.filterModels.set(field, filter);
|
|
654
|
-
* this.applyFilter();
|
|
655
|
-
* }
|
|
656
|
-
* }
|
|
657
|
-
* ```
|
|
658
|
-
*/
|
|
659
|
-
applyColumnState?(field: string, state: ColumnState): void;
|
|
660
|
-
/**
|
|
661
|
-
* Report horizontal scroll boundary offsets for this plugin.
|
|
662
|
-
* Plugins that obscure part of the scroll area (e.g., pinned/sticky columns)
|
|
663
|
-
* should return how much space they occupy on each side.
|
|
664
|
-
* The keyboard navigation uses this to ensure focused cells are fully visible.
|
|
665
|
-
*
|
|
666
|
-
* @param rowEl - The row element (optional, for calculating widths from rendered cells)
|
|
667
|
-
* @param focusedCell - The currently focused cell element (optional, to determine if scrolling should be skipped)
|
|
668
|
-
* @returns Object with left/right pixel offsets and optional skipScroll flag, or undefined if plugin has no offsets
|
|
669
|
-
*
|
|
670
|
-
* @example
|
|
671
|
-
* ```ts
|
|
672
|
-
* getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): { left: number; right: number; skipScroll?: boolean } | undefined {
|
|
673
|
-
* // Calculate total width of left-pinned columns
|
|
674
|
-
* const leftCells = rowEl?.querySelectorAll('.sticky-left') ?? [];
|
|
675
|
-
* let left = 0;
|
|
676
|
-
* leftCells.forEach(el => { left += (el as HTMLElement).offsetWidth; });
|
|
677
|
-
* // Skip scroll if focused cell is pinned (always visible)
|
|
678
|
-
* const skipScroll = focusedCell?.classList.contains('sticky-left');
|
|
679
|
-
* return { left, right: 0, skipScroll };
|
|
680
|
-
* }
|
|
681
|
-
* ```
|
|
682
|
-
*/
|
|
683
|
-
getHorizontalScrollOffsets?(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
|
|
684
|
-
left: number;
|
|
685
|
-
right: number;
|
|
686
|
-
skipScroll?: boolean;
|
|
687
|
-
} | undefined;
|
|
688
|
-
/**
|
|
689
|
-
* Register a tool panel for this plugin.
|
|
690
|
-
* Return undefined if plugin has no tool panel.
|
|
691
|
-
* The shell will create a toolbar toggle button and render the panel content
|
|
692
|
-
* when the user opens the panel.
|
|
693
|
-
*
|
|
694
|
-
* @returns Tool panel definition, or undefined if plugin has no panel
|
|
695
|
-
*
|
|
696
|
-
* @example
|
|
697
|
-
* ```ts
|
|
698
|
-
* getToolPanel(): ToolPanelDefinition | undefined {
|
|
699
|
-
* return {
|
|
700
|
-
* id: 'columns',
|
|
701
|
-
* title: 'Columns',
|
|
702
|
-
* icon: '☰',
|
|
703
|
-
* tooltip: 'Show/hide columns',
|
|
704
|
-
* order: 10,
|
|
705
|
-
* render: (container) => {
|
|
706
|
-
* this.renderColumnList(container);
|
|
707
|
-
* return () => this.cleanup();
|
|
708
|
-
* },
|
|
709
|
-
* };
|
|
710
|
-
* }
|
|
711
|
-
* ```
|
|
712
|
-
*/
|
|
713
|
-
getToolPanel?(): ToolPanelDefinition | undefined;
|
|
714
|
-
/**
|
|
715
|
-
* Register content for the shell header center section.
|
|
716
|
-
* Return undefined if plugin has no header content.
|
|
717
|
-
* Examples: search input, selection summary, status indicators.
|
|
718
|
-
*
|
|
719
|
-
* @returns Header content definition, or undefined if plugin has no header content
|
|
720
|
-
*
|
|
721
|
-
* @example
|
|
722
|
-
* ```ts
|
|
723
|
-
* getHeaderContent(): HeaderContentDefinition | undefined {
|
|
724
|
-
* return {
|
|
725
|
-
* id: 'quick-filter',
|
|
726
|
-
* order: 10,
|
|
727
|
-
* render: (container) => {
|
|
728
|
-
* const input = document.createElement('input');
|
|
729
|
-
* input.type = 'text';
|
|
730
|
-
* input.placeholder = 'Search...';
|
|
731
|
-
* input.addEventListener('input', this.handleInput);
|
|
732
|
-
* container.appendChild(input);
|
|
733
|
-
* return () => input.removeEventListener('input', this.handleInput);
|
|
734
|
-
* },
|
|
735
|
-
* };
|
|
736
|
-
* }
|
|
737
|
-
* ```
|
|
738
|
-
*/
|
|
739
|
-
getHeaderContent?(): HeaderContentDefinition | undefined;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* Built-in sort implementation using column comparator or default.
|
|
744
|
-
* This is the default sortHandler when none is configured.
|
|
745
|
-
*/
|
|
746
|
-
export declare function builtInSort<T>(rows: T[], sortState: SortState, columns: ColumnConfig<T>[]): T[];
|
|
747
|
-
|
|
748
|
-
/**
|
|
749
|
-
* Cell click event
|
|
750
|
-
*/
|
|
751
|
-
export declare interface CellClickEvent {
|
|
752
|
-
rowIndex: number;
|
|
753
|
-
colIndex: number;
|
|
754
|
-
field: string;
|
|
755
|
-
value: any;
|
|
756
|
-
row: any;
|
|
757
|
-
cellEl: HTMLElement;
|
|
758
|
-
originalEvent: MouseEvent;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
export declare interface CellCommitDetail<TRow = unknown> {
|
|
762
|
-
/** The mutated row after commit. */
|
|
763
|
-
row: TRow;
|
|
764
|
-
/** Field name whose value changed. */
|
|
765
|
-
field: string;
|
|
766
|
-
/** New value stored. */
|
|
767
|
-
value: unknown;
|
|
768
|
-
/** Index of the row in current data set. */
|
|
769
|
-
rowIndex: number;
|
|
770
|
-
/** All rows that have at least one committed change (snapshot list). */
|
|
771
|
-
changedRows: TRow[];
|
|
772
|
-
/** Indices parallel to changedRows. */
|
|
773
|
-
changedRowIndices: number[];
|
|
774
|
-
/** True if this row just entered the changed set. */
|
|
775
|
-
firstTimeForRow: boolean;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
/**
|
|
779
|
-
* Runtime cell context used internally for compiled template execution.
|
|
780
|
-
*/
|
|
781
|
-
declare interface CellContext<T = any> {
|
|
782
|
-
row: T;
|
|
783
|
-
value: unknown;
|
|
784
|
-
field: string;
|
|
785
|
-
column: ColumnInternal<T>;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
/**
|
|
789
|
-
* Cell coordinates
|
|
790
|
-
*/
|
|
791
|
-
export declare interface CellCoords {
|
|
792
|
-
row: number;
|
|
793
|
-
col: number;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
/**
|
|
797
|
-
* Cell editor interface for plugins.
|
|
798
|
-
*/
|
|
799
|
-
export declare interface CellEditor {
|
|
800
|
-
create(ctx: PluginCellRenderContext, commitFn: (value: any) => void, cancelFn: () => void): HTMLElement;
|
|
801
|
-
getValue?(element: HTMLElement): any;
|
|
802
|
-
focus?(element: HTMLElement): void;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* Cell mouse event (for drag operations, selection, etc.)
|
|
807
|
-
*/
|
|
808
|
-
export declare interface CellMouseEvent {
|
|
809
|
-
/** Event type: mousedown, mousemove, or mouseup */
|
|
810
|
-
type: 'mousedown' | 'mousemove' | 'mouseup';
|
|
811
|
-
/** Row index, undefined if not over a data cell */
|
|
812
|
-
rowIndex?: number;
|
|
813
|
-
/** Column index, undefined if not over a cell */
|
|
814
|
-
colIndex?: number;
|
|
815
|
-
/** Field name, undefined if not over a cell */
|
|
816
|
-
field?: string;
|
|
817
|
-
/** Cell value, undefined if not over a data cell */
|
|
818
|
-
value?: unknown;
|
|
819
|
-
/** Row data object, undefined if not over a data row */
|
|
820
|
-
row?: unknown;
|
|
821
|
-
/** Column configuration, undefined if not over a column */
|
|
822
|
-
column?: ColumnConfig;
|
|
823
|
-
/** The cell element, undefined if not over a cell */
|
|
824
|
-
cellElement?: HTMLElement;
|
|
825
|
-
/** The row element, undefined if not over a row */
|
|
826
|
-
rowElement?: HTMLElement;
|
|
827
|
-
/** Whether the event is over a header cell */
|
|
828
|
-
isHeader: boolean;
|
|
829
|
-
/** Cell coordinates if over a valid data cell */
|
|
830
|
-
cell?: CellCoords;
|
|
831
|
-
/** The original mouse event */
|
|
832
|
-
originalEvent: MouseEvent;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
/** Public representation of a cell range (for events) */
|
|
836
|
-
export declare interface CellRange {
|
|
837
|
-
/** Starting cell coordinates */
|
|
838
|
-
from: {
|
|
839
|
-
row: number;
|
|
840
|
-
col: number;
|
|
841
|
-
};
|
|
842
|
-
/** Ending cell coordinates */
|
|
843
|
-
to: {
|
|
844
|
-
row: number;
|
|
845
|
-
col: number;
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
* Context passed to custom view renderers (pure display – no commit helpers).
|
|
851
|
-
*/
|
|
852
|
-
export declare interface CellRenderContext<TRow = any, TValue = any> {
|
|
853
|
-
/** Row object for the cell being rendered. */
|
|
854
|
-
row: TRow;
|
|
855
|
-
/** Value at field. */
|
|
856
|
-
value: TValue;
|
|
857
|
-
/** Field key. */
|
|
858
|
-
field: keyof TRow & string;
|
|
859
|
-
/** Column configuration reference. */
|
|
860
|
-
column: ColumnConfig<TRow>;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
/**
|
|
864
|
-
* Cell renderer function type for plugins.
|
|
865
|
-
*/
|
|
866
|
-
export declare type CellRenderer = (ctx: PluginCellRenderContext) => string | HTMLElement;
|
|
867
|
-
|
|
868
|
-
/** Emitted when the changed rows tracking set is cleared programmatically. */
|
|
869
|
-
export declare interface ChangedRowsResetDetail<TRow = unknown> {
|
|
870
|
-
/** New (empty) changed rows array after reset. */
|
|
871
|
-
rows: TRow[];
|
|
872
|
-
/** Parallel indices (likely empty). */
|
|
873
|
-
indices: number[];
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
* Full column configuration including optional custom view/renderer & grouping metadata.
|
|
878
|
-
*/
|
|
879
|
-
export declare interface ColumnConfig<TRow = any> extends BaseColumnConfig<TRow, any> {
|
|
880
|
-
/** Optional custom view renderer used instead of default text rendering */
|
|
881
|
-
viewRenderer?: ColumnViewRenderer<TRow, any>;
|
|
882
|
-
/** External view spec (lets host app mount any framework component) */
|
|
883
|
-
externalView?: {
|
|
884
|
-
component: unknown;
|
|
885
|
-
props?: Record<string, unknown>;
|
|
886
|
-
mount?: (options: {
|
|
887
|
-
placeholder: HTMLElement;
|
|
888
|
-
context: CellRenderContext<TRow, unknown>;
|
|
889
|
-
spec: unknown;
|
|
890
|
-
}) => void | {
|
|
891
|
-
dispose?: () => void;
|
|
892
|
-
};
|
|
893
|
-
};
|
|
894
|
-
/** Whether the column is initially hidden */
|
|
895
|
-
hidden?: boolean;
|
|
896
|
-
/** Prevent this column from being hidden by the visibility plugin */
|
|
897
|
-
lockVisible?: boolean;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
export declare type ColumnConfigMap<TRow = any> = ColumnConfig<TRow>[];
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* Context object provided to editor factories allowing mutation (commit/cancel) of a cell value.
|
|
904
|
-
*/
|
|
905
|
-
export declare interface ColumnEditorContext<TRow = any, TValue = any> {
|
|
906
|
-
/** Underlying full row object for the active edit. */
|
|
907
|
-
row: TRow;
|
|
908
|
-
/** Current cell value (mutable only via commit). */
|
|
909
|
-
value: TValue;
|
|
910
|
-
/** Field name being edited. */
|
|
911
|
-
field: keyof TRow & string;
|
|
912
|
-
/** Column configuration reference. */
|
|
913
|
-
column: ColumnConfig<TRow>;
|
|
914
|
-
/** Accept the edit; triggers change tracking + rerender. */
|
|
915
|
-
commit: (newValue: TValue) => void;
|
|
916
|
-
/** Abort edit without persisting changes. */
|
|
917
|
-
cancel: () => void;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
/** External editor spec: tag name, factory function, or external mount spec */
|
|
921
|
-
export declare type ColumnEditorSpec<TRow = unknown, TValue = unknown> = string | ((context: ColumnEditorContext<TRow, TValue>) => HTMLElement | string) | {
|
|
922
|
-
/** Arbitrary component reference (class, function, token) */
|
|
923
|
-
component: unknown;
|
|
924
|
-
/** Optional static props passed to mount */
|
|
925
|
-
props?: Record<string, unknown>;
|
|
926
|
-
/** Optional custom mount function; if provided we call it directly instead of emitting an event */
|
|
927
|
-
mount?: (options: {
|
|
928
|
-
placeholder: HTMLElement;
|
|
929
|
-
context: ColumnEditorContext<TRow, TValue>;
|
|
930
|
-
spec: unknown;
|
|
931
|
-
}) => void | {
|
|
932
|
-
dispose?: () => void;
|
|
933
|
-
};
|
|
934
|
-
};
|
|
935
|
-
|
|
936
|
-
declare interface ColumnInternal<T = any> extends ColumnConfig<T> {
|
|
937
|
-
__autoSized?: boolean;
|
|
938
|
-
__userResized?: boolean;
|
|
939
|
-
__renderedWidth?: number;
|
|
940
|
-
/** Original configured width (for reset on double-click) */
|
|
941
|
-
__originalWidth?: number;
|
|
942
|
-
__viewTemplate?: HTMLElement;
|
|
943
|
-
__editorTemplate?: HTMLElement;
|
|
944
|
-
__headerTemplate?: HTMLElement;
|
|
945
|
-
__compiledView?: (ctx: CellContext<T>) => string;
|
|
946
|
-
__compiledEditor?: (ctx: EditorExecContext<T>) => string;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
/** Column resize event detail containing final pixel width. */
|
|
950
|
-
export declare interface ColumnResizeDetail {
|
|
951
|
-
/** Resized column field key. */
|
|
952
|
-
field: string;
|
|
953
|
-
/** New width in pixels. */
|
|
954
|
-
width: number;
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
/**
|
|
958
|
-
* Sort state for a column
|
|
959
|
-
*/
|
|
960
|
-
export declare interface ColumnSortState {
|
|
961
|
-
/** Sort direction */
|
|
962
|
-
direction: 'asc' | 'desc';
|
|
963
|
-
/** Priority for multi-sort (0 = primary, 1 = secondary, etc.) */
|
|
964
|
-
priority: number;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
/**
|
|
968
|
-
* State for a single column. Captures user-driven changes at runtime.
|
|
969
|
-
* Plugins can extend this interface via module augmentation to add their own state.
|
|
970
|
-
*
|
|
971
|
-
* @example
|
|
972
|
-
* ```ts
|
|
973
|
-
* // In filtering plugin
|
|
974
|
-
* declare module '@toolbox-web/grid' {
|
|
975
|
-
* interface ColumnState {
|
|
976
|
-
* filter?: FilterValue;
|
|
977
|
-
* }
|
|
978
|
-
* }
|
|
979
|
-
* ```
|
|
980
|
-
*/
|
|
981
|
-
export declare interface ColumnState {
|
|
982
|
-
/** Column field identifier */
|
|
983
|
-
field: string;
|
|
984
|
-
/** Position index after reordering (0-based) */
|
|
985
|
-
order: number;
|
|
986
|
-
/** Width in pixels (undefined = use default) */
|
|
987
|
-
width?: number;
|
|
988
|
-
/** Visibility state */
|
|
989
|
-
visible: boolean;
|
|
990
|
-
/** Sort state (undefined = not sorted) */
|
|
991
|
-
sort?: ColumnSortState;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
export declare type ColumnViewRenderer<TRow = unknown, TValue = unknown> = (ctx: CellRenderContext<TRow, TValue>) => Node | string | void;
|
|
995
|
-
|
|
996
|
-
/**
|
|
997
|
-
* Context menu item (used by context-menu plugin query)
|
|
998
|
-
*/
|
|
999
|
-
export declare interface ContextMenuItem {
|
|
1000
|
-
id: string;
|
|
1001
|
-
label: string;
|
|
1002
|
-
icon?: string;
|
|
1003
|
-
disabled?: boolean;
|
|
1004
|
-
separator?: boolean;
|
|
1005
|
-
children?: ContextMenuItem[];
|
|
1006
|
-
action?: (params: ContextMenuParams) => void;
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
/**
|
|
1010
|
-
* Context menu parameters
|
|
1011
|
-
*/
|
|
1012
|
-
export declare interface ContextMenuParams {
|
|
1013
|
-
x: number;
|
|
1014
|
-
y: number;
|
|
1015
|
-
rowIndex?: number;
|
|
1016
|
-
colIndex?: number;
|
|
1017
|
-
field?: string;
|
|
1018
|
-
value?: any;
|
|
1019
|
-
row?: any;
|
|
1020
|
-
column?: ColumnConfig;
|
|
1021
|
-
isHeader?: boolean;
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
export declare type DataGridCustomEvent<K extends keyof DataGridEventMap<unknown>, TRow = unknown> = CustomEvent<DataGridEventMap<TRow>[K]>;
|
|
1025
|
-
|
|
1026
|
-
export declare class DataGridElement<T = any> extends HTMLElement implements InternalGrid<T> {
|
|
1027
|
-
#private;
|
|
1028
|
-
static readonly tagName = "tbw-grid";
|
|
1029
|
-
static readonly version: string;
|
|
1030
|
-
static get observedAttributes(): string[];
|
|
1031
|
-
_rows: T[];
|
|
1032
|
-
get _columns(): ColumnInternal<T>[];
|
|
1033
|
-
set _columns(value: ColumnInternal<T>[]);
|
|
1034
|
-
get _visibleColumns(): ColumnInternal<T>[];
|
|
1035
|
-
_headerRowEl: HTMLElement;
|
|
1036
|
-
_bodyEl: HTMLElement;
|
|
1037
|
-
_rowPool: HTMLElement[];
|
|
1038
|
-
_resizeController: ResizeController;
|
|
1039
|
-
_virtualization: VirtualState;
|
|
1040
|
-
_focusRow: number;
|
|
1041
|
-
_focusCol: number;
|
|
1042
|
-
_sortState: {
|
|
1043
|
-
field: string;
|
|
1044
|
-
direction: 1 | -1;
|
|
1045
|
-
} | null;
|
|
1046
|
-
_activeEditRows: number;
|
|
1047
|
-
_rowEditSnapshots: Map<number, T>;
|
|
1048
|
-
_changedRowIndices: Set<number>;
|
|
1049
|
-
_gridTemplate: string;
|
|
1050
|
-
__rowRenderEpoch: number;
|
|
1051
|
-
__didInitialAutoSize: boolean;
|
|
1052
|
-
__lightDomColumnsCache?: ColumnInternal[];
|
|
1053
|
-
__originalColumnNodes?: HTMLElement[];
|
|
1054
|
-
__originalOrder: T[];
|
|
1055
|
-
get rows(): T[];
|
|
1056
|
-
set rows(value: T[]);
|
|
1057
|
-
/**
|
|
1058
|
-
* Get the original unfiltered/unprocessed rows.
|
|
1059
|
-
* Use this when you need access to all source data regardless of active filters.
|
|
1060
|
-
*/
|
|
1061
|
-
get sourceRows(): T[];
|
|
1062
|
-
get columns(): ColumnConfig<T>[];
|
|
1063
|
-
set columns(value: ColumnConfig<T>[] | ColumnConfigMap<T> | undefined);
|
|
1064
|
-
get gridConfig(): GridConfig<T>;
|
|
1065
|
-
set gridConfig(value: GridConfig<T> | undefined);
|
|
1066
|
-
get fitMode(): FitMode;
|
|
1067
|
-
set fitMode(value: FitMode | undefined);
|
|
1068
|
-
get editOn(): string | undefined;
|
|
1069
|
-
set editOn(value: string | undefined);
|
|
1070
|
-
/* Excluded from this release type: effectiveConfig */
|
|
1071
|
-
/* Excluded from this release type: disconnectSignal */
|
|
1072
|
-
constructor();
|
|
1073
|
-
/* Excluded from this release type: getPlugin */
|
|
1074
|
-
/* Excluded from this release type: getPluginByName */
|
|
1075
|
-
/* Excluded from this release type: requestRender */
|
|
1076
|
-
/* Excluded from this release type: updateTemplate */
|
|
1077
|
-
/* Excluded from this release type: requestAfterRender */
|
|
1078
|
-
connectedCallback(): void;
|
|
1079
|
-
disconnectedCallback(): void;
|
|
1080
|
-
/**
|
|
1081
|
-
* Handle HTML attribute changes.
|
|
1082
|
-
* Only processes attribute values when SET (non-null).
|
|
1083
|
-
* Removing an attribute does NOT clear JS-set properties.
|
|
1084
|
-
*/
|
|
1085
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
1086
|
-
_emitCellCommit(detail: CellCommitDetail<T>): void;
|
|
1087
|
-
_emitRowCommit(detail: RowCommitDetail<T>): void;
|
|
1088
|
-
_emitSortChange(detail: SortChangeDetail): void;
|
|
1089
|
-
_emitColumnResize(detail: ColumnResizeDetail): void;
|
|
1090
|
-
_emitActivateCell(detail: ActivateCellDetail): void;
|
|
1091
|
-
/* Excluded from this release type: findHeaderRow */
|
|
1092
|
-
/* Excluded from this release type: findRenderedRowElement */
|
|
1093
|
-
/**
|
|
1094
|
-
* Dispatch a cell click event to the plugin system.
|
|
1095
|
-
* Returns true if any plugin handled the event.
|
|
1096
|
-
*/
|
|
1097
|
-
_dispatchCellClick(event: MouseEvent, rowIndex: number, colIndex: number, cellEl: HTMLElement): boolean;
|
|
1098
|
-
/**
|
|
1099
|
-
* Dispatch a row click event to the plugin system.
|
|
1100
|
-
* Returns true if any plugin handled the event.
|
|
1101
|
-
*/
|
|
1102
|
-
_dispatchRowClick(event: MouseEvent, rowIndex: number, row: any, rowEl: HTMLElement): boolean;
|
|
1103
|
-
/**
|
|
1104
|
-
* Dispatch a header click event to the plugin system.
|
|
1105
|
-
* Returns true if any plugin handled the event.
|
|
1106
|
-
*/
|
|
1107
|
-
_dispatchHeaderClick(event: MouseEvent, colIndex: number, headerEl: HTMLElement): boolean;
|
|
1108
|
-
/**
|
|
1109
|
-
* Dispatch a keyboard event to the plugin system.
|
|
1110
|
-
* Returns true if any plugin handled the event.
|
|
1111
|
-
*/
|
|
1112
|
-
_dispatchKeyDown(event: KeyboardEvent): boolean;
|
|
1113
|
-
/**
|
|
1114
|
-
* Get horizontal scroll boundary offsets from plugins.
|
|
1115
|
-
* Used by keyboard navigation to ensure focused cells are fully visible
|
|
1116
|
-
* when plugins like pinned columns obscure part of the scroll area.
|
|
1117
|
-
*/
|
|
1118
|
-
_getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
|
|
1119
|
-
left: number;
|
|
1120
|
-
right: number;
|
|
1121
|
-
skipScroll?: boolean;
|
|
1122
|
-
};
|
|
1123
|
-
/* Excluded from this release type: queryPlugins */
|
|
1124
|
-
get changedRows(): T[];
|
|
1125
|
-
get changedRowIndices(): number[];
|
|
1126
|
-
resetChangedRows(silent?: boolean): Promise<void>;
|
|
1127
|
-
beginBulkEdit(rowIndex: number): Promise<void>;
|
|
1128
|
-
commitActiveRowEdit(): Promise<void>;
|
|
1129
|
-
ready(): Promise<void>;
|
|
1130
|
-
forceLayout(): Promise<void>;
|
|
1131
|
-
/** Public method: returns a frozen snapshot of the merged effective configuration */
|
|
1132
|
-
getConfig(): Promise<Readonly<GridConfig<T>>>;
|
|
1133
|
-
/**
|
|
1134
|
-
* Set the visibility of a column.
|
|
1135
|
-
* @param field - The field name of the column
|
|
1136
|
-
* @param visible - Whether the column should be visible
|
|
1137
|
-
* @returns True if visibility was changed, false if column not found or locked
|
|
1138
|
-
*/
|
|
1139
|
-
setColumnVisible(field: string, visible: boolean): boolean;
|
|
1140
|
-
/**
|
|
1141
|
-
* Toggle the visibility of a column.
|
|
1142
|
-
* @param field - The field name of the column
|
|
1143
|
-
* @returns True if visibility was toggled, false if column not found or locked
|
|
1144
|
-
*/
|
|
1145
|
-
toggleColumnVisibility(field: string): boolean;
|
|
1146
|
-
/**
|
|
1147
|
-
* Check if a column is currently visible.
|
|
1148
|
-
* @param field - The field name of the column
|
|
1149
|
-
* @returns True if visible, false if hidden or not found
|
|
1150
|
-
*/
|
|
1151
|
-
isColumnVisible(field: string): boolean;
|
|
1152
|
-
/**
|
|
1153
|
-
* Show all columns.
|
|
1154
|
-
*/
|
|
1155
|
-
showAllColumns(): void;
|
|
1156
|
-
/**
|
|
1157
|
-
* Get list of all column fields (including hidden).
|
|
1158
|
-
* Returns columns reflecting current display order (after reordering).
|
|
1159
|
-
* Hidden columns are interleaved at their original relative positions.
|
|
1160
|
-
* @returns Array of all field names with their visibility status
|
|
1161
|
-
*/
|
|
1162
|
-
getAllColumns(): Array<{
|
|
1163
|
-
field: string;
|
|
1164
|
-
header: string;
|
|
1165
|
-
visible: boolean;
|
|
1166
|
-
lockVisible?: boolean;
|
|
1167
|
-
}>;
|
|
1168
|
-
/**
|
|
1169
|
-
* Reorder columns according to the specified field order.
|
|
1170
|
-
* This directly updates _columns in place without going through processColumns.
|
|
1171
|
-
* @param order - Array of field names in the desired order
|
|
1172
|
-
*/
|
|
1173
|
-
setColumnOrder(order: string[]): void;
|
|
1174
|
-
/**
|
|
1175
|
-
* Get the current column order as an array of field names.
|
|
1176
|
-
* @returns Array of field names in display order
|
|
1177
|
-
*/
|
|
1178
|
-
getColumnOrder(): string[];
|
|
1179
|
-
/**
|
|
1180
|
-
* Get the current column state, including order, width, visibility, sort, and plugin state.
|
|
1181
|
-
* Returns a serializable object suitable for localStorage or database storage.
|
|
1182
|
-
*/
|
|
1183
|
-
getColumnState(): GridColumnState;
|
|
1184
|
-
/**
|
|
1185
|
-
* Set the column state, restoring order, width, visibility, sort, and plugin state.
|
|
1186
|
-
* Use this to restore previously saved column state.
|
|
1187
|
-
*/
|
|
1188
|
-
set columnState(state: GridColumnState | undefined);
|
|
1189
|
-
/**
|
|
1190
|
-
* Get the current column state.
|
|
1191
|
-
*/
|
|
1192
|
-
get columnState(): GridColumnState | undefined;
|
|
1193
|
-
/* Excluded from this release type: requestStateChange */
|
|
1194
|
-
/**
|
|
1195
|
-
* Reset column state to initial configuration.
|
|
1196
|
-
* Clears all user modifications (order, width, visibility, sort).
|
|
1197
|
-
*/
|
|
1198
|
-
resetColumnState(): void;
|
|
1199
|
-
/** Check if the tool panel is currently open. */
|
|
1200
|
-
get isToolPanelOpen(): boolean;
|
|
1201
|
-
/**
|
|
1202
|
-
* Get the currently active tool panel ID, or null if none is open.
|
|
1203
|
-
* @deprecated Use isToolPanelOpen and expandedToolPanelSections instead.
|
|
1204
|
-
*/
|
|
1205
|
-
get activeToolPanel(): string | null;
|
|
1206
|
-
/** Get the IDs of expanded accordion sections. */
|
|
1207
|
-
get expandedToolPanelSections(): string[];
|
|
1208
|
-
/** Open the tool panel (accordion view with all registered panels). */
|
|
1209
|
-
openToolPanel(): void;
|
|
1210
|
-
/** Close the tool panel. */
|
|
1211
|
-
closeToolPanel(): void;
|
|
1212
|
-
/** Toggle the tool panel open/closed. */
|
|
1213
|
-
toggleToolPanel(): void;
|
|
1214
|
-
/** Toggle an accordion section expanded/collapsed. */
|
|
1215
|
-
toggleToolPanelSection(sectionId: string): void;
|
|
1216
|
-
/** Get registered tool panel definitions. */
|
|
1217
|
-
getToolPanels(): ToolPanelDefinition[];
|
|
1218
|
-
/** Register a custom tool panel (without creating a plugin). */
|
|
1219
|
-
registerToolPanel(panel: ToolPanelDefinition): void;
|
|
1220
|
-
/** Unregister a custom tool panel. */
|
|
1221
|
-
unregisterToolPanel(panelId: string): void;
|
|
1222
|
-
/** Get registered header content definitions. */
|
|
1223
|
-
getHeaderContents(): HeaderContentDefinition[];
|
|
1224
|
-
/** Register custom header content (without creating a plugin). */
|
|
1225
|
-
registerHeaderContent(content: HeaderContentDefinition): void;
|
|
1226
|
-
/** Unregister custom header content. */
|
|
1227
|
-
unregisterHeaderContent(contentId: string): void;
|
|
1228
|
-
/** Get all registered toolbar buttons. */
|
|
1229
|
-
getToolbarButtons(): ToolbarButtonInfo[];
|
|
1230
|
-
/** Register a custom toolbar button programmatically. */
|
|
1231
|
-
registerToolbarButton(button: ToolbarButtonConfig): void;
|
|
1232
|
-
/** Unregister a custom toolbar button. */
|
|
1233
|
-
unregisterToolbarButton(buttonId: string): void;
|
|
1234
|
-
/** Enable/disable a toolbar button by ID. */
|
|
1235
|
-
setToolbarButtonDisabled(buttonId: string, disabled: boolean): void;
|
|
1236
|
-
/**
|
|
1237
|
-
* Re-parse light DOM shell elements and refresh shell header.
|
|
1238
|
-
* Call this after dynamically modifying <tbw-grid-header> children.
|
|
1239
|
-
*/
|
|
1240
|
-
refreshShellHeader(): void;
|
|
1241
|
-
/* Excluded from this release type: refreshVirtualWindow */
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
/**
|
|
1245
|
-
* The compiled webcomponent interface for DataGrid
|
|
1246
|
-
*/
|
|
1247
|
-
export declare interface DataGridElementInterface extends PublicGrid, HTMLElement {
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
export declare interface DataGridEventMap<TRow = unknown> {
|
|
1251
|
-
'cell-commit': CellCommitDetail<TRow>;
|
|
1252
|
-
'row-commit': RowCommitDetail<TRow>;
|
|
1253
|
-
'changed-rows-reset': ChangedRowsResetDetail<TRow>;
|
|
1254
|
-
'mount-external-view': ExternalMountViewDetail<TRow>;
|
|
1255
|
-
'mount-external-editor': ExternalMountEditorDetail<TRow>;
|
|
1256
|
-
'sort-change': SortChangeDetail;
|
|
1257
|
-
'column-resize': ColumnResizeDetail;
|
|
1258
|
-
'activate-cell': ActivateCellDetail;
|
|
1259
|
-
'column-state-change': GridColumnState;
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
/** Default animation configuration */
|
|
1263
|
-
export declare const DEFAULT_ANIMATION_CONFIG: Required<Omit<AnimationConfig, 'sort'>>;
|
|
1264
|
-
|
|
1265
|
-
/** Default icons used when not overridden */
|
|
1266
|
-
export declare const DEFAULT_GRID_ICONS: Required<GridIcons>;
|
|
1267
|
-
|
|
1268
|
-
/**
|
|
1269
|
-
* Default comparator for sorting values.
|
|
1270
|
-
* Handles nulls (pushed to end), numbers, and string fallback.
|
|
1271
|
-
*/
|
|
1272
|
-
export declare function defaultComparator(a: unknown, b: unknown): number;
|
|
1273
|
-
|
|
1274
|
-
export declare type DGEventName = (typeof DGEvents)[keyof typeof DGEvents];
|
|
1275
|
-
|
|
1276
|
-
export declare const DGEvents: {
|
|
1277
|
-
readonly CELL_COMMIT: "cell-commit";
|
|
1278
|
-
readonly ROW_COMMIT: "row-commit";
|
|
1279
|
-
readonly CHANGED_ROWS_RESET: "changed-rows-reset";
|
|
1280
|
-
readonly MOUNT_EXTERNAL_VIEW: "mount-external-view";
|
|
1281
|
-
readonly MOUNT_EXTERNAL_EDITOR: "mount-external-editor";
|
|
1282
|
-
readonly SORT_CHANGE: "sort-change";
|
|
1283
|
-
readonly COLUMN_RESIZE: "column-resize";
|
|
1284
|
-
readonly ACTIVATE_CELL: "activate-cell";
|
|
1285
|
-
readonly GROUP_TOGGLE: "group-toggle";
|
|
1286
|
-
readonly COLUMN_STATE_CHANGE: "column-state-change";
|
|
1287
|
-
};
|
|
1288
|
-
|
|
1289
|
-
/** Represents a single edit action that can be undone/redone */
|
|
1290
|
-
export declare interface EditAction {
|
|
1291
|
-
/** Type of action - currently only 'cell-edit' is supported */
|
|
1292
|
-
type: 'cell-edit';
|
|
1293
|
-
/** The row index where the edit occurred */
|
|
1294
|
-
rowIndex: number;
|
|
1295
|
-
/** The field (column key) that was edited */
|
|
1296
|
-
field: string;
|
|
1297
|
-
/** The value before the edit */
|
|
1298
|
-
oldValue: unknown;
|
|
1299
|
-
/** The value after the edit */
|
|
1300
|
-
newValue: unknown;
|
|
1301
|
-
/** Unix timestamp when the edit occurred */
|
|
1302
|
-
timestamp: number;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
/**
|
|
1306
|
-
* Internal editor execution context extending the generic cell context with commit helpers.
|
|
1307
|
-
*/
|
|
1308
|
-
declare interface EditorExecContext<T = any> extends CellContext<T> {
|
|
1309
|
-
commit: (newValue: unknown) => void;
|
|
1310
|
-
cancel: () => void;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
/**
|
|
1314
|
-
* Tree Data Plugin Types
|
|
1315
|
-
*
|
|
1316
|
-
* Type definitions for hierarchical tree data with expand/collapse functionality.
|
|
1317
|
-
*/
|
|
1318
|
-
/** Animation style for expand/collapse */
|
|
1319
|
-
declare type ExpandCollapseAnimation = false | 'slide' | 'fade';
|
|
1320
|
-
|
|
1321
|
-
/** Animation style for expand/collapse */
|
|
1322
|
-
declare type ExpandCollapseAnimation_2 = false | 'slide' | 'fade';
|
|
1323
|
-
|
|
1324
|
-
/** Animation style for expand/collapse */
|
|
1325
|
-
declare type ExpandCollapseAnimation_3 = false | 'slide' | 'fade';
|
|
1326
|
-
|
|
1327
|
-
/**
|
|
1328
|
-
* Export Plugin Types
|
|
1329
|
-
*
|
|
1330
|
-
* Type definitions for the data export feature.
|
|
1331
|
-
*/
|
|
1332
|
-
/** Supported export formats */
|
|
1333
|
-
export declare type ExportFormat = 'csv' | 'excel' | 'json';
|
|
1334
|
-
|
|
1335
|
-
/** Parameters for a specific export operation */
|
|
1336
|
-
export declare interface ExportParams {
|
|
1337
|
-
/** Export format */
|
|
1338
|
-
format: ExportFormat;
|
|
1339
|
-
/** File name for the export (without extension) */
|
|
1340
|
-
fileName?: string;
|
|
1341
|
-
/** Specific column fields to export */
|
|
1342
|
-
columns?: string[];
|
|
1343
|
-
/** Specific row indices to export */
|
|
1344
|
-
rowIndices?: number[];
|
|
1345
|
-
/** Include column headers in export */
|
|
1346
|
-
includeHeaders?: boolean;
|
|
1347
|
-
/** Custom cell value processor */
|
|
1348
|
-
processCell?: (value: any, field: string, row: any) => any;
|
|
1349
|
-
/** Custom header processor */
|
|
1350
|
-
processHeader?: (header: string, field: string) => string;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
export declare interface ExternalMountEditorDetail<TRow = unknown> {
|
|
1354
|
-
placeholder: HTMLElement;
|
|
1355
|
-
spec: unknown;
|
|
1356
|
-
context: {
|
|
1357
|
-
row: TRow;
|
|
1358
|
-
value: unknown;
|
|
1359
|
-
field: string;
|
|
1360
|
-
column: unknown;
|
|
1361
|
-
commit: (v: unknown) => void;
|
|
1362
|
-
cancel: () => void;
|
|
1363
|
-
};
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
export declare interface ExternalMountViewDetail<TRow = unknown> {
|
|
1367
|
-
placeholder: HTMLElement;
|
|
1368
|
-
spec: unknown;
|
|
1369
|
-
context: {
|
|
1370
|
-
row: TRow;
|
|
1371
|
-
value: unknown;
|
|
1372
|
-
field: string;
|
|
1373
|
-
column: unknown;
|
|
1374
|
-
};
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
/** Configuration options for the filtering plugin */
|
|
1378
|
-
export declare interface FilterConfig<TRow = unknown> {
|
|
1379
|
-
/** Debounce delay in ms for filter input (default: 300) */
|
|
1380
|
-
debounceMs?: number;
|
|
1381
|
-
/** Whether text filtering is case sensitive (default: false) */
|
|
1382
|
-
caseSensitive?: boolean;
|
|
1383
|
-
/** Whether to trim whitespace from filter input (default: true) */
|
|
1384
|
-
trimInput?: boolean;
|
|
1385
|
-
/** Use Web Worker for filtering large datasets >1000 rows (default: true) */
|
|
1386
|
-
useWorker?: boolean;
|
|
1387
|
-
/** Custom filter panel renderer (replaces default panel content) */
|
|
1388
|
-
filterPanelRenderer?: FilterPanelRenderer;
|
|
1389
|
-
/**
|
|
1390
|
-
* Async handler for fetching unique values from a server.
|
|
1391
|
-
* When provided, this is called instead of extracting values from local rows.
|
|
1392
|
-
* Useful for server-side datasets where not all data is loaded.
|
|
1393
|
-
*/
|
|
1394
|
-
valuesHandler?: FilterValuesHandler;
|
|
1395
|
-
/**
|
|
1396
|
-
* Async handler for applying filters on a server.
|
|
1397
|
-
* When provided, filtering is delegated to the server instead of local filtering.
|
|
1398
|
-
* Should return the filtered rows from the server.
|
|
1399
|
-
*
|
|
1400
|
-
* Note: When using filterHandler, processRows() becomes a passthrough
|
|
1401
|
-
* and the returned rows replace the grid's data.
|
|
1402
|
-
*/
|
|
1403
|
-
filterHandler?: FilterHandler<TRow>;
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
/**
|
|
1407
|
-
* Async handler for applying filters on a server.
|
|
1408
|
-
*
|
|
1409
|
-
* For server-side filtering, this handler is called when filters change.
|
|
1410
|
-
* It should fetch filtered data from the server and return the new rows.
|
|
1411
|
-
* The plugin will replace the grid's rows with the returned data.
|
|
1412
|
-
*
|
|
1413
|
-
* @param filters - Current active filter models
|
|
1414
|
-
* @param currentRows - Current row array (for reference/optimistic updates)
|
|
1415
|
-
* @returns Promise resolving to filtered rows
|
|
1416
|
-
*
|
|
1417
|
-
* @example
|
|
1418
|
-
* ```ts
|
|
1419
|
-
* filterHandler: async (filters) => {
|
|
1420
|
-
* const params = new URLSearchParams();
|
|
1421
|
-
* filters.forEach(f => params.append(f.field, `${f.operator}:${f.value}`));
|
|
1422
|
-
* const response = await fetch(`/api/data?${params}`);
|
|
1423
|
-
* return response.json();
|
|
1424
|
-
* }
|
|
1425
|
-
* ```
|
|
1426
|
-
*/
|
|
1427
|
-
export declare type FilterHandler<TRow = unknown> = (filters: FilterModel[], currentRows: TRow[]) => TRow[] | Promise<TRow[]>;
|
|
1428
|
-
|
|
1429
|
-
/** Filter model representing a single filter condition */
|
|
1430
|
-
export declare interface FilterModel {
|
|
1431
|
-
/** The field/column to filter on */
|
|
1432
|
-
field: string;
|
|
1433
|
-
/** The type of filter */
|
|
1434
|
-
type: FilterType;
|
|
1435
|
-
/** The filter operator */
|
|
1436
|
-
operator: FilterOperator;
|
|
1437
|
-
/** The filter value (type depends on operator) */
|
|
1438
|
-
value: unknown;
|
|
1439
|
-
/** Secondary value for 'between' operator */
|
|
1440
|
-
valueTo?: unknown;
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
/** Filter operators for different filter types */
|
|
1444
|
-
export declare type FilterOperator = 'contains' | 'notContains' | 'equals' | 'notEquals' | 'startsWith' | 'endsWith' | 'blank' | 'notBlank' | 'lessThan' | 'lessThanOrEqual' | 'greaterThan' | 'greaterThanOrEqual' | 'between' | 'in' | 'notIn';
|
|
1445
|
-
|
|
1446
|
-
/** Parameters passed to custom filter panel renderer */
|
|
1447
|
-
declare interface FilterPanelParams {
|
|
1448
|
-
/** The field being filtered */
|
|
1449
|
-
field: string;
|
|
1450
|
-
/** The column configuration */
|
|
1451
|
-
column: ColumnConfig;
|
|
1452
|
-
/** All unique values for this field */
|
|
1453
|
-
uniqueValues: unknown[];
|
|
1454
|
-
/** Currently excluded values (for set filter) */
|
|
1455
|
-
excludedValues: Set<unknown>;
|
|
1456
|
-
/** Current search text */
|
|
1457
|
-
searchText: string;
|
|
1458
|
-
/** Apply a set filter (exclude these values) */
|
|
1459
|
-
applySetFilter: (excludedValues: unknown[]) => void;
|
|
1460
|
-
/** Apply a text filter */
|
|
1461
|
-
applyTextFilter: (operator: FilterOperator, value: string, valueTo?: string) => void;
|
|
1462
|
-
/** Clear the filter for this field */
|
|
1463
|
-
clearFilter: () => void;
|
|
1464
|
-
/** Close the filter panel */
|
|
1465
|
-
closePanel: () => void;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
/** Custom filter panel renderer function. Return undefined to use default panel for this column. */
|
|
1469
|
-
declare type FilterPanelRenderer = (container: HTMLElement, params: FilterPanelParams) => void | undefined;
|
|
1470
|
-
|
|
1471
|
-
/** Supported filter types */
|
|
1472
|
-
export declare type FilterType = 'text' | 'number' | 'date' | 'set' | 'boolean';
|
|
1473
|
-
|
|
1474
|
-
/**
|
|
1475
|
-
* Async handler for fetching unique filter values from a server.
|
|
1476
|
-
*
|
|
1477
|
-
* For server-side datasets where not all values are available locally,
|
|
1478
|
-
* this handler is called when the filter panel opens to fetch all
|
|
1479
|
-
* possible values for the column.
|
|
1480
|
-
*
|
|
1481
|
-
* @param field - The field/column name
|
|
1482
|
-
* @param column - The column configuration
|
|
1483
|
-
* @returns Promise resolving to array of unique values
|
|
1484
|
-
*
|
|
1485
|
-
* @example
|
|
1486
|
-
* ```ts
|
|
1487
|
-
* valuesHandler: async (field, column) => {
|
|
1488
|
-
* const response = await fetch(`/api/distinct/${field}`);
|
|
1489
|
-
* return response.json(); // ['Engineering', 'Marketing', 'Sales', ...]
|
|
1490
|
-
* }
|
|
1491
|
-
* ```
|
|
1492
|
-
*/
|
|
1493
|
-
export declare type FilterValuesHandler = (field: string, column: ColumnConfig) => Promise<unknown[]>;
|
|
1494
|
-
|
|
1495
|
-
export declare type FitMode = (typeof FitModeEnum)[keyof typeof FitModeEnum];
|
|
1496
|
-
|
|
1497
|
-
export declare const FitModeEnum: {
|
|
1498
|
-
readonly STRETCH: "stretch";
|
|
1499
|
-
readonly FIXED: "fixed";
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
|
-
export declare const getAggregator: (ref: AggregatorRef_2 | undefined) => AggregatorFn | undefined;
|
|
1503
|
-
|
|
1504
|
-
export declare interface GetRowsParams {
|
|
1505
|
-
startRow: number;
|
|
1506
|
-
endRow: number;
|
|
1507
|
-
sortModel?: Array<{
|
|
1508
|
-
field: string;
|
|
1509
|
-
direction: 'asc' | 'desc';
|
|
1510
|
-
}>;
|
|
1511
|
-
filterModel?: Record<string, any>;
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
export declare interface GetRowsResult {
|
|
1515
|
-
rows: any[];
|
|
1516
|
-
totalRowCount: number;
|
|
1517
|
-
lastRow?: number;
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
/**
|
|
1521
|
-
* Get a value-based aggregator function.
|
|
1522
|
-
* Used by Pivot plugin and other features that aggregate pre-extracted values.
|
|
1523
|
-
*
|
|
1524
|
-
* @param aggFunc - Aggregation function name ('sum', 'avg', 'count', 'min', 'max', 'first', 'last')
|
|
1525
|
-
* @returns Aggregator function that takes number[] and returns number
|
|
1526
|
-
*/
|
|
1527
|
-
export declare function getValueAggregator(aggFunc: string): ValueAggregatorFn;
|
|
1528
|
-
|
|
1529
|
-
/**
|
|
1530
|
-
* CSS class names used in the grid's shadow DOM.
|
|
1531
|
-
* Use these when adding/removing classes or querying elements.
|
|
1532
|
-
*
|
|
1533
|
-
* Classes are organized by:
|
|
1534
|
-
* - Core: Used by the grid core for structure and basic functionality
|
|
1535
|
-
* - Shared: Used by multiple features/plugins, styled by core CSS
|
|
1536
|
-
*/
|
|
1537
|
-
export declare const GridClasses: {
|
|
1538
|
-
readonly ROOT: "tbw-grid-root";
|
|
1539
|
-
readonly HEADER: "header";
|
|
1540
|
-
readonly HEADER_ROW: "header-row";
|
|
1541
|
-
readonly HEADER_CELL: "header-cell";
|
|
1542
|
-
readonly ROWS_VIEWPORT: "rows-viewport";
|
|
1543
|
-
readonly ROWS_SPACER: "rows-spacer";
|
|
1544
|
-
readonly ROWS_CONTAINER: "rows";
|
|
1545
|
-
readonly DATA_ROW: "data-row";
|
|
1546
|
-
readonly GROUP_ROW: "group-row";
|
|
1547
|
-
readonly DATA_CELL: "data-cell";
|
|
1548
|
-
readonly SELECTED: "selected";
|
|
1549
|
-
readonly FOCUSED: "focused";
|
|
1550
|
-
readonly EDITING: "editing";
|
|
1551
|
-
readonly EXPANDED: "expanded";
|
|
1552
|
-
readonly COLLAPSED: "collapsed";
|
|
1553
|
-
readonly DRAGGING: "dragging";
|
|
1554
|
-
readonly RESIZING: "resizing";
|
|
1555
|
-
readonly SORTABLE: "sortable";
|
|
1556
|
-
readonly SORTED_ASC: "sorted-asc";
|
|
1557
|
-
readonly SORTED_DESC: "sorted-desc";
|
|
1558
|
-
readonly HIDDEN: "hidden";
|
|
1559
|
-
readonly STICKY_LEFT: "sticky-left";
|
|
1560
|
-
readonly STICKY_RIGHT: "sticky-right";
|
|
1561
|
-
readonly PINNED_TOP: "pinned-top";
|
|
1562
|
-
readonly PINNED_BOTTOM: "pinned-bottom";
|
|
1563
|
-
readonly TREE_TOGGLE: "tree-toggle";
|
|
1564
|
-
readonly TREE_INDENT: "tree-indent";
|
|
1565
|
-
readonly GROUP_TOGGLE: "group-toggle";
|
|
1566
|
-
readonly GROUP_LABEL: "group-label";
|
|
1567
|
-
readonly GROUP_COUNT: "group-count";
|
|
1568
|
-
readonly RANGE_SELECTION: "range-selection";
|
|
1569
|
-
readonly SELECTION_OVERLAY: "selection-overlay";
|
|
1570
|
-
};
|
|
1571
|
-
|
|
1572
|
-
export declare type GridClassName = (typeof GridClasses)[keyof typeof GridClasses];
|
|
1573
|
-
|
|
1574
|
-
/**
|
|
1575
|
-
* Complete grid column state for persistence.
|
|
1576
|
-
* Contains state for all columns, including plugin-contributed properties.
|
|
1577
|
-
*/
|
|
1578
|
-
export declare interface GridColumnState {
|
|
1579
|
-
columns: ColumnState[];
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1582
|
-
/**
|
|
1583
|
-
* Grid configuration object - the **single source of truth** for grid behavior.
|
|
1584
|
-
*
|
|
1585
|
-
* Users can configure the grid via multiple input methods, all of which converge
|
|
1586
|
-
* into an effective `GridConfig` internally:
|
|
1587
|
-
*
|
|
1588
|
-
* **Configuration Input Methods:**
|
|
1589
|
-
* - `gridConfig` property - direct assignment of this object
|
|
1590
|
-
* - `columns` property - shorthand for `gridConfig.columns`
|
|
1591
|
-
* - `fitMode` property - shorthand for `gridConfig.fitMode`
|
|
1592
|
-
* - `editOn` property - shorthand for `gridConfig.editOn`
|
|
1593
|
-
* - Light DOM `<tbw-grid-column>` - declarative columns (merged into `columns`)
|
|
1594
|
-
* - Light DOM `<tbw-grid-header>` - declarative shell header (merged into `shell.header`)
|
|
1595
|
-
*
|
|
1596
|
-
* **Precedence (when same property set multiple ways):**
|
|
1597
|
-
* Individual props (`fitMode`, `editOn`) > `columns` prop > Light DOM > `gridConfig`
|
|
1598
|
-
*
|
|
1599
|
-
* @example
|
|
1600
|
-
* ```ts
|
|
1601
|
-
* // Via gridConfig (recommended for complex setups)
|
|
1602
|
-
* grid.gridConfig = {
|
|
1603
|
-
* columns: [{ field: 'name' }, { field: 'age' }],
|
|
1604
|
-
* fitMode: 'stretch',
|
|
1605
|
-
* plugins: [new SelectionPlugin()],
|
|
1606
|
-
* shell: { header: { title: 'My Grid' } }
|
|
1607
|
-
* };
|
|
1608
|
-
*
|
|
1609
|
-
* // Via individual props (convenience for simple cases)
|
|
1610
|
-
* grid.columns = [{ field: 'name' }, { field: 'age' }];
|
|
1611
|
-
* grid.fitMode = 'stretch';
|
|
1612
|
-
* ```
|
|
1613
|
-
*/
|
|
1614
|
-
export declare interface GridConfig<TRow = any> {
|
|
1615
|
-
/** Column definitions. Can also be set via `columns` prop or `<tbw-grid-column>` light DOM. */
|
|
1616
|
-
columns?: ColumnConfigMap<TRow>;
|
|
1617
|
-
/** Sizing mode for columns. Can also be set via `fitMode` prop. */
|
|
1618
|
-
fitMode?: FitMode;
|
|
1619
|
-
/** Edit activation mode ('click' | 'dblclick'). Can also be set via `editOn` prop. */
|
|
1620
|
-
editOn?: string;
|
|
1621
|
-
/**
|
|
1622
|
-
* Row height in pixels for virtualization calculations.
|
|
1623
|
-
* The virtualization system assumes uniform row heights for performance.
|
|
1624
|
-
*
|
|
1625
|
-
* If not specified, the grid measures the first rendered row's height,
|
|
1626
|
-
* which respects the CSS variable `--tbw-row-height` set by themes.
|
|
1627
|
-
*
|
|
1628
|
-
* Set this explicitly when:
|
|
1629
|
-
* - Row content may wrap to multiple lines (also set `--tbw-cell-white-space: normal`)
|
|
1630
|
-
* - Using custom row templates with variable content
|
|
1631
|
-
* - You want to override theme-defined row height
|
|
1632
|
-
*
|
|
1633
|
-
* @default Auto-measured from first row (respects --tbw-row-height CSS variable)
|
|
1634
|
-
*
|
|
1635
|
-
* @example
|
|
1636
|
-
* ```ts
|
|
1637
|
-
* // Fixed height for rows that may wrap to 2 lines
|
|
1638
|
-
* gridConfig = { rowHeight: 56 };
|
|
1639
|
-
* ```
|
|
1640
|
-
*/
|
|
1641
|
-
rowHeight?: number;
|
|
1642
|
-
/**
|
|
1643
|
-
* Array of plugin instances.
|
|
1644
|
-
* Each plugin is instantiated with its configuration and attached to this grid.
|
|
1645
|
-
*
|
|
1646
|
-
* @example
|
|
1647
|
-
* ```ts
|
|
1648
|
-
* plugins: [
|
|
1649
|
-
* new SelectionPlugin({ mode: 'range' }),
|
|
1650
|
-
* new MultiSortPlugin(),
|
|
1651
|
-
* new FilteringPlugin({ debounceMs: 150 }),
|
|
1652
|
-
* ]
|
|
1653
|
-
* ```
|
|
1654
|
-
*/
|
|
1655
|
-
plugins?: GridPlugin[];
|
|
1656
|
-
/**
|
|
1657
|
-
* Saved column state to restore on initialization.
|
|
1658
|
-
* Includes order, width, visibility, sort, and plugin-contributed state.
|
|
1659
|
-
*/
|
|
1660
|
-
columnState?: GridColumnState;
|
|
1661
|
-
/**
|
|
1662
|
-
* Shell configuration for header bar and tool panels.
|
|
1663
|
-
* When configured, adds an optional wrapper with title, toolbar, and collapsible side panels.
|
|
1664
|
-
*/
|
|
1665
|
-
shell?: ShellConfig;
|
|
1666
|
-
/**
|
|
1667
|
-
* Grid-wide icon configuration.
|
|
1668
|
-
* Provides consistent icons across all plugins (tree, grouping, sorting, etc.).
|
|
1669
|
-
* Plugins will use these by default but can override with their own config.
|
|
1670
|
-
*/
|
|
1671
|
-
icons?: GridIcons;
|
|
1672
|
-
/**
|
|
1673
|
-
* Grid-wide animation configuration.
|
|
1674
|
-
* Controls animations for expand/collapse, reordering, and other visual transitions.
|
|
1675
|
-
* Individual plugins can override these defaults in their own config.
|
|
1676
|
-
*/
|
|
1677
|
-
animation?: AnimationConfig;
|
|
1678
|
-
/**
|
|
1679
|
-
* Custom sort handler for full control over sorting behavior.
|
|
1680
|
-
*
|
|
1681
|
-
* When provided, this handler is called instead of the built-in sorting logic.
|
|
1682
|
-
* Enables custom sorting algorithms, server-side sorting, or plugin-specific sorting.
|
|
1683
|
-
*
|
|
1684
|
-
* The handler receives:
|
|
1685
|
-
* - `rows`: Current row array to sort
|
|
1686
|
-
* - `sortState`: Sort field and direction (1 = asc, -1 = desc)
|
|
1687
|
-
* - `columns`: Column configurations (for accessing sortComparator)
|
|
1688
|
-
*
|
|
1689
|
-
* Return the sorted array (sync) or a Promise that resolves to the sorted array (async).
|
|
1690
|
-
* For server-side sorting, return a Promise that resolves when data is fetched.
|
|
1691
|
-
*
|
|
1692
|
-
* @example
|
|
1693
|
-
* ```ts
|
|
1694
|
-
* // Custom stable sort
|
|
1695
|
-
* sortHandler: (rows, state, cols) => {
|
|
1696
|
-
* return stableSort(rows, (a, b) => compare(a[state.field], b[state.field]) * state.direction);
|
|
1697
|
-
* }
|
|
1698
|
-
*
|
|
1699
|
-
* // Server-side sorting
|
|
1700
|
-
* sortHandler: async (rows, state) => {
|
|
1701
|
-
* const response = await fetch(`/api/data?sort=${state.field}&dir=${state.direction}`);
|
|
1702
|
-
* return response.json();
|
|
1703
|
-
* }
|
|
1704
|
-
* ```
|
|
1705
|
-
*/
|
|
1706
|
-
sortHandler?: SortHandler<TRow>;
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
export declare type GridCSSVar = (typeof GridCSSVars)[keyof typeof GridCSSVars];
|
|
1710
|
-
|
|
1711
|
-
/**
|
|
1712
|
-
* CSS custom property names for theming.
|
|
1713
|
-
* Use these when programmatically setting styles.
|
|
1714
|
-
*/
|
|
1715
|
-
export declare const GridCSSVars: {
|
|
1716
|
-
readonly COLOR_BG: "--tbw-color-bg";
|
|
1717
|
-
readonly COLOR_FG: "--tbw-color-fg";
|
|
1718
|
-
readonly COLOR_FG_MUTED: "--tbw-color-fg-muted";
|
|
1719
|
-
readonly COLOR_BORDER: "--tbw-color-border";
|
|
1720
|
-
readonly COLOR_ACCENT: "--tbw-color-accent";
|
|
1721
|
-
readonly COLOR_HEADER_BG: "--tbw-color-header-bg";
|
|
1722
|
-
readonly COLOR_HEADER_FG: "--tbw-color-header-fg";
|
|
1723
|
-
readonly COLOR_SELECTION: "--tbw-color-selection";
|
|
1724
|
-
readonly COLOR_ROW_HOVER: "--tbw-color-row-hover";
|
|
1725
|
-
readonly COLOR_ROW_ALT: "--tbw-color-row-alt";
|
|
1726
|
-
readonly ROW_HEIGHT: "--tbw-row-height";
|
|
1727
|
-
readonly HEADER_HEIGHT: "--tbw-header-height";
|
|
1728
|
-
readonly CELL_PADDING: "--tbw-cell-padding";
|
|
1729
|
-
readonly FONT_FAMILY: "--tbw-font-family";
|
|
1730
|
-
readonly FONT_SIZE: "--tbw-font-size";
|
|
1731
|
-
readonly BORDER_RADIUS: "--tbw-border-radius";
|
|
1732
|
-
readonly FOCUS_OUTLINE: "--tbw-focus-outline";
|
|
1733
|
-
};
|
|
1734
|
-
|
|
1735
|
-
export declare type GridDataAttr = (typeof GridDataAttrs)[keyof typeof GridDataAttrs];
|
|
1736
|
-
|
|
1737
|
-
/**
|
|
1738
|
-
* Data attribute names used on grid elements.
|
|
1739
|
-
* Use these when getting/setting data attributes.
|
|
1740
|
-
*/
|
|
1741
|
-
export declare const GridDataAttrs: {
|
|
1742
|
-
readonly ROW_INDEX: "data-row-index";
|
|
1743
|
-
readonly COL_INDEX: "data-col-index";
|
|
1744
|
-
readonly FIELD: "data-field";
|
|
1745
|
-
readonly GROUP_KEY: "data-group-key";
|
|
1746
|
-
readonly TREE_LEVEL: "data-tree-level";
|
|
1747
|
-
readonly STICKY: "data-sticky";
|
|
1748
|
-
};
|
|
1749
|
-
|
|
1750
|
-
export declare interface GridElement {
|
|
1751
|
-
shadowRoot: ShadowRoot | null;
|
|
1752
|
-
rows: any[];
|
|
1753
|
-
columns: ColumnConfig[];
|
|
1754
|
-
gridConfig: any;
|
|
1755
|
-
/* Excluded from this release type: _focusRow */
|
|
1756
|
-
/* Excluded from this release type: _focusCol */
|
|
1757
|
-
/** AbortSignal that is aborted when the grid disconnects from the DOM */
|
|
1758
|
-
disconnectSignal: AbortSignal;
|
|
1759
|
-
requestRender(): void;
|
|
1760
|
-
requestAfterRender(): void;
|
|
1761
|
-
forceLayout(): Promise<void>;
|
|
1762
|
-
getPlugin<T extends BaseGridPlugin>(PluginClass: new (...args: any[]) => T): T | undefined;
|
|
1763
|
-
getPluginByName(name: string): BaseGridPlugin | undefined;
|
|
1764
|
-
dispatchEvent(event: Event): boolean;
|
|
1765
|
-
}
|
|
1766
|
-
|
|
1767
|
-
/**
|
|
1768
|
-
* Grid-wide icon configuration.
|
|
1769
|
-
* All icons are optional - sensible defaults are used when not specified.
|
|
1770
|
-
*/
|
|
1771
|
-
export declare interface GridIcons {
|
|
1772
|
-
/** Expand icon for collapsed items (trees, groups, details). Default: '▶' */
|
|
1773
|
-
expand?: IconValue;
|
|
1774
|
-
/** Collapse icon for expanded items (trees, groups, details). Default: '▼' */
|
|
1775
|
-
collapse?: IconValue;
|
|
1776
|
-
/** Sort ascending indicator. Default: '▲' */
|
|
1777
|
-
sortAsc?: IconValue;
|
|
1778
|
-
/** Sort descending indicator. Default: '▼' */
|
|
1779
|
-
sortDesc?: IconValue;
|
|
1780
|
-
/** Sort neutral/unsorted indicator. Default: '⇅' */
|
|
1781
|
-
sortNone?: IconValue;
|
|
1782
|
-
/** Submenu arrow for context menus. Default: '▶' */
|
|
1783
|
-
submenuArrow?: IconValue;
|
|
1784
|
-
/** Drag handle icon for reordering. Default: '⋮⋮' */
|
|
1785
|
-
dragHandle?: IconValue;
|
|
1786
|
-
/** Tool panel toggle icon in toolbar. Default: '☰' */
|
|
1787
|
-
toolPanel?: IconValue;
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
/**
|
|
1791
|
-
* Minimal plugin interface for type-checking.
|
|
1792
|
-
* This interface is defined here to avoid circular imports with BaseGridPlugin.
|
|
1793
|
-
* All plugins must satisfy this shape (BaseGridPlugin implements it).
|
|
1794
|
-
*/
|
|
1795
|
-
export declare interface GridPlugin {
|
|
1796
|
-
/** Unique plugin identifier */
|
|
1797
|
-
readonly name: string;
|
|
1798
|
-
/** Plugin version */
|
|
1799
|
-
readonly version: string;
|
|
1800
|
-
/** CSS styles to inject into grid's shadow DOM */
|
|
1801
|
-
readonly styles?: string;
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
/**
|
|
1805
|
-
* Common CSS selectors for querying grid elements.
|
|
1806
|
-
* Built from the class constants for consistency.
|
|
1807
|
-
*/
|
|
1808
|
-
export declare const GridSelectors: {
|
|
1809
|
-
readonly ROOT: ".tbw-grid-root";
|
|
1810
|
-
readonly HEADER: ".header";
|
|
1811
|
-
readonly HEADER_ROW: ".header-row";
|
|
1812
|
-
readonly HEADER_CELL: ".header-cell";
|
|
1813
|
-
readonly ROWS_VIEWPORT: ".rows-viewport";
|
|
1814
|
-
readonly ROWS_CONTAINER: ".rows";
|
|
1815
|
-
readonly DATA_ROW: ".data-row";
|
|
1816
|
-
readonly DATA_CELL: ".data-cell";
|
|
1817
|
-
readonly GROUP_ROW: ".group-row";
|
|
1818
|
-
readonly ROW_BY_INDEX: (index: number) => string;
|
|
1819
|
-
readonly CELL_BY_FIELD: (field: string) => string;
|
|
1820
|
-
readonly CELL_AT: (row: number, col: number) => string;
|
|
1821
|
-
readonly SELECTED_ROWS: ".data-row.selected";
|
|
1822
|
-
readonly EDITING_CELL: ".data-cell.editing";
|
|
1823
|
-
};
|
|
1824
|
-
|
|
1825
|
-
/** Configuration options for the row grouping plugin */
|
|
1826
|
-
export declare interface GroupingRowsConfig {
|
|
1827
|
-
/**
|
|
1828
|
-
* Callback to determine group path for a row.
|
|
1829
|
-
* Return an array of group keys, a single key, null/false to skip grouping.
|
|
1830
|
-
*/
|
|
1831
|
-
groupOn?: (row: any) => any[] | any | null | false;
|
|
1832
|
-
/** Whether groups are expanded by default (default: false) */
|
|
1833
|
-
defaultExpanded?: boolean;
|
|
1834
|
-
/** Custom group row renderer - takes full control of group row rendering */
|
|
1835
|
-
groupRowRenderer?: (params: GroupRowRenderParams) => HTMLElement | string | void;
|
|
1836
|
-
/** Show row count in group headers (default: true) */
|
|
1837
|
-
showRowCount?: boolean;
|
|
1838
|
-
/** Indent width per depth level in pixels (default: 20) */
|
|
1839
|
-
indentWidth?: number;
|
|
1840
|
-
/** Aggregators for group row cells by field name */
|
|
1841
|
-
aggregators?: AggregatorMap;
|
|
1842
|
-
/** Custom format function for group label */
|
|
1843
|
-
formatLabel?: (value: any, depth: number, key: string) => string;
|
|
1844
|
-
/** Whether to render group row as full-width spanning cell (default: true) */
|
|
1845
|
-
fullWidth?: boolean;
|
|
1846
|
-
/**
|
|
1847
|
-
* Animation style for expanding/collapsing groups.
|
|
1848
|
-
* - `false`: No animation
|
|
1849
|
-
* - `'slide'`: Slide animation (default)
|
|
1850
|
-
* - `'fade'`: Fade animation
|
|
1851
|
-
* @default 'slide'
|
|
1852
|
-
*/
|
|
1853
|
-
animation?: ExpandCollapseAnimation_3;
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
|
-
/** Parameters passed to custom group row renderer */
|
|
1857
|
-
declare interface GroupRowRenderParams {
|
|
1858
|
-
/** The group key */
|
|
1859
|
-
key: string;
|
|
1860
|
-
/** The group value (last segment of path) */
|
|
1861
|
-
value: any;
|
|
1862
|
-
/** Depth level (0-based) */
|
|
1863
|
-
depth: number;
|
|
1864
|
-
/** All data rows in this group (including nested) */
|
|
1865
|
-
rows: any[];
|
|
1866
|
-
/** Whether the group is expanded */
|
|
1867
|
-
expanded: boolean;
|
|
1868
|
-
/** Toggle expand/collapse */
|
|
1869
|
-
toggleExpand: () => void;
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
/**
|
|
1873
|
-
* Header click event
|
|
1874
|
-
*/
|
|
1875
|
-
export declare interface HeaderClickEvent {
|
|
1876
|
-
colIndex: number;
|
|
1877
|
-
field: string;
|
|
1878
|
-
column: ColumnConfig;
|
|
1879
|
-
headerEl: HTMLElement;
|
|
1880
|
-
originalEvent: MouseEvent;
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
/**
|
|
1884
|
-
* Header content definition for plugins contributing to shell header center section.
|
|
1885
|
-
*/
|
|
1886
|
-
export declare interface HeaderContentDefinition {
|
|
1887
|
-
/** Unique content ID */
|
|
1888
|
-
id: string;
|
|
1889
|
-
/** Content factory - called once when shell header renders */
|
|
1890
|
-
render: (container: HTMLElement) => void | (() => void);
|
|
1891
|
-
/** Called when content is removed (for cleanup) */
|
|
1892
|
-
onDestroy?: () => void;
|
|
1893
|
-
/** Order priority (lower = first, default: 100) */
|
|
1894
|
-
order?: number;
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
/**
|
|
1898
|
-
* Header renderer function type for plugins.
|
|
1899
|
-
*/
|
|
1900
|
-
export declare type HeaderRenderer = (ctx: PluginHeaderRenderContext) => string | HTMLElement;
|
|
1901
|
-
|
|
1902
|
-
/** Icon value - can be a string (text/HTML) or HTMLElement */
|
|
1903
|
-
export declare type IconValue = string | HTMLElement;
|
|
1904
|
-
|
|
1905
|
-
/** Result of automatic column inference from sample rows. */
|
|
1906
|
-
export declare interface InferredColumnResult<TRow = unknown> {
|
|
1907
|
-
columns: ColumnConfigMap<TRow>;
|
|
1908
|
-
typeMap: Record<string, PrimitiveColumnType>;
|
|
1909
|
-
}
|
|
1910
|
-
|
|
1911
|
-
/**
|
|
1912
|
-
* Internal-only augmented interface for DataGrid component
|
|
1913
|
-
*/
|
|
1914
|
-
declare interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
|
|
1915
|
-
shadowRoot: ShadowRoot | null;
|
|
1916
|
-
_rows: T[];
|
|
1917
|
-
_columns: ColumnInternal<T>[];
|
|
1918
|
-
/** Visible columns only (excludes hidden). Use for rendering. */
|
|
1919
|
-
_visibleColumns: ColumnInternal<T>[];
|
|
1920
|
-
_headerRowEl: HTMLElement;
|
|
1921
|
-
_bodyEl: HTMLElement;
|
|
1922
|
-
_rowPool: HTMLElement[];
|
|
1923
|
-
_resizeController: ResizeController;
|
|
1924
|
-
_sortState: {
|
|
1925
|
-
field: string;
|
|
1926
|
-
direction: 1 | -1;
|
|
1927
|
-
} | null;
|
|
1928
|
-
__originalOrder: T[];
|
|
1929
|
-
__rowRenderEpoch: number;
|
|
1930
|
-
__didInitialAutoSize?: boolean;
|
|
1931
|
-
__lightDomColumnsCache?: ColumnInternal[];
|
|
1932
|
-
__originalColumnNodes?: HTMLElement[];
|
|
1933
|
-
_gridTemplate: string;
|
|
1934
|
-
_virtualization: VirtualState;
|
|
1935
|
-
_focusRow: number;
|
|
1936
|
-
_focusCol: number;
|
|
1937
|
-
_activeEditRows: number;
|
|
1938
|
-
_rowEditSnapshots: Map<number, T>;
|
|
1939
|
-
_changedRowIndices: Set<number>;
|
|
1940
|
-
changedRows?: T[];
|
|
1941
|
-
changedRowIndices?: number[];
|
|
1942
|
-
effectiveConfig?: GridConfig<T>;
|
|
1943
|
-
findHeaderRow?: () => HTMLElement;
|
|
1944
|
-
refreshVirtualWindow: (full: boolean) => void;
|
|
1945
|
-
updateTemplate?: () => void;
|
|
1946
|
-
findRenderedRowElement?: (rowIndex: number) => HTMLElement | null;
|
|
1947
|
-
beginBulkEdit?: (rowIndex: number) => void;
|
|
1948
|
-
commitActiveRowEdit?: () => void;
|
|
1949
|
-
/** Dispatch cell click to plugin system, returns true if handled */
|
|
1950
|
-
_dispatchCellClick?: (event: MouseEvent, rowIndex: number, colIndex: number, cellEl: HTMLElement) => boolean;
|
|
1951
|
-
/** Dispatch row click to plugin system, returns true if handled */
|
|
1952
|
-
_dispatchRowClick?: (event: MouseEvent, rowIndex: number, row: any, rowEl: HTMLElement) => boolean;
|
|
1953
|
-
/** Dispatch header click to plugin system, returns true if handled */
|
|
1954
|
-
_dispatchHeaderClick?: (event: MouseEvent, colIndex: number, headerEl: HTMLElement) => boolean;
|
|
1955
|
-
/** Dispatch keydown to plugin system, returns true if handled */
|
|
1956
|
-
_dispatchKeyDown?: (event: KeyboardEvent) => boolean;
|
|
1957
|
-
/** Get horizontal scroll boundary offsets from plugins (e.g., pinned columns) */
|
|
1958
|
-
_getHorizontalScrollOffsets?: (rowEl?: HTMLElement, focusedCell?: HTMLElement) => {
|
|
1959
|
-
left: number;
|
|
1960
|
-
right: number;
|
|
1961
|
-
skipScroll?: boolean;
|
|
1962
|
-
};
|
|
1963
|
-
/** Query all plugins with a generic query and collect responses */
|
|
1964
|
-
queryPlugins?: <T>(query: PluginQuery) => T[];
|
|
1965
|
-
/** Request emission of column-state-change event (debounced) */
|
|
1966
|
-
requestStateChange?: () => void;
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
/**
|
|
1970
|
-
* Keyboard modifier flags
|
|
1971
|
-
*/
|
|
1972
|
-
export declare interface KeyboardModifiers {
|
|
1973
|
-
ctrl?: boolean;
|
|
1974
|
-
shift?: boolean;
|
|
1975
|
-
alt?: boolean;
|
|
1976
|
-
meta?: boolean;
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
export declare const listAggregators: () => string[];
|
|
1980
|
-
|
|
1981
|
-
/** Configuration options for the multi-sort plugin */
|
|
1982
|
-
export declare interface MultiSortConfig {
|
|
1983
|
-
/** Maximum number of columns to sort by (default: 3) */
|
|
1984
|
-
maxSortColumns?: number;
|
|
1985
|
-
/** Whether to show sort order badges (1, 2, 3) on headers (default: true) */
|
|
1986
|
-
showSortIndex?: boolean;
|
|
1987
|
-
}
|
|
1988
|
-
|
|
1989
|
-
/** Context provided to panel renderers */
|
|
1990
|
-
export declare interface PinnedRowsContext {
|
|
1991
|
-
/** Total number of rows in the grid */
|
|
1992
|
-
totalRows: number;
|
|
1993
|
-
/** Number of rows after filtering */
|
|
1994
|
-
filteredRows: number;
|
|
1995
|
-
/** Number of selected rows */
|
|
1996
|
-
selectedRows: number;
|
|
1997
|
-
/** Current column configuration */
|
|
1998
|
-
columns: ColumnConfig[];
|
|
1999
|
-
/** Current row data */
|
|
2000
|
-
rows: unknown[];
|
|
2001
|
-
/** Reference to the grid element */
|
|
2002
|
-
grid: HTMLElement;
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
/** Custom panel definition for the status bar */
|
|
2006
|
-
export declare interface PinnedRowsPanel {
|
|
2007
|
-
/** Unique identifier for the panel */
|
|
2008
|
-
id: string;
|
|
2009
|
-
/** Position within the status bar */
|
|
2010
|
-
position: 'left' | 'center' | 'right';
|
|
2011
|
-
/** Render function for the panel content */
|
|
2012
|
-
render: (context: PinnedRowsContext) => HTMLElement | string;
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
export declare interface PivotConfig {
|
|
2016
|
-
/** Whether pivot view is active on load (default: true when fields are configured) */
|
|
2017
|
-
active?: boolean;
|
|
2018
|
-
rowGroupFields?: string[];
|
|
2019
|
-
columnGroupFields?: string[];
|
|
2020
|
-
valueFields?: PivotValueField[];
|
|
2021
|
-
showTotals?: boolean;
|
|
2022
|
-
showGrandTotal?: boolean;
|
|
2023
|
-
/** Whether groups are expanded by default (default: true) */
|
|
2024
|
-
defaultExpanded?: boolean;
|
|
2025
|
-
/** Indent width per depth level in pixels (default: 20) */
|
|
2026
|
-
indentWidth?: number;
|
|
2027
|
-
/** Whether to show the pivot configuration tool panel (default: true) */
|
|
2028
|
-
showToolPanel?: boolean;
|
|
2029
|
-
/**
|
|
2030
|
-
* Animation style for expanding/collapsing groups.
|
|
2031
|
-
* - `false`: No animation
|
|
2032
|
-
* - `'slide'`: Slide animation (default)
|
|
2033
|
-
* - `'fade'`: Fade animation
|
|
2034
|
-
* @default 'slide'
|
|
2035
|
-
*/
|
|
2036
|
-
animation?: ExpandCollapseAnimation_2;
|
|
2037
|
-
}
|
|
2038
|
-
|
|
2039
|
-
export declare interface PivotResult {
|
|
2040
|
-
rows: PivotRow[];
|
|
2041
|
-
columnKeys: string[];
|
|
2042
|
-
totals: Record<string, number>;
|
|
2043
|
-
grandTotal: number;
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
declare interface PivotRow {
|
|
2047
|
-
/** Unique key for this row (hierarchical path) */
|
|
2048
|
-
rowKey: string;
|
|
2049
|
-
/** Display label for this row */
|
|
2050
|
-
rowLabel: string;
|
|
2051
|
-
/** Depth level (0 = top level) */
|
|
2052
|
-
depth: number;
|
|
2053
|
-
/** Aggregated values by column key */
|
|
2054
|
-
values: Record<string, number | null>;
|
|
2055
|
-
/** Row total across all columns */
|
|
2056
|
-
total?: number;
|
|
2057
|
-
/** Whether this row has children (is a group header) */
|
|
2058
|
-
isGroup: boolean;
|
|
2059
|
-
/** Child rows (for hierarchical grouping) */
|
|
2060
|
-
children?: PivotRow[];
|
|
2061
|
-
/** Number of data rows in this group */
|
|
2062
|
-
rowCount?: number;
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
export declare interface PivotValueField {
|
|
2066
|
-
field: string;
|
|
2067
|
-
aggFunc: AggFunc;
|
|
2068
|
-
header?: string;
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
/**
|
|
2072
|
-
* Well-known plugin query types.
|
|
2073
|
-
* Plugins can define additional query types beyond these.
|
|
2074
|
-
*/
|
|
2075
|
-
export declare const PLUGIN_QUERIES: {
|
|
2076
|
-
/** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
|
|
2077
|
-
readonly CAN_MOVE_COLUMN: "canMoveColumn";
|
|
2078
|
-
/** Get context menu items. Context: ContextMenuParams. Response: ContextMenuItem[] */
|
|
2079
|
-
readonly GET_CONTEXT_MENU_ITEMS: "getContextMenuItems";
|
|
2080
|
-
};
|
|
2081
|
-
|
|
2082
|
-
/**
|
|
2083
|
-
* Cell render context for plugin cell renderers.
|
|
2084
|
-
* Provides full context including position and editing state.
|
|
2085
|
-
*
|
|
2086
|
-
* Note: This differs from the core `CellRenderContext` in types.ts which is
|
|
2087
|
-
* simpler and used for column view renderers. This version provides additional
|
|
2088
|
-
* context needed by plugins that register custom cell renderers.
|
|
2089
|
-
*/
|
|
2090
|
-
export declare interface PluginCellRenderContext {
|
|
2091
|
-
/** The cell value */
|
|
2092
|
-
value: any;
|
|
2093
|
-
/** The field/column key */
|
|
2094
|
-
field: string;
|
|
2095
|
-
/** The row data object */
|
|
2096
|
-
row: any;
|
|
2097
|
-
/** Row index in the data array */
|
|
2098
|
-
rowIndex: number;
|
|
2099
|
-
/** Column index */
|
|
2100
|
-
colIndex: number;
|
|
2101
|
-
/** Column configuration */
|
|
2102
|
-
column: ColumnConfig;
|
|
2103
|
-
/** Whether the cell is currently in edit mode */
|
|
2104
|
-
isEditing: boolean;
|
|
2105
|
-
}
|
|
2106
|
-
|
|
2107
|
-
export declare type PluginEventName = (typeof PluginEvents)[keyof typeof PluginEvents];
|
|
2108
|
-
|
|
2109
|
-
export declare const PluginEvents: {
|
|
2110
|
-
readonly SELECTION_CHANGE: "selection-change";
|
|
2111
|
-
readonly TREE_EXPAND: "tree-expand";
|
|
2112
|
-
readonly FILTER_CHANGE: "filter-change";
|
|
2113
|
-
readonly SORT_MODEL_CHANGE: "sort-model-change";
|
|
2114
|
-
readonly EXPORT_START: "export-start";
|
|
2115
|
-
readonly EXPORT_COMPLETE: "export-complete";
|
|
2116
|
-
readonly CLIPBOARD_COPY: "clipboard-copy";
|
|
2117
|
-
readonly CLIPBOARD_PASTE: "clipboard-paste";
|
|
2118
|
-
readonly CONTEXT_MENU_OPEN: "context-menu-open";
|
|
2119
|
-
readonly CONTEXT_MENU_CLOSE: "context-menu-close";
|
|
2120
|
-
readonly HISTORY_CHANGE: "history-change";
|
|
2121
|
-
readonly SERVER_LOADING: "server-loading";
|
|
2122
|
-
readonly SERVER_ERROR: "server-error";
|
|
2123
|
-
readonly COLUMN_VISIBILITY_CHANGE: "column-visibility-change";
|
|
2124
|
-
readonly COLUMN_REORDER: "column-reorder";
|
|
2125
|
-
readonly DETAIL_EXPAND: "detail-expand";
|
|
2126
|
-
readonly GROUP_EXPAND: "group-expand";
|
|
2127
|
-
};
|
|
2128
|
-
|
|
2129
|
-
/**
|
|
2130
|
-
* Header render context for plugin header renderers.
|
|
2131
|
-
*/
|
|
2132
|
-
export declare interface PluginHeaderRenderContext {
|
|
2133
|
-
/** Column configuration */
|
|
2134
|
-
column: ColumnConfig;
|
|
2135
|
-
/** Column index */
|
|
2136
|
-
colIndex: number;
|
|
2137
|
-
}
|
|
2138
|
-
|
|
2139
|
-
/**
|
|
2140
|
-
* Manages plugins for a single grid instance.
|
|
2141
|
-
*/
|
|
2142
|
-
export declare class PluginManager {
|
|
2143
|
-
private grid;
|
|
2144
|
-
/** Plugin instances in order of attachment */
|
|
2145
|
-
private plugins;
|
|
2146
|
-
/** Map from plugin class to instance for fast lookup */
|
|
2147
|
-
private pluginMap;
|
|
2148
|
-
/** Cell renderers registered by plugins */
|
|
2149
|
-
private cellRenderers;
|
|
2150
|
-
/** Header renderers registered by plugins */
|
|
2151
|
-
private headerRenderers;
|
|
2152
|
-
/** Cell editors registered by plugins */
|
|
2153
|
-
private cellEditors;
|
|
2154
|
-
constructor(grid: any);
|
|
2155
|
-
/**
|
|
2156
|
-
* Attach all plugins from the config.
|
|
2157
|
-
*/
|
|
2158
|
-
attachAll(plugins: BaseGridPlugin[]): void;
|
|
2159
|
-
/**
|
|
2160
|
-
* Attach a plugin to this grid.
|
|
2161
|
-
*/
|
|
2162
|
-
attach(plugin: BaseGridPlugin): void;
|
|
2163
|
-
/**
|
|
2164
|
-
* Detach all plugins and clean up.
|
|
2165
|
-
*/
|
|
2166
|
-
detachAll(): void;
|
|
2167
|
-
/**
|
|
2168
|
-
* Get a plugin instance by its class.
|
|
2169
|
-
*/
|
|
2170
|
-
getPlugin<T extends BaseGridPlugin>(PluginClass: new (...args: any[]) => T): T | undefined;
|
|
2171
|
-
/**
|
|
2172
|
-
* Get a plugin instance by its name.
|
|
2173
|
-
*/
|
|
2174
|
-
getPluginByName(name: string): BaseGridPlugin | undefined;
|
|
2175
|
-
/**
|
|
2176
|
-
* Check if a plugin is attached.
|
|
2177
|
-
*/
|
|
2178
|
-
hasPlugin<T extends BaseGridPlugin>(PluginClass: new (...args: any[]) => T): boolean;
|
|
2179
|
-
/**
|
|
2180
|
-
* Get all attached plugins.
|
|
2181
|
-
*/
|
|
2182
|
-
getAll(): readonly BaseGridPlugin[];
|
|
2183
|
-
/**
|
|
2184
|
-
* Get a cell renderer by type name.
|
|
2185
|
-
*/
|
|
2186
|
-
getCellRenderer(type: string): CellRenderer | undefined;
|
|
2187
|
-
/**
|
|
2188
|
-
* Get a header renderer by type name.
|
|
2189
|
-
*/
|
|
2190
|
-
getHeaderRenderer(type: string): HeaderRenderer | undefined;
|
|
2191
|
-
/**
|
|
2192
|
-
* Get a cell editor by type name.
|
|
2193
|
-
*/
|
|
2194
|
-
getCellEditor(type: string): CellEditor | undefined;
|
|
2195
|
-
/**
|
|
2196
|
-
* Get all CSS styles from all plugins.
|
|
2197
|
-
*/
|
|
2198
|
-
getAllStyles(): string;
|
|
2199
|
-
/**
|
|
2200
|
-
* Execute processRows hook on all plugins.
|
|
2201
|
-
*/
|
|
2202
|
-
processRows(rows: readonly any[]): any[];
|
|
2203
|
-
/**
|
|
2204
|
-
* Execute processColumns hook on all plugins.
|
|
2205
|
-
*/
|
|
2206
|
-
processColumns(columns: readonly ColumnConfig[]): ColumnConfig[];
|
|
2207
|
-
/**
|
|
2208
|
-
* Execute beforeRender hook on all plugins.
|
|
2209
|
-
*/
|
|
2210
|
-
beforeRender(): void;
|
|
2211
|
-
/**
|
|
2212
|
-
* Execute afterRender hook on all plugins.
|
|
2213
|
-
*/
|
|
2214
|
-
afterRender(): void;
|
|
2215
|
-
/**
|
|
2216
|
-
* Execute onScrollRender hook on all plugins.
|
|
2217
|
-
* Called after scroll-triggered row rendering for lightweight visual state updates.
|
|
2218
|
-
*/
|
|
2219
|
-
onScrollRender(): void;
|
|
2220
|
-
/**
|
|
2221
|
-
* Get total extra height contributed by plugins (e.g., expanded detail rows).
|
|
2222
|
-
* Used to adjust scrollbar height calculations.
|
|
2223
|
-
*/
|
|
2224
|
-
getExtraHeight(): number;
|
|
2225
|
-
/**
|
|
2226
|
-
* Get extra height from plugins that appears before a given row index.
|
|
2227
|
-
* Used by virtualization to correctly position the scroll window.
|
|
2228
|
-
*/
|
|
2229
|
-
getExtraHeightBefore(beforeRowIndex: number): number;
|
|
2230
|
-
/**
|
|
2231
|
-
* Adjust the virtualization start index based on plugin needs.
|
|
2232
|
-
* Returns the minimum start index from all plugins.
|
|
2233
|
-
*/
|
|
2234
|
-
adjustVirtualStart(start: number, scrollTop: number, rowHeight: number): number;
|
|
2235
|
-
/**
|
|
2236
|
-
* Execute renderRow hook on all plugins.
|
|
2237
|
-
* Returns true if any plugin handled the row.
|
|
2238
|
-
*/
|
|
2239
|
-
renderRow(row: any, rowEl: HTMLElement, rowIndex: number): boolean;
|
|
2240
|
-
/**
|
|
2241
|
-
* Query all plugins with a generic query and collect responses.
|
|
2242
|
-
* This enables inter-plugin communication without the core knowing plugin-specific concepts.
|
|
2243
|
-
*
|
|
2244
|
-
* Common query types are defined in PLUGIN_QUERIES, but plugins can define their own.
|
|
2245
|
-
*
|
|
2246
|
-
* @param query - The query object containing type and context
|
|
2247
|
-
* @returns Array of non-undefined responses from plugins
|
|
2248
|
-
*/
|
|
2249
|
-
queryPlugins<T>(query: PluginQuery): T[];
|
|
2250
|
-
/**
|
|
2251
|
-
* Execute onKeyDown hook on all plugins.
|
|
2252
|
-
* Returns true if any plugin handled the event.
|
|
2253
|
-
*/
|
|
2254
|
-
onKeyDown(event: KeyboardEvent): boolean;
|
|
2255
|
-
/**
|
|
2256
|
-
* Execute onCellClick hook on all plugins.
|
|
2257
|
-
* Returns true if any plugin handled the event.
|
|
2258
|
-
*/
|
|
2259
|
-
onCellClick(event: CellClickEvent): boolean;
|
|
2260
|
-
/**
|
|
2261
|
-
* Execute onRowClick hook on all plugins.
|
|
2262
|
-
* Returns true if any plugin handled the event.
|
|
2263
|
-
*/
|
|
2264
|
-
onRowClick(event: RowClickEvent): boolean;
|
|
2265
|
-
/**
|
|
2266
|
-
* Execute onHeaderClick hook on all plugins.
|
|
2267
|
-
* Returns true if any plugin handled the event.
|
|
2268
|
-
*/
|
|
2269
|
-
onHeaderClick(event: HeaderClickEvent): boolean;
|
|
2270
|
-
/**
|
|
2271
|
-
* Execute onScroll hook on all plugins.
|
|
2272
|
-
*/
|
|
2273
|
-
onScroll(event: ScrollEvent): void;
|
|
2274
|
-
/**
|
|
2275
|
-
* Execute onCellMouseDown hook on all plugins.
|
|
2276
|
-
* Returns true if any plugin handled the event.
|
|
2277
|
-
*/
|
|
2278
|
-
onCellMouseDown(event: CellMouseEvent): boolean;
|
|
2279
|
-
/**
|
|
2280
|
-
* Execute onCellMouseMove hook on all plugins.
|
|
2281
|
-
* Returns true if any plugin handled the event.
|
|
2282
|
-
*/
|
|
2283
|
-
onCellMouseMove(event: CellMouseEvent): boolean;
|
|
2284
|
-
/**
|
|
2285
|
-
* Execute onCellMouseUp hook on all plugins.
|
|
2286
|
-
* Returns true if any plugin handled the event.
|
|
2287
|
-
*/
|
|
2288
|
-
onCellMouseUp(event: CellMouseEvent): boolean;
|
|
2289
|
-
/**
|
|
2290
|
-
* Collect horizontal scroll boundary offsets from all plugins.
|
|
2291
|
-
* Combines offsets from all plugins that report them.
|
|
2292
|
-
*
|
|
2293
|
-
* @param rowEl - The row element (optional, for calculating widths from rendered cells)
|
|
2294
|
-
* @param focusedCell - The currently focused cell element (optional, to determine if scrolling should be skipped)
|
|
2295
|
-
* @returns Combined left and right pixel offsets, plus skipScroll if any plugin requests it
|
|
2296
|
-
*/
|
|
2297
|
-
getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
|
|
2298
|
-
left: number;
|
|
2299
|
-
right: number;
|
|
2300
|
-
skipScroll?: boolean;
|
|
2301
|
-
};
|
|
2302
|
-
/**
|
|
2303
|
-
* Collect tool panels from all plugins.
|
|
2304
|
-
* Returns panels sorted by order (ascending).
|
|
2305
|
-
*/
|
|
2306
|
-
getToolPanels(): {
|
|
2307
|
-
plugin: BaseGridPlugin;
|
|
2308
|
-
panel: NonNullable<ReturnType<NonNullable<BaseGridPlugin['getToolPanel']>>>;
|
|
2309
|
-
}[];
|
|
2310
|
-
/**
|
|
2311
|
-
* Collect header contents from all plugins.
|
|
2312
|
-
* Returns contents sorted by order (ascending).
|
|
2313
|
-
*/
|
|
2314
|
-
getHeaderContents(): {
|
|
2315
|
-
plugin: BaseGridPlugin;
|
|
2316
|
-
content: NonNullable<ReturnType<NonNullable<BaseGridPlugin['getHeaderContent']>>>;
|
|
2317
|
-
}[];
|
|
2318
|
-
}
|
|
2319
|
-
|
|
2320
|
-
/**
|
|
2321
|
-
* Generic plugin query for inter-plugin communication.
|
|
2322
|
-
* Plugins can define their own query types as string constants
|
|
2323
|
-
* and respond to queries from other plugins.
|
|
2324
|
-
*/
|
|
2325
|
-
export declare interface PluginQuery<T = unknown> {
|
|
2326
|
-
/** Query type identifier (e.g., 'canMoveColumn', 'getContextMenuItems') */
|
|
2327
|
-
type: string;
|
|
2328
|
-
/** Query-specific context/parameters */
|
|
2329
|
-
context: T;
|
|
2330
|
-
}
|
|
2331
|
-
|
|
2332
|
-
export declare type PrimitiveColumnType = 'number' | 'string' | 'date' | 'boolean' | 'select' | 'typeahead';
|
|
2333
|
-
|
|
2334
|
-
/**
|
|
2335
|
-
* Public API interface for DataGrid component.
|
|
2336
|
-
*
|
|
2337
|
-
* **Property Getters vs Setters:**
|
|
2338
|
-
*
|
|
2339
|
-
* Property getters return the EFFECTIVE (resolved) value after merging all config sources.
|
|
2340
|
-
* This is the "current situation" - what consumers and plugins need to know.
|
|
2341
|
-
*
|
|
2342
|
-
* Property setters accept input values which are merged into the effective config.
|
|
2343
|
-
* Multiple sources can contribute (gridConfig, columns prop, light DOM, individual props).
|
|
2344
|
-
*
|
|
2345
|
-
* For example:
|
|
2346
|
-
* - `grid.fitMode` returns the resolved fitMode (e.g., 'stretch' even if you set undefined)
|
|
2347
|
-
* - `grid.columns` returns the effective columns after merging
|
|
2348
|
-
* - `grid.gridConfig` returns the full effective config
|
|
2349
|
-
*/
|
|
2350
|
-
export declare interface PublicGrid<T = any> {
|
|
2351
|
-
/**
|
|
2352
|
-
* Full config object. Setter merges with other inputs per precedence rules.
|
|
2353
|
-
* Getter returns the effective (resolved) config.
|
|
2354
|
-
*/
|
|
2355
|
-
gridConfig?: GridConfig<T>;
|
|
2356
|
-
/**
|
|
2357
|
-
* Column definitions.
|
|
2358
|
-
* Getter returns effective columns (after merging config, light DOM, inference).
|
|
2359
|
-
*/
|
|
2360
|
-
columns?: ColumnConfig<T>[];
|
|
2361
|
-
/** Current row data (after plugin processing like grouping, filtering). */
|
|
2362
|
-
rows?: T[];
|
|
2363
|
-
/** Resolves once the component has finished initial work (layout, inference). */
|
|
2364
|
-
ready?: () => Promise<void>;
|
|
2365
|
-
/** Force a layout / measurement pass (e.g. after container resize). */
|
|
2366
|
-
forceLayout?: () => Promise<void>;
|
|
2367
|
-
/** Return effective resolved config (after inference & precedence). */
|
|
2368
|
-
getConfig?: () => Promise<Readonly<GridConfig<T>>>;
|
|
2369
|
-
/** Toggle expansion state of a group row by its generated key. */
|
|
2370
|
-
toggleGroup?: (key: string) => Promise<void>;
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
export declare const registerAggregator: (name: string, fn: AggregatorFn) => void;
|
|
2374
|
-
|
|
2375
|
-
/** Controller managing drag-based column resize lifecycle. */
|
|
2376
|
-
declare interface ResizeController {
|
|
2377
|
-
start: (e: MouseEvent, colIndex: number, cell: HTMLElement) => void;
|
|
2378
|
-
/** Reset a column to its configured width (or auto-size if none configured). */
|
|
2379
|
-
resetColumn: (colIndex: number) => void;
|
|
2380
|
-
dispose: () => void;
|
|
2381
|
-
/** True while a resize drag is in progress (used to suppress header click/sort). */
|
|
2382
|
-
isResizing: boolean;
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
/**
|
|
2386
|
-
* Row click event
|
|
2387
|
-
*/
|
|
2388
|
-
export declare interface RowClickEvent {
|
|
2389
|
-
rowIndex: number;
|
|
2390
|
-
row: any;
|
|
2391
|
-
rowEl: HTMLElement;
|
|
2392
|
-
originalEvent: MouseEvent;
|
|
2393
|
-
}
|
|
2394
|
-
|
|
2395
|
-
/** Detail payload for a committed row edit (may or may not include changes). */
|
|
2396
|
-
export declare interface RowCommitDetail<TRow = unknown> {
|
|
2397
|
-
/** Row index that lost edit focus. */
|
|
2398
|
-
rowIndex: number;
|
|
2399
|
-
/** Row object reference. */
|
|
2400
|
-
row: TRow;
|
|
2401
|
-
/** Whether any cell changes were actually committed in this row during the session. */
|
|
2402
|
-
changed: boolean;
|
|
2403
|
-
/** Current changed row collection. */
|
|
2404
|
-
changedRows: TRow[];
|
|
2405
|
-
/** Indices of changed rows. */
|
|
2406
|
-
changedRowIndices: number[];
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2409
|
-
/**
|
|
2410
|
-
* Group row rendering customization options.
|
|
2411
|
-
* Used within grouping-rows plugin config for presentation of group rows.
|
|
2412
|
-
*/
|
|
2413
|
-
export declare interface RowGroupRenderConfig {
|
|
2414
|
-
/** If true, group rows span all columns (single full-width cell). Default false. */
|
|
2415
|
-
fullWidth?: boolean;
|
|
2416
|
-
/** Optional label formatter override. Receives raw group value + depth. */
|
|
2417
|
-
formatLabel?: (value: unknown, depth: number, key: string) => string;
|
|
2418
|
-
/** Optional aggregate overrides per field for group summary cells (only when not fullWidth). */
|
|
2419
|
-
aggregators?: Record<string, AggregatorRef>;
|
|
2420
|
-
/** Additional CSS class applied to each group row root element. */
|
|
2421
|
-
class?: string;
|
|
2422
|
-
}
|
|
2423
|
-
|
|
2424
|
-
export declare const runAggregator: (ref: AggregatorRef_2 | undefined, rows: any[], field: string, column?: any) => any;
|
|
2425
|
-
|
|
2426
|
-
/**
|
|
2427
|
-
* Run a value-based aggregator on a set of values.
|
|
2428
|
-
*
|
|
2429
|
-
* @param aggFunc - Aggregation function name
|
|
2430
|
-
* @param values - Array of numbers to aggregate
|
|
2431
|
-
* @returns Aggregated result
|
|
2432
|
-
*/
|
|
2433
|
-
export declare function runValueAggregator(aggFunc: string, values: number[]): number;
|
|
2434
|
-
|
|
2435
|
-
/**
|
|
2436
|
-
* Scroll event
|
|
2437
|
-
*/
|
|
2438
|
-
export declare interface ScrollEvent {
|
|
2439
|
-
scrollTop: number;
|
|
2440
|
-
scrollLeft: number;
|
|
2441
|
-
scrollHeight: number;
|
|
2442
|
-
scrollWidth: number;
|
|
2443
|
-
clientHeight: number;
|
|
2444
|
-
clientWidth: number;
|
|
2445
|
-
originalEvent?: Event;
|
|
2446
|
-
}
|
|
2447
|
-
|
|
2448
|
-
/**
|
|
2449
|
-
* Unified event detail emitted when selection changes (all modes).
|
|
2450
|
-
* Provides a consistent structure for consumers to handle selection state.
|
|
2451
|
-
*/
|
|
2452
|
-
export declare interface SelectionChangeDetail {
|
|
2453
|
-
/** The selection mode that triggered this event */
|
|
2454
|
-
mode: SelectionMode_2;
|
|
2455
|
-
/** Selected cell ranges. For cell mode, contains a single-cell range. For row mode, contains full-row ranges. */
|
|
2456
|
-
ranges: CellRange[];
|
|
2457
|
-
}
|
|
2458
|
-
|
|
2459
|
-
/** Configuration options for the selection plugin */
|
|
2460
|
-
export declare interface SelectionConfig {
|
|
2461
|
-
/** Selection mode (default: 'cell') */
|
|
2462
|
-
mode: SelectionMode_2;
|
|
2463
|
-
}
|
|
2464
|
-
|
|
2465
|
-
/**
|
|
2466
|
-
* Selection Plugin Types
|
|
2467
|
-
*
|
|
2468
|
-
* Type definitions for the selection feature.
|
|
2469
|
-
*/
|
|
2470
|
-
/**
|
|
2471
|
-
* Selection mode for the grid:
|
|
2472
|
-
* - 'cell': Single cell selection (default). No border, just focus highlight.
|
|
2473
|
-
* - 'row': Row selection. Clicking a cell selects the entire row. Uses focus outline color.
|
|
2474
|
-
* - 'range': Range selection. Shift+click or drag to select rectangular cell ranges. Uses success border color.
|
|
2475
|
-
*/
|
|
2476
|
-
declare type SelectionMode_2 = 'cell' | 'row' | 'range';
|
|
2477
|
-
export { SelectionMode_2 as SelectionMode }
|
|
2478
|
-
|
|
2479
|
-
export declare interface ServerSideDataSource {
|
|
2480
|
-
getRows(params: GetRowsParams): Promise<GetRowsResult>;
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
/**
|
|
2484
|
-
* Shell configuration for the grid's optional header bar and tool panels.
|
|
2485
|
-
*/
|
|
2486
|
-
export declare interface ShellConfig {
|
|
2487
|
-
/** Shell header bar configuration */
|
|
2488
|
-
header?: ShellHeaderConfig;
|
|
2489
|
-
/** Tool panel configuration */
|
|
2490
|
-
toolPanel?: ToolPanelConfig;
|
|
2491
|
-
}
|
|
2492
|
-
|
|
2493
|
-
/**
|
|
2494
|
-
* Shell header bar configuration
|
|
2495
|
-
*/
|
|
2496
|
-
export declare interface ShellHeaderConfig {
|
|
2497
|
-
/** Grid title displayed on the left (optional) */
|
|
2498
|
-
title?: string;
|
|
2499
|
-
/** Custom toolbar buttons (rendered before tool panel toggles) */
|
|
2500
|
-
toolbarButtons?: ToolbarButtonConfig[];
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
|
-
/** Detail for a sort change (direction 0 indicates cleared sort). */
|
|
2504
|
-
export declare interface SortChangeDetail {
|
|
2505
|
-
/** Sorted field key. */
|
|
2506
|
-
field: string;
|
|
2507
|
-
/** Direction: 1 ascending, -1 descending, 0 cleared. */
|
|
2508
|
-
direction: 1 | -1 | 0;
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2511
|
-
/**
|
|
2512
|
-
* Custom sort handler function signature.
|
|
2513
|
-
*
|
|
2514
|
-
* @param rows - Current row array to sort
|
|
2515
|
-
* @param sortState - Sort field and direction
|
|
2516
|
-
* @param columns - Column configurations (for accessing sortComparator)
|
|
2517
|
-
* @returns Sorted array (sync) or Promise resolving to sorted array (async)
|
|
2518
|
-
*/
|
|
2519
|
-
export declare type SortHandler<TRow = any> = (rows: TRow[], sortState: SortState, columns: ColumnConfig<TRow>[]) => TRow[] | Promise<TRow[]>;
|
|
2520
|
-
|
|
2521
|
-
/**
|
|
2522
|
-
* Multi-Sort Plugin Types
|
|
2523
|
-
*
|
|
2524
|
-
* Type definitions for the multi-column sorting feature.
|
|
2525
|
-
*/
|
|
2526
|
-
/** Represents a single column sort configuration */
|
|
2527
|
-
export declare interface SortModel {
|
|
2528
|
-
/** The field key to sort by */
|
|
2529
|
-
field: string;
|
|
2530
|
-
/** Sort direction */
|
|
2531
|
-
direction: 'asc' | 'desc';
|
|
2532
|
-
}
|
|
2533
|
-
|
|
2534
|
-
/**
|
|
2535
|
-
* Sort state passed to custom sort handlers.
|
|
2536
|
-
*/
|
|
2537
|
-
export declare interface SortState {
|
|
2538
|
-
/** Field to sort by */
|
|
2539
|
-
field: string;
|
|
2540
|
-
/** Sort direction: 1 = ascending, -1 = descending */
|
|
2541
|
-
direction: 1 | -1;
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2544
|
-
/**
|
|
2545
|
-
* Toolbar button defined via config (programmatic approach).
|
|
2546
|
-
* Supports three modes:
|
|
2547
|
-
* - Simple: provide `icon` + `action` for grid to create button
|
|
2548
|
-
* - Element: provide `element` for user-created DOM
|
|
2549
|
-
* - Render: provide `render` function for complex widgets
|
|
2550
|
-
*/
|
|
2551
|
-
export declare interface ToolbarButtonConfig {
|
|
2552
|
-
/** Unique button ID */
|
|
2553
|
-
id: string;
|
|
2554
|
-
/** Tooltip / aria-label (required for accessibility) */
|
|
2555
|
-
label: string;
|
|
2556
|
-
/** Order priority (lower = first, default: 100) */
|
|
2557
|
-
order?: number;
|
|
2558
|
-
/** Whether button is disabled (only applies to grid-rendered buttons) */
|
|
2559
|
-
disabled?: boolean;
|
|
2560
|
-
/** Button content: SVG string, emoji, or text. Grid creates <button> with this. */
|
|
2561
|
-
icon?: string;
|
|
2562
|
-
/** Click handler (required when using icon) */
|
|
2563
|
-
action?: () => void;
|
|
2564
|
-
/**
|
|
2565
|
-
* User-provided element. Grid wraps it but doesn't modify it.
|
|
2566
|
-
* User is responsible for event handlers.
|
|
2567
|
-
*/
|
|
2568
|
-
element?: HTMLElement;
|
|
2569
|
-
/**
|
|
2570
|
-
* Render function called once. Receives container, user appends their DOM.
|
|
2571
|
-
* User is responsible for event handlers.
|
|
2572
|
-
* Return a cleanup function (optional).
|
|
2573
|
-
*/
|
|
2574
|
-
render?: (container: HTMLElement) => void | (() => void);
|
|
2575
|
-
}
|
|
2576
|
-
|
|
2577
|
-
/**
|
|
2578
|
-
* Toolbar button info returned by getToolbarButtons().
|
|
2579
|
-
*/
|
|
2580
|
-
declare interface ToolbarButtonInfo {
|
|
2581
|
-
id: string;
|
|
2582
|
-
label: string;
|
|
2583
|
-
disabled: boolean;
|
|
2584
|
-
/** Source of this button: 'config' | 'light-dom' | 'panel-toggle' */
|
|
2585
|
-
source: 'config' | 'light-dom' | 'panel-toggle';
|
|
2586
|
-
/** For panel toggles, the associated panel ID */
|
|
2587
|
-
panelId?: string;
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2590
|
-
/**
|
|
2591
|
-
* Tool panel configuration
|
|
2592
|
-
*/
|
|
2593
|
-
export declare interface ToolPanelConfig {
|
|
2594
|
-
/** Panel position: 'left' | 'right' (default: 'right') */
|
|
2595
|
-
position?: 'left' | 'right';
|
|
2596
|
-
/** Default panel width in pixels (default: 280) */
|
|
2597
|
-
width?: number;
|
|
2598
|
-
/** Panel ID to open by default on load */
|
|
2599
|
-
defaultOpen?: string;
|
|
2600
|
-
/** Whether to persist open/closed state (requires Column State Events) */
|
|
2601
|
-
persistState?: boolean;
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
|
-
/**
|
|
2605
|
-
* Tool panel definition registered by plugins or consumers.
|
|
2606
|
-
*/
|
|
2607
|
-
export declare interface ToolPanelDefinition {
|
|
2608
|
-
/** Unique panel ID */
|
|
2609
|
-
id: string;
|
|
2610
|
-
/** Panel title shown in accordion header */
|
|
2611
|
-
title: string;
|
|
2612
|
-
/** Icon for accordion section header (optional, emoji or SVG) */
|
|
2613
|
-
icon?: string;
|
|
2614
|
-
/** Tooltip for accordion section header */
|
|
2615
|
-
tooltip?: string;
|
|
2616
|
-
/** Panel content factory - called when panel section opens */
|
|
2617
|
-
render: (container: HTMLElement) => void | (() => void);
|
|
2618
|
-
/** Called when panel closes (for cleanup) */
|
|
2619
|
-
onClose?: () => void;
|
|
2620
|
-
/** Panel order priority (lower = first, default: 100) */
|
|
2621
|
-
order?: number;
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
/** Configuration options for the tree plugin */
|
|
2625
|
-
export declare interface TreeConfig {
|
|
2626
|
-
/** Field name containing child rows (default: 'children') */
|
|
2627
|
-
childrenField?: string;
|
|
2628
|
-
/** Auto-detect tree structure from data (default: true) */
|
|
2629
|
-
autoDetect?: boolean;
|
|
2630
|
-
/** Whether nodes are expanded by default (default: false) */
|
|
2631
|
-
defaultExpanded?: boolean;
|
|
2632
|
-
/** Indentation width per level in pixels (default: 20) */
|
|
2633
|
-
indentWidth?: number;
|
|
2634
|
-
/** Show expand/collapse icons (default: true) */
|
|
2635
|
-
showExpandIcons?: boolean;
|
|
2636
|
-
/**
|
|
2637
|
-
* Animation style for expanding/collapsing tree nodes.
|
|
2638
|
-
* - `false`: No animation
|
|
2639
|
-
* - `'slide'`: Slide animation (default)
|
|
2640
|
-
* - `'fade'`: Fade animation
|
|
2641
|
-
* @default 'slide'
|
|
2642
|
-
*/
|
|
2643
|
-
animation?: ExpandCollapseAnimation;
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2646
|
-
/** Event detail emitted when a tree node is expanded or collapsed */
|
|
2647
|
-
export declare interface TreeExpandDetail {
|
|
2648
|
-
/** The row key that was toggled */
|
|
2649
|
-
key: string;
|
|
2650
|
-
/** The original row data */
|
|
2651
|
-
row: any;
|
|
2652
|
-
/** Whether the row is now expanded */
|
|
2653
|
-
expanded: boolean;
|
|
2654
|
-
/** Depth level of the row */
|
|
2655
|
-
depth: number;
|
|
2656
|
-
}
|
|
2657
|
-
|
|
2658
|
-
export declare const unregisterAggregator: (name: string) => void;
|
|
2659
|
-
|
|
2660
|
-
export declare type ValueAggregatorFn = (values: number[]) => number;
|
|
2661
|
-
|
|
2662
|
-
/** Virtual window bookkeeping; modified in-place as scroll position changes. */
|
|
2663
|
-
declare interface VirtualState {
|
|
2664
|
-
enabled: boolean;
|
|
2665
|
-
rowHeight: number;
|
|
2666
|
-
/** Threshold for bypassing virtualization (renders all rows if totalRows <= bypassThreshold) */
|
|
2667
|
-
bypassThreshold: number;
|
|
2668
|
-
start: number;
|
|
2669
|
-
end: number;
|
|
2670
|
-
/** Faux scrollbar element that provides scroll events (AG Grid pattern) */
|
|
2671
|
-
container: HTMLElement | null;
|
|
2672
|
-
/** Rows viewport element for measuring visible area height */
|
|
2673
|
-
viewportEl: HTMLElement | null;
|
|
2674
|
-
/** Spacer element inside faux scrollbar for setting virtual height */
|
|
2675
|
-
totalHeightEl: HTMLElement | null;
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
|
-
export { }
|
|
1
|
+
export * from './public';
|
|
2
|
+
export { DataGridElement } from './lib/core/grid';
|
|
3
|
+
export type { AggregatorRef, CellRenderContext, ColumnEditorContext, ColumnEditorSpec, ColumnViewRenderer, RowGroupRenderConfig, } from './lib/core/types';
|
|
4
|
+
export { BaseGridPlugin, PluginManager } from './lib/core/plugin';
|
|
5
|
+
export type { CellClickEvent, CellCoords, CellEditor, CellMouseEvent, CellRenderer, ContextMenuItem, ContextMenuParams, GridElement, HeaderClickEvent, HeaderRenderer, KeyboardModifiers, PluginCellRenderContext, PluginHeaderRenderContext, RowClickEvent, ScrollEvent, } from './lib/core/plugin';
|
|
6
|
+
export { aggregatorRegistry, getAggregator, getValueAggregator, listAggregators, registerAggregator, runAggregator, runValueAggregator, unregisterAggregator, } from './lib/core/internal/aggregators';
|
|
7
|
+
export type { AggregatorFn, ValueAggregatorFn } from './lib/core/internal/aggregators';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|