@toolbox-web/grid 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/all.d.ts +151 -95
  2. package/all.js +1554 -1452
  3. package/all.js.map +1 -1
  4. package/custom-elements.json +89 -7
  5. package/index.d.ts +68 -23
  6. package/index.js +1066 -948
  7. package/index.js.map +1 -1
  8. package/lib/plugins/clipboard/index.js +48 -49
  9. package/lib/plugins/clipboard/index.js.map +1 -1
  10. package/lib/plugins/column-virtualization/index.js +6 -6
  11. package/lib/plugins/column-virtualization/index.js.map +1 -1
  12. package/lib/plugins/context-menu/index.js +32 -34
  13. package/lib/plugins/context-menu/index.js.map +1 -1
  14. package/lib/plugins/export/index.js +7 -7
  15. package/lib/plugins/export/index.js.map +1 -1
  16. package/lib/plugins/filtering/index.js +5 -38
  17. package/lib/plugins/filtering/index.js.map +1 -1
  18. package/lib/plugins/grouping-columns/index.js +4 -32
  19. package/lib/plugins/grouping-columns/index.js.map +1 -1
  20. package/lib/plugins/grouping-rows/index.js +8 -45
  21. package/lib/plugins/grouping-rows/index.js.map +1 -1
  22. package/lib/plugins/master-detail/index.js +6 -30
  23. package/lib/plugins/master-detail/index.js.map +1 -1
  24. package/lib/plugins/multi-sort/index.js +19 -42
  25. package/lib/plugins/multi-sort/index.js.map +1 -1
  26. package/lib/plugins/pinned-columns/index.js +5 -6
  27. package/lib/plugins/pinned-columns/index.js.map +1 -1
  28. package/lib/plugins/pinned-rows/index.js +6 -80
  29. package/lib/plugins/pinned-rows/index.js.map +1 -1
  30. package/lib/plugins/pivot/index.js +673 -145
  31. package/lib/plugins/pivot/index.js.map +1 -1
  32. package/lib/plugins/reorder/index.js +22 -51
  33. package/lib/plugins/reorder/index.js.map +1 -1
  34. package/lib/plugins/selection/index.js +53 -83
  35. package/lib/plugins/selection/index.js.map +1 -1
  36. package/lib/plugins/server-side/index.js +2 -2
  37. package/lib/plugins/server-side/index.js.map +1 -1
  38. package/lib/plugins/tree/index.js +6 -14
  39. package/lib/plugins/tree/index.js.map +1 -1
  40. package/lib/plugins/undo-redo/index.js +2 -3
  41. package/lib/plugins/undo-redo/index.js.map +1 -1
  42. package/lib/plugins/visibility/index.js +13 -105
  43. package/lib/plugins/visibility/index.js.map +1 -1
  44. package/package.json +1 -1
  45. package/themes/dg-theme-bootstrap.css +73 -0
  46. package/themes/dg-theme-material.css +71 -0
  47. package/umd/grid.all.umd.js +40 -415
  48. package/umd/grid.all.umd.js.map +1 -1
  49. package/umd/grid.umd.js +29 -60
  50. package/umd/grid.umd.js.map +1 -1
  51. package/umd/plugins/clipboard.umd.js +4 -4
  52. package/umd/plugins/clipboard.umd.js.map +1 -1
  53. package/umd/plugins/column-virtualization.umd.js +1 -1
  54. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  55. package/umd/plugins/context-menu.umd.js +2 -2
  56. package/umd/plugins/context-menu.umd.js.map +1 -1
  57. package/umd/plugins/export.umd.js +1 -1
  58. package/umd/plugins/export.umd.js.map +1 -1
  59. package/umd/plugins/filtering.umd.js +2 -34
  60. package/umd/plugins/filtering.umd.js.map +1 -1
  61. package/umd/plugins/grouping-columns.umd.js +1 -28
  62. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  63. package/umd/plugins/grouping-rows.umd.js +1 -39
  64. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  65. package/umd/plugins/master-detail.umd.js +1 -26
  66. package/umd/plugins/master-detail.umd.js.map +1 -1
  67. package/umd/plugins/multi-sort.umd.js +1 -25
  68. package/umd/plugins/multi-sort.umd.js.map +1 -1
  69. package/umd/plugins/pinned-columns.umd.js +1 -1
  70. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  71. package/umd/plugins/pinned-rows.umd.js +1 -72
  72. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  73. package/umd/plugins/pivot.umd.js +1 -7
  74. package/umd/plugins/pivot.umd.js.map +1 -1
  75. package/umd/plugins/reorder.umd.js +1 -30
  76. package/umd/plugins/reorder.umd.js.map +1 -1
  77. package/umd/plugins/selection.umd.js +1 -33
  78. package/umd/plugins/selection.umd.js.map +1 -1
  79. package/umd/plugins/server-side.umd.js +1 -1
  80. package/umd/plugins/server-side.umd.js.map +1 -1
  81. package/umd/plugins/tree.umd.js +1 -10
  82. package/umd/plugins/tree.umd.js.map +1 -1
  83. package/umd/plugins/undo-redo.umd.js +1 -1
  84. package/umd/plugins/undo-redo.umd.js.map +1 -1
  85. package/umd/plugins/visibility.umd.js +1 -93
  86. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -276,6 +276,14 @@
276
276
  },
277
277
  "default": "false"
278
278
  },
279
+ {
280
+ "kind": "field",
281
+ "name": "#resizeCleanup",
282
+ "privacy": "private",
283
+ "type": {
284
+ "text": "() => void | undefined"
285
+ }
286
+ },
279
287
  {
280
288
  "kind": "field",
281
289
  "name": "_rows",
@@ -284,6 +292,15 @@
284
292
  },
285
293
  "default": "[]"
286
294
  },
295
+ {
296
+ "kind": "field",
297
+ "name": "#baseColumns",
298
+ "privacy": "private",
299
+ "type": {
300
+ "text": "ColumnInternal<T>[]"
301
+ },
302
+ "default": "[]"
303
+ },
287
304
  {
288
305
  "kind": "field",
289
306
  "name": "_columns",
@@ -1451,6 +1468,15 @@
1451
1468
  },
1452
1469
  "description": "Reset column state to initial configuration.\nClears all user modifications (order, width, visibility, sort)."
1453
1470
  },
1471
+ {
1472
+ "kind": "field",
1473
+ "name": "isToolPanelOpen",
1474
+ "type": {
1475
+ "text": "boolean"
1476
+ },
1477
+ "description": "Check if the tool panel is currently open.",
1478
+ "readonly": true
1479
+ },
1454
1480
  {
1455
1481
  "kind": "field",
1456
1482
  "name": "activeToolPanel",
@@ -1458,6 +1484,16 @@
1458
1484
  "text": "string | null"
1459
1485
  },
1460
1486
  "description": "Get the currently active tool panel ID, or null if none is open.",
1487
+ "deprecated": "Use isToolPanelOpen and expandedToolPanelSections instead.",
1488
+ "readonly": true
1489
+ },
1490
+ {
1491
+ "kind": "field",
1492
+ "name": "expandedToolPanelSections",
1493
+ "type": {
1494
+ "text": "string[]"
1495
+ },
1496
+ "description": "Get the IDs of expanded accordion sections.",
1461
1497
  "readonly": true
1462
1498
  },
1463
1499
  {
@@ -1468,29 +1504,75 @@
1468
1504
  "text": "void"
1469
1505
  }
1470
1506
  },
1507
+ "description": "Open the tool panel (accordion view with all registered panels)."
1508
+ },
1509
+ {
1510
+ "kind": "method",
1511
+ "name": "closeToolPanel",
1512
+ "return": {
1513
+ "type": {
1514
+ "text": "void"
1515
+ }
1516
+ },
1517
+ "description": "Close the tool panel."
1518
+ },
1519
+ {
1520
+ "kind": "method",
1521
+ "name": "toggleToolPanel",
1522
+ "return": {
1523
+ "type": {
1524
+ "text": "void"
1525
+ }
1526
+ },
1527
+ "description": "Toggle the tool panel open/closed."
1528
+ },
1529
+ {
1530
+ "kind": "method",
1531
+ "name": "toggleToolPanelSection",
1532
+ "return": {
1533
+ "type": {
1534
+ "text": "void"
1535
+ }
1536
+ },
1471
1537
  "parameters": [
1472
1538
  {
1473
- "name": "panelId",
1539
+ "name": "sectionId",
1474
1540
  "type": {
1475
1541
  "text": "string"
1476
1542
  }
1477
1543
  }
1478
1544
  ],
1479
- "description": "Open a tool panel by ID.\nCloses any currently open panel first."
1545
+ "description": "Toggle an accordion section expanded/collapsed.\nOnly one section can be expanded at a time (exclusive accordion).\nWhen there's only one panel, toggling is disabled (always expanded)."
1480
1546
  },
1481
1547
  {
1482
1548
  "kind": "method",
1483
- "name": "closeToolPanel",
1549
+ "name": "#updateAccordionSectionState",
1550
+ "privacy": "private",
1484
1551
  "return": {
1485
1552
  "type": {
1486
1553
  "text": "void"
1487
1554
  }
1488
1555
  },
1489
- "description": "Close the currently open tool panel."
1556
+ "parameters": [
1557
+ {
1558
+ "name": "sectionId",
1559
+ "type": {
1560
+ "text": "string"
1561
+ }
1562
+ },
1563
+ {
1564
+ "name": "expanded",
1565
+ "type": {
1566
+ "text": "boolean"
1567
+ }
1568
+ }
1569
+ ],
1570
+ "description": "Update accordion section visual state."
1490
1571
  },
1491
1572
  {
1492
1573
  "kind": "method",
1493
- "name": "toggleToolPanel",
1574
+ "name": "#renderAccordionSectionContent",
1575
+ "privacy": "private",
1494
1576
  "return": {
1495
1577
  "type": {
1496
1578
  "text": "void"
@@ -1498,13 +1580,13 @@
1498
1580
  },
1499
1581
  "parameters": [
1500
1582
  {
1501
- "name": "panelId",
1583
+ "name": "sectionId",
1502
1584
  "type": {
1503
1585
  "text": "string"
1504
1586
  }
1505
1587
  }
1506
1588
  ],
1507
- "description": "Toggle a tool panel open/closed."
1589
+ "description": "Render content for a single accordion section."
1508
1590
  },
1509
1591
  {
1510
1592
  "kind": "method",
package/index.d.ts CHANGED
@@ -6,6 +6,9 @@ export declare interface ActivateCellDetail {
6
6
  col: number;
7
7
  }
8
8
 
9
+ /** Available aggregation function types */
10
+ declare type AggFunc = 'sum' | 'avg' | 'count' | 'min' | 'max' | 'first' | 'last';
11
+
9
12
  /**
10
13
  * Aggregators Core Registry
11
14
  *
@@ -1165,23 +1168,37 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
1165
1168
  * Clears all user modifications (order, width, visibility, sort).
1166
1169
  */
1167
1170
  resetColumnState(): void;
1171
+ /**
1172
+ * Check if the tool panel is currently open.
1173
+ */
1174
+ get isToolPanelOpen(): boolean;
1168
1175
  /**
1169
1176
  * Get the currently active tool panel ID, or null if none is open.
1177
+ * @deprecated Use isToolPanelOpen and expandedToolPanelSections instead.
1170
1178
  */
1171
1179
  get activeToolPanel(): string | null;
1172
1180
  /**
1173
- * Open a tool panel by ID.
1174
- * Closes any currently open panel first.
1181
+ * Get the IDs of expanded accordion sections.
1182
+ */
1183
+ get expandedToolPanelSections(): string[];
1184
+ /**
1185
+ * Open the tool panel (accordion view with all registered panels).
1175
1186
  */
1176
- openToolPanel(panelId: string): void;
1187
+ openToolPanel(): void;
1177
1188
  /**
1178
- * Close the currently open tool panel.
1189
+ * Close the tool panel.
1179
1190
  */
1180
1191
  closeToolPanel(): void;
1181
1192
  /**
1182
- * Toggle a tool panel open/closed.
1193
+ * Toggle the tool panel open/closed.
1183
1194
  */
1184
- toggleToolPanel(panelId: string): void;
1195
+ toggleToolPanel(): void;
1196
+ /**
1197
+ * Toggle an accordion section expanded/collapsed.
1198
+ * Only one section can be expanded at a time (exclusive accordion).
1199
+ * When there's only one panel, toggling is disabled (always expanded).
1200
+ */
1201
+ toggleToolPanelSection(sectionId: string): void;
1185
1202
  /**
1186
1203
  * Get registered tool panel definitions.
1187
1204
  */
@@ -1346,8 +1363,6 @@ export declare interface ExternalMountViewDetail<TRow = any> {
1346
1363
 
1347
1364
  /** Configuration options for the filtering plugin */
1348
1365
  export declare interface FilterConfig {
1349
- /** Whether filtering is enabled (default: true) */
1350
- enabled?: boolean;
1351
1366
  /** Debounce delay in ms for filter input (default: 300) */
1352
1367
  debounceMs?: number;
1353
1368
  /** Whether text filtering is case sensitive (default: false) */
@@ -1446,6 +1461,15 @@ export declare interface GetRowsResult {
1446
1461
  lastRow?: number;
1447
1462
  }
1448
1463
 
1464
+ /**
1465
+ * Get a value-based aggregator function.
1466
+ * Used by Pivot plugin and other features that aggregate pre-extracted values.
1467
+ *
1468
+ * @param aggFunc - Aggregation function name ('sum', 'avg', 'count', 'min', 'max', 'first', 'last')
1469
+ * @returns Aggregator function that takes number[] and returns number
1470
+ */
1471
+ export declare function getValueAggregator(aggFunc: string): ValueAggregatorFn;
1472
+
1449
1473
  /**
1450
1474
  * CSS class names used in the grid's shadow DOM.
1451
1475
  * Use these when adding/removing classes or querying elements.
@@ -1641,6 +1665,8 @@ export declare interface GridIcons {
1641
1665
  submenuArrow?: IconValue;
1642
1666
  /** Drag handle icon for reordering. Default: '⋮⋮' */
1643
1667
  dragHandle?: IconValue;
1668
+ /** Tool panel toggle icon in toolbar. Default: '☰' */
1669
+ toolPanel?: IconValue;
1644
1670
  }
1645
1671
 
1646
1672
  /**
@@ -1666,8 +1692,6 @@ export declare const GridSelectors: {
1666
1692
 
1667
1693
  /** Configuration options for the row grouping plugin */
1668
1694
  export declare interface GroupingRowsConfig {
1669
- /** Whether the plugin is enabled (default: true) */
1670
- enabled?: boolean;
1671
1695
  /**
1672
1696
  * Callback to determine group path for a row.
1673
1697
  * Return an array of group keys, a single key, null/false to skip grouping.
@@ -1806,8 +1830,6 @@ export declare const listAggregators: () => string[];
1806
1830
 
1807
1831
  /** Configuration options for the multi-sort plugin */
1808
1832
  export declare interface MultiSortConfig {
1809
- /** Whether multi-sort is enabled (default: true) */
1810
- enabled?: boolean;
1811
1833
  /** Maximum number of columns to sort by (default: 3) */
1812
1834
  maxSortColumns?: number;
1813
1835
  /** Whether to show sort order badges (1, 2, 3) on headers (default: true) */
@@ -1841,12 +1863,17 @@ export declare interface PinnedRowsPanel {
1841
1863
  }
1842
1864
 
1843
1865
  export declare interface PivotConfig {
1844
- enabled?: boolean;
1866
+ /** Whether pivot view is active on load (default: true when fields are configured) */
1867
+ active?: boolean;
1845
1868
  rowGroupFields?: string[];
1846
1869
  columnGroupFields?: string[];
1847
1870
  valueFields?: PivotValueField[];
1848
1871
  showTotals?: boolean;
1849
1872
  showGrandTotal?: boolean;
1873
+ /** Whether groups are expanded by default (default: true) */
1874
+ defaultExpanded?: boolean;
1875
+ /** Indent width per depth level in pixels (default: 20) */
1876
+ indentWidth?: number;
1850
1877
  }
1851
1878
 
1852
1879
  export declare interface PivotResult {
@@ -1857,18 +1884,27 @@ export declare interface PivotResult {
1857
1884
  }
1858
1885
 
1859
1886
  declare interface PivotRow {
1887
+ /** Unique key for this row (hierarchical path) */
1860
1888
  rowKey: string;
1889
+ /** Display label for this row */
1861
1890
  rowLabel: string;
1891
+ /** Depth level (0 = top level) */
1862
1892
  depth: number;
1893
+ /** Aggregated values by column key */
1863
1894
  values: Record<string, number | null>;
1895
+ /** Row total across all columns */
1864
1896
  total?: number;
1897
+ /** Whether this row has children (is a group header) */
1865
1898
  isGroup: boolean;
1899
+ /** Child rows (for hierarchical grouping) */
1866
1900
  children?: PivotRow[];
1901
+ /** Number of data rows in this group */
1902
+ rowCount?: number;
1867
1903
  }
1868
1904
 
1869
1905
  export declare interface PivotValueField {
1870
1906
  field: string;
1871
- aggFunc: 'sum' | 'avg' | 'count' | 'min' | 'max' | 'first' | 'last';
1907
+ aggFunc: AggFunc;
1872
1908
  header?: string;
1873
1909
  }
1874
1910
 
@@ -2183,6 +2219,15 @@ export declare interface RowGroupRenderConfig {
2183
2219
 
2184
2220
  export declare const runAggregator: (ref: AggregatorRef_2 | undefined, rows: any[], field: string, column?: any) => any;
2185
2221
 
2222
+ /**
2223
+ * Run a value-based aggregator on a set of values.
2224
+ *
2225
+ * @param aggFunc - Aggregation function name
2226
+ * @param values - Array of numbers to aggregate
2227
+ * @returns Aggregated result
2228
+ */
2229
+ export declare function runValueAggregator(aggFunc: string, values: number[]): number;
2230
+
2186
2231
  /**
2187
2232
  * Scroll event
2188
2233
  */
@@ -2297,7 +2342,7 @@ export declare class SelectionPlugin extends BaseGridPlugin<SelectionConfig> {
2297
2342
  * Set selected ranges programmatically.
2298
2343
  */
2299
2344
  setRanges(ranges: CellRange[]): void;
2300
- readonly styles = "\n /* Prevent text selection during range drag */\n :host .selecting .data-grid-row > .cell {\n user-select: none;\n }\n\n /* Row selection - use accent color for row focus */\n :host .data-grid-row.row-focus {\n background-color: var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%));\n }\n\n /* Disable cell-focus outline in row mode - row is the focus unit */\n :host([data-selection-mode=\"row\"]) .cell-focus {\n outline: none;\n }\n\n /* Selection cell styles - for range mode */\n :host .data-grid-row > .cell.selected {\n background-color: var(--tbw-range-selection-bg);\n }\n :host .data-grid-row > .cell.selected.top {\n border-top: 2px solid var(--tbw-range-border-color);\n }\n :host .data-grid-row > .cell.selected.bottom {\n border-bottom: 2px solid var(--tbw-range-border-color);\n }\n :host .data-grid-row > .cell.selected.first {\n border-left: 2px solid var(--tbw-range-border-color);\n }\n :host .data-grid-row > .cell.selected.last {\n border-right: 2px solid var(--tbw-range-border-color);\n }\n ";
2345
+ readonly styles: string;
2301
2346
  }
2302
2347
 
2303
2348
  export declare interface ServerSideDataSource {
@@ -2411,13 +2456,13 @@ export declare interface ToolPanelConfig {
2411
2456
  export declare interface ToolPanelDefinition {
2412
2457
  /** Unique panel ID */
2413
2458
  id: string;
2414
- /** Panel title shown in header */
2459
+ /** Panel title shown in accordion header */
2415
2460
  title: string;
2416
- /** Icon for toolbar button (SVG string or emoji) */
2417
- icon: string;
2418
- /** Toolbar button tooltip */
2461
+ /** Icon for accordion section header (optional, emoji or SVG) */
2462
+ icon?: string;
2463
+ /** Tooltip for accordion section header */
2419
2464
  tooltip?: string;
2420
- /** Panel content factory - called when panel opens */
2465
+ /** Panel content factory - called when panel section opens */
2421
2466
  render: (container: HTMLElement) => void | (() => void);
2422
2467
  /** Called when panel closes (for cleanup) */
2423
2468
  onClose?: () => void;
@@ -2432,8 +2477,6 @@ export declare interface ToolPanelDefinition {
2432
2477
  */
2433
2478
  /** Configuration options for the tree plugin */
2434
2479
  export declare interface TreeConfig {
2435
- /** Whether tree functionality is enabled (default: true) */
2436
- enabled?: boolean;
2437
2480
  /** Field name containing child rows (default: 'children') */
2438
2481
  childrenField?: string;
2439
2482
  /** Auto-detect tree structure from data (default: true) */
@@ -2529,11 +2572,13 @@ export declare class TreePlugin extends BaseGridPlugin<TreeConfig> {
2529
2572
  * Expand all ancestors of a node to make it visible.
2530
2573
  */
2531
2574
  expandToKey(key: string): void;
2532
- readonly styles = "\n .tree-toggle {\n cursor: pointer;\n user-select: none;\n transition: transform 0.2s;\n }\n .tree-toggle:hover {\n color: var(--tbw-tree-accent, var(--tbw-color-accent));\n }\n ";
2575
+ readonly styles: string;
2533
2576
  }
2534
2577
 
2535
2578
  export declare const unregisterAggregator: (name: string) => void;
2536
2579
 
2580
+ export declare type ValueAggregatorFn = (values: number[]) => number;
2581
+
2537
2582
  /** Virtual window bookkeeping; modified in-place as scroll position changes. */
2538
2583
  declare interface VirtualState {
2539
2584
  enabled: boolean;