@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 { PluginManifest, BaseGridPlugin, CellClickEvent, CellMouseEvent } from '../../core/plugin/base-plugin';
1
+ import { GridElement, PluginManifest, PluginQuery, BaseGridPlugin, CellClickEvent, CellMouseEvent } from '../../core/plugin/base-plugin';
2
2
  import { CellRange, SelectionConfig, SelectionResult } from './types';
3
3
  /**
4
4
  * Selection Plugin for tbw-grid
@@ -82,7 +82,7 @@ import { CellRange, SelectionConfig, SelectionResult } from './types';
82
82
  export declare class SelectionPlugin extends BaseGridPlugin<SelectionConfig> {
83
83
  #private;
84
84
  /**
85
- * Plugin manifest - declares configuration validation rules.
85
+ * Plugin manifest - declares queries and configuration validation rules.
86
86
  * @internal
87
87
  */
88
88
  static readonly manifest: PluginManifest<SelectionConfig>;
@@ -124,7 +124,19 @@ export declare class SelectionPlugin extends BaseGridPlugin<SelectionConfig> {
124
124
  */
125
125
  private isCellSelectable;
126
126
  /** @internal */
127
+ attach(grid: GridElement): void;
128
+ /**
129
+ * Handle queries from other plugins.
130
+ * @internal
131
+ */
132
+ handleQuery(query: PluginQuery): unknown;
133
+ /** @internal */
127
134
  detach(): void;
135
+ /**
136
+ * Clear selection without emitting an event.
137
+ * Used when selection is invalidated by external changes (filtering, grouping, etc.)
138
+ */
139
+ private clearSelectionSilent;
128
140
  /** @internal */
129
141
  onCellClick(event: CellClickEvent): boolean;
130
142
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/selection/SelectionPlugin.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GAAG,OAAO,GAAG,IAAI;IAwC/D,gBAAgB;IACP,aAAa,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,GAAG,IAAI;IAuH9D,gBAAgB;IACP,WAAW,IAAI,IAAI;IA6C5B;;;;OAIG;IACM,cAAc,IAAI,IAAI;IAW/B;;;;;;;;;;;;;;OAcG;IACH,YAAY,IAAI,eAAe;IAQ/B;;OAEG;IACH,gBAAgB,IAAI,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAIvD;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAIjD;;OAEG;IACH,cAAc,IAAI,IAAI;IAWtB;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI;CAgCrC"}
@@ -1,4 +1,4 @@
1
- function y(r) {
1
+ function S(r) {
2
2
  if (!r) return -1;
3
3
  const e = r.getAttribute("data-row");
4
4
  if (e) return parseInt(e, 10);
@@ -14,7 +14,7 @@ function y(r) {
14
14
  function m(r) {
15
15
  r && r.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
16
16
  }
17
- const R = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', S = {
17
+ const R = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', y = {
18
18
  expand: "▶",
19
19
  collapse: "▼",
20
20
  sortAsc: "▲",
@@ -165,6 +165,63 @@ class v {
165
165
  const s = new CustomEvent(e, { detail: t, bubbles: !0, cancelable: !0 });
166
166
  return this.grid?.dispatchEvent?.(s), s.defaultPrevented;
167
167
  }
168
+ // =========================================================================
169
+ // Event Bus - Plugin-to-Plugin Communication
170
+ // =========================================================================
171
+ /**
172
+ * Subscribe to an event from another plugin.
173
+ * The subscription is automatically cleaned up when this plugin is detached.
174
+ *
175
+ * @category Plugin Development
176
+ * @param eventType - The event type to listen for (e.g., 'filter-change')
177
+ * @param callback - The callback to invoke when the event is emitted
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * // In attach() or other initialization
182
+ * this.on('filter-change', (detail) => {
183
+ * console.log('Filter changed:', detail);
184
+ * });
185
+ * ```
186
+ */
187
+ on(e, t) {
188
+ this.grid?._pluginManager?.subscribe(this, e, t);
189
+ }
190
+ /**
191
+ * Unsubscribe from a plugin event.
192
+ *
193
+ * @category Plugin Development
194
+ * @param eventType - The event type to stop listening for
195
+ *
196
+ * @example
197
+ * ```typescript
198
+ * this.off('filter-change');
199
+ * ```
200
+ */
201
+ off(e) {
202
+ this.grid?._pluginManager?.unsubscribe(this, e);
203
+ }
204
+ /**
205
+ * Emit an event to other plugins via the Event Bus.
206
+ * This is for inter-plugin communication only; it does NOT dispatch DOM events.
207
+ * Use `emit()` to dispatch DOM events that external consumers can listen to.
208
+ *
209
+ * @category Plugin Development
210
+ * @param eventType - The event type to emit (should be declared in manifest.events)
211
+ * @param detail - The event payload
212
+ *
213
+ * @example
214
+ * ```typescript
215
+ * // Emit to other plugins (not DOM)
216
+ * this.emitPluginEvent('filter-change', { field: 'name', value: 'Alice' });
217
+ *
218
+ * // For DOM events that consumers can addEventListener to:
219
+ * this.emit('filter-change', { field: 'name', value: 'Alice' });
220
+ * ```
221
+ */
222
+ emitPluginEvent(e, t) {
223
+ this.grid?._pluginManager?.emitPluginEvent(e, t);
224
+ }
168
225
  /**
169
226
  * Request a re-render of the grid.
170
227
  */
@@ -251,7 +308,7 @@ class v {
251
308
  */
252
309
  get gridIcons() {
253
310
  const e = this.grid?.gridConfig?.icons ?? {};
254
- return { ...S, ...e };
311
+ return { ...y, ...e };
255
312
  }
256
313
  // #region Animation Helpers
257
314
  /**
@@ -382,7 +439,7 @@ function w(r, e) {
382
439
  return t.startRow === s.startRow && t.startCol === s.startCol && t.endRow === s.endRow && t.endCol === s.endCol;
383
440
  }
384
441
  const k = "@layer tbw-plugins{tbw-grid.selecting .data-grid-row>.cell{-webkit-user-select:none;user-select:none}tbw-grid[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}tbw-grid[data-selection-mode=row] .cell-focus{outline:none}tbw-grid .data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg)}tbw-grid .data-grid-row>.cell.selected.top{border-top:2px solid var(--tbw-range-border-color)}tbw-grid .data-grid-row>.cell.selected.bottom{border-bottom:2px solid var(--tbw-range-border-color)}tbw-grid .data-grid-row>.cell.selected.first{border-left:2px solid var(--tbw-range-border-color)}tbw-grid .data-grid-row>.cell.selected.last{border-right:2px solid var(--tbw-range-border-color)}tbw-grid .data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6}tbw-grid .data-grid-row[data-selectable=false].row-focus{background-color:var(--tbw-color-row-alt)}tbw-grid .data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6}tbw-grid .data-grid-row>.cell[data-selectable=false].selected{background-color:var(--tbw-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}tbw-grid .tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}";
385
- function K(r, e, t) {
442
+ function _(r, e, t) {
386
443
  if (r === "cell" && e.selectedCell)
387
444
  return {
388
445
  mode: r,
@@ -404,10 +461,11 @@ function K(r, e, t) {
404
461
  }
405
462
  class D extends v {
406
463
  /**
407
- * Plugin manifest - declares configuration validation rules.
464
+ * Plugin manifest - declares queries and configuration validation rules.
408
465
  * @internal
409
466
  */
410
467
  static manifest = {
468
+ queries: [{ type: "getSelection", description: "Get the current selection state" }],
411
469
  configRules: [
412
470
  {
413
471
  id: "selection/range-dblclick",
@@ -483,9 +541,28 @@ class D extends v {
483
541
  // #endregion
484
542
  // #region Lifecycle
485
543
  /** @internal */
544
+ attach(e) {
545
+ super.attach(e), this.on("filter-applied", () => this.clearSelectionSilent()), this.on("grouping-state-change", () => this.clearSelectionSilent()), this.on("tree-state-change", () => this.clearSelectionSilent());
546
+ }
547
+ /**
548
+ * Handle queries from other plugins.
549
+ * @internal
550
+ */
551
+ handleQuery(e) {
552
+ if (e.type === "getSelection")
553
+ return this.getSelection();
554
+ }
555
+ /** @internal */
486
556
  detach() {
487
557
  this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null;
488
558
  }
559
+ /**
560
+ * Clear selection without emitting an event.
561
+ * Used when selection is invalidated by external changes (filtering, grouping, etc.)
562
+ */
563
+ clearSelectionSilent() {
564
+ this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.selectedCell = null, this.lastSelected = null, this.anchor = null, this.requestAfterRender();
565
+ }
489
566
  // #endregion
490
567
  // #region Event Handlers
491
568
  /** @internal */
@@ -617,7 +694,7 @@ class D extends v {
617
694
  if (l.forEach((n) => {
618
695
  n.classList.remove("selected", "row-focus"), s && n.removeAttribute("data-selectable");
619
696
  }), t === "row" && (m(e), l.forEach((n) => {
620
- const o = n.querySelector(".cell[data-row]"), d = y(o);
697
+ const o = n.querySelector(".cell[data-row]"), d = S(o);
621
698
  d >= 0 && (s && !this.isRowSelectable(d) && n.setAttribute("data-selectable", "false"), this.selected.has(d) && n.classList.add("selected", "row-focus"));
622
699
  })), (t === "cell" || t === "range") && s && e.querySelectorAll(".cell[data-row][data-col]").forEach((o) => {
623
700
  const d = parseInt(o.getAttribute("data-row") ?? "-1", 10), a = parseInt(o.getAttribute("data-col") ?? "-1", 10);
@@ -725,7 +802,7 @@ class D extends v {
725
802
  // #endregion
726
803
  // #region Private Helpers
727
804
  #e() {
728
- return K(
805
+ return _(
729
806
  this.config.mode,
730
807
  {
731
808
  selectedCell: this.selectedCell,