@toolbox-web/grid 0.2.2 → 0.2.3

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 (36) hide show
  1. package/README.md +46 -0
  2. package/all.d.ts +327 -178
  3. package/all.js +328 -287
  4. package/all.js.map +1 -1
  5. package/index.d.ts +219 -113
  6. package/index.js +1182 -1108
  7. package/index.js.map +1 -1
  8. package/lib/plugins/clipboard/index.js.map +1 -1
  9. package/lib/plugins/column-virtualization/index.js.map +1 -1
  10. package/lib/plugins/context-menu/index.js.map +1 -1
  11. package/lib/plugins/export/index.js.map +1 -1
  12. package/lib/plugins/filtering/index.js.map +1 -1
  13. package/lib/plugins/grouping-columns/index.js.map +1 -1
  14. package/lib/plugins/grouping-rows/index.js.map +1 -1
  15. package/lib/plugins/master-detail/index.js.map +1 -1
  16. package/lib/plugins/multi-sort/index.js.map +1 -1
  17. package/lib/plugins/pinned-columns/index.js +91 -48
  18. package/lib/plugins/pinned-columns/index.js.map +1 -1
  19. package/lib/plugins/pinned-rows/index.js.map +1 -1
  20. package/lib/plugins/pivot/index.js.map +1 -1
  21. package/lib/plugins/reorder/index.js +38 -35
  22. package/lib/plugins/reorder/index.js.map +1 -1
  23. package/lib/plugins/selection/index.js.map +1 -1
  24. package/lib/plugins/server-side/index.js.map +1 -1
  25. package/lib/plugins/tree/index.js.map +1 -1
  26. package/lib/plugins/undo-redo/index.js.map +1 -1
  27. package/lib/plugins/visibility/index.js.map +1 -1
  28. package/package.json +1 -1
  29. package/umd/grid.all.umd.js +19 -19
  30. package/umd/grid.all.umd.js.map +1 -1
  31. package/umd/grid.umd.js +16 -16
  32. package/umd/grid.umd.js.map +1 -1
  33. package/umd/plugins/pinned-columns.umd.js +1 -1
  34. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  35. package/umd/plugins/reorder.umd.js +1 -1
  36. package/umd/plugins/reorder.umd.js.map +1 -1
package/all.d.ts CHANGED
@@ -65,7 +65,7 @@ declare type AggregatorMap = Record<string, AggregatorRef_2>;
65
65
  /** Map of field names to aggregator references */
66
66
  declare type AggregatorMap_2 = Record<string, AggregatorRef_2_2>;
67
67
 
68
- export declare type AggregatorRef = string | ((rows: any[], field: string, column?: any) => any);
68
+ export declare type AggregatorRef = string | ((rows: unknown[], field: string, column?: unknown) => unknown);
69
69
 
70
70
  declare type AggregatorRef_2 = string | AggregatorFn_2;
71
71
 
@@ -133,17 +133,17 @@ export declare interface BaseColumnConfig<TRow = any, TValue = any> {
133
133
  /** For select/typeahead types - available options */
134
134
  options?: Array<{
135
135
  label: string;
136
- value: any;
136
+ value: unknown;
137
137
  }> | (() => Array<{
138
138
  label: string;
139
- value: any;
139
+ value: unknown;
140
140
  }>);
141
141
  /** For select/typeahead - allow multi select */
142
142
  multi?: boolean;
143
143
  /** Optional formatter */
144
144
  format?: (value: TValue, row: TRow) => string;
145
145
  /** Arbitrary extra metadata */
146
- meta?: Record<string, any>;
146
+ meta?: Record<string, unknown>;
147
147
  }
148
148
 
149
149
  /**
@@ -151,7 +151,7 @@ export declare interface BaseColumnConfig<TRow = any, TValue = any> {
151
151
  *
152
152
  * @template TConfig - Configuration type for the plugin
153
153
  */
154
- export declare abstract class BaseGridPlugin<TConfig = unknown> {
154
+ export declare abstract class BaseGridPlugin<TConfig = unknown> implements GridPlugin {
155
155
  /** Unique plugin identifier (derived from class name by default) */
156
156
  abstract readonly name: string;
157
157
  /** Plugin version - override in subclass if needed */
@@ -447,6 +447,33 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> {
447
447
  * ```
448
448
  */
449
449
  renderRow?(row: any, rowEl: HTMLElement, rowIndex: number): boolean | void;
450
+ /**
451
+ * Handle queries from other plugins.
452
+ * This is the generic mechanism for inter-plugin communication.
453
+ * Plugins can respond to well-known query types or define their own.
454
+ *
455
+ * @param query - The query object with type and context
456
+ * @returns Query-specific response, or undefined if not handling this query
457
+ *
458
+ * @example
459
+ * ```ts
460
+ * onPluginQuery(query: PluginQuery): unknown {
461
+ * switch (query.type) {
462
+ * case PLUGIN_QUERIES.CAN_MOVE_COLUMN:
463
+ * // Prevent moving pinned columns
464
+ * const column = query.context as ColumnConfig;
465
+ * if (column.sticky === 'left' || column.sticky === 'right') {
466
+ * return false;
467
+ * }
468
+ * break;
469
+ * case PLUGIN_QUERIES.GET_CONTEXT_MENU_ITEMS:
470
+ * const params = query.context as ContextMenuParams;
471
+ * return [{ id: 'my-action', label: 'My Action', action: () => {} }];
472
+ * }
473
+ * }
474
+ * ```
475
+ */
476
+ onPluginQuery?(query: PluginQuery): unknown;
450
477
  /**
451
478
  * Handle keyboard events on the grid.
452
479
  * Called when a key is pressed while the grid or a cell has focus.
@@ -590,29 +617,6 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> {
590
617
  * ```
591
618
  */
592
619
  onCellMouseUp?(event: CellMouseEvent): boolean | void;
593
- /**
594
- * Provide context menu items when right-clicking on the grid.
595
- * Multiple plugins can contribute items; they are merged into a single menu.
596
- *
597
- * @param params - Context about where the menu was triggered (row, column, etc.)
598
- * @returns Array of menu items to display
599
- *
600
- * @example
601
- * ```ts
602
- * getContextMenuItems(params: ContextMenuParams): ContextMenuItem[] {
603
- * if (params.isHeader) {
604
- * return [
605
- * { id: 'sort-asc', label: 'Sort Ascending', action: () => this.sortAsc(params.field) },
606
- * { id: 'sort-desc', label: 'Sort Descending', action: () => this.sortDesc(params.field) },
607
- * ];
608
- * }
609
- * return [
610
- * { id: 'copy', label: 'Copy Cell', action: () => this.copyCell(params) },
611
- * ];
612
- * }
613
- * ```
614
- */
615
- getContextMenuItems?(params: ContextMenuParams): ContextMenuItem[];
616
620
  /**
617
621
  * Contribute plugin-specific state for a column.
618
622
  * Called by the grid when collecting column state for serialization.
@@ -655,6 +659,34 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> {
655
659
  * ```
656
660
  */
657
661
  applyColumnState?(field: string, state: ColumnState): void;
662
+ /**
663
+ * Report horizontal scroll boundary offsets for this plugin.
664
+ * Plugins that obscure part of the scroll area (e.g., pinned/sticky columns)
665
+ * should return how much space they occupy on each side.
666
+ * The keyboard navigation uses this to ensure focused cells are fully visible.
667
+ *
668
+ * @param rowEl - The row element (optional, for calculating widths from rendered cells)
669
+ * @param focusedCell - The currently focused cell element (optional, to determine if scrolling should be skipped)
670
+ * @returns Object with left/right pixel offsets and optional skipScroll flag, or undefined if plugin has no offsets
671
+ *
672
+ * @example
673
+ * ```ts
674
+ * getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): { left: number; right: number; skipScroll?: boolean } | undefined {
675
+ * // Calculate total width of left-pinned columns
676
+ * const leftCells = rowEl?.querySelectorAll('.sticky-left') ?? [];
677
+ * let left = 0;
678
+ * leftCells.forEach(el => { left += (el as HTMLElement).offsetWidth; });
679
+ * // Skip scroll if focused cell is pinned (always visible)
680
+ * const skipScroll = focusedCell?.classList.contains('sticky-left');
681
+ * return { left, right: 0, skipScroll };
682
+ * }
683
+ * ```
684
+ */
685
+ getHorizontalScrollOffsets?(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
686
+ left: number;
687
+ right: number;
688
+ skipScroll?: boolean;
689
+ } | undefined;
658
690
  /**
659
691
  * Register a tool panel for this plugin.
660
692
  * Return undefined if plugin has no tool panel.
@@ -714,7 +746,7 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> {
714
746
  *
715
747
  * @template TConfig - Configuration type for the plugin
716
748
  */
717
- declare abstract class BaseGridPlugin_2<TConfig = unknown> {
749
+ declare abstract class BaseGridPlugin_2<TConfig = unknown> implements GridPlugin_2 {
718
750
  /** Unique plugin identifier (derived from class name by default) */
719
751
  abstract readonly name: string;
720
752
  /** Plugin version - override in subclass if needed */
@@ -1010,6 +1042,33 @@ declare abstract class BaseGridPlugin_2<TConfig = unknown> {
1010
1042
  * ```
1011
1043
  */
1012
1044
  renderRow?(row: any, rowEl: HTMLElement, rowIndex: number): boolean | void;
1045
+ /**
1046
+ * Handle queries from other plugins.
1047
+ * This is the generic mechanism for inter-plugin communication.
1048
+ * Plugins can respond to well-known query types or define their own.
1049
+ *
1050
+ * @param query - The query object with type and context
1051
+ * @returns Query-specific response, or undefined if not handling this query
1052
+ *
1053
+ * @example
1054
+ * ```ts
1055
+ * onPluginQuery(query: PluginQuery): unknown {
1056
+ * switch (query.type) {
1057
+ * case PLUGIN_QUERIES.CAN_MOVE_COLUMN:
1058
+ * // Prevent moving pinned columns
1059
+ * const column = query.context as ColumnConfig;
1060
+ * if (column.sticky === 'left' || column.sticky === 'right') {
1061
+ * return false;
1062
+ * }
1063
+ * break;
1064
+ * case PLUGIN_QUERIES.GET_CONTEXT_MENU_ITEMS:
1065
+ * const params = query.context as ContextMenuParams;
1066
+ * return [{ id: 'my-action', label: 'My Action', action: () => {} }];
1067
+ * }
1068
+ * }
1069
+ * ```
1070
+ */
1071
+ onPluginQuery?(query: PluginQuery_2): unknown;
1013
1072
  /**
1014
1073
  * Handle keyboard events on the grid.
1015
1074
  * Called when a key is pressed while the grid or a cell has focus.
@@ -1153,29 +1212,6 @@ declare abstract class BaseGridPlugin_2<TConfig = unknown> {
1153
1212
  * ```
1154
1213
  */
1155
1214
  onCellMouseUp?(event: CellMouseEvent_2): boolean | void;
1156
- /**
1157
- * Provide context menu items when right-clicking on the grid.
1158
- * Multiple plugins can contribute items; they are merged into a single menu.
1159
- *
1160
- * @param params - Context about where the menu was triggered (row, column, etc.)
1161
- * @returns Array of menu items to display
1162
- *
1163
- * @example
1164
- * ```ts
1165
- * getContextMenuItems(params: ContextMenuParams): ContextMenuItem[] {
1166
- * if (params.isHeader) {
1167
- * return [
1168
- * { id: 'sort-asc', label: 'Sort Ascending', action: () => this.sortAsc(params.field) },
1169
- * { id: 'sort-desc', label: 'Sort Descending', action: () => this.sortDesc(params.field) },
1170
- * ];
1171
- * }
1172
- * return [
1173
- * { id: 'copy', label: 'Copy Cell', action: () => this.copyCell(params) },
1174
- * ];
1175
- * }
1176
- * ```
1177
- */
1178
- getContextMenuItems?(params: ContextMenuParams_2): ContextMenuItem_2[];
1179
1215
  /**
1180
1216
  * Contribute plugin-specific state for a column.
1181
1217
  * Called by the grid when collecting column state for serialization.
@@ -1218,6 +1254,34 @@ declare abstract class BaseGridPlugin_2<TConfig = unknown> {
1218
1254
  * ```
1219
1255
  */
1220
1256
  applyColumnState?(field: string, state: ColumnState_2): void;
1257
+ /**
1258
+ * Report horizontal scroll boundary offsets for this plugin.
1259
+ * Plugins that obscure part of the scroll area (e.g., pinned/sticky columns)
1260
+ * should return how much space they occupy on each side.
1261
+ * The keyboard navigation uses this to ensure focused cells are fully visible.
1262
+ *
1263
+ * @param rowEl - The row element (optional, for calculating widths from rendered cells)
1264
+ * @param focusedCell - The currently focused cell element (optional, to determine if scrolling should be skipped)
1265
+ * @returns Object with left/right pixel offsets and optional skipScroll flag, or undefined if plugin has no offsets
1266
+ *
1267
+ * @example
1268
+ * ```ts
1269
+ * getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): { left: number; right: number; skipScroll?: boolean } | undefined {
1270
+ * // Calculate total width of left-pinned columns
1271
+ * const leftCells = rowEl?.querySelectorAll('.sticky-left') ?? [];
1272
+ * let left = 0;
1273
+ * leftCells.forEach(el => { left += (el as HTMLElement).offsetWidth; });
1274
+ * // Skip scroll if focused cell is pinned (always visible)
1275
+ * const skipScroll = focusedCell?.classList.contains('sticky-left');
1276
+ * return { left, right: 0, skipScroll };
1277
+ * }
1278
+ * ```
1279
+ */
1280
+ getHorizontalScrollOffsets?(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
1281
+ left: number;
1282
+ right: number;
1283
+ skipScroll?: boolean;
1284
+ } | undefined;
1221
1285
  /**
1222
1286
  * Register a tool panel for this plugin.
1223
1287
  * Return undefined if plugin has no tool panel.
@@ -1298,13 +1362,13 @@ declare interface CellClickEvent_2 {
1298
1362
  originalEvent: MouseEvent;
1299
1363
  }
1300
1364
 
1301
- export declare interface CellCommitDetail<TRow = any> {
1365
+ export declare interface CellCommitDetail<TRow = unknown> {
1302
1366
  /** The mutated row after commit. */
1303
1367
  row: TRow;
1304
1368
  /** Field name whose value changed. */
1305
1369
  field: string;
1306
1370
  /** New value stored. */
1307
- value: any;
1371
+ value: unknown;
1308
1372
  /** Index of the row in current data set. */
1309
1373
  rowIndex: number;
1310
1374
  /** All rows that have at least one committed change (snapshot list). */
@@ -1320,7 +1384,7 @@ export declare interface CellCommitDetail<TRow = any> {
1320
1384
  */
1321
1385
  declare interface CellContext<T = any> {
1322
1386
  row: T;
1323
- value: any;
1387
+ value: unknown;
1324
1388
  field: string;
1325
1389
  column: ColumnInternal<T>;
1326
1390
  }
@@ -1486,7 +1550,7 @@ export declare type CellRenderer = (ctx: PluginCellRenderContext) => string | HT
1486
1550
  declare type CellRenderer_2 = (ctx: PluginCellRenderContext_2) => string | HTMLElement;
1487
1551
 
1488
1552
  /** Emitted when the changed rows tracking set is cleared programmatically. */
1489
- export declare interface ChangedRowsResetDetail<TRow = any> {
1553
+ export declare interface ChangedRowsResetDetail<TRow = unknown> {
1490
1554
  /** New (empty) changed rows array after reset. */
1491
1555
  rows: TRow[];
1492
1556
  /** Parallel indices (likely empty). */
@@ -1563,12 +1627,12 @@ export declare interface ColumnConfig<TRow = any> extends BaseColumnConfig<TRow,
1563
1627
  viewRenderer?: ColumnViewRenderer<TRow, any>;
1564
1628
  /** External view spec (lets host app mount any framework component) */
1565
1629
  externalView?: {
1566
- component: any;
1567
- props?: Record<string, any>;
1630
+ component: unknown;
1631
+ props?: Record<string, unknown>;
1568
1632
  mount?: (options: {
1569
1633
  placeholder: HTMLElement;
1570
- context: CellRenderContext<TRow, any>;
1571
- spec: any;
1634
+ context: CellRenderContext<TRow, unknown>;
1635
+ spec: unknown;
1572
1636
  }) => void | {
1573
1637
  dispose?: () => void;
1574
1638
  };
@@ -1587,12 +1651,12 @@ declare interface ColumnConfig_2<TRow = any> extends BaseColumnConfig<TRow, any>
1587
1651
  viewRenderer?: ColumnViewRenderer_2<TRow, any>;
1588
1652
  /** External view spec (lets host app mount any framework component) */
1589
1653
  externalView?: {
1590
- component: any;
1591
- props?: Record<string, any>;
1654
+ component: unknown;
1655
+ props?: Record<string, unknown>;
1592
1656
  mount?: (options: {
1593
1657
  placeholder: HTMLElement;
1594
- context: CellRenderContext_2<TRow, any>;
1595
- spec: any;
1658
+ context: CellRenderContext_2<TRow, unknown>;
1659
+ spec: unknown;
1596
1660
  }) => void | {
1597
1661
  dispose?: () => void;
1598
1662
  };
@@ -1624,16 +1688,16 @@ export declare interface ColumnEditorContext<TRow = any, TValue = any> {
1624
1688
  }
1625
1689
 
1626
1690
  /** External editor spec: tag name, factory function, or external mount spec */
1627
- export declare type ColumnEditorSpec<TRow = any, TValue = any> = string | ((context: ColumnEditorContext<TRow, TValue>) => HTMLElement | string) | {
1691
+ export declare type ColumnEditorSpec<TRow = unknown, TValue = unknown> = string | ((context: ColumnEditorContext<TRow, TValue>) => HTMLElement | string) | {
1628
1692
  /** Arbitrary component reference (class, function, token) */
1629
- component: any;
1693
+ component: unknown;
1630
1694
  /** Optional static props passed to mount */
1631
- props?: Record<string, any>;
1695
+ props?: Record<string, unknown>;
1632
1696
  /** Optional custom mount function; if provided we call it directly instead of emitting an event */
1633
1697
  mount?: (options: {
1634
1698
  placeholder: HTMLElement;
1635
1699
  context: ColumnEditorContext<TRow, TValue>;
1636
- spec: any;
1700
+ spec: unknown;
1637
1701
  }) => void | {
1638
1702
  dispose?: () => void;
1639
1703
  };
@@ -1744,9 +1808,9 @@ declare interface ColumnState {
1744
1808
  sort?: ColumnSortState_2;
1745
1809
  }
1746
1810
 
1747
- export declare type ColumnViewRenderer<TRow = any, TValue = any> = (ctx: CellRenderContext<TRow, TValue>) => Node | string | void;
1811
+ export declare type ColumnViewRenderer<TRow = unknown, TValue = unknown> = (ctx: CellRenderContext<TRow, TValue>) => Node | string | void;
1748
1812
 
1749
- declare type ColumnViewRenderer_2<TRow = any, TValue = any> = (ctx: CellRenderContext_2<TRow, TValue>) => Node | string | void;
1813
+ declare type ColumnViewRenderer_2<TRow = unknown, TValue = unknown> = (ctx: CellRenderContext_2<TRow, TValue>) => Node | string | void;
1750
1814
 
1751
1815
  /**
1752
1816
  * Column Virtualization Plugin Types
@@ -1819,11 +1883,11 @@ export declare class ColumnVirtualizationPlugin extends BaseGridPlugin_2<ColumnV
1819
1883
  */
1820
1884
  declare interface ContextMenuConfig {
1821
1885
  /** Menu items - static array or function returning items */
1822
- items?: ContextMenuItem_3[] | ((params: ContextMenuParams_3) => ContextMenuItem_3[]);
1886
+ items?: ContextMenuItem_2[] | ((params: ContextMenuParams_2) => ContextMenuItem_2[]);
1823
1887
  }
1824
1888
 
1825
1889
  /**
1826
- * Context menu item
1890
+ * Context menu item (used by context-menu plugin query)
1827
1891
  */
1828
1892
  export declare interface ContextMenuItem {
1829
1893
  id: string;
@@ -1835,19 +1899,6 @@ export declare interface ContextMenuItem {
1835
1899
  action?: (params: ContextMenuParams) => void;
1836
1900
  }
1837
1901
 
1838
- /**
1839
- * Context menu item
1840
- */
1841
- declare interface ContextMenuItem_2 {
1842
- id: string;
1843
- label: string;
1844
- icon?: string;
1845
- disabled?: boolean;
1846
- separator?: boolean;
1847
- children?: ContextMenuItem_2[];
1848
- action?: (params: ContextMenuParams_2) => void;
1849
- }
1850
-
1851
1902
  /**
1852
1903
  * Context Menu Plugin Types
1853
1904
  *
@@ -1857,7 +1908,7 @@ declare interface ContextMenuItem_2 {
1857
1908
  * Context menu item definition.
1858
1909
  * Supports icons, shortcuts, submenus, separators, and dynamic disabled/hidden states.
1859
1910
  */
1860
- declare interface ContextMenuItem_3 {
1911
+ declare interface ContextMenuItem_2 {
1861
1912
  /** Unique identifier for the menu item */
1862
1913
  id: string;
1863
1914
  /** Display label for the menu item */
@@ -1867,13 +1918,13 @@ declare interface ContextMenuItem_3 {
1867
1918
  /** Optional keyboard shortcut hint (display only) */
1868
1919
  shortcut?: string;
1869
1920
  /** Whether the item is disabled (static or dynamic) */
1870
- disabled?: boolean | ((params: ContextMenuParams_3) => boolean);
1921
+ disabled?: boolean | ((params: ContextMenuParams_2) => boolean);
1871
1922
  /** Whether the item is hidden (static or dynamic) */
1872
- hidden?: boolean | ((params: ContextMenuParams_3) => boolean);
1923
+ hidden?: boolean | ((params: ContextMenuParams_2) => boolean);
1873
1924
  /** Action handler when the item is clicked */
1874
- action?: (params: ContextMenuParams_3) => void;
1925
+ action?: (params: ContextMenuParams_2) => void;
1875
1926
  /** Nested submenu items */
1876
- subMenu?: ContextMenuItem_3[];
1927
+ subMenu?: ContextMenuItem_2[];
1877
1928
  /** Whether this is a separator (id and name required but ignored) */
1878
1929
  separator?: boolean;
1879
1930
  /** Optional CSS class to add to the menu item */
@@ -1895,26 +1946,11 @@ export declare interface ContextMenuParams {
1895
1946
  isHeader?: boolean;
1896
1947
  }
1897
1948
 
1898
- /**
1899
- * Context menu parameters
1900
- */
1901
- declare interface ContextMenuParams_2 {
1902
- x: number;
1903
- y: number;
1904
- rowIndex?: number;
1905
- colIndex?: number;
1906
- field?: string;
1907
- value?: any;
1908
- row?: any;
1909
- column?: ColumnConfig_2;
1910
- isHeader?: boolean;
1911
- }
1912
-
1913
1949
  /**
1914
1950
  * Parameters passed to context menu callbacks.
1915
1951
  * Provides context about what element triggered the menu.
1916
1952
  */
1917
- declare interface ContextMenuParams_3 {
1953
+ declare interface ContextMenuParams_2 {
1918
1954
  /** The row data object (null for header clicks) */
1919
1955
  row: unknown;
1920
1956
  /** The row index (-1 for header clicks) */
@@ -1971,7 +2007,7 @@ export declare class ContextMenuPlugin extends BaseGridPlugin_2<ContextMenuConfi
1971
2007
  * @param y - Y coordinate
1972
2008
  * @param params - Partial context menu parameters
1973
2009
  */
1974
- showMenu(x: number, y: number, params: Partial<ContextMenuParams_3>): void;
2010
+ showMenu(x: number, y: number, params: Partial<ContextMenuParams_2>): void;
1975
2011
  /**
1976
2012
  * Hide the context menu.
1977
2013
  */
@@ -1983,7 +2019,7 @@ export declare class ContextMenuPlugin extends BaseGridPlugin_2<ContextMenuConfi
1983
2019
  isMenuOpen(): boolean;
1984
2020
  }
1985
2021
 
1986
- export declare type DataGridCustomEvent<K extends keyof DataGridEventMap<any>, TRow = any> = CustomEvent<DataGridEventMap<TRow>[K]>;
2022
+ export declare type DataGridCustomEvent<K extends keyof DataGridEventMap<unknown>, TRow = unknown> = CustomEvent<DataGridEventMap<TRow>[K]>;
1987
2023
 
1988
2024
  export declare class DataGridElement<T = any> extends HTMLElement implements InternalGrid<T> {
1989
2025
  #private;
@@ -2067,7 +2103,6 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
2067
2103
  emitSortChange(detail: SortChangeDetail): void;
2068
2104
  emitColumnResize(detail: ColumnResizeDetail): void;
2069
2105
  emitActivateCell(detail: ActivateCellDetail): void;
2070
- updateTemplate(): void;
2071
2106
  findHeaderRow(): HTMLElement;
2072
2107
  findRenderedRowElement(rowIndex: number): HTMLElement | null;
2073
2108
  /**
@@ -2085,6 +2120,26 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
2085
2120
  * Returns true if any plugin handled the event.
2086
2121
  */
2087
2122
  dispatchKeyDown(event: KeyboardEvent): boolean;
2123
+ /**
2124
+ * Get horizontal scroll boundary offsets from plugins.
2125
+ * Used by keyboard navigation to ensure focused cells are fully visible
2126
+ * when plugins like pinned columns obscure part of the scroll area.
2127
+ */
2128
+ getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
2129
+ left: number;
2130
+ right: number;
2131
+ skipScroll?: boolean;
2132
+ };
2133
+ /**
2134
+ * Query all plugins with a generic query and collect responses.
2135
+ * This enables inter-plugin communication without the core knowing plugin-specific concepts.
2136
+ *
2137
+ * @example
2138
+ * // Check if any plugin vetoes moving a column
2139
+ * const responses = grid.queryPlugins<boolean>({ type: PLUGIN_QUERIES.CAN_MOVE_COLUMN, context: column });
2140
+ * const canMove = !responses.includes(false);
2141
+ */
2142
+ queryPlugins<T>(query: PluginQuery): T[];
2088
2143
  get changedRows(): T[];
2089
2144
  get changedRowIndices(): number[];
2090
2145
  resetChangedRows(silent?: boolean): Promise<void>;
@@ -2166,76 +2221,42 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
2166
2221
  * Clears all user modifications (order, width, visibility, sort).
2167
2222
  */
2168
2223
  resetColumnState(): void;
2169
- /**
2170
- * Check if the tool panel is currently open.
2171
- */
2224
+ /** Check if the tool panel is currently open. */
2172
2225
  get isToolPanelOpen(): boolean;
2173
2226
  /**
2174
2227
  * Get the currently active tool panel ID, or null if none is open.
2175
2228
  * @deprecated Use isToolPanelOpen and expandedToolPanelSections instead.
2176
2229
  */
2177
2230
  get activeToolPanel(): string | null;
2178
- /**
2179
- * Get the IDs of expanded accordion sections.
2180
- */
2231
+ /** Get the IDs of expanded accordion sections. */
2181
2232
  get expandedToolPanelSections(): string[];
2182
- /**
2183
- * Open the tool panel (accordion view with all registered panels).
2184
- */
2233
+ /** Open the tool panel (accordion view with all registered panels). */
2185
2234
  openToolPanel(): void;
2186
- /**
2187
- * Close the tool panel.
2188
- */
2235
+ /** Close the tool panel. */
2189
2236
  closeToolPanel(): void;
2190
- /**
2191
- * Toggle the tool panel open/closed.
2192
- */
2237
+ /** Toggle the tool panel open/closed. */
2193
2238
  toggleToolPanel(): void;
2194
- /**
2195
- * Toggle an accordion section expanded/collapsed.
2196
- * Only one section can be expanded at a time (exclusive accordion).
2197
- * When there's only one panel, toggling is disabled (always expanded).
2198
- */
2239
+ /** Toggle an accordion section expanded/collapsed. */
2199
2240
  toggleToolPanelSection(sectionId: string): void;
2200
- /**
2201
- * Get registered tool panel definitions.
2202
- */
2241
+ /** Get registered tool panel definitions. */
2203
2242
  getToolPanels(): ToolPanelDefinition[];
2204
- /**
2205
- * Register a custom tool panel (without creating a plugin).
2206
- */
2243
+ /** Register a custom tool panel (without creating a plugin). */
2207
2244
  registerToolPanel(panel: ToolPanelDefinition): void;
2208
- /**
2209
- * Unregister a custom tool panel.
2210
- */
2245
+ /** Unregister a custom tool panel. */
2211
2246
  unregisterToolPanel(panelId: string): void;
2212
- /**
2213
- * Get registered header content definitions.
2214
- */
2247
+ /** Get registered header content definitions. */
2215
2248
  getHeaderContents(): HeaderContentDefinition[];
2216
- /**
2217
- * Register custom header content (without creating a plugin).
2218
- */
2249
+ /** Register custom header content (without creating a plugin). */
2219
2250
  registerHeaderContent(content: HeaderContentDefinition): void;
2220
- /**
2221
- * Unregister custom header content.
2222
- */
2251
+ /** Unregister custom header content. */
2223
2252
  unregisterHeaderContent(contentId: string): void;
2224
- /**
2225
- * Get all registered toolbar buttons.
2226
- */
2253
+ /** Get all registered toolbar buttons. */
2227
2254
  getToolbarButtons(): ToolbarButtonInfo[];
2228
- /**
2229
- * Register a custom toolbar button programmatically.
2230
- */
2255
+ /** Register a custom toolbar button programmatically. */
2231
2256
  registerToolbarButton(button: ToolbarButtonConfig): void;
2232
- /**
2233
- * Unregister a custom toolbar button.
2234
- */
2257
+ /** Unregister a custom toolbar button. */
2235
2258
  unregisterToolbarButton(buttonId: string): void;
2236
- /**
2237
- * Enable/disable a toolbar button by ID.
2238
- */
2259
+ /** Enable/disable a toolbar button by ID. */
2239
2260
  setToolbarButtonDisabled(buttonId: string, disabled: boolean): void;
2240
2261
  /**
2241
2262
  * Re-parse light DOM shell elements and refresh shell header.
@@ -2255,7 +2276,7 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
2255
2276
  export declare interface DataGridElementInterface extends PublicGrid, HTMLElement {
2256
2277
  }
2257
2278
 
2258
- export declare interface DataGridEventMap<TRow = any> {
2279
+ export declare interface DataGridEventMap<TRow = unknown> {
2259
2280
  'cell-commit': CellCommitDetail<TRow>;
2260
2281
  'row-commit': RowCommitDetail<TRow>;
2261
2282
  'changed-rows-reset': ChangedRowsResetDetail<TRow>;
@@ -2331,7 +2352,7 @@ declare interface EditAction_2 {
2331
2352
  * Internal editor execution context extending the generic cell context with commit helpers.
2332
2353
  */
2333
2354
  declare interface EditorExecContext<T = any> extends CellContext<T> {
2334
- commit: (newValue: any) => void;
2355
+ commit: (newValue: unknown) => void;
2335
2356
  cancel: () => void;
2336
2357
  }
2337
2358
 
@@ -2450,27 +2471,27 @@ export declare class ExportPlugin extends BaseGridPlugin_2<ExportConfig> {
2450
2471
  } | null;
2451
2472
  }
2452
2473
 
2453
- export declare interface ExternalMountEditorDetail<TRow = any> {
2474
+ export declare interface ExternalMountEditorDetail<TRow = unknown> {
2454
2475
  placeholder: HTMLElement;
2455
- spec: any;
2476
+ spec: unknown;
2456
2477
  context: {
2457
2478
  row: TRow;
2458
- value: any;
2479
+ value: unknown;
2459
2480
  field: string;
2460
- column: any;
2461
- commit: (v: any) => void;
2481
+ column: unknown;
2482
+ commit: (v: unknown) => void;
2462
2483
  cancel: () => void;
2463
2484
  };
2464
2485
  }
2465
2486
 
2466
- export declare interface ExternalMountViewDetail<TRow = any> {
2487
+ export declare interface ExternalMountViewDetail<TRow = unknown> {
2467
2488
  placeholder: HTMLElement;
2468
- spec: any;
2489
+ spec: unknown;
2469
2490
  context: {
2470
2491
  row: TRow;
2471
- value: any;
2492
+ value: unknown;
2472
2493
  field: string;
2473
- column: any;
2494
+ column: unknown;
2474
2495
  };
2475
2496
  }
2476
2497
 
@@ -2774,6 +2795,10 @@ export declare function getValueAggregator(aggFunc: string): ValueAggregatorFn;
2774
2795
  /**
2775
2796
  * CSS class names used in the grid's shadow DOM.
2776
2797
  * Use these when adding/removing classes or querying elements.
2798
+ *
2799
+ * Classes are organized by:
2800
+ * - Core: Used by the grid core for structure and basic functionality
2801
+ * - Shared: Used by multiple features/plugins, styled by core CSS
2777
2802
  */
2778
2803
  export declare const GridClasses: {
2779
2804
  readonly ROOT: "tbw-grid-root";
@@ -2859,6 +2884,27 @@ export declare interface GridConfig<TRow = any> {
2859
2884
  fitMode?: FitMode;
2860
2885
  /** Edit activation mode ('click' | 'dblclick'). Can also be set via `editOn` prop. */
2861
2886
  editOn?: string;
2887
+ /**
2888
+ * Row height in pixels for virtualization calculations.
2889
+ * The virtualization system assumes uniform row heights for performance.
2890
+ *
2891
+ * If not specified, the grid measures the first rendered row's height,
2892
+ * which respects the CSS variable `--tbw-row-height` set by themes.
2893
+ *
2894
+ * Set this explicitly when:
2895
+ * - Row content may wrap to multiple lines (also set `--tbw-cell-white-space: normal`)
2896
+ * - Using custom row templates with variable content
2897
+ * - You want to override theme-defined row height
2898
+ *
2899
+ * @default Auto-measured from first row (respects --tbw-row-height CSS variable)
2900
+ *
2901
+ * @example
2902
+ * ```ts
2903
+ * // Fixed height for rows that may wrap to 2 lines
2904
+ * gridConfig = { rowHeight: 56 };
2905
+ * ```
2906
+ */
2907
+ rowHeight?: number;
2862
2908
  /**
2863
2909
  * Array of plugin instances.
2864
2910
  * Each plugin is instantiated with its configuration and attached to this grid.
@@ -2872,7 +2918,7 @@ export declare interface GridConfig<TRow = any> {
2872
2918
  * ]
2873
2919
  * ```
2874
2920
  */
2875
- plugins?: any[];
2921
+ plugins?: GridPlugin[];
2876
2922
  /**
2877
2923
  * Saved column state to restore on initialization.
2878
2924
  * Includes order, width, visibility, sort, and plugin-contributed state.
@@ -3016,6 +3062,34 @@ declare interface GridIcons_2 {
3016
3062
  toolPanel?: IconValue_2;
3017
3063
  }
3018
3064
 
3065
+ /**
3066
+ * Minimal plugin interface for type-checking.
3067
+ * This interface is defined here to avoid circular imports with BaseGridPlugin.
3068
+ * All plugins must satisfy this shape (BaseGridPlugin implements it).
3069
+ */
3070
+ export declare interface GridPlugin {
3071
+ /** Unique plugin identifier */
3072
+ readonly name: string;
3073
+ /** Plugin version */
3074
+ readonly version: string;
3075
+ /** CSS styles to inject into grid's shadow DOM */
3076
+ readonly styles?: string;
3077
+ }
3078
+
3079
+ /**
3080
+ * Minimal plugin interface for type-checking.
3081
+ * This interface is defined here to avoid circular imports with BaseGridPlugin.
3082
+ * All plugins must satisfy this shape (BaseGridPlugin implements it).
3083
+ */
3084
+ declare interface GridPlugin_2 {
3085
+ /** Unique plugin identifier */
3086
+ readonly name: string;
3087
+ /** Plugin version */
3088
+ readonly version: string;
3089
+ /** CSS styles to inject into grid's shadow DOM */
3090
+ readonly styles?: string;
3091
+ }
3092
+
3019
3093
  /**
3020
3094
  * Common CSS selectors for querying grid elements.
3021
3095
  * Built from the class constants for consistency.
@@ -3377,7 +3451,7 @@ export declare type IconValue = string | HTMLElement;
3377
3451
  declare type IconValue_2 = string | HTMLElement;
3378
3452
 
3379
3453
  /** Result of automatic column inference from sample rows. */
3380
- export declare interface InferredColumnResult<TRow = any> {
3454
+ export declare interface InferredColumnResult<TRow = unknown> {
3381
3455
  columns: ColumnConfigMap<TRow>;
3382
3456
  typeMap: Record<string, PrimitiveColumnType>;
3383
3457
  }
@@ -3409,7 +3483,7 @@ declare interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
3409
3483
  focusRow: number;
3410
3484
  focusCol: number;
3411
3485
  activeEditRows: number;
3412
- rowEditSnapshots: Map<number, any>;
3486
+ rowEditSnapshots: Map<number, T>;
3413
3487
  _changedRowIndices: Set<number>;
3414
3488
  changedRows?: T[];
3415
3489
  changedRowIndices?: number[];
@@ -3426,6 +3500,14 @@ declare interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
3426
3500
  dispatchHeaderClick?: (event: MouseEvent, colIndex: number, headerEl: HTMLElement) => boolean;
3427
3501
  /** Dispatch keydown to plugin system, returns true if handled */
3428
3502
  dispatchKeyDown?: (event: KeyboardEvent) => boolean;
3503
+ /** Get horizontal scroll boundary offsets from plugins (e.g., pinned columns) */
3504
+ getHorizontalScrollOffsets?: (rowEl?: HTMLElement, focusedCell?: HTMLElement) => {
3505
+ left: number;
3506
+ right: number;
3507
+ skipScroll?: boolean;
3508
+ };
3509
+ /** Query all plugins with a generic query and collect responses */
3510
+ queryPlugins?: <T>(query: PluginQuery) => T[];
3429
3511
  /** Request emission of column-state-change event (debounced) */
3430
3512
  requestStateChange?: () => void;
3431
3513
  }
@@ -3652,6 +3734,10 @@ export declare class PinnedColumnsPlugin extends BaseGridPlugin_2<PinnedColumnsC
3652
3734
  }): boolean;
3653
3735
  processColumns(columns: readonly ColumnConfig_2[]): ColumnConfig_2[];
3654
3736
  afterRender(): void;
3737
+ /**
3738
+ * Handle inter-plugin queries.
3739
+ */
3740
+ onPluginQuery(query: PluginQuery_2): unknown;
3655
3741
  /**
3656
3742
  * Re-apply sticky offsets (e.g., after column resize).
3657
3743
  */
@@ -3668,6 +3754,15 @@ export declare class PinnedColumnsPlugin extends BaseGridPlugin_2<PinnedColumnsC
3668
3754
  * Clear all sticky positioning.
3669
3755
  */
3670
3756
  clearStickyPositions(): void;
3757
+ /**
3758
+ * Report horizontal scroll boundary offsets for pinned columns.
3759
+ * Used by keyboard navigation to ensure focused cells aren't hidden behind sticky columns.
3760
+ */
3761
+ getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
3762
+ left: number;
3763
+ right: number;
3764
+ skipScroll?: boolean;
3765
+ } | undefined;
3671
3766
  }
3672
3767
 
3673
3768
  /** Configuration options for the status bar plugin */
@@ -3981,6 +4076,17 @@ declare interface PivotValueField_2 {
3981
4076
  header?: string;
3982
4077
  }
3983
4078
 
4079
+ /**
4080
+ * Well-known plugin query types.
4081
+ * Plugins can define additional query types beyond these.
4082
+ */
4083
+ export declare const PLUGIN_QUERIES: {
4084
+ /** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
4085
+ readonly CAN_MOVE_COLUMN: "canMoveColumn";
4086
+ /** Get context menu items. Context: ContextMenuParams. Response: ContextMenuItem[] */
4087
+ readonly GET_CONTEXT_MENU_ITEMS: "getContextMenuItems";
4088
+ };
4089
+
3984
4090
  /**
3985
4091
  * Cell render context for plugin cell renderers.
3986
4092
  * Provides full context including position and editing state.
@@ -4174,6 +4280,16 @@ export declare class PluginManager {
4174
4280
  * Returns true if any plugin handled the row.
4175
4281
  */
4176
4282
  renderRow(row: any, rowEl: HTMLElement, rowIndex: number): boolean;
4283
+ /**
4284
+ * Query all plugins with a generic query and collect responses.
4285
+ * This enables inter-plugin communication without the core knowing plugin-specific concepts.
4286
+ *
4287
+ * Common query types are defined in PLUGIN_QUERIES, but plugins can define their own.
4288
+ *
4289
+ * @param query - The query object containing type and context
4290
+ * @returns Array of non-undefined responses from plugins
4291
+ */
4292
+ queryPlugins<T>(query: PluginQuery): T[];
4177
4293
  /**
4178
4294
  * Execute onKeyDown hook on all plugins.
4179
4295
  * Returns true if any plugin handled the event.
@@ -4214,9 +4330,18 @@ export declare class PluginManager {
4214
4330
  */
4215
4331
  onCellMouseUp(event: CellMouseEvent): boolean;
4216
4332
  /**
4217
- * Collect context menu items from all plugins.
4218
- */
4219
- getContextMenuItems(params: ContextMenuParams): ContextMenuItem[];
4333
+ * Collect horizontal scroll boundary offsets from all plugins.
4334
+ * Combines offsets from all plugins that report them.
4335
+ *
4336
+ * @param rowEl - The row element (optional, for calculating widths from rendered cells)
4337
+ * @param focusedCell - The currently focused cell element (optional, to determine if scrolling should be skipped)
4338
+ * @returns Combined left and right pixel offsets, plus skipScroll if any plugin requests it
4339
+ */
4340
+ getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
4341
+ left: number;
4342
+ right: number;
4343
+ skipScroll?: boolean;
4344
+ };
4220
4345
  /**
4221
4346
  * Collect tool panels from all plugins.
4222
4347
  * Returns panels sorted by order (ascending).
@@ -4235,6 +4360,30 @@ export declare class PluginManager {
4235
4360
  }[];
4236
4361
  }
4237
4362
 
4363
+ /**
4364
+ * Generic plugin query for inter-plugin communication.
4365
+ * Plugins can define their own query types as string constants
4366
+ * and respond to queries from other plugins.
4367
+ */
4368
+ export declare interface PluginQuery<T = unknown> {
4369
+ /** Query type identifier (e.g., 'canMoveColumn', 'getContextMenuItems') */
4370
+ type: string;
4371
+ /** Query-specific context/parameters */
4372
+ context: T;
4373
+ }
4374
+
4375
+ /**
4376
+ * Generic plugin query for inter-plugin communication.
4377
+ * Plugins can define their own query types as string constants
4378
+ * and respond to queries from other plugins.
4379
+ */
4380
+ declare interface PluginQuery_2<T = unknown> {
4381
+ /** Query type identifier (e.g., 'canMoveColumn', 'getContextMenuItems') */
4382
+ type: string;
4383
+ /** Query-specific context/parameters */
4384
+ context: T;
4385
+ }
4386
+
4238
4387
  export declare type PrimitiveColumnType = 'number' | 'string' | 'date' | 'boolean' | 'select' | 'typeahead';
4239
4388
 
4240
4389
  /**
@@ -4369,7 +4518,7 @@ declare interface RowClickEvent_2 {
4369
4518
  }
4370
4519
 
4371
4520
  /** Detail payload for a committed row edit (may or may not include changes). */
4372
- export declare interface RowCommitDetail<TRow = any> {
4521
+ export declare interface RowCommitDetail<TRow = unknown> {
4373
4522
  /** Row index that lost edit focus. */
4374
4523
  rowIndex: number;
4375
4524
  /** Row object reference. */
@@ -4390,7 +4539,7 @@ export declare interface RowGroupRenderConfig {
4390
4539
  /** If true, group rows span all columns (single full-width cell). Default false. */
4391
4540
  fullWidth?: boolean;
4392
4541
  /** Optional label formatter override. Receives raw group value + depth. */
4393
- formatLabel?: (value: any, depth: number, key: string) => string;
4542
+ formatLabel?: (value: unknown, depth: number, key: string) => string;
4394
4543
  /** Optional aggregate overrides per field for group summary cells (only when not fullWidth). */
4395
4544
  aggregators?: Record<string, AggregatorRef>;
4396
4545
  /** Additional CSS class applied to each group row root element. */