@toolbox-web/grid 0.2.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/README.md +13 -13
  2. package/all.d.ts +25 -5659
  3. package/all.d.ts.map +1 -0
  4. package/all.js +524 -450
  5. package/all.js.map +1 -1
  6. package/index.d.ts +8 -2678
  7. package/index.d.ts.map +1 -0
  8. package/index.js +3929 -25
  9. package/index.js.map +1 -1
  10. package/lib/core/constants.d.ts +114 -0
  11. package/lib/core/constants.d.ts.map +1 -0
  12. package/lib/core/grid.d.ts +337 -0
  13. package/lib/core/grid.d.ts.map +1 -0
  14. package/lib/core/internal/aggregators.d.ts +67 -0
  15. package/lib/core/internal/aggregators.d.ts.map +1 -0
  16. package/lib/core/internal/column-state.d.ts +124 -0
  17. package/lib/core/internal/column-state.d.ts.map +1 -0
  18. package/lib/core/internal/columns.d.ts +107 -0
  19. package/lib/core/internal/columns.d.ts.map +1 -0
  20. package/lib/core/internal/dom-builder.d.ts +115 -0
  21. package/lib/core/internal/dom-builder.d.ts.map +1 -0
  22. package/lib/core/internal/editing.d.ts +76 -0
  23. package/lib/core/internal/editing.d.ts.map +1 -0
  24. package/lib/core/internal/editors.d.ts +8 -0
  25. package/lib/core/internal/editors.d.ts.map +1 -0
  26. package/lib/core/internal/event-delegation.d.ts +11 -0
  27. package/lib/core/internal/event-delegation.d.ts.map +1 -0
  28. package/lib/core/internal/grid-internals.d.ts +83 -0
  29. package/lib/core/internal/grid-internals.d.ts.map +1 -0
  30. package/lib/core/internal/header.d.ts +7 -0
  31. package/lib/core/internal/header.d.ts.map +1 -0
  32. package/lib/core/internal/idle-scheduler.d.ts +65 -0
  33. package/lib/core/internal/idle-scheduler.d.ts.map +1 -0
  34. package/lib/core/internal/inference.d.ts +12 -0
  35. package/lib/core/internal/inference.d.ts.map +1 -0
  36. package/lib/core/internal/keyboard.d.ts +18 -0
  37. package/lib/core/internal/keyboard.d.ts.map +1 -0
  38. package/lib/core/internal/resize.d.ts +3 -0
  39. package/lib/core/internal/resize.d.ts.map +1 -0
  40. package/lib/core/internal/rows.d.ts +35 -0
  41. package/lib/core/internal/rows.d.ts.map +1 -0
  42. package/lib/core/internal/sanitize.d.ts +13 -0
  43. package/lib/core/internal/sanitize.d.ts.map +1 -0
  44. package/lib/core/internal/shell.d.ts +228 -0
  45. package/lib/core/internal/shell.d.ts.map +1 -0
  46. package/lib/core/internal/sorting.d.ts +24 -0
  47. package/lib/core/internal/sorting.d.ts.map +1 -0
  48. package/lib/core/internal/touch-scroll.d.ts +54 -0
  49. package/lib/core/internal/touch-scroll.d.ts.map +1 -0
  50. package/lib/core/internal/utils.d.ts +38 -0
  51. package/lib/core/internal/utils.d.ts.map +1 -0
  52. package/lib/core/internal/virtualization.d.ts +66 -0
  53. package/lib/core/internal/virtualization.d.ts.map +1 -0
  54. package/lib/core/plugin/base-plugin.d.ts +616 -0
  55. package/lib/core/plugin/base-plugin.d.ts.map +1 -0
  56. package/lib/core/plugin/index.d.ts +11 -0
  57. package/lib/core/plugin/index.d.ts.map +1 -0
  58. package/lib/core/plugin/plugin-manager.d.ts +183 -0
  59. package/lib/core/plugin/plugin-manager.d.ts.map +1 -0
  60. package/lib/core/plugin/types.d.ts +196 -0
  61. package/lib/core/plugin/types.d.ts.map +1 -0
  62. package/lib/core/types.d.ts +841 -0
  63. package/lib/core/types.d.ts.map +1 -0
  64. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +46 -0
  65. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -0
  66. package/lib/plugins/clipboard/copy.d.ts +47 -0
  67. package/lib/plugins/clipboard/copy.d.ts.map +1 -0
  68. package/lib/plugins/clipboard/index.d.ts +7 -0
  69. package/lib/plugins/clipboard/index.d.ts.map +1 -0
  70. package/lib/plugins/clipboard/index.js.map +1 -1
  71. package/lib/plugins/clipboard/paste.d.ts +25 -0
  72. package/lib/plugins/clipboard/paste.d.ts.map +1 -0
  73. package/lib/plugins/clipboard/types.d.ts +40 -0
  74. package/lib/plugins/clipboard/types.d.ts.map +1 -0
  75. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +54 -0
  76. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -0
  77. package/lib/plugins/column-virtualization/column-virtualization.d.ts +53 -0
  78. package/lib/plugins/column-virtualization/column-virtualization.d.ts.map +1 -0
  79. package/lib/plugins/column-virtualization/index.d.ts +7 -0
  80. package/lib/plugins/column-virtualization/index.d.ts.map +1 -0
  81. package/lib/plugins/column-virtualization/index.js.map +1 -1
  82. package/lib/plugins/column-virtualization/types.d.ts +41 -0
  83. package/lib/plugins/column-virtualization/types.d.ts.map +1 -0
  84. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +52 -0
  85. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -0
  86. package/lib/plugins/context-menu/index.d.ts +7 -0
  87. package/lib/plugins/context-menu/index.d.ts.map +1 -0
  88. package/lib/plugins/context-menu/index.js +24 -24
  89. package/lib/plugins/context-menu/index.js.map +1 -1
  90. package/lib/plugins/context-menu/menu.d.ts +38 -0
  91. package/lib/plugins/context-menu/menu.d.ts.map +1 -0
  92. package/lib/plugins/context-menu/types.d.ts +77 -0
  93. package/lib/plugins/context-menu/types.d.ts.map +1 -0
  94. package/lib/plugins/export/ExportPlugin.d.ts +53 -0
  95. package/lib/plugins/export/ExportPlugin.d.ts.map +1 -0
  96. package/lib/plugins/export/csv.d.ts +31 -0
  97. package/lib/plugins/export/csv.d.ts.map +1 -0
  98. package/lib/plugins/export/excel.d.ts +12 -0
  99. package/lib/plugins/export/excel.d.ts.map +1 -0
  100. package/lib/plugins/export/index.d.ts +7 -0
  101. package/lib/plugins/export/index.d.ts.map +1 -0
  102. package/lib/plugins/export/index.js.map +1 -1
  103. package/lib/plugins/export/types.d.ts +57 -0
  104. package/lib/plugins/export/types.d.ts.map +1 -0
  105. package/lib/plugins/filtering/FilteringPlugin.d.ts +128 -0
  106. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -0
  107. package/lib/plugins/filtering/filter-model.d.ts +38 -0
  108. package/lib/plugins/filtering/filter-model.d.ts.map +1 -0
  109. package/lib/plugins/filtering/index.d.ts +7 -0
  110. package/lib/plugins/filtering/index.d.ts.map +1 -0
  111. package/lib/plugins/filtering/index.js +5 -5
  112. package/lib/plugins/filtering/index.js.map +1 -1
  113. package/lib/plugins/filtering/types.d.ts +157 -0
  114. package/lib/plugins/filtering/types.d.ts.map +1 -0
  115. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +51 -0
  116. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -0
  117. package/lib/plugins/grouping-columns/grouping-columns.d.ts +41 -0
  118. package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -0
  119. package/lib/plugins/grouping-columns/index.d.ts +7 -0
  120. package/lib/plugins/grouping-columns/index.d.ts.map +1 -0
  121. package/lib/plugins/grouping-columns/index.js +58 -42
  122. package/lib/plugins/grouping-columns/index.js.map +1 -1
  123. package/lib/plugins/grouping-columns/types.d.ts +91 -0
  124. package/lib/plugins/grouping-columns/types.d.ts.map +1 -0
  125. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +120 -0
  126. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -0
  127. package/lib/plugins/grouping-rows/grouping-rows.d.ts +51 -0
  128. package/lib/plugins/grouping-rows/grouping-rows.d.ts.map +1 -0
  129. package/lib/plugins/grouping-rows/index.d.ts +7 -0
  130. package/lib/plugins/grouping-rows/index.d.ts.map +1 -0
  131. package/lib/plugins/grouping-rows/index.js +51 -51
  132. package/lib/plugins/grouping-rows/index.js.map +1 -1
  133. package/lib/plugins/grouping-rows/types.d.ts +95 -0
  134. package/lib/plugins/grouping-rows/types.d.ts.map +1 -0
  135. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +147 -0
  136. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -0
  137. package/lib/plugins/master-detail/index.d.ts +7 -0
  138. package/lib/plugins/master-detail/index.d.ts.map +1 -0
  139. package/lib/plugins/master-detail/index.js +235 -78
  140. package/lib/plugins/master-detail/index.js.map +1 -1
  141. package/lib/plugins/master-detail/master-detail.d.ts +30 -0
  142. package/lib/plugins/master-detail/master-detail.d.ts.map +1 -0
  143. package/lib/plugins/master-detail/types.d.ts +40 -0
  144. package/lib/plugins/master-detail/types.d.ts.map +1 -0
  145. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +58 -0
  146. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -0
  147. package/lib/plugins/multi-sort/index.d.ts +7 -0
  148. package/lib/plugins/multi-sort/index.d.ts.map +1 -0
  149. package/lib/plugins/multi-sort/index.js.map +1 -1
  150. package/lib/plugins/multi-sort/multi-sort.d.ts +51 -0
  151. package/lib/plugins/multi-sort/multi-sort.d.ts.map +1 -0
  152. package/lib/plugins/multi-sort/types.d.ts +25 -0
  153. package/lib/plugins/multi-sort/types.d.ts.map +1 -0
  154. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +58 -0
  155. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -0
  156. package/lib/plugins/pinned-columns/index.d.ts +7 -0
  157. package/lib/plugins/pinned-columns/index.d.ts.map +1 -0
  158. package/lib/plugins/pinned-columns/index.js.map +1 -1
  159. package/lib/plugins/pinned-columns/pinned-columns.d.ts +62 -0
  160. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -0
  161. package/lib/plugins/pinned-columns/types.d.ts +20 -0
  162. package/lib/plugins/pinned-columns/types.d.ts.map +1 -0
  163. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +64 -0
  164. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -0
  165. package/lib/plugins/pinned-rows/index.d.ts +7 -0
  166. package/lib/plugins/pinned-rows/index.d.ts.map +1 -0
  167. package/lib/plugins/pinned-rows/index.js +1 -1
  168. package/lib/plugins/pinned-rows/index.js.map +1 -1
  169. package/lib/plugins/pinned-rows/pinned-rows.d.ts +43 -0
  170. package/lib/plugins/pinned-rows/pinned-rows.d.ts.map +1 -0
  171. package/lib/plugins/pinned-rows/types.d.ts +95 -0
  172. package/lib/plugins/pinned-rows/types.d.ts.map +1 -0
  173. package/lib/plugins/pivot/PivotPlugin.d.ts +94 -0
  174. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -0
  175. package/lib/plugins/pivot/index.d.ts +7 -0
  176. package/lib/plugins/pivot/index.d.ts.map +1 -0
  177. package/lib/plugins/pivot/index.js.map +1 -1
  178. package/lib/plugins/pivot/pivot-engine.d.ts +50 -0
  179. package/lib/plugins/pivot/pivot-engine.d.ts.map +1 -0
  180. package/lib/plugins/pivot/pivot-model.d.ts +6 -0
  181. package/lib/plugins/pivot/pivot-model.d.ts.map +1 -0
  182. package/lib/plugins/pivot/pivot-panel.d.ts +25 -0
  183. package/lib/plugins/pivot/pivot-panel.d.ts.map +1 -0
  184. package/lib/plugins/pivot/pivot-rows.d.ts +33 -0
  185. package/lib/plugins/pivot/pivot-rows.d.ts.map +1 -0
  186. package/lib/plugins/pivot/types.d.ts +62 -0
  187. package/lib/plugins/pivot/types.d.ts.map +1 -0
  188. package/lib/plugins/reorder/ReorderPlugin.d.ts +81 -0
  189. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -0
  190. package/lib/plugins/reorder/column-drag.d.ts +41 -0
  191. package/lib/plugins/reorder/column-drag.d.ts.map +1 -0
  192. package/lib/plugins/reorder/index.d.ts +7 -0
  193. package/lib/plugins/reorder/index.d.ts.map +1 -0
  194. package/lib/plugins/reorder/index.js +51 -48
  195. package/lib/plugins/reorder/index.js.map +1 -1
  196. package/lib/plugins/reorder/types.d.ts +54 -0
  197. package/lib/plugins/reorder/types.d.ts.map +1 -0
  198. package/lib/plugins/selection/SelectionPlugin.d.ts +77 -0
  199. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -0
  200. package/lib/plugins/selection/index.d.ts +8 -0
  201. package/lib/plugins/selection/index.d.ts.map +1 -0
  202. package/lib/plugins/selection/index.js +86 -75
  203. package/lib/plugins/selection/index.js.map +1 -1
  204. package/lib/plugins/selection/range-selection.d.ts +109 -0
  205. package/lib/plugins/selection/range-selection.d.ts.map +1 -0
  206. package/lib/plugins/selection/row-selection.d.ts +48 -0
  207. package/lib/plugins/selection/row-selection.d.ts.map +1 -0
  208. package/lib/plugins/selection/types.d.ts +80 -0
  209. package/lib/plugins/selection/types.d.ts.map +1 -0
  210. package/lib/plugins/server-side/ServerSidePlugin.d.ts +56 -0
  211. package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -0
  212. package/lib/plugins/server-side/cache.d.ts +14 -0
  213. package/lib/plugins/server-side/cache.d.ts.map +1 -0
  214. package/lib/plugins/server-side/datasource.d.ts +12 -0
  215. package/lib/plugins/server-side/datasource.d.ts.map +1 -0
  216. package/lib/plugins/server-side/index.d.ts +7 -0
  217. package/lib/plugins/server-side/index.d.ts.map +1 -0
  218. package/lib/plugins/server-side/index.js.map +1 -1
  219. package/lib/plugins/server-side/types.d.ts +43 -0
  220. package/lib/plugins/server-side/types.d.ts.map +1 -0
  221. package/lib/plugins/tree/TreePlugin.d.ts +49 -0
  222. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -0
  223. package/lib/plugins/tree/index.d.ts +8 -0
  224. package/lib/plugins/tree/index.d.ts.map +1 -0
  225. package/lib/plugins/tree/index.js.map +1 -1
  226. package/lib/plugins/tree/tree-data.d.ts +42 -0
  227. package/lib/plugins/tree/tree-data.d.ts.map +1 -0
  228. package/lib/plugins/tree/tree-detect.d.ts +24 -0
  229. package/lib/plugins/tree/tree-detect.d.ts.map +1 -0
  230. package/lib/plugins/tree/types.d.ts +61 -0
  231. package/lib/plugins/tree/types.d.ts.map +1 -0
  232. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +68 -0
  233. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -0
  234. package/lib/plugins/undo-redo/history.d.ts +64 -0
  235. package/lib/plugins/undo-redo/history.d.ts.map +1 -0
  236. package/lib/plugins/undo-redo/index.d.ts +7 -0
  237. package/lib/plugins/undo-redo/index.d.ts.map +1 -0
  238. package/lib/plugins/undo-redo/index.js.map +1 -1
  239. package/lib/plugins/undo-redo/types.d.ts +41 -0
  240. package/lib/plugins/undo-redo/types.d.ts.map +1 -0
  241. package/lib/plugins/visibility/VisibilityPlugin.d.ts +135 -0
  242. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -0
  243. package/lib/plugins/visibility/index.d.ts +8 -0
  244. package/lib/plugins/visibility/index.d.ts.map +1 -0
  245. package/lib/plugins/visibility/index.js.map +1 -1
  246. package/lib/plugins/visibility/types.d.ts +33 -0
  247. package/lib/plugins/visibility/types.d.ts.map +1 -0
  248. package/lib/plugins/visibility/visibility.d.ts +30 -0
  249. package/lib/plugins/visibility/visibility.d.ts.map +1 -0
  250. package/package.json +6 -2
  251. package/public.d.ts +52 -0
  252. package/public.d.ts.map +1 -0
  253. package/umd/grid.all.umd.js +32 -74
  254. package/umd/grid.all.umd.js.map +1 -1
  255. package/umd/grid.umd.js +22 -64
  256. package/umd/grid.umd.js.map +1 -1
  257. package/umd/plugins/context-menu.umd.js +1 -1
  258. package/umd/plugins/context-menu.umd.js.map +1 -1
  259. package/umd/plugins/filtering.umd.js +1 -1
  260. package/umd/plugins/filtering.umd.js.map +1 -1
  261. package/umd/plugins/grouping-columns.umd.js +1 -1
  262. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  263. package/umd/plugins/grouping-rows.umd.js +1 -1
  264. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  265. package/umd/plugins/master-detail.umd.js +1 -1
  266. package/umd/plugins/master-detail.umd.js.map +1 -1
  267. package/umd/plugins/pinned-rows.umd.js +1 -1
  268. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  269. package/umd/plugins/pivot.umd.js.map +1 -1
  270. package/umd/plugins/selection.umd.js +1 -1
  271. package/umd/plugins/selection.umd.js.map +1 -1
  272. package/index-YjW60MHD.js +0 -3235
  273. package/index-YjW60MHD.js.map +0 -1
@@ -0,0 +1,841 @@
1
+ import { PluginQuery } from './plugin/base-plugin';
2
+ /**
3
+ * The compiled webcomponent interface for DataGrid
4
+ */
5
+ export interface DataGridElement extends PublicGrid, HTMLElement {
6
+ }
7
+ /**
8
+ * Public API interface for DataGrid component.
9
+ *
10
+ * **Property Getters vs Setters:**
11
+ *
12
+ * Property getters return the EFFECTIVE (resolved) value after merging all config sources.
13
+ * This is the "current situation" - what consumers and plugins need to know.
14
+ *
15
+ * Property setters accept input values which are merged into the effective config.
16
+ * Multiple sources can contribute (gridConfig, columns prop, light DOM, individual props).
17
+ *
18
+ * For example:
19
+ * - `grid.fitMode` returns the resolved fitMode (e.g., 'stretch' even if you set undefined)
20
+ * - `grid.columns` returns the effective columns after merging
21
+ * - `grid.gridConfig` returns the full effective config
22
+ */
23
+ export interface PublicGrid<T = any> {
24
+ /**
25
+ * Full config object. Setter merges with other inputs per precedence rules.
26
+ * Getter returns the effective (resolved) config.
27
+ */
28
+ gridConfig?: GridConfig<T>;
29
+ /**
30
+ * Column definitions.
31
+ * Getter returns effective columns (after merging config, light DOM, inference).
32
+ */
33
+ columns?: ColumnConfig<T>[];
34
+ /** Current row data (after plugin processing like grouping, filtering). */
35
+ rows?: T[];
36
+ /** Resolves once the component has finished initial work (layout, inference). */
37
+ ready?: () => Promise<void>;
38
+ /** Force a layout / measurement pass (e.g. after container resize). */
39
+ forceLayout?: () => Promise<void>;
40
+ /** Return effective resolved config (after inference & precedence). */
41
+ getConfig?: () => Promise<Readonly<GridConfig<T>>>;
42
+ /** Toggle expansion state of a group row by its generated key. */
43
+ toggleGroup?: (key: string) => Promise<void>;
44
+ /**
45
+ * Register custom CSS styles to be injected into the grid's shadow DOM.
46
+ * Use this to style custom cell renderers, editors, or detail panels.
47
+ * @param id - Unique identifier for the style block (for removal/updates)
48
+ * @param css - CSS string to inject
49
+ */
50
+ registerStyles?: (id: string, css: string) => void;
51
+ /**
52
+ * Remove previously registered custom styles.
53
+ * @param id - The ID used when registering the styles
54
+ */
55
+ unregisterStyles?: (id: string) => void;
56
+ /**
57
+ * Get list of registered custom style IDs.
58
+ */
59
+ getRegisteredStyles?: () => string[];
60
+ }
61
+ /**
62
+ * Internal-only augmented interface for DataGrid component
63
+ */
64
+ export interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
65
+ shadowRoot: ShadowRoot | null;
66
+ _rows: T[];
67
+ _columns: ColumnInternal<T>[];
68
+ /** Visible columns only (excludes hidden). Use for rendering. */
69
+ _visibleColumns: ColumnInternal<T>[];
70
+ _headerRowEl: HTMLElement;
71
+ _bodyEl: HTMLElement;
72
+ _rowPool: HTMLElement[];
73
+ _resizeController: ResizeController;
74
+ _sortState: {
75
+ field: string;
76
+ direction: 1 | -1;
77
+ } | null;
78
+ __originalOrder: T[];
79
+ __rowRenderEpoch: number;
80
+ __didInitialAutoSize?: boolean;
81
+ __lightDomColumnsCache?: ColumnInternal[];
82
+ __originalColumnNodes?: HTMLElement[];
83
+ _gridTemplate: string;
84
+ _virtualization: VirtualState;
85
+ _focusRow: number;
86
+ _focusCol: number;
87
+ _activeEditRows: number;
88
+ _rowEditSnapshots: Map<number, T>;
89
+ _changedRowIndices: Set<number>;
90
+ changedRows?: T[];
91
+ changedRowIndices?: number[];
92
+ effectiveConfig?: GridConfig<T>;
93
+ findHeaderRow?: () => HTMLElement;
94
+ refreshVirtualWindow: (full: boolean) => void;
95
+ updateTemplate?: () => void;
96
+ findRenderedRowElement?: (rowIndex: number) => HTMLElement | null;
97
+ beginBulkEdit?: (rowIndex: number) => void;
98
+ commitActiveRowEdit?: () => void;
99
+ /** Dispatch cell click to plugin system, returns true if handled */
100
+ _dispatchCellClick?: (event: MouseEvent, rowIndex: number, colIndex: number, cellEl: HTMLElement) => boolean;
101
+ /** Dispatch row click to plugin system, returns true if handled */
102
+ _dispatchRowClick?: (event: MouseEvent, rowIndex: number, row: any, rowEl: HTMLElement) => boolean;
103
+ /** Dispatch header click to plugin system, returns true if handled */
104
+ _dispatchHeaderClick?: (event: MouseEvent, colIndex: number, headerEl: HTMLElement) => boolean;
105
+ /** Dispatch keydown to plugin system, returns true if handled */
106
+ _dispatchKeyDown?: (event: KeyboardEvent) => boolean;
107
+ /** Get horizontal scroll boundary offsets from plugins */
108
+ _getHorizontalScrollOffsets?: (rowEl?: HTMLElement, focusedCell?: HTMLElement) => {
109
+ left: number;
110
+ right: number;
111
+ skipScroll?: boolean;
112
+ };
113
+ /** Query all plugins with a generic query and collect responses */
114
+ queryPlugins?: <T>(query: PluginQuery) => T[];
115
+ /** Request emission of column-state-change event (debounced) */
116
+ requestStateChange?: () => void;
117
+ }
118
+ export type PrimitiveColumnType = 'number' | 'string' | 'date' | 'boolean' | 'select' | 'typeahead';
119
+ /**
120
+ * Base contract for a column. Public; kept intentionally lean so host apps can extend via intersection types.
121
+ * Prefer adding optional properties here only when broadly useful to most grids.
122
+ */
123
+ export interface BaseColumnConfig<TRow = any, TValue = any> {
124
+ /** Unique field key referencing property in row objects */
125
+ field: keyof TRow & string;
126
+ /** Visible header label; defaults to capitalized field */
127
+ header?: string;
128
+ /** Column data type; inferred if omitted */
129
+ type?: PrimitiveColumnType;
130
+ /** Column width in pixels; fixed size (no flexibility) */
131
+ width?: string | number;
132
+ /** Minimum column width in pixels (stretch mode only); when set, column uses minmax(minWidth, 1fr) */
133
+ minWidth?: number;
134
+ /** Whether column can be sorted */
135
+ sortable?: boolean;
136
+ /** Whether column can be resized by user */
137
+ resizable?: boolean;
138
+ /** Optional custom comparator for sorting (a,b) -> number */
139
+ sortComparator?: (a: TValue, b: TValue, rowA: TRow, rowB: TRow) => number;
140
+ /** Whether the field is editable (enables editors) */
141
+ editable?: boolean;
142
+ /** Optional custom editor factory or element tag name */
143
+ editor?: ColumnEditorSpec<TRow, TValue>;
144
+ /** For select/typeahead types - available options */
145
+ options?: Array<{
146
+ label: string;
147
+ value: unknown;
148
+ }> | (() => Array<{
149
+ label: string;
150
+ value: unknown;
151
+ }>);
152
+ /** For select/typeahead - allow multi select */
153
+ multi?: boolean;
154
+ /** Optional formatter */
155
+ format?: (value: TValue, row: TRow) => string;
156
+ /** Arbitrary extra metadata */
157
+ meta?: Record<string, unknown>;
158
+ }
159
+ /**
160
+ * Full column configuration including optional custom view/renderer & grouping metadata.
161
+ */
162
+ export interface ColumnConfig<TRow = any> extends BaseColumnConfig<TRow, any> {
163
+ /** Optional custom view renderer used instead of default text rendering */
164
+ viewRenderer?: ColumnViewRenderer<TRow, any>;
165
+ /** External view spec (lets host app mount any framework component) */
166
+ externalView?: {
167
+ component: unknown;
168
+ props?: Record<string, unknown>;
169
+ mount?: (options: {
170
+ placeholder: HTMLElement;
171
+ context: CellRenderContext<TRow, unknown>;
172
+ spec: unknown;
173
+ }) => void | {
174
+ dispose?: () => void;
175
+ };
176
+ };
177
+ /** Whether the column is initially hidden */
178
+ hidden?: boolean;
179
+ /** Prevent this column from being hidden programmatically */
180
+ lockVisible?: boolean;
181
+ }
182
+ export type ColumnConfigMap<TRow = any> = ColumnConfig<TRow>[];
183
+ /** External editor spec: tag name, factory function, or external mount spec */
184
+ export type ColumnEditorSpec<TRow = unknown, TValue = unknown> = string | ((context: ColumnEditorContext<TRow, TValue>) => HTMLElement | string) | {
185
+ /** Arbitrary component reference (class, function, token) */
186
+ component: unknown;
187
+ /** Optional static props passed to mount */
188
+ props?: Record<string, unknown>;
189
+ /** Optional custom mount function; if provided we call it directly instead of emitting an event */
190
+ mount?: (options: {
191
+ placeholder: HTMLElement;
192
+ context: ColumnEditorContext<TRow, TValue>;
193
+ spec: unknown;
194
+ }) => void | {
195
+ dispose?: () => void;
196
+ };
197
+ };
198
+ /**
199
+ * Context object provided to editor factories allowing mutation (commit/cancel) of a cell value.
200
+ */
201
+ export interface ColumnEditorContext<TRow = any, TValue = any> {
202
+ /** Underlying full row object for the active edit. */
203
+ row: TRow;
204
+ /** Current cell value (mutable only via commit). */
205
+ value: TValue;
206
+ /** Field name being edited. */
207
+ field: keyof TRow & string;
208
+ /** Column configuration reference. */
209
+ column: ColumnConfig<TRow>;
210
+ /** Accept the edit; triggers change tracking + rerender. */
211
+ commit: (newValue: TValue) => void;
212
+ /** Abort edit without persisting changes. */
213
+ cancel: () => void;
214
+ }
215
+ /**
216
+ * Context passed to custom view renderers (pure display – no commit helpers).
217
+ */
218
+ export interface CellRenderContext<TRow = any, TValue = any> {
219
+ /** Row object for the cell being rendered. */
220
+ row: TRow;
221
+ /** Value at field. */
222
+ value: TValue;
223
+ /** Field key. */
224
+ field: keyof TRow & string;
225
+ /** Column configuration reference. */
226
+ column: ColumnConfig<TRow>;
227
+ }
228
+ export type ColumnViewRenderer<TRow = unknown, TValue = unknown> = (ctx: CellRenderContext<TRow, TValue>) => Node | string | void;
229
+ /**
230
+ * Framework adapter interface for handling framework-specific component instantiation.
231
+ * Allows framework libraries (Angular, React, Vue) to register handlers that convert
232
+ * declarative light DOM elements into functional renderers/editors.
233
+ *
234
+ * @example
235
+ * ```typescript
236
+ * // In @toolbox-web/grid-angular
237
+ * class AngularGridAdapter implements FrameworkAdapter {
238
+ * canHandle(element: HTMLElement): boolean {
239
+ * return element.tagName.startsWith('APP-');
240
+ * }
241
+ * createRenderer(element: HTMLElement): ColumnViewRenderer {
242
+ * return (ctx) => {
243
+ * // Angular-specific instantiation logic
244
+ * const componentRef = createComponent(...);
245
+ * componentRef.setInput('value', ctx.value);
246
+ * return componentRef.location.nativeElement;
247
+ * };
248
+ * }
249
+ * createEditor(element: HTMLElement): ColumnEditorSpec {
250
+ * return (ctx) => {
251
+ * // Angular-specific editor with commit/cancel
252
+ * const componentRef = createComponent(...);
253
+ * componentRef.setInput('value', ctx.value);
254
+ * // Subscribe to commit/cancel outputs
255
+ * return componentRef.location.nativeElement;
256
+ * };
257
+ * }
258
+ * }
259
+ *
260
+ * // User registers adapter once in their app
261
+ * GridElement.registerAdapter(new AngularGridAdapter(injector, appRef));
262
+ * ```
263
+ */
264
+ export interface FrameworkAdapter {
265
+ /**
266
+ * Determines if this adapter can handle the given element.
267
+ * Typically checks tag name, attributes, or other conventions.
268
+ */
269
+ canHandle(element: HTMLElement): boolean;
270
+ /**
271
+ * Creates a view renderer function from a light DOM element.
272
+ * The renderer receives cell context and returns DOM or string.
273
+ */
274
+ createRenderer<TRow = unknown, TValue = unknown>(element: HTMLElement): ColumnViewRenderer<TRow, TValue>;
275
+ /**
276
+ * Creates an editor spec from a light DOM element.
277
+ * The editor receives context with commit/cancel and returns DOM.
278
+ */
279
+ createEditor<TRow = unknown, TValue = unknown>(element: HTMLElement): ColumnEditorSpec<TRow, TValue>;
280
+ /**
281
+ * Creates a tool panel renderer from a light DOM element.
282
+ * The renderer receives a container element and optionally returns a cleanup function.
283
+ */
284
+ createToolPanelRenderer?(element: HTMLElement): ((container: HTMLElement) => void | (() => void)) | undefined;
285
+ }
286
+ export interface ColumnInternal<T = any> extends ColumnConfig<T> {
287
+ __autoSized?: boolean;
288
+ __userResized?: boolean;
289
+ __renderedWidth?: number;
290
+ /** Original configured width (for reset on double-click) */
291
+ __originalWidth?: number;
292
+ __viewTemplate?: HTMLElement;
293
+ __editorTemplate?: HTMLElement;
294
+ __headerTemplate?: HTMLElement;
295
+ __compiledView?: (ctx: CellContext<T>) => string;
296
+ __compiledEditor?: (ctx: EditorExecContext<T>) => string;
297
+ }
298
+ /**
299
+ * Runtime cell context used internally for compiled template execution.
300
+ */
301
+ export interface CellContext<T = any> {
302
+ row: T;
303
+ value: unknown;
304
+ field: string;
305
+ column: ColumnInternal<T>;
306
+ }
307
+ /**
308
+ * Internal editor execution context extending the generic cell context with commit helpers.
309
+ */
310
+ export interface EditorExecContext<T = any> extends CellContext<T> {
311
+ commit: (newValue: unknown) => void;
312
+ cancel: () => void;
313
+ }
314
+ /** Controller managing drag-based column resize lifecycle. */
315
+ export interface ResizeController {
316
+ start: (e: MouseEvent, colIndex: number, cell: HTMLElement) => void;
317
+ /** Reset a column to its configured width (or auto-size if none configured). */
318
+ resetColumn: (colIndex: number) => void;
319
+ dispose: () => void;
320
+ /** True while a resize drag is in progress (used to suppress header click/sort). */
321
+ isResizing: boolean;
322
+ }
323
+ /** Virtual window bookkeeping; modified in-place as scroll position changes. */
324
+ export interface VirtualState {
325
+ enabled: boolean;
326
+ rowHeight: number;
327
+ /** Threshold for bypassing virtualization (renders all rows if totalRows <= bypassThreshold) */
328
+ bypassThreshold: number;
329
+ start: number;
330
+ end: number;
331
+ /** Faux scrollbar element that provides scroll events (AG Grid pattern) */
332
+ container: HTMLElement | null;
333
+ /** Rows viewport element for measuring visible area height */
334
+ viewportEl: HTMLElement | null;
335
+ /** Spacer element inside faux scrollbar for setting virtual height */
336
+ totalHeightEl: HTMLElement | null;
337
+ }
338
+ /**
339
+ * Group row rendering customization options.
340
+ * Used within grouping-rows plugin config for presentation of group rows.
341
+ */
342
+ export interface RowGroupRenderConfig {
343
+ /** If true, group rows span all columns (single full-width cell). Default false. */
344
+ fullWidth?: boolean;
345
+ /** Optional label formatter override. Receives raw group value + depth. */
346
+ formatLabel?: (value: unknown, depth: number, key: string) => string;
347
+ /** Optional aggregate overrides per field for group summary cells (only when not fullWidth). */
348
+ aggregators?: Record<string, AggregatorRef>;
349
+ /** Additional CSS class applied to each group row root element. */
350
+ class?: string;
351
+ }
352
+ export type AggregatorRef = string | ((rows: unknown[], field: string, column?: unknown) => unknown);
353
+ /** Result of automatic column inference from sample rows. */
354
+ export interface InferredColumnResult<TRow = unknown> {
355
+ columns: ColumnConfigMap<TRow>;
356
+ typeMap: Record<string, PrimitiveColumnType>;
357
+ }
358
+ export declare const FitModeEnum: {
359
+ readonly STRETCH: "stretch";
360
+ readonly FIXED: "fixed";
361
+ };
362
+ export type FitMode = (typeof FitModeEnum)[keyof typeof FitModeEnum];
363
+ /**
364
+ * Minimal plugin interface for type-checking.
365
+ * This interface is defined here to avoid circular imports with BaseGridPlugin.
366
+ * All plugins must satisfy this shape (BaseGridPlugin implements it).
367
+ */
368
+ export interface GridPlugin {
369
+ /** Unique plugin identifier */
370
+ readonly name: string;
371
+ /** Plugin version */
372
+ readonly version: string;
373
+ /** CSS styles to inject into grid's shadow DOM */
374
+ readonly styles?: string;
375
+ }
376
+ /**
377
+ * Grid configuration object - the **single source of truth** for grid behavior.
378
+ *
379
+ * Users can configure the grid via multiple input methods, all of which converge
380
+ * into an effective `GridConfig` internally:
381
+ *
382
+ * **Configuration Input Methods:**
383
+ * - `gridConfig` property - direct assignment of this object
384
+ * - `columns` property - shorthand for `gridConfig.columns`
385
+ * - `fitMode` property - shorthand for `gridConfig.fitMode`
386
+ * - `editOn` property - shorthand for `gridConfig.editOn`
387
+ * - Light DOM `<tbw-grid-column>` - declarative columns (merged into `columns`)
388
+ * - Light DOM `<tbw-grid-header>` - declarative shell header (merged into `shell.header`)
389
+ *
390
+ * **Precedence (when same property set multiple ways):**
391
+ * Individual props (`fitMode`, `editOn`) > `columns` prop > Light DOM > `gridConfig`
392
+ *
393
+ * @example
394
+ * ```ts
395
+ * // Via gridConfig (recommended for complex setups)
396
+ * grid.gridConfig = {
397
+ * columns: [{ field: 'name' }, { field: 'age' }],
398
+ * fitMode: 'stretch',
399
+ * plugins: [new SelectionPlugin()],
400
+ * shell: { header: { title: 'My Grid' } }
401
+ * };
402
+ *
403
+ * // Via individual props (convenience for simple cases)
404
+ * grid.columns = [{ field: 'name' }, { field: 'age' }];
405
+ * grid.fitMode = 'stretch';
406
+ * ```
407
+ */
408
+ export interface GridConfig<TRow = any> {
409
+ /** Column definitions. Can also be set via `columns` prop or `<tbw-grid-column>` light DOM. */
410
+ columns?: ColumnConfigMap<TRow>;
411
+ /** Sizing mode for columns. Can also be set via `fitMode` prop. */
412
+ fitMode?: FitMode;
413
+ /** Edit activation mode ('click' | 'dblClick' | false). Set to false to disable editing. Can also be set via `editOn` prop. */
414
+ editOn?: string | boolean;
415
+ /**
416
+ * Row height in pixels for virtualization calculations.
417
+ * The virtualization system assumes uniform row heights for performance.
418
+ *
419
+ * If not specified, the grid measures the first rendered row's height,
420
+ * which respects the CSS variable `--tbw-row-height` set by themes.
421
+ *
422
+ * Set this explicitly when:
423
+ * - Row content may wrap to multiple lines (also set `--tbw-cell-white-space: normal`)
424
+ * - Using custom row templates with variable content
425
+ * - You want to override theme-defined row height
426
+ *
427
+ * @default Auto-measured from first row (respects --tbw-row-height CSS variable)
428
+ *
429
+ * @example
430
+ * ```ts
431
+ * // Fixed height for rows that may wrap to 2 lines
432
+ * gridConfig = { rowHeight: 56 };
433
+ * ```
434
+ */
435
+ rowHeight?: number;
436
+ /**
437
+ * Array of plugin instances.
438
+ * Each plugin is instantiated with its configuration and attached to this grid.
439
+ *
440
+ * @example
441
+ * ```ts
442
+ * plugins: [
443
+ * new SelectionPlugin({ mode: 'range' }),
444
+ * new MultiSortPlugin(),
445
+ * new FilteringPlugin({ debounceMs: 150 }),
446
+ * ]
447
+ * ```
448
+ */
449
+ plugins?: GridPlugin[];
450
+ /**
451
+ * Saved column state to restore on initialization.
452
+ * Includes order, width, visibility, sort, and plugin-contributed state.
453
+ */
454
+ columnState?: GridColumnState;
455
+ /**
456
+ * Shell configuration for header bar and tool panels.
457
+ * When configured, adds an optional wrapper with title, toolbar, and collapsible side panels.
458
+ */
459
+ shell?: ShellConfig;
460
+ /**
461
+ * Grid-wide icon configuration.
462
+ * Provides consistent icons across all plugins (tree, grouping, sorting, etc.).
463
+ * Plugins will use these by default but can override with their own config.
464
+ */
465
+ icons?: GridIcons;
466
+ /**
467
+ * Grid-wide animation configuration.
468
+ * Controls animations for expand/collapse, reordering, and other visual transitions.
469
+ * Individual plugins can override these defaults in their own config.
470
+ */
471
+ animation?: AnimationConfig;
472
+ /**
473
+ * Custom sort handler for full control over sorting behavior.
474
+ *
475
+ * When provided, this handler is called instead of the built-in sorting logic.
476
+ * Enables custom sorting algorithms, server-side sorting, or plugin-specific sorting.
477
+ *
478
+ * The handler receives:
479
+ * - `rows`: Current row array to sort
480
+ * - `sortState`: Sort field and direction (1 = asc, -1 = desc)
481
+ * - `columns`: Column configurations (for accessing sortComparator)
482
+ *
483
+ * Return the sorted array (sync) or a Promise that resolves to the sorted array (async).
484
+ * For server-side sorting, return a Promise that resolves when data is fetched.
485
+ *
486
+ * @example
487
+ * ```ts
488
+ * // Custom stable sort
489
+ * sortHandler: (rows, state, cols) => {
490
+ * return stableSort(rows, (a, b) => compare(a[state.field], b[state.field]) * state.direction);
491
+ * }
492
+ *
493
+ * // Server-side sorting
494
+ * sortHandler: async (rows, state) => {
495
+ * const response = await fetch(`/api/data?sort=${state.field}&dir=${state.direction}`);
496
+ * return response.json();
497
+ * }
498
+ * ```
499
+ */
500
+ sortHandler?: SortHandler<TRow>;
501
+ }
502
+ /**
503
+ * Sort state passed to custom sort handlers.
504
+ */
505
+ export interface SortState {
506
+ /** Field to sort by */
507
+ field: string;
508
+ /** Sort direction: 1 = ascending, -1 = descending */
509
+ direction: 1 | -1;
510
+ }
511
+ /**
512
+ * Custom sort handler function signature.
513
+ *
514
+ * @param rows - Current row array to sort
515
+ * @param sortState - Sort field and direction
516
+ * @param columns - Column configurations (for accessing sortComparator)
517
+ * @returns Sorted array (sync) or Promise resolving to sorted array (async)
518
+ */
519
+ export type SortHandler<TRow = any> = (rows: TRow[], sortState: SortState, columns: ColumnConfig<TRow>[]) => TRow[] | Promise<TRow[]>;
520
+ /**
521
+ * Animation behavior mode.
522
+ * - `true` or `'on'`: Animations always enabled
523
+ * - `false` or `'off'`: Animations always disabled
524
+ * - `'reduced-motion'`: Respects `prefers-reduced-motion` media query (default)
525
+ */
526
+ export type AnimationMode = boolean | 'on' | 'off' | 'reduced-motion';
527
+ /**
528
+ * Animation style for visual transitions.
529
+ * - `'slide'`: Slide/transform animation (e.g., expand down, slide left/right)
530
+ * - `'fade'`: Opacity fade animation
531
+ * - `'flip'`: FLIP technique for position changes (First, Last, Invert, Play)
532
+ * - `false`: No animation for this specific feature
533
+ */
534
+ export type AnimationStyle = 'slide' | 'fade' | 'flip' | false;
535
+ /**
536
+ * Animation style for expand/collapse operations.
537
+ * Subset of AnimationStyle - excludes 'flip' which is for position changes.
538
+ * - `'slide'`: Slide down/up animation for expanding/collapsing content
539
+ * - `'fade'`: Fade in/out animation
540
+ * - `false`: No animation
541
+ */
542
+ export type ExpandCollapseAnimation = 'slide' | 'fade' | false;
543
+ /**
544
+ * Grid-wide animation configuration.
545
+ * Controls global animation behavior - individual plugins define their own animation styles.
546
+ * Duration and easing values set corresponding CSS variables on the grid element.
547
+ */
548
+ export interface AnimationConfig {
549
+ /**
550
+ * Global animation mode.
551
+ * @default 'reduced-motion'
552
+ */
553
+ mode?: AnimationMode;
554
+ /**
555
+ * Default animation duration in milliseconds.
556
+ * Sets `--tbw-animation-duration` CSS variable.
557
+ * @default 200
558
+ */
559
+ duration?: number;
560
+ /**
561
+ * Default easing function.
562
+ * Sets `--tbw-animation-easing` CSS variable.
563
+ * @default 'ease-out'
564
+ */
565
+ easing?: string;
566
+ }
567
+ /** Default animation configuration */
568
+ export declare const DEFAULT_ANIMATION_CONFIG: Required<Omit<AnimationConfig, 'sort'>>;
569
+ /** Icon value - can be a string (text/HTML) or HTMLElement */
570
+ export type IconValue = string | HTMLElement;
571
+ /**
572
+ * Grid-wide icon configuration.
573
+ * All icons are optional - sensible defaults are used when not specified.
574
+ */
575
+ export interface GridIcons {
576
+ /** Expand icon for collapsed items (trees, groups, details). Default: '▶' */
577
+ expand?: IconValue;
578
+ /** Collapse icon for expanded items (trees, groups, details). Default: '▼' */
579
+ collapse?: IconValue;
580
+ /** Sort ascending indicator. Default: '▲' */
581
+ sortAsc?: IconValue;
582
+ /** Sort descending indicator. Default: '▼' */
583
+ sortDesc?: IconValue;
584
+ /** Sort neutral/unsorted indicator. Default: '⇅' */
585
+ sortNone?: IconValue;
586
+ /** Submenu arrow for context menus. Default: '▶' */
587
+ submenuArrow?: IconValue;
588
+ /** Drag handle icon for reordering. Default: '⋮⋮' */
589
+ dragHandle?: IconValue;
590
+ /** Tool panel toggle icon in toolbar. Default: '☰' */
591
+ toolPanel?: IconValue;
592
+ }
593
+ /** Default icons used when not overridden */
594
+ export declare const DEFAULT_GRID_ICONS: Required<GridIcons>;
595
+ /**
596
+ * Shell configuration for the grid's optional header bar and tool panels.
597
+ */
598
+ export interface ShellConfig {
599
+ /** Shell header bar configuration */
600
+ header?: ShellHeaderConfig;
601
+ /** Tool panel configuration */
602
+ toolPanel?: ToolPanelConfig;
603
+ }
604
+ /**
605
+ * Shell header bar configuration
606
+ */
607
+ export interface ShellHeaderConfig {
608
+ /** Grid title displayed on the left (optional) */
609
+ title?: string;
610
+ /** Custom toolbar buttons (rendered before tool panel toggles) */
611
+ toolbarButtons?: ToolbarButtonConfig[];
612
+ }
613
+ /**
614
+ * Tool panel configuration
615
+ */
616
+ export interface ToolPanelConfig {
617
+ /** Panel position: 'left' | 'right' (default: 'right') */
618
+ position?: 'left' | 'right';
619
+ /** Default panel width in pixels (default: 280) */
620
+ width?: number;
621
+ /** Panel ID to open by default on load */
622
+ defaultOpen?: string;
623
+ /** Whether to persist open/closed state (requires Column State Events) */
624
+ persistState?: boolean;
625
+ }
626
+ /**
627
+ * Toolbar button defined via config (programmatic approach).
628
+ * Supports three modes:
629
+ * - Simple: provide `icon` + `action` for grid to create button
630
+ * - Element: provide `element` for user-created DOM
631
+ * - Render: provide `render` function for complex widgets
632
+ */
633
+ export interface ToolbarButtonConfig {
634
+ /** Unique button ID */
635
+ id: string;
636
+ /** Tooltip / aria-label (required for accessibility) */
637
+ label: string;
638
+ /** Order priority (lower = first, default: 100) */
639
+ order?: number;
640
+ /** Whether button is disabled (only applies to grid-rendered buttons) */
641
+ disabled?: boolean;
642
+ /** Button content: SVG string, emoji, or text. Grid creates <button> with this. */
643
+ icon?: string;
644
+ /** Click handler (required when using icon) */
645
+ action?: () => void;
646
+ /**
647
+ * User-provided element. Grid wraps it but doesn't modify it.
648
+ * User is responsible for event handlers.
649
+ */
650
+ element?: HTMLElement;
651
+ /**
652
+ * Render function called once. Receives container, user appends their DOM.
653
+ * User is responsible for event handlers.
654
+ * Return a cleanup function (optional).
655
+ */
656
+ render?: (container: HTMLElement) => void | (() => void);
657
+ }
658
+ /**
659
+ * Toolbar button info returned by getToolbarButtons().
660
+ */
661
+ export interface ToolbarButtonInfo {
662
+ id: string;
663
+ label: string;
664
+ disabled: boolean;
665
+ /** Source of this button: 'config' | 'light-dom' | 'panel-toggle' */
666
+ source: 'config' | 'light-dom' | 'panel-toggle';
667
+ /** For panel toggles, the associated panel ID */
668
+ panelId?: string;
669
+ }
670
+ /**
671
+ * Tool panel definition registered by plugins or consumers.
672
+ */
673
+ export interface ToolPanelDefinition {
674
+ /** Unique panel ID */
675
+ id: string;
676
+ /** Panel title shown in accordion header */
677
+ title: string;
678
+ /** Icon for accordion section header (optional, emoji or SVG) */
679
+ icon?: string;
680
+ /** Tooltip for accordion section header */
681
+ tooltip?: string;
682
+ /** Panel content factory - called when panel section opens */
683
+ render: (container: HTMLElement) => void | (() => void);
684
+ /** Called when panel closes (for cleanup) */
685
+ onClose?: () => void;
686
+ /** Panel order priority (lower = first, default: 100) */
687
+ order?: number;
688
+ }
689
+ /**
690
+ * Header content definition for plugins contributing to shell header center section.
691
+ */
692
+ export interface HeaderContentDefinition {
693
+ /** Unique content ID */
694
+ id: string;
695
+ /** Content factory - called once when shell header renders */
696
+ render: (container: HTMLElement) => void | (() => void);
697
+ /** Called when content is removed (for cleanup) */
698
+ onDestroy?: () => void;
699
+ /** Order priority (lower = first, default: 100) */
700
+ order?: number;
701
+ }
702
+ /**
703
+ * State for a single column. Captures user-driven changes at runtime.
704
+ * Plugins can extend this interface via module augmentation to add their own state.
705
+ *
706
+ * @example
707
+ * ```ts
708
+ * // In filtering plugin
709
+ * declare module '@toolbox-web/grid' {
710
+ * interface ColumnState {
711
+ * filter?: FilterValue;
712
+ * }
713
+ * }
714
+ * ```
715
+ */
716
+ export interface ColumnState {
717
+ /** Column field identifier */
718
+ field: string;
719
+ /** Position index after reordering (0-based) */
720
+ order: number;
721
+ /** Width in pixels (undefined = use default) */
722
+ width?: number;
723
+ /** Visibility state */
724
+ visible: boolean;
725
+ /** Sort state (undefined = not sorted) */
726
+ sort?: ColumnSortState;
727
+ }
728
+ /**
729
+ * Sort state for a column
730
+ */
731
+ export interface ColumnSortState {
732
+ /** Sort direction */
733
+ direction: 'asc' | 'desc';
734
+ /** Priority for multi-sort (0 = primary, 1 = secondary, etc.) */
735
+ priority: number;
736
+ }
737
+ /**
738
+ * Complete grid column state for persistence.
739
+ * Contains state for all columns, including plugin-contributed properties.
740
+ */
741
+ export interface GridColumnState {
742
+ columns: ColumnState[];
743
+ }
744
+ export interface CellCommitDetail<TRow = unknown> {
745
+ /** The mutated row after commit. */
746
+ row: TRow;
747
+ /** Field name whose value changed. */
748
+ field: string;
749
+ /** New value stored. */
750
+ value: unknown;
751
+ /** Index of the row in current data set. */
752
+ rowIndex: number;
753
+ /** All rows that have at least one committed change (snapshot list). */
754
+ changedRows: TRow[];
755
+ /** Indices parallel to changedRows. */
756
+ changedRowIndices: number[];
757
+ /** True if this row just entered the changed set. */
758
+ firstTimeForRow: boolean;
759
+ }
760
+ /** Detail payload for a committed row edit (may or may not include changes). */
761
+ export interface RowCommitDetail<TRow = unknown> {
762
+ /** Row index that lost edit focus. */
763
+ rowIndex: number;
764
+ /** Row object reference. */
765
+ row: TRow;
766
+ /** Whether any cell changes were actually committed in this row during the session. */
767
+ changed: boolean;
768
+ /** Current changed row collection. */
769
+ changedRows: TRow[];
770
+ /** Indices of changed rows. */
771
+ changedRowIndices: number[];
772
+ }
773
+ /** Emitted when the changed rows tracking set is cleared programmatically. */
774
+ export interface ChangedRowsResetDetail<TRow = unknown> {
775
+ /** New (empty) changed rows array after reset. */
776
+ rows: TRow[];
777
+ /** Parallel indices (likely empty). */
778
+ indices: number[];
779
+ }
780
+ /** Detail for a sort change (direction 0 indicates cleared sort). */
781
+ export interface SortChangeDetail {
782
+ /** Sorted field key. */
783
+ field: string;
784
+ /** Direction: 1 ascending, -1 descending, 0 cleared. */
785
+ direction: 1 | -1 | 0;
786
+ }
787
+ /** Column resize event detail containing final pixel width. */
788
+ export interface ColumnResizeDetail {
789
+ /** Resized column field key. */
790
+ field: string;
791
+ /** New width in pixels. */
792
+ width: number;
793
+ }
794
+ /** Fired when keyboard navigation or programmatic focus changes active cell. */
795
+ export interface ActivateCellDetail {
796
+ /** Zero-based row index now focused. */
797
+ row: number;
798
+ /** Zero-based column index now focused. */
799
+ col: number;
800
+ }
801
+ export interface ExternalMountViewDetail<TRow = unknown> {
802
+ placeholder: HTMLElement;
803
+ spec: unknown;
804
+ context: {
805
+ row: TRow;
806
+ value: unknown;
807
+ field: string;
808
+ column: unknown;
809
+ };
810
+ }
811
+ export interface ExternalMountEditorDetail<TRow = unknown> {
812
+ placeholder: HTMLElement;
813
+ spec: unknown;
814
+ context: {
815
+ row: TRow;
816
+ value: unknown;
817
+ field: string;
818
+ column: unknown;
819
+ commit: (v: unknown) => void;
820
+ cancel: () => void;
821
+ };
822
+ }
823
+ export interface DataGridEventMap<TRow = unknown> {
824
+ 'cell-commit': CellCommitDetail<TRow>;
825
+ 'row-commit': RowCommitDetail<TRow>;
826
+ 'changed-rows-reset': ChangedRowsResetDetail<TRow>;
827
+ 'mount-external-view': ExternalMountViewDetail<TRow>;
828
+ 'mount-external-editor': ExternalMountEditorDetail<TRow>;
829
+ 'sort-change': SortChangeDetail;
830
+ 'column-resize': ColumnResizeDetail;
831
+ 'activate-cell': ActivateCellDetail;
832
+ 'column-state-change': GridColumnState;
833
+ }
834
+ export type DataGridEventDetail<K extends keyof DataGridEventMap<unknown>, TRow = unknown> = DataGridEventMap<TRow>[K];
835
+ export type DataGridCustomEvent<K extends keyof DataGridEventMap<unknown>, TRow = unknown> = CustomEvent<DataGridEventMap<TRow>[K]>;
836
+ export type EditorContext<T = unknown> = ColumnEditorContext<T, unknown>;
837
+ export interface EvalContext {
838
+ value: unknown;
839
+ row: Record<string, unknown> | null;
840
+ }
841
+ //# sourceMappingURL=types.d.ts.map