@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 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,11 @@ const b = {
6
6
  sortNone: "⇅",
7
7
  submenuArrow: "▶",
8
8
  dragHandle: "⋮⋮",
9
- toolPanel: "☰"
9
+ toolPanel: "☰",
10
+ filter: h,
11
+ filterActive: h
10
12
  };
11
- class x {
13
+ class C {
12
14
  /**
13
15
  * Plugin dependencies - declare other plugins this one requires.
14
16
  *
@@ -321,23 +323,23 @@ function S(r, t, e) {
321
323
  function y(r, t) {
322
324
  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
325
  }
324
- function C(r, t, e, o) {
326
+ function M(r, t, e, o) {
325
327
  const i = r.find((n) => n.field === t);
326
328
  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
329
  }
328
- function h(r, t) {
330
+ function m(r, t) {
329
331
  const e = r.findIndex((o) => o.field === t);
330
332
  return e >= 0 ? e + 1 : void 0;
331
333
  }
332
- function m(r, t) {
334
+ function p(r, t) {
333
335
  return r.find((e) => e.field === t)?.direction;
334
336
  }
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 {
337
+ 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}}';
338
+ class v extends C {
337
339
  /** @internal */
338
340
  name = "multiSort";
339
341
  /** @internal */
340
- styles = M;
342
+ styles = I;
341
343
  /** @internal */
342
344
  get defaultConfig() {
343
345
  return {
@@ -363,7 +365,7 @@ class I extends x {
363
365
  onHeaderClick(t) {
364
366
  if (!this.columns.find((n) => n.field === t.field)?.sortable) return !1;
365
367
  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;
368
+ return this.sortModel = M(this.sortModel, t.field, o, i), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
367
369
  }
368
370
  /** @internal */
369
371
  afterRender() {
@@ -373,12 +375,12 @@ class I extends x {
373
375
  t.querySelectorAll(".header-row .cell[data-field]").forEach((i) => {
374
376
  const n = i.getAttribute("data-field");
375
377
  if (!n) return;
376
- const a = h(this.sortModel, n), d = m(this.sortModel, n);
378
+ const a = m(this.sortModel, n), d = p(this.sortModel, n);
377
379
  if (i.querySelector(".sort-index")?.remove(), d) {
378
380
  i.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), i.setAttribute("data-sort", d);
379
381
  const s = document.createElement("span");
380
382
  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;
383
+ const c = i.querySelector(".tbw-filter-btn"), x = i.querySelector(".resize-handle"), g = c ?? x;
382
384
  if (g ? i.insertBefore(s, g) : i.appendChild(s), e && this.sortModel.length > 1 && a !== void 0) {
383
385
  const l = document.createElement("span");
384
386
  l.className = "sort-index", l.textContent = String(a), s.nextSibling ? i.insertBefore(l, s.nextSibling) : i.appendChild(l);
@@ -415,7 +417,7 @@ class I extends x {
415
417
  * @returns 1-based index or undefined if not sorted
416
418
  */
417
419
  getSortIndex(t) {
418
- return h(this.sortModel, t);
420
+ return m(this.sortModel, t);
419
421
  }
420
422
  /**
421
423
  * Get the sort direction for a specific field.
@@ -423,7 +425,7 @@ class I extends x {
423
425
  * @returns Sort direction or undefined if not sorted
424
426
  */
425
427
  getSortDirection(t) {
426
- return m(this.sortModel, t);
428
+ return p(this.sortModel, t);
427
429
  }
428
430
  // #endregion
429
431
  // #region Column State Hooks
@@ -459,6 +461,6 @@ class I extends x {
459
461
  // #endregion
460
462
  }
461
463
  export {
462
- I as MultiSortPlugin
464
+ v as MultiSortPlugin
463
465
  };
464
466
  //# sourceMappingURL=index.js.map