@toolbox-web/grid 1.14.1 → 1.16.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 +5 -1
- package/all.js +2013 -1564
- package/all.js.map +1 -1
- package/index.js +918 -880
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/columns.d.ts +0 -5
- package/lib/core/internal/columns.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/types.d.ts +12 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +20 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.d.ts +1 -1
- package/lib/plugins/context-menu/index.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +177 -84
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/context-menu/menu.d.ts +7 -0
- package/lib/plugins/context-menu/menu.d.ts.map +1 -1
- package/lib/plugins/context-menu/types.d.ts +48 -2
- package/lib/plugins/context-menu/types.d.ts.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +327 -298
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +7 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/filter-model.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +173 -138
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +5 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +242 -109
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-columns/types.d.ts +7 -0
- package/lib/plugins/grouping-columns/types.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +11 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.d.ts +1 -1
- package/lib/plugins/pinned-columns/index.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +174 -79
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-columns/pinned-columns.d.ts +23 -4
- package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/types.d.ts +21 -9
- package/lib/plugins/pinned-columns/types.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +42 -2
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.d.ts +1 -1
- package/lib/plugins/visibility/index.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +219 -59
- package/lib/plugins/visibility/index.js.map +1 -1
- package/lib/plugins/visibility/types.d.ts +25 -0
- package/lib/plugins/visibility/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +27 -27
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +21 -21
- 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/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseGridPlugin, GridElement, PluginManifest } from '../../core/plugin/base-plugin';
|
|
1
|
+
import { BaseGridPlugin, GridElement, PluginManifest, PluginQuery } from '../../core/plugin/base-plugin';
|
|
2
2
|
import { ColumnState } from '../../core/types';
|
|
3
3
|
import { FilterConfig, FilterModel } from './types';
|
|
4
4
|
/**
|
|
@@ -145,6 +145,12 @@ export declare class FilteringPlugin extends BaseGridPlugin<FilterConfig> {
|
|
|
145
145
|
attach(grid: GridElement): void;
|
|
146
146
|
/** @internal */
|
|
147
147
|
detach(): void;
|
|
148
|
+
/**
|
|
149
|
+
* Handle inter-plugin queries.
|
|
150
|
+
* Contributes filter-related items to the header context menu.
|
|
151
|
+
* @internal
|
|
152
|
+
*/
|
|
153
|
+
handleQuery(query: PluginQuery): unknown;
|
|
148
154
|
/** @internal */
|
|
149
155
|
processRows(rows: readonly unknown[]): unknown[];
|
|
150
156
|
/** @internal */
|
|
@@ -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,KAAK,cAAc,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-model.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/filtering/filter-model.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAe3C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,UAAQ,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"filter-model.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/filtering/filter-model.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAe3C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,UAAQ,GAAG,OAAO,CAoE/G;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1D,IAAI,EAAE,CAAC,EAAE,EACT,OAAO,EAAE,WAAW,EAAE,EACtB,aAAa,UAAQ,GACpB,CAAC,EAAE,CAGL;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CASpE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CAetG"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
function G(x) {
|
|
2
|
-
const { totalRows: e, viewportHeight: t, scrollTop: r, rowHeight: n, overscan:
|
|
3
|
-
let u = Math.floor(r / n) -
|
|
2
|
+
const { totalRows: e, viewportHeight: t, scrollTop: r, rowHeight: n, overscan: i } = x, l = Math.ceil(t / n);
|
|
3
|
+
let u = Math.floor(r / n) - i;
|
|
4
4
|
u < 0 && (u = 0);
|
|
5
|
-
let
|
|
6
|
-
return
|
|
5
|
+
let a = u + l + i * 2;
|
|
6
|
+
return a > e && (a = e), a === e && u > 0 && (u = Math.max(0, a - l - i * 2)), {
|
|
7
7
|
start: u,
|
|
8
|
-
end:
|
|
8
|
+
end: a,
|
|
9
9
|
offsetY: u * n,
|
|
10
10
|
totalHeight: e * n
|
|
11
11
|
};
|
|
@@ -406,22 +406,26 @@ function j(x, e, t = !1) {
|
|
|
406
406
|
return r == null || r === "";
|
|
407
407
|
if (e.operator === "notBlank")
|
|
408
408
|
return r != null && r !== "";
|
|
409
|
+
if (e.operator === "notIn")
|
|
410
|
+
return r == null ? !0 : Array.isArray(e.value) && !e.value.includes(r);
|
|
411
|
+
if (e.operator === "in")
|
|
412
|
+
return Array.isArray(e.value) && e.value.includes(r);
|
|
409
413
|
if (r == null) return !1;
|
|
410
|
-
const n = String(r),
|
|
414
|
+
const n = String(r), i = t ? n : n.toLowerCase(), l = t ? String(e.value) : String(e.value).toLowerCase();
|
|
411
415
|
switch (e.operator) {
|
|
412
416
|
// Text operators
|
|
413
417
|
case "contains":
|
|
414
|
-
return
|
|
418
|
+
return i.includes(l);
|
|
415
419
|
case "notContains":
|
|
416
|
-
return !
|
|
420
|
+
return !i.includes(l);
|
|
417
421
|
case "equals":
|
|
418
|
-
return
|
|
422
|
+
return i === l;
|
|
419
423
|
case "notEquals":
|
|
420
|
-
return
|
|
424
|
+
return i !== l;
|
|
421
425
|
case "startsWith":
|
|
422
|
-
return
|
|
426
|
+
return i.startsWith(l);
|
|
423
427
|
case "endsWith":
|
|
424
|
-
return
|
|
428
|
+
return i.endsWith(l);
|
|
425
429
|
// Number/Date operators (use toNumeric for Date objects and date strings)
|
|
426
430
|
case "lessThan":
|
|
427
431
|
return V(r) < V(e.value);
|
|
@@ -433,11 +437,6 @@ function j(x, e, t = !1) {
|
|
|
433
437
|
return V(r) >= V(e.value);
|
|
434
438
|
case "between":
|
|
435
439
|
return V(r) >= V(e.value) && V(r) <= V(e.valueTo);
|
|
436
|
-
// Set operators
|
|
437
|
-
case "in":
|
|
438
|
-
return Array.isArray(e.value) && e.value.includes(r);
|
|
439
|
-
case "notIn":
|
|
440
|
-
return Array.isArray(e.value) && !e.value.includes(r);
|
|
441
440
|
default:
|
|
442
441
|
return !0;
|
|
443
442
|
}
|
|
@@ -475,6 +474,12 @@ class _ extends W {
|
|
|
475
474
|
type: "filter-applied",
|
|
476
475
|
description: "Emitted when filter criteria change. Subscribers can react to row visibility changes."
|
|
477
476
|
}
|
|
477
|
+
],
|
|
478
|
+
queries: [
|
|
479
|
+
{
|
|
480
|
+
type: "getContextMenuItems",
|
|
481
|
+
description: "Contributes filter-related items to the header context menu"
|
|
482
|
+
}
|
|
478
483
|
]
|
|
479
484
|
};
|
|
480
485
|
/** @internal */
|
|
@@ -557,6 +562,36 @@ class _ extends W {
|
|
|
557
562
|
this.filters.clear(), this.cachedResult = null, this.cacheKey = null, this.cachedInputSpot = null, this.openPanelField = null, this.panelElement && (this.panelElement.remove(), this.panelElement = null), this.searchText.clear(), this.excludedValues.clear(), this.panelAbortController?.abort(), this.panelAbortController = null;
|
|
558
563
|
}
|
|
559
564
|
// #endregion
|
|
565
|
+
// #region Query Handlers
|
|
566
|
+
/**
|
|
567
|
+
* Handle inter-plugin queries.
|
|
568
|
+
* Contributes filter-related items to the header context menu.
|
|
569
|
+
* @internal
|
|
570
|
+
*/
|
|
571
|
+
handleQuery(e) {
|
|
572
|
+
if (e.type === "getContextMenuItems") {
|
|
573
|
+
const t = e.context;
|
|
574
|
+
if (!t.isHeader) return;
|
|
575
|
+
const r = t.column;
|
|
576
|
+
if (!r?.field || !this.isFilteringEnabled() || !this.isColumnFilterable(r)) return;
|
|
577
|
+
const n = [], i = this.isFieldFiltered(r.field), l = this.filters.size > 0;
|
|
578
|
+
return i && n.push({
|
|
579
|
+
id: "filtering/clear-column-filter",
|
|
580
|
+
label: "Clear Filter",
|
|
581
|
+
icon: "✕",
|
|
582
|
+
order: 20,
|
|
583
|
+
action: () => this.clearFieldFilter(r.field)
|
|
584
|
+
}), l && n.push({
|
|
585
|
+
id: "filtering/clear-all-filters",
|
|
586
|
+
label: "Clear All Filters",
|
|
587
|
+
icon: "✕",
|
|
588
|
+
order: 21,
|
|
589
|
+
disabled: !l,
|
|
590
|
+
action: () => this.clearAllFilters()
|
|
591
|
+
}), n.length > 0 ? n : void 0;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
// #endregion
|
|
560
595
|
// #region Hooks
|
|
561
596
|
/** @internal */
|
|
562
597
|
processRows(e) {
|
|
@@ -569,11 +604,11 @@ class _ extends W {
|
|
|
569
604
|
first: e[0],
|
|
570
605
|
mid: e[Math.floor(e.length / 2)],
|
|
571
606
|
last: e[e.length - 1]
|
|
572
|
-
},
|
|
573
|
-
if (this.cacheKey === r && this.cachedResult &&
|
|
607
|
+
}, i = this.cachedInputSpot != null && n.len === this.cachedInputSpot.len && n.first === this.cachedInputSpot.first && n.mid === this.cachedInputSpot.mid && n.last === this.cachedInputSpot.last;
|
|
608
|
+
if (this.cacheKey === r && this.cachedResult && i)
|
|
574
609
|
return this.cachedResult;
|
|
575
|
-
const
|
|
576
|
-
return this.cachedResult =
|
|
610
|
+
const l = J([...e], t, this.config.caseSensitive);
|
|
611
|
+
return this.cachedResult = l, this.cacheKey = r, this.cachedInputSpot = n, l;
|
|
577
612
|
}
|
|
578
613
|
/** @internal */
|
|
579
614
|
afterRender() {
|
|
@@ -582,27 +617,27 @@ class _ extends W {
|
|
|
582
617
|
e.querySelectorAll('[part~="header-cell"]').forEach((r) => {
|
|
583
618
|
const n = r.getAttribute("data-col");
|
|
584
619
|
if (n === null) return;
|
|
585
|
-
const
|
|
586
|
-
if (!
|
|
587
|
-
const
|
|
588
|
-
if (!
|
|
589
|
-
const u = this.filters.has(
|
|
590
|
-
let
|
|
591
|
-
if (
|
|
592
|
-
const y =
|
|
593
|
-
if (
|
|
620
|
+
const i = this.visibleColumns[parseInt(n, 10)];
|
|
621
|
+
if (!i || !this.isColumnFilterable(i) || U(i)) return;
|
|
622
|
+
const l = i.field;
|
|
623
|
+
if (!l) return;
|
|
624
|
+
const u = this.filters.has(l);
|
|
625
|
+
let a = r.querySelector(".tbw-filter-btn");
|
|
626
|
+
if (a) {
|
|
627
|
+
const y = a.classList.contains("active");
|
|
628
|
+
if (a.classList.toggle("active", u), r.classList.toggle("filtered", u), y !== u) {
|
|
594
629
|
const h = u ? "filterActive" : "filter";
|
|
595
|
-
this.setIcon(
|
|
630
|
+
this.setIcon(a, this.resolveIcon(h));
|
|
596
631
|
}
|
|
597
632
|
return;
|
|
598
633
|
}
|
|
599
|
-
|
|
634
|
+
a = document.createElement("button"), a.className = "tbw-filter-btn", a.setAttribute("aria-label", `Filter ${i.header ?? l}`);
|
|
600
635
|
const f = u ? "filterActive" : "filter";
|
|
601
|
-
this.setIcon(
|
|
602
|
-
y.stopPropagation(), this.toggleFilterPanel(
|
|
636
|
+
this.setIcon(a, this.resolveIcon(f)), u && (a.classList.add("active"), r.classList.add("filtered")), a.addEventListener("click", (y) => {
|
|
637
|
+
y.stopPropagation(), this.toggleFilterPanel(l, i, a);
|
|
603
638
|
});
|
|
604
639
|
const N = r.querySelector(".resize-handle");
|
|
605
|
-
N ? r.insertBefore(
|
|
640
|
+
N ? r.insertBefore(a, N) : r.appendChild(a);
|
|
606
641
|
});
|
|
607
642
|
}
|
|
608
643
|
// #endregion
|
|
@@ -728,26 +763,26 @@ class _ extends W {
|
|
|
728
763
|
this.closeFilterPanel();
|
|
729
764
|
const n = document.createElement("div");
|
|
730
765
|
if (n.className = "tbw-filter-panel", this.copyGridThemeContext(n), this.isAnimationEnabled && n.classList.add("tbw-filter-panel-animated"), this.panelElement = n, this.openPanelField = e, this.config.valuesHandler) {
|
|
731
|
-
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((
|
|
732
|
-
this.openPanelField !== e || !this.panelElement || (n.innerHTML = "", this.renderPanelContent(e, t, n,
|
|
766
|
+
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) => {
|
|
767
|
+
this.openPanelField !== e || !this.panelElement || (n.innerHTML = "", this.renderPanelContent(e, t, n, l));
|
|
733
768
|
});
|
|
734
769
|
return;
|
|
735
770
|
}
|
|
736
|
-
const
|
|
737
|
-
document.body.appendChild(n), this.positionPanel(n, r), this.renderPanelContent(e, t, n,
|
|
771
|
+
const i = O(this.sourceRows, e);
|
|
772
|
+
document.body.appendChild(n), this.positionPanel(n, r), this.renderPanelContent(e, t, n, i), this.setupPanelCloseHandler(n, r);
|
|
738
773
|
}
|
|
739
774
|
/**
|
|
740
775
|
* Render filter panel content with given values
|
|
741
776
|
*/
|
|
742
777
|
renderPanelContent(e, t, r, n) {
|
|
743
|
-
let
|
|
744
|
-
|
|
745
|
-
const
|
|
778
|
+
let i = this.excludedValues.get(e);
|
|
779
|
+
i || (i = /* @__PURE__ */ new Set(), this.excludedValues.set(e, i));
|
|
780
|
+
const l = this.searchText.get(e) ?? "", u = {
|
|
746
781
|
field: e,
|
|
747
782
|
column: t,
|
|
748
783
|
uniqueValues: n,
|
|
749
|
-
excludedValues:
|
|
750
|
-
searchText:
|
|
784
|
+
excludedValues: i,
|
|
785
|
+
searchText: l,
|
|
751
786
|
applySetFilter: (f) => {
|
|
752
787
|
this.applySetFilter(e, f), this.closeFilterPanel();
|
|
753
788
|
},
|
|
@@ -759,14 +794,14 @@ class _ extends W {
|
|
|
759
794
|
},
|
|
760
795
|
closePanel: () => this.closeFilterPanel()
|
|
761
796
|
};
|
|
762
|
-
let
|
|
763
|
-
if (this.config.filterPanelRenderer && (this.config.filterPanelRenderer(r, u),
|
|
797
|
+
let a = !1;
|
|
798
|
+
if (this.config.filterPanelRenderer && (this.config.filterPanelRenderer(r, u), a = r.children.length > 0), !a && t.type) {
|
|
764
799
|
const f = this.grid.effectiveConfig.typeDefaults?.[t.type];
|
|
765
|
-
f?.filterPanelRenderer && (f.filterPanelRenderer(r, u),
|
|
800
|
+
f?.filterPanelRenderer && (f.filterPanelRenderer(r, u), a = r.children.length > 0);
|
|
766
801
|
}
|
|
767
|
-
if (!
|
|
802
|
+
if (!a) {
|
|
768
803
|
const f = t.type;
|
|
769
|
-
f === "number" ? this.renderNumberFilterPanel(r, u, n) : f === "date" ? this.renderDateFilterPanel(r, u, n) : this.renderDefaultFilterPanel(r, u, n,
|
|
804
|
+
f === "number" ? this.renderNumberFilterPanel(r, u, n) : f === "date" ? this.renderDateFilterPanel(r, u, n) : this.renderDefaultFilterPanel(r, u, n, i);
|
|
770
805
|
}
|
|
771
806
|
}
|
|
772
807
|
/**
|
|
@@ -806,25 +841,25 @@ class _ extends W {
|
|
|
806
841
|
const n = t.closest(".cell") ?? t;
|
|
807
842
|
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, _.checkAnchorPositioningSupport()) {
|
|
808
843
|
requestAnimationFrame(() => {
|
|
809
|
-
const
|
|
810
|
-
|
|
844
|
+
const l = e.getBoundingClientRect(), u = n.getBoundingClientRect();
|
|
845
|
+
l.top < u.top && e.classList.add("tbw-filter-panel-above");
|
|
811
846
|
});
|
|
812
847
|
return;
|
|
813
848
|
}
|
|
814
|
-
const
|
|
815
|
-
e.style.position = "fixed", e.style.top = `${
|
|
816
|
-
const
|
|
817
|
-
|
|
849
|
+
const i = n.getBoundingClientRect();
|
|
850
|
+
e.style.position = "fixed", e.style.top = `${i.bottom + 4}px`, e.style.left = `${i.left}px`, requestAnimationFrame(() => {
|
|
851
|
+
const l = e.getBoundingClientRect();
|
|
852
|
+
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"));
|
|
818
853
|
});
|
|
819
854
|
}
|
|
820
855
|
/**
|
|
821
856
|
* Render the default filter panel content
|
|
822
857
|
*/
|
|
823
858
|
renderDefaultFilterPanel(e, t, r, n) {
|
|
824
|
-
const { field:
|
|
859
|
+
const { field: i } = t, l = this.getListItemHeight(), u = document.createElement("div");
|
|
825
860
|
u.className = "tbw-filter-search";
|
|
826
|
-
const
|
|
827
|
-
|
|
861
|
+
const a = document.createElement("input");
|
|
862
|
+
a.type = "text", a.placeholder = "Search...", a.className = "tbw-filter-search-input", a.value = this.searchText.get(i) ?? "", u.appendChild(a), e.appendChild(u);
|
|
828
863
|
const f = document.createElement("div");
|
|
829
864
|
f.className = "tbw-filter-actions";
|
|
830
865
|
const N = document.createElement("label");
|
|
@@ -834,95 +869,95 @@ class _ extends W {
|
|
|
834
869
|
const h = document.createElement("span");
|
|
835
870
|
h.textContent = "Select All", N.appendChild(y), N.appendChild(h), f.appendChild(N);
|
|
836
871
|
const C = () => {
|
|
837
|
-
const
|
|
872
|
+
const s = [...k.values()], b = s.every((o) => o), m = s.every((o) => !o);
|
|
838
873
|
y.checked = b, y.indeterminate = !b && !m;
|
|
839
874
|
};
|
|
840
875
|
y.addEventListener("change", () => {
|
|
841
|
-
const
|
|
842
|
-
for (const b of
|
|
843
|
-
|
|
844
|
-
C(),
|
|
876
|
+
const s = y.checked;
|
|
877
|
+
for (const b of k.keys())
|
|
878
|
+
k.set(b, s);
|
|
879
|
+
C(), L();
|
|
845
880
|
}), e.appendChild(f);
|
|
846
|
-
const
|
|
847
|
-
|
|
881
|
+
const F = document.createElement("div");
|
|
882
|
+
F.className = "tbw-filter-values";
|
|
848
883
|
const w = document.createElement("div");
|
|
849
|
-
w.className = "tbw-filter-values-spacer",
|
|
884
|
+
w.className = "tbw-filter-values-spacer", F.appendChild(w);
|
|
850
885
|
const E = document.createElement("div");
|
|
851
|
-
E.className = "tbw-filter-values-content",
|
|
852
|
-
const
|
|
853
|
-
r.forEach((
|
|
854
|
-
const b =
|
|
855
|
-
|
|
886
|
+
E.className = "tbw-filter-values-content", F.appendChild(E);
|
|
887
|
+
const k = /* @__PURE__ */ new Map();
|
|
888
|
+
r.forEach((s) => {
|
|
889
|
+
const b = s == null ? "__null__" : String(s);
|
|
890
|
+
k.set(b, !n.has(s));
|
|
856
891
|
}), C();
|
|
857
892
|
let T = [];
|
|
858
|
-
const
|
|
859
|
-
const m =
|
|
893
|
+
const R = (s, b) => {
|
|
894
|
+
const m = s == null ? "(Blank)" : String(s), o = s == null ? "__null__" : String(s), c = document.createElement("label");
|
|
860
895
|
c.className = "tbw-filter-value-item", c.style.position = "absolute", c.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${b})`, c.style.left = "0", c.style.right = "0", c.style.boxSizing = "border-box";
|
|
861
896
|
const g = document.createElement("input");
|
|
862
|
-
g.type = "checkbox", g.className = "tbw-filter-checkbox", g.checked =
|
|
863
|
-
|
|
897
|
+
g.type = "checkbox", g.className = "tbw-filter-checkbox", g.checked = k.get(o) ?? !0, g.dataset.value = o, g.addEventListener("change", () => {
|
|
898
|
+
k.set(o, g.checked), C();
|
|
864
899
|
});
|
|
865
900
|
const M = document.createElement("span");
|
|
866
901
|
return M.textContent = m, c.appendChild(g), c.appendChild(M), c;
|
|
867
|
-
},
|
|
868
|
-
const
|
|
869
|
-
if (w.style.height = `${
|
|
902
|
+
}, L = () => {
|
|
903
|
+
const s = T.length, b = F.clientHeight, m = F.scrollTop;
|
|
904
|
+
if (w.style.height = `${s * l}px`, $(s, _.LIST_BYPASS_THRESHOLD / 3)) {
|
|
870
905
|
E.innerHTML = "", E.style.transform = "translateY(0px)", T.forEach((c, g) => {
|
|
871
|
-
E.appendChild(
|
|
906
|
+
E.appendChild(R(c, g));
|
|
872
907
|
});
|
|
873
908
|
return;
|
|
874
909
|
}
|
|
875
910
|
const o = G({
|
|
876
|
-
totalRows:
|
|
911
|
+
totalRows: s,
|
|
877
912
|
viewportHeight: b,
|
|
878
913
|
scrollTop: m,
|
|
879
|
-
rowHeight:
|
|
914
|
+
rowHeight: l,
|
|
880
915
|
overscan: _.LIST_OVERSCAN
|
|
881
916
|
});
|
|
882
917
|
E.style.transform = `translateY(${o.offsetY}px)`, E.innerHTML = "";
|
|
883
918
|
for (let c = o.start; c < o.end; c++)
|
|
884
|
-
E.appendChild(
|
|
885
|
-
}, S = (
|
|
886
|
-
const b = this.config.caseSensitive ?? !1, m = b ?
|
|
919
|
+
E.appendChild(R(T[c], c - o.start));
|
|
920
|
+
}, S = (s) => {
|
|
921
|
+
const b = this.config.caseSensitive ?? !1, m = b ? s : s.toLowerCase();
|
|
887
922
|
if (T = r.filter((o) => {
|
|
888
923
|
const c = o == null ? "(Blank)" : String(o), g = b ? c : c.toLowerCase();
|
|
889
|
-
return !
|
|
924
|
+
return !s || g.includes(m);
|
|
890
925
|
}), T.length === 0) {
|
|
891
926
|
w.style.height = "0px", E.innerHTML = "";
|
|
892
927
|
const o = document.createElement("div");
|
|
893
928
|
o.className = "tbw-filter-no-match", o.textContent = "No matching values", E.appendChild(o);
|
|
894
929
|
return;
|
|
895
930
|
}
|
|
896
|
-
|
|
931
|
+
L();
|
|
897
932
|
};
|
|
898
|
-
|
|
933
|
+
F.addEventListener(
|
|
899
934
|
"scroll",
|
|
900
935
|
() => {
|
|
901
|
-
T.length > 0 &&
|
|
936
|
+
T.length > 0 && L();
|
|
902
937
|
},
|
|
903
938
|
{ passive: !0 }
|
|
904
|
-
), S(
|
|
905
|
-
let
|
|
906
|
-
|
|
907
|
-
clearTimeout(
|
|
908
|
-
this.searchText.set(
|
|
939
|
+
), S(a.value), e.appendChild(F);
|
|
940
|
+
let I;
|
|
941
|
+
a.addEventListener("input", () => {
|
|
942
|
+
clearTimeout(I), I = setTimeout(() => {
|
|
943
|
+
this.searchText.set(i, a.value), S(a.value);
|
|
909
944
|
}, this.config.debounceMs ?? 150);
|
|
910
945
|
});
|
|
911
946
|
const P = document.createElement("div");
|
|
912
947
|
P.className = "tbw-filter-buttons";
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
const
|
|
916
|
-
for (const [b, m] of
|
|
948
|
+
const A = document.createElement("button");
|
|
949
|
+
A.className = "tbw-filter-apply-btn", A.textContent = "Apply", A.addEventListener("click", () => {
|
|
950
|
+
const s = [];
|
|
951
|
+
for (const [b, m] of k)
|
|
917
952
|
if (!m)
|
|
918
953
|
if (b === "__null__")
|
|
919
|
-
|
|
954
|
+
s.push(null);
|
|
920
955
|
else {
|
|
921
956
|
const o = r.find((c) => String(c) === b);
|
|
922
|
-
|
|
957
|
+
s.push(o !== void 0 ? o : b);
|
|
923
958
|
}
|
|
924
|
-
t.applySetFilter(
|
|
925
|
-
}), P.appendChild(
|
|
959
|
+
t.applySetFilter(s);
|
|
960
|
+
}), P.appendChild(A);
|
|
926
961
|
const v = document.createElement("button");
|
|
927
962
|
v.className = "tbw-filter-clear-btn", v.textContent = "Clear Filter", v.addEventListener("click", () => {
|
|
928
963
|
t.clearFilter();
|
|
@@ -932,42 +967,42 @@ class _ extends W {
|
|
|
932
967
|
* Render a number range filter panel with min/max inputs and slider
|
|
933
968
|
*/
|
|
934
969
|
renderNumberFilterPanel(e, t, r) {
|
|
935
|
-
const { field: n, column:
|
|
970
|
+
const { field: n, column: i } = t, l = i.filterParams, u = i.editorParams, a = (p, D) => {
|
|
936
971
|
if (typeof p == "number") return p;
|
|
937
972
|
if (typeof p == "string") {
|
|
938
973
|
const z = parseFloat(p);
|
|
939
974
|
return isNaN(z) ? D : z;
|
|
940
975
|
}
|
|
941
976
|
return D;
|
|
942
|
-
}, f = r.filter((p) => typeof p == "number" && !isNaN(p)), N = f.length > 0 ? Math.min(...f) : 0, y = f.length > 0 ? Math.max(...f) : 100, h =
|
|
943
|
-
let E = h,
|
|
944
|
-
w?.operator === "between" ? (E =
|
|
977
|
+
}, f = r.filter((p) => typeof p == "number" && !isNaN(p)), N = f.length > 0 ? Math.min(...f) : 0, y = f.length > 0 ? Math.max(...f) : 100, h = a(l?.min ?? u?.min, N), C = a(l?.max ?? u?.max, y), F = l?.step ?? u?.step ?? 1, w = this.filters.get(n);
|
|
978
|
+
let E = h, k = C;
|
|
979
|
+
w?.operator === "between" ? (E = a(w.value, h), k = a(w.valueTo, C)) : w?.operator === "greaterThanOrEqual" ? E = a(w.value, h) : w?.operator === "lessThanOrEqual" && (k = a(w.value, C));
|
|
945
980
|
const T = document.createElement("div");
|
|
946
981
|
T.className = "tbw-filter-range-inputs";
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
const
|
|
950
|
-
|
|
982
|
+
const R = document.createElement("div");
|
|
983
|
+
R.className = "tbw-filter-range-group";
|
|
984
|
+
const L = document.createElement("label");
|
|
985
|
+
L.textContent = "Min", L.className = "tbw-filter-range-label";
|
|
951
986
|
const S = document.createElement("input");
|
|
952
|
-
S.type = "number", S.className = "tbw-filter-range-input", S.min = String(h), S.max = String(C), S.step = String(
|
|
953
|
-
const
|
|
954
|
-
|
|
987
|
+
S.type = "number", S.className = "tbw-filter-range-input", S.min = String(h), S.max = String(C), S.step = String(F), S.value = String(E), R.appendChild(L), R.appendChild(S), T.appendChild(R);
|
|
988
|
+
const I = document.createElement("span");
|
|
989
|
+
I.className = "tbw-filter-range-separator", I.textContent = "–", T.appendChild(I);
|
|
955
990
|
const P = document.createElement("div");
|
|
956
991
|
P.className = "tbw-filter-range-group";
|
|
957
|
-
const
|
|
958
|
-
|
|
992
|
+
const A = document.createElement("label");
|
|
993
|
+
A.textContent = "Max", A.className = "tbw-filter-range-label";
|
|
959
994
|
const v = document.createElement("input");
|
|
960
|
-
v.type = "number", v.className = "tbw-filter-range-input", v.min = String(h), v.max = String(C), v.step = String(
|
|
961
|
-
const
|
|
962
|
-
|
|
995
|
+
v.type = "number", v.className = "tbw-filter-range-input", v.min = String(h), v.max = String(C), v.step = String(F), v.value = String(k), P.appendChild(A), P.appendChild(v), T.appendChild(P), e.appendChild(T);
|
|
996
|
+
const s = document.createElement("div");
|
|
997
|
+
s.className = "tbw-filter-range-slider";
|
|
963
998
|
const b = document.createElement("div");
|
|
964
999
|
b.className = "tbw-filter-range-track";
|
|
965
1000
|
const m = document.createElement("div");
|
|
966
1001
|
m.className = "tbw-filter-range-fill";
|
|
967
1002
|
const o = document.createElement("input");
|
|
968
|
-
o.type = "range", o.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", o.min = String(h), o.max = String(C), o.step = String(
|
|
1003
|
+
o.type = "range", o.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", o.min = String(h), o.max = String(C), o.step = String(F), o.value = String(E);
|
|
969
1004
|
const c = document.createElement("input");
|
|
970
|
-
c.type = "range", c.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", c.min = String(h), c.max = String(C), c.step = String(
|
|
1005
|
+
c.type = "range", c.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", c.min = String(h), c.max = String(C), c.step = String(F), c.value = String(k), s.appendChild(b), s.appendChild(m), s.appendChild(o), s.appendChild(c), e.appendChild(s);
|
|
971
1006
|
const g = () => {
|
|
972
1007
|
const p = parseFloat(o.value), D = parseFloat(c.value), z = C - h, q = (p - h) / z * 100, Y = (D - h) / z * 100;
|
|
973
1008
|
m.style.left = `${q}%`, m.style.width = `${Y - q}%`;
|
|
@@ -1001,26 +1036,26 @@ class _ extends W {
|
|
|
1001
1036
|
* Render a date range filter panel with from/to date inputs
|
|
1002
1037
|
*/
|
|
1003
1038
|
renderDateFilterPanel(e, t, r) {
|
|
1004
|
-
const { field: n, column:
|
|
1005
|
-
let E = "",
|
|
1039
|
+
const { field: n, column: i } = t, l = i.filterParams, u = i.editorParams, a = r.filter((d) => d instanceof Date || typeof d == "string" && !isNaN(Date.parse(d))).map((d) => d instanceof Date ? d : new Date(d)).filter((d) => !isNaN(d.getTime())), f = a.length > 0 ? new Date(Math.min(...a.map((d) => d.getTime()))) : null, N = a.length > 0 ? new Date(Math.max(...a.map((d) => d.getTime()))) : null, y = (d) => d ? d.toISOString().split("T")[0] : "", h = (d) => d ? typeof d == "string" ? d : typeof d == "number" ? y(new Date(d)) : "" : "", C = h(l?.min) || h(u?.min) || y(f), F = h(l?.max) || h(u?.max) || y(N), w = this.filters.get(n);
|
|
1040
|
+
let E = "", k = "";
|
|
1006
1041
|
const T = w?.operator === "blank";
|
|
1007
|
-
w?.operator === "between" ? (E = h(w.value) || "",
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1042
|
+
w?.operator === "between" ? (E = h(w.value) || "", k = h(w.valueTo) || "") : w?.operator === "greaterThanOrEqual" ? E = h(w.value) || "" : w?.operator === "lessThanOrEqual" && (k = h(w.value) || "");
|
|
1043
|
+
const R = document.createElement("div");
|
|
1044
|
+
R.className = "tbw-filter-date-range";
|
|
1045
|
+
const L = document.createElement("div");
|
|
1046
|
+
L.className = "tbw-filter-date-group";
|
|
1012
1047
|
const S = document.createElement("label");
|
|
1013
1048
|
S.textContent = "From", S.className = "tbw-filter-range-label";
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1049
|
+
const I = document.createElement("input");
|
|
1050
|
+
I.type = "date", I.className = "tbw-filter-date-input", C && (I.min = C), F && (I.max = F), I.value = E, L.appendChild(S), L.appendChild(I), R.appendChild(L);
|
|
1016
1051
|
const P = document.createElement("span");
|
|
1017
|
-
P.className = "tbw-filter-range-separator", P.textContent = "–",
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1052
|
+
P.className = "tbw-filter-range-separator", P.textContent = "–", R.appendChild(P);
|
|
1053
|
+
const A = document.createElement("div");
|
|
1054
|
+
A.className = "tbw-filter-date-group";
|
|
1020
1055
|
const v = document.createElement("label");
|
|
1021
1056
|
v.textContent = "To", v.className = "tbw-filter-range-label";
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1057
|
+
const s = document.createElement("input");
|
|
1058
|
+
s.type = "date", s.className = "tbw-filter-date-input", C && (s.min = C), F && (s.max = F), s.value = k, A.appendChild(v), A.appendChild(s), R.appendChild(A), e.appendChild(R);
|
|
1024
1059
|
const b = document.createElement("label");
|
|
1025
1060
|
b.className = "tbw-filter-blank-option";
|
|
1026
1061
|
const m = document.createElement("input");
|
|
@@ -1028,7 +1063,7 @@ class _ extends W {
|
|
|
1028
1063
|
const o = document.createTextNode("Show only blank");
|
|
1029
1064
|
b.appendChild(m), b.appendChild(o);
|
|
1030
1065
|
const c = (d) => {
|
|
1031
|
-
|
|
1066
|
+
I.disabled = d, s.disabled = d, R.classList.toggle("tbw-filter-disabled", d);
|
|
1032
1067
|
};
|
|
1033
1068
|
c(T), m.addEventListener("change", () => {
|
|
1034
1069
|
c(m.checked);
|
|
@@ -1041,7 +1076,7 @@ class _ extends W {
|
|
|
1041
1076
|
t.applyTextFilter("blank", "");
|
|
1042
1077
|
return;
|
|
1043
1078
|
}
|
|
1044
|
-
const d =
|
|
1079
|
+
const d = I.value, p = s.value;
|
|
1045
1080
|
d && p ? t.applyTextFilter("between", d, p) : d ? t.applyTextFilter("greaterThanOrEqual", d) : p ? t.applyTextFilter("lessThanOrEqual", p) : t.clearFilter();
|
|
1046
1081
|
}), g.appendChild(M);
|
|
1047
1082
|
const H = document.createElement("button");
|
|
@@ -1081,10 +1116,10 @@ class _ extends W {
|
|
|
1081
1116
|
if (this.config.filterHandler) {
|
|
1082
1117
|
const t = this.grid;
|
|
1083
1118
|
t.setAttribute("aria-busy", "true");
|
|
1084
|
-
const r = this.config.filterHandler(e, this.sourceRows), n = (
|
|
1085
|
-
t.removeAttribute("aria-busy"), this.cachedResult =
|
|
1119
|
+
const r = this.config.filterHandler(e, this.sourceRows), n = (i) => {
|
|
1120
|
+
t.removeAttribute("aria-busy"), this.cachedResult = i, this.grid.rows = i, this.emit("filter-change", {
|
|
1086
1121
|
filters: e,
|
|
1087
|
-
filteredRowCount:
|
|
1122
|
+
filteredRowCount: i.length
|
|
1088
1123
|
}), this.emitPluginEvent("filter-applied", { filters: e }), this.requestRender();
|
|
1089
1124
|
};
|
|
1090
1125
|
r && typeof r.then == "function" ? r.then(n) : n(r);
|