@toolbox-web/grid 0.2.2 → 0.2.4
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 +70 -0
- package/all.d.ts +373 -261
- package/all.js +328 -287
- package/all.js.map +1 -1
- package/index.d.ts +265 -196
- package/index.js +1307 -1179
- package/index.js.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +91 -48
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +38 -35
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +2 -2
- package/umd/grid.all.umd.js +19 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +16 -16
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/reorder.umd.js +1 -1
- 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:
|
|
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:
|
|
136
|
+
value: unknown;
|
|
137
137
|
}> | (() => Array<{
|
|
138
138
|
label: string;
|
|
139
|
-
value:
|
|
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,
|
|
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 =
|
|
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:
|
|
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:
|
|
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 =
|
|
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:
|
|
1567
|
-
props?: Record<string,
|
|
1630
|
+
component: unknown;
|
|
1631
|
+
props?: Record<string, unknown>;
|
|
1568
1632
|
mount?: (options: {
|
|
1569
1633
|
placeholder: HTMLElement;
|
|
1570
|
-
context: CellRenderContext<TRow,
|
|
1571
|
-
spec:
|
|
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:
|
|
1591
|
-
props?: Record<string,
|
|
1654
|
+
component: unknown;
|
|
1655
|
+
props?: Record<string, unknown>;
|
|
1592
1656
|
mount?: (options: {
|
|
1593
1657
|
placeholder: HTMLElement;
|
|
1594
|
-
context: CellRenderContext_2<TRow,
|
|
1595
|
-
spec:
|
|
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 =
|
|
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:
|
|
1693
|
+
component: unknown;
|
|
1630
1694
|
/** Optional static props passed to mount */
|
|
1631
|
-
props?: Record<string,
|
|
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:
|
|
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 =
|
|
1811
|
+
export declare type ColumnViewRenderer<TRow = unknown, TValue = unknown> = (ctx: CellRenderContext<TRow, TValue>) => Node | string | void;
|
|
1748
1812
|
|
|
1749
|
-
declare type ColumnViewRenderer_2<TRow =
|
|
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?:
|
|
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
|
|
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:
|
|
1921
|
+
disabled?: boolean | ((params: ContextMenuParams_2) => boolean);
|
|
1871
1922
|
/** Whether the item is hidden (static or dynamic) */
|
|
1872
|
-
hidden?: boolean | ((params:
|
|
1923
|
+
hidden?: boolean | ((params: ContextMenuParams_2) => boolean);
|
|
1873
1924
|
/** Action handler when the item is clicked */
|
|
1874
|
-
action?: (params:
|
|
1925
|
+
action?: (params: ContextMenuParams_2) => void;
|
|
1875
1926
|
/** Nested submenu items */
|
|
1876
|
-
subMenu?:
|
|
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
|
|
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<
|
|
2010
|
+
showMenu(x: number, y: number, params: Partial<ContextMenuParams_2>): void;
|
|
1975
2011
|
/**
|
|
1976
2012
|
* Hide the context menu.
|
|
1977
2013
|
*/
|
|
@@ -1983,36 +2019,37 @@ 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<
|
|
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;
|
|
1990
2026
|
static readonly tagName = "tbw-grid";
|
|
1991
2027
|
static readonly version: string;
|
|
2028
|
+
static get observedAttributes(): string[];
|
|
1992
2029
|
_rows: T[];
|
|
1993
2030
|
get _columns(): ColumnInternal<T>[];
|
|
1994
2031
|
set _columns(value: ColumnInternal<T>[]);
|
|
1995
|
-
get
|
|
1996
|
-
|
|
2032
|
+
get _visibleColumns(): ColumnInternal<T>[];
|
|
2033
|
+
_headerRowEl: HTMLElement;
|
|
2034
|
+
_bodyEl: HTMLElement;
|
|
2035
|
+
_rowPool: HTMLElement[];
|
|
2036
|
+
_resizeController: ResizeController;
|
|
2037
|
+
_virtualization: VirtualState;
|
|
2038
|
+
_focusRow: number;
|
|
2039
|
+
_focusCol: number;
|
|
2040
|
+
_sortState: {
|
|
2041
|
+
field: string;
|
|
2042
|
+
direction: 1 | -1;
|
|
2043
|
+
} | null;
|
|
2044
|
+
_activeEditRows: number;
|
|
2045
|
+
_rowEditSnapshots: Map<number, T>;
|
|
2046
|
+
_changedRowIndices: Set<number>;
|
|
2047
|
+
_gridTemplate: string;
|
|
1997
2048
|
__rowRenderEpoch: number;
|
|
1998
|
-
activeEditRows: number;
|
|
1999
|
-
resizeController: ResizeController;
|
|
2000
2049
|
__didInitialAutoSize: boolean;
|
|
2001
2050
|
__lightDomColumnsCache?: ColumnInternal[];
|
|
2002
2051
|
__originalColumnNodes?: HTMLElement[];
|
|
2003
|
-
headerRowEl: HTMLElement;
|
|
2004
|
-
bodyEl: HTMLElement;
|
|
2005
|
-
virtualization: VirtualState;
|
|
2006
|
-
sortState: {
|
|
2007
|
-
field: string;
|
|
2008
|
-
direction: 1 | -1;
|
|
2009
|
-
} | null;
|
|
2010
2052
|
__originalOrder: T[];
|
|
2011
|
-
focusRow: number;
|
|
2012
|
-
focusCol: number;
|
|
2013
|
-
gridTemplate: string;
|
|
2014
|
-
rowEditSnapshots: Map<number, T>;
|
|
2015
|
-
_changedRowIndices: Set<number>;
|
|
2016
2053
|
get rows(): T[];
|
|
2017
2054
|
set rows(value: T[]);
|
|
2018
2055
|
/**
|
|
@@ -2028,63 +2065,54 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
2028
2065
|
set fitMode(value: FitMode | undefined);
|
|
2029
2066
|
get editOn(): string | undefined;
|
|
2030
2067
|
set editOn(value: string | undefined);
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
* Get the disconnect signal for event listener cleanup.
|
|
2034
|
-
* This signal is aborted when the grid disconnects from the DOM.
|
|
2035
|
-
* Plugins and internal code can use this for automatic listener cleanup.
|
|
2036
|
-
* @example
|
|
2037
|
-
* element.addEventListener('click', handler, { signal: this.grid.disconnectSignal });
|
|
2038
|
-
*/
|
|
2039
|
-
get disconnectSignal(): AbortSignal;
|
|
2068
|
+
/* Excluded from this release type: effectiveConfig */
|
|
2069
|
+
/* Excluded from this release type: disconnectSignal */
|
|
2040
2070
|
constructor();
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
getPlugin<P extends BaseGridPlugin>(PluginClass: new (...args: any[]) => P): P | undefined;
|
|
2046
|
-
/**
|
|
2047
|
-
* Get a plugin instance by its name.
|
|
2048
|
-
* Used for loose coupling between plugins (avoids static imports).
|
|
2049
|
-
*/
|
|
2050
|
-
getPluginByName(name: string): BaseGridPlugin | undefined;
|
|
2051
|
-
/**
|
|
2052
|
-
* Request a full re-render of the grid.
|
|
2053
|
-
* Called by plugins when they need the grid to update.
|
|
2054
|
-
* Note: This does NOT reset plugin state - just re-processes rows/columns and renders.
|
|
2055
|
-
*/
|
|
2056
|
-
requestRender(): void;
|
|
2057
|
-
/**
|
|
2058
|
-
* Request a lightweight style update without rebuilding DOM.
|
|
2059
|
-
* Called by plugins when they only need to update CSS classes/styles.
|
|
2060
|
-
* This runs all plugin afterRender hooks without rebuilding row/column DOM.
|
|
2061
|
-
*/
|
|
2062
|
-
requestAfterRender(): void;
|
|
2071
|
+
/* Excluded from this release type: getPlugin */
|
|
2072
|
+
/* Excluded from this release type: getPluginByName */
|
|
2073
|
+
/* Excluded from this release type: requestRender */
|
|
2074
|
+
/* Excluded from this release type: requestAfterRender */
|
|
2063
2075
|
connectedCallback(): void;
|
|
2064
2076
|
disconnectedCallback(): void;
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2077
|
+
/**
|
|
2078
|
+
* Handle HTML attribute changes.
|
|
2079
|
+
* Only processes attribute values when SET (non-null).
|
|
2080
|
+
* Removing an attribute does NOT clear JS-set properties.
|
|
2081
|
+
*/
|
|
2082
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
2083
|
+
_emitCellCommit(detail: CellCommitDetail<T>): void;
|
|
2084
|
+
_emitRowCommit(detail: RowCommitDetail<T>): void;
|
|
2085
|
+
_emitSortChange(detail: SortChangeDetail): void;
|
|
2086
|
+
_emitColumnResize(detail: ColumnResizeDetail): void;
|
|
2087
|
+
_emitActivateCell(detail: ActivateCellDetail): void;
|
|
2088
|
+
/* Excluded from this release type: findHeaderRow */
|
|
2089
|
+
/* Excluded from this release type: findRenderedRowElement */
|
|
2073
2090
|
/**
|
|
2074
2091
|
* Dispatch a cell click event to the plugin system.
|
|
2075
2092
|
* Returns true if any plugin handled the event.
|
|
2076
2093
|
*/
|
|
2077
|
-
|
|
2094
|
+
_dispatchCellClick(event: MouseEvent, rowIndex: number, colIndex: number, cellEl: HTMLElement): boolean;
|
|
2078
2095
|
/**
|
|
2079
2096
|
* Dispatch a header click event to the plugin system.
|
|
2080
2097
|
* Returns true if any plugin handled the event.
|
|
2081
2098
|
*/
|
|
2082
|
-
|
|
2099
|
+
_dispatchHeaderClick(event: MouseEvent, colIndex: number, headerEl: HTMLElement): boolean;
|
|
2083
2100
|
/**
|
|
2084
2101
|
* Dispatch a keyboard event to the plugin system.
|
|
2085
2102
|
* Returns true if any plugin handled the event.
|
|
2086
2103
|
*/
|
|
2087
|
-
|
|
2104
|
+
_dispatchKeyDown(event: KeyboardEvent): boolean;
|
|
2105
|
+
/**
|
|
2106
|
+
* Get horizontal scroll boundary offsets from plugins.
|
|
2107
|
+
* Used by keyboard navigation to ensure focused cells are fully visible
|
|
2108
|
+
* when plugins like pinned columns obscure part of the scroll area.
|
|
2109
|
+
*/
|
|
2110
|
+
_getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
|
|
2111
|
+
left: number;
|
|
2112
|
+
right: number;
|
|
2113
|
+
skipScroll?: boolean;
|
|
2114
|
+
};
|
|
2115
|
+
/* Excluded from this release type: queryPlugins */
|
|
2088
2116
|
get changedRows(): T[];
|
|
2089
2117
|
get changedRowIndices(): number[];
|
|
2090
2118
|
resetChangedRows(silent?: boolean): Promise<void>;
|
|
@@ -2154,99 +2182,55 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
2154
2182
|
* Get the current column state.
|
|
2155
2183
|
*/
|
|
2156
2184
|
get columnState(): GridColumnState | undefined;
|
|
2157
|
-
|
|
2158
|
-
* Request a state change event to be emitted.
|
|
2159
|
-
* Called internally after resize, reorder, visibility, or sort changes.
|
|
2160
|
-
* Plugins should call this after changing their state.
|
|
2161
|
-
* The event is debounced to avoid excessive events during drag operations.
|
|
2162
|
-
*/
|
|
2163
|
-
requestStateChange(): void;
|
|
2185
|
+
/* Excluded from this release type: requestStateChange */
|
|
2164
2186
|
/**
|
|
2165
2187
|
* Reset column state to initial configuration.
|
|
2166
2188
|
* Clears all user modifications (order, width, visibility, sort).
|
|
2167
2189
|
*/
|
|
2168
2190
|
resetColumnState(): void;
|
|
2169
|
-
/**
|
|
2170
|
-
* Check if the tool panel is currently open.
|
|
2171
|
-
*/
|
|
2191
|
+
/** Check if the tool panel is currently open. */
|
|
2172
2192
|
get isToolPanelOpen(): boolean;
|
|
2173
2193
|
/**
|
|
2174
2194
|
* Get the currently active tool panel ID, or null if none is open.
|
|
2175
2195
|
* @deprecated Use isToolPanelOpen and expandedToolPanelSections instead.
|
|
2176
2196
|
*/
|
|
2177
2197
|
get activeToolPanel(): string | null;
|
|
2178
|
-
/**
|
|
2179
|
-
* Get the IDs of expanded accordion sections.
|
|
2180
|
-
*/
|
|
2198
|
+
/** Get the IDs of expanded accordion sections. */
|
|
2181
2199
|
get expandedToolPanelSections(): string[];
|
|
2182
|
-
/**
|
|
2183
|
-
* Open the tool panel (accordion view with all registered panels).
|
|
2184
|
-
*/
|
|
2200
|
+
/** Open the tool panel (accordion view with all registered panels). */
|
|
2185
2201
|
openToolPanel(): void;
|
|
2186
|
-
/**
|
|
2187
|
-
* Close the tool panel.
|
|
2188
|
-
*/
|
|
2202
|
+
/** Close the tool panel. */
|
|
2189
2203
|
closeToolPanel(): void;
|
|
2190
|
-
/**
|
|
2191
|
-
* Toggle the tool panel open/closed.
|
|
2192
|
-
*/
|
|
2204
|
+
/** Toggle the tool panel open/closed. */
|
|
2193
2205
|
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
|
-
*/
|
|
2206
|
+
/** Toggle an accordion section expanded/collapsed. */
|
|
2199
2207
|
toggleToolPanelSection(sectionId: string): void;
|
|
2200
|
-
/**
|
|
2201
|
-
* Get registered tool panel definitions.
|
|
2202
|
-
*/
|
|
2208
|
+
/** Get registered tool panel definitions. */
|
|
2203
2209
|
getToolPanels(): ToolPanelDefinition[];
|
|
2204
|
-
/**
|
|
2205
|
-
* Register a custom tool panel (without creating a plugin).
|
|
2206
|
-
*/
|
|
2210
|
+
/** Register a custom tool panel (without creating a plugin). */
|
|
2207
2211
|
registerToolPanel(panel: ToolPanelDefinition): void;
|
|
2208
|
-
/**
|
|
2209
|
-
* Unregister a custom tool panel.
|
|
2210
|
-
*/
|
|
2212
|
+
/** Unregister a custom tool panel. */
|
|
2211
2213
|
unregisterToolPanel(panelId: string): void;
|
|
2212
|
-
/**
|
|
2213
|
-
* Get registered header content definitions.
|
|
2214
|
-
*/
|
|
2214
|
+
/** Get registered header content definitions. */
|
|
2215
2215
|
getHeaderContents(): HeaderContentDefinition[];
|
|
2216
|
-
/**
|
|
2217
|
-
* Register custom header content (without creating a plugin).
|
|
2218
|
-
*/
|
|
2216
|
+
/** Register custom header content (without creating a plugin). */
|
|
2219
2217
|
registerHeaderContent(content: HeaderContentDefinition): void;
|
|
2220
|
-
/**
|
|
2221
|
-
* Unregister custom header content.
|
|
2222
|
-
*/
|
|
2218
|
+
/** Unregister custom header content. */
|
|
2223
2219
|
unregisterHeaderContent(contentId: string): void;
|
|
2224
|
-
/**
|
|
2225
|
-
* Get all registered toolbar buttons.
|
|
2226
|
-
*/
|
|
2220
|
+
/** Get all registered toolbar buttons. */
|
|
2227
2221
|
getToolbarButtons(): ToolbarButtonInfo[];
|
|
2228
|
-
/**
|
|
2229
|
-
* Register a custom toolbar button programmatically.
|
|
2230
|
-
*/
|
|
2222
|
+
/** Register a custom toolbar button programmatically. */
|
|
2231
2223
|
registerToolbarButton(button: ToolbarButtonConfig): void;
|
|
2232
|
-
/**
|
|
2233
|
-
* Unregister a custom toolbar button.
|
|
2234
|
-
*/
|
|
2224
|
+
/** Unregister a custom toolbar button. */
|
|
2235
2225
|
unregisterToolbarButton(buttonId: string): void;
|
|
2236
|
-
/**
|
|
2237
|
-
* Enable/disable a toolbar button by ID.
|
|
2238
|
-
*/
|
|
2226
|
+
/** Enable/disable a toolbar button by ID. */
|
|
2239
2227
|
setToolbarButtonDisabled(buttonId: string, disabled: boolean): void;
|
|
2240
2228
|
/**
|
|
2241
2229
|
* Re-parse light DOM shell elements and refresh shell header.
|
|
2242
2230
|
* Call this after dynamically modifying <tbw-grid-header> children.
|
|
2243
2231
|
*/
|
|
2244
2232
|
refreshShellHeader(): void;
|
|
2245
|
-
|
|
2246
|
-
* Core virtualization routine. Chooses between bypass (small datasets), grouped window rendering,
|
|
2247
|
-
* or standard row window rendering.
|
|
2248
|
-
*/
|
|
2249
|
-
refreshVirtualWindow(force?: boolean): void;
|
|
2233
|
+
/* Excluded from this release type: refreshVirtualWindow */
|
|
2250
2234
|
}
|
|
2251
2235
|
|
|
2252
2236
|
/**
|
|
@@ -2255,7 +2239,7 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
2255
2239
|
export declare interface DataGridElementInterface extends PublicGrid, HTMLElement {
|
|
2256
2240
|
}
|
|
2257
2241
|
|
|
2258
|
-
export declare interface DataGridEventMap<TRow =
|
|
2242
|
+
export declare interface DataGridEventMap<TRow = unknown> {
|
|
2259
2243
|
'cell-commit': CellCommitDetail<TRow>;
|
|
2260
2244
|
'row-commit': RowCommitDetail<TRow>;
|
|
2261
2245
|
'changed-rows-reset': ChangedRowsResetDetail<TRow>;
|
|
@@ -2331,7 +2315,7 @@ declare interface EditAction_2 {
|
|
|
2331
2315
|
* Internal editor execution context extending the generic cell context with commit helpers.
|
|
2332
2316
|
*/
|
|
2333
2317
|
declare interface EditorExecContext<T = any> extends CellContext<T> {
|
|
2334
|
-
commit: (newValue:
|
|
2318
|
+
commit: (newValue: unknown) => void;
|
|
2335
2319
|
cancel: () => void;
|
|
2336
2320
|
}
|
|
2337
2321
|
|
|
@@ -2450,27 +2434,27 @@ export declare class ExportPlugin extends BaseGridPlugin_2<ExportConfig> {
|
|
|
2450
2434
|
} | null;
|
|
2451
2435
|
}
|
|
2452
2436
|
|
|
2453
|
-
export declare interface ExternalMountEditorDetail<TRow =
|
|
2437
|
+
export declare interface ExternalMountEditorDetail<TRow = unknown> {
|
|
2454
2438
|
placeholder: HTMLElement;
|
|
2455
|
-
spec:
|
|
2439
|
+
spec: unknown;
|
|
2456
2440
|
context: {
|
|
2457
2441
|
row: TRow;
|
|
2458
|
-
value:
|
|
2442
|
+
value: unknown;
|
|
2459
2443
|
field: string;
|
|
2460
|
-
column:
|
|
2461
|
-
commit: (v:
|
|
2444
|
+
column: unknown;
|
|
2445
|
+
commit: (v: unknown) => void;
|
|
2462
2446
|
cancel: () => void;
|
|
2463
2447
|
};
|
|
2464
2448
|
}
|
|
2465
2449
|
|
|
2466
|
-
export declare interface ExternalMountViewDetail<TRow =
|
|
2450
|
+
export declare interface ExternalMountViewDetail<TRow = unknown> {
|
|
2467
2451
|
placeholder: HTMLElement;
|
|
2468
|
-
spec:
|
|
2452
|
+
spec: unknown;
|
|
2469
2453
|
context: {
|
|
2470
2454
|
row: TRow;
|
|
2471
|
-
value:
|
|
2455
|
+
value: unknown;
|
|
2472
2456
|
field: string;
|
|
2473
|
-
column:
|
|
2457
|
+
column: unknown;
|
|
2474
2458
|
};
|
|
2475
2459
|
}
|
|
2476
2460
|
|
|
@@ -2774,6 +2758,10 @@ export declare function getValueAggregator(aggFunc: string): ValueAggregatorFn;
|
|
|
2774
2758
|
/**
|
|
2775
2759
|
* CSS class names used in the grid's shadow DOM.
|
|
2776
2760
|
* Use these when adding/removing classes or querying elements.
|
|
2761
|
+
*
|
|
2762
|
+
* Classes are organized by:
|
|
2763
|
+
* - Core: Used by the grid core for structure and basic functionality
|
|
2764
|
+
* - Shared: Used by multiple features/plugins, styled by core CSS
|
|
2777
2765
|
*/
|
|
2778
2766
|
export declare const GridClasses: {
|
|
2779
2767
|
readonly ROOT: "tbw-grid-root";
|
|
@@ -2859,6 +2847,27 @@ export declare interface GridConfig<TRow = any> {
|
|
|
2859
2847
|
fitMode?: FitMode;
|
|
2860
2848
|
/** Edit activation mode ('click' | 'dblclick'). Can also be set via `editOn` prop. */
|
|
2861
2849
|
editOn?: string;
|
|
2850
|
+
/**
|
|
2851
|
+
* Row height in pixels for virtualization calculations.
|
|
2852
|
+
* The virtualization system assumes uniform row heights for performance.
|
|
2853
|
+
*
|
|
2854
|
+
* If not specified, the grid measures the first rendered row's height,
|
|
2855
|
+
* which respects the CSS variable `--tbw-row-height` set by themes.
|
|
2856
|
+
*
|
|
2857
|
+
* Set this explicitly when:
|
|
2858
|
+
* - Row content may wrap to multiple lines (also set `--tbw-cell-white-space: normal`)
|
|
2859
|
+
* - Using custom row templates with variable content
|
|
2860
|
+
* - You want to override theme-defined row height
|
|
2861
|
+
*
|
|
2862
|
+
* @default Auto-measured from first row (respects --tbw-row-height CSS variable)
|
|
2863
|
+
*
|
|
2864
|
+
* @example
|
|
2865
|
+
* ```ts
|
|
2866
|
+
* // Fixed height for rows that may wrap to 2 lines
|
|
2867
|
+
* gridConfig = { rowHeight: 56 };
|
|
2868
|
+
* ```
|
|
2869
|
+
*/
|
|
2870
|
+
rowHeight?: number;
|
|
2862
2871
|
/**
|
|
2863
2872
|
* Array of plugin instances.
|
|
2864
2873
|
* Each plugin is instantiated with its configuration and attached to this grid.
|
|
@@ -2872,7 +2881,7 @@ export declare interface GridConfig<TRow = any> {
|
|
|
2872
2881
|
* ]
|
|
2873
2882
|
* ```
|
|
2874
2883
|
*/
|
|
2875
|
-
plugins?:
|
|
2884
|
+
plugins?: GridPlugin[];
|
|
2876
2885
|
/**
|
|
2877
2886
|
* Saved column state to restore on initialization.
|
|
2878
2887
|
* Includes order, width, visibility, sort, and plugin-contributed state.
|
|
@@ -3016,6 +3025,34 @@ declare interface GridIcons_2 {
|
|
|
3016
3025
|
toolPanel?: IconValue_2;
|
|
3017
3026
|
}
|
|
3018
3027
|
|
|
3028
|
+
/**
|
|
3029
|
+
* Minimal plugin interface for type-checking.
|
|
3030
|
+
* This interface is defined here to avoid circular imports with BaseGridPlugin.
|
|
3031
|
+
* All plugins must satisfy this shape (BaseGridPlugin implements it).
|
|
3032
|
+
*/
|
|
3033
|
+
export declare interface GridPlugin {
|
|
3034
|
+
/** Unique plugin identifier */
|
|
3035
|
+
readonly name: string;
|
|
3036
|
+
/** Plugin version */
|
|
3037
|
+
readonly version: string;
|
|
3038
|
+
/** CSS styles to inject into grid's shadow DOM */
|
|
3039
|
+
readonly styles?: string;
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
/**
|
|
3043
|
+
* Minimal plugin interface for type-checking.
|
|
3044
|
+
* This interface is defined here to avoid circular imports with BaseGridPlugin.
|
|
3045
|
+
* All plugins must satisfy this shape (BaseGridPlugin implements it).
|
|
3046
|
+
*/
|
|
3047
|
+
declare interface GridPlugin_2 {
|
|
3048
|
+
/** Unique plugin identifier */
|
|
3049
|
+
readonly name: string;
|
|
3050
|
+
/** Plugin version */
|
|
3051
|
+
readonly version: string;
|
|
3052
|
+
/** CSS styles to inject into grid's shadow DOM */
|
|
3053
|
+
readonly styles?: string;
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3019
3056
|
/**
|
|
3020
3057
|
* Common CSS selectors for querying grid elements.
|
|
3021
3058
|
* Built from the class constants for consistency.
|
|
@@ -3377,7 +3414,7 @@ export declare type IconValue = string | HTMLElement;
|
|
|
3377
3414
|
declare type IconValue_2 = string | HTMLElement;
|
|
3378
3415
|
|
|
3379
3416
|
/** Result of automatic column inference from sample rows. */
|
|
3380
|
-
export declare interface InferredColumnResult<TRow =
|
|
3417
|
+
export declare interface InferredColumnResult<TRow = unknown> {
|
|
3381
3418
|
columns: ColumnConfigMap<TRow>;
|
|
3382
3419
|
typeMap: Record<string, PrimitiveColumnType>;
|
|
3383
3420
|
}
|
|
@@ -3390,12 +3427,12 @@ declare interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
|
|
|
3390
3427
|
_rows: T[];
|
|
3391
3428
|
_columns: ColumnInternal<T>[];
|
|
3392
3429
|
/** Visible columns only (excludes hidden). Use for rendering. */
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3430
|
+
_visibleColumns: ColumnInternal<T>[];
|
|
3431
|
+
_headerRowEl: HTMLElement;
|
|
3432
|
+
_bodyEl: HTMLElement;
|
|
3433
|
+
_rowPool: HTMLElement[];
|
|
3434
|
+
_resizeController: ResizeController;
|
|
3435
|
+
_sortState: {
|
|
3399
3436
|
field: string;
|
|
3400
3437
|
direction: 1 | -1;
|
|
3401
3438
|
} | null;
|
|
@@ -3404,12 +3441,12 @@ declare interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
|
|
|
3404
3441
|
__didInitialAutoSize?: boolean;
|
|
3405
3442
|
__lightDomColumnsCache?: ColumnInternal[];
|
|
3406
3443
|
__originalColumnNodes?: HTMLElement[];
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3444
|
+
_gridTemplate: string;
|
|
3445
|
+
_virtualization: VirtualState;
|
|
3446
|
+
_focusRow: number;
|
|
3447
|
+
_focusCol: number;
|
|
3448
|
+
_activeEditRows: number;
|
|
3449
|
+
_rowEditSnapshots: Map<number, T>;
|
|
3413
3450
|
_changedRowIndices: Set<number>;
|
|
3414
3451
|
changedRows?: T[];
|
|
3415
3452
|
changedRowIndices?: number[];
|
|
@@ -3421,11 +3458,19 @@ declare interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
|
|
|
3421
3458
|
beginBulkEdit?: (rowIndex: number) => void;
|
|
3422
3459
|
commitActiveRowEdit?: () => void;
|
|
3423
3460
|
/** Dispatch cell click to plugin system, returns true if handled */
|
|
3424
|
-
|
|
3461
|
+
_dispatchCellClick?: (event: MouseEvent, rowIndex: number, colIndex: number, cellEl: HTMLElement) => boolean;
|
|
3425
3462
|
/** Dispatch header click to plugin system, returns true if handled */
|
|
3426
|
-
|
|
3463
|
+
_dispatchHeaderClick?: (event: MouseEvent, colIndex: number, headerEl: HTMLElement) => boolean;
|
|
3427
3464
|
/** Dispatch keydown to plugin system, returns true if handled */
|
|
3428
|
-
|
|
3465
|
+
_dispatchKeyDown?: (event: KeyboardEvent) => boolean;
|
|
3466
|
+
/** Get horizontal scroll boundary offsets from plugins (e.g., pinned columns) */
|
|
3467
|
+
_getHorizontalScrollOffsets?: (rowEl?: HTMLElement, focusedCell?: HTMLElement) => {
|
|
3468
|
+
left: number;
|
|
3469
|
+
right: number;
|
|
3470
|
+
skipScroll?: boolean;
|
|
3471
|
+
};
|
|
3472
|
+
/** Query all plugins with a generic query and collect responses */
|
|
3473
|
+
queryPlugins?: <T>(query: PluginQuery) => T[];
|
|
3429
3474
|
/** Request emission of column-state-change event (debounced) */
|
|
3430
3475
|
requestStateChange?: () => void;
|
|
3431
3476
|
}
|
|
@@ -3652,6 +3697,10 @@ export declare class PinnedColumnsPlugin extends BaseGridPlugin_2<PinnedColumnsC
|
|
|
3652
3697
|
}): boolean;
|
|
3653
3698
|
processColumns(columns: readonly ColumnConfig_2[]): ColumnConfig_2[];
|
|
3654
3699
|
afterRender(): void;
|
|
3700
|
+
/**
|
|
3701
|
+
* Handle inter-plugin queries.
|
|
3702
|
+
*/
|
|
3703
|
+
onPluginQuery(query: PluginQuery_2): unknown;
|
|
3655
3704
|
/**
|
|
3656
3705
|
* Re-apply sticky offsets (e.g., after column resize).
|
|
3657
3706
|
*/
|
|
@@ -3668,6 +3717,15 @@ export declare class PinnedColumnsPlugin extends BaseGridPlugin_2<PinnedColumnsC
|
|
|
3668
3717
|
* Clear all sticky positioning.
|
|
3669
3718
|
*/
|
|
3670
3719
|
clearStickyPositions(): void;
|
|
3720
|
+
/**
|
|
3721
|
+
* Report horizontal scroll boundary offsets for pinned columns.
|
|
3722
|
+
* Used by keyboard navigation to ensure focused cells aren't hidden behind sticky columns.
|
|
3723
|
+
*/
|
|
3724
|
+
getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
|
|
3725
|
+
left: number;
|
|
3726
|
+
right: number;
|
|
3727
|
+
skipScroll?: boolean;
|
|
3728
|
+
} | undefined;
|
|
3671
3729
|
}
|
|
3672
3730
|
|
|
3673
3731
|
/** Configuration options for the status bar plugin */
|
|
@@ -3981,6 +4039,17 @@ declare interface PivotValueField_2 {
|
|
|
3981
4039
|
header?: string;
|
|
3982
4040
|
}
|
|
3983
4041
|
|
|
4042
|
+
/**
|
|
4043
|
+
* Well-known plugin query types.
|
|
4044
|
+
* Plugins can define additional query types beyond these.
|
|
4045
|
+
*/
|
|
4046
|
+
export declare const PLUGIN_QUERIES: {
|
|
4047
|
+
/** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
|
|
4048
|
+
readonly CAN_MOVE_COLUMN: "canMoveColumn";
|
|
4049
|
+
/** Get context menu items. Context: ContextMenuParams. Response: ContextMenuItem[] */
|
|
4050
|
+
readonly GET_CONTEXT_MENU_ITEMS: "getContextMenuItems";
|
|
4051
|
+
};
|
|
4052
|
+
|
|
3984
4053
|
/**
|
|
3985
4054
|
* Cell render context for plugin cell renderers.
|
|
3986
4055
|
* Provides full context including position and editing state.
|
|
@@ -4174,6 +4243,16 @@ export declare class PluginManager {
|
|
|
4174
4243
|
* Returns true if any plugin handled the row.
|
|
4175
4244
|
*/
|
|
4176
4245
|
renderRow(row: any, rowEl: HTMLElement, rowIndex: number): boolean;
|
|
4246
|
+
/**
|
|
4247
|
+
* Query all plugins with a generic query and collect responses.
|
|
4248
|
+
* This enables inter-plugin communication without the core knowing plugin-specific concepts.
|
|
4249
|
+
*
|
|
4250
|
+
* Common query types are defined in PLUGIN_QUERIES, but plugins can define their own.
|
|
4251
|
+
*
|
|
4252
|
+
* @param query - The query object containing type and context
|
|
4253
|
+
* @returns Array of non-undefined responses from plugins
|
|
4254
|
+
*/
|
|
4255
|
+
queryPlugins<T>(query: PluginQuery): T[];
|
|
4177
4256
|
/**
|
|
4178
4257
|
* Execute onKeyDown hook on all plugins.
|
|
4179
4258
|
* Returns true if any plugin handled the event.
|
|
@@ -4214,9 +4293,18 @@ export declare class PluginManager {
|
|
|
4214
4293
|
*/
|
|
4215
4294
|
onCellMouseUp(event: CellMouseEvent): boolean;
|
|
4216
4295
|
/**
|
|
4217
|
-
* Collect
|
|
4218
|
-
|
|
4219
|
-
|
|
4296
|
+
* Collect horizontal scroll boundary offsets from all plugins.
|
|
4297
|
+
* Combines offsets from all plugins that report them.
|
|
4298
|
+
*
|
|
4299
|
+
* @param rowEl - The row element (optional, for calculating widths from rendered cells)
|
|
4300
|
+
* @param focusedCell - The currently focused cell element (optional, to determine if scrolling should be skipped)
|
|
4301
|
+
* @returns Combined left and right pixel offsets, plus skipScroll if any plugin requests it
|
|
4302
|
+
*/
|
|
4303
|
+
getHorizontalScrollOffsets(rowEl?: HTMLElement, focusedCell?: HTMLElement): {
|
|
4304
|
+
left: number;
|
|
4305
|
+
right: number;
|
|
4306
|
+
skipScroll?: boolean;
|
|
4307
|
+
};
|
|
4220
4308
|
/**
|
|
4221
4309
|
* Collect tool panels from all plugins.
|
|
4222
4310
|
* Returns panels sorted by order (ascending).
|
|
@@ -4235,6 +4323,30 @@ export declare class PluginManager {
|
|
|
4235
4323
|
}[];
|
|
4236
4324
|
}
|
|
4237
4325
|
|
|
4326
|
+
/**
|
|
4327
|
+
* Generic plugin query for inter-plugin communication.
|
|
4328
|
+
* Plugins can define their own query types as string constants
|
|
4329
|
+
* and respond to queries from other plugins.
|
|
4330
|
+
*/
|
|
4331
|
+
export declare interface PluginQuery<T = unknown> {
|
|
4332
|
+
/** Query type identifier (e.g., 'canMoveColumn', 'getContextMenuItems') */
|
|
4333
|
+
type: string;
|
|
4334
|
+
/** Query-specific context/parameters */
|
|
4335
|
+
context: T;
|
|
4336
|
+
}
|
|
4337
|
+
|
|
4338
|
+
/**
|
|
4339
|
+
* Generic plugin query for inter-plugin communication.
|
|
4340
|
+
* Plugins can define their own query types as string constants
|
|
4341
|
+
* and respond to queries from other plugins.
|
|
4342
|
+
*/
|
|
4343
|
+
declare interface PluginQuery_2<T = unknown> {
|
|
4344
|
+
/** Query type identifier (e.g., 'canMoveColumn', 'getContextMenuItems') */
|
|
4345
|
+
type: string;
|
|
4346
|
+
/** Query-specific context/parameters */
|
|
4347
|
+
context: T;
|
|
4348
|
+
}
|
|
4349
|
+
|
|
4238
4350
|
export declare type PrimitiveColumnType = 'number' | 'string' | 'date' | 'boolean' | 'select' | 'typeahead';
|
|
4239
4351
|
|
|
4240
4352
|
/**
|
|
@@ -4369,7 +4481,7 @@ declare interface RowClickEvent_2 {
|
|
|
4369
4481
|
}
|
|
4370
4482
|
|
|
4371
4483
|
/** Detail payload for a committed row edit (may or may not include changes). */
|
|
4372
|
-
export declare interface RowCommitDetail<TRow =
|
|
4484
|
+
export declare interface RowCommitDetail<TRow = unknown> {
|
|
4373
4485
|
/** Row index that lost edit focus. */
|
|
4374
4486
|
rowIndex: number;
|
|
4375
4487
|
/** Row object reference. */
|
|
@@ -4390,7 +4502,7 @@ export declare interface RowGroupRenderConfig {
|
|
|
4390
4502
|
/** If true, group rows span all columns (single full-width cell). Default false. */
|
|
4391
4503
|
fullWidth?: boolean;
|
|
4392
4504
|
/** Optional label formatter override. Receives raw group value + depth. */
|
|
4393
|
-
formatLabel?: (value:
|
|
4505
|
+
formatLabel?: (value: unknown, depth: number, key: string) => string;
|
|
4394
4506
|
/** Optional aggregate overrides per field for group summary cells (only when not fullWidth). */
|
|
4395
4507
|
aggregators?: Record<string, AggregatorRef>;
|
|
4396
4508
|
/** Additional CSS class applied to each group row root element. */
|