@opennsw/jsonforms-renderers 0.11.0 → 0.12.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/LICENSE +201 -0
- package/README.md +24 -53
- package/dist/index.d.ts +9 -2
- package/dist/renderers.cjs.js +2 -2
- package/dist/renderers.es.js +1447 -1247
- package/package.json +1 -1
package/dist/renderers.es.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as i, jsxs as y, Fragment as
|
|
5
|
-
import { useContext as
|
|
6
|
-
import { rankWith as
|
|
7
|
-
import { withJsonFormsControlProps as
|
|
8
|
-
import { Box as
|
|
9
|
-
import { ChevronDownIcon as
|
|
10
|
-
import
|
|
11
|
-
const
|
|
12
|
-
function
|
|
1
|
+
var fr = Object.defineProperty;
|
|
2
|
+
var pr = (e, r, t) => r in e ? fr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
|
+
var gt = (e, r, t) => pr(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { jsx as i, jsxs as y, Fragment as ve } from "react/jsx-runtime";
|
|
5
|
+
import { useContext as Mt, createContext as zt, useMemo as We, useEffect as me, useState as j, useRef as ue, useCallback as $e } from "react";
|
|
6
|
+
import { rankWith as te, isStringControl as hr, or as tt, isNumberControl as mr, isIntegerControl as gr, isBooleanControl as yr, isEnumControl as Ft, isOneOfControl as Ut, Resolve as Pe, schemaMatches as Me, isDateControl as br, isDateTimeControl as vr, isTimeControl as wr, uiTypeIs as Xe, and as $t, not as Er, optionIs as Tr, update as xr, createDefaultValue as Ar, isObjectArrayControl as Rr, isPrimitiveArrayControl as Cr } from "@jsonforms/core";
|
|
7
|
+
import { withJsonFormsControlProps as pe, useJsonForms as Ve, JsonFormsDispatch as Ye, withJsonFormsArrayControlProps as Sr, withJsonFormsLayoutProps as Ge } from "@jsonforms/react";
|
|
8
|
+
import { Box as k, Flex as F, Text as h, TextField as Oe, Checkbox as Or, RadioGroup as yt, ScrollArea as Pt, Select as qe, Spinner as _e, Button as ze, Tabs as Je, Heading as _t, Card as jt, Tooltip as Be, IconButton as je, Table as Se } from "@radix-ui/themes";
|
|
9
|
+
import { ChevronDownIcon as Vt, FileTextIcon as Nr, DownloadIcon as at, CheckCircledIcon as Dr, Cross2Icon as ct, ExclamationTriangleIcon as ut, UploadIcon as Ue, TrashIcon as Ir, PlusIcon as kr } from "@radix-ui/react-icons";
|
|
10
|
+
import Ht from "dayjs";
|
|
11
|
+
const Wt = zt(null);
|
|
12
|
+
function Ci({
|
|
13
13
|
children: e,
|
|
14
14
|
onUpload: r,
|
|
15
15
|
getDownloadUrl: t
|
|
16
16
|
}) {
|
|
17
17
|
const n = { onUpload: r, getDownloadUrl: t };
|
|
18
|
-
return /* @__PURE__ */ i(
|
|
18
|
+
return /* @__PURE__ */ i(Wt.Provider, { value: n, children: e });
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
20
|
+
function Lr() {
|
|
21
|
+
return Mt(Wt);
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
23
|
+
const Bt = zt(null);
|
|
24
|
+
function Si({
|
|
25
25
|
children: e,
|
|
26
26
|
services: r
|
|
27
27
|
}) {
|
|
28
|
-
const t =
|
|
29
|
-
return /* @__PURE__ */ i(
|
|
28
|
+
const t = We(() => r, [r]);
|
|
29
|
+
return /* @__PURE__ */ i(Bt.Provider, { value: t, children: e });
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const r =
|
|
31
|
+
function Mr(e) {
|
|
32
|
+
const r = Mt(Bt);
|
|
33
33
|
return !r || !e ? null : r[e] ?? null;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const Re = (e, r, t, n = void 0) => {
|
|
36
|
+
me(() => {
|
|
37
37
|
e === !1 && t(r, n);
|
|
38
38
|
}, [e, r, t, n]);
|
|
39
|
-
},
|
|
39
|
+
}, we = (e, r) => e ? e.split(`
|
|
40
40
|
`).map((t) => t.trim() === "is a required property" ? `${r || "This field"} is required` : t).join(`
|
|
41
|
-
`) : "",
|
|
41
|
+
`) : "", zr = ({
|
|
42
42
|
data: e,
|
|
43
43
|
handleChange: r,
|
|
44
44
|
path: t,
|
|
@@ -46,35 +46,35 @@ const Ee = (e, r, t, n = void 0) => {
|
|
|
46
46
|
required: l,
|
|
47
47
|
errors: o,
|
|
48
48
|
uischema: s,
|
|
49
|
-
schema:
|
|
49
|
+
schema: u,
|
|
50
50
|
enabled: a,
|
|
51
|
-
visible:
|
|
51
|
+
visible: c = !0
|
|
52
52
|
}) => {
|
|
53
|
-
var
|
|
54
|
-
if (
|
|
53
|
+
var f;
|
|
54
|
+
if (Re(c, t, r), c === !1)
|
|
55
55
|
return null;
|
|
56
|
-
const
|
|
57
|
-
return /* @__PURE__ */ i(
|
|
58
|
-
/* @__PURE__ */ y(
|
|
56
|
+
const d = o.length === 0;
|
|
57
|
+
return /* @__PURE__ */ i(k, { mb: "4", children: /* @__PURE__ */ y(F, { direction: "column", gap: "1", children: [
|
|
58
|
+
/* @__PURE__ */ y(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
59
59
|
n,
|
|
60
60
|
" ",
|
|
61
|
-
l && /* @__PURE__ */ i(
|
|
61
|
+
l && /* @__PURE__ */ i(h, { color: "red", children: "*" })
|
|
62
62
|
] }),
|
|
63
63
|
/* @__PURE__ */ i(
|
|
64
|
-
|
|
64
|
+
Oe.Root,
|
|
65
65
|
{
|
|
66
66
|
value: e || "",
|
|
67
67
|
onChange: (p) => r(t, p.target.value),
|
|
68
68
|
disabled: !a,
|
|
69
|
-
placeholder: (
|
|
70
|
-
color:
|
|
69
|
+
placeholder: (f = s.options) == null ? void 0 : f.placeholder,
|
|
70
|
+
color: d ? void 0 : "red",
|
|
71
71
|
id: t
|
|
72
72
|
}
|
|
73
73
|
),
|
|
74
|
-
!
|
|
75
|
-
|
|
74
|
+
!d && /* @__PURE__ */ i(h, { color: "red", size: "1", children: we(o, n) }),
|
|
75
|
+
u.description && /* @__PURE__ */ i(h, { size: "1", color: "gray", children: u.description })
|
|
76
76
|
] }) });
|
|
77
|
-
},
|
|
77
|
+
}, Fr = te(1, hr), Ur = pe(zr), $r = ({
|
|
78
78
|
data: e,
|
|
79
79
|
handleChange: r,
|
|
80
80
|
path: t,
|
|
@@ -82,14 +82,14 @@ const Ee = (e, r, t, n = void 0) => {
|
|
|
82
82
|
required: l,
|
|
83
83
|
errors: o,
|
|
84
84
|
uischema: s,
|
|
85
|
-
schema:
|
|
85
|
+
schema: u,
|
|
86
86
|
enabled: a,
|
|
87
|
-
visible:
|
|
87
|
+
visible: c = !0
|
|
88
88
|
}) => {
|
|
89
89
|
var p;
|
|
90
|
-
if (
|
|
90
|
+
if (Re(c, t, r), c === !1)
|
|
91
91
|
return null;
|
|
92
|
-
const
|
|
92
|
+
const d = o.length === 0, f = (g) => {
|
|
93
93
|
if (g === "") {
|
|
94
94
|
r(t, void 0);
|
|
95
95
|
return;
|
|
@@ -97,28 +97,28 @@ const Ee = (e, r, t, n = void 0) => {
|
|
|
97
97
|
const b = Number(g);
|
|
98
98
|
isNaN(b) || r(t, b);
|
|
99
99
|
};
|
|
100
|
-
return /* @__PURE__ */ i(
|
|
101
|
-
/* @__PURE__ */ y(
|
|
100
|
+
return /* @__PURE__ */ i(k, { mb: "4", children: /* @__PURE__ */ y(F, { direction: "column", gap: "1", children: [
|
|
101
|
+
/* @__PURE__ */ y(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
102
102
|
n,
|
|
103
103
|
" ",
|
|
104
|
-
l && /* @__PURE__ */ i(
|
|
104
|
+
l && /* @__PURE__ */ i(h, { color: "red", children: "*" })
|
|
105
105
|
] }),
|
|
106
106
|
/* @__PURE__ */ i(
|
|
107
|
-
|
|
107
|
+
Oe.Root,
|
|
108
108
|
{
|
|
109
109
|
type: "number",
|
|
110
110
|
value: e ?? "",
|
|
111
|
-
onChange: (g) =>
|
|
111
|
+
onChange: (g) => f(g.target.value),
|
|
112
112
|
disabled: !a,
|
|
113
113
|
placeholder: (p = s.options) == null ? void 0 : p.placeholder,
|
|
114
|
-
color:
|
|
114
|
+
color: d ? void 0 : "red",
|
|
115
115
|
id: t
|
|
116
116
|
}
|
|
117
117
|
),
|
|
118
|
-
!
|
|
119
|
-
|
|
118
|
+
!d && /* @__PURE__ */ i(h, { color: "red", size: "1", children: we(o, n) }),
|
|
119
|
+
u.description && /* @__PURE__ */ i(h, { size: "1", color: "gray", children: u.description })
|
|
120
120
|
] }) });
|
|
121
|
-
},
|
|
121
|
+
}, Pr = te(2, tt(mr, gr)), _r = pe($r), jr = ({
|
|
122
122
|
data: e,
|
|
123
123
|
handleChange: r,
|
|
124
124
|
path: t,
|
|
@@ -126,33 +126,33 @@ const Ee = (e, r, t, n = void 0) => {
|
|
|
126
126
|
required: l,
|
|
127
127
|
errors: o,
|
|
128
128
|
schema: s,
|
|
129
|
-
enabled:
|
|
129
|
+
enabled: u,
|
|
130
130
|
visible: a = !0
|
|
131
131
|
}) => {
|
|
132
|
-
if (
|
|
132
|
+
if (Re(a, t, r), a === !1)
|
|
133
133
|
return null;
|
|
134
|
-
const
|
|
135
|
-
return /* @__PURE__ */ y(
|
|
136
|
-
/* @__PURE__ */ y(
|
|
134
|
+
const c = o.length === 0;
|
|
135
|
+
return /* @__PURE__ */ y(k, { mb: "4", children: [
|
|
136
|
+
/* @__PURE__ */ y(F, { gap: "2", align: "center", children: [
|
|
137
137
|
/* @__PURE__ */ i(
|
|
138
|
-
|
|
138
|
+
Or,
|
|
139
139
|
{
|
|
140
140
|
checked: !!e,
|
|
141
|
-
onCheckedChange: (
|
|
142
|
-
disabled: !
|
|
141
|
+
onCheckedChange: (d) => r(t, d === !0),
|
|
142
|
+
disabled: !u,
|
|
143
143
|
id: t
|
|
144
144
|
}
|
|
145
145
|
),
|
|
146
|
-
/* @__PURE__ */ y(
|
|
146
|
+
/* @__PURE__ */ y(h, { as: "label", size: "2", htmlFor: t, children: [
|
|
147
147
|
n,
|
|
148
148
|
" ",
|
|
149
149
|
l && "*"
|
|
150
150
|
] })
|
|
151
151
|
] }),
|
|
152
|
-
!
|
|
153
|
-
s.description && /* @__PURE__ */ i(
|
|
152
|
+
!c && /* @__PURE__ */ i(h, { color: "red", size: "1", className: "block mt-1", children: we(o, n) }),
|
|
153
|
+
s.description && /* @__PURE__ */ i(h, { size: "1", color: "gray", className: "block mt-1", children: s.description })
|
|
154
154
|
] });
|
|
155
|
-
},
|
|
155
|
+
}, Vr = te(2, yr), Hr = pe(jr), Wr = ({
|
|
156
156
|
data: e,
|
|
157
157
|
handleChange: r,
|
|
158
158
|
path: t,
|
|
@@ -160,35 +160,35 @@ const Ee = (e, r, t, n = void 0) => {
|
|
|
160
160
|
required: l,
|
|
161
161
|
errors: o,
|
|
162
162
|
schema: s,
|
|
163
|
-
enabled:
|
|
163
|
+
enabled: u,
|
|
164
164
|
visible: a = !0
|
|
165
165
|
}) => {
|
|
166
|
-
if (
|
|
166
|
+
if (Re(a, t, r), a === !1)
|
|
167
167
|
return null;
|
|
168
|
-
const
|
|
169
|
-
let
|
|
170
|
-
s.enum ?
|
|
168
|
+
const c = o.length === 0;
|
|
169
|
+
let d = [];
|
|
170
|
+
s.enum ? d = s.enum.map((p) => ({ value: p, label: String(p) })) : s.oneOf && (d = s.oneOf.map((p) => ({
|
|
171
171
|
value: p.const,
|
|
172
172
|
label: p.title || String(p.const)
|
|
173
173
|
})));
|
|
174
|
-
const
|
|
175
|
-
return /* @__PURE__ */ i(
|
|
176
|
-
/* @__PURE__ */ y(
|
|
174
|
+
const f = e;
|
|
175
|
+
return /* @__PURE__ */ i(k, { mb: "4", children: /* @__PURE__ */ y(F, { direction: "column", gap: "1", children: [
|
|
176
|
+
/* @__PURE__ */ y(h, { as: "div", size: "2", weight: "bold", children: [
|
|
177
177
|
n,
|
|
178
178
|
" ",
|
|
179
|
-
l && /* @__PURE__ */ i(
|
|
179
|
+
l && /* @__PURE__ */ i(h, { color: "red", children: "*" })
|
|
180
180
|
] }),
|
|
181
181
|
/* @__PURE__ */ i(
|
|
182
|
-
|
|
182
|
+
yt.Root,
|
|
183
183
|
{
|
|
184
|
-
value:
|
|
184
|
+
value: f !== void 0 ? String(f) : "",
|
|
185
185
|
onValueChange: (p) => {
|
|
186
|
-
const g =
|
|
186
|
+
const g = d.find((b) => String(b.value) === p);
|
|
187
187
|
g && r(t, g.value);
|
|
188
188
|
},
|
|
189
|
-
disabled: !
|
|
189
|
+
disabled: !u,
|
|
190
190
|
children: /* @__PURE__ */ i(
|
|
191
|
-
|
|
191
|
+
F,
|
|
192
192
|
{
|
|
193
193
|
direction: "row",
|
|
194
194
|
style: {
|
|
@@ -196,21 +196,21 @@ const Ee = (e, r, t, n = void 0) => {
|
|
|
196
196
|
columnGap: "clamp(14px, 3vw, 36px)",
|
|
197
197
|
rowGap: "clamp(8px, 1.6vw, 14px)"
|
|
198
198
|
},
|
|
199
|
-
children:
|
|
200
|
-
/* @__PURE__ */ i(
|
|
201
|
-
/* @__PURE__ */ i(
|
|
199
|
+
children: d.map((p) => /* @__PURE__ */ y(F, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
|
|
200
|
+
/* @__PURE__ */ i(yt.Item, { value: String(p.value) }),
|
|
201
|
+
/* @__PURE__ */ i(h, { size: "2", color: u ? void 0 : "gray", children: p.label })
|
|
202
202
|
] }, String(p.value)))
|
|
203
203
|
}
|
|
204
204
|
)
|
|
205
205
|
}
|
|
206
206
|
),
|
|
207
|
-
!
|
|
208
|
-
s.description && /* @__PURE__ */ i(
|
|
207
|
+
!c && /* @__PURE__ */ i(h, { color: "red", size: "1", children: we(o, n) }),
|
|
208
|
+
s.description && /* @__PURE__ */ i(h, { size: "1", color: "gray", children: s.description })
|
|
209
209
|
] }) });
|
|
210
|
-
},
|
|
210
|
+
}, Br = (e, r, t) => {
|
|
211
211
|
var l;
|
|
212
|
-
return
|
|
213
|
-
},
|
|
212
|
+
return tt(Ft, Ut)(e, r, t) && ((l = e == null ? void 0 : e.options) == null ? void 0 : l.format) === "radio" ? 3 : -1;
|
|
213
|
+
}, Xr = pe(Wr), Yr = ({
|
|
214
214
|
data: e,
|
|
215
215
|
handleChange: r,
|
|
216
216
|
path: t,
|
|
@@ -218,85 +218,85 @@ const Ee = (e, r, t, n = void 0) => {
|
|
|
218
218
|
required: l,
|
|
219
219
|
errors: o,
|
|
220
220
|
schema: s,
|
|
221
|
-
uischema:
|
|
221
|
+
uischema: u,
|
|
222
222
|
enabled: a,
|
|
223
|
-
visible:
|
|
223
|
+
visible: c = !0
|
|
224
224
|
}) => {
|
|
225
|
-
var
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
if (
|
|
229
|
-
if (!
|
|
230
|
-
const v = (
|
|
231
|
-
|
|
225
|
+
var D, z, V;
|
|
226
|
+
Re(c, t, r);
|
|
227
|
+
const d = ((D = u.options) == null ? void 0 : D.autocomplete) === !0, [f, p] = j(!1), [g, b] = j(""), [M, N] = j(0), U = ue(null);
|
|
228
|
+
if (me(() => {
|
|
229
|
+
if (!d || !f) return;
|
|
230
|
+
const v = (x) => {
|
|
231
|
+
U.current && !U.current.contains(x.target) && p(!1);
|
|
232
232
|
};
|
|
233
233
|
return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
|
|
234
|
-
}, [
|
|
234
|
+
}, [d, f]), c === !1)
|
|
235
235
|
return null;
|
|
236
|
-
const
|
|
237
|
-
let
|
|
238
|
-
s.enum ?
|
|
236
|
+
const T = o.length === 0;
|
|
237
|
+
let R = [];
|
|
238
|
+
s.enum ? R = s.enum.map((v) => ({ value: String(v), label: String(v) })) : s.oneOf && (R = s.oneOf.map((v) => ({
|
|
239
239
|
value: String(v.const),
|
|
240
240
|
label: v.title || String(v.const)
|
|
241
241
|
})));
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
const v = ((
|
|
245
|
-
r(t,
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
-
(
|
|
242
|
+
const I = e !== void 0 ? String(e) : "", A = ((z = u.options) == null ? void 0 : z.placeholder) || "Select an option";
|
|
243
|
+
if (d) {
|
|
244
|
+
const v = ((V = R.find((O) => O.value === I)) == null ? void 0 : V.label) ?? "", x = f ? R.filter((O) => O.label.toLowerCase().includes(g.toLowerCase())) : R, re = Math.min(M, x.length - 1), X = (O) => {
|
|
245
|
+
r(t, O.value), p(!1);
|
|
246
|
+
}, Y = (O) => {
|
|
247
|
+
O.stopPropagation(), r(t, void 0), b("");
|
|
248
|
+
}, L = (O) => {
|
|
249
|
+
(O.key === "Enter" || O.key === " ") && Y(O);
|
|
250
250
|
};
|
|
251
|
-
return /* @__PURE__ */ i(
|
|
252
|
-
/* @__PURE__ */ y(
|
|
251
|
+
return /* @__PURE__ */ i(k, { mb: "4", children: /* @__PURE__ */ y(F, { direction: "column", gap: "1", children: [
|
|
252
|
+
/* @__PURE__ */ y(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
253
253
|
n,
|
|
254
254
|
" ",
|
|
255
|
-
l && /* @__PURE__ */ i(
|
|
255
|
+
l && /* @__PURE__ */ i(h, { color: "red", children: "*" })
|
|
256
256
|
] }),
|
|
257
|
-
/* @__PURE__ */ y("div", { ref:
|
|
257
|
+
/* @__PURE__ */ y("div", { ref: U, style: { position: "relative" }, children: [
|
|
258
258
|
/* @__PURE__ */ i(
|
|
259
|
-
|
|
259
|
+
Oe.Root,
|
|
260
260
|
{
|
|
261
261
|
id: t,
|
|
262
|
-
value:
|
|
263
|
-
placeholder:
|
|
262
|
+
value: f ? g : v,
|
|
263
|
+
placeholder: A,
|
|
264
264
|
disabled: !a,
|
|
265
|
-
style:
|
|
266
|
-
onChange: (
|
|
267
|
-
b(
|
|
265
|
+
style: T ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
|
|
266
|
+
onChange: (O) => {
|
|
267
|
+
b(O.target.value), N(0), f || p(!0);
|
|
268
268
|
},
|
|
269
269
|
onFocus: () => {
|
|
270
|
-
a && !
|
|
270
|
+
a && !f && (b(""), N(0), p(!0));
|
|
271
271
|
},
|
|
272
|
-
onKeyDown: (
|
|
273
|
-
|
|
272
|
+
onKeyDown: (O) => {
|
|
273
|
+
O.key === "Escape" ? p(!1) : O.key === "ArrowDown" ? (O.preventDefault(), f ? N((G) => Math.min(G + 1, x.length - 1)) : (b(""), p(!0))) : O.key === "ArrowUp" ? (O.preventDefault(), f && N((G) => Math.max(G - 1, 0))) : O.key === "Enter" && f && x[re] && (O.preventDefault(), X(x[re]));
|
|
274
274
|
},
|
|
275
|
-
children: /* @__PURE__ */ i(
|
|
276
|
-
|
|
275
|
+
children: /* @__PURE__ */ i(Oe.Slot, { side: "right", children: /* @__PURE__ */ y(F, { align: "center", gap: "1", children: [
|
|
276
|
+
I && a && /* @__PURE__ */ i(
|
|
277
277
|
"span",
|
|
278
278
|
{
|
|
279
279
|
role: "button",
|
|
280
280
|
tabIndex: 0,
|
|
281
|
-
onMouseDown: (
|
|
282
|
-
onClick:
|
|
283
|
-
onKeyDown:
|
|
281
|
+
onMouseDown: (O) => O.preventDefault(),
|
|
282
|
+
onClick: Y,
|
|
283
|
+
onKeyDown: L,
|
|
284
284
|
style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
|
|
285
285
|
"aria-label": "Clear selection",
|
|
286
286
|
children: "×"
|
|
287
287
|
}
|
|
288
288
|
),
|
|
289
289
|
/* @__PURE__ */ i(
|
|
290
|
-
|
|
290
|
+
Vt,
|
|
291
291
|
{
|
|
292
|
-
style: { transform:
|
|
292
|
+
style: { transform: f ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
|
|
293
293
|
}
|
|
294
294
|
)
|
|
295
295
|
] }) })
|
|
296
296
|
}
|
|
297
297
|
),
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
f && /* @__PURE__ */ i(
|
|
299
|
+
k,
|
|
300
300
|
{
|
|
301
301
|
style: {
|
|
302
302
|
position: "absolute",
|
|
@@ -310,82 +310,82 @@ const Ee = (e, r, t, n = void 0) => {
|
|
|
310
310
|
border: "1px solid var(--gray-a6)",
|
|
311
311
|
overflow: "hidden"
|
|
312
312
|
},
|
|
313
|
-
children: /* @__PURE__ */ i(
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
313
|
+
children: /* @__PURE__ */ i(Pt, { style: { maxHeight: 240 }, children: /* @__PURE__ */ y(k, { p: "1", children: [
|
|
314
|
+
x.length === 0 && /* @__PURE__ */ i(k, { px: "3", py: "2", children: /* @__PURE__ */ i(h, { size: "2", color: "gray", children: "No results found." }) }),
|
|
315
|
+
x.map((O, G) => /* @__PURE__ */ i(
|
|
316
|
+
k,
|
|
317
317
|
{
|
|
318
318
|
px: "3",
|
|
319
319
|
py: "2",
|
|
320
320
|
onMouseDown: (Q) => Q.preventDefault(),
|
|
321
|
-
onClick: () =>
|
|
322
|
-
onMouseEnter: () =>
|
|
321
|
+
onClick: () => X(O),
|
|
322
|
+
onMouseEnter: () => N(G),
|
|
323
323
|
style: {
|
|
324
324
|
cursor: "pointer",
|
|
325
325
|
borderRadius: "var(--radius-2)",
|
|
326
|
-
backgroundColor:
|
|
326
|
+
backgroundColor: G === re ? "var(--accent-4)" : O.value === I ? "var(--accent-3)" : void 0
|
|
327
327
|
},
|
|
328
|
-
children: /* @__PURE__ */ i(
|
|
328
|
+
children: /* @__PURE__ */ i(h, { size: "2", children: O.label })
|
|
329
329
|
},
|
|
330
|
-
|
|
330
|
+
O.value
|
|
331
331
|
))
|
|
332
332
|
] }) })
|
|
333
333
|
}
|
|
334
334
|
)
|
|
335
335
|
] }),
|
|
336
|
-
!
|
|
337
|
-
s.description && /* @__PURE__ */ i(
|
|
336
|
+
!T && /* @__PURE__ */ i(h, { color: "red", size: "1", children: we(o, n) }),
|
|
337
|
+
s.description && /* @__PURE__ */ i(h, { size: "1", color: "gray", children: s.description })
|
|
338
338
|
] }) });
|
|
339
339
|
}
|
|
340
|
-
return /* @__PURE__ */ i(
|
|
341
|
-
/* @__PURE__ */ y(
|
|
340
|
+
return /* @__PURE__ */ i(k, { mb: "4", children: /* @__PURE__ */ y(F, { direction: "column", gap: "1", children: [
|
|
341
|
+
/* @__PURE__ */ y(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
342
342
|
n,
|
|
343
343
|
" ",
|
|
344
|
-
l && /* @__PURE__ */ i(
|
|
344
|
+
l && /* @__PURE__ */ i(h, { color: "red", children: "*" })
|
|
345
345
|
] }),
|
|
346
|
-
/* @__PURE__ */ y(
|
|
347
|
-
/* @__PURE__ */ i(
|
|
348
|
-
/* @__PURE__ */ i(
|
|
346
|
+
/* @__PURE__ */ y(qe.Root, { value: I, onValueChange: (v) => r(t, v), disabled: !a, children: [
|
|
347
|
+
/* @__PURE__ */ i(qe.Trigger, { placeholder: A, color: T ? void 0 : "red", id: t }),
|
|
348
|
+
/* @__PURE__ */ i(qe.Content, { children: R.map((v) => /* @__PURE__ */ i(qe.Item, { value: v.value, children: v.label }, v.value)) })
|
|
349
349
|
] }),
|
|
350
|
-
!
|
|
351
|
-
s.description && /* @__PURE__ */ i(
|
|
350
|
+
!T && /* @__PURE__ */ i(h, { color: "red", size: "1", children: we(o, n) }),
|
|
351
|
+
s.description && /* @__PURE__ */ i(h, { size: "1", color: "gray", children: s.description })
|
|
352
352
|
] }) });
|
|
353
|
-
},
|
|
354
|
-
today: (e) =>
|
|
355
|
-
},
|
|
356
|
-
function
|
|
357
|
-
const n = { ...
|
|
358
|
-
return e.replace(
|
|
359
|
-
let
|
|
353
|
+
}, Kr = te(2, tt(Ft, Ut)), Gr = pe(Yr), Xt = /\{([A-Za-z0-9_]+)(?:\(([^(){}]*)\))?\}/g, qr = {
|
|
354
|
+
today: (e) => Ht().format(e || "YYYY-MM-DD")
|
|
355
|
+
}, Jr = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint", bt = (e, r) => Object.prototype.hasOwnProperty.call(e, r);
|
|
356
|
+
function rt(e, r, t = {}) {
|
|
357
|
+
const n = { ...qr, ...t };
|
|
358
|
+
return e.replace(Xt, (l, o, s) => {
|
|
359
|
+
let u;
|
|
360
360
|
if (s === void 0) {
|
|
361
|
-
if (!
|
|
362
|
-
|
|
361
|
+
if (!bt(r, o)) return l;
|
|
362
|
+
u = r[o];
|
|
363
363
|
} else {
|
|
364
|
-
if (!
|
|
364
|
+
if (!bt(n, o)) return l;
|
|
365
365
|
try {
|
|
366
|
-
|
|
366
|
+
u = n[o](s);
|
|
367
367
|
} catch {
|
|
368
368
|
return l;
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
return
|
|
371
|
+
return u == null ? "" : Jr(u) ? String(u) : l;
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function dt(e) {
|
|
375
375
|
const r = [];
|
|
376
376
|
let t = 0;
|
|
377
|
-
for (const n of e.matchAll(
|
|
377
|
+
for (const n of e.matchAll(Xt))
|
|
378
378
|
n.index > t && r.push(e.slice(t, n.index)), r.push(n[2] === void 0 ? { name: n[1] } : { name: n[1], arg: n[2] }), t = n.index + n[0].length;
|
|
379
379
|
return t < e.length && r.push(e.slice(t)), r;
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function Zr(e) {
|
|
382
382
|
if (typeof e == "string" && e.length > 0) return e;
|
|
383
383
|
if (e && typeof e == "object" && typeof e.value == "string") {
|
|
384
384
|
const r = e.value;
|
|
385
385
|
return r.length > 0 ? r : void 0;
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function Qr(e) {
|
|
389
389
|
if (typeof e == "string") return e.length > 0 ? { parent: e } : void 0;
|
|
390
390
|
if (!e || typeof e != "object") return;
|
|
391
391
|
const r = Object.entries(e);
|
|
@@ -395,20 +395,20 @@ function Pr(e) {
|
|
|
395
395
|
typeof o == "string" && o.length > 0 ? t[l] = o : n.push(l);
|
|
396
396
|
return n.length > 0 && console.warn(`x-search.dependsOn: ignoring invalid entries [${n.join(", ")}]`), Object.keys(t).length === 0 ? (console.warn("x-search.dependsOn: map has no valid entries; search will not fetch until fixed"), {}) : t;
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function en(e, r, t) {
|
|
399
399
|
const n = {};
|
|
400
400
|
for (const [l, o] of Object.entries(e))
|
|
401
|
-
n[l] =
|
|
401
|
+
n[l] = Zr(Pe.data(r, t ? `${t}.${o}` : o));
|
|
402
402
|
return n;
|
|
403
403
|
}
|
|
404
|
-
function
|
|
405
|
-
return r ? { ...e, name:
|
|
404
|
+
function vt(e, r) {
|
|
405
|
+
return r ? { ...e, name: rt(r, e) } : e;
|
|
406
406
|
}
|
|
407
|
-
const
|
|
407
|
+
const tn = {
|
|
408
408
|
"small-list": { fetchOnOpen: !0, searchable: !1, paginated: !1 },
|
|
409
409
|
"large-searchable-list": { fetchOnOpen: !0, searchable: !0, paginated: !1 },
|
|
410
410
|
"large-paginated-list": { fetchOnOpen: !1, searchable: !0, paginated: !0 }
|
|
411
|
-
},
|
|
411
|
+
}, rn = ({
|
|
412
412
|
data: e,
|
|
413
413
|
handleChange: r,
|
|
414
414
|
path: t,
|
|
@@ -416,167 +416,172 @@ const _r = {
|
|
|
416
416
|
required: l,
|
|
417
417
|
errors: o,
|
|
418
418
|
enabled: s,
|
|
419
|
-
visible:
|
|
419
|
+
visible: u = !0,
|
|
420
420
|
schema: a,
|
|
421
|
-
uischema:
|
|
421
|
+
uischema: c
|
|
422
422
|
}) => {
|
|
423
|
-
var
|
|
424
|
-
const
|
|
423
|
+
var Ke, ye;
|
|
424
|
+
const d = (a == null ? void 0 : a["x-search"]) ?? {
|
|
425
425
|
service: "",
|
|
426
426
|
displayTemplate: ""
|
|
427
|
-
},
|
|
428
|
-
var
|
|
429
|
-
const
|
|
430
|
-
if (!
|
|
431
|
-
const Z =
|
|
432
|
-
return { parentValues: Z, parentValuesKey: JSON.stringify(Z), missingParent:
|
|
433
|
-
}, [
|
|
434
|
-
|
|
435
|
-
if (!
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
438
|
-
Object.keys(
|
|
439
|
-
}, [
|
|
440
|
-
var
|
|
441
|
-
if (
|
|
442
|
-
|
|
427
|
+
}, f = d.service ?? "", p = d.mode ?? "large-paginated-list", g = tn[p], b = (g == null ? void 0 : g.fetchOnOpen) ?? !1, M = typeof d.displayTemplate == "string" ? d.displayTemplate : "", N = Ve(), U = t.split(".").slice(0, -1).join("."), { parentValues: T, parentValuesKey: R, missingParent: I } = We(() => {
|
|
428
|
+
var be;
|
|
429
|
+
const E = Qr(d.dependsOn);
|
|
430
|
+
if (!E) return { parentValues: void 0, parentValuesKey: "", missingParent: !1 };
|
|
431
|
+
const Z = en(E, (be = N.core) == null ? void 0 : be.data, U), le = Object.keys(Z).length === 0 || Object.values(Z).some((Ce) => !Ce);
|
|
432
|
+
return { parentValues: Z, parentValuesKey: JSON.stringify(Z), missingParent: le };
|
|
433
|
+
}, [d.dependsOn, (Ke = N.core) == null ? void 0 : Ke.data, U]), A = We(() => T ? { ...d.params, ...T } : d.params, [T, R, d.params]), D = Mr(f), z = a.type === "object", V = z ? typeof e == "string" ? { value: e } : e ?? void 0 : void 0, v = z ? V == null ? void 0 : V.value : e, x = V == null ? void 0 : V.label, re = f ? D ? g ? M ? null : "x-search.displayTemplate is required." : `Invalid x-search.mode "${p}". Expected "small-list", "large-searchable-list", or "large-paginated-list".` : `Search service "${f}" is not registered.` : "Search not configured.", X = s !== !1, Y = !o || o.length === 0, [L, O] = j(!1), [G, Q] = j(""), [de, ne] = j([]), [Ne, S] = j(!1), [K, fe] = j(!1), [Ee, ee] = j(!1), [ge, ie] = j(null), [Te, m] = j(void 0), w = ue(void 0), $ = ue(null), B = ue(null), q = ue(null), J = ue(void 0), C = ue(void 0);
|
|
434
|
+
me(() => {
|
|
435
|
+
if (!T) return;
|
|
436
|
+
const E = C.current;
|
|
437
|
+
if (C.current = T, !E || !v) return;
|
|
438
|
+
Object.keys(T).some((le) => E[le] !== void 0 && E[le] !== T[le]) && r(t, z ? void 0 : null);
|
|
439
|
+
}, [R, v, r, t, z]), me(() => {
|
|
440
|
+
var be, Ce;
|
|
441
|
+
if (re) {
|
|
442
|
+
m(void 0), J.current = void 0;
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
445
445
|
if (!v) {
|
|
446
|
-
|
|
446
|
+
m(void 0), J.current = void 0;
|
|
447
447
|
return;
|
|
448
448
|
}
|
|
449
|
-
if (((
|
|
450
|
-
if (
|
|
451
|
-
|
|
449
|
+
if (((be = J.current) == null ? void 0 : be.value) === v && ((Ce = J.current) == null ? void 0 : Ce.label) === x) return;
|
|
450
|
+
if (z && x) {
|
|
451
|
+
m({ id: v, name: x }), J.current = { value: v, label: x };
|
|
452
452
|
return;
|
|
453
453
|
}
|
|
454
|
-
if (
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
454
|
+
if (m({ id: v, name: x ?? v }), !(D != null && D.resolve)) {
|
|
455
|
+
J.current = { value: v, label: x };
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
let E = !1;
|
|
459
|
+
const Z = v, le = x;
|
|
460
|
+
return D.resolve(Z, A).then((He) => {
|
|
461
|
+
E || (He && m(vt(He, M)), J.current = { value: Z, label: le });
|
|
458
462
|
}).catch(() => {
|
|
463
|
+
E || (J.current = { value: Z, label: le });
|
|
459
464
|
}), () => {
|
|
460
|
-
|
|
465
|
+
E = !0;
|
|
461
466
|
};
|
|
462
|
-
}, [
|
|
463
|
-
const
|
|
464
|
-
async (
|
|
465
|
-
var
|
|
466
|
-
if (
|
|
467
|
-
if (!
|
|
468
|
-
|
|
467
|
+
}, [re, v, x, z, D, A, M]);
|
|
468
|
+
const P = $e(
|
|
469
|
+
async (E, Z = !1) => {
|
|
470
|
+
var be;
|
|
471
|
+
if (re) return;
|
|
472
|
+
if (!D) {
|
|
473
|
+
ie("Search service not configured.");
|
|
469
474
|
return;
|
|
470
475
|
}
|
|
471
|
-
(
|
|
472
|
-
const
|
|
473
|
-
|
|
476
|
+
(be = B.current) == null || be.abort();
|
|
477
|
+
const le = new AbortController();
|
|
478
|
+
B.current = le, Z ? ee(!0) : (fe(!0), ee(!1), ie(null));
|
|
474
479
|
try {
|
|
475
|
-
const
|
|
476
|
-
query:
|
|
477
|
-
cursor: Z ?
|
|
478
|
-
signal:
|
|
479
|
-
params:
|
|
480
|
+
const Ce = await D.search({
|
|
481
|
+
query: E,
|
|
482
|
+
cursor: Z ? w.current : void 0,
|
|
483
|
+
signal: le.signal,
|
|
484
|
+
params: A
|
|
480
485
|
});
|
|
481
|
-
if (
|
|
482
|
-
const
|
|
483
|
-
|
|
486
|
+
if (le.signal.aborted) return;
|
|
487
|
+
const He = (Ce.options ?? []).map((nt) => vt(nt, M));
|
|
488
|
+
ne(Z ? (nt) => [...nt, ...He] : He), w.current = Ce.nextCursor, S(((g == null ? void 0 : g.paginated) ?? !1) && Ce.nextCursor != null);
|
|
484
489
|
} catch {
|
|
485
|
-
if (
|
|
486
|
-
|
|
490
|
+
if (le.signal.aborted) return;
|
|
491
|
+
ie("Failed to load results. Please try again.");
|
|
487
492
|
} finally {
|
|
488
|
-
|
|
493
|
+
le.signal.aborted || (Z ? ee(!1) : fe(!1));
|
|
489
494
|
}
|
|
490
495
|
},
|
|
491
|
-
[
|
|
496
|
+
[re, D, g == null ? void 0 : g.paginated, A, M]
|
|
492
497
|
);
|
|
493
|
-
if (
|
|
494
|
-
if (!
|
|
495
|
-
const
|
|
496
|
-
|
|
498
|
+
if (me(() => {
|
|
499
|
+
if (!L) return;
|
|
500
|
+
const E = (Z) => {
|
|
501
|
+
q.current && !q.current.contains(Z.target) && O(!1);
|
|
497
502
|
};
|
|
498
|
-
return document.addEventListener("mousedown",
|
|
499
|
-
}, [
|
|
500
|
-
var
|
|
501
|
-
|
|
502
|
-
}, [
|
|
503
|
-
if (!
|
|
504
|
-
if (
|
|
505
|
-
|
|
503
|
+
return document.addEventListener("mousedown", E), () => document.removeEventListener("mousedown", E);
|
|
504
|
+
}, [L]), me(() => {
|
|
505
|
+
var E;
|
|
506
|
+
L || ((E = B.current) == null || E.abort(), Q(""), ne([]), S(!1), ie(null), fe(!1), ee(!1), w.current = void 0);
|
|
507
|
+
}, [L]), me(() => {
|
|
508
|
+
if (!L) return;
|
|
509
|
+
if (I) {
|
|
510
|
+
ne([]), S(!1), ie(null), w.current = void 0;
|
|
506
511
|
return;
|
|
507
512
|
}
|
|
508
|
-
if (!
|
|
509
|
-
|
|
513
|
+
if (!G && !b) {
|
|
514
|
+
ne([]), S(!1), ie(null), w.current = void 0;
|
|
510
515
|
return;
|
|
511
516
|
}
|
|
512
|
-
|
|
513
|
-
const
|
|
514
|
-
return
|
|
515
|
-
|
|
516
|
-
},
|
|
517
|
-
|
|
517
|
+
$.current && clearTimeout($.current);
|
|
518
|
+
const E = G ? 300 : 0;
|
|
519
|
+
return $.current = setTimeout(() => {
|
|
520
|
+
ne([]), S(!1), w.current = void 0, P(G);
|
|
521
|
+
}, E), () => {
|
|
522
|
+
$.current && clearTimeout($.current);
|
|
518
523
|
};
|
|
519
|
-
}, [
|
|
524
|
+
}, [G, L, b, P, I, R]), Re(u, t, r), u === !1)
|
|
520
525
|
return null;
|
|
521
526
|
const se = () => {
|
|
522
|
-
Q(""),
|
|
523
|
-
},
|
|
524
|
-
r(t,
|
|
525
|
-
},
|
|
526
|
-
|
|
527
|
-
},
|
|
528
|
-
(
|
|
529
|
-
},
|
|
530
|
-
return /* @__PURE__ */ i(
|
|
531
|
-
/* @__PURE__ */ y(
|
|
527
|
+
Q(""), ne([]), S(!1), ie(null), w.current = void 0, O(!0);
|
|
528
|
+
}, H = (E) => {
|
|
529
|
+
r(t, z ? { value: E.id, label: E.name } : E.id), m(E), J.current = { value: E.id, label: z ? E.name : void 0 }, O(!1);
|
|
530
|
+
}, _ = (E) => {
|
|
531
|
+
E.stopPropagation(), r(t, void 0), m(void 0);
|
|
532
|
+
}, De = (E) => {
|
|
533
|
+
(E.key === "Enter" || E.key === " ") && _(E);
|
|
534
|
+
}, Fe = ((ye = c == null ? void 0 : c.options) == null ? void 0 : ye.placeholder) ?? "Select an option";
|
|
535
|
+
return /* @__PURE__ */ i(k, { mb: "4", children: /* @__PURE__ */ y(F, { direction: "column", gap: "1", children: [
|
|
536
|
+
/* @__PURE__ */ y(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
532
537
|
n,
|
|
533
538
|
" ",
|
|
534
|
-
l && /* @__PURE__ */ i(
|
|
539
|
+
l && /* @__PURE__ */ i(h, { color: "red", children: "*" })
|
|
535
540
|
] }),
|
|
536
|
-
/* @__PURE__ */ y("div", { ref:
|
|
541
|
+
/* @__PURE__ */ y("div", { ref: q, style: { position: "relative" }, children: [
|
|
537
542
|
/* @__PURE__ */ i(
|
|
538
|
-
|
|
543
|
+
Oe.Root,
|
|
539
544
|
{
|
|
540
545
|
id: t,
|
|
541
|
-
value:
|
|
542
|
-
placeholder:
|
|
543
|
-
disabled: !
|
|
544
|
-
readOnly:
|
|
545
|
-
style:
|
|
546
|
-
onChange: (
|
|
547
|
-
g != null && g.searchable && (Q(
|
|
546
|
+
value: L ? G : (Te == null ? void 0 : Te.name) ?? "",
|
|
547
|
+
placeholder: L && (g != null && g.searchable) ? "Search..." : Fe,
|
|
548
|
+
disabled: !X,
|
|
549
|
+
readOnly: L && !(g != null && g.searchable),
|
|
550
|
+
style: Y ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
|
|
551
|
+
onChange: (E) => {
|
|
552
|
+
g != null && g.searchable && (Q(E.target.value), L || se());
|
|
548
553
|
},
|
|
549
554
|
onFocus: () => {
|
|
550
|
-
|
|
555
|
+
X && !L && se();
|
|
551
556
|
},
|
|
552
|
-
onKeyDown: (
|
|
553
|
-
|
|
557
|
+
onKeyDown: (E) => {
|
|
558
|
+
E.key === "Escape" && O(!1);
|
|
554
559
|
},
|
|
555
|
-
children: /* @__PURE__ */ i(
|
|
556
|
-
v &&
|
|
560
|
+
children: /* @__PURE__ */ i(Oe.Slot, { side: "right", children: /* @__PURE__ */ y(F, { align: "center", gap: "1", children: [
|
|
561
|
+
v && X && /* @__PURE__ */ i(
|
|
557
562
|
"span",
|
|
558
563
|
{
|
|
559
564
|
role: "button",
|
|
560
565
|
tabIndex: 0,
|
|
561
|
-
onMouseDown: (
|
|
562
|
-
onClick:
|
|
563
|
-
onKeyDown:
|
|
566
|
+
onMouseDown: (E) => E.preventDefault(),
|
|
567
|
+
onClick: _,
|
|
568
|
+
onKeyDown: De,
|
|
564
569
|
style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
|
|
565
570
|
"aria-label": "Clear selection",
|
|
566
571
|
children: "×"
|
|
567
572
|
}
|
|
568
573
|
),
|
|
569
574
|
/* @__PURE__ */ i(
|
|
570
|
-
|
|
575
|
+
Vt,
|
|
571
576
|
{
|
|
572
|
-
style: { transform:
|
|
577
|
+
style: { transform: L ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
|
|
573
578
|
}
|
|
574
579
|
)
|
|
575
580
|
] }) })
|
|
576
581
|
}
|
|
577
582
|
),
|
|
578
|
-
|
|
579
|
-
|
|
583
|
+
L && /* @__PURE__ */ i(
|
|
584
|
+
k,
|
|
580
585
|
{
|
|
581
586
|
style: {
|
|
582
587
|
position: "absolute",
|
|
@@ -590,65 +595,72 @@ const _r = {
|
|
|
590
595
|
border: "1px solid var(--gray-a6)",
|
|
591
596
|
overflow: "hidden"
|
|
592
597
|
},
|
|
593
|
-
children:
|
|
594
|
-
|
|
595
|
-
!
|
|
596
|
-
!
|
|
597
|
-
|
|
598
|
-
|
|
598
|
+
children: re ? /* @__PURE__ */ i(k, { p: "3", children: /* @__PURE__ */ i(h, { size: "2", color: "gray", children: re }) }) : /* @__PURE__ */ i(Pt, { style: { maxHeight: 240 }, children: /* @__PURE__ */ y(k, { p: "1", children: [
|
|
599
|
+
K && /* @__PURE__ */ i(F, { justify: "center", p: "4", children: /* @__PURE__ */ i(_e, {}) }),
|
|
600
|
+
!K && ge && /* @__PURE__ */ i(k, { px: "3", py: "2", children: /* @__PURE__ */ i(h, { size: "2", color: "red", children: ge }) }),
|
|
601
|
+
!K && !ge && de.length === 0 && /* @__PURE__ */ i(k, { px: "3", py: "2", children: /* @__PURE__ */ i(h, { size: "2", color: "gray", children: I ? "Select the related field first." : G || b ? "No results found." : "Type to search…" }) }),
|
|
602
|
+
de.map((E) => /* @__PURE__ */ i(
|
|
603
|
+
k,
|
|
599
604
|
{
|
|
600
605
|
px: "3",
|
|
601
606
|
py: "2",
|
|
602
607
|
onMouseDown: (Z) => Z.preventDefault(),
|
|
603
|
-
onClick: () =>
|
|
608
|
+
onClick: () => H(E),
|
|
604
609
|
style: {
|
|
605
610
|
cursor: "pointer",
|
|
606
611
|
borderRadius: "var(--radius-2)",
|
|
607
|
-
backgroundColor:
|
|
612
|
+
backgroundColor: E.id === v ? "var(--accent-3)" : void 0
|
|
608
613
|
},
|
|
609
614
|
className: "hover:bg-(--gray-3)",
|
|
610
|
-
children: /* @__PURE__ */ i(
|
|
615
|
+
children: /* @__PURE__ */ i(h, { size: "2", children: E.name })
|
|
611
616
|
},
|
|
612
|
-
|
|
617
|
+
E.id
|
|
613
618
|
)),
|
|
614
|
-
(g == null ? void 0 : g.paginated) &&
|
|
615
|
-
|
|
619
|
+
(g == null ? void 0 : g.paginated) && Ne && !Ee && /* @__PURE__ */ i(k, { px: "3", py: "2", children: /* @__PURE__ */ i(
|
|
620
|
+
ze,
|
|
616
621
|
{
|
|
617
622
|
variant: "ghost",
|
|
618
623
|
size: "1",
|
|
619
624
|
style: { width: "100%" },
|
|
620
|
-
onMouseDown: (
|
|
621
|
-
onClick: () => void
|
|
625
|
+
onMouseDown: (E) => E.preventDefault(),
|
|
626
|
+
onClick: () => void P(G, !0),
|
|
622
627
|
children: "Load more"
|
|
623
628
|
}
|
|
624
629
|
) }),
|
|
625
|
-
|
|
630
|
+
Ee && /* @__PURE__ */ i(F, { justify: "center", p: "2", children: /* @__PURE__ */ i(_e, {}) })
|
|
626
631
|
] }) })
|
|
627
632
|
}
|
|
628
633
|
)
|
|
629
634
|
] }),
|
|
630
|
-
!
|
|
631
|
-
a.description && /* @__PURE__ */ i(
|
|
635
|
+
!Y && /* @__PURE__ */ i(h, { color: "red", size: "1", children: we(o, n) }),
|
|
636
|
+
a.description && /* @__PURE__ */ i(h, { size: "1", color: "gray", children: a.description })
|
|
632
637
|
] }) });
|
|
633
|
-
},
|
|
638
|
+
}, nn = pe(rn), on = te(
|
|
634
639
|
3,
|
|
635
|
-
|
|
640
|
+
Me((e) => {
|
|
636
641
|
const r = e["x-search"];
|
|
637
642
|
return (e.type === "string" || e.type === "object") && typeof (r == null ? void 0 : r.service) == "string" && r.service !== "";
|
|
638
643
|
})
|
|
639
|
-
),
|
|
644
|
+
), sn = (e) => {
|
|
645
|
+
if (e)
|
|
646
|
+
return /^\d{2}:\d{2}$/.test(e) ? `${e}:00` : e;
|
|
647
|
+
}, wt = (e, r) => {
|
|
648
|
+
if (!e) return "";
|
|
649
|
+
const t = e.match(/^(\d{2}:\d{2})(:\d{2})?/);
|
|
650
|
+
return t ? r ? `${t[1]}${t[2] ?? ":00"}` : t[1] : e;
|
|
651
|
+
}, ln = (e, r) => Ht(`${e}T${r}`).format(), an = ({ path: e, label: r, required: t, errors: n, description: l, children: o }) => {
|
|
640
652
|
const s = n.length === 0;
|
|
641
|
-
return /* @__PURE__ */ i(
|
|
642
|
-
/* @__PURE__ */ y(
|
|
653
|
+
return /* @__PURE__ */ i(k, { mb: "4", children: /* @__PURE__ */ y(F, { direction: "column", gap: "1", children: [
|
|
654
|
+
/* @__PURE__ */ y(h, { as: "label", size: "2", weight: "bold", htmlFor: e, children: [
|
|
643
655
|
r,
|
|
644
656
|
" ",
|
|
645
|
-
t && /* @__PURE__ */ i(
|
|
657
|
+
t && /* @__PURE__ */ i(h, { color: "red", children: "*" })
|
|
646
658
|
] }),
|
|
647
659
|
o,
|
|
648
|
-
!s && /* @__PURE__ */ i(
|
|
649
|
-
l && /* @__PURE__ */ i(
|
|
660
|
+
!s && /* @__PURE__ */ i(h, { color: "red", size: "1", children: we(n, r) }),
|
|
661
|
+
l && /* @__PURE__ */ i(h, { size: "1", color: "gray", children: l })
|
|
650
662
|
] }) });
|
|
651
|
-
},
|
|
663
|
+
}, cn = ({
|
|
652
664
|
data: e,
|
|
653
665
|
handleChange: r,
|
|
654
666
|
path: t,
|
|
@@ -656,63 +668,67 @@ const _r = {
|
|
|
656
668
|
required: l,
|
|
657
669
|
errors: o,
|
|
658
670
|
schema: s,
|
|
659
|
-
|
|
660
|
-
|
|
671
|
+
uischema: u,
|
|
672
|
+
enabled: a,
|
|
673
|
+
visible: c = !0
|
|
661
674
|
}) => {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
675
|
+
var I;
|
|
676
|
+
if (me(() => {
|
|
677
|
+
c === !1 && r(t, void 0);
|
|
678
|
+
}, [c, t, r]), c === !1)
|
|
665
679
|
return null;
|
|
666
|
-
const d = o.length === 0,
|
|
680
|
+
const d = o.length === 0, f = typeof e == "string" ? e : "", p = ((I = u == null ? void 0 : u.options) == null ? void 0 : I.showSeconds) === !0, g = p ? 1 : 60, b = (A) => /* @__PURE__ */ i(an, { path: t, label: n, required: l, errors: o, description: s.description, children: A });
|
|
667
681
|
if (s.format === "time")
|
|
668
|
-
return
|
|
682
|
+
return b(
|
|
669
683
|
/* @__PURE__ */ i(
|
|
670
|
-
|
|
684
|
+
Oe.Root,
|
|
671
685
|
{
|
|
672
686
|
type: "time",
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
687
|
+
step: g,
|
|
688
|
+
value: wt(f, p),
|
|
689
|
+
onChange: (A) => r(t, sn(A.target.value)),
|
|
690
|
+
disabled: !a,
|
|
676
691
|
color: d ? void 0 : "red",
|
|
677
692
|
id: t
|
|
678
693
|
}
|
|
679
694
|
)
|
|
680
695
|
);
|
|
681
|
-
const
|
|
682
|
-
if (!
|
|
696
|
+
const M = s.format === "date-time", [N = "", U = ""] = f.split("T"), T = wt(U, p), R = (A, D) => {
|
|
697
|
+
if (!A) {
|
|
683
698
|
r(t, void 0);
|
|
684
699
|
return;
|
|
685
700
|
}
|
|
686
|
-
r(t,
|
|
701
|
+
r(t, M ? ln(A, D || "00:00") : A);
|
|
687
702
|
};
|
|
688
|
-
return
|
|
689
|
-
/* @__PURE__ */ y(
|
|
703
|
+
return b(
|
|
704
|
+
/* @__PURE__ */ y(F, { gap: "2", align: "center", children: [
|
|
690
705
|
/* @__PURE__ */ i(
|
|
691
|
-
|
|
706
|
+
Oe.Root,
|
|
692
707
|
{
|
|
693
708
|
type: "date",
|
|
694
|
-
value:
|
|
695
|
-
disabled: !
|
|
709
|
+
value: N,
|
|
710
|
+
disabled: !a,
|
|
696
711
|
color: d ? void 0 : "red",
|
|
697
|
-
onChange: (
|
|
712
|
+
onChange: (A) => R(A.target.value, T),
|
|
698
713
|
id: t,
|
|
699
714
|
style: { flex: 1 }
|
|
700
715
|
}
|
|
701
716
|
),
|
|
702
|
-
|
|
703
|
-
|
|
717
|
+
M && /* @__PURE__ */ i(
|
|
718
|
+
Oe.Root,
|
|
704
719
|
{
|
|
705
720
|
type: "time",
|
|
706
|
-
|
|
707
|
-
|
|
721
|
+
step: g,
|
|
722
|
+
value: T,
|
|
723
|
+
disabled: !a || !N,
|
|
708
724
|
color: d ? void 0 : "red",
|
|
709
|
-
onChange: (
|
|
725
|
+
onChange: (A) => R(N, A.target.value),
|
|
710
726
|
style: { flex: 1 }
|
|
711
727
|
}
|
|
712
728
|
)
|
|
713
729
|
] })
|
|
714
730
|
);
|
|
715
|
-
},
|
|
731
|
+
}, un = te(2, tt(br, vr, wr)), dn = pe(cn), fn = ({
|
|
716
732
|
uischema: e,
|
|
717
733
|
schema: r,
|
|
718
734
|
path: t,
|
|
@@ -722,19 +738,19 @@ const _r = {
|
|
|
722
738
|
visible: s = !0
|
|
723
739
|
}) => {
|
|
724
740
|
const a = e.elements;
|
|
725
|
-
return s === !1 ? null : /* @__PURE__ */ i(
|
|
726
|
-
|
|
741
|
+
return s === !1 ? null : /* @__PURE__ */ i(F, { direction: "column", gap: "4", children: a.map((c, d) => /* @__PURE__ */ i(
|
|
742
|
+
Ye,
|
|
727
743
|
{
|
|
728
|
-
uischema:
|
|
744
|
+
uischema: c,
|
|
729
745
|
schema: r,
|
|
730
746
|
path: t,
|
|
731
747
|
renderers: n,
|
|
732
748
|
cells: l,
|
|
733
749
|
enabled: o
|
|
734
750
|
},
|
|
735
|
-
`${t}-${
|
|
751
|
+
`${t}-${d}`
|
|
736
752
|
)) });
|
|
737
|
-
},
|
|
753
|
+
}, pn = te(1, Xe("VerticalLayout")), hn = ({
|
|
738
754
|
uischema: e,
|
|
739
755
|
schema: r,
|
|
740
756
|
path: t,
|
|
@@ -744,18 +760,18 @@ const _r = {
|
|
|
744
760
|
visible: s = !0
|
|
745
761
|
}) => {
|
|
746
762
|
const a = e.elements;
|
|
747
|
-
return s === !1 ? null : /* @__PURE__ */ i(
|
|
748
|
-
|
|
763
|
+
return s === !1 ? null : /* @__PURE__ */ i(F, { direction: "row", gap: "4", children: a.map((c, d) => /* @__PURE__ */ i(k, { style: { flex: 1 }, children: /* @__PURE__ */ i(
|
|
764
|
+
Ye,
|
|
749
765
|
{
|
|
750
|
-
uischema:
|
|
766
|
+
uischema: c,
|
|
751
767
|
schema: r,
|
|
752
768
|
path: t,
|
|
753
769
|
renderers: n,
|
|
754
770
|
cells: l,
|
|
755
771
|
enabled: o
|
|
756
772
|
}
|
|
757
|
-
) }, `${t}-${
|
|
758
|
-
},
|
|
773
|
+
) }, `${t}-${d}`)) });
|
|
774
|
+
}, mn = te(1, Xe("HorizontalLayout")), gn = ({
|
|
759
775
|
uischema: e,
|
|
760
776
|
schema: r,
|
|
761
777
|
path: t,
|
|
@@ -764,23 +780,23 @@ const _r = {
|
|
|
764
780
|
enabled: o,
|
|
765
781
|
visible: s = !0
|
|
766
782
|
}) => {
|
|
767
|
-
const
|
|
768
|
-
return s === !1 ? null : /* @__PURE__ */ y(
|
|
769
|
-
|
|
770
|
-
/* @__PURE__ */ i(
|
|
771
|
-
|
|
783
|
+
const u = e, a = u.elements;
|
|
784
|
+
return s === !1 ? null : /* @__PURE__ */ y(k, { mb: "6", children: [
|
|
785
|
+
u.label && /* @__PURE__ */ i(_t, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: u.label }),
|
|
786
|
+
/* @__PURE__ */ i(F, { direction: "column", gap: "4", children: a.map((c, d) => /* @__PURE__ */ i(
|
|
787
|
+
Ye,
|
|
772
788
|
{
|
|
773
|
-
uischema:
|
|
789
|
+
uischema: c,
|
|
774
790
|
schema: r,
|
|
775
791
|
path: t,
|
|
776
792
|
renderers: n,
|
|
777
793
|
cells: l,
|
|
778
794
|
enabled: o
|
|
779
795
|
},
|
|
780
|
-
`${t}-${
|
|
796
|
+
`${t}-${d}`
|
|
781
797
|
)) })
|
|
782
798
|
] });
|
|
783
|
-
},
|
|
799
|
+
}, yn = te(1, Xe("Group")), bn = ({
|
|
784
800
|
uischema: e,
|
|
785
801
|
schema: r,
|
|
786
802
|
path: t,
|
|
@@ -790,29 +806,29 @@ const _r = {
|
|
|
790
806
|
visible: s = !0
|
|
791
807
|
}) => {
|
|
792
808
|
var p;
|
|
793
|
-
const a = e.elements.filter((g) => g.type === "Category"), [
|
|
809
|
+
const a = e.elements.filter((g) => g.type === "Category"), [c, d] = j(((p = a[0]) == null ? void 0 : p.label) || "");
|
|
794
810
|
if (s === !1 || !a.length) return null;
|
|
795
|
-
const
|
|
796
|
-
return /* @__PURE__ */ y(
|
|
797
|
-
/* @__PURE__ */ i(
|
|
798
|
-
/* @__PURE__ */ i(
|
|
799
|
-
|
|
811
|
+
const f = a.find((g) => g.label === c) ? c : a[0].label;
|
|
812
|
+
return /* @__PURE__ */ y(Je.Root, { value: f, onValueChange: d, children: [
|
|
813
|
+
/* @__PURE__ */ i(Je.List, { children: a.map((g, b) => /* @__PURE__ */ i(Je.Trigger, { value: g.label, children: g.label }, `${t}-${b}`)) }),
|
|
814
|
+
/* @__PURE__ */ i(k, { pt: "3", children: a.map((g, b) => /* @__PURE__ */ i(Je.Content, { value: g.label, children: /* @__PURE__ */ i(F, { direction: "column", gap: "4", children: g.elements.map((M, N) => /* @__PURE__ */ i(
|
|
815
|
+
Ye,
|
|
800
816
|
{
|
|
801
|
-
uischema:
|
|
817
|
+
uischema: M,
|
|
802
818
|
schema: r,
|
|
803
819
|
path: t,
|
|
804
820
|
renderers: n,
|
|
805
821
|
cells: l,
|
|
806
822
|
enabled: o
|
|
807
823
|
},
|
|
808
|
-
`${t}-${b}-${
|
|
824
|
+
`${t}-${b}-${N}`
|
|
809
825
|
)) }) }, `${t}-${b}`)) })
|
|
810
826
|
] });
|
|
811
|
-
},
|
|
812
|
-
function
|
|
827
|
+
}, vn = te(1, Xe("Categorization"));
|
|
828
|
+
function xe(e) {
|
|
813
829
|
return e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(0)} MB` : e >= 1024 ? `${(e / 1024).toFixed(0)} KB` : `${e} B`;
|
|
814
830
|
}
|
|
815
|
-
function
|
|
831
|
+
function Ae(e) {
|
|
816
832
|
const r = e.split(",").map((o) => o.trim()).filter(Boolean), t = r.filter((o) => o.startsWith(".")), l = (t.length > 0 ? t : r).map((o) => {
|
|
817
833
|
if (o.endsWith("/*")) return o.split("/")[0].toUpperCase() + "S";
|
|
818
834
|
if (o.startsWith(".")) return o.slice(1).toUpperCase();
|
|
@@ -821,10 +837,50 @@ function we(e) {
|
|
|
821
837
|
});
|
|
822
838
|
return [...new Set(l)].join(", ");
|
|
823
839
|
}
|
|
824
|
-
|
|
840
|
+
const wn = "image/png,image/jpeg,image/gif,image/webp,application/pdf,text/html,text/plain,.png,.jpg,.jpeg,.gif,.webp,.pdf,.html,.htm,.txt";
|
|
841
|
+
function Yt(e, r) {
|
|
842
|
+
return r.split(",").map((n) => n.trim()).filter(Boolean).some((n) => n === "*" || n === "*/*" ? !0 : n.endsWith("/*") ? (e.type ?? "").startsWith(n.slice(0, -1)) : n.startsWith(".") ? e.name.toLowerCase().endsWith(n.toLowerCase()) : e.type === n);
|
|
843
|
+
}
|
|
844
|
+
function En(e) {
|
|
845
|
+
const r = !!e.type, t = it(e.name) !== void 0;
|
|
846
|
+
return !r && !t ? !0 : Yt(e, wn);
|
|
847
|
+
}
|
|
848
|
+
function it(e) {
|
|
849
|
+
const r = e.split(/[/\\]/).pop() ?? e, t = r.lastIndexOf(".");
|
|
850
|
+
if (!(t <= 0 || t === r.length - 1))
|
|
851
|
+
return r.slice(t);
|
|
852
|
+
}
|
|
853
|
+
function Tn(e, r, t) {
|
|
854
|
+
Kt(new Blob([e], { type: t }), r);
|
|
855
|
+
}
|
|
856
|
+
function Kt(e, r) {
|
|
857
|
+
const t = URL.createObjectURL(e), n = document.createElement("a");
|
|
858
|
+
n.href = t, n.download = r, n.click(), setTimeout(() => URL.revokeObjectURL(t), 0);
|
|
859
|
+
}
|
|
860
|
+
async function xn(e, r) {
|
|
861
|
+
const t = await fetch(e);
|
|
862
|
+
if (!t.ok) throw new Error(`Download failed (${t.status})`);
|
|
863
|
+
Kt(await t.blob(), r);
|
|
864
|
+
}
|
|
865
|
+
function An(e, r, t) {
|
|
866
|
+
const n = t.name || t.key;
|
|
867
|
+
if (!e) return n;
|
|
868
|
+
const l = ft(e, r, n), o = it(t.name ?? "") ?? it(t.key);
|
|
869
|
+
return !o || l.toLowerCase().endsWith(o.toLowerCase()) ? l : `${l}${o}`;
|
|
870
|
+
}
|
|
871
|
+
const Rn = /* @__PURE__ */ new Set(["/", "\\", "<", ">", ":", '"', "|", "?", "*"]), Cn = (e) => Rn.has(e) || e.charCodeAt(0) < 32 || e.charCodeAt(0) === 127;
|
|
872
|
+
function Sn(e, r) {
|
|
873
|
+
const t = Array.from(e, (n) => Cn(n) ? "_" : n).join("").trim();
|
|
874
|
+
return t === "" || t.startsWith(".") ? r : t;
|
|
875
|
+
}
|
|
876
|
+
function ft(e, r, t) {
|
|
877
|
+
const n = r !== null && typeof r == "object" && !Array.isArray(r) ? r : {};
|
|
878
|
+
return Sn(rt(e, n), t);
|
|
879
|
+
}
|
|
880
|
+
function On(e) {
|
|
825
881
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
826
882
|
}
|
|
827
|
-
const
|
|
883
|
+
const Nn = ({
|
|
828
884
|
data: e,
|
|
829
885
|
handleChange: r,
|
|
830
886
|
path: t,
|
|
@@ -832,184 +888,248 @@ const on = ({
|
|
|
832
888
|
required: l,
|
|
833
889
|
uischema: o,
|
|
834
890
|
schema: s,
|
|
835
|
-
enabled:
|
|
891
|
+
enabled: u,
|
|
836
892
|
errors: a,
|
|
837
|
-
visible:
|
|
893
|
+
visible: c = !0
|
|
838
894
|
}) => {
|
|
839
|
-
const
|
|
840
|
-
|
|
841
|
-
const
|
|
842
|
-
|
|
843
|
-
|
|
895
|
+
const d = Lr();
|
|
896
|
+
Re(c, t, r);
|
|
897
|
+
const f = !a || a.length === 0, p = (s == null ? void 0 : s["x-file"]) ?? {}, g = (o == null ? void 0 : o.options) ?? {}, b = p.maxFiles ?? g.maxFiles ?? 1, M = p.maxSize ?? g.maxSize ?? 5 * 1024 * 1024, N = p.accept ?? g.accept ?? "image/*,application/pdf", U = typeof p.fileName == "string" ? p.fileName : void 0, T = b > 1, R = u !== !1, [I, A] = j(!1), [D, z] = j(null), [V, v] = j({}), [x, re] = j({}), X = ue(/* @__PURE__ */ new Set()), Y = ue(null), L = On(e), O = L.length >= b, G = (m) => {
|
|
898
|
+
const w = x[m];
|
|
899
|
+
return { name: (w == null ? void 0 : w.name) ?? m, type: w == null ? void 0 : w.type };
|
|
900
|
+
}, Q = async (m) => {
|
|
901
|
+
var B, q;
|
|
902
|
+
const w = (B = x[m]) == null ? void 0 : B.blobUrl;
|
|
903
|
+
if (w) return w;
|
|
904
|
+
const $ = await ((q = d == null ? void 0 : d.getDownloadUrl) == null ? void 0 : q.call(d, m));
|
|
905
|
+
return $ == null ? void 0 : $.url;
|
|
906
|
+
}, de = (m, w) => {
|
|
907
|
+
v(($) => ({ ...$, [m]: w }));
|
|
908
|
+
}, ne = (m) => {
|
|
909
|
+
v((w) => {
|
|
910
|
+
if (!w[m]) return w;
|
|
911
|
+
const $ = { ...w };
|
|
912
|
+
return delete $[m], $;
|
|
913
|
+
});
|
|
914
|
+
};
|
|
915
|
+
me(() => () => {
|
|
916
|
+
X.current.forEach((m) => URL.revokeObjectURL(m)), X.current.clear();
|
|
844
917
|
}, []);
|
|
845
|
-
const
|
|
918
|
+
const Ne = $e(
|
|
846
919
|
async (m) => {
|
|
847
|
-
if (
|
|
848
|
-
|
|
920
|
+
if (z(null), L.length >= b) {
|
|
921
|
+
z(`Maximum ${b} file${b > 1 ? "s" : ""} allowed.`);
|
|
849
922
|
return;
|
|
850
923
|
}
|
|
851
|
-
if (m.size >
|
|
852
|
-
|
|
924
|
+
if (m.size > M) {
|
|
925
|
+
z(`File exceeds the ${xe(M)} limit.`);
|
|
853
926
|
return;
|
|
854
927
|
}
|
|
855
|
-
if (!
|
|
856
|
-
|
|
928
|
+
if (!Yt(m, N)) {
|
|
929
|
+
z(`Invalid type. Accepted: ${Ae(N)}`);
|
|
857
930
|
return;
|
|
858
931
|
}
|
|
859
|
-
if (!(
|
|
860
|
-
|
|
932
|
+
if (!(d != null && d.onUpload)) {
|
|
933
|
+
z("Upload service not configured.");
|
|
861
934
|
return;
|
|
862
935
|
}
|
|
863
936
|
try {
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
const
|
|
867
|
-
|
|
868
|
-
|
|
937
|
+
const w = await d.onUpload(m), $ = URL.createObjectURL(m);
|
|
938
|
+
X.current.add($);
|
|
939
|
+
const B = {
|
|
940
|
+
key: w.key,
|
|
941
|
+
name: w.name ?? m.name,
|
|
942
|
+
type: m.type || void 0,
|
|
943
|
+
blobUrl: $
|
|
944
|
+
};
|
|
945
|
+
re((J) => ({ ...J, [w.key]: B }));
|
|
946
|
+
const q = [...L, w.key];
|
|
869
947
|
r(t, T ? q : q[0]);
|
|
870
948
|
} catch {
|
|
871
|
-
|
|
949
|
+
z("Upload failed. Please try again."), Y.current && (Y.current.value = "");
|
|
872
950
|
}
|
|
873
951
|
},
|
|
874
|
-
[
|
|
952
|
+
[L, b, M, N, d, t, r, T]
|
|
875
953
|
);
|
|
876
|
-
if (
|
|
954
|
+
if (c === !1)
|
|
877
955
|
return null;
|
|
878
|
-
const
|
|
879
|
-
m.preventDefault(), m.stopPropagation(), !(!
|
|
880
|
-
},
|
|
881
|
-
var
|
|
882
|
-
m.preventDefault(), m.stopPropagation(),
|
|
883
|
-
},
|
|
884
|
-
var
|
|
885
|
-
(
|
|
886
|
-
},
|
|
887
|
-
if (!
|
|
888
|
-
|
|
889
|
-
var
|
|
890
|
-
const
|
|
891
|
-
return
|
|
892
|
-
});
|
|
893
|
-
const
|
|
894
|
-
r(t, T ?
|
|
895
|
-
},
|
|
896
|
-
var
|
|
897
|
-
m.preventDefault();
|
|
898
|
-
const
|
|
899
|
-
if (
|
|
900
|
-
(
|
|
956
|
+
const S = (m) => {
|
|
957
|
+
m.preventDefault(), m.stopPropagation(), !(!R || O) && A(m.type === "dragenter" || m.type === "dragover");
|
|
958
|
+
}, K = (m) => {
|
|
959
|
+
var w;
|
|
960
|
+
m.preventDefault(), m.stopPropagation(), A(!1), !(!R || O) && (w = m.dataTransfer.files) != null && w[0] && Ne(m.dataTransfer.files[0]);
|
|
961
|
+
}, fe = (m) => {
|
|
962
|
+
var w;
|
|
963
|
+
(w = m.target.files) != null && w[0] && (Ne(m.target.files[0]), m.target.value = "");
|
|
964
|
+
}, Ee = (m) => {
|
|
965
|
+
if (!R) return;
|
|
966
|
+
re(($) => {
|
|
967
|
+
var J;
|
|
968
|
+
const B = { ...$ }, q = (J = B[m]) == null ? void 0 : J.blobUrl;
|
|
969
|
+
return q && (URL.revokeObjectURL(q), X.current.delete(q)), delete B[m], B;
|
|
970
|
+
}), ne(m);
|
|
971
|
+
const w = L.filter(($) => $ !== m);
|
|
972
|
+
r(t, T ? w.length > 0 ? w : void 0 : w[0]);
|
|
973
|
+
}, ee = async (m, w) => {
|
|
974
|
+
var q, J;
|
|
975
|
+
m.preventDefault(), ne(w);
|
|
976
|
+
const $ = (q = x[w]) == null ? void 0 : q.blobUrl;
|
|
977
|
+
if ($) {
|
|
978
|
+
(J = window.open($, "_blank", "noopener,noreferrer")) == null || J.focus();
|
|
901
979
|
return;
|
|
902
980
|
}
|
|
903
|
-
const
|
|
904
|
-
if (
|
|
981
|
+
const B = window.open("", "_blank");
|
|
982
|
+
if (B)
|
|
905
983
|
try {
|
|
906
|
-
const
|
|
907
|
-
|
|
984
|
+
const C = await Q(w);
|
|
985
|
+
C ? B.location.href = C : (B.close(), de(w, "Unable to open file."));
|
|
908
986
|
} catch {
|
|
909
|
-
|
|
987
|
+
B.close(), de(w, "Unable to open file.");
|
|
988
|
+
}
|
|
989
|
+
}, ge = async (m, w) => {
|
|
990
|
+
ne(m);
|
|
991
|
+
try {
|
|
992
|
+
const $ = await Q(m);
|
|
993
|
+
if (!$) {
|
|
994
|
+
de(m, "Unable to download file.");
|
|
995
|
+
return;
|
|
910
996
|
}
|
|
997
|
+
await xn($, w);
|
|
998
|
+
} catch {
|
|
999
|
+
de(m, "Unable to download file.");
|
|
1000
|
+
}
|
|
911
1001
|
};
|
|
912
|
-
if (!
|
|
913
|
-
const
|
|
914
|
-
return /* @__PURE__ */ y(
|
|
915
|
-
/* @__PURE__ */ y(
|
|
916
|
-
/* @__PURE__ */ y(
|
|
1002
|
+
if (!R && L.length === 0) return null;
|
|
1003
|
+
const ie = b - L.length, Te = R && !O;
|
|
1004
|
+
return /* @__PURE__ */ y(k, { mb: "4", children: [
|
|
1005
|
+
/* @__PURE__ */ y(F, { align: "center", justify: "between", mb: "2", children: [
|
|
1006
|
+
/* @__PURE__ */ y(h, { as: "label", size: "2", weight: "bold", children: [
|
|
917
1007
|
n,
|
|
918
|
-
l && /* @__PURE__ */ i(
|
|
1008
|
+
l && /* @__PURE__ */ i(h, { color: "red", children: " *" })
|
|
919
1009
|
] }),
|
|
920
|
-
/* @__PURE__ */ i(
|
|
1010
|
+
/* @__PURE__ */ i(h, { size: "1", color: "gray", children: T ? `Up to ${b} files · ${xe(M)} each · ${Ae(N)}` : `${xe(M)} · ${Ae(N)}` })
|
|
921
1011
|
] }),
|
|
922
|
-
|
|
923
|
-
var
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
{
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1012
|
+
L.map((m, w) => {
|
|
1013
|
+
var H;
|
|
1014
|
+
const $ = w + 1, B = (H = x[m]) == null ? void 0 : H.name, q = An(U, { index: $ }, { name: B, key: m }), J = U ? q : B ?? "Uploaded File", C = !!(U && B), P = V[m], se = En(G(m));
|
|
1015
|
+
return /* @__PURE__ */ y(jt, { size: "2", variant: "surface", mb: "2", children: [
|
|
1016
|
+
/* @__PURE__ */ y(F, { align: "center", gap: "3", children: [
|
|
1017
|
+
/* @__PURE__ */ i(
|
|
1018
|
+
k,
|
|
1019
|
+
{
|
|
1020
|
+
style: {
|
|
1021
|
+
background: "var(--blue-3)",
|
|
1022
|
+
padding: 8,
|
|
1023
|
+
borderRadius: 6,
|
|
1024
|
+
color: "var(--blue-9)",
|
|
1025
|
+
flexShrink: 0
|
|
1026
|
+
},
|
|
1027
|
+
children: /* @__PURE__ */ i(Nr, { width: "20", height: "20" })
|
|
1028
|
+
}
|
|
1029
|
+
),
|
|
1030
|
+
/* @__PURE__ */ y(k, { style: { flex: 1, overflow: "hidden" }, children: [
|
|
1031
|
+
/* @__PURE__ */ i(
|
|
1032
|
+
h,
|
|
1033
|
+
{
|
|
1034
|
+
size: "2",
|
|
1035
|
+
weight: "bold",
|
|
1036
|
+
style: {
|
|
1037
|
+
display: "block",
|
|
1038
|
+
overflow: "hidden",
|
|
1039
|
+
textOverflow: "ellipsis",
|
|
1040
|
+
whiteSpace: "nowrap"
|
|
1041
|
+
},
|
|
1042
|
+
children: J
|
|
1043
|
+
}
|
|
1044
|
+
),
|
|
1045
|
+
C && /* @__PURE__ */ i(
|
|
1046
|
+
h,
|
|
1047
|
+
{
|
|
1048
|
+
size: "1",
|
|
1049
|
+
color: "gray",
|
|
1050
|
+
style: {
|
|
1051
|
+
display: "block",
|
|
1052
|
+
overflow: "hidden",
|
|
1053
|
+
textOverflow: "ellipsis",
|
|
1054
|
+
whiteSpace: "nowrap"
|
|
1055
|
+
},
|
|
1056
|
+
children: B
|
|
1057
|
+
}
|
|
1058
|
+
)
|
|
1059
|
+
] }),
|
|
1060
|
+
/* @__PURE__ */ y(F, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
|
|
1061
|
+
se && /* @__PURE__ */ i(ze, { variant: "soft", color: "blue", size: "1", onClick: (_) => void ee(_, m), children: "View" }),
|
|
1062
|
+
/* @__PURE__ */ i(Be, { content: "Download", children: /* @__PURE__ */ i(
|
|
1063
|
+
je,
|
|
1064
|
+
{
|
|
1065
|
+
variant: "ghost",
|
|
1066
|
+
color: "gray",
|
|
1067
|
+
"aria-label": "Download",
|
|
1068
|
+
onClick: () => void ge(m, q),
|
|
1069
|
+
children: /* @__PURE__ */ i(at, {})
|
|
1070
|
+
}
|
|
1071
|
+
) }),
|
|
1072
|
+
/* @__PURE__ */ i(Dr, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
|
|
1073
|
+
R && /* @__PURE__ */ i(je, { variant: "ghost", color: "gray", onClick: () => Ee(m), children: /* @__PURE__ */ i(ct, {}) })
|
|
1074
|
+
] })
|
|
1075
|
+
] }),
|
|
1076
|
+
P && /* @__PURE__ */ i(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: P })
|
|
1077
|
+
] }, m);
|
|
958
1078
|
}),
|
|
959
|
-
|
|
1079
|
+
Te && /* @__PURE__ */ y(
|
|
960
1080
|
"div",
|
|
961
1081
|
{
|
|
962
1082
|
role: "button",
|
|
963
1083
|
tabIndex: 0,
|
|
964
1084
|
onClick: () => {
|
|
965
1085
|
var m;
|
|
966
|
-
return (m =
|
|
1086
|
+
return (m = Y.current) == null ? void 0 : m.click();
|
|
967
1087
|
},
|
|
968
1088
|
onKeyDown: (m) => {
|
|
969
|
-
var
|
|
970
|
-
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), (
|
|
1089
|
+
var w;
|
|
1090
|
+
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), (w = Y.current) == null || w.click());
|
|
971
1091
|
},
|
|
972
|
-
onDragEnter:
|
|
973
|
-
onDragLeave:
|
|
974
|
-
onDragOver:
|
|
975
|
-
onDrop:
|
|
1092
|
+
onDragEnter: S,
|
|
1093
|
+
onDragLeave: S,
|
|
1094
|
+
onDragOver: S,
|
|
1095
|
+
onDrop: K,
|
|
976
1096
|
style: { cursor: "pointer" },
|
|
977
1097
|
className: [
|
|
978
1098
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
979
1099
|
"transition-all duration-200 ease-in-out",
|
|
980
|
-
|
|
1100
|
+
I ? "border-blue-500 bg-blue-50" : D ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
981
1101
|
].join(" "),
|
|
982
1102
|
children: [
|
|
983
|
-
/* @__PURE__ */ i("input", { ref:
|
|
984
|
-
/* @__PURE__ */ i(
|
|
985
|
-
/* @__PURE__ */ i(
|
|
986
|
-
/* @__PURE__ */ i(
|
|
987
|
-
/* @__PURE__ */ i(
|
|
988
|
-
] }) : /* @__PURE__ */ y(
|
|
989
|
-
/* @__PURE__ */ i(
|
|
990
|
-
/* @__PURE__ */ i(
|
|
991
|
-
/* @__PURE__ */ y(
|
|
992
|
-
|
|
1103
|
+
/* @__PURE__ */ i("input", { ref: Y, type: "file", style: { display: "none" }, accept: N, onChange: fe }),
|
|
1104
|
+
/* @__PURE__ */ i(F, { direction: "column", align: "center", gap: "2", children: D ? /* @__PURE__ */ y(ve, { children: [
|
|
1105
|
+
/* @__PURE__ */ i(ut, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
1106
|
+
/* @__PURE__ */ i(h, { size: "2", color: "red", weight: "medium", children: D }),
|
|
1107
|
+
/* @__PURE__ */ i(h, { size: "1", color: "gray", children: "Click to try again" })
|
|
1108
|
+
] }) : /* @__PURE__ */ y(ve, { children: [
|
|
1109
|
+
/* @__PURE__ */ i(Ue, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
1110
|
+
/* @__PURE__ */ i(h, { size: "2", weight: "medium", children: L.length > 0 ? `Add another file (${ie} remaining)` : "Click to upload or drag and drop" }),
|
|
1111
|
+
/* @__PURE__ */ y(h, { size: "1", color: "gray", children: [
|
|
1112
|
+
xe(M),
|
|
993
1113
|
" max · ",
|
|
994
|
-
|
|
1114
|
+
Ae(N)
|
|
995
1115
|
] })
|
|
996
1116
|
] }) })
|
|
997
1117
|
]
|
|
998
1118
|
}
|
|
999
1119
|
),
|
|
1000
|
-
|
|
1120
|
+
R && O && T && /* @__PURE__ */ y(h, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
|
|
1001
1121
|
"Maximum ",
|
|
1002
1122
|
b,
|
|
1003
1123
|
" files uploaded. Remove one to replace it."
|
|
1004
1124
|
] }),
|
|
1005
|
-
!
|
|
1125
|
+
!f && /* @__PURE__ */ i(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: we(a, n) })
|
|
1006
1126
|
] });
|
|
1007
|
-
},
|
|
1127
|
+
}, Dn = pe(Nn), In = te(
|
|
1008
1128
|
10,
|
|
1009
1129
|
// high rank to beat default array renderer
|
|
1010
|
-
|
|
1130
|
+
$t(
|
|
1011
1131
|
// Match both single-file (type: string) and multi-file (type: array)
|
|
1012
|
-
|
|
1132
|
+
Me((e) => {
|
|
1013
1133
|
if (e.type === "string" && e.format === "file") return !0;
|
|
1014
1134
|
if (e.type === "array") {
|
|
1015
1135
|
const r = e.items;
|
|
@@ -1019,27 +1139,27 @@ const on = ({
|
|
|
1019
1139
|
})
|
|
1020
1140
|
)
|
|
1021
1141
|
);
|
|
1022
|
-
function
|
|
1142
|
+
function Gt(e, r) {
|
|
1023
1143
|
return e !== !1 && r !== !0;
|
|
1024
1144
|
}
|
|
1025
|
-
class
|
|
1145
|
+
class st extends Error {
|
|
1026
1146
|
}
|
|
1027
|
-
async function
|
|
1147
|
+
async function kn(e, r) {
|
|
1028
1148
|
const { read: t, utils: n } = await import("@e965/xlsx"), l = t(e, { type: "array", cellDates: !0 });
|
|
1029
1149
|
if (l.SheetNames.length === 0)
|
|
1030
|
-
throw new
|
|
1150
|
+
throw new st("This file has no sheets.");
|
|
1031
1151
|
const o = r ?? l.SheetNames[0], s = l.Sheets[o];
|
|
1032
1152
|
if (!s)
|
|
1033
|
-
throw new
|
|
1034
|
-
const
|
|
1153
|
+
throw new st(`This file doesn't have a sheet named "${o}".`);
|
|
1154
|
+
const u = n.sheet_to_json(s, { header: 1, raw: !0, defval: null });
|
|
1035
1155
|
return {
|
|
1036
1156
|
sheetName: o,
|
|
1037
|
-
matrix:
|
|
1038
|
-
rowCount:
|
|
1039
|
-
colCount: Math.max(0, ...
|
|
1157
|
+
matrix: u,
|
|
1158
|
+
rowCount: u.length,
|
|
1159
|
+
colCount: Math.max(0, ...u.map((a) => a.length))
|
|
1040
1160
|
};
|
|
1041
1161
|
}
|
|
1042
|
-
function
|
|
1162
|
+
function Ln(e) {
|
|
1043
1163
|
let r = e + 1, t = "";
|
|
1044
1164
|
for (; r > 0; ) {
|
|
1045
1165
|
const n = (r - 1) % 26;
|
|
@@ -1050,11 +1170,11 @@ function an(e) {
|
|
|
1050
1170
|
class ce extends Error {
|
|
1051
1171
|
constructor(t, n) {
|
|
1052
1172
|
super(n ?? t);
|
|
1053
|
-
|
|
1173
|
+
gt(this, "code");
|
|
1054
1174
|
this.code = t, this.name = "FormulaError";
|
|
1055
1175
|
}
|
|
1056
1176
|
}
|
|
1057
|
-
const
|
|
1177
|
+
const Mn = [
|
|
1058
1178
|
// Logical
|
|
1059
1179
|
// IF is excluded here even though its native body is real, non-stub code —
|
|
1060
1180
|
// see LOGICAL_FUNCTIONS_WITH_BROKEN_CONDITION_COERCION below for why it's
|
|
@@ -1080,7 +1200,7 @@ const un = [
|
|
|
1080
1200
|
// DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL.
|
|
1081
1201
|
"DATE",
|
|
1082
1202
|
"TODAY"
|
|
1083
|
-
],
|
|
1203
|
+
], zn = [
|
|
1084
1204
|
"MAX",
|
|
1085
1205
|
"MIN",
|
|
1086
1206
|
"MAXA",
|
|
@@ -1099,7 +1219,7 @@ const un = [
|
|
|
1099
1219
|
"COUNTA",
|
|
1100
1220
|
// not present in fast-formula-parser's function table at all.
|
|
1101
1221
|
"UPPER"
|
|
1102
|
-
],
|
|
1222
|
+
], Fn = ["YEAR", "MONTH", "DAY", "WEEKDAY"], Un = ["IF"], $n = [
|
|
1103
1223
|
"CONCATENATE",
|
|
1104
1224
|
"CONCAT",
|
|
1105
1225
|
"LEN",
|
|
@@ -1110,24 +1230,24 @@ const un = [
|
|
|
1110
1230
|
"MID",
|
|
1111
1231
|
"FIND",
|
|
1112
1232
|
"SEARCH"
|
|
1113
|
-
],
|
|
1114
|
-
...
|
|
1115
|
-
...
|
|
1116
|
-
...
|
|
1117
|
-
|
|
1118
|
-
...
|
|
1119
|
-
]),
|
|
1120
|
-
function
|
|
1121
|
-
const r = e.replace(
|
|
1122
|
-
|
|
1233
|
+
], Pn = /* @__PURE__ */ new Set([
|
|
1234
|
+
...Mn,
|
|
1235
|
+
...zn,
|
|
1236
|
+
...Fn,
|
|
1237
|
+
...$n,
|
|
1238
|
+
...Un
|
|
1239
|
+
]), _n = /"(?:[^"]|"")*"/g, Et = new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(", "g");
|
|
1240
|
+
function jn(e) {
|
|
1241
|
+
const r = e.replace(_n, (n) => " ".repeat(n.length));
|
|
1242
|
+
Et.lastIndex = 0;
|
|
1123
1243
|
let t;
|
|
1124
|
-
for (; (t =
|
|
1244
|
+
for (; (t = Et.exec(r)) !== null; ) {
|
|
1125
1245
|
const n = t[1].toUpperCase();
|
|
1126
|
-
if (!
|
|
1246
|
+
if (!Pn.has(n))
|
|
1127
1247
|
throw new ce("NAME", `Function ${n} is not allowed.`);
|
|
1128
1248
|
}
|
|
1129
1249
|
}
|
|
1130
|
-
function
|
|
1250
|
+
function Vn(e, r, t) {
|
|
1131
1251
|
let n = e;
|
|
1132
1252
|
if (n == null) throw t.NA;
|
|
1133
1253
|
if (typeof n == "object" && !(n instanceof t) && (n = r.retrieveRef(n)), n instanceof t) throw n;
|
|
@@ -1135,54 +1255,54 @@ function bn(e, r, t) {
|
|
|
1135
1255
|
if (typeof n == "number") return n !== 0;
|
|
1136
1256
|
throw t.VALUE;
|
|
1137
1257
|
}
|
|
1138
|
-
function
|
|
1258
|
+
function qt(e) {
|
|
1139
1259
|
return e !== null && typeof e == "object" && "value" in e ? e.value : e;
|
|
1140
1260
|
}
|
|
1141
|
-
function
|
|
1142
|
-
const r =
|
|
1261
|
+
function Le(e) {
|
|
1262
|
+
const r = qt(e);
|
|
1143
1263
|
return Array.isArray(r) ? r.flat(1 / 0) : [r];
|
|
1144
1264
|
}
|
|
1145
1265
|
function W(e) {
|
|
1146
|
-
const r =
|
|
1266
|
+
const r = qt(e);
|
|
1147
1267
|
return Array.isArray(r) ? r.flat(1 / 0)[0] : r;
|
|
1148
1268
|
}
|
|
1149
|
-
function
|
|
1269
|
+
function Ze(e) {
|
|
1150
1270
|
return e === void 0 ? void 0 : W(e);
|
|
1151
1271
|
}
|
|
1152
|
-
function
|
|
1272
|
+
function ae(e) {
|
|
1153
1273
|
return e == null || e === "" ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
1154
1274
|
}
|
|
1155
|
-
function
|
|
1275
|
+
function Hn(e, r) {
|
|
1156
1276
|
return e instanceof r ? e : new r(e.message || "#ERROR!");
|
|
1157
1277
|
}
|
|
1158
|
-
function
|
|
1278
|
+
function oe(e) {
|
|
1159
1279
|
return e.find((r) => r instanceof Error);
|
|
1160
1280
|
}
|
|
1161
|
-
function
|
|
1281
|
+
function Wn(e, r) {
|
|
1162
1282
|
const t = (o) => {
|
|
1163
|
-
throw
|
|
1164
|
-
}, n = (o, { checkArgsForErrors: s = !0 } = {}) => (...
|
|
1165
|
-
const a =
|
|
1283
|
+
throw Hn(o, r);
|
|
1284
|
+
}, n = (o, { checkArgsForErrors: s = !0 } = {}) => (...u) => {
|
|
1285
|
+
const a = u.flatMap(Le);
|
|
1166
1286
|
if (s) {
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1287
|
+
const d = oe(a);
|
|
1288
|
+
d && t(d);
|
|
1169
1289
|
}
|
|
1170
|
-
const
|
|
1290
|
+
const c = o(...a);
|
|
1291
|
+
return c instanceof Error ? t(c) : c;
|
|
1292
|
+
}, l = (o, { toText: s = !1 } = {}) => (u) => {
|
|
1293
|
+
const a = W(u), c = oe([a]);
|
|
1294
|
+
c && t(c);
|
|
1295
|
+
const d = o(s ? ae(a) : a);
|
|
1171
1296
|
return d instanceof Error ? t(d) : d;
|
|
1172
|
-
}, l = (o, { toText: s = !1 } = {}) => (c) => {
|
|
1173
|
-
const a = W(c), d = te([a]);
|
|
1174
|
-
d && t(d);
|
|
1175
|
-
const u = o(s ? le(a) : a);
|
|
1176
|
-
return u instanceof Error ? t(u) : u;
|
|
1177
1297
|
};
|
|
1178
1298
|
return {
|
|
1179
1299
|
// valueIfTrue/valueIfFalse are passed through unretrieved (not
|
|
1180
1300
|
// dereferenced or type-checked here) — that's what makes
|
|
1181
1301
|
// `IF(FALSE, B100, 99)` a genuine short-circuit rather than a lookup.
|
|
1182
|
-
IF: (o, s,
|
|
1183
|
-
const
|
|
1184
|
-
if (
|
|
1185
|
-
return
|
|
1302
|
+
IF: (o, s, u, a) => {
|
|
1303
|
+
const c = Vn(s, o, r);
|
|
1304
|
+
if (u == null) throw r.NA;
|
|
1305
|
+
return c ? u : a ?? !1;
|
|
1186
1306
|
},
|
|
1187
1307
|
// Empty input -> 0, matching both the hand-rolled engine this replaces
|
|
1188
1308
|
// and formulajs's own convention for MAX/MIN.
|
|
@@ -1197,28 +1317,28 @@ function wn(e, r) {
|
|
|
1197
1317
|
// the other aggregates use.
|
|
1198
1318
|
COUNTA: n(e.COUNTA, { checkArgsForErrors: !1 }),
|
|
1199
1319
|
LARGE: (o, s) => {
|
|
1200
|
-
const
|
|
1201
|
-
|
|
1202
|
-
const
|
|
1203
|
-
return
|
|
1320
|
+
const u = Le(o), a = W(s), c = oe([...u, a]);
|
|
1321
|
+
c && t(c);
|
|
1322
|
+
const d = e.LARGE(u, a);
|
|
1323
|
+
return d instanceof Error ? t(d) : d;
|
|
1204
1324
|
},
|
|
1205
1325
|
SMALL: (o, s) => {
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
-
const
|
|
1209
|
-
return
|
|
1326
|
+
const u = Le(o), a = W(s), c = oe([...u, a]);
|
|
1327
|
+
c && t(c);
|
|
1328
|
+
const d = e.SMALL(u, a);
|
|
1329
|
+
return d instanceof Error ? t(d) : d;
|
|
1210
1330
|
},
|
|
1211
1331
|
PERMUT: (o, s) => {
|
|
1212
|
-
const
|
|
1332
|
+
const u = [W(o), W(s)], a = oe(u);
|
|
1213
1333
|
a && t(a);
|
|
1214
|
-
const
|
|
1215
|
-
return
|
|
1334
|
+
const c = e.PERMUT(u[0], u[1]);
|
|
1335
|
+
return c instanceof Error ? t(c) : c;
|
|
1216
1336
|
},
|
|
1217
1337
|
PERMUTATIONA: (o, s) => {
|
|
1218
|
-
const
|
|
1338
|
+
const u = [W(o), W(s)], a = oe(u);
|
|
1219
1339
|
a && t(a);
|
|
1220
|
-
const
|
|
1221
|
-
return
|
|
1340
|
+
const c = e.PERMUTATIONA(u[0], u[1]);
|
|
1341
|
+
return c instanceof Error ? t(c) : c;
|
|
1222
1342
|
},
|
|
1223
1343
|
// match_type is intentionally ignored and forced to 0 (exact match)
|
|
1224
1344
|
// regardless of what the formula author supplied — approximate/sorted
|
|
@@ -1227,29 +1347,29 @@ function wn(e, r) {
|
|
|
1227
1347
|
// real-world data. Same scope decision as the hand-rolled engine this
|
|
1228
1348
|
// replaces, carried forward deliberately rather than dropped.
|
|
1229
1349
|
MATCH: (o, s) => {
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1232
|
-
const
|
|
1233
|
-
return
|
|
1350
|
+
const u = W(o), a = Le(s), c = oe([u, ...a]);
|
|
1351
|
+
c && t(c);
|
|
1352
|
+
const d = e.MATCH(u, a, 0);
|
|
1353
|
+
return d instanceof Error ? t(d) : d;
|
|
1234
1354
|
},
|
|
1235
1355
|
SWITCH: (...o) => {
|
|
1236
|
-
const s = o.map(W),
|
|
1237
|
-
|
|
1356
|
+
const s = o.map(W), u = oe(s);
|
|
1357
|
+
u && t(u);
|
|
1238
1358
|
const a = e.SWITCH(...s);
|
|
1239
1359
|
return a instanceof Error ? t(a) : a;
|
|
1240
1360
|
},
|
|
1241
|
-
SUBSTITUTE: (o, s,
|
|
1242
|
-
const
|
|
1243
|
-
a !== void 0 &&
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1246
|
-
const
|
|
1247
|
-
return
|
|
1361
|
+
SUBSTITUTE: (o, s, u, a) => {
|
|
1362
|
+
const c = [ae(W(o)), ae(W(s)), ae(W(u))];
|
|
1363
|
+
a !== void 0 && c.push(W(a));
|
|
1364
|
+
const d = oe(c);
|
|
1365
|
+
d && t(d);
|
|
1366
|
+
const f = e.SUBSTITUTE(...c);
|
|
1367
|
+
return f instanceof Error ? t(f) : f;
|
|
1248
1368
|
},
|
|
1249
|
-
TEXTJOIN: (o, s, ...
|
|
1250
|
-
const a =
|
|
1251
|
-
|
|
1252
|
-
const p = e.TEXTJOIN(a,
|
|
1369
|
+
TEXTJOIN: (o, s, ...u) => {
|
|
1370
|
+
const a = ae(W(o)), c = W(s), d = u.flatMap(Le).map(ae), f = oe([a, c]);
|
|
1371
|
+
f && t(f);
|
|
1372
|
+
const p = e.TEXTJOIN(a, c, d);
|
|
1253
1373
|
return p instanceof Error ? t(p) : p;
|
|
1254
1374
|
},
|
|
1255
1375
|
UPPER: l(e.UPPER),
|
|
@@ -1259,10 +1379,10 @@ function wn(e, r) {
|
|
|
1259
1379
|
MONTH: l(e.MONTH),
|
|
1260
1380
|
DAY: l(e.DAY),
|
|
1261
1381
|
WEEKDAY: (o, s) => {
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
-
const
|
|
1265
|
-
return
|
|
1382
|
+
const u = W(o), a = W(s), c = oe([u]);
|
|
1383
|
+
c && t(c);
|
|
1384
|
+
const d = e.WEEKDAY(u, a);
|
|
1385
|
+
return d instanceof Error ? t(d) : d;
|
|
1266
1386
|
},
|
|
1267
1387
|
// See TEXT_FUNCTIONS_BROKEN_FOR_BLANK_CELLS above: these override fast-
|
|
1268
1388
|
// formula-parser's own (real, but broken-for-a-bare-blank-cell) versions.
|
|
@@ -1274,53 +1394,53 @@ function wn(e, r) {
|
|
|
1274
1394
|
// separator, matching Excel's own range-argument behavior — the native
|
|
1275
1395
|
// implementation instead inserts stray commas for a whole-range argument.
|
|
1276
1396
|
CONCATENATE: (...o) => {
|
|
1277
|
-
const s = o.flatMap(
|
|
1278
|
-
|
|
1279
|
-
const a = e.CONCATENATE(...s.map(
|
|
1397
|
+
const s = o.flatMap(Le), u = oe(s);
|
|
1398
|
+
u && t(u);
|
|
1399
|
+
const a = e.CONCATENATE(...s.map(ae));
|
|
1280
1400
|
return a instanceof Error ? t(a) : a;
|
|
1281
1401
|
},
|
|
1282
1402
|
CONCAT: (...o) => {
|
|
1283
|
-
const s = o.flatMap(
|
|
1284
|
-
|
|
1285
|
-
const a = e.CONCAT(...s.map(
|
|
1403
|
+
const s = o.flatMap(Le), u = oe(s);
|
|
1404
|
+
u && t(u);
|
|
1405
|
+
const a = e.CONCAT(...s.map(ae));
|
|
1286
1406
|
return a instanceof Error ? t(a) : a;
|
|
1287
1407
|
},
|
|
1288
1408
|
LEN: l(e.LEN, { toText: !0 }),
|
|
1289
1409
|
TRIM: l(e.TRIM, { toText: !0 }),
|
|
1290
1410
|
LOWER: l(e.LOWER, { toText: !0 }),
|
|
1291
1411
|
LEFT: (o, s) => {
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1294
|
-
const
|
|
1295
|
-
return
|
|
1412
|
+
const u = W(o), a = Ze(s), c = oe([u]);
|
|
1413
|
+
c && t(c);
|
|
1414
|
+
const d = e.LEFT(ae(u), a);
|
|
1415
|
+
return d instanceof Error ? t(d) : d;
|
|
1296
1416
|
},
|
|
1297
1417
|
RIGHT: (o, s) => {
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1300
|
-
const
|
|
1301
|
-
return
|
|
1418
|
+
const u = W(o), a = Ze(s), c = oe([u]);
|
|
1419
|
+
c && t(c);
|
|
1420
|
+
const d = e.RIGHT(ae(u), a);
|
|
1421
|
+
return d instanceof Error ? t(d) : d;
|
|
1302
1422
|
},
|
|
1303
|
-
MID: (o, s,
|
|
1304
|
-
const a = W(o),
|
|
1305
|
-
|
|
1306
|
-
const p = e.MID(
|
|
1423
|
+
MID: (o, s, u) => {
|
|
1424
|
+
const a = W(o), c = W(s), d = W(u), f = oe([a, c, d]);
|
|
1425
|
+
f && t(f);
|
|
1426
|
+
const p = e.MID(ae(a), c, d);
|
|
1307
1427
|
return p instanceof Error ? t(p) : p;
|
|
1308
1428
|
},
|
|
1309
|
-
FIND: (o, s,
|
|
1310
|
-
const a = W(o),
|
|
1311
|
-
|
|
1312
|
-
const p = e.FIND(
|
|
1429
|
+
FIND: (o, s, u) => {
|
|
1430
|
+
const a = W(o), c = W(s), d = Ze(u), f = oe([a, c]);
|
|
1431
|
+
f && t(f);
|
|
1432
|
+
const p = e.FIND(ae(a), ae(c), d);
|
|
1313
1433
|
return p instanceof Error ? t(p) : p;
|
|
1314
1434
|
},
|
|
1315
|
-
SEARCH: (o, s,
|
|
1316
|
-
const a = W(o),
|
|
1317
|
-
|
|
1318
|
-
const p = e.SEARCH(
|
|
1435
|
+
SEARCH: (o, s, u) => {
|
|
1436
|
+
const a = W(o), c = W(s), d = Ze(u), f = oe([a, c]);
|
|
1437
|
+
f && t(f);
|
|
1438
|
+
const p = e.SEARCH(ae(a), ae(c), d);
|
|
1319
1439
|
return p instanceof Error ? t(p) : p;
|
|
1320
1440
|
}
|
|
1321
1441
|
};
|
|
1322
1442
|
}
|
|
1323
|
-
const
|
|
1443
|
+
const Bn = {
|
|
1324
1444
|
"#REF!": "REF",
|
|
1325
1445
|
"#VALUE!": "VALUE",
|
|
1326
1446
|
"#DIV/0!": "DIV0",
|
|
@@ -1329,21 +1449,21 @@ const En = {
|
|
|
1329
1449
|
"#NUM!": "NUM",
|
|
1330
1450
|
"#NULL!": "NULL"
|
|
1331
1451
|
};
|
|
1332
|
-
function
|
|
1333
|
-
return
|
|
1452
|
+
function Tt(e) {
|
|
1453
|
+
return Bn[e.error] ?? "ERROR";
|
|
1334
1454
|
}
|
|
1335
|
-
function
|
|
1455
|
+
function xt(e, r) {
|
|
1336
1456
|
if (e instanceof ce) return e;
|
|
1337
1457
|
if (e instanceof r) {
|
|
1338
1458
|
const t = e.details;
|
|
1339
|
-
return t instanceof ce ? t : t instanceof r ? new ce(
|
|
1459
|
+
return t instanceof ce ? t : t instanceof r ? new ce(Tt(t), t.message) : new ce(Tt(e), e.message);
|
|
1340
1460
|
}
|
|
1341
1461
|
return new ce("ERROR", e instanceof Error ? e.message : void 0);
|
|
1342
1462
|
}
|
|
1343
|
-
function
|
|
1463
|
+
function Xn(e) {
|
|
1344
1464
|
return Math.max(0, ...e.map((r) => (r == null ? void 0 : r.length) ?? 0));
|
|
1345
1465
|
}
|
|
1346
|
-
function
|
|
1466
|
+
function Yn(e) {
|
|
1347
1467
|
return (r) => {
|
|
1348
1468
|
const t = e[r.row - 1];
|
|
1349
1469
|
if (r.row < 1 || r.col < 1 || t == null || r.col - 1 >= t.length)
|
|
@@ -1352,69 +1472,69 @@ function An(e) {
|
|
|
1352
1472
|
return n == null || n === "" ? null : n;
|
|
1353
1473
|
};
|
|
1354
1474
|
}
|
|
1355
|
-
function
|
|
1475
|
+
function Kn(e) {
|
|
1356
1476
|
return (r) => {
|
|
1357
|
-
const t = Math.min(r.from.row, r.to.row), n = Math.min(r.from.col, r.to.col), l = Math.max(r.from.row, r.to.row), o = Math.max(r.from.col, r.to.col), s =
|
|
1477
|
+
const t = Math.min(r.from.row, r.to.row), n = Math.min(r.from.col, r.to.col), l = Math.max(r.from.row, r.to.row), o = Math.max(r.from.col, r.to.col), s = Xn(e);
|
|
1358
1478
|
if (t > e.length || n > s)
|
|
1359
1479
|
throw new ce("REF");
|
|
1360
|
-
const
|
|
1361
|
-
for (let
|
|
1362
|
-
const
|
|
1363
|
-
if (
|
|
1364
|
-
const p = Math.min(o,
|
|
1480
|
+
const u = Math.min(l, e.length), a = [];
|
|
1481
|
+
for (let c = t; c <= u; c++) {
|
|
1482
|
+
const d = e[c - 1], f = [];
|
|
1483
|
+
if (d != null) {
|
|
1484
|
+
const p = Math.min(o, d.length);
|
|
1365
1485
|
for (let g = n; g <= p; g++) {
|
|
1366
|
-
const b =
|
|
1367
|
-
|
|
1486
|
+
const b = d[g - 1];
|
|
1487
|
+
f.push(b == null || b === "" ? null : b);
|
|
1368
1488
|
}
|
|
1369
1489
|
}
|
|
1370
|
-
a.push(
|
|
1490
|
+
a.push(f);
|
|
1371
1491
|
}
|
|
1372
1492
|
return a;
|
|
1373
1493
|
};
|
|
1374
1494
|
}
|
|
1375
|
-
function
|
|
1495
|
+
function Gn(e) {
|
|
1376
1496
|
if (e == null || e === "") return null;
|
|
1377
1497
|
if (typeof e == "number" || typeof e == "string" || typeof e == "boolean" || e instanceof Date)
|
|
1378
1498
|
return e;
|
|
1379
1499
|
throw new ce("VALUE");
|
|
1380
1500
|
}
|
|
1381
|
-
async function
|
|
1501
|
+
async function Jt(e, r) {
|
|
1382
1502
|
if (typeof e != "string") throw new ce("ERROR");
|
|
1383
1503
|
const t = e.trim();
|
|
1384
1504
|
if (t === "") throw new ce("ERROR");
|
|
1385
1505
|
const n = t.startsWith("=") ? t.slice(1) : t;
|
|
1386
|
-
|
|
1506
|
+
jn(n);
|
|
1387
1507
|
const [l, o] = await Promise.all([
|
|
1388
1508
|
import("fast-formula-parser"),
|
|
1389
1509
|
import("@formulajs/formulajs")
|
|
1390
|
-
]), s = l.default ?? l,
|
|
1510
|
+
]), s = l.default ?? l, u = s.FormulaError, a = new s({
|
|
1391
1511
|
...r,
|
|
1392
1512
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- formulajs's own types are all `any`-typed; formulaFunctions.ts narrows the surface it actually calls.
|
|
1393
|
-
functions:
|
|
1513
|
+
functions: Wn(o, u)
|
|
1394
1514
|
});
|
|
1395
|
-
let
|
|
1515
|
+
let c;
|
|
1396
1516
|
try {
|
|
1397
|
-
|
|
1398
|
-
} catch (
|
|
1399
|
-
throw
|
|
1517
|
+
c = a.parse(n, { row: 1, col: 1, sheet: "Sheet1" });
|
|
1518
|
+
} catch (d) {
|
|
1519
|
+
throw xt(d, u);
|
|
1400
1520
|
}
|
|
1401
|
-
if (
|
|
1402
|
-
throw
|
|
1403
|
-
return
|
|
1521
|
+
if (c instanceof u)
|
|
1522
|
+
throw xt(c, u);
|
|
1523
|
+
return Gn(c);
|
|
1404
1524
|
}
|
|
1405
|
-
async function
|
|
1406
|
-
return
|
|
1525
|
+
async function qn(e, r) {
|
|
1526
|
+
return Jt(r, { onCell: Yn(e), onRange: Kn(e) });
|
|
1407
1527
|
}
|
|
1408
|
-
const
|
|
1409
|
-
async function
|
|
1528
|
+
const At = -1;
|
|
1529
|
+
async function Zt(e, r) {
|
|
1410
1530
|
const t = Object.keys(e);
|
|
1411
|
-
return
|
|
1531
|
+
return Jt(r, {
|
|
1412
1532
|
onVariable: (n) => {
|
|
1413
1533
|
const l = t.indexOf(n);
|
|
1414
|
-
return l === -1 ? null : { row:
|
|
1534
|
+
return l === -1 ? null : { row: At, col: l + 1 };
|
|
1415
1535
|
},
|
|
1416
1536
|
onCell: (n) => {
|
|
1417
|
-
if (n.row ===
|
|
1537
|
+
if (n.row === At) return e[t[n.col - 1]] ?? null;
|
|
1418
1538
|
throw new ce("REF");
|
|
1419
1539
|
},
|
|
1420
1540
|
onRange: () => {
|
|
@@ -1422,7 +1542,7 @@ async function jt(e, r) {
|
|
|
1422
1542
|
}
|
|
1423
1543
|
});
|
|
1424
1544
|
}
|
|
1425
|
-
const
|
|
1545
|
+
const Qt = {
|
|
1426
1546
|
REF: "#REF!",
|
|
1427
1547
|
VALUE: "#VALUE!",
|
|
1428
1548
|
DIV0: "#DIV/0!",
|
|
@@ -1432,34 +1552,34 @@ const Ht = {
|
|
|
1432
1552
|
NUM: "#NUM!",
|
|
1433
1553
|
NULL: "#NULL!"
|
|
1434
1554
|
};
|
|
1435
|
-
function
|
|
1555
|
+
function pt(e) {
|
|
1436
1556
|
const r = e instanceof ce ? e.code : "ERROR";
|
|
1437
|
-
return
|
|
1557
|
+
return Qt[r];
|
|
1438
1558
|
}
|
|
1439
|
-
async function
|
|
1559
|
+
async function Jn(e, r) {
|
|
1440
1560
|
return e.length === 0 ? r.map((t) => ({
|
|
1441
1561
|
id: typeof (t == null ? void 0 : t.id) == "string" ? t.id : "(unknown)",
|
|
1442
1562
|
label: (t == null ? void 0 : t.label) ?? "(unknown)",
|
|
1443
1563
|
value: null,
|
|
1444
|
-
error:
|
|
1564
|
+
error: Qt.ERROR
|
|
1445
1565
|
})) : Promise.all(
|
|
1446
1566
|
r.map(async (t) => {
|
|
1447
1567
|
try {
|
|
1448
1568
|
if (!t || typeof t.label != "string" || typeof t.expression != "string" || typeof t.id != "string")
|
|
1449
1569
|
throw new ce("ERROR");
|
|
1450
|
-
return { id: t.id, label: t.label, value: await
|
|
1570
|
+
return { id: t.id, label: t.label, value: await qn(e, t.expression) };
|
|
1451
1571
|
} catch (n) {
|
|
1452
1572
|
return {
|
|
1453
1573
|
id: typeof (t == null ? void 0 : t.id) == "string" ? t.id : "(unknown)",
|
|
1454
1574
|
label: (t == null ? void 0 : t.label) ?? "(unknown)",
|
|
1455
1575
|
value: null,
|
|
1456
|
-
error:
|
|
1576
|
+
error: pt(n)
|
|
1457
1577
|
};
|
|
1458
1578
|
}
|
|
1459
1579
|
})
|
|
1460
1580
|
);
|
|
1461
1581
|
}
|
|
1462
|
-
function
|
|
1582
|
+
function Rt(e) {
|
|
1463
1583
|
const r = /* @__PURE__ */ new Set();
|
|
1464
1584
|
for (const { id: t } of e) {
|
|
1465
1585
|
if (r.has(t)) return t;
|
|
@@ -1467,7 +1587,7 @@ function bt(e) {
|
|
|
1467
1587
|
}
|
|
1468
1588
|
return null;
|
|
1469
1589
|
}
|
|
1470
|
-
function
|
|
1590
|
+
function er(e) {
|
|
1471
1591
|
const { columnHeader: r, rowHeader: t, columns: n, rows: l } = e;
|
|
1472
1592
|
if (n !== void 0 && !Array.isArray(n))
|
|
1473
1593
|
return "columns must be an array of { id, label } objects.";
|
|
@@ -1477,89 +1597,89 @@ function Wt(e) {
|
|
|
1477
1597
|
return "columns is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";
|
|
1478
1598
|
if (l !== void 0 && l.length === 0)
|
|
1479
1599
|
return "rows is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";
|
|
1480
|
-
const o = (
|
|
1600
|
+
const o = (d) => !!d && typeof d.id == "string" && d.id !== "" && typeof d.label == "string" && d.label !== "", s = n == null ? void 0 : n.findIndex((d) => !o(d));
|
|
1481
1601
|
if (s != null && s !== -1)
|
|
1482
1602
|
return `columns[${s}] must be a { id, label } object with non-empty string fields.`;
|
|
1483
|
-
const
|
|
1484
|
-
if (
|
|
1485
|
-
return `rows[${
|
|
1486
|
-
const a = !!n && n.length > 0,
|
|
1603
|
+
const u = l == null ? void 0 : l.findIndex((d) => !o(d));
|
|
1604
|
+
if (u != null && u !== -1)
|
|
1605
|
+
return `rows[${u}] must be a { id, label } object with non-empty string fields.`;
|
|
1606
|
+
const a = !!n && n.length > 0, c = !!l && l.length > 0;
|
|
1487
1607
|
if (a) {
|
|
1488
|
-
const
|
|
1489
|
-
if (
|
|
1608
|
+
const d = Rt(n);
|
|
1609
|
+
if (d) return `duplicate column id "${d}" — every declared column id must be unique.`;
|
|
1490
1610
|
}
|
|
1491
|
-
if (
|
|
1492
|
-
const
|
|
1493
|
-
if (
|
|
1611
|
+
if (c) {
|
|
1612
|
+
const d = Rt(l);
|
|
1613
|
+
if (d) return `duplicate row id "${d}" — every declared row id must be unique.`;
|
|
1494
1614
|
}
|
|
1495
|
-
return r && t ? "columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape." : a &&
|
|
1615
|
+
return r && t ? "columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape." : a && c ? "columns and rows cannot both be declared — pick one orientation for the persisted sheet shape." : r && !a ? "columnHeader is true but columns is missing or empty — declare the column list columnHeader positions map to." : t && !c ? "rowHeader is true but rows is missing or empty — declare the row list rowHeader positions map to." : null;
|
|
1496
1616
|
}
|
|
1497
|
-
function
|
|
1498
|
-
const t =
|
|
1617
|
+
function Ct(e, r = {}) {
|
|
1618
|
+
const t = er(r);
|
|
1499
1619
|
if (t) throw new Error(`x-spreadsheet: ${t}`);
|
|
1500
1620
|
const { columnHeader: n, rowHeader: l, columns: o, rows: s } = r;
|
|
1501
|
-
return o && o.length > 0 ?
|
|
1621
|
+
return o && o.length > 0 ? Zn(e, o, n === !0) : s && s.length > 0 ? Qn(e, s, l === !0) : e;
|
|
1502
1622
|
}
|
|
1503
|
-
function
|
|
1623
|
+
function Zn(e, r, t) {
|
|
1504
1624
|
return (t ? e.slice(1) : e).map((l) => {
|
|
1505
1625
|
const o = /* @__PURE__ */ Object.create(null);
|
|
1506
|
-
return r.forEach((s,
|
|
1507
|
-
o[s.id] = l[
|
|
1626
|
+
return r.forEach((s, u) => {
|
|
1627
|
+
o[s.id] = l[u] ?? null;
|
|
1508
1628
|
}), o;
|
|
1509
1629
|
});
|
|
1510
1630
|
}
|
|
1511
|
-
function
|
|
1631
|
+
function Qn(e, r, t) {
|
|
1512
1632
|
const n = t ? 1 : 0, l = Math.max(0, ...e.map((s) => s.length)), o = Math.max(0, l - n);
|
|
1513
|
-
return Array.from({ length: o }, (s,
|
|
1514
|
-
const a = n +
|
|
1515
|
-
return r.forEach((
|
|
1633
|
+
return Array.from({ length: o }, (s, u) => {
|
|
1634
|
+
const a = n + u, c = /* @__PURE__ */ Object.create(null);
|
|
1635
|
+
return r.forEach((d, f) => {
|
|
1516
1636
|
var p;
|
|
1517
|
-
d
|
|
1518
|
-
}),
|
|
1637
|
+
c[d.id] = ((p = e[f]) == null ? void 0 : p[a]) ?? null;
|
|
1638
|
+
}), c;
|
|
1519
1639
|
});
|
|
1520
1640
|
}
|
|
1521
|
-
function
|
|
1641
|
+
function tr(e) {
|
|
1522
1642
|
return !Array.isArray(e[0]);
|
|
1523
1643
|
}
|
|
1524
|
-
function
|
|
1644
|
+
function eo(e) {
|
|
1525
1645
|
const r = /* @__PURE__ */ Object.create(null);
|
|
1526
1646
|
for (const { id: t, label: n, value: l, error: o } of e)
|
|
1527
1647
|
r[t] = o === void 0 ? { label: n, value: l } : { label: n, value: l, error: o };
|
|
1528
1648
|
return r;
|
|
1529
1649
|
}
|
|
1530
|
-
function
|
|
1650
|
+
function lt(e, r) {
|
|
1531
1651
|
const t = (n) => n instanceof Date ? n.toISOString() : n ?? null;
|
|
1532
1652
|
return t(e) === t(r);
|
|
1533
1653
|
}
|
|
1534
|
-
function
|
|
1654
|
+
function to(e, r) {
|
|
1535
1655
|
const t = e ?? {}, n = r ?? {}, l = Object.keys(t);
|
|
1536
1656
|
return l.length !== Object.keys(n).length ? !1 : l.every((o) => {
|
|
1537
1657
|
if (!Object.prototype.hasOwnProperty.call(n, o)) return !1;
|
|
1538
|
-
const s = t[o],
|
|
1539
|
-
return s.label ===
|
|
1658
|
+
const s = t[o], u = n[o];
|
|
1659
|
+
return s.label === u.label && s.error === u.error && lt(s.value, u.value);
|
|
1540
1660
|
});
|
|
1541
1661
|
}
|
|
1542
|
-
function
|
|
1662
|
+
function ro(e, r) {
|
|
1543
1663
|
if (e == null || r == null) return e === r;
|
|
1544
1664
|
const t = Array.isArray(e);
|
|
1545
1665
|
if (t !== Array.isArray(r)) return !1;
|
|
1546
1666
|
if (t) {
|
|
1547
|
-
const s = e,
|
|
1548
|
-
return s.length ===
|
|
1667
|
+
const s = e, u = r;
|
|
1668
|
+
return s.length === u.length && s.every((a, c) => lt(a, u[c]));
|
|
1549
1669
|
}
|
|
1550
1670
|
const n = e, l = r, o = Object.keys(n);
|
|
1551
|
-
return o.length !== Object.keys(l).length ? !1 : o.every((s) => Object.prototype.hasOwnProperty.call(l, s) &&
|
|
1671
|
+
return o.length !== Object.keys(l).length ? !1 : o.every((s) => Object.prototype.hasOwnProperty.call(l, s) && lt(n[s], l[s]));
|
|
1552
1672
|
}
|
|
1553
|
-
function
|
|
1673
|
+
function no(e, r) {
|
|
1554
1674
|
if (e === r) return !0;
|
|
1555
1675
|
if (e == null || r == null) return !1;
|
|
1556
1676
|
const t = e, n = r;
|
|
1557
|
-
return t.length !== n.length ? !1 : t.every((l, o) =>
|
|
1677
|
+
return t.length !== n.length ? !1 : t.every((l, o) => ro(l, n[o]));
|
|
1558
1678
|
}
|
|
1559
|
-
function
|
|
1679
|
+
function oo(e) {
|
|
1560
1680
|
return e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e instanceof Date;
|
|
1561
1681
|
}
|
|
1562
|
-
function
|
|
1682
|
+
function rr(e, r) {
|
|
1563
1683
|
if (e.length === 0) return [];
|
|
1564
1684
|
const t = [], n = /* @__PURE__ */ new Set();
|
|
1565
1685
|
for (const o of r ?? [])
|
|
@@ -1571,21 +1691,21 @@ function Xt(e, r) {
|
|
|
1571
1691
|
const l = e.map(
|
|
1572
1692
|
(o) => t.map((s) => {
|
|
1573
1693
|
if (!Object.prototype.hasOwnProperty.call(o, s)) return null;
|
|
1574
|
-
const
|
|
1575
|
-
return
|
|
1694
|
+
const u = o[s];
|
|
1695
|
+
return oo(u) ? u : null;
|
|
1576
1696
|
})
|
|
1577
1697
|
);
|
|
1578
1698
|
return [t, ...l];
|
|
1579
1699
|
}
|
|
1580
|
-
function
|
|
1700
|
+
function io(e) {
|
|
1581
1701
|
const r = Math.max(0, ...e.map((t) => t.length));
|
|
1582
1702
|
return Array.from({ length: r }, (t, n) => e.map((l) => l[n] ?? null));
|
|
1583
1703
|
}
|
|
1584
|
-
const
|
|
1585
|
-
function
|
|
1704
|
+
const so = ".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv", lo = 10 * 1024 * 1024, ot = 200, ao = 50, co = [];
|
|
1705
|
+
function St(e) {
|
|
1586
1706
|
return e == null || e === "" ? "" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
1587
1707
|
}
|
|
1588
|
-
const
|
|
1708
|
+
const uo = ({
|
|
1589
1709
|
data: e,
|
|
1590
1710
|
handleChange: r,
|
|
1591
1711
|
path: t,
|
|
@@ -1593,34 +1713,34 @@ const _n = ({
|
|
|
1593
1713
|
required: l,
|
|
1594
1714
|
schema: o,
|
|
1595
1715
|
enabled: s,
|
|
1596
|
-
readonly:
|
|
1716
|
+
readonly: u,
|
|
1597
1717
|
errors: a,
|
|
1598
|
-
visible:
|
|
1718
|
+
visible: c = !0
|
|
1599
1719
|
}) => {
|
|
1600
|
-
|
|
1601
|
-
const
|
|
1602
|
-
() =>
|
|
1603
|
-
), [
|
|
1604
|
-
(
|
|
1605
|
-
if (!
|
|
1606
|
-
const
|
|
1607
|
-
|
|
1608
|
-
|
|
1720
|
+
Re(c, t, r);
|
|
1721
|
+
const d = !a || a.length === 0, f = Gt(s, u), p = (o == null ? void 0 : o["x-spreadsheet"]) ?? {}, g = (o == null ? void 0 : o["x-evaluate"]) ?? co, b = p.accept ?? so, M = p.maxSize ?? lo, N = p.columnHeader === !0, U = p.rowHeader === !0, T = p.columns, R = p.rows, I = Array.isArray(T) && T.length > 0, A = Array.isArray(R) && R.length > 0, D = er({ columnHeader: N, rowHeader: U, columns: T, rows: R }), z = p.showSheet !== !1, V = p.sheetName, v = p.persistSheet !== !1, x = e ?? null, [re, X] = j(
|
|
1722
|
+
() => x != null && x.sheet || Object.keys((x == null ? void 0 : x.derivations) ?? {}).length > 0 ? "ready" : "empty"
|
|
1723
|
+
), [Y, L] = j(null), [O, G] = j(!1), [Q, de] = j(null), [ne, Ne] = j(null), S = ue(null), K = ue(null), fe = (x == null ? void 0 : x.sheet) ?? null, Ee = $e(
|
|
1724
|
+
(C) => {
|
|
1725
|
+
if (!tr(C)) return C;
|
|
1726
|
+
const P = A ? R : I ? T : void 0, se = rr(
|
|
1727
|
+
C,
|
|
1728
|
+
P == null ? void 0 : P.map((H) => H.id)
|
|
1609
1729
|
);
|
|
1610
|
-
return
|
|
1730
|
+
return A ? io(se) : se;
|
|
1611
1731
|
},
|
|
1612
|
-
[
|
|
1613
|
-
),
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1616
|
-
Math.max(0, ...
|
|
1617
|
-
),
|
|
1618
|
-
return /* @__PURE__ */ i(
|
|
1619
|
-
/* @__PURE__ */ i(
|
|
1620
|
-
!
|
|
1621
|
-
/* @__PURE__ */ i(
|
|
1622
|
-
|
|
1623
|
-
var
|
|
1732
|
+
[I, A, T, R]
|
|
1733
|
+
), ee = We(() => Q ?? (fe ? Ee(fe) : null), [Q, fe, Ee]), ge = ((ne == null ? void 0 : ne.matrix) === ee ? ne.derivations : null) ?? (x == null ? void 0 : x.derivations) ?? {}, ie = ee != null || x != null, Te = We(() => {
|
|
1734
|
+
const C = I ? 1 : 0, P = A ? 1 : 0, se = ee ? ee.slice(C) : [], H = se.slice(0, ot), _ = Math.min(
|
|
1735
|
+
ao,
|
|
1736
|
+
Math.max(0, ...H.map((ye) => Math.max(0, ye.length - P)))
|
|
1737
|
+
), De = Array.from({ length: _ }, (ye, E) => E + P), Fe = "", Ke = A && !I;
|
|
1738
|
+
return /* @__PURE__ */ i(ve, { children: ee && z && /* @__PURE__ */ y(k, { mt: "3", children: [
|
|
1739
|
+
/* @__PURE__ */ i(k, { style: { overflow: "auto", maxHeight: 420 }, children: /* @__PURE__ */ y(Se.Root, { variant: "surface", size: "1", children: [
|
|
1740
|
+
!Ke && /* @__PURE__ */ i(Se.Header, { children: /* @__PURE__ */ y(Se.Row, { children: [
|
|
1741
|
+
/* @__PURE__ */ i(Se.ColumnHeaderCell, { children: Fe }),
|
|
1742
|
+
De.map((ye) => {
|
|
1743
|
+
var E;
|
|
1624
1744
|
return (
|
|
1625
1745
|
// This row only renders when hasRows isn't the sole
|
|
1626
1746
|
// flag set (see suppressColumnHeaderRow) — so reaching
|
|
@@ -1628,227 +1748,227 @@ const _n = ({
|
|
|
1628
1748
|
// looked up positionally — never read from the matrix
|
|
1629
1749
|
// cell itself, which only ever holds the id) or both
|
|
1630
1750
|
// are false (columnLetter fallback).
|
|
1631
|
-
/* @__PURE__ */ i(
|
|
1751
|
+
/* @__PURE__ */ i(Se.ColumnHeaderCell, { children: I ? ((E = T == null ? void 0 : T[ye]) == null ? void 0 : E.label) ?? "" : Ln(ye) }, ye)
|
|
1632
1752
|
);
|
|
1633
1753
|
})
|
|
1634
1754
|
] }) }),
|
|
1635
|
-
/* @__PURE__ */ i(
|
|
1636
|
-
var
|
|
1637
|
-
const Z =
|
|
1638
|
-
return /* @__PURE__ */ y(
|
|
1755
|
+
/* @__PURE__ */ i(Se.Body, { children: H.map((ye, E) => {
|
|
1756
|
+
var le;
|
|
1757
|
+
const Z = C + E;
|
|
1758
|
+
return /* @__PURE__ */ y(Se.Row, { children: [
|
|
1639
1759
|
/* @__PURE__ */ i(
|
|
1640
|
-
|
|
1760
|
+
Se.RowHeaderCell,
|
|
1641
1761
|
{
|
|
1642
|
-
style:
|
|
1643
|
-
children:
|
|
1762
|
+
style: A ? { fontWeight: 700, background: "var(--gray-a3)" } : void 0,
|
|
1763
|
+
children: A ? ((le = R == null ? void 0 : R[Z]) == null ? void 0 : le.label) ?? "" : I ? "" : Z + 1
|
|
1644
1764
|
}
|
|
1645
1765
|
),
|
|
1646
|
-
|
|
1647
|
-
] },
|
|
1766
|
+
De.map((be) => /* @__PURE__ */ i(Se.Cell, { children: St(ye[be]) }, be))
|
|
1767
|
+
] }, E);
|
|
1648
1768
|
}) })
|
|
1649
1769
|
] }) }),
|
|
1650
|
-
se.length >
|
|
1770
|
+
se.length > ot && /* @__PURE__ */ y(h, { size: "1", color: "gray", mt: "1", style: { display: "block" }, children: [
|
|
1651
1771
|
"Showing first ",
|
|
1652
|
-
|
|
1772
|
+
ot,
|
|
1653
1773
|
" of ",
|
|
1654
1774
|
se.length,
|
|
1655
1775
|
" rows"
|
|
1656
1776
|
] })
|
|
1657
1777
|
] }) });
|
|
1658
|
-
}, [
|
|
1659
|
-
async (
|
|
1660
|
-
if (
|
|
1661
|
-
|
|
1778
|
+
}, [ee, z, I, A, T, R]), m = $e(
|
|
1779
|
+
async (C) => {
|
|
1780
|
+
if (L(null), C.size > M) {
|
|
1781
|
+
L(`File exceeds the ${xe(M)} limit.`);
|
|
1662
1782
|
return;
|
|
1663
1783
|
}
|
|
1664
|
-
if (!b.split(",").map((
|
|
1665
|
-
|
|
1784
|
+
if (!b.split(",").map((_) => _.trim()).some((_) => _ === "*" || _ === "*/*" ? !0 : _.endsWith("/*") ? C.type.startsWith(_.slice(0, -1)) : _.startsWith(".") ? C.name.toLowerCase().endsWith(_.toLowerCase()) : C.type === _)) {
|
|
1785
|
+
L(`Invalid type. Accepted: ${Ae(b)}`);
|
|
1666
1786
|
return;
|
|
1667
1787
|
}
|
|
1668
|
-
|
|
1669
|
-
let
|
|
1788
|
+
X("parsing");
|
|
1789
|
+
let H;
|
|
1670
1790
|
try {
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1673
|
-
} catch (
|
|
1674
|
-
|
|
1675
|
-
|
|
1791
|
+
const _ = await C.arrayBuffer();
|
|
1792
|
+
H = (await kn(_, V)).matrix;
|
|
1793
|
+
} catch (_) {
|
|
1794
|
+
X("error"), L(
|
|
1795
|
+
_ instanceof st ? _.message : "This doesn't look like a valid spreadsheet. Please check the file and try again."
|
|
1676
1796
|
);
|
|
1677
1797
|
return;
|
|
1678
1798
|
}
|
|
1679
|
-
if (
|
|
1799
|
+
if (I || A)
|
|
1680
1800
|
try {
|
|
1681
|
-
|
|
1682
|
-
} catch (
|
|
1683
|
-
|
|
1801
|
+
H = Ee(Ct(H, { columnHeader: N, rowHeader: U, columns: T, rows: R }));
|
|
1802
|
+
} catch (_) {
|
|
1803
|
+
X("error"), L(_ instanceof Error ? _.message : "Failed to process this sheet.");
|
|
1684
1804
|
return;
|
|
1685
1805
|
}
|
|
1686
|
-
|
|
1806
|
+
K.current = (e == null ? void 0 : e.sheet) ?? null, de(H), X("ready");
|
|
1687
1807
|
},
|
|
1688
|
-
[b,
|
|
1808
|
+
[b, M, V, e, N, U, T, R, I, A, Ee]
|
|
1689
1809
|
);
|
|
1690
|
-
if (
|
|
1691
|
-
Q != null &&
|
|
1692
|
-
}, [Q,
|
|
1693
|
-
if (
|
|
1694
|
-
let
|
|
1695
|
-
const
|
|
1696
|
-
|
|
1697
|
-
}, se =
|
|
1810
|
+
if (me(() => {
|
|
1811
|
+
Q != null && fe != null && fe !== K.current && de(null);
|
|
1812
|
+
}, [Q, fe]), me(() => {
|
|
1813
|
+
if (D || g.length === 0 && !v) return;
|
|
1814
|
+
let C = !1;
|
|
1815
|
+
const P = (H) => {
|
|
1816
|
+
f && (to(x == null ? void 0 : x.derivations, H == null ? void 0 : H.derivations) && no(x == null ? void 0 : x.sheet, H == null ? void 0 : H.sheet) || (K.current = (H == null ? void 0 : H.sheet) ?? null, r(t, H)));
|
|
1817
|
+
}, se = ee ?? [];
|
|
1698
1818
|
if (se.length === 0) {
|
|
1699
|
-
|
|
1819
|
+
x != null && P(void 0);
|
|
1700
1820
|
return;
|
|
1701
1821
|
}
|
|
1702
|
-
return
|
|
1703
|
-
if (
|
|
1704
|
-
let
|
|
1822
|
+
return Jn(se, g).then((H) => {
|
|
1823
|
+
if (C) return;
|
|
1824
|
+
let _;
|
|
1705
1825
|
if (Q != null) {
|
|
1706
1826
|
if (v)
|
|
1707
1827
|
try {
|
|
1708
|
-
|
|
1709
|
-
} catch (
|
|
1710
|
-
|
|
1828
|
+
_ = Ct(se, { columnHeader: I, rowHeader: A, columns: T, rows: R });
|
|
1829
|
+
} catch (Fe) {
|
|
1830
|
+
L(Fe instanceof Error ? Fe.message : "Failed to process this sheet.");
|
|
1711
1831
|
return;
|
|
1712
1832
|
}
|
|
1713
1833
|
} else
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
const
|
|
1717
|
-
|
|
1834
|
+
_ = x == null ? void 0 : x.sheet;
|
|
1835
|
+
L(null);
|
|
1836
|
+
const De = eo(H);
|
|
1837
|
+
Ne({ matrix: se, derivations: De }), P(_ === void 0 ? { derivations: De } : { sheet: _, derivations: De });
|
|
1718
1838
|
}), () => {
|
|
1719
|
-
|
|
1839
|
+
C = !0;
|
|
1720
1840
|
};
|
|
1721
|
-
}, [
|
|
1841
|
+
}, [ee, Q, g, f, v, I, A, T, R, D]), c === !1)
|
|
1722
1842
|
return null;
|
|
1723
|
-
if (
|
|
1724
|
-
return /* @__PURE__ */ y(
|
|
1725
|
-
/* @__PURE__ */ i(
|
|
1726
|
-
/* @__PURE__ */ y(
|
|
1843
|
+
if (D)
|
|
1844
|
+
return /* @__PURE__ */ y(k, { mb: "4", children: [
|
|
1845
|
+
/* @__PURE__ */ i(h, { as: "label", size: "2", weight: "bold", children: n }),
|
|
1846
|
+
/* @__PURE__ */ y(h, { size: "2", color: "red", style: { display: "block" }, children: [
|
|
1727
1847
|
"Invalid x-spreadsheet config: ",
|
|
1728
|
-
|
|
1848
|
+
D
|
|
1729
1849
|
] })
|
|
1730
1850
|
] });
|
|
1731
|
-
if (!
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1734
|
-
},
|
|
1735
|
-
var
|
|
1736
|
-
|
|
1737
|
-
},
|
|
1738
|
-
var
|
|
1739
|
-
(
|
|
1740
|
-
},
|
|
1741
|
-
|
|
1742
|
-
},
|
|
1743
|
-
return /* @__PURE__ */ y(
|
|
1744
|
-
/* @__PURE__ */ y(
|
|
1745
|
-
/* @__PURE__ */ y(
|
|
1746
|
-
/* @__PURE__ */ y(
|
|
1851
|
+
if (!f && !ie) return null;
|
|
1852
|
+
const w = (C) => {
|
|
1853
|
+
C.preventDefault(), C.stopPropagation(), f && G(C.type === "dragenter" || C.type === "dragover");
|
|
1854
|
+
}, $ = (C) => {
|
|
1855
|
+
var P;
|
|
1856
|
+
C.preventDefault(), C.stopPropagation(), G(!1), f && (P = C.dataTransfer.files) != null && P[0] && m(C.dataTransfer.files[0]);
|
|
1857
|
+
}, B = (C) => {
|
|
1858
|
+
var P;
|
|
1859
|
+
(P = C.target.files) != null && P[0] && (m(C.target.files[0]), C.target.value = "");
|
|
1860
|
+
}, q = () => {
|
|
1861
|
+
f && (de(null), Ne(null), K.current = null, L(null), X("empty"), r(t, void 0));
|
|
1862
|
+
}, J = z && ee == null && x != null;
|
|
1863
|
+
return /* @__PURE__ */ y(k, { mb: "4", children: [
|
|
1864
|
+
/* @__PURE__ */ y(F, { align: "center", justify: "between", mb: "2", children: [
|
|
1865
|
+
/* @__PURE__ */ y(F, { align: "center", gap: "1", children: [
|
|
1866
|
+
/* @__PURE__ */ y(h, { as: "label", size: "2", weight: "bold", children: [
|
|
1747
1867
|
n,
|
|
1748
|
-
l && /* @__PURE__ */ i(
|
|
1868
|
+
l && /* @__PURE__ */ i(h, { color: "red", children: " *" })
|
|
1749
1869
|
] }),
|
|
1750
|
-
|
|
1751
|
-
/* @__PURE__ */ i(
|
|
1870
|
+
ie && f && /* @__PURE__ */ y(ve, { children: [
|
|
1871
|
+
/* @__PURE__ */ i(Be, { content: "Replace spreadsheet", children: /* @__PURE__ */ i(
|
|
1752
1872
|
je,
|
|
1753
1873
|
{
|
|
1754
1874
|
variant: "ghost",
|
|
1755
1875
|
size: "1",
|
|
1756
1876
|
onClick: () => {
|
|
1757
|
-
var
|
|
1758
|
-
return (
|
|
1877
|
+
var C;
|
|
1878
|
+
return (C = S.current) == null ? void 0 : C.click();
|
|
1759
1879
|
},
|
|
1760
1880
|
"aria-label": "Replace spreadsheet",
|
|
1761
|
-
children: /* @__PURE__ */ i(
|
|
1881
|
+
children: /* @__PURE__ */ i(Ue, {})
|
|
1762
1882
|
}
|
|
1763
1883
|
) }),
|
|
1764
|
-
/* @__PURE__ */ i(
|
|
1884
|
+
/* @__PURE__ */ i(Be, { content: "Remove spreadsheet", children: /* @__PURE__ */ i(
|
|
1765
1885
|
je,
|
|
1766
1886
|
{
|
|
1767
1887
|
variant: "ghost",
|
|
1768
1888
|
size: "1",
|
|
1769
1889
|
color: "gray",
|
|
1770
|
-
onClick:
|
|
1890
|
+
onClick: q,
|
|
1771
1891
|
"aria-label": "Remove spreadsheet",
|
|
1772
|
-
children: /* @__PURE__ */ i(
|
|
1892
|
+
children: /* @__PURE__ */ i(ct, {})
|
|
1773
1893
|
}
|
|
1774
1894
|
) })
|
|
1775
1895
|
] })
|
|
1776
1896
|
] }),
|
|
1777
|
-
/* @__PURE__ */ y(
|
|
1778
|
-
|
|
1897
|
+
/* @__PURE__ */ y(h, { size: "1", color: "gray", children: [
|
|
1898
|
+
xe(M),
|
|
1779
1899
|
" max · ",
|
|
1780
|
-
|
|
1900
|
+
Ae(b)
|
|
1781
1901
|
] })
|
|
1782
1902
|
] }),
|
|
1783
|
-
|
|
1784
|
-
/* @__PURE__ */ i("input", { ref:
|
|
1785
|
-
|
|
1903
|
+
ie && Y && /* @__PURE__ */ i(h, { size: "2", color: "red", mb: "2", style: { display: "block" }, children: Y }),
|
|
1904
|
+
/* @__PURE__ */ i("input", { ref: S, type: "file", style: { display: "none" }, accept: b, onChange: B }),
|
|
1905
|
+
f && !ie && /* @__PURE__ */ i(
|
|
1786
1906
|
"div",
|
|
1787
1907
|
{
|
|
1788
1908
|
role: "button",
|
|
1789
1909
|
tabIndex: 0,
|
|
1790
1910
|
onClick: () => {
|
|
1791
|
-
var
|
|
1792
|
-
return (
|
|
1911
|
+
var C;
|
|
1912
|
+
return (C = S.current) == null ? void 0 : C.click();
|
|
1793
1913
|
},
|
|
1794
|
-
onKeyDown: (
|
|
1795
|
-
var
|
|
1796
|
-
(
|
|
1914
|
+
onKeyDown: (C) => {
|
|
1915
|
+
var P;
|
|
1916
|
+
(C.key === "Enter" || C.key === " ") && (C.preventDefault(), (P = S.current) == null || P.click());
|
|
1797
1917
|
},
|
|
1798
|
-
onDragEnter:
|
|
1799
|
-
onDragLeave:
|
|
1800
|
-
onDragOver:
|
|
1801
|
-
onDrop:
|
|
1918
|
+
onDragEnter: w,
|
|
1919
|
+
onDragLeave: w,
|
|
1920
|
+
onDragOver: w,
|
|
1921
|
+
onDrop: $,
|
|
1802
1922
|
style: { cursor: "pointer" },
|
|
1803
1923
|
className: [
|
|
1804
1924
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
1805
1925
|
"transition-all duration-200 ease-in-out",
|
|
1806
|
-
|
|
1926
|
+
O ? "border-blue-500 bg-blue-50" : Y ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
1807
1927
|
].join(" "),
|
|
1808
|
-
children: /* @__PURE__ */ i(
|
|
1809
|
-
/* @__PURE__ */ i(
|
|
1810
|
-
/* @__PURE__ */ i(
|
|
1811
|
-
] }) :
|
|
1812
|
-
/* @__PURE__ */ i(
|
|
1813
|
-
/* @__PURE__ */ i(
|
|
1814
|
-
/* @__PURE__ */ i(
|
|
1815
|
-
] }) : /* @__PURE__ */ y(
|
|
1816
|
-
/* @__PURE__ */ i(
|
|
1817
|
-
/* @__PURE__ */ i(
|
|
1818
|
-
/* @__PURE__ */ y(
|
|
1819
|
-
|
|
1928
|
+
children: /* @__PURE__ */ i(F, { direction: "column", align: "center", gap: "2", children: re === "parsing" ? /* @__PURE__ */ y(ve, { children: [
|
|
1929
|
+
/* @__PURE__ */ i(_e, { size: "3" }),
|
|
1930
|
+
/* @__PURE__ */ i(h, { size: "2", color: "gray", children: "Parsing spreadsheet…" })
|
|
1931
|
+
] }) : Y ? /* @__PURE__ */ y(ve, { children: [
|
|
1932
|
+
/* @__PURE__ */ i(ut, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
1933
|
+
/* @__PURE__ */ i(h, { size: "2", color: "red", weight: "medium", children: Y }),
|
|
1934
|
+
/* @__PURE__ */ i(h, { size: "1", color: "gray", children: "Click to try again" })
|
|
1935
|
+
] }) : /* @__PURE__ */ y(ve, { children: [
|
|
1936
|
+
/* @__PURE__ */ i(Ue, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
1937
|
+
/* @__PURE__ */ i(h, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
|
|
1938
|
+
/* @__PURE__ */ y(h, { size: "1", color: "gray", children: [
|
|
1939
|
+
xe(M),
|
|
1820
1940
|
" max · ",
|
|
1821
|
-
|
|
1941
|
+
Ae(b)
|
|
1822
1942
|
] })
|
|
1823
1943
|
] }) })
|
|
1824
1944
|
}
|
|
1825
1945
|
),
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
Object.keys(
|
|
1829
|
-
/* @__PURE__ */ i(
|
|
1830
|
-
/* @__PURE__ */ i(
|
|
1831
|
-
/* @__PURE__ */ i(
|
|
1832
|
-
|
|
1946
|
+
Te,
|
|
1947
|
+
J && /* @__PURE__ */ i(h, { size: "2", color: "gray", mt: "3", style: { display: "block" }, children: "Sheet preview not stored for this field — re-upload to view contents." }),
|
|
1948
|
+
Object.keys(ge).length > 0 && /* @__PURE__ */ y(k, { mt: "3", children: [
|
|
1949
|
+
/* @__PURE__ */ i(h, { size: "2", weight: "bold", as: "div", mb: "1", children: "Computed values" }),
|
|
1950
|
+
/* @__PURE__ */ i(F, { direction: "column", gap: "1", children: Object.entries(ge).map(([C, P]) => /* @__PURE__ */ y(F, { justify: "between", children: [
|
|
1951
|
+
/* @__PURE__ */ i(h, { size: "2", children: P.label }),
|
|
1952
|
+
P.error ? /* @__PURE__ */ i(h, { size: "2", color: "red", children: P.error }) : (
|
|
1833
1953
|
// d.value is CellValue | null now (SUM/AVERAGE aren't the only
|
|
1834
1954
|
// possible results anymore — INDEX/CONCATENATE can return a
|
|
1835
1955
|
// string, a bare comparison can return a boolean, etc.), so
|
|
1836
1956
|
// `.toLocaleString()` would throw for e.g. a boolean result.
|
|
1837
1957
|
// Reuse the same formatCell used for the sheet-preview grid.
|
|
1838
|
-
/* @__PURE__ */ i(
|
|
1958
|
+
/* @__PURE__ */ i(h, { size: "2", children: St(P.value) })
|
|
1839
1959
|
)
|
|
1840
|
-
] },
|
|
1960
|
+
] }, C)) })
|
|
1841
1961
|
] }),
|
|
1842
|
-
!
|
|
1962
|
+
!d && /* @__PURE__ */ i(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: we(a, n) })
|
|
1843
1963
|
] });
|
|
1844
|
-
},
|
|
1964
|
+
}, fo = pe(uo), po = te(
|
|
1845
1965
|
10,
|
|
1846
1966
|
// matches FileControlTester's rank — beats the default object/Group renderer
|
|
1847
|
-
|
|
1967
|
+
Me(
|
|
1848
1968
|
(e) => e.type === "object" && typeof e["x-spreadsheet"] == "object"
|
|
1849
1969
|
)
|
|
1850
|
-
),
|
|
1851
|
-
function
|
|
1970
|
+
), ho = "Sheet1", mo = "xlsx";
|
|
1971
|
+
function go(e) {
|
|
1852
1972
|
if (e === void 0) return null;
|
|
1853
1973
|
if (!Array.isArray(e)) return "columns must be an array of { id, label } objects.";
|
|
1854
1974
|
if (e.length === 0)
|
|
@@ -1858,9 +1978,9 @@ function Bn(e) {
|
|
|
1858
1978
|
);
|
|
1859
1979
|
return r !== -1 ? `columns[${r}] must be a { id, label } object with non-empty string fields.` : null;
|
|
1860
1980
|
}
|
|
1861
|
-
function
|
|
1862
|
-
if (!
|
|
1863
|
-
const t =
|
|
1981
|
+
function yo(e, r) {
|
|
1982
|
+
if (!tr(e)) return e;
|
|
1983
|
+
const t = rr(
|
|
1864
1984
|
e,
|
|
1865
1985
|
r == null ? void 0 : r.map((s) => s.id)
|
|
1866
1986
|
);
|
|
@@ -1868,51 +1988,54 @@ function Xn(e, r) {
|
|
|
1868
1988
|
const n = new Map(r.map((s) => [s.id, s.label])), [l, ...o] = t;
|
|
1869
1989
|
return [l.map((s) => n.get(String(s)) ?? s), ...o];
|
|
1870
1990
|
}
|
|
1871
|
-
const
|
|
1872
|
-
const [
|
|
1873
|
-
if (
|
|
1991
|
+
const bo = ({ data: e, path: r, label: t, schema: n, visible: l = !0 }) => {
|
|
1992
|
+
const [o, s] = j(null), u = Ve();
|
|
1993
|
+
if (l === !1)
|
|
1874
1994
|
return null;
|
|
1875
|
-
const
|
|
1876
|
-
if (
|
|
1877
|
-
return /* @__PURE__ */ y(
|
|
1878
|
-
/* @__PURE__ */ i(
|
|
1879
|
-
/* @__PURE__ */ y(
|
|
1995
|
+
const a = (n == null ? void 0 : n["x-spreadsheet-export"]) ?? {}, c = a.columns, d = a.sheetName ?? ho, f = a.fileType ?? mo, p = a.fileName ?? `export.${f}`, g = go(c);
|
|
1996
|
+
if (g)
|
|
1997
|
+
return /* @__PURE__ */ y(k, { mb: "4", children: [
|
|
1998
|
+
/* @__PURE__ */ i(h, { as: "label", size: "2", weight: "bold", children: t }),
|
|
1999
|
+
/* @__PURE__ */ y(h, { size: "2", color: "red", style: { display: "block" }, children: [
|
|
1880
2000
|
"Invalid x-spreadsheet-export config: ",
|
|
1881
|
-
|
|
2001
|
+
g
|
|
1882
2002
|
] })
|
|
1883
2003
|
] });
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1886
|
-
|
|
2004
|
+
const b = Array.isArray(e) && e.length > 0, M = async () => {
|
|
2005
|
+
var N, U;
|
|
2006
|
+
if (b) {
|
|
2007
|
+
s(null);
|
|
1887
2008
|
try {
|
|
1888
|
-
const
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
2009
|
+
const T = await import("@e965/xlsx"), R = yo(e, c), I = T.utils.aoa_to_sheet(R), A = T.utils.book_new();
|
|
2010
|
+
T.utils.book_append_sheet(A, I, d);
|
|
2011
|
+
const D = r.split(".").slice(0, -1).join("."), z = D ? Pe.data((N = u.core) == null ? void 0 : N.data, D) : (U = u.core) == null ? void 0 : U.data;
|
|
2012
|
+
T.writeFile(A, ft(p, z, `export.${f}`), { bookType: f });
|
|
2013
|
+
} catch (T) {
|
|
2014
|
+
s(T instanceof Error ? T.message : "Failed to build the workbook.");
|
|
1892
2015
|
}
|
|
1893
2016
|
}
|
|
1894
2017
|
};
|
|
1895
|
-
return /* @__PURE__ */ y(
|
|
1896
|
-
/* @__PURE__ */ i(
|
|
1897
|
-
/* @__PURE__ */ y(
|
|
1898
|
-
/* @__PURE__ */ i(
|
|
2018
|
+
return /* @__PURE__ */ y(k, { mb: "4", children: [
|
|
2019
|
+
/* @__PURE__ */ i(h, { as: "label", size: "2", weight: "bold", style: { display: "block", marginBottom: "var(--space-2)" }, children: t }),
|
|
2020
|
+
/* @__PURE__ */ y(ze, { type: "button", variant: "soft", disabled: !b, onClick: () => void M(), children: [
|
|
2021
|
+
/* @__PURE__ */ i(at, {}),
|
|
1899
2022
|
" Download Spreadsheet"
|
|
1900
2023
|
] }),
|
|
1901
|
-
|
|
2024
|
+
o && /* @__PURE__ */ i(h, { size: "2", color: "red", style: { display: "block", marginTop: "var(--space-2)" }, children: o })
|
|
1902
2025
|
] });
|
|
1903
|
-
},
|
|
2026
|
+
}, vo = pe(bo), wo = te(
|
|
1904
2027
|
10,
|
|
1905
|
-
|
|
1906
|
-
|
|
2028
|
+
$t(
|
|
2029
|
+
Me((e) => {
|
|
1907
2030
|
const r = e["x-spreadsheet-export"];
|
|
1908
2031
|
return e.type === "array" && typeof r == "object" && r !== null;
|
|
1909
2032
|
}),
|
|
1910
|
-
|
|
2033
|
+
Er(Tr("editable", !0))
|
|
1911
2034
|
)
|
|
1912
2035
|
);
|
|
1913
|
-
class
|
|
2036
|
+
class Ie extends Error {
|
|
1914
2037
|
}
|
|
1915
|
-
const
|
|
2038
|
+
const Ot = 5e6, Eo = 1024, To = /^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["']/i, xo = {
|
|
1916
2039
|
// Default is true, which would silently drop what in many formats is most of
|
|
1917
2040
|
// the payload.
|
|
1918
2041
|
ignoreAttributes: !1,
|
|
@@ -1959,7 +2082,7 @@ const Et = 5e6, qn = 1024, Jn = /^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["'
|
|
|
1959
2082
|
maxNestedTags: 100,
|
|
1960
2083
|
strictReservedNames: !0
|
|
1961
2084
|
};
|
|
1962
|
-
function
|
|
2085
|
+
function Ao(e) {
|
|
1963
2086
|
const r = new Set(e);
|
|
1964
2087
|
return r.size === 0 ? () => !1 : (t, n) => (
|
|
1965
2088
|
// A string while the library's own `jPath` option is true (the default) and
|
|
@@ -1967,137 +2090,212 @@ function Qn(e) {
|
|
|
1967
2090
|
r.has(typeof n == "string" ? n : n.toString()) || r.has(t)
|
|
1968
2091
|
);
|
|
1969
2092
|
}
|
|
1970
|
-
function
|
|
2093
|
+
function Ro(e) {
|
|
1971
2094
|
const r = e instanceof Error ? e.message : "";
|
|
1972
2095
|
return r.startsWith("[SECURITY] Invalid name:") ? "This document uses a reserved JavaScript name (__proto__, constructor or prototype) as an element or attribute name, which cannot be represented safely." : r === "External entities are not supported" || r === "Parameter entities are not supported" ? `${r}. Please remove the DOCTYPE entity declarations and try again.` : r.startsWith("Maximum nested tags exceeded") ? "This document is nested too deeply to parse." : r.startsWith("Entity count") || r.includes("exceeds maximum allowed") ? "This document declares too many or too large entity definitions to expand safely." : "This doesn't look like a valid XML document. Please check the file and try again.";
|
|
1973
2096
|
}
|
|
1974
|
-
async function
|
|
1975
|
-
var
|
|
1976
|
-
if (typeof e != "string") throw new
|
|
2097
|
+
async function Co(e, r = {}) {
|
|
2098
|
+
var c;
|
|
2099
|
+
if (typeof e != "string") throw new Ie("This file could not be read as text.");
|
|
1977
2100
|
const t = e.charCodeAt(0) === 65279 ? e.slice(1) : e;
|
|
1978
|
-
if (t.trim() === "") throw new
|
|
1979
|
-
if (t.length >
|
|
1980
|
-
throw new
|
|
1981
|
-
`This document is too large to parse (over ${
|
|
2101
|
+
if (t.trim() === "") throw new Ie("This file is empty.");
|
|
2102
|
+
if (t.length > Ot)
|
|
2103
|
+
throw new Ie(
|
|
2104
|
+
`This document is too large to parse (over ${Ot / 1e6} million characters).`
|
|
1982
2105
|
);
|
|
1983
|
-
const n = (
|
|
2106
|
+
const n = (c = To.exec(t.slice(0, Eo))) == null ? void 0 : c[1];
|
|
1984
2107
|
if (n && !/^utf-?8$/i.test(n))
|
|
1985
|
-
throw new
|
|
2108
|
+
throw new Ie(
|
|
1986
2109
|
`This document declares the unsupported encoding "${n}". Only UTF-8 is supported.`
|
|
1987
2110
|
);
|
|
1988
2111
|
const { XMLParser: l, XMLValidator: o } = await import("fast-xml-parser"), s = o.validate(t, { allowBooleanAttributes: !1 });
|
|
1989
2112
|
if (s !== !0) {
|
|
1990
|
-
const { msg:
|
|
1991
|
-
throw new
|
|
2113
|
+
const { msg: d, line: f, col: p } = s.err;
|
|
2114
|
+
throw new Ie(`Invalid XML at line ${f}, column ${p}: ${d}`);
|
|
1992
2115
|
}
|
|
1993
|
-
const
|
|
1994
|
-
...
|
|
2116
|
+
const u = new l({
|
|
2117
|
+
...xo,
|
|
1995
2118
|
removeNSPrefix: r.removeNamespaces === !0,
|
|
1996
|
-
isArray:
|
|
2119
|
+
isArray: Ao(r.arrayPaths ?? [])
|
|
1997
2120
|
});
|
|
1998
2121
|
let a;
|
|
1999
2122
|
try {
|
|
2000
|
-
a =
|
|
2001
|
-
} catch (
|
|
2002
|
-
throw new
|
|
2123
|
+
a = u.parse(t);
|
|
2124
|
+
} catch (d) {
|
|
2125
|
+
throw new Ie(Ro(d));
|
|
2003
2126
|
}
|
|
2004
2127
|
if (a == null || typeof a != "object" || Array.isArray(a))
|
|
2005
|
-
throw new
|
|
2128
|
+
throw new Ie("This document has no root element.");
|
|
2006
2129
|
return a;
|
|
2007
2130
|
}
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
return
|
|
2131
|
+
function nr(e, r, t) {
|
|
2132
|
+
const { path: n, default: l } = typeof t == "string" ? { path: t, default: void 0 } : t, o = Pe.data(e, r ? `${r}.${n}` : n);
|
|
2133
|
+
return o ?? l;
|
|
2134
|
+
}
|
|
2135
|
+
function So(e, r, t) {
|
|
2136
|
+
const n = {};
|
|
2137
|
+
for (const [l, o] of Object.entries(t)) {
|
|
2138
|
+
const s = nr(e, r, o);
|
|
2139
|
+
if (s === void 0) return;
|
|
2140
|
+
n[l] = s;
|
|
2141
|
+
}
|
|
2142
|
+
return n;
|
|
2143
|
+
}
|
|
2144
|
+
async function Oo(e, r) {
|
|
2145
|
+
try {
|
|
2146
|
+
return { status: "ok", value: await Zt(e, r) };
|
|
2147
|
+
} catch (t) {
|
|
2148
|
+
return { status: "error", error: pt(t) };
|
|
2149
|
+
}
|
|
2011
2150
|
}
|
|
2012
|
-
|
|
2013
|
-
|
|
2151
|
+
function or(e, r) {
|
|
2152
|
+
return e == null ? "" : typeof e == "number" ? e.toFixed(No(r)) : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
2153
|
+
}
|
|
2154
|
+
function No(e) {
|
|
2155
|
+
return Number.isFinite(e) ? Math.min(100, Math.max(0, Math.trunc(e))) : 0;
|
|
2156
|
+
}
|
|
2157
|
+
const ke = { found: !1 }, he = (e) => ({ found: !0, value: e });
|
|
2158
|
+
function Nt(e) {
|
|
2159
|
+
return e == null || e === "" ? ke : Array.isArray(e) || e instanceof Date ? he(e) : typeof e == "object" ? ke : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? he(e) : ke;
|
|
2160
|
+
}
|
|
2161
|
+
const Do = /* @__PURE__ */ new Set(["true", "1", "yes", "y"]), Io = /* @__PURE__ */ new Set(["false", "0", "no", "n"]), ko = /^(\d{4}-\d{2}-\d{2})(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})?)?$/;
|
|
2162
|
+
async function Lo(e, r, t) {
|
|
2014
2163
|
switch (r.as) {
|
|
2015
2164
|
case void 0:
|
|
2016
|
-
return
|
|
2165
|
+
return he(e);
|
|
2017
2166
|
case "string":
|
|
2018
|
-
return
|
|
2167
|
+
return he(e instanceof Date ? e.toISOString() : String(e));
|
|
2019
2168
|
case "number": {
|
|
2020
|
-
const
|
|
2021
|
-
return Number.isFinite(
|
|
2169
|
+
const n = e instanceof Date ? e.getTime() : Number(e);
|
|
2170
|
+
return Number.isFinite(n) ? he(r.decimals === void 0 ? n : or(n, r.decimals)) : ke;
|
|
2022
2171
|
}
|
|
2023
2172
|
case "boolean": {
|
|
2024
|
-
const
|
|
2025
|
-
return
|
|
2173
|
+
const n = String(e).trim().toLowerCase();
|
|
2174
|
+
return Do.has(n) ? he(!0) : Io.has(n) ? he(!1) : ke;
|
|
2026
2175
|
}
|
|
2027
2176
|
case "date": {
|
|
2028
|
-
const { default:
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2177
|
+
const { default: n } = await import("dayjs"), { default: l } = await import("./customParseFormat-D14EWdSX.js").then((u) => u.c);
|
|
2178
|
+
if (n.extend(l), t === "export") {
|
|
2179
|
+
const u = typeof e == "string" ? ko.exec(e) : null, a = e instanceof Date ? n(e) : u ? n(u[1], "YYYY-MM-DD", !0) : null;
|
|
2180
|
+
return a != null && a.isValid() ? he(a.format(r.format ?? "YYYY-MM-DD")) : ke;
|
|
2181
|
+
}
|
|
2182
|
+
const o = e instanceof Date ? e.toISOString() : String(e), s = r.format ? n(o, r.format, !0) : n(o);
|
|
2183
|
+
return s.isValid() ? he(s.format("YYYY-MM-DD")) : ke;
|
|
2032
2184
|
}
|
|
2033
2185
|
}
|
|
2034
2186
|
}
|
|
2035
|
-
async function
|
|
2187
|
+
async function Mo(e, r) {
|
|
2036
2188
|
if (r.formula !== void 0) {
|
|
2037
2189
|
const t = {};
|
|
2038
2190
|
for (const [n, l] of Object.entries(r.inputs ?? {})) {
|
|
2039
|
-
const o =
|
|
2191
|
+
const o = Nt(Pe.data(e, l));
|
|
2040
2192
|
if (!o.found || Array.isArray(o.value)) return ke;
|
|
2041
2193
|
t[n] = o.value;
|
|
2042
2194
|
}
|
|
2043
2195
|
try {
|
|
2044
|
-
return
|
|
2196
|
+
return he(await Zt(t, r.formula));
|
|
2045
2197
|
} catch (n) {
|
|
2046
|
-
throw new Error(`writeTo "${r.to}": ${
|
|
2198
|
+
throw new Error(`writeTo "${r.to}": ${pt(n)}`);
|
|
2047
2199
|
}
|
|
2048
2200
|
}
|
|
2049
2201
|
if (r.from === void 0) throw new Error(`writeTo "${r.to}" needs either "from" or "formula".`);
|
|
2050
|
-
return
|
|
2051
|
-
}
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2202
|
+
return Nt(Pe.data(e, r.from));
|
|
2203
|
+
}
|
|
2204
|
+
const Qe = "@_", ir = "#text", et = (e) => e.split(".").filter(Boolean), sr = (e) => e.startsWith(Qe) || e === ir;
|
|
2205
|
+
function lr(e, r) {
|
|
2206
|
+
if (typeof e.to != "string" || et(e.to).length === 0) return '"to" must be a non-empty path.';
|
|
2207
|
+
if (e.format !== void 0 && e.as !== "date") return '"format" needs "as": "date".';
|
|
2208
|
+
if (e.decimals !== void 0) {
|
|
2209
|
+
if (r === "import")
|
|
2210
|
+
return '"decimals" only applies on export — on import it would put text in a number field.';
|
|
2211
|
+
if (e.as !== "number") return '"decimals" needs "as": "number".';
|
|
2212
|
+
const { decimals: t } = e;
|
|
2213
|
+
if (!Number.isInteger(t) || t < 0 || t > 100)
|
|
2214
|
+
return '"decimals" must be a whole number from 0 to 100.';
|
|
2215
|
+
}
|
|
2216
|
+
if (r === "export") {
|
|
2217
|
+
const t = et(e.to);
|
|
2218
|
+
for (const [n, l] of t.entries()) {
|
|
2219
|
+
if (l === Qe) return '"@_" needs an attribute name after it, e.g. "@_id".';
|
|
2220
|
+
if (sr(l) && n < t.length - 1)
|
|
2221
|
+
return `"${l}" must be the last segment — it belongs to the element before it.`;
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
return null;
|
|
2225
|
+
}
|
|
2226
|
+
function Dt(e, r, t) {
|
|
2227
|
+
const n = t ? ` To give "${r}" both text and attributes, write its text to "${r}.${ir}".` : "";
|
|
2228
|
+
return new Error(`writeTo "${e}": "${r}" is written both as a value and as the parent of other values.${n}`);
|
|
2229
|
+
}
|
|
2230
|
+
function ar(e) {
|
|
2231
|
+
const r = {}, t = /* @__PURE__ */ new Set([r]);
|
|
2232
|
+
for (const { to: n, value: l } of e) {
|
|
2233
|
+
const o = et(n);
|
|
2234
|
+
if (o.length === 0) continue;
|
|
2235
|
+
let s = r;
|
|
2236
|
+
for (const [c, d] of o.slice(0, -1).entries()) {
|
|
2237
|
+
const f = s[d];
|
|
2238
|
+
if (f === void 0) {
|
|
2239
|
+
const p = {};
|
|
2240
|
+
t.add(p), s[d] = p, s = p;
|
|
2241
|
+
} else if (t.has(f))
|
|
2242
|
+
s = f;
|
|
2243
|
+
else
|
|
2244
|
+
throw Dt(n, o.slice(0, c + 1).join("."), o[c + 1].startsWith(Qe));
|
|
2245
|
+
}
|
|
2246
|
+
const u = o[o.length - 1], a = s[u];
|
|
2247
|
+
if (t.has(a)) {
|
|
2248
|
+
const c = Object.keys(a).some((d) => d.startsWith(Qe));
|
|
2249
|
+
throw Dt(n, o.join("."), c);
|
|
2066
2250
|
}
|
|
2067
|
-
|
|
2251
|
+
s[u] = l;
|
|
2068
2252
|
}
|
|
2069
2253
|
return r;
|
|
2070
2254
|
}
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
const o = l
|
|
2076
|
-
if (
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2255
|
+
const zo = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
2256
|
+
async function ht(e, r, t) {
|
|
2257
|
+
const n = [];
|
|
2258
|
+
for (const l of r) {
|
|
2259
|
+
const o = lr(l, t);
|
|
2260
|
+
if (o) throw new Error(`writeTo "${l.to}": ${o}`);
|
|
2261
|
+
const s = et(l.to), u = t === "export" && sr(s[s.length - 1]), a = (f) => {
|
|
2262
|
+
if (!(u && f == null)) {
|
|
2263
|
+
if (u && !zo(f)) {
|
|
2264
|
+
const p = f instanceof Date ? ' Add "as": "date" to write a date.' : "";
|
|
2265
|
+
throw new Error(
|
|
2266
|
+
`writeTo "${l.to}": an attribute or #text value must be text, a number or a boolean.${p}`
|
|
2267
|
+
);
|
|
2268
|
+
}
|
|
2269
|
+
n.push({ to: l.to, value: f });
|
|
2270
|
+
}
|
|
2271
|
+
};
|
|
2272
|
+
let c = await Mo(e, l);
|
|
2273
|
+
const d = c.found && Array.isArray(c.value);
|
|
2274
|
+
if (c.found && d && l.writeTo) {
|
|
2275
|
+
const f = await Promise.all(
|
|
2276
|
+
c.value.map(
|
|
2277
|
+
async (p) => ar(await ht(p, l.writeTo, t))
|
|
2080
2278
|
)
|
|
2081
2279
|
);
|
|
2082
|
-
|
|
2280
|
+
a(f);
|
|
2083
2281
|
continue;
|
|
2084
2282
|
}
|
|
2085
|
-
if (
|
|
2086
|
-
throw new Error(`writeTo "${
|
|
2087
|
-
if (
|
|
2088
|
-
const
|
|
2089
|
-
Object.prototype.hasOwnProperty.call(
|
|
2283
|
+
if (c.found && !d && l.writeTo)
|
|
2284
|
+
throw new Error(`writeTo "${l.to}": "writeTo" is set, but "from" did not resolve to a repeating element.`);
|
|
2285
|
+
if (c.found && !d && l.map) {
|
|
2286
|
+
const f = c.value instanceof Date ? c.value.toISOString() : String(c.value);
|
|
2287
|
+
Object.prototype.hasOwnProperty.call(l.map, f) && (c = he(l.map[f]));
|
|
2090
2288
|
}
|
|
2091
|
-
if (
|
|
2092
|
-
if (
|
|
2093
|
-
|
|
2289
|
+
if (c.found && !d && (c = await Lo(c.value, l, t)), !c.found) {
|
|
2290
|
+
if (l.default === void 0) continue;
|
|
2291
|
+
a(l.default);
|
|
2094
2292
|
continue;
|
|
2095
2293
|
}
|
|
2096
|
-
|
|
2294
|
+
a(c.value);
|
|
2097
2295
|
}
|
|
2098
|
-
return
|
|
2296
|
+
return n;
|
|
2099
2297
|
}
|
|
2100
|
-
const
|
|
2298
|
+
const Fo = ".xml,text/xml,application/xml", Uo = 5 * 1024 * 1024, $o = ({
|
|
2101
2299
|
data: e,
|
|
2102
2300
|
handleChange: r,
|
|
2103
2301
|
path: t,
|
|
@@ -2105,347 +2303,346 @@ const so = ".xml,text/xml,application/xml", lo = 5 * 1024 * 1024, co = ({
|
|
|
2105
2303
|
required: l,
|
|
2106
2304
|
schema: o,
|
|
2107
2305
|
enabled: s,
|
|
2108
|
-
readonly:
|
|
2306
|
+
readonly: u,
|
|
2109
2307
|
errors: a,
|
|
2110
|
-
visible:
|
|
2308
|
+
visible: c = !0
|
|
2111
2309
|
}) => {
|
|
2112
|
-
|
|
2113
|
-
const
|
|
2114
|
-
async (
|
|
2115
|
-
var
|
|
2116
|
-
const
|
|
2117
|
-
if (v(null),
|
|
2118
|
-
v(`File exceeds the ${
|
|
2310
|
+
Re(c, t, r);
|
|
2311
|
+
const d = !a || a.length === 0, f = Gt(s, u), p = (o == null ? void 0 : o["x-xml"]) ?? {}, g = p.accept ?? Fo, b = p.maxSize ?? Uo, M = p.arrayPaths, N = p.removeNamespaces === !0, U = p.writeTo, T = p.writeBase ?? "root", R = p.persistDocument !== !1, I = Ve(), A = e ?? null, [D, z] = j(() => A ? "ready" : "empty"), [V, v] = j(null), [x, re] = j(!1), X = ue(null), Y = ue(0), L = A != null, O = U !== void 0 && U.length > 0, G = $e(
|
|
2312
|
+
async (S) => {
|
|
2313
|
+
var Te;
|
|
2314
|
+
const K = ++Y.current;
|
|
2315
|
+
if (v(null), S.size > b) {
|
|
2316
|
+
v(`File exceeds the ${xe(b)} limit.`);
|
|
2119
2317
|
return;
|
|
2120
2318
|
}
|
|
2121
|
-
if (!g.split(",").map((
|
|
2122
|
-
v(`Invalid type. Accepted: ${
|
|
2319
|
+
if (!g.split(",").map((m) => m.trim()).some((m) => m === "*" || m === "*/*" ? !0 : m.endsWith("/*") ? S.type.startsWith(m.slice(0, -1)) : m.startsWith(".") ? S.name.toLowerCase().endsWith(m.toLowerCase()) : S.type === m)) {
|
|
2320
|
+
v(`Invalid type. Accepted: ${Ae(g)}`);
|
|
2123
2321
|
return;
|
|
2124
2322
|
}
|
|
2125
|
-
|
|
2126
|
-
let
|
|
2323
|
+
z("parsing");
|
|
2324
|
+
let ee;
|
|
2127
2325
|
try {
|
|
2128
|
-
const
|
|
2129
|
-
|
|
2130
|
-
} catch (
|
|
2131
|
-
if (
|
|
2132
|
-
|
|
2133
|
-
|
|
2326
|
+
const m = await S.text();
|
|
2327
|
+
ee = await Co(m, { arrayPaths: M, removeNamespaces: N });
|
|
2328
|
+
} catch (m) {
|
|
2329
|
+
if (K !== Y.current) return;
|
|
2330
|
+
z("error"), v(
|
|
2331
|
+
m instanceof Ie ? m.message : "This doesn't look like a valid XML document. Please check the file and try again."
|
|
2134
2332
|
);
|
|
2135
2333
|
return;
|
|
2136
2334
|
}
|
|
2137
|
-
let
|
|
2138
|
-
if (
|
|
2335
|
+
let ge = [];
|
|
2336
|
+
if (U && U.length > 0)
|
|
2139
2337
|
try {
|
|
2140
|
-
|
|
2141
|
-
} catch (
|
|
2142
|
-
if (
|
|
2143
|
-
|
|
2338
|
+
ge = await ht(ee, U, "import");
|
|
2339
|
+
} catch (m) {
|
|
2340
|
+
if (K !== Y.current) return;
|
|
2341
|
+
z("error"), v(m instanceof Error ? m.message : "This document could not be mapped onto the form.");
|
|
2144
2342
|
return;
|
|
2145
2343
|
}
|
|
2146
|
-
if (
|
|
2147
|
-
|
|
2148
|
-
const
|
|
2149
|
-
for (const
|
|
2150
|
-
|
|
2344
|
+
if (K !== Y.current) return;
|
|
2345
|
+
R && r(t, ee);
|
|
2346
|
+
const ie = T === "parent" ? t.split(".").slice(0, -1).join(".") : "";
|
|
2347
|
+
for (const m of ge) (Te = I.dispatch) == null || Te.call(I, xr(ie ? `${ie}.${m.to}` : m.to, () => m.value));
|
|
2348
|
+
z("ready");
|
|
2151
2349
|
},
|
|
2152
|
-
[g, b,
|
|
2350
|
+
[g, b, M, N, U, T, R, t, r, I]
|
|
2153
2351
|
);
|
|
2154
|
-
if (
|
|
2155
|
-
const Q = (
|
|
2156
|
-
|
|
2157
|
-
},
|
|
2158
|
-
var
|
|
2159
|
-
|
|
2160
|
-
},
|
|
2161
|
-
var
|
|
2162
|
-
(
|
|
2352
|
+
if (c === !1 || !f && !L) return null;
|
|
2353
|
+
const Q = (S) => {
|
|
2354
|
+
S.preventDefault(), S.stopPropagation(), f && re(S.type === "dragenter" || S.type === "dragover");
|
|
2355
|
+
}, de = (S) => {
|
|
2356
|
+
var K;
|
|
2357
|
+
S.preventDefault(), S.stopPropagation(), re(!1), f && (K = S.dataTransfer.files) != null && K[0] && G(S.dataTransfer.files[0]);
|
|
2358
|
+
}, ne = (S) => {
|
|
2359
|
+
var K;
|
|
2360
|
+
(K = S.target.files) != null && K[0] && (G(S.target.files[0]), S.target.value = "");
|
|
2163
2361
|
};
|
|
2164
|
-
return /* @__PURE__ */ y(
|
|
2165
|
-
/* @__PURE__ */ y(
|
|
2166
|
-
/* @__PURE__ */ y(
|
|
2167
|
-
/* @__PURE__ */ y(
|
|
2362
|
+
return /* @__PURE__ */ y(k, { mb: "4", children: [
|
|
2363
|
+
/* @__PURE__ */ y(F, { align: "center", justify: "between", mb: "2", children: [
|
|
2364
|
+
/* @__PURE__ */ y(F, { align: "center", gap: "1", children: [
|
|
2365
|
+
/* @__PURE__ */ y(h, { as: "label", size: "2", weight: "bold", children: [
|
|
2168
2366
|
n,
|
|
2169
|
-
l && /* @__PURE__ */ i(
|
|
2367
|
+
l && /* @__PURE__ */ i(h, { color: "red", children: " *" })
|
|
2170
2368
|
] }),
|
|
2171
|
-
!
|
|
2172
|
-
/* @__PURE__ */ i(
|
|
2369
|
+
!O && L && f && /* @__PURE__ */ y(ve, { children: [
|
|
2370
|
+
/* @__PURE__ */ i(Be, { content: "Replace document", children: /* @__PURE__ */ i(
|
|
2173
2371
|
je,
|
|
2174
2372
|
{
|
|
2175
2373
|
variant: "ghost",
|
|
2176
2374
|
size: "1",
|
|
2177
2375
|
onClick: () => {
|
|
2178
|
-
var
|
|
2179
|
-
return (
|
|
2376
|
+
var S;
|
|
2377
|
+
return (S = X.current) == null ? void 0 : S.click();
|
|
2180
2378
|
},
|
|
2181
2379
|
"aria-label": "Replace document",
|
|
2182
|
-
children: /* @__PURE__ */ i(
|
|
2380
|
+
children: /* @__PURE__ */ i(Ue, {})
|
|
2183
2381
|
}
|
|
2184
2382
|
) }),
|
|
2185
|
-
/* @__PURE__ */ i(
|
|
2186
|
-
|
|
2187
|
-
}, "aria-label": "Remove document", children: /* @__PURE__ */ i(
|
|
2383
|
+
/* @__PURE__ */ i(Be, { content: "Remove document", children: /* @__PURE__ */ i(je, { variant: "ghost", size: "1", color: "gray", onClick: () => {
|
|
2384
|
+
f && (++Y.current, v(null), z("empty"), r(t, void 0));
|
|
2385
|
+
}, "aria-label": "Remove document", children: /* @__PURE__ */ i(ct, {}) }) })
|
|
2188
2386
|
] })
|
|
2189
2387
|
] }),
|
|
2190
|
-
/* @__PURE__ */ y(
|
|
2191
|
-
/* @__PURE__ */ y(
|
|
2192
|
-
|
|
2388
|
+
/* @__PURE__ */ y(F, { align: "center", gap: "2", children: [
|
|
2389
|
+
/* @__PURE__ */ y(h, { size: "1", color: "gray", children: [
|
|
2390
|
+
xe(b),
|
|
2193
2391
|
" max · ",
|
|
2194
|
-
|
|
2392
|
+
Ae(g)
|
|
2195
2393
|
] }),
|
|
2196
|
-
|
|
2197
|
-
var
|
|
2198
|
-
return (
|
|
2199
|
-
}, disabled:
|
|
2200
|
-
|
|
2394
|
+
O && f && /* @__PURE__ */ y(ze, { size: "1", variant: "soft", onClick: () => {
|
|
2395
|
+
var S;
|
|
2396
|
+
return (S = X.current) == null ? void 0 : S.click();
|
|
2397
|
+
}, disabled: D === "parsing", children: [
|
|
2398
|
+
D === "parsing" ? /* @__PURE__ */ i(_e, { size: "1" }) : /* @__PURE__ */ i(Ue, {}),
|
|
2201
2399
|
"Upload"
|
|
2202
2400
|
] })
|
|
2203
2401
|
] })
|
|
2204
2402
|
] }),
|
|
2205
|
-
(
|
|
2206
|
-
/* @__PURE__ */ i("input", { ref:
|
|
2207
|
-
!
|
|
2403
|
+
(O || L) && V && /* @__PURE__ */ i(h, { size: "2", color: "red", mb: "2", style: { display: "block" }, children: V }),
|
|
2404
|
+
/* @__PURE__ */ i("input", { ref: X, type: "file", style: { display: "none" }, accept: g, onChange: ne }),
|
|
2405
|
+
!O && f && !L && /* @__PURE__ */ i(
|
|
2208
2406
|
"div",
|
|
2209
2407
|
{
|
|
2210
2408
|
role: "button",
|
|
2211
2409
|
tabIndex: 0,
|
|
2212
2410
|
onClick: () => {
|
|
2213
|
-
var
|
|
2214
|
-
return (
|
|
2411
|
+
var S;
|
|
2412
|
+
return (S = X.current) == null ? void 0 : S.click();
|
|
2215
2413
|
},
|
|
2216
|
-
onKeyDown: (
|
|
2217
|
-
var
|
|
2218
|
-
(
|
|
2414
|
+
onKeyDown: (S) => {
|
|
2415
|
+
var K;
|
|
2416
|
+
(S.key === "Enter" || S.key === " ") && (S.preventDefault(), (K = X.current) == null || K.click());
|
|
2219
2417
|
},
|
|
2220
2418
|
onDragEnter: Q,
|
|
2221
2419
|
onDragLeave: Q,
|
|
2222
2420
|
onDragOver: Q,
|
|
2223
|
-
onDrop:
|
|
2421
|
+
onDrop: de,
|
|
2224
2422
|
style: { cursor: "pointer" },
|
|
2225
2423
|
className: [
|
|
2226
2424
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
2227
2425
|
"transition-all duration-200 ease-in-out",
|
|
2228
|
-
|
|
2426
|
+
x ? "border-blue-500 bg-blue-50" : V ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
2229
2427
|
].join(" "),
|
|
2230
|
-
children: /* @__PURE__ */ i(
|
|
2231
|
-
/* @__PURE__ */ i(
|
|
2232
|
-
/* @__PURE__ */ i(
|
|
2233
|
-
] }) :
|
|
2234
|
-
/* @__PURE__ */ i(
|
|
2235
|
-
/* @__PURE__ */ i(
|
|
2236
|
-
/* @__PURE__ */ i(
|
|
2237
|
-
] }) : /* @__PURE__ */ y(
|
|
2238
|
-
/* @__PURE__ */ i(
|
|
2239
|
-
/* @__PURE__ */ i(
|
|
2240
|
-
/* @__PURE__ */ y(
|
|
2241
|
-
|
|
2428
|
+
children: /* @__PURE__ */ i(F, { direction: "column", align: "center", gap: "2", children: D === "parsing" ? /* @__PURE__ */ y(ve, { children: [
|
|
2429
|
+
/* @__PURE__ */ i(_e, { size: "3" }),
|
|
2430
|
+
/* @__PURE__ */ i(h, { size: "2", color: "gray", children: "Parsing document…" })
|
|
2431
|
+
] }) : V ? /* @__PURE__ */ y(ve, { children: [
|
|
2432
|
+
/* @__PURE__ */ i(ut, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
2433
|
+
/* @__PURE__ */ i(h, { size: "2", color: "red", weight: "medium", children: V }),
|
|
2434
|
+
/* @__PURE__ */ i(h, { size: "1", color: "gray", children: "Click to try again" })
|
|
2435
|
+
] }) : /* @__PURE__ */ y(ve, { children: [
|
|
2436
|
+
/* @__PURE__ */ i(Ue, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
2437
|
+
/* @__PURE__ */ i(h, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
|
|
2438
|
+
/* @__PURE__ */ y(h, { size: "1", color: "gray", children: [
|
|
2439
|
+
xe(b),
|
|
2242
2440
|
" max · ",
|
|
2243
|
-
|
|
2441
|
+
Ae(g)
|
|
2244
2442
|
] })
|
|
2245
2443
|
] }) })
|
|
2246
2444
|
}
|
|
2247
2445
|
),
|
|
2248
|
-
!
|
|
2446
|
+
!d && /* @__PURE__ */ i(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: we(a, n) })
|
|
2249
2447
|
] });
|
|
2250
|
-
},
|
|
2448
|
+
}, Po = pe($o), _o = te(
|
|
2251
2449
|
10,
|
|
2252
|
-
|
|
2450
|
+
Me((e) => {
|
|
2253
2451
|
const r = e["x-xml"];
|
|
2254
2452
|
return e.type === "object" && typeof r == "object" && r !== null;
|
|
2255
2453
|
})
|
|
2256
|
-
)
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2454
|
+
), jo = "root", It = "export.xml", Vo = {
|
|
2455
|
+
format: !0,
|
|
2456
|
+
indentBy: " ",
|
|
2457
|
+
ignoreAttributes: !1,
|
|
2458
|
+
attributeNamePrefix: "@_",
|
|
2459
|
+
textNodeName: "#text",
|
|
2460
|
+
suppressBooleanAttributes: !1,
|
|
2461
|
+
processEntities: !0
|
|
2462
|
+
};
|
|
2463
|
+
function Ho(e) {
|
|
2464
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
2465
|
+
return 'declaration must be an object, e.g. { "standalone": "no" }, or {} for the defaults.';
|
|
2466
|
+
const { version: r, encoding: t, standalone: n, ...l } = e, [o] = Object.keys(l);
|
|
2467
|
+
return o ? `declaration has an unknown key "${o}" — only version, encoding and standalone.` : r !== void 0 && r !== "1.0" && r !== "1.1" ? 'declaration.version must be "1.0" or "1.1".' : t !== void 0 && t !== "UTF-8" ? 'declaration.encoding can only be "UTF-8" — the file is always written as UTF-8.' : n !== void 0 && n !== "yes" && n !== "no" ? 'declaration.standalone must be "yes" or "no".' : null;
|
|
2468
|
+
}
|
|
2469
|
+
function cr(e) {
|
|
2470
|
+
for (const r of e) {
|
|
2471
|
+
if (r === null || typeof r != "object" || Array.isArray(r))
|
|
2472
|
+
return "every writeTo entry must be an object.";
|
|
2473
|
+
const { to: t, writeTo: n } = r, l = lr(r, "export");
|
|
2474
|
+
if (l) return `writeTo "${t}": ${l}`;
|
|
2475
|
+
if (n !== void 0) {
|
|
2476
|
+
if (!Array.isArray(n)) return `writeTo "${t}": its nested writeTo must be an array.`;
|
|
2477
|
+
const o = cr(n);
|
|
2478
|
+
if (o) return o;
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
return null;
|
|
2260
2482
|
}
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
return e === void 0 ? "writeTo is required — see docs/xml-export-control.md." : Array.isArray(e) ? e.length === 0 ? "writeTo is declared but empty — declare at least one entry." : null : "writeTo must be an array of { from | formula, to } entries.";
|
|
2483
|
+
function Wo({ writeTo: e, declaration: r }) {
|
|
2484
|
+
return e === void 0 ? "writeTo is required — see docs/xml-export-control.md." : Array.isArray(e) ? e.length === 0 ? "writeTo is declared but empty — declare at least one entry." : cr(e) ?? (r === void 0 ? null : Ho(r)) : "writeTo must be an array of { from | formula, to } entries.";
|
|
2264
2485
|
}
|
|
2265
|
-
function
|
|
2486
|
+
function Bo({ version: e = "1.0", standalone: r }) {
|
|
2487
|
+
return { "@_version": e, "@_encoding": "UTF-8", ...r && { "@_standalone": r } };
|
|
2488
|
+
}
|
|
2489
|
+
function Xo(e) {
|
|
2266
2490
|
return e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
|
|
2267
2491
|
}
|
|
2268
|
-
const
|
|
2269
|
-
var T,
|
|
2270
|
-
const l = (t == null ? void 0 : t["x-xml-export"]) ?? {}, o = l.rootElement ??
|
|
2271
|
-
if (
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2492
|
+
const Yo = ({ path: e, label: r, schema: t, visible: n = !0 }) => {
|
|
2493
|
+
var T, R;
|
|
2494
|
+
const l = (t == null ? void 0 : t["x-xml-export"]) ?? {}, o = l.rootElement ?? jo, s = l.fileName ?? It, u = l.writeTo, a = l.writeBase ?? "root", c = l.declaration, d = Wo(l), f = Ve(), p = a === "parent" ? e.split(".").slice(0, -1).join(".") : "", g = p ? Pe.data((T = f.core) == null ? void 0 : T.data, p) : (R = f.core) == null ? void 0 : R.data, [b, M] = j(null), N = Xo(g), U = $e(async () => {
|
|
2495
|
+
if (u) {
|
|
2496
|
+
M(null);
|
|
2497
|
+
try {
|
|
2498
|
+
const I = ar(await ht(g, u, "export")), { XMLBuilder: A } = await import("fast-xml-parser"), D = {
|
|
2499
|
+
...c && { "?xml": Bo(c) },
|
|
2500
|
+
[o]: I
|
|
2501
|
+
}, z = new A(Vo).build(D);
|
|
2502
|
+
Tn(z, ft(s, g, It), "application/xml");
|
|
2503
|
+
} catch (I) {
|
|
2504
|
+
M(I instanceof Error ? I.message : "This export could not be built.");
|
|
2505
|
+
}
|
|
2280
2506
|
}
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
/* @__PURE__ */ i(f, { as: "label", size: "2", weight: "bold", children: r }),
|
|
2286
|
-
/* @__PURE__ */ y(f, { size: "2", color: "red", style: { display: "block" }, children: [
|
|
2507
|
+
}, [u, g, c, o, s]);
|
|
2508
|
+
return n === !1 ? null : d ? /* @__PURE__ */ y(k, { mb: "4", children: [
|
|
2509
|
+
/* @__PURE__ */ i(h, { as: "label", size: "2", weight: "bold", children: r }),
|
|
2510
|
+
/* @__PURE__ */ y(h, { size: "2", color: "red", style: { display: "block" }, children: [
|
|
2287
2511
|
"Invalid x-xml-export config: ",
|
|
2288
2512
|
d
|
|
2289
2513
|
] })
|
|
2290
|
-
] }) : /* @__PURE__ */ y(
|
|
2291
|
-
/* @__PURE__ */ i(
|
|
2292
|
-
/* @__PURE__ */ y(
|
|
2293
|
-
/* @__PURE__ */ i(
|
|
2514
|
+
] }) : /* @__PURE__ */ y(k, { mb: "4", children: [
|
|
2515
|
+
/* @__PURE__ */ i(h, { as: "label", size: "2", weight: "bold", style: { display: "block", marginBottom: "var(--space-2)" }, children: r }),
|
|
2516
|
+
/* @__PURE__ */ y(ze, { size: "1", variant: "soft", disabled: N, onClick: () => void U(), children: [
|
|
2517
|
+
/* @__PURE__ */ i(at, {}),
|
|
2294
2518
|
"Download XML"
|
|
2295
2519
|
] }),
|
|
2296
|
-
|
|
2520
|
+
b && /* @__PURE__ */ i(h, { size: "2", color: "red", style: { display: "block", marginTop: "var(--space-2)" }, children: b })
|
|
2297
2521
|
] });
|
|
2298
|
-
},
|
|
2522
|
+
}, Ko = pe(Yo), Go = te(
|
|
2299
2523
|
10,
|
|
2300
|
-
|
|
2524
|
+
Me((e) => {
|
|
2301
2525
|
const r = e["x-xml-export"];
|
|
2302
2526
|
return e.type === "object" && typeof r == "object" && r !== null;
|
|
2303
2527
|
})
|
|
2304
|
-
)
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
function wo(e, r, t) {
|
|
2310
|
-
const n = {};
|
|
2311
|
-
for (const [l, o] of Object.entries(t)) {
|
|
2312
|
-
const s = Yt(e, r, o);
|
|
2313
|
-
if (s === void 0) return;
|
|
2314
|
-
n[l] = s;
|
|
2315
|
-
}
|
|
2316
|
-
return n;
|
|
2317
|
-
}
|
|
2318
|
-
async function Eo(e, r) {
|
|
2319
|
-
try {
|
|
2320
|
-
return { status: "ok", value: await jt(e, r) };
|
|
2321
|
-
} catch (t) {
|
|
2322
|
-
return { status: "error", error: st(t) };
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
function To(e, r) {
|
|
2326
|
-
return e == null ? "" : typeof e == "number" ? e.toFixed(Ao(r)) : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
2327
|
-
}
|
|
2328
|
-
function Ao(e) {
|
|
2329
|
-
return Number.isFinite(e) ? Math.min(100, Math.max(0, Math.trunc(e))) : 0;
|
|
2330
|
-
}
|
|
2331
|
-
const xo = "{value}", Ro = 2, Co = {}, So = ({ data: e, handleChange: r, path: t, label: n, schema: l, visible: o = !0 }) => {
|
|
2332
|
-
var N;
|
|
2333
|
-
Ee(o, t, r);
|
|
2334
|
-
const s = l == null ? void 0 : l["x-computed"], c = (s == null ? void 0 : s.inputs) ?? Co, a = (s == null ? void 0 : s.formula) ?? "", d = (s == null ? void 0 : s.format) ?? xo, u = (s == null ? void 0 : s.decimals) ?? Ro, h = We(), p = t.split(".").slice(0, -1).join("."), g = wo((N = h.core) == null ? void 0 : N.data, p, c), b = g ? JSON.stringify(g) : null, I = h.readonly === !0, [O, T] = j(() => typeof e == "number" ? "ok" : "unavailable"), [A, k] = j(() => typeof e == "number" ? e : null), [M, L] = j(null);
|
|
2335
|
-
return de(() => {
|
|
2528
|
+
), qo = "{value}", Jo = 2, Zo = {}, Qo = ({ data: e, handleChange: r, path: t, label: n, schema: l, visible: o = !0 }) => {
|
|
2529
|
+
var D;
|
|
2530
|
+
Re(o, t, r);
|
|
2531
|
+
const s = l == null ? void 0 : l["x-computed"], u = (s == null ? void 0 : s.inputs) ?? Zo, a = (s == null ? void 0 : s.formula) ?? "", c = (s == null ? void 0 : s.format) ?? qo, d = (s == null ? void 0 : s.decimals) ?? Jo, f = Ve(), p = t.split(".").slice(0, -1).join("."), g = So((D = f.core) == null ? void 0 : D.data, p, u), b = g ? JSON.stringify(g) : null, M = f.readonly === !0, [N, U] = j(() => typeof e == "number" ? "ok" : "unavailable"), [T, R] = j(() => typeof e == "number" ? e : null), [I, A] = j(null);
|
|
2532
|
+
return me(() => {
|
|
2336
2533
|
if (!o) return;
|
|
2337
|
-
let
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2534
|
+
let z = !1;
|
|
2535
|
+
const V = (v) => {
|
|
2536
|
+
M || v !== e && r(t, v);
|
|
2340
2537
|
};
|
|
2341
2538
|
if (g === void 0) {
|
|
2342
|
-
|
|
2539
|
+
U("unavailable"), A(null), R(null), V(void 0);
|
|
2343
2540
|
return;
|
|
2344
2541
|
}
|
|
2345
|
-
return
|
|
2346
|
-
if (
|
|
2347
|
-
const
|
|
2348
|
-
if (
|
|
2349
|
-
|
|
2542
|
+
return U((v) => v === "ok" ? v : "loading"), Oo(g, a).then((v) => {
|
|
2543
|
+
if (z) return;
|
|
2544
|
+
const x = v.status === "ok" && typeof v.value == "number" && Number.isFinite(v.value) ? v.value : null;
|
|
2545
|
+
if (x === null) {
|
|
2546
|
+
U("error"), A(
|
|
2350
2547
|
v.status === "error" ? v.error ?? "Unable to compute value." : "Computed value must be a number."
|
|
2351
|
-
),
|
|
2548
|
+
), R(null), V(void 0);
|
|
2352
2549
|
return;
|
|
2353
2550
|
}
|
|
2354
|
-
|
|
2551
|
+
U("ok"), A(null), R(x), V(x);
|
|
2355
2552
|
}), () => {
|
|
2356
|
-
|
|
2553
|
+
z = !0;
|
|
2357
2554
|
};
|
|
2358
|
-
}, [b, a, o,
|
|
2359
|
-
/* @__PURE__ */ i(
|
|
2360
|
-
|
|
2361
|
-
/* @__PURE__ */ i(
|
|
2362
|
-
/* @__PURE__ */ i(
|
|
2363
|
-
] }) :
|
|
2364
|
-
l.description && /* @__PURE__ */ i(
|
|
2555
|
+
}, [b, a, o, M]), o === !1 ? null : /* @__PURE__ */ i(k, { mb: "4", children: /* @__PURE__ */ y(F, { direction: "column", gap: "1", children: [
|
|
2556
|
+
/* @__PURE__ */ i(h, { as: "label", size: "2", weight: "bold", children: n }),
|
|
2557
|
+
N === "unavailable" ? /* @__PURE__ */ i(h, { size: "2", color: "gray", children: "Not yet available." }) : N === "loading" ? /* @__PURE__ */ y(F, { align: "center", gap: "2", children: [
|
|
2558
|
+
/* @__PURE__ */ i(_e, { size: "1" }),
|
|
2559
|
+
/* @__PURE__ */ i(h, { size: "2", color: "gray", children: "Computing…" })
|
|
2560
|
+
] }) : N === "error" ? /* @__PURE__ */ i(h, { size: "2", color: "red", children: I }) : /* @__PURE__ */ i(h, { size: "2", children: rt(c, { value: or(T, d) }) }),
|
|
2561
|
+
l.description && /* @__PURE__ */ i(h, { size: "1", color: "gray", children: l.description })
|
|
2365
2562
|
] }) });
|
|
2366
|
-
},
|
|
2563
|
+
}, ei = pe(Qo), ti = te(
|
|
2367
2564
|
5,
|
|
2368
|
-
|
|
2565
|
+
Me((e) => {
|
|
2369
2566
|
const r = e["x-computed"];
|
|
2370
2567
|
return e.type === "number" && typeof r == "object" && r !== null;
|
|
2371
2568
|
})
|
|
2372
|
-
),
|
|
2569
|
+
), ur = "seq", kt = 2, ri = (e) => e == null || e === "", dr = (e) => typeof e == "object" && e !== null && !Array.isArray(e) ? e : void 0, ni = (e) => {
|
|
2373
2570
|
const r = e == null ? void 0 : e["x-template"];
|
|
2374
2571
|
if (typeof r != "object" || r === null) return;
|
|
2375
2572
|
const { template: t, inputs: n } = r;
|
|
2376
2573
|
if (!(typeof t != "string" || t === ""))
|
|
2377
2574
|
return { template: t, inputs: n };
|
|
2378
|
-
},
|
|
2575
|
+
}, mt = (e) => typeof e == "object" && e.name === ur && e.arg !== void 0, oi = (e) => e.every((r, t) => !mt(r) || typeof e[t - 1] != "object" && typeof e[t + 1] != "object"), ii = (e) => {
|
|
2379
2576
|
const r = /* @__PURE__ */ new Set();
|
|
2380
|
-
for (const t of
|
|
2577
|
+
for (const t of dt(e))
|
|
2381
2578
|
typeof t == "object" && t.arg === void 0 && r.add(t.name);
|
|
2382
2579
|
return [...r];
|
|
2383
|
-
},
|
|
2580
|
+
}, si = (e) => {
|
|
2384
2581
|
const r = [];
|
|
2385
2582
|
for (const [t, n] of Object.entries((e == null ? void 0 : e.properties) ?? {})) {
|
|
2386
|
-
const l =
|
|
2583
|
+
const l = ni(n);
|
|
2387
2584
|
l && r.push([t, l]);
|
|
2388
2585
|
}
|
|
2389
2586
|
return r;
|
|
2390
|
-
},
|
|
2587
|
+
}, li = (e, r, t) => {
|
|
2391
2588
|
var l;
|
|
2392
2589
|
const n = {};
|
|
2393
|
-
for (const o of
|
|
2394
|
-
const s =
|
|
2590
|
+
for (const o of ii(t.template)) {
|
|
2591
|
+
const s = nr(e, r, ((l = t.inputs) == null ? void 0 : l[o]) ?? o);
|
|
2395
2592
|
n[o] = typeof s == "string" || typeof s == "number" || typeof s == "boolean" ? String(s) : "";
|
|
2396
2593
|
}
|
|
2397
2594
|
return n;
|
|
2398
|
-
},
|
|
2399
|
-
const t = r.trim() === "" ?
|
|
2400
|
-
return `${e}`.padStart(Number.isInteger(t) && t >= 0 ? t :
|
|
2401
|
-
},
|
|
2595
|
+
}, ai = (e) => (r) => {
|
|
2596
|
+
const t = r.trim() === "" ? kt : Number(r);
|
|
2597
|
+
return `${e}`.padStart(Number.isInteger(t) && t >= 0 ? t : kt, "0");
|
|
2598
|
+
}, ci = (e) => {
|
|
2402
2599
|
const r = (n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2403
2600
|
let t = "";
|
|
2404
|
-
for (const n of
|
|
2405
|
-
typeof n == "string" ? t += r(n) : t +=
|
|
2601
|
+
for (const n of dt(e))
|
|
2602
|
+
typeof n == "string" ? t += r(n) : t += mt(n) ? "(\\d+)" : ".*?";
|
|
2406
2603
|
return new RegExp(`^${t}$`);
|
|
2407
|
-
},
|
|
2604
|
+
}, ui = (e, r, t) => {
|
|
2408
2605
|
var o, s;
|
|
2409
|
-
const n =
|
|
2606
|
+
const n = ci(t.template);
|
|
2410
2607
|
let l = 0;
|
|
2411
|
-
for (const
|
|
2412
|
-
const a = (o =
|
|
2608
|
+
for (const u of e) {
|
|
2609
|
+
const a = (o = dr(u)) == null ? void 0 : o[r];
|
|
2413
2610
|
if (typeof a != "string") continue;
|
|
2414
|
-
const
|
|
2415
|
-
Number.isFinite(
|
|
2611
|
+
const c = Number((s = n.exec(a)) == null ? void 0 : s[1]);
|
|
2612
|
+
Number.isFinite(c) && c > l && (l = c);
|
|
2416
2613
|
}
|
|
2417
2614
|
return l;
|
|
2418
|
-
},
|
|
2419
|
-
const s =
|
|
2615
|
+
}, di = (e, r, t, n, l, o) => {
|
|
2616
|
+
const s = si(e);
|
|
2420
2617
|
if (s.length === 0) return r;
|
|
2421
|
-
const
|
|
2422
|
-
if (!
|
|
2423
|
-
const a = { ...
|
|
2424
|
-
for (const [
|
|
2425
|
-
if (!
|
|
2426
|
-
const
|
|
2427
|
-
if (
|
|
2428
|
-
if (!
|
|
2618
|
+
const u = dr(r);
|
|
2619
|
+
if (!u) return r;
|
|
2620
|
+
const a = { ...u };
|
|
2621
|
+
for (const [c, d] of s) {
|
|
2622
|
+
if (!ri(a[c])) continue;
|
|
2623
|
+
const f = dt(d.template), p = {};
|
|
2624
|
+
if (f.some(mt)) {
|
|
2625
|
+
if (!oi(f)) {
|
|
2429
2626
|
console.warn(
|
|
2430
|
-
`x-template: {seq(…)} needs literal text between it and other placeholders; not numbering "${
|
|
2627
|
+
`x-template: {seq(…)} needs literal text between it and other placeholders; not numbering "${d.template}"`
|
|
2431
2628
|
);
|
|
2432
2629
|
continue;
|
|
2433
2630
|
}
|
|
2434
|
-
const g = Math.max(o[
|
|
2435
|
-
o[
|
|
2631
|
+
const g = Math.max(o[c] ?? 0, ui(t, c, d)) + 1;
|
|
2632
|
+
o[c] = g, p[ur] = ai(g);
|
|
2436
2633
|
}
|
|
2437
|
-
a[
|
|
2634
|
+
a[c] = rt(d.template, li(n, l, d), p);
|
|
2438
2635
|
}
|
|
2439
2636
|
return a;
|
|
2440
|
-
},
|
|
2441
|
-
const s =
|
|
2442
|
-
return /* @__PURE__ */ i(
|
|
2443
|
-
var
|
|
2444
|
-
const a =
|
|
2637
|
+
}, fi = ({ path: e, items: r, itemsSchema: t, rootSchema: n, addItem: l, sequences: o }) => {
|
|
2638
|
+
const s = Ve();
|
|
2639
|
+
return /* @__PURE__ */ i(k, { mt: "2", children: /* @__PURE__ */ y(ze, { type: "button", variant: "surface", onClick: () => {
|
|
2640
|
+
var c;
|
|
2641
|
+
const a = di(
|
|
2445
2642
|
t,
|
|
2446
|
-
|
|
2643
|
+
Ar(t, n),
|
|
2447
2644
|
r,
|
|
2448
|
-
(
|
|
2645
|
+
(c = s.core) == null ? void 0 : c.data,
|
|
2449
2646
|
// The object CONTAINING the array, not the row: a row being filled is
|
|
2450
2647
|
// empty, so what a template reaches for sits alongside the array.
|
|
2451
2648
|
e.split(".").slice(0, -1).join("."),
|
|
@@ -2453,10 +2650,10 @@ const xo = "{value}", Ro = 2, Co = {}, So = ({ data: e, handleChange: r, path: t
|
|
|
2453
2650
|
);
|
|
2454
2651
|
l && l(e, a)();
|
|
2455
2652
|
}, children: [
|
|
2456
|
-
/* @__PURE__ */ i(
|
|
2653
|
+
/* @__PURE__ */ i(kr, {}),
|
|
2457
2654
|
"Add Item"
|
|
2458
2655
|
] }) });
|
|
2459
|
-
},
|
|
2656
|
+
}, pi = ({
|
|
2460
2657
|
data: e,
|
|
2461
2658
|
path: r,
|
|
2462
2659
|
schema: t,
|
|
@@ -2464,52 +2661,52 @@ const xo = "{value}", Ro = 2, Co = {}, So = ({ data: e, handleChange: r, path: t
|
|
|
2464
2661
|
enabled: l,
|
|
2465
2662
|
visible: o,
|
|
2466
2663
|
addItem: s,
|
|
2467
|
-
removeItems:
|
|
2664
|
+
removeItems: u,
|
|
2468
2665
|
rootSchema: a,
|
|
2469
|
-
arraySchema:
|
|
2666
|
+
arraySchema: c
|
|
2470
2667
|
}) => {
|
|
2471
|
-
const
|
|
2472
|
-
if (o === !1 || !
|
|
2668
|
+
const d = ue({}), f = c ? t : t.items, p = c || t;
|
|
2669
|
+
if (o === !1 || !f || typeof f != "object" || Array.isArray(f))
|
|
2473
2670
|
return null;
|
|
2474
|
-
const g =
|
|
2475
|
-
if (
|
|
2476
|
-
const
|
|
2477
|
-
|
|
2671
|
+
const g = f, b = Array.isArray(e) ? e : [], M = p.title || "Array Items", N = n.options ?? {}, U = l && N.addable !== !1, T = l && N.removable !== !1, R = N.itemLabel || "Item", I = (A) => {
|
|
2672
|
+
if (u) {
|
|
2673
|
+
const D = u(r, [A]);
|
|
2674
|
+
D && D();
|
|
2478
2675
|
}
|
|
2479
2676
|
};
|
|
2480
|
-
return /* @__PURE__ */ i(
|
|
2481
|
-
/* @__PURE__ */ i(
|
|
2482
|
-
b.length === 0 && /* @__PURE__ */ i(
|
|
2483
|
-
b.map((
|
|
2484
|
-
var
|
|
2485
|
-
const
|
|
2486
|
-
return /* @__PURE__ */ i(
|
|
2487
|
-
/* @__PURE__ */ y(
|
|
2488
|
-
/* @__PURE__ */ y(
|
|
2489
|
-
|
|
2677
|
+
return /* @__PURE__ */ i(k, { mb: "6", children: /* @__PURE__ */ y(F, { direction: "column", gap: "4", children: [
|
|
2678
|
+
/* @__PURE__ */ i(h, { as: "div", size: "4", weight: "bold", children: M }),
|
|
2679
|
+
b.length === 0 && /* @__PURE__ */ i(k, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ i(h, { size: "2", color: "gray", children: "No items have been added yet." }) }),
|
|
2680
|
+
b.map((A, D) => {
|
|
2681
|
+
var V;
|
|
2682
|
+
const z = `${r}.${D}`;
|
|
2683
|
+
return /* @__PURE__ */ i(jt, { size: "3", variant: "surface", children: /* @__PURE__ */ y(F, { direction: "column", gap: "4", children: [
|
|
2684
|
+
/* @__PURE__ */ y(F, { justify: "between", align: "center", children: [
|
|
2685
|
+
/* @__PURE__ */ y(h, { size: "3", weight: "bold", children: [
|
|
2686
|
+
R,
|
|
2490
2687
|
" ",
|
|
2491
|
-
|
|
2688
|
+
D + 1
|
|
2492
2689
|
] }),
|
|
2493
|
-
|
|
2494
|
-
|
|
2690
|
+
T && /* @__PURE__ */ y(
|
|
2691
|
+
ze,
|
|
2495
2692
|
{
|
|
2496
2693
|
type: "button",
|
|
2497
2694
|
color: "red",
|
|
2498
2695
|
variant: "soft",
|
|
2499
|
-
onClick: () =>
|
|
2696
|
+
onClick: () => I(D),
|
|
2500
2697
|
title: "Remove item",
|
|
2501
2698
|
children: [
|
|
2502
|
-
/* @__PURE__ */ i(
|
|
2699
|
+
/* @__PURE__ */ i(Ir, {}),
|
|
2503
2700
|
"Remove"
|
|
2504
2701
|
]
|
|
2505
2702
|
}
|
|
2506
2703
|
)
|
|
2507
2704
|
] }),
|
|
2508
|
-
/* @__PURE__ */ i(
|
|
2509
|
-
|
|
2705
|
+
/* @__PURE__ */ i(k, { children: /* @__PURE__ */ i(
|
|
2706
|
+
Ye,
|
|
2510
2707
|
{
|
|
2511
2708
|
schema: g,
|
|
2512
|
-
uischema: ((
|
|
2709
|
+
uischema: ((V = n.options) == null ? void 0 : V.detail) || (g.type === "object" || g.properties ? {
|
|
2513
2710
|
type: "VerticalLayout",
|
|
2514
2711
|
elements: Object.keys(g.properties || {}).map((v) => ({
|
|
2515
2712
|
type: "Control",
|
|
@@ -2519,98 +2716,101 @@ const xo = "{value}", Ro = 2, Co = {}, So = ({ data: e, handleChange: r, path: t
|
|
|
2519
2716
|
type: "Control",
|
|
2520
2717
|
scope: "#"
|
|
2521
2718
|
}),
|
|
2522
|
-
path:
|
|
2719
|
+
path: z,
|
|
2523
2720
|
enabled: l,
|
|
2524
2721
|
renderers: void 0,
|
|
2525
2722
|
cells: void 0
|
|
2526
2723
|
}
|
|
2527
2724
|
) })
|
|
2528
|
-
] }) },
|
|
2725
|
+
] }) }, z);
|
|
2529
2726
|
}),
|
|
2530
|
-
|
|
2531
|
-
|
|
2727
|
+
U && /* @__PURE__ */ i(
|
|
2728
|
+
fi,
|
|
2532
2729
|
{
|
|
2533
2730
|
path: r,
|
|
2534
2731
|
items: b,
|
|
2535
2732
|
itemsSchema: g,
|
|
2536
2733
|
rootSchema: a,
|
|
2537
2734
|
addItem: s,
|
|
2538
|
-
sequences:
|
|
2735
|
+
sequences: d
|
|
2539
2736
|
}
|
|
2540
2737
|
)
|
|
2541
2738
|
] }) });
|
|
2542
|
-
},
|
|
2739
|
+
}, Lt = Sr(pi), hi = te(3, Rr), mi = ({ uischema: e, visible: r }) => {
|
|
2543
2740
|
const t = e;
|
|
2544
|
-
return r === !1 ? null : /* @__PURE__ */ i(
|
|
2545
|
-
},
|
|
2546
|
-
{ tester:
|
|
2547
|
-
{ tester:
|
|
2548
|
-
{ tester:
|
|
2549
|
-
{ tester:
|
|
2550
|
-
{ tester:
|
|
2551
|
-
{ tester:
|
|
2552
|
-
{ tester:
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
{ tester:
|
|
2557
|
-
{ tester:
|
|
2558
|
-
{ tester:
|
|
2559
|
-
{ tester:
|
|
2741
|
+
return r === !1 ? null : /* @__PURE__ */ i(k, { mb: "4", children: /* @__PURE__ */ i(_t, { size: "4", children: t.text }) });
|
|
2742
|
+
}, gi = te(1, Xe("Label")), yi = te(3, Cr), Oi = [
|
|
2743
|
+
{ tester: Fr, renderer: Ur },
|
|
2744
|
+
{ tester: Pr, renderer: _r },
|
|
2745
|
+
{ tester: Vr, renderer: Hr },
|
|
2746
|
+
{ tester: Br, renderer: Xr },
|
|
2747
|
+
{ tester: on, renderer: nn },
|
|
2748
|
+
{ tester: Kr, renderer: Gr },
|
|
2749
|
+
{ tester: un, renderer: dn },
|
|
2750
|
+
// The layout renderers take their props from withJsonFormsLayoutProps, which
|
|
2751
|
+
// evaluates the layout's rule into `visible` and `enabled`, as
|
|
2752
|
+
// withJsonFormsControlProps does for the controls.
|
|
2753
|
+
{ tester: pn, renderer: Ge(fn) },
|
|
2754
|
+
{ tester: mn, renderer: Ge(hn) },
|
|
2755
|
+
{ tester: yn, renderer: Ge(gn) },
|
|
2756
|
+
{ tester: vn, renderer: Ge(bn) },
|
|
2757
|
+
{ tester: In, renderer: Dn },
|
|
2758
|
+
{ tester: po, renderer: fo },
|
|
2759
|
+
{ tester: wo, renderer: vo },
|
|
2560
2760
|
// After SpreadsheetControl on purpose: both testers rank 10, and a tie is
|
|
2561
2761
|
// resolved by registration order (see XmlControlTester's comment).
|
|
2562
|
-
{ tester:
|
|
2762
|
+
{ tester: _o, renderer: Po },
|
|
2563
2763
|
// Also rank 10, but matches the distinct `x-xml-export` keyword rather
|
|
2564
2764
|
// than `x-xml`, so it never ties with XmlControlTester on the same schema
|
|
2565
2765
|
// node (see XmlExportControlTester's own comment).
|
|
2566
|
-
{ tester:
|
|
2567
|
-
{ tester:
|
|
2568
|
-
{ tester:
|
|
2569
|
-
{ tester:
|
|
2570
|
-
{ tester:
|
|
2766
|
+
{ tester: Go, renderer: Ko },
|
|
2767
|
+
{ tester: ti, renderer: ei },
|
|
2768
|
+
{ tester: hi, renderer: Lt },
|
|
2769
|
+
{ tester: yi, renderer: Lt },
|
|
2770
|
+
{ tester: gi, renderer: mi }
|
|
2571
2771
|
];
|
|
2572
2772
|
export {
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2773
|
+
Lt as ArrayControl,
|
|
2774
|
+
hi as ArrayControlTester,
|
|
2775
|
+
jr as BooleanControl,
|
|
2776
|
+
Vr as BooleanControlTester,
|
|
2777
|
+
bn as CategorizationLayoutRenderer,
|
|
2778
|
+
vn as CategorizationLayoutTester,
|
|
2779
|
+
ei as ComputedControl,
|
|
2780
|
+
ti as ComputedControlTester,
|
|
2781
|
+
cn as DateControl,
|
|
2782
|
+
un as DateControlTester,
|
|
2783
|
+
Dn as FileControl,
|
|
2784
|
+
In as FileControlTester,
|
|
2785
|
+
gn as GroupLayoutRenderer,
|
|
2786
|
+
yn as GroupLayoutTester,
|
|
2787
|
+
hn as HorizontalLayoutRenderer,
|
|
2788
|
+
mn as HorizontalLayoutTester,
|
|
2789
|
+
mi as LabelRenderer,
|
|
2790
|
+
gi as LabelTester,
|
|
2791
|
+
$r as NumberControl,
|
|
2792
|
+
Pr as NumberControlTester,
|
|
2793
|
+
Wr as RadioControl,
|
|
2794
|
+
Br as RadioControlTester,
|
|
2795
|
+
nn as SearchSelectControl,
|
|
2796
|
+
on as SearchSelectControlTester,
|
|
2797
|
+
Si as SearchServiceProvider,
|
|
2798
|
+
Yr as SelectControl,
|
|
2799
|
+
Kr as SelectControlTester,
|
|
2800
|
+
fo as SpreadsheetControl,
|
|
2801
|
+
po as SpreadsheetControlTester,
|
|
2802
|
+
vo as SpreadsheetExportControl,
|
|
2803
|
+
wo as SpreadsheetExportControlTester,
|
|
2804
|
+
zr as TextControl,
|
|
2805
|
+
Fr as TextControlTester,
|
|
2806
|
+
Ci as UploadProvider,
|
|
2807
|
+
fn as VerticalLayoutRenderer,
|
|
2808
|
+
pn as VerticalLayoutTester,
|
|
2809
|
+
Po as XmlControl,
|
|
2810
|
+
_o as XmlControlTester,
|
|
2811
|
+
Ko as XmlExportControl,
|
|
2812
|
+
Go as XmlExportControlTester,
|
|
2813
|
+
Oi as radixRenderers,
|
|
2814
|
+
Mr as useSearchService,
|
|
2815
|
+
Lr as useUpload
|
|
2616
2816
|
};
|