@toolbox-web/grid 1.14.1 → 1.15.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 (70) hide show
  1. package/README.md +5 -1
  2. package/all.js +1985 -1558
  3. package/all.js.map +1 -1
  4. package/index.js +46 -20
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts.map +1 -1
  7. package/lib/core/internal/validate-config.d.ts.map +1 -1
  8. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
  9. package/lib/plugins/column-virtualization/index.js +1 -1
  10. package/lib/plugins/column-virtualization/index.js.map +1 -1
  11. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +20 -1
  12. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  13. package/lib/plugins/context-menu/index.d.ts +1 -1
  14. package/lib/plugins/context-menu/index.d.ts.map +1 -1
  15. package/lib/plugins/context-menu/index.js +153 -70
  16. package/lib/plugins/context-menu/index.js.map +1 -1
  17. package/lib/plugins/context-menu/menu.d.ts +7 -0
  18. package/lib/plugins/context-menu/menu.d.ts.map +1 -1
  19. package/lib/plugins/context-menu/types.d.ts +46 -0
  20. package/lib/plugins/context-menu/types.d.ts.map +1 -1
  21. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  22. package/lib/plugins/editing/index.js +214 -197
  23. package/lib/plugins/editing/index.js.map +1 -1
  24. package/lib/plugins/filtering/FilteringPlugin.d.ts +7 -1
  25. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  26. package/lib/plugins/filtering/index.js +169 -133
  27. package/lib/plugins/filtering/index.js.map +1 -1
  28. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +5 -1
  29. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  30. package/lib/plugins/grouping-columns/index.js +242 -109
  31. package/lib/plugins/grouping-columns/index.js.map +1 -1
  32. package/lib/plugins/grouping-columns/types.d.ts +7 -0
  33. package/lib/plugins/grouping-columns/types.d.ts.map +1 -1
  34. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +11 -1
  35. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  36. package/lib/plugins/pinned-columns/index.d.ts +1 -1
  37. package/lib/plugins/pinned-columns/index.d.ts.map +1 -1
  38. package/lib/plugins/pinned-columns/index.js +174 -79
  39. package/lib/plugins/pinned-columns/index.js.map +1 -1
  40. package/lib/plugins/pinned-columns/pinned-columns.d.ts +23 -4
  41. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
  42. package/lib/plugins/pinned-columns/types.d.ts +21 -9
  43. package/lib/plugins/pinned-columns/types.d.ts.map +1 -1
  44. package/lib/plugins/visibility/VisibilityPlugin.d.ts +42 -2
  45. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
  46. package/lib/plugins/visibility/index.d.ts +1 -1
  47. package/lib/plugins/visibility/index.d.ts.map +1 -1
  48. package/lib/plugins/visibility/index.js +219 -59
  49. package/lib/plugins/visibility/index.js.map +1 -1
  50. package/lib/plugins/visibility/types.d.ts +25 -0
  51. package/lib/plugins/visibility/types.d.ts.map +1 -1
  52. package/package.json +1 -1
  53. package/umd/grid.all.umd.js +25 -25
  54. package/umd/grid.all.umd.js.map +1 -1
  55. package/umd/grid.umd.js +2 -2
  56. package/umd/grid.umd.js.map +1 -1
  57. package/umd/plugins/column-virtualization.umd.js +1 -1
  58. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  59. package/umd/plugins/context-menu.umd.js +1 -1
  60. package/umd/plugins/context-menu.umd.js.map +1 -1
  61. package/umd/plugins/editing.umd.js +1 -1
  62. package/umd/plugins/editing.umd.js.map +1 -1
  63. package/umd/plugins/filtering.umd.js +1 -1
  64. package/umd/plugins/filtering.umd.js.map +1 -1
  65. package/umd/plugins/grouping-columns.umd.js +1 -1
  66. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  67. package/umd/plugins/pinned-columns.umd.js +1 -1
  68. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  69. package/umd/plugins/visibility.umd.js +1 -1
  70. package/umd/plugins/visibility.umd.js.map +1 -1
package/index.js CHANGED
@@ -2160,11 +2160,18 @@ const xi = [
2160
2160
  level: "column",
2161
2161
  description: 'the "group" column property'
2162
2162
  },
2163
+ {
2164
+ property: "pinned",
2165
+ pluginName: "pinnedColumns",
2166
+ level: "column",
2167
+ description: 'the "pinned" column property',
2168
+ isUsed: (t) => t === "left" || t === "right" || t === "start" || t === "end"
2169
+ },
2163
2170
  {
2164
2171
  property: "sticky",
2165
2172
  pluginName: "pinnedColumns",
2166
2173
  level: "column",
2167
- description: 'the "sticky" column property',
2174
+ description: 'the "sticky" column property (deprecated, use "pinned")',
2168
2175
  isUsed: (t) => t === "left" || t === "right" || t === "start" || t === "end"
2169
2176
  }
2170
2177
  ], Hi = [
@@ -2737,7 +2744,7 @@ ${Xi}
2737
2744
  `;
2738
2745
  class k extends HTMLElement {
2739
2746
  static tagName = "tbw-grid";
2740
- static version = "1.14.1";
2747
+ static version = "1.15.0";
2741
2748
  static #l = 0;
2742
2749
  static adapters = [];
2743
2750
  static registerAdapter(e) {
@@ -2936,10 +2943,10 @@ class k extends HTMLElement {
2936
2943
  constructor() {
2937
2944
  super(), this.#be(), this.#d = new Promise((e) => this.#h = e), this.#s = new Zt({
2938
2945
  mergeConfig: () => {
2939
- this.#t.parseLightDomColumns(this), this.#t.merge(), this.#te(), Pi(this.#o, this.#e?.getPlugins() ?? []), zi(this.#e?.getPlugins() ?? []), Oi(this.#e?.getPlugins() ?? []), this.#Pe(), this.#B = [...this._columns];
2946
+ this.#t.parseLightDomColumns(this), this.#t.merge(), this.#te(), Pi(this.#o, this.#e?.getPlugins() ?? []), zi(this.#e?.getPlugins() ?? []), Oi(this.#e?.getPlugins() ?? []), this.#ze(), this.#B = [...this._columns];
2940
2947
  },
2941
2948
  processColumns: () => this.#xe(),
2942
- processRows: () => this.#He(),
2949
+ processRows: () => this.#Le(),
2943
2950
  renderHeader: () => ie(this),
2944
2951
  updateTemplate: () => U(this),
2945
2952
  renderVirtualWindow: () => this.refreshVirtualWindow(!0, !0),
@@ -2985,7 +2992,7 @@ class k extends HTMLElement {
2985
2992
  setRowHeight: (e) => {
2986
2993
  this._virtualization.rowHeight = e;
2987
2994
  },
2988
- applyAnimationConfig: (e) => this.#Le(e),
2995
+ applyAnimationConfig: (e) => this.#Pe(e),
2989
2996
  getShellLightDomTitle: () => this.#i.lightDomTitle,
2990
2997
  getShellToolPanels: () => this.#i.toolPanels,
2991
2998
  getShellHeaderContents: () => this.#i.headerContents,
@@ -3087,7 +3094,7 @@ class k extends HTMLElement {
3087
3094
  const e = this.#o?.plugins;
3088
3095
  this.#_ = Array.isArray(e) ? e : [], this.#ie(), this.#u || (this.#Z(), this.#W(), this.#u = !0), this.#ne(), this.#S = Vt(
3089
3096
  () => {
3090
- this.#Me();
3097
+ this.#ke();
3091
3098
  },
3092
3099
  { timeout: 100 }
3093
3100
  );
@@ -3184,7 +3191,7 @@ class k extends HTMLElement {
3184
3191
  n.style.transform = `translateY(${g}px)`;
3185
3192
  }
3186
3193
  this.#r = a, this.#C || (this.#C = requestAnimationFrame(() => {
3187
- this.#C = 0, this.#r !== null && (this.#ze(this.#r), this.#r = null);
3194
+ this.#C = 0, this.#r !== null && (this.#De(this.#r), this.#r = null);
3188
3195
  }));
3189
3196
  },
3190
3197
  { passive: !0, signal: i }
@@ -3220,7 +3227,7 @@ class k extends HTMLElement {
3220
3227
  ));
3221
3228
  }
3222
3229
  this._bodyEl && It(this, this._bodyEl, i), this.#y?.disconnect(), this._virtualization.viewportEl && (this.#y = new ResizeObserver(() => {
3223
- this.#ke(), this.#s.requestPhase(x.VIRTUALIZATION, "resize-observer");
3230
+ this.#Ne(), this.#s.requestPhase(x.VIRTUALIZATION, "resize-observer");
3224
3231
  }), this.#y.observe(this._virtualization.viewportEl)), this.#n.addEventListener(
3225
3232
  "focusin",
3226
3233
  () => {
@@ -3338,17 +3345,36 @@ class k extends HTMLElement {
3338
3345
  const e = this.#B.length > 0 ? this.#B : this._columns, i = e.filter((r) => !r.hidden), o = e.filter((r) => r.hidden), n = this.#e.processColumns([...i]);
3339
3346
  if (n !== i) {
3340
3347
  const r = new Set(n.map((l) => l.field));
3341
- !i.some((l) => r.has(l.field)) && n.length > 0 ? this._columns = [...n, ...o] : this._columns = [...n, ...o];
3348
+ !i.some((l) => r.has(l.field)) && n.length > 0 ? this._columns = [...n, ...o] : this._columns = this.#He(
3349
+ e,
3350
+ n,
3351
+ o
3352
+ );
3342
3353
  } else
3343
3354
  this._columns = [...e];
3344
3355
  }
3345
3356
  }
3346
- #He() {
3357
+ #He(e, i, o) {
3358
+ if (o.length === 0) return i;
3359
+ const n = /* @__PURE__ */ new Map();
3360
+ for (const a of i)
3361
+ n.set(a.field, a);
3362
+ const r = new Set(e.map((a) => a.field)), s = [];
3363
+ for (const a of i)
3364
+ r.has(a.field) || s.push(a);
3365
+ const l = [];
3366
+ for (const a of e) {
3367
+ const c = n.get(a.field);
3368
+ c ? l.push(c) : a.hidden && l.push(a);
3369
+ }
3370
+ return l.push(...s), l;
3371
+ }
3372
+ #Le() {
3347
3373
  X(this);
3348
3374
  const e = Array.isArray(this.#a) ? [...this.#a] : [], i = this.#e?.processRows(e) ?? e;
3349
3375
  this._rows = i, this._virtualization.variableHeights && this.#Q();
3350
3376
  }
3351
- #Le(e) {
3377
+ #Pe(e) {
3352
3378
  const i = {
3353
3379
  ...ht,
3354
3380
  ...e.animation
@@ -3365,7 +3391,7 @@ class k extends HTMLElement {
3365
3391
  #de(e, i) {
3366
3392
  at(this.#ce, this.__rowsBodyEl, this._bodyEl, e, i);
3367
3393
  }
3368
- #Pe() {
3394
+ #ze() {
3369
3395
  dt(this.#ce, this.__rowsBodyEl, this.#o, this.#i);
3370
3396
  }
3371
3397
  #he() {
@@ -3399,7 +3425,7 @@ class k extends HTMLElement {
3399
3425
  this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(x.FULL, "setup");
3400
3426
  }
3401
3427
  }
3402
- #ze(e) {
3428
+ #De(e) {
3403
3429
  let i = 0, o = 0, n = 0, r = 0, s = 0;
3404
3430
  if (this.#g) {
3405
3431
  const a = this._virtualization.container, c = this.#V;
@@ -3608,12 +3634,12 @@ class k extends HTMLElement {
3608
3634
  return this.#t.collectState(e);
3609
3635
  }
3610
3636
  set columnState(e) {
3611
- e && (this.#O = e, this.#t.initialColumnState = e, this.#u && this.#De(e));
3637
+ e && (this.#O = e, this.#t.initialColumnState = e, this.#u && this.#Oe(e));
3612
3638
  }
3613
3639
  get columnState() {
3614
3640
  return this.getColumnState();
3615
3641
  }
3616
- #De(e) {
3642
+ #Oe(e) {
3617
3643
  const i = this.#e?.getAll() ?? [];
3618
3644
  this.#t.applyState(e, i), this.#P();
3619
3645
  }
@@ -3677,10 +3703,10 @@ class k extends HTMLElement {
3677
3703
  #K = !1;
3678
3704
  refreshShellHeader() {
3679
3705
  this.#K || (this.#K = !0, queueMicrotask(() => {
3680
- this.#K = !1, this.isConnected && (this.#k(), this.#t.markSourcesChanged(), this.#t.merge(), de(this.#i), this.#Z(), this.#W(), this.#Oe());
3706
+ this.#K = !1, this.isConnected && (this.#k(), this.#t.markSourcesChanged(), this.#t.merge(), de(this.#i), this.#Z(), this.#W(), this.#Me());
3681
3707
  }));
3682
3708
  }
3683
- #Oe() {
3709
+ #Me() {
3684
3710
  const i = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
3685
3711
  if (this._headerRowEl = i?.querySelector(".header-row"), this._virtualization.totalHeightEl = i?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = i?.querySelector(".rows-viewport"), this._bodyEl = i?.querySelector(".rows"), this.__rowsBodyEl = i?.querySelector(".rows-body"), this.#c.isInitialized) {
3686
3712
  fe(this.#n, this.#i), ce(this.#n, this.#o?.shell, this.#i);
@@ -3722,7 +3748,7 @@ class k extends HTMLElement {
3722
3748
  const n = o.firstElementChild;
3723
3749
  n && (e.replaceWith(n), this.#we(), ce(this.#n, this.#o?.shell, this.#i));
3724
3750
  }
3725
- #Me() {
3751
+ #ke() {
3726
3752
  const e = () => {
3727
3753
  const o = this.#i.lightDomTitle, n = this.#i.hasToolButtonsContainer;
3728
3754
  this.#k();
@@ -3740,7 +3766,7 @@ class k extends HTMLElement {
3740
3766
  const o = this.#i.lightDomTitle, n = this.#i.hasToolButtonsContainer;
3741
3767
  (o && !e || n && !i) && (this.#t.markSourcesChanged(), this.#t.merge(), this.#ge()), this.#s.requestPhase(x.COLUMNS, "refreshColumns");
3742
3768
  }
3743
- #ke() {
3769
+ #Ne() {
3744
3770
  const e = this._virtualization.container, i = this._virtualization.viewportEl ?? e;
3745
3771
  i && (this._virtualization.cachedViewportHeight = i.clientHeight), e && (this._virtualization.cachedFauxHeight = e.clientHeight);
3746
3772
  const o = this._virtualization.scrollAreaEl;
@@ -3909,7 +3935,7 @@ const oo = {
3909
3935
  class no {
3910
3936
  static dependencies;
3911
3937
  static manifest;
3912
- version = "1.14.1";
3938
+ version = "1.15.0";
3913
3939
  styles;
3914
3940
  cellRenderers;
3915
3941
  headerRenderers;