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