@declarion/react 0.59.0 → 0.60.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/{AgentChatPanel.impl-DBH1Ff4G.js → AgentChatPanel.impl-BY-Ir7Sh.js} +39 -39
- package/dist-lib/{DetailAuditStrip-GNRA_eP5.js → DetailAuditStrip-B9p1XhjC.js} +26 -27
- package/dist-lib/{DraggableChildrenTable-4RZC351U.js → DraggableChildrenTable-CtL7rdT6.js} +34 -34
- package/dist-lib/{Grid-CQabaBLx.js → Grid-CYERLdXO.js} +1 -1
- package/dist-lib/{LayoutRenderer-DGKWZKpW.js → LayoutRenderer-B08IJKsZ.js} +465 -465
- package/dist-lib/{ListCardsBody-DfGmyNIu.js → ListCardsBody-Dje_rays.js} +26 -26
- package/dist-lib/{MarkdownRenderer-BDbzDv_y.js → MarkdownRenderer-N0IWjTH5.js} +1 -1
- package/dist-lib/{RefreshControl-Bhoib0ZA.js → RefreshControl-BEWSHtAC.js} +26 -26
- package/dist-lib/{SmartDetailPage.impl-Ds2RGg6K.js → SmartDetailPage.impl-CYiM-ITJ.js} +467 -467
- package/dist-lib/SmartListPage.impl-Db_Pv9Xc.js +3051 -0
- package/dist-lib/SmartRecordListPage.impl-hbbLglC1.js +780 -0
- package/dist-lib/{SortHeaderMenu-Cijxk4cX.js → SortHeaderMenu-DKKeCGTH.js} +1 -1
- package/dist-lib/{action-dispatch-DY0c8U81.js → action-dispatch-DbiOpvd6.js} +187 -187
- package/dist-lib/api/data.d.ts +5 -1
- package/dist-lib/{cardProjection-Bkl2SSYz.js → cardProjection-nveYLvHR.js} +1 -1
- package/dist-lib/components/chrome/headerActionZone.d.ts +27 -0
- package/dist-lib/components/pages/list/filter-meta.d.ts +1 -1
- package/dist-lib/components/pages/list/useActiveView.d.ts +9 -2
- package/dist-lib/components/pages/list/useListViews.d.ts +3 -2
- package/dist-lib/{failure-v-uGSpbX.js → failure-BT54OLHy.js} +5 -5
- package/dist-lib/{format-count-DA4wmmWR.js → format-count-DLFCdtME.js} +246 -246
- package/dist-lib/hooks/useObject.d.ts +3 -2
- package/dist-lib/index.js +1083 -1091
- package/dist-lib/lib/field-classification.d.ts +10 -1
- package/dist-lib/{peekDraftStore-D-cTbiIr.js → peekDraftStore-DSExeoAh.js} +6 -6
- package/dist-lib/{registry-Cb3W-czW.js → registry-CRPxNbkk.js} +444 -438
- package/dist-lib/testing.js +2 -2
- package/dist-lib/{useAgentConversation-D97IqE-J.js → useAgentConversation-BavrHfrU.js} +14 -14
- package/dist-lib/{useCurrentScreen-BL5NZFCw.js → useCurrentScreen-BPq7HMF1.js} +1083 -1017
- package/dist-lib/{useListQuery-BG1GyKtJ.js → useListQuery-CG1WM4cv.js} +5 -5
- package/dist-lib/{field-classification-C28XE-_P.js → useOwnRefresh-C18iWRgr.js} +132 -158
- package/dist-lib/{useProperties-4Lg3odrt.js → useProperties-C35JrjwQ.js} +2 -2
- package/dist-lib/{useTabSearchMirror-ZVLlINBX.js → useTabSearchMirror-DKktWWLB.js} +1 -1
- package/package.json +1 -1
- package/dist-lib/SmartListPage.impl-BrZLE_Gb.js +0 -3046
- package/dist-lib/SmartRecordListPage.impl-C1FJLr80.js +0 -780
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
-
import { An as n,
|
|
3
|
-
import { M as
|
|
4
|
-
import { a as
|
|
5
|
-
import { c as
|
|
6
|
-
import { E as
|
|
7
|
-
import { m as ue, p as de } from "./action-dispatch-
|
|
2
|
+
import { An as n, Bn as r, D as i, Dn as a, En as o, Fn as s, It as c, Jn as l, Kn as u, O as d, Pn as f, St as p, Tn as m, Un as h, Vn as g, b as _, fn as v, gn as y, it as b, jn as x, kn as S, qn as C, rt as w, sn as T, xt as E, yn as D, z as O, zt as k } from "./useCurrentScreen-BPq7HMF1.js";
|
|
3
|
+
import { M as A, d as j, t as M } from "./useText-BFDCTUSo.js";
|
|
4
|
+
import { a as N, d as P, f as F, h as I, i as L, l as R, m as z, o as B, r as V, t as H, u as U } from "./registry-CRPxNbkk.js";
|
|
5
|
+
import { c as ee, o as te, s as ne, t as re, y as ie } from "./failure-BT54OLHy.js";
|
|
6
|
+
import { E as ae, _ as oe, i as se, t as ce, y as le } from "./useOwnRefresh-C18iWRgr.js";
|
|
7
|
+
import { m as ue, p as de } from "./action-dispatch-DbiOpvd6.js";
|
|
8
8
|
import { n as fe, r as pe, t as me } from "./dataTableStyles-vwD1mVOP.js";
|
|
9
9
|
import { Suspense as he, lazy as ge, useCallback as W, useEffect as G, useId as _e, useLayoutEffect as ve, useMemo as ye, useRef as K, useState as q } from "react";
|
|
10
10
|
import { useInfiniteQuery as be, useMutation as xe, useQueryClient as Se } from "@tanstack/react-query";
|
|
@@ -65,16 +65,16 @@ function Te({ config: e, ctx: t }) {
|
|
|
65
65
|
}, [u, p]), h = u ?? p(), g = e.height ? De(e.height) : void 0;
|
|
66
66
|
return /* @__PURE__ */ Y("div", {
|
|
67
67
|
ref: l,
|
|
68
|
-
className:
|
|
68
|
+
className: F("flex", s && "flex-col"),
|
|
69
69
|
style: {
|
|
70
70
|
gap: r ? `${r}px` : void 0,
|
|
71
71
|
...g
|
|
72
72
|
},
|
|
73
73
|
children: n.map((r, a) => /* @__PURE__ */ X("div", {
|
|
74
|
-
className:
|
|
74
|
+
className: F("min-w-0 flex items-stretch", s && "w-full"),
|
|
75
75
|
style: s ? void 0 : Ee(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
|
|
76
76
|
children: [/* @__PURE__ */ Y("div", {
|
|
77
|
-
className:
|
|
77
|
+
className: F("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
|
|
78
78
|
children: /* @__PURE__ */ Y(ln, {
|
|
79
79
|
node: r,
|
|
80
80
|
ctx: t
|
|
@@ -148,7 +148,7 @@ function je(e, t) {
|
|
|
148
148
|
//#endregion
|
|
149
149
|
//#region src/components/detail-layout/LayoutTabs.tsx
|
|
150
150
|
function Me({ config: e, ctx: n }) {
|
|
151
|
-
let r =
|
|
151
|
+
let r = M(), { items: i } = e, [a, o] = q(0), s = y(), c = n.detailTabsPresentation ?? (s.isPhone ? "sections" : "scroll");
|
|
152
152
|
if (i.length === 0) return null;
|
|
153
153
|
if (c === "sections") {
|
|
154
154
|
let e = i.map((e, t) => `detail-tab-section-${t}`);
|
|
@@ -335,7 +335,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
335
335
|
//#endregion
|
|
336
336
|
//#region src/components/detail-layout/SectionBlock.tsx
|
|
337
337
|
function Ne({ config: e, ctx: n }) {
|
|
338
|
-
let r =
|
|
338
|
+
let r = M(), { name: i, items: a, collapsed: o = !1, columns: s, icon: c, badge: l, emphasis: u } = e, d = {
|
|
339
339
|
...n,
|
|
340
340
|
withinCard: !0,
|
|
341
341
|
...s ? { columns: s } : null
|
|
@@ -347,7 +347,7 @@ function Ne({ config: e, ctx: n }) {
|
|
|
347
347
|
tone: l.tone,
|
|
348
348
|
dot: l.dot
|
|
349
349
|
} : void 0;
|
|
350
|
-
return /* @__PURE__ */ Y(
|
|
350
|
+
return /* @__PURE__ */ Y(I, {
|
|
351
351
|
title: r(i),
|
|
352
352
|
defaultOpen: !o,
|
|
353
353
|
icon: f,
|
|
@@ -387,7 +387,7 @@ function Z(e, t, n) {
|
|
|
387
387
|
return e ?? t ?? n;
|
|
388
388
|
}
|
|
389
389
|
function Fe(e) {
|
|
390
|
-
return
|
|
390
|
+
return m(e, "update") ? "inline_edit" : "readonly";
|
|
391
391
|
}
|
|
392
392
|
function Ie(e) {
|
|
393
393
|
return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
|
|
@@ -463,7 +463,7 @@ function We(e, ...t) {
|
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
function Ge(e) {
|
|
466
|
-
let t =
|
|
466
|
+
let t = S(e);
|
|
467
467
|
return t.length > 0 ? t[0] : void 0;
|
|
468
468
|
}
|
|
469
469
|
function Ke(e, t) {
|
|
@@ -477,7 +477,7 @@ function qe(e, t, n, r) {
|
|
|
477
477
|
...e
|
|
478
478
|
};
|
|
479
479
|
if (Array.isArray(n)) {
|
|
480
|
-
let e = Array.isArray(r) ? r.map(String) :
|
|
480
|
+
let e = Array.isArray(r) ? r.map(String) : x(String(r), n.length);
|
|
481
481
|
if (!e || e.length !== n.length) throw Error("invalid composite parent id");
|
|
482
482
|
for (let t = 0; t < n.length; t++) i[n[t]] = e[t];
|
|
483
483
|
} else i[n] = Array.isArray(r) ? r[0] : r;
|
|
@@ -492,27 +492,27 @@ function Je(e, t) {
|
|
|
492
492
|
}
|
|
493
493
|
//#endregion
|
|
494
494
|
//#region src/components/detail-layout/useQuickAdd.ts
|
|
495
|
-
function Ye(e, t,
|
|
496
|
-
let [
|
|
497
|
-
let t = e.quick_add,
|
|
498
|
-
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ?
|
|
495
|
+
function Ye(e, t, a, o) {
|
|
496
|
+
let [s, c] = q(() => {
|
|
497
|
+
let t = e.quick_add, n = o.entities[e.entity], i = {};
|
|
498
|
+
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = r()) : i[e] = t.defaults[e];
|
|
499
499
|
return i;
|
|
500
|
-
}),
|
|
501
|
-
mutationFn: (t) =>
|
|
502
|
-
onMutate: async (
|
|
503
|
-
let
|
|
504
|
-
|
|
500
|
+
}), l = Se(), { mutate: u, isPending: d, error: f, reset: p } = xe({
|
|
501
|
+
mutationFn: (t) => te(e.entity, t),
|
|
502
|
+
onMutate: async (r) => {
|
|
503
|
+
let o = Array.isArray(a) ? n(a.map(String)) : a, s = [
|
|
504
|
+
i,
|
|
505
505
|
t,
|
|
506
|
-
|
|
506
|
+
o,
|
|
507
507
|
e.entity
|
|
508
508
|
];
|
|
509
|
-
await
|
|
510
|
-
let
|
|
511
|
-
...
|
|
509
|
+
await l.cancelQueries({ queryKey: s });
|
|
510
|
+
let c = l.getQueriesData({ queryKey: s }), u = {
|
|
511
|
+
...r,
|
|
512
512
|
id: `__optimistic_${crypto.randomUUID()}`,
|
|
513
513
|
__optimistic: !0
|
|
514
514
|
};
|
|
515
|
-
return
|
|
515
|
+
return l.setQueriesData({ queryKey: s }, (e) => {
|
|
516
516
|
if (!e || typeof e != "object") return e;
|
|
517
517
|
if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
|
|
518
518
|
let t = e, [n, ...r] = t.pages;
|
|
@@ -520,48 +520,48 @@ function Ye(e, t, i, a) {
|
|
|
520
520
|
...t,
|
|
521
521
|
pages: [{
|
|
522
522
|
...n,
|
|
523
|
-
data: [
|
|
523
|
+
data: [u, ...n.data]
|
|
524
524
|
}, ...r]
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
527
|
return e;
|
|
528
|
-
}), { snapshots:
|
|
528
|
+
}), { snapshots: c };
|
|
529
529
|
},
|
|
530
530
|
onError: (e, t, n) => {
|
|
531
|
-
if (n?.snapshots) for (let [e, t] of n.snapshots)
|
|
531
|
+
if (n?.snapshots) for (let [e, t] of n.snapshots) l.setQueryData(e, t);
|
|
532
532
|
},
|
|
533
533
|
onSuccess: () => {
|
|
534
|
-
let t = e.quick_add,
|
|
535
|
-
if (t?.fields) for (let e of t.fields) i[e] = t?.defaults?.[e] == null ?
|
|
536
|
-
|
|
534
|
+
let t = e.quick_add, n = o.entities[e.entity], i = {};
|
|
535
|
+
if (t?.fields) for (let e of t.fields) i[e] = t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? r() : "" : t.defaults[e];
|
|
536
|
+
c(i);
|
|
537
537
|
},
|
|
538
538
|
onSettled: () => {
|
|
539
|
-
let
|
|
540
|
-
|
|
541
|
-
|
|
539
|
+
let r = Array.isArray(a) ? n(a.map(String)) : a;
|
|
540
|
+
l.invalidateQueries({ queryKey: [
|
|
541
|
+
i,
|
|
542
542
|
t,
|
|
543
|
-
|
|
543
|
+
r,
|
|
544
544
|
e.entity
|
|
545
545
|
] });
|
|
546
546
|
}
|
|
547
|
-
}),
|
|
547
|
+
}), m = e.quick_add, h = o.entities[e.entity], g = Je(s, m?.fields.filter((e) => h?.fields.get(e)?.required) ?? []);
|
|
548
548
|
function _(t) {
|
|
549
|
-
if (t.preventDefault(), !
|
|
550
|
-
let n = qe(
|
|
551
|
-
|
|
549
|
+
if (t.preventDefault(), !m) return;
|
|
550
|
+
let n = qe(s, m.defaults, e.foreign_key, a);
|
|
551
|
+
u(n);
|
|
552
552
|
}
|
|
553
553
|
function v(e, t) {
|
|
554
|
-
|
|
554
|
+
f && p(), c((n) => ({
|
|
555
555
|
...n,
|
|
556
556
|
[e]: t
|
|
557
557
|
}));
|
|
558
558
|
}
|
|
559
559
|
return {
|
|
560
|
-
values:
|
|
561
|
-
quickAdd:
|
|
560
|
+
values: s,
|
|
561
|
+
quickAdd: m,
|
|
562
562
|
childEntity: h,
|
|
563
|
-
isPending:
|
|
564
|
-
error:
|
|
563
|
+
isPending: d,
|
|
564
|
+
error: f,
|
|
565
565
|
isReady: g,
|
|
566
566
|
handleSubmit: _,
|
|
567
567
|
handleFieldChange: v
|
|
@@ -570,8 +570,8 @@ function Ye(e, t, i, a) {
|
|
|
570
570
|
//#endregion
|
|
571
571
|
//#region src/components/detail-layout/QuickAddForm.tsx
|
|
572
572
|
function Xe({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
573
|
-
let
|
|
574
|
-
return !
|
|
573
|
+
let o = M(), s = M("errors"), { values: c, quickAdd: u, childEntity: d, isPending: f, error: p, isReady: m, handleSubmit: h, handleFieldChange: g } = Ye(t, n, r, i), _ = y(), v = _e();
|
|
574
|
+
return !u || u.fields.length === 0 || !d ? null : /* @__PURE__ */ X("form", {
|
|
575
575
|
onSubmit: h,
|
|
576
576
|
style: {
|
|
577
577
|
display: "flex",
|
|
@@ -582,10 +582,10 @@ function Xe({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
582
582
|
borderBottom: "1px solid var(--divider)"
|
|
583
583
|
},
|
|
584
584
|
children: [
|
|
585
|
-
|
|
586
|
-
let n =
|
|
585
|
+
u.fields.map((e) => {
|
|
586
|
+
let n = d.fields.get(e);
|
|
587
587
|
if (!n) return null;
|
|
588
|
-
let r = `${v}-quick-add-${t.entity}-${e}`,
|
|
588
|
+
let r = `${v}-quick-add-${t.entity}-${e}`, s = `${r}-label`;
|
|
589
589
|
return /* @__PURE__ */ X("div", {
|
|
590
590
|
style: {
|
|
591
591
|
flex: 1,
|
|
@@ -593,7 +593,7 @@ function Xe({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
593
593
|
width: _.isPhone ? "100%" : void 0
|
|
594
594
|
},
|
|
595
595
|
children: [/* @__PURE__ */ Y("label", {
|
|
596
|
-
id:
|
|
596
|
+
id: s,
|
|
597
597
|
htmlFor: r,
|
|
598
598
|
style: {
|
|
599
599
|
fontSize: 11,
|
|
@@ -602,17 +602,17 @@ function Xe({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
602
602
|
display: "block",
|
|
603
603
|
fontWeight: 500
|
|
604
604
|
},
|
|
605
|
-
children:
|
|
606
|
-
}),
|
|
605
|
+
children: a(o, n, e, i.entities)
|
|
606
|
+
}), w({
|
|
607
607
|
field: n,
|
|
608
608
|
fieldName: e,
|
|
609
|
-
value:
|
|
609
|
+
value: c[e] ?? "",
|
|
610
610
|
mode: "edit",
|
|
611
611
|
onChange: (t) => g(e, t),
|
|
612
|
-
record:
|
|
612
|
+
record: c,
|
|
613
613
|
fieldId: r,
|
|
614
|
-
labelId:
|
|
615
|
-
t:
|
|
614
|
+
labelId: s,
|
|
615
|
+
t: o
|
|
616
616
|
})]
|
|
617
617
|
}, e);
|
|
618
618
|
}),
|
|
@@ -621,9 +621,9 @@ function Xe({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
621
621
|
kind: "primary",
|
|
622
622
|
size: _.isPhone ? "md" : "sm",
|
|
623
623
|
icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
|
|
624
|
-
disabled:
|
|
624
|
+
disabled: f || !m,
|
|
625
625
|
style: _.isPhone ? { alignSelf: "flex-end" } : void 0,
|
|
626
|
-
children:
|
|
626
|
+
children: o("record.related.add", "Add")
|
|
627
627
|
}),
|
|
628
628
|
p != null && /* @__PURE__ */ Y("span", {
|
|
629
629
|
style: {
|
|
@@ -632,7 +632,7 @@ function Xe({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
632
632
|
alignSelf: "flex-end",
|
|
633
633
|
marginBottom: 4
|
|
634
634
|
},
|
|
635
|
-
children:
|
|
635
|
+
children: re(s, p)
|
|
636
636
|
})
|
|
637
637
|
]
|
|
638
638
|
});
|
|
@@ -643,10 +643,10 @@ function Ze(e, t, n) {
|
|
|
643
643
|
return `${e}::child::${t}.${n}`;
|
|
644
644
|
}
|
|
645
645
|
function Qe(e) {
|
|
646
|
-
return Math.min(
|
|
646
|
+
return Math.min(oe, Math.max(60, Math.round(e)));
|
|
647
647
|
}
|
|
648
648
|
function $e(e) {
|
|
649
|
-
let { widths: t, setWidths: n, resetWidths: r } =
|
|
649
|
+
let { widths: t, setWidths: n, resetWidths: r } = le(e), [i, a] = q({}), o = K(null);
|
|
650
650
|
G(() => {
|
|
651
651
|
let e = (e) => {
|
|
652
652
|
let t = o.current;
|
|
@@ -730,46 +730,46 @@ function et({ colId: e, onMouseDown: t }) {
|
|
|
730
730
|
//#endregion
|
|
731
731
|
//#region src/components/detail-layout/ChildrenTable.tsx
|
|
732
732
|
function tt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
733
|
-
let
|
|
733
|
+
let o = M(), c = M("errors"), l = i.entities[t.entity], f = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, p = $e(Ze(n, t.entity, f)), m = _(l?.realtime, t.entity), { data: h, isLoading: y, isError: x, refetch: S } = d(n, r, t.entity, t.foreign_key, t.sort, t.limit), { refreshing: w, refresh: T } = ce(S), E = h?.data ?? [], D = h?.$refs, O = K(D);
|
|
734
734
|
O.current = D;
|
|
735
|
-
let k = t.columns,
|
|
735
|
+
let k = t.columns, A = t.interaction === "navigate", j = k[0], N = A && l ? s(void 0, l, i.screens) : null, P = l ? Ge(l) : void 0, F = ye(() => {
|
|
736
736
|
let e = /* @__PURE__ */ new Map();
|
|
737
|
-
if (!
|
|
737
|
+
if (!l) return e;
|
|
738
738
|
for (let t of k) {
|
|
739
|
-
let n =
|
|
740
|
-
n && e.set(t,
|
|
739
|
+
let n = l.fields.get(t);
|
|
740
|
+
n && e.set(t, b({
|
|
741
741
|
field: n,
|
|
742
742
|
fieldName: t,
|
|
743
743
|
surface: "list",
|
|
744
|
-
entity:
|
|
744
|
+
entity: l,
|
|
745
745
|
entities: i.entities,
|
|
746
746
|
screens: i.screens,
|
|
747
747
|
refs: () => O.current,
|
|
748
|
-
t:
|
|
748
|
+
t: o
|
|
749
749
|
}));
|
|
750
750
|
}
|
|
751
751
|
return e;
|
|
752
752
|
}, [
|
|
753
|
-
|
|
753
|
+
l,
|
|
754
754
|
k,
|
|
755
755
|
i.entities,
|
|
756
756
|
i.screens,
|
|
757
|
-
|
|
757
|
+
o
|
|
758
758
|
]);
|
|
759
|
-
if (!
|
|
759
|
+
if (!l) return /* @__PURE__ */ Y("div", {
|
|
760
760
|
style: {
|
|
761
761
|
fontSize: 12.5,
|
|
762
762
|
color: "var(--text-3)",
|
|
763
763
|
padding: "8px 0"
|
|
764
764
|
},
|
|
765
|
-
children:
|
|
765
|
+
children: c("record.related_entity_not_found", "The related record type is not declared in this deployment.")
|
|
766
766
|
});
|
|
767
|
-
let
|
|
767
|
+
let I = /* @__PURE__ */ Y(Xe, {
|
|
768
768
|
config: t,
|
|
769
769
|
parentEntity: n,
|
|
770
770
|
parentId: r,
|
|
771
771
|
schema: i
|
|
772
|
-
}),
|
|
772
|
+
}), L = m ? o("record.related.live", "Live") : o("record.related.paused", "Updates paused"), R = /* @__PURE__ */ X("div", {
|
|
773
773
|
style: {
|
|
774
774
|
display: "flex",
|
|
775
775
|
alignItems: "center",
|
|
@@ -778,40 +778,40 @@ function tt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
778
778
|
justifyContent: "flex-end"
|
|
779
779
|
},
|
|
780
780
|
children: [
|
|
781
|
-
|
|
781
|
+
p.hasWidths && /* @__PURE__ */ Y(C, {
|
|
782
782
|
icon: /* @__PURE__ */ Y(e.columns, { size: 13 }),
|
|
783
|
-
title:
|
|
783
|
+
title: o("record.related.reset_widths", "Reset column widths (this device)"),
|
|
784
784
|
size: 24,
|
|
785
|
-
onClick:
|
|
785
|
+
onClick: p.resetWidths
|
|
786
786
|
}),
|
|
787
|
-
|
|
787
|
+
l.realtime === !0 && /* @__PURE__ */ Y("span", {
|
|
788
788
|
"data-testid": "children-live-indicator",
|
|
789
789
|
role: "status",
|
|
790
|
-
"aria-label":
|
|
791
|
-
title:
|
|
792
|
-
children: /* @__PURE__ */ Y(
|
|
793
|
-
tone:
|
|
790
|
+
"aria-label": L,
|
|
791
|
+
title: m ? o("record.related.live_hint", "This table updates automatically in realtime.") : o("record.related.paused_hint", "Realtime updates are paused. Refresh manually to load the latest data."),
|
|
792
|
+
children: /* @__PURE__ */ Y(u, {
|
|
793
|
+
tone: m ? "emerald" : "amber",
|
|
794
794
|
size: "xs",
|
|
795
795
|
dot: !0,
|
|
796
|
-
children:
|
|
796
|
+
children: L
|
|
797
797
|
})
|
|
798
798
|
}),
|
|
799
|
-
/* @__PURE__ */ Y(
|
|
799
|
+
/* @__PURE__ */ Y(C, {
|
|
800
800
|
icon: w ? /* @__PURE__ */ Y("span", {
|
|
801
801
|
"data-testid": "children-refresh-spinner",
|
|
802
802
|
style: { display: "inline-flex" },
|
|
803
|
-
children: /* @__PURE__ */ Y(
|
|
803
|
+
children: /* @__PURE__ */ Y(v, { size: 13 })
|
|
804
804
|
}) : /* @__PURE__ */ Y(e.refresh, { size: 13 }),
|
|
805
|
-
title:
|
|
805
|
+
title: o("record.related.refresh", "Refresh"),
|
|
806
806
|
size: 24,
|
|
807
807
|
disabled: w,
|
|
808
808
|
onClick: T
|
|
809
809
|
})
|
|
810
810
|
]
|
|
811
811
|
});
|
|
812
|
-
return
|
|
813
|
-
|
|
814
|
-
|
|
812
|
+
return x ? /* @__PURE__ */ X("div", { children: [
|
|
813
|
+
I,
|
|
814
|
+
R,
|
|
815
815
|
/* @__PURE__ */ X("div", {
|
|
816
816
|
style: {
|
|
817
817
|
fontSize: 12.5,
|
|
@@ -819,14 +819,14 @@ function tt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
819
819
|
padding: "8px 0"
|
|
820
820
|
},
|
|
821
821
|
children: [
|
|
822
|
-
|
|
822
|
+
c("record.related_rows_unreadable", "The related records could not be loaded."),
|
|
823
823
|
" ",
|
|
824
|
-
|
|
824
|
+
o("record.related.try_again", "Try again.")
|
|
825
825
|
]
|
|
826
826
|
})
|
|
827
|
-
] }) :
|
|
828
|
-
|
|
829
|
-
|
|
827
|
+
] }) : y ? /* @__PURE__ */ X("div", { children: [
|
|
828
|
+
I,
|
|
829
|
+
R,
|
|
830
830
|
/* @__PURE__ */ Y("div", {
|
|
831
831
|
style: {
|
|
832
832
|
display: "flex",
|
|
@@ -845,39 +845,39 @@ function tt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
845
845
|
} }, e))
|
|
846
846
|
})
|
|
847
847
|
] }) : E.length === 0 ? /* @__PURE__ */ X("div", { children: [
|
|
848
|
-
|
|
849
|
-
|
|
848
|
+
I,
|
|
849
|
+
R,
|
|
850
850
|
/* @__PURE__ */ Y("div", {
|
|
851
851
|
style: {
|
|
852
852
|
fontSize: 12.5,
|
|
853
853
|
color: "var(--text-3)",
|
|
854
854
|
padding: "12px 0"
|
|
855
855
|
},
|
|
856
|
-
children:
|
|
856
|
+
children: o("record.related.empty", "No records yet.")
|
|
857
857
|
})
|
|
858
858
|
] }) : /* @__PURE__ */ X("div", { children: [
|
|
859
|
-
|
|
860
|
-
|
|
859
|
+
I,
|
|
860
|
+
R,
|
|
861
861
|
/* @__PURE__ */ Y("div", {
|
|
862
862
|
style: { overflowX: "auto" },
|
|
863
863
|
children: /* @__PURE__ */ X("table", {
|
|
864
864
|
style: pe,
|
|
865
865
|
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: k.map((e) => {
|
|
866
|
-
let t =
|
|
866
|
+
let t = l.fields.get(e);
|
|
867
867
|
return /* @__PURE__ */ X("th", {
|
|
868
|
-
style:
|
|
869
|
-
children: [t ?
|
|
868
|
+
style: p.headerStyle(e, fe),
|
|
869
|
+
children: [t ? a(o, t, e, i.entities) : e, /* @__PURE__ */ Y(et, {
|
|
870
870
|
colId: e,
|
|
871
|
-
onMouseDown:
|
|
871
|
+
onMouseDown: p.onHandleMouseDown
|
|
872
872
|
})]
|
|
873
873
|
}, e);
|
|
874
874
|
}) }) }), /* @__PURE__ */ Y("tbody", { children: E.map((e, t) => {
|
|
875
|
-
let n = P ?
|
|
875
|
+
let n = P ? g(e[P]) : "", r = A && N && n ? N.replace(/:\w+/, n) : void 0;
|
|
876
876
|
return /* @__PURE__ */ Y("tr", { children: k.map((t) => {
|
|
877
|
-
let n = t ===
|
|
877
|
+
let n = t === j, i = F.get(t), a = i ? i(e[t], e) : g(e[t]);
|
|
878
878
|
return /* @__PURE__ */ Y("td", {
|
|
879
879
|
title: typeof a == "string" ? a : void 0,
|
|
880
|
-
style:
|
|
880
|
+
style: p.cellStyle(t, me),
|
|
881
881
|
children: n && r ? /* @__PURE__ */ Y("a", {
|
|
882
882
|
href: r,
|
|
883
883
|
style: {
|
|
@@ -890,7 +890,7 @@ function tt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
890
890
|
children: a
|
|
891
891
|
}) : a
|
|
892
892
|
}, t);
|
|
893
|
-
}) },
|
|
893
|
+
}) }, g(e.id ?? t));
|
|
894
894
|
}) })]
|
|
895
895
|
})
|
|
896
896
|
})
|
|
@@ -899,7 +899,7 @@ function tt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
899
899
|
//#endregion
|
|
900
900
|
//#region src/components/detail-layout/ChildrenList.tsx
|
|
901
901
|
function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
902
|
-
let i = r.entities[e.entity], a =
|
|
902
|
+
let i = r.entities[e.entity], a = M(), o = M("errors"), { data: s, isLoading: c, isError: l } = d(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], f = s?.$refs, p = e.columns;
|
|
903
903
|
if (!i) return /* @__PURE__ */ Y("div", {
|
|
904
904
|
style: {
|
|
905
905
|
fontSize: 12.5,
|
|
@@ -914,7 +914,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
914
914
|
parentId: n,
|
|
915
915
|
schema: r
|
|
916
916
|
});
|
|
917
|
-
if (
|
|
917
|
+
if (l) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ X("div", {
|
|
918
918
|
style: {
|
|
919
919
|
fontSize: 12.5,
|
|
920
920
|
color: "var(--danger)",
|
|
@@ -926,7 +926,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
926
926
|
a("record.related.try_again", "Try again.")
|
|
927
927
|
]
|
|
928
928
|
})] });
|
|
929
|
-
if (
|
|
929
|
+
if (c) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ X("div", {
|
|
930
930
|
style: {
|
|
931
931
|
display: "flex",
|
|
932
932
|
flexDirection: "column",
|
|
@@ -952,7 +952,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
952
952
|
} })
|
|
953
953
|
]
|
|
954
954
|
})] });
|
|
955
|
-
if (
|
|
955
|
+
if (u.length === 0) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ Y("div", {
|
|
956
956
|
style: {
|
|
957
957
|
fontSize: 12.5,
|
|
958
958
|
color: "var(--text-3)",
|
|
@@ -966,8 +966,8 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
966
966
|
display: "flex",
|
|
967
967
|
flexDirection: "column"
|
|
968
968
|
},
|
|
969
|
-
children:
|
|
970
|
-
let n = typeof e.$display == "string" ? e[
|
|
969
|
+
children: u.map((e, t) => {
|
|
970
|
+
let n = typeof e.$display == "string" ? e[D] : "";
|
|
971
971
|
return /* @__PURE__ */ Y("div", {
|
|
972
972
|
style: {
|
|
973
973
|
display: "flex",
|
|
@@ -988,7 +988,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
988
988
|
textOverflow: "ellipsis",
|
|
989
989
|
whiteSpace: "nowrap"
|
|
990
990
|
},
|
|
991
|
-
children: n || (h && i.fields.get(h) ?
|
|
991
|
+
children: n || (h && i.fields.get(h) ? w({
|
|
992
992
|
field: i.fields.get(h),
|
|
993
993
|
fieldName: h,
|
|
994
994
|
value: e[h],
|
|
@@ -996,7 +996,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
996
996
|
record: e,
|
|
997
997
|
refs: f,
|
|
998
998
|
t: a
|
|
999
|
-
}) : h && e[h] != null ?
|
|
999
|
+
}) : h && e[h] != null ? g(e[h]) : null)
|
|
1000
1000
|
}), p.length > 1 && (() => {
|
|
1001
1001
|
let t = p.slice(1, 3).filter((t) => e[t] != null);
|
|
1002
1002
|
return t.length === 0 ? null : /* @__PURE__ */ Y("div", {
|
|
@@ -1007,7 +1007,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1007
1007
|
textOverflow: "ellipsis",
|
|
1008
1008
|
whiteSpace: "nowrap"
|
|
1009
1009
|
},
|
|
1010
|
-
children: t.map((t, n) => /* @__PURE__ */ X("span", { children: [n > 0 && " · ", i.fields.get(t) ?
|
|
1010
|
+
children: t.map((t, n) => /* @__PURE__ */ X("span", { children: [n > 0 && " · ", i.fields.get(t) ? w({
|
|
1011
1011
|
field: i.fields.get(t),
|
|
1012
1012
|
fieldName: t,
|
|
1013
1013
|
value: e[t],
|
|
@@ -1019,14 +1019,14 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1019
1019
|
});
|
|
1020
1020
|
})()]
|
|
1021
1021
|
})
|
|
1022
|
-
},
|
|
1022
|
+
}, g(e.id ?? t));
|
|
1023
1023
|
})
|
|
1024
1024
|
})] });
|
|
1025
1025
|
}
|
|
1026
1026
|
//#endregion
|
|
1027
1027
|
//#region src/components/detail-layout/ChildrenCards.tsx
|
|
1028
1028
|
function rt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1029
|
-
let i = r.entities[e.entity], o =
|
|
1029
|
+
let i = r.entities[e.entity], o = M(), s = M("errors"), { data: c, isLoading: l, isError: f } = d(t, n, e.entity, e.foreign_key, e.sort, e.limit), p = c?.data ?? [], m = c?.$refs, h = e.columns, _ = e.cards, v = _?.header_field ?? h[0], y = _?.badge_field, b = _?.columns_count ?? 3;
|
|
1030
1030
|
if (!i) return /* @__PURE__ */ Y("div", {
|
|
1031
1031
|
style: {
|
|
1032
1032
|
fontSize: 12.5,
|
|
@@ -1045,7 +1045,7 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1045
1045
|
parentId: n,
|
|
1046
1046
|
schema: r
|
|
1047
1047
|
});
|
|
1048
|
-
if (
|
|
1048
|
+
if (f) return /* @__PURE__ */ X("div", { children: [S, /* @__PURE__ */ X("div", {
|
|
1049
1049
|
style: {
|
|
1050
1050
|
fontSize: 12.5,
|
|
1051
1051
|
color: "var(--danger)",
|
|
@@ -1057,7 +1057,7 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1057
1057
|
o("record.related.try_again", "Try again.")
|
|
1058
1058
|
]
|
|
1059
1059
|
})] });
|
|
1060
|
-
if (
|
|
1060
|
+
if (l) return /* @__PURE__ */ X("div", { children: [S, /* @__PURE__ */ Y("div", {
|
|
1061
1061
|
style: x,
|
|
1062
1062
|
children: [
|
|
1063
1063
|
0,
|
|
@@ -1077,7 +1077,7 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1077
1077
|
},
|
|
1078
1078
|
children: o("record.related.empty", "No records yet.")
|
|
1079
1079
|
})] });
|
|
1080
|
-
let
|
|
1080
|
+
let C = h.filter((e) => e !== v && e !== y);
|
|
1081
1081
|
return /* @__PURE__ */ X("div", { children: [S, /* @__PURE__ */ Y("div", {
|
|
1082
1082
|
style: x,
|
|
1083
1083
|
children: p.map((e, t) => /* @__PURE__ */ X("div", {
|
|
@@ -1094,7 +1094,7 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1094
1094
|
alignItems: "center",
|
|
1095
1095
|
justifyContent: "space-between",
|
|
1096
1096
|
gap: 8,
|
|
1097
|
-
borderBottom:
|
|
1097
|
+
borderBottom: C.length > 0 ? "1px solid var(--divider)" : "none"
|
|
1098
1098
|
},
|
|
1099
1099
|
children: [/* @__PURE__ */ Y("div", {
|
|
1100
1100
|
style: {
|
|
@@ -1104,19 +1104,19 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1104
1104
|
textOverflow: "ellipsis",
|
|
1105
1105
|
whiteSpace: "nowrap"
|
|
1106
1106
|
},
|
|
1107
|
-
children:
|
|
1108
|
-
field: i.fields.get(
|
|
1109
|
-
fieldName:
|
|
1110
|
-
value: e[
|
|
1107
|
+
children: v && i.fields.get(v) ? w({
|
|
1108
|
+
field: i.fields.get(v),
|
|
1109
|
+
fieldName: v,
|
|
1110
|
+
value: e[v],
|
|
1111
1111
|
mode: "display",
|
|
1112
1112
|
record: e,
|
|
1113
1113
|
refs: m,
|
|
1114
1114
|
t: o
|
|
1115
1115
|
}) : o("record.related.card_title", "Record {number}", { number: t + 1 })
|
|
1116
|
-
}), y && e[y] != null && /* @__PURE__ */ Y(
|
|
1116
|
+
}), y && e[y] != null && /* @__PURE__ */ Y(u, {
|
|
1117
1117
|
tone: "slate",
|
|
1118
1118
|
size: "xs",
|
|
1119
|
-
children: i.fields.get(y) ?
|
|
1119
|
+
children: i.fields.get(y) ? w({
|
|
1120
1120
|
field: i.fields.get(y),
|
|
1121
1121
|
fieldName: y,
|
|
1122
1122
|
value: e[y],
|
|
@@ -1124,16 +1124,16 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1124
1124
|
record: e,
|
|
1125
1125
|
refs: m,
|
|
1126
1126
|
t: o
|
|
1127
|
-
}) :
|
|
1127
|
+
}) : g(e[y])
|
|
1128
1128
|
})]
|
|
1129
|
-
}),
|
|
1129
|
+
}), C.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1130
1130
|
style: {
|
|
1131
1131
|
padding: "10px 14px",
|
|
1132
1132
|
display: "flex",
|
|
1133
1133
|
flexDirection: "column",
|
|
1134
1134
|
gap: 4
|
|
1135
1135
|
},
|
|
1136
|
-
children:
|
|
1136
|
+
children: C.slice(0, 4).map((t) => {
|
|
1137
1137
|
let n = i.fields.get(t);
|
|
1138
1138
|
return n ? /* @__PURE__ */ X("div", {
|
|
1139
1139
|
style: {
|
|
@@ -1147,14 +1147,14 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1147
1147
|
color: "var(--text-3)",
|
|
1148
1148
|
flexShrink: 0
|
|
1149
1149
|
},
|
|
1150
|
-
children: [
|
|
1150
|
+
children: [a(o, n, t, r.entities), ":"]
|
|
1151
1151
|
}), /* @__PURE__ */ Y("span", {
|
|
1152
1152
|
style: {
|
|
1153
1153
|
overflow: "hidden",
|
|
1154
1154
|
textOverflow: "ellipsis",
|
|
1155
1155
|
whiteSpace: "nowrap"
|
|
1156
1156
|
},
|
|
1157
|
-
children:
|
|
1157
|
+
children: w({
|
|
1158
1158
|
field: n,
|
|
1159
1159
|
fieldName: t,
|
|
1160
1160
|
value: e[t],
|
|
@@ -1167,16 +1167,16 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1167
1167
|
}, t) : null;
|
|
1168
1168
|
})
|
|
1169
1169
|
})]
|
|
1170
|
-
},
|
|
1170
|
+
}, g(e.id ?? t)))
|
|
1171
1171
|
})] });
|
|
1172
1172
|
}
|
|
1173
1173
|
//#endregion
|
|
1174
1174
|
//#region src/hooks/useTimelineData.ts
|
|
1175
1175
|
var it = 50;
|
|
1176
|
-
function at(e, t, n,
|
|
1177
|
-
let s = Array.isArray(
|
|
1176
|
+
function at(e, t, n, r, a, o) {
|
|
1177
|
+
let s = Array.isArray(r) ? r : [r], c = Array.isArray(r) ? x(t, s.length) : [t], l = o ?? it, u = be({
|
|
1178
1178
|
queryKey: [
|
|
1179
|
-
|
|
1179
|
+
i,
|
|
1180
1180
|
e,
|
|
1181
1181
|
t,
|
|
1182
1182
|
n,
|
|
@@ -1192,11 +1192,11 @@ function at(e, t, n, i, a, o) {
|
|
|
1192
1192
|
op: "eq",
|
|
1193
1193
|
value: c[t]
|
|
1194
1194
|
}));
|
|
1195
|
-
return t.set("filters", JSON.stringify(r)), a ? t.set("sort", `${a}: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),
|
|
1195
|
+
return t.set("filters", JSON.stringify(r)), a ? t.set("sort", `${a}: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), A(`/api/data/${n}?${t.toString()}`);
|
|
1196
1196
|
},
|
|
1197
1197
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
1198
1198
|
initialPageParam: void 0,
|
|
1199
|
-
enabled: !!e && !!t && !!n && !!
|
|
1199
|
+
enabled: !!e && !!t && !!n && !!r && c !== null
|
|
1200
1200
|
});
|
|
1201
1201
|
return {
|
|
1202
1202
|
rows: ye(() => u.data?.pages.flatMap((e) => e.data) ?? [], [u.data?.pages]),
|
|
@@ -1212,7 +1212,7 @@ function at(e, t, n, i, a, o) {
|
|
|
1212
1212
|
//#region src/components/detail-layout/TimelineComposer.tsx
|
|
1213
1213
|
var ot = "quick_entry", st = 100, ct = 240, lt = 800, ut = 80;
|
|
1214
1214
|
function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
1215
|
-
let { values: a, quickAdd: o, childEntity: s, isPending: c, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ye(t, n, r, i), m =
|
|
1215
|
+
let { values: a, quickAdd: o, childEntity: s, isPending: c, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ye(t, n, r, i), m = M(), h = M("errors"), [g, _] = q(ct), v = K(null), y = K(null), [b, x] = q(lt);
|
|
1216
1216
|
G(() => {
|
|
1217
1217
|
let e = y.current?.parentElement;
|
|
1218
1218
|
if (!e) return;
|
|
@@ -1228,20 +1228,20 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1228
1228
|
}, [b]);
|
|
1229
1229
|
let S = K(a);
|
|
1230
1230
|
S.current = a;
|
|
1231
|
-
let
|
|
1232
|
-
|
|
1231
|
+
let C = K(p);
|
|
1232
|
+
C.current = p;
|
|
1233
1233
|
let T = K({}), E = ye(() => ({
|
|
1234
1234
|
getField: (e) => S.current[e],
|
|
1235
1235
|
setField: (e, t) => {
|
|
1236
|
-
|
|
1236
|
+
C.current(e, t);
|
|
1237
1237
|
},
|
|
1238
1238
|
focusField: (e) => {
|
|
1239
1239
|
let t = T.current[e];
|
|
1240
1240
|
t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
|
|
1241
1241
|
}
|
|
1242
1242
|
}), []);
|
|
1243
|
-
G(() =>
|
|
1244
|
-
let
|
|
1243
|
+
G(() => O(ot, E), [E]);
|
|
1244
|
+
let D = W((e) => {
|
|
1245
1245
|
e.preventDefault(), v.current = {
|
|
1246
1246
|
startY: e.clientY,
|
|
1247
1247
|
startHeight: g
|
|
@@ -1256,14 +1256,14 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1256
1256
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
1257
1257
|
}, [g, b]);
|
|
1258
1258
|
if (!o || o.fields.length === 0 || !s) return null;
|
|
1259
|
-
let
|
|
1259
|
+
let k = o.fields.find((e) => {
|
|
1260
1260
|
let t = s.fields.get(e);
|
|
1261
1261
|
return t && (t.type === "text" || t.type === "string");
|
|
1262
|
-
}),
|
|
1262
|
+
}), A = [], N = [];
|
|
1263
1263
|
for (let e of o.fields) {
|
|
1264
|
-
if (e ===
|
|
1264
|
+
if (e === k) continue;
|
|
1265
1265
|
let t = s.fields.get(e);
|
|
1266
|
-
t && (t.type === "enum" ?
|
|
1266
|
+
t && (t.type === "enum" ? A.push(e) : N.push(e));
|
|
1267
1267
|
}
|
|
1268
1268
|
let P = (e) => {
|
|
1269
1269
|
let t = s.fields.get(e);
|
|
@@ -1271,7 +1271,7 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1271
1271
|
ref: (t) => {
|
|
1272
1272
|
T.current[e] = t;
|
|
1273
1273
|
},
|
|
1274
|
-
children:
|
|
1274
|
+
children: w({
|
|
1275
1275
|
field: t,
|
|
1276
1276
|
fieldName: e,
|
|
1277
1277
|
value: a[e] ?? "",
|
|
@@ -1293,7 +1293,7 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1293
1293
|
height: `${g}px`
|
|
1294
1294
|
},
|
|
1295
1295
|
children: [/* @__PURE__ */ Y("div", {
|
|
1296
|
-
onMouseDown:
|
|
1296
|
+
onMouseDown: D,
|
|
1297
1297
|
title: m("record.layout.drag_to_resize", "Drag to resize"),
|
|
1298
1298
|
style: {
|
|
1299
1299
|
height: 12,
|
|
@@ -1323,7 +1323,7 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1323
1323
|
padding: "0 12px 8px"
|
|
1324
1324
|
},
|
|
1325
1325
|
children: [
|
|
1326
|
-
|
|
1326
|
+
A.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1327
1327
|
style: {
|
|
1328
1328
|
display: "flex",
|
|
1329
1329
|
flexWrap: "wrap",
|
|
@@ -1331,23 +1331,23 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1331
1331
|
gap: 6,
|
|
1332
1332
|
flexShrink: 0
|
|
1333
1333
|
},
|
|
1334
|
-
children:
|
|
1334
|
+
children: A.map(P)
|
|
1335
1335
|
}),
|
|
1336
|
-
|
|
1336
|
+
k && s.fields.get(k) && /* @__PURE__ */ Y("div", {
|
|
1337
1337
|
style: {
|
|
1338
1338
|
flex: 1,
|
|
1339
1339
|
minHeight: 0,
|
|
1340
1340
|
display: "flex"
|
|
1341
1341
|
},
|
|
1342
1342
|
ref: (e) => {
|
|
1343
|
-
T.current[
|
|
1343
|
+
T.current[k] = e;
|
|
1344
1344
|
},
|
|
1345
|
-
children:
|
|
1346
|
-
field: s.fields.get(
|
|
1347
|
-
fieldName:
|
|
1348
|
-
value: a[
|
|
1345
|
+
children: w({
|
|
1346
|
+
field: s.fields.get(k),
|
|
1347
|
+
fieldName: k,
|
|
1348
|
+
value: a[k] ?? "",
|
|
1349
1349
|
mode: "edit",
|
|
1350
|
-
onChange: (e) => p(
|
|
1350
|
+
onChange: (e) => p(k, e),
|
|
1351
1351
|
record: a,
|
|
1352
1352
|
fill: !0,
|
|
1353
1353
|
t: m
|
|
@@ -1373,7 +1373,7 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1373
1373
|
fontSize: 10.5,
|
|
1374
1374
|
color: "var(--text-4)"
|
|
1375
1375
|
},
|
|
1376
|
-
children:
|
|
1376
|
+
children: j(m("record.related.shortcut_to_add", "{keys} to add"), { keys: /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("span", {
|
|
1377
1377
|
className: "mono",
|
|
1378
1378
|
children: "⌘"
|
|
1379
1379
|
}), /* @__PURE__ */ Y("span", {
|
|
@@ -1396,7 +1396,7 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1396
1396
|
margin: 0,
|
|
1397
1397
|
flexShrink: 0
|
|
1398
1398
|
},
|
|
1399
|
-
children:
|
|
1399
|
+
children: re(h, u)
|
|
1400
1400
|
})
|
|
1401
1401
|
]
|
|
1402
1402
|
})]
|
|
@@ -1414,43 +1414,43 @@ function _t(e) {
|
|
|
1414
1414
|
function vt(e, t) {
|
|
1415
1415
|
if (yt(t)) {
|
|
1416
1416
|
let e = t.id;
|
|
1417
|
-
return e == null ? "" :
|
|
1417
|
+
return e == null ? "" : g(e);
|
|
1418
1418
|
}
|
|
1419
|
-
return
|
|
1419
|
+
return ee(o(e, t));
|
|
1420
1420
|
}
|
|
1421
1421
|
function yt(e) {
|
|
1422
1422
|
return e.__optimistic === !0;
|
|
1423
1423
|
}
|
|
1424
1424
|
function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1425
|
-
let i =
|
|
1425
|
+
let i = M(), a = M("errors"), o = r.entities[e.entity], { rows: s, refs: c, fetchNextPage: u, hasOlder: d, isFetchingOlder: f, isLoading: p, isError: m } = at(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), h = e.timeline, g = h?.scroll ?? !1, _ = (e.sort ?? "").endsWith(":asc"), y = ye(() => _ ? [...s].reverse() : s, [s, _]), b = h?.auto_scroll ?? "none", x = K(null), S = K(null), C = K(!1), w = K(0), T = K(null), E = K(null), D = K(!0), O = K(null);
|
|
1426
1426
|
G(() => {
|
|
1427
1427
|
C.current = !1, w.current = 0, T.current = null, E.current = null, D.current = !0, O.current = null;
|
|
1428
1428
|
}, [n]), ve(() => {
|
|
1429
|
-
f &&
|
|
1430
|
-
scrollHeight:
|
|
1431
|
-
scrollTop:
|
|
1429
|
+
f && x.current && (O.current = {
|
|
1430
|
+
scrollHeight: x.current.scrollHeight,
|
|
1431
|
+
scrollTop: x.current.scrollTop
|
|
1432
1432
|
});
|
|
1433
1433
|
}, [f]), ve(() => {
|
|
1434
|
-
let e =
|
|
1435
|
-
if (!e ||
|
|
1436
|
-
w.current =
|
|
1434
|
+
let e = x.current;
|
|
1435
|
+
if (!e || y.length === 0 || !o) {
|
|
1436
|
+
w.current = y.length;
|
|
1437
1437
|
return;
|
|
1438
1438
|
}
|
|
1439
|
-
let t = vt(o,
|
|
1440
|
-
if (r) _ &&
|
|
1439
|
+
let t = vt(o, y[0]), n = vt(o, y[y.length - 1]), r = !C.current, i = y.length > w.current && w.current > 0, a = i && (_ && t !== T.current && n === E.current || !_ && n !== E.current && t === T.current), s = i && !a;
|
|
1440
|
+
if (r) _ && b === "bottom" && (e.scrollTop = e.scrollHeight), C.current = !0;
|
|
1441
1441
|
else if (a && O.current) {
|
|
1442
1442
|
let t = O.current;
|
|
1443
1443
|
_ && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), O.current = null;
|
|
1444
1444
|
} else s && _ && D.current && (e.scrollTop = e.scrollHeight);
|
|
1445
|
-
w.current =
|
|
1445
|
+
w.current = y.length, T.current = t, E.current = n;
|
|
1446
1446
|
}, [
|
|
1447
|
-
v,
|
|
1448
1447
|
y,
|
|
1448
|
+
b,
|
|
1449
1449
|
_,
|
|
1450
1450
|
o
|
|
1451
1451
|
]);
|
|
1452
1452
|
let k = W(() => {
|
|
1453
|
-
let e =
|
|
1453
|
+
let e = x.current;
|
|
1454
1454
|
e && (D.current = e.scrollHeight - e.scrollTop - e.clientHeight < ft);
|
|
1455
1455
|
}, []);
|
|
1456
1456
|
G(() => {
|
|
@@ -1459,7 +1459,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1459
1459
|
let t = new IntersectionObserver((e) => {
|
|
1460
1460
|
for (let t of e) t.isIntersecting && d && !f && u();
|
|
1461
1461
|
}, {
|
|
1462
|
-
root:
|
|
1462
|
+
root: x.current ?? null,
|
|
1463
1463
|
rootMargin: `${pt}px 0px 0px 0px`,
|
|
1464
1464
|
threshold: 0
|
|
1465
1465
|
});
|
|
@@ -1469,7 +1469,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1469
1469
|
f,
|
|
1470
1470
|
u
|
|
1471
1471
|
]);
|
|
1472
|
-
let [
|
|
1472
|
+
let [A, j] = q(null);
|
|
1473
1473
|
if (!o) return /* @__PURE__ */ Y("div", {
|
|
1474
1474
|
style: {
|
|
1475
1475
|
fontSize: 12.5,
|
|
@@ -1478,7 +1478,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1478
1478
|
},
|
|
1479
1479
|
children: a("record.related_entity_not_found", "The related record type is not declared in this deployment.")
|
|
1480
1480
|
});
|
|
1481
|
-
let N = e.quick_add?.fields ?? [h?.content_field].filter(Boolean), P = i(o.display?.name_plural) || i(o.display?.name) || e.entity,
|
|
1481
|
+
let N = e.quick_add?.fields ?? [h?.content_field].filter(Boolean), P = i(o.display?.name_plural) || i(o.display?.name) || e.entity, F = d ? /* @__PURE__ */ Y("div", {
|
|
1482
1482
|
style: {
|
|
1483
1483
|
display: "flex",
|
|
1484
1484
|
justifyContent: "center",
|
|
@@ -1488,15 +1488,15 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1488
1488
|
size: "xs",
|
|
1489
1489
|
onClick: () => u(),
|
|
1490
1490
|
disabled: f,
|
|
1491
|
-
icon: f ? /* @__PURE__ */ Y(
|
|
1491
|
+
icon: f ? /* @__PURE__ */ Y(v, { size: 11 }) : void 0,
|
|
1492
1492
|
children: f ? i("record.loading", "Loading…") : i("record.timeline.load_older", "Load older")
|
|
1493
1493
|
})
|
|
1494
|
-
}) : null,
|
|
1494
|
+
}) : null, I = /* @__PURE__ */ Y("div", {
|
|
1495
1495
|
ref: S,
|
|
1496
1496
|
"aria-hidden": "true",
|
|
1497
1497
|
style: { height: 1 }
|
|
1498
|
-
}),
|
|
1499
|
-
if (m)
|
|
1498
|
+
}), L;
|
|
1499
|
+
if (m) L = /* @__PURE__ */ Y("div", {
|
|
1500
1500
|
style: {
|
|
1501
1501
|
fontSize: 12.5,
|
|
1502
1502
|
color: "var(--danger)",
|
|
@@ -1504,7 +1504,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1504
1504
|
},
|
|
1505
1505
|
children: a("record.related_rows_unreadable", "The related records could not be loaded.")
|
|
1506
1506
|
});
|
|
1507
|
-
else if (p)
|
|
1507
|
+
else if (p) L = /* @__PURE__ */ X("div", {
|
|
1508
1508
|
style: {
|
|
1509
1509
|
display: "flex",
|
|
1510
1510
|
flexDirection: "column",
|
|
@@ -1521,7 +1521,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1521
1521
|
borderRadius: 8
|
|
1522
1522
|
} })]
|
|
1523
1523
|
});
|
|
1524
|
-
else if (
|
|
1524
|
+
else if (y.length === 0) L = /* @__PURE__ */ X(J, { children: [I, /* @__PURE__ */ Y("div", {
|
|
1525
1525
|
style: {
|
|
1526
1526
|
fontSize: 12.5,
|
|
1527
1527
|
color: "var(--text-3)",
|
|
@@ -1542,17 +1542,17 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1542
1542
|
timeline: h,
|
|
1543
1543
|
editableFields: N,
|
|
1544
1544
|
refs: c,
|
|
1545
|
-
isEditing:
|
|
1546
|
-
onStartEdit: () =>
|
|
1547
|
-
onCancelEdit: () =>
|
|
1548
|
-
onSaved: () =>
|
|
1545
|
+
isEditing: A === s,
|
|
1546
|
+
onStartEdit: () => j(s),
|
|
1547
|
+
onCancelEdit: () => j(null),
|
|
1548
|
+
onSaved: () => j(null),
|
|
1549
1549
|
schema: r,
|
|
1550
1550
|
optimistic: yt(i)
|
|
1551
1551
|
}, s);
|
|
1552
1552
|
}, s = h?.time_field, l;
|
|
1553
1553
|
if (s) {
|
|
1554
1554
|
let e = [];
|
|
1555
|
-
|
|
1555
|
+
y.forEach((t, n) => {
|
|
1556
1556
|
let r = t[s], a = Ct(r), o = e[e.length - 1];
|
|
1557
1557
|
!o || o.key !== a ? e.push({
|
|
1558
1558
|
key: a,
|
|
@@ -1576,10 +1576,10 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1576
1576
|
count: e.rows.length
|
|
1577
1577
|
}), e.rows.map(({ row: e, idx: t }) => a(e, t))]
|
|
1578
1578
|
}, `day-${e.key}`));
|
|
1579
|
-
} else l =
|
|
1580
|
-
|
|
1579
|
+
} else l = y.map((e, t) => a(e, t));
|
|
1580
|
+
L = /* @__PURE__ */ X(J, { children: [
|
|
1581
|
+
I,
|
|
1581
1582
|
F,
|
|
1582
|
-
ee,
|
|
1583
1583
|
l
|
|
1584
1584
|
] });
|
|
1585
1585
|
}
|
|
@@ -1609,7 +1609,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1609
1609
|
})
|
|
1610
1610
|
}),
|
|
1611
1611
|
/* @__PURE__ */ Y("div", {
|
|
1612
|
-
ref:
|
|
1612
|
+
ref: x,
|
|
1613
1613
|
onScroll: k,
|
|
1614
1614
|
style: {
|
|
1615
1615
|
flex: 1,
|
|
@@ -1619,7 +1619,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1619
1619
|
flexDirection: "column",
|
|
1620
1620
|
gap: 8
|
|
1621
1621
|
},
|
|
1622
|
-
children:
|
|
1622
|
+
children: L
|
|
1623
1623
|
}),
|
|
1624
1624
|
/* @__PURE__ */ Y(dt, {
|
|
1625
1625
|
config: e,
|
|
@@ -1634,7 +1634,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1634
1634
|
flexDirection: "column",
|
|
1635
1635
|
gap: 8
|
|
1636
1636
|
},
|
|
1637
|
-
children:
|
|
1637
|
+
children: L
|
|
1638
1638
|
}), /* @__PURE__ */ Y(dt, {
|
|
1639
1639
|
config: e,
|
|
1640
1640
|
parentEntity: t,
|
|
@@ -1642,52 +1642,52 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1642
1642
|
schema: r
|
|
1643
1643
|
})] });
|
|
1644
1644
|
}
|
|
1645
|
-
function xt({ row: t, rowId: n, childEntity:
|
|
1646
|
-
let
|
|
1647
|
-
|
|
1648
|
-
|
|
1645
|
+
function xt({ row: t, rowId: n, childEntity: r, entityCode: o, parentEntity: s, parentId: c, timeline: d, editableFields: f, refs: p, isEditing: m, onStartEdit: h, onCancelEdit: _, onSaved: y, schema: b, optimistic: x = !1 }) {
|
|
1646
|
+
let S = M(), T = M("errors"), E = Se(), [D, O] = q({}), A = W(() => {
|
|
1647
|
+
E.invalidateQueries({ queryKey: [
|
|
1648
|
+
i,
|
|
1649
|
+
s,
|
|
1649
1650
|
c,
|
|
1650
|
-
|
|
1651
|
-
s
|
|
1651
|
+
o
|
|
1652
1652
|
] });
|
|
1653
1653
|
}, [
|
|
1654
|
-
|
|
1654
|
+
E,
|
|
1655
|
+
s,
|
|
1655
1656
|
c,
|
|
1656
|
-
|
|
1657
|
-
s
|
|
1657
|
+
o
|
|
1658
1658
|
]), N = xe({
|
|
1659
1659
|
mutationFn: (e) => {
|
|
1660
1660
|
let r = t.$row_version, i = typeof r == "string" && r !== "" ? {
|
|
1661
1661
|
...e,
|
|
1662
1662
|
$row_version: r
|
|
1663
1663
|
} : e;
|
|
1664
|
-
return
|
|
1664
|
+
return ie(o, n, i);
|
|
1665
1665
|
},
|
|
1666
1666
|
onSuccess: () => {
|
|
1667
|
-
|
|
1667
|
+
A(), k.success(S("record.timeline.updated", "Updated")), y();
|
|
1668
1668
|
},
|
|
1669
|
-
onError: (e) =>
|
|
1669
|
+
onError: (e) => k.error(re(T, e))
|
|
1670
1670
|
}), P = xe({
|
|
1671
|
-
mutationFn: () =>
|
|
1671
|
+
mutationFn: () => ne(o, n),
|
|
1672
1672
|
onSuccess: () => {
|
|
1673
|
-
|
|
1673
|
+
A(), k.success(S("record.timeline.deleted", "Deleted"));
|
|
1674
1674
|
},
|
|
1675
|
-
onError: (e) =>
|
|
1676
|
-
}),
|
|
1675
|
+
onError: (e) => k.error(re(T, e))
|
|
1676
|
+
}), F = W(() => {
|
|
1677
1677
|
let e = {};
|
|
1678
|
-
for (let n of
|
|
1679
|
-
|
|
1678
|
+
for (let n of f) e[n] = t[n] ?? "";
|
|
1679
|
+
O(e), h();
|
|
1680
1680
|
}, [
|
|
1681
1681
|
t,
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
]),
|
|
1685
|
-
|
|
1682
|
+
f,
|
|
1683
|
+
h
|
|
1684
|
+
]), I = W((e, t) => {
|
|
1685
|
+
O((n) => ({
|
|
1686
1686
|
...n,
|
|
1687
1687
|
[e]: t
|
|
1688
1688
|
}));
|
|
1689
|
-
}, []),
|
|
1690
|
-
return
|
|
1689
|
+
}, []), L = d?.time_field, R = d?.type_field, z = d?.summary_field, B = d?.content_field, V = d?.author_field, H = d?.direction_field, U = d?.intent_field;
|
|
1690
|
+
return m ? /* @__PURE__ */ X("div", {
|
|
1691
1691
|
style: {
|
|
1692
1692
|
borderRadius: 10,
|
|
1693
1693
|
border: "1px solid var(--accent)",
|
|
@@ -1697,8 +1697,8 @@ function xt({ row: t, rowId: n, childEntity: i, entityCode: s, parentEntity: c,
|
|
|
1697
1697
|
flexDirection: "column",
|
|
1698
1698
|
gap: 8
|
|
1699
1699
|
},
|
|
1700
|
-
children: [
|
|
1701
|
-
let t =
|
|
1700
|
+
children: [f.map((e) => {
|
|
1701
|
+
let t = r.fields.get(e);
|
|
1702
1702
|
return t ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("label", {
|
|
1703
1703
|
style: {
|
|
1704
1704
|
fontSize: 11,
|
|
@@ -1706,15 +1706,15 @@ function xt({ row: t, rowId: n, childEntity: i, entityCode: s, parentEntity: c,
|
|
|
1706
1706
|
marginBottom: 4,
|
|
1707
1707
|
display: "block"
|
|
1708
1708
|
},
|
|
1709
|
-
children:
|
|
1710
|
-
}),
|
|
1709
|
+
children: a(S, t, e, b.entities)
|
|
1710
|
+
}), w({
|
|
1711
1711
|
field: t,
|
|
1712
1712
|
fieldName: e,
|
|
1713
|
-
value:
|
|
1713
|
+
value: D[e] ?? "",
|
|
1714
1714
|
mode: "edit",
|
|
1715
|
-
onChange: (t) =>
|
|
1716
|
-
record:
|
|
1717
|
-
t:
|
|
1715
|
+
onChange: (t) => I(e, t),
|
|
1716
|
+
record: D,
|
|
1717
|
+
t: S
|
|
1718
1718
|
})] }, e) : null;
|
|
1719
1719
|
}), /* @__PURE__ */ X("div", {
|
|
1720
1720
|
style: {
|
|
@@ -1726,30 +1726,30 @@ function xt({ row: t, rowId: n, childEntity: i, entityCode: s, parentEntity: c,
|
|
|
1726
1726
|
children: [/* @__PURE__ */ Y(l, {
|
|
1727
1727
|
kind: "primary",
|
|
1728
1728
|
size: "xs",
|
|
1729
|
-
icon: N.isPending ? /* @__PURE__ */ Y(
|
|
1730
|
-
onClick: () => N.mutate(
|
|
1729
|
+
icon: N.isPending ? /* @__PURE__ */ Y(v, { size: 12 }) : /* @__PURE__ */ Y(e.check, { size: 12 }),
|
|
1730
|
+
onClick: () => N.mutate(D),
|
|
1731
1731
|
disabled: N.isPending,
|
|
1732
|
-
children: N.isPending ?
|
|
1732
|
+
children: N.isPending ? S("dialog.saving", "Saving…") : S("dialog.save", "Save")
|
|
1733
1733
|
}), /* @__PURE__ */ Y(l, {
|
|
1734
1734
|
size: "xs",
|
|
1735
1735
|
icon: /* @__PURE__ */ Y(e.x, { size: 12 }),
|
|
1736
1736
|
onClick: () => {
|
|
1737
|
-
|
|
1737
|
+
O({}), _();
|
|
1738
1738
|
},
|
|
1739
1739
|
disabled: N.isPending,
|
|
1740
|
-
children:
|
|
1740
|
+
children: S("dialog.cancel", "Cancel")
|
|
1741
1741
|
})]
|
|
1742
1742
|
})]
|
|
1743
1743
|
}) : /* @__PURE__ */ X("div", {
|
|
1744
1744
|
className: "group",
|
|
1745
|
-
"data-optimistic":
|
|
1745
|
+
"data-optimistic": x || void 0,
|
|
1746
1746
|
style: {
|
|
1747
1747
|
borderRadius: 10,
|
|
1748
1748
|
border: "1px solid var(--border)",
|
|
1749
1749
|
background: "var(--surface)",
|
|
1750
1750
|
padding: 12,
|
|
1751
1751
|
transition: "border-color .12s",
|
|
1752
|
-
opacity:
|
|
1752
|
+
opacity: x ? .6 : 1
|
|
1753
1753
|
},
|
|
1754
1754
|
onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
|
|
1755
1755
|
onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
|
|
@@ -1764,111 +1764,111 @@ function xt({ row: t, rowId: n, childEntity: i, entityCode: s, parentEntity: c,
|
|
|
1764
1764
|
color: "var(--text-3)"
|
|
1765
1765
|
},
|
|
1766
1766
|
children: [
|
|
1767
|
-
|
|
1767
|
+
L && t[L] != null && r.fields.get(L) && /* @__PURE__ */ Y("span", {
|
|
1768
1768
|
style: { fontWeight: 500 },
|
|
1769
|
-
children:
|
|
1770
|
-
field:
|
|
1771
|
-
fieldName:
|
|
1772
|
-
value: t[
|
|
1769
|
+
children: w({
|
|
1770
|
+
field: r.fields.get(L),
|
|
1771
|
+
fieldName: L,
|
|
1772
|
+
value: t[L],
|
|
1773
1773
|
mode: "display",
|
|
1774
1774
|
record: t,
|
|
1775
|
-
refs:
|
|
1776
|
-
t:
|
|
1775
|
+
refs: p,
|
|
1776
|
+
t: S
|
|
1777
1777
|
})
|
|
1778
1778
|
}),
|
|
1779
|
-
|
|
1779
|
+
R && t[R] != null && r.fields.get(R) && /* @__PURE__ */ Y(u, {
|
|
1780
1780
|
tone: "slate",
|
|
1781
1781
|
size: "xs",
|
|
1782
|
-
children:
|
|
1783
|
-
field:
|
|
1784
|
-
fieldName:
|
|
1785
|
-
value: t[
|
|
1782
|
+
children: w({
|
|
1783
|
+
field: r.fields.get(R),
|
|
1784
|
+
fieldName: R,
|
|
1785
|
+
value: t[R],
|
|
1786
1786
|
mode: "display",
|
|
1787
1787
|
record: t,
|
|
1788
|
-
refs:
|
|
1789
|
-
t:
|
|
1788
|
+
refs: p,
|
|
1789
|
+
t: S
|
|
1790
1790
|
})
|
|
1791
1791
|
}),
|
|
1792
|
-
|
|
1793
|
-
value: t[
|
|
1794
|
-
field:
|
|
1792
|
+
H && t[H] != null && r.fields.get(H) && /* @__PURE__ */ Y(Et, {
|
|
1793
|
+
value: t[H],
|
|
1794
|
+
field: r.fields.get(H)
|
|
1795
1795
|
}),
|
|
1796
|
-
|
|
1796
|
+
U && t[U] != null && r.fields.get(U) && /* @__PURE__ */ Y(u, {
|
|
1797
1797
|
tone: "slate",
|
|
1798
1798
|
size: "xs",
|
|
1799
|
-
children:
|
|
1800
|
-
field:
|
|
1801
|
-
fieldName:
|
|
1802
|
-
value: t[
|
|
1799
|
+
children: w({
|
|
1800
|
+
field: r.fields.get(U),
|
|
1801
|
+
fieldName: U,
|
|
1802
|
+
value: t[U],
|
|
1803
1803
|
mode: "display",
|
|
1804
1804
|
record: t,
|
|
1805
|
-
refs:
|
|
1806
|
-
t:
|
|
1805
|
+
refs: p,
|
|
1806
|
+
t: S
|
|
1807
1807
|
})
|
|
1808
1808
|
}),
|
|
1809
|
-
|
|
1810
|
-
field:
|
|
1811
|
-
fieldName:
|
|
1812
|
-
value: t[
|
|
1809
|
+
V && t[V] != null && r.fields.get(V) && /* @__PURE__ */ Y("span", { children: j(S("record.timeline.by_author", "by {author}"), { author: w({
|
|
1810
|
+
field: r.fields.get(V),
|
|
1811
|
+
fieldName: V,
|
|
1812
|
+
value: t[V],
|
|
1813
1813
|
mode: "display",
|
|
1814
1814
|
record: t,
|
|
1815
|
-
refs:
|
|
1816
|
-
t:
|
|
1815
|
+
refs: p,
|
|
1816
|
+
t: S
|
|
1817
1817
|
}) }) }),
|
|
1818
|
-
!
|
|
1818
|
+
!x && /* @__PURE__ */ X("div", {
|
|
1819
1819
|
style: {
|
|
1820
1820
|
marginLeft: "auto",
|
|
1821
1821
|
display: "flex",
|
|
1822
1822
|
alignItems: "center",
|
|
1823
1823
|
gap: 2
|
|
1824
1824
|
},
|
|
1825
|
-
children: [/* @__PURE__ */ Y(
|
|
1825
|
+
children: [/* @__PURE__ */ Y(C, {
|
|
1826
1826
|
size: 22,
|
|
1827
1827
|
icon: /* @__PURE__ */ Y(e.edit, { size: 11 }),
|
|
1828
|
-
onClick:
|
|
1829
|
-
title:
|
|
1830
|
-
}), /* @__PURE__ */ Y(
|
|
1828
|
+
onClick: F,
|
|
1829
|
+
title: S("record.action.edit", "Edit")
|
|
1830
|
+
}), /* @__PURE__ */ Y(C, {
|
|
1831
1831
|
size: 22,
|
|
1832
1832
|
icon: /* @__PURE__ */ Y(e.trash, { size: 11 }),
|
|
1833
1833
|
onClick: () => P.mutate(),
|
|
1834
|
-
title:
|
|
1834
|
+
title: S("record.action.delete", "Delete")
|
|
1835
1835
|
})]
|
|
1836
1836
|
})
|
|
1837
1837
|
]
|
|
1838
1838
|
}),
|
|
1839
|
-
|
|
1839
|
+
z && t[z] != null && r.fields.get(z) && /* @__PURE__ */ Y("div", {
|
|
1840
1840
|
style: {
|
|
1841
1841
|
fontSize: 12.5,
|
|
1842
1842
|
fontWeight: 500,
|
|
1843
1843
|
marginTop: 6
|
|
1844
1844
|
},
|
|
1845
|
-
children:
|
|
1846
|
-
field:
|
|
1847
|
-
fieldName:
|
|
1848
|
-
value: t[
|
|
1845
|
+
children: w({
|
|
1846
|
+
field: r.fields.get(z),
|
|
1847
|
+
fieldName: z,
|
|
1848
|
+
value: t[z],
|
|
1849
1849
|
mode: "display",
|
|
1850
1850
|
record: t,
|
|
1851
|
-
refs:
|
|
1852
|
-
t:
|
|
1851
|
+
refs: p,
|
|
1852
|
+
t: S
|
|
1853
1853
|
})
|
|
1854
1854
|
}),
|
|
1855
|
-
|
|
1856
|
-
rendered:
|
|
1857
|
-
field:
|
|
1858
|
-
fieldName:
|
|
1859
|
-
value: t[
|
|
1855
|
+
B && t[B] != null && B !== z && r.fields.get(B) && /* @__PURE__ */ Y(St, {
|
|
1856
|
+
rendered: w({
|
|
1857
|
+
field: r.fields.get(B),
|
|
1858
|
+
fieldName: B,
|
|
1859
|
+
value: t[B],
|
|
1860
1860
|
mode: "display",
|
|
1861
1861
|
record: t,
|
|
1862
|
-
refs:
|
|
1863
|
-
t:
|
|
1862
|
+
refs: p,
|
|
1863
|
+
t: S
|
|
1864
1864
|
}),
|
|
1865
|
-
text:
|
|
1865
|
+
text: g(t[B])
|
|
1866
1866
|
})
|
|
1867
1867
|
]
|
|
1868
1868
|
});
|
|
1869
1869
|
}
|
|
1870
1870
|
function St({ rendered: e, text: t }) {
|
|
1871
|
-
let n =
|
|
1871
|
+
let n = M(), r = {
|
|
1872
1872
|
fontSize: 12.5,
|
|
1873
1873
|
fontWeight: 400,
|
|
1874
1874
|
marginTop: 6
|
|
@@ -1888,7 +1888,7 @@ function St({ rendered: e, text: t }) {
|
|
|
1888
1888
|
whiteSpace: "pre-wrap",
|
|
1889
1889
|
overflowWrap: "anywhere"
|
|
1890
1890
|
},
|
|
1891
|
-
children: /* @__PURE__ */ Y(
|
|
1891
|
+
children: /* @__PURE__ */ Y(h, {
|
|
1892
1892
|
width: 380,
|
|
1893
1893
|
content: /* @__PURE__ */ X("div", {
|
|
1894
1894
|
style: {
|
|
@@ -1911,12 +1911,12 @@ function St({ rendered: e, text: t }) {
|
|
|
1911
1911
|
}
|
|
1912
1912
|
function Ct(e) {
|
|
1913
1913
|
if (e == null) return "";
|
|
1914
|
-
let t = new Date(
|
|
1914
|
+
let t = new Date(g(e));
|
|
1915
1915
|
return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
|
|
1916
1916
|
}
|
|
1917
1917
|
function wt(e, t) {
|
|
1918
1918
|
if (t == null) return "—";
|
|
1919
|
-
let n = new Date(
|
|
1919
|
+
let n = new Date(g(t));
|
|
1920
1920
|
if (Number.isNaN(n.getTime())) return "—";
|
|
1921
1921
|
let r = /* @__PURE__ */ new Date(), i = /* @__PURE__ */ new Date();
|
|
1922
1922
|
i.setDate(r.getDate() - 1);
|
|
@@ -1965,7 +1965,7 @@ function Tt({ label: e, count: t }) {
|
|
|
1965
1965
|
});
|
|
1966
1966
|
}
|
|
1967
1967
|
function Et({ value: t, field: n }) {
|
|
1968
|
-
let r =
|
|
1968
|
+
let r = M(), i = Dt(t, n);
|
|
1969
1969
|
return i === null ? null : /* @__PURE__ */ X("span", {
|
|
1970
1970
|
style: {
|
|
1971
1971
|
display: "inline-flex",
|
|
@@ -1992,70 +1992,70 @@ function Dt(e, t) {
|
|
|
1992
1992
|
}
|
|
1993
1993
|
//#endregion
|
|
1994
1994
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
1995
|
-
function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange:
|
|
1996
|
-
let d =
|
|
1995
|
+
function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: o, validationErrors: s, refs: c, forceTablePresentation: u = !1 }) {
|
|
1996
|
+
let d = M(), f = y(), p = K(null), m = t.columns, h = t.position_field, _ = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), v = m.filter((e) => {
|
|
1997
1997
|
if (_.has(e) || t.position_field && e === t.position_field) return !1;
|
|
1998
1998
|
let r = n.fields.get(e);
|
|
1999
1999
|
return !(!r || r.auto || r.primary || r.source);
|
|
2000
|
-
}), b = new Set(
|
|
2000
|
+
}), b = new Set(m.filter((e) => {
|
|
2001
2001
|
if (t.position_field && e === t.position_field) return !0;
|
|
2002
2002
|
let r = n.fields.get(e);
|
|
2003
2003
|
return r && (r.auto || r.primary || r.source);
|
|
2004
2004
|
})), x = W((e, t, n) => {
|
|
2005
|
-
|
|
2005
|
+
o(i.map((r) => r._key === e ? {
|
|
2006
2006
|
...r,
|
|
2007
2007
|
[t]: n,
|
|
2008
2008
|
_dirty: !0
|
|
2009
2009
|
} : r));
|
|
2010
|
-
}, [i,
|
|
2010
|
+
}, [i, o]), S = W(() => {
|
|
2011
2011
|
let e = {
|
|
2012
2012
|
_key: crypto.randomUUID(),
|
|
2013
2013
|
_dirty: !0
|
|
2014
2014
|
};
|
|
2015
|
-
if (
|
|
2015
|
+
if (h) {
|
|
2016
2016
|
let t = i.filter((e) => !e._deleted).reduce((e, t) => {
|
|
2017
|
-
let n = typeof t[
|
|
2017
|
+
let n = typeof t[h] == "number" ? t[h] : -1;
|
|
2018
2018
|
return Math.max(e, n);
|
|
2019
2019
|
}, -1);
|
|
2020
|
-
e[
|
|
2020
|
+
e[h] = t + 1;
|
|
2021
2021
|
}
|
|
2022
2022
|
let r = t.quick_add?.defaults ?? {};
|
|
2023
|
-
for (let t of
|
|
2023
|
+
for (let t of v) {
|
|
2024
2024
|
let i = n.fields.get(t);
|
|
2025
2025
|
i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
|
|
2026
2026
|
}
|
|
2027
|
-
|
|
2027
|
+
o([...i, e]);
|
|
2028
2028
|
}, [
|
|
2029
2029
|
i,
|
|
2030
|
-
|
|
2031
|
-
|
|
2030
|
+
o,
|
|
2031
|
+
v,
|
|
2032
2032
|
n,
|
|
2033
2033
|
t.quick_add?.defaults,
|
|
2034
|
-
|
|
2034
|
+
h
|
|
2035
2035
|
]), T = W((e) => {
|
|
2036
|
-
|
|
2036
|
+
o(i.map((t) => t._key === e ? {
|
|
2037
2037
|
...t,
|
|
2038
2038
|
_deleted: !0
|
|
2039
2039
|
} : t));
|
|
2040
|
-
}, [i,
|
|
2041
|
-
|
|
2040
|
+
}, [i, o]), E = W((e) => {
|
|
2041
|
+
o(i.map((t) => t._key === e ? {
|
|
2042
2042
|
...t,
|
|
2043
2043
|
_deleted: !1
|
|
2044
2044
|
} : t));
|
|
2045
|
-
}, [i,
|
|
2046
|
-
if (!
|
|
2047
|
-
let n = i.filter((e) => !e._deleted), r = i.filter((e) => e._deleted),
|
|
2048
|
-
if (
|
|
2049
|
-
let c = [...n], [l] = c.splice(
|
|
2050
|
-
c.splice(s, 0, l),
|
|
2045
|
+
}, [i, o]), D = W((e, t) => {
|
|
2046
|
+
if (!h) return;
|
|
2047
|
+
let n = i.filter((e) => !e._deleted), r = i.filter((e) => e._deleted), a = n.findIndex((t) => t._key === e), s = a + t;
|
|
2048
|
+
if (a < 0 || s < 0 || s >= n.length) return;
|
|
2049
|
+
let c = [...n], [l] = c.splice(a, 1);
|
|
2050
|
+
c.splice(s, 0, l), o([...c.map((e, t) => ({
|
|
2051
2051
|
...e,
|
|
2052
|
-
[
|
|
2053
|
-
_dirty: e[
|
|
2052
|
+
[h]: t,
|
|
2053
|
+
_dirty: e[h] !== t || e._dirty
|
|
2054
2054
|
})), ...r]);
|
|
2055
2055
|
}, [
|
|
2056
2056
|
i,
|
|
2057
|
-
|
|
2058
|
-
|
|
2057
|
+
o,
|
|
2058
|
+
h
|
|
2059
2059
|
]), O = W((e) => {
|
|
2060
2060
|
let t = e.target, n = t.closest("td");
|
|
2061
2061
|
if (!n) return;
|
|
@@ -2080,7 +2080,7 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2080
2080
|
if (o < t.length - 1) {
|
|
2081
2081
|
let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
|
|
2082
2082
|
e && e.focus();
|
|
2083
|
-
} else
|
|
2083
|
+
} else S(), requestAnimationFrame(() => {
|
|
2084
2084
|
let e = i.querySelectorAll("tr"), t = e[e.length - 1];
|
|
2085
2085
|
if (t) {
|
|
2086
2086
|
let e = t.querySelector("input, select, textarea, [tabindex]");
|
|
@@ -2088,15 +2088,15 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2088
2088
|
}
|
|
2089
2089
|
});
|
|
2090
2090
|
} else e.key === "Escape" && t.blur?.();
|
|
2091
|
-
}, [
|
|
2092
|
-
return
|
|
2091
|
+
}, [S]), k = fe;
|
|
2092
|
+
return f.isPhone && !u ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
2093
2093
|
style: {
|
|
2094
2094
|
display: "flex",
|
|
2095
2095
|
flexDirection: "column",
|
|
2096
2096
|
gap: 10
|
|
2097
2097
|
},
|
|
2098
|
-
children: i.map((t,
|
|
2099
|
-
let l = !!t._deleted, u = s?.[t._key],
|
|
2098
|
+
children: i.map((t, o) => {
|
|
2099
|
+
let l = !!t._deleted, u = s?.[t._key], f = h ? i.filter((e) => !e._deleted) : [], p = h ? f.findIndex((e) => e._key === t._key) : -1;
|
|
2100
2100
|
return /* @__PURE__ */ X("div", {
|
|
2101
2101
|
style: {
|
|
2102
2102
|
border: "1px solid var(--border)",
|
|
@@ -2121,31 +2121,31 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2121
2121
|
fontWeight: 600,
|
|
2122
2122
|
color: "var(--text-2)"
|
|
2123
2123
|
},
|
|
2124
|
-
children: d("record.row.number", "Row {number}", { number:
|
|
2124
|
+
children: d("record.row.number", "Row {number}", { number: o + 1 })
|
|
2125
2125
|
}), /* @__PURE__ */ X("div", {
|
|
2126
2126
|
style: {
|
|
2127
2127
|
display: "flex",
|
|
2128
2128
|
alignItems: "center",
|
|
2129
2129
|
gap: 4
|
|
2130
2130
|
},
|
|
2131
|
-
children: [
|
|
2131
|
+
children: [h && !l && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(C, {
|
|
2132
2132
|
size: 32,
|
|
2133
2133
|
icon: /* @__PURE__ */ Y(e.up, { size: 14 }),
|
|
2134
2134
|
onClick: () => D(t._key, -1),
|
|
2135
|
-
disabled:
|
|
2135
|
+
disabled: p <= 0,
|
|
2136
2136
|
title: d("record.row.move_up", "Move row up")
|
|
2137
|
-
}), /* @__PURE__ */ Y(
|
|
2137
|
+
}), /* @__PURE__ */ Y(C, {
|
|
2138
2138
|
size: 32,
|
|
2139
2139
|
icon: /* @__PURE__ */ Y(e.down, { size: 14 }),
|
|
2140
2140
|
onClick: () => D(t._key, 1),
|
|
2141
|
-
disabled:
|
|
2141
|
+
disabled: p === -1 || p >= f.length - 1,
|
|
2142
2142
|
title: d("record.row.move_down", "Move row down")
|
|
2143
|
-
})] }), l ? /* @__PURE__ */ Y(
|
|
2143
|
+
})] }), l ? /* @__PURE__ */ Y(C, {
|
|
2144
2144
|
size: 32,
|
|
2145
2145
|
icon: /* @__PURE__ */ Y(e.refresh, { size: 14 }),
|
|
2146
2146
|
onClick: () => E(t._key),
|
|
2147
2147
|
title: d("record.row.undo_delete", "Undo delete")
|
|
2148
|
-
}) : /* @__PURE__ */ Y(
|
|
2148
|
+
}) : /* @__PURE__ */ Y(C, {
|
|
2149
2149
|
size: 32,
|
|
2150
2150
|
icon: /* @__PURE__ */ Y(e.trash, { size: 14 }),
|
|
2151
2151
|
onClick: () => T(t._key),
|
|
@@ -2159,16 +2159,16 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2159
2159
|
flexDirection: "column",
|
|
2160
2160
|
gap: 12
|
|
2161
2161
|
},
|
|
2162
|
-
children:
|
|
2163
|
-
let i = n.fields.get(e),
|
|
2164
|
-
outline:
|
|
2162
|
+
children: m.map((e) => {
|
|
2163
|
+
let i = n.fields.get(e), o = u?.includes(e), s = b.has(e), f = i ? a(d, i, e, r.entities) : e, p = `child-${t._key}-${e}`, m = `${p}-label`, h = {
|
|
2164
|
+
outline: o ? "1px solid var(--danger)" : "none",
|
|
2165
2165
|
outlineOffset: 3,
|
|
2166
|
-
borderRadius:
|
|
2167
|
-
},
|
|
2166
|
+
borderRadius: o ? 5 : 0
|
|
2167
|
+
}, _ = {
|
|
2168
2168
|
fontSize: 11.5,
|
|
2169
2169
|
fontWeight: 600,
|
|
2170
2170
|
color: "var(--text-3)"
|
|
2171
|
-
},
|
|
2171
|
+
}, v = !l && !s && !!i;
|
|
2172
2172
|
return /* @__PURE__ */ X("div", {
|
|
2173
2173
|
style: {
|
|
2174
2174
|
display: "flex",
|
|
@@ -2177,19 +2177,19 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2177
2177
|
minWidth: 0,
|
|
2178
2178
|
textDecoration: l ? "line-through" : "none"
|
|
2179
2179
|
},
|
|
2180
|
-
title:
|
|
2181
|
-
children: [
|
|
2180
|
+
title: o ? d("record.row.field_required", "{field} is required", { field: e }) : void 0,
|
|
2181
|
+
children: [v ? /* @__PURE__ */ Y("label", {
|
|
2182
2182
|
id: m,
|
|
2183
2183
|
htmlFor: p,
|
|
2184
|
-
style:
|
|
2185
|
-
children:
|
|
2184
|
+
style: _,
|
|
2185
|
+
children: f
|
|
2186
2186
|
}) : /* @__PURE__ */ Y("div", {
|
|
2187
2187
|
id: m,
|
|
2188
|
-
style:
|
|
2189
|
-
children:
|
|
2188
|
+
style: _,
|
|
2189
|
+
children: f
|
|
2190
2190
|
}), /* @__PURE__ */ Y("div", {
|
|
2191
2191
|
style: h,
|
|
2192
|
-
children: l ||
|
|
2192
|
+
children: l || s ? i ? w({
|
|
2193
2193
|
field: i,
|
|
2194
2194
|
fieldName: e,
|
|
2195
2195
|
value: t[e],
|
|
@@ -2199,7 +2199,7 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2199
2199
|
fieldId: p,
|
|
2200
2200
|
labelId: m,
|
|
2201
2201
|
t: d
|
|
2202
|
-
}) :
|
|
2202
|
+
}) : g(t[e]) : i ? w({
|
|
2203
2203
|
field: i,
|
|
2204
2204
|
fieldName: e,
|
|
2205
2205
|
value: t[e],
|
|
@@ -2211,7 +2211,7 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2211
2211
|
fieldId: p,
|
|
2212
2212
|
labelId: m,
|
|
2213
2213
|
t: d
|
|
2214
|
-
}) :
|
|
2214
|
+
}) : g(t[e])
|
|
2215
2215
|
})]
|
|
2216
2216
|
}, e);
|
|
2217
2217
|
})
|
|
@@ -2224,20 +2224,20 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2224
2224
|
kind: "ghost",
|
|
2225
2225
|
size: "sm",
|
|
2226
2226
|
icon: /* @__PURE__ */ Y(e.plus, { size: 14 }),
|
|
2227
|
-
onClick:
|
|
2227
|
+
onClick: S,
|
|
2228
2228
|
children: d("record.row.add", "Add row")
|
|
2229
2229
|
})
|
|
2230
2230
|
})] }) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
2231
2231
|
style: { overflowX: "auto" },
|
|
2232
2232
|
children: /* @__PURE__ */ X("table", {
|
|
2233
|
-
ref:
|
|
2233
|
+
ref: p,
|
|
2234
2234
|
style: pe,
|
|
2235
2235
|
onKeyDown: O,
|
|
2236
|
-
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", { children: [
|
|
2236
|
+
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", { children: [m.map((e) => {
|
|
2237
2237
|
let t = n.fields.get(e);
|
|
2238
2238
|
return /* @__PURE__ */ Y("th", {
|
|
2239
2239
|
style: k,
|
|
2240
|
-
children: t ?
|
|
2240
|
+
children: t ? a(d, t, e, r.entities) : e
|
|
2241
2241
|
}, e);
|
|
2242
2242
|
}), /* @__PURE__ */ Y("th", { style: {
|
|
2243
2243
|
...k,
|
|
@@ -2246,7 +2246,7 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2246
2246
|
let r = !!t._deleted, i = s?.[t._key];
|
|
2247
2247
|
return /* @__PURE__ */ X("tr", {
|
|
2248
2248
|
style: { opacity: r ? .5 : 1 },
|
|
2249
|
-
children: [
|
|
2249
|
+
children: [m.map((e) => {
|
|
2250
2250
|
let a = n.fields.get(e), o = i?.includes(e), s = b.has(e);
|
|
2251
2251
|
return r || s ? /* @__PURE__ */ Y("td", {
|
|
2252
2252
|
style: {
|
|
@@ -2256,7 +2256,7 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2256
2256
|
textDecoration: r ? "line-through" : "none",
|
|
2257
2257
|
color: "var(--text-2)"
|
|
2258
2258
|
},
|
|
2259
|
-
children: a ?
|
|
2259
|
+
children: a ? w({
|
|
2260
2260
|
field: a,
|
|
2261
2261
|
fieldName: e,
|
|
2262
2262
|
value: t[e],
|
|
@@ -2264,7 +2264,7 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2264
2264
|
record: t,
|
|
2265
2265
|
refs: c,
|
|
2266
2266
|
t: d
|
|
2267
|
-
}) :
|
|
2267
|
+
}) : g(t[e])
|
|
2268
2268
|
}, e) : /* @__PURE__ */ Y("td", {
|
|
2269
2269
|
style: {
|
|
2270
2270
|
padding: "4px 4px",
|
|
@@ -2275,7 +2275,7 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2275
2275
|
borderRadius: o ? 4 : 0
|
|
2276
2276
|
},
|
|
2277
2277
|
title: o ? d("record.row.field_required", "{field} is required", { field: e }) : void 0,
|
|
2278
|
-
children: a ?
|
|
2278
|
+
children: a ? w({
|
|
2279
2279
|
field: a,
|
|
2280
2280
|
fieldName: e,
|
|
2281
2281
|
value: t[e],
|
|
@@ -2285,7 +2285,7 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2285
2285
|
refs: c,
|
|
2286
2286
|
compact: !0,
|
|
2287
2287
|
t: d
|
|
2288
|
-
}) :
|
|
2288
|
+
}) : g(t[e])
|
|
2289
2289
|
}, e);
|
|
2290
2290
|
}), /* @__PURE__ */ Y("td", {
|
|
2291
2291
|
style: {
|
|
@@ -2293,12 +2293,12 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2293
2293
|
borderBottom: "1px solid var(--divider)",
|
|
2294
2294
|
verticalAlign: "middle"
|
|
2295
2295
|
},
|
|
2296
|
-
children: r ? /* @__PURE__ */ Y(
|
|
2296
|
+
children: r ? /* @__PURE__ */ Y(C, {
|
|
2297
2297
|
size: 24,
|
|
2298
2298
|
icon: /* @__PURE__ */ Y(e.refresh, { size: 12 }),
|
|
2299
2299
|
onClick: () => E(t._key),
|
|
2300
2300
|
title: d("record.row.undo_delete", "Undo delete")
|
|
2301
|
-
}) : /* @__PURE__ */ Y(
|
|
2301
|
+
}) : /* @__PURE__ */ Y(C, {
|
|
2302
2302
|
size: 24,
|
|
2303
2303
|
icon: /* @__PURE__ */ Y(e.trash, { size: 12 }),
|
|
2304
2304
|
onClick: () => T(t._key),
|
|
@@ -2314,16 +2314,16 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2314
2314
|
kind: "ghost",
|
|
2315
2315
|
size: "xs",
|
|
2316
2316
|
icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
|
|
2317
|
-
onClick:
|
|
2317
|
+
onClick: S,
|
|
2318
2318
|
children: d("record.row.add", "Add row")
|
|
2319
2319
|
})
|
|
2320
2320
|
})] });
|
|
2321
2321
|
}
|
|
2322
2322
|
//#endregion
|
|
2323
2323
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
2324
|
-
var kt = ge(() => import("./DraggableChildrenTable-
|
|
2324
|
+
var kt = ge(() => import("./DraggableChildrenTable-CtL7rdT6.js").then((e) => ({ default: e.DraggableChildrenTable })));
|
|
2325
2325
|
function At({ node: e, ctx: n }) {
|
|
2326
|
-
let r =
|
|
2326
|
+
let r = M(), i = M("errors"), a = y(), o = e.children;
|
|
2327
2327
|
if (!o) return null;
|
|
2328
2328
|
let s = a.isPhone && n.relatedRecordsPresentation === "table";
|
|
2329
2329
|
if (n.isNew && n.mode !== "edit") return null;
|
|
@@ -2345,7 +2345,7 @@ function At({ node: e, ctx: n }) {
|
|
|
2345
2345
|
/* @__PURE__ */ Y("code", { children: c.entity })
|
|
2346
2346
|
]
|
|
2347
2347
|
});
|
|
2348
|
-
let u = Pe(c, l, e), d = Ae(e, n, r), f = je(e, n), p = (e) => u.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ Y(
|
|
2348
|
+
let u = Pe(c, l, e), d = Ae(e, n, r), f = je(e, n), p = (e) => u.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ Y(I, {
|
|
2349
2349
|
title: d,
|
|
2350
2350
|
icon: f ? /* @__PURE__ */ Y(t, {
|
|
2351
2351
|
name: f,
|
|
@@ -2353,10 +2353,10 @@ function At({ node: e, ctx: n }) {
|
|
|
2353
2353
|
}) : void 0,
|
|
2354
2354
|
children: e
|
|
2355
2355
|
});
|
|
2356
|
-
if (n.mode === "edit" && u.editable && u.interaction !== "navigate" && u.interaction !== "readonly" &&
|
|
2356
|
+
if (n.mode === "edit" && u.editable && u.interaction !== "navigate" && u.interaction !== "readonly" && m(l, "update") && u.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
|
|
2357
2357
|
let e = n.pendingChildren[o] ?? [], t = n.childValidationErrors?.[o], r = u.position_field ? a.isPhone && !s ? Ot : kt : Ot;
|
|
2358
2358
|
return p(/* @__PURE__ */ Y(he, {
|
|
2359
|
-
fallback: /* @__PURE__ */ Y(
|
|
2359
|
+
fallback: /* @__PURE__ */ Y(se, {}),
|
|
2360
2360
|
children: /* @__PURE__ */ Y(r, {
|
|
2361
2361
|
config: u,
|
|
2362
2362
|
childEntity: l,
|
|
@@ -2370,38 +2370,38 @@ function At({ node: e, ctx: n }) {
|
|
|
2370
2370
|
}));
|
|
2371
2371
|
}
|
|
2372
2372
|
if (n.isNew) return null;
|
|
2373
|
-
let
|
|
2373
|
+
let h = {
|
|
2374
2374
|
config: u,
|
|
2375
2375
|
parentEntity: n.entityCode,
|
|
2376
2376
|
parentId: n.recordId,
|
|
2377
2377
|
schema: n.schema
|
|
2378
2378
|
};
|
|
2379
2379
|
switch (u.mode) {
|
|
2380
|
-
case "list": return p(/* @__PURE__ */ Y(nt, { ...
|
|
2381
|
-
case "cards": return p(/* @__PURE__ */ Y(rt, { ...
|
|
2382
|
-
case "timeline": return p(/* @__PURE__ */ Y(bt, { ...
|
|
2383
|
-
default: return a.isPhone && !s ? p(/* @__PURE__ */ Y(rt, { ...
|
|
2380
|
+
case "list": return p(/* @__PURE__ */ Y(nt, { ...h }));
|
|
2381
|
+
case "cards": return p(/* @__PURE__ */ Y(rt, { ...h }));
|
|
2382
|
+
case "timeline": return p(/* @__PURE__ */ Y(bt, { ...h }));
|
|
2383
|
+
default: return a.isPhone && !s ? p(/* @__PURE__ */ Y(rt, { ...h })) : p(/* @__PURE__ */ Y(tt, { ...h }));
|
|
2384
2384
|
}
|
|
2385
2385
|
}
|
|
2386
2386
|
//#endregion
|
|
2387
2387
|
//#region src/components/detail-layout/FieldsBlock.tsx
|
|
2388
2388
|
function jt({ fields: e, ctx: t }) {
|
|
2389
|
-
let n =
|
|
2390
|
-
return /* @__PURE__ */ Y(
|
|
2389
|
+
let n = M(), { entity: r, entityCode: i, record: a, mode: o, onFieldChange: s, schema: c } = t, l = t.columns ?? 2, u = l === 1 && e.length === 1;
|
|
2390
|
+
return /* @__PURE__ */ Y(U, {
|
|
2391
2391
|
columns: l,
|
|
2392
2392
|
children: e.map((e) => {
|
|
2393
|
-
let l = e.code, d = `${i ?? "field"}-${l}`, f = `${d}-label`,
|
|
2394
|
-
tier:
|
|
2395
|
-
tierDef:
|
|
2396
|
-
requiredPermission:
|
|
2397
|
-
variant:
|
|
2393
|
+
let l = e.code, d = `${i ?? "field"}-${l}`, f = `${d}-label`, m = r.fields.get(l), h = !!(m?.auto || m?.readonly || m?.source), _ = p(r, l), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = h || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ Y(z, {
|
|
2394
|
+
tier: _.classification,
|
|
2395
|
+
tierDef: E(c, r, l),
|
|
2396
|
+
requiredPermission: _?.required_permission,
|
|
2397
|
+
variant: x === "edit" ? "input" : "value"
|
|
2398
2398
|
}) : de({
|
|
2399
2399
|
entity: r,
|
|
2400
2400
|
entityCode: i,
|
|
2401
2401
|
fieldName: l,
|
|
2402
2402
|
record: a,
|
|
2403
|
-
mode:
|
|
2404
|
-
onChange: s && !
|
|
2403
|
+
mode: x,
|
|
2404
|
+
onChange: s && !h ? (e) => s(l, e) : void 0,
|
|
2405
2405
|
refs: t.refs,
|
|
2406
2406
|
entities: c?.entities,
|
|
2407
2407
|
screens: c?.screens,
|
|
@@ -2411,40 +2411,40 @@ function jt({ fields: e, ctx: t }) {
|
|
|
2411
2411
|
structure: e.structure,
|
|
2412
2412
|
detailScreen: e.detail_screen
|
|
2413
2413
|
});
|
|
2414
|
-
if (!
|
|
2415
|
-
let
|
|
2414
|
+
if (!S) return null;
|
|
2415
|
+
let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ Y(J, { children: e.actions.map((e, t) => /* @__PURE__ */ Y(B, {
|
|
2416
2416
|
actionCode: `${l}.action[${t}]`,
|
|
2417
2417
|
action: e,
|
|
2418
2418
|
entityCode: i,
|
|
2419
2419
|
row: a,
|
|
2420
2420
|
variant: "ghost",
|
|
2421
2421
|
size: "icon"
|
|
2422
|
-
}, t)) }) : void 0,
|
|
2422
|
+
}, t)) }) : void 0, w = !!m && P.has(m.type), T = a?.[l], D = x === "display" && (m?.copyable || m?.type === "uuid") && T != null && T !== "" ? g(T) : void 0, O = n(m?.display?.description);
|
|
2423
2423
|
return u ? /* @__PURE__ */ X("div", {
|
|
2424
2424
|
style: { gridColumn: "1 / -1" },
|
|
2425
|
-
children: [
|
|
2425
|
+
children: [S, x === "edit" && O && /* @__PURE__ */ Y("div", {
|
|
2426
2426
|
style: {
|
|
2427
2427
|
fontSize: 11.5,
|
|
2428
2428
|
lineHeight: 1.4,
|
|
2429
2429
|
color: "var(--text-3)",
|
|
2430
2430
|
marginTop: 3
|
|
2431
2431
|
},
|
|
2432
|
-
children:
|
|
2432
|
+
children: O
|
|
2433
2433
|
})]
|
|
2434
|
-
}, l) : /* @__PURE__ */ Y(
|
|
2434
|
+
}, l) : /* @__PURE__ */ Y(R, {
|
|
2435
2435
|
"data-testid": `field-${l}`,
|
|
2436
2436
|
label: ue(n, r, l, c.entities),
|
|
2437
|
-
htmlFor:
|
|
2437
|
+
htmlFor: x === "edit" ? d : void 0,
|
|
2438
2438
|
labelId: f,
|
|
2439
|
-
labelTitle:
|
|
2440
|
-
required:
|
|
2441
|
-
mode:
|
|
2442
|
-
span:
|
|
2439
|
+
labelTitle: O || void 0,
|
|
2440
|
+
required: m?.required ?? !1,
|
|
2441
|
+
mode: x,
|
|
2442
|
+
span: w,
|
|
2443
2443
|
error: t.fieldErrors?.[l],
|
|
2444
|
-
hint:
|
|
2445
|
-
actions:
|
|
2446
|
-
copyValue:
|
|
2447
|
-
children:
|
|
2444
|
+
hint: x === "edit" && O ? O : void 0,
|
|
2445
|
+
actions: C,
|
|
2446
|
+
copyValue: D,
|
|
2447
|
+
children: S
|
|
2448
2448
|
}, l);
|
|
2449
2449
|
})
|
|
2450
2450
|
});
|
|
@@ -2464,10 +2464,10 @@ function Pt({ node: e, ctx: t }) {
|
|
|
2464
2464
|
let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
|
|
2465
2465
|
if (a) return null;
|
|
2466
2466
|
let l = e.properties === !0 || e.properties, u = l === !0 ? Object.entries(c).sort(([e], [t]) => e.localeCompare(t)) : l.filter((e) => c[e] != null).map((e) => [e, c[e]]);
|
|
2467
|
-
return u.length === 0 ? null : /* @__PURE__ */ Y(
|
|
2467
|
+
return u.length === 0 ? null : /* @__PURE__ */ Y(U, {
|
|
2468
2468
|
columns: 2,
|
|
2469
2469
|
children: u.map(([e, a]) => {
|
|
2470
|
-
let c = r?.find((t) => t.property_code === e), l =
|
|
2470
|
+
let c = r?.find((t) => t.property_code === e), l = f(a), u = a.readonly || !i ? "display" : o;
|
|
2471
2471
|
return /* @__PURE__ */ Y(Ft, {
|
|
2472
2472
|
propCode: e,
|
|
2473
2473
|
prop: a,
|
|
@@ -2483,7 +2483,7 @@ function Pt({ node: e, ctx: t }) {
|
|
|
2483
2483
|
});
|
|
2484
2484
|
}
|
|
2485
2485
|
function Ft({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: s, schema: c }) {
|
|
2486
|
-
let l =
|
|
2486
|
+
let l = M(), u = K(null);
|
|
2487
2487
|
G(() => () => {
|
|
2488
2488
|
u.current && clearTimeout(u.current);
|
|
2489
2489
|
}, []);
|
|
@@ -2493,22 +2493,22 @@ function Ft({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty:
|
|
|
2493
2493
|
e,
|
|
2494
2494
|
t.type,
|
|
2495
2495
|
a
|
|
2496
|
-
]), f =
|
|
2497
|
-
return /* @__PURE__ */ Y(
|
|
2496
|
+
]), f = p(s, e), m = f?.read === "denied", h = f?.write === "denied", g = i === "display" ? m : h || m, _ = i === "edit" && h ? "display" : i;
|
|
2497
|
+
return /* @__PURE__ */ Y(R, {
|
|
2498
2498
|
label: l(t.display?.name ?? t.name),
|
|
2499
|
-
mode:
|
|
2500
|
-
span:
|
|
2501
|
-
children:
|
|
2499
|
+
mode: _,
|
|
2500
|
+
span: P.has(t.type),
|
|
2501
|
+
children: g ? /* @__PURE__ */ Y(z, {
|
|
2502
2502
|
tier: f.classification,
|
|
2503
|
-
tierDef:
|
|
2503
|
+
tierDef: E(c, s, e),
|
|
2504
2504
|
requiredPermission: f?.required_permission,
|
|
2505
|
-
variant:
|
|
2506
|
-
}) :
|
|
2505
|
+
variant: _ === "edit" ? "input" : "value"
|
|
2506
|
+
}) : w({
|
|
2507
2507
|
field: n,
|
|
2508
2508
|
fieldName: e,
|
|
2509
2509
|
value: r,
|
|
2510
|
-
mode:
|
|
2511
|
-
onChange:
|
|
2510
|
+
mode: _,
|
|
2511
|
+
onChange: _ === "edit" ? d : void 0,
|
|
2512
2512
|
refs: o,
|
|
2513
2513
|
t: l
|
|
2514
2514
|
})
|
|
@@ -2584,7 +2584,7 @@ function It({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2584
2584
|
//#endregion
|
|
2585
2585
|
//#region src/components/shared/StatusGroupsDisplay.tsx
|
|
2586
2586
|
function Lt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r, mode: i = "edit" }) {
|
|
2587
|
-
let
|
|
2587
|
+
let a = M();
|
|
2588
2588
|
return /* @__PURE__ */ Y("div", {
|
|
2589
2589
|
style: {
|
|
2590
2590
|
display: "flex",
|
|
@@ -2592,10 +2592,10 @@ function Lt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2592
2592
|
alignItems: "center",
|
|
2593
2593
|
gap: 16
|
|
2594
2594
|
},
|
|
2595
|
-
children: Object.entries(e).map(([e,
|
|
2596
|
-
let
|
|
2597
|
-
if (
|
|
2598
|
-
let t = i === "edit",
|
|
2595
|
+
children: Object.entries(e).map(([e, o]) => {
|
|
2596
|
+
let s = t?.find((t) => t.group_code === e)?.status_code, c = s ? o.statuses.find((e) => e.code === s) : void 0;
|
|
2597
|
+
if (o.display_mode === "stepper") {
|
|
2598
|
+
let t = i === "edit", c = t ? o.transitions && s ? /* @__PURE__ */ new Set([s, ...o.transitions[s] ?? []]) : new Set(o.statuses.map((e) => e.code)) : void 0;
|
|
2599
2599
|
return /* @__PURE__ */ X("div", {
|
|
2600
2600
|
style: {
|
|
2601
2601
|
display: "flex",
|
|
@@ -2609,7 +2609,7 @@ function Lt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2609
2609
|
color: "var(--text-3)",
|
|
2610
2610
|
flexShrink: 0
|
|
2611
2611
|
},
|
|
2612
|
-
children: [o
|
|
2612
|
+
children: [a(o.name), ":"]
|
|
2613
2613
|
}), /* @__PURE__ */ Y("div", {
|
|
2614
2614
|
style: {
|
|
2615
2615
|
minWidth: 240,
|
|
@@ -2617,12 +2617,12 @@ function Lt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2617
2617
|
pointerEvents: r ? "none" : "auto"
|
|
2618
2618
|
},
|
|
2619
2619
|
children: /* @__PURE__ */ Y(It, {
|
|
2620
|
-
stages:
|
|
2620
|
+
stages: o.statuses.map((e) => ({
|
|
2621
2621
|
code: e.code,
|
|
2622
|
-
label:
|
|
2622
|
+
label: a(e.name)
|
|
2623
2623
|
})),
|
|
2624
|
-
current:
|
|
2625
|
-
selectable:
|
|
2624
|
+
current: s,
|
|
2625
|
+
selectable: c,
|
|
2626
2626
|
onSelect: t ? (t) => n(e, t) : void 0,
|
|
2627
2627
|
compact: !0
|
|
2628
2628
|
})
|
|
@@ -2640,11 +2640,11 @@ function Lt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2640
2640
|
fontSize: 12,
|
|
2641
2641
|
color: "var(--text-3)"
|
|
2642
2642
|
},
|
|
2643
|
-
children: [o
|
|
2644
|
-
}),
|
|
2645
|
-
tone:
|
|
2643
|
+
children: [a(o.name), ":"]
|
|
2644
|
+
}), c ? /* @__PURE__ */ Y(u, {
|
|
2645
|
+
tone: c.color ?? "slate",
|
|
2646
2646
|
size: "xs",
|
|
2647
|
-
children:
|
|
2647
|
+
children: a(c.name)
|
|
2648
2648
|
}) : /* @__PURE__ */ Y("span", {
|
|
2649
2649
|
style: {
|
|
2650
2650
|
fontSize: 12.5,
|
|
@@ -2653,7 +2653,7 @@ function Lt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2653
2653
|
children: "—"
|
|
2654
2654
|
})]
|
|
2655
2655
|
}, e);
|
|
2656
|
-
let
|
|
2656
|
+
let l = (o.transitions && s ? o.statuses.filter((e) => e.code === s || (o.transitions[s]?.includes(e.code) ?? !1)) : o.statuses).map((e) => ({
|
|
2657
2657
|
value: e.code,
|
|
2658
2658
|
label: /* @__PURE__ */ X("span", {
|
|
2659
2659
|
style: {
|
|
@@ -2667,7 +2667,7 @@ function Lt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2667
2667
|
borderRadius: 999,
|
|
2668
2668
|
background: `var(--pill-${e.color}, ${e.color})`,
|
|
2669
2669
|
display: "inline-block"
|
|
2670
|
-
} }),
|
|
2670
|
+
} }), a(e.name)]
|
|
2671
2671
|
})
|
|
2672
2672
|
}));
|
|
2673
2673
|
return /* @__PURE__ */ X("div", {
|
|
@@ -2681,16 +2681,16 @@ function Lt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2681
2681
|
fontSize: 12,
|
|
2682
2682
|
color: "var(--text-3)"
|
|
2683
2683
|
},
|
|
2684
|
-
children: [o
|
|
2684
|
+
children: [a(o.name), ":"]
|
|
2685
2685
|
}), /* @__PURE__ */ Y("div", {
|
|
2686
2686
|
style: {
|
|
2687
2687
|
minWidth: 180,
|
|
2688
2688
|
opacity: r ? .6 : 1,
|
|
2689
2689
|
pointerEvents: r ? "none" : "auto"
|
|
2690
2690
|
},
|
|
2691
|
-
children: /* @__PURE__ */ Y(
|
|
2692
|
-
value:
|
|
2693
|
-
options:
|
|
2691
|
+
children: /* @__PURE__ */ Y(T, {
|
|
2692
|
+
value: s ?? "",
|
|
2693
|
+
options: l,
|
|
2694
2694
|
onChange: (t) => n(e, t)
|
|
2695
2695
|
})
|
|
2696
2696
|
})]
|
|
@@ -2751,14 +2751,14 @@ function Ut(e) {
|
|
|
2751
2751
|
}
|
|
2752
2752
|
var Wt = ge(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonDiff }))), Gt = ge(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonSource }))), Kt = ge(() => import("./JsonEditor-Dz1PQHC8.js").then((e) => ({ default: e.JsonEditor })));
|
|
2753
2753
|
function qt() {
|
|
2754
|
-
let e =
|
|
2754
|
+
let e = M();
|
|
2755
2755
|
return /* @__PURE__ */ Y("div", {
|
|
2756
2756
|
className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
|
|
2757
2757
|
children: e("record.diff.loading_editor", "Loading editor…")
|
|
2758
2758
|
});
|
|
2759
2759
|
}
|
|
2760
2760
|
function Jt({ before: e, after: t }) {
|
|
2761
|
-
let n =
|
|
2761
|
+
let n = M();
|
|
2762
2762
|
return /* @__PURE__ */ Y(he, {
|
|
2763
2763
|
fallback: /* @__PURE__ */ Y(qt, {}),
|
|
2764
2764
|
children: /* @__PURE__ */ X("div", {
|
|
@@ -2782,7 +2782,7 @@ function Jt({ before: e, after: t }) {
|
|
|
2782
2782
|
});
|
|
2783
2783
|
}
|
|
2784
2784
|
function Yt({ mode: e, onChange: t }) {
|
|
2785
|
-
let n =
|
|
2785
|
+
let n = M();
|
|
2786
2786
|
return /* @__PURE__ */ X("div", {
|
|
2787
2787
|
className: "inline-flex gap-1",
|
|
2788
2788
|
role: "group",
|
|
@@ -2803,7 +2803,7 @@ function Yt({ mode: e, onChange: t }) {
|
|
|
2803
2803
|
});
|
|
2804
2804
|
}
|
|
2805
2805
|
function Xt({ values: e, options: t }) {
|
|
2806
|
-
let n =
|
|
2806
|
+
let n = M(), r = e.before, i = e.after, a = t?.default_mode === "source" ? "source" : "diff", [o, s] = q(a), c = Ht(r), l = Ht(i);
|
|
2807
2807
|
return /* @__PURE__ */ X("div", {
|
|
2808
2808
|
className: "flex flex-col gap-2",
|
|
2809
2809
|
children: [/* @__PURE__ */ X("div", {
|
|
@@ -2820,7 +2820,7 @@ function Xt({ values: e, options: t }) {
|
|
|
2820
2820
|
className: "h-[480px] w-full overflow-hidden rounded border",
|
|
2821
2821
|
role: "group",
|
|
2822
2822
|
"aria-label": Ut(n),
|
|
2823
|
-
children: /* @__PURE__ */ Y(
|
|
2823
|
+
children: /* @__PURE__ */ Y(L, {
|
|
2824
2824
|
fallback: /* @__PURE__ */ Y(Jt, {
|
|
2825
2825
|
before: r,
|
|
2826
2826
|
after: i
|
|
@@ -2960,48 +2960,48 @@ function nn(e, t) {
|
|
|
2960
2960
|
return !t || Object.entries(t).every(([t, n]) => e[t] === n);
|
|
2961
2961
|
}
|
|
2962
2962
|
function rn({ values: e, options: t }) {
|
|
2963
|
-
let n =
|
|
2963
|
+
let n = M(), r = M("errors"), i = ye(() => Qt(t), [t]), a = ae(), o = e.scope, s = i?.windows.some((e) => e.code === i.default_window) ? i.default_window : i?.windows[0]?.code ?? "", [l, u] = q(s), [d, f] = q("");
|
|
2964
2964
|
G(() => {
|
|
2965
|
-
u(
|
|
2966
|
-
}, [
|
|
2965
|
+
u(s);
|
|
2966
|
+
}, [s]), G(() => {
|
|
2967
2967
|
f("");
|
|
2968
2968
|
}, [l]);
|
|
2969
|
-
let p =
|
|
2970
|
-
field:
|
|
2969
|
+
let p = i ? [{
|
|
2970
|
+
field: i.scope_field,
|
|
2971
2971
|
op: "eq",
|
|
2972
|
-
value:
|
|
2972
|
+
value: o
|
|
2973
2973
|
}, {
|
|
2974
|
-
field:
|
|
2974
|
+
field: i.window_field,
|
|
2975
2975
|
op: "eq",
|
|
2976
2976
|
value: l
|
|
2977
|
-
}] : [], m = i
|
|
2977
|
+
}] : [], m = c(i?.entity, {
|
|
2978
2978
|
per_page: 1,
|
|
2979
2979
|
filters: p
|
|
2980
|
-
}, !!(
|
|
2980
|
+
}, !!(i && o && l)), h = i?.breakdown, g = h ? [{
|
|
2981
2981
|
field: h.scope_field,
|
|
2982
2982
|
op: "eq",
|
|
2983
|
-
value:
|
|
2983
|
+
value: o
|
|
2984
2984
|
}, {
|
|
2985
2985
|
field: h.window_field,
|
|
2986
2986
|
op: "eq",
|
|
2987
2987
|
value: l
|
|
2988
|
-
}] : [], _ =
|
|
2988
|
+
}] : [], _ = c(h?.entity, {
|
|
2989
2989
|
per_page: h?.limit ?? 200,
|
|
2990
2990
|
sort: h?.sort,
|
|
2991
2991
|
filters: g
|
|
2992
|
-
}, !!(h &&
|
|
2993
|
-
if (!
|
|
2992
|
+
}, !!(h && o && l));
|
|
2993
|
+
if (!i || !o) return /* @__PURE__ */ Y("div", {
|
|
2994
2994
|
role: "alert",
|
|
2995
2995
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
2996
2996
|
children: r("record.scorecard_config_invalid", "Invalid entity_scorecard configuration.")
|
|
2997
2997
|
});
|
|
2998
2998
|
let v = m.data?.data?.[0], y = _.data?.data ?? [], b = h?.filter_field ? Array.from(new Set(y.map((e) => e[h.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], x = d && h?.filter_field ? y.filter((e) => e[h.filter_field] === d) : y, S = (e) => !d || !e.filtered || !h?.filter_field ? v?.[e.field] : y.find((t) => t[h.filter_field] === d && nn(t, e.filtered?.where))?.[e.filtered.field], C = (e) => {
|
|
2999
|
-
let t =
|
|
2999
|
+
let t = i.drillthrough;
|
|
3000
3000
|
if (!t || !e.drillthrough_value) return;
|
|
3001
3001
|
let n = [{
|
|
3002
3002
|
field: t.scope_field,
|
|
3003
3003
|
op: "eq",
|
|
3004
|
-
value:
|
|
3004
|
+
value: o
|
|
3005
3005
|
}, {
|
|
3006
3006
|
field: t.window_field,
|
|
3007
3007
|
op: "eq",
|
|
@@ -3015,28 +3015,28 @@ function rn({ values: e, options: t }) {
|
|
|
3015
3015
|
field: t.metric_field,
|
|
3016
3016
|
op: "eq",
|
|
3017
3017
|
value: e.drillthrough_value
|
|
3018
|
-
}),
|
|
3018
|
+
}), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(n) }).toString() });
|
|
3019
3019
|
}, w = m.error ?? _.error, T = n(h?.filter_label) || n("record.scorecard.filter", "Filter");
|
|
3020
3020
|
return /* @__PURE__ */ X("div", {
|
|
3021
3021
|
className: "flex min-w-0 flex-col gap-4",
|
|
3022
|
-
"aria-label": n(
|
|
3022
|
+
"aria-label": n(i.title) || n("record.scorecard.title", "Scorecard"),
|
|
3023
3023
|
children: [
|
|
3024
3024
|
/* @__PURE__ */ X("div", {
|
|
3025
3025
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
3026
3026
|
children: [/* @__PURE__ */ X("div", {
|
|
3027
3027
|
className: "min-w-0",
|
|
3028
3028
|
children: [
|
|
3029
|
-
|
|
3029
|
+
i.title && /* @__PURE__ */ Y("h3", {
|
|
3030
3030
|
className: "text-base font-semibold text-foreground",
|
|
3031
|
-
children: n(
|
|
3031
|
+
children: n(i.title)
|
|
3032
3032
|
}),
|
|
3033
|
-
|
|
3033
|
+
i.description && /* @__PURE__ */ Y("p", {
|
|
3034
3034
|
className: "mt-1 text-sm text-muted-foreground",
|
|
3035
|
-
children: n(
|
|
3035
|
+
children: n(i.description)
|
|
3036
3036
|
}),
|
|
3037
|
-
|
|
3037
|
+
i.intended_note && /* @__PURE__ */ Y("p", {
|
|
3038
3038
|
className: "mt-1 text-xs text-muted-foreground",
|
|
3039
|
-
children: n(
|
|
3039
|
+
children: n(i.intended_note)
|
|
3040
3040
|
})
|
|
3041
3041
|
]
|
|
3042
3042
|
}), /* @__PURE__ */ X("div", {
|
|
@@ -3045,7 +3045,7 @@ function rn({ values: e, options: t }) {
|
|
|
3045
3045
|
role: "group",
|
|
3046
3046
|
"aria-label": n("record.scorecard.window", "Scorecard window"),
|
|
3047
3047
|
className: "inline-flex rounded border border-border p-1",
|
|
3048
|
-
children:
|
|
3048
|
+
children: i.windows.map((e) => /* @__PURE__ */ Y("button", {
|
|
3049
3049
|
type: "button",
|
|
3050
3050
|
"aria-pressed": l === e.code,
|
|
3051
3051
|
onClick: () => u(e.code),
|
|
@@ -3073,16 +3073,16 @@ function rn({ values: e, options: t }) {
|
|
|
3073
3073
|
w && /* @__PURE__ */ Y("div", {
|
|
3074
3074
|
role: "alert",
|
|
3075
3075
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
3076
|
-
children:
|
|
3076
|
+
children: re(r, w)
|
|
3077
3077
|
}),
|
|
3078
3078
|
!w && !m.isLoading && !v && /* @__PURE__ */ Y("div", {
|
|
3079
3079
|
className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
|
|
3080
|
-
children: n(
|
|
3080
|
+
children: n(i.empty_label) || n("record.scorecard.empty", "No scorecard data.")
|
|
3081
3081
|
}),
|
|
3082
3082
|
v && /* @__PURE__ */ Y("div", {
|
|
3083
3083
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
3084
|
-
children:
|
|
3085
|
-
let t = S(e), r = !!(
|
|
3084
|
+
children: i.metrics.map((e) => {
|
|
3085
|
+
let t = S(e), r = !!(i.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ X(J, { children: [
|
|
3086
3086
|
/* @__PURE__ */ Y("span", {
|
|
3087
3087
|
className: "text-xs font-medium text-muted-foreground",
|
|
3088
3088
|
children: n(e.label) || e.field
|
|
@@ -3100,10 +3100,10 @@ function rn({ values: e, options: t }) {
|
|
|
3100
3100
|
type: "button",
|
|
3101
3101
|
onClick: () => C(e),
|
|
3102
3102
|
className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
|
|
3103
|
-
children:
|
|
3103
|
+
children: a
|
|
3104
3104
|
}, e.field) : /* @__PURE__ */ Y("article", {
|
|
3105
3105
|
className: "rounded border border-border bg-card p-3",
|
|
3106
|
-
children:
|
|
3106
|
+
children: a
|
|
3107
3107
|
}, e.field);
|
|
3108
3108
|
})
|
|
3109
3109
|
}),
|
|
@@ -3137,13 +3137,13 @@ function rn({ values: e, options: t }) {
|
|
|
3137
3137
|
//#region src/components/detail-layout/widgets/builtins.ts
|
|
3138
3138
|
var an = !1;
|
|
3139
3139
|
function on() {
|
|
3140
|
-
an ||= (
|
|
3140
|
+
an ||= (V("json_diff", Xt), V("entity_scorecard", rn), !0);
|
|
3141
3141
|
}
|
|
3142
3142
|
//#endregion
|
|
3143
3143
|
//#region src/components/detail-layout/widgets/WidgetHost.tsx
|
|
3144
3144
|
on();
|
|
3145
3145
|
function sn({ config: e, ctx: t }) {
|
|
3146
|
-
let n =
|
|
3146
|
+
let n = M("errors"), r = H(e.type);
|
|
3147
3147
|
if (!r) return /* @__PURE__ */ X("span", {
|
|
3148
3148
|
className: "text-sm text-muted-foreground",
|
|
3149
3149
|
children: [
|
|
@@ -3195,7 +3195,7 @@ function ln({ node: e, ctx: t }) {
|
|
|
3195
3195
|
}) : e.children ? /* @__PURE__ */ Y(At, {
|
|
3196
3196
|
node: e,
|
|
3197
3197
|
ctx: t
|
|
3198
|
-
}) : e.associated ? /* @__PURE__ */ Y(
|
|
3198
|
+
}) : e.associated ? /* @__PURE__ */ Y(N, {
|
|
3199
3199
|
node: e,
|
|
3200
3200
|
ctx: t
|
|
3201
3201
|
}) : e.fields ? /* @__PURE__ */ Y(jt, {
|