react-gridix 0.2.7 → 0.2.9
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 +44 -0
- package/dist/index.d.ts +35 -2
- package/dist/react-gridix.cjs +5 -5
- package/dist/react-gridix.js +985 -944
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/react-gridix.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as I, jsx as h, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
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 vi, createElement as Ke, useId as ki } from "react";
|
|
3
|
+
import { createPortal as Si } from "react-dom";
|
|
4
|
+
const Et = (...t) => t.filter(Boolean).join(" ");
|
|
5
|
+
function Ni() {
|
|
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,15 +15,15 @@ function ci() {
|
|
|
15
15
|
}
|
|
16
16
|
) });
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function Ci() {
|
|
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
|
-
function
|
|
21
|
+
function ft({
|
|
22
22
|
checked: t,
|
|
23
23
|
onChange: n,
|
|
24
24
|
indeterminate: i = !1,
|
|
25
25
|
variant: o = "native",
|
|
26
|
-
disabled:
|
|
26
|
+
disabled: f = !1,
|
|
27
27
|
label: d,
|
|
28
28
|
"aria-label": a,
|
|
29
29
|
id: g,
|
|
@@ -38,12 +38,12 @@ function ht({
|
|
|
38
38
|
return /* @__PURE__ */ I(
|
|
39
39
|
"label",
|
|
40
40
|
{
|
|
41
|
-
className:
|
|
41
|
+
className: Et(
|
|
42
42
|
"rg-checkbox",
|
|
43
43
|
`rg-checkbox--${o}`,
|
|
44
44
|
k === "checked" && "rg-checkbox--checked",
|
|
45
45
|
i && "rg-checkbox--indeterminate",
|
|
46
|
-
|
|
46
|
+
f && "rg-checkbox--disabled",
|
|
47
47
|
v.root,
|
|
48
48
|
E
|
|
49
49
|
),
|
|
@@ -59,10 +59,10 @@ function ht({
|
|
|
59
59
|
ref: (D) => {
|
|
60
60
|
D && (D.indeterminate = i);
|
|
61
61
|
},
|
|
62
|
-
className:
|
|
62
|
+
className: Et("rg-checkbox__control", v.control),
|
|
63
63
|
style: p.control,
|
|
64
64
|
checked: t,
|
|
65
|
-
disabled:
|
|
65
|
+
disabled: f,
|
|
66
66
|
"aria-label": a,
|
|
67
67
|
"data-state": k,
|
|
68
68
|
onChange: (D) => n(D.target.checked)
|
|
@@ -73,17 +73,17 @@ function ht({
|
|
|
73
73
|
type: "button",
|
|
74
74
|
role: "checkbox",
|
|
75
75
|
id: g,
|
|
76
|
-
className:
|
|
76
|
+
className: Et("rg-checkbox__control", v.control),
|
|
77
77
|
style: p.control,
|
|
78
78
|
"aria-checked": i ? "mixed" : t,
|
|
79
79
|
"aria-label": a,
|
|
80
|
-
disabled:
|
|
80
|
+
disabled: f,
|
|
81
81
|
"data-state": k,
|
|
82
82
|
onClick: () => n(!t),
|
|
83
83
|
children: /* @__PURE__ */ h(
|
|
84
84
|
"span",
|
|
85
85
|
{
|
|
86
|
-
className:
|
|
86
|
+
className: Et(
|
|
87
87
|
"rg-checkbox__indicator",
|
|
88
88
|
x !== void 0 && !i && "rg-checkbox__indicator--custom",
|
|
89
89
|
v.indicator
|
|
@@ -91,83 +91,83 @@ function ht({
|
|
|
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(Ci, {}) : null : x !== void 0 ? x : o === "tick" ? /* @__PURE__ */ h(Ni, {}) : null
|
|
95
95
|
}
|
|
96
96
|
)
|
|
97
97
|
}
|
|
98
98
|
),
|
|
99
|
-
d != null && d !== !1 && d !== "" && /* @__PURE__ */ h("span", { className:
|
|
99
|
+
d != null && d !== !1 && d !== "" && /* @__PURE__ */ h("span", { className: Et("rg-checkbox__label", v.label), style: p.label, children: d })
|
|
100
100
|
]
|
|
101
101
|
}
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
function
|
|
106
|
-
const n =
|
|
104
|
+
const Di = /^(\d{4})-(\d{2})-(\d{2})$/, Hr = (t) => String(t).padStart(2, "0");
|
|
105
|
+
function le(t) {
|
|
106
|
+
const n = Di.exec(t);
|
|
107
107
|
if (!n) return null;
|
|
108
|
-
const [i, o,
|
|
109
|
-
return d.getFullYear() === i && d.getMonth() === o - 1 && d.getDate() ===
|
|
108
|
+
const [i, o, f] = [Number(n[1]), Number(n[2]), Number(n[3])], d = new Date(i, o - 1, f);
|
|
109
|
+
return d.getFullYear() === i && d.getMonth() === o - 1 && d.getDate() === f ? d : null;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function pe(t) {
|
|
112
112
|
var n;
|
|
113
113
|
if (t instanceof Date)
|
|
114
|
-
return Number.isNaN(t.getTime()) ? null : `${t.getFullYear()}-${
|
|
115
|
-
if (typeof t == "number") return Number.isFinite(t) ?
|
|
114
|
+
return Number.isNaN(t.getTime()) ? null : `${t.getFullYear()}-${Hr(t.getMonth() + 1)}-${Hr(t.getDate())}`;
|
|
115
|
+
if (typeof t == "number") return Number.isFinite(t) ? pe(new Date(t)) : null;
|
|
116
116
|
if (typeof t == "string") {
|
|
117
117
|
const i = t.trim();
|
|
118
118
|
if (i === "") return null;
|
|
119
119
|
const o = (n = /^\d{4}-\d{2}-\d{2}/.exec(i)) == null ? void 0 : n[0];
|
|
120
|
-
if (o) return
|
|
121
|
-
const
|
|
122
|
-
return Number.isNaN(
|
|
120
|
+
if (o) return le(o) ? o : null;
|
|
121
|
+
const f = Date.parse(i);
|
|
122
|
+
return Number.isNaN(f) ? null : pe(new Date(f));
|
|
123
123
|
}
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
const o =
|
|
128
|
-
return o ?
|
|
126
|
+
function Ti(t, n, i) {
|
|
127
|
+
const o = pe(t);
|
|
128
|
+
return o ? le(o).toLocaleDateString(n, i ?? { year: "numeric", month: "short", day: "numeric" }) : t == null ? "" : String(t);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Fi(t, n) {
|
|
131
131
|
var i;
|
|
132
|
-
return t === "" ? null : n instanceof Date ?
|
|
132
|
+
return t === "" ? null : n instanceof Date ? le(t) : typeof n == "number" ? ((i = le(t)) == null ? void 0 : i.getTime()) ?? null : t;
|
|
133
133
|
}
|
|
134
|
-
const U = (...t) => t.filter(Boolean).join(" "),
|
|
135
|
-
function
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
134
|
+
const U = (...t) => t.filter(Boolean).join(" "), $t = (t) => t.headerName ?? (t.type === "boolean" ? "" : t.type === "sequence" ? "#" : t.field), nt = (t) => $t(t) || t.field, Xr = (t) => String(t).padStart(2, "0"), zn = (t, n, i) => `${t}-${Xr(n + 1)}-${Xr(i)}`;
|
|
135
|
+
function Gr(t, n, i, o) {
|
|
136
|
+
const f = [t, n == null ? void 0 : n.from, n == null ? void 0 : n.to].map((m) => m ? le(m) : null).find(Boolean);
|
|
137
|
+
if (f) return new Date(f.getFullYear(), f.getMonth(), 1);
|
|
138
138
|
const d = /* @__PURE__ */ new Date();
|
|
139
|
-
let a =
|
|
139
|
+
let a = pe(d);
|
|
140
140
|
i && a < i && (a = i), o && a > o && (a = o);
|
|
141
|
-
const g =
|
|
141
|
+
const g = le(a) ?? d;
|
|
142
142
|
return new Date(g.getFullYear(), g.getMonth(), 1);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
var
|
|
146
|
-
const [E, b] =
|
|
144
|
+
function go({ value: t, range: n, min: i, max: o, onPick: f, locale: d, weekStart: a = 0, hideFooter: g, keepFocus: m, className: x }) {
|
|
145
|
+
var Ee;
|
|
146
|
+
const [E, b] = j(() => Gr(t, n, i, o)), [v, p] = j(null), k = W(null), D = W({ value: t, from: n == null ? void 0 : n.from, to: n == null ? void 0 : n.to });
|
|
147
147
|
ne(() => {
|
|
148
148
|
const _ = D.current;
|
|
149
149
|
D.current = { value: t, from: n == null ? void 0 : n.from, to: n == null ? void 0 : n.to };
|
|
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 ?
|
|
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 =
|
|
153
|
+
const C = pe(/* @__PURE__ */ new Date()), F = E.getFullYear(), w = E.getMonth(), L = 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
|
-
}, [d, a]),
|
|
157
|
-
const _ = (new Date(
|
|
156
|
+
}, [d, a]), H = new Intl.DateTimeFormat(d, { month: "long", year: "numeric" }).format(E), q = ve(() => {
|
|
157
|
+
const _ = (new Date(F, w, 1).getDay() - a + 7) % 7;
|
|
158
158
|
return Array.from({ length: 42 }, (G, S) => {
|
|
159
|
-
const B = new Date(
|
|
160
|
-
return { iso:
|
|
159
|
+
const B = new Date(F, w, 1 - _ + S);
|
|
160
|
+
return { iso: zn(B.getFullYear(), B.getMonth(), B.getDate()), day: B.getDate(), outside: B.getMonth() !== w };
|
|
161
161
|
});
|
|
162
|
-
}, [
|
|
163
|
-
const G =
|
|
164
|
-
G && ((G.getFullYear() !==
|
|
162
|
+
}, [F, w, a]), A = (_) => !!i && _ < i || !!o && _ > o, V = (_) => b(new Date(F, w + _, 1)), ke = (_) => {
|
|
163
|
+
const G = le(_);
|
|
164
|
+
G && ((G.getFullYear() !== F || G.getMonth() !== w) && b(new Date(G.getFullYear(), G.getMonth(), 1)), p(_), requestAnimationFrame(() => {
|
|
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
|
}, Pe = (_, G) => {
|
|
169
|
-
const S =
|
|
170
|
-
_.preventDefault(),
|
|
169
|
+
const S = le(G), B = (ce) => {
|
|
170
|
+
_.preventDefault(), ke(zn(S.getFullYear(), S.getMonth(), S.getDate() + ce));
|
|
171
171
|
};
|
|
172
172
|
switch (_.key) {
|
|
173
173
|
case "ArrowLeft":
|
|
@@ -185,51 +185,51 @@ function lo({ value: t, range: n, min: i, max: o, onPick: u, locale: d, weekStar
|
|
|
185
185
|
case "PageUp":
|
|
186
186
|
case "PageDown": {
|
|
187
187
|
_.preventDefault();
|
|
188
|
-
const ce = _.key === "PageUp" ? -1 : 1,
|
|
189
|
-
|
|
188
|
+
const ce = _.key === "PageUp" ? -1 : 1, ge = new Date(S.getFullYear(), S.getMonth() + ce + 1, 0).getDate();
|
|
189
|
+
ke(zn(S.getFullYear(), S.getMonth() + ce, Math.min(S.getDate(), ge)));
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
}, ze = (_) => !!_ && q.some((G) => G.iso === _ && !G.outside),
|
|
193
|
+
}, ze = (_) => !!_ && q.some((G) => G.iso === _ && !G.outside), Fe = [v, t, C].find((_) => ze(_) && !A(_)) ?? ((Ee = q.find((_) => !_.outside && !A(_.iso))) == null ? void 0 : Ee.iso), Y = n == null ? void 0 : n.from, se = n == null ? void 0 : n.to;
|
|
194
194
|
return /* @__PURE__ */ I(
|
|
195
195
|
"div",
|
|
196
196
|
{
|
|
197
197
|
className: U("rg-cal", x),
|
|
198
198
|
onMouseDown: m ? (_) => _.preventDefault() : void 0,
|
|
199
199
|
role: "group",
|
|
200
|
-
"aria-label": `Calendar, ${
|
|
200
|
+
"aria-label": `Calendar, ${H}`,
|
|
201
201
|
children: [
|
|
202
202
|
/* @__PURE__ */ I("div", { className: "rg-cal__head", children: [
|
|
203
|
-
/* @__PURE__ */ h("button", { type: "button", className: "rg-cal__nav", "aria-label": "Previous year", onClick: () =>
|
|
204
|
-
/* @__PURE__ */ h("button", { type: "button", className: "rg-cal__nav", "aria-label": "Previous month", onClick: () =>
|
|
205
|
-
/* @__PURE__ */ h("span", { className: "rg-cal__title", "aria-live": "polite", children:
|
|
206
|
-
/* @__PURE__ */ h("button", { type: "button", className: "rg-cal__nav", "aria-label": "Next month", onClick: () =>
|
|
207
|
-
/* @__PURE__ */ h("button", { type: "button", className: "rg-cal__nav", "aria-label": "Next year", onClick: () =>
|
|
203
|
+
/* @__PURE__ */ h("button", { type: "button", className: "rg-cal__nav", "aria-label": "Previous year", onClick: () => V(-12), children: "«" }),
|
|
204
|
+
/* @__PURE__ */ h("button", { type: "button", className: "rg-cal__nav", "aria-label": "Previous month", onClick: () => V(-1), children: "‹" }),
|
|
205
|
+
/* @__PURE__ */ h("span", { className: "rg-cal__title", "aria-live": "polite", children: H }),
|
|
206
|
+
/* @__PURE__ */ h("button", { type: "button", className: "rg-cal__nav", "aria-label": "Next month", onClick: () => V(1), children: "›" }),
|
|
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
|
+
L.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
|
-
const B = _ === t, ce = _ ===
|
|
212
|
+
const B = _ === t, ce = _ === Y, ge = _ === se, qe = !!Y && !!se && _ > Y && _ < se;
|
|
213
213
|
return /* @__PURE__ */ h(
|
|
214
214
|
"button",
|
|
215
215
|
{
|
|
216
216
|
type: "button",
|
|
217
217
|
"data-iso": _,
|
|
218
|
-
tabIndex: _ ===
|
|
219
|
-
disabled:
|
|
220
|
-
"aria-pressed": B || ce ||
|
|
221
|
-
"aria-label": new Intl.DateTimeFormat(d, { dateStyle: "full" }).format(
|
|
218
|
+
tabIndex: _ === Fe ? 0 : -1,
|
|
219
|
+
disabled: A(_),
|
|
220
|
+
"aria-pressed": B || ce || ge,
|
|
221
|
+
"aria-label": new Intl.DateTimeFormat(d, { dateStyle: "full" }).format(le(_)),
|
|
222
222
|
className: U(
|
|
223
223
|
"rg-cal__day",
|
|
224
224
|
S && "rg-cal__day--outside",
|
|
225
225
|
_ === C && "rg-cal__day--today",
|
|
226
|
-
(B || ce ||
|
|
226
|
+
(B || ce || ge) && "rg-cal__day--selected",
|
|
227
227
|
qe && "rg-cal__day--in-range",
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
Y && se && ce && Y !== se && "rg-cal__day--range-start",
|
|
229
|
+
Y && se && ge && Y !== se && "rg-cal__day--range-end"
|
|
230
230
|
),
|
|
231
|
-
onClick: () =>
|
|
232
|
-
onKeyDown: (
|
|
231
|
+
onClick: () => f(_),
|
|
232
|
+
onKeyDown: (rt) => Pe(rt, _),
|
|
233
233
|
onFocus: () => p(_),
|
|
234
234
|
children: G
|
|
235
235
|
},
|
|
@@ -243,66 +243,66 @@ function lo({ value: t, range: n, min: i, max: o, onPick: u, locale: d, weekStar
|
|
|
243
243
|
{
|
|
244
244
|
type: "button",
|
|
245
245
|
className: "rg-cal__link",
|
|
246
|
-
disabled:
|
|
246
|
+
disabled: A(C),
|
|
247
247
|
onClick: () => {
|
|
248
|
-
b(
|
|
248
|
+
b(Gr(C)), f(C);
|
|
249
249
|
},
|
|
250
250
|
children: "Today"
|
|
251
251
|
}
|
|
252
252
|
),
|
|
253
|
-
/* @__PURE__ */ h("button", { type: "button", className: "rg-cal__link", onClick: () =>
|
|
253
|
+
/* @__PURE__ */ h("button", { type: "button", className: "rg-cal__link", onClick: () => f(""), children: "Clear" })
|
|
254
254
|
] })
|
|
255
255
|
]
|
|
256
256
|
}
|
|
257
257
|
);
|
|
258
258
|
}
|
|
259
|
-
const
|
|
260
|
-
function
|
|
261
|
-
const [o,
|
|
259
|
+
const Pt = typeof window < "u" ? vi : ne;
|
|
260
|
+
function It(t, n, i) {
|
|
261
|
+
const [o, f] = j(n), d = t !== void 0, a = d ? t : o, g = Te(
|
|
262
262
|
(m) => {
|
|
263
|
-
d ||
|
|
263
|
+
d || f(m), i == null || i(m);
|
|
264
264
|
},
|
|
265
265
|
[d, i]
|
|
266
266
|
);
|
|
267
267
|
return [a, g];
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
const i =
|
|
269
|
+
function mo(t, n) {
|
|
270
|
+
const i = W(t);
|
|
271
271
|
i.current = t;
|
|
272
|
-
const o =
|
|
273
|
-
o.current !== void 0 && clearTimeout(o.current), o.current = void 0,
|
|
274
|
-
}, []), a =
|
|
272
|
+
const o = W(void 0), f = W(null), d = Te(() => {
|
|
273
|
+
o.current !== void 0 && clearTimeout(o.current), o.current = void 0, f.current = null;
|
|
274
|
+
}, []), a = Te(() => {
|
|
275
275
|
o.current !== void 0 && clearTimeout(o.current), o.current = void 0;
|
|
276
|
-
const m =
|
|
277
|
-
|
|
278
|
-
}, []), g =
|
|
276
|
+
const m = f.current;
|
|
277
|
+
f.current = null, m && i.current(...m);
|
|
278
|
+
}, []), g = Te(
|
|
279
279
|
(...m) => {
|
|
280
280
|
if (n <= 0) {
|
|
281
281
|
d(), i.current(...m);
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
|
-
|
|
284
|
+
f.current = m, o.current !== void 0 && clearTimeout(o.current), o.current = setTimeout(a, n);
|
|
285
285
|
},
|
|
286
286
|
[n, d, a]
|
|
287
287
|
);
|
|
288
288
|
return ne(() => a, [a]), { call: g, flush: a, cancel: d };
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
const x =
|
|
292
|
-
var
|
|
290
|
+
function kn({ anchorRef: t, open: n, onClose: i, label: o, theme: f, className: d, style: a, keepFocus: g, children: m }) {
|
|
291
|
+
const x = W(null), [E, b] = j({ top: 0, left: 0 }), v = Te(() => {
|
|
292
|
+
var F;
|
|
293
293
|
const p = t.current;
|
|
294
294
|
if (!p) return;
|
|
295
|
-
const k = p.getBoundingClientRect(), D = ((
|
|
295
|
+
const k = p.getBoundingClientRect(), D = ((F = x.current) == null ? void 0 : F.offsetWidth) ?? 260, C = Math.max(8, Math.min(k.left, window.innerWidth - D - 8));
|
|
296
296
|
b({ top: k.bottom + 6, left: C });
|
|
297
297
|
}, [t]);
|
|
298
|
-
return
|
|
298
|
+
return Pt(() => {
|
|
299
299
|
n && v();
|
|
300
300
|
}, [n, v]), ne(() => {
|
|
301
301
|
if (!n) return;
|
|
302
302
|
const p = (D) => {
|
|
303
|
-
var
|
|
303
|
+
var F, w;
|
|
304
304
|
const C = D.target;
|
|
305
|
-
(
|
|
305
|
+
(F = x.current) != null && F.contains(C) || (w = t.current) != null && w.contains(C) || i();
|
|
306
306
|
}, k = (D) => {
|
|
307
307
|
var C;
|
|
308
308
|
D.key === "Escape" && (i(), (C = t.current) == null || C.focus());
|
|
@@ -310,7 +310,7 @@ function yn({ anchorRef: t, open: n, onClose: i, label: o, theme: u, 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 : Si(
|
|
314
314
|
/* @__PURE__ */ h(
|
|
315
315
|
"div",
|
|
316
316
|
{
|
|
@@ -318,7 +318,7 @@ function yn({ anchorRef: t, open: n, onClose: i, label: o, theme: u, className:
|
|
|
318
318
|
role: "dialog",
|
|
319
319
|
onMouseDown: g ? (p) => p.preventDefault() : void 0,
|
|
320
320
|
"aria-label": o,
|
|
321
|
-
"data-rg-theme":
|
|
321
|
+
"data-rg-theme": f || void 0,
|
|
322
322
|
className: U("rg-grid-popup", d),
|
|
323
323
|
style: { position: "fixed", top: E.top, left: E.left, ...a },
|
|
324
324
|
children: m
|
|
@@ -327,9 +327,9 @@ function yn({ anchorRef: t, open: n, onClose: i, label: o, theme: u, className:
|
|
|
327
327
|
document.body
|
|
328
328
|
);
|
|
329
329
|
}
|
|
330
|
-
function
|
|
331
|
-
const p =
|
|
332
|
-
return /* @__PURE__ */ I(
|
|
330
|
+
function Ei({ 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
|
+
const p = W(null);
|
|
332
|
+
return /* @__PURE__ */ I(ht, { children: [
|
|
333
333
|
/* @__PURE__ */ h(
|
|
334
334
|
"input",
|
|
335
335
|
{
|
|
@@ -349,24 +349,24 @@ function pi({ value: t, onChange: n, onPick: i, onBlur: o, onKeyDown: u, min: d,
|
|
|
349
349
|
onChange: (D) => n(D.target.value.trim()),
|
|
350
350
|
onBlur: o,
|
|
351
351
|
onKeyDown: (D) => {
|
|
352
|
-
const C = D.ctrlKey || D.altKey || D.metaKey,
|
|
353
|
-
if (!
|
|
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
|
+
if (!F || D.shiftKey) return f(D);
|
|
354
354
|
D.preventDefault();
|
|
355
|
-
const w =
|
|
356
|
-
let q =
|
|
355
|
+
const w = le(t) ?? /* @__PURE__ */ new Date(), L = new Date(w.getFullYear(), w.getMonth() + F.months + 1, 0).getDate(), H = new Date(w.getFullYear(), w.getMonth() + F.months, Math.min(w.getDate(), L) + F.days);
|
|
356
|
+
let q = pe(H);
|
|
357
357
|
d && q < d && (q = d), a && q > a && (q = a), n(q);
|
|
358
358
|
},
|
|
359
359
|
onFocus: (D) => D.currentTarget.setSelectionRange(D.currentTarget.value.length, D.currentTarget.value.length)
|
|
360
360
|
}
|
|
361
361
|
),
|
|
362
|
-
/* @__PURE__ */ h(
|
|
363
|
-
}, label: x, theme: E, className: "rg-date-popup", keepFocus: !0, children: /* @__PURE__ */ h(
|
|
362
|
+
/* @__PURE__ */ h(kn, { anchorRef: p, open: !0, onClose: () => {
|
|
363
|
+
}, label: x, theme: E, className: "rg-date-popup", keepFocus: !0, children: /* @__PURE__ */ h(go, { value: t, min: d, max: a, locale: g, onPick: i, keepFocus: !0 }) })
|
|
364
364
|
] });
|
|
365
365
|
}
|
|
366
|
-
function
|
|
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 Qr = [
|
|
370
370
|
"contains",
|
|
371
371
|
"notContains",
|
|
372
372
|
"equals",
|
|
@@ -375,7 +375,7 @@ const zr = [
|
|
|
375
375
|
"notStartsWith",
|
|
376
376
|
"endsWith",
|
|
377
377
|
"notEndsWith"
|
|
378
|
-
],
|
|
378
|
+
], Zr = {
|
|
379
379
|
contains: "Contains",
|
|
380
380
|
notContains: "Does not contain",
|
|
381
381
|
equals: "Equals",
|
|
@@ -385,102 +385,102 @@ const zr = [
|
|
|
385
385
|
endsWith: "Ends with",
|
|
386
386
|
notEndsWith: "Does not end with"
|
|
387
387
|
};
|
|
388
|
-
function
|
|
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 Qr;
|
|
392
|
+
const i = Qr.filter((o) => n.includes(o));
|
|
393
393
|
return i.length > 0 ? i : null;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
const i =
|
|
395
|
+
function Ii(t, n) {
|
|
396
|
+
const i = bo(t), o = t.filterOperator ?? (n === "exact" ? "equals" : "contains");
|
|
397
397
|
return i && !i.includes(o) ? i[0] : o;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
400
|
-
const o = n.toLowerCase(),
|
|
399
|
+
function eo(t, n, i) {
|
|
400
|
+
const o = n.toLowerCase(), f = i.trim().toLowerCase();
|
|
401
401
|
switch (t) {
|
|
402
402
|
case "contains":
|
|
403
|
-
return o.includes(
|
|
403
|
+
return o.includes(f);
|
|
404
404
|
case "notContains":
|
|
405
|
-
return !o.includes(
|
|
405
|
+
return !o.includes(f);
|
|
406
406
|
case "equals":
|
|
407
|
-
return o ===
|
|
407
|
+
return o === f;
|
|
408
408
|
case "notEquals":
|
|
409
|
-
return o !==
|
|
409
|
+
return o !== f;
|
|
410
410
|
case "startsWith":
|
|
411
|
-
return o.startsWith(
|
|
411
|
+
return o.startsWith(f);
|
|
412
412
|
case "notStartsWith":
|
|
413
|
-
return !o.startsWith(
|
|
413
|
+
return !o.startsWith(f);
|
|
414
414
|
case "endsWith":
|
|
415
|
-
return o.endsWith(
|
|
415
|
+
return o.endsWith(f);
|
|
416
416
|
case "notEndsWith":
|
|
417
|
-
return !o.endsWith(
|
|
417
|
+
return !o.endsWith(f);
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
const
|
|
421
|
-
function
|
|
420
|
+
const yo = (t) => typeof t == "object" && t !== null && !Array.isArray(t);
|
|
421
|
+
function xo(t) {
|
|
422
422
|
if (t == null) return !1;
|
|
423
423
|
if (typeof t == "string") return t.trim() !== "";
|
|
424
424
|
if (Array.isArray(t)) return t.length > 0;
|
|
425
|
-
if (
|
|
425
|
+
if (yo(t)) {
|
|
426
426
|
const n = t;
|
|
427
427
|
return typeof n.operator == "string" ? typeof n.value == "string" && n.value.trim() !== "" : typeof n.min == "number" || typeof n.max == "number" || !!n.from || !!n.to;
|
|
428
428
|
}
|
|
429
429
|
return !1;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function Mi(t, n, i, o) {
|
|
432
432
|
switch (t) {
|
|
433
433
|
case "text":
|
|
434
434
|
case "exact": {
|
|
435
|
-
if (
|
|
436
|
-
const
|
|
437
|
-
return
|
|
435
|
+
if (yo(n)) {
|
|
436
|
+
const f = n;
|
|
437
|
+
return eo(f.operator, i, String(f.value ?? ""));
|
|
438
438
|
}
|
|
439
|
-
return
|
|
439
|
+
return eo(t === "exact" ? "equals" : "contains", i, String(n));
|
|
440
440
|
}
|
|
441
441
|
case "number": {
|
|
442
|
-
const { min:
|
|
443
|
-
return Number.isNaN(a) ? !1 : (typeof
|
|
442
|
+
const { min: f, max: d } = n, a = typeof o == "number" ? o : o == null || o === "" ? NaN : Number(o);
|
|
443
|
+
return Number.isNaN(a) ? !1 : (typeof f != "number" || a >= f) && (typeof d != "number" || a <= d);
|
|
444
444
|
}
|
|
445
445
|
case "date": {
|
|
446
|
-
const { from:
|
|
447
|
-
return a ? (!
|
|
446
|
+
const { from: f, to: d } = n, a = pe(o);
|
|
447
|
+
return a ? (!f || a >= f) && (!d || a <= d) : !1;
|
|
448
448
|
}
|
|
449
449
|
case "select":
|
|
450
450
|
return n.includes(String(o ?? ""));
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function $i(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 [
|
|
457
457
|
{ value: "true", label: "Yes" },
|
|
458
458
|
{ value: "false", label: "No" }
|
|
459
459
|
];
|
|
460
|
-
const
|
|
460
|
+
const f = /* @__PURE__ */ new Map();
|
|
461
461
|
for (const d of n) {
|
|
462
462
|
const a = i(d);
|
|
463
463
|
if (a == null || a === "") continue;
|
|
464
464
|
const g = String(a);
|
|
465
|
-
|
|
465
|
+
f.has(g) || f.set(g, o(d));
|
|
466
466
|
}
|
|
467
|
-
return [...
|
|
467
|
+
return [...f].map(([d, a]) => ({ value: d, label: a })).sort((d, a) => d.label.localeCompare(a.label, void 0, { numeric: !0 }));
|
|
468
468
|
}
|
|
469
|
-
const
|
|
469
|
+
const to = (t) => {
|
|
470
470
|
if (t.trim() === "") return;
|
|
471
471
|
const n = Number(t);
|
|
472
472
|
return Number.isFinite(n) ? n : void 0;
|
|
473
|
-
},
|
|
474
|
-
function
|
|
473
|
+
}, Jn = (t) => typeof t == "object" && t !== null && !Array.isArray(t);
|
|
474
|
+
function Pi({
|
|
475
475
|
value: t,
|
|
476
476
|
onChange: n,
|
|
477
477
|
label: i,
|
|
478
478
|
debounce: o,
|
|
479
|
-
inputClassName:
|
|
479
|
+
inputClassName: f,
|
|
480
480
|
inputStyle: d
|
|
481
481
|
}) {
|
|
482
|
-
const a =
|
|
483
|
-
const D =
|
|
482
|
+
const a = Jn(t) ? t : {}, [g, m] = j(a.min === void 0 ? "" : String(a.min)), [x, E] = j(a.max === void 0 ? "" : String(a.max)), b = W(a), v = mo((p, k) => {
|
|
483
|
+
const D = to(p), C = to(k);
|
|
484
484
|
b.current = { min: D, max: C }, n(D === void 0 && C === void 0 ? void 0 : { min: D, max: C });
|
|
485
485
|
}, o);
|
|
486
486
|
return ne(() => {
|
|
@@ -493,7 +493,7 @@ function yi({
|
|
|
493
493
|
{
|
|
494
494
|
autoFocus: !0,
|
|
495
495
|
type: "number",
|
|
496
|
-
className: U("rg-grid__filter-input",
|
|
496
|
+
className: U("rg-grid__filter-input", f),
|
|
497
497
|
style: d,
|
|
498
498
|
value: g,
|
|
499
499
|
"aria-label": `Minimum ${i}`,
|
|
@@ -510,7 +510,7 @@ function yi({
|
|
|
510
510
|
"input",
|
|
511
511
|
{
|
|
512
512
|
type: "number",
|
|
513
|
-
className: U("rg-grid__filter-input",
|
|
513
|
+
className: U("rg-grid__filter-input", f),
|
|
514
514
|
style: d,
|
|
515
515
|
value: x,
|
|
516
516
|
"aria-label": `Maximum ${i}`,
|
|
@@ -523,18 +523,18 @@ function yi({
|
|
|
523
523
|
] })
|
|
524
524
|
] });
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function Li({
|
|
527
527
|
value: t,
|
|
528
528
|
onChange: n,
|
|
529
529
|
onEnter: i,
|
|
530
530
|
label: o,
|
|
531
|
-
kind:
|
|
531
|
+
kind: f,
|
|
532
532
|
placeholder: d,
|
|
533
533
|
debounce: a,
|
|
534
534
|
inputClassName: g,
|
|
535
535
|
inputStyle: m
|
|
536
536
|
}) {
|
|
537
|
-
const [x, E] =
|
|
537
|
+
const [x, E] = j(t), b = W(t), v = mo((p) => {
|
|
538
538
|
b.current = p, n(p || void 0);
|
|
539
539
|
}, a);
|
|
540
540
|
return ne(() => {
|
|
@@ -547,7 +547,7 @@ function xi({
|
|
|
547
547
|
className: U("rg-grid__filter-input", g),
|
|
548
548
|
style: m,
|
|
549
549
|
value: x,
|
|
550
|
-
placeholder: d ?? (
|
|
550
|
+
placeholder: d ?? (f === "exact" ? "Exactly…" : `Filter ${o}…`),
|
|
551
551
|
"aria-label": `Filter text for ${o}`,
|
|
552
552
|
onChange: (p) => {
|
|
553
553
|
E(p.target.value), v.call(p.target.value);
|
|
@@ -558,41 +558,41 @@ function xi({
|
|
|
558
558
|
}
|
|
559
559
|
);
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function Oi({
|
|
562
562
|
value: t,
|
|
563
563
|
onChange: n,
|
|
564
564
|
label: i,
|
|
565
565
|
inputClassName: o,
|
|
566
|
-
inputStyle:
|
|
566
|
+
inputStyle: f,
|
|
567
567
|
min: d,
|
|
568
568
|
max: a,
|
|
569
569
|
locale: g
|
|
570
570
|
}) {
|
|
571
|
-
const m =
|
|
571
|
+
const m = Jn(t) ? t : {}, x = (F, w) => n(!F && !w ? void 0 : { from: F || void 0, to: w || void 0 }), [E, b] = j(m.from ?? ""), [v, p] = j(m.to ?? "");
|
|
572
572
|
ne(() => {
|
|
573
|
-
(
|
|
573
|
+
(le(E) ? E : "") !== (m.from ?? "") && b(m.from ?? ""), (le(v) ? v : "") !== (m.to ?? "") && p(m.to ?? "");
|
|
574
574
|
}, [m.from, m.to]);
|
|
575
|
-
const k = (
|
|
576
|
-
if ((
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
}, D = (
|
|
580
|
-
|
|
581
|
-
}, C = (
|
|
582
|
-
/* @__PURE__ */ h("span", { children:
|
|
575
|
+
const k = (F, w) => {
|
|
576
|
+
if ((F === "from" ? b : p)(w), w !== "" && !le(w)) return;
|
|
577
|
+
const L = w || void 0;
|
|
578
|
+
F === "from" ? x(L, m.to) : x(m.from, L);
|
|
579
|
+
}, D = (F) => {
|
|
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, L) => /* @__PURE__ */ I("label", { className: "rg-grid__filter-field", children: [
|
|
582
|
+
/* @__PURE__ */ h("span", { children: F === "from" ? "From" : "To" }),
|
|
583
583
|
/* @__PURE__ */ h(
|
|
584
584
|
"input",
|
|
585
585
|
{
|
|
586
|
-
autoFocus:
|
|
586
|
+
autoFocus: L,
|
|
587
587
|
type: "text",
|
|
588
588
|
inputMode: "numeric",
|
|
589
589
|
placeholder: "YYYY-MM-DD",
|
|
590
|
-
className: U("rg-grid__filter-input", w !== "" && !
|
|
591
|
-
style:
|
|
590
|
+
className: U("rg-grid__filter-input", w !== "" && !le(w) && "rg-grid__filter-input--invalid", o),
|
|
591
|
+
style: f,
|
|
592
592
|
value: w,
|
|
593
|
-
"aria-label": `${i} ${
|
|
594
|
-
"aria-invalid": w !== "" && !
|
|
595
|
-
onChange: (
|
|
593
|
+
"aria-label": `${i} ${F}`,
|
|
594
|
+
"aria-invalid": w !== "" && !le(w) || void 0,
|
|
595
|
+
onChange: (H) => k(F, H.target.value.trim())
|
|
596
596
|
}
|
|
597
597
|
)
|
|
598
598
|
] });
|
|
@@ -601,44 +601,44 @@ function _i({
|
|
|
601
601
|
C("from", E, !0),
|
|
602
602
|
C("to", v, !1)
|
|
603
603
|
] }),
|
|
604
|
-
/* @__PURE__ */ h(
|
|
604
|
+
/* @__PURE__ */ h(go, { range: m, min: d, max: a, locale: g, onPick: D, hideFooter: !0 })
|
|
605
605
|
] });
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function Ri({
|
|
608
608
|
value: t,
|
|
609
609
|
onChange: n,
|
|
610
610
|
options: i
|
|
611
611
|
}) {
|
|
612
|
-
const o = Array.isArray(t) ? t : [],
|
|
612
|
+
const o = Array.isArray(t) ? t : [], f = (d, a) => {
|
|
613
613
|
const g = a ? [...o, d] : o.filter((m) => m !== d);
|
|
614
614
|
n(g.length ? g : void 0);
|
|
615
615
|
};
|
|
616
616
|
return /* @__PURE__ */ I("div", { className: "rg-grid__filter-fields rg-grid__filter-options", role: "group", children: [
|
|
617
617
|
i.length === 0 && /* @__PURE__ */ h("span", { className: "rg-grid__filter-empty", children: "No values" }),
|
|
618
618
|
i.map((d) => /* @__PURE__ */ h(
|
|
619
|
-
|
|
619
|
+
ft,
|
|
620
620
|
{
|
|
621
621
|
checked: o.includes(d.value),
|
|
622
|
-
onChange: (a) =>
|
|
622
|
+
onChange: (a) => f(d.value, a),
|
|
623
623
|
label: d.label ?? d.value
|
|
624
624
|
},
|
|
625
625
|
d.value
|
|
626
626
|
))
|
|
627
627
|
] });
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Ui({
|
|
630
630
|
value: t,
|
|
631
631
|
options: n,
|
|
632
632
|
onChange: i,
|
|
633
633
|
label: o
|
|
634
634
|
}) {
|
|
635
|
-
const [
|
|
635
|
+
const [f, d] = j(!1), [a, g] = j(0), m = ki(), x = W(null), E = () => {
|
|
636
636
|
g(Math.max(0, n.indexOf(t))), d(!0);
|
|
637
637
|
}, b = (p) => {
|
|
638
638
|
var k;
|
|
639
639
|
i(p), d(!1), (k = x.current) == null || k.focus();
|
|
640
640
|
}, v = (p) => {
|
|
641
|
-
if (!
|
|
641
|
+
if (!f) {
|
|
642
642
|
(p.key === "ArrowDown" || p.key === "ArrowUp") && (p.preventDefault(), E());
|
|
643
643
|
return;
|
|
644
644
|
}
|
|
@@ -677,19 +677,19 @@ function vi({
|
|
|
677
677
|
role: "combobox",
|
|
678
678
|
"aria-label": `Comparison for ${o}`,
|
|
679
679
|
"aria-haspopup": "listbox",
|
|
680
|
-
"aria-expanded":
|
|
681
|
-
"aria-controls":
|
|
682
|
-
"aria-activedescendant":
|
|
683
|
-
onClick: () =>
|
|
680
|
+
"aria-expanded": f,
|
|
681
|
+
"aria-controls": f ? m : void 0,
|
|
682
|
+
"aria-activedescendant": f ? `${m}-${a}` : void 0,
|
|
683
|
+
onClick: () => f ? d(!1) : E(),
|
|
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: Zr[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
|
}
|
|
691
691
|
),
|
|
692
|
-
|
|
692
|
+
f && // mousedown must not move focus away from the button, or onBlur would close the list before the click lands
|
|
693
693
|
/* @__PURE__ */ h("ul", { id: m, role: "listbox", className: "rg-op__list", "aria-label": `Comparisons for ${o}`, onMouseDown: (p) => p.preventDefault(), children: n.map((p, k) => /* @__PURE__ */ I(
|
|
694
694
|
"li",
|
|
695
695
|
{
|
|
@@ -701,7 +701,7 @@ function vi({
|
|
|
701
701
|
onMouseEnter: () => g(k),
|
|
702
702
|
onClick: () => b(p),
|
|
703
703
|
children: [
|
|
704
|
-
|
|
704
|
+
Zr[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,12 +709,12 @@ function vi({
|
|
|
709
709
|
)) })
|
|
710
710
|
] });
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function Ai({
|
|
713
713
|
column: t,
|
|
714
714
|
label: n,
|
|
715
715
|
kind: i,
|
|
716
716
|
value: o,
|
|
717
|
-
onChange:
|
|
717
|
+
onChange: f,
|
|
718
718
|
options: d,
|
|
719
719
|
debounce: a = 300,
|
|
720
720
|
theme: g,
|
|
@@ -725,32 +725,32 @@ function ki({
|
|
|
725
725
|
inputClassName: v,
|
|
726
726
|
inputStyle: p
|
|
727
727
|
}) {
|
|
728
|
-
const [k, D] =
|
|
729
|
-
if (
|
|
730
|
-
|
|
731
|
-
}, ze = (
|
|
732
|
-
|
|
733
|
-
},
|
|
728
|
+
const [k, D] = j(!1), C = W(null), F = xo(o), w = Te(() => D(!1), []), L = Jn(o) ? o : null, H = typeof o == "string" ? o : typeof (L == null ? void 0 : L.value) == "string" ? L.value : "", q = (i === "text" || i === "exact") && !t.filterRenderer ? bo(t) : null, [A, V] = j(() => Ii(t, i)), ke = L && typeof L.operator == "string" ? L.operator : A, Pe = (Y) => {
|
|
729
|
+
if (Y === void 0) return f(void 0);
|
|
730
|
+
f(q ? { operator: ke, value: String(Y) } : Y);
|
|
731
|
+
}, ze = (Y) => {
|
|
732
|
+
V(Y), H.trim() !== "" && f({ operator: Y, value: H });
|
|
733
|
+
}, Fe = () => {
|
|
734
734
|
if (t.filterRenderer)
|
|
735
|
-
return Ke(t.filterRenderer, { column: t, value:
|
|
735
|
+
return Ke(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(Pi, { value: o, onChange: f, label: n, debounce: a, inputClassName: v, inputStyle: p });
|
|
739
739
|
case "date":
|
|
740
|
-
return /* @__PURE__ */ h(
|
|
740
|
+
return /* @__PURE__ */ h(Oi, { 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(Ri, { 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(Ui, { value: ke, options: q, onChange: ze, label: n }),
|
|
746
746
|
/* @__PURE__ */ h(
|
|
747
|
-
|
|
747
|
+
Li,
|
|
748
748
|
{
|
|
749
|
-
value:
|
|
749
|
+
value: H,
|
|
750
750
|
onChange: Pe,
|
|
751
751
|
onEnter: () => {
|
|
752
|
-
var
|
|
753
|
-
D(!1), (
|
|
752
|
+
var Y;
|
|
753
|
+
D(!1), (Y = C.current) == null || Y.focus();
|
|
754
754
|
},
|
|
755
755
|
label: n,
|
|
756
756
|
kind: i,
|
|
@@ -763,7 +763,7 @@ function ki({
|
|
|
763
763
|
] });
|
|
764
764
|
}
|
|
765
765
|
};
|
|
766
|
-
return /* @__PURE__ */ I(
|
|
766
|
+
return /* @__PURE__ */ I(ht, { children: [
|
|
767
767
|
/* @__PURE__ */ h(
|
|
768
768
|
"button",
|
|
769
769
|
{
|
|
@@ -771,7 +771,7 @@ function ki({
|
|
|
771
771
|
type: "button",
|
|
772
772
|
className: U(
|
|
773
773
|
"rg-grid__filter-btn",
|
|
774
|
-
|
|
774
|
+
F && "rg-grid__filter-btn--active",
|
|
775
775
|
k && "rg-grid__filter-btn--open",
|
|
776
776
|
m
|
|
777
777
|
),
|
|
@@ -779,16 +779,16 @@ function ki({
|
|
|
779
779
|
"aria-label": `Filter ${n}`,
|
|
780
780
|
"aria-haspopup": "dialog",
|
|
781
781
|
"aria-expanded": k,
|
|
782
|
-
"data-active":
|
|
783
|
-
onClick: (
|
|
784
|
-
|
|
782
|
+
"data-active": F || void 0,
|
|
783
|
+
onClick: (Y) => {
|
|
784
|
+
Y.stopPropagation(), D((se) => !se);
|
|
785
785
|
},
|
|
786
|
-
onKeyDown: (
|
|
787
|
-
children: t.filterIndicator ? Ke(t.filterIndicator, { column: t, active:
|
|
786
|
+
onKeyDown: (Y) => Y.stopPropagation(),
|
|
787
|
+
children: t.filterIndicator ? Ke(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(
|
|
791
|
-
|
|
791
|
+
kn,
|
|
792
792
|
{
|
|
793
793
|
anchorRef: C,
|
|
794
794
|
open: k,
|
|
@@ -798,22 +798,22 @@ function ki({
|
|
|
798
798
|
className: E,
|
|
799
799
|
style: b,
|
|
800
800
|
children: [
|
|
801
|
-
|
|
802
|
-
|
|
801
|
+
Fe(),
|
|
802
|
+
F && /* @__PURE__ */ h("button", { type: "button", className: "rg-grid__filter-clear", onClick: () => f(void 0), children: "Clear" })
|
|
803
803
|
]
|
|
804
804
|
}
|
|
805
805
|
)
|
|
806
806
|
] });
|
|
807
807
|
}
|
|
808
|
-
function
|
|
809
|
-
const [a, g] =
|
|
810
|
-
return /* @__PURE__ */ I(
|
|
808
|
+
function Wi({ columns: t, hidden: n, onToggle: i, theme: o, className: f, style: d }) {
|
|
809
|
+
const [a, g] = j(!1), m = W(null), x = Te(() => g(!1), []), E = t.filter((b) => !n.has(b.field)).length;
|
|
810
|
+
return /* @__PURE__ */ I(ht, { children: [
|
|
811
811
|
/* @__PURE__ */ h(
|
|
812
812
|
"button",
|
|
813
813
|
{
|
|
814
814
|
ref: m,
|
|
815
815
|
type: "button",
|
|
816
|
-
className: U("rg-grid__tool-btn",
|
|
816
|
+
className: U("rg-grid__tool-btn", f),
|
|
817
817
|
style: d,
|
|
818
818
|
"aria-haspopup": "dialog",
|
|
819
819
|
"aria-expanded": a,
|
|
@@ -821,57 +821,57 @@ function Si({ columns: t, hidden: n, onToggle: i, theme: o, className: u, style:
|
|
|
821
821
|
children: "Columns"
|
|
822
822
|
}
|
|
823
823
|
),
|
|
824
|
-
/* @__PURE__ */ h(
|
|
824
|
+
/* @__PURE__ */ h(kn, { anchorRef: m, open: a, onClose: x, label: "Show or hide columns", theme: o, children: /* @__PURE__ */ h("div", { className: "rg-grid__filter-fields rg-grid__filter-options", role: "group", "aria-label": "Columns", children: t.filter((b) => b.hideable !== !1).map((b) => {
|
|
825
825
|
const v = !n.has(b.field);
|
|
826
826
|
return /* @__PURE__ */ h(
|
|
827
|
-
|
|
827
|
+
ft,
|
|
828
828
|
{
|
|
829
829
|
checked: v,
|
|
830
830
|
disabled: v && E <= 1,
|
|
831
831
|
onChange: (p) => i(b.field, !p),
|
|
832
|
-
label:
|
|
832
|
+
label: nt(b)
|
|
833
833
|
},
|
|
834
834
|
b.field
|
|
835
835
|
);
|
|
836
836
|
}) }) })
|
|
837
837
|
] });
|
|
838
838
|
}
|
|
839
|
-
const
|
|
840
|
-
function
|
|
839
|
+
const Bi = /^[=+\-@\t\r]/;
|
|
840
|
+
function ji(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" && Bi.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:
|
|
845
|
+
function Ki(t, n, i = {}) {
|
|
846
|
+
const { delimiter: o = ",", sanitize: f = !0 } = i, d = (a) => a.map((g) => ji(g, o, f)).join(o);
|
|
847
847
|
return [d(t), ...n.map(d)].join(`\r
|
|
848
848
|
`);
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function _n(t, n) {
|
|
851
851
|
if (typeof document > "u") return;
|
|
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
|
|
856
|
-
|
|
855
|
+
function zi(t, n) {
|
|
856
|
+
_n(new Blob(["\uFEFF", t], { type: "text/csv;charset=utf-8" }), n);
|
|
857
857
|
}
|
|
858
|
-
const
|
|
858
|
+
const _o = {
|
|
859
859
|
csv: "CSV",
|
|
860
860
|
xlsx: "Excel",
|
|
861
861
|
json: "JSON",
|
|
862
862
|
pdf: "PDF"
|
|
863
|
-
},
|
|
864
|
-
function
|
|
865
|
-
const [x, E] =
|
|
866
|
-
var
|
|
863
|
+
}, qi = { csv: ".csv", xlsx: ".xlsx", json: ".json", pdf: ".pdf" }, Yi = (t) => `Export ${_o[t]}`;
|
|
864
|
+
function Vi({ formats: t, scopes: n, scope: i, onScopeChange: o, onExport: f, theme: d, className: a, style: g, popupClassName: m }) {
|
|
865
|
+
const [x, E] = j(!1), [b, v] = j(null), p = W(null), k = Te(() => E(!1), []), D = async (C) => {
|
|
866
|
+
var F;
|
|
867
867
|
v(C);
|
|
868
868
|
try {
|
|
869
|
-
await
|
|
869
|
+
await f(C, i);
|
|
870
870
|
} finally {
|
|
871
|
-
v(null), E(!1), (
|
|
871
|
+
v(null), E(!1), (F = p.current) == null || F.focus();
|
|
872
872
|
}
|
|
873
873
|
};
|
|
874
|
-
return /* @__PURE__ */ I(
|
|
874
|
+
return /* @__PURE__ */ I(ht, { children: [
|
|
875
875
|
/* @__PURE__ */ I(
|
|
876
876
|
"button",
|
|
877
877
|
{
|
|
@@ -888,12 +888,12 @@ function Ii({ formats: t, scopes: n, scope: i, onScopeChange: o, onExport: u, th
|
|
|
888
888
|
]
|
|
889
889
|
}
|
|
890
890
|
),
|
|
891
|
-
/* @__PURE__ */ h(
|
|
891
|
+
/* @__PURE__ */ h(kn, { anchorRef: p, open: x, onClose: k, label: "Export", theme: d, className: U("rg-export-popup", m), children: /* @__PURE__ */ I("div", { className: "rg-export", children: [
|
|
892
892
|
n.length > 1 && /* @__PURE__ */ I("div", { className: "rg-export__group", role: "radiogroup", "aria-label": "Rows to export", children: [
|
|
893
893
|
/* @__PURE__ */ h("div", { className: "rg-export__title", children: "Rows to export" }),
|
|
894
894
|
n.map((C) => {
|
|
895
|
-
const
|
|
896
|
-
return /* @__PURE__ */ I("label", { className: U("rg-export__scope",
|
|
895
|
+
const F = C.count === 0;
|
|
896
|
+
return /* @__PURE__ */ I("label", { className: U("rg-export__scope", F && "rg-export__scope--disabled", C.value === i && "rg-export__scope--on"), children: [
|
|
897
897
|
/* @__PURE__ */ h(
|
|
898
898
|
"input",
|
|
899
899
|
{
|
|
@@ -901,7 +901,7 @@ function Ii({ formats: t, scopes: n, scope: i, onScopeChange: o, onExport: u, th
|
|
|
901
901
|
name: "rg-export-scope",
|
|
902
902
|
value: C.value,
|
|
903
903
|
checked: C.value === i,
|
|
904
|
-
disabled:
|
|
904
|
+
disabled: F,
|
|
905
905
|
onChange: () => o(C.value)
|
|
906
906
|
}
|
|
907
907
|
),
|
|
@@ -921,8 +921,8 @@ function Ii({ formats: t, scopes: n, scope: i, onScopeChange: o, onExport: u, th
|
|
|
921
921
|
disabled: b !== null,
|
|
922
922
|
onClick: () => D(C),
|
|
923
923
|
children: [
|
|
924
|
-
/* @__PURE__ */ h("span", { children:
|
|
925
|
-
/* @__PURE__ */ h("span", { className: "rg-export__ext", children: b === C ? "Preparing…" :
|
|
924
|
+
/* @__PURE__ */ h("span", { children: _o[C] }),
|
|
925
|
+
/* @__PURE__ */ h("span", { className: "rg-export__ext", children: b === C ? "Preparing…" : qi[C] })
|
|
926
926
|
]
|
|
927
927
|
},
|
|
928
928
|
C
|
|
@@ -931,8 +931,8 @@ function Ii({ formats: t, scopes: n, scope: i, onScopeChange: o, onExport: u, th
|
|
|
931
931
|
] }) })
|
|
932
932
|
] });
|
|
933
933
|
}
|
|
934
|
-
let
|
|
935
|
-
function
|
|
934
|
+
let _e;
|
|
935
|
+
function he(t) {
|
|
936
936
|
const n = (t ?? "").trim();
|
|
937
937
|
if (!n || n === "transparent" || n === "none") return null;
|
|
938
938
|
const i = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(n);
|
|
@@ -941,34 +941,34 @@ function fe(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
|
|
945
|
-
if (typeof document > "u" || (
|
|
946
|
-
|
|
947
|
-
const
|
|
948
|
-
if (
|
|
949
|
-
|
|
950
|
-
const [d, a, g, m] =
|
|
951
|
-
return m === 0 ? null :
|
|
944
|
+
if (o) return no([Number(o[1]), Number(o[2]), Number(o[3])], Hi(o[4]));
|
|
945
|
+
if (typeof document > "u" || (_e === void 0 && (_e = document.createElement("canvas").getContext("2d", { willReadFrequently: !0 })), !_e)) return null;
|
|
946
|
+
_e.fillStyle = "#000000", _e.fillStyle = n;
|
|
947
|
+
const f = String(_e.fillStyle);
|
|
948
|
+
if (_e.fillStyle = "#ffffff", _e.fillStyle = n, f !== String(_e.fillStyle)) return null;
|
|
949
|
+
_e.clearRect(0, 0, 1, 1), _e.fillRect(0, 0, 1, 1);
|
|
950
|
+
const [d, a, g, m] = _e.getImageData(0, 0, 1, 1).data;
|
|
951
|
+
return m === 0 ? null : no([d, a, g], m / 255);
|
|
952
952
|
}
|
|
953
|
-
const
|
|
954
|
-
function
|
|
953
|
+
const Hi = (t) => t === void 0 ? 1 : t.endsWith("%") ? parseFloat(t) / 100 : parseFloat(t);
|
|
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
|
|
960
|
-
async function
|
|
959
|
+
const Xi = ([t, n, i]) => (0.299 * t + 0.587 * n + 0.114 * i) / 255, qn = (t) => Xi(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
|
+
async function ro(t, n) {
|
|
961
961
|
try {
|
|
962
962
|
return await n();
|
|
963
963
|
} catch (i) {
|
|
964
964
|
const o = i instanceof Error ? i.message : String(i);
|
|
965
|
-
throw new Error(`PDF export needs the package "${t}", which could not be loaded (${o}). ${
|
|
965
|
+
throw new Error(`PDF export needs the package "${t}", which could not be loaded (${o}). ${Lt}`);
|
|
966
966
|
}
|
|
967
967
|
}
|
|
968
|
-
function
|
|
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 Gi(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,50 +976,50 @@ async function Pi(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 Ji(t, n, i, o, f) {
|
|
980
980
|
const d = i.html2canvas;
|
|
981
981
|
if (typeof d != "function")
|
|
982
|
-
throw new Error(`A PDF header / footer element needs html2canvas. Add it to exportable.pdf.libraries. ${
|
|
982
|
+
throw new Error(`A PDF header / footer element needs html2canvas. Add it to exportable.pdf.libraries. ${Lt}`);
|
|
983
983
|
const [a, g] = await Promise.all([
|
|
984
|
-
|
|
985
|
-
|
|
984
|
+
ro("react-dom/client", () => import("./client-DUlru6F3.js").then((b) => b.c)),
|
|
985
|
+
ro("react-dom", () => import("react-dom"))
|
|
986
986
|
]), m = 2, x = document.createElement("div");
|
|
987
|
-
x.style.cssText = `position:fixed;left:-10000px;top:0;width:${Math.round(n /
|
|
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 Gi(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
|
-
return { dataUrl: b.toDataURL("image/png"), width: b.width / m *
|
|
992
|
+
return { dataUrl: b.toDataURL("image/png"), width: b.width / m * Yn, height: b.height / m * Yn };
|
|
993
993
|
} finally {
|
|
994
994
|
E.unmount(), x.remove();
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
|
-
async function
|
|
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 Ji(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
|
-
const
|
|
1004
|
-
function
|
|
1003
|
+
const io = (t) => `rgb(${t[0]},${t[1]},${t[2]})`, lo = ["normal", "bold", "italic", "bolditalic"];
|
|
1004
|
+
function so(t, n) {
|
|
1005
1005
|
return typeof t == "number" ? { top: t, right: t, bottom: t, left: t } : { top: (t == null ? void 0 : t.top) ?? n, right: (t == null ? void 0 : t.right) ?? n, bottom: (t == null ? void 0 : t.bottom) ?? n, left: (t == null ? void 0 : t.left) ?? n };
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function ao(t) {
|
|
1008
1008
|
return Object.fromEntries(Object.entries(t).filter(([, n]) => n !== void 0));
|
|
1009
1009
|
}
|
|
1010
|
-
async function
|
|
1011
|
-
var it,
|
|
1010
|
+
async function Qi(t, n = {}, i = {}) {
|
|
1011
|
+
var it, lt;
|
|
1012
1012
|
let o;
|
|
1013
1013
|
try {
|
|
1014
1014
|
o = typeof n.libraries == "function" ? await n.libraries() : n.libraries;
|
|
1015
|
-
} catch (
|
|
1016
|
-
const Q =
|
|
1017
|
-
throw new Error(`PDF export could not load jspdf / jspdf-autotable (${Q}). ${
|
|
1015
|
+
} catch (T) {
|
|
1016
|
+
const Q = T instanceof Error ? T.message : String(T);
|
|
1017
|
+
throw new Error(`PDF export could not load jspdf / jspdf-autotable (${Q}). ${Lt}`);
|
|
1018
1018
|
}
|
|
1019
|
-
if (!o) throw new Error(`PDF export needs the jspdf and jspdf-autotable libraries. ${
|
|
1020
|
-
const
|
|
1021
|
-
if (typeof
|
|
1022
|
-
throw new Error(`exportable.pdf.libraries must contain jsPDF (a class) and autoTable (a function). ${
|
|
1019
|
+
if (!o) throw new Error(`PDF export needs the jspdf and jspdf-autotable libraries. ${Lt}`);
|
|
1020
|
+
const f = o.jsPDF, d = o.autoTable;
|
|
1021
|
+
if (typeof f != "function" || typeof d != "function")
|
|
1022
|
+
throw new Error(`exportable.pdf.libraries must contain jsPDF (a class) and autoTable (a function). ${Lt}`);
|
|
1023
1023
|
const {
|
|
1024
1024
|
title: a,
|
|
1025
1025
|
header: g,
|
|
@@ -1032,131 +1032,131 @@ async function Oi(t, n = {}, i = {}) {
|
|
|
1032
1032
|
pageNumbers: k = !0,
|
|
1033
1033
|
maxImageHeight: D = 90,
|
|
1034
1034
|
beforeRender: C,
|
|
1035
|
-
autoTableOptions:
|
|
1035
|
+
autoTableOptions: F
|
|
1036
1036
|
} = n, w = {
|
|
1037
1037
|
...i,
|
|
1038
|
-
...
|
|
1038
|
+
...ao({
|
|
1039
1039
|
headColor: n.headColor,
|
|
1040
1040
|
headTextColor: n.headTextColor,
|
|
1041
1041
|
fontSize: n.fontSize,
|
|
1042
1042
|
fontName: n.fontName,
|
|
1043
1043
|
margin: n.margin
|
|
1044
1044
|
}),
|
|
1045
|
-
...
|
|
1046
|
-
},
|
|
1045
|
+
...ao(n.style ?? {})
|
|
1046
|
+
}, L = 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, Pe = 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(),
|
|
1053
|
-
!
|
|
1052
|
+
const B = S.internal.pageSize.getWidth(), ce = S.internal.pageSize.getHeight(), ge = B - L.left - L.right, qe = 10, rt = 12, Ot = /* @__PURE__ */ new Set(), pt = (T) => {
|
|
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
|
-
const Ye =
|
|
1057
|
-
S.setFont(
|
|
1058
|
-
const gt = (
|
|
1059
|
-
let Xe =
|
|
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
|
+
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), Le = Math.min(18, L.top), bt = ce - 14, yt = ce - (k ? 26 : 18), Rt = de ? Math.max(L.top, Le + He + 12) : L.top, xt = Math.max(L.bottom, me ? ce - yt + mt + 10 : k ? 34 : 0);
|
|
1059
|
+
let Xe = Rt;
|
|
1060
1060
|
if (a && typeof a != "string" && typeof a != "number" && typeof a != "boolean") {
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
} else a && (S.setFont(
|
|
1064
|
-
const
|
|
1065
|
-
t.fields.forEach((
|
|
1066
|
-
var
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
const
|
|
1072
|
-
|
|
1061
|
+
const T = await Vn(a, ge, D, o, Ye, Ve);
|
|
1062
|
+
T && T.kind === "image" && (S.addImage(T.dataUrl, "PNG", L.left, Xe, T.width, T.height), Xe += T.height + 12);
|
|
1063
|
+
} else a && (S.setFont(H, "bold"), S.setFontSize(w.titleSize ?? 14), S.setTextColor(...Pe), S.text(String(a), L.left, Xe + (w.titleSize ?? 14)), Xe += (w.titleSize ?? 14) + 12);
|
|
1064
|
+
const Ut = {};
|
|
1065
|
+
t.fields.forEach((T, Q) => {
|
|
1066
|
+
var Wt;
|
|
1067
|
+
const P = (Wt = w.columns) == null ? void 0 : Wt[T], ae = {}, Je = (P == null ? void 0 : P.align) ?? t.aligns[Q];
|
|
1068
|
+
Je && (ae.halign = Je), (P == null ? void 0 : P.width) !== void 0 && (ae.cellWidth = P.width);
|
|
1069
|
+
const Oe = he(P == null ? void 0 : P.textColor);
|
|
1070
|
+
Oe && (ae.textColor = Oe);
|
|
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[Q] = ae);
|
|
1073
1073
|
});
|
|
1074
|
-
const
|
|
1075
|
-
font:
|
|
1074
|
+
const Ie = {
|
|
1075
|
+
font: H,
|
|
1076
1076
|
fontSize: q,
|
|
1077
|
-
cellPadding:
|
|
1077
|
+
cellPadding: so(w.cellPadding, 4),
|
|
1078
1078
|
overflow: "linebreak",
|
|
1079
1079
|
valign: "middle"
|
|
1080
1080
|
};
|
|
1081
|
-
|
|
1082
|
-
const
|
|
1081
|
+
Y ? Ie.textColor = Y : A && (Ie.textColor = qn(A)), G && (Ie.lineColor = G), w.borderWidth !== void 0 ? Ie.lineWidth = w.borderWidth : G && (Ie.lineWidth = 0.5), w.minRowHeight && (Ie.minCellHeight = w.minRowHeight);
|
|
1082
|
+
const Se = {
|
|
1083
1083
|
head: [t.headers],
|
|
1084
1084
|
body: t.rows,
|
|
1085
1085
|
startY: Xe,
|
|
1086
|
-
margin: { top:
|
|
1086
|
+
margin: { top: Rt, right: L.right, bottom: xt, left: L.left },
|
|
1087
1087
|
theme: p,
|
|
1088
1088
|
showHead: "everyPage",
|
|
1089
|
-
styles:
|
|
1089
|
+
styles: Ie,
|
|
1090
1090
|
headStyles: {
|
|
1091
1091
|
fillColor: ze,
|
|
1092
|
-
textColor:
|
|
1093
|
-
fontStyle: w.headFontStyle &&
|
|
1092
|
+
textColor: Fe,
|
|
1093
|
+
fontStyle: w.headFontStyle && lo.includes(w.headFontStyle) ? w.headFontStyle : "bold",
|
|
1094
1094
|
...w.headFontSize ? { fontSize: w.headFontSize } : null
|
|
1095
1095
|
},
|
|
1096
|
-
columnStyles:
|
|
1096
|
+
columnStyles: Ut,
|
|
1097
1097
|
// A new page starts blank: paint its background before the table draws on it
|
|
1098
1098
|
willDrawPage: () => {
|
|
1099
|
-
var Q,
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1099
|
+
var Q, P;
|
|
1100
|
+
const T = typeof S.getCurrentPageInfo == "function" ? S.getCurrentPageInfo() : (P = (Q = S.internal).getCurrentPageInfo) == null ? void 0 : P.call(Q);
|
|
1101
|
+
T != null && T.pageNumber && pt(T.pageNumber);
|
|
1102
1102
|
}
|
|
1103
1103
|
};
|
|
1104
|
-
_ && (
|
|
1105
|
-
const
|
|
1106
|
-
for (const
|
|
1107
|
-
const Q =
|
|
1108
|
-
Q &&
|
|
1104
|
+
_ && (Se.bodyStyles = { fillColor: _ }), se && Ee ? (Se.bodyStyles = { fillColor: se }, Se.alternateRowStyles = { fillColor: Ee }) : (se || _) && (Se.alternateRowStyles = { fillColor: _ });
|
|
1105
|
+
const ot = { ...Se, ...F };
|
|
1106
|
+
for (const T of ["styles", "headStyles", "bodyStyles", "alternateRowStyles", "margin"]) {
|
|
1107
|
+
const Q = Se[T], P = F == null ? void 0 : F[T];
|
|
1108
|
+
Q && P && typeof P == "object" && (ot[T] = { ...Q, ...P });
|
|
1109
1109
|
}
|
|
1110
|
-
d(S,
|
|
1111
|
-
const
|
|
1112
|
-
if (!
|
|
1113
|
-
if (
|
|
1114
|
-
S.addImage(
|
|
1110
|
+
d(S, ot);
|
|
1111
|
+
const _t = typeof S.getNumberOfPages == "function" ? S.getNumberOfPages() : S.internal.getNumberOfPages(), ue = (T, Q) => T === "center" ? (B - Q) / 2 : T === "right" ? B - L.right - Q : L.left, Ge = (T, Q, P, ae) => {
|
|
1112
|
+
if (!T) return;
|
|
1113
|
+
if (T.kind === "image") {
|
|
1114
|
+
S.addImage(T.dataUrl, "PNG", ue(P, T.width), Q, T.width, T.height);
|
|
1115
1115
|
return;
|
|
1116
1116
|
}
|
|
1117
|
-
S.setFont(
|
|
1118
|
-
const
|
|
1119
|
-
S.text(
|
|
1117
|
+
S.setFont(H, "normal"), S.setFontSize(qe), S.setTextColor(...ke);
|
|
1118
|
+
const Je = S.splitTextToSize(oo(T.text, ae, _t), ge), Oe = P === "center" ? B / 2 : P === "right" ? B - L.right : L.left;
|
|
1119
|
+
S.text(Je, Oe, Q + qe, { align: P });
|
|
1120
1120
|
};
|
|
1121
|
-
for (let
|
|
1122
|
-
S.setPage(
|
|
1121
|
+
for (let T = 1; T <= _t; T++)
|
|
1122
|
+
S.setPage(T), Ge(de, Le, 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 - L.right, bt, { align: "right" }));
|
|
1123
1123
|
return S.output("blob");
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1125
|
+
function Zi(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) => {
|
|
1129
1129
|
var v;
|
|
1130
1130
|
for (let p = b; p; p = p.parentElement) {
|
|
1131
1131
|
const k = (v = i(p)) == null ? void 0 : v.backgroundColor;
|
|
1132
|
-
if (k &&
|
|
1132
|
+
if (k && he(k)) return k;
|
|
1133
1133
|
}
|
|
1134
|
-
},
|
|
1135
|
-
const v =
|
|
1134
|
+
}, f = (b) => {
|
|
1135
|
+
const v = he(b);
|
|
1136
1136
|
return v ? "#" + v.map((p) => p.toString(16).padStart(2, "0")).join("") : void 0;
|
|
1137
1137
|
}, d = (b) => b ? Math.round(parseFloat(b) * 0.75 * 10) / 10 : void 0, a = t.querySelector("thead th");
|
|
1138
1138
|
if (a) {
|
|
1139
1139
|
const b = i(a);
|
|
1140
|
-
n.headColor =
|
|
1140
|
+
n.headColor = f(o(a)), n.headTextColor = f(b.color), n.headFontStyle = parseInt(b.fontWeight, 10) >= 600 ? "bold" : "normal";
|
|
1141
1141
|
}
|
|
1142
1142
|
const g = Array.from(t.querySelectorAll("tbody tr.rg-grid__row:not(.rg-grid__row--exit)")).slice(0, 2), m = (E = g[0]) == null ? void 0 : E.querySelector("td");
|
|
1143
1143
|
if (m) {
|
|
1144
1144
|
const b = i(m);
|
|
1145
|
-
n.bodyTextColor =
|
|
1145
|
+
n.bodyTextColor = f(b.color);
|
|
1146
1146
|
const v = d(b.fontSize);
|
|
1147
1147
|
v && !Number.isNaN(v) && (n.fontSize = Math.min(14, Math.max(6, v)));
|
|
1148
|
-
const p =
|
|
1148
|
+
const p = f(o(g[0].querySelector("td"))), k = f(g[1] ? o(g[1].querySelector("td")) : void 0);
|
|
1149
1149
|
n.bodyColor = p, p && k && p !== k && (n.stripeColors = [p, k]);
|
|
1150
1150
|
const D = i(m);
|
|
1151
|
-
parseFloat(D.borderBottomWidth) > 0 && D.borderBottomStyle !== "none" && (n.borderColor =
|
|
1151
|
+
parseFloat(D.borderBottomWidth) > 0 && D.borderBottomStyle !== "none" && (n.borderColor = f(D.borderBottomColor), n.borderWidth = 0.5);
|
|
1152
1152
|
}
|
|
1153
|
-
const x =
|
|
1154
|
-
return x && x !== "#ffffff" && (n.pageBackground = x), n.textColor =
|
|
1153
|
+
const x = f(o(t));
|
|
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
|
-
const
|
|
1157
|
-
function
|
|
1158
|
-
const d =
|
|
1159
|
-
return d.current += g, /* @__PURE__ */ I("span", { className: U("rg-sort-arrow", t && "rg-sort-arrow--active", o), style:
|
|
1156
|
+
const wo = { none: 0, asc: 0, desc: 180 };
|
|
1157
|
+
function el({ direction: t, size: n = 14, priority: i, className: o, style: f }) {
|
|
1158
|
+
const d = W(0), g = ((wo[t ?? "none"] - d.current) % 360 + 360) % 360;
|
|
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(
|
|
1161
1161
|
"svg",
|
|
1162
1162
|
{
|
|
@@ -1181,22 +1181,26 @@ function Ai({ direction: t, size: n = 14, priority: i, className: o, style: u })
|
|
|
1181
1181
|
t && i !== void 0 && /* @__PURE__ */ h("sup", { className: "rg-sort-arrow__order", children: i })
|
|
1182
1182
|
] });
|
|
1183
1183
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1184
|
+
function tl({ direction: t, children: n }) {
|
|
1185
|
+
const i = W(0), o = ((wo[t ?? "none"] - i.current) % 360 + 360) % 360;
|
|
1186
|
+
return i.current += o, /* @__PURE__ */ h("span", { className: "rg-sort-turn", style: { transform: `rotate(${i.current}deg)` }, children: n });
|
|
1187
|
+
}
|
|
1188
|
+
const vo = new TextEncoder();
|
|
1189
|
+
let xn = null;
|
|
1190
|
+
function nl(t) {
|
|
1191
|
+
if (!xn) {
|
|
1192
|
+
xn = new Uint32Array(256);
|
|
1189
1193
|
for (let i = 0; i < 256; i++) {
|
|
1190
1194
|
let o = i;
|
|
1191
|
-
for (let
|
|
1192
|
-
|
|
1195
|
+
for (let f = 0; f < 8; f++) o = o & 1 ? 3988292384 ^ o >>> 1 : o >>> 1;
|
|
1196
|
+
xn[i] = o >>> 0;
|
|
1193
1197
|
}
|
|
1194
1198
|
}
|
|
1195
1199
|
let n = 4294967295;
|
|
1196
|
-
for (let i = 0; i < t.length; i++) n =
|
|
1200
|
+
for (let i = 0; i < t.length; i++) n = xn[(n ^ t[i]) & 255] ^ n >>> 8;
|
|
1197
1201
|
return (n ^ 4294967295) >>> 0;
|
|
1198
1202
|
}
|
|
1199
|
-
async function
|
|
1203
|
+
async function rl(t) {
|
|
1200
1204
|
const n = globalThis.CompressionStream;
|
|
1201
1205
|
if (typeof n > "u") return null;
|
|
1202
1206
|
try {
|
|
@@ -1206,27 +1210,27 @@ async function Wi(t) {
|
|
|
1206
1210
|
return null;
|
|
1207
1211
|
}
|
|
1208
1212
|
}
|
|
1209
|
-
async function
|
|
1210
|
-
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(),
|
|
1213
|
+
async function ol(t) {
|
|
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 = [];
|
|
1211
1215
|
let a = 0;
|
|
1212
1216
|
for (const p of t) {
|
|
1213
|
-
const k =
|
|
1214
|
-
q.setUint32(0, 67324752, !0), q.setUint16(4, 20, !0), q.setUint16(6, 2048, !0), q.setUint16(8,
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1217
|
+
const k = vo.encode(p.name), D = nl(p.data), C = await rl(p.data), F = C !== null && C.length < p.data.length, w = F ? C : p.data, L = 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, L, !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
|
+
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, L, !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;
|
|
1217
1221
|
}
|
|
1218
1222
|
const g = d.reduce((p, k) => p + k.length, 0), m = new Uint8Array(22), x = new DataView(m.buffer);
|
|
1219
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);
|
|
1220
|
-
const E = [...
|
|
1224
|
+
const E = [...f, ...d, m], b = new Uint8Array(E.reduce((p, k) => p + k.length, 0));
|
|
1221
1225
|
let v = 0;
|
|
1222
1226
|
for (const p of E)
|
|
1223
1227
|
b.set(p, v), v += p.length;
|
|
1224
1228
|
return b;
|
|
1225
1229
|
}
|
|
1226
|
-
function
|
|
1230
|
+
function vn(t) {
|
|
1227
1231
|
return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1228
1232
|
}
|
|
1229
|
-
function
|
|
1233
|
+
function wn(t) {
|
|
1230
1234
|
let n = t + 1, i = "";
|
|
1231
1235
|
for (; n > 0; ) {
|
|
1232
1236
|
const o = (n - 1) % 26;
|
|
@@ -1234,16 +1238,16 @@ function mn(t) {
|
|
|
1234
1238
|
}
|
|
1235
1239
|
return i;
|
|
1236
1240
|
}
|
|
1237
|
-
function
|
|
1241
|
+
function il(t) {
|
|
1238
1242
|
const n = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t);
|
|
1239
1243
|
if (!n) return null;
|
|
1240
|
-
const [i, o,
|
|
1241
|
-
return d.getUTCFullYear() !== i || d.getUTCMonth() !== o - 1 || d.getUTCDate() !==
|
|
1244
|
+
const [i, o, f] = [Number(n[1]), Number(n[2]), Number(n[3])], d = new Date(Date.UTC(i, o - 1, f));
|
|
1245
|
+
return d.getUTCFullYear() !== i || d.getUTCMonth() !== o - 1 || d.getUTCDate() !== f ? null : Math.round((d.getTime() - Date.UTC(1899, 11, 30)) / 864e5);
|
|
1242
1246
|
}
|
|
1243
|
-
function
|
|
1247
|
+
function ll(t) {
|
|
1244
1248
|
return (t ?? "").replace(/[\[\]:*?/\\]/g, " ").trim().slice(0, 31) || "Sheet1";
|
|
1245
1249
|
}
|
|
1246
|
-
const
|
|
1250
|
+
const sl = 1, al = 2, cl = 3, dl = 4, ul = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1247
1251
|
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
1248
1252
|
<numFmts count="1"><numFmt numFmtId="164" formatCode="yyyy\\-mm\\-dd"/></numFmts>
|
|
1249
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>
|
|
@@ -1259,108 +1263,108 @@ const qi = 1, Yi = 2, Vi = 3, Hi = 4, Xi = `<?xml version="1.0" encoding="UTF-8"
|
|
|
1259
1263
|
</cellXfs>
|
|
1260
1264
|
<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>
|
|
1261
1265
|
</styleSheet>`;
|
|
1262
|
-
function
|
|
1266
|
+
function fl(t, n, i) {
|
|
1263
1267
|
if (n == null || n === "") return "";
|
|
1264
|
-
const o = i.align === "right" ?
|
|
1268
|
+
const o = i.align === "right" ? cl : i.align === "center" ? dl : 0;
|
|
1265
1269
|
if (typeof n == "boolean") return `<c r="${t}" t="b"${o ? ` s="${o}"` : ""}><v>${n ? 1 : 0}</v></c>`;
|
|
1266
1270
|
if (typeof n == "number")
|
|
1267
1271
|
return Number.isFinite(n) ? `<c r="${t}"${o ? ` s="${o}"` : ""}><v>${n}</v></c>` : "";
|
|
1268
1272
|
if (i.kind === "date") {
|
|
1269
|
-
const d =
|
|
1270
|
-
if (d !== null) return `<c r="${t}" s="${
|
|
1273
|
+
const d = il(n);
|
|
1274
|
+
if (d !== null) return `<c r="${t}" s="${al}"><v>${d}</v></c>`;
|
|
1271
1275
|
}
|
|
1272
1276
|
if (i.kind === "number" && n.trim() !== "" && Number.isFinite(Number(n)))
|
|
1273
1277
|
return `<c r="${t}"${o ? ` s="${o}"` : ""}><v>${Number(n)}</v></c>`;
|
|
1274
|
-
const
|
|
1275
|
-
return `<c r="${t}" t="inlineStr"${o ? ` s="${o}"` : ""}><is><t xml:space="preserve">${
|
|
1278
|
+
const f = vn(n.slice(0, 32767));
|
|
1279
|
+
return `<c r="${t}" t="inlineStr"${o ? ` s="${o}"` : ""}><is><t xml:space="preserve">${f}</t></is></c>`;
|
|
1276
1280
|
}
|
|
1277
|
-
const
|
|
1278
|
-
function
|
|
1279
|
-
const i =
|
|
1280
|
-
let m =
|
|
1281
|
-
for (let x = 0; x < Math.min(n.length, 500); x++) m = Math.max(m, a.kind === "date" ? 11 :
|
|
1281
|
+
const co = (t) => t == null ? 0 : typeof t == "boolean" ? 5 : String(t).length;
|
|
1282
|
+
function hl(t, n) {
|
|
1283
|
+
const i = wn(Math.max(0, t.length - 1)), o = n.length + 1, f = t.map((a, g) => {
|
|
1284
|
+
let m = co(a.header) + 3;
|
|
1285
|
+
for (let x = 0; x < Math.min(n.length, 500); x++) m = Math.max(m, a.kind === "date" ? 11 : co(n[x][g]));
|
|
1282
1286
|
return Math.min(60, Math.max(8, m + 2));
|
|
1283
1287
|
}), d = [];
|
|
1284
|
-
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>" +
|
|
1285
|
-
'<row r="1" ht="22" customHeight="1">' + t.map((a, g) => `<c r="${
|
|
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="${sl}" t="inlineStr"><is><t xml:space="preserve">${vn(a.header)}</t></is></c>`).join("") + "</row>"
|
|
1286
1290
|
), n.forEach((a, g) => {
|
|
1287
|
-
const m = g + 2, x = t.map((E, b) =>
|
|
1291
|
+
const m = g + 2, x = t.map((E, b) => fl(`${wn(b)}${m}`, a[b], E)).join("");
|
|
1288
1292
|
d.push(`<row r="${m}">${x}</row>`);
|
|
1289
1293
|
}), d.push("</sheetData>"), d.push(`<autoFilter ref="A1:${i}${o}"/>`), d.push("</worksheet>"), d.join("");
|
|
1290
1294
|
}
|
|
1291
|
-
async function
|
|
1292
|
-
const o =
|
|
1295
|
+
async function pl(t, n, i = {}) {
|
|
1296
|
+
const o = ll(i.sheetName), f = `'${o.replace(/'/g, "''")}'`, d = wn(Math.max(0, t.length - 1)), a = {
|
|
1293
1297
|
"[Content_Types].xml": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1294
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>`,
|
|
1295
1299
|
"_rels/.rels": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1296
1300
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`,
|
|
1297
1301
|
"xl/workbook.xml": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1298
|
-
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="${
|
|
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>`,
|
|
1299
1303
|
"xl/_rels/workbook.xml.rels": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1300
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>`,
|
|
1301
|
-
"xl/styles.xml":
|
|
1302
|
-
"xl/worksheets/sheet1.xml":
|
|
1303
|
-
}, g = await
|
|
1305
|
+
"xl/styles.xml": ul,
|
|
1306
|
+
"xl/worksheets/sheet1.xml": hl(t, n)
|
|
1307
|
+
}, g = await ol(Object.entries(a).map(([m, x]) => ({ name: m, data: vo.encode(x) })));
|
|
1304
1308
|
return new Blob([g], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
|
|
1305
1309
|
}
|
|
1306
|
-
const
|
|
1307
|
-
function
|
|
1310
|
+
const Xn = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), ko = (t, n) => Object.prototype.hasOwnProperty.call(t, n);
|
|
1311
|
+
function we(t, n) {
|
|
1308
1312
|
if (t === null || typeof t != "object") return;
|
|
1309
|
-
if (
|
|
1313
|
+
if (ko(t, n)) return t[n];
|
|
1310
1314
|
let i = t;
|
|
1311
1315
|
for (const o of n.split(".")) {
|
|
1312
|
-
if (i == null || typeof i != "object" ||
|
|
1316
|
+
if (i == null || typeof i != "object" || Xn.has(o)) return;
|
|
1313
1317
|
i = i[o];
|
|
1314
1318
|
}
|
|
1315
1319
|
return i;
|
|
1316
1320
|
}
|
|
1317
|
-
function
|
|
1321
|
+
function uo(t, n, i) {
|
|
1318
1322
|
if (Array.isArray(t)) {
|
|
1319
1323
|
const o = [...t];
|
|
1320
1324
|
return o[n] = i, o;
|
|
1321
1325
|
}
|
|
1322
1326
|
return { ...t, [n]: i };
|
|
1323
1327
|
}
|
|
1324
|
-
function
|
|
1328
|
+
function Gn(t, n, i) {
|
|
1325
1329
|
const o = t ?? {};
|
|
1326
|
-
if (
|
|
1327
|
-
return
|
|
1328
|
-
const [
|
|
1329
|
-
if (
|
|
1330
|
-
const a = o[
|
|
1331
|
-
return
|
|
1330
|
+
if (ko(o, n) || !n.includes("."))
|
|
1331
|
+
return Xn.has(n) ? t : uo(o, n, i);
|
|
1332
|
+
const [f, ...d] = n.split(".");
|
|
1333
|
+
if (Xn.has(f)) return t;
|
|
1334
|
+
const a = o[f];
|
|
1335
|
+
return uo(o, f, Gn(a !== null && typeof a == "object" ? a : {}, d.join("."), i));
|
|
1332
1336
|
}
|
|
1333
|
-
function
|
|
1337
|
+
function fo(t, n) {
|
|
1334
1338
|
if (n.length === 0) return t.map((a, g) => ({ kind: "row", entry: a, i: g }));
|
|
1335
1339
|
const i = /* @__PURE__ */ new Map();
|
|
1336
1340
|
for (const a of n) i.set(a.afterId, [...i.get(a.afterId) ?? [], a]);
|
|
1337
|
-
const o = [],
|
|
1341
|
+
const o = [], f = /* @__PURE__ */ new Set(), d = (a) => {
|
|
1338
1342
|
for (const g of i.get(a) ?? [])
|
|
1339
|
-
|
|
1343
|
+
f.has(g.id) || (f.add(g.id), o.push({ kind: "ghost", ghost: g }), d(g.id));
|
|
1340
1344
|
};
|
|
1341
1345
|
return d(null), t.forEach((a, g) => {
|
|
1342
1346
|
o.push({ kind: "row", entry: a, i: g }), d(a.id);
|
|
1343
|
-
}), n.forEach((a) => !
|
|
1347
|
+
}), n.forEach((a) => !f.has(a.id) && o.push({ kind: "ghost", ghost: a })), o;
|
|
1344
1348
|
}
|
|
1345
|
-
const
|
|
1346
|
-
function
|
|
1347
|
-
const i =
|
|
1348
|
-
return t.valueFormatter ? t.valueFormatter(i, n) : t.type === "boolean" && typeof i == "boolean" ? i ? "Yes" : "No" : t.type === "date" ?
|
|
1349
|
+
const gl = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, $e = 38, ml = 150, ho = 10, Hn = (t, n) => `${typeof t}:${t}\0${n}`;
|
|
1350
|
+
function Mt(t, n) {
|
|
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" ? Ti(i, t.dateLocale, t.dateFormat) : i == null ? "" : i instanceof Date ? i.toLocaleDateString() : String(i);
|
|
1349
1353
|
}
|
|
1350
|
-
function
|
|
1354
|
+
function bl(t, n, i) {
|
|
1351
1355
|
if (i.type === "date") {
|
|
1352
|
-
const o =
|
|
1353
|
-
return o <
|
|
1356
|
+
const o = pe(t) ?? "", f = pe(n) ?? "";
|
|
1357
|
+
return o < f ? -1 : o > f ? 1 : 0;
|
|
1354
1358
|
}
|
|
1355
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" });
|
|
1356
1360
|
}
|
|
1357
|
-
const
|
|
1358
|
-
function
|
|
1361
|
+
const yl = (t) => t ? Array.isArray(t) ? t : [t] : [], po = (t) => t.type === "date" && t.validity.badInput;
|
|
1362
|
+
function kl({
|
|
1359
1363
|
columns: t,
|
|
1360
1364
|
rows: n,
|
|
1361
1365
|
getRowId: i,
|
|
1362
1366
|
editable: o = !1,
|
|
1363
|
-
enterMovesDown:
|
|
1367
|
+
enterMovesDown: f = !0,
|
|
1364
1368
|
onCellEdit: d,
|
|
1365
1369
|
onRowsChange: a,
|
|
1366
1370
|
rowSelection: g = !1,
|
|
@@ -1373,307 +1377,312 @@ function sl({
|
|
|
1373
1377
|
onSortChange: k,
|
|
1374
1378
|
multiSort: D = !1,
|
|
1375
1379
|
searchable: C = !1,
|
|
1376
|
-
searchPlaceholder:
|
|
1380
|
+
searchPlaceholder: F = "Search…",
|
|
1377
1381
|
search: w,
|
|
1378
|
-
onSearchChange:
|
|
1379
|
-
filters:
|
|
1382
|
+
onSearchChange: L,
|
|
1383
|
+
filters: H,
|
|
1380
1384
|
onFiltersChange: q,
|
|
1381
|
-
pagination:
|
|
1382
|
-
paginationPosition:
|
|
1383
|
-
showToolbar:
|
|
1385
|
+
pagination: A = !1,
|
|
1386
|
+
paginationPosition: V = "bottom",
|
|
1387
|
+
showToolbar: ke = !0,
|
|
1384
1388
|
showFooter: Pe = !0,
|
|
1385
1389
|
pageSize: ze = 10,
|
|
1386
|
-
pageSizeOptions:
|
|
1387
|
-
page:
|
|
1388
|
-
onPageChange:
|
|
1389
|
-
onPageSizeChange:
|
|
1390
|
+
pageSizeOptions: Fe = [5, 10, 25, 50],
|
|
1391
|
+
page: Y,
|
|
1392
|
+
onPageChange: se,
|
|
1393
|
+
onPageSizeChange: Ee,
|
|
1390
1394
|
serverSide: _ = !1,
|
|
1391
1395
|
rowCount: G,
|
|
1392
1396
|
onQueryChange: S,
|
|
1393
1397
|
queryDebounce: B = 250,
|
|
1394
1398
|
filterDebounce: ce = 300,
|
|
1395
|
-
loading:
|
|
1399
|
+
loading: ge,
|
|
1396
1400
|
loadingRows: qe,
|
|
1397
|
-
skeletonRow:
|
|
1398
|
-
errorMessage:
|
|
1401
|
+
skeletonRow: rt,
|
|
1402
|
+
errorMessage: Ot = "Could not load the data.",
|
|
1399
1403
|
columnMenu: pt = !1,
|
|
1400
1404
|
onColumnVisibilityChange: Ye,
|
|
1401
1405
|
keyboardNavigation: Ve = !1,
|
|
1402
1406
|
virtualize: de = !1,
|
|
1403
|
-
rowHeight:
|
|
1407
|
+
rowHeight: me = 40,
|
|
1404
1408
|
overscan: gt = 6,
|
|
1405
1409
|
exportable: He = !1,
|
|
1406
1410
|
onExportError: mt,
|
|
1407
1411
|
apiRef: Le,
|
|
1408
1412
|
onRowClick: bt,
|
|
1409
1413
|
toolbar: yt,
|
|
1410
|
-
emptyMessage:
|
|
1414
|
+
emptyMessage: Rt = "No rows to show",
|
|
1411
1415
|
emptyComponent: xt,
|
|
1412
1416
|
sortIndicator: Xe = "default",
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1417
|
+
sortIndicatorRotate: Ut = !0,
|
|
1418
|
+
striped: Ie = !1,
|
|
1419
|
+
stripeColors: Se,
|
|
1420
|
+
checkboxVariant: ot = "native",
|
|
1421
|
+
animateRows: _t = !0,
|
|
1422
|
+
rowAnimation: ue,
|
|
1423
|
+
rowAnimationDuration: Ge,
|
|
1424
|
+
rowAnimationStagger: it,
|
|
1425
|
+
rowAnimationClassName: lt,
|
|
1426
|
+
rowExitAnimationClassName: T,
|
|
1427
|
+
theme: Q,
|
|
1428
|
+
maxHeight: P,
|
|
1429
|
+
stickyToolbar: ae = !1,
|
|
1430
|
+
stickyHeader: Je = !1,
|
|
1431
|
+
stickyOffset: Oe = 0,
|
|
1432
|
+
scrollbar: At = "thin",
|
|
1433
|
+
className: Wt,
|
|
1434
|
+
style: So,
|
|
1435
|
+
classNames: X = {},
|
|
1436
|
+
styles: K = {},
|
|
1437
|
+
rowClassName: Sn,
|
|
1438
|
+
rowStyle: Nn
|
|
1430
1439
|
}) {
|
|
1431
1440
|
const Z = (e, r) => ({
|
|
1432
|
-
className: U(r,
|
|
1433
|
-
style:
|
|
1434
|
-
}), [
|
|
1441
|
+
className: U(r, X[e]),
|
|
1442
|
+
style: K[e]
|
|
1443
|
+
}), [Bt, Qn] = j(n), st = W(n);
|
|
1435
1444
|
ne(() => {
|
|
1436
|
-
|
|
1445
|
+
st.current = n, Qn(n);
|
|
1437
1446
|
}, [n]);
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1440
|
-
}, [
|
|
1441
|
-
|
|
1442
|
-
}, [
|
|
1443
|
-
const l = new Set(
|
|
1444
|
-
r ? l.add(e) : l.delete(e),
|
|
1445
|
-
}, [
|
|
1446
|
-
const e = t.filter((r) => !
|
|
1447
|
+
const Zn = (e) => {
|
|
1448
|
+
st.current = e, Qn(e);
|
|
1449
|
+
}, [wt, er] = It(w, "", L), [at, tr] = It(H, {}, q), [be, No] = It(v, yl(p), k), [Cn, ct] = It(Y, 0, se), [re, Co] = j(ze), Do = (e) => {
|
|
1450
|
+
Co(e), Ee == null || Ee(e);
|
|
1451
|
+
}, [jt, To] = j(() => new Set(t.filter((e) => e.hidden).map((e) => e.field))), Fo = (e, r) => {
|
|
1452
|
+
const l = new Set(jt);
|
|
1453
|
+
r ? l.add(e) : l.delete(e), To(l), Ye == null || Ye([...l]);
|
|
1454
|
+
}, [Dn, nr] = j({}), [Kt, Eo] = j({}), [xl, Io] = j(0), vt = W(/* @__PURE__ */ new Map()), [kt, Qe] = j(null), Re = 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 }), O = ve(() => {
|
|
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);
|
|
1447
1456
|
return [
|
|
1448
1457
|
...e.filter((r) => r.pinned === "left"),
|
|
1449
1458
|
...e.filter((r) => r.pinned !== "left" && r.pinned !== "right"),
|
|
1450
1459
|
...e.filter((r) => r.pinned === "right")
|
|
1451
1460
|
];
|
|
1452
|
-
}, [t,
|
|
1453
|
-
() =>
|
|
1454
|
-
[
|
|
1455
|
-
),
|
|
1456
|
-
|
|
1457
|
-
const
|
|
1458
|
-
() => Object.entries(
|
|
1459
|
-
const l =
|
|
1460
|
-
return !!l && !!l.filterable &&
|
|
1461
|
+
}, [t, jt]), In = (e) => e.sortable === !0, fe = g === "single" ? "single" : g ? "multiple" : null, Nt = O.length + (fe ? 1 : 0), Ze = ve(
|
|
1462
|
+
() => Bt.map((e, r) => ({ row: e, index: r, id: i ? i(e, r) : r })),
|
|
1463
|
+
[Bt, i]
|
|
1464
|
+
), lr = W(/* @__PURE__ */ new Map());
|
|
1465
|
+
Ze.forEach((e) => lr.current.set(e.id, e.row));
|
|
1466
|
+
const dt = ve(
|
|
1467
|
+
() => Object.entries(at).filter(([e, r]) => {
|
|
1468
|
+
const l = O.find((s) => s.field === e);
|
|
1469
|
+
return !!l && !!l.filterable && xo(r);
|
|
1461
1470
|
}),
|
|
1462
|
-
[
|
|
1463
|
-
), [
|
|
1471
|
+
[at, O]
|
|
1472
|
+
), [Mo, $o] = j(wt);
|
|
1464
1473
|
ne(() => {
|
|
1465
1474
|
if (!_) return;
|
|
1466
|
-
const e = setTimeout(() =>
|
|
1475
|
+
const e = setTimeout(() => $o(wt), B);
|
|
1467
1476
|
return () => clearTimeout(e);
|
|
1468
|
-
}, [
|
|
1469
|
-
const
|
|
1470
|
-
if (_) return
|
|
1471
|
-
const e =
|
|
1472
|
-
let r =
|
|
1473
|
-
const y =
|
|
1474
|
-
return
|
|
1477
|
+
}, [wt, _, B]);
|
|
1478
|
+
const Ue = _ ? Mo : wt, sr = (e) => e.filterRenderer ? "text" : Jr(e), Me = ve(() => {
|
|
1479
|
+
if (_) return Ze;
|
|
1480
|
+
const e = Ue.trim().toLowerCase();
|
|
1481
|
+
let r = Ze.filter(({ row: s }) => e && !O.some((c) => Mt(c, s).toLowerCase().includes(e)) ? !1 : dt.every(([c, u]) => {
|
|
1482
|
+
const y = O.find((N) => N.field === c);
|
|
1483
|
+
return Mi(sr(y), u, Mt(y, s), we(s, c));
|
|
1475
1484
|
}));
|
|
1476
|
-
const l =
|
|
1485
|
+
const l = be.map((s) => ({ col: O.find((c) => c.field === s.field), dir: s.direction === "asc" ? 1 : -1 })).filter((s) => !!s.col);
|
|
1477
1486
|
return l.length && (r = [...r].sort((s, c) => {
|
|
1478
|
-
for (const { col:
|
|
1479
|
-
const N =
|
|
1480
|
-
if (
|
|
1481
|
-
if (
|
|
1487
|
+
for (const { col: u, dir: y } of l) {
|
|
1488
|
+
const N = we(s.row, u.field), M = we(c.row, u.field), R = N == null || N === "", ee = M == null || M === "";
|
|
1489
|
+
if (R || ee) {
|
|
1490
|
+
if (R !== ee) return R ? 1 : -1;
|
|
1482
1491
|
continue;
|
|
1483
1492
|
}
|
|
1484
|
-
const
|
|
1485
|
-
if (
|
|
1493
|
+
const ye = u.comparator ? u.comparator(N, M, s.row, c.row) : bl(N, M, u);
|
|
1494
|
+
if (ye !== 0) return ye * y;
|
|
1486
1495
|
}
|
|
1487
1496
|
return 0;
|
|
1488
1497
|
})), r;
|
|
1489
|
-
}, [
|
|
1498
|
+
}, [Ze, O, Ue, dt, be, _]), Yt = JSON.stringify([Ue, at, be, re]), ar = W(Yt);
|
|
1490
1499
|
ne(() => {
|
|
1491
|
-
|
|
1492
|
-
}, [
|
|
1493
|
-
const
|
|
1500
|
+
ar.current !== Yt && (ar.current = Yt, ct(0));
|
|
1501
|
+
}, [Yt]);
|
|
1502
|
+
const ut = _ ? G ?? Ze.length : Me.length, Ae = A ? Math.max(1, Math.ceil(ut / re)) : 1, oe = Math.min(Cn, Ae - 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(
|
|
1494
1503
|
() => ({
|
|
1495
|
-
sort:
|
|
1504
|
+
sort: be.filter((e) => {
|
|
1496
1505
|
const r = t.find((l) => l.field === e.field);
|
|
1497
|
-
return !!r &&
|
|
1506
|
+
return !!r && In(r);
|
|
1498
1507
|
}),
|
|
1499
|
-
filters: Object.fromEntries(
|
|
1500
|
-
search:
|
|
1501
|
-
page:
|
|
1502
|
-
pageSize:
|
|
1508
|
+
filters: Object.fromEntries(dt),
|
|
1509
|
+
search: Ue.trim(),
|
|
1510
|
+
page: oe,
|
|
1511
|
+
pageSize: re
|
|
1503
1512
|
}),
|
|
1504
1513
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1505
|
-
[
|
|
1506
|
-
),
|
|
1507
|
-
|
|
1508
|
-
const
|
|
1509
|
-
|
|
1510
|
-
const [
|
|
1514
|
+
[be, t, dt, Ue, oe, re]
|
|
1515
|
+
), Oo = JSON.stringify(Mn), Vt = W(Mn);
|
|
1516
|
+
Vt.current = Mn;
|
|
1517
|
+
const Ht = W(S);
|
|
1518
|
+
Ht.current = S;
|
|
1519
|
+
const [Ro, Xt] = j(!1), [$n, Pn] = j(!1), Ln = W(0), Gt = Te((e) => {
|
|
1511
1520
|
var s;
|
|
1512
|
-
const r = ++
|
|
1513
|
-
l && typeof l.then == "function" ? (
|
|
1521
|
+
const r = ++Ln.current, l = (s = Ht.current) == null ? void 0 : s.call(Ht, e);
|
|
1522
|
+
l && typeof l.then == "function" ? (Xt(!0), Pn(!1), l.then(
|
|
1514
1523
|
() => {
|
|
1515
|
-
r ===
|
|
1524
|
+
r === Ln.current && Xt(!1);
|
|
1516
1525
|
},
|
|
1517
1526
|
() => {
|
|
1518
|
-
r ===
|
|
1527
|
+
r === Ln.current && (Xt(!1), Pn(!0));
|
|
1519
1528
|
}
|
|
1520
|
-
)) : (
|
|
1529
|
+
)) : (Xt(!1), Pn(!1));
|
|
1521
1530
|
}, []);
|
|
1522
1531
|
ne(() => {
|
|
1523
|
-
_ && Vt
|
|
1524
|
-
}, [_,
|
|
1525
|
-
_ &&
|
|
1526
|
-
}, [_,
|
|
1527
|
-
const
|
|
1532
|
+
_ && Gt(Vt.current);
|
|
1533
|
+
}, [_, Oo, Gt]), ne(() => {
|
|
1534
|
+
_ && A && Cn > Ae - 1 && ct(Ae - 1);
|
|
1535
|
+
}, [_, A, Cn, Ae]);
|
|
1536
|
+
const Ct = ge ?? Ro, cr = (e) => e.map((r) => lr.current.get(r)).filter((r) => r !== void 0), [Ce, Jt] = It(
|
|
1528
1537
|
m,
|
|
1529
1538
|
x ?? [],
|
|
1530
|
-
(e) => E == null ? void 0 : E({ ids: e, rows:
|
|
1531
|
-
),
|
|
1532
|
-
if (!
|
|
1533
|
-
if (
|
|
1534
|
-
|
|
1539
|
+
(e) => E == null ? void 0 : E({ ids: e, rows: cr(e) })
|
|
1540
|
+
), Qt = ve(() => new Set(Ce), [Ce]), Zt = (e) => b ? b(e) : !0, en = W(null), dr = W(!1), Uo = (e, r) => {
|
|
1541
|
+
if (!fe || !Zt(e.row)) return;
|
|
1542
|
+
if (fe === "single") {
|
|
1543
|
+
Jt(r ? [e.id] : []), en.current = e.id;
|
|
1535
1544
|
return;
|
|
1536
1545
|
}
|
|
1537
|
-
const l = new Set(
|
|
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);
|
|
1538
1547
|
if (s >= 0 && c >= 0)
|
|
1539
|
-
for (let
|
|
1540
|
-
|
|
1548
|
+
for (let u = Math.min(s, c); u <= Math.max(s, c); u++)
|
|
1549
|
+
Zt(z[u].row) && (r ? l.add(z[u].id) : l.delete(z[u].id));
|
|
1541
1550
|
else r ? l.add(e.id) : l.delete(e.id);
|
|
1542
|
-
|
|
1543
|
-
},
|
|
1544
|
-
const r = new Set(
|
|
1545
|
-
|
|
1546
|
-
},
|
|
1547
|
-
value:
|
|
1548
|
-
formattedValue:
|
|
1551
|
+
en.current = e.id, Jt([...l]);
|
|
1552
|
+
}, Dt = ve(() => Me.filter((e) => Zt(e.row)), [Me, b]), ur = Dt.filter((e) => Qt.has(e.id)).length, fr = Dt.length > 0 && ur === Dt.length, hr = (e) => {
|
|
1553
|
+
const r = new Set(Ce);
|
|
1554
|
+
Dt.forEach((l) => e ? r.add(l.id) : r.delete(l.id)), Jt([...r]);
|
|
1555
|
+
}, tn = (e, r, l) => ({
|
|
1556
|
+
value: we(r, e.field),
|
|
1557
|
+
formattedValue: Mt(e, r),
|
|
1549
1558
|
row: r,
|
|
1550
1559
|
rowIndex: l,
|
|
1551
1560
|
field: e.field,
|
|
1552
1561
|
column: e
|
|
1553
|
-
}),
|
|
1562
|
+
}), On = (e, r) => {
|
|
1554
1563
|
const l = e.editable ?? o;
|
|
1555
1564
|
return typeof l == "function" ? l(r) : !!l;
|
|
1556
|
-
},
|
|
1557
|
-
const l =
|
|
1565
|
+
}, nn = (e, r) => On(e, r) && !(e.type === "boolean" && !e.cellEditor), Ao = (e, r) => {
|
|
1566
|
+
const l = tn(e, r.row, r.index), s = On(e, l);
|
|
1558
1567
|
return {
|
|
1559
1568
|
...l,
|
|
1560
1569
|
editable: s,
|
|
1561
|
-
updateValue: (c) => s &&
|
|
1570
|
+
updateValue: (c) => s && gr(r, e, { value: c })
|
|
1562
1571
|
};
|
|
1563
|
-
},
|
|
1564
|
-
if (!
|
|
1565
|
-
const l =
|
|
1572
|
+
}, pr = (e, r) => {
|
|
1573
|
+
if (!In(e)) return;
|
|
1574
|
+
const l = be.find((u) => u.field === e.field), s = l ? l.direction === "asc" ? "desc" : null : "asc";
|
|
1566
1575
|
let c;
|
|
1567
|
-
r && D ? s ? l ? c =
|
|
1568
|
-
},
|
|
1576
|
+
r && D ? s ? l ? c = be.map((u) => u.field === e.field ? { ...u, direction: s } : u) : c = [...be, { field: e.field, direction: s }] : c = be.filter((u) => u.field !== e.field) : c = s ? [{ field: e.field, direction: s }] : [], No(c);
|
|
1577
|
+
}, rn = (e, r) => {
|
|
1569
1578
|
var l;
|
|
1570
|
-
return (l =
|
|
1571
|
-
},
|
|
1572
|
-
|
|
1573
|
-
},
|
|
1574
|
-
for (const r of
|
|
1575
|
-
const l =
|
|
1579
|
+
return (l = qt.current.get(Hn(e, r))) == null ? void 0 : l.focus();
|
|
1580
|
+
}, We = () => {
|
|
1581
|
+
Re.current += 1, Qe(null);
|
|
1582
|
+
}, Wo = (e) => {
|
|
1583
|
+
for (const r of st.current) {
|
|
1584
|
+
const l = we(r, e.field);
|
|
1576
1585
|
if (l != null && l !== "") return l;
|
|
1577
1586
|
}
|
|
1578
|
-
},
|
|
1579
|
-
if (!
|
|
1580
|
-
const s =
|
|
1587
|
+
}, on = (e, r, l = {}) => {
|
|
1588
|
+
if (!nn(r, tn(r, e.row, e.index))) return !1;
|
|
1589
|
+
const s = we(e.row, r.field);
|
|
1581
1590
|
let c;
|
|
1582
|
-
return r.cellEditor ? c = s : r.type === "date" ? c =
|
|
1591
|
+
return r.cellEditor ? c = s : r.type === "date" ? c = pe(s) ?? "" : c = l.text ?? (s == null ? "" : String(s)), zt.current = c, Re.current += 1, Qe({
|
|
1583
1592
|
id: e.id,
|
|
1584
1593
|
field: r.field,
|
|
1585
1594
|
draft: c,
|
|
1586
|
-
session:
|
|
1595
|
+
session: Re.current,
|
|
1587
1596
|
select: l.select ?? "end",
|
|
1588
1597
|
invalid: !1
|
|
1589
1598
|
}), !0;
|
|
1590
|
-
},
|
|
1591
|
-
const s =
|
|
1592
|
-
let
|
|
1599
|
+
}, gr = (e, r, l) => {
|
|
1600
|
+
const s = st.current[e.index] ?? e.row, c = we(s, r.field);
|
|
1601
|
+
let u;
|
|
1593
1602
|
if ("value" in l)
|
|
1594
|
-
|
|
1603
|
+
u = l.value;
|
|
1595
1604
|
else if (r.valueParser)
|
|
1596
|
-
|
|
1605
|
+
u = r.valueParser(l.text, s);
|
|
1597
1606
|
else if (r.type === "date") {
|
|
1598
|
-
if (l.text !== "" && !
|
|
1599
|
-
|
|
1607
|
+
if (l.text !== "" && !le(l.text)) return !1;
|
|
1608
|
+
u = Fi(l.text, c ?? Wo(r));
|
|
1600
1609
|
} else if (r.type === "number")
|
|
1601
|
-
if (l.text.trim() === "")
|
|
1610
|
+
if (l.text.trim() === "") u = null;
|
|
1602
1611
|
else {
|
|
1603
1612
|
const M = Number(l.text);
|
|
1604
1613
|
if (!Number.isFinite(M)) return !1;
|
|
1605
|
-
|
|
1614
|
+
u = M;
|
|
1606
1615
|
}
|
|
1607
1616
|
else
|
|
1608
|
-
|
|
1617
|
+
u = l.text;
|
|
1609
1618
|
if (r.type === "date") {
|
|
1610
|
-
if (
|
|
1611
|
-
const M =
|
|
1619
|
+
if (pe(u) === pe(c)) return !0;
|
|
1620
|
+
const M = pe(u);
|
|
1612
1621
|
if (M && (r.dateMin && M < r.dateMin || r.dateMax && M > r.dateMax)) return !1;
|
|
1613
|
-
} else if (Object.is(
|
|
1622
|
+
} else if (Object.is(u, c))
|
|
1614
1623
|
return !0;
|
|
1615
|
-
if (r.validate && !r.validate(
|
|
1616
|
-
const y =
|
|
1617
|
-
return
|
|
1618
|
-
},
|
|
1619
|
-
const s =
|
|
1624
|
+
if (r.validate && !r.validate(u, s)) return !1;
|
|
1625
|
+
const y = Gn(s, r.field, u), N = st.current.map((M, R) => R === e.index ? y : M);
|
|
1626
|
+
return Zn(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
|
+
}, mr = (e, r, l) => {
|
|
1628
|
+
const s = z.findIndex((R) => R.id === e.id), c = O.findIndex((R) => R.field === r);
|
|
1620
1629
|
if (s < 0 || c < 0) return null;
|
|
1621
|
-
const
|
|
1630
|
+
const u = (R, ee) => nn(ee, tn(ee, R.row, R.index));
|
|
1622
1631
|
if (l === "down" || l === "up") {
|
|
1623
|
-
const
|
|
1624
|
-
for (let ee = s +
|
|
1625
|
-
if (
|
|
1632
|
+
const R = l === "down" ? 1 : -1;
|
|
1633
|
+
for (let ee = s + R; ee >= 0 && ee < z.length; ee += R)
|
|
1634
|
+
if (u(z[ee], O[c])) return { entry: z[ee], col: O[c] };
|
|
1626
1635
|
return null;
|
|
1627
1636
|
}
|
|
1628
1637
|
const y = l === "right" ? 1 : -1;
|
|
1629
1638
|
let N = s, M = c + y;
|
|
1630
|
-
for (; N >= 0 && N <
|
|
1631
|
-
for (; M >= 0 && M <
|
|
1632
|
-
if (
|
|
1639
|
+
for (; N >= 0 && N < z.length; ) {
|
|
1640
|
+
for (; M >= 0 && M < O.length; ) {
|
|
1641
|
+
if (u(z[N], O[M])) return { entry: z[N], col: O[M] };
|
|
1633
1642
|
M += y;
|
|
1634
1643
|
}
|
|
1635
|
-
N += y, M = y > 0 ? 0 :
|
|
1644
|
+
N += y, M = y > 0 ? 0 : O.length - 1;
|
|
1636
1645
|
}
|
|
1637
1646
|
return null;
|
|
1638
|
-
},
|
|
1639
|
-
const { move: c = "none", focus:
|
|
1640
|
-
if (!
|
|
1641
|
-
return
|
|
1642
|
-
const y = c === "none" ? null :
|
|
1643
|
-
return y ?
|
|
1644
|
-
},
|
|
1647
|
+
}, et = (e, r, l, s = {}) => {
|
|
1648
|
+
const { move: c = "none", focus: u = !0 } = s;
|
|
1649
|
+
if (!gr(e, r, l))
|
|
1650
|
+
return Qe((N) => N && { ...N, invalid: !0 }), !1;
|
|
1651
|
+
const y = c === "none" ? null : mr(e, r.field, c);
|
|
1652
|
+
return y ? on(y.entry, y.col, { select: "all" }) : (We(), u && rn(e.id, r.field)), !0;
|
|
1653
|
+
}, br = (e, r, l) => {
|
|
1645
1654
|
if (e.nativeEvent.isComposing) return;
|
|
1646
|
-
const s = e.currentTarget.value, c =
|
|
1655
|
+
const s = e.currentTarget.value, c = po(e.currentTarget);
|
|
1647
1656
|
if (e.key === "Enter") {
|
|
1648
|
-
if (e.preventDefault(), c) return
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1657
|
+
if (e.preventDefault(), c) return Qe((y) => y && { ...y, invalid: !0 });
|
|
1658
|
+
const u = f ? e.shiftKey ? "up" : "down" : "none";
|
|
1659
|
+
et(r, l, { text: s }, { move: u });
|
|
1651
1660
|
} else if (e.key === "Escape")
|
|
1652
|
-
e.preventDefault(),
|
|
1661
|
+
e.preventDefault(), We(), rn(r.id, l.field);
|
|
1653
1662
|
else if (e.key === "Tab" && !c) {
|
|
1654
|
-
const
|
|
1655
|
-
|
|
1663
|
+
const u = e.shiftKey ? "left" : "right";
|
|
1664
|
+
mr(r, l.field, u) && (e.preventDefault(), et(r, l, { text: s }, { move: u }));
|
|
1656
1665
|
}
|
|
1657
|
-
},
|
|
1658
|
-
var
|
|
1659
|
-
const l =
|
|
1666
|
+
}, Bo = (e, r) => {
|
|
1667
|
+
var u;
|
|
1668
|
+
const l = z[e], s = O[r];
|
|
1660
1669
|
if (!l || !s) return;
|
|
1661
|
-
|
|
1662
|
-
const c =
|
|
1670
|
+
rr({ id: l.id, field: s.field }), Fn.current = Hn(l.id, s.field);
|
|
1671
|
+
const c = St.current;
|
|
1663
1672
|
if (de && c) {
|
|
1664
|
-
const y = ((
|
|
1665
|
-
N < c.scrollTop ? c.scrollTo({ top: N, behavior: "auto" }) : N +
|
|
1673
|
+
const y = ((u = c.querySelector("thead")) == null ? void 0 : u.clientHeight) ?? 0, N = e * me;
|
|
1674
|
+
N < c.scrollTop ? c.scrollTo({ top: N, behavior: "auto" }) : N + me > c.scrollTop + c.clientHeight - y && c.scrollTo({ top: N + me - c.clientHeight + y, behavior: "auto" });
|
|
1666
1675
|
}
|
|
1667
1676
|
};
|
|
1668
1677
|
ne(() => {
|
|
1669
|
-
const e =
|
|
1678
|
+
const e = Fn.current;
|
|
1670
1679
|
if (!e) return;
|
|
1671
|
-
const r =
|
|
1672
|
-
r && (
|
|
1680
|
+
const r = qt.current.get(e);
|
|
1681
|
+
r && (Fn.current = null, r.focus());
|
|
1673
1682
|
});
|
|
1674
|
-
const
|
|
1683
|
+
const jo = (e, r, l) => {
|
|
1675
1684
|
if (!Ve) return !1;
|
|
1676
|
-
let s =
|
|
1685
|
+
let s = z.findIndex((u) => u.id === r.id), c = O.findIndex((u) => u.field === l.field);
|
|
1677
1686
|
if (s < 0 || c < 0) return !1;
|
|
1678
1687
|
switch (e.key) {
|
|
1679
1688
|
case "ArrowDown":
|
|
@@ -1689,164 +1698,173 @@ function sl({
|
|
|
1689
1698
|
c -= 1;
|
|
1690
1699
|
break;
|
|
1691
1700
|
case "PageDown":
|
|
1692
|
-
s +=
|
|
1701
|
+
s += ho;
|
|
1693
1702
|
break;
|
|
1694
1703
|
case "PageUp":
|
|
1695
|
-
s -=
|
|
1704
|
+
s -= ho;
|
|
1696
1705
|
break;
|
|
1697
1706
|
case "Home":
|
|
1698
1707
|
c = 0, (e.ctrlKey || e.metaKey) && (s = 0);
|
|
1699
1708
|
break;
|
|
1700
1709
|
case "End":
|
|
1701
|
-
c =
|
|
1710
|
+
c = O.length - 1, (e.ctrlKey || e.metaKey) && (s = z.length - 1);
|
|
1702
1711
|
break;
|
|
1703
1712
|
default:
|
|
1704
1713
|
return !1;
|
|
1705
1714
|
}
|
|
1706
|
-
return e.preventDefault(),
|
|
1707
|
-
},
|
|
1708
|
-
e.target === e.currentTarget && (
|
|
1715
|
+
return e.preventDefault(), Bo(Math.max(0, Math.min(z.length - 1, s)), Math.max(0, Math.min(O.length - 1, c))), !0;
|
|
1716
|
+
}, Ko = (e, r, l, s) => {
|
|
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 }))));
|
|
1709
1718
|
};
|
|
1710
|
-
|
|
1711
|
-
if (!de || !
|
|
1712
|
-
const e =
|
|
1719
|
+
Pt(() => {
|
|
1720
|
+
if (!de || !St.current) return;
|
|
1721
|
+
const e = St.current, r = () => ir((s) => s.height === e.clientHeight ? s : { ...s, height: e.clientHeight });
|
|
1713
1722
|
if (r(), typeof ResizeObserver > "u") return;
|
|
1714
1723
|
const l = new ResizeObserver(r);
|
|
1715
1724
|
return l.observe(e), () => l.disconnect();
|
|
1716
1725
|
}, [de]);
|
|
1717
|
-
const
|
|
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)}|${Ue}|${JSON.stringify(at)}`, xr = W(!0);
|
|
1718
1727
|
ne(() => {
|
|
1719
|
-
if (
|
|
1720
|
-
|
|
1728
|
+
if (xr.current) {
|
|
1729
|
+
xr.current = !1;
|
|
1721
1730
|
return;
|
|
1722
1731
|
}
|
|
1723
|
-
const e =
|
|
1732
|
+
const e = St.current;
|
|
1724
1733
|
e && typeof e.scrollTo == "function" && e.scrollTop > 0 && e.scrollTo({ top: 0, behavior: "smooth" });
|
|
1725
|
-
}, [
|
|
1726
|
-
const
|
|
1727
|
-
let
|
|
1728
|
-
const
|
|
1729
|
-
let r =
|
|
1730
|
-
return r === void 0 && (r =
|
|
1731
|
-
}, [
|
|
1734
|
+
}, [qo]);
|
|
1735
|
+
const _r = (typeof ue == "string" ? ue : ue == null ? void 0 : ue.enter) ?? "slide-up", Un = (typeof ue == "string" ? ue : (ue == null ? void 0 : ue.exit) ?? (ue == null ? void 0 : ue.enter)) ?? "slide-up", An = _t && !de, wr = An && (Un !== "none" || !!T), vr = Ge ?? 380, kr = it ?? 28, sn = W(/* @__PURE__ */ new Map());
|
|
1736
|
+
let Yo = 0;
|
|
1737
|
+
const Vo = (e) => {
|
|
1738
|
+
let r = sn.current.get(e);
|
|
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: "" }), Be = W(/* @__PURE__ */ new Map()), Wn = `${oe}|${re}|${_}`, Bn = Te((e) => {
|
|
1732
1741
|
const r = Be.current.get(e);
|
|
1733
|
-
r !== void 0 && clearTimeout(r), Be.current.delete(e),
|
|
1742
|
+
r !== void 0 && clearTimeout(r), Be.current.delete(e), Sr((l) => {
|
|
1734
1743
|
const s = l.find((c) => c.id === e);
|
|
1735
1744
|
return s ? l.filter((c) => c.id !== e).map((c) => c.afterId === e ? { ...c, afterId: s.afterId } : c) : l;
|
|
1736
1745
|
});
|
|
1737
1746
|
}, []);
|
|
1738
|
-
|
|
1739
|
-
const e =
|
|
1740
|
-
|
|
1741
|
-
const l = !
|
|
1742
|
-
let s =
|
|
1747
|
+
Pt(() => {
|
|
1748
|
+
const e = Nr.current, r = new Set(z.map((c) => c.id));
|
|
1749
|
+
sn.current.forEach((c, u) => !r.has(u) && sn.current.delete(u));
|
|
1750
|
+
const l = !wr || Ct || $n || e.pageKey !== Wn || gl();
|
|
1751
|
+
let s = De;
|
|
1743
1752
|
if (l)
|
|
1744
1753
|
s = [];
|
|
1745
1754
|
else {
|
|
1746
|
-
s = s.filter((
|
|
1747
|
-
const c = e.rows.filter((
|
|
1755
|
+
s = s.filter((u) => !r.has(u.id));
|
|
1756
|
+
const c = e.rows.filter((u) => !r.has(u.id) && !s.some((y) => y.id === u.id));
|
|
1748
1757
|
if (c.length > 0) {
|
|
1749
|
-
const
|
|
1758
|
+
const u = c.map((y, N) => {
|
|
1750
1759
|
const M = e.order.indexOf(y.id);
|
|
1751
1760
|
return { id: y.id, entry: y, afterId: M > 0 ? e.order[M - 1] : null, batch: N };
|
|
1752
1761
|
});
|
|
1753
|
-
s = [...s, ...
|
|
1762
|
+
s = [...s, ...u];
|
|
1754
1763
|
}
|
|
1755
1764
|
}
|
|
1756
|
-
(s.length !==
|
|
1757
|
-
}, [
|
|
1758
|
-
const e = !!
|
|
1759
|
-
|
|
1765
|
+
(s.length !== De.length || s.some((c, u) => c !== De[u])) && Sr(s), Nr.current = { rows: z, order: fo(z, s).map((c) => c.kind === "row" ? c.entry.id : c.ghost.id), pageKey: Wn };
|
|
1766
|
+
}, [z, De, Ct, $n, Wn, wr]), ne(() => {
|
|
1767
|
+
const e = !!T;
|
|
1768
|
+
De.forEach((r) => {
|
|
1760
1769
|
if (Be.current.has(r.id)) return;
|
|
1761
|
-
const l = e ? 2500 :
|
|
1762
|
-
Be.current.set(r.id, setTimeout(() =>
|
|
1770
|
+
const l = e ? 2500 : vr * 0.8 + kr * Math.min(r.batch, 24) + 250;
|
|
1771
|
+
Be.current.set(r.id, setTimeout(() => Bn(r.id), l));
|
|
1763
1772
|
}), Be.current.forEach((r, l) => {
|
|
1764
|
-
|
|
1773
|
+
De.some((s) => s.id === l) || (clearTimeout(r), Be.current.delete(l));
|
|
1765
1774
|
});
|
|
1766
|
-
}, [
|
|
1775
|
+
}, [De, vr, kr, T, Bn]), ne(
|
|
1767
1776
|
() => () => {
|
|
1768
1777
|
Be.current.forEach((e) => clearTimeout(e)), Be.current.clear();
|
|
1769
1778
|
},
|
|
1770
1779
|
[]
|
|
1771
1780
|
);
|
|
1772
|
-
const
|
|
1781
|
+
const Ho = ve(() => fo(yr, De), [yr, De]), Cr = W(null), [Xo, Go] = j(0);
|
|
1782
|
+
Pt(() => {
|
|
1783
|
+
const e = Cr.current;
|
|
1784
|
+
if (!e || !ae) return;
|
|
1785
|
+
const r = () => Go(e.offsetHeight);
|
|
1786
|
+
if (r(), typeof ResizeObserver > "u") return;
|
|
1787
|
+
const l = new ResizeObserver(r);
|
|
1788
|
+
return l.observe(e), () => l.disconnect();
|
|
1789
|
+
}, [ae]);
|
|
1790
|
+
const an = Object.keys(Dn).length > 0, cn = (e) => Dn[e.field] ?? (typeof e.width == "number" ? e.width : ml), 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, Qo = O.some((e) => e.width !== void 0 && e.width !== null && e.width !== ""), Zo = O.length > 0 && O.every((e) => typeof e.width == "number"), ei = (e, r) => {
|
|
1773
1791
|
e.preventDefault(), e.stopPropagation();
|
|
1774
|
-
const l = { ...
|
|
1775
|
-
|
|
1792
|
+
const l = { ...Dn };
|
|
1793
|
+
an || O.forEach((R) => {
|
|
1776
1794
|
var ee;
|
|
1777
|
-
return l[
|
|
1795
|
+
return l[R.field] = ((ee = vt.current.get(R.field)) == null ? void 0 : ee.offsetWidth) ?? cn(R);
|
|
1778
1796
|
});
|
|
1779
|
-
const s = e.clientX, c = l[r.field] ??
|
|
1780
|
-
|
|
1781
|
-
const y = (
|
|
1782
|
-
|
|
1797
|
+
const s = e.clientX, c = l[r.field] ?? cn(r), u = e.currentTarget;
|
|
1798
|
+
u.setPointerCapture(e.pointerId), nr(l);
|
|
1799
|
+
const y = (R) => Math.min(r.maxWidth ?? 1 / 0, Math.max(Jo(r), Math.round(R))), N = (R) => nr((ee) => ({ ...ee, [r.field]: y(c + R.clientX - s) })), M = () => {
|
|
1800
|
+
u.removeEventListener("pointermove", N), u.removeEventListener("pointerup", M), u.removeEventListener("pointercancel", M);
|
|
1783
1801
|
};
|
|
1784
|
-
|
|
1802
|
+
u.addEventListener("pointermove", N), u.addEventListener("pointerup", M), u.addEventListener("pointercancel", M);
|
|
1785
1803
|
};
|
|
1786
|
-
|
|
1787
|
-
var c,
|
|
1804
|
+
Pt(() => {
|
|
1805
|
+
var c, u;
|
|
1788
1806
|
const e = {};
|
|
1789
|
-
let r =
|
|
1790
|
-
for (const y of
|
|
1791
|
-
y.pinned === "left" && (e[y.field] = r, r += ((c =
|
|
1807
|
+
let r = fe && O.some((y) => y.pinned === "left") ? $e : 0;
|
|
1808
|
+
for (const y of O)
|
|
1809
|
+
y.pinned === "left" && (e[y.field] = r, r += ((c = vt.current.get(y.field)) == null ? void 0 : c.offsetWidth) ?? 0);
|
|
1792
1810
|
let l = 0;
|
|
1793
|
-
for (const y of [...
|
|
1794
|
-
y.pinned === "right" && (e[y.field] = l, l += ((
|
|
1811
|
+
for (const y of [...O].reverse())
|
|
1812
|
+
y.pinned === "right" && (e[y.field] = l, l += ((u = vt.current.get(y.field)) == null ? void 0 : u.offsetWidth) ?? 0);
|
|
1795
1813
|
const s = Object.keys(e);
|
|
1796
|
-
(s.length !== Object.keys(
|
|
1814
|
+
(s.length !== Object.keys(Kt).length || s.some((y) => e[y] !== Kt[y])) && Eo(e);
|
|
1797
1815
|
}), ne(() => {
|
|
1798
|
-
const e = () =>
|
|
1816
|
+
const e = () => Io((r) => r + 1);
|
|
1799
1817
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1800
1818
|
}, []);
|
|
1801
|
-
const
|
|
1802
|
-
className: e.pinned ? U("rg-grid__pinned", `rg-grid__pinned--${e.pinned}`, r ===
|
|
1803
|
-
style: e.pinned === "left" ? { left:
|
|
1804
|
-
}),
|
|
1819
|
+
const Tr = O.map((e) => e.pinned).lastIndexOf("left"), ti = O.findIndex((e) => e.pinned === "right"), un = Tr >= 0, Fr = (e, r) => ({
|
|
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
|
+
style: e.pinned === "left" ? { left: Kt[e.field] ?? 0 } : e.pinned === "right" ? { right: Kt[e.field] ?? 0 } : void 0
|
|
1822
|
+
}), je = typeof He == "object" ? He : {}, fn = ve(() => {
|
|
1805
1823
|
var r;
|
|
1806
|
-
const e = (r =
|
|
1824
|
+
const e = (r = je.formats) != null && r.length ? je.formats : ["csv"];
|
|
1807
1825
|
return e.filter((l, s) => e.indexOf(l) === s);
|
|
1808
|
-
}, [He]),
|
|
1809
|
-
const r = { ...
|
|
1810
|
-
return c.forEach(({ row:
|
|
1811
|
-
const
|
|
1812
|
-
|
|
1813
|
-
const te =
|
|
1814
|
-
let
|
|
1826
|
+
}, [He]), hn = (e = {}) => {
|
|
1827
|
+
const r = { ...je, ...e, pdf: { ...je.pdf, ...e.pdf } }, l = r.scope ?? "filtered", s = l === "page" || l === "visible", c = s ? z : l === "selected" ? Ze.filter((ye) => Qt.has(ye.id)) : Me, u = r.includeHidden ? t : O, y = s && A ? oe * re : 0, N = u.map((ye) => $t(ye) || ye.field), M = [], R = [], ee = [];
|
|
1828
|
+
return c.forEach(({ row: ye }, jn) => {
|
|
1829
|
+
const mn = [], $ = [], Ft = {};
|
|
1830
|
+
u.forEach((J, Kn) => {
|
|
1831
|
+
const te = we(ye, J.field);
|
|
1832
|
+
let xe, ie;
|
|
1815
1833
|
if (J.type === "sequence") {
|
|
1816
|
-
const
|
|
1817
|
-
|
|
1818
|
-
} else J.exportValue ? (
|
|
1819
|
-
|
|
1820
|
-
const
|
|
1821
|
-
|
|
1822
|
-
}), M.push(
|
|
1823
|
-
}), { opts: r, cols:
|
|
1824
|
-
},
|
|
1825
|
-
const r =
|
|
1826
|
-
return
|
|
1827
|
-
},
|
|
1828
|
-
const r = { ...
|
|
1829
|
-
|
|
1830
|
-
},
|
|
1831
|
-
const r =
|
|
1834
|
+
const yn = qr(J, jn, J.sequenceRestartEachPage ? 0 : y);
|
|
1835
|
+
xe = yn, ie = yn;
|
|
1836
|
+
} else J.exportValue ? (xe = J.exportValue(te, ye), ie = xe ?? null) : J.type === "date" ? (xe = pe(te) ?? "", ie = xe) : (xe = Mt(J, ye), J.type === "number" && typeof te == "number" && Number.isFinite(te) || J.type === "boolean" && typeof te == "boolean" ? ie = te : J.valueFormatter ? ie = xe : te == null ? ie = null : typeof te == "string" || typeof te == "boolean" || typeof te == "number" && Number.isFinite(te) ? ie = te : te instanceof Date ? ie = Number.isNaN(te.getTime()) ? null : te.toISOString() : ie = xe);
|
|
1837
|
+
mn.push(xe), $.push(ie);
|
|
1838
|
+
const bn = r.jsonKeys === "header" ? N[Kn] : J.field;
|
|
1839
|
+
Ft[bn] = J.type === "date" && ie === "" ? null : ie ?? null;
|
|
1840
|
+
}), M.push(mn), R.push($), ee.push(Ft);
|
|
1841
|
+
}), { opts: r, cols: u, headers: N, display: M, typed: R, records: ee };
|
|
1842
|
+
}, pn = (e, r) => `${e.filename ?? "export"}.${r}`, Er = (e = {}) => {
|
|
1843
|
+
const r = hn(e);
|
|
1844
|
+
return Ki(r.headers, r.display, { sanitize: r.opts.sanitize });
|
|
1845
|
+
}, Ir = (e = {}) => {
|
|
1846
|
+
const r = { ...je, ...e };
|
|
1847
|
+
zi(Er(e), pn(r, "csv"));
|
|
1848
|
+
}, Mr = (e = {}) => {
|
|
1849
|
+
const r = hn(e);
|
|
1832
1850
|
return JSON.stringify(r.records, null, r.opts.jsonIndent ?? 2);
|
|
1833
|
-
},
|
|
1834
|
-
const r = { ...
|
|
1835
|
-
|
|
1836
|
-
},
|
|
1837
|
-
const r =
|
|
1838
|
-
header:
|
|
1851
|
+
}, $r = (e = {}) => {
|
|
1852
|
+
const r = { ...je, ...e };
|
|
1853
|
+
_n(new Blob([Mr(e)], { type: "application/json;charset=utf-8" }), pn(r, "json"));
|
|
1854
|
+
}, Pr = async (e = {}) => {
|
|
1855
|
+
const r = hn(e), l = r.cols.map((s) => ({
|
|
1856
|
+
header: $t(s) || s.field,
|
|
1839
1857
|
kind: s.type === "number" || s.type === "sequence" ? "number" : s.type === "date" ? "date" : s.type === "boolean" ? "boolean" : "text",
|
|
1840
1858
|
align: s.align ?? (s.type === "number" || s.type === "sequence" ? "right" : void 0)
|
|
1841
1859
|
}));
|
|
1842
|
-
return
|
|
1843
|
-
},
|
|
1844
|
-
const r = { ...
|
|
1845
|
-
|
|
1846
|
-
},
|
|
1860
|
+
return pl(l, r.typed, { sheetName: r.opts.sheetName });
|
|
1861
|
+
}, Lr = async (e = {}) => {
|
|
1862
|
+
const r = { ...je, ...e };
|
|
1863
|
+
_n(await Pr(e), pn(r, "xlsx"));
|
|
1864
|
+
}, Or = async (e = {}) => {
|
|
1847
1865
|
var l;
|
|
1848
|
-
const r =
|
|
1849
|
-
return
|
|
1866
|
+
const r = hn(e);
|
|
1867
|
+
return Qi(
|
|
1850
1868
|
{
|
|
1851
1869
|
headers: r.headers,
|
|
1852
1870
|
rows: r.display.map((s) => s.map((c) => c == null ? "" : String(c))),
|
|
@@ -1855,41 +1873,41 @@ function sl({
|
|
|
1855
1873
|
},
|
|
1856
1874
|
r.opts.pdf,
|
|
1857
1875
|
// Only when asked: read the grid's colours, stripes and borders from the page
|
|
1858
|
-
(l = r.opts.pdf) != null && l.matchGridStyle ?
|
|
1876
|
+
(l = r.opts.pdf) != null && l.matchGridStyle ? Zi(or.current) : void 0
|
|
1859
1877
|
);
|
|
1860
|
-
},
|
|
1861
|
-
const r = { ...
|
|
1862
|
-
|
|
1863
|
-
},
|
|
1878
|
+
}, Rr = async (e = {}) => {
|
|
1879
|
+
const r = { ...je, ...e };
|
|
1880
|
+
_n(await Or(e), pn(r, "pdf"));
|
|
1881
|
+
}, Ur = async (e, r = {}) => e === "csv" ? Ir(r) : e === "json" ? $r(r) : e === "xlsx" ? Lr(r) : Rr(r), Ar = async (e, r = {}) => {
|
|
1864
1882
|
try {
|
|
1865
|
-
await
|
|
1883
|
+
await Ur(e, r);
|
|
1866
1884
|
} catch (l) {
|
|
1867
1885
|
const s = l instanceof Error ? l : new Error(String(l));
|
|
1868
1886
|
mt ? mt(s, e) : console.error(`[react-gridix] ${e.toUpperCase()} export failed:`, s);
|
|
1869
1887
|
}
|
|
1870
|
-
}, [
|
|
1871
|
-
{ value: "visible", label: "Visible rows", count:
|
|
1888
|
+
}, [Wr, ni] = j("visible"), ri = Ze.filter((e) => Qt.has(e.id)).length, Br = [
|
|
1889
|
+
{ value: "visible", label: "Visible rows", count: z.length },
|
|
1872
1890
|
// Without pagination the visible rows already are every matching row
|
|
1873
|
-
...
|
|
1874
|
-
...
|
|
1875
|
-
],
|
|
1891
|
+
...A ? [{ value: "filtered", label: "All matching rows", count: Me.length }] : [],
|
|
1892
|
+
...fe ? [{ value: "selected", label: "Selected rows", count: ri }] : []
|
|
1893
|
+
], oi = Br.some((e) => e.value === Wr && e.count > 0) ? Wr : "visible";
|
|
1876
1894
|
ne(() => {
|
|
1877
1895
|
Le && (Le.current = {
|
|
1878
|
-
getCsv:
|
|
1879
|
-
exportCsv:
|
|
1880
|
-
getJson:
|
|
1881
|
-
exportJson:
|
|
1882
|
-
getXlsx:
|
|
1883
|
-
exportXlsx:
|
|
1884
|
-
getPdf:
|
|
1885
|
-
exportPdf:
|
|
1886
|
-
exportAs:
|
|
1887
|
-
getSelectedRows: () =>
|
|
1888
|
-
getSelectedRowIds: () =>
|
|
1889
|
-
selectAll: () =>
|
|
1890
|
-
clearSelection: () =>
|
|
1896
|
+
getCsv: Er,
|
|
1897
|
+
exportCsv: Ir,
|
|
1898
|
+
getJson: Mr,
|
|
1899
|
+
exportJson: $r,
|
|
1900
|
+
getXlsx: Pr,
|
|
1901
|
+
exportXlsx: Lr,
|
|
1902
|
+
getPdf: Or,
|
|
1903
|
+
exportPdf: Rr,
|
|
1904
|
+
exportAs: Ur,
|
|
1905
|
+
getSelectedRows: () => cr(Ce),
|
|
1906
|
+
getSelectedRowIds: () => Ce,
|
|
1907
|
+
selectAll: () => hr(!0),
|
|
1908
|
+
clearSelection: () => Jt([]),
|
|
1891
1909
|
refresh: () => {
|
|
1892
|
-
_ && Vt
|
|
1910
|
+
_ && Gt(Vt.current);
|
|
1893
1911
|
}
|
|
1894
1912
|
});
|
|
1895
1913
|
}), ne(
|
|
@@ -1898,71 +1916,71 @@ function sl({
|
|
|
1898
1916
|
},
|
|
1899
1917
|
[Le]
|
|
1900
1918
|
);
|
|
1901
|
-
const
|
|
1902
|
-
var l, s, c,
|
|
1919
|
+
const jr = (e) => {
|
|
1920
|
+
var l, s, c, u, y, N, M, R;
|
|
1903
1921
|
const r = e.checkbox ?? {};
|
|
1904
1922
|
return {
|
|
1905
|
-
variant: r.variant ??
|
|
1923
|
+
variant: r.variant ?? ot,
|
|
1906
1924
|
indicator: r.indicator,
|
|
1907
1925
|
className: r.className,
|
|
1908
1926
|
style: r.style,
|
|
1909
1927
|
classNames: {
|
|
1910
|
-
root: U(
|
|
1911
|
-
control: U(
|
|
1912
|
-
indicator: U(
|
|
1913
|
-
label: (
|
|
1928
|
+
root: U(X.checkbox, (l = r.classNames) == null ? void 0 : l.root),
|
|
1929
|
+
control: U(X.checkboxControl, (s = r.classNames) == null ? void 0 : s.control),
|
|
1930
|
+
indicator: U(X.checkboxIndicator, (c = r.classNames) == null ? void 0 : c.indicator),
|
|
1931
|
+
label: (u = r.classNames) == null ? void 0 : u.label
|
|
1914
1932
|
},
|
|
1915
1933
|
styles: {
|
|
1916
|
-
root: { ...
|
|
1917
|
-
control: { ...
|
|
1918
|
-
indicator: { ...
|
|
1919
|
-
label: (
|
|
1934
|
+
root: { ...K.checkbox, ...(y = r.styles) == null ? void 0 : y.root },
|
|
1935
|
+
control: { ...K.checkboxControl, ...(N = r.styles) == null ? void 0 : N.control },
|
|
1936
|
+
indicator: { ...K.checkboxIndicator, ...(M = r.styles) == null ? void 0 : M.indicator },
|
|
1937
|
+
label: (R = r.styles) == null ? void 0 : R.label
|
|
1920
1938
|
}
|
|
1921
1939
|
};
|
|
1922
|
-
},
|
|
1923
|
-
|
|
1940
|
+
}, tt = (e) => e.stopPropagation(), ii = (e, r) => /* @__PURE__ */ h("span", { className: "rg-grid__checkbox-cell", onClick: tt, onDoubleClick: tt, children: /* @__PURE__ */ h(
|
|
1941
|
+
ft,
|
|
1924
1942
|
{
|
|
1925
|
-
...
|
|
1943
|
+
...jr(e),
|
|
1926
1944
|
checked: !!r.value,
|
|
1927
1945
|
disabled: !r.editable,
|
|
1928
|
-
"aria-label": `Toggle ${
|
|
1946
|
+
"aria-label": `Toggle ${nt(e)}`,
|
|
1929
1947
|
onChange: (l) => r.updateValue(l)
|
|
1930
1948
|
}
|
|
1931
|
-
) }),
|
|
1932
|
-
const l = new Map(
|
|
1949
|
+
) }), Kr = (e) => Me.filter((r) => On(e, tn(e, r.row, r.index))), li = (e, r) => {
|
|
1950
|
+
const l = new Map(Kr(e).map((u) => [u.index, u])), s = [], c = st.current.map((u, y) => {
|
|
1933
1951
|
const N = l.get(y);
|
|
1934
|
-
if (!N) return
|
|
1935
|
-
const M =
|
|
1936
|
-
if (!!M === r || e.validate && !e.validate(r,
|
|
1937
|
-
const
|
|
1938
|
-
return s.push({ rowId: N.id, rowIndex: y, field: e.field, oldValue: M, newValue: r, row:
|
|
1952
|
+
if (!N) return u;
|
|
1953
|
+
const M = we(u, e.field);
|
|
1954
|
+
if (!!M === r || e.validate && !e.validate(r, u)) return u;
|
|
1955
|
+
const R = Gn(u, e.field, r);
|
|
1956
|
+
return s.push({ rowId: N.id, rowIndex: y, field: e.field, oldValue: M, newValue: r, row: R }), R;
|
|
1939
1957
|
});
|
|
1940
|
-
s.length !== 0 && (
|
|
1941
|
-
},
|
|
1942
|
-
const r =
|
|
1943
|
-
return /* @__PURE__ */ h("span", { className: "rg-grid__header-checkbox", onClick:
|
|
1944
|
-
|
|
1958
|
+
s.length !== 0 && (Zn(c), s.forEach((u) => d == null ? void 0 : d(u)), a == null || a(c));
|
|
1959
|
+
}, si = (e) => {
|
|
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
|
+
return /* @__PURE__ */ h("span", { className: "rg-grid__header-checkbox", onClick: tt, onDoubleClick: tt, children: /* @__PURE__ */ h(
|
|
1962
|
+
ft,
|
|
1945
1963
|
{
|
|
1946
|
-
...
|
|
1964
|
+
...jr(e),
|
|
1947
1965
|
checked: c,
|
|
1948
1966
|
indeterminate: s > 0 && !c,
|
|
1949
1967
|
disabled: r.length === 0,
|
|
1950
|
-
label:
|
|
1951
|
-
"aria-label": `Select all ${
|
|
1952
|
-
onChange: (
|
|
1968
|
+
label: $t(e) || void 0,
|
|
1969
|
+
"aria-label": `Select all ${nt(e)}`,
|
|
1970
|
+
onChange: (u) => li(e, u)
|
|
1953
1971
|
}
|
|
1954
1972
|
) });
|
|
1955
|
-
},
|
|
1973
|
+
}, ai = (e, r, l) => {
|
|
1956
1974
|
if (r.cellEditor)
|
|
1957
1975
|
return /* @__PURE__ */ h(
|
|
1958
1976
|
"div",
|
|
1959
1977
|
{
|
|
1960
1978
|
className: "rg-grid__custom-editor",
|
|
1961
1979
|
onBlur: (c) => {
|
|
1962
|
-
c.currentTarget.contains(c.relatedTarget) || l.session ===
|
|
1980
|
+
c.currentTarget.contains(c.relatedTarget) || l.session === Re.current && (et(e, r, { value: zt.current }, { focus: !1 }) || We());
|
|
1963
1981
|
},
|
|
1964
1982
|
onKeyDown: (c) => {
|
|
1965
|
-
c.key === "Escape" && (c.preventDefault(), c.stopPropagation(),
|
|
1983
|
+
c.key === "Escape" && (c.preventDefault(), c.stopPropagation(), We(), rn(e.id, r.field));
|
|
1966
1984
|
},
|
|
1967
1985
|
children: Ke(r.cellEditor, {
|
|
1968
1986
|
value: l.draft,
|
|
@@ -1971,38 +1989,38 @@ function sl({
|
|
|
1971
1989
|
field: r.field,
|
|
1972
1990
|
column: r,
|
|
1973
1991
|
onChange: (c) => {
|
|
1974
|
-
|
|
1992
|
+
zt.current = c, Qe((u) => u && u.session === l.session ? { ...u, draft: c, invalid: !1 } : u);
|
|
1975
1993
|
},
|
|
1976
|
-
onCommit: (c,
|
|
1977
|
-
l.session ===
|
|
1994
|
+
onCommit: (c, u = "none") => {
|
|
1995
|
+
l.session === Re.current && et(e, r, { value: c === void 0 ? zt.current : c }, { move: u });
|
|
1978
1996
|
},
|
|
1979
1997
|
onCancel: () => {
|
|
1980
|
-
|
|
1998
|
+
We(), rn(e.id, r.field);
|
|
1981
1999
|
}
|
|
1982
2000
|
})
|
|
1983
2001
|
}
|
|
1984
2002
|
);
|
|
1985
2003
|
const s = r.type === "date";
|
|
1986
2004
|
return s ? /* @__PURE__ */ h(
|
|
1987
|
-
|
|
2005
|
+
Ei,
|
|
1988
2006
|
{
|
|
1989
2007
|
value: l.draft === null || l.draft === void 0 ? "" : String(l.draft),
|
|
1990
|
-
label: `Edit ${
|
|
2008
|
+
label: `Edit ${nt(r)}`,
|
|
1991
2009
|
invalid: l.invalid,
|
|
1992
2010
|
min: r.dateMin,
|
|
1993
2011
|
max: r.dateMax,
|
|
1994
2012
|
locale: r.dateLocale,
|
|
1995
|
-
theme:
|
|
1996
|
-
className: U("rg-grid__editor", l.invalid && "rg-grid__editor--invalid",
|
|
1997
|
-
style: { textAlign: r.align, ...
|
|
1998
|
-
onChange: (c) =>
|
|
2013
|
+
theme: Q,
|
|
2014
|
+
className: U("rg-grid__editor", l.invalid && "rg-grid__editor--invalid", X.editor),
|
|
2015
|
+
style: { textAlign: r.align, ...K.editor },
|
|
2016
|
+
onChange: (c) => Qe((u) => u && { ...u, draft: c, invalid: !1 }),
|
|
1999
2017
|
onPick: (c) => {
|
|
2000
|
-
l.session ===
|
|
2018
|
+
l.session === Re.current && et(e, r, { text: c }, { focus: !0 });
|
|
2001
2019
|
},
|
|
2002
2020
|
onBlur: (c) => {
|
|
2003
|
-
l.session ===
|
|
2021
|
+
l.session === Re.current && (et(e, r, { text: c.currentTarget.value }, { focus: !1 }) || We());
|
|
2004
2022
|
},
|
|
2005
|
-
onKeyDown: (c) =>
|
|
2023
|
+
onKeyDown: (c) => br(c, e, r)
|
|
2006
2024
|
}
|
|
2007
2025
|
) : /* @__PURE__ */ h(
|
|
2008
2026
|
"input",
|
|
@@ -2011,155 +2029,159 @@ function sl({
|
|
|
2011
2029
|
type: s ? "date" : "text",
|
|
2012
2030
|
min: s ? r.dateMin : void 0,
|
|
2013
2031
|
max: s ? r.dateMax : void 0,
|
|
2014
|
-
className: U("rg-grid__editor", l.invalid && "rg-grid__editor--invalid",
|
|
2015
|
-
style: { textAlign: r.align, ...
|
|
2032
|
+
className: U("rg-grid__editor", l.invalid && "rg-grid__editor--invalid", X.editor),
|
|
2033
|
+
style: { textAlign: r.align, ...K.editor },
|
|
2016
2034
|
value: l.draft === null || l.draft === void 0 ? "" : String(l.draft),
|
|
2017
2035
|
inputMode: r.type === "number" ? "decimal" : void 0,
|
|
2018
|
-
"aria-label": `Edit ${
|
|
2036
|
+
"aria-label": `Edit ${nt(r)}`,
|
|
2019
2037
|
"aria-invalid": l.invalid || void 0,
|
|
2020
2038
|
onChange: (c) => {
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2039
|
+
const u = c.target.value;
|
|
2040
|
+
Qe((y) => y && { ...y, draft: u, invalid: !1 });
|
|
2023
2041
|
},
|
|
2024
2042
|
onFocus: (c) => {
|
|
2025
|
-
const
|
|
2026
|
-
s || (l.select === "all" ?
|
|
2043
|
+
const u = c.currentTarget;
|
|
2044
|
+
s || (l.select === "all" ? u.select() : u.setSelectionRange(u.value.length, u.value.length));
|
|
2027
2045
|
},
|
|
2028
2046
|
onBlur: (c) => {
|
|
2029
|
-
if (l.session ===
|
|
2030
|
-
if (
|
|
2031
|
-
|
|
2047
|
+
if (l.session === Re.current) {
|
|
2048
|
+
if (po(c.currentTarget)) return We();
|
|
2049
|
+
et(e, r, { text: c.currentTarget.value }, { focus: !1 }) || We();
|
|
2032
2050
|
}
|
|
2033
2051
|
},
|
|
2034
|
-
onKeyDown: (c) =>
|
|
2052
|
+
onKeyDown: (c) => br(c, e, r)
|
|
2035
2053
|
}
|
|
2036
2054
|
);
|
|
2037
|
-
},
|
|
2055
|
+
}, ci = ve(() => {
|
|
2038
2056
|
const e = /* @__PURE__ */ new Map();
|
|
2039
|
-
for (const r of
|
|
2040
|
-
r.filterable && !r.filterRenderer &&
|
|
2057
|
+
for (const r of O)
|
|
2058
|
+
r.filterable && !r.filterRenderer && Jr(r) === "select" && e.set(r.field, $i(r, Bt, (l) => we(l, r.field), (l) => Mt(r, l)));
|
|
2041
2059
|
return e;
|
|
2042
|
-
}, [
|
|
2043
|
-
...
|
|
2044
|
-
...
|
|
2045
|
-
},
|
|
2060
|
+
}, [O, Bt]), di = {
|
|
2061
|
+
...Ge !== void 0 ? { "--rg-row-duration": `${Ge}ms`, "--rg-row-exit-duration": `${Math.round(Ge * 0.8)}ms` } : null,
|
|
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 = Pe && A && (V === "top" || V === "both"), pi = Pe && A && (V === "bottom" || V === "both"), gi = ke && (C || !!yt || pt || !!He), zr = (e) => /* @__PURE__ */ I(
|
|
2046
2064
|
"div",
|
|
2047
2065
|
{
|
|
2048
|
-
className: U("rg-grid__footer", e === "top" && "rg-grid__footer--top",
|
|
2049
|
-
style:
|
|
2066
|
+
className: U("rg-grid__footer", e === "top" && "rg-grid__footer--top", X.footer),
|
|
2067
|
+
style: K.footer,
|
|
2050
2068
|
"data-position": e,
|
|
2051
2069
|
children: [
|
|
2052
2070
|
/* @__PURE__ */ I("span", { ...Z("rowCount", "rg-grid__count"), children: [
|
|
2053
|
-
|
|
2054
|
-
|
|
2071
|
+
ut === 0 ? "0 rows" : `${Po}–${Lo} of ${ut}`,
|
|
2072
|
+
fe && Ce.length > 0 ? ` · ${Ce.length} selected` : ""
|
|
2055
2073
|
] }),
|
|
2056
2074
|
/* @__PURE__ */ I("div", { ...Z("pagination", "rg-grid__pagination"), children: [
|
|
2057
2075
|
/* @__PURE__ */ I("label", { className: "rg-grid__page-size-label", children: [
|
|
2058
2076
|
"Rows per page",
|
|
2059
|
-
/* @__PURE__ */ h("select", { value:
|
|
2077
|
+
/* @__PURE__ */ h("select", { value: re, onChange: (r) => Do(Number(r.target.value)), ...Z("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)) })
|
|
2060
2078
|
] }),
|
|
2061
|
-
/* @__PURE__ */ h("button", { type: "button", "aria-label": "First page", disabled:
|
|
2062
|
-
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Previous page", disabled:
|
|
2079
|
+
/* @__PURE__ */ h("button", { type: "button", "aria-label": "First page", disabled: oe === 0, onClick: () => ct(0), ...Z("pageButton", "rg-grid__page-btn"), children: "«" }),
|
|
2080
|
+
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Previous page", disabled: oe === 0, onClick: () => ct(oe - 1), ...Z("pageButton", "rg-grid__page-btn"), children: "‹" }),
|
|
2063
2081
|
/* @__PURE__ */ I("span", { ...Z("pageInfo", "rg-grid__page-info"), children: [
|
|
2064
2082
|
"Page ",
|
|
2065
|
-
|
|
2083
|
+
oe + 1,
|
|
2066
2084
|
" of ",
|
|
2067
|
-
|
|
2085
|
+
Ae
|
|
2068
2086
|
] }),
|
|
2069
|
-
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Next page", disabled:
|
|
2070
|
-
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Last page", disabled:
|
|
2087
|
+
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Next page", disabled: oe >= Ae - 1, onClick: () => ct(oe + 1), ...Z("pageButton", "rg-grid__page-btn"), children: "›" }),
|
|
2088
|
+
/* @__PURE__ */ h("button", { type: "button", "aria-label": "Last page", disabled: oe >= Ae - 1, onClick: () => ct(Ae - 1), ...Z("pageButton", "rg-grid__page-btn"), children: "»" })
|
|
2071
2089
|
] })
|
|
2072
2090
|
]
|
|
2073
2091
|
}
|
|
2074
|
-
),
|
|
2075
|
-
const s = e.sortIndicator ?? Xe
|
|
2076
|
-
|
|
2077
|
-
r === "asc" ? "▲" : r === "desc" ? "▼" : "↕"
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
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(el, { direction: r, priority: l }) : s !== "default" ? Ke(s, { column: e, direction: r, priority: l }) : (
|
|
2094
|
+
// Default: ↕ before sorting, then one ▲ that turns into ▼ (or stays ▲ when not turning)
|
|
2095
|
+
u ? r ? "▲" : "↕" : r === "asc" ? "▲" : r === "desc" ? "▼" : "↕"
|
|
2096
|
+
);
|
|
2097
|
+
return /* @__PURE__ */ I("span", { ...Z("sortIndicator", U("rg-grid__sort", c && "rg-grid__sort--custom")), "aria-hidden": "true", "data-direction": r ?? "none", children: [
|
|
2098
|
+
u ? /* @__PURE__ */ h(tl, { direction: r, children: y }) : y,
|
|
2099
|
+
s === "default" && l !== void 0 && /* @__PURE__ */ h("sup", { className: "rg-grid__sort-order", children: l })
|
|
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 ? (
|
|
2081
2102
|
// A custom component draws the whole row content inside one wide cell
|
|
2082
|
-
/* @__PURE__ */ h("td", { colSpan:
|
|
2083
|
-
) : /* @__PURE__ */ I(
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
] }) }, `sk${e}`),
|
|
2087
|
-
const { row: s, id: c, index:
|
|
2103
|
+
/* @__PURE__ */ h("td", { colSpan: Nt, className: "rg-grid__td rg-grid__skeleton-cell", children: Ke(rt, { rowIndex: e, columns: O }) })
|
|
2104
|
+
) : /* @__PURE__ */ I(ht, { children: [
|
|
2105
|
+
fe && /* @__PURE__ */ h("td", { className: "rg-grid__td", children: /* @__PURE__ */ h("span", { ...Z("skeleton", "rg-grid__skeleton"), style: { ...K.skeleton, width: 18 } }) }),
|
|
2106
|
+
O.map((r, l) => /* @__PURE__ */ h("td", { className: "rg-grid__td", style: { textAlign: r.align }, children: /* @__PURE__ */ h("span", { ...Z("skeleton", "rg-grid__skeleton"), style: { ...K.skeleton, width: `${55 + (e * 7 + l * 13) % 35}%` } }) }, r.field))
|
|
2107
|
+
] }) }, `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 = Qt.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}`);
|
|
2088
2109
|
return /* @__PURE__ */ I(
|
|
2089
2110
|
"tr",
|
|
2090
2111
|
{
|
|
2091
|
-
onClick: bt && !y ? () => bt(s,
|
|
2112
|
+
onClick: bt && !y ? () => bt(s, u) : void 0,
|
|
2092
2113
|
"aria-hidden": y || void 0,
|
|
2093
|
-
onAnimationEnd: l ? ($) => $.target === $.currentTarget &&
|
|
2094
|
-
"aria-selected":
|
|
2114
|
+
onAnimationEnd: l ? ($) => $.target === $.currentTarget && Bn(l.id) : void 0,
|
|
2115
|
+
"aria-selected": fe ? R : void 0,
|
|
2095
2116
|
className: U(
|
|
2096
2117
|
"rg-grid__tr",
|
|
2097
2118
|
"rg-grid__row",
|
|
2098
|
-
|
|
2119
|
+
ui && (r % 2 === 0 ? "rg-grid__row--stripe-a" : "rg-grid__row--stripe-b"),
|
|
2099
2120
|
// Rows are not animated while virtualizing. New rows play the enter class once, when they are created.
|
|
2100
|
-
|
|
2101
|
-
y &&
|
|
2102
|
-
|
|
2121
|
+
An && !y && jn,
|
|
2122
|
+
y && mn,
|
|
2123
|
+
R && "rg-grid__row--selected",
|
|
2103
2124
|
bt && "rg-grid__row--clickable",
|
|
2104
|
-
|
|
2125
|
+
X.row,
|
|
2105
2126
|
N
|
|
2106
2127
|
),
|
|
2107
2128
|
style: {
|
|
2108
|
-
...
|
|
2109
|
-
...de ? { height:
|
|
2110
|
-
...
|
|
2129
|
+
...An ? { "--rg-i": l ? Math.min(l.batch, 24) : Vo(c) } : null,
|
|
2130
|
+
...de ? { height: me } : null,
|
|
2131
|
+
...K.row,
|
|
2111
2132
|
...M
|
|
2112
2133
|
},
|
|
2113
2134
|
children: [
|
|
2114
|
-
|
|
2135
|
+
fe && /* @__PURE__ */ h(
|
|
2115
2136
|
"td",
|
|
2116
2137
|
{
|
|
2117
|
-
className: U("rg-grid__td rg-grid__select-cell",
|
|
2118
|
-
style: { width:
|
|
2119
|
-
onClick:
|
|
2120
|
-
children: /* @__PURE__ */ h("span", { className: "rg-grid__checkbox-cell", onClickCapture: ($) =>
|
|
2121
|
-
|
|
2138
|
+
className: U("rg-grid__td rg-grid__select-cell", un && "rg-grid__pinned rg-grid__pinned--left"),
|
|
2139
|
+
style: { width: $e, minWidth: $e, maxWidth: $e, ...un ? { left: 0 } : null },
|
|
2140
|
+
onClick: tt,
|
|
2141
|
+
children: /* @__PURE__ */ h("span", { className: "rg-grid__checkbox-cell", onClickCapture: ($) => dr.current = $.shiftKey, children: /* @__PURE__ */ h(
|
|
2142
|
+
ft,
|
|
2122
2143
|
{
|
|
2123
|
-
variant:
|
|
2124
|
-
checked:
|
|
2125
|
-
disabled: y || !
|
|
2126
|
-
"aria-label":
|
|
2127
|
-
onChange: ($) =>
|
|
2128
|
-
classNames: { root:
|
|
2129
|
-
styles: { root:
|
|
2144
|
+
variant: ot,
|
|
2145
|
+
checked: R,
|
|
2146
|
+
disabled: y || !Zt(s),
|
|
2147
|
+
"aria-label": fe === "single" ? "Select row" : `Select row ${u + 1}`,
|
|
2148
|
+
onChange: ($) => Uo(e, $),
|
|
2149
|
+
classNames: { root: X.checkbox, control: X.checkboxControl, indicator: X.checkboxIndicator },
|
|
2150
|
+
styles: { root: K.checkbox, control: K.checkboxControl, indicator: K.checkboxIndicator }
|
|
2130
2151
|
}
|
|
2131
2152
|
) })
|
|
2132
2153
|
}
|
|
2133
2154
|
),
|
|
2134
|
-
|
|
2135
|
-
let J =
|
|
2155
|
+
O.map(($, Ft) => {
|
|
2156
|
+
let J = Ao($, e);
|
|
2136
2157
|
if ($.type === "sequence") {
|
|
2137
|
-
const Ne =
|
|
2158
|
+
const Ne = qr($, r);
|
|
2138
2159
|
J = { ...J, value: Ne, formattedValue: $.valueFormatter ? $.valueFormatter(Ne, s) : String(Ne), editable: !1 };
|
|
2139
2160
|
}
|
|
2140
|
-
const
|
|
2161
|
+
const Kn = typeof $.cellClassName == "function" ? $.cellClassName(J) : $.cellClassName, te = typeof $.cellStyle == "function" ? $.cellStyle(J) : $.cellStyle, xe = kt !== null && kt.id === c && kt.field === $.field, ie = nn($, J), bn = Fr($, Ft), yn = Tn ? Tn.id === c && Tn.field === $.field : r === 0 && Ft === 0;
|
|
2141
2162
|
return /* @__PURE__ */ h(
|
|
2142
2163
|
"td",
|
|
2143
2164
|
{
|
|
2144
2165
|
ref: y ? void 0 : (Ne) => {
|
|
2145
|
-
const
|
|
2146
|
-
Ne ?
|
|
2166
|
+
const Vr = Hn(c, $.field);
|
|
2167
|
+
Ne ? qt.current.set(Vr, Ne) : qt.current.delete(Vr);
|
|
2147
2168
|
},
|
|
2148
|
-
tabIndex: y ? void 0 : Ve ?
|
|
2149
|
-
onFocus: Ve && !y ? (Ne) => Ne.target === Ne.currentTarget &&
|
|
2150
|
-
onDoubleClick:
|
|
2151
|
-
onKeyDown: y ? void 0 : (Ne) =>
|
|
2169
|
+
tabIndex: y ? void 0 : Ve ? yn ? 0 : -1 : ie ? 0 : void 0,
|
|
2170
|
+
onFocus: Ve && !y ? (Ne) => Ne.target === Ne.currentTarget && rr({ id: c, field: $.field }) : void 0,
|
|
2171
|
+
onDoubleClick: ie && !y ? () => on(e, $) : void 0,
|
|
2172
|
+
onKeyDown: y ? void 0 : (Ne) => Ko(Ne, e, $, J),
|
|
2152
2173
|
className: U(
|
|
2153
2174
|
"rg-grid__td",
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2175
|
+
ie && "rg-grid__td--editable",
|
|
2176
|
+
xe && "rg-grid__td--editing",
|
|
2177
|
+
dn($) && !xe && `rg-grid__cell--${dn($)}`,
|
|
2178
|
+
bn.className,
|
|
2179
|
+
X.cell,
|
|
2158
2180
|
$.className,
|
|
2159
|
-
|
|
2181
|
+
Kn
|
|
2160
2182
|
),
|
|
2161
|
-
style: { textAlign: $.align, ...
|
|
2162
|
-
children:
|
|
2183
|
+
style: { textAlign: $.align, ...Dr($), ...K.cell, ...$.style, ...te, ...bn.style },
|
|
2184
|
+
children: xe && kt && !y ? ai(e, $, kt) : $.cellRenderer ? Ke($.cellRenderer, J) : $.type === "boolean" && !$.cellEditor ? ii($, J) : J.formattedValue
|
|
2163
2185
|
},
|
|
2164
2186
|
$.field
|
|
2165
2187
|
);
|
|
@@ -2168,161 +2190,180 @@ function sl({
|
|
|
2168
2190
|
},
|
|
2169
2191
|
y ? `ghost:${c}` : c
|
|
2170
2192
|
);
|
|
2171
|
-
},
|
|
2193
|
+
}, yi = Ue.trim() !== "" || dt.length > 0 ? "no-results" : "no-data", xi = qe ?? (A ? Math.min(re, 20) : 5), gn = (ae || Je) && P === void 0 && !de, _i = typeof Oe == "number" ? `${Oe}px` : Oe, wi = gn ? {
|
|
2194
|
+
"--rg-sticky-offset": _i,
|
|
2195
|
+
// The header sits just under the toolbar when the toolbar is sticky too
|
|
2196
|
+
"--rg-sticky-toolbar-h": ae ? `${Xo}px` : "0px"
|
|
2197
|
+
} : null;
|
|
2172
2198
|
return /* @__PURE__ */ I(
|
|
2173
2199
|
"div",
|
|
2174
2200
|
{
|
|
2175
|
-
ref:
|
|
2176
|
-
className: U(
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2201
|
+
ref: or,
|
|
2202
|
+
className: U(
|
|
2203
|
+
"rg-grid",
|
|
2204
|
+
de && "rg-grid--virtual",
|
|
2205
|
+
gn && "rg-grid--sticky-page",
|
|
2206
|
+
gn && ae && "rg-grid--sticky-toolbar",
|
|
2207
|
+
gn && Je && "rg-grid--sticky-header",
|
|
2208
|
+
X.root,
|
|
2209
|
+
Wt
|
|
2210
|
+
),
|
|
2211
|
+
style: { ...fi, ...di, ...wi, ...K.root, ...So },
|
|
2212
|
+
"data-rg-theme": Q || void 0,
|
|
2213
|
+
"aria-busy": Ct || void 0,
|
|
2180
2214
|
children: [
|
|
2181
|
-
|
|
2215
|
+
gi && /* @__PURE__ */ I("div", { ref: Cr, ...Z("toolbar", "rg-grid__toolbar"), children: [
|
|
2182
2216
|
/* @__PURE__ */ I("div", { className: "rg-grid__toolbar-left", children: [
|
|
2183
2217
|
C && /* @__PURE__ */ h(
|
|
2184
2218
|
"input",
|
|
2185
2219
|
{
|
|
2186
2220
|
type: "search",
|
|
2187
|
-
value:
|
|
2188
|
-
onChange: (e) =>
|
|
2189
|
-
placeholder:
|
|
2221
|
+
value: wt,
|
|
2222
|
+
onChange: (e) => er(e.target.value),
|
|
2223
|
+
placeholder: F,
|
|
2190
2224
|
"aria-label": "Search all columns",
|
|
2191
2225
|
...Z("search", "rg-grid__search")
|
|
2192
2226
|
}
|
|
2193
2227
|
),
|
|
2194
|
-
|
|
2195
|
-
|
|
2228
|
+
fe && Ce.length > 0 && /* @__PURE__ */ I("span", { className: "rg-grid__selected-count", role: "status", children: [
|
|
2229
|
+
Ce.length,
|
|
2196
2230
|
" selected"
|
|
2197
2231
|
] })
|
|
2198
2232
|
] }),
|
|
2199
2233
|
/* @__PURE__ */ I("div", { className: "rg-grid__toolbar-actions", children: [
|
|
2200
2234
|
yt,
|
|
2201
2235
|
pt && /* @__PURE__ */ h(
|
|
2202
|
-
|
|
2236
|
+
Wi,
|
|
2203
2237
|
{
|
|
2204
2238
|
columns: t,
|
|
2205
|
-
hidden:
|
|
2206
|
-
onToggle:
|
|
2207
|
-
theme:
|
|
2208
|
-
className:
|
|
2209
|
-
style:
|
|
2239
|
+
hidden: jt,
|
|
2240
|
+
onToggle: Fo,
|
|
2241
|
+
theme: Q,
|
|
2242
|
+
className: X.toolButton,
|
|
2243
|
+
style: K.toolButton
|
|
2210
2244
|
}
|
|
2211
2245
|
),
|
|
2212
|
-
He && (
|
|
2246
|
+
He && (fn.length > 1 ? (
|
|
2213
2247
|
// Several formats: a menu with "which rows" and one button per format
|
|
2214
2248
|
/* @__PURE__ */ h(
|
|
2215
|
-
|
|
2249
|
+
Vi,
|
|
2216
2250
|
{
|
|
2217
|
-
formats:
|
|
2218
|
-
scopes:
|
|
2219
|
-
scope:
|
|
2220
|
-
onScopeChange:
|
|
2221
|
-
onExport: (e, r) =>
|
|
2222
|
-
theme:
|
|
2223
|
-
className: U(
|
|
2224
|
-
style: { ...
|
|
2251
|
+
formats: fn,
|
|
2252
|
+
scopes: Br,
|
|
2253
|
+
scope: oi,
|
|
2254
|
+
onScopeChange: ni,
|
|
2255
|
+
onExport: (e, r) => Ar(e, { scope: r }),
|
|
2256
|
+
theme: Q,
|
|
2257
|
+
className: U(X.toolButton, X.exportMenu),
|
|
2258
|
+
style: { ...K.toolButton, ...K.exportMenu }
|
|
2225
2259
|
}
|
|
2226
2260
|
)
|
|
2227
2261
|
) : (
|
|
2228
2262
|
// One format: a plain button ("Export CSV"), using the scope from `exportable` (default: all matching rows)
|
|
2229
|
-
/* @__PURE__ */ h("button", { type: "button", onClick: () =>
|
|
2263
|
+
/* @__PURE__ */ h("button", { type: "button", onClick: () => Ar(fn[0]), ...Z("toolButton", "rg-grid__tool-btn"), children: Yi(fn[0]) })
|
|
2230
2264
|
))
|
|
2231
2265
|
] })
|
|
2232
2266
|
] }),
|
|
2233
|
-
|
|
2267
|
+
hi && zr("top"),
|
|
2234
2268
|
/* @__PURE__ */ h(
|
|
2235
2269
|
"div",
|
|
2236
2270
|
{
|
|
2237
|
-
ref:
|
|
2238
|
-
...Z("scroll", "rg-grid__scroll"),
|
|
2239
|
-
onScroll: de ? (e) =>
|
|
2240
|
-
style: { ...
|
|
2271
|
+
ref: St,
|
|
2272
|
+
...Z("scroll", U("rg-grid__scroll", `rg-grid__scroll--${At}`)),
|
|
2273
|
+
onScroll: de ? (e) => ir({ top: e.currentTarget.scrollTop, height: e.currentTarget.clientHeight }) : void 0,
|
|
2274
|
+
style: { ...K.scroll, ...P !== void 0 ? { maxHeight: P } : de ? { maxHeight: 400 } : null },
|
|
2241
2275
|
children: /* @__PURE__ */ I(
|
|
2242
2276
|
"table",
|
|
2243
2277
|
{
|
|
2244
2278
|
...Z("table", "rg-grid__table"),
|
|
2245
2279
|
role: "grid",
|
|
2246
|
-
style:
|
|
2247
|
-
...
|
|
2280
|
+
style: an ? {
|
|
2281
|
+
...K.table,
|
|
2248
2282
|
tableLayout: "fixed",
|
|
2249
|
-
width:
|
|
2283
|
+
width: O.reduce((e, r) => e + cn(r), fe ? $e : 0),
|
|
2250
2284
|
minWidth: "100%"
|
|
2251
|
-
} :
|
|
2285
|
+
} : Qo ? {
|
|
2286
|
+
...K.table,
|
|
2287
|
+
tableLayout: "fixed",
|
|
2288
|
+
// Every width is a number: the table is exactly as wide as their sum (no stretching)
|
|
2289
|
+
...Zo ? { width: O.reduce((e, r) => e + r.width, fe ? $e : 0) } : null
|
|
2290
|
+
} : K.table,
|
|
2252
2291
|
children: [
|
|
2253
2292
|
/* @__PURE__ */ h("thead", { ...Z("thead", "rg-grid__thead"), children: /* @__PURE__ */ I("tr", { ...Z("headerRow", "rg-grid__tr"), children: [
|
|
2254
|
-
|
|
2293
|
+
fe && /* @__PURE__ */ h(
|
|
2255
2294
|
"th",
|
|
2256
2295
|
{
|
|
2257
2296
|
scope: "col",
|
|
2258
|
-
className: U("rg-grid__th rg-grid__select-cell",
|
|
2259
|
-
style: { width:
|
|
2260
|
-
children:
|
|
2261
|
-
|
|
2297
|
+
className: U("rg-grid__th rg-grid__select-cell", un && "rg-grid__pinned rg-grid__pinned--left", X.headerCell),
|
|
2298
|
+
style: { width: $e, minWidth: $e, maxWidth: $e, ...un ? { left: 0 } : null, ...K.headerCell },
|
|
2299
|
+
children: fe === "multiple" && /* @__PURE__ */ h("span", { className: "rg-grid__checkbox-cell", children: /* @__PURE__ */ h(
|
|
2300
|
+
ft,
|
|
2262
2301
|
{
|
|
2263
|
-
variant:
|
|
2264
|
-
checked:
|
|
2265
|
-
indeterminate:
|
|
2266
|
-
disabled:
|
|
2302
|
+
variant: ot,
|
|
2303
|
+
checked: fr,
|
|
2304
|
+
indeterminate: ur > 0 && !fr,
|
|
2305
|
+
disabled: Dt.length === 0,
|
|
2267
2306
|
"aria-label": "Select all rows",
|
|
2268
|
-
onChange:
|
|
2269
|
-
classNames: { root:
|
|
2270
|
-
styles: { root:
|
|
2307
|
+
onChange: hr,
|
|
2308
|
+
classNames: { root: X.checkbox, control: X.checkboxControl, indicator: X.checkboxIndicator },
|
|
2309
|
+
styles: { root: K.checkbox, control: K.checkboxControl, indicator: K.checkboxIndicator }
|
|
2271
2310
|
}
|
|
2272
2311
|
) })
|
|
2273
2312
|
}
|
|
2274
2313
|
),
|
|
2275
|
-
|
|
2276
|
-
const l =
|
|
2314
|
+
O.map((e, r) => {
|
|
2315
|
+
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);
|
|
2277
2316
|
return /* @__PURE__ */ I(
|
|
2278
2317
|
"th",
|
|
2279
2318
|
{
|
|
2280
2319
|
ref: (N) => {
|
|
2281
|
-
N ?
|
|
2320
|
+
N ? vt.current.set(e.field, N) : vt.current.delete(e.field);
|
|
2282
2321
|
},
|
|
2283
2322
|
scope: "col",
|
|
2284
2323
|
"aria-sort": s ? s === "asc" ? "ascending" : "descending" : c ? "none" : void 0,
|
|
2285
2324
|
tabIndex: c ? 0 : void 0,
|
|
2286
|
-
onClick: (N) =>
|
|
2325
|
+
onClick: (N) => pr(e, N.shiftKey),
|
|
2287
2326
|
onKeyDown: (N) => {
|
|
2288
|
-
c && N.target === N.currentTarget && (N.key === "Enter" || N.key === " ") && (N.preventDefault(),
|
|
2327
|
+
c && N.target === N.currentTarget && (N.key === "Enter" || N.key === " ") && (N.preventDefault(), pr(e, N.shiftKey));
|
|
2289
2328
|
},
|
|
2290
|
-
className: U("rg-grid__th", c && "rg-grid__th--sortable", y.className,
|
|
2329
|
+
className: U("rg-grid__th", c && "rg-grid__th--sortable", dn(e) && `rg-grid__cell--${dn(e)}`, y.className, X.headerCell, e.className, e.headerClassName),
|
|
2291
2330
|
style: {
|
|
2292
|
-
width:
|
|
2331
|
+
width: an ? cn(e) : e.width,
|
|
2293
2332
|
minWidth: e.minWidth,
|
|
2333
|
+
maxWidth: an ? void 0 : e.maxWidth,
|
|
2294
2334
|
textAlign: e.align,
|
|
2295
|
-
...
|
|
2335
|
+
...Dr(e),
|
|
2336
|
+
...K.headerCell,
|
|
2296
2337
|
...e.style,
|
|
2297
2338
|
...e.headerStyle,
|
|
2298
2339
|
...y.style
|
|
2299
2340
|
},
|
|
2300
2341
|
children: [
|
|
2301
2342
|
/* @__PURE__ */ I("span", { className: "rg-grid__th-content", children: [
|
|
2302
|
-
e.headerRenderer ? Ke(e.headerRenderer, { column: e, sortDirection: s }) : e.headerCheckbox && e.type === "boolean" ?
|
|
2343
|
+
e.headerRenderer ? Ke(e.headerRenderer, { column: e, sortDirection: s }) : e.headerCheckbox && e.type === "boolean" ? si(e) : /* @__PURE__ */ h("span", { className: "rg-grid__th-label", children: $t(e) }),
|
|
2303
2344
|
e.filterable && /* @__PURE__ */ h(
|
|
2304
|
-
|
|
2345
|
+
Ai,
|
|
2305
2346
|
{
|
|
2306
2347
|
column: e,
|
|
2307
|
-
label:
|
|
2308
|
-
kind:
|
|
2309
|
-
value:
|
|
2348
|
+
label: nt(e),
|
|
2349
|
+
kind: u,
|
|
2350
|
+
value: at[e.field],
|
|
2310
2351
|
onChange: (N) => {
|
|
2311
|
-
const M = { ...
|
|
2312
|
-
N === void 0 ? delete M[e.field] : M[e.field] = N,
|
|
2352
|
+
const M = { ...at };
|
|
2353
|
+
N === void 0 ? delete M[e.field] : M[e.field] = N, tr(M);
|
|
2313
2354
|
},
|
|
2314
|
-
options:
|
|
2355
|
+
options: ci.get(e.field) ?? [],
|
|
2315
2356
|
debounce: e.filterDebounce ?? ce,
|
|
2316
|
-
theme:
|
|
2317
|
-
indicatorClassName: U(
|
|
2318
|
-
indicatorStyle: { ...
|
|
2319
|
-
popupClassName: U(
|
|
2320
|
-
popupStyle: { ...
|
|
2321
|
-
inputClassName:
|
|
2322
|
-
inputStyle:
|
|
2357
|
+
theme: Q,
|
|
2358
|
+
indicatorClassName: U(X.filterIndicator, e.filterIndicatorClassName),
|
|
2359
|
+
indicatorStyle: { ...K.filterIndicator, ...e.filterIndicatorStyle },
|
|
2360
|
+
popupClassName: U(X.filterPopup, e.filterPopupClassName),
|
|
2361
|
+
popupStyle: { ...K.filterPopup, ...e.filterPopupStyle },
|
|
2362
|
+
inputClassName: X.filterInput,
|
|
2363
|
+
inputStyle: K.filterInput
|
|
2323
2364
|
}
|
|
2324
2365
|
),
|
|
2325
|
-
c &&
|
|
2366
|
+
c && mi(e, s, s && be.length > 1 ? l + 1 : void 0)
|
|
2326
2367
|
] }),
|
|
2327
2368
|
e.resizable && /* @__PURE__ */ h(
|
|
2328
2369
|
"span",
|
|
@@ -2330,10 +2371,10 @@ function sl({
|
|
|
2330
2371
|
className: "rg-grid__resizer",
|
|
2331
2372
|
role: "separator",
|
|
2332
2373
|
"aria-orientation": "vertical",
|
|
2333
|
-
"aria-label": `Resize ${
|
|
2334
|
-
onPointerDown: (N) =>
|
|
2335
|
-
onClick:
|
|
2336
|
-
onDoubleClick:
|
|
2374
|
+
"aria-label": `Resize ${nt(e)}`,
|
|
2375
|
+
onPointerDown: (N) => ei(N, e),
|
|
2376
|
+
onClick: tt,
|
|
2377
|
+
onDoubleClick: tt
|
|
2337
2378
|
}
|
|
2338
2379
|
)
|
|
2339
2380
|
]
|
|
@@ -2342,35 +2383,35 @@ function sl({
|
|
|
2342
2383
|
);
|
|
2343
2384
|
})
|
|
2344
2385
|
] }) }),
|
|
2345
|
-
/* @__PURE__ */ h("tbody", { ...Z("tbody", "rg-grid__tbody"), children:
|
|
2346
|
-
|
|
2386
|
+
/* @__PURE__ */ h("tbody", { ...Z("tbody", "rg-grid__tbody"), children: Ct ? Array.from({ length: xi }, (e, r) => bi(r)) : $n ? /* @__PURE__ */ h("tr", { children: /* @__PURE__ */ I("td", { colSpan: Nt, ...Z("empty", "rg-grid__empty rg-grid__error"), role: "alert", children: [
|
|
2387
|
+
Ot,
|
|
2347
2388
|
" ",
|
|
2348
|
-
/* @__PURE__ */ h("button", { type: "button", className: "rg-grid__tool-btn", onClick: () => Vt
|
|
2349
|
-
] }) }) :
|
|
2350
|
-
reason:
|
|
2351
|
-
search:
|
|
2352
|
-
filters: Object.fromEntries(
|
|
2353
|
-
columns:
|
|
2389
|
+
/* @__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, ...Z("empty", U("rg-grid__empty", xt && "rg-grid__empty--custom")), children: xt ? Ke(xt, {
|
|
2391
|
+
reason: yi,
|
|
2392
|
+
search: Ue.trim(),
|
|
2393
|
+
filters: Object.fromEntries(dt),
|
|
2394
|
+
columns: O,
|
|
2354
2395
|
clearAll: () => {
|
|
2355
|
-
|
|
2396
|
+
er(""), tr({});
|
|
2356
2397
|
}
|
|
2357
|
-
}) :
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2398
|
+
}) : Rt }) }) : /* @__PURE__ */ I(ht, { children: [
|
|
2399
|
+
Tt && ln > 0 && /* @__PURE__ */ h("tr", { "aria-hidden": "true", className: "rg-grid__spacer", children: /* @__PURE__ */ h("td", { colSpan: Nt, style: { height: ln * me } }) }),
|
|
2400
|
+
Ho.map((e) => e.kind === "row" ? Yr(e.entry, ln + e.i) : Yr(e.ghost.entry, 0, e.ghost)),
|
|
2401
|
+
Tt && Rn < z.length && /* @__PURE__ */ h("tr", { "aria-hidden": "true", className: "rg-grid__spacer", children: /* @__PURE__ */ h("td", { colSpan: Nt, style: { height: (z.length - Rn) * me } }) })
|
|
2361
2402
|
] }) })
|
|
2362
2403
|
]
|
|
2363
2404
|
}
|
|
2364
2405
|
)
|
|
2365
2406
|
}
|
|
2366
2407
|
),
|
|
2367
|
-
|
|
2408
|
+
pi && zr("bottom")
|
|
2368
2409
|
]
|
|
2369
2410
|
}
|
|
2370
2411
|
);
|
|
2371
2412
|
}
|
|
2372
2413
|
export {
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2414
|
+
ft as Checkbox,
|
|
2415
|
+
kl as DataGrid,
|
|
2416
|
+
el as SortArrow
|
|
2376
2417
|
};
|