@opennsw/jsonforms-renderers 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/renderers.cjs.js +2 -2
- package/dist/renderers.es.js +244 -244
- package/package.json +1 -1
package/dist/renderers.es.js
CHANGED
|
@@ -2,10 +2,10 @@ var mr = Object.defineProperty;
|
|
|
2
2
|
var gr = (e, t, r) => t in e ? mr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var Pe = (e, t, r) => gr(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { jsx as n, jsxs as g, Fragment as be } from "react/jsx-runtime";
|
|
5
|
-
import { useContext as Ze, createContext as Qe, useMemo as yr, useEffect as fe, useState as
|
|
6
|
-
import { rankWith as
|
|
5
|
+
import { useContext as Ze, createContext as Qe, useMemo as yr, useEffect as fe, useState as U, useRef as de, useCallback as _e } from "react";
|
|
6
|
+
import { rankWith as K, isStringControl as vr, or as Le, isNumberControl as br, isIntegerControl as wr, isBooleanControl as Er, isEnumControl as er, isOneOfControl as rr, schemaMatches as ze, isDateControl as Rr, isDateTimeControl as Cr, isTimeControl as Tr, uiTypeIs as Te, and as Ar, Resolve as Sr, createDefaultValue as Or, isObjectArrayControl as Nr, isPrimitiveArrayControl as Ir } from "@jsonforms/core";
|
|
7
7
|
import { withJsonFormsControlProps as se, JsonFormsDispatch as Ae, useJsonForms as xr, withJsonFormsArrayControlProps as Mr } from "@jsonforms/react";
|
|
8
|
-
import { Box as
|
|
8
|
+
import { Box as R, Flex as S, Text as h, TextField as ye, Checkbox as kr, RadioGroup as Ve, Select as Ne, ScrollArea as Lr, Spinner as Me, Button as ke, Tabs as Ie, Heading as tr, Card as nr, IconButton as Ue, Tooltip as We, Table as P } from "@radix-ui/themes";
|
|
9
9
|
import { ChevronDownIcon as zr, FileTextIcon as Dr, CheckCircledIcon as Fr, Cross2Icon as or, ExclamationTriangleIcon as lr, UploadIcon as He, TrashIcon as Ur, PlusIcon as Hr } from "@radix-ui/react-icons";
|
|
10
10
|
import $r from "dayjs";
|
|
11
11
|
import { read as _r, utils as Pr } from "@e965/xlsx";
|
|
@@ -55,7 +55,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
55
55
|
if (ce(c, r, t), c === !1)
|
|
56
56
|
return null;
|
|
57
57
|
const u = s.length === 0;
|
|
58
|
-
return /* @__PURE__ */ n(
|
|
58
|
+
return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(S, { direction: "column", gap: "1", children: [
|
|
59
59
|
/* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
60
60
|
i,
|
|
61
61
|
" ",
|
|
@@ -75,7 +75,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
75
75
|
!u && /* @__PURE__ */ n(h, { color: "red", size: "1", children: ae(s, i) }),
|
|
76
76
|
a.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: a.description })
|
|
77
77
|
] }) });
|
|
78
|
-
}, Kr =
|
|
78
|
+
}, Kr = K(1, vr), Gr = se(Br), Xr = ({
|
|
79
79
|
data: e,
|
|
80
80
|
handleChange: t,
|
|
81
81
|
path: r,
|
|
@@ -98,7 +98,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
98
98
|
const v = Number(m);
|
|
99
99
|
isNaN(v) || t(r, v);
|
|
100
100
|
};
|
|
101
|
-
return /* @__PURE__ */ n(
|
|
101
|
+
return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(S, { direction: "column", gap: "1", children: [
|
|
102
102
|
/* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
103
103
|
i,
|
|
104
104
|
" ",
|
|
@@ -119,7 +119,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
119
119
|
!u && /* @__PURE__ */ n(h, { color: "red", size: "1", children: ae(s, i) }),
|
|
120
120
|
a.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: a.description })
|
|
121
121
|
] }) });
|
|
122
|
-
}, jr =
|
|
122
|
+
}, jr = K(2, Le(br, wr)), Yr = se(Xr), Jr = ({
|
|
123
123
|
data: e,
|
|
124
124
|
handleChange: t,
|
|
125
125
|
path: r,
|
|
@@ -133,7 +133,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
133
133
|
if (ce(o, r, t), o === !1)
|
|
134
134
|
return null;
|
|
135
135
|
const c = s.length === 0;
|
|
136
|
-
return /* @__PURE__ */ g(
|
|
136
|
+
return /* @__PURE__ */ g(R, { mb: "4", children: [
|
|
137
137
|
/* @__PURE__ */ g(S, { gap: "2", align: "center", children: [
|
|
138
138
|
/* @__PURE__ */ n(
|
|
139
139
|
kr,
|
|
@@ -153,7 +153,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
153
153
|
!c && /* @__PURE__ */ n(h, { color: "red", size: "1", className: "block mt-1", children: ae(s, i) }),
|
|
154
154
|
l.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", className: "block mt-1", children: l.description })
|
|
155
155
|
] });
|
|
156
|
-
}, qr =
|
|
156
|
+
}, qr = K(2, Er), Zr = se(Jr), Qr = ({
|
|
157
157
|
data: e,
|
|
158
158
|
handleChange: t,
|
|
159
159
|
path: r,
|
|
@@ -173,7 +173,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
173
173
|
label: p.title || String(p.const)
|
|
174
174
|
})));
|
|
175
175
|
const y = e;
|
|
176
|
-
return /* @__PURE__ */ n(
|
|
176
|
+
return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(S, { direction: "column", gap: "1", children: [
|
|
177
177
|
/* @__PURE__ */ g(h, { as: "div", size: "2", weight: "bold", children: [
|
|
178
178
|
i,
|
|
179
179
|
" ",
|
|
@@ -233,7 +233,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
233
233
|
label: v.title || String(v.const)
|
|
234
234
|
})));
|
|
235
235
|
const p = e !== void 0 ? String(e) : "";
|
|
236
|
-
return /* @__PURE__ */ n(
|
|
236
|
+
return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(S, { direction: "column", gap: "1", children: [
|
|
237
237
|
/* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
238
238
|
i,
|
|
239
239
|
" ",
|
|
@@ -253,7 +253,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
253
253
|
!u && /* @__PURE__ */ n(h, { color: "red", size: "1", children: ae(s, i) }),
|
|
254
254
|
l.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: l.description })
|
|
255
255
|
] }) });
|
|
256
|
-
}, nt =
|
|
256
|
+
}, nt = K(2, Le(er, rr)), ot = se(tt), lt = {
|
|
257
257
|
"small-list": { fetchOnOpen: !0, searchable: !1, paginated: !1 },
|
|
258
258
|
"large-searchable-list": { fetchOnOpen: !0, searchable: !0, paginated: !1 },
|
|
259
259
|
"large-paginated-list": { fetchOnOpen: !1, searchable: !0, paginated: !0 }
|
|
@@ -270,27 +270,27 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
270
270
|
uischema: c
|
|
271
271
|
}) => {
|
|
272
272
|
var Re;
|
|
273
|
-
const u = (o == null ? void 0 : o["x-search"]) ?? { service: "" }, y = u.service ?? "", p = u.mode ?? "large-paginated-list", m = lt[p], v = (m == null ? void 0 : m.fetchOnOpen) ?? !1, N = u.params, A = Wr(y), w = o.type === "object",
|
|
273
|
+
const u = (o == null ? void 0 : o["x-search"]) ?? { service: "" }, y = u.service ?? "", p = u.mode ?? "large-paginated-list", m = lt[p], v = (m == null ? void 0 : m.fetchOnOpen) ?? !1, N = u.params, A = Wr(y), w = o.type === "object", I = w ? typeof e == "string" ? { value: e } : e ?? void 0 : void 0, L = w ? I == null ? void 0 : I.value : e, D = I == null ? void 0 : I.label, C = y ? A ? m ? null : `Invalid x-search.mode "${p}". Expected "small-list", "large-searchable-list", or "large-paginated-list".` : `Search service "${y}" is not registered.` : "Search not configured.", H = l !== !1, W = !s || s.length === 0, [x, O] = U(!1), [F, B] = U(""), [oe, ee] = U([]), [le, Y] = U(!1), [Z, re] = U(!1), [he, ne] = U(!1), [ue, b] = U(null), [k, $] = U(void 0), T = de(void 0), _ = de(null), J = de(null), Q = de(null), G = de(void 0);
|
|
274
274
|
fe(() => {
|
|
275
275
|
var E, q;
|
|
276
276
|
if (!L) {
|
|
277
|
-
|
|
277
|
+
$(void 0), G.current = void 0;
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
|
-
if (((E =
|
|
281
|
-
if (
|
|
282
|
-
|
|
280
|
+
if (((E = G.current) == null ? void 0 : E.value) === L && ((q = G.current) == null ? void 0 : q.label) === D) return;
|
|
281
|
+
if (G.current = { value: L, label: D }, w && D) {
|
|
282
|
+
$({ id: L, name: D });
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
|
-
if (
|
|
285
|
+
if ($({ id: L, name: D ?? L }), !(A != null && A.resolve)) return;
|
|
286
286
|
let d = !1;
|
|
287
287
|
return A.resolve(L, N).then((te) => {
|
|
288
|
-
!d && te &&
|
|
288
|
+
!d && te && $(te);
|
|
289
289
|
}).catch(() => {
|
|
290
290
|
}), () => {
|
|
291
291
|
d = !0;
|
|
292
292
|
};
|
|
293
|
-
}, [L,
|
|
293
|
+
}, [L, D, w, A, N]);
|
|
294
294
|
const we = _e(
|
|
295
295
|
async (d, E = !1) => {
|
|
296
296
|
var te;
|
|
@@ -319,39 +319,39 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
319
319
|
[A, m == null ? void 0 : m.paginated, N]
|
|
320
320
|
);
|
|
321
321
|
if (fe(() => {
|
|
322
|
-
if (!
|
|
322
|
+
if (!x) return;
|
|
323
323
|
const d = (E) => {
|
|
324
324
|
Q.current && !Q.current.contains(E.target) && O(!1);
|
|
325
325
|
};
|
|
326
326
|
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
327
|
-
}, [
|
|
327
|
+
}, [x]), fe(() => {
|
|
328
328
|
var d;
|
|
329
|
-
|
|
330
|
-
}, [
|
|
331
|
-
if (!
|
|
332
|
-
if (!
|
|
329
|
+
x || ((d = J.current) == null || d.abort(), B(""), ee([]), Y(!1), b(null), re(!1), ne(!1), T.current = void 0);
|
|
330
|
+
}, [x]), fe(() => {
|
|
331
|
+
if (!x) return;
|
|
332
|
+
if (!F && !v) {
|
|
333
333
|
ee([]), Y(!1), b(null), T.current = void 0;
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
|
-
|
|
337
|
-
const d =
|
|
338
|
-
return
|
|
339
|
-
ee([]), Y(!1), T.current = void 0, we(
|
|
336
|
+
_.current && clearTimeout(_.current);
|
|
337
|
+
const d = F ? 300 : 0;
|
|
338
|
+
return _.current = setTimeout(() => {
|
|
339
|
+
ee([]), Y(!1), T.current = void 0, we(F);
|
|
340
340
|
}, d), () => {
|
|
341
|
-
|
|
341
|
+
_.current && clearTimeout(_.current);
|
|
342
342
|
};
|
|
343
|
-
}, [
|
|
343
|
+
}, [F, x, v, we]), ce(a, r, t, w ? void 0 : null), a === !1)
|
|
344
344
|
return null;
|
|
345
345
|
const Ee = () => {
|
|
346
|
-
|
|
346
|
+
B(""), ee([]), Y(!1), b(null), T.current = void 0, O(!0);
|
|
347
347
|
}, De = (d) => {
|
|
348
|
-
t(r, w ? { value: d.id, label: d.name } : d.id),
|
|
348
|
+
t(r, w ? { value: d.id, label: d.name } : d.id), $(d), G.current = { value: d.id, label: w ? d.name : void 0 }, O(!1);
|
|
349
349
|
}, Se = (d) => {
|
|
350
|
-
d.stopPropagation(), t(r, w ? void 0 : null),
|
|
350
|
+
d.stopPropagation(), t(r, w ? void 0 : null), $(void 0);
|
|
351
351
|
}, Fe = (d) => {
|
|
352
352
|
(d.key === "Enter" || d.key === " ") && Se(d);
|
|
353
353
|
}, Oe = ((Re = c == null ? void 0 : c.options) == null ? void 0 : Re.placeholder) ?? "Select an option";
|
|
354
|
-
return /* @__PURE__ */ n(
|
|
354
|
+
return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(S, { direction: "column", gap: "1", children: [
|
|
355
355
|
/* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
356
356
|
i,
|
|
357
357
|
" ",
|
|
@@ -362,22 +362,22 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
362
362
|
ye.Root,
|
|
363
363
|
{
|
|
364
364
|
id: r,
|
|
365
|
-
value:
|
|
366
|
-
placeholder:
|
|
367
|
-
disabled: !
|
|
368
|
-
readOnly:
|
|
369
|
-
style:
|
|
365
|
+
value: x ? F : (k == null ? void 0 : k.name) ?? "",
|
|
366
|
+
placeholder: x && (m != null && m.searchable) ? "Search..." : Oe,
|
|
367
|
+
disabled: !H,
|
|
368
|
+
readOnly: x && !(m != null && m.searchable),
|
|
369
|
+
style: W ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
|
|
370
370
|
onChange: (d) => {
|
|
371
|
-
m != null && m.searchable && (
|
|
371
|
+
m != null && m.searchable && (B(d.target.value), x || Ee());
|
|
372
372
|
},
|
|
373
373
|
onFocus: () => {
|
|
374
|
-
|
|
374
|
+
H && !x && Ee();
|
|
375
375
|
},
|
|
376
376
|
onKeyDown: (d) => {
|
|
377
377
|
d.key === "Escape" && O(!1);
|
|
378
378
|
},
|
|
379
379
|
children: /* @__PURE__ */ n(ye.Slot, { side: "right", children: /* @__PURE__ */ g(S, { align: "center", gap: "1", children: [
|
|
380
|
-
L &&
|
|
380
|
+
L && H && /* @__PURE__ */ n(
|
|
381
381
|
"span",
|
|
382
382
|
{
|
|
383
383
|
role: "button",
|
|
@@ -393,14 +393,14 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
393
393
|
/* @__PURE__ */ n(
|
|
394
394
|
zr,
|
|
395
395
|
{
|
|
396
|
-
style: { transform:
|
|
396
|
+
style: { transform: x ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
|
|
397
397
|
}
|
|
398
398
|
)
|
|
399
399
|
] }) })
|
|
400
400
|
}
|
|
401
401
|
),
|
|
402
|
-
|
|
403
|
-
|
|
402
|
+
x && /* @__PURE__ */ n(
|
|
403
|
+
R,
|
|
404
404
|
{
|
|
405
405
|
style: {
|
|
406
406
|
position: "absolute",
|
|
@@ -414,12 +414,12 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
414
414
|
border: "1px solid var(--gray-a6)",
|
|
415
415
|
overflow: "hidden"
|
|
416
416
|
},
|
|
417
|
-
children:
|
|
417
|
+
children: C ? /* @__PURE__ */ n(R, { p: "3", children: /* @__PURE__ */ n(h, { size: "2", color: "gray", children: C }) }) : /* @__PURE__ */ n(Lr, { style: { maxHeight: 240 }, children: /* @__PURE__ */ g(R, { p: "1", children: [
|
|
418
418
|
Z && /* @__PURE__ */ n(S, { justify: "center", p: "4", children: /* @__PURE__ */ n(Me, {}) }),
|
|
419
|
-
!Z && ue && /* @__PURE__ */ n(
|
|
420
|
-
!Z && !ue && oe.length === 0 && /* @__PURE__ */ n(
|
|
419
|
+
!Z && ue && /* @__PURE__ */ n(R, { px: "3", py: "2", children: /* @__PURE__ */ n(h, { size: "2", color: "red", children: ue }) }),
|
|
420
|
+
!Z && !ue && oe.length === 0 && /* @__PURE__ */ n(R, { px: "3", py: "2", children: /* @__PURE__ */ n(h, { size: "2", color: "gray", children: F || v ? "No results found." : "Type to search…" }) }),
|
|
421
421
|
oe.map((d) => /* @__PURE__ */ n(
|
|
422
|
-
|
|
422
|
+
R,
|
|
423
423
|
{
|
|
424
424
|
px: "3",
|
|
425
425
|
py: "2",
|
|
@@ -435,14 +435,14 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
435
435
|
},
|
|
436
436
|
d.id
|
|
437
437
|
)),
|
|
438
|
-
(m == null ? void 0 : m.paginated) && le && !he && /* @__PURE__ */ n(
|
|
438
|
+
(m == null ? void 0 : m.paginated) && le && !he && /* @__PURE__ */ n(R, { px: "3", py: "2", children: /* @__PURE__ */ n(
|
|
439
439
|
ke,
|
|
440
440
|
{
|
|
441
441
|
variant: "ghost",
|
|
442
442
|
size: "1",
|
|
443
443
|
style: { width: "100%" },
|
|
444
444
|
onMouseDown: (d) => d.preventDefault(),
|
|
445
|
-
onClick: () => void we(
|
|
445
|
+
onClick: () => void we(F, !0),
|
|
446
446
|
children: "Load more"
|
|
447
447
|
}
|
|
448
448
|
) }),
|
|
@@ -451,10 +451,10 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
451
451
|
}
|
|
452
452
|
)
|
|
453
453
|
] }),
|
|
454
|
-
!
|
|
454
|
+
!W && /* @__PURE__ */ n(h, { color: "red", size: "1", children: ae(s, i) }),
|
|
455
455
|
o.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: o.description })
|
|
456
456
|
] }) });
|
|
457
|
-
}, st = se(it), ct =
|
|
457
|
+
}, st = se(it), ct = K(
|
|
458
458
|
3,
|
|
459
459
|
ze((e) => {
|
|
460
460
|
const t = e["x-search"];
|
|
@@ -462,7 +462,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
462
462
|
})
|
|
463
463
|
), at = (e, t) => $r(`${e}T${t}`).format(), ut = ({ path: e, label: t, required: r, errors: i, description: f, children: s }) => {
|
|
464
464
|
const l = i.length === 0;
|
|
465
|
-
return /* @__PURE__ */ n(
|
|
465
|
+
return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(S, { direction: "column", gap: "1", children: [
|
|
466
466
|
/* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", htmlFor: e, children: [
|
|
467
467
|
t,
|
|
468
468
|
" ",
|
|
@@ -502,12 +502,12 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
502
502
|
}
|
|
503
503
|
)
|
|
504
504
|
);
|
|
505
|
-
const p = l.format === "date-time", [m = "", v = ""] = u.split("T"), N = v.slice(0, 5), A = (w,
|
|
505
|
+
const p = l.format === "date-time", [m = "", v = ""] = u.split("T"), N = v.slice(0, 5), A = (w, I) => {
|
|
506
506
|
if (!w) {
|
|
507
507
|
t(r, void 0);
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
t(r, p ? at(w,
|
|
510
|
+
t(r, p ? at(w, I || "00:00") : w);
|
|
511
511
|
};
|
|
512
512
|
return y(
|
|
513
513
|
/* @__PURE__ */ g(S, { gap: "2", align: "center", children: [
|
|
@@ -536,7 +536,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
536
536
|
)
|
|
537
537
|
] })
|
|
538
538
|
);
|
|
539
|
-
}, ft =
|
|
539
|
+
}, ft = K(2, Le(Rr, Cr, Tr)), ht = se(dt), pt = ({
|
|
540
540
|
uischema: e,
|
|
541
541
|
schema: t,
|
|
542
542
|
path: r,
|
|
@@ -558,7 +558,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
558
558
|
},
|
|
559
559
|
`${r}-${u}`
|
|
560
560
|
)) });
|
|
561
|
-
}, mt =
|
|
561
|
+
}, mt = K(1, Te("VerticalLayout")), gt = ({
|
|
562
562
|
uischema: e,
|
|
563
563
|
schema: t,
|
|
564
564
|
path: r,
|
|
@@ -568,7 +568,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
568
568
|
visible: l = !0
|
|
569
569
|
}) => {
|
|
570
570
|
const o = e.elements;
|
|
571
|
-
return l === !1 ? null : /* @__PURE__ */ n(S, { direction: "row", gap: "4", children: o.map((c, u) => /* @__PURE__ */ n(
|
|
571
|
+
return l === !1 ? null : /* @__PURE__ */ n(S, { direction: "row", gap: "4", children: o.map((c, u) => /* @__PURE__ */ n(R, { style: { flex: 1 }, children: /* @__PURE__ */ n(
|
|
572
572
|
Ae,
|
|
573
573
|
{
|
|
574
574
|
uischema: c,
|
|
@@ -579,7 +579,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
579
579
|
enabled: s
|
|
580
580
|
}
|
|
581
581
|
) }, `${r}-${u}`)) });
|
|
582
|
-
}, yt =
|
|
582
|
+
}, yt = K(1, Te("HorizontalLayout")), vt = ({
|
|
583
583
|
uischema: e,
|
|
584
584
|
schema: t,
|
|
585
585
|
path: r,
|
|
@@ -589,7 +589,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
589
589
|
visible: l = !0
|
|
590
590
|
}) => {
|
|
591
591
|
const a = e, o = a.elements;
|
|
592
|
-
return l === !1 ? null : /* @__PURE__ */ g(
|
|
592
|
+
return l === !1 ? null : /* @__PURE__ */ g(R, { mb: "6", children: [
|
|
593
593
|
a.label && /* @__PURE__ */ n(tr, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: a.label }),
|
|
594
594
|
/* @__PURE__ */ n(S, { direction: "column", gap: "4", children: o.map((c, u) => /* @__PURE__ */ n(
|
|
595
595
|
Ae,
|
|
@@ -604,7 +604,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
604
604
|
`${r}-${u}`
|
|
605
605
|
)) })
|
|
606
606
|
] });
|
|
607
|
-
}, bt =
|
|
607
|
+
}, bt = K(1, Te("Group")), wt = ({
|
|
608
608
|
uischema: e,
|
|
609
609
|
schema: t,
|
|
610
610
|
path: r,
|
|
@@ -614,12 +614,12 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
614
614
|
visible: l = !0
|
|
615
615
|
}) => {
|
|
616
616
|
var p;
|
|
617
|
-
const o = e.elements.filter((m) => m.type === "Category"), [c, u] =
|
|
617
|
+
const o = e.elements.filter((m) => m.type === "Category"), [c, u] = U(((p = o[0]) == null ? void 0 : p.label) || "");
|
|
618
618
|
if (l === !1 || !o.length) return null;
|
|
619
619
|
const y = o.find((m) => m.label === c) ? c : o[0].label;
|
|
620
620
|
return /* @__PURE__ */ g(Ie.Root, { value: y, onValueChange: u, children: [
|
|
621
621
|
/* @__PURE__ */ n(Ie.List, { children: o.map((m, v) => /* @__PURE__ */ n(Ie.Trigger, { value: m.label, children: m.label }, `${r}-${v}`)) }),
|
|
622
|
-
/* @__PURE__ */ n(
|
|
622
|
+
/* @__PURE__ */ n(R, { pt: "3", children: o.map((m, v) => /* @__PURE__ */ n(Ie.Content, { value: m.label, children: /* @__PURE__ */ n(S, { direction: "column", gap: "4", children: m.elements.map((N, A) => /* @__PURE__ */ n(
|
|
623
623
|
Ae,
|
|
624
624
|
{
|
|
625
625
|
uischema: N,
|
|
@@ -632,7 +632,7 @@ const ce = (e, t, r, i = void 0) => {
|
|
|
632
632
|
`${r}-${v}-${A}`
|
|
633
633
|
)) }) }, `${r}-${v}`)) })
|
|
634
634
|
] });
|
|
635
|
-
}, Et =
|
|
635
|
+
}, Et = K(1, Te("Categorization"));
|
|
636
636
|
function me(e) {
|
|
637
637
|
return e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(0)} MB` : e >= 1024 ? `${(e / 1024).toFixed(0)} KB` : `${e} B`;
|
|
638
638
|
}
|
|
@@ -663,80 +663,80 @@ const Ct = ({
|
|
|
663
663
|
}) => {
|
|
664
664
|
const u = Vr();
|
|
665
665
|
ce(c, r, t, null);
|
|
666
|
-
const y = !o || o.length === 0, p = (l == null ? void 0 : l["x-file"]) ?? {}, m = (s == null ? void 0 : s.options) ?? {}, v = p.maxFiles ?? m.maxFiles ?? 1, N = p.maxSize ?? m.maxSize ?? 5 * 1024 * 1024, A = p.accept ?? m.accept ?? "image/*,application/pdf", w = v > 1,
|
|
666
|
+
const y = !o || o.length === 0, p = (l == null ? void 0 : l["x-file"]) ?? {}, m = (s == null ? void 0 : s.options) ?? {}, v = p.maxFiles ?? m.maxFiles ?? 1, N = p.maxSize ?? m.maxSize ?? 5 * 1024 * 1024, A = p.accept ?? m.accept ?? "image/*,application/pdf", w = v > 1, I = a !== !1, [L, D] = U(!1), [C, H] = U(null), [W, x] = U({}), O = de(/* @__PURE__ */ new Set()), F = de(null), B = Rt(e), oe = B.length >= v;
|
|
667
667
|
fe(() => () => {
|
|
668
668
|
O.current.forEach((b) => URL.revokeObjectURL(b)), O.current.clear();
|
|
669
669
|
}, []);
|
|
670
670
|
const ee = _e(
|
|
671
671
|
async (b) => {
|
|
672
|
-
if (
|
|
673
|
-
|
|
672
|
+
if (H(null), B.length >= v) {
|
|
673
|
+
H(`Maximum ${v} file${v > 1 ? "s" : ""} allowed.`);
|
|
674
674
|
return;
|
|
675
675
|
}
|
|
676
676
|
if (b.size > N) {
|
|
677
|
-
|
|
677
|
+
H(`File exceeds the ${me(N)} limit.`);
|
|
678
678
|
return;
|
|
679
679
|
}
|
|
680
680
|
if (!A.split(",").map((T) => T.trim()).some((T) => T === "*" || T === "*/*" ? !0 : T.endsWith("/*") ? b.type.startsWith(T.slice(0, -1)) : T.startsWith(".") ? b.name.toLowerCase().endsWith(T.toLowerCase()) : b.type === T)) {
|
|
681
|
-
|
|
681
|
+
H(`Invalid type. Accepted: ${ge(A)}`);
|
|
682
682
|
return;
|
|
683
683
|
}
|
|
684
684
|
if (!(u != null && u.onUpload)) {
|
|
685
|
-
|
|
685
|
+
H("Upload service not configured.");
|
|
686
686
|
return;
|
|
687
687
|
}
|
|
688
688
|
try {
|
|
689
|
-
const T = await u.onUpload(b),
|
|
690
|
-
O.current.add(
|
|
691
|
-
const J = { key: T.key, name: T.name ?? b.name, blobUrl:
|
|
692
|
-
|
|
693
|
-
const Q = [...
|
|
689
|
+
const T = await u.onUpload(b), _ = URL.createObjectURL(b);
|
|
690
|
+
O.current.add(_);
|
|
691
|
+
const J = { key: T.key, name: T.name ?? b.name, blobUrl: _ };
|
|
692
|
+
x((G) => ({ ...G, [T.key]: J }));
|
|
693
|
+
const Q = [...B, T.key];
|
|
694
694
|
t(r, w ? Q : Q[0]);
|
|
695
695
|
} catch {
|
|
696
|
-
|
|
696
|
+
H("Upload failed. Please try again."), F.current && (F.current.value = "");
|
|
697
697
|
}
|
|
698
698
|
},
|
|
699
|
-
[
|
|
699
|
+
[B, v, N, A, u, r, t, w]
|
|
700
700
|
);
|
|
701
701
|
if (c === !1)
|
|
702
702
|
return null;
|
|
703
703
|
const le = (b) => {
|
|
704
|
-
b.preventDefault(), b.stopPropagation(), !(!
|
|
704
|
+
b.preventDefault(), b.stopPropagation(), !(!I || oe) && D(b.type === "dragenter" || b.type === "dragover");
|
|
705
705
|
}, Y = (b) => {
|
|
706
706
|
var k;
|
|
707
|
-
b.preventDefault(), b.stopPropagation(),
|
|
707
|
+
b.preventDefault(), b.stopPropagation(), D(!1), !(!I || oe) && (k = b.dataTransfer.files) != null && k[0] && ee(b.dataTransfer.files[0]);
|
|
708
708
|
}, Z = (b) => {
|
|
709
709
|
var k;
|
|
710
710
|
(k = b.target.files) != null && k[0] && (ee(b.target.files[0]), b.target.value = "");
|
|
711
711
|
}, re = (b) => {
|
|
712
|
-
if (!
|
|
713
|
-
|
|
712
|
+
if (!I) return;
|
|
713
|
+
x(($) => {
|
|
714
714
|
var J;
|
|
715
|
-
const T = {
|
|
716
|
-
return
|
|
715
|
+
const T = { ...$ }, _ = (J = T[b]) == null ? void 0 : J.blobUrl;
|
|
716
|
+
return _ && (URL.revokeObjectURL(_), O.current.delete(_)), delete T[b], T;
|
|
717
717
|
});
|
|
718
|
-
const k =
|
|
718
|
+
const k = B.filter(($) => $ !== b);
|
|
719
719
|
t(r, w ? k.length > 0 ? k : null : k[0] ?? null);
|
|
720
720
|
}, he = async (b, k) => {
|
|
721
|
-
var
|
|
721
|
+
var _, J, Q;
|
|
722
722
|
b.preventDefault();
|
|
723
|
-
const
|
|
724
|
-
if (
|
|
725
|
-
(J = window.open(
|
|
723
|
+
const $ = (_ = W[k]) == null ? void 0 : _.blobUrl;
|
|
724
|
+
if ($) {
|
|
725
|
+
(J = window.open($, "_blank", "noopener,noreferrer")) == null || J.focus();
|
|
726
726
|
return;
|
|
727
727
|
}
|
|
728
728
|
const T = window.open("", "_blank");
|
|
729
729
|
if (T)
|
|
730
730
|
try {
|
|
731
|
-
const
|
|
732
|
-
|
|
731
|
+
const G = await ((Q = u == null ? void 0 : u.getDownloadUrl) == null ? void 0 : Q.call(u, k));
|
|
732
|
+
G != null && G.url ? T.location.href = G.url : T.close();
|
|
733
733
|
} catch {
|
|
734
734
|
T.close();
|
|
735
735
|
}
|
|
736
736
|
};
|
|
737
|
-
if (!
|
|
738
|
-
const ne = v -
|
|
739
|
-
return /* @__PURE__ */ g(
|
|
737
|
+
if (!I && B.length === 0) return null;
|
|
738
|
+
const ne = v - B.length, ue = I && !oe;
|
|
739
|
+
return /* @__PURE__ */ g(R, { mb: "4", children: [
|
|
740
740
|
/* @__PURE__ */ g(S, { align: "center", justify: "between", mb: "2", children: [
|
|
741
741
|
/* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", children: [
|
|
742
742
|
i,
|
|
@@ -744,11 +744,11 @@ const Ct = ({
|
|
|
744
744
|
] }),
|
|
745
745
|
/* @__PURE__ */ n(h, { size: "1", color: "gray", children: w ? `Up to ${v} files · ${me(N)} each · ${ge(A)}` : `${me(N)} · ${ge(A)}` })
|
|
746
746
|
] }),
|
|
747
|
-
|
|
747
|
+
B.map((b) => {
|
|
748
748
|
var k;
|
|
749
749
|
return /* @__PURE__ */ n(nr, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ g(S, { align: "center", gap: "3", children: [
|
|
750
750
|
/* @__PURE__ */ n(
|
|
751
|
-
|
|
751
|
+
R,
|
|
752
752
|
{
|
|
753
753
|
style: {
|
|
754
754
|
background: "var(--blue-3)",
|
|
@@ -760,7 +760,7 @@ const Ct = ({
|
|
|
760
760
|
children: /* @__PURE__ */ n(Dr, { width: "20", height: "20" })
|
|
761
761
|
}
|
|
762
762
|
),
|
|
763
|
-
/* @__PURE__ */ n(
|
|
763
|
+
/* @__PURE__ */ n(R, { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ n(
|
|
764
764
|
h,
|
|
765
765
|
{
|
|
766
766
|
size: "2",
|
|
@@ -771,13 +771,13 @@ const Ct = ({
|
|
|
771
771
|
textOverflow: "ellipsis",
|
|
772
772
|
whiteSpace: "nowrap"
|
|
773
773
|
},
|
|
774
|
-
children: ((k =
|
|
774
|
+
children: ((k = W[b]) == null ? void 0 : k.name) ?? "Uploaded File"
|
|
775
775
|
}
|
|
776
776
|
) }),
|
|
777
777
|
/* @__PURE__ */ g(S, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
|
|
778
|
-
/* @__PURE__ */ n(ke, { variant: "soft", color: "blue", size: "1", onClick: (
|
|
778
|
+
/* @__PURE__ */ n(ke, { variant: "soft", color: "blue", size: "1", onClick: ($) => he($, b), children: "View" }),
|
|
779
779
|
/* @__PURE__ */ n(Fr, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
|
|
780
|
-
|
|
780
|
+
I && /* @__PURE__ */ n(Ue, { variant: "ghost", color: "gray", onClick: () => re(b), children: /* @__PURE__ */ n(or, {}) })
|
|
781
781
|
] })
|
|
782
782
|
] }) }, b);
|
|
783
783
|
}),
|
|
@@ -788,11 +788,11 @@ const Ct = ({
|
|
|
788
788
|
tabIndex: 0,
|
|
789
789
|
onClick: () => {
|
|
790
790
|
var b;
|
|
791
|
-
return (b =
|
|
791
|
+
return (b = F.current) == null ? void 0 : b.click();
|
|
792
792
|
},
|
|
793
793
|
onKeyDown: (b) => {
|
|
794
794
|
var k;
|
|
795
|
-
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), (k =
|
|
795
|
+
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), (k = F.current) == null || k.click());
|
|
796
796
|
},
|
|
797
797
|
onDragEnter: le,
|
|
798
798
|
onDragLeave: le,
|
|
@@ -802,17 +802,17 @@ const Ct = ({
|
|
|
802
802
|
className: [
|
|
803
803
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
804
804
|
"transition-all duration-200 ease-in-out",
|
|
805
|
-
L ? "border-blue-500 bg-blue-50" :
|
|
805
|
+
L ? "border-blue-500 bg-blue-50" : C ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
806
806
|
].join(" "),
|
|
807
807
|
children: [
|
|
808
|
-
/* @__PURE__ */ n("input", { ref:
|
|
809
|
-
/* @__PURE__ */ n(S, { direction: "column", align: "center", gap: "2", children:
|
|
808
|
+
/* @__PURE__ */ n("input", { ref: F, type: "file", style: { display: "none" }, accept: A, onChange: Z }),
|
|
809
|
+
/* @__PURE__ */ n(S, { direction: "column", align: "center", gap: "2", children: C ? /* @__PURE__ */ g(be, { children: [
|
|
810
810
|
/* @__PURE__ */ n(lr, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
811
|
-
/* @__PURE__ */ n(h, { size: "2", color: "red", weight: "medium", children:
|
|
811
|
+
/* @__PURE__ */ n(h, { size: "2", color: "red", weight: "medium", children: C }),
|
|
812
812
|
/* @__PURE__ */ n(h, { size: "1", color: "gray", children: "Click to try again" })
|
|
813
813
|
] }) : /* @__PURE__ */ g(be, { children: [
|
|
814
814
|
/* @__PURE__ */ n(He, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
815
|
-
/* @__PURE__ */ n(h, { size: "2", weight: "medium", children:
|
|
815
|
+
/* @__PURE__ */ n(h, { size: "2", weight: "medium", children: B.length > 0 ? `Add another file (${ne} remaining)` : "Click to upload or drag and drop" }),
|
|
816
816
|
/* @__PURE__ */ g(h, { size: "1", color: "gray", children: [
|
|
817
817
|
me(N),
|
|
818
818
|
" max · ",
|
|
@@ -822,14 +822,14 @@ const Ct = ({
|
|
|
822
822
|
]
|
|
823
823
|
}
|
|
824
824
|
),
|
|
825
|
-
|
|
825
|
+
I && oe && w && /* @__PURE__ */ g(h, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
|
|
826
826
|
"Maximum ",
|
|
827
827
|
v,
|
|
828
828
|
" files uploaded. Remove one to replace it."
|
|
829
829
|
] }),
|
|
830
830
|
!y && /* @__PURE__ */ n(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: ae(o, i) })
|
|
831
831
|
] });
|
|
832
|
-
}, Tt = se(Ct), At =
|
|
832
|
+
}, Tt = se(Ct), At = K(
|
|
833
833
|
10,
|
|
834
834
|
// high rank to beat default array renderer
|
|
835
835
|
Ar(
|
|
@@ -872,7 +872,7 @@ function Nt(e) {
|
|
|
872
872
|
}
|
|
873
873
|
return r;
|
|
874
874
|
}
|
|
875
|
-
class
|
|
875
|
+
class j extends Error {
|
|
876
876
|
constructor(r, i) {
|
|
877
877
|
super(i ?? r);
|
|
878
878
|
Pe(this, "code");
|
|
@@ -949,7 +949,7 @@ function Ft(e) {
|
|
|
949
949
|
for (; (r = Be.exec(t)) !== null; ) {
|
|
950
950
|
const i = r[1].toUpperCase();
|
|
951
951
|
if (!zt.has(i))
|
|
952
|
-
throw new
|
|
952
|
+
throw new j("NAME", `Function ${i} is not allowed.`);
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
955
|
function Ut(e, t, r) {
|
|
@@ -967,20 +967,20 @@ function pe(e) {
|
|
|
967
967
|
const t = cr(e);
|
|
968
968
|
return Array.isArray(t) ? t.flat(1 / 0) : [t];
|
|
969
969
|
}
|
|
970
|
-
function
|
|
970
|
+
function M(e) {
|
|
971
971
|
const t = cr(e);
|
|
972
972
|
return Array.isArray(t) ? t.flat(1 / 0)[0] : t;
|
|
973
973
|
}
|
|
974
974
|
function xe(e) {
|
|
975
|
-
return e === void 0 ? void 0 :
|
|
975
|
+
return e === void 0 ? void 0 : M(e);
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function X(e) {
|
|
978
978
|
return e == null || e === "" ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
979
979
|
}
|
|
980
980
|
function Ht(e, t) {
|
|
981
981
|
return e instanceof t ? e : new t(e.message || "#ERROR!");
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function V(e) {
|
|
984
984
|
return e.find((t) => t instanceof Error);
|
|
985
985
|
}
|
|
986
986
|
function $t(e, t) {
|
|
@@ -989,15 +989,15 @@ function $t(e, t) {
|
|
|
989
989
|
}, i = (s, { checkArgsForErrors: l = !0 } = {}) => (...a) => {
|
|
990
990
|
const o = a.flatMap(pe);
|
|
991
991
|
if (l) {
|
|
992
|
-
const u =
|
|
992
|
+
const u = V(o);
|
|
993
993
|
u && r(u);
|
|
994
994
|
}
|
|
995
995
|
const c = s(...o);
|
|
996
996
|
return c instanceof Error ? r(c) : c;
|
|
997
997
|
}, f = (s, { toText: l = !1 } = {}) => (a) => {
|
|
998
|
-
const o =
|
|
998
|
+
const o = M(a), c = V([o]);
|
|
999
999
|
c && r(c);
|
|
1000
|
-
const u = s(l ?
|
|
1000
|
+
const u = s(l ? X(o) : o);
|
|
1001
1001
|
return u instanceof Error ? r(u) : u;
|
|
1002
1002
|
};
|
|
1003
1003
|
return {
|
|
@@ -1022,25 +1022,25 @@ function $t(e, t) {
|
|
|
1022
1022
|
// the other aggregates use.
|
|
1023
1023
|
COUNTA: i(e.COUNTA, { checkArgsForErrors: !1 }),
|
|
1024
1024
|
LARGE: (s, l) => {
|
|
1025
|
-
const a = pe(s), o =
|
|
1025
|
+
const a = pe(s), o = M(l), c = V([...a, o]);
|
|
1026
1026
|
c && r(c);
|
|
1027
1027
|
const u = e.LARGE(a, o);
|
|
1028
1028
|
return u instanceof Error ? r(u) : u;
|
|
1029
1029
|
},
|
|
1030
1030
|
SMALL: (s, l) => {
|
|
1031
|
-
const a = pe(s), o =
|
|
1031
|
+
const a = pe(s), o = M(l), c = V([...a, o]);
|
|
1032
1032
|
c && r(c);
|
|
1033
1033
|
const u = e.SMALL(a, o);
|
|
1034
1034
|
return u instanceof Error ? r(u) : u;
|
|
1035
1035
|
},
|
|
1036
1036
|
PERMUT: (s, l) => {
|
|
1037
|
-
const a = [
|
|
1037
|
+
const a = [M(s), M(l)], o = V(a);
|
|
1038
1038
|
o && r(o);
|
|
1039
1039
|
const c = e.PERMUT(a[0], a[1]);
|
|
1040
1040
|
return c instanceof Error ? r(c) : c;
|
|
1041
1041
|
},
|
|
1042
1042
|
PERMUTATIONA: (s, l) => {
|
|
1043
|
-
const a = [
|
|
1043
|
+
const a = [M(s), M(l)], o = V(a);
|
|
1044
1044
|
o && r(o);
|
|
1045
1045
|
const c = e.PERMUTATIONA(a[0], a[1]);
|
|
1046
1046
|
return c instanceof Error ? r(c) : c;
|
|
@@ -1052,27 +1052,27 @@ function $t(e, t) {
|
|
|
1052
1052
|
// real-world data. Same scope decision as the hand-rolled engine this
|
|
1053
1053
|
// replaces, carried forward deliberately rather than dropped.
|
|
1054
1054
|
MATCH: (s, l) => {
|
|
1055
|
-
const a =
|
|
1055
|
+
const a = M(s), o = pe(l), c = V([a, ...o]);
|
|
1056
1056
|
c && r(c);
|
|
1057
1057
|
const u = e.MATCH(a, o, 0);
|
|
1058
1058
|
return u instanceof Error ? r(u) : u;
|
|
1059
1059
|
},
|
|
1060
1060
|
SWITCH: (...s) => {
|
|
1061
|
-
const l = s.map(
|
|
1061
|
+
const l = s.map(M), a = V(l);
|
|
1062
1062
|
a && r(a);
|
|
1063
1063
|
const o = e.SWITCH(...l);
|
|
1064
1064
|
return o instanceof Error ? r(o) : o;
|
|
1065
1065
|
},
|
|
1066
1066
|
SUBSTITUTE: (s, l, a, o) => {
|
|
1067
|
-
const c = [
|
|
1068
|
-
o !== void 0 && c.push(
|
|
1069
|
-
const u =
|
|
1067
|
+
const c = [X(M(s)), X(M(l)), X(M(a))];
|
|
1068
|
+
o !== void 0 && c.push(M(o));
|
|
1069
|
+
const u = V(c);
|
|
1070
1070
|
u && r(u);
|
|
1071
1071
|
const y = e.SUBSTITUTE(...c);
|
|
1072
1072
|
return y instanceof Error ? r(y) : y;
|
|
1073
1073
|
},
|
|
1074
1074
|
TEXTJOIN: (s, l, ...a) => {
|
|
1075
|
-
const o =
|
|
1075
|
+
const o = X(M(s)), c = M(l), u = a.flatMap(pe).map(X), y = V([o, c]);
|
|
1076
1076
|
y && r(y);
|
|
1077
1077
|
const p = e.TEXTJOIN(o, c, u);
|
|
1078
1078
|
return p instanceof Error ? r(p) : p;
|
|
@@ -1084,7 +1084,7 @@ function $t(e, t) {
|
|
|
1084
1084
|
MONTH: f(e.MONTH),
|
|
1085
1085
|
DAY: f(e.DAY),
|
|
1086
1086
|
WEEKDAY: (s, l) => {
|
|
1087
|
-
const a =
|
|
1087
|
+
const a = M(s), o = M(l), c = V([a]);
|
|
1088
1088
|
c && r(c);
|
|
1089
1089
|
const u = e.WEEKDAY(a, o);
|
|
1090
1090
|
return u instanceof Error ? r(u) : u;
|
|
@@ -1099,48 +1099,48 @@ function $t(e, t) {
|
|
|
1099
1099
|
// separator, matching Excel's own range-argument behavior — the native
|
|
1100
1100
|
// implementation instead inserts stray commas for a whole-range argument.
|
|
1101
1101
|
CONCATENATE: (...s) => {
|
|
1102
|
-
const l = s.flatMap(pe), a =
|
|
1102
|
+
const l = s.flatMap(pe), a = V(l);
|
|
1103
1103
|
a && r(a);
|
|
1104
|
-
const o = e.CONCATENATE(...l.map(
|
|
1104
|
+
const o = e.CONCATENATE(...l.map(X));
|
|
1105
1105
|
return o instanceof Error ? r(o) : o;
|
|
1106
1106
|
},
|
|
1107
1107
|
CONCAT: (...s) => {
|
|
1108
|
-
const l = s.flatMap(pe), a =
|
|
1108
|
+
const l = s.flatMap(pe), a = V(l);
|
|
1109
1109
|
a && r(a);
|
|
1110
|
-
const o = e.CONCAT(...l.map(
|
|
1110
|
+
const o = e.CONCAT(...l.map(X));
|
|
1111
1111
|
return o instanceof Error ? r(o) : o;
|
|
1112
1112
|
},
|
|
1113
1113
|
LEN: f(e.LEN, { toText: !0 }),
|
|
1114
1114
|
TRIM: f(e.TRIM, { toText: !0 }),
|
|
1115
1115
|
LOWER: f(e.LOWER, { toText: !0 }),
|
|
1116
1116
|
LEFT: (s, l) => {
|
|
1117
|
-
const a =
|
|
1117
|
+
const a = M(s), o = xe(l), c = V([a]);
|
|
1118
1118
|
c && r(c);
|
|
1119
|
-
const u = e.LEFT(
|
|
1119
|
+
const u = e.LEFT(X(a), o);
|
|
1120
1120
|
return u instanceof Error ? r(u) : u;
|
|
1121
1121
|
},
|
|
1122
1122
|
RIGHT: (s, l) => {
|
|
1123
|
-
const a =
|
|
1123
|
+
const a = M(s), o = xe(l), c = V([a]);
|
|
1124
1124
|
c && r(c);
|
|
1125
|
-
const u = e.RIGHT(
|
|
1125
|
+
const u = e.RIGHT(X(a), o);
|
|
1126
1126
|
return u instanceof Error ? r(u) : u;
|
|
1127
1127
|
},
|
|
1128
1128
|
MID: (s, l, a) => {
|
|
1129
|
-
const o =
|
|
1129
|
+
const o = M(s), c = M(l), u = M(a), y = V([o, c, u]);
|
|
1130
1130
|
y && r(y);
|
|
1131
|
-
const p = e.MID(
|
|
1131
|
+
const p = e.MID(X(o), c, u);
|
|
1132
1132
|
return p instanceof Error ? r(p) : p;
|
|
1133
1133
|
},
|
|
1134
1134
|
FIND: (s, l, a) => {
|
|
1135
|
-
const o =
|
|
1135
|
+
const o = M(s), c = M(l), u = xe(a), y = V([o, c]);
|
|
1136
1136
|
y && r(y);
|
|
1137
|
-
const p = e.FIND(
|
|
1137
|
+
const p = e.FIND(X(o), X(c), u);
|
|
1138
1138
|
return p instanceof Error ? r(p) : p;
|
|
1139
1139
|
},
|
|
1140
1140
|
SEARCH: (s, l, a) => {
|
|
1141
|
-
const o =
|
|
1141
|
+
const o = M(s), c = M(l), u = xe(a), y = V([o, c]);
|
|
1142
1142
|
y && r(y);
|
|
1143
|
-
const p = e.SEARCH(
|
|
1143
|
+
const p = e.SEARCH(X(o), X(c), u);
|
|
1144
1144
|
return p instanceof Error ? r(p) : p;
|
|
1145
1145
|
}
|
|
1146
1146
|
};
|
|
@@ -1158,12 +1158,12 @@ function Ke(e) {
|
|
|
1158
1158
|
return _t[e.error] ?? "ERROR";
|
|
1159
1159
|
}
|
|
1160
1160
|
function Ge(e, t) {
|
|
1161
|
-
if (e instanceof
|
|
1161
|
+
if (e instanceof j) return e;
|
|
1162
1162
|
if (e instanceof t) {
|
|
1163
1163
|
const r = e.details;
|
|
1164
|
-
return r instanceof
|
|
1164
|
+
return r instanceof j ? r : r instanceof t ? new j(Ke(r), r.message) : new j(Ke(e), e.message);
|
|
1165
1165
|
}
|
|
1166
|
-
return new
|
|
1166
|
+
return new j("ERROR", e instanceof Error ? e.message : void 0);
|
|
1167
1167
|
}
|
|
1168
1168
|
function Pt(e) {
|
|
1169
1169
|
return Math.max(0, ...e.map((t) => (t == null ? void 0 : t.length) ?? 0));
|
|
@@ -1172,7 +1172,7 @@ function Vt(e) {
|
|
|
1172
1172
|
return (t) => {
|
|
1173
1173
|
const r = e[t.row - 1];
|
|
1174
1174
|
if (t.row < 1 || t.col < 1 || r == null || t.col - 1 >= r.length)
|
|
1175
|
-
throw new
|
|
1175
|
+
throw new j("REF");
|
|
1176
1176
|
const i = r[t.col - 1];
|
|
1177
1177
|
return i == null || i === "" ? null : i;
|
|
1178
1178
|
};
|
|
@@ -1181,7 +1181,7 @@ function Wt(e) {
|
|
|
1181
1181
|
return (t) => {
|
|
1182
1182
|
const r = Math.min(t.from.row, t.to.row), i = Math.min(t.from.col, t.to.col), f = Math.max(t.from.row, t.to.row), s = Math.max(t.from.col, t.to.col), l = Pt(e);
|
|
1183
1183
|
if (r > e.length || i > l)
|
|
1184
|
-
throw new
|
|
1184
|
+
throw new j("REF");
|
|
1185
1185
|
const a = Math.min(f, e.length), o = [];
|
|
1186
1186
|
for (let c = r; c <= a; c++) {
|
|
1187
1187
|
const u = e[c - 1], y = [];
|
|
@@ -1201,12 +1201,12 @@ function Bt(e) {
|
|
|
1201
1201
|
if (e == null || e === "") return null;
|
|
1202
1202
|
if (typeof e == "number" || typeof e == "string" || typeof e == "boolean" || e instanceof Date)
|
|
1203
1203
|
return e;
|
|
1204
|
-
throw new
|
|
1204
|
+
throw new j("VALUE");
|
|
1205
1205
|
}
|
|
1206
1206
|
async function ar(e, t) {
|
|
1207
|
-
if (typeof e != "string") throw new
|
|
1207
|
+
if (typeof e != "string") throw new j("ERROR");
|
|
1208
1208
|
const r = e.trim();
|
|
1209
|
-
if (r === "") throw new
|
|
1209
|
+
if (r === "") throw new j("ERROR");
|
|
1210
1210
|
const i = r.startsWith("=") ? r.slice(1) : r;
|
|
1211
1211
|
Ft(i);
|
|
1212
1212
|
const [f, s] = await Promise.all([
|
|
@@ -1240,10 +1240,10 @@ async function Gt(e, t) {
|
|
|
1240
1240
|
},
|
|
1241
1241
|
onCell: (i) => {
|
|
1242
1242
|
if (i.row === Xe) return e[r[i.col - 1]] ?? null;
|
|
1243
|
-
throw new
|
|
1243
|
+
throw new j("REF");
|
|
1244
1244
|
},
|
|
1245
1245
|
onRange: () => {
|
|
1246
|
-
throw new
|
|
1246
|
+
throw new j("REF");
|
|
1247
1247
|
}
|
|
1248
1248
|
});
|
|
1249
1249
|
}
|
|
@@ -1258,7 +1258,7 @@ const ur = {
|
|
|
1258
1258
|
NULL: "#NULL!"
|
|
1259
1259
|
};
|
|
1260
1260
|
function dr(e) {
|
|
1261
|
-
const t = e instanceof
|
|
1261
|
+
const t = e instanceof j ? e.code : "ERROR";
|
|
1262
1262
|
return ur[t];
|
|
1263
1263
|
}
|
|
1264
1264
|
async function Xt(e, t) {
|
|
@@ -1271,7 +1271,7 @@ async function Xt(e, t) {
|
|
|
1271
1271
|
t.map(async (r) => {
|
|
1272
1272
|
try {
|
|
1273
1273
|
if (!r || typeof r.label != "string" || typeof r.expression != "string" || typeof r.id != "string")
|
|
1274
|
-
throw new
|
|
1274
|
+
throw new j("ERROR");
|
|
1275
1275
|
return { id: r.id, label: r.label, value: await Kt(e, r.expression) };
|
|
1276
1276
|
} catch (i) {
|
|
1277
1277
|
return {
|
|
@@ -1353,9 +1353,9 @@ const rn = ({
|
|
|
1353
1353
|
visible: c = !0
|
|
1354
1354
|
}) => {
|
|
1355
1355
|
ce(c, r, t, null);
|
|
1356
|
-
const u = !o || o.length === 0, y = St(l, a), p = (s == null ? void 0 : s["x-spreadsheet"]) ?? {}, m = (s == null ? void 0 : s["x-evaluate"]) ?? en, v = p.accept ?? Zt, N = p.maxSize ?? Qt, A = p.persistSheet !== !1, w = p.columnHeader === !0,
|
|
1357
|
-
() =>
|
|
1358
|
-
), [
|
|
1356
|
+
const u = !o || o.length === 0, y = St(l, a), p = (s == null ? void 0 : s["x-spreadsheet"]) ?? {}, m = (s == null ? void 0 : s["x-evaluate"]) ?? en, v = p.accept ?? Zt, N = p.maxSize ?? Qt, A = p.persistSheet !== !1, w = p.columnHeader === !0, I = p.rowHeader === !0, L = p.showSheet !== !1, D = p.sheetName, C = e ?? null, [H, W] = U(
|
|
1357
|
+
() => C != null && C.sheet || Object.keys((C == null ? void 0 : C.derivations) ?? {}).length > 0 ? "ready" : "empty"
|
|
1358
|
+
), [x, O] = U(null), [F, B] = U(!1), [oe, ee] = U(null), le = de(null), Y = (C == null ? void 0 : C.sheet) ?? null, Z = oe ?? (Y && !je(Y) ? Y : null), re = oe == null && Y && je(Y) ? Y : null, he = (C == null ? void 0 : C.derivations) ?? {}, ne = Z != null || C != null, ue = _e(
|
|
1359
1359
|
async (d) => {
|
|
1360
1360
|
if (O(null), d.size > N) {
|
|
1361
1361
|
O(`File exceeds the ${me(N)} limit.`);
|
|
@@ -1365,13 +1365,13 @@ const rn = ({
|
|
|
1365
1365
|
O(`Invalid type. Accepted: ${ge(v)}`);
|
|
1366
1366
|
return;
|
|
1367
1367
|
}
|
|
1368
|
-
|
|
1368
|
+
W("parsing");
|
|
1369
1369
|
let te;
|
|
1370
1370
|
try {
|
|
1371
1371
|
const z = await d.arrayBuffer();
|
|
1372
|
-
te = Ot(z,
|
|
1372
|
+
te = Ot(z, D).matrix;
|
|
1373
1373
|
} catch (z) {
|
|
1374
|
-
|
|
1374
|
+
W("error"), O(
|
|
1375
1375
|
z instanceof $e ? z.message : "This doesn't look like a valid spreadsheet. Please check the file and try again."
|
|
1376
1376
|
);
|
|
1377
1377
|
return;
|
|
@@ -1379,38 +1379,38 @@ const rn = ({
|
|
|
1379
1379
|
ee(te);
|
|
1380
1380
|
let ie;
|
|
1381
1381
|
try {
|
|
1382
|
-
ie = await qt(te, m, { persistSheet: A, columnHeader: w, rowHeader:
|
|
1382
|
+
ie = await qt(te, m, { persistSheet: A, columnHeader: w, rowHeader: I });
|
|
1383
1383
|
} catch (z) {
|
|
1384
|
-
|
|
1384
|
+
W("error"), O(z instanceof Error ? z.message : "Failed to process the uploaded spreadsheet.");
|
|
1385
1385
|
return;
|
|
1386
1386
|
}
|
|
1387
|
-
t(r, ie),
|
|
1387
|
+
t(r, ie), W("ready");
|
|
1388
1388
|
},
|
|
1389
|
-
[v, N, A, w,
|
|
1389
|
+
[v, N, A, w, I, D, m, r, t]
|
|
1390
1390
|
);
|
|
1391
1391
|
if (c === !1)
|
|
1392
1392
|
return null;
|
|
1393
|
-
if (w &&
|
|
1394
|
-
return /* @__PURE__ */ g(
|
|
1393
|
+
if (w && I)
|
|
1394
|
+
return /* @__PURE__ */ g(R, { mb: "4", children: [
|
|
1395
1395
|
/* @__PURE__ */ n(h, { as: "label", size: "2", weight: "bold", children: i }),
|
|
1396
1396
|
/* @__PURE__ */ n(h, { size: "2", color: "red", style: { display: "block" }, children: "Invalid x-spreadsheet config: columnHeader and rowHeader cannot both be true — pick one orientation." })
|
|
1397
1397
|
] });
|
|
1398
1398
|
if (!y && !ne) return null;
|
|
1399
1399
|
const b = (d) => {
|
|
1400
|
-
d.preventDefault(), d.stopPropagation(), y &&
|
|
1400
|
+
d.preventDefault(), d.stopPropagation(), y && B(d.type === "dragenter" || d.type === "dragover");
|
|
1401
1401
|
}, k = (d) => {
|
|
1402
1402
|
var E;
|
|
1403
|
-
d.preventDefault(), d.stopPropagation(),
|
|
1404
|
-
},
|
|
1403
|
+
d.preventDefault(), d.stopPropagation(), B(!1), y && (E = d.dataTransfer.files) != null && E[0] && ue(d.dataTransfer.files[0]);
|
|
1404
|
+
}, $ = (d) => {
|
|
1405
1405
|
var E;
|
|
1406
1406
|
(E = d.target.files) != null && E[0] && (ue(d.target.files[0]), d.target.value = "");
|
|
1407
1407
|
}, T = () => {
|
|
1408
|
-
y && (ee(null), O(null),
|
|
1409
|
-
},
|
|
1408
|
+
y && (ee(null), O(null), W("empty"), t(r, null));
|
|
1409
|
+
}, _ = w ? 1 : 0, J = I ? 1 : 0, Q = Z ? Z.slice(_) : [], G = Q.slice(0, ve), we = Math.min(
|
|
1410
1410
|
Ye,
|
|
1411
|
-
Math.max(0, ...
|
|
1412
|
-
), Ee = Array.from({ length: we }, (d, E) => E + J), De = L && Z == null && re == null &&
|
|
1413
|
-
return /* @__PURE__ */ g(
|
|
1411
|
+
Math.max(0, ...G.map((d) => Math.max(0, d.length - J)))
|
|
1412
|
+
), Ee = Array.from({ length: we }, (d, E) => E + J), De = L && Z == null && re == null && C != null, Se = "", Fe = I && !w, Oe = re ? re.slice(0, ve) : [], Re = Array.from(new Set(Oe.flatMap((d) => Object.keys(d)))).slice(0, Ye);
|
|
1413
|
+
return /* @__PURE__ */ g(R, { mb: "4", children: [
|
|
1414
1414
|
/* @__PURE__ */ g(S, { align: "center", justify: "between", mb: "2", children: [
|
|
1415
1415
|
/* @__PURE__ */ g(S, { align: "center", gap: "1", children: [
|
|
1416
1416
|
/* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", children: [
|
|
@@ -1450,8 +1450,8 @@ const rn = ({
|
|
|
1450
1450
|
ge(v)
|
|
1451
1451
|
] })
|
|
1452
1452
|
] }),
|
|
1453
|
-
ne &&
|
|
1454
|
-
/* @__PURE__ */ n("input", { ref: le, type: "file", style: { display: "none" }, accept: v, onChange:
|
|
1453
|
+
ne && x && /* @__PURE__ */ n(h, { size: "2", color: "red", mb: "2", style: { display: "block" }, children: x }),
|
|
1454
|
+
/* @__PURE__ */ n("input", { ref: le, type: "file", style: { display: "none" }, accept: v, onChange: $ }),
|
|
1455
1455
|
y && !ne && /* @__PURE__ */ n(
|
|
1456
1456
|
"div",
|
|
1457
1457
|
{
|
|
@@ -1473,14 +1473,14 @@ const rn = ({
|
|
|
1473
1473
|
className: [
|
|
1474
1474
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
1475
1475
|
"transition-all duration-200 ease-in-out",
|
|
1476
|
-
|
|
1476
|
+
F ? "border-blue-500 bg-blue-50" : x ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
1477
1477
|
].join(" "),
|
|
1478
|
-
children: /* @__PURE__ */ n(S, { direction: "column", align: "center", gap: "2", children:
|
|
1478
|
+
children: /* @__PURE__ */ n(S, { direction: "column", align: "center", gap: "2", children: H === "parsing" ? /* @__PURE__ */ g(be, { children: [
|
|
1479
1479
|
/* @__PURE__ */ n(Me, { size: "3" }),
|
|
1480
1480
|
/* @__PURE__ */ n(h, { size: "2", color: "gray", children: "Parsing spreadsheet…" })
|
|
1481
|
-
] }) :
|
|
1481
|
+
] }) : x ? /* @__PURE__ */ g(be, { children: [
|
|
1482
1482
|
/* @__PURE__ */ n(lr, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
1483
|
-
/* @__PURE__ */ n(h, { size: "2", color: "red", weight: "medium", children:
|
|
1483
|
+
/* @__PURE__ */ n(h, { size: "2", color: "red", weight: "medium", children: x }),
|
|
1484
1484
|
/* @__PURE__ */ n(h, { size: "1", color: "gray", children: "Click to try again" })
|
|
1485
1485
|
] }) : /* @__PURE__ */ g(be, { children: [
|
|
1486
1486
|
/* @__PURE__ */ n(He, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
@@ -1493,10 +1493,10 @@ const rn = ({
|
|
|
1493
1493
|
] }) })
|
|
1494
1494
|
}
|
|
1495
1495
|
),
|
|
1496
|
-
Z && L && /* @__PURE__ */ g(
|
|
1497
|
-
/* @__PURE__ */ n(
|
|
1498
|
-
!Fe && /* @__PURE__ */ n(
|
|
1499
|
-
/* @__PURE__ */ n(
|
|
1496
|
+
Z && L && /* @__PURE__ */ g(R, { mt: "3", children: [
|
|
1497
|
+
/* @__PURE__ */ n(R, { style: { overflow: "auto", maxHeight: 420 }, children: /* @__PURE__ */ g(P.Root, { variant: "surface", size: "1", children: [
|
|
1498
|
+
!Fe && /* @__PURE__ */ n(P.Header, { children: /* @__PURE__ */ g(P.Row, { children: [
|
|
1499
|
+
/* @__PURE__ */ n(P.ColumnHeaderCell, { children: Se }),
|
|
1500
1500
|
Ee.map((d) => {
|
|
1501
1501
|
var E;
|
|
1502
1502
|
return (
|
|
@@ -1504,22 +1504,22 @@ const rn = ({
|
|
|
1504
1504
|
// flag set (see suppressColumnHeaderRow) — so reaching
|
|
1505
1505
|
// here, either columnHeader is true (real labels) or
|
|
1506
1506
|
// both are false (columnLetter fallback).
|
|
1507
|
-
/* @__PURE__ */ n(
|
|
1507
|
+
/* @__PURE__ */ n(P.ColumnHeaderCell, { children: w ? Ce((E = Z[0]) == null ? void 0 : E[d]) : Nt(d) }, d)
|
|
1508
1508
|
);
|
|
1509
1509
|
})
|
|
1510
1510
|
] }) }),
|
|
1511
|
-
/* @__PURE__ */ n(
|
|
1511
|
+
/* @__PURE__ */ n(P.Body, { children: G.map((d, E) => {
|
|
1512
1512
|
var te;
|
|
1513
|
-
const q =
|
|
1514
|
-
return /* @__PURE__ */ g(
|
|
1513
|
+
const q = _ + E;
|
|
1514
|
+
return /* @__PURE__ */ g(P.Row, { children: [
|
|
1515
1515
|
/* @__PURE__ */ n(
|
|
1516
|
-
|
|
1516
|
+
P.RowHeaderCell,
|
|
1517
1517
|
{
|
|
1518
|
-
style:
|
|
1519
|
-
children:
|
|
1518
|
+
style: I ? { fontWeight: 700, background: "var(--gray-a3)" } : void 0,
|
|
1519
|
+
children: I ? Ce((te = Z[q]) == null ? void 0 : te[0]) : w ? "" : q + 1
|
|
1520
1520
|
}
|
|
1521
1521
|
),
|
|
1522
|
-
Ee.map((ie) => /* @__PURE__ */ n(
|
|
1522
|
+
Ee.map((ie) => /* @__PURE__ */ n(P.Cell, { children: Ce(d[ie]) }, ie))
|
|
1523
1523
|
] }, E);
|
|
1524
1524
|
}) })
|
|
1525
1525
|
] }) }),
|
|
@@ -1531,15 +1531,15 @@ const rn = ({
|
|
|
1531
1531
|
" rows"
|
|
1532
1532
|
] })
|
|
1533
1533
|
] }),
|
|
1534
|
-
re && L && /* @__PURE__ */ g(
|
|
1535
|
-
/* @__PURE__ */ n(
|
|
1536
|
-
/* @__PURE__ */ n(
|
|
1537
|
-
/* @__PURE__ */ n(
|
|
1538
|
-
Re.map((d) => /* @__PURE__ */ n(
|
|
1534
|
+
re && L && /* @__PURE__ */ g(R, { mt: "3", children: [
|
|
1535
|
+
/* @__PURE__ */ n(R, { style: { overflow: "auto", maxHeight: 420 }, children: /* @__PURE__ */ g(P.Root, { variant: "surface", size: "1", children: [
|
|
1536
|
+
/* @__PURE__ */ n(P.Header, { children: /* @__PURE__ */ g(P.Row, { children: [
|
|
1537
|
+
/* @__PURE__ */ n(P.ColumnHeaderCell, {}),
|
|
1538
|
+
Re.map((d) => /* @__PURE__ */ n(P.ColumnHeaderCell, { children: d }, d))
|
|
1539
1539
|
] }) }),
|
|
1540
|
-
/* @__PURE__ */ n(
|
|
1541
|
-
/* @__PURE__ */ n(
|
|
1542
|
-
Re.map((q) => /* @__PURE__ */ n(
|
|
1540
|
+
/* @__PURE__ */ n(P.Body, { children: Oe.map((d, E) => /* @__PURE__ */ g(P.Row, { children: [
|
|
1541
|
+
/* @__PURE__ */ n(P.RowHeaderCell, { children: E + 1 }),
|
|
1542
|
+
Re.map((q) => /* @__PURE__ */ n(P.Cell, { children: Ce(d[q]) }, q))
|
|
1543
1543
|
] }, E)) })
|
|
1544
1544
|
] }) }),
|
|
1545
1545
|
re.length > ve && /* @__PURE__ */ g(h, { size: "1", color: "gray", mt: "1", style: { display: "block" }, children: [
|
|
@@ -1551,7 +1551,7 @@ const rn = ({
|
|
|
1551
1551
|
] })
|
|
1552
1552
|
] }),
|
|
1553
1553
|
De && /* @__PURE__ */ n(h, { size: "2", color: "gray", mt: "3", style: { display: "block" }, children: "Sheet preview not stored for this field — re-upload to view contents." }),
|
|
1554
|
-
Object.keys(he).length > 0 && /* @__PURE__ */ g(
|
|
1554
|
+
Object.keys(he).length > 0 && /* @__PURE__ */ g(R, { mt: "3", children: [
|
|
1555
1555
|
/* @__PURE__ */ n(h, { size: "2", weight: "bold", as: "div", mb: "1", children: "Computed values" }),
|
|
1556
1556
|
/* @__PURE__ */ n(S, { direction: "column", gap: "1", children: Object.entries(he).map(([d, E]) => /* @__PURE__ */ g(S, { justify: "between", children: [
|
|
1557
1557
|
/* @__PURE__ */ n(h, { size: "2", children: E.label }),
|
|
@@ -1567,7 +1567,7 @@ const rn = ({
|
|
|
1567
1567
|
] }),
|
|
1568
1568
|
!u && /* @__PURE__ */ n(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: ae(o, i) })
|
|
1569
1569
|
] });
|
|
1570
|
-
}, tn = se(rn), nn =
|
|
1570
|
+
}, tn = se(rn), nn = K(
|
|
1571
1571
|
10,
|
|
1572
1572
|
// matches FileControlTester's rank — beats the default object/Group renderer
|
|
1573
1573
|
ze(
|
|
@@ -1600,41 +1600,41 @@ function cn(e) {
|
|
|
1600
1600
|
return Number.isFinite(e) ? Math.min(100, Math.max(0, Math.trunc(e))) : 0;
|
|
1601
1601
|
}
|
|
1602
1602
|
const Je = "{value}", an = 2, un = {}, dn = ({ data: e, handleChange: t, path: r, label: i, schema: f, visible: s = !0 }) => {
|
|
1603
|
-
var
|
|
1603
|
+
var H;
|
|
1604
1604
|
ce(s, r, t, null);
|
|
1605
|
-
const l = f == null ? void 0 : f["x-computed"], a = (l == null ? void 0 : l.inputs) ?? un, o = (l == null ? void 0 : l.formula) ?? "", c = (l == null ? void 0 : l.format) ?? Je, u = (l == null ? void 0 : l.decimals) ?? an, y = xr(), p = r.split(".").slice(0, -1).join("."), m = on((
|
|
1605
|
+
const l = f == null ? void 0 : f["x-computed"], a = (l == null ? void 0 : l.inputs) ?? un, o = (l == null ? void 0 : l.formula) ?? "", c = (l == null ? void 0 : l.format) ?? Je, u = (l == null ? void 0 : l.decimals) ?? an, y = xr(), p = r.split(".").slice(0, -1).join("."), m = on((H = y.core) == null ? void 0 : H.data, p, a), v = m ? JSON.stringify(m) : null, N = y.readonly === !0, [A, w] = U(() => typeof e == "number" ? "ok" : "unavailable"), [I, L] = U(() => typeof e == "number" ? e : null), [D, C] = U(null);
|
|
1606
1606
|
return fe(() => {
|
|
1607
1607
|
if (!s) return;
|
|
1608
|
-
let
|
|
1609
|
-
const
|
|
1608
|
+
let W = !1;
|
|
1609
|
+
const x = (O) => {
|
|
1610
1610
|
N || O !== (e ?? null) && t(r, O);
|
|
1611
1611
|
};
|
|
1612
1612
|
if (m === void 0) {
|
|
1613
|
-
w("unavailable"),
|
|
1613
|
+
w("unavailable"), C(null), L(null), x(null);
|
|
1614
1614
|
return;
|
|
1615
1615
|
}
|
|
1616
1616
|
return w((O) => O === "ok" ? O : "loading"), ln(m, o).then((O) => {
|
|
1617
|
-
if (
|
|
1618
|
-
const
|
|
1619
|
-
if (
|
|
1620
|
-
w("error"),
|
|
1617
|
+
if (W) return;
|
|
1618
|
+
const F = O.status === "ok" && typeof O.value == "number" && Number.isFinite(O.value) ? O.value : null;
|
|
1619
|
+
if (F === null) {
|
|
1620
|
+
w("error"), C(
|
|
1621
1621
|
O.status === "error" ? O.error ?? "Unable to compute value." : "Computed value must be a number."
|
|
1622
|
-
), L(null),
|
|
1622
|
+
), L(null), x(null);
|
|
1623
1623
|
return;
|
|
1624
1624
|
}
|
|
1625
|
-
w("ok"),
|
|
1625
|
+
w("ok"), C(null), L(F), x(F);
|
|
1626
1626
|
}), () => {
|
|
1627
|
-
|
|
1627
|
+
W = !0;
|
|
1628
1628
|
};
|
|
1629
|
-
}, [v, o, s, N]), s === !1 ? null : /* @__PURE__ */ n(
|
|
1629
|
+
}, [v, o, s, N]), s === !1 ? null : /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(S, { direction: "column", gap: "1", children: [
|
|
1630
1630
|
/* @__PURE__ */ n(h, { as: "label", size: "2", weight: "bold", children: i }),
|
|
1631
1631
|
A === "unavailable" ? /* @__PURE__ */ n(h, { size: "2", color: "gray", children: "Not yet available." }) : A === "loading" ? /* @__PURE__ */ g(S, { align: "center", gap: "2", children: [
|
|
1632
1632
|
/* @__PURE__ */ n(Me, { size: "1" }),
|
|
1633
1633
|
/* @__PURE__ */ n(h, { size: "2", color: "gray", children: "Computing…" })
|
|
1634
|
-
] }) : A === "error" ? /* @__PURE__ */ n(h, { size: "2", color: "red", children:
|
|
1634
|
+
] }) : A === "error" ? /* @__PURE__ */ n(h, { size: "2", color: "red", children: D }) : /* @__PURE__ */ n(h, { size: "2", children: c.split(Je).join(sn(I, u)) }),
|
|
1635
1635
|
f.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: f.description })
|
|
1636
1636
|
] }) });
|
|
1637
|
-
}, fn = se(dn), hn =
|
|
1637
|
+
}, fn = se(dn), hn = K(
|
|
1638
1638
|
5,
|
|
1639
1639
|
ze((e) => {
|
|
1640
1640
|
const t = e["x-computed"];
|
|
@@ -1655,34 +1655,34 @@ const Je = "{value}", an = 2, un = {}, dn = ({ data: e, handleChange: t, path: r
|
|
|
1655
1655
|
const u = c ? r : r.items, y = c || r;
|
|
1656
1656
|
if (s === !1 || !u || typeof u != "object" || Array.isArray(u))
|
|
1657
1657
|
return null;
|
|
1658
|
-
const p = u, m = Array.isArray(e) ? e : [], v = y.title || "Array Items", N = () => {
|
|
1659
|
-
const
|
|
1660
|
-
l && l(t,
|
|
1661
|
-
},
|
|
1658
|
+
const p = u, m = Array.isArray(e) ? e : [], v = y.title || "Array Items", N = i.options ?? {}, A = f && N.addable !== !1, w = f && N.removable !== !1, I = () => {
|
|
1659
|
+
const D = Or(p, o);
|
|
1660
|
+
l && l(t, D)();
|
|
1661
|
+
}, L = (D) => {
|
|
1662
1662
|
if (a) {
|
|
1663
|
-
const
|
|
1664
|
-
|
|
1663
|
+
const C = a(t, [D]);
|
|
1664
|
+
C && C();
|
|
1665
1665
|
}
|
|
1666
1666
|
};
|
|
1667
|
-
return /* @__PURE__ */ n(
|
|
1667
|
+
return /* @__PURE__ */ n(R, { mb: "6", children: /* @__PURE__ */ g(S, { direction: "column", gap: "4", children: [
|
|
1668
1668
|
/* @__PURE__ */ n(h, { as: "div", size: "4", weight: "bold", children: v }),
|
|
1669
|
-
m.length === 0 && /* @__PURE__ */ n(
|
|
1670
|
-
m.map((
|
|
1671
|
-
var
|
|
1672
|
-
const
|
|
1669
|
+
m.length === 0 && /* @__PURE__ */ n(R, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ n(h, { size: "2", color: "gray", children: "No items have been added yet." }) }),
|
|
1670
|
+
m.map((D, C) => {
|
|
1671
|
+
var W;
|
|
1672
|
+
const H = `${t}.${C}`;
|
|
1673
1673
|
return /* @__PURE__ */ n(nr, { size: "3", variant: "surface", children: /* @__PURE__ */ g(S, { direction: "column", gap: "4", children: [
|
|
1674
1674
|
/* @__PURE__ */ g(S, { justify: "between", align: "center", children: [
|
|
1675
1675
|
/* @__PURE__ */ g(h, { size: "3", weight: "bold", children: [
|
|
1676
1676
|
"Item ",
|
|
1677
|
-
|
|
1677
|
+
C + 1
|
|
1678
1678
|
] }),
|
|
1679
|
-
|
|
1679
|
+
w && /* @__PURE__ */ g(
|
|
1680
1680
|
ke,
|
|
1681
1681
|
{
|
|
1682
1682
|
type: "button",
|
|
1683
1683
|
color: "red",
|
|
1684
1684
|
variant: "soft",
|
|
1685
|
-
onClick: () =>
|
|
1685
|
+
onClick: () => L(C),
|
|
1686
1686
|
title: "Remove item",
|
|
1687
1687
|
children: [
|
|
1688
1688
|
/* @__PURE__ */ n(Ur, {}),
|
|
@@ -1691,37 +1691,37 @@ const Je = "{value}", an = 2, un = {}, dn = ({ data: e, handleChange: t, path: r
|
|
|
1691
1691
|
}
|
|
1692
1692
|
)
|
|
1693
1693
|
] }),
|
|
1694
|
-
/* @__PURE__ */ n(
|
|
1694
|
+
/* @__PURE__ */ n(R, { children: /* @__PURE__ */ n(
|
|
1695
1695
|
Ae,
|
|
1696
1696
|
{
|
|
1697
1697
|
schema: p,
|
|
1698
|
-
uischema: ((
|
|
1698
|
+
uischema: ((W = i.options) == null ? void 0 : W.detail) || (p.type === "object" || p.properties ? {
|
|
1699
1699
|
type: "VerticalLayout",
|
|
1700
|
-
elements: Object.keys(p.properties || {}).map((
|
|
1700
|
+
elements: Object.keys(p.properties || {}).map((x) => ({
|
|
1701
1701
|
type: "Control",
|
|
1702
|
-
scope: `#/properties/${
|
|
1702
|
+
scope: `#/properties/${x}`
|
|
1703
1703
|
}))
|
|
1704
1704
|
} : {
|
|
1705
1705
|
type: "Control",
|
|
1706
1706
|
scope: "#"
|
|
1707
1707
|
}),
|
|
1708
|
-
path:
|
|
1708
|
+
path: H,
|
|
1709
1709
|
enabled: f,
|
|
1710
1710
|
renderers: void 0,
|
|
1711
1711
|
cells: void 0
|
|
1712
1712
|
}
|
|
1713
1713
|
) })
|
|
1714
|
-
] }) },
|
|
1714
|
+
] }) }, H);
|
|
1715
1715
|
}),
|
|
1716
|
-
|
|
1716
|
+
A && /* @__PURE__ */ n(R, { mt: "2", children: /* @__PURE__ */ g(ke, { type: "button", variant: "surface", onClick: I, children: [
|
|
1717
1717
|
/* @__PURE__ */ n(Hr, {}),
|
|
1718
1718
|
"Add Item"
|
|
1719
1719
|
] }) })
|
|
1720
1720
|
] }) });
|
|
1721
|
-
}, qe = Mr(pn), mn =
|
|
1721
|
+
}, qe = Mr(pn), mn = K(3, Nr), gn = ({ uischema: e, visible: t }) => {
|
|
1722
1722
|
const r = e;
|
|
1723
|
-
return t === !1 ? null : /* @__PURE__ */ n(
|
|
1724
|
-
}, yn =
|
|
1723
|
+
return t === !1 ? null : /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ n(tr, { size: "4", children: r.text }) });
|
|
1724
|
+
}, yn = K(1, Te("Label")), vn = K(3, Ir), xn = [
|
|
1725
1725
|
{ tester: Kr, renderer: Gr },
|
|
1726
1726
|
{ tester: jr, renderer: Yr },
|
|
1727
1727
|
{ tester: qr, renderer: Zr },
|