@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,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,14 @@ const y = {
56
56
  sortNone: "⇅",
57
57
  submenuArrow: "▶",
58
58
  dragHandle: "⋮⋮",
59
- toolPanel: "☰"
60
- }, L = {
59
+ toolPanel: "☰",
60
+ filter: p,
61
+ filterActive: p
62
+ }, A = {
61
63
  /** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
62
64
  CAN_MOVE_COLUMN: "canMoveColumn"
63
65
  };
64
- class A {
66
+ class O {
65
67
  /**
66
68
  * Plugin dependencies - declare other plugins this one requires.
67
69
  *
@@ -285,7 +287,7 @@ class A {
285
287
  */
286
288
  get gridIcons() {
287
289
  const e = this.grid?.gridConfig?.icons ?? {};
288
- return { ...y, ...e };
290
+ return { ...L, ...e };
289
291
  }
290
292
  // #region Animation Helpers
291
293
  /**
@@ -361,21 +363,21 @@ class A {
361
363
  }
362
364
  // #endregion
363
365
  }
364
- function O(l) {
366
+ function _(l) {
365
367
  const e = l.meta ?? {};
366
368
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
367
369
  }
368
- function p(l, e, t) {
370
+ function v(l, e, t) {
369
371
  if (e === t || e < 0 || e >= l.length || t < 0 || t > l.length) return l;
370
372
  const i = [...l], [n] = i.splice(e, 1);
371
373
  return i.splice(t, 0, n), i;
372
374
  }
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 {
375
+ 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}}';
376
+ class x extends O {
375
377
  /** @internal */
376
378
  name = "reorder";
377
379
  /** @internal */
378
- styles = _;
380
+ styles = R;
379
381
  /** @internal */
380
382
  get defaultConfig() {
381
383
  return {
@@ -406,8 +408,8 @@ class R extends A {
406
408
  * Check if a column can be moved, considering both column config and plugin queries.
407
409
  */
408
410
  canMoveColumnWithPlugins(e) {
409
- return !e || !O(e) ? !1 : !this.grid.queryPlugins({
410
- type: L.CAN_MOVE_COLUMN,
411
+ return !e || !_(e) ? !1 : !this.grid.queryPlugins({
412
+ type: A.CAN_MOVE_COLUMN,
411
413
  context: e
412
414
  }).includes(!1);
413
415
  }
@@ -466,7 +468,7 @@ class R extends A {
466
468
  const s = this.draggedField, o = this.draggedIndex, c = this.dropIndex;
467
469
  if (!this.isDragging || s === null || o === null || c === null)
468
470
  return;
469
- const u = c > o ? c - 1 : c, f = this.getColumnOrder(), g = p(f, o, u), h = {
471
+ const u = c > o ? c - 1 : c, f = this.getColumnOrder(), g = v(f, o, u), h = {
470
472
  field: s,
471
473
  fromIndex: o,
472
474
  toIndex: u,
@@ -493,7 +495,7 @@ class R extends A {
493
495
  if (s < 0 || s >= a.length) return;
494
496
  const o = n.find((c) => c.field === a[s]);
495
497
  if (this.canMoveColumnWithPlugins(o))
496
- return this.moveColumn(d.field, s), t._focusCol = s, w(this.grid), e.preventDefault(), e.stopPropagation(), !0;
498
+ return this.moveColumn(d.field, s), t._focusCol = s, y(this.grid), e.preventDefault(), e.stopPropagation(), !0;
497
499
  }
498
500
  // #endregion
499
501
  // #region Public API
@@ -512,7 +514,7 @@ class R extends A {
512
514
  moveColumn(e, t) {
513
515
  const i = this.getColumnOrder(), n = i.indexOf(e);
514
516
  if (n === -1) return;
515
- const d = p(i, n, t);
517
+ const d = v(i, n, t);
516
518
  this.emitCancelable("column-move", {
517
519
  field: e,
518
520
  fromIndex: n,
@@ -633,6 +635,6 @@ class R extends A {
633
635
  // #endregion
634
636
  }
635
637
  export {
636
- R as ReorderPlugin
638
+ x as ReorderPlugin
637
639
  };
638
640
  //# sourceMappingURL=index.js.map