@declarion/react 0.89.0 → 0.91.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.
|
@@ -21,14 +21,14 @@ import { useTabNavigate as v } from "../../hooks/useTabNavigate.js";
|
|
|
21
21
|
import { usePageStateStore as me } from "../../stores/page-state.js";
|
|
22
22
|
import { applyRowState as he, resolveActionLayoutForSlot as y } from "../../lib/actions.js";
|
|
23
23
|
import { useScreenIsLive as ge } from "../../stores/realtime.js";
|
|
24
|
-
import { useActionRunner as
|
|
25
|
-
import { canonicalUrl as
|
|
26
|
-
import { useRegisterRetainedQuery as
|
|
27
|
-
import { useBrandingChrome as
|
|
28
|
-
import { objectQueryKey as
|
|
29
|
-
import { discardFile as
|
|
30
|
-
import { FileDraftScope as
|
|
31
|
-
import { getEntityFileField as
|
|
24
|
+
import { useActionRunner as _e } from "../actions/ActionRunner.js";
|
|
25
|
+
import { canonicalUrl as ve } from "../../lib/canonical-url.js";
|
|
26
|
+
import { useRegisterRetainedQuery as ye } from "../../hooks/usePageStateRuntime.js";
|
|
27
|
+
import { useBrandingChrome as b } from "../../hooks/useBrandingChrome.js";
|
|
28
|
+
import { objectQueryKey as be, useObject as x } from "../../hooks/useObject.js";
|
|
29
|
+
import { discardFile as xe } from "../file-widgets/upload.js";
|
|
30
|
+
import { FileDraftScope as S, useFileDraftScope as Se } from "../file-widgets/draft-scope.js";
|
|
31
|
+
import { getEntityFileField as C, getSchemaFieldValue as w, serializeSchemaFieldValue as T } from "../file-widgets/host.js";
|
|
32
32
|
import { buildFilesPayload as Ce, collectCommittedFileIds as we } from "../file-widgets/payload.js";
|
|
33
33
|
import { useCreateObject as Te, useRestoreEntity as Ee, useUpdateObject as De } from "../../hooks/useMutations.js";
|
|
34
34
|
import { useScreenBack as Oe } from "../../hooks/useScreenBack.js";
|
|
@@ -78,7 +78,7 @@ function at({ entity: e, formData: t, record: n, isNew: r, pendingStatuses: i, p
|
|
|
78
78
|
}
|
|
79
79
|
else for (let [r, i] of Object.entries(t)) {
|
|
80
80
|
if (e.files?.has(r)) continue;
|
|
81
|
-
let t = n ?
|
|
81
|
+
let t = n ? w(e, n, r) : void 0, a = T(e, r, i), o = T(e, r, t);
|
|
82
82
|
(a === "" ? null : a) !== (o === "" || o === void 0 ? null : o) && (c[r] = a);
|
|
83
83
|
}
|
|
84
84
|
if (Object.keys(l).length > 0 && (c.$files = l), Object.keys(i).length > 0 && (c.$statuses = Object.entries(i).map(([e, t]) => ({
|
|
@@ -111,20 +111,20 @@ function ot(e, n) {
|
|
|
111
111
|
return n.id == null ? crypto.randomUUID() : t(n.id);
|
|
112
112
|
}
|
|
113
113
|
function st({ screenCode: e }) {
|
|
114
|
-
return /* @__PURE__ */ F(
|
|
114
|
+
return /* @__PURE__ */ F(S, { children: /* @__PURE__ */ F(ct, { screenCode: e }) });
|
|
115
115
|
}
|
|
116
116
|
function ct({ screenCode: t }) {
|
|
117
|
-
let p = _(), ae = _("errors"), { id: oe } = tt(), g = pe(), [le, ue] = nt(), { data: v } = ie(), he = re((e) => e.user), y =
|
|
118
|
-
if (!
|
|
119
|
-
let e = l(
|
|
117
|
+
let p = _(), ae = _("errors"), { id: oe } = tt(), g = pe(), [le, ue] = nt(), { data: v } = ie(), he = re((e) => e.user), y = Se(), _e = ce(), b = v?.screens[t], S = b?.entity ? v?.entities[b.entity] : void 0, T = b?.entity, E = a(S, "create"), je = Me(S), Pe = (() => {
|
|
118
|
+
if (!S || !S.singleton || !S.prefilter) return;
|
|
119
|
+
let e = l(S);
|
|
120
120
|
if (e.length !== 1) return;
|
|
121
|
-
let t =
|
|
121
|
+
let t = S.prefilter[e[0]];
|
|
122
122
|
if (t === "$caller.user_id") return he?.id;
|
|
123
123
|
if (t === "$caller.tenant_id") return he?.tenant?.id;
|
|
124
124
|
})(), D = Pe !== void 0, O = D ? Pe : oe, k = !D && O === "new", L = M(() => {
|
|
125
125
|
if (!O || k) return;
|
|
126
|
-
if (!
|
|
127
|
-
let e = l(
|
|
126
|
+
if (!S) return O;
|
|
127
|
+
let e = l(S);
|
|
128
128
|
if (e.length === 1) return { [e[0]]: O };
|
|
129
129
|
let t = d(O, e.length);
|
|
130
130
|
if (!t) return;
|
|
@@ -134,17 +134,17 @@ function ct({ screenCode: t }) {
|
|
|
134
134
|
}, [
|
|
135
135
|
O,
|
|
136
136
|
k,
|
|
137
|
-
|
|
137
|
+
S
|
|
138
138
|
]), st = M(() => {
|
|
139
139
|
if (L) return typeof L == "string" ? L : f(L);
|
|
140
|
-
}, [L]), ct =
|
|
140
|
+
}, [L]), ct = x(T, L, it), { data: ut, isLoading: dt, error: pt } = ct;
|
|
141
141
|
ne(!dt);
|
|
142
|
-
let gt = ge(
|
|
143
|
-
|
|
144
|
-
let vt = Te(T ?? ""), yt = De(T ?? ""), bt = Ee(T ?? ""), xt = Object.keys(
|
|
142
|
+
let gt = ge(S?.realtime, T ?? ""), _t = T ? gt : !1;
|
|
143
|
+
ye(be(T, L, it), !k);
|
|
144
|
+
let vt = Te(T ?? ""), yt = De(T ?? ""), bt = Ee(T ?? ""), xt = Object.keys(S?.status_groups ?? {}).length > 0, R = ut?.data, z = m(S, "update", R, je.tenantId), St = !!R && a(S, "update") && !ee(S, R, je.tenantId), Ct = m(S, "restore", R, je.tenantId), wt = R?.$statuses, Tt = R?.$properties, Et = le.get("edit") === "true", [Dt, Ot] = P(k || Et), [B, kt] = P({}), [V, At] = P({}), [H, jt] = P({}), [U, W] = P(void 0), [Mt, Nt] = P(!1), [Pt, G] = P(void 0), [Ft, It] = P(!1), Lt = k ? E : z, K = Dt && Lt, Rt = te();
|
|
145
145
|
fe(K && !k, Rt.enabled);
|
|
146
146
|
let [zt, Bt] = P(() => {
|
|
147
|
-
let e = parseInt(
|
|
147
|
+
let e = parseInt(b?.sidebar_width || "380", 10);
|
|
148
148
|
return isNaN(e) ? 380 : e;
|
|
149
149
|
}), Vt = N(null), q = N(null), Ht = A((e) => {
|
|
150
150
|
e.preventDefault();
|
|
@@ -163,7 +163,7 @@ function ct({ screenCode: t }) {
|
|
|
163
163
|
q.current && t && Bt(parseInt(t.style.width, 10) || q.current.startW), q.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
164
164
|
};
|
|
165
165
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
166
|
-
}, []), J = ut?.data, Y = Ne(
|
|
166
|
+
}, []), J = ut?.data, Y = Ne(S, b, J ?? {});
|
|
167
167
|
j(() => {
|
|
168
168
|
let e = parseInt(Y?.sidebar_width || "380", 10);
|
|
169
169
|
Bt(Number.isNaN(e) ? 380 : e);
|
|
@@ -174,18 +174,18 @@ function ct({ screenCode: t }) {
|
|
|
174
174
|
let e = Wt.current;
|
|
175
175
|
Wt.current = X, e && e !== X && Dt && Nt(!0);
|
|
176
176
|
}, [Dt, X]);
|
|
177
|
-
let Gt = !!
|
|
177
|
+
let Gt = !!S?.soft_delete && J != null && J[S.soft_delete] != null, Z = et(), Kt = N(null);
|
|
178
178
|
ke({ scrollElementRef: Kt });
|
|
179
|
-
let qt = !k && pt instanceof e && pt.status === 404, Jt = k && !i(
|
|
179
|
+
let qt = !k && pt instanceof e && pt.status === 404, Jt = k && !i(S), Yt = N(null);
|
|
180
180
|
j(() => {
|
|
181
181
|
if (!qt) return;
|
|
182
|
-
let e =
|
|
182
|
+
let e = ve(Z);
|
|
183
183
|
Yt.current !== e && (Yt.current = e, me.getState().kill(e));
|
|
184
184
|
}, [qt, Z]);
|
|
185
185
|
let { openTab: Xt, updateTabTitle: Zt, findTabByPathname: Qt } = de();
|
|
186
186
|
j(() => {
|
|
187
|
-
if (!
|
|
188
|
-
let e = Z.pathname, t = p(Y?.display?.name) || p(
|
|
187
|
+
if (!S || D || Rt.enabled) return;
|
|
188
|
+
let e = Z.pathname, t = p(Y?.display?.name) || p(S.display.name), n = Y?.display?.icon || S.display.icon;
|
|
189
189
|
Xt({
|
|
190
190
|
pathname: e,
|
|
191
191
|
search: "",
|
|
@@ -198,39 +198,39 @@ function ct({ screenCode: t }) {
|
|
|
198
198
|
Z.pathname,
|
|
199
199
|
p,
|
|
200
200
|
Y?.display?.icon,
|
|
201
|
-
|
|
201
|
+
S?.display.icon,
|
|
202
202
|
k,
|
|
203
203
|
D,
|
|
204
204
|
Rt.enabled
|
|
205
205
|
]), j(() => {
|
|
206
|
-
if (!J || !
|
|
206
|
+
if (!J || !S || D || Rt.enabled) return;
|
|
207
207
|
let e = Qt(Z.pathname);
|
|
208
208
|
if (e) {
|
|
209
|
-
let t = p(Y?.display?.name) || p(
|
|
209
|
+
let t = p(Y?.display?.name) || p(S.display.name), n = c(p, J, S), r = n && !String(n).startsWith("/") ? String(n) : t;
|
|
210
210
|
Zt(e.id, r, r === t);
|
|
211
211
|
}
|
|
212
212
|
}, [
|
|
213
213
|
J,
|
|
214
214
|
p,
|
|
215
|
-
|
|
215
|
+
S?.display.display_field,
|
|
216
216
|
Z.pathname,
|
|
217
217
|
D,
|
|
218
218
|
Rt.enabled
|
|
219
219
|
]);
|
|
220
220
|
let $t = M(() => {
|
|
221
|
-
if (!
|
|
221
|
+
if (!S || !Lt) return /* @__PURE__ */ new Set();
|
|
222
222
|
let e = /* @__PURE__ */ new Set();
|
|
223
|
-
for (let [t, n] of
|
|
224
|
-
for (let [t] of
|
|
223
|
+
for (let [t, n] of S.fields) u(n) && e.add(t);
|
|
224
|
+
for (let [t] of S.files ?? []) e.add(t);
|
|
225
225
|
return e;
|
|
226
|
-
}, [
|
|
226
|
+
}, [S, Lt]), en = N(null);
|
|
227
227
|
j(() => {
|
|
228
|
-
if (Et && J &&
|
|
229
|
-
if (Dt || Ot(!0), Object.keys(B).length === 0) {
|
|
228
|
+
if (Et && J && S && z && en.current !== Z.key) {
|
|
229
|
+
if (en.current = Z.key, Dt || Ot(!0), Object.keys(B).length === 0) {
|
|
230
230
|
let e = O ? Ze(O) : null;
|
|
231
231
|
if (e) {
|
|
232
232
|
let t = Ce({
|
|
233
|
-
entity:
|
|
233
|
+
entity: S,
|
|
234
234
|
formData: e,
|
|
235
235
|
record: void 0,
|
|
236
236
|
isNew: !0
|
|
@@ -238,7 +238,7 @@ function ct({ screenCode: t }) {
|
|
|
238
238
|
we(t).forEach((e) => {
|
|
239
239
|
y.registerDraft({
|
|
240
240
|
fileId: e,
|
|
241
|
-
discard: () =>
|
|
241
|
+
discard: () => xe(e)
|
|
242
242
|
});
|
|
243
243
|
});
|
|
244
244
|
}
|
|
@@ -249,11 +249,11 @@ function ct({ screenCode: t }) {
|
|
|
249
249
|
t[n] = r;
|
|
250
250
|
return;
|
|
251
251
|
}
|
|
252
|
-
let i =
|
|
253
|
-
t[n] =
|
|
252
|
+
let i = w(S, J, n);
|
|
253
|
+
t[n] = C(S, n) ? i ?? null : i ?? "";
|
|
254
254
|
}), kt(t);
|
|
255
255
|
}
|
|
256
|
-
if (
|
|
256
|
+
if (S.children !== void 0 && S.children.length > 0 && U === void 0) {
|
|
257
257
|
let e = J.$children;
|
|
258
258
|
if (e && Object.keys(e).length > 0) {
|
|
259
259
|
let t = {};
|
|
@@ -277,17 +277,18 @@ function ct({ screenCode: t }) {
|
|
|
277
277
|
J,
|
|
278
278
|
$t,
|
|
279
279
|
z,
|
|
280
|
-
|
|
280
|
+
S,
|
|
281
281
|
U,
|
|
282
|
-
v
|
|
282
|
+
v,
|
|
283
|
+
Z.key
|
|
283
284
|
]), j(() => {
|
|
284
|
-
k && E &&
|
|
285
|
+
k && E && S?.children && S.children.length !== 0 && U === void 0 && (W({}), G({}));
|
|
285
286
|
}, [
|
|
286
287
|
k,
|
|
287
288
|
E,
|
|
288
|
-
|
|
289
|
+
S?.children
|
|
289
290
|
]);
|
|
290
|
-
let
|
|
291
|
+
let tn = A(async () => {
|
|
291
292
|
if (await y.flushAllDrafts(), k) {
|
|
292
293
|
let e = Y?.route?.replace("/:id", "") ?? "/";
|
|
293
294
|
g(e);
|
|
@@ -297,7 +298,7 @@ function ct({ screenCode: t }) {
|
|
|
297
298
|
k,
|
|
298
299
|
Y,
|
|
299
300
|
g
|
|
300
|
-
]),
|
|
301
|
+
]), nn = A((e, t) => {
|
|
301
302
|
kt((n) => ({
|
|
302
303
|
...n,
|
|
303
304
|
[e]: t
|
|
@@ -306,33 +307,33 @@ function ct({ screenCode: t }) {
|
|
|
306
307
|
if (!Y?.route) return "/";
|
|
307
308
|
let e = Y.route.split("/");
|
|
308
309
|
return e.pop(), e.join("/") || "/";
|
|
309
|
-
}, [Y]),
|
|
310
|
-
if (!
|
|
310
|
+
}, [Y]), rn = M(() => !v?.screens || !Q || Q === "/" ? !1 : Object.values(v.screens).some((e) => e.route === Q), [v, Q]), an = A(() => {
|
|
311
|
+
if (!rn) {
|
|
311
312
|
g("/");
|
|
312
313
|
return;
|
|
313
314
|
}
|
|
314
315
|
let e = Qt(Q)?.search ?? "";
|
|
315
316
|
g(e ? `${Q}?${e}` : Q);
|
|
316
317
|
}, [
|
|
317
|
-
|
|
318
|
+
rn,
|
|
318
319
|
Q,
|
|
319
320
|
Qt,
|
|
320
321
|
g
|
|
321
|
-
]),
|
|
322
|
-
if (!
|
|
322
|
+
]), on = Oe({ fallback: an }), sn = !D && (on.hasOriginBack || on.allowFallbackBack && !!rn), cn = M(() => {
|
|
323
|
+
if (!S) return {};
|
|
323
324
|
let e = {};
|
|
324
|
-
for (let t of Ye(
|
|
325
|
-
for (let t of Je(
|
|
325
|
+
for (let t of Ye(S, B, k)) $t.has(t) && (e[t] = p("record.field.required", "Required"));
|
|
326
|
+
for (let t of Je(S, B)) $t.has(t) && (e[t] = ae("record.email_invalid", "This is not a valid email address."));
|
|
326
327
|
return e;
|
|
327
328
|
}, [
|
|
328
329
|
p,
|
|
329
330
|
ae,
|
|
330
|
-
|
|
331
|
+
S,
|
|
331
332
|
B,
|
|
332
333
|
k,
|
|
333
334
|
$t
|
|
334
|
-
]),
|
|
335
|
-
entity:
|
|
335
|
+
]), ln = Object.keys(cn).length > 0, un = M(() => S ? at({
|
|
336
|
+
entity: S,
|
|
336
337
|
formData: B,
|
|
337
338
|
record: J,
|
|
338
339
|
isNew: k,
|
|
@@ -344,7 +345,7 @@ function ct({ screenCode: t }) {
|
|
|
344
345
|
payload: {},
|
|
345
346
|
committedFileIds: []
|
|
346
347
|
}, [
|
|
347
|
-
|
|
348
|
+
S,
|
|
348
349
|
B,
|
|
349
350
|
J,
|
|
350
351
|
k,
|
|
@@ -352,12 +353,12 @@ function ct({ screenCode: t }) {
|
|
|
352
353
|
H,
|
|
353
354
|
U,
|
|
354
355
|
Pt
|
|
355
|
-
]),
|
|
356
|
-
Fe(
|
|
357
|
-
let
|
|
358
|
-
if (!T || !
|
|
359
|
-
let t = { ...
|
|
360
|
-
if (!k && !
|
|
356
|
+
]), dn = Object.keys(un.payload).length > 0, fn = K && (k || dn);
|
|
357
|
+
Fe(fn);
|
|
358
|
+
let pn = A(() => {
|
|
359
|
+
if (!T || !S || k && !E || !k && !z || (It(!0), ln)) return;
|
|
360
|
+
let t = { ...un.payload }, { committedFileIds: n } = un;
|
|
361
|
+
if (!k && !dn) {
|
|
361
362
|
Ot(!1), At({}), jt({}), W(void 0), G(void 0), It(!1);
|
|
362
363
|
return;
|
|
363
364
|
}
|
|
@@ -367,7 +368,7 @@ function ct({ screenCode: t }) {
|
|
|
367
368
|
};
|
|
368
369
|
k ? vt.mutate(t, { onSuccess: (e) => {
|
|
369
370
|
n.forEach((e) => y.markCommitted(e));
|
|
370
|
-
let t = e.data, i =
|
|
371
|
+
let t = e.data, i = S ? o(S, t) : {}, a = f(i);
|
|
371
372
|
g(a ? `${Q}/${encodeURIComponent(a)}` : Q, { replace: !0 }), r();
|
|
372
373
|
} }) : L && yt.mutate({
|
|
373
374
|
pkValues: L,
|
|
@@ -386,30 +387,30 @@ function ct({ screenCode: t }) {
|
|
|
386
387
|
E,
|
|
387
388
|
z,
|
|
388
389
|
T,
|
|
389
|
-
cn,
|
|
390
390
|
ln,
|
|
391
391
|
un,
|
|
392
|
+
dn,
|
|
392
393
|
vt,
|
|
393
394
|
yt,
|
|
394
|
-
|
|
395
|
+
S,
|
|
395
396
|
g,
|
|
396
397
|
Q,
|
|
397
398
|
X,
|
|
398
399
|
L
|
|
399
|
-
]),
|
|
400
|
+
]), mn = A((e, t) => {
|
|
400
401
|
W((n) => ({
|
|
401
402
|
...n ?? {},
|
|
402
403
|
[e]: t
|
|
403
404
|
}));
|
|
404
|
-
}, []),
|
|
405
|
+
}, []), hn = A(() => {
|
|
405
406
|
L && !k && Ct && bt.mutate(L);
|
|
406
407
|
}, [
|
|
407
408
|
L,
|
|
408
409
|
k,
|
|
409
410
|
Ct,
|
|
410
411
|
bt
|
|
411
|
-
]),
|
|
412
|
-
if (!Y || !
|
|
412
|
+
]), gn = M(() => Xe(U, v), [U, v]), _n = Object.keys(gn).length > 0;
|
|
413
|
+
if (!Y || !S) return null;
|
|
413
414
|
if (!k && dt) return /* @__PURE__ */ F(Ae, {});
|
|
414
415
|
if (Jt) return /* @__PURE__ */ I("div", {
|
|
415
416
|
style: { padding: 24 },
|
|
@@ -420,9 +421,9 @@ function ct({ screenCode: t }) {
|
|
|
420
421
|
gap: 8,
|
|
421
422
|
marginBottom: 8
|
|
422
423
|
},
|
|
423
|
-
children: [
|
|
424
|
+
children: [sn && /* @__PURE__ */ F(se, {
|
|
424
425
|
icon: /* @__PURE__ */ F(h.back, { size: 14 }),
|
|
425
|
-
onClick:
|
|
426
|
+
onClick: on.goBack,
|
|
426
427
|
title: p("record.back", "Back")
|
|
427
428
|
}), /* @__PURE__ */ F("h1", {
|
|
428
429
|
style: {
|
|
@@ -447,9 +448,9 @@ function ct({ screenCode: t }) {
|
|
|
447
448
|
gap: 8,
|
|
448
449
|
marginBottom: 8
|
|
449
450
|
},
|
|
450
|
-
children: [
|
|
451
|
+
children: [sn && /* @__PURE__ */ F(se, {
|
|
451
452
|
icon: /* @__PURE__ */ F(h.back, { size: 14 }),
|
|
452
|
-
onClick:
|
|
453
|
+
onClick: on.goBack,
|
|
453
454
|
title: p("record.back", "Back")
|
|
454
455
|
}), /* @__PURE__ */ F("h1", {
|
|
455
456
|
style: {
|
|
@@ -465,12 +466,12 @@ function ct({ screenCode: t }) {
|
|
|
465
466
|
children: ae("entity.not_found", "This record does not exist.")
|
|
466
467
|
})]
|
|
467
468
|
});
|
|
468
|
-
let
|
|
469
|
-
entity:
|
|
469
|
+
let vn = S.display, yn = p(Y.display?.name) || p(vn.name), bn = c(p, J, S), xn = k ? p("record.new_title", "New {name}", { name: yn }) : bn ? String(bn) : yn, Sn = vt.isPending || yt.isPending, Cn = Y.responsive?.[_e.category]?.layout, wn = Cn?.tabs ?? (_e.isPhone ? "sections" : void 0), Tn = Cn?.header_card === !0 ? Qe({
|
|
470
|
+
entity: S,
|
|
470
471
|
screen: Y
|
|
471
472
|
}) : void 0, $ = {
|
|
472
473
|
schema: v,
|
|
473
|
-
entity:
|
|
474
|
+
entity: S,
|
|
474
475
|
entityCode: T,
|
|
475
476
|
recordId: st ?? O ?? "",
|
|
476
477
|
record: K ? {
|
|
@@ -479,9 +480,9 @@ function ct({ screenCode: t }) {
|
|
|
479
480
|
} : J ?? {},
|
|
480
481
|
isNew: k,
|
|
481
482
|
mode: K ? "edit" : "display",
|
|
482
|
-
onFieldChange: K ?
|
|
483
|
+
onFieldChange: K ? nn : void 0,
|
|
483
484
|
refs: Ut,
|
|
484
|
-
headerFields: !k && J ? We(Y,
|
|
485
|
+
headerFields: !k && J ? We(Y, S) : void 0,
|
|
485
486
|
objectProperties: (() => {
|
|
486
487
|
let e = Tt ?? [];
|
|
487
488
|
if (!K || Object.keys(H).length === 0) return e.length > 0 ? e : void 0;
|
|
@@ -523,67 +524,67 @@ function ct({ screenCode: t }) {
|
|
|
523
524
|
})) : void 0,
|
|
524
525
|
isStatusPending: !1,
|
|
525
526
|
pendingChildren: K ? U : void 0,
|
|
526
|
-
onChildrenChange: K ?
|
|
527
|
-
childValidationErrors: K ?
|
|
528
|
-
fieldErrors: K && Ft ?
|
|
529
|
-
detailTabsPresentation:
|
|
530
|
-
relatedRecordsPresentation:
|
|
531
|
-
},
|
|
527
|
+
onChildrenChange: K ? mn : void 0,
|
|
528
|
+
childValidationErrors: K ? gn : void 0,
|
|
529
|
+
fieldErrors: K && Ft ? cn : void 0,
|
|
530
|
+
detailTabsPresentation: wn,
|
|
531
|
+
relatedRecordsPresentation: Cn?.related_records
|
|
532
|
+
}, En = !!Y.sidebar && (k ? Y.sidebar.some((e) => ze(e, S, v?.entities ?? {})) : Y.sidebar.length > 0), Dn = Cn?.sidebar === "hidden", On = En && !Dn && !_e.isDesktop, kn = En && !Dn && _e.isDesktop, An = !k && J ? /* @__PURE__ */ F(Ue, {
|
|
532
533
|
screen: Y,
|
|
533
|
-
entity:
|
|
534
|
+
entity: S,
|
|
534
535
|
entityCode: T,
|
|
535
536
|
record: J,
|
|
536
537
|
refs: Ut,
|
|
537
538
|
objectStatuses: wt,
|
|
538
539
|
schema: v
|
|
539
|
-
}) : void 0,
|
|
540
|
-
title:
|
|
540
|
+
}) : void 0, jn = /* @__PURE__ */ F(ft, {
|
|
541
|
+
title: xn,
|
|
541
542
|
editing: K,
|
|
542
543
|
isNew: k,
|
|
543
544
|
isRecordDeleted: Gt,
|
|
544
|
-
dirty:
|
|
545
|
-
isSaving:
|
|
546
|
-
hasChildErrors:
|
|
547
|
-
hasFieldErrors: Ft &&
|
|
545
|
+
dirty: fn,
|
|
546
|
+
isSaving: Sn,
|
|
547
|
+
hasChildErrors: _n,
|
|
548
|
+
hasFieldErrors: Ft && ln,
|
|
548
549
|
canRestore: Ct,
|
|
549
|
-
entity:
|
|
550
|
+
entity: S,
|
|
550
551
|
screen: Y,
|
|
551
552
|
globalActions: v?.actions,
|
|
552
553
|
entityCode: T,
|
|
553
554
|
record: J,
|
|
554
555
|
id: O,
|
|
555
556
|
listRoute: Q,
|
|
556
|
-
listRouteExists: !!
|
|
557
|
-
highlights:
|
|
558
|
-
showBack:
|
|
559
|
-
onBack:
|
|
560
|
-
onCancelEdit:
|
|
561
|
-
onSave:
|
|
562
|
-
onRestore:
|
|
557
|
+
listRouteExists: !!rn,
|
|
558
|
+
highlights: An,
|
|
559
|
+
showBack: sn,
|
|
560
|
+
onBack: on.goBack,
|
|
561
|
+
onCancelEdit: tn,
|
|
562
|
+
onSave: pn,
|
|
563
|
+
onRestore: hn,
|
|
563
564
|
isRestoring: bt.isPending,
|
|
564
565
|
refreshControl: {
|
|
565
566
|
refetch: ct.refetch,
|
|
566
567
|
isLoading: ct.isLoading,
|
|
567
568
|
isLive: _t
|
|
568
569
|
},
|
|
569
|
-
isRealtimeEntity:
|
|
570
|
+
isRealtimeEntity: S?.realtime === !0,
|
|
570
571
|
canManageTemplates: Le(v)
|
|
571
|
-
}),
|
|
572
|
+
}), Mn = Gt && /* @__PURE__ */ F(mt, {
|
|
572
573
|
tone: "danger",
|
|
573
|
-
children: p("record.deleted_banner", "This record was deleted on {date}", { date: n(String(J[
|
|
574
|
+
children: p("record.deleted_banner", "This record was deleted on {date}", { date: n(String(J[S.soft_delete]), {
|
|
574
575
|
zone: p.timeZone,
|
|
575
|
-
declared: !!(
|
|
576
|
+
declared: !!(S.fields.get(S.soft_delete)?.timezone || S.default_timezone)
|
|
576
577
|
}) })
|
|
577
|
-
}),
|
|
578
|
+
}), Nn = Mt && /* @__PURE__ */ F(mt, {
|
|
578
579
|
tone: "warn",
|
|
579
580
|
children: p("record.changed_on_server", "This record changed on the server while you were viewing or editing it.")
|
|
580
|
-
}),
|
|
581
|
+
}), Pn = St && J ? ht(p, S, J, Ut) : void 0, Fn = St && /* @__PURE__ */ F(mt, {
|
|
581
582
|
tone: "info",
|
|
582
583
|
testId: "record-other-tenant-banner",
|
|
583
|
-
children:
|
|
584
|
-
}),
|
|
585
|
-
errors: Object.entries(
|
|
586
|
-
let n =
|
|
584
|
+
children: Pn ? p("record.other_tenant_banner_named", "This record is set in the tenant {tenant}. Change it from that tenant.", { tenant: Pn }) : p("record.other_tenant_banner", "This record is set in another tenant. Change it from that tenant.")
|
|
585
|
+
}), In = K && Ft && ln && /* @__PURE__ */ F(He, {
|
|
586
|
+
errors: Object.entries(cn).map(([e, t]) => {
|
|
587
|
+
let n = S.fields.get(e);
|
|
587
588
|
return {
|
|
588
589
|
name: e,
|
|
589
590
|
label: n ? s(p, n, e, v?.entities) : e,
|
|
@@ -597,10 +598,10 @@ function ct({ screenCode: t }) {
|
|
|
597
598
|
behavior: "smooth"
|
|
598
599
|
}), t.focus?.());
|
|
599
600
|
}
|
|
600
|
-
}),
|
|
601
|
+
}), Ln = xt && !k && !(Y.items && Y.items.length > 0) && /* @__PURE__ */ F("div", {
|
|
601
602
|
className: "mb-4",
|
|
602
603
|
children: /* @__PURE__ */ F(Be, {
|
|
603
|
-
statusGroups:
|
|
604
|
+
statusGroups: S.status_groups ?? {},
|
|
604
605
|
objectStatuses: $.objectStatuses,
|
|
605
606
|
onSetStatus: z && K ? (e, t) => At((n) => ({
|
|
606
607
|
...n,
|
|
@@ -609,13 +610,13 @@ function ct({ screenCode: t }) {
|
|
|
609
610
|
isPending: !1,
|
|
610
611
|
mode: K ? "edit" : "display"
|
|
611
612
|
})
|
|
612
|
-
}),
|
|
613
|
+
}), Rn = S.evidence_covered && !k && J && /* @__PURE__ */ F("div", {
|
|
613
614
|
className: "mb-4",
|
|
614
615
|
children: /* @__PURE__ */ F(Ke, { evidence: J.$evidence })
|
|
615
|
-
}),
|
|
616
|
-
|
|
617
|
-
card:
|
|
618
|
-
entity:
|
|
616
|
+
}), zn = /* @__PURE__ */ I($e, { children: [
|
|
617
|
+
Tn && (J || k) && /* @__PURE__ */ F(lt, {
|
|
618
|
+
card: Tn,
|
|
619
|
+
entity: S,
|
|
619
620
|
record: $.record,
|
|
620
621
|
objectStatuses: $.objectStatuses,
|
|
621
622
|
objectProperties: $.objectProperties
|
|
@@ -624,37 +625,37 @@ function ct({ screenCode: t }) {
|
|
|
624
625
|
nodes: Y.items,
|
|
625
626
|
ctx: $
|
|
626
627
|
}),
|
|
627
|
-
!k && O && T &&
|
|
628
|
+
!k && O && T && S.associations && Object.keys(S.associations).length > 0 && v && /* @__PURE__ */ F(Ie, {
|
|
628
629
|
entityCode: T,
|
|
629
630
|
recordId: st ?? O ?? "",
|
|
630
|
-
associations:
|
|
631
|
+
associations: S.associations,
|
|
631
632
|
schema: v
|
|
632
633
|
}),
|
|
633
634
|
!k && O && T && /* @__PURE__ */ F(Re, {
|
|
634
|
-
entity:
|
|
635
|
+
entity: S,
|
|
635
636
|
entityCode: T,
|
|
636
637
|
objectId: st ?? O,
|
|
637
638
|
schema: v
|
|
638
639
|
}),
|
|
639
640
|
!k && J && v && /* @__PURE__ */ F(Ge, {
|
|
640
641
|
screen: Y,
|
|
641
|
-
entity:
|
|
642
|
+
entity: S,
|
|
642
643
|
entityCode: T,
|
|
643
644
|
record: J,
|
|
644
645
|
recordId: st ?? O,
|
|
645
646
|
refs: Ut,
|
|
646
647
|
schema: v
|
|
647
648
|
})
|
|
648
|
-
] }),
|
|
649
|
-
An,
|
|
650
|
-
Mn,
|
|
649
|
+
] }), Bn = /* @__PURE__ */ I($e, { children: [
|
|
651
650
|
jn,
|
|
652
|
-
|
|
651
|
+
Nn,
|
|
652
|
+
Mn,
|
|
653
653
|
Fn,
|
|
654
654
|
In,
|
|
655
|
-
Ln
|
|
655
|
+
Ln,
|
|
656
|
+
Rn
|
|
656
657
|
] });
|
|
657
|
-
return
|
|
658
|
+
return kn ? /* @__PURE__ */ I("div", {
|
|
658
659
|
style: {
|
|
659
660
|
height: "100%",
|
|
660
661
|
display: "flex",
|
|
@@ -670,8 +671,8 @@ function ct({ screenCode: t }) {
|
|
|
670
671
|
},
|
|
671
672
|
children: /* @__PURE__ */ F(qe, {
|
|
672
673
|
scrollRef: Kt,
|
|
673
|
-
header:
|
|
674
|
-
children:
|
|
674
|
+
header: Bn,
|
|
675
|
+
children: zn
|
|
675
676
|
})
|
|
676
677
|
}),
|
|
677
678
|
/* @__PURE__ */ F("div", {
|
|
@@ -703,8 +704,8 @@ function ct({ screenCode: t }) {
|
|
|
703
704
|
]
|
|
704
705
|
}) : /* @__PURE__ */ I(qe, {
|
|
705
706
|
scrollRef: Kt,
|
|
706
|
-
header:
|
|
707
|
-
children: [
|
|
707
|
+
header: Bn,
|
|
708
|
+
children: [zn, On && (J || k) && v && /* @__PURE__ */ F("div", {
|
|
708
709
|
"data-testid": "detail-sidebar-inline",
|
|
709
710
|
style: {
|
|
710
711
|
display: "flex",
|
|
@@ -845,7 +846,7 @@ function ut(e, t, n, r, i, a) {
|
|
|
845
846
|
let e = n.slice(10);
|
|
846
847
|
return a?.find((t) => t.property_code === e)?.value;
|
|
847
848
|
}
|
|
848
|
-
return
|
|
849
|
+
return w(t, r, n);
|
|
849
850
|
}
|
|
850
851
|
function dt(e, t, n) {
|
|
851
852
|
if (n.startsWith("$status.")) return n.slice(8);
|
|
@@ -853,8 +854,8 @@ function dt(e, t, n) {
|
|
|
853
854
|
let r = t.fields.get(n);
|
|
854
855
|
return r ? s(e, r, n) : n;
|
|
855
856
|
}
|
|
856
|
-
function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSaving: a, hasChildErrors: o, hasFieldErrors: s, canRestore: c, entity: l, screen: u, globalActions: d, entityCode: f, record: p, id: m, listRoute: ee, listRouteExists: te, highlights: ne, showBack: re, onBack: ie, onCancelEdit: se, onSave: ce, onRestore: de, isRestoring: fe, refreshControl: ge, isRealtimeEntity:
|
|
857
|
-
let
|
|
857
|
+
function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSaving: a, hasChildErrors: o, hasFieldErrors: s, canRestore: c, entity: l, screen: u, globalActions: d, entityCode: f, record: p, id: m, listRoute: ee, listRouteExists: te, highlights: ne, showBack: re, onBack: ie, onCancelEdit: se, onSave: ce, onRestore: de, isRestoring: fe, refreshControl: ge, isRealtimeEntity: ye, canManageTemplates: be }) {
|
|
858
|
+
let x = _(), xe = _("errors"), S = Me(l), { run: Se } = _e(), C = b("detail"), w = v(), T = pe(), Ce = y(u?.action_layout, l?.action_layout, l?.actions, d, "detail_toolbar"), we = y(u?.action_layout, l?.action_layout, l?.actions, d, "detail"), Te = he(x, we, l?.actions, d, p ?? {}, [], S, Pe(l, p ?? {})), Ee = he(x, Ce, l?.actions, d, p ?? {}, [], S, Pe(l, p ?? {})), De = M(() => {
|
|
858
859
|
if (!l) return;
|
|
859
860
|
let e = m ? [m] : [];
|
|
860
861
|
return {
|
|
@@ -864,8 +865,8 @@ function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSa
|
|
|
864
865
|
screenRoute: u?.route ?? "",
|
|
865
866
|
selectedRows: p ? [p] : [],
|
|
866
867
|
selectedIds: e,
|
|
867
|
-
t:
|
|
868
|
-
tabNavigate: (e, t) =>
|
|
868
|
+
t: x,
|
|
869
|
+
tabNavigate: (e, t) => w(e, {
|
|
869
870
|
title: t?.title,
|
|
870
871
|
icon: t?.icon,
|
|
871
872
|
search: t?.search
|
|
@@ -879,22 +880,22 @@ function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSa
|
|
|
879
880
|
u,
|
|
880
881
|
m,
|
|
881
882
|
p,
|
|
882
|
-
|
|
883
|
-
|
|
883
|
+
x,
|
|
884
|
+
w
|
|
884
885
|
]), Oe = (e, t) => {
|
|
885
|
-
let n = E(
|
|
886
|
+
let n = E(xe, e, t, { row: p ?? void 0 });
|
|
886
887
|
if (n === null) return;
|
|
887
888
|
let r = m ? [m] : [], i = e === "__delete" && te ? ee : null;
|
|
888
|
-
return
|
|
889
|
+
return Se({
|
|
889
890
|
action: t,
|
|
890
|
-
title:
|
|
891
|
+
title: x(t.display?.name) || e,
|
|
891
892
|
row: p ?? void 0,
|
|
892
893
|
execute: (e) => oe(n, ae(e, r)),
|
|
893
894
|
onSuccess: i ? () => {
|
|
894
|
-
me.getState().kill(
|
|
895
|
+
me.getState().kill(ve(location)), T(i, { replace: !0 });
|
|
895
896
|
} : void 0
|
|
896
897
|
});
|
|
897
|
-
}, ke =
|
|
898
|
+
}, ke = C.isVisible("show_actions") && !n && m && Te.length > 0 ? /* @__PURE__ */ F(je, {
|
|
898
899
|
layout: Te,
|
|
899
900
|
row: p,
|
|
900
901
|
onRun: Oe,
|
|
@@ -905,8 +906,8 @@ function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSa
|
|
|
905
906
|
widgetContext: De
|
|
906
907
|
}) : null, Ae = !n && m ? /* @__PURE__ */ F(D, {
|
|
907
908
|
liveObject: ge,
|
|
908
|
-
realtime:
|
|
909
|
-
}) : null, Ne =
|
|
909
|
+
realtime: ye
|
|
910
|
+
}) : null, Ne = C.isVisible("show_actions") && !n && m && Ee.length > 0 ? /* @__PURE__ */ I("div", {
|
|
910
911
|
style: {
|
|
911
912
|
display: "flex",
|
|
912
913
|
justifyContent: "flex-end",
|
|
@@ -923,32 +924,32 @@ function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSa
|
|
|
923
924
|
globalActions: d,
|
|
924
925
|
reservedRightWidth: 0,
|
|
925
926
|
widgetContext: De,
|
|
926
|
-
ariaLabel: ke ?
|
|
927
|
+
ariaLabel: ke ? x("record.toolbar_actions", "Detail toolbar actions") : x("record.page_actions", "Page actions")
|
|
927
928
|
})]
|
|
928
|
-
}) : null, Fe =
|
|
929
|
+
}) : null, Fe = C.isVisible("show_actions") && !n && m && f ? /* @__PURE__ */ F(O, {
|
|
929
930
|
entityCode: f,
|
|
930
931
|
scope: "detail",
|
|
931
932
|
objectIds: [m],
|
|
932
933
|
capability: l?.documents,
|
|
933
|
-
canManageTemplates:
|
|
934
|
+
canManageTemplates: be
|
|
934
935
|
}) : null, Ie = r ? c ? /* @__PURE__ */ F(g, {
|
|
935
936
|
kind: "primary",
|
|
936
937
|
icon: F(fe ? le : h.refresh, { size: 13 }),
|
|
937
938
|
onClick: de,
|
|
938
939
|
disabled: fe,
|
|
939
|
-
children: fe ?
|
|
940
|
+
children: fe ? x("record.restoring", "Restoring…") : x("record.restore", "Restore")
|
|
940
941
|
}) : null : t ? /* @__PURE__ */ I($e, { children: [/* @__PURE__ */ F(g, {
|
|
941
942
|
icon: /* @__PURE__ */ F(h.x, { size: 13 }),
|
|
942
943
|
onClick: se,
|
|
943
944
|
disabled: a,
|
|
944
|
-
children:
|
|
945
|
+
children: x("dialog.cancel", "Cancel")
|
|
945
946
|
}), /* @__PURE__ */ F(g, {
|
|
946
947
|
kind: "primary",
|
|
947
948
|
icon: F(a ? le : h.save, { size: 13 }),
|
|
948
949
|
onClick: ce,
|
|
949
950
|
disabled: a || o || s,
|
|
950
|
-
title: o ?
|
|
951
|
-
children: a ?
|
|
951
|
+
title: o ? x("record.save.fix_child_rows", "Fix errors in child rows") : s ? x("record.save.fix_fields", "Fix the highlighted fields") : void 0,
|
|
952
|
+
children: a ? x("dialog.saving", "Saving…") : x("dialog.save", "Save")
|
|
952
953
|
})] }) : !n && m ? ke ? /* @__PURE__ */ I("span", {
|
|
953
954
|
style: { display: "contents" },
|
|
954
955
|
children: [Fe, ke]
|
|
@@ -959,7 +960,7 @@ function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSa
|
|
|
959
960
|
size: 16
|
|
960
961
|
}) : void 0,
|
|
961
962
|
title: e,
|
|
962
|
-
description:
|
|
963
|
+
description: x(u?.display?.description) || x(l?.display?.description),
|
|
963
964
|
highlights: ne,
|
|
964
965
|
identityControls: !r && !t && !n ? Ae : null,
|
|
965
966
|
mode: n ? "create" : t ? "edit" : "display",
|
|
@@ -967,7 +968,7 @@ function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSa
|
|
|
967
968
|
showBack: re,
|
|
968
969
|
onBack: ie,
|
|
969
970
|
right: Ie,
|
|
970
|
-
showTitle:
|
|
971
|
+
showTitle: C.isVisible("show_title")
|
|
971
972
|
}), Ne] });
|
|
972
973
|
}
|
|
973
974
|
var pt = {
|