@opennsw/jsonforms-renderers 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/jsonforms-renderers.css +1 -1
- package/dist/renderers.cjs.js +2 -2
- package/dist/renderers.es.js +664 -657
- package/package.json +1 -1
package/dist/renderers.es.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as n, jsxs as
|
|
5
|
-
import { useContext as
|
|
6
|
-
import { rankWith as W, isStringControl as
|
|
7
|
-
import { withJsonFormsControlProps as
|
|
8
|
-
import { Box as
|
|
9
|
-
import { ChevronDownIcon as
|
|
10
|
-
import
|
|
11
|
-
import { read as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
1
|
+
var cr = Object.defineProperty;
|
|
2
|
+
var ar = (e, t, r) => t in e ? cr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var Pe = (e, t, r) => ar(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { jsx as n, jsxs as p, Fragment as Te } from "react/jsx-runtime";
|
|
5
|
+
import { useContext as Xe, createContext as Ye, useMemo as dr, useEffect as ge, useState as _, useRef as de, useCallback as ke } from "react";
|
|
6
|
+
import { rankWith as W, isStringControl as ur, or as Me, isNumberControl as fr, isIntegerControl as hr, isBooleanControl as pr, isEnumControl as Je, isOneOfControl as Ze, schemaMatches as Fe, isDateControl as gr, isDateTimeControl as mr, isTimeControl as yr, uiTypeIs as Ae, and as vr, createDefaultValue as br, isObjectArrayControl as Er, isPrimitiveArrayControl as wr } from "@jsonforms/core";
|
|
7
|
+
import { withJsonFormsControlProps as oe, JsonFormsDispatch as Se, withJsonFormsArrayControlProps as Rr } from "@jsonforms/react";
|
|
8
|
+
import { Box as C, Flex as T, Text as f, TextField as ve, Checkbox as Cr, RadioGroup as Ve, Select as Oe, ScrollArea as Tr, Spinner as ze, Button as Le, Tabs as Ie, Heading as qe, Card as $e, IconButton as je, Table as ne } from "@radix-ui/themes";
|
|
9
|
+
import { ChevronDownIcon as Ar, FileTextIcon as Qe, CheckCircledIcon as er, Cross2Icon as rr, ExclamationTriangleIcon as tr, UploadIcon as nr, TrashIcon as Sr, PlusIcon as Nr } from "@radix-ui/react-icons";
|
|
10
|
+
import Or from "dayjs";
|
|
11
|
+
import { read as Ir, utils as xr } from "@e965/xlsx";
|
|
12
|
+
const or = Ye(null);
|
|
13
|
+
function tn({
|
|
14
14
|
children: e,
|
|
15
15
|
onUpload: t,
|
|
16
16
|
getDownloadUrl: r
|
|
17
17
|
}) {
|
|
18
18
|
const d = { onUpload: t, getDownloadUrl: r };
|
|
19
|
-
return /* @__PURE__ */ n(
|
|
19
|
+
return /* @__PURE__ */ n(or.Provider, { value: d, children: e });
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
21
|
+
function Lr() {
|
|
22
|
+
return Xe(or);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
24
|
+
const lr = Ye(null);
|
|
25
|
+
function nn({
|
|
26
26
|
children: e,
|
|
27
27
|
services: t
|
|
28
28
|
}) {
|
|
29
|
-
const r =
|
|
30
|
-
return /* @__PURE__ */ n(
|
|
29
|
+
const r = dr(() => t, [t]);
|
|
30
|
+
return /* @__PURE__ */ n(lr.Provider, { value: r, children: e });
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const t =
|
|
32
|
+
function Mr(e) {
|
|
33
|
+
const t = Xe(lr);
|
|
34
34
|
return !t || !e ? null : t[e] ?? null;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const ue = (e, t, r, d = void 0) => {
|
|
37
|
+
ge(() => {
|
|
38
38
|
e === !1 && r(t, d);
|
|
39
39
|
}, [e, t, r, d]);
|
|
40
|
-
},
|
|
40
|
+
}, le = (e, t) => e ? e.split(`
|
|
41
41
|
`).map((r) => r.trim() === "is a required property" ? `${t || "This field"} is required` : r).join(`
|
|
42
|
-
`) : "",
|
|
42
|
+
`) : "", Dr = ({
|
|
43
43
|
data: e,
|
|
44
44
|
handleChange: t,
|
|
45
45
|
path: r,
|
|
46
46
|
label: d,
|
|
47
|
-
required:
|
|
47
|
+
required: g,
|
|
48
48
|
errors: a,
|
|
49
49
|
uischema: c,
|
|
50
50
|
schema: s,
|
|
@@ -52,91 +52,91 @@ const fe = (e, t, r, d = void 0) => {
|
|
|
52
52
|
visible: i = !0
|
|
53
53
|
}) => {
|
|
54
54
|
var y;
|
|
55
|
-
if (
|
|
55
|
+
if (ue(i, r, t), i === !1)
|
|
56
56
|
return null;
|
|
57
57
|
const l = a.length === 0;
|
|
58
|
-
return /* @__PURE__ */ n(
|
|
59
|
-
/* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
|
|
59
|
+
/* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
60
60
|
d,
|
|
61
61
|
" ",
|
|
62
|
-
|
|
62
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
63
63
|
] }),
|
|
64
64
|
/* @__PURE__ */ n(
|
|
65
|
-
|
|
65
|
+
ve.Root,
|
|
66
66
|
{
|
|
67
67
|
value: e || "",
|
|
68
|
-
onChange: (
|
|
68
|
+
onChange: (h) => t(r, h.target.value),
|
|
69
69
|
disabled: !o,
|
|
70
70
|
placeholder: (y = c.options) == null ? void 0 : y.placeholder,
|
|
71
71
|
color: l ? void 0 : "red",
|
|
72
72
|
id: r
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
!l && /* @__PURE__ */ n(
|
|
76
|
-
s.description && /* @__PURE__ */ n(
|
|
75
|
+
!l && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(a, d) }),
|
|
76
|
+
s.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: s.description })
|
|
77
77
|
] }) });
|
|
78
|
-
},
|
|
78
|
+
}, zr = W(1, ur), Ur = oe(Dr), kr = ({
|
|
79
79
|
data: e,
|
|
80
80
|
handleChange: t,
|
|
81
81
|
path: r,
|
|
82
82
|
label: d,
|
|
83
|
-
required:
|
|
83
|
+
required: g,
|
|
84
84
|
errors: a,
|
|
85
85
|
uischema: c,
|
|
86
86
|
schema: s,
|
|
87
87
|
enabled: o,
|
|
88
88
|
visible: i = !0
|
|
89
89
|
}) => {
|
|
90
|
-
var
|
|
91
|
-
if (
|
|
90
|
+
var h;
|
|
91
|
+
if (ue(i, r, t), i === !1)
|
|
92
92
|
return null;
|
|
93
|
-
const l = a.length === 0, y = (
|
|
94
|
-
if (
|
|
93
|
+
const l = a.length === 0, y = (u) => {
|
|
94
|
+
if (u === "") {
|
|
95
95
|
t(r, void 0);
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
-
const v = Number(
|
|
98
|
+
const v = Number(u);
|
|
99
99
|
isNaN(v) || t(r, v);
|
|
100
100
|
};
|
|
101
|
-
return /* @__PURE__ */ n(
|
|
102
|
-
/* @__PURE__ */
|
|
101
|
+
return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
|
|
102
|
+
/* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
103
103
|
d,
|
|
104
104
|
" ",
|
|
105
|
-
|
|
105
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
106
106
|
] }),
|
|
107
107
|
/* @__PURE__ */ n(
|
|
108
|
-
|
|
108
|
+
ve.Root,
|
|
109
109
|
{
|
|
110
110
|
type: "number",
|
|
111
111
|
value: e ?? "",
|
|
112
|
-
onChange: (
|
|
112
|
+
onChange: (u) => y(u.target.value),
|
|
113
113
|
disabled: !o,
|
|
114
|
-
placeholder: (
|
|
114
|
+
placeholder: (h = c.options) == null ? void 0 : h.placeholder,
|
|
115
115
|
color: l ? void 0 : "red",
|
|
116
116
|
id: r
|
|
117
117
|
}
|
|
118
118
|
),
|
|
119
|
-
!l && /* @__PURE__ */ n(
|
|
120
|
-
s.description && /* @__PURE__ */ n(
|
|
119
|
+
!l && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(a, d) }),
|
|
120
|
+
s.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: s.description })
|
|
121
121
|
] }) });
|
|
122
|
-
},
|
|
122
|
+
}, Fr = W(2, Me(fr, hr)), $r = oe(kr), _r = ({
|
|
123
123
|
data: e,
|
|
124
124
|
handleChange: t,
|
|
125
125
|
path: r,
|
|
126
126
|
label: d,
|
|
127
|
-
required:
|
|
127
|
+
required: g,
|
|
128
128
|
errors: a,
|
|
129
129
|
schema: c,
|
|
130
130
|
enabled: s,
|
|
131
131
|
visible: o = !0
|
|
132
132
|
}) => {
|
|
133
|
-
if (
|
|
133
|
+
if (ue(o, r, t), o === !1)
|
|
134
134
|
return null;
|
|
135
135
|
const i = a.length === 0;
|
|
136
|
-
return /* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
136
|
+
return /* @__PURE__ */ p(C, { mb: "4", children: [
|
|
137
|
+
/* @__PURE__ */ p(T, { gap: "2", align: "center", children: [
|
|
138
138
|
/* @__PURE__ */ n(
|
|
139
|
-
|
|
139
|
+
Cr,
|
|
140
140
|
{
|
|
141
141
|
checked: !!e,
|
|
142
142
|
onCheckedChange: (l) => t(r, l === !0),
|
|
@@ -144,48 +144,48 @@ const fe = (e, t, r, d = void 0) => {
|
|
|
144
144
|
id: r
|
|
145
145
|
}
|
|
146
146
|
),
|
|
147
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ p(f, { as: "label", size: "2", htmlFor: r, children: [
|
|
148
148
|
d,
|
|
149
149
|
" ",
|
|
150
|
-
|
|
150
|
+
g && "*"
|
|
151
151
|
] })
|
|
152
152
|
] }),
|
|
153
|
-
!i && /* @__PURE__ */ n(
|
|
154
|
-
c.description && /* @__PURE__ */ n(
|
|
153
|
+
!i && /* @__PURE__ */ n(f, { color: "red", size: "1", className: "block mt-1", children: le(a, d) }),
|
|
154
|
+
c.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", className: "block mt-1", children: c.description })
|
|
155
155
|
] });
|
|
156
|
-
},
|
|
156
|
+
}, Pr = W(2, pr), Vr = oe(_r), Hr = ({
|
|
157
157
|
data: e,
|
|
158
158
|
handleChange: t,
|
|
159
159
|
path: r,
|
|
160
160
|
label: d,
|
|
161
|
-
required:
|
|
161
|
+
required: g,
|
|
162
162
|
errors: a,
|
|
163
163
|
schema: c,
|
|
164
164
|
enabled: s,
|
|
165
165
|
visible: o = !0
|
|
166
166
|
}) => {
|
|
167
|
-
if (
|
|
167
|
+
if (ue(o, r, t), o === !1)
|
|
168
168
|
return null;
|
|
169
169
|
const i = a.length === 0;
|
|
170
170
|
let l = [];
|
|
171
|
-
c.enum ? l = c.enum.map((
|
|
172
|
-
value:
|
|
173
|
-
label:
|
|
171
|
+
c.enum ? l = c.enum.map((h) => ({ value: h, label: String(h) })) : c.oneOf && (l = c.oneOf.map((h) => ({
|
|
172
|
+
value: h.const,
|
|
173
|
+
label: h.title || String(h.const)
|
|
174
174
|
})));
|
|
175
175
|
const y = e;
|
|
176
|
-
return /* @__PURE__ */ n(
|
|
177
|
-
/* @__PURE__ */
|
|
176
|
+
return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
|
|
177
|
+
/* @__PURE__ */ p(f, { as: "div", size: "2", weight: "bold", children: [
|
|
178
178
|
d,
|
|
179
179
|
" ",
|
|
180
|
-
|
|
180
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
181
181
|
] }),
|
|
182
182
|
/* @__PURE__ */ n(
|
|
183
|
-
|
|
183
|
+
Ve.Root,
|
|
184
184
|
{
|
|
185
185
|
value: y !== void 0 ? String(y) : "",
|
|
186
|
-
onValueChange: (
|
|
187
|
-
const
|
|
188
|
-
|
|
186
|
+
onValueChange: (h) => {
|
|
187
|
+
const u = l.find((v) => String(v.value) === h);
|
|
188
|
+
u && t(r, u.value);
|
|
189
189
|
},
|
|
190
190
|
disabled: !s,
|
|
191
191
|
children: /* @__PURE__ */ n(
|
|
@@ -197,34 +197,34 @@ const fe = (e, t, r, d = void 0) => {
|
|
|
197
197
|
columnGap: "clamp(14px, 3vw, 36px)",
|
|
198
198
|
rowGap: "clamp(8px, 1.6vw, 14px)"
|
|
199
199
|
},
|
|
200
|
-
children: l.map((
|
|
201
|
-
/* @__PURE__ */ n(
|
|
202
|
-
/* @__PURE__ */ n(
|
|
203
|
-
] }, String(
|
|
200
|
+
children: l.map((h) => /* @__PURE__ */ p(T, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
|
|
201
|
+
/* @__PURE__ */ n(Ve.Item, { value: String(h.value) }),
|
|
202
|
+
/* @__PURE__ */ n(f, { size: "2", color: s ? void 0 : "gray", children: h.label })
|
|
203
|
+
] }, String(h.value)))
|
|
204
204
|
}
|
|
205
205
|
)
|
|
206
206
|
}
|
|
207
207
|
),
|
|
208
|
-
!i && /* @__PURE__ */ n(
|
|
209
|
-
c.description && /* @__PURE__ */ n(
|
|
208
|
+
!i && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(a, d) }),
|
|
209
|
+
c.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: c.description })
|
|
210
210
|
] }) });
|
|
211
|
-
},
|
|
212
|
-
var
|
|
213
|
-
return
|
|
214
|
-
},
|
|
211
|
+
}, Wr = (e, t, r) => {
|
|
212
|
+
var g;
|
|
213
|
+
return Me(Je, Ze)(e, t, r) && ((g = e == null ? void 0 : e.options) == null ? void 0 : g.format) === "radio" ? 3 : -1;
|
|
214
|
+
}, Br = oe(Hr), Kr = ({
|
|
215
215
|
data: e,
|
|
216
216
|
handleChange: t,
|
|
217
217
|
path: r,
|
|
218
218
|
label: d,
|
|
219
|
-
required:
|
|
219
|
+
required: g,
|
|
220
220
|
errors: a,
|
|
221
221
|
schema: c,
|
|
222
222
|
uischema: s,
|
|
223
223
|
enabled: o,
|
|
224
224
|
visible: i = !0
|
|
225
225
|
}) => {
|
|
226
|
-
var
|
|
227
|
-
if (
|
|
226
|
+
var u;
|
|
227
|
+
if (ue(i, r, t), i === !1)
|
|
228
228
|
return null;
|
|
229
229
|
const l = a.length === 0;
|
|
230
230
|
let y = [];
|
|
@@ -232,168 +232,175 @@ const fe = (e, t, r, d = void 0) => {
|
|
|
232
232
|
value: String(v.const),
|
|
233
233
|
label: v.title || String(v.const)
|
|
234
234
|
})));
|
|
235
|
-
const
|
|
236
|
-
return /* @__PURE__ */ n(
|
|
237
|
-
/* @__PURE__ */
|
|
235
|
+
const h = e !== void 0 ? String(e) : "";
|
|
236
|
+
return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
|
|
237
|
+
/* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
238
238
|
d,
|
|
239
239
|
" ",
|
|
240
|
-
|
|
240
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
241
241
|
] }),
|
|
242
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ p(Oe.Root, { value: h, onValueChange: (v) => t(r, v), disabled: !o, children: [
|
|
243
243
|
/* @__PURE__ */ n(
|
|
244
|
-
|
|
244
|
+
Oe.Trigger,
|
|
245
245
|
{
|
|
246
|
-
placeholder: ((
|
|
246
|
+
placeholder: ((u = s.options) == null ? void 0 : u.placeholder) || "Select an option",
|
|
247
247
|
color: l ? void 0 : "red",
|
|
248
248
|
id: r
|
|
249
249
|
}
|
|
250
250
|
),
|
|
251
|
-
/* @__PURE__ */ n(
|
|
251
|
+
/* @__PURE__ */ n(Oe.Content, { children: y.map((v) => /* @__PURE__ */ n(Oe.Item, { value: v.value, children: v.label }, v.value)) })
|
|
252
252
|
] }),
|
|
253
|
-
!l && /* @__PURE__ */ n(
|
|
254
|
-
c.description && /* @__PURE__ */ n(
|
|
253
|
+
!l && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(a, d) }),
|
|
254
|
+
c.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: c.description })
|
|
255
255
|
] }) });
|
|
256
|
-
},
|
|
256
|
+
}, Gr = W(2, Me(Je, Ze)), Xr = oe(Kr), Yr = {
|
|
257
257
|
"small-list": { fetchOnOpen: !0, searchable: !1, paginated: !1 },
|
|
258
258
|
"large-searchable-list": { fetchOnOpen: !0, searchable: !0, paginated: !1 },
|
|
259
259
|
"large-paginated-list": { fetchOnOpen: !1, searchable: !0, paginated: !0 }
|
|
260
|
-
},
|
|
260
|
+
}, Jr = ({
|
|
261
261
|
data: e,
|
|
262
262
|
handleChange: t,
|
|
263
263
|
path: r,
|
|
264
264
|
label: d,
|
|
265
|
-
required:
|
|
265
|
+
required: g,
|
|
266
266
|
errors: a,
|
|
267
267
|
enabled: c,
|
|
268
268
|
visible: s = !0,
|
|
269
269
|
schema: o,
|
|
270
270
|
uischema: i
|
|
271
271
|
}) => {
|
|
272
|
-
var
|
|
273
|
-
const l = (o == null ? void 0 : o["x-search"]) ?? { service: "" }, y = l.service ?? "",
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
var ae;
|
|
273
|
+
const l = (o == null ? void 0 : o["x-search"]) ?? { service: "" }, y = l.service ?? "", h = l.mode ?? "large-paginated-list", u = Yr[h], v = (u == null ? void 0 : u.fetchOnOpen) ?? !1, M = l.params, A = Mr(y), w = o.type === "object", O = w ? typeof e == "string" ? { value: e } : e ?? void 0 : void 0, z = w ? O == null ? void 0 : O.value : e, S = O == null ? void 0 : O.label, q = y ? A ? u ? null : `Invalid x-search.mode "${h}". Expected "small-list", "large-searchable-list", or "large-paginated-list".` : `Search service "${y}" is not registered.` : "Search not configured.", P = c !== !1, ee = !a || a.length === 0, [x, J] = _(!1), [F, V] = _(""), [j, K] = _([]), [$, Q] = _(!1), [re, ie] = _(!1), [se, ce] = _(!1), [fe, b] = _(null), [I, D] = _(void 0), R = de(void 0), U = de(null), G = de(null), Y = de(null), B = de(void 0);
|
|
274
|
+
ge(() => {
|
|
275
|
+
var Z, he;
|
|
276
|
+
if (!z) {
|
|
277
|
+
D(void 0), B.current = void 0;
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (((Z = B.current) == null ? void 0 : Z.value) === z && ((he = B.current) == null ? void 0 : he.label) === S) return;
|
|
281
|
+
if (B.current = { value: z, label: S }, w && S) {
|
|
282
|
+
D({ id: z, name: S });
|
|
277
283
|
return;
|
|
278
284
|
}
|
|
279
|
-
if (
|
|
280
|
-
let
|
|
281
|
-
return
|
|
282
|
-
!
|
|
285
|
+
if (D({ id: z, name: S ?? z }), !(A != null && A.resolve)) return;
|
|
286
|
+
let m = !1;
|
|
287
|
+
return A.resolve(z, M).then((Re) => {
|
|
288
|
+
!m && Re && D(Re);
|
|
283
289
|
}).catch(() => {
|
|
284
290
|
}), () => {
|
|
285
|
-
|
|
291
|
+
m = !0;
|
|
286
292
|
};
|
|
287
|
-
}, [
|
|
288
|
-
const
|
|
289
|
-
async (
|
|
290
|
-
var
|
|
291
|
-
if (!
|
|
292
|
-
|
|
293
|
+
}, [z, S, w, A, M]);
|
|
294
|
+
const be = ke(
|
|
295
|
+
async (m, Z = !1) => {
|
|
296
|
+
var Re;
|
|
297
|
+
if (!A) {
|
|
298
|
+
b("Search service not configured.");
|
|
293
299
|
return;
|
|
294
300
|
}
|
|
295
|
-
(
|
|
296
|
-
const
|
|
297
|
-
|
|
301
|
+
(Re = G.current) == null || Re.abort();
|
|
302
|
+
const he = new AbortController();
|
|
303
|
+
G.current = he, Z ? ce(!0) : (ie(!0), ce(!1), b(null));
|
|
298
304
|
try {
|
|
299
|
-
const
|
|
300
|
-
query:
|
|
301
|
-
cursor:
|
|
302
|
-
signal:
|
|
303
|
-
|
|
304
|
-
|
|
305
|
+
const Ne = await A.search({
|
|
306
|
+
query: m,
|
|
307
|
+
cursor: Z ? R.current : void 0,
|
|
308
|
+
signal: he.signal,
|
|
309
|
+
params: M
|
|
310
|
+
}), _e = Ne.options ?? [];
|
|
311
|
+
K(Z ? (sr) => [...sr, ..._e] : _e), R.current = Ne.nextCursor, Q(((u == null ? void 0 : u.paginated) ?? !1) && Ne.nextCursor != null);
|
|
305
312
|
} catch {
|
|
306
|
-
if (
|
|
307
|
-
|
|
313
|
+
if (he.signal.aborted) return;
|
|
314
|
+
b("Failed to load results. Please try again.");
|
|
308
315
|
} finally {
|
|
309
|
-
|
|
316
|
+
he.signal.aborted || (Z ? ce(!1) : ie(!1));
|
|
310
317
|
}
|
|
311
318
|
},
|
|
312
|
-
[
|
|
319
|
+
[A, u == null ? void 0 : u.paginated, M]
|
|
313
320
|
);
|
|
314
|
-
if (
|
|
315
|
-
if (!
|
|
316
|
-
const
|
|
317
|
-
|
|
321
|
+
if (ge(() => {
|
|
322
|
+
if (!x) return;
|
|
323
|
+
const m = (Z) => {
|
|
324
|
+
Y.current && !Y.current.contains(Z.target) && J(!1);
|
|
318
325
|
};
|
|
319
|
-
return document.addEventListener("mousedown",
|
|
320
|
-
}, [
|
|
321
|
-
var
|
|
322
|
-
|
|
323
|
-
}, [
|
|
324
|
-
if (!
|
|
326
|
+
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
327
|
+
}, [x]), ge(() => {
|
|
328
|
+
var m;
|
|
329
|
+
x || ((m = G.current) == null || m.abort(), V(""), K([]), Q(!1), b(null), ie(!1), ce(!1), R.current = void 0);
|
|
330
|
+
}, [x]), ge(() => {
|
|
331
|
+
if (!x) return;
|
|
325
332
|
if (!F && !v) {
|
|
326
|
-
|
|
333
|
+
K([]), Q(!1), b(null), R.current = void 0;
|
|
327
334
|
return;
|
|
328
335
|
}
|
|
329
|
-
|
|
330
|
-
const
|
|
331
|
-
return
|
|
332
|
-
|
|
333
|
-
},
|
|
334
|
-
|
|
336
|
+
U.current && clearTimeout(U.current);
|
|
337
|
+
const m = F ? 300 : 0;
|
|
338
|
+
return U.current = setTimeout(() => {
|
|
339
|
+
K([]), Q(!1), R.current = void 0, be(F);
|
|
340
|
+
}, m), () => {
|
|
341
|
+
U.current && clearTimeout(U.current);
|
|
335
342
|
};
|
|
336
|
-
}, [F,
|
|
343
|
+
}, [F, x, v, be]), ue(s, r, t, w ? void 0 : null), s === !1)
|
|
337
344
|
return null;
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
},
|
|
341
|
-
t(r,
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
},
|
|
345
|
-
(
|
|
346
|
-
},
|
|
347
|
-
return /* @__PURE__ */ n(
|
|
348
|
-
/* @__PURE__ */
|
|
345
|
+
const Ee = () => {
|
|
346
|
+
V(""), K([]), Q(!1), b(null), R.current = void 0, J(!0);
|
|
347
|
+
}, E = (m) => {
|
|
348
|
+
t(r, w ? { value: m.id, label: m.name } : m.id), D(m), B.current = { value: m.id, label: w ? m.name : void 0 }, J(!1);
|
|
349
|
+
}, L = (m) => {
|
|
350
|
+
m.stopPropagation(), t(r, w ? void 0 : null), D(void 0);
|
|
351
|
+
}, we = (m) => {
|
|
352
|
+
(m.key === "Enter" || m.key === " ") && L(m);
|
|
353
|
+
}, te = ((ae = i == null ? void 0 : i.options) == null ? void 0 : ae.placeholder) ?? "Select an option";
|
|
354
|
+
return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
|
|
355
|
+
/* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
|
|
349
356
|
d,
|
|
350
357
|
" ",
|
|
351
|
-
|
|
358
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
352
359
|
] }),
|
|
353
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ p("div", { ref: Y, style: { position: "relative" }, children: [
|
|
354
361
|
/* @__PURE__ */ n(
|
|
355
|
-
|
|
362
|
+
ve.Root,
|
|
356
363
|
{
|
|
357
364
|
id: r,
|
|
358
|
-
value:
|
|
359
|
-
placeholder:
|
|
360
|
-
disabled: !
|
|
361
|
-
readOnly:
|
|
362
|
-
style:
|
|
363
|
-
onChange: (
|
|
364
|
-
|
|
365
|
+
value: x ? F : (I == null ? void 0 : I.name) ?? "",
|
|
366
|
+
placeholder: x && (u != null && u.searchable) ? "Search..." : te,
|
|
367
|
+
disabled: !P,
|
|
368
|
+
readOnly: x && !(u != null && u.searchable),
|
|
369
|
+
style: ee ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
|
|
370
|
+
onChange: (m) => {
|
|
371
|
+
u != null && u.searchable && (V(m.target.value), x || Ee());
|
|
365
372
|
},
|
|
366
373
|
onFocus: () => {
|
|
367
|
-
|
|
374
|
+
P && !x && Ee();
|
|
368
375
|
},
|
|
369
|
-
onKeyDown: (
|
|
370
|
-
|
|
376
|
+
onKeyDown: (m) => {
|
|
377
|
+
m.key === "Escape" && J(!1);
|
|
371
378
|
},
|
|
372
|
-
children: /* @__PURE__ */ n(
|
|
373
|
-
|
|
379
|
+
children: /* @__PURE__ */ n(ve.Slot, { side: "right", children: /* @__PURE__ */ p(T, { align: "center", gap: "1", children: [
|
|
380
|
+
z && P && /* @__PURE__ */ n(
|
|
374
381
|
"span",
|
|
375
382
|
{
|
|
376
383
|
role: "button",
|
|
377
384
|
tabIndex: 0,
|
|
378
|
-
onMouseDown: (
|
|
379
|
-
onClick:
|
|
380
|
-
onKeyDown:
|
|
385
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
386
|
+
onClick: L,
|
|
387
|
+
onKeyDown: we,
|
|
381
388
|
style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
|
|
382
389
|
"aria-label": "Clear selection",
|
|
383
390
|
children: "×"
|
|
384
391
|
}
|
|
385
392
|
),
|
|
386
393
|
/* @__PURE__ */ n(
|
|
387
|
-
|
|
394
|
+
Ar,
|
|
388
395
|
{
|
|
389
|
-
style: { transform:
|
|
396
|
+
style: { transform: x ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
|
|
390
397
|
}
|
|
391
398
|
)
|
|
392
399
|
] }) })
|
|
393
400
|
}
|
|
394
401
|
),
|
|
395
|
-
|
|
396
|
-
|
|
402
|
+
x && /* @__PURE__ */ n(
|
|
403
|
+
C,
|
|
397
404
|
{
|
|
398
405
|
style: {
|
|
399
406
|
position: "absolute",
|
|
@@ -407,229 +414,229 @@ const fe = (e, t, r, d = void 0) => {
|
|
|
407
414
|
border: "1px solid var(--gray-a6)",
|
|
408
415
|
overflow: "hidden"
|
|
409
416
|
},
|
|
410
|
-
children:
|
|
411
|
-
|
|
412
|
-
!
|
|
413
|
-
!
|
|
414
|
-
|
|
415
|
-
|
|
417
|
+
children: q ? /* @__PURE__ */ n(C, { p: "3", children: /* @__PURE__ */ n(f, { size: "2", color: "gray", children: q }) }) : /* @__PURE__ */ n(Tr, { style: { maxHeight: 240 }, children: /* @__PURE__ */ p(C, { p: "1", children: [
|
|
418
|
+
re && /* @__PURE__ */ n(T, { justify: "center", p: "4", children: /* @__PURE__ */ n(ze, {}) }),
|
|
419
|
+
!re && fe && /* @__PURE__ */ n(C, { px: "3", py: "2", children: /* @__PURE__ */ n(f, { size: "2", color: "red", children: fe }) }),
|
|
420
|
+
!re && !fe && j.length === 0 && /* @__PURE__ */ n(C, { px: "3", py: "2", children: /* @__PURE__ */ n(f, { size: "2", color: "gray", children: F || v ? "No results found." : "Type to search…" }) }),
|
|
421
|
+
j.map((m) => /* @__PURE__ */ n(
|
|
422
|
+
C,
|
|
416
423
|
{
|
|
417
424
|
px: "3",
|
|
418
425
|
py: "2",
|
|
419
|
-
onMouseDown: (
|
|
420
|
-
onClick: () =>
|
|
426
|
+
onMouseDown: (Z) => Z.preventDefault(),
|
|
427
|
+
onClick: () => E(m),
|
|
421
428
|
style: {
|
|
422
429
|
cursor: "pointer",
|
|
423
430
|
borderRadius: "var(--radius-2)",
|
|
424
|
-
backgroundColor:
|
|
431
|
+
backgroundColor: m.id === z ? "var(--accent-3)" : void 0
|
|
425
432
|
},
|
|
426
433
|
className: "hover:bg-(--gray-3)",
|
|
427
|
-
children: /* @__PURE__ */ n(
|
|
434
|
+
children: /* @__PURE__ */ n(f, { size: "2", children: m.name })
|
|
428
435
|
},
|
|
429
|
-
|
|
436
|
+
m.id
|
|
430
437
|
)),
|
|
431
|
-
(
|
|
432
|
-
|
|
438
|
+
(u == null ? void 0 : u.paginated) && $ && !se && /* @__PURE__ */ n(C, { px: "3", py: "2", children: /* @__PURE__ */ n(
|
|
439
|
+
Le,
|
|
433
440
|
{
|
|
434
441
|
variant: "ghost",
|
|
435
442
|
size: "1",
|
|
436
443
|
style: { width: "100%" },
|
|
437
|
-
onMouseDown: (
|
|
438
|
-
onClick: () => void
|
|
444
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
445
|
+
onClick: () => void be(F, !0),
|
|
439
446
|
children: "Load more"
|
|
440
447
|
}
|
|
441
448
|
) }),
|
|
442
|
-
|
|
449
|
+
se && /* @__PURE__ */ n(T, { justify: "center", p: "2", children: /* @__PURE__ */ n(ze, {}) })
|
|
443
450
|
] }) })
|
|
444
451
|
}
|
|
445
452
|
)
|
|
446
453
|
] }),
|
|
447
|
-
!
|
|
448
|
-
o.description && /* @__PURE__ */ n(
|
|
454
|
+
!ee && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(a, d) }),
|
|
455
|
+
o.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: o.description })
|
|
449
456
|
] }) });
|
|
450
|
-
},
|
|
457
|
+
}, Zr = oe(Jr), qr = W(
|
|
451
458
|
3,
|
|
452
|
-
|
|
459
|
+
Fe((e) => {
|
|
453
460
|
const t = e["x-search"];
|
|
454
|
-
return e.type === "string" && typeof (t == null ? void 0 : t.service) == "string" && t.service !== "";
|
|
461
|
+
return (e.type === "string" || e.type === "object") && typeof (t == null ? void 0 : t.service) == "string" && t.service !== "";
|
|
455
462
|
})
|
|
456
|
-
),
|
|
463
|
+
), jr = (e, t) => Or(`${e}T${t}`).format(), Qr = ({ path: e, label: t, required: r, errors: d, description: g, children: a }) => {
|
|
457
464
|
const c = d.length === 0;
|
|
458
|
-
return /* @__PURE__ */ n(
|
|
459
|
-
/* @__PURE__ */
|
|
465
|
+
return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
|
|
466
|
+
/* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", htmlFor: e, children: [
|
|
460
467
|
t,
|
|
461
468
|
" ",
|
|
462
|
-
r && /* @__PURE__ */ n(
|
|
469
|
+
r && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
463
470
|
] }),
|
|
464
471
|
a,
|
|
465
|
-
!c && /* @__PURE__ */ n(
|
|
466
|
-
|
|
472
|
+
!c && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(d, t) }),
|
|
473
|
+
g && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: g })
|
|
467
474
|
] }) });
|
|
468
|
-
},
|
|
475
|
+
}, et = ({
|
|
469
476
|
data: e,
|
|
470
477
|
handleChange: t,
|
|
471
478
|
path: r,
|
|
472
479
|
label: d,
|
|
473
|
-
required:
|
|
480
|
+
required: g,
|
|
474
481
|
errors: a,
|
|
475
482
|
schema: c,
|
|
476
483
|
enabled: s,
|
|
477
484
|
visible: o = !0
|
|
478
485
|
}) => {
|
|
479
|
-
if (
|
|
486
|
+
if (ge(() => {
|
|
480
487
|
o === !1 && t(r, void 0);
|
|
481
488
|
}, [o, r, t]), o === !1)
|
|
482
489
|
return null;
|
|
483
|
-
const i = a.length === 0, l = typeof e == "string" ? e : "", y = (
|
|
490
|
+
const i = a.length === 0, l = typeof e == "string" ? e : "", y = (w) => /* @__PURE__ */ n(Qr, { path: r, label: d, required: g, errors: a, description: c.description, children: w });
|
|
484
491
|
if (c.format === "time")
|
|
485
492
|
return y(
|
|
486
493
|
/* @__PURE__ */ n(
|
|
487
|
-
|
|
494
|
+
ve.Root,
|
|
488
495
|
{
|
|
489
496
|
type: "time",
|
|
490
497
|
value: l,
|
|
491
|
-
onChange: (
|
|
498
|
+
onChange: (w) => t(r, w.target.value),
|
|
492
499
|
disabled: !s,
|
|
493
500
|
color: i ? void 0 : "red",
|
|
494
501
|
id: r
|
|
495
502
|
}
|
|
496
503
|
)
|
|
497
504
|
);
|
|
498
|
-
const
|
|
499
|
-
if (!
|
|
505
|
+
const h = c.format === "date-time", [u = "", v = ""] = l.split("T"), M = v.slice(0, 5), A = (w, O) => {
|
|
506
|
+
if (!w) {
|
|
500
507
|
t(r, void 0);
|
|
501
508
|
return;
|
|
502
509
|
}
|
|
503
|
-
t(r,
|
|
510
|
+
t(r, h ? jr(w, O || "00:00") : w);
|
|
504
511
|
};
|
|
505
512
|
return y(
|
|
506
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ p(T, { gap: "2", align: "center", children: [
|
|
507
514
|
/* @__PURE__ */ n(
|
|
508
|
-
|
|
515
|
+
ve.Root,
|
|
509
516
|
{
|
|
510
517
|
type: "date",
|
|
511
|
-
value:
|
|
518
|
+
value: u,
|
|
512
519
|
disabled: !s,
|
|
513
520
|
color: i ? void 0 : "red",
|
|
514
|
-
onChange: (
|
|
521
|
+
onChange: (w) => A(w.target.value, M),
|
|
515
522
|
id: r,
|
|
516
523
|
style: { flex: 1 }
|
|
517
524
|
}
|
|
518
525
|
),
|
|
519
|
-
|
|
520
|
-
|
|
526
|
+
h && /* @__PURE__ */ n(
|
|
527
|
+
ve.Root,
|
|
521
528
|
{
|
|
522
529
|
type: "time",
|
|
523
|
-
value:
|
|
524
|
-
disabled: !s || !
|
|
530
|
+
value: M,
|
|
531
|
+
disabled: !s || !u,
|
|
525
532
|
color: i ? void 0 : "red",
|
|
526
|
-
onChange: (
|
|
533
|
+
onChange: (w) => A(u, w.target.value),
|
|
527
534
|
style: { flex: 1 }
|
|
528
535
|
}
|
|
529
536
|
)
|
|
530
537
|
] })
|
|
531
538
|
);
|
|
532
|
-
},
|
|
539
|
+
}, rt = W(2, Me(gr, mr, yr)), tt = oe(et), nt = ({
|
|
533
540
|
uischema: e,
|
|
534
541
|
schema: t,
|
|
535
542
|
path: r,
|
|
536
543
|
renderers: d,
|
|
537
|
-
cells:
|
|
544
|
+
cells: g,
|
|
538
545
|
enabled: a,
|
|
539
546
|
visible: c = !0
|
|
540
547
|
}) => {
|
|
541
548
|
const o = e.elements;
|
|
542
549
|
return c === !1 ? null : /* @__PURE__ */ n(T, { direction: "column", gap: "4", children: o.map((i, l) => /* @__PURE__ */ n(
|
|
543
|
-
|
|
550
|
+
Se,
|
|
544
551
|
{
|
|
545
552
|
uischema: i,
|
|
546
553
|
schema: t,
|
|
547
554
|
path: r,
|
|
548
555
|
renderers: d,
|
|
549
|
-
cells:
|
|
556
|
+
cells: g,
|
|
550
557
|
enabled: a
|
|
551
558
|
},
|
|
552
559
|
`${r}-${l}`
|
|
553
560
|
)) });
|
|
554
|
-
},
|
|
561
|
+
}, ot = W(1, Ae("VerticalLayout")), lt = ({
|
|
555
562
|
uischema: e,
|
|
556
563
|
schema: t,
|
|
557
564
|
path: r,
|
|
558
565
|
renderers: d,
|
|
559
|
-
cells:
|
|
566
|
+
cells: g,
|
|
560
567
|
enabled: a,
|
|
561
568
|
visible: c = !0
|
|
562
569
|
}) => {
|
|
563
570
|
const o = e.elements;
|
|
564
|
-
return c === !1 ? null : /* @__PURE__ */ n(T, { direction: "row", gap: "4", children: o.map((i, l) => /* @__PURE__ */ n(
|
|
565
|
-
|
|
571
|
+
return c === !1 ? null : /* @__PURE__ */ n(T, { direction: "row", gap: "4", children: o.map((i, l) => /* @__PURE__ */ n(C, { style: { flex: 1 }, children: /* @__PURE__ */ n(
|
|
572
|
+
Se,
|
|
566
573
|
{
|
|
567
574
|
uischema: i,
|
|
568
575
|
schema: t,
|
|
569
576
|
path: r,
|
|
570
577
|
renderers: d,
|
|
571
|
-
cells:
|
|
578
|
+
cells: g,
|
|
572
579
|
enabled: a
|
|
573
580
|
}
|
|
574
581
|
) }, `${r}-${l}`)) });
|
|
575
|
-
},
|
|
582
|
+
}, it = W(1, Ae("HorizontalLayout")), st = ({
|
|
576
583
|
uischema: e,
|
|
577
584
|
schema: t,
|
|
578
585
|
path: r,
|
|
579
586
|
renderers: d,
|
|
580
|
-
cells:
|
|
587
|
+
cells: g,
|
|
581
588
|
enabled: a,
|
|
582
589
|
visible: c = !0
|
|
583
590
|
}) => {
|
|
584
591
|
const s = e, o = s.elements;
|
|
585
|
-
return c === !1 ? null : /* @__PURE__ */
|
|
586
|
-
s.label && /* @__PURE__ */ n(
|
|
592
|
+
return c === !1 ? null : /* @__PURE__ */ p(C, { mb: "6", children: [
|
|
593
|
+
s.label && /* @__PURE__ */ n(qe, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: s.label }),
|
|
587
594
|
/* @__PURE__ */ n(T, { direction: "column", gap: "4", children: o.map((i, l) => /* @__PURE__ */ n(
|
|
588
|
-
|
|
595
|
+
Se,
|
|
589
596
|
{
|
|
590
597
|
uischema: i,
|
|
591
598
|
schema: t,
|
|
592
599
|
path: r,
|
|
593
600
|
renderers: d,
|
|
594
|
-
cells:
|
|
601
|
+
cells: g,
|
|
595
602
|
enabled: a
|
|
596
603
|
},
|
|
597
604
|
`${r}-${l}`
|
|
598
605
|
)) })
|
|
599
606
|
] });
|
|
600
|
-
},
|
|
607
|
+
}, ct = W(1, Ae("Group")), at = ({
|
|
601
608
|
uischema: e,
|
|
602
609
|
schema: t,
|
|
603
610
|
path: r,
|
|
604
611
|
renderers: d,
|
|
605
|
-
cells:
|
|
612
|
+
cells: g,
|
|
606
613
|
enabled: a,
|
|
607
614
|
visible: c = !0
|
|
608
615
|
}) => {
|
|
609
|
-
var
|
|
610
|
-
const o = e.elements.filter((
|
|
616
|
+
var h;
|
|
617
|
+
const o = e.elements.filter((u) => u.type === "Category"), [i, l] = _(((h = o[0]) == null ? void 0 : h.label) || "");
|
|
611
618
|
if (c === !1 || !o.length) return null;
|
|
612
|
-
const y = o.find((
|
|
613
|
-
return /* @__PURE__ */
|
|
614
|
-
/* @__PURE__ */ n(
|
|
615
|
-
/* @__PURE__ */ n(
|
|
616
|
-
|
|
619
|
+
const y = o.find((u) => u.label === i) ? i : o[0].label;
|
|
620
|
+
return /* @__PURE__ */ p(Ie.Root, { value: y, onValueChange: l, children: [
|
|
621
|
+
/* @__PURE__ */ n(Ie.List, { children: o.map((u, v) => /* @__PURE__ */ n(Ie.Trigger, { value: u.label, children: u.label }, `${r}-${v}`)) }),
|
|
622
|
+
/* @__PURE__ */ n(C, { pt: "3", children: o.map((u, v) => /* @__PURE__ */ n(Ie.Content, { value: u.label, children: /* @__PURE__ */ n(T, { direction: "column", gap: "4", children: u.elements.map((M, A) => /* @__PURE__ */ n(
|
|
623
|
+
Se,
|
|
617
624
|
{
|
|
618
|
-
uischema:
|
|
625
|
+
uischema: M,
|
|
619
626
|
schema: t,
|
|
620
627
|
path: r,
|
|
621
628
|
renderers: d,
|
|
622
|
-
cells:
|
|
629
|
+
cells: g,
|
|
623
630
|
enabled: a
|
|
624
631
|
},
|
|
625
|
-
`${r}-${v}-${
|
|
632
|
+
`${r}-${v}-${A}`
|
|
626
633
|
)) }) }, `${r}-${v}`)) })
|
|
627
634
|
] });
|
|
628
|
-
},
|
|
629
|
-
function
|
|
635
|
+
}, dt = W(1, Ae("Categorization"));
|
|
636
|
+
function me(e) {
|
|
630
637
|
return e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(0)} MB` : e >= 1024 ? `${(e / 1024).toFixed(0)} KB` : `${e} B`;
|
|
631
638
|
}
|
|
632
|
-
function
|
|
639
|
+
function ye(e) {
|
|
633
640
|
return e.split(",").map((t) => {
|
|
634
641
|
if (t = t.trim(), t.endsWith("/*"))
|
|
635
642
|
return t.split("/")[0].toUpperCase() + "S";
|
|
@@ -639,109 +646,109 @@ function me(e) {
|
|
|
639
646
|
return r ? r.toUpperCase() : t;
|
|
640
647
|
}).join(", ");
|
|
641
648
|
}
|
|
642
|
-
function
|
|
649
|
+
function ut(e) {
|
|
643
650
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
644
651
|
}
|
|
645
|
-
const
|
|
652
|
+
const ft = ({
|
|
646
653
|
data: e,
|
|
647
654
|
handleChange: t,
|
|
648
655
|
path: r,
|
|
649
656
|
label: d,
|
|
650
|
-
required:
|
|
657
|
+
required: g,
|
|
651
658
|
uischema: a,
|
|
652
659
|
schema: c,
|
|
653
660
|
enabled: s,
|
|
654
661
|
errors: o,
|
|
655
662
|
visible: i = !0
|
|
656
663
|
}) => {
|
|
657
|
-
const l =
|
|
658
|
-
|
|
659
|
-
const y = !o || o.length === 0,
|
|
660
|
-
|
|
661
|
-
|
|
664
|
+
const l = Lr();
|
|
665
|
+
ue(i, r, t, null);
|
|
666
|
+
const y = !o || o.length === 0, h = (c == null ? void 0 : c["x-file"]) ?? {}, u = (a == null ? void 0 : a.options) ?? {}, v = h.maxFiles ?? u.maxFiles ?? 1, M = h.maxSize ?? u.maxSize ?? 5 * 1024 * 1024, A = h.accept ?? u.accept ?? "image/*,application/pdf", w = v > 1, O = s !== !1, [z, S] = _(!1), [q, P] = _(null), [ee, x] = _({}), J = de(/* @__PURE__ */ new Set()), F = de(null), V = ut(e), j = V.length >= v;
|
|
667
|
+
ge(() => () => {
|
|
668
|
+
J.current.forEach((b) => URL.revokeObjectURL(b)), J.current.clear();
|
|
662
669
|
}, []);
|
|
663
|
-
const
|
|
670
|
+
const K = ke(
|
|
664
671
|
async (b) => {
|
|
665
|
-
if (
|
|
666
|
-
|
|
672
|
+
if (P(null), V.length >= v) {
|
|
673
|
+
P(`Maximum ${v} file${v > 1 ? "s" : ""} allowed.`);
|
|
667
674
|
return;
|
|
668
675
|
}
|
|
669
|
-
if (b.size >
|
|
670
|
-
|
|
676
|
+
if (b.size > M) {
|
|
677
|
+
P(`File exceeds the ${me(M)} limit.`);
|
|
671
678
|
return;
|
|
672
679
|
}
|
|
673
|
-
if (!
|
|
674
|
-
|
|
680
|
+
if (!A.split(",").map((R) => R.trim()).some((R) => R === "*" || R === "*/*" ? !0 : R.endsWith("/*") ? b.type.startsWith(R.slice(0, -1)) : R.startsWith(".") ? b.name.toLowerCase().endsWith(R.toLowerCase()) : b.type === R)) {
|
|
681
|
+
P(`Invalid type. Accepted: ${ye(A)}`);
|
|
675
682
|
return;
|
|
676
683
|
}
|
|
677
684
|
if (!(l != null && l.onUpload)) {
|
|
678
|
-
|
|
685
|
+
P("Upload service not configured.");
|
|
679
686
|
return;
|
|
680
687
|
}
|
|
681
688
|
try {
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
const
|
|
687
|
-
t(r,
|
|
689
|
+
const R = await l.onUpload(b), U = URL.createObjectURL(b);
|
|
690
|
+
J.current.add(U);
|
|
691
|
+
const G = { key: R.key, name: R.name ?? b.name, blobUrl: U };
|
|
692
|
+
x((B) => ({ ...B, [R.key]: G }));
|
|
693
|
+
const Y = [...V, R.key];
|
|
694
|
+
t(r, w ? Y : Y[0]);
|
|
688
695
|
} catch {
|
|
689
|
-
|
|
696
|
+
P("Upload failed. Please try again."), F.current && (F.current.value = "");
|
|
690
697
|
}
|
|
691
698
|
},
|
|
692
|
-
[
|
|
699
|
+
[V, v, M, A, l, r, t, w]
|
|
693
700
|
);
|
|
694
701
|
if (i === !1)
|
|
695
702
|
return null;
|
|
696
|
-
const
|
|
697
|
-
b.preventDefault(), b.stopPropagation(), !(!
|
|
698
|
-
},
|
|
699
|
-
var
|
|
700
|
-
b.preventDefault(), b.stopPropagation(),
|
|
701
|
-
},
|
|
702
|
-
var
|
|
703
|
-
(
|
|
704
|
-
},
|
|
705
|
-
if (!
|
|
706
|
-
|
|
707
|
-
var
|
|
708
|
-
const
|
|
709
|
-
return
|
|
703
|
+
const $ = (b) => {
|
|
704
|
+
b.preventDefault(), b.stopPropagation(), !(!O || j) && S(b.type === "dragenter" || b.type === "dragover");
|
|
705
|
+
}, Q = (b) => {
|
|
706
|
+
var I;
|
|
707
|
+
b.preventDefault(), b.stopPropagation(), S(!1), !(!O || j) && (I = b.dataTransfer.files) != null && I[0] && K(b.dataTransfer.files[0]);
|
|
708
|
+
}, re = (b) => {
|
|
709
|
+
var I;
|
|
710
|
+
(I = b.target.files) != null && I[0] && (K(b.target.files[0]), b.target.value = "");
|
|
711
|
+
}, ie = (b) => {
|
|
712
|
+
if (!O) return;
|
|
713
|
+
x((D) => {
|
|
714
|
+
var G;
|
|
715
|
+
const R = { ...D }, U = (G = R[b]) == null ? void 0 : G.blobUrl;
|
|
716
|
+
return U && (URL.revokeObjectURL(U), J.current.delete(U)), delete R[b], R;
|
|
710
717
|
});
|
|
711
|
-
const
|
|
712
|
-
t(r,
|
|
713
|
-
},
|
|
714
|
-
var
|
|
718
|
+
const I = V.filter((D) => D !== b);
|
|
719
|
+
t(r, w ? I.length > 0 ? I : null : I[0] ?? null);
|
|
720
|
+
}, se = async (b, I) => {
|
|
721
|
+
var U, G, Y;
|
|
715
722
|
b.preventDefault();
|
|
716
|
-
const
|
|
717
|
-
if (
|
|
718
|
-
(
|
|
723
|
+
const D = (U = ee[I]) == null ? void 0 : U.blobUrl;
|
|
724
|
+
if (D) {
|
|
725
|
+
(G = window.open(D, "_blank", "noopener,noreferrer")) == null || G.focus();
|
|
719
726
|
return;
|
|
720
727
|
}
|
|
721
|
-
const
|
|
722
|
-
if (
|
|
728
|
+
const R = window.open("", "_blank");
|
|
729
|
+
if (R)
|
|
723
730
|
try {
|
|
724
|
-
const
|
|
725
|
-
|
|
731
|
+
const B = await ((Y = l == null ? void 0 : l.getDownloadUrl) == null ? void 0 : Y.call(l, I));
|
|
732
|
+
B != null && B.url ? R.location.href = B.url : R.close();
|
|
726
733
|
} catch {
|
|
727
|
-
|
|
734
|
+
R.close();
|
|
728
735
|
}
|
|
729
736
|
};
|
|
730
|
-
if (!
|
|
731
|
-
const
|
|
732
|
-
return /* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
734
|
-
/* @__PURE__ */
|
|
737
|
+
if (!O && V.length === 0) return null;
|
|
738
|
+
const ce = v - V.length, fe = O && !j;
|
|
739
|
+
return /* @__PURE__ */ p(C, { mb: "4", children: [
|
|
740
|
+
/* @__PURE__ */ p(T, { align: "center", justify: "between", mb: "2", children: [
|
|
741
|
+
/* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", children: [
|
|
735
742
|
d,
|
|
736
|
-
|
|
743
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: " *" })
|
|
737
744
|
] }),
|
|
738
|
-
/* @__PURE__ */ n(
|
|
745
|
+
/* @__PURE__ */ n(f, { size: "1", color: "gray", children: w ? `Up to ${v} files · ${me(M)} each · ${ye(A)}` : `${me(M)} · ${ye(A)}` })
|
|
739
746
|
] }),
|
|
740
|
-
|
|
741
|
-
var
|
|
742
|
-
return /* @__PURE__ */ n(
|
|
747
|
+
V.map((b) => {
|
|
748
|
+
var I;
|
|
749
|
+
return /* @__PURE__ */ n($e, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ p(T, { align: "center", gap: "3", children: [
|
|
743
750
|
/* @__PURE__ */ n(
|
|
744
|
-
|
|
751
|
+
C,
|
|
745
752
|
{
|
|
746
753
|
style: {
|
|
747
754
|
background: "var(--blue-3)",
|
|
@@ -750,11 +757,11 @@ const st = ({
|
|
|
750
757
|
color: "var(--blue-9)",
|
|
751
758
|
flexShrink: 0
|
|
752
759
|
},
|
|
753
|
-
children: /* @__PURE__ */ n(
|
|
760
|
+
children: /* @__PURE__ */ n(Qe, { width: "20", height: "20" })
|
|
754
761
|
}
|
|
755
762
|
),
|
|
756
|
-
/* @__PURE__ */ n(
|
|
757
|
-
|
|
763
|
+
/* @__PURE__ */ n(C, { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ n(
|
|
764
|
+
f,
|
|
758
765
|
{
|
|
759
766
|
size: "2",
|
|
760
767
|
weight: "bold",
|
|
@@ -764,70 +771,70 @@ const st = ({
|
|
|
764
771
|
textOverflow: "ellipsis",
|
|
765
772
|
whiteSpace: "nowrap"
|
|
766
773
|
},
|
|
767
|
-
children: ((
|
|
774
|
+
children: ((I = ee[b]) == null ? void 0 : I.name) ?? "Uploaded File"
|
|
768
775
|
}
|
|
769
776
|
) }),
|
|
770
|
-
/* @__PURE__ */
|
|
771
|
-
/* @__PURE__ */ n(
|
|
772
|
-
/* @__PURE__ */ n(
|
|
773
|
-
|
|
777
|
+
/* @__PURE__ */ p(T, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
|
|
778
|
+
/* @__PURE__ */ n(Le, { variant: "soft", color: "blue", size: "1", onClick: (D) => se(D, b), children: "View" }),
|
|
779
|
+
/* @__PURE__ */ n(er, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
|
|
780
|
+
O && /* @__PURE__ */ n(je, { variant: "ghost", color: "gray", onClick: () => ie(b), children: /* @__PURE__ */ n(rr, {}) })
|
|
774
781
|
] })
|
|
775
782
|
] }) }, b);
|
|
776
783
|
}),
|
|
777
|
-
|
|
784
|
+
fe && /* @__PURE__ */ p(
|
|
778
785
|
"div",
|
|
779
786
|
{
|
|
780
787
|
role: "button",
|
|
781
788
|
tabIndex: 0,
|
|
782
789
|
onClick: () => {
|
|
783
790
|
var b;
|
|
784
|
-
return (b =
|
|
791
|
+
return (b = F.current) == null ? void 0 : b.click();
|
|
785
792
|
},
|
|
786
793
|
onKeyDown: (b) => {
|
|
787
|
-
var
|
|
788
|
-
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), (
|
|
794
|
+
var I;
|
|
795
|
+
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), (I = F.current) == null || I.click());
|
|
789
796
|
},
|
|
790
|
-
onDragEnter:
|
|
791
|
-
onDragLeave:
|
|
792
|
-
onDragOver:
|
|
793
|
-
onDrop:
|
|
797
|
+
onDragEnter: $,
|
|
798
|
+
onDragLeave: $,
|
|
799
|
+
onDragOver: $,
|
|
800
|
+
onDrop: Q,
|
|
794
801
|
style: { cursor: "pointer" },
|
|
795
802
|
className: [
|
|
796
803
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
797
804
|
"transition-all duration-200 ease-in-out",
|
|
798
|
-
|
|
805
|
+
z ? "border-blue-500 bg-blue-50" : q ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
799
806
|
].join(" "),
|
|
800
807
|
children: [
|
|
801
|
-
/* @__PURE__ */ n("input", { ref:
|
|
802
|
-
/* @__PURE__ */ n(T, { direction: "column", align: "center", gap: "2", children:
|
|
803
|
-
/* @__PURE__ */ n(
|
|
804
|
-
/* @__PURE__ */ n(
|
|
805
|
-
/* @__PURE__ */ n(
|
|
806
|
-
] }) : /* @__PURE__ */
|
|
807
|
-
/* @__PURE__ */ n(
|
|
808
|
-
/* @__PURE__ */ n(
|
|
809
|
-
/* @__PURE__ */
|
|
810
|
-
|
|
808
|
+
/* @__PURE__ */ n("input", { ref: F, type: "file", style: { display: "none" }, accept: A, onChange: re }),
|
|
809
|
+
/* @__PURE__ */ n(T, { direction: "column", align: "center", gap: "2", children: q ? /* @__PURE__ */ p(Te, { children: [
|
|
810
|
+
/* @__PURE__ */ n(tr, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
811
|
+
/* @__PURE__ */ n(f, { size: "2", color: "red", weight: "medium", children: q }),
|
|
812
|
+
/* @__PURE__ */ n(f, { size: "1", color: "gray", children: "Click to try again" })
|
|
813
|
+
] }) : /* @__PURE__ */ p(Te, { children: [
|
|
814
|
+
/* @__PURE__ */ n(nr, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
815
|
+
/* @__PURE__ */ n(f, { size: "2", weight: "medium", children: V.length > 0 ? `Add another file (${ce} remaining)` : "Click to upload or drag and drop" }),
|
|
816
|
+
/* @__PURE__ */ p(f, { size: "1", color: "gray", children: [
|
|
817
|
+
me(M),
|
|
811
818
|
" max · ",
|
|
812
|
-
|
|
819
|
+
ye(A)
|
|
813
820
|
] })
|
|
814
821
|
] }) })
|
|
815
822
|
]
|
|
816
823
|
}
|
|
817
824
|
),
|
|
818
|
-
|
|
825
|
+
O && j && w && /* @__PURE__ */ p(f, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
|
|
819
826
|
"Maximum ",
|
|
820
827
|
v,
|
|
821
828
|
" files uploaded. Remove one to replace it."
|
|
822
829
|
] }),
|
|
823
|
-
!y && /* @__PURE__ */ n(
|
|
830
|
+
!y && /* @__PURE__ */ n(f, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: le(o, d) })
|
|
824
831
|
] });
|
|
825
|
-
},
|
|
832
|
+
}, ht = oe(ft), pt = W(
|
|
826
833
|
10,
|
|
827
834
|
// high rank to beat default array renderer
|
|
828
|
-
|
|
835
|
+
vr(
|
|
829
836
|
// Match both single-file (type: string) and multi-file (type: array)
|
|
830
|
-
|
|
837
|
+
Fe((e) => {
|
|
831
838
|
if (e.type === "string" && e.format === "file") return !0;
|
|
832
839
|
if (e.type === "array") {
|
|
833
840
|
const t = e.items;
|
|
@@ -837,16 +844,16 @@ const st = ({
|
|
|
837
844
|
})
|
|
838
845
|
)
|
|
839
846
|
);
|
|
840
|
-
class
|
|
847
|
+
class Ue extends Error {
|
|
841
848
|
}
|
|
842
|
-
function
|
|
843
|
-
const r =
|
|
849
|
+
function gt(e, t) {
|
|
850
|
+
const r = Ir(e, { type: "array", cellDates: !0 });
|
|
844
851
|
if (r.SheetNames.length === 0)
|
|
845
|
-
throw new
|
|
846
|
-
const d = t ?? r.SheetNames[0],
|
|
847
|
-
if (!
|
|
848
|
-
throw new
|
|
849
|
-
const a =
|
|
852
|
+
throw new Ue("This file has no sheets.");
|
|
853
|
+
const d = t ?? r.SheetNames[0], g = r.Sheets[d];
|
|
854
|
+
if (!g)
|
|
855
|
+
throw new Ue(`This file doesn't have a sheet named "${d}".`);
|
|
856
|
+
const a = xr.sheet_to_json(g, { header: 1, raw: !0, defval: null });
|
|
850
857
|
return {
|
|
851
858
|
sheetName: d,
|
|
852
859
|
matrix: a,
|
|
@@ -854,7 +861,7 @@ function dt(e, t) {
|
|
|
854
861
|
colCount: Math.max(0, ...a.map((c) => c.length))
|
|
855
862
|
};
|
|
856
863
|
}
|
|
857
|
-
function
|
|
864
|
+
function mt(e) {
|
|
858
865
|
let t = e + 1, r = "";
|
|
859
866
|
for (; t > 0; ) {
|
|
860
867
|
const d = (t - 1) % 26;
|
|
@@ -862,14 +869,14 @@ function ut(e) {
|
|
|
862
869
|
}
|
|
863
870
|
return r;
|
|
864
871
|
}
|
|
865
|
-
class
|
|
872
|
+
class X extends Error {
|
|
866
873
|
constructor(r, d) {
|
|
867
874
|
super(d ?? r);
|
|
868
|
-
|
|
875
|
+
Pe(this, "code");
|
|
869
876
|
this.code = r, this.name = "FormulaError";
|
|
870
877
|
}
|
|
871
878
|
}
|
|
872
|
-
const
|
|
879
|
+
const yt = [
|
|
873
880
|
// Logical
|
|
874
881
|
// IF is excluded here even though its native body is real, non-stub code —
|
|
875
882
|
// see LOGICAL_FUNCTIONS_WITH_BROKEN_CONDITION_COERCION below for why it's
|
|
@@ -895,7 +902,7 @@ const ft = [
|
|
|
895
902
|
// DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL.
|
|
896
903
|
"DATE",
|
|
897
904
|
"TODAY"
|
|
898
|
-
],
|
|
905
|
+
], vt = [
|
|
899
906
|
"MAX",
|
|
900
907
|
"MIN",
|
|
901
908
|
"MAXA",
|
|
@@ -914,7 +921,7 @@ const ft = [
|
|
|
914
921
|
"COUNTA",
|
|
915
922
|
// not present in fast-formula-parser's function table at all.
|
|
916
923
|
"UPPER"
|
|
917
|
-
],
|
|
924
|
+
], bt = ["YEAR", "MONTH", "DAY", "WEEKDAY"], Et = ["IF"], wt = [
|
|
918
925
|
"CONCATENATE",
|
|
919
926
|
"CONCAT",
|
|
920
927
|
"LEN",
|
|
@@ -925,24 +932,24 @@ const ft = [
|
|
|
925
932
|
"MID",
|
|
926
933
|
"FIND",
|
|
927
934
|
"SEARCH"
|
|
928
|
-
],
|
|
929
|
-
...
|
|
930
|
-
...
|
|
931
|
-
...
|
|
932
|
-
...
|
|
933
|
-
...
|
|
934
|
-
]),
|
|
935
|
-
function
|
|
936
|
-
const t = e.replace(
|
|
937
|
-
|
|
935
|
+
], Rt = /* @__PURE__ */ new Set([
|
|
936
|
+
...yt,
|
|
937
|
+
...vt,
|
|
938
|
+
...bt,
|
|
939
|
+
...wt,
|
|
940
|
+
...Et
|
|
941
|
+
]), Ct = /"(?:[^"]|"")*"/g, He = new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(", "g");
|
|
942
|
+
function Tt(e) {
|
|
943
|
+
const t = e.replace(Ct, (d) => " ".repeat(d.length));
|
|
944
|
+
He.lastIndex = 0;
|
|
938
945
|
let r;
|
|
939
|
-
for (; (r =
|
|
946
|
+
for (; (r = He.exec(t)) !== null; ) {
|
|
940
947
|
const d = r[1].toUpperCase();
|
|
941
|
-
if (!
|
|
942
|
-
throw new
|
|
948
|
+
if (!Rt.has(d))
|
|
949
|
+
throw new X("NAME", `Function ${d} is not allowed.`);
|
|
943
950
|
}
|
|
944
951
|
}
|
|
945
|
-
function
|
|
952
|
+
function At(e, t, r) {
|
|
946
953
|
let d = e;
|
|
947
954
|
if (d == null) throw r.NA;
|
|
948
955
|
if (typeof d == "object" && !(d instanceof r) && (d = t.retrieveRef(d)), d instanceof r) throw d;
|
|
@@ -950,42 +957,42 @@ function Et(e, t, r) {
|
|
|
950
957
|
if (typeof d == "number") return d !== 0;
|
|
951
958
|
throw r.VALUE;
|
|
952
959
|
}
|
|
953
|
-
function
|
|
960
|
+
function ir(e) {
|
|
954
961
|
return e !== null && typeof e == "object" && "value" in e ? e.value : e;
|
|
955
962
|
}
|
|
956
|
-
function
|
|
957
|
-
const t =
|
|
963
|
+
function pe(e) {
|
|
964
|
+
const t = ir(e);
|
|
958
965
|
return Array.isArray(t) ? t.flat(1 / 0) : [t];
|
|
959
966
|
}
|
|
960
|
-
function
|
|
961
|
-
const t =
|
|
967
|
+
function N(e) {
|
|
968
|
+
const t = ir(e);
|
|
962
969
|
return Array.isArray(t) ? t.flat(1 / 0)[0] : t;
|
|
963
970
|
}
|
|
964
|
-
function
|
|
965
|
-
return e === void 0 ? void 0 :
|
|
971
|
+
function xe(e) {
|
|
972
|
+
return e === void 0 ? void 0 : N(e);
|
|
966
973
|
}
|
|
967
974
|
function H(e) {
|
|
968
975
|
return e == null || e === "" ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
969
976
|
}
|
|
970
|
-
function
|
|
977
|
+
function St(e, t) {
|
|
971
978
|
return e instanceof t ? e : new t(e.message || "#ERROR!");
|
|
972
979
|
}
|
|
973
|
-
function
|
|
980
|
+
function k(e) {
|
|
974
981
|
return e.find((t) => t instanceof Error);
|
|
975
982
|
}
|
|
976
|
-
function
|
|
983
|
+
function Nt(e, t) {
|
|
977
984
|
const r = (a) => {
|
|
978
|
-
throw
|
|
985
|
+
throw St(a, t);
|
|
979
986
|
}, d = (a, { checkArgsForErrors: c = !0 } = {}) => (...s) => {
|
|
980
|
-
const o = s.flatMap(
|
|
987
|
+
const o = s.flatMap(pe);
|
|
981
988
|
if (c) {
|
|
982
|
-
const l =
|
|
989
|
+
const l = k(o);
|
|
983
990
|
l && r(l);
|
|
984
991
|
}
|
|
985
992
|
const i = a(...o);
|
|
986
993
|
return i instanceof Error ? r(i) : i;
|
|
987
|
-
},
|
|
988
|
-
const o =
|
|
994
|
+
}, g = (a, { toText: c = !1 } = {}) => (s) => {
|
|
995
|
+
const o = N(s), i = k([o]);
|
|
989
996
|
i && r(i);
|
|
990
997
|
const l = a(c ? H(o) : o);
|
|
991
998
|
return l instanceof Error ? r(l) : l;
|
|
@@ -995,7 +1002,7 @@ function Rt(e, t) {
|
|
|
995
1002
|
// dereferenced or type-checked here) — that's what makes
|
|
996
1003
|
// `IF(FALSE, B100, 99)` a genuine short-circuit rather than a lookup.
|
|
997
1004
|
IF: (a, c, s, o) => {
|
|
998
|
-
const i =
|
|
1005
|
+
const i = At(c, a, t);
|
|
999
1006
|
if (s == null) throw t.NA;
|
|
1000
1007
|
return i ? s : o ?? !1;
|
|
1001
1008
|
},
|
|
@@ -1012,25 +1019,25 @@ function Rt(e, t) {
|
|
|
1012
1019
|
// the other aggregates use.
|
|
1013
1020
|
COUNTA: d(e.COUNTA, { checkArgsForErrors: !1 }),
|
|
1014
1021
|
LARGE: (a, c) => {
|
|
1015
|
-
const s =
|
|
1022
|
+
const s = pe(a), o = N(c), i = k([...s, o]);
|
|
1016
1023
|
i && r(i);
|
|
1017
1024
|
const l = e.LARGE(s, o);
|
|
1018
1025
|
return l instanceof Error ? r(l) : l;
|
|
1019
1026
|
},
|
|
1020
1027
|
SMALL: (a, c) => {
|
|
1021
|
-
const s =
|
|
1028
|
+
const s = pe(a), o = N(c), i = k([...s, o]);
|
|
1022
1029
|
i && r(i);
|
|
1023
1030
|
const l = e.SMALL(s, o);
|
|
1024
1031
|
return l instanceof Error ? r(l) : l;
|
|
1025
1032
|
},
|
|
1026
1033
|
PERMUT: (a, c) => {
|
|
1027
|
-
const s = [
|
|
1034
|
+
const s = [N(a), N(c)], o = k(s);
|
|
1028
1035
|
o && r(o);
|
|
1029
1036
|
const i = e.PERMUT(s[0], s[1]);
|
|
1030
1037
|
return i instanceof Error ? r(i) : i;
|
|
1031
1038
|
},
|
|
1032
1039
|
PERMUTATIONA: (a, c) => {
|
|
1033
|
-
const s = [
|
|
1040
|
+
const s = [N(a), N(c)], o = k(s);
|
|
1034
1041
|
o && r(o);
|
|
1035
1042
|
const i = e.PERMUTATIONA(s[0], s[1]);
|
|
1036
1043
|
return i instanceof Error ? r(i) : i;
|
|
@@ -1042,39 +1049,39 @@ function Rt(e, t) {
|
|
|
1042
1049
|
// real-world data. Same scope decision as the hand-rolled engine this
|
|
1043
1050
|
// replaces, carried forward deliberately rather than dropped.
|
|
1044
1051
|
MATCH: (a, c) => {
|
|
1045
|
-
const s =
|
|
1052
|
+
const s = N(a), o = pe(c), i = k([s, ...o]);
|
|
1046
1053
|
i && r(i);
|
|
1047
1054
|
const l = e.MATCH(s, o, 0);
|
|
1048
1055
|
return l instanceof Error ? r(l) : l;
|
|
1049
1056
|
},
|
|
1050
1057
|
SWITCH: (...a) => {
|
|
1051
|
-
const c = a.map(
|
|
1058
|
+
const c = a.map(N), s = k(c);
|
|
1052
1059
|
s && r(s);
|
|
1053
1060
|
const o = e.SWITCH(...c);
|
|
1054
1061
|
return o instanceof Error ? r(o) : o;
|
|
1055
1062
|
},
|
|
1056
1063
|
SUBSTITUTE: (a, c, s, o) => {
|
|
1057
|
-
const i = [H(
|
|
1058
|
-
o !== void 0 && i.push(
|
|
1059
|
-
const l =
|
|
1064
|
+
const i = [H(N(a)), H(N(c)), H(N(s))];
|
|
1065
|
+
o !== void 0 && i.push(N(o));
|
|
1066
|
+
const l = k(i);
|
|
1060
1067
|
l && r(l);
|
|
1061
1068
|
const y = e.SUBSTITUTE(...i);
|
|
1062
1069
|
return y instanceof Error ? r(y) : y;
|
|
1063
1070
|
},
|
|
1064
1071
|
TEXTJOIN: (a, c, ...s) => {
|
|
1065
|
-
const o = H(
|
|
1072
|
+
const o = H(N(a)), i = N(c), l = s.flatMap(pe).map(H), y = k([o, i]);
|
|
1066
1073
|
y && r(y);
|
|
1067
|
-
const
|
|
1068
|
-
return
|
|
1074
|
+
const h = e.TEXTJOIN(o, i, l);
|
|
1075
|
+
return h instanceof Error ? r(h) : h;
|
|
1069
1076
|
},
|
|
1070
|
-
UPPER:
|
|
1077
|
+
UPPER: g(e.UPPER),
|
|
1071
1078
|
// See DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL above for why these override
|
|
1072
1079
|
// fast-formula-parser's own (real, but broken-for-Date-cells) versions.
|
|
1073
|
-
YEAR:
|
|
1074
|
-
MONTH:
|
|
1075
|
-
DAY:
|
|
1080
|
+
YEAR: g(e.YEAR),
|
|
1081
|
+
MONTH: g(e.MONTH),
|
|
1082
|
+
DAY: g(e.DAY),
|
|
1076
1083
|
WEEKDAY: (a, c) => {
|
|
1077
|
-
const s =
|
|
1084
|
+
const s = N(a), o = N(c), i = k([s]);
|
|
1078
1085
|
i && r(i);
|
|
1079
1086
|
const l = e.WEEKDAY(s, o);
|
|
1080
1087
|
return l instanceof Error ? r(l) : l;
|
|
@@ -1089,53 +1096,53 @@ function Rt(e, t) {
|
|
|
1089
1096
|
// separator, matching Excel's own range-argument behavior — the native
|
|
1090
1097
|
// implementation instead inserts stray commas for a whole-range argument.
|
|
1091
1098
|
CONCATENATE: (...a) => {
|
|
1092
|
-
const c = a.flatMap(
|
|
1099
|
+
const c = a.flatMap(pe), s = k(c);
|
|
1093
1100
|
s && r(s);
|
|
1094
1101
|
const o = e.CONCATENATE(...c.map(H));
|
|
1095
1102
|
return o instanceof Error ? r(o) : o;
|
|
1096
1103
|
},
|
|
1097
1104
|
CONCAT: (...a) => {
|
|
1098
|
-
const c = a.flatMap(
|
|
1105
|
+
const c = a.flatMap(pe), s = k(c);
|
|
1099
1106
|
s && r(s);
|
|
1100
1107
|
const o = e.CONCAT(...c.map(H));
|
|
1101
1108
|
return o instanceof Error ? r(o) : o;
|
|
1102
1109
|
},
|
|
1103
|
-
LEN:
|
|
1104
|
-
TRIM:
|
|
1105
|
-
LOWER:
|
|
1110
|
+
LEN: g(e.LEN, { toText: !0 }),
|
|
1111
|
+
TRIM: g(e.TRIM, { toText: !0 }),
|
|
1112
|
+
LOWER: g(e.LOWER, { toText: !0 }),
|
|
1106
1113
|
LEFT: (a, c) => {
|
|
1107
|
-
const s =
|
|
1114
|
+
const s = N(a), o = xe(c), i = k([s]);
|
|
1108
1115
|
i && r(i);
|
|
1109
1116
|
const l = e.LEFT(H(s), o);
|
|
1110
1117
|
return l instanceof Error ? r(l) : l;
|
|
1111
1118
|
},
|
|
1112
1119
|
RIGHT: (a, c) => {
|
|
1113
|
-
const s =
|
|
1120
|
+
const s = N(a), o = xe(c), i = k([s]);
|
|
1114
1121
|
i && r(i);
|
|
1115
1122
|
const l = e.RIGHT(H(s), o);
|
|
1116
1123
|
return l instanceof Error ? r(l) : l;
|
|
1117
1124
|
},
|
|
1118
1125
|
MID: (a, c, s) => {
|
|
1119
|
-
const o =
|
|
1126
|
+
const o = N(a), i = N(c), l = N(s), y = k([o, i, l]);
|
|
1120
1127
|
y && r(y);
|
|
1121
|
-
const
|
|
1122
|
-
return
|
|
1128
|
+
const h = e.MID(H(o), i, l);
|
|
1129
|
+
return h instanceof Error ? r(h) : h;
|
|
1123
1130
|
},
|
|
1124
1131
|
FIND: (a, c, s) => {
|
|
1125
|
-
const o =
|
|
1132
|
+
const o = N(a), i = N(c), l = xe(s), y = k([o, i]);
|
|
1126
1133
|
y && r(y);
|
|
1127
|
-
const
|
|
1128
|
-
return
|
|
1134
|
+
const h = e.FIND(H(o), H(i), l);
|
|
1135
|
+
return h instanceof Error ? r(h) : h;
|
|
1129
1136
|
},
|
|
1130
1137
|
SEARCH: (a, c, s) => {
|
|
1131
|
-
const o =
|
|
1138
|
+
const o = N(a), i = N(c), l = xe(s), y = k([o, i]);
|
|
1132
1139
|
y && r(y);
|
|
1133
|
-
const
|
|
1134
|
-
return
|
|
1140
|
+
const h = e.SEARCH(H(o), H(i), l);
|
|
1141
|
+
return h instanceof Error ? r(h) : h;
|
|
1135
1142
|
}
|
|
1136
1143
|
};
|
|
1137
1144
|
}
|
|
1138
|
-
const
|
|
1145
|
+
const Ot = {
|
|
1139
1146
|
"#REF!": "REF",
|
|
1140
1147
|
"#VALUE!": "VALUE",
|
|
1141
1148
|
"#DIV/0!": "DIV0",
|
|
@@ -1144,41 +1151,41 @@ const Ct = {
|
|
|
1144
1151
|
"#NUM!": "NUM",
|
|
1145
1152
|
"#NULL!": "NULL"
|
|
1146
1153
|
};
|
|
1147
|
-
function
|
|
1148
|
-
return
|
|
1154
|
+
function We(e) {
|
|
1155
|
+
return Ot[e.error] ?? "ERROR";
|
|
1149
1156
|
}
|
|
1150
|
-
function
|
|
1151
|
-
if (e instanceof
|
|
1157
|
+
function Be(e, t) {
|
|
1158
|
+
if (e instanceof X) return e;
|
|
1152
1159
|
if (e instanceof t) {
|
|
1153
1160
|
const r = e.details;
|
|
1154
|
-
return r instanceof
|
|
1161
|
+
return r instanceof X ? r : r instanceof t ? new X(We(r), r.message) : new X(We(e), e.message);
|
|
1155
1162
|
}
|
|
1156
|
-
return new
|
|
1163
|
+
return new X("ERROR", e instanceof Error ? e.message : void 0);
|
|
1157
1164
|
}
|
|
1158
|
-
function
|
|
1165
|
+
function It(e) {
|
|
1159
1166
|
return Math.max(0, ...e.map((t) => (t == null ? void 0 : t.length) ?? 0));
|
|
1160
1167
|
}
|
|
1161
|
-
function
|
|
1168
|
+
function xt(e) {
|
|
1162
1169
|
return (t) => {
|
|
1163
1170
|
const r = e[t.row - 1];
|
|
1164
1171
|
if (t.row < 1 || t.col < 1 || r == null || t.col - 1 >= r.length)
|
|
1165
|
-
throw new
|
|
1172
|
+
throw new X("REF");
|
|
1166
1173
|
const d = r[t.col - 1];
|
|
1167
1174
|
return d == null || d === "" ? null : d;
|
|
1168
1175
|
};
|
|
1169
1176
|
}
|
|
1170
|
-
function
|
|
1177
|
+
function Lt(e) {
|
|
1171
1178
|
return (t) => {
|
|
1172
|
-
const r = Math.min(t.from.row, t.to.row), d = Math.min(t.from.col, t.to.col),
|
|
1179
|
+
const r = Math.min(t.from.row, t.to.row), d = Math.min(t.from.col, t.to.col), g = Math.max(t.from.row, t.to.row), a = Math.max(t.from.col, t.to.col), c = It(e);
|
|
1173
1180
|
if (r > e.length || d > c)
|
|
1174
|
-
throw new
|
|
1175
|
-
const s = Math.min(
|
|
1181
|
+
throw new X("REF");
|
|
1182
|
+
const s = Math.min(g, e.length), o = [];
|
|
1176
1183
|
for (let i = r; i <= s; i++) {
|
|
1177
1184
|
const l = e[i - 1], y = [];
|
|
1178
1185
|
if (l != null) {
|
|
1179
|
-
const
|
|
1180
|
-
for (let
|
|
1181
|
-
const v = l[
|
|
1186
|
+
const h = Math.min(a, l.length);
|
|
1187
|
+
for (let u = d; u <= h; u++) {
|
|
1188
|
+
const v = l[u - 1];
|
|
1182
1189
|
y.push(v == null || v === "" ? null : v);
|
|
1183
1190
|
}
|
|
1184
1191
|
}
|
|
@@ -1187,38 +1194,38 @@ function St(e) {
|
|
|
1187
1194
|
return o;
|
|
1188
1195
|
};
|
|
1189
1196
|
}
|
|
1190
|
-
function
|
|
1197
|
+
function Mt(e) {
|
|
1191
1198
|
if (e == null || e === "") return null;
|
|
1192
1199
|
if (typeof e == "number" || typeof e == "string" || typeof e == "boolean" || e instanceof Date)
|
|
1193
1200
|
return e;
|
|
1194
|
-
throw new
|
|
1201
|
+
throw new X("VALUE");
|
|
1195
1202
|
}
|
|
1196
|
-
async function
|
|
1197
|
-
if (typeof t != "string") throw new
|
|
1203
|
+
async function Dt(e, t) {
|
|
1204
|
+
if (typeof t != "string") throw new X("ERROR");
|
|
1198
1205
|
const r = t.trim();
|
|
1199
|
-
if (r === "") throw new
|
|
1206
|
+
if (r === "") throw new X("ERROR");
|
|
1200
1207
|
const d = r.startsWith("=") ? r.slice(1) : r;
|
|
1201
|
-
|
|
1202
|
-
const [
|
|
1208
|
+
Tt(d);
|
|
1209
|
+
const [g, a] = await Promise.all([
|
|
1203
1210
|
import("fast-formula-parser"),
|
|
1204
1211
|
import("@formulajs/formulajs")
|
|
1205
|
-
]), c =
|
|
1206
|
-
onCell:
|
|
1207
|
-
onRange:
|
|
1212
|
+
]), c = g.default ?? g, s = c.FormulaError, o = new c({
|
|
1213
|
+
onCell: xt(e),
|
|
1214
|
+
onRange: Lt(e),
|
|
1208
1215
|
// 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.
|
|
1209
|
-
functions:
|
|
1216
|
+
functions: Nt(a, s)
|
|
1210
1217
|
});
|
|
1211
1218
|
let i;
|
|
1212
1219
|
try {
|
|
1213
1220
|
i = o.parse(d, { row: 1, col: 1, sheet: "Sheet1" });
|
|
1214
1221
|
} catch (l) {
|
|
1215
|
-
throw
|
|
1222
|
+
throw Be(l, s);
|
|
1216
1223
|
}
|
|
1217
1224
|
if (i instanceof s)
|
|
1218
|
-
throw
|
|
1219
|
-
return
|
|
1225
|
+
throw Be(i, s);
|
|
1226
|
+
return Mt(i);
|
|
1220
1227
|
}
|
|
1221
|
-
const
|
|
1228
|
+
const Ke = {
|
|
1222
1229
|
REF: "#REF!",
|
|
1223
1230
|
VALUE: "#VALUE!",
|
|
1224
1231
|
DIV0: "#DIV/0!",
|
|
@@ -1228,102 +1235,102 @@ const Pe = {
|
|
|
1228
1235
|
NUM: "#NUM!",
|
|
1229
1236
|
NULL: "#NULL!"
|
|
1230
1237
|
};
|
|
1231
|
-
async function
|
|
1232
|
-
return e.length === 0 ? t.map((r) => ({ label: (r == null ? void 0 : r.label) ?? "(unknown)", value: null, error:
|
|
1238
|
+
async function zt(e, t) {
|
|
1239
|
+
return e.length === 0 ? t.map((r) => ({ label: (r == null ? void 0 : r.label) ?? "(unknown)", value: null, error: Ke.ERROR })) : Promise.all(
|
|
1233
1240
|
t.map(async (r) => {
|
|
1234
1241
|
try {
|
|
1235
1242
|
if (!r || typeof r.label != "string" || typeof r.expression != "string")
|
|
1236
|
-
throw new
|
|
1237
|
-
return { label: r.label, value: await
|
|
1243
|
+
throw new X("ERROR");
|
|
1244
|
+
return { label: r.label, value: await Dt(e, r.expression) };
|
|
1238
1245
|
} catch (d) {
|
|
1239
|
-
const
|
|
1240
|
-
return { label: (r == null ? void 0 : r.label) ?? "(unknown)", value: null, error:
|
|
1246
|
+
const g = d instanceof X ? d.code : "ERROR";
|
|
1247
|
+
return { label: (r == null ? void 0 : r.label) ?? "(unknown)", value: null, error: Ke[g] };
|
|
1241
1248
|
}
|
|
1242
1249
|
})
|
|
1243
1250
|
);
|
|
1244
1251
|
}
|
|
1245
|
-
const
|
|
1246
|
-
function
|
|
1252
|
+
const Ut = ".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv", kt = 10 * 1024 * 1024, De = 200, Ft = 50, $t = [];
|
|
1253
|
+
function Ce(e) {
|
|
1247
1254
|
return e == null || e === "" ? "" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
1248
1255
|
}
|
|
1249
|
-
const
|
|
1256
|
+
const _t = ({
|
|
1250
1257
|
data: e,
|
|
1251
1258
|
handleChange: t,
|
|
1252
1259
|
path: r,
|
|
1253
1260
|
label: d,
|
|
1254
|
-
required:
|
|
1261
|
+
required: g,
|
|
1255
1262
|
schema: a,
|
|
1256
1263
|
enabled: c,
|
|
1257
1264
|
errors: s,
|
|
1258
1265
|
visible: o = !0
|
|
1259
1266
|
}) => {
|
|
1260
|
-
var
|
|
1261
|
-
|
|
1262
|
-
const i = !s || s.length === 0, l = c !== !1, y = (a == null ? void 0 : a["x-spreadsheet"]) ?? {},
|
|
1267
|
+
var Ee;
|
|
1268
|
+
ue(o, r, t, null);
|
|
1269
|
+
const i = !s || s.length === 0, l = c !== !1, y = (a == null ? void 0 : a["x-spreadsheet"]) ?? {}, h = (a == null ? void 0 : a["x-evaluate"]) ?? $t, u = y.accept ?? Ut, v = y.maxSize ?? kt, M = y.persistSheet !== !1, A = y.columnHeader === !0, w = y.rowHeader === !0, O = y.showSheet !== !1, z = y.sheetName, S = e ?? null, [q, P] = _(
|
|
1263
1270
|
() => {
|
|
1264
|
-
var
|
|
1265
|
-
return
|
|
1271
|
+
var E;
|
|
1272
|
+
return S != null && S.sheet || (((E = S == null ? void 0 : S.derivations) == null ? void 0 : E.length) ?? 0) > 0 ? "ready" : "empty";
|
|
1266
1273
|
}
|
|
1267
|
-
), [
|
|
1268
|
-
async (
|
|
1269
|
-
if (
|
|
1270
|
-
|
|
1274
|
+
), [ee, x] = _(null), [J, F] = _(!1), [V, j] = _(null), K = de(null), $ = V ?? (S == null ? void 0 : S.sheet) ?? null, Q = (S == null ? void 0 : S.derivations) ?? [], re = $ != null || S != null, ie = ke(
|
|
1275
|
+
async (E) => {
|
|
1276
|
+
if (x(null), E.size > v) {
|
|
1277
|
+
x(`File exceeds the ${me(v)} limit.`);
|
|
1271
1278
|
return;
|
|
1272
1279
|
}
|
|
1273
|
-
if (!
|
|
1274
|
-
|
|
1280
|
+
if (!u.split(",").map((m) => m.trim()).some((m) => m === "*" || m === "*/*" ? !0 : m.endsWith("/*") ? E.type.startsWith(m.slice(0, -1)) : m.startsWith(".") ? E.name.toLowerCase().endsWith(m.toLowerCase()) : E.type === m)) {
|
|
1281
|
+
x(`Invalid type. Accepted: ${ye(u)}`);
|
|
1275
1282
|
return;
|
|
1276
1283
|
}
|
|
1277
|
-
|
|
1278
|
-
let
|
|
1284
|
+
P("parsing");
|
|
1285
|
+
let te;
|
|
1279
1286
|
try {
|
|
1280
|
-
const
|
|
1281
|
-
|
|
1282
|
-
} catch (
|
|
1283
|
-
|
|
1284
|
-
|
|
1287
|
+
const m = await E.arrayBuffer();
|
|
1288
|
+
te = gt(m, z).matrix;
|
|
1289
|
+
} catch (m) {
|
|
1290
|
+
P("error"), x(
|
|
1291
|
+
m instanceof Ue ? m.message : "This doesn't look like a valid spreadsheet. Please check the file and try again."
|
|
1285
1292
|
);
|
|
1286
1293
|
return;
|
|
1287
1294
|
}
|
|
1288
|
-
|
|
1289
|
-
const
|
|
1295
|
+
j(te);
|
|
1296
|
+
const ae = await zt(te, h);
|
|
1290
1297
|
t(
|
|
1291
1298
|
r,
|
|
1292
|
-
|
|
1293
|
-
),
|
|
1299
|
+
M ? { sheet: te, derivations: ae } : { derivations: ae }
|
|
1300
|
+
), P("ready");
|
|
1294
1301
|
},
|
|
1295
|
-
[
|
|
1302
|
+
[u, v, M, z, h, r, t]
|
|
1296
1303
|
);
|
|
1297
|
-
if (o === !1 || !l && !
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1300
|
-
},
|
|
1301
|
-
var
|
|
1302
|
-
|
|
1303
|
-
},
|
|
1304
|
-
var
|
|
1305
|
-
(
|
|
1304
|
+
if (o === !1 || !l && !re) return null;
|
|
1305
|
+
const se = (E) => {
|
|
1306
|
+
E.preventDefault(), E.stopPropagation(), l && F(E.type === "dragenter" || E.type === "dragover");
|
|
1307
|
+
}, ce = (E) => {
|
|
1308
|
+
var L;
|
|
1309
|
+
E.preventDefault(), E.stopPropagation(), F(!1), l && (L = E.dataTransfer.files) != null && L[0] && ie(E.dataTransfer.files[0]);
|
|
1310
|
+
}, fe = (E) => {
|
|
1311
|
+
var L;
|
|
1312
|
+
(L = E.target.files) != null && L[0] && (ie(E.target.files[0]), E.target.value = "");
|
|
1306
1313
|
}, b = () => {
|
|
1307
|
-
l && (
|
|
1308
|
-
},
|
|
1309
|
-
|
|
1310
|
-
Math.max(0, ...
|
|
1311
|
-
),
|
|
1312
|
-
return /* @__PURE__ */
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */
|
|
1314
|
+
l && (j(null), x(null), P("empty"), t(r, null));
|
|
1315
|
+
}, I = A ? 1 : 0, D = w ? 1 : 0, R = $ ? $.slice(I) : [], U = R.slice(0, De), G = Math.min(
|
|
1316
|
+
Ft,
|
|
1317
|
+
Math.max(0, ...U.map((E) => Math.max(0, E.length - D)))
|
|
1318
|
+
), Y = Array.from({ length: G }, (E, L) => L + D), B = O && $ == null && S != null, be = A && w ? Ce((Ee = $ == null ? void 0 : $[0]) == null ? void 0 : Ee[0]) : "";
|
|
1319
|
+
return /* @__PURE__ */ p(C, { mb: "4", children: [
|
|
1320
|
+
/* @__PURE__ */ p(T, { align: "center", justify: "between", mb: "2", children: [
|
|
1321
|
+
/* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", children: [
|
|
1315
1322
|
d,
|
|
1316
|
-
|
|
1323
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: " *" })
|
|
1317
1324
|
] }),
|
|
1318
|
-
/* @__PURE__ */
|
|
1319
|
-
|
|
1325
|
+
/* @__PURE__ */ p(f, { size: "1", color: "gray", children: [
|
|
1326
|
+
me(v),
|
|
1320
1327
|
" max · ",
|
|
1321
|
-
|
|
1328
|
+
ye(u)
|
|
1322
1329
|
] })
|
|
1323
1330
|
] }),
|
|
1324
|
-
|
|
1331
|
+
re && /* @__PURE__ */ n($e, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ p(T, { align: "center", gap: "3", children: [
|
|
1325
1332
|
/* @__PURE__ */ n(
|
|
1326
|
-
|
|
1333
|
+
C,
|
|
1327
1334
|
{
|
|
1328
1335
|
style: {
|
|
1329
1336
|
background: "var(--blue-3)",
|
|
@@ -1332,112 +1339,112 @@ const zt = ({
|
|
|
1332
1339
|
color: "var(--blue-9)",
|
|
1333
1340
|
flexShrink: 0
|
|
1334
1341
|
},
|
|
1335
|
-
children: /* @__PURE__ */ n(
|
|
1342
|
+
children: /* @__PURE__ */ n(Qe, { width: "20", height: "20" })
|
|
1336
1343
|
}
|
|
1337
1344
|
),
|
|
1338
|
-
/* @__PURE__ */ n(
|
|
1339
|
-
/* @__PURE__ */ n(
|
|
1340
|
-
l && /* @__PURE__ */ n(
|
|
1345
|
+
/* @__PURE__ */ n(C, { style: { flex: 1 }, children: /* @__PURE__ */ n(f, { size: "2", weight: "bold", children: "Spreadsheet uploaded" }) }),
|
|
1346
|
+
/* @__PURE__ */ n(er, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
|
|
1347
|
+
l && /* @__PURE__ */ n(je, { variant: "ghost", color: "gray", onClick: b, "aria-label": "Remove spreadsheet", children: /* @__PURE__ */ n(rr, {}) })
|
|
1341
1348
|
] }) }),
|
|
1342
|
-
l && /* @__PURE__ */
|
|
1349
|
+
l && /* @__PURE__ */ p(
|
|
1343
1350
|
"div",
|
|
1344
1351
|
{
|
|
1345
1352
|
role: "button",
|
|
1346
1353
|
tabIndex: 0,
|
|
1347
1354
|
onClick: () => {
|
|
1348
|
-
var
|
|
1349
|
-
return (
|
|
1355
|
+
var E;
|
|
1356
|
+
return (E = K.current) == null ? void 0 : E.click();
|
|
1350
1357
|
},
|
|
1351
|
-
onKeyDown: (
|
|
1352
|
-
var
|
|
1353
|
-
(
|
|
1358
|
+
onKeyDown: (E) => {
|
|
1359
|
+
var L;
|
|
1360
|
+
(E.key === "Enter" || E.key === " ") && (E.preventDefault(), (L = K.current) == null || L.click());
|
|
1354
1361
|
},
|
|
1355
|
-
onDragEnter:
|
|
1356
|
-
onDragLeave:
|
|
1357
|
-
onDragOver:
|
|
1358
|
-
onDrop:
|
|
1362
|
+
onDragEnter: se,
|
|
1363
|
+
onDragLeave: se,
|
|
1364
|
+
onDragOver: se,
|
|
1365
|
+
onDrop: ce,
|
|
1359
1366
|
style: { cursor: "pointer" },
|
|
1360
1367
|
className: [
|
|
1361
1368
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
1362
1369
|
"transition-all duration-200 ease-in-out",
|
|
1363
|
-
|
|
1370
|
+
J ? "border-blue-500 bg-blue-50" : ee ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
1364
1371
|
].join(" "),
|
|
1365
1372
|
children: [
|
|
1366
|
-
/* @__PURE__ */ n("input", { ref:
|
|
1367
|
-
/* @__PURE__ */ n(T, { direction: "column", align: "center", gap: "2", children:
|
|
1368
|
-
/* @__PURE__ */ n(
|
|
1369
|
-
/* @__PURE__ */ n(
|
|
1370
|
-
] }) :
|
|
1371
|
-
/* @__PURE__ */ n(
|
|
1372
|
-
/* @__PURE__ */ n(
|
|
1373
|
-
/* @__PURE__ */ n(
|
|
1374
|
-
] }) : /* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */ n(
|
|
1376
|
-
/* @__PURE__ */ n(
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
|
|
1373
|
+
/* @__PURE__ */ n("input", { ref: K, type: "file", style: { display: "none" }, accept: u, onChange: fe }),
|
|
1374
|
+
/* @__PURE__ */ n(T, { direction: "column", align: "center", gap: "2", children: q === "parsing" ? /* @__PURE__ */ p(Te, { children: [
|
|
1375
|
+
/* @__PURE__ */ n(ze, { size: "3" }),
|
|
1376
|
+
/* @__PURE__ */ n(f, { size: "2", color: "gray", children: "Parsing spreadsheet…" })
|
|
1377
|
+
] }) : ee ? /* @__PURE__ */ p(Te, { children: [
|
|
1378
|
+
/* @__PURE__ */ n(tr, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
1379
|
+
/* @__PURE__ */ n(f, { size: "2", color: "red", weight: "medium", children: ee }),
|
|
1380
|
+
/* @__PURE__ */ n(f, { size: "1", color: "gray", children: "Click to try again" })
|
|
1381
|
+
] }) : /* @__PURE__ */ p(Te, { children: [
|
|
1382
|
+
/* @__PURE__ */ n(nr, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
1383
|
+
/* @__PURE__ */ n(f, { size: "2", weight: "medium", children: re ? "Click to upload a replacement" : "Click to upload or drag and drop" }),
|
|
1384
|
+
/* @__PURE__ */ p(f, { size: "1", color: "gray", children: [
|
|
1385
|
+
me(v),
|
|
1379
1386
|
" max · ",
|
|
1380
|
-
|
|
1387
|
+
ye(u)
|
|
1381
1388
|
] })
|
|
1382
1389
|
] }) })
|
|
1383
1390
|
]
|
|
1384
1391
|
}
|
|
1385
1392
|
),
|
|
1386
|
-
|
|
1387
|
-
/* @__PURE__ */ n(
|
|
1388
|
-
/* @__PURE__ */ n(
|
|
1389
|
-
/* @__PURE__ */ n(
|
|
1390
|
-
|
|
1391
|
-
var
|
|
1392
|
-
return /* @__PURE__ */ n(
|
|
1393
|
+
$ && O && /* @__PURE__ */ p(C, { mt: "3", children: [
|
|
1394
|
+
/* @__PURE__ */ n(C, { style: { overflow: "auto", maxHeight: 420 }, children: /* @__PURE__ */ p(ne.Root, { variant: "surface", size: "1", children: [
|
|
1395
|
+
/* @__PURE__ */ n(ne.Header, { children: /* @__PURE__ */ p(ne.Row, { children: [
|
|
1396
|
+
/* @__PURE__ */ n(ne.ColumnHeaderCell, { children: be }),
|
|
1397
|
+
Y.map((E) => {
|
|
1398
|
+
var L;
|
|
1399
|
+
return /* @__PURE__ */ n(ne.ColumnHeaderCell, { children: A ? Ce((L = $[0]) == null ? void 0 : L[E]) : mt(E) }, E);
|
|
1393
1400
|
})
|
|
1394
1401
|
] }) }),
|
|
1395
|
-
/* @__PURE__ */ n(
|
|
1396
|
-
var
|
|
1397
|
-
const
|
|
1398
|
-
return /* @__PURE__ */
|
|
1399
|
-
/* @__PURE__ */ n(
|
|
1400
|
-
|
|
1401
|
-
] },
|
|
1402
|
+
/* @__PURE__ */ n(ne.Body, { children: U.map((E, L) => {
|
|
1403
|
+
var te;
|
|
1404
|
+
const we = I + L;
|
|
1405
|
+
return /* @__PURE__ */ p(ne.Row, { children: [
|
|
1406
|
+
/* @__PURE__ */ n(ne.RowHeaderCell, { children: w ? Ce((te = $[we]) == null ? void 0 : te[0]) : we + 1 }),
|
|
1407
|
+
Y.map((ae) => /* @__PURE__ */ n(ne.Cell, { children: Ce(E[ae]) }, ae))
|
|
1408
|
+
] }, L);
|
|
1402
1409
|
}) })
|
|
1403
1410
|
] }) }),
|
|
1404
|
-
|
|
1411
|
+
R.length > De && /* @__PURE__ */ p(f, { size: "1", color: "gray", mt: "1", style: { display: "block" }, children: [
|
|
1405
1412
|
"Showing first ",
|
|
1406
|
-
|
|
1413
|
+
De,
|
|
1407
1414
|
" of ",
|
|
1408
|
-
|
|
1415
|
+
R.length,
|
|
1409
1416
|
" rows"
|
|
1410
1417
|
] })
|
|
1411
1418
|
] }),
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
/* @__PURE__ */ n(
|
|
1415
|
-
/* @__PURE__ */ n(T, { direction: "column", gap: "1", children:
|
|
1416
|
-
/* @__PURE__ */ n(
|
|
1417
|
-
|
|
1419
|
+
B && /* @__PURE__ */ n(f, { size: "2", color: "gray", mt: "3", style: { display: "block" }, children: "Sheet preview not stored for this field — re-upload to view contents." }),
|
|
1420
|
+
Q.length > 0 && /* @__PURE__ */ p(C, { mt: "3", children: [
|
|
1421
|
+
/* @__PURE__ */ n(f, { size: "2", weight: "bold", as: "div", mb: "1", children: "Computed values" }),
|
|
1422
|
+
/* @__PURE__ */ n(T, { direction: "column", gap: "1", children: Q.map((E, L) => /* @__PURE__ */ p(T, { justify: "between", children: [
|
|
1423
|
+
/* @__PURE__ */ n(f, { size: "2", children: E.label }),
|
|
1424
|
+
E.error ? /* @__PURE__ */ n(f, { size: "2", color: "red", children: E.error }) : (
|
|
1418
1425
|
// d.value is CellValue | null now (SUM/AVERAGE aren't the only
|
|
1419
1426
|
// possible results anymore — INDEX/CONCATENATE can return a
|
|
1420
1427
|
// string, a bare comparison can return a boolean, etc.), so
|
|
1421
1428
|
// `.toLocaleString()` would throw for e.g. a boolean result.
|
|
1422
1429
|
// Reuse the same formatCell used for the sheet-preview grid.
|
|
1423
|
-
/* @__PURE__ */ n(
|
|
1430
|
+
/* @__PURE__ */ n(f, { size: "2", children: Ce(E.value) })
|
|
1424
1431
|
)
|
|
1425
|
-
] },
|
|
1432
|
+
] }, L)) })
|
|
1426
1433
|
] }),
|
|
1427
|
-
!i && /* @__PURE__ */ n(
|
|
1434
|
+
!i && /* @__PURE__ */ n(f, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: le(s, d) })
|
|
1428
1435
|
] });
|
|
1429
|
-
},
|
|
1436
|
+
}, Pt = oe(_t), Vt = W(
|
|
1430
1437
|
10,
|
|
1431
1438
|
// matches FileControlTester's rank — beats the default object/Group renderer
|
|
1432
|
-
|
|
1439
|
+
Fe(
|
|
1433
1440
|
(e) => e.type === "object" && typeof e["x-spreadsheet"] == "object"
|
|
1434
1441
|
)
|
|
1435
|
-
),
|
|
1442
|
+
), Ht = ({
|
|
1436
1443
|
data: e,
|
|
1437
1444
|
path: t,
|
|
1438
1445
|
schema: r,
|
|
1439
1446
|
uischema: d,
|
|
1440
|
-
enabled:
|
|
1447
|
+
enabled: g,
|
|
1441
1448
|
visible: a,
|
|
1442
1449
|
addItem: c,
|
|
1443
1450
|
removeItems: s,
|
|
@@ -1447,124 +1454,124 @@ const zt = ({
|
|
|
1447
1454
|
const l = i ? r : r.items, y = i || r;
|
|
1448
1455
|
if (a === !1 || !l || typeof l != "object" || Array.isArray(l))
|
|
1449
1456
|
return null;
|
|
1450
|
-
const
|
|
1451
|
-
const
|
|
1452
|
-
c && c(t,
|
|
1453
|
-
},
|
|
1457
|
+
const h = l, u = Array.isArray(e) ? e : [], v = y.title || "Array Items", M = () => {
|
|
1458
|
+
const w = br(h, o);
|
|
1459
|
+
c && c(t, w)();
|
|
1460
|
+
}, A = (w) => {
|
|
1454
1461
|
if (s) {
|
|
1455
|
-
const
|
|
1456
|
-
|
|
1462
|
+
const O = s(t, [w]);
|
|
1463
|
+
O && O();
|
|
1457
1464
|
}
|
|
1458
1465
|
};
|
|
1459
|
-
return /* @__PURE__ */ n(
|
|
1460
|
-
/* @__PURE__ */ n(
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
var
|
|
1464
|
-
const
|
|
1465
|
-
return /* @__PURE__ */ n(
|
|
1466
|
-
/* @__PURE__ */
|
|
1467
|
-
/* @__PURE__ */
|
|
1466
|
+
return /* @__PURE__ */ n(C, { mb: "6", children: /* @__PURE__ */ p(T, { direction: "column", gap: "4", children: [
|
|
1467
|
+
/* @__PURE__ */ n(f, { as: "div", size: "4", weight: "bold", children: v }),
|
|
1468
|
+
u.length === 0 && /* @__PURE__ */ n(C, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ n(f, { size: "2", color: "gray", children: "No items have been added yet." }) }),
|
|
1469
|
+
u.map((w, O) => {
|
|
1470
|
+
var S;
|
|
1471
|
+
const z = `${t}.${O}`;
|
|
1472
|
+
return /* @__PURE__ */ n($e, { size: "3", variant: "surface", children: /* @__PURE__ */ p(T, { direction: "column", gap: "4", children: [
|
|
1473
|
+
/* @__PURE__ */ p(T, { justify: "between", align: "center", children: [
|
|
1474
|
+
/* @__PURE__ */ p(f, { size: "3", weight: "bold", children: [
|
|
1468
1475
|
"Item ",
|
|
1469
|
-
|
|
1476
|
+
O + 1
|
|
1470
1477
|
] }),
|
|
1471
|
-
|
|
1472
|
-
|
|
1478
|
+
g && /* @__PURE__ */ p(
|
|
1479
|
+
Le,
|
|
1473
1480
|
{
|
|
1474
1481
|
type: "button",
|
|
1475
1482
|
color: "red",
|
|
1476
1483
|
variant: "soft",
|
|
1477
|
-
onClick: () =>
|
|
1484
|
+
onClick: () => A(O),
|
|
1478
1485
|
title: "Remove item",
|
|
1479
1486
|
children: [
|
|
1480
|
-
/* @__PURE__ */ n(
|
|
1487
|
+
/* @__PURE__ */ n(Sr, {}),
|
|
1481
1488
|
"Remove"
|
|
1482
1489
|
]
|
|
1483
1490
|
}
|
|
1484
1491
|
)
|
|
1485
1492
|
] }),
|
|
1486
|
-
/* @__PURE__ */ n(
|
|
1487
|
-
|
|
1493
|
+
/* @__PURE__ */ n(C, { children: /* @__PURE__ */ n(
|
|
1494
|
+
Se,
|
|
1488
1495
|
{
|
|
1489
|
-
schema:
|
|
1490
|
-
uischema: ((
|
|
1496
|
+
schema: h,
|
|
1497
|
+
uischema: ((S = d.options) == null ? void 0 : S.detail) || (h.type === "object" || h.properties ? {
|
|
1491
1498
|
type: "VerticalLayout",
|
|
1492
|
-
elements: Object.keys(
|
|
1499
|
+
elements: Object.keys(h.properties || {}).map((q) => ({
|
|
1493
1500
|
type: "Control",
|
|
1494
|
-
scope: `#/properties/${
|
|
1501
|
+
scope: `#/properties/${q}`
|
|
1495
1502
|
}))
|
|
1496
1503
|
} : {
|
|
1497
1504
|
type: "Control",
|
|
1498
1505
|
scope: "#"
|
|
1499
1506
|
}),
|
|
1500
|
-
path:
|
|
1501
|
-
enabled:
|
|
1507
|
+
path: z,
|
|
1508
|
+
enabled: g,
|
|
1502
1509
|
renderers: void 0,
|
|
1503
1510
|
cells: void 0
|
|
1504
1511
|
}
|
|
1505
1512
|
) })
|
|
1506
|
-
] }) },
|
|
1513
|
+
] }) }, z);
|
|
1507
1514
|
}),
|
|
1508
|
-
|
|
1509
|
-
/* @__PURE__ */ n(
|
|
1515
|
+
g && /* @__PURE__ */ n(C, { mt: "2", children: /* @__PURE__ */ p(Le, { type: "button", variant: "surface", onClick: M, children: [
|
|
1516
|
+
/* @__PURE__ */ n(Nr, {}),
|
|
1510
1517
|
"Add Item"
|
|
1511
1518
|
] }) })
|
|
1512
1519
|
] }) });
|
|
1513
|
-
},
|
|
1520
|
+
}, Ge = Rr(Ht), Wt = W(3, Er), Bt = ({ uischema: e, visible: t }) => {
|
|
1514
1521
|
const r = e;
|
|
1515
|
-
return t === !1 ? null : /* @__PURE__ */ n(
|
|
1516
|
-
},
|
|
1517
|
-
{ tester:
|
|
1518
|
-
{ tester:
|
|
1519
|
-
{ tester:
|
|
1520
|
-
{ tester:
|
|
1521
|
-
{ tester:
|
|
1522
|
-
{ tester:
|
|
1523
|
-
{ tester:
|
|
1524
|
-
{ tester:
|
|
1525
|
-
{ tester:
|
|
1526
|
-
{ tester:
|
|
1527
|
-
{ tester:
|
|
1528
|
-
{ tester:
|
|
1529
|
-
{ tester:
|
|
1530
|
-
{ tester:
|
|
1531
|
-
{ tester:
|
|
1532
|
-
{ tester:
|
|
1522
|
+
return t === !1 ? null : /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ n(qe, { size: "4", children: r.text }) });
|
|
1523
|
+
}, Kt = W(1, Ae("Label")), Gt = W(3, wr), on = [
|
|
1524
|
+
{ tester: zr, renderer: Ur },
|
|
1525
|
+
{ tester: Fr, renderer: $r },
|
|
1526
|
+
{ tester: Pr, renderer: Vr },
|
|
1527
|
+
{ tester: Wr, renderer: Br },
|
|
1528
|
+
{ tester: qr, renderer: Zr },
|
|
1529
|
+
{ tester: Gr, renderer: Xr },
|
|
1530
|
+
{ tester: rt, renderer: tt },
|
|
1531
|
+
{ tester: ot, renderer: nt },
|
|
1532
|
+
{ tester: it, renderer: lt },
|
|
1533
|
+
{ tester: ct, renderer: st },
|
|
1534
|
+
{ tester: dt, renderer: at },
|
|
1535
|
+
{ tester: pt, renderer: ht },
|
|
1536
|
+
{ tester: Vt, renderer: Pt },
|
|
1537
|
+
{ tester: Wt, renderer: Ge },
|
|
1538
|
+
{ tester: Gt, renderer: Ge },
|
|
1539
|
+
{ tester: Kt, renderer: Bt }
|
|
1533
1540
|
];
|
|
1534
1541
|
export {
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1542
|
+
Ge as ArrayControl,
|
|
1543
|
+
Wt as ArrayControlTester,
|
|
1544
|
+
_r as BooleanControl,
|
|
1545
|
+
Pr as BooleanControlTester,
|
|
1546
|
+
at as CategorizationLayoutRenderer,
|
|
1547
|
+
dt as CategorizationLayoutTester,
|
|
1548
|
+
et as DateControl,
|
|
1549
|
+
rt as DateControlTester,
|
|
1550
|
+
ht as FileControl,
|
|
1551
|
+
pt as FileControlTester,
|
|
1552
|
+
st as GroupLayoutRenderer,
|
|
1553
|
+
ct as GroupLayoutTester,
|
|
1554
|
+
lt as HorizontalLayoutRenderer,
|
|
1555
|
+
it as HorizontalLayoutTester,
|
|
1556
|
+
Bt as LabelRenderer,
|
|
1557
|
+
Kt as LabelTester,
|
|
1558
|
+
kr as NumberControl,
|
|
1559
|
+
Fr as NumberControlTester,
|
|
1560
|
+
Hr as RadioControl,
|
|
1561
|
+
Wr as RadioControlTester,
|
|
1562
|
+
Zr as SearchSelectControl,
|
|
1563
|
+
qr as SearchSelectControlTester,
|
|
1564
|
+
nn as SearchServiceProvider,
|
|
1565
|
+
Kr as SelectControl,
|
|
1566
|
+
Gr as SelectControlTester,
|
|
1567
|
+
Pt as SpreadsheetControl,
|
|
1568
|
+
Vt as SpreadsheetControlTester,
|
|
1569
|
+
Dr as TextControl,
|
|
1570
|
+
zr as TextControlTester,
|
|
1571
|
+
tn as UploadProvider,
|
|
1572
|
+
nt as VerticalLayoutRenderer,
|
|
1573
|
+
ot as VerticalLayoutTester,
|
|
1574
|
+
on as radixRenderers,
|
|
1575
|
+
Mr as useSearchService,
|
|
1576
|
+
Lr as useUpload
|
|
1570
1577
|
};
|