react-gridix 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -2
- package/dist/index.d.ts +14 -0
- package/dist/react-gridix.cjs +4 -4
- package/dist/react-gridix.js +273 -267
- package/package.json +2 -2
package/dist/react-gridix.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as I, jsx as h, Fragment as ht } from "react/jsx-runtime";
|
|
2
|
-
import { useState as j, useRef as W, useEffect as ne, useMemo as ve, useCallback as Te, useLayoutEffect as
|
|
3
|
-
import { createPortal as
|
|
2
|
+
import { useState as j, useRef as W, useEffect as ne, useMemo as ve, useCallback as Te, useLayoutEffect as ki, createElement as Pe, useId as Si } from "react";
|
|
3
|
+
import { createPortal as Ni } from "react-dom";
|
|
4
4
|
const Et = (...t) => t.filter(Boolean).join(" ");
|
|
5
|
-
function
|
|
5
|
+
function Ci() {
|
|
6
6
|
return /* @__PURE__ */ h("svg", { viewBox: "0 0 16 16", width: "100%", height: "100%", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ h(
|
|
7
7
|
"path",
|
|
8
8
|
{
|
|
@@ -15,7 +15,7 @@ function Ni() {
|
|
|
15
15
|
}
|
|
16
16
|
) });
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function Di() {
|
|
19
19
|
return /* @__PURE__ */ h("svg", { viewBox: "0 0 16 16", width: "100%", height: "100%", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ h("path", { d: "M4 8h8", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round" }) });
|
|
20
20
|
}
|
|
21
21
|
function ft({
|
|
@@ -91,7 +91,7 @@ function ft({
|
|
|
91
91
|
style: p.indicator,
|
|
92
92
|
"data-state": k,
|
|
93
93
|
"aria-hidden": "true",
|
|
94
|
-
children: i ? o === "tick" ? /* @__PURE__ */ h(
|
|
94
|
+
children: i ? o === "tick" ? /* @__PURE__ */ h(Di, {}) : null : x !== void 0 ? x : o === "tick" ? /* @__PURE__ */ h(Ci, {}) : null
|
|
95
95
|
}
|
|
96
96
|
)
|
|
97
97
|
}
|
|
@@ -101,9 +101,9 @@ function ft({
|
|
|
101
101
|
}
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
|
-
const
|
|
104
|
+
const Ti = /^(\d{4})-(\d{2})-(\d{2})$/, Hr = (t) => String(t).padStart(2, "0");
|
|
105
105
|
function le(t) {
|
|
106
|
-
const n =
|
|
106
|
+
const n = Ti.exec(t);
|
|
107
107
|
if (!n) return null;
|
|
108
108
|
const [i, o, f] = [Number(n[1]), Number(n[2]), Number(n[3])], d = new Date(i, o - 1, f);
|
|
109
109
|
return d.getFullYear() === i && d.getMonth() === o - 1 && d.getDate() === f ? d : null;
|
|
@@ -123,11 +123,11 @@ function pe(t) {
|
|
|
123
123
|
}
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function Fi(t, n, i) {
|
|
127
127
|
const o = pe(t);
|
|
128
128
|
return o ? le(o).toLocaleDateString(n, i ?? { year: "numeric", month: "short", day: "numeric" }) : t == null ? "" : String(t);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Ei(t, n) {
|
|
131
131
|
var i;
|
|
132
132
|
return t === "" ? null : n instanceof Date ? le(t) : typeof n == "number" ? ((i = le(t)) == null ? void 0 : i.getTime()) ?? null : t;
|
|
133
133
|
}
|
|
@@ -150,7 +150,7 @@ function go({ value: t, range: n, min: i, max: o, onPick: f, locale: d, weekStar
|
|
|
150
150
|
const G = t !== _.value ? t : (n == null ? void 0 : n.from) !== _.from ? n == null ? void 0 : n.from : (n == null ? void 0 : n.to) !== _.to ? n == null ? void 0 : n.to : void 0, S = G ? le(G) : null;
|
|
151
151
|
S && b((B) => B.getFullYear() === S.getFullYear() && B.getMonth() === S.getMonth() ? B : new Date(S.getFullYear(), S.getMonth(), 1));
|
|
152
152
|
}, [t, n == null ? void 0 : n.from, n == null ? void 0 : n.to]);
|
|
153
|
-
const C = pe(/* @__PURE__ */ new Date()), F = E.getFullYear(), w = E.getMonth(),
|
|
153
|
+
const C = pe(/* @__PURE__ */ new Date()), F = E.getFullYear(), w = E.getMonth(), O = ve(() => {
|
|
154
154
|
const _ = new Intl.DateTimeFormat(d, { weekday: "short" });
|
|
155
155
|
return Array.from({ length: 7 }, (G, S) => _.format(new Date(2023, 0, 1 + (S + a) % 7)));
|
|
156
156
|
}, [d, a]), H = new Intl.DateTimeFormat(d, { month: "long", year: "numeric" }).format(E), q = ve(() => {
|
|
@@ -165,7 +165,7 @@ function go({ value: t, range: n, min: i, max: o, onPick: f, locale: d, weekStar
|
|
|
165
165
|
var S, B;
|
|
166
166
|
return (B = (S = k.current) == null ? void 0 : S.querySelector(`[data-iso="${_}"]`)) == null ? void 0 : B.focus();
|
|
167
167
|
}));
|
|
168
|
-
},
|
|
168
|
+
}, Le = (_, G) => {
|
|
169
169
|
const S = le(G), B = (ce) => {
|
|
170
170
|
_.preventDefault(), ke(zn(S.getFullYear(), S.getMonth(), S.getDate() + ce));
|
|
171
171
|
};
|
|
@@ -207,7 +207,7 @@ function go({ value: t, range: n, min: i, max: o, onPick: f, locale: d, weekStar
|
|
|
207
207
|
/* @__PURE__ */ h("button", { type: "button", className: "rg-cal__nav", "aria-label": "Next year", onClick: () => V(12), children: "»" })
|
|
208
208
|
] }),
|
|
209
209
|
/* @__PURE__ */ I("div", { className: "rg-cal__grid", ref: k, children: [
|
|
210
|
-
|
|
210
|
+
O.map((_) => /* @__PURE__ */ h("span", { className: "rg-cal__dow", "aria-hidden": "true", children: _.slice(0, 2) }, _)),
|
|
211
211
|
q.map(({ iso: _, day: G, outside: S }) => {
|
|
212
212
|
const B = _ === t, ce = _ === Y, ge = _ === se, qe = !!Y && !!se && _ > Y && _ < se;
|
|
213
213
|
return /* @__PURE__ */ h(
|
|
@@ -229,7 +229,7 @@ function go({ value: t, range: n, min: i, max: o, onPick: f, locale: d, weekStar
|
|
|
229
229
|
Y && se && ge && Y !== se && "rg-cal__day--range-end"
|
|
230
230
|
),
|
|
231
231
|
onClick: () => f(_),
|
|
232
|
-
onKeyDown: (rt) =>
|
|
232
|
+
onKeyDown: (rt) => Le(rt, _),
|
|
233
233
|
onFocus: () => p(_),
|
|
234
234
|
children: G
|
|
235
235
|
},
|
|
@@ -256,7 +256,7 @@ function go({ value: t, range: n, min: i, max: o, onPick: f, locale: d, weekStar
|
|
|
256
256
|
}
|
|
257
257
|
);
|
|
258
258
|
}
|
|
259
|
-
const Pt = typeof window < "u" ?
|
|
259
|
+
const Pt = typeof window < "u" ? ki : ne;
|
|
260
260
|
function It(t, n, i) {
|
|
261
261
|
const [o, f] = j(n), d = t !== void 0, a = d ? t : o, g = Te(
|
|
262
262
|
(m) => {
|
|
@@ -310,7 +310,7 @@ function kn({ anchorRef: t, open: n, onClose: i, label: o, theme: f, className:
|
|
|
310
310
|
return document.addEventListener("mousedown", p), document.addEventListener("keydown", k), window.addEventListener("resize", v), window.addEventListener("scroll", v, !0), () => {
|
|
311
311
|
document.removeEventListener("mousedown", p), document.removeEventListener("keydown", k), window.removeEventListener("resize", v), window.removeEventListener("scroll", v, !0);
|
|
312
312
|
};
|
|
313
|
-
}, [n, i, v, t]), !n || typeof document > "u" ? null :
|
|
313
|
+
}, [n, i, v, t]), !n || typeof document > "u" ? null : Ni(
|
|
314
314
|
/* @__PURE__ */ h(
|
|
315
315
|
"div",
|
|
316
316
|
{
|
|
@@ -327,7 +327,7 @@ function kn({ anchorRef: t, open: n, onClose: i, label: o, theme: f, className:
|
|
|
327
327
|
document.body
|
|
328
328
|
);
|
|
329
329
|
}
|
|
330
|
-
function
|
|
330
|
+
function Ii({ value: t, onChange: n, onPick: i, onBlur: o, onKeyDown: f, min: d, max: a, locale: g, invalid: m, label: x, theme: E, className: b, style: v }) {
|
|
331
331
|
const p = W(null);
|
|
332
332
|
return /* @__PURE__ */ I(ht, { children: [
|
|
333
333
|
/* @__PURE__ */ h(
|
|
@@ -352,7 +352,7 @@ function Ei({ value: t, onChange: n, onPick: i, onBlur: o, onKeyDown: f, min: d,
|
|
|
352
352
|
const C = D.ctrlKey || D.altKey || D.metaKey, F = D.key === "ArrowUp" ? { days: -7, months: 0 } : D.key === "ArrowDown" ? { days: 7, months: 0 } : C && D.key === "ArrowLeft" ? { days: -1, months: 0 } : C && D.key === "ArrowRight" ? { days: 1, months: 0 } : D.key === "PageUp" ? { days: 0, months: -1 } : D.key === "PageDown" ? { days: 0, months: 1 } : null;
|
|
353
353
|
if (!F || D.shiftKey) return f(D);
|
|
354
354
|
D.preventDefault();
|
|
355
|
-
const w = le(t) ?? /* @__PURE__ */ new Date(),
|
|
355
|
+
const w = le(t) ?? /* @__PURE__ */ new Date(), O = new Date(w.getFullYear(), w.getMonth() + F.months + 1, 0).getDate(), H = new Date(w.getFullYear(), w.getMonth() + F.months, Math.min(w.getDate(), O) + F.days);
|
|
356
356
|
let q = pe(H);
|
|
357
357
|
d && q < d && (q = d), a && q > a && (q = a), n(q);
|
|
358
358
|
},
|
|
@@ -366,7 +366,7 @@ function Ei({ value: t, onChange: n, onPick: i, onBlur: o, onKeyDown: f, min: d,
|
|
|
366
366
|
function Jr(t) {
|
|
367
367
|
return t.filterType ? t.filterType : t.type === "number" ? "number" : t.type === "date" ? "date" : t.type === "boolean" ? "select" : "text";
|
|
368
368
|
}
|
|
369
|
-
const
|
|
369
|
+
const Zr = [
|
|
370
370
|
"contains",
|
|
371
371
|
"notContains",
|
|
372
372
|
"equals",
|
|
@@ -375,7 +375,7 @@ const Qr = [
|
|
|
375
375
|
"notStartsWith",
|
|
376
376
|
"endsWith",
|
|
377
377
|
"notEndsWith"
|
|
378
|
-
],
|
|
378
|
+
], Qr = {
|
|
379
379
|
contains: "Contains",
|
|
380
380
|
notContains: "Does not contain",
|
|
381
381
|
equals: "Equals",
|
|
@@ -388,11 +388,11 @@ const Qr = [
|
|
|
388
388
|
function bo(t) {
|
|
389
389
|
const n = t.filterOperators;
|
|
390
390
|
if (!n) return null;
|
|
391
|
-
if (n === !0) return
|
|
392
|
-
const i =
|
|
391
|
+
if (n === !0) return Zr;
|
|
392
|
+
const i = Zr.filter((o) => n.includes(o));
|
|
393
393
|
return i.length > 0 ? i : null;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function Mi(t, n) {
|
|
396
396
|
const i = bo(t), o = t.filterOperator ?? (n === "exact" ? "equals" : "contains");
|
|
397
397
|
return i && !i.includes(o) ? i[0] : o;
|
|
398
398
|
}
|
|
@@ -428,7 +428,7 @@ function xo(t) {
|
|
|
428
428
|
}
|
|
429
429
|
return !1;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function $i(t, n, i, o) {
|
|
432
432
|
switch (t) {
|
|
433
433
|
case "text":
|
|
434
434
|
case "exact": {
|
|
@@ -450,7 +450,7 @@ function Mi(t, n, i, o) {
|
|
|
450
450
|
return n.includes(String(o ?? ""));
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function Pi(t, n, i, o) {
|
|
454
454
|
if (t.filterOptions) return t.filterOptions.map((d) => typeof d == "string" ? { value: d, label: d } : d);
|
|
455
455
|
if (t.type === "boolean")
|
|
456
456
|
return [
|
|
@@ -471,7 +471,7 @@ const to = (t) => {
|
|
|
471
471
|
const n = Number(t);
|
|
472
472
|
return Number.isFinite(n) ? n : void 0;
|
|
473
473
|
}, Jn = (t) => typeof t == "object" && t !== null && !Array.isArray(t);
|
|
474
|
-
function
|
|
474
|
+
function Li({
|
|
475
475
|
value: t,
|
|
476
476
|
onChange: n,
|
|
477
477
|
label: i,
|
|
@@ -523,7 +523,7 @@ function Pi({
|
|
|
523
523
|
] })
|
|
524
524
|
] });
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function Oi({
|
|
527
527
|
value: t,
|
|
528
528
|
onChange: n,
|
|
529
529
|
onEnter: i,
|
|
@@ -558,7 +558,7 @@ function Li({
|
|
|
558
558
|
}
|
|
559
559
|
);
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function Ri({
|
|
562
562
|
value: t,
|
|
563
563
|
onChange: n,
|
|
564
564
|
label: i,
|
|
@@ -574,16 +574,16 @@ function Oi({
|
|
|
574
574
|
}, [m.from, m.to]);
|
|
575
575
|
const k = (F, w) => {
|
|
576
576
|
if ((F === "from" ? b : p)(w), w !== "" && !le(w)) return;
|
|
577
|
-
const
|
|
578
|
-
F === "from" ? x(
|
|
577
|
+
const O = w || void 0;
|
|
578
|
+
F === "from" ? x(O, m.to) : x(m.from, O);
|
|
579
579
|
}, D = (F) => {
|
|
580
580
|
F && (!m.from || m.to ? x(F, void 0) : F < m.from ? x(F, m.from) : x(m.from, F));
|
|
581
|
-
}, C = (F, w,
|
|
581
|
+
}, C = (F, w, O) => /* @__PURE__ */ I("label", { className: "rg-grid__filter-field", children: [
|
|
582
582
|
/* @__PURE__ */ h("span", { children: F === "from" ? "From" : "To" }),
|
|
583
583
|
/* @__PURE__ */ h(
|
|
584
584
|
"input",
|
|
585
585
|
{
|
|
586
|
-
autoFocus:
|
|
586
|
+
autoFocus: O,
|
|
587
587
|
type: "text",
|
|
588
588
|
inputMode: "numeric",
|
|
589
589
|
placeholder: "YYYY-MM-DD",
|
|
@@ -604,7 +604,7 @@ function Oi({
|
|
|
604
604
|
/* @__PURE__ */ h(go, { range: m, min: d, max: a, locale: g, onPick: D, hideFooter: !0 })
|
|
605
605
|
] });
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function Ui({
|
|
608
608
|
value: t,
|
|
609
609
|
onChange: n,
|
|
610
610
|
options: i
|
|
@@ -626,13 +626,13 @@ function Ri({
|
|
|
626
626
|
))
|
|
627
627
|
] });
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Ai({
|
|
630
630
|
value: t,
|
|
631
631
|
options: n,
|
|
632
632
|
onChange: i,
|
|
633
633
|
label: o
|
|
634
634
|
}) {
|
|
635
|
-
const [f, d] = j(!1), [a, g] = j(0), m =
|
|
635
|
+
const [f, d] = j(!1), [a, g] = j(0), m = Si(), x = W(null), E = () => {
|
|
636
636
|
g(Math.max(0, n.indexOf(t))), d(!0);
|
|
637
637
|
}, b = (p) => {
|
|
638
638
|
var k;
|
|
@@ -684,7 +684,7 @@ function Ui({
|
|
|
684
684
|
onBlur: () => d(!1),
|
|
685
685
|
onKeyDown: v,
|
|
686
686
|
children: [
|
|
687
|
-
/* @__PURE__ */ h("span", { className: "rg-op__value", children:
|
|
687
|
+
/* @__PURE__ */ h("span", { className: "rg-op__value", children: Qr[t] }),
|
|
688
688
|
/* @__PURE__ */ h("svg", { className: "rg-op__chevron", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ h("path", { d: "M2.5 4.5 6 8l3.5-3.5" }) })
|
|
689
689
|
]
|
|
690
690
|
}
|
|
@@ -701,7 +701,7 @@ function Ui({
|
|
|
701
701
|
onMouseEnter: () => g(k),
|
|
702
702
|
onClick: () => b(p),
|
|
703
703
|
children: [
|
|
704
|
-
|
|
704
|
+
Qr[p],
|
|
705
705
|
p === t && /* @__PURE__ */ h("svg", { className: "rg-op__check", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ h("path", { d: "M2.5 6.5 5 9l4.5-5.5" }) })
|
|
706
706
|
]
|
|
707
707
|
},
|
|
@@ -709,7 +709,7 @@ function Ui({
|
|
|
709
709
|
)) })
|
|
710
710
|
] });
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function Wi({
|
|
713
713
|
column: t,
|
|
714
714
|
label: n,
|
|
715
715
|
kind: i,
|
|
@@ -725,29 +725,29 @@ function Ai({
|
|
|
725
725
|
inputClassName: v,
|
|
726
726
|
inputStyle: p
|
|
727
727
|
}) {
|
|
728
|
-
const [k, D] = j(!1), C = W(null), F = xo(o), w = Te(() => D(!1), []),
|
|
728
|
+
const [k, D] = j(!1), C = W(null), F = xo(o), w = Te(() => D(!1), []), O = Jn(o) ? o : null, H = typeof o == "string" ? o : typeof (O == null ? void 0 : O.value) == "string" ? O.value : "", q = (i === "text" || i === "exact") && !t.filterRenderer ? bo(t) : null, [A, V] = j(() => Mi(t, i)), ke = O && typeof O.operator == "string" ? O.operator : A, Le = (Y) => {
|
|
729
729
|
if (Y === void 0) return f(void 0);
|
|
730
730
|
f(q ? { operator: ke, value: String(Y) } : Y);
|
|
731
731
|
}, ze = (Y) => {
|
|
732
732
|
V(Y), H.trim() !== "" && f({ operator: Y, value: H });
|
|
733
733
|
}, Fe = () => {
|
|
734
734
|
if (t.filterRenderer)
|
|
735
|
-
return
|
|
735
|
+
return Pe(t.filterRenderer, { column: t, value: H, onChange: (Y) => f(Y || void 0) });
|
|
736
736
|
switch (i) {
|
|
737
737
|
case "number":
|
|
738
|
-
return /* @__PURE__ */ h(
|
|
738
|
+
return /* @__PURE__ */ h(Li, { value: o, onChange: f, label: n, debounce: a, inputClassName: v, inputStyle: p });
|
|
739
739
|
case "date":
|
|
740
|
-
return /* @__PURE__ */ h(
|
|
740
|
+
return /* @__PURE__ */ h(Ri, { value: o, onChange: f, label: n, min: t.dateMin, max: t.dateMax, locale: t.dateLocale, inputClassName: v, inputStyle: p });
|
|
741
741
|
case "select":
|
|
742
|
-
return /* @__PURE__ */ h(
|
|
742
|
+
return /* @__PURE__ */ h(Ui, { value: o, onChange: f, options: d });
|
|
743
743
|
default:
|
|
744
744
|
return /* @__PURE__ */ I("div", { className: "rg-grid__filter-stack", children: [
|
|
745
|
-
q && /* @__PURE__ */ h(
|
|
745
|
+
q && /* @__PURE__ */ h(Ai, { value: ke, options: q, onChange: ze, label: n }),
|
|
746
746
|
/* @__PURE__ */ h(
|
|
747
|
-
|
|
747
|
+
Oi,
|
|
748
748
|
{
|
|
749
749
|
value: H,
|
|
750
|
-
onChange:
|
|
750
|
+
onChange: Le,
|
|
751
751
|
onEnter: () => {
|
|
752
752
|
var Y;
|
|
753
753
|
D(!1), (Y = C.current) == null || Y.focus();
|
|
@@ -784,7 +784,7 @@ function Ai({
|
|
|
784
784
|
Y.stopPropagation(), D((se) => !se);
|
|
785
785
|
},
|
|
786
786
|
onKeyDown: (Y) => Y.stopPropagation(),
|
|
787
|
-
children: t.filterIndicator ?
|
|
787
|
+
children: t.filterIndicator ? Pe(t.filterIndicator, { column: t, active: F, open: k }) : /* @__PURE__ */ h("span", { className: "rg-grid__filter-dot", "aria-hidden": "true" })
|
|
788
788
|
}
|
|
789
789
|
),
|
|
790
790
|
/* @__PURE__ */ I(
|
|
@@ -805,7 +805,7 @@ function Ai({
|
|
|
805
805
|
)
|
|
806
806
|
] });
|
|
807
807
|
}
|
|
808
|
-
function
|
|
808
|
+
function Bi({ columns: t, hidden: n, onToggle: i, theme: o, className: f, style: d }) {
|
|
809
809
|
const [a, g] = j(!1), m = W(null), x = Te(() => g(!1), []), E = t.filter((b) => !n.has(b.field)).length;
|
|
810
810
|
return /* @__PURE__ */ I(ht, { children: [
|
|
811
811
|
/* @__PURE__ */ h(
|
|
@@ -836,14 +836,14 @@ function Wi({ columns: t, hidden: n, onToggle: i, theme: o, className: f, style:
|
|
|
836
836
|
}) }) })
|
|
837
837
|
] });
|
|
838
838
|
}
|
|
839
|
-
const
|
|
840
|
-
function
|
|
839
|
+
const ji = /^[=+\-@\t\r]/;
|
|
840
|
+
function Ki(t, n, i) {
|
|
841
841
|
if (t == null) return "";
|
|
842
842
|
let o = String(t);
|
|
843
|
-
return i && typeof t == "string" &&
|
|
843
|
+
return i && typeof t == "string" && ji.test(o) && !Number.isFinite(Number(o)) && (o = `'${o}`), o.includes(n) || /["\r\n]/.test(o) ? `"${o.replace(/"/g, '""')}"` : o;
|
|
844
844
|
}
|
|
845
|
-
function
|
|
846
|
-
const { delimiter: o = ",", sanitize: f = !0 } = i, d = (a) => a.map((g) =>
|
|
845
|
+
function zi(t, n, i = {}) {
|
|
846
|
+
const { delimiter: o = ",", sanitize: f = !0 } = i, d = (a) => a.map((g) => Ki(g, o, f)).join(o);
|
|
847
847
|
return [d(t), ...n.map(d)].join(`\r
|
|
848
848
|
`);
|
|
849
849
|
}
|
|
@@ -852,7 +852,7 @@ function _n(t, n) {
|
|
|
852
852
|
const i = URL.createObjectURL(t), o = document.createElement("a");
|
|
853
853
|
o.href = i, o.download = n, o.style.display = "none", document.body.appendChild(o), o.click(), o.remove(), setTimeout(() => URL.revokeObjectURL(i), 1e3);
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function qi(t, n) {
|
|
856
856
|
_n(new Blob(["\uFEFF", t], { type: "text/csv;charset=utf-8" }), n);
|
|
857
857
|
}
|
|
858
858
|
const _o = {
|
|
@@ -860,8 +860,8 @@ const _o = {
|
|
|
860
860
|
xlsx: "Excel",
|
|
861
861
|
json: "JSON",
|
|
862
862
|
pdf: "PDF"
|
|
863
|
-
},
|
|
864
|
-
function
|
|
863
|
+
}, Yi = { csv: ".csv", xlsx: ".xlsx", json: ".json", pdf: ".pdf" }, Vi = (t) => `Export ${_o[t]}`;
|
|
864
|
+
function Hi({ formats: t, scopes: n, scope: i, onScopeChange: o, onExport: f, theme: d, className: a, style: g, popupClassName: m }) {
|
|
865
865
|
const [x, E] = j(!1), [b, v] = j(null), p = W(null), k = Te(() => E(!1), []), D = async (C) => {
|
|
866
866
|
var F;
|
|
867
867
|
v(C);
|
|
@@ -922,7 +922,7 @@ function Vi({ formats: t, scopes: n, scope: i, onScopeChange: o, onExport: f, th
|
|
|
922
922
|
onClick: () => D(C),
|
|
923
923
|
children: [
|
|
924
924
|
/* @__PURE__ */ h("span", { children: _o[C] }),
|
|
925
|
-
/* @__PURE__ */ h("span", { className: "rg-export__ext", children: b === C ? "Preparing…" :
|
|
925
|
+
/* @__PURE__ */ h("span", { className: "rg-export__ext", children: b === C ? "Preparing…" : Yi[C] })
|
|
926
926
|
]
|
|
927
927
|
},
|
|
928
928
|
C
|
|
@@ -941,7 +941,7 @@ function he(t) {
|
|
|
941
941
|
return x.length === 3 && (x = x.split("").map((E) => E + E).join("")), [parseInt(x.slice(0, 2), 16), parseInt(x.slice(2, 4), 16), parseInt(x.slice(4, 6), 16)];
|
|
942
942
|
}
|
|
943
943
|
const o = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/i.exec(n);
|
|
944
|
-
if (o) return no([Number(o[1]), Number(o[2]), Number(o[3])],
|
|
944
|
+
if (o) return no([Number(o[1]), Number(o[2]), Number(o[3])], Xi(o[4]));
|
|
945
945
|
if (typeof document > "u" || (_e === void 0 && (_e = document.createElement("canvas").getContext("2d", { willReadFrequently: !0 })), !_e)) return null;
|
|
946
946
|
_e.fillStyle = "#000000", _e.fillStyle = n;
|
|
947
947
|
const f = String(_e.fillStyle);
|
|
@@ -950,13 +950,13 @@ function he(t) {
|
|
|
950
950
|
const [d, a, g, m] = _e.getImageData(0, 0, 1, 1).data;
|
|
951
951
|
return m === 0 ? null : no([d, a, g], m / 255);
|
|
952
952
|
}
|
|
953
|
-
const
|
|
953
|
+
const Xi = (t) => t === void 0 ? 1 : t.endsWith("%") ? parseFloat(t) / 100 : parseFloat(t);
|
|
954
954
|
function no(t, n) {
|
|
955
955
|
if (!(n > 0)) return null;
|
|
956
956
|
const i = Math.min(1, n);
|
|
957
957
|
return t.map((o) => Math.round(Math.min(255, o) * i + 255 * (1 - i)));
|
|
958
958
|
}
|
|
959
|
-
const
|
|
959
|
+
const Gi = ([t, n, i]) => (0.299 * t + 0.587 * n + 0.114 * i) / 255, qn = (t) => Gi(t) > 0.55 ? [31, 41, 55] : [243, 244, 246], Yn = 72 / 96, Lt = "Install them with: npm install jspdf jspdf-autotable (and html2canvas for header / footer elements), then pass them in exportable.pdf.libraries.";
|
|
960
960
|
async function ro(t, n) {
|
|
961
961
|
try {
|
|
962
962
|
return await n();
|
|
@@ -968,7 +968,7 @@ async function ro(t, n) {
|
|
|
968
968
|
function oo(t, n, i) {
|
|
969
969
|
return t.replace(/\{page\}/g, String(n)).replace(/\{pages\}/g, String(i)).replace(/\{date\}/g, (/* @__PURE__ */ new Date()).toLocaleDateString());
|
|
970
970
|
}
|
|
971
|
-
async function
|
|
971
|
+
async function Ji(t) {
|
|
972
972
|
const n = Array.from(t.querySelectorAll("img")).map(
|
|
973
973
|
(i) => i.complete ? Promise.resolve() : new Promise((o) => {
|
|
974
974
|
i.addEventListener("load", () => o(), { once: !0 }), i.addEventListener("error", () => o(), { once: !0 });
|
|
@@ -976,7 +976,7 @@ async function Gi(t) {
|
|
|
976
976
|
);
|
|
977
977
|
await Promise.race([Promise.all(n), new Promise((i) => setTimeout(i, 5e3))]);
|
|
978
978
|
}
|
|
979
|
-
async function
|
|
979
|
+
async function Zi(t, n, i, o, f) {
|
|
980
980
|
const d = i.html2canvas;
|
|
981
981
|
if (typeof d != "function")
|
|
982
982
|
throw new Error(`A PDF header / footer element needs html2canvas. Add it to exportable.pdf.libraries. ${Lt}`);
|
|
@@ -987,7 +987,7 @@ async function Ji(t, n, i, o, f) {
|
|
|
987
987
|
x.style.cssText = `position:fixed;left:-10000px;top:0;width:${Math.round(n / Yn)}px;background:${o};color:${f};font-family:system-ui,sans-serif;font-size:14px;`, document.body.appendChild(x);
|
|
988
988
|
const E = a.createRoot(x);
|
|
989
989
|
try {
|
|
990
|
-
g.flushSync(() => E.render(t)), await
|
|
990
|
+
g.flushSync(() => E.render(t)), await Ji(x), await new Promise((v) => requestAnimationFrame(() => v(void 0)));
|
|
991
991
|
const b = await d(x, { scale: m, backgroundColor: o, useCORS: !0, logging: !1 });
|
|
992
992
|
return { dataUrl: b.toDataURL("image/png"), width: b.width / m * Yn, height: b.height / m * Yn };
|
|
993
993
|
} finally {
|
|
@@ -997,7 +997,7 @@ async function Ji(t, n, i, o, f) {
|
|
|
997
997
|
async function Vn(t, n, i, o, f, d) {
|
|
998
998
|
if (t == null || t === !1 || t === !0 || t === "") return null;
|
|
999
999
|
if (typeof t == "string" || typeof t == "number") return { kind: "text", text: String(t) };
|
|
1000
|
-
const a = await
|
|
1000
|
+
const a = await Zi(t, n, o, f, d), g = Math.min(1, n / a.width, i / a.height);
|
|
1001
1001
|
return { kind: "image", dataUrl: a.dataUrl, width: a.width * g, height: a.height * g };
|
|
1002
1002
|
}
|
|
1003
1003
|
const io = (t) => `rgb(${t[0]},${t[1]},${t[2]})`, lo = ["normal", "bold", "italic", "bolditalic"];
|
|
@@ -1013,8 +1013,8 @@ async function Qi(t, n = {}, i = {}) {
|
|
|
1013
1013
|
try {
|
|
1014
1014
|
o = typeof n.libraries == "function" ? await n.libraries() : n.libraries;
|
|
1015
1015
|
} catch (T) {
|
|
1016
|
-
const
|
|
1017
|
-
throw new Error(`PDF export could not load jspdf / jspdf-autotable (${
|
|
1016
|
+
const Z = T instanceof Error ? T.message : String(T);
|
|
1017
|
+
throw new Error(`PDF export could not load jspdf / jspdf-autotable (${Z}). ${Lt}`);
|
|
1018
1018
|
}
|
|
1019
1019
|
if (!o) throw new Error(`PDF export needs the jspdf and jspdf-autotable libraries. ${Lt}`);
|
|
1020
1020
|
const f = o.jsPDF, d = o.autoTable;
|
|
@@ -1043,33 +1043,33 @@ async function Qi(t, n = {}, i = {}) {
|
|
|
1043
1043
|
margin: n.margin
|
|
1044
1044
|
}),
|
|
1045
1045
|
...ao(n.style ?? {})
|
|
1046
|
-
},
|
|
1046
|
+
}, O = so(w.margin, 36), H = w.fontName ?? "helvetica", q = w.fontSize ?? 9, A = he(w.pageBackground), V = A ? qn(A) : [75, 85, 99], ke = he(w.textColor) ?? V, Le = he(w.titleColor) ?? (A ? qn(A) : [17, 24, 39]), ze = he(w.headColor) ?? [79, 70, 229], Fe = he(w.headTextColor) ?? [255, 255, 255], Y = he(w.bodyTextColor), se = he((it = w.stripeColors) == null ? void 0 : it[0]), Ee = he((lt = w.stripeColors) == null ? void 0 : lt[1]), _ = he(w.bodyColor) ?? se ?? A ?? void 0, G = he(w.borderColor), S = new f({
|
|
1047
1047
|
orientation: b === "auto" ? t.headers.length > 6 ? "landscape" : "portrait" : b,
|
|
1048
1048
|
unit: "pt",
|
|
1049
1049
|
format: v
|
|
1050
1050
|
});
|
|
1051
1051
|
C && await C(S);
|
|
1052
|
-
const B = S.internal.pageSize.getWidth(), ce = S.internal.pageSize.getHeight(), ge = B -
|
|
1052
|
+
const B = S.internal.pageSize.getWidth(), ce = S.internal.pageSize.getHeight(), ge = B - O.left - O.right, qe = 10, rt = 12, Ot = /* @__PURE__ */ new Set(), pt = (T) => {
|
|
1053
1053
|
!A || Ot.has(T) || (Ot.add(T), S.setFillColor(...A), S.rect(0, 0, B, ce, "F"));
|
|
1054
1054
|
};
|
|
1055
1055
|
pt(1);
|
|
1056
1056
|
const Ye = A ? io(A) : "#ffffff", Ve = io(ke), de = await Vn(g, ge, D, o, Ye, Ve), me = await Vn(m, ge, D, o, Ye, Ve);
|
|
1057
1057
|
S.setFont(H, "normal"), S.setFontSize(qe);
|
|
1058
|
-
const gt = (T) => T ? T.kind === "image" ? T.height : S.splitTextToSize(oo(T.text, 99, 99), ge).length * rt : 0, He = gt(de), mt = gt(me),
|
|
1058
|
+
const gt = (T) => T ? T.kind === "image" ? T.height : S.splitTextToSize(oo(T.text, 99, 99), ge).length * rt : 0, He = gt(de), mt = gt(me), Oe = Math.min(18, O.top), bt = ce - 14, yt = ce - (k ? 26 : 18), Rt = de ? Math.max(O.top, Oe + He + 12) : O.top, xt = Math.max(O.bottom, me ? ce - yt + mt + 10 : k ? 34 : 0);
|
|
1059
1059
|
let Xe = Rt;
|
|
1060
1060
|
if (a && typeof a != "string" && typeof a != "number" && typeof a != "boolean") {
|
|
1061
1061
|
const T = await Vn(a, ge, D, o, Ye, Ve);
|
|
1062
|
-
T && T.kind === "image" && (S.addImage(T.dataUrl, "PNG",
|
|
1063
|
-
} else a && (S.setFont(H, "bold"), S.setFontSize(w.titleSize ?? 14), S.setTextColor(...
|
|
1062
|
+
T && T.kind === "image" && (S.addImage(T.dataUrl, "PNG", O.left, Xe, T.width, T.height), Xe += T.height + 12);
|
|
1063
|
+
} else a && (S.setFont(H, "bold"), S.setFontSize(w.titleSize ?? 14), S.setTextColor(...Le), S.text(String(a), O.left, Xe + (w.titleSize ?? 14)), Xe += (w.titleSize ?? 14) + 12);
|
|
1064
1064
|
const Ut = {};
|
|
1065
|
-
t.fields.forEach((T,
|
|
1065
|
+
t.fields.forEach((T, Z) => {
|
|
1066
1066
|
var Wt;
|
|
1067
|
-
const P = (Wt = w.columns) == null ? void 0 : Wt[T], ae = {}, Je = (P == null ? void 0 : P.align) ?? t.aligns[
|
|
1067
|
+
const P = (Wt = w.columns) == null ? void 0 : Wt[T], ae = {}, Je = (P == null ? void 0 : P.align) ?? t.aligns[Z];
|
|
1068
1068
|
Je && (ae.halign = Je), (P == null ? void 0 : P.width) !== void 0 && (ae.cellWidth = P.width);
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1069
|
+
const Re = he(P == null ? void 0 : P.textColor);
|
|
1070
|
+
Re && (ae.textColor = Re);
|
|
1071
1071
|
const At = he(P == null ? void 0 : P.backgroundColor);
|
|
1072
|
-
At && (ae.fillColor = At), P != null && P.fontStyle && lo.includes(P.fontStyle) && (ae.fontStyle = P.fontStyle), P != null && P.fontSize && (ae.fontSize = P.fontSize), Object.keys(ae).length > 0 && (Ut[
|
|
1072
|
+
At && (ae.fillColor = At), P != null && P.fontStyle && lo.includes(P.fontStyle) && (ae.fontStyle = P.fontStyle), P != null && P.fontSize && (ae.fontSize = P.fontSize), Object.keys(ae).length > 0 && (Ut[Z] = ae);
|
|
1073
1073
|
});
|
|
1074
1074
|
const Ie = {
|
|
1075
1075
|
font: H,
|
|
@@ -1083,7 +1083,7 @@ async function Qi(t, n = {}, i = {}) {
|
|
|
1083
1083
|
head: [t.headers],
|
|
1084
1084
|
body: t.rows,
|
|
1085
1085
|
startY: Xe,
|
|
1086
|
-
margin: { top: Rt, right:
|
|
1086
|
+
margin: { top: Rt, right: O.right, bottom: xt, left: O.left },
|
|
1087
1087
|
theme: p,
|
|
1088
1088
|
showHead: "everyPage",
|
|
1089
1089
|
styles: Ie,
|
|
@@ -1096,33 +1096,33 @@ async function Qi(t, n = {}, i = {}) {
|
|
|
1096
1096
|
columnStyles: Ut,
|
|
1097
1097
|
// A new page starts blank: paint its background before the table draws on it
|
|
1098
1098
|
willDrawPage: () => {
|
|
1099
|
-
var
|
|
1100
|
-
const T = typeof S.getCurrentPageInfo == "function" ? S.getCurrentPageInfo() : (P = (
|
|
1099
|
+
var Z, P;
|
|
1100
|
+
const T = typeof S.getCurrentPageInfo == "function" ? S.getCurrentPageInfo() : (P = (Z = S.internal).getCurrentPageInfo) == null ? void 0 : P.call(Z);
|
|
1101
1101
|
T != null && T.pageNumber && pt(T.pageNumber);
|
|
1102
1102
|
}
|
|
1103
1103
|
};
|
|
1104
1104
|
_ && (Se.bodyStyles = { fillColor: _ }), se && Ee ? (Se.bodyStyles = { fillColor: se }, Se.alternateRowStyles = { fillColor: Ee }) : (se || _) && (Se.alternateRowStyles = { fillColor: _ });
|
|
1105
1105
|
const ot = { ...Se, ...F };
|
|
1106
1106
|
for (const T of ["styles", "headStyles", "bodyStyles", "alternateRowStyles", "margin"]) {
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1107
|
+
const Z = Se[T], P = F == null ? void 0 : F[T];
|
|
1108
|
+
Z && P && typeof P == "object" && (ot[T] = { ...Z, ...P });
|
|
1109
1109
|
}
|
|
1110
1110
|
d(S, ot);
|
|
1111
|
-
const _t = typeof S.getNumberOfPages == "function" ? S.getNumberOfPages() : S.internal.getNumberOfPages(), ue = (T,
|
|
1111
|
+
const _t = typeof S.getNumberOfPages == "function" ? S.getNumberOfPages() : S.internal.getNumberOfPages(), ue = (T, Z) => T === "center" ? (B - Z) / 2 : T === "right" ? B - O.right - Z : O.left, Ge = (T, Z, P, ae) => {
|
|
1112
1112
|
if (!T) return;
|
|
1113
1113
|
if (T.kind === "image") {
|
|
1114
|
-
S.addImage(T.dataUrl, "PNG", ue(P, T.width),
|
|
1114
|
+
S.addImage(T.dataUrl, "PNG", ue(P, T.width), Z, T.width, T.height);
|
|
1115
1115
|
return;
|
|
1116
1116
|
}
|
|
1117
1117
|
S.setFont(H, "normal"), S.setFontSize(qe), S.setTextColor(...ke);
|
|
1118
|
-
const Je = S.splitTextToSize(oo(T.text, ae, _t), ge),
|
|
1119
|
-
S.text(Je,
|
|
1118
|
+
const Je = S.splitTextToSize(oo(T.text, ae, _t), ge), Re = P === "center" ? B / 2 : P === "right" ? B - O.right : O.left;
|
|
1119
|
+
S.text(Je, Re, Z + qe, { align: P });
|
|
1120
1120
|
};
|
|
1121
1121
|
for (let T = 1; T <= _t; T++)
|
|
1122
|
-
S.setPage(T), Ge(de,
|
|
1122
|
+
S.setPage(T), Ge(de, Oe, x, T), Ge(me, yt - mt, E, T), k && (S.setFont(H, "normal"), S.setFontSize(8), S.setTextColor(...ke), S.text(`Page ${T} of ${_t}`, B - O.right, bt, { align: "right" }));
|
|
1123
1123
|
return S.output("blob");
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1125
|
+
function el(t) {
|
|
1126
1126
|
var E;
|
|
1127
1127
|
if (!t || typeof getComputedStyle > "u") return {};
|
|
1128
1128
|
const n = {}, i = (b) => b ? getComputedStyle(b) : null, o = (b) => {
|
|
@@ -1154,7 +1154,7 @@ function Zi(t) {
|
|
|
1154
1154
|
return x && x !== "#ffffff" && (n.pageBackground = x), n.textColor = f(i(t).color), n.fontName = void 0, Object.keys(n).forEach((b) => n[b] === void 0 && delete n[b]), n;
|
|
1155
1155
|
}
|
|
1156
1156
|
const wo = { none: 0, asc: 0, desc: 180 };
|
|
1157
|
-
function
|
|
1157
|
+
function tl({ direction: t, size: n = 14, priority: i, className: o, style: f }) {
|
|
1158
1158
|
const d = W(0), g = ((wo[t ?? "none"] - d.current) % 360 + 360) % 360;
|
|
1159
1159
|
return d.current += g, /* @__PURE__ */ I("span", { className: U("rg-sort-arrow", t && "rg-sort-arrow--active", o), style: f, "data-direction": t ?? "none", children: [
|
|
1160
1160
|
/* @__PURE__ */ I(
|
|
@@ -1181,13 +1181,13 @@ function el({ direction: t, size: n = 14, priority: i, className: o, style: f })
|
|
|
1181
1181
|
t && i !== void 0 && /* @__PURE__ */ h("sup", { className: "rg-sort-arrow__order", children: i })
|
|
1182
1182
|
] });
|
|
1183
1183
|
}
|
|
1184
|
-
function
|
|
1184
|
+
function nl({ direction: t, children: n }) {
|
|
1185
1185
|
const i = W(0), o = ((wo[t ?? "none"] - i.current) % 360 + 360) % 360;
|
|
1186
1186
|
return i.current += o, /* @__PURE__ */ h("span", { className: "rg-sort-turn", style: { transform: `rotate(${i.current}deg)` }, children: n });
|
|
1187
1187
|
}
|
|
1188
1188
|
const vo = new TextEncoder();
|
|
1189
1189
|
let xn = null;
|
|
1190
|
-
function
|
|
1190
|
+
function rl(t) {
|
|
1191
1191
|
if (!xn) {
|
|
1192
1192
|
xn = new Uint32Array(256);
|
|
1193
1193
|
for (let i = 0; i < 256; i++) {
|
|
@@ -1200,7 +1200,7 @@ function nl(t) {
|
|
|
1200
1200
|
for (let i = 0; i < t.length; i++) n = xn[(n ^ t[i]) & 255] ^ n >>> 8;
|
|
1201
1201
|
return (n ^ 4294967295) >>> 0;
|
|
1202
1202
|
}
|
|
1203
|
-
async function
|
|
1203
|
+
async function ol(t) {
|
|
1204
1204
|
const n = globalThis.CompressionStream;
|
|
1205
1205
|
if (typeof n > "u") return null;
|
|
1206
1206
|
try {
|
|
@@ -1210,14 +1210,14 @@ async function rl(t) {
|
|
|
1210
1210
|
return null;
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
1213
|
-
async function
|
|
1213
|
+
async function il(t) {
|
|
1214
1214
|
const n = /* @__PURE__ */ new Date(), i = n.getHours() << 11 | n.getMinutes() << 5 | n.getSeconds() >> 1, o = n.getFullYear() - 1980 << 9 | n.getMonth() + 1 << 5 | n.getDate(), f = [], d = [];
|
|
1215
1215
|
let a = 0;
|
|
1216
1216
|
for (const p of t) {
|
|
1217
|
-
const k = vo.encode(p.name), D =
|
|
1218
|
-
q.setUint32(0, 67324752, !0), q.setUint16(4, 20, !0), q.setUint16(6, 2048, !0), q.setUint16(8,
|
|
1217
|
+
const k = vo.encode(p.name), D = rl(p.data), C = await ol(p.data), F = C !== null && C.length < p.data.length, w = F ? C : p.data, O = F ? 8 : 0, H = new Uint8Array(30 + k.length), q = new DataView(H.buffer);
|
|
1218
|
+
q.setUint32(0, 67324752, !0), q.setUint16(4, 20, !0), q.setUint16(6, 2048, !0), q.setUint16(8, O, !0), q.setUint16(10, i, !0), q.setUint16(12, o, !0), q.setUint32(14, D, !0), q.setUint32(18, w.length, !0), q.setUint32(22, p.data.length, !0), q.setUint16(26, k.length, !0), q.setUint16(28, 0, !0), H.set(k, 30);
|
|
1219
1219
|
const A = new Uint8Array(46 + k.length), V = new DataView(A.buffer);
|
|
1220
|
-
V.setUint32(0, 33639248, !0), V.setUint16(4, 20, !0), V.setUint16(6, 20, !0), V.setUint16(8, 2048, !0), V.setUint16(10,
|
|
1220
|
+
V.setUint32(0, 33639248, !0), V.setUint16(4, 20, !0), V.setUint16(6, 20, !0), V.setUint16(8, 2048, !0), V.setUint16(10, O, !0), V.setUint16(12, i, !0), V.setUint16(14, o, !0), V.setUint32(16, D, !0), V.setUint32(20, w.length, !0), V.setUint32(24, p.data.length, !0), V.setUint16(28, k.length, !0), V.setUint32(42, a, !0), A.set(k, 46), f.push(H, w), d.push(A), a += H.length + w.length;
|
|
1221
1221
|
}
|
|
1222
1222
|
const g = d.reduce((p, k) => p + k.length, 0), m = new Uint8Array(22), x = new DataView(m.buffer);
|
|
1223
1223
|
x.setUint32(0, 101010256, !0), x.setUint16(8, t.length, !0), x.setUint16(10, t.length, !0), x.setUint32(12, g, !0), x.setUint32(16, a, !0);
|
|
@@ -1238,16 +1238,16 @@ function wn(t) {
|
|
|
1238
1238
|
}
|
|
1239
1239
|
return i;
|
|
1240
1240
|
}
|
|
1241
|
-
function
|
|
1241
|
+
function ll(t) {
|
|
1242
1242
|
const n = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t);
|
|
1243
1243
|
if (!n) return null;
|
|
1244
1244
|
const [i, o, f] = [Number(n[1]), Number(n[2]), Number(n[3])], d = new Date(Date.UTC(i, o - 1, f));
|
|
1245
1245
|
return d.getUTCFullYear() !== i || d.getUTCMonth() !== o - 1 || d.getUTCDate() !== f ? null : Math.round((d.getTime() - Date.UTC(1899, 11, 30)) / 864e5);
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function sl(t) {
|
|
1248
1248
|
return (t ?? "").replace(/[\[\]:*?/\\]/g, " ").trim().slice(0, 31) || "Sheet1";
|
|
1249
1249
|
}
|
|
1250
|
-
const
|
|
1250
|
+
const al = 1, cl = 2, dl = 3, ul = 4, fl = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1251
1251
|
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
1252
1252
|
<numFmts count="1"><numFmt numFmtId="164" formatCode="yyyy\\-mm\\-dd"/></numFmts>
|
|
1253
1253
|
<fonts count="2"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><color rgb="FFFFFFFF"/><name val="Calibri"/></font></fonts>
|
|
@@ -1263,15 +1263,15 @@ const sl = 1, al = 2, cl = 3, dl = 4, ul = `<?xml version="1.0" encoding="UTF-8"
|
|
|
1263
1263
|
</cellXfs>
|
|
1264
1264
|
<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>
|
|
1265
1265
|
</styleSheet>`;
|
|
1266
|
-
function
|
|
1266
|
+
function hl(t, n, i) {
|
|
1267
1267
|
if (n == null || n === "") return "";
|
|
1268
|
-
const o = i.align === "right" ?
|
|
1268
|
+
const o = i.align === "right" ? dl : i.align === "center" ? ul : 0;
|
|
1269
1269
|
if (typeof n == "boolean") return `<c r="${t}" t="b"${o ? ` s="${o}"` : ""}><v>${n ? 1 : 0}</v></c>`;
|
|
1270
1270
|
if (typeof n == "number")
|
|
1271
1271
|
return Number.isFinite(n) ? `<c r="${t}"${o ? ` s="${o}"` : ""}><v>${n}</v></c>` : "";
|
|
1272
1272
|
if (i.kind === "date") {
|
|
1273
|
-
const d =
|
|
1274
|
-
if (d !== null) return `<c r="${t}" s="${
|
|
1273
|
+
const d = ll(n);
|
|
1274
|
+
if (d !== null) return `<c r="${t}" s="${cl}"><v>${d}</v></c>`;
|
|
1275
1275
|
}
|
|
1276
1276
|
if (i.kind === "number" && n.trim() !== "" && Number.isFinite(Number(n)))
|
|
1277
1277
|
return `<c r="${t}"${o ? ` s="${o}"` : ""}><v>${Number(n)}</v></c>`;
|
|
@@ -1279,21 +1279,21 @@ function fl(t, n, i) {
|
|
|
1279
1279
|
return `<c r="${t}" t="inlineStr"${o ? ` s="${o}"` : ""}><is><t xml:space="preserve">${f}</t></is></c>`;
|
|
1280
1280
|
}
|
|
1281
1281
|
const co = (t) => t == null ? 0 : typeof t == "boolean" ? 5 : String(t).length;
|
|
1282
|
-
function
|
|
1282
|
+
function pl(t, n) {
|
|
1283
1283
|
const i = wn(Math.max(0, t.length - 1)), o = n.length + 1, f = t.map((a, g) => {
|
|
1284
1284
|
let m = co(a.header) + 3;
|
|
1285
1285
|
for (let x = 0; x < Math.min(n.length, 500); x++) m = Math.max(m, a.kind === "date" ? 11 : co(n[x][g]));
|
|
1286
1286
|
return Math.min(60, Math.max(8, m + 2));
|
|
1287
1287
|
}), d = [];
|
|
1288
1288
|
return d.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'), d.push('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">'), d.push(`<dimension ref="A1:${i}${o}"/>`), d.push('<sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/><selection pane="bottomLeft"/></sheetView></sheetViews>'), d.push('<sheetFormatPr defaultRowHeight="15"/>'), d.push("<cols>" + f.map((a, g) => `<col min="${g + 1}" max="${g + 1}" width="${a}" customWidth="1"/>`).join("") + "</cols>"), d.push("<sheetData>"), d.push(
|
|
1289
|
-
'<row r="1" ht="22" customHeight="1">' + t.map((a, g) => `<c r="${wn(g)}1" s="${
|
|
1289
|
+
'<row r="1" ht="22" customHeight="1">' + t.map((a, g) => `<c r="${wn(g)}1" s="${al}" t="inlineStr"><is><t xml:space="preserve">${vn(a.header)}</t></is></c>`).join("") + "</row>"
|
|
1290
1290
|
), n.forEach((a, g) => {
|
|
1291
|
-
const m = g + 2, x = t.map((E, b) =>
|
|
1291
|
+
const m = g + 2, x = t.map((E, b) => hl(`${wn(b)}${m}`, a[b], E)).join("");
|
|
1292
1292
|
d.push(`<row r="${m}">${x}</row>`);
|
|
1293
1293
|
}), d.push("</sheetData>"), d.push(`<autoFilter ref="A1:${i}${o}"/>`), d.push("</worksheet>"), d.join("");
|
|
1294
1294
|
}
|
|
1295
|
-
async function
|
|
1296
|
-
const o =
|
|
1295
|
+
async function gl(t, n, i = {}) {
|
|
1296
|
+
const o = sl(i.sheetName), f = `'${o.replace(/'/g, "''")}'`, d = wn(Math.max(0, t.length - 1)), a = {
|
|
1297
1297
|
"[Content_Types].xml": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1298
1298
|
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>`,
|
|
1299
1299
|
"_rels/.rels": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -1302,9 +1302,9 @@ async function pl(t, n, i = {}) {
|
|
|
1302
1302
|
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="${vn(o)}" sheetId="1" r:id="rId1"/></sheets><definedNames><definedName name="_xlnm._FilterDatabase" localSheetId="0" hidden="1">${vn(f)}!$A$1:$${d}$${n.length + 1}</definedName></definedNames></workbook>`,
|
|
1303
1303
|
"xl/_rels/workbook.xml.rels": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1304
1304
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`,
|
|
1305
|
-
"xl/styles.xml":
|
|
1306
|
-
"xl/worksheets/sheet1.xml":
|
|
1307
|
-
}, g = await
|
|
1305
|
+
"xl/styles.xml": fl,
|
|
1306
|
+
"xl/worksheets/sheet1.xml": pl(t, n)
|
|
1307
|
+
}, g = await il(Object.entries(a).map(([m, x]) => ({ name: m, data: vo.encode(x) })));
|
|
1308
1308
|
return new Blob([g], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
|
|
1309
1309
|
}
|
|
1310
1310
|
const Xn = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), ko = (t, n) => Object.prototype.hasOwnProperty.call(t, n);
|
|
@@ -1346,20 +1346,20 @@ function fo(t, n) {
|
|
|
1346
1346
|
o.push({ kind: "row", entry: a, i: g }), d(a.id);
|
|
1347
1347
|
}), n.forEach((a) => !f.has(a.id) && o.push({ kind: "ghost", ghost: a })), o;
|
|
1348
1348
|
}
|
|
1349
|
-
const
|
|
1349
|
+
const ml = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, $e = 38, bl = 150, ho = 10, Hn = (t, n) => `${typeof t}:${t}\0${n}`;
|
|
1350
1350
|
function Mt(t, n) {
|
|
1351
1351
|
const i = we(n, t.field);
|
|
1352
|
-
return t.valueFormatter ? t.valueFormatter(i, n) : t.type === "boolean" && typeof i == "boolean" ? i ? "Yes" : "No" : t.type === "date" ?
|
|
1352
|
+
return t.valueFormatter ? t.valueFormatter(i, n) : t.type === "boolean" && typeof i == "boolean" ? i ? "Yes" : "No" : t.type === "date" ? Fi(i, t.dateLocale, t.dateFormat) : i == null ? "" : i instanceof Date ? i.toLocaleDateString() : String(i);
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1354
|
+
function yl(t, n, i) {
|
|
1355
1355
|
if (i.type === "date") {
|
|
1356
1356
|
const o = pe(t) ?? "", f = pe(n) ?? "";
|
|
1357
1357
|
return o < f ? -1 : o > f ? 1 : 0;
|
|
1358
1358
|
}
|
|
1359
1359
|
return typeof t == "number" && typeof n == "number" ? t - n : t instanceof Date && n instanceof Date ? t.getTime() - n.getTime() : typeof t == "boolean" && typeof n == "boolean" ? Number(t) - Number(n) : String(t).localeCompare(String(n), void 0, { numeric: !0, sensitivity: "base" });
|
|
1360
1360
|
}
|
|
1361
|
-
const
|
|
1362
|
-
function
|
|
1361
|
+
const xl = (t) => t ? Array.isArray(t) ? t : [t] : [], po = (t) => t.type === "date" && t.validity.badInput;
|
|
1362
|
+
function Sl({
|
|
1363
1363
|
columns: t,
|
|
1364
1364
|
rows: n,
|
|
1365
1365
|
getRowId: i,
|
|
@@ -1379,13 +1379,13 @@ function kl({
|
|
|
1379
1379
|
searchable: C = !1,
|
|
1380
1380
|
searchPlaceholder: F = "Search…",
|
|
1381
1381
|
search: w,
|
|
1382
|
-
onSearchChange:
|
|
1382
|
+
onSearchChange: O,
|
|
1383
1383
|
filters: H,
|
|
1384
1384
|
onFiltersChange: q,
|
|
1385
1385
|
pagination: A = !1,
|
|
1386
1386
|
paginationPosition: V = "bottom",
|
|
1387
1387
|
showToolbar: ke = !0,
|
|
1388
|
-
showFooter:
|
|
1388
|
+
showFooter: Le = !0,
|
|
1389
1389
|
pageSize: ze = 10,
|
|
1390
1390
|
pageSizeOptions: Fe = [5, 10, 25, 50],
|
|
1391
1391
|
page: Y,
|
|
@@ -1408,7 +1408,7 @@ function kl({
|
|
|
1408
1408
|
overscan: gt = 6,
|
|
1409
1409
|
exportable: He = !1,
|
|
1410
1410
|
onExportError: mt,
|
|
1411
|
-
apiRef:
|
|
1411
|
+
apiRef: Oe,
|
|
1412
1412
|
onRowClick: bt,
|
|
1413
1413
|
toolbar: yt,
|
|
1414
1414
|
emptyMessage: Rt = "No rows to show",
|
|
@@ -1424,11 +1424,11 @@ function kl({
|
|
|
1424
1424
|
rowAnimationStagger: it,
|
|
1425
1425
|
rowAnimationClassName: lt,
|
|
1426
1426
|
rowExitAnimationClassName: T,
|
|
1427
|
-
theme:
|
|
1427
|
+
theme: Z,
|
|
1428
1428
|
maxHeight: P,
|
|
1429
1429
|
stickyToolbar: ae = !1,
|
|
1430
1430
|
stickyHeader: Je = !1,
|
|
1431
|
-
stickyOffset:
|
|
1431
|
+
stickyOffset: Re = 0,
|
|
1432
1432
|
scrollbar: At = "thin",
|
|
1433
1433
|
className: Wt,
|
|
1434
1434
|
style: So,
|
|
@@ -1437,52 +1437,52 @@ function kl({
|
|
|
1437
1437
|
rowClassName: Sn,
|
|
1438
1438
|
rowStyle: Nn
|
|
1439
1439
|
}) {
|
|
1440
|
-
const
|
|
1440
|
+
const Q = (e, r) => ({
|
|
1441
1441
|
className: U(r, X[e]),
|
|
1442
1442
|
style: K[e]
|
|
1443
|
-
}), [Bt,
|
|
1443
|
+
}), [Bt, Zn] = j(n), st = W(n);
|
|
1444
1444
|
ne(() => {
|
|
1445
|
-
st.current = n,
|
|
1445
|
+
st.current = n, Zn(n);
|
|
1446
1446
|
}, [n]);
|
|
1447
|
-
const
|
|
1448
|
-
st.current = e,
|
|
1449
|
-
}, [wt, er] = It(w, "",
|
|
1447
|
+
const Qn = (e) => {
|
|
1448
|
+
st.current = e, Zn(e);
|
|
1449
|
+
}, [wt, er] = It(w, "", O), [at, tr] = It(H, {}, q), [be, No] = It(v, xl(p), k), [Cn, ct] = It(Y, 0, se), [re, Co] = j(ze), Do = (e) => {
|
|
1450
1450
|
Co(e), Ee == null || Ee(e);
|
|
1451
1451
|
}, [jt, To] = j(() => new Set(t.filter((e) => e.hidden).map((e) => e.field))), Fo = (e, r) => {
|
|
1452
1452
|
const l = new Set(jt);
|
|
1453
1453
|
r ? l.add(e) : l.delete(e), To(l), Ye == null || Ye([...l]);
|
|
1454
|
-
}, [Dn, nr] = j({}), [Kt, Eo] = j({}), [
|
|
1454
|
+
}, [Dn, nr] = j({}), [Kt, Eo] = j({}), [_l, Io] = j(0), vt = W(/* @__PURE__ */ new Map()), [kt, Ze] = j(null), Ue = W(0), zt = W(null), qt = W(/* @__PURE__ */ new Map()), [Tn, rr] = j(null), Fn = W(null), or = W(null), St = W(null), [En, ir] = j({ top: 0, height: 0 }), L = ve(() => {
|
|
1455
1455
|
const e = t.filter((r) => !jt.has(r.field)).map((r) => r.type === "sequence" ? { ...r, sortable: !1, filterable: !1, editable: !1, filterRenderer: void 0 } : r);
|
|
1456
1456
|
return [
|
|
1457
1457
|
...e.filter((r) => r.pinned === "left"),
|
|
1458
1458
|
...e.filter((r) => r.pinned !== "left" && r.pinned !== "right"),
|
|
1459
1459
|
...e.filter((r) => r.pinned === "right")
|
|
1460
1460
|
];
|
|
1461
|
-
}, [t, jt]), In = (e) => e.sortable === !0, fe = g === "single" ? "single" : g ? "multiple" : null, Nt =
|
|
1461
|
+
}, [t, jt]), In = (e) => e.sortable === !0, fe = g === "single" ? "single" : g ? "multiple" : null, Nt = L.length + (fe ? 1 : 0), Qe = ve(
|
|
1462
1462
|
() => Bt.map((e, r) => ({ row: e, index: r, id: i ? i(e, r) : r })),
|
|
1463
1463
|
[Bt, i]
|
|
1464
1464
|
), lr = W(/* @__PURE__ */ new Map());
|
|
1465
|
-
|
|
1465
|
+
Qe.forEach((e) => lr.current.set(e.id, e.row));
|
|
1466
1466
|
const dt = ve(
|
|
1467
1467
|
() => Object.entries(at).filter(([e, r]) => {
|
|
1468
|
-
const l =
|
|
1468
|
+
const l = L.find((s) => s.field === e);
|
|
1469
1469
|
return !!l && !!l.filterable && xo(r);
|
|
1470
1470
|
}),
|
|
1471
|
-
[at,
|
|
1471
|
+
[at, L]
|
|
1472
1472
|
), [Mo, $o] = j(wt);
|
|
1473
1473
|
ne(() => {
|
|
1474
1474
|
if (!_) return;
|
|
1475
1475
|
const e = setTimeout(() => $o(wt), B);
|
|
1476
1476
|
return () => clearTimeout(e);
|
|
1477
1477
|
}, [wt, _, B]);
|
|
1478
|
-
const
|
|
1479
|
-
if (_) return
|
|
1480
|
-
const e =
|
|
1481
|
-
let r =
|
|
1482
|
-
const y =
|
|
1483
|
-
return
|
|
1478
|
+
const Ae = _ ? Mo : wt, sr = (e) => e.filterRenderer ? "text" : Jr(e), Me = ve(() => {
|
|
1479
|
+
if (_) return Qe;
|
|
1480
|
+
const e = Ae.trim().toLowerCase();
|
|
1481
|
+
let r = Qe.filter(({ row: s }) => e && !L.some((c) => Mt(c, s).toLowerCase().includes(e)) ? !1 : dt.every(([c, u]) => {
|
|
1482
|
+
const y = L.find((N) => N.field === c);
|
|
1483
|
+
return $i(sr(y), u, Mt(y, s), we(s, c));
|
|
1484
1484
|
}));
|
|
1485
|
-
const l = be.map((s) => ({ col:
|
|
1485
|
+
const l = be.map((s) => ({ col: L.find((c) => c.field === s.field), dir: s.direction === "asc" ? 1 : -1 })).filter((s) => !!s.col);
|
|
1486
1486
|
return l.length && (r = [...r].sort((s, c) => {
|
|
1487
1487
|
for (const { col: u, dir: y } of l) {
|
|
1488
1488
|
const N = we(s.row, u.field), M = we(c.row, u.field), R = N == null || N === "", ee = M == null || M === "";
|
|
@@ -1490,33 +1490,33 @@ function kl({
|
|
|
1490
1490
|
if (R !== ee) return R ? 1 : -1;
|
|
1491
1491
|
continue;
|
|
1492
1492
|
}
|
|
1493
|
-
const ye = u.comparator ? u.comparator(N, M, s.row, c.row) :
|
|
1493
|
+
const ye = u.comparator ? u.comparator(N, M, s.row, c.row) : yl(N, M, u);
|
|
1494
1494
|
if (ye !== 0) return ye * y;
|
|
1495
1495
|
}
|
|
1496
1496
|
return 0;
|
|
1497
1497
|
})), r;
|
|
1498
|
-
}, [
|
|
1498
|
+
}, [Qe, L, Ae, dt, be, _]), Yt = JSON.stringify([Ae, at, be, re]), ar = W(Yt);
|
|
1499
1499
|
ne(() => {
|
|
1500
1500
|
ar.current !== Yt && (ar.current = Yt, ct(0));
|
|
1501
1501
|
}, [Yt]);
|
|
1502
|
-
const ut = _ ? G ??
|
|
1502
|
+
const ut = _ ? G ?? Qe.length : Me.length, We = A ? Math.max(1, Math.ceil(ut / re)) : 1, oe = Math.min(Cn, We - 1), z = A && !_ ? Me.slice(oe * re, oe * re + re) : Me, Po = ut === 0 ? 0 : A ? oe * re + 1 : 1, Lo = A ? Math.min(ut, (oe + 1) * re) : ut, Mn = ve(
|
|
1503
1503
|
() => ({
|
|
1504
1504
|
sort: be.filter((e) => {
|
|
1505
1505
|
const r = t.find((l) => l.field === e.field);
|
|
1506
1506
|
return !!r && In(r);
|
|
1507
1507
|
}),
|
|
1508
1508
|
filters: Object.fromEntries(dt),
|
|
1509
|
-
search:
|
|
1509
|
+
search: Ae.trim(),
|
|
1510
1510
|
page: oe,
|
|
1511
1511
|
pageSize: re
|
|
1512
1512
|
}),
|
|
1513
1513
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1514
|
-
[be, t, dt,
|
|
1514
|
+
[be, t, dt, Ae, oe, re]
|
|
1515
1515
|
), Oo = JSON.stringify(Mn), Vt = W(Mn);
|
|
1516
1516
|
Vt.current = Mn;
|
|
1517
1517
|
const Ht = W(S);
|
|
1518
1518
|
Ht.current = S;
|
|
1519
|
-
const [Ro, Xt] = j(
|
|
1519
|
+
const [Ro, Xt] = j(() => _ && !!S), [$n, Pn] = j(!1), Ln = W(0), Gt = Te((e) => {
|
|
1520
1520
|
var s;
|
|
1521
1521
|
const r = ++Ln.current, l = (s = Ht.current) == null ? void 0 : s.call(Ht, e);
|
|
1522
1522
|
l && typeof l.then == "function" ? (Xt(!0), Pn(!1), l.then(
|
|
@@ -1531,14 +1531,14 @@ function kl({
|
|
|
1531
1531
|
ne(() => {
|
|
1532
1532
|
_ && Gt(Vt.current);
|
|
1533
1533
|
}, [_, Oo, Gt]), ne(() => {
|
|
1534
|
-
_ && A && Cn >
|
|
1535
|
-
}, [_, A, Cn,
|
|
1534
|
+
_ && A && Cn > We - 1 && ct(We - 1);
|
|
1535
|
+
}, [_, A, Cn, We]);
|
|
1536
1536
|
const Ct = ge ?? Ro, cr = (e) => e.map((r) => lr.current.get(r)).filter((r) => r !== void 0), [Ce, Jt] = It(
|
|
1537
1537
|
m,
|
|
1538
1538
|
x ?? [],
|
|
1539
1539
|
(e) => E == null ? void 0 : E({ ids: e, rows: cr(e) })
|
|
1540
|
-
),
|
|
1541
|
-
if (!fe || !
|
|
1540
|
+
), Zt = ve(() => new Set(Ce), [Ce]), Qt = (e) => b ? b(e) : !0, en = W(null), dr = W(!1), Uo = (e, r) => {
|
|
1541
|
+
if (!fe || !Qt(e.row)) return;
|
|
1542
1542
|
if (fe === "single") {
|
|
1543
1543
|
Jt(r ? [e.id] : []), en.current = e.id;
|
|
1544
1544
|
return;
|
|
@@ -1546,10 +1546,10 @@ function kl({
|
|
|
1546
1546
|
const l = new Set(Ce), s = dr.current && en.current !== null ? z.findIndex((u) => u.id === en.current) : -1, c = z.findIndex((u) => u.id === e.id);
|
|
1547
1547
|
if (s >= 0 && c >= 0)
|
|
1548
1548
|
for (let u = Math.min(s, c); u <= Math.max(s, c); u++)
|
|
1549
|
-
|
|
1549
|
+
Qt(z[u].row) && (r ? l.add(z[u].id) : l.delete(z[u].id));
|
|
1550
1550
|
else r ? l.add(e.id) : l.delete(e.id);
|
|
1551
1551
|
en.current = e.id, Jt([...l]);
|
|
1552
|
-
}, Dt = ve(() => Me.filter((e) =>
|
|
1552
|
+
}, Dt = ve(() => Me.filter((e) => Qt(e.row)), [Me, b]), ur = Dt.filter((e) => Zt.has(e.id)).length, fr = Dt.length > 0 && ur === Dt.length, hr = (e) => {
|
|
1553
1553
|
const r = new Set(Ce);
|
|
1554
1554
|
Dt.forEach((l) => e ? r.add(l.id) : r.delete(l.id)), Jt([...r]);
|
|
1555
1555
|
}, tn = (e, r, l) => ({
|
|
@@ -1577,8 +1577,8 @@ function kl({
|
|
|
1577
1577
|
}, rn = (e, r) => {
|
|
1578
1578
|
var l;
|
|
1579
1579
|
return (l = qt.current.get(Hn(e, r))) == null ? void 0 : l.focus();
|
|
1580
|
-
},
|
|
1581
|
-
|
|
1580
|
+
}, Be = () => {
|
|
1581
|
+
Ue.current += 1, Ze(null);
|
|
1582
1582
|
}, Wo = (e) => {
|
|
1583
1583
|
for (const r of st.current) {
|
|
1584
1584
|
const l = we(r, e.field);
|
|
@@ -1588,11 +1588,11 @@ function kl({
|
|
|
1588
1588
|
if (!nn(r, tn(r, e.row, e.index))) return !1;
|
|
1589
1589
|
const s = we(e.row, r.field);
|
|
1590
1590
|
let c;
|
|
1591
|
-
return r.cellEditor ? c = s : r.type === "date" ? c = pe(s) ?? "" : c = l.text ?? (s == null ? "" : String(s)), zt.current = c,
|
|
1591
|
+
return r.cellEditor ? c = s : r.type === "date" ? c = pe(s) ?? "" : c = l.text ?? (s == null ? "" : String(s)), zt.current = c, Ue.current += 1, Ze({
|
|
1592
1592
|
id: e.id,
|
|
1593
1593
|
field: r.field,
|
|
1594
1594
|
draft: c,
|
|
1595
|
-
session:
|
|
1595
|
+
session: Ue.current,
|
|
1596
1596
|
select: l.select ?? "end",
|
|
1597
1597
|
invalid: !1
|
|
1598
1598
|
}), !0;
|
|
@@ -1605,7 +1605,7 @@ function kl({
|
|
|
1605
1605
|
u = r.valueParser(l.text, s);
|
|
1606
1606
|
else if (r.type === "date") {
|
|
1607
1607
|
if (l.text !== "" && !le(l.text)) return !1;
|
|
1608
|
-
u =
|
|
1608
|
+
u = Ei(l.text, c ?? Wo(r));
|
|
1609
1609
|
} else if (r.type === "number")
|
|
1610
1610
|
if (l.text.trim() === "") u = null;
|
|
1611
1611
|
else {
|
|
@@ -1623,49 +1623,49 @@ function kl({
|
|
|
1623
1623
|
return !0;
|
|
1624
1624
|
if (r.validate && !r.validate(u, s)) return !1;
|
|
1625
1625
|
const y = Gn(s, r.field, u), N = st.current.map((M, R) => R === e.index ? y : M);
|
|
1626
|
-
return
|
|
1626
|
+
return Qn(N), d == null || d({ rowId: e.id, rowIndex: e.index, field: r.field, oldValue: c, newValue: u, row: y }), a == null || a(N), !0;
|
|
1627
1627
|
}, mr = (e, r, l) => {
|
|
1628
|
-
const s = z.findIndex((R) => R.id === e.id), c =
|
|
1628
|
+
const s = z.findIndex((R) => R.id === e.id), c = L.findIndex((R) => R.field === r);
|
|
1629
1629
|
if (s < 0 || c < 0) return null;
|
|
1630
1630
|
const u = (R, ee) => nn(ee, tn(ee, R.row, R.index));
|
|
1631
1631
|
if (l === "down" || l === "up") {
|
|
1632
1632
|
const R = l === "down" ? 1 : -1;
|
|
1633
1633
|
for (let ee = s + R; ee >= 0 && ee < z.length; ee += R)
|
|
1634
|
-
if (u(z[ee],
|
|
1634
|
+
if (u(z[ee], L[c])) return { entry: z[ee], col: L[c] };
|
|
1635
1635
|
return null;
|
|
1636
1636
|
}
|
|
1637
1637
|
const y = l === "right" ? 1 : -1;
|
|
1638
1638
|
let N = s, M = c + y;
|
|
1639
1639
|
for (; N >= 0 && N < z.length; ) {
|
|
1640
|
-
for (; M >= 0 && M <
|
|
1641
|
-
if (u(z[N],
|
|
1640
|
+
for (; M >= 0 && M < L.length; ) {
|
|
1641
|
+
if (u(z[N], L[M])) return { entry: z[N], col: L[M] };
|
|
1642
1642
|
M += y;
|
|
1643
1643
|
}
|
|
1644
|
-
N += y, M = y > 0 ? 0 :
|
|
1644
|
+
N += y, M = y > 0 ? 0 : L.length - 1;
|
|
1645
1645
|
}
|
|
1646
1646
|
return null;
|
|
1647
1647
|
}, et = (e, r, l, s = {}) => {
|
|
1648
1648
|
const { move: c = "none", focus: u = !0 } = s;
|
|
1649
1649
|
if (!gr(e, r, l))
|
|
1650
|
-
return
|
|
1650
|
+
return Ze((N) => N && { ...N, invalid: !0 }), !1;
|
|
1651
1651
|
const y = c === "none" ? null : mr(e, r.field, c);
|
|
1652
|
-
return y ? on(y.entry, y.col, { select: "all" }) : (
|
|
1652
|
+
return y ? on(y.entry, y.col, { select: "all" }) : (Be(), u && rn(e.id, r.field)), !0;
|
|
1653
1653
|
}, br = (e, r, l) => {
|
|
1654
1654
|
if (e.nativeEvent.isComposing) return;
|
|
1655
1655
|
const s = e.currentTarget.value, c = po(e.currentTarget);
|
|
1656
1656
|
if (e.key === "Enter") {
|
|
1657
|
-
if (e.preventDefault(), c) return
|
|
1657
|
+
if (e.preventDefault(), c) return Ze((y) => y && { ...y, invalid: !0 });
|
|
1658
1658
|
const u = f ? e.shiftKey ? "up" : "down" : "none";
|
|
1659
1659
|
et(r, l, { text: s }, { move: u });
|
|
1660
1660
|
} else if (e.key === "Escape")
|
|
1661
|
-
e.preventDefault(),
|
|
1661
|
+
e.preventDefault(), Be(), rn(r.id, l.field);
|
|
1662
1662
|
else if (e.key === "Tab" && !c) {
|
|
1663
1663
|
const u = e.shiftKey ? "left" : "right";
|
|
1664
1664
|
mr(r, l.field, u) && (e.preventDefault(), et(r, l, { text: s }, { move: u }));
|
|
1665
1665
|
}
|
|
1666
1666
|
}, Bo = (e, r) => {
|
|
1667
1667
|
var u;
|
|
1668
|
-
const l = z[e], s =
|
|
1668
|
+
const l = z[e], s = L[r];
|
|
1669
1669
|
if (!l || !s) return;
|
|
1670
1670
|
rr({ id: l.id, field: s.field }), Fn.current = Hn(l.id, s.field);
|
|
1671
1671
|
const c = St.current;
|
|
@@ -1682,7 +1682,7 @@ function kl({
|
|
|
1682
1682
|
});
|
|
1683
1683
|
const jo = (e, r, l) => {
|
|
1684
1684
|
if (!Ve) return !1;
|
|
1685
|
-
let s = z.findIndex((u) => u.id === r.id), c =
|
|
1685
|
+
let s = z.findIndex((u) => u.id === r.id), c = L.findIndex((u) => u.field === l.field);
|
|
1686
1686
|
if (s < 0 || c < 0) return !1;
|
|
1687
1687
|
switch (e.key) {
|
|
1688
1688
|
case "ArrowDown":
|
|
@@ -1707,12 +1707,12 @@ function kl({
|
|
|
1707
1707
|
c = 0, (e.ctrlKey || e.metaKey) && (s = 0);
|
|
1708
1708
|
break;
|
|
1709
1709
|
case "End":
|
|
1710
|
-
c =
|
|
1710
|
+
c = L.length - 1, (e.ctrlKey || e.metaKey) && (s = z.length - 1);
|
|
1711
1711
|
break;
|
|
1712
1712
|
default:
|
|
1713
1713
|
return !1;
|
|
1714
1714
|
}
|
|
1715
|
-
return e.preventDefault(), Bo(Math.max(0, Math.min(z.length - 1, s)), Math.max(0, Math.min(
|
|
1715
|
+
return e.preventDefault(), Bo(Math.max(0, Math.min(z.length - 1, s)), Math.max(0, Math.min(L.length - 1, c))), !0;
|
|
1716
1716
|
}, Ko = (e, r, l, s) => {
|
|
1717
1717
|
e.target === e.currentTarget && (jo(e, r, l) || nn(l, s) && (e.key === "Enter" || e.key === "F2" ? (e.preventDefault(), on(r, l)) : !l.cellEditor && l.type !== "date" && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), on(r, l, { text: e.key }))));
|
|
1718
1718
|
};
|
|
@@ -1723,7 +1723,7 @@ function kl({
|
|
|
1723
1723
|
const l = new ResizeObserver(r);
|
|
1724
1724
|
return l.observe(e), () => l.disconnect();
|
|
1725
1725
|
}, [de]);
|
|
1726
|
-
const Tt = de && !Ct && z.length > 0, zo = En.height || (typeof P == "number" ? P : 400), ln = Tt ? Math.max(0, Math.floor(En.top / me) - gt) : 0, Rn = Tt ? Math.min(z.length, Math.ceil((En.top + zo) / me) + gt) : z.length, yr = Tt ? z.slice(ln, Rn) : z, qo = `${oe}|${re}|${JSON.stringify(be)}|${
|
|
1726
|
+
const Tt = de && !Ct && z.length > 0, zo = En.height || (typeof P == "number" ? P : 400), ln = Tt ? Math.max(0, Math.floor(En.top / me) - gt) : 0, Rn = Tt ? Math.min(z.length, Math.ceil((En.top + zo) / me) + gt) : z.length, yr = Tt ? z.slice(ln, Rn) : z, qo = `${oe}|${re}|${JSON.stringify(be)}|${Ae}|${JSON.stringify(at)}`, xr = W(!0);
|
|
1727
1727
|
ne(() => {
|
|
1728
1728
|
if (xr.current) {
|
|
1729
1729
|
xr.current = !1;
|
|
@@ -1737,9 +1737,9 @@ function kl({
|
|
|
1737
1737
|
const Vo = (e) => {
|
|
1738
1738
|
let r = sn.current.get(e);
|
|
1739
1739
|
return r === void 0 && (r = Yo++, sn.current.set(e, r)), Math.min(r, 24);
|
|
1740
|
-
}, [De, Sr] = j([]), Nr = W({ rows: [], order: [], pageKey: "" }),
|
|
1741
|
-
const r =
|
|
1742
|
-
r !== void 0 && clearTimeout(r),
|
|
1740
|
+
}, [De, Sr] = j([]), Nr = W({ rows: [], order: [], pageKey: "" }), je = W(/* @__PURE__ */ new Map()), Wn = `${oe}|${re}|${_}`, Bn = Te((e) => {
|
|
1741
|
+
const r = je.current.get(e);
|
|
1742
|
+
r !== void 0 && clearTimeout(r), je.current.delete(e), Sr((l) => {
|
|
1743
1743
|
const s = l.find((c) => c.id === e);
|
|
1744
1744
|
return s ? l.filter((c) => c.id !== e).map((c) => c.afterId === e ? { ...c, afterId: s.afterId } : c) : l;
|
|
1745
1745
|
});
|
|
@@ -1747,7 +1747,7 @@ function kl({
|
|
|
1747
1747
|
Pt(() => {
|
|
1748
1748
|
const e = Nr.current, r = new Set(z.map((c) => c.id));
|
|
1749
1749
|
sn.current.forEach((c, u) => !r.has(u) && sn.current.delete(u));
|
|
1750
|
-
const l = !wr || Ct || $n || e.pageKey !== Wn ||
|
|
1750
|
+
const l = !wr || Ct || $n || e.pageKey !== Wn || ml();
|
|
1751
1751
|
let s = De;
|
|
1752
1752
|
if (l)
|
|
1753
1753
|
s = [];
|
|
@@ -1766,15 +1766,15 @@ function kl({
|
|
|
1766
1766
|
}, [z, De, Ct, $n, Wn, wr]), ne(() => {
|
|
1767
1767
|
const e = !!T;
|
|
1768
1768
|
De.forEach((r) => {
|
|
1769
|
-
if (
|
|
1769
|
+
if (je.current.has(r.id)) return;
|
|
1770
1770
|
const l = e ? 2500 : vr * 0.8 + kr * Math.min(r.batch, 24) + 250;
|
|
1771
|
-
|
|
1772
|
-
}),
|
|
1773
|
-
De.some((s) => s.id === l) || (clearTimeout(r),
|
|
1771
|
+
je.current.set(r.id, setTimeout(() => Bn(r.id), l));
|
|
1772
|
+
}), je.current.forEach((r, l) => {
|
|
1773
|
+
De.some((s) => s.id === l) || (clearTimeout(r), je.current.delete(l));
|
|
1774
1774
|
});
|
|
1775
1775
|
}, [De, vr, kr, T, Bn]), ne(
|
|
1776
1776
|
() => () => {
|
|
1777
|
-
|
|
1777
|
+
je.current.forEach((e) => clearTimeout(e)), je.current.clear();
|
|
1778
1778
|
},
|
|
1779
1779
|
[]
|
|
1780
1780
|
);
|
|
@@ -1787,10 +1787,10 @@ function kl({
|
|
|
1787
1787
|
const l = new ResizeObserver(r);
|
|
1788
1788
|
return l.observe(e), () => l.disconnect();
|
|
1789
1789
|
}, [ae]);
|
|
1790
|
-
const an = Object.keys(Dn).length > 0, cn = (e) => Dn[e.field] ?? (typeof e.width == "number" ? e.width :
|
|
1790
|
+
const an = Object.keys(Dn).length > 0, cn = (e) => Dn[e.field] ?? (typeof e.width == "number" ? e.width : bl), Jo = (e) => Math.max(40, typeof e.minWidth == "number" ? e.minWidth : 60), dn = (e) => e.overflow ?? (typeof e.width == "number" && e.width < 40 ? "clip" : e.width !== void 0 && e.width !== "" ? "wrap" : void 0), Dr = (e) => typeof e.width == "number" && e.width < 40 ? { paddingLeft: 0, paddingRight: 0 } : null, Zo = L.some((e) => e.width !== void 0 && e.width !== null && e.width !== ""), Qo = L.length > 0 && L.every((e) => typeof e.width == "number"), ei = (e, r) => {
|
|
1791
1791
|
e.preventDefault(), e.stopPropagation();
|
|
1792
1792
|
const l = { ...Dn };
|
|
1793
|
-
an ||
|
|
1793
|
+
an || L.forEach((R) => {
|
|
1794
1794
|
var ee;
|
|
1795
1795
|
return l[R.field] = ((ee = vt.current.get(R.field)) == null ? void 0 : ee.offsetWidth) ?? cn(R);
|
|
1796
1796
|
});
|
|
@@ -1804,11 +1804,11 @@ function kl({
|
|
|
1804
1804
|
Pt(() => {
|
|
1805
1805
|
var c, u;
|
|
1806
1806
|
const e = {};
|
|
1807
|
-
let r = fe &&
|
|
1808
|
-
for (const y of
|
|
1807
|
+
let r = fe && L.some((y) => y.pinned === "left") ? $e : 0;
|
|
1808
|
+
for (const y of L)
|
|
1809
1809
|
y.pinned === "left" && (e[y.field] = r, r += ((c = vt.current.get(y.field)) == null ? void 0 : c.offsetWidth) ?? 0);
|
|
1810
1810
|
let l = 0;
|
|
1811
|
-
for (const y of [...
|
|
1811
|
+
for (const y of [...L].reverse())
|
|
1812
1812
|
y.pinned === "right" && (e[y.field] = l, l += ((u = vt.current.get(y.field)) == null ? void 0 : u.offsetWidth) ?? 0);
|
|
1813
1813
|
const s = Object.keys(e);
|
|
1814
1814
|
(s.length !== Object.keys(Kt).length || s.some((y) => e[y] !== Kt[y])) && Eo(e);
|
|
@@ -1816,15 +1816,15 @@ function kl({
|
|
|
1816
1816
|
const e = () => Io((r) => r + 1);
|
|
1817
1817
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1818
1818
|
}, []);
|
|
1819
|
-
const Tr =
|
|
1819
|
+
const Tr = L.map((e) => e.pinned).lastIndexOf("left"), ti = L.findIndex((e) => e.pinned === "right"), un = Tr >= 0, Fr = (e, r) => ({
|
|
1820
1820
|
className: e.pinned ? U("rg-grid__pinned", `rg-grid__pinned--${e.pinned}`, r === Tr && "rg-grid__pinned--edge", r === ti && "rg-grid__pinned--edge") : void 0,
|
|
1821
1821
|
style: e.pinned === "left" ? { left: Kt[e.field] ?? 0 } : e.pinned === "right" ? { right: Kt[e.field] ?? 0 } : void 0
|
|
1822
|
-
}),
|
|
1822
|
+
}), Ke = typeof He == "object" ? He : {}, fn = ve(() => {
|
|
1823
1823
|
var r;
|
|
1824
|
-
const e = (r =
|
|
1824
|
+
const e = (r = Ke.formats) != null && r.length ? Ke.formats : ["csv"];
|
|
1825
1825
|
return e.filter((l, s) => e.indexOf(l) === s);
|
|
1826
1826
|
}, [He]), hn = (e = {}) => {
|
|
1827
|
-
const r = { ...
|
|
1827
|
+
const r = { ...Ke, ...e, pdf: { ...Ke.pdf, ...e.pdf } }, l = r.scope ?? "filtered", s = l === "page" || l === "visible", c = s ? z : l === "selected" ? Qe.filter((ye) => Zt.has(ye.id)) : Me, u = r.includeHidden ? t : L, y = s && A ? oe * re : 0, N = u.map((ye) => $t(ye) || ye.field), M = [], R = [], ee = [];
|
|
1828
1828
|
return c.forEach(({ row: ye }, jn) => {
|
|
1829
1829
|
const mn = [], $ = [], Ft = {};
|
|
1830
1830
|
u.forEach((J, Kn) => {
|
|
@@ -1841,15 +1841,15 @@ function kl({
|
|
|
1841
1841
|
}), { opts: r, cols: u, headers: N, display: M, typed: R, records: ee };
|
|
1842
1842
|
}, pn = (e, r) => `${e.filename ?? "export"}.${r}`, Er = (e = {}) => {
|
|
1843
1843
|
const r = hn(e);
|
|
1844
|
-
return
|
|
1844
|
+
return zi(r.headers, r.display, { sanitize: r.opts.sanitize });
|
|
1845
1845
|
}, Ir = (e = {}) => {
|
|
1846
|
-
const r = { ...
|
|
1847
|
-
|
|
1846
|
+
const r = { ...Ke, ...e };
|
|
1847
|
+
qi(Er(e), pn(r, "csv"));
|
|
1848
1848
|
}, Mr = (e = {}) => {
|
|
1849
1849
|
const r = hn(e);
|
|
1850
1850
|
return JSON.stringify(r.records, null, r.opts.jsonIndent ?? 2);
|
|
1851
1851
|
}, $r = (e = {}) => {
|
|
1852
|
-
const r = { ...
|
|
1852
|
+
const r = { ...Ke, ...e };
|
|
1853
1853
|
_n(new Blob([Mr(e)], { type: "application/json;charset=utf-8" }), pn(r, "json"));
|
|
1854
1854
|
}, Pr = async (e = {}) => {
|
|
1855
1855
|
const r = hn(e), l = r.cols.map((s) => ({
|
|
@@ -1857,9 +1857,9 @@ function kl({
|
|
|
1857
1857
|
kind: s.type === "number" || s.type === "sequence" ? "number" : s.type === "date" ? "date" : s.type === "boolean" ? "boolean" : "text",
|
|
1858
1858
|
align: s.align ?? (s.type === "number" || s.type === "sequence" ? "right" : void 0)
|
|
1859
1859
|
}));
|
|
1860
|
-
return
|
|
1860
|
+
return gl(l, r.typed, { sheetName: r.opts.sheetName });
|
|
1861
1861
|
}, Lr = async (e = {}) => {
|
|
1862
|
-
const r = { ...
|
|
1862
|
+
const r = { ...Ke, ...e };
|
|
1863
1863
|
_n(await Pr(e), pn(r, "xlsx"));
|
|
1864
1864
|
}, Or = async (e = {}) => {
|
|
1865
1865
|
var l;
|
|
@@ -1873,10 +1873,10 @@ function kl({
|
|
|
1873
1873
|
},
|
|
1874
1874
|
r.opts.pdf,
|
|
1875
1875
|
// Only when asked: read the grid's colours, stripes and borders from the page
|
|
1876
|
-
(l = r.opts.pdf) != null && l.matchGridStyle ?
|
|
1876
|
+
(l = r.opts.pdf) != null && l.matchGridStyle ? el(or.current) : void 0
|
|
1877
1877
|
);
|
|
1878
1878
|
}, Rr = async (e = {}) => {
|
|
1879
|
-
const r = { ...
|
|
1879
|
+
const r = { ...Ke, ...e };
|
|
1880
1880
|
_n(await Or(e), pn(r, "pdf"));
|
|
1881
1881
|
}, Ur = async (e, r = {}) => e === "csv" ? Ir(r) : e === "json" ? $r(r) : e === "xlsx" ? Lr(r) : Rr(r), Ar = async (e, r = {}) => {
|
|
1882
1882
|
try {
|
|
@@ -1885,14 +1885,14 @@ function kl({
|
|
|
1885
1885
|
const s = l instanceof Error ? l : new Error(String(l));
|
|
1886
1886
|
mt ? mt(s, e) : console.error(`[react-gridix] ${e.toUpperCase()} export failed:`, s);
|
|
1887
1887
|
}
|
|
1888
|
-
}, [Wr, ni] = j("visible"), ri =
|
|
1888
|
+
}, [Wr, ni] = j("visible"), ri = Qe.filter((e) => Zt.has(e.id)).length, Br = [
|
|
1889
1889
|
{ value: "visible", label: "Visible rows", count: z.length },
|
|
1890
1890
|
// Without pagination the visible rows already are every matching row
|
|
1891
1891
|
...A ? [{ value: "filtered", label: "All matching rows", count: Me.length }] : [],
|
|
1892
1892
|
...fe ? [{ value: "selected", label: "Selected rows", count: ri }] : []
|
|
1893
1893
|
], oi = Br.some((e) => e.value === Wr && e.count > 0) ? Wr : "visible";
|
|
1894
1894
|
ne(() => {
|
|
1895
|
-
|
|
1895
|
+
Oe && (Oe.current = {
|
|
1896
1896
|
getCsv: Er,
|
|
1897
1897
|
exportCsv: Ir,
|
|
1898
1898
|
getJson: Mr,
|
|
@@ -1912,9 +1912,9 @@ function kl({
|
|
|
1912
1912
|
});
|
|
1913
1913
|
}), ne(
|
|
1914
1914
|
() => () => {
|
|
1915
|
-
|
|
1915
|
+
Oe && (Oe.current = null);
|
|
1916
1916
|
},
|
|
1917
|
-
[
|
|
1917
|
+
[Oe]
|
|
1918
1918
|
);
|
|
1919
1919
|
const jr = (e) => {
|
|
1920
1920
|
var l, s, c, u, y, N, M, R;
|
|
@@ -1955,7 +1955,7 @@ function kl({
|
|
|
1955
1955
|
const R = Gn(u, e.field, r);
|
|
1956
1956
|
return s.push({ rowId: N.id, rowIndex: y, field: e.field, oldValue: M, newValue: r, row: R }), R;
|
|
1957
1957
|
});
|
|
1958
|
-
s.length !== 0 && (
|
|
1958
|
+
s.length !== 0 && (Qn(c), s.forEach((u) => d == null ? void 0 : d(u)), a == null || a(c));
|
|
1959
1959
|
}, si = (e) => {
|
|
1960
1960
|
const r = Kr(e), l = r.length > 0 ? r : Me, s = l.filter((u) => !!we(u.row, e.field)).length, c = l.length > 0 && s === l.length;
|
|
1961
1961
|
return /* @__PURE__ */ h("span", { className: "rg-grid__header-checkbox", onClick: tt, onDoubleClick: tt, children: /* @__PURE__ */ h(
|
|
@@ -1977,32 +1977,32 @@ function kl({
|
|
|
1977
1977
|
{
|
|
1978
1978
|
className: "rg-grid__custom-editor",
|
|
1979
1979
|
onBlur: (c) => {
|
|
1980
|
-
c.currentTarget.contains(c.relatedTarget) || l.session ===
|
|
1980
|
+
c.currentTarget.contains(c.relatedTarget) || l.session === Ue.current && (et(e, r, { value: zt.current }, { focus: !1 }) || Be());
|
|
1981
1981
|
},
|
|
1982
1982
|
onKeyDown: (c) => {
|
|
1983
|
-
c.key === "Escape" && (c.preventDefault(), c.stopPropagation(),
|
|
1983
|
+
c.key === "Escape" && (c.preventDefault(), c.stopPropagation(), Be(), rn(e.id, r.field));
|
|
1984
1984
|
},
|
|
1985
|
-
children:
|
|
1985
|
+
children: Pe(r.cellEditor, {
|
|
1986
1986
|
value: l.draft,
|
|
1987
1987
|
row: e.row,
|
|
1988
1988
|
rowIndex: e.index,
|
|
1989
1989
|
field: r.field,
|
|
1990
1990
|
column: r,
|
|
1991
1991
|
onChange: (c) => {
|
|
1992
|
-
zt.current = c,
|
|
1992
|
+
zt.current = c, Ze((u) => u && u.session === l.session ? { ...u, draft: c, invalid: !1 } : u);
|
|
1993
1993
|
},
|
|
1994
1994
|
onCommit: (c, u = "none") => {
|
|
1995
|
-
l.session ===
|
|
1995
|
+
l.session === Ue.current && et(e, r, { value: c === void 0 ? zt.current : c }, { move: u });
|
|
1996
1996
|
},
|
|
1997
1997
|
onCancel: () => {
|
|
1998
|
-
|
|
1998
|
+
Be(), rn(e.id, r.field);
|
|
1999
1999
|
}
|
|
2000
2000
|
})
|
|
2001
2001
|
}
|
|
2002
2002
|
);
|
|
2003
2003
|
const s = r.type === "date";
|
|
2004
2004
|
return s ? /* @__PURE__ */ h(
|
|
2005
|
-
|
|
2005
|
+
Ii,
|
|
2006
2006
|
{
|
|
2007
2007
|
value: l.draft === null || l.draft === void 0 ? "" : String(l.draft),
|
|
2008
2008
|
label: `Edit ${nt(r)}`,
|
|
@@ -2010,15 +2010,15 @@ function kl({
|
|
|
2010
2010
|
min: r.dateMin,
|
|
2011
2011
|
max: r.dateMax,
|
|
2012
2012
|
locale: r.dateLocale,
|
|
2013
|
-
theme:
|
|
2013
|
+
theme: Z,
|
|
2014
2014
|
className: U("rg-grid__editor", l.invalid && "rg-grid__editor--invalid", X.editor),
|
|
2015
2015
|
style: { textAlign: r.align, ...K.editor },
|
|
2016
|
-
onChange: (c) =>
|
|
2016
|
+
onChange: (c) => Ze((u) => u && { ...u, draft: c, invalid: !1 }),
|
|
2017
2017
|
onPick: (c) => {
|
|
2018
|
-
l.session ===
|
|
2018
|
+
l.session === Ue.current && et(e, r, { text: c }, { focus: !0 });
|
|
2019
2019
|
},
|
|
2020
2020
|
onBlur: (c) => {
|
|
2021
|
-
l.session ===
|
|
2021
|
+
l.session === Ue.current && (et(e, r, { text: c.currentTarget.value }, { focus: !1 }) || Be());
|
|
2022
2022
|
},
|
|
2023
2023
|
onKeyDown: (c) => br(c, e, r)
|
|
2024
2024
|
}
|
|
@@ -2037,16 +2037,16 @@ function kl({
|
|
|
2037
2037
|
"aria-invalid": l.invalid || void 0,
|
|
2038
2038
|
onChange: (c) => {
|
|
2039
2039
|
const u = c.target.value;
|
|
2040
|
-
|
|
2040
|
+
Ze((y) => y && { ...y, draft: u, invalid: !1 });
|
|
2041
2041
|
},
|
|
2042
2042
|
onFocus: (c) => {
|
|
2043
2043
|
const u = c.currentTarget;
|
|
2044
2044
|
s || (l.select === "all" ? u.select() : u.setSelectionRange(u.value.length, u.value.length));
|
|
2045
2045
|
},
|
|
2046
2046
|
onBlur: (c) => {
|
|
2047
|
-
if (l.session ===
|
|
2048
|
-
if (po(c.currentTarget)) return
|
|
2049
|
-
et(e, r, { text: c.currentTarget.value }, { focus: !1 }) ||
|
|
2047
|
+
if (l.session === Ue.current) {
|
|
2048
|
+
if (po(c.currentTarget)) return Be();
|
|
2049
|
+
et(e, r, { text: c.currentTarget.value }, { focus: !1 }) || Be();
|
|
2050
2050
|
}
|
|
2051
2051
|
},
|
|
2052
2052
|
onKeyDown: (c) => br(c, e, r)
|
|
@@ -2054,58 +2054,64 @@ function kl({
|
|
|
2054
2054
|
);
|
|
2055
2055
|
}, ci = ve(() => {
|
|
2056
2056
|
const e = /* @__PURE__ */ new Map();
|
|
2057
|
-
for (const r of
|
|
2058
|
-
r.filterable && !r.filterRenderer && Jr(r) === "select" && e.set(r.field,
|
|
2057
|
+
for (const r of L)
|
|
2058
|
+
r.filterable && !r.filterRenderer && Jr(r) === "select" && e.set(r.field, Pi(r, Bt, (l) => we(l, r.field), (l) => Mt(r, l)));
|
|
2059
2059
|
return e;
|
|
2060
|
-
}, [
|
|
2060
|
+
}, [L, Bt]), di = {
|
|
2061
2061
|
...Ge !== void 0 ? { "--rg-row-duration": `${Ge}ms`, "--rg-row-exit-duration": `${Math.round(Ge * 0.8)}ms` } : null,
|
|
2062
2062
|
...it !== void 0 ? { "--rg-row-stagger": `${it}ms` } : null
|
|
2063
|
-
}, ui = Ie || !!Se, fi = Se ? { "--rg-stripe-a": Se[0], "--rg-stripe-b": Se[1] } : void 0, hi =
|
|
2063
|
+
}, ui = Ie || !!Se, fi = Se ? { "--rg-stripe-a": Se[0], "--rg-stripe-b": Se[1] } : void 0, hi = Le && A && (V === "top" || V === "both"), pi = Le && A && (V === "bottom" || V === "both"), gi = ke && (C || !!yt || pt || !!He), zr = (e) => /* @__PURE__ */ I(
|
|
2064
2064
|
"div",
|
|
2065
2065
|
{
|
|
2066
2066
|
className: U("rg-grid__footer", e === "top" && "rg-grid__footer--top", X.footer),
|
|
2067
2067
|
style: K.footer,
|
|
2068
2068
|
"data-position": e,
|
|
2069
2069
|
children: [
|
|
2070
|
-
/* @__PURE__ */ I("span", { ...
|
|
2070
|
+
/* @__PURE__ */ I("span", { ...Q("rowCount", "rg-grid__count"), children: [
|
|
2071
2071
|
ut === 0 ? "0 rows" : `${Po}–${Lo} of ${ut}`,
|
|
2072
2072
|
fe && Ce.length > 0 ? ` · ${Ce.length} selected` : ""
|
|
2073
2073
|
] }),
|
|
2074
|
-
/* @__PURE__ */ I("div", { ...
|
|
2074
|
+
/* @__PURE__ */ I("div", { ...Q("pagination", "rg-grid__pagination"), children: [
|
|
2075
2075
|
/* @__PURE__ */ I("label", { className: "rg-grid__page-size-label", children: [
|
|
2076
2076
|
"Rows per page",
|
|
2077
|
-
/* @__PURE__ */ h("select", { value: re, onChange: (r) => Do(Number(r.target.value)), ...
|
|
2077
|
+
/* @__PURE__ */ h("select", { value: re, onChange: (r) => Do(Number(r.target.value)), ...Q("pageSize", "rg-grid__page-size"), children: (Fe.includes(re) ? Fe : [...Fe, re].sort((r, l) => r - l)).map((r) => /* @__PURE__ */ h("option", { value: r, children: r }, r)) })
|
|
2078
2078
|
] }),
|
|
2079
|
-
/* @__PURE__ */ h("button", { type: "button", "aria-label": "First page", disabled: oe === 0, onClick: () => ct(0), ...
|
|
2080
|
-
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Previous page", disabled: oe === 0, onClick: () => ct(oe - 1), ...
|
|
2081
|
-
/* @__PURE__ */ I("span", { ...
|
|
2079
|
+
/* @__PURE__ */ h("button", { type: "button", "aria-label": "First page", disabled: oe === 0, onClick: () => ct(0), ...Q("pageButton", "rg-grid__page-btn"), children: "«" }),
|
|
2080
|
+
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Previous page", disabled: oe === 0, onClick: () => ct(oe - 1), ...Q("pageButton", "rg-grid__page-btn"), children: "‹" }),
|
|
2081
|
+
/* @__PURE__ */ I("span", { ...Q("pageInfo", "rg-grid__page-info"), children: [
|
|
2082
2082
|
"Page ",
|
|
2083
2083
|
oe + 1,
|
|
2084
2084
|
" of ",
|
|
2085
|
-
|
|
2085
|
+
We
|
|
2086
2086
|
] }),
|
|
2087
|
-
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Next page", disabled: oe >=
|
|
2088
|
-
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Last page", disabled: oe >=
|
|
2087
|
+
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Next page", disabled: oe >= We - 1, onClick: () => ct(oe + 1), ...Q("pageButton", "rg-grid__page-btn"), children: "›" }),
|
|
2088
|
+
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Last page", disabled: oe >= We - 1, onClick: () => ct(We - 1), ...Q("pageButton", "rg-grid__page-btn"), children: "»" })
|
|
2089
2089
|
] })
|
|
2090
2090
|
]
|
|
2091
2091
|
}
|
|
2092
2092
|
), mi = (e, r, l) => {
|
|
2093
|
-
const s = r === null ? "default" : e.sortIndicator ?? Xe, c = s !== "default", u = Ut && s !== "arrow", y = s === "arrow" ? /* @__PURE__ */ h(
|
|
2093
|
+
const s = r === null ? "default" : e.sortIndicator ?? Xe, c = s !== "default", u = Ut && s !== "arrow", y = s === "arrow" ? /* @__PURE__ */ h(tl, { direction: r, priority: l }) : s !== "default" ? Pe(s, { column: e, direction: r, priority: l }) : (
|
|
2094
2094
|
// Default: ↕ before sorting, then one ▲ that turns into ▼ (or stays ▲ when not turning)
|
|
2095
2095
|
u ? r ? "▲" : "↕" : r === "asc" ? "▲" : r === "desc" ? "▼" : "↕"
|
|
2096
2096
|
);
|
|
2097
|
-
return /* @__PURE__ */ I("span", { ...
|
|
2098
|
-
u ? /* @__PURE__ */ h(
|
|
2097
|
+
return /* @__PURE__ */ I("span", { ...Q("sortIndicator", U("rg-grid__sort", c && "rg-grid__sort--custom")), "aria-hidden": "true", "data-direction": r ?? "none", children: [
|
|
2098
|
+
u ? /* @__PURE__ */ h(nl, { direction: r, children: y }) : y,
|
|
2099
2099
|
s === "default" && l !== void 0 && /* @__PURE__ */ h("sup", { className: "rg-grid__sort-order", children: l })
|
|
2100
2100
|
] });
|
|
2101
|
-
}, bi = (e) => /* @__PURE__ */ h("tr", { className: "rg-grid__tr rg-grid__skeleton-row", "aria-hidden": "true", style: de ? { height: me } : void 0, children: rt ? (
|
|
2101
|
+
}, bi = L.some((e) => e.skeleton), yi = (e) => /* @__PURE__ */ h("tr", { className: "rg-grid__tr rg-grid__skeleton-row", "aria-hidden": "true", style: de ? { height: me } : void 0, children: rt && !bi ? (
|
|
2102
2102
|
// A custom component draws the whole row content inside one wide cell
|
|
2103
|
-
/* @__PURE__ */ h("td", { colSpan: Nt, className: "rg-grid__td rg-grid__skeleton-cell", children:
|
|
2103
|
+
/* @__PURE__ */ h("td", { colSpan: Nt, className: "rg-grid__td rg-grid__skeleton-cell", children: Pe(rt, { rowIndex: e, columns: L }) })
|
|
2104
2104
|
) : /* @__PURE__ */ I(ht, { children: [
|
|
2105
|
-
fe && /* @__PURE__ */ h("td", { className: "rg-grid__td", children: /* @__PURE__ */ h("span", { ...
|
|
2106
|
-
|
|
2105
|
+
fe && /* @__PURE__ */ h("td", { className: "rg-grid__td", children: /* @__PURE__ */ h("span", { ...Q("skeleton", "rg-grid__skeleton"), style: { ...K.skeleton, width: 18 } }) }),
|
|
2106
|
+
L.map((r, l) => /* @__PURE__ */ h("td", { className: "rg-grid__td", style: { textAlign: r.align }, children: r.skeleton ? (
|
|
2107
|
+
// The column's own placeholder
|
|
2108
|
+
Pe(r.skeleton, { rowIndex: e, column: r })
|
|
2109
|
+
) : (
|
|
2110
|
+
/* Vary the bar widths a little so the placeholder does not look like a grid of identical stripes */
|
|
2111
|
+
/* @__PURE__ */ h("span", { ...Q("skeleton", "rg-grid__skeleton"), style: { ...K.skeleton, width: `${55 + (e * 7 + l * 13) % 35}%` } })
|
|
2112
|
+
) }, r.field))
|
|
2107
2113
|
] }) }, `sk${e}`), qr = (e, r, l = A && !e.sequenceRestartEachPage ? oe * re : 0) => (e.sequenceStart ?? 1) + l + r, Yr = (e, r, l) => {
|
|
2108
|
-
const { row: s, id: c, index: u } = e, y = !!l, N = typeof Sn == "function" ? Sn(s, u) : Sn, M = typeof Nn == "function" ? Nn(s, u) : Nn, R =
|
|
2114
|
+
const { row: s, id: c, index: u } = e, y = !!l, N = typeof Sn == "function" ? Sn(s, u) : Sn, M = typeof Nn == "function" ? Nn(s, u) : Nn, R = Zt.has(c), ee = typeof lt == "function" ? lt(s, u) : lt, ye = typeof T == "function" ? T(s, u) : T, jn = ee || (_r === "none" ? void 0 : U("rg-grid__row--enter", `rg-row-in--${_r}`)), mn = ye || U("rg-grid__row--exit", Un !== "none" && `rg-row-out--${Un}`);
|
|
2109
2115
|
return /* @__PURE__ */ I(
|
|
2110
2116
|
"tr",
|
|
2111
2117
|
{
|
|
@@ -2143,7 +2149,7 @@ function kl({
|
|
|
2143
2149
|
{
|
|
2144
2150
|
variant: ot,
|
|
2145
2151
|
checked: R,
|
|
2146
|
-
disabled: y || !
|
|
2152
|
+
disabled: y || !Qt(s),
|
|
2147
2153
|
"aria-label": fe === "single" ? "Select row" : `Select row ${u + 1}`,
|
|
2148
2154
|
onChange: ($) => Uo(e, $),
|
|
2149
2155
|
classNames: { root: X.checkbox, control: X.checkboxControl, indicator: X.checkboxIndicator },
|
|
@@ -2152,7 +2158,7 @@ function kl({
|
|
|
2152
2158
|
) })
|
|
2153
2159
|
}
|
|
2154
2160
|
),
|
|
2155
|
-
|
|
2161
|
+
L.map(($, Ft) => {
|
|
2156
2162
|
let J = Ao($, e);
|
|
2157
2163
|
if ($.type === "sequence") {
|
|
2158
2164
|
const Ne = qr($, r);
|
|
@@ -2181,7 +2187,7 @@ function kl({
|
|
|
2181
2187
|
Kn
|
|
2182
2188
|
),
|
|
2183
2189
|
style: { textAlign: $.align, ...Dr($), ...K.cell, ...$.style, ...te, ...bn.style },
|
|
2184
|
-
children: xe && kt && !y ? ai(e, $, kt) : $.cellRenderer ?
|
|
2190
|
+
children: xe && kt && !y ? ai(e, $, kt) : $.cellRenderer ? Pe($.cellRenderer, J) : $.type === "boolean" && !$.cellEditor ? ii($, J) : J.formattedValue
|
|
2185
2191
|
},
|
|
2186
2192
|
$.field
|
|
2187
2193
|
);
|
|
@@ -2190,8 +2196,8 @@ function kl({
|
|
|
2190
2196
|
},
|
|
2191
2197
|
y ? `ghost:${c}` : c
|
|
2192
2198
|
);
|
|
2193
|
-
},
|
|
2194
|
-
"--rg-sticky-offset":
|
|
2199
|
+
}, xi = Ae.trim() !== "" || dt.length > 0 ? "no-results" : "no-data", _i = qe ?? (A ? Math.min(re, 20) : 5), gn = (ae || Je) && P === void 0 && !de, wi = typeof Re == "number" ? `${Re}px` : Re, vi = gn ? {
|
|
2200
|
+
"--rg-sticky-offset": wi,
|
|
2195
2201
|
// The header sits just under the toolbar when the toolbar is sticky too
|
|
2196
2202
|
"--rg-sticky-toolbar-h": ae ? `${Xo}px` : "0px"
|
|
2197
2203
|
} : null;
|
|
@@ -2208,11 +2214,11 @@ function kl({
|
|
|
2208
2214
|
X.root,
|
|
2209
2215
|
Wt
|
|
2210
2216
|
),
|
|
2211
|
-
style: { ...fi, ...di, ...
|
|
2212
|
-
"data-rg-theme":
|
|
2217
|
+
style: { ...fi, ...di, ...vi, ...K.root, ...So },
|
|
2218
|
+
"data-rg-theme": Z || void 0,
|
|
2213
2219
|
"aria-busy": Ct || void 0,
|
|
2214
2220
|
children: [
|
|
2215
|
-
gi && /* @__PURE__ */ I("div", { ref: Cr, ...
|
|
2221
|
+
gi && /* @__PURE__ */ I("div", { ref: Cr, ...Q("toolbar", "rg-grid__toolbar"), children: [
|
|
2216
2222
|
/* @__PURE__ */ I("div", { className: "rg-grid__toolbar-left", children: [
|
|
2217
2223
|
C && /* @__PURE__ */ h(
|
|
2218
2224
|
"input",
|
|
@@ -2222,7 +2228,7 @@ function kl({
|
|
|
2222
2228
|
onChange: (e) => er(e.target.value),
|
|
2223
2229
|
placeholder: F,
|
|
2224
2230
|
"aria-label": "Search all columns",
|
|
2225
|
-
...
|
|
2231
|
+
...Q("search", "rg-grid__search")
|
|
2226
2232
|
}
|
|
2227
2233
|
),
|
|
2228
2234
|
fe && Ce.length > 0 && /* @__PURE__ */ I("span", { className: "rg-grid__selected-count", role: "status", children: [
|
|
@@ -2233,12 +2239,12 @@ function kl({
|
|
|
2233
2239
|
/* @__PURE__ */ I("div", { className: "rg-grid__toolbar-actions", children: [
|
|
2234
2240
|
yt,
|
|
2235
2241
|
pt && /* @__PURE__ */ h(
|
|
2236
|
-
|
|
2242
|
+
Bi,
|
|
2237
2243
|
{
|
|
2238
2244
|
columns: t,
|
|
2239
2245
|
hidden: jt,
|
|
2240
2246
|
onToggle: Fo,
|
|
2241
|
-
theme:
|
|
2247
|
+
theme: Z,
|
|
2242
2248
|
className: X.toolButton,
|
|
2243
2249
|
style: K.toolButton
|
|
2244
2250
|
}
|
|
@@ -2246,21 +2252,21 @@ function kl({
|
|
|
2246
2252
|
He && (fn.length > 1 ? (
|
|
2247
2253
|
// Several formats: a menu with "which rows" and one button per format
|
|
2248
2254
|
/* @__PURE__ */ h(
|
|
2249
|
-
|
|
2255
|
+
Hi,
|
|
2250
2256
|
{
|
|
2251
2257
|
formats: fn,
|
|
2252
2258
|
scopes: Br,
|
|
2253
2259
|
scope: oi,
|
|
2254
2260
|
onScopeChange: ni,
|
|
2255
2261
|
onExport: (e, r) => Ar(e, { scope: r }),
|
|
2256
|
-
theme:
|
|
2262
|
+
theme: Z,
|
|
2257
2263
|
className: U(X.toolButton, X.exportMenu),
|
|
2258
2264
|
style: { ...K.toolButton, ...K.exportMenu }
|
|
2259
2265
|
}
|
|
2260
2266
|
)
|
|
2261
2267
|
) : (
|
|
2262
2268
|
// One format: a plain button ("Export CSV"), using the scope from `exportable` (default: all matching rows)
|
|
2263
|
-
/* @__PURE__ */ h("button", { type: "button", onClick: () => Ar(fn[0]), ...
|
|
2269
|
+
/* @__PURE__ */ h("button", { type: "button", onClick: () => Ar(fn[0]), ...Q("toolButton", "rg-grid__tool-btn"), children: Vi(fn[0]) })
|
|
2264
2270
|
))
|
|
2265
2271
|
] })
|
|
2266
2272
|
] }),
|
|
@@ -2269,27 +2275,27 @@ function kl({
|
|
|
2269
2275
|
"div",
|
|
2270
2276
|
{
|
|
2271
2277
|
ref: St,
|
|
2272
|
-
...
|
|
2278
|
+
...Q("scroll", U("rg-grid__scroll", `rg-grid__scroll--${At}`)),
|
|
2273
2279
|
onScroll: de ? (e) => ir({ top: e.currentTarget.scrollTop, height: e.currentTarget.clientHeight }) : void 0,
|
|
2274
2280
|
style: { ...K.scroll, ...P !== void 0 ? { maxHeight: P } : de ? { maxHeight: 400 } : null },
|
|
2275
2281
|
children: /* @__PURE__ */ I(
|
|
2276
2282
|
"table",
|
|
2277
2283
|
{
|
|
2278
|
-
...
|
|
2284
|
+
...Q("table", "rg-grid__table"),
|
|
2279
2285
|
role: "grid",
|
|
2280
2286
|
style: an ? {
|
|
2281
2287
|
...K.table,
|
|
2282
2288
|
tableLayout: "fixed",
|
|
2283
|
-
width:
|
|
2289
|
+
width: L.reduce((e, r) => e + cn(r), fe ? $e : 0),
|
|
2284
2290
|
minWidth: "100%"
|
|
2285
|
-
} :
|
|
2291
|
+
} : Zo ? {
|
|
2286
2292
|
...K.table,
|
|
2287
2293
|
tableLayout: "fixed",
|
|
2288
2294
|
// Every width is a number: the table is exactly as wide as their sum (no stretching)
|
|
2289
|
-
...
|
|
2295
|
+
...Qo ? { width: L.reduce((e, r) => e + r.width, fe ? $e : 0) } : null
|
|
2290
2296
|
} : K.table,
|
|
2291
2297
|
children: [
|
|
2292
|
-
/* @__PURE__ */ h("thead", { ...
|
|
2298
|
+
/* @__PURE__ */ h("thead", { ...Q("thead", "rg-grid__thead"), children: /* @__PURE__ */ I("tr", { ...Q("headerRow", "rg-grid__tr"), children: [
|
|
2293
2299
|
fe && /* @__PURE__ */ h(
|
|
2294
2300
|
"th",
|
|
2295
2301
|
{
|
|
@@ -2311,7 +2317,7 @@ function kl({
|
|
|
2311
2317
|
) })
|
|
2312
2318
|
}
|
|
2313
2319
|
),
|
|
2314
|
-
|
|
2320
|
+
L.map((e, r) => {
|
|
2315
2321
|
const l = be.findIndex((N) => N.field === e.field), s = l >= 0 ? be[l].direction : null, c = In(e), u = sr(e), y = Fr(e, r);
|
|
2316
2322
|
return /* @__PURE__ */ I(
|
|
2317
2323
|
"th",
|
|
@@ -2340,9 +2346,9 @@ function kl({
|
|
|
2340
2346
|
},
|
|
2341
2347
|
children: [
|
|
2342
2348
|
/* @__PURE__ */ I("span", { className: "rg-grid__th-content", children: [
|
|
2343
|
-
e.headerRenderer ?
|
|
2349
|
+
e.headerRenderer ? Pe(e.headerRenderer, { column: e, sortDirection: s }) : e.headerCheckbox && e.type === "boolean" ? si(e) : /* @__PURE__ */ h("span", { className: "rg-grid__th-label", children: $t(e) }),
|
|
2344
2350
|
e.filterable && /* @__PURE__ */ h(
|
|
2345
|
-
|
|
2351
|
+
Wi,
|
|
2346
2352
|
{
|
|
2347
2353
|
column: e,
|
|
2348
2354
|
label: nt(e),
|
|
@@ -2354,7 +2360,7 @@ function kl({
|
|
|
2354
2360
|
},
|
|
2355
2361
|
options: ci.get(e.field) ?? [],
|
|
2356
2362
|
debounce: e.filterDebounce ?? ce,
|
|
2357
|
-
theme:
|
|
2363
|
+
theme: Z,
|
|
2358
2364
|
indicatorClassName: U(X.filterIndicator, e.filterIndicatorClassName),
|
|
2359
2365
|
indicatorStyle: { ...K.filterIndicator, ...e.filterIndicatorStyle },
|
|
2360
2366
|
popupClassName: U(X.filterPopup, e.filterPopupClassName),
|
|
@@ -2383,15 +2389,15 @@ function kl({
|
|
|
2383
2389
|
);
|
|
2384
2390
|
})
|
|
2385
2391
|
] }) }),
|
|
2386
|
-
/* @__PURE__ */ h("tbody", { ...
|
|
2392
|
+
/* @__PURE__ */ h("tbody", { ...Q("tbody", "rg-grid__tbody"), children: Ct ? Array.from({ length: _i }, (e, r) => yi(r)) : $n ? /* @__PURE__ */ h("tr", { children: /* @__PURE__ */ I("td", { colSpan: Nt, ...Q("empty", "rg-grid__empty rg-grid__error"), role: "alert", children: [
|
|
2387
2393
|
Ot,
|
|
2388
2394
|
" ",
|
|
2389
2395
|
/* @__PURE__ */ h("button", { type: "button", className: "rg-grid__tool-btn", onClick: () => Gt(Vt.current), children: "Retry" })
|
|
2390
|
-
] }) }) : z.length === 0 && De.length === 0 ? /* @__PURE__ */ h("tr", { children: /* @__PURE__ */ h("td", { colSpan: Nt, ...
|
|
2391
|
-
reason:
|
|
2392
|
-
search:
|
|
2396
|
+
] }) }) : z.length === 0 && De.length === 0 ? /* @__PURE__ */ h("tr", { children: /* @__PURE__ */ h("td", { colSpan: Nt, ...Q("empty", U("rg-grid__empty", xt && "rg-grid__empty--custom")), children: xt ? Pe(xt, {
|
|
2397
|
+
reason: xi,
|
|
2398
|
+
search: Ae.trim(),
|
|
2393
2399
|
filters: Object.fromEntries(dt),
|
|
2394
|
-
columns:
|
|
2400
|
+
columns: L,
|
|
2395
2401
|
clearAll: () => {
|
|
2396
2402
|
er(""), tr({});
|
|
2397
2403
|
}
|
|
@@ -2412,6 +2418,6 @@ function kl({
|
|
|
2412
2418
|
}
|
|
2413
2419
|
export {
|
|
2414
2420
|
ft as Checkbox,
|
|
2415
|
-
|
|
2416
|
-
|
|
2421
|
+
Sl as DataGrid,
|
|
2422
|
+
tl as SortArrow
|
|
2417
2423
|
};
|