@declarion/react 0.358.0 → 0.365.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/api/access-expiry.js +17 -17
- package/dist-lib/api/session-renewal.js +6 -5
- package/dist-lib/components/fields/ErrorField.js +27 -0
- package/dist-lib/components/fields/JsonField.js +101 -57
- package/dist-lib/components/fields/cells/factories/errorTitle.js +11 -0
- package/dist-lib/components/fields/cells/factories/json.js +1 -0
- package/dist-lib/components/fields/cells/registry.js +8 -6
- package/dist-lib/components/fields/index.js +53 -51
- package/dist-lib/components/list/QuickPeek.js +51 -55
- package/dist-lib/components/pages/list/cardProjection.js +1 -0
- package/dist-lib/components/pages/list/filter-meta.js +44 -41
- package/dist-lib/components/pages/list/useListFilterPresentation.js +25 -22
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +78 -75
- package/dist-lib/components/primitives/Avatar.js +1 -1
- package/dist-lib/components/shared/LucideIcon.js +5 -1
- package/dist-lib/hooks/useScreenTab.js +20 -8
- package/dist-lib/index.d.ts +4 -2
- package/dist-lib/lib/error-options.js +8 -0
- package/dist-lib/lib/filter-evaluator.js +2 -1
- package/dist-lib/types/fieldType.js +1 -1
- package/package.json +1 -1
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
// src/api/access-expiry.ts
|
|
2
|
-
var e = "declarion.auth.access.expiry";
|
|
3
|
-
function
|
|
2
|
+
var e = "declarion.auth.access.expiry", t = 6e4;
|
|
3
|
+
function n(t) {
|
|
4
4
|
if (t && !Number.isNaN(Date.parse(t))) try {
|
|
5
5
|
window.localStorage.setItem(e, t);
|
|
6
6
|
} catch {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function r() {
|
|
11
11
|
try {
|
|
12
12
|
window.localStorage.removeItem(e);
|
|
13
13
|
} catch {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
var
|
|
18
|
-
function
|
|
17
|
+
var i = "declarion.auth.signed_out";
|
|
18
|
+
function a() {
|
|
19
19
|
try {
|
|
20
|
-
window.localStorage.setItem(
|
|
20
|
+
window.localStorage.setItem(i, "1");
|
|
21
21
|
} catch {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function o() {
|
|
26
26
|
try {
|
|
27
|
-
window.localStorage.removeItem(
|
|
27
|
+
window.localStorage.removeItem(i);
|
|
28
28
|
} catch {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function s() {
|
|
33
33
|
try {
|
|
34
|
-
return window.localStorage.getItem(
|
|
34
|
+
return window.localStorage.getItem(i) === "1";
|
|
35
35
|
} catch {
|
|
36
36
|
return !1;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function c() {
|
|
40
40
|
try {
|
|
41
41
|
let t = Date.parse(window.localStorage.getItem(e) ?? "");
|
|
42
42
|
return Number.isNaN(t) ? null : t;
|
|
@@ -44,11 +44,11 @@ function s() {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
var
|
|
48
|
-
function
|
|
49
|
-
return n ? "first-wave" : e === null ? "probe-first" : e > t ? "first-wave" : "refresh-first";
|
|
47
|
+
var l = "/login/sso-callback";
|
|
48
|
+
function u(e, t, n = !1) {
|
|
49
|
+
return n ? "first-wave" : e === null ? "probe-first" : e - 6e4 > t ? "first-wave" : "refresh-first";
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
51
|
+
function d() {
|
|
52
|
+
return u(c(), Date.now(), window.location.pathname === l);
|
|
53
53
|
}
|
|
54
|
-
export {
|
|
54
|
+
export { t as PROACTIVE_REFRESH_MARGIN_MS, l as SSO_RETURN_PATH, r as clearAccessExpiry, o as clearSignOut, n as recordAccessExpiry, a as recordSignOut, s as signedOutExplicitly, u as startOrder, d as startOrderNow };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { RefreshDeadError as e, ensureRefresh as t, getPersistentAuthFailureHandler as n } from "./client.js";
|
|
2
2
|
import { backoffDelayMs as r } from "./request-bounds.js";
|
|
3
|
-
import {
|
|
3
|
+
import { PROACTIVE_REFRESH_MARGIN_MS as i } from "./access-expiry.js";
|
|
4
|
+
import { isEmbedTokenMode as a } from "../embed/token.js";
|
|
4
5
|
// src/api/session-renewal.ts
|
|
5
|
-
var
|
|
6
|
+
var o = 5e3, s = null, c = null, l = 0, u = !1;
|
|
6
7
|
function d() {
|
|
7
8
|
s && clearTimeout(s), s = null;
|
|
8
9
|
}
|
|
@@ -12,7 +13,7 @@ function f(e) {
|
|
|
12
13
|
}, e);
|
|
13
14
|
}
|
|
14
15
|
function p() {
|
|
15
|
-
u ||
|
|
16
|
+
u || a() || (d(), u = !0, t().catch((t) => {
|
|
16
17
|
t instanceof e ? n()() : c !== null && f(r(l++));
|
|
17
18
|
}).finally(() => {
|
|
18
19
|
u = !1;
|
|
@@ -21,7 +22,7 @@ function p() {
|
|
|
21
22
|
function m(e) {
|
|
22
23
|
h();
|
|
23
24
|
let t = e ? Date.parse(e) : NaN;
|
|
24
|
-
Number.isNaN(t) || (c = t, f(Math.max(t - Date.now() -
|
|
25
|
+
Number.isNaN(t) || (c = t, f(Math.max(t - Date.now() - i, o)));
|
|
25
26
|
}
|
|
26
27
|
function h() {
|
|
27
28
|
d(), c = null, l = 0;
|
|
@@ -32,4 +33,4 @@ function g() {
|
|
|
32
33
|
document.addEventListener("visibilitychange", () => {
|
|
33
34
|
document.visibilityState === "visible" && g();
|
|
34
35
|
}), document.addEventListener("resume", g), window.addEventListener("pageshow", g), window.addEventListener("online", g);
|
|
35
|
-
export {
|
|
36
|
+
export { h as cancelRenewal, m as scheduleRenewal };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Select as e } from "../primitives/Fields.js";
|
|
2
|
+
import { useSchema as t } from "../../hooks/useSchema.js";
|
|
3
|
+
import { useText as n } from "../../hooks/useText.js";
|
|
4
|
+
import { coerceDisplayString as r } from "../../lib/display-value.js";
|
|
5
|
+
import { errorOptions as i } from "../../lib/error-options.js";
|
|
6
|
+
import { EMPTY_CELL as a } from "./cells/factories/emptyCell.js";
|
|
7
|
+
import { Fragment as o, jsx as s } from "react/jsx-runtime";
|
|
8
|
+
// src/components/fields/ErrorField.tsx
|
|
9
|
+
var c = "__declarion_error_null__";
|
|
10
|
+
function l({ field: l, value: u, mode: d, onChange: f, fieldId: p, labelId: m, t: h }) {
|
|
11
|
+
let { data: g } = t(), _ = n("errors"), v = u != null && u !== "" ? r(u) : "";
|
|
12
|
+
if (d === "display") return v ? /* @__PURE__ */ s(o, { children: _(v, v) }) : a;
|
|
13
|
+
let y = [...l.required ? [] : [{
|
|
14
|
+
value: c,
|
|
15
|
+
label: h("field.enum.none", "— None —")
|
|
16
|
+
}], ...i(g?.errors, h)];
|
|
17
|
+
return /* @__PURE__ */ s(e, {
|
|
18
|
+
id: p,
|
|
19
|
+
"aria-labelledby": m,
|
|
20
|
+
"aria-required": l.required || void 0,
|
|
21
|
+
value: v || c,
|
|
22
|
+
options: y,
|
|
23
|
+
onChange: (e) => f?.(e === c ? null : e),
|
|
24
|
+
placeholder: h("field.select_placeholder", "Select…")
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { l as ErrorField };
|
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
import { IconBtn as e } from "../primitives/IconBtn.js";
|
|
2
2
|
import { Icon as t } from "../primitives/Icons.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useSchema as n } from "../../hooks/useSchema.js";
|
|
4
|
+
import { useText as r } from "../../hooks/useText.js";
|
|
5
|
+
import { coerceDisplayString as i } from "../../lib/display-value.js";
|
|
6
|
+
import { Suspense as a, lazy as o, useState as s } from "react";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
8
|
// src/components/fields/JsonField.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
return /* @__PURE__ */
|
|
9
|
+
var d = o(() => import("./JsonEditor.js").then((e) => ({ default: e.JsonEditor })));
|
|
10
|
+
function f() {
|
|
11
|
+
return /* @__PURE__ */ l("div", { className: "h-20 rounded-md border border-border bg-muted animate-pulse" });
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function p(e) {
|
|
13
14
|
return e == null ? !0 : typeof e == "string" ? e.trim() === "" : Array.isArray(e) ? e.length === 0 : typeof e == "object" && Object.keys(e).length === 0;
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
+
function m(e) {
|
|
16
17
|
return Array.isArray(e) && e.every((e) => [
|
|
17
18
|
"string",
|
|
18
19
|
"number",
|
|
19
20
|
"boolean"
|
|
20
21
|
].includes(typeof e));
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
23
|
+
function h({ value: e, mode: t, onChange: n, fieldId: r, entityCode: i, fieldName: o }) {
|
|
24
|
+
let s = T(i, o);
|
|
25
|
+
return t === "display" ? p(e) ? /* @__PURE__ */ l("span", {
|
|
24
26
|
style: {
|
|
25
27
|
fontSize: 12.5,
|
|
26
28
|
color: "var(--text-4)"
|
|
27
29
|
},
|
|
28
30
|
children: "—"
|
|
29
|
-
}) :
|
|
31
|
+
}) : s && typeof e == "object" && !Array.isArray(e) ? /* @__PURE__ */ l(D, {
|
|
32
|
+
value: e,
|
|
33
|
+
body: /* @__PURE__ */ l(E, { value: e })
|
|
34
|
+
}) : m(e) ? /* @__PURE__ */ l("ul", {
|
|
30
35
|
className: "mono",
|
|
31
36
|
style: {
|
|
32
37
|
margin: 0,
|
|
@@ -35,17 +40,17 @@ function m({ value: e, mode: t, onChange: n, fieldId: r }) {
|
|
|
35
40
|
fontSize: 12.5,
|
|
36
41
|
lineHeight: 1.7
|
|
37
42
|
},
|
|
38
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
39
|
-
}) : /* @__PURE__ */
|
|
40
|
-
fallback: /* @__PURE__ */
|
|
41
|
-
children: /* @__PURE__ */
|
|
43
|
+
children: e.map((e, t) => /* @__PURE__ */ l("li", { children: String(e) }, t))
|
|
44
|
+
}) : /* @__PURE__ */ l(D, { value: e }) : /* @__PURE__ */ l(a, {
|
|
45
|
+
fallback: /* @__PURE__ */ l(f, {}),
|
|
46
|
+
children: /* @__PURE__ */ l(d, {
|
|
42
47
|
value: e,
|
|
43
48
|
onChange: n,
|
|
44
49
|
id: r
|
|
45
50
|
})
|
|
46
51
|
});
|
|
47
52
|
}
|
|
48
|
-
var
|
|
53
|
+
var g = {
|
|
49
54
|
display: "flex",
|
|
50
55
|
flexDirection: "column",
|
|
51
56
|
gap: 6,
|
|
@@ -53,72 +58,103 @@ var h = {
|
|
|
53
58
|
borderRadius: "var(--radius-md)",
|
|
54
59
|
padding: 12,
|
|
55
60
|
background: "var(--surface-2)"
|
|
56
|
-
},
|
|
61
|
+
}, _ = {
|
|
57
62
|
display: "flex",
|
|
58
63
|
flexDirection: "column",
|
|
59
64
|
gap: 8
|
|
60
|
-
},
|
|
65
|
+
}, v = {
|
|
61
66
|
display: "flex",
|
|
62
67
|
flexWrap: "wrap",
|
|
63
68
|
alignItems: "baseline",
|
|
64
69
|
gap: 8
|
|
65
|
-
},
|
|
70
|
+
}, y = {
|
|
66
71
|
fontSize: 11.5,
|
|
67
72
|
fontWeight: 500,
|
|
68
73
|
color: "var(--text-3)",
|
|
69
74
|
width: 120,
|
|
70
75
|
flexShrink: 0,
|
|
71
76
|
overflowWrap: "anywhere"
|
|
72
|
-
},
|
|
73
|
-
...
|
|
77
|
+
}, b = {
|
|
78
|
+
..._,
|
|
74
79
|
paddingLeft: 10,
|
|
75
80
|
borderLeft: "2px solid var(--border)"
|
|
76
|
-
},
|
|
81
|
+
}, x = {
|
|
77
82
|
minWidth: 0,
|
|
78
83
|
flex: "1 1 14rem",
|
|
79
84
|
fontSize: 12.5,
|
|
80
85
|
overflowWrap: "anywhere"
|
|
81
|
-
},
|
|
86
|
+
}, S = {
|
|
82
87
|
display: "flex",
|
|
83
88
|
justifyContent: "flex-end"
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
}, C = {
|
|
90
|
+
fontSize: 12.5,
|
|
91
|
+
fontWeight: 500
|
|
92
|
+
}, w = /* @__PURE__ */ new Set([
|
|
93
|
+
"type",
|
|
94
|
+
"status",
|
|
95
|
+
"title",
|
|
96
|
+
"detail",
|
|
97
|
+
"instance",
|
|
98
|
+
"retryable"
|
|
99
|
+
]);
|
|
100
|
+
function T(e, t) {
|
|
101
|
+
let { data: r } = n(), i = e ? r?.entities[e] : void 0;
|
|
102
|
+
return i ? [...i.fields].some(([, e]) => e.type === "error" && e.source === `$row.${t}.type`) : !1;
|
|
103
|
+
}
|
|
104
|
+
function E({ value: e }) {
|
|
105
|
+
let t = r("errors"), n = typeof e.type == "string" ? e.type : "", i = n.startsWith("/errors/") ? n.slice(8) : n, a = Object.fromEntries(Object.entries(e).filter(([e]) => !w.has(e)));
|
|
106
|
+
return /* @__PURE__ */ u("div", {
|
|
107
|
+
style: _,
|
|
108
|
+
children: [
|
|
109
|
+
i ? /* @__PURE__ */ l("span", {
|
|
110
|
+
style: C,
|
|
111
|
+
children: t(i, i)
|
|
112
|
+
}) : null,
|
|
113
|
+
typeof e.detail == "string" && e.detail ? /* @__PURE__ */ l("span", {
|
|
114
|
+
style: x,
|
|
115
|
+
children: e.detail
|
|
116
|
+
}) : null,
|
|
117
|
+
Object.keys(a).length > 0 ? /* @__PURE__ */ l(O, { value: a }) : null
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function D({ value: n, body: i }) {
|
|
122
|
+
let o = r(), [c, p] = s(!1), m = c ? o("field.json.hide_source", "Hide JSON") : o("field.json.show_source", "Show JSON");
|
|
123
|
+
return /* @__PURE__ */ u("div", {
|
|
124
|
+
style: g,
|
|
125
|
+
children: [/* @__PURE__ */ l("div", {
|
|
126
|
+
style: S,
|
|
127
|
+
children: /* @__PURE__ */ l(e, {
|
|
92
128
|
size: 22,
|
|
93
|
-
icon: /* @__PURE__ */
|
|
129
|
+
icon: /* @__PURE__ */ l(t.code, { size: 13 }),
|
|
94
130
|
onClick: (e) => {
|
|
95
|
-
e.stopPropagation(),
|
|
131
|
+
e.stopPropagation(), p((e) => !e);
|
|
96
132
|
},
|
|
97
|
-
title:
|
|
98
|
-
"aria-label":
|
|
99
|
-
"aria-pressed":
|
|
133
|
+
title: m,
|
|
134
|
+
"aria-label": m,
|
|
135
|
+
"aria-pressed": c
|
|
100
136
|
})
|
|
101
|
-
}),
|
|
102
|
-
fallback: /* @__PURE__ */
|
|
103
|
-
children: /* @__PURE__ */
|
|
104
|
-
value:
|
|
137
|
+
}), c ? /* @__PURE__ */ l(a, {
|
|
138
|
+
fallback: /* @__PURE__ */ l(f, {}),
|
|
139
|
+
children: /* @__PURE__ */ l(d, {
|
|
140
|
+
value: n,
|
|
105
141
|
readOnly: !0
|
|
106
142
|
})
|
|
107
|
-
}) : /* @__PURE__ */
|
|
143
|
+
}) : i ?? /* @__PURE__ */ l(k, { value: n })]
|
|
108
144
|
});
|
|
109
145
|
}
|
|
110
|
-
function
|
|
146
|
+
function O({ value: e, nested: t }) {
|
|
111
147
|
let n = Array.isArray(e) ? e.map((e, t) => [String(t + 1), e]) : Object.entries(e);
|
|
112
|
-
return /* @__PURE__ */
|
|
113
|
-
style: t ?
|
|
114
|
-
children: n.map(([e, t]) => /* @__PURE__ */
|
|
115
|
-
style:
|
|
116
|
-
children: [/* @__PURE__ */
|
|
117
|
-
style:
|
|
148
|
+
return /* @__PURE__ */ l("div", {
|
|
149
|
+
style: t ? b : _,
|
|
150
|
+
children: n.map(([e, t]) => /* @__PURE__ */ u("div", {
|
|
151
|
+
style: v,
|
|
152
|
+
children: [/* @__PURE__ */ l("span", {
|
|
153
|
+
style: y,
|
|
118
154
|
children: e
|
|
119
|
-
}), /* @__PURE__ */
|
|
120
|
-
style:
|
|
121
|
-
children: /* @__PURE__ */
|
|
155
|
+
}), /* @__PURE__ */ l("div", {
|
|
156
|
+
style: x,
|
|
157
|
+
children: /* @__PURE__ */ l(k, {
|
|
122
158
|
value: t,
|
|
123
159
|
nested: !0
|
|
124
160
|
})
|
|
@@ -126,13 +162,21 @@ function C({ value: e, nested: t }) {
|
|
|
126
162
|
}, e))
|
|
127
163
|
});
|
|
128
164
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
165
|
+
function k({ value: e, nested: t }) {
|
|
166
|
+
let n = r();
|
|
167
|
+
return p(e) ? /* @__PURE__ */ l("span", {
|
|
131
168
|
style: { color: "var(--text-4)" },
|
|
132
169
|
children: "—"
|
|
133
|
-
}) :
|
|
170
|
+
}) : m(e) ? /* @__PURE__ */ l(c, { children: e.map((e) => A(e, n.language)).join(", ") }) : typeof e == "object" ? /* @__PURE__ */ l(O, {
|
|
134
171
|
value: e,
|
|
135
172
|
nested: t
|
|
136
|
-
}) : /* @__PURE__ */ c
|
|
173
|
+
}) : /* @__PURE__ */ l(c, { children: A(e, n.language) });
|
|
174
|
+
}
|
|
175
|
+
function A(e, t) {
|
|
176
|
+
if (typeof e == "number" && Number.isFinite(e) && !Number.isInteger(e)) {
|
|
177
|
+
let n = Math.abs(e) < 1 ? { maximumSignificantDigits: 4 } : { maximumFractionDigits: 4 };
|
|
178
|
+
return new Intl.NumberFormat(t, n).format(e);
|
|
179
|
+
}
|
|
180
|
+
return i(e);
|
|
137
181
|
}
|
|
138
|
-
export {
|
|
182
|
+
export { h as JsonField, p as isEmptyJsonValue };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useText as e } from "../../../../hooks/useText.js";
|
|
2
|
+
import { coerceDisplayString as t } from "../../../../lib/display-value.js";
|
|
3
|
+
import { EMPTY_CELL as n } from "./emptyCell.js";
|
|
4
|
+
import { Fragment as r, jsx as i } from "react/jsx-runtime";
|
|
5
|
+
// src/components/fields/cells/factories/errorTitle.tsx
|
|
6
|
+
function a({ code: t }) {
|
|
7
|
+
let n = e("errors");
|
|
8
|
+
return /* @__PURE__ */ i(r, { children: n(t, t) });
|
|
9
|
+
}
|
|
10
|
+
var o = () => (e) => e == null || e === "" ? n : /* @__PURE__ */ i(a, { code: t(e) });
|
|
11
|
+
export { o as errorFactory };
|
|
@@ -21,8 +21,9 @@ import { passwordMaskFactory as x } from "./factories/passwordMask.js";
|
|
|
21
21
|
import { richTextPreviewFactory as S } from "./factories/richTextPreview.js";
|
|
22
22
|
import { multilangInlineFactory as C } from "./factories/multilangInline.js";
|
|
23
23
|
import { fileReferenceFactory as w } from "./factories/fileReference.js";
|
|
24
|
+
import { errorFactory as T } from "./factories/errorTitle.js";
|
|
24
25
|
// src/components/fields/cells/registry.ts
|
|
25
|
-
var
|
|
26
|
+
var E = {
|
|
26
27
|
text: e,
|
|
27
28
|
bool_pill: t,
|
|
28
29
|
badge: n,
|
|
@@ -48,12 +49,13 @@ var T = {
|
|
|
48
49
|
markdown: b,
|
|
49
50
|
password_mask: x,
|
|
50
51
|
rich_text_preview: S,
|
|
51
|
-
multilang_inline: C
|
|
52
|
+
multilang_inline: C,
|
|
53
|
+
error: T
|
|
52
54
|
};
|
|
53
|
-
Object.keys(
|
|
54
|
-
function
|
|
55
|
-
let t = e.field.display?.widget ?? "text", n =
|
|
55
|
+
Object.keys(E).sort();
|
|
56
|
+
function D(e) {
|
|
57
|
+
let t = e.field.display?.widget ?? "text", n = E[t];
|
|
56
58
|
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.`);
|
|
57
59
|
return n(e);
|
|
58
60
|
}
|
|
59
|
-
export {
|
|
61
|
+
export { D as resolveCellRenderer };
|
|
@@ -2,69 +2,71 @@ import { FIELD_TYPES as e } from "../../types/fieldType.js";
|
|
|
2
2
|
import { StringField as t } from "./StringField.js";
|
|
3
3
|
import { TextField as n } from "./TextField.js";
|
|
4
4
|
import { EnumField as r } from "./EnumField.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
5
|
+
import { ErrorField as i } from "./ErrorField.js";
|
|
6
|
+
import { EmailField as a } from "./EmailField.js";
|
|
7
|
+
import { UrlField as o } from "./UrlField.js";
|
|
8
|
+
import { PhoneField as s } from "./PhoneField.js";
|
|
9
|
+
import { TimestampField as c } from "./TimestampField.js";
|
|
10
|
+
import { BoolField as l } from "./BoolField.js";
|
|
11
|
+
import { NumberField as u } from "./NumberField.js";
|
|
12
|
+
import { RefField as d } from "./RefField.js";
|
|
13
|
+
import { JsonField as f } from "./JsonField.js";
|
|
14
|
+
import { MultilangField as p } from "./MultilangField.js";
|
|
15
|
+
import { MultilangTextField as m } from "./MultilangTextField.js";
|
|
16
|
+
import { MultilangArrayField as h } from "./MultilangArrayField.js";
|
|
17
|
+
import { StructureField as g } from "./StructureField.js";
|
|
18
|
+
import { SecretField as _ } from "./SecretField.js";
|
|
19
|
+
import { PasswordField as v } from "./PasswordField.js";
|
|
20
|
+
import { StringArrayField as y } from "./StringArrayField.js";
|
|
21
|
+
import { IntArrayField as b } from "./IntArrayField.js";
|
|
22
|
+
import { RichTextField as x } from "./RichTextField.js";
|
|
23
|
+
import { FileReferenceField as S } from "./FileReferenceField.js";
|
|
24
|
+
import { resolveCellRenderer as C } from "./cells/registry.js";
|
|
25
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
25
26
|
// src/components/fields/index.tsx
|
|
26
|
-
var
|
|
27
|
+
var T = {
|
|
27
28
|
string: t,
|
|
28
29
|
text: n,
|
|
29
|
-
rich_text:
|
|
30
|
-
int:
|
|
31
|
-
float:
|
|
32
|
-
decimal:
|
|
33
|
-
bool:
|
|
34
|
-
timestamp:
|
|
35
|
-
date:
|
|
36
|
-
time:
|
|
30
|
+
rich_text: x,
|
|
31
|
+
int: u,
|
|
32
|
+
float: u,
|
|
33
|
+
decimal: u,
|
|
34
|
+
bool: l,
|
|
35
|
+
timestamp: c,
|
|
36
|
+
date: c,
|
|
37
|
+
time: c,
|
|
37
38
|
enum: r,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
error: i,
|
|
40
|
+
email: a,
|
|
41
|
+
url: o,
|
|
42
|
+
phone: s,
|
|
41
43
|
uuid: t,
|
|
42
44
|
bytes: t,
|
|
43
|
-
ref:
|
|
44
|
-
file_ref:
|
|
45
|
+
ref: d,
|
|
46
|
+
file_ref: S,
|
|
45
47
|
folder_ref: t,
|
|
46
|
-
json:
|
|
48
|
+
json: f,
|
|
47
49
|
tags: t,
|
|
48
|
-
string_array:
|
|
49
|
-
int_array:
|
|
50
|
-
uuid_array:
|
|
51
|
-
multilang:
|
|
52
|
-
multilang_text:
|
|
53
|
-
multilang_array:
|
|
54
|
-
structure:
|
|
55
|
-
secret:
|
|
56
|
-
password:
|
|
50
|
+
string_array: y,
|
|
51
|
+
int_array: b,
|
|
52
|
+
uuid_array: y,
|
|
53
|
+
multilang: p,
|
|
54
|
+
multilang_text: m,
|
|
55
|
+
multilang_array: h,
|
|
56
|
+
structure: g,
|
|
57
|
+
secret: _,
|
|
58
|
+
password: v
|
|
57
59
|
};
|
|
58
|
-
for (let t of e) if (!
|
|
59
|
-
function
|
|
60
|
-
if (e.field.type === "json" && e.field.structure) return /* @__PURE__ */
|
|
60
|
+
for (let t of e) if (!T[t]) throw Error(`editRegistry: missing entry for FieldType "${t}". The FieldType union and editRegistry must cover every field type the server declares.`);
|
|
61
|
+
function E(e) {
|
|
62
|
+
if (e.field.type === "json" && e.field.structure) return /* @__PURE__ */ w(g, { ...e });
|
|
61
63
|
if (e.mode === "edit") {
|
|
62
|
-
let t =
|
|
64
|
+
let t = T[e.field.type];
|
|
63
65
|
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.`);
|
|
64
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ w(t, { ...e });
|
|
65
67
|
}
|
|
66
68
|
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.`);
|
|
67
|
-
return
|
|
69
|
+
return C({
|
|
68
70
|
field: e.field,
|
|
69
71
|
fieldName: e.fieldName,
|
|
70
72
|
surface: e.surface ?? "detail",
|
|
@@ -77,4 +79,4 @@ function T(e) {
|
|
|
77
79
|
detailScreen: e.detailScreen
|
|
78
80
|
})(e.value, e.record ?? {});
|
|
79
81
|
}
|
|
80
|
-
export {
|
|
82
|
+
export { T as editRegistry, E as renderField };
|