@toolbox-web/grid 0.2.5 → 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 (61) hide show
  1. package/all.d.ts +56 -23
  2. package/all.js +841 -809
  3. package/all.js.map +1 -1
  4. package/index.d.ts +12 -5
  5. package/index.js +276 -225
  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/umd/grid.all.umd.js +13 -13
  45. package/umd/grid.all.umd.js.map +1 -1
  46. package/umd/grid.umd.js +7 -7
  47. package/umd/grid.umd.js.map +1 -1
  48. package/umd/plugins/grouping-columns.umd.js +1 -1
  49. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  50. package/umd/plugins/pinned-rows.umd.js +1 -1
  51. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  52. package/umd/plugins/pivot.umd.js +1 -1
  53. package/umd/plugins/pivot.umd.js.map +1 -1
  54. package/umd/plugins/reorder.umd.js +1 -1
  55. package/umd/plugins/reorder.umd.js.map +1 -1
  56. package/umd/plugins/selection.umd.js +1 -1
  57. package/umd/plugins/selection.umd.js.map +1 -1
  58. package/umd/plugins/server-side.umd.js +1 -1
  59. package/umd/plugins/server-side.umd.js.map +1 -1
  60. package/umd/plugins/tree.umd.js +1 -1
  61. 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
@@ -2095,6 +2120,11 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
2095
2120
  * Returns true if any plugin handled the event.
2096
2121
  */
2097
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;
2098
2128
  /**
2099
2129
  * Dispatch a header click event to the plugin system.
2100
2130
  * Returns true if any plugin handled the event.
@@ -2949,10 +2979,8 @@ export declare interface GridElement {
2949
2979
  rows: any[];
2950
2980
  columns: ColumnConfig[];
2951
2981
  gridConfig: any;
2952
- /** Current focused row index */
2953
- focusRow: number;
2954
- /** Current focused column index */
2955
- focusCol: number;
2982
+ /* Excluded from this release type: _focusRow */
2983
+ /* Excluded from this release type: _focusCol */
2956
2984
  /** AbortSignal that is aborted when the grid disconnects from the DOM */
2957
2985
  disconnectSignal: AbortSignal;
2958
2986
  requestRender(): void;
@@ -2968,10 +2996,8 @@ declare interface GridElement_2 {
2968
2996
  rows: any[];
2969
2997
  columns: ColumnConfig_2[];
2970
2998
  gridConfig: any;
2971
- /** Current focused row index */
2972
- focusRow: number;
2973
- /** Current focused column index */
2974
- focusCol: number;
2999
+ /* Excluded from this release type: _focusRow */
3000
+ /* Excluded from this release type: _focusCol */
2975
3001
  /** AbortSignal that is aborted when the grid disconnects from the DOM */
2976
3002
  disconnectSignal: AbortSignal;
2977
3003
  requestRender(): void;
@@ -3462,6 +3488,8 @@ declare interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
3462
3488
  commitActiveRowEdit?: () => void;
3463
3489
  /** Dispatch cell click to plugin system, returns true if handled */
3464
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;
3465
3493
  /** Dispatch header click to plugin system, returns true if handled */
3466
3494
  _dispatchHeaderClick?: (event: MouseEvent, colIndex: number, headerEl: HTMLElement) => boolean;
3467
3495
  /** Dispatch keydown to plugin system, returns true if handled */
@@ -3876,6 +3904,8 @@ export declare interface PivotConfig {
3876
3904
  defaultExpanded?: boolean;
3877
3905
  /** Indent width per depth level in pixels (default: 20) */
3878
3906
  indentWidth?: number;
3907
+ /** Whether to show the pivot configuration tool panel (default: true) */
3908
+ showToolPanel?: boolean;
3879
3909
  }
3880
3910
 
3881
3911
  declare interface PivotConfig_2 {
@@ -3890,6 +3920,8 @@ declare interface PivotConfig_2 {
3890
3920
  defaultExpanded?: boolean;
3891
3921
  /** Indent width per depth level in pixels (default: 20) */
3892
3922
  indentWidth?: number;
3923
+ /** Whether to show the pivot configuration tool panel (default: true) */
3924
+ showToolPanel?: boolean;
3893
3925
  }
3894
3926
 
3895
3927
  declare type PivotDataRow = Record<string, unknown>;
@@ -4403,10 +4435,8 @@ declare type RenderRow = GroupRowModelItem | DataRowModelItem;
4403
4435
  */
4404
4436
  /** Configuration options for the reorder plugin */
4405
4437
  declare interface ReorderConfig {
4406
- /** Whether to animate column movement (default: true) */
4407
- animation?: boolean;
4408
- /** Animation duration in milliseconds (default: 200) */
4409
- animationDuration?: number;
4438
+ /** Use View Transitions API for smooth column movement (default: true) */
4439
+ viewTransition?: boolean;
4410
4440
  }
4411
4441
 
4412
4442
  /**
@@ -4414,11 +4444,7 @@ declare interface ReorderConfig {
4414
4444
  *
4415
4445
  * @example
4416
4446
  * ```ts
4417
- * new ReorderPlugin({
4418
- * enabled: true,
4419
- * animation: true,
4420
- * animationDuration: 200,
4421
- * })
4447
+ * new ReorderPlugin()
4422
4448
  * ```
4423
4449
  */
4424
4450
  export declare class ReorderPlugin extends BaseGridPlugin_2<ReorderConfig> {
@@ -4452,6 +4478,11 @@ export declare class ReorderPlugin extends BaseGridPlugin_2<ReorderConfig> {
4452
4478
  * Reset column order to the original configuration order.
4453
4479
  */
4454
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;
4455
4486
  readonly styles: string;
4456
4487
  }
4457
4488
 
@@ -4623,6 +4654,8 @@ export declare class SelectionPlugin extends BaseGridPlugin_2<SelectionConfig_2>
4623
4654
  private activeRange;
4624
4655
  private cellAnchor;
4625
4656
  private isDragging;
4657
+ /** Pending keyboard navigation update (processed in afterRender) */
4658
+ private pendingKeyboardUpdate;
4626
4659
  /** Cell selection state (cell mode) */
4627
4660
  private selectedCell;
4628
4661
  detach(): void;