@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
@@ -23,7 +23,7 @@ const R = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", E = /^[\w$. '?+\-*/%:()!<>=,
23
23
  "plaintext",
24
24
  "xmp",
25
25
  "listing"
26
- ]), h = /^on\w+$/i, C = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), _ = /^\s*(javascript|vbscript|data|blob):/i;
26
+ ]), g = /^on\w+$/i, C = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), _ = /^\s*(javascript|vbscript|data|blob):/i;
27
27
  function A(n) {
28
28
  if (!n || typeof n != "string") return "";
29
29
  if (n.indexOf("<") === -1) return n;
@@ -39,7 +39,7 @@ function D(n) {
39
39
  continue;
40
40
  }
41
41
  if ((s === "svg" || i.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(i.attributes).some(
42
- (r) => h.test(r.name) || r.name === "href" || r.name === "xlink:href"
42
+ (r) => g.test(r.name) || r.name === "href" || r.name === "xlink:href"
43
43
  )) {
44
44
  e.push(i);
45
45
  continue;
@@ -47,7 +47,7 @@ function D(n) {
47
47
  const l = [];
48
48
  for (const o of i.attributes) {
49
49
  const r = o.name.toLowerCase();
50
- if (h.test(r)) {
50
+ if (g.test(r)) {
51
51
  l.push(o.name);
52
52
  continue;
53
53
  }
@@ -92,7 +92,7 @@ function L(n, e) {
92
92
  function I(n) {
93
93
  return n && n.replace(new RegExp(u, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
94
94
  }
95
- const g = '<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>', T = {
95
+ const h = '<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>', T = {
96
96
  expand: "▶",
97
97
  collapse: "▼",
98
98
  sortAsc: "▲",
@@ -101,8 +101,8 @@ const g = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
101
101
  submenuArrow: "▶",
102
102
  dragHandle: "⋮⋮",
103
103
  toolPanel: "☰",
104
- filter: g,
105
- filterActive: g,
104
+ filter: h,
105
+ filterActive: h,
106
106
  print: "🖨️"
107
107
  };
108
108
  class H {
@@ -243,6 +243,63 @@ class H {
243
243
  const i = new CustomEvent(e, { detail: t, bubbles: !0, cancelable: !0 });
244
244
  return this.grid?.dispatchEvent?.(i), i.defaultPrevented;
245
245
  }
246
+ // =========================================================================
247
+ // Event Bus - Plugin-to-Plugin Communication
248
+ // =========================================================================
249
+ /**
250
+ * Subscribe to an event from another plugin.
251
+ * The subscription is automatically cleaned up when this plugin is detached.
252
+ *
253
+ * @category Plugin Development
254
+ * @param eventType - The event type to listen for (e.g., 'filter-change')
255
+ * @param callback - The callback to invoke when the event is emitted
256
+ *
257
+ * @example
258
+ * ```typescript
259
+ * // In attach() or other initialization
260
+ * this.on('filter-change', (detail) => {
261
+ * console.log('Filter changed:', detail);
262
+ * });
263
+ * ```
264
+ */
265
+ on(e, t) {
266
+ this.grid?._pluginManager?.subscribe(this, e, t);
267
+ }
268
+ /**
269
+ * Unsubscribe from a plugin event.
270
+ *
271
+ * @category Plugin Development
272
+ * @param eventType - The event type to stop listening for
273
+ *
274
+ * @example
275
+ * ```typescript
276
+ * this.off('filter-change');
277
+ * ```
278
+ */
279
+ off(e) {
280
+ this.grid?._pluginManager?.unsubscribe(this, e);
281
+ }
282
+ /**
283
+ * Emit an event to other plugins via the Event Bus.
284
+ * This is for inter-plugin communication only; it does NOT dispatch DOM events.
285
+ * Use `emit()` to dispatch DOM events that external consumers can listen to.
286
+ *
287
+ * @category Plugin Development
288
+ * @param eventType - The event type to emit (should be declared in manifest.events)
289
+ * @param detail - The event payload
290
+ *
291
+ * @example
292
+ * ```typescript
293
+ * // Emit to other plugins (not DOM)
294
+ * this.emitPluginEvent('filter-change', { field: 'name', value: 'Alice' });
295
+ *
296
+ * // For DOM events that consumers can addEventListener to:
297
+ * this.emit('filter-change', { field: 'name', value: 'Alice' });
298
+ * ```
299
+ */
300
+ emitPluginEvent(e, t) {
301
+ this.grid?._pluginManager?.emitPluginEvent(e, t);
302
+ }
246
303
  /**
247
304
  * Request a re-render of the grid.
248
305
  */
@@ -436,15 +493,15 @@ function p(n, e) {
436
493
  const t = new Set(n);
437
494
  return t.has(e) ? t.delete(e) : t.add(e), t;
438
495
  }
439
- function q(n, e) {
496
+ function P(n, e) {
440
497
  const t = new Set(n);
441
498
  return t.add(e), t;
442
499
  }
443
- function P(n, e) {
500
+ function M(n, e) {
444
501
  const t = new Set(n);
445
502
  return t.delete(e), t;
446
503
  }
447
- function M(n, e) {
504
+ function q(n, e) {
448
505
  return n.has(e);
449
506
  }
450
507
  function F(n, e, t, i) {
@@ -718,7 +775,7 @@ class b extends H {
718
775
  */
719
776
  expand(e) {
720
777
  const t = this.rows[e];
721
- t && (this.expandedRows = q(this.expandedRows, t), this.requestRender());
778
+ t && (this.expandedRows = P(this.expandedRows, t), this.requestRender());
722
779
  }
723
780
  /**
724
781
  * Collapse the detail row at the given index.
@@ -726,7 +783,7 @@ class b extends H {
726
783
  */
727
784
  collapse(e) {
728
785
  const t = this.rows[e];
729
- t && (this.expandedRows = P(this.expandedRows, t), this.requestRender());
786
+ t && (this.expandedRows = M(this.expandedRows, t), this.requestRender());
730
787
  }
731
788
  /**
732
789
  * Toggle the detail row at the given index.
@@ -743,7 +800,7 @@ class b extends H {
743
800
  */
744
801
  isExpanded(e) {
745
802
  const t = this.rows[e];
746
- return t ? M(this.expandedRows, t) : !1;
803
+ return t ? q(this.expandedRows, t) : !1;
747
804
  }
748
805
  /**
749
806
  * Expand all detail rows.