@editora/ui-core 0.1.20 → 0.1.22
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/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +3 -3
- package/dist/alert-dialog.cjs.js +32 -32
- package/dist/alert-dialog.esm.js +95 -75
- package/dist/alert.cjs.js +6 -6
- package/dist/alert.esm.js +6 -6
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +4 -4
- package/dist/animated-text.cjs.js +4 -4
- package/dist/animated-text.esm.js +4 -4
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +3 -3
- package/dist/aspect-ratio.cjs.js +3 -3
- package/dist/aspect-ratio.esm.js +3 -3
- package/dist/avatar.cjs.js +14 -14
- package/dist/avatar.esm.js +31 -29
- package/dist/badge.cjs.js +4 -4
- package/dist/badge.esm.js +4 -4
- package/dist/block-controls.cjs.js +4 -4
- package/dist/block-controls.esm.js +4 -4
- package/dist/box.cjs.js +2 -2
- package/dist/box.esm.js +2 -2
- package/dist/breadcrumb.cjs.js +5 -5
- package/dist/breadcrumb.esm.js +5 -5
- package/dist/button.cjs.js +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/{calendar-DLY4acgn.mjs → calendar-DbxYRdlv.mjs} +227 -183
- package/dist/{calendar-Dkof-FTK.js → calendar-Qa-cFOp3.js} +74 -35
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +8 -8
- package/dist/card.esm.js +63 -20
- package/dist/chart.cjs.js +4 -4
- package/dist/chart.esm.js +6 -6
- package/dist/checkbox.cjs.js +2 -2
- package/dist/checkbox.esm.js +2 -2
- package/dist/collapsible.cjs.js +7 -7
- package/dist/collapsible.esm.js +7 -7
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +27 -23
- package/dist/color-picker.cjs.js +34 -14
- package/dist/color-picker.esm.js +89 -67
- package/dist/combobox.cjs.js +29 -27
- package/dist/combobox.esm.js +51 -45
- package/dist/command.cjs.js +2 -2
- package/dist/command.esm.js +2 -2
- package/dist/components/ui-alert-dialog.d.ts +1 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-avatar.d.ts +1 -0
- package/dist/components/ui-avatar.d.ts.map +1 -1
- package/dist/components/ui-button.d.ts +1 -0
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-calendar.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts +3 -0
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-collection.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-data-table.d.ts.map +1 -1
- package/dist/components/ui-date-field.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dock.d.ts +1 -0
- package/dist/components/ui-dock.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-dropdown.d.ts.map +1 -1
- package/dist/components/ui-field.d.ts.map +1 -1
- package/dist/components/ui-file-upload.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-pin-input.d.ts +1 -0
- package/dist/components/ui-pin-input.d.ts.map +1 -1
- package/dist/components/ui-placement-grid.d.ts.map +1 -1
- package/dist/components/ui-portal.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-progress.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts.map +1 -1
- package/dist/components/ui-rating.d.ts +1 -0
- package/dist/components/ui-rating.d.ts.map +1 -1
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +8 -0
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-table.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts +1 -0
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-tags-input.d.ts +1 -0
- package/dist/components/ui-tags-input.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-time-field.d.ts.map +1 -1
- package/dist/components/ui-toggle-group.d.ts.map +1 -1
- package/dist/components/ui-toggle.d.ts.map +1 -1
- package/dist/components/ui-tree.d.ts.map +1 -1
- package/dist/components/ui-wizard.d.ts.map +1 -1
- package/dist/context-menu.cjs.js +3 -3
- package/dist/context-menu.esm.js +4 -4
- package/dist/control-name-BmoI1m3a.js +1 -0
- package/dist/control-name-Bpj7F34X.mjs +48 -0
- package/dist/data-table.cjs.js +5 -2
- package/dist/data-table.esm.js +145 -142
- package/dist/date-field.cjs.js +5 -5
- package/dist/date-field.esm.js +34 -31
- package/dist/date-picker.cjs.js +16 -16
- package/dist/date-picker.esm.js +48 -44
- package/dist/date-range-picker.cjs.js +5 -5
- package/dist/date-range-picker.esm.js +120 -118
- package/dist/date-range-time-picker.cjs.js +22 -22
- package/dist/date-range-time-picker.esm.js +88 -84
- package/dist/date-time-picker.cjs.js +26 -26
- package/dist/date-time-picker.esm.js +105 -101
- package/dist/{date-time-utils-Dmost5Ee.js → date-time-utils-BzfTpeU-.js} +1 -1
- package/dist/{date-time-utils-y1N2gvG2.mjs → date-time-utils-Cps2aSu2.mjs} +1 -1
- package/dist/description.cjs.js +3 -3
- package/dist/description.esm.js +3 -3
- package/dist/dialog.cjs.js +2 -2
- package/dist/dialog.esm.js +2 -2
- package/dist/dock.cjs.js +12 -12
- package/dist/dock.esm.js +72 -74
- package/dist/drawer.cjs.js +19 -19
- package/dist/drawer.esm.js +58 -58
- package/dist/dropdown.cjs.js +13 -13
- package/dist/dropdown.esm.js +49 -48
- package/dist/empty-state.cjs.js +3 -3
- package/dist/empty-state.esm.js +3 -3
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +1 -1
- package/dist/field.cjs.js +12 -12
- package/dist/field.esm.js +84 -75
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +4 -4
- package/dist/file-upload.cjs.js +3 -3
- package/dist/file-upload.esm.js +5 -3
- package/dist/floating-toolbar.cjs.js +8 -8
- package/dist/floating-toolbar.esm.js +9 -9
- package/dist/form.cjs.js +11 -11
- package/dist/form.esm.js +11 -11
- package/dist/gantt.cjs.js +43 -32
- package/dist/gantt.esm.js +99 -88
- package/dist/icon-cloud.cjs.js +3 -3
- package/dist/icon-cloud.esm.js +3 -3
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +121 -118
- package/dist/inline-edit.cjs.js +1 -1
- package/dist/inline-edit.esm.js +1 -1
- package/dist/input.cjs.js +14 -14
- package/dist/input.esm.js +39 -32
- package/dist/label.cjs.js +3 -3
- package/dist/label.esm.js +3 -3
- package/dist/{listbox-B6QgECax.js → listbox-CTpRpuF7.js} +1 -1
- package/dist/{listbox-DJamVeFj.mjs → listbox-hMVOhKHC.mjs} +1 -1
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +1 -1
- package/dist/marquee.cjs.js +3 -3
- package/dist/marquee.esm.js +3 -3
- package/dist/{menu-item-styles-CbNUEwP2.js → menu-item-styles-B4onAr4C.js} +3 -3
- package/dist/{menu-item-styles-CZiPwPwl.mjs → menu-item-styles-IGSFLAHu.mjs} +3 -3
- package/dist/menu.cjs.js +7 -7
- package/dist/menu.esm.js +29 -28
- package/dist/menubar.cjs.js +1 -1
- package/dist/menubar.esm.js +2 -2
- package/dist/meter.cjs.js +1 -1
- package/dist/meter.esm.js +1 -1
- package/dist/multi-select.cjs.js +18 -18
- package/dist/multi-select.esm.js +82 -66
- package/dist/navigation-menu.cjs.js +1 -1
- package/dist/navigation-menu.esm.js +1 -1
- package/dist/number-field.cjs.js +11 -13
- package/dist/number-field.esm.js +29 -27
- package/dist/number-ticker.cjs.js +4 -4
- package/dist/number-ticker.esm.js +4 -4
- package/dist/odometer.cjs.js +2 -2
- package/dist/odometer.esm.js +2 -2
- package/dist/orbiter.cjs.js +3 -3
- package/dist/orbiter.esm.js +3 -3
- package/dist/pagination.cjs.js +1 -1
- package/dist/pagination.esm.js +1 -1
- package/dist/password-field.cjs.js +23 -23
- package/dist/password-field.esm.js +48 -47
- package/dist/pin-input.cjs.js +8 -6
- package/dist/pin-input.esm.js +21 -15
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +58 -58
- package/dist/plugin-panel.cjs.js +1 -1
- package/dist/plugin-panel.esm.js +1 -1
- package/dist/popover.cjs.js +5 -5
- package/dist/popover.esm.js +4 -4
- package/dist/portal.cjs.js +3 -3
- package/dist/portal.esm.js +11 -10
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +15 -14
- package/dist/primitives/auto-scroll.d.ts +9 -0
- package/dist/primitives/auto-scroll.d.ts.map +1 -0
- package/dist/primitives/control-name.d.ts +30 -0
- package/dist/primitives/control-name.d.ts.map +1 -0
- package/dist/primitives/selector.d.ts +4 -0
- package/dist/primitives/selector.d.ts.map +1 -0
- package/dist/primitives/trigger.d.ts +2 -0
- package/dist/primitives/trigger.d.ts.map +1 -0
- package/dist/progress.cjs.js +4 -4
- package/dist/progress.esm.js +20 -18
- package/dist/quick-actions.cjs.js +3 -3
- package/dist/quick-actions.esm.js +3 -3
- package/dist/radio-group.cjs.js +1 -1
- package/dist/radio-group.esm.js +1 -1
- package/dist/radio.cjs.js +2 -2
- package/dist/radio.esm.js +2 -2
- package/dist/rating.cjs.js +17 -16
- package/dist/rating.esm.js +91 -92
- package/dist/{runtime-D1gFh1fS.mjs → runtime-CFnK53iC.mjs} +133 -94
- package/dist/runtime-DwE-tizc.js +1 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +29 -26
- package/dist/select.cjs.js +20 -19
- package/dist/select.esm.js +36 -32
- package/dist/selection-popup.cjs.js +2 -2
- package/dist/selection-popup.esm.js +2 -2
- package/dist/selector-BvAh35ve.js +1 -0
- package/dist/selector-WI8pD7YO.mjs +18 -0
- package/dist/separator.cjs.js +7 -7
- package/dist/separator.esm.js +7 -7
- package/dist/sidebar.cjs.js +7 -7
- package/dist/sidebar.esm.js +7 -7
- package/dist/skeleton.cjs.js +7 -7
- package/dist/skeleton.esm.js +7 -7
- package/dist/slider.cjs.js +3 -3
- package/dist/slider.esm.js +3 -3
- package/dist/slot.cjs.js +3 -3
- package/dist/slot.esm.js +3 -3
- package/dist/sortable.cjs.js +61 -48
- package/dist/sortable.esm.js +636 -554
- package/dist/spinning-text.cjs.js +3 -3
- package/dist/spinning-text.esm.js +3 -3
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +1 -1
- package/dist/stepper.cjs.js +1 -1
- package/dist/stepper.esm.js +1 -1
- package/dist/switch.cjs.js +10 -12
- package/dist/switch.esm.js +10 -12
- package/dist/table.cjs.js +9 -6
- package/dist/table.esm.js +46 -43
- package/dist/tabs.cjs.js +22 -23
- package/dist/tabs.esm.js +116 -112
- package/dist/tags-input.cjs.js +9 -9
- package/dist/tags-input.esm.js +32 -25
- package/dist/textarea.cjs.js +13 -13
- package/dist/textarea.esm.js +46 -31
- package/dist/theme.d.ts +18 -0
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +5 -5
- package/dist/time-field.esm.js +21 -18
- package/dist/time-picker.cjs.js +4 -4
- package/dist/time-picker.esm.js +5 -5
- package/dist/timeline.cjs.js +2 -2
- package/dist/timeline.esm.js +4 -4
- package/dist/toast.cjs.js +6 -6
- package/dist/toast.esm.js +13 -13
- package/dist/toggle-group.cjs.js +5 -6
- package/dist/toggle-group.esm.js +63 -60
- package/dist/toggle.cjs.js +18 -18
- package/dist/toggle.esm.js +32 -31
- package/dist/tooltip.cjs.js +4 -4
- package/dist/tooltip.esm.js +4 -4
- package/dist/transfer-list.cjs.js +32 -32
- package/dist/transfer-list.esm.js +57 -57
- package/dist/tree-7qbVnpGp.js +39 -0
- package/dist/{tree-B3kE8ESs.mjs → tree-Deoft-kO.mjs} +34 -33
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/trigger-BjnxLCeQ.mjs +9 -0
- package/dist/trigger-DkPsKxsP.js +1 -0
- package/dist/{ui-button-rXQOS9QJ.js → ui-button-BInsgSbr.js} +27 -26
- package/dist/{ui-button-Q0GNNWKC.mjs → ui-button-rfiuUnUD.mjs} +65 -48
- package/dist/{ui-icon-YI6lyuqU.mjs → ui-icon-BSi_GtqO.mjs} +2 -2
- package/dist/{ui-icon-BzVNC_lr.js → ui-icon-Bvt9oIIR.js} +5 -5
- package/dist/wizard.cjs.js +12 -13
- package/dist/wizard.esm.js +17 -15
- package/package.json +1 -1
- package/dist/runtime-CTaOSmBj.js +0 -1
- package/dist/tree-Dx_kv_ih.js +0 -39
package/dist/data-table.esm.js
CHANGED
|
@@ -2,12 +2,15 @@ import { E as C } from "./ElementBase-YlTLMsGk.mjs";
|
|
|
2
2
|
const A = `
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
|
+
/* A wide table scrolls inside its own frame. Without this a grid or flex parent grows to the table's width. */
|
|
6
|
+
min-inline-size: 0;
|
|
7
|
+
max-inline-size: 100%;
|
|
5
8
|
--ui-data-table-radius: 16px;
|
|
6
9
|
--ui-data-table-border-color: var(--ui-color-border, rgba(15, 23, 42, 0.14));
|
|
7
10
|
--ui-data-table-border: 1px solid var(--ui-data-table-border-color);
|
|
8
11
|
--ui-data-table-bg: var(--ui-color-surface, rgba(255, 255, 255, 0.96));
|
|
9
12
|
--ui-data-table-shadow: none;
|
|
10
|
-
--ui-data-table-empty-color: var(--ui-color-muted, #
|
|
13
|
+
--ui-data-table-empty-color: var(--ui-color-muted, #526175);
|
|
11
14
|
--ui-data-table-summary-color: var(--ui-color-muted, #475569);
|
|
12
15
|
--ui-data-table-text: var(--ui-color-text, #0f172a);
|
|
13
16
|
--ui-data-table-header-text: var(--ui-color-text, #1e293b);
|
|
@@ -839,14 +842,14 @@ class R extends C {
|
|
|
839
842
|
return a || (t === "loading" ? "Refreshing table data" : t === "error" ? "Table data could not be loaded" : t === "success" ? "Table data is up to date" : "");
|
|
840
843
|
}
|
|
841
844
|
_syncStateBar() {
|
|
842
|
-
const t = this.root.querySelector(".statebar"), a = this.root.querySelector(".state-text"), e = this.root.querySelector(".loading-text"),
|
|
845
|
+
const t = this.root.querySelector(".statebar"), a = this.root.querySelector(".state-text"), e = this.root.querySelector(".loading-text"), i = this.root.querySelector(".frame"), r = this._table;
|
|
843
846
|
if (!t) return;
|
|
844
847
|
const s = this._state();
|
|
845
848
|
s !== "idle" ? t.removeAttribute("hidden") : t.setAttribute("hidden", ""), t.setAttribute("data-state", s), t.setAttribute("aria-live", s === "error" ? "assertive" : "polite");
|
|
846
849
|
const n = this._stateText(s);
|
|
847
850
|
a && (a.textContent = n), e && (e.textContent = this._stateText("loading"));
|
|
848
851
|
const u = s === "loading" ? "true" : "false";
|
|
849
|
-
|
|
852
|
+
i && i.setAttribute("aria-busy", u), r && r.setAttribute("aria-busy", u);
|
|
850
853
|
}
|
|
851
854
|
_isInteractionBlocked() {
|
|
852
855
|
return this._state() === "loading";
|
|
@@ -862,8 +865,8 @@ class R extends C {
|
|
|
862
865
|
if (!t) return `column-${a + 1}`;
|
|
863
866
|
const e = (t.getAttribute("data-key") || "").trim();
|
|
864
867
|
if (e) return e;
|
|
865
|
-
const
|
|
866
|
-
return
|
|
868
|
+
const i = p(t);
|
|
869
|
+
return i ? i.toLowerCase().replace(/\s+/g, "_") : `column-${a + 1}`;
|
|
867
870
|
}
|
|
868
871
|
_currentColumnOrderString() {
|
|
869
872
|
return this._headerCells().map((a, e) => this._headerKey(a, e)).join(",");
|
|
@@ -891,10 +894,10 @@ class R extends C {
|
|
|
891
894
|
const e = Number(a);
|
|
892
895
|
if (Number.isInteger(e) && e >= 0 && e < t.length)
|
|
893
896
|
return e;
|
|
894
|
-
const
|
|
895
|
-
for (let
|
|
896
|
-
const s = t[
|
|
897
|
-
if (o ===
|
|
897
|
+
const i = a.toLowerCase();
|
|
898
|
+
for (let r = 0; r < t.length; r += 1) {
|
|
899
|
+
const s = t[r], o = (s.getAttribute("data-key") || "").toLowerCase(), n = p(s).toLowerCase();
|
|
900
|
+
if (o === i || n === i) return r;
|
|
898
901
|
}
|
|
899
902
|
return -1;
|
|
900
903
|
}
|
|
@@ -902,12 +905,12 @@ class R extends C {
|
|
|
902
905
|
if (typeof a == "number" && Number.isInteger(a) && a >= 0 && a < t.length) return a;
|
|
903
906
|
const e = String(a || "").trim();
|
|
904
907
|
if (!e) return -1;
|
|
905
|
-
const
|
|
906
|
-
if (Number.isInteger(
|
|
907
|
-
const
|
|
908
|
+
const i = Number(e);
|
|
909
|
+
if (Number.isInteger(i) && i >= 0 && i < t.length) return i;
|
|
910
|
+
const r = e.toLowerCase();
|
|
908
911
|
for (let s = 0; s < t.length; s += 1) {
|
|
909
912
|
const o = t[s], n = (o.getAttribute("data-key") || "").toLowerCase(), u = p(o).toLowerCase();
|
|
910
|
-
if (n ===
|
|
913
|
+
if (n === r || u === r || this._headerKey(o, s) === r) return s;
|
|
911
914
|
}
|
|
912
915
|
return -1;
|
|
913
916
|
}
|
|
@@ -917,14 +920,14 @@ class R extends C {
|
|
|
917
920
|
try {
|
|
918
921
|
const e = JSON.parse(a);
|
|
919
922
|
if (!Array.isArray(e)) return [];
|
|
920
|
-
const
|
|
921
|
-
return e.forEach((
|
|
922
|
-
if (!
|
|
923
|
-
const s =
|
|
923
|
+
const i = [];
|
|
924
|
+
return e.forEach((r) => {
|
|
925
|
+
if (!r || typeof r != "object") return;
|
|
926
|
+
const s = r.column ?? r.field ?? r.key, o = this._resolveColumnIndex(t, s);
|
|
924
927
|
if (o < 0) return;
|
|
925
|
-
const n = String(
|
|
926
|
-
|
|
927
|
-
}),
|
|
928
|
+
const n = String(r.op || r.operator || "contains").trim().toLowerCase();
|
|
929
|
+
i.push({ columnIndex: o, op: n, value: r.value });
|
|
930
|
+
}), i;
|
|
928
931
|
} catch {
|
|
929
932
|
return [];
|
|
930
933
|
}
|
|
@@ -935,7 +938,7 @@ class R extends C {
|
|
|
935
938
|
_parsePinColumns(t) {
|
|
936
939
|
const a = this.getAttribute("pin-columns");
|
|
937
940
|
if (!a) return { left: [], right: [] };
|
|
938
|
-
const e = /* @__PURE__ */ new Set(),
|
|
941
|
+
const e = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), r = (u, h) => {
|
|
939
942
|
h.forEach((l) => {
|
|
940
943
|
const d = this._resolveColumnIndex(t, l);
|
|
941
944
|
d >= 0 && u.add(d);
|
|
@@ -944,17 +947,17 @@ class R extends C {
|
|
|
944
947
|
try {
|
|
945
948
|
const u = JSON.parse(a);
|
|
946
949
|
if (u && typeof u == "object") {
|
|
947
|
-
|
|
948
|
-
const h = Array.from(e).sort((d, c) => d - c), l = Array.from(
|
|
950
|
+
r(e, this._normalizePinTokens(u.left)), r(i, this._normalizePinTokens(u.right));
|
|
951
|
+
const h = Array.from(e).sort((d, c) => d - c), l = Array.from(i).filter((d) => !e.has(d)).sort((d, c) => c - d);
|
|
949
952
|
return { left: h, right: l };
|
|
950
953
|
}
|
|
951
954
|
} catch {
|
|
952
955
|
}
|
|
953
956
|
a.split(";").map((u) => u.trim()).filter(Boolean).forEach((u) => {
|
|
954
957
|
const [h, l] = u.split(":"), d = (h || "").trim().toLowerCase(), c = this._normalizePinTokens(l || "");
|
|
955
|
-
d === "left" &&
|
|
958
|
+
d === "left" && r(e, c), d === "right" && r(i, c);
|
|
956
959
|
});
|
|
957
|
-
const o = Array.from(e).sort((u, h) => u - h), n = Array.from(
|
|
960
|
+
const o = Array.from(e).sort((u, h) => u - h), n = Array.from(i).filter((u) => !e.has(u)).sort((u, h) => h - u);
|
|
958
961
|
return { left: o, right: n };
|
|
959
962
|
}
|
|
960
963
|
_setPageAttribute(t) {
|
|
@@ -980,11 +983,11 @@ class R extends C {
|
|
|
980
983
|
_resolveColumnWidth(t, a) {
|
|
981
984
|
const e = this._columnWidths.get(t);
|
|
982
985
|
if (typeof e == "number" && Number.isFinite(e)) return Math.max(1, e);
|
|
983
|
-
const
|
|
984
|
-
return Number.isFinite(
|
|
986
|
+
const i = a?.getBoundingClientRect().width || a?.offsetWidth || 0;
|
|
987
|
+
return Number.isFinite(i) && i > 0 ? i : 120;
|
|
985
988
|
}
|
|
986
|
-
_pinCell(t, a, e,
|
|
987
|
-
t && (t.setAttribute("data-pinned", a),
|
|
989
|
+
_pinCell(t, a, e, i, r) {
|
|
990
|
+
t && (t.setAttribute("data-pinned", a), i ? 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 = r ? "4" : "3");
|
|
988
991
|
}
|
|
989
992
|
_applyPinnedColumns() {
|
|
990
993
|
if (!this._table) return;
|
|
@@ -993,19 +996,19 @@ class R extends C {
|
|
|
993
996
|
if (!t.length) return;
|
|
994
997
|
const { left: a, right: e } = this._parsePinColumns(t);
|
|
995
998
|
if (!a.length && !e.length) return;
|
|
996
|
-
const
|
|
997
|
-
let
|
|
999
|
+
const i = Array.from(this._table.rows).filter((o) => !this._isVirtualSpacerRow(o));
|
|
1000
|
+
let r = 0;
|
|
998
1001
|
a.forEach((o, n) => {
|
|
999
1002
|
const u = this._resolveColumnWidth(o, t[o]), h = n === a.length - 1;
|
|
1000
|
-
|
|
1003
|
+
i.forEach((l, d) => {
|
|
1001
1004
|
const c = l.cells[o];
|
|
1002
|
-
this._pinCell(c, "left",
|
|
1003
|
-
}),
|
|
1005
|
+
this._pinCell(c, "left", r, h, d === 0);
|
|
1006
|
+
}), r += u;
|
|
1004
1007
|
});
|
|
1005
1008
|
let s = 0;
|
|
1006
1009
|
e.forEach((o, n) => {
|
|
1007
1010
|
const u = this._resolveColumnWidth(o, t[o]), h = n === e.length - 1;
|
|
1008
|
-
|
|
1011
|
+
i.forEach((l, d) => {
|
|
1009
1012
|
const c = l.cells[o];
|
|
1010
1013
|
this._pinCell(c, "right", s, h, d === 0);
|
|
1011
1014
|
}), s += u;
|
|
@@ -1017,40 +1020,40 @@ class R extends C {
|
|
|
1017
1020
|
if (!t) return;
|
|
1018
1021
|
const a = this._table.tHead?.rows[0], e = this._table.tBodies[0];
|
|
1019
1022
|
if (!a || !e) return;
|
|
1020
|
-
const
|
|
1021
|
-
if (!r.length) return;
|
|
1022
|
-
const i = t.split(",").map((l) => l.trim()).filter(Boolean);
|
|
1023
|
+
const i = Array.from(a.cells);
|
|
1023
1024
|
if (!i.length) return;
|
|
1025
|
+
const r = t.split(",").map((l) => l.trim()).filter(Boolean);
|
|
1026
|
+
if (!r.length) return;
|
|
1024
1027
|
const s = [], o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
1025
|
-
|
|
1028
|
+
i.forEach((l, d) => {
|
|
1026
1029
|
const c = (l.getAttribute("data-key") || p(l)).toLowerCase().trim();
|
|
1027
1030
|
c && n.set(c, d);
|
|
1028
1031
|
});
|
|
1029
|
-
for (const l of
|
|
1032
|
+
for (const l of r) {
|
|
1030
1033
|
const d = Number(l);
|
|
1031
|
-
if (Number.isInteger(d) && d >= 0 && d <
|
|
1034
|
+
if (Number.isInteger(d) && d >= 0 && d < i.length) {
|
|
1032
1035
|
o.has(d) || (o.add(d), s.push(d));
|
|
1033
1036
|
continue;
|
|
1034
1037
|
}
|
|
1035
1038
|
const c = n.get(l.toLowerCase());
|
|
1036
1039
|
typeof c == "number" && !o.has(c) && (o.add(c), s.push(c));
|
|
1037
1040
|
}
|
|
1038
|
-
for (let l = 0; l <
|
|
1041
|
+
for (let l = 0; l < i.length; l += 1)
|
|
1039
1042
|
o.has(l) || s.push(l);
|
|
1040
1043
|
if (s.every((l, d) => l === d)) return;
|
|
1041
|
-
s.map((l) =>
|
|
1044
|
+
s.map((l) => i[l]).forEach((l) => a.appendChild(l)), Array.from(e.rows).filter((l) => !this._isVirtualSpacerRow(l)).forEach((l) => {
|
|
1042
1045
|
const d = Array.from(l.cells);
|
|
1043
1046
|
s.map((f) => d[f]).filter(Boolean).forEach((f) => l.appendChild(f));
|
|
1044
1047
|
}), this._columnWidths.clear();
|
|
1045
1048
|
}
|
|
1046
1049
|
_moveColumn(t, a) {
|
|
1047
1050
|
if (!this._table) return !1;
|
|
1048
|
-
const e = this._table.tHead?.rows[0],
|
|
1049
|
-
if (!e || !
|
|
1050
|
-
const
|
|
1051
|
+
const e = this._table.tHead?.rows[0], i = this._table.tBodies[0];
|
|
1052
|
+
if (!e || !i) return !1;
|
|
1053
|
+
const r = Array.from(e.cells), s = r.length;
|
|
1051
1054
|
if (!s || t < 0 || t >= s || a < 0 || a >= s || t === a) return !1;
|
|
1052
1055
|
const o = Array.from({ length: s }, (l, d) => d), [n] = o.splice(t, 1);
|
|
1053
|
-
o.splice(a, 0, n), o.map((l) =>
|
|
1056
|
+
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) => {
|
|
1054
1057
|
const d = Array.from(l.cells);
|
|
1055
1058
|
o.map((f) => d[f]).filter(Boolean).forEach((f) => l.appendChild(f));
|
|
1056
1059
|
});
|
|
@@ -1073,7 +1076,7 @@ class R extends C {
|
|
|
1073
1076
|
sourceIndex: t,
|
|
1074
1077
|
targetIndex: a,
|
|
1075
1078
|
order: e,
|
|
1076
|
-
keys: this._headerCells().map((
|
|
1079
|
+
keys: this._headerCells().map((i, r) => this._headerKey(i, r))
|
|
1077
1080
|
},
|
|
1078
1081
|
bubbles: !0
|
|
1079
1082
|
})
|
|
@@ -1084,14 +1087,14 @@ class R extends C {
|
|
|
1084
1087
|
e && e.focus();
|
|
1085
1088
|
}
|
|
1086
1089
|
_focusSelectableRow(t, a) {
|
|
1087
|
-
const e = this._bodyRows().filter((o) => !o.hidden),
|
|
1088
|
-
if (
|
|
1089
|
-
const
|
|
1090
|
+
const e = this._bodyRows().filter((o) => !o.hidden), i = e.indexOf(t);
|
|
1091
|
+
if (i < 0) return;
|
|
1092
|
+
const r = Math.min(e.length - 1, Math.max(0, i + a)), s = e[r];
|
|
1090
1093
|
s && s.focus();
|
|
1091
1094
|
}
|
|
1092
1095
|
_headerKeyboardShortcuts(t, a) {
|
|
1093
|
-
const e = this._isRtl(),
|
|
1094
|
-
return t && s.push("Enter", "Space"), a && s.push(`Alt+${
|
|
1096
|
+
const e = this._isRtl(), i = e ? "ArrowRight" : "ArrowLeft", r = e ? "ArrowLeft" : "ArrowRight", s = [i, r, "Home", "End"];
|
|
1097
|
+
return t && s.push("Enter", "Space"), a && s.push(`Alt+${i}`, `Alt+${r}`), s.join(" ");
|
|
1095
1098
|
}
|
|
1096
1099
|
_syncStructure() {
|
|
1097
1100
|
if (!this._isSyncing) {
|
|
@@ -1112,9 +1115,9 @@ class R extends C {
|
|
|
1112
1115
|
}
|
|
1113
1116
|
}
|
|
1114
1117
|
_syncHeaderState() {
|
|
1115
|
-
const t = this.hasAttribute("sortable"), a = this.hasAttribute("draggable-columns"), e = this.hasAttribute("resizable-columns"),
|
|
1118
|
+
const t = this.hasAttribute("sortable"), a = this.hasAttribute("draggable-columns"), e = this.hasAttribute("resizable-columns"), i = this._headerKeyboardShortcuts(t, a);
|
|
1116
1119
|
this._headerCells().forEach((s, o) => {
|
|
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",
|
|
1120
|
+
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", i) : 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) {
|
|
1118
1121
|
s.setAttribute("data-resizable", "true");
|
|
1119
1122
|
let n = s.querySelector(".resize-handle");
|
|
1120
1123
|
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));
|
|
@@ -1130,7 +1133,7 @@ class R extends C {
|
|
|
1130
1133
|
_applyPagination(t) {
|
|
1131
1134
|
const a = this._bodyRows();
|
|
1132
1135
|
this._pageSize = this._parsePageSize(), this._totalRows = a.length;
|
|
1133
|
-
const e = this._parseFilterQuery(),
|
|
1136
|
+
const e = this._parseFilterQuery(), i = this._headerCells(), r = this._resolveFilterColumnIndex(i), s = this._parseFilters(i), o = a.filter((d) => this._rowMatchesFilter(d, e, r, s));
|
|
1134
1137
|
this._filteredRows = o.length, this._table?.setAttribute("aria-rowcount", String(this._filteredRows));
|
|
1135
1138
|
const n = this._parsePage();
|
|
1136
1139
|
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);
|
|
@@ -1168,15 +1171,15 @@ class R extends C {
|
|
|
1168
1171
|
if (!a) return null;
|
|
1169
1172
|
const e = t === "top" ? this._virtualTopSpacer : this._virtualBottomSpacer;
|
|
1170
1173
|
if (e && e.isConnected) return e;
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
const
|
|
1174
|
-
return
|
|
1174
|
+
const i = document.createElement("tr");
|
|
1175
|
+
i.setAttribute("data-virtual-spacer", t), i.setAttribute("aria-hidden", "true"), i.setAttribute("role", "presentation"), i.style.pointerEvents = "none";
|
|
1176
|
+
const r = document.createElement("td");
|
|
1177
|
+
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;
|
|
1175
1178
|
}
|
|
1176
1179
|
_setVirtualSpacerHeight(t, a, e) {
|
|
1177
1180
|
if (!t) return;
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1181
|
+
const i = t.cells[0] || t.appendChild(document.createElement("td"));
|
|
1182
|
+
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";
|
|
1180
1183
|
}
|
|
1181
1184
|
_applyVirtualization(t) {
|
|
1182
1185
|
if (!this.hasAttribute("virtualize") || !this._frameEl || !this._table) {
|
|
@@ -1188,7 +1191,7 @@ class R extends C {
|
|
|
1188
1191
|
this._clearVirtualization(!0);
|
|
1189
1192
|
return;
|
|
1190
1193
|
}
|
|
1191
|
-
const
|
|
1194
|
+
const i = this._parseRowHeight(), r = this._parseOverscan(), s = this._frameEl.clientHeight || i * 8, o = this._frameEl.scrollTop, n = Math.max(0, Math.floor(o / i) - r), u = Math.min(e.length, Math.ceil((o + s) / i) + r), h = n * i, l = Math.max(0, (e.length - u) * i), d = Math.max(1, this._headerCells().length || e[0]?.cells.length || 1), c = this._ensureVirtualSpacer("top"), f = this._ensureVirtualSpacer("bottom");
|
|
1192
1195
|
this._setVirtualSpacerHeight(c, h, d), this._setVirtualSpacerHeight(f, l, d);
|
|
1193
1196
|
const y = (g, v) => {
|
|
1194
1197
|
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", ""));
|
|
@@ -1236,12 +1239,12 @@ class R extends C {
|
|
|
1236
1239
|
t.textContent = "No records";
|
|
1237
1240
|
return;
|
|
1238
1241
|
}
|
|
1239
|
-
const
|
|
1242
|
+
const i = (this._page - 1) * this._pageSize + 1, r = Math.min(this._page * this._pageSize, e);
|
|
1240
1243
|
if (e === a) {
|
|
1241
|
-
t.textContent = `Showing ${
|
|
1244
|
+
t.textContent = `Showing ${i}-${r} of ${a}`;
|
|
1242
1245
|
return;
|
|
1243
1246
|
}
|
|
1244
|
-
t.textContent = `Showing ${
|
|
1247
|
+
t.textContent = `Showing ${i}-${r} of ${e} filtered records (${a} total)`;
|
|
1245
1248
|
}
|
|
1246
1249
|
_syncEmptyText() {
|
|
1247
1250
|
const t = this.root.querySelector(".empty");
|
|
@@ -1273,45 +1276,45 @@ class R extends C {
|
|
|
1273
1276
|
return /^-?\d+(\.\d+)?$/.test(a) ? Number(a) : t.toLowerCase();
|
|
1274
1277
|
}
|
|
1275
1278
|
_rulePasses(t, a) {
|
|
1276
|
-
const e = a.op,
|
|
1277
|
-
if (e === "empty") return
|
|
1278
|
-
if (e === "notempty" || e === "not-empty") return
|
|
1279
|
-
if (e === "equals" || e === "eq") return s === String(
|
|
1280
|
-
if (e === "neq" || e === "not-equals") return s !== String(
|
|
1281
|
-
if (e === "startswith" || e === "starts-with") return s.startsWith(String(
|
|
1282
|
-
if (e === "endswith" || e === "ends-with") return s.endsWith(String(
|
|
1279
|
+
const e = a.op, i = a.value, r = t.trim(), s = r.toLowerCase();
|
|
1280
|
+
if (e === "empty") return r.length === 0;
|
|
1281
|
+
if (e === "notempty" || e === "not-empty") return r.length > 0;
|
|
1282
|
+
if (e === "equals" || e === "eq") return s === String(i ?? "").toLowerCase();
|
|
1283
|
+
if (e === "neq" || e === "not-equals") return s !== String(i ?? "").toLowerCase();
|
|
1284
|
+
if (e === "startswith" || e === "starts-with") return s.startsWith(String(i ?? "").toLowerCase());
|
|
1285
|
+
if (e === "endswith" || e === "ends-with") return s.endsWith(String(i ?? "").toLowerCase());
|
|
1283
1286
|
if (e === "in")
|
|
1284
|
-
return (Array.isArray(
|
|
1287
|
+
return (Array.isArray(i) ? i.map((n) => String(n).toLowerCase()) : String(i ?? "").split(",").map((n) => n.trim().toLowerCase()).filter(Boolean)).includes(s);
|
|
1285
1288
|
if (e === "gt" || e === "gte" || e === "lt" || e === "lte" || e === "between") {
|
|
1286
|
-
const o = this._parseComparable(
|
|
1289
|
+
const o = this._parseComparable(r);
|
|
1287
1290
|
if (typeof o != "number") return !1;
|
|
1288
1291
|
if (e === "between") {
|
|
1289
|
-
const u = Array.isArray(
|
|
1292
|
+
const u = Array.isArray(i) ? i : String(i ?? "").split(","), h = Number(u[0]), l = Number(u[1]);
|
|
1290
1293
|
return !Number.isFinite(h) || !Number.isFinite(l) ? !1 : o >= Math.min(h, l) && o <= Math.max(h, l);
|
|
1291
1294
|
}
|
|
1292
|
-
const n = Number(
|
|
1295
|
+
const n = Number(i);
|
|
1293
1296
|
return Number.isFinite(n) ? e === "gt" ? o > n : e === "gte" ? o >= n : e === "lt" ? o < n : o <= n : !1;
|
|
1294
1297
|
}
|
|
1295
|
-
return s.includes(String(
|
|
1298
|
+
return s.includes(String(i ?? "").toLowerCase());
|
|
1296
1299
|
}
|
|
1297
|
-
_rowMatchesFilter(t, a, e,
|
|
1300
|
+
_rowMatchesFilter(t, a, e, i) {
|
|
1298
1301
|
if (a) {
|
|
1299
|
-
const
|
|
1300
|
-
if (!
|
|
1301
|
-
const s =
|
|
1302
|
+
const r = e >= 0 ? p(t.cells[e]) : Array.from(t.cells).map((n) => p(n)).join(" ");
|
|
1303
|
+
if (!r) return !1;
|
|
1304
|
+
const s = r.toLowerCase(), o = a.split(/\s+/).filter(Boolean);
|
|
1302
1305
|
if (o.length && !o.every((n) => s.includes(n))) return !1;
|
|
1303
1306
|
}
|
|
1304
|
-
return
|
|
1305
|
-
const s = t.cells[
|
|
1306
|
-
return this._rulePasses(p(s),
|
|
1307
|
+
return i.length ? i.every((r) => {
|
|
1308
|
+
const s = t.cells[r.columnIndex];
|
|
1309
|
+
return this._rulePasses(p(s), r);
|
|
1307
1310
|
}) : !0;
|
|
1308
1311
|
}
|
|
1309
1312
|
_setColumnWidth(t, a, e = !0) {
|
|
1310
1313
|
if (!this._table) return;
|
|
1311
|
-
const
|
|
1312
|
-
if (this._columnWidths.set(t,
|
|
1314
|
+
const i = Math.max(72, Math.round(a));
|
|
1315
|
+
if (this._columnWidths.set(t, i), Array.from(this._table.rows).forEach((o) => {
|
|
1313
1316
|
const n = o.cells[t];
|
|
1314
|
-
n && (n.style.width = `${
|
|
1317
|
+
n && (n.style.width = `${i}px`, n.style.minWidth = `${i}px`, n.style.maxWidth = `${i}px`, n.style.boxSizing = "border-box");
|
|
1315
1318
|
}), !e) return;
|
|
1316
1319
|
this._applyPinnedColumns();
|
|
1317
1320
|
const s = this._headerCells()[t];
|
|
@@ -1320,7 +1323,7 @@ class R extends C {
|
|
|
1320
1323
|
detail: {
|
|
1321
1324
|
columnIndex: t,
|
|
1322
1325
|
key: s?.getAttribute("data-key") || p(s) || `column-${t + 1}`,
|
|
1323
|
-
width:
|
|
1326
|
+
width: i
|
|
1324
1327
|
},
|
|
1325
1328
|
bubbles: !0
|
|
1326
1329
|
})
|
|
@@ -1330,14 +1333,14 @@ class R extends C {
|
|
|
1330
1333
|
if (!this.hasAttribute("resizable-columns") || !this._table) return;
|
|
1331
1334
|
const e = t.target.closest(".resize-handle");
|
|
1332
1335
|
if (!e || !this._table.contains(e)) return;
|
|
1333
|
-
const
|
|
1334
|
-
if (!Number.isInteger(
|
|
1335
|
-
const
|
|
1336
|
-
if (!
|
|
1336
|
+
const i = Number(e.getAttribute("data-col-index"));
|
|
1337
|
+
if (!Number.isInteger(i) || i < 0) return;
|
|
1338
|
+
const r = this._headerCells()[i];
|
|
1339
|
+
if (!r) return;
|
|
1337
1340
|
t.preventDefault();
|
|
1338
|
-
const s =
|
|
1341
|
+
const s = r.getBoundingClientRect().width;
|
|
1339
1342
|
this._resizeState = {
|
|
1340
|
-
columnIndex:
|
|
1343
|
+
columnIndex: i,
|
|
1341
1344
|
startX: t.clientX,
|
|
1342
1345
|
startWidth: s
|
|
1343
1346
|
}, window.addEventListener("pointermove", this._onPointerMove), window.addEventListener("pointerup", this._onPointerUp);
|
|
@@ -1370,58 +1373,58 @@ class R extends C {
|
|
|
1370
1373
|
}
|
|
1371
1374
|
const e = a.closest("th");
|
|
1372
1375
|
if (!e || !this._table.contains(e)) return;
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1376
|
+
const r = this._headerCells().indexOf(e);
|
|
1377
|
+
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))));
|
|
1375
1378
|
}
|
|
1376
1379
|
_onDragOver(t) {
|
|
1377
1380
|
if (!this.hasAttribute("draggable-columns") || !this._table || this._dragColumnIndex < 0) return;
|
|
1378
1381
|
const e = t.target.closest("th");
|
|
1379
1382
|
if (!e || !this._table.contains(e)) return;
|
|
1380
|
-
const
|
|
1381
|
-
if (
|
|
1382
|
-
this._clearDragMarkers(), this._dragOverColumnIndex =
|
|
1383
|
-
const s =
|
|
1383
|
+
const i = this._headerCells(), r = i.indexOf(e);
|
|
1384
|
+
if (r < 0 || (t.preventDefault(), this._dragOverColumnIndex === r)) return;
|
|
1385
|
+
this._clearDragMarkers(), this._dragOverColumnIndex = r, e.setAttribute("data-drag-over", "true");
|
|
1386
|
+
const s = i[this._dragColumnIndex];
|
|
1384
1387
|
s && s.setAttribute("data-dragging", "true");
|
|
1385
1388
|
}
|
|
1386
1389
|
_onDrop(t) {
|
|
1387
1390
|
if (!this.hasAttribute("draggable-columns") || !this._table || this._dragColumnIndex < 0) return;
|
|
1388
1391
|
const e = t.target.closest("th");
|
|
1389
1392
|
if (!e || !this._table.contains(e)) return;
|
|
1390
|
-
const
|
|
1391
|
-
if (
|
|
1393
|
+
const r = this._headerCells().indexOf(e);
|
|
1394
|
+
if (r < 0) return;
|
|
1392
1395
|
t.preventDefault();
|
|
1393
|
-
const s = this._dragColumnIndex, o = this._moveColumn(s,
|
|
1394
|
-
this._clearDragMarkers(), this._dragColumnIndex = -1, this._ignoreHeaderClickUntil = Date.now() + 220, o && (this._applyVirtualization(!1), this._emitColumnOrderChange(s,
|
|
1396
|
+
const s = this._dragColumnIndex, o = this._moveColumn(s, r);
|
|
1397
|
+
this._clearDragMarkers(), this._dragColumnIndex = -1, this._ignoreHeaderClickUntil = Date.now() + 220, o && (this._applyVirtualization(!1), this._emitColumnOrderChange(s, r));
|
|
1395
1398
|
}
|
|
1396
1399
|
_onDragEnd() {
|
|
1397
1400
|
this._clearDragMarkers(), this._dragColumnIndex = -1;
|
|
1398
1401
|
}
|
|
1399
1402
|
_rowValues(t) {
|
|
1400
|
-
const a = this._headerCells(), e = Array.from(t.cells),
|
|
1401
|
-
return e.forEach((
|
|
1403
|
+
const a = this._headerCells(), e = Array.from(t.cells), i = {};
|
|
1404
|
+
return e.forEach((r, s) => {
|
|
1402
1405
|
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
|
-
|
|
1404
|
-
}),
|
|
1406
|
+
i[n || `col_${s + 1}`] = p(r);
|
|
1407
|
+
}), i;
|
|
1405
1408
|
}
|
|
1406
1409
|
_syncRowSelectionState() {
|
|
1407
1410
|
const t = this.hasAttribute("selectable"), a = this._bodyRows();
|
|
1408
1411
|
for (const e of Array.from(this._selectedRows))
|
|
1409
1412
|
a.includes(e) || this._selectedRows.delete(e);
|
|
1410
1413
|
a.forEach((e) => {
|
|
1411
|
-
const
|
|
1412
|
-
t &&
|
|
1414
|
+
const i = !e.hidden;
|
|
1415
|
+
t && i ? (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"));
|
|
1413
1416
|
});
|
|
1414
1417
|
}
|
|
1415
1418
|
_toggleRowSelection(t) {
|
|
1416
1419
|
const a = this.hasAttribute("multi-select"), e = this._selectedRows.has(t);
|
|
1417
1420
|
a || this._selectedRows.clear(), e && a ? this._selectedRows.delete(t) : this._selectedRows.add(t), this._syncRowSelectionState(), this._updateBulkActions();
|
|
1418
|
-
const
|
|
1421
|
+
const i = this._bodyRows(), r = i.flatMap((o, n) => this._selectedRows.has(o) ? [n] : []), s = i.filter((o) => this._selectedRows.has(o)).map((o) => this._rowValues(o));
|
|
1419
1422
|
this.dispatchEvent(
|
|
1420
1423
|
new CustomEvent("row-select", {
|
|
1421
1424
|
detail: {
|
|
1422
|
-
index:
|
|
1425
|
+
index: i.indexOf(t),
|
|
1423
1426
|
selected: this._selectedRows.has(t),
|
|
1424
|
-
indices:
|
|
1427
|
+
indices: r,
|
|
1425
1428
|
rows: s,
|
|
1426
1429
|
page: this._page
|
|
1427
1430
|
},
|
|
@@ -1474,29 +1477,29 @@ class R extends C {
|
|
|
1474
1477
|
}
|
|
1475
1478
|
_onClick(t) {
|
|
1476
1479
|
if (!this._table) return;
|
|
1477
|
-
const e = t.composedPath().find((
|
|
1480
|
+
const e = t.composedPath().find((r) => r instanceof HTMLElement) || t.target;
|
|
1478
1481
|
if (e.closest(".bulk-clear")) {
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1482
|
+
const r = this._selectedRows.size;
|
|
1483
|
+
r > 0 && (this._selectedRows.clear(), this._syncRowSelectionState(), this._updateBulkActions(), this.dispatchEvent(new CustomEvent("bulk-clear", { detail: { count: r, page: this._page }, bubbles: !0 })));
|
|
1481
1484
|
return;
|
|
1482
1485
|
}
|
|
1483
1486
|
if (!e.closest(".resize-handle") && !(e.closest("th") && Date.now() < this._ignoreHeaderClickUntil) && !this._isInteractionBlocked()) {
|
|
1484
1487
|
if (this.hasAttribute("sortable")) {
|
|
1485
|
-
const
|
|
1486
|
-
if (
|
|
1487
|
-
if (e !==
|
|
1488
|
-
const o = this._headerCells().indexOf(
|
|
1488
|
+
const r = e.closest("th");
|
|
1489
|
+
if (r && this._table.contains(r)) {
|
|
1490
|
+
if (e !== r && this._isInteractiveTarget(e)) return;
|
|
1491
|
+
const o = this._headerCells().indexOf(r);
|
|
1489
1492
|
if (o >= 0) {
|
|
1490
|
-
this._sortByColumn(o,
|
|
1493
|
+
this._sortByColumn(o, r);
|
|
1491
1494
|
return;
|
|
1492
1495
|
}
|
|
1493
1496
|
}
|
|
1494
1497
|
}
|
|
1495
1498
|
if (this.hasAttribute("selectable")) {
|
|
1496
|
-
const
|
|
1497
|
-
if (
|
|
1498
|
-
if (e !==
|
|
1499
|
-
this._toggleRowSelection(
|
|
1499
|
+
const r = e.closest("tbody tr");
|
|
1500
|
+
if (r && this._table.contains(r) && !r.hidden && !this._isVirtualSpacerRow(r)) {
|
|
1501
|
+
if (e !== r && this._isInteractiveTarget(e)) return;
|
|
1502
|
+
this._toggleRowSelection(r);
|
|
1500
1503
|
}
|
|
1501
1504
|
}
|
|
1502
1505
|
}
|
|
@@ -1505,19 +1508,19 @@ class R extends C {
|
|
|
1505
1508
|
if (!this._table) return;
|
|
1506
1509
|
const a = t.key, e = t.target;
|
|
1507
1510
|
if (a === "Escape" && this._selectedRows.size) {
|
|
1508
|
-
const
|
|
1509
|
-
this._selectedRows.clear(), this._syncRowSelectionState(), this._updateBulkActions(), this.dispatchEvent(new CustomEvent("bulk-clear", { detail: { count:
|
|
1511
|
+
const r = this._selectedRows.size;
|
|
1512
|
+
this._selectedRows.clear(), this._syncRowSelectionState(), this._updateBulkActions(), this.dispatchEvent(new CustomEvent("bulk-clear", { detail: { count: r, page: this._page }, bubbles: !0 }));
|
|
1510
1513
|
return;
|
|
1511
1514
|
}
|
|
1512
1515
|
if (this._isInteractionBlocked()) return;
|
|
1513
|
-
const
|
|
1514
|
-
if (
|
|
1515
|
-
const
|
|
1516
|
+
const i = e.closest("th");
|
|
1517
|
+
if (i && this._table.contains(i)) {
|
|
1518
|
+
const r = this._headerCells(), s = r.indexOf(i);
|
|
1516
1519
|
if (s >= 0) {
|
|
1517
1520
|
const n = this._isRtl() ? -1 : 1, u = -n;
|
|
1518
1521
|
if (a === "ArrowRight" || a === "ArrowLeft") {
|
|
1519
1522
|
t.preventDefault();
|
|
1520
|
-
const h = a === "ArrowRight" ? n : u, l = Math.max(0, Math.min(
|
|
1523
|
+
const h = a === "ArrowRight" ? n : u, l = Math.max(0, Math.min(r.length - 1, s + h));
|
|
1521
1524
|
if (t.altKey && this.hasAttribute("draggable-columns") && l !== s) {
|
|
1522
1525
|
this._moveColumn(s, l) && (this._ignoreHeaderClickUntil = Date.now() + 220, this._emitColumnOrderChange(s, l), this._applyVirtualization(!1), this._focusHeaderAt(l));
|
|
1523
1526
|
return;
|
|
@@ -1526,22 +1529,22 @@ class R extends C {
|
|
|
1526
1529
|
return;
|
|
1527
1530
|
}
|
|
1528
1531
|
if (a === "Home" || a === "End") {
|
|
1529
|
-
t.preventDefault(), this._focusHeaderAt(a === "Home" ? 0 :
|
|
1532
|
+
t.preventDefault(), this._focusHeaderAt(a === "Home" ? 0 : r.length - 1);
|
|
1530
1533
|
return;
|
|
1531
1534
|
}
|
|
1532
1535
|
if ((a === "Enter" || a === " ") && this.hasAttribute("sortable")) {
|
|
1533
|
-
if (e !==
|
|
1534
|
-
t.preventDefault(), this._sortByColumn(s,
|
|
1536
|
+
if (e !== i && this._isInteractiveTarget(e)) return;
|
|
1537
|
+
t.preventDefault(), this._sortByColumn(s, i);
|
|
1535
1538
|
return;
|
|
1536
1539
|
}
|
|
1537
1540
|
}
|
|
1538
1541
|
}
|
|
1539
1542
|
if (this.hasAttribute("selectable")) {
|
|
1540
|
-
const
|
|
1541
|
-
if (
|
|
1542
|
-
if (e !==
|
|
1543
|
+
const r = e.closest("tbody tr");
|
|
1544
|
+
if (r && this._table.contains(r) && !r.hidden && !this._isVirtualSpacerRow(r)) {
|
|
1545
|
+
if (e !== r && this._isInteractiveTarget(e)) return;
|
|
1543
1546
|
if (a === "ArrowDown" || a === "ArrowUp") {
|
|
1544
|
-
t.preventDefault(), this._focusSelectableRow(
|
|
1547
|
+
t.preventDefault(), this._focusSelectableRow(r, a === "ArrowDown" ? 1 : -1);
|
|
1545
1548
|
return;
|
|
1546
1549
|
}
|
|
1547
1550
|
if (a === "Home" || a === "End") {
|
|
@@ -1550,7 +1553,7 @@ class R extends C {
|
|
|
1550
1553
|
o && o.focus();
|
|
1551
1554
|
return;
|
|
1552
1555
|
}
|
|
1553
|
-
(a === "Enter" || a === " ") && (t.preventDefault(), this._toggleRowSelection(
|
|
1556
|
+
(a === "Enter" || a === " ") && (t.preventDefault(), this._toggleRowSelection(r));
|
|
1554
1557
|
}
|
|
1555
1558
|
}
|
|
1556
1559
|
}
|
|
@@ -1563,8 +1566,8 @@ class R extends C {
|
|
|
1563
1566
|
return;
|
|
1564
1567
|
}
|
|
1565
1568
|
t.removeAttribute("hidden");
|
|
1566
|
-
const
|
|
1567
|
-
o && (o.textContent =
|
|
1569
|
+
const r = this.getAttribute("bulk-actions-label") || "{count} selected", s = this.getAttribute("bulk-clear-label") || "Clear selection", o = t.querySelector(".bulk-count");
|
|
1570
|
+
o && (o.textContent = r.replace("{count}", String(e)));
|
|
1568
1571
|
const n = t.querySelector(".bulk-clear");
|
|
1569
1572
|
n && (n.textContent = s);
|
|
1570
1573
|
}
|