@voidable/ui 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/angular/index.d.ts +2 -2
- package/dist/angular/index.js +2 -1
- package/dist/chunks/activation-B8aBarKd.js +4 -0
- package/dist/chunks/carousel-C9u0bg5l.js +10 -0
- package/dist/chunks/choice-BTrsi7OW.js +16 -0
- package/dist/chunks/data-Baycjoo4.js +96 -0
- package/dist/chunks/fields-MEqz-olE.js +21 -0
- package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
- package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
- package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
- package/dist/chunks/menu-CxRRgkJI.js +21 -0
- package/dist/chunks/{modal-DWGkNdNG.js → modal-Cz2-Ov76.js} +23 -15
- package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
- package/dist/chunks/{overlay-CH7L4N-h.js → overlay-BuV-4Yvt.js} +75 -68
- package/dist/chunks/overlay-K1ilWC1p.js +4 -0
- package/dist/chunks/pickers-CjlFgNke.js +36 -0
- package/dist/chunks/table-BBpqwWEi.js +4 -0
- package/dist/chunks/tabs-Buf3EBWq.js +10 -0
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/accordion.js +22 -14
- package/dist/components/action-input.d.ts +2 -1
- package/dist/components/action-input.js +59 -55
- package/dist/components/bar-chart.js +41 -40
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +15 -11
- package/dist/components/button.d.ts +7 -0
- package/dist/components/button.js +23 -16
- package/dist/components/calendar.d.ts +45 -10
- package/dist/components/calendar.js +183 -129
- package/dist/components/carousel.d.ts +22 -0
- package/dist/components/carousel.js +64 -35
- package/dist/components/charts/data.d.ts +2 -2
- package/dist/components/checkbox-group.js +22 -21
- package/dist/components/checkbox.d.ts +7 -0
- package/dist/components/checkbox.js +29 -24
- package/dist/components/collapsible.d.ts +7 -0
- package/dist/components/collapsible.js +19 -11
- package/dist/components/color-picker.js +28 -27
- package/dist/components/combobox.d.ts +13 -1
- package/dist/components/combobox.js +54 -41
- package/dist/components/compose-input.d.ts +9 -1
- package/dist/components/compose-input.js +28 -16
- package/dist/components/dialog.js +1 -1
- package/dist/components/donut-chart.js +57 -56
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.d.ts +22 -0
- package/dist/components/dropdown-menu.js +54 -39
- package/dist/components/editable.d.ts +11 -1
- package/dist/components/editable.js +35 -22
- package/dist/components/error-fallback.d.ts +4 -2
- package/dist/components/error-fallback.js +34 -28
- package/dist/components/file-upload.d.ts +9 -0
- package/dist/components/file-upload.js +54 -28
- package/dist/components/gauge.js +108 -107
- package/dist/components/hamburger.d.ts +7 -0
- package/dist/components/hamburger.js +28 -19
- package/dist/components/hover-card.d.ts +7 -0
- package/dist/components/hover-card.js +22 -14
- package/dist/components/indicator.js +15 -14
- package/dist/components/input.js +1 -1
- package/dist/components/line-chart.js +43 -42
- package/dist/components/menu.d.ts +25 -0
- package/dist/components/menu.js +55 -33
- package/dist/components/multiselect.d.ts +17 -1
- package/dist/components/multiselect.js +96 -74
- package/dist/components/nav-menu.d.ts +9 -0
- package/dist/components/nav-menu.js +30 -23
- package/dist/components/number-input.d.ts +15 -1
- package/dist/components/number-input.js +71 -37
- package/dist/components/pagination.js +25 -24
- package/dist/components/pin-input.d.ts +11 -0
- package/dist/components/pin-input.js +46 -32
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.js +21 -13
- package/dist/components/radio-group.js +1 -1
- package/dist/components/radio.d.ts +10 -1
- package/dist/components/radio.js +37 -32
- package/dist/components/segmented-control.d.ts +14 -0
- package/dist/components/segmented-control.js +40 -28
- package/dist/components/sidebar.d.ts +1 -0
- package/dist/components/sidebar.js +14 -10
- package/dist/components/slider.js +1 -1
- package/dist/components/spinner.d.ts +5 -3
- package/dist/components/spinner.js +21 -14
- package/dist/components/stat.js +1 -1
- package/dist/components/status-dot.d.ts +2 -2
- package/dist/components/status-dot.js +12 -14
- package/dist/components/stepper.d.ts +2 -0
- package/dist/components/stepper.js +20 -13
- package/dist/components/switch.d.ts +7 -0
- package/dist/components/switch.js +24 -16
- package/dist/components/table.d.ts +77 -1
- package/dist/components/table.js +562 -73
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +42 -33
- package/dist/components/tag.js +12 -11
- package/dist/components/tags-input.d.ts +10 -1
- package/dist/components/tags-input.js +42 -30
- package/dist/components/textarea.js +1 -1
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +35 -28
- package/dist/components/toggle-group.d.ts +8 -0
- package/dist/components/toggle-group.js +24 -17
- package/dist/components/toggle.d.ts +7 -0
- package/dist/components/toggle.js +23 -15
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.js +20 -12
- package/dist/components.json +96 -74
- package/dist/custom-elements.json +4213 -131
- package/dist/dev/rules.d.ts +0 -1
- package/dist/dev/types.d.ts +3 -1
- package/dist/dev.js +244 -113
- package/dist/index.d.ts +4 -0
- package/dist/index.js +68 -66
- package/dist/keyboard-activation.d.ts +9 -9
- package/dist/keyboard.d.ts +2 -10
- package/dist/keymaps/activation.d.ts +8 -0
- package/dist/keymaps/carousel.d.ts +9 -0
- package/dist/keymaps/choice.d.ts +21 -0
- package/dist/keymaps/fields.d.ts +31 -0
- package/dist/keymaps/index.d.ts +2 -0
- package/dist/keymaps/menu.d.ts +36 -0
- package/dist/keymaps/nav-menu.d.ts +11 -0
- package/dist/keymaps/overlay.d.ts +4 -0
- package/dist/keymaps/pickers.d.ts +36 -0
- package/dist/keymaps/table.d.ts +8 -0
- package/dist/keymaps/tabs.d.ts +7 -0
- package/dist/keymaps.js +51 -0
- package/dist/keys.d.ts +46 -0
- package/dist/keys.js +57 -0
- package/dist/llms.txt +11 -3
- package/dist/messages/ar.d.ts +1 -0
- package/dist/messages/ar.js +130 -0
- package/dist/messages/fr.d.ts +1 -0
- package/dist/messages/fr.js +109 -0
- package/dist/messages.d.ts +213 -0
- package/dist/messages.js +190 -0
- package/dist/modal.d.ts +7 -0
- package/dist/reference.md +817 -17
- package/dist/testing/index.d.ts +46 -0
- package/dist/testing.js +79 -0
- package/dist/types/elements.d.ts +89 -73
- package/dist/types/react.d.ts +5 -1
- package/dist/types/solid.d.ts +5 -1
- package/dist/types/solid2.d.ts +4 -0
- package/dist/types/svelte.d.ts +5 -1
- package/dist/types/vue.d.ts +5 -1
- package/dist/vscode.html-custom-data.json +384 -18
- package/dist/web-types.json +830 -69
- package/package.json +22 -2
- package/dist/chunks/data-BpiiNapL.js +0 -95
package/dist/components/table.js
CHANGED
|
@@ -1,8 +1,69 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { localeOf as i, msg as a } from "../messages.js";
|
|
5
|
+
import { t as o } from "../chunks/form-control-fL-Hhy91.js";
|
|
6
|
+
import { t as s } from "../chunks/table-BBpqwWEi.js";
|
|
7
|
+
import { property as c } from "lit/decorators.js";
|
|
4
8
|
//#region src/components/table.ts
|
|
5
|
-
var
|
|
9
|
+
var l = {
|
|
10
|
+
fromAttribute(e) {
|
|
11
|
+
if (e === null || e.trim() === "") return [];
|
|
12
|
+
try {
|
|
13
|
+
let t = JSON.parse(e);
|
|
14
|
+
if (Array.isArray(t)) return t.map(String);
|
|
15
|
+
} catch {}
|
|
16
|
+
return [e];
|
|
17
|
+
},
|
|
18
|
+
toAttribute(e) {
|
|
19
|
+
return e && e.length ? JSON.stringify(e) : null;
|
|
20
|
+
}
|
|
21
|
+
}, u = "void-checkbox, input[type=\"checkbox\"]", d = (e) => e.checked ?? e.hasAttribute("checked"), f = (e) => !!(e.disabled ?? e.hasAttribute("disabled"));
|
|
22
|
+
function p(e, t, n = !1) {
|
|
23
|
+
"checked" in e ? e.checked !== t && (e.checked = t) : e.toggleAttribute("checked", t), "indeterminate" in e ? e.indeterminate !== n && (e.indeterminate = n) : e.toggleAttribute("indeterminate", n);
|
|
24
|
+
}
|
|
25
|
+
var m = (e) => e.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase(), h = /* @__PURE__ */ new Map();
|
|
26
|
+
function g(e) {
|
|
27
|
+
let t = h.get(e);
|
|
28
|
+
if (!t) {
|
|
29
|
+
t = {
|
|
30
|
+
group: ",",
|
|
31
|
+
decimal: "."
|
|
32
|
+
};
|
|
33
|
+
try {
|
|
34
|
+
for (let n of new Intl.NumberFormat(e).formatToParts(-12345.6)) n.type === "group" ? t.group = n.value : n.type === "decimal" && (t.decimal = n.value);
|
|
35
|
+
} catch {}
|
|
36
|
+
h.set(e, t);
|
|
37
|
+
}
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
function _(e, t) {
|
|
41
|
+
let { group: n, decimal: r } = g(t), i = e.replace(/[٠-٩]/g, (e) => String(e.charCodeAt(0) - 1632)).replace(/[۰-۹]/g, (e) => String(e.charCodeAt(0) - 1776)).replace(/[\s ]/g, "").replace(/[−–]/g, "-");
|
|
42
|
+
n.trim() !== "" && (i = i.split(n).join("")), r !== "." && (i = i.split(r).join("."));
|
|
43
|
+
let a = Number(i);
|
|
44
|
+
return Number.isNaN(a) ? Number.parseFloat(i.replace(/[^\d.+\-eE]/g, "")) : a;
|
|
45
|
+
}
|
|
46
|
+
function v(e, t) {
|
|
47
|
+
try {
|
|
48
|
+
return new Intl.NumberFormat(t).format(e);
|
|
49
|
+
} catch {
|
|
50
|
+
return String(e);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
var y = /* @__PURE__ */ new Map();
|
|
54
|
+
function b(e) {
|
|
55
|
+
let t = y.get(e);
|
|
56
|
+
if (!t) {
|
|
57
|
+
try {
|
|
58
|
+
t = new Intl.Collator(e || void 0, { numeric: !0 });
|
|
59
|
+
} catch {
|
|
60
|
+
t = new Intl.Collator(void 0, { numeric: !0 });
|
|
61
|
+
}
|
|
62
|
+
y.set(e, t);
|
|
63
|
+
}
|
|
64
|
+
return t;
|
|
65
|
+
}
|
|
66
|
+
var x = 150, S = "button, a[href], input, select, textarea, [tabindex], [role=\"checkbox\"], [role=\"button\"], [role=\"switch\"]", C = 100, w = {
|
|
6
67
|
TABLE: "table",
|
|
7
68
|
THEAD: "rowgroup",
|
|
8
69
|
TBODY: "rowgroup",
|
|
@@ -11,15 +72,65 @@ var r = "button, a[href], input, select, textarea, [tabindex], [role=\"checkbox\
|
|
|
11
72
|
TD: "cell",
|
|
12
73
|
CAPTION: "caption"
|
|
13
74
|
};
|
|
14
|
-
function
|
|
75
|
+
function T(e) {
|
|
15
76
|
return Array.from(e.children).filter((e) => e.tagName === "TD" || e.tagName === "TH");
|
|
16
77
|
}
|
|
17
|
-
function
|
|
78
|
+
function E(e) {
|
|
18
79
|
return Math.max(1, Number.parseInt(e.getAttribute("colspan") ?? "1", 10) || 1);
|
|
19
80
|
}
|
|
20
|
-
var
|
|
81
|
+
var D = class extends o(e) {
|
|
21
82
|
constructor(...e) {
|
|
22
|
-
super(...e), this.striped = !1, this.hoverable = !1, this.compact = !1, this.bordered = !1, this.inset = !1, this.stack = null, this.scrollable = !1, this.stickyHeader = !1, this.stickyColumn = !1, this.maxHeight = null, this.label = null, this
|
|
83
|
+
super(...e), this.striped = !1, this.hoverable = !1, this.compact = !1, this.bordered = !1, this.inset = !1, this.stack = null, this.scrollable = !1, this.stickyHeader = !1, this.stickyColumn = !1, this.maxHeight = null, this.label = null, this.sort = null, this.sortDirection = null, this.filter = null, this.filterColumns = null, this.selectable = null, this.manual = !1, this.totalRows = null, this.allSelected = !1, this.keys = null, this.#e = /* @__PURE__ */ new Set(), this.#t = null, this.#n = null, this.#r = /* @__PURE__ */ new Map(), this.#i = [], this.#a = null, this.#o = null, this.#s = !1, this.#c = !0, this.#l = !0, this.#u = !1, this.#d = "", this.#f = "", this.#p = "", this.#m = !1, this.#h = null, this.#g = !1, this.#_ = /* @__PURE__ */ new WeakSet(), this.#v = /* @__PURE__ */ new WeakMap(), this.#y = null, this.#b = null, this.#x = null, this.#S = !1, this.#C = {
|
|
84
|
+
shown: 0,
|
|
85
|
+
total: 0
|
|
86
|
+
}, this.#w = null, this.#T = null, this.#E = !1, this.#D = /* @__PURE__ */ new WeakMap(), this.#O = /* @__PURE__ */ new WeakMap(), this.#k = null, this.#A = /* @__PURE__ */ new WeakMap(), this.#j = /* @__PURE__ */ new WeakMap(), this.#M = null, this.#N = !1, this.#P = !1, this.#F = () => this.#be(), this.#se = (e) => {
|
|
87
|
+
this.#g = e.shiftKey;
|
|
88
|
+
}, this.#ce = (e) => {
|
|
89
|
+
let t = e.target;
|
|
90
|
+
if (!(t instanceof Element)) return;
|
|
91
|
+
let n = t.closest("th[data-sort]");
|
|
92
|
+
if (n && t.closest("button") && this.#G(n) && n.closest("table") === this.#o) {
|
|
93
|
+
this.#le(n);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
let r = t.closest("void-table-select-all");
|
|
97
|
+
r && t.closest("button, [role=\"button\"], a") && this.#G(r) && this.#oe();
|
|
98
|
+
}, this.#ue = (e) => {
|
|
99
|
+
if (this.selectable === null) return;
|
|
100
|
+
let t = e.target;
|
|
101
|
+
!(t instanceof HTMLInputElement) || t.type !== "checkbox" || t.closest("void-checkbox") || this.#ae(t);
|
|
102
|
+
}, this.#de = (e) => {
|
|
103
|
+
let t = e.target;
|
|
104
|
+
this.selectable === null || t === this || !(t instanceof HTMLElement) || t.tagName !== "VOID-CHECKBOX" || this.#ae(t) && e.stopImmediatePropagation();
|
|
105
|
+
}, this.#pe = (e) => {
|
|
106
|
+
let t = e.target;
|
|
107
|
+
if (!(t instanceof HTMLInputElement)) return;
|
|
108
|
+
let n = t.closest("void-table-filter");
|
|
109
|
+
!n || !this.#G(n) || (this.#x !== null && clearTimeout(this.#x), this.#x = setTimeout(() => {
|
|
110
|
+
this.#x = null;
|
|
111
|
+
let e = t.value.trim() === "" ? null : t.value;
|
|
112
|
+
this.#S = !0, this.filter = e, this.updateComplete.then(() => {
|
|
113
|
+
this.#S = !1, this.#K(), this.#w?.takeRecords();
|
|
114
|
+
let { shown: e, total: t } = this.#C;
|
|
115
|
+
this.dispatchEvent(new CustomEvent("void-filter", {
|
|
116
|
+
bubbles: !0,
|
|
117
|
+
composed: !0,
|
|
118
|
+
detail: {
|
|
119
|
+
filter: this.filter ?? "",
|
|
120
|
+
shown: e,
|
|
121
|
+
total: t
|
|
122
|
+
}
|
|
123
|
+
}));
|
|
124
|
+
});
|
|
125
|
+
}, x));
|
|
126
|
+
}, this.#me = (e) => {
|
|
127
|
+
if (this.selectable === null || this.selectable === "single" || n(this, e) !== "selectAll") return;
|
|
128
|
+
let t = e.target;
|
|
129
|
+
!(t instanceof Element) || !t.closest("tbody") || t.closest("input:not([type=\"checkbox\"]), textarea, select, [contenteditable]:not([contenteditable=\"false\"])") || (e.preventDefault(), this.#ie(!0));
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
static {
|
|
133
|
+
this.keyMap = s;
|
|
23
134
|
}
|
|
24
135
|
#e;
|
|
25
136
|
#t;
|
|
@@ -32,8 +143,32 @@ var c = class extends e {
|
|
|
32
143
|
#c;
|
|
33
144
|
#l;
|
|
34
145
|
#u;
|
|
146
|
+
#d;
|
|
147
|
+
#f;
|
|
148
|
+
#p;
|
|
149
|
+
#m;
|
|
150
|
+
#h;
|
|
151
|
+
#g;
|
|
152
|
+
#_;
|
|
153
|
+
#v;
|
|
154
|
+
#y;
|
|
155
|
+
#b;
|
|
156
|
+
#x;
|
|
157
|
+
#S;
|
|
158
|
+
#C;
|
|
159
|
+
#w;
|
|
160
|
+
#T;
|
|
161
|
+
#E;
|
|
162
|
+
#D;
|
|
163
|
+
#O;
|
|
164
|
+
#k;
|
|
165
|
+
#A;
|
|
166
|
+
#j;
|
|
167
|
+
#M;
|
|
168
|
+
#N;
|
|
169
|
+
#P;
|
|
35
170
|
connectedCallback() {
|
|
36
|
-
super.connectedCallback(), this.#
|
|
171
|
+
super.connectedCallback(), this.#w ??= new MutationObserver((e) => this.#H(e)), this.#w.observe(this, {
|
|
37
172
|
childList: !0,
|
|
38
173
|
subtree: !0,
|
|
39
174
|
characterData: !0,
|
|
@@ -43,144 +178,498 @@ var c = class extends e {
|
|
|
43
178
|
"data-stack",
|
|
44
179
|
"data-align",
|
|
45
180
|
"role",
|
|
46
|
-
"colspan"
|
|
181
|
+
"colspan",
|
|
182
|
+
"data-value",
|
|
183
|
+
"data-sort-value",
|
|
184
|
+
"data-key",
|
|
185
|
+
"data-sort",
|
|
186
|
+
"hidden",
|
|
187
|
+
"aria-selected",
|
|
188
|
+
"checked",
|
|
189
|
+
"disabled"
|
|
47
190
|
]
|
|
48
|
-
}), this.#
|
|
191
|
+
}), this.addEventListener("click", this.#se, !0), this.addEventListener("click", this.#ce), this.addEventListener("change", this.#ue), this.addEventListener("void-change", this.#de), this.addEventListener("input", this.#pe), this.addEventListener("keydown", this.#me), this.#c = !0, this.#l = !0, this.#k ??= new MutationObserver(() => this.#I()), this.#k.observe(this, {
|
|
49
192
|
attributes: !0,
|
|
50
193
|
attributeFilter: ["aria-label"]
|
|
51
|
-
}), typeof ResizeObserver < "u" && (this.#
|
|
194
|
+
}), typeof ResizeObserver < "u" && (this.#T ??= new ResizeObserver(() => this.#I()), this.#T.observe(this)), this.addEventListener("scroll", this.#F, { passive: !0 }), this.#I();
|
|
52
195
|
}
|
|
53
196
|
disconnectedCallback() {
|
|
54
|
-
super.disconnectedCallback(), this.#
|
|
197
|
+
super.disconnectedCallback(), this.#w?.disconnect(), this.#k?.disconnect(), this.#T?.disconnect(), this.removeEventListener("scroll", this.#F), this.removeEventListener("click", this.#se, !0), this.removeEventListener("click", this.#ce), this.removeEventListener("change", this.#ue), this.removeEventListener("void-change", this.#de), this.removeEventListener("input", this.#pe), this.removeEventListener("keydown", this.#me), this.#x !== null && clearTimeout(this.#x), this.#x = null;
|
|
198
|
+
}
|
|
199
|
+
get value() {
|
|
200
|
+
if (this.#t) return [...this.#t];
|
|
201
|
+
let e = this.#n, t = e && e.length ? e.filter((e) => this.#e.has(e.value)).map((e) => e.value) : [...this.#e];
|
|
202
|
+
return this.#t = t, [...t];
|
|
203
|
+
}
|
|
204
|
+
set value(e) {
|
|
205
|
+
let t = Array.isArray(e) ? e.map(String) : [];
|
|
206
|
+
this.#e = new Set(t), this.#t = null, this.#l = !0, this.requestUpdate("value", void 0);
|
|
207
|
+
}
|
|
208
|
+
formSubmission() {
|
|
209
|
+
return this.selectable === null ? null : this.value;
|
|
210
|
+
}
|
|
211
|
+
formValidity() {
|
|
212
|
+
return this.selectable === null ? null : super.formValidity();
|
|
213
|
+
}
|
|
214
|
+
morphedCallback() {
|
|
215
|
+
this.#n && (this.#l = !0, this.#u = !0, this.#I());
|
|
216
|
+
}
|
|
217
|
+
serverChangedCallback(e) {
|
|
218
|
+
super.serverChangedCallback(e), this.#l = !0, this.#I();
|
|
55
219
|
}
|
|
56
220
|
updated(e) {
|
|
57
221
|
super.updated(e), this.setHostStyle("--void-table-max-height", this.maxHeight || "");
|
|
58
222
|
let t = (this.stack ?? "").trim();
|
|
59
|
-
/^\d*\.?\d+(px|rem|em)$/.test(t) ? (this.setHostStyle("--void-table-stack-at", t), this.#
|
|
223
|
+
if (/^\d*\.?\d+(px|rem|em)$/.test(t) ? (this.setHostStyle("--void-table-stack-at", t), this.#P = !0) : this.#P &&= (this.setHostStyle("--void-table-stack-at", null), !1), e.has("filter") && !this.#S) {
|
|
224
|
+
let e = this.#fe(), t = this.filter ?? "";
|
|
225
|
+
e && e.value !== t && (e.value = t);
|
|
226
|
+
}
|
|
227
|
+
e.size === 0 && (this.#d = "", this.#l = !0), (e.has("sort") || e.has("sortDirection")) && (this.#d = ""), (e.has("selectable") || e.has("allSelected") || e.has("totalRows")) && (this.#l = !0), this.#I();
|
|
60
228
|
}
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
this.#
|
|
64
|
-
this.#
|
|
229
|
+
#F;
|
|
230
|
+
#I() {
|
|
231
|
+
this.#E || (this.#E = !0, queueMicrotask(() => {
|
|
232
|
+
this.#E = !1, this.isConnected && (this.#L(this.stack !== null), this.#K(), this.#ve(), this.#w?.takeRecords());
|
|
65
233
|
}));
|
|
66
234
|
}
|
|
67
|
-
#
|
|
68
|
-
let t = !1, n = !1, a =
|
|
69
|
-
for (let
|
|
70
|
-
if (
|
|
71
|
-
this.#
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
74
|
-
|
|
235
|
+
#L(e) {
|
|
236
|
+
let t = !1, n = !1, r = 0, i = null, a = !1;
|
|
237
|
+
for (let o of this.querySelectorAll("table")) {
|
|
238
|
+
if (o.closest("void-table") !== this) continue;
|
|
239
|
+
i ??= o, this.#R(o), e && this.#V(o);
|
|
240
|
+
let s = this.#z(o), c = [];
|
|
241
|
+
if (s) for (let e of T(s)) {
|
|
242
|
+
o === i && e.hasAttribute("data-sort") && (a = !0, this.#U(e));
|
|
243
|
+
let r = {
|
|
75
244
|
label: e.hasAttribute("data-label") ? e.getAttribute("data-label") ?? "" : (e.textContent ?? "").replace(/\s+/g, " ").trim(),
|
|
76
245
|
stack: e.getAttribute("data-stack"),
|
|
77
246
|
align: e.getAttribute("data-align")
|
|
78
247
|
};
|
|
79
|
-
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
for (let t = 0; t <
|
|
248
|
+
r.stack === "title" && (t = !0), r.stack === "select" && (n = !0);
|
|
249
|
+
let s = e.querySelector(S) !== null;
|
|
250
|
+
s !== e.hasAttribute("data-controls") && e.toggleAttribute("data-controls", s);
|
|
251
|
+
for (let t = 0; t < E(e); t++) c.push(r);
|
|
83
252
|
}
|
|
84
|
-
if (
|
|
85
|
-
let e =
|
|
86
|
-
e !==
|
|
253
|
+
if (s) {
|
|
254
|
+
let e = s.querySelector("[data-controls]") !== null;
|
|
255
|
+
e !== s.hasAttribute("data-controls") && s.toggleAttribute("data-controls", e);
|
|
87
256
|
}
|
|
88
|
-
if (e) for (let e of
|
|
89
|
-
for (let t of Array.from(
|
|
90
|
-
if (t.closest("table") !==
|
|
91
|
-
|
|
92
|
-
let n = t.parentElement?.tagName === "THEAD" || t ===
|
|
93
|
-
for (let
|
|
94
|
-
if (e && (
|
|
95
|
-
let t =
|
|
96
|
-
t && (e && this.#
|
|
257
|
+
if (e) for (let e of o.querySelectorAll(":scope > caption, :scope > thead, :scope > tbody, :scope > tfoot")) this.#V(e);
|
|
258
|
+
for (let t of Array.from(o.querySelectorAll("tr"))) {
|
|
259
|
+
if (t.closest("table") !== o) continue;
|
|
260
|
+
r++, e && this.#V(t);
|
|
261
|
+
let n = t.parentElement?.tagName === "THEAD" || t === s, i = 0;
|
|
262
|
+
for (let r of T(t)) {
|
|
263
|
+
if (e && (r.tagName === "TH" ? this.#V(r, n || r.getAttribute("scope") === "col" ? "columnheader" : "rowheader") : this.#V(r)), !n) {
|
|
264
|
+
let t = c[i];
|
|
265
|
+
t && (e && this.#B(r, "data-label", t.label, this.#D, !0), this.#B(r, "data-stack", t.stack, this.#A), this.#B(r, "data-align", t.align, this.#j));
|
|
97
266
|
}
|
|
98
|
-
|
|
267
|
+
i += E(r);
|
|
99
268
|
}
|
|
100
269
|
}
|
|
101
270
|
}
|
|
102
|
-
this.setHostAttribute("data-stack-title", t ? "" : null), this.setHostAttribute("data-stack-select", n ? "" : null), this.setHostAttribute("data-long",
|
|
271
|
+
this.#o = i, this.#s = a, this.setHostAttribute("data-stack-title", t ? "" : null), this.setHostAttribute("data-stack-select", n ? "" : null), this.setHostAttribute("data-long", r > C ? "" : null);
|
|
103
272
|
}
|
|
104
|
-
#
|
|
105
|
-
let t = this.getAttribute("aria-label"), n = (t !== null && t !== this.#
|
|
273
|
+
#R(e) {
|
|
274
|
+
let t = this.getAttribute("aria-label"), n = (t !== null && t !== this.#M && t.trim() !== "" ? t : null) ?? (this.label?.trim() ? this.label : null), r = e.getAttribute("aria-label"), i = this.#O.get(e), a = r !== null && r !== i || e.hasAttribute("aria-labelledby") || e.querySelector(":scope > caption") !== null;
|
|
106
275
|
if (n === null || a) {
|
|
107
|
-
i !== void 0 && r === i && e.removeAttribute("aria-label"), this.#
|
|
276
|
+
i !== void 0 && r === i && e.removeAttribute("aria-label"), this.#O.delete(e);
|
|
108
277
|
return;
|
|
109
278
|
}
|
|
110
|
-
r !== n && e.setAttribute("aria-label", n), this.#
|
|
279
|
+
r !== n && e.setAttribute("aria-label", n), this.#O.set(e, n);
|
|
111
280
|
}
|
|
112
|
-
#
|
|
281
|
+
#z(e) {
|
|
113
282
|
let t = e.querySelectorAll(":scope > thead > tr");
|
|
114
283
|
if (t.length) return t[t.length - 1];
|
|
115
284
|
let n = e.querySelector(":scope > tbody > tr, :scope > tr");
|
|
116
|
-
return n &&
|
|
285
|
+
return n && T(n).every((e) => e.tagName === "TH") ? n : null;
|
|
117
286
|
}
|
|
118
|
-
#
|
|
287
|
+
#B(e, t, n, r, i = !1) {
|
|
119
288
|
let a = e.getAttribute(t), o = r.get(e);
|
|
120
289
|
if (a !== null && a !== o) return;
|
|
121
290
|
let s = n === null || !i && n === "" ? null : n;
|
|
122
291
|
s === null ? (a !== null && e.removeAttribute(t), r.delete(e)) : (a !== s && e.setAttribute(t, s), r.set(e, s));
|
|
123
292
|
}
|
|
124
|
-
#
|
|
293
|
+
#V(e, t = w[e.tagName]) {
|
|
125
294
|
t && (e.hasAttribute("role") || e.setAttribute("role", t));
|
|
126
295
|
}
|
|
127
|
-
|
|
296
|
+
#H(e) {
|
|
297
|
+
let t = this.#y;
|
|
298
|
+
for (let n of e) {
|
|
299
|
+
let e = n.target;
|
|
300
|
+
if (!(t && (e === t || t.contains(e)))) if (n.type === "attributes") {
|
|
301
|
+
let e = n.attributeName;
|
|
302
|
+
e === "data-value" || e === "data-sort-value" || e === "data-key" || e === "data-sort" ? this.#c = !0 : e === "hidden" ? this.#u = !0 : (e === "checked" || e === "disabled" || e === "aria-selected") && (this.#l = !0);
|
|
303
|
+
} else this.#c = !0;
|
|
304
|
+
}
|
|
305
|
+
this.#I();
|
|
306
|
+
}
|
|
307
|
+
#U(e) {
|
|
308
|
+
if (!e.firstChild || e.querySelector("button, a[href], input, select, textarea, [role=\"button\"]")) return;
|
|
309
|
+
let t = this.ownerDocument.createElement("button");
|
|
310
|
+
t.type = "button", t.setAttribute("data-sort-button", ""), t.append(...Array.from(e.childNodes)), e.append(t);
|
|
311
|
+
}
|
|
312
|
+
#W(e) {
|
|
313
|
+
return T(e).map((e, t) => {
|
|
314
|
+
let n = e.getAttribute("data-sort"), r = e.getAttribute("data-stack");
|
|
315
|
+
return {
|
|
316
|
+
th: e,
|
|
317
|
+
key: e.getAttribute("data-key") ?? String(t),
|
|
318
|
+
type: n === null ? null : n === "number" || n === "date" ? n : "text",
|
|
319
|
+
skip: r === "select" || r === "actions" || r === "hide"
|
|
320
|
+
};
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
#G(e) {
|
|
324
|
+
return e.closest("void-table") === this;
|
|
325
|
+
}
|
|
326
|
+
#K() {
|
|
327
|
+
let e = this.#o, t = this.getElementsByTagName("void-table-filter"), n = !!this.filter?.trim();
|
|
328
|
+
if (!e || !(this.#s || n || this.selectable !== null || t.length > 0 || this.#n)) return;
|
|
329
|
+
let r = this.#z(e);
|
|
330
|
+
this.#a = r;
|
|
331
|
+
let i = r ? this.#W(r) : [];
|
|
332
|
+
(this.#c || !this.#n) && this.#J(e, r, i);
|
|
333
|
+
let o = this.#n;
|
|
334
|
+
this.#he(), this.manual || this.#X(o, i);
|
|
335
|
+
let { shown: s, total: c } = this.#Q(o, i);
|
|
336
|
+
this.#C = {
|
|
337
|
+
shown: s,
|
|
338
|
+
total: c
|
|
339
|
+
};
|
|
340
|
+
for (let e of i) {
|
|
341
|
+
if (e.type === null) continue;
|
|
342
|
+
let t = this.sort === e.key ? this.sortDirection === "descending" ? "descending" : "ascending" : "none";
|
|
343
|
+
e.th.getAttribute("aria-sort") !== t && e.th.setAttribute("aria-sort", t);
|
|
344
|
+
}
|
|
345
|
+
if (this.#l && this.#ne(), !this.manual) for (let e of this.getElementsByTagName("void-table-empty")) this.#G(e) && this.#q(e, s !== 0);
|
|
346
|
+
if (n || t.length > 0) {
|
|
347
|
+
let e = n && !this.manual ? a(this, "table.rowsShown", {
|
|
348
|
+
shown: s,
|
|
349
|
+
total: c
|
|
350
|
+
}) : a(this, "table.rows", { count: s });
|
|
351
|
+
this.#b === null ? this.#b = e : e !== this.#b && (this.#b = e, this.#ge(e));
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
#q(e, t) {
|
|
355
|
+
e.hidden !== t && (e.hidden = t);
|
|
356
|
+
}
|
|
357
|
+
#J(e, t, n) {
|
|
358
|
+
let r = Array.from(e.querySelectorAll(":scope > tbody > tr, :scope > tr")).filter((e) => e !== t), i = this.#r, a = !this.manual && this.#n !== null && i.size === r.length && r.every((e) => i.has(e)), o = this.selectable === null ? -2 : n.findIndex((e) => e.th.getAttribute("data-stack") === "select"), s = /* @__PURE__ */ new Map(), c = r.map((e, t) => {
|
|
359
|
+
let n = a ? i.get(e).orig : t, r = null;
|
|
360
|
+
o !== -2 && (r = (o >= 0 ? T(e)[o] : e)?.querySelector(u) ?? null);
|
|
361
|
+
let c = {
|
|
362
|
+
el: e,
|
|
363
|
+
value: e.getAttribute("data-value") ?? String(n),
|
|
364
|
+
orig: n,
|
|
365
|
+
cells: null,
|
|
366
|
+
hay: null,
|
|
367
|
+
haySig: "\0",
|
|
368
|
+
key: null,
|
|
369
|
+
keyCol: -1,
|
|
370
|
+
box: r
|
|
371
|
+
};
|
|
372
|
+
return s.set(e, c), c;
|
|
373
|
+
});
|
|
374
|
+
if (this.#i = [...c], a && c.sort((e, t) => e.orig - t.orig), this.#r = s, this.#n = c, this.#c = !1, this.#d = "", this.#p = "", this.#l = !0, this.#t = null, !c.length) return;
|
|
375
|
+
let l = !1;
|
|
376
|
+
if (!this.#m && this.selectable !== null && (this.#m = !0, !this.#e.size && !this.hasAttribute("value"))) for (let e of c) (e.box && d(e.box) || e.el.getAttribute("aria-selected") === "true") && (this.#e.add(e.value), l = !0);
|
|
377
|
+
let f = new Set(c.map((e) => e.value));
|
|
378
|
+
for (let e of this.#e) f.has(e) || (this.#e.delete(e), l = !0);
|
|
379
|
+
if (this.selectable === "single" && this.#e.size > 1) {
|
|
380
|
+
let e = c.find((e) => this.#e.has(e.value));
|
|
381
|
+
this.#e = new Set([e.value]), l = !0;
|
|
382
|
+
}
|
|
383
|
+
l && (this.#t = null, this.requestUpdate("value", void 0));
|
|
384
|
+
}
|
|
385
|
+
#Y(e, t, n) {
|
|
386
|
+
let r = T(e.el)[t];
|
|
387
|
+
if (!r) return null;
|
|
388
|
+
let a = r.getAttribute("data-sort-value"), o = (a ?? r.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
389
|
+
if (o === "") return null;
|
|
390
|
+
if (n === "number") {
|
|
391
|
+
let e = a !== null && !Number.isNaN(Number(o)) ? Number(o) : _(o, i(this));
|
|
392
|
+
return Number.isNaN(e) ? null : e;
|
|
393
|
+
}
|
|
394
|
+
if (n === "date") {
|
|
395
|
+
let e = Date.parse(o);
|
|
396
|
+
return Number.isNaN(e) ? null : e;
|
|
397
|
+
}
|
|
398
|
+
return o;
|
|
399
|
+
}
|
|
400
|
+
#X(e, t) {
|
|
401
|
+
let n = this.sort === null ? -1 : t.findIndex((e) => e.key === this.sort), r = this.sortDirection === "descending" ? "descending" : "ascending", a = n < 0 ? "none" : `${n}|${r}`;
|
|
402
|
+
if (a === this.#d) return;
|
|
403
|
+
this.#d = a;
|
|
404
|
+
let o = e;
|
|
405
|
+
if (n >= 0) {
|
|
406
|
+
let a = t[n].type ?? "text", s = i(this), c = b(s), l = this.#f !== s;
|
|
407
|
+
this.#f = s;
|
|
408
|
+
for (let t of e) (l || t.keyCol !== n) && (t.key = this.#Y(t, n, a), t.keyCol = n);
|
|
409
|
+
let u = r === "ascending" ? 1 : -1;
|
|
410
|
+
o = [...e].sort((e, t) => {
|
|
411
|
+
let n = e.key, r = t.key;
|
|
412
|
+
return n === null || r === null ? n === r ? 0 : n === null ? 1 : -1 : (a === "text" ? c.compare(n, r) : n - r) * u;
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
this.#Z(o);
|
|
416
|
+
}
|
|
417
|
+
#Z(e) {
|
|
418
|
+
let t = this.#i;
|
|
419
|
+
if (e.length === t.length && e.every((e, n) => e === t[n])) return;
|
|
420
|
+
let n = this.ownerDocument.activeElement, r = n && this.contains(n) ? n : null, i = /* @__PURE__ */ new Map();
|
|
421
|
+
for (let t of e) {
|
|
422
|
+
let e = t.el.parentNode;
|
|
423
|
+
if (!e) continue;
|
|
424
|
+
let n = i.get(e);
|
|
425
|
+
n ? n.push(t) : i.set(e, [t]);
|
|
426
|
+
}
|
|
427
|
+
for (let [e, t] of i) {
|
|
428
|
+
let n = e, r = !1;
|
|
429
|
+
if (typeof n.moveBefore == "function") try {
|
|
430
|
+
for (let e of t) n.moveBefore(e.el, null);
|
|
431
|
+
r = !0;
|
|
432
|
+
} catch {
|
|
433
|
+
r = !1;
|
|
434
|
+
}
|
|
435
|
+
if (!r) {
|
|
436
|
+
let n = this.ownerDocument.createDocumentFragment();
|
|
437
|
+
for (let e of t) n.appendChild(e.el);
|
|
438
|
+
e.appendChild(n);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
this.#i = e, r && r.isConnected && this.ownerDocument.activeElement !== r && r.focus({ preventScroll: !0 });
|
|
442
|
+
}
|
|
443
|
+
#Q(e, t) {
|
|
444
|
+
if (this.manual) return {
|
|
445
|
+
shown: e.length,
|
|
446
|
+
total: e.length
|
|
447
|
+
};
|
|
448
|
+
let n = m(this.filter ?? "").split(/\s+/).filter(Boolean), r = (this.filterColumns ?? "").split(/[\s,]+/).filter(Boolean).map((e) => t.findIndex((t) => t.key === e)).filter((e) => e >= 0), i = r.join(","), a = `${n.join(" ")}|${i}`;
|
|
449
|
+
if (a === this.#p && !this.#u) return this.#C;
|
|
450
|
+
let o = 0, s = 0;
|
|
451
|
+
for (let a of e) {
|
|
452
|
+
let e = a.el;
|
|
453
|
+
if (e.hidden && !this.#_.has(e)) continue;
|
|
454
|
+
s++;
|
|
455
|
+
let c = !0;
|
|
456
|
+
if (n.length) {
|
|
457
|
+
a.cells ??= T(e).map((e) => m(e.textContent ?? "")), a.haySig !== i && (a.hay = (r.length ? r.map((e) => a.cells[e] ?? "") : a.cells.filter((e, n) => !t[n]?.skip)).join(" "), a.haySig = i);
|
|
458
|
+
let o = a.hay;
|
|
459
|
+
for (let e of n) if (!o.includes(e)) {
|
|
460
|
+
c = !1;
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
c && o++, e.hidden === c && (e.hidden = !c), c ? this.#_.delete(e) : this.#_.add(e);
|
|
465
|
+
}
|
|
466
|
+
return a !== this.#p && (this.#l = !0), this.#p = a, this.#u = !1, {
|
|
467
|
+
shown: o,
|
|
468
|
+
total: s
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
#$(e) {
|
|
472
|
+
return e.el.hasAttribute("data-disabled") || e.box !== null && f(e.box);
|
|
473
|
+
}
|
|
474
|
+
#ee() {
|
|
475
|
+
return this.#i.filter((e) => !e.el.hidden && !this.#$(e));
|
|
476
|
+
}
|
|
477
|
+
#te() {
|
|
478
|
+
return this.#a?.querySelector(u) ?? null;
|
|
479
|
+
}
|
|
480
|
+
#ne() {
|
|
481
|
+
this.#l = !1;
|
|
482
|
+
let e = this.#n;
|
|
483
|
+
if (!e || this.selectable === null) return;
|
|
484
|
+
let t = this.#e;
|
|
485
|
+
for (let n of e) {
|
|
486
|
+
let e = t.has(n.value);
|
|
487
|
+
n.box && p(n.box, e);
|
|
488
|
+
let r = e ? "true" : "false";
|
|
489
|
+
n.el.getAttribute("aria-selected") !== r && n.el.setAttribute("aria-selected", r);
|
|
490
|
+
}
|
|
491
|
+
let n = this.#ee(), r = 0;
|
|
492
|
+
for (let e of n) t.has(e.value) && r++;
|
|
493
|
+
let o = n.length > 0 && r === n.length, s = this.selectable === "single" ? null : this.#te();
|
|
494
|
+
if (s) {
|
|
495
|
+
p(s, o, !o && r > 0);
|
|
496
|
+
let e = this.filter?.trim() ? a(this, "table.selectAllShown", { count: n.length }) : a(this, "table.selectAll"), t = s.getAttribute("aria-label"), i = this.#v.get(s);
|
|
497
|
+
s.hasAttribute("aria-labelledby") || t !== null && t !== i || (t !== e && s.setAttribute("aria-label", e), this.#v.set(s, e));
|
|
498
|
+
}
|
|
499
|
+
let c = this.value.length, l = this.allSelected && this.totalRows !== null ? this.totalRows : c, u = this.selectable !== "single", d = v(l, i(this));
|
|
500
|
+
for (let e of this.getElementsByTagName("void-table-selection")) if (this.#G(e)) {
|
|
501
|
+
this.#q(e, l === 0);
|
|
502
|
+
for (let t of e.querySelectorAll("[data-count]")) t.textContent !== d && (t.textContent = d);
|
|
503
|
+
}
|
|
504
|
+
for (let t of this.getElementsByTagName("void-table-select-all")) this.#G(t) && this.#q(t, !(u && this.totalRows !== null && this.totalRows > e.length && o && !this.allSelected));
|
|
505
|
+
}
|
|
506
|
+
#re() {
|
|
507
|
+
this.allSelected &&= !1, this.#t = null, this.requestUpdate("value", void 0), this.#ne();
|
|
508
|
+
let e = this.value;
|
|
509
|
+
this.#ge(e.length ? a(this, "table.selected", { count: e.length }) : a(this, "table.noneSelected")), this.#w?.takeRecords(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
510
|
+
bubbles: !0,
|
|
511
|
+
composed: !0,
|
|
512
|
+
detail: {
|
|
513
|
+
value: e,
|
|
514
|
+
all: !1
|
|
515
|
+
}
|
|
516
|
+
}));
|
|
517
|
+
}
|
|
518
|
+
#ie(e) {
|
|
519
|
+
for (let t of this.#ee()) e ? this.#e.add(t.value) : this.#e.delete(t.value);
|
|
520
|
+
this.#h = null, this.#re();
|
|
521
|
+
}
|
|
522
|
+
#ae(e) {
|
|
523
|
+
let t = e.closest("tr");
|
|
524
|
+
if (!t || !this.#n || t.closest("table") !== this.#o || !this.#G(t)) return !1;
|
|
525
|
+
if (t === this.#a) return this.#te() === e ? this.selectable === "single" ? (this.#l = !0, this.#ne(), !0) : (this.#ie(d(e)), !0) : !1;
|
|
526
|
+
let n = this.#r.get(t);
|
|
527
|
+
if (!n || n.box !== e) return !1;
|
|
528
|
+
let r = d(e), i = this.#g;
|
|
529
|
+
if (this.#g = !1, this.selectable === "single") this.#e = new Set(r ? [n.value] : []);
|
|
530
|
+
else {
|
|
531
|
+
let e = [n];
|
|
532
|
+
if (i && this.#h !== null && this.#h !== n.value) {
|
|
533
|
+
let t = this.#i.filter((e) => !e.el.hidden), r = t.findIndex((e) => e.value === this.#h), i = t.indexOf(n);
|
|
534
|
+
r >= 0 && i >= 0 && (e = t.slice(Math.min(r, i), Math.max(r, i) + 1).filter((e) => e === n || !this.#$(e)));
|
|
535
|
+
}
|
|
536
|
+
for (let t of e) r ? this.#e.add(t.value) : this.#e.delete(t.value);
|
|
537
|
+
}
|
|
538
|
+
return this.#h = n.value, this.#re(), !0;
|
|
539
|
+
}
|
|
540
|
+
#oe() {
|
|
541
|
+
this.allSelected || this.totalRows === null || (this.allSelected = !0, this.#ne(), this.#ge(a(this, "table.allSelected", { count: this.totalRows })), this.#w?.takeRecords(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
542
|
+
bubbles: !0,
|
|
543
|
+
composed: !0,
|
|
544
|
+
detail: {
|
|
545
|
+
value: this.value,
|
|
546
|
+
all: !0
|
|
547
|
+
}
|
|
548
|
+
})));
|
|
549
|
+
}
|
|
550
|
+
#se;
|
|
551
|
+
#ce;
|
|
552
|
+
#le(e) {
|
|
553
|
+
let t = e.parentElement, n = e.getAttribute("data-key") ?? String(t ? T(t).indexOf(e) : 0), r = this.sort === n ? this.sortDirection === "descending" ? "descending" : "ascending" : "none", i = r === "none" ? "ascending" : r === "ascending" ? "descending" : "none", o = new CustomEvent("void-sort", {
|
|
554
|
+
bubbles: !0,
|
|
555
|
+
composed: !0,
|
|
556
|
+
cancelable: !0,
|
|
557
|
+
detail: {
|
|
558
|
+
column: n,
|
|
559
|
+
direction: i
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
if (!this.dispatchEvent(o)) return;
|
|
563
|
+
this.sort = i === "none" ? null : n, this.sortDirection = i === "none" ? null : i;
|
|
564
|
+
let s = (e.getAttribute("data-label") ?? e.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
565
|
+
this.#ge(i === "none" ? a(this, "table.sortCleared", { column: s }) : a(this, i === "ascending" ? "table.sortedAscending" : "table.sortedDescending", { column: s }));
|
|
566
|
+
}
|
|
567
|
+
#ue;
|
|
568
|
+
#de;
|
|
569
|
+
#fe() {
|
|
570
|
+
return this.getElementsByTagName("void-table-filter")[0]?.querySelector("input") ?? null;
|
|
571
|
+
}
|
|
572
|
+
#pe;
|
|
573
|
+
#me;
|
|
574
|
+
#he() {
|
|
575
|
+
let e = this.#y;
|
|
576
|
+
return (!e || e.parentNode !== this) && (e = this.ownerDocument.createElement("span"), e.setAttribute("data-void-announcer", "table"), e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.setAttribute("aria-atomic", "true"), this.append(e), this.#y = e), e;
|
|
577
|
+
}
|
|
578
|
+
#ge(e) {
|
|
579
|
+
let t = this.#he();
|
|
580
|
+
t.textContent = t.textContent === e ? `${e} ` : e;
|
|
581
|
+
}
|
|
582
|
+
get #_e() {
|
|
128
583
|
return this.scrollable && this.scrollWidth > this.clientWidth + 1;
|
|
129
584
|
}
|
|
130
|
-
#
|
|
131
|
-
let e = this.#
|
|
585
|
+
#ve() {
|
|
586
|
+
let e = this.#_e;
|
|
132
587
|
if (this.setHostAttribute("data-overflowing", e ? "" : null), !e) {
|
|
133
|
-
this.#
|
|
588
|
+
this.#ye(), this.setHostAttribute("data-overflow-start", null), this.setHostAttribute("data-overflow-end", null);
|
|
134
589
|
return;
|
|
135
590
|
}
|
|
136
|
-
let t = this.getAttribute("aria-label"), n = t !== null && t !== this.#
|
|
137
|
-
!r && !n && !this.hasAttribute("aria-labelledby") && !this.#
|
|
591
|
+
let t = this.getAttribute("aria-label"), n = t !== null && t !== this.#M, r = this.label || (n || this.hasAttribute("aria-labelledby") ? "" : (this.querySelector("caption")?.textContent ?? "").replace(/\s+/g, " ").trim());
|
|
592
|
+
!r && !n && !this.hasAttribute("aria-labelledby") && !this.#N && (this.#N = !0, console.warn("<void-table scrollable>: the scroll region has no accessible name. Set label, aria-label or add a <caption>.", this)), this.setHostAttribute("tabindex", "0"), (!this.hasAttribute("role") || this.getAttribute("role") === "region") && this.setHostAttribute("role", "region"), r && !n && (this.setHostAttribute("aria-label", r), this.#M = r), this.#be();
|
|
138
593
|
}
|
|
139
|
-
#
|
|
140
|
-
this.setHostAttribute("tabindex", null), this.getAttribute("role") === "region" && this.setHostAttribute("role", null), this.#
|
|
594
|
+
#ye() {
|
|
595
|
+
this.setHostAttribute("tabindex", null), this.getAttribute("role") === "region" && this.setHostAttribute("role", null), this.#M !== null && (this.getAttribute("aria-label") === this.#M && this.setHostAttribute("aria-label", null), this.#M = null);
|
|
141
596
|
}
|
|
142
|
-
#
|
|
143
|
-
if (!this.#
|
|
597
|
+
#be() {
|
|
598
|
+
if (!this.#_e) return;
|
|
144
599
|
let e = this.scrollWidth - this.clientWidth, t = Math.abs(this.scrollLeft);
|
|
145
600
|
this.setHostAttribute("data-overflow-start", t > 1 ? "" : null), this.setHostAttribute("data-overflow-end", t < e - 1 ? "" : null);
|
|
146
601
|
}
|
|
147
602
|
};
|
|
148
|
-
t([
|
|
603
|
+
t([c({
|
|
149
604
|
type: Boolean,
|
|
150
605
|
reflect: !0
|
|
151
|
-
})],
|
|
606
|
+
})], D.prototype, "striped", void 0), t([c({
|
|
152
607
|
type: Boolean,
|
|
153
608
|
reflect: !0
|
|
154
|
-
})],
|
|
609
|
+
})], D.prototype, "hoverable", void 0), t([c({
|
|
155
610
|
type: Boolean,
|
|
156
611
|
reflect: !0
|
|
157
|
-
})],
|
|
612
|
+
})], D.prototype, "compact", void 0), t([c({
|
|
158
613
|
type: Boolean,
|
|
159
614
|
reflect: !0
|
|
160
|
-
})],
|
|
615
|
+
})], D.prototype, "bordered", void 0), t([c({
|
|
161
616
|
type: Boolean,
|
|
162
617
|
reflect: !0
|
|
163
|
-
})],
|
|
618
|
+
})], D.prototype, "inset", void 0), t([c({
|
|
164
619
|
type: String,
|
|
165
620
|
reflect: !0
|
|
166
|
-
})],
|
|
621
|
+
})], D.prototype, "stack", void 0), t([c({
|
|
167
622
|
type: Boolean,
|
|
168
623
|
reflect: !0
|
|
169
|
-
})],
|
|
624
|
+
})], D.prototype, "scrollable", void 0), t([c({
|
|
170
625
|
type: Boolean,
|
|
171
626
|
reflect: !0,
|
|
172
627
|
attribute: "sticky-header"
|
|
173
|
-
})],
|
|
628
|
+
})], D.prototype, "stickyHeader", void 0), t([c({
|
|
174
629
|
type: Boolean,
|
|
175
630
|
reflect: !0,
|
|
176
631
|
attribute: "sticky-column"
|
|
177
|
-
})],
|
|
632
|
+
})], D.prototype, "stickyColumn", void 0), t([c({
|
|
178
633
|
type: String,
|
|
179
634
|
reflect: !0,
|
|
180
635
|
attribute: "max-height"
|
|
181
|
-
})],
|
|
636
|
+
})], D.prototype, "maxHeight", void 0), t([c({
|
|
637
|
+
type: String,
|
|
638
|
+
reflect: !0
|
|
639
|
+
})], D.prototype, "label", void 0), t([c({
|
|
640
|
+
type: String,
|
|
641
|
+
reflect: !0
|
|
642
|
+
})], D.prototype, "sort", void 0), t([c({
|
|
643
|
+
type: String,
|
|
644
|
+
reflect: !0,
|
|
645
|
+
attribute: "sort-direction"
|
|
646
|
+
})], D.prototype, "sortDirection", void 0), t([c({
|
|
182
647
|
type: String,
|
|
183
648
|
reflect: !0
|
|
184
|
-
})],
|
|
649
|
+
})], D.prototype, "filter", void 0), t([c({
|
|
650
|
+
type: String,
|
|
651
|
+
reflect: !0,
|
|
652
|
+
attribute: "filter-columns"
|
|
653
|
+
})], D.prototype, "filterColumns", void 0), t([c({
|
|
654
|
+
type: String,
|
|
655
|
+
reflect: !0
|
|
656
|
+
})], D.prototype, "selectable", void 0), t([c({
|
|
657
|
+
type: Boolean,
|
|
658
|
+
reflect: !0
|
|
659
|
+
})], D.prototype, "manual", void 0), t([c({
|
|
660
|
+
type: Number,
|
|
661
|
+
reflect: !0,
|
|
662
|
+
attribute: "total-rows"
|
|
663
|
+
})], D.prototype, "totalRows", void 0), t([c({
|
|
664
|
+
type: Boolean,
|
|
665
|
+
reflect: !0,
|
|
666
|
+
attribute: "all-selected"
|
|
667
|
+
})], D.prototype, "allSelected", void 0), t([c({
|
|
668
|
+
attribute: "keys",
|
|
669
|
+
converter: r
|
|
670
|
+
})], D.prototype, "keys", void 0), t([c({
|
|
671
|
+
converter: l,
|
|
672
|
+
reflect: !0
|
|
673
|
+
})], D.prototype, "value", null), customElements.get("void-table") || customElements.define("void-table", D);
|
|
185
674
|
//#endregion
|
|
186
|
-
export {
|
|
675
|
+
export { D as VoidTable };
|