@toolbox-web/grid 0.4.2 → 0.6.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 (123) hide show
  1. package/README.md +2 -3
  2. package/all.js +1063 -1024
  3. package/all.js.map +1 -1
  4. package/index.js +1078 -912
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +28 -0
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/dom-builder.d.ts +2 -0
  9. package/lib/core/internal/dom-builder.d.ts.map +1 -1
  10. package/lib/core/internal/event-delegation.d.ts +21 -0
  11. package/lib/core/internal/event-delegation.d.ts.map +1 -1
  12. package/lib/core/internal/header.d.ts.map +1 -1
  13. package/lib/core/internal/resize.d.ts.map +1 -1
  14. package/lib/core/internal/rows.d.ts +1 -1
  15. package/lib/core/internal/rows.d.ts.map +1 -1
  16. package/lib/core/internal/shell.d.ts +19 -13
  17. package/lib/core/internal/shell.d.ts.map +1 -1
  18. package/lib/core/plugin/base-plugin.d.ts +13 -2
  19. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  20. package/lib/core/plugin/expander-column.d.ts.map +1 -1
  21. package/lib/core/plugin/plugin-manager.d.ts +6 -2
  22. package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
  23. package/lib/core/types.d.ts +41 -3
  24. package/lib/core/types.d.ts.map +1 -1
  25. package/lib/plugins/clipboard/index.js +22 -11
  26. package/lib/plugins/clipboard/index.js.map +1 -1
  27. package/lib/plugins/column-virtualization/index.js +59 -48
  28. package/lib/plugins/column-virtualization/index.js.map +1 -1
  29. package/lib/plugins/context-menu/index.js +71 -60
  30. package/lib/plugins/context-menu/index.js.map +1 -1
  31. package/lib/plugins/editing/EditingPlugin.d.ts +1 -0
  32. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  33. package/lib/plugins/editing/index.js +93 -80
  34. package/lib/plugins/editing/index.js.map +1 -1
  35. package/lib/plugins/export/index.js +29 -18
  36. package/lib/plugins/export/index.js.map +1 -1
  37. package/lib/plugins/filtering/FilteringPlugin.d.ts +9 -1
  38. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  39. package/lib/plugins/filtering/index.js +199 -165
  40. package/lib/plugins/filtering/index.js.map +1 -1
  41. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -0
  42. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  43. package/lib/plugins/grouping-columns/index.js +79 -49
  44. package/lib/plugins/grouping-columns/index.js.map +1 -1
  45. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
  46. package/lib/plugins/grouping-rows/index.js +98 -87
  47. package/lib/plugins/grouping-rows/index.js.map +1 -1
  48. package/lib/plugins/master-detail/index.js +70 -57
  49. package/lib/plugins/master-detail/index.js.map +1 -1
  50. package/lib/plugins/multi-sort/index.js +48 -37
  51. package/lib/plugins/multi-sort/index.js.map +1 -1
  52. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  53. package/lib/plugins/pinned-columns/index.js +71 -66
  54. package/lib/plugins/pinned-columns/index.js.map +1 -1
  55. package/lib/plugins/pinned-columns/pinned-columns.d.ts +2 -2
  56. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
  57. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  58. package/lib/plugins/pinned-rows/index.js +63 -52
  59. package/lib/plugins/pinned-rows/index.js.map +1 -1
  60. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  61. package/lib/plugins/pivot/index.js +310 -299
  62. package/lib/plugins/pivot/index.js.map +1 -1
  63. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
  64. package/lib/plugins/reorder/index.d.ts +1 -1
  65. package/lib/plugins/reorder/index.d.ts.map +1 -1
  66. package/lib/plugins/reorder/index.js +79 -68
  67. package/lib/plugins/reorder/index.js.map +1 -1
  68. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  69. package/lib/plugins/selection/index.js +115 -105
  70. package/lib/plugins/selection/index.js.map +1 -1
  71. package/lib/plugins/server-side/index.js +15 -4
  72. package/lib/plugins/server-side/index.js.map +1 -1
  73. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
  74. package/lib/plugins/tree/index.js +41 -30
  75. package/lib/plugins/tree/index.js.map +1 -1
  76. package/lib/plugins/undo-redo/index.js +29 -18
  77. package/lib/plugins/undo-redo/index.js.map +1 -1
  78. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
  79. package/lib/plugins/visibility/index.js +59 -47
  80. package/lib/plugins/visibility/index.js.map +1 -1
  81. package/package.json +6 -6
  82. package/public.d.ts +42 -0
  83. package/public.d.ts.map +1 -1
  84. package/themes/dg-theme-bootstrap.css +55 -53
  85. package/themes/dg-theme-contrast.css +42 -40
  86. package/themes/dg-theme-large.css +38 -37
  87. package/themes/dg-theme-material.css +54 -52
  88. package/themes/dg-theme-standard.css +19 -17
  89. package/themes/dg-theme-vibrant.css +16 -14
  90. package/umd/grid.all.umd.js +23 -22
  91. package/umd/grid.all.umd.js.map +1 -1
  92. package/umd/grid.umd.js +15 -14
  93. package/umd/grid.umd.js.map +1 -1
  94. package/umd/plugins/column-virtualization.umd.js +1 -1
  95. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  96. package/umd/plugins/context-menu.umd.js +1 -1
  97. package/umd/plugins/context-menu.umd.js.map +1 -1
  98. package/umd/plugins/editing.umd.js +1 -1
  99. package/umd/plugins/editing.umd.js.map +1 -1
  100. package/umd/plugins/filtering.umd.js +1 -1
  101. package/umd/plugins/filtering.umd.js.map +1 -1
  102. package/umd/plugins/grouping-columns.umd.js +1 -1
  103. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  104. package/umd/plugins/grouping-rows.umd.js +1 -1
  105. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  106. package/umd/plugins/master-detail.umd.js +1 -1
  107. package/umd/plugins/master-detail.umd.js.map +1 -1
  108. package/umd/plugins/multi-sort.umd.js +1 -1
  109. package/umd/plugins/multi-sort.umd.js.map +1 -1
  110. package/umd/plugins/pinned-columns.umd.js +1 -1
  111. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  112. package/umd/plugins/pinned-rows.umd.js +1 -1
  113. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  114. package/umd/plugins/pivot.umd.js +1 -1
  115. package/umd/plugins/pivot.umd.js.map +1 -1
  116. package/umd/plugins/reorder.umd.js +1 -1
  117. package/umd/plugins/reorder.umd.js.map +1 -1
  118. package/umd/plugins/selection.umd.js +1 -1
  119. package/umd/plugins/selection.umd.js.map +1 -1
  120. package/umd/plugins/tree.umd.js +1 -1
  121. package/umd/plugins/tree.umd.js.map +1 -1
  122. package/umd/plugins/visibility.umd.js +1 -1
  123. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -1,4 +1,4 @@
1
- const g = {
1
+ const h = {
2
2
  expand: "▶",
3
3
  collapse: "▼",
4
4
  sortAsc: "▲",
@@ -7,11 +7,11 @@ const g = {
7
7
  submenuArrow: "▶",
8
8
  dragHandle: "⋮⋮",
9
9
  toolPanel: "☰"
10
- }, y = {
10
+ }, g = {
11
11
  /** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
12
12
  CAN_MOVE_COLUMN: "canMoveColumn"
13
13
  };
14
- class m {
14
+ class y {
15
15
  /**
16
16
  * Plugin dependencies - declare other plugins this one requires.
17
17
  *
@@ -188,10 +188,21 @@ class m {
188
188
  return this.grid;
189
189
  }
190
190
  /**
191
- * Get the shadow root of the grid.
191
+ * Get the render root of the grid for DOM queries.
192
+ * @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
193
+ *
194
+ * With Shadow DOM removed, the grid element itself is the render root.
195
+ * All new code should use `this.gridElement` for DOM queries.
196
+ *
197
+ * @example
198
+ * // OLD (deprecated)
199
+ * const rows = this.shadowRoot?.querySelector('.rows');
200
+ *
201
+ * // NEW (preferred)
202
+ * const rows = this.gridElement.querySelector('.rows');
192
203
  */
193
204
  get shadowRoot() {
194
- return this.grid?.shadowRoot ?? null;
205
+ return this.gridElement;
195
206
  }
196
207
  /**
197
208
  * Get the disconnect signal for event listener cleanup.
@@ -219,7 +230,7 @@ class m {
219
230
  */
220
231
  get gridIcons() {
221
232
  const t = this.grid?.gridConfig?.icons ?? {};
222
- return { ...g, ...t };
233
+ return { ...h, ...t };
223
234
  }
224
235
  // #region Animation Helpers
225
236
  /**
@@ -242,7 +253,7 @@ class m {
242
253
  const t = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
243
254
  if (t === !1 || t === "off") return !1;
244
255
  if (t === !0 || t === "on") return !0;
245
- const e = this.shadowRoot?.host;
256
+ const e = this.gridElement;
246
257
  return e ? getComputedStyle(e).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
247
258
  }
248
259
  /**
@@ -258,7 +269,7 @@ class m {
258
269
  * ```
259
270
  */
260
271
  get animationDuration() {
261
- const t = this.shadowRoot?.host;
272
+ const t = this.gridElement;
262
273
  if (t) {
263
274
  const e = getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(), s = parseInt(e, 10);
264
275
  if (!isNaN(s)) return s;
@@ -295,49 +306,45 @@ class m {
295
306
  }
296
307
  // #endregion
297
308
  }
298
- function p(n) {
299
- return n.filter((t) => t.sticky === "left");
309
+ function m(r) {
310
+ return r.filter((t) => t.sticky === "left");
300
311
  }
301
- function k(n) {
302
- return n.filter((t) => t.sticky === "right");
312
+ function p(r) {
313
+ return r.filter((t) => t.sticky === "right");
303
314
  }
304
- function a(n) {
305
- return n.some((t) => t.sticky === "left" || t.sticky === "right");
315
+ function d(r) {
316
+ return r.some((t) => t.sticky === "left" || t.sticky === "right");
306
317
  }
307
- function u(n, t) {
308
- const e = n.shadowRoot;
309
- if (!e) return;
310
- const s = Array.from(e.querySelectorAll(".header-row .cell"));
311
- if (!s.length) return;
312
- const c = /* @__PURE__ */ new Map();
313
- t.forEach((r, o) => {
314
- r.field && c.set(r.field, o);
318
+ function a(r, t) {
319
+ const e = Array.from(r.querySelectorAll(".header-row .cell"));
320
+ if (!e.length) return;
321
+ const s = /* @__PURE__ */ new Map();
322
+ t.forEach((n, c) => {
323
+ n.field && s.set(n.field, c);
315
324
  });
325
+ let l = 0;
326
+ for (const n of t)
327
+ if (n.sticky === "left") {
328
+ const c = s.get(n.field), i = e.find((o) => o.getAttribute("data-field") === n.field);
329
+ i && (i.classList.add("sticky-left"), i.style.position = "sticky", i.style.left = l + "px", c !== void 0 && r.querySelectorAll(`.data-grid-row .cell[data-col="${c}"]`).forEach((o) => {
330
+ o.classList.add("sticky-left"), o.style.position = "sticky", o.style.left = l + "px";
331
+ }), l += i.offsetWidth);
332
+ }
316
333
  let f = 0;
317
- for (const r of t)
318
- if (r.sticky === "left") {
319
- const o = c.get(r.field), i = s.find((l) => l.getAttribute("data-field") === r.field);
320
- i && (i.classList.add("sticky-left"), i.style.position = "sticky", i.style.left = f + "px", o !== void 0 && e.querySelectorAll(`.data-grid-row .cell[data-col="${o}"]`).forEach((l) => {
321
- l.classList.add("sticky-left"), l.style.position = "sticky", l.style.left = f + "px";
334
+ for (const n of [...t].reverse())
335
+ if (n.sticky === "right") {
336
+ const c = s.get(n.field), i = e.find((o) => o.getAttribute("data-field") === n.field);
337
+ i && (i.classList.add("sticky-right"), i.style.position = "sticky", i.style.right = f + "px", c !== void 0 && r.querySelectorAll(`.data-grid-row .cell[data-col="${c}"]`).forEach((o) => {
338
+ o.classList.add("sticky-right"), o.style.position = "sticky", o.style.right = f + "px";
322
339
  }), f += i.offsetWidth);
323
340
  }
324
- let d = 0;
325
- for (const r of [...t].reverse())
326
- if (r.sticky === "right") {
327
- const o = c.get(r.field), i = s.find((l) => l.getAttribute("data-field") === r.field);
328
- i && (i.classList.add("sticky-right"), i.style.position = "sticky", i.style.right = d + "px", o !== void 0 && e.querySelectorAll(`.data-grid-row .cell[data-col="${o}"]`).forEach((l) => {
329
- l.classList.add("sticky-right"), l.style.position = "sticky", l.style.right = d + "px";
330
- }), d += i.offsetWidth);
331
- }
332
341
  }
333
- function h(n) {
334
- const t = n.shadowRoot;
335
- if (!t) return;
336
- t.querySelectorAll(".sticky-left, .sticky-right").forEach((s) => {
337
- s.classList.remove("sticky-left", "sticky-right"), s.style.position = "", s.style.left = "", s.style.right = "";
342
+ function u(r) {
343
+ r.querySelectorAll(".sticky-left, .sticky-right").forEach((e) => {
344
+ e.classList.remove("sticky-left", "sticky-right"), e.style.position = "", e.style.left = "", e.style.right = "";
338
345
  });
339
346
  }
340
- class C extends m {
347
+ class k extends y {
341
348
  name = "pinnedColumns";
342
349
  get defaultConfig() {
343
350
  return {};
@@ -358,23 +365,23 @@ class C extends m {
358
365
  */
359
366
  static detect(t, e) {
360
367
  const s = e?.columns;
361
- return Array.isArray(s) ? a(s) : !1;
368
+ return Array.isArray(s) ? d(s) : !1;
362
369
  }
363
370
  // #endregion
364
371
  // #region Hooks
365
372
  processColumns(t) {
366
- return this.isApplied = a([...t]), [...t];
373
+ return this.isApplied = d([...t]), [...t];
367
374
  }
368
375
  afterRender() {
369
376
  if (!this.isApplied)
370
377
  return;
371
378
  const t = this.grid, e = [...this.columns];
372
- if (!a(e)) {
373
- h(t), this.isApplied = !1;
379
+ if (!d(e)) {
380
+ u(t), this.isApplied = !1;
374
381
  return;
375
382
  }
376
383
  queueMicrotask(() => {
377
- u(t, e);
384
+ a(t, e);
378
385
  });
379
386
  }
380
387
  /**
@@ -382,12 +389,12 @@ class C extends m {
382
389
  */
383
390
  onPluginQuery(t) {
384
391
  switch (t.type) {
385
- case y.CAN_MOVE_COLUMN: {
392
+ case g.CAN_MOVE_COLUMN: {
386
393
  const e = t.context, s = e.sticky;
387
394
  if (s === "left" || s === "right")
388
395
  return !1;
389
- const c = e.meta?.sticky;
390
- return c === "left" || c === "right" ? !1 : void 0;
396
+ const l = e.meta?.sticky;
397
+ return l === "left" || l === "right" ? !1 : void 0;
391
398
  }
392
399
  default:
393
400
  return;
@@ -400,27 +407,27 @@ class C extends m {
400
407
  */
401
408
  refreshStickyOffsets() {
402
409
  const t = [...this.columns];
403
- u(this.grid, t);
410
+ a(this.grid, t);
404
411
  }
405
412
  /**
406
413
  * Get columns pinned to the left.
407
414
  */
408
415
  getLeftPinnedColumns() {
409
416
  const t = [...this.columns];
410
- return p(t);
417
+ return m(t);
411
418
  }
412
419
  /**
413
420
  * Get columns pinned to the right.
414
421
  */
415
422
  getRightPinnedColumns() {
416
423
  const t = [...this.columns];
417
- return k(t);
424
+ return p(t);
418
425
  }
419
426
  /**
420
427
  * Clear all sticky positioning.
421
428
  */
422
429
  clearStickyPositions() {
423
- h(this.grid);
430
+ u(this.grid);
424
431
  }
425
432
  /**
426
433
  * Report horizontal scroll boundary offsets for pinned columns.
@@ -429,26 +436,24 @@ class C extends m {
429
436
  getHorizontalScrollOffsets(t, e) {
430
437
  if (!this.isApplied)
431
438
  return;
432
- let s = 0, c = 0;
439
+ let s = 0, l = 0;
433
440
  if (t) {
434
- const d = t.querySelectorAll(".sticky-left"), r = t.querySelectorAll(".sticky-right");
435
- d.forEach((o) => {
436
- s += o.offsetWidth;
437
- }), r.forEach((o) => {
438
- c += o.offsetWidth;
441
+ const n = t.querySelectorAll(".sticky-left"), c = t.querySelectorAll(".sticky-right");
442
+ n.forEach((i) => {
443
+ s += i.offsetWidth;
444
+ }), c.forEach((i) => {
445
+ l += i.offsetWidth;
439
446
  });
440
- } else {
441
- const r = this.grid.shadowRoot;
442
- r && r.querySelectorAll(".header-row .cell").forEach((i) => {
443
- i.classList.contains("sticky-left") ? s += i.offsetWidth : i.classList.contains("sticky-right") && (c += i.offsetWidth);
447
+ } else
448
+ this.grid.querySelectorAll(".header-row .cell").forEach((i) => {
449
+ i.classList.contains("sticky-left") ? s += i.offsetWidth : i.classList.contains("sticky-right") && (l += i.offsetWidth);
444
450
  });
445
- }
446
451
  const f = e?.classList.contains("sticky-left") || e?.classList.contains("sticky-right");
447
- return { left: s, right: c, skipScroll: f };
452
+ return { left: s, right: l, skipScroll: f };
448
453
  }
449
454
  // #endregion
450
455
  }
451
456
  export {
452
- C as PinnedColumnsPlugin
457
+ k as PinnedColumnsPlugin
453
458
  };
454
459
  //# sourceMappingURL=index.js.map