@toolbox-web/grid 1.6.2 → 1.8.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 (114) hide show
  1. package/README.md +51 -15
  2. package/all.js +267 -158
  3. package/all.js.map +1 -1
  4. package/index.js +866 -722
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +68 -1
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/header.d.ts.map +1 -1
  9. package/lib/core/plugin/base-plugin.d.ts +182 -1
  10. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  11. package/lib/core/plugin/index.d.ts +1 -1
  12. package/lib/core/plugin/index.d.ts.map +1 -1
  13. package/lib/core/plugin/plugin-manager.d.ts +56 -1
  14. package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
  15. package/lib/core/plugin/types.d.ts +36 -0
  16. package/lib/core/plugin/types.d.ts.map +1 -1
  17. package/lib/core/types.d.ts +1349 -31
  18. package/lib/core/types.d.ts.map +1 -1
  19. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
  20. package/lib/plugins/clipboard/index.js +140 -87
  21. package/lib/plugins/clipboard/index.js.map +1 -1
  22. package/lib/plugins/column-virtualization/index.js +64 -7
  23. package/lib/plugins/column-virtualization/index.js.map +1 -1
  24. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  25. package/lib/plugins/context-menu/index.js +123 -65
  26. package/lib/plugins/context-menu/index.js.map +1 -1
  27. package/lib/plugins/editing/EditingPlugin.d.ts +6 -1
  28. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  29. package/lib/plugins/editing/index.js +95 -13
  30. package/lib/plugins/editing/index.js.map +1 -1
  31. package/lib/plugins/export/index.js +91 -34
  32. package/lib/plugins/export/index.js.map +1 -1
  33. package/lib/plugins/filtering/FilteringPlugin.d.ts +6 -1
  34. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  35. package/lib/plugins/filtering/index.js +192 -123
  36. package/lib/plugins/filtering/index.js.map +1 -1
  37. package/lib/plugins/grouping-columns/index.js +57 -0
  38. package/lib/plugins/grouping-columns/index.js.map +1 -1
  39. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +7 -2
  40. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
  41. package/lib/plugins/grouping-rows/index.js +142 -60
  42. package/lib/plugins/grouping-rows/index.js.map +1 -1
  43. package/lib/plugins/master-detail/index.js +69 -12
  44. package/lib/plugins/master-detail/index.js.map +1 -1
  45. package/lib/plugins/multi-sort/index.js +70 -13
  46. package/lib/plugins/multi-sort/index.js.map +1 -1
  47. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +3 -3
  48. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  49. package/lib/plugins/pinned-columns/index.js +106 -36
  50. package/lib/plugins/pinned-columns/index.js.map +1 -1
  51. package/lib/plugins/pinned-rows/index.js +57 -0
  52. package/lib/plugins/pinned-rows/index.js.map +1 -1
  53. package/lib/plugins/pivot/index.js +57 -0
  54. package/lib/plugins/pivot/index.js.map +1 -1
  55. package/lib/plugins/print/PrintPlugin.d.ts.map +1 -1
  56. package/lib/plugins/print/index.js +58 -1
  57. package/lib/plugins/print/index.js.map +1 -1
  58. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
  59. package/lib/plugins/reorder/column-drag.d.ts +2 -2
  60. package/lib/plugins/reorder/index.js +68 -17
  61. package/lib/plugins/reorder/index.js.map +1 -1
  62. package/lib/plugins/responsive/ResponsivePlugin.d.ts +6 -1
  63. package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -1
  64. package/lib/plugins/responsive/index.js +125 -54
  65. package/lib/plugins/responsive/index.js.map +1 -1
  66. package/lib/plugins/row-reorder/index.js +169 -112
  67. package/lib/plugins/row-reorder/index.js.map +1 -1
  68. package/lib/plugins/selection/SelectionPlugin.d.ts +14 -2
  69. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  70. package/lib/plugins/selection/index.js +84 -7
  71. package/lib/plugins/selection/index.js.map +1 -1
  72. package/lib/plugins/server-side/index.js +79 -22
  73. package/lib/plugins/server-side/index.js.map +1 -1
  74. package/lib/plugins/tree/TreePlugin.d.ts +7 -1
  75. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
  76. package/lib/plugins/tree/index.js +140 -58
  77. package/lib/plugins/tree/index.js.map +1 -1
  78. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +6 -1
  79. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
  80. package/lib/plugins/undo-redo/index.js +79 -10
  81. package/lib/plugins/undo-redo/index.js.map +1 -1
  82. package/lib/plugins/visibility/index.js +57 -0
  83. package/lib/plugins/visibility/index.js.map +1 -1
  84. package/package.json +1 -1
  85. package/public.d.ts +80 -2
  86. package/public.d.ts.map +1 -1
  87. package/umd/grid.all.umd.js +25 -25
  88. package/umd/grid.all.umd.js.map +1 -1
  89. package/umd/grid.umd.js +15 -15
  90. package/umd/grid.umd.js.map +1 -1
  91. package/umd/plugins/clipboard.umd.js +5 -5
  92. package/umd/plugins/clipboard.umd.js.map +1 -1
  93. package/umd/plugins/context-menu.umd.js +1 -1
  94. package/umd/plugins/context-menu.umd.js.map +1 -1
  95. package/umd/plugins/editing.umd.js +1 -1
  96. package/umd/plugins/editing.umd.js.map +1 -1
  97. package/umd/plugins/filtering.umd.js +1 -1
  98. package/umd/plugins/filtering.umd.js.map +1 -1
  99. package/umd/plugins/grouping-rows.umd.js +2 -2
  100. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  101. package/umd/plugins/pinned-columns.umd.js +1 -1
  102. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  103. package/umd/plugins/print.umd.js +1 -1
  104. package/umd/plugins/print.umd.js.map +1 -1
  105. package/umd/plugins/reorder.umd.js +1 -1
  106. package/umd/plugins/reorder.umd.js.map +1 -1
  107. package/umd/plugins/responsive.umd.js +1 -1
  108. package/umd/plugins/responsive.umd.js.map +1 -1
  109. package/umd/plugins/selection.umd.js +2 -2
  110. package/umd/plugins/selection.umd.js.map +1 -1
  111. package/umd/plugins/tree.umd.js +1 -1
  112. package/umd/plugins/tree.umd.js.map +1 -1
  113. package/umd/plugins/undo-redo.umd.js +1 -1
  114. package/umd/plugins/undo-redo.umd.js.map +1 -1
@@ -1,4 +1,4 @@
1
- import { BaseGridPlugin, PluginDependency } from '../../core/plugin/base-plugin';
1
+ import { BaseGridPlugin, GridElement, PluginDependency } from '../../core/plugin/base-plugin';
2
2
  import { EditAction, UndoRedoConfig } from './types';
3
3
  /**
4
4
  * Undo/Redo Plugin for tbw-grid
@@ -78,6 +78,11 @@ export declare class UndoRedoPlugin extends BaseGridPlugin<UndoRedoConfig> {
78
78
  protected get defaultConfig(): Partial<UndoRedoConfig>;
79
79
  private undoStack;
80
80
  private redoStack;
81
+ /**
82
+ * Subscribe to cell-edit-committed events from EditingPlugin.
83
+ * @internal
84
+ */
85
+ attach(grid: GridElement): void;
81
86
  /**
82
87
  * Clean up state when plugin is detached.
83
88
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"UndoRedoPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/undo-redo/UndoRedoPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtF,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAkB,MAAM,SAAS,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,qBAAa,cAAe,SAAQ,cAAc,CAAC,cAAc,CAAC;IAChE;;;;;OAKG;IACH,gBAAyB,YAAY,EAAE,gBAAgB,EAAE,CAEvD;IAEF,gBAAgB;IAChB,QA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,CAAC,IAAI,cAAc;IAE3B,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAAC,cAAc,CAAC,CAI9D;IAGD,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,SAAS,CAAoB;IAErC;;;OAGG;IACM,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAWxC;;;OAGG;IACM,MAAM,IAAI,IAAI;IAKvB;;;;;OAKG;IACM,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAuDjD;;;;;;;;OAQG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI;IAWvF;;;;OAIG;IACH,IAAI,IAAI,UAAU,GAAG,IAAI;IAczB;;;;OAIG;IACH,IAAI,IAAI,UAAU,GAAG,IAAI;IAczB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,YAAY,IAAI,IAAI;IAMpB;;OAEG;IACH,YAAY,IAAI,UAAU,EAAE;IAI5B;;OAEG;IACH,YAAY,IAAI,UAAU,EAAE;CAI7B"}
@@ -11,7 +11,7 @@ const c = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
11
11
  filterActive: c,
12
12
  print: "🖨️"
13
13
  };
14
- class S {
14
+ class h {
15
15
  /**
16
16
  * Plugin dependencies - declare other plugins this one requires.
17
17
  *
@@ -149,6 +149,63 @@ class S {
149
149
  const r = new CustomEvent(t, { detail: e, bubbles: !0, cancelable: !0 });
150
150
  return this.grid?.dispatchEvent?.(r), r.defaultPrevented;
151
151
  }
152
+ // =========================================================================
153
+ // Event Bus - Plugin-to-Plugin Communication
154
+ // =========================================================================
155
+ /**
156
+ * Subscribe to an event from another plugin.
157
+ * The subscription is automatically cleaned up when this plugin is detached.
158
+ *
159
+ * @category Plugin Development
160
+ * @param eventType - The event type to listen for (e.g., 'filter-change')
161
+ * @param callback - The callback to invoke when the event is emitted
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * // In attach() or other initialization
166
+ * this.on('filter-change', (detail) => {
167
+ * console.log('Filter changed:', detail);
168
+ * });
169
+ * ```
170
+ */
171
+ on(t, e) {
172
+ this.grid?._pluginManager?.subscribe(this, t, e);
173
+ }
174
+ /**
175
+ * Unsubscribe from a plugin event.
176
+ *
177
+ * @category Plugin Development
178
+ * @param eventType - The event type to stop listening for
179
+ *
180
+ * @example
181
+ * ```typescript
182
+ * this.off('filter-change');
183
+ * ```
184
+ */
185
+ off(t) {
186
+ this.grid?._pluginManager?.unsubscribe(this, t);
187
+ }
188
+ /**
189
+ * Emit an event to other plugins via the Event Bus.
190
+ * This is for inter-plugin communication only; it does NOT dispatch DOM events.
191
+ * Use `emit()` to dispatch DOM events that external consumers can listen to.
192
+ *
193
+ * @category Plugin Development
194
+ * @param eventType - The event type to emit (should be declared in manifest.events)
195
+ * @param detail - The event payload
196
+ *
197
+ * @example
198
+ * ```typescript
199
+ * // Emit to other plugins (not DOM)
200
+ * this.emitPluginEvent('filter-change', { field: 'name', value: 'Alice' });
201
+ *
202
+ * // For DOM events that consumers can addEventListener to:
203
+ * this.emit('filter-change', { field: 'name', value: 'Alice' });
204
+ * ```
205
+ */
206
+ emitPluginEvent(t, e) {
207
+ this.grid?._pluginManager?.emitPluginEvent(t, e);
208
+ }
152
209
  /**
153
210
  * Request a re-render of the grid.
154
211
  */
@@ -311,7 +368,7 @@ class S {
311
368
  }
312
369
  // #endregion
313
370
  }
314
- function h(n, t, e) {
371
+ function l(n, t, e) {
315
372
  const r = [...n.undoStack, t];
316
373
  for (; r.length > e; )
317
374
  r.shift();
@@ -345,13 +402,13 @@ function d(n) {
345
402
  action: e
346
403
  } : { newState: n, action: null };
347
404
  }
348
- function l(n) {
405
+ function S(n) {
349
406
  return n.undoStack.length > 0;
350
407
  }
351
- function k(n) {
408
+ function g(n) {
352
409
  return n.redoStack.length > 0;
353
410
  }
354
- function g() {
411
+ function k() {
355
412
  return { undoStack: [], redoStack: [] };
356
413
  }
357
414
  function f(n, t, e, r) {
@@ -364,7 +421,7 @@ function f(n, t, e, r) {
364
421
  timestamp: Date.now()
365
422
  };
366
423
  }
367
- class w extends S {
424
+ class w extends h {
368
425
  /**
369
426
  * Plugin dependencies - UndoRedoPlugin requires EditingPlugin to track edits.
370
427
  *
@@ -385,6 +442,18 @@ class w extends S {
385
442
  // State as class properties
386
443
  undoStack = [];
387
444
  redoStack = [];
445
+ /**
446
+ * Subscribe to cell-edit-committed events from EditingPlugin.
447
+ * @internal
448
+ */
449
+ attach(t) {
450
+ super.attach(t), this.on(
451
+ "cell-edit-committed",
452
+ (e) => {
453
+ this.recordEdit(e.rowIndex, e.field, e.oldValue, e.newValue);
454
+ }
455
+ );
456
+ }
388
457
  /**
389
458
  * Clean up state when plugin is detached.
390
459
  * @internal
@@ -435,7 +504,7 @@ class w extends S {
435
504
  * @param newValue - The value after the edit
436
505
  */
437
506
  recordEdit(t, e, r, o) {
438
- const i = f(t, e, r, o), a = h(
507
+ const i = f(t, e, r, o), a = l(
439
508
  { undoStack: this.undoStack, redoStack: this.redoStack },
440
509
  i,
441
510
  this.config.maxHistorySize ?? 100
@@ -472,19 +541,19 @@ class w extends S {
472
541
  * Check if there are any actions that can be undone.
473
542
  */
474
543
  canUndo() {
475
- return l({ undoStack: this.undoStack, redoStack: this.redoStack });
544
+ return S({ undoStack: this.undoStack, redoStack: this.redoStack });
476
545
  }
477
546
  /**
478
547
  * Check if there are any actions that can be redone.
479
548
  */
480
549
  canRedo() {
481
- return k({ undoStack: this.undoStack, redoStack: this.redoStack });
550
+ return g({ undoStack: this.undoStack, redoStack: this.redoStack });
482
551
  }
483
552
  /**
484
553
  * Clear all undo/redo history.
485
554
  */
486
555
  clearHistory() {
487
- const t = g();
556
+ const t = k();
488
557
  this.undoStack = t.undoStack, this.redoStack = t.redoStack;
489
558
  }
490
559
  /**