treege 3.0.0-beta.89 → 3.0.0-beta.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DefaultSubmitButton-BIjoDpUm.js → DefaultSubmitButton-NeSDqyzv.js} +120 -120
- package/dist/{ThemeContext-CiVygpDK.js → ThemeContext-CPsC8QIP.js} +87 -72
- package/dist/{editor-DH9ocYy4.js → editor-D3EmQ-8C.js} +235 -235
- package/dist/editor.js +2 -2
- package/dist/main.js +6 -6
- package/dist/{renderer-BIccXyWl.js → renderer-CNbSt_QW.js} +41 -41
- package/dist/renderer-native.js +801 -814
- package/dist/renderer.js +5 -5
- package/dist/{useRenderNode-D9gPe-xm.js → useRenderNode-CG466pNk.js} +123 -123
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as e, E as t, F as n, L as r, M as i, N as a, O as o, P as s, S as c, T as l,
|
|
1
|
+
import { D as e, E as t, F as n, L as r, M as i, N as a, O as o, P as s, S as c, T as l, V as u, _ as d, g as f, h as p, j as m, k as h, s as g, v as _, w as v, x as y, y as b } from "./ThemeContext-CPsC8QIP.js";
|
|
2
2
|
import * as x from "react";
|
|
3
3
|
import { createContext as S, forwardRef as C, useCallback as w, useContext as T, useEffect as E, useMemo as ee, useRef as D, useState as O } from "react";
|
|
4
4
|
import { Fragment as te, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
@@ -471,34 +471,34 @@ var st = async (e, t) => {
|
|
|
471
471
|
})));
|
|
472
472
|
});
|
|
473
473
|
}), lt = ({ field: e, extra: t }) => {
|
|
474
|
-
let [r, i] = O(""), [a, o] = O([]), [s, c] = O(!1), { id: l, name:
|
|
475
|
-
|
|
476
|
-
}, [
|
|
477
|
-
|
|
478
|
-
}, [
|
|
474
|
+
let [r, i] = O(""), [a, o] = O([]), [s, c] = O(!1), { id: l, name: d, value: f, placeholder: p } = e, { InputLabel: m, node: h, setValue: g, error: _, label: v, helperText: y } = t, { googleApiKey: b, language: x } = u(), S = n(), C = w((e) => {
|
|
475
|
+
g(e.value), i(e.value), c(!1);
|
|
476
|
+
}, [g]), T = w((e) => {
|
|
477
|
+
g(e), i(e), e.length >= 3 && c(!0);
|
|
478
|
+
}, [g]);
|
|
479
479
|
return E(() => {
|
|
480
480
|
if (!r || r.trim().length < 3) {
|
|
481
481
|
o([]);
|
|
482
482
|
return;
|
|
483
483
|
}
|
|
484
484
|
let e = setTimeout(async () => {
|
|
485
|
-
o(
|
|
485
|
+
o(b ? await ct(r) : await st(r, x));
|
|
486
486
|
}, 300);
|
|
487
487
|
return () => clearTimeout(e);
|
|
488
488
|
}, [
|
|
489
489
|
r,
|
|
490
|
-
|
|
490
|
+
b,
|
|
491
491
|
x
|
|
492
|
-
]), /* @__PURE__ */ A(te, { children: [
|
|
492
|
+
]), /* @__PURE__ */ A(te, { children: [b && /* @__PURE__ */ k("script", {
|
|
493
493
|
async: !0,
|
|
494
|
-
src: `https://maps.googleapis.com/maps/api/js?key=${
|
|
494
|
+
src: `https://maps.googleapis.com/maps/api/js?key=${b}&libraries=places`
|
|
495
495
|
}), /* @__PURE__ */ A(J, {
|
|
496
496
|
className: "tg:mb-4",
|
|
497
497
|
children: [
|
|
498
|
-
/* @__PURE__ */ k(
|
|
498
|
+
/* @__PURE__ */ k(m, {
|
|
499
499
|
htmlFor: l,
|
|
500
|
-
label:
|
|
501
|
-
required:
|
|
500
|
+
label: v,
|
|
501
|
+
required: h.data.required
|
|
502
502
|
}),
|
|
503
503
|
/* @__PURE__ */ A("div", {
|
|
504
504
|
className: "tg:relative",
|
|
@@ -506,14 +506,14 @@ var st = async (e, t) => {
|
|
|
506
506
|
/* @__PURE__ */ k(Z, {
|
|
507
507
|
type: "text",
|
|
508
508
|
id: l,
|
|
509
|
-
name:
|
|
510
|
-
"aria-label":
|
|
511
|
-
value:
|
|
509
|
+
name: d,
|
|
510
|
+
"aria-label": v || h.data.name,
|
|
511
|
+
value: f || "",
|
|
512
512
|
onChange: (e) => T(e.target.value),
|
|
513
513
|
onFocus: () => {
|
|
514
514
|
a.length > 0 && c(!0);
|
|
515
515
|
},
|
|
516
|
-
placeholder:
|
|
516
|
+
placeholder: p || S("renderer.defaultAddressInput.enterAddress"),
|
|
517
517
|
className: "tg:pr-10",
|
|
518
518
|
autoComplete: "off"
|
|
519
519
|
}),
|
|
@@ -529,8 +529,8 @@ var st = async (e, t) => {
|
|
|
529
529
|
})
|
|
530
530
|
]
|
|
531
531
|
}),
|
|
532
|
-
|
|
533
|
-
|
|
532
|
+
_ && /* @__PURE__ */ k(X, { children: _ }),
|
|
533
|
+
y && !_ && /* @__PURE__ */ k(Y, { children: y })
|
|
534
534
|
]
|
|
535
535
|
})] });
|
|
536
536
|
}, ut = ({ missing: e }) => /* @__PURE__ */ A(te, { children: [/* @__PURE__ */ k("p", {
|
|
@@ -628,33 +628,33 @@ var vt = ({ label: e, description: t, image: n }) => /* @__PURE__ */ A(te, { chi
|
|
|
628
628
|
error: null,
|
|
629
629
|
fetched: null,
|
|
630
630
|
isLoading: !1
|
|
631
|
-
}), { baseUrl: s, formValues: l, headers:
|
|
632
|
-
if (!(
|
|
631
|
+
}), { baseUrl: s, formValues: l, headers: d } = u(), f = e.data.optionsSource, p = e.data.options, g = ee(() => {
|
|
632
|
+
if (!(f?.url && f.mapping?.valueField && f.mapping?.labelField) || !Array.from(f.url.matchAll(yt), (e) => e[1]).every((e) => {
|
|
633
633
|
let t = l[e];
|
|
634
634
|
return t != null && t !== "";
|
|
635
635
|
})) return null;
|
|
636
|
-
let e =
|
|
636
|
+
let e = f.method ?? "GET", t = {
|
|
637
637
|
body: [
|
|
638
638
|
"POST",
|
|
639
639
|
"PUT",
|
|
640
640
|
"PATCH"
|
|
641
|
-
].includes(e) ?
|
|
642
|
-
headers:
|
|
643
|
-
mapping:
|
|
641
|
+
].includes(e) ? v(f.body, l, []) : void 0,
|
|
642
|
+
headers: h(i(d, l), i(f.headers, l)),
|
|
643
|
+
mapping: f.mapping,
|
|
644
644
|
method: e,
|
|
645
|
-
queryParams: i(
|
|
646
|
-
responsePath:
|
|
647
|
-
url: a(
|
|
645
|
+
queryParams: i(f.queryParams, l) ?? {},
|
|
646
|
+
responsePath: f.responsePath,
|
|
647
|
+
url: a(m(f.url, l, { encode: !0 }), s)
|
|
648
648
|
};
|
|
649
649
|
return JSON.stringify(t);
|
|
650
650
|
}, [
|
|
651
651
|
s,
|
|
652
|
-
|
|
652
|
+
f,
|
|
653
653
|
l,
|
|
654
|
-
|
|
654
|
+
d
|
|
655
655
|
]);
|
|
656
656
|
E(() => {
|
|
657
|
-
if (!
|
|
657
|
+
if (!g) {
|
|
658
658
|
r({
|
|
659
659
|
error: null,
|
|
660
660
|
fetched: null,
|
|
@@ -662,7 +662,7 @@ var vt = ({ label: e, description: t, image: n }) => /* @__PURE__ */ A(te, { chi
|
|
|
662
662
|
});
|
|
663
663
|
return;
|
|
664
664
|
}
|
|
665
|
-
let e = JSON.parse(
|
|
665
|
+
let e = JSON.parse(g), n = new AbortController();
|
|
666
666
|
return r((e) => ({
|
|
667
667
|
...e,
|
|
668
668
|
error: null,
|
|
@@ -692,19 +692,19 @@ var vt = ({ label: e, description: t, image: n }) => /* @__PURE__ */ A(te, { chi
|
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
694
|
})(), () => n.abort();
|
|
695
|
-
}, [
|
|
696
|
-
let
|
|
695
|
+
}, [g]);
|
|
696
|
+
let _ = e.data.normalizeOptionLabels !== !1, y = ee(() => n.fetched ? _ ? n.fetched.map((e) => ({
|
|
697
697
|
...e,
|
|
698
698
|
label: c(e.label)
|
|
699
|
-
})) : n.fetched :
|
|
699
|
+
})) : n.fetched : p ?? [], [
|
|
700
700
|
n.fetched,
|
|
701
|
-
|
|
702
|
-
|
|
701
|
+
p,
|
|
702
|
+
_
|
|
703
703
|
]);
|
|
704
704
|
return {
|
|
705
705
|
error: n.error,
|
|
706
706
|
isLoading: n.isLoading,
|
|
707
|
-
options:
|
|
707
|
+
options: y
|
|
708
708
|
};
|
|
709
709
|
}, xt = ({ field: e, extra: t }) => {
|
|
710
710
|
let [r, i] = O(!1), { id: a, value: o, placeholder: s } = e, { InputLabel: c, node: l, setValue: u, error: d, label: f, helperText: p, missingDependencies: m } = t, { options: h, isLoading: g, error: _ } = bt(l), v = n(), y = `${a}-trigger`, b = `${a}-error`, x = h.find((e) => e.value === o);
|
|
@@ -778,9 +778,9 @@ var vt = ({ label: e, description: t, image: n }) => /* @__PURE__ */ A(te, { chi
|
|
|
778
778
|
]
|
|
779
779
|
});
|
|
780
780
|
}, St = ({ field: e, extra: t }) => {
|
|
781
|
-
let { id: r, name: i, value: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label:
|
|
782
|
-
if (
|
|
783
|
-
let e = `${r}-label`, t = Array.isArray(a) ? a.map(String) : [], n =
|
|
781
|
+
let { id: r, name: i, value: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: d, helperText: f, renderOptionExtras: p, compactOptions: m, missingDependencies: h } = t, { options: g, isLoading: _, error: v } = bt(s), { optionsDisplayLimit: y } = u(), b = n();
|
|
782
|
+
if (g.length > 0 || s.data.optionsSource) {
|
|
783
|
+
let e = `${r}-label`, t = Array.isArray(a) ? a.map(String) : [], n = y ? g.slice(0, y) : g, u = g.length - n.length, x = (e, n) => {
|
|
784
784
|
c(n ? [...t, e] : t.filter((t) => t !== e));
|
|
785
785
|
};
|
|
786
786
|
return /* @__PURE__ */ A(J, {
|
|
@@ -789,23 +789,23 @@ var vt = ({ label: e, description: t, image: n }) => /* @__PURE__ */ A(te, { chi
|
|
|
789
789
|
/* @__PURE__ */ k(o, {
|
|
790
790
|
className: "tg:mb-1",
|
|
791
791
|
id: e,
|
|
792
|
-
label:
|
|
792
|
+
label: d,
|
|
793
793
|
required: s.data.required
|
|
794
794
|
}),
|
|
795
|
-
/* @__PURE__ */ k(ft, { missing:
|
|
796
|
-
|
|
795
|
+
/* @__PURE__ */ k(ft, { missing: h }),
|
|
796
|
+
_ && /* @__PURE__ */ A("div", {
|
|
797
797
|
className: "tg:flex tg:items-center tg:gap-2 tg:py-2 tg:text-muted-foreground tg:text-sm",
|
|
798
|
-
children: [/* @__PURE__ */ k(F, { className: "tg:h-4 tg:w-4 tg:animate-spin" }), /* @__PURE__ */ k("span", { children:
|
|
798
|
+
children: [/* @__PURE__ */ k(F, { className: "tg:h-4 tg:w-4 tg:animate-spin" }), /* @__PURE__ */ k("span", { children: b("renderer.defaultCheckboxInput.loadingOptions") })]
|
|
799
799
|
}),
|
|
800
800
|
/* @__PURE__ */ A("div", {
|
|
801
801
|
role: "group",
|
|
802
|
-
"aria-labelledby":
|
|
803
|
-
"aria-label":
|
|
802
|
+
"aria-labelledby": d ? e : void 0,
|
|
803
|
+
"aria-label": d ? void 0 : s.data.name,
|
|
804
804
|
className: "tg:min-w-0 tg:space-y-2",
|
|
805
805
|
children: [n.map((e, n) => {
|
|
806
|
-
let a =
|
|
806
|
+
let a = b(e.description);
|
|
807
807
|
return /* @__PURE__ */ A("div", {
|
|
808
|
-
className: K("tg:group/option tg:pointer-events-auto tg:relative tg:flex tg:items-start tg:gap-3",
|
|
808
|
+
className: K("tg:group/option tg:pointer-events-auto tg:relative tg:flex tg:items-start tg:gap-3", m && "tg:pr-22"),
|
|
809
809
|
children: [
|
|
810
810
|
/* @__PURE__ */ k(be, {
|
|
811
811
|
id: `${r}-${e.value}`,
|
|
@@ -821,30 +821,30 @@ var vt = ({ label: e, description: t, image: n }) => /* @__PURE__ */ A(te, { chi
|
|
|
821
821
|
className: "tg:h-8 tg:w-8 tg:shrink-0 tg:rounded tg:object-cover"
|
|
822
822
|
}),
|
|
823
823
|
/* @__PURE__ */ A("div", {
|
|
824
|
-
className: K("tg:flex tg:flex-col",
|
|
824
|
+
className: K("tg:flex tg:flex-col", m && "tg:min-w-0 tg:flex-1 tg:overflow-hidden"),
|
|
825
825
|
children: [/* @__PURE__ */ k(Q, {
|
|
826
826
|
htmlFor: `${r}-${e.value}`,
|
|
827
|
-
className: K("tg:cursor-pointer tg:font-normal tg:text-sm",
|
|
828
|
-
children:
|
|
827
|
+
className: K("tg:cursor-pointer tg:font-normal tg:text-sm", m && "tg:block tg:max-w-full tg:truncate"),
|
|
828
|
+
children: b(e.label) ? b(e.label) : e.value
|
|
829
829
|
}), a && /* @__PURE__ */ k("span", {
|
|
830
|
-
className: K("tg:text-muted-foreground tg:text-xs",
|
|
830
|
+
className: K("tg:text-muted-foreground tg:text-xs", m && "tg:block tg:max-w-full tg:truncate"),
|
|
831
831
|
children: a
|
|
832
832
|
})]
|
|
833
833
|
}),
|
|
834
|
-
|
|
834
|
+
p?.({
|
|
835
835
|
index: n,
|
|
836
836
|
option: e
|
|
837
837
|
})
|
|
838
838
|
]
|
|
839
839
|
}, e.value + n);
|
|
840
|
-
}),
|
|
840
|
+
}), u > 0 && /* @__PURE__ */ k("div", {
|
|
841
841
|
className: "tg:px-2 tg:text-muted-foreground tg:text-xs",
|
|
842
842
|
children: "…"
|
|
843
843
|
})]
|
|
844
844
|
}),
|
|
845
845
|
l && /* @__PURE__ */ k(X, { children: l }),
|
|
846
|
-
|
|
847
|
-
|
|
846
|
+
v && !l && /* @__PURE__ */ k(X, { children: v }),
|
|
847
|
+
f && !l && !v && /* @__PURE__ */ k(Y, { children: f })
|
|
848
848
|
]
|
|
849
849
|
});
|
|
850
850
|
}
|
|
@@ -855,15 +855,15 @@ var vt = ({ label: e, description: t, image: n }) => /* @__PURE__ */ A(te, { chi
|
|
|
855
855
|
children: [/* @__PURE__ */ k(be, {
|
|
856
856
|
id: r,
|
|
857
857
|
name: i,
|
|
858
|
-
"aria-label":
|
|
858
|
+
"aria-label": d || s.data.name,
|
|
859
859
|
checked: typeof a == "boolean" ? a : !1,
|
|
860
860
|
onCheckedChange: (e) => c(!!e)
|
|
861
861
|
}), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(o, {
|
|
862
862
|
htmlFor: r,
|
|
863
|
-
label:
|
|
863
|
+
label: d,
|
|
864
864
|
required: s.data.required,
|
|
865
865
|
className: "tg:cursor-pointer tg:font-medium tg:text-sm"
|
|
866
|
-
}),
|
|
866
|
+
}), f && !l && /* @__PURE__ */ k(Y, { children: f })] })]
|
|
867
867
|
}), l && /* @__PURE__ */ k(X, { children: l })]
|
|
868
868
|
});
|
|
869
869
|
};
|
|
@@ -1053,13 +1053,13 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1053
1053
|
]
|
|
1054
1054
|
});
|
|
1055
1055
|
}, Dt = ({ field: e, extra: t }) => {
|
|
1056
|
-
let { id: r, name: i, value: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label:
|
|
1056
|
+
let { id: r, name: i, value: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: u, helperText: m } = t, h = n(), g = D(null), v = b(a), y = s.data.multiple, x = async (e) => {
|
|
1057
1057
|
let { files: t } = e.target;
|
|
1058
1058
|
if (!(!t || t.length === 0)) {
|
|
1059
|
-
if (
|
|
1060
|
-
let e = await
|
|
1059
|
+
if (y) {
|
|
1060
|
+
let e = await f(Array.from(t));
|
|
1061
1061
|
c([...v, ...e]);
|
|
1062
|
-
} else c(await
|
|
1062
|
+
} else c(await p(t[0]));
|
|
1063
1063
|
e.target.value = "";
|
|
1064
1064
|
}
|
|
1065
1065
|
}, S = (e) => {
|
|
@@ -1071,7 +1071,7 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1071
1071
|
children: [
|
|
1072
1072
|
/* @__PURE__ */ k(o, {
|
|
1073
1073
|
htmlFor: r,
|
|
1074
|
-
label:
|
|
1074
|
+
label: u,
|
|
1075
1075
|
required: s.data.required
|
|
1076
1076
|
}),
|
|
1077
1077
|
v.length > 0 && /* @__PURE__ */ k("ul", {
|
|
@@ -1080,7 +1080,7 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1080
1080
|
className: "tg:flex tg:items-center tg:gap-2 tg:rounded-md tg:border tg:bg-card tg:px-3 tg:py-2 tg:text-sm",
|
|
1081
1081
|
children: [
|
|
1082
1082
|
/* @__PURE__ */ k(P, { className: "tg:size-4 tg:shrink-0 tg:text-muted-foreground" }),
|
|
1083
|
-
|
|
1083
|
+
_(e.data) ? /* @__PURE__ */ k("a", {
|
|
1084
1084
|
href: e.data,
|
|
1085
1085
|
target: "_blank",
|
|
1086
1086
|
rel: "noreferrer",
|
|
@@ -1094,7 +1094,7 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1094
1094
|
}),
|
|
1095
1095
|
e.size > 0 && /* @__PURE__ */ k("span", {
|
|
1096
1096
|
className: "tg:shrink-0 tg:text-muted-foreground tg:text-xs",
|
|
1097
|
-
children:
|
|
1097
|
+
children: d(e.size)
|
|
1098
1098
|
}),
|
|
1099
1099
|
/* @__PURE__ */ k(q, {
|
|
1100
1100
|
type: "button",
|
|
@@ -1108,20 +1108,20 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1108
1108
|
}, `${e.name}-${t}`))
|
|
1109
1109
|
}),
|
|
1110
1110
|
/* @__PURE__ */ k("input", {
|
|
1111
|
-
ref:
|
|
1111
|
+
ref: g,
|
|
1112
1112
|
type: "file",
|
|
1113
1113
|
name: i,
|
|
1114
1114
|
id: r,
|
|
1115
1115
|
className: "tg:hidden",
|
|
1116
1116
|
onChange: x,
|
|
1117
|
-
multiple:
|
|
1117
|
+
multiple: y
|
|
1118
1118
|
}),
|
|
1119
1119
|
/* @__PURE__ */ A(q, {
|
|
1120
1120
|
type: "button",
|
|
1121
1121
|
variant: "outline",
|
|
1122
|
-
onClick: () =>
|
|
1123
|
-
"aria-label":
|
|
1124
|
-
children: [/* @__PURE__ */ k(se, { className: "tg:size-4" }), v.length === 0 ? h(
|
|
1122
|
+
onClick: () => g.current?.click(),
|
|
1123
|
+
"aria-label": u || s.data.name,
|
|
1124
|
+
children: [/* @__PURE__ */ k(se, { className: "tg:size-4" }), v.length === 0 ? h(y ? "renderer.defaultInputs.selectFiles" : "renderer.defaultInputs.selectFile") : h(y ? "renderer.defaultInputs.addMoreFiles" : "renderer.defaultInputs.replaceFile")]
|
|
1125
1125
|
}),
|
|
1126
1126
|
l && /* @__PURE__ */ k(X, { children: l }),
|
|
1127
1127
|
m && !l && /* @__PURE__ */ k(Y, { children: m })
|
|
@@ -1145,7 +1145,7 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1145
1145
|
let i = t[r], a = i == null ? "" : String(i);
|
|
1146
1146
|
return n ? encodeURIComponent(a) : a;
|
|
1147
1147
|
}), Mt = ({ field: t, extra: o }) => {
|
|
1148
|
-
let [c,
|
|
1148
|
+
let [c, d] = O(!1), [f, p] = O(null), [m, _] = O([]), [b, x] = O(""), [S, C] = O(!1), { id: T, name: re, value: j, placeholder: ie } = t, { InputLabel: ae, node: M, setValue: N, error: P, label: se, helperText: I, missingDependencies: ce } = o, { formValues: L, inputNodes: ue, headers: R, baseUrl: de } = u(), { httpConfig: z } = M.data, fe = D(!1), pe = D(!1), B = D(""), V = n(), H = D(z), me = D(L), U = D(ue), W = D(R), he = D(de), ge = D(N), _e = D(null), G = D(null), ve = D(M.data.normalizeOptionLabels !== !1), ye = ee(() => z?.url ? kt(z.url) : [], [z?.url]), be = ye.length > 0, Q = ee(() => ye.map((e) => `${e}:${String(L[e] ?? "")}`).join("|"), [ye, L]), xe = ee(() => z?.url ? be ? At(z.url, L) : !0 : !1, [
|
|
1149
1149
|
z?.url,
|
|
1150
1150
|
be,
|
|
1151
1151
|
L
|
|
@@ -1153,54 +1153,54 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1153
1153
|
G.current && G.current.abort();
|
|
1154
1154
|
let n = new AbortController();
|
|
1155
1155
|
G.current = n;
|
|
1156
|
-
let o = H.current, c = me.current,
|
|
1156
|
+
let o = H.current, c = me.current, u = ge.current;
|
|
1157
1157
|
if (!o?.url) {
|
|
1158
|
-
|
|
1158
|
+
p(V("renderer.defaultHttpInput.noUrlConfigured")), G.current = null;
|
|
1159
1159
|
return;
|
|
1160
1160
|
}
|
|
1161
1161
|
if (o.url && !At(o.url, c)) {
|
|
1162
1162
|
G.current = null;
|
|
1163
1163
|
return;
|
|
1164
1164
|
}
|
|
1165
|
-
|
|
1165
|
+
d(!0), p(null);
|
|
1166
1166
|
try {
|
|
1167
|
-
let
|
|
1167
|
+
let d = a(jt(o.url, c, !0), he.current), f = l(o.searchParam && t ? `${d}${d.includes("?") ? "&" : "?"}${o.searchParam}=${encodeURIComponent(t)}` : d, i(o.queryParams, c)), m = h({ "Content-Type": "application/json" }, i(W.current, c), i(o.headers, c)), b = [
|
|
1168
1168
|
"POST",
|
|
1169
1169
|
"PUT",
|
|
1170
1170
|
"PATCH"
|
|
1171
|
-
].includes(o.method || "") ? o.sendAllFormValues ? JSON.stringify(
|
|
1171
|
+
].includes(o.method || "") ? o.sendAllFormValues ? JSON.stringify(g(c, U.current)) : v(o.body, c, U.current) : void 0, x = setTimeout(() => n.abort(), 3e4), S = await fetch(f, {
|
|
1172
1172
|
body: b || void 0,
|
|
1173
|
-
headers: Object.fromEntries(Object.entries(
|
|
1173
|
+
headers: Object.fromEntries(Object.entries(m).filter(([, e]) => e)),
|
|
1174
1174
|
method: o.method || "GET",
|
|
1175
1175
|
signal: n.signal
|
|
1176
1176
|
});
|
|
1177
1177
|
if (clearTimeout(x), !S.ok) {
|
|
1178
|
-
|
|
1178
|
+
p(`HTTP Error ${S.status}: ${S.statusText}`);
|
|
1179
1179
|
return;
|
|
1180
1180
|
}
|
|
1181
1181
|
let C = s(await S.text());
|
|
1182
1182
|
if (!C.ok) {
|
|
1183
|
-
|
|
1183
|
+
p(V("renderer.defaultHttpInput.invalidJson"));
|
|
1184
1184
|
return;
|
|
1185
1185
|
}
|
|
1186
1186
|
let w = r(C.value), T = o.responsePath ? e(w, o.responsePath) : w;
|
|
1187
1187
|
if (o.responseMapping && Array.isArray(T)) {
|
|
1188
1188
|
let { valueField: t = "value", labelField: n = "label", descriptionField: r, imageField: i } = o.responseMapping, a = ve.current;
|
|
1189
|
-
|
|
1189
|
+
_(T.map((o) => {
|
|
1190
1190
|
let s = r ? e(o, r) : void 0, c = i ? e(o, i) : void 0, l = String(e(o, n) || "");
|
|
1191
1191
|
return {
|
|
1192
1192
|
description: s != null && s !== "" ? String(s) : void 0,
|
|
1193
1193
|
image: typeof c == "string" && c !== "" ? c : void 0,
|
|
1194
|
-
label: a ?
|
|
1194
|
+
label: a ? y(l) : l,
|
|
1195
1195
|
value: String(e(o, t) || "")
|
|
1196
1196
|
};
|
|
1197
1197
|
}));
|
|
1198
|
-
} else
|
|
1198
|
+
} else u(typeof T == "string" ? T : JSON.stringify(T));
|
|
1199
1199
|
} catch (e) {
|
|
1200
1200
|
if (e instanceof Error && e.name === "AbortError") return;
|
|
1201
|
-
|
|
1201
|
+
p(e instanceof Error ? e.message : V("renderer.defaultHttpInput.fetchFailed")), console.error("HTTP Input fetch error:", e);
|
|
1202
1202
|
} finally {
|
|
1203
|
-
G.current === n && (
|
|
1203
|
+
G.current === n && (d(!1), G.current = null);
|
|
1204
1204
|
}
|
|
1205
1205
|
}, [V]);
|
|
1206
1206
|
if (E(() => {
|
|
@@ -1251,17 +1251,17 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1251
1251
|
sendAllFormValues: z?.sendAllFormValues,
|
|
1252
1252
|
url: z?.url
|
|
1253
1253
|
}), [z])]), E(() => {
|
|
1254
|
-
if (!(z?.searchParam &&
|
|
1254
|
+
if (!(z?.searchParam && b)) return;
|
|
1255
1255
|
let e = setTimeout(() => {
|
|
1256
|
-
$(
|
|
1256
|
+
$(b);
|
|
1257
1257
|
}, 300);
|
|
1258
1258
|
return () => clearTimeout(e);
|
|
1259
1259
|
}, [
|
|
1260
|
-
|
|
1260
|
+
b,
|
|
1261
1261
|
z?.searchParam,
|
|
1262
1262
|
$
|
|
1263
1263
|
]), z?.responseMapping) {
|
|
1264
|
-
let e = Array.isArray(j) ? j[0] : j, t =
|
|
1264
|
+
let e = Array.isArray(j) ? j[0] : j, t = m.find((t) => t.value === e);
|
|
1265
1265
|
if (z.searchParam) {
|
|
1266
1266
|
let n = c && z?.showLoading, r = t?.label || ie || V("renderer.defaultHttpInput.search");
|
|
1267
1267
|
return /* @__PURE__ */ A(J, {
|
|
@@ -1302,25 +1302,25 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1302
1302
|
shouldFilter: !1,
|
|
1303
1303
|
children: [/* @__PURE__ */ k(nt, {
|
|
1304
1304
|
placeholder: V("renderer.defaultHttpInput.search"),
|
|
1305
|
-
value:
|
|
1305
|
+
value: b,
|
|
1306
1306
|
onValueChange: (e) => {
|
|
1307
|
-
x(e),
|
|
1307
|
+
x(e), p(null);
|
|
1308
1308
|
}
|
|
1309
1309
|
}), /* @__PURE__ */ A(rt, { children: [
|
|
1310
1310
|
c && /* @__PURE__ */ k("div", {
|
|
1311
1311
|
className: "tg:flex tg:items-center tg:justify-center tg:p-4",
|
|
1312
1312
|
children: /* @__PURE__ */ k(F, { className: "tg:h-4 tg:w-4 tg:animate-spin" })
|
|
1313
1313
|
}),
|
|
1314
|
-
!c &&
|
|
1314
|
+
!c && f && /* @__PURE__ */ A("div", {
|
|
1315
1315
|
className: "tg:p-4 tg:text-destructive tg:text-sm",
|
|
1316
|
-
children: [/* @__PURE__ */ k("div", { children:
|
|
1316
|
+
children: [/* @__PURE__ */ k("div", { children: f }), /* @__PURE__ */ k("button", {
|
|
1317
1317
|
type: "button",
|
|
1318
|
-
onClick: () => $(
|
|
1318
|
+
onClick: () => $(b),
|
|
1319
1319
|
className: "tg:mt-2 tg:block tg:text-primary tg:hover:underline",
|
|
1320
1320
|
children: V("renderer.defaultHttpInput.retry")
|
|
1321
1321
|
})]
|
|
1322
1322
|
}),
|
|
1323
|
-
!(c ||
|
|
1323
|
+
!(c || f) && /* @__PURE__ */ A(te, { children: [/* @__PURE__ */ k(it, { children: V("renderer.defaultHttpInput.noResults") }), /* @__PURE__ */ k(at, { children: m.map((e) => /* @__PURE__ */ A(ot, {
|
|
1324
1324
|
value: e.value,
|
|
1325
1325
|
onSelect: () => {
|
|
1326
1326
|
N(e.value === j ? "" : e.value), C(!1);
|
|
@@ -1351,13 +1351,13 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1351
1351
|
]
|
|
1352
1352
|
});
|
|
1353
1353
|
}
|
|
1354
|
-
let n = c && z?.showLoading, r = ce.length === 0 &&
|
|
1354
|
+
let n = c && z?.showLoading, r = ce.length === 0 && m.length === 0 && !n ? f ?? V("renderer.defaultHttpInput.noDataAvailable") : void 0, i = Array.isArray(j) ? j[0] ?? "" : j ?? "", a = /* @__PURE__ */ A("div", {
|
|
1355
1355
|
className: "tg:relative",
|
|
1356
1356
|
children: [
|
|
1357
1357
|
/* @__PURE__ */ A(Ee, {
|
|
1358
1358
|
value: i,
|
|
1359
1359
|
onValueChange: (e) => N(e),
|
|
1360
|
-
disabled: n ||
|
|
1360
|
+
disabled: n || m.length === 0,
|
|
1361
1361
|
name: re,
|
|
1362
1362
|
children: [/* @__PURE__ */ k(ke, {
|
|
1363
1363
|
id: T,
|
|
@@ -1365,7 +1365,7 @@ var Tt = ({ field: e, extra: t }) => {
|
|
|
1365
1365
|
"aria-label": se || M.data.name,
|
|
1366
1366
|
className: K("tg:w-full", (i || n) && "tg:pr-14"),
|
|
1367
1367
|
children: /* @__PURE__ */ k(Oe, { placeholder: ie || V("renderer.defaultHttpInput.selectOption") })
|
|
1368
|
-
}), /* @__PURE__ */ k(Ae, { children: /* @__PURE__ */ k(De, { children:
|
|
1368
|
+
}), /* @__PURE__ */ k(Ae, { children: /* @__PURE__ */ k(De, { children: m.map((e, t) => /* @__PURE__ */ k(Me, {
|
|
1369
1369
|
value: e.value,
|
|
1370
1370
|
children: /* @__PURE__ */ k(vt, {
|
|
1371
1371
|
label: e.label,
|
|
@@ -1552,33 +1552,33 @@ function Ht({ className: e, ...t }) {
|
|
|
1552
1552
|
//#endregion
|
|
1553
1553
|
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.tsx
|
|
1554
1554
|
var Ut = ({ field: e, extra: t }) => {
|
|
1555
|
-
let { id: r, name: i, value: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label:
|
|
1555
|
+
let { id: r, name: i, value: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: d, helperText: f, renderOptionExtras: p, compactOptions: m, missingDependencies: h } = t, { options: g, isLoading: _, error: v } = bt(s), { optionsDisplayLimit: y } = u(), b = n(), x = a ? String(a) : "", S = s.data.variant !== "default", C = `${r}-label`, w = y ? g.slice(0, y) : g, T = g.length - w.length;
|
|
1556
1556
|
return /* @__PURE__ */ A(J, {
|
|
1557
1557
|
className: "tg:mb-4",
|
|
1558
1558
|
children: [
|
|
1559
1559
|
/* @__PURE__ */ k(o, {
|
|
1560
1560
|
className: "tg:mb-1",
|
|
1561
1561
|
id: C,
|
|
1562
|
-
label:
|
|
1562
|
+
label: d,
|
|
1563
1563
|
required: s.data.required
|
|
1564
1564
|
}),
|
|
1565
|
-
/* @__PURE__ */ k(ft, { missing:
|
|
1566
|
-
|
|
1565
|
+
/* @__PURE__ */ k(ft, { missing: h }),
|
|
1566
|
+
_ && /* @__PURE__ */ A("div", {
|
|
1567
1567
|
className: "tg:flex tg:items-center tg:gap-2 tg:py-2 tg:text-muted-foreground tg:text-sm",
|
|
1568
|
-
children: [/* @__PURE__ */ k(F, { className: "tg:h-4 tg:w-4 tg:animate-spin" }), /* @__PURE__ */ k("span", { children:
|
|
1568
|
+
children: [/* @__PURE__ */ k(F, { className: "tg:h-4 tg:w-4 tg:animate-spin" }), /* @__PURE__ */ k("span", { children: b("renderer.defaultRadioInput.loadingOptions") })]
|
|
1569
1569
|
}),
|
|
1570
1570
|
/* @__PURE__ */ A(Vt, {
|
|
1571
1571
|
value: x,
|
|
1572
1572
|
onValueChange: (e) => c(e),
|
|
1573
|
-
"aria-labelledby":
|
|
1574
|
-
"aria-label":
|
|
1573
|
+
"aria-labelledby": d ? C : void 0,
|
|
1574
|
+
"aria-label": d ? void 0 : s.data.name,
|
|
1575
1575
|
name: i,
|
|
1576
1576
|
className: K("tg:min-w-0", S && "tg:flex tg:flex-col tg:gap-2"),
|
|
1577
1577
|
children: [w.map((e, t) => {
|
|
1578
|
-
let n = `${r}-${e.value}`, i =
|
|
1578
|
+
let n = `${r}-${e.value}`, i = b(e.label) || e.value, a = b(e.description), o = String(e.value);
|
|
1579
1579
|
return S ? /* @__PURE__ */ A(Rt, {
|
|
1580
1580
|
htmlFor: n,
|
|
1581
|
-
className: K("tg:group/option tg:pointer-events-auto tg:relative",
|
|
1581
|
+
className: K("tg:group/option tg:pointer-events-auto tg:relative", m && "tg:group-hover/option:pr-16"),
|
|
1582
1582
|
children: [/* @__PURE__ */ A(It, {
|
|
1583
1583
|
orientation: "horizontal",
|
|
1584
1584
|
"data-disabled": e.disabled || void 0,
|
|
@@ -1589,12 +1589,12 @@ var Ut = ({ field: e, extra: t }) => {
|
|
|
1589
1589
|
className: "tg:h-10 tg:w-10 tg:shrink-0 tg:self-center tg:rounded tg:object-cover"
|
|
1590
1590
|
}),
|
|
1591
1591
|
/* @__PURE__ */ A(Lt, {
|
|
1592
|
-
className: K(
|
|
1592
|
+
className: K(m && "tg:min-w-0 tg:flex-1 tg:overflow-hidden"),
|
|
1593
1593
|
children: [/* @__PURE__ */ k(zt, {
|
|
1594
|
-
className: K(
|
|
1594
|
+
className: K(m && "tg:block tg:max-w-full tg:truncate"),
|
|
1595
1595
|
children: i
|
|
1596
1596
|
}), a && /* @__PURE__ */ k(Bt, {
|
|
1597
|
-
className: K(
|
|
1597
|
+
className: K(m && "tg:block tg:max-w-full tg:truncate"),
|
|
1598
1598
|
children: a
|
|
1599
1599
|
})]
|
|
1600
1600
|
}),
|
|
@@ -1602,16 +1602,16 @@ var Ut = ({ field: e, extra: t }) => {
|
|
|
1602
1602
|
value: o,
|
|
1603
1603
|
id: n,
|
|
1604
1604
|
disabled: e.disabled,
|
|
1605
|
-
className: K(
|
|
1605
|
+
className: K(m && "tg:ml-auto tg:shrink-0 tg:group-hover/option:invisible")
|
|
1606
1606
|
})
|
|
1607
1607
|
]
|
|
1608
|
-
}),
|
|
1608
|
+
}), p?.({
|
|
1609
1609
|
index: t,
|
|
1610
1610
|
option: e,
|
|
1611
1611
|
variant: "card"
|
|
1612
1612
|
})]
|
|
1613
1613
|
}, e.value + t) : /* @__PURE__ */ A("div", {
|
|
1614
|
-
className: K("tg:group/option tg:pointer-events-auto tg:relative tg:flex tg:items-start tg:space-x-2",
|
|
1614
|
+
className: K("tg:group/option tg:pointer-events-auto tg:relative tg:flex tg:items-start tg:space-x-2", m && "tg:min-w-0 tg:pr-22"),
|
|
1615
1615
|
children: [
|
|
1616
1616
|
/* @__PURE__ */ k(Ht, {
|
|
1617
1617
|
value: o,
|
|
@@ -1625,17 +1625,17 @@ var Ut = ({ field: e, extra: t }) => {
|
|
|
1625
1625
|
className: "tg:h-8 tg:w-8 tg:rounded tg:object-cover"
|
|
1626
1626
|
}),
|
|
1627
1627
|
/* @__PURE__ */ A("div", {
|
|
1628
|
-
className: K("tg:flex tg:flex-col",
|
|
1628
|
+
className: K("tg:flex tg:flex-col", m && "tg:min-w-0 tg:flex-1 tg:overflow-hidden"),
|
|
1629
1629
|
children: [/* @__PURE__ */ k(Q, {
|
|
1630
1630
|
htmlFor: n,
|
|
1631
|
-
className: K("tg:cursor-pointer tg:font-normal tg:text-sm",
|
|
1631
|
+
className: K("tg:cursor-pointer tg:font-normal tg:text-sm", m && "tg:block tg:max-w-full tg:truncate"),
|
|
1632
1632
|
children: i
|
|
1633
1633
|
}), a && /* @__PURE__ */ k("span", {
|
|
1634
|
-
className: K("tg:text-muted-foreground tg:text-xs",
|
|
1634
|
+
className: K("tg:text-muted-foreground tg:text-xs", m && "tg:block tg:max-w-full tg:truncate"),
|
|
1635
1635
|
children: a
|
|
1636
1636
|
})]
|
|
1637
1637
|
}),
|
|
1638
|
-
|
|
1638
|
+
p?.({
|
|
1639
1639
|
index: t,
|
|
1640
1640
|
option: e,
|
|
1641
1641
|
variant: "default"
|
|
@@ -1648,8 +1648,8 @@ var Ut = ({ field: e, extra: t }) => {
|
|
|
1648
1648
|
})]
|
|
1649
1649
|
}),
|
|
1650
1650
|
l && /* @__PURE__ */ k(X, { children: l }),
|
|
1651
|
-
|
|
1652
|
-
|
|
1651
|
+
v && !l && /* @__PURE__ */ k(X, { children: v }),
|
|
1652
|
+
f && !l && !v && /* @__PURE__ */ k(Y, { children: f })
|
|
1653
1653
|
]
|
|
1654
1654
|
});
|
|
1655
1655
|
}, Wt = ({ field: e, extra: t }) => {
|