@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,4 +1,4 @@
1
- const E = {
1
+ const b = '<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>', A = {
2
2
  expand: "▶",
3
3
  collapse: "▼",
4
4
  sortAsc: "▲",
@@ -6,9 +6,11 @@ const E = {
6
6
  sortNone: "⇅",
7
7
  submenuArrow: "▶",
8
8
  dragHandle: "⋮⋮",
9
- toolPanel: "☰"
9
+ toolPanel: "☰",
10
+ filter: b,
11
+ filterActive: b
10
12
  };
11
- class A {
13
+ class R {
12
14
  /**
13
15
  * Plugin dependencies - declare other plugins this one requires.
14
16
  *
@@ -232,7 +234,7 @@ class A {
232
234
  */
233
235
  get gridIcons() {
234
236
  const t = this.grid?.gridConfig?.icons ?? {};
235
- return { ...E, ...t };
237
+ return { ...A, ...t };
236
238
  }
237
239
  // #region Animation Helpers
238
240
  /**
@@ -361,10 +363,10 @@ const p = {
361
363
  };
362
364
  d.register.bind(d);
363
365
  d.unregister.bind(d);
364
- const b = d.get.bind(d);
366
+ const w = d.get.bind(d);
365
367
  d.run.bind(d);
366
368
  d.list.bind(d);
367
- function R(n) {
369
+ function y(n) {
368
370
  return typeof n == "object" && n !== null && "aggFunc" in n;
369
371
  }
370
372
  function m(n, t) {
@@ -389,7 +391,7 @@ function m(n, t) {
389
391
  }
390
392
  if (n.customPanels)
391
393
  for (const i of n.customPanels) {
392
- const a = y(i, t);
394
+ const a = S(i, t);
393
395
  switch (i.position) {
394
396
  case "left":
395
397
  o.appendChild(a);
@@ -404,11 +406,11 @@ function m(n, t) {
404
406
  }
405
407
  return e.appendChild(o), e.appendChild(r), e.appendChild(s), e;
406
408
  }
407
- function w(n) {
409
+ function C(n) {
408
410
  const t = document.createElement("div");
409
411
  return t.className = `tbw-aggregation-rows tbw-aggregation-rows-${n}`, t.setAttribute("role", "presentation"), t;
410
412
  }
411
- function C(n, t, e, o) {
413
+ function v(n, t, e, o) {
412
414
  n.innerHTML = "";
413
415
  for (const r of t) {
414
416
  const s = document.createElement("div");
@@ -422,11 +424,11 @@ function C(n, t, e, o) {
422
424
  let l, u;
423
425
  const h = r.aggregators?.[i.field];
424
426
  if (h)
425
- if (R(h)) {
426
- const g = b(h.aggFunc);
427
+ if (y(h)) {
428
+ const g = w(h.aggFunc);
427
429
  g && (l = g(o, i.field, i)), u = h.formatter;
428
430
  } else {
429
- const g = b(h);
431
+ const g = w(h);
430
432
  g && (l = g(o, i.field, i));
431
433
  }
432
434
  else if (r.cells && Object.prototype.hasOwnProperty.call(r.cells, i.field)) {
@@ -438,13 +440,13 @@ function C(n, t, e, o) {
438
440
  n.appendChild(s);
439
441
  }
440
442
  }
441
- function y(n, t) {
443
+ function S(n, t) {
442
444
  const e = document.createElement("div");
443
445
  e.className = "tbw-status-panel tbw-status-panel-custom", e.id = `status-panel-${n.id}`;
444
446
  const o = n.render(t);
445
447
  return typeof o == "string" ? e.innerHTML = o : e.appendChild(o), e;
446
448
  }
447
- function v(n, t, e, o, r) {
449
+ function E(n, t, e, o, r) {
448
450
  return {
449
451
  totalRows: n.length,
450
452
  filteredRows: r?.cachedResult?.length ?? n.length,
@@ -454,12 +456,12 @@ function v(n, t, e, o, r) {
454
456
  grid: e
455
457
  };
456
458
  }
457
- const S = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:flex;align-items:center;border-right:1px solid var(--tbw-color-border-cell)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
458
- class B extends A {
459
+ const B = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:flex;align-items:center;border-right:1px solid var(--tbw-color-border-cell)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
460
+ class x extends R {
459
461
  /** @internal */
460
462
  name = "pinnedRows";
461
463
  /** @internal */
462
- styles = S;
464
+ styles = B;
463
465
  /** @internal */
464
466
  get defaultConfig() {
465
467
  return {
@@ -489,7 +491,7 @@ class B extends A {
489
491
  const e = t.querySelector(".tbw-scroll-area") ?? t.querySelector(".tbw-grid-content") ?? t.children[0];
490
492
  if (!e) return;
491
493
  this.footerWrapper && !e.contains(this.footerWrapper) && (this.footerWrapper = null, this.bottomAggregationContainer = null, this.infoBarElement = null), this.topAggregationContainer && !e.contains(this.topAggregationContainer) && (this.topAggregationContainer = null), this.infoBarElement && !e.contains(this.infoBarElement) && (this.infoBarElement = null);
492
- const o = this.getSelectionState(), r = this.getFilterState(), s = v(
494
+ const o = this.getSelectionState(), r = this.getFilterState(), s = E(
493
495
  this.rows,
494
496
  this.columns,
495
497
  this.grid,
@@ -498,11 +500,11 @@ class B extends A {
498
500
  ), i = this.config.aggregationRows || [], a = i.filter((c) => c.position === "top"), l = i.filter((c) => c.position !== "top");
499
501
  if (a.length > 0) {
500
502
  if (!this.topAggregationContainer) {
501
- this.topAggregationContainer = w("top");
503
+ this.topAggregationContainer = C("top");
502
504
  const c = t.querySelector(".header");
503
505
  c && c.nextSibling ? e.insertBefore(this.topAggregationContainer, c.nextSibling) : e.appendChild(this.topAggregationContainer);
504
506
  }
505
- C(
507
+ v(
506
508
  this.topAggregationContainer,
507
509
  a,
508
510
  this.visibleColumns,
@@ -518,7 +520,7 @@ class B extends A {
518
520
  this.infoBarElement.replaceWith(c), this.infoBarElement = c;
519
521
  }
520
522
  else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
521
- g ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", e.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = w("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), C(
523
+ g ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", e.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = C("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), v(
522
524
  this.bottomAggregationContainer,
523
525
  l,
524
526
  this.visibleColumns,
@@ -561,7 +563,7 @@ class B extends A {
561
563
  */
562
564
  getContext() {
563
565
  const t = this.getSelectionState(), e = this.getFilterState();
564
- return v(
566
+ return E(
565
567
  this.rows,
566
568
  this.columns,
567
569
  this.grid,
@@ -600,6 +602,6 @@ class B extends A {
600
602
  // #endregion
601
603
  }
602
604
  export {
603
- B as PinnedRowsPlugin
605
+ x as PinnedRowsPlugin
604
606
  };
605
607
  //# sourceMappingURL=index.js.map