@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,4 +1,4 @@
1
- const b = {
1
+ const h = '<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>', b = {
2
2
  expand: "▶",
3
3
  collapse: "▼",
4
4
  sortAsc: "▲",
@@ -6,9 +6,12 @@ const b = {
6
6
  sortNone: "⇅",
7
7
  submenuArrow: "▶",
8
8
  dragHandle: "⋮⋮",
9
- toolPanel: "☰"
9
+ toolPanel: "☰",
10
+ filter: h,
11
+ filterActive: h,
12
+ print: "🖨️"
10
13
  };
11
- class x {
14
+ class C {
12
15
  /**
13
16
  * Plugin dependencies - declare other plugins this one requires.
14
17
  *
@@ -321,23 +324,23 @@ function S(r, t, e) {
321
324
  function y(r, t) {
322
325
  return r == null && t == null ? 0 : r == null ? 1 : t == null ? -1 : typeof r == "number" && typeof t == "number" ? r - t : r instanceof Date && t instanceof Date ? r.getTime() - t.getTime() : typeof r == "boolean" && typeof t == "boolean" ? r === t ? 0 : r ? -1 : 1 : String(r).localeCompare(String(t));
323
326
  }
324
- function C(r, t, e, o) {
327
+ function M(r, t, e, o) {
325
328
  const i = r.find((n) => n.field === t);
326
329
  return e ? i ? i.direction === "asc" ? r.map((n) => n.field === t ? { ...n, direction: "desc" } : n) : r.filter((n) => n.field !== t) : r.length < o ? [...r, { field: t, direction: "asc" }] : r : i?.direction === "asc" ? [{ field: t, direction: "desc" }] : i?.direction === "desc" ? [] : [{ field: t, direction: "asc" }];
327
330
  }
328
- function h(r, t) {
331
+ function m(r, t) {
329
332
  const e = r.findIndex((o) => o.field === t);
330
333
  return e >= 0 ? e + 1 : void 0;
331
334
  }
332
- function m(r, t) {
335
+ function p(r, t) {
333
336
  return r.find((e) => e.field === t)?.direction;
334
337
  }
335
- const M = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
336
- class I extends x {
338
+ const I = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
339
+ class v extends C {
337
340
  /** @internal */
338
341
  name = "multiSort";
339
342
  /** @internal */
340
- styles = M;
343
+ styles = I;
341
344
  /** @internal */
342
345
  get defaultConfig() {
343
346
  return {
@@ -363,7 +366,7 @@ class I extends x {
363
366
  onHeaderClick(t) {
364
367
  if (!this.columns.find((n) => n.field === t.field)?.sortable) return !1;
365
368
  const o = t.originalEvent.shiftKey, i = this.config.maxSortColumns ?? 3;
366
- return this.sortModel = C(this.sortModel, t.field, o, i), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
369
+ return this.sortModel = M(this.sortModel, t.field, o, i), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
367
370
  }
368
371
  /** @internal */
369
372
  afterRender() {
@@ -373,12 +376,12 @@ class I extends x {
373
376
  t.querySelectorAll(".header-row .cell[data-field]").forEach((i) => {
374
377
  const n = i.getAttribute("data-field");
375
378
  if (!n) return;
376
- const a = h(this.sortModel, n), d = m(this.sortModel, n);
379
+ const a = m(this.sortModel, n), d = p(this.sortModel, n);
377
380
  if (i.querySelector(".sort-index")?.remove(), d) {
378
381
  i.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), i.setAttribute("data-sort", d);
379
382
  const s = document.createElement("span");
380
383
  s.className = "sort-indicator", this.setIcon(s, this.resolveIcon(d === "asc" ? "sortAsc" : "sortDesc"));
381
- const c = i.querySelector(".tbw-filter-btn"), p = i.querySelector(".resize-handle"), g = c ?? p;
384
+ const c = i.querySelector(".tbw-filter-btn"), x = i.querySelector(".resize-handle"), g = c ?? x;
382
385
  if (g ? i.insertBefore(s, g) : i.appendChild(s), e && this.sortModel.length > 1 && a !== void 0) {
383
386
  const l = document.createElement("span");
384
387
  l.className = "sort-index", l.textContent = String(a), s.nextSibling ? i.insertBefore(l, s.nextSibling) : i.appendChild(l);
@@ -415,7 +418,7 @@ class I extends x {
415
418
  * @returns 1-based index or undefined if not sorted
416
419
  */
417
420
  getSortIndex(t) {
418
- return h(this.sortModel, t);
421
+ return m(this.sortModel, t);
419
422
  }
420
423
  /**
421
424
  * Get the sort direction for a specific field.
@@ -423,7 +426,7 @@ class I extends x {
423
426
  * @returns Sort direction or undefined if not sorted
424
427
  */
425
428
  getSortDirection(t) {
426
- return m(this.sortModel, t);
429
+ return p(this.sortModel, t);
427
430
  }
428
431
  // #endregion
429
432
  // #region Column State Hooks
@@ -459,6 +462,6 @@ class I extends x {
459
462
  // #endregion
460
463
  }
461
464
  export {
462
- I as MultiSortPlugin
465
+ v as MultiSortPlugin
463
466
  };
464
467
  //# sourceMappingURL=index.js.map