treege 3.0.0-beta.18 → 3.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -12
- package/dist/{ThemeContext-zQO8nZ9d.js → ThemeContext-CQoWKClD.js} +85 -85
- package/dist/{TreegeEditor-DXhj6fWi.js → TreegeEditor-BP0R2rMo.js} +275 -264
- package/dist/{TreegeRenderer-CjLeK7_j.js → TreegeRenderer-ClfGb4Mq.js} +305 -291
- package/dist/editor.js +2 -2
- package/dist/main.js +3 -3
- package/dist/renderer.js +2 -2
- package/dist/shared/locales/ar.json.d.ts +8 -1
- package/dist/shared/locales/de.json.d.ts +8 -1
- package/dist/shared/locales/en.json.d.ts +8 -1
- package/dist/shared/locales/es.json.d.ts +8 -1
- package/dist/shared/locales/fr.json.d.ts +8 -1
- package/dist/shared/locales/it.json.d.ts +8 -1
- package/dist/shared/locales/pt.json.d.ts +8 -1
- package/dist/shared/types/node.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { j as t, i as W, L as be, b as
|
|
1
|
+
import { j as t, i as W, L as be, b as Ue, e as Nt, F as E, f as D, I as X, C as De, h as Re, k as ke, l as Ae, m as Ee, n as O, o as P, P as me, p as fe, B as le, q as pe, r as Ge, s as y, t as Ve, v as Me, S as We, w as Ke, x as Je, y as Qe, z as Xe, A as Ye, D as wt, E as vt, G as je, g as ne, N as ue, a as St, c as Ft, T as Ct } from "./ThemeContext-CQoWKClD.js";
|
|
2
2
|
import * as ze from "react";
|
|
3
3
|
import { createContext as Ze, useContext as et, useMemo as G, useRef as K, useState as B, useCallback as Q, useEffect as J, forwardRef as It } from "react";
|
|
4
|
-
import { MapPin as Be, ChevronsUpDown as tt, Check as st, ChevronLeftIcon as Tt, ChevronRightIcon as
|
|
5
|
-
import { getDefaultClassNames as rt, DayPicker as
|
|
4
|
+
import { MapPin as Be, ChevronsUpDown as tt, Check as st, ChevronLeftIcon as Tt, ChevronRightIcon as Dt, ChevronDownIcon as Oe, Loader2 as ye, CircleIcon as Rt } from "lucide-react";
|
|
5
|
+
import { getDefaultClassNames as rt, DayPicker as kt } from "react-day-picker";
|
|
6
6
|
import * as ae from "@radix-ui/react-tooltip";
|
|
7
7
|
import * as Ie from "@radix-ui/react-radio-group";
|
|
8
8
|
import "cmdk";
|
|
@@ -31,7 +31,7 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
31
31
|
validationMode: i
|
|
32
32
|
};
|
|
33
33
|
return /* @__PURE__ */ t.jsx(nt.Provider, { value: a, children: e });
|
|
34
|
-
}, qe = (e) => e == null ? null : typeof e == "boolean" || typeof e == "number" ? e : typeof e == "string" ? e === "" ? null : e : typeof e == "object" ? JSON.stringify(e) : String(e),
|
|
34
|
+
}, qe = (e) => e == null ? null : typeof e == "boolean" || typeof e == "number" ? e : typeof e == "string" ? e === "" ? null : e : typeof e == "object" ? JSON.stringify(e) : String(e), At = (e, r, n) => {
|
|
35
35
|
const s = qe(e), o = qe(r);
|
|
36
36
|
if (s === null || o === null)
|
|
37
37
|
switch (n) {
|
|
@@ -80,7 +80,7 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
80
80
|
const l = n.get(s);
|
|
81
81
|
l && W(l) && (a = r[l.id]);
|
|
82
82
|
}
|
|
83
|
-
return
|
|
83
|
+
return At(a, i, o);
|
|
84
84
|
}, Et = (e, r, n) => {
|
|
85
85
|
if (!e || e.length === 0)
|
|
86
86
|
return !0;
|
|
@@ -110,7 +110,7 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
110
110
|
}, Pt = (e, r) => {
|
|
111
111
|
const n = r.find((s) => s.id === e);
|
|
112
112
|
return n ? Pe(n) : void 0;
|
|
113
|
-
},
|
|
113
|
+
}, we = (e) => e == null || typeof e == "string" && e.trim() === "" ? !0 : Array.isArray(e) && e.length === 0, $t = (e, r) => {
|
|
114
114
|
if (!e)
|
|
115
115
|
return !1;
|
|
116
116
|
const n = r[e];
|
|
@@ -153,7 +153,7 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
153
153
|
default:
|
|
154
154
|
return e;
|
|
155
155
|
}
|
|
156
|
-
},
|
|
156
|
+
}, He = (e, r) => {
|
|
157
157
|
if (Object.is(e, r))
|
|
158
158
|
return !0;
|
|
159
159
|
if (!(e && r) || typeof e != "object" || typeof r != "object")
|
|
@@ -172,8 +172,8 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
172
172
|
const a = o.id, { referenceField: l, transformFunction: c, objectMapping: m } = i, u = r[l], d = n[l];
|
|
173
173
|
if (u === d || u === void 0 || u === null)
|
|
174
174
|
return;
|
|
175
|
-
const f = Le(u, c, m),
|
|
176
|
-
!p ||
|
|
175
|
+
const f = Le(u, c, m), g = Le(d, c, m), h = r[a], p = He(h, g), j = He(h, f);
|
|
176
|
+
!p || j || (s[a] = f);
|
|
177
177
|
}), s;
|
|
178
178
|
}, Vt = (e) => {
|
|
179
179
|
const r = /* @__PURE__ */ new Map();
|
|
@@ -195,8 +195,8 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
195
195
|
return u ? u.every((d) => {
|
|
196
196
|
if (!d.field)
|
|
197
197
|
return !0;
|
|
198
|
-
const f = n.get(d.field),
|
|
199
|
-
return $t(
|
|
198
|
+
const f = n.get(d.field), g = W(f) ? f.id : d.field;
|
|
199
|
+
return $t(g, r);
|
|
200
200
|
}) : !1;
|
|
201
201
|
}))
|
|
202
202
|
return i.length > 0 && a.push(...i), { edgesToFollow: a, waitingForInput: a.length === 0 };
|
|
@@ -235,28 +235,28 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
235
235
|
if (c.has(p))
|
|
236
236
|
return;
|
|
237
237
|
c.add(p);
|
|
238
|
-
const
|
|
239
|
-
if (!
|
|
238
|
+
const j = o.get(p);
|
|
239
|
+
if (!j)
|
|
240
240
|
return;
|
|
241
|
-
l.add(p), a.push(
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
241
|
+
l.add(p), a.push(j);
|
|
242
|
+
const T = i.get(p) || [], { edgesToFollow: _, waitingForInput: R } = Mt(T, n, o);
|
|
243
|
+
if (R) {
|
|
244
244
|
m = !0;
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
|
-
_.forEach((
|
|
248
|
-
u(
|
|
247
|
+
_.forEach((w) => {
|
|
248
|
+
u(w.target);
|
|
249
249
|
});
|
|
250
250
|
};
|
|
251
251
|
u(s.id);
|
|
252
|
-
const d = new Map(a.map((p,
|
|
252
|
+
const d = new Map(a.map((p, j) => [p.id, j])), f = new Set(l);
|
|
253
253
|
Bt(l, f, d, o);
|
|
254
|
-
const
|
|
254
|
+
const g = e.filter((p) => f.has(p.id)).sort((p, j) => (d.get(p.id) ?? Number.MAX_SAFE_INTEGER) - (d.get(j.id) ?? Number.MAX_SAFE_INTEGER)), h = g.filter((p) => !(p.parentId && f.has(p.parentId)));
|
|
255
255
|
return {
|
|
256
256
|
endOfPathReached: !m,
|
|
257
257
|
visibleNodeIds: f,
|
|
258
|
-
visibleNodes:
|
|
259
|
-
visibleRootNodes:
|
|
258
|
+
visibleNodes: g,
|
|
259
|
+
visibleRootNodes: h
|
|
260
260
|
};
|
|
261
261
|
}, Lt = (e) => {
|
|
262
262
|
if (e.length === 1)
|
|
@@ -264,7 +264,7 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
264
264
|
const r = new Set(e.map((s) => s.id)), n = /* @__PURE__ */ new Set();
|
|
265
265
|
return e.forEach((s) => {
|
|
266
266
|
s.nodes.forEach((o) => {
|
|
267
|
-
if (
|
|
267
|
+
if (Ue(o)) {
|
|
268
268
|
const i = o.data.targetId;
|
|
269
269
|
i && r.has(i) && n.add(i);
|
|
270
270
|
}
|
|
@@ -286,7 +286,7 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
286
286
|
} else
|
|
287
287
|
i.add(a);
|
|
288
288
|
return i;
|
|
289
|
-
},
|
|
289
|
+
}, Ht = (e, r) => {
|
|
290
290
|
const n = /* @__PURE__ */ new Set();
|
|
291
291
|
return r.forEach((s) => {
|
|
292
292
|
e.has(s.source) && e.has(s.target) && n.add(s.source);
|
|
@@ -301,61 +301,61 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
301
301
|
if (r.length === 1)
|
|
302
302
|
return n;
|
|
303
303
|
const s = new Map(r.map((f) => [f.id, f])), o = [], i = [...n.edges], a = /* @__PURE__ */ new Set([n.id]), l = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), u = (f) => {
|
|
304
|
-
const
|
|
305
|
-
return f.forEach((
|
|
306
|
-
if (!
|
|
307
|
-
|
|
304
|
+
const g = [];
|
|
305
|
+
return f.forEach((h) => {
|
|
306
|
+
if (!Ue(h)) {
|
|
307
|
+
g.push(h);
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
|
-
const p =
|
|
310
|
+
const p = h.data.targetId;
|
|
311
311
|
if (!p)
|
|
312
312
|
return;
|
|
313
|
-
const
|
|
314
|
-
if (!
|
|
313
|
+
const j = s.get(p);
|
|
314
|
+
if (!j) {
|
|
315
315
|
console.warn(`Flow with id "${p}" not found`);
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
|
-
const
|
|
319
|
-
if (!
|
|
320
|
-
console.warn(`Flow "${p}" has no root node; preserving FlowNode "${
|
|
318
|
+
const T = j.nodes.find((_) => !_.parentId);
|
|
319
|
+
if (!T) {
|
|
320
|
+
console.warn(`Flow "${p}" has no root node; preserving FlowNode "${h.id}"`), g.push(h);
|
|
321
321
|
return;
|
|
322
322
|
}
|
|
323
|
-
l.set(
|
|
324
|
-
}),
|
|
323
|
+
l.set(h.id, T.id), c.set(h.id, p), a.has(p) || (a.add(p), i.push(...j.edges), g.push(...u(j.nodes)));
|
|
324
|
+
}), g;
|
|
325
325
|
};
|
|
326
326
|
o.push(...u(n.nodes)), i.forEach((f) => {
|
|
327
327
|
if (l.has(f.source)) {
|
|
328
|
-
const
|
|
329
|
-
|
|
328
|
+
const g = m.get(f.source);
|
|
329
|
+
g ? g.push(f) : m.set(f.source, [f]);
|
|
330
330
|
}
|
|
331
331
|
});
|
|
332
332
|
const d = i.map((f) => {
|
|
333
333
|
if (l.has(f.source))
|
|
334
334
|
return null;
|
|
335
|
-
const
|
|
336
|
-
return
|
|
335
|
+
const g = l.get(f.target);
|
|
336
|
+
return g ? { ...f, target: g } : f;
|
|
337
337
|
}).filter((f) => f !== null);
|
|
338
|
-
return l.forEach((f,
|
|
339
|
-
const
|
|
340
|
-
if (!
|
|
338
|
+
return l.forEach((f, g) => {
|
|
339
|
+
const h = m.get(g);
|
|
340
|
+
if (!h?.length)
|
|
341
341
|
return;
|
|
342
|
-
const p = c.get(
|
|
343
|
-
if (!
|
|
342
|
+
const p = c.get(g), j = p ? s.get(p) : void 0;
|
|
343
|
+
if (!j)
|
|
344
344
|
return;
|
|
345
|
-
const
|
|
346
|
-
|
|
345
|
+
const T = new Set(j.nodes.map((w) => w.id)), _ = it(
|
|
346
|
+
T,
|
|
347
347
|
s,
|
|
348
348
|
l,
|
|
349
349
|
c,
|
|
350
350
|
new Set(p ? [p] : [])
|
|
351
351
|
);
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
const b = l.get(x.target) ?? x.target,
|
|
352
|
+
Ht(_, d).forEach((w) => {
|
|
353
|
+
h.forEach((x) => {
|
|
354
|
+
const b = l.get(x.target) ?? x.target, v = x.id ?? `${g}__${x.target}`;
|
|
355
355
|
d.push({
|
|
356
356
|
...x,
|
|
357
|
-
id: `${
|
|
358
|
-
source:
|
|
357
|
+
id: `${w}__${v}`,
|
|
358
|
+
source: w,
|
|
359
359
|
target: b
|
|
360
360
|
});
|
|
361
361
|
});
|
|
@@ -365,7 +365,7 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
365
365
|
id: n.id,
|
|
366
366
|
nodes: o
|
|
367
367
|
};
|
|
368
|
-
}, ct = Ze(null),
|
|
368
|
+
}, ct = Ze(null), Ut = ({ children: e, value: r }) => /* @__PURE__ */ t.jsx(ct.Provider, { value: r, children: e }), he = () => {
|
|
369
369
|
const r = et(ct) ?? {
|
|
370
370
|
flows: null,
|
|
371
371
|
formErrors: {},
|
|
@@ -388,50 +388,50 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
388
388
|
const x = { ...r };
|
|
389
389
|
return o.forEach((b) => {
|
|
390
390
|
if (W(b)) {
|
|
391
|
-
const
|
|
392
|
-
if (x[
|
|
391
|
+
const v = b.id;
|
|
392
|
+
if (x[v] !== void 0)
|
|
393
393
|
return;
|
|
394
394
|
const { defaultValue: F } = b.data;
|
|
395
395
|
if (!F)
|
|
396
396
|
return;
|
|
397
|
-
if (F.type === "static" && F.staticValue !== void 0 && (x[
|
|
397
|
+
if (F.type === "static" && F.staticValue !== void 0 && (x[v] = F.staticValue), F.type === "reference" && F.referenceField) {
|
|
398
398
|
const { referenceField: $ } = F, L = x[$];
|
|
399
|
-
L !== void 0 && (x[
|
|
399
|
+
L !== void 0 && (x[v] = L);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
}), x;
|
|
403
|
-
}), { endOfPathReached:
|
|
403
|
+
}), { endOfPathReached: g, visibleNodes: h, visibleRootNodes: p } = G(
|
|
404
404
|
() => qt(o, i, d),
|
|
405
405
|
[o, i, d]
|
|
406
|
-
),
|
|
407
|
-
f((
|
|
408
|
-
...
|
|
406
|
+
), j = Q((x, b) => {
|
|
407
|
+
f((v) => ({
|
|
408
|
+
...v,
|
|
409
409
|
[x]: b
|
|
410
|
-
})), u((
|
|
411
|
-
const F = { ...
|
|
410
|
+
})), u((v) => {
|
|
411
|
+
const F = { ...v };
|
|
412
412
|
return delete F[x], F;
|
|
413
413
|
});
|
|
414
|
-
}, []),
|
|
414
|
+
}, []), T = Q((x) => {
|
|
415
415
|
Object.keys(x).length !== 0 && (f((b) => ({
|
|
416
416
|
...b,
|
|
417
417
|
...x
|
|
418
418
|
})), u((b) => {
|
|
419
|
-
const
|
|
419
|
+
const v = { ...b };
|
|
420
420
|
return Object.keys(x).forEach((F) => {
|
|
421
|
-
delete
|
|
422
|
-
}),
|
|
421
|
+
delete v[F];
|
|
422
|
+
}), v;
|
|
423
423
|
}));
|
|
424
424
|
}, []), _ = Q(
|
|
425
425
|
(x) => {
|
|
426
426
|
const b = {};
|
|
427
|
-
|
|
427
|
+
h.forEach(($) => {
|
|
428
428
|
if (W($)) {
|
|
429
429
|
const L = $.id, ee = d[L];
|
|
430
|
-
if ($.data.required &&
|
|
430
|
+
if ($.data.required && we(ee)) {
|
|
431
431
|
b[L] = l($.data.errorMessage) || l("validation.required");
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
|
-
if (!
|
|
434
|
+
if (!we(ee) && $.data.pattern)
|
|
435
435
|
try {
|
|
436
436
|
new RegExp($.data.pattern).test(String(ee)) || (b[L] = l($.data.errorMessage) || l("validation.invalidFormat"));
|
|
437
437
|
} catch (Y) {
|
|
@@ -439,49 +439,49 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
});
|
|
442
|
-
const
|
|
442
|
+
const v = x ? x(d, h) : {}, F = {
|
|
443
443
|
...b,
|
|
444
|
-
...
|
|
444
|
+
...v
|
|
445
445
|
};
|
|
446
446
|
return u(F), {
|
|
447
447
|
errors: F,
|
|
448
|
-
hasCustomErrors: Object.keys(
|
|
448
|
+
hasCustomErrors: Object.keys(v).length > 0,
|
|
449
449
|
isValid: Object.keys(F).length === 0
|
|
450
450
|
};
|
|
451
451
|
},
|
|
452
|
-
[
|
|
453
|
-
),
|
|
452
|
+
[h, d, l]
|
|
453
|
+
), R = G(() => {
|
|
454
454
|
const x = [];
|
|
455
|
-
return
|
|
455
|
+
return h.forEach((b) => {
|
|
456
456
|
if (!W(b))
|
|
457
457
|
return;
|
|
458
|
-
const
|
|
459
|
-
if (b.data.required &&
|
|
460
|
-
const $ = l(b.data.label) ||
|
|
458
|
+
const v = b.id, F = d[v];
|
|
459
|
+
if (b.data.required && we(F)) {
|
|
460
|
+
const $ = l(b.data.label) || v;
|
|
461
461
|
x.push($);
|
|
462
462
|
}
|
|
463
463
|
}), x;
|
|
464
|
-
}, [
|
|
464
|
+
}, [h, d, l]);
|
|
465
465
|
return {
|
|
466
|
-
canSubmit: !G(() =>
|
|
466
|
+
canSubmit: !G(() => h.some((x) => W(x) && x.data.type === "submit"), [h]) && g && o.length > 0,
|
|
467
467
|
formErrors: m,
|
|
468
468
|
formValues: d,
|
|
469
469
|
inputNodes: a,
|
|
470
470
|
mergedFlow: s,
|
|
471
|
-
missingRequiredFields:
|
|
471
|
+
missingRequiredFields: R,
|
|
472
472
|
prevFormValuesRef: c,
|
|
473
|
-
setFieldValue:
|
|
473
|
+
setFieldValue: j,
|
|
474
474
|
setFormErrors: u,
|
|
475
|
-
setMultipleFieldValues:
|
|
475
|
+
setMultipleFieldValues: T,
|
|
476
476
|
t: l,
|
|
477
477
|
validateForm: _,
|
|
478
|
-
visibleNodes:
|
|
478
|
+
visibleNodes: h,
|
|
479
479
|
visibleRootNodes: p
|
|
480
480
|
};
|
|
481
481
|
}, Wt = ({ children: e, onSubmit: r }) => /* @__PURE__ */ t.jsx("form", { onSubmit: r, className: "mx-auto max-w-2xl gap-y-3", children: e }), Kt = ({ node: e, children: r }) => {
|
|
482
482
|
const n = q();
|
|
483
483
|
return /* @__PURE__ */ t.jsxs("section", { className: "mb-6 rounded-lg border p-4", children: [
|
|
484
|
-
e.data.label && /* @__PURE__ */ t.jsx("h3", { className: "
|
|
484
|
+
e.data.label && /* @__PURE__ */ t.jsx("h3", { className: "mb-4 font-semibold text-lg", children: n(e.data.label) }),
|
|
485
485
|
r
|
|
486
486
|
] });
|
|
487
487
|
}, Jt = async (e, r) => {
|
|
@@ -523,9 +523,9 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
523
523
|
);
|
|
524
524
|
});
|
|
525
525
|
}), Xt = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i, helperText: a, id: l, name: c }) => {
|
|
526
|
-
const [m, u] = B(""), [d, f] = B([]), [
|
|
527
|
-
(
|
|
528
|
-
n(
|
|
526
|
+
const [m, u] = B(""), [d, f] = B([]), [g, h] = B(!1), { googleApiKey: p, language: j } = he(), T = q(), _ = Q(
|
|
527
|
+
(w) => {
|
|
528
|
+
n(w.value), u(w.value), h(!1);
|
|
529
529
|
},
|
|
530
530
|
[n]
|
|
531
531
|
);
|
|
@@ -534,22 +534,22 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
534
534
|
f([]);
|
|
535
535
|
return;
|
|
536
536
|
}
|
|
537
|
-
const
|
|
538
|
-
const x = p ? await Qt(m) : await Jt(m,
|
|
537
|
+
const w = setTimeout(async () => {
|
|
538
|
+
const x = p ? await Qt(m) : await Jt(m, j);
|
|
539
539
|
f(x);
|
|
540
540
|
}, 300);
|
|
541
|
-
return () => clearTimeout(
|
|
542
|
-
}, [m, p,
|
|
543
|
-
const
|
|
544
|
-
(
|
|
545
|
-
n(
|
|
541
|
+
return () => clearTimeout(w);
|
|
542
|
+
}, [m, p, j]);
|
|
543
|
+
const R = Q(
|
|
544
|
+
(w) => {
|
|
545
|
+
n(w), u(w), w.length >= 3 && h(!0);
|
|
546
546
|
},
|
|
547
547
|
[n]
|
|
548
548
|
);
|
|
549
549
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
550
550
|
p && /* @__PURE__ */ t.jsx("script", { async: !0, src: `https://maps.googleapis.com/maps/api/js?key=${p}&libraries=places` }),
|
|
551
551
|
/* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
552
|
-
/* @__PURE__ */ t.jsxs(
|
|
552
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: l, children: [
|
|
553
553
|
o || e.data.name,
|
|
554
554
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
555
555
|
] }),
|
|
@@ -561,27 +561,27 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
561
561
|
id: l,
|
|
562
562
|
name: c,
|
|
563
563
|
value: r || "",
|
|
564
|
-
onChange: (
|
|
564
|
+
onChange: (w) => R(w.target.value),
|
|
565
565
|
onFocus: () => {
|
|
566
|
-
d.length > 0 &&
|
|
566
|
+
d.length > 0 && h(!0);
|
|
567
567
|
},
|
|
568
|
-
placeholder: i ||
|
|
568
|
+
placeholder: i || T("renderer.defaultAddressInput.enterAddress"),
|
|
569
569
|
className: "pr-10",
|
|
570
570
|
autoComplete: "off"
|
|
571
571
|
}
|
|
572
572
|
),
|
|
573
573
|
/* @__PURE__ */ t.jsx(Be, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 right-3 h-4 w-4 text-muted-foreground" }),
|
|
574
|
-
|
|
575
|
-
/* @__PURE__ */ t.jsx(
|
|
576
|
-
/* @__PURE__ */ t.jsx(
|
|
574
|
+
g && /* @__PURE__ */ t.jsx("div", { className: "absolute z-50 mt-1 w-full rounded-md border bg-popover shadow-md", children: /* @__PURE__ */ t.jsx(De, { children: /* @__PURE__ */ t.jsxs(Re, { children: [
|
|
575
|
+
/* @__PURE__ */ t.jsx(ke, { children: T("renderer.defaultAddressInput.noAddressesFound") }),
|
|
576
|
+
/* @__PURE__ */ t.jsx(Ae, { children: d.map((w, x) => /* @__PURE__ */ t.jsxs(
|
|
577
577
|
Ee,
|
|
578
578
|
{
|
|
579
|
-
value:
|
|
580
|
-
onSelect: () => _(
|
|
579
|
+
value: w.value,
|
|
580
|
+
onSelect: () => _(w),
|
|
581
581
|
onMouseDown: (b) => b.preventDefault(),
|
|
582
582
|
children: [
|
|
583
583
|
/* @__PURE__ */ t.jsx(Be, { className: "mr-2 h-4 w-4" }),
|
|
584
|
-
|
|
584
|
+
w.label
|
|
585
585
|
]
|
|
586
586
|
},
|
|
587
587
|
x
|
|
@@ -602,9 +602,9 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
602
602
|
helperText: a,
|
|
603
603
|
id: l
|
|
604
604
|
}) => {
|
|
605
|
-
const c = q(), [m, u] = B(!1), d = `${l}-trigger`, f = `${l}-error`,
|
|
605
|
+
const c = q(), [m, u] = B(!1), d = `${l}-trigger`, f = `${l}-error`, g = e.data.options || [], h = g.find((p) => p.value === r);
|
|
606
606
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
607
|
-
/* @__PURE__ */ t.jsxs(
|
|
607
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: d, children: [
|
|
608
608
|
o || e.data.name,
|
|
609
609
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
610
610
|
] }),
|
|
@@ -620,25 +620,25 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
620
620
|
"aria-describedby": s ? f : void 0,
|
|
621
621
|
className: "w-full justify-between font-normal",
|
|
622
622
|
children: [
|
|
623
|
-
r ?
|
|
623
|
+
r ? h?.label ? c(h.label) : r : i || c("renderer.defaultAutocompleteInput.selectOption"),
|
|
624
624
|
/* @__PURE__ */ t.jsx(tt, { className: "ml-2 size-4 shrink-0 opacity-50" })
|
|
625
625
|
]
|
|
626
626
|
}
|
|
627
627
|
) }),
|
|
628
|
-
/* @__PURE__ */ t.jsx(pe, { className: "w-full p-0", align: "start", children: /* @__PURE__ */ t.jsxs(
|
|
628
|
+
/* @__PURE__ */ t.jsx(pe, { className: "w-full p-0", align: "start", children: /* @__PURE__ */ t.jsxs(De, { children: [
|
|
629
629
|
/* @__PURE__ */ t.jsx(Ge, { placeholder: i || c("renderer.defaultAutocompleteInput.search") }),
|
|
630
|
-
/* @__PURE__ */ t.jsxs(
|
|
631
|
-
/* @__PURE__ */ t.jsx(
|
|
632
|
-
/* @__PURE__ */ t.jsx(
|
|
630
|
+
/* @__PURE__ */ t.jsxs(Re, { children: [
|
|
631
|
+
/* @__PURE__ */ t.jsx(ke, { children: c("renderer.defaultAutocompleteInput.noResults") }),
|
|
632
|
+
/* @__PURE__ */ t.jsx(Ae, { children: g.map((p) => /* @__PURE__ */ t.jsxs(
|
|
633
633
|
Ee,
|
|
634
634
|
{
|
|
635
635
|
value: p.value,
|
|
636
636
|
disabled: p.disabled,
|
|
637
|
-
onSelect: (
|
|
638
|
-
n(
|
|
637
|
+
onSelect: (j) => {
|
|
638
|
+
n(j === r ? "" : j), u(!1);
|
|
639
639
|
},
|
|
640
640
|
children: [
|
|
641
|
-
/* @__PURE__ */ t.jsx(st, { className:
|
|
641
|
+
/* @__PURE__ */ t.jsx(st, { className: y("mr-2 size-4", r === p.value ? "opacity-100" : "opacity-0") }),
|
|
642
642
|
c(p.label)
|
|
643
643
|
]
|
|
644
644
|
},
|
|
@@ -654,11 +654,11 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
654
654
|
const c = q();
|
|
655
655
|
if (e.data.options && e.data.options.length > 0) {
|
|
656
656
|
const m = Array.isArray(r) ? r.map(String) : [], u = (d, f) => {
|
|
657
|
-
const
|
|
658
|
-
n(
|
|
657
|
+
const g = f ? [...m, d] : m.filter((h) => h !== d);
|
|
658
|
+
n(g);
|
|
659
659
|
};
|
|
660
660
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
661
|
-
/* @__PURE__ */ t.jsxs(
|
|
661
|
+
/* @__PURE__ */ t.jsxs(D, { className: "mb-1", children: [
|
|
662
662
|
o || e.data.name,
|
|
663
663
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
664
664
|
] }),
|
|
@@ -669,11 +669,11 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
669
669
|
id: `${a}-${d.value}`,
|
|
670
670
|
name: l,
|
|
671
671
|
checked: m.includes(String(d.value)),
|
|
672
|
-
onCheckedChange: (
|
|
672
|
+
onCheckedChange: (g) => u(String(d.value), !!g),
|
|
673
673
|
disabled: d.disabled
|
|
674
674
|
}
|
|
675
675
|
),
|
|
676
|
-
/* @__PURE__ */ t.jsx(
|
|
676
|
+
/* @__PURE__ */ t.jsx(D, { htmlFor: `${a}-${d.value}`, className: "cursor-pointer font-normal text-sm", children: c(d.label) ? c(d.label) : d.value })
|
|
677
677
|
] }, d.value + f)) }),
|
|
678
678
|
s && /* @__PURE__ */ t.jsx(O, { children: s }),
|
|
679
679
|
i && !s && /* @__PURE__ */ t.jsx(P, { children: i })
|
|
@@ -691,7 +691,7 @@ const nt = Ze(void 0), at = () => et(nt), Ls = ({
|
|
|
691
691
|
}
|
|
692
692
|
),
|
|
693
693
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
694
|
-
/* @__PURE__ */ t.jsxs(
|
|
694
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: a, className: "cursor-pointer font-medium text-sm", children: [
|
|
695
695
|
o || e.data.name,
|
|
696
696
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
697
697
|
] }),
|
|
@@ -713,10 +713,10 @@ function dt({
|
|
|
713
713
|
}) {
|
|
714
714
|
const c = rt();
|
|
715
715
|
return /* @__PURE__ */ t.jsx(
|
|
716
|
-
|
|
716
|
+
kt,
|
|
717
717
|
{
|
|
718
718
|
showOutsideDays: n,
|
|
719
|
-
className:
|
|
719
|
+
className: y(
|
|
720
720
|
"group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
721
721
|
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
722
722
|
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
@@ -728,55 +728,55 @@ function dt({
|
|
|
728
728
|
...i
|
|
729
729
|
},
|
|
730
730
|
classNames: {
|
|
731
|
-
button_next:
|
|
731
|
+
button_next: y(
|
|
732
732
|
Me({ variant: o }),
|
|
733
733
|
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
734
734
|
c.button_next
|
|
735
735
|
),
|
|
736
|
-
button_previous:
|
|
736
|
+
button_previous: y(
|
|
737
737
|
Me({ variant: o }),
|
|
738
738
|
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
739
739
|
c.button_previous
|
|
740
740
|
),
|
|
741
|
-
caption_label:
|
|
741
|
+
caption_label: y(
|
|
742
742
|
"select-none font-medium",
|
|
743
743
|
s === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
|
|
744
744
|
c.caption_label
|
|
745
745
|
),
|
|
746
|
-
day:
|
|
746
|
+
day: y(
|
|
747
747
|
"relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
|
|
748
748
|
c.day
|
|
749
749
|
),
|
|
750
|
-
disabled:
|
|
751
|
-
dropdown:
|
|
752
|
-
dropdown_root:
|
|
750
|
+
disabled: y("text-muted-foreground opacity-50", c.disabled),
|
|
751
|
+
dropdown: y("absolute bg-popover inset-0 opacity-0", c.dropdown),
|
|
752
|
+
dropdown_root: y(
|
|
753
753
|
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
754
754
|
c.dropdown_root
|
|
755
755
|
),
|
|
756
|
-
dropdowns:
|
|
757
|
-
hidden:
|
|
758
|
-
month:
|
|
759
|
-
month_caption:
|
|
760
|
-
months:
|
|
761
|
-
nav:
|
|
762
|
-
outside:
|
|
763
|
-
range_end:
|
|
764
|
-
range_middle:
|
|
765
|
-
range_start:
|
|
766
|
-
root:
|
|
756
|
+
dropdowns: y("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5", c.dropdowns),
|
|
757
|
+
hidden: y("invisible", c.hidden),
|
|
758
|
+
month: y("flex flex-col w-full gap-4", c.month),
|
|
759
|
+
month_caption: y("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)", c.month_caption),
|
|
760
|
+
months: y("flex gap-4 flex-col md:flex-row relative", c.months),
|
|
761
|
+
nav: y("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between", c.nav),
|
|
762
|
+
outside: y("text-muted-foreground aria-selected:text-muted-foreground", c.outside),
|
|
763
|
+
range_end: y("rounded-r-md bg-accent", c.range_end),
|
|
764
|
+
range_middle: y("rounded-none", c.range_middle),
|
|
765
|
+
range_start: y("rounded-l-md bg-accent", c.range_start),
|
|
766
|
+
root: y("w-fit", c.root),
|
|
767
767
|
table: "w-full border-collapse",
|
|
768
|
-
today:
|
|
769
|
-
week:
|
|
770
|
-
week_number:
|
|
771
|
-
week_number_header:
|
|
772
|
-
weekday:
|
|
773
|
-
weekdays:
|
|
768
|
+
today: y("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none", c.today),
|
|
769
|
+
week: y("flex w-full mt-2", c.week),
|
|
770
|
+
week_number: y("text-[0.8rem] select-none text-muted-foreground", c.week_number),
|
|
771
|
+
week_number_header: y("select-none w-(--cell-size)", c.week_number_header),
|
|
772
|
+
weekday: y("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none", c.weekday),
|
|
773
|
+
weekdays: y("flex", c.weekdays),
|
|
774
774
|
...r
|
|
775
775
|
},
|
|
776
776
|
components: {
|
|
777
|
-
Chevron: ({ className: m, orientation: u, ...d }) => u === "left" ? /* @__PURE__ */ t.jsx(Tt, { className:
|
|
777
|
+
Chevron: ({ className: m, orientation: u, ...d }) => u === "left" ? /* @__PURE__ */ t.jsx(Tt, { className: y("size-4", m), ...d }) : u === "right" ? /* @__PURE__ */ t.jsx(Dt, { className: y("size-4", m), ...d }) : /* @__PURE__ */ t.jsx(Oe, { className: y("size-4", m), ...d }),
|
|
778
778
|
DayButton: es,
|
|
779
|
-
Root: ({ className: m, rootRef: u, ...d }) => /* @__PURE__ */ t.jsx("div", { "data-slot": "calendar", ref: u, className:
|
|
779
|
+
Root: ({ className: m, rootRef: u, ...d }) => /* @__PURE__ */ t.jsx("div", { "data-slot": "calendar", ref: u, className: y(m), ...d }),
|
|
780
780
|
WeekNumber: ({ children: m, ...u }) => /* @__PURE__ */ t.jsx("td", { ...u, children: /* @__PURE__ */ t.jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: m }) }),
|
|
781
781
|
...a
|
|
782
782
|
},
|
|
@@ -799,7 +799,7 @@ function es({ className: e, day: r, modifiers: n, ...s }) {
|
|
|
799
799
|
"data-range-start": n.range_start,
|
|
800
800
|
"data-range-end": n.range_end,
|
|
801
801
|
"data-range-middle": n.range_middle,
|
|
802
|
-
className:
|
|
802
|
+
className: y(
|
|
803
803
|
"flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-start=true]:rounded-l-md data-[range-end=true]:bg-primary data-[range-middle=true]:bg-accent data-[range-start=true]:bg-primary data-[selected-single=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:text-accent-foreground data-[range-start=true]:text-primary-foreground data-[selected-single=true]:text-primary-foreground group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70",
|
|
804
804
|
o.day,
|
|
805
805
|
e
|
|
@@ -809,9 +809,15 @@ function es({ className: e, day: r, modifiers: n, ...s }) {
|
|
|
809
809
|
);
|
|
810
810
|
}
|
|
811
811
|
const ts = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i, helperText: a, id: l, name: c }) => {
|
|
812
|
-
const [m, u] = B(!1), d = q(), f = r ? new Date(r) : void 0
|
|
812
|
+
const [m, u] = B(!1), d = q(), f = r ? new Date(r) : void 0, g = (h) => {
|
|
813
|
+
if (e.data.disablePast) {
|
|
814
|
+
const p = /* @__PURE__ */ new Date();
|
|
815
|
+
return p.setHours(0, 0, 0, 0), h < p;
|
|
816
|
+
}
|
|
817
|
+
return !1;
|
|
818
|
+
};
|
|
813
819
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
814
|
-
/* @__PURE__ */ t.jsxs(
|
|
820
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: l, children: [
|
|
815
821
|
o || e.data.name,
|
|
816
822
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
817
823
|
] }),
|
|
@@ -826,6 +832,7 @@ const ts = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i
|
|
|
826
832
|
mode: "single",
|
|
827
833
|
selected: f,
|
|
828
834
|
captionLayout: "dropdown",
|
|
835
|
+
disabled: g,
|
|
829
836
|
onSelect: (h) => {
|
|
830
837
|
n(h ? h.toISOString() : ""), u(!1);
|
|
831
838
|
}
|
|
@@ -836,17 +843,23 @@ const ts = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i
|
|
|
836
843
|
a && !s && /* @__PURE__ */ t.jsx(P, { children: a })
|
|
837
844
|
] });
|
|
838
845
|
}, ss = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i, id: a }) => {
|
|
839
|
-
const [l, c] = B(!1), m = q(), u = Array.isArray(r) ? r : [], d = u[0] ? new Date(u[0]) : void 0, f = u[1] ? new Date(u[1]) : void 0,
|
|
840
|
-
n([
|
|
841
|
-
},
|
|
846
|
+
const [l, c] = B(!1), m = q(), u = Array.isArray(r) ? r : [], d = u[0] ? new Date(u[0]) : void 0, f = u[1] ? new Date(u[1]) : void 0, g = (j) => {
|
|
847
|
+
n([j?.from ? j.from.toISOString() : void 0, j?.to ? j.to.toISOString() : void 0]);
|
|
848
|
+
}, h = () => d && f ? `${d.toLocaleDateString()} - ${f.toLocaleDateString()}` : d ? d.toLocaleDateString() : m("renderer.defaultInputs.selectDateRange"), p = (j) => {
|
|
849
|
+
if (e.data.disablePast) {
|
|
850
|
+
const T = /* @__PURE__ */ new Date();
|
|
851
|
+
return T.setHours(0, 0, 0, 0), j < T;
|
|
852
|
+
}
|
|
853
|
+
return !1;
|
|
854
|
+
};
|
|
842
855
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
843
|
-
/* @__PURE__ */ t.jsxs(
|
|
856
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: a, children: [
|
|
844
857
|
o || e.data.name,
|
|
845
858
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
846
859
|
] }),
|
|
847
860
|
/* @__PURE__ */ t.jsxs(me, { open: l, onOpenChange: c, children: [
|
|
848
861
|
/* @__PURE__ */ t.jsx(fe, { asChild: !0, children: /* @__PURE__ */ t.jsxs(le, { id: a, variant: "outline", className: "w-full justify-between font-normal", children: [
|
|
849
|
-
|
|
862
|
+
h(),
|
|
850
863
|
/* @__PURE__ */ t.jsx(Oe, { className: "size-4" })
|
|
851
864
|
] }) }),
|
|
852
865
|
/* @__PURE__ */ t.jsx(pe, { className: "w-auto overflow-hidden p-0", align: "start", children: /* @__PURE__ */ t.jsx(
|
|
@@ -855,7 +868,8 @@ const ts = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i
|
|
|
855
868
|
mode: "range",
|
|
856
869
|
selected: { from: d, to: f },
|
|
857
870
|
captionLayout: "dropdown",
|
|
858
|
-
|
|
871
|
+
disabled: p,
|
|
872
|
+
onSelect: g,
|
|
859
873
|
numberOfMonths: 2
|
|
860
874
|
}
|
|
861
875
|
) })
|
|
@@ -877,7 +891,7 @@ const ts = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i
|
|
|
877
891
|
}, s.onerror = () => {
|
|
878
892
|
n(new Error(`Failed to read file: ${e.name}`));
|
|
879
893
|
}, s.readAsDataURL(e);
|
|
880
|
-
}),
|
|
894
|
+
}), Hs = (e) => {
|
|
881
895
|
const r = e.data.split(",")[1], n = atob(r), s = new ArrayBuffer(n.length), o = new Uint8Array(s);
|
|
882
896
|
for (let a = 0; a < n.length; a++)
|
|
883
897
|
o[a] = n.charCodeAt(a);
|
|
@@ -902,7 +916,7 @@ const ts = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i
|
|
|
902
916
|
r(d);
|
|
903
917
|
};
|
|
904
918
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
905
|
-
/* @__PURE__ */ t.jsxs(
|
|
919
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: l, children: [
|
|
906
920
|
s || e.data.name,
|
|
907
921
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
908
922
|
] }),
|
|
@@ -926,19 +940,19 @@ function pt({ className: e, sideOffset: r = 0, children: n, ...s }) {
|
|
|
926
940
|
{
|
|
927
941
|
"data-slot": "tooltip-content",
|
|
928
942
|
sideOffset: r,
|
|
929
|
-
className:
|
|
930
|
-
"
|
|
943
|
+
className: y(
|
|
944
|
+
"fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[state=closed]:animate-out",
|
|
931
945
|
e
|
|
932
946
|
),
|
|
933
947
|
...s,
|
|
934
948
|
children: [
|
|
935
949
|
n,
|
|
936
|
-
/* @__PURE__ */ t.jsx(ae.Arrow, { className: "
|
|
950
|
+
/* @__PURE__ */ t.jsx(ae.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })
|
|
937
951
|
]
|
|
938
952
|
}
|
|
939
953
|
) });
|
|
940
954
|
}
|
|
941
|
-
const
|
|
955
|
+
const ve = (e, r) => r ? r.split(".").reduce((s, o) => {
|
|
942
956
|
if (s == null)
|
|
943
957
|
return;
|
|
944
958
|
const i = o.match(/^(\w+)\[(\d+)]$/);
|
|
@@ -957,7 +971,7 @@ const we = (e, r) => r ? r.split(".").reduce((s, o) => {
|
|
|
957
971
|
const i = String(r[o] || "");
|
|
958
972
|
return n ? encodeURIComponent(i) : i;
|
|
959
973
|
}), os = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i, helperText: a, id: l, name: c }) => {
|
|
960
|
-
const [m, u] = B(!1), [d, f] = B(null), [
|
|
974
|
+
const [m, u] = B(!1), [d, f] = B(null), [g, h] = B([]), [p, j] = B(""), [T, _] = B(!1), { formValues: R, inputNodes: w } = he(), x = q(), { httpConfig: b } = e.data, v = K(!1), F = K(""), $ = K(b), L = K(R), ee = K(w), Y = K(n), ce = K(null), te = G(() => b?.url ? Te(b.url) : [], [b?.url]), se = te.length > 0, oe = G(() => te.map((C) => `${C}:${String(R[C] ?? "")}`).join("|"), [te, R]), ie = G(() => b?.url ? se ? Se(b.url, R) : !0 : !1, [b?.url, se, R]), U = Q(
|
|
961
975
|
async (C) => {
|
|
962
976
|
const I = $.current, z = L.current, N = Y.current;
|
|
963
977
|
if (!I?.url) {
|
|
@@ -967,15 +981,15 @@ const we = (e, r) => r ? r.split(".").reduce((s, o) => {
|
|
|
967
981
|
if (!(I.url && !Se(I.url, z))) {
|
|
968
982
|
u(!0), f(null);
|
|
969
983
|
try {
|
|
970
|
-
const V = Fe(I.url, z, !0),
|
|
984
|
+
const V = Fe(I.url, z, !0), k = I.searchParam && C ? `${V}${V.includes("?") ? "&" : "?"}${I.searchParam}=${encodeURIComponent(C)}` : V, A = {};
|
|
971
985
|
I.headers?.forEach((re) => {
|
|
972
|
-
|
|
986
|
+
A[re.key] = Fe(re.value, z);
|
|
973
987
|
});
|
|
974
|
-
const S = ["POST", "PUT", "PATCH"].includes(I.method || "") ? I.sendFormData ? JSON.stringify($e(z, ee.current)) : I.body ? Fe(I.body, z) : void 0 : void 0, M = await fetch(
|
|
988
|
+
const S = ["POST", "PUT", "PATCH"].includes(I.method || "") ? I.sendFormData ? JSON.stringify($e(z, ee.current)) : I.body ? Fe(I.body, z) : void 0 : void 0, M = await fetch(k, {
|
|
975
989
|
body: S || void 0,
|
|
976
990
|
headers: {
|
|
977
991
|
"Content-Type": "application/json",
|
|
978
|
-
...
|
|
992
|
+
...A
|
|
979
993
|
},
|
|
980
994
|
method: I.method || "GET"
|
|
981
995
|
});
|
|
@@ -983,18 +997,18 @@ const we = (e, r) => r ? r.split(".").reduce((s, o) => {
|
|
|
983
997
|
f(`HTTP ${M.status}: ${M.statusText}`), u(!1);
|
|
984
998
|
return;
|
|
985
999
|
}
|
|
986
|
-
const
|
|
1000
|
+
const H = await M.json(), Z = I.responsePath ? ve(H, I.responsePath) : H;
|
|
987
1001
|
if (I.responseMapping && Array.isArray(Z)) {
|
|
988
1002
|
const { valueField: re = "value", labelField: ge = "label" } = I.responseMapping, xe = Z.map((de) => ({
|
|
989
|
-
label: String(
|
|
990
|
-
value: String(
|
|
1003
|
+
label: String(ve(de, ge) || ""),
|
|
1004
|
+
value: String(ve(de, re) || "")
|
|
991
1005
|
}));
|
|
992
|
-
|
|
1006
|
+
h(xe);
|
|
993
1007
|
} else
|
|
994
1008
|
N(typeof Z == "string" ? Z : JSON.stringify(Z));
|
|
995
1009
|
} catch (V) {
|
|
996
|
-
const
|
|
997
|
-
f(
|
|
1010
|
+
const k = V instanceof Error ? V.message : x("renderer.defaultHttpInput.fetchFailed");
|
|
1011
|
+
f(k), console.error("HTTP Input fetch error:", V);
|
|
998
1012
|
} finally {
|
|
999
1013
|
u(!1);
|
|
1000
1014
|
}
|
|
@@ -1003,79 +1017,79 @@ const we = (e, r) => r ? r.split(".").reduce((s, o) => {
|
|
|
1003
1017
|
[x]
|
|
1004
1018
|
);
|
|
1005
1019
|
if (J(() => {
|
|
1006
|
-
$.current = b, L.current =
|
|
1007
|
-
}, [b,
|
|
1008
|
-
if (
|
|
1020
|
+
$.current = b, L.current = R, ee.current = w, Y.current = n, ce.current = U;
|
|
1021
|
+
}, [b, R, w, n, U]), J(() => {
|
|
1022
|
+
if (v.current)
|
|
1009
1023
|
return;
|
|
1010
|
-
|
|
1024
|
+
v.current = !0;
|
|
1011
1025
|
const C = $.current, I = L.current, z = ce.current, N = C?.url && Se(C.url, I);
|
|
1012
1026
|
if (C?.fetchOnMount && N && z && (z(), C.url)) {
|
|
1013
1027
|
const V = Te(C.url);
|
|
1014
|
-
F.current = V.map((
|
|
1028
|
+
F.current = V.map((k) => `${k}:${String(I[k] ?? "")}`).join("|");
|
|
1015
1029
|
}
|
|
1016
1030
|
}, []), J(() => {
|
|
1017
|
-
if (!
|
|
1031
|
+
if (!v.current || !se || F.current === oe || !ie)
|
|
1018
1032
|
return;
|
|
1019
1033
|
const C = setTimeout(() => {
|
|
1020
|
-
|
|
1034
|
+
U(), F.current = oe;
|
|
1021
1035
|
}, 500);
|
|
1022
1036
|
return () => clearTimeout(C);
|
|
1023
|
-
}, [oe, se, ie,
|
|
1037
|
+
}, [oe, se, ie, U]), J(() => {
|
|
1024
1038
|
if (!(b?.searchParam && p))
|
|
1025
1039
|
return;
|
|
1026
1040
|
const C = setTimeout(() => {
|
|
1027
|
-
|
|
1041
|
+
U(p);
|
|
1028
1042
|
}, 300);
|
|
1029
1043
|
return () => clearTimeout(C);
|
|
1030
|
-
}, [p, b?.searchParam,
|
|
1031
|
-
const C = Array.isArray(r) ? r[0] : r, I =
|
|
1044
|
+
}, [p, b?.searchParam, U]), b?.responseMapping) {
|
|
1045
|
+
const C = Array.isArray(r) ? r[0] : r, I = g.find((S) => S.value === C);
|
|
1032
1046
|
if (b.searchParam) {
|
|
1033
1047
|
const M = m && b?.showLoading ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1034
1048
|
/* @__PURE__ */ t.jsx(ye, { className: "h-4 w-4 animate-spin" }),
|
|
1035
1049
|
/* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: I?.label || i || x("renderer.defaultHttpInput.search") })
|
|
1036
1050
|
] }) : I?.label || i || x("renderer.defaultHttpInput.search");
|
|
1037
1051
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1038
|
-
/* @__PURE__ */ t.jsxs(
|
|
1052
|
+
/* @__PURE__ */ t.jsxs(D, { children: [
|
|
1039
1053
|
o || e.data.name,
|
|
1040
1054
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1041
1055
|
] }),
|
|
1042
|
-
/* @__PURE__ */ t.jsxs(me, { open:
|
|
1043
|
-
/* @__PURE__ */ t.jsx(fe, { asChild: !0, children: /* @__PURE__ */ t.jsxs(le, { variant: "outline", role: "combobox", "aria-expanded":
|
|
1056
|
+
/* @__PURE__ */ t.jsxs(me, { open: T, onOpenChange: _, children: [
|
|
1057
|
+
/* @__PURE__ */ t.jsx(fe, { asChild: !0, children: /* @__PURE__ */ t.jsxs(le, { variant: "outline", role: "combobox", "aria-expanded": T, className: "w-full justify-between", children: [
|
|
1044
1058
|
M,
|
|
1045
1059
|
/* @__PURE__ */ t.jsx(tt, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
1046
1060
|
] }) }),
|
|
1047
|
-
/* @__PURE__ */ t.jsx(pe, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ t.jsxs(
|
|
1061
|
+
/* @__PURE__ */ t.jsx(pe, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ t.jsxs(De, { shouldFilter: !1, children: [
|
|
1048
1062
|
/* @__PURE__ */ t.jsx(
|
|
1049
1063
|
Ge,
|
|
1050
1064
|
{
|
|
1051
1065
|
placeholder: x("renderer.defaultHttpInput.search"),
|
|
1052
1066
|
value: p,
|
|
1053
|
-
onValueChange: (
|
|
1054
|
-
|
|
1067
|
+
onValueChange: (H) => {
|
|
1068
|
+
j(H), f(null);
|
|
1055
1069
|
}
|
|
1056
1070
|
}
|
|
1057
1071
|
),
|
|
1058
|
-
/* @__PURE__ */ t.jsxs(
|
|
1072
|
+
/* @__PURE__ */ t.jsxs(Re, { children: [
|
|
1059
1073
|
m && /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ t.jsx(ye, { className: "h-4 w-4 animate-spin" }) }),
|
|
1060
1074
|
!m && d && /* @__PURE__ */ t.jsxs("div", { className: "p-4 text-destructive text-sm", children: [
|
|
1061
1075
|
/* @__PURE__ */ t.jsx("div", { children: d }),
|
|
1062
|
-
/* @__PURE__ */ t.jsx("button", { type: "button", onClick: () =>
|
|
1076
|
+
/* @__PURE__ */ t.jsx("button", { type: "button", onClick: () => U(p), className: "mt-2 block text-primary hover:underline", children: x("renderer.defaultHttpInput.retry") })
|
|
1063
1077
|
] }),
|
|
1064
1078
|
!(m || d) && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1065
|
-
/* @__PURE__ */ t.jsx(
|
|
1066
|
-
/* @__PURE__ */ t.jsx(
|
|
1079
|
+
/* @__PURE__ */ t.jsx(ke, { children: x("renderer.defaultHttpInput.noResults") }),
|
|
1080
|
+
/* @__PURE__ */ t.jsx(Ae, { children: g.map((H) => /* @__PURE__ */ t.jsxs(
|
|
1067
1081
|
Ee,
|
|
1068
1082
|
{
|
|
1069
|
-
value:
|
|
1083
|
+
value: H.value,
|
|
1070
1084
|
onSelect: () => {
|
|
1071
|
-
n(
|
|
1085
|
+
n(H.value), _(!1);
|
|
1072
1086
|
},
|
|
1073
1087
|
children: [
|
|
1074
|
-
/* @__PURE__ */ t.jsx(st, { className:
|
|
1075
|
-
|
|
1088
|
+
/* @__PURE__ */ t.jsx(st, { className: y("mr-2 h-4 w-4", r === H.value ? "opacity-100" : "opacity-0") }),
|
|
1089
|
+
H.label
|
|
1076
1090
|
]
|
|
1077
1091
|
},
|
|
1078
|
-
|
|
1092
|
+
H.value
|
|
1079
1093
|
)) })
|
|
1080
1094
|
] })
|
|
1081
1095
|
] })
|
|
@@ -1086,39 +1100,39 @@ const we = (e, r) => r ? r.split(".").reduce((s, o) => {
|
|
|
1086
1100
|
] });
|
|
1087
1101
|
}
|
|
1088
1102
|
const z = m && b?.showLoading, N = te.filter((S) => {
|
|
1089
|
-
const M =
|
|
1103
|
+
const M = R[S];
|
|
1090
1104
|
return M == null || M === "";
|
|
1091
|
-
}), V = N.map((S) => Pt(S,
|
|
1105
|
+
}), V = N.map((S) => Pt(S, w) || S), k = g.length === 0 && !z ? N.length > 0 ? `${x("renderer.defaultHttpInput.waitingForRequiredFields")}: ${V.join(", ")}` : x("renderer.defaultHttpInput.noDataAvailable") : void 0, A = /* @__PURE__ */ t.jsxs(
|
|
1092
1106
|
We,
|
|
1093
1107
|
{
|
|
1094
1108
|
value: Array.isArray(r) ? r[0] ?? "" : r ?? "",
|
|
1095
1109
|
onValueChange: (S) => n(S),
|
|
1096
|
-
disabled: z ||
|
|
1110
|
+
disabled: z || g.length === 0,
|
|
1097
1111
|
name: c,
|
|
1098
1112
|
children: [
|
|
1099
1113
|
/* @__PURE__ */ t.jsxs(Ke, { id: l, name: c, className: "w-full", children: [
|
|
1100
1114
|
z && /* @__PURE__ */ t.jsx(ye, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1101
1115
|
/* @__PURE__ */ t.jsx(Je, { placeholder: i || x("renderer.defaultHttpInput.selectOption") })
|
|
1102
1116
|
] }),
|
|
1103
|
-
/* @__PURE__ */ t.jsx(Qe, { children: /* @__PURE__ */ t.jsx(Xe, { children:
|
|
1117
|
+
/* @__PURE__ */ t.jsx(Qe, { children: /* @__PURE__ */ t.jsx(Xe, { children: g.map((S, M) => /* @__PURE__ */ t.jsx(Ye, { value: S.value, children: S.label }, S.value + M)) }) })
|
|
1104
1118
|
]
|
|
1105
1119
|
}
|
|
1106
1120
|
);
|
|
1107
1121
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1108
|
-
/* @__PURE__ */ t.jsxs(
|
|
1122
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: l, children: [
|
|
1109
1123
|
o || e.data.name,
|
|
1110
1124
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1111
1125
|
] }),
|
|
1112
|
-
|
|
1113
|
-
/* @__PURE__ */ t.jsx(ft, { asChild: !0, children: /* @__PURE__ */ t.jsx("div", { className: "w-full", children:
|
|
1114
|
-
/* @__PURE__ */ t.jsx(pt, { children: /* @__PURE__ */ t.jsx("p", { children:
|
|
1115
|
-
] }) }) :
|
|
1126
|
+
k ? /* @__PURE__ */ t.jsx(_e, { children: /* @__PURE__ */ t.jsxs(mt, { children: [
|
|
1127
|
+
/* @__PURE__ */ t.jsx(ft, { asChild: !0, children: /* @__PURE__ */ t.jsx("div", { className: "w-full", children: A }) }),
|
|
1128
|
+
/* @__PURE__ */ t.jsx(pt, { children: /* @__PURE__ */ t.jsx("p", { children: k }) })
|
|
1129
|
+
] }) }) : A,
|
|
1116
1130
|
s && /* @__PURE__ */ t.jsx(O, { children: s }),
|
|
1117
1131
|
a && !s && /* @__PURE__ */ t.jsx(P, { children: a })
|
|
1118
1132
|
] });
|
|
1119
1133
|
}
|
|
1120
1134
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1121
|
-
/* @__PURE__ */ t.jsxs(
|
|
1135
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: l, children: [
|
|
1122
1136
|
o || e.data.name,
|
|
1123
1137
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1124
1138
|
] }),
|
|
@@ -1127,7 +1141,7 @@ const we = (e, r) => r ? r.split(".").reduce((s, o) => {
|
|
|
1127
1141
|
a && !s && /* @__PURE__ */ t.jsx(P, { children: a })
|
|
1128
1142
|
] });
|
|
1129
1143
|
}, is = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i, helperText: a, name: l, id: c }) => /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1130
|
-
/* @__PURE__ */ t.jsxs(
|
|
1144
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: c, children: [
|
|
1131
1145
|
o || e.data.name,
|
|
1132
1146
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1133
1147
|
] }),
|
|
@@ -1145,7 +1159,7 @@ const we = (e, r) => r ? r.split(".").reduce((s, o) => {
|
|
|
1145
1159
|
s && /* @__PURE__ */ t.jsx(O, { children: s }),
|
|
1146
1160
|
a && !s && /* @__PURE__ */ t.jsx(P, { children: a })
|
|
1147
1161
|
] }), ls = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i, helperText: a, name: l, id: c }) => /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1148
|
-
/* @__PURE__ */ t.jsxs(
|
|
1162
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: c, children: [
|
|
1149
1163
|
o || e.data.name,
|
|
1150
1164
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1151
1165
|
] }),
|
|
@@ -1165,32 +1179,32 @@ const we = (e, r) => r ? r.split(".").reduce((s, o) => {
|
|
|
1165
1179
|
a && !s && /* @__PURE__ */ t.jsx(P, { children: a })
|
|
1166
1180
|
] });
|
|
1167
1181
|
function cs({ className: e, ...r }) {
|
|
1168
|
-
return /* @__PURE__ */ t.jsx(Ie.Root, { "data-slot": "radio-group", className:
|
|
1182
|
+
return /* @__PURE__ */ t.jsx(Ie.Root, { "data-slot": "radio-group", className: y("grid gap-3", e), ...r });
|
|
1169
1183
|
}
|
|
1170
1184
|
function ds({ className: e, ...r }) {
|
|
1171
1185
|
return /* @__PURE__ */ t.jsx(
|
|
1172
1186
|
Ie.Item,
|
|
1173
1187
|
{
|
|
1174
1188
|
"data-slot": "radio-group-item",
|
|
1175
|
-
className:
|
|
1176
|
-
"
|
|
1189
|
+
className: y(
|
|
1190
|
+
"aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
|
1177
1191
|
e
|
|
1178
1192
|
),
|
|
1179
1193
|
...r,
|
|
1180
|
-
children: /* @__PURE__ */ t.jsx(Ie.Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: /* @__PURE__ */ t.jsx(
|
|
1194
|
+
children: /* @__PURE__ */ t.jsx(Ie.Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: /* @__PURE__ */ t.jsx(Rt, { className: "-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 size-2 fill-primary" }) })
|
|
1181
1195
|
}
|
|
1182
1196
|
);
|
|
1183
1197
|
}
|
|
1184
1198
|
const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i, id: a, name: l }) => {
|
|
1185
1199
|
const c = q(), m = r ? String(r) : "";
|
|
1186
1200
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1187
|
-
/* @__PURE__ */ t.jsxs(
|
|
1201
|
+
/* @__PURE__ */ t.jsxs(D, { className: "mb-1", htmlFor: a, children: [
|
|
1188
1202
|
o || e.data.name,
|
|
1189
1203
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1190
1204
|
] }),
|
|
1191
1205
|
/* @__PURE__ */ t.jsx(cs, { value: m, onValueChange: (u) => n(u), id: a, name: l, children: e.data.options?.map((u, d) => /* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1192
1206
|
/* @__PURE__ */ t.jsx(ds, { value: String(u.value), id: `${a}-${u.value}`, disabled: u.disabled }),
|
|
1193
|
-
/* @__PURE__ */ t.jsx(
|
|
1207
|
+
/* @__PURE__ */ t.jsx(D, { htmlFor: `${a}-${u.value}`, className: "cursor-pointer font-normal text-sm", children: c(u.label) ? c(u.label) : u.value })
|
|
1194
1208
|
] }, u.value + d)) }),
|
|
1195
1209
|
s && /* @__PURE__ */ t.jsx(O, { children: s }),
|
|
1196
1210
|
i && !s && /* @__PURE__ */ t.jsx(P, { children: i })
|
|
@@ -1198,7 +1212,7 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1198
1212
|
}, ms = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i, helperText: a, name: l, id: c }) => {
|
|
1199
1213
|
const m = q(), u = r ? String(r) : "";
|
|
1200
1214
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1201
|
-
/* @__PURE__ */ t.jsxs(
|
|
1215
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: c, children: [
|
|
1202
1216
|
o || e.data.name,
|
|
1203
1217
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1204
1218
|
] }),
|
|
@@ -1247,20 +1261,20 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1247
1261
|
const s = at(), o = s?.components?.submitButton, i = s?.components?.submitButtonWrapper, a = o || ht, l = i || gt;
|
|
1248
1262
|
return /* @__PURE__ */ t.jsx(l, { missingFields: e, children: /* @__PURE__ */ t.jsx(a, { label: n, disabled: r }) });
|
|
1249
1263
|
}, ps = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i, name: a, id: l }) => /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1250
|
-
/* @__PURE__ */ t.jsxs(
|
|
1264
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: l, children: [
|
|
1251
1265
|
o || e.data.name,
|
|
1252
1266
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1253
1267
|
] }),
|
|
1254
|
-
/* @__PURE__ */ t.jsx(
|
|
1268
|
+
/* @__PURE__ */ t.jsx(wt, { id: l, name: a, checked: r, onCheckedChange: n }),
|
|
1255
1269
|
i && !s && /* @__PURE__ */ t.jsx(P, { children: i }),
|
|
1256
1270
|
s && /* @__PURE__ */ t.jsx(O, { children: s })
|
|
1257
1271
|
] }), hs = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i, helperText: a, name: l, id: c }) => /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1258
|
-
/* @__PURE__ */ t.jsxs(
|
|
1272
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: c, children: [
|
|
1259
1273
|
o || e.data.name,
|
|
1260
1274
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1261
1275
|
] }),
|
|
1262
1276
|
/* @__PURE__ */ t.jsx(
|
|
1263
|
-
|
|
1277
|
+
vt,
|
|
1264
1278
|
{
|
|
1265
1279
|
id: c,
|
|
1266
1280
|
name: l,
|
|
@@ -1274,7 +1288,7 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1274
1288
|
s && /* @__PURE__ */ t.jsx(O, { children: s }),
|
|
1275
1289
|
a && !s && /* @__PURE__ */ t.jsx(P, { children: a })
|
|
1276
1290
|
] }), gs = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i, helperText: a, name: l, id: c }) => /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1277
|
-
/* @__PURE__ */ t.jsxs(
|
|
1291
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: c, children: [
|
|
1278
1292
|
o || e.data.name,
|
|
1279
1293
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1280
1294
|
] }),
|
|
@@ -1282,7 +1296,7 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1282
1296
|
s && /* @__PURE__ */ t.jsx(O, { children: s }),
|
|
1283
1297
|
a && !s && /* @__PURE__ */ t.jsx(P, { children: a })
|
|
1284
1298
|
] }), xs = ({ node: e, value: r, setValue: n, error: s, label: o, placeholder: i, helperText: a, name: l, id: c }) => /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1285
|
-
/* @__PURE__ */ t.jsxs(
|
|
1299
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: c, children: [
|
|
1286
1300
|
o || e.data.name,
|
|
1287
1301
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1288
1302
|
] }),
|
|
@@ -1301,13 +1315,13 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1301
1315
|
s && /* @__PURE__ */ t.jsx(O, { children: s }),
|
|
1302
1316
|
a && !s && /* @__PURE__ */ t.jsx(P, { children: a })
|
|
1303
1317
|
] }), bs = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i, id: a, name: l }) => {
|
|
1304
|
-
const c = q(), m = Array.isArray(r) ? r : [], u = m[0] || "", d = m[1] || "", f = (
|
|
1305
|
-
n([
|
|
1306
|
-
},
|
|
1307
|
-
n([u,
|
|
1318
|
+
const c = q(), m = Array.isArray(r) ? r : [], u = m[0] || "", d = m[1] || "", f = (h) => {
|
|
1319
|
+
n([h, d]);
|
|
1320
|
+
}, g = (h) => {
|
|
1321
|
+
n([u, h]);
|
|
1308
1322
|
};
|
|
1309
1323
|
return /* @__PURE__ */ t.jsxs(E, { className: "mb-4", children: [
|
|
1310
|
-
/* @__PURE__ */ t.jsxs(
|
|
1324
|
+
/* @__PURE__ */ t.jsxs(D, { htmlFor: `${a}-start`, children: [
|
|
1311
1325
|
o || e.data.name,
|
|
1312
1326
|
e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
|
|
1313
1327
|
] }),
|
|
@@ -1322,7 +1336,7 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1322
1336
|
"aria-describedby": s ? `${e.id}-error` : void 0,
|
|
1323
1337
|
type: "time",
|
|
1324
1338
|
value: u,
|
|
1325
|
-
onChange: (
|
|
1339
|
+
onChange: (h) => f(h.target.value),
|
|
1326
1340
|
placeholder: c("renderer.defaultInputs.startTime"),
|
|
1327
1341
|
className: "flex-1 bg-background [color-scheme:light] dark:[color-scheme:dark]"
|
|
1328
1342
|
}
|
|
@@ -1337,7 +1351,7 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1337
1351
|
"aria-describedby": s ? `${e.id}-error` : void 0,
|
|
1338
1352
|
type: "time",
|
|
1339
1353
|
value: d,
|
|
1340
|
-
onChange: (
|
|
1354
|
+
onChange: (h) => g(h.target.value),
|
|
1341
1355
|
placeholder: c("renderer.defaultInputs.endTime"),
|
|
1342
1356
|
className: "flex-1 bg-background [color-scheme:light] dark:[color-scheme:dark]"
|
|
1343
1357
|
}
|
|
@@ -1374,11 +1388,11 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1374
1388
|
] }) : /* @__PURE__ */ t.jsx(je, { className: "my-8" });
|
|
1375
1389
|
}, Ns = ({ node: e }) => {
|
|
1376
1390
|
const { edges: r } = he(), n = q(), s = ot(e.id, r);
|
|
1377
|
-
return /* @__PURE__ */ t.jsx("h2", { className:
|
|
1378
|
-
},
|
|
1391
|
+
return /* @__PURE__ */ t.jsx("h2", { className: y("mb-5 font-bold text-2xl", !s && "mt-10"), children: n(e.data?.label) });
|
|
1392
|
+
}, ws = {
|
|
1379
1393
|
divider: ys,
|
|
1380
1394
|
title: Ns
|
|
1381
|
-
},
|
|
1395
|
+
}, vs = async (e) => {
|
|
1382
1396
|
try {
|
|
1383
1397
|
const { url: r, method: n = "GET", headers: s = [], body: o } = e;
|
|
1384
1398
|
if (!r || r.trim() === "")
|
|
@@ -1461,7 +1475,7 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1461
1475
|
const o = e.headers?.map((c) => ({
|
|
1462
1476
|
key: c.key,
|
|
1463
1477
|
value: Ce(c.value, r)
|
|
1464
|
-
})), i = e.sendFormData ? JSON.stringify($e(r, n)) : e.body ? Ce(e.body, r, { json: !0 }) : void 0, a = await
|
|
1478
|
+
})), i = e.sendFormData ? JSON.stringify($e(r, n)) : e.body ? Ce(e.body, r, { json: !0 }) : void 0, a = await vs({
|
|
1465
1479
|
body: i,
|
|
1466
1480
|
headers: o,
|
|
1467
1481
|
method: e.method || "POST",
|
|
@@ -1499,22 +1513,22 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1499
1513
|
return null;
|
|
1500
1514
|
l(null), f.showLoading !== !1 && i(!0);
|
|
1501
1515
|
try {
|
|
1502
|
-
const
|
|
1503
|
-
if (
|
|
1504
|
-
const
|
|
1505
|
-
if (
|
|
1506
|
-
const p =
|
|
1516
|
+
const g = await Cs(f, r, s);
|
|
1517
|
+
if (g.success) {
|
|
1518
|
+
const h = ne(f.successMessage, n);
|
|
1519
|
+
if (h && l({ message: h, type: "success" }), d && d(g.data), g.redirectUrl) {
|
|
1520
|
+
const p = g.redirectUrl;
|
|
1507
1521
|
setTimeout(() => Is(p), 1e3);
|
|
1508
1522
|
}
|
|
1509
1523
|
} else {
|
|
1510
|
-
const
|
|
1511
|
-
l({ message:
|
|
1524
|
+
const h = ne(f.errorMessage, n) || g.error || "An error occurred during submission";
|
|
1525
|
+
l({ message: h, type: "error" });
|
|
1512
1526
|
}
|
|
1513
|
-
return
|
|
1514
|
-
} catch (
|
|
1515
|
-
const
|
|
1516
|
-
return l({ message:
|
|
1517
|
-
error:
|
|
1527
|
+
return g;
|
|
1528
|
+
} catch (g) {
|
|
1529
|
+
const h = ne(f.errorMessage, n) || (g instanceof Error ? g.message : "An unexpected error occurred");
|
|
1530
|
+
return l({ message: h, type: "error" }), {
|
|
1531
|
+
error: h,
|
|
1518
1532
|
success: !1
|
|
1519
1533
|
};
|
|
1520
1534
|
} finally {
|
|
@@ -1533,7 +1547,7 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1533
1547
|
submitButtonNode: c,
|
|
1534
1548
|
submitMessage: a
|
|
1535
1549
|
};
|
|
1536
|
-
},
|
|
1550
|
+
}, Us = ({
|
|
1537
1551
|
components: e,
|
|
1538
1552
|
flows: r,
|
|
1539
1553
|
googleApiKey: n,
|
|
@@ -1560,45 +1574,45 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1560
1574
|
validationMode: m ?? u?.validationMode ?? "onSubmit"
|
|
1561
1575
|
}, {
|
|
1562
1576
|
canSubmit: f,
|
|
1563
|
-
mergedFlow:
|
|
1564
|
-
formErrors:
|
|
1577
|
+
mergedFlow: g,
|
|
1578
|
+
formErrors: h,
|
|
1565
1579
|
formValues: p,
|
|
1566
|
-
inputNodes:
|
|
1567
|
-
missingRequiredFields:
|
|
1580
|
+
inputNodes: j,
|
|
1581
|
+
missingRequiredFields: T,
|
|
1568
1582
|
prevFormValuesRef: _,
|
|
1569
|
-
visibleNodes:
|
|
1570
|
-
visibleRootNodes:
|
|
1583
|
+
visibleNodes: R,
|
|
1584
|
+
visibleRootNodes: w,
|
|
1571
1585
|
setFieldValue: x,
|
|
1572
1586
|
setMultipleFieldValues: b,
|
|
1573
|
-
validateForm:
|
|
1587
|
+
validateForm: v,
|
|
1574
1588
|
t: F
|
|
1575
1589
|
} = Gt(r, s, d.language), { handleSubmitWithConfig: $, hasSubmitConfig: L, isSubmitting: ee, submitMessage: Y, clearSubmitMessage: ce } = Ts(
|
|
1576
|
-
|
|
1590
|
+
R,
|
|
1577
1591
|
p,
|
|
1578
1592
|
d.language,
|
|
1579
|
-
|
|
1580
|
-
), te = d.components.form || Wt, se = d.components.submitButton || ht, oe = d.components.submitButtonWrapper || gt, ie = K(i),
|
|
1593
|
+
j
|
|
1594
|
+
), te = d.components.form || Wt, se = d.components.submitButton || ht, oe = d.components.submitButtonWrapper || gt, ie = K(i), U = K(c), C = G(() => $e(p, j), [p, j]), I = Q(
|
|
1581
1595
|
async (N) => {
|
|
1582
1596
|
N.preventDefault();
|
|
1583
|
-
const { isValid: V, errors:
|
|
1597
|
+
const { isValid: V, errors: k } = v(U.current);
|
|
1584
1598
|
if (!V) {
|
|
1585
|
-
const
|
|
1586
|
-
|
|
1599
|
+
const A = Object.keys(k)[0];
|
|
1600
|
+
A && document.getElementById(A)?.focus();
|
|
1587
1601
|
return;
|
|
1588
1602
|
}
|
|
1589
1603
|
if (L) {
|
|
1590
|
-
const
|
|
1604
|
+
const A = await $((S) => {
|
|
1591
1605
|
a && a(C, { httpResponse: S });
|
|
1592
1606
|
});
|
|
1593
|
-
if (
|
|
1607
|
+
if (A === null) {
|
|
1594
1608
|
a?.(C);
|
|
1595
1609
|
return;
|
|
1596
1610
|
}
|
|
1597
|
-
if (!
|
|
1611
|
+
if (!A.success)
|
|
1598
1612
|
return;
|
|
1599
1613
|
} else a && a(C);
|
|
1600
1614
|
},
|
|
1601
|
-
[
|
|
1615
|
+
[v, L, $, a, C]
|
|
1602
1616
|
), z = Q(
|
|
1603
1617
|
(N) => {
|
|
1604
1618
|
const { type: V } = N;
|
|
@@ -1606,9 +1620,9 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1606
1620
|
case ue.input: {
|
|
1607
1621
|
if (!W(N))
|
|
1608
1622
|
return null;
|
|
1609
|
-
const
|
|
1623
|
+
const k = N.data, A = k.type || "text", S = d.components.inputs?.[A], M = js[A], H = S || M, Z = N.id, re = p[Z], ge = h[Z], xe = (yt) => x(Z, yt), de = ne(k.label, d.language), xt = ne(k.placeholder, d.language), bt = ne(k.helperText, d.language), jt = Pe(N);
|
|
1610
1624
|
return /* @__PURE__ */ t.jsx(
|
|
1611
|
-
|
|
1625
|
+
H,
|
|
1612
1626
|
{
|
|
1613
1627
|
id: N.id,
|
|
1614
1628
|
node: N,
|
|
@@ -1619,7 +1633,7 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1619
1633
|
helperText: bt,
|
|
1620
1634
|
name: jt,
|
|
1621
1635
|
setValue: xe,
|
|
1622
|
-
missingRequiredFields:
|
|
1636
|
+
missingRequiredFields: T
|
|
1623
1637
|
},
|
|
1624
1638
|
N.id
|
|
1625
1639
|
);
|
|
@@ -1627,14 +1641,14 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1627
1641
|
case ue.group: {
|
|
1628
1642
|
if (!Ft(N))
|
|
1629
1643
|
return null;
|
|
1630
|
-
const
|
|
1631
|
-
return /* @__PURE__ */ t.jsx(
|
|
1644
|
+
const k = d.components.group || Kt, A = R.filter((S) => S.parentId === N.id);
|
|
1645
|
+
return /* @__PURE__ */ t.jsx(k, { node: N, children: A.map((S) => z(S)) }, N.id);
|
|
1632
1646
|
}
|
|
1633
1647
|
case ue.ui: {
|
|
1634
1648
|
if (!St(N))
|
|
1635
1649
|
return null;
|
|
1636
|
-
const
|
|
1637
|
-
return /* @__PURE__ */ t.jsx(
|
|
1650
|
+
const A = N.data.type || "title", S = d.components.ui?.[A], M = ws[A], H = S || M;
|
|
1651
|
+
return /* @__PURE__ */ t.jsx(H, { node: N }, N.id);
|
|
1638
1652
|
}
|
|
1639
1653
|
case ue.flow:
|
|
1640
1654
|
return null;
|
|
@@ -1642,35 +1656,35 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1642
1656
|
return console.warn("Unknown node type:", V), null;
|
|
1643
1657
|
}
|
|
1644
1658
|
},
|
|
1645
|
-
[d.components, d.language,
|
|
1659
|
+
[d.components, d.language, R, p, h, x, T]
|
|
1646
1660
|
);
|
|
1647
1661
|
return J(() => {
|
|
1648
1662
|
ie.current = i;
|
|
1649
1663
|
}, [i]), J(() => {
|
|
1650
|
-
|
|
1664
|
+
U.current = c;
|
|
1651
1665
|
}, [c]), J(() => {
|
|
1652
1666
|
ie.current?.(C);
|
|
1653
1667
|
}, [C]), J(() => {
|
|
1654
|
-
d.validationMode === "onChange" &&
|
|
1655
|
-
}, [d.validationMode,
|
|
1656
|
-
const N = _t(
|
|
1668
|
+
d.validationMode === "onChange" && v(U.current);
|
|
1669
|
+
}, [d.validationMode, v]), J(() => {
|
|
1670
|
+
const N = _t(j, p, _.current);
|
|
1657
1671
|
Object.keys(N).length > 0 && b(N), _.current = p;
|
|
1658
|
-
}, [p,
|
|
1659
|
-
|
|
1672
|
+
}, [p, j, b, _]), /* @__PURE__ */ t.jsx(Ct, { theme: d.theme, storageKey: "treege-renderer-theme", children: /* @__PURE__ */ t.jsxs(
|
|
1673
|
+
Ut,
|
|
1660
1674
|
{
|
|
1661
1675
|
value: {
|
|
1662
|
-
flows:
|
|
1663
|
-
formErrors:
|
|
1676
|
+
flows: g,
|
|
1677
|
+
formErrors: h,
|
|
1664
1678
|
formValues: p,
|
|
1665
1679
|
googleApiKey: d.googleApiKey,
|
|
1666
|
-
inputNodes:
|
|
1680
|
+
inputNodes: j,
|
|
1667
1681
|
language: d.language,
|
|
1668
1682
|
setFieldValue: x
|
|
1669
1683
|
},
|
|
1670
1684
|
children: [
|
|
1671
1685
|
/* @__PURE__ */ t.jsxs(te, { onSubmit: I, children: [
|
|
1672
|
-
|
|
1673
|
-
f && /* @__PURE__ */ t.jsx(oe, { missingFields:
|
|
1686
|
+
w.map((N) => z(N)),
|
|
1687
|
+
f && /* @__PURE__ */ t.jsx(oe, { missingFields: T, children: /* @__PURE__ */ t.jsx(se, { label: F("renderer.defaultSubmitButton.submit"), disabled: ee }) })
|
|
1674
1688
|
] }),
|
|
1675
1689
|
/* @__PURE__ */ t.jsx("p", { className: "py-2 text-muted-foreground text-xs", children: "Powered by Treege" }),
|
|
1676
1690
|
Y && /* @__PURE__ */ t.jsx(
|
|
@@ -1698,21 +1712,21 @@ const us = ({ node: e, value: r, setValue: n, error: s, label: o, helperText: i,
|
|
|
1698
1712
|
};
|
|
1699
1713
|
export {
|
|
1700
1714
|
ut as A,
|
|
1701
|
-
|
|
1715
|
+
Hs as B,
|
|
1702
1716
|
rs as C,
|
|
1703
1717
|
Kt as D,
|
|
1704
1718
|
ot as E,
|
|
1705
1719
|
zt as F,
|
|
1706
1720
|
qt as G,
|
|
1707
1721
|
lt as H,
|
|
1708
|
-
|
|
1722
|
+
we as I,
|
|
1709
1723
|
$t as J,
|
|
1710
1724
|
$e as K,
|
|
1711
1725
|
Le as L,
|
|
1712
1726
|
_t as M,
|
|
1713
1727
|
Ls as T,
|
|
1714
1728
|
Gt as a,
|
|
1715
|
-
|
|
1729
|
+
Us as b,
|
|
1716
1730
|
Xt as c,
|
|
1717
1731
|
Yt as d,
|
|
1718
1732
|
Zt as e,
|
|
@@ -1734,7 +1748,7 @@ export {
|
|
|
1734
1748
|
at as u,
|
|
1735
1749
|
ys as v,
|
|
1736
1750
|
Ns as w,
|
|
1737
|
-
|
|
1751
|
+
ws as x,
|
|
1738
1752
|
Ne as y,
|
|
1739
1753
|
Et as z
|
|
1740
1754
|
};
|