@toolbox-web/grid 0.2.4 → 0.2.6

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 (67) hide show
  1. package/all.d.ts +61 -23
  2. package/all.js +841 -809
  3. package/all.js.map +1 -1
  4. package/index.d.ts +17 -5
  5. package/index.js +316 -247
  6. package/index.js.map +1 -1
  7. package/lib/plugins/clipboard/index.js +1 -1
  8. package/lib/plugins/clipboard/index.js.map +1 -1
  9. package/lib/plugins/column-virtualization/index.js +1 -1
  10. package/lib/plugins/column-virtualization/index.js.map +1 -1
  11. package/lib/plugins/context-menu/index.js +1 -1
  12. package/lib/plugins/context-menu/index.js.map +1 -1
  13. package/lib/plugins/export/index.js +1 -1
  14. package/lib/plugins/export/index.js.map +1 -1
  15. package/lib/plugins/filtering/index.js +1 -1
  16. package/lib/plugins/filtering/index.js.map +1 -1
  17. package/lib/plugins/grouping-columns/index.js +46 -45
  18. package/lib/plugins/grouping-columns/index.js.map +1 -1
  19. package/lib/plugins/grouping-rows/index.js +1 -1
  20. package/lib/plugins/grouping-rows/index.js.map +1 -1
  21. package/lib/plugins/master-detail/index.js +1 -1
  22. package/lib/plugins/master-detail/index.js.map +1 -1
  23. package/lib/plugins/multi-sort/index.js +1 -1
  24. package/lib/plugins/multi-sort/index.js.map +1 -1
  25. package/lib/plugins/pinned-columns/index.js +1 -1
  26. package/lib/plugins/pinned-columns/index.js.map +1 -1
  27. package/lib/plugins/pinned-rows/index.js +55 -47
  28. package/lib/plugins/pinned-rows/index.js.map +1 -1
  29. package/lib/plugins/pivot/index.js +243 -241
  30. package/lib/plugins/pivot/index.js.map +1 -1
  31. package/lib/plugins/reorder/index.js +87 -67
  32. package/lib/plugins/reorder/index.js.map +1 -1
  33. package/lib/plugins/selection/index.js +28 -27
  34. package/lib/plugins/selection/index.js.map +1 -1
  35. package/lib/plugins/server-side/index.js +2 -2
  36. package/lib/plugins/server-side/index.js.map +1 -1
  37. package/lib/plugins/tree/index.js +70 -70
  38. package/lib/plugins/tree/index.js.map +1 -1
  39. package/lib/plugins/undo-redo/index.js +1 -1
  40. package/lib/plugins/undo-redo/index.js.map +1 -1
  41. package/lib/plugins/visibility/index.js +1 -1
  42. package/lib/plugins/visibility/index.js.map +1 -1
  43. package/package.json +1 -1
  44. package/themes/dg-theme-bootstrap.css +0 -2
  45. package/themes/dg-theme-contrast.css +0 -1
  46. package/themes/dg-theme-large.css +0 -1
  47. package/themes/dg-theme-material.css +0 -2
  48. package/themes/dg-theme-standard.css +0 -1
  49. package/themes/dg-theme-vibrant.css +0 -1
  50. package/umd/grid.all.umd.js +13 -13
  51. package/umd/grid.all.umd.js.map +1 -1
  52. package/umd/grid.umd.js +7 -7
  53. package/umd/grid.umd.js.map +1 -1
  54. package/umd/plugins/grouping-columns.umd.js +1 -1
  55. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  56. package/umd/plugins/pinned-rows.umd.js +1 -1
  57. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  58. package/umd/plugins/pivot.umd.js +1 -1
  59. package/umd/plugins/pivot.umd.js.map +1 -1
  60. package/umd/plugins/reorder.umd.js +1 -1
  61. package/umd/plugins/reorder.umd.js.map +1 -1
  62. package/umd/plugins/selection.umd.js +1 -1
  63. package/umd/plugins/selection.umd.js.map +1 -1
  64. package/umd/plugins/server-side.umd.js +1 -1
  65. package/umd/plugins/server-side.umd.js.map +1 -1
  66. package/umd/plugins/tree.umd.js +1 -1
  67. package/umd/plugins/tree.umd.js.map +1 -1
package/all.d.ts CHANGED
@@ -27,10 +27,29 @@ declare interface AggregationRowConfig {
27
27
  label?: string;
28
28
  /** Static or computed cell values keyed by field */
29
29
  cells?: Record<string, unknown | string | ((rows: unknown[], field: string, column?: ColumnConfig_2) => unknown)>;
30
- /** Per-field aggregator override; string maps to registered aggregator key */
31
- aggregators?: Record<string, AggregatorRef_3>;
30
+ /**
31
+ * Per-field aggregator configuration.
32
+ * Can be a simple string ('sum', 'avg', etc.), a function, or an object with aggFunc and formatter.
33
+ * @example
34
+ * aggregators: {
35
+ * quantity: 'sum', // simple built-in
36
+ * price: { aggFunc: 'sum', formatter: (v) => `$${v.toFixed(2)}` } // with formatter
37
+ * }
38
+ */
39
+ aggregators?: Record<string, AggregatorDefinition>;
32
40
  }
33
41
 
42
+ /** Full aggregator config with optional formatter */
43
+ declare interface AggregatorConfig {
44
+ /** The aggregator function or built-in key ('sum', 'avg', 'min', 'max', 'count', 'first', 'last') */
45
+ aggFunc: AggregatorRef_3;
46
+ /** Optional formatter to format the computed value for display */
47
+ formatter?: AggregatorFormatter;
48
+ }
49
+
50
+ /** Aggregator definition - simple string/function or full config object */
51
+ declare type AggregatorDefinition = AggregatorRef_3 | AggregatorConfig;
52
+
34
53
  /**
35
54
  * Aggregators Core Registry
36
55
  *
@@ -59,6 +78,12 @@ export declare type AggregatorFn = (rows: any[], field: string, column?: any) =>
59
78
  */
60
79
  declare type AggregatorFn_2 = (rows: any[], field: string, column?: any) => any;
61
80
 
81
+ /** Aggregator function signature */
82
+ declare type AggregatorFn_3 = (rows: unknown[], field: string, column?: ColumnConfig_2) => unknown;
83
+
84
+ /** Aggregator formatter function - formats the computed value for display */
85
+ declare type AggregatorFormatter = (value: unknown, field: string, column?: ColumnConfig_2) => string;
86
+
62
87
  /** Map of field names to aggregator references */
63
88
  declare type AggregatorMap = Record<string, AggregatorRef_2>;
64
89
 
@@ -71,8 +96,8 @@ declare type AggregatorRef_2 = string | AggregatorFn_2;
71
96
 
72
97
  declare type AggregatorRef_2_2 = string | AggregatorFn;
73
98
 
74
- /** Aggregator reference - string key for built-in or custom function */
75
- declare type AggregatorRef_3 = string | ((rows: unknown[], field: string, column?: ColumnConfig_2) => unknown);
99
+ /** Simple aggregator reference - string key for built-in or custom function */
100
+ declare type AggregatorRef_3 = string | AggregatorFn_3;
76
101
 
77
102
  /**
78
103
  * The aggregator registry singleton.
@@ -169,7 +194,7 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> implements GridP
169
194
  /** Plugin configuration - merged with defaults in attach() */
170
195
  protected config: TConfig;
171
196
  /** User-provided configuration from constructor */
172
- private readonly userConfig;
197
+ protected readonly userConfig: Partial<TConfig>;
173
198
  /**
174
199
  * Default configuration - subclasses should override this getter.
175
200
  * Note: This must be a getter (not property initializer) for proper inheritance
@@ -764,7 +789,7 @@ declare abstract class BaseGridPlugin_2<TConfig = unknown> implements GridPlugin
764
789
  /** Plugin configuration - merged with defaults in attach() */
765
790
  protected config: TConfig;
766
791
  /** User-provided configuration from constructor */
767
- private readonly userConfig;
792
+ protected readonly userConfig: Partial<TConfig>;
768
793
  /**
769
794
  * Default configuration - subclasses should override this getter.
770
795
  * Note: This must be a getter (not property initializer) for proper inheritance
@@ -1719,6 +1744,8 @@ declare interface ColumnInternal<T = any> extends ColumnConfig<T> {
1719
1744
  __autoSized?: boolean;
1720
1745
  __userResized?: boolean;
1721
1746
  __renderedWidth?: number;
1747
+ /** Original configured width (for reset on double-click) */
1748
+ __originalWidth?: number;
1722
1749
  __viewTemplate?: HTMLElement;
1723
1750
  __editorTemplate?: HTMLElement;
1724
1751
  __headerTemplate?: HTMLElement;
@@ -2071,6 +2098,7 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
2071
2098
  /* Excluded from this release type: getPlugin */
2072
2099
  /* Excluded from this release type: getPluginByName */
2073
2100
  /* Excluded from this release type: requestRender */
2101
+ /* Excluded from this release type: updateTemplate */
2074
2102
  /* Excluded from this release type: requestAfterRender */
2075
2103
  connectedCallback(): void;
2076
2104
  disconnectedCallback(): void;
@@ -2092,6 +2120,11 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
2092
2120
  * Returns true if any plugin handled the event.
2093
2121
  */
2094
2122
  _dispatchCellClick(event: MouseEvent, rowIndex: number, colIndex: number, cellEl: HTMLElement): boolean;
2123
+ /**
2124
+ * Dispatch a row click event to the plugin system.
2125
+ * Returns true if any plugin handled the event.
2126
+ */
2127
+ _dispatchRowClick(event: MouseEvent, rowIndex: number, row: any, rowEl: HTMLElement): boolean;
2095
2128
  /**
2096
2129
  * Dispatch a header click event to the plugin system.
2097
2130
  * Returns true if any plugin handled the event.
@@ -2946,10 +2979,8 @@ export declare interface GridElement {
2946
2979
  rows: any[];
2947
2980
  columns: ColumnConfig[];
2948
2981
  gridConfig: any;
2949
- /** Current focused row index */
2950
- focusRow: number;
2951
- /** Current focused column index */
2952
- focusCol: number;
2982
+ /* Excluded from this release type: _focusRow */
2983
+ /* Excluded from this release type: _focusCol */
2953
2984
  /** AbortSignal that is aborted when the grid disconnects from the DOM */
2954
2985
  disconnectSignal: AbortSignal;
2955
2986
  requestRender(): void;
@@ -2965,10 +2996,8 @@ declare interface GridElement_2 {
2965
2996
  rows: any[];
2966
2997
  columns: ColumnConfig_2[];
2967
2998
  gridConfig: any;
2968
- /** Current focused row index */
2969
- focusRow: number;
2970
- /** Current focused column index */
2971
- focusCol: number;
2999
+ /* Excluded from this release type: _focusRow */
3000
+ /* Excluded from this release type: _focusCol */
2972
3001
  /** AbortSignal that is aborted when the grid disconnects from the DOM */
2973
3002
  disconnectSignal: AbortSignal;
2974
3003
  requestRender(): void;
@@ -3459,6 +3488,8 @@ declare interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
3459
3488
  commitActiveRowEdit?: () => void;
3460
3489
  /** Dispatch cell click to plugin system, returns true if handled */
3461
3490
  _dispatchCellClick?: (event: MouseEvent, rowIndex: number, colIndex: number, cellEl: HTMLElement) => boolean;
3491
+ /** Dispatch row click to plugin system, returns true if handled */
3492
+ _dispatchRowClick?: (event: MouseEvent, rowIndex: number, row: any, rowEl: HTMLElement) => boolean;
3462
3493
  /** Dispatch header click to plugin system, returns true if handled */
3463
3494
  _dispatchHeaderClick?: (event: MouseEvent, colIndex: number, headerEl: HTMLElement) => boolean;
3464
3495
  /** Dispatch keydown to plugin system, returns true if handled */
@@ -3873,6 +3904,8 @@ export declare interface PivotConfig {
3873
3904
  defaultExpanded?: boolean;
3874
3905
  /** Indent width per depth level in pixels (default: 20) */
3875
3906
  indentWidth?: number;
3907
+ /** Whether to show the pivot configuration tool panel (default: true) */
3908
+ showToolPanel?: boolean;
3876
3909
  }
3877
3910
 
3878
3911
  declare interface PivotConfig_2 {
@@ -3887,6 +3920,8 @@ declare interface PivotConfig_2 {
3887
3920
  defaultExpanded?: boolean;
3888
3921
  /** Indent width per depth level in pixels (default: 20) */
3889
3922
  indentWidth?: number;
3923
+ /** Whether to show the pivot configuration tool panel (default: true) */
3924
+ showToolPanel?: boolean;
3890
3925
  }
3891
3926
 
3892
3927
  declare type PivotDataRow = Record<string, unknown>;
@@ -4400,10 +4435,8 @@ declare type RenderRow = GroupRowModelItem | DataRowModelItem;
4400
4435
  */
4401
4436
  /** Configuration options for the reorder plugin */
4402
4437
  declare interface ReorderConfig {
4403
- /** Whether to animate column movement (default: true) */
4404
- animation?: boolean;
4405
- /** Animation duration in milliseconds (default: 200) */
4406
- animationDuration?: number;
4438
+ /** Use View Transitions API for smooth column movement (default: true) */
4439
+ viewTransition?: boolean;
4407
4440
  }
4408
4441
 
4409
4442
  /**
@@ -4411,11 +4444,7 @@ declare interface ReorderConfig {
4411
4444
  *
4412
4445
  * @example
4413
4446
  * ```ts
4414
- * new ReorderPlugin({
4415
- * enabled: true,
4416
- * animation: true,
4417
- * animationDuration: 200,
4418
- * })
4447
+ * new ReorderPlugin()
4419
4448
  * ```
4420
4449
  */
4421
4450
  export declare class ReorderPlugin extends BaseGridPlugin_2<ReorderConfig> {
@@ -4449,12 +4478,19 @@ export declare class ReorderPlugin extends BaseGridPlugin_2<ReorderConfig> {
4449
4478
  * Reset column order to the original configuration order.
4450
4479
  */
4451
4480
  resetColumnOrder(): void;
4481
+ /**
4482
+ * Update column order with optional view transition animation.
4483
+ * Falls back to instant update if View Transitions API is not supported.
4484
+ */
4485
+ private updateColumnOrder;
4452
4486
  readonly styles: string;
4453
4487
  }
4454
4488
 
4455
4489
  /** Controller managing drag-based column resize lifecycle. */
4456
4490
  declare interface ResizeController {
4457
4491
  start: (e: MouseEvent, colIndex: number, cell: HTMLElement) => void;
4492
+ /** Reset a column to its configured width (or auto-size if none configured). */
4493
+ resetColumn: (colIndex: number) => void;
4458
4494
  dispose: () => void;
4459
4495
  /** True while a resize drag is in progress (used to suppress header click/sort). */
4460
4496
  isResizing: boolean;
@@ -4618,6 +4654,8 @@ export declare class SelectionPlugin extends BaseGridPlugin_2<SelectionConfig_2>
4618
4654
  private activeRange;
4619
4655
  private cellAnchor;
4620
4656
  private isDragging;
4657
+ /** Pending keyboard navigation update (processed in afterRender) */
4658
+ private pendingKeyboardUpdate;
4621
4659
  /** Cell selection state (cell mode) */
4622
4660
  private selectedCell;
4623
4661
  detach(): void;