@toolbox-web/grid 1.2.0 → 1.3.1

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 (79) hide show
  1. package/README.md +80 -22
  2. package/all.js +619 -571
  3. package/all.js.map +1 -1
  4. package/index.js +362 -302
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +64 -1
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/row-animation.d.ts +37 -0
  9. package/lib/core/internal/row-animation.d.ts.map +1 -0
  10. package/lib/core/types.d.ts +17 -0
  11. package/lib/core/types.d.ts.map +1 -1
  12. package/lib/plugins/clipboard/index.js +82 -76
  13. package/lib/plugins/clipboard/index.js.map +1 -1
  14. package/lib/plugins/clipboard/types.d.ts +1 -0
  15. package/lib/plugins/clipboard/types.d.ts.map +1 -1
  16. package/lib/plugins/column-virtualization/index.js +43 -41
  17. package/lib/plugins/column-virtualization/index.js.map +1 -1
  18. package/lib/plugins/context-menu/index.js +24 -22
  19. package/lib/plugins/context-menu/index.js.map +1 -1
  20. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  21. package/lib/plugins/editing/index.js +83 -52
  22. package/lib/plugins/editing/index.js.map +1 -1
  23. package/lib/plugins/export/index.js +22 -20
  24. package/lib/plugins/export/index.js.map +1 -1
  25. package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
  26. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  27. package/lib/plugins/filtering/index.js +160 -125
  28. package/lib/plugins/filtering/index.js.map +1 -1
  29. package/lib/plugins/grouping-columns/index.js +20 -18
  30. package/lib/plugins/grouping-columns/index.js.map +1 -1
  31. package/lib/plugins/grouping-rows/index.js +66 -64
  32. package/lib/plugins/grouping-rows/index.js.map +1 -1
  33. package/lib/plugins/master-detail/index.js +51 -49
  34. package/lib/plugins/master-detail/index.js.map +1 -1
  35. package/lib/plugins/multi-sort/index.js +17 -15
  36. package/lib/plugins/multi-sort/index.js.map +1 -1
  37. package/lib/plugins/pinned-columns/index.js +24 -22
  38. package/lib/plugins/pinned-columns/index.js.map +1 -1
  39. package/lib/plugins/pinned-rows/index.js +25 -23
  40. package/lib/plugins/pinned-rows/index.js.map +1 -1
  41. package/lib/plugins/pivot/index.js +49 -47
  42. package/lib/plugins/pivot/index.js.map +1 -1
  43. package/lib/plugins/reorder/index.js +24 -22
  44. package/lib/plugins/reorder/index.js.map +1 -1
  45. package/lib/plugins/responsive/index.js +19 -17
  46. package/lib/plugins/responsive/index.js.map +1 -1
  47. package/lib/plugins/row-reorder/index.js +38 -36
  48. package/lib/plugins/row-reorder/index.js.map +1 -1
  49. package/lib/plugins/selection/SelectionPlugin.d.ts +13 -0
  50. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  51. package/lib/plugins/selection/index.d.ts +1 -1
  52. package/lib/plugins/selection/index.d.ts.map +1 -1
  53. package/lib/plugins/selection/index.js +118 -85
  54. package/lib/plugins/selection/index.js.map +1 -1
  55. package/lib/plugins/selection/types.d.ts +50 -6
  56. package/lib/plugins/selection/types.d.ts.map +1 -1
  57. package/lib/plugins/server-side/index.js +34 -32
  58. package/lib/plugins/server-side/index.js.map +1 -1
  59. package/lib/plugins/tree/index.js +25 -23
  60. package/lib/plugins/tree/index.js.map +1 -1
  61. package/lib/plugins/undo-redo/index.js +22 -20
  62. package/lib/plugins/undo-redo/index.js.map +1 -1
  63. package/lib/plugins/visibility/index.js +21 -19
  64. package/lib/plugins/visibility/index.js.map +1 -1
  65. package/package.json +21 -4
  66. package/public.d.ts +1 -1
  67. package/public.d.ts.map +1 -1
  68. package/umd/grid.all.umd.js +19 -19
  69. package/umd/grid.all.umd.js.map +1 -1
  70. package/umd/grid.umd.js +9 -9
  71. package/umd/grid.umd.js.map +1 -1
  72. package/umd/plugins/clipboard.umd.js +5 -5
  73. package/umd/plugins/clipboard.umd.js.map +1 -1
  74. package/umd/plugins/editing.umd.js +1 -1
  75. package/umd/plugins/editing.umd.js.map +1 -1
  76. package/umd/plugins/filtering.umd.js +1 -1
  77. package/umd/plugins/filtering.umd.js.map +1 -1
  78. package/umd/plugins/selection.umd.js +2 -2
  79. package/umd/plugins/selection.umd.js.map +1 -1
@@ -1,38 +1,38 @@
1
- function p(l) {
2
- l && l.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
1
+ function v(a) {
2
+ a && a.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
3
3
  }
4
- const v = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', R = document.createElement("template");
5
- R.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
6
- const m = document.createElement("template");
7
- m.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
8
- function h(l, e) {
9
- if (l._virtualization?.enabled) {
10
- const { rowHeight: o, container: s, viewportEl: a } = l._virtualization, c = s, d = a?.clientHeight ?? c?.clientHeight ?? 0;
4
+ const R = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', m = document.createElement("template");
5
+ m.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
6
+ const _ = document.createElement("template");
7
+ _.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
8
+ function h(a, e) {
9
+ if (a._virtualization?.enabled) {
10
+ const { rowHeight: o, container: s, viewportEl: l } = a._virtualization, c = s, d = l?.clientHeight ?? c?.clientHeight ?? 0;
11
11
  if (c && d > 0) {
12
- const u = l._focusRow * o;
12
+ const u = a._focusRow * o;
13
13
  u < c.scrollTop ? c.scrollTop = u : u + o > c.scrollTop + d && (c.scrollTop = u - d + o);
14
14
  }
15
15
  }
16
- const r = l._activeEditRows !== void 0 && l._activeEditRows !== -1;
17
- r || l.refreshVirtualWindow(!1), p(l._bodyEl), Array.from(l._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((o) => {
16
+ const r = a._activeEditRows !== void 0 && a._activeEditRows !== -1;
17
+ r || a.refreshVirtualWindow(!1), v(a._bodyEl), Array.from(a._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((o) => {
18
18
  o.setAttribute("aria-selected", "false");
19
19
  });
20
- const t = l._focusRow, i = l._virtualization.start ?? 0, n = l._virtualization.end ?? l._rows.length;
20
+ const t = a._focusRow, i = a._virtualization.start ?? 0, n = a._virtualization.end ?? a._rows.length;
21
21
  if (t >= i && t < n) {
22
- const o = l._bodyEl.querySelectorAll(".data-grid-row")[t - i];
23
- let s = o?.children[l._focusCol];
24
- if ((!s || !s.classList?.contains("cell")) && (s = o?.querySelector(`.cell[data-col="${l._focusCol}"]`) ?? o?.querySelector(".cell[data-col]")), s) {
22
+ const o = a._bodyEl.querySelectorAll(".data-grid-row")[t - i];
23
+ let s = o?.children[a._focusCol];
24
+ if ((!s || !s.classList?.contains("cell")) && (s = o?.querySelector(`.cell[data-col="${a._focusCol}"]`) ?? o?.querySelector(".cell[data-col]")), s) {
25
25
  s.classList.add("cell-focus"), s.setAttribute("aria-selected", "true");
26
- const a = l.querySelector(".tbw-scroll-area");
27
- if (a && s && !r) {
28
- const c = l._getHorizontalScrollOffsets?.(o ?? void 0, s) ?? { left: 0, right: 0 };
26
+ const l = a.querySelector(".tbw-scroll-area");
27
+ if (l && s && !r) {
28
+ const c = a._getHorizontalScrollOffsets?.(o ?? void 0, s) ?? { left: 0, right: 0 };
29
29
  if (!c.skipScroll) {
30
- const d = s.getBoundingClientRect(), u = a.getBoundingClientRect(), g = d.left - u.left + a.scrollLeft, f = g + d.width, w = a.scrollLeft + c.left, b = a.scrollLeft + a.clientWidth - c.right;
31
- g < w ? a.scrollLeft = g - c.left : f > b && (a.scrollLeft = f - a.clientWidth + c.right);
30
+ const d = s.getBoundingClientRect(), u = l.getBoundingClientRect(), g = d.left - u.left + l.scrollLeft, f = g + d.width, b = l.scrollLeft + c.left, p = l.scrollLeft + l.clientWidth - c.right;
31
+ g < b ? l.scrollLeft = g - c.left : f > p && (l.scrollLeft = f - l.clientWidth + c.right);
32
32
  }
33
33
  }
34
- if (l._activeEditRows !== void 0 && l._activeEditRows !== -1 && s.classList.contains("editing")) {
35
- const c = s.querySelector(v);
34
+ if (a._activeEditRows !== void 0 && a._activeEditRows !== -1 && s.classList.contains("editing")) {
35
+ const c = s.querySelector(R);
36
36
  if (c && document.activeElement !== c)
37
37
  try {
38
38
  c.focus({ preventScroll: !0 });
@@ -48,7 +48,7 @@ function h(l, e) {
48
48
  }
49
49
  }
50
50
  }
51
- const _ = {
51
+ const w = '<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>', E = {
52
52
  expand: "▶",
53
53
  collapse: "▼",
54
54
  sortAsc: "▲",
@@ -56,7 +56,9 @@ const _ = {
56
56
  sortNone: "⇅",
57
57
  submenuArrow: "▶",
58
58
  dragHandle: "⋮⋮",
59
- toolPanel: "☰"
59
+ toolPanel: "☰",
60
+ filter: w,
61
+ filterActive: w
60
62
  };
61
63
  class y {
62
64
  /**
@@ -282,7 +284,7 @@ class y {
282
284
  */
283
285
  get gridIcons() {
284
286
  const e = this.grid?.gridConfig?.icons ?? {};
285
- return { ..._, ...e };
287
+ return { ...E, ...e };
286
288
  }
287
289
  // #region Animation Helpers
288
290
  /**
@@ -358,12 +360,12 @@ class y {
358
360
  }
359
361
  // #endregion
360
362
  }
361
- const E = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;-webkit-user-select:none;user-select:none;color:var(--tbw-color-fg-muted, #999);transition:color .15s ease;font-size:14px;letter-spacing:-2px}.dg-row-drag-handle:hover{color:var(--tbw-color-fg, #333)}.dg-row-drag-handle:active{cursor:grabbing}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative}.data-grid-row.drop-target.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}.data-grid-row.drop-target.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}.data-grid-row.keyboard-moving{background-color:var(--tbw-color-bg-selected, #e3f2fd);box-shadow:0 0 0 1px var(--tbw-color-accent, #1976d2) inset}.data-grid-row.animate-flip{transition:transform var(--tbw-animation-duration, .2s) ease-out}', C = "__tbw_row_drag";
362
- class D extends y {
363
+ const C = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;-webkit-user-select:none;user-select:none;color:var(--tbw-color-fg-muted, #999);transition:color .15s ease;font-size:14px;letter-spacing:-2px}.dg-row-drag-handle:hover{color:var(--tbw-color-fg, #333)}.dg-row-drag-handle:active{cursor:grabbing}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative}.data-grid-row.drop-target.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}.data-grid-row.drop-target.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}.data-grid-row.keyboard-moving{background-color:var(--tbw-color-bg-selected, #e3f2fd);box-shadow:0 0 0 1px var(--tbw-color-accent, #1976d2) inset}.data-grid-row.animate-flip{transition:transform var(--tbw-animation-duration, .2s) ease-out}', L = "__tbw_row_drag";
364
+ class A extends y {
363
365
  /** @internal */
364
366
  name = "rowReorder";
365
367
  /** @internal */
366
- styles = E;
368
+ styles = C;
367
369
  /** @internal */
368
370
  get defaultConfig() {
369
371
  return {
@@ -396,7 +398,7 @@ class D extends y {
396
398
  if (!this.config.showDragHandle)
397
399
  return [...e];
398
400
  const r = {
399
- field: C,
401
+ field: L,
400
402
  header: "",
401
403
  width: this.config.dragHandleWidth ?? 40,
402
404
  resizable: !1,
@@ -524,8 +526,8 @@ class D extends y {
524
526
  currentIndex: t,
525
527
  row: e
526
528
  }, this.lastFocusCol = n;
527
- const o = this.grid, s = [...o._rows ?? this.sourceRows], [a] = s.splice(r, 1);
528
- s.splice(t, 0, a), o._rows = s, o._focusRow = t, o._focusCol = n, o.refreshVirtualWindow(!0), h(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
529
+ const o = this.grid, s = [...o._rows ?? this.sourceRows], [l] = s.splice(r, 1);
530
+ s.splice(t, 0, l), o._rows = s, o._focusRow = t, o._focusCol = n, o.refreshVirtualWindow(!0), h(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
529
531
  this.flushPendingMove();
530
532
  }, this.config.debounceMs ?? 300);
531
533
  }
@@ -547,8 +549,8 @@ class D extends y {
547
549
  if (this.emitCancelable("row-move", i)) {
548
550
  const o = [...this.sourceRows], [s] = o.splice(r, 1);
549
551
  o.splice(e, 0, s);
550
- const a = this.grid;
551
- a._rows = o, a._focusRow = e, a._focusCol = this.lastFocusCol, a.refreshVirtualWindow(!0), h(a);
552
+ const l = this.grid;
553
+ l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), h(l);
552
554
  }
553
555
  }
554
556
  /**
@@ -591,7 +593,7 @@ class D extends y {
591
593
  // #endregion
592
594
  }
593
595
  export {
594
- C as ROW_DRAG_HANDLE_FIELD,
595
- D as RowReorderPlugin
596
+ L as ROW_DRAG_HANDLE_FIELD,
597
+ A as RowReorderPlugin
596
598
  };
597
599
  //# sourceMappingURL=index.js.map