@toolbox-web/grid 0.4.2 → 0.6.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 (123) hide show
  1. package/README.md +2 -3
  2. package/all.js +1063 -1024
  3. package/all.js.map +1 -1
  4. package/index.js +1078 -912
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +28 -0
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/dom-builder.d.ts +2 -0
  9. package/lib/core/internal/dom-builder.d.ts.map +1 -1
  10. package/lib/core/internal/event-delegation.d.ts +21 -0
  11. package/lib/core/internal/event-delegation.d.ts.map +1 -1
  12. package/lib/core/internal/header.d.ts.map +1 -1
  13. package/lib/core/internal/resize.d.ts.map +1 -1
  14. package/lib/core/internal/rows.d.ts +1 -1
  15. package/lib/core/internal/rows.d.ts.map +1 -1
  16. package/lib/core/internal/shell.d.ts +19 -13
  17. package/lib/core/internal/shell.d.ts.map +1 -1
  18. package/lib/core/plugin/base-plugin.d.ts +13 -2
  19. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  20. package/lib/core/plugin/expander-column.d.ts.map +1 -1
  21. package/lib/core/plugin/plugin-manager.d.ts +6 -2
  22. package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
  23. package/lib/core/types.d.ts +41 -3
  24. package/lib/core/types.d.ts.map +1 -1
  25. package/lib/plugins/clipboard/index.js +22 -11
  26. package/lib/plugins/clipboard/index.js.map +1 -1
  27. package/lib/plugins/column-virtualization/index.js +59 -48
  28. package/lib/plugins/column-virtualization/index.js.map +1 -1
  29. package/lib/plugins/context-menu/index.js +71 -60
  30. package/lib/plugins/context-menu/index.js.map +1 -1
  31. package/lib/plugins/editing/EditingPlugin.d.ts +1 -0
  32. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  33. package/lib/plugins/editing/index.js +93 -80
  34. package/lib/plugins/editing/index.js.map +1 -1
  35. package/lib/plugins/export/index.js +29 -18
  36. package/lib/plugins/export/index.js.map +1 -1
  37. package/lib/plugins/filtering/FilteringPlugin.d.ts +9 -1
  38. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  39. package/lib/plugins/filtering/index.js +199 -165
  40. package/lib/plugins/filtering/index.js.map +1 -1
  41. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -0
  42. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  43. package/lib/plugins/grouping-columns/index.js +79 -49
  44. package/lib/plugins/grouping-columns/index.js.map +1 -1
  45. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
  46. package/lib/plugins/grouping-rows/index.js +98 -87
  47. package/lib/plugins/grouping-rows/index.js.map +1 -1
  48. package/lib/plugins/master-detail/index.js +70 -57
  49. package/lib/plugins/master-detail/index.js.map +1 -1
  50. package/lib/plugins/multi-sort/index.js +48 -37
  51. package/lib/plugins/multi-sort/index.js.map +1 -1
  52. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  53. package/lib/plugins/pinned-columns/index.js +71 -66
  54. package/lib/plugins/pinned-columns/index.js.map +1 -1
  55. package/lib/plugins/pinned-columns/pinned-columns.d.ts +2 -2
  56. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
  57. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  58. package/lib/plugins/pinned-rows/index.js +63 -52
  59. package/lib/plugins/pinned-rows/index.js.map +1 -1
  60. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  61. package/lib/plugins/pivot/index.js +310 -299
  62. package/lib/plugins/pivot/index.js.map +1 -1
  63. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
  64. package/lib/plugins/reorder/index.d.ts +1 -1
  65. package/lib/plugins/reorder/index.d.ts.map +1 -1
  66. package/lib/plugins/reorder/index.js +79 -68
  67. package/lib/plugins/reorder/index.js.map +1 -1
  68. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  69. package/lib/plugins/selection/index.js +115 -105
  70. package/lib/plugins/selection/index.js.map +1 -1
  71. package/lib/plugins/server-side/index.js +15 -4
  72. package/lib/plugins/server-side/index.js.map +1 -1
  73. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
  74. package/lib/plugins/tree/index.js +41 -30
  75. package/lib/plugins/tree/index.js.map +1 -1
  76. package/lib/plugins/undo-redo/index.js +29 -18
  77. package/lib/plugins/undo-redo/index.js.map +1 -1
  78. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
  79. package/lib/plugins/visibility/index.js +59 -47
  80. package/lib/plugins/visibility/index.js.map +1 -1
  81. package/package.json +6 -6
  82. package/public.d.ts +42 -0
  83. package/public.d.ts.map +1 -1
  84. package/themes/dg-theme-bootstrap.css +55 -53
  85. package/themes/dg-theme-contrast.css +42 -40
  86. package/themes/dg-theme-large.css +38 -37
  87. package/themes/dg-theme-material.css +54 -52
  88. package/themes/dg-theme-standard.css +19 -17
  89. package/themes/dg-theme-vibrant.css +16 -14
  90. package/umd/grid.all.umd.js +23 -22
  91. package/umd/grid.all.umd.js.map +1 -1
  92. package/umd/grid.umd.js +15 -14
  93. package/umd/grid.umd.js.map +1 -1
  94. package/umd/plugins/column-virtualization.umd.js +1 -1
  95. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  96. package/umd/plugins/context-menu.umd.js +1 -1
  97. package/umd/plugins/context-menu.umd.js.map +1 -1
  98. package/umd/plugins/editing.umd.js +1 -1
  99. package/umd/plugins/editing.umd.js.map +1 -1
  100. package/umd/plugins/filtering.umd.js +1 -1
  101. package/umd/plugins/filtering.umd.js.map +1 -1
  102. package/umd/plugins/grouping-columns.umd.js +1 -1
  103. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  104. package/umd/plugins/grouping-rows.umd.js +1 -1
  105. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  106. package/umd/plugins/master-detail.umd.js +1 -1
  107. package/umd/plugins/master-detail.umd.js.map +1 -1
  108. package/umd/plugins/multi-sort.umd.js +1 -1
  109. package/umd/plugins/multi-sort.umd.js.map +1 -1
  110. package/umd/plugins/pinned-columns.umd.js +1 -1
  111. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  112. package/umd/plugins/pinned-rows.umd.js +1 -1
  113. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  114. package/umd/plugins/pivot.umd.js +1 -1
  115. package/umd/plugins/pivot.umd.js.map +1 -1
  116. package/umd/plugins/reorder.umd.js +1 -1
  117. package/umd/plugins/reorder.umd.js.map +1 -1
  118. package/umd/plugins/selection.umd.js +1 -1
  119. package/umd/plugins/selection.umd.js.map +1 -1
  120. package/umd/plugins/tree.umd.js +1 -1
  121. package/umd/plugins/tree.umd.js.map +1 -1
  122. package/umd/plugins/visibility.umd.js +1 -1
  123. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"FilteringPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/filtering/FilteringPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIlE,OAAO,KAAK,EAAsB,YAAY,EAAE,WAAW,EAAqB,MAAM,SAAS,CAAC;AAEhG;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,cAAc,CAAC,YAAY,CAAC;IAC/D,QAAQ,CAAC,IAAI,eAAe;IAC5B,SAAkB,MAAM,SAAU;IAElC,cAAuB,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC,CAO5D;IAGD,OAAO,CAAC,OAAO,CAAuC;IACtD,OAAO,CAAC,YAAY,CAA0B;IAC9C,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,Y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EG;IACH,OAAO,CAAC,kBAAkB;IAmB1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA8CzB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA8C1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAoB9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAiBxB,qDAAqD;IACrD,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAwB;IAEhE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;IAO5C;;;OAGG;IACH,OAAO,CAAC,aAAa;IAgDrB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAsPhC;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;OAEG;IACH,OAAO,CAAC,eAAe;IAYvB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAiD5B;;OAEG;IACM,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,SAAS;IAcxE;;OAEG;IACM,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;CAsBnE"}
@@ -1,19 +1,19 @@
1
- function P(p) {
2
- const { totalRows: e, viewportHeight: t, scrollTop: r, rowHeight: l, overscan: n } = p, o = Math.ceil(t / l);
3
- let i = Math.floor(r / l) - n;
4
- i < 0 && (i = 0);
5
- let s = i + o + n * 2;
6
- return s > e && (s = e), s === e && i > 0 && (i = Math.max(0, s - o - n * 2)), {
7
- start: i,
8
- end: s,
9
- offsetY: i * l,
10
- totalHeight: e * l
1
+ function P(h) {
2
+ const { totalRows: e, viewportHeight: t, scrollTop: r, rowHeight: n, overscan: i } = h, l = Math.ceil(t / n);
3
+ let a = Math.floor(r / n) - i;
4
+ a < 0 && (a = 0);
5
+ let o = a + l + i * 2;
6
+ return o > e && (o = e), o === e && a > 0 && (a = Math.max(0, o - l - i * 2)), {
7
+ start: a,
8
+ end: o,
9
+ offsetY: a * n,
10
+ totalHeight: e * n
11
11
  };
12
12
  }
13
- function _(p, e) {
14
- return p <= e;
13
+ function V(h, e) {
14
+ return h <= e;
15
15
  }
16
- const V = {
16
+ const _ = {
17
17
  expand: "▶",
18
18
  collapse: "▼",
19
19
  sortAsc: "▲",
@@ -200,10 +200,21 @@ class M {
200
200
  return this.grid;
201
201
  }
202
202
  /**
203
- * Get the shadow root of the grid.
203
+ * Get the render root of the grid for DOM queries.
204
+ * @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
205
+ *
206
+ * With Shadow DOM removed, the grid element itself is the render root.
207
+ * All new code should use `this.gridElement` for DOM queries.
208
+ *
209
+ * @example
210
+ * // OLD (deprecated)
211
+ * const rows = this.shadowRoot?.querySelector('.rows');
212
+ *
213
+ * // NEW (preferred)
214
+ * const rows = this.gridElement.querySelector('.rows');
204
215
  */
205
216
  get shadowRoot() {
206
- return this.grid?.shadowRoot ?? null;
217
+ return this.gridElement;
207
218
  }
208
219
  /**
209
220
  * Get the disconnect signal for event listener cleanup.
@@ -231,7 +242,7 @@ class M {
231
242
  */
232
243
  get gridIcons() {
233
244
  const e = this.grid?.gridConfig?.icons ?? {};
234
- return { ...V, ...e };
245
+ return { ..._, ...e };
235
246
  }
236
247
  // #region Animation Helpers
237
248
  /**
@@ -254,7 +265,7 @@ class M {
254
265
  const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
255
266
  if (e === !1 || e === "off") return !1;
256
267
  if (e === !0 || e === "on") return !0;
257
- const t = this.shadowRoot?.host;
268
+ const t = this.gridElement;
258
269
  return t ? getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
259
270
  }
260
271
  /**
@@ -270,7 +281,7 @@ class M {
270
281
  * ```
271
282
  */
272
283
  get animationDuration() {
273
- const e = this.shadowRoot?.host;
284
+ const e = this.gridElement;
274
285
  if (e) {
275
286
  const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), r = parseInt(t, 10);
276
287
  if (!isNaN(r)) return r;
@@ -307,28 +318,31 @@ class M {
307
318
  }
308
319
  // #endregion
309
320
  }
310
- function q(p, e, t = !1) {
311
- const r = p[e.field];
321
+ function z(h) {
322
+ return h.meta?.utility === !0;
323
+ }
324
+ function q(h, e, t = !1) {
325
+ const r = h[e.field];
312
326
  if (e.operator === "blank")
313
327
  return r == null || r === "";
314
328
  if (e.operator === "notBlank")
315
329
  return r != null && r !== "";
316
330
  if (r == null) return !1;
317
- const l = String(r), n = t ? l : l.toLowerCase(), o = t ? String(e.value) : String(e.value).toLowerCase();
331
+ const n = String(r), i = t ? n : n.toLowerCase(), l = t ? String(e.value) : String(e.value).toLowerCase();
318
332
  switch (e.operator) {
319
333
  // Text operators
320
334
  case "contains":
321
- return n.includes(o);
335
+ return i.includes(l);
322
336
  case "notContains":
323
- return !n.includes(o);
337
+ return !i.includes(l);
324
338
  case "equals":
325
- return n === o;
339
+ return i === l;
326
340
  case "notEquals":
327
- return n !== o;
341
+ return i !== l;
328
342
  case "startsWith":
329
- return n.startsWith(o);
343
+ return i.startsWith(l);
330
344
  case "endsWith":
331
- return n.endsWith(o);
345
+ return i.endsWith(l);
332
346
  // Number/Date operators (use raw numeric values)
333
347
  case "lessThan":
334
348
  return Number(r) < Number(e.value);
@@ -349,12 +363,12 @@ function q(p, e, t = !1) {
349
363
  return !0;
350
364
  }
351
365
  }
352
- function z(p, e, t = !1) {
353
- return e.length ? p.filter((r) => e.every((l) => q(r, l, t))) : p;
366
+ function B(h, e, t = !1) {
367
+ return e.length ? h.filter((r) => e.every((n) => q(r, n, t))) : h;
354
368
  }
355
- function B(p) {
369
+ function Y(h) {
356
370
  return JSON.stringify(
357
- p.map((e) => ({
371
+ h.map((e) => ({
358
372
  field: e.field,
359
373
  operator: e.operator,
360
374
  value: e.value,
@@ -362,16 +376,16 @@ function B(p) {
362
376
  }))
363
377
  );
364
378
  }
365
- function N(p, e) {
379
+ function H(h, e) {
366
380
  const t = /* @__PURE__ */ new Set();
367
- for (const r of p) {
368
- const l = r[e];
369
- l != null && t.add(l);
381
+ for (const r of h) {
382
+ const n = r[e];
383
+ n != null && t.add(n);
370
384
  }
371
- return [...t].sort((r, l) => typeof r == "number" && typeof l == "number" ? r - l : String(r).localeCompare(String(l)));
385
+ return [...t].sort((r, n) => typeof r == "number" && typeof n == "number" ? r - n : String(r).localeCompare(String(n)));
372
386
  }
373
- const G = ':host .tbw-quick-filter-input{flex:1;max-width:300px;height:28px;padding:0 8px;border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:13px}:host .tbw-quick-filter-input:focus{outline:none;border-color:var(--tbw-color-accent)}:host .header-cell.filtered:before{content:"";position:absolute;top:4px;right:4px;width:6px;height:6px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}:host .tbw-filter-btn{display:inline-flex;align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:4px;opacity:.4;transition:opacity .15s;color:inherit;vertical-align:middle}:host .tbw-filter-btn:hover,:host .tbw-filter-btn.active{opacity:1}:host .tbw-filter-btn.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}', $ = ".tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, 4px));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:12px;z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, 13px)}.tbw-filter-search{margin-bottom:8px}.tbw-filter-search-input{width:100%;padding:6px 10px;background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, 4px);font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:4px 2px;margin-bottom:8px;border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:12px;padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:8px;max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:8px;padding:4px 2px;cursor:pointer;border-radius:3px}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:8px 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:8px;padding-top:8px;border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:6px 12px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:4px;cursor:pointer;font-size:13px}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:6px 12px;background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:4px;cursor:pointer;font-size:13px}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}";
374
- class x extends M {
387
+ const G = '@layer tbw-plugins{tbw-grid .tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem)}tbw-grid .tbw-quick-filter-input:focus{outline:none;border-color:var(--tbw-color-accent)}tbw-grid .header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}tbw-grid .tbw-filter-btn{display:inline-flex;align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s;color:inherit;vertical-align:middle}tbw-grid .tbw-filter-btn:hover,tbw-grid .tbw-filter-btn.active{opacity:1}tbw-grid .tbw-filter-btn.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}', $ = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-search-input{width:100%;padding:var(--tbw-button-padding, .375rem .625rem);background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:var(--tbw-font-size-xs, .75rem);padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding-sm, .25rem .125rem);cursor:pointer;border-radius:3px}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem)) 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-top:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:var(--tbw-button-padding, .375rem .75rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:var(--tbw-button-padding, .375rem .75rem);background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}}";
388
+ class g extends M {
375
389
  name = "filtering";
376
390
  styles = G;
377
391
  get defaultConfig() {
@@ -388,6 +402,8 @@ class x extends M {
388
402
  cacheKey = null;
389
403
  openPanelField = null;
390
404
  panelElement = null;
405
+ panelAnchorElement = null;
406
+ // For CSS anchor positioning cleanup
391
407
  searchText = /* @__PURE__ */ new Map();
392
408
  excludedValues = /* @__PURE__ */ new Map();
393
409
  panelAbortController = null;
@@ -419,33 +435,33 @@ class x extends M {
419
435
  if (!t.length) return [...e];
420
436
  if (this.config.filterHandler)
421
437
  return this.cachedResult ? this.cachedResult : [...e];
422
- const r = B(t);
438
+ const r = Y(t);
423
439
  if (this.cacheKey === r && this.cachedResult)
424
440
  return this.cachedResult;
425
- const l = z([...e], t, this.config.caseSensitive);
426
- return this.cachedResult = l, this.cacheKey = r, l;
441
+ const n = B([...e], t, this.config.caseSensitive);
442
+ return this.cachedResult = n, this.cacheKey = r, n;
427
443
  }
428
444
  afterRender() {
429
- const e = this.shadowRoot;
445
+ const e = this.gridElement;
430
446
  if (!e) return;
431
447
  e.querySelectorAll('[part~="header-cell"]').forEach((r) => {
432
- const l = r.getAttribute("data-col");
433
- if (l === null) return;
434
- const n = this.visibleColumns[parseInt(l, 10)];
435
- if (!n || n.filterable === !1) return;
436
- const o = n.field;
437
- if (!o) return;
438
- const i = this.filters.has(o);
439
- let s = r.querySelector(".tbw-filter-btn");
440
- if (s) {
441
- s.classList.toggle("active", i), r.classList.toggle("filtered", i);
448
+ const n = r.getAttribute("data-col");
449
+ if (n === null) return;
450
+ const i = this.visibleColumns[parseInt(n, 10)];
451
+ if (!i || i.filterable === !1 || z(i)) return;
452
+ const l = i.field;
453
+ if (!l) return;
454
+ const a = this.filters.has(l);
455
+ let o = r.querySelector(".tbw-filter-btn");
456
+ if (o) {
457
+ o.classList.toggle("active", a), r.classList.toggle("filtered", a);
442
458
  return;
443
459
  }
444
- s = document.createElement("button"), s.className = "tbw-filter-btn", s.setAttribute("aria-label", `Filter ${n.header ?? o}`), s.innerHTML = '<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>', i && (s.classList.add("active"), r.classList.add("filtered")), s.addEventListener("click", (b) => {
445
- b.stopPropagation(), this.toggleFilterPanel(o, n, s);
460
+ o = document.createElement("button"), o.className = "tbw-filter-btn", o.setAttribute("aria-label", `Filter ${i.header ?? l}`), o.innerHTML = '<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 && (o.classList.add("active"), r.classList.add("filtered")), o.addEventListener("click", (b) => {
461
+ b.stopPropagation(), this.toggleFilterPanel(l, i, o);
446
462
  });
447
- const f = r.querySelector(".resize-handle");
448
- f ? r.insertBefore(s, f) : r.appendChild(s);
463
+ const p = r.querySelector(".resize-handle");
464
+ p ? r.insertBefore(o, p) : r.appendChild(o);
449
465
  });
450
466
  }
451
467
  // #endregion
@@ -532,7 +548,7 @@ class x extends M {
532
548
  * Uses sourceRows to include all values regardless of current filter.
533
549
  */
534
550
  getUniqueValues(e) {
535
- return N(this.sourceRows, e);
551
+ return H(this.sourceRows, e);
536
552
  }
537
553
  // #endregion
538
554
  // #region Private Methods
@@ -557,41 +573,41 @@ class x extends M {
557
573
  return;
558
574
  }
559
575
  this.closeFilterPanel();
560
- const l = document.createElement("div");
561
- if (l.className = "tbw-filter-panel", this.panelElement = l, this.openPanelField = e, this.config.valuesHandler) {
562
- l.innerHTML = '<div class="tbw-filter-loading">Loading...</div>', document.body.appendChild(l), this.positionPanel(l, r), this.setupPanelCloseHandler(l, r), this.config.valuesHandler(e, t).then((o) => {
563
- this.openPanelField !== e || !this.panelElement || (l.innerHTML = "", this.renderPanelContent(e, t, l, o));
576
+ const n = document.createElement("div");
577
+ if (n.className = "tbw-filter-panel", this.isAnimationEnabled && n.classList.add("tbw-filter-panel-animated"), this.panelElement = n, this.openPanelField = e, this.config.valuesHandler) {
578
+ n.innerHTML = '<div class="tbw-filter-loading">Loading...</div>', document.body.appendChild(n), this.positionPanel(n, r), this.setupPanelCloseHandler(n, r), this.config.valuesHandler(e, t).then((l) => {
579
+ this.openPanelField !== e || !this.panelElement || (n.innerHTML = "", this.renderPanelContent(e, t, n, l));
564
580
  });
565
581
  return;
566
582
  }
567
- const n = N(this.sourceRows, e);
568
- this.renderPanelContent(e, t, l, n), document.body.appendChild(l), this.positionPanel(l, r), this.setupPanelCloseHandler(l, r);
583
+ const i = H(this.sourceRows, e);
584
+ this.renderPanelContent(e, t, n, i), document.body.appendChild(n), this.positionPanel(n, r), this.setupPanelCloseHandler(n, r);
569
585
  }
570
586
  /**
571
587
  * Render filter panel content with given values
572
588
  */
573
- renderPanelContent(e, t, r, l) {
574
- let n = this.excludedValues.get(e);
575
- n || (n = /* @__PURE__ */ new Set(), this.excludedValues.set(e, n));
576
- const o = this.searchText.get(e) ?? "", i = {
589
+ renderPanelContent(e, t, r, n) {
590
+ let i = this.excludedValues.get(e);
591
+ i || (i = /* @__PURE__ */ new Set(), this.excludedValues.set(e, i));
592
+ const l = this.searchText.get(e) ?? "", a = {
577
593
  field: e,
578
594
  column: t,
579
- uniqueValues: l,
580
- excludedValues: n,
581
- searchText: o,
582
- applySetFilter: (f) => {
583
- this.applySetFilter(e, f), this.closeFilterPanel();
595
+ uniqueValues: n,
596
+ excludedValues: i,
597
+ searchText: l,
598
+ applySetFilter: (p) => {
599
+ this.applySetFilter(e, p), this.closeFilterPanel();
584
600
  },
585
- applyTextFilter: (f, b, C) => {
586
- this.applyTextFilter(e, f, b, C), this.closeFilterPanel();
601
+ applyTextFilter: (p, b, C) => {
602
+ this.applyTextFilter(e, p, b, C), this.closeFilterPanel();
587
603
  },
588
604
  clearFilter: () => {
589
605
  this.clearFieldFilter(e), this.closeFilterPanel();
590
606
  },
591
607
  closePanel: () => this.closeFilterPanel()
592
608
  };
593
- let s = !1;
594
- this.config.filterPanelRenderer && (this.config.filterPanelRenderer(r, i), s = r.children.length > 0), s || this.renderDefaultFilterPanel(r, i, l, n);
609
+ let o = !1;
610
+ this.config.filterPanelRenderer && (this.config.filterPanelRenderer(r, a), o = r.children.length > 0), o || this.renderDefaultFilterPanel(r, a, n, i);
595
611
  }
596
612
  /**
597
613
  * Setup click-outside handler to close the panel
@@ -611,128 +627,146 @@ class x extends M {
611
627
  * Close the filter panel
612
628
  */
613
629
  closeFilterPanel() {
614
- this.panelElement && (this.panelElement.remove(), this.panelElement = null), this.openPanelField = null, this.panelAbortController?.abort(), this.panelAbortController = null;
630
+ const e = this.panelElement;
631
+ e && (e.remove(), this.panelElement = null), this.panelAnchorElement && (this.panelAnchorElement.style.anchorName = "", this.panelAnchorElement = null), this.openPanelField = null, this.panelAbortController?.abort(), this.panelAbortController = null;
615
632
  }
633
+ /** Cache for CSS anchor positioning support check */
634
+ static supportsAnchorPositioning = null;
616
635
  /**
617
- * Position the panel below the button
636
+ * Check if browser supports CSS Anchor Positioning
637
+ */
638
+ static checkAnchorPositioningSupport() {
639
+ return g.supportsAnchorPositioning === null && (g.supportsAnchorPositioning = CSS.supports("anchor-name", "--test")), g.supportsAnchorPositioning;
640
+ }
641
+ /**
642
+ * Position the panel below the header cell
643
+ * Uses CSS Anchor Positioning if supported, falls back to JS positioning
618
644
  */
619
645
  positionPanel(e, t) {
620
- const r = t.getBoundingClientRect();
621
- e.style.position = "fixed", e.style.top = `${r.bottom + 4}px`, e.style.left = `${r.left}px`, requestAnimationFrame(() => {
646
+ const n = t.closest(".cell") ?? t;
647
+ if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, g.checkAnchorPositioningSupport()) {
648
+ requestAnimationFrame(() => {
649
+ const l = e.getBoundingClientRect(), a = n.getBoundingClientRect();
650
+ l.top < a.top && e.classList.add("tbw-filter-panel-above");
651
+ });
652
+ return;
653
+ }
654
+ const i = n.getBoundingClientRect();
655
+ e.style.position = "fixed", e.style.top = `${i.bottom + 4}px`, e.style.left = `${i.left}px`, requestAnimationFrame(() => {
622
656
  const l = e.getBoundingClientRect();
623
- l.right > window.innerWidth - 8 && (e.style.left = `${window.innerWidth - l.width - 8}px`), l.bottom > window.innerHeight - 8 && (e.style.top = `${r.top - l.height - 4}px`);
657
+ l.right > window.innerWidth - 8 && (e.style.left = `${i.right - l.width}px`), l.bottom > window.innerHeight - 8 && (e.style.top = `${i.top - l.height - 4}px`, e.classList.add("tbw-filter-panel-above"));
624
658
  });
625
659
  }
626
660
  /**
627
661
  * Render the default filter panel content
628
662
  */
629
- renderDefaultFilterPanel(e, t, r, l) {
630
- const { field: n } = t, o = document.createElement("div");
631
- o.className = "tbw-filter-search";
632
- const i = document.createElement("input");
633
- i.type = "text", i.placeholder = "Search...", i.className = "tbw-filter-search-input", i.value = this.searchText.get(n) ?? "", o.appendChild(i), e.appendChild(o);
634
- const s = document.createElement("div");
635
- s.className = "tbw-filter-actions";
636
- const f = document.createElement("label");
637
- f.className = "tbw-filter-value-item", f.style.padding = "0", f.style.margin = "0";
663
+ renderDefaultFilterPanel(e, t, r, n) {
664
+ const { field: i } = t, l = document.createElement("div");
665
+ l.className = "tbw-filter-search";
666
+ const a = document.createElement("input");
667
+ a.type = "text", a.placeholder = "Search...", a.className = "tbw-filter-search-input", a.value = this.searchText.get(i) ?? "", l.appendChild(a), e.appendChild(l);
668
+ const o = document.createElement("div");
669
+ o.className = "tbw-filter-actions";
670
+ const p = document.createElement("label");
671
+ p.className = "tbw-filter-value-item", p.style.padding = "0", p.style.margin = "0";
638
672
  const b = document.createElement("input");
639
673
  b.type = "checkbox", b.className = "tbw-filter-checkbox";
640
674
  const C = document.createElement("span");
641
- C.textContent = "Select All", f.appendChild(b), f.appendChild(C), s.appendChild(f);
642
- const k = () => {
643
- const a = [...v.values()], u = a.every((d) => d), h = a.every((d) => !d);
644
- b.checked = u, b.indeterminate = !u && !h;
675
+ C.textContent = "Select All", p.appendChild(b), p.appendChild(C), o.appendChild(p);
676
+ const T = () => {
677
+ const s = [...y.values()], u = s.every((c) => c), w = s.every((c) => !c);
678
+ b.checked = u, b.indeterminate = !u && !w;
645
679
  };
646
680
  b.addEventListener("change", () => {
647
- const a = b.checked;
648
- for (const u of v.keys())
649
- v.set(u, a);
650
- k(), F();
651
- }), e.appendChild(s);
652
- const m = document.createElement("div");
653
- m.className = "tbw-filter-values";
681
+ const s = b.checked;
682
+ for (const u of y.keys())
683
+ y.set(u, s);
684
+ T(), A();
685
+ }), e.appendChild(o);
686
+ const v = document.createElement("div");
687
+ v.className = "tbw-filter-values";
654
688
  const E = document.createElement("div");
655
- E.className = "tbw-filter-values-spacer", m.appendChild(E);
656
- const g = document.createElement("div");
657
- g.className = "tbw-filter-values-content", m.appendChild(g);
658
- const v = /* @__PURE__ */ new Map();
659
- r.forEach((a) => {
660
- const u = a == null ? "__null__" : String(a);
661
- v.set(u, !l.has(a));
662
- }), k();
663
- let y = [];
664
- const I = (a, u) => {
665
- const h = a == null ? "(Blank)" : String(a), d = a == null ? "__null__" : String(a), c = document.createElement("label");
666
- c.className = "tbw-filter-value-item", c.style.position = "absolute", c.style.top = `${u * x.LIST_ITEM_HEIGHT}px`, c.style.left = "0", c.style.right = "0", c.style.height = `${x.LIST_ITEM_HEIGHT}px`, c.style.boxSizing = "border-box";
667
- const w = document.createElement("input");
668
- w.type = "checkbox", w.className = "tbw-filter-checkbox", w.checked = v.get(d) ?? !0, w.dataset.value = d, w.addEventListener("change", () => {
669
- v.set(d, w.checked), k();
689
+ E.className = "tbw-filter-values-spacer", v.appendChild(E);
690
+ const m = document.createElement("div");
691
+ m.className = "tbw-filter-values-content", v.appendChild(m);
692
+ const y = /* @__PURE__ */ new Map();
693
+ r.forEach((s) => {
694
+ const u = s == null ? "__null__" : String(s);
695
+ y.set(u, !n.has(s));
696
+ }), T();
697
+ let x = [];
698
+ const F = (s, u) => {
699
+ const w = s == null ? "(Blank)" : String(s), c = s == null ? "__null__" : String(s), d = document.createElement("label");
700
+ d.className = "tbw-filter-value-item", d.style.position = "absolute", d.style.top = `${u * g.LIST_ITEM_HEIGHT}px`, d.style.left = "0", d.style.right = "0", d.style.height = `${g.LIST_ITEM_HEIGHT}px`, d.style.boxSizing = "border-box";
701
+ const f = document.createElement("input");
702
+ f.type = "checkbox", f.className = "tbw-filter-checkbox", f.checked = y.get(c) ?? !0, f.dataset.value = c, f.addEventListener("change", () => {
703
+ y.set(c, f.checked), T();
670
704
  });
671
- const A = document.createElement("span");
672
- return A.textContent = h, c.appendChild(w), c.appendChild(A), c;
673
- }, F = () => {
674
- const a = y.length, u = m.clientHeight, h = m.scrollTop;
675
- if (E.style.height = `${a * x.LIST_ITEM_HEIGHT}px`, _(a, x.LIST_BYPASS_THRESHOLD / 3)) {
676
- g.innerHTML = "", g.style.transform = "translateY(0px)", y.forEach((c, w) => {
677
- g.appendChild(I(c, w));
705
+ const N = document.createElement("span");
706
+ return N.textContent = w, d.appendChild(f), d.appendChild(N), d;
707
+ }, A = () => {
708
+ const s = x.length, u = v.clientHeight, w = v.scrollTop;
709
+ if (E.style.height = `${s * g.LIST_ITEM_HEIGHT}px`, V(s, g.LIST_BYPASS_THRESHOLD / 3)) {
710
+ m.innerHTML = "", m.style.transform = "translateY(0px)", x.forEach((d, f) => {
711
+ m.appendChild(F(d, f));
678
712
  });
679
713
  return;
680
714
  }
681
- const d = P({
682
- totalRows: a,
715
+ const c = P({
716
+ totalRows: s,
683
717
  viewportHeight: u,
684
- scrollTop: h,
685
- rowHeight: x.LIST_ITEM_HEIGHT,
686
- overscan: x.LIST_OVERSCAN
718
+ scrollTop: w,
719
+ rowHeight: g.LIST_ITEM_HEIGHT,
720
+ overscan: g.LIST_OVERSCAN
687
721
  });
688
- g.style.transform = `translateY(${d.offsetY}px)`, g.innerHTML = "";
689
- for (let c = d.start; c < d.end; c++)
690
- g.appendChild(I(y[c], c - d.start));
691
- }, L = (a) => {
692
- const u = a.toLowerCase();
693
- if (y = r.filter((h) => {
694
- const d = h == null ? "(Blank)" : String(h);
695
- return !a || d.toLowerCase().includes(u);
696
- }), y.length === 0) {
697
- E.style.height = "0px", g.innerHTML = "";
698
- const h = document.createElement("div");
699
- h.className = "tbw-filter-no-match", h.textContent = "No matching values", g.appendChild(h);
722
+ m.style.transform = `translateY(${c.offsetY}px)`, m.innerHTML = "";
723
+ for (let d = c.start; d < c.end; d++)
724
+ m.appendChild(F(x[d], d - c.start));
725
+ }, I = (s) => {
726
+ const u = this.config.caseSensitive ?? !1, w = u ? s : s.toLowerCase();
727
+ if (x = r.filter((c) => {
728
+ const d = c == null ? "(Blank)" : String(c), f = u ? d : d.toLowerCase();
729
+ return !s || f.includes(w);
730
+ }), x.length === 0) {
731
+ E.style.height = "0px", m.innerHTML = "";
732
+ const c = document.createElement("div");
733
+ c.className = "tbw-filter-no-match", c.textContent = "No matching values", m.appendChild(c);
700
734
  return;
701
735
  }
702
- F();
736
+ A();
703
737
  };
704
- m.addEventListener(
738
+ v.addEventListener(
705
739
  "scroll",
706
740
  () => {
707
- y.length > 0 && F();
741
+ x.length > 0 && A();
708
742
  },
709
743
  { passive: !0 }
710
- ), L(i.value), e.appendChild(m);
711
- let H;
712
- i.addEventListener("input", () => {
713
- clearTimeout(H), H = setTimeout(() => {
714
- this.searchText.set(n, i.value), L(i.value);
744
+ ), I(a.value), e.appendChild(v);
745
+ let L;
746
+ a.addEventListener("input", () => {
747
+ clearTimeout(L), L = setTimeout(() => {
748
+ this.searchText.set(i, a.value), I(a.value);
715
749
  }, this.config.debounceMs ?? 150);
716
750
  });
717
751
  const S = document.createElement("div");
718
752
  S.className = "tbw-filter-buttons";
719
753
  const R = document.createElement("button");
720
754
  R.className = "tbw-filter-apply-btn", R.textContent = "Apply", R.addEventListener("click", () => {
721
- const a = [];
722
- for (const [u, h] of v)
723
- if (!h)
755
+ const s = [];
756
+ for (const [u, w] of y)
757
+ if (!w)
724
758
  if (u === "__null__")
725
- a.push(null);
759
+ s.push(null);
726
760
  else {
727
- const d = r.find((c) => String(c) === u);
728
- a.push(d !== void 0 ? d : u);
761
+ const c = r.find((d) => String(d) === u);
762
+ s.push(c !== void 0 ? c : u);
729
763
  }
730
- t.applySetFilter(a);
764
+ t.applySetFilter(s);
731
765
  }), S.appendChild(R);
732
- const T = document.createElement("button");
733
- T.className = "tbw-filter-clear-btn", T.textContent = "Clear Filter", T.addEventListener("click", () => {
766
+ const k = document.createElement("button");
767
+ k.className = "tbw-filter-clear-btn", k.textContent = "Clear Filter", k.addEventListener("click", () => {
734
768
  t.clearFilter();
735
- }), S.appendChild(T), e.appendChild(S);
769
+ }), S.appendChild(k), e.appendChild(S);
736
770
  }
737
771
  /**
738
772
  * Apply a set filter (exclude values)
@@ -748,13 +782,13 @@ class x extends M {
748
782
  /**
749
783
  * Apply a text filter
750
784
  */
751
- applyTextFilter(e, t, r, l) {
785
+ applyTextFilter(e, t, r, n) {
752
786
  this.filters.set(e, {
753
787
  field: e,
754
788
  type: "text",
755
789
  operator: t,
756
790
  value: r,
757
- valueTo: l
791
+ valueTo: n
758
792
  }), this.applyFiltersInternal();
759
793
  }
760
794
  /**
@@ -766,13 +800,13 @@ class x extends M {
766
800
  if (this.config.filterHandler) {
767
801
  const t = this.grid;
768
802
  t.setAttribute("aria-busy", "true");
769
- const r = this.config.filterHandler(e, this.sourceRows), l = (n) => {
770
- t.removeAttribute("aria-busy"), this.cachedResult = n, this.grid.rows = n, this.emit("filter-change", {
803
+ const r = this.config.filterHandler(e, this.sourceRows), n = (i) => {
804
+ t.removeAttribute("aria-busy"), this.cachedResult = i, this.grid.rows = i, this.emit("filter-change", {
771
805
  filters: e,
772
- filteredRowCount: n.length
806
+ filteredRowCount: i.length
773
807
  }), this.requestRender();
774
808
  };
775
- r && typeof r.then == "function" ? r.then(l) : l(r);
809
+ r && typeof r.then == "function" ? r.then(n) : n(r);
776
810
  return;
777
811
  }
778
812
  this.emit("filter-change", {
@@ -817,6 +851,6 @@ class x extends M {
817
851
  // #endregion
818
852
  }
819
853
  export {
820
- x as FilteringPlugin
854
+ g as FilteringPlugin
821
855
  };
822
856
  //# sourceMappingURL=index.js.map