@toolbox-web/grid 1.3.0 → 1.4.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 (82) hide show
  1. package/all.d.ts +1 -0
  2. package/all.d.ts.map +1 -1
  3. package/all.js +997 -710
  4. package/all.js.map +1 -1
  5. package/index.js +642 -599
  6. package/index.js.map +1 -1
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/header.d.ts +7 -0
  9. package/lib/core/internal/header.d.ts.map +1 -1
  10. package/lib/core/types.d.ts +151 -0
  11. package/lib/core/types.d.ts.map +1 -1
  12. package/lib/plugins/clipboard/index.js +19 -16
  13. package/lib/plugins/clipboard/index.js.map +1 -1
  14. package/lib/plugins/column-virtualization/index.js +42 -39
  15. package/lib/plugins/column-virtualization/index.js.map +1 -1
  16. package/lib/plugins/context-menu/index.js +25 -22
  17. package/lib/plugins/context-menu/index.js.map +1 -1
  18. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  19. package/lib/plugins/editing/index.js +53 -48
  20. package/lib/plugins/editing/index.js.map +1 -1
  21. package/lib/plugins/export/index.js +23 -20
  22. package/lib/plugins/export/index.js.map +1 -1
  23. package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
  24. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  25. package/lib/plugins/filtering/index.js +186 -150
  26. package/lib/plugins/filtering/index.js.map +1 -1
  27. package/lib/plugins/grouping-columns/index.js +21 -18
  28. package/lib/plugins/grouping-columns/index.js.map +1 -1
  29. package/lib/plugins/grouping-rows/index.js +67 -64
  30. package/lib/plugins/grouping-rows/index.js.map +1 -1
  31. package/lib/plugins/master-detail/index.js +52 -49
  32. package/lib/plugins/master-detail/index.js.map +1 -1
  33. package/lib/plugins/multi-sort/index.js +18 -15
  34. package/lib/plugins/multi-sort/index.js.map +1 -1
  35. package/lib/plugins/pinned-columns/index.js +25 -22
  36. package/lib/plugins/pinned-columns/index.js.map +1 -1
  37. package/lib/plugins/pinned-rows/index.js +26 -23
  38. package/lib/plugins/pinned-rows/index.js.map +1 -1
  39. package/lib/plugins/pivot/index.js +50 -47
  40. package/lib/plugins/pivot/index.js.map +1 -1
  41. package/lib/plugins/print/PrintPlugin.d.ts +98 -0
  42. package/lib/plugins/print/PrintPlugin.d.ts.map +1 -0
  43. package/lib/plugins/print/index.d.ts +10 -0
  44. package/lib/plugins/print/index.d.ts.map +1 -0
  45. package/lib/plugins/print/index.js +626 -0
  46. package/lib/plugins/print/index.js.map +1 -0
  47. package/lib/plugins/print/print-isolated.d.ts +26 -0
  48. package/lib/plugins/print/print-isolated.d.ts.map +1 -0
  49. package/lib/plugins/print/types.d.ts +147 -0
  50. package/lib/plugins/print/types.d.ts.map +1 -0
  51. package/lib/plugins/reorder/index.js +25 -22
  52. package/lib/plugins/reorder/index.js.map +1 -1
  53. package/lib/plugins/responsive/index.js +20 -17
  54. package/lib/plugins/responsive/index.js.map +1 -1
  55. package/lib/plugins/row-reorder/index.js +39 -36
  56. package/lib/plugins/row-reorder/index.js.map +1 -1
  57. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  58. package/lib/plugins/selection/index.js +115 -101
  59. package/lib/plugins/selection/index.js.map +1 -1
  60. package/lib/plugins/server-side/index.js +35 -32
  61. package/lib/plugins/server-side/index.js.map +1 -1
  62. package/lib/plugins/tree/index.js +26 -23
  63. package/lib/plugins/tree/index.js.map +1 -1
  64. package/lib/plugins/undo-redo/index.js +23 -20
  65. package/lib/plugins/undo-redo/index.js.map +1 -1
  66. package/lib/plugins/visibility/index.js +22 -19
  67. package/lib/plugins/visibility/index.js.map +1 -1
  68. package/package.json +1 -1
  69. package/public.d.ts +1 -1
  70. package/public.d.ts.map +1 -1
  71. package/umd/grid.all.umd.js +98 -24
  72. package/umd/grid.all.umd.js.map +1 -1
  73. package/umd/grid.umd.js +11 -11
  74. package/umd/grid.umd.js.map +1 -1
  75. package/umd/plugins/editing.umd.js +1 -1
  76. package/umd/plugins/editing.umd.js.map +1 -1
  77. package/umd/plugins/filtering.umd.js +1 -1
  78. package/umd/plugins/filtering.umd.js.map +1 -1
  79. package/umd/plugins/print.umd.js +76 -0
  80. package/umd/plugins/print.umd.js.map +1 -0
  81. package/umd/plugins/selection.umd.js +2 -2
  82. package/umd/plugins/selection.umd.js.map +1 -1
@@ -1,11 +1,11 @@
1
1
  function b(l) {
2
2
  l && l.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"])', C = document.createElement("template");
5
- C.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
6
- const E = document.createElement("template");
7
- E.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
8
- function w(l, e) {
4
+ const C = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', E = document.createElement("template");
5
+ E.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
6
+ const w = document.createElement("template");
7
+ w.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
8
+ function y(l, e) {
9
9
  if (l._virtualization?.enabled) {
10
10
  const { rowHeight: a, container: r, viewportEl: s } = l._virtualization, o = r, c = s?.clientHeight ?? o?.clientHeight ?? 0;
11
11
  if (o && c > 0) {
@@ -32,7 +32,7 @@ function w(l, e) {
32
32
  }
33
33
  }
34
34
  if (l._activeEditRows !== void 0 && l._activeEditRows !== -1 && r.classList.contains("editing")) {
35
- const o = r.querySelector(v);
35
+ const o = r.querySelector(C);
36
36
  if (o && document.activeElement !== o)
37
37
  try {
38
38
  o.focus({ preventScroll: !0 });
@@ -48,7 +48,7 @@ function w(l, e) {
48
48
  }
49
49
  }
50
50
  }
51
- const y = {
51
+ const p = '<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>', L = {
52
52
  expand: "▶",
53
53
  collapse: "▼",
54
54
  sortAsc: "▲",
@@ -56,12 +56,15 @@ const y = {
56
56
  sortNone: "⇅",
57
57
  submenuArrow: "▶",
58
58
  dragHandle: "⋮⋮",
59
- toolPanel: "☰"
60
- }, L = {
59
+ toolPanel: "☰",
60
+ filter: p,
61
+ filterActive: p,
62
+ print: "🖨️"
63
+ }, A = {
61
64
  /** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
62
65
  CAN_MOVE_COLUMN: "canMoveColumn"
63
66
  };
64
- class A {
67
+ class O {
65
68
  /**
66
69
  * Plugin dependencies - declare other plugins this one requires.
67
70
  *
@@ -285,7 +288,7 @@ class A {
285
288
  */
286
289
  get gridIcons() {
287
290
  const e = this.grid?.gridConfig?.icons ?? {};
288
- return { ...y, ...e };
291
+ return { ...L, ...e };
289
292
  }
290
293
  // #region Animation Helpers
291
294
  /**
@@ -361,21 +364,21 @@ class A {
361
364
  }
362
365
  // #endregion
363
366
  }
364
- function O(l) {
367
+ function _(l) {
365
368
  const e = l.meta ?? {};
366
369
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
367
370
  }
368
- function p(l, e, t) {
371
+ function v(l, e, t) {
369
372
  if (e === t || e < 0 || e >= l.length || t < 0 || t > l.length) return l;
370
373
  const i = [...l], [n] = i.splice(e, 1);
371
374
  return i.splice(t, 0, n), i;
372
375
  }
373
- const _ = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
374
- class R extends A {
376
+ const R = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
377
+ class x extends O {
375
378
  /** @internal */
376
379
  name = "reorder";
377
380
  /** @internal */
378
- styles = _;
381
+ styles = R;
379
382
  /** @internal */
380
383
  get defaultConfig() {
381
384
  return {
@@ -406,8 +409,8 @@ class R extends A {
406
409
  * Check if a column can be moved, considering both column config and plugin queries.
407
410
  */
408
411
  canMoveColumnWithPlugins(e) {
409
- return !e || !O(e) ? !1 : !this.grid.queryPlugins({
410
- type: L.CAN_MOVE_COLUMN,
412
+ return !e || !_(e) ? !1 : !this.grid.queryPlugins({
413
+ type: A.CAN_MOVE_COLUMN,
411
414
  context: e
412
415
  }).includes(!1);
413
416
  }
@@ -466,7 +469,7 @@ class R extends A {
466
469
  const s = this.draggedField, o = this.draggedIndex, c = this.dropIndex;
467
470
  if (!this.isDragging || s === null || o === null || c === null)
468
471
  return;
469
- const u = c > o ? c - 1 : c, f = this.getColumnOrder(), g = p(f, o, u), h = {
472
+ const u = c > o ? c - 1 : c, f = this.getColumnOrder(), g = v(f, o, u), h = {
470
473
  field: s,
471
474
  fromIndex: o,
472
475
  toIndex: u,
@@ -493,7 +496,7 @@ class R extends A {
493
496
  if (s < 0 || s >= a.length) return;
494
497
  const o = n.find((c) => c.field === a[s]);
495
498
  if (this.canMoveColumnWithPlugins(o))
496
- return this.moveColumn(d.field, s), t._focusCol = s, w(this.grid), e.preventDefault(), e.stopPropagation(), !0;
499
+ return this.moveColumn(d.field, s), t._focusCol = s, y(this.grid), e.preventDefault(), e.stopPropagation(), !0;
497
500
  }
498
501
  // #endregion
499
502
  // #region Public API
@@ -512,7 +515,7 @@ class R extends A {
512
515
  moveColumn(e, t) {
513
516
  const i = this.getColumnOrder(), n = i.indexOf(e);
514
517
  if (n === -1) return;
515
- const d = p(i, n, t);
518
+ const d = v(i, n, t);
516
519
  this.emitCancelable("column-move", {
517
520
  field: e,
518
521
  fromIndex: n,
@@ -633,6 +636,6 @@ class R extends A {
633
636
  // #endregion
634
637
  }
635
638
  export {
636
- R as ReorderPlugin
639
+ x as ReorderPlugin
637
640
  };
638
641
  //# sourceMappingURL=index.js.map