@editora/ui-core 0.1.19 → 0.1.20
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/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -671
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +4 -7
- package/dist/color-picker.cjs.js +9 -9
- package/dist/color-picker.esm.js +189 -252
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +9 -9
- package/dist/date-picker.esm.js +69 -97
- package/dist/date-range-picker.cjs.js +3 -3
- package/dist/date-range-picker.esm.js +32 -56
- package/dist/date-range-time-picker.cjs.js +9 -9
- package/dist/date-range-time-picker.esm.js +111 -140
- package/dist/date-time-picker.cjs.js +4 -4
- package/dist/date-time-picker.esm.js +112 -144
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +4 -4
- package/dist/multi-select.esm.js +120 -140
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +2 -2
- package/dist/portal.esm.js +10 -19
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +11 -18
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +45 -45
- package/dist/sortable.esm.js +421 -524
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.esm.js +35 -55
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +6 -6
- package/dist/textarea.esm.js +32 -41
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +22 -22
- package/dist/time-picker.esm.js +88 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +19 -19
- package/dist/transfer-list.esm.js +98 -111
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +2 -2
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
package/dist/data-table.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
const
|
|
1
|
+
import { E as C } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
const A = `
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
5
|
--ui-data-table-radius: 16px;
|
|
@@ -654,29 +654,27 @@ const S = `
|
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
656
|
`;
|
|
657
|
-
function
|
|
658
|
-
if (typeof document > "u")
|
|
659
|
-
|
|
660
|
-
const _ = "ui-data-table-light-dom-style", t = document.getElementById(_);
|
|
657
|
+
function w() {
|
|
658
|
+
if (typeof document > "u") return;
|
|
659
|
+
const m = "ui-data-table-light-dom-style", t = document.getElementById(m);
|
|
661
660
|
if (t) {
|
|
662
661
|
t.textContent !== x && (t.textContent = x);
|
|
663
662
|
return;
|
|
664
663
|
}
|
|
665
664
|
const a = document.createElement("style");
|
|
666
|
-
a.id =
|
|
665
|
+
a.id = m, a.textContent = x, document.head.appendChild(a);
|
|
667
666
|
}
|
|
668
|
-
typeof document < "u" &&
|
|
669
|
-
function m
|
|
670
|
-
return
|
|
667
|
+
typeof document < "u" && w();
|
|
668
|
+
function p(m) {
|
|
669
|
+
return m ? (m.textContent || "").replace(/\s+/g, " ").trim() : "";
|
|
671
670
|
}
|
|
672
|
-
function
|
|
673
|
-
const t =
|
|
674
|
-
if (/^-?\d+(\.\d+)?$/.test(t))
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
return !Number.isNaN(a) && /[-/]/.test(_) ? a : _.toLowerCase();
|
|
671
|
+
function S(m) {
|
|
672
|
+
const t = m.replace(/,/g, "");
|
|
673
|
+
if (/^-?\d+(\.\d+)?$/.test(t)) return Number(t);
|
|
674
|
+
const a = Date.parse(m);
|
|
675
|
+
return !Number.isNaN(a) && /[-/]/.test(m) ? a : m.toLowerCase();
|
|
678
676
|
}
|
|
679
|
-
const
|
|
677
|
+
const k = /* @__PURE__ */ new Set([
|
|
680
678
|
"sticky-header",
|
|
681
679
|
"sticky-footer",
|
|
682
680
|
"striped",
|
|
@@ -689,13 +687,13 @@ const E = /* @__PURE__ */ new Set([
|
|
|
689
687
|
"shape",
|
|
690
688
|
"variant",
|
|
691
689
|
"elevation"
|
|
692
|
-
]),
|
|
690
|
+
]), E = /* @__PURE__ */ new Set([
|
|
693
691
|
"pagination-id",
|
|
694
692
|
"bulk-actions-label",
|
|
695
693
|
"bulk-clear-label",
|
|
696
694
|
"state-text"
|
|
697
695
|
]);
|
|
698
|
-
class
|
|
696
|
+
class R extends C {
|
|
699
697
|
constructor() {
|
|
700
698
|
super(), this._table = null, this._observer = null, this._sortColumnIndex = -1, this._sortDirection = "asc", this._selectedRows = /* @__PURE__ */ new Set(), this._isSyncing = !1, this._isSettingPage = !1, this._isSettingColumnOrder = !1, this._page = 1, this._pageCount = 1, this._pageSize = 10, this._totalRows = 0, this._filteredRows = 0, this._paginationEl = null, this._resizeState = null, this._columnWidths = /* @__PURE__ */ new Map(), this._frameEl = null, this._virtualRaf = 0, this._virtualTopSpacer = null, this._virtualBottomSpacer = null, this._dragColumnIndex = -1, this._dragOverColumnIndex = -1, this._ignoreHeaderClickUntil = 0, this._syncRaf = 0, this._virtualStart = -1, this._virtualEnd = -1, this._virtualVisibleTotal = -1, this._resizeRaf = 0, this._pendingResizeColumn = -1, this._pendingResizeWidth = null, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onPaginationChange = this._onPaginationChange.bind(this), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onFrameScroll = this._onFrameScroll.bind(this), this._onDragStart = this._onDragStart.bind(this), this._onDragOver = this._onDragOver.bind(this), this._onDrop = this._onDrop.bind(this), this._onDragEnd = this._onDragEnd.bind(this);
|
|
701
699
|
}
|
|
@@ -737,7 +735,7 @@ class z extends A {
|
|
|
737
735
|
];
|
|
738
736
|
}
|
|
739
737
|
connectedCallback() {
|
|
740
|
-
super.connectedCallback(),
|
|
738
|
+
super.connectedCallback(), w(), this.addEventListener("click", this._onClick), this.addEventListener("keydown", this._onKeyDown), this.addEventListener("pointerdown", this._onPointerDown), this.addEventListener("dragstart", this._onDragStart), this.addEventListener("dragover", this._onDragOver), this.addEventListener("drop", this._onDrop), this.addEventListener("dragend", this._onDragEnd), this._observer = new MutationObserver(() => {
|
|
741
739
|
this._isSyncing || this._queueSyncStructure();
|
|
742
740
|
}), this._observer.observe(this, {
|
|
743
741
|
childList: !0,
|
|
@@ -759,11 +757,11 @@ class z extends A {
|
|
|
759
757
|
return;
|
|
760
758
|
}
|
|
761
759
|
if (this.isConnected) {
|
|
762
|
-
if (
|
|
760
|
+
if (E.has(t)) {
|
|
763
761
|
t === "pagination-id" ? this._syncPaginationBinding() : t === "bulk-actions-label" || t === "bulk-clear-label" ? this._updateBulkActions() : t === "state-text" && this._syncStateBar();
|
|
764
762
|
return;
|
|
765
763
|
}
|
|
766
|
-
if (
|
|
764
|
+
if (k.has(t)) {
|
|
767
765
|
t === "hide-summary" ? this._updateSummary() : (t === "state" || t === "loading") && this._syncStateBar();
|
|
768
766
|
return;
|
|
769
767
|
}
|
|
@@ -782,7 +780,7 @@ class z extends A {
|
|
|
782
780
|
}
|
|
783
781
|
const t = this.getAttribute("empty-text") || "No data available.";
|
|
784
782
|
this.setContent(`
|
|
785
|
-
<style>${
|
|
783
|
+
<style>${A}</style>
|
|
786
784
|
<div class="statebar" part="state" hidden role="status" aria-live="polite">
|
|
787
785
|
<span class="state-dot" aria-hidden="true"></span>
|
|
788
786
|
<span class="state-text"></span>
|
|
@@ -822,8 +820,7 @@ class z extends A {
|
|
|
822
820
|
return t.hasAttribute("data-virtual-spacer");
|
|
823
821
|
}
|
|
824
822
|
_clearVirtualSpacers() {
|
|
825
|
-
|
|
826
|
-
(t = this._virtualTopSpacer) != null && t.isConnected && this._virtualTopSpacer.remove(), (a = this._virtualBottomSpacer) != null && a.isConnected && this._virtualBottomSpacer.remove(), this._virtualTopSpacer = null, this._virtualBottomSpacer = null, this._virtualStart = -1, this._virtualEnd = -1, this._virtualVisibleTotal = -1;
|
|
823
|
+
this._virtualTopSpacer?.isConnected && this._virtualTopSpacer.remove(), this._virtualBottomSpacer?.isConnected && this._virtualBottomSpacer.remove(), this._virtualTopSpacer = null, this._virtualBottomSpacer = null, this._virtualStart = -1, this._virtualEnd = -1, this._virtualVisibleTotal = -1;
|
|
827
824
|
}
|
|
828
825
|
_parseRowHeight() {
|
|
829
826
|
const t = Number(this.getAttribute("row-height") || 44);
|
|
@@ -842,35 +839,31 @@ class z extends A {
|
|
|
842
839
|
return a || (t === "loading" ? "Refreshing table data" : t === "error" ? "Table data could not be loaded" : t === "success" ? "Table data is up to date" : "");
|
|
843
840
|
}
|
|
844
841
|
_syncStateBar() {
|
|
845
|
-
const t = this.root.querySelector(".statebar"), a = this.root.querySelector(".state-text"), e = this.root.querySelector(".loading-text"),
|
|
846
|
-
if (!t)
|
|
847
|
-
return;
|
|
842
|
+
const t = this.root.querySelector(".statebar"), a = this.root.querySelector(".state-text"), e = this.root.querySelector(".loading-text"), r = this.root.querySelector(".frame"), i = this._table;
|
|
843
|
+
if (!t) return;
|
|
848
844
|
const s = this._state();
|
|
849
845
|
s !== "idle" ? t.removeAttribute("hidden") : t.setAttribute("hidden", ""), t.setAttribute("data-state", s), t.setAttribute("aria-live", s === "error" ? "assertive" : "polite");
|
|
850
846
|
const n = this._stateText(s);
|
|
851
847
|
a && (a.textContent = n), e && (e.textContent = this._stateText("loading"));
|
|
852
|
-
const
|
|
853
|
-
|
|
848
|
+
const u = s === "loading" ? "true" : "false";
|
|
849
|
+
r && r.setAttribute("aria-busy", u), i && i.setAttribute("aria-busy", u);
|
|
854
850
|
}
|
|
855
851
|
_isInteractionBlocked() {
|
|
856
852
|
return this._state() === "loading";
|
|
857
853
|
}
|
|
858
854
|
_isInteractiveTarget(t) {
|
|
859
|
-
if (!t)
|
|
860
|
-
return !1;
|
|
855
|
+
if (!t) return !1;
|
|
861
856
|
const a = t.closest(
|
|
862
857
|
'button, a[href], input, select, textarea, label, summary, details, [contenteditable=""], [contenteditable="true"], [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="menuitem"]'
|
|
863
858
|
);
|
|
864
859
|
return !(!a || a.classList.contains("resize-handle"));
|
|
865
860
|
}
|
|
866
861
|
_headerKey(t, a) {
|
|
867
|
-
if (!t)
|
|
868
|
-
return `column-${a + 1}`;
|
|
862
|
+
if (!t) return `column-${a + 1}`;
|
|
869
863
|
const e = (t.getAttribute("data-key") || "").trim();
|
|
870
|
-
if (e)
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
return i ? i.toLowerCase().replace(/\s+/g, "_") : `column-${a + 1}`;
|
|
864
|
+
if (e) return e;
|
|
865
|
+
const r = p(t);
|
|
866
|
+
return r ? r.toLowerCase().replace(/\s+/g, "_") : `column-${a + 1}`;
|
|
874
867
|
}
|
|
875
868
|
_currentColumnOrderString() {
|
|
876
869
|
return this._headerCells().map((a, e) => this._headerKey(a, e)).join(",");
|
|
@@ -894,54 +887,44 @@ class z extends A {
|
|
|
894
887
|
}
|
|
895
888
|
_resolveFilterColumnIndex(t) {
|
|
896
889
|
const a = (this.getAttribute("filter-column") || "").trim();
|
|
897
|
-
if (!a)
|
|
898
|
-
return -1;
|
|
890
|
+
if (!a) return -1;
|
|
899
891
|
const e = Number(a);
|
|
900
892
|
if (Number.isInteger(e) && e >= 0 && e < t.length)
|
|
901
893
|
return e;
|
|
902
|
-
const
|
|
903
|
-
for (let
|
|
904
|
-
const s = t[
|
|
905
|
-
if (o ===
|
|
906
|
-
return r;
|
|
894
|
+
const r = a.toLowerCase();
|
|
895
|
+
for (let i = 0; i < t.length; i += 1) {
|
|
896
|
+
const s = t[i], o = (s.getAttribute("data-key") || "").toLowerCase(), n = p(s).toLowerCase();
|
|
897
|
+
if (o === r || n === r) return i;
|
|
907
898
|
}
|
|
908
899
|
return -1;
|
|
909
900
|
}
|
|
910
901
|
_resolveColumnIndex(t, a) {
|
|
911
|
-
if (typeof a == "number" && Number.isInteger(a) && a >= 0 && a < t.length)
|
|
912
|
-
return a;
|
|
902
|
+
if (typeof a == "number" && Number.isInteger(a) && a >= 0 && a < t.length) return a;
|
|
913
903
|
const e = String(a || "").trim();
|
|
914
|
-
if (!e)
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
return i;
|
|
919
|
-
const r = e.toLowerCase();
|
|
904
|
+
if (!e) return -1;
|
|
905
|
+
const r = Number(e);
|
|
906
|
+
if (Number.isInteger(r) && r >= 0 && r < t.length) return r;
|
|
907
|
+
const i = e.toLowerCase();
|
|
920
908
|
for (let s = 0; s < t.length; s += 1) {
|
|
921
|
-
const o = t[s], n = (o.getAttribute("data-key") || "").toLowerCase(),
|
|
922
|
-
if (n ===
|
|
923
|
-
return s;
|
|
909
|
+
const o = t[s], n = (o.getAttribute("data-key") || "").toLowerCase(), u = p(o).toLowerCase();
|
|
910
|
+
if (n === i || u === i || this._headerKey(o, s) === i) return s;
|
|
924
911
|
}
|
|
925
912
|
return -1;
|
|
926
913
|
}
|
|
927
914
|
_parseFilters(t) {
|
|
928
915
|
const a = this.getAttribute("filters");
|
|
929
|
-
if (!a)
|
|
930
|
-
return [];
|
|
916
|
+
if (!a) return [];
|
|
931
917
|
try {
|
|
932
918
|
const e = JSON.parse(a);
|
|
933
|
-
if (!Array.isArray(e))
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
const
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
const n = String(r.op || r.operator || "contains").trim().toLowerCase();
|
|
943
|
-
i.push({ columnIndex: o, op: n, value: r.value });
|
|
944
|
-
}), i;
|
|
919
|
+
if (!Array.isArray(e)) return [];
|
|
920
|
+
const r = [];
|
|
921
|
+
return e.forEach((i) => {
|
|
922
|
+
if (!i || typeof i != "object") return;
|
|
923
|
+
const s = i.column ?? i.field ?? i.key, o = this._resolveColumnIndex(t, s);
|
|
924
|
+
if (o < 0) return;
|
|
925
|
+
const n = String(i.op || i.operator || "contains").trim().toLowerCase();
|
|
926
|
+
r.push({ columnIndex: o, op: n, value: i.value });
|
|
927
|
+
}), r;
|
|
945
928
|
} catch {
|
|
946
929
|
return [];
|
|
947
930
|
}
|
|
@@ -951,28 +934,27 @@ class z extends A {
|
|
|
951
934
|
}
|
|
952
935
|
_parsePinColumns(t) {
|
|
953
936
|
const a = this.getAttribute("pin-columns");
|
|
954
|
-
if (!a)
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
l >= 0 && d.add(l);
|
|
937
|
+
if (!a) return { left: [], right: [] };
|
|
938
|
+
const e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = (u, h) => {
|
|
939
|
+
h.forEach((l) => {
|
|
940
|
+
const d = this._resolveColumnIndex(t, l);
|
|
941
|
+
d >= 0 && u.add(d);
|
|
960
942
|
});
|
|
961
943
|
};
|
|
962
944
|
try {
|
|
963
|
-
const
|
|
964
|
-
if (
|
|
965
|
-
|
|
966
|
-
const
|
|
967
|
-
return { left:
|
|
945
|
+
const u = JSON.parse(a);
|
|
946
|
+
if (u && typeof u == "object") {
|
|
947
|
+
i(e, this._normalizePinTokens(u.left)), i(r, this._normalizePinTokens(u.right));
|
|
948
|
+
const h = Array.from(e).sort((d, c) => d - c), l = Array.from(r).filter((d) => !e.has(d)).sort((d, c) => c - d);
|
|
949
|
+
return { left: h, right: l };
|
|
968
950
|
}
|
|
969
951
|
} catch {
|
|
970
952
|
}
|
|
971
|
-
a.split(";").map((
|
|
972
|
-
const [
|
|
973
|
-
|
|
953
|
+
a.split(";").map((u) => u.trim()).filter(Boolean).forEach((u) => {
|
|
954
|
+
const [h, l] = u.split(":"), d = (h || "").trim().toLowerCase(), c = this._normalizePinTokens(l || "");
|
|
955
|
+
d === "left" && i(e, c), d === "right" && i(r, c);
|
|
974
956
|
});
|
|
975
|
-
const o = Array.from(e).sort((
|
|
957
|
+
const o = Array.from(e).sort((u, h) => u - h), n = Array.from(r).filter((u) => !e.has(u)).sort((u, h) => h - u);
|
|
976
958
|
return { left: o, right: n };
|
|
977
959
|
}
|
|
978
960
|
_setPageAttribute(t) {
|
|
@@ -980,17 +962,14 @@ class z extends A {
|
|
|
980
962
|
this.getAttribute("page") !== String(a) && (this._isSettingPage = !0, this.setAttribute("page", String(a)), this._isSettingPage = !1);
|
|
981
963
|
}
|
|
982
964
|
_bodyRows() {
|
|
983
|
-
if (!this._table)
|
|
984
|
-
return [];
|
|
965
|
+
if (!this._table) return [];
|
|
985
966
|
const t = this._table.tBodies[0];
|
|
986
967
|
return t ? Array.from(t.rows).filter((a) => !this._isVirtualSpacerRow(a)) : [];
|
|
987
968
|
}
|
|
988
969
|
_headerCells() {
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
const t = (a = this._table.tHead) == null ? void 0 : a.rows[0];
|
|
993
|
-
return t ? Array.from(t.cells).filter((e) => e.tagName.toLowerCase() === "th") : Array.from(this._table.querySelectorAll("th"));
|
|
970
|
+
if (!this._table) return [];
|
|
971
|
+
const t = this._table.tHead?.rows[0];
|
|
972
|
+
return t ? Array.from(t.cells).filter((a) => a.tagName.toLowerCase() === "th") : Array.from(this._table.querySelectorAll("th"));
|
|
994
973
|
}
|
|
995
974
|
_clearPinnedColumns() {
|
|
996
975
|
this._table && this._table.querySelectorAll("[data-pinned]").forEach((t) => {
|
|
@@ -1000,101 +979,86 @@ class z extends A {
|
|
|
1000
979
|
}
|
|
1001
980
|
_resolveColumnWidth(t, a) {
|
|
1002
981
|
const e = this._columnWidths.get(t);
|
|
1003
|
-
if (typeof e == "number" && Number.isFinite(e))
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
return Number.isFinite(i) && i > 0 ? i : 120;
|
|
982
|
+
if (typeof e == "number" && Number.isFinite(e)) return Math.max(1, e);
|
|
983
|
+
const r = a?.getBoundingClientRect().width || a?.offsetWidth || 0;
|
|
984
|
+
return Number.isFinite(r) && r > 0 ? r : 120;
|
|
1007
985
|
}
|
|
1008
|
-
_pinCell(t, a, e,
|
|
1009
|
-
t && (t.setAttribute("data-pinned", a),
|
|
986
|
+
_pinCell(t, a, e, r, i) {
|
|
987
|
+
t && (t.setAttribute("data-pinned", a), r ? t.setAttribute("data-pin-edge", "true") : t.removeAttribute("data-pin-edge"), a === "left" ? (t.style.left = `${Math.max(0, Math.round(e))}px`, t.style.right = "") : (t.style.right = `${Math.max(0, Math.round(e))}px`, t.style.left = ""), t.style.zIndex = i ? "4" : "3");
|
|
1010
988
|
}
|
|
1011
989
|
_applyPinnedColumns() {
|
|
1012
|
-
if (!this._table)
|
|
1013
|
-
return;
|
|
990
|
+
if (!this._table) return;
|
|
1014
991
|
this._clearPinnedColumns();
|
|
1015
992
|
const t = this._headerCells();
|
|
1016
|
-
if (!t.length)
|
|
1017
|
-
return;
|
|
993
|
+
if (!t.length) return;
|
|
1018
994
|
const { left: a, right: e } = this._parsePinColumns(t);
|
|
1019
|
-
if (!a.length && !e.length)
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
let r = 0;
|
|
995
|
+
if (!a.length && !e.length) return;
|
|
996
|
+
const r = Array.from(this._table.rows).filter((o) => !this._isVirtualSpacerRow(o));
|
|
997
|
+
let i = 0;
|
|
1023
998
|
a.forEach((o, n) => {
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1026
|
-
const
|
|
1027
|
-
this._pinCell(
|
|
1028
|
-
}),
|
|
999
|
+
const u = this._resolveColumnWidth(o, t[o]), h = n === a.length - 1;
|
|
1000
|
+
r.forEach((l, d) => {
|
|
1001
|
+
const c = l.cells[o];
|
|
1002
|
+
this._pinCell(c, "left", i, h, d === 0);
|
|
1003
|
+
}), i += u;
|
|
1029
1004
|
});
|
|
1030
1005
|
let s = 0;
|
|
1031
1006
|
e.forEach((o, n) => {
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1034
|
-
const
|
|
1035
|
-
this._pinCell(
|
|
1036
|
-
}), s +=
|
|
1007
|
+
const u = this._resolveColumnWidth(o, t[o]), h = n === e.length - 1;
|
|
1008
|
+
r.forEach((l, d) => {
|
|
1009
|
+
const c = l.cells[o];
|
|
1010
|
+
this._pinCell(c, "right", s, h, d === 0);
|
|
1011
|
+
}), s += u;
|
|
1037
1012
|
});
|
|
1038
1013
|
}
|
|
1039
1014
|
_applyColumnOrder() {
|
|
1040
|
-
|
|
1041
|
-
if (!this._table)
|
|
1042
|
-
return;
|
|
1015
|
+
if (!this._table) return;
|
|
1043
1016
|
const t = (this.getAttribute("column-order") || "").trim();
|
|
1044
|
-
if (!t)
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
const i =
|
|
1050
|
-
if (!i.length)
|
|
1051
|
-
return;
|
|
1052
|
-
const r = t.split(",").map((l) => l.trim()).filter(Boolean);
|
|
1053
|
-
if (!r.length)
|
|
1054
|
-
return;
|
|
1017
|
+
if (!t) return;
|
|
1018
|
+
const a = this._table.tHead?.rows[0], e = this._table.tBodies[0];
|
|
1019
|
+
if (!a || !e) return;
|
|
1020
|
+
const r = Array.from(a.cells);
|
|
1021
|
+
if (!r.length) return;
|
|
1022
|
+
const i = t.split(",").map((l) => l.trim()).filter(Boolean);
|
|
1023
|
+
if (!i.length) return;
|
|
1055
1024
|
const s = [], o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
1056
|
-
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1025
|
+
r.forEach((l, d) => {
|
|
1026
|
+
const c = (l.getAttribute("data-key") || p(l)).toLowerCase().trim();
|
|
1027
|
+
c && n.set(c, d);
|
|
1059
1028
|
});
|
|
1060
|
-
for (const l of
|
|
1061
|
-
const
|
|
1062
|
-
if (Number.isInteger(
|
|
1063
|
-
o.has(
|
|
1029
|
+
for (const l of i) {
|
|
1030
|
+
const d = Number(l);
|
|
1031
|
+
if (Number.isInteger(d) && d >= 0 && d < r.length) {
|
|
1032
|
+
o.has(d) || (o.add(d), s.push(d));
|
|
1064
1033
|
continue;
|
|
1065
1034
|
}
|
|
1066
|
-
const
|
|
1067
|
-
typeof
|
|
1035
|
+
const c = n.get(l.toLowerCase());
|
|
1036
|
+
typeof c == "number" && !o.has(c) && (o.add(c), s.push(c));
|
|
1068
1037
|
}
|
|
1069
|
-
for (let l = 0; l <
|
|
1038
|
+
for (let l = 0; l < r.length; l += 1)
|
|
1070
1039
|
o.has(l) || s.push(l);
|
|
1071
|
-
if (s.every((l,
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
s.map((f) => u[f]).filter(Boolean).forEach((f) => l.appendChild(f));
|
|
1040
|
+
if (s.every((l, d) => l === d)) return;
|
|
1041
|
+
s.map((l) => r[l]).forEach((l) => a.appendChild(l)), Array.from(e.rows).filter((l) => !this._isVirtualSpacerRow(l)).forEach((l) => {
|
|
1042
|
+
const d = Array.from(l.cells);
|
|
1043
|
+
s.map((f) => d[f]).filter(Boolean).forEach((f) => l.appendChild(f));
|
|
1076
1044
|
}), this._columnWidths.clear();
|
|
1077
1045
|
}
|
|
1078
1046
|
_moveColumn(t, a) {
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
const
|
|
1083
|
-
if (!
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
const o = Array.from({ length: s }, (l, u) => u), [n] = o.splice(t, 1);
|
|
1089
|
-
o.splice(a, 0, n), o.map((l) => r[l]).forEach((l) => e.appendChild(l)), Array.from(i.rows).filter((l) => !this._isVirtualSpacerRow(l)).forEach((l) => {
|
|
1090
|
-
const u = Array.from(l.cells);
|
|
1091
|
-
o.map((f) => u[f]).filter(Boolean).forEach((f) => l.appendChild(f));
|
|
1047
|
+
if (!this._table) return !1;
|
|
1048
|
+
const e = this._table.tHead?.rows[0], r = this._table.tBodies[0];
|
|
1049
|
+
if (!e || !r) return !1;
|
|
1050
|
+
const i = Array.from(e.cells), s = i.length;
|
|
1051
|
+
if (!s || t < 0 || t >= s || a < 0 || a >= s || t === a) return !1;
|
|
1052
|
+
const o = Array.from({ length: s }, (l, d) => d), [n] = o.splice(t, 1);
|
|
1053
|
+
o.splice(a, 0, n), o.map((l) => i[l]).forEach((l) => e.appendChild(l)), Array.from(r.rows).filter((l) => !this._isVirtualSpacerRow(l)).forEach((l) => {
|
|
1054
|
+
const d = Array.from(l.cells);
|
|
1055
|
+
o.map((f) => d[f]).filter(Boolean).forEach((f) => l.appendChild(f));
|
|
1092
1056
|
});
|
|
1093
|
-
const
|
|
1094
|
-
return o.forEach((l,
|
|
1095
|
-
const
|
|
1096
|
-
typeof
|
|
1097
|
-
}), this._columnWidths =
|
|
1057
|
+
const h = /* @__PURE__ */ new Map();
|
|
1058
|
+
return o.forEach((l, d) => {
|
|
1059
|
+
const c = this._columnWidths.get(l);
|
|
1060
|
+
typeof c == "number" && h.set(d, c);
|
|
1061
|
+
}), this._columnWidths = h, this._sortColumnIndex >= 0 && (this._sortColumnIndex = o.indexOf(this._sortColumnIndex)), this._syncHeaderState(), this._applyPinnedColumns(), this._syncRowSelectionState(), !0;
|
|
1098
1062
|
}
|
|
1099
1063
|
_clearDragMarkers() {
|
|
1100
1064
|
this._headerCells().forEach((a) => {
|
|
@@ -1109,7 +1073,7 @@ class z extends A {
|
|
|
1109
1073
|
sourceIndex: t,
|
|
1110
1074
|
targetIndex: a,
|
|
1111
1075
|
order: e,
|
|
1112
|
-
keys: this._headerCells().map((
|
|
1076
|
+
keys: this._headerCells().map((r, i) => this._headerKey(r, i))
|
|
1113
1077
|
},
|
|
1114
1078
|
bubbles: !0
|
|
1115
1079
|
})
|
|
@@ -1120,15 +1084,14 @@ class z extends A {
|
|
|
1120
1084
|
e && e.focus();
|
|
1121
1085
|
}
|
|
1122
1086
|
_focusSelectableRow(t, a) {
|
|
1123
|
-
const e = this._bodyRows().filter((o) => !o.hidden),
|
|
1124
|
-
if (
|
|
1125
|
-
|
|
1126
|
-
const r = Math.min(e.length - 1, Math.max(0, i + a)), s = e[r];
|
|
1087
|
+
const e = this._bodyRows().filter((o) => !o.hidden), r = e.indexOf(t);
|
|
1088
|
+
if (r < 0) return;
|
|
1089
|
+
const i = Math.min(e.length - 1, Math.max(0, r + a)), s = e[i];
|
|
1127
1090
|
s && s.focus();
|
|
1128
1091
|
}
|
|
1129
1092
|
_headerKeyboardShortcuts(t, a) {
|
|
1130
|
-
const e = this._isRtl(),
|
|
1131
|
-
return t && s.push("Enter", "Space"), a && s.push(`Alt+${
|
|
1093
|
+
const e = this._isRtl(), r = e ? "ArrowRight" : "ArrowLeft", i = e ? "ArrowLeft" : "ArrowRight", s = [r, i, "Home", "End"];
|
|
1094
|
+
return t && s.push("Enter", "Space"), a && s.push(`Alt+${r}`, `Alt+${i}`), s.join(" ");
|
|
1132
1095
|
}
|
|
1133
1096
|
_syncStructure() {
|
|
1134
1097
|
if (!this._isSyncing) {
|
|
@@ -1149,14 +1112,14 @@ class z extends A {
|
|
|
1149
1112
|
}
|
|
1150
1113
|
}
|
|
1151
1114
|
_syncHeaderState() {
|
|
1152
|
-
const t = this.hasAttribute("sortable"), a = this.hasAttribute("draggable-columns"), e = this.hasAttribute("resizable-columns"),
|
|
1115
|
+
const t = this.hasAttribute("sortable"), a = this.hasAttribute("draggable-columns"), e = this.hasAttribute("resizable-columns"), r = this._headerKeyboardShortcuts(t, a);
|
|
1153
1116
|
this._headerCells().forEach((s, o) => {
|
|
1154
|
-
if (s.setAttribute("data-col-index", String(o)), s.setAttribute("scope", "col"), s.setAttribute("aria-colindex", String(o + 1)), t || a ? s.setAttribute("aria-keyshortcuts",
|
|
1117
|
+
if (s.setAttribute("data-col-index", String(o)), s.setAttribute("scope", "col"), s.setAttribute("aria-colindex", String(o + 1)), t || a ? s.setAttribute("aria-keyshortcuts", r) : s.removeAttribute("aria-keyshortcuts"), t ? s.setAttribute("data-sortable", "true") : s.removeAttribute("data-sortable"), t || a ? s.hasAttribute("tabindex") || s.setAttribute("tabindex", "0") : s.getAttribute("tabindex") === "0" && s.removeAttribute("tabindex"), o === this._sortColumnIndex && t ? s.setAttribute("aria-sort", this._sortDirection === "asc" ? "ascending" : "descending") : t ? s.setAttribute("aria-sort", "none") : s.removeAttribute("aria-sort"), a ? (s.setAttribute("data-draggable", "true"), s.setAttribute("draggable", "true"), s.setAttribute("aria-description", "Draggable column header")) : (s.removeAttribute("data-draggable"), s.removeAttribute("draggable"), s.removeAttribute("data-dragging"), s.removeAttribute("data-drag-over"), s.removeAttribute("aria-description")), e) {
|
|
1155
1118
|
s.setAttribute("data-resizable", "true");
|
|
1156
1119
|
let n = s.querySelector(".resize-handle");
|
|
1157
1120
|
n || (n = document.createElement("button"), n.type = "button", n.className = "resize-handle", n.setAttribute("aria-hidden", "true"), n.tabIndex = -1, s.appendChild(n)), n.setAttribute("data-col-index", String(o));
|
|
1158
|
-
const
|
|
1159
|
-
typeof
|
|
1121
|
+
const u = this._columnWidths.get(o);
|
|
1122
|
+
typeof u == "number" && this._setColumnWidth(o, u, !1);
|
|
1160
1123
|
} else {
|
|
1161
1124
|
s.removeAttribute("data-resizable");
|
|
1162
1125
|
const n = s.querySelector(".resize-handle");
|
|
@@ -1165,29 +1128,28 @@ class z extends A {
|
|
|
1165
1128
|
});
|
|
1166
1129
|
}
|
|
1167
1130
|
_applyPagination(t) {
|
|
1168
|
-
var l;
|
|
1169
1131
|
const a = this._bodyRows();
|
|
1170
1132
|
this._pageSize = this._parsePageSize(), this._totalRows = a.length;
|
|
1171
|
-
const e = this._parseFilterQuery(),
|
|
1172
|
-
this._filteredRows = o.length,
|
|
1133
|
+
const e = this._parseFilterQuery(), r = this._headerCells(), i = this._resolveFilterColumnIndex(r), s = this._parseFilters(r), o = a.filter((d) => this._rowMatchesFilter(d, e, i, s));
|
|
1134
|
+
this._filteredRows = o.length, this._table?.setAttribute("aria-rowcount", String(this._filteredRows));
|
|
1173
1135
|
const n = this._parsePage();
|
|
1174
1136
|
this._pageCount = Math.max(1, Math.ceil(o.length / this._pageSize)), this._page = Math.min(this._pageCount, Math.max(1, n)), this._page !== n && this._setPageAttribute(this._page);
|
|
1175
|
-
const
|
|
1176
|
-
if (a.forEach((
|
|
1177
|
-
|
|
1178
|
-
}), o.forEach((
|
|
1179
|
-
const f =
|
|
1180
|
-
|
|
1137
|
+
const u = (this._page - 1) * this._pageSize, h = u + this._pageSize, l = new Set(o);
|
|
1138
|
+
if (a.forEach((d) => {
|
|
1139
|
+
l.has(d) ? d.removeAttribute("data-hidden-by-filter") : (d.hidden = !0, d.setAttribute("data-hidden-by-filter", ""), d.removeAttribute("data-hidden-by-page"), d.removeAttribute("aria-rowindex"));
|
|
1140
|
+
}), o.forEach((d, c) => {
|
|
1141
|
+
const f = c >= u && c < h;
|
|
1142
|
+
d.hidden = !f, f ? d.removeAttribute("data-hidden-by-page") : d.setAttribute("data-hidden-by-page", ""), d.setAttribute("aria-rowindex", String(c + 1));
|
|
1181
1143
|
}), t) {
|
|
1182
|
-
const
|
|
1144
|
+
const d = o.length, c = d === 0 ? 0 : u + 1, f = Math.min(h, d);
|
|
1183
1145
|
this.dispatchEvent(
|
|
1184
1146
|
new CustomEvent("page-change", {
|
|
1185
1147
|
detail: {
|
|
1186
1148
|
page: this._page,
|
|
1187
1149
|
count: this._pageCount,
|
|
1188
1150
|
pageSize: this._pageSize,
|
|
1189
|
-
total:
|
|
1190
|
-
start:
|
|
1151
|
+
total: d,
|
|
1152
|
+
start: c,
|
|
1191
1153
|
end: f
|
|
1192
1154
|
},
|
|
1193
1155
|
bubbles: !0
|
|
@@ -1201,70 +1163,65 @@ class z extends A {
|
|
|
1201
1163
|
});
|
|
1202
1164
|
}
|
|
1203
1165
|
_ensureVirtualSpacer(t) {
|
|
1204
|
-
if (!this._table)
|
|
1205
|
-
return null;
|
|
1166
|
+
if (!this._table) return null;
|
|
1206
1167
|
const a = this._table.tBodies[0];
|
|
1207
|
-
if (!a)
|
|
1208
|
-
return null;
|
|
1168
|
+
if (!a) return null;
|
|
1209
1169
|
const e = t === "top" ? this._virtualTopSpacer : this._virtualBottomSpacer;
|
|
1210
|
-
if (e && e.isConnected)
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
return r.style.padding = "0", r.style.border = "0", r.style.height = "0px", r.style.lineHeight = "0", r.style.fontSize = "0", r.innerHTML = " ", i.appendChild(r), t === "top" ? (a.insertBefore(i, a.firstChild), this._virtualTopSpacer = i) : (a.appendChild(i), this._virtualBottomSpacer = i), i;
|
|
1170
|
+
if (e && e.isConnected) return e;
|
|
1171
|
+
const r = document.createElement("tr");
|
|
1172
|
+
r.setAttribute("data-virtual-spacer", t), r.setAttribute("aria-hidden", "true"), r.setAttribute("role", "presentation"), r.style.pointerEvents = "none";
|
|
1173
|
+
const i = document.createElement("td");
|
|
1174
|
+
return i.style.padding = "0", i.style.border = "0", i.style.height = "0px", i.style.lineHeight = "0", i.style.fontSize = "0", i.innerHTML = " ", r.appendChild(i), t === "top" ? (a.insertBefore(r, a.firstChild), this._virtualTopSpacer = r) : (a.appendChild(r), this._virtualBottomSpacer = r), r;
|
|
1216
1175
|
}
|
|
1217
1176
|
_setVirtualSpacerHeight(t, a, e) {
|
|
1218
|
-
if (!t)
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
i.colSpan !== Math.max(1, e) && (i.colSpan = Math.max(1, e)), i.style.padding = "0", i.style.border = "0", i.style.height = `${Math.max(0, Math.round(a))}px`, i.style.lineHeight = "0", i.style.fontSize = "0";
|
|
1177
|
+
if (!t) return;
|
|
1178
|
+
const r = t.cells[0] || t.appendChild(document.createElement("td"));
|
|
1179
|
+
r.colSpan !== Math.max(1, e) && (r.colSpan = Math.max(1, e)), r.style.padding = "0", r.style.border = "0", r.style.height = `${Math.max(0, Math.round(a))}px`, r.style.lineHeight = "0", r.style.fontSize = "0";
|
|
1222
1180
|
}
|
|
1223
1181
|
_applyVirtualization(t) {
|
|
1224
|
-
var w;
|
|
1225
1182
|
if (!this.hasAttribute("virtualize") || !this._frameEl || !this._table) {
|
|
1226
1183
|
this._clearVirtualization(!0);
|
|
1227
1184
|
return;
|
|
1228
1185
|
}
|
|
1229
|
-
const e = this._bodyRows().filter((
|
|
1186
|
+
const e = this._bodyRows().filter((g) => !g.hidden);
|
|
1230
1187
|
if (!e.length) {
|
|
1231
1188
|
this._clearVirtualization(!0);
|
|
1232
1189
|
return;
|
|
1233
1190
|
}
|
|
1234
|
-
const
|
|
1235
|
-
this._setVirtualSpacerHeight(
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1191
|
+
const r = this._parseRowHeight(), i = this._parseOverscan(), s = this._frameEl.clientHeight || r * 8, o = this._frameEl.scrollTop, n = Math.max(0, Math.floor(o / r) - i), u = Math.min(e.length, Math.ceil((o + s) / r) + i), h = n * r, l = Math.max(0, (e.length - u) * r), d = Math.max(1, this._headerCells().length || e[0]?.cells.length || 1), c = this._ensureVirtualSpacer("top"), f = this._ensureVirtualSpacer("bottom");
|
|
1192
|
+
this._setVirtualSpacerHeight(c, h, d), this._setVirtualSpacerHeight(f, l, d);
|
|
1193
|
+
const y = (g, v) => {
|
|
1194
|
+
v ? (g.style.display === "none" && (g.style.display = ""), g.removeAttribute("data-hidden-by-virtual")) : (g.style.display !== "none" && (g.style.display = "none"), g.setAttribute("data-hidden-by-virtual", ""));
|
|
1238
1195
|
};
|
|
1239
1196
|
if (!(this._virtualStart >= 0 && this._virtualEnd >= this._virtualStart && this._virtualVisibleTotal === e.length))
|
|
1240
|
-
e.forEach((
|
|
1241
|
-
|
|
1197
|
+
e.forEach((g, v) => {
|
|
1198
|
+
y(g, v >= n && v < u);
|
|
1242
1199
|
});
|
|
1243
1200
|
else {
|
|
1244
|
-
const
|
|
1245
|
-
for (let
|
|
1246
|
-
const
|
|
1247
|
-
|
|
1201
|
+
const g = this._virtualStart, v = this._virtualEnd;
|
|
1202
|
+
for (let b = g; b < Math.min(n, v); b += 1) {
|
|
1203
|
+
const _ = e[b];
|
|
1204
|
+
_ && y(_, !1);
|
|
1248
1205
|
}
|
|
1249
|
-
for (let
|
|
1250
|
-
const
|
|
1251
|
-
|
|
1206
|
+
for (let b = n; b < Math.min(g, u); b += 1) {
|
|
1207
|
+
const _ = e[b];
|
|
1208
|
+
_ && y(_, !0);
|
|
1252
1209
|
}
|
|
1253
|
-
for (let
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1210
|
+
for (let b = Math.max(u, g); b < v; b += 1) {
|
|
1211
|
+
const _ = e[b];
|
|
1212
|
+
_ && y(_, !1);
|
|
1256
1213
|
}
|
|
1257
|
-
for (let
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1214
|
+
for (let b = Math.max(v, n); b < u; b += 1) {
|
|
1215
|
+
const _ = e[b];
|
|
1216
|
+
_ && y(_, !0);
|
|
1260
1217
|
}
|
|
1261
1218
|
}
|
|
1262
|
-
this._virtualStart = n, this._virtualEnd =
|
|
1219
|
+
this._virtualStart = n, this._virtualEnd = u, this._virtualVisibleTotal = e.length, t && this.dispatchEvent(
|
|
1263
1220
|
new CustomEvent("virtual-range-change", {
|
|
1264
1221
|
detail: {
|
|
1265
1222
|
start: n,
|
|
1266
|
-
end: Math.max(n,
|
|
1267
|
-
visible: Math.max(0,
|
|
1223
|
+
end: Math.max(n, u - 1),
|
|
1224
|
+
visible: Math.max(0, u - n),
|
|
1268
1225
|
total: e.length
|
|
1269
1226
|
},
|
|
1270
1227
|
bubbles: !0
|
|
@@ -1273,24 +1230,22 @@ class z extends A {
|
|
|
1273
1230
|
}
|
|
1274
1231
|
_updateSummary() {
|
|
1275
1232
|
const t = this.root.querySelector(".summary");
|
|
1276
|
-
if (!t)
|
|
1277
|
-
return;
|
|
1233
|
+
if (!t) return;
|
|
1278
1234
|
const a = this._totalRows, e = this._filteredRows;
|
|
1279
1235
|
if (!a || !e) {
|
|
1280
1236
|
t.textContent = "No records";
|
|
1281
1237
|
return;
|
|
1282
1238
|
}
|
|
1283
|
-
const
|
|
1239
|
+
const r = (this._page - 1) * this._pageSize + 1, i = Math.min(this._page * this._pageSize, e);
|
|
1284
1240
|
if (e === a) {
|
|
1285
|
-
t.textContent = `Showing ${
|
|
1241
|
+
t.textContent = `Showing ${r}-${i} of ${a}`;
|
|
1286
1242
|
return;
|
|
1287
1243
|
}
|
|
1288
|
-
t.textContent = `Showing ${
|
|
1244
|
+
t.textContent = `Showing ${r}-${i} of ${e} filtered records (${a} total)`;
|
|
1289
1245
|
}
|
|
1290
1246
|
_syncEmptyText() {
|
|
1291
1247
|
const t = this.root.querySelector(".empty");
|
|
1292
|
-
if (!t)
|
|
1293
|
-
return;
|
|
1248
|
+
if (!t) return;
|
|
1294
1249
|
const a = !!this._parseFilterQuery();
|
|
1295
1250
|
if (this._table && this._filteredRows === 0 && a) {
|
|
1296
1251
|
t.textContent = "No matching records.";
|
|
@@ -1318,104 +1273,86 @@ class z extends A {
|
|
|
1318
1273
|
return /^-?\d+(\.\d+)?$/.test(a) ? Number(a) : t.toLowerCase();
|
|
1319
1274
|
}
|
|
1320
1275
|
_rulePasses(t, a) {
|
|
1321
|
-
const e = a.op,
|
|
1322
|
-
if (e === "empty")
|
|
1323
|
-
|
|
1324
|
-
if (e === "
|
|
1325
|
-
|
|
1326
|
-
if (e === "
|
|
1327
|
-
|
|
1328
|
-
if (e === "neq" || e === "not-equals")
|
|
1329
|
-
return s !== String(i ?? "").toLowerCase();
|
|
1330
|
-
if (e === "startswith" || e === "starts-with")
|
|
1331
|
-
return s.startsWith(String(i ?? "").toLowerCase());
|
|
1332
|
-
if (e === "endswith" || e === "ends-with")
|
|
1333
|
-
return s.endsWith(String(i ?? "").toLowerCase());
|
|
1276
|
+
const e = a.op, r = a.value, i = t.trim(), s = i.toLowerCase();
|
|
1277
|
+
if (e === "empty") return i.length === 0;
|
|
1278
|
+
if (e === "notempty" || e === "not-empty") return i.length > 0;
|
|
1279
|
+
if (e === "equals" || e === "eq") return s === String(r ?? "").toLowerCase();
|
|
1280
|
+
if (e === "neq" || e === "not-equals") return s !== String(r ?? "").toLowerCase();
|
|
1281
|
+
if (e === "startswith" || e === "starts-with") return s.startsWith(String(r ?? "").toLowerCase());
|
|
1282
|
+
if (e === "endswith" || e === "ends-with") return s.endsWith(String(r ?? "").toLowerCase());
|
|
1334
1283
|
if (e === "in")
|
|
1335
|
-
return (Array.isArray(
|
|
1284
|
+
return (Array.isArray(r) ? r.map((n) => String(n).toLowerCase()) : String(r ?? "").split(",").map((n) => n.trim().toLowerCase()).filter(Boolean)).includes(s);
|
|
1336
1285
|
if (e === "gt" || e === "gte" || e === "lt" || e === "lte" || e === "between") {
|
|
1337
|
-
const o = this._parseComparable(
|
|
1338
|
-
if (typeof o != "number")
|
|
1339
|
-
return !1;
|
|
1286
|
+
const o = this._parseComparable(i);
|
|
1287
|
+
if (typeof o != "number") return !1;
|
|
1340
1288
|
if (e === "between") {
|
|
1341
|
-
const
|
|
1342
|
-
return !Number.isFinite(
|
|
1289
|
+
const u = Array.isArray(r) ? r : String(r ?? "").split(","), h = Number(u[0]), l = Number(u[1]);
|
|
1290
|
+
return !Number.isFinite(h) || !Number.isFinite(l) ? !1 : o >= Math.min(h, l) && o <= Math.max(h, l);
|
|
1343
1291
|
}
|
|
1344
|
-
const n = Number(
|
|
1292
|
+
const n = Number(r);
|
|
1345
1293
|
return Number.isFinite(n) ? e === "gt" ? o > n : e === "gte" ? o >= n : e === "lt" ? o < n : o <= n : !1;
|
|
1346
1294
|
}
|
|
1347
|
-
return s.includes(String(
|
|
1295
|
+
return s.includes(String(r ?? "").toLowerCase());
|
|
1348
1296
|
}
|
|
1349
|
-
_rowMatchesFilter(t, a, e,
|
|
1297
|
+
_rowMatchesFilter(t, a, e, r) {
|
|
1350
1298
|
if (a) {
|
|
1351
|
-
const
|
|
1352
|
-
if (!
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
if (o.length && !o.every((n) => s.includes(n)))
|
|
1356
|
-
return !1;
|
|
1299
|
+
const i = e >= 0 ? p(t.cells[e]) : Array.from(t.cells).map((n) => p(n)).join(" ");
|
|
1300
|
+
if (!i) return !1;
|
|
1301
|
+
const s = i.toLowerCase(), o = a.split(/\s+/).filter(Boolean);
|
|
1302
|
+
if (o.length && !o.every((n) => s.includes(n))) return !1;
|
|
1357
1303
|
}
|
|
1358
|
-
return
|
|
1359
|
-
const s = t.cells[
|
|
1360
|
-
return this._rulePasses(
|
|
1304
|
+
return r.length ? r.every((i) => {
|
|
1305
|
+
const s = t.cells[i.columnIndex];
|
|
1306
|
+
return this._rulePasses(p(s), i);
|
|
1361
1307
|
}) : !0;
|
|
1362
1308
|
}
|
|
1363
1309
|
_setColumnWidth(t, a, e = !0) {
|
|
1364
|
-
if (!this._table)
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
if (this._columnWidths.set(t, i), Array.from(this._table.rows).forEach((o) => {
|
|
1310
|
+
if (!this._table) return;
|
|
1311
|
+
const r = Math.max(72, Math.round(a));
|
|
1312
|
+
if (this._columnWidths.set(t, r), Array.from(this._table.rows).forEach((o) => {
|
|
1368
1313
|
const n = o.cells[t];
|
|
1369
|
-
n && (n.style.width = `${
|
|
1370
|
-
}), !e)
|
|
1371
|
-
return;
|
|
1314
|
+
n && (n.style.width = `${r}px`, n.style.minWidth = `${r}px`, n.style.maxWidth = `${r}px`, n.style.boxSizing = "border-box");
|
|
1315
|
+
}), !e) return;
|
|
1372
1316
|
this._applyPinnedColumns();
|
|
1373
1317
|
const s = this._headerCells()[t];
|
|
1374
1318
|
this.dispatchEvent(
|
|
1375
1319
|
new CustomEvent("column-resize", {
|
|
1376
1320
|
detail: {
|
|
1377
1321
|
columnIndex: t,
|
|
1378
|
-
key:
|
|
1379
|
-
width:
|
|
1322
|
+
key: s?.getAttribute("data-key") || p(s) || `column-${t + 1}`,
|
|
1323
|
+
width: r
|
|
1380
1324
|
},
|
|
1381
1325
|
bubbles: !0
|
|
1382
1326
|
})
|
|
1383
1327
|
);
|
|
1384
1328
|
}
|
|
1385
1329
|
_onPointerDown(t) {
|
|
1386
|
-
if (!this.hasAttribute("resizable-columns") || !this._table)
|
|
1387
|
-
return;
|
|
1330
|
+
if (!this.hasAttribute("resizable-columns") || !this._table) return;
|
|
1388
1331
|
const e = t.target.closest(".resize-handle");
|
|
1389
|
-
if (!e || !this._table.contains(e))
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
const r = this._headerCells()[i];
|
|
1395
|
-
if (!r)
|
|
1396
|
-
return;
|
|
1332
|
+
if (!e || !this._table.contains(e)) return;
|
|
1333
|
+
const r = Number(e.getAttribute("data-col-index"));
|
|
1334
|
+
if (!Number.isInteger(r) || r < 0) return;
|
|
1335
|
+
const i = this._headerCells()[r];
|
|
1336
|
+
if (!i) return;
|
|
1397
1337
|
t.preventDefault();
|
|
1398
|
-
const s =
|
|
1338
|
+
const s = i.getBoundingClientRect().width;
|
|
1399
1339
|
this._resizeState = {
|
|
1400
|
-
columnIndex:
|
|
1340
|
+
columnIndex: r,
|
|
1401
1341
|
startX: t.clientX,
|
|
1402
1342
|
startWidth: s
|
|
1403
1343
|
}, window.addEventListener("pointermove", this._onPointerMove), window.addEventListener("pointerup", this._onPointerUp);
|
|
1404
1344
|
}
|
|
1405
1345
|
_onPointerMove(t) {
|
|
1406
|
-
if (!this._resizeState)
|
|
1407
|
-
return;
|
|
1346
|
+
if (!this._resizeState) return;
|
|
1408
1347
|
const a = t.clientX - this._resizeState.startX, e = this._isRtl() ? -a : a;
|
|
1409
1348
|
this._pendingResizeColumn = this._resizeState.columnIndex, this._pendingResizeWidth = this._resizeState.startWidth + e, this._setColumnWidth(this._pendingResizeColumn, this._pendingResizeWidth, !1);
|
|
1410
1349
|
}
|
|
1411
1350
|
_onPointerUp() {
|
|
1412
|
-
if (!this._resizeState)
|
|
1413
|
-
return;
|
|
1351
|
+
if (!this._resizeState) return;
|
|
1414
1352
|
const t = this._resizeState;
|
|
1415
1353
|
this._resizeState = null, this._resizeRaf && (cancelAnimationFrame(this._resizeRaf), this._resizeRaf = 0), this._pendingResizeColumn === t.columnIndex && this._pendingResizeWidth != null && this._setColumnWidth(t.columnIndex, this._pendingResizeWidth, !1), this._pendingResizeColumn = -1, this._pendingResizeWidth = null, window.removeEventListener("pointermove", this._onPointerMove), window.removeEventListener("pointerup", this._onPointerUp);
|
|
1416
1354
|
const a = this._headerCells()[t.columnIndex];
|
|
1417
|
-
if (!a)
|
|
1418
|
-
return;
|
|
1355
|
+
if (!a) return;
|
|
1419
1356
|
const e = a.getBoundingClientRect().width;
|
|
1420
1357
|
this._setColumnWidth(t.columnIndex, e, !0);
|
|
1421
1358
|
}
|
|
@@ -1425,74 +1362,66 @@ class z extends A {
|
|
|
1425
1362
|
})));
|
|
1426
1363
|
}
|
|
1427
1364
|
_onDragStart(t) {
|
|
1428
|
-
if (!this.hasAttribute("draggable-columns") || !this._table)
|
|
1429
|
-
return;
|
|
1365
|
+
if (!this.hasAttribute("draggable-columns") || !this._table) return;
|
|
1430
1366
|
const a = t.target;
|
|
1431
1367
|
if (a.closest(".resize-handle")) {
|
|
1432
1368
|
t.preventDefault();
|
|
1433
1369
|
return;
|
|
1434
1370
|
}
|
|
1435
1371
|
const e = a.closest("th");
|
|
1436
|
-
if (!e || !this._table.contains(e))
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
r < 0 || (this._dragColumnIndex = r, this._dragOverColumnIndex = r, this._clearDragMarkers(), e.setAttribute("data-dragging", "true"), t.dataTransfer && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", String(r))));
|
|
1372
|
+
if (!e || !this._table.contains(e)) return;
|
|
1373
|
+
const i = this._headerCells().indexOf(e);
|
|
1374
|
+
i < 0 || (this._dragColumnIndex = i, this._dragOverColumnIndex = i, this._clearDragMarkers(), e.setAttribute("data-dragging", "true"), t.dataTransfer && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", String(i))));
|
|
1440
1375
|
}
|
|
1441
1376
|
_onDragOver(t) {
|
|
1442
|
-
if (!this.hasAttribute("draggable-columns") || !this._table || this._dragColumnIndex < 0)
|
|
1443
|
-
return;
|
|
1377
|
+
if (!this.hasAttribute("draggable-columns") || !this._table || this._dragColumnIndex < 0) return;
|
|
1444
1378
|
const e = t.target.closest("th");
|
|
1445
|
-
if (!e || !this._table.contains(e))
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
this._clearDragMarkers(), this._dragOverColumnIndex = r, e.setAttribute("data-drag-over", "true");
|
|
1451
|
-
const s = i[this._dragColumnIndex];
|
|
1379
|
+
if (!e || !this._table.contains(e)) return;
|
|
1380
|
+
const r = this._headerCells(), i = r.indexOf(e);
|
|
1381
|
+
if (i < 0 || (t.preventDefault(), this._dragOverColumnIndex === i)) return;
|
|
1382
|
+
this._clearDragMarkers(), this._dragOverColumnIndex = i, e.setAttribute("data-drag-over", "true");
|
|
1383
|
+
const s = r[this._dragColumnIndex];
|
|
1452
1384
|
s && s.setAttribute("data-dragging", "true");
|
|
1453
1385
|
}
|
|
1454
1386
|
_onDrop(t) {
|
|
1455
|
-
if (!this.hasAttribute("draggable-columns") || !this._table || this._dragColumnIndex < 0)
|
|
1456
|
-
return;
|
|
1387
|
+
if (!this.hasAttribute("draggable-columns") || !this._table || this._dragColumnIndex < 0) return;
|
|
1457
1388
|
const e = t.target.closest("th");
|
|
1458
|
-
if (!e || !this._table.contains(e))
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
if (r < 0)
|
|
1462
|
-
return;
|
|
1389
|
+
if (!e || !this._table.contains(e)) return;
|
|
1390
|
+
const i = this._headerCells().indexOf(e);
|
|
1391
|
+
if (i < 0) return;
|
|
1463
1392
|
t.preventDefault();
|
|
1464
|
-
const s = this._dragColumnIndex, o = this._moveColumn(s,
|
|
1465
|
-
this._clearDragMarkers(), this._dragColumnIndex = -1, this._ignoreHeaderClickUntil = Date.now() + 220, o && (this._applyVirtualization(!1), this._emitColumnOrderChange(s,
|
|
1393
|
+
const s = this._dragColumnIndex, o = this._moveColumn(s, i);
|
|
1394
|
+
this._clearDragMarkers(), this._dragColumnIndex = -1, this._ignoreHeaderClickUntil = Date.now() + 220, o && (this._applyVirtualization(!1), this._emitColumnOrderChange(s, i));
|
|
1466
1395
|
}
|
|
1467
1396
|
_onDragEnd() {
|
|
1468
1397
|
this._clearDragMarkers(), this._dragColumnIndex = -1;
|
|
1469
1398
|
}
|
|
1470
1399
|
_rowValues(t) {
|
|
1471
|
-
const a = this._headerCells(), e = Array.from(t.cells),
|
|
1472
|
-
return e.forEach((
|
|
1473
|
-
const o = a[s], n = (
|
|
1474
|
-
|
|
1475
|
-
}),
|
|
1400
|
+
const a = this._headerCells(), e = Array.from(t.cells), r = {};
|
|
1401
|
+
return e.forEach((i, s) => {
|
|
1402
|
+
const o = a[s], n = (o?.getAttribute("data-key") || p(o || void 0) || `col_${s + 1}`).toLowerCase().replace(/[^a-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
|
|
1403
|
+
r[n || `col_${s + 1}`] = p(i);
|
|
1404
|
+
}), r;
|
|
1476
1405
|
}
|
|
1477
1406
|
_syncRowSelectionState() {
|
|
1478
1407
|
const t = this.hasAttribute("selectable"), a = this._bodyRows();
|
|
1479
1408
|
for (const e of Array.from(this._selectedRows))
|
|
1480
1409
|
a.includes(e) || this._selectedRows.delete(e);
|
|
1481
1410
|
a.forEach((e) => {
|
|
1482
|
-
const
|
|
1483
|
-
t &&
|
|
1411
|
+
const r = !e.hidden;
|
|
1412
|
+
t && r ? (e.setAttribute("aria-selected", this._selectedRows.has(e) ? "true" : "false"), e.setAttribute("aria-keyshortcuts", "ArrowUp ArrowDown Home End Enter Space"), e.hasAttribute("tabindex") || e.setAttribute("tabindex", "0"), this._selectedRows.has(e) ? e.setAttribute("data-selected", "true") : e.removeAttribute("data-selected")) : (e.removeAttribute("aria-selected"), e.removeAttribute("aria-keyshortcuts"), e.removeAttribute("data-selected"), e.getAttribute("tabindex") === "0" && e.removeAttribute("tabindex"));
|
|
1484
1413
|
});
|
|
1485
1414
|
}
|
|
1486
1415
|
_toggleRowSelection(t) {
|
|
1487
1416
|
const a = this.hasAttribute("multi-select"), e = this._selectedRows.has(t);
|
|
1488
1417
|
a || this._selectedRows.clear(), e && a ? this._selectedRows.delete(t) : this._selectedRows.add(t), this._syncRowSelectionState(), this._updateBulkActions();
|
|
1489
|
-
const
|
|
1418
|
+
const r = this._bodyRows(), i = r.flatMap((o, n) => this._selectedRows.has(o) ? [n] : []), s = r.filter((o) => this._selectedRows.has(o)).map((o) => this._rowValues(o));
|
|
1490
1419
|
this.dispatchEvent(
|
|
1491
1420
|
new CustomEvent("row-select", {
|
|
1492
1421
|
detail: {
|
|
1493
|
-
index:
|
|
1422
|
+
index: r.indexOf(t),
|
|
1494
1423
|
selected: this._selectedRows.has(t),
|
|
1495
|
-
indices:
|
|
1424
|
+
indices: i,
|
|
1496
1425
|
rows: s,
|
|
1497
1426
|
page: this._page
|
|
1498
1427
|
},
|
|
@@ -1501,21 +1430,19 @@ class z extends A {
|
|
|
1501
1430
|
);
|
|
1502
1431
|
}
|
|
1503
1432
|
_sortByColumn(t, a) {
|
|
1504
|
-
if (!this._table)
|
|
1505
|
-
return;
|
|
1433
|
+
if (!this._table) return;
|
|
1506
1434
|
const e = this._table.tBodies[0];
|
|
1507
|
-
if (!e)
|
|
1508
|
-
return;
|
|
1435
|
+
if (!e) return;
|
|
1509
1436
|
this._sortColumnIndex === t ? this._sortDirection = this._sortDirection === "asc" ? "desc" : "asc" : (this._sortColumnIndex = t, this._sortDirection = "asc"), Array.from(e.rows).filter((o) => !this._isVirtualSpacerRow(o)).map((o, n) => ({
|
|
1510
1437
|
row: o,
|
|
1511
1438
|
rowIndex: n,
|
|
1512
|
-
value:
|
|
1439
|
+
value: S(p(o.cells[t]))
|
|
1513
1440
|
})).sort((o, n) => {
|
|
1514
|
-
const
|
|
1515
|
-
let
|
|
1516
|
-
return typeof
|
|
1441
|
+
const u = o.value, h = n.value;
|
|
1442
|
+
let l = 0;
|
|
1443
|
+
return typeof u == "number" && typeof h == "number" ? l = u - h : l = String(u).localeCompare(String(h), void 0, { numeric: !0, sensitivity: "base" }), l === 0 && (l = o.rowIndex - n.rowIndex), this._sortDirection === "asc" ? l : -l;
|
|
1517
1444
|
}).map((o) => o.row).forEach((o) => e.appendChild(o)), this._syncHeaderState(), this._applyPagination(!1), this._syncRowSelectionState(), this._updateSummary(), this._syncPaginationElement();
|
|
1518
|
-
const s = a.getAttribute("data-key") ||
|
|
1445
|
+
const s = a.getAttribute("data-key") || p(a) || `column-${t + 1}`;
|
|
1519
1446
|
this.dispatchEvent(
|
|
1520
1447
|
new CustomEvent("sort-change", {
|
|
1521
1448
|
detail: {
|
|
@@ -1534,8 +1461,7 @@ class z extends A {
|
|
|
1534
1461
|
_syncPaginationBinding() {
|
|
1535
1462
|
this._detachPaginationListener();
|
|
1536
1463
|
const t = this.getAttribute("pagination-id");
|
|
1537
|
-
if (!t)
|
|
1538
|
-
return;
|
|
1464
|
+
if (!t) return;
|
|
1539
1465
|
const a = document.getElementById(t);
|
|
1540
1466
|
a && (this._paginationEl = a, this._paginationEl.addEventListener("change", this._onPaginationChange), this._syncPaginationElement());
|
|
1541
1467
|
}
|
|
@@ -1543,86 +1469,79 @@ class z extends A {
|
|
|
1543
1469
|
this._paginationEl && (this._paginationEl.setAttribute("count", String(this._pageCount || 1)), this._paginationEl.setAttribute("page", String(this._page || 1)));
|
|
1544
1470
|
}
|
|
1545
1471
|
_onPaginationChange(t) {
|
|
1546
|
-
const a = t.detail, e = Number(a
|
|
1472
|
+
const a = t.detail, e = Number(a?.page);
|
|
1547
1473
|
Number.isFinite(e) && e !== this._page && (this._setPageAttribute(e), this._applyPagination(!0), this._syncRowSelectionState(), this._updateSummary(), this._syncPaginationElement());
|
|
1548
1474
|
}
|
|
1549
1475
|
_onClick(t) {
|
|
1550
|
-
if (!this._table)
|
|
1551
|
-
|
|
1552
|
-
const e = t.composedPath().find((r) => r instanceof HTMLElement) || t.target;
|
|
1476
|
+
if (!this._table) return;
|
|
1477
|
+
const e = t.composedPath().find((i) => i instanceof HTMLElement) || t.target;
|
|
1553
1478
|
if (e.closest(".bulk-clear")) {
|
|
1554
|
-
const
|
|
1555
|
-
|
|
1479
|
+
const i = this._selectedRows.size;
|
|
1480
|
+
i > 0 && (this._selectedRows.clear(), this._syncRowSelectionState(), this._updateBulkActions(), this.dispatchEvent(new CustomEvent("bulk-clear", { detail: { count: i, page: this._page }, bubbles: !0 })));
|
|
1556
1481
|
return;
|
|
1557
1482
|
}
|
|
1558
1483
|
if (!e.closest(".resize-handle") && !(e.closest("th") && Date.now() < this._ignoreHeaderClickUntil) && !this._isInteractionBlocked()) {
|
|
1559
1484
|
if (this.hasAttribute("sortable")) {
|
|
1560
|
-
const
|
|
1561
|
-
if (
|
|
1562
|
-
if (e !==
|
|
1563
|
-
|
|
1564
|
-
const o = this._headerCells().indexOf(r);
|
|
1485
|
+
const i = e.closest("th");
|
|
1486
|
+
if (i && this._table.contains(i)) {
|
|
1487
|
+
if (e !== i && this._isInteractiveTarget(e)) return;
|
|
1488
|
+
const o = this._headerCells().indexOf(i);
|
|
1565
1489
|
if (o >= 0) {
|
|
1566
|
-
this._sortByColumn(o,
|
|
1490
|
+
this._sortByColumn(o, i);
|
|
1567
1491
|
return;
|
|
1568
1492
|
}
|
|
1569
1493
|
}
|
|
1570
1494
|
}
|
|
1571
1495
|
if (this.hasAttribute("selectable")) {
|
|
1572
|
-
const
|
|
1573
|
-
if (
|
|
1574
|
-
if (e !==
|
|
1575
|
-
|
|
1576
|
-
this._toggleRowSelection(r);
|
|
1496
|
+
const i = e.closest("tbody tr");
|
|
1497
|
+
if (i && this._table.contains(i) && !i.hidden && !this._isVirtualSpacerRow(i)) {
|
|
1498
|
+
if (e !== i && this._isInteractiveTarget(e)) return;
|
|
1499
|
+
this._toggleRowSelection(i);
|
|
1577
1500
|
}
|
|
1578
1501
|
}
|
|
1579
1502
|
}
|
|
1580
1503
|
}
|
|
1581
1504
|
_onKeyDown(t) {
|
|
1582
|
-
if (!this._table)
|
|
1583
|
-
return;
|
|
1505
|
+
if (!this._table) return;
|
|
1584
1506
|
const a = t.key, e = t.target;
|
|
1585
1507
|
if (a === "Escape" && this._selectedRows.size) {
|
|
1586
|
-
const
|
|
1587
|
-
this._selectedRows.clear(), this._syncRowSelectionState(), this._updateBulkActions(), this.dispatchEvent(new CustomEvent("bulk-clear", { detail: { count:
|
|
1508
|
+
const i = this._selectedRows.size;
|
|
1509
|
+
this._selectedRows.clear(), this._syncRowSelectionState(), this._updateBulkActions(), this.dispatchEvent(new CustomEvent("bulk-clear", { detail: { count: i, page: this._page }, bubbles: !0 }));
|
|
1588
1510
|
return;
|
|
1589
1511
|
}
|
|
1590
|
-
if (this._isInteractionBlocked())
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
const r = this._headerCells(), s = r.indexOf(i);
|
|
1512
|
+
if (this._isInteractionBlocked()) return;
|
|
1513
|
+
const r = e.closest("th");
|
|
1514
|
+
if (r && this._table.contains(r)) {
|
|
1515
|
+
const i = this._headerCells(), s = i.indexOf(r);
|
|
1595
1516
|
if (s >= 0) {
|
|
1596
|
-
const n = this._isRtl() ? -1 : 1,
|
|
1517
|
+
const n = this._isRtl() ? -1 : 1, u = -n;
|
|
1597
1518
|
if (a === "ArrowRight" || a === "ArrowLeft") {
|
|
1598
1519
|
t.preventDefault();
|
|
1599
|
-
const
|
|
1600
|
-
if (t.altKey && this.hasAttribute("draggable-columns") &&
|
|
1601
|
-
this._moveColumn(s,
|
|
1520
|
+
const h = a === "ArrowRight" ? n : u, l = Math.max(0, Math.min(i.length - 1, s + h));
|
|
1521
|
+
if (t.altKey && this.hasAttribute("draggable-columns") && l !== s) {
|
|
1522
|
+
this._moveColumn(s, l) && (this._ignoreHeaderClickUntil = Date.now() + 220, this._emitColumnOrderChange(s, l), this._applyVirtualization(!1), this._focusHeaderAt(l));
|
|
1602
1523
|
return;
|
|
1603
1524
|
}
|
|
1604
|
-
this._focusHeaderAt(
|
|
1525
|
+
this._focusHeaderAt(l);
|
|
1605
1526
|
return;
|
|
1606
1527
|
}
|
|
1607
1528
|
if (a === "Home" || a === "End") {
|
|
1608
|
-
t.preventDefault(), this._focusHeaderAt(a === "Home" ? 0 :
|
|
1529
|
+
t.preventDefault(), this._focusHeaderAt(a === "Home" ? 0 : i.length - 1);
|
|
1609
1530
|
return;
|
|
1610
1531
|
}
|
|
1611
1532
|
if ((a === "Enter" || a === " ") && this.hasAttribute("sortable")) {
|
|
1612
|
-
if (e !==
|
|
1613
|
-
|
|
1614
|
-
t.preventDefault(), this._sortByColumn(s, i);
|
|
1533
|
+
if (e !== r && this._isInteractiveTarget(e)) return;
|
|
1534
|
+
t.preventDefault(), this._sortByColumn(s, r);
|
|
1615
1535
|
return;
|
|
1616
1536
|
}
|
|
1617
1537
|
}
|
|
1618
1538
|
}
|
|
1619
1539
|
if (this.hasAttribute("selectable")) {
|
|
1620
|
-
const
|
|
1621
|
-
if (
|
|
1622
|
-
if (e !==
|
|
1623
|
-
return;
|
|
1540
|
+
const i = e.closest("tbody tr");
|
|
1541
|
+
if (i && this._table.contains(i) && !i.hidden && !this._isVirtualSpacerRow(i)) {
|
|
1542
|
+
if (e !== i && this._isInteractiveTarget(e)) return;
|
|
1624
1543
|
if (a === "ArrowDown" || a === "ArrowUp") {
|
|
1625
|
-
t.preventDefault(), this._focusSelectableRow(
|
|
1544
|
+
t.preventDefault(), this._focusSelectableRow(i, a === "ArrowDown" ? 1 : -1);
|
|
1626
1545
|
return;
|
|
1627
1546
|
}
|
|
1628
1547
|
if (a === "Home" || a === "End") {
|
|
@@ -1631,22 +1550,21 @@ class z extends A {
|
|
|
1631
1550
|
o && o.focus();
|
|
1632
1551
|
return;
|
|
1633
1552
|
}
|
|
1634
|
-
(a === "Enter" || a === " ") && (t.preventDefault(), this._toggleRowSelection(
|
|
1553
|
+
(a === "Enter" || a === " ") && (t.preventDefault(), this._toggleRowSelection(i));
|
|
1635
1554
|
}
|
|
1636
1555
|
}
|
|
1637
1556
|
}
|
|
1638
1557
|
_updateBulkActions() {
|
|
1639
1558
|
const t = this.root.querySelector(".bulk");
|
|
1640
|
-
if (!t)
|
|
1641
|
-
return;
|
|
1559
|
+
if (!t) return;
|
|
1642
1560
|
const a = this.hasAttribute("selectable"), e = this._selectedRows.size;
|
|
1643
1561
|
if (!(a && e > 0)) {
|
|
1644
1562
|
t.setAttribute("hidden", "");
|
|
1645
1563
|
return;
|
|
1646
1564
|
}
|
|
1647
1565
|
t.removeAttribute("hidden");
|
|
1648
|
-
const
|
|
1649
|
-
o && (o.textContent =
|
|
1566
|
+
const i = this.getAttribute("bulk-actions-label") || "{count} selected", s = this.getAttribute("bulk-clear-label") || "Clear selection", o = t.querySelector(".bulk-count");
|
|
1567
|
+
o && (o.textContent = i.replace("{count}", String(e)));
|
|
1650
1568
|
const n = t.querySelector(".bulk-clear");
|
|
1651
1569
|
n && (n.textContent = s);
|
|
1652
1570
|
}
|
|
@@ -1654,7 +1572,7 @@ class z extends A {
|
|
|
1654
1572
|
return !1;
|
|
1655
1573
|
}
|
|
1656
1574
|
}
|
|
1657
|
-
typeof customElements < "u" && !customElements.get("ui-data-table") && customElements.define("ui-data-table",
|
|
1575
|
+
typeof customElements < "u" && !customElements.get("ui-data-table") && customElements.define("ui-data-table", R);
|
|
1658
1576
|
export {
|
|
1659
|
-
|
|
1577
|
+
R as UIDataTable
|
|
1660
1578
|
};
|