@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.
- package/README.md +2 -3
- package/all.js +1063 -1024
- package/all.js.map +1 -1
- package/index.js +1078 -912
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +28 -0
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/dom-builder.d.ts +2 -0
- package/lib/core/internal/dom-builder.d.ts.map +1 -1
- package/lib/core/internal/event-delegation.d.ts +21 -0
- package/lib/core/internal/event-delegation.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/internal/resize.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts +19 -13
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +13 -2
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/expander-column.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +6 -2
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/types.d.ts +41 -3
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +22 -11
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +59 -48
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +71 -60
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +1 -0
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +93 -80
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +29 -18
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +9 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +199 -165
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -0
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +79 -49
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +98 -87
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +70 -57
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +48 -37
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +71 -66
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-columns/pinned-columns.d.ts +2 -2
- package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +63 -52
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +310 -299
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/index.d.ts +1 -1
- package/lib/plugins/reorder/index.d.ts.map +1 -1
- package/lib/plugins/reorder/index.js +79 -68
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +115 -105
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +15 -4
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +41 -30
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +29 -18
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +59 -47
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +6 -6
- package/public.d.ts +42 -0
- package/public.d.ts.map +1 -1
- package/themes/dg-theme-bootstrap.css +55 -53
- package/themes/dg-theme-contrast.css +42 -40
- package/themes/dg-theme-large.css +38 -37
- package/themes/dg-theme-material.css +54 -52
- package/themes/dg-theme-standard.css +19 -17
- package/themes/dg-theme-vibrant.css +16 -14
- package/umd/grid.all.umd.js +23 -22
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +15 -14
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/column-virtualization.umd.js +1 -1
- package/umd/plugins/column-virtualization.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/grouping-columns.umd.js +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js +1 -1
- package/umd/plugins/pivot.umd.js.map +1 -1
- package/umd/plugins/reorder.umd.js +1 -1
- package/umd/plugins/reorder.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js +1 -1
- 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;
|
|
1
|
+
{"version":3,"file":"FilteringPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/filtering/FilteringPlugin.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
function P(
|
|
2
|
-
const { totalRows: e, viewportHeight: t, scrollTop: r, rowHeight:
|
|
3
|
-
let
|
|
4
|
-
|
|
5
|
-
let
|
|
6
|
-
return
|
|
7
|
-
start:
|
|
8
|
-
end:
|
|
9
|
-
offsetY:
|
|
10
|
-
totalHeight: e *
|
|
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
|
|
14
|
-
return
|
|
13
|
+
function V(h, e) {
|
|
14
|
+
return h <= e;
|
|
15
15
|
}
|
|
16
|
-
const
|
|
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
|
|
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.
|
|
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 { ...
|
|
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.
|
|
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.
|
|
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
|
|
311
|
-
|
|
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
|
|
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
|
|
335
|
+
return i.includes(l);
|
|
322
336
|
case "notContains":
|
|
323
|
-
return !
|
|
337
|
+
return !i.includes(l);
|
|
324
338
|
case "equals":
|
|
325
|
-
return
|
|
339
|
+
return i === l;
|
|
326
340
|
case "notEquals":
|
|
327
|
-
return
|
|
341
|
+
return i !== l;
|
|
328
342
|
case "startsWith":
|
|
329
|
-
return
|
|
343
|
+
return i.startsWith(l);
|
|
330
344
|
case "endsWith":
|
|
331
|
-
return
|
|
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
|
|
353
|
-
return e.length ?
|
|
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
|
|
369
|
+
function Y(h) {
|
|
356
370
|
return JSON.stringify(
|
|
357
|
-
|
|
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
|
|
379
|
+
function H(h, e) {
|
|
366
380
|
const t = /* @__PURE__ */ new Set();
|
|
367
|
-
for (const r of
|
|
368
|
-
const
|
|
369
|
-
|
|
381
|
+
for (const r of h) {
|
|
382
|
+
const n = r[e];
|
|
383
|
+
n != null && t.add(n);
|
|
370
384
|
}
|
|
371
|
-
return [...t].sort((r,
|
|
385
|
+
return [...t].sort((r, n) => typeof r == "number" && typeof n == "number" ? r - n : String(r).localeCompare(String(n)));
|
|
372
386
|
}
|
|
373
|
-
const G = '
|
|
374
|
-
class
|
|
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 =
|
|
438
|
+
const r = Y(t);
|
|
423
439
|
if (this.cacheKey === r && this.cachedResult)
|
|
424
440
|
return this.cachedResult;
|
|
425
|
-
const
|
|
426
|
-
return this.cachedResult =
|
|
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.
|
|
445
|
+
const e = this.gridElement;
|
|
430
446
|
if (!e) return;
|
|
431
447
|
e.querySelectorAll('[part~="header-cell"]').forEach((r) => {
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
434
|
-
const
|
|
435
|
-
if (!
|
|
436
|
-
const
|
|
437
|
-
if (!
|
|
438
|
-
const
|
|
439
|
-
let
|
|
440
|
-
if (
|
|
441
|
-
|
|
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
|
-
|
|
445
|
-
b.stopPropagation(), this.toggleFilterPanel(
|
|
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
|
|
448
|
-
|
|
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
|
|
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
|
|
561
|
-
if (
|
|
562
|
-
|
|
563
|
-
this.openPanelField !== e || !this.panelElement || (
|
|
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
|
|
568
|
-
this.renderPanelContent(e, t,
|
|
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,
|
|
574
|
-
let
|
|
575
|
-
|
|
576
|
-
const
|
|
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:
|
|
580
|
-
excludedValues:
|
|
581
|
-
searchText:
|
|
582
|
-
applySetFilter: (
|
|
583
|
-
this.applySetFilter(e,
|
|
595
|
+
uniqueValues: n,
|
|
596
|
+
excludedValues: i,
|
|
597
|
+
searchText: l,
|
|
598
|
+
applySetFilter: (p) => {
|
|
599
|
+
this.applySetFilter(e, p), this.closeFilterPanel();
|
|
584
600
|
},
|
|
585
|
-
applyTextFilter: (
|
|
586
|
-
this.applyTextFilter(e,
|
|
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
|
|
594
|
-
this.config.filterPanelRenderer && (this.config.filterPanelRenderer(r,
|
|
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
|
-
|
|
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
|
-
*
|
|
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
|
|
621
|
-
|
|
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 = `${
|
|
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,
|
|
630
|
-
const { field:
|
|
631
|
-
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
const
|
|
637
|
-
|
|
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",
|
|
642
|
-
const
|
|
643
|
-
const
|
|
644
|
-
b.checked = u, b.indeterminate = !u && !
|
|
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
|
|
648
|
-
for (const u of
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}), e.appendChild(
|
|
652
|
-
const
|
|
653
|
-
|
|
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",
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
const
|
|
659
|
-
r.forEach((
|
|
660
|
-
const u =
|
|
661
|
-
|
|
662
|
-
}),
|
|
663
|
-
let
|
|
664
|
-
const
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
const
|
|
668
|
-
|
|
669
|
-
|
|
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
|
|
672
|
-
return
|
|
673
|
-
},
|
|
674
|
-
const
|
|
675
|
-
if (E.style.height = `${
|
|
676
|
-
|
|
677
|
-
|
|
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
|
|
682
|
-
totalRows:
|
|
715
|
+
const c = P({
|
|
716
|
+
totalRows: s,
|
|
683
717
|
viewportHeight: u,
|
|
684
|
-
scrollTop:
|
|
685
|
-
rowHeight:
|
|
686
|
-
overscan:
|
|
718
|
+
scrollTop: w,
|
|
719
|
+
rowHeight: g.LIST_ITEM_HEIGHT,
|
|
720
|
+
overscan: g.LIST_OVERSCAN
|
|
687
721
|
});
|
|
688
|
-
|
|
689
|
-
for (let
|
|
690
|
-
|
|
691
|
-
},
|
|
692
|
-
const u =
|
|
693
|
-
if (
|
|
694
|
-
const d =
|
|
695
|
-
return !
|
|
696
|
-
}),
|
|
697
|
-
E.style.height = "0px",
|
|
698
|
-
const
|
|
699
|
-
|
|
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
|
-
|
|
736
|
+
A();
|
|
703
737
|
};
|
|
704
|
-
|
|
738
|
+
v.addEventListener(
|
|
705
739
|
"scroll",
|
|
706
740
|
() => {
|
|
707
|
-
|
|
741
|
+
x.length > 0 && A();
|
|
708
742
|
},
|
|
709
743
|
{ passive: !0 }
|
|
710
|
-
),
|
|
711
|
-
let
|
|
712
|
-
|
|
713
|
-
clearTimeout(
|
|
714
|
-
this.searchText.set(
|
|
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
|
|
722
|
-
for (const [u,
|
|
723
|
-
if (!
|
|
755
|
+
const s = [];
|
|
756
|
+
for (const [u, w] of y)
|
|
757
|
+
if (!w)
|
|
724
758
|
if (u === "__null__")
|
|
725
|
-
|
|
759
|
+
s.push(null);
|
|
726
760
|
else {
|
|
727
|
-
const
|
|
728
|
-
|
|
761
|
+
const c = r.find((d) => String(d) === u);
|
|
762
|
+
s.push(c !== void 0 ? c : u);
|
|
729
763
|
}
|
|
730
|
-
t.applySetFilter(
|
|
764
|
+
t.applySetFilter(s);
|
|
731
765
|
}), S.appendChild(R);
|
|
732
|
-
const
|
|
733
|
-
|
|
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(
|
|
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,
|
|
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:
|
|
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),
|
|
770
|
-
t.removeAttribute("aria-busy"), this.cachedResult =
|
|
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:
|
|
806
|
+
filteredRowCount: i.length
|
|
773
807
|
}), this.requestRender();
|
|
774
808
|
};
|
|
775
|
-
r && typeof r.then == "function" ? r.then(
|
|
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
|
-
|
|
854
|
+
g as FilteringPlugin
|
|
821
855
|
};
|
|
822
856
|
//# sourceMappingURL=index.js.map
|