@toolbox-web/grid 0.0.7 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +1 -1
  2. package/all.d.ts +156 -95
  3. package/all.js +1561 -1502
  4. package/all.js.map +1 -1
  5. package/custom-elements.json +89 -7
  6. package/index.d.ts +68 -23
  7. package/index.js +1617 -1388
  8. package/index.js.map +1 -1
  9. package/lib/plugins/clipboard/index.js +48 -49
  10. package/lib/plugins/clipboard/index.js.map +1 -1
  11. package/lib/plugins/column-virtualization/index.js +6 -6
  12. package/lib/plugins/column-virtualization/index.js.map +1 -1
  13. package/lib/plugins/context-menu/index.js +64 -109
  14. package/lib/plugins/context-menu/index.js.map +1 -1
  15. package/lib/plugins/export/index.js +7 -7
  16. package/lib/plugins/export/index.js.map +1 -1
  17. package/lib/plugins/filtering/index.js +5 -38
  18. package/lib/plugins/filtering/index.js.map +1 -1
  19. package/lib/plugins/grouping-columns/index.js +4 -32
  20. package/lib/plugins/grouping-columns/index.js.map +1 -1
  21. package/lib/plugins/grouping-rows/index.js +8 -45
  22. package/lib/plugins/grouping-rows/index.js.map +1 -1
  23. package/lib/plugins/master-detail/index.js +7 -31
  24. package/lib/plugins/master-detail/index.js.map +1 -1
  25. package/lib/plugins/multi-sort/index.js +19 -42
  26. package/lib/plugins/multi-sort/index.js.map +1 -1
  27. package/lib/plugins/pinned-columns/index.js +5 -6
  28. package/lib/plugins/pinned-columns/index.js.map +1 -1
  29. package/lib/plugins/pinned-rows/index.js +14 -88
  30. package/lib/plugins/pinned-rows/index.js.map +1 -1
  31. package/lib/plugins/pivot/index.js +673 -145
  32. package/lib/plugins/pivot/index.js.map +1 -1
  33. package/lib/plugins/reorder/index.js +22 -51
  34. package/lib/plugins/reorder/index.js.map +1 -1
  35. package/lib/plugins/selection/index.js +76 -83
  36. package/lib/plugins/selection/index.js.map +1 -1
  37. package/lib/plugins/server-side/index.js +2 -2
  38. package/lib/plugins/server-side/index.js.map +1 -1
  39. package/lib/plugins/tree/index.js +6 -14
  40. package/lib/plugins/tree/index.js.map +1 -1
  41. package/lib/plugins/undo-redo/index.js +2 -3
  42. package/lib/plugins/undo-redo/index.js.map +1 -1
  43. package/lib/plugins/visibility/index.js +13 -105
  44. package/lib/plugins/visibility/index.js.map +1 -1
  45. package/package.json +1 -1
  46. package/themes/dg-theme-bootstrap.css +73 -0
  47. package/themes/dg-theme-material.css +71 -0
  48. package/umd/grid.all.umd.js +43 -469
  49. package/umd/grid.all.umd.js.map +1 -1
  50. package/umd/grid.umd.js +35 -66
  51. package/umd/grid.umd.js.map +1 -1
  52. package/umd/plugins/clipboard.umd.js +4 -4
  53. package/umd/plugins/clipboard.umd.js.map +1 -1
  54. package/umd/plugins/column-virtualization.umd.js +1 -1
  55. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  56. package/umd/plugins/context-menu.umd.js +1 -52
  57. package/umd/plugins/context-menu.umd.js.map +1 -1
  58. package/umd/plugins/export.umd.js +1 -1
  59. package/umd/plugins/export.umd.js.map +1 -1
  60. package/umd/plugins/filtering.umd.js +2 -34
  61. package/umd/plugins/filtering.umd.js.map +1 -1
  62. package/umd/plugins/grouping-columns.umd.js +1 -28
  63. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  64. package/umd/plugins/grouping-rows.umd.js +1 -39
  65. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  66. package/umd/plugins/master-detail.umd.js +1 -26
  67. package/umd/plugins/master-detail.umd.js.map +1 -1
  68. package/umd/plugins/multi-sort.umd.js +1 -25
  69. package/umd/plugins/multi-sort.umd.js.map +1 -1
  70. package/umd/plugins/pinned-columns.umd.js +1 -1
  71. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  72. package/umd/plugins/pinned-rows.umd.js +1 -72
  73. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  74. package/umd/plugins/pivot.umd.js +1 -7
  75. package/umd/plugins/pivot.umd.js.map +1 -1
  76. package/umd/plugins/reorder.umd.js +1 -30
  77. package/umd/plugins/reorder.umd.js.map +1 -1
  78. package/umd/plugins/selection.umd.js +1 -33
  79. package/umd/plugins/selection.umd.js.map +1 -1
  80. package/umd/plugins/server-side.umd.js +1 -1
  81. package/umd/plugins/server-side.umd.js.map +1 -1
  82. package/umd/plugins/tree.umd.js +1 -10
  83. package/umd/plugins/tree.umd.js.map +1 -1
  84. package/umd/plugins/undo-redo.umd.js +1 -1
  85. package/umd/plugins/undo-redo.umd.js.map +1 -1
  86. package/umd/plugins/visibility.umd.js +1 -93
  87. package/umd/plugins/visibility.umd.js.map +1 -1
package/README.md CHANGED
@@ -506,7 +506,7 @@ For architecture details, rendering pipeline, and plugin development, see [ARCHI
506
506
  This grid is built and maintained by a single developer in spare time. If it saves you time or money, consider sponsoring to keep development going:
507
507
 
508
508
  [![GitHub Sponsors](https://img.shields.io/badge/Sponsor_on_GitHub-ea4aaa?style=for-the-badge&logo=github)](https://github.com/sponsors/OysteinAmundsen)
509
- [![Patreon](https://img.shields.io/badge/Support_on_Patreon-f96854?style=for-the-badge&logo=patreon)](https://patreon.com/user?u=40656340)
509
+ [![Patreon](https://img.shields.io/badge/Support_on_Patreon-f96854?style=for-the-badge&logo=patreon)](https://www.patreon.com/c/OysteinAmundsen)
510
510
 
511
511
  **What sponsorship enables:**
512
512
 
package/all.d.ts CHANGED
@@ -6,6 +6,12 @@ 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
+
12
+ /** Available aggregation function types */
13
+ declare type AggFunc_2 = 'sum' | 'avg' | 'count' | 'min' | 'max' | 'first' | 'last';
14
+
9
15
  /**
10
16
  * Configuration for an aggregation row (footer/header row with computed values).
11
17
  * Replaces the core FooterRowConfig functionality.
@@ -1494,8 +1500,6 @@ export declare interface ChangedRowsResetDetail<TRow = any> {
1494
1500
  */
1495
1501
  /** Configuration options for the clipboard plugin */
1496
1502
  declare interface ClipboardConfig {
1497
- /** Whether clipboard functionality is enabled (default: true) */
1498
- enabled?: boolean;
1499
1503
  /** Include column headers in copied text (default: false) */
1500
1504
  includeHeaders?: boolean;
1501
1505
  /** Column delimiter character (default: '\t' for tab) */
@@ -1751,8 +1755,6 @@ declare type ColumnViewRenderer_2<TRow = any, TValue = any> = (ctx: CellRenderCo
1751
1755
  */
1752
1756
  /** Configuration options for the column virtualization plugin */
1753
1757
  declare interface ColumnVirtualizationConfig {
1754
- /** Whether the plugin is enabled (default: true) */
1755
- enabled?: boolean;
1756
1758
  /** Auto-enable when column count exceeds threshold (default: true) */
1757
1759
  autoEnable?: boolean;
1758
1760
  /** Column count threshold for auto-enabling (default: 30) */
@@ -1816,8 +1818,6 @@ export declare class ColumnVirtualizationPlugin extends BaseGridPlugin_2<ColumnV
1816
1818
  * Configuration options for the context menu plugin.
1817
1819
  */
1818
1820
  declare interface ContextMenuConfig {
1819
- /** Whether the context menu is enabled (default: true) */
1820
- enabled?: boolean;
1821
1821
  /** Menu items - static array or function returning items */
1822
1822
  items?: ContextMenuItem_3[] | ((params: ContextMenuParams_3) => ContextMenuItem_3[]);
1823
1823
  }
@@ -1959,6 +1959,11 @@ export declare class ContextMenuPlugin extends BaseGridPlugin_2<ContextMenuConfi
1959
1959
  attach(grid: GridElement_2): void;
1960
1960
  detach(): void;
1961
1961
  private installGlobalHandlers;
1962
+ /**
1963
+ * Clean up global handlers when the last instance detaches.
1964
+ * Uses reference counting to ensure handlers persist while any grid uses the plugin.
1965
+ */
1966
+ private uninstallGlobalHandlers;
1962
1967
  afterRender(): void;
1963
1968
  /**
1964
1969
  * Programmatically show the context menu at the specified position.
@@ -2207,23 +2212,37 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
2207
2212
  * Clears all user modifications (order, width, visibility, sort).
2208
2213
  */
2209
2214
  resetColumnState(): void;
2215
+ /**
2216
+ * Check if the tool panel is currently open.
2217
+ */
2218
+ get isToolPanelOpen(): boolean;
2210
2219
  /**
2211
2220
  * Get the currently active tool panel ID, or null if none is open.
2221
+ * @deprecated Use isToolPanelOpen and expandedToolPanelSections instead.
2212
2222
  */
2213
2223
  get activeToolPanel(): string | null;
2214
2224
  /**
2215
- * Open a tool panel by ID.
2216
- * Closes any currently open panel first.
2225
+ * Get the IDs of expanded accordion sections.
2226
+ */
2227
+ get expandedToolPanelSections(): string[];
2228
+ /**
2229
+ * Open the tool panel (accordion view with all registered panels).
2217
2230
  */
2218
- openToolPanel(panelId: string): void;
2231
+ openToolPanel(): void;
2219
2232
  /**
2220
- * Close the currently open tool panel.
2233
+ * Close the tool panel.
2221
2234
  */
2222
2235
  closeToolPanel(): void;
2223
2236
  /**
2224
- * Toggle a tool panel open/closed.
2237
+ * Toggle the tool panel open/closed.
2238
+ */
2239
+ toggleToolPanel(): void;
2240
+ /**
2241
+ * Toggle an accordion section expanded/collapsed.
2242
+ * Only one section can be expanded at a time (exclusive accordion).
2243
+ * When there's only one panel, toggling is disabled (always expanded).
2225
2244
  */
2226
- toggleToolPanel(panelId: string): void;
2245
+ toggleToolPanelSection(sectionId: string): void;
2227
2246
  /**
2228
2247
  * Get registered tool panel definitions.
2229
2248
  */
@@ -2364,8 +2383,6 @@ declare interface EditorExecContext<T = any> extends CellContext<T> {
2364
2383
 
2365
2384
  /** Configuration options for the export plugin */
2366
2385
  declare interface ExportConfig {
2367
- /** Whether export is enabled (default: true) */
2368
- enabled?: boolean;
2369
2386
  /** Default file name for exports (default: 'export') */
2370
2387
  fileName?: string;
2371
2388
  /** Include column headers in export (default: true) */
@@ -2505,8 +2522,6 @@ export declare interface ExternalMountViewDetail<TRow = any> {
2505
2522
 
2506
2523
  /** Configuration options for the filtering plugin */
2507
2524
  export declare interface FilterConfig {
2508
- /** Whether filtering is enabled (default: true) */
2509
- enabled?: boolean;
2510
2525
  /** Debounce delay in ms for filter input (default: 300) */
2511
2526
  debounceMs?: number;
2512
2527
  /** Whether text filtering is case sensitive (default: false) */
@@ -2521,8 +2536,6 @@ export declare interface FilterConfig {
2521
2536
 
2522
2537
  /** Configuration options for the filtering plugin */
2523
2538
  declare interface FilterConfig_2 {
2524
- /** Whether filtering is enabled (default: true) */
2525
- enabled?: boolean;
2526
2539
  /** Debounce delay in ms for filter input (default: 300) */
2527
2540
  debounceMs?: number;
2528
2541
  /** Whether text filtering is case sensitive (default: false) */
@@ -2645,7 +2658,7 @@ export declare class FilteringPlugin extends BaseGridPlugin_2<FilterConfig_2> {
2645
2658
  * Apply filter state from column state.
2646
2659
  */
2647
2660
  applyColumnState(field: string, state: ColumnState_2): void;
2648
- readonly styles = "\n .header-cell.filtered::before {\n content: '';\n position: absolute;\n top: 4px;\n right: 4px;\n width: 6px;\n height: 6px;\n background: var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));\n border-radius: 50%;\n }\n .tbw-filter-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 2px;\n margin-left: 4px;\n opacity: 0.4;\n transition: opacity 0.15s;\n color: inherit;\n vertical-align: middle;\n }\n .tbw-filter-btn:hover,\n .tbw-filter-btn.active {\n opacity: 1;\n }\n .tbw-filter-btn.active {\n color: var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));\n }\n ";
2661
+ readonly styles: string;
2649
2662
  }
2650
2663
 
2651
2664
  /** Filter model representing a single filter condition */
@@ -2795,6 +2808,15 @@ declare interface GetRowsResult_2 {
2795
2808
  lastRow?: number;
2796
2809
  }
2797
2810
 
2811
+ /**
2812
+ * Get a value-based aggregator function.
2813
+ * Used by Pivot plugin and other features that aggregate pre-extracted values.
2814
+ *
2815
+ * @param aggFunc - Aggregation function name ('sum', 'avg', 'count', 'min', 'max', 'first', 'last')
2816
+ * @returns Aggregator function that takes number[] and returns number
2817
+ */
2818
+ export declare function getValueAggregator(aggFunc: string): ValueAggregatorFn;
2819
+
2798
2820
  /**
2799
2821
  * CSS class names used in the grid's shadow DOM.
2800
2822
  * Use these when adding/removing classes or querying elements.
@@ -3005,6 +3027,8 @@ export declare interface GridIcons {
3005
3027
  submenuArrow?: IconValue;
3006
3028
  /** Drag handle icon for reordering. Default: '⋮⋮' */
3007
3029
  dragHandle?: IconValue;
3030
+ /** Tool panel toggle icon in toolbar. Default: '☰' */
3031
+ toolPanel?: IconValue;
3008
3032
  }
3009
3033
 
3010
3034
  /**
@@ -3026,6 +3050,8 @@ declare interface GridIcons_2 {
3026
3050
  submenuArrow?: IconValue_2;
3027
3051
  /** Drag handle icon for reordering. Default: '⋮⋮' */
3028
3052
  dragHandle?: IconValue_2;
3053
+ /** Tool panel toggle icon in toolbar. Default: '☰' */
3054
+ toolPanel?: IconValue_2;
3029
3055
  }
3030
3056
 
3031
3057
  /**
@@ -3065,8 +3091,6 @@ declare interface GroupHeaderRenderParams {
3065
3091
 
3066
3092
  /** Configuration options for the column groups plugin */
3067
3093
  declare interface GroupingColumnsConfig {
3068
- /** Whether the plugin is enabled (default: true) */
3069
- enabled?: boolean;
3070
3094
  /** Custom group header renderer */
3071
3095
  groupHeaderRenderer?: (params: GroupHeaderRenderParams) => HTMLElement | string | void;
3072
3096
  /** Whether to show group borders (default: true) */
@@ -3117,13 +3141,11 @@ export declare class GroupingColumnsPlugin extends BaseGridPlugin_2<GroupingColu
3117
3141
  * Refresh column groups (recompute from current columns).
3118
3142
  */
3119
3143
  refresh(): void;
3120
- readonly styles = "\n .header-group-row {\n display: grid;\n grid-auto-flow: column;\n background: var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));\n border-bottom: 1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border));\n }\n .header-group-cell {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 4px 8px;\n font-weight: 600;\n font-size: 0.9em;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n border-right: 1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border));\n }\n .header-group-cell:last-child {\n border-right: none;\n }\n .header-row .cell.grouped {\n border-top: none;\n }\n .header-row .cell.group-end {\n border-right: 2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong));\n }\n ";
3144
+ readonly styles: string;
3121
3145
  }
3122
3146
 
3123
3147
  /** Configuration options for the row grouping plugin */
3124
3148
  export declare interface GroupingRowsConfig {
3125
- /** Whether the plugin is enabled (default: true) */
3126
- enabled?: boolean;
3127
3149
  /**
3128
3150
  * Callback to determine group path for a row.
3129
3151
  * Return an array of group keys, a single key, null/false to skip grouping.
@@ -3147,8 +3169,6 @@ export declare interface GroupingRowsConfig {
3147
3169
 
3148
3170
  /** Configuration options for the row grouping plugin */
3149
3171
  declare interface GroupingRowsConfig_2 {
3150
- /** Whether the plugin is enabled (default: true) */
3151
- enabled?: boolean;
3152
3172
  /**
3153
3173
  * Callback to determine group path for a row.
3154
3174
  * Return an array of group keys, a single key, null/false to skip grouping.
@@ -3269,7 +3289,7 @@ export declare class GroupingRowsPlugin extends BaseGridPlugin_2<GroupingRowsCon
3269
3289
  * @param fn - The groupOn function or undefined to disable
3270
3290
  */
3271
3291
  setGroupOn(fn: ((row: any) => any[] | any | null | false) | undefined): void;
3272
- readonly styles = "\n .group-row {\n background: var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));\n font-weight: 500;\n }\n .group-row:hover {\n background: var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover));\n }\n .group-toggle {\n cursor: pointer;\n user-select: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n margin-right: 4px;\n font-size: 10px;\n }\n .group-toggle:hover {\n background: var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));\n border-radius: 2px;\n }\n .group-label {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n }\n .group-count {\n color: var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));\n font-size: 0.85em;\n font-weight: normal;\n }\n [data-group-depth=\"0\"] .group-label { padding-left: 0; }\n [data-group-depth=\"1\"] .group-label { padding-left: 20px; }\n [data-group-depth=\"2\"] .group-label { padding-left: 40px; }\n [data-group-depth=\"3\"] .group-label { padding-left: 60px; }\n [data-group-depth=\"4\"] .group-label { padding-left: 80px; }\n ";
3292
+ readonly styles: string;
3273
3293
  }
3274
3294
 
3275
3295
  /** Group row model item */
@@ -3467,8 +3487,6 @@ export declare const listAggregators: () => string[];
3467
3487
  */
3468
3488
  /** Configuration options for the master-detail plugin */
3469
3489
  declare interface MasterDetailConfig {
3470
- /** Whether master-detail functionality is enabled (default: true) */
3471
- enabled?: boolean;
3472
3490
  /** Renderer function that returns detail content for a row */
3473
3491
  detailRenderer?: (row: any, rowIndex: number) => HTMLElement | string;
3474
3492
  /** Height of the detail row - number (pixels) or 'auto' (default: 'auto') */
@@ -3565,13 +3583,11 @@ export declare class MasterDetailPlugin extends BaseGridPlugin_2<MasterDetailCon
3565
3583
  * @returns The detail HTMLElement or undefined
3566
3584
  */
3567
3585
  getDetailElement(rowIndex: number): HTMLElement | undefined;
3568
- readonly styles = "\n .master-detail-cell-wrapper {\n display: flex;\n align-items: center;\n gap: 4px;\n }\n .master-detail-toggle {\n cursor: pointer;\n font-size: 10px;\n opacity: 0.7;\n user-select: none;\n }\n .master-detail-toggle:hover {\n opacity: 1;\n }\n .master-detail-row {\n grid-column: 1 / -1;\n display: grid;\n background: var(--tbw-master-detail-bg, var(--tbw-color-row-alt));\n border-bottom: 1px solid var(--tbw-master-detail-border, var(--tbw-color-border));\n }\n .master-detail-cell {\n padding: 16px;\n overflow: auto;\n }\n ";
3586
+ readonly styles: string;
3569
3587
  }
3570
3588
 
3571
3589
  /** Configuration options for the multi-sort plugin */
3572
3590
  export declare interface MultiSortConfig {
3573
- /** Whether multi-sort is enabled (default: true) */
3574
- enabled?: boolean;
3575
3591
  /** Maximum number of columns to sort by (default: 3) */
3576
3592
  maxSortColumns?: number;
3577
3593
  /** Whether to show sort order badges (1, 2, 3) on headers (default: true) */
@@ -3580,8 +3596,6 @@ export declare interface MultiSortConfig {
3580
3596
 
3581
3597
  /** Configuration options for the multi-sort plugin */
3582
3598
  declare interface MultiSortConfig_2 {
3583
- /** Whether multi-sort is enabled (default: true) */
3584
- enabled?: boolean;
3585
3599
  /** Maximum number of columns to sort by (default: 3) */
3586
3600
  maxSortColumns?: number;
3587
3601
  /** Whether to show sort order badges (1, 2, 3) on headers (default: true) */
@@ -3640,7 +3654,7 @@ export declare class MultiSortPlugin extends BaseGridPlugin_2<MultiSortConfig_2>
3640
3654
  * Rebuilds the sort model from all column states.
3641
3655
  */
3642
3656
  applyColumnState(field: string, state: ColumnState_2): void;
3643
- readonly styles = "\n .header-cell[data-sort=\"asc\"]::after {\n content: '\u2191';\n margin-left: 4px;\n opacity: 0.8;\n }\n .header-cell[data-sort=\"desc\"]::after {\n content: '\u2193';\n margin-left: 4px;\n opacity: 0.8;\n }\n .sort-index {\n font-size: 10px;\n background: var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));\n color: var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));\n border-radius: 50%;\n width: 14px;\n height: 14px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: 2px;\n font-weight: 600;\n }\n ";
3657
+ readonly styles: string;
3644
3658
  }
3645
3659
 
3646
3660
  /**
@@ -3650,8 +3664,6 @@ export declare class MultiSortPlugin extends BaseGridPlugin_2<MultiSortConfig_2>
3650
3664
  */
3651
3665
  /** Configuration options for the pinned columns plugin */
3652
3666
  declare interface PinnedColumnsConfig {
3653
- /** Whether the plugin is enabled (default: true) */
3654
- enabled?: boolean;
3655
3667
  }
3656
3668
 
3657
3669
  /**
@@ -3698,8 +3710,6 @@ export declare class PinnedColumnsPlugin extends BaseGridPlugin_2<PinnedColumnsC
3698
3710
 
3699
3711
  /** Configuration options for the status bar plugin */
3700
3712
  declare interface PinnedRowsConfig {
3701
- /** Whether the status bar is enabled (default: false) */
3702
- enabled?: boolean;
3703
3713
  /** Position of the info bar (default: 'bottom') */
3704
3714
  position?: PinnedRowsPosition;
3705
3715
  /** Show total row count in info bar (default: true) */
@@ -3825,28 +3835,38 @@ export declare class PinnedRowsPlugin extends BaseGridPlugin_2<PinnedRowsConfig>
3825
3835
  * @param id - The aggregation row ID to remove
3826
3836
  */
3827
3837
  removeAggregationRow(id: string): void;
3828
- readonly styles = "\n .tbw-footer {\n position: sticky;\n bottom: 0;\n z-index: var(--tbw-z-layer-pinned-rows, 20);\n background: var(--tbw-color-panel-bg);\n }\n\n .tbw-pinned-rows {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 12px;\n background: var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));\n border-top: 1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));\n font-size: 12px;\n color: var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));\n min-height: 32px;\n box-sizing: border-box;\n min-width: fit-content;\n }\n .tbw-pinned-rows-left,\n .tbw-pinned-rows-center,\n .tbw-pinned-rows-right {\n display: flex;\n align-items: center;\n gap: 16px;\n }\n .tbw-pinned-rows-left {\n justify-content: flex-start;\n }\n .tbw-pinned-rows-center {\n justify-content: center;\n flex: 1;\n }\n .tbw-pinned-rows-right {\n justify-content: flex-end;\n }\n .tbw-status-panel {\n white-space: nowrap;\n }\n\n .tbw-aggregation-rows {\n min-width: fit-content;\n background: var(--tbw-aggregation-bg, var(--tbw-color-header-bg));\n }\n .tbw-aggregation-rows-top {\n border-bottom: 1px solid var(--tbw-aggregation-border, var(--tbw-color-border));\n }\n .tbw-aggregation-rows-bottom {\n border-top: 1px solid var(--tbw-aggregation-border, var(--tbw-color-border));\n }\n .tbw-aggregation-row {\n display: grid;\n grid-template-columns: var(--tbw-column-template);\n font-weight: var(--tbw-aggregation-font-weight, 600);\n }\n .tbw-aggregation-cell {\n padding: var(--tbw-cell-padding, 2px 8px);\n min-height: var(--tbw-row-height, 28px);\n display: flex;\n align-items: center;\n border-right: 1px solid var(--tbw-color-border-cell);\n }\n .tbw-aggregation-cell:last-child {\n border-right: 0;\n }\n .tbw-aggregation-cell-full {\n grid-column: 1 / -1;\n border-right: 0;\n }\n ";
3838
+ readonly styles: string;
3829
3839
  }
3830
3840
 
3831
3841
  /** Position of the status bar relative to the grid */
3832
3842
  declare type PinnedRowsPosition = 'top' | 'bottom';
3833
3843
 
3834
3844
  export declare interface PivotConfig {
3835
- enabled?: boolean;
3845
+ /** Whether pivot view is active on load (default: true when fields are configured) */
3846
+ active?: boolean;
3836
3847
  rowGroupFields?: string[];
3837
3848
  columnGroupFields?: string[];
3838
3849
  valueFields?: PivotValueField[];
3839
3850
  showTotals?: boolean;
3840
3851
  showGrandTotal?: boolean;
3852
+ /** Whether groups are expanded by default (default: true) */
3853
+ defaultExpanded?: boolean;
3854
+ /** Indent width per depth level in pixels (default: 20) */
3855
+ indentWidth?: number;
3841
3856
  }
3842
3857
 
3843
3858
  declare interface PivotConfig_2 {
3844
- enabled?: boolean;
3859
+ /** Whether pivot view is active on load (default: true when fields are configured) */
3860
+ active?: boolean;
3845
3861
  rowGroupFields?: string[];
3846
3862
  columnGroupFields?: string[];
3847
3863
  valueFields?: PivotValueField_2[];
3848
3864
  showTotals?: boolean;
3849
3865
  showGrandTotal?: boolean;
3866
+ /** Whether groups are expanded by default (default: true) */
3867
+ defaultExpanded?: boolean;
3868
+ /** Indent width per depth level in pixels (default: 20) */
3869
+ indentWidth?: number;
3850
3870
  }
3851
3871
 
3852
3872
  declare type PivotDataRow = Record<string, unknown>;
@@ -3866,50 +3886,73 @@ declare type PivotDataRow = Record<string, unknown>;
3866
3886
  export declare class PivotPlugin extends BaseGridPlugin_2<PivotConfig_2> {
3867
3887
  readonly name = "pivot";
3868
3888
  readonly version = "1.0.0";
3889
+ /** Tool panel ID for shell integration */
3890
+ static readonly PANEL_ID = "pivot";
3869
3891
  protected get defaultConfig(): Partial<PivotConfig_2>;
3870
3892
  private isActive;
3893
+ private hasInitialized;
3871
3894
  private pivotResult;
3872
- private columnHeaders;
3873
- private rowHeaders;
3895
+ private fieldHeaderMap;
3896
+ private expandedKeys;
3897
+ private defaultExpanded;
3898
+ private originalColumns;
3899
+ private panelContainer;
3900
+ private grandTotalFooter;
3901
+ /**
3902
+ * Check if the plugin has valid pivot configuration (at least value fields).
3903
+ */
3904
+ private hasValidPivotConfig;
3874
3905
  detach(): void;
3906
+ getToolPanel(): ToolPanelDefinition_2 | undefined;
3875
3907
  processRows(rows: readonly unknown[]): PivotDataRow[];
3876
3908
  processColumns(columns: readonly ColumnConfig_2[]): ColumnConfig_2[];
3909
+ renderRow(row: Record<string, unknown>, rowEl: HTMLElement): boolean;
3877
3910
  /**
3878
- * Enable pivot mode.
3911
+ * Remove pivot-specific classes, attributes, and inline styles from a row element.
3912
+ * Called when pivot mode is disabled to clean up reused DOM elements.
3913
+ * Clears innerHTML so the grid's default renderer can rebuild the row.
3879
3914
  */
3880
- enablePivot(): void;
3915
+ private cleanupPivotStyling;
3916
+ afterRender(): void;
3881
3917
  /**
3882
- * Disable pivot mode and return to normal grid view.
3918
+ * Render the grand total row as a sticky footer pinned to the bottom.
3883
3919
  */
3884
- disablePivot(): void;
3920
+ private renderGrandTotalFooter;
3885
3921
  /**
3886
- * Check if pivot mode is currently active.
3922
+ * Remove the grand total footer element.
3887
3923
  */
3924
+ private cleanupGrandTotalFooter;
3925
+ toggle(key: string): void;
3926
+ expand(key: string): void;
3927
+ collapse(key: string): void;
3928
+ expandAll(): void;
3929
+ collapseAll(): void;
3930
+ isExpanded(key: string): boolean;
3931
+ enablePivot(): void;
3932
+ disablePivot(): void;
3888
3933
  isPivotActive(): boolean;
3889
- /**
3890
- * Get the current pivot result.
3891
- */
3892
3934
  getPivotResult(): PivotResult_2 | null;
3893
- /**
3894
- * Set the row group fields for pivoting.
3895
- * @param fields - Array of field names to group rows by
3896
- */
3897
3935
  setRowGroupFields(fields: string[]): void;
3898
- /**
3899
- * Set the column group fields for pivoting.
3900
- * @param fields - Array of field names to create columns from
3901
- */
3902
3936
  setColumnGroupFields(fields: string[]): void;
3903
- /**
3904
- * Set the value fields with aggregation functions.
3905
- * @param fields - Array of value field configurations
3906
- */
3907
3937
  setValueFields(fields: PivotValueField_2[]): void;
3908
- /**
3909
- * Refresh the pivot by clearing cached results.
3910
- */
3911
3938
  refresh(): void;
3912
- readonly styles = "\n [data-pivot-depth=\"1\"] { padding-left: 20px; }\n [data-pivot-depth=\"2\"] { padding-left: 40px; }\n [data-pivot-depth=\"3\"] { padding-left: 60px; }\n .pivot-group-row { font-weight: bold; background: var(--tbw-pivot-group-bg, var(--tbw-color-panel-bg)); }\n .pivot-total-row { font-weight: bold; border-top: 2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong)); }\n ";
3939
+ showPanel(): void;
3940
+ hidePanel(): void;
3941
+ togglePanel(): void;
3942
+ isPanelVisible(): boolean;
3943
+ private get gridColumns();
3944
+ private buildFieldHeaderMap;
3945
+ private getAvailableFields;
3946
+ private captureOriginalColumns;
3947
+ private renderPanel;
3948
+ private refreshPanel;
3949
+ private addFieldToZone;
3950
+ private removeFieldFromZone;
3951
+ private removeFromOtherZones;
3952
+ private addValueField;
3953
+ private removeValueField;
3954
+ private updateValueAggFunc;
3955
+ readonly styles: string;
3913
3956
  }
3914
3957
 
3915
3958
  export declare interface PivotResult {
@@ -3927,34 +3970,52 @@ declare interface PivotResult_2 {
3927
3970
  }
3928
3971
 
3929
3972
  declare interface PivotRow {
3973
+ /** Unique key for this row (hierarchical path) */
3930
3974
  rowKey: string;
3975
+ /** Display label for this row */
3931
3976
  rowLabel: string;
3977
+ /** Depth level (0 = top level) */
3932
3978
  depth: number;
3979
+ /** Aggregated values by column key */
3933
3980
  values: Record<string, number | null>;
3981
+ /** Row total across all columns */
3934
3982
  total?: number;
3983
+ /** Whether this row has children (is a group header) */
3935
3984
  isGroup: boolean;
3985
+ /** Child rows (for hierarchical grouping) */
3936
3986
  children?: PivotRow[];
3987
+ /** Number of data rows in this group */
3988
+ rowCount?: number;
3937
3989
  }
3938
3990
 
3939
3991
  declare interface PivotRow_2 {
3992
+ /** Unique key for this row (hierarchical path) */
3940
3993
  rowKey: string;
3994
+ /** Display label for this row */
3941
3995
  rowLabel: string;
3996
+ /** Depth level (0 = top level) */
3942
3997
  depth: number;
3998
+ /** Aggregated values by column key */
3943
3999
  values: Record<string, number | null>;
4000
+ /** Row total across all columns */
3944
4001
  total?: number;
4002
+ /** Whether this row has children (is a group header) */
3945
4003
  isGroup: boolean;
4004
+ /** Child rows (for hierarchical grouping) */
3946
4005
  children?: PivotRow_2[];
4006
+ /** Number of data rows in this group */
4007
+ rowCount?: number;
3947
4008
  }
3948
4009
 
3949
4010
  export declare interface PivotValueField {
3950
4011
  field: string;
3951
- aggFunc: 'sum' | 'avg' | 'count' | 'min' | 'max' | 'first' | 'last';
4012
+ aggFunc: AggFunc_2;
3952
4013
  header?: string;
3953
4014
  }
3954
4015
 
3955
4016
  declare interface PivotValueField_2 {
3956
4017
  field: string;
3957
- aggFunc: 'sum' | 'avg' | 'count' | 'min' | 'max' | 'first' | 'last';
4018
+ aggFunc: AggFunc;
3958
4019
  header?: string;
3959
4020
  }
3960
4021
 
@@ -4265,8 +4326,6 @@ declare type RenderRow = GroupRowModelItem | DataRowModelItem;
4265
4326
  */
4266
4327
  /** Configuration options for the reorder plugin */
4267
4328
  declare interface ReorderConfig {
4268
- /** Whether column reordering is enabled (default: true) */
4269
- enabled?: boolean;
4270
4329
  /** Whether to animate column movement (default: true) */
4271
4330
  animation?: boolean;
4272
4331
  /** Animation duration in milliseconds (default: 200) */
@@ -4316,7 +4375,7 @@ export declare class ReorderPlugin extends BaseGridPlugin_2<ReorderConfig> {
4316
4375
  * Reset column order to the original configuration order.
4317
4376
  */
4318
4377
  resetColumnOrder(): void;
4319
- readonly styles = "\n .header-row > .cell[draggable=\"true\"] {\n cursor: grab;\n position: relative;\n }\n .header-row > .cell.dragging {\n opacity: 0.5;\n cursor: grabbing;\n }\n .header-row > .cell.drop-before::before {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 2px;\n background: var(--tbw-reorder-indicator, var(--tbw-color-accent));\n z-index: 1;\n }\n .header-row > .cell.drop-after::after {\n content: '';\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n width: 2px;\n background: var(--tbw-reorder-indicator, var(--tbw-color-accent));\n z-index: 1;\n }\n ";
4378
+ readonly styles: string;
4320
4379
  }
4321
4380
 
4322
4381
  /** Controller managing drag-based column resize lifecycle. */
@@ -4378,6 +4437,15 @@ export declare interface RowGroupRenderConfig {
4378
4437
 
4379
4438
  export declare const runAggregator: (ref: AggregatorRef_2_2 | undefined, rows: any[], field: string, column?: any) => any;
4380
4439
 
4440
+ /**
4441
+ * Run a value-based aggregator on a set of values.
4442
+ *
4443
+ * @param aggFunc - Aggregation function name
4444
+ * @param values - Array of numbers to aggregate
4445
+ * @returns Aggregated result
4446
+ */
4447
+ export declare function runValueAggregator(aggFunc: string, values: number[]): number;
4448
+
4381
4449
  /**
4382
4450
  * Scroll event
4383
4451
  */
@@ -4524,11 +4592,10 @@ export declare class SelectionPlugin extends BaseGridPlugin_2<SelectionConfig_2>
4524
4592
  * Set selected ranges programmatically.
4525
4593
  */
4526
4594
  setRanges(ranges: CellRange_2[]): void;
4527
- 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 ";
4595
+ readonly styles: string;
4528
4596
  }
4529
4597
 
4530
4598
  declare interface ServerSideConfig {
4531
- enabled?: boolean;
4532
4599
  pageSize?: number;
4533
4600
  cacheBlockSize?: number;
4534
4601
  maxConcurrentRequests?: number;
@@ -4716,13 +4783,13 @@ export declare interface ToolPanelConfig {
4716
4783
  export declare interface ToolPanelDefinition {
4717
4784
  /** Unique panel ID */
4718
4785
  id: string;
4719
- /** Panel title shown in header */
4786
+ /** Panel title shown in accordion header */
4720
4787
  title: string;
4721
- /** Icon for toolbar button (SVG string or emoji) */
4722
- icon: string;
4723
- /** Toolbar button tooltip */
4788
+ /** Icon for accordion section header (optional, emoji or SVG) */
4789
+ icon?: string;
4790
+ /** Tooltip for accordion section header */
4724
4791
  tooltip?: string;
4725
- /** Panel content factory - called when panel opens */
4792
+ /** Panel content factory - called when panel section opens */
4726
4793
  render: (container: HTMLElement) => void | (() => void);
4727
4794
  /** Called when panel closes (for cleanup) */
4728
4795
  onClose?: () => void;
@@ -4736,13 +4803,13 @@ export declare interface ToolPanelDefinition {
4736
4803
  declare interface ToolPanelDefinition_2 {
4737
4804
  /** Unique panel ID */
4738
4805
  id: string;
4739
- /** Panel title shown in header */
4806
+ /** Panel title shown in accordion header */
4740
4807
  title: string;
4741
- /** Icon for toolbar button (SVG string or emoji) */
4742
- icon: string;
4743
- /** Toolbar button tooltip */
4808
+ /** Icon for accordion section header (optional, emoji or SVG) */
4809
+ icon?: string;
4810
+ /** Tooltip for accordion section header */
4744
4811
  tooltip?: string;
4745
- /** Panel content factory - called when panel opens */
4812
+ /** Panel content factory - called when panel section opens */
4746
4813
  render: (container: HTMLElement) => void | (() => void);
4747
4814
  /** Called when panel closes (for cleanup) */
4748
4815
  onClose?: () => void;
@@ -4757,8 +4824,6 @@ declare interface ToolPanelDefinition_2 {
4757
4824
  */
4758
4825
  /** Configuration options for the tree plugin */
4759
4826
  export declare interface TreeConfig {
4760
- /** Whether tree functionality is enabled (default: true) */
4761
- enabled?: boolean;
4762
4827
  /** Field name containing child rows (default: 'children') */
4763
4828
  childrenField?: string;
4764
4829
  /** Auto-detect tree structure from data (default: true) */
@@ -4778,8 +4843,6 @@ export declare interface TreeConfig {
4778
4843
  */
4779
4844
  /** Configuration options for the tree plugin */
4780
4845
  declare interface TreeConfig_2 {
4781
- /** Whether tree functionality is enabled (default: true) */
4782
- enabled?: boolean;
4783
4846
  /** Field name containing child rows (default: 'children') */
4784
4847
  childrenField?: string;
4785
4848
  /** Auto-detect tree structure from data (default: true) */
@@ -4875,7 +4938,7 @@ export declare class TreePlugin extends BaseGridPlugin_2<TreeConfig_2> {
4875
4938
  * Expand all ancestors of a node to make it visible.
4876
4939
  */
4877
4940
  expandToKey(key: string): void;
4878
- 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 ";
4941
+ readonly styles: string;
4879
4942
  }
4880
4943
 
4881
4944
  /**
@@ -4886,8 +4949,6 @@ export declare class TreePlugin extends BaseGridPlugin_2<TreeConfig_2> {
4886
4949
  */
4887
4950
  /** Configuration for the undo/redo plugin */
4888
4951
  declare interface UndoRedoConfig {
4889
- /** Whether the plugin is enabled. Default: true */
4890
- enabled?: boolean;
4891
4952
  /** Maximum number of actions to keep in history. Default: 100 */
4892
4953
  maxHistorySize?: number;
4893
4954
  }
@@ -4960,6 +5021,8 @@ export declare class UndoRedoPlugin extends BaseGridPlugin_2<UndoRedoConfig> {
4960
5021
 
4961
5022
  export declare const unregisterAggregator: (name: string) => void;
4962
5023
 
5024
+ export declare type ValueAggregatorFn = (values: number[]) => number;
5025
+
4963
5026
  /** Virtual window bookkeeping; modified in-place as scroll position changes. */
4964
5027
  declare interface VirtualState {
4965
5028
  enabled: boolean;
@@ -4983,8 +5046,6 @@ declare interface VirtualState {
4983
5046
  */
4984
5047
  /** Configuration options for the visibility plugin */
4985
5048
  declare interface VisibilityConfig {
4986
- /** Whether visibility control is enabled (default: true) */
4987
- enabled?: boolean;
4988
5049
  /** Allow hiding all columns (default: false) */
4989
5050
  allowHideAll?: boolean;
4990
5051
  }
@@ -5107,7 +5168,7 @@ export declare class VisibilityPlugin extends BaseGridPlugin_2<VisibilityConfig>
5107
5168
  * On drop, emits a 'column-reorder-request' event for other plugins to handle.
5108
5169
  */
5109
5170
  private setupDragListeners;
5110
- readonly styles = "\n .tbw-visibility-content {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .tbw-visibility-list {\n flex: 1;\n overflow-y: auto;\n padding: 8px;\n }\n\n .tbw-visibility-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 4px;\n cursor: pointer;\n font-size: 13px;\n border-radius: var(--tbw-border-radius, 4px);\n position: relative;\n }\n .tbw-visibility-row:hover {\n background: var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6));\n }\n .tbw-visibility-row input[type=\"checkbox\"] {\n cursor: pointer;\n }\n .tbw-visibility-row.locked span {\n color: var(--tbw-color-fg-muted, #888);\n }\n\n /* Drag handle */\n .tbw-visibility-handle {\n cursor: grab;\n color: var(--tbw-color-fg-muted, #888);\n font-size: 10px;\n letter-spacing: -2px;\n user-select: none;\n flex-shrink: 0;\n }\n .tbw-visibility-row.reorderable:hover .tbw-visibility-handle {\n color: var(--tbw-color-fg, #1f2937);\n }\n\n /* Label wrapper for checkbox and text */\n .tbw-visibility-label {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n cursor: pointer;\n }\n\n /* Drag states */\n .tbw-visibility-row.dragging {\n opacity: 0.5;\n cursor: grabbing;\n }\n .tbw-visibility-row.drop-before::before {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n height: 2px;\n background: var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6));\n }\n .tbw-visibility-row.drop-after::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 2px;\n background: var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6));\n }\n\n .tbw-visibility-show-all {\n margin: 8px;\n padding: 8px 12px;\n border: 1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));\n border-radius: var(--tbw-border-radius, 4px);\n background: var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));\n color: var(--tbw-color-fg, #1f2937);\n cursor: pointer;\n font-size: 13px;\n }\n .tbw-visibility-show-all:hover {\n background: var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6));\n }\n ";
5171
+ readonly styles: string;
5111
5172
  }
5112
5173
 
5113
5174
  export { }