@declarion/react 0.34.0 → 0.36.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/README.md +1 -1
- package/dist-lib/{ActionRunner-UGGvGypS.js → ActionRunner-BrXXs8ga.js} +1179 -1287
- package/dist-lib/{DraggableChildrenTable-CljdYXd_.js → DraggableChildrenTable-ChUh120M.js} +39 -39
- package/dist-lib/{Grid-5Y_iPqNW.js → Grid-DT9wV-D7.js} +2 -2
- package/dist-lib/{JsonEditor-KelPV-OQ.js → JsonEditor-DoNmyrYd.js} +2 -2
- package/dist-lib/{LayoutRenderer-CoTMmvNW.js → LayoutRenderer-CUiUEyCz.js} +407 -405
- package/dist-lib/{MarkdownRenderer-unbncYEV.js → MarkdownRenderer-CvURrJCu.js} +1 -1
- package/dist-lib/{MonacoJson-DVjwsaBK.js → MonacoJson-BfpzZ1iT.js} +1 -1
- package/dist-lib/{RefreshControl-oeKhCjEC.js → RefreshControl-CX_D6PcA.js} +92 -94
- package/dist-lib/{SmartDetailPage.impl-Caxd97q6.js → SmartDetailPage.impl-Cd0eqv1J.js} +321 -318
- package/dist-lib/{SmartRecordListPage.impl-BF_ieDc2.js → SmartRecordListPage.impl-DqB_MARs.js} +248 -248
- package/dist-lib/assets/OFL-Inter.txt +93 -0
- package/dist-lib/assets/OFL-JetBrainsMono.txt +93 -0
- package/dist-lib/assets/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist-lib/assets/inter-latin-wght-normal.woff2 +0 -0
- package/dist-lib/assets/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
- package/dist-lib/assets/jetbrains-mono-latin-wght-normal.woff2 +0 -0
- package/dist-lib/components/fields/cells/factories/host-icons.d.ts +9 -1
- package/dist-lib/components/layout/TopBar.d.ts +2 -1
- package/dist-lib/components/pages/list/DataCell.d.ts +1 -2
- package/dist-lib/components/primitives/Btn.d.ts +1 -1
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/embed/theme.d.ts +8 -8
- package/dist-lib/hooks/useBrandingChrome.d.ts +28 -2
- package/dist-lib/hooks/useResponsiveMode.d.ts +17 -1
- package/dist-lib/index.js +1971 -1936
- package/dist-lib/lib/brand-tokens.d.ts +43 -0
- package/dist-lib/lib/html-state.d.ts +11 -0
- package/dist-lib/lib/versionTracker.d.ts +6 -0
- package/dist-lib/{registry-DnPK3Msj.js → registry-4fuZuCKy.js} +1425 -1299
- package/dist-lib/stores/page-state.d.ts +1 -1
- package/dist-lib/stores/preferences.d.ts +37 -0
- package/dist-lib/testing.js +25 -25
- package/dist-lib/types/api.d.ts +96 -16
- package/dist-lib/types/schema.d.ts +15 -0
- package/dist-lib/{useProperties-CgRhBh0k.js → useProperties-CT45yZHW.js} +41 -41
- package/dist-lib/{value-GmL5BVFm.js → value-BBnVc95O.js} +97 -97
- package/dist-lib/vite/fingerprint-plugin.d.ts +1 -1
- package/package.json +17 -16
- package/dist-lib/stores/appearance.d.ts +0 -37
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
|
|
2
|
-
import {
|
|
3
|
-
import { E as j, J as M, K as ee,
|
|
2
|
+
import { En as n, F as r, Hn as i, I as a, Ln as o, Qt as s, Un as c, V as l, Wn as u, an as d, cn as f, f as p, h as m, in as h, jn as g, kt as _, ln as v, m as y, mn as b, nt as x, p as S, pn as C, pt as w, rn as T, rt as E, sn as D, tt as O, un as k, vn as A } from "./ActionRunner-BrXXs8ga.js";
|
|
3
|
+
import { E as j, J as M, K as ee, St as N, T as P, Y as F, d as I, et as L, k as R, o as z, pt as B, q as V, r as te, t as ne, tt as re, u as ie, xt as ae } from "./registry-4fuZuCKy.js";
|
|
4
4
|
import { n as oe, r as se, t as ce } from "./dataTableStyles-vwD1mVOP.js";
|
|
5
5
|
import { Suspense as le, createContext as ue, lazy as H, useCallback as U, useContext as de, useEffect as W, useId as fe, useLayoutEffect as pe, useMemo as G, useRef as K, useState as q } from "react";
|
|
6
6
|
import { useInfiniteQuery as me, useMutation as he, useQueryClient as ge } from "@tanstack/react-query";
|
|
@@ -123,13 +123,13 @@ function Ce(e) {
|
|
|
123
123
|
function Z(e, t) {
|
|
124
124
|
let n = Ce(e);
|
|
125
125
|
if (n) {
|
|
126
|
-
if (e.label) return
|
|
126
|
+
if (e.label) return f(e.label);
|
|
127
127
|
let r = t.entity.children?.find((e) => e.entity === n);
|
|
128
|
-
if (r?.display?.name) return
|
|
128
|
+
if (r?.display?.name) return f(r.display.name);
|
|
129
129
|
let i = t.schema.entities[n];
|
|
130
|
-
return i && (
|
|
130
|
+
return i && (f(i.display.name_plural) || f(i.display.name)) || n;
|
|
131
131
|
}
|
|
132
|
-
return e.section ?
|
|
132
|
+
return e.section ? f(e.section.name) : "Tab";
|
|
133
133
|
}
|
|
134
134
|
function we(e, t) {
|
|
135
135
|
if (e.icon) return e.icon;
|
|
@@ -144,9 +144,9 @@ function we(e, t) {
|
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/components/detail-layout/LayoutTabs.tsx
|
|
146
146
|
function Te({ config: e, ctx: n }) {
|
|
147
|
-
let { items: r } = e, [i, a] = q(0),
|
|
147
|
+
let { items: r } = e, [i, a] = q(0), s = o(), c = n.detailTabsPresentation ?? (s.isPhone ? "sections" : "scroll");
|
|
148
148
|
if (r.length === 0) return null;
|
|
149
|
-
if (
|
|
149
|
+
if (c === "sections") {
|
|
150
150
|
let e = r.map((e, t) => `detail-tab-section-${t}`);
|
|
151
151
|
return /* @__PURE__ */ X("div", {
|
|
152
152
|
style: {
|
|
@@ -338,16 +338,16 @@ function Ee({ config: e, ctx: n }) {
|
|
|
338
338
|
}, d = s ? /* @__PURE__ */ Y(t, {
|
|
339
339
|
name: s,
|
|
340
340
|
size: 14
|
|
341
|
-
}) : void 0,
|
|
342
|
-
text:
|
|
341
|
+
}) : void 0, p = c ? {
|
|
342
|
+
text: f(c.text),
|
|
343
343
|
tone: c.tone,
|
|
344
344
|
dot: c.dot
|
|
345
345
|
} : void 0;
|
|
346
|
-
return /* @__PURE__ */ Y(
|
|
347
|
-
title:
|
|
346
|
+
return /* @__PURE__ */ Y(N, {
|
|
347
|
+
title: f(r),
|
|
348
348
|
defaultOpen: !a,
|
|
349
349
|
icon: d,
|
|
350
|
-
badge:
|
|
350
|
+
badge: p,
|
|
351
351
|
emphasis: l,
|
|
352
352
|
headingLevel: n.withinCard ? 3 : 2,
|
|
353
353
|
children: /* @__PURE__ */ Y(Kt, {
|
|
@@ -383,7 +383,7 @@ function Q(e, t, n) {
|
|
|
383
383
|
return e ?? t ?? n;
|
|
384
384
|
}
|
|
385
385
|
function Oe(e) {
|
|
386
|
-
return
|
|
386
|
+
return T(e, "update") ? "inline_edit" : "readonly";
|
|
387
387
|
}
|
|
388
388
|
function ke(e) {
|
|
389
389
|
return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
|
|
@@ -459,7 +459,7 @@ function Le(e, ...t) {
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
function Re(e) {
|
|
462
|
-
let t =
|
|
462
|
+
let t = D(e);
|
|
463
463
|
return t.length > 0 ? t[0] : void 0;
|
|
464
464
|
}
|
|
465
465
|
function ze(e, t) {
|
|
@@ -473,7 +473,7 @@ function Be(e, t, n, r) {
|
|
|
473
473
|
...e
|
|
474
474
|
};
|
|
475
475
|
if (Array.isArray(n)) {
|
|
476
|
-
let e = Array.isArray(r) ? r.map(String) :
|
|
476
|
+
let e = Array.isArray(r) ? r.map(String) : k(String(r), n.length);
|
|
477
477
|
if (!e || e.length !== n.length) throw Error("invalid composite parent id");
|
|
478
478
|
for (let t = 0; t < n.length; t++) i[n[t]] = e[t];
|
|
479
479
|
} else i[n] = Array.isArray(r) ? r[0] : r;
|
|
@@ -488,10 +488,10 @@ function Ve(e, t) {
|
|
|
488
488
|
}
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/components/detail-layout/useQuickAdd.ts
|
|
491
|
-
function He(e, t, n,
|
|
491
|
+
function He(e, t, n, i) {
|
|
492
492
|
let [a, o] = q(() => {
|
|
493
|
-
let t = e.quick_add, n =
|
|
494
|
-
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (a[e] =
|
|
493
|
+
let t = e.quick_add, n = i.entities[e.entity], a = {};
|
|
494
|
+
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (a[e] = r()) : a[e] = t.defaults[e];
|
|
495
495
|
return a;
|
|
496
496
|
}), s = ge(), { mutate: c, isPending: l, error: u, reset: d } = he({
|
|
497
497
|
mutationFn: (t) => O(e.entity, t),
|
|
@@ -499,7 +499,7 @@ function He(e, t, n, r) {
|
|
|
499
499
|
let i = [
|
|
500
500
|
M,
|
|
501
501
|
t,
|
|
502
|
-
Array.isArray(n) ?
|
|
502
|
+
Array.isArray(n) ? v(n.map(String)) : n,
|
|
503
503
|
e.entity
|
|
504
504
|
];
|
|
505
505
|
await s.cancelQueries({ queryKey: i });
|
|
@@ -527,12 +527,12 @@ function He(e, t, n, r) {
|
|
|
527
527
|
if (n?.snapshots) for (let [e, t] of n.snapshots) s.setQueryData(e, t);
|
|
528
528
|
},
|
|
529
529
|
onSuccess: () => {
|
|
530
|
-
let t = e.quick_add, n =
|
|
531
|
-
if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? a[e] =
|
|
530
|
+
let t = e.quick_add, n = i.entities[e.entity], a = {};
|
|
531
|
+
if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? a[e] = r() : a[e] = "" : a[e] = t.defaults[e];
|
|
532
532
|
o(a);
|
|
533
533
|
},
|
|
534
534
|
onSettled: () => {
|
|
535
|
-
let r = Array.isArray(n) ?
|
|
535
|
+
let r = Array.isArray(n) ? v(n.map(String)) : n;
|
|
536
536
|
s.invalidateQueries({ queryKey: [
|
|
537
537
|
M,
|
|
538
538
|
t,
|
|
@@ -540,9 +540,11 @@ function He(e, t, n, r) {
|
|
|
540
540
|
e.entity
|
|
541
541
|
] });
|
|
542
542
|
}
|
|
543
|
-
}), f = e.quick_add, p =
|
|
543
|
+
}), f = e.quick_add, p = i.entities[e.entity], m = Ve(a, f?.fields.filter((e) => p?.fields.get(e)?.required) ?? []);
|
|
544
544
|
function h(t) {
|
|
545
|
-
t.preventDefault(), f
|
|
545
|
+
if (t.preventDefault(), !f) return;
|
|
546
|
+
let r = Be(a, f.defaults, e.foreign_key, n);
|
|
547
|
+
c(r);
|
|
546
548
|
}
|
|
547
549
|
function g(e, t) {
|
|
548
550
|
u && d(), o((n) => ({
|
|
@@ -564,12 +566,12 @@ function He(e, t, n, r) {
|
|
|
564
566
|
//#endregion
|
|
565
567
|
//#region src/components/detail-layout/QuickAddForm.tsx
|
|
566
568
|
function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
567
|
-
let { values:
|
|
568
|
-
return !s || s.fields.length === 0 || !
|
|
569
|
-
onSubmit:
|
|
569
|
+
let { values: a, quickAdd: s, childEntity: c, isPending: l, error: f, isReady: p, handleSubmit: m, handleFieldChange: h } = He(t, n, r, i), g = S(), _ = o(), v = fe();
|
|
570
|
+
return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ X("form", {
|
|
571
|
+
onSubmit: m,
|
|
570
572
|
style: {
|
|
571
573
|
display: "flex",
|
|
572
|
-
flexDirection:
|
|
574
|
+
flexDirection: _.isPhone ? "column" : "row",
|
|
573
575
|
alignItems: "flex-end",
|
|
574
576
|
gap: 8,
|
|
575
577
|
padding: "8px 0",
|
|
@@ -577,17 +579,17 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
577
579
|
},
|
|
578
580
|
children: [
|
|
579
581
|
s.fields.map((e) => {
|
|
580
|
-
let n =
|
|
582
|
+
let n = c.fields.get(e);
|
|
581
583
|
if (!n) return null;
|
|
582
|
-
let r = `${
|
|
584
|
+
let r = `${v}-quick-add-${t.entity}-${e}`, o = `${r}-label`;
|
|
583
585
|
return /* @__PURE__ */ X("div", {
|
|
584
586
|
style: {
|
|
585
587
|
flex: 1,
|
|
586
588
|
minWidth: 0,
|
|
587
|
-
width:
|
|
589
|
+
width: _.isPhone ? "100%" : void 0
|
|
588
590
|
},
|
|
589
591
|
children: [/* @__PURE__ */ Y("label", {
|
|
590
|
-
id:
|
|
592
|
+
id: o,
|
|
591
593
|
htmlFor: r,
|
|
592
594
|
style: {
|
|
593
595
|
fontSize: 11,
|
|
@@ -596,71 +598,71 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
596
598
|
display: "block",
|
|
597
599
|
fontWeight: 500
|
|
598
600
|
},
|
|
599
|
-
children:
|
|
600
|
-
}),
|
|
601
|
+
children: d(n, e, i.entities)
|
|
602
|
+
}), y({
|
|
601
603
|
field: n,
|
|
602
604
|
fieldName: e,
|
|
603
|
-
value:
|
|
605
|
+
value: a[e] ?? "",
|
|
604
606
|
mode: "edit",
|
|
605
|
-
onChange: (t) =>
|
|
606
|
-
record:
|
|
607
|
+
onChange: (t) => h(e, t),
|
|
608
|
+
record: a,
|
|
607
609
|
fieldId: r,
|
|
608
|
-
labelId:
|
|
609
|
-
locale:
|
|
610
|
+
labelId: o,
|
|
611
|
+
locale: g
|
|
610
612
|
})]
|
|
611
613
|
}, e);
|
|
612
614
|
}),
|
|
613
|
-
/* @__PURE__ */ Y(
|
|
615
|
+
/* @__PURE__ */ Y(u, {
|
|
614
616
|
type: "submit",
|
|
615
617
|
kind: "primary",
|
|
616
|
-
size:
|
|
618
|
+
size: _.isPhone ? "md" : "sm",
|
|
617
619
|
icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
|
|
618
|
-
disabled:
|
|
619
|
-
style:
|
|
620
|
+
disabled: l || !p,
|
|
621
|
+
style: _.isPhone ? { alignSelf: "flex-end" } : void 0,
|
|
620
622
|
children: "Add"
|
|
621
623
|
}),
|
|
622
|
-
|
|
624
|
+
f != null && /* @__PURE__ */ Y("span", {
|
|
623
625
|
style: {
|
|
624
626
|
fontSize: 11,
|
|
625
627
|
color: "var(--danger)",
|
|
626
628
|
alignSelf: "flex-end",
|
|
627
629
|
marginBottom: 4
|
|
628
630
|
},
|
|
629
|
-
children:
|
|
631
|
+
children: f.message
|
|
630
632
|
})
|
|
631
633
|
]
|
|
632
634
|
});
|
|
633
635
|
}
|
|
634
636
|
//#endregion
|
|
635
637
|
//#region src/components/detail-layout/ChildrenTable.tsx
|
|
636
|
-
function We({ config: t, parentEntity: n, parentId: r, schema:
|
|
637
|
-
let
|
|
638
|
-
|
|
639
|
-
let
|
|
638
|
+
function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
639
|
+
let o = a.entities[t.entity], s = S(), l = V((e) => e.degradedEntities), { data: u, isLoading: f, isError: p, isFetching: h, refetch: _ } = F(n, r, t.entity, t.foreign_key, t.sort, t.limit), v = u?.data ?? [], y = u?.$refs, x = K(y);
|
|
640
|
+
x.current = y;
|
|
641
|
+
let C = t.columns, w = t.interaction === "navigate", T = C[0], E = w && o ? b(void 0, o, a.screens) : null, D = o ? Re(o) : void 0, O = G(() => {
|
|
640
642
|
let e = /* @__PURE__ */ new Map();
|
|
641
|
-
if (!
|
|
642
|
-
for (let t of
|
|
643
|
-
let n =
|
|
644
|
-
n && e.set(t,
|
|
643
|
+
if (!o) return e;
|
|
644
|
+
for (let t of C) {
|
|
645
|
+
let n = o.fields.get(t);
|
|
646
|
+
n && e.set(t, m({
|
|
645
647
|
field: n,
|
|
646
648
|
fieldName: t,
|
|
647
649
|
surface: "list",
|
|
648
|
-
entity:
|
|
649
|
-
entities:
|
|
650
|
-
screens:
|
|
651
|
-
refs: () =>
|
|
652
|
-
locale:
|
|
650
|
+
entity: o,
|
|
651
|
+
entities: a.entities,
|
|
652
|
+
screens: a.screens,
|
|
653
|
+
refs: () => x.current,
|
|
654
|
+
locale: s
|
|
653
655
|
}));
|
|
654
656
|
}
|
|
655
657
|
return e;
|
|
656
658
|
}, [
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
659
|
+
o,
|
|
660
|
+
C,
|
|
661
|
+
a.entities,
|
|
662
|
+
a.screens,
|
|
663
|
+
s
|
|
662
664
|
]);
|
|
663
|
-
if (!
|
|
665
|
+
if (!o) return /* @__PURE__ */ Y("div", {
|
|
664
666
|
style: {
|
|
665
667
|
fontSize: 12.5,
|
|
666
668
|
color: "var(--text-3)",
|
|
@@ -672,7 +674,7 @@ function We({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
672
674
|
config: t,
|
|
673
675
|
parentEntity: n,
|
|
674
676
|
parentId: r,
|
|
675
|
-
schema:
|
|
677
|
+
schema: a
|
|
676
678
|
}), j = /* @__PURE__ */ X("div", {
|
|
677
679
|
style: {
|
|
678
680
|
display: "flex",
|
|
@@ -681,26 +683,26 @@ function We({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
681
683
|
padding: "4px 0",
|
|
682
684
|
justifyContent: "flex-end"
|
|
683
685
|
},
|
|
684
|
-
children: [ee(
|
|
686
|
+
children: [ee(o.realtime, l, t.entity) && /* @__PURE__ */ Y("span", {
|
|
685
687
|
"data-testid": "children-live-indicator",
|
|
686
688
|
title: "This table updates automatically in realtime.",
|
|
687
|
-
children: /* @__PURE__ */ Y(
|
|
689
|
+
children: /* @__PURE__ */ Y(i, {
|
|
688
690
|
tone: "emerald",
|
|
689
691
|
size: "xs",
|
|
690
692
|
dot: !0,
|
|
691
693
|
children: "Live"
|
|
692
694
|
})
|
|
693
|
-
}), /* @__PURE__ */ Y(
|
|
694
|
-
icon:
|
|
695
|
+
}), /* @__PURE__ */ Y(c, {
|
|
696
|
+
icon: h ? /* @__PURE__ */ Y("span", {
|
|
695
697
|
"data-testid": "children-refresh-spinner",
|
|
696
698
|
style: { display: "inline-flex" },
|
|
697
|
-
children: /* @__PURE__ */ Y(
|
|
699
|
+
children: /* @__PURE__ */ Y(g, { size: 13 })
|
|
698
700
|
}) : /* @__PURE__ */ Y(e.refresh, { size: 13 }),
|
|
699
701
|
title: "Refresh",
|
|
700
702
|
size: 24,
|
|
701
|
-
disabled:
|
|
703
|
+
disabled: h,
|
|
702
704
|
onClick: () => {
|
|
703
|
-
|
|
705
|
+
_();
|
|
704
706
|
}
|
|
705
707
|
})]
|
|
706
708
|
});
|
|
@@ -735,7 +737,7 @@ function We({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
735
737
|
borderRadius: 4
|
|
736
738
|
} }, e))
|
|
737
739
|
})
|
|
738
|
-
] }) :
|
|
740
|
+
] }) : v.length === 0 ? /* @__PURE__ */ X("div", { children: [
|
|
739
741
|
k,
|
|
740
742
|
j,
|
|
741
743
|
/* @__PURE__ */ Y("div", {
|
|
@@ -753,16 +755,16 @@ function We({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
753
755
|
style: { overflowX: "auto" },
|
|
754
756
|
children: /* @__PURE__ */ X("table", {
|
|
755
757
|
style: se,
|
|
756
|
-
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children:
|
|
757
|
-
let t =
|
|
758
|
+
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: C.map((e) => {
|
|
759
|
+
let t = o.fields.get(e);
|
|
758
760
|
return /* @__PURE__ */ Y("th", {
|
|
759
761
|
style: oe,
|
|
760
|
-
children: t ?
|
|
762
|
+
children: t ? d(t, e, a.entities) : e
|
|
761
763
|
}, e);
|
|
762
|
-
}) }) }), /* @__PURE__ */ Y("tbody", { children:
|
|
763
|
-
let n =
|
|
764
|
-
return /* @__PURE__ */ Y("tr", { children:
|
|
765
|
-
let n = t ===
|
|
764
|
+
}) }) }), /* @__PURE__ */ Y("tbody", { children: v.map((e, t) => {
|
|
765
|
+
let n = D ? A(e[D]) : "", r = w && E && n ? E.replace(/:\w+/, n) : void 0;
|
|
766
|
+
return /* @__PURE__ */ Y("tr", { children: C.map((t) => {
|
|
767
|
+
let n = t === T, i = O.get(t), a = i ? i(e[t], e) : A(e[t]);
|
|
766
768
|
return /* @__PURE__ */ Y("td", {
|
|
767
769
|
title: typeof a == "string" ? a : void 0,
|
|
768
770
|
style: ce,
|
|
@@ -786,9 +788,9 @@ function We({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
786
788
|
}
|
|
787
789
|
//#endregion
|
|
788
790
|
//#region src/components/detail-layout/ChildrenList.tsx
|
|
789
|
-
function Ge({ config: e, parentEntity: t, parentId:
|
|
790
|
-
let
|
|
791
|
-
if (!
|
|
791
|
+
function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
792
|
+
let i = r.entities[e.entity], a = S(), { data: o, isLoading: c, isError: l } = F(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = o?.data ?? [], d = o?.$refs, f = e.columns;
|
|
793
|
+
if (!i) return /* @__PURE__ */ Y("div", {
|
|
792
794
|
style: {
|
|
793
795
|
fontSize: 12.5,
|
|
794
796
|
color: "var(--text-3)",
|
|
@@ -799,8 +801,8 @@ function Ge({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
799
801
|
let p = /* @__PURE__ */ Y(Ue, {
|
|
800
802
|
config: e,
|
|
801
803
|
parentEntity: t,
|
|
802
|
-
parentId:
|
|
803
|
-
schema:
|
|
804
|
+
parentId: n,
|
|
805
|
+
schema: r
|
|
804
806
|
});
|
|
805
807
|
if (l) return /* @__PURE__ */ X("div", { children: [p, /* @__PURE__ */ Y("div", {
|
|
806
808
|
style: {
|
|
@@ -844,7 +846,7 @@ function Ge({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
844
846
|
},
|
|
845
847
|
children: "No records yet."
|
|
846
848
|
})] });
|
|
847
|
-
let m = f.length > 0 ?
|
|
849
|
+
let m = f.length > 0 ? i.display.display_field ?? f[0] : i.display.display_field;
|
|
848
850
|
return /* @__PURE__ */ X("div", { children: [p, /* @__PURE__ */ Y("div", {
|
|
849
851
|
style: {
|
|
850
852
|
display: "flex",
|
|
@@ -870,14 +872,14 @@ function Ge({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
870
872
|
textOverflow: "ellipsis",
|
|
871
873
|
whiteSpace: "nowrap"
|
|
872
874
|
},
|
|
873
|
-
children: (typeof e.$display == "string" ? e[
|
|
874
|
-
field:
|
|
875
|
+
children: (typeof e.$display == "string" ? e[s] : "") || (m && i.fields.get(m) ? y({
|
|
876
|
+
field: i.fields.get(m),
|
|
875
877
|
fieldName: m,
|
|
876
878
|
value: e[m],
|
|
877
879
|
mode: "display",
|
|
878
880
|
record: e,
|
|
879
881
|
refs: d,
|
|
880
|
-
locale:
|
|
882
|
+
locale: a
|
|
881
883
|
}) : m && e[m] != null ? A(e[m]) : null)
|
|
882
884
|
}), f.length > 1 && (() => {
|
|
883
885
|
let t = f.slice(1, 3).filter((t) => e[t] != null);
|
|
@@ -889,14 +891,14 @@ function Ge({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
889
891
|
textOverflow: "ellipsis",
|
|
890
892
|
whiteSpace: "nowrap"
|
|
891
893
|
},
|
|
892
|
-
children: t.map((t, n) => /* @__PURE__ */ X("span", { children: [n > 0 && " · ",
|
|
893
|
-
field:
|
|
894
|
+
children: t.map((t, n) => /* @__PURE__ */ X("span", { children: [n > 0 && " · ", i.fields.get(t) ? y({
|
|
895
|
+
field: i.fields.get(t),
|
|
894
896
|
fieldName: t,
|
|
895
897
|
value: e[t],
|
|
896
898
|
mode: "display",
|
|
897
899
|
record: e,
|
|
898
900
|
refs: d,
|
|
899
|
-
locale:
|
|
901
|
+
locale: a
|
|
900
902
|
}) : String(e[t])] }, t))
|
|
901
903
|
});
|
|
902
904
|
})()]
|
|
@@ -907,8 +909,8 @@ function Ge({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
907
909
|
//#endregion
|
|
908
910
|
//#region src/components/detail-layout/ChildrenCards.tsx
|
|
909
911
|
function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
910
|
-
let
|
|
911
|
-
if (!
|
|
912
|
+
let a = r.entities[e.entity], o = S(), { data: s, isLoading: c, isError: l } = F(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], d = s?.$refs, f = e.columns, p = e.cards, m = p?.header_field ?? f[0], h = p?.badge_field, g = p?.columns_count ?? 3;
|
|
913
|
+
if (!a) return /* @__PURE__ */ Y("div", {
|
|
912
914
|
style: {
|
|
913
915
|
fontSize: 12.5,
|
|
914
916
|
color: "var(--text-3)",
|
|
@@ -926,7 +928,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
926
928
|
parentId: n,
|
|
927
929
|
schema: r
|
|
928
930
|
});
|
|
929
|
-
if (
|
|
931
|
+
if (l) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
930
932
|
style: {
|
|
931
933
|
fontSize: 12.5,
|
|
932
934
|
color: "var(--danger)",
|
|
@@ -934,7 +936,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
934
936
|
},
|
|
935
937
|
children: "Failed to load. Try again."
|
|
936
938
|
})] });
|
|
937
|
-
if (
|
|
939
|
+
if (c) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
938
940
|
style: _,
|
|
939
941
|
children: [
|
|
940
942
|
0,
|
|
@@ -954,7 +956,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
954
956
|
},
|
|
955
957
|
children: "No records yet."
|
|
956
958
|
})] });
|
|
957
|
-
let
|
|
959
|
+
let b = f.filter((e) => e !== m && e !== h);
|
|
958
960
|
return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
959
961
|
style: _,
|
|
960
962
|
children: u.map((t, n) => /* @__PURE__ */ X("div", {
|
|
@@ -971,7 +973,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
971
973
|
alignItems: "center",
|
|
972
974
|
justifyContent: "space-between",
|
|
973
975
|
gap: 8,
|
|
974
|
-
borderBottom:
|
|
976
|
+
borderBottom: b.length > 0 ? "1px solid var(--divider)" : "none"
|
|
975
977
|
},
|
|
976
978
|
children: [/* @__PURE__ */ Y("div", {
|
|
977
979
|
style: {
|
|
@@ -981,38 +983,38 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
981
983
|
textOverflow: "ellipsis",
|
|
982
984
|
whiteSpace: "nowrap"
|
|
983
985
|
},
|
|
984
|
-
children: m &&
|
|
985
|
-
field:
|
|
986
|
+
children: m && a.fields.get(m) ? y({
|
|
987
|
+
field: a.fields.get(m),
|
|
986
988
|
fieldName: m,
|
|
987
989
|
value: t[m],
|
|
988
990
|
mode: "display",
|
|
989
991
|
record: t,
|
|
990
992
|
refs: d,
|
|
991
|
-
locale:
|
|
993
|
+
locale: o
|
|
992
994
|
}) : `Record ${n + 1}`
|
|
993
|
-
}), h && t[h] != null && /* @__PURE__ */ Y(
|
|
995
|
+
}), h && t[h] != null && /* @__PURE__ */ Y(i, {
|
|
994
996
|
tone: "slate",
|
|
995
997
|
size: "xs",
|
|
996
|
-
children:
|
|
997
|
-
field:
|
|
998
|
+
children: a.fields.get(h) ? y({
|
|
999
|
+
field: a.fields.get(h),
|
|
998
1000
|
fieldName: h,
|
|
999
1001
|
value: t[h],
|
|
1000
1002
|
mode: "display",
|
|
1001
1003
|
record: t,
|
|
1002
1004
|
refs: d,
|
|
1003
|
-
locale:
|
|
1005
|
+
locale: o
|
|
1004
1006
|
}) : A(t[h])
|
|
1005
1007
|
})]
|
|
1006
|
-
}),
|
|
1008
|
+
}), b.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1007
1009
|
style: {
|
|
1008
1010
|
padding: "10px 14px",
|
|
1009
1011
|
display: "flex",
|
|
1010
1012
|
flexDirection: "column",
|
|
1011
1013
|
gap: 4
|
|
1012
1014
|
},
|
|
1013
|
-
children:
|
|
1014
|
-
let
|
|
1015
|
-
return
|
|
1015
|
+
children: b.slice(0, 4).map((n) => {
|
|
1016
|
+
let i = a.fields.get(n);
|
|
1017
|
+
return i ? /* @__PURE__ */ X("div", {
|
|
1016
1018
|
style: {
|
|
1017
1019
|
display: "flex",
|
|
1018
1020
|
alignItems: "baseline",
|
|
@@ -1031,14 +1033,14 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1031
1033
|
textOverflow: "ellipsis",
|
|
1032
1034
|
whiteSpace: "nowrap"
|
|
1033
1035
|
},
|
|
1034
|
-
children:
|
|
1035
|
-
field:
|
|
1036
|
+
children: y({
|
|
1037
|
+
field: i,
|
|
1036
1038
|
fieldName: n,
|
|
1037
1039
|
value: t[n],
|
|
1038
1040
|
mode: "display",
|
|
1039
1041
|
record: t,
|
|
1040
1042
|
refs: d,
|
|
1041
|
-
locale:
|
|
1043
|
+
locale: o
|
|
1042
1044
|
})
|
|
1043
1045
|
})]
|
|
1044
1046
|
}, n) : null;
|
|
@@ -1051,7 +1053,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1051
1053
|
//#region src/hooks/useTimelineData.ts
|
|
1052
1054
|
var qe = 50;
|
|
1053
1055
|
function Je(e, t, n, r, i, a) {
|
|
1054
|
-
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ?
|
|
1056
|
+
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? k(t, o.length) : [t], c = a ?? qe, l = me({
|
|
1055
1057
|
queryKey: [
|
|
1056
1058
|
M,
|
|
1057
1059
|
e,
|
|
@@ -1069,7 +1071,7 @@ function Je(e, t, n, r, i, a) {
|
|
|
1069
1071
|
op: "eq",
|
|
1070
1072
|
value: s[t]
|
|
1071
1073
|
}));
|
|
1072
|
-
return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(c)), e && t.set("after", e),
|
|
1074
|
+
return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(c)), e && t.set("after", e), _(`/api/data/${n}?${t.toString()}`);
|
|
1073
1075
|
},
|
|
1074
1076
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
1075
1077
|
initialPageParam: void 0,
|
|
@@ -1089,85 +1091,85 @@ function Je(e, t, n, r, i, a) {
|
|
|
1089
1091
|
//#region src/components/detail-layout/TimelineComposer.tsx
|
|
1090
1092
|
var Ye = "quick_entry", Xe = 100, Ze = 240, Qe = 800, $e = 80;
|
|
1091
1093
|
function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
1092
|
-
let { values:
|
|
1094
|
+
let { values: a, quickAdd: o, childEntity: s, isPending: c, error: l, isReady: d, handleSubmit: f, handleFieldChange: m } = He(t, n, r, i), h = S(), [g, _] = q(Ze), v = K(null), b = K(null), [x, C] = q(Qe);
|
|
1093
1095
|
W(() => {
|
|
1094
|
-
let e =
|
|
1096
|
+
let e = b.current?.parentElement;
|
|
1095
1097
|
if (!e) return;
|
|
1096
1098
|
let t = () => {
|
|
1097
1099
|
let t = Math.max(Xe, e.clientHeight - $e);
|
|
1098
|
-
|
|
1100
|
+
C(Math.min(Qe, t));
|
|
1099
1101
|
};
|
|
1100
1102
|
t();
|
|
1101
1103
|
let n = new ResizeObserver(t);
|
|
1102
1104
|
return n.observe(e), () => n.disconnect();
|
|
1103
1105
|
}, []), W(() => {
|
|
1104
|
-
_((e) => Math.min(e,
|
|
1105
|
-
}, [
|
|
1106
|
-
let
|
|
1107
|
-
|
|
1108
|
-
let
|
|
1109
|
-
|
|
1110
|
-
let
|
|
1111
|
-
getField: (e) =>
|
|
1106
|
+
_((e) => Math.min(e, x));
|
|
1107
|
+
}, [x]);
|
|
1108
|
+
let w = K(a);
|
|
1109
|
+
w.current = a;
|
|
1110
|
+
let T = K(m);
|
|
1111
|
+
T.current = m;
|
|
1112
|
+
let E = K({}), D = G(() => ({
|
|
1113
|
+
getField: (e) => w.current[e],
|
|
1112
1114
|
setField: (e, t) => {
|
|
1113
|
-
|
|
1115
|
+
T.current(e, t);
|
|
1114
1116
|
},
|
|
1115
1117
|
focusField: (e) => {
|
|
1116
|
-
let t =
|
|
1118
|
+
let t = E.current[e];
|
|
1117
1119
|
t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
|
|
1118
1120
|
}
|
|
1119
1121
|
}), []);
|
|
1120
|
-
W(() =>
|
|
1122
|
+
W(() => p(Ye, D), [D]);
|
|
1121
1123
|
let O = U((e) => {
|
|
1122
1124
|
e.preventDefault(), v.current = {
|
|
1123
1125
|
startY: e.clientY,
|
|
1124
|
-
startHeight:
|
|
1126
|
+
startHeight: g
|
|
1125
1127
|
};
|
|
1126
1128
|
let t = (e) => {
|
|
1127
1129
|
if (!v.current) return;
|
|
1128
|
-
let t = v.current.startY - e.clientY;
|
|
1129
|
-
_(
|
|
1130
|
+
let t = v.current.startY - e.clientY, n = Math.min(x, Math.max(Xe, v.current.startHeight + t));
|
|
1131
|
+
_(n);
|
|
1130
1132
|
}, n = () => {
|
|
1131
1133
|
v.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
1132
1134
|
};
|
|
1133
1135
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
1134
|
-
}, [
|
|
1135
|
-
if (!
|
|
1136
|
-
let k =
|
|
1137
|
-
let t =
|
|
1136
|
+
}, [g, x]);
|
|
1137
|
+
if (!o || o.fields.length === 0 || !s) return null;
|
|
1138
|
+
let k = o.fields.find((e) => {
|
|
1139
|
+
let t = s.fields.get(e);
|
|
1138
1140
|
return t && (t.type === "text" || t.type === "string");
|
|
1139
1141
|
}), A = [], j = [];
|
|
1140
|
-
for (let e of
|
|
1142
|
+
for (let e of o.fields) {
|
|
1141
1143
|
if (e === k) continue;
|
|
1142
|
-
let t =
|
|
1144
|
+
let t = s.fields.get(e);
|
|
1143
1145
|
t && (t.type === "enum" ? A.push(e) : j.push(e));
|
|
1144
1146
|
}
|
|
1145
1147
|
let M = (e) => {
|
|
1146
|
-
let t =
|
|
1148
|
+
let t = s.fields.get(e);
|
|
1147
1149
|
return t ? /* @__PURE__ */ Y("div", {
|
|
1148
1150
|
ref: (t) => {
|
|
1149
|
-
|
|
1151
|
+
E.current[e] = t;
|
|
1150
1152
|
},
|
|
1151
|
-
children:
|
|
1153
|
+
children: y({
|
|
1152
1154
|
field: t,
|
|
1153
1155
|
fieldName: e,
|
|
1154
|
-
value:
|
|
1156
|
+
value: a[e] ?? "",
|
|
1155
1157
|
mode: "edit",
|
|
1156
|
-
onChange: (t) =>
|
|
1157
|
-
record:
|
|
1158
|
-
locale:
|
|
1158
|
+
onChange: (t) => m(e, t),
|
|
1159
|
+
record: a,
|
|
1160
|
+
locale: h
|
|
1159
1161
|
})
|
|
1160
1162
|
}, e) : null;
|
|
1161
1163
|
};
|
|
1162
1164
|
return /* @__PURE__ */ X("div", {
|
|
1163
|
-
ref:
|
|
1165
|
+
ref: b,
|
|
1164
1166
|
style: {
|
|
1165
1167
|
flexShrink: 0,
|
|
1166
1168
|
borderTop: "1px solid var(--divider)",
|
|
1167
1169
|
background: "var(--surface)",
|
|
1168
1170
|
display: "flex",
|
|
1169
1171
|
flexDirection: "column",
|
|
1170
|
-
height: `${
|
|
1172
|
+
height: `${g}px`
|
|
1171
1173
|
},
|
|
1172
1174
|
children: [/* @__PURE__ */ Y("div", {
|
|
1173
1175
|
onMouseDown: O,
|
|
@@ -1210,24 +1212,24 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1210
1212
|
},
|
|
1211
1213
|
children: A.map(M)
|
|
1212
1214
|
}),
|
|
1213
|
-
k &&
|
|
1215
|
+
k && s.fields.get(k) && /* @__PURE__ */ Y("div", {
|
|
1214
1216
|
style: {
|
|
1215
1217
|
flex: 1,
|
|
1216
1218
|
minHeight: 0,
|
|
1217
1219
|
display: "flex"
|
|
1218
1220
|
},
|
|
1219
1221
|
ref: (e) => {
|
|
1220
|
-
|
|
1222
|
+
E.current[k] = e;
|
|
1221
1223
|
},
|
|
1222
|
-
children:
|
|
1223
|
-
field:
|
|
1224
|
+
children: y({
|
|
1225
|
+
field: s.fields.get(k),
|
|
1224
1226
|
fieldName: k,
|
|
1225
|
-
value:
|
|
1227
|
+
value: a[k] ?? "",
|
|
1226
1228
|
mode: "edit",
|
|
1227
|
-
onChange: (e) =>
|
|
1228
|
-
record:
|
|
1229
|
+
onChange: (e) => m(k, e),
|
|
1230
|
+
record: a,
|
|
1229
1231
|
fill: !0,
|
|
1230
|
-
locale:
|
|
1232
|
+
locale: h
|
|
1231
1233
|
})
|
|
1232
1234
|
}),
|
|
1233
1235
|
/* @__PURE__ */ X("div", {
|
|
@@ -1261,23 +1263,23 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1261
1263
|
}),
|
|
1262
1264
|
" to add"
|
|
1263
1265
|
]
|
|
1264
|
-
}), /* @__PURE__ */ Y(
|
|
1266
|
+
}), /* @__PURE__ */ Y(u, {
|
|
1265
1267
|
type: "submit",
|
|
1266
1268
|
kind: "primary",
|
|
1267
1269
|
icon: /* @__PURE__ */ Y(e.plus, { size: 13 }),
|
|
1268
|
-
disabled:
|
|
1270
|
+
disabled: c || !d,
|
|
1269
1271
|
children: "Add"
|
|
1270
1272
|
})]
|
|
1271
1273
|
})]
|
|
1272
1274
|
}),
|
|
1273
|
-
|
|
1275
|
+
l != null && /* @__PURE__ */ Y("p", {
|
|
1274
1276
|
style: {
|
|
1275
1277
|
fontSize: 11,
|
|
1276
1278
|
color: "var(--danger)",
|
|
1277
1279
|
margin: 0,
|
|
1278
1280
|
flexShrink: 0
|
|
1279
1281
|
},
|
|
1280
|
-
children:
|
|
1282
|
+
children: l.message
|
|
1281
1283
|
})
|
|
1282
1284
|
]
|
|
1283
1285
|
})]
|
|
@@ -1291,58 +1293,58 @@ function rt(e, t) {
|
|
|
1291
1293
|
let e = t.id;
|
|
1292
1294
|
return e == null ? "" : A(e);
|
|
1293
1295
|
}
|
|
1294
|
-
return
|
|
1296
|
+
return E(h(e, t));
|
|
1295
1297
|
}
|
|
1296
1298
|
function it(e) {
|
|
1297
1299
|
return e.__optimistic === !0;
|
|
1298
1300
|
}
|
|
1299
1301
|
function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1300
|
-
let i = r.entities[e.entity], { rows:
|
|
1302
|
+
let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: l, isLoading: d, isError: p } = Je(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), m = e.timeline, h = m?.scroll ?? !1, _ = (e.sort ?? "").endsWith(":asc"), v = G(() => _ ? [...a].reverse() : a, [a, _]), y = m?.auto_scroll ?? "none", b = K(null), x = K(null), S = K(!1), C = K(0), w = K(null), T = K(null), E = K(!0), D = K(null);
|
|
1301
1303
|
W(() => {
|
|
1302
|
-
|
|
1304
|
+
S.current = !1, C.current = 0, w.current = null, T.current = null, E.current = !0, D.current = null;
|
|
1303
1305
|
}, [n]), pe(() => {
|
|
1304
|
-
!
|
|
1305
|
-
scrollHeight:
|
|
1306
|
-
scrollTop:
|
|
1306
|
+
!l || !b.current || (D.current = {
|
|
1307
|
+
scrollHeight: b.current.scrollHeight,
|
|
1308
|
+
scrollTop: b.current.scrollTop
|
|
1307
1309
|
});
|
|
1308
|
-
}, [
|
|
1309
|
-
let e =
|
|
1310
|
-
if (!e ||
|
|
1311
|
-
|
|
1310
|
+
}, [l]), pe(() => {
|
|
1311
|
+
let e = b.current;
|
|
1312
|
+
if (!e || v.length === 0 || !i) {
|
|
1313
|
+
C.current = v.length;
|
|
1312
1314
|
return;
|
|
1313
1315
|
}
|
|
1314
|
-
let t = rt(i,
|
|
1315
|
-
if (r)
|
|
1316
|
+
let t = rt(i, v[0]), n = rt(i, v[v.length - 1]), r = !S.current, a = v.length > C.current && C.current > 0, o = a && (_ && t !== w.current && n === T.current || !_ && n !== T.current && t === w.current), s = a && !o;
|
|
1317
|
+
if (r) _ && y === "bottom" && (e.scrollTop = e.scrollHeight), S.current = !0;
|
|
1316
1318
|
else if (o && D.current) {
|
|
1317
1319
|
let t = D.current;
|
|
1318
|
-
|
|
1319
|
-
} else s &&
|
|
1320
|
-
|
|
1320
|
+
_ && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), D.current = null;
|
|
1321
|
+
} else s && _ && E.current && (e.scrollTop = e.scrollHeight);
|
|
1322
|
+
C.current = v.length, w.current = t, T.current = n;
|
|
1321
1323
|
}, [
|
|
1322
|
-
_,
|
|
1323
1324
|
v,
|
|
1324
|
-
|
|
1325
|
+
y,
|
|
1326
|
+
_,
|
|
1325
1327
|
i
|
|
1326
1328
|
]);
|
|
1327
1329
|
let O = U(() => {
|
|
1328
|
-
let e =
|
|
1330
|
+
let e = b.current;
|
|
1329
1331
|
e && (E.current = e.scrollHeight - e.scrollTop - e.clientHeight < tt);
|
|
1330
1332
|
}, []);
|
|
1331
1333
|
W(() => {
|
|
1332
|
-
let e =
|
|
1334
|
+
let e = x.current;
|
|
1333
1335
|
if (!e || typeof IntersectionObserver > "u") return;
|
|
1334
1336
|
let t = new IntersectionObserver((e) => {
|
|
1335
|
-
for (let t of e) t.isIntersecting &&
|
|
1337
|
+
for (let t of e) t.isIntersecting && c && !l && s();
|
|
1336
1338
|
}, {
|
|
1337
|
-
root:
|
|
1339
|
+
root: b.current ?? null,
|
|
1338
1340
|
rootMargin: `${nt}px 0px 0px 0px`,
|
|
1339
1341
|
threshold: 0
|
|
1340
1342
|
});
|
|
1341
1343
|
return t.observe(e), () => t.disconnect();
|
|
1342
1344
|
}, [
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1345
|
+
c,
|
|
1346
|
+
l,
|
|
1347
|
+
s
|
|
1346
1348
|
]);
|
|
1347
1349
|
let [k, A] = q(null);
|
|
1348
1350
|
if (!i) return /* @__PURE__ */ Y("div", {
|
|
@@ -1353,21 +1355,21 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1353
1355
|
},
|
|
1354
1356
|
children: "Entity not found."
|
|
1355
1357
|
});
|
|
1356
|
-
let j = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), M =
|
|
1358
|
+
let j = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), M = f(i.display?.name_plural) || f(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ Y("div", {
|
|
1357
1359
|
style: {
|
|
1358
1360
|
display: "flex",
|
|
1359
1361
|
justifyContent: "center",
|
|
1360
1362
|
padding: "6px 0"
|
|
1361
1363
|
},
|
|
1362
|
-
children: /* @__PURE__ */ Y(
|
|
1364
|
+
children: /* @__PURE__ */ Y(u, {
|
|
1363
1365
|
size: "xs",
|
|
1364
|
-
onClick: () =>
|
|
1365
|
-
disabled:
|
|
1366
|
-
icon:
|
|
1367
|
-
children:
|
|
1366
|
+
onClick: () => s(),
|
|
1367
|
+
disabled: l,
|
|
1368
|
+
icon: l ? /* @__PURE__ */ Y(g, { size: 11 }) : void 0,
|
|
1369
|
+
children: l ? "Loading…" : "Load older"
|
|
1368
1370
|
})
|
|
1369
1371
|
}) : null, N = /* @__PURE__ */ Y("div", {
|
|
1370
|
-
ref:
|
|
1372
|
+
ref: x,
|
|
1371
1373
|
"aria-hidden": "true",
|
|
1372
1374
|
style: { height: 1 }
|
|
1373
1375
|
}), P;
|
|
@@ -1379,7 +1381,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1379
1381
|
},
|
|
1380
1382
|
children: "Failed to load."
|
|
1381
1383
|
});
|
|
1382
|
-
else if (
|
|
1384
|
+
else if (d) P = /* @__PURE__ */ X("div", {
|
|
1383
1385
|
style: {
|
|
1384
1386
|
display: "flex",
|
|
1385
1387
|
flexDirection: "column",
|
|
@@ -1396,7 +1398,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1396
1398
|
borderRadius: 8
|
|
1397
1399
|
} })]
|
|
1398
1400
|
});
|
|
1399
|
-
else if (
|
|
1401
|
+
else if (v.length === 0) P = /* @__PURE__ */ X(J, { children: [N, /* @__PURE__ */ Y("div", {
|
|
1400
1402
|
style: {
|
|
1401
1403
|
fontSize: 12.5,
|
|
1402
1404
|
color: "var(--text-3)",
|
|
@@ -1405,30 +1407,30 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1405
1407
|
children: "No activity yet."
|
|
1406
1408
|
})] });
|
|
1407
1409
|
else {
|
|
1408
|
-
let a = (a,
|
|
1409
|
-
let
|
|
1410
|
+
let a = (a, s) => {
|
|
1411
|
+
let c = rt(i, a) || String(s);
|
|
1410
1412
|
return /* @__PURE__ */ Y(ot, {
|
|
1411
1413
|
row: a,
|
|
1412
|
-
rowId:
|
|
1414
|
+
rowId: c,
|
|
1413
1415
|
childEntity: i,
|
|
1414
1416
|
entityCode: e.entity,
|
|
1415
1417
|
parentEntity: t,
|
|
1416
1418
|
parentId: n,
|
|
1417
1419
|
timeline: m,
|
|
1418
1420
|
editableFields: j,
|
|
1419
|
-
refs:
|
|
1420
|
-
isEditing: k ===
|
|
1421
|
-
onStartEdit: () => A(
|
|
1421
|
+
refs: o,
|
|
1422
|
+
isEditing: k === c,
|
|
1423
|
+
onStartEdit: () => A(c),
|
|
1422
1424
|
onCancelEdit: () => A(null),
|
|
1423
1425
|
onSaved: () => A(null),
|
|
1424
1426
|
schema: r,
|
|
1425
1427
|
optimistic: it(a)
|
|
1426
|
-
},
|
|
1427
|
-
},
|
|
1428
|
-
if (
|
|
1428
|
+
}, c);
|
|
1429
|
+
}, s = m?.time_field, c;
|
|
1430
|
+
if (s) {
|
|
1429
1431
|
let e = [];
|
|
1430
|
-
|
|
1431
|
-
let r = t[
|
|
1432
|
+
v.forEach((t, n) => {
|
|
1433
|
+
let r = t[s], i = st(r), a = e[e.length - 1];
|
|
1432
1434
|
!a || a.key !== i ? e.push({
|
|
1433
1435
|
key: i,
|
|
1434
1436
|
label: ct(r),
|
|
@@ -1440,7 +1442,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1440
1442
|
row: t,
|
|
1441
1443
|
idx: n
|
|
1442
1444
|
});
|
|
1443
|
-
}),
|
|
1445
|
+
}), c = e.map((e) => /* @__PURE__ */ X("div", {
|
|
1444
1446
|
style: {
|
|
1445
1447
|
display: "flex",
|
|
1446
1448
|
flexDirection: "column",
|
|
@@ -1451,11 +1453,11 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1451
1453
|
count: e.rows.length
|
|
1452
1454
|
}), e.rows.map(({ row: e, idx: t }) => a(e, t))]
|
|
1453
1455
|
}, `day-${e.key}`));
|
|
1454
|
-
} else
|
|
1456
|
+
} else c = v.map((e, t) => a(e, t));
|
|
1455
1457
|
P = /* @__PURE__ */ X(J, { children: [
|
|
1456
1458
|
N,
|
|
1457
1459
|
ee,
|
|
1458
|
-
|
|
1460
|
+
c
|
|
1459
1461
|
] });
|
|
1460
1462
|
}
|
|
1461
1463
|
return h ? /* @__PURE__ */ X("div", {
|
|
@@ -1484,7 +1486,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1484
1486
|
})
|
|
1485
1487
|
}),
|
|
1486
1488
|
/* @__PURE__ */ Y("div", {
|
|
1487
|
-
ref:
|
|
1489
|
+
ref: b,
|
|
1488
1490
|
onScroll: O,
|
|
1489
1491
|
style: {
|
|
1490
1492
|
flex: 1,
|
|
@@ -1517,45 +1519,45 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1517
1519
|
schema: r
|
|
1518
1520
|
})] });
|
|
1519
1521
|
}
|
|
1520
|
-
function ot({ row: t, rowId: n, childEntity: r, entityCode:
|
|
1521
|
-
let
|
|
1522
|
-
|
|
1522
|
+
function ot({ row: t, rowId: n, childEntity: r, entityCode: a, parentEntity: o, parentId: s, timeline: f, editableFields: p, refs: m, isEditing: h, onStartEdit: _, onCancelEdit: v, onSaved: b, schema: C, optimistic: T = !1 }) {
|
|
1523
|
+
let E = ge(), D = S(), [O, k] = q({}), A = U(() => {
|
|
1524
|
+
E.invalidateQueries({ queryKey: [
|
|
1523
1525
|
M,
|
|
1524
1526
|
o,
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
+
s,
|
|
1528
|
+
a
|
|
1527
1529
|
] });
|
|
1528
1530
|
}, [
|
|
1529
|
-
|
|
1531
|
+
E,
|
|
1530
1532
|
o,
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
+
s,
|
|
1534
|
+
a
|
|
1533
1535
|
]), j = he({
|
|
1534
1536
|
mutationFn: (e) => {
|
|
1535
1537
|
let r = t.$row_version;
|
|
1536
|
-
return
|
|
1538
|
+
return w(a, n, typeof r == "string" && r !== "" ? {
|
|
1537
1539
|
...e,
|
|
1538
1540
|
$row_version: r
|
|
1539
1541
|
} : e);
|
|
1540
1542
|
},
|
|
1541
1543
|
onSuccess: () => {
|
|
1542
|
-
A(),
|
|
1544
|
+
A(), l.success("Updated"), b();
|
|
1543
1545
|
},
|
|
1544
|
-
onError: (e) =>
|
|
1546
|
+
onError: (e) => l.error(e.message)
|
|
1545
1547
|
}), ee = he({
|
|
1546
|
-
mutationFn: () => x(
|
|
1548
|
+
mutationFn: () => x(a, n),
|
|
1547
1549
|
onSuccess: () => {
|
|
1548
|
-
A(),
|
|
1550
|
+
A(), l.success("Deleted");
|
|
1549
1551
|
},
|
|
1550
|
-
onError: (e) =>
|
|
1552
|
+
onError: (e) => l.error(e.message)
|
|
1551
1553
|
}), N = U(() => {
|
|
1552
1554
|
let e = {};
|
|
1553
1555
|
for (let n of p) e[n] = t[n] ?? "";
|
|
1554
|
-
k(e),
|
|
1556
|
+
k(e), _();
|
|
1555
1557
|
}, [
|
|
1556
1558
|
t,
|
|
1557
1559
|
p,
|
|
1558
|
-
|
|
1560
|
+
_
|
|
1559
1561
|
]), P = U((e, t) => {
|
|
1560
1562
|
k((n) => ({
|
|
1561
1563
|
...n,
|
|
@@ -1581,15 +1583,15 @@ function ot({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1581
1583
|
marginBottom: 4,
|
|
1582
1584
|
display: "block"
|
|
1583
1585
|
},
|
|
1584
|
-
children:
|
|
1585
|
-
}),
|
|
1586
|
+
children: d(t, e, C.entities)
|
|
1587
|
+
}), y({
|
|
1586
1588
|
field: t,
|
|
1587
1589
|
fieldName: e,
|
|
1588
1590
|
value: O[e] ?? "",
|
|
1589
1591
|
mode: "edit",
|
|
1590
1592
|
onChange: (t) => P(e, t),
|
|
1591
1593
|
record: O,
|
|
1592
|
-
locale:
|
|
1594
|
+
locale: D
|
|
1593
1595
|
})] }, e) : null;
|
|
1594
1596
|
}), /* @__PURE__ */ X("div", {
|
|
1595
1597
|
style: {
|
|
@@ -1598,18 +1600,18 @@ function ot({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1598
1600
|
gap: 6,
|
|
1599
1601
|
paddingTop: 4
|
|
1600
1602
|
},
|
|
1601
|
-
children: [/* @__PURE__ */ Y(
|
|
1603
|
+
children: [/* @__PURE__ */ Y(u, {
|
|
1602
1604
|
kind: "primary",
|
|
1603
1605
|
size: "xs",
|
|
1604
|
-
icon: j.isPending ? /* @__PURE__ */ Y(
|
|
1606
|
+
icon: j.isPending ? /* @__PURE__ */ Y(g, { size: 12 }) : /* @__PURE__ */ Y(e.check, { size: 12 }),
|
|
1605
1607
|
onClick: () => j.mutate(O),
|
|
1606
1608
|
disabled: j.isPending,
|
|
1607
1609
|
children: j.isPending ? "Saving…" : "Save"
|
|
1608
|
-
}), /* @__PURE__ */ Y(
|
|
1610
|
+
}), /* @__PURE__ */ Y(u, {
|
|
1609
1611
|
size: "xs",
|
|
1610
1612
|
icon: /* @__PURE__ */ Y(e.x, { size: 12 }),
|
|
1611
1613
|
onClick: () => {
|
|
1612
|
-
k({}),
|
|
1614
|
+
k({}), v();
|
|
1613
1615
|
},
|
|
1614
1616
|
disabled: j.isPending,
|
|
1615
1617
|
children: "Cancel"
|
|
@@ -1617,14 +1619,14 @@ function ot({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1617
1619
|
})]
|
|
1618
1620
|
}) : /* @__PURE__ */ X("div", {
|
|
1619
1621
|
className: "group",
|
|
1620
|
-
"data-optimistic":
|
|
1622
|
+
"data-optimistic": T || void 0,
|
|
1621
1623
|
style: {
|
|
1622
1624
|
borderRadius: 10,
|
|
1623
1625
|
border: "1px solid var(--border)",
|
|
1624
1626
|
background: "var(--surface)",
|
|
1625
1627
|
padding: 12,
|
|
1626
1628
|
transition: "border-color .12s",
|
|
1627
|
-
opacity:
|
|
1629
|
+
opacity: T ? .6 : 1
|
|
1628
1630
|
},
|
|
1629
1631
|
onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
|
|
1630
1632
|
onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
|
|
@@ -1641,72 +1643,72 @@ function ot({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1641
1643
|
children: [
|
|
1642
1644
|
F && t[F] != null && r.fields.get(F) && /* @__PURE__ */ Y("span", {
|
|
1643
1645
|
style: { fontWeight: 500 },
|
|
1644
|
-
children:
|
|
1646
|
+
children: y({
|
|
1645
1647
|
field: r.fields.get(F),
|
|
1646
1648
|
fieldName: F,
|
|
1647
1649
|
value: t[F],
|
|
1648
1650
|
mode: "display",
|
|
1649
1651
|
record: t,
|
|
1650
1652
|
refs: m,
|
|
1651
|
-
locale:
|
|
1653
|
+
locale: D
|
|
1652
1654
|
})
|
|
1653
1655
|
}),
|
|
1654
|
-
I && t[I] != null && r.fields.get(I) && /* @__PURE__ */ Y(
|
|
1656
|
+
I && t[I] != null && r.fields.get(I) && /* @__PURE__ */ Y(i, {
|
|
1655
1657
|
tone: "slate",
|
|
1656
1658
|
size: "xs",
|
|
1657
|
-
children:
|
|
1659
|
+
children: y({
|
|
1658
1660
|
field: r.fields.get(I),
|
|
1659
1661
|
fieldName: I,
|
|
1660
1662
|
value: t[I],
|
|
1661
1663
|
mode: "display",
|
|
1662
1664
|
record: t,
|
|
1663
1665
|
refs: m,
|
|
1664
|
-
locale:
|
|
1666
|
+
locale: D
|
|
1665
1667
|
})
|
|
1666
1668
|
}),
|
|
1667
1669
|
B && t[B] != null && r.fields.get(B) && /* @__PURE__ */ Y(ut, {
|
|
1668
1670
|
value: t[B],
|
|
1669
1671
|
field: r.fields.get(B)
|
|
1670
1672
|
}),
|
|
1671
|
-
V && t[V] != null && r.fields.get(V) && /* @__PURE__ */ Y(
|
|
1673
|
+
V && t[V] != null && r.fields.get(V) && /* @__PURE__ */ Y(i, {
|
|
1672
1674
|
tone: "slate",
|
|
1673
1675
|
size: "xs",
|
|
1674
|
-
children:
|
|
1676
|
+
children: y({
|
|
1675
1677
|
field: r.fields.get(V),
|
|
1676
1678
|
fieldName: V,
|
|
1677
1679
|
value: t[V],
|
|
1678
1680
|
mode: "display",
|
|
1679
1681
|
record: t,
|
|
1680
1682
|
refs: m,
|
|
1681
|
-
locale:
|
|
1683
|
+
locale: D
|
|
1682
1684
|
})
|
|
1683
1685
|
}),
|
|
1684
1686
|
z && t[z] != null && r.fields.get(z) && /* @__PURE__ */ X("span", { children: [
|
|
1685
1687
|
"by",
|
|
1686
1688
|
" ",
|
|
1687
|
-
|
|
1689
|
+
y({
|
|
1688
1690
|
field: r.fields.get(z),
|
|
1689
1691
|
fieldName: z,
|
|
1690
1692
|
value: t[z],
|
|
1691
1693
|
mode: "display",
|
|
1692
1694
|
record: t,
|
|
1693
1695
|
refs: m,
|
|
1694
|
-
locale:
|
|
1696
|
+
locale: D
|
|
1695
1697
|
})
|
|
1696
1698
|
] }),
|
|
1697
|
-
!
|
|
1699
|
+
!T && /* @__PURE__ */ X("div", {
|
|
1698
1700
|
style: {
|
|
1699
1701
|
marginLeft: "auto",
|
|
1700
1702
|
display: "flex",
|
|
1701
1703
|
alignItems: "center",
|
|
1702
1704
|
gap: 2
|
|
1703
1705
|
},
|
|
1704
|
-
children: [/* @__PURE__ */ Y(
|
|
1706
|
+
children: [/* @__PURE__ */ Y(c, {
|
|
1705
1707
|
size: 22,
|
|
1706
1708
|
icon: /* @__PURE__ */ Y(e.edit, { size: 11 }),
|
|
1707
1709
|
onClick: N,
|
|
1708
1710
|
title: "Edit"
|
|
1709
|
-
}), /* @__PURE__ */ Y(
|
|
1711
|
+
}), /* @__PURE__ */ Y(c, {
|
|
1710
1712
|
size: 22,
|
|
1711
1713
|
icon: /* @__PURE__ */ Y(e.trash, { size: 11 }),
|
|
1712
1714
|
onClick: () => ee.mutate(),
|
|
@@ -1721,14 +1723,14 @@ function ot({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1721
1723
|
fontWeight: 500,
|
|
1722
1724
|
marginTop: 6
|
|
1723
1725
|
},
|
|
1724
|
-
children:
|
|
1726
|
+
children: y({
|
|
1725
1727
|
field: r.fields.get(L),
|
|
1726
1728
|
fieldName: L,
|
|
1727
1729
|
value: t[L],
|
|
1728
1730
|
mode: "display",
|
|
1729
1731
|
record: t,
|
|
1730
1732
|
refs: m,
|
|
1731
|
-
locale:
|
|
1733
|
+
locale: D
|
|
1732
1734
|
})
|
|
1733
1735
|
}),
|
|
1734
1736
|
R && t[R] != null && R !== L && r.fields.get(R) && /* @__PURE__ */ Y("div", {
|
|
@@ -1737,14 +1739,14 @@ function ot({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1737
1739
|
fontWeight: 400,
|
|
1738
1740
|
marginTop: 6
|
|
1739
1741
|
},
|
|
1740
|
-
children:
|
|
1742
|
+
children: y({
|
|
1741
1743
|
field: r.fields.get(R),
|
|
1742
1744
|
fieldName: R,
|
|
1743
1745
|
value: t[R],
|
|
1744
1746
|
mode: "display",
|
|
1745
1747
|
record: t,
|
|
1746
1748
|
refs: m,
|
|
1747
|
-
locale:
|
|
1749
|
+
locale: D
|
|
1748
1750
|
})
|
|
1749
1751
|
})
|
|
1750
1752
|
]
|
|
@@ -1833,67 +1835,67 @@ function dt(e, t) {
|
|
|
1833
1835
|
}
|
|
1834
1836
|
//#endregion
|
|
1835
1837
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
1836
|
-
function ft({ config: t, childEntity: n, schema: r, rows: i, onChange:
|
|
1837
|
-
let
|
|
1838
|
-
if (
|
|
1838
|
+
function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, validationErrors: s, refs: l, forceTablePresentation: f = !1 }) {
|
|
1839
|
+
let p = S(), m = o(), h = K(null), g = t.columns, _ = t.position_field, v = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), b = g.filter((e) => {
|
|
1840
|
+
if (v.has(e) || t.position_field && e === t.position_field) return !1;
|
|
1839
1841
|
let r = n.fields.get(e);
|
|
1840
1842
|
return !(!r || r.auto || r.primary || r.source);
|
|
1841
|
-
}),
|
|
1843
|
+
}), x = new Set(g.filter((e) => {
|
|
1842
1844
|
if (t.position_field && e === t.position_field) return !0;
|
|
1843
1845
|
let r = n.fields.get(e);
|
|
1844
1846
|
return r && (r.auto || r.primary || r.source);
|
|
1845
|
-
})),
|
|
1846
|
-
|
|
1847
|
+
})), C = U((e, t, n) => {
|
|
1848
|
+
a(i.map((r) => r._key === e ? {
|
|
1847
1849
|
...r,
|
|
1848
1850
|
[t]: n,
|
|
1849
1851
|
_dirty: !0
|
|
1850
1852
|
} : r));
|
|
1851
|
-
}, [i,
|
|
1853
|
+
}, [i, a]), w = U(() => {
|
|
1852
1854
|
let e = {
|
|
1853
1855
|
_key: crypto.randomUUID(),
|
|
1854
1856
|
_dirty: !0
|
|
1855
1857
|
};
|
|
1856
|
-
|
|
1857
|
-
let n = typeof t[
|
|
1858
|
+
_ && (e[_] = i.filter((e) => !e._deleted).reduce((e, t) => {
|
|
1859
|
+
let n = typeof t[_] == "number" ? t[_] : -1;
|
|
1858
1860
|
return Math.max(e, n);
|
|
1859
1861
|
}, -1) + 1);
|
|
1860
1862
|
let r = t.quick_add?.defaults ?? {};
|
|
1861
|
-
for (let t of
|
|
1863
|
+
for (let t of b) {
|
|
1862
1864
|
let i = n.fields.get(t);
|
|
1863
1865
|
i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
|
|
1864
1866
|
}
|
|
1865
|
-
|
|
1867
|
+
a([...i, e]);
|
|
1866
1868
|
}, [
|
|
1867
1869
|
i,
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
+
a,
|
|
1871
|
+
b,
|
|
1870
1872
|
n,
|
|
1871
1873
|
t.quick_add?.defaults,
|
|
1872
|
-
|
|
1873
|
-
]),
|
|
1874
|
-
|
|
1874
|
+
_
|
|
1875
|
+
]), T = U((e) => {
|
|
1876
|
+
a(i.map((t) => t._key === e ? {
|
|
1875
1877
|
...t,
|
|
1876
1878
|
_deleted: !0
|
|
1877
1879
|
} : t));
|
|
1878
|
-
}, [i,
|
|
1879
|
-
|
|
1880
|
+
}, [i, a]), E = U((e) => {
|
|
1881
|
+
a(i.map((t) => t._key === e ? {
|
|
1880
1882
|
...t,
|
|
1881
1883
|
_deleted: !1
|
|
1882
1884
|
} : t));
|
|
1883
|
-
}, [i,
|
|
1884
|
-
if (!
|
|
1885
|
-
let n = i.filter((e) => !e._deleted), r = i.filter((e) => e._deleted),
|
|
1886
|
-
if (
|
|
1887
|
-
let c = [...n], [l] = c.splice(
|
|
1888
|
-
c.splice(s, 0, l),
|
|
1885
|
+
}, [i, a]), D = U((e, t) => {
|
|
1886
|
+
if (!_) return;
|
|
1887
|
+
let n = i.filter((e) => !e._deleted), r = i.filter((e) => e._deleted), o = n.findIndex((t) => t._key === e), s = o + t;
|
|
1888
|
+
if (o < 0 || s < 0 || s >= n.length) return;
|
|
1889
|
+
let c = [...n], [l] = c.splice(o, 1);
|
|
1890
|
+
c.splice(s, 0, l), a([...c.map((e, t) => ({
|
|
1889
1891
|
...e,
|
|
1890
|
-
[
|
|
1891
|
-
_dirty: e[
|
|
1892
|
+
[_]: t,
|
|
1893
|
+
_dirty: e[_] === t ? e._dirty : !0
|
|
1892
1894
|
})), ...r]);
|
|
1893
1895
|
}, [
|
|
1894
1896
|
i,
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
+
a,
|
|
1898
|
+
_
|
|
1897
1899
|
]), O = U((e) => {
|
|
1898
1900
|
let t = e.target, n = t.closest("td");
|
|
1899
1901
|
if (!n) return;
|
|
@@ -1918,7 +1920,7 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
1918
1920
|
if (o < t.length - 1) {
|
|
1919
1921
|
let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
|
|
1920
1922
|
e && e.focus();
|
|
1921
|
-
} else
|
|
1923
|
+
} else w(), requestAnimationFrame(() => {
|
|
1922
1924
|
let e = i.querySelectorAll("tr"), t = e[e.length - 1];
|
|
1923
1925
|
if (t) {
|
|
1924
1926
|
let e = t.querySelector("input, select, textarea, [tabindex]");
|
|
@@ -1926,15 +1928,15 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
1926
1928
|
}
|
|
1927
1929
|
});
|
|
1928
1930
|
} else e.key === "Escape" && t.blur?.();
|
|
1929
|
-
}, [
|
|
1930
|
-
return
|
|
1931
|
+
}, [w]), k = oe;
|
|
1932
|
+
return m.isPhone && !f ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
1931
1933
|
style: {
|
|
1932
1934
|
display: "flex",
|
|
1933
1935
|
flexDirection: "column",
|
|
1934
1936
|
gap: 10
|
|
1935
1937
|
},
|
|
1936
1938
|
children: i.map((t, a) => {
|
|
1937
|
-
let o = !!t._deleted,
|
|
1939
|
+
let o = !!t._deleted, u = s?.[t._key], f = _ ? i.filter((e) => !e._deleted) : [], m = _ ? f.findIndex((e) => e._key === t._key) : -1;
|
|
1938
1940
|
return /* @__PURE__ */ X("div", {
|
|
1939
1941
|
style: {
|
|
1940
1942
|
border: "1px solid var(--border)",
|
|
@@ -1966,27 +1968,27 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
1966
1968
|
alignItems: "center",
|
|
1967
1969
|
gap: 4
|
|
1968
1970
|
},
|
|
1969
|
-
children: [
|
|
1971
|
+
children: [_ && !o && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(c, {
|
|
1970
1972
|
size: 32,
|
|
1971
1973
|
icon: /* @__PURE__ */ Y(e.up, { size: 14 }),
|
|
1972
|
-
onClick: () =>
|
|
1973
|
-
disabled:
|
|
1974
|
+
onClick: () => D(t._key, -1),
|
|
1975
|
+
disabled: m <= 0,
|
|
1974
1976
|
title: "Move row up"
|
|
1975
|
-
}), /* @__PURE__ */ Y(
|
|
1977
|
+
}), /* @__PURE__ */ Y(c, {
|
|
1976
1978
|
size: 32,
|
|
1977
1979
|
icon: /* @__PURE__ */ Y(e.down, { size: 14 }),
|
|
1978
|
-
onClick: () =>
|
|
1979
|
-
disabled:
|
|
1980
|
+
onClick: () => D(t._key, 1),
|
|
1981
|
+
disabled: m === -1 || m >= f.length - 1,
|
|
1980
1982
|
title: "Move row down"
|
|
1981
|
-
})] }), o ? /* @__PURE__ */ Y(
|
|
1983
|
+
})] }), o ? /* @__PURE__ */ Y(c, {
|
|
1982
1984
|
size: 32,
|
|
1983
1985
|
icon: /* @__PURE__ */ Y(e.refresh, { size: 14 }),
|
|
1984
|
-
onClick: () =>
|
|
1986
|
+
onClick: () => E(t._key),
|
|
1985
1987
|
title: "Undo delete"
|
|
1986
|
-
}) : /* @__PURE__ */ Y(
|
|
1988
|
+
}) : /* @__PURE__ */ Y(c, {
|
|
1987
1989
|
size: 32,
|
|
1988
1990
|
icon: /* @__PURE__ */ Y(e.trash, { size: 14 }),
|
|
1989
|
-
onClick: () =>
|
|
1991
|
+
onClick: () => T(t._key),
|
|
1990
1992
|
title: "Delete row"
|
|
1991
1993
|
})]
|
|
1992
1994
|
})]
|
|
@@ -1997,16 +1999,16 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
1997
1999
|
flexDirection: "column",
|
|
1998
2000
|
gap: 12
|
|
1999
2001
|
},
|
|
2000
|
-
children:
|
|
2001
|
-
let i = n.fields.get(e), a =
|
|
2002
|
+
children: g.map((e) => {
|
|
2003
|
+
let i = n.fields.get(e), a = u?.includes(e), s = x.has(e), c = i ? d(i, e, r.entities) : e, f = `child-${t._key}-${e}`, m = `${f}-label`, h = {
|
|
2002
2004
|
outline: a ? "1px solid var(--danger)" : "none",
|
|
2003
2005
|
outlineOffset: 3,
|
|
2004
2006
|
borderRadius: a ? 5 : 0
|
|
2005
|
-
},
|
|
2007
|
+
}, g = {
|
|
2006
2008
|
fontSize: 11.5,
|
|
2007
2009
|
fontWeight: 600,
|
|
2008
2010
|
color: "var(--text-3)"
|
|
2009
|
-
},
|
|
2011
|
+
}, _ = !o && !s && !!i;
|
|
2010
2012
|
return /* @__PURE__ */ X("div", {
|
|
2011
2013
|
style: {
|
|
2012
2014
|
display: "flex",
|
|
@@ -2016,39 +2018,39 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
2016
2018
|
textDecoration: o ? "line-through" : "none"
|
|
2017
2019
|
},
|
|
2018
2020
|
title: a ? `${e} is required` : void 0,
|
|
2019
|
-
children: [
|
|
2020
|
-
id:
|
|
2021
|
-
htmlFor:
|
|
2022
|
-
style:
|
|
2023
|
-
children:
|
|
2021
|
+
children: [_ ? /* @__PURE__ */ Y("label", {
|
|
2022
|
+
id: m,
|
|
2023
|
+
htmlFor: f,
|
|
2024
|
+
style: g,
|
|
2025
|
+
children: c
|
|
2024
2026
|
}) : /* @__PURE__ */ Y("div", {
|
|
2025
|
-
id:
|
|
2026
|
-
style:
|
|
2027
|
-
children:
|
|
2027
|
+
id: m,
|
|
2028
|
+
style: g,
|
|
2029
|
+
children: c
|
|
2028
2030
|
}), /* @__PURE__ */ Y("div", {
|
|
2029
|
-
style:
|
|
2030
|
-
children: o || s ? i ?
|
|
2031
|
+
style: h,
|
|
2032
|
+
children: o || s ? i ? y({
|
|
2031
2033
|
field: i,
|
|
2032
2034
|
fieldName: e,
|
|
2033
2035
|
value: t[e],
|
|
2034
2036
|
mode: "display",
|
|
2035
2037
|
record: t,
|
|
2036
2038
|
refs: l,
|
|
2037
|
-
fieldId:
|
|
2038
|
-
labelId:
|
|
2039
|
-
locale:
|
|
2040
|
-
}) : A(t[e]) : i ?
|
|
2039
|
+
fieldId: f,
|
|
2040
|
+
labelId: m,
|
|
2041
|
+
locale: p
|
|
2042
|
+
}) : A(t[e]) : i ? y({
|
|
2041
2043
|
field: i,
|
|
2042
2044
|
fieldName: e,
|
|
2043
2045
|
value: t[e],
|
|
2044
2046
|
mode: "edit",
|
|
2045
|
-
onChange: (n) =>
|
|
2047
|
+
onChange: (n) => C(t._key, e, n),
|
|
2046
2048
|
record: t,
|
|
2047
2049
|
refs: l,
|
|
2048
2050
|
compact: !0,
|
|
2049
|
-
fieldId:
|
|
2050
|
-
labelId:
|
|
2051
|
-
locale:
|
|
2051
|
+
fieldId: f,
|
|
2052
|
+
labelId: m,
|
|
2053
|
+
locale: p
|
|
2052
2054
|
}) : A(t[e])
|
|
2053
2055
|
})]
|
|
2054
2056
|
}, e);
|
|
@@ -2058,24 +2060,24 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
2058
2060
|
})
|
|
2059
2061
|
}), /* @__PURE__ */ Y("div", {
|
|
2060
2062
|
style: { marginTop: 10 },
|
|
2061
|
-
children: /* @__PURE__ */ Y(
|
|
2063
|
+
children: /* @__PURE__ */ Y(u, {
|
|
2062
2064
|
kind: "ghost",
|
|
2063
2065
|
size: "sm",
|
|
2064
2066
|
icon: /* @__PURE__ */ Y(e.plus, { size: 14 }),
|
|
2065
|
-
onClick:
|
|
2067
|
+
onClick: w,
|
|
2066
2068
|
children: "Add row"
|
|
2067
2069
|
})
|
|
2068
2070
|
})] }) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
2069
2071
|
style: { overflowX: "auto" },
|
|
2070
2072
|
children: /* @__PURE__ */ X("table", {
|
|
2071
|
-
ref:
|
|
2073
|
+
ref: h,
|
|
2072
2074
|
style: se,
|
|
2073
2075
|
onKeyDown: O,
|
|
2074
|
-
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", { children: [
|
|
2076
|
+
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", { children: [g.map((e) => {
|
|
2075
2077
|
let t = n.fields.get(e);
|
|
2076
2078
|
return /* @__PURE__ */ Y("th", {
|
|
2077
2079
|
style: k,
|
|
2078
|
-
children: t ?
|
|
2080
|
+
children: t ? d(t, e, r.entities) : e
|
|
2079
2081
|
}, e);
|
|
2080
2082
|
}), /* @__PURE__ */ Y("th", { style: {
|
|
2081
2083
|
...k,
|
|
@@ -2084,8 +2086,8 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
2084
2086
|
let r = !!t._deleted, i = s?.[t._key];
|
|
2085
2087
|
return /* @__PURE__ */ X("tr", {
|
|
2086
2088
|
style: { opacity: r ? .5 : 1 },
|
|
2087
|
-
children: [
|
|
2088
|
-
let a = n.fields.get(e), o = i?.includes(e), s =
|
|
2089
|
+
children: [g.map((e) => {
|
|
2090
|
+
let a = n.fields.get(e), o = i?.includes(e), s = x.has(e);
|
|
2089
2091
|
return r || s ? /* @__PURE__ */ Y("td", {
|
|
2090
2092
|
style: {
|
|
2091
2093
|
padding: "6px 12px",
|
|
@@ -2094,14 +2096,14 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
2094
2096
|
textDecoration: r ? "line-through" : "none",
|
|
2095
2097
|
color: "var(--text-2)"
|
|
2096
2098
|
},
|
|
2097
|
-
children: a ?
|
|
2099
|
+
children: a ? y({
|
|
2098
2100
|
field: a,
|
|
2099
2101
|
fieldName: e,
|
|
2100
2102
|
value: t[e],
|
|
2101
2103
|
mode: "display",
|
|
2102
2104
|
record: t,
|
|
2103
2105
|
refs: l,
|
|
2104
|
-
locale:
|
|
2106
|
+
locale: p
|
|
2105
2107
|
}) : A(t[e])
|
|
2106
2108
|
}, e) : /* @__PURE__ */ Y("td", {
|
|
2107
2109
|
style: {
|
|
@@ -2113,16 +2115,16 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
2113
2115
|
borderRadius: o ? 4 : 0
|
|
2114
2116
|
},
|
|
2115
2117
|
title: o ? `${e} is required` : void 0,
|
|
2116
|
-
children: a ?
|
|
2118
|
+
children: a ? y({
|
|
2117
2119
|
field: a,
|
|
2118
2120
|
fieldName: e,
|
|
2119
2121
|
value: t[e],
|
|
2120
2122
|
mode: "edit",
|
|
2121
|
-
onChange: (n) =>
|
|
2123
|
+
onChange: (n) => C(t._key, e, n),
|
|
2122
2124
|
record: t,
|
|
2123
2125
|
refs: l,
|
|
2124
2126
|
compact: !0,
|
|
2125
|
-
locale:
|
|
2127
|
+
locale: p
|
|
2126
2128
|
}) : A(t[e])
|
|
2127
2129
|
}, e);
|
|
2128
2130
|
}), /* @__PURE__ */ Y("td", {
|
|
@@ -2131,15 +2133,15 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
2131
2133
|
borderBottom: "1px solid var(--divider)",
|
|
2132
2134
|
verticalAlign: "middle"
|
|
2133
2135
|
},
|
|
2134
|
-
children: r ? /* @__PURE__ */ Y(
|
|
2136
|
+
children: r ? /* @__PURE__ */ Y(c, {
|
|
2135
2137
|
size: 24,
|
|
2136
2138
|
icon: /* @__PURE__ */ Y(e.refresh, { size: 12 }),
|
|
2137
|
-
onClick: () =>
|
|
2139
|
+
onClick: () => E(t._key),
|
|
2138
2140
|
title: "Undo delete"
|
|
2139
|
-
}) : /* @__PURE__ */ Y(
|
|
2141
|
+
}) : /* @__PURE__ */ Y(c, {
|
|
2140
2142
|
size: 24,
|
|
2141
2143
|
icon: /* @__PURE__ */ Y(e.trash, { size: 12 }),
|
|
2142
|
-
onClick: () =>
|
|
2144
|
+
onClick: () => T(t._key),
|
|
2143
2145
|
title: "Delete row"
|
|
2144
2146
|
})
|
|
2145
2147
|
})]
|
|
@@ -2148,34 +2150,34 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, valida
|
|
|
2148
2150
|
})
|
|
2149
2151
|
}), /* @__PURE__ */ Y("div", {
|
|
2150
2152
|
style: { marginTop: 8 },
|
|
2151
|
-
children: /* @__PURE__ */ Y(
|
|
2153
|
+
children: /* @__PURE__ */ Y(u, {
|
|
2152
2154
|
kind: "ghost",
|
|
2153
2155
|
size: "xs",
|
|
2154
2156
|
icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
|
|
2155
|
-
onClick:
|
|
2157
|
+
onClick: w,
|
|
2156
2158
|
children: "Add row"
|
|
2157
2159
|
})
|
|
2158
2160
|
})] });
|
|
2159
2161
|
}
|
|
2160
2162
|
//#endregion
|
|
2161
2163
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
2162
|
-
var pt = H(() => import("./DraggableChildrenTable-
|
|
2164
|
+
var pt = H(() => import("./DraggableChildrenTable-ChUh120M.js").then((e) => ({ default: e.DraggableChildrenTable })));
|
|
2163
2165
|
function mt({ node: e, ctx: n }) {
|
|
2164
|
-
let r =
|
|
2166
|
+
let r = o(), i = e.children;
|
|
2165
2167
|
if (!i) return null;
|
|
2166
2168
|
let a = r.isPhone && n.relatedRecordsPresentation === "table";
|
|
2167
2169
|
if (n.isNew && n.mode !== "edit") return null;
|
|
2168
|
-
let
|
|
2169
|
-
if (!
|
|
2170
|
+
let s = ze(n.entity, i);
|
|
2171
|
+
if (!s) return /* @__PURE__ */ X("div", {
|
|
2170
2172
|
className: "text-sm text-muted-foreground py-2",
|
|
2171
2173
|
children: ["Unknown child relation: ", i]
|
|
2172
2174
|
});
|
|
2173
|
-
let
|
|
2174
|
-
if (!
|
|
2175
|
+
let c = n.schema.entities[s.entity];
|
|
2176
|
+
if (!c) return /* @__PURE__ */ X("div", {
|
|
2175
2177
|
className: "text-sm text-muted-foreground py-2",
|
|
2176
|
-
children: ["Entity not found: ",
|
|
2178
|
+
children: ["Entity not found: ", s.entity]
|
|
2177
2179
|
});
|
|
2178
|
-
let l = De(
|
|
2180
|
+
let l = De(s, c, e), u = Z(e, n), d = we(e, n), f = (e) => l.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ Y(N, {
|
|
2179
2181
|
title: u,
|
|
2180
2182
|
icon: d ? /* @__PURE__ */ Y(t, {
|
|
2181
2183
|
name: d,
|
|
@@ -2183,13 +2185,13 @@ function mt({ node: e, ctx: n }) {
|
|
|
2183
2185
|
}) : void 0,
|
|
2184
2186
|
children: e
|
|
2185
2187
|
});
|
|
2186
|
-
if (n.mode === "edit" && l.editable && l.interaction !== "navigate" && l.interaction !== "readonly" &&
|
|
2188
|
+
if (n.mode === "edit" && l.editable && l.interaction !== "navigate" && l.interaction !== "readonly" && T(c, "update") && l.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
|
|
2187
2189
|
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = l.position_field ? r.isPhone && !a ? ft : pt : ft;
|
|
2188
2190
|
return f(/* @__PURE__ */ Y(le, {
|
|
2189
|
-
fallback: /* @__PURE__ */ Y(
|
|
2191
|
+
fallback: /* @__PURE__ */ Y(P, {}),
|
|
2190
2192
|
children: /* @__PURE__ */ Y(o, {
|
|
2191
2193
|
config: l,
|
|
2192
|
-
childEntity:
|
|
2194
|
+
childEntity: c,
|
|
2193
2195
|
schema: n.schema,
|
|
2194
2196
|
rows: e,
|
|
2195
2197
|
onChange: (e) => n.onChildrenChange(i, e),
|
|
@@ -2247,8 +2249,8 @@ function xt({ columns: e = 2, children: t }) {
|
|
|
2247
2249
|
})
|
|
2248
2250
|
});
|
|
2249
2251
|
}
|
|
2250
|
-
function St({ label: t, children: n, span: r = !1, required: i, error:
|
|
2251
|
-
let h = de(bt), g = r || h.columns === 1, _ = !!
|
|
2252
|
+
function St({ label: t, children: n, span: r = !1, required: i, error: o, hint: s, actions: c, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
|
|
2253
|
+
let h = de(bt), g = r || h.columns === 1, _ = !!o;
|
|
2252
2254
|
return /* @__PURE__ */ X("div", {
|
|
2253
2255
|
className: "detail-row",
|
|
2254
2256
|
"data-error": _ || void 0,
|
|
@@ -2331,7 +2333,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2331
2333
|
flexShrink: 0,
|
|
2332
2334
|
marginTop: -2
|
|
2333
2335
|
},
|
|
2334
|
-
children: [l && /* @__PURE__ */ Y(
|
|
2336
|
+
children: [l && /* @__PURE__ */ Y(a, {
|
|
2335
2337
|
value: l,
|
|
2336
2338
|
size: "sm",
|
|
2337
2339
|
title: "Copy value"
|
|
@@ -2346,7 +2348,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2346
2348
|
alignItems: "center",
|
|
2347
2349
|
gap: 4
|
|
2348
2350
|
},
|
|
2349
|
-
children: [_ && /* @__PURE__ */ Y(e.warning, { size: 11 }), /* @__PURE__ */ Y("span", { children: _ ?
|
|
2351
|
+
children: [_ && /* @__PURE__ */ Y(e.warning, { size: 11 }), /* @__PURE__ */ Y("span", { children: _ ? o : s })]
|
|
2350
2352
|
})]
|
|
2351
2353
|
})]
|
|
2352
2354
|
});
|
|
@@ -2354,42 +2356,42 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2354
2356
|
//#endregion
|
|
2355
2357
|
//#region src/components/detail-layout/FieldsBlock.tsx
|
|
2356
2358
|
function Ct({ fields: e, ctx: t }) {
|
|
2357
|
-
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c =
|
|
2359
|
+
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = S(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
|
|
2358
2360
|
return /* @__PURE__ */ Y(xt, {
|
|
2359
2361
|
columns: l,
|
|
2360
2362
|
children: e.map((e) => {
|
|
2361
|
-
let l = e.name, d = `${r ?? "field"}-${l}`,
|
|
2362
|
-
tier:
|
|
2363
|
+
let l = e.name, d = `${r ?? "field"}-${l}`, p = `${d}-label`, m = n.fields.get(l), h = !!(m?.auto || m?.readonly || m?.source), g = I(n, l), _ = g?.read === "denied", v = g?.write === "denied", y = a === "display" ? _ : v || _, b = h || a === "edit" && v ? "display" : a, x = y ? /* @__PURE__ */ Y(ae, {
|
|
2364
|
+
tier: g.classification,
|
|
2363
2365
|
tierDef: ie(s, n, l),
|
|
2364
|
-
requiredPermission:
|
|
2366
|
+
requiredPermission: g?.required_permission,
|
|
2365
2367
|
locale: c,
|
|
2366
|
-
variant:
|
|
2368
|
+
variant: b === "edit" ? "input" : "value"
|
|
2367
2369
|
}) : L({
|
|
2368
2370
|
entity: n,
|
|
2369
2371
|
entityCode: r,
|
|
2370
2372
|
fieldName: l,
|
|
2371
2373
|
record: i,
|
|
2372
|
-
mode:
|
|
2373
|
-
onChange: o && !
|
|
2374
|
+
mode: b,
|
|
2375
|
+
onChange: o && !h ? (e) => o(l, e) : void 0,
|
|
2374
2376
|
refs: t.refs,
|
|
2375
2377
|
entities: s?.entities,
|
|
2376
2378
|
screens: s?.screens,
|
|
2377
2379
|
locale: c,
|
|
2378
2380
|
fieldId: d,
|
|
2379
|
-
labelId:
|
|
2381
|
+
labelId: p
|
|
2380
2382
|
});
|
|
2381
|
-
if (!
|
|
2382
|
-
let
|
|
2383
|
+
if (!x) return null;
|
|
2384
|
+
let S = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ Y(J, { children: e.actions.map((e, t) => /* @__PURE__ */ Y(R, {
|
|
2383
2385
|
actionCode: `${l}.action[${t}]`,
|
|
2384
2386
|
action: e,
|
|
2385
2387
|
entityCode: r,
|
|
2386
2388
|
row: i,
|
|
2387
2389
|
variant: "ghost",
|
|
2388
2390
|
size: "icon"
|
|
2389
|
-
}, t)) }) : void 0,
|
|
2391
|
+
}, t)) }) : void 0, C = !!m && yt.has(m.type), w = i?.[l], T = b === "display" && (m?.copyable || m?.type === "uuid") && w != null && w !== "" ? A(w) : void 0, E = f(m?.display?.description);
|
|
2390
2392
|
return u ? /* @__PURE__ */ X("div", {
|
|
2391
2393
|
style: { gridColumn: "1 / -1" },
|
|
2392
|
-
children: [
|
|
2394
|
+
children: [x, b === "edit" && E && /* @__PURE__ */ Y("div", {
|
|
2393
2395
|
style: {
|
|
2394
2396
|
fontSize: 11.5,
|
|
2395
2397
|
lineHeight: 1.4,
|
|
@@ -2400,17 +2402,17 @@ function Ct({ fields: e, ctx: t }) {
|
|
|
2400
2402
|
})]
|
|
2401
2403
|
}, l) : /* @__PURE__ */ Y(St, {
|
|
2402
2404
|
label: re(n, l, s.entities),
|
|
2403
|
-
htmlFor:
|
|
2404
|
-
labelId:
|
|
2405
|
+
htmlFor: b === "edit" ? d : void 0,
|
|
2406
|
+
labelId: p,
|
|
2405
2407
|
labelTitle: E || void 0,
|
|
2406
|
-
required:
|
|
2407
|
-
mode:
|
|
2408
|
-
span:
|
|
2408
|
+
required: m?.required ?? !1,
|
|
2409
|
+
mode: b,
|
|
2410
|
+
span: C,
|
|
2409
2411
|
error: t.fieldErrors?.[l],
|
|
2410
|
-
hint:
|
|
2411
|
-
actions:
|
|
2412
|
+
hint: b === "edit" && E ? E : void 0,
|
|
2413
|
+
actions: S,
|
|
2412
2414
|
copyValue: T,
|
|
2413
|
-
children:
|
|
2415
|
+
children: x
|
|
2414
2416
|
}, l);
|
|
2415
2417
|
})
|
|
2416
2418
|
});
|
|
@@ -2433,7 +2435,7 @@ function Et({ node: e, ctx: t }) {
|
|
|
2433
2435
|
return u.length === 0 ? null : /* @__PURE__ */ Y(xt, {
|
|
2434
2436
|
columns: 2,
|
|
2435
2437
|
children: u.map(([e, a]) => {
|
|
2436
|
-
let c = r?.find((t) => t.property_code === e), l =
|
|
2438
|
+
let c = r?.find((t) => t.property_code === e), l = C(a), u = a.readonly || !i ? "display" : o;
|
|
2437
2439
|
return /* @__PURE__ */ Y(Dt, {
|
|
2438
2440
|
propCode: e,
|
|
2439
2441
|
prop: a,
|
|
@@ -2449,7 +2451,7 @@ function Et({ node: e, ctx: t }) {
|
|
|
2449
2451
|
});
|
|
2450
2452
|
}
|
|
2451
2453
|
function Dt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: s, schema: c }) {
|
|
2452
|
-
let l =
|
|
2454
|
+
let l = S(), u = K(null);
|
|
2453
2455
|
W(() => () => {
|
|
2454
2456
|
u.current && clearTimeout(u.current);
|
|
2455
2457
|
}, []);
|
|
@@ -2459,23 +2461,23 @@ function Dt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty:
|
|
|
2459
2461
|
e,
|
|
2460
2462
|
t.type,
|
|
2461
2463
|
a
|
|
2462
|
-
]),
|
|
2464
|
+
]), p = I(s, e), m = p?.read === "denied", h = p?.write === "denied", g = i === "display" ? m : h || m, _ = i === "edit" && h ? "display" : i;
|
|
2463
2465
|
return /* @__PURE__ */ Y(St, {
|
|
2464
|
-
label:
|
|
2465
|
-
mode:
|
|
2466
|
+
label: f(t.display?.name ?? t.name),
|
|
2467
|
+
mode: _,
|
|
2466
2468
|
span: yt.has(t.type),
|
|
2467
|
-
children:
|
|
2468
|
-
tier:
|
|
2469
|
+
children: g ? /* @__PURE__ */ Y(ae, {
|
|
2470
|
+
tier: p.classification,
|
|
2469
2471
|
tierDef: ie(c, s, e),
|
|
2470
|
-
requiredPermission:
|
|
2472
|
+
requiredPermission: p?.required_permission,
|
|
2471
2473
|
locale: l,
|
|
2472
|
-
variant:
|
|
2473
|
-
}) :
|
|
2474
|
+
variant: _ === "edit" ? "input" : "value"
|
|
2475
|
+
}) : y({
|
|
2474
2476
|
field: n,
|
|
2475
2477
|
fieldName: e,
|
|
2476
2478
|
value: r,
|
|
2477
|
-
mode:
|
|
2478
|
-
onChange:
|
|
2479
|
+
mode: _,
|
|
2480
|
+
onChange: _ === "edit" ? d : void 0,
|
|
2479
2481
|
refs: o,
|
|
2480
2482
|
locale: l
|
|
2481
2483
|
})
|
|
@@ -2550,7 +2552,7 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2550
2552
|
}
|
|
2551
2553
|
//#endregion
|
|
2552
2554
|
//#region src/components/shared/StatusGroupsDisplay.tsx
|
|
2553
|
-
function kt({ statusGroups: e, objectStatuses: t, onSetStatus:
|
|
2555
|
+
function kt({ statusGroups: e, objectStatuses: t, onSetStatus: r, isPending: a, mode: o = "edit" }) {
|
|
2554
2556
|
return /* @__PURE__ */ Y("div", {
|
|
2555
2557
|
style: {
|
|
2556
2558
|
display: "flex",
|
|
@@ -2558,10 +2560,10 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: i,
|
|
|
2558
2560
|
alignItems: "center",
|
|
2559
2561
|
gap: 16
|
|
2560
2562
|
},
|
|
2561
|
-
children: Object.entries(e).map(([e,
|
|
2562
|
-
let
|
|
2563
|
-
if (
|
|
2564
|
-
let t =
|
|
2563
|
+
children: Object.entries(e).map(([e, s]) => {
|
|
2564
|
+
let c = t?.find((t) => t.group_code === e)?.status_code, l = c ? s.statuses.find((e) => e.code === c) : void 0;
|
|
2565
|
+
if (s.display_mode === "stepper") {
|
|
2566
|
+
let t = o === "edit", n = t ? s.transitions && c ? /* @__PURE__ */ new Set([c, ...s.transitions[c] ?? []]) : new Set(s.statuses.map((e) => e.code)) : void 0;
|
|
2565
2567
|
return /* @__PURE__ */ X("div", {
|
|
2566
2568
|
style: {
|
|
2567
2569
|
display: "flex",
|
|
@@ -2575,27 +2577,27 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: i,
|
|
|
2575
2577
|
color: "var(--text-3)",
|
|
2576
2578
|
flexShrink: 0
|
|
2577
2579
|
},
|
|
2578
|
-
children: [
|
|
2580
|
+
children: [f(s.name), ":"]
|
|
2579
2581
|
}), /* @__PURE__ */ Y("div", {
|
|
2580
2582
|
style: {
|
|
2581
2583
|
minWidth: 240,
|
|
2582
|
-
opacity:
|
|
2583
|
-
pointerEvents:
|
|
2584
|
+
opacity: a ? .6 : 1,
|
|
2585
|
+
pointerEvents: a ? "none" : "auto"
|
|
2584
2586
|
},
|
|
2585
2587
|
children: /* @__PURE__ */ Y(Ot, {
|
|
2586
|
-
stages:
|
|
2588
|
+
stages: s.statuses.map((e) => ({
|
|
2587
2589
|
code: e.code,
|
|
2588
|
-
label:
|
|
2590
|
+
label: f(e.name)
|
|
2589
2591
|
})),
|
|
2590
|
-
current:
|
|
2591
|
-
selectable:
|
|
2592
|
-
onSelect: t ? (t) =>
|
|
2592
|
+
current: c,
|
|
2593
|
+
selectable: n,
|
|
2594
|
+
onSelect: t ? (t) => r(e, t) : void 0,
|
|
2593
2595
|
compact: !0
|
|
2594
2596
|
})
|
|
2595
2597
|
})]
|
|
2596
2598
|
}, e);
|
|
2597
2599
|
}
|
|
2598
|
-
if (
|
|
2600
|
+
if (o === "display") return /* @__PURE__ */ X("div", {
|
|
2599
2601
|
style: {
|
|
2600
2602
|
display: "flex",
|
|
2601
2603
|
alignItems: "center",
|
|
@@ -2606,11 +2608,11 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: i,
|
|
|
2606
2608
|
fontSize: 12,
|
|
2607
2609
|
color: "var(--text-3)"
|
|
2608
2610
|
},
|
|
2609
|
-
children: [
|
|
2610
|
-
}),
|
|
2611
|
-
tone:
|
|
2611
|
+
children: [f(s.name), ":"]
|
|
2612
|
+
}), l ? /* @__PURE__ */ Y(i, {
|
|
2613
|
+
tone: l.color ?? "slate",
|
|
2612
2614
|
size: "xs",
|
|
2613
|
-
children:
|
|
2615
|
+
children: f(l.name)
|
|
2614
2616
|
}) : /* @__PURE__ */ Y("span", {
|
|
2615
2617
|
style: {
|
|
2616
2618
|
fontSize: 12.5,
|
|
@@ -2619,7 +2621,7 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: i,
|
|
|
2619
2621
|
children: "—"
|
|
2620
2622
|
})]
|
|
2621
2623
|
}, e);
|
|
2622
|
-
let u = (
|
|
2624
|
+
let u = (s.transitions && c ? s.statuses.filter((e) => e.code === c || (s.transitions[c]?.includes(e.code) ?? !1)) : s.statuses).map((e) => ({
|
|
2623
2625
|
value: e.code,
|
|
2624
2626
|
label: /* @__PURE__ */ X("span", {
|
|
2625
2627
|
style: {
|
|
@@ -2633,7 +2635,7 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: i,
|
|
|
2633
2635
|
borderRadius: 999,
|
|
2634
2636
|
background: `var(--pill-${e.color}, ${e.color})`,
|
|
2635
2637
|
display: "inline-block"
|
|
2636
|
-
} }),
|
|
2638
|
+
} }), f(e.name)]
|
|
2637
2639
|
})
|
|
2638
2640
|
}));
|
|
2639
2641
|
return /* @__PURE__ */ X("div", {
|
|
@@ -2647,17 +2649,17 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: i,
|
|
|
2647
2649
|
fontSize: 12,
|
|
2648
2650
|
color: "var(--text-3)"
|
|
2649
2651
|
},
|
|
2650
|
-
children: [
|
|
2652
|
+
children: [f(s.name), ":"]
|
|
2651
2653
|
}), /* @__PURE__ */ Y("div", {
|
|
2652
2654
|
style: {
|
|
2653
2655
|
minWidth: 180,
|
|
2654
|
-
opacity:
|
|
2655
|
-
pointerEvents:
|
|
2656
|
+
opacity: a ? .6 : 1,
|
|
2657
|
+
pointerEvents: a ? "none" : "auto"
|
|
2656
2658
|
},
|
|
2657
|
-
children: /* @__PURE__ */ Y(
|
|
2658
|
-
value:
|
|
2659
|
+
children: /* @__PURE__ */ Y(n, {
|
|
2660
|
+
value: c ?? "",
|
|
2659
2661
|
options: u,
|
|
2660
|
-
onChange: (t) =>
|
|
2662
|
+
onChange: (t) => r(e, t),
|
|
2661
2663
|
placeholder: "Select…"
|
|
2662
2664
|
})
|
|
2663
2665
|
})]
|
|
@@ -2713,7 +2715,7 @@ function Pt(e) {
|
|
|
2713
2715
|
}
|
|
2714
2716
|
//#endregion
|
|
2715
2717
|
//#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
|
|
2716
|
-
var Ft = "Audit change diff", It = H(() => import("./MonacoJson-
|
|
2718
|
+
var Ft = "Audit change diff", It = H(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonDiff }))), Lt = H(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonSource }))), Rt = H(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
|
|
2717
2719
|
function zt() {
|
|
2718
2720
|
return /* @__PURE__ */ Y("div", {
|
|
2719
2721
|
className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
|