@declarion/react 0.40.0 → 0.40.1
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-lib/{DraggableChildrenTable-Ctmn0liO.js → DraggableChildrenTable-BkqtkJuz.js} +29 -29
- package/dist-lib/{Grid-BsIkTp3u.js → Grid-CTxov4x2.js} +2 -2
- package/dist-lib/{LayoutRenderer-D4oTfZhV.js → LayoutRenderer-Cbh-pY26.js} +307 -307
- package/dist-lib/{MarkdownRenderer-B-2CrtjU.js → MarkdownRenderer-DeguFsZL.js} +1 -1
- package/dist-lib/{RefreshControl-VQf34HKZ.js → RefreshControl-DG2kMABB.js} +165 -165
- package/dist-lib/{SmartDetailPage.impl-HMaLVDlV.js → SmartDetailPage.impl-DCJ_V-Nh.js} +458 -458
- package/dist-lib/{SmartRecordListPage.impl-Cxm7qvlZ.js → SmartRecordListPage.impl-sYCMQw8V.js} +183 -183
- package/dist-lib/components/primitives/Fields.d.ts +7 -0
- package/dist-lib/components/primitives/index.d.ts +2 -2
- package/dist-lib/index.js +1927 -1894
- package/dist-lib/lib/filters.d.ts +5 -0
- package/dist-lib/{registry-DFtAh6zc.js → registry-DbZX1hy8.js} +410 -410
- package/dist-lib/testing.js +25 -25
- package/dist-lib/{useCurrentScreen-mw8TfE8q.js → useCurrentScreen-C33VZcNn.js} +1118 -967
- package/dist-lib/{useProperties-gMdnhdhO.js → useProperties-BgAEk8X9.js} +27 -27
- package/dist-lib/{value-t9ETvWIJ.js → value-VOi8Svry.js} +1 -1
- package/package.json +1 -1
|
@@ -199,7 +199,7 @@ function j({ open: e, onClose: t, anchor: n, anchorPoint: r, children: i, align:
|
|
|
199
199
|
n,
|
|
200
200
|
t
|
|
201
201
|
]), !e || !d) return null;
|
|
202
|
-
let _ = d.placement === "below" ? `calc(var(--app-height) - ${d.top}px - 8px)` : `${Math.max(120, d.top - 8)}px`, v =
|
|
202
|
+
let _ = d.placement === "below" ? `calc(var(--app-height) - ${d.top}px - 8px)` : `${Math.max(120, d.top - 8)}px`, v = ee(s?.maxHeight), y = v ? `min(${_}, ${v})` : _;
|
|
203
203
|
return S(/* @__PURE__ */ b("div", {
|
|
204
204
|
ref: c,
|
|
205
205
|
style: {
|
|
@@ -232,19 +232,19 @@ function M() {
|
|
|
232
232
|
let t = window.visualViewport?.height;
|
|
233
233
|
return Number.isFinite(t) && t && t > 0 ? t : window.innerHeight;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function ee(e) {
|
|
236
236
|
if (e != null) return typeof e == "number" ? `${e}px` : String(e);
|
|
237
237
|
}
|
|
238
238
|
//#endregion
|
|
239
239
|
//#region src/components/primitives/HoverCard.tsx
|
|
240
|
-
var
|
|
241
|
-
function
|
|
240
|
+
var te = 400, ne = 150, re = 320, ie = 240, ae = 4, oe = 4;
|
|
241
|
+
function se({ content: e, children: t, width: n = re, align: r = "center", style: i }) {
|
|
242
242
|
let a = f(null), o = f(null), c = f(null), u = f(null), [d, m] = p(!1), [h, g] = p(null), [_, v] = p(!1), C = s(() => {
|
|
243
243
|
let e = a.current;
|
|
244
244
|
if (!e) return;
|
|
245
|
-
let t = e.getBoundingClientRect(), i = typeof window < "u" ? window.visualViewport : void 0, s = i?.width ?? (typeof window < "u" ? window.innerWidth : 0), c = i?.height ?? (typeof window < "u" ? window.innerHeight : 0), l = i?.offsetLeft ?? 0, u = i?.offsetTop ?? 0, d = Math.min(n, Math.max(160, s -
|
|
245
|
+
let t = e.getBoundingClientRect(), i = typeof window < "u" ? window.visualViewport : void 0, s = i?.width ?? (typeof window < "u" ? window.innerWidth : 0), c = i?.height ?? (typeof window < "u" ? window.innerHeight : 0), l = i?.offsetLeft ?? 0, u = i?.offsetTop ?? 0, d = Math.min(n, Math.max(160, s - ae * 2)), f = o.current?.offsetHeight ?? ie, p = u + c - t.bottom < f + oe * 2 && t.top > f + oe * 2 ? "above" : "below", m = p === "below" ? t.bottom + oe : t.top - oe - f, h;
|
|
246
246
|
h = r === "start" ? t.left : r === "end" ? t.right - d : t.left + t.width / 2 - d / 2;
|
|
247
|
-
let _ = l +
|
|
247
|
+
let _ = l + ae, v = l + s - ae;
|
|
248
248
|
h + d > v && (h = Math.max(_, t.right - d)), h < _ && (h = _), g((e) => e && e.top === m && e.left === h && e.width === d && e.placement === p ? e : {
|
|
249
249
|
top: m,
|
|
250
250
|
left: h,
|
|
@@ -263,7 +263,7 @@ function oe({ content: e, children: t, width: n = ne, align: r = "center", style
|
|
|
263
263
|
}, []), D = () => {
|
|
264
264
|
u.current !== null && (window.clearTimeout(u.current), u.current = null), !(d || c.current !== null) && (c.current = window.setTimeout(() => {
|
|
265
265
|
c.current = null, m(!0);
|
|
266
|
-
},
|
|
266
|
+
}, te));
|
|
267
267
|
}, O = s(() => {
|
|
268
268
|
E(), m(!0);
|
|
269
269
|
}, [E]), k = s(() => {
|
|
@@ -271,7 +271,7 @@ function oe({ content: e, children: t, width: n = ne, align: r = "center", style
|
|
|
271
271
|
}, [E]), A = () => {
|
|
272
272
|
c.current !== null && (window.clearTimeout(c.current), c.current = null), u.current === null && (u.current = window.setTimeout(() => {
|
|
273
273
|
u.current = null, m(!1);
|
|
274
|
-
},
|
|
274
|
+
}, ne));
|
|
275
275
|
};
|
|
276
276
|
l(() => () => {
|
|
277
277
|
E(), w.current &&= (w.current.disconnect(), null);
|
|
@@ -303,7 +303,7 @@ function oe({ content: e, children: t, width: n = ne, align: r = "center", style
|
|
|
303
303
|
top: h.top,
|
|
304
304
|
left: h.left,
|
|
305
305
|
width: h.width,
|
|
306
|
-
maxHeight:
|
|
306
|
+
maxHeight: ie,
|
|
307
307
|
overflowY: "auto",
|
|
308
308
|
zIndex: 250,
|
|
309
309
|
background: "var(--surface)",
|
|
@@ -349,7 +349,7 @@ function oe({ content: e, children: t, width: n = ne, align: r = "center", style
|
|
|
349
349
|
}
|
|
350
350
|
//#endregion
|
|
351
351
|
//#region src/components/primitives/Chip.tsx
|
|
352
|
-
function
|
|
352
|
+
function N({ icon: e, children: n, onRemove: r, onClick: i }) {
|
|
353
353
|
return /* @__PURE__ */ x("span", {
|
|
354
354
|
onClick: i,
|
|
355
355
|
style: {
|
|
@@ -758,13 +758,17 @@ function F({ value: e, options: n, onChange: r, placeholder: i = "Select...", on
|
|
|
758
758
|
alignItems: "center",
|
|
759
759
|
gap: 6,
|
|
760
760
|
overflow: "hidden",
|
|
761
|
-
textOverflow: "ellipsis"
|
|
761
|
+
textOverflow: "ellipsis",
|
|
762
|
+
whiteSpace: "nowrap"
|
|
762
763
|
},
|
|
763
764
|
children: h ? h.label : i
|
|
764
765
|
}), /* @__PURE__ */ b(t.down, {
|
|
765
766
|
size: 12,
|
|
766
767
|
cls: "",
|
|
767
|
-
style: {
|
|
768
|
+
style: {
|
|
769
|
+
color: "var(--text-3)",
|
|
770
|
+
flexShrink: 0
|
|
771
|
+
}
|
|
768
772
|
})]
|
|
769
773
|
}), /* @__PURE__ */ x(j, {
|
|
770
774
|
open: s,
|
|
@@ -823,7 +827,154 @@ function F({ value: e, options: n, onChange: r, placeholder: i = "Select...", on
|
|
|
823
827
|
]
|
|
824
828
|
})] });
|
|
825
829
|
}
|
|
826
|
-
function ke({ value: e,
|
|
830
|
+
function ke({ value: e = [], options: n, onChange: r, placeholder: i = "Select…", ...a }) {
|
|
831
|
+
let [o, s] = p(!1), [c, l] = p(""), u = f(null), m = n.filter((e) => !e.heading && !e.divider), h = m.length > Ee, g = e.map((e) => m.find((t) => t.value === e) ?? {
|
|
832
|
+
value: e,
|
|
833
|
+
label: e
|
|
834
|
+
}), _ = d(() => {
|
|
835
|
+
let e = c.trim().toLowerCase();
|
|
836
|
+
return e ? n.filter((t) => !t.heading && !t.divider && Oe(t).toLowerCase().includes(e)).slice(0, De) : n.slice(0, De);
|
|
837
|
+
}, [n, c]), v = (t) => r(e.includes(t) ? e.filter((e) => e !== t) : [...e, t]);
|
|
838
|
+
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ x("button", {
|
|
839
|
+
...a,
|
|
840
|
+
type: "button",
|
|
841
|
+
ref: u,
|
|
842
|
+
"aria-haspopup": "listbox",
|
|
843
|
+
"aria-expanded": o,
|
|
844
|
+
onClick: () => {
|
|
845
|
+
s((e) => {
|
|
846
|
+
let t = !e;
|
|
847
|
+
return t && l(""), t;
|
|
848
|
+
});
|
|
849
|
+
},
|
|
850
|
+
style: {
|
|
851
|
+
...we,
|
|
852
|
+
height: "auto",
|
|
853
|
+
minHeight: "var(--control-height)",
|
|
854
|
+
display: "flex",
|
|
855
|
+
alignItems: "center",
|
|
856
|
+
flexWrap: "wrap",
|
|
857
|
+
gap: 4,
|
|
858
|
+
padding: g.length ? "3px 8px" : "0 10px",
|
|
859
|
+
textAlign: "left",
|
|
860
|
+
cursor: "pointer",
|
|
861
|
+
...a.style
|
|
862
|
+
},
|
|
863
|
+
children: [g.length === 0 ? /* @__PURE__ */ b("span", {
|
|
864
|
+
style: {
|
|
865
|
+
flex: 1,
|
|
866
|
+
color: "var(--text-placeholder)"
|
|
867
|
+
},
|
|
868
|
+
children: i
|
|
869
|
+
}) : g.map((e) => /* @__PURE__ */ x("span", {
|
|
870
|
+
style: {
|
|
871
|
+
display: "inline-flex",
|
|
872
|
+
alignItems: "center",
|
|
873
|
+
gap: 4,
|
|
874
|
+
height: 22,
|
|
875
|
+
padding: "0 4px 0 8px",
|
|
876
|
+
borderRadius: 6,
|
|
877
|
+
background: "var(--surface-3)",
|
|
878
|
+
border: "1px solid var(--border)",
|
|
879
|
+
fontSize: 12,
|
|
880
|
+
color: "var(--text-2)",
|
|
881
|
+
maxWidth: "100%"
|
|
882
|
+
},
|
|
883
|
+
children: [/* @__PURE__ */ b("span", {
|
|
884
|
+
style: {
|
|
885
|
+
overflow: "hidden",
|
|
886
|
+
textOverflow: "ellipsis",
|
|
887
|
+
whiteSpace: "nowrap"
|
|
888
|
+
},
|
|
889
|
+
children: e.label
|
|
890
|
+
}), /* @__PURE__ */ b("span", {
|
|
891
|
+
role: "button",
|
|
892
|
+
"aria-label": `Remove ${Oe(e)}`,
|
|
893
|
+
onClick: (t) => {
|
|
894
|
+
t.stopPropagation(), v(e.value);
|
|
895
|
+
},
|
|
896
|
+
style: {
|
|
897
|
+
display: "flex",
|
|
898
|
+
color: "var(--text-3)",
|
|
899
|
+
cursor: "pointer",
|
|
900
|
+
flexShrink: 0
|
|
901
|
+
},
|
|
902
|
+
children: /* @__PURE__ */ b(t.x, { size: 12 })
|
|
903
|
+
})]
|
|
904
|
+
}, e.value)), /* @__PURE__ */ b(t.down, {
|
|
905
|
+
size: 12,
|
|
906
|
+
cls: "",
|
|
907
|
+
style: {
|
|
908
|
+
color: "var(--text-3)",
|
|
909
|
+
marginLeft: "auto",
|
|
910
|
+
flexShrink: 0
|
|
911
|
+
}
|
|
912
|
+
})]
|
|
913
|
+
}), /* @__PURE__ */ x(j, {
|
|
914
|
+
open: o,
|
|
915
|
+
anchor: u.current,
|
|
916
|
+
onClose: () => s(!1),
|
|
917
|
+
width: u.current?.offsetWidth,
|
|
918
|
+
style: {
|
|
919
|
+
maxHeight: "min(360px, calc(var(--app-height) - 24px))",
|
|
920
|
+
overflowY: "auto"
|
|
921
|
+
},
|
|
922
|
+
children: [
|
|
923
|
+
h && /* @__PURE__ */ b("div", {
|
|
924
|
+
style: {
|
|
925
|
+
padding: 6,
|
|
926
|
+
position: "sticky",
|
|
927
|
+
top: -4,
|
|
928
|
+
background: "var(--surface)",
|
|
929
|
+
zIndex: 1
|
|
930
|
+
},
|
|
931
|
+
children: /* @__PURE__ */ b(P, {
|
|
932
|
+
value: c,
|
|
933
|
+
onChange: l,
|
|
934
|
+
placeholder: "Search…",
|
|
935
|
+
prefix: /* @__PURE__ */ b(t.search, { size: 12 }),
|
|
936
|
+
autoFocus: !0
|
|
937
|
+
})
|
|
938
|
+
}),
|
|
939
|
+
_.map((n, r) => {
|
|
940
|
+
if (n.divider) return /* @__PURE__ */ b("div", { style: {
|
|
941
|
+
borderTop: "1px solid var(--divider)",
|
|
942
|
+
margin: "4px 0"
|
|
943
|
+
} }, `divider-${r}`);
|
|
944
|
+
if (n.heading) return /* @__PURE__ */ b("div", {
|
|
945
|
+
style: {
|
|
946
|
+
padding: "6px 10px 2px",
|
|
947
|
+
fontSize: 10.5,
|
|
948
|
+
fontWeight: 600,
|
|
949
|
+
color: "var(--text-3)",
|
|
950
|
+
textTransform: "uppercase",
|
|
951
|
+
letterSpacing: "0.06em"
|
|
952
|
+
},
|
|
953
|
+
children: n.label
|
|
954
|
+
}, `heading-${r}`);
|
|
955
|
+
let i = e.includes(n.value);
|
|
956
|
+
return /* @__PURE__ */ b(xe, {
|
|
957
|
+
active: i,
|
|
958
|
+
icon: i ? /* @__PURE__ */ b(t.check, { size: 13 }) : /* @__PURE__ */ b("span", { style: {
|
|
959
|
+
display: "inline-block",
|
|
960
|
+
width: 13
|
|
961
|
+
} }),
|
|
962
|
+
onClick: () => v(n.value),
|
|
963
|
+
children: n.label
|
|
964
|
+
}, n.value);
|
|
965
|
+
}),
|
|
966
|
+
_.length === 0 && /* @__PURE__ */ b("div", {
|
|
967
|
+
style: {
|
|
968
|
+
padding: "8px 10px",
|
|
969
|
+
fontSize: 12.5,
|
|
970
|
+
color: "var(--text-3)"
|
|
971
|
+
},
|
|
972
|
+
children: "No matches"
|
|
973
|
+
})
|
|
974
|
+
]
|
|
975
|
+
})] });
|
|
976
|
+
}
|
|
977
|
+
function Ae({ value: e, onChange: n }) {
|
|
827
978
|
return /* @__PURE__ */ b(P, {
|
|
828
979
|
value: e || "",
|
|
829
980
|
onChange: n,
|
|
@@ -831,26 +982,26 @@ function ke({ value: e, onChange: n }) {
|
|
|
831
982
|
prefix: /* @__PURE__ */ b(t.calendar, { size: 13 })
|
|
832
983
|
});
|
|
833
984
|
}
|
|
834
|
-
function
|
|
985
|
+
function je(e) {
|
|
835
986
|
if (!e) return 0;
|
|
836
987
|
let t = 0;
|
|
837
988
|
return e.length >= 8 && t++, e.length >= 12 && t++, /[A-Z]/.test(e) && /[a-z]/.test(e) && t++, /\d/.test(e) && t++, /[^A-Za-z0-9]/.test(e) && t++, Math.min(4, t);
|
|
838
989
|
}
|
|
839
|
-
var
|
|
990
|
+
var Me = [
|
|
840
991
|
"Too short",
|
|
841
992
|
"Weak",
|
|
842
993
|
"Fair",
|
|
843
994
|
"Good",
|
|
844
995
|
"Strong"
|
|
845
|
-
],
|
|
996
|
+
], Ne = [
|
|
846
997
|
"var(--danger)",
|
|
847
998
|
"var(--danger)",
|
|
848
999
|
"var(--warning, #B45309)",
|
|
849
1000
|
"var(--accent)",
|
|
850
1001
|
"var(--success, #3FBF8F)"
|
|
851
1002
|
];
|
|
852
|
-
function
|
|
853
|
-
let [c, l] = p(!1), u = e || "", d =
|
|
1003
|
+
function Pe({ value: e, onChange: n, placeholder: r = "Enter password", showStrength: i, id: a, name: o, ariaRequired: s }) {
|
|
1004
|
+
let [c, l] = p(!1), u = e || "", d = je(u);
|
|
854
1005
|
return /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b(P, {
|
|
855
1006
|
id: a,
|
|
856
1007
|
name: o,
|
|
@@ -895,7 +1046,7 @@ function Ne({ value: e, onChange: n, placeholder: r = "Enter password", showStre
|
|
|
895
1046
|
flex: 1,
|
|
896
1047
|
height: 3,
|
|
897
1048
|
borderRadius: 999,
|
|
898
|
-
background: e < d ?
|
|
1049
|
+
background: e < d ? Ne[d] : "var(--surface-3)",
|
|
899
1050
|
transition: "background .15s"
|
|
900
1051
|
} }, e))
|
|
901
1052
|
}), /* @__PURE__ */ b("span", {
|
|
@@ -905,11 +1056,11 @@ function Ne({ value: e, onChange: n, placeholder: r = "Enter password", showStre
|
|
|
905
1056
|
minWidth: 54,
|
|
906
1057
|
textAlign: "right"
|
|
907
1058
|
},
|
|
908
|
-
children: u ?
|
|
1059
|
+
children: u ? Me[d] : ""
|
|
909
1060
|
})]
|
|
910
1061
|
})] });
|
|
911
1062
|
}
|
|
912
|
-
function
|
|
1063
|
+
function Fe({ value: e = [], onChange: t }) {
|
|
913
1064
|
let [n, r] = p("");
|
|
914
1065
|
return /* @__PURE__ */ x("div", {
|
|
915
1066
|
style: {
|
|
@@ -922,7 +1073,7 @@ function Pe({ value: e = [], onChange: t }) {
|
|
|
922
1073
|
padding: "4px 6px",
|
|
923
1074
|
alignItems: "center"
|
|
924
1075
|
},
|
|
925
|
-
children: [e.map((n, r) => /* @__PURE__ */ b(
|
|
1076
|
+
children: [e.map((n, r) => /* @__PURE__ */ b(N, {
|
|
926
1077
|
tone: "slate",
|
|
927
1078
|
onRemove: () => t(e.filter((e, t) => t !== r)),
|
|
928
1079
|
children: n
|
|
@@ -945,7 +1096,7 @@ function Pe({ value: e = [], onChange: t }) {
|
|
|
945
1096
|
})]
|
|
946
1097
|
});
|
|
947
1098
|
}
|
|
948
|
-
function
|
|
1099
|
+
function Ie({ value: e, onChange: t }) {
|
|
949
1100
|
return /* @__PURE__ */ x("div", {
|
|
950
1101
|
style: {
|
|
951
1102
|
border: "1px solid var(--border)",
|
|
@@ -1004,7 +1155,7 @@ function Fe({ value: e, onChange: t }) {
|
|
|
1004
1155
|
})]
|
|
1005
1156
|
});
|
|
1006
1157
|
}
|
|
1007
|
-
function
|
|
1158
|
+
function Le({ value: e, entity: n = "company", onChange: r, items: i = [], id: a, ariaLabelledby: o, ariaRequired: s }) {
|
|
1008
1159
|
let [c, l] = p(!1), u = f(null);
|
|
1009
1160
|
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ x("button", {
|
|
1010
1161
|
type: "button",
|
|
@@ -1070,7 +1221,7 @@ function Ie({ value: e, entity: n = "company", onChange: r, items: i = [], id: a
|
|
|
1070
1221
|
}, e.id))]
|
|
1071
1222
|
})] });
|
|
1072
1223
|
}
|
|
1073
|
-
function
|
|
1224
|
+
function Re({ label: e, children: t, mono: n, wide: r, empty: i }) {
|
|
1074
1225
|
return /* @__PURE__ */ x("div", {
|
|
1075
1226
|
style: {
|
|
1076
1227
|
display: "flex",
|
|
@@ -1103,7 +1254,7 @@ function Le({ label: e, children: t, mono: n, wide: r, empty: i }) {
|
|
|
1103
1254
|
})]
|
|
1104
1255
|
});
|
|
1105
1256
|
}
|
|
1106
|
-
function
|
|
1257
|
+
function ze({ value: e, onChange: n, type: r = "text", options: i }) {
|
|
1107
1258
|
let [a, o] = p(!1), [s, c] = p(e), l = () => {
|
|
1108
1259
|
s !== void 0 && n?.(s), o(!1);
|
|
1109
1260
|
}, u = () => {
|
|
@@ -1172,7 +1323,7 @@ function Re({ value: e, onChange: n, type: r = "text", options: i }) {
|
|
|
1172
1323
|
}
|
|
1173
1324
|
//#endregion
|
|
1174
1325
|
//#region src/types/ordmap.ts
|
|
1175
|
-
var
|
|
1326
|
+
var Be = class e {
|
|
1176
1327
|
#e;
|
|
1177
1328
|
#t;
|
|
1178
1329
|
constructor(e) {
|
|
@@ -1234,10 +1385,10 @@ function I(e) {
|
|
|
1234
1385
|
function L(e, t = "en") {
|
|
1235
1386
|
return e ? e[t] ?? Object.values(e)[0] ?? "" : "";
|
|
1236
1387
|
}
|
|
1237
|
-
var
|
|
1238
|
-
function
|
|
1388
|
+
var Ve = "$display";
|
|
1389
|
+
function He(e, t) {
|
|
1239
1390
|
if (!e) return;
|
|
1240
|
-
let n = e[
|
|
1391
|
+
let n = e[Ve];
|
|
1241
1392
|
if (typeof n == "string" && n !== "") return n;
|
|
1242
1393
|
let r = t?.display?.display_field;
|
|
1243
1394
|
if (!r) return;
|
|
@@ -1258,11 +1409,11 @@ function R(e, t, n) {
|
|
|
1258
1409
|
let r = e[t];
|
|
1259
1410
|
return r == null ? n : typeof r == "object" && !Array.isArray(r) ? L(r) || n : I(r);
|
|
1260
1411
|
}
|
|
1261
|
-
function
|
|
1412
|
+
function Ue(e) {
|
|
1262
1413
|
let t = e.replace(/\/+$/, "").split("/").map((e) => e.startsWith(":") ? "[^/]+" : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
1263
1414
|
return RegExp("^" + t.join("/") + "$");
|
|
1264
1415
|
}
|
|
1265
|
-
function
|
|
1416
|
+
function We(e) {
|
|
1266
1417
|
let t = (() => {
|
|
1267
1418
|
try {
|
|
1268
1419
|
return decodeURIComponent(e);
|
|
@@ -1272,17 +1423,17 @@ function Ue(e) {
|
|
|
1272
1423
|
})().split("-")[0];
|
|
1273
1424
|
return t.length > 8 ? t.slice(0, 8) : t;
|
|
1274
1425
|
}
|
|
1275
|
-
function
|
|
1426
|
+
function Ge(e, t, n) {
|
|
1276
1427
|
if (!t) return;
|
|
1277
1428
|
let r = e.replace(/\/+$/, "") || "/", i;
|
|
1278
1429
|
for (let e of Object.values(t)) {
|
|
1279
|
-
if (!e.route || !
|
|
1430
|
+
if (!e.route || !Ue(e.route).test(r)) continue;
|
|
1280
1431
|
let t = e.route.includes("/:"), a = L(e.display?.name);
|
|
1281
1432
|
if (!a && t && n && e.entity) {
|
|
1282
1433
|
let t = L(n[e.entity]?.display?.name);
|
|
1283
1434
|
if (t) {
|
|
1284
1435
|
let e = r.slice(r.lastIndexOf("/") + 1);
|
|
1285
|
-
a = e ? `${t} ${
|
|
1436
|
+
a = e ? `${t} ${We(e)}` : t;
|
|
1286
1437
|
}
|
|
1287
1438
|
}
|
|
1288
1439
|
if (!a) continue;
|
|
@@ -1295,7 +1446,7 @@ function We(e, t, n) {
|
|
|
1295
1446
|
}
|
|
1296
1447
|
return i;
|
|
1297
1448
|
}
|
|
1298
|
-
function
|
|
1449
|
+
function Ke(e, t, n) {
|
|
1299
1450
|
let r = L(e.display?.name);
|
|
1300
1451
|
if (r) return r;
|
|
1301
1452
|
if (e.type === "ref" && e.ref?.entity && n) {
|
|
@@ -1307,10 +1458,10 @@ function Ge(e, t, n) {
|
|
|
1307
1458
|
}
|
|
1308
1459
|
return t;
|
|
1309
1460
|
}
|
|
1310
|
-
function
|
|
1461
|
+
function qe(e) {
|
|
1311
1462
|
if (e != null) return typeof e == "string" ? { entity: e } : e;
|
|
1312
1463
|
}
|
|
1313
|
-
function
|
|
1464
|
+
function Je(e, t) {
|
|
1314
1465
|
let n = e ?? [];
|
|
1315
1466
|
if (!t) return n;
|
|
1316
1467
|
switch (t.mode ?? "append") {
|
|
@@ -1319,7 +1470,7 @@ function qe(e, t) {
|
|
|
1319
1470
|
default: return [...n, ...t.values ?? []];
|
|
1320
1471
|
}
|
|
1321
1472
|
}
|
|
1322
|
-
function
|
|
1473
|
+
function Ye(e) {
|
|
1323
1474
|
let t = e.name, n = e.display ? {
|
|
1324
1475
|
...e.display,
|
|
1325
1476
|
name: e.display.name ?? t
|
|
@@ -1332,7 +1483,7 @@ function Je(e) {
|
|
|
1332
1483
|
structure: e.structure
|
|
1333
1484
|
};
|
|
1334
1485
|
}
|
|
1335
|
-
function
|
|
1486
|
+
function Xe(e, t) {
|
|
1336
1487
|
return !e || e.readonly ? !1 : e.mutations?.[t] ?? !0;
|
|
1337
1488
|
}
|
|
1338
1489
|
function z(e) {
|
|
@@ -1340,25 +1491,25 @@ function z(e) {
|
|
|
1340
1491
|
for (let [t, n] of e.fields) if (n.primary) return [t];
|
|
1341
1492
|
return ["id"];
|
|
1342
1493
|
}
|
|
1343
|
-
function
|
|
1494
|
+
function Ze(e, t) {
|
|
1344
1495
|
let n = z(e), r = {};
|
|
1345
1496
|
for (let e of n) r[e] = I(t[e]);
|
|
1346
1497
|
return r;
|
|
1347
1498
|
}
|
|
1348
|
-
function Ze(e) {
|
|
1349
|
-
return e.length === 1 ? e[0] : JSON.stringify(e);
|
|
1350
|
-
}
|
|
1351
1499
|
function Qe(e) {
|
|
1352
|
-
return
|
|
1500
|
+
return e.length === 1 ? e[0] : JSON.stringify(e);
|
|
1353
1501
|
}
|
|
1354
|
-
function $e(e
|
|
1355
|
-
return
|
|
1502
|
+
function $e(e) {
|
|
1503
|
+
return Qe(Object.values(e));
|
|
1356
1504
|
}
|
|
1357
1505
|
function et(e, t) {
|
|
1506
|
+
return Qe(z(e).map((e) => t[e] ?? ""));
|
|
1507
|
+
}
|
|
1508
|
+
function tt(e, t) {
|
|
1358
1509
|
let n = z(e);
|
|
1359
1510
|
if (n.length === 1) return { [n[0]]: t };
|
|
1360
1511
|
}
|
|
1361
|
-
function
|
|
1512
|
+
function nt(e, t) {
|
|
1362
1513
|
if (t <= 1) return [e];
|
|
1363
1514
|
try {
|
|
1364
1515
|
let n = JSON.parse(e);
|
|
@@ -1368,23 +1519,23 @@ function tt(e, t) {
|
|
|
1368
1519
|
}
|
|
1369
1520
|
return null;
|
|
1370
1521
|
}
|
|
1371
|
-
function
|
|
1522
|
+
function rt(e, t, n) {
|
|
1372
1523
|
if (e?.detail_screen === "none") return null;
|
|
1373
1524
|
let r = e?.detail_screen ?? t?.detail_screen;
|
|
1374
1525
|
return r ? n?.[r]?.route ?? null : null;
|
|
1375
1526
|
}
|
|
1376
|
-
function
|
|
1527
|
+
function it(e, t, n, r) {
|
|
1377
1528
|
if (!t) return null;
|
|
1378
|
-
let i =
|
|
1529
|
+
let i = rt(e, n, r);
|
|
1379
1530
|
return i ? i.replace(":id", encodeURIComponent(t)) : null;
|
|
1380
1531
|
}
|
|
1381
|
-
function it(e, t, n, r) {
|
|
1382
|
-
return !t || z(t).some((e) => !r[e]) ? null : rt(e, $e(t, r), t, n);
|
|
1383
|
-
}
|
|
1384
1532
|
function at(e, t, n, r) {
|
|
1385
|
-
return t ? it(e, t,
|
|
1533
|
+
return !t || z(t).some((e) => !r[e]) ? null : it(e, et(t, r), t, n);
|
|
1534
|
+
}
|
|
1535
|
+
function ot(e, t, n, r) {
|
|
1536
|
+
return t ? at(e, t, n, Ze(t, r)) : null;
|
|
1386
1537
|
}
|
|
1387
|
-
function
|
|
1538
|
+
function st(e) {
|
|
1388
1539
|
return z(e).length > 1;
|
|
1389
1540
|
}
|
|
1390
1541
|
//#endregion
|
|
@@ -1397,42 +1548,42 @@ var B = class extends Error {
|
|
|
1397
1548
|
constructor(e, t, n, r, i) {
|
|
1398
1549
|
super(t), this.name = "ApiError", this.status = e, this.code = n, this.index = r, this.raw = i;
|
|
1399
1550
|
}
|
|
1400
|
-
},
|
|
1401
|
-
function
|
|
1551
|
+
}, ct = "cursor_semantics_mismatch", lt = "cursor_locale_changed";
|
|
1552
|
+
function ut(e) {
|
|
1402
1553
|
return e instanceof B && (e.code === "cursor_semantics_mismatch" || e.code === "cursor_locale_changed" || e.code === "archive_cursor_invalid");
|
|
1403
1554
|
}
|
|
1404
1555
|
//#endregion
|
|
1405
1556
|
//#region src/api/auth-redirect.ts
|
|
1406
|
-
var V = "/",
|
|
1407
|
-
function
|
|
1557
|
+
var V = "/", dt = "/login", ft = "/signup", pt = "https://declarion.local";
|
|
1558
|
+
function mt(e) {
|
|
1408
1559
|
let t = e.split(/[?#]/, 1)[0];
|
|
1409
|
-
return t ===
|
|
1560
|
+
return t === dt || t.startsWith(`${dt}/`) || t === ft || t.startsWith(`${ft}/`);
|
|
1410
1561
|
}
|
|
1411
|
-
function
|
|
1562
|
+
function ht(e) {
|
|
1412
1563
|
if (!e) return V;
|
|
1413
1564
|
let t = e.toLowerCase();
|
|
1414
1565
|
if (!e.startsWith("/") || e.startsWith("//") || e.includes("\\") || t.includes("%5c")) return V;
|
|
1415
1566
|
try {
|
|
1416
|
-
let t = new URL(e,
|
|
1417
|
-
if (t.origin !==
|
|
1567
|
+
let t = new URL(e, pt);
|
|
1568
|
+
if (t.origin !== pt) return V;
|
|
1418
1569
|
let n = `${t.pathname}${t.search}${t.hash}`;
|
|
1419
1570
|
return !n.startsWith("/") || n.startsWith("//") || n.includes("\\") ? V : n || V;
|
|
1420
1571
|
} catch {
|
|
1421
1572
|
return V;
|
|
1422
1573
|
}
|
|
1423
1574
|
}
|
|
1424
|
-
function
|
|
1425
|
-
let t =
|
|
1426
|
-
return t === V ||
|
|
1575
|
+
function gt(e) {
|
|
1576
|
+
let t = ht(e);
|
|
1577
|
+
return t === V || mt(t) ? dt : `${dt}?next=${encodeURIComponent(t)}`;
|
|
1427
1578
|
}
|
|
1428
|
-
function
|
|
1429
|
-
if (typeof window > "u") return
|
|
1579
|
+
function _t() {
|
|
1580
|
+
if (typeof window > "u") return dt;
|
|
1430
1581
|
let { pathname: e, search: t, hash: n } = window.location;
|
|
1431
|
-
return
|
|
1582
|
+
return gt(`${e}${t}${n}`);
|
|
1432
1583
|
}
|
|
1433
1584
|
//#endregion
|
|
1434
1585
|
//#region src/embed/protocol.ts
|
|
1435
|
-
var
|
|
1586
|
+
var vt = "declarion-embed", yt = {
|
|
1436
1587
|
ready: "ready",
|
|
1437
1588
|
setToken: "set-token",
|
|
1438
1589
|
tokenExpired: "token-expired",
|
|
@@ -1445,10 +1596,10 @@ var _t = "declarion-embed", vt = {
|
|
|
1445
1596
|
navigate: "navigate",
|
|
1446
1597
|
setTheme: "set-theme"
|
|
1447
1598
|
};
|
|
1448
|
-
function
|
|
1599
|
+
function bt(e, t, n) {
|
|
1449
1600
|
if (!e || typeof window > "u" || window.parent === window) return !1;
|
|
1450
1601
|
let r = {
|
|
1451
|
-
source:
|
|
1602
|
+
source: vt,
|
|
1452
1603
|
protocol: 1,
|
|
1453
1604
|
type: t,
|
|
1454
1605
|
payload: n
|
|
@@ -1457,28 +1608,28 @@ function yt(e, t, n) {
|
|
|
1457
1608
|
}
|
|
1458
1609
|
//#endregion
|
|
1459
1610
|
//#region src/embed/token.ts
|
|
1460
|
-
var
|
|
1611
|
+
var xt = 15e3, St = 5e3, H = {
|
|
1461
1612
|
active: !1,
|
|
1462
1613
|
parentOrigin: null,
|
|
1463
1614
|
current: null,
|
|
1464
1615
|
pending: null
|
|
1465
1616
|
};
|
|
1466
|
-
function
|
|
1617
|
+
function Ct(e) {
|
|
1467
1618
|
H.active = !0, H.parentOrigin = e;
|
|
1468
1619
|
}
|
|
1469
|
-
function
|
|
1620
|
+
function wt() {
|
|
1470
1621
|
return H.active;
|
|
1471
1622
|
}
|
|
1472
|
-
function
|
|
1623
|
+
function Tt() {
|
|
1473
1624
|
return H.current?.token ?? null;
|
|
1474
1625
|
}
|
|
1475
|
-
function
|
|
1626
|
+
function Et() {
|
|
1476
1627
|
return H.parentOrigin;
|
|
1477
1628
|
}
|
|
1478
|
-
function
|
|
1479
|
-
return !H.current || Date.now() >= H.current.expiresAt -
|
|
1629
|
+
function Dt() {
|
|
1630
|
+
return !H.current || Date.now() >= H.current.expiresAt - St;
|
|
1480
1631
|
}
|
|
1481
|
-
function
|
|
1632
|
+
function Ot(e) {
|
|
1482
1633
|
if (!e.token || typeof e.token != "string") return;
|
|
1483
1634
|
let t = Date.parse(e.expires_at);
|
|
1484
1635
|
if (!Number.isNaN(t) && (H.current = {
|
|
@@ -1489,31 +1640,31 @@ function Dt(e) {
|
|
|
1489
1640
|
H.pending = null, clearTimeout(t.timer), t.resolve(e.token);
|
|
1490
1641
|
}
|
|
1491
1642
|
}
|
|
1492
|
-
function
|
|
1643
|
+
function kt() {
|
|
1493
1644
|
H.current = null;
|
|
1494
1645
|
}
|
|
1495
|
-
function
|
|
1496
|
-
if (!
|
|
1646
|
+
function At() {
|
|
1647
|
+
if (!Dt() && H.current) return Promise.resolve(H.current.token);
|
|
1497
1648
|
if (H.pending) return H.pending.promise;
|
|
1498
1649
|
let e, t, n = new Promise((n, r) => {
|
|
1499
1650
|
e = n, t = r;
|
|
1500
1651
|
}), r = setTimeout(() => {
|
|
1501
|
-
H.pending && H.pending.promise === n && (H.pending = null), t(/* @__PURE__ */ Error(`embed token wait timed out after ${
|
|
1502
|
-
},
|
|
1652
|
+
H.pending && H.pending.promise === n && (H.pending = null), t(/* @__PURE__ */ Error(`embed token wait timed out after ${xt}ms`));
|
|
1653
|
+
}, xt);
|
|
1503
1654
|
return H.pending = {
|
|
1504
1655
|
promise: n,
|
|
1505
1656
|
resolve: e,
|
|
1506
1657
|
reject: t,
|
|
1507
1658
|
timer: r
|
|
1508
|
-
},
|
|
1659
|
+
}, bt(H.parentOrigin, yt.tokenExpired, {}), n;
|
|
1509
1660
|
}
|
|
1510
1661
|
//#endregion
|
|
1511
1662
|
//#region src/lib/versionTracker.ts
|
|
1512
|
-
var
|
|
1513
|
-
function
|
|
1663
|
+
var jt = "X-Declarion-Version", Mt = "declarion-version";
|
|
1664
|
+
function Nt() {
|
|
1514
1665
|
if (typeof BroadcastChannel > "u") return null;
|
|
1515
1666
|
try {
|
|
1516
|
-
return new BroadcastChannel(
|
|
1667
|
+
return new BroadcastChannel(Mt);
|
|
1517
1668
|
} catch {
|
|
1518
1669
|
return null;
|
|
1519
1670
|
}
|
|
@@ -1526,8 +1677,8 @@ var U = {
|
|
|
1526
1677
|
listeners: /* @__PURE__ */ new Set(),
|
|
1527
1678
|
channel: null
|
|
1528
1679
|
};
|
|
1529
|
-
function
|
|
1530
|
-
U.channel || typeof BroadcastChannel > "u" || (U.channel =
|
|
1680
|
+
function Pt() {
|
|
1681
|
+
U.channel || typeof BroadcastChannel > "u" || (U.channel = Nt(), U.channel && U.channel.addEventListener("message", (e) => {
|
|
1531
1682
|
let t = e.data;
|
|
1532
1683
|
if (!(!t || t.type !== "drift" || !t.delta) && !U.hasReportedDrift) {
|
|
1533
1684
|
U.hasReportedDrift = !0;
|
|
@@ -1535,30 +1686,30 @@ function Nt() {
|
|
|
1535
1686
|
}
|
|
1536
1687
|
}));
|
|
1537
1688
|
}
|
|
1538
|
-
function
|
|
1539
|
-
if (
|
|
1540
|
-
let t = e.get(
|
|
1689
|
+
function Ft(e) {
|
|
1690
|
+
if (Pt(), !e) return;
|
|
1691
|
+
let t = e.get(jt);
|
|
1541
1692
|
if (t) {
|
|
1542
1693
|
if (!U.firstSeen) {
|
|
1543
1694
|
U.firstSeen = t;
|
|
1544
1695
|
return;
|
|
1545
1696
|
}
|
|
1546
|
-
t !== U.firstSeen && (U.hasReportedDrift ||
|
|
1547
|
-
|
|
1697
|
+
t !== U.firstSeen && (U.hasReportedDrift || It().catch(() => {
|
|
1698
|
+
Rt({
|
|
1548
1699
|
kind: "unknown",
|
|
1549
1700
|
observed: t
|
|
1550
1701
|
});
|
|
1551
1702
|
}));
|
|
1552
1703
|
}
|
|
1553
1704
|
}
|
|
1554
|
-
async function
|
|
1555
|
-
|
|
1705
|
+
async function It() {
|
|
1706
|
+
Pt();
|
|
1556
1707
|
let e;
|
|
1557
1708
|
try {
|
|
1558
1709
|
let t = {};
|
|
1559
1710
|
U.firstSeen && (t["If-None-Match"] = `"${U.firstSeen}"`), e = await fetch("/api/version", {
|
|
1560
1711
|
method: "GET",
|
|
1561
|
-
credentials:
|
|
1712
|
+
credentials: wt() ? "omit" : "include",
|
|
1562
1713
|
headers: t
|
|
1563
1714
|
});
|
|
1564
1715
|
} catch {
|
|
@@ -1579,18 +1730,18 @@ async function Ft() {
|
|
|
1579
1730
|
asset: t.asset_fingerprint,
|
|
1580
1731
|
binary: t.binary_fingerprint
|
|
1581
1732
|
} : void 0;
|
|
1582
|
-
U.firstSeen ||= n, !U.firstComponents && r && n === U.firstSeen && (U.firstComponents = r), n !== U.firstSeen &&
|
|
1583
|
-
kind:
|
|
1733
|
+
U.firstSeen ||= n, !U.firstComponents && r && n === U.firstSeen && (U.firstComponents = r), n !== U.firstSeen && Rt({
|
|
1734
|
+
kind: Lt(U.firstComponents, r),
|
|
1584
1735
|
observed: n,
|
|
1585
1736
|
components: r
|
|
1586
1737
|
});
|
|
1587
1738
|
}
|
|
1588
|
-
function
|
|
1739
|
+
function Lt(e, t) {
|
|
1589
1740
|
if (!e || !t) return "unknown";
|
|
1590
1741
|
let n = e.schema !== t.schema, r = e.asset !== t.asset, i = e.binary !== t.binary;
|
|
1591
1742
|
return n && !r && !i ? "schema-only" : r || i ? "asset-or-binary" : "unknown";
|
|
1592
1743
|
}
|
|
1593
|
-
function
|
|
1744
|
+
function Rt(e) {
|
|
1594
1745
|
if (!U.hasReportedDrift) {
|
|
1595
1746
|
U.hasReportedDrift = !0, e.kind !== "schema-only" && (U.pendingReload = e);
|
|
1596
1747
|
for (let t of U.listeners) t(e);
|
|
@@ -1600,21 +1751,21 @@ function Lt(e) {
|
|
|
1600
1751
|
delta: e
|
|
1601
1752
|
});
|
|
1602
1753
|
} catch {}
|
|
1603
|
-
|
|
1754
|
+
wt() && e.kind !== "schema-only" && bt(Et(), yt.reloadRequired, { reason: `version drift: ${e.kind}` });
|
|
1604
1755
|
}
|
|
1605
1756
|
}
|
|
1606
|
-
function
|
|
1757
|
+
function zt() {
|
|
1607
1758
|
return U.pendingReload;
|
|
1608
1759
|
}
|
|
1609
|
-
function
|
|
1760
|
+
function Bt(e) {
|
|
1610
1761
|
return U.listeners.add(e), () => {
|
|
1611
1762
|
U.listeners.delete(e);
|
|
1612
1763
|
};
|
|
1613
1764
|
}
|
|
1614
1765
|
//#endregion
|
|
1615
1766
|
//#region src/api/client.ts
|
|
1616
|
-
var
|
|
1617
|
-
function
|
|
1767
|
+
var Vt = (e) => JSON.stringify(e ?? {}), Ht = null, W = "declarion.auth.refresh.lock", Ut = "declarion.auth.refresh.result", Wt = "declarion.auth.refresh", Gt = 3e4, Kt = 100, qt = typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
1768
|
+
function Jt() {
|
|
1618
1769
|
if (typeof window > "u") return !1;
|
|
1619
1770
|
try {
|
|
1620
1771
|
let e = window.localStorage, t = `${W}.probe`;
|
|
@@ -1623,10 +1774,10 @@ function qt() {
|
|
|
1623
1774
|
return !1;
|
|
1624
1775
|
}
|
|
1625
1776
|
}
|
|
1626
|
-
function
|
|
1777
|
+
function Yt() {
|
|
1627
1778
|
return typeof navigator > "u" ? null : navigator.locks ?? null;
|
|
1628
1779
|
}
|
|
1629
|
-
function
|
|
1780
|
+
function Xt(e) {
|
|
1630
1781
|
if (!e) return null;
|
|
1631
1782
|
try {
|
|
1632
1783
|
let t = JSON.parse(e);
|
|
@@ -1638,7 +1789,7 @@ function Yt(e) {
|
|
|
1638
1789
|
return null;
|
|
1639
1790
|
}
|
|
1640
1791
|
}
|
|
1641
|
-
function
|
|
1792
|
+
function Zt(e) {
|
|
1642
1793
|
if (!e) return null;
|
|
1643
1794
|
try {
|
|
1644
1795
|
let t = JSON.parse(e);
|
|
@@ -1652,47 +1803,47 @@ function Xt(e) {
|
|
|
1652
1803
|
return null;
|
|
1653
1804
|
}
|
|
1654
1805
|
}
|
|
1655
|
-
function
|
|
1656
|
-
if (!
|
|
1657
|
-
let t =
|
|
1806
|
+
function Qt(e) {
|
|
1807
|
+
if (!Jt()) return null;
|
|
1808
|
+
let t = Zt(window.localStorage.getItem(Ut));
|
|
1658
1809
|
return !t || t.updated_at < e ? null : t;
|
|
1659
1810
|
}
|
|
1660
|
-
function
|
|
1811
|
+
function $t(e) {
|
|
1661
1812
|
if (!e.ok) throw new G(e.status ?? 401);
|
|
1662
1813
|
}
|
|
1663
|
-
function
|
|
1664
|
-
let t =
|
|
1665
|
-
if (t && t.expires_at > e && t.owner !==
|
|
1814
|
+
function en(e = Date.now()) {
|
|
1815
|
+
let t = Xt(window.localStorage.getItem(W));
|
|
1816
|
+
if (t && t.expires_at > e && t.owner !== qt) return !1;
|
|
1666
1817
|
let n = {
|
|
1667
|
-
owner:
|
|
1668
|
-
expires_at: e +
|
|
1818
|
+
owner: qt,
|
|
1819
|
+
expires_at: e + Gt
|
|
1669
1820
|
};
|
|
1670
|
-
return window.localStorage.setItem(W, JSON.stringify(n)),
|
|
1821
|
+
return window.localStorage.setItem(W, JSON.stringify(n)), Xt(window.localStorage.getItem(W))?.owner === qt;
|
|
1671
1822
|
}
|
|
1672
|
-
function
|
|
1673
|
-
|
|
1823
|
+
function tn() {
|
|
1824
|
+
Xt(window.localStorage.getItem(W))?.owner === qt && window.localStorage.removeItem(W);
|
|
1674
1825
|
}
|
|
1675
|
-
function
|
|
1826
|
+
function nn(e) {
|
|
1676
1827
|
let t = {
|
|
1677
|
-
owner:
|
|
1828
|
+
owner: qt,
|
|
1678
1829
|
updated_at: Date.now(),
|
|
1679
1830
|
...e
|
|
1680
1831
|
};
|
|
1681
|
-
window.localStorage.setItem(
|
|
1832
|
+
window.localStorage.setItem(Ut, JSON.stringify(t));
|
|
1682
1833
|
}
|
|
1683
|
-
async function
|
|
1834
|
+
async function rn(e) {
|
|
1684
1835
|
return new Promise((t, n) => {
|
|
1685
1836
|
let r = !1, i = null, a = (e) => {
|
|
1686
1837
|
r || (r = !0, i && clearTimeout(i), window.removeEventListener("storage", c), t(e));
|
|
1687
1838
|
}, o = (e) => {
|
|
1688
1839
|
r || (r = !0, i && clearTimeout(i), window.removeEventListener("storage", c), n(new G(e)));
|
|
1689
1840
|
}, s = () => {
|
|
1690
|
-
let t =
|
|
1841
|
+
let t = Zt(window.localStorage.getItem(Ut));
|
|
1691
1842
|
if (t && t.updated_at >= e) {
|
|
1692
1843
|
t.ok ? a("complete") : o(t.status ?? 401);
|
|
1693
1844
|
return;
|
|
1694
1845
|
}
|
|
1695
|
-
let n =
|
|
1846
|
+
let n = Xt(window.localStorage.getItem(W));
|
|
1696
1847
|
if (!n) {
|
|
1697
1848
|
a("complete");
|
|
1698
1849
|
return;
|
|
@@ -1701,50 +1852,50 @@ async function nn(e) {
|
|
|
1701
1852
|
a("expired");
|
|
1702
1853
|
return;
|
|
1703
1854
|
}
|
|
1704
|
-
i = setTimeout(s,
|
|
1855
|
+
i = setTimeout(s, Kt);
|
|
1705
1856
|
}, c = (e) => {
|
|
1706
|
-
(e.key === W || e.key ===
|
|
1857
|
+
(e.key === W || e.key === Ut) && (i && clearTimeout(i), s());
|
|
1707
1858
|
};
|
|
1708
1859
|
window.addEventListener("storage", c), s();
|
|
1709
1860
|
});
|
|
1710
1861
|
}
|
|
1711
|
-
async function
|
|
1712
|
-
let t =
|
|
1713
|
-
return t ? (await t.request(
|
|
1714
|
-
let t =
|
|
1862
|
+
async function an(e) {
|
|
1863
|
+
let t = Yt();
|
|
1864
|
+
return t ? (await t.request(Wt, { mode: "exclusive" }, async () => {
|
|
1865
|
+
let t = Qt(e);
|
|
1715
1866
|
if (t) {
|
|
1716
|
-
|
|
1867
|
+
$t(t);
|
|
1717
1868
|
return;
|
|
1718
1869
|
}
|
|
1719
1870
|
try {
|
|
1720
|
-
await
|
|
1871
|
+
await hn(), Jt() && nn({ ok: !0 });
|
|
1721
1872
|
} catch (e) {
|
|
1722
|
-
throw e instanceof G &&
|
|
1873
|
+
throw e instanceof G && Jt() && nn({
|
|
1723
1874
|
ok: !1,
|
|
1724
1875
|
status: e.status
|
|
1725
1876
|
}), e;
|
|
1726
1877
|
}
|
|
1727
1878
|
}), !0) : !1;
|
|
1728
1879
|
}
|
|
1729
|
-
async function
|
|
1880
|
+
async function on() {
|
|
1730
1881
|
let e = Date.now();
|
|
1731
|
-
if (!await
|
|
1732
|
-
if (!
|
|
1733
|
-
await
|
|
1882
|
+
if (!await an(e)) {
|
|
1883
|
+
if (!Jt()) {
|
|
1884
|
+
await hn();
|
|
1734
1885
|
return;
|
|
1735
1886
|
}
|
|
1736
|
-
if (
|
|
1737
|
-
await
|
|
1887
|
+
if (en(e)) try {
|
|
1888
|
+
await hn(), nn({ ok: !0 });
|
|
1738
1889
|
return;
|
|
1739
1890
|
} catch (e) {
|
|
1740
|
-
throw e instanceof G &&
|
|
1891
|
+
throw e instanceof G && nn({
|
|
1741
1892
|
ok: !1,
|
|
1742
1893
|
status: e.status
|
|
1743
1894
|
}), e;
|
|
1744
1895
|
} finally {
|
|
1745
|
-
|
|
1896
|
+
tn();
|
|
1746
1897
|
}
|
|
1747
|
-
await
|
|
1898
|
+
await rn(e) === "expired" && await on();
|
|
1748
1899
|
}
|
|
1749
1900
|
}
|
|
1750
1901
|
var G = class extends Error {
|
|
@@ -1752,83 +1903,83 @@ var G = class extends Error {
|
|
|
1752
1903
|
constructor(e) {
|
|
1753
1904
|
super(`refresh failed terminally (${e})`), this.status = e, this.name = "RefreshDeadError";
|
|
1754
1905
|
}
|
|
1755
|
-
},
|
|
1756
|
-
function
|
|
1757
|
-
|
|
1906
|
+
}, sn = null, cn = null, ln = 3e4, un = 5e3;
|
|
1907
|
+
function dn() {
|
|
1908
|
+
gn().catch((e) => {
|
|
1758
1909
|
e instanceof G && K();
|
|
1759
1910
|
});
|
|
1760
1911
|
}
|
|
1761
|
-
function
|
|
1762
|
-
if (
|
|
1912
|
+
function fn(e) {
|
|
1913
|
+
if (sn &&= (clearTimeout(sn), null), cn = null, !e || typeof window > "u") return;
|
|
1763
1914
|
let t = Date.parse(e);
|
|
1764
1915
|
if (Number.isNaN(t)) return;
|
|
1765
|
-
|
|
1766
|
-
let n = Math.max(t - Date.now() -
|
|
1767
|
-
|
|
1768
|
-
|
|
1916
|
+
cn = t;
|
|
1917
|
+
let n = Math.max(t - Date.now() - ln, un);
|
|
1918
|
+
sn = setTimeout(() => {
|
|
1919
|
+
sn = null, dn();
|
|
1769
1920
|
}, n);
|
|
1770
1921
|
}
|
|
1771
|
-
function
|
|
1772
|
-
|
|
1922
|
+
function pn() {
|
|
1923
|
+
sn &&= (clearTimeout(sn), null), cn = null;
|
|
1773
1924
|
}
|
|
1774
1925
|
typeof document < "u" && document.addEventListener("visibilitychange", () => {
|
|
1775
|
-
document.visibilityState === "visible" &&
|
|
1926
|
+
document.visibilityState === "visible" && cn !== null && Date.now() >= cn - ln && dn();
|
|
1776
1927
|
});
|
|
1777
|
-
async function
|
|
1928
|
+
async function mn(e) {
|
|
1778
1929
|
try {
|
|
1779
1930
|
let t = await e.json();
|
|
1780
|
-
|
|
1931
|
+
fn(t?.result?.expires_at ?? t?.expires_at);
|
|
1781
1932
|
} catch {}
|
|
1782
1933
|
}
|
|
1783
|
-
async function
|
|
1934
|
+
async function hn() {
|
|
1784
1935
|
let e = {
|
|
1785
1936
|
method: "POST",
|
|
1786
1937
|
credentials: "include",
|
|
1787
1938
|
headers: { "Content-Type": "application/json" },
|
|
1788
|
-
body:
|
|
1939
|
+
body: Vt({})
|
|
1789
1940
|
}, t = await fetch("/api/actions/auth.refresh", e);
|
|
1790
1941
|
if (t.status === 429) {
|
|
1791
1942
|
let n = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
1792
1943
|
await new Promise((e) => setTimeout(e, n * 1e3));
|
|
1793
1944
|
let r = await fetch("/api/actions/auth.refresh", e);
|
|
1794
1945
|
if (!r.ok) throw new G(r.status);
|
|
1795
|
-
await
|
|
1946
|
+
await mn(r);
|
|
1796
1947
|
return;
|
|
1797
1948
|
}
|
|
1798
1949
|
if (!t.ok) throw new G(t.status);
|
|
1799
|
-
await
|
|
1950
|
+
await mn(t);
|
|
1800
1951
|
}
|
|
1801
|
-
async function
|
|
1802
|
-
return
|
|
1803
|
-
|
|
1804
|
-
}),
|
|
1952
|
+
async function gn() {
|
|
1953
|
+
return Ht || (Ht = on().finally(() => {
|
|
1954
|
+
Ht = null;
|
|
1955
|
+
}), Ht);
|
|
1805
1956
|
}
|
|
1806
1957
|
var K = () => {
|
|
1807
1958
|
if (typeof window > "u") return;
|
|
1808
1959
|
let { pathname: e } = window.location;
|
|
1809
|
-
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href =
|
|
1960
|
+
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href = _t());
|
|
1810
1961
|
};
|
|
1811
|
-
function
|
|
1962
|
+
function _n(e) {
|
|
1812
1963
|
let t = K;
|
|
1813
1964
|
return K = e, t;
|
|
1814
1965
|
}
|
|
1815
|
-
function
|
|
1966
|
+
function vn() {
|
|
1816
1967
|
return K;
|
|
1817
1968
|
}
|
|
1818
|
-
var
|
|
1969
|
+
var yn = ({ status: e, code: t, message: n }) => {
|
|
1819
1970
|
console.error(`[API ${e}] ${t}: ${n}`);
|
|
1820
1971
|
};
|
|
1821
|
-
function
|
|
1972
|
+
function bn(e, t, n, r) {
|
|
1822
1973
|
let i = new Headers(e);
|
|
1823
1974
|
return !i.has("Content-Type") && t && i.set("Content-Type", "application/json"), n.setAccept && !i.has("Accept") && i.set("Accept", "*/*"), r && i.set("Authorization", `Bearer ${r}`), i;
|
|
1824
1975
|
}
|
|
1825
|
-
async function
|
|
1826
|
-
let i =
|
|
1976
|
+
async function xn(e, t, n, r) {
|
|
1977
|
+
let i = wt(), a = i ? "omit" : "include", o = bn(t.headers, !!t.body, n, i ? Tt() : null), s = await fetch(e, {
|
|
1827
1978
|
...t,
|
|
1828
1979
|
headers: o,
|
|
1829
1980
|
credentials: a
|
|
1830
1981
|
});
|
|
1831
|
-
if (
|
|
1982
|
+
if (Ft(s.headers), !s.ok) {
|
|
1832
1983
|
let o = "Request failed", c = "UNKNOWN", l, u;
|
|
1833
1984
|
try {
|
|
1834
1985
|
u = await s.json();
|
|
@@ -1837,8 +1988,8 @@ async function bn(e, t, n, r) {
|
|
|
1837
1988
|
} catch {}
|
|
1838
1989
|
if (s.status === 401 && (c === "TOKEN_REFRESH_NEEDED" || c === "UNAUTHORIZED")) try {
|
|
1839
1990
|
let o = null;
|
|
1840
|
-
i ? (
|
|
1841
|
-
let s =
|
|
1991
|
+
i ? (kt(), o = await At()) : await gn();
|
|
1992
|
+
let s = bn(t.headers, !!t.body, n, o), c = await fetch(e, {
|
|
1842
1993
|
...t,
|
|
1843
1994
|
headers: s,
|
|
1844
1995
|
credentials: a
|
|
@@ -1855,7 +2006,7 @@ async function bn(e, t, n, r) {
|
|
|
1855
2006
|
} catch (e) {
|
|
1856
2007
|
throw e instanceof B ? e : (K(), new B(401, o, c, l));
|
|
1857
2008
|
}
|
|
1858
|
-
throw s.status === 401 && K(),
|
|
2009
|
+
throw s.status === 401 && K(), yn({
|
|
1859
2010
|
status: s.status,
|
|
1860
2011
|
code: c,
|
|
1861
2012
|
message: o
|
|
@@ -1863,23 +2014,23 @@ async function bn(e, t, n, r) {
|
|
|
1863
2014
|
}
|
|
1864
2015
|
return r(s);
|
|
1865
2016
|
}
|
|
1866
|
-
function
|
|
2017
|
+
function Sn(e) {
|
|
1867
2018
|
return e.status === 204 ? Promise.resolve(void 0) : e.json();
|
|
1868
2019
|
}
|
|
1869
2020
|
async function q(e, t = {}) {
|
|
1870
|
-
return
|
|
2021
|
+
return xn(e, t, { setAccept: !1 }, Sn);
|
|
1871
2022
|
}
|
|
1872
|
-
async function
|
|
2023
|
+
async function Cn(e) {
|
|
1873
2024
|
return {
|
|
1874
2025
|
blob: await e.blob(),
|
|
1875
|
-
filename:
|
|
2026
|
+
filename: Tn(e.headers),
|
|
1876
2027
|
headers: e.headers
|
|
1877
2028
|
};
|
|
1878
2029
|
}
|
|
1879
|
-
async function
|
|
1880
|
-
return
|
|
2030
|
+
async function wn(e, t = {}) {
|
|
2031
|
+
return xn(e, t, { setAccept: !0 }, Cn);
|
|
1881
2032
|
}
|
|
1882
|
-
function
|
|
2033
|
+
function Tn(e) {
|
|
1883
2034
|
let t = e.get("Content-Disposition");
|
|
1884
2035
|
if (!t) return "";
|
|
1885
2036
|
let n = t.match(/filename\*\s*=\s*([^']*)'([^']*)'([^;]+)/i);
|
|
@@ -1892,48 +2043,48 @@ function wn(e) {
|
|
|
1892
2043
|
async function J(e, t = {}) {
|
|
1893
2044
|
return (await q(`/api/actions/${encodeURIComponent(e)}`, {
|
|
1894
2045
|
method: "POST",
|
|
1895
|
-
body:
|
|
2046
|
+
body: Vt(t)
|
|
1896
2047
|
})).result;
|
|
1897
2048
|
}
|
|
1898
2049
|
//#endregion
|
|
1899
2050
|
//#region src/api/schema.ts
|
|
1900
|
-
function
|
|
2051
|
+
function En(e) {
|
|
1901
2052
|
return {
|
|
1902
2053
|
...e,
|
|
1903
|
-
params: e.params ?
|
|
2054
|
+
params: e.params ? Be.fromObject(e.params) : void 0
|
|
1904
2055
|
};
|
|
1905
2056
|
}
|
|
1906
|
-
function
|
|
2057
|
+
function Dn(e) {
|
|
1907
2058
|
return {
|
|
1908
2059
|
...e,
|
|
1909
|
-
resolved_params: e.resolved_params ?
|
|
2060
|
+
resolved_params: e.resolved_params ? Be.fromObject(e.resolved_params) : void 0
|
|
1910
2061
|
};
|
|
1911
2062
|
}
|
|
1912
|
-
function
|
|
2063
|
+
function On(e) {
|
|
1913
2064
|
let t = {};
|
|
1914
|
-
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t[n] =
|
|
2065
|
+
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t[n] = En(r);
|
|
1915
2066
|
let n = {};
|
|
1916
|
-
if (e.actions) for (let [t, r] of Object.entries(e.actions)) n[t] =
|
|
2067
|
+
if (e.actions) for (let [t, r] of Object.entries(e.actions)) n[t] = Dn(r);
|
|
1917
2068
|
return {
|
|
1918
2069
|
...e,
|
|
1919
|
-
fields:
|
|
1920
|
-
files: e.files ?
|
|
2070
|
+
fields: Be.fromObject(e.fields),
|
|
2071
|
+
files: e.files ? Be.fromObject(e.files) : void 0,
|
|
1921
2072
|
handlers: e.handlers ? t : void 0,
|
|
1922
2073
|
actions: e.actions ? n : void 0
|
|
1923
2074
|
};
|
|
1924
2075
|
}
|
|
1925
|
-
function
|
|
2076
|
+
function kn(e) {
|
|
1926
2077
|
let t = {};
|
|
1927
|
-
if (e.entities) for (let [n, r] of Object.entries(e.entities)) t[n] =
|
|
2078
|
+
if (e.entities) for (let [n, r] of Object.entries(e.entities)) t[n] = On(r);
|
|
1928
2079
|
let n = {};
|
|
1929
2080
|
if (e.structures) for (let [t, r] of Object.entries(e.structures)) n[t] = {
|
|
1930
2081
|
...r,
|
|
1931
|
-
fields:
|
|
2082
|
+
fields: Be.fromObject(r.fields)
|
|
1932
2083
|
};
|
|
1933
2084
|
let r = {};
|
|
1934
|
-
if (e.handlers) for (let [t, n] of Object.entries(e.handlers)) r[t] =
|
|
2085
|
+
if (e.handlers) for (let [t, n] of Object.entries(e.handlers)) r[t] = En(n);
|
|
1935
2086
|
let i = {};
|
|
1936
|
-
if (e.actions) for (let [t, n] of Object.entries(e.actions)) i[t] =
|
|
2087
|
+
if (e.actions) for (let [t, n] of Object.entries(e.actions)) i[t] = Dn(n);
|
|
1937
2088
|
return {
|
|
1938
2089
|
...e,
|
|
1939
2090
|
entities: t,
|
|
@@ -1942,66 +2093,66 @@ function On(e) {
|
|
|
1942
2093
|
actions: i
|
|
1943
2094
|
};
|
|
1944
2095
|
}
|
|
1945
|
-
async function
|
|
1946
|
-
return
|
|
2096
|
+
async function An() {
|
|
2097
|
+
return kn(await q("/api/schema"));
|
|
1947
2098
|
}
|
|
1948
2099
|
//#endregion
|
|
1949
2100
|
//#region src/api/auth.ts
|
|
1950
|
-
async function
|
|
2101
|
+
async function jn() {
|
|
1951
2102
|
return J("auth.check_setup");
|
|
1952
2103
|
}
|
|
1953
|
-
async function
|
|
2104
|
+
async function Mn(e, t, n = !0) {
|
|
1954
2105
|
let r = await J("auth.login", {
|
|
1955
2106
|
email: e,
|
|
1956
2107
|
password: t,
|
|
1957
2108
|
remember: n
|
|
1958
2109
|
});
|
|
1959
|
-
return
|
|
2110
|
+
return fn(r.expires_at), r;
|
|
1960
2111
|
}
|
|
1961
|
-
async function
|
|
2112
|
+
async function Nn(e, t, n) {
|
|
1962
2113
|
let r = await J("auth.signup", {
|
|
1963
2114
|
email: e,
|
|
1964
2115
|
password: t,
|
|
1965
2116
|
display_name: n
|
|
1966
2117
|
});
|
|
1967
|
-
return
|
|
2118
|
+
return fn(r.expires_at), r;
|
|
1968
2119
|
}
|
|
1969
|
-
async function
|
|
2120
|
+
async function Pn() {
|
|
1970
2121
|
return J("auth.me");
|
|
1971
2122
|
}
|
|
1972
|
-
async function
|
|
2123
|
+
async function Fn() {
|
|
1973
2124
|
return (await J("auth.list_tenants")).tenants;
|
|
1974
2125
|
}
|
|
1975
|
-
async function
|
|
2126
|
+
async function In(e) {
|
|
1976
2127
|
let t = await J("auth.switch_tenant", { tenant_id: e });
|
|
1977
|
-
return
|
|
2128
|
+
return fn(t.expires_at), t;
|
|
1978
2129
|
}
|
|
1979
|
-
async function
|
|
2130
|
+
async function Ln() {
|
|
1980
2131
|
await J("auth.logout");
|
|
1981
2132
|
}
|
|
1982
|
-
async function
|
|
2133
|
+
async function Rn(e) {
|
|
1983
2134
|
return (await J("sso_provider.list", e ? { tenant_code: e } : {})).providers;
|
|
1984
2135
|
}
|
|
1985
|
-
function
|
|
2136
|
+
function zn(e, t, n) {
|
|
1986
2137
|
let r = new URLSearchParams();
|
|
1987
2138
|
t && r.set("tenant", t), n && r.set("redirect", n);
|
|
1988
2139
|
let i = r.toString();
|
|
1989
2140
|
return `/api/auth/sso/authorize/${encodeURIComponent(e)}${i ? `?${i}` : ""}`;
|
|
1990
2141
|
}
|
|
1991
|
-
async function
|
|
2142
|
+
async function Bn(e, t, n) {
|
|
1992
2143
|
let r = {
|
|
1993
2144
|
target_user_id: e,
|
|
1994
2145
|
reason: t
|
|
1995
2146
|
};
|
|
1996
2147
|
return n != null && (r.duration_minutes = n), J("impersonation.start", r);
|
|
1997
2148
|
}
|
|
1998
|
-
async function
|
|
2149
|
+
async function Vn() {
|
|
1999
2150
|
return J("impersonation.stop");
|
|
2000
2151
|
}
|
|
2001
|
-
async function
|
|
2152
|
+
async function Hn(e) {
|
|
2002
2153
|
await J("impersonation.revoke", { session_id: e });
|
|
2003
2154
|
}
|
|
2004
|
-
async function
|
|
2155
|
+
async function Un(e, t) {
|
|
2005
2156
|
await J("auth.change_password", {
|
|
2006
2157
|
current_password: e,
|
|
2007
2158
|
new_password: t
|
|
@@ -2009,7 +2160,7 @@ async function Hn(e, t) {
|
|
|
2009
2160
|
}
|
|
2010
2161
|
//#endregion
|
|
2011
2162
|
//#region src/stores/auth.ts
|
|
2012
|
-
var
|
|
2163
|
+
var Wn = C((e) => ({
|
|
2013
2164
|
user: null,
|
|
2014
2165
|
isAuthenticated: !1,
|
|
2015
2166
|
isLoading: !0,
|
|
@@ -2017,9 +2168,9 @@ var Un = C((e) => ({
|
|
|
2017
2168
|
tenants: [],
|
|
2018
2169
|
initialize: async () => {
|
|
2019
2170
|
try {
|
|
2020
|
-
let t = await
|
|
2171
|
+
let t = await Pn(), n = t.tenant ?? null, r = [];
|
|
2021
2172
|
try {
|
|
2022
|
-
r = await
|
|
2173
|
+
r = await Fn();
|
|
2023
2174
|
} catch {}
|
|
2024
2175
|
e({
|
|
2025
2176
|
user: t,
|
|
@@ -2038,7 +2189,7 @@ var Un = C((e) => ({
|
|
|
2038
2189
|
},
|
|
2039
2190
|
refreshMe: async () => {
|
|
2040
2191
|
try {
|
|
2041
|
-
let t = await
|
|
2192
|
+
let t = await Pn();
|
|
2042
2193
|
e({
|
|
2043
2194
|
user: t,
|
|
2044
2195
|
activeTenant: t.tenant ?? null
|
|
@@ -2060,9 +2211,9 @@ var Un = C((e) => ({
|
|
|
2060
2211
|
e({ activeTenant: t });
|
|
2061
2212
|
},
|
|
2062
2213
|
logout: async () => {
|
|
2063
|
-
|
|
2214
|
+
pn();
|
|
2064
2215
|
try {
|
|
2065
|
-
await
|
|
2216
|
+
await Ln();
|
|
2066
2217
|
} catch {}
|
|
2067
2218
|
e({
|
|
2068
2219
|
user: null,
|
|
@@ -2075,31 +2226,31 @@ var Un = C((e) => ({
|
|
|
2075
2226
|
//#endregion
|
|
2076
2227
|
//#region src/hooks/useSchema.ts
|
|
2077
2228
|
function Y() {
|
|
2078
|
-
let e =
|
|
2229
|
+
let e = Wn((e) => e.isAuthenticated);
|
|
2079
2230
|
return g({
|
|
2080
2231
|
queryKey: ["schema", e],
|
|
2081
|
-
queryFn:
|
|
2232
|
+
queryFn: An,
|
|
2082
2233
|
staleTime: Infinity,
|
|
2083
2234
|
enabled: e
|
|
2084
2235
|
});
|
|
2085
2236
|
}
|
|
2086
2237
|
//#endregion
|
|
2087
2238
|
//#region src/api/data.ts
|
|
2088
|
-
function
|
|
2239
|
+
function Gn(e, t) {
|
|
2089
2240
|
let n = new URL(`/api/data/${e}`, window.location.origin);
|
|
2090
2241
|
if (t.page && n.searchParams.set("page", String(t.page)), t.per_page && n.searchParams.set("per_page", String(t.per_page)), t.sort && n.searchParams.set("sort", t.sort), t.search && n.searchParams.set("search", t.search), t.filters && t.filters.length > 0 && n.searchParams.set("filters", JSON.stringify(t.filters)), t.include_deleted && n.searchParams.set("include_deleted", "true"), t.expand) for (let e of t.expand) n.searchParams.append("expand", e);
|
|
2091
2242
|
return t.select && t.select.length > 0 && n.searchParams.set("select", t.select.join(",")), t.screen && n.searchParams.set("screen", t.screen), t.preview && n.searchParams.set("preview", "true"), t.count && n.searchParams.set("count", t.count), n.pathname + n.search;
|
|
2092
2243
|
}
|
|
2093
|
-
async function
|
|
2094
|
-
if (
|
|
2095
|
-
let n =
|
|
2244
|
+
async function Kn(e, t = {}, n = {}) {
|
|
2245
|
+
if (ar) {
|
|
2246
|
+
let n = ar(e, t);
|
|
2096
2247
|
if (n !== void 0) return n;
|
|
2097
2248
|
}
|
|
2098
|
-
return q(
|
|
2249
|
+
return q(Gn(e, t), { signal: n.signal });
|
|
2099
2250
|
}
|
|
2100
|
-
async function
|
|
2101
|
-
if (
|
|
2102
|
-
let n =
|
|
2251
|
+
async function qn(e, t) {
|
|
2252
|
+
if (or) {
|
|
2253
|
+
let n = or(e, t);
|
|
2103
2254
|
if (n !== void 0) return n;
|
|
2104
2255
|
}
|
|
2105
2256
|
let n = new URLSearchParams();
|
|
@@ -2107,40 +2258,40 @@ async function Kn(e, t) {
|
|
|
2107
2258
|
else for (let [e, r] of Object.entries(t)) n.set(e, r);
|
|
2108
2259
|
return q(`/api/data/${e}?${n.toString()}`);
|
|
2109
2260
|
}
|
|
2110
|
-
async function
|
|
2111
|
-
return { data: ((await
|
|
2261
|
+
async function Jn(e, t) {
|
|
2262
|
+
return { data: ((await lr(`${e}.__create`, {
|
|
2112
2263
|
entity: e,
|
|
2113
2264
|
fields: t
|
|
2114
2265
|
})).result?.rows ?? [])[0] };
|
|
2115
2266
|
}
|
|
2116
|
-
async function
|
|
2117
|
-
let r = typeof t == "string" ? t :
|
|
2118
|
-
return { data: ((await
|
|
2267
|
+
async function Yn(e, t, n) {
|
|
2268
|
+
let r = typeof t == "string" ? t : Zn(t);
|
|
2269
|
+
return { data: ((await lr(`${e}.__update`, {
|
|
2119
2270
|
object_ids: [r],
|
|
2120
2271
|
entity: e,
|
|
2121
2272
|
fields: n
|
|
2122
2273
|
})).result?.rows ?? [])[0] };
|
|
2123
2274
|
}
|
|
2124
|
-
async function
|
|
2125
|
-
let n = typeof t == "string" ? t :
|
|
2126
|
-
await
|
|
2275
|
+
async function Xn(e, t) {
|
|
2276
|
+
let n = typeof t == "string" ? t : Zn(t);
|
|
2277
|
+
await lr(`${e}.__delete`, {
|
|
2127
2278
|
object_ids: [n],
|
|
2128
2279
|
entity: e
|
|
2129
2280
|
});
|
|
2130
2281
|
}
|
|
2131
|
-
function
|
|
2282
|
+
function Zn(e) {
|
|
2132
2283
|
let t = Object.values(e);
|
|
2133
2284
|
return t.length === 1 ? t[0] : t.join("");
|
|
2134
2285
|
}
|
|
2135
|
-
async function
|
|
2136
|
-
let n = typeof t == "string" ? t :
|
|
2137
|
-
await
|
|
2286
|
+
async function Qn(e, t) {
|
|
2287
|
+
let n = typeof t == "string" ? t : Zn(t);
|
|
2288
|
+
await lr(`${e}.__restore`, {
|
|
2138
2289
|
object_ids: [n],
|
|
2139
2290
|
entity: e
|
|
2140
2291
|
});
|
|
2141
2292
|
}
|
|
2142
|
-
async function
|
|
2143
|
-
let n = await
|
|
2293
|
+
async function $n(e, t) {
|
|
2294
|
+
let n = await wn(`/api/data/${e}/export`, {
|
|
2144
2295
|
method: "POST",
|
|
2145
2296
|
body: JSON.stringify(t)
|
|
2146
2297
|
});
|
|
@@ -2149,7 +2300,7 @@ async function Qn(e, t) {
|
|
|
2149
2300
|
filename: n.filename
|
|
2150
2301
|
};
|
|
2151
2302
|
}
|
|
2152
|
-
var
|
|
2303
|
+
var er = class extends Error {
|
|
2153
2304
|
status;
|
|
2154
2305
|
response;
|
|
2155
2306
|
constructor(e, t) {
|
|
@@ -2157,55 +2308,55 @@ var $n = class extends Error {
|
|
|
2157
2308
|
super(n || "Action failed"), this.name = "ActionBatchError", this.status = e, this.response = t;
|
|
2158
2309
|
}
|
|
2159
2310
|
};
|
|
2160
|
-
function
|
|
2311
|
+
function tr(e) {
|
|
2161
2312
|
if (!e || typeof e != "object") return !1;
|
|
2162
2313
|
let t = e;
|
|
2163
2314
|
return typeof t.status == "string" && Array.isArray(t.errors);
|
|
2164
2315
|
}
|
|
2165
|
-
function
|
|
2316
|
+
function nr(e, t) {
|
|
2166
2317
|
let n = { ...e ?? {} };
|
|
2167
2318
|
if ("object_ids" in n) throw Error("handler param \"object_ids\" collides with reserved key");
|
|
2168
2319
|
if ("_ids" in n) throw Error("handler param \"_ids\" is a removed legacy key; use object_ids");
|
|
2169
2320
|
return t !== void 0 && (n.object_ids = t), n;
|
|
2170
2321
|
}
|
|
2171
|
-
var
|
|
2172
|
-
function
|
|
2173
|
-
let t =
|
|
2174
|
-
return
|
|
2175
|
-
}
|
|
2176
|
-
var ir = null, ar = null;
|
|
2177
|
-
function or(e) {
|
|
2178
|
-
let t = ir;
|
|
2179
|
-
return ir = e, t;
|
|
2322
|
+
var rr = null;
|
|
2323
|
+
function ir(e) {
|
|
2324
|
+
let t = rr;
|
|
2325
|
+
return rr = e, t;
|
|
2180
2326
|
}
|
|
2327
|
+
var ar = null, or = null;
|
|
2181
2328
|
function sr(e) {
|
|
2182
2329
|
let t = ar;
|
|
2183
2330
|
return ar = e, t;
|
|
2184
2331
|
}
|
|
2185
|
-
|
|
2186
|
-
|
|
2332
|
+
function cr(e) {
|
|
2333
|
+
let t = or;
|
|
2334
|
+
return or = e, t;
|
|
2335
|
+
}
|
|
2336
|
+
async function lr(e, t) {
|
|
2337
|
+
if (rr) return rr(e, t);
|
|
2187
2338
|
try {
|
|
2188
2339
|
return await q(`/api/actions/${e}`, {
|
|
2189
2340
|
method: "POST",
|
|
2190
2341
|
body: JSON.stringify(t)
|
|
2191
2342
|
});
|
|
2192
2343
|
} catch (e) {
|
|
2193
|
-
throw e instanceof B &&
|
|
2344
|
+
throw e instanceof B && tr(e.raw) ? new er(e.status, e.raw) : e;
|
|
2194
2345
|
}
|
|
2195
2346
|
}
|
|
2196
|
-
async function
|
|
2347
|
+
async function ur(e, t) {
|
|
2197
2348
|
let n = new URLSearchParams();
|
|
2198
2349
|
return n.set("ids", t.join(",")), q(`/api/associations/${e}?${n.toString()}`);
|
|
2199
2350
|
}
|
|
2200
2351
|
//#endregion
|
|
2201
2352
|
//#region src/embed/params.ts
|
|
2202
|
-
var
|
|
2203
|
-
dr,
|
|
2353
|
+
var dr = "self", fr = "embed", pr = "parent_origin", mr = "theme", hr = [
|
|
2204
2354
|
fr,
|
|
2205
2355
|
pr,
|
|
2356
|
+
mr,
|
|
2206
2357
|
"nav"
|
|
2207
2358
|
];
|
|
2208
|
-
function
|
|
2359
|
+
function gr(e) {
|
|
2209
2360
|
if (!e) return null;
|
|
2210
2361
|
let t;
|
|
2211
2362
|
try {
|
|
@@ -2215,22 +2366,22 @@ function hr(e) {
|
|
|
2215
2366
|
}
|
|
2216
2367
|
return t.origin === "null" ? null : e === t.origin ? t.origin : null;
|
|
2217
2368
|
}
|
|
2218
|
-
function gr(e) {
|
|
2219
|
-
return e === "light" || e === "dark" ? e : null;
|
|
2220
|
-
}
|
|
2221
2369
|
function _r(e) {
|
|
2222
|
-
return e === "
|
|
2370
|
+
return e === "light" || e === "dark" ? e : null;
|
|
2223
2371
|
}
|
|
2224
2372
|
function vr(e) {
|
|
2373
|
+
return e === "delegated" ? "delegated" : dr;
|
|
2374
|
+
}
|
|
2375
|
+
function yr(e) {
|
|
2225
2376
|
let t = typeof e == "string" ? new URLSearchParams(e) : e;
|
|
2226
2377
|
return {
|
|
2227
|
-
enabled: t.get(
|
|
2228
|
-
parentOrigin:
|
|
2229
|
-
theme:
|
|
2230
|
-
navigationMode:
|
|
2378
|
+
enabled: t.get(fr) === "1",
|
|
2379
|
+
parentOrigin: gr(t.get(pr)),
|
|
2380
|
+
theme: _r(t.get(mr)),
|
|
2381
|
+
navigationMode: vr(t.get("nav"))
|
|
2231
2382
|
};
|
|
2232
2383
|
}
|
|
2233
|
-
function
|
|
2384
|
+
function br(e, t) {
|
|
2234
2385
|
if (!t.enabled) return e;
|
|
2235
2386
|
let n = /^[a-z][a-z0-9+.-]*:/i.test(e), r;
|
|
2236
2387
|
try {
|
|
@@ -2239,46 +2390,46 @@ function yr(e, t) {
|
|
|
2239
2390
|
return e;
|
|
2240
2391
|
}
|
|
2241
2392
|
let i = r.searchParams;
|
|
2242
|
-
return t.enabled && i.set(
|
|
2393
|
+
return t.enabled && i.set(fr, "1"), t.parentOrigin && i.set(pr, t.parentOrigin), t.theme && i.set(mr, t.theme), i.set("nav", t.navigationMode), n ? r.toString() : `${r.pathname}${r.search}${r.hash}`;
|
|
2243
2394
|
}
|
|
2244
2395
|
//#endregion
|
|
2245
2396
|
//#region src/embed/EmbedContext.tsx
|
|
2246
|
-
var
|
|
2397
|
+
var xr = i({
|
|
2247
2398
|
enabled: !1,
|
|
2248
2399
|
parentOrigin: null,
|
|
2249
2400
|
theme: null,
|
|
2250
2401
|
navigationMode: "self",
|
|
2251
2402
|
appendEmbedParams: (e) => e
|
|
2252
2403
|
});
|
|
2253
|
-
function
|
|
2404
|
+
function Sr(e) {
|
|
2254
2405
|
return {
|
|
2255
2406
|
enabled: e.enabled,
|
|
2256
2407
|
parentOrigin: e.parentOrigin,
|
|
2257
2408
|
theme: e.theme,
|
|
2258
2409
|
navigationMode: e.navigationMode,
|
|
2259
|
-
appendEmbedParams: (t) =>
|
|
2410
|
+
appendEmbedParams: (t) => br(t, e)
|
|
2260
2411
|
};
|
|
2261
2412
|
}
|
|
2262
|
-
function
|
|
2263
|
-
let n = d(() =>
|
|
2413
|
+
function Cr({ children: e, query: t }) {
|
|
2414
|
+
let n = d(() => Sr(yr(t ?? (typeof window < "u" ? window.location.search : ""))), [t]);
|
|
2264
2415
|
return l(() => {
|
|
2265
2416
|
le(n.enabled);
|
|
2266
|
-
}, [n.enabled]), /* @__PURE__ */ b(
|
|
2417
|
+
}, [n.enabled]), /* @__PURE__ */ b(xr.Provider, {
|
|
2267
2418
|
value: n,
|
|
2268
2419
|
children: e
|
|
2269
2420
|
});
|
|
2270
2421
|
}
|
|
2271
|
-
function
|
|
2272
|
-
return c(
|
|
2422
|
+
function wr() {
|
|
2423
|
+
return c(xr);
|
|
2273
2424
|
}
|
|
2274
2425
|
//#endregion
|
|
2275
2426
|
//#region src/embed/embed-dirty.ts
|
|
2276
|
-
var
|
|
2427
|
+
var Tr = C((e) => ({
|
|
2277
2428
|
isDirty: !1,
|
|
2278
2429
|
setDirty: (t) => e((e) => e.isDirty === t ? e : { isDirty: t })
|
|
2279
2430
|
}));
|
|
2280
|
-
function
|
|
2281
|
-
let n =
|
|
2431
|
+
function Er(e, t) {
|
|
2432
|
+
let n = Tr((e) => e.setDirty);
|
|
2282
2433
|
l(() => {
|
|
2283
2434
|
t && n(e);
|
|
2284
2435
|
}, [
|
|
@@ -2291,7 +2442,7 @@ function Tr(e, t) {
|
|
|
2291
2442
|
}
|
|
2292
2443
|
//#endregion
|
|
2293
2444
|
//#region src/embed/embed-nav-guard.ts
|
|
2294
|
-
var
|
|
2445
|
+
var Dr = C((e, t) => ({
|
|
2295
2446
|
pendingNavigation: null,
|
|
2296
2447
|
requestNavigation: (t) => e({ pendingNavigation: t }),
|
|
2297
2448
|
confirmNavigation: () => {
|
|
@@ -2302,18 +2453,18 @@ var Er = C((e, t) => ({
|
|
|
2302
2453
|
}));
|
|
2303
2454
|
//#endregion
|
|
2304
2455
|
//#region src/embed/screen-location.ts
|
|
2305
|
-
function
|
|
2456
|
+
function Or(e) {
|
|
2306
2457
|
let t = e.replace(/\/+$/, "").split("/").map((e) => e.startsWith(":") ? "[^/]+" : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
2307
2458
|
return RegExp("^" + t.join("/") + "$");
|
|
2308
2459
|
}
|
|
2309
|
-
function
|
|
2460
|
+
function kr(e, t) {
|
|
2310
2461
|
let n = e.replace(/\/+$/, "") || "/";
|
|
2311
2462
|
if (!t) return {
|
|
2312
2463
|
matched: !1,
|
|
2313
2464
|
payload: { route: e }
|
|
2314
2465
|
};
|
|
2315
2466
|
let r, i, a, o;
|
|
2316
|
-
for (let [e, s] of Object.entries(t)) if (s.route &&
|
|
2467
|
+
for (let [e, s] of Object.entries(t)) if (s.route && Or(s.route).test(n)) if (s.route.includes("/:")) a || (a = s, o = e);
|
|
2317
2468
|
else {
|
|
2318
2469
|
r = s, i = e;
|
|
2319
2470
|
break;
|
|
@@ -2338,34 +2489,34 @@ function Or(e, t) {
|
|
|
2338
2489
|
payload: l
|
|
2339
2490
|
};
|
|
2340
2491
|
}
|
|
2341
|
-
function
|
|
2342
|
-
return
|
|
2492
|
+
function Ar(e, t) {
|
|
2493
|
+
return kr(e, t).payload;
|
|
2343
2494
|
}
|
|
2344
2495
|
//#endregion
|
|
2345
2496
|
//#region src/embed/useEmbedNavigate.ts
|
|
2346
|
-
function
|
|
2497
|
+
function jr(e) {
|
|
2347
2498
|
let t = e.search(/[?#]/);
|
|
2348
2499
|
return t === -1 ? e : e.slice(0, t);
|
|
2349
2500
|
}
|
|
2350
|
-
function
|
|
2351
|
-
let e = h(), t = m(), n =
|
|
2501
|
+
function Mr() {
|
|
2502
|
+
let e = h(), t = m(), n = wr(), { data: r } = Y();
|
|
2352
2503
|
return s((i, a) => {
|
|
2353
2504
|
if (!n.enabled) return e(i, a), !0;
|
|
2354
|
-
let o = r?.screens, s =
|
|
2355
|
-
if (o && !s.matched) return
|
|
2356
|
-
route:
|
|
2505
|
+
let o = r?.screens, s = kr(jr(i), o), c = Tr.getState().isDirty && jr(i) !== t.pathname;
|
|
2506
|
+
if (o && !s.matched) return bt(n.parentOrigin, yt.navigationFailed, {
|
|
2507
|
+
route: jr(i),
|
|
2357
2508
|
reason: "unresolved"
|
|
2358
2509
|
}), !1;
|
|
2359
2510
|
if (n.navigationMode === "delegated") {
|
|
2360
2511
|
let e = () => {
|
|
2361
|
-
|
|
2512
|
+
bt(n.parentOrigin, yt.navigationRequested, s.payload);
|
|
2362
2513
|
};
|
|
2363
|
-
return c ? (
|
|
2514
|
+
return c ? (Dr.getState().requestNavigation(e), !1) : (e(), !1);
|
|
2364
2515
|
}
|
|
2365
2516
|
let l = () => {
|
|
2366
2517
|
e(n.appendEmbedParams(i), a);
|
|
2367
2518
|
};
|
|
2368
|
-
return c ? (
|
|
2519
|
+
return c ? (Dr.getState().requestNavigation(l), !1) : (l(), !0);
|
|
2369
2520
|
}, [
|
|
2370
2521
|
e,
|
|
2371
2522
|
t.pathname,
|
|
@@ -2373,29 +2524,29 @@ function jr() {
|
|
|
2373
2524
|
r?.screens
|
|
2374
2525
|
]);
|
|
2375
2526
|
}
|
|
2376
|
-
function
|
|
2377
|
-
let e =
|
|
2527
|
+
function Nr() {
|
|
2528
|
+
let e = Mr();
|
|
2378
2529
|
return s((t, n) => {
|
|
2379
2530
|
e(t, n);
|
|
2380
2531
|
}, [e]);
|
|
2381
2532
|
}
|
|
2382
|
-
function
|
|
2533
|
+
function Pr() {
|
|
2383
2534
|
let e = h();
|
|
2384
2535
|
return s(() => {
|
|
2385
2536
|
let t = () => {
|
|
2386
2537
|
e(-1);
|
|
2387
2538
|
};
|
|
2388
|
-
if (
|
|
2389
|
-
|
|
2539
|
+
if (Tr.getState().isDirty) {
|
|
2540
|
+
Dr.getState().requestNavigation(t);
|
|
2390
2541
|
return;
|
|
2391
2542
|
}
|
|
2392
2543
|
t();
|
|
2393
2544
|
}, [e]);
|
|
2394
2545
|
}
|
|
2395
|
-
function
|
|
2396
|
-
let e =
|
|
2546
|
+
function Fr() {
|
|
2547
|
+
let e = wr();
|
|
2397
2548
|
return s((t, n) => {
|
|
2398
|
-
e.enabled &&
|
|
2549
|
+
e.enabled && bt(e.parentOrigin, yt.navigationFailed, {
|
|
2399
2550
|
route: t,
|
|
2400
2551
|
reason: n
|
|
2401
2552
|
});
|
|
@@ -2403,7 +2554,7 @@ function Pr() {
|
|
|
2403
2554
|
}
|
|
2404
2555
|
//#endregion
|
|
2405
2556
|
//#region src/components/shared/toast/DeclarionToast.tsx
|
|
2406
|
-
var
|
|
2557
|
+
var Ir = {
|
|
2407
2558
|
success: {
|
|
2408
2559
|
tone: "success",
|
|
2409
2560
|
defaultTitle: "Success"
|
|
@@ -2424,8 +2575,8 @@ var Fr = {
|
|
|
2424
2575
|
tone: "info",
|
|
2425
2576
|
defaultTitle: "Working…"
|
|
2426
2577
|
}
|
|
2427
|
-
},
|
|
2428
|
-
function
|
|
2578
|
+
}, Lr = 200;
|
|
2579
|
+
function Rr({ type: e }) {
|
|
2429
2580
|
let n = { display: "flex" };
|
|
2430
2581
|
return e === "loading" ? /* @__PURE__ */ b("span", {
|
|
2431
2582
|
style: {
|
|
@@ -2438,9 +2589,9 @@ function Lr({ type: e }) {
|
|
|
2438
2589
|
children: /* @__PURE__ */ b(e === "success" ? t.check : e === "error" ? t.x : e === "warning" ? t.warning : t.info, { size: 11 })
|
|
2439
2590
|
});
|
|
2440
2591
|
}
|
|
2441
|
-
function
|
|
2442
|
-
let r =
|
|
2443
|
-
S.current || (S.current = !0, g(!0), window.setTimeout(n,
|
|
2592
|
+
function zr({ model: e, onClose: n }) {
|
|
2593
|
+
let r = Ir[e.type] ?? Ir.info, i = r.tone, [a, o] = p(!1), [c, u] = p(!1), [d, m] = p(!1), [h, g] = p(!1), [_, v] = p(1), y = f(e.duration), S = f(!1), C = !e.sticky && e.duration > 0, w = s(() => {
|
|
2594
|
+
S.current || (S.current = !0, g(!0), window.setTimeout(n, Lr));
|
|
2444
2595
|
}, [n]);
|
|
2445
2596
|
l(() => {
|
|
2446
2597
|
y.current = e.duration, v(1);
|
|
@@ -2489,7 +2640,7 @@ function Rr({ model: e, onClose: n }) {
|
|
|
2489
2640
|
boxShadow: "var(--shadow-toast)",
|
|
2490
2641
|
overflow: "hidden",
|
|
2491
2642
|
position: "relative",
|
|
2492
|
-
animation: h ? `dz-toast-out ${
|
|
2643
|
+
animation: h ? `dz-toast-out ${Lr}ms ease-in forwards` : "dz-toast-in 0.24s cubic-bezier(0.16, 1, 0.3, 1)"
|
|
2493
2644
|
},
|
|
2494
2645
|
children: [/* @__PURE__ */ x("div", {
|
|
2495
2646
|
style: {
|
|
@@ -2511,7 +2662,7 @@ function Rr({ model: e, onClose: n }) {
|
|
|
2511
2662
|
justifyContent: "center",
|
|
2512
2663
|
color: E("")
|
|
2513
2664
|
},
|
|
2514
|
-
children: /* @__PURE__ */ b(
|
|
2665
|
+
children: /* @__PURE__ */ b(Rr, { type: e.type })
|
|
2515
2666
|
}),
|
|
2516
2667
|
/* @__PURE__ */ x("div", {
|
|
2517
2668
|
style: {
|
|
@@ -2704,28 +2855,28 @@ function Rr({ model: e, onClose: n }) {
|
|
|
2704
2855
|
}
|
|
2705
2856
|
//#endregion
|
|
2706
2857
|
//#region src/lib/toast.tsx
|
|
2707
|
-
var
|
|
2858
|
+
var Br = {
|
|
2708
2859
|
success: 4e3,
|
|
2709
2860
|
info: 6e3,
|
|
2710
2861
|
warning: 8e3,
|
|
2711
2862
|
error: 0,
|
|
2712
2863
|
loading: 0
|
|
2713
|
-
}, X = /* @__PURE__ */ new Map(),
|
|
2714
|
-
function
|
|
2715
|
-
v.custom(() => /* @__PURE__ */ b(
|
|
2864
|
+
}, X = /* @__PURE__ */ new Map(), Vr = /* @__PURE__ */ new Map(), Hr = 0, Ur = () => `dz-${++Hr}`;
|
|
2865
|
+
function Wr(e) {
|
|
2866
|
+
v.custom(() => /* @__PURE__ */ b(zr, {
|
|
2716
2867
|
model: e,
|
|
2717
2868
|
onClose: () => v.dismiss(e.id)
|
|
2718
2869
|
}), {
|
|
2719
2870
|
id: e.id,
|
|
2720
2871
|
duration: Infinity,
|
|
2721
2872
|
onDismiss: () => {
|
|
2722
|
-
X.delete(String(e.id)), e.group &&
|
|
2873
|
+
X.delete(String(e.id)), e.group && Vr.get(e.group) === e.id && Vr.delete(e.group);
|
|
2723
2874
|
}
|
|
2724
2875
|
});
|
|
2725
2876
|
}
|
|
2726
|
-
function
|
|
2877
|
+
function Gr(e, t, n, r = {}) {
|
|
2727
2878
|
if (r.group) {
|
|
2728
|
-
let e =
|
|
2879
|
+
let e = Vr.get(r.group);
|
|
2729
2880
|
if (e && X.has(e)) {
|
|
2730
2881
|
let r = X.get(e), i = {
|
|
2731
2882
|
...r,
|
|
@@ -2734,10 +2885,10 @@ function Wr(e, t, n, r = {}) {
|
|
|
2734
2885
|
count: (r.count ?? 1) + 1,
|
|
2735
2886
|
createdAt: Date.now()
|
|
2736
2887
|
};
|
|
2737
|
-
return X.set(e, i),
|
|
2888
|
+
return X.set(e, i), Wr(i), e;
|
|
2738
2889
|
}
|
|
2739
2890
|
}
|
|
2740
|
-
let i = r.id ??
|
|
2891
|
+
let i = r.id ?? Ur(), a = r.duration ?? Br[e], o = {
|
|
2741
2892
|
id: i,
|
|
2742
2893
|
type: e,
|
|
2743
2894
|
title: t,
|
|
@@ -2751,12 +2902,12 @@ function Wr(e, t, n, r = {}) {
|
|
|
2751
2902
|
createdAt: Date.now(),
|
|
2752
2903
|
group: r.group
|
|
2753
2904
|
};
|
|
2754
|
-
return X.set(i, o), r.group &&
|
|
2905
|
+
return X.set(i, o), r.group && Vr.set(r.group, i), Wr(o), i;
|
|
2755
2906
|
}
|
|
2756
|
-
function
|
|
2907
|
+
function Kr(e, t) {
|
|
2757
2908
|
let n = X.get(e);
|
|
2758
2909
|
if (!n) return;
|
|
2759
|
-
let r = t.type ?? n.type, i = t.duration ?? (t.type ?
|
|
2910
|
+
let r = t.type ?? n.type, i = t.duration ?? (t.type ? Br[r] : n.duration), a = {
|
|
2760
2911
|
...n,
|
|
2761
2912
|
...t,
|
|
2762
2913
|
type: r,
|
|
@@ -2764,70 +2915,70 @@ function Gr(e, t) {
|
|
|
2764
2915
|
sticky: t.sticky ?? i === 0,
|
|
2765
2916
|
createdAt: Date.now()
|
|
2766
2917
|
};
|
|
2767
|
-
X.set(e, a),
|
|
2918
|
+
X.set(e, a), Wr(a);
|
|
2768
2919
|
}
|
|
2769
2920
|
var Z = {
|
|
2770
|
-
success: (e, t, n) =>
|
|
2771
|
-
info: (e, t, n) =>
|
|
2772
|
-
warning: (e, t, n) =>
|
|
2773
|
-
error: (e, t, n) =>
|
|
2774
|
-
loading: (e, t, n) =>
|
|
2775
|
-
update:
|
|
2921
|
+
success: (e, t, n) => Gr("success", e, t, n),
|
|
2922
|
+
info: (e, t, n) => Gr("info", e, t, n),
|
|
2923
|
+
warning: (e, t, n) => Gr("warning", e, t, n),
|
|
2924
|
+
error: (e, t, n) => Gr("error", e, t, n),
|
|
2925
|
+
loading: (e, t, n) => Gr("loading", e, t, n),
|
|
2926
|
+
update: Kr,
|
|
2776
2927
|
dismiss: (e) => v.dismiss(e),
|
|
2777
2928
|
dismissAll: () => v.dismiss()
|
|
2778
|
-
},
|
|
2779
|
-
function
|
|
2929
|
+
}, qr = o(() => import("./MarkdownRenderer-DeguFsZL.js").then((e) => ({ default: e.MarkdownRenderer })));
|
|
2930
|
+
function Jr() {
|
|
2780
2931
|
return /* @__PURE__ */ b("div", { className: "h-4 w-2/3 rounded bg-muted animate-pulse" });
|
|
2781
2932
|
}
|
|
2782
|
-
function
|
|
2933
|
+
function Yr(e) {
|
|
2783
2934
|
return /* @__PURE__ */ b(r, {
|
|
2784
|
-
fallback: /* @__PURE__ */ b(
|
|
2785
|
-
children: /* @__PURE__ */ b(
|
|
2935
|
+
fallback: /* @__PURE__ */ b(Jr, {}),
|
|
2936
|
+
children: /* @__PURE__ */ b(qr, { ...e })
|
|
2786
2937
|
});
|
|
2787
2938
|
}
|
|
2788
2939
|
//#endregion
|
|
2789
2940
|
//#region src/lib/safe-url.ts
|
|
2790
|
-
var
|
|
2941
|
+
var Xr = [
|
|
2791
2942
|
"http:",
|
|
2792
2943
|
"https:",
|
|
2793
2944
|
"mailto:"
|
|
2794
|
-
],
|
|
2795
|
-
function
|
|
2945
|
+
], Zr = /[\u0000-\u001f\u007f]/g;
|
|
2946
|
+
function Qr(e) {
|
|
2796
2947
|
if (!e) return;
|
|
2797
2948
|
let t = e.trim();
|
|
2798
2949
|
if (!t) return;
|
|
2799
|
-
let n = t.replace(
|
|
2950
|
+
let n = t.replace(Zr, "");
|
|
2800
2951
|
if (!n || n.startsWith("//")) return;
|
|
2801
2952
|
let r = n.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);
|
|
2802
2953
|
if (r) {
|
|
2803
2954
|
let e = r[1].toLowerCase() + ":";
|
|
2804
|
-
if (!
|
|
2955
|
+
if (!Xr.includes(e)) return;
|
|
2805
2956
|
}
|
|
2806
2957
|
return n;
|
|
2807
2958
|
}
|
|
2808
2959
|
//#endregion
|
|
2809
2960
|
//#region src/lib/download.ts
|
|
2810
|
-
var
|
|
2961
|
+
var $r = class extends Error {
|
|
2811
2962
|
code;
|
|
2812
2963
|
constructor(e, t) {
|
|
2813
2964
|
super(e), this.code = t, this.name = "DownloadError";
|
|
2814
2965
|
}
|
|
2815
2966
|
};
|
|
2816
|
-
function
|
|
2817
|
-
return e instanceof
|
|
2967
|
+
function ei(e) {
|
|
2968
|
+
return e instanceof $r && e.code === "FILE_NOT_FOUND";
|
|
2818
2969
|
}
|
|
2819
|
-
async function
|
|
2820
|
-
let n =
|
|
2821
|
-
if (!n) throw new
|
|
2970
|
+
async function ti(e, t) {
|
|
2971
|
+
let n = Qr(e);
|
|
2972
|
+
if (!n) throw new $r(`Refused to download from an unsafe URL: ${e}`);
|
|
2822
2973
|
let r = await fetch(n, { credentials: "same-origin" });
|
|
2823
2974
|
if (!r.ok) {
|
|
2824
|
-
let e = await
|
|
2825
|
-
throw new
|
|
2975
|
+
let e = await ni(r);
|
|
2976
|
+
throw new $r(e.message || `Download failed (${r.status})`, e.code);
|
|
2826
2977
|
}
|
|
2827
2978
|
let i = await r.blob(), a = URL.createObjectURL(i), o = document.createElement("a");
|
|
2828
2979
|
o.href = a, t && (o.download = t), document.body.appendChild(o), o.click(), o.remove(), URL.revokeObjectURL(a);
|
|
2829
2980
|
}
|
|
2830
|
-
async function
|
|
2981
|
+
async function ni(e) {
|
|
2831
2982
|
let t = await e.text();
|
|
2832
2983
|
if (!t) return {};
|
|
2833
2984
|
try {
|
|
@@ -2845,10 +2996,10 @@ async function ti(e) {
|
|
|
2845
2996
|
}
|
|
2846
2997
|
//#endregion
|
|
2847
2998
|
//#region src/types/fieldType.ts
|
|
2848
|
-
var
|
|
2999
|
+
var ri = /* @__PURE__ */ "bool.bytes.date.decimal.email.enum.float.int.int_array.json.multilang.multilang_text.password.phone.ref.rich_text.secret.string.string_array.structure.tags.text.time.timestamp.url.uuid.uuid_array".split(".");
|
|
2849
3000
|
//#endregion
|
|
2850
3001
|
//#region src/components/shared/CopyButton.tsx
|
|
2851
|
-
function
|
|
3002
|
+
function ii({ value: e, title: n, size: r = "icon" }) {
|
|
2852
3003
|
let [i, a] = p(!1), o = s(async (t) => {
|
|
2853
3004
|
t.stopPropagation(), t.preventDefault();
|
|
2854
3005
|
try {
|
|
@@ -2867,7 +3018,7 @@ function ri({ value: e, title: n, size: r = "icon" }) {
|
|
|
2867
3018
|
}
|
|
2868
3019
|
//#endregion
|
|
2869
3020
|
//#region src/components/fields/StringField.tsx
|
|
2870
|
-
function
|
|
3021
|
+
function ai({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
2871
3022
|
if (r === "display") {
|
|
2872
3023
|
let t = I(n);
|
|
2873
3024
|
return e.copyable && t ? /* @__PURE__ */ x("span", {
|
|
@@ -2879,7 +3030,7 @@ function ii({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
2879
3030
|
children: [/* @__PURE__ */ b("span", {
|
|
2880
3031
|
style: { fontSize: 12.5 },
|
|
2881
3032
|
children: t
|
|
2882
|
-
}), /* @__PURE__ */ b(
|
|
3033
|
+
}), /* @__PURE__ */ b(ii, {
|
|
2883
3034
|
value: t,
|
|
2884
3035
|
size: "sm"
|
|
2885
3036
|
})]
|
|
@@ -2901,7 +3052,7 @@ function ii({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
2901
3052
|
}
|
|
2902
3053
|
//#endregion
|
|
2903
3054
|
//#region src/components/fields/TextField.tsx
|
|
2904
|
-
function
|
|
3055
|
+
function oi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fill: a, compact: o, fieldId: s }) {
|
|
2905
3056
|
let c = e.display?.widget;
|
|
2906
3057
|
if (r === "display") {
|
|
2907
3058
|
let t = I(n);
|
|
@@ -2912,7 +3063,7 @@ function ai({ field: e, fieldName: t, value: n, mode: r, onChange: i, fill: a, c
|
|
|
2912
3063
|
},
|
|
2913
3064
|
children: "—"
|
|
2914
3065
|
});
|
|
2915
|
-
let r = c === "markdown" ? /* @__PURE__ */ b(
|
|
3066
|
+
let r = c === "markdown" ? /* @__PURE__ */ b(Yr, { content: t }) : c === "code" ? /* @__PURE__ */ b("pre", {
|
|
2916
3067
|
className: "mono",
|
|
2917
3068
|
style: {
|
|
2918
3069
|
fontSize: 12,
|
|
@@ -2944,7 +3095,7 @@ function ai({ field: e, fieldName: t, value: n, mode: r, onChange: i, fill: a, c
|
|
|
2944
3095
|
top: 0,
|
|
2945
3096
|
right: 0
|
|
2946
3097
|
},
|
|
2947
|
-
children: /* @__PURE__ */ b(
|
|
3098
|
+
children: /* @__PURE__ */ b(ii, {
|
|
2948
3099
|
value: t,
|
|
2949
3100
|
size: "sm"
|
|
2950
3101
|
})
|
|
@@ -2971,8 +3122,8 @@ function ai({ field: e, fieldName: t, value: n, mode: r, onChange: i, fill: a, c
|
|
|
2971
3122
|
}
|
|
2972
3123
|
//#endregion
|
|
2973
3124
|
//#region src/components/fields/EnumField.tsx
|
|
2974
|
-
var
|
|
2975
|
-
function
|
|
3125
|
+
var si = "__declarion_enum_null__";
|
|
3126
|
+
function ci({ field: e, value: t, mode: n, onChange: r, fieldId: i, labelId: a }) {
|
|
2976
3127
|
let o = e.values ?? [], s = o.find((e) => e.code === t);
|
|
2977
3128
|
if (n === "display") return s ? /* @__PURE__ */ b(k, {
|
|
2978
3129
|
tone: s.color ?? "slate",
|
|
@@ -2985,8 +3136,8 @@ function si({ field: e, value: t, mode: n, onChange: r, fieldId: i, labelId: a }
|
|
|
2985
3136
|
},
|
|
2986
3137
|
children: "—"
|
|
2987
3138
|
});
|
|
2988
|
-
let c = !e.required, l = t != null && t !== "" ? I(t) :
|
|
2989
|
-
value:
|
|
3139
|
+
let c = !e.required, l = t != null && t !== "" ? I(t) : si, u = [...c ? [{
|
|
3140
|
+
value: si,
|
|
2990
3141
|
label: "— None —"
|
|
2991
3142
|
}] : [], ...o.map((e) => ({
|
|
2992
3143
|
value: e.code,
|
|
@@ -2998,13 +3149,13 @@ function si({ field: e, value: t, mode: n, onChange: r, fieldId: i, labelId: a }
|
|
|
2998
3149
|
"aria-required": e.required || void 0,
|
|
2999
3150
|
value: l,
|
|
3000
3151
|
options: u,
|
|
3001
|
-
onChange: (e) => r?.(e ===
|
|
3152
|
+
onChange: (e) => r?.(e === si ? null : e),
|
|
3002
3153
|
placeholder: "Select…"
|
|
3003
3154
|
});
|
|
3004
3155
|
}
|
|
3005
3156
|
//#endregion
|
|
3006
3157
|
//#region src/components/fields/EmailField.tsx
|
|
3007
|
-
function
|
|
3158
|
+
function li({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
3008
3159
|
return /* @__PURE__ */ b(P, {
|
|
3009
3160
|
id: i,
|
|
3010
3161
|
name: t,
|
|
@@ -3016,7 +3167,7 @@ function ci({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
|
3016
3167
|
}
|
|
3017
3168
|
//#endregion
|
|
3018
3169
|
//#region src/components/fields/UrlField.tsx
|
|
3019
|
-
function
|
|
3170
|
+
function ui({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
3020
3171
|
return /* @__PURE__ */ b(P, {
|
|
3021
3172
|
id: i,
|
|
3022
3173
|
name: t,
|
|
@@ -3029,7 +3180,7 @@ function li({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
|
3029
3180
|
}
|
|
3030
3181
|
//#endregion
|
|
3031
3182
|
//#region src/components/fields/PhoneField.tsx
|
|
3032
|
-
function
|
|
3183
|
+
function di({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
3033
3184
|
return /* @__PURE__ */ b(P, {
|
|
3034
3185
|
id: i,
|
|
3035
3186
|
name: t,
|
|
@@ -3042,10 +3193,10 @@ function ui({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
|
3042
3193
|
}
|
|
3043
3194
|
//#endregion
|
|
3044
3195
|
//#region src/lib/timestamp.ts
|
|
3045
|
-
function
|
|
3196
|
+
function fi(e = /* @__PURE__ */ new Date()) {
|
|
3046
3197
|
return E(e);
|
|
3047
3198
|
}
|
|
3048
|
-
function
|
|
3199
|
+
function pi(e, t) {
|
|
3049
3200
|
let n = e.match(/([+-]\d{2}:\d{2})$/), r = e.endsWith("Z"), i = new Date(e);
|
|
3050
3201
|
if (isNaN(i.getTime())) return e;
|
|
3051
3202
|
if (n || r) {
|
|
@@ -3071,13 +3222,13 @@ function fi(e, t) {
|
|
|
3071
3222
|
}
|
|
3072
3223
|
return new Intl.DateTimeFormat(void 0, t).format(i);
|
|
3073
3224
|
}
|
|
3074
|
-
function
|
|
3075
|
-
return
|
|
3225
|
+
function mi(e) {
|
|
3226
|
+
return pi(e, {
|
|
3076
3227
|
dateStyle: "medium",
|
|
3077
3228
|
timeStyle: "short"
|
|
3078
3229
|
});
|
|
3079
3230
|
}
|
|
3080
|
-
function
|
|
3231
|
+
function hi(e, t = /* @__PURE__ */ new Date()) {
|
|
3081
3232
|
if (e == null || e === "") return {
|
|
3082
3233
|
text: "—",
|
|
3083
3234
|
absolute: ""
|
|
@@ -3090,7 +3241,7 @@ function mi(e, t = /* @__PURE__ */ new Date()) {
|
|
|
3090
3241
|
absolute: t
|
|
3091
3242
|
};
|
|
3092
3243
|
}
|
|
3093
|
-
let r =
|
|
3244
|
+
let r = mi(typeof e == "string" ? e : n.toISOString()), i = t.getTime() - n.getTime();
|
|
3094
3245
|
return Math.abs(i) > 720 * 60 * 60 * 1e3 ? {
|
|
3095
3246
|
text: E(n, { representation: "date" }),
|
|
3096
3247
|
absolute: r
|
|
@@ -3101,23 +3252,23 @@ function mi(e, t = /* @__PURE__ */ new Date()) {
|
|
|
3101
3252
|
}
|
|
3102
3253
|
//#endregion
|
|
3103
3254
|
//#region src/components/fields/TimestampField.tsx
|
|
3104
|
-
var
|
|
3255
|
+
var gi = {
|
|
3105
3256
|
year: "numeric",
|
|
3106
3257
|
month: "short",
|
|
3107
3258
|
day: "numeric"
|
|
3108
|
-
},
|
|
3109
|
-
...
|
|
3259
|
+
}, _i = {
|
|
3260
|
+
...gi,
|
|
3110
3261
|
hour: "2-digit",
|
|
3111
3262
|
minute: "2-digit"
|
|
3112
3263
|
};
|
|
3113
|
-
function
|
|
3264
|
+
function vi(e, t) {
|
|
3114
3265
|
if (t) {
|
|
3115
3266
|
let t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
3116
|
-
return isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(void 0,
|
|
3267
|
+
return isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(void 0, gi).format(t);
|
|
3117
3268
|
}
|
|
3118
|
-
return
|
|
3269
|
+
return pi(e, _i);
|
|
3119
3270
|
}
|
|
3120
|
-
function
|
|
3271
|
+
function yi(e, t) {
|
|
3121
3272
|
if (t) {
|
|
3122
3273
|
let t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
3123
3274
|
return isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(void 0, {
|
|
@@ -3135,14 +3286,14 @@ function vi(e, t) {
|
|
|
3135
3286
|
minute: "2-digit"
|
|
3136
3287
|
}).format(n);
|
|
3137
3288
|
}
|
|
3138
|
-
function
|
|
3289
|
+
function bi(e) {
|
|
3139
3290
|
if (e.endsWith("Z")) return "UTC";
|
|
3140
3291
|
let t = e.match(/([+-]\d{2}:\d{2})$/);
|
|
3141
3292
|
if (!t) return null;
|
|
3142
3293
|
let n = t[1].charAt(0), r = parseInt(t[1].substring(1, 3), 10), i = parseInt(t[1].substring(4, 6), 10);
|
|
3143
3294
|
return r === 0 && i === 0 ? "UTC" : `UTC${n}${r}${i > 0 ? `:${String(i).padStart(2, "0")}` : ""}`;
|
|
3144
3295
|
}
|
|
3145
|
-
function
|
|
3296
|
+
function xi(e, t) {
|
|
3146
3297
|
let n = e.match(/([+-]\d{2}:\d{2})$/), r = e.endsWith("Z"), i = new Date(e);
|
|
3147
3298
|
if (isNaN(i.getTime())) return "";
|
|
3148
3299
|
if (r) {
|
|
@@ -3155,13 +3306,13 @@ function bi(e, t) {
|
|
|
3155
3306
|
}
|
|
3156
3307
|
return t ? e.slice(0, 10) : e.slice(0, 16);
|
|
3157
3308
|
}
|
|
3158
|
-
function
|
|
3309
|
+
function Si(e, t) {
|
|
3159
3310
|
let n = new Date(e);
|
|
3160
3311
|
if (isNaN(n.getTime())) return "";
|
|
3161
3312
|
let r = n.getFullYear(), i = String(n.getMonth() + 1).padStart(2, "0"), a = String(n.getDate()).padStart(2, "0");
|
|
3162
3313
|
return t ? `${r}-${i}-${a}` : `${r}-${i}-${a}T${String(n.getHours()).padStart(2, "0")}:${String(n.getMinutes()).padStart(2, "0")}`;
|
|
3163
3314
|
}
|
|
3164
|
-
function
|
|
3315
|
+
function Ci({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
3165
3316
|
let o = e.type === "date", s = !!e.timezone;
|
|
3166
3317
|
if (r === "display") {
|
|
3167
3318
|
if (!n) return /* @__PURE__ */ b("span", {
|
|
@@ -3171,7 +3322,7 @@ function Si({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3171
3322
|
},
|
|
3172
3323
|
children: "—"
|
|
3173
3324
|
});
|
|
3174
|
-
let e = I(n), t = s ?
|
|
3325
|
+
let e = I(n), t = s ? vi(e, o) : yi(e, o), r = s && !o ? bi(e) : null;
|
|
3175
3326
|
return /* @__PURE__ */ x("span", {
|
|
3176
3327
|
style: { fontSize: 12.5 },
|
|
3177
3328
|
children: [t, r && /* @__PURE__ */ b("span", {
|
|
@@ -3183,7 +3334,7 @@ function Si({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3183
3334
|
})]
|
|
3184
3335
|
});
|
|
3185
3336
|
}
|
|
3186
|
-
let c = n ? s ?
|
|
3337
|
+
let c = n ? s ? xi(I(n), o) : Si(I(n), o) : "";
|
|
3187
3338
|
return /* @__PURE__ */ b(P, {
|
|
3188
3339
|
id: a,
|
|
3189
3340
|
name: t,
|
|
@@ -3204,13 +3355,13 @@ function Si({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3204
3355
|
i?.(e);
|
|
3205
3356
|
return;
|
|
3206
3357
|
}
|
|
3207
|
-
i?.(
|
|
3358
|
+
i?.(fi(t));
|
|
3208
3359
|
}
|
|
3209
3360
|
});
|
|
3210
3361
|
}
|
|
3211
3362
|
//#endregion
|
|
3212
3363
|
//#region src/components/fields/BoolField.tsx
|
|
3213
|
-
function
|
|
3364
|
+
function wi({ value: e, mode: t, onChange: n, fieldId: r, labelId: i }) {
|
|
3214
3365
|
let a = !!e;
|
|
3215
3366
|
return t === "display" ? /* @__PURE__ */ x("span", {
|
|
3216
3367
|
style: {
|
|
@@ -3235,7 +3386,7 @@ function Ci({ value: e, mode: t, onChange: n, fieldId: r, labelId: i }) {
|
|
|
3235
3386
|
}
|
|
3236
3387
|
//#endregion
|
|
3237
3388
|
//#region src/components/fields/NumberField.tsx
|
|
3238
|
-
function
|
|
3389
|
+
function Ti(e) {
|
|
3239
3390
|
let t = e.trim();
|
|
3240
3391
|
if (t === "" || t === "-") return t;
|
|
3241
3392
|
let n = t.startsWith("-"), [r, i] = (n ? t.slice(1) : t).split("."), a;
|
|
@@ -3247,8 +3398,8 @@ function wi(e) {
|
|
|
3247
3398
|
let o = n ? `-${a}` : a;
|
|
3248
3399
|
return i !== void 0 && (o += `.${i}`), o;
|
|
3249
3400
|
}
|
|
3250
|
-
var
|
|
3251
|
-
function
|
|
3401
|
+
var Ei = new Intl.NumberFormat();
|
|
3402
|
+
function Di({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a, fieldId: o }) {
|
|
3252
3403
|
let s = e.display?.widget === "money", c = e.type === "decimal" || s, l = a?.$units?.[t], u = !l && e.unit ? e.unit.display || e.unit.storage : void 0, d = l || (u && !u.startsWith("$") ? u : void 0);
|
|
3253
3404
|
if (r === "display") {
|
|
3254
3405
|
if (n == null) return /* @__PURE__ */ b("span", {
|
|
@@ -3259,10 +3410,10 @@ function Ei({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
3259
3410
|
children: "—"
|
|
3260
3411
|
});
|
|
3261
3412
|
let e;
|
|
3262
|
-
if (c && typeof n == "string") e =
|
|
3413
|
+
if (c && typeof n == "string") e = Ti(n);
|
|
3263
3414
|
else {
|
|
3264
3415
|
let t = Number(n);
|
|
3265
|
-
e = isNaN(t) ? null :
|
|
3416
|
+
e = isNaN(t) ? null : Ei.format(t);
|
|
3266
3417
|
}
|
|
3267
3418
|
return e == null ? /* @__PURE__ */ b("span", {
|
|
3268
3419
|
style: { fontSize: 12.5 },
|
|
@@ -3307,7 +3458,7 @@ function Ei({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
3307
3458
|
}
|
|
3308
3459
|
//#endregion
|
|
3309
3460
|
//#region src/hooks/useEntityData.ts
|
|
3310
|
-
function
|
|
3461
|
+
function Oi(e, t) {
|
|
3311
3462
|
return [
|
|
3312
3463
|
"entity-data",
|
|
3313
3464
|
e,
|
|
@@ -3317,16 +3468,16 @@ function Di(e, t) {
|
|
|
3317
3468
|
}
|
|
3318
3469
|
];
|
|
3319
3470
|
}
|
|
3320
|
-
function
|
|
3321
|
-
let r =
|
|
3471
|
+
function ki(e, t, n = !0) {
|
|
3472
|
+
let r = Oi(e, t), i = r[2];
|
|
3322
3473
|
return g({
|
|
3323
3474
|
queryKey: r,
|
|
3324
|
-
queryFn: ({ signal: t }) =>
|
|
3475
|
+
queryFn: ({ signal: t }) => Kn(e, i, { signal: t }),
|
|
3325
3476
|
enabled: !!e && n,
|
|
3326
3477
|
placeholderData: (t, n) => n?.queryKey?.[1] === e ? t : void 0
|
|
3327
3478
|
});
|
|
3328
3479
|
}
|
|
3329
|
-
function
|
|
3480
|
+
function Ai(e, t, n = !0) {
|
|
3330
3481
|
let r = {
|
|
3331
3482
|
...t,
|
|
3332
3483
|
count: "only",
|
|
@@ -3342,7 +3493,7 @@ function ki(e, t, n = !0) {
|
|
|
3342
3493
|
e,
|
|
3343
3494
|
r
|
|
3344
3495
|
],
|
|
3345
|
-
queryFn: ({ signal: t }) =>
|
|
3496
|
+
queryFn: ({ signal: t }) => Kn(e, r, { signal: t }),
|
|
3346
3497
|
enabled: !!e && n,
|
|
3347
3498
|
retry: 1,
|
|
3348
3499
|
staleTime: 3e4,
|
|
@@ -3351,7 +3502,7 @@ function ki(e, t, n = !0) {
|
|
|
3351
3502
|
}
|
|
3352
3503
|
//#endregion
|
|
3353
3504
|
//#region src/hooks/useDebounce.ts
|
|
3354
|
-
function
|
|
3505
|
+
function ji(e, t) {
|
|
3355
3506
|
let [n, r] = p(e);
|
|
3356
3507
|
return l(() => {
|
|
3357
3508
|
let n = setTimeout(() => r(e), t);
|
|
@@ -3360,16 +3511,16 @@ function Ai(e, t) {
|
|
|
3360
3511
|
}
|
|
3361
3512
|
//#endregion
|
|
3362
3513
|
//#region src/hooks/useEntity.ts
|
|
3363
|
-
function
|
|
3514
|
+
function Mi(e) {
|
|
3364
3515
|
let { data: t } = Y();
|
|
3365
3516
|
if (!(!t || !e)) return t.entities[e];
|
|
3366
3517
|
}
|
|
3367
3518
|
//#endregion
|
|
3368
3519
|
//#region src/components/fields/RefCombobox.tsx
|
|
3369
|
-
var
|
|
3370
|
-
function
|
|
3371
|
-
let m = e?.entity, h =
|
|
3372
|
-
per_page:
|
|
3520
|
+
var Ni = 200;
|
|
3521
|
+
function Pi({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, id: a, labelId: o, ariaLabel: s, required: c, placeholder: l = "Select…", specialValues: u }) {
|
|
3522
|
+
let m = e?.entity, h = Mi(m), g = i ?? e?.display?.field ?? h?.display?.display_field ?? "$display", _ = d(() => h ? z(h)[0] ?? "id" : "id", [h]), v = e?.field || _, [y, x] = p(""), S = ji(y, 300), { data: C, isLoading: w } = ki(m, {
|
|
3523
|
+
per_page: Ni,
|
|
3373
3524
|
sort: g ? `${g}:asc` : void 0,
|
|
3374
3525
|
search: S || void 0,
|
|
3375
3526
|
filters: e?.options_filter
|
|
@@ -3377,7 +3528,7 @@ function Ni({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3377
3528
|
T,
|
|
3378
3529
|
v,
|
|
3379
3530
|
E
|
|
3380
|
-
]), O = r && m ? r[m]?.[E] : void 0, k = !!u?.some((e) => e.code === E), { data: A } =
|
|
3531
|
+
]), O = r && m ? r[m]?.[E] : void 0, k = !!u?.some((e) => e.code === E), { data: A } = ki(E && !D && !k && !O && !w ? m : void 0, {
|
|
3381
3532
|
per_page: 1,
|
|
3382
3533
|
filters: [{
|
|
3383
3534
|
field: v,
|
|
@@ -3407,7 +3558,7 @@ function Ni({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3407
3558
|
v,
|
|
3408
3559
|
g,
|
|
3409
3560
|
A
|
|
3410
|
-
]),
|
|
3561
|
+
]), ee = d(() => {
|
|
3411
3562
|
let e = (u ?? []).map((e) => ({
|
|
3412
3563
|
value: e.code,
|
|
3413
3564
|
label: L(e.label) || e.code
|
|
@@ -3456,7 +3607,7 @@ function Ni({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3456
3607
|
"aria-labelledby": o,
|
|
3457
3608
|
"aria-required": c || void 0,
|
|
3458
3609
|
value: E,
|
|
3459
|
-
options:
|
|
3610
|
+
options: ee,
|
|
3460
3611
|
onChange: (e) => n(e || null),
|
|
3461
3612
|
onSearchChange: x,
|
|
3462
3613
|
placeholder: l
|
|
@@ -3464,7 +3615,7 @@ function Ni({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3464
3615
|
}
|
|
3465
3616
|
//#endregion
|
|
3466
3617
|
//#region src/components/fields/RefField.tsx
|
|
3467
|
-
function
|
|
3618
|
+
function Fi({ field: e, value: t, mode: n, onChange: r, refs: i, fieldId: a, labelId: o }) {
|
|
3468
3619
|
let s = e.ref?.entity, c = e.display?.ref_display_field || "$display", l = d(() => {
|
|
3469
3620
|
if (t == null) return "—";
|
|
3470
3621
|
let e = I(t);
|
|
@@ -3482,7 +3633,7 @@ function Pi({ field: e, value: t, mode: n, onChange: r, refs: i, fieldId: a, lab
|
|
|
3482
3633
|
return n === "display" ? /* @__PURE__ */ b("span", {
|
|
3483
3634
|
style: { fontSize: 12.5 },
|
|
3484
3635
|
children: l
|
|
3485
|
-
}) : /* @__PURE__ */ b(
|
|
3636
|
+
}) : /* @__PURE__ */ b(Pi, {
|
|
3486
3637
|
ref: e.ref,
|
|
3487
3638
|
value: t,
|
|
3488
3639
|
onChange: (e) => r?.(e),
|
|
@@ -3495,29 +3646,29 @@ function Pi({ field: e, value: t, mode: n, onChange: r, refs: i, fieldId: a, lab
|
|
|
3495
3646
|
}
|
|
3496
3647
|
//#endregion
|
|
3497
3648
|
//#region src/components/fields/JsonField.tsx
|
|
3498
|
-
var
|
|
3499
|
-
function
|
|
3649
|
+
var Ii = o(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
|
|
3650
|
+
function Li() {
|
|
3500
3651
|
return /* @__PURE__ */ b("div", { className: "h-20 rounded-md border border-border bg-muted animate-pulse" });
|
|
3501
3652
|
}
|
|
3502
|
-
function
|
|
3653
|
+
function Ri(e) {
|
|
3503
3654
|
return e == null ? !0 : typeof e == "string" ? e.trim() === "" : Array.isArray(e) ? e.length === 0 : typeof e == "object" && Object.keys(e).length === 0;
|
|
3504
3655
|
}
|
|
3505
|
-
function
|
|
3506
|
-
return t === "display" ?
|
|
3656
|
+
function zi({ value: e, mode: t, onChange: n, fieldId: i }) {
|
|
3657
|
+
return t === "display" ? Ri(e) ? /* @__PURE__ */ b("span", {
|
|
3507
3658
|
style: {
|
|
3508
3659
|
fontSize: 12.5,
|
|
3509
3660
|
color: "var(--text-4)"
|
|
3510
3661
|
},
|
|
3511
3662
|
children: "—"
|
|
3512
3663
|
}) : /* @__PURE__ */ b(r, {
|
|
3513
|
-
fallback: /* @__PURE__ */ b(
|
|
3514
|
-
children: /* @__PURE__ */ b(
|
|
3664
|
+
fallback: /* @__PURE__ */ b(Li, {}),
|
|
3665
|
+
children: /* @__PURE__ */ b(Ii, {
|
|
3515
3666
|
value: e,
|
|
3516
3667
|
readOnly: !0
|
|
3517
3668
|
})
|
|
3518
3669
|
}) : /* @__PURE__ */ b(r, {
|
|
3519
|
-
fallback: /* @__PURE__ */ b(
|
|
3520
|
-
children: /* @__PURE__ */ b(
|
|
3670
|
+
fallback: /* @__PURE__ */ b(Li, {}),
|
|
3671
|
+
children: /* @__PURE__ */ b(Ii, {
|
|
3521
3672
|
value: e,
|
|
3522
3673
|
onChange: n,
|
|
3523
3674
|
id: i
|
|
@@ -3526,14 +3677,14 @@ function Ri({ value: e, mode: t, onChange: n, fieldId: i }) {
|
|
|
3526
3677
|
}
|
|
3527
3678
|
//#endregion
|
|
3528
3679
|
//#region src/components/fields/MultilangField.tsx
|
|
3529
|
-
function
|
|
3680
|
+
function Bi(e) {
|
|
3530
3681
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
3531
3682
|
}
|
|
3532
|
-
function
|
|
3683
|
+
function Vi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
3533
3684
|
let { data: o } = Y(), s = o?.languages?.length ? o.languages : [{
|
|
3534
3685
|
code: "en",
|
|
3535
3686
|
name: { en: "English" }
|
|
3536
|
-
}], c =
|
|
3687
|
+
}], c = Bi(n);
|
|
3537
3688
|
if (r === "display") return /* @__PURE__ */ b("span", {
|
|
3538
3689
|
style: { fontSize: 12.5 },
|
|
3539
3690
|
children: Object.values(c)[0] ?? "—"
|
|
@@ -3589,14 +3740,14 @@ function Bi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3589
3740
|
}
|
|
3590
3741
|
//#endregion
|
|
3591
3742
|
//#region src/components/fields/MultilangTextField.tsx
|
|
3592
|
-
function
|
|
3743
|
+
function Hi(e) {
|
|
3593
3744
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
3594
3745
|
}
|
|
3595
|
-
function
|
|
3746
|
+
function Ui({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
3596
3747
|
let { data: o } = Y(), s = o?.languages?.length ? o.languages : [{
|
|
3597
3748
|
code: "en",
|
|
3598
3749
|
name: { en: "English" }
|
|
3599
|
-
}], c =
|
|
3750
|
+
}], c = Hi(n);
|
|
3600
3751
|
if (r === "display") return /* @__PURE__ */ b("p", {
|
|
3601
3752
|
style: {
|
|
3602
3753
|
fontSize: 12.5,
|
|
@@ -3652,25 +3803,25 @@ function Hi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3652
3803
|
}
|
|
3653
3804
|
//#endregion
|
|
3654
3805
|
//#region src/components/fields/StructureField.tsx
|
|
3655
|
-
function
|
|
3806
|
+
function Wi(e) {
|
|
3656
3807
|
let { field: t, value: n, mode: r, onChange: i, locale: a, fieldId: o } = e, { data: s } = Y(), c = t.structure ? s?.structures?.[t.structure] : void 0;
|
|
3657
|
-
return c ? t.array ? /* @__PURE__ */ b(
|
|
3808
|
+
return c ? t.array ? /* @__PURE__ */ b(Ki, {
|
|
3658
3809
|
structDef: c,
|
|
3659
3810
|
value: n,
|
|
3660
3811
|
mode: r,
|
|
3661
3812
|
onChange: i,
|
|
3662
3813
|
locale: a,
|
|
3663
3814
|
fieldId: o
|
|
3664
|
-
}) : /* @__PURE__ */ b(
|
|
3815
|
+
}) : /* @__PURE__ */ b(Gi, {
|
|
3665
3816
|
structDef: c,
|
|
3666
3817
|
value: n,
|
|
3667
3818
|
mode: r,
|
|
3668
3819
|
onChange: i,
|
|
3669
3820
|
locale: a,
|
|
3670
3821
|
fieldId: o
|
|
3671
|
-
}) : /* @__PURE__ */ b(
|
|
3822
|
+
}) : /* @__PURE__ */ b(zi, { ...e });
|
|
3672
3823
|
}
|
|
3673
|
-
function
|
|
3824
|
+
function Gi({ structDef: e, value: t, mode: n, onChange: r, locale: i, fieldId: a }) {
|
|
3674
3825
|
let o = typeof t == "object" && t && !Array.isArray(t) ? t : {}, s = e.fields.names(), c = {
|
|
3675
3826
|
display: "flex",
|
|
3676
3827
|
flexDirection: "column",
|
|
@@ -3706,13 +3857,13 @@ function Wi({ structDef: e, value: t, mode: n, onChange: r, locale: i, fieldId:
|
|
|
3706
3857
|
minWidth: 0,
|
|
3707
3858
|
flex: 1
|
|
3708
3859
|
},
|
|
3709
|
-
children: n.type === "structure" && n.structure ? /* @__PURE__ */ b(
|
|
3860
|
+
children: n.type === "structure" && n.structure ? /* @__PURE__ */ b(Wi, {
|
|
3710
3861
|
field: n,
|
|
3711
3862
|
fieldName: t,
|
|
3712
3863
|
value: r,
|
|
3713
3864
|
mode: "display",
|
|
3714
3865
|
locale: i
|
|
3715
|
-
}) :
|
|
3866
|
+
}) : fs({
|
|
3716
3867
|
field: n,
|
|
3717
3868
|
fieldName: t,
|
|
3718
3869
|
value: r,
|
|
@@ -3750,14 +3901,14 @@ function Wi({ structDef: e, value: t, mode: n, onChange: r, locale: i, fieldId:
|
|
|
3750
3901
|
children: [/* @__PURE__ */ b(Ce, {
|
|
3751
3902
|
required: n.required,
|
|
3752
3903
|
children: n.display ? L(n.display.name) : t
|
|
3753
|
-
}), n.type === "structure" && n.structure ? /* @__PURE__ */ b(
|
|
3904
|
+
}), n.type === "structure" && n.structure ? /* @__PURE__ */ b(Wi, {
|
|
3754
3905
|
field: n,
|
|
3755
3906
|
fieldName: t,
|
|
3756
3907
|
value: o[t],
|
|
3757
3908
|
mode: "edit",
|
|
3758
3909
|
onChange: l(t),
|
|
3759
3910
|
locale: i
|
|
3760
|
-
}) :
|
|
3911
|
+
}) : fs({
|
|
3761
3912
|
field: n,
|
|
3762
3913
|
fieldName: t,
|
|
3763
3914
|
value: o[t],
|
|
@@ -3769,7 +3920,7 @@ function Wi({ structDef: e, value: t, mode: n, onChange: r, locale: i, fieldId:
|
|
|
3769
3920
|
})
|
|
3770
3921
|
});
|
|
3771
3922
|
}
|
|
3772
|
-
function
|
|
3923
|
+
function Ki({ structDef: e, value: n, mode: r, onChange: i, locale: a, fieldId: o }) {
|
|
3773
3924
|
let s = Array.isArray(n) ? n : [];
|
|
3774
3925
|
if (r === "display") return s.length === 0 ? /* @__PURE__ */ b("span", {
|
|
3775
3926
|
style: {
|
|
@@ -3783,7 +3934,7 @@ function Gi({ structDef: e, value: n, mode: r, onChange: i, locale: a, fieldId:
|
|
|
3783
3934
|
flexDirection: "column",
|
|
3784
3935
|
gap: 8
|
|
3785
3936
|
},
|
|
3786
|
-
children: s.map((t, n) => /* @__PURE__ */ b(
|
|
3937
|
+
children: s.map((t, n) => /* @__PURE__ */ b(Gi, {
|
|
3787
3938
|
structDef: e,
|
|
3788
3939
|
value: t,
|
|
3789
3940
|
mode: "display",
|
|
@@ -3809,7 +3960,7 @@ function Gi({ structDef: e, value: n, mode: r, onChange: i, locale: a, fieldId:
|
|
|
3809
3960
|
role: "group",
|
|
3810
3961
|
children: [s.map((n, r) => /* @__PURE__ */ x("div", {
|
|
3811
3962
|
style: { position: "relative" },
|
|
3812
|
-
children: [/* @__PURE__ */ b(
|
|
3963
|
+
children: [/* @__PURE__ */ b(Gi, {
|
|
3813
3964
|
structDef: e,
|
|
3814
3965
|
value: n,
|
|
3815
3966
|
mode: "edit",
|
|
@@ -3837,16 +3988,16 @@ function Gi({ structDef: e, value: n, mode: r, onChange: i, locale: a, fieldId:
|
|
|
3837
3988
|
}
|
|
3838
3989
|
//#endregion
|
|
3839
3990
|
//#region src/components/fields/SecretField.tsx
|
|
3840
|
-
var
|
|
3841
|
-
function
|
|
3842
|
-
let [s, c] = p(""), l = a !== void 0, u = n ===
|
|
3991
|
+
var qi = "[SET]";
|
|
3992
|
+
function Ji({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a, fieldId: o }) {
|
|
3993
|
+
let [s, c] = p(""), l = a !== void 0, u = n === qi || typeof n == "string" && n !== "";
|
|
3843
3994
|
return r === "display" ? u ? /* @__PURE__ */ b("span", {
|
|
3844
3995
|
className: "mono",
|
|
3845
3996
|
style: {
|
|
3846
3997
|
fontSize: 12.5,
|
|
3847
3998
|
color: "var(--text-3)"
|
|
3848
3999
|
},
|
|
3849
|
-
children:
|
|
4000
|
+
children: qi
|
|
3850
4001
|
}) : /* @__PURE__ */ b("span", {
|
|
3851
4002
|
style: {
|
|
3852
4003
|
fontSize: 12.5,
|
|
@@ -3854,29 +4005,29 @@ function qi({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
3854
4005
|
fontStyle: "italic"
|
|
3855
4006
|
},
|
|
3856
4007
|
children: "Not set"
|
|
3857
|
-
}) : /* @__PURE__ */ b(
|
|
4008
|
+
}) : /* @__PURE__ */ b(Pe, {
|
|
3858
4009
|
id: o,
|
|
3859
4010
|
name: t,
|
|
3860
4011
|
ariaRequired: e.required,
|
|
3861
4012
|
value: s,
|
|
3862
4013
|
onChange: (e) => {
|
|
3863
|
-
c(e), l && e === "" ? i?.(u ?
|
|
4014
|
+
c(e), l && e === "" ? i?.(u ? qi : "") : i?.(e);
|
|
3864
4015
|
},
|
|
3865
4016
|
placeholder: l ? "Leave blank to keep existing value" : "Enter value"
|
|
3866
4017
|
});
|
|
3867
4018
|
}
|
|
3868
4019
|
//#endregion
|
|
3869
4020
|
//#region src/components/fields/PasswordField.tsx
|
|
3870
|
-
var
|
|
3871
|
-
function
|
|
3872
|
-
let [s, c] = p(""), l = a !== void 0, u = n ===
|
|
4021
|
+
var Yi = "[SET]";
|
|
4022
|
+
function Xi({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a, fieldId: o }) {
|
|
4023
|
+
let [s, c] = p(""), l = a !== void 0, u = n === Yi || typeof n == "string" && n !== "";
|
|
3873
4024
|
return r === "display" ? u ? /* @__PURE__ */ b("span", {
|
|
3874
4025
|
className: "mono",
|
|
3875
4026
|
style: {
|
|
3876
4027
|
fontSize: 12.5,
|
|
3877
4028
|
color: "var(--text-3)"
|
|
3878
4029
|
},
|
|
3879
|
-
children:
|
|
4030
|
+
children: Yi
|
|
3880
4031
|
}) : /* @__PURE__ */ b("span", {
|
|
3881
4032
|
style: {
|
|
3882
4033
|
fontSize: 12.5,
|
|
@@ -3884,24 +4035,24 @@ function Yi({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
3884
4035
|
fontStyle: "italic"
|
|
3885
4036
|
},
|
|
3886
4037
|
children: "Not set"
|
|
3887
|
-
}) : /* @__PURE__ */ b(
|
|
4038
|
+
}) : /* @__PURE__ */ b(Pe, {
|
|
3888
4039
|
id: o,
|
|
3889
4040
|
name: t,
|
|
3890
4041
|
ariaRequired: e.required,
|
|
3891
4042
|
value: s,
|
|
3892
4043
|
onChange: (e) => {
|
|
3893
|
-
c(e), l && e === "" ? i?.(u ?
|
|
4044
|
+
c(e), l && e === "" ? i?.(u ? Yi : "") : i?.(e);
|
|
3894
4045
|
},
|
|
3895
4046
|
placeholder: l ? "Leave blank to keep existing value" : "Enter password"
|
|
3896
4047
|
});
|
|
3897
4048
|
}
|
|
3898
4049
|
//#endregion
|
|
3899
4050
|
//#region src/components/fields/StringArrayField.tsx
|
|
3900
|
-
function
|
|
4051
|
+
function Zi(e) {
|
|
3901
4052
|
return Array.isArray(e) ? e.filter((e) => e != null).map(String) : [];
|
|
3902
4053
|
}
|
|
3903
|
-
function
|
|
3904
|
-
let s =
|
|
4054
|
+
function Qi({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o }) {
|
|
4055
|
+
let s = Zi(r), [c, l] = p("");
|
|
3905
4056
|
if (i === "display") return s.length === 0 ? /* @__PURE__ */ b("span", {
|
|
3906
4057
|
style: {
|
|
3907
4058
|
fontSize: 12.5,
|
|
@@ -3914,7 +4065,7 @@ function Zi({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
3914
4065
|
flexWrap: "wrap",
|
|
3915
4066
|
gap: 4
|
|
3916
4067
|
},
|
|
3917
|
-
children: s.map((e, t) => /* @__PURE__ */ b(
|
|
4068
|
+
children: s.map((e, t) => /* @__PURE__ */ b(N, {
|
|
3918
4069
|
tone: "slate",
|
|
3919
4070
|
children: e
|
|
3920
4071
|
}, t))
|
|
@@ -3937,7 +4088,7 @@ function Zi({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
3937
4088
|
flexWrap: "wrap",
|
|
3938
4089
|
gap: 4
|
|
3939
4090
|
},
|
|
3940
|
-
children: s.map((e, t) => /* @__PURE__ */ b(
|
|
4091
|
+
children: s.map((e, t) => /* @__PURE__ */ b(N, {
|
|
3941
4092
|
tone: "slate",
|
|
3942
4093
|
onRemove: () => d(t),
|
|
3943
4094
|
children: e
|
|
@@ -3970,11 +4121,11 @@ function Zi({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
3970
4121
|
}
|
|
3971
4122
|
//#endregion
|
|
3972
4123
|
//#region src/components/fields/IntArrayField.tsx
|
|
3973
|
-
function
|
|
4124
|
+
function $i(e) {
|
|
3974
4125
|
return Array.isArray(e) ? e.filter((e) => e != null).map(Number).filter((e) => !isNaN(e)) : [];
|
|
3975
4126
|
}
|
|
3976
|
-
function
|
|
3977
|
-
let s =
|
|
4127
|
+
function ea({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o }) {
|
|
4128
|
+
let s = $i(r), [c, l] = p("");
|
|
3978
4129
|
if (i === "display") return s.length === 0 ? /* @__PURE__ */ b("span", {
|
|
3979
4130
|
style: {
|
|
3980
4131
|
fontSize: 12.5,
|
|
@@ -3987,7 +4138,7 @@ function $i({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
3987
4138
|
flexWrap: "wrap",
|
|
3988
4139
|
gap: 4
|
|
3989
4140
|
},
|
|
3990
|
-
children: s.map((e, t) => /* @__PURE__ */ b(
|
|
4141
|
+
children: s.map((e, t) => /* @__PURE__ */ b(N, {
|
|
3991
4142
|
tone: "slate",
|
|
3992
4143
|
children: e
|
|
3993
4144
|
}, t))
|
|
@@ -4012,7 +4163,7 @@ function $i({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
4012
4163
|
flexWrap: "wrap",
|
|
4013
4164
|
gap: 4
|
|
4014
4165
|
},
|
|
4015
|
-
children: s.map((e, t) => /* @__PURE__ */ b(
|
|
4166
|
+
children: s.map((e, t) => /* @__PURE__ */ b(N, {
|
|
4016
4167
|
tone: "slate",
|
|
4017
4168
|
onRemove: () => d(t),
|
|
4018
4169
|
children: e
|
|
@@ -4046,47 +4197,47 @@ function $i({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
4046
4197
|
}
|
|
4047
4198
|
//#endregion
|
|
4048
4199
|
//#region src/lib/rich-text.ts
|
|
4049
|
-
var
|
|
4050
|
-
function
|
|
4051
|
-
return typeof e == "string" ? e :
|
|
4200
|
+
var ta = /declarion:\/\/file\/([0-9a-fA-F-]{36})/g;
|
|
4201
|
+
function na(e) {
|
|
4202
|
+
return typeof e == "string" ? e : ua(e) && typeof e.markdown == "string" ? e.markdown : "";
|
|
4052
4203
|
}
|
|
4053
|
-
function
|
|
4204
|
+
function ra(e, t) {
|
|
4054
4205
|
return {
|
|
4055
|
-
markdown:
|
|
4056
|
-
files:
|
|
4206
|
+
markdown: na(e),
|
|
4207
|
+
files: oa(t)
|
|
4057
4208
|
};
|
|
4058
4209
|
}
|
|
4059
|
-
function
|
|
4060
|
-
let n =
|
|
4210
|
+
function ia(e, t) {
|
|
4211
|
+
let n = ra(e, null);
|
|
4061
4212
|
return n.files[t.id] = t, n;
|
|
4062
4213
|
}
|
|
4063
|
-
function
|
|
4064
|
-
let n =
|
|
4214
|
+
function aa(e, t) {
|
|
4215
|
+
let n = ra(e, null);
|
|
4065
4216
|
for (let e of t) delete n.files[e];
|
|
4066
4217
|
return n;
|
|
4067
4218
|
}
|
|
4068
|
-
function
|
|
4219
|
+
function oa(e) {
|
|
4069
4220
|
if (!Array.isArray(e)) return {};
|
|
4070
4221
|
let t = {};
|
|
4071
|
-
for (let n of e)
|
|
4222
|
+
for (let n of e) ua(n) && typeof n.id == "string" && (t[n.id] = n);
|
|
4072
4223
|
return t;
|
|
4073
4224
|
}
|
|
4074
|
-
function
|
|
4225
|
+
function sa(e) {
|
|
4075
4226
|
let t = /* @__PURE__ */ new Set(), n = [], r;
|
|
4076
|
-
for (
|
|
4227
|
+
for (ta.lastIndex = 0; (r = ta.exec(e)) !== null;) {
|
|
4077
4228
|
let e = r[1];
|
|
4078
4229
|
t.has(e) || (t.add(e), n.push(e));
|
|
4079
4230
|
}
|
|
4080
4231
|
return n;
|
|
4081
4232
|
}
|
|
4082
|
-
function
|
|
4233
|
+
function ca(e) {
|
|
4083
4234
|
return e ? /^declarion:\/\/file\/([0-9a-fA-F-]{36})$/.exec(e)?.[1] ?? null : null;
|
|
4084
4235
|
}
|
|
4085
|
-
function
|
|
4236
|
+
function la(e) {
|
|
4086
4237
|
let t = `declarion://file/${e.id}`;
|
|
4087
4238
|
return e.content_type.startsWith("image/") ? `` : `[${e.filename || e.id}](${t})`;
|
|
4088
4239
|
}
|
|
4089
|
-
function
|
|
4240
|
+
function ua(e) {
|
|
4090
4241
|
return typeof e == "object" && !!e;
|
|
4091
4242
|
}
|
|
4092
4243
|
//#endregion
|
|
@@ -4098,30 +4249,30 @@ var Q = class extends Error {
|
|
|
4098
4249
|
super(n), this.code = t, this.status = e;
|
|
4099
4250
|
}
|
|
4100
4251
|
};
|
|
4101
|
-
async function
|
|
4102
|
-
let t =
|
|
4252
|
+
async function da(e) {
|
|
4253
|
+
let t = wt();
|
|
4103
4254
|
try {
|
|
4104
|
-
return await
|
|
4255
|
+
return await fa(e, t ? await At() : null);
|
|
4105
4256
|
} catch (n) {
|
|
4106
4257
|
if (!(n instanceof Q && n.status === 401 && (n.code === "TOKEN_REFRESH_NEEDED" || n.code === "UNAUTHORIZED"))) throw n;
|
|
4107
4258
|
let r = null;
|
|
4108
4259
|
try {
|
|
4109
|
-
t ? (
|
|
4260
|
+
t ? (kt(), r = await At()) : await gn();
|
|
4110
4261
|
} catch {
|
|
4111
|
-
throw
|
|
4262
|
+
throw vn()(), n;
|
|
4112
4263
|
}
|
|
4113
4264
|
try {
|
|
4114
|
-
return await
|
|
4265
|
+
return await fa(e, r);
|
|
4115
4266
|
} catch (e) {
|
|
4116
|
-
throw e instanceof Q && e.status === 401 &&
|
|
4267
|
+
throw e instanceof Q && e.status === 401 && vn()(), e;
|
|
4117
4268
|
}
|
|
4118
4269
|
}
|
|
4119
4270
|
}
|
|
4120
|
-
function
|
|
4271
|
+
function fa(e, t) {
|
|
4121
4272
|
let { file: n, entityCode: r, fieldCode: i, slotCode: a, onProgress: o, signal: s } = e;
|
|
4122
4273
|
return new Promise((e, c) => {
|
|
4123
4274
|
let l = new XMLHttpRequest();
|
|
4124
|
-
if (l.open("POST",
|
|
4275
|
+
if (l.open("POST", pa(r, i, a)), l.withCredentials = t === null, t && l.setRequestHeader("Authorization", `Bearer ${t}`), l.upload.onprogress = (e) => {
|
|
4125
4276
|
if (!o) return;
|
|
4126
4277
|
let t = e.lengthComputable ? e.total : n.size, r = t > 0 ? Math.min(100, Math.round(e.loaded / t * 100)) : 0;
|
|
4127
4278
|
o({
|
|
@@ -4135,7 +4286,7 @@ function da(e, t) {
|
|
|
4135
4286
|
n = t ? JSON.parse(t) : null;
|
|
4136
4287
|
} catch {}
|
|
4137
4288
|
if (l.status >= 200 && l.status < 300) {
|
|
4138
|
-
let t =
|
|
4289
|
+
let t = ma(n);
|
|
4139
4290
|
if (!t || !t.id) {
|
|
4140
4291
|
c(new Q(l.status, "BAD_RESPONSE", "Upload returned no file id"));
|
|
4141
4292
|
return;
|
|
@@ -4160,56 +4311,56 @@ function da(e, t) {
|
|
|
4160
4311
|
u.append("file", n, n.name), l.send(u);
|
|
4161
4312
|
});
|
|
4162
4313
|
}
|
|
4163
|
-
function
|
|
4314
|
+
function pa(e, t, n) {
|
|
4164
4315
|
let r = new URLSearchParams();
|
|
4165
4316
|
e && t && (r.set("entity_code", e), r.set("field_code", t), n && r.set("slot_code", n));
|
|
4166
4317
|
let i = r.toString();
|
|
4167
4318
|
return i ? `/api/files/upload?${i}` : "/api/files/upload";
|
|
4168
4319
|
}
|
|
4169
|
-
function pa(e) {
|
|
4170
|
-
return ha(e) ? ha(e.result) ? pa(e.result) : ha(e.file) ? ma(e.file) : typeof e.id == "string" ? e : null : null;
|
|
4171
|
-
}
|
|
4172
4320
|
function ma(e) {
|
|
4173
|
-
|
|
4321
|
+
return ga(e) ? ga(e.result) ? ma(e.result) : ga(e.file) ? ha(e.file) : typeof e.id == "string" ? e : null : null;
|
|
4322
|
+
}
|
|
4323
|
+
function ha(e) {
|
|
4324
|
+
let t = _a(e.file_id);
|
|
4174
4325
|
return t ? {
|
|
4175
4326
|
id: t,
|
|
4176
|
-
filename:
|
|
4177
|
-
content_type:
|
|
4178
|
-
size_bytes:
|
|
4179
|
-
sha256:
|
|
4180
|
-
dedup:
|
|
4327
|
+
filename: _a(e.filename_original) ?? _a(e.filename_normalized) ?? t,
|
|
4328
|
+
content_type: _a(e.content_type) ?? "application/octet-stream",
|
|
4329
|
+
size_bytes: va(e.size_bytes) ?? 0,
|
|
4330
|
+
sha256: _a(e.sha256) ?? "",
|
|
4331
|
+
dedup: ya(e.dedup)
|
|
4181
4332
|
} : null;
|
|
4182
4333
|
}
|
|
4183
|
-
function
|
|
4334
|
+
function ga(e) {
|
|
4184
4335
|
return typeof e == "object" && !!e;
|
|
4185
4336
|
}
|
|
4186
|
-
function
|
|
4337
|
+
function _a(e) {
|
|
4187
4338
|
return typeof e == "string" ? e : void 0;
|
|
4188
4339
|
}
|
|
4189
|
-
function
|
|
4340
|
+
function va(e) {
|
|
4190
4341
|
return typeof e == "number" ? e : void 0;
|
|
4191
4342
|
}
|
|
4192
|
-
function
|
|
4343
|
+
function ya(e) {
|
|
4193
4344
|
return typeof e == "boolean" ? e : void 0;
|
|
4194
4345
|
}
|
|
4195
|
-
async function
|
|
4346
|
+
async function ba(e) {
|
|
4196
4347
|
await J("files.discard", { file_id: e });
|
|
4197
4348
|
}
|
|
4198
|
-
function
|
|
4349
|
+
function xa(e, t, n) {
|
|
4199
4350
|
if (n && e.size > n) return {
|
|
4200
4351
|
code: "FILE_TOO_LARGE",
|
|
4201
|
-
message: `File is ${
|
|
4352
|
+
message: `File is ${Ca(e.size)}, max ${Ca(n)}`
|
|
4202
4353
|
};
|
|
4203
4354
|
if (t && t.length > 0) {
|
|
4204
4355
|
let n = e.type || "application/octet-stream";
|
|
4205
|
-
if (!t.some((e) =>
|
|
4356
|
+
if (!t.some((e) => Sa(e, n))) return {
|
|
4206
4357
|
code: "MIME_NOT_ACCEPTED",
|
|
4207
4358
|
message: `File type ${n} is not accepted`
|
|
4208
4359
|
};
|
|
4209
4360
|
}
|
|
4210
4361
|
return null;
|
|
4211
4362
|
}
|
|
4212
|
-
function
|
|
4363
|
+
function Sa(e, t) {
|
|
4213
4364
|
if (e === "*/*" || e === "*") return !0;
|
|
4214
4365
|
if (e.endsWith("/*")) {
|
|
4215
4366
|
let n = e.slice(0, e.length - 1);
|
|
@@ -4217,7 +4368,7 @@ function xa(e, t) {
|
|
|
4217
4368
|
}
|
|
4218
4369
|
return e === t;
|
|
4219
4370
|
}
|
|
4220
|
-
function
|
|
4371
|
+
function Ca(e) {
|
|
4221
4372
|
if (e < 1024) return `${e} B`;
|
|
4222
4373
|
let t = [
|
|
4223
4374
|
"KB",
|
|
@@ -4229,7 +4380,7 @@ function Sa(e) {
|
|
|
4229
4380
|
}
|
|
4230
4381
|
//#endregion
|
|
4231
4382
|
//#region src/components/file-widgets/draft-scope.tsx
|
|
4232
|
-
var
|
|
4383
|
+
var wa = i({
|
|
4233
4384
|
registerDraft() {},
|
|
4234
4385
|
unregisterDraft() {},
|
|
4235
4386
|
hasDraft() {
|
|
@@ -4238,7 +4389,7 @@ var Ca = i({
|
|
|
4238
4389
|
flushAllDrafts: async () => {},
|
|
4239
4390
|
markCommitted() {}
|
|
4240
4391
|
});
|
|
4241
|
-
function
|
|
4392
|
+
function Ta({ children: e }) {
|
|
4242
4393
|
let t = f(/* @__PURE__ */ new Map()), n = d(() => ({
|
|
4243
4394
|
registerDraft(e) {
|
|
4244
4395
|
t.current.set(e.fileId, e);
|
|
@@ -4257,16 +4408,16 @@ function wa({ children: e }) {
|
|
|
4257
4408
|
t.current.clear(), await Promise.allSettled(e.map((e) => Promise.resolve(e.discard())));
|
|
4258
4409
|
}
|
|
4259
4410
|
}), []);
|
|
4260
|
-
return /* @__PURE__ */ b(
|
|
4411
|
+
return /* @__PURE__ */ b(wa.Provider, {
|
|
4261
4412
|
value: n,
|
|
4262
4413
|
children: e
|
|
4263
4414
|
});
|
|
4264
4415
|
}
|
|
4265
|
-
function Ta() {
|
|
4266
|
-
return c(Ca);
|
|
4267
|
-
}
|
|
4268
4416
|
function Ea() {
|
|
4269
|
-
|
|
4417
|
+
return c(wa);
|
|
4418
|
+
}
|
|
4419
|
+
function Da() {
|
|
4420
|
+
let e = Ea();
|
|
4270
4421
|
return {
|
|
4271
4422
|
register: s((t, n) => {
|
|
4272
4423
|
e.registerDraft({
|
|
@@ -4285,17 +4436,17 @@ function Ea() {
|
|
|
4285
4436
|
}
|
|
4286
4437
|
//#endregion
|
|
4287
4438
|
//#region src/components/fields/RichTextField.tsx
|
|
4288
|
-
function
|
|
4289
|
-
let { field: n, entityCode: r, fieldName: i, value: a, mode: o, onChange: s, record: c, compact: l, fieldId: u } = e, m = f(null), h = f(null), g = f(/* @__PURE__ */ new Map()), _ = f(/* @__PURE__ */ new Set()), [v, y] = p(0), [S, C] = p(null), { register: w, unregister: T } =
|
|
4290
|
-
let n = new Set(
|
|
4439
|
+
function Oa(e) {
|
|
4440
|
+
let { field: n, entityCode: r, fieldName: i, value: a, mode: o, onChange: s, record: c, compact: l, fieldId: u } = e, m = f(null), h = f(null), g = f(/* @__PURE__ */ new Map()), _ = f(/* @__PURE__ */ new Set()), [v, y] = p(0), [S, C] = p(null), { register: w, unregister: T } = Da(), E = c?.$files?.[i], O = d(() => ra(a, E), [E, a]), k = O.markdown, A = n.files?.accepts, j = n.files?.max_size_bytes, M = (e, t = O.files) => {
|
|
4441
|
+
let n = new Set(sa(e)), r = [];
|
|
4291
4442
|
for (let e of _.current) n.has(e) || r.push(e);
|
|
4292
4443
|
if (r.length > 0) {
|
|
4293
4444
|
for (let e of r) {
|
|
4294
|
-
_.current.delete(e), T(e),
|
|
4445
|
+
_.current.delete(e), T(e), ba(e).catch(() => {});
|
|
4295
4446
|
let t = g.current.get(e);
|
|
4296
4447
|
t && (URL.revokeObjectURL(t), g.current.delete(e));
|
|
4297
4448
|
}
|
|
4298
|
-
s?.(
|
|
4449
|
+
s?.(aa({
|
|
4299
4450
|
markdown: e,
|
|
4300
4451
|
files: t
|
|
4301
4452
|
}, r));
|
|
@@ -4305,14 +4456,14 @@ function Da(e) {
|
|
|
4305
4456
|
markdown: e,
|
|
4306
4457
|
files: t
|
|
4307
4458
|
});
|
|
4308
|
-
},
|
|
4309
|
-
let r = m.current, i = r?.selectionStart ?? e.markdown.length, a = r?.selectionEnd ?? e.markdown.length, o = `${e.markdown.slice(0, i)}${t}${e.markdown.slice(a)}`, s = n ?
|
|
4459
|
+
}, ee = (e, t, n) => {
|
|
4460
|
+
let r = m.current, i = r?.selectionStart ?? e.markdown.length, a = r?.selectionEnd ?? e.markdown.length, o = `${e.markdown.slice(0, i)}${t}${e.markdown.slice(a)}`, s = n ? ia(e, n).files : e.files;
|
|
4310
4461
|
M(o, s), requestAnimationFrame(() => {
|
|
4311
4462
|
if (!r) return;
|
|
4312
4463
|
let e = i + t.length;
|
|
4313
4464
|
r.focus(), r.setSelectionRange(e, e);
|
|
4314
4465
|
});
|
|
4315
|
-
},
|
|
4466
|
+
}, te = async (e) => {
|
|
4316
4467
|
if (!r || !n.files) return;
|
|
4317
4468
|
let t = Array.from(e);
|
|
4318
4469
|
if (t.length === 0) return;
|
|
@@ -4322,28 +4473,28 @@ function Da(e) {
|
|
|
4322
4473
|
files: O.files
|
|
4323
4474
|
};
|
|
4324
4475
|
for (let e of t) {
|
|
4325
|
-
let n =
|
|
4476
|
+
let n = xa(e, A, j);
|
|
4326
4477
|
if (n) {
|
|
4327
4478
|
C(n.message), y((e) => e - 1);
|
|
4328
4479
|
continue;
|
|
4329
4480
|
}
|
|
4330
4481
|
try {
|
|
4331
|
-
let n = await
|
|
4482
|
+
let n = await da({
|
|
4332
4483
|
file: e,
|
|
4333
4484
|
entityCode: r,
|
|
4334
4485
|
fieldCode: i
|
|
4335
4486
|
}), o = e.type.startsWith("image/") ? URL.createObjectURL(e) : void 0;
|
|
4336
4487
|
o && g.current.set(n.id, o);
|
|
4337
|
-
let s =
|
|
4338
|
-
if (w(n.id, () =>
|
|
4339
|
-
let e =
|
|
4340
|
-
|
|
4488
|
+
let s = Aa(n, o);
|
|
4489
|
+
if (w(n.id, () => ba(n.id)), _.current.add(n.id), t.length === 1) {
|
|
4490
|
+
let e = ka(a.markdown, la(s));
|
|
4491
|
+
ee(a, e, s), a = ia({
|
|
4341
4492
|
markdown: `${a.markdown}${e}`,
|
|
4342
4493
|
files: a.files
|
|
4343
4494
|
}, s);
|
|
4344
4495
|
} else {
|
|
4345
|
-
let e =
|
|
4346
|
-
a =
|
|
4496
|
+
let e = ka(a.markdown, la(s));
|
|
4497
|
+
a = ia({
|
|
4347
4498
|
markdown: `${a.markdown}${e}`,
|
|
4348
4499
|
files: a.files
|
|
4349
4500
|
}, s), M(a.markdown, a.files);
|
|
@@ -4355,7 +4506,7 @@ function Da(e) {
|
|
|
4355
4506
|
}
|
|
4356
4507
|
}
|
|
4357
4508
|
};
|
|
4358
|
-
return o === "display" ? k ? /* @__PURE__ */ b(
|
|
4509
|
+
return o === "display" ? k ? /* @__PURE__ */ b(Yr, {
|
|
4359
4510
|
content: k,
|
|
4360
4511
|
files: O.files
|
|
4361
4512
|
}) : /* @__PURE__ */ b("span", {
|
|
@@ -4416,7 +4567,7 @@ function Da(e) {
|
|
|
4416
4567
|
accept: A?.join(","),
|
|
4417
4568
|
multiple: !0,
|
|
4418
4569
|
onChange: (e) => {
|
|
4419
|
-
e.target.files &&
|
|
4570
|
+
e.target.files && te(e.target.files), e.target.value = "";
|
|
4420
4571
|
}
|
|
4421
4572
|
}),
|
|
4422
4573
|
/* @__PURE__ */ b("textarea", {
|
|
@@ -4428,11 +4579,11 @@ function Da(e) {
|
|
|
4428
4579
|
onChange: (e) => M(e.target.value),
|
|
4429
4580
|
onPaste: (e) => {
|
|
4430
4581
|
let t = Array.from(e.clipboardData.files ?? []).filter((e) => e.size > 0);
|
|
4431
|
-
t.length !== 0 && (e.preventDefault(),
|
|
4582
|
+
t.length !== 0 && (e.preventDefault(), te(t));
|
|
4432
4583
|
},
|
|
4433
4584
|
onDrop: (e) => {
|
|
4434
4585
|
let t = Array.from(e.dataTransfer.files ?? []).filter((e) => e.size > 0);
|
|
4435
|
-
t.length !== 0 && (e.preventDefault(),
|
|
4586
|
+
t.length !== 0 && (e.preventDefault(), te(t));
|
|
4436
4587
|
},
|
|
4437
4588
|
onDragOver: (e) => e.preventDefault(),
|
|
4438
4589
|
rows: 12,
|
|
@@ -4471,7 +4622,7 @@ function Da(e) {
|
|
|
4471
4622
|
marginBottom: 8
|
|
4472
4623
|
},
|
|
4473
4624
|
children: "Preview"
|
|
4474
|
-
}), k ? /* @__PURE__ */ b(
|
|
4625
|
+
}), k ? /* @__PURE__ */ b(Yr, {
|
|
4475
4626
|
content: k,
|
|
4476
4627
|
files: O.files
|
|
4477
4628
|
}) : /* @__PURE__ */ b("span", {
|
|
@@ -4485,10 +4636,10 @@ function Da(e) {
|
|
|
4485
4636
|
]
|
|
4486
4637
|
});
|
|
4487
4638
|
}
|
|
4488
|
-
function
|
|
4639
|
+
function ka(e, t) {
|
|
4489
4640
|
return e ? e.endsWith("\n\n") ? t : e.endsWith("\n") ? `\n${t}` : `\n\n${t}` : `${t}\n`;
|
|
4490
4641
|
}
|
|
4491
|
-
function
|
|
4642
|
+
function Aa(e, t) {
|
|
4492
4643
|
return {
|
|
4493
4644
|
id: e.id,
|
|
4494
4645
|
filename: e.filename,
|
|
@@ -4503,8 +4654,8 @@ function ka(e, t) {
|
|
|
4503
4654
|
}
|
|
4504
4655
|
//#endregion
|
|
4505
4656
|
//#region src/components/fields/cells/factories/text.ts
|
|
4506
|
-
var
|
|
4507
|
-
let { field: t, fieldName: n, locale: r = "en" } = e, i =
|
|
4657
|
+
var ja = () => (e) => e == null || e === "" ? "—" : I(e), Ma = (e) => {
|
|
4658
|
+
let { field: t, fieldName: n, locale: r = "en" } = e, i = Na(t, n, r);
|
|
4508
4659
|
return (e) => {
|
|
4509
4660
|
if (e == null) return "—";
|
|
4510
4661
|
let t = !!e;
|
|
@@ -4515,7 +4666,7 @@ var Aa = () => (e) => e == null || e === "" ? "—" : I(e), ja = (e) => {
|
|
|
4515
4666
|
});
|
|
4516
4667
|
};
|
|
4517
4668
|
};
|
|
4518
|
-
function
|
|
4669
|
+
function Na(e, t, n) {
|
|
4519
4670
|
if (e.display?.bool_labels) return {
|
|
4520
4671
|
trueLabel: L(e.display.bool_labels.true, n) || "Yes",
|
|
4521
4672
|
falseLabel: L(e.display.bool_labels.false, n) || "No"
|
|
@@ -4536,14 +4687,14 @@ function Ma(e, t, n) {
|
|
|
4536
4687
|
};
|
|
4537
4688
|
}
|
|
4538
4689
|
if (t.startsWith("is_")) {
|
|
4539
|
-
let e =
|
|
4690
|
+
let e = Pa(t.slice(3));
|
|
4540
4691
|
return {
|
|
4541
4692
|
trueLabel: e,
|
|
4542
4693
|
falseLabel: `Not ${e}`
|
|
4543
4694
|
};
|
|
4544
4695
|
}
|
|
4545
4696
|
if (t.startsWith("has_")) {
|
|
4546
|
-
let e =
|
|
4697
|
+
let e = Pa(t.slice(4));
|
|
4547
4698
|
return {
|
|
4548
4699
|
trueLabel: e,
|
|
4549
4700
|
falseLabel: `No ${e}`
|
|
@@ -4554,12 +4705,12 @@ function Ma(e, t, n) {
|
|
|
4554
4705
|
falseLabel: "No"
|
|
4555
4706
|
};
|
|
4556
4707
|
}
|
|
4557
|
-
function
|
|
4708
|
+
function Pa(e) {
|
|
4558
4709
|
return e.split("_").map((e) => e && e[0].toUpperCase() + e.slice(1)).join(" ");
|
|
4559
4710
|
}
|
|
4560
4711
|
//#endregion
|
|
4561
4712
|
//#region src/components/fields/cells/factories/badge.tsx
|
|
4562
|
-
var
|
|
4713
|
+
var Fa = /* @__PURE__ */ new Set([
|
|
4563
4714
|
"indigo",
|
|
4564
4715
|
"emerald",
|
|
4565
4716
|
"amber",
|
|
@@ -4569,17 +4720,17 @@ var Pa = /* @__PURE__ */ new Set([
|
|
|
4569
4720
|
"slate",
|
|
4570
4721
|
"teal"
|
|
4571
4722
|
]);
|
|
4572
|
-
function
|
|
4573
|
-
return e &&
|
|
4723
|
+
function Ia(e) {
|
|
4724
|
+
return e && Fa.has(e) ? e : "slate";
|
|
4574
4725
|
}
|
|
4575
|
-
var
|
|
4726
|
+
var La = (e) => {
|
|
4576
4727
|
let { field: t, locale: n = "en" } = e, r = /* @__PURE__ */ new Map();
|
|
4577
4728
|
if (t.values) for (let e of t.values) r.set(e.code, {
|
|
4578
|
-
tone:
|
|
4729
|
+
tone: Ia(e.color),
|
|
4579
4730
|
label: L(e.name, n) || e.code
|
|
4580
4731
|
});
|
|
4581
4732
|
if (t.display?.value_map) for (let [e, i] of Object.entries(t.display.value_map)) {
|
|
4582
|
-
let t = r.get(e), a = i.color ?
|
|
4733
|
+
let t = r.get(e), a = i.color ? Ia(i.color) : t?.tone ?? "slate", o = (i.label ? L(i.label, n) : "") || t?.label || e;
|
|
4583
4734
|
r.set(e, {
|
|
4584
4735
|
tone: a,
|
|
4585
4736
|
label: o
|
|
@@ -4594,7 +4745,7 @@ var Ia = (e) => {
|
|
|
4594
4745
|
children: n?.label ?? t
|
|
4595
4746
|
});
|
|
4596
4747
|
};
|
|
4597
|
-
},
|
|
4748
|
+
}, Ra = /* @__PURE__ */ new Set([
|
|
4598
4749
|
"indigo",
|
|
4599
4750
|
"emerald",
|
|
4600
4751
|
"amber",
|
|
@@ -4604,13 +4755,13 @@ var Ia = (e) => {
|
|
|
4604
4755
|
"slate",
|
|
4605
4756
|
"teal"
|
|
4606
4757
|
]);
|
|
4607
|
-
function
|
|
4608
|
-
return e &&
|
|
4758
|
+
function za(e) {
|
|
4759
|
+
return e && Ra.has(e) ? e : "slate";
|
|
4609
4760
|
}
|
|
4610
|
-
var
|
|
4761
|
+
var Ba = (e) => {
|
|
4611
4762
|
let { entity: t, locale: n = "en" } = e, r = /* @__PURE__ */ new Map();
|
|
4612
4763
|
if (t?.status_groups) for (let e of Object.values(t.status_groups)) for (let t of e.statuses) r.set(t.code, {
|
|
4613
|
-
tone:
|
|
4764
|
+
tone: za(t.color),
|
|
4614
4765
|
label: L(t.name, n) || t.code
|
|
4615
4766
|
});
|
|
4616
4767
|
return (e) => {
|
|
@@ -4622,7 +4773,7 @@ var za = (e) => {
|
|
|
4622
4773
|
children: n?.label ?? t
|
|
4623
4774
|
});
|
|
4624
4775
|
};
|
|
4625
|
-
},
|
|
4776
|
+
}, Va = /* @__PURE__ */ new Set([
|
|
4626
4777
|
"indigo",
|
|
4627
4778
|
"emerald",
|
|
4628
4779
|
"amber",
|
|
@@ -4632,14 +4783,14 @@ var za = (e) => {
|
|
|
4632
4783
|
"slate",
|
|
4633
4784
|
"teal"
|
|
4634
4785
|
]);
|
|
4635
|
-
function
|
|
4636
|
-
return e &&
|
|
4786
|
+
function Ha(e) {
|
|
4787
|
+
return e && Va.has(e) ? e : null;
|
|
4637
4788
|
}
|
|
4638
|
-
var
|
|
4789
|
+
var Ua = (e) => {
|
|
4639
4790
|
let { field: t, locale: n = "en" } = e, r = /* @__PURE__ */ new Map();
|
|
4640
4791
|
if (t.display?.value_map) for (let [e, i] of Object.entries(t.display.value_map)) r.set(e, {
|
|
4641
4792
|
label: i.label && L(i.label, n) || e,
|
|
4642
|
-
tone:
|
|
4793
|
+
tone: Ha(i.color)
|
|
4643
4794
|
});
|
|
4644
4795
|
return (e) => !Array.isArray(e) || e.length === 0 ? "—" : /* @__PURE__ */ b("span", {
|
|
4645
4796
|
style: {
|
|
@@ -4653,26 +4804,26 @@ var Ha = (e) => {
|
|
|
4653
4804
|
tone: i.tone,
|
|
4654
4805
|
size: "xs",
|
|
4655
4806
|
children: i.label
|
|
4656
|
-
}, `${n}-${t}`) : /* @__PURE__ */ b(
|
|
4807
|
+
}, `${n}-${t}`) : /* @__PURE__ */ b(N, { children: i?.label ?? n }, `${n}-${t}`);
|
|
4657
4808
|
})
|
|
4658
4809
|
});
|
|
4659
|
-
},
|
|
4810
|
+
}, Wa = () => (e) => {
|
|
4660
4811
|
if (e == null || e === "") return "—";
|
|
4661
|
-
let { text: t, absolute: n } =
|
|
4812
|
+
let { text: t, absolute: n } = hi(typeof e == "string" ? e : I(e));
|
|
4662
4813
|
return /* @__PURE__ */ b("span", {
|
|
4663
4814
|
title: n,
|
|
4664
4815
|
children: t
|
|
4665
4816
|
});
|
|
4666
|
-
},
|
|
4817
|
+
}, Ga = () => (e) => e == null || e === "" ? "—" : mi(typeof e == "string" ? e : I(e)), Ka = 60 * 1e3, qa = 300 * 1e3, Ja = () => (e) => {
|
|
4667
4818
|
if (e == null || e === "") return "—";
|
|
4668
4819
|
let t = typeof e == "string" ? e : I(e), n = new Date(t);
|
|
4669
4820
|
if (isNaN(n.getTime())) return t;
|
|
4670
|
-
let r =
|
|
4821
|
+
let r = mi(t), i = Date.now() - n.getTime();
|
|
4671
4822
|
if (i <= 0) return /* @__PURE__ */ x("span", {
|
|
4672
4823
|
title: r,
|
|
4673
4824
|
children: ["in ", w(n, /* @__PURE__ */ new Date(), { addSuffix: !1 })]
|
|
4674
4825
|
});
|
|
4675
|
-
if (i <=
|
|
4826
|
+
if (i <= Ka) return /* @__PURE__ */ b("span", {
|
|
4676
4827
|
title: r,
|
|
4677
4828
|
children: /* @__PURE__ */ b(k, {
|
|
4678
4829
|
tone: "slate",
|
|
@@ -4684,13 +4835,13 @@ var Ha = (e) => {
|
|
|
4684
4835
|
return /* @__PURE__ */ b("span", {
|
|
4685
4836
|
title: r,
|
|
4686
4837
|
children: /* @__PURE__ */ x(k, {
|
|
4687
|
-
tone: i <=
|
|
4838
|
+
tone: i <= qa ? "amber" : "rose",
|
|
4688
4839
|
size: "xs",
|
|
4689
4840
|
children: ["overdue ", a]
|
|
4690
4841
|
})
|
|
4691
4842
|
});
|
|
4692
|
-
},
|
|
4693
|
-
let { field: t, locale: n = "en" } = e, r = t.display?.currency || "USD", i = t.display?.currency_field, a =
|
|
4843
|
+
}, Ya = (e) => {
|
|
4844
|
+
let { field: t, locale: n = "en" } = e, r = t.display?.currency || "USD", i = t.display?.currency_field, a = Xa(t.display?.currency_display), o = Za(typeof t.scale == "number" ? t.scale : 2, 0, 6), s = /* @__PURE__ */ new Map();
|
|
4694
4845
|
return (e, t = {}) => {
|
|
4695
4846
|
if (e == null || e === "") return "—";
|
|
4696
4847
|
let c = typeof e == "number" ? e : Number(e);
|
|
@@ -4705,7 +4856,7 @@ var Ha = (e) => {
|
|
|
4705
4856
|
}), s.set(d, f)), f.format(c);
|
|
4706
4857
|
};
|
|
4707
4858
|
};
|
|
4708
|
-
function
|
|
4859
|
+
function Xa(e) {
|
|
4709
4860
|
switch (e) {
|
|
4710
4861
|
case "narrow_symbol": return "narrowSymbol";
|
|
4711
4862
|
case "code":
|
|
@@ -4714,16 +4865,16 @@ function Ya(e) {
|
|
|
4714
4865
|
default: return "symbol";
|
|
4715
4866
|
}
|
|
4716
4867
|
}
|
|
4717
|
-
function
|
|
4868
|
+
function Za(e, t, n) {
|
|
4718
4869
|
return e < t ? t : e > n ? n : e;
|
|
4719
4870
|
}
|
|
4720
4871
|
//#endregion
|
|
4721
4872
|
//#region src/components/fields/cells/factories/refLink.tsx
|
|
4722
|
-
var
|
|
4873
|
+
var Qa = (e) => {
|
|
4723
4874
|
let { field: t, entities: r, screens: i, refs: a, surface: o } = e, s = t.ref?.entity, c = s ? r?.[s] : void 0, l = typeof a == "function" ? a : () => a, u = o === "detail", d = c?.display?.icon, f = t.display?.ref_display_field || "$display", p = c?.detail_screen, m = (p ? i?.[p] : void 0)?.route;
|
|
4724
4875
|
return (e, t) => {
|
|
4725
4876
|
if (e == null || e === "") return "—";
|
|
4726
|
-
let r = I(e), i =
|
|
4877
|
+
let r = I(e), i = $a(r, s, l(), f), a = m ? m.replace(":id", encodeURIComponent(r)) : void 0;
|
|
4727
4878
|
if (u) {
|
|
4728
4879
|
let e = /* @__PURE__ */ x(y, { children: [d && /* @__PURE__ */ b("span", {
|
|
4729
4880
|
style: {
|
|
@@ -4765,29 +4916,29 @@ var Za = (e) => {
|
|
|
4765
4916
|
}) : i;
|
|
4766
4917
|
};
|
|
4767
4918
|
};
|
|
4768
|
-
function
|
|
4919
|
+
function $a(e, t, n, r) {
|
|
4769
4920
|
let i = t && n ? n[t]?.[e] : void 0;
|
|
4770
4921
|
return i ? R(i, r, e) : e;
|
|
4771
4922
|
}
|
|
4772
4923
|
//#endregion
|
|
4773
4924
|
//#region src/components/fields/cells/factories/url-helpers.ts
|
|
4774
|
-
var
|
|
4775
|
-
function to(e) {
|
|
4776
|
-
return /^[a-z]{2,3}$/i.test(e) || eo.test(e);
|
|
4777
|
-
}
|
|
4925
|
+
var eo = /^(https?|ftps?|ssh|mailto|tel):/i, to = /^(info|name|tech|site|cloud|online|store|shop|blog|space|world|link|live|page|zone|life|team|work|host|land|news|wiki|mobi|coop|aero|asia)$/i;
|
|
4778
4926
|
function no(e) {
|
|
4927
|
+
return /^[a-z]{2,3}$/i.test(e) || to.test(e);
|
|
4928
|
+
}
|
|
4929
|
+
function ro(e) {
|
|
4779
4930
|
if (!e.includes(".")) return !1;
|
|
4780
4931
|
let t = e.split(".");
|
|
4781
4932
|
if (t.length < 3) return !0;
|
|
4782
4933
|
let n = t[0].toLowerCase();
|
|
4783
|
-
return /^(com|org|net|edu|gov)$/.test(n) ? !1 : !/^(io|app|dev)$/.test(n) ||
|
|
4934
|
+
return /^(com|org|net|edu|gov)$/.test(n) ? !1 : !/^(io|app|dev)$/.test(n) || no(t[t.length - 1]);
|
|
4784
4935
|
}
|
|
4785
|
-
function
|
|
4786
|
-
if (
|
|
4936
|
+
function io(e) {
|
|
4937
|
+
if (eo.test(e)) return e;
|
|
4787
4938
|
let t = e.match(/^([a-z][a-z0-9+.-]*):/i);
|
|
4788
4939
|
if (t) {
|
|
4789
4940
|
let n = t[1], r = e.slice(t[0].length);
|
|
4790
|
-
if (/^\d+([/?#]|$)/.test(r) &&
|
|
4941
|
+
if (/^\d+([/?#]|$)/.test(r) && ro(n)) {
|
|
4791
4942
|
let t = parseInt(r, 10);
|
|
4792
4943
|
if (t >= 1 && t <= 65535) return `https://${e}`;
|
|
4793
4944
|
}
|
|
@@ -4795,14 +4946,14 @@ function ro(e) {
|
|
|
4795
4946
|
}
|
|
4796
4947
|
return `https://${e}`;
|
|
4797
4948
|
}
|
|
4798
|
-
function
|
|
4949
|
+
function ao(e) {
|
|
4799
4950
|
try {
|
|
4800
4951
|
return new URL(e).hostname.replace(/^www\./i, "") || null;
|
|
4801
4952
|
} catch {
|
|
4802
4953
|
return null;
|
|
4803
4954
|
}
|
|
4804
4955
|
}
|
|
4805
|
-
function
|
|
4956
|
+
function oo(e, t) {
|
|
4806
4957
|
if (t !== "linkedin.com") return null;
|
|
4807
4958
|
try {
|
|
4808
4959
|
let t = new URL(e).pathname.match(/^\/(in|company|school)\/([^/]+)/i);
|
|
@@ -4810,7 +4961,7 @@ function ao(e, t) {
|
|
|
4810
4961
|
} catch {}
|
|
4811
4962
|
return null;
|
|
4812
4963
|
}
|
|
4813
|
-
function
|
|
4964
|
+
function so(e) {
|
|
4814
4965
|
try {
|
|
4815
4966
|
return new URL(e), !0;
|
|
4816
4967
|
} catch {
|
|
@@ -4819,7 +4970,7 @@ function oo(e) {
|
|
|
4819
4970
|
}
|
|
4820
4971
|
//#endregion
|
|
4821
4972
|
//#region src/components/fields/cells/factories/host-icons.tsx
|
|
4822
|
-
function
|
|
4973
|
+
function co(e, t = "0 0 24 24") {
|
|
4823
4974
|
return (n) => /* @__PURE__ */ b("svg", {
|
|
4824
4975
|
width: 16,
|
|
4825
4976
|
height: 16,
|
|
@@ -4835,17 +4986,17 @@ function so(e, t = "0 0 24 24") {
|
|
|
4835
4986
|
children: e
|
|
4836
4987
|
});
|
|
4837
4988
|
}
|
|
4838
|
-
var
|
|
4989
|
+
var lo = co(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
4839
4990
|
cx: "12",
|
|
4840
4991
|
cy: "12",
|
|
4841
4992
|
r: "9"
|
|
4842
|
-
}), /* @__PURE__ */ b("path", { d: "M3 12h18M12 3c3 3 3 15 0 18-3-3-3-15 0-18" })] })),
|
|
4993
|
+
}), /* @__PURE__ */ b("path", { d: "M3 12h18M12 3c3 3 3 15 0 18-3-3-3-15 0-18" })] })), uo = () => /* @__PURE__ */ b(e, {
|
|
4843
4994
|
size: 16,
|
|
4844
4995
|
style: {
|
|
4845
4996
|
flexShrink: 0,
|
|
4846
4997
|
color: "#0A66C2"
|
|
4847
4998
|
}
|
|
4848
|
-
}),
|
|
4999
|
+
}), fo = (e) => /* @__PURE__ */ b("svg", {
|
|
4849
5000
|
width: 16,
|
|
4850
5001
|
height: 16,
|
|
4851
5002
|
viewBox: "0 0 24 24",
|
|
@@ -4854,7 +5005,7 @@ var co = so(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
4854
5005
|
style: { flexShrink: 0 },
|
|
4855
5006
|
...e,
|
|
4856
5007
|
children: /* @__PURE__ */ b("path", { d: "M12 .5a11.5 11.5 0 0 0-3.64 22.41c.58.1.79-.25.79-.56 0-.27-.01-1-.02-1.96-3.21.7-3.89-1.55-3.89-1.55-.52-1.34-1.28-1.7-1.28-1.7-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.2 1.77 1.2 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.56-.29-5.26-1.28-5.26-5.71 0-1.26.45-2.3 1.19-3.11-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.19a11.05 11.05 0 0 1 5.79 0c2.21-1.5 3.18-1.19 3.18-1.19.63 1.59.23 2.76.11 3.05.74.81 1.19 1.85 1.19 3.11 0 4.44-2.71 5.42-5.29 5.7.41.36.78 1.07.78 2.16 0 1.56-.01 2.81-.01 3.19 0 .31.21.68.8.56A11.5 11.5 0 0 0 12 .5z" })
|
|
4857
|
-
}),
|
|
5008
|
+
}), po = (e) => /* @__PURE__ */ b("svg", {
|
|
4858
5009
|
width: 16,
|
|
4859
5010
|
height: 16,
|
|
4860
5011
|
viewBox: "0 0 24 24",
|
|
@@ -4863,7 +5014,7 @@ var co = so(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
4863
5014
|
style: { flexShrink: 0 },
|
|
4864
5015
|
...e,
|
|
4865
5016
|
children: /* @__PURE__ */ b("path", { d: "M18.244 2H21.5l-7.62 8.71L23 22h-7.05l-5.52-7.21L4.07 22H.81l8.18-9.34L1 2h7.22l5 6.59L18.244 2zm-2.47 18h1.95L7.32 4h-2.1l10.55 16z" })
|
|
4866
|
-
}),
|
|
5017
|
+
}), mo = (e) => /* @__PURE__ */ b("svg", {
|
|
4867
5018
|
width: 16,
|
|
4868
5019
|
height: 16,
|
|
4869
5020
|
viewBox: "0 0 24 24",
|
|
@@ -4872,7 +5023,7 @@ var co = so(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
4872
5023
|
style: { flexShrink: 0 },
|
|
4873
5024
|
...e,
|
|
4874
5025
|
children: /* @__PURE__ */ b("path", { d: "M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1c.5-1.9.5-5.8.5-5.8s0-3.9-.5-5.8zM9.6 15.6V8.4l6.2 3.6-6.2 3.6z" })
|
|
4875
|
-
}),
|
|
5026
|
+
}), ho = (e) => /* @__PURE__ */ b("svg", {
|
|
4876
5027
|
width: 16,
|
|
4877
5028
|
height: 16,
|
|
4878
5029
|
viewBox: "0 0 24 24",
|
|
@@ -4881,7 +5032,7 @@ var co = so(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
4881
5032
|
style: { flexShrink: 0 },
|
|
4882
5033
|
...e,
|
|
4883
5034
|
children: /* @__PURE__ */ b("path", { d: "M24 5.45v13.1A1.45 1.45 0 0 1 22.55 20H19.5V9.27L12 14.7 4.5 9.27V20H1.45A1.45 1.45 0 0 1 0 18.55V5.45A1.45 1.45 0 0 1 1.45 4h.5l10.05 7.27L22.05 4h.5A1.45 1.45 0 0 1 24 5.45z" })
|
|
4884
|
-
}),
|
|
5035
|
+
}), go = (e) => /* @__PURE__ */ x("svg", {
|
|
4885
5036
|
width: 16,
|
|
4886
5037
|
height: 16,
|
|
4887
5038
|
viewBox: "0 0 24 24",
|
|
@@ -4906,7 +5057,7 @@ var co = so(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
4906
5057
|
d: "M15.17 18.96a2.52 2.52 0 1 1-2.52 2.52v-2.52h2.52zm0-1.27a2.52 2.52 0 1 1 0-5.04h6.31a2.52 2.52 0 1 1 0 5.04h-6.31z"
|
|
4907
5058
|
})
|
|
4908
5059
|
]
|
|
4909
|
-
}),
|
|
5060
|
+
}), _o = (e) => /* @__PURE__ */ b("svg", {
|
|
4910
5061
|
width: 16,
|
|
4911
5062
|
height: 16,
|
|
4912
5063
|
viewBox: "0 0 24 24",
|
|
@@ -4915,39 +5066,39 @@ var co = so(/* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("circle", {
|
|
|
4915
5066
|
style: { flexShrink: 0 },
|
|
4916
5067
|
...e,
|
|
4917
5068
|
children: /* @__PURE__ */ b("path", { d: "M4.46 3.83 14.94 3a3.7 3.7 0 0 1 2.5.62l3 2.16a1.4 1.4 0 0 1 .56 1.31v13.06a1.7 1.7 0 0 1-1.66 1.7l-12.5.78a2.4 2.4 0 0 1-1.85-.62L2.5 19.7a1.7 1.7 0 0 1-.5-1.2V5.16c0-.74.6-1.27 1.46-1.33l1-.01zm.46 1.86c-.31 0-.46.16-.46.47v12.25c0 .31.16.47.46.47l11.62-.7c.31 0 .46-.16.46-.47V6c0-.32-.16-.47-.46-.47L4.92 5.7zm5.57 2.32c.16 0 .31.16.31.31v.46l3.7.23c.31 0 .46.16.46.47v8.32c0 .31-.16.47-.46.47l-3.7.23c-.31 0-.46-.16-.46-.47V8.78c0-.16.15-.32.15-.46l-.04-.31z" })
|
|
4918
|
-
}),
|
|
4919
|
-
"linkedin.com":
|
|
4920
|
-
"github.com":
|
|
4921
|
-
"x.com":
|
|
4922
|
-
"twitter.com":
|
|
4923
|
-
"youtube.com":
|
|
4924
|
-
"youtu.be":
|
|
4925
|
-
"gmail.com":
|
|
4926
|
-
"mail.google.com":
|
|
4927
|
-
"slack.com":
|
|
4928
|
-
"notion.so":
|
|
4929
|
-
"notion.com":
|
|
5069
|
+
}), vo = {
|
|
5070
|
+
"linkedin.com": uo,
|
|
5071
|
+
"github.com": fo,
|
|
5072
|
+
"x.com": po,
|
|
5073
|
+
"twitter.com": po,
|
|
5074
|
+
"youtube.com": mo,
|
|
5075
|
+
"youtu.be": mo,
|
|
5076
|
+
"gmail.com": ho,
|
|
5077
|
+
"mail.google.com": ho,
|
|
5078
|
+
"slack.com": go,
|
|
5079
|
+
"notion.so": _o,
|
|
5080
|
+
"notion.com": _o
|
|
4930
5081
|
};
|
|
4931
|
-
function
|
|
5082
|
+
function yo(e, t) {
|
|
4932
5083
|
return !e || t === "none" ? null : t === "google" ? `https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=32` : `https://${e}/favicon.ico`;
|
|
4933
5084
|
}
|
|
4934
|
-
var
|
|
5085
|
+
var bo = {
|
|
4935
5086
|
width: 16,
|
|
4936
5087
|
height: 16,
|
|
4937
5088
|
flexShrink: 0,
|
|
4938
5089
|
objectFit: "contain"
|
|
4939
5090
|
};
|
|
4940
|
-
function
|
|
4941
|
-
let n = e ? e.toLowerCase() : "", r = n ?
|
|
5091
|
+
function xo({ domain: e, source: t }) {
|
|
5092
|
+
let n = e ? e.toLowerCase() : "", r = n ? vo[n] : void 0;
|
|
4942
5093
|
if (r) return /* @__PURE__ */ b(r, {});
|
|
4943
|
-
let i =
|
|
4944
|
-
return i ? /* @__PURE__ */ b(
|
|
5094
|
+
let i = yo(n, t);
|
|
5095
|
+
return i ? /* @__PURE__ */ b(So, { src: i }) : /* @__PURE__ */ b(lo, {});
|
|
4945
5096
|
}
|
|
4946
|
-
function
|
|
5097
|
+
function So({ src: e }) {
|
|
4947
5098
|
let [t, n] = p(!1);
|
|
4948
5099
|
return l(() => {
|
|
4949
5100
|
n(!1);
|
|
4950
|
-
}, [e]), t ? /* @__PURE__ */ b(
|
|
5101
|
+
}, [e]), t ? /* @__PURE__ */ b(lo, {}) : /* @__PURE__ */ b("img", {
|
|
4951
5102
|
src: e,
|
|
4952
5103
|
alt: "",
|
|
4953
5104
|
width: 16,
|
|
@@ -4955,7 +5106,7 @@ function xo({ src: e }) {
|
|
|
4955
5106
|
loading: "lazy",
|
|
4956
5107
|
decoding: "async",
|
|
4957
5108
|
referrerPolicy: "no-referrer",
|
|
4958
|
-
style:
|
|
5109
|
+
style: bo,
|
|
4959
5110
|
onError: () => n(!0)
|
|
4960
5111
|
});
|
|
4961
5112
|
}
|
|
@@ -4965,33 +5116,33 @@ var $ = /* @__PURE__ */ b("span", {
|
|
|
4965
5116
|
color: "var(--text-4)"
|
|
4966
5117
|
},
|
|
4967
5118
|
children: "—"
|
|
4968
|
-
}),
|
|
5119
|
+
}), Co = {
|
|
4969
5120
|
display: "inline-flex",
|
|
4970
5121
|
alignItems: "center",
|
|
4971
5122
|
gap: 4,
|
|
4972
5123
|
fontSize: 12.5,
|
|
4973
5124
|
color: "var(--accent)",
|
|
4974
5125
|
textDecoration: "none"
|
|
4975
|
-
},
|
|
5126
|
+
}, wo = { fontSize: 12.5 }, To = (e) => {
|
|
4976
5127
|
let n = e.field.display?.favicon_source ?? "google";
|
|
4977
5128
|
return (e) => {
|
|
4978
5129
|
let r = e == null ? "" : I(e);
|
|
4979
5130
|
if (!r) return $;
|
|
4980
|
-
let i =
|
|
4981
|
-
if (i == null || !
|
|
4982
|
-
style:
|
|
5131
|
+
let i = io(r);
|
|
5132
|
+
if (i == null || !so(i)) return /* @__PURE__ */ b("span", {
|
|
5133
|
+
style: wo,
|
|
4983
5134
|
children: r
|
|
4984
5135
|
});
|
|
4985
|
-
let a =
|
|
5136
|
+
let a = ao(i), o = oo(i, a ?? "") ?? a ?? r;
|
|
4986
5137
|
return /* @__PURE__ */ x("a", {
|
|
4987
5138
|
href: i,
|
|
4988
5139
|
target: "_blank",
|
|
4989
5140
|
rel: "noopener noreferrer",
|
|
4990
5141
|
title: r,
|
|
4991
5142
|
className: "mono",
|
|
4992
|
-
style:
|
|
5143
|
+
style: Co,
|
|
4993
5144
|
children: [
|
|
4994
|
-
/* @__PURE__ */ b(
|
|
5145
|
+
/* @__PURE__ */ b(xo, {
|
|
4995
5146
|
domain: a,
|
|
4996
5147
|
source: n
|
|
4997
5148
|
}),
|
|
@@ -5000,43 +5151,43 @@ var $ = /* @__PURE__ */ b("span", {
|
|
|
5000
5151
|
]
|
|
5001
5152
|
});
|
|
5002
5153
|
};
|
|
5003
|
-
},
|
|
5154
|
+
}, Eo = {
|
|
5004
5155
|
fontSize: 12.5,
|
|
5005
5156
|
color: "var(--accent)",
|
|
5006
5157
|
textDecoration: "none"
|
|
5007
|
-
},
|
|
5158
|
+
}, Do = () => (e) => {
|
|
5008
5159
|
let t = e == null ? "" : I(e);
|
|
5009
5160
|
return t ? /* @__PURE__ */ b("a", {
|
|
5010
5161
|
href: `mailto:${t}`,
|
|
5011
5162
|
className: "mono",
|
|
5012
|
-
style:
|
|
5163
|
+
style: Eo,
|
|
5013
5164
|
children: t
|
|
5014
5165
|
}) : $;
|
|
5015
|
-
},
|
|
5166
|
+
}, Oo = {
|
|
5016
5167
|
fontSize: 12.5,
|
|
5017
5168
|
color: "var(--accent)",
|
|
5018
5169
|
textDecoration: "none"
|
|
5019
|
-
},
|
|
5170
|
+
}, ko = { fontSize: 12.5 }, Ao = /^[+()\-.\s\d]+$/, jo = () => (e) => {
|
|
5020
5171
|
let t = e == null ? "" : I(e);
|
|
5021
5172
|
if (!t) return $;
|
|
5022
5173
|
let n = t.trim();
|
|
5023
|
-
return
|
|
5174
|
+
return Ao.test(n) ? /* @__PURE__ */ b("a", {
|
|
5024
5175
|
href: `tel:${n.replace(/\s+/g, "")}`,
|
|
5025
5176
|
className: "mono",
|
|
5026
|
-
style:
|
|
5177
|
+
style: Oo,
|
|
5027
5178
|
children: t
|
|
5028
5179
|
}) : /* @__PURE__ */ b("span", {
|
|
5029
|
-
style:
|
|
5180
|
+
style: ko,
|
|
5030
5181
|
children: t
|
|
5031
5182
|
});
|
|
5032
|
-
},
|
|
5183
|
+
}, Mo = {
|
|
5033
5184
|
fontSize: 12.5,
|
|
5034
5185
|
fontVariantNumeric: "tabular-nums"
|
|
5035
|
-
},
|
|
5186
|
+
}, No = {
|
|
5036
5187
|
color: "var(--text-3)",
|
|
5037
5188
|
marginLeft: 4
|
|
5038
|
-
},
|
|
5039
|
-
function
|
|
5189
|
+
}, Po = { fontSize: 12.5 };
|
|
5190
|
+
function Fo(e, t) {
|
|
5040
5191
|
let n = e.trim();
|
|
5041
5192
|
if (n === "" || n === "-") return n;
|
|
5042
5193
|
let r = n.startsWith("-"), [i, a] = (r ? n.slice(1) : n).split("."), o;
|
|
@@ -5048,45 +5199,45 @@ function Po(e, t) {
|
|
|
5048
5199
|
let s = r ? `-${o}` : o;
|
|
5049
5200
|
return a !== void 0 && (s += `.${a}`), s;
|
|
5050
5201
|
}
|
|
5051
|
-
var
|
|
5202
|
+
var Io = (e) => {
|
|
5052
5203
|
let { field: t, fieldName: n, locale: r = "en" } = e, i = new Intl.NumberFormat(r), a = t.type === "decimal", o = t.unit ? t.unit.display || t.unit.storage : void 0;
|
|
5053
5204
|
return (e, t) => {
|
|
5054
5205
|
if (e == null) return $;
|
|
5055
5206
|
let r = t.$units?.[n] || (o && !o.startsWith("$") ? o : void 0), s;
|
|
5056
|
-
if (a && typeof e == "string") s =
|
|
5207
|
+
if (a && typeof e == "string") s = Fo(e, i);
|
|
5057
5208
|
else {
|
|
5058
5209
|
let t = typeof e == "number" ? e : Number(e);
|
|
5059
5210
|
s = Number.isFinite(t) ? i.format(t) : null;
|
|
5060
5211
|
}
|
|
5061
5212
|
return s == null ? /* @__PURE__ */ b("span", {
|
|
5062
|
-
style:
|
|
5213
|
+
style: Po,
|
|
5063
5214
|
children: "—"
|
|
5064
5215
|
}) : /* @__PURE__ */ x("span", {
|
|
5065
5216
|
className: "num",
|
|
5066
|
-
style:
|
|
5217
|
+
style: Mo,
|
|
5067
5218
|
children: [s, r && /* @__PURE__ */ b("span", {
|
|
5068
|
-
style:
|
|
5219
|
+
style: No,
|
|
5069
5220
|
children: r
|
|
5070
5221
|
})]
|
|
5071
5222
|
});
|
|
5072
5223
|
};
|
|
5073
|
-
},
|
|
5224
|
+
}, Lo = { fontSize: 12.5 }, Ro = () => (e) => e == null || e === "" ? $ : /* @__PURE__ */ b("code", {
|
|
5074
5225
|
className: "mono",
|
|
5075
|
-
style:
|
|
5226
|
+
style: Lo,
|
|
5076
5227
|
children: I(e)
|
|
5077
|
-
}),
|
|
5228
|
+
}), zo = {
|
|
5078
5229
|
display: "inline-flex",
|
|
5079
5230
|
alignItems: "center",
|
|
5080
5231
|
gap: 4,
|
|
5081
5232
|
fontSize: 12.5,
|
|
5082
5233
|
color: "var(--accent)",
|
|
5083
5234
|
textDecoration: "none"
|
|
5084
|
-
},
|
|
5235
|
+
}, Bo = { fontSize: 12.5 }, Vo = () => (e) => {
|
|
5085
5236
|
let n = e == null ? "" : I(e);
|
|
5086
5237
|
if (!n) return $;
|
|
5087
|
-
let r =
|
|
5088
|
-
return r == null || !
|
|
5089
|
-
style:
|
|
5238
|
+
let r = io(n);
|
|
5239
|
+
return r == null || !so(r) ? /* @__PURE__ */ b("span", {
|
|
5240
|
+
style: Bo,
|
|
5090
5241
|
children: n
|
|
5091
5242
|
}) : /* @__PURE__ */ x("a", {
|
|
5092
5243
|
href: r,
|
|
@@ -5094,21 +5245,21 @@ var Fo = (e) => {
|
|
|
5094
5245
|
rel: "noopener noreferrer",
|
|
5095
5246
|
title: n,
|
|
5096
5247
|
className: "mono",
|
|
5097
|
-
style:
|
|
5248
|
+
style: zo,
|
|
5098
5249
|
children: [n, /* @__PURE__ */ b(t.external, { size: 11 })]
|
|
5099
5250
|
});
|
|
5100
|
-
},
|
|
5101
|
-
function
|
|
5102
|
-
return Math.max(1, Math.min(typeof e == "number" && Number.isFinite(e) ? Math.floor(e) :
|
|
5251
|
+
}, Ho = 400, Uo = 2e3;
|
|
5252
|
+
function Wo(e) {
|
|
5253
|
+
return Math.max(1, Math.min(typeof e == "number" && Number.isFinite(e) ? Math.floor(e) : Ho, Uo));
|
|
5103
5254
|
}
|
|
5104
|
-
function
|
|
5255
|
+
function Go(e, t) {
|
|
5105
5256
|
return e.length <= t ? e : `${e.slice(0, t)}...`;
|
|
5106
5257
|
}
|
|
5107
|
-
function
|
|
5258
|
+
function Ko(e, t, n, r = 0) {
|
|
5108
5259
|
if (e == null || e === "") return "";
|
|
5109
|
-
if (typeof e == "string") return
|
|
5260
|
+
if (typeof e == "string") return Go(e, t);
|
|
5110
5261
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
5111
|
-
if (typeof e != "object") return
|
|
5262
|
+
if (typeof e != "object") return Go(I(e), t);
|
|
5112
5263
|
if (n.has(e)) return "[Circular]";
|
|
5113
5264
|
if (r >= 3) return Array.isArray(e) ? "[...]" : "{...}";
|
|
5114
5265
|
n.add(e);
|
|
@@ -5119,30 +5270,30 @@ function Go(e, t, n, r = 0) {
|
|
|
5119
5270
|
a.push(a.length > 1 ? ",..." : "...");
|
|
5120
5271
|
break;
|
|
5121
5272
|
}
|
|
5122
|
-
let f =
|
|
5273
|
+
let f = Ko(c, d, n, r + 1);
|
|
5123
5274
|
if (a.push(u, f), a.join("").length >= t) {
|
|
5124
5275
|
a.push(",...");
|
|
5125
5276
|
break;
|
|
5126
5277
|
}
|
|
5127
5278
|
}
|
|
5128
|
-
return a.push(i), n.delete(e),
|
|
5279
|
+
return a.push(i), n.delete(e), Go(a.join(""), t);
|
|
5129
5280
|
}
|
|
5130
|
-
function
|
|
5131
|
-
return
|
|
5281
|
+
function qo(e, t) {
|
|
5282
|
+
return Ko(e, t, /* @__PURE__ */ new WeakSet());
|
|
5132
5283
|
}
|
|
5133
|
-
var
|
|
5134
|
-
let t = e.surface ?? "detail", n =
|
|
5284
|
+
var Jo = (e) => {
|
|
5285
|
+
let t = e.surface ?? "detail", n = Wo(e.field.display?.list_preview?.max_chars);
|
|
5135
5286
|
return (r) => {
|
|
5136
|
-
if (
|
|
5287
|
+
if (Ri(r)) return $;
|
|
5137
5288
|
if (t === "list") {
|
|
5138
|
-
let e =
|
|
5289
|
+
let e = qo(r, n);
|
|
5139
5290
|
return /* @__PURE__ */ b("span", {
|
|
5140
5291
|
className: "font-mono text-xs text-muted-foreground",
|
|
5141
5292
|
title: e,
|
|
5142
5293
|
children: e
|
|
5143
5294
|
});
|
|
5144
5295
|
}
|
|
5145
|
-
return /* @__PURE__ */ b(
|
|
5296
|
+
return /* @__PURE__ */ b(zi, {
|
|
5146
5297
|
field: e.field,
|
|
5147
5298
|
fieldName: e.fieldName,
|
|
5148
5299
|
value: r,
|
|
@@ -5150,7 +5301,7 @@ var qo = (e) => {
|
|
|
5150
5301
|
locale: e.locale
|
|
5151
5302
|
});
|
|
5152
5303
|
};
|
|
5153
|
-
},
|
|
5304
|
+
}, Yo = [
|
|
5154
5305
|
{
|
|
5155
5306
|
pattern: /```[^\n]*\n?([\s\S]*?)```/g,
|
|
5156
5307
|
replacement: "$1"
|
|
@@ -5213,13 +5364,13 @@ var qo = (e) => {
|
|
|
5213
5364
|
replacement: ""
|
|
5214
5365
|
}
|
|
5215
5366
|
];
|
|
5216
|
-
function
|
|
5367
|
+
function Xo(e) {
|
|
5217
5368
|
if (!e) return {
|
|
5218
5369
|
text: "",
|
|
5219
5370
|
isPlain: !0
|
|
5220
5371
|
};
|
|
5221
5372
|
let t = e, n = !1;
|
|
5222
|
-
for (let e of
|
|
5373
|
+
for (let e of Yo) {
|
|
5223
5374
|
let r = t.replace(e.pattern, e.replacement);
|
|
5224
5375
|
r !== t && e.structural !== !1 && (n = !0), t = r;
|
|
5225
5376
|
}
|
|
@@ -5230,123 +5381,123 @@ function Yo(e) {
|
|
|
5230
5381
|
}
|
|
5231
5382
|
//#endregion
|
|
5232
5383
|
//#region src/components/fields/cells/factories/markdown.tsx
|
|
5233
|
-
function
|
|
5234
|
-
return /* @__PURE__ */ b(
|
|
5384
|
+
function Zo(e) {
|
|
5385
|
+
return /* @__PURE__ */ b(Yr, { content: e });
|
|
5235
5386
|
}
|
|
5236
|
-
var
|
|
5387
|
+
var Qo = (e) => {
|
|
5237
5388
|
let t = e.surface === "list";
|
|
5238
5389
|
return (e) => {
|
|
5239
5390
|
let n = e == null ? "" : I(e);
|
|
5240
5391
|
if (!n) return $;
|
|
5241
|
-
if (!t) return
|
|
5242
|
-
let { text: r, isPlain: i } =
|
|
5392
|
+
if (!t) return Zo(n);
|
|
5393
|
+
let { text: r, isPlain: i } = Xo(n);
|
|
5243
5394
|
return i ? /* @__PURE__ */ b("span", {
|
|
5244
5395
|
title: r,
|
|
5245
5396
|
children: r
|
|
5246
|
-
}) : /* @__PURE__ */ b(
|
|
5247
|
-
content:
|
|
5397
|
+
}) : /* @__PURE__ */ b(se, {
|
|
5398
|
+
content: Zo(n),
|
|
5248
5399
|
children: /* @__PURE__ */ b("span", {
|
|
5249
5400
|
title: r,
|
|
5250
5401
|
children: r
|
|
5251
5402
|
})
|
|
5252
5403
|
});
|
|
5253
5404
|
};
|
|
5254
|
-
},
|
|
5405
|
+
}, $o = "[SET]", es = {
|
|
5255
5406
|
fontSize: 12.5,
|
|
5256
5407
|
color: "var(--text-3)"
|
|
5257
|
-
},
|
|
5408
|
+
}, ts = {
|
|
5258
5409
|
fontSize: 12.5,
|
|
5259
5410
|
color: "var(--text-4)",
|
|
5260
5411
|
fontStyle: "italic"
|
|
5261
|
-
},
|
|
5412
|
+
}, ns = () => (e) => e === $o || typeof e == "string" && e !== "" ? /* @__PURE__ */ b("span", {
|
|
5262
5413
|
className: "mono",
|
|
5263
|
-
style: $o,
|
|
5264
|
-
children: Qo
|
|
5265
|
-
}) : /* @__PURE__ */ b("span", {
|
|
5266
5414
|
style: es,
|
|
5415
|
+
children: $o
|
|
5416
|
+
}) : /* @__PURE__ */ b("span", {
|
|
5417
|
+
style: ts,
|
|
5267
5418
|
children: "Not set"
|
|
5268
5419
|
});
|
|
5269
5420
|
//#endregion
|
|
5270
5421
|
//#region src/components/fields/cells/factories/richTextPreview.tsx
|
|
5271
|
-
function
|
|
5272
|
-
return /* @__PURE__ */ b(
|
|
5422
|
+
function rs(e, t) {
|
|
5423
|
+
return /* @__PURE__ */ b(Yr, {
|
|
5273
5424
|
content: e,
|
|
5274
5425
|
files: t
|
|
5275
5426
|
});
|
|
5276
5427
|
}
|
|
5277
|
-
var
|
|
5428
|
+
var is = (e) => {
|
|
5278
5429
|
let { fieldName: t } = e, n = e.surface === "list";
|
|
5279
5430
|
return (e, r) => {
|
|
5280
|
-
let i = r?.$files?.[t], a =
|
|
5431
|
+
let i = r?.$files?.[t], a = ra(e, i);
|
|
5281
5432
|
if (!a.markdown) return $;
|
|
5282
|
-
if (!n) return
|
|
5283
|
-
let { text: o, isPlain: s } =
|
|
5433
|
+
if (!n) return rs(a.markdown, a.files);
|
|
5434
|
+
let { text: o, isPlain: s } = Xo(a.markdown);
|
|
5284
5435
|
return s ? /* @__PURE__ */ b("span", {
|
|
5285
5436
|
title: o,
|
|
5286
5437
|
children: o
|
|
5287
|
-
}) : /* @__PURE__ */ b(
|
|
5288
|
-
content:
|
|
5438
|
+
}) : /* @__PURE__ */ b(se, {
|
|
5439
|
+
content: rs(a.markdown, a.files),
|
|
5289
5440
|
children: /* @__PURE__ */ b("span", {
|
|
5290
5441
|
title: o,
|
|
5291
5442
|
children: o
|
|
5292
5443
|
})
|
|
5293
5444
|
});
|
|
5294
5445
|
};
|
|
5295
|
-
},
|
|
5446
|
+
}, as = { fontSize: 12.5 }, os = {
|
|
5296
5447
|
fontSize: 12.5,
|
|
5297
5448
|
whiteSpace: "pre-wrap",
|
|
5298
5449
|
margin: 0
|
|
5299
5450
|
};
|
|
5300
|
-
function
|
|
5451
|
+
function ss(e) {
|
|
5301
5452
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
5302
5453
|
}
|
|
5303
|
-
function
|
|
5454
|
+
function cs(e, t) {
|
|
5304
5455
|
if (t && typeof e[t] == "string" && e[t] !== "") return [t, e[t]];
|
|
5305
5456
|
for (let [t, n] of Object.entries(e)) if (typeof n == "string" && n !== "") return [t, n];
|
|
5306
5457
|
return null;
|
|
5307
5458
|
}
|
|
5308
5459
|
//#endregion
|
|
5309
5460
|
//#region src/components/fields/cells/registry.ts
|
|
5310
|
-
var
|
|
5311
|
-
text:
|
|
5312
|
-
bool_pill:
|
|
5313
|
-
badge:
|
|
5314
|
-
status_pill:
|
|
5315
|
-
tag_list:
|
|
5316
|
-
time_ago:
|
|
5317
|
-
timestamp_full:
|
|
5318
|
-
next_run:
|
|
5319
|
-
money:
|
|
5320
|
-
ref_link:
|
|
5321
|
-
url:
|
|
5322
|
-
email:
|
|
5323
|
-
phone:
|
|
5324
|
-
number:
|
|
5325
|
-
code:
|
|
5326
|
-
link:
|
|
5327
|
-
json:
|
|
5328
|
-
markdown:
|
|
5329
|
-
password_mask:
|
|
5330
|
-
rich_text_preview:
|
|
5461
|
+
var ls = {
|
|
5462
|
+
text: ja,
|
|
5463
|
+
bool_pill: Ma,
|
|
5464
|
+
badge: La,
|
|
5465
|
+
status_pill: Ba,
|
|
5466
|
+
tag_list: Ua,
|
|
5467
|
+
time_ago: Wa,
|
|
5468
|
+
timestamp_full: Ga,
|
|
5469
|
+
next_run: Ja,
|
|
5470
|
+
money: Ya,
|
|
5471
|
+
ref_link: Qa,
|
|
5472
|
+
url: To,
|
|
5473
|
+
email: Do,
|
|
5474
|
+
phone: jo,
|
|
5475
|
+
number: Io,
|
|
5476
|
+
code: Ro,
|
|
5477
|
+
link: Vo,
|
|
5478
|
+
json: Jo,
|
|
5479
|
+
markdown: Qo,
|
|
5480
|
+
password_mask: ns,
|
|
5481
|
+
rich_text_preview: is,
|
|
5331
5482
|
multilang_inline: (e) => {
|
|
5332
5483
|
let { field: t, locale: n } = e, r = t.type === "multilang_text";
|
|
5333
5484
|
return (e) => {
|
|
5334
|
-
let t = ss(
|
|
5485
|
+
let t = cs(ss(e), n);
|
|
5335
5486
|
if (!t) return r ? /* @__PURE__ */ b("p", {
|
|
5336
|
-
style:
|
|
5487
|
+
style: os,
|
|
5337
5488
|
children: "—"
|
|
5338
5489
|
}) : /* @__PURE__ */ b("span", {
|
|
5339
|
-
style:
|
|
5490
|
+
style: as,
|
|
5340
5491
|
children: "—"
|
|
5341
5492
|
});
|
|
5342
5493
|
let [i, a] = t;
|
|
5343
5494
|
return r ? /* @__PURE__ */ b("p", {
|
|
5344
|
-
style:
|
|
5495
|
+
style: os,
|
|
5345
5496
|
lang: i,
|
|
5346
5497
|
dir: "auto",
|
|
5347
5498
|
children: a
|
|
5348
5499
|
}) : /* @__PURE__ */ b("span", {
|
|
5349
|
-
style:
|
|
5500
|
+
style: as,
|
|
5350
5501
|
lang: i,
|
|
5351
5502
|
dir: "auto",
|
|
5352
5503
|
children: a
|
|
@@ -5354,53 +5505,53 @@ var cs = {
|
|
|
5354
5505
|
};
|
|
5355
5506
|
}
|
|
5356
5507
|
};
|
|
5357
|
-
Object.keys(
|
|
5358
|
-
function
|
|
5359
|
-
let t = e.field.display?.widget ?? "text", n =
|
|
5508
|
+
Object.keys(ls).sort();
|
|
5509
|
+
function us(e) {
|
|
5510
|
+
let t = e.field.display?.widget ?? "text", n = ls[t];
|
|
5360
5511
|
if (!n) throw Error(`resolveCellRenderer: no factory registered for widget "${t}" (field "${e.fieldName}"). The engine must stamp a smart default at YAML-load time; an unknown widget here indicates an out-of-sync allow-list.`);
|
|
5361
5512
|
return n(e);
|
|
5362
5513
|
}
|
|
5363
5514
|
//#endregion
|
|
5364
5515
|
//#region src/components/fields/index.tsx
|
|
5365
|
-
var
|
|
5366
|
-
string:
|
|
5367
|
-
text:
|
|
5368
|
-
rich_text:
|
|
5369
|
-
int:
|
|
5370
|
-
float:
|
|
5371
|
-
decimal:
|
|
5372
|
-
bool:
|
|
5373
|
-
timestamp:
|
|
5374
|
-
date:
|
|
5375
|
-
time:
|
|
5376
|
-
enum:
|
|
5377
|
-
email:
|
|
5378
|
-
url:
|
|
5379
|
-
phone:
|
|
5380
|
-
uuid:
|
|
5381
|
-
bytes:
|
|
5382
|
-
ref:
|
|
5383
|
-
json:
|
|
5384
|
-
tags:
|
|
5385
|
-
string_array:
|
|
5386
|
-
int_array:
|
|
5387
|
-
uuid_array:
|
|
5388
|
-
multilang:
|
|
5389
|
-
multilang_text:
|
|
5390
|
-
structure:
|
|
5391
|
-
secret:
|
|
5392
|
-
password:
|
|
5516
|
+
var ds = {
|
|
5517
|
+
string: ai,
|
|
5518
|
+
text: oi,
|
|
5519
|
+
rich_text: Oa,
|
|
5520
|
+
int: Di,
|
|
5521
|
+
float: Di,
|
|
5522
|
+
decimal: Di,
|
|
5523
|
+
bool: wi,
|
|
5524
|
+
timestamp: Ci,
|
|
5525
|
+
date: Ci,
|
|
5526
|
+
time: Ci,
|
|
5527
|
+
enum: ci,
|
|
5528
|
+
email: li,
|
|
5529
|
+
url: ui,
|
|
5530
|
+
phone: di,
|
|
5531
|
+
uuid: ai,
|
|
5532
|
+
bytes: ai,
|
|
5533
|
+
ref: Fi,
|
|
5534
|
+
json: zi,
|
|
5535
|
+
tags: ai,
|
|
5536
|
+
string_array: Qi,
|
|
5537
|
+
int_array: ea,
|
|
5538
|
+
uuid_array: Qi,
|
|
5539
|
+
multilang: Vi,
|
|
5540
|
+
multilang_text: Ui,
|
|
5541
|
+
structure: Wi,
|
|
5542
|
+
secret: Ji,
|
|
5543
|
+
password: Xi
|
|
5393
5544
|
};
|
|
5394
|
-
for (let e of
|
|
5395
|
-
function
|
|
5396
|
-
if (e.field.type === "json" && e.field.structure) return /* @__PURE__ */ b(
|
|
5545
|
+
for (let e of ri) if (!ds[e]) throw Error(`editRegistry: missing entry for FieldType "${e}". The TS union (types/fieldType.ts) and editRegistry must stay in sync with golang/internal/engine/types.go.`);
|
|
5546
|
+
function fs(e) {
|
|
5547
|
+
if (e.field.type === "json" && e.field.structure) return /* @__PURE__ */ b(Wi, { ...e });
|
|
5397
5548
|
if (e.mode === "edit") {
|
|
5398
|
-
let t =
|
|
5549
|
+
let t = ds[e.field.type];
|
|
5399
5550
|
if (!t) throw Error(`renderField: no edit-mode renderer for FieldType "${e.field.type}" (field "${e.fieldName}"). editRegistry must be total over FieldType; check types/fieldType.ts and components/fields/index.tsx.`);
|
|
5400
5551
|
return /* @__PURE__ */ b(t, { ...e });
|
|
5401
5552
|
}
|
|
5402
5553
|
if (!e.field.display?.widget) throw Error(`renderField: display mode requires a non-empty field.display.widget (field "${e.fieldName}", type "${e.field.type}"). The engine must stamp a smart default; an empty widget here means the field bypassed ResolveDefaultWidgets.`);
|
|
5403
|
-
return
|
|
5554
|
+
return us({
|
|
5404
5555
|
field: e.field,
|
|
5405
5556
|
fieldName: e.fieldName,
|
|
5406
5557
|
surface: e.surface ?? "detail",
|
|
@@ -5413,57 +5564,57 @@ function ds(e) {
|
|
|
5413
5564
|
}
|
|
5414
5565
|
//#endregion
|
|
5415
5566
|
//#region src/hooks/useUserLocale.ts
|
|
5416
|
-
var
|
|
5417
|
-
function
|
|
5567
|
+
var ps = "en";
|
|
5568
|
+
function ms() {
|
|
5418
5569
|
if (typeof navigator > "u") return;
|
|
5419
5570
|
let e = navigator.language;
|
|
5420
5571
|
if (e) return e.split("-")[0] || void 0;
|
|
5421
5572
|
}
|
|
5422
|
-
function
|
|
5423
|
-
let e =
|
|
5573
|
+
function hs() {
|
|
5574
|
+
let e = Wn((e) => e.user), { data: t } = Y(), n = e?.language;
|
|
5424
5575
|
if (n && n.trim()) return n;
|
|
5425
5576
|
let r = t?.languages?.[0]?.code;
|
|
5426
|
-
return r && r.trim() ? r :
|
|
5577
|
+
return r && r.trim() ? r : ms() || ps;
|
|
5427
5578
|
}
|
|
5428
5579
|
//#endregion
|
|
5429
5580
|
//#region src/lib/actions.ts
|
|
5430
|
-
var
|
|
5581
|
+
var gs = {
|
|
5431
5582
|
__create: "create",
|
|
5432
5583
|
__edit: "update",
|
|
5433
5584
|
__delete: "delete",
|
|
5434
5585
|
__restore: "restore"
|
|
5435
|
-
},
|
|
5436
|
-
function
|
|
5586
|
+
}, _s = "__peek", vs = "__open";
|
|
5587
|
+
function ys(e) {
|
|
5437
5588
|
return e === "__peek" || e === "__open";
|
|
5438
5589
|
}
|
|
5439
|
-
function
|
|
5590
|
+
function bs(e, t) {
|
|
5440
5591
|
if (!e) return "";
|
|
5441
5592
|
if (t) try {
|
|
5442
|
-
return
|
|
5593
|
+
return et(t, Ze(t, e));
|
|
5443
5594
|
} catch {}
|
|
5444
5595
|
let n = e.id;
|
|
5445
5596
|
return typeof n == "string" ? n : n == null ? "" : I(n);
|
|
5446
5597
|
}
|
|
5447
|
-
function
|
|
5598
|
+
function xs(e, t) {
|
|
5448
5599
|
if (!e || e.length === 0) return !0;
|
|
5449
5600
|
for (let n of e) {
|
|
5450
5601
|
if (n.status && n.status.length > 0) {
|
|
5451
5602
|
let e = t.status;
|
|
5452
5603
|
if (typeof e != "string" || !n.status.includes(e)) return !1;
|
|
5453
5604
|
}
|
|
5454
|
-
if (n.field && !
|
|
5605
|
+
if (n.field && !Ss(n, t)) return !1;
|
|
5455
5606
|
}
|
|
5456
5607
|
return !0;
|
|
5457
5608
|
}
|
|
5458
|
-
function
|
|
5459
|
-
let n =
|
|
5609
|
+
function Ss(e, t) {
|
|
5610
|
+
let n = Cs(t, e.field), r = e.op || "eq";
|
|
5460
5611
|
if (r === "in" || r === "not_in") {
|
|
5461
5612
|
let t = Array.isArray(e.value) ? e.value : [e.value], i = I(n), a = t.some((e) => I(e) === i);
|
|
5462
5613
|
return r === "in" ? a : !a;
|
|
5463
5614
|
}
|
|
5464
|
-
return typeof e.value == "boolean" && r === "eq" ?
|
|
5615
|
+
return typeof e.value == "boolean" && r === "eq" ? Ts(n) === e.value : typeof n == "number" && typeof e.value == "number" ? Es(n, e.value, r) : Es(I(n), I(e.value), r);
|
|
5465
5616
|
}
|
|
5466
|
-
function
|
|
5617
|
+
function Cs(e, t) {
|
|
5467
5618
|
if (Object.prototype.hasOwnProperty.call(e, t)) return e[t];
|
|
5468
5619
|
if (t.startsWith("$status.")) {
|
|
5469
5620
|
let n = t.slice(8), r = e.$statuses;
|
|
@@ -5474,27 +5625,27 @@ function Ss(e, t) {
|
|
|
5474
5625
|
return Array.isArray(r) ? r.find((e) => !e || typeof e != "object" ? !1 : e.property_code === n)?.value : void 0;
|
|
5475
5626
|
}
|
|
5476
5627
|
}
|
|
5477
|
-
function
|
|
5628
|
+
function ws(e) {
|
|
5478
5629
|
let t = null, n = (n, r) => {
|
|
5479
5630
|
Object.prototype.hasOwnProperty.call(e, n) || (t === null && (t = { ...e }), t[n] = r);
|
|
5480
5631
|
}, r = e.$statuses;
|
|
5481
5632
|
if (Array.isArray(r)) for (let t of r) {
|
|
5482
5633
|
if (!t || typeof t != "object") continue;
|
|
5483
5634
|
let r = t.group_code;
|
|
5484
|
-
typeof r == "string" && n(`$status.${r}`,
|
|
5635
|
+
typeof r == "string" && n(`$status.${r}`, Cs(e, `$status.${r}`));
|
|
5485
5636
|
}
|
|
5486
5637
|
let i = e.$properties;
|
|
5487
5638
|
if (Array.isArray(i)) for (let t of i) {
|
|
5488
5639
|
if (!t || typeof t != "object") continue;
|
|
5489
5640
|
let r = t.property_code;
|
|
5490
|
-
typeof r == "string" && n(`$property.${r}`,
|
|
5641
|
+
typeof r == "string" && n(`$property.${r}`, Cs(e, `$property.${r}`));
|
|
5491
5642
|
}
|
|
5492
5643
|
return t ?? e;
|
|
5493
5644
|
}
|
|
5494
|
-
function
|
|
5645
|
+
function Ts(e) {
|
|
5495
5646
|
return e == null ? !1 : typeof e == "boolean" ? e : typeof e == "string" ? e !== "" : typeof e != "number" || e !== 0;
|
|
5496
5647
|
}
|
|
5497
|
-
function
|
|
5648
|
+
function Es(e, t, n) {
|
|
5498
5649
|
switch (n) {
|
|
5499
5650
|
case "eq": return e === t;
|
|
5500
5651
|
case "ne": return e !== t;
|
|
@@ -5507,14 +5658,14 @@ function Ts(e, t, n) {
|
|
|
5507
5658
|
default: return !1;
|
|
5508
5659
|
}
|
|
5509
5660
|
}
|
|
5510
|
-
function
|
|
5661
|
+
function Ds(e, t) {
|
|
5511
5662
|
return e ? Object.entries(e).filter(([, e]) => e.visibility?.includes(t)).map(([e, t]) => ({
|
|
5512
5663
|
code: e,
|
|
5513
5664
|
action: t
|
|
5514
5665
|
})) : [];
|
|
5515
5666
|
}
|
|
5516
|
-
function
|
|
5517
|
-
return !e && !r ? [] : t === void 0 ?
|
|
5667
|
+
function Os(e, t, n, r) {
|
|
5668
|
+
return !e && !r ? [] : t === void 0 ? Ds(e, n) : t.map((t) => {
|
|
5518
5669
|
let n = e?.[t] ?? r?.[t];
|
|
5519
5670
|
return n ? {
|
|
5520
5671
|
code: t,
|
|
@@ -5522,34 +5673,34 @@ function Ds(e, t, n, r) {
|
|
|
5522
5673
|
} : null;
|
|
5523
5674
|
}).filter((e) => e !== null);
|
|
5524
5675
|
}
|
|
5525
|
-
function
|
|
5676
|
+
function ks(e, t) {
|
|
5526
5677
|
return e.filter(({ code: e }) => {
|
|
5527
|
-
let n =
|
|
5528
|
-
return !n ||
|
|
5678
|
+
let n = gs[e];
|
|
5679
|
+
return !n || Xe(t, n);
|
|
5529
5680
|
});
|
|
5530
5681
|
}
|
|
5531
|
-
var
|
|
5682
|
+
var As = {
|
|
5532
5683
|
en: "This action cannot be undone.",
|
|
5533
5684
|
ru: "Это действие нельзя отменить."
|
|
5534
5685
|
};
|
|
5535
|
-
function
|
|
5686
|
+
function js(e) {
|
|
5536
5687
|
return !!e?.confirmation && Object.keys(e.confirmation).length > 0;
|
|
5537
5688
|
}
|
|
5538
|
-
function
|
|
5539
|
-
return
|
|
5689
|
+
function Ms(e, t) {
|
|
5690
|
+
return js(e) ? L(e.confirmation, t) : e?.destructive ? L(As, t) : null;
|
|
5540
5691
|
}
|
|
5541
|
-
function
|
|
5542
|
-
return
|
|
5692
|
+
function Ns(e) {
|
|
5693
|
+
return js(e) || !!e?.destructive;
|
|
5543
5694
|
}
|
|
5544
|
-
function
|
|
5695
|
+
function Ps(e, t, n, r) {
|
|
5545
5696
|
if (n && r) return r;
|
|
5546
5697
|
let i = L(e?.display?.description);
|
|
5547
5698
|
return i ? e?.display?.icon_only === !0 ? `${t} - ${i}` : i : t;
|
|
5548
5699
|
}
|
|
5549
|
-
function
|
|
5700
|
+
function Fs(e) {
|
|
5550
5701
|
return !!e.association;
|
|
5551
5702
|
}
|
|
5552
|
-
function
|
|
5703
|
+
function Is(e, t) {
|
|
5553
5704
|
if (e) {
|
|
5554
5705
|
for (let n of Object.values(e.screens)) if (n.entity === t && n.type === "list") {
|
|
5555
5706
|
let r = e.entities[t];
|
|
@@ -5560,21 +5711,21 @@ function Fs(e, t) {
|
|
|
5560
5711
|
}
|
|
5561
5712
|
}
|
|
5562
5713
|
}
|
|
5563
|
-
function
|
|
5714
|
+
function Ls(e, t, n, r, i) {
|
|
5564
5715
|
let a = [];
|
|
5565
5716
|
for (let o of e) {
|
|
5566
|
-
let e =
|
|
5717
|
+
let e = Rs(o, t, n, r, i);
|
|
5567
5718
|
e !== null && a.push(e);
|
|
5568
5719
|
}
|
|
5569
5720
|
return a;
|
|
5570
5721
|
}
|
|
5571
|
-
function Ls(e, t, n, r, i) {
|
|
5572
|
-
return e.kind === "group" ? Rs(e, t, n, r, i) : zs(e, t, n, r, i);
|
|
5573
|
-
}
|
|
5574
5722
|
function Rs(e, t, n, r, i) {
|
|
5723
|
+
return e.kind === "group" ? zs(e, t, n, r, i) : Bs(e, t, n, r, i);
|
|
5724
|
+
}
|
|
5725
|
+
function zs(e, t, n, r, i) {
|
|
5575
5726
|
let a = [];
|
|
5576
5727
|
for (let o of e.items) {
|
|
5577
|
-
let e =
|
|
5728
|
+
let e = Rs(o, t, n, r, i);
|
|
5578
5729
|
e !== null && a.push(e);
|
|
5579
5730
|
}
|
|
5580
5731
|
return a.length === 0 ? null : {
|
|
@@ -5582,31 +5733,31 @@ function Rs(e, t, n, r, i) {
|
|
|
5582
5733
|
items: a
|
|
5583
5734
|
};
|
|
5584
5735
|
}
|
|
5585
|
-
function
|
|
5586
|
-
let a =
|
|
5736
|
+
function Bs(e, t, n, r, i) {
|
|
5737
|
+
let a = Us(e.code, t, n);
|
|
5587
5738
|
if (!a) return null;
|
|
5588
5739
|
if (i.length > 0) {
|
|
5589
|
-
let t =
|
|
5740
|
+
let t = Vs(a, i);
|
|
5590
5741
|
return t.visible ? {
|
|
5591
5742
|
...e,
|
|
5592
5743
|
enabled: t.enabled,
|
|
5593
5744
|
reason: t.reason
|
|
5594
5745
|
} : null;
|
|
5595
5746
|
}
|
|
5596
|
-
if (!
|
|
5597
|
-
let { enabled: o, reason: s } =
|
|
5747
|
+
if (!xs(a.conditions, r) || !xs(Ws(a.visible_if), r)) return null;
|
|
5748
|
+
let { enabled: o, reason: s } = Hs(a, r);
|
|
5598
5749
|
return {
|
|
5599
5750
|
...e,
|
|
5600
5751
|
enabled: o,
|
|
5601
5752
|
reason: s
|
|
5602
5753
|
};
|
|
5603
5754
|
}
|
|
5604
|
-
function
|
|
5605
|
-
let n =
|
|
5755
|
+
function Vs(e, t) {
|
|
5756
|
+
let n = Ws(e.visible_if), r = Ws(e.enabled_if), i = e.conditions, a = Gs(e.enabled_if_reason), o = 0, s = 0;
|
|
5606
5757
|
for (let e of t) {
|
|
5607
|
-
let t =
|
|
5758
|
+
let t = xs(n, e) && xs(i, e);
|
|
5608
5759
|
t && o++;
|
|
5609
|
-
let a =
|
|
5760
|
+
let a = xs(r, e);
|
|
5610
5761
|
(!t || !a) && s++;
|
|
5611
5762
|
}
|
|
5612
5763
|
if (o === 0) return {
|
|
@@ -5626,14 +5777,14 @@ function Bs(e, t) {
|
|
|
5626
5777
|
reason: a ? `${a} ${c}` : c
|
|
5627
5778
|
};
|
|
5628
5779
|
}
|
|
5629
|
-
function
|
|
5630
|
-
let n =
|
|
5780
|
+
function Hs(e, t) {
|
|
5781
|
+
let n = Ws(e.enabled_if);
|
|
5631
5782
|
if (!n || n.length === 0) return {
|
|
5632
5783
|
enabled: !0,
|
|
5633
5784
|
reason: null
|
|
5634
5785
|
};
|
|
5635
|
-
let r =
|
|
5636
|
-
return
|
|
5786
|
+
let r = Gs(e.enabled_if_reason);
|
|
5787
|
+
return xs(n, t) ? {
|
|
5637
5788
|
enabled: !0,
|
|
5638
5789
|
reason: null
|
|
5639
5790
|
} : {
|
|
@@ -5641,52 +5792,52 @@ function Vs(e, t) {
|
|
|
5641
5792
|
reason: r
|
|
5642
5793
|
};
|
|
5643
5794
|
}
|
|
5644
|
-
function
|
|
5795
|
+
function Us(e, t, n) {
|
|
5645
5796
|
if (t && e in t) return t[e];
|
|
5646
5797
|
if (n && e in n) return n[e];
|
|
5647
5798
|
}
|
|
5648
|
-
function
|
|
5799
|
+
function Ws(e) {
|
|
5649
5800
|
return e;
|
|
5650
5801
|
}
|
|
5651
|
-
function
|
|
5802
|
+
function Gs(e) {
|
|
5652
5803
|
if (!e) return null;
|
|
5653
5804
|
if (e.en) return e.en;
|
|
5654
5805
|
let t = Object.values(e);
|
|
5655
5806
|
return t.length > 0 ? t[0] : null;
|
|
5656
5807
|
}
|
|
5657
|
-
function
|
|
5808
|
+
function Ks(e, t, n, r, i) {
|
|
5658
5809
|
let a = [];
|
|
5659
5810
|
for (let o of e) {
|
|
5660
5811
|
if (o.kind === "group") {
|
|
5661
|
-
let e =
|
|
5812
|
+
let e = Ks(o.items, t, n, r, i);
|
|
5662
5813
|
e.length > 0 && a.push({
|
|
5663
5814
|
...o,
|
|
5664
5815
|
items: e
|
|
5665
5816
|
});
|
|
5666
5817
|
continue;
|
|
5667
5818
|
}
|
|
5668
|
-
let e =
|
|
5819
|
+
let e = Us(o.code, t, n);
|
|
5669
5820
|
e && e.visibility?.includes(r) && (i?.bulkRequired !== void 0 && (i.bulkRequiredPredicate ? i.bulkRequiredPredicate(e) : !1) !== i.bulkRequired || i?.excludeIf && i.excludeIf(e) || a.push(o));
|
|
5670
5821
|
}
|
|
5671
5822
|
return a;
|
|
5672
5823
|
}
|
|
5673
|
-
function
|
|
5824
|
+
function qs(e, t, n, r, i, a) {
|
|
5674
5825
|
let o = e ?? t;
|
|
5675
|
-
return o ?
|
|
5676
|
-
}
|
|
5677
|
-
function qs(e) {
|
|
5678
|
-
return e.requires_selection === void 0 ? Js(e) : e.requires_selection;
|
|
5826
|
+
return o ? Ks(o, n, r, i, a) : Zs(n, i);
|
|
5679
5827
|
}
|
|
5680
5828
|
function Js(e) {
|
|
5829
|
+
return e.requires_selection === void 0 ? Ys(e) : e.requires_selection;
|
|
5830
|
+
}
|
|
5831
|
+
function Ys(e) {
|
|
5681
5832
|
return e.visibility?.includes("list_floatbar") ?? !1;
|
|
5682
5833
|
}
|
|
5683
|
-
function
|
|
5834
|
+
function Xs(e, t, n, r, i) {
|
|
5684
5835
|
return e.map((e) => {
|
|
5685
5836
|
if (e.kind === "group") return {
|
|
5686
5837
|
...e,
|
|
5687
|
-
items:
|
|
5838
|
+
items: Xs(e.items, t, n, r, i)
|
|
5688
5839
|
};
|
|
5689
|
-
let a =
|
|
5840
|
+
let a = Us(e.code, t, n);
|
|
5690
5841
|
return a && r(a) ? {
|
|
5691
5842
|
...e,
|
|
5692
5843
|
enabled: !1,
|
|
@@ -5694,7 +5845,7 @@ function Ys(e, t, n, r, i) {
|
|
|
5694
5845
|
} : e;
|
|
5695
5846
|
});
|
|
5696
5847
|
}
|
|
5697
|
-
function
|
|
5848
|
+
function Zs(e, t) {
|
|
5698
5849
|
return e ? Object.entries(e).filter(([, e]) => e.visibility?.includes(t)).sort(([e, t], [n, r]) => {
|
|
5699
5850
|
let i = t.position ?? 0, a = r.position ?? 0;
|
|
5700
5851
|
return i === a ? e < n ? -1 : +(e > n) : i - a;
|
|
@@ -5707,84 +5858,84 @@ function Xs(e, t) {
|
|
|
5707
5858
|
}
|
|
5708
5859
|
//#endregion
|
|
5709
5860
|
//#region src/lib/field-regions.ts
|
|
5710
|
-
var
|
|
5711
|
-
function
|
|
5712
|
-
return
|
|
5713
|
-
|
|
5861
|
+
var Qs = /* @__PURE__ */ new Map();
|
|
5862
|
+
function $s(e, t) {
|
|
5863
|
+
return Qs.set(e, t), () => {
|
|
5864
|
+
Qs.get(e) === t && Qs.delete(e);
|
|
5714
5865
|
};
|
|
5715
5866
|
}
|
|
5716
|
-
function
|
|
5717
|
-
return
|
|
5867
|
+
function ec(e) {
|
|
5868
|
+
return Qs.get(e);
|
|
5718
5869
|
}
|
|
5719
5870
|
//#endregion
|
|
5720
5871
|
//#region src/lib/ui-actions.ts
|
|
5721
|
-
var
|
|
5722
|
-
function
|
|
5723
|
-
let n = e.match(
|
|
5872
|
+
var tc = /\$\{\s*([^}]+?)\s*\}/g, nc = /^\s*\$\{\s*([^}]+?)\s*\}\s*$/, rc = Symbol("unresolved");
|
|
5873
|
+
function ic(e, t) {
|
|
5874
|
+
let n = e.match(nc);
|
|
5724
5875
|
if (n) {
|
|
5725
|
-
let r =
|
|
5726
|
-
return r ===
|
|
5876
|
+
let r = ac(n[1], t);
|
|
5877
|
+
return r === rc ? e : r;
|
|
5727
5878
|
}
|
|
5728
|
-
return e.replace(
|
|
5729
|
-
let r =
|
|
5730
|
-
return r ===
|
|
5879
|
+
return e.replace(tc, (e, n) => {
|
|
5880
|
+
let r = ac(n, t);
|
|
5881
|
+
return r === rc ? e : I(r);
|
|
5731
5882
|
});
|
|
5732
5883
|
}
|
|
5733
|
-
function
|
|
5734
|
-
if (e === "now") return
|
|
5884
|
+
function ac(e, t) {
|
|
5885
|
+
if (e === "now") return fi();
|
|
5735
5886
|
let [n, ...r] = e.split(".");
|
|
5736
|
-
if (n === "row") return !t.row || r.length === 0 ?
|
|
5887
|
+
if (n === "row") return !t.row || r.length === 0 ? rc : oc(t.row, r);
|
|
5737
5888
|
if (n === "field" && r.length >= 2) {
|
|
5738
|
-
let [e, t] = r, n =
|
|
5739
|
-
return n ? n.getField(t) :
|
|
5889
|
+
let [e, t] = r, n = ec(e);
|
|
5890
|
+
return n ? n.getField(t) : rc;
|
|
5740
5891
|
}
|
|
5741
|
-
return n === "params" ? !t.params || r.length === 0 ?
|
|
5892
|
+
return n === "params" ? !t.params || r.length === 0 ? rc : oc(t.params, r) : rc;
|
|
5742
5893
|
}
|
|
5743
|
-
function
|
|
5894
|
+
function oc(e, t) {
|
|
5744
5895
|
return t.reduce((e, t) => {
|
|
5745
5896
|
if (e && typeof e == "object") return e[t];
|
|
5746
5897
|
}, e);
|
|
5747
5898
|
}
|
|
5748
|
-
async function
|
|
5899
|
+
async function sc(e, t) {
|
|
5749
5900
|
for (let n of e) try {
|
|
5750
|
-
await
|
|
5901
|
+
await cc(n, t);
|
|
5751
5902
|
} catch (e) {
|
|
5752
5903
|
let t = e instanceof Error ? e.message : String(e);
|
|
5753
5904
|
Z.error(`ui_step failed: ${t}`);
|
|
5754
5905
|
return;
|
|
5755
5906
|
}
|
|
5756
5907
|
}
|
|
5757
|
-
async function
|
|
5908
|
+
async function cc(e, t) {
|
|
5758
5909
|
if (e.copy_to_clipboard != null) {
|
|
5759
|
-
let n =
|
|
5910
|
+
let n = uc(e.copy_to_clipboard, t);
|
|
5760
5911
|
await navigator.clipboard.writeText(n);
|
|
5761
5912
|
return;
|
|
5762
5913
|
}
|
|
5763
5914
|
if (e.set_field) {
|
|
5764
|
-
let { target: n, value: r } = e.set_field, { region: i, field: a } =
|
|
5915
|
+
let { target: n, value: r } = e.set_field, { region: i, field: a } = dc(n), o = ec(i);
|
|
5765
5916
|
if (!o) throw Error(`region "${i}" not registered`);
|
|
5766
|
-
o.setField(a,
|
|
5917
|
+
o.setField(a, lc(r, t));
|
|
5767
5918
|
return;
|
|
5768
5919
|
}
|
|
5769
5920
|
if (e.focus_field) {
|
|
5770
|
-
let { region: t, field: n } =
|
|
5921
|
+
let { region: t, field: n } = dc(e.focus_field), r = ec(t);
|
|
5771
5922
|
if (!r) throw Error(`region "${t}" not registered`);
|
|
5772
5923
|
r.focusField(n);
|
|
5773
5924
|
return;
|
|
5774
5925
|
}
|
|
5775
5926
|
if (e.show_toast) {
|
|
5776
|
-
let n =
|
|
5927
|
+
let n = uc(e.show_toast.message, t), r = e.show_toast.kind ?? "info";
|
|
5777
5928
|
r === "success" ? Z.success(n) : r === "error" ? Z.error(n) : Z.info(n);
|
|
5778
5929
|
return;
|
|
5779
5930
|
}
|
|
5780
5931
|
}
|
|
5781
|
-
function cc(e, t) {
|
|
5782
|
-
return typeof e == "string" ? rc(e, t) : e;
|
|
5783
|
-
}
|
|
5784
5932
|
function lc(e, t) {
|
|
5785
|
-
return
|
|
5933
|
+
return typeof e == "string" ? ic(e, t) : e;
|
|
5786
5934
|
}
|
|
5787
|
-
function uc(e) {
|
|
5935
|
+
function uc(e, t) {
|
|
5936
|
+
return I(ic(e, t));
|
|
5937
|
+
}
|
|
5938
|
+
function dc(e) {
|
|
5788
5939
|
let t = e.indexOf(".");
|
|
5789
5940
|
if (t <= 0) throw Error(`invalid path "${e}" (expected "region.field")`);
|
|
5790
5941
|
return {
|
|
@@ -5792,12 +5943,12 @@ function uc(e) {
|
|
|
5792
5943
|
field: e.slice(t + 1)
|
|
5793
5944
|
};
|
|
5794
5945
|
}
|
|
5795
|
-
function
|
|
5946
|
+
function fc(e) {
|
|
5796
5947
|
return !e.handler && !!e.ui_steps && e.ui_steps.length > 0;
|
|
5797
5948
|
}
|
|
5798
5949
|
//#endregion
|
|
5799
5950
|
//#region src/lib/mass-edit.ts
|
|
5800
|
-
function
|
|
5951
|
+
function pc(e) {
|
|
5801
5952
|
if (!e) return [];
|
|
5802
5953
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
5803
5954
|
for (let r of e.split(",")) {
|
|
@@ -5806,17 +5957,17 @@ function fc(e) {
|
|
|
5806
5957
|
}
|
|
5807
5958
|
return n;
|
|
5808
5959
|
}
|
|
5809
|
-
function
|
|
5810
|
-
if (!e || !
|
|
5811
|
-
let n = Array.isArray(t) ? t :
|
|
5960
|
+
function mc(e, t) {
|
|
5961
|
+
if (!e || !Xe(e, "update")) return [];
|
|
5962
|
+
let n = Array.isArray(t) ? t : pc(t), r = n.length > 0 ? new Set(n) : null, i = st(e), a = new Set(z(e)), o = r ? n : hc(e, i, a), s = [];
|
|
5812
5963
|
for (let t of o) {
|
|
5813
5964
|
if (r && !r.has(t)) continue;
|
|
5814
|
-
let n =
|
|
5965
|
+
let n = gc(e, t, i, a);
|
|
5815
5966
|
n && s.push(n);
|
|
5816
5967
|
}
|
|
5817
5968
|
return s;
|
|
5818
5969
|
}
|
|
5819
|
-
function
|
|
5970
|
+
function hc(e, t, n) {
|
|
5820
5971
|
let r = [];
|
|
5821
5972
|
for (let [t, i] of e.fields) n.has(t) || i.auto || r.push(t);
|
|
5822
5973
|
if (!t) {
|
|
@@ -5825,7 +5976,7 @@ function mc(e, t, n) {
|
|
|
5825
5976
|
}
|
|
5826
5977
|
return r;
|
|
5827
5978
|
}
|
|
5828
|
-
function
|
|
5979
|
+
function gc(e, t, n, r) {
|
|
5829
5980
|
if (t.startsWith("$status.")) {
|
|
5830
5981
|
if (n) return null;
|
|
5831
5982
|
let r = t.slice(8), i = e.status_groups?.[r];
|
|
@@ -5833,7 +5984,7 @@ function hc(e, t, n, r) {
|
|
|
5833
5984
|
code: t,
|
|
5834
5985
|
bare: r,
|
|
5835
5986
|
kind: "status",
|
|
5836
|
-
label:
|
|
5987
|
+
label: _c(i.name, r),
|
|
5837
5988
|
statusGroup: i
|
|
5838
5989
|
} : null;
|
|
5839
5990
|
}
|
|
@@ -5844,7 +5995,7 @@ function hc(e, t, n, r) {
|
|
|
5844
5995
|
code: t,
|
|
5845
5996
|
bare: r,
|
|
5846
5997
|
kind: "property",
|
|
5847
|
-
label:
|
|
5998
|
+
label: _c(i.name, r),
|
|
5848
5999
|
property: i
|
|
5849
6000
|
} : null;
|
|
5850
6001
|
}
|
|
@@ -5854,18 +6005,18 @@ function hc(e, t, n, r) {
|
|
|
5854
6005
|
code: t,
|
|
5855
6006
|
bare: t,
|
|
5856
6007
|
kind: "field",
|
|
5857
|
-
label:
|
|
6008
|
+
label: _c(i.display?.name, t),
|
|
5858
6009
|
field: i
|
|
5859
6010
|
};
|
|
5860
6011
|
}
|
|
5861
|
-
function
|
|
6012
|
+
function _c(e, t) {
|
|
5862
6013
|
return e && L(e) || t;
|
|
5863
6014
|
}
|
|
5864
6015
|
//#endregion
|
|
5865
6016
|
//#region src/components/mass-edit/PropertyGridEditor.tsx
|
|
5866
|
-
var
|
|
5867
|
-
function
|
|
5868
|
-
let a = d(() =>
|
|
6017
|
+
var vc = Symbol.for("declarion.mass-edit.multiple");
|
|
6018
|
+
function yc({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange: i }) {
|
|
6019
|
+
let a = d(() => mc(e, t), [e, t]), o = d(() => Object.keys(r).map((e) => {
|
|
5869
6020
|
let t = a.find((t) => t.code === e);
|
|
5870
6021
|
return t ? {
|
|
5871
6022
|
target: t,
|
|
@@ -5875,8 +6026,8 @@ function vc({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange:
|
|
|
5875
6026
|
let e = new Set(o.map((e) => e.target.code));
|
|
5876
6027
|
return a.filter((t) => !e.has(t.code));
|
|
5877
6028
|
}, [o, a]), l = s((e) => {
|
|
5878
|
-
let t =
|
|
5879
|
-
a[e.code] = t ===
|
|
6029
|
+
let t = wc(e, n), a = { ...r };
|
|
6030
|
+
a[e.code] = t === vc ? void 0 : t, i(a);
|
|
5880
6031
|
}, [
|
|
5881
6032
|
r,
|
|
5882
6033
|
n,
|
|
@@ -5904,12 +6055,12 @@ function vc({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange:
|
|
|
5904
6055
|
},
|
|
5905
6056
|
children: "No targets selected. Add a field, status, or property to edit across all selected rows."
|
|
5906
6057
|
}),
|
|
5907
|
-
o.map((e) => /* @__PURE__ */ b(
|
|
6058
|
+
o.map((e) => /* @__PURE__ */ b(bc, {
|
|
5908
6059
|
row: e,
|
|
5909
6060
|
onChange: (t) => u(e.target.code, t),
|
|
5910
6061
|
onRemove: () => f(e.target.code)
|
|
5911
6062
|
}, e.target.code)),
|
|
5912
|
-
/* @__PURE__ */ b(
|
|
6063
|
+
/* @__PURE__ */ b(Cc, {
|
|
5913
6064
|
targets: c,
|
|
5914
6065
|
onPick: l
|
|
5915
6066
|
})
|
|
@@ -5922,7 +6073,7 @@ function vc({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange:
|
|
|
5922
6073
|
children: "Entity schema unavailable. Mass edit requires an entity-bound action."
|
|
5923
6074
|
});
|
|
5924
6075
|
}
|
|
5925
|
-
function
|
|
6076
|
+
function bc({ row: e, onChange: n, onRemove: r }) {
|
|
5926
6077
|
let { target: i } = e;
|
|
5927
6078
|
return /* @__PURE__ */ x("div", {
|
|
5928
6079
|
"data-testid": "mass-edit-row",
|
|
@@ -5941,7 +6092,7 @@ function yc({ row: e, onChange: n, onRemove: r }) {
|
|
|
5941
6092
|
title: i.code,
|
|
5942
6093
|
children: i.label
|
|
5943
6094
|
}),
|
|
5944
|
-
/* @__PURE__ */ b(
|
|
6095
|
+
/* @__PURE__ */ b(xc, {
|
|
5945
6096
|
row: e,
|
|
5946
6097
|
onChange: n
|
|
5947
6098
|
}),
|
|
@@ -5953,8 +6104,8 @@ function yc({ row: e, onChange: n, onRemove: r }) {
|
|
|
5953
6104
|
]
|
|
5954
6105
|
});
|
|
5955
6106
|
}
|
|
5956
|
-
function
|
|
5957
|
-
let { target: n } = e, r =
|
|
6107
|
+
function xc({ row: e, onChange: t }) {
|
|
6108
|
+
let { target: n } = e, r = hs(), i = e.value === vc, a = i ? "<multiple values>" : void 0, o = i ? "" : e.value;
|
|
5958
6109
|
if (n.kind === "status" && n.statusGroup) {
|
|
5959
6110
|
let e = n.statusGroup.statuses.map((e) => ({
|
|
5960
6111
|
value: e.code,
|
|
@@ -5970,11 +6121,11 @@ function bc({ row: e, onChange: t }) {
|
|
|
5970
6121
|
})
|
|
5971
6122
|
});
|
|
5972
6123
|
}
|
|
5973
|
-
let s =
|
|
6124
|
+
let s = Sc(n);
|
|
5974
6125
|
return /* @__PURE__ */ x("div", {
|
|
5975
6126
|
"data-testid": `value-${n.code}`,
|
|
5976
6127
|
style: { position: "relative" },
|
|
5977
|
-
children: [
|
|
6128
|
+
children: [fs({
|
|
5978
6129
|
field: s,
|
|
5979
6130
|
fieldName: n.bare,
|
|
5980
6131
|
value: o ?? "",
|
|
@@ -5993,7 +6144,7 @@ function bc({ row: e, onChange: t }) {
|
|
|
5993
6144
|
})]
|
|
5994
6145
|
});
|
|
5995
6146
|
}
|
|
5996
|
-
function
|
|
6147
|
+
function Sc(e) {
|
|
5997
6148
|
if (e.kind === "field" && e.field) return e.field;
|
|
5998
6149
|
if (e.kind === "property" && e.property) {
|
|
5999
6150
|
let t = e.property;
|
|
@@ -6008,7 +6159,7 @@ function xc(e) {
|
|
|
6008
6159
|
}
|
|
6009
6160
|
return { type: "string" };
|
|
6010
6161
|
}
|
|
6011
|
-
function
|
|
6162
|
+
function Cc({ targets: e, onPick: n }) {
|
|
6012
6163
|
let [r, i] = p(!1);
|
|
6013
6164
|
return e.length === 0 ? null : r ? /* @__PURE__ */ b("div", {
|
|
6014
6165
|
"data-testid": "mass-edit-target-picker",
|
|
@@ -6035,7 +6186,7 @@ function Sc({ targets: e, onPick: n }) {
|
|
|
6035
6186
|
children: [/* @__PURE__ */ b(t.plus, { size: 12 }), " Add target"]
|
|
6036
6187
|
});
|
|
6037
6188
|
}
|
|
6038
|
-
function
|
|
6189
|
+
function wc(e, t) {
|
|
6039
6190
|
if (!t || t.length === 0 || e.kind !== "field") return;
|
|
6040
6191
|
let n, r = !1;
|
|
6041
6192
|
for (let i of t) {
|
|
@@ -6044,16 +6195,16 @@ function Cc(e, t) {
|
|
|
6044
6195
|
n = t, r = !0;
|
|
6045
6196
|
continue;
|
|
6046
6197
|
}
|
|
6047
|
-
if (n !== t) return
|
|
6198
|
+
if (n !== t) return vc;
|
|
6048
6199
|
}
|
|
6049
6200
|
return n;
|
|
6050
6201
|
}
|
|
6051
6202
|
//#endregion
|
|
6052
6203
|
//#region src/components/shared/ActionDialog.tsx
|
|
6053
|
-
var
|
|
6054
|
-
function
|
|
6204
|
+
var Tc = /^\$row\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)$/;
|
|
6205
|
+
function Ec(e, t) {
|
|
6055
6206
|
if (typeof e != "string") return e ?? "";
|
|
6056
|
-
let n = e.match(
|
|
6207
|
+
let n = e.match(Tc);
|
|
6057
6208
|
if (n) {
|
|
6058
6209
|
let r = n[1].split("."), i = t;
|
|
6059
6210
|
for (let e of r) {
|
|
@@ -6065,9 +6216,9 @@ function Tc(e, t) {
|
|
|
6065
6216
|
}
|
|
6066
6217
|
return i === void 0 ? ((t == null || !(r[0] in t)) && typeof console < "u" && console.warn && console.warn(`ActionDialog: prefill template ${e} could not be resolved; row is missing field '${r[0]}'`), "") : i ?? "";
|
|
6067
6218
|
}
|
|
6068
|
-
return
|
|
6219
|
+
return ic(e, { row: t });
|
|
6069
6220
|
}
|
|
6070
|
-
function
|
|
6221
|
+
function Dc(e) {
|
|
6071
6222
|
return {
|
|
6072
6223
|
type: e.type ?? "string",
|
|
6073
6224
|
required: e.required,
|
|
@@ -6078,21 +6229,21 @@ function Ec(e) {
|
|
|
6078
6229
|
enum: e.enum,
|
|
6079
6230
|
values: e.values,
|
|
6080
6231
|
structure: e.structure,
|
|
6081
|
-
ref:
|
|
6232
|
+
ref: qe(e.ref)
|
|
6082
6233
|
};
|
|
6083
6234
|
}
|
|
6084
|
-
function
|
|
6235
|
+
function Oc(e, t) {
|
|
6085
6236
|
if (!e.includes("${")) return e;
|
|
6086
|
-
let n =
|
|
6237
|
+
let n = ic(e, { params: t });
|
|
6087
6238
|
return n == null ? "" : I(n);
|
|
6088
6239
|
}
|
|
6089
|
-
var
|
|
6090
|
-
function
|
|
6240
|
+
var kc = /\$\{\s*([^}]+?)\s*\}/g;
|
|
6241
|
+
function Ac(e, t) {
|
|
6091
6242
|
let n = `params.${t}`;
|
|
6092
|
-
for (let t of e.matchAll(
|
|
6243
|
+
for (let t of e.matchAll(kc)) if (t[1] === n) return !0;
|
|
6093
6244
|
return !1;
|
|
6094
6245
|
}
|
|
6095
|
-
function
|
|
6246
|
+
function jc({ param: e, value: t, onChange: n, statusGroups: r }) {
|
|
6096
6247
|
let i = d(() => {
|
|
6097
6248
|
let t = r ? Object.entries(r) : [];
|
|
6098
6249
|
return [{
|
|
@@ -6110,12 +6261,12 @@ function Ac({ param: e, value: t, onChange: n, statusGroups: r }) {
|
|
|
6110
6261
|
placeholder: "Select status group…"
|
|
6111
6262
|
});
|
|
6112
6263
|
}
|
|
6113
|
-
function
|
|
6264
|
+
function Mc({ param: e, value: t, onChange: n, statusGroups: r, formData: i }) {
|
|
6114
6265
|
let a = d(() => {
|
|
6115
6266
|
if (!r) return [];
|
|
6116
6267
|
let t = e.filter?.status_group;
|
|
6117
6268
|
if (t) {
|
|
6118
|
-
let e =
|
|
6269
|
+
let e = Oc(t, i);
|
|
6119
6270
|
return e && r[e] ? r[e].statuses : [];
|
|
6120
6271
|
}
|
|
6121
6272
|
return Object.values(r).flatMap((e) => e.statuses);
|
|
@@ -6137,8 +6288,8 @@ function jc({ param: e, value: t, onChange: n, statusGroups: r, formData: i }) {
|
|
|
6137
6288
|
placeholder: "Select status…"
|
|
6138
6289
|
});
|
|
6139
6290
|
}
|
|
6140
|
-
function
|
|
6141
|
-
let { data: m } = Y(), h =
|
|
6291
|
+
function Nc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, isPending: o, row: c, bulkSelection: u }) {
|
|
6292
|
+
let { data: m } = Y(), h = hs(), g = r.resolved_params, _ = r.resolved_hidden_defaults ?? {}, v = !!r.destructive, S = Ms(r, h), C = s(() => {
|
|
6142
6293
|
o || n(!1);
|
|
6143
6294
|
}, [o, n]), w = f(null);
|
|
6144
6295
|
l(() => {
|
|
@@ -6165,11 +6316,11 @@ function Mc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6165
6316
|
continue;
|
|
6166
6317
|
}
|
|
6167
6318
|
if (n.type === "bool") {
|
|
6168
|
-
let r =
|
|
6319
|
+
let r = Ec(n.default, c);
|
|
6169
6320
|
e[t] = r === !0 || r === "true";
|
|
6170
6321
|
continue;
|
|
6171
6322
|
}
|
|
6172
|
-
e[t] =
|
|
6323
|
+
e[t] = Ec(n.default, c);
|
|
6173
6324
|
}
|
|
6174
6325
|
return e;
|
|
6175
6326
|
}, [
|
|
@@ -6177,7 +6328,7 @@ function Mc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6177
6328
|
c,
|
|
6178
6329
|
u,
|
|
6179
6330
|
A
|
|
6180
|
-
])),
|
|
6331
|
+
])), ee = s((e, t) => {
|
|
6181
6332
|
M((n) => {
|
|
6182
6333
|
let r = {
|
|
6183
6334
|
...n,
|
|
@@ -6187,11 +6338,11 @@ function Mc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6187
6338
|
for (let [t, n] of g) {
|
|
6188
6339
|
if (n.type !== "status") continue;
|
|
6189
6340
|
let i = n.filter?.status_group;
|
|
6190
|
-
i &&
|
|
6341
|
+
i && Ac(i, e) && (r[t] = "");
|
|
6191
6342
|
}
|
|
6192
6343
|
return r;
|
|
6193
6344
|
});
|
|
6194
|
-
}, [g]),
|
|
6345
|
+
}, [g]), te = s(() => {
|
|
6195
6346
|
let e = { ...j };
|
|
6196
6347
|
for (let [t, n] of T) {
|
|
6197
6348
|
let r = j[t], i = r == null || r === "";
|
|
@@ -6333,31 +6484,31 @@ function Mc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6333
6484
|
let r;
|
|
6334
6485
|
if (t.type === "entity_patch") {
|
|
6335
6486
|
let n = typeof t.filter?.targets == "string" ? t.filter.targets : void 0;
|
|
6336
|
-
r = /* @__PURE__ */ b(
|
|
6487
|
+
r = /* @__PURE__ */ b(yc, {
|
|
6337
6488
|
entity: k,
|
|
6338
6489
|
filterTargets: n,
|
|
6339
6490
|
selectedRows: u,
|
|
6340
6491
|
value: j[e] ?? {},
|
|
6341
|
-
onChange: (t) =>
|
|
6492
|
+
onChange: (t) => ee(e, t)
|
|
6342
6493
|
});
|
|
6343
|
-
} else r = t.type === "status_group" ? /* @__PURE__ */ b(
|
|
6494
|
+
} else r = t.type === "status_group" ? /* @__PURE__ */ b(jc, {
|
|
6344
6495
|
param: t,
|
|
6345
6496
|
value: j[e],
|
|
6346
|
-
onChange: (t) =>
|
|
6497
|
+
onChange: (t) => ee(e, t),
|
|
6347
6498
|
statusGroups: E,
|
|
6348
6499
|
formData: j
|
|
6349
|
-
}) : t.type === "status" ? /* @__PURE__ */ b(
|
|
6500
|
+
}) : t.type === "status" ? /* @__PURE__ */ b(Mc, {
|
|
6350
6501
|
param: t,
|
|
6351
6502
|
value: j[e],
|
|
6352
|
-
onChange: (t) =>
|
|
6503
|
+
onChange: (t) => ee(e, t),
|
|
6353
6504
|
statusGroups: E,
|
|
6354
6505
|
formData: j
|
|
6355
|
-
}) :
|
|
6356
|
-
field:
|
|
6506
|
+
}) : fs({
|
|
6507
|
+
field: Dc(t),
|
|
6357
6508
|
fieldName: e,
|
|
6358
6509
|
value: j[e],
|
|
6359
6510
|
mode: "edit",
|
|
6360
|
-
onChange: (t) =>
|
|
6511
|
+
onChange: (t) => ee(e, t),
|
|
6361
6512
|
locale: h
|
|
6362
6513
|
});
|
|
6363
6514
|
return /* @__PURE__ */ x("div", {
|
|
@@ -6405,7 +6556,7 @@ function Mc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6405
6556
|
kind: "primary",
|
|
6406
6557
|
danger: v,
|
|
6407
6558
|
icon: b(o ? Se : v ? t.trash : t.bolt, { size: 13 }),
|
|
6408
|
-
onClick:
|
|
6559
|
+
onClick: te,
|
|
6409
6560
|
disabled: o,
|
|
6410
6561
|
children: o ? "Executing…" : T.length > 0 ? "Execute" : "Confirm"
|
|
6411
6562
|
})
|
|
@@ -6416,7 +6567,7 @@ function Mc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6416
6567
|
}
|
|
6417
6568
|
//#endregion
|
|
6418
6569
|
//#region src/components/shared/ActionResultDialog.tsx
|
|
6419
|
-
function
|
|
6570
|
+
function Pc({ open: e, onClose: n, display: r }) {
|
|
6420
6571
|
let i = f(null);
|
|
6421
6572
|
return l(() => {
|
|
6422
6573
|
e && i.current?.focus();
|
|
@@ -6511,7 +6662,7 @@ function Nc({ open: e, onClose: n, display: r }) {
|
|
|
6511
6662
|
gap: 12,
|
|
6512
6663
|
overflowY: "auto"
|
|
6513
6664
|
},
|
|
6514
|
-
children: r.fields.map((e, t) => /* @__PURE__ */ b(
|
|
6665
|
+
children: r.fields.map((e, t) => /* @__PURE__ */ b(Fc, { field: e }, t))
|
|
6515
6666
|
}),
|
|
6516
6667
|
/* @__PURE__ */ x("div", {
|
|
6517
6668
|
style: {
|
|
@@ -6534,13 +6685,13 @@ function Nc({ open: e, onClose: n, display: r }) {
|
|
|
6534
6685
|
]
|
|
6535
6686
|
})] }) : null;
|
|
6536
6687
|
}
|
|
6537
|
-
function
|
|
6538
|
-
let n = e.href ?? e.download_url ?? e.value, r = e.type === "download", i = r || e.type === "link", a = n ?
|
|
6688
|
+
function Fc({ field: e }) {
|
|
6689
|
+
let n = e.href ?? e.download_url ?? e.value, r = e.type === "download", i = r || e.type === "link", a = n ? Qr(n) : void 0, [o, s] = p(!1), [c, l] = p(null);
|
|
6539
6690
|
async function u() {
|
|
6540
6691
|
if (a) {
|
|
6541
6692
|
s(!0), l(null);
|
|
6542
6693
|
try {
|
|
6543
|
-
await
|
|
6694
|
+
await ti(a, e.filename);
|
|
6544
6695
|
} catch (e) {
|
|
6545
6696
|
l(e instanceof Error ? e.message : String(e));
|
|
6546
6697
|
} finally {
|
|
@@ -6632,7 +6783,7 @@ function Pc({ field: e }) {
|
|
|
6632
6783
|
},
|
|
6633
6784
|
children: e.value
|
|
6634
6785
|
})]
|
|
6635
|
-
}), e.copyable && /* @__PURE__ */ b(
|
|
6786
|
+
}), e.copyable && /* @__PURE__ */ b(ii, { value: e.value })]
|
|
6636
6787
|
}) : /* @__PURE__ */ x("div", {
|
|
6637
6788
|
style: {
|
|
6638
6789
|
position: "relative",
|
|
@@ -6656,7 +6807,7 @@ function Pc({ field: e }) {
|
|
|
6656
6807
|
top: 4,
|
|
6657
6808
|
right: 4
|
|
6658
6809
|
},
|
|
6659
|
-
children: /* @__PURE__ */ b(
|
|
6810
|
+
children: /* @__PURE__ */ b(ii, { value: e.value })
|
|
6660
6811
|
})]
|
|
6661
6812
|
})
|
|
6662
6813
|
]
|
|
@@ -6664,7 +6815,7 @@ function Pc({ field: e }) {
|
|
|
6664
6815
|
}
|
|
6665
6816
|
//#endregion
|
|
6666
6817
|
//#region src/components/shared/ActionRunner.tsx
|
|
6667
|
-
function
|
|
6818
|
+
function Ic(e) {
|
|
6668
6819
|
if (!e || typeof e != "object") return { kind: "success" };
|
|
6669
6820
|
let t = e, n = t.status, r = t.success?.length ?? 0, i = t.errors?.length ?? 0, a = t.skipped?.length ?? 0, o = t.errors?.[0]?.error;
|
|
6670
6821
|
if (n === "partial") {
|
|
@@ -6679,33 +6830,33 @@ function Fc(e) {
|
|
|
6679
6830
|
detail: "No items matched"
|
|
6680
6831
|
} : n === "accepted" ? { kind: "accepted" } : { kind: "success" };
|
|
6681
6832
|
}
|
|
6682
|
-
function
|
|
6833
|
+
function Lc(e) {
|
|
6683
6834
|
if (!e || typeof e != "object") return null;
|
|
6684
6835
|
let t = e.result;
|
|
6685
6836
|
if (!t || typeof t != "object") return null;
|
|
6686
6837
|
let n = t.$display;
|
|
6687
6838
|
return !n || typeof n != "object" ? null : n;
|
|
6688
6839
|
}
|
|
6689
|
-
function
|
|
6690
|
-
let t =
|
|
6840
|
+
function Rc(e) {
|
|
6841
|
+
let t = Lc(e)?.fields;
|
|
6691
6842
|
if (!Array.isArray(t)) return null;
|
|
6692
6843
|
for (let e of t) {
|
|
6693
6844
|
if (e?.type !== "download") continue;
|
|
6694
6845
|
let t = e.href ?? e.download_url ?? e.value;
|
|
6695
|
-
if (typeof t == "string" && t !== "" &&
|
|
6846
|
+
if (typeof t == "string" && t !== "" && Qr(t)) return {
|
|
6696
6847
|
url: t,
|
|
6697
6848
|
filename: typeof e.filename == "string" ? e.filename : void 0
|
|
6698
6849
|
};
|
|
6699
6850
|
}
|
|
6700
6851
|
return null;
|
|
6701
6852
|
}
|
|
6702
|
-
function
|
|
6853
|
+
function zc(e) {
|
|
6703
6854
|
if (!e || typeof e != "object") return;
|
|
6704
6855
|
let t = e.result;
|
|
6705
6856
|
!t || typeof t != "object" || "impersonation_session_id" in t && window.location.assign("/");
|
|
6706
6857
|
}
|
|
6707
|
-
function
|
|
6708
|
-
if (e instanceof
|
|
6858
|
+
function Bc(e) {
|
|
6859
|
+
if (e instanceof er) {
|
|
6709
6860
|
let t = e.response.errors ?? [];
|
|
6710
6861
|
if (t.length === 1) return {
|
|
6711
6862
|
kind: "error",
|
|
@@ -6725,23 +6876,23 @@ function zc(e) {
|
|
|
6725
6876
|
detail: e instanceof Error ? e.message : String(e)
|
|
6726
6877
|
};
|
|
6727
6878
|
}
|
|
6728
|
-
var
|
|
6729
|
-
function
|
|
6730
|
-
let e = c(
|
|
6879
|
+
var Vc = i(null);
|
|
6880
|
+
function Hc() {
|
|
6881
|
+
let e = c(Vc);
|
|
6731
6882
|
if (!e) throw Error("useActionRunner must be used within <ActionRunnerProvider>");
|
|
6732
6883
|
return e;
|
|
6733
6884
|
}
|
|
6734
|
-
function
|
|
6885
|
+
function Uc(e) {
|
|
6735
6886
|
let t = {}, n = e.action?.resolved_hidden_defaults;
|
|
6736
6887
|
if (n) for (let [e, r] of Object.entries(n)) r !== void 0 && (t[e] = r);
|
|
6737
6888
|
return t;
|
|
6738
6889
|
}
|
|
6739
|
-
function
|
|
6740
|
-
let t =
|
|
6890
|
+
function Wc({ children: e }) {
|
|
6891
|
+
let t = Nr(), { data: n } = Y(), [r, i] = p(null), [a, o] = p(0), [c, l] = p(null), u = s((e) => {
|
|
6741
6892
|
if (e?.progress_screen) return n?.screens[e.progress_screen]?.route;
|
|
6742
6893
|
}, [n?.screens]), f = s((e, n, r, i, a) => {
|
|
6743
6894
|
let o = () => {
|
|
6744
|
-
let n =
|
|
6895
|
+
let n = Gc(a), i = u(r), o = n ? `Job ${n} queued` : "Running in background";
|
|
6745
6896
|
Z.success(`${e} started`, o, i ? { action: {
|
|
6746
6897
|
label: "View",
|
|
6747
6898
|
onClick: () => t(i)
|
|
@@ -6749,10 +6900,10 @@ function Uc({ children: e }) {
|
|
|
6749
6900
|
};
|
|
6750
6901
|
switch (i.kind) {
|
|
6751
6902
|
case "success": {
|
|
6752
|
-
let t =
|
|
6903
|
+
let t = Rc(a), r = t ? { action: {
|
|
6753
6904
|
label: "Download",
|
|
6754
6905
|
onClick: () => {
|
|
6755
|
-
|
|
6906
|
+
ti(t.url, t.filename).catch((e) => {
|
|
6756
6907
|
Z.error("Download failed", e instanceof Error ? e.message : String(e));
|
|
6757
6908
|
});
|
|
6758
6909
|
}
|
|
@@ -6784,16 +6935,16 @@ function Uc({ children: e }) {
|
|
|
6784
6935
|
}
|
|
6785
6936
|
if (t.kind !== "success" && t.kind !== "accepted") return;
|
|
6786
6937
|
e.onSuccess?.(n);
|
|
6787
|
-
let r =
|
|
6788
|
-
r && l(r),
|
|
6938
|
+
let r = Lc(n);
|
|
6939
|
+
r && l(r), zc(n);
|
|
6789
6940
|
}, [m]), g = s((e) => {
|
|
6790
6941
|
let t = e.action, n = e.longRunning ?? t?.long_running ?? !1, r = e.title || L(t?.display?.name) || "Action", a = async (i) => {
|
|
6791
6942
|
o((e) => e + 1);
|
|
6792
6943
|
try {
|
|
6793
|
-
let a = await e.execute(i), o =
|
|
6944
|
+
let a = await e.execute(i), o = Ic(a);
|
|
6794
6945
|
f(r, n, t, o, a), h(e, o, a);
|
|
6795
6946
|
} catch (e) {
|
|
6796
|
-
f(r, n, t,
|
|
6947
|
+
f(r, n, t, Bc(e));
|
|
6797
6948
|
} finally {
|
|
6798
6949
|
o((e) => Math.max(0, e - 1));
|
|
6799
6950
|
}
|
|
@@ -6803,14 +6954,14 @@ function Uc({ children: e }) {
|
|
|
6803
6954
|
icon: ""
|
|
6804
6955
|
},
|
|
6805
6956
|
destructive: !0
|
|
6806
|
-
} : void 0), c = !!(t?.resolved_params && t.resolved_params.length > 0), l =
|
|
6957
|
+
} : void 0), c = !!(t?.resolved_params && t.resolved_params.length > 0), l = Ns(s);
|
|
6807
6958
|
return s && (c || l) ? (i({
|
|
6808
6959
|
id: Symbol(),
|
|
6809
6960
|
opts: e,
|
|
6810
6961
|
title: r,
|
|
6811
6962
|
action: s,
|
|
6812
6963
|
pending: !1
|
|
6813
|
-
}), Promise.resolve()) : a(
|
|
6964
|
+
}), Promise.resolve()) : a(Uc(e));
|
|
6814
6965
|
}, [f, h]), v = a > 0 || !!r?.pending, y = d(() => ({
|
|
6815
6966
|
run: g,
|
|
6816
6967
|
isRunning: v
|
|
@@ -6822,10 +6973,10 @@ function Uc({ children: e }) {
|
|
|
6822
6973
|
pending: !0
|
|
6823
6974
|
} : e), o((e) => e + 1);
|
|
6824
6975
|
try {
|
|
6825
|
-
let r = await n.opts.execute(e), o =
|
|
6976
|
+
let r = await n.opts.execute(e), o = Ic(r);
|
|
6826
6977
|
f(n.title, s, a, o, r), h(n.opts, o, r), o.kind !== "partial" && i((e) => e?.id === t ? null : e);
|
|
6827
6978
|
} catch (e) {
|
|
6828
|
-
f(n.title, s, a,
|
|
6979
|
+
f(n.title, s, a, Bc(e));
|
|
6829
6980
|
} finally {
|
|
6830
6981
|
o((e) => Math.max(0, e - 1)), i((e) => e?.id === t ? {
|
|
6831
6982
|
...e,
|
|
@@ -6837,16 +6988,16 @@ function Uc({ children: e }) {
|
|
|
6837
6988
|
f,
|
|
6838
6989
|
h
|
|
6839
6990
|
]);
|
|
6840
|
-
return /* @__PURE__ */ x(
|
|
6991
|
+
return /* @__PURE__ */ x(Vc.Provider, {
|
|
6841
6992
|
value: y,
|
|
6842
6993
|
children: [
|
|
6843
6994
|
e,
|
|
6844
|
-
c && /* @__PURE__ */ b(
|
|
6995
|
+
c && /* @__PURE__ */ b(Pc, {
|
|
6845
6996
|
open: !0,
|
|
6846
6997
|
onClose: () => l(null),
|
|
6847
6998
|
display: c
|
|
6848
6999
|
}),
|
|
6849
|
-
r && S && /* @__PURE__ */ b(
|
|
7000
|
+
r && S && /* @__PURE__ */ b(Nc, {
|
|
6850
7001
|
open: !0,
|
|
6851
7002
|
onOpenChange: (e) => {
|
|
6852
7003
|
e || i(null);
|
|
@@ -6861,29 +7012,29 @@ function Uc({ children: e }) {
|
|
|
6861
7012
|
]
|
|
6862
7013
|
});
|
|
6863
7014
|
}
|
|
6864
|
-
function Wc(e) {
|
|
6865
|
-
return Gc(e) ?? Gc(e?.result);
|
|
6866
|
-
}
|
|
6867
7015
|
function Gc(e) {
|
|
7016
|
+
return Kc(e) ?? Kc(e?.result);
|
|
7017
|
+
}
|
|
7018
|
+
function Kc(e) {
|
|
6868
7019
|
if (!e || typeof e != "object") return;
|
|
6869
7020
|
let t = e, n = t.job_id ?? t.id;
|
|
6870
7021
|
return typeof n == "string" ? n : void 0;
|
|
6871
7022
|
}
|
|
6872
7023
|
//#endregion
|
|
6873
7024
|
//#region src/hooks/useCurrentScreen.tsx
|
|
6874
|
-
var
|
|
6875
|
-
function
|
|
7025
|
+
var qc = i(void 0);
|
|
7026
|
+
function Jc({ code: e, children: t }) {
|
|
6876
7027
|
let { data: n } = Y(), r = d(() => ({
|
|
6877
7028
|
code: e,
|
|
6878
7029
|
screen: n?.screens[e]
|
|
6879
7030
|
}), [e, n]);
|
|
6880
|
-
return /* @__PURE__ */ b(
|
|
7031
|
+
return /* @__PURE__ */ b(qc.Provider, {
|
|
6881
7032
|
value: r,
|
|
6882
7033
|
children: t
|
|
6883
7034
|
});
|
|
6884
7035
|
}
|
|
6885
|
-
function
|
|
6886
|
-
return c(
|
|
7036
|
+
function Yc() {
|
|
7037
|
+
return c(qc);
|
|
6887
7038
|
}
|
|
6888
7039
|
//#endregion
|
|
6889
|
-
export {
|
|
7040
|
+
export { ii as $, ve as $n, Bt as $t, hs as A, Ye as An, Yn as At, xa as B, ke as Bn, Fn as Bt, Is as C, He as Cn, qn as Ct, qs as D, nt as Dn, ir as Dt, ys as E, Qe as En, Qn as Et, Ea as F, I as Fn, Pn as Ft, Pi as G, Fe as Gn, G as Gt, ca as H, ze as Hn, Nn as Ht, Q as I, Be as In, Hn as It, Oi as J, Re as Jn, gn as Jt, Mi as K, Te as Kn, q as Kt, ba as L, Ae as Ln, Bn as Lt, us as M, R as Mn, Wn as Mt, Ta as N, Ge as Nn, Un as Nt, bs as O, et as On, cr as Ot, Da as P, tt as Pn, jn as Pt, fi as Q, ue as Qn, zt as Qt, Ca as R, Ce as Rn, Vn as Rt, ks as S, Ke as Sn, $n as St, Fs as T, L as Tn, ur as Tt, sa as U, Le as Un, zn as Ut, ra as V, Pe as Vn, Mn as Vt, na as W, F as Wn, In as Wt, ki as X, xe as Xn, _n as Xt, Ai as Y, Se as Yn, vn as Yt, mi as Z, be as Zn, It as Zt, Ls as _, at as _n, nr as _t, vc as a, Ot as an, A as ar, Nr as at, xs as b, Xe as bn, Zn as bt, mc as c, bt as cn, D as cr, Mr as ct, fc as d, B as dn, Tr as dt, At as en, pe as er, ti as et, $s as f, lt as fn, Er as ft, Ps as g, it as gn, er as gt, Js as h, Ve as hn, hr as ht, Hc as i, wt as in, j as ir, Z as it, fs as j, rt as jn, Y as jt, ws as k, $e as kn, sr as kt, pc as l, gt as ln, Ar as lt, _s as m, ut as mn, wr as mt, Yc as n, Tt as nn, N as nr, Qr as nt, yc as o, vt as on, k as or, Fr as ot, vs as p, ct as pn, Cr as pt, ji as q, P as qn, J as qt, Wc as r, Ct as rn, se as rr, Yr as rt, wc as s, yt as sn, O as sr, Pr as st, Jc as t, kt as tn, ye as tr, ei as tt, sc as u, ht as un, Dr as ut, Zs as v, ot as vn, Jn as vt, Os as w, z as wn, Kn as wt, Ks as x, Ze as xn, lr as xt, Xs as y, Je as yn, Xn as yt, da as z, Ie as zn, Rn as zt };
|