@declarion/react 0.39.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/{DraggableChildrenTable-DziCVhq6.js → DraggableChildrenTable-Ctmn0liO.js} +27 -27
- package/dist-lib/{Grid-BTX2tkCT.js → Grid-BsIkTp3u.js} +42 -42
- package/dist-lib/{LayoutRenderer-CwMERoPJ.js → LayoutRenderer-D4oTfZhV.js} +562 -562
- package/dist-lib/{MarkdownRenderer-dHOTEhUa.js → MarkdownRenderer-B-2CrtjU.js} +1 -1
- package/dist-lib/{RefreshControl--UAgflh7.js → RefreshControl-VQf34HKZ.js} +201 -201
- package/dist-lib/SmartDetailPage.impl-HMaLVDlV.js +1802 -0
- package/dist-lib/{SmartRecordListPage.impl-CZXzVhPC.js → SmartRecordListPage.impl-Cxm7qvlZ.js} +239 -239
- package/dist-lib/components/shared/ActionButton.d.ts +1 -7
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/index.js +1788 -1666
- package/dist-lib/lib/actions.d.ts +27 -0
- package/dist-lib/{registry-DXNFRlbB.js → registry-DFtAh6zc.js} +1798 -2427
- package/dist-lib/testing.js +27 -27
- package/dist-lib/{useCurrentScreen-BA2lb-d7.js → useCurrentScreen-mw8TfE8q.js} +563 -361
- package/dist-lib/{useProperties-Br2DeOQh.js → useProperties-gMdnhdhO.js} +50 -50
- package/dist-lib/{value-C91loRXp.js → value-t9ETvWIJ.js} +4 -4
- package/package.json +1 -1
- package/dist-lib/SmartDetailPage.impl-Bj7MtHxi.js +0 -1827
- package/dist-lib/components/shared/ActionConfirmDialog.d.ts +0 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
|
|
2
|
-
import {
|
|
3
|
-
import { A as M,
|
|
2
|
+
import { $ as n, A as r, An as i, At as a, Dn as o, En as s, Fn as c, Jn as l, Kt as u, M as d, Q as f, Sn as p, Tn as m, Un as h, X as g, ar as _, bn as v, bt as y, er as b, f as x, hn as S, it as C, j as w, jn as T, or as E, sr as D, vt as O, wn as k, xn as A, yt as j } from "./useCurrentScreen-mw8TfE8q.js";
|
|
3
|
+
import { A as M, F as ee, I as N, J as P, L as F, P as I, R as L, T as R, V as z, at as B, d as V, it as te, mt as ne, o as re, pt as ie, q as ae, r as oe, t as se, u as ce, z as le } from "./registry-DFtAh6zc.js";
|
|
4
4
|
import { n as ue, r as de, t as fe } from "./dataTableStyles-vwD1mVOP.js";
|
|
5
5
|
import { Suspense as pe, createContext as me, lazy as he, useCallback as H, useContext as ge, useEffect as U, useId as _e, useLayoutEffect as ve, useMemo as W, useRef as G, useState as K } from "react";
|
|
6
6
|
import { useInfiniteQuery as ye, useMutation as be, useQueryClient as xe } from "@tanstack/react-query";
|
|
@@ -61,16 +61,16 @@ function we({ config: e, ctx: t }) {
|
|
|
61
61
|
}, [u, p]), h = u ?? p(), g = e.height ? Ee(e.height) : void 0;
|
|
62
62
|
return /* @__PURE__ */ J("div", {
|
|
63
63
|
ref: l,
|
|
64
|
-
className:
|
|
64
|
+
className: B("flex", s && "flex-col"),
|
|
65
65
|
style: {
|
|
66
66
|
gap: r ? `${r}px` : void 0,
|
|
67
67
|
...g
|
|
68
68
|
},
|
|
69
69
|
children: n.map((r, a) => /* @__PURE__ */ Y("div", {
|
|
70
|
-
className:
|
|
70
|
+
className: B("min-w-0 flex items-stretch", s && "w-full"),
|
|
71
71
|
style: s ? void 0 : Te(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
|
|
72
72
|
children: [/* @__PURE__ */ J("div", {
|
|
73
|
-
className:
|
|
73
|
+
className: B("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
|
|
74
74
|
children: /* @__PURE__ */ J($, {
|
|
75
75
|
node: r,
|
|
76
76
|
ctx: t
|
|
@@ -123,13 +123,13 @@ function Oe(e) {
|
|
|
123
123
|
function ke(e, t) {
|
|
124
124
|
let n = Oe(e);
|
|
125
125
|
if (n) {
|
|
126
|
-
if (e.label) return
|
|
126
|
+
if (e.label) return m(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 m(r.display.name);
|
|
129
129
|
let i = t.schema.entities[n];
|
|
130
|
-
return i && (
|
|
130
|
+
return i && (m(i.display.name_plural) || m(i.display.name)) || n;
|
|
131
131
|
}
|
|
132
|
-
return e.section ?
|
|
132
|
+
return e.section ? m(e.section.name) : "Tab";
|
|
133
133
|
}
|
|
134
134
|
function Ae(e, t) {
|
|
135
135
|
if (e.icon) return e.icon;
|
|
@@ -144,7 +144,7 @@ function Ae(e, t) {
|
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/components/detail-layout/LayoutTabs.tsx
|
|
146
146
|
function je({ config: e, ctx: n }) {
|
|
147
|
-
let { items: r } = e, [i, a] = K(0), o =
|
|
147
|
+
let { items: r } = e, [i, a] = K(0), o = b(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
|
|
148
148
|
if (r.length === 0) return null;
|
|
149
149
|
if (s === "sections") {
|
|
150
150
|
let e = r.map((e, t) => `detail-tab-section-${t}`);
|
|
@@ -339,12 +339,12 @@ function Me({ config: e, ctx: n }) {
|
|
|
339
339
|
name: s,
|
|
340
340
|
size: 14
|
|
341
341
|
}) : void 0, f = c ? {
|
|
342
|
-
text:
|
|
342
|
+
text: m(c.text),
|
|
343
343
|
tone: c.tone,
|
|
344
344
|
dot: c.dot
|
|
345
345
|
} : void 0;
|
|
346
|
-
return /* @__PURE__ */ J(
|
|
347
|
-
title:
|
|
346
|
+
return /* @__PURE__ */ J(ne, {
|
|
347
|
+
title: m(r),
|
|
348
348
|
defaultOpen: !a,
|
|
349
349
|
icon: d,
|
|
350
350
|
badge: f,
|
|
@@ -383,7 +383,7 @@ function X(e, t, n) {
|
|
|
383
383
|
return e ?? t ?? n;
|
|
384
384
|
}
|
|
385
385
|
function Pe(e) {
|
|
386
|
-
return
|
|
386
|
+
return v(e, "update") ? "inline_edit" : "readonly";
|
|
387
387
|
}
|
|
388
388
|
function Fe(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 Ue(e, ...t) {
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
function We(e) {
|
|
462
|
-
let t =
|
|
462
|
+
let t = k(e);
|
|
463
463
|
return t.length > 0 ? t[0] : void 0;
|
|
464
464
|
}
|
|
465
465
|
function Ge(e, t) {
|
|
@@ -473,7 +473,7 @@ function Ke(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) : o(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;
|
|
@@ -489,26 +489,26 @@ function qe(e, t) {
|
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/components/detail-layout/useQuickAdd.ts
|
|
491
491
|
function Je(e, t, n, r) {
|
|
492
|
-
let [i,
|
|
492
|
+
let [i, a] = K(() => {
|
|
493
493
|
let t = e.quick_add, n = r.entities[e.entity], i = {};
|
|
494
|
-
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] =
|
|
494
|
+
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = f()) : i[e] = t.defaults[e];
|
|
495
495
|
return i;
|
|
496
|
-
}),
|
|
496
|
+
}), o = xe(), { mutate: c, isPending: l, error: u, reset: d } = be({
|
|
497
497
|
mutationFn: (t) => O(e.entity, t),
|
|
498
498
|
onMutate: async (r) => {
|
|
499
499
|
let i = [
|
|
500
|
-
|
|
500
|
+
F,
|
|
501
501
|
t,
|
|
502
|
-
Array.isArray(n) ?
|
|
502
|
+
Array.isArray(n) ? s(n.map(String)) : n,
|
|
503
503
|
e.entity
|
|
504
504
|
];
|
|
505
|
-
await
|
|
506
|
-
let a =
|
|
505
|
+
await o.cancelQueries({ queryKey: i });
|
|
506
|
+
let a = o.getQueriesData({ queryKey: i }), c = {
|
|
507
507
|
...r,
|
|
508
508
|
id: `__optimistic_${crypto.randomUUID()}`,
|
|
509
509
|
__optimistic: !0
|
|
510
510
|
};
|
|
511
|
-
return
|
|
511
|
+
return o.setQueriesData({ queryKey: i }, (e) => {
|
|
512
512
|
if (!e || typeof e != "object") return e;
|
|
513
513
|
if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
|
|
514
514
|
let t = e, [n, ...r] = t.pages;
|
|
@@ -516,7 +516,7 @@ function Je(e, t, n, r) {
|
|
|
516
516
|
...t,
|
|
517
517
|
pages: [{
|
|
518
518
|
...n,
|
|
519
|
-
data: [
|
|
519
|
+
data: [c, ...n.data]
|
|
520
520
|
}, ...r]
|
|
521
521
|
};
|
|
522
522
|
}
|
|
@@ -524,54 +524,54 @@ function Je(e, t, n, r) {
|
|
|
524
524
|
}), { snapshots: a };
|
|
525
525
|
},
|
|
526
526
|
onError: (e, t, n) => {
|
|
527
|
-
if (n?.snapshots) for (let [e, t] of n.snapshots)
|
|
527
|
+
if (n?.snapshots) for (let [e, t] of n.snapshots) o.setQueryData(e, t);
|
|
528
528
|
},
|
|
529
529
|
onSuccess: () => {
|
|
530
530
|
let t = e.quick_add, n = r.entities[e.entity], i = {};
|
|
531
|
-
if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? i[e] =
|
|
532
|
-
|
|
531
|
+
if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? i[e] = f() : i[e] = "" : i[e] = t.defaults[e];
|
|
532
|
+
a(i);
|
|
533
533
|
},
|
|
534
534
|
onSettled: () => {
|
|
535
|
-
let r = Array.isArray(n) ?
|
|
536
|
-
|
|
537
|
-
|
|
535
|
+
let r = Array.isArray(n) ? s(n.map(String)) : n;
|
|
536
|
+
o.invalidateQueries({ queryKey: [
|
|
537
|
+
F,
|
|
538
538
|
t,
|
|
539
539
|
r,
|
|
540
540
|
e.entity
|
|
541
541
|
] });
|
|
542
542
|
}
|
|
543
|
-
}),
|
|
543
|
+
}), p = e.quick_add, m = r.entities[e.entity], h = qe(i, p?.fields.filter((e) => m?.fields.get(e)?.required) ?? []);
|
|
544
544
|
function g(t) {
|
|
545
|
-
if (t.preventDefault(), !
|
|
546
|
-
let r = Ke(i,
|
|
545
|
+
if (t.preventDefault(), !p) return;
|
|
546
|
+
let r = Ke(i, p.defaults, e.foreign_key, n);
|
|
547
547
|
c(r);
|
|
548
548
|
}
|
|
549
549
|
function _(e, t) {
|
|
550
|
-
u && d(),
|
|
550
|
+
u && d(), a((n) => ({
|
|
551
551
|
...n,
|
|
552
552
|
[e]: t
|
|
553
553
|
}));
|
|
554
554
|
}
|
|
555
555
|
return {
|
|
556
556
|
values: i,
|
|
557
|
-
quickAdd:
|
|
558
|
-
childEntity:
|
|
557
|
+
quickAdd: p,
|
|
558
|
+
childEntity: m,
|
|
559
559
|
isPending: l,
|
|
560
560
|
error: u,
|
|
561
|
-
isReady:
|
|
561
|
+
isReady: h,
|
|
562
562
|
handleSubmit: g,
|
|
563
563
|
handleFieldChange: _
|
|
564
564
|
};
|
|
565
565
|
}
|
|
566
566
|
//#endregion
|
|
567
567
|
//#region src/components/detail-layout/QuickAddForm.tsx
|
|
568
|
-
function Ye({ config: t, parentEntity: n, parentId:
|
|
569
|
-
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange:
|
|
568
|
+
function Ye({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
569
|
+
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: m } = Je(t, n, i, a), h = r(), g = b(), _ = _e();
|
|
570
570
|
return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ Y("form", {
|
|
571
571
|
onSubmit: f,
|
|
572
572
|
style: {
|
|
573
573
|
display: "flex",
|
|
574
|
-
flexDirection:
|
|
574
|
+
flexDirection: g.isPhone ? "column" : "row",
|
|
575
575
|
alignItems: "flex-end",
|
|
576
576
|
gap: 8,
|
|
577
577
|
padding: "8px 0",
|
|
@@ -581,12 +581,12 @@ function Ye({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
581
581
|
s.fields.map((e) => {
|
|
582
582
|
let n = c.fields.get(e);
|
|
583
583
|
if (!n) return null;
|
|
584
|
-
let r = `${
|
|
584
|
+
let r = `${_}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
|
|
585
585
|
return /* @__PURE__ */ Y("div", {
|
|
586
586
|
style: {
|
|
587
587
|
flex: 1,
|
|
588
588
|
minWidth: 0,
|
|
589
|
-
width:
|
|
589
|
+
width: g.isPhone ? "100%" : void 0
|
|
590
590
|
},
|
|
591
591
|
children: [/* @__PURE__ */ J("label", {
|
|
592
592
|
id: i,
|
|
@@ -598,27 +598,27 @@ function Ye({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
598
598
|
display: "block",
|
|
599
599
|
fontWeight: 500
|
|
600
600
|
},
|
|
601
|
-
children:
|
|
602
|
-
}),
|
|
601
|
+
children: p(n, e, a.entities)
|
|
602
|
+
}), w({
|
|
603
603
|
field: n,
|
|
604
604
|
fieldName: e,
|
|
605
605
|
value: o[e] ?? "",
|
|
606
606
|
mode: "edit",
|
|
607
|
-
onChange: (t) =>
|
|
607
|
+
onChange: (t) => m(e, t),
|
|
608
608
|
record: o,
|
|
609
609
|
fieldId: r,
|
|
610
610
|
labelId: i,
|
|
611
|
-
locale:
|
|
611
|
+
locale: h
|
|
612
612
|
})]
|
|
613
613
|
}, e);
|
|
614
614
|
}),
|
|
615
|
-
/* @__PURE__ */ J(
|
|
615
|
+
/* @__PURE__ */ J(D, {
|
|
616
616
|
type: "submit",
|
|
617
617
|
kind: "primary",
|
|
618
|
-
size:
|
|
618
|
+
size: g.isPhone ? "md" : "sm",
|
|
619
619
|
icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
|
|
620
620
|
disabled: l || !d,
|
|
621
|
-
style:
|
|
621
|
+
style: g.isPhone ? { alignSelf: "flex-end" } : void 0,
|
|
622
622
|
children: "Add"
|
|
623
623
|
}),
|
|
624
624
|
u != null && /* @__PURE__ */ J("span", {
|
|
@@ -639,10 +639,10 @@ function Xe(e, t, n) {
|
|
|
639
639
|
return `${e}::child::${t}.${n}`;
|
|
640
640
|
}
|
|
641
641
|
function Ze(e) {
|
|
642
|
-
return Math.min(
|
|
642
|
+
return Math.min(le, Math.max(60, Math.round(e)));
|
|
643
643
|
}
|
|
644
644
|
function Qe(e) {
|
|
645
|
-
let { widths: t, setWidths: n, resetWidths: r } =
|
|
645
|
+
let { widths: t, setWidths: n, resetWidths: r } = z(e), [i, a] = K({}), o = G(null);
|
|
646
646
|
U(() => {
|
|
647
647
|
let e = (e) => {
|
|
648
648
|
let t = o.current;
|
|
@@ -726,33 +726,33 @@ function $e({ colId: e, onMouseDown: t }) {
|
|
|
726
726
|
//#endregion
|
|
727
727
|
//#region src/components/detail-layout/ChildrenTable.tsx
|
|
728
728
|
function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
729
|
-
let
|
|
730
|
-
|
|
731
|
-
let
|
|
729
|
+
let o = a.entities[t.entity], s = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, u = Qe(Xe(n, t.entity, s)), f = r(), m = N((e) => e.degradedEntities), { data: h, isLoading: g, isError: v, isFetching: y, refetch: b } = L(n, i, t.entity, t.foreign_key, t.sort, t.limit), x = h?.data ?? [], S = h?.$refs, C = G(S);
|
|
730
|
+
C.current = S;
|
|
731
|
+
let w = t.columns, D = t.interaction === "navigate", O = w[0], k = D && o ? T(void 0, o, a.screens) : null, A = o ? We(o) : void 0, j = W(() => {
|
|
732
732
|
let e = /* @__PURE__ */ new Map();
|
|
733
|
-
if (!
|
|
734
|
-
for (let t of
|
|
735
|
-
let n =
|
|
733
|
+
if (!o) return e;
|
|
734
|
+
for (let t of w) {
|
|
735
|
+
let n = o.fields.get(t);
|
|
736
736
|
n && e.set(t, d({
|
|
737
737
|
field: n,
|
|
738
738
|
fieldName: t,
|
|
739
739
|
surface: "list",
|
|
740
|
-
entity:
|
|
740
|
+
entity: o,
|
|
741
741
|
entities: a.entities,
|
|
742
742
|
screens: a.screens,
|
|
743
|
-
refs: () =>
|
|
743
|
+
refs: () => C.current,
|
|
744
744
|
locale: f
|
|
745
745
|
}));
|
|
746
746
|
}
|
|
747
747
|
return e;
|
|
748
748
|
}, [
|
|
749
|
-
|
|
750
|
-
|
|
749
|
+
o,
|
|
750
|
+
w,
|
|
751
751
|
a.entities,
|
|
752
752
|
a.screens,
|
|
753
753
|
f
|
|
754
754
|
]);
|
|
755
|
-
if (!
|
|
755
|
+
if (!o) return /* @__PURE__ */ J("div", {
|
|
756
756
|
style: {
|
|
757
757
|
fontSize: 12.5,
|
|
758
758
|
color: "var(--text-3)",
|
|
@@ -765,7 +765,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
765
765
|
parentEntity: n,
|
|
766
766
|
parentId: i,
|
|
767
767
|
schema: a
|
|
768
|
-
}),
|
|
768
|
+
}), P = ee(o.realtime, m, t.entity), F = /* @__PURE__ */ Y("div", {
|
|
769
769
|
style: {
|
|
770
770
|
display: "flex",
|
|
771
771
|
alignItems: "center",
|
|
@@ -774,40 +774,40 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
774
774
|
justifyContent: "flex-end"
|
|
775
775
|
},
|
|
776
776
|
children: [
|
|
777
|
-
|
|
777
|
+
u.hasWidths && /* @__PURE__ */ J(E, {
|
|
778
778
|
icon: /* @__PURE__ */ J(e.columns, { size: 13 }),
|
|
779
779
|
title: "Reset column widths (this device)",
|
|
780
780
|
size: 24,
|
|
781
|
-
onClick:
|
|
781
|
+
onClick: u.resetWidths
|
|
782
782
|
}),
|
|
783
|
-
|
|
783
|
+
P && /* @__PURE__ */ J("span", {
|
|
784
784
|
"data-testid": "children-live-indicator",
|
|
785
785
|
title: "This table updates automatically in realtime.",
|
|
786
|
-
children: /* @__PURE__ */ J(
|
|
786
|
+
children: /* @__PURE__ */ J(_, {
|
|
787
787
|
tone: "emerald",
|
|
788
788
|
size: "xs",
|
|
789
789
|
dot: !0,
|
|
790
790
|
children: "Live"
|
|
791
791
|
})
|
|
792
792
|
}),
|
|
793
|
-
/* @__PURE__ */ J(
|
|
794
|
-
icon:
|
|
793
|
+
/* @__PURE__ */ J(E, {
|
|
794
|
+
icon: y ? /* @__PURE__ */ J("span", {
|
|
795
795
|
"data-testid": "children-refresh-spinner",
|
|
796
796
|
style: { display: "inline-flex" },
|
|
797
|
-
children: /* @__PURE__ */ J(
|
|
797
|
+
children: /* @__PURE__ */ J(l, { size: 13 })
|
|
798
798
|
}) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
|
|
799
799
|
title: "Refresh",
|
|
800
800
|
size: 24,
|
|
801
|
-
disabled:
|
|
801
|
+
disabled: y,
|
|
802
802
|
onClick: () => {
|
|
803
|
-
|
|
803
|
+
b();
|
|
804
804
|
}
|
|
805
805
|
})
|
|
806
806
|
]
|
|
807
807
|
});
|
|
808
|
-
return
|
|
808
|
+
return v ? /* @__PURE__ */ Y("div", { children: [
|
|
809
809
|
M,
|
|
810
|
-
|
|
810
|
+
F,
|
|
811
811
|
/* @__PURE__ */ J("div", {
|
|
812
812
|
style: {
|
|
813
813
|
fontSize: 12.5,
|
|
@@ -818,7 +818,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
818
818
|
})
|
|
819
819
|
] }) : g ? /* @__PURE__ */ Y("div", { children: [
|
|
820
820
|
M,
|
|
821
|
-
|
|
821
|
+
F,
|
|
822
822
|
/* @__PURE__ */ J("div", {
|
|
823
823
|
style: {
|
|
824
824
|
display: "flex",
|
|
@@ -836,9 +836,9 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
836
836
|
borderRadius: 4
|
|
837
837
|
} }, e))
|
|
838
838
|
})
|
|
839
|
-
] }) :
|
|
839
|
+
] }) : x.length === 0 ? /* @__PURE__ */ Y("div", { children: [
|
|
840
840
|
M,
|
|
841
|
-
|
|
841
|
+
F,
|
|
842
842
|
/* @__PURE__ */ J("div", {
|
|
843
843
|
style: {
|
|
844
844
|
fontSize: 12.5,
|
|
@@ -849,27 +849,27 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
849
849
|
})
|
|
850
850
|
] }) : /* @__PURE__ */ Y("div", { children: [
|
|
851
851
|
M,
|
|
852
|
-
|
|
852
|
+
F,
|
|
853
853
|
/* @__PURE__ */ J("div", {
|
|
854
854
|
style: { overflowX: "auto" },
|
|
855
855
|
children: /* @__PURE__ */ Y("table", {
|
|
856
856
|
style: de,
|
|
857
|
-
children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children:
|
|
858
|
-
let t =
|
|
857
|
+
children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: w.map((e) => {
|
|
858
|
+
let t = o.fields.get(e);
|
|
859
859
|
return /* @__PURE__ */ Y("th", {
|
|
860
|
-
style:
|
|
861
|
-
children: [t ?
|
|
860
|
+
style: u.headerStyle(e, ue),
|
|
861
|
+
children: [t ? p(t, e, a.entities) : e, /* @__PURE__ */ J($e, {
|
|
862
862
|
colId: e,
|
|
863
|
-
onMouseDown:
|
|
863
|
+
onMouseDown: u.onHandleMouseDown
|
|
864
864
|
})]
|
|
865
865
|
}, e);
|
|
866
|
-
}) }) }), /* @__PURE__ */ J("tbody", { children:
|
|
867
|
-
let n = A ?
|
|
868
|
-
return /* @__PURE__ */ J("tr", { children:
|
|
869
|
-
let n = t ===
|
|
866
|
+
}) }) }), /* @__PURE__ */ J("tbody", { children: x.map((e, t) => {
|
|
867
|
+
let n = A ? c(e[A]) : "", r = D && k && n ? k.replace(/:\w+/, n) : void 0;
|
|
868
|
+
return /* @__PURE__ */ J("tr", { children: w.map((t) => {
|
|
869
|
+
let n = t === O, i = j.get(t), a = i ? i(e[t], e) : c(e[t]);
|
|
870
870
|
return /* @__PURE__ */ J("td", {
|
|
871
871
|
title: typeof a == "string" ? a : void 0,
|
|
872
|
-
style:
|
|
872
|
+
style: u.cellStyle(t, fe),
|
|
873
873
|
children: n && r ? /* @__PURE__ */ J("a", {
|
|
874
874
|
href: r,
|
|
875
875
|
style: {
|
|
@@ -882,7 +882,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
882
882
|
children: a
|
|
883
883
|
}) : a
|
|
884
884
|
}, t);
|
|
885
|
-
}) },
|
|
885
|
+
}) }, c(e.id ?? t));
|
|
886
886
|
}) })]
|
|
887
887
|
})
|
|
888
888
|
})
|
|
@@ -890,9 +890,9 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
890
890
|
}
|
|
891
891
|
//#endregion
|
|
892
892
|
//#region src/components/detail-layout/ChildrenList.tsx
|
|
893
|
-
function tt({ config: e, parentEntity: t, parentId: n, schema:
|
|
894
|
-
let
|
|
895
|
-
if (!
|
|
893
|
+
function tt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
894
|
+
let a = i.entities[e.entity], o = r(), { data: s, isLoading: l, isError: u } = L(t, n, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns;
|
|
895
|
+
if (!a) return /* @__PURE__ */ J("div", {
|
|
896
896
|
style: {
|
|
897
897
|
fontSize: 12.5,
|
|
898
898
|
color: "var(--text-3)",
|
|
@@ -900,13 +900,13 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
900
900
|
},
|
|
901
901
|
children: "Entity not found."
|
|
902
902
|
});
|
|
903
|
-
let
|
|
903
|
+
let m = /* @__PURE__ */ J(Ye, {
|
|
904
904
|
config: e,
|
|
905
905
|
parentEntity: t,
|
|
906
906
|
parentId: n,
|
|
907
|
-
schema:
|
|
907
|
+
schema: i
|
|
908
908
|
});
|
|
909
|
-
if (
|
|
909
|
+
if (u) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
|
|
910
910
|
style: {
|
|
911
911
|
fontSize: 12.5,
|
|
912
912
|
color: "var(--danger)",
|
|
@@ -914,7 +914,7 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
914
914
|
},
|
|
915
915
|
children: "Failed to load. Try again."
|
|
916
916
|
})] });
|
|
917
|
-
if (
|
|
917
|
+
if (l) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ Y("div", {
|
|
918
918
|
style: {
|
|
919
919
|
display: "flex",
|
|
920
920
|
flexDirection: "column",
|
|
@@ -940,7 +940,7 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
940
940
|
} })
|
|
941
941
|
]
|
|
942
942
|
})] });
|
|
943
|
-
if (
|
|
943
|
+
if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
|
|
944
944
|
style: {
|
|
945
945
|
fontSize: 12.5,
|
|
946
946
|
color: "var(--text-3)",
|
|
@@ -948,13 +948,13 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
948
948
|
},
|
|
949
949
|
children: "No records yet."
|
|
950
950
|
})] });
|
|
951
|
-
let
|
|
952
|
-
return /* @__PURE__ */ Y("div", { children: [
|
|
951
|
+
let h = p.length > 0 ? a.display.display_field ?? p[0] : a.display.display_field;
|
|
952
|
+
return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
|
|
953
953
|
style: {
|
|
954
954
|
display: "flex",
|
|
955
955
|
flexDirection: "column"
|
|
956
956
|
},
|
|
957
|
-
children:
|
|
957
|
+
children: d.map((e, t) => /* @__PURE__ */ J("div", {
|
|
958
958
|
style: {
|
|
959
959
|
display: "flex",
|
|
960
960
|
alignItems: "center",
|
|
@@ -974,17 +974,17 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
974
974
|
textOverflow: "ellipsis",
|
|
975
975
|
whiteSpace: "nowrap"
|
|
976
976
|
},
|
|
977
|
-
children: (typeof e.$display == "string" ? e[
|
|
978
|
-
field:
|
|
979
|
-
fieldName:
|
|
980
|
-
value: e[
|
|
977
|
+
children: (typeof e.$display == "string" ? e[S] : "") || (h && a.fields.get(h) ? w({
|
|
978
|
+
field: a.fields.get(h),
|
|
979
|
+
fieldName: h,
|
|
980
|
+
value: e[h],
|
|
981
981
|
mode: "display",
|
|
982
982
|
record: e,
|
|
983
|
-
refs:
|
|
984
|
-
locale:
|
|
985
|
-
}) :
|
|
986
|
-
}),
|
|
987
|
-
let t =
|
|
983
|
+
refs: f,
|
|
984
|
+
locale: o
|
|
985
|
+
}) : h && e[h] != null ? c(e[h]) : null)
|
|
986
|
+
}), p.length > 1 && (() => {
|
|
987
|
+
let t = p.slice(1, 3).filter((t) => e[t] != null);
|
|
988
988
|
return t.length === 0 ? null : /* @__PURE__ */ J("div", {
|
|
989
989
|
style: {
|
|
990
990
|
fontSize: 11.5,
|
|
@@ -993,26 +993,26 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
993
993
|
textOverflow: "ellipsis",
|
|
994
994
|
whiteSpace: "nowrap"
|
|
995
995
|
},
|
|
996
|
-
children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ",
|
|
997
|
-
field:
|
|
996
|
+
children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", a.fields.get(t) ? w({
|
|
997
|
+
field: a.fields.get(t),
|
|
998
998
|
fieldName: t,
|
|
999
999
|
value: e[t],
|
|
1000
1000
|
mode: "display",
|
|
1001
1001
|
record: e,
|
|
1002
|
-
refs:
|
|
1003
|
-
locale:
|
|
1002
|
+
refs: f,
|
|
1003
|
+
locale: o
|
|
1004
1004
|
}) : String(e[t])] }, t))
|
|
1005
1005
|
});
|
|
1006
1006
|
})()]
|
|
1007
1007
|
})
|
|
1008
|
-
},
|
|
1008
|
+
}, c(e.id ?? t)))
|
|
1009
1009
|
})] });
|
|
1010
1010
|
}
|
|
1011
1011
|
//#endregion
|
|
1012
1012
|
//#region src/components/detail-layout/ChildrenCards.tsx
|
|
1013
|
-
function nt({ config: e, parentEntity: t, parentId: n, schema:
|
|
1014
|
-
let
|
|
1015
|
-
if (!
|
|
1013
|
+
function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
1014
|
+
let a = i.entities[e.entity], o = r(), { data: s, isLoading: l, isError: u } = L(t, n, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns, m = e.cards, h = m?.header_field ?? p[0], g = m?.badge_field, v = m?.columns_count ?? 3;
|
|
1015
|
+
if (!a) return /* @__PURE__ */ J("div", {
|
|
1016
1016
|
style: {
|
|
1017
1017
|
fontSize: 12.5,
|
|
1018
1018
|
color: "var(--text-3)",
|
|
@@ -1022,15 +1022,15 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1022
1022
|
});
|
|
1023
1023
|
let y = {
|
|
1024
1024
|
display: "grid",
|
|
1025
|
-
gridTemplateColumns: `repeat(auto-fill, minmax(${
|
|
1025
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${v >= 4 ? 180 : 240}px, 1fr))`,
|
|
1026
1026
|
gap: 12
|
|
1027
|
-
},
|
|
1027
|
+
}, b = /* @__PURE__ */ J(Ye, {
|
|
1028
1028
|
config: e,
|
|
1029
1029
|
parentEntity: t,
|
|
1030
1030
|
parentId: n,
|
|
1031
|
-
schema:
|
|
1031
|
+
schema: i
|
|
1032
1032
|
});
|
|
1033
|
-
if (
|
|
1033
|
+
if (u) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
|
|
1034
1034
|
style: {
|
|
1035
1035
|
fontSize: 12.5,
|
|
1036
1036
|
color: "var(--danger)",
|
|
@@ -1038,7 +1038,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1038
1038
|
},
|
|
1039
1039
|
children: "Failed to load. Try again."
|
|
1040
1040
|
})] });
|
|
1041
|
-
if (
|
|
1041
|
+
if (l) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
|
|
1042
1042
|
style: y,
|
|
1043
1043
|
children: [
|
|
1044
1044
|
0,
|
|
@@ -1050,7 +1050,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1050
1050
|
borderRadius: 10
|
|
1051
1051
|
} }, e))
|
|
1052
1052
|
})] });
|
|
1053
|
-
if (
|
|
1053
|
+
if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
|
|
1054
1054
|
style: {
|
|
1055
1055
|
fontSize: 12.5,
|
|
1056
1056
|
color: "var(--text-3)",
|
|
@@ -1058,10 +1058,10 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1058
1058
|
},
|
|
1059
1059
|
children: "No records yet."
|
|
1060
1060
|
})] });
|
|
1061
|
-
let
|
|
1062
|
-
return /* @__PURE__ */ Y("div", { children: [
|
|
1061
|
+
let x = p.filter((e) => e !== h && e !== g);
|
|
1062
|
+
return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
|
|
1063
1063
|
style: y,
|
|
1064
|
-
children:
|
|
1064
|
+
children: d.map((t, n) => /* @__PURE__ */ Y("div", {
|
|
1065
1065
|
style: {
|
|
1066
1066
|
background: "var(--surface)",
|
|
1067
1067
|
border: "1px solid var(--border)",
|
|
@@ -1075,7 +1075,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1075
1075
|
alignItems: "center",
|
|
1076
1076
|
justifyContent: "space-between",
|
|
1077
1077
|
gap: 8,
|
|
1078
|
-
borderBottom:
|
|
1078
|
+
borderBottom: x.length > 0 ? "1px solid var(--divider)" : "none"
|
|
1079
1079
|
},
|
|
1080
1080
|
children: [/* @__PURE__ */ J("div", {
|
|
1081
1081
|
style: {
|
|
@@ -1085,38 +1085,38 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1085
1085
|
textOverflow: "ellipsis",
|
|
1086
1086
|
whiteSpace: "nowrap"
|
|
1087
1087
|
},
|
|
1088
|
-
children: h &&
|
|
1089
|
-
field:
|
|
1088
|
+
children: h && a.fields.get(h) ? w({
|
|
1089
|
+
field: a.fields.get(h),
|
|
1090
1090
|
fieldName: h,
|
|
1091
1091
|
value: t[h],
|
|
1092
1092
|
mode: "display",
|
|
1093
1093
|
record: t,
|
|
1094
|
-
refs:
|
|
1095
|
-
locale:
|
|
1094
|
+
refs: f,
|
|
1095
|
+
locale: o
|
|
1096
1096
|
}) : `Record ${n + 1}`
|
|
1097
|
-
}), g && t[g] != null && /* @__PURE__ */ J(
|
|
1097
|
+
}), g && t[g] != null && /* @__PURE__ */ J(_, {
|
|
1098
1098
|
tone: "slate",
|
|
1099
1099
|
size: "xs",
|
|
1100
|
-
children:
|
|
1101
|
-
field:
|
|
1100
|
+
children: a.fields.get(g) ? w({
|
|
1101
|
+
field: a.fields.get(g),
|
|
1102
1102
|
fieldName: g,
|
|
1103
1103
|
value: t[g],
|
|
1104
1104
|
mode: "display",
|
|
1105
1105
|
record: t,
|
|
1106
|
-
refs:
|
|
1107
|
-
locale:
|
|
1108
|
-
}) :
|
|
1106
|
+
refs: f,
|
|
1107
|
+
locale: o
|
|
1108
|
+
}) : c(t[g])
|
|
1109
1109
|
})]
|
|
1110
|
-
}),
|
|
1110
|
+
}), x.length > 0 && /* @__PURE__ */ J("div", {
|
|
1111
1111
|
style: {
|
|
1112
1112
|
padding: "10px 14px",
|
|
1113
1113
|
display: "flex",
|
|
1114
1114
|
flexDirection: "column",
|
|
1115
1115
|
gap: 4
|
|
1116
1116
|
},
|
|
1117
|
-
children:
|
|
1118
|
-
let
|
|
1119
|
-
return
|
|
1117
|
+
children: x.slice(0, 4).map((n) => {
|
|
1118
|
+
let r = a.fields.get(n);
|
|
1119
|
+
return r ? /* @__PURE__ */ Y("div", {
|
|
1120
1120
|
style: {
|
|
1121
1121
|
display: "flex",
|
|
1122
1122
|
alignItems: "baseline",
|
|
@@ -1128,100 +1128,100 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1128
1128
|
color: "var(--text-3)",
|
|
1129
1129
|
flexShrink: 0
|
|
1130
1130
|
},
|
|
1131
|
-
children: [
|
|
1131
|
+
children: [i.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(i.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
|
|
1132
1132
|
}), /* @__PURE__ */ J("span", {
|
|
1133
1133
|
style: {
|
|
1134
1134
|
overflow: "hidden",
|
|
1135
1135
|
textOverflow: "ellipsis",
|
|
1136
1136
|
whiteSpace: "nowrap"
|
|
1137
1137
|
},
|
|
1138
|
-
children:
|
|
1139
|
-
field:
|
|
1138
|
+
children: w({
|
|
1139
|
+
field: r,
|
|
1140
1140
|
fieldName: n,
|
|
1141
1141
|
value: t[n],
|
|
1142
1142
|
mode: "display",
|
|
1143
1143
|
record: t,
|
|
1144
|
-
refs:
|
|
1145
|
-
locale:
|
|
1144
|
+
refs: f,
|
|
1145
|
+
locale: o
|
|
1146
1146
|
})
|
|
1147
1147
|
})]
|
|
1148
1148
|
}, n) : null;
|
|
1149
1149
|
})
|
|
1150
1150
|
})]
|
|
1151
|
-
},
|
|
1151
|
+
}, c(t.id ?? n)))
|
|
1152
1152
|
})] });
|
|
1153
1153
|
}
|
|
1154
1154
|
//#endregion
|
|
1155
1155
|
//#region src/hooks/useTimelineData.ts
|
|
1156
1156
|
var rt = 50;
|
|
1157
1157
|
function it(e, t, n, r, i, a) {
|
|
1158
|
-
let
|
|
1158
|
+
let s = Array.isArray(r) ? r : [r], c = Array.isArray(r) ? o(t, s.length) : [t], l = a ?? rt, d = ye({
|
|
1159
1159
|
queryKey: [
|
|
1160
|
-
|
|
1160
|
+
F,
|
|
1161
1161
|
e,
|
|
1162
1162
|
t,
|
|
1163
1163
|
n,
|
|
1164
1164
|
"timeline",
|
|
1165
1165
|
i,
|
|
1166
|
-
|
|
1166
|
+
l
|
|
1167
1167
|
],
|
|
1168
1168
|
queryFn: ({ pageParam: e }) => {
|
|
1169
1169
|
let t = new URLSearchParams();
|
|
1170
|
-
if (!
|
|
1171
|
-
let r =
|
|
1170
|
+
if (!c) throw Error("invalid composite parent id");
|
|
1171
|
+
let r = s.map((e, t) => ({
|
|
1172
1172
|
field: e,
|
|
1173
1173
|
op: "eq",
|
|
1174
|
-
value:
|
|
1174
|
+
value: c[t]
|
|
1175
1175
|
}));
|
|
1176
|
-
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(
|
|
1176
|
+
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(l)), e && t.set("after", e), u(`/api/data/${n}?${t.toString()}`);
|
|
1177
1177
|
},
|
|
1178
1178
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
1179
1179
|
initialPageParam: void 0,
|
|
1180
|
-
enabled: !!e && !!t && !!n && !!r &&
|
|
1180
|
+
enabled: !!e && !!t && !!n && !!r && c !== null
|
|
1181
1181
|
});
|
|
1182
1182
|
return {
|
|
1183
|
-
rows: W(() =>
|
|
1184
|
-
refs:
|
|
1185
|
-
fetchNextPage:
|
|
1186
|
-
hasOlder: !!
|
|
1187
|
-
isFetchingOlder:
|
|
1188
|
-
isLoading:
|
|
1189
|
-
isError:
|
|
1183
|
+
rows: W(() => d.data?.pages.flatMap((e) => e.data) ?? [], [d.data?.pages]),
|
|
1184
|
+
refs: d.data?.pages[0]?.$refs,
|
|
1185
|
+
fetchNextPage: d.fetchNextPage,
|
|
1186
|
+
hasOlder: !!d.hasNextPage,
|
|
1187
|
+
isFetchingOlder: d.isFetchingNextPage,
|
|
1188
|
+
isLoading: d.isLoading,
|
|
1189
|
+
isError: d.isError
|
|
1190
1190
|
};
|
|
1191
1191
|
}
|
|
1192
1192
|
//#endregion
|
|
1193
1193
|
//#region src/components/detail-layout/TimelineComposer.tsx
|
|
1194
1194
|
var at = "quick_entry", ot = 100, st = 240, ct = 800, lt = 80;
|
|
1195
|
-
function ut({ config: t, parentEntity: n, parentId:
|
|
1196
|
-
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n,
|
|
1195
|
+
function ut({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
1196
|
+
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n, i, a), m = r(), [h, g] = K(st), _ = G(null), v = G(null), [y, b] = K(ct);
|
|
1197
1197
|
U(() => {
|
|
1198
|
-
let e =
|
|
1198
|
+
let e = v.current?.parentElement;
|
|
1199
1199
|
if (!e) return;
|
|
1200
1200
|
let t = () => {
|
|
1201
1201
|
let t = Math.max(ot, e.clientHeight - lt);
|
|
1202
|
-
|
|
1202
|
+
b(Math.min(ct, t));
|
|
1203
1203
|
};
|
|
1204
1204
|
t();
|
|
1205
1205
|
let n = new ResizeObserver(t);
|
|
1206
1206
|
return n.observe(e), () => n.disconnect();
|
|
1207
1207
|
}, []), U(() => {
|
|
1208
|
-
g((e) => Math.min(e,
|
|
1209
|
-
}, [
|
|
1210
|
-
let
|
|
1211
|
-
|
|
1212
|
-
let
|
|
1213
|
-
|
|
1214
|
-
let T = G({}),
|
|
1215
|
-
getField: (e) =>
|
|
1208
|
+
g((e) => Math.min(e, y));
|
|
1209
|
+
}, [y]);
|
|
1210
|
+
let S = G(o);
|
|
1211
|
+
S.current = o;
|
|
1212
|
+
let C = G(p);
|
|
1213
|
+
C.current = p;
|
|
1214
|
+
let T = G({}), E = W(() => ({
|
|
1215
|
+
getField: (e) => S.current[e],
|
|
1216
1216
|
setField: (e, t) => {
|
|
1217
|
-
|
|
1217
|
+
C.current(e, t);
|
|
1218
1218
|
},
|
|
1219
1219
|
focusField: (e) => {
|
|
1220
1220
|
let t = T.current[e];
|
|
1221
1221
|
t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
|
|
1222
1222
|
}
|
|
1223
1223
|
}), []);
|
|
1224
|
-
U(() =>
|
|
1224
|
+
U(() => x(at, E), [E]);
|
|
1225
1225
|
let O = H((e) => {
|
|
1226
1226
|
e.preventDefault(), _.current = {
|
|
1227
1227
|
startY: e.clientY,
|
|
@@ -1229,13 +1229,13 @@ function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1229
1229
|
};
|
|
1230
1230
|
let t = (e) => {
|
|
1231
1231
|
if (!_.current) return;
|
|
1232
|
-
let t = _.current.startY - e.clientY, n = Math.min(
|
|
1232
|
+
let t = _.current.startY - e.clientY, n = Math.min(y, Math.max(ot, _.current.startHeight + t));
|
|
1233
1233
|
g(n);
|
|
1234
1234
|
}, n = () => {
|
|
1235
1235
|
_.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
1236
1236
|
};
|
|
1237
1237
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
1238
|
-
}, [h,
|
|
1238
|
+
}, [h, y]);
|
|
1239
1239
|
if (!s || s.fields.length === 0 || !c) return null;
|
|
1240
1240
|
let k = s.fields.find((e) => {
|
|
1241
1241
|
let t = c.fields.get(e);
|
|
@@ -1252,7 +1252,7 @@ function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1252
1252
|
ref: (t) => {
|
|
1253
1253
|
T.current[e] = t;
|
|
1254
1254
|
},
|
|
1255
|
-
children:
|
|
1255
|
+
children: w({
|
|
1256
1256
|
field: t,
|
|
1257
1257
|
fieldName: e,
|
|
1258
1258
|
value: o[e] ?? "",
|
|
@@ -1264,7 +1264,7 @@ function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1264
1264
|
}, e) : null;
|
|
1265
1265
|
};
|
|
1266
1266
|
return /* @__PURE__ */ Y("div", {
|
|
1267
|
-
ref:
|
|
1267
|
+
ref: v,
|
|
1268
1268
|
style: {
|
|
1269
1269
|
flexShrink: 0,
|
|
1270
1270
|
borderTop: "1px solid var(--divider)",
|
|
@@ -1323,7 +1323,7 @@ function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1323
1323
|
ref: (e) => {
|
|
1324
1324
|
T.current[k] = e;
|
|
1325
1325
|
},
|
|
1326
|
-
children:
|
|
1326
|
+
children: w({
|
|
1327
1327
|
field: c.fields.get(k),
|
|
1328
1328
|
fieldName: k,
|
|
1329
1329
|
value: o[k] ?? "",
|
|
@@ -1365,7 +1365,7 @@ function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1365
1365
|
}),
|
|
1366
1366
|
" to add"
|
|
1367
1367
|
]
|
|
1368
|
-
}), /* @__PURE__ */ J(
|
|
1368
|
+
}), /* @__PURE__ */ J(D, {
|
|
1369
1369
|
type: "submit",
|
|
1370
1370
|
kind: "primary",
|
|
1371
1371
|
icon: /* @__PURE__ */ J(e.plus, { size: 13 }),
|
|
@@ -1393,29 +1393,29 @@ var dt = 80, ft = 200;
|
|
|
1393
1393
|
function pt(e, t) {
|
|
1394
1394
|
if (mt(t)) {
|
|
1395
1395
|
let e = t.id;
|
|
1396
|
-
return e == null ? "" :
|
|
1396
|
+
return e == null ? "" : c(e);
|
|
1397
1397
|
}
|
|
1398
|
-
return
|
|
1398
|
+
return y(A(e, t));
|
|
1399
1399
|
}
|
|
1400
1400
|
function mt(e) {
|
|
1401
1401
|
return e.__optimistic === !0;
|
|
1402
1402
|
}
|
|
1403
1403
|
function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1404
|
-
let
|
|
1404
|
+
let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: u, isLoading: d, isError: f } = it(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), p = e.timeline, h = p?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = W(() => g ? [...a].reverse() : a, [a, g]), v = p?.auto_scroll ?? "none", y = G(null), b = G(null), x = G(!1), S = G(0), C = G(null), w = G(null), T = G(!0), E = G(null);
|
|
1405
1405
|
U(() => {
|
|
1406
1406
|
x.current = !1, S.current = 0, C.current = null, w.current = null, T.current = !0, E.current = null;
|
|
1407
1407
|
}, [n]), ve(() => {
|
|
1408
|
-
!
|
|
1408
|
+
!u || !y.current || (E.current = {
|
|
1409
1409
|
scrollHeight: y.current.scrollHeight,
|
|
1410
1410
|
scrollTop: y.current.scrollTop
|
|
1411
1411
|
});
|
|
1412
|
-
}, [
|
|
1412
|
+
}, [u]), ve(() => {
|
|
1413
1413
|
let e = y.current;
|
|
1414
|
-
if (!e || _.length === 0 || !
|
|
1414
|
+
if (!e || _.length === 0 || !i) {
|
|
1415
1415
|
S.current = _.length;
|
|
1416
1416
|
return;
|
|
1417
1417
|
}
|
|
1418
|
-
let t = pt(
|
|
1418
|
+
let t = pt(i, _[0]), n = pt(i, _[_.length - 1]), r = !x.current, a = _.length > S.current && S.current > 0, o = a && (g && t !== C.current && n === w.current || !g && n !== w.current && t === C.current), s = a && !o;
|
|
1419
1419
|
if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
|
|
1420
1420
|
else if (o && E.current) {
|
|
1421
1421
|
let t = E.current;
|
|
@@ -1426,9 +1426,9 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1426
1426
|
_,
|
|
1427
1427
|
v,
|
|
1428
1428
|
g,
|
|
1429
|
-
|
|
1429
|
+
i
|
|
1430
1430
|
]);
|
|
1431
|
-
let
|
|
1431
|
+
let O = H(() => {
|
|
1432
1432
|
let e = y.current;
|
|
1433
1433
|
e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight < dt);
|
|
1434
1434
|
}, []);
|
|
@@ -1436,7 +1436,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1436
1436
|
let e = b.current;
|
|
1437
1437
|
if (!e || typeof IntersectionObserver > "u") return;
|
|
1438
1438
|
let t = new IntersectionObserver((e) => {
|
|
1439
|
-
for (let t of e) t.isIntersecting &&
|
|
1439
|
+
for (let t of e) t.isIntersecting && c && !u && s();
|
|
1440
1440
|
}, {
|
|
1441
1441
|
root: y.current ?? null,
|
|
1442
1442
|
rootMargin: `${ft}px 0px 0px 0px`,
|
|
@@ -1444,12 +1444,12 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1444
1444
|
});
|
|
1445
1445
|
return t.observe(e), () => t.disconnect();
|
|
1446
1446
|
}, [
|
|
1447
|
+
c,
|
|
1447
1448
|
u,
|
|
1448
|
-
|
|
1449
|
-
l
|
|
1449
|
+
s
|
|
1450
1450
|
]);
|
|
1451
|
-
let [
|
|
1452
|
-
if (!
|
|
1451
|
+
let [k, A] = K(null);
|
|
1452
|
+
if (!i) return /* @__PURE__ */ J("div", {
|
|
1453
1453
|
style: {
|
|
1454
1454
|
fontSize: 12.5,
|
|
1455
1455
|
color: "var(--text-3)",
|
|
@@ -1457,25 +1457,25 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1457
1457
|
},
|
|
1458
1458
|
children: "Entity not found."
|
|
1459
1459
|
});
|
|
1460
|
-
let j = e.quick_add?.fields ?? [
|
|
1460
|
+
let j = e.quick_add?.fields ?? [p?.content_field].filter(Boolean), M = m(i.display?.name_plural) || m(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ J("div", {
|
|
1461
1461
|
style: {
|
|
1462
1462
|
display: "flex",
|
|
1463
1463
|
justifyContent: "center",
|
|
1464
1464
|
padding: "6px 0"
|
|
1465
1465
|
},
|
|
1466
|
-
children: /* @__PURE__ */ J(
|
|
1466
|
+
children: /* @__PURE__ */ J(D, {
|
|
1467
1467
|
size: "xs",
|
|
1468
|
-
onClick: () =>
|
|
1469
|
-
disabled:
|
|
1470
|
-
icon:
|
|
1471
|
-
children:
|
|
1468
|
+
onClick: () => s(),
|
|
1469
|
+
disabled: u,
|
|
1470
|
+
icon: u ? /* @__PURE__ */ J(l, { size: 11 }) : void 0,
|
|
1471
|
+
children: u ? "Loading…" : "Load older"
|
|
1472
1472
|
})
|
|
1473
|
-
}) : null,
|
|
1473
|
+
}) : null, N = /* @__PURE__ */ J("div", {
|
|
1474
1474
|
ref: b,
|
|
1475
1475
|
"aria-hidden": "true",
|
|
1476
1476
|
style: { height: 1 }
|
|
1477
|
-
}),
|
|
1478
|
-
if (
|
|
1477
|
+
}), P;
|
|
1478
|
+
if (f) P = /* @__PURE__ */ J("div", {
|
|
1479
1479
|
style: {
|
|
1480
1480
|
fontSize: 12.5,
|
|
1481
1481
|
color: "var(--danger)",
|
|
@@ -1483,7 +1483,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1483
1483
|
},
|
|
1484
1484
|
children: "Failed to load."
|
|
1485
1485
|
});
|
|
1486
|
-
else if (
|
|
1486
|
+
else if (d) P = /* @__PURE__ */ Y("div", {
|
|
1487
1487
|
style: {
|
|
1488
1488
|
display: "flex",
|
|
1489
1489
|
flexDirection: "column",
|
|
@@ -1500,7 +1500,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1500
1500
|
borderRadius: 8
|
|
1501
1501
|
} })]
|
|
1502
1502
|
});
|
|
1503
|
-
else if (_.length === 0)
|
|
1503
|
+
else if (_.length === 0) P = /* @__PURE__ */ Y(q, { children: [N, /* @__PURE__ */ J("div", {
|
|
1504
1504
|
style: {
|
|
1505
1505
|
fontSize: 12.5,
|
|
1506
1506
|
color: "var(--text-3)",
|
|
@@ -1509,30 +1509,30 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1509
1509
|
children: "No activity yet."
|
|
1510
1510
|
})] });
|
|
1511
1511
|
else {
|
|
1512
|
-
let
|
|
1513
|
-
let
|
|
1512
|
+
let a = (a, s) => {
|
|
1513
|
+
let c = pt(i, a) || String(s);
|
|
1514
1514
|
return /* @__PURE__ */ J(gt, {
|
|
1515
|
-
row:
|
|
1516
|
-
rowId:
|
|
1517
|
-
childEntity:
|
|
1515
|
+
row: a,
|
|
1516
|
+
rowId: c,
|
|
1517
|
+
childEntity: i,
|
|
1518
1518
|
entityCode: e.entity,
|
|
1519
1519
|
parentEntity: t,
|
|
1520
1520
|
parentId: n,
|
|
1521
|
-
timeline:
|
|
1521
|
+
timeline: p,
|
|
1522
1522
|
editableFields: j,
|
|
1523
|
-
refs:
|
|
1524
|
-
isEditing:
|
|
1525
|
-
onStartEdit: () =>
|
|
1526
|
-
onCancelEdit: () =>
|
|
1527
|
-
onSaved: () =>
|
|
1523
|
+
refs: o,
|
|
1524
|
+
isEditing: k === c,
|
|
1525
|
+
onStartEdit: () => A(c),
|
|
1526
|
+
onCancelEdit: () => A(null),
|
|
1527
|
+
onSaved: () => A(null),
|
|
1528
1528
|
schema: r,
|
|
1529
|
-
optimistic: mt(
|
|
1530
|
-
},
|
|
1531
|
-
},
|
|
1532
|
-
if (
|
|
1529
|
+
optimistic: mt(a)
|
|
1530
|
+
}, c);
|
|
1531
|
+
}, s = p?.time_field, c;
|
|
1532
|
+
if (s) {
|
|
1533
1533
|
let e = [];
|
|
1534
1534
|
_.forEach((t, n) => {
|
|
1535
|
-
let r = t[
|
|
1535
|
+
let r = t[s], i = _t(r), a = e[e.length - 1];
|
|
1536
1536
|
!a || a.key !== i ? e.push({
|
|
1537
1537
|
key: i,
|
|
1538
1538
|
label: vt(r),
|
|
@@ -1544,7 +1544,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1544
1544
|
row: t,
|
|
1545
1545
|
idx: n
|
|
1546
1546
|
});
|
|
1547
|
-
}),
|
|
1547
|
+
}), c = e.map((e) => /* @__PURE__ */ Y("div", {
|
|
1548
1548
|
style: {
|
|
1549
1549
|
display: "flex",
|
|
1550
1550
|
flexDirection: "column",
|
|
@@ -1553,13 +1553,13 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1553
1553
|
children: [/* @__PURE__ */ J(yt, {
|
|
1554
1554
|
label: e.label,
|
|
1555
1555
|
count: e.rows.length
|
|
1556
|
-
}), e.rows.map(({ row: e, idx: t }) =>
|
|
1556
|
+
}), e.rows.map(({ row: e, idx: t }) => a(e, t))]
|
|
1557
1557
|
}, `day-${e.key}`));
|
|
1558
|
-
} else
|
|
1559
|
-
|
|
1560
|
-
P,
|
|
1558
|
+
} else c = _.map((e, t) => a(e, t));
|
|
1559
|
+
P = /* @__PURE__ */ Y(q, { children: [
|
|
1561
1560
|
N,
|
|
1562
|
-
|
|
1561
|
+
ee,
|
|
1562
|
+
c
|
|
1563
1563
|
] });
|
|
1564
1564
|
}
|
|
1565
1565
|
return h ? /* @__PURE__ */ Y("div", {
|
|
@@ -1589,7 +1589,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1589
1589
|
}),
|
|
1590
1590
|
/* @__PURE__ */ J("div", {
|
|
1591
1591
|
ref: y,
|
|
1592
|
-
onScroll:
|
|
1592
|
+
onScroll: O,
|
|
1593
1593
|
style: {
|
|
1594
1594
|
flex: 1,
|
|
1595
1595
|
overflowY: "auto",
|
|
@@ -1598,7 +1598,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1598
1598
|
flexDirection: "column",
|
|
1599
1599
|
gap: 8
|
|
1600
1600
|
},
|
|
1601
|
-
children:
|
|
1601
|
+
children: P
|
|
1602
1602
|
}),
|
|
1603
1603
|
/* @__PURE__ */ J(ut, {
|
|
1604
1604
|
config: e,
|
|
@@ -1613,7 +1613,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1613
1613
|
flexDirection: "column",
|
|
1614
1614
|
gap: 8
|
|
1615
1615
|
},
|
|
1616
|
-
children:
|
|
1616
|
+
children: P
|
|
1617
1617
|
}), /* @__PURE__ */ J(ut, {
|
|
1618
1618
|
config: e,
|
|
1619
1619
|
parentEntity: t,
|
|
@@ -1621,52 +1621,52 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1621
1621
|
schema: r
|
|
1622
1622
|
})] });
|
|
1623
1623
|
}
|
|
1624
|
-
function gt({ row: t, rowId: n, childEntity:
|
|
1625
|
-
let
|
|
1626
|
-
|
|
1627
|
-
|
|
1624
|
+
function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s, parentId: c, timeline: u, editableFields: d, refs: f, isEditing: m, onStartEdit: h, onCancelEdit: g, onSaved: v, schema: y, optimistic: b = !1 }) {
|
|
1625
|
+
let x = xe(), S = r(), [T, O] = K({}), k = H(() => {
|
|
1626
|
+
x.invalidateQueries({ queryKey: [
|
|
1627
|
+
F,
|
|
1628
|
+
s,
|
|
1628
1629
|
c,
|
|
1629
|
-
|
|
1630
|
-
s
|
|
1630
|
+
o
|
|
1631
1631
|
] });
|
|
1632
1632
|
}, [
|
|
1633
|
-
|
|
1633
|
+
x,
|
|
1634
|
+
s,
|
|
1634
1635
|
c,
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
]), j = be({
|
|
1636
|
+
o
|
|
1637
|
+
]), A = be({
|
|
1638
1638
|
mutationFn: (e) => {
|
|
1639
1639
|
let r = t.$row_version;
|
|
1640
|
-
return
|
|
1640
|
+
return a(o, n, typeof r == "string" && r !== "" ? {
|
|
1641
1641
|
...e,
|
|
1642
1642
|
$row_version: r
|
|
1643
1643
|
} : e);
|
|
1644
1644
|
},
|
|
1645
1645
|
onSuccess: () => {
|
|
1646
|
-
|
|
1646
|
+
k(), C.success("Updated"), v();
|
|
1647
1647
|
},
|
|
1648
|
-
onError: (e) =>
|
|
1648
|
+
onError: (e) => C.error(e.message)
|
|
1649
1649
|
}), M = be({
|
|
1650
|
-
mutationFn: () =>
|
|
1650
|
+
mutationFn: () => j(o, n),
|
|
1651
1651
|
onSuccess: () => {
|
|
1652
|
-
|
|
1652
|
+
k(), C.success("Deleted");
|
|
1653
1653
|
},
|
|
1654
|
-
onError: (e) =>
|
|
1655
|
-
}),
|
|
1654
|
+
onError: (e) => C.error(e.message)
|
|
1655
|
+
}), ee = H(() => {
|
|
1656
1656
|
let e = {};
|
|
1657
|
-
for (let n of
|
|
1658
|
-
O(e),
|
|
1657
|
+
for (let n of d) e[n] = t[n] ?? "";
|
|
1658
|
+
O(e), h();
|
|
1659
1659
|
}, [
|
|
1660
1660
|
t,
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
]),
|
|
1661
|
+
d,
|
|
1662
|
+
h
|
|
1663
|
+
]), N = H((e, t) => {
|
|
1664
1664
|
O((n) => ({
|
|
1665
1665
|
...n,
|
|
1666
1666
|
[e]: t
|
|
1667
1667
|
}));
|
|
1668
|
-
}, []),
|
|
1669
|
-
return
|
|
1668
|
+
}, []), P = u?.time_field, I = u?.type_field, L = u?.summary_field, R = u?.content_field, z = u?.author_field, B = u?.direction_field, V = u?.intent_field;
|
|
1669
|
+
return m ? /* @__PURE__ */ Y("div", {
|
|
1670
1670
|
style: {
|
|
1671
1671
|
borderRadius: 10,
|
|
1672
1672
|
border: "1px solid var(--accent)",
|
|
@@ -1676,8 +1676,8 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1676
1676
|
flexDirection: "column",
|
|
1677
1677
|
gap: 8
|
|
1678
1678
|
},
|
|
1679
|
-
children: [
|
|
1680
|
-
let t =
|
|
1679
|
+
children: [d.map((e) => {
|
|
1680
|
+
let t = i.fields.get(e);
|
|
1681
1681
|
return t ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("label", {
|
|
1682
1682
|
style: {
|
|
1683
1683
|
fontSize: 11,
|
|
@@ -1685,15 +1685,15 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1685
1685
|
marginBottom: 4,
|
|
1686
1686
|
display: "block"
|
|
1687
1687
|
},
|
|
1688
|
-
children:
|
|
1689
|
-
}),
|
|
1688
|
+
children: p(t, e, y.entities)
|
|
1689
|
+
}), w({
|
|
1690
1690
|
field: t,
|
|
1691
1691
|
fieldName: e,
|
|
1692
|
-
value:
|
|
1692
|
+
value: T[e] ?? "",
|
|
1693
1693
|
mode: "edit",
|
|
1694
|
-
onChange: (t) =>
|
|
1695
|
-
record:
|
|
1696
|
-
locale:
|
|
1694
|
+
onChange: (t) => N(e, t),
|
|
1695
|
+
record: T,
|
|
1696
|
+
locale: S
|
|
1697
1697
|
})] }, e) : null;
|
|
1698
1698
|
}), /* @__PURE__ */ Y("div", {
|
|
1699
1699
|
style: {
|
|
@@ -1702,33 +1702,33 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1702
1702
|
gap: 6,
|
|
1703
1703
|
paddingTop: 4
|
|
1704
1704
|
},
|
|
1705
|
-
children: [/* @__PURE__ */ J(
|
|
1705
|
+
children: [/* @__PURE__ */ J(D, {
|
|
1706
1706
|
kind: "primary",
|
|
1707
1707
|
size: "xs",
|
|
1708
|
-
icon:
|
|
1709
|
-
onClick: () =>
|
|
1710
|
-
disabled:
|
|
1711
|
-
children:
|
|
1712
|
-
}), /* @__PURE__ */ J(
|
|
1708
|
+
icon: A.isPending ? /* @__PURE__ */ J(l, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
|
|
1709
|
+
onClick: () => A.mutate(T),
|
|
1710
|
+
disabled: A.isPending,
|
|
1711
|
+
children: A.isPending ? "Saving…" : "Save"
|
|
1712
|
+
}), /* @__PURE__ */ J(D, {
|
|
1713
1713
|
size: "xs",
|
|
1714
1714
|
icon: /* @__PURE__ */ J(e.x, { size: 12 }),
|
|
1715
1715
|
onClick: () => {
|
|
1716
|
-
O({}),
|
|
1716
|
+
O({}), g();
|
|
1717
1717
|
},
|
|
1718
|
-
disabled:
|
|
1718
|
+
disabled: A.isPending,
|
|
1719
1719
|
children: "Cancel"
|
|
1720
1720
|
})]
|
|
1721
1721
|
})]
|
|
1722
1722
|
}) : /* @__PURE__ */ Y("div", {
|
|
1723
1723
|
className: "group",
|
|
1724
|
-
"data-optimistic":
|
|
1724
|
+
"data-optimistic": b || void 0,
|
|
1725
1725
|
style: {
|
|
1726
1726
|
borderRadius: 10,
|
|
1727
1727
|
border: "1px solid var(--border)",
|
|
1728
1728
|
background: "var(--surface)",
|
|
1729
1729
|
padding: 12,
|
|
1730
1730
|
transition: "border-color .12s",
|
|
1731
|
-
opacity:
|
|
1731
|
+
opacity: b ? .6 : 1
|
|
1732
1732
|
},
|
|
1733
1733
|
onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
|
|
1734
1734
|
onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
|
|
@@ -1743,74 +1743,74 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1743
1743
|
color: "var(--text-3)"
|
|
1744
1744
|
},
|
|
1745
1745
|
children: [
|
|
1746
|
-
|
|
1746
|
+
P && t[P] != null && i.fields.get(P) && /* @__PURE__ */ J("span", {
|
|
1747
1747
|
style: { fontWeight: 500 },
|
|
1748
|
-
children:
|
|
1749
|
-
field:
|
|
1750
|
-
fieldName:
|
|
1751
|
-
value: t[
|
|
1748
|
+
children: w({
|
|
1749
|
+
field: i.fields.get(P),
|
|
1750
|
+
fieldName: P,
|
|
1751
|
+
value: t[P],
|
|
1752
1752
|
mode: "display",
|
|
1753
1753
|
record: t,
|
|
1754
|
-
refs:
|
|
1755
|
-
locale:
|
|
1754
|
+
refs: f,
|
|
1755
|
+
locale: S
|
|
1756
1756
|
})
|
|
1757
1757
|
}),
|
|
1758
|
-
I && t[I] != null &&
|
|
1758
|
+
I && t[I] != null && i.fields.get(I) && /* @__PURE__ */ J(_, {
|
|
1759
1759
|
tone: "slate",
|
|
1760
1760
|
size: "xs",
|
|
1761
|
-
children:
|
|
1762
|
-
field:
|
|
1761
|
+
children: w({
|
|
1762
|
+
field: i.fields.get(I),
|
|
1763
1763
|
fieldName: I,
|
|
1764
1764
|
value: t[I],
|
|
1765
1765
|
mode: "display",
|
|
1766
1766
|
record: t,
|
|
1767
|
-
refs:
|
|
1768
|
-
locale:
|
|
1767
|
+
refs: f,
|
|
1768
|
+
locale: S
|
|
1769
1769
|
})
|
|
1770
1770
|
}),
|
|
1771
|
-
B && t[B] != null &&
|
|
1771
|
+
B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ J(bt, {
|
|
1772
1772
|
value: t[B],
|
|
1773
|
-
field:
|
|
1773
|
+
field: i.fields.get(B)
|
|
1774
1774
|
}),
|
|
1775
|
-
V && t[V] != null &&
|
|
1775
|
+
V && t[V] != null && i.fields.get(V) && /* @__PURE__ */ J(_, {
|
|
1776
1776
|
tone: "slate",
|
|
1777
1777
|
size: "xs",
|
|
1778
|
-
children:
|
|
1779
|
-
field:
|
|
1778
|
+
children: w({
|
|
1779
|
+
field: i.fields.get(V),
|
|
1780
1780
|
fieldName: V,
|
|
1781
1781
|
value: t[V],
|
|
1782
1782
|
mode: "display",
|
|
1783
1783
|
record: t,
|
|
1784
|
-
refs:
|
|
1785
|
-
locale:
|
|
1784
|
+
refs: f,
|
|
1785
|
+
locale: S
|
|
1786
1786
|
})
|
|
1787
1787
|
}),
|
|
1788
|
-
z && t[z] != null &&
|
|
1788
|
+
z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ Y("span", { children: [
|
|
1789
1789
|
"by",
|
|
1790
1790
|
" ",
|
|
1791
|
-
|
|
1792
|
-
field:
|
|
1791
|
+
w({
|
|
1792
|
+
field: i.fields.get(z),
|
|
1793
1793
|
fieldName: z,
|
|
1794
1794
|
value: t[z],
|
|
1795
1795
|
mode: "display",
|
|
1796
1796
|
record: t,
|
|
1797
|
-
refs:
|
|
1798
|
-
locale:
|
|
1797
|
+
refs: f,
|
|
1798
|
+
locale: S
|
|
1799
1799
|
})
|
|
1800
1800
|
] }),
|
|
1801
|
-
!
|
|
1801
|
+
!b && /* @__PURE__ */ Y("div", {
|
|
1802
1802
|
style: {
|
|
1803
1803
|
marginLeft: "auto",
|
|
1804
1804
|
display: "flex",
|
|
1805
1805
|
alignItems: "center",
|
|
1806
1806
|
gap: 2
|
|
1807
1807
|
},
|
|
1808
|
-
children: [/* @__PURE__ */ J(
|
|
1808
|
+
children: [/* @__PURE__ */ J(E, {
|
|
1809
1809
|
size: 22,
|
|
1810
1810
|
icon: /* @__PURE__ */ J(e.edit, { size: 11 }),
|
|
1811
|
-
onClick:
|
|
1811
|
+
onClick: ee,
|
|
1812
1812
|
title: "Edit"
|
|
1813
|
-
}), /* @__PURE__ */ J(
|
|
1813
|
+
}), /* @__PURE__ */ J(E, {
|
|
1814
1814
|
size: 22,
|
|
1815
1815
|
icon: /* @__PURE__ */ J(e.trash, { size: 11 }),
|
|
1816
1816
|
onClick: () => M.mutate(),
|
|
@@ -1819,36 +1819,36 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1819
1819
|
})
|
|
1820
1820
|
]
|
|
1821
1821
|
}),
|
|
1822
|
-
L && t[L] != null &&
|
|
1822
|
+
L && t[L] != null && i.fields.get(L) && /* @__PURE__ */ J("div", {
|
|
1823
1823
|
style: {
|
|
1824
1824
|
fontSize: 12.5,
|
|
1825
1825
|
fontWeight: 500,
|
|
1826
1826
|
marginTop: 6
|
|
1827
1827
|
},
|
|
1828
|
-
children:
|
|
1829
|
-
field:
|
|
1828
|
+
children: w({
|
|
1829
|
+
field: i.fields.get(L),
|
|
1830
1830
|
fieldName: L,
|
|
1831
1831
|
value: t[L],
|
|
1832
1832
|
mode: "display",
|
|
1833
1833
|
record: t,
|
|
1834
|
-
refs:
|
|
1835
|
-
locale:
|
|
1834
|
+
refs: f,
|
|
1835
|
+
locale: S
|
|
1836
1836
|
})
|
|
1837
1837
|
}),
|
|
1838
|
-
R && t[R] != null && R !== L &&
|
|
1838
|
+
R && t[R] != null && R !== L && i.fields.get(R) && /* @__PURE__ */ J("div", {
|
|
1839
1839
|
style: {
|
|
1840
1840
|
fontSize: 12.5,
|
|
1841
1841
|
fontWeight: 400,
|
|
1842
1842
|
marginTop: 6
|
|
1843
1843
|
},
|
|
1844
|
-
children:
|
|
1845
|
-
field:
|
|
1844
|
+
children: w({
|
|
1845
|
+
field: i.fields.get(R),
|
|
1846
1846
|
fieldName: R,
|
|
1847
1847
|
value: t[R],
|
|
1848
1848
|
mode: "display",
|
|
1849
1849
|
record: t,
|
|
1850
|
-
refs:
|
|
1851
|
-
locale:
|
|
1850
|
+
refs: f,
|
|
1851
|
+
locale: S
|
|
1852
1852
|
})
|
|
1853
1853
|
})
|
|
1854
1854
|
]
|
|
@@ -1856,12 +1856,12 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1856
1856
|
}
|
|
1857
1857
|
function _t(e) {
|
|
1858
1858
|
if (e == null) return "";
|
|
1859
|
-
let t = new Date(
|
|
1859
|
+
let t = new Date(c(e));
|
|
1860
1860
|
return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
|
|
1861
1861
|
}
|
|
1862
1862
|
function vt(e) {
|
|
1863
1863
|
if (e == null) return "—";
|
|
1864
|
-
let t = new Date(
|
|
1864
|
+
let t = new Date(c(e));
|
|
1865
1865
|
if (Number.isNaN(t.getTime())) return "—";
|
|
1866
1866
|
let n = /* @__PURE__ */ new Date(), r = /* @__PURE__ */ new Date();
|
|
1867
1867
|
r.setDate(n.getDate() - 1);
|
|
@@ -1937,68 +1937,68 @@ function xt(e, t) {
|
|
|
1937
1937
|
}
|
|
1938
1938
|
//#endregion
|
|
1939
1939
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
1940
|
-
function St({ config: t, childEntity: n, schema:
|
|
1941
|
-
let d =
|
|
1940
|
+
function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, validationErrors: s, refs: l, forceTablePresentation: u = !1 }) {
|
|
1941
|
+
let d = r(), f = b(), m = G(null), h = t.columns, g = t.position_field, _ = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), v = h.filter((e) => {
|
|
1942
1942
|
if (_.has(e) || t.position_field && e === t.position_field) return !1;
|
|
1943
1943
|
let r = n.fields.get(e);
|
|
1944
1944
|
return !(!r || r.auto || r.primary || r.source);
|
|
1945
|
-
}),
|
|
1945
|
+
}), y = new Set(h.filter((e) => {
|
|
1946
1946
|
if (t.position_field && e === t.position_field) return !0;
|
|
1947
1947
|
let r = n.fields.get(e);
|
|
1948
1948
|
return r && (r.auto || r.primary || r.source);
|
|
1949
|
-
})),
|
|
1950
|
-
|
|
1949
|
+
})), x = H((e, t, n) => {
|
|
1950
|
+
o(a.map((r) => r._key === e ? {
|
|
1951
1951
|
...r,
|
|
1952
1952
|
[t]: n,
|
|
1953
1953
|
_dirty: !0
|
|
1954
1954
|
} : r));
|
|
1955
|
-
}, [
|
|
1955
|
+
}, [a, o]), S = H(() => {
|
|
1956
1956
|
let e = {
|
|
1957
1957
|
_key: crypto.randomUUID(),
|
|
1958
1958
|
_dirty: !0
|
|
1959
1959
|
};
|
|
1960
|
-
g && (e[g] =
|
|
1960
|
+
g && (e[g] = a.filter((e) => !e._deleted).reduce((e, t) => {
|
|
1961
1961
|
let n = typeof t[g] == "number" ? t[g] : -1;
|
|
1962
1962
|
return Math.max(e, n);
|
|
1963
1963
|
}, -1) + 1);
|
|
1964
1964
|
let r = t.quick_add?.defaults ?? {};
|
|
1965
|
-
for (let t of
|
|
1965
|
+
for (let t of v) {
|
|
1966
1966
|
let i = n.fields.get(t);
|
|
1967
1967
|
i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
|
|
1968
1968
|
}
|
|
1969
|
-
|
|
1969
|
+
o([...a, e]);
|
|
1970
1970
|
}, [
|
|
1971
|
+
a,
|
|
1971
1972
|
o,
|
|
1972
|
-
|
|
1973
|
-
y,
|
|
1973
|
+
v,
|
|
1974
1974
|
n,
|
|
1975
1975
|
t.quick_add?.defaults,
|
|
1976
1976
|
g
|
|
1977
|
-
]),
|
|
1978
|
-
|
|
1977
|
+
]), C = H((e) => {
|
|
1978
|
+
o(a.map((t) => t._key === e ? {
|
|
1979
1979
|
...t,
|
|
1980
1980
|
_deleted: !0
|
|
1981
1981
|
} : t));
|
|
1982
|
-
}, [
|
|
1983
|
-
|
|
1982
|
+
}, [a, o]), T = H((e) => {
|
|
1983
|
+
o(a.map((t) => t._key === e ? {
|
|
1984
1984
|
...t,
|
|
1985
1985
|
_deleted: !1
|
|
1986
1986
|
} : t));
|
|
1987
|
-
}, [
|
|
1987
|
+
}, [a, o]), O = H((e, t) => {
|
|
1988
1988
|
if (!g) return;
|
|
1989
|
-
let n =
|
|
1990
|
-
if (i < 0 ||
|
|
1989
|
+
let n = a.filter((e) => !e._deleted), r = a.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), s = i + t;
|
|
1990
|
+
if (i < 0 || s < 0 || s >= n.length) return;
|
|
1991
1991
|
let c = [...n], [l] = c.splice(i, 1);
|
|
1992
|
-
c.splice(
|
|
1992
|
+
c.splice(s, 0, l), o([...c.map((e, t) => ({
|
|
1993
1993
|
...e,
|
|
1994
1994
|
[g]: t,
|
|
1995
1995
|
_dirty: e[g] !== t || e._dirty
|
|
1996
1996
|
})), ...r]);
|
|
1997
1997
|
}, [
|
|
1998
|
+
a,
|
|
1998
1999
|
o,
|
|
1999
|
-
s,
|
|
2000
2000
|
g
|
|
2001
|
-
]),
|
|
2001
|
+
]), k = H((e) => {
|
|
2002
2002
|
let t = e.target, n = t.closest("td");
|
|
2003
2003
|
if (!n) return;
|
|
2004
2004
|
let r = n.closest("tr");
|
|
@@ -2022,7 +2022,7 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2022
2022
|
if (o < t.length - 1) {
|
|
2023
2023
|
let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
|
|
2024
2024
|
e && e.focus();
|
|
2025
|
-
} else
|
|
2025
|
+
} else S(), requestAnimationFrame(() => {
|
|
2026
2026
|
let e = i.querySelectorAll("tr"), t = e[e.length - 1];
|
|
2027
2027
|
if (t) {
|
|
2028
2028
|
let e = t.querySelector("input, select, textarea, [tabindex]");
|
|
@@ -2030,21 +2030,21 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2030
2030
|
}
|
|
2031
2031
|
});
|
|
2032
2032
|
} else e.key === "Escape" && t.blur?.();
|
|
2033
|
-
}, [
|
|
2033
|
+
}, [S]), A = ue;
|
|
2034
2034
|
return f.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
|
|
2035
2035
|
style: {
|
|
2036
2036
|
display: "flex",
|
|
2037
2037
|
flexDirection: "column",
|
|
2038
2038
|
gap: 10
|
|
2039
2039
|
},
|
|
2040
|
-
children:
|
|
2041
|
-
let
|
|
2040
|
+
children: a.map((t, r) => {
|
|
2041
|
+
let o = !!t._deleted, u = s?.[t._key], f = g ? a.filter((e) => !e._deleted) : [], m = g ? f.findIndex((e) => e._key === t._key) : -1;
|
|
2042
2042
|
return /* @__PURE__ */ Y("div", {
|
|
2043
2043
|
style: {
|
|
2044
2044
|
border: "1px solid var(--border)",
|
|
2045
2045
|
borderRadius: 8,
|
|
2046
2046
|
background: "var(--surface)",
|
|
2047
|
-
opacity:
|
|
2047
|
+
opacity: o ? .58 : 1,
|
|
2048
2048
|
overflow: "hidden"
|
|
2049
2049
|
},
|
|
2050
2050
|
children: [/* @__PURE__ */ Y("div", {
|
|
@@ -2063,34 +2063,34 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2063
2063
|
fontWeight: 600,
|
|
2064
2064
|
color: "var(--text-2)"
|
|
2065
2065
|
},
|
|
2066
|
-
children: ["Row ",
|
|
2066
|
+
children: ["Row ", r + 1]
|
|
2067
2067
|
}), /* @__PURE__ */ Y("div", {
|
|
2068
2068
|
style: {
|
|
2069
2069
|
display: "flex",
|
|
2070
2070
|
alignItems: "center",
|
|
2071
2071
|
gap: 4
|
|
2072
2072
|
},
|
|
2073
|
-
children: [g && !
|
|
2073
|
+
children: [g && !o && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(E, {
|
|
2074
2074
|
size: 32,
|
|
2075
2075
|
icon: /* @__PURE__ */ J(e.up, { size: 14 }),
|
|
2076
|
-
onClick: () =>
|
|
2077
|
-
disabled:
|
|
2076
|
+
onClick: () => O(t._key, -1),
|
|
2077
|
+
disabled: m <= 0,
|
|
2078
2078
|
title: "Move row up"
|
|
2079
|
-
}), /* @__PURE__ */ J(
|
|
2079
|
+
}), /* @__PURE__ */ J(E, {
|
|
2080
2080
|
size: 32,
|
|
2081
2081
|
icon: /* @__PURE__ */ J(e.down, { size: 14 }),
|
|
2082
|
-
onClick: () =>
|
|
2083
|
-
disabled:
|
|
2082
|
+
onClick: () => O(t._key, 1),
|
|
2083
|
+
disabled: m === -1 || m >= f.length - 1,
|
|
2084
2084
|
title: "Move row down"
|
|
2085
|
-
})] }),
|
|
2085
|
+
})] }), o ? /* @__PURE__ */ J(E, {
|
|
2086
2086
|
size: 32,
|
|
2087
2087
|
icon: /* @__PURE__ */ J(e.refresh, { size: 14 }),
|
|
2088
2088
|
onClick: () => T(t._key),
|
|
2089
2089
|
title: "Undo delete"
|
|
2090
|
-
}) : /* @__PURE__ */ J(
|
|
2090
|
+
}) : /* @__PURE__ */ J(E, {
|
|
2091
2091
|
size: 32,
|
|
2092
2092
|
icon: /* @__PURE__ */ J(e.trash, { size: 14 }),
|
|
2093
|
-
onClick: () =>
|
|
2093
|
+
onClick: () => C(t._key),
|
|
2094
2094
|
title: "Delete row"
|
|
2095
2095
|
})]
|
|
2096
2096
|
})]
|
|
@@ -2102,58 +2102,58 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2102
2102
|
gap: 12
|
|
2103
2103
|
},
|
|
2104
2104
|
children: h.map((e) => {
|
|
2105
|
-
let r = n.fields.get(e),
|
|
2106
|
-
outline:
|
|
2105
|
+
let r = n.fields.get(e), a = u?.includes(e), s = y.has(e), f = r ? p(r, e, i.entities) : e, m = `child-${t._key}-${e}`, h = `${m}-label`, g = {
|
|
2106
|
+
outline: a ? "1px solid var(--danger)" : "none",
|
|
2107
2107
|
outlineOffset: 3,
|
|
2108
|
-
borderRadius:
|
|
2109
|
-
},
|
|
2108
|
+
borderRadius: a ? 5 : 0
|
|
2109
|
+
}, _ = {
|
|
2110
2110
|
fontSize: 11.5,
|
|
2111
2111
|
fontWeight: 600,
|
|
2112
2112
|
color: "var(--text-3)"
|
|
2113
|
-
},
|
|
2113
|
+
}, v = !o && !s && !!r;
|
|
2114
2114
|
return /* @__PURE__ */ Y("div", {
|
|
2115
2115
|
style: {
|
|
2116
2116
|
display: "flex",
|
|
2117
2117
|
flexDirection: "column",
|
|
2118
2118
|
gap: 5,
|
|
2119
2119
|
minWidth: 0,
|
|
2120
|
-
textDecoration:
|
|
2120
|
+
textDecoration: o ? "line-through" : "none"
|
|
2121
2121
|
},
|
|
2122
|
-
title:
|
|
2123
|
-
children: [
|
|
2124
|
-
id:
|
|
2125
|
-
htmlFor:
|
|
2126
|
-
style:
|
|
2127
|
-
children:
|
|
2122
|
+
title: a ? `${e} is required` : void 0,
|
|
2123
|
+
children: [v ? /* @__PURE__ */ J("label", {
|
|
2124
|
+
id: h,
|
|
2125
|
+
htmlFor: m,
|
|
2126
|
+
style: _,
|
|
2127
|
+
children: f
|
|
2128
2128
|
}) : /* @__PURE__ */ J("div", {
|
|
2129
|
-
id:
|
|
2130
|
-
style:
|
|
2131
|
-
children:
|
|
2129
|
+
id: h,
|
|
2130
|
+
style: _,
|
|
2131
|
+
children: f
|
|
2132
2132
|
}), /* @__PURE__ */ J("div", {
|
|
2133
|
-
style:
|
|
2134
|
-
children:
|
|
2133
|
+
style: g,
|
|
2134
|
+
children: o || s ? r ? w({
|
|
2135
2135
|
field: r,
|
|
2136
2136
|
fieldName: e,
|
|
2137
2137
|
value: t[e],
|
|
2138
2138
|
mode: "display",
|
|
2139
2139
|
record: t,
|
|
2140
2140
|
refs: l,
|
|
2141
|
-
fieldId:
|
|
2142
|
-
labelId:
|
|
2141
|
+
fieldId: m,
|
|
2142
|
+
labelId: h,
|
|
2143
2143
|
locale: d
|
|
2144
|
-
}) :
|
|
2144
|
+
}) : c(t[e]) : r ? w({
|
|
2145
2145
|
field: r,
|
|
2146
2146
|
fieldName: e,
|
|
2147
2147
|
value: t[e],
|
|
2148
2148
|
mode: "edit",
|
|
2149
|
-
onChange: (n) =>
|
|
2149
|
+
onChange: (n) => x(t._key, e, n),
|
|
2150
2150
|
record: t,
|
|
2151
2151
|
refs: l,
|
|
2152
2152
|
compact: !0,
|
|
2153
|
-
fieldId:
|
|
2154
|
-
labelId:
|
|
2153
|
+
fieldId: m,
|
|
2154
|
+
labelId: h,
|
|
2155
2155
|
locale: d
|
|
2156
|
-
}) :
|
|
2156
|
+
}) : c(t[e])
|
|
2157
2157
|
})]
|
|
2158
2158
|
}, e);
|
|
2159
2159
|
})
|
|
@@ -2162,51 +2162,51 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2162
2162
|
})
|
|
2163
2163
|
}), /* @__PURE__ */ J("div", {
|
|
2164
2164
|
style: { marginTop: 10 },
|
|
2165
|
-
children: /* @__PURE__ */ J(
|
|
2165
|
+
children: /* @__PURE__ */ J(D, {
|
|
2166
2166
|
kind: "ghost",
|
|
2167
2167
|
size: "sm",
|
|
2168
2168
|
icon: /* @__PURE__ */ J(e.plus, { size: 14 }),
|
|
2169
|
-
onClick:
|
|
2169
|
+
onClick: S,
|
|
2170
2170
|
children: "Add row"
|
|
2171
2171
|
})
|
|
2172
2172
|
})] }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
|
|
2173
2173
|
style: { overflowX: "auto" },
|
|
2174
2174
|
children: /* @__PURE__ */ Y("table", {
|
|
2175
|
-
ref:
|
|
2175
|
+
ref: m,
|
|
2176
2176
|
style: de,
|
|
2177
|
-
onKeyDown:
|
|
2177
|
+
onKeyDown: k,
|
|
2178
2178
|
children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [h.map((e) => {
|
|
2179
2179
|
let t = n.fields.get(e);
|
|
2180
2180
|
return /* @__PURE__ */ J("th", {
|
|
2181
|
-
style:
|
|
2182
|
-
children: t ?
|
|
2181
|
+
style: A,
|
|
2182
|
+
children: t ? p(t, e, i.entities) : e
|
|
2183
2183
|
}, e);
|
|
2184
2184
|
}), /* @__PURE__ */ J("th", { style: {
|
|
2185
|
-
...
|
|
2185
|
+
...A,
|
|
2186
2186
|
width: 40
|
|
2187
|
-
} })] }) }), /* @__PURE__ */ J("tbody", { children:
|
|
2188
|
-
let
|
|
2187
|
+
} })] }) }), /* @__PURE__ */ J("tbody", { children: a.map((t) => {
|
|
2188
|
+
let r = !!t._deleted, i = s?.[t._key];
|
|
2189
2189
|
return /* @__PURE__ */ Y("tr", {
|
|
2190
|
-
style: { opacity:
|
|
2190
|
+
style: { opacity: r ? .5 : 1 },
|
|
2191
2191
|
children: [h.map((e) => {
|
|
2192
|
-
let
|
|
2193
|
-
return
|
|
2192
|
+
let a = n.fields.get(e), o = i?.includes(e), s = y.has(e);
|
|
2193
|
+
return r || s ? /* @__PURE__ */ J("td", {
|
|
2194
2194
|
style: {
|
|
2195
2195
|
padding: "6px 12px",
|
|
2196
2196
|
borderBottom: "1px solid var(--divider)",
|
|
2197
2197
|
verticalAlign: "middle",
|
|
2198
|
-
textDecoration:
|
|
2198
|
+
textDecoration: r ? "line-through" : "none",
|
|
2199
2199
|
color: "var(--text-2)"
|
|
2200
2200
|
},
|
|
2201
|
-
children:
|
|
2202
|
-
field:
|
|
2201
|
+
children: a ? w({
|
|
2202
|
+
field: a,
|
|
2203
2203
|
fieldName: e,
|
|
2204
2204
|
value: t[e],
|
|
2205
2205
|
mode: "display",
|
|
2206
2206
|
record: t,
|
|
2207
2207
|
refs: l,
|
|
2208
2208
|
locale: d
|
|
2209
|
-
}) :
|
|
2209
|
+
}) : c(t[e])
|
|
2210
2210
|
}, e) : /* @__PURE__ */ J("td", {
|
|
2211
2211
|
style: {
|
|
2212
2212
|
padding: "4px 4px",
|
|
@@ -2217,17 +2217,17 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2217
2217
|
borderRadius: o ? 4 : 0
|
|
2218
2218
|
},
|
|
2219
2219
|
title: o ? `${e} is required` : void 0,
|
|
2220
|
-
children:
|
|
2221
|
-
field:
|
|
2220
|
+
children: a ? w({
|
|
2221
|
+
field: a,
|
|
2222
2222
|
fieldName: e,
|
|
2223
2223
|
value: t[e],
|
|
2224
2224
|
mode: "edit",
|
|
2225
|
-
onChange: (n) =>
|
|
2225
|
+
onChange: (n) => x(t._key, e, n),
|
|
2226
2226
|
record: t,
|
|
2227
2227
|
refs: l,
|
|
2228
2228
|
compact: !0,
|
|
2229
2229
|
locale: d
|
|
2230
|
-
}) :
|
|
2230
|
+
}) : c(t[e])
|
|
2231
2231
|
}, e);
|
|
2232
2232
|
}), /* @__PURE__ */ J("td", {
|
|
2233
2233
|
style: {
|
|
@@ -2235,15 +2235,15 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2235
2235
|
borderBottom: "1px solid var(--divider)",
|
|
2236
2236
|
verticalAlign: "middle"
|
|
2237
2237
|
},
|
|
2238
|
-
children:
|
|
2238
|
+
children: r ? /* @__PURE__ */ J(E, {
|
|
2239
2239
|
size: 24,
|
|
2240
2240
|
icon: /* @__PURE__ */ J(e.refresh, { size: 12 }),
|
|
2241
2241
|
onClick: () => T(t._key),
|
|
2242
2242
|
title: "Undo delete"
|
|
2243
|
-
}) : /* @__PURE__ */ J(
|
|
2243
|
+
}) : /* @__PURE__ */ J(E, {
|
|
2244
2244
|
size: 24,
|
|
2245
2245
|
icon: /* @__PURE__ */ J(e.trash, { size: 12 }),
|
|
2246
|
-
onClick: () =>
|
|
2246
|
+
onClick: () => C(t._key),
|
|
2247
2247
|
title: "Delete row"
|
|
2248
2248
|
})
|
|
2249
2249
|
})]
|
|
@@ -2252,20 +2252,20 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2252
2252
|
})
|
|
2253
2253
|
}), /* @__PURE__ */ J("div", {
|
|
2254
2254
|
style: { marginTop: 8 },
|
|
2255
|
-
children: /* @__PURE__ */ J(
|
|
2255
|
+
children: /* @__PURE__ */ J(D, {
|
|
2256
2256
|
kind: "ghost",
|
|
2257
2257
|
size: "xs",
|
|
2258
2258
|
icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
|
|
2259
|
-
onClick:
|
|
2259
|
+
onClick: S,
|
|
2260
2260
|
children: "Add row"
|
|
2261
2261
|
})
|
|
2262
2262
|
})] });
|
|
2263
2263
|
}
|
|
2264
2264
|
//#endregion
|
|
2265
2265
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
2266
|
-
var Ct = he(() => import("./DraggableChildrenTable-
|
|
2266
|
+
var Ct = he(() => import("./DraggableChildrenTable-Ctmn0liO.js").then((e) => ({ default: e.DraggableChildrenTable })));
|
|
2267
2267
|
function wt({ node: e, ctx: n }) {
|
|
2268
|
-
let r =
|
|
2268
|
+
let r = b(), i = e.children;
|
|
2269
2269
|
if (!i) return null;
|
|
2270
2270
|
let a = r.isPhone && n.relatedRecordsPresentation === "table";
|
|
2271
2271
|
if (n.isNew && n.mode !== "edit") return null;
|
|
@@ -2279,7 +2279,7 @@ function wt({ node: e, ctx: n }) {
|
|
|
2279
2279
|
className: "text-sm text-muted-foreground py-2",
|
|
2280
2280
|
children: ["Entity not found: ", o.entity]
|
|
2281
2281
|
});
|
|
2282
|
-
let c = Ne(o, s, e), l = ke(e, n), u = Ae(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(
|
|
2282
|
+
let c = Ne(o, s, e), l = ke(e, n), u = Ae(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(ne, {
|
|
2283
2283
|
title: l,
|
|
2284
2284
|
icon: u ? /* @__PURE__ */ J(t, {
|
|
2285
2285
|
name: u,
|
|
@@ -2287,7 +2287,7 @@ function wt({ node: e, ctx: n }) {
|
|
|
2287
2287
|
}) : void 0,
|
|
2288
2288
|
children: e
|
|
2289
2289
|
});
|
|
2290
|
-
if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" &&
|
|
2290
|
+
if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && v(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
|
|
2291
2291
|
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ? St : Ct : St;
|
|
2292
2292
|
return d(/* @__PURE__ */ J(pe, {
|
|
2293
2293
|
fallback: /* @__PURE__ */ J(R, {}),
|
|
@@ -2304,17 +2304,17 @@ function wt({ node: e, ctx: n }) {
|
|
|
2304
2304
|
}));
|
|
2305
2305
|
}
|
|
2306
2306
|
if (n.isNew) return null;
|
|
2307
|
-
let
|
|
2307
|
+
let f = {
|
|
2308
2308
|
config: c,
|
|
2309
2309
|
parentEntity: n.entityCode,
|
|
2310
2310
|
parentId: n.recordId,
|
|
2311
2311
|
schema: n.schema
|
|
2312
2312
|
};
|
|
2313
2313
|
switch (c.mode) {
|
|
2314
|
-
case "list": return d(/* @__PURE__ */ J(tt, { ...
|
|
2315
|
-
case "cards": return d(/* @__PURE__ */ J(nt, { ...
|
|
2316
|
-
case "timeline": return d(/* @__PURE__ */ J(ht, { ...
|
|
2317
|
-
default: return r.isPhone && !a ? d(/* @__PURE__ */ J(nt, { ...
|
|
2314
|
+
case "list": return d(/* @__PURE__ */ J(tt, { ...f }));
|
|
2315
|
+
case "cards": return d(/* @__PURE__ */ J(nt, { ...f }));
|
|
2316
|
+
case "timeline": return d(/* @__PURE__ */ J(ht, { ...f }));
|
|
2317
|
+
default: return r.isPhone && !a ? d(/* @__PURE__ */ J(nt, { ...f })) : d(/* @__PURE__ */ J(et, { ...f }));
|
|
2318
2318
|
}
|
|
2319
2319
|
}
|
|
2320
2320
|
//#endregion
|
|
@@ -2351,8 +2351,8 @@ function jt({ columns: e = 2, children: t }) {
|
|
|
2351
2351
|
})
|
|
2352
2352
|
});
|
|
2353
2353
|
}
|
|
2354
|
-
function Mt({ label: t, children:
|
|
2355
|
-
let h = ge(At), g =
|
|
2354
|
+
function Mt({ label: t, children: r, span: i = !1, required: a, error: o, hint: s, actions: c, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
|
|
2355
|
+
let h = ge(At), g = i || h.columns === 1, _ = !!o;
|
|
2356
2356
|
return /* @__PURE__ */ Y("div", {
|
|
2357
2357
|
className: "detail-row",
|
|
2358
2358
|
"data-error": _ || void 0,
|
|
@@ -2363,7 +2363,7 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2363
2363
|
gap: g ? 4 : 16,
|
|
2364
2364
|
alignItems: g ? "stretch" : "flex-start",
|
|
2365
2365
|
padding: "6px 0",
|
|
2366
|
-
...
|
|
2366
|
+
...i ? { gridColumn: "1 / -1" } : null
|
|
2367
2367
|
},
|
|
2368
2368
|
children: [/* @__PURE__ */ Y("div", {
|
|
2369
2369
|
style: {
|
|
@@ -2387,7 +2387,7 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2387
2387
|
id: f,
|
|
2388
2388
|
title: p || void 0,
|
|
2389
2389
|
children: t
|
|
2390
|
-
}),
|
|
2390
|
+
}), a && u === "edit" && /* @__PURE__ */ J("span", {
|
|
2391
2391
|
"aria-hidden": "true",
|
|
2392
2392
|
style: {
|
|
2393
2393
|
color: "var(--danger)",
|
|
@@ -2425,9 +2425,9 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2425
2425
|
borderRadius: 6,
|
|
2426
2426
|
boxShadow: "0 0 0 1.5px var(--danger)"
|
|
2427
2427
|
},
|
|
2428
|
-
children:
|
|
2429
|
-
}) :
|
|
2430
|
-
}), (l ||
|
|
2428
|
+
children: r
|
|
2429
|
+
}) : r
|
|
2430
|
+
}), (l || c) && /* @__PURE__ */ Y("div", {
|
|
2431
2431
|
className: "detail-row-action",
|
|
2432
2432
|
style: {
|
|
2433
2433
|
display: "flex",
|
|
@@ -2435,13 +2435,13 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2435
2435
|
flexShrink: 0,
|
|
2436
2436
|
marginTop: -2
|
|
2437
2437
|
},
|
|
2438
|
-
children: [l && /* @__PURE__ */ J(
|
|
2438
|
+
children: [l && /* @__PURE__ */ J(n, {
|
|
2439
2439
|
value: l,
|
|
2440
2440
|
size: "sm",
|
|
2441
2441
|
title: "Copy value"
|
|
2442
|
-
}),
|
|
2442
|
+
}), c]
|
|
2443
2443
|
})]
|
|
2444
|
-
}), (_ ||
|
|
2444
|
+
}), (_ || s != null) && /* @__PURE__ */ Y("div", {
|
|
2445
2445
|
style: {
|
|
2446
2446
|
fontSize: 11.5,
|
|
2447
2447
|
lineHeight: 1.4,
|
|
@@ -2450,7 +2450,7 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2450
2450
|
alignItems: "center",
|
|
2451
2451
|
gap: 4
|
|
2452
2452
|
},
|
|
2453
|
-
children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ?
|
|
2453
|
+
children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ? o : s })]
|
|
2454
2454
|
})]
|
|
2455
2455
|
})]
|
|
2456
2456
|
});
|
|
@@ -2458,64 +2458,64 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2458
2458
|
//#endregion
|
|
2459
2459
|
//#region src/components/detail-layout/FieldsBlock.tsx
|
|
2460
2460
|
function Nt({ fields: e, ctx: t }) {
|
|
2461
|
-
let { entity: n, entityCode:
|
|
2461
|
+
let { entity: n, entityCode: i, record: a, mode: o, onFieldChange: s, schema: l } = t, u = r(), d = t.columns ?? 2, f = d === 1 && e.length === 1;
|
|
2462
2462
|
return /* @__PURE__ */ J(jt, {
|
|
2463
|
-
columns:
|
|
2463
|
+
columns: d,
|
|
2464
2464
|
children: e.map((e) => {
|
|
2465
|
-
let
|
|
2466
|
-
tier:
|
|
2467
|
-
tierDef: ce(
|
|
2468
|
-
requiredPermission:
|
|
2469
|
-
locale:
|
|
2470
|
-
variant:
|
|
2471
|
-
}) :
|
|
2465
|
+
let r = e.name, d = `${i ?? "field"}-${r}`, p = `${d}-label`, h = n.fields.get(r), g = !!(h?.auto || h?.readonly || h?.source), _ = V(n, r), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = g || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ J(ie, {
|
|
2466
|
+
tier: _.classification,
|
|
2467
|
+
tierDef: ce(l, n, r),
|
|
2468
|
+
requiredPermission: _?.required_permission,
|
|
2469
|
+
locale: u,
|
|
2470
|
+
variant: x === "edit" ? "input" : "value"
|
|
2471
|
+
}) : ae({
|
|
2472
2472
|
entity: n,
|
|
2473
|
-
entityCode:
|
|
2474
|
-
fieldName:
|
|
2475
|
-
record:
|
|
2476
|
-
mode:
|
|
2477
|
-
onChange:
|
|
2473
|
+
entityCode: i,
|
|
2474
|
+
fieldName: r,
|
|
2475
|
+
record: a,
|
|
2476
|
+
mode: x,
|
|
2477
|
+
onChange: s && !g ? (e) => s(r, e) : void 0,
|
|
2478
2478
|
refs: t.refs,
|
|
2479
|
-
entities:
|
|
2480
|
-
screens:
|
|
2481
|
-
locale:
|
|
2479
|
+
entities: l?.entities,
|
|
2480
|
+
screens: l?.screens,
|
|
2481
|
+
locale: u,
|
|
2482
2482
|
fieldId: d,
|
|
2483
|
-
labelId:
|
|
2483
|
+
labelId: p
|
|
2484
2484
|
});
|
|
2485
|
-
if (!
|
|
2486
|
-
let
|
|
2487
|
-
actionCode: `${
|
|
2485
|
+
if (!S) return null;
|
|
2486
|
+
let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(I, {
|
|
2487
|
+
actionCode: `${r}.action[${t}]`,
|
|
2488
2488
|
action: e,
|
|
2489
|
-
entityCode:
|
|
2490
|
-
row:
|
|
2489
|
+
entityCode: i,
|
|
2490
|
+
row: a,
|
|
2491
2491
|
variant: "ghost",
|
|
2492
2492
|
size: "icon"
|
|
2493
|
-
}, t)) }) : void 0,
|
|
2494
|
-
return
|
|
2493
|
+
}, t)) }) : void 0, w = !!h && kt.has(h.type), T = a?.[r], E = x === "display" && (h?.copyable || h?.type === "uuid") && T != null && T !== "" ? c(T) : void 0, D = m(h?.display?.description);
|
|
2494
|
+
return f ? /* @__PURE__ */ Y("div", {
|
|
2495
2495
|
style: { gridColumn: "1 / -1" },
|
|
2496
|
-
children: [
|
|
2496
|
+
children: [S, x === "edit" && D && /* @__PURE__ */ J("div", {
|
|
2497
2497
|
style: {
|
|
2498
2498
|
fontSize: 11.5,
|
|
2499
2499
|
lineHeight: 1.4,
|
|
2500
2500
|
color: "var(--text-3)",
|
|
2501
2501
|
marginTop: 3
|
|
2502
2502
|
},
|
|
2503
|
-
children:
|
|
2503
|
+
children: D
|
|
2504
2504
|
})]
|
|
2505
|
-
},
|
|
2506
|
-
label:
|
|
2507
|
-
htmlFor:
|
|
2508
|
-
labelId:
|
|
2509
|
-
labelTitle:
|
|
2510
|
-
required:
|
|
2511
|
-
mode:
|
|
2512
|
-
span:
|
|
2513
|
-
error: t.fieldErrors?.[
|
|
2514
|
-
hint:
|
|
2515
|
-
actions:
|
|
2516
|
-
copyValue:
|
|
2517
|
-
children:
|
|
2518
|
-
},
|
|
2505
|
+
}, r) : /* @__PURE__ */ J(Mt, {
|
|
2506
|
+
label: P(n, r, l.entities),
|
|
2507
|
+
htmlFor: x === "edit" ? d : void 0,
|
|
2508
|
+
labelId: p,
|
|
2509
|
+
labelTitle: D || void 0,
|
|
2510
|
+
required: h?.required ?? !1,
|
|
2511
|
+
mode: x,
|
|
2512
|
+
span: w,
|
|
2513
|
+
error: t.fieldErrors?.[r],
|
|
2514
|
+
hint: x === "edit" && D ? D : void 0,
|
|
2515
|
+
actions: C,
|
|
2516
|
+
copyValue: E,
|
|
2517
|
+
children: S
|
|
2518
|
+
}, r);
|
|
2519
2519
|
})
|
|
2520
2520
|
});
|
|
2521
2521
|
}
|
|
@@ -2531,57 +2531,57 @@ var Pt = /* @__PURE__ */ new Set([
|
|
|
2531
2531
|
"url"
|
|
2532
2532
|
]), Ft = 500;
|
|
2533
2533
|
function It({ node: e, ctx: t }) {
|
|
2534
|
-
let { entity: n, objectProperties: r, onSetProperty:
|
|
2535
|
-
if (
|
|
2536
|
-
let
|
|
2537
|
-
return
|
|
2534
|
+
let { entity: n, objectProperties: r, onSetProperty: a, isNew: o, mode: s, refs: c } = t, l = n.properties ?? {};
|
|
2535
|
+
if (o) return null;
|
|
2536
|
+
let u = e.properties === !0 || e.properties, d = u === !0 ? Object.entries(l).sort(([e], [t]) => e.localeCompare(t)) : u.filter((e) => l[e] != null).map((e) => [e, l[e]]);
|
|
2537
|
+
return d.length === 0 ? null : /* @__PURE__ */ J(jt, {
|
|
2538
2538
|
columns: 2,
|
|
2539
|
-
children:
|
|
2540
|
-
let
|
|
2539
|
+
children: d.map(([e, o]) => {
|
|
2540
|
+
let l = r?.find((t) => t.property_code === e), u = i(o), d = o.readonly || !a ? "display" : s;
|
|
2541
2541
|
return /* @__PURE__ */ J(Lt, {
|
|
2542
2542
|
propCode: e,
|
|
2543
|
-
prop:
|
|
2544
|
-
field:
|
|
2545
|
-
value:
|
|
2546
|
-
mode:
|
|
2547
|
-
onSetProperty:
|
|
2548
|
-
refs:
|
|
2543
|
+
prop: o,
|
|
2544
|
+
field: u,
|
|
2545
|
+
value: l?.value,
|
|
2546
|
+
mode: d,
|
|
2547
|
+
onSetProperty: a,
|
|
2548
|
+
refs: c,
|
|
2549
2549
|
entity: n,
|
|
2550
2550
|
schema: t.schema
|
|
2551
2551
|
}, e);
|
|
2552
2552
|
})
|
|
2553
2553
|
});
|
|
2554
2554
|
}
|
|
2555
|
-
function Lt({ propCode: e, prop: t, field: n, value:
|
|
2556
|
-
let
|
|
2555
|
+
function Lt({ propCode: e, prop: t, field: n, value: i, mode: a, onSetProperty: o, refs: s, entity: c, schema: l }) {
|
|
2556
|
+
let u = r(), d = G(null);
|
|
2557
2557
|
U(() => () => {
|
|
2558
|
-
|
|
2558
|
+
d.current && clearTimeout(d.current);
|
|
2559
2559
|
}, []);
|
|
2560
|
-
let
|
|
2561
|
-
|
|
2560
|
+
let f = H((n) => {
|
|
2561
|
+
o && (Pt.has(t.type) ? (d.current && clearTimeout(d.current), d.current = setTimeout(() => o(e, n), Ft)) : o(e, n));
|
|
2562
2562
|
}, [
|
|
2563
2563
|
e,
|
|
2564
2564
|
t.type,
|
|
2565
|
-
|
|
2566
|
-
]),
|
|
2565
|
+
o
|
|
2566
|
+
]), p = V(c, e), h = p?.read === "denied", g = p?.write === "denied", _ = a === "display" ? h : g || h, v = a === "edit" && g ? "display" : a;
|
|
2567
2567
|
return /* @__PURE__ */ J(Mt, {
|
|
2568
|
-
label:
|
|
2569
|
-
mode:
|
|
2568
|
+
label: m(t.display?.name ?? t.name),
|
|
2569
|
+
mode: v,
|
|
2570
2570
|
span: kt.has(t.type),
|
|
2571
|
-
children:
|
|
2572
|
-
tier:
|
|
2573
|
-
tierDef: ce(
|
|
2574
|
-
requiredPermission:
|
|
2575
|
-
locale:
|
|
2576
|
-
variant:
|
|
2577
|
-
}) :
|
|
2571
|
+
children: _ ? /* @__PURE__ */ J(ie, {
|
|
2572
|
+
tier: p.classification,
|
|
2573
|
+
tierDef: ce(l, c, e),
|
|
2574
|
+
requiredPermission: p?.required_permission,
|
|
2575
|
+
locale: u,
|
|
2576
|
+
variant: v === "edit" ? "input" : "value"
|
|
2577
|
+
}) : w({
|
|
2578
2578
|
field: n,
|
|
2579
2579
|
fieldName: e,
|
|
2580
|
-
value:
|
|
2581
|
-
mode:
|
|
2582
|
-
onChange:
|
|
2583
|
-
refs:
|
|
2584
|
-
locale:
|
|
2580
|
+
value: i,
|
|
2581
|
+
mode: v,
|
|
2582
|
+
onChange: v === "edit" ? f : void 0,
|
|
2583
|
+
refs: s,
|
|
2584
|
+
locale: u
|
|
2585
2585
|
})
|
|
2586
2586
|
});
|
|
2587
2587
|
}
|
|
@@ -2663,7 +2663,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2663
2663
|
gap: 16
|
|
2664
2664
|
},
|
|
2665
2665
|
children: Object.entries(e).map(([e, a]) => {
|
|
2666
|
-
let o = t?.find((t) => t.group_code === e)?.status_code,
|
|
2666
|
+
let o = t?.find((t) => t.group_code === e)?.status_code, s = o ? a.statuses.find((e) => e.code === o) : void 0;
|
|
2667
2667
|
if (a.display_mode === "stepper") {
|
|
2668
2668
|
let t = i === "edit", s = t ? a.transitions && o ? /* @__PURE__ */ new Set([o, ...a.transitions[o] ?? []]) : new Set(a.statuses.map((e) => e.code)) : void 0;
|
|
2669
2669
|
return /* @__PURE__ */ Y("div", {
|
|
@@ -2679,7 +2679,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2679
2679
|
color: "var(--text-3)",
|
|
2680
2680
|
flexShrink: 0
|
|
2681
2681
|
},
|
|
2682
|
-
children: [
|
|
2682
|
+
children: [m(a.name), ":"]
|
|
2683
2683
|
}), /* @__PURE__ */ J("div", {
|
|
2684
2684
|
style: {
|
|
2685
2685
|
minWidth: 240,
|
|
@@ -2689,7 +2689,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2689
2689
|
children: /* @__PURE__ */ J(Rt, {
|
|
2690
2690
|
stages: a.statuses.map((e) => ({
|
|
2691
2691
|
code: e.code,
|
|
2692
|
-
label:
|
|
2692
|
+
label: m(e.name)
|
|
2693
2693
|
})),
|
|
2694
2694
|
current: o,
|
|
2695
2695
|
selectable: s,
|
|
@@ -2710,11 +2710,11 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2710
2710
|
fontSize: 12,
|
|
2711
2711
|
color: "var(--text-3)"
|
|
2712
2712
|
},
|
|
2713
|
-
children: [
|
|
2714
|
-
}),
|
|
2715
|
-
tone:
|
|
2713
|
+
children: [m(a.name), ":"]
|
|
2714
|
+
}), s ? /* @__PURE__ */ J(_, {
|
|
2715
|
+
tone: s.color ?? "slate",
|
|
2716
2716
|
size: "xs",
|
|
2717
|
-
children:
|
|
2717
|
+
children: m(s.name)
|
|
2718
2718
|
}) : /* @__PURE__ */ J("span", {
|
|
2719
2719
|
style: {
|
|
2720
2720
|
fontSize: 12.5,
|
|
@@ -2723,7 +2723,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2723
2723
|
children: "—"
|
|
2724
2724
|
})]
|
|
2725
2725
|
}, e);
|
|
2726
|
-
let
|
|
2726
|
+
let c = (a.transitions && o ? a.statuses.filter((e) => e.code === o || (a.transitions[o]?.includes(e.code) ?? !1)) : a.statuses).map((e) => ({
|
|
2727
2727
|
value: e.code,
|
|
2728
2728
|
label: /* @__PURE__ */ Y("span", {
|
|
2729
2729
|
style: {
|
|
@@ -2737,7 +2737,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2737
2737
|
borderRadius: 999,
|
|
2738
2738
|
background: `var(--pill-${e.color}, ${e.color})`,
|
|
2739
2739
|
display: "inline-block"
|
|
2740
|
-
} }),
|
|
2740
|
+
} }), m(e.name)]
|
|
2741
2741
|
})
|
|
2742
2742
|
}));
|
|
2743
2743
|
return /* @__PURE__ */ Y("div", {
|
|
@@ -2751,16 +2751,16 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2751
2751
|
fontSize: 12,
|
|
2752
2752
|
color: "var(--text-3)"
|
|
2753
2753
|
},
|
|
2754
|
-
children: [
|
|
2754
|
+
children: [m(a.name), ":"]
|
|
2755
2755
|
}), /* @__PURE__ */ J("div", {
|
|
2756
2756
|
style: {
|
|
2757
2757
|
minWidth: 180,
|
|
2758
2758
|
opacity: r ? .6 : 1,
|
|
2759
2759
|
pointerEvents: r ? "none" : "auto"
|
|
2760
2760
|
},
|
|
2761
|
-
children: /* @__PURE__ */ J(
|
|
2761
|
+
children: /* @__PURE__ */ J(h, {
|
|
2762
2762
|
value: o ?? "",
|
|
2763
|
-
options:
|
|
2763
|
+
options: c,
|
|
2764
2764
|
onChange: (t) => n(e, t),
|
|
2765
2765
|
placeholder: "Select…"
|
|
2766
2766
|
})
|
|
@@ -3016,45 +3016,45 @@ function rn(e, t) {
|
|
|
3016
3016
|
return !t || Object.entries(t).every(([t, n]) => e[t] === n);
|
|
3017
3017
|
}
|
|
3018
3018
|
function an({ values: e, options: t }) {
|
|
3019
|
-
let
|
|
3019
|
+
let n = W(() => en(t), [t]), i = r(), a = te(), o = e.scope, s = n?.windows.some((e) => e.code === n.default_window) ? n.default_window : n?.windows[0]?.code ?? "", [c, l] = K(s), [u, d] = K("");
|
|
3020
3020
|
U(() => {
|
|
3021
3021
|
l(s);
|
|
3022
3022
|
}, [s]), U(() => {
|
|
3023
3023
|
d("");
|
|
3024
3024
|
}, [c]);
|
|
3025
|
-
let f =
|
|
3026
|
-
field:
|
|
3025
|
+
let f = n ? [{
|
|
3026
|
+
field: n.scope_field,
|
|
3027
3027
|
op: "eq",
|
|
3028
3028
|
value: o
|
|
3029
3029
|
}, {
|
|
3030
|
-
field:
|
|
3030
|
+
field: n.window_field,
|
|
3031
3031
|
op: "eq",
|
|
3032
3032
|
value: c
|
|
3033
|
-
}] : [], p = n
|
|
3033
|
+
}] : [], p = g(n?.entity, {
|
|
3034
3034
|
per_page: 1,
|
|
3035
3035
|
filters: f
|
|
3036
|
-
}, !!(
|
|
3037
|
-
field:
|
|
3036
|
+
}, !!(n && o && c)), h = n?.breakdown, _ = h ? [{
|
|
3037
|
+
field: h.scope_field,
|
|
3038
3038
|
op: "eq",
|
|
3039
3039
|
value: o
|
|
3040
3040
|
}, {
|
|
3041
|
-
field:
|
|
3041
|
+
field: h.window_field,
|
|
3042
3042
|
op: "eq",
|
|
3043
3043
|
value: c
|
|
3044
|
-
}] : [],
|
|
3045
|
-
per_page:
|
|
3046
|
-
sort:
|
|
3047
|
-
filters:
|
|
3048
|
-
}, !!(
|
|
3049
|
-
if (!
|
|
3044
|
+
}] : [], v = g(h?.entity, {
|
|
3045
|
+
per_page: h?.limit ?? 200,
|
|
3046
|
+
sort: h?.sort,
|
|
3047
|
+
filters: _
|
|
3048
|
+
}, !!(h && o && c));
|
|
3049
|
+
if (!n || !o) return /* @__PURE__ */ J("div", {
|
|
3050
3050
|
role: "alert",
|
|
3051
3051
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
3052
3052
|
children: "Invalid entity_scorecard configuration."
|
|
3053
3053
|
});
|
|
3054
|
-
let
|
|
3055
|
-
let t =
|
|
3054
|
+
let y = p.data?.data?.[0], b = v.data?.data ?? [], x = h?.filter_field ? Array.from(new Set(b.map((e) => e[h.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], S = u && h?.filter_field ? b.filter((e) => e[h.filter_field] === u) : b, C = (e) => !u || !e.filtered || !h?.filter_field ? y?.[e.field] : b.find((t) => t[h.filter_field] === u && rn(t, e.filtered?.where))?.[e.filtered.field], w = (e) => {
|
|
3055
|
+
let t = n.drillthrough;
|
|
3056
3056
|
if (!t || !e.drillthrough_value) return;
|
|
3057
|
-
let
|
|
3057
|
+
let r = [{
|
|
3058
3058
|
field: t.scope_field,
|
|
3059
3059
|
op: "eq",
|
|
3060
3060
|
value: o
|
|
@@ -3063,36 +3063,36 @@ function an({ values: e, options: t }) {
|
|
|
3063
3063
|
op: "eq",
|
|
3064
3064
|
value: c
|
|
3065
3065
|
}];
|
|
3066
|
-
t.filter_field && u && e.drillthrough_filter !== !1 &&
|
|
3066
|
+
t.filter_field && u && e.drillthrough_filter !== !1 && r.push({
|
|
3067
3067
|
field: t.filter_field,
|
|
3068
3068
|
op: "eq",
|
|
3069
3069
|
value: u
|
|
3070
|
-
}), t.metric_field &&
|
|
3070
|
+
}), t.metric_field && r.push({
|
|
3071
3071
|
field: t.metric_field,
|
|
3072
3072
|
op: "eq",
|
|
3073
3073
|
value: e.drillthrough_value
|
|
3074
|
-
}), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(
|
|
3075
|
-
},
|
|
3074
|
+
}), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(r) }).toString() });
|
|
3075
|
+
}, T = p.error ?? v.error;
|
|
3076
3076
|
return /* @__PURE__ */ Y("div", {
|
|
3077
3077
|
className: "flex min-w-0 flex-col gap-4",
|
|
3078
|
-
"aria-label":
|
|
3078
|
+
"aria-label": m(n.title, i) || "Scorecard",
|
|
3079
3079
|
children: [
|
|
3080
3080
|
/* @__PURE__ */ Y("div", {
|
|
3081
3081
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
3082
3082
|
children: [/* @__PURE__ */ Y("div", {
|
|
3083
3083
|
className: "min-w-0",
|
|
3084
3084
|
children: [
|
|
3085
|
-
|
|
3085
|
+
n.title && /* @__PURE__ */ J("h3", {
|
|
3086
3086
|
className: "text-base font-semibold text-foreground",
|
|
3087
|
-
children:
|
|
3087
|
+
children: m(n.title, i)
|
|
3088
3088
|
}),
|
|
3089
|
-
|
|
3089
|
+
n.description && /* @__PURE__ */ J("p", {
|
|
3090
3090
|
className: "mt-1 text-sm text-muted-foreground",
|
|
3091
|
-
children:
|
|
3091
|
+
children: m(n.description, i)
|
|
3092
3092
|
}),
|
|
3093
|
-
|
|
3093
|
+
n.intended_note && /* @__PURE__ */ J("p", {
|
|
3094
3094
|
className: "mt-1 text-xs text-muted-foreground",
|
|
3095
|
-
children:
|
|
3095
|
+
children: m(n.intended_note, i)
|
|
3096
3096
|
})
|
|
3097
3097
|
]
|
|
3098
3098
|
}), /* @__PURE__ */ Y("div", {
|
|
@@ -3101,24 +3101,24 @@ function an({ values: e, options: t }) {
|
|
|
3101
3101
|
role: "group",
|
|
3102
3102
|
"aria-label": "Scorecard window",
|
|
3103
3103
|
className: "inline-flex rounded border border-border p-1",
|
|
3104
|
-
children:
|
|
3104
|
+
children: n.windows.map((e) => /* @__PURE__ */ J("button", {
|
|
3105
3105
|
type: "button",
|
|
3106
3106
|
"aria-pressed": c === e.code,
|
|
3107
3107
|
onClick: () => l(e.code),
|
|
3108
3108
|
className: `rounded px-3 py-1.5 text-xs font-medium ${c === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
|
|
3109
|
-
children:
|
|
3109
|
+
children: m(e.label, i) || e.code
|
|
3110
3110
|
}, e.code))
|
|
3111
|
-
}),
|
|
3111
|
+
}), h?.filter_field && /* @__PURE__ */ Y("label", {
|
|
3112
3112
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
3113
|
-
children: [
|
|
3114
|
-
"aria-label":
|
|
3113
|
+
children: [m(h.filter_label, i) || "Filter", /* @__PURE__ */ Y("select", {
|
|
3114
|
+
"aria-label": m(h.filter_label, i) || "Filter",
|
|
3115
3115
|
value: u,
|
|
3116
3116
|
onChange: (e) => d(e.target.value),
|
|
3117
3117
|
className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
|
|
3118
3118
|
children: [/* @__PURE__ */ J("option", {
|
|
3119
3119
|
value: "",
|
|
3120
|
-
children:
|
|
3121
|
-
}),
|
|
3120
|
+
children: m(h.all_label, i) || "All"
|
|
3121
|
+
}), x.map((e) => /* @__PURE__ */ J("option", {
|
|
3122
3122
|
value: e,
|
|
3123
3123
|
children: e
|
|
3124
3124
|
}, e))]
|
|
@@ -3126,22 +3126,22 @@ function an({ values: e, options: t }) {
|
|
|
3126
3126
|
})]
|
|
3127
3127
|
})]
|
|
3128
3128
|
}),
|
|
3129
|
-
|
|
3129
|
+
T && /* @__PURE__ */ J("div", {
|
|
3130
3130
|
role: "alert",
|
|
3131
3131
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
3132
|
-
children:
|
|
3132
|
+
children: T instanceof Error ? T.message : "Scorecard data could not be loaded."
|
|
3133
3133
|
}),
|
|
3134
|
-
!
|
|
3134
|
+
!T && !p.isLoading && !y && /* @__PURE__ */ J("div", {
|
|
3135
3135
|
className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
|
|
3136
|
-
children:
|
|
3136
|
+
children: m(n.empty_label, i) || "No scorecard data."
|
|
3137
3137
|
}),
|
|
3138
|
-
|
|
3138
|
+
y && /* @__PURE__ */ J("div", {
|
|
3139
3139
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
3140
|
-
children:
|
|
3141
|
-
let t =
|
|
3140
|
+
children: n.metrics.map((e) => {
|
|
3141
|
+
let t = C(e), r = !!(n.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ Y(q, { children: [
|
|
3142
3142
|
/* @__PURE__ */ J("span", {
|
|
3143
3143
|
className: "text-xs font-medium text-muted-foreground",
|
|
3144
|
-
children:
|
|
3144
|
+
children: m(e.label, i) || e.field
|
|
3145
3145
|
}),
|
|
3146
3146
|
/* @__PURE__ */ J("strong", {
|
|
3147
3147
|
className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
|
|
@@ -3149,12 +3149,12 @@ function an({ values: e, options: t }) {
|
|
|
3149
3149
|
}),
|
|
3150
3150
|
e.help && /* @__PURE__ */ J("span", {
|
|
3151
3151
|
className: "mt-1 block text-xs text-muted-foreground",
|
|
3152
|
-
children:
|
|
3152
|
+
children: m(e.help, i)
|
|
3153
3153
|
})
|
|
3154
3154
|
] });
|
|
3155
|
-
return
|
|
3155
|
+
return r ? /* @__PURE__ */ J("button", {
|
|
3156
3156
|
type: "button",
|
|
3157
|
-
onClick: () =>
|
|
3157
|
+
onClick: () => w(e),
|
|
3158
3158
|
className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
|
|
3159
3159
|
children: a
|
|
3160
3160
|
}, e.field) : /* @__PURE__ */ J("article", {
|
|
@@ -3163,26 +3163,26 @@ function an({ values: e, options: t }) {
|
|
|
3163
3163
|
}, e.field);
|
|
3164
3164
|
})
|
|
3165
3165
|
}),
|
|
3166
|
-
|
|
3166
|
+
h && /* @__PURE__ */ J("div", {
|
|
3167
3167
|
className: "min-w-0 overflow-x-auto rounded border border-border",
|
|
3168
3168
|
children: /* @__PURE__ */ Y("table", {
|
|
3169
3169
|
className: "w-full border-collapse text-sm",
|
|
3170
3170
|
children: [/* @__PURE__ */ J("thead", {
|
|
3171
3171
|
className: "bg-surface text-left text-xs text-muted-foreground",
|
|
3172
|
-
children: /* @__PURE__ */ J("tr", { children:
|
|
3172
|
+
children: /* @__PURE__ */ J("tr", { children: h.columns.map((e) => /* @__PURE__ */ J("th", {
|
|
3173
3173
|
className: "border-b border-divider px-3 py-2 font-medium",
|
|
3174
|
-
children:
|
|
3174
|
+
children: m(e.label, i) || e.field
|
|
3175
3175
|
}, e.field)) })
|
|
3176
|
-
}), /* @__PURE__ */ Y("tbody", { children: [
|
|
3176
|
+
}), /* @__PURE__ */ Y("tbody", { children: [S.map((e, t) => /* @__PURE__ */ J("tr", {
|
|
3177
3177
|
className: "border-b border-divider last:border-0",
|
|
3178
|
-
children:
|
|
3178
|
+
children: h.columns.map((t) => /* @__PURE__ */ J("td", {
|
|
3179
3179
|
className: "px-3 py-2 text-foreground",
|
|
3180
3180
|
children: tn(e[t.field], t.format, i)
|
|
3181
3181
|
}, t.field))
|
|
3182
|
-
}, nn(e, t))), !
|
|
3183
|
-
colSpan: Math.max(1,
|
|
3182
|
+
}, nn(e, t))), !v.isLoading && S.length === 0 && /* @__PURE__ */ J("tr", { children: /* @__PURE__ */ J("td", {
|
|
3183
|
+
colSpan: Math.max(1, h.columns.length),
|
|
3184
3184
|
className: "px-3 py-6 text-center text-muted-foreground",
|
|
3185
|
-
children:
|
|
3185
|
+
children: m(h.empty_label, i) || "No breakdown rows."
|
|
3186
3186
|
}) })] })]
|
|
3187
3187
|
})
|
|
3188
3188
|
})
|
|
@@ -3193,7 +3193,7 @@ function an({ values: e, options: t }) {
|
|
|
3193
3193
|
//#region src/components/detail-layout/widgets/builtins.ts
|
|
3194
3194
|
var on = !1;
|
|
3195
3195
|
function sn() {
|
|
3196
|
-
on ||= (
|
|
3196
|
+
on ||= (oe("json_diff", Qt), oe("entity_scorecard", an), !0);
|
|
3197
3197
|
}
|
|
3198
3198
|
//#endregion
|
|
3199
3199
|
//#region src/components/detail-layout/widgets/WidgetHost.tsx
|
|
@@ -3247,7 +3247,7 @@ function $({ node: e, ctx: t }) {
|
|
|
3247
3247
|
}) : e.children ? /* @__PURE__ */ J(wt, {
|
|
3248
3248
|
node: e,
|
|
3249
3249
|
ctx: t
|
|
3250
|
-
}) : e.associated ? /* @__PURE__ */ J(
|
|
3250
|
+
}) : e.associated ? /* @__PURE__ */ J(M, {
|
|
3251
3251
|
node: e,
|
|
3252
3252
|
ctx: t
|
|
3253
3253
|
}) : e.fields ? /* @__PURE__ */ J(Nt, {
|