@opennsw/jsonforms-renderers 0.4.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 +6 -1
- package/dist/jsonforms-renderers.css +1 -1
- package/dist/renderers.cjs.js +3 -3
- package/dist/renderers.es.js +1252 -642
- package/package.json +9 -4
package/dist/renderers.es.js
CHANGED
|
@@ -1,191 +1,195 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
children: e,
|
|
15
|
+
onUpload: t,
|
|
16
|
+
getDownloadUrl: r
|
|
13
17
|
}) {
|
|
14
|
-
const
|
|
15
|
-
return /* @__PURE__ */
|
|
18
|
+
const d = { onUpload: t, getDownloadUrl: r };
|
|
19
|
+
return /* @__PURE__ */ n(or.Provider, { value: d, children: e });
|
|
16
20
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
21
|
+
function Lr() {
|
|
22
|
+
return Xe(or);
|
|
19
23
|
}
|
|
20
|
-
const
|
|
21
|
-
function
|
|
22
|
-
children:
|
|
23
|
-
services:
|
|
24
|
+
const lr = Ye(null);
|
|
25
|
+
function nn({
|
|
26
|
+
children: e,
|
|
27
|
+
services: t
|
|
24
28
|
}) {
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
29
|
+
const r = dr(() => t, [t]);
|
|
30
|
+
return /* @__PURE__ */ n(lr.Provider, { value: r, children: e });
|
|
27
31
|
}
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
-
return !
|
|
32
|
+
function Mr(e) {
|
|
33
|
+
const t = Xe(lr);
|
|
34
|
+
return !t || !e ? null : t[e] ?? null;
|
|
31
35
|
}
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, [t, r,
|
|
36
|
-
},
|
|
37
|
-
`).map((
|
|
38
|
-
`) : "",
|
|
39
|
-
data:
|
|
40
|
-
handleChange:
|
|
41
|
-
path:
|
|
42
|
-
label:
|
|
43
|
-
required:
|
|
44
|
-
errors:
|
|
45
|
-
uischema:
|
|
46
|
-
schema:
|
|
47
|
-
enabled:
|
|
48
|
-
visible:
|
|
36
|
+
const ue = (e, t, r, d = void 0) => {
|
|
37
|
+
ge(() => {
|
|
38
|
+
e === !1 && r(t, d);
|
|
39
|
+
}, [e, t, r, d]);
|
|
40
|
+
}, le = (e, t) => e ? e.split(`
|
|
41
|
+
`).map((r) => r.trim() === "is a required property" ? `${t || "This field"} is required` : r).join(`
|
|
42
|
+
`) : "", Dr = ({
|
|
43
|
+
data: e,
|
|
44
|
+
handleChange: t,
|
|
45
|
+
path: r,
|
|
46
|
+
label: d,
|
|
47
|
+
required: g,
|
|
48
|
+
errors: a,
|
|
49
|
+
uischema: c,
|
|
50
|
+
schema: s,
|
|
51
|
+
enabled: o,
|
|
52
|
+
visible: i = !0
|
|
49
53
|
}) => {
|
|
50
|
-
var
|
|
51
|
-
if (
|
|
54
|
+
var y;
|
|
55
|
+
if (ue(i, r, t), i === !1)
|
|
52
56
|
return null;
|
|
53
|
-
const l =
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */ f
|
|
56
|
-
|
|
57
|
+
const l = a.length === 0;
|
|
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
|
+
d,
|
|
57
61
|
" ",
|
|
58
|
-
|
|
62
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
59
63
|
] }),
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
64
|
+
/* @__PURE__ */ n(
|
|
65
|
+
ve.Root,
|
|
62
66
|
{
|
|
63
|
-
value:
|
|
64
|
-
onChange: (
|
|
65
|
-
disabled: !
|
|
66
|
-
placeholder: (
|
|
67
|
+
value: e || "",
|
|
68
|
+
onChange: (h) => t(r, h.target.value),
|
|
69
|
+
disabled: !o,
|
|
70
|
+
placeholder: (y = c.options) == null ? void 0 : y.placeholder,
|
|
67
71
|
color: l ? void 0 : "red",
|
|
68
|
-
id:
|
|
72
|
+
id: r
|
|
69
73
|
}
|
|
70
74
|
),
|
|
71
|
-
!l && /* @__PURE__ */
|
|
72
|
-
|
|
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 })
|
|
73
77
|
] }) });
|
|
74
|
-
},
|
|
75
|
-
data:
|
|
76
|
-
handleChange:
|
|
77
|
-
path:
|
|
78
|
-
label:
|
|
79
|
-
required:
|
|
80
|
-
errors:
|
|
81
|
-
uischema:
|
|
82
|
-
schema:
|
|
83
|
-
enabled:
|
|
84
|
-
visible:
|
|
78
|
+
}, zr = W(1, ur), Ur = oe(Dr), kr = ({
|
|
79
|
+
data: e,
|
|
80
|
+
handleChange: t,
|
|
81
|
+
path: r,
|
|
82
|
+
label: d,
|
|
83
|
+
required: g,
|
|
84
|
+
errors: a,
|
|
85
|
+
uischema: c,
|
|
86
|
+
schema: s,
|
|
87
|
+
enabled: o,
|
|
88
|
+
visible: i = !0
|
|
85
89
|
}) => {
|
|
86
|
-
var
|
|
87
|
-
if (
|
|
90
|
+
var h;
|
|
91
|
+
if (ue(i, r, t), i === !1)
|
|
88
92
|
return null;
|
|
89
|
-
const l =
|
|
90
|
-
if (
|
|
91
|
-
r
|
|
93
|
+
const l = a.length === 0, y = (u) => {
|
|
94
|
+
if (u === "") {
|
|
95
|
+
t(r, void 0);
|
|
92
96
|
return;
|
|
93
97
|
}
|
|
94
|
-
const
|
|
95
|
-
isNaN(
|
|
98
|
+
const v = Number(u);
|
|
99
|
+
isNaN(v) || t(r, v);
|
|
96
100
|
};
|
|
97
|
-
return /* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */ f
|
|
99
|
-
|
|
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
|
+
d,
|
|
100
104
|
" ",
|
|
101
|
-
|
|
105
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
102
106
|
] }),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
107
|
+
/* @__PURE__ */ n(
|
|
108
|
+
ve.Root,
|
|
105
109
|
{
|
|
106
110
|
type: "number",
|
|
107
|
-
value:
|
|
108
|
-
onChange: (
|
|
109
|
-
disabled: !
|
|
110
|
-
placeholder: (
|
|
111
|
+
value: e ?? "",
|
|
112
|
+
onChange: (u) => y(u.target.value),
|
|
113
|
+
disabled: !o,
|
|
114
|
+
placeholder: (h = c.options) == null ? void 0 : h.placeholder,
|
|
111
115
|
color: l ? void 0 : "red",
|
|
112
|
-
id:
|
|
116
|
+
id: r
|
|
113
117
|
}
|
|
114
118
|
),
|
|
115
|
-
!l && /* @__PURE__ */
|
|
116
|
-
|
|
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 })
|
|
117
121
|
] }) });
|
|
118
|
-
},
|
|
119
|
-
data:
|
|
120
|
-
handleChange:
|
|
121
|
-
path:
|
|
122
|
-
label:
|
|
123
|
-
required:
|
|
124
|
-
errors:
|
|
125
|
-
schema:
|
|
126
|
-
enabled:
|
|
127
|
-
visible:
|
|
122
|
+
}, Fr = W(2, Me(fr, hr)), $r = oe(kr), _r = ({
|
|
123
|
+
data: e,
|
|
124
|
+
handleChange: t,
|
|
125
|
+
path: r,
|
|
126
|
+
label: d,
|
|
127
|
+
required: g,
|
|
128
|
+
errors: a,
|
|
129
|
+
schema: c,
|
|
130
|
+
enabled: s,
|
|
131
|
+
visible: o = !0
|
|
128
132
|
}) => {
|
|
129
|
-
if (
|
|
133
|
+
if (ue(o, r, t), o === !1)
|
|
130
134
|
return null;
|
|
131
|
-
const
|
|
132
|
-
return /* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
-
|
|
135
|
+
const i = a.length === 0;
|
|
136
|
+
return /* @__PURE__ */ p(C, { mb: "4", children: [
|
|
137
|
+
/* @__PURE__ */ p(T, { gap: "2", align: "center", children: [
|
|
138
|
+
/* @__PURE__ */ n(
|
|
139
|
+
Cr,
|
|
136
140
|
{
|
|
137
|
-
checked: !!
|
|
138
|
-
onCheckedChange: (l) => r
|
|
139
|
-
disabled: !
|
|
140
|
-
id:
|
|
141
|
+
checked: !!e,
|
|
142
|
+
onCheckedChange: (l) => t(r, l === !0),
|
|
143
|
+
disabled: !s,
|
|
144
|
+
id: r
|
|
141
145
|
}
|
|
142
146
|
),
|
|
143
|
-
/* @__PURE__ */ f
|
|
144
|
-
|
|
147
|
+
/* @__PURE__ */ p(f, { as: "label", size: "2", htmlFor: r, children: [
|
|
148
|
+
d,
|
|
145
149
|
" ",
|
|
146
|
-
|
|
150
|
+
g && "*"
|
|
147
151
|
] })
|
|
148
152
|
] }),
|
|
149
|
-
!
|
|
150
|
-
|
|
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 })
|
|
151
155
|
] });
|
|
152
|
-
},
|
|
153
|
-
data:
|
|
154
|
-
handleChange:
|
|
155
|
-
path:
|
|
156
|
-
label:
|
|
157
|
-
required:
|
|
158
|
-
errors:
|
|
159
|
-
schema:
|
|
160
|
-
enabled:
|
|
161
|
-
visible:
|
|
156
|
+
}, Pr = W(2, pr), Vr = oe(_r), Hr = ({
|
|
157
|
+
data: e,
|
|
158
|
+
handleChange: t,
|
|
159
|
+
path: r,
|
|
160
|
+
label: d,
|
|
161
|
+
required: g,
|
|
162
|
+
errors: a,
|
|
163
|
+
schema: c,
|
|
164
|
+
enabled: s,
|
|
165
|
+
visible: o = !0
|
|
162
166
|
}) => {
|
|
163
|
-
if (
|
|
167
|
+
if (ue(o, r, t), o === !1)
|
|
164
168
|
return null;
|
|
165
|
-
const
|
|
169
|
+
const i = a.length === 0;
|
|
166
170
|
let l = [];
|
|
167
|
-
|
|
168
|
-
value:
|
|
169
|
-
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)
|
|
170
174
|
})));
|
|
171
|
-
const
|
|
172
|
-
return /* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */ f
|
|
174
|
-
|
|
175
|
+
const y = e;
|
|
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
|
+
d,
|
|
175
179
|
" ",
|
|
176
|
-
|
|
180
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
177
181
|
] }),
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
-
|
|
182
|
+
/* @__PURE__ */ n(
|
|
183
|
+
Ve.Root,
|
|
180
184
|
{
|
|
181
|
-
value:
|
|
182
|
-
onValueChange: (
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
+
value: y !== void 0 ? String(y) : "",
|
|
186
|
+
onValueChange: (h) => {
|
|
187
|
+
const u = l.find((v) => String(v.value) === h);
|
|
188
|
+
u && t(r, u.value);
|
|
185
189
|
},
|
|
186
|
-
disabled: !
|
|
187
|
-
children: /* @__PURE__ */
|
|
188
|
-
|
|
190
|
+
disabled: !s,
|
|
191
|
+
children: /* @__PURE__ */ n(
|
|
192
|
+
T,
|
|
189
193
|
{
|
|
190
194
|
direction: "row",
|
|
191
195
|
style: {
|
|
@@ -193,202 +197,209 @@ const ee = (t, r, n, a = void 0) => {
|
|
|
193
197
|
columnGap: "clamp(14px, 3vw, 36px)",
|
|
194
198
|
rowGap: "clamp(8px, 1.6vw, 14px)"
|
|
195
199
|
},
|
|
196
|
-
children: l.map((
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
] }, 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)))
|
|
200
204
|
}
|
|
201
205
|
)
|
|
202
206
|
}
|
|
203
207
|
),
|
|
204
|
-
!
|
|
205
|
-
|
|
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 })
|
|
206
210
|
] }) });
|
|
207
|
-
},
|
|
208
|
-
var
|
|
209
|
-
return
|
|
210
|
-
},
|
|
211
|
-
data:
|
|
212
|
-
handleChange:
|
|
213
|
-
path:
|
|
214
|
-
label:
|
|
215
|
-
required:
|
|
216
|
-
errors:
|
|
217
|
-
schema:
|
|
218
|
-
uischema:
|
|
219
|
-
enabled:
|
|
220
|
-
visible:
|
|
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
|
+
data: e,
|
|
216
|
+
handleChange: t,
|
|
217
|
+
path: r,
|
|
218
|
+
label: d,
|
|
219
|
+
required: g,
|
|
220
|
+
errors: a,
|
|
221
|
+
schema: c,
|
|
222
|
+
uischema: s,
|
|
223
|
+
enabled: o,
|
|
224
|
+
visible: i = !0
|
|
221
225
|
}) => {
|
|
222
|
-
var
|
|
223
|
-
if (
|
|
226
|
+
var u;
|
|
227
|
+
if (ue(i, r, t), i === !1)
|
|
224
228
|
return null;
|
|
225
|
-
const l =
|
|
226
|
-
let
|
|
227
|
-
|
|
228
|
-
value: String(
|
|
229
|
-
label:
|
|
229
|
+
const l = a.length === 0;
|
|
230
|
+
let y = [];
|
|
231
|
+
c.enum ? y = c.enum.map((v) => ({ value: String(v), label: String(v) })) : c.oneOf && (y = c.oneOf.map((v) => ({
|
|
232
|
+
value: String(v.const),
|
|
233
|
+
label: v.title || String(v.const)
|
|
230
234
|
})));
|
|
231
|
-
const
|
|
232
|
-
return /* @__PURE__ */
|
|
233
|
-
/* @__PURE__ */ f
|
|
234
|
-
|
|
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
|
+
d,
|
|
235
239
|
" ",
|
|
236
|
-
|
|
240
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
237
241
|
] }),
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
/* @__PURE__ */
|
|
240
|
-
|
|
242
|
+
/* @__PURE__ */ p(Oe.Root, { value: h, onValueChange: (v) => t(r, v), disabled: !o, children: [
|
|
243
|
+
/* @__PURE__ */ n(
|
|
244
|
+
Oe.Trigger,
|
|
241
245
|
{
|
|
242
|
-
placeholder: ((
|
|
246
|
+
placeholder: ((u = s.options) == null ? void 0 : u.placeholder) || "Select an option",
|
|
243
247
|
color: l ? void 0 : "red",
|
|
244
|
-
id:
|
|
248
|
+
id: r
|
|
245
249
|
}
|
|
246
250
|
),
|
|
247
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ n(Oe.Content, { children: y.map((v) => /* @__PURE__ */ n(Oe.Item, { value: v.value, children: v.label }, v.value)) })
|
|
248
252
|
] }),
|
|
249
|
-
!l && /* @__PURE__ */
|
|
250
|
-
|
|
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 })
|
|
251
255
|
] }) });
|
|
252
|
-
},
|
|
256
|
+
}, Gr = W(2, Me(Je, Ze)), Xr = oe(Kr), Yr = {
|
|
253
257
|
"small-list": { fetchOnOpen: !0, searchable: !1, paginated: !1 },
|
|
254
258
|
"large-searchable-list": { fetchOnOpen: !0, searchable: !0, paginated: !1 },
|
|
255
259
|
"large-paginated-list": { fetchOnOpen: !1, searchable: !0, paginated: !0 }
|
|
256
|
-
},
|
|
257
|
-
data:
|
|
258
|
-
handleChange:
|
|
259
|
-
path:
|
|
260
|
-
label:
|
|
261
|
-
required:
|
|
262
|
-
errors:
|
|
263
|
-
enabled:
|
|
264
|
-
visible:
|
|
265
|
-
schema:
|
|
266
|
-
uischema:
|
|
260
|
+
}, Jr = ({
|
|
261
|
+
data: e,
|
|
262
|
+
handleChange: t,
|
|
263
|
+
path: r,
|
|
264
|
+
label: d,
|
|
265
|
+
required: g,
|
|
266
|
+
errors: a,
|
|
267
|
+
enabled: c,
|
|
268
|
+
visible: s = !0,
|
|
269
|
+
schema: o,
|
|
270
|
+
uischema: i
|
|
267
271
|
}) => {
|
|
268
|
-
var
|
|
269
|
-
const l = (
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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 });
|
|
273
283
|
return;
|
|
274
284
|
}
|
|
275
|
-
if (
|
|
285
|
+
if (D({ id: z, name: S ?? z }), !(A != null && A.resolve)) return;
|
|
276
286
|
let m = !1;
|
|
277
|
-
return
|
|
278
|
-
!m &&
|
|
287
|
+
return A.resolve(z, M).then((Re) => {
|
|
288
|
+
!m && Re && D(Re);
|
|
279
289
|
}).catch(() => {
|
|
280
290
|
}), () => {
|
|
281
291
|
m = !0;
|
|
282
292
|
};
|
|
283
|
-
}, [
|
|
284
|
-
const
|
|
285
|
-
async (m,
|
|
286
|
-
var
|
|
287
|
-
if (!
|
|
288
|
-
|
|
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.");
|
|
289
299
|
return;
|
|
290
300
|
}
|
|
291
|
-
(
|
|
292
|
-
const
|
|
293
|
-
|
|
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));
|
|
294
304
|
try {
|
|
295
|
-
const
|
|
305
|
+
const Ne = await A.search({
|
|
296
306
|
query: m,
|
|
297
|
-
cursor:
|
|
298
|
-
signal:
|
|
299
|
-
|
|
300
|
-
|
|
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);
|
|
301
312
|
} catch {
|
|
302
|
-
if (
|
|
303
|
-
|
|
313
|
+
if (he.signal.aborted) return;
|
|
314
|
+
b("Failed to load results. Please try again.");
|
|
304
315
|
} finally {
|
|
305
|
-
|
|
316
|
+
he.signal.aborted || (Z ? ce(!1) : ie(!1));
|
|
306
317
|
}
|
|
307
318
|
},
|
|
308
|
-
[
|
|
319
|
+
[A, u == null ? void 0 : u.paginated, M]
|
|
309
320
|
);
|
|
310
|
-
if (
|
|
311
|
-
if (!
|
|
312
|
-
const m = (
|
|
313
|
-
|
|
321
|
+
if (ge(() => {
|
|
322
|
+
if (!x) return;
|
|
323
|
+
const m = (Z) => {
|
|
324
|
+
Y.current && !Y.current.contains(Z.target) && J(!1);
|
|
314
325
|
};
|
|
315
326
|
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
316
|
-
}, [
|
|
327
|
+
}, [x]), ge(() => {
|
|
317
328
|
var m;
|
|
318
|
-
|
|
319
|
-
}, [
|
|
320
|
-
if (!
|
|
321
|
-
if (!
|
|
322
|
-
|
|
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;
|
|
332
|
+
if (!F && !v) {
|
|
333
|
+
K([]), Q(!1), b(null), R.current = void 0;
|
|
323
334
|
return;
|
|
324
335
|
}
|
|
325
|
-
|
|
326
|
-
const m =
|
|
327
|
-
return
|
|
328
|
-
|
|
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);
|
|
329
340
|
}, m), () => {
|
|
330
|
-
|
|
341
|
+
U.current && clearTimeout(U.current);
|
|
331
342
|
};
|
|
332
|
-
}, [
|
|
343
|
+
}, [F, x, v, be]), ue(s, r, t, w ? void 0 : null), s === !1)
|
|
333
344
|
return null;
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
},
|
|
337
|
-
r
|
|
338
|
-
},
|
|
339
|
-
m.stopPropagation(), r
|
|
340
|
-
},
|
|
341
|
-
(m.key === "Enter" || m.key === " ") &&
|
|
342
|
-
},
|
|
343
|
-
return /* @__PURE__ */
|
|
344
|
-
/* @__PURE__ */ f
|
|
345
|
-
|
|
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: [
|
|
356
|
+
d,
|
|
346
357
|
" ",
|
|
347
|
-
|
|
358
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
348
359
|
] }),
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
|
|
360
|
+
/* @__PURE__ */ p("div", { ref: Y, style: { position: "relative" }, children: [
|
|
361
|
+
/* @__PURE__ */ n(
|
|
362
|
+
ve.Root,
|
|
352
363
|
{
|
|
353
|
-
id:
|
|
354
|
-
value:
|
|
355
|
-
placeholder:
|
|
356
|
-
disabled: !
|
|
357
|
-
readOnly:
|
|
358
|
-
style:
|
|
364
|
+
id: r,
|
|
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" },
|
|
359
370
|
onChange: (m) => {
|
|
360
|
-
|
|
371
|
+
u != null && u.searchable && (V(m.target.value), x || Ee());
|
|
361
372
|
},
|
|
362
373
|
onFocus: () => {
|
|
363
|
-
|
|
374
|
+
P && !x && Ee();
|
|
364
375
|
},
|
|
365
376
|
onKeyDown: (m) => {
|
|
366
|
-
m.key === "Escape" &&
|
|
377
|
+
m.key === "Escape" && J(!1);
|
|
367
378
|
},
|
|
368
|
-
children: /* @__PURE__ */
|
|
369
|
-
|
|
379
|
+
children: /* @__PURE__ */ n(ve.Slot, { side: "right", children: /* @__PURE__ */ p(T, { align: "center", gap: "1", children: [
|
|
380
|
+
z && P && /* @__PURE__ */ n(
|
|
370
381
|
"span",
|
|
371
382
|
{
|
|
372
383
|
role: "button",
|
|
373
384
|
tabIndex: 0,
|
|
374
385
|
onMouseDown: (m) => m.preventDefault(),
|
|
375
|
-
onClick:
|
|
376
|
-
onKeyDown:
|
|
386
|
+
onClick: L,
|
|
387
|
+
onKeyDown: we,
|
|
377
388
|
style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
|
|
378
389
|
"aria-label": "Clear selection",
|
|
379
390
|
children: "×"
|
|
380
391
|
}
|
|
381
392
|
),
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
|
|
393
|
+
/* @__PURE__ */ n(
|
|
394
|
+
Ar,
|
|
384
395
|
{
|
|
385
|
-
style: { transform:
|
|
396
|
+
style: { transform: x ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
|
|
386
397
|
}
|
|
387
398
|
)
|
|
388
399
|
] }) })
|
|
389
400
|
}
|
|
390
401
|
),
|
|
391
|
-
|
|
402
|
+
x && /* @__PURE__ */ n(
|
|
392
403
|
C,
|
|
393
404
|
{
|
|
394
405
|
style: {
|
|
@@ -403,340 +414,340 @@ const ee = (t, r, n, a = void 0) => {
|
|
|
403
414
|
border: "1px solid var(--gray-a6)",
|
|
404
415
|
overflow: "hidden"
|
|
405
416
|
},
|
|
406
|
-
children:
|
|
407
|
-
|
|
408
|
-
!
|
|
409
|
-
!
|
|
410
|
-
|
|
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(
|
|
411
422
|
C,
|
|
412
423
|
{
|
|
413
424
|
px: "3",
|
|
414
425
|
py: "2",
|
|
415
|
-
onMouseDown: (
|
|
416
|
-
onClick: () =>
|
|
426
|
+
onMouseDown: (Z) => Z.preventDefault(),
|
|
427
|
+
onClick: () => E(m),
|
|
417
428
|
style: {
|
|
418
429
|
cursor: "pointer",
|
|
419
430
|
borderRadius: "var(--radius-2)",
|
|
420
|
-
backgroundColor: m.id ===
|
|
431
|
+
backgroundColor: m.id === z ? "var(--accent-3)" : void 0
|
|
421
432
|
},
|
|
422
433
|
className: "hover:bg-(--gray-3)",
|
|
423
|
-
children: /* @__PURE__ */
|
|
434
|
+
children: /* @__PURE__ */ n(f, { size: "2", children: m.name })
|
|
424
435
|
},
|
|
425
436
|
m.id
|
|
426
437
|
)),
|
|
427
|
-
(
|
|
428
|
-
|
|
438
|
+
(u == null ? void 0 : u.paginated) && $ && !se && /* @__PURE__ */ n(C, { px: "3", py: "2", children: /* @__PURE__ */ n(
|
|
439
|
+
Le,
|
|
429
440
|
{
|
|
430
441
|
variant: "ghost",
|
|
431
442
|
size: "1",
|
|
432
443
|
style: { width: "100%" },
|
|
433
444
|
onMouseDown: (m) => m.preventDefault(),
|
|
434
|
-
onClick: () => void
|
|
445
|
+
onClick: () => void be(F, !0),
|
|
435
446
|
children: "Load more"
|
|
436
447
|
}
|
|
437
448
|
) }),
|
|
438
|
-
|
|
449
|
+
se && /* @__PURE__ */ n(T, { justify: "center", p: "2", children: /* @__PURE__ */ n(ze, {}) })
|
|
439
450
|
] }) })
|
|
440
451
|
}
|
|
441
452
|
)
|
|
442
453
|
] }),
|
|
443
|
-
!
|
|
444
|
-
|
|
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 })
|
|
445
456
|
] }) });
|
|
446
|
-
},
|
|
457
|
+
}, Zr = oe(Jr), qr = W(
|
|
447
458
|
3,
|
|
448
|
-
|
|
449
|
-
const
|
|
450
|
-
return
|
|
459
|
+
Fe((e) => {
|
|
460
|
+
const t = e["x-search"];
|
|
461
|
+
return (e.type === "string" || e.type === "object") && typeof (t == null ? void 0 : t.service) == "string" && t.service !== "";
|
|
451
462
|
})
|
|
452
|
-
),
|
|
453
|
-
const
|
|
454
|
-
return /* @__PURE__ */
|
|
455
|
-
/* @__PURE__ */ f
|
|
456
|
-
|
|
463
|
+
), jr = (e, t) => Or(`${e}T${t}`).format(), Qr = ({ path: e, label: t, required: r, errors: d, description: g, children: a }) => {
|
|
464
|
+
const c = d.length === 0;
|
|
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: [
|
|
467
|
+
t,
|
|
457
468
|
" ",
|
|
458
|
-
|
|
469
|
+
r && /* @__PURE__ */ n(f, { color: "red", children: "*" })
|
|
459
470
|
] }),
|
|
460
|
-
|
|
461
|
-
!
|
|
462
|
-
|
|
471
|
+
a,
|
|
472
|
+
!c && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(d, t) }),
|
|
473
|
+
g && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: g })
|
|
463
474
|
] }) });
|
|
464
|
-
},
|
|
465
|
-
data:
|
|
466
|
-
handleChange:
|
|
467
|
-
path:
|
|
468
|
-
label:
|
|
469
|
-
required:
|
|
470
|
-
errors:
|
|
471
|
-
schema:
|
|
472
|
-
enabled:
|
|
473
|
-
visible:
|
|
475
|
+
}, et = ({
|
|
476
|
+
data: e,
|
|
477
|
+
handleChange: t,
|
|
478
|
+
path: r,
|
|
479
|
+
label: d,
|
|
480
|
+
required: g,
|
|
481
|
+
errors: a,
|
|
482
|
+
schema: c,
|
|
483
|
+
enabled: s,
|
|
484
|
+
visible: o = !0
|
|
474
485
|
}) => {
|
|
475
|
-
if (
|
|
476
|
-
|
|
477
|
-
}, [
|
|
486
|
+
if (ge(() => {
|
|
487
|
+
o === !1 && t(r, void 0);
|
|
488
|
+
}, [o, r, t]), o === !1)
|
|
478
489
|
return null;
|
|
479
|
-
const
|
|
480
|
-
if (
|
|
481
|
-
return
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
|
|
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 });
|
|
491
|
+
if (c.format === "time")
|
|
492
|
+
return y(
|
|
493
|
+
/* @__PURE__ */ n(
|
|
494
|
+
ve.Root,
|
|
484
495
|
{
|
|
485
496
|
type: "time",
|
|
486
497
|
value: l,
|
|
487
|
-
onChange: (w) => r
|
|
488
|
-
disabled: !
|
|
489
|
-
color:
|
|
490
|
-
id:
|
|
498
|
+
onChange: (w) => t(r, w.target.value),
|
|
499
|
+
disabled: !s,
|
|
500
|
+
color: i ? void 0 : "red",
|
|
501
|
+
id: r
|
|
491
502
|
}
|
|
492
503
|
)
|
|
493
504
|
);
|
|
494
|
-
const
|
|
505
|
+
const h = c.format === "date-time", [u = "", v = ""] = l.split("T"), M = v.slice(0, 5), A = (w, O) => {
|
|
495
506
|
if (!w) {
|
|
496
|
-
r
|
|
507
|
+
t(r, void 0);
|
|
497
508
|
return;
|
|
498
509
|
}
|
|
499
|
-
r
|
|
510
|
+
t(r, h ? jr(w, O || "00:00") : w);
|
|
500
511
|
};
|
|
501
|
-
return
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
/* @__PURE__ */
|
|
504
|
-
|
|
512
|
+
return y(
|
|
513
|
+
/* @__PURE__ */ p(T, { gap: "2", align: "center", children: [
|
|
514
|
+
/* @__PURE__ */ n(
|
|
515
|
+
ve.Root,
|
|
505
516
|
{
|
|
506
517
|
type: "date",
|
|
507
|
-
value:
|
|
508
|
-
disabled: !
|
|
509
|
-
color:
|
|
510
|
-
onChange: (w) =>
|
|
511
|
-
id:
|
|
518
|
+
value: u,
|
|
519
|
+
disabled: !s,
|
|
520
|
+
color: i ? void 0 : "red",
|
|
521
|
+
onChange: (w) => A(w.target.value, M),
|
|
522
|
+
id: r,
|
|
512
523
|
style: { flex: 1 }
|
|
513
524
|
}
|
|
514
525
|
),
|
|
515
|
-
|
|
516
|
-
|
|
526
|
+
h && /* @__PURE__ */ n(
|
|
527
|
+
ve.Root,
|
|
517
528
|
{
|
|
518
529
|
type: "time",
|
|
519
|
-
value:
|
|
520
|
-
disabled: !
|
|
521
|
-
color:
|
|
522
|
-
onChange: (w) =>
|
|
530
|
+
value: M,
|
|
531
|
+
disabled: !s || !u,
|
|
532
|
+
color: i ? void 0 : "red",
|
|
533
|
+
onChange: (w) => A(u, w.target.value),
|
|
523
534
|
style: { flex: 1 }
|
|
524
535
|
}
|
|
525
536
|
)
|
|
526
537
|
] })
|
|
527
538
|
);
|
|
528
|
-
},
|
|
529
|
-
uischema:
|
|
530
|
-
schema:
|
|
531
|
-
path:
|
|
532
|
-
renderers:
|
|
533
|
-
cells:
|
|
534
|
-
enabled:
|
|
535
|
-
visible:
|
|
539
|
+
}, rt = W(2, Me(gr, mr, yr)), tt = oe(et), nt = ({
|
|
540
|
+
uischema: e,
|
|
541
|
+
schema: t,
|
|
542
|
+
path: r,
|
|
543
|
+
renderers: d,
|
|
544
|
+
cells: g,
|
|
545
|
+
enabled: a,
|
|
546
|
+
visible: c = !0
|
|
536
547
|
}) => {
|
|
537
|
-
const
|
|
538
|
-
return
|
|
539
|
-
|
|
548
|
+
const o = e.elements;
|
|
549
|
+
return c === !1 ? null : /* @__PURE__ */ n(T, { direction: "column", gap: "4", children: o.map((i, l) => /* @__PURE__ */ n(
|
|
550
|
+
Se,
|
|
540
551
|
{
|
|
541
|
-
uischema:
|
|
542
|
-
schema:
|
|
543
|
-
path:
|
|
544
|
-
renderers:
|
|
545
|
-
cells:
|
|
546
|
-
enabled:
|
|
552
|
+
uischema: i,
|
|
553
|
+
schema: t,
|
|
554
|
+
path: r,
|
|
555
|
+
renderers: d,
|
|
556
|
+
cells: g,
|
|
557
|
+
enabled: a
|
|
547
558
|
},
|
|
548
|
-
`${
|
|
559
|
+
`${r}-${l}`
|
|
549
560
|
)) });
|
|
550
|
-
},
|
|
551
|
-
uischema:
|
|
552
|
-
schema:
|
|
553
|
-
path:
|
|
554
|
-
renderers:
|
|
555
|
-
cells:
|
|
556
|
-
enabled:
|
|
557
|
-
visible:
|
|
561
|
+
}, ot = W(1, Ae("VerticalLayout")), lt = ({
|
|
562
|
+
uischema: e,
|
|
563
|
+
schema: t,
|
|
564
|
+
path: r,
|
|
565
|
+
renderers: d,
|
|
566
|
+
cells: g,
|
|
567
|
+
enabled: a,
|
|
568
|
+
visible: c = !0
|
|
558
569
|
}) => {
|
|
559
|
-
const
|
|
560
|
-
return
|
|
561
|
-
|
|
570
|
+
const o = e.elements;
|
|
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,
|
|
562
573
|
{
|
|
563
|
-
uischema:
|
|
564
|
-
schema:
|
|
565
|
-
path:
|
|
566
|
-
renderers:
|
|
567
|
-
cells:
|
|
568
|
-
enabled:
|
|
574
|
+
uischema: i,
|
|
575
|
+
schema: t,
|
|
576
|
+
path: r,
|
|
577
|
+
renderers: d,
|
|
578
|
+
cells: g,
|
|
579
|
+
enabled: a
|
|
569
580
|
}
|
|
570
|
-
) }, `${
|
|
571
|
-
},
|
|
572
|
-
uischema:
|
|
573
|
-
schema:
|
|
574
|
-
path:
|
|
575
|
-
renderers:
|
|
576
|
-
cells:
|
|
577
|
-
enabled:
|
|
578
|
-
visible:
|
|
581
|
+
) }, `${r}-${l}`)) });
|
|
582
|
+
}, it = W(1, Ae("HorizontalLayout")), st = ({
|
|
583
|
+
uischema: e,
|
|
584
|
+
schema: t,
|
|
585
|
+
path: r,
|
|
586
|
+
renderers: d,
|
|
587
|
+
cells: g,
|
|
588
|
+
enabled: a,
|
|
589
|
+
visible: c = !0
|
|
579
590
|
}) => {
|
|
580
|
-
const
|
|
581
|
-
return
|
|
582
|
-
|
|
583
|
-
/* @__PURE__ */
|
|
584
|
-
|
|
591
|
+
const s = e, o = s.elements;
|
|
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 }),
|
|
594
|
+
/* @__PURE__ */ n(T, { direction: "column", gap: "4", children: o.map((i, l) => /* @__PURE__ */ n(
|
|
595
|
+
Se,
|
|
585
596
|
{
|
|
586
|
-
uischema:
|
|
587
|
-
schema:
|
|
588
|
-
path:
|
|
589
|
-
renderers:
|
|
590
|
-
cells:
|
|
591
|
-
enabled:
|
|
597
|
+
uischema: i,
|
|
598
|
+
schema: t,
|
|
599
|
+
path: r,
|
|
600
|
+
renderers: d,
|
|
601
|
+
cells: g,
|
|
602
|
+
enabled: a
|
|
592
603
|
},
|
|
593
|
-
`${
|
|
604
|
+
`${r}-${l}`
|
|
594
605
|
)) })
|
|
595
606
|
] });
|
|
596
|
-
},
|
|
597
|
-
uischema:
|
|
598
|
-
schema:
|
|
599
|
-
path:
|
|
600
|
-
renderers:
|
|
601
|
-
cells:
|
|
602
|
-
enabled:
|
|
603
|
-
visible:
|
|
607
|
+
}, ct = W(1, Ae("Group")), at = ({
|
|
608
|
+
uischema: e,
|
|
609
|
+
schema: t,
|
|
610
|
+
path: r,
|
|
611
|
+
renderers: d,
|
|
612
|
+
cells: g,
|
|
613
|
+
enabled: a,
|
|
614
|
+
visible: c = !0
|
|
604
615
|
}) => {
|
|
605
|
-
var
|
|
606
|
-
const
|
|
607
|
-
if (
|
|
608
|
-
const
|
|
609
|
-
return /* @__PURE__ */
|
|
610
|
-
/* @__PURE__ */
|
|
611
|
-
/* @__PURE__ */
|
|
612
|
-
|
|
616
|
+
var h;
|
|
617
|
+
const o = e.elements.filter((u) => u.type === "Category"), [i, l] = _(((h = o[0]) == null ? void 0 : h.label) || "");
|
|
618
|
+
if (c === !1 || !o.length) return null;
|
|
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,
|
|
613
624
|
{
|
|
614
|
-
uischema:
|
|
615
|
-
schema:
|
|
616
|
-
path:
|
|
617
|
-
renderers:
|
|
618
|
-
cells:
|
|
619
|
-
enabled:
|
|
625
|
+
uischema: M,
|
|
626
|
+
schema: t,
|
|
627
|
+
path: r,
|
|
628
|
+
renderers: d,
|
|
629
|
+
cells: g,
|
|
630
|
+
enabled: a
|
|
620
631
|
},
|
|
621
|
-
`${
|
|
622
|
-
)) }) }, `${
|
|
632
|
+
`${r}-${v}-${A}`
|
|
633
|
+
)) }) }, `${r}-${v}`)) })
|
|
623
634
|
] });
|
|
624
|
-
},
|
|
625
|
-
function
|
|
626
|
-
return
|
|
635
|
+
}, dt = W(1, Ae("Categorization"));
|
|
636
|
+
function me(e) {
|
|
637
|
+
return e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(0)} MB` : e >= 1024 ? `${(e / 1024).toFixed(0)} KB` : `${e} B`;
|
|
627
638
|
}
|
|
628
|
-
function
|
|
629
|
-
return
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return r.slice(1).toUpperCase();
|
|
637
|
-
const n = r.split("/")[1];
|
|
638
|
-
return n ? n.toUpperCase() : r;
|
|
639
|
+
function ye(e) {
|
|
640
|
+
return e.split(",").map((t) => {
|
|
641
|
+
if (t = t.trim(), t.endsWith("/*"))
|
|
642
|
+
return t.split("/")[0].toUpperCase() + "S";
|
|
643
|
+
if (t.startsWith("."))
|
|
644
|
+
return t.slice(1).toUpperCase();
|
|
645
|
+
const r = t.split("/")[1];
|
|
646
|
+
return r ? r.toUpperCase() : t;
|
|
639
647
|
}).join(", ");
|
|
640
648
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
649
|
+
function ut(e) {
|
|
650
|
+
return e ? Array.isArray(e) ? e : [e] : [];
|
|
651
|
+
}
|
|
652
|
+
const ft = ({
|
|
653
|
+
data: e,
|
|
654
|
+
handleChange: t,
|
|
655
|
+
path: r,
|
|
656
|
+
label: d,
|
|
657
|
+
required: g,
|
|
658
|
+
uischema: a,
|
|
659
|
+
schema: c,
|
|
660
|
+
enabled: s,
|
|
661
|
+
errors: o,
|
|
662
|
+
visible: i = !0
|
|
652
663
|
}) => {
|
|
653
|
-
const l =
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
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();
|
|
658
669
|
}, []);
|
|
659
|
-
const
|
|
660
|
-
async (
|
|
661
|
-
if (
|
|
662
|
-
|
|
670
|
+
const K = ke(
|
|
671
|
+
async (b) => {
|
|
672
|
+
if (P(null), V.length >= v) {
|
|
673
|
+
P(`Maximum ${v} file${v > 1 ? "s" : ""} allowed.`);
|
|
663
674
|
return;
|
|
664
675
|
}
|
|
665
|
-
if (
|
|
666
|
-
|
|
676
|
+
if (b.size > M) {
|
|
677
|
+
P(`File exceeds the ${me(M)} limit.`);
|
|
667
678
|
return;
|
|
668
679
|
}
|
|
669
|
-
if (
|
|
670
|
-
|
|
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)}`);
|
|
671
682
|
return;
|
|
672
683
|
}
|
|
673
684
|
if (!(l != null && l.onUpload)) {
|
|
674
|
-
|
|
685
|
+
P("Upload service not configured.");
|
|
675
686
|
return;
|
|
676
687
|
}
|
|
677
688
|
try {
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
const
|
|
683
|
-
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]);
|
|
684
695
|
} catch {
|
|
685
|
-
|
|
696
|
+
P("Upload failed. Please try again."), F.current && (F.current.value = "");
|
|
686
697
|
}
|
|
687
698
|
},
|
|
688
|
-
[
|
|
699
|
+
[V, v, M, A, l, r, t, w]
|
|
689
700
|
);
|
|
690
|
-
if (
|
|
701
|
+
if (i === !1)
|
|
691
702
|
return null;
|
|
692
|
-
const
|
|
693
|
-
|
|
694
|
-
},
|
|
695
|
-
var
|
|
696
|
-
|
|
697
|
-
},
|
|
698
|
-
var
|
|
699
|
-
(
|
|
700
|
-
},
|
|
701
|
-
if (!
|
|
702
|
-
|
|
703
|
-
var
|
|
704
|
-
const
|
|
705
|
-
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;
|
|
706
717
|
});
|
|
707
|
-
const
|
|
708
|
-
r
|
|
709
|
-
},
|
|
710
|
-
var
|
|
711
|
-
|
|
712
|
-
const
|
|
713
|
-
if (
|
|
714
|
-
(
|
|
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;
|
|
722
|
+
b.preventDefault();
|
|
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();
|
|
715
726
|
return;
|
|
716
727
|
}
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
728
|
+
const R = window.open("", "_blank");
|
|
729
|
+
if (R)
|
|
719
730
|
try {
|
|
720
|
-
const
|
|
721
|
-
|
|
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();
|
|
722
733
|
} catch {
|
|
723
|
-
|
|
734
|
+
R.close();
|
|
724
735
|
}
|
|
725
736
|
};
|
|
726
|
-
if (!
|
|
727
|
-
const
|
|
728
|
-
return /* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
730
|
-
/* @__PURE__ */ f
|
|
731
|
-
|
|
732
|
-
|
|
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: [
|
|
742
|
+
d,
|
|
743
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: " *" })
|
|
733
744
|
] }),
|
|
734
|
-
/* @__PURE__ */
|
|
745
|
+
/* @__PURE__ */ n(f, { size: "1", color: "gray", children: w ? `Up to ${v} files · ${me(M)} each · ${ye(A)}` : `${me(M)} · ${ye(A)}` })
|
|
735
746
|
] }),
|
|
736
|
-
|
|
737
|
-
var
|
|
738
|
-
return /* @__PURE__ */ e
|
|
739
|
-
/* @__PURE__ */
|
|
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: [
|
|
750
|
+
/* @__PURE__ */ n(
|
|
740
751
|
C,
|
|
741
752
|
{
|
|
742
753
|
style: {
|
|
@@ -746,11 +757,11 @@ const Br = ({
|
|
|
746
757
|
color: "var(--blue-9)",
|
|
747
758
|
flexShrink: 0
|
|
748
759
|
},
|
|
749
|
-
children: /* @__PURE__ */
|
|
760
|
+
children: /* @__PURE__ */ n(Qe, { width: "20", height: "20" })
|
|
750
761
|
}
|
|
751
762
|
),
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
|
|
763
|
+
/* @__PURE__ */ n(C, { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ n(
|
|
764
|
+
f,
|
|
754
765
|
{
|
|
755
766
|
size: "2",
|
|
756
767
|
weight: "bold",
|
|
@@ -760,208 +771,807 @@ const Br = ({
|
|
|
760
771
|
textOverflow: "ellipsis",
|
|
761
772
|
whiteSpace: "nowrap"
|
|
762
773
|
},
|
|
763
|
-
children: ((
|
|
774
|
+
children: ((I = ee[b]) == null ? void 0 : I.name) ?? "Uploaded File"
|
|
764
775
|
}
|
|
765
776
|
) }),
|
|
766
|
-
/* @__PURE__ */
|
|
767
|
-
/* @__PURE__ */
|
|
768
|
-
/* @__PURE__ */
|
|
769
|
-
|
|
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, {}) })
|
|
770
781
|
] })
|
|
771
|
-
] }) },
|
|
782
|
+
] }) }, b);
|
|
772
783
|
}),
|
|
773
|
-
|
|
784
|
+
fe && /* @__PURE__ */ p(
|
|
774
785
|
"div",
|
|
775
786
|
{
|
|
776
787
|
role: "button",
|
|
777
788
|
tabIndex: 0,
|
|
778
789
|
onClick: () => {
|
|
779
|
-
var
|
|
780
|
-
return (
|
|
790
|
+
var b;
|
|
791
|
+
return (b = F.current) == null ? void 0 : b.click();
|
|
781
792
|
},
|
|
782
|
-
onKeyDown: (
|
|
783
|
-
var
|
|
784
|
-
(
|
|
793
|
+
onKeyDown: (b) => {
|
|
794
|
+
var I;
|
|
795
|
+
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), (I = F.current) == null || I.click());
|
|
785
796
|
},
|
|
786
|
-
onDragEnter:
|
|
787
|
-
onDragLeave:
|
|
788
|
-
onDragOver:
|
|
789
|
-
onDrop:
|
|
797
|
+
onDragEnter: $,
|
|
798
|
+
onDragLeave: $,
|
|
799
|
+
onDragOver: $,
|
|
800
|
+
onDrop: Q,
|
|
790
801
|
style: { cursor: "pointer" },
|
|
791
802
|
className: [
|
|
792
803
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
793
804
|
"transition-all duration-200 ease-in-out",
|
|
794
|
-
|
|
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"
|
|
795
806
|
].join(" "),
|
|
796
807
|
children: [
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
/* @__PURE__ */
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
] }) : /* @__PURE__ */
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
/* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */ f
|
|
806
|
-
|
|
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),
|
|
807
818
|
" max · ",
|
|
808
|
-
|
|
819
|
+
ye(A)
|
|
809
820
|
] })
|
|
810
821
|
] }) })
|
|
811
822
|
]
|
|
812
823
|
}
|
|
813
824
|
),
|
|
814
|
-
|
|
825
|
+
O && j && w && /* @__PURE__ */ p(f, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
|
|
815
826
|
"Maximum ",
|
|
816
|
-
|
|
827
|
+
v,
|
|
817
828
|
" files uploaded. Remove one to replace it."
|
|
818
829
|
] }),
|
|
819
|
-
!
|
|
830
|
+
!y && /* @__PURE__ */ n(f, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: le(o, d) })
|
|
820
831
|
] });
|
|
821
|
-
},
|
|
832
|
+
}, ht = oe(ft), pt = W(
|
|
822
833
|
10,
|
|
823
834
|
// high rank to beat default array renderer
|
|
824
|
-
|
|
835
|
+
vr(
|
|
825
836
|
// Match both single-file (type: string) and multi-file (type: array)
|
|
826
|
-
|
|
827
|
-
if (
|
|
828
|
-
if (
|
|
829
|
-
const
|
|
830
|
-
return (
|
|
837
|
+
Fe((e) => {
|
|
838
|
+
if (e.type === "string" && e.format === "file") return !0;
|
|
839
|
+
if (e.type === "array") {
|
|
840
|
+
const t = e.items;
|
|
841
|
+
return (t == null ? void 0 : t.type) === "string" && (t == null ? void 0 : t.format) === "file";
|
|
831
842
|
}
|
|
832
843
|
return !1;
|
|
833
844
|
})
|
|
834
845
|
)
|
|
835
|
-
)
|
|
836
|
-
|
|
846
|
+
);
|
|
847
|
+
class Ue extends Error {
|
|
848
|
+
}
|
|
849
|
+
function gt(e, t) {
|
|
850
|
+
const r = Ir(e, { type: "array", cellDates: !0 });
|
|
851
|
+
if (r.SheetNames.length === 0)
|
|
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 });
|
|
857
|
+
return {
|
|
858
|
+
sheetName: d,
|
|
859
|
+
matrix: a,
|
|
860
|
+
rowCount: a.length,
|
|
861
|
+
colCount: Math.max(0, ...a.map((c) => c.length))
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
function mt(e) {
|
|
865
|
+
let t = e + 1, r = "";
|
|
866
|
+
for (; t > 0; ) {
|
|
867
|
+
const d = (t - 1) % 26;
|
|
868
|
+
r = String.fromCharCode(65 + d) + r, t = Math.floor((t - 1) / 26);
|
|
869
|
+
}
|
|
870
|
+
return r;
|
|
871
|
+
}
|
|
872
|
+
class X extends Error {
|
|
873
|
+
constructor(r, d) {
|
|
874
|
+
super(d ?? r);
|
|
875
|
+
Pe(this, "code");
|
|
876
|
+
this.code = r, this.name = "FormulaError";
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
const yt = [
|
|
880
|
+
// Logical
|
|
881
|
+
// IF is excluded here even though its native body is real, non-stub code —
|
|
882
|
+
// see LOGICAL_FUNCTIONS_WITH_BROKEN_CONDITION_COERCION below for why it's
|
|
883
|
+
// backfilled instead.
|
|
884
|
+
"IFS",
|
|
885
|
+
"IFERROR",
|
|
886
|
+
"AND",
|
|
887
|
+
"OR",
|
|
888
|
+
"NOT",
|
|
889
|
+
// Math
|
|
890
|
+
"ROUND",
|
|
891
|
+
"ROUNDUP",
|
|
892
|
+
"ROUNDDOWN",
|
|
893
|
+
// Lookup and reference
|
|
894
|
+
"INDEX",
|
|
895
|
+
"VLOOKUP",
|
|
896
|
+
"HLOOKUP",
|
|
897
|
+
// Statistical
|
|
898
|
+
"SUM",
|
|
899
|
+
"AVERAGE",
|
|
900
|
+
"COUNT",
|
|
901
|
+
// Date — DATE/TODAY only; YEAR/MONTH/DAY/WEEKDAY are backfilled below, see
|
|
902
|
+
// DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL.
|
|
903
|
+
"DATE",
|
|
904
|
+
"TODAY"
|
|
905
|
+
], vt = [
|
|
906
|
+
"MAX",
|
|
907
|
+
"MIN",
|
|
908
|
+
"MAXA",
|
|
909
|
+
"MINA",
|
|
910
|
+
"MEDIAN",
|
|
911
|
+
"LARGE",
|
|
912
|
+
"SMALL",
|
|
913
|
+
"PERMUT",
|
|
914
|
+
"PERMUTATIONA",
|
|
915
|
+
"MATCH",
|
|
916
|
+
// forced to exact-match only — see the MATCH wrapper below.
|
|
917
|
+
"SWITCH",
|
|
918
|
+
// a stub too, despite being implemented elsewhere in Excel's own function set.
|
|
919
|
+
"SUBSTITUTE",
|
|
920
|
+
"TEXTJOIN",
|
|
921
|
+
"COUNTA",
|
|
922
|
+
// not present in fast-formula-parser's function table at all.
|
|
923
|
+
"UPPER"
|
|
924
|
+
], bt = ["YEAR", "MONTH", "DAY", "WEEKDAY"], Et = ["IF"], wt = [
|
|
925
|
+
"CONCATENATE",
|
|
926
|
+
"CONCAT",
|
|
927
|
+
"LEN",
|
|
928
|
+
"TRIM",
|
|
929
|
+
"LOWER",
|
|
930
|
+
"LEFT",
|
|
931
|
+
"RIGHT",
|
|
932
|
+
"MID",
|
|
933
|
+
"FIND",
|
|
934
|
+
"SEARCH"
|
|
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;
|
|
945
|
+
let r;
|
|
946
|
+
for (; (r = He.exec(t)) !== null; ) {
|
|
947
|
+
const d = r[1].toUpperCase();
|
|
948
|
+
if (!Rt.has(d))
|
|
949
|
+
throw new X("NAME", `Function ${d} is not allowed.`);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
function At(e, t, r) {
|
|
953
|
+
let d = e;
|
|
954
|
+
if (d == null) throw r.NA;
|
|
955
|
+
if (typeof d == "object" && !(d instanceof r) && (d = t.retrieveRef(d)), d instanceof r) throw d;
|
|
956
|
+
if (typeof d == "boolean") return d;
|
|
957
|
+
if (typeof d == "number") return d !== 0;
|
|
958
|
+
throw r.VALUE;
|
|
959
|
+
}
|
|
960
|
+
function ir(e) {
|
|
961
|
+
return e !== null && typeof e == "object" && "value" in e ? e.value : e;
|
|
962
|
+
}
|
|
963
|
+
function pe(e) {
|
|
964
|
+
const t = ir(e);
|
|
965
|
+
return Array.isArray(t) ? t.flat(1 / 0) : [t];
|
|
966
|
+
}
|
|
967
|
+
function N(e) {
|
|
968
|
+
const t = ir(e);
|
|
969
|
+
return Array.isArray(t) ? t.flat(1 / 0)[0] : t;
|
|
970
|
+
}
|
|
971
|
+
function xe(e) {
|
|
972
|
+
return e === void 0 ? void 0 : N(e);
|
|
973
|
+
}
|
|
974
|
+
function H(e) {
|
|
975
|
+
return e == null || e === "" ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
976
|
+
}
|
|
977
|
+
function St(e, t) {
|
|
978
|
+
return e instanceof t ? e : new t(e.message || "#ERROR!");
|
|
979
|
+
}
|
|
980
|
+
function k(e) {
|
|
981
|
+
return e.find((t) => t instanceof Error);
|
|
982
|
+
}
|
|
983
|
+
function Nt(e, t) {
|
|
984
|
+
const r = (a) => {
|
|
985
|
+
throw St(a, t);
|
|
986
|
+
}, d = (a, { checkArgsForErrors: c = !0 } = {}) => (...s) => {
|
|
987
|
+
const o = s.flatMap(pe);
|
|
988
|
+
if (c) {
|
|
989
|
+
const l = k(o);
|
|
990
|
+
l && r(l);
|
|
991
|
+
}
|
|
992
|
+
const i = a(...o);
|
|
993
|
+
return i instanceof Error ? r(i) : i;
|
|
994
|
+
}, g = (a, { toText: c = !1 } = {}) => (s) => {
|
|
995
|
+
const o = N(s), i = k([o]);
|
|
996
|
+
i && r(i);
|
|
997
|
+
const l = a(c ? H(o) : o);
|
|
998
|
+
return l instanceof Error ? r(l) : l;
|
|
999
|
+
};
|
|
1000
|
+
return {
|
|
1001
|
+
// valueIfTrue/valueIfFalse are passed through unretrieved (not
|
|
1002
|
+
// dereferenced or type-checked here) — that's what makes
|
|
1003
|
+
// `IF(FALSE, B100, 99)` a genuine short-circuit rather than a lookup.
|
|
1004
|
+
IF: (a, c, s, o) => {
|
|
1005
|
+
const i = At(c, a, t);
|
|
1006
|
+
if (s == null) throw t.NA;
|
|
1007
|
+
return i ? s : o ?? !1;
|
|
1008
|
+
},
|
|
1009
|
+
// Empty input -> 0, matching both the hand-rolled engine this replaces
|
|
1010
|
+
// and formulajs's own convention for MAX/MIN.
|
|
1011
|
+
MAX: d(e.MAX),
|
|
1012
|
+
MIN: d(e.MIN),
|
|
1013
|
+
MAXA: d(e.MAXA),
|
|
1014
|
+
MINA: d(e.MINA),
|
|
1015
|
+
MEDIAN: d(e.MEDIAN),
|
|
1016
|
+
// COUNTA counts non-blank entries; an error value among the args is
|
|
1017
|
+
// itself non-blank and gets counted (matching formulajs's own COUNTA,
|
|
1018
|
+
// which never checks for errors), so this skips the error propagation
|
|
1019
|
+
// the other aggregates use.
|
|
1020
|
+
COUNTA: d(e.COUNTA, { checkArgsForErrors: !1 }),
|
|
1021
|
+
LARGE: (a, c) => {
|
|
1022
|
+
const s = pe(a), o = N(c), i = k([...s, o]);
|
|
1023
|
+
i && r(i);
|
|
1024
|
+
const l = e.LARGE(s, o);
|
|
1025
|
+
return l instanceof Error ? r(l) : l;
|
|
1026
|
+
},
|
|
1027
|
+
SMALL: (a, c) => {
|
|
1028
|
+
const s = pe(a), o = N(c), i = k([...s, o]);
|
|
1029
|
+
i && r(i);
|
|
1030
|
+
const l = e.SMALL(s, o);
|
|
1031
|
+
return l instanceof Error ? r(l) : l;
|
|
1032
|
+
},
|
|
1033
|
+
PERMUT: (a, c) => {
|
|
1034
|
+
const s = [N(a), N(c)], o = k(s);
|
|
1035
|
+
o && r(o);
|
|
1036
|
+
const i = e.PERMUT(s[0], s[1]);
|
|
1037
|
+
return i instanceof Error ? r(i) : i;
|
|
1038
|
+
},
|
|
1039
|
+
PERMUTATIONA: (a, c) => {
|
|
1040
|
+
const s = [N(a), N(c)], o = k(s);
|
|
1041
|
+
o && r(o);
|
|
1042
|
+
const i = e.PERMUTATIONA(s[0], s[1]);
|
|
1043
|
+
return i instanceof Error ? r(i) : i;
|
|
1044
|
+
},
|
|
1045
|
+
// match_type is intentionally ignored and forced to 0 (exact match)
|
|
1046
|
+
// regardless of what the formula author supplied — approximate/sorted
|
|
1047
|
+
// matching (formulajs's own default when the argument is omitted, and
|
|
1048
|
+
// Excel's own default too) risks silently mis-ranking unsorted
|
|
1049
|
+
// real-world data. Same scope decision as the hand-rolled engine this
|
|
1050
|
+
// replaces, carried forward deliberately rather than dropped.
|
|
1051
|
+
MATCH: (a, c) => {
|
|
1052
|
+
const s = N(a), o = pe(c), i = k([s, ...o]);
|
|
1053
|
+
i && r(i);
|
|
1054
|
+
const l = e.MATCH(s, o, 0);
|
|
1055
|
+
return l instanceof Error ? r(l) : l;
|
|
1056
|
+
},
|
|
1057
|
+
SWITCH: (...a) => {
|
|
1058
|
+
const c = a.map(N), s = k(c);
|
|
1059
|
+
s && r(s);
|
|
1060
|
+
const o = e.SWITCH(...c);
|
|
1061
|
+
return o instanceof Error ? r(o) : o;
|
|
1062
|
+
},
|
|
1063
|
+
SUBSTITUTE: (a, c, s, o) => {
|
|
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);
|
|
1067
|
+
l && r(l);
|
|
1068
|
+
const y = e.SUBSTITUTE(...i);
|
|
1069
|
+
return y instanceof Error ? r(y) : y;
|
|
1070
|
+
},
|
|
1071
|
+
TEXTJOIN: (a, c, ...s) => {
|
|
1072
|
+
const o = H(N(a)), i = N(c), l = s.flatMap(pe).map(H), y = k([o, i]);
|
|
1073
|
+
y && r(y);
|
|
1074
|
+
const h = e.TEXTJOIN(o, i, l);
|
|
1075
|
+
return h instanceof Error ? r(h) : h;
|
|
1076
|
+
},
|
|
1077
|
+
UPPER: g(e.UPPER),
|
|
1078
|
+
// See DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL above for why these override
|
|
1079
|
+
// fast-formula-parser's own (real, but broken-for-Date-cells) versions.
|
|
1080
|
+
YEAR: g(e.YEAR),
|
|
1081
|
+
MONTH: g(e.MONTH),
|
|
1082
|
+
DAY: g(e.DAY),
|
|
1083
|
+
WEEKDAY: (a, c) => {
|
|
1084
|
+
const s = N(a), o = N(c), i = k([s]);
|
|
1085
|
+
i && r(i);
|
|
1086
|
+
const l = e.WEEKDAY(s, o);
|
|
1087
|
+
return l instanceof Error ? r(l) : l;
|
|
1088
|
+
},
|
|
1089
|
+
// See TEXT_FUNCTIONS_BROKEN_FOR_BLANK_CELLS above: these override fast-
|
|
1090
|
+
// formula-parser's own (real, but broken-for-a-bare-blank-cell) versions.
|
|
1091
|
+
// Every text argument goes through this file's own null-safe toText()
|
|
1092
|
+
// rather than the library's own buggy coercer, so a blank cell reads as
|
|
1093
|
+
// empty text here the same way it always has for SUM/AVERAGE/COUNT.
|
|
1094
|
+
//
|
|
1095
|
+
// Flattens every argument (a whole range included) and joins with no
|
|
1096
|
+
// separator, matching Excel's own range-argument behavior — the native
|
|
1097
|
+
// implementation instead inserts stray commas for a whole-range argument.
|
|
1098
|
+
CONCATENATE: (...a) => {
|
|
1099
|
+
const c = a.flatMap(pe), s = k(c);
|
|
1100
|
+
s && r(s);
|
|
1101
|
+
const o = e.CONCATENATE(...c.map(H));
|
|
1102
|
+
return o instanceof Error ? r(o) : o;
|
|
1103
|
+
},
|
|
1104
|
+
CONCAT: (...a) => {
|
|
1105
|
+
const c = a.flatMap(pe), s = k(c);
|
|
1106
|
+
s && r(s);
|
|
1107
|
+
const o = e.CONCAT(...c.map(H));
|
|
1108
|
+
return o instanceof Error ? r(o) : o;
|
|
1109
|
+
},
|
|
1110
|
+
LEN: g(e.LEN, { toText: !0 }),
|
|
1111
|
+
TRIM: g(e.TRIM, { toText: !0 }),
|
|
1112
|
+
LOWER: g(e.LOWER, { toText: !0 }),
|
|
1113
|
+
LEFT: (a, c) => {
|
|
1114
|
+
const s = N(a), o = xe(c), i = k([s]);
|
|
1115
|
+
i && r(i);
|
|
1116
|
+
const l = e.LEFT(H(s), o);
|
|
1117
|
+
return l instanceof Error ? r(l) : l;
|
|
1118
|
+
},
|
|
1119
|
+
RIGHT: (a, c) => {
|
|
1120
|
+
const s = N(a), o = xe(c), i = k([s]);
|
|
1121
|
+
i && r(i);
|
|
1122
|
+
const l = e.RIGHT(H(s), o);
|
|
1123
|
+
return l instanceof Error ? r(l) : l;
|
|
1124
|
+
},
|
|
1125
|
+
MID: (a, c, s) => {
|
|
1126
|
+
const o = N(a), i = N(c), l = N(s), y = k([o, i, l]);
|
|
1127
|
+
y && r(y);
|
|
1128
|
+
const h = e.MID(H(o), i, l);
|
|
1129
|
+
return h instanceof Error ? r(h) : h;
|
|
1130
|
+
},
|
|
1131
|
+
FIND: (a, c, s) => {
|
|
1132
|
+
const o = N(a), i = N(c), l = xe(s), y = k([o, i]);
|
|
1133
|
+
y && r(y);
|
|
1134
|
+
const h = e.FIND(H(o), H(i), l);
|
|
1135
|
+
return h instanceof Error ? r(h) : h;
|
|
1136
|
+
},
|
|
1137
|
+
SEARCH: (a, c, s) => {
|
|
1138
|
+
const o = N(a), i = N(c), l = xe(s), y = k([o, i]);
|
|
1139
|
+
y && r(y);
|
|
1140
|
+
const h = e.SEARCH(H(o), H(i), l);
|
|
1141
|
+
return h instanceof Error ? r(h) : h;
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
const Ot = {
|
|
1146
|
+
"#REF!": "REF",
|
|
1147
|
+
"#VALUE!": "VALUE",
|
|
1148
|
+
"#DIV/0!": "DIV0",
|
|
1149
|
+
"#NAME?": "NAME",
|
|
1150
|
+
"#N/A": "NA",
|
|
1151
|
+
"#NUM!": "NUM",
|
|
1152
|
+
"#NULL!": "NULL"
|
|
1153
|
+
};
|
|
1154
|
+
function We(e) {
|
|
1155
|
+
return Ot[e.error] ?? "ERROR";
|
|
1156
|
+
}
|
|
1157
|
+
function Be(e, t) {
|
|
1158
|
+
if (e instanceof X) return e;
|
|
1159
|
+
if (e instanceof t) {
|
|
1160
|
+
const r = e.details;
|
|
1161
|
+
return r instanceof X ? r : r instanceof t ? new X(We(r), r.message) : new X(We(e), e.message);
|
|
1162
|
+
}
|
|
1163
|
+
return new X("ERROR", e instanceof Error ? e.message : void 0);
|
|
1164
|
+
}
|
|
1165
|
+
function It(e) {
|
|
1166
|
+
return Math.max(0, ...e.map((t) => (t == null ? void 0 : t.length) ?? 0));
|
|
1167
|
+
}
|
|
1168
|
+
function xt(e) {
|
|
1169
|
+
return (t) => {
|
|
1170
|
+
const r = e[t.row - 1];
|
|
1171
|
+
if (t.row < 1 || t.col < 1 || r == null || t.col - 1 >= r.length)
|
|
1172
|
+
throw new X("REF");
|
|
1173
|
+
const d = r[t.col - 1];
|
|
1174
|
+
return d == null || d === "" ? null : d;
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
function Lt(e) {
|
|
1178
|
+
return (t) => {
|
|
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);
|
|
1180
|
+
if (r > e.length || d > c)
|
|
1181
|
+
throw new X("REF");
|
|
1182
|
+
const s = Math.min(g, e.length), o = [];
|
|
1183
|
+
for (let i = r; i <= s; i++) {
|
|
1184
|
+
const l = e[i - 1], y = [];
|
|
1185
|
+
if (l != null) {
|
|
1186
|
+
const h = Math.min(a, l.length);
|
|
1187
|
+
for (let u = d; u <= h; u++) {
|
|
1188
|
+
const v = l[u - 1];
|
|
1189
|
+
y.push(v == null || v === "" ? null : v);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
o.push(y);
|
|
1193
|
+
}
|
|
1194
|
+
return o;
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
function Mt(e) {
|
|
1198
|
+
if (e == null || e === "") return null;
|
|
1199
|
+
if (typeof e == "number" || typeof e == "string" || typeof e == "boolean" || e instanceof Date)
|
|
1200
|
+
return e;
|
|
1201
|
+
throw new X("VALUE");
|
|
1202
|
+
}
|
|
1203
|
+
async function Dt(e, t) {
|
|
1204
|
+
if (typeof t != "string") throw new X("ERROR");
|
|
1205
|
+
const r = t.trim();
|
|
1206
|
+
if (r === "") throw new X("ERROR");
|
|
1207
|
+
const d = r.startsWith("=") ? r.slice(1) : r;
|
|
1208
|
+
Tt(d);
|
|
1209
|
+
const [g, a] = await Promise.all([
|
|
1210
|
+
import("fast-formula-parser"),
|
|
1211
|
+
import("@formulajs/formulajs")
|
|
1212
|
+
]), c = g.default ?? g, s = c.FormulaError, o = new c({
|
|
1213
|
+
onCell: xt(e),
|
|
1214
|
+
onRange: Lt(e),
|
|
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.
|
|
1216
|
+
functions: Nt(a, s)
|
|
1217
|
+
});
|
|
1218
|
+
let i;
|
|
1219
|
+
try {
|
|
1220
|
+
i = o.parse(d, { row: 1, col: 1, sheet: "Sheet1" });
|
|
1221
|
+
} catch (l) {
|
|
1222
|
+
throw Be(l, s);
|
|
1223
|
+
}
|
|
1224
|
+
if (i instanceof s)
|
|
1225
|
+
throw Be(i, s);
|
|
1226
|
+
return Mt(i);
|
|
1227
|
+
}
|
|
1228
|
+
const Ke = {
|
|
1229
|
+
REF: "#REF!",
|
|
1230
|
+
VALUE: "#VALUE!",
|
|
1231
|
+
DIV0: "#DIV/0!",
|
|
1232
|
+
NAME: "#NAME?",
|
|
1233
|
+
ERROR: "#ERROR!",
|
|
1234
|
+
NA: "#N/A",
|
|
1235
|
+
NUM: "#NUM!",
|
|
1236
|
+
NULL: "#NULL!"
|
|
1237
|
+
};
|
|
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(
|
|
1240
|
+
t.map(async (r) => {
|
|
1241
|
+
try {
|
|
1242
|
+
if (!r || typeof r.label != "string" || typeof r.expression != "string")
|
|
1243
|
+
throw new X("ERROR");
|
|
1244
|
+
return { label: r.label, value: await Dt(e, r.expression) };
|
|
1245
|
+
} catch (d) {
|
|
1246
|
+
const g = d instanceof X ? d.code : "ERROR";
|
|
1247
|
+
return { label: (r == null ? void 0 : r.label) ?? "(unknown)", value: null, error: Ke[g] };
|
|
1248
|
+
}
|
|
1249
|
+
})
|
|
1250
|
+
);
|
|
1251
|
+
}
|
|
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) {
|
|
1254
|
+
return e == null || e === "" ? "" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
1255
|
+
}
|
|
1256
|
+
const _t = ({
|
|
1257
|
+
data: e,
|
|
1258
|
+
handleChange: t,
|
|
837
1259
|
path: r,
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
1260
|
+
label: d,
|
|
1261
|
+
required: g,
|
|
1262
|
+
schema: a,
|
|
1263
|
+
enabled: c,
|
|
1264
|
+
errors: s,
|
|
1265
|
+
visible: o = !0
|
|
1266
|
+
}) => {
|
|
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] = _(
|
|
1270
|
+
() => {
|
|
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";
|
|
1273
|
+
}
|
|
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.`);
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
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)}`);
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
P("parsing");
|
|
1285
|
+
let te;
|
|
1286
|
+
try {
|
|
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."
|
|
1292
|
+
);
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1295
|
+
j(te);
|
|
1296
|
+
const ae = await zt(te, h);
|
|
1297
|
+
t(
|
|
1298
|
+
r,
|
|
1299
|
+
M ? { sheet: te, derivations: ae } : { derivations: ae }
|
|
1300
|
+
), P("ready");
|
|
1301
|
+
},
|
|
1302
|
+
[u, v, M, z, h, r, t]
|
|
1303
|
+
);
|
|
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 = "");
|
|
1313
|
+
}, b = () => {
|
|
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: [
|
|
1322
|
+
d,
|
|
1323
|
+
g && /* @__PURE__ */ n(f, { color: "red", children: " *" })
|
|
1324
|
+
] }),
|
|
1325
|
+
/* @__PURE__ */ p(f, { size: "1", color: "gray", children: [
|
|
1326
|
+
me(v),
|
|
1327
|
+
" max · ",
|
|
1328
|
+
ye(u)
|
|
1329
|
+
] })
|
|
1330
|
+
] }),
|
|
1331
|
+
re && /* @__PURE__ */ n($e, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ p(T, { align: "center", gap: "3", children: [
|
|
1332
|
+
/* @__PURE__ */ n(
|
|
1333
|
+
C,
|
|
1334
|
+
{
|
|
1335
|
+
style: {
|
|
1336
|
+
background: "var(--blue-3)",
|
|
1337
|
+
padding: 8,
|
|
1338
|
+
borderRadius: 6,
|
|
1339
|
+
color: "var(--blue-9)",
|
|
1340
|
+
flexShrink: 0
|
|
1341
|
+
},
|
|
1342
|
+
children: /* @__PURE__ */ n(Qe, { width: "20", height: "20" })
|
|
1343
|
+
}
|
|
1344
|
+
),
|
|
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, {}) })
|
|
1348
|
+
] }) }),
|
|
1349
|
+
l && /* @__PURE__ */ p(
|
|
1350
|
+
"div",
|
|
1351
|
+
{
|
|
1352
|
+
role: "button",
|
|
1353
|
+
tabIndex: 0,
|
|
1354
|
+
onClick: () => {
|
|
1355
|
+
var E;
|
|
1356
|
+
return (E = K.current) == null ? void 0 : E.click();
|
|
1357
|
+
},
|
|
1358
|
+
onKeyDown: (E) => {
|
|
1359
|
+
var L;
|
|
1360
|
+
(E.key === "Enter" || E.key === " ") && (E.preventDefault(), (L = K.current) == null || L.click());
|
|
1361
|
+
},
|
|
1362
|
+
onDragEnter: se,
|
|
1363
|
+
onDragLeave: se,
|
|
1364
|
+
onDragOver: se,
|
|
1365
|
+
onDrop: ce,
|
|
1366
|
+
style: { cursor: "pointer" },
|
|
1367
|
+
className: [
|
|
1368
|
+
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
1369
|
+
"transition-all duration-200 ease-in-out",
|
|
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"
|
|
1371
|
+
].join(" "),
|
|
1372
|
+
children: [
|
|
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),
|
|
1386
|
+
" max · ",
|
|
1387
|
+
ye(u)
|
|
1388
|
+
] })
|
|
1389
|
+
] }) })
|
|
1390
|
+
]
|
|
1391
|
+
}
|
|
1392
|
+
),
|
|
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);
|
|
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);
|
|
1409
|
+
}) })
|
|
1410
|
+
] }) }),
|
|
1411
|
+
R.length > De && /* @__PURE__ */ p(f, { size: "1", color: "gray", mt: "1", style: { display: "block" }, children: [
|
|
1412
|
+
"Showing first ",
|
|
1413
|
+
De,
|
|
1414
|
+
" of ",
|
|
1415
|
+
R.length,
|
|
1416
|
+
" rows"
|
|
1417
|
+
] })
|
|
1418
|
+
] }),
|
|
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 }) : (
|
|
1425
|
+
// d.value is CellValue | null now (SUM/AVERAGE aren't the only
|
|
1426
|
+
// possible results anymore — INDEX/CONCATENATE can return a
|
|
1427
|
+
// string, a bare comparison can return a boolean, etc.), so
|
|
1428
|
+
// `.toLocaleString()` would throw for e.g. a boolean result.
|
|
1429
|
+
// Reuse the same formatCell used for the sheet-preview grid.
|
|
1430
|
+
/* @__PURE__ */ n(f, { size: "2", children: Ce(E.value) })
|
|
1431
|
+
)
|
|
1432
|
+
] }, L)) })
|
|
1433
|
+
] }),
|
|
1434
|
+
!i && /* @__PURE__ */ n(f, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: le(s, d) })
|
|
1435
|
+
] });
|
|
1436
|
+
}, Pt = oe(_t), Vt = W(
|
|
1437
|
+
10,
|
|
1438
|
+
// matches FileControlTester's rank — beats the default object/Group renderer
|
|
1439
|
+
Fe(
|
|
1440
|
+
(e) => e.type === "object" && typeof e["x-spreadsheet"] == "object"
|
|
1441
|
+
)
|
|
1442
|
+
), Ht = ({
|
|
1443
|
+
data: e,
|
|
1444
|
+
path: t,
|
|
1445
|
+
schema: r,
|
|
1446
|
+
uischema: d,
|
|
1447
|
+
enabled: g,
|
|
1448
|
+
visible: a,
|
|
1449
|
+
addItem: c,
|
|
1450
|
+
removeItems: s,
|
|
1451
|
+
rootSchema: o,
|
|
1452
|
+
arraySchema: i
|
|
846
1453
|
}) => {
|
|
847
|
-
const l =
|
|
848
|
-
if (
|
|
1454
|
+
const l = i ? r : r.items, y = i || r;
|
|
1455
|
+
if (a === !1 || !l || typeof l != "object" || Array.isArray(l))
|
|
849
1456
|
return null;
|
|
850
|
-
const
|
|
851
|
-
const w =
|
|
852
|
-
|
|
853
|
-
},
|
|
854
|
-
if (
|
|
855
|
-
const
|
|
856
|
-
|
|
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) => {
|
|
1461
|
+
if (s) {
|
|
1462
|
+
const O = s(t, [w]);
|
|
1463
|
+
O && O();
|
|
857
1464
|
}
|
|
858
1465
|
};
|
|
859
|
-
return /* @__PURE__ */
|
|
860
|
-
/* @__PURE__ */
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
var
|
|
864
|
-
const
|
|
865
|
-
return /* @__PURE__ */ e
|
|
866
|
-
/* @__PURE__ */
|
|
867
|
-
/* @__PURE__ */ f
|
|
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: [
|
|
868
1475
|
"Item ",
|
|
869
|
-
|
|
1476
|
+
O + 1
|
|
870
1477
|
] }),
|
|
871
|
-
|
|
872
|
-
|
|
1478
|
+
g && /* @__PURE__ */ p(
|
|
1479
|
+
Le,
|
|
873
1480
|
{
|
|
874
1481
|
type: "button",
|
|
875
1482
|
color: "red",
|
|
876
1483
|
variant: "soft",
|
|
877
|
-
onClick: () =>
|
|
1484
|
+
onClick: () => A(O),
|
|
878
1485
|
title: "Remove item",
|
|
879
1486
|
children: [
|
|
880
|
-
/* @__PURE__ */
|
|
1487
|
+
/* @__PURE__ */ n(Sr, {}),
|
|
881
1488
|
"Remove"
|
|
882
1489
|
]
|
|
883
1490
|
}
|
|
884
1491
|
)
|
|
885
1492
|
] }),
|
|
886
|
-
/* @__PURE__ */
|
|
887
|
-
|
|
1493
|
+
/* @__PURE__ */ n(C, { children: /* @__PURE__ */ n(
|
|
1494
|
+
Se,
|
|
888
1495
|
{
|
|
889
|
-
schema:
|
|
890
|
-
uischema: ((
|
|
1496
|
+
schema: h,
|
|
1497
|
+
uischema: ((S = d.options) == null ? void 0 : S.detail) || (h.type === "object" || h.properties ? {
|
|
891
1498
|
type: "VerticalLayout",
|
|
892
|
-
elements: Object.keys(
|
|
1499
|
+
elements: Object.keys(h.properties || {}).map((q) => ({
|
|
893
1500
|
type: "Control",
|
|
894
|
-
scope: `#/properties/${
|
|
1501
|
+
scope: `#/properties/${q}`
|
|
895
1502
|
}))
|
|
896
1503
|
} : {
|
|
897
1504
|
type: "Control",
|
|
898
1505
|
scope: "#"
|
|
899
1506
|
}),
|
|
900
|
-
path:
|
|
901
|
-
enabled:
|
|
1507
|
+
path: z,
|
|
1508
|
+
enabled: g,
|
|
902
1509
|
renderers: void 0,
|
|
903
1510
|
cells: void 0
|
|
904
1511
|
}
|
|
905
1512
|
) })
|
|
906
|
-
] }) },
|
|
1513
|
+
] }) }, z);
|
|
907
1514
|
}),
|
|
908
|
-
|
|
909
|
-
/* @__PURE__ */
|
|
1515
|
+
g && /* @__PURE__ */ n(C, { mt: "2", children: /* @__PURE__ */ p(Le, { type: "button", variant: "surface", onClick: M, children: [
|
|
1516
|
+
/* @__PURE__ */ n(Nr, {}),
|
|
910
1517
|
"Add Item"
|
|
911
1518
|
] }) })
|
|
912
1519
|
] }) });
|
|
913
|
-
},
|
|
914
|
-
const
|
|
915
|
-
return
|
|
916
|
-
},
|
|
917
|
-
{ tester:
|
|
918
|
-
{ tester:
|
|
919
|
-
{ tester:
|
|
920
|
-
{ tester:
|
|
921
|
-
{ tester:
|
|
922
|
-
{ tester:
|
|
923
|
-
{ tester:
|
|
924
|
-
{ tester:
|
|
925
|
-
{ tester:
|
|
926
|
-
{ tester:
|
|
927
|
-
{ tester:
|
|
928
|
-
{ tester:
|
|
929
|
-
{ tester:
|
|
930
|
-
{ tester:
|
|
931
|
-
{ tester:
|
|
1520
|
+
}, Ge = Rr(Ht), Wt = W(3, Er), Bt = ({ uischema: e, visible: t }) => {
|
|
1521
|
+
const r = e;
|
|
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 }
|
|
932
1540
|
];
|
|
933
1541
|
export {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
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
|
|
967
1577
|
};
|