@declarion/react 0.52.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/{DraggableChildrenTable-CJCjc_cd.js → DraggableChildrenTable-CPoUY99R.js} +35 -35
- package/dist-lib/{Grid-DUjbQg3r.js → Grid--QAEby8k.js} +28 -28
- package/dist-lib/{LayoutRenderer-DbdxC-Bq.js → LayoutRenderer-BxZ7Nd9b.js} +920 -922
- package/dist-lib/{ListCardsBody-C8ofksQb.js → ListCardsBody-BPV4GPrv.js} +14 -14
- package/dist-lib/{MarkdownRenderer-B9_5fwuE.js → MarkdownRenderer-CIKuh_0i.js} +10 -10
- package/dist-lib/{record-documents-key-8fdm7C10.js → RecordIdBadge-CGxPR-8q.js} +1 -4
- package/dist-lib/{RefreshControl-C-8UCyau.js → RefreshControl-DMLkZP3R.js} +120 -122
- package/dist-lib/{SmartDetailPage.impl-DWjNQ052.js → SmartDetailPage.impl-SnNu6Ug-.js} +376 -377
- package/dist-lib/{SmartListPage.impl-yKBK7a8b.js → SmartListPage.impl-C73pR7Iw.js} +1098 -1099
- package/dist-lib/{SmartRecordListPage.impl-DRpU_DOC.js → SmartRecordListPage.impl-rJjQZe1V.js} +183 -183
- package/dist-lib/{SortHeaderMenu-CbihbEGd.js → SortHeaderMenu-DQ_KrkWk.js} +1 -1
- package/dist-lib/{action-dispatch-C28UhXXA.js → action-dispatch-DsuUS7ae.js} +382 -382
- package/dist-lib/api/agents.d.ts +0 -1
- package/dist-lib/api/events.d.ts +27 -5
- package/dist-lib/{cardProjection-Bp_ZPLUE.js → cardProjection-BadzqyeQ.js} +146 -204
- package/dist-lib/components/actions/ObjectActionBar.d.ts +1 -1
- package/dist-lib/components/chrome/Breadcrumbs.d.ts +1 -1
- package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +1 -1
- package/dist-lib/components/detail-layout/DetailHighlights.d.ts +1 -1
- package/dist-lib/components/detail-layout/DraggableChildrenTable.d.ts +1 -1
- package/dist-lib/components/detail-layout/EditableChildrenTable.d.ts +1 -1
- package/dist-lib/components/detail-layout/LayoutRenderer.d.ts +1 -1
- package/dist-lib/components/file-widgets/host.d.ts +1 -1
- package/dist-lib/components/layout/Layout.d.ts +1 -1
- package/dist-lib/components/layout/TopBar.d.ts +1 -1
- package/dist-lib/components/list/InlineEditCell.d.ts +1 -1
- package/dist-lib/components/list/PeekFieldCell.d.ts +1 -1
- package/dist-lib/components/list/QuickPeek.d.ts +1 -1
- package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -1
- package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +2 -2
- package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
- package/dist-lib/components/pages/list/ListCardRow.d.ts +1 -1
- package/dist-lib/components/pages/list/ListCardsBody.d.ts +1 -1
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +1 -1
- package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
- package/dist-lib/components/pages/list/columns.d.ts +1 -1
- package/dist-lib/components/pages/list/filter-meta.d.ts +1 -1
- package/dist-lib/components/pages/list/use-filter-value-labels.d.ts +1 -1
- package/dist-lib/components/pages/list/useListQuery.d.ts +6 -1
- package/dist-lib/components/pages/list/useListRowInteraction.d.ts +1 -1
- package/dist-lib/components/pages/list/useListViews.d.ts +1 -1
- package/dist-lib/components/pages/list/useRowMenu.d.ts +1 -1
- package/dist-lib/components/shared/RefreshControl.d.ts +7 -1
- package/dist-lib/components/shared/useOwnRefresh.d.ts +9 -0
- package/dist-lib/{field-classification-CeYJlsNq.js → field-classification-sMkkAEg9.js} +301 -320
- package/dist-lib/{format-count-C3N-WxEy.js → format-count-B5SLlNOb.js} +245 -245
- package/dist-lib/hooks/useMutations.d.ts +1 -1
- package/dist-lib/hooks/useSSE.d.ts +24 -4
- package/dist-lib/index.js +1586 -1858
- package/dist-lib/lib/action-dispatch.d.ts +1 -1
- package/dist-lib/lib/document-templates.d.ts +1 -1
- package/dist-lib/lib/realtime-reconcile.d.ts +43 -0
- package/dist-lib/{peekDraftStore-D3sowXga.js → peekDraftStore-CbHFwz_F.js} +36 -36
- package/dist-lib/{registry-p6CejATt.js → registry-D0RhCnEL.js} +507 -507
- package/dist-lib/stores/realtime.d.ts +20 -0
- package/dist-lib/testing.js +35 -35
- package/dist-lib/types/api.d.ts +8 -4
- package/dist-lib/types/schema.d.ts +6 -0
- package/dist-lib/{useCurrentScreen-74x5yJNb.js → useCurrentScreen-DVTXCj_K.js} +2508 -1557
- package/dist-lib/{useListQuery-D75bgLLz.js → useListQuery-C2nq58YV.js} +13 -10
- package/dist-lib/{useProperties-C5fZp12D.js → useProperties-BcIz-MyO.js} +25 -25
- package/dist-lib/useTabSearchMirror-UYCsopxP.js +177 -0
- package/dist-lib/{value-DKekzcjz.js → value-CQzGOI0F.js} +25 -25
- package/package.json +14 -14
- package/dist-lib/useTabSearchMirror-D_wzoYRz.js +0 -406
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
-
import { $n as n, A as r,
|
|
3
|
-
import { c as
|
|
4
|
-
import {
|
|
5
|
-
import { m as ce, p as le } from "./action-dispatch-
|
|
6
|
-
import {
|
|
2
|
+
import { $n as n, A as r, Bn as i, Cr as a, Ct as o, Dr as s, Fr as c, Ir as l, Jn as u, Jt as d, Kn as f, Kt as p, Mt as m, Pr as h, Qn as g, R as _, St as v, Xn as y, Zn as b, c as x, cr as S, in as C, it as w, jr as T, k as E, lr as D, nr as O, nt as k, qn as A, qt as j, rr as M, rt as N, s as ee, vr as P, yn as F } from "./useCurrentScreen-DVTXCj_K.js";
|
|
3
|
+
import { c as I, d as L, f as R, l as z, o as B, r as V, s as H, t as te } from "./registry-D0RhCnEL.js";
|
|
4
|
+
import { C as ne, O as re, c as ie, n as ae, t as oe, x as se } from "./field-classification-sMkkAEg9.js";
|
|
5
|
+
import { m as ce, p as le } from "./action-dispatch-DsuUS7ae.js";
|
|
6
|
+
import { o as ue } from "./cardProjection-BadzqyeQ.js";
|
|
7
7
|
import { n as de, r as fe, t as pe } from "./dataTableStyles-vwD1mVOP.js";
|
|
8
|
-
import { Suspense as me, createContext as he, lazy as ge, useCallback as
|
|
8
|
+
import { Suspense as me, createContext as he, lazy as ge, useCallback as U, useContext as _e, useEffect as W, useId as ve, useLayoutEffect as ye, useMemo as G, useRef as K, useState as q } from "react";
|
|
9
9
|
import { useInfiniteQuery as be, useMutation as xe, useQueryClient as Se } from "@tanstack/react-query";
|
|
10
|
-
import { Fragment as
|
|
10
|
+
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
11
11
|
//#region src/lib/size-value.ts
|
|
12
12
|
var Ce = /^(\d+)px$/;
|
|
13
13
|
function we(e) {
|
|
@@ -31,8 +31,8 @@ function we(e) {
|
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/components/detail-layout/LayoutRow.tsx
|
|
33
33
|
function Te({ config: e, ctx: t }) {
|
|
34
|
-
let { items: n, gap: r = 0, resizable: i = !1, stack_below: a } = e, o = a === "never" ? 0 : a ?? 768, [s, c] =
|
|
35
|
-
|
|
34
|
+
let { items: n, gap: r = 0, resizable: i = !1, stack_below: a } = e, o = a === "never" ? 0 : a ?? 768, [s, c] = q(!1), l = K(null);
|
|
35
|
+
W(() => {
|
|
36
36
|
if (o === 0) return;
|
|
37
37
|
let e = l.current;
|
|
38
38
|
if (!e) return;
|
|
@@ -41,10 +41,10 @@ function Te({ config: e, ctx: t }) {
|
|
|
41
41
|
});
|
|
42
42
|
return t.observe(e), () => t.disconnect();
|
|
43
43
|
}, [o]);
|
|
44
|
-
let [u, d] =
|
|
44
|
+
let [u, d] = q(null), f = K(null), p = U(() => n.map((t) => {
|
|
45
45
|
let n = we(t.width ?? t.column?.width ?? t.row?.width ?? e.width);
|
|
46
46
|
return n && n.kind === "weight" ? n.value : 1;
|
|
47
|
-
}), [n, e.width]), m =
|
|
47
|
+
}), [n, e.width]), m = U((e, t) => {
|
|
48
48
|
t.preventDefault();
|
|
49
49
|
let n = u ?? p();
|
|
50
50
|
f.current = {
|
|
@@ -62,23 +62,23 @@ function Te({ config: e, ctx: t }) {
|
|
|
62
62
|
};
|
|
63
63
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
64
64
|
}, [u, p]), h = u ?? p(), g = e.height ? De(e.height) : void 0;
|
|
65
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ Y("div", {
|
|
66
66
|
ref: l,
|
|
67
|
-
className:
|
|
67
|
+
className: z("flex", s && "flex-col"),
|
|
68
68
|
style: {
|
|
69
69
|
gap: r ? `${r}px` : void 0,
|
|
70
70
|
...g
|
|
71
71
|
},
|
|
72
|
-
children: n.map((r, a) => /* @__PURE__ */
|
|
73
|
-
className:
|
|
72
|
+
children: n.map((r, a) => /* @__PURE__ */ X("div", {
|
|
73
|
+
className: z("min-w-0 flex items-stretch", s && "w-full"),
|
|
74
74
|
style: s ? void 0 : Ee(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
|
|
75
|
-
children: [/* @__PURE__ */
|
|
76
|
-
className:
|
|
77
|
-
children: /* @__PURE__ */
|
|
75
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
76
|
+
className: z("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
|
|
77
|
+
children: /* @__PURE__ */ Y(_n, {
|
|
78
78
|
node: r,
|
|
79
79
|
ctx: t
|
|
80
80
|
})
|
|
81
|
-
}), i && !s && a < n.length - 1 && /* @__PURE__ */
|
|
81
|
+
}), i && !s && a < n.length - 1 && /* @__PURE__ */ Y("div", {
|
|
82
82
|
className: "detail-resize-handle",
|
|
83
83
|
onMouseDown: (e) => m(a, e)
|
|
84
84
|
})]
|
|
@@ -109,10 +109,10 @@ function De(e) {
|
|
|
109
109
|
//#region src/components/detail-layout/LayoutColumn.tsx
|
|
110
110
|
function Oe({ config: e, ctx: t }) {
|
|
111
111
|
let { items: n, gap: r = 12 } = e;
|
|
112
|
-
return /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ Y("div", {
|
|
113
113
|
className: "flex flex-col h-full",
|
|
114
114
|
style: { gap: r ? `${r}px` : void 0 },
|
|
115
|
-
children: n.map((e, n) => /* @__PURE__ */
|
|
115
|
+
children: n.map((e, n) => /* @__PURE__ */ Y(_n, {
|
|
116
116
|
node: e,
|
|
117
117
|
ctx: t
|
|
118
118
|
}, n))
|
|
@@ -126,13 +126,13 @@ function ke(e) {
|
|
|
126
126
|
function Ae(e, t) {
|
|
127
127
|
let n = ke(e);
|
|
128
128
|
if (n) {
|
|
129
|
-
if (e.label) return
|
|
129
|
+
if (e.label) return b(e.label);
|
|
130
130
|
let r = t.entity.children?.find((e) => e.entity === n);
|
|
131
|
-
if (r?.display?.name) return
|
|
131
|
+
if (r?.display?.name) return b(r.display.name);
|
|
132
132
|
let i = t.schema.entities[n];
|
|
133
|
-
return i && (
|
|
133
|
+
return i && (b(i.display.name_plural) || b(i.display.name)) || n;
|
|
134
134
|
}
|
|
135
|
-
return e.section ?
|
|
135
|
+
return e.section ? b(e.section.name) : "Tab";
|
|
136
136
|
}
|
|
137
137
|
function je(e, t) {
|
|
138
138
|
if (e.icon) return e.icon;
|
|
@@ -147,18 +147,18 @@ function je(e, t) {
|
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/components/detail-layout/LayoutTabs.tsx
|
|
149
149
|
function Me({ config: e, ctx: n }) {
|
|
150
|
-
let { items: r } = e, [i, a] =
|
|
150
|
+
let { items: r } = e, [i, a] = q(0), o = s(), c = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
|
|
151
151
|
if (r.length === 0) return null;
|
|
152
|
-
if (
|
|
152
|
+
if (c === "sections") {
|
|
153
153
|
let e = r.map((e, t) => `detail-tab-section-${t}`);
|
|
154
|
-
return /* @__PURE__ */
|
|
154
|
+
return /* @__PURE__ */ X("div", {
|
|
155
155
|
style: {
|
|
156
156
|
display: "flex",
|
|
157
157
|
flexDirection: "column",
|
|
158
158
|
gap: 10,
|
|
159
159
|
minWidth: 0
|
|
160
160
|
},
|
|
161
|
-
children: [r.length > 1 && /* @__PURE__ */
|
|
161
|
+
children: [r.length > 1 && /* @__PURE__ */ Y("nav", {
|
|
162
162
|
"aria-label": "Detail sections",
|
|
163
163
|
style: {
|
|
164
164
|
display: "flex",
|
|
@@ -169,7 +169,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
169
169
|
},
|
|
170
170
|
children: r.map((r, i) => {
|
|
171
171
|
let a = Ae(r, n), o = je(r, n);
|
|
172
|
-
return /* @__PURE__ */
|
|
172
|
+
return /* @__PURE__ */ X("button", {
|
|
173
173
|
type: "button",
|
|
174
174
|
onClick: () => document.getElementById(e[i])?.scrollIntoView({
|
|
175
175
|
block: "start",
|
|
@@ -191,10 +191,10 @@ function Me({ config: e, ctx: n }) {
|
|
|
191
191
|
whiteSpace: "nowrap",
|
|
192
192
|
cursor: "pointer"
|
|
193
193
|
},
|
|
194
|
-
children: [o && /* @__PURE__ */
|
|
194
|
+
children: [o && /* @__PURE__ */ Y(t, {
|
|
195
195
|
name: o,
|
|
196
196
|
size: 13
|
|
197
|
-
}), /* @__PURE__ */
|
|
197
|
+
}), /* @__PURE__ */ Y("span", {
|
|
198
198
|
style: {
|
|
199
199
|
overflow: "hidden",
|
|
200
200
|
textOverflow: "ellipsis"
|
|
@@ -205,7 +205,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
205
205
|
})
|
|
206
206
|
}), r.map((r, i) => {
|
|
207
207
|
let a = Ae(r, n), o = je(r, n);
|
|
208
|
-
return /* @__PURE__ */
|
|
208
|
+
return /* @__PURE__ */ X("section", {
|
|
209
209
|
id: e[i],
|
|
210
210
|
style: {
|
|
211
211
|
background: "var(--surface)",
|
|
@@ -216,7 +216,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
216
216
|
minWidth: 0,
|
|
217
217
|
scrollMarginTop: 12
|
|
218
218
|
},
|
|
219
|
-
children: [/* @__PURE__ */
|
|
219
|
+
children: [/* @__PURE__ */ X("div", {
|
|
220
220
|
style: {
|
|
221
221
|
display: "flex",
|
|
222
222
|
alignItems: "center",
|
|
@@ -227,19 +227,19 @@ function Me({ config: e, ctx: n }) {
|
|
|
227
227
|
fontSize: 13,
|
|
228
228
|
fontWeight: 700
|
|
229
229
|
},
|
|
230
|
-
children: [o && /* @__PURE__ */
|
|
230
|
+
children: [o && /* @__PURE__ */ Y(t, {
|
|
231
231
|
name: o,
|
|
232
232
|
size: 14
|
|
233
|
-
}), /* @__PURE__ */
|
|
233
|
+
}), /* @__PURE__ */ Y("span", {
|
|
234
234
|
style: { overflowWrap: "anywhere" },
|
|
235
235
|
children: a
|
|
236
236
|
})]
|
|
237
|
-
}), /* @__PURE__ */
|
|
237
|
+
}), /* @__PURE__ */ Y("div", {
|
|
238
238
|
style: {
|
|
239
239
|
padding: 14,
|
|
240
240
|
minWidth: 0
|
|
241
241
|
},
|
|
242
|
-
children: /* @__PURE__ */
|
|
242
|
+
children: /* @__PURE__ */ Y(_n, {
|
|
243
243
|
node: r,
|
|
244
244
|
ctx: {
|
|
245
245
|
...n,
|
|
@@ -251,7 +251,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
251
251
|
})]
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
-
return /* @__PURE__ */
|
|
254
|
+
return /* @__PURE__ */ X("div", {
|
|
255
255
|
style: {
|
|
256
256
|
background: "var(--surface)",
|
|
257
257
|
border: "1px solid var(--border)",
|
|
@@ -260,7 +260,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
260
260
|
boxShadow: "var(--shadow-xs)",
|
|
261
261
|
flexShrink: 0
|
|
262
262
|
},
|
|
263
|
-
children: [/* @__PURE__ */
|
|
263
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
264
264
|
role: "tablist",
|
|
265
265
|
style: {
|
|
266
266
|
display: "flex",
|
|
@@ -272,7 +272,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
272
272
|
},
|
|
273
273
|
children: r.map((e, r) => {
|
|
274
274
|
let o = Ae(e, n), s = je(e, n), c = r === i;
|
|
275
|
-
return /* @__PURE__ */
|
|
275
|
+
return /* @__PURE__ */ X("button", {
|
|
276
276
|
role: "tab",
|
|
277
277
|
"aria-selected": c,
|
|
278
278
|
onClick: (e) => {
|
|
@@ -301,12 +301,12 @@ function Me({ config: e, ctx: n }) {
|
|
|
301
301
|
c || (e.currentTarget.style.color = "var(--text-3)");
|
|
302
302
|
},
|
|
303
303
|
children: [
|
|
304
|
-
s && /* @__PURE__ */
|
|
304
|
+
s && /* @__PURE__ */ Y(t, {
|
|
305
305
|
name: s,
|
|
306
306
|
size: 13
|
|
307
307
|
}),
|
|
308
308
|
o,
|
|
309
|
-
c && /* @__PURE__ */
|
|
309
|
+
c && /* @__PURE__ */ Y("span", { style: {
|
|
310
310
|
position: "absolute",
|
|
311
311
|
left: 4,
|
|
312
312
|
right: 4,
|
|
@@ -318,10 +318,10 @@ function Me({ config: e, ctx: n }) {
|
|
|
318
318
|
]
|
|
319
319
|
}, r);
|
|
320
320
|
})
|
|
321
|
-
}), /* @__PURE__ */
|
|
321
|
+
}), /* @__PURE__ */ Y("div", {
|
|
322
322
|
role: "tabpanel",
|
|
323
323
|
style: { padding: 14 },
|
|
324
|
-
children: /* @__PURE__ */
|
|
324
|
+
children: /* @__PURE__ */ Y(_n, {
|
|
325
325
|
node: r[i],
|
|
326
326
|
ctx: {
|
|
327
327
|
...n,
|
|
@@ -334,46 +334,46 @@ function Me({ config: e, ctx: n }) {
|
|
|
334
334
|
//#endregion
|
|
335
335
|
//#region src/components/detail-layout/SectionBlock.tsx
|
|
336
336
|
function Ne({ config: e, ctx: n }) {
|
|
337
|
-
let { name: r, items: i, collapsed:
|
|
337
|
+
let { name: r, items: i, collapsed: a = !1, columns: o, icon: s, badge: c, emphasis: l } = e, u = {
|
|
338
338
|
...n,
|
|
339
339
|
withinCard: !0,
|
|
340
|
-
...
|
|
341
|
-
},
|
|
342
|
-
name:
|
|
340
|
+
...o ? { columns: o } : null
|
|
341
|
+
}, d = s ? /* @__PURE__ */ Y(t, {
|
|
342
|
+
name: s,
|
|
343
343
|
size: 14
|
|
344
|
-
}) : void 0,
|
|
345
|
-
text:
|
|
346
|
-
tone:
|
|
347
|
-
dot:
|
|
344
|
+
}) : void 0, f = c ? {
|
|
345
|
+
text: b(c.text),
|
|
346
|
+
tone: c.tone,
|
|
347
|
+
dot: c.dot
|
|
348
348
|
} : void 0;
|
|
349
|
-
return /* @__PURE__ */
|
|
350
|
-
title:
|
|
351
|
-
defaultOpen: !
|
|
352
|
-
icon:
|
|
353
|
-
badge:
|
|
354
|
-
emphasis:
|
|
349
|
+
return /* @__PURE__ */ Y(R, {
|
|
350
|
+
title: b(r),
|
|
351
|
+
defaultOpen: !a,
|
|
352
|
+
icon: d,
|
|
353
|
+
badge: f,
|
|
354
|
+
emphasis: l,
|
|
355
355
|
headingLevel: n.withinCard ? 3 : 2,
|
|
356
|
-
children: /* @__PURE__ */
|
|
356
|
+
children: /* @__PURE__ */ Y(gn, {
|
|
357
357
|
nodes: i,
|
|
358
|
-
ctx:
|
|
358
|
+
ctx: u
|
|
359
359
|
})
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
362
|
//#endregion
|
|
363
363
|
//#region src/lib/child-config.ts
|
|
364
364
|
function Pe(e, t, n) {
|
|
365
|
-
let r = e.display, i =
|
|
365
|
+
let r = e.display, i = Z(n?.mode, r?.mode, "table"), a = i === "timeline" ? 50 : 20, o = {
|
|
366
366
|
entity: e.entity,
|
|
367
367
|
foreign_key: e.foreign_key,
|
|
368
|
-
name:
|
|
369
|
-
icon:
|
|
368
|
+
name: Z(n?.label, r?.name, Ie(t)),
|
|
369
|
+
icon: Z(n?.icon, r?.icon, t.display.icon) ?? "",
|
|
370
370
|
mode: i,
|
|
371
|
-
columns:
|
|
372
|
-
sort:
|
|
373
|
-
limit:
|
|
374
|
-
editable:
|
|
375
|
-
interaction:
|
|
376
|
-
}, s =
|
|
371
|
+
columns: Z(n?.columns, r?.columns, Re(t, e.foreign_key)),
|
|
372
|
+
sort: Z(n?.sort, r?.sort, Le(t)),
|
|
373
|
+
limit: Z(n?.limit, r?.limit, a),
|
|
374
|
+
editable: Z(n?.editable, r?.editable, !0),
|
|
375
|
+
interaction: Z(n?.interaction, r?.interaction, Fe(t))
|
|
376
|
+
}, s = Z(n?.position_field, r?.position_field, void 0);
|
|
377
377
|
s && (o.position_field = s, o.sort = s + ":asc");
|
|
378
378
|
let c = n?.timeline ?? r?.timeline;
|
|
379
379
|
o.mode === "timeline" ? o.timeline = ze(c ?? {}, t) : c && (o.timeline = c);
|
|
@@ -382,11 +382,11 @@ function Pe(e, t, n) {
|
|
|
382
382
|
let u = n?.quick_add ?? e.quick_add;
|
|
383
383
|
return u && (o.quick_add = u), o;
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function Z(e, t, n) {
|
|
386
386
|
return e ?? t ?? n;
|
|
387
387
|
}
|
|
388
388
|
function Fe(e) {
|
|
389
|
-
return
|
|
389
|
+
return f(e, "update") ? "inline_edit" : "readonly";
|
|
390
390
|
}
|
|
391
391
|
function Ie(e) {
|
|
392
392
|
return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
|
|
@@ -462,7 +462,7 @@ function We(e, ...t) {
|
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
function Ge(e) {
|
|
465
|
-
let t =
|
|
465
|
+
let t = y(e);
|
|
466
466
|
return t.length > 0 ? t[0] : void 0;
|
|
467
467
|
}
|
|
468
468
|
function Ke(e, t) {
|
|
@@ -470,17 +470,17 @@ function Ke(e, t) {
|
|
|
470
470
|
}
|
|
471
471
|
//#endregion
|
|
472
472
|
//#region src/lib/quick-add.ts
|
|
473
|
-
function qe(e, t,
|
|
474
|
-
let
|
|
473
|
+
function qe(e, t, r, i) {
|
|
474
|
+
let a = {
|
|
475
475
|
...t ?? {},
|
|
476
476
|
...e
|
|
477
477
|
};
|
|
478
|
-
if (Array.isArray(
|
|
479
|
-
let e = Array.isArray(
|
|
480
|
-
if (!e || e.length !==
|
|
481
|
-
for (let t = 0; t <
|
|
482
|
-
} else
|
|
483
|
-
return
|
|
478
|
+
if (Array.isArray(r)) {
|
|
479
|
+
let e = Array.isArray(i) ? i.map(String) : n(String(i), r.length);
|
|
480
|
+
if (!e || e.length !== r.length) throw Error("invalid composite parent id");
|
|
481
|
+
for (let t = 0; t < r.length; t++) a[r[t]] = e[t];
|
|
482
|
+
} else a[r] = Array.isArray(i) ? i[0] : i;
|
|
483
|
+
return a;
|
|
484
484
|
}
|
|
485
485
|
function Je(e, t) {
|
|
486
486
|
for (let n of t) {
|
|
@@ -492,15 +492,15 @@ function Je(e, t) {
|
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region src/components/detail-layout/useQuickAdd.ts
|
|
494
494
|
function Ye(e, t, n, r) {
|
|
495
|
-
let [i, a] =
|
|
495
|
+
let [i, a] = q(() => {
|
|
496
496
|
let t = e.quick_add, n = r.entities[e.entity], i = {};
|
|
497
|
-
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] =
|
|
497
|
+
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = S()) : i[e] = t.defaults[e];
|
|
498
498
|
return i;
|
|
499
499
|
}), o = Se(), { mutate: s, isPending: c, error: l, reset: u } = xe({
|
|
500
|
-
mutationFn: (t) =>
|
|
500
|
+
mutationFn: (t) => p(e.entity, t),
|
|
501
501
|
onMutate: async (r) => {
|
|
502
|
-
let i = Array.isArray(n) ?
|
|
503
|
-
|
|
502
|
+
let i = Array.isArray(n) ? g(n.map(String)) : n, a = [
|
|
503
|
+
E,
|
|
504
504
|
t,
|
|
505
505
|
i,
|
|
506
506
|
e.entity
|
|
@@ -531,25 +531,25 @@ function Ye(e, t, n, r) {
|
|
|
531
531
|
},
|
|
532
532
|
onSuccess: () => {
|
|
533
533
|
let t = e.quick_add, n = r.entities[e.entity], i = {};
|
|
534
|
-
if (t?.fields) for (let e of t.fields) i[e] = t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ?
|
|
534
|
+
if (t?.fields) for (let e of t.fields) i[e] = t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? S() : "" : t.defaults[e];
|
|
535
535
|
a(i);
|
|
536
536
|
},
|
|
537
537
|
onSettled: () => {
|
|
538
|
-
let r = Array.isArray(n) ?
|
|
538
|
+
let r = Array.isArray(n) ? g(n.map(String)) : n;
|
|
539
539
|
o.invalidateQueries({ queryKey: [
|
|
540
|
-
|
|
540
|
+
E,
|
|
541
541
|
t,
|
|
542
542
|
r,
|
|
543
543
|
e.entity
|
|
544
544
|
] });
|
|
545
545
|
}
|
|
546
|
-
}), d = e.quick_add,
|
|
547
|
-
function
|
|
546
|
+
}), d = e.quick_add, f = r.entities[e.entity], m = Je(i, d?.fields.filter((e) => f?.fields.get(e)?.required) ?? []);
|
|
547
|
+
function h(t) {
|
|
548
548
|
if (t.preventDefault(), !d) return;
|
|
549
549
|
let r = qe(i, d.defaults, e.foreign_key, n);
|
|
550
550
|
s(r);
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function _(e, t) {
|
|
553
553
|
l && u(), a((n) => ({
|
|
554
554
|
...n,
|
|
555
555
|
[e]: t
|
|
@@ -558,41 +558,41 @@ function Ye(e, t, n, r) {
|
|
|
558
558
|
return {
|
|
559
559
|
values: i,
|
|
560
560
|
quickAdd: d,
|
|
561
|
-
childEntity:
|
|
561
|
+
childEntity: f,
|
|
562
562
|
isPending: c,
|
|
563
563
|
error: l,
|
|
564
|
-
isReady:
|
|
565
|
-
handleSubmit:
|
|
566
|
-
handleFieldChange:
|
|
564
|
+
isReady: m,
|
|
565
|
+
handleSubmit: h,
|
|
566
|
+
handleFieldChange: _
|
|
567
567
|
};
|
|
568
568
|
}
|
|
569
569
|
//#endregion
|
|
570
570
|
//#region src/components/detail-layout/QuickAddForm.tsx
|
|
571
|
-
function Xe({ config: t, parentEntity: n, parentId:
|
|
572
|
-
let { values:
|
|
573
|
-
return !
|
|
574
|
-
onSubmit:
|
|
571
|
+
function Xe({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
572
|
+
let { values: a, quickAdd: o, childEntity: c, isPending: d, error: f, isReady: p, handleSubmit: m, handleFieldChange: h } = Ye(t, n, r, i), g = k(), _ = s(), v = ve();
|
|
573
|
+
return !o || o.fields.length === 0 || !c ? null : /* @__PURE__ */ X("form", {
|
|
574
|
+
onSubmit: m,
|
|
575
575
|
style: {
|
|
576
576
|
display: "flex",
|
|
577
|
-
flexDirection:
|
|
577
|
+
flexDirection: _.isPhone ? "column" : "row",
|
|
578
578
|
alignItems: "flex-end",
|
|
579
579
|
gap: 8,
|
|
580
580
|
padding: "8px 0",
|
|
581
581
|
borderBottom: "1px solid var(--divider)"
|
|
582
582
|
},
|
|
583
583
|
children: [
|
|
584
|
-
|
|
584
|
+
o.fields.map((e) => {
|
|
585
585
|
let n = c.fields.get(e);
|
|
586
586
|
if (!n) return null;
|
|
587
|
-
let r = `${
|
|
588
|
-
return /* @__PURE__ */
|
|
587
|
+
let r = `${v}-quick-add-${t.entity}-${e}`, o = `${r}-label`;
|
|
588
|
+
return /* @__PURE__ */ X("div", {
|
|
589
589
|
style: {
|
|
590
590
|
flex: 1,
|
|
591
591
|
minWidth: 0,
|
|
592
|
-
width:
|
|
592
|
+
width: _.isPhone ? "100%" : void 0
|
|
593
593
|
},
|
|
594
|
-
children: [/* @__PURE__ */
|
|
595
|
-
id:
|
|
594
|
+
children: [/* @__PURE__ */ Y("label", {
|
|
595
|
+
id: o,
|
|
596
596
|
htmlFor: r,
|
|
597
597
|
style: {
|
|
598
598
|
fontSize: 11,
|
|
@@ -601,37 +601,37 @@ function Xe({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
601
601
|
display: "block",
|
|
602
602
|
fontWeight: 500
|
|
603
603
|
},
|
|
604
|
-
children:
|
|
605
|
-
}),
|
|
604
|
+
children: u(n, e, i.entities)
|
|
605
|
+
}), N({
|
|
606
606
|
field: n,
|
|
607
607
|
fieldName: e,
|
|
608
|
-
value:
|
|
608
|
+
value: a[e] ?? "",
|
|
609
609
|
mode: "edit",
|
|
610
|
-
onChange: (t) =>
|
|
611
|
-
record:
|
|
610
|
+
onChange: (t) => h(e, t),
|
|
611
|
+
record: a,
|
|
612
612
|
fieldId: r,
|
|
613
|
-
labelId:
|
|
614
|
-
locale:
|
|
613
|
+
labelId: o,
|
|
614
|
+
locale: g
|
|
615
615
|
})]
|
|
616
616
|
}, e);
|
|
617
617
|
}),
|
|
618
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ Y(l, {
|
|
619
619
|
type: "submit",
|
|
620
620
|
kind: "primary",
|
|
621
|
-
size:
|
|
622
|
-
icon: /* @__PURE__ */
|
|
623
|
-
disabled:
|
|
624
|
-
style:
|
|
621
|
+
size: _.isPhone ? "md" : "sm",
|
|
622
|
+
icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
|
|
623
|
+
disabled: d || !p,
|
|
624
|
+
style: _.isPhone ? { alignSelf: "flex-end" } : void 0,
|
|
625
625
|
children: "Add"
|
|
626
626
|
}),
|
|
627
|
-
|
|
627
|
+
f != null && /* @__PURE__ */ Y("span", {
|
|
628
628
|
style: {
|
|
629
629
|
fontSize: 11,
|
|
630
630
|
color: "var(--danger)",
|
|
631
631
|
alignSelf: "flex-end",
|
|
632
632
|
marginBottom: 4
|
|
633
633
|
},
|
|
634
|
-
children:
|
|
634
|
+
children: f.message
|
|
635
635
|
})
|
|
636
636
|
]
|
|
637
637
|
});
|
|
@@ -645,8 +645,8 @@ function Qe(e) {
|
|
|
645
645
|
return Math.min(se, Math.max(60, Math.round(e)));
|
|
646
646
|
}
|
|
647
647
|
function $e(e) {
|
|
648
|
-
let { widths: t, setWidths: n, resetWidths: r } =
|
|
649
|
-
|
|
648
|
+
let { widths: t, setWidths: n, resetWidths: r } = ne(e), [i, a] = q({}), o = K(null);
|
|
649
|
+
W(() => {
|
|
650
650
|
let e = (e) => {
|
|
651
651
|
let t = o.current;
|
|
652
652
|
if (!t) return;
|
|
@@ -660,7 +660,7 @@ function $e(e) {
|
|
|
660
660
|
window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", t);
|
|
661
661
|
};
|
|
662
662
|
}, [n]);
|
|
663
|
-
let s =
|
|
663
|
+
let s = U((e, n) => {
|
|
664
664
|
n.preventDefault(), n.stopPropagation();
|
|
665
665
|
let r = n.currentTarget.closest("th")?.getBoundingClientRect().width, i = t[e] ?? (r && r > 0 ? r : 150);
|
|
666
666
|
o.current = {
|
|
@@ -671,7 +671,7 @@ function $e(e) {
|
|
|
671
671
|
};
|
|
672
672
|
}, [t]);
|
|
673
673
|
return {
|
|
674
|
-
headerStyle:
|
|
674
|
+
headerStyle: U((e, n) => {
|
|
675
675
|
let r = i[e] ?? t[e];
|
|
676
676
|
return r == null ? {
|
|
677
677
|
...n,
|
|
@@ -684,7 +684,7 @@ function $e(e) {
|
|
|
684
684
|
maxWidth: r
|
|
685
685
|
};
|
|
686
686
|
}, [i, t]),
|
|
687
|
-
cellStyle:
|
|
687
|
+
cellStyle: U((e, n) => {
|
|
688
688
|
let r = i[e] ?? t[e];
|
|
689
689
|
return r == null ? n : {
|
|
690
690
|
...n,
|
|
@@ -701,7 +701,7 @@ function $e(e) {
|
|
|
701
701
|
};
|
|
702
702
|
}
|
|
703
703
|
function et({ colId: e, onMouseDown: t }) {
|
|
704
|
-
return /* @__PURE__ */
|
|
704
|
+
return /* @__PURE__ */ Y("span", {
|
|
705
705
|
"data-testid": "col-resize-handle",
|
|
706
706
|
"aria-hidden": "true",
|
|
707
707
|
onMouseDown: (n) => t(e, n),
|
|
@@ -717,7 +717,7 @@ function et({ colId: e, onMouseDown: t }) {
|
|
|
717
717
|
cursor: "col-resize",
|
|
718
718
|
userSelect: "none"
|
|
719
719
|
},
|
|
720
|
-
children: /* @__PURE__ */
|
|
720
|
+
children: /* @__PURE__ */ Y("span", { style: {
|
|
721
721
|
width: 2,
|
|
722
722
|
height: "55%",
|
|
723
723
|
alignSelf: "center",
|
|
@@ -728,34 +728,34 @@ function et({ colId: e, onMouseDown: t }) {
|
|
|
728
728
|
}
|
|
729
729
|
//#endregion
|
|
730
730
|
//#region src/components/detail-layout/ChildrenTable.tsx
|
|
731
|
-
function tt({ config: t, parentEntity:
|
|
732
|
-
let s = o.entities[t.entity],
|
|
733
|
-
|
|
734
|
-
let
|
|
731
|
+
function tt({ config: t, parentEntity: n, parentId: i, schema: o }) {
|
|
732
|
+
let s = o.entities[t.entity], l = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, d = $e(Ze(n, t.entity, l)), f = k(), p = x((e) => e.degradedEntities), { data: m, isLoading: g, isError: _, refetch: v } = r(n, i, t.entity, t.foreign_key, t.sort, t.limit), { refreshing: y, refresh: b } = ie(v), S = m?.data ?? [], C = m?.$refs, T = K(C);
|
|
733
|
+
T.current = C;
|
|
734
|
+
let E = t.columns, O = t.interaction === "navigate", A = E[0], j = O && s ? M(void 0, s, o.screens) : null, N = s ? Ge(s) : void 0, P = G(() => {
|
|
735
735
|
let e = /* @__PURE__ */ new Map();
|
|
736
736
|
if (!s) return e;
|
|
737
|
-
for (let t of
|
|
737
|
+
for (let t of E) {
|
|
738
738
|
let n = s.fields.get(t);
|
|
739
|
-
n && e.set(t,
|
|
739
|
+
n && e.set(t, w({
|
|
740
740
|
field: n,
|
|
741
741
|
fieldName: t,
|
|
742
742
|
surface: "list",
|
|
743
743
|
entity: s,
|
|
744
744
|
entities: o.entities,
|
|
745
745
|
screens: o.screens,
|
|
746
|
-
refs: () =>
|
|
746
|
+
refs: () => T.current,
|
|
747
747
|
locale: f
|
|
748
748
|
}));
|
|
749
749
|
}
|
|
750
750
|
return e;
|
|
751
751
|
}, [
|
|
752
752
|
s,
|
|
753
|
-
|
|
753
|
+
E,
|
|
754
754
|
o.entities,
|
|
755
755
|
o.screens,
|
|
756
756
|
f
|
|
757
757
|
]);
|
|
758
|
-
if (!s) return /* @__PURE__ */
|
|
758
|
+
if (!s) return /* @__PURE__ */ Y("div", {
|
|
759
759
|
style: {
|
|
760
760
|
fontSize: 12.5,
|
|
761
761
|
color: "var(--text-3)",
|
|
@@ -763,12 +763,12 @@ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
|
|
|
763
763
|
},
|
|
764
764
|
children: "Entity not found."
|
|
765
765
|
});
|
|
766
|
-
let
|
|
766
|
+
let F = /* @__PURE__ */ Y(Xe, {
|
|
767
767
|
config: t,
|
|
768
|
-
parentEntity:
|
|
769
|
-
parentId:
|
|
768
|
+
parentEntity: n,
|
|
769
|
+
parentId: i,
|
|
770
770
|
schema: o
|
|
771
|
-
}),
|
|
771
|
+
}), I = ee(s.realtime, p, t.entity), L = /* @__PURE__ */ X("div", {
|
|
772
772
|
style: {
|
|
773
773
|
display: "flex",
|
|
774
774
|
alignItems: "center",
|
|
@@ -777,41 +777,39 @@ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
|
|
|
777
777
|
justifyContent: "flex-end"
|
|
778
778
|
},
|
|
779
779
|
children: [
|
|
780
|
-
|
|
781
|
-
icon: /* @__PURE__ */
|
|
780
|
+
d.hasWidths && /* @__PURE__ */ Y(c, {
|
|
781
|
+
icon: /* @__PURE__ */ Y(e.columns, { size: 13 }),
|
|
782
782
|
title: "Reset column widths (this device)",
|
|
783
783
|
size: 24,
|
|
784
|
-
onClick:
|
|
784
|
+
onClick: d.resetWidths
|
|
785
785
|
}),
|
|
786
|
-
|
|
786
|
+
I && /* @__PURE__ */ Y("span", {
|
|
787
787
|
"data-testid": "children-live-indicator",
|
|
788
788
|
title: "This table updates automatically in realtime.",
|
|
789
|
-
children: /* @__PURE__ */
|
|
789
|
+
children: /* @__PURE__ */ Y(h, {
|
|
790
790
|
tone: "emerald",
|
|
791
791
|
size: "xs",
|
|
792
792
|
dot: !0,
|
|
793
793
|
children: "Live"
|
|
794
794
|
})
|
|
795
795
|
}),
|
|
796
|
-
/* @__PURE__ */
|
|
797
|
-
icon:
|
|
796
|
+
/* @__PURE__ */ Y(c, {
|
|
797
|
+
icon: y ? /* @__PURE__ */ Y("span", {
|
|
798
798
|
"data-testid": "children-refresh-spinner",
|
|
799
799
|
style: { display: "inline-flex" },
|
|
800
|
-
children: /* @__PURE__ */
|
|
801
|
-
}) : /* @__PURE__ */
|
|
800
|
+
children: /* @__PURE__ */ Y(a, { size: 13 })
|
|
801
|
+
}) : /* @__PURE__ */ Y(e.refresh, { size: 13 }),
|
|
802
802
|
title: "Refresh",
|
|
803
803
|
size: 24,
|
|
804
|
-
disabled:
|
|
805
|
-
onClick:
|
|
806
|
-
y();
|
|
807
|
-
}
|
|
804
|
+
disabled: y,
|
|
805
|
+
onClick: b
|
|
808
806
|
})
|
|
809
807
|
]
|
|
810
808
|
});
|
|
811
|
-
return
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
/* @__PURE__ */
|
|
809
|
+
return _ ? /* @__PURE__ */ X("div", { children: [
|
|
810
|
+
F,
|
|
811
|
+
L,
|
|
812
|
+
/* @__PURE__ */ Y("div", {
|
|
815
813
|
style: {
|
|
816
814
|
fontSize: 12.5,
|
|
817
815
|
color: "var(--danger)",
|
|
@@ -819,10 +817,10 @@ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
|
|
|
819
817
|
},
|
|
820
818
|
children: "Failed to load. Try again."
|
|
821
819
|
})
|
|
822
|
-
] }) :
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
/* @__PURE__ */
|
|
820
|
+
] }) : g ? /* @__PURE__ */ X("div", { children: [
|
|
821
|
+
F,
|
|
822
|
+
L,
|
|
823
|
+
/* @__PURE__ */ Y("div", {
|
|
826
824
|
style: {
|
|
827
825
|
display: "flex",
|
|
828
826
|
flexDirection: "column",
|
|
@@ -833,16 +831,16 @@ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
|
|
|
833
831
|
0,
|
|
834
832
|
1,
|
|
835
833
|
2
|
|
836
|
-
].map((e) => /* @__PURE__ */
|
|
834
|
+
].map((e) => /* @__PURE__ */ Y("div", { style: {
|
|
837
835
|
height: 32,
|
|
838
836
|
background: "var(--surface-3)",
|
|
839
837
|
borderRadius: 4
|
|
840
838
|
} }, e))
|
|
841
839
|
})
|
|
842
|
-
] }) :
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
/* @__PURE__ */
|
|
840
|
+
] }) : S.length === 0 ? /* @__PURE__ */ X("div", { children: [
|
|
841
|
+
F,
|
|
842
|
+
L,
|
|
843
|
+
/* @__PURE__ */ Y("div", {
|
|
846
844
|
style: {
|
|
847
845
|
fontSize: 12.5,
|
|
848
846
|
color: "var(--text-3)",
|
|
@@ -850,30 +848,30 @@ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
|
|
|
850
848
|
},
|
|
851
849
|
children: "No records yet."
|
|
852
850
|
})
|
|
853
|
-
] }) : /* @__PURE__ */
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
/* @__PURE__ */
|
|
851
|
+
] }) : /* @__PURE__ */ X("div", { children: [
|
|
852
|
+
F,
|
|
853
|
+
L,
|
|
854
|
+
/* @__PURE__ */ Y("div", {
|
|
857
855
|
style: { overflowX: "auto" },
|
|
858
|
-
children: /* @__PURE__ */
|
|
856
|
+
children: /* @__PURE__ */ X("table", {
|
|
859
857
|
style: fe,
|
|
860
|
-
children: [/* @__PURE__ */
|
|
858
|
+
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: E.map((e) => {
|
|
861
859
|
let t = s.fields.get(e);
|
|
862
|
-
return /* @__PURE__ */
|
|
863
|
-
style:
|
|
864
|
-
children: [t ?
|
|
860
|
+
return /* @__PURE__ */ X("th", {
|
|
861
|
+
style: d.headerStyle(e, de),
|
|
862
|
+
children: [t ? u(t, e, o.entities) : e, /* @__PURE__ */ Y(et, {
|
|
865
863
|
colId: e,
|
|
866
|
-
onMouseDown:
|
|
864
|
+
onMouseDown: d.onHandleMouseDown
|
|
867
865
|
})]
|
|
868
866
|
}, e);
|
|
869
|
-
}) }) }), /* @__PURE__ */
|
|
870
|
-
let n =
|
|
871
|
-
return /* @__PURE__ */
|
|
872
|
-
let n = t ===
|
|
873
|
-
return /* @__PURE__ */
|
|
867
|
+
}) }) }), /* @__PURE__ */ Y("tbody", { children: S.map((e, t) => {
|
|
868
|
+
let n = N ? D(e[N]) : "", r = O && j && n ? j.replace(/:\w+/, n) : void 0;
|
|
869
|
+
return /* @__PURE__ */ Y("tr", { children: E.map((t) => {
|
|
870
|
+
let n = t === A, i = P.get(t), a = i ? i(e[t], e) : D(e[t]);
|
|
871
|
+
return /* @__PURE__ */ Y("td", {
|
|
874
872
|
title: typeof a == "string" ? a : void 0,
|
|
875
|
-
style:
|
|
876
|
-
children: n && r ? /* @__PURE__ */
|
|
873
|
+
style: d.cellStyle(t, pe),
|
|
874
|
+
children: n && r ? /* @__PURE__ */ Y("a", {
|
|
877
875
|
href: r,
|
|
878
876
|
style: {
|
|
879
877
|
color: "var(--accent)",
|
|
@@ -885,7 +883,7 @@ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
|
|
|
885
883
|
children: a
|
|
886
884
|
}) : a
|
|
887
885
|
}, t);
|
|
888
|
-
}) },
|
|
886
|
+
}) }, D(e.id ?? t));
|
|
889
887
|
}) })]
|
|
890
888
|
})
|
|
891
889
|
})
|
|
@@ -893,9 +891,9 @@ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
|
|
|
893
891
|
}
|
|
894
892
|
//#endregion
|
|
895
893
|
//#region src/components/detail-layout/ChildrenList.tsx
|
|
896
|
-
function nt({ config: e, parentEntity: t, parentId: n, schema:
|
|
897
|
-
let
|
|
898
|
-
if (!
|
|
894
|
+
function nt({ config: e, parentEntity: t, parentId: n, schema: a }) {
|
|
895
|
+
let o = a.entities[e.entity], s = k(), { data: c, isLoading: l, isError: u } = r(t, n, e.entity, e.foreign_key, e.sort, e.limit), d = c?.data ?? [], f = c?.$refs, p = e.columns;
|
|
896
|
+
if (!o) return /* @__PURE__ */ Y("div", {
|
|
899
897
|
style: {
|
|
900
898
|
fontSize: 12.5,
|
|
901
899
|
color: "var(--text-3)",
|
|
@@ -903,13 +901,13 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
903
901
|
},
|
|
904
902
|
children: "Entity not found."
|
|
905
903
|
});
|
|
906
|
-
let
|
|
904
|
+
let m = /* @__PURE__ */ Y(Xe, {
|
|
907
905
|
config: e,
|
|
908
906
|
parentEntity: t,
|
|
909
907
|
parentId: n,
|
|
910
|
-
schema:
|
|
908
|
+
schema: a
|
|
911
909
|
});
|
|
912
|
-
if (
|
|
910
|
+
if (u) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ Y("div", {
|
|
913
911
|
style: {
|
|
914
912
|
fontSize: 12.5,
|
|
915
913
|
color: "var(--danger)",
|
|
@@ -917,7 +915,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
917
915
|
},
|
|
918
916
|
children: "Failed to load. Try again."
|
|
919
917
|
})] });
|
|
920
|
-
if (
|
|
918
|
+
if (l) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ X("div", {
|
|
921
919
|
style: {
|
|
922
920
|
display: "flex",
|
|
923
921
|
flexDirection: "column",
|
|
@@ -925,17 +923,17 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
925
923
|
padding: "8px 0"
|
|
926
924
|
},
|
|
927
925
|
children: [
|
|
928
|
-
/* @__PURE__ */
|
|
926
|
+
/* @__PURE__ */ Y("div", { style: {
|
|
929
927
|
height: 22,
|
|
930
928
|
background: "var(--surface-3)",
|
|
931
929
|
borderRadius: 4
|
|
932
930
|
} }),
|
|
933
|
-
/* @__PURE__ */
|
|
931
|
+
/* @__PURE__ */ Y("div", { style: {
|
|
934
932
|
height: 22,
|
|
935
933
|
background: "var(--surface-3)",
|
|
936
934
|
borderRadius: 4
|
|
937
935
|
} }),
|
|
938
|
-
/* @__PURE__ */
|
|
936
|
+
/* @__PURE__ */ Y("div", { style: {
|
|
939
937
|
height: 22,
|
|
940
938
|
background: "var(--surface-3)",
|
|
941
939
|
borderRadius: 4,
|
|
@@ -943,7 +941,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
943
941
|
} })
|
|
944
942
|
]
|
|
945
943
|
})] });
|
|
946
|
-
if (
|
|
944
|
+
if (d.length === 0) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ Y("div", {
|
|
947
945
|
style: {
|
|
948
946
|
fontSize: 12.5,
|
|
949
947
|
color: "var(--text-3)",
|
|
@@ -951,15 +949,15 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
951
949
|
},
|
|
952
950
|
children: "No records yet."
|
|
953
951
|
})] });
|
|
954
|
-
let
|
|
955
|
-
return /* @__PURE__ */
|
|
952
|
+
let h = p.length > 0 ? o.display.display_field ?? p[0] : o.display.display_field;
|
|
953
|
+
return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ Y("div", {
|
|
956
954
|
style: {
|
|
957
955
|
display: "flex",
|
|
958
956
|
flexDirection: "column"
|
|
959
957
|
},
|
|
960
|
-
children:
|
|
961
|
-
let n = typeof e.$display == "string" ? e[
|
|
962
|
-
return /* @__PURE__ */
|
|
958
|
+
children: d.map((e, t) => {
|
|
959
|
+
let n = typeof e.$display == "string" ? e[i] : "";
|
|
960
|
+
return /* @__PURE__ */ Y("div", {
|
|
963
961
|
style: {
|
|
964
962
|
display: "flex",
|
|
965
963
|
alignItems: "center",
|
|
@@ -967,30 +965,30 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
967
965
|
padding: "8px 4px",
|
|
968
966
|
borderBottom: "1px solid var(--divider)"
|
|
969
967
|
},
|
|
970
|
-
children: /* @__PURE__ */
|
|
968
|
+
children: /* @__PURE__ */ X("div", {
|
|
971
969
|
style: {
|
|
972
970
|
flex: 1,
|
|
973
971
|
minWidth: 0
|
|
974
972
|
},
|
|
975
|
-
children: [/* @__PURE__ */
|
|
973
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
976
974
|
style: {
|
|
977
975
|
fontSize: 12.5,
|
|
978
976
|
overflow: "hidden",
|
|
979
977
|
textOverflow: "ellipsis",
|
|
980
978
|
whiteSpace: "nowrap"
|
|
981
979
|
},
|
|
982
|
-
children: n || (
|
|
983
|
-
field:
|
|
984
|
-
fieldName:
|
|
985
|
-
value: e[
|
|
980
|
+
children: n || (h && o.fields.get(h) ? N({
|
|
981
|
+
field: o.fields.get(h),
|
|
982
|
+
fieldName: h,
|
|
983
|
+
value: e[h],
|
|
986
984
|
mode: "display",
|
|
987
985
|
record: e,
|
|
988
|
-
refs:
|
|
989
|
-
locale:
|
|
990
|
-
}) :
|
|
991
|
-
}),
|
|
992
|
-
let t =
|
|
993
|
-
return t.length === 0 ? null : /* @__PURE__ */
|
|
986
|
+
refs: f,
|
|
987
|
+
locale: s
|
|
988
|
+
}) : h && e[h] != null ? D(e[h]) : null)
|
|
989
|
+
}), p.length > 1 && (() => {
|
|
990
|
+
let t = p.slice(1, 3).filter((t) => e[t] != null);
|
|
991
|
+
return t.length === 0 ? null : /* @__PURE__ */ Y("div", {
|
|
994
992
|
style: {
|
|
995
993
|
fontSize: 11.5,
|
|
996
994
|
color: "var(--text-3)",
|
|
@@ -998,27 +996,27 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
998
996
|
textOverflow: "ellipsis",
|
|
999
997
|
whiteSpace: "nowrap"
|
|
1000
998
|
},
|
|
1001
|
-
children: t.map((t, n) => /* @__PURE__ */
|
|
1002
|
-
field:
|
|
999
|
+
children: t.map((t, n) => /* @__PURE__ */ X("span", { children: [n > 0 && " · ", o.fields.get(t) ? N({
|
|
1000
|
+
field: o.fields.get(t),
|
|
1003
1001
|
fieldName: t,
|
|
1004
1002
|
value: e[t],
|
|
1005
1003
|
mode: "display",
|
|
1006
1004
|
record: e,
|
|
1007
|
-
refs:
|
|
1008
|
-
locale:
|
|
1005
|
+
refs: f,
|
|
1006
|
+
locale: s
|
|
1009
1007
|
}) : String(e[t])] }, t))
|
|
1010
1008
|
});
|
|
1011
1009
|
})()]
|
|
1012
1010
|
})
|
|
1013
|
-
},
|
|
1011
|
+
}, D(e.id ?? t));
|
|
1014
1012
|
})
|
|
1015
1013
|
})] });
|
|
1016
1014
|
}
|
|
1017
1015
|
//#endregion
|
|
1018
1016
|
//#region src/components/detail-layout/ChildrenCards.tsx
|
|
1019
1017
|
function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
1020
|
-
let a = i.entities[e.entity], o =
|
|
1021
|
-
if (!a) return /* @__PURE__ */
|
|
1018
|
+
let a = i.entities[e.entity], o = k(), { data: s, isLoading: c, isError: l } = r(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], d = s?.$refs, f = e.columns, p = e.cards, m = p?.header_field ?? f[0], g = p?.badge_field, _ = p?.columns_count ?? 3;
|
|
1019
|
+
if (!a) return /* @__PURE__ */ Y("div", {
|
|
1022
1020
|
style: {
|
|
1023
1021
|
fontSize: 12.5,
|
|
1024
1022
|
color: "var(--text-3)",
|
|
@@ -1026,17 +1024,17 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1026
1024
|
},
|
|
1027
1025
|
children: "Entity not found."
|
|
1028
1026
|
});
|
|
1029
|
-
let
|
|
1027
|
+
let v = {
|
|
1030
1028
|
display: "grid",
|
|
1031
|
-
gridTemplateColumns: `repeat(auto-fill, minmax(${
|
|
1029
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${_ >= 4 ? 180 : 240}px, 1fr))`,
|
|
1032
1030
|
gap: 12
|
|
1033
|
-
},
|
|
1031
|
+
}, y = /* @__PURE__ */ Y(Xe, {
|
|
1034
1032
|
config: e,
|
|
1035
1033
|
parentEntity: t,
|
|
1036
1034
|
parentId: n,
|
|
1037
1035
|
schema: i
|
|
1038
1036
|
});
|
|
1039
|
-
if (l) return /* @__PURE__ */
|
|
1037
|
+
if (l) return /* @__PURE__ */ X("div", { children: [y, /* @__PURE__ */ Y("div", {
|
|
1040
1038
|
style: {
|
|
1041
1039
|
fontSize: 12.5,
|
|
1042
1040
|
color: "var(--danger)",
|
|
@@ -1044,19 +1042,19 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1044
1042
|
},
|
|
1045
1043
|
children: "Failed to load. Try again."
|
|
1046
1044
|
})] });
|
|
1047
|
-
if (c) return /* @__PURE__ */
|
|
1048
|
-
style:
|
|
1045
|
+
if (c) return /* @__PURE__ */ X("div", { children: [y, /* @__PURE__ */ Y("div", {
|
|
1046
|
+
style: v,
|
|
1049
1047
|
children: [
|
|
1050
1048
|
0,
|
|
1051
1049
|
1,
|
|
1052
1050
|
2
|
|
1053
|
-
].map((e) => /* @__PURE__ */
|
|
1051
|
+
].map((e) => /* @__PURE__ */ Y("div", { style: {
|
|
1054
1052
|
height: 96,
|
|
1055
1053
|
background: "var(--surface-3)",
|
|
1056
1054
|
borderRadius: 10
|
|
1057
1055
|
} }, e))
|
|
1058
1056
|
})] });
|
|
1059
|
-
if (u.length === 0) return /* @__PURE__ */
|
|
1057
|
+
if (u.length === 0) return /* @__PURE__ */ X("div", { children: [y, /* @__PURE__ */ Y("div", {
|
|
1060
1058
|
style: {
|
|
1061
1059
|
fontSize: 12.5,
|
|
1062
1060
|
color: "var(--text-3)",
|
|
@@ -1064,26 +1062,26 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1064
1062
|
},
|
|
1065
1063
|
children: "No records yet."
|
|
1066
1064
|
})] });
|
|
1067
|
-
let
|
|
1068
|
-
return /* @__PURE__ */
|
|
1069
|
-
style:
|
|
1070
|
-
children: u.map((t, n) => /* @__PURE__ */
|
|
1065
|
+
let b = f.filter((e) => e !== m && e !== g);
|
|
1066
|
+
return /* @__PURE__ */ X("div", { children: [y, /* @__PURE__ */ Y("div", {
|
|
1067
|
+
style: v,
|
|
1068
|
+
children: u.map((t, n) => /* @__PURE__ */ X("div", {
|
|
1071
1069
|
style: {
|
|
1072
1070
|
background: "var(--surface)",
|
|
1073
1071
|
border: "1px solid var(--border)",
|
|
1074
1072
|
borderRadius: 10,
|
|
1075
1073
|
overflow: "hidden"
|
|
1076
1074
|
},
|
|
1077
|
-
children: [/* @__PURE__ */
|
|
1075
|
+
children: [/* @__PURE__ */ X("div", {
|
|
1078
1076
|
style: {
|
|
1079
1077
|
padding: "10px 14px",
|
|
1080
1078
|
display: "flex",
|
|
1081
1079
|
alignItems: "center",
|
|
1082
1080
|
justifyContent: "space-between",
|
|
1083
1081
|
gap: 8,
|
|
1084
|
-
borderBottom:
|
|
1082
|
+
borderBottom: b.length > 0 ? "1px solid var(--divider)" : "none"
|
|
1085
1083
|
},
|
|
1086
|
-
children: [/* @__PURE__ */
|
|
1084
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
1087
1085
|
style: {
|
|
1088
1086
|
fontSize: 12.5,
|
|
1089
1087
|
fontWeight: 600,
|
|
@@ -1091,7 +1089,7 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1091
1089
|
textOverflow: "ellipsis",
|
|
1092
1090
|
whiteSpace: "nowrap"
|
|
1093
1091
|
},
|
|
1094
|
-
children: m && a.fields.get(m) ?
|
|
1092
|
+
children: m && a.fields.get(m) ? N({
|
|
1095
1093
|
field: a.fields.get(m),
|
|
1096
1094
|
fieldName: m,
|
|
1097
1095
|
value: t[m],
|
|
@@ -1100,48 +1098,48 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1100
1098
|
refs: d,
|
|
1101
1099
|
locale: o
|
|
1102
1100
|
}) : `Record ${n + 1}`
|
|
1103
|
-
}),
|
|
1101
|
+
}), g && t[g] != null && /* @__PURE__ */ Y(h, {
|
|
1104
1102
|
tone: "slate",
|
|
1105
1103
|
size: "xs",
|
|
1106
|
-
children: a.fields.get(
|
|
1107
|
-
field: a.fields.get(
|
|
1108
|
-
fieldName:
|
|
1109
|
-
value: t[
|
|
1104
|
+
children: a.fields.get(g) ? N({
|
|
1105
|
+
field: a.fields.get(g),
|
|
1106
|
+
fieldName: g,
|
|
1107
|
+
value: t[g],
|
|
1110
1108
|
mode: "display",
|
|
1111
1109
|
record: t,
|
|
1112
1110
|
refs: d,
|
|
1113
1111
|
locale: o
|
|
1114
|
-
}) :
|
|
1112
|
+
}) : D(t[g])
|
|
1115
1113
|
})]
|
|
1116
|
-
}),
|
|
1114
|
+
}), b.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1117
1115
|
style: {
|
|
1118
1116
|
padding: "10px 14px",
|
|
1119
1117
|
display: "flex",
|
|
1120
1118
|
flexDirection: "column",
|
|
1121
1119
|
gap: 4
|
|
1122
1120
|
},
|
|
1123
|
-
children:
|
|
1121
|
+
children: b.slice(0, 4).map((n) => {
|
|
1124
1122
|
let r = a.fields.get(n);
|
|
1125
|
-
return r ? /* @__PURE__ */
|
|
1123
|
+
return r ? /* @__PURE__ */ X("div", {
|
|
1126
1124
|
style: {
|
|
1127
1125
|
display: "flex",
|
|
1128
1126
|
alignItems: "baseline",
|
|
1129
1127
|
gap: 8,
|
|
1130
1128
|
fontSize: 11.5
|
|
1131
1129
|
},
|
|
1132
|
-
children: [/* @__PURE__ */
|
|
1130
|
+
children: [/* @__PURE__ */ X("span", {
|
|
1133
1131
|
style: {
|
|
1134
1132
|
color: "var(--text-3)",
|
|
1135
1133
|
flexShrink: 0
|
|
1136
1134
|
},
|
|
1137
1135
|
children: [i.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(i.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
|
|
1138
|
-
}), /* @__PURE__ */
|
|
1136
|
+
}), /* @__PURE__ */ Y("span", {
|
|
1139
1137
|
style: {
|
|
1140
1138
|
overflow: "hidden",
|
|
1141
1139
|
textOverflow: "ellipsis",
|
|
1142
1140
|
whiteSpace: "nowrap"
|
|
1143
1141
|
},
|
|
1144
|
-
children:
|
|
1142
|
+
children: N({
|
|
1145
1143
|
field: r,
|
|
1146
1144
|
fieldName: n,
|
|
1147
1145
|
value: t[n],
|
|
@@ -1154,39 +1152,39 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1154
1152
|
}, n) : null;
|
|
1155
1153
|
})
|
|
1156
1154
|
})]
|
|
1157
|
-
},
|
|
1155
|
+
}, D(t.id ?? n)))
|
|
1158
1156
|
})] });
|
|
1159
1157
|
}
|
|
1160
1158
|
//#endregion
|
|
1161
1159
|
//#region src/hooks/useTimelineData.ts
|
|
1162
1160
|
var it = 50;
|
|
1163
|
-
function at(e, t,
|
|
1164
|
-
let
|
|
1161
|
+
function at(e, t, r, i, a, o) {
|
|
1162
|
+
let s = Array.isArray(i) ? i : [i], c = Array.isArray(i) ? n(t, s.length) : [t], l = o ?? it, u = be({
|
|
1165
1163
|
queryKey: [
|
|
1166
|
-
|
|
1164
|
+
E,
|
|
1167
1165
|
e,
|
|
1168
1166
|
t,
|
|
1169
|
-
|
|
1167
|
+
r,
|
|
1170
1168
|
"timeline",
|
|
1171
|
-
|
|
1169
|
+
a,
|
|
1172
1170
|
l
|
|
1173
1171
|
],
|
|
1174
1172
|
queryFn: ({ pageParam: e }) => {
|
|
1175
1173
|
let t = new URLSearchParams();
|
|
1176
1174
|
if (!c) throw Error("invalid composite parent id");
|
|
1177
|
-
let
|
|
1175
|
+
let n = s.map((e, t) => ({
|
|
1178
1176
|
field: e,
|
|
1179
1177
|
op: "eq",
|
|
1180
1178
|
value: c[t]
|
|
1181
1179
|
}));
|
|
1182
|
-
return t.set("filters", JSON.stringify(
|
|
1180
|
+
return t.set("filters", JSON.stringify(n)), a ? t.set("sort", `${a}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${r}; fetch order falls back to API default`), t.set("limit", String(l)), e && t.set("after", e), F(`/api/data/${r}?${t.toString()}`);
|
|
1183
1181
|
},
|
|
1184
1182
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
1185
1183
|
initialPageParam: void 0,
|
|
1186
|
-
enabled: !!e && !!t && !!
|
|
1184
|
+
enabled: !!e && !!t && !!r && !!i && c !== null
|
|
1187
1185
|
});
|
|
1188
1186
|
return {
|
|
1189
|
-
rows:
|
|
1187
|
+
rows: G(() => u.data?.pages.flatMap((e) => e.data) ?? [], [u.data?.pages]),
|
|
1190
1188
|
refs: u.data?.pages[0]?.$refs,
|
|
1191
1189
|
fetchNextPage: u.fetchNextPage,
|
|
1192
1190
|
hasOlder: !!u.hasNextPage,
|
|
@@ -1198,79 +1196,79 @@ function at(e, t, n, r, i, a) {
|
|
|
1198
1196
|
//#endregion
|
|
1199
1197
|
//#region src/components/detail-layout/TimelineComposer.tsx
|
|
1200
1198
|
var ot = "quick_entry", st = 100, ct = 240, lt = 800, ut = 80;
|
|
1201
|
-
function dt({ config: t, parentEntity: n, parentId:
|
|
1202
|
-
let { values:
|
|
1203
|
-
|
|
1204
|
-
let e =
|
|
1199
|
+
function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
1200
|
+
let { values: a, quickAdd: o, childEntity: s, isPending: c, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ye(t, n, r, i), m = k(), [h, g] = q(ct), v = K(null), y = K(null), [b, x] = q(lt);
|
|
1201
|
+
W(() => {
|
|
1202
|
+
let e = y.current?.parentElement;
|
|
1205
1203
|
if (!e) return;
|
|
1206
1204
|
let t = () => {
|
|
1207
1205
|
let t = Math.max(st, e.clientHeight - ut);
|
|
1208
|
-
|
|
1206
|
+
x(Math.min(lt, t));
|
|
1209
1207
|
};
|
|
1210
1208
|
t();
|
|
1211
1209
|
let n = new ResizeObserver(t);
|
|
1212
1210
|
return n.observe(e), () => n.disconnect();
|
|
1213
|
-
}, []),
|
|
1214
|
-
g((e) => Math.min(e,
|
|
1215
|
-
}, [
|
|
1216
|
-
let
|
|
1217
|
-
|
|
1218
|
-
let
|
|
1219
|
-
|
|
1220
|
-
let
|
|
1221
|
-
getField: (e) =>
|
|
1211
|
+
}, []), W(() => {
|
|
1212
|
+
g((e) => Math.min(e, b));
|
|
1213
|
+
}, [b]);
|
|
1214
|
+
let S = K(a);
|
|
1215
|
+
S.current = a;
|
|
1216
|
+
let C = K(p);
|
|
1217
|
+
C.current = p;
|
|
1218
|
+
let w = K({}), T = G(() => ({
|
|
1219
|
+
getField: (e) => S.current[e],
|
|
1222
1220
|
setField: (e, t) => {
|
|
1223
|
-
|
|
1221
|
+
C.current(e, t);
|
|
1224
1222
|
},
|
|
1225
1223
|
focusField: (e) => {
|
|
1226
|
-
let t =
|
|
1224
|
+
let t = w.current[e];
|
|
1227
1225
|
t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
|
|
1228
1226
|
}
|
|
1229
1227
|
}), []);
|
|
1230
|
-
|
|
1231
|
-
let
|
|
1232
|
-
e.preventDefault(),
|
|
1228
|
+
W(() => _(ot, T), [T]);
|
|
1229
|
+
let E = U((e) => {
|
|
1230
|
+
e.preventDefault(), v.current = {
|
|
1233
1231
|
startY: e.clientY,
|
|
1234
1232
|
startHeight: h
|
|
1235
1233
|
};
|
|
1236
1234
|
let t = (e) => {
|
|
1237
|
-
if (!
|
|
1238
|
-
let t =
|
|
1235
|
+
if (!v.current) return;
|
|
1236
|
+
let t = v.current.startY - e.clientY, n = Math.min(b, Math.max(st, v.current.startHeight + t));
|
|
1239
1237
|
g(n);
|
|
1240
1238
|
}, n = () => {
|
|
1241
|
-
|
|
1239
|
+
v.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
1242
1240
|
};
|
|
1243
1241
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
1244
|
-
}, [h,
|
|
1245
|
-
if (!
|
|
1246
|
-
let
|
|
1247
|
-
let t =
|
|
1242
|
+
}, [h, b]);
|
|
1243
|
+
if (!o || o.fields.length === 0 || !s) return null;
|
|
1244
|
+
let D = o.fields.find((e) => {
|
|
1245
|
+
let t = s.fields.get(e);
|
|
1248
1246
|
return t && (t.type === "text" || t.type === "string");
|
|
1249
|
-
}),
|
|
1250
|
-
for (let e of
|
|
1251
|
-
if (e ===
|
|
1252
|
-
let t =
|
|
1253
|
-
t && (t.type === "enum" ?
|
|
1247
|
+
}), O = [], A = [];
|
|
1248
|
+
for (let e of o.fields) {
|
|
1249
|
+
if (e === D) continue;
|
|
1250
|
+
let t = s.fields.get(e);
|
|
1251
|
+
t && (t.type === "enum" ? O.push(e) : A.push(e));
|
|
1254
1252
|
}
|
|
1255
|
-
let
|
|
1256
|
-
let t =
|
|
1257
|
-
return t ? /* @__PURE__ */
|
|
1253
|
+
let j = (e) => {
|
|
1254
|
+
let t = s.fields.get(e);
|
|
1255
|
+
return t ? /* @__PURE__ */ Y("div", {
|
|
1258
1256
|
ref: (t) => {
|
|
1259
|
-
|
|
1257
|
+
w.current[e] = t;
|
|
1260
1258
|
},
|
|
1261
|
-
children:
|
|
1259
|
+
children: N({
|
|
1262
1260
|
field: t,
|
|
1263
1261
|
fieldName: e,
|
|
1264
|
-
value:
|
|
1262
|
+
value: a[e] ?? "",
|
|
1265
1263
|
mode: "edit",
|
|
1266
1264
|
onChange: (t) => p(e, t),
|
|
1267
|
-
record:
|
|
1265
|
+
record: a,
|
|
1268
1266
|
locale: m
|
|
1269
1267
|
})
|
|
1270
1268
|
}, e) : null;
|
|
1271
1269
|
};
|
|
1272
|
-
return /* @__PURE__ */
|
|
1273
|
-
ref:
|
|
1270
|
+
return /* @__PURE__ */ X("div", {
|
|
1271
|
+
ref: y,
|
|
1274
1272
|
style: {
|
|
1275
1273
|
flexShrink: 0,
|
|
1276
1274
|
borderTop: "1px solid var(--divider)",
|
|
@@ -1279,8 +1277,8 @@ function dt({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1279
1277
|
flexDirection: "column",
|
|
1280
1278
|
height: `${h}px`
|
|
1281
1279
|
},
|
|
1282
|
-
children: [/* @__PURE__ */
|
|
1283
|
-
onMouseDown:
|
|
1280
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
1281
|
+
onMouseDown: E,
|
|
1284
1282
|
title: "Drag to resize",
|
|
1285
1283
|
style: {
|
|
1286
1284
|
height: 12,
|
|
@@ -1290,13 +1288,13 @@ function dt({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1290
1288
|
justifyContent: "center",
|
|
1291
1289
|
flexShrink: 0
|
|
1292
1290
|
},
|
|
1293
|
-
children: /* @__PURE__ */
|
|
1291
|
+
children: /* @__PURE__ */ Y("div", { style: {
|
|
1294
1292
|
width: 56,
|
|
1295
1293
|
height: 3,
|
|
1296
1294
|
borderRadius: 999,
|
|
1297
1295
|
background: "var(--border)"
|
|
1298
1296
|
} })
|
|
1299
|
-
}), /* @__PURE__ */
|
|
1297
|
+
}), /* @__PURE__ */ X("form", {
|
|
1300
1298
|
onSubmit: f,
|
|
1301
1299
|
onKeyDown: (e) => {
|
|
1302
1300
|
(e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), e.currentTarget.requestSubmit());
|
|
@@ -1310,7 +1308,7 @@ function dt({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1310
1308
|
padding: "0 12px 8px"
|
|
1311
1309
|
},
|
|
1312
1310
|
children: [
|
|
1313
|
-
|
|
1311
|
+
O.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1314
1312
|
style: {
|
|
1315
1313
|
display: "flex",
|
|
1316
1314
|
flexWrap: "wrap",
|
|
@@ -1318,29 +1316,29 @@ function dt({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1318
1316
|
gap: 6,
|
|
1319
1317
|
flexShrink: 0
|
|
1320
1318
|
},
|
|
1321
|
-
children:
|
|
1319
|
+
children: O.map(j)
|
|
1322
1320
|
}),
|
|
1323
|
-
|
|
1321
|
+
D && s.fields.get(D) && /* @__PURE__ */ Y("div", {
|
|
1324
1322
|
style: {
|
|
1325
1323
|
flex: 1,
|
|
1326
1324
|
minHeight: 0,
|
|
1327
1325
|
display: "flex"
|
|
1328
1326
|
},
|
|
1329
1327
|
ref: (e) => {
|
|
1330
|
-
|
|
1328
|
+
w.current[D] = e;
|
|
1331
1329
|
},
|
|
1332
|
-
children:
|
|
1333
|
-
field:
|
|
1334
|
-
fieldName:
|
|
1335
|
-
value:
|
|
1330
|
+
children: N({
|
|
1331
|
+
field: s.fields.get(D),
|
|
1332
|
+
fieldName: D,
|
|
1333
|
+
value: a[D] ?? "",
|
|
1336
1334
|
mode: "edit",
|
|
1337
|
-
onChange: (e) => p(
|
|
1338
|
-
record:
|
|
1335
|
+
onChange: (e) => p(D, e),
|
|
1336
|
+
record: a,
|
|
1339
1337
|
fill: !0,
|
|
1340
1338
|
locale: m
|
|
1341
1339
|
})
|
|
1342
1340
|
}),
|
|
1343
|
-
/* @__PURE__ */
|
|
1341
|
+
/* @__PURE__ */ X("div", {
|
|
1344
1342
|
style: {
|
|
1345
1343
|
display: "flex",
|
|
1346
1344
|
flexWrap: "wrap",
|
|
@@ -1348,39 +1346,39 @@ function dt({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1348
1346
|
gap: 6,
|
|
1349
1347
|
flexShrink: 0
|
|
1350
1348
|
},
|
|
1351
|
-
children: [
|
|
1349
|
+
children: [A.map(j), /* @__PURE__ */ X("div", {
|
|
1352
1350
|
style: {
|
|
1353
1351
|
marginLeft: "auto",
|
|
1354
1352
|
display: "flex",
|
|
1355
1353
|
alignItems: "center",
|
|
1356
1354
|
gap: 8
|
|
1357
1355
|
},
|
|
1358
|
-
children: [/* @__PURE__ */
|
|
1356
|
+
children: [/* @__PURE__ */ X("span", {
|
|
1359
1357
|
style: {
|
|
1360
1358
|
fontSize: 10.5,
|
|
1361
1359
|
color: "var(--text-4)"
|
|
1362
1360
|
},
|
|
1363
1361
|
children: [
|
|
1364
|
-
/* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ Y("span", {
|
|
1365
1363
|
className: "mono",
|
|
1366
1364
|
children: "⌘"
|
|
1367
1365
|
}),
|
|
1368
|
-
/* @__PURE__ */
|
|
1366
|
+
/* @__PURE__ */ Y("span", {
|
|
1369
1367
|
className: "mono",
|
|
1370
1368
|
children: "↵"
|
|
1371
1369
|
}),
|
|
1372
1370
|
" to add"
|
|
1373
1371
|
]
|
|
1374
|
-
}), /* @__PURE__ */
|
|
1372
|
+
}), /* @__PURE__ */ Y(l, {
|
|
1375
1373
|
type: "submit",
|
|
1376
1374
|
kind: "primary",
|
|
1377
|
-
icon: /* @__PURE__ */
|
|
1378
|
-
disabled:
|
|
1375
|
+
icon: /* @__PURE__ */ Y(e.plus, { size: 13 }),
|
|
1376
|
+
disabled: c || !d,
|
|
1379
1377
|
children: "Add"
|
|
1380
1378
|
})]
|
|
1381
1379
|
})]
|
|
1382
1380
|
}),
|
|
1383
|
-
u != null && /* @__PURE__ */
|
|
1381
|
+
u != null && /* @__PURE__ */ Y("p", {
|
|
1384
1382
|
style: {
|
|
1385
1383
|
fontSize: 11,
|
|
1386
1384
|
color: "var(--danger)",
|
|
@@ -1405,31 +1403,31 @@ function _t(e) {
|
|
|
1405
1403
|
function vt(e, t) {
|
|
1406
1404
|
if (yt(t)) {
|
|
1407
1405
|
let e = t.id;
|
|
1408
|
-
return e == null ? "" :
|
|
1406
|
+
return e == null ? "" : D(e);
|
|
1409
1407
|
}
|
|
1410
|
-
return
|
|
1408
|
+
return d(A(e, t));
|
|
1411
1409
|
}
|
|
1412
1410
|
function yt(e) {
|
|
1413
1411
|
return e.__optimistic === !0;
|
|
1414
1412
|
}
|
|
1415
|
-
function bt({ config: e, parentEntity: t, parentId:
|
|
1416
|
-
let
|
|
1417
|
-
|
|
1413
|
+
function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1414
|
+
let i = r.entities[e.entity], { rows: o, refs: s, fetchNextPage: c, hasOlder: u, isFetchingOlder: d, isLoading: f, isError: p } = at(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), m = e.timeline, h = m?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = G(() => g ? [...o].reverse() : o, [o, g]), v = m?.auto_scroll ?? "none", y = K(null), x = K(null), S = K(!1), C = K(0), w = K(null), T = K(null), E = K(!0), D = K(null);
|
|
1415
|
+
W(() => {
|
|
1418
1416
|
S.current = !1, C.current = 0, w.current = null, T.current = null, E.current = !0, D.current = null;
|
|
1419
|
-
}, [
|
|
1417
|
+
}, [n]), ye(() => {
|
|
1420
1418
|
!d || !y.current || (D.current = {
|
|
1421
1419
|
scrollHeight: y.current.scrollHeight,
|
|
1422
1420
|
scrollTop: y.current.scrollTop
|
|
1423
1421
|
});
|
|
1424
1422
|
}, [d]), ye(() => {
|
|
1425
1423
|
let e = y.current;
|
|
1426
|
-
if (!e || _.length === 0 || !
|
|
1424
|
+
if (!e || _.length === 0 || !i) {
|
|
1427
1425
|
C.current = _.length;
|
|
1428
1426
|
return;
|
|
1429
1427
|
}
|
|
1430
|
-
let t = vt(
|
|
1428
|
+
let t = vt(i, _[0]), n = vt(i, _[_.length - 1]), r = !S.current, a = _.length > C.current && C.current > 0, o = a && (g && t !== w.current && n === T.current || !g && n !== T.current && t === w.current), s = a && !o;
|
|
1431
1429
|
if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), S.current = !0;
|
|
1432
|
-
else if (
|
|
1430
|
+
else if (o && D.current) {
|
|
1433
1431
|
let t = D.current;
|
|
1434
1432
|
g && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), D.current = null;
|
|
1435
1433
|
} else s && g && E.current && (e.scrollTop = e.scrollHeight);
|
|
@@ -1438,17 +1436,17 @@ function bt({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
1438
1436
|
_,
|
|
1439
1437
|
v,
|
|
1440
1438
|
g,
|
|
1441
|
-
|
|
1439
|
+
i
|
|
1442
1440
|
]);
|
|
1443
|
-
let O =
|
|
1441
|
+
let O = U(() => {
|
|
1444
1442
|
let e = y.current;
|
|
1445
1443
|
e && (E.current = e.scrollHeight - e.scrollTop - e.clientHeight < ft);
|
|
1446
1444
|
}, []);
|
|
1447
|
-
|
|
1445
|
+
W(() => {
|
|
1448
1446
|
let e = x.current;
|
|
1449
1447
|
if (!e || typeof IntersectionObserver > "u") return;
|
|
1450
1448
|
let t = new IntersectionObserver((e) => {
|
|
1451
|
-
for (let t of e) t.isIntersecting && u && !d &&
|
|
1449
|
+
for (let t of e) t.isIntersecting && u && !d && c();
|
|
1452
1450
|
}, {
|
|
1453
1451
|
root: y.current ?? null,
|
|
1454
1452
|
rootMargin: `${pt}px 0px 0px 0px`,
|
|
@@ -1458,10 +1456,10 @@ function bt({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
1458
1456
|
}, [
|
|
1459
1457
|
u,
|
|
1460
1458
|
d,
|
|
1461
|
-
|
|
1459
|
+
c
|
|
1462
1460
|
]);
|
|
1463
|
-
let [k, A] =
|
|
1464
|
-
if (!
|
|
1461
|
+
let [k, A] = q(null);
|
|
1462
|
+
if (!i) return /* @__PURE__ */ Y("div", {
|
|
1465
1463
|
style: {
|
|
1466
1464
|
fontSize: 12.5,
|
|
1467
1465
|
color: "var(--text-3)",
|
|
@@ -1469,25 +1467,25 @@ function bt({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
1469
1467
|
},
|
|
1470
1468
|
children: "Entity not found."
|
|
1471
1469
|
});
|
|
1472
|
-
let j = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), M =
|
|
1470
|
+
let j = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), M = b(i.display?.name_plural) || b(i.display?.name) || e.entity, N = u ? /* @__PURE__ */ Y("div", {
|
|
1473
1471
|
style: {
|
|
1474
1472
|
display: "flex",
|
|
1475
1473
|
justifyContent: "center",
|
|
1476
1474
|
padding: "6px 0"
|
|
1477
1475
|
},
|
|
1478
|
-
children: /* @__PURE__ */
|
|
1476
|
+
children: /* @__PURE__ */ Y(l, {
|
|
1479
1477
|
size: "xs",
|
|
1480
|
-
onClick: () =>
|
|
1478
|
+
onClick: () => c(),
|
|
1481
1479
|
disabled: d,
|
|
1482
|
-
icon: d ? /* @__PURE__ */
|
|
1480
|
+
icon: d ? /* @__PURE__ */ Y(a, { size: 11 }) : void 0,
|
|
1483
1481
|
children: d ? "Loading…" : "Load older"
|
|
1484
1482
|
})
|
|
1485
|
-
}) : null,
|
|
1483
|
+
}) : null, ee = /* @__PURE__ */ Y("div", {
|
|
1486
1484
|
ref: x,
|
|
1487
1485
|
"aria-hidden": "true",
|
|
1488
1486
|
style: { height: 1 }
|
|
1489
1487
|
}), P;
|
|
1490
|
-
if (p) P = /* @__PURE__ */
|
|
1488
|
+
if (p) P = /* @__PURE__ */ Y("div", {
|
|
1491
1489
|
style: {
|
|
1492
1490
|
fontSize: 12.5,
|
|
1493
1491
|
color: "var(--danger)",
|
|
@@ -1495,24 +1493,24 @@ function bt({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
1495
1493
|
},
|
|
1496
1494
|
children: "Failed to load."
|
|
1497
1495
|
});
|
|
1498
|
-
else if (f) P = /* @__PURE__ */
|
|
1496
|
+
else if (f) P = /* @__PURE__ */ X("div", {
|
|
1499
1497
|
style: {
|
|
1500
1498
|
display: "flex",
|
|
1501
1499
|
flexDirection: "column",
|
|
1502
1500
|
gap: 8,
|
|
1503
1501
|
padding: 12
|
|
1504
1502
|
},
|
|
1505
|
-
children: [/* @__PURE__ */
|
|
1503
|
+
children: [/* @__PURE__ */ Y("div", { style: {
|
|
1506
1504
|
height: 64,
|
|
1507
1505
|
background: "var(--surface-3)",
|
|
1508
1506
|
borderRadius: 8
|
|
1509
|
-
} }), /* @__PURE__ */
|
|
1507
|
+
} }), /* @__PURE__ */ Y("div", { style: {
|
|
1510
1508
|
height: 64,
|
|
1511
1509
|
background: "var(--surface-3)",
|
|
1512
1510
|
borderRadius: 8
|
|
1513
1511
|
} })]
|
|
1514
1512
|
});
|
|
1515
|
-
else if (_.length === 0) P = /* @__PURE__ */
|
|
1513
|
+
else if (_.length === 0) P = /* @__PURE__ */ X(J, { children: [ee, /* @__PURE__ */ Y("div", {
|
|
1516
1514
|
style: {
|
|
1517
1515
|
fontSize: 12.5,
|
|
1518
1516
|
color: "var(--text-3)",
|
|
@@ -1521,60 +1519,60 @@ function bt({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
1521
1519
|
children: "No activity yet."
|
|
1522
1520
|
})] });
|
|
1523
1521
|
else {
|
|
1524
|
-
let
|
|
1525
|
-
let
|
|
1526
|
-
return /* @__PURE__ */
|
|
1527
|
-
row:
|
|
1528
|
-
rowId:
|
|
1529
|
-
childEntity:
|
|
1522
|
+
let a = (a, o) => {
|
|
1523
|
+
let c = vt(i, a) || String(o);
|
|
1524
|
+
return /* @__PURE__ */ Y(xt, {
|
|
1525
|
+
row: a,
|
|
1526
|
+
rowId: c,
|
|
1527
|
+
childEntity: i,
|
|
1530
1528
|
entityCode: e.entity,
|
|
1531
1529
|
parentEntity: t,
|
|
1532
|
-
parentId:
|
|
1530
|
+
parentId: n,
|
|
1533
1531
|
timeline: m,
|
|
1534
1532
|
editableFields: j,
|
|
1535
|
-
refs:
|
|
1536
|
-
isEditing: k ===
|
|
1537
|
-
onStartEdit: () => A(
|
|
1533
|
+
refs: s,
|
|
1534
|
+
isEditing: k === c,
|
|
1535
|
+
onStartEdit: () => A(c),
|
|
1538
1536
|
onCancelEdit: () => A(null),
|
|
1539
1537
|
onSaved: () => A(null),
|
|
1540
|
-
schema:
|
|
1541
|
-
optimistic: yt(
|
|
1542
|
-
},
|
|
1543
|
-
},
|
|
1544
|
-
if (
|
|
1538
|
+
schema: r,
|
|
1539
|
+
optimistic: yt(a)
|
|
1540
|
+
}, c);
|
|
1541
|
+
}, o = m?.time_field, c;
|
|
1542
|
+
if (o) {
|
|
1545
1543
|
let e = [];
|
|
1546
1544
|
_.forEach((t, n) => {
|
|
1547
|
-
let r = t[
|
|
1548
|
-
!
|
|
1545
|
+
let r = t[o], i = Ct(r), a = e[e.length - 1];
|
|
1546
|
+
!a || a.key !== i ? e.push({
|
|
1549
1547
|
key: i,
|
|
1550
1548
|
label: wt(r),
|
|
1551
1549
|
rows: [{
|
|
1552
1550
|
row: t,
|
|
1553
1551
|
idx: n
|
|
1554
1552
|
}]
|
|
1555
|
-
}) :
|
|
1553
|
+
}) : a.rows.push({
|
|
1556
1554
|
row: t,
|
|
1557
1555
|
idx: n
|
|
1558
1556
|
});
|
|
1559
|
-
}),
|
|
1557
|
+
}), c = e.map((e) => /* @__PURE__ */ X("div", {
|
|
1560
1558
|
style: {
|
|
1561
1559
|
display: "flex",
|
|
1562
1560
|
flexDirection: "column",
|
|
1563
1561
|
gap: 8
|
|
1564
1562
|
},
|
|
1565
|
-
children: [/* @__PURE__ */
|
|
1563
|
+
children: [/* @__PURE__ */ Y(Tt, {
|
|
1566
1564
|
label: e.label,
|
|
1567
1565
|
count: e.rows.length
|
|
1568
|
-
}), e.rows.map(({ row: e, idx: t }) =>
|
|
1566
|
+
}), e.rows.map(({ row: e, idx: t }) => a(e, t))]
|
|
1569
1567
|
}, `day-${e.key}`));
|
|
1570
|
-
} else
|
|
1571
|
-
P = /* @__PURE__ */
|
|
1572
|
-
N,
|
|
1568
|
+
} else c = _.map((e, t) => a(e, t));
|
|
1569
|
+
P = /* @__PURE__ */ X(J, { children: [
|
|
1573
1570
|
ee,
|
|
1574
|
-
|
|
1571
|
+
N,
|
|
1572
|
+
c
|
|
1575
1573
|
] });
|
|
1576
1574
|
}
|
|
1577
|
-
return h ? /* @__PURE__ */
|
|
1575
|
+
return h ? /* @__PURE__ */ X("div", {
|
|
1578
1576
|
style: {
|
|
1579
1577
|
display: "flex",
|
|
1580
1578
|
flexDirection: "column",
|
|
@@ -1584,13 +1582,13 @@ function bt({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
1584
1582
|
color: "var(--text)"
|
|
1585
1583
|
},
|
|
1586
1584
|
children: [
|
|
1587
|
-
/* @__PURE__ */
|
|
1585
|
+
/* @__PURE__ */ Y("div", {
|
|
1588
1586
|
style: {
|
|
1589
1587
|
padding: "10px 16px",
|
|
1590
1588
|
borderBottom: "1px solid var(--divider)",
|
|
1591
1589
|
background: "var(--surface)"
|
|
1592
1590
|
},
|
|
1593
|
-
children: /* @__PURE__ */
|
|
1591
|
+
children: /* @__PURE__ */ Y("h3", {
|
|
1594
1592
|
style: {
|
|
1595
1593
|
margin: 0,
|
|
1596
1594
|
fontSize: 12.5,
|
|
@@ -1599,7 +1597,7 @@ function bt({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
1599
1597
|
children: M
|
|
1600
1598
|
})
|
|
1601
1599
|
}),
|
|
1602
|
-
/* @__PURE__ */
|
|
1600
|
+
/* @__PURE__ */ Y("div", {
|
|
1603
1601
|
ref: y,
|
|
1604
1602
|
onScroll: O,
|
|
1605
1603
|
style: {
|
|
@@ -1612,73 +1610,73 @@ function bt({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
|
1612
1610
|
},
|
|
1613
1611
|
children: P
|
|
1614
1612
|
}),
|
|
1615
|
-
/* @__PURE__ */
|
|
1613
|
+
/* @__PURE__ */ Y(dt, {
|
|
1616
1614
|
config: e,
|
|
1617
1615
|
parentEntity: t,
|
|
1618
|
-
parentId:
|
|
1619
|
-
schema:
|
|
1616
|
+
parentId: n,
|
|
1617
|
+
schema: r
|
|
1620
1618
|
})
|
|
1621
1619
|
]
|
|
1622
|
-
}) : /* @__PURE__ */
|
|
1620
|
+
}) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
1623
1621
|
style: {
|
|
1624
1622
|
display: "flex",
|
|
1625
1623
|
flexDirection: "column",
|
|
1626
1624
|
gap: 8
|
|
1627
1625
|
},
|
|
1628
1626
|
children: P
|
|
1629
|
-
}), /* @__PURE__ */
|
|
1627
|
+
}), /* @__PURE__ */ Y(dt, {
|
|
1630
1628
|
config: e,
|
|
1631
1629
|
parentEntity: t,
|
|
1632
|
-
parentId:
|
|
1633
|
-
schema:
|
|
1630
|
+
parentId: n,
|
|
1631
|
+
schema: r
|
|
1634
1632
|
})] });
|
|
1635
1633
|
}
|
|
1636
|
-
function xt({ row: t, rowId:
|
|
1637
|
-
let
|
|
1638
|
-
|
|
1639
|
-
|
|
1634
|
+
function xt({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o, parentId: s, timeline: d, editableFields: f, refs: p, isEditing: g, onStartEdit: _, onCancelEdit: v, onSaved: y, schema: b, optimistic: x = !1 }) {
|
|
1635
|
+
let S = Se(), w = k(), [T, O] = q({}), A = U(() => {
|
|
1636
|
+
S.invalidateQueries({ queryKey: [
|
|
1637
|
+
E,
|
|
1638
|
+
o,
|
|
1640
1639
|
s,
|
|
1641
|
-
|
|
1642
|
-
o
|
|
1640
|
+
i
|
|
1643
1641
|
] });
|
|
1644
1642
|
}, [
|
|
1645
|
-
|
|
1643
|
+
S,
|
|
1644
|
+
o,
|
|
1646
1645
|
s,
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
]), j = xe({
|
|
1646
|
+
i
|
|
1647
|
+
]), M = xe({
|
|
1650
1648
|
mutationFn: (e) => {
|
|
1651
|
-
let
|
|
1649
|
+
let r = t.$row_version, a = typeof r == "string" && r !== "" ? {
|
|
1652
1650
|
...e,
|
|
1653
|
-
$row_version:
|
|
1651
|
+
$row_version: r
|
|
1654
1652
|
} : e;
|
|
1655
|
-
return
|
|
1653
|
+
return C(i, n, a);
|
|
1656
1654
|
},
|
|
1657
1655
|
onSuccess: () => {
|
|
1658
|
-
|
|
1656
|
+
A(), m.success("Updated"), y();
|
|
1659
1657
|
},
|
|
1660
|
-
onError: (e) =>
|
|
1658
|
+
onError: (e) => m.error(e.message)
|
|
1661
1659
|
}), ee = xe({
|
|
1662
|
-
mutationFn: () =>
|
|
1660
|
+
mutationFn: () => j(i, n),
|
|
1663
1661
|
onSuccess: () => {
|
|
1664
|
-
|
|
1662
|
+
A(), m.success("Deleted");
|
|
1665
1663
|
},
|
|
1666
|
-
onError: (e) =>
|
|
1667
|
-
}),
|
|
1664
|
+
onError: (e) => m.error(e.message)
|
|
1665
|
+
}), P = U(() => {
|
|
1668
1666
|
let e = {};
|
|
1669
|
-
for (let n of
|
|
1670
|
-
|
|
1667
|
+
for (let n of f) e[n] = t[n] ?? "";
|
|
1668
|
+
O(e), _();
|
|
1671
1669
|
}, [
|
|
1672
1670
|
t,
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
]),
|
|
1676
|
-
|
|
1671
|
+
f,
|
|
1672
|
+
_
|
|
1673
|
+
]), F = U((e, t) => {
|
|
1674
|
+
O((n) => ({
|
|
1677
1675
|
...n,
|
|
1678
1676
|
[e]: t
|
|
1679
1677
|
}));
|
|
1680
|
-
}, []),
|
|
1681
|
-
return
|
|
1678
|
+
}, []), I = d?.time_field, L = d?.type_field, R = d?.summary_field, z = d?.content_field, B = d?.author_field, V = d?.direction_field, H = d?.intent_field;
|
|
1679
|
+
return g ? /* @__PURE__ */ X("div", {
|
|
1682
1680
|
style: {
|
|
1683
1681
|
borderRadius: 10,
|
|
1684
1682
|
border: "1px solid var(--accent)",
|
|
@@ -1688,64 +1686,64 @@ function xt({ row: t, rowId: i, childEntity: a, entityCode: o, parentEntity: s,
|
|
|
1688
1686
|
flexDirection: "column",
|
|
1689
1687
|
gap: 8
|
|
1690
1688
|
},
|
|
1691
|
-
children: [
|
|
1692
|
-
let t =
|
|
1693
|
-
return t ? /* @__PURE__ */
|
|
1689
|
+
children: [f.map((e) => {
|
|
1690
|
+
let t = r.fields.get(e);
|
|
1691
|
+
return t ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("label", {
|
|
1694
1692
|
style: {
|
|
1695
1693
|
fontSize: 11,
|
|
1696
1694
|
color: "var(--text-3)",
|
|
1697
1695
|
marginBottom: 4,
|
|
1698
1696
|
display: "block"
|
|
1699
1697
|
},
|
|
1700
|
-
children:
|
|
1701
|
-
}),
|
|
1698
|
+
children: u(t, e, b.entities)
|
|
1699
|
+
}), N({
|
|
1702
1700
|
field: t,
|
|
1703
1701
|
fieldName: e,
|
|
1704
|
-
value:
|
|
1702
|
+
value: T[e] ?? "",
|
|
1705
1703
|
mode: "edit",
|
|
1706
|
-
onChange: (t) =>
|
|
1707
|
-
record:
|
|
1708
|
-
locale:
|
|
1704
|
+
onChange: (t) => F(e, t),
|
|
1705
|
+
record: T,
|
|
1706
|
+
locale: w
|
|
1709
1707
|
})] }, e) : null;
|
|
1710
|
-
}), /* @__PURE__ */
|
|
1708
|
+
}), /* @__PURE__ */ X("div", {
|
|
1711
1709
|
style: {
|
|
1712
1710
|
display: "flex",
|
|
1713
1711
|
alignItems: "center",
|
|
1714
1712
|
gap: 6,
|
|
1715
1713
|
paddingTop: 4
|
|
1716
1714
|
},
|
|
1717
|
-
children: [/* @__PURE__ */
|
|
1715
|
+
children: [/* @__PURE__ */ Y(l, {
|
|
1718
1716
|
kind: "primary",
|
|
1719
1717
|
size: "xs",
|
|
1720
|
-
icon:
|
|
1721
|
-
onClick: () =>
|
|
1722
|
-
disabled:
|
|
1723
|
-
children:
|
|
1724
|
-
}), /* @__PURE__ */
|
|
1718
|
+
icon: M.isPending ? /* @__PURE__ */ Y(a, { size: 12 }) : /* @__PURE__ */ Y(e.check, { size: 12 }),
|
|
1719
|
+
onClick: () => M.mutate(T),
|
|
1720
|
+
disabled: M.isPending,
|
|
1721
|
+
children: M.isPending ? "Saving…" : "Save"
|
|
1722
|
+
}), /* @__PURE__ */ Y(l, {
|
|
1725
1723
|
size: "xs",
|
|
1726
|
-
icon: /* @__PURE__ */
|
|
1724
|
+
icon: /* @__PURE__ */ Y(e.x, { size: 12 }),
|
|
1727
1725
|
onClick: () => {
|
|
1728
|
-
|
|
1726
|
+
O({}), v();
|
|
1729
1727
|
},
|
|
1730
|
-
disabled:
|
|
1728
|
+
disabled: M.isPending,
|
|
1731
1729
|
children: "Cancel"
|
|
1732
1730
|
})]
|
|
1733
1731
|
})]
|
|
1734
|
-
}) : /* @__PURE__ */
|
|
1732
|
+
}) : /* @__PURE__ */ X("div", {
|
|
1735
1733
|
className: "group",
|
|
1736
|
-
"data-optimistic":
|
|
1734
|
+
"data-optimistic": x || void 0,
|
|
1737
1735
|
style: {
|
|
1738
1736
|
borderRadius: 10,
|
|
1739
1737
|
border: "1px solid var(--border)",
|
|
1740
1738
|
background: "var(--surface)",
|
|
1741
1739
|
padding: 12,
|
|
1742
1740
|
transition: "border-color .12s",
|
|
1743
|
-
opacity:
|
|
1741
|
+
opacity: x ? .6 : 1
|
|
1744
1742
|
},
|
|
1745
1743
|
onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
|
|
1746
1744
|
onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
|
|
1747
1745
|
children: [
|
|
1748
|
-
/* @__PURE__ */
|
|
1746
|
+
/* @__PURE__ */ X("div", {
|
|
1749
1747
|
style: {
|
|
1750
1748
|
display: "flex",
|
|
1751
1749
|
alignItems: "center",
|
|
@@ -1755,109 +1753,109 @@ function xt({ row: t, rowId: i, childEntity: a, entityCode: o, parentEntity: s,
|
|
|
1755
1753
|
color: "var(--text-3)"
|
|
1756
1754
|
},
|
|
1757
1755
|
children: [
|
|
1758
|
-
|
|
1756
|
+
I && t[I] != null && r.fields.get(I) && /* @__PURE__ */ Y("span", {
|
|
1759
1757
|
style: { fontWeight: 500 },
|
|
1760
|
-
children:
|
|
1761
|
-
field:
|
|
1762
|
-
fieldName:
|
|
1763
|
-
value: t[
|
|
1758
|
+
children: N({
|
|
1759
|
+
field: r.fields.get(I),
|
|
1760
|
+
fieldName: I,
|
|
1761
|
+
value: t[I],
|
|
1764
1762
|
mode: "display",
|
|
1765
1763
|
record: t,
|
|
1766
|
-
refs:
|
|
1767
|
-
locale:
|
|
1764
|
+
refs: p,
|
|
1765
|
+
locale: w
|
|
1768
1766
|
})
|
|
1769
1767
|
}),
|
|
1770
|
-
|
|
1768
|
+
L && t[L] != null && r.fields.get(L) && /* @__PURE__ */ Y(h, {
|
|
1771
1769
|
tone: "slate",
|
|
1772
1770
|
size: "xs",
|
|
1773
|
-
children:
|
|
1774
|
-
field:
|
|
1775
|
-
fieldName:
|
|
1776
|
-
value: t[
|
|
1771
|
+
children: N({
|
|
1772
|
+
field: r.fields.get(L),
|
|
1773
|
+
fieldName: L,
|
|
1774
|
+
value: t[L],
|
|
1777
1775
|
mode: "display",
|
|
1778
1776
|
record: t,
|
|
1779
|
-
refs:
|
|
1780
|
-
locale:
|
|
1777
|
+
refs: p,
|
|
1778
|
+
locale: w
|
|
1781
1779
|
})
|
|
1782
1780
|
}),
|
|
1783
|
-
|
|
1784
|
-
value: t[
|
|
1785
|
-
field:
|
|
1781
|
+
V && t[V] != null && r.fields.get(V) && /* @__PURE__ */ Y(Et, {
|
|
1782
|
+
value: t[V],
|
|
1783
|
+
field: r.fields.get(V)
|
|
1786
1784
|
}),
|
|
1787
|
-
|
|
1785
|
+
H && t[H] != null && r.fields.get(H) && /* @__PURE__ */ Y(h, {
|
|
1788
1786
|
tone: "slate",
|
|
1789
1787
|
size: "xs",
|
|
1790
|
-
children:
|
|
1791
|
-
field:
|
|
1792
|
-
fieldName:
|
|
1793
|
-
value: t[
|
|
1788
|
+
children: N({
|
|
1789
|
+
field: r.fields.get(H),
|
|
1790
|
+
fieldName: H,
|
|
1791
|
+
value: t[H],
|
|
1794
1792
|
mode: "display",
|
|
1795
1793
|
record: t,
|
|
1796
|
-
refs:
|
|
1797
|
-
locale:
|
|
1794
|
+
refs: p,
|
|
1795
|
+
locale: w
|
|
1798
1796
|
})
|
|
1799
1797
|
}),
|
|
1800
|
-
|
|
1798
|
+
B && t[B] != null && r.fields.get(B) && /* @__PURE__ */ X("span", { children: [
|
|
1801
1799
|
"by",
|
|
1802
1800
|
" ",
|
|
1803
|
-
|
|
1804
|
-
field:
|
|
1805
|
-
fieldName:
|
|
1806
|
-
value: t[
|
|
1801
|
+
N({
|
|
1802
|
+
field: r.fields.get(B),
|
|
1803
|
+
fieldName: B,
|
|
1804
|
+
value: t[B],
|
|
1807
1805
|
mode: "display",
|
|
1808
1806
|
record: t,
|
|
1809
|
-
refs:
|
|
1810
|
-
locale:
|
|
1807
|
+
refs: p,
|
|
1808
|
+
locale: w
|
|
1811
1809
|
})
|
|
1812
1810
|
] }),
|
|
1813
|
-
!
|
|
1811
|
+
!x && /* @__PURE__ */ X("div", {
|
|
1814
1812
|
style: {
|
|
1815
1813
|
marginLeft: "auto",
|
|
1816
1814
|
display: "flex",
|
|
1817
1815
|
alignItems: "center",
|
|
1818
1816
|
gap: 2
|
|
1819
1817
|
},
|
|
1820
|
-
children: [/* @__PURE__ */
|
|
1818
|
+
children: [/* @__PURE__ */ Y(c, {
|
|
1821
1819
|
size: 22,
|
|
1822
|
-
icon: /* @__PURE__ */
|
|
1823
|
-
onClick:
|
|
1820
|
+
icon: /* @__PURE__ */ Y(e.edit, { size: 11 }),
|
|
1821
|
+
onClick: P,
|
|
1824
1822
|
title: "Edit"
|
|
1825
|
-
}), /* @__PURE__ */
|
|
1823
|
+
}), /* @__PURE__ */ Y(c, {
|
|
1826
1824
|
size: 22,
|
|
1827
|
-
icon: /* @__PURE__ */
|
|
1825
|
+
icon: /* @__PURE__ */ Y(e.trash, { size: 11 }),
|
|
1828
1826
|
onClick: () => ee.mutate(),
|
|
1829
1827
|
title: "Delete"
|
|
1830
1828
|
})]
|
|
1831
1829
|
})
|
|
1832
1830
|
]
|
|
1833
1831
|
}),
|
|
1834
|
-
|
|
1832
|
+
R && t[R] != null && r.fields.get(R) && /* @__PURE__ */ Y("div", {
|
|
1835
1833
|
style: {
|
|
1836
1834
|
fontSize: 12.5,
|
|
1837
1835
|
fontWeight: 500,
|
|
1838
1836
|
marginTop: 6
|
|
1839
1837
|
},
|
|
1840
|
-
children:
|
|
1841
|
-
field:
|
|
1842
|
-
fieldName:
|
|
1843
|
-
value: t[
|
|
1838
|
+
children: N({
|
|
1839
|
+
field: r.fields.get(R),
|
|
1840
|
+
fieldName: R,
|
|
1841
|
+
value: t[R],
|
|
1844
1842
|
mode: "display",
|
|
1845
1843
|
record: t,
|
|
1846
|
-
refs:
|
|
1847
|
-
locale:
|
|
1844
|
+
refs: p,
|
|
1845
|
+
locale: w
|
|
1848
1846
|
})
|
|
1849
1847
|
}),
|
|
1850
|
-
|
|
1851
|
-
rendered:
|
|
1852
|
-
field:
|
|
1853
|
-
fieldName:
|
|
1854
|
-
value: t[
|
|
1848
|
+
z && t[z] != null && z !== R && r.fields.get(z) && /* @__PURE__ */ Y(St, {
|
|
1849
|
+
rendered: N({
|
|
1850
|
+
field: r.fields.get(z),
|
|
1851
|
+
fieldName: z,
|
|
1852
|
+
value: t[z],
|
|
1855
1853
|
mode: "display",
|
|
1856
1854
|
record: t,
|
|
1857
|
-
refs:
|
|
1858
|
-
locale:
|
|
1855
|
+
refs: p,
|
|
1856
|
+
locale: w
|
|
1859
1857
|
}),
|
|
1860
|
-
text:
|
|
1858
|
+
text: D(t[z])
|
|
1861
1859
|
})
|
|
1862
1860
|
]
|
|
1863
1861
|
});
|
|
@@ -1868,12 +1866,12 @@ function St({ rendered: e, text: t }) {
|
|
|
1868
1866
|
fontWeight: 400,
|
|
1869
1867
|
marginTop: 6
|
|
1870
1868
|
};
|
|
1871
|
-
if (!_t(t)) return /* @__PURE__ */
|
|
1869
|
+
if (!_t(t)) return /* @__PURE__ */ Y("div", {
|
|
1872
1870
|
style: n,
|
|
1873
1871
|
children: e
|
|
1874
1872
|
});
|
|
1875
1873
|
let r = t.length > ht, i = r ? t.slice(0, ht) : t;
|
|
1876
|
-
return /* @__PURE__ */
|
|
1874
|
+
return /* @__PURE__ */ Y("div", {
|
|
1877
1875
|
style: {
|
|
1878
1876
|
...n,
|
|
1879
1877
|
display: "-webkit-box",
|
|
@@ -1883,15 +1881,15 @@ function St({ rendered: e, text: t }) {
|
|
|
1883
1881
|
whiteSpace: "pre-wrap",
|
|
1884
1882
|
overflowWrap: "anywhere"
|
|
1885
1883
|
},
|
|
1886
|
-
children: /* @__PURE__ */
|
|
1884
|
+
children: /* @__PURE__ */ Y(T, {
|
|
1887
1885
|
width: 380,
|
|
1888
|
-
content: /* @__PURE__ */
|
|
1886
|
+
content: /* @__PURE__ */ X("div", {
|
|
1889
1887
|
style: {
|
|
1890
1888
|
fontSize: 12.5,
|
|
1891
1889
|
whiteSpace: "pre-wrap",
|
|
1892
1890
|
overflowWrap: "anywhere"
|
|
1893
1891
|
},
|
|
1894
|
-
children: [i, r && /* @__PURE__ */
|
|
1892
|
+
children: [i, r && /* @__PURE__ */ Y("div", {
|
|
1895
1893
|
style: {
|
|
1896
1894
|
marginTop: 8,
|
|
1897
1895
|
fontSize: 11,
|
|
@@ -1906,12 +1904,12 @@ function St({ rendered: e, text: t }) {
|
|
|
1906
1904
|
}
|
|
1907
1905
|
function Ct(e) {
|
|
1908
1906
|
if (e == null) return "";
|
|
1909
|
-
let t = new Date(
|
|
1907
|
+
let t = new Date(D(e));
|
|
1910
1908
|
return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
|
|
1911
1909
|
}
|
|
1912
1910
|
function wt(e) {
|
|
1913
1911
|
if (e == null) return "—";
|
|
1914
|
-
let t = new Date(
|
|
1912
|
+
let t = new Date(D(e));
|
|
1915
1913
|
if (Number.isNaN(t.getTime())) return "—";
|
|
1916
1914
|
let n = /* @__PURE__ */ new Date(), r = /* @__PURE__ */ new Date();
|
|
1917
1915
|
r.setDate(n.getDate() - 1);
|
|
@@ -1923,7 +1921,7 @@ function wt(e) {
|
|
|
1923
1921
|
});
|
|
1924
1922
|
}
|
|
1925
1923
|
function Tt({ label: e, count: t }) {
|
|
1926
|
-
return /* @__PURE__ */
|
|
1924
|
+
return /* @__PURE__ */ X("div", {
|
|
1927
1925
|
style: {
|
|
1928
1926
|
position: "sticky",
|
|
1929
1927
|
top: -4,
|
|
@@ -1935,7 +1933,7 @@ function Tt({ label: e, count: t }) {
|
|
|
1935
1933
|
background: "linear-gradient(180deg, var(--surface-2) 0%, var(--surface-2) 65%, transparent 100%)"
|
|
1936
1934
|
},
|
|
1937
1935
|
children: [
|
|
1938
|
-
/* @__PURE__ */
|
|
1936
|
+
/* @__PURE__ */ Y("span", {
|
|
1939
1937
|
style: {
|
|
1940
1938
|
fontSize: 11,
|
|
1941
1939
|
fontWeight: 600,
|
|
@@ -1943,12 +1941,12 @@ function Tt({ label: e, count: t }) {
|
|
|
1943
1941
|
},
|
|
1944
1942
|
children: e
|
|
1945
1943
|
}),
|
|
1946
|
-
/* @__PURE__ */
|
|
1944
|
+
/* @__PURE__ */ Y("span", { style: {
|
|
1947
1945
|
flex: 1,
|
|
1948
1946
|
height: 1,
|
|
1949
1947
|
background: "var(--divider)"
|
|
1950
1948
|
} }),
|
|
1951
|
-
/* @__PURE__ */
|
|
1949
|
+
/* @__PURE__ */ Y("span", {
|
|
1952
1950
|
className: "num",
|
|
1953
1951
|
style: {
|
|
1954
1952
|
fontSize: 10.5,
|
|
@@ -1961,7 +1959,7 @@ function Tt({ label: e, count: t }) {
|
|
|
1961
1959
|
}
|
|
1962
1960
|
function Et({ value: t, field: n }) {
|
|
1963
1961
|
let r = Dt(t, n);
|
|
1964
|
-
return r === null ? null : /* @__PURE__ */
|
|
1962
|
+
return r === null ? null : /* @__PURE__ */ X("span", {
|
|
1965
1963
|
style: {
|
|
1966
1964
|
display: "inline-flex",
|
|
1967
1965
|
alignItems: "center",
|
|
@@ -1973,7 +1971,7 @@ function Et({ value: t, field: n }) {
|
|
|
1973
1971
|
background: r ? "var(--accent-soft)" : "var(--info-soft)",
|
|
1974
1972
|
color: r ? "var(--accent)" : "var(--info)"
|
|
1975
1973
|
},
|
|
1976
|
-
children: [
|
|
1974
|
+
children: [Y(r ? e.arrowUp : e.arrowDown, { size: 10 }), r ? "Out" : "In"]
|
|
1977
1975
|
});
|
|
1978
1976
|
}
|
|
1979
1977
|
function Dt(e, t) {
|
|
@@ -1987,71 +1985,71 @@ function Dt(e, t) {
|
|
|
1987
1985
|
}
|
|
1988
1986
|
//#endregion
|
|
1989
1987
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
1990
|
-
function Ot({ config: t, childEntity: n, schema:
|
|
1991
|
-
let
|
|
1992
|
-
if (
|
|
1988
|
+
function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, validationErrors: o, refs: d, forceTablePresentation: f = !1 }) {
|
|
1989
|
+
let p = k(), m = s(), h = K(null), g = t.columns, _ = t.position_field, v = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), y = g.filter((e) => {
|
|
1990
|
+
if (v.has(e) || t.position_field && e === t.position_field) return !1;
|
|
1993
1991
|
let r = n.fields.get(e);
|
|
1994
1992
|
return !(!r || r.auto || r.primary || r.source);
|
|
1995
|
-
}),
|
|
1993
|
+
}), b = new Set(g.filter((e) => {
|
|
1996
1994
|
if (t.position_field && e === t.position_field) return !0;
|
|
1997
1995
|
let r = n.fields.get(e);
|
|
1998
1996
|
return r && (r.auto || r.primary || r.source);
|
|
1999
|
-
})),
|
|
2000
|
-
|
|
1997
|
+
})), x = U((e, t, n) => {
|
|
1998
|
+
a(i.map((r) => r._key === e ? {
|
|
2001
1999
|
...r,
|
|
2002
2000
|
[t]: n,
|
|
2003
2001
|
_dirty: !0
|
|
2004
2002
|
} : r));
|
|
2005
|
-
}, [
|
|
2003
|
+
}, [i, a]), S = U(() => {
|
|
2006
2004
|
let e = {
|
|
2007
2005
|
_key: crypto.randomUUID(),
|
|
2008
2006
|
_dirty: !0
|
|
2009
2007
|
};
|
|
2010
|
-
if (
|
|
2011
|
-
let t =
|
|
2012
|
-
let n = typeof t[
|
|
2008
|
+
if (_) {
|
|
2009
|
+
let t = i.filter((e) => !e._deleted).reduce((e, t) => {
|
|
2010
|
+
let n = typeof t[_] == "number" ? t[_] : -1;
|
|
2013
2011
|
return Math.max(e, n);
|
|
2014
2012
|
}, -1);
|
|
2015
|
-
e[
|
|
2013
|
+
e[_] = t + 1;
|
|
2016
2014
|
}
|
|
2017
2015
|
let r = t.quick_add?.defaults ?? {};
|
|
2018
|
-
for (let t of
|
|
2016
|
+
for (let t of y) {
|
|
2019
2017
|
let i = n.fields.get(t);
|
|
2020
2018
|
i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
|
|
2021
2019
|
}
|
|
2022
|
-
|
|
2020
|
+
a([...i, e]);
|
|
2023
2021
|
}, [
|
|
2022
|
+
i,
|
|
2024
2023
|
a,
|
|
2025
|
-
|
|
2026
|
-
g,
|
|
2024
|
+
y,
|
|
2027
2025
|
n,
|
|
2028
2026
|
t.quick_add?.defaults,
|
|
2029
|
-
|
|
2030
|
-
]), C =
|
|
2031
|
-
|
|
2027
|
+
_
|
|
2028
|
+
]), C = U((e) => {
|
|
2029
|
+
a(i.map((t) => t._key === e ? {
|
|
2032
2030
|
...t,
|
|
2033
2031
|
_deleted: !0
|
|
2034
2032
|
} : t));
|
|
2035
|
-
}, [
|
|
2036
|
-
|
|
2033
|
+
}, [i, a]), w = U((e) => {
|
|
2034
|
+
a(i.map((t) => t._key === e ? {
|
|
2037
2035
|
...t,
|
|
2038
2036
|
_deleted: !1
|
|
2039
2037
|
} : t));
|
|
2040
|
-
}, [
|
|
2041
|
-
if (!
|
|
2042
|
-
let n =
|
|
2043
|
-
if (
|
|
2044
|
-
let c = [...n], [l] = c.splice(
|
|
2045
|
-
c.splice(s, 0, l),
|
|
2038
|
+
}, [i, a]), T = U((e, t) => {
|
|
2039
|
+
if (!_) return;
|
|
2040
|
+
let n = i.filter((e) => !e._deleted), r = i.filter((e) => e._deleted), o = n.findIndex((t) => t._key === e), s = o + t;
|
|
2041
|
+
if (o < 0 || s < 0 || s >= n.length) return;
|
|
2042
|
+
let c = [...n], [l] = c.splice(o, 1);
|
|
2043
|
+
c.splice(s, 0, l), a([...c.map((e, t) => ({
|
|
2046
2044
|
...e,
|
|
2047
|
-
[
|
|
2048
|
-
_dirty: e[
|
|
2045
|
+
[_]: t,
|
|
2046
|
+
_dirty: e[_] !== t || e._dirty
|
|
2049
2047
|
})), ...r]);
|
|
2050
2048
|
}, [
|
|
2049
|
+
i,
|
|
2051
2050
|
a,
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
]), D = H((e) => {
|
|
2051
|
+
_
|
|
2052
|
+
]), E = U((e) => {
|
|
2055
2053
|
let t = e.target, n = t.closest("td");
|
|
2056
2054
|
if (!n) return;
|
|
2057
2055
|
let r = n.closest("tr");
|
|
@@ -2075,7 +2073,7 @@ function Ot({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
|
|
|
2075
2073
|
if (o < t.length - 1) {
|
|
2076
2074
|
let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
|
|
2077
2075
|
e && e.focus();
|
|
2078
|
-
} else
|
|
2076
|
+
} else S(), requestAnimationFrame(() => {
|
|
2079
2077
|
let e = i.querySelectorAll("tr"), t = e[e.length - 1];
|
|
2080
2078
|
if (t) {
|
|
2081
2079
|
let e = t.querySelector("input, select, textarea, [tabindex]");
|
|
@@ -2083,24 +2081,24 @@ function Ot({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
|
|
|
2083
2081
|
}
|
|
2084
2082
|
});
|
|
2085
2083
|
} else e.key === "Escape" && t.blur?.();
|
|
2086
|
-
}, [
|
|
2087
|
-
return
|
|
2084
|
+
}, [S]), O = de;
|
|
2085
|
+
return m.isPhone && !f ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
2088
2086
|
style: {
|
|
2089
2087
|
display: "flex",
|
|
2090
2088
|
flexDirection: "column",
|
|
2091
2089
|
gap: 10
|
|
2092
2090
|
},
|
|
2093
|
-
children:
|
|
2094
|
-
let
|
|
2095
|
-
return /* @__PURE__ */
|
|
2091
|
+
children: i.map((t, a) => {
|
|
2092
|
+
let s = !!t._deleted, l = o?.[t._key], f = _ ? i.filter((e) => !e._deleted) : [], m = _ ? f.findIndex((e) => e._key === t._key) : -1;
|
|
2093
|
+
return /* @__PURE__ */ X("div", {
|
|
2096
2094
|
style: {
|
|
2097
2095
|
border: "1px solid var(--border)",
|
|
2098
2096
|
borderRadius: 8,
|
|
2099
2097
|
background: "var(--surface)",
|
|
2100
|
-
opacity:
|
|
2098
|
+
opacity: s ? .58 : 1,
|
|
2101
2099
|
overflow: "hidden"
|
|
2102
2100
|
},
|
|
2103
|
-
children: [/* @__PURE__ */
|
|
2101
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2104
2102
|
style: {
|
|
2105
2103
|
minHeight: 38,
|
|
2106
2104
|
padding: "8px 10px",
|
|
@@ -2110,140 +2108,140 @@ function Ot({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
|
|
|
2110
2108
|
justifyContent: "space-between",
|
|
2111
2109
|
gap: 8
|
|
2112
2110
|
},
|
|
2113
|
-
children: [/* @__PURE__ */
|
|
2111
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2114
2112
|
style: {
|
|
2115
2113
|
fontSize: 12,
|
|
2116
2114
|
fontWeight: 600,
|
|
2117
2115
|
color: "var(--text-2)"
|
|
2118
2116
|
},
|
|
2119
|
-
children: ["Row ",
|
|
2120
|
-
}), /* @__PURE__ */
|
|
2117
|
+
children: ["Row ", a + 1]
|
|
2118
|
+
}), /* @__PURE__ */ X("div", {
|
|
2121
2119
|
style: {
|
|
2122
2120
|
display: "flex",
|
|
2123
2121
|
alignItems: "center",
|
|
2124
2122
|
gap: 4
|
|
2125
2123
|
},
|
|
2126
|
-
children: [
|
|
2124
|
+
children: [_ && !s && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(c, {
|
|
2127
2125
|
size: 32,
|
|
2128
|
-
icon: /* @__PURE__ */
|
|
2129
|
-
onClick: () =>
|
|
2130
|
-
disabled:
|
|
2126
|
+
icon: /* @__PURE__ */ Y(e.up, { size: 14 }),
|
|
2127
|
+
onClick: () => T(t._key, -1),
|
|
2128
|
+
disabled: m <= 0,
|
|
2131
2129
|
title: "Move row up"
|
|
2132
|
-
}), /* @__PURE__ */
|
|
2130
|
+
}), /* @__PURE__ */ Y(c, {
|
|
2133
2131
|
size: 32,
|
|
2134
|
-
icon: /* @__PURE__ */
|
|
2135
|
-
onClick: () =>
|
|
2136
|
-
disabled:
|
|
2132
|
+
icon: /* @__PURE__ */ Y(e.down, { size: 14 }),
|
|
2133
|
+
onClick: () => T(t._key, 1),
|
|
2134
|
+
disabled: m === -1 || m >= f.length - 1,
|
|
2137
2135
|
title: "Move row down"
|
|
2138
|
-
})] }),
|
|
2136
|
+
})] }), s ? /* @__PURE__ */ Y(c, {
|
|
2139
2137
|
size: 32,
|
|
2140
|
-
icon: /* @__PURE__ */
|
|
2138
|
+
icon: /* @__PURE__ */ Y(e.refresh, { size: 14 }),
|
|
2141
2139
|
onClick: () => w(t._key),
|
|
2142
2140
|
title: "Undo delete"
|
|
2143
|
-
}) : /* @__PURE__ */
|
|
2141
|
+
}) : /* @__PURE__ */ Y(c, {
|
|
2144
2142
|
size: 32,
|
|
2145
|
-
icon: /* @__PURE__ */
|
|
2143
|
+
icon: /* @__PURE__ */ Y(e.trash, { size: 14 }),
|
|
2146
2144
|
onClick: () => C(t._key),
|
|
2147
2145
|
title: "Delete row"
|
|
2148
2146
|
})]
|
|
2149
2147
|
})]
|
|
2150
|
-
}), /* @__PURE__ */
|
|
2148
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2151
2149
|
style: {
|
|
2152
2150
|
padding: 10,
|
|
2153
2151
|
display: "flex",
|
|
2154
2152
|
flexDirection: "column",
|
|
2155
2153
|
gap: 12
|
|
2156
2154
|
},
|
|
2157
|
-
children:
|
|
2158
|
-
let
|
|
2155
|
+
children: g.map((e) => {
|
|
2156
|
+
let i = n.fields.get(e), a = l?.includes(e), o = b.has(e), c = i ? u(i, e, r.entities) : e, f = `child-${t._key}-${e}`, m = `${f}-label`, h = {
|
|
2159
2157
|
outline: a ? "1px solid var(--danger)" : "none",
|
|
2160
2158
|
outlineOffset: 3,
|
|
2161
2159
|
borderRadius: a ? 5 : 0
|
|
2162
|
-
},
|
|
2160
|
+
}, g = {
|
|
2163
2161
|
fontSize: 11.5,
|
|
2164
2162
|
fontWeight: 600,
|
|
2165
2163
|
color: "var(--text-3)"
|
|
2166
|
-
},
|
|
2167
|
-
return /* @__PURE__ */
|
|
2164
|
+
}, _ = !s && !o && !!i;
|
|
2165
|
+
return /* @__PURE__ */ X("div", {
|
|
2168
2166
|
style: {
|
|
2169
2167
|
display: "flex",
|
|
2170
2168
|
flexDirection: "column",
|
|
2171
2169
|
gap: 5,
|
|
2172
2170
|
minWidth: 0,
|
|
2173
|
-
textDecoration:
|
|
2171
|
+
textDecoration: s ? "line-through" : "none"
|
|
2174
2172
|
},
|
|
2175
2173
|
title: a ? `${e} is required` : void 0,
|
|
2176
|
-
children: [
|
|
2177
|
-
id:
|
|
2174
|
+
children: [_ ? /* @__PURE__ */ Y("label", {
|
|
2175
|
+
id: m,
|
|
2178
2176
|
htmlFor: f,
|
|
2177
|
+
style: g,
|
|
2178
|
+
children: c
|
|
2179
|
+
}) : /* @__PURE__ */ Y("div", {
|
|
2180
|
+
id: m,
|
|
2181
|
+
style: g,
|
|
2182
|
+
children: c
|
|
2183
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2179
2184
|
style: h,
|
|
2180
|
-
children:
|
|
2181
|
-
|
|
2182
|
-
id: p,
|
|
2183
|
-
style: h,
|
|
2184
|
-
children: d
|
|
2185
|
-
}), /* @__PURE__ */ J("div", {
|
|
2186
|
-
style: m,
|
|
2187
|
-
children: o || s ? r ? S({
|
|
2188
|
-
field: r,
|
|
2185
|
+
children: s || o ? i ? N({
|
|
2186
|
+
field: i,
|
|
2189
2187
|
fieldName: e,
|
|
2190
2188
|
value: t[e],
|
|
2191
2189
|
mode: "display",
|
|
2192
2190
|
record: t,
|
|
2193
|
-
refs:
|
|
2191
|
+
refs: d,
|
|
2194
2192
|
fieldId: f,
|
|
2195
|
-
labelId:
|
|
2196
|
-
locale:
|
|
2197
|
-
}) :
|
|
2198
|
-
field:
|
|
2193
|
+
labelId: m,
|
|
2194
|
+
locale: p
|
|
2195
|
+
}) : D(t[e]) : i ? N({
|
|
2196
|
+
field: i,
|
|
2199
2197
|
fieldName: e,
|
|
2200
2198
|
value: t[e],
|
|
2201
2199
|
mode: "edit",
|
|
2202
|
-
onChange: (n) =>
|
|
2200
|
+
onChange: (n) => x(t._key, e, n),
|
|
2203
2201
|
record: t,
|
|
2204
|
-
refs:
|
|
2202
|
+
refs: d,
|
|
2205
2203
|
compact: !0,
|
|
2206
2204
|
fieldId: f,
|
|
2207
|
-
labelId:
|
|
2208
|
-
locale:
|
|
2209
|
-
}) :
|
|
2205
|
+
labelId: m,
|
|
2206
|
+
locale: p
|
|
2207
|
+
}) : D(t[e])
|
|
2210
2208
|
})]
|
|
2211
2209
|
}, e);
|
|
2212
2210
|
})
|
|
2213
2211
|
})]
|
|
2214
2212
|
}, t._key);
|
|
2215
2213
|
})
|
|
2216
|
-
}), /* @__PURE__ */
|
|
2214
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2217
2215
|
style: { marginTop: 10 },
|
|
2218
|
-
children: /* @__PURE__ */
|
|
2216
|
+
children: /* @__PURE__ */ Y(l, {
|
|
2219
2217
|
kind: "ghost",
|
|
2220
2218
|
size: "sm",
|
|
2221
|
-
icon: /* @__PURE__ */
|
|
2222
|
-
onClick:
|
|
2219
|
+
icon: /* @__PURE__ */ Y(e.plus, { size: 14 }),
|
|
2220
|
+
onClick: S,
|
|
2223
2221
|
children: "Add row"
|
|
2224
2222
|
})
|
|
2225
|
-
})] }) : /* @__PURE__ */
|
|
2223
|
+
})] }) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
2226
2224
|
style: { overflowX: "auto" },
|
|
2227
|
-
children: /* @__PURE__ */
|
|
2228
|
-
ref:
|
|
2225
|
+
children: /* @__PURE__ */ X("table", {
|
|
2226
|
+
ref: h,
|
|
2229
2227
|
style: fe,
|
|
2230
|
-
onKeyDown:
|
|
2231
|
-
children: [/* @__PURE__ */
|
|
2228
|
+
onKeyDown: E,
|
|
2229
|
+
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", { children: [g.map((e) => {
|
|
2232
2230
|
let t = n.fields.get(e);
|
|
2233
|
-
return /* @__PURE__ */
|
|
2231
|
+
return /* @__PURE__ */ Y("th", {
|
|
2234
2232
|
style: O,
|
|
2235
|
-
children: t ?
|
|
2233
|
+
children: t ? u(t, e, r.entities) : e
|
|
2236
2234
|
}, e);
|
|
2237
|
-
}), /* @__PURE__ */
|
|
2235
|
+
}), /* @__PURE__ */ Y("th", { style: {
|
|
2238
2236
|
...O,
|
|
2239
2237
|
width: 40
|
|
2240
|
-
} })] }) }), /* @__PURE__ */
|
|
2241
|
-
let r = !!t._deleted, i =
|
|
2242
|
-
return /* @__PURE__ */
|
|
2238
|
+
} })] }) }), /* @__PURE__ */ Y("tbody", { children: i.map((t) => {
|
|
2239
|
+
let r = !!t._deleted, i = o?.[t._key];
|
|
2240
|
+
return /* @__PURE__ */ X("tr", {
|
|
2243
2241
|
style: { opacity: r ? .5 : 1 },
|
|
2244
|
-
children: [
|
|
2245
|
-
let a = n.fields.get(e), o = i?.includes(e), s =
|
|
2246
|
-
return r || s ? /* @__PURE__ */
|
|
2242
|
+
children: [g.map((e) => {
|
|
2243
|
+
let a = n.fields.get(e), o = i?.includes(e), s = b.has(e);
|
|
2244
|
+
return r || s ? /* @__PURE__ */ Y("td", {
|
|
2247
2245
|
style: {
|
|
2248
2246
|
padding: "6px 12px",
|
|
2249
2247
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -2251,16 +2249,16 @@ function Ot({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
|
|
|
2251
2249
|
textDecoration: r ? "line-through" : "none",
|
|
2252
2250
|
color: "var(--text-2)"
|
|
2253
2251
|
},
|
|
2254
|
-
children: a ?
|
|
2252
|
+
children: a ? N({
|
|
2255
2253
|
field: a,
|
|
2256
2254
|
fieldName: e,
|
|
2257
2255
|
value: t[e],
|
|
2258
2256
|
mode: "display",
|
|
2259
2257
|
record: t,
|
|
2260
|
-
refs:
|
|
2261
|
-
locale:
|
|
2262
|
-
}) :
|
|
2263
|
-
}, e) : /* @__PURE__ */
|
|
2258
|
+
refs: d,
|
|
2259
|
+
locale: p
|
|
2260
|
+
}) : D(t[e])
|
|
2261
|
+
}, e) : /* @__PURE__ */ Y("td", {
|
|
2264
2262
|
style: {
|
|
2265
2263
|
padding: "4px 4px",
|
|
2266
2264
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -2270,32 +2268,32 @@ function Ot({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
|
|
|
2270
2268
|
borderRadius: o ? 4 : 0
|
|
2271
2269
|
},
|
|
2272
2270
|
title: o ? `${e} is required` : void 0,
|
|
2273
|
-
children: a ?
|
|
2271
|
+
children: a ? N({
|
|
2274
2272
|
field: a,
|
|
2275
2273
|
fieldName: e,
|
|
2276
2274
|
value: t[e],
|
|
2277
2275
|
mode: "edit",
|
|
2278
|
-
onChange: (n) =>
|
|
2276
|
+
onChange: (n) => x(t._key, e, n),
|
|
2279
2277
|
record: t,
|
|
2280
|
-
refs:
|
|
2278
|
+
refs: d,
|
|
2281
2279
|
compact: !0,
|
|
2282
|
-
locale:
|
|
2283
|
-
}) :
|
|
2280
|
+
locale: p
|
|
2281
|
+
}) : D(t[e])
|
|
2284
2282
|
}, e);
|
|
2285
|
-
}), /* @__PURE__ */
|
|
2283
|
+
}), /* @__PURE__ */ Y("td", {
|
|
2286
2284
|
style: {
|
|
2287
2285
|
padding: "4px 8px",
|
|
2288
2286
|
borderBottom: "1px solid var(--divider)",
|
|
2289
2287
|
verticalAlign: "middle"
|
|
2290
2288
|
},
|
|
2291
|
-
children: r ? /* @__PURE__ */
|
|
2289
|
+
children: r ? /* @__PURE__ */ Y(c, {
|
|
2292
2290
|
size: 24,
|
|
2293
|
-
icon: /* @__PURE__ */
|
|
2291
|
+
icon: /* @__PURE__ */ Y(e.refresh, { size: 12 }),
|
|
2294
2292
|
onClick: () => w(t._key),
|
|
2295
2293
|
title: "Undo delete"
|
|
2296
|
-
}) : /* @__PURE__ */
|
|
2294
|
+
}) : /* @__PURE__ */ Y(c, {
|
|
2297
2295
|
size: 24,
|
|
2298
|
-
icon: /* @__PURE__ */
|
|
2296
|
+
icon: /* @__PURE__ */ Y(e.trash, { size: 12 }),
|
|
2299
2297
|
onClick: () => C(t._key),
|
|
2300
2298
|
title: "Delete row"
|
|
2301
2299
|
})
|
|
@@ -2303,50 +2301,50 @@ function Ot({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
|
|
|
2303
2301
|
}, t._key);
|
|
2304
2302
|
}) })]
|
|
2305
2303
|
})
|
|
2306
|
-
}), /* @__PURE__ */
|
|
2304
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2307
2305
|
style: { marginTop: 8 },
|
|
2308
|
-
children: /* @__PURE__ */
|
|
2306
|
+
children: /* @__PURE__ */ Y(l, {
|
|
2309
2307
|
kind: "ghost",
|
|
2310
2308
|
size: "xs",
|
|
2311
|
-
icon: /* @__PURE__ */
|
|
2312
|
-
onClick:
|
|
2309
|
+
icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
|
|
2310
|
+
onClick: S,
|
|
2313
2311
|
children: "Add row"
|
|
2314
2312
|
})
|
|
2315
2313
|
})] });
|
|
2316
2314
|
}
|
|
2317
2315
|
//#endregion
|
|
2318
2316
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
2319
|
-
var kt = ge(() => import("./DraggableChildrenTable-
|
|
2317
|
+
var kt = ge(() => import("./DraggableChildrenTable-CPoUY99R.js").then((e) => ({ default: e.DraggableChildrenTable })));
|
|
2320
2318
|
function At({ node: e, ctx: n }) {
|
|
2321
|
-
let r =
|
|
2319
|
+
let r = s(), i = e.children;
|
|
2322
2320
|
if (!i) return null;
|
|
2323
2321
|
let a = r.isPhone && n.relatedRecordsPresentation === "table";
|
|
2324
2322
|
if (n.isNew && n.mode !== "edit") return null;
|
|
2325
2323
|
let o = Ke(n.entity, i);
|
|
2326
|
-
if (!o) return /* @__PURE__ */
|
|
2324
|
+
if (!o) return /* @__PURE__ */ X("div", {
|
|
2327
2325
|
className: "text-sm text-muted-foreground py-2",
|
|
2328
2326
|
children: ["Unknown child relation: ", i]
|
|
2329
2327
|
});
|
|
2330
|
-
let
|
|
2331
|
-
if (!
|
|
2328
|
+
let c = n.schema.entities[o.entity];
|
|
2329
|
+
if (!c) return /* @__PURE__ */ X("div", {
|
|
2332
2330
|
className: "text-sm text-muted-foreground py-2",
|
|
2333
2331
|
children: ["Entity not found: ", o.entity]
|
|
2334
2332
|
});
|
|
2335
|
-
let
|
|
2336
|
-
title:
|
|
2337
|
-
icon:
|
|
2338
|
-
name:
|
|
2333
|
+
let l = Pe(o, c, e), u = Ae(e, n), d = je(e, n), p = (e) => l.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ Y(R, {
|
|
2334
|
+
title: u,
|
|
2335
|
+
icon: d ? /* @__PURE__ */ Y(t, {
|
|
2336
|
+
name: d,
|
|
2339
2337
|
size: 14
|
|
2340
2338
|
}) : void 0,
|
|
2341
2339
|
children: e
|
|
2342
2340
|
});
|
|
2343
|
-
if (n.mode === "edit" &&
|
|
2344
|
-
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o =
|
|
2345
|
-
return
|
|
2346
|
-
fallback: /* @__PURE__ */
|
|
2347
|
-
children: /* @__PURE__ */
|
|
2348
|
-
config:
|
|
2349
|
-
childEntity:
|
|
2341
|
+
if (n.mode === "edit" && l.editable && l.interaction !== "navigate" && l.interaction !== "readonly" && f(c, "update") && l.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
|
|
2342
|
+
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = l.position_field ? r.isPhone && !a ? Ot : kt : Ot;
|
|
2343
|
+
return p(/* @__PURE__ */ Y(me, {
|
|
2344
|
+
fallback: /* @__PURE__ */ Y(ue, {}),
|
|
2345
|
+
children: /* @__PURE__ */ Y(o, {
|
|
2346
|
+
config: l,
|
|
2347
|
+
childEntity: c,
|
|
2350
2348
|
schema: n.schema,
|
|
2351
2349
|
rows: e,
|
|
2352
2350
|
onChange: (e) => n.onChildrenChange(i, e),
|
|
@@ -2357,17 +2355,17 @@ function At({ node: e, ctx: n }) {
|
|
|
2357
2355
|
}));
|
|
2358
2356
|
}
|
|
2359
2357
|
if (n.isNew) return null;
|
|
2360
|
-
let
|
|
2361
|
-
config:
|
|
2358
|
+
let m = {
|
|
2359
|
+
config: l,
|
|
2362
2360
|
parentEntity: n.entityCode,
|
|
2363
2361
|
parentId: n.recordId,
|
|
2364
2362
|
schema: n.schema
|
|
2365
2363
|
};
|
|
2366
|
-
switch (
|
|
2367
|
-
case "list": return
|
|
2368
|
-
case "cards": return
|
|
2369
|
-
case "timeline": return
|
|
2370
|
-
default: return r.isPhone && !a ?
|
|
2364
|
+
switch (l.mode) {
|
|
2365
|
+
case "list": return p(/* @__PURE__ */ Y(nt, { ...m }));
|
|
2366
|
+
case "cards": return p(/* @__PURE__ */ Y(rt, { ...m }));
|
|
2367
|
+
case "timeline": return p(/* @__PURE__ */ Y(bt, { ...m }));
|
|
2368
|
+
default: return r.isPhone && !a ? p(/* @__PURE__ */ Y(rt, { ...m })) : p(/* @__PURE__ */ Y(tt, { ...m }));
|
|
2371
2369
|
}
|
|
2372
2370
|
}
|
|
2373
2371
|
//#endregion
|
|
@@ -2383,8 +2381,8 @@ var jt = 150, Mt = 560, Nt = 270, Pt = "20px", Ft = 4, It = /* @__PURE__ */ new
|
|
|
2383
2381
|
stackPairs: !1
|
|
2384
2382
|
});
|
|
2385
2383
|
function Rt({ columns: e = 2, children: t }) {
|
|
2386
|
-
let n =
|
|
2387
|
-
|
|
2384
|
+
let n = K(null), [r, i] = q(null);
|
|
2385
|
+
W(() => {
|
|
2388
2386
|
let e = n.current;
|
|
2389
2387
|
if (!e || typeof ResizeObserver > "u") return;
|
|
2390
2388
|
let t = new ResizeObserver(([e]) => {
|
|
@@ -2393,12 +2391,12 @@ function Rt({ columns: e = 2, children: t }) {
|
|
|
2393
2391
|
return t.observe(e), () => t.disconnect();
|
|
2394
2392
|
}, []);
|
|
2395
2393
|
let a = e === 1 || r !== null && r < Mt ? 1 : e, o = r === null ? null : (r - (a - 1) * 24) / a, s = o !== null && o < Nt;
|
|
2396
|
-
return /* @__PURE__ */
|
|
2394
|
+
return /* @__PURE__ */ Y(Lt.Provider, {
|
|
2397
2395
|
value: {
|
|
2398
2396
|
columns: a,
|
|
2399
2397
|
stackPairs: s
|
|
2400
2398
|
},
|
|
2401
|
-
children: /* @__PURE__ */
|
|
2399
|
+
children: /* @__PURE__ */ Y("div", {
|
|
2402
2400
|
ref: n,
|
|
2403
2401
|
style: {
|
|
2404
2402
|
display: "grid",
|
|
@@ -2410,25 +2408,25 @@ function Rt({ columns: e = 2, children: t }) {
|
|
|
2410
2408
|
})
|
|
2411
2409
|
});
|
|
2412
2410
|
}
|
|
2413
|
-
function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
2414
|
-
let
|
|
2415
|
-
return /* @__PURE__ */
|
|
2411
|
+
function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint: s, actions: c, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
|
|
2412
|
+
let h = _e(Lt), g = r || h.stackPairs, _ = !!a;
|
|
2413
|
+
return /* @__PURE__ */ X("div", {
|
|
2416
2414
|
className: "detail-row",
|
|
2417
2415
|
"data-error": _ || void 0,
|
|
2418
|
-
"data-testid":
|
|
2416
|
+
"data-testid": m,
|
|
2419
2417
|
style: {
|
|
2420
2418
|
display: "flex",
|
|
2421
|
-
flexDirection:
|
|
2422
|
-
gap:
|
|
2423
|
-
alignItems:
|
|
2419
|
+
flexDirection: g ? "column" : "row",
|
|
2420
|
+
gap: g ? 4 : 16,
|
|
2421
|
+
alignItems: g ? "stretch" : "flex-start",
|
|
2424
2422
|
padding: "6px 0",
|
|
2425
2423
|
...r ? { gridColumn: "1 / -1" } : null
|
|
2426
2424
|
},
|
|
2427
|
-
children: [/* @__PURE__ */
|
|
2425
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2428
2426
|
style: {
|
|
2429
|
-
width:
|
|
2427
|
+
width: g ? "auto" : jt,
|
|
2430
2428
|
flexShrink: 0,
|
|
2431
|
-
paddingTop:
|
|
2429
|
+
paddingTop: g ? 0 : Ft,
|
|
2432
2430
|
fontSize: 12,
|
|
2433
2431
|
lineHeight: Pt,
|
|
2434
2432
|
fontWeight: 500,
|
|
@@ -2437,16 +2435,16 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2437
2435
|
alignItems: "flex-start",
|
|
2438
2436
|
gap: 2
|
|
2439
2437
|
},
|
|
2440
|
-
children: [
|
|
2441
|
-
id:
|
|
2442
|
-
htmlFor:
|
|
2443
|
-
title:
|
|
2438
|
+
children: [d ? /* @__PURE__ */ Y("label", {
|
|
2439
|
+
id: f,
|
|
2440
|
+
htmlFor: d,
|
|
2441
|
+
title: p || void 0,
|
|
2444
2442
|
children: t
|
|
2445
|
-
}) : /* @__PURE__ */
|
|
2446
|
-
id:
|
|
2447
|
-
title:
|
|
2443
|
+
}) : /* @__PURE__ */ Y("span", {
|
|
2444
|
+
id: f,
|
|
2445
|
+
title: p || void 0,
|
|
2448
2446
|
children: t
|
|
2449
|
-
}), i &&
|
|
2447
|
+
}), i && u === "edit" && /* @__PURE__ */ Y("span", {
|
|
2450
2448
|
"aria-hidden": "true",
|
|
2451
2449
|
style: {
|
|
2452
2450
|
color: "var(--danger)",
|
|
@@ -2454,7 +2452,7 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2454
2452
|
},
|
|
2455
2453
|
children: "*"
|
|
2456
2454
|
})]
|
|
2457
|
-
}), /* @__PURE__ */
|
|
2455
|
+
}), /* @__PURE__ */ X("div", {
|
|
2458
2456
|
style: {
|
|
2459
2457
|
flex: 1,
|
|
2460
2458
|
minWidth: 0,
|
|
@@ -2462,14 +2460,14 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2462
2460
|
flexDirection: "column",
|
|
2463
2461
|
gap: 3
|
|
2464
2462
|
},
|
|
2465
|
-
children: [/* @__PURE__ */
|
|
2463
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2466
2464
|
style: {
|
|
2467
2465
|
display: "flex",
|
|
2468
2466
|
alignItems: "flex-start",
|
|
2469
2467
|
gap: 6,
|
|
2470
2468
|
minHeight: 24
|
|
2471
2469
|
},
|
|
2472
|
-
children: [/* @__PURE__ */
|
|
2470
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2473
2471
|
style: {
|
|
2474
2472
|
flex: 1,
|
|
2475
2473
|
minWidth: 0,
|
|
@@ -2477,16 +2475,16 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2477
2475
|
lineHeight: Pt,
|
|
2478
2476
|
color: "var(--text)",
|
|
2479
2477
|
overflowWrap: "anywhere",
|
|
2480
|
-
paddingTop:
|
|
2478
|
+
paddingTop: u === "display" && !g ? Ft : 0
|
|
2481
2479
|
},
|
|
2482
|
-
children: _ &&
|
|
2480
|
+
children: _ && u === "edit" ? /* @__PURE__ */ Y("div", {
|
|
2483
2481
|
style: {
|
|
2484
2482
|
borderRadius: 6,
|
|
2485
2483
|
boxShadow: "0 0 0 1.5px var(--danger)"
|
|
2486
2484
|
},
|
|
2487
2485
|
children: n
|
|
2488
2486
|
}) : n
|
|
2489
|
-
}), (
|
|
2487
|
+
}), (l || c) && /* @__PURE__ */ X("div", {
|
|
2490
2488
|
className: "detail-row-action",
|
|
2491
2489
|
style: {
|
|
2492
2490
|
display: "flex",
|
|
@@ -2494,13 +2492,13 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2494
2492
|
flexShrink: 0,
|
|
2495
2493
|
marginTop: -2
|
|
2496
2494
|
},
|
|
2497
|
-
children: [
|
|
2498
|
-
value:
|
|
2495
|
+
children: [l && /* @__PURE__ */ Y(o, {
|
|
2496
|
+
value: l,
|
|
2499
2497
|
size: "sm",
|
|
2500
2498
|
title: "Copy value"
|
|
2501
|
-
}),
|
|
2499
|
+
}), c]
|
|
2502
2500
|
})]
|
|
2503
|
-
}), (_ ||
|
|
2501
|
+
}), (_ || s != null) && /* @__PURE__ */ X("div", {
|
|
2504
2502
|
style: {
|
|
2505
2503
|
fontSize: 11.5,
|
|
2506
2504
|
lineHeight: 1.4,
|
|
@@ -2509,7 +2507,7 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2509
2507
|
alignItems: "center",
|
|
2510
2508
|
gap: 4
|
|
2511
2509
|
},
|
|
2512
|
-
children: [_ && /* @__PURE__ */
|
|
2510
|
+
children: [_ && /* @__PURE__ */ Y(e.warning, { size: 11 }), /* @__PURE__ */ Y("span", { children: _ ? a : s })]
|
|
2513
2511
|
})]
|
|
2514
2512
|
})]
|
|
2515
2513
|
});
|
|
@@ -2517,44 +2515,44 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2517
2515
|
//#endregion
|
|
2518
2516
|
//#region src/components/detail-layout/FieldsBlock.tsx
|
|
2519
2517
|
function Bt({ fields: e, ctx: t }) {
|
|
2520
|
-
let { entity: n, entityCode:
|
|
2521
|
-
return /* @__PURE__ */
|
|
2522
|
-
columns:
|
|
2518
|
+
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = k(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
|
|
2519
|
+
return /* @__PURE__ */ Y(Rt, {
|
|
2520
|
+
columns: l,
|
|
2523
2521
|
children: e.map((e) => {
|
|
2524
|
-
let
|
|
2525
|
-
tier:
|
|
2526
|
-
tierDef: oe(
|
|
2527
|
-
requiredPermission:
|
|
2528
|
-
locale:
|
|
2529
|
-
variant:
|
|
2522
|
+
let l = e.code, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), m = !!(p?.auto || p?.readonly || p?.source), h = ae(n, l), g = h?.read === "denied", _ = h?.write === "denied", v = a === "display" ? g : _ || g, y = m || a === "edit" && _ ? "display" : a, x = v ? /* @__PURE__ */ Y(L, {
|
|
2523
|
+
tier: h.classification,
|
|
2524
|
+
tierDef: oe(s, n, l),
|
|
2525
|
+
requiredPermission: h?.required_permission,
|
|
2526
|
+
locale: c,
|
|
2527
|
+
variant: y === "edit" ? "input" : "value"
|
|
2530
2528
|
}) : le({
|
|
2531
2529
|
entity: n,
|
|
2532
|
-
entityCode:
|
|
2533
|
-
fieldName:
|
|
2534
|
-
record:
|
|
2535
|
-
mode:
|
|
2536
|
-
onChange:
|
|
2530
|
+
entityCode: r,
|
|
2531
|
+
fieldName: l,
|
|
2532
|
+
record: i,
|
|
2533
|
+
mode: y,
|
|
2534
|
+
onChange: o && !m ? (e) => o(l, e) : void 0,
|
|
2537
2535
|
refs: t.refs,
|
|
2538
|
-
entities:
|
|
2539
|
-
screens:
|
|
2540
|
-
locale:
|
|
2536
|
+
entities: s?.entities,
|
|
2537
|
+
screens: s?.screens,
|
|
2538
|
+
locale: c,
|
|
2541
2539
|
fieldId: d,
|
|
2542
|
-
labelId:
|
|
2540
|
+
labelId: f,
|
|
2543
2541
|
structure: e.structure,
|
|
2544
2542
|
detailScreen: e.detail_screen
|
|
2545
2543
|
});
|
|
2546
2544
|
if (!x) return null;
|
|
2547
|
-
let S =
|
|
2548
|
-
actionCode: `${
|
|
2545
|
+
let S = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ Y(J, { children: e.actions.map((e, t) => /* @__PURE__ */ Y(I, {
|
|
2546
|
+
actionCode: `${l}.action[${t}]`,
|
|
2549
2547
|
action: e,
|
|
2550
|
-
entityCode:
|
|
2551
|
-
row:
|
|
2548
|
+
entityCode: r,
|
|
2549
|
+
row: i,
|
|
2552
2550
|
variant: "ghost",
|
|
2553
2551
|
size: "icon"
|
|
2554
|
-
}, t)) }) : void 0, C = !!
|
|
2555
|
-
return
|
|
2552
|
+
}, t)) }) : void 0, C = !!p && It.has(p.type), w = i?.[l], T = y === "display" && (p?.copyable || p?.type === "uuid") && w != null && w !== "" ? D(w) : void 0, E = b(p?.display?.description);
|
|
2553
|
+
return u ? /* @__PURE__ */ X("div", {
|
|
2556
2554
|
style: { gridColumn: "1 / -1" },
|
|
2557
|
-
children: [x,
|
|
2555
|
+
children: [x, y === "edit" && E && /* @__PURE__ */ Y("div", {
|
|
2558
2556
|
style: {
|
|
2559
2557
|
fontSize: 11.5,
|
|
2560
2558
|
lineHeight: 1.4,
|
|
@@ -2563,21 +2561,21 @@ function Bt({ fields: e, ctx: t }) {
|
|
|
2563
2561
|
},
|
|
2564
2562
|
children: E
|
|
2565
2563
|
})]
|
|
2566
|
-
},
|
|
2567
|
-
"data-testid": `field-${
|
|
2568
|
-
label: ce(n,
|
|
2569
|
-
htmlFor:
|
|
2570
|
-
labelId:
|
|
2564
|
+
}, l) : /* @__PURE__ */ Y(zt, {
|
|
2565
|
+
"data-testid": `field-${l}`,
|
|
2566
|
+
label: ce(n, l, s.entities),
|
|
2567
|
+
htmlFor: y === "edit" ? d : void 0,
|
|
2568
|
+
labelId: f,
|
|
2571
2569
|
labelTitle: E || void 0,
|
|
2572
|
-
required:
|
|
2573
|
-
mode:
|
|
2570
|
+
required: p?.required ?? !1,
|
|
2571
|
+
mode: y,
|
|
2574
2572
|
span: C,
|
|
2575
|
-
error: t.fieldErrors?.[
|
|
2576
|
-
hint:
|
|
2573
|
+
error: t.fieldErrors?.[l],
|
|
2574
|
+
hint: y === "edit" && E ? E : void 0,
|
|
2577
2575
|
actions: S,
|
|
2578
2576
|
copyValue: T,
|
|
2579
2577
|
children: x
|
|
2580
|
-
},
|
|
2578
|
+
}, l);
|
|
2581
2579
|
})
|
|
2582
2580
|
});
|
|
2583
2581
|
}
|
|
@@ -2595,17 +2593,17 @@ var Vt = /* @__PURE__ */ new Set([
|
|
|
2595
2593
|
function Ut({ node: e, ctx: t }) {
|
|
2596
2594
|
let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
|
|
2597
2595
|
if (a) return null;
|
|
2598
|
-
let l = e.properties === !0 || e.properties,
|
|
2599
|
-
return
|
|
2596
|
+
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]]);
|
|
2597
|
+
return u.length === 0 ? null : /* @__PURE__ */ Y(Rt, {
|
|
2600
2598
|
columns: 2,
|
|
2601
|
-
children:
|
|
2602
|
-
let c = r?.find((t) => t.property_code === e), l =
|
|
2603
|
-
return /* @__PURE__ */
|
|
2599
|
+
children: u.map(([e, a]) => {
|
|
2600
|
+
let c = r?.find((t) => t.property_code === e), l = O(a), u = a.readonly || !i ? "display" : o;
|
|
2601
|
+
return /* @__PURE__ */ Y(Wt, {
|
|
2604
2602
|
propCode: e,
|
|
2605
2603
|
prop: a,
|
|
2606
2604
|
field: l,
|
|
2607
2605
|
value: c?.value,
|
|
2608
|
-
mode:
|
|
2606
|
+
mode: u,
|
|
2609
2607
|
onSetProperty: i,
|
|
2610
2608
|
refs: s,
|
|
2611
2609
|
entity: n,
|
|
@@ -2614,36 +2612,36 @@ function Ut({ node: e, ctx: t }) {
|
|
|
2614
2612
|
})
|
|
2615
2613
|
});
|
|
2616
2614
|
}
|
|
2617
|
-
function Wt({ propCode: e, prop: t, field: n, value:
|
|
2618
|
-
let
|
|
2619
|
-
|
|
2620
|
-
|
|
2615
|
+
function Wt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: s, schema: c }) {
|
|
2616
|
+
let l = k(), u = K(null);
|
|
2617
|
+
W(() => () => {
|
|
2618
|
+
u.current && clearTimeout(u.current);
|
|
2621
2619
|
}, []);
|
|
2622
|
-
let
|
|
2623
|
-
|
|
2620
|
+
let d = U((n) => {
|
|
2621
|
+
a && (Vt.has(t.type) ? (u.current && clearTimeout(u.current), u.current = setTimeout(() => a(e, n), Ht)) : a(e, n));
|
|
2624
2622
|
}, [
|
|
2625
2623
|
e,
|
|
2626
2624
|
t.type,
|
|
2627
|
-
|
|
2628
|
-
]),
|
|
2629
|
-
return /* @__PURE__ */
|
|
2630
|
-
label:
|
|
2631
|
-
mode:
|
|
2625
|
+
a
|
|
2626
|
+
]), f = ae(s, e), p = f?.read === "denied", m = f?.write === "denied", h = i === "display" ? p : m || p, g = i === "edit" && m ? "display" : i;
|
|
2627
|
+
return /* @__PURE__ */ Y(zt, {
|
|
2628
|
+
label: b(t.display?.name ?? t.name),
|
|
2629
|
+
mode: g,
|
|
2632
2630
|
span: It.has(t.type),
|
|
2633
|
-
children:
|
|
2634
|
-
tier:
|
|
2635
|
-
tierDef: oe(
|
|
2636
|
-
requiredPermission:
|
|
2637
|
-
locale:
|
|
2638
|
-
variant:
|
|
2639
|
-
}) :
|
|
2631
|
+
children: h ? /* @__PURE__ */ Y(L, {
|
|
2632
|
+
tier: f.classification,
|
|
2633
|
+
tierDef: oe(c, s, e),
|
|
2634
|
+
requiredPermission: f?.required_permission,
|
|
2635
|
+
locale: l,
|
|
2636
|
+
variant: g === "edit" ? "input" : "value"
|
|
2637
|
+
}) : N({
|
|
2640
2638
|
field: n,
|
|
2641
2639
|
fieldName: e,
|
|
2642
|
-
value:
|
|
2643
|
-
mode:
|
|
2644
|
-
onChange:
|
|
2645
|
-
refs:
|
|
2646
|
-
locale:
|
|
2640
|
+
value: r,
|
|
2641
|
+
mode: g,
|
|
2642
|
+
onChange: g === "edit" ? d : void 0,
|
|
2643
|
+
refs: o,
|
|
2644
|
+
locale: l
|
|
2647
2645
|
})
|
|
2648
2646
|
});
|
|
2649
2647
|
}
|
|
@@ -2651,7 +2649,7 @@ function Wt({ propCode: e, prop: t, field: n, value: i, mode: o, onSetProperty:
|
|
|
2651
2649
|
//#region src/components/shared/StatusStepper.tsx
|
|
2652
2650
|
function Gt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1 }) {
|
|
2653
2651
|
let o = t.findIndex((e) => e.code === n);
|
|
2654
|
-
return /* @__PURE__ */
|
|
2652
|
+
return /* @__PURE__ */ Y("div", {
|
|
2655
2653
|
role: "list",
|
|
2656
2654
|
style: {
|
|
2657
2655
|
display: "flex",
|
|
@@ -2663,7 +2661,7 @@ function Gt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2663
2661
|
},
|
|
2664
2662
|
children: t.map((n, s) => {
|
|
2665
2663
|
let c = o >= 0 && s < o, l = s === o, u = o < 0 || s > o, d = !!i && (r?.has(n.code) ?? !1), f = s === 0, p = s === t.length - 1, m = l ? "var(--accent-soft)" : c ? "var(--success-soft)" : "transparent", h = l ? "var(--accent)" : c ? "var(--success)" : "var(--text-3)", g = f && p ? void 0 : f ? "polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%)" : p ? "polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%)" : "polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%)";
|
|
2666
|
-
return /* @__PURE__ */
|
|
2664
|
+
return /* @__PURE__ */ X("button", {
|
|
2667
2665
|
role: "listitem",
|
|
2668
2666
|
type: "button",
|
|
2669
2667
|
disabled: !d,
|
|
@@ -2687,7 +2685,7 @@ function Gt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2687
2685
|
clipPath: g,
|
|
2688
2686
|
whiteSpace: "nowrap"
|
|
2689
2687
|
},
|
|
2690
|
-
children: [/* @__PURE__ */
|
|
2688
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
2691
2689
|
style: {
|
|
2692
2690
|
width: 16,
|
|
2693
2691
|
height: 16,
|
|
@@ -2702,8 +2700,8 @@ function Gt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2702
2700
|
fontSize: 9.5,
|
|
2703
2701
|
fontWeight: 700
|
|
2704
2702
|
},
|
|
2705
|
-
children: c ? /* @__PURE__ */
|
|
2706
|
-
}), /* @__PURE__ */
|
|
2703
|
+
children: c ? /* @__PURE__ */ Y(e.check, { size: 10 }) : s + 1
|
|
2704
|
+
}), /* @__PURE__ */ Y("span", {
|
|
2707
2705
|
style: {
|
|
2708
2706
|
overflow: "hidden",
|
|
2709
2707
|
textOverflow: "ellipsis"
|
|
@@ -2717,67 +2715,67 @@ function Gt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2717
2715
|
//#endregion
|
|
2718
2716
|
//#region src/components/shared/StatusGroupsDisplay.tsx
|
|
2719
2717
|
function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r, mode: i = "edit" }) {
|
|
2720
|
-
return /* @__PURE__ */
|
|
2718
|
+
return /* @__PURE__ */ Y("div", {
|
|
2721
2719
|
style: {
|
|
2722
2720
|
display: "flex",
|
|
2723
2721
|
flexWrap: "wrap",
|
|
2724
2722
|
alignItems: "center",
|
|
2725
2723
|
gap: 16
|
|
2726
2724
|
},
|
|
2727
|
-
children: Object.entries(e).map(([e,
|
|
2728
|
-
let
|
|
2729
|
-
if (
|
|
2730
|
-
let t = i === "edit",
|
|
2731
|
-
return /* @__PURE__ */
|
|
2725
|
+
children: Object.entries(e).map(([e, a]) => {
|
|
2726
|
+
let o = t?.find((t) => t.group_code === e)?.status_code, s = o ? a.statuses.find((e) => e.code === o) : void 0;
|
|
2727
|
+
if (a.display_mode === "stepper") {
|
|
2728
|
+
let t = i === "edit", s = t ? a.transitions && o ? /* @__PURE__ */ new Set([o, ...a.transitions[o] ?? []]) : new Set(a.statuses.map((e) => e.code)) : void 0;
|
|
2729
|
+
return /* @__PURE__ */ X("div", {
|
|
2732
2730
|
style: {
|
|
2733
2731
|
display: "flex",
|
|
2734
2732
|
alignItems: "center",
|
|
2735
2733
|
gap: 8,
|
|
2736
2734
|
minWidth: 0
|
|
2737
2735
|
},
|
|
2738
|
-
children: [/* @__PURE__ */
|
|
2736
|
+
children: [/* @__PURE__ */ X("span", {
|
|
2739
2737
|
style: {
|
|
2740
2738
|
fontSize: 12,
|
|
2741
2739
|
color: "var(--text-3)",
|
|
2742
2740
|
flexShrink: 0
|
|
2743
2741
|
},
|
|
2744
|
-
children: [a
|
|
2745
|
-
}), /* @__PURE__ */
|
|
2742
|
+
children: [b(a.name), ":"]
|
|
2743
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2746
2744
|
style: {
|
|
2747
2745
|
minWidth: 240,
|
|
2748
2746
|
opacity: r ? .6 : 1,
|
|
2749
2747
|
pointerEvents: r ? "none" : "auto"
|
|
2750
2748
|
},
|
|
2751
|
-
children: /* @__PURE__ */
|
|
2752
|
-
stages:
|
|
2749
|
+
children: /* @__PURE__ */ Y(Gt, {
|
|
2750
|
+
stages: a.statuses.map((e) => ({
|
|
2753
2751
|
code: e.code,
|
|
2754
|
-
label:
|
|
2752
|
+
label: b(e.name)
|
|
2755
2753
|
})),
|
|
2756
|
-
current:
|
|
2757
|
-
selectable:
|
|
2754
|
+
current: o,
|
|
2755
|
+
selectable: s,
|
|
2758
2756
|
onSelect: t ? (t) => n(e, t) : void 0,
|
|
2759
2757
|
compact: !0
|
|
2760
2758
|
})
|
|
2761
2759
|
})]
|
|
2762
2760
|
}, e);
|
|
2763
2761
|
}
|
|
2764
|
-
if (i === "display") return /* @__PURE__ */
|
|
2762
|
+
if (i === "display") return /* @__PURE__ */ X("div", {
|
|
2765
2763
|
style: {
|
|
2766
2764
|
display: "flex",
|
|
2767
2765
|
alignItems: "center",
|
|
2768
2766
|
gap: 8
|
|
2769
2767
|
},
|
|
2770
|
-
children: [/* @__PURE__ */
|
|
2768
|
+
children: [/* @__PURE__ */ X("span", {
|
|
2771
2769
|
style: {
|
|
2772
2770
|
fontSize: 12,
|
|
2773
2771
|
color: "var(--text-3)"
|
|
2774
2772
|
},
|
|
2775
|
-
children: [a
|
|
2776
|
-
}),
|
|
2777
|
-
tone:
|
|
2773
|
+
children: [b(a.name), ":"]
|
|
2774
|
+
}), s ? /* @__PURE__ */ Y(h, {
|
|
2775
|
+
tone: s.color ?? "slate",
|
|
2778
2776
|
size: "xs",
|
|
2779
|
-
children:
|
|
2780
|
-
}) : /* @__PURE__ */
|
|
2777
|
+
children: b(s.name)
|
|
2778
|
+
}) : /* @__PURE__ */ Y("span", {
|
|
2781
2779
|
style: {
|
|
2782
2780
|
fontSize: 12.5,
|
|
2783
2781
|
color: "var(--text-4)"
|
|
@@ -2785,44 +2783,44 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2785
2783
|
children: "—"
|
|
2786
2784
|
})]
|
|
2787
2785
|
}, e);
|
|
2788
|
-
let
|
|
2786
|
+
let c = (a.transitions && o ? a.statuses.filter((e) => e.code === o || (a.transitions[o]?.includes(e.code) ?? !1)) : a.statuses).map((e) => ({
|
|
2789
2787
|
value: e.code,
|
|
2790
|
-
label: /* @__PURE__ */
|
|
2788
|
+
label: /* @__PURE__ */ X("span", {
|
|
2791
2789
|
style: {
|
|
2792
2790
|
display: "inline-flex",
|
|
2793
2791
|
alignItems: "center",
|
|
2794
2792
|
gap: 6
|
|
2795
2793
|
},
|
|
2796
|
-
children: [e.color && /* @__PURE__ */
|
|
2794
|
+
children: [e.color && /* @__PURE__ */ Y("span", { style: {
|
|
2797
2795
|
width: 8,
|
|
2798
2796
|
height: 8,
|
|
2799
2797
|
borderRadius: 999,
|
|
2800
2798
|
background: `var(--pill-${e.color}, ${e.color})`,
|
|
2801
2799
|
display: "inline-block"
|
|
2802
|
-
} }),
|
|
2800
|
+
} }), b(e.name)]
|
|
2803
2801
|
})
|
|
2804
2802
|
}));
|
|
2805
|
-
return /* @__PURE__ */
|
|
2803
|
+
return /* @__PURE__ */ X("div", {
|
|
2806
2804
|
style: {
|
|
2807
2805
|
display: "flex",
|
|
2808
2806
|
alignItems: "center",
|
|
2809
2807
|
gap: 8
|
|
2810
2808
|
},
|
|
2811
|
-
children: [/* @__PURE__ */
|
|
2809
|
+
children: [/* @__PURE__ */ X("span", {
|
|
2812
2810
|
style: {
|
|
2813
2811
|
fontSize: 12,
|
|
2814
2812
|
color: "var(--text-3)"
|
|
2815
2813
|
},
|
|
2816
|
-
children: [a
|
|
2817
|
-
}), /* @__PURE__ */
|
|
2814
|
+
children: [b(a.name), ":"]
|
|
2815
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2818
2816
|
style: {
|
|
2819
2817
|
minWidth: 180,
|
|
2820
2818
|
opacity: r ? .6 : 1,
|
|
2821
2819
|
pointerEvents: r ? "none" : "auto"
|
|
2822
2820
|
},
|
|
2823
|
-
children: /* @__PURE__ */
|
|
2824
|
-
value:
|
|
2825
|
-
options:
|
|
2821
|
+
children: /* @__PURE__ */ Y(P, {
|
|
2822
|
+
value: o ?? "",
|
|
2823
|
+
options: c,
|
|
2826
2824
|
onChange: (t) => n(e, t),
|
|
2827
2825
|
placeholder: "Select…"
|
|
2828
2826
|
})
|
|
@@ -2838,7 +2836,7 @@ function Jt({ node: e, ctx: t }) {
|
|
|
2838
2836
|
let { entity: n, objectStatuses: r, onSetStatus: i, isStatusPending: a, isNew: o } = t, s = n.status_groups ?? {};
|
|
2839
2837
|
if (o) return null;
|
|
2840
2838
|
let c = e.statuses === !0 || e.statuses, l = Object.fromEntries(Object.entries(s).filter(([e]) => c === !0 || c.includes(e)));
|
|
2841
|
-
return Object.keys(l).length === 0 ? null : /* @__PURE__ */
|
|
2839
|
+
return Object.keys(l).length === 0 ? null : /* @__PURE__ */ Y(Kt, {
|
|
2842
2840
|
statusGroups: l,
|
|
2843
2841
|
objectStatuses: r,
|
|
2844
2842
|
onSetStatus: i ?? qt,
|
|
@@ -2881,27 +2879,27 @@ function Zt(e) {
|
|
|
2881
2879
|
//#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
|
|
2882
2880
|
var Qt = "Audit change diff", $t = ge(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonDiff }))), en = ge(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonSource }))), tn = ge(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
|
|
2883
2881
|
function nn() {
|
|
2884
|
-
return /* @__PURE__ */
|
|
2882
|
+
return /* @__PURE__ */ Y("div", {
|
|
2885
2883
|
className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
|
|
2886
2884
|
children: "Loading editor…"
|
|
2887
2885
|
});
|
|
2888
2886
|
}
|
|
2889
2887
|
function rn({ before: e, after: t }) {
|
|
2890
|
-
return /* @__PURE__ */
|
|
2891
|
-
fallback: /* @__PURE__ */
|
|
2892
|
-
children: /* @__PURE__ */
|
|
2888
|
+
return /* @__PURE__ */ Y(me, {
|
|
2889
|
+
fallback: /* @__PURE__ */ Y(nn, {}),
|
|
2890
|
+
children: /* @__PURE__ */ X("div", {
|
|
2893
2891
|
className: "flex h-full w-full gap-2",
|
|
2894
2892
|
role: "group",
|
|
2895
2893
|
"aria-label": Qt,
|
|
2896
|
-
children: [/* @__PURE__ */
|
|
2894
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2897
2895
|
className: "min-w-0 flex-1",
|
|
2898
|
-
children: /* @__PURE__ */
|
|
2896
|
+
children: /* @__PURE__ */ Y(tn, {
|
|
2899
2897
|
value: e,
|
|
2900
2898
|
readOnly: !0
|
|
2901
2899
|
})
|
|
2902
|
-
}), /* @__PURE__ */
|
|
2900
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2903
2901
|
className: "min-w-0 flex-1",
|
|
2904
|
-
children: /* @__PURE__ */
|
|
2902
|
+
children: /* @__PURE__ */ Y(tn, {
|
|
2905
2903
|
value: t,
|
|
2906
2904
|
readOnly: !0
|
|
2907
2905
|
})
|
|
@@ -2910,17 +2908,17 @@ function rn({ before: e, after: t }) {
|
|
|
2910
2908
|
});
|
|
2911
2909
|
}
|
|
2912
2910
|
function an({ mode: e, onChange: t }) {
|
|
2913
|
-
return /* @__PURE__ */
|
|
2911
|
+
return /* @__PURE__ */ X("div", {
|
|
2914
2912
|
className: "inline-flex gap-1",
|
|
2915
2913
|
role: "group",
|
|
2916
2914
|
"aria-label": "Diff view mode",
|
|
2917
|
-
children: [/* @__PURE__ */
|
|
2915
|
+
children: [/* @__PURE__ */ Y("button", {
|
|
2918
2916
|
type: "button",
|
|
2919
2917
|
"aria-pressed": e === "diff",
|
|
2920
2918
|
onClick: () => t("diff"),
|
|
2921
2919
|
className: `rounded px-2 py-0.5 text-xs ${e === "diff" ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
|
|
2922
2920
|
children: "Diff"
|
|
2923
|
-
}), /* @__PURE__ */
|
|
2921
|
+
}), /* @__PURE__ */ Y("button", {
|
|
2924
2922
|
type: "button",
|
|
2925
2923
|
"aria-pressed": e === "source",
|
|
2926
2924
|
onClick: () => t("source"),
|
|
@@ -2930,41 +2928,41 @@ function an({ mode: e, onChange: t }) {
|
|
|
2930
2928
|
});
|
|
2931
2929
|
}
|
|
2932
2930
|
function on({ values: e, options: t }) {
|
|
2933
|
-
let n = e.before, r = e.after, i = t?.default_mode === "source" ? "source" : "diff", [a, o] =
|
|
2934
|
-
return /* @__PURE__ */
|
|
2931
|
+
let n = e.before, r = e.after, i = t?.default_mode === "source" ? "source" : "diff", [a, o] = q(i), s = Zt(n), c = Zt(r);
|
|
2932
|
+
return /* @__PURE__ */ X("div", {
|
|
2935
2933
|
className: "flex flex-col gap-2",
|
|
2936
|
-
children: [/* @__PURE__ */
|
|
2934
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2937
2935
|
className: "flex items-center justify-between",
|
|
2938
|
-
children: [/* @__PURE__ */
|
|
2936
|
+
children: [/* @__PURE__ */ Y(an, {
|
|
2939
2937
|
mode: a,
|
|
2940
2938
|
onChange: o
|
|
2941
|
-
}), s === c && /* @__PURE__ */
|
|
2939
|
+
}), s === c && /* @__PURE__ */ Y("span", {
|
|
2942
2940
|
className: "text-xs text-muted-foreground",
|
|
2943
2941
|
role: "status",
|
|
2944
2942
|
children: "No field changes"
|
|
2945
2943
|
})]
|
|
2946
|
-
}), /* @__PURE__ */
|
|
2944
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2947
2945
|
className: "h-[480px] w-full overflow-hidden rounded border",
|
|
2948
2946
|
role: "group",
|
|
2949
2947
|
"aria-label": Qt,
|
|
2950
|
-
children: /* @__PURE__ */
|
|
2951
|
-
fallback: /* @__PURE__ */
|
|
2948
|
+
children: /* @__PURE__ */ Y(B, {
|
|
2949
|
+
fallback: /* @__PURE__ */ Y(rn, {
|
|
2952
2950
|
before: n,
|
|
2953
2951
|
after: r
|
|
2954
2952
|
}),
|
|
2955
|
-
children: /* @__PURE__ */
|
|
2956
|
-
fallback: /* @__PURE__ */
|
|
2957
|
-
children: a === "diff" ? /* @__PURE__ */
|
|
2953
|
+
children: /* @__PURE__ */ Y(me, {
|
|
2954
|
+
fallback: /* @__PURE__ */ Y(nn, {}),
|
|
2955
|
+
children: a === "diff" ? /* @__PURE__ */ Y($t, {
|
|
2958
2956
|
before: s,
|
|
2959
2957
|
after: c
|
|
2960
|
-
}) : /* @__PURE__ */
|
|
2958
|
+
}) : /* @__PURE__ */ X("div", {
|
|
2961
2959
|
className: "flex h-full w-full gap-2",
|
|
2962
|
-
children: [/* @__PURE__ */
|
|
2960
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2963
2961
|
className: "min-w-0 flex-1",
|
|
2964
|
-
children: /* @__PURE__ */
|
|
2965
|
-
}), /* @__PURE__ */
|
|
2962
|
+
children: /* @__PURE__ */ Y(en, { value: s })
|
|
2963
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2966
2964
|
className: "min-w-0 flex-1",
|
|
2967
|
-
children: /* @__PURE__ */
|
|
2965
|
+
children: /* @__PURE__ */ Y(en, { value: c })
|
|
2968
2966
|
})]
|
|
2969
2967
|
})
|
|
2970
2968
|
})
|
|
@@ -2974,21 +2972,21 @@ function on({ values: e, options: t }) {
|
|
|
2974
2972
|
}
|
|
2975
2973
|
//#endregion
|
|
2976
2974
|
//#region src/components/detail-layout/widgets/EntityScorecardWidget.tsx
|
|
2977
|
-
function
|
|
2975
|
+
function Q(e) {
|
|
2978
2976
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
2979
2977
|
}
|
|
2980
|
-
function
|
|
2981
|
-
let t =
|
|
2978
|
+
function $(e) {
|
|
2979
|
+
let t = Q(e);
|
|
2982
2980
|
if (!t) return;
|
|
2983
2981
|
let n = Object.entries(t).filter((e) => typeof e[1] == "string");
|
|
2984
2982
|
return n.length > 0 ? Object.fromEntries(n) : void 0;
|
|
2985
2983
|
}
|
|
2986
2984
|
function sn(e) {
|
|
2987
2985
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
2988
|
-
let t =
|
|
2986
|
+
let t = Q(e);
|
|
2989
2987
|
return !t || typeof t.field != "string" ? [] : [{
|
|
2990
2988
|
field: t.field,
|
|
2991
|
-
label:
|
|
2989
|
+
label: $(t.label),
|
|
2992
2990
|
format: t.format
|
|
2993
2991
|
}];
|
|
2994
2992
|
}) : [];
|
|
@@ -2996,42 +2994,42 @@ function sn(e) {
|
|
|
2996
2994
|
function cn(e) {
|
|
2997
2995
|
if (!e || typeof e.entity != "string" || typeof e.scope_field != "string" || typeof e.window_field != "string") return;
|
|
2998
2996
|
let t = Array.isArray(e.windows) ? e.windows.flatMap((e) => {
|
|
2999
|
-
let t =
|
|
2997
|
+
let t = Q(e);
|
|
3000
2998
|
return t && typeof t.code == "string" ? [{
|
|
3001
2999
|
code: t.code,
|
|
3002
|
-
label:
|
|
3000
|
+
label: $(t.label)
|
|
3003
3001
|
}] : [];
|
|
3004
3002
|
}) : [], n = Array.isArray(e.metrics) ? e.metrics.flatMap((e) => {
|
|
3005
|
-
let t =
|
|
3003
|
+
let t = Q(e);
|
|
3006
3004
|
if (!t || typeof t.field != "string") return [];
|
|
3007
|
-
let n =
|
|
3005
|
+
let n = Q(t.filtered);
|
|
3008
3006
|
return [{
|
|
3009
3007
|
field: t.field,
|
|
3010
|
-
label:
|
|
3011
|
-
help:
|
|
3008
|
+
label: $(t.label),
|
|
3009
|
+
help: $(t.help),
|
|
3012
3010
|
format: t.format,
|
|
3013
3011
|
attention: t.attention === !0,
|
|
3014
3012
|
drillthrough_value: typeof t.drillthrough_value == "string" ? t.drillthrough_value : void 0,
|
|
3015
3013
|
drillthrough_filter: t.drillthrough_filter !== !1,
|
|
3016
3014
|
filtered: n && typeof n.field == "string" ? {
|
|
3017
3015
|
field: n.field,
|
|
3018
|
-
where:
|
|
3016
|
+
where: Q(n.where)
|
|
3019
3017
|
} : void 0
|
|
3020
3018
|
}];
|
|
3021
3019
|
}) : [];
|
|
3022
3020
|
if (t.length === 0 || n.length === 0) return;
|
|
3023
|
-
let r =
|
|
3021
|
+
let r = Q(e.breakdown), i = r && typeof r.entity == "string" && typeof r.scope_field == "string" && typeof r.window_field == "string" ? {
|
|
3024
3022
|
entity: r.entity,
|
|
3025
3023
|
scope_field: r.scope_field,
|
|
3026
3024
|
window_field: r.window_field,
|
|
3027
3025
|
filter_field: typeof r.filter_field == "string" ? r.filter_field : void 0,
|
|
3028
|
-
filter_label:
|
|
3029
|
-
all_label:
|
|
3030
|
-
empty_label:
|
|
3026
|
+
filter_label: $(r.filter_label),
|
|
3027
|
+
all_label: $(r.all_label),
|
|
3028
|
+
empty_label: $(r.empty_label),
|
|
3031
3029
|
columns: sn(r.columns),
|
|
3032
3030
|
sort: typeof r.sort == "string" ? r.sort : void 0,
|
|
3033
3031
|
limit: typeof r.limit == "number" ? Math.min(500, Math.max(1, r.limit)) : 200
|
|
3034
|
-
} : void 0, a =
|
|
3032
|
+
} : void 0, a = Q(e.drillthrough), o = a && typeof a.route == "string" && typeof a.scope_field == "string" && typeof a.window_field == "string" ? {
|
|
3035
3033
|
route: a.route,
|
|
3036
3034
|
scope_field: a.scope_field,
|
|
3037
3035
|
window_field: a.window_field,
|
|
@@ -3045,10 +3043,10 @@ function cn(e) {
|
|
|
3045
3043
|
windows: t,
|
|
3046
3044
|
default_window: typeof e.default_window == "string" ? e.default_window : void 0,
|
|
3047
3045
|
metrics: n,
|
|
3048
|
-
title:
|
|
3049
|
-
description:
|
|
3050
|
-
intended_note:
|
|
3051
|
-
empty_label:
|
|
3046
|
+
title: $(e.title),
|
|
3047
|
+
description: $(e.description),
|
|
3048
|
+
intended_note: $(e.intended_note),
|
|
3049
|
+
empty_label: $(e.empty_label),
|
|
3052
3050
|
breakdown: i,
|
|
3053
3051
|
drillthrough: o
|
|
3054
3052
|
};
|
|
@@ -3078,109 +3076,109 @@ function dn(e, t) {
|
|
|
3078
3076
|
return !t || Object.entries(t).every(([t, n]) => e[t] === n);
|
|
3079
3077
|
}
|
|
3080
3078
|
function fn({ values: e, options: t }) {
|
|
3081
|
-
let n =
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
}, [
|
|
3085
|
-
|
|
3086
|
-
}, [
|
|
3087
|
-
let
|
|
3079
|
+
let n = G(() => cn(t), [t]), r = k(), i = re(), a = e.scope, o = n?.windows.some((e) => e.code === n.default_window) ? n.default_window : n?.windows[0]?.code ?? "", [s, c] = q(o), [l, u] = q("");
|
|
3080
|
+
W(() => {
|
|
3081
|
+
c(o);
|
|
3082
|
+
}, [o]), W(() => {
|
|
3083
|
+
u("");
|
|
3084
|
+
}, [s]);
|
|
3085
|
+
let d = n ? [{
|
|
3088
3086
|
field: n.scope_field,
|
|
3089
3087
|
op: "eq",
|
|
3090
|
-
value:
|
|
3088
|
+
value: a
|
|
3091
3089
|
}, {
|
|
3092
3090
|
field: n.window_field,
|
|
3093
3091
|
op: "eq",
|
|
3094
|
-
value:
|
|
3095
|
-
}] : [],
|
|
3092
|
+
value: s
|
|
3093
|
+
}] : [], f = v(n?.entity, {
|
|
3096
3094
|
per_page: 1,
|
|
3097
|
-
filters:
|
|
3098
|
-
}, !!(n &&
|
|
3099
|
-
field:
|
|
3095
|
+
filters: d
|
|
3096
|
+
}, !!(n && a && s)), p = n?.breakdown, m = p ? [{
|
|
3097
|
+
field: p.scope_field,
|
|
3100
3098
|
op: "eq",
|
|
3101
|
-
value:
|
|
3099
|
+
value: a
|
|
3102
3100
|
}, {
|
|
3103
|
-
field:
|
|
3101
|
+
field: p.window_field,
|
|
3104
3102
|
op: "eq",
|
|
3105
|
-
value:
|
|
3106
|
-
}] : [],
|
|
3107
|
-
per_page:
|
|
3108
|
-
sort:
|
|
3109
|
-
filters:
|
|
3110
|
-
}, !!(
|
|
3111
|
-
if (!n || !
|
|
3103
|
+
value: s
|
|
3104
|
+
}] : [], h = v(p?.entity, {
|
|
3105
|
+
per_page: p?.limit ?? 200,
|
|
3106
|
+
sort: p?.sort,
|
|
3107
|
+
filters: m
|
|
3108
|
+
}, !!(p && a && s));
|
|
3109
|
+
if (!n || !a) return /* @__PURE__ */ Y("div", {
|
|
3112
3110
|
role: "alert",
|
|
3113
3111
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
3114
3112
|
children: "Invalid entity_scorecard configuration."
|
|
3115
3113
|
});
|
|
3116
|
-
let
|
|
3114
|
+
let g = f.data?.data?.[0], _ = h.data?.data ?? [], y = p?.filter_field ? Array.from(new Set(_.map((e) => e[p.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], x = l && p?.filter_field ? _.filter((e) => e[p.filter_field] === l) : _, S = (e) => !l || !e.filtered || !p?.filter_field ? g?.[e.field] : _.find((t) => t[p.filter_field] === l && dn(t, e.filtered?.where))?.[e.filtered.field], C = (e) => {
|
|
3117
3115
|
let t = n.drillthrough;
|
|
3118
3116
|
if (!t || !e.drillthrough_value) return;
|
|
3119
3117
|
let r = [{
|
|
3120
3118
|
field: t.scope_field,
|
|
3121
3119
|
op: "eq",
|
|
3122
|
-
value:
|
|
3120
|
+
value: a
|
|
3123
3121
|
}, {
|
|
3124
3122
|
field: t.window_field,
|
|
3125
3123
|
op: "eq",
|
|
3126
|
-
value:
|
|
3124
|
+
value: s
|
|
3127
3125
|
}];
|
|
3128
|
-
t.filter_field &&
|
|
3126
|
+
t.filter_field && l && e.drillthrough_filter !== !1 && r.push({
|
|
3129
3127
|
field: t.filter_field,
|
|
3130
3128
|
op: "eq",
|
|
3131
|
-
value:
|
|
3129
|
+
value: l
|
|
3132
3130
|
}), t.metric_field && r.push({
|
|
3133
3131
|
field: t.metric_field,
|
|
3134
3132
|
op: "eq",
|
|
3135
3133
|
value: e.drillthrough_value
|
|
3136
|
-
}),
|
|
3137
|
-
},
|
|
3138
|
-
return /* @__PURE__ */
|
|
3134
|
+
}), i(t.route, { search: new URLSearchParams({ filters: JSON.stringify(r) }).toString() });
|
|
3135
|
+
}, w = f.error ?? h.error;
|
|
3136
|
+
return /* @__PURE__ */ X("div", {
|
|
3139
3137
|
className: "flex min-w-0 flex-col gap-4",
|
|
3140
|
-
"aria-label":
|
|
3138
|
+
"aria-label": b(n.title, r) || "Scorecard",
|
|
3141
3139
|
children: [
|
|
3142
|
-
/* @__PURE__ */
|
|
3140
|
+
/* @__PURE__ */ X("div", {
|
|
3143
3141
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
3144
|
-
children: [/* @__PURE__ */
|
|
3142
|
+
children: [/* @__PURE__ */ X("div", {
|
|
3145
3143
|
className: "min-w-0",
|
|
3146
3144
|
children: [
|
|
3147
|
-
n.title && /* @__PURE__ */
|
|
3145
|
+
n.title && /* @__PURE__ */ Y("h3", {
|
|
3148
3146
|
className: "text-base font-semibold text-foreground",
|
|
3149
|
-
children:
|
|
3147
|
+
children: b(n.title, r)
|
|
3150
3148
|
}),
|
|
3151
|
-
n.description && /* @__PURE__ */
|
|
3149
|
+
n.description && /* @__PURE__ */ Y("p", {
|
|
3152
3150
|
className: "mt-1 text-sm text-muted-foreground",
|
|
3153
|
-
children:
|
|
3151
|
+
children: b(n.description, r)
|
|
3154
3152
|
}),
|
|
3155
|
-
n.intended_note && /* @__PURE__ */
|
|
3153
|
+
n.intended_note && /* @__PURE__ */ Y("p", {
|
|
3156
3154
|
className: "mt-1 text-xs text-muted-foreground",
|
|
3157
|
-
children:
|
|
3155
|
+
children: b(n.intended_note, r)
|
|
3158
3156
|
})
|
|
3159
3157
|
]
|
|
3160
|
-
}), /* @__PURE__ */
|
|
3158
|
+
}), /* @__PURE__ */ X("div", {
|
|
3161
3159
|
className: "flex flex-wrap items-center gap-2",
|
|
3162
|
-
children: [/* @__PURE__ */
|
|
3160
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
3163
3161
|
role: "group",
|
|
3164
3162
|
"aria-label": "Scorecard window",
|
|
3165
3163
|
className: "inline-flex rounded border border-border p-1",
|
|
3166
|
-
children: n.windows.map((e) => /* @__PURE__ */
|
|
3164
|
+
children: n.windows.map((e) => /* @__PURE__ */ Y("button", {
|
|
3167
3165
|
type: "button",
|
|
3168
|
-
"aria-pressed":
|
|
3169
|
-
onClick: () =>
|
|
3170
|
-
className: `rounded px-3 py-1.5 text-xs font-medium ${
|
|
3171
|
-
children:
|
|
3166
|
+
"aria-pressed": s === e.code,
|
|
3167
|
+
onClick: () => c(e.code),
|
|
3168
|
+
className: `rounded px-3 py-1.5 text-xs font-medium ${s === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
|
|
3169
|
+
children: b(e.label, r) || e.code
|
|
3172
3170
|
}, e.code))
|
|
3173
|
-
}),
|
|
3171
|
+
}), p?.filter_field && /* @__PURE__ */ X("label", {
|
|
3174
3172
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
3175
|
-
children: [
|
|
3176
|
-
"aria-label":
|
|
3177
|
-
value:
|
|
3178
|
-
onChange: (e) =>
|
|
3173
|
+
children: [b(p.filter_label, r) || "Filter", /* @__PURE__ */ X("select", {
|
|
3174
|
+
"aria-label": b(p.filter_label, r) || "Filter",
|
|
3175
|
+
value: l,
|
|
3176
|
+
onChange: (e) => u(e.target.value),
|
|
3179
3177
|
className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
|
|
3180
|
-
children: [/* @__PURE__ */
|
|
3178
|
+
children: [/* @__PURE__ */ Y("option", {
|
|
3181
3179
|
value: "",
|
|
3182
|
-
children:
|
|
3183
|
-
}),
|
|
3180
|
+
children: b(p.all_label, r) || "All"
|
|
3181
|
+
}), y.map((e) => /* @__PURE__ */ Y("option", {
|
|
3184
3182
|
value: e,
|
|
3185
3183
|
children: e
|
|
3186
3184
|
}, e))]
|
|
@@ -3188,63 +3186,63 @@ function fn({ values: e, options: t }) {
|
|
|
3188
3186
|
})]
|
|
3189
3187
|
})]
|
|
3190
3188
|
}),
|
|
3191
|
-
|
|
3189
|
+
w && /* @__PURE__ */ Y("div", {
|
|
3192
3190
|
role: "alert",
|
|
3193
3191
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
3194
|
-
children:
|
|
3192
|
+
children: w instanceof Error ? w.message : "Scorecard data could not be loaded."
|
|
3195
3193
|
}),
|
|
3196
|
-
!
|
|
3194
|
+
!w && !f.isLoading && !g && /* @__PURE__ */ Y("div", {
|
|
3197
3195
|
className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
|
|
3198
|
-
children:
|
|
3196
|
+
children: b(n.empty_label, r) || "No scorecard data."
|
|
3199
3197
|
}),
|
|
3200
|
-
|
|
3198
|
+
g && /* @__PURE__ */ Y("div", {
|
|
3201
3199
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
3202
3200
|
children: n.metrics.map((e) => {
|
|
3203
|
-
let t =
|
|
3204
|
-
/* @__PURE__ */
|
|
3201
|
+
let t = S(e), i = !!(n.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ X(J, { children: [
|
|
3202
|
+
/* @__PURE__ */ Y("span", {
|
|
3205
3203
|
className: "text-xs font-medium text-muted-foreground",
|
|
3206
|
-
children:
|
|
3204
|
+
children: b(e.label, r) || e.field
|
|
3207
3205
|
}),
|
|
3208
|
-
/* @__PURE__ */
|
|
3206
|
+
/* @__PURE__ */ Y("strong", {
|
|
3209
3207
|
className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
|
|
3210
|
-
children: ln(t, e.format,
|
|
3208
|
+
children: ln(t, e.format, r)
|
|
3211
3209
|
}),
|
|
3212
|
-
e.help && /* @__PURE__ */
|
|
3210
|
+
e.help && /* @__PURE__ */ Y("span", {
|
|
3213
3211
|
className: "mt-1 block text-xs text-muted-foreground",
|
|
3214
|
-
children:
|
|
3212
|
+
children: b(e.help, r)
|
|
3215
3213
|
})
|
|
3216
3214
|
] });
|
|
3217
|
-
return
|
|
3215
|
+
return i ? /* @__PURE__ */ Y("button", {
|
|
3218
3216
|
type: "button",
|
|
3219
|
-
onClick: () =>
|
|
3217
|
+
onClick: () => C(e),
|
|
3220
3218
|
className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
|
|
3221
|
-
children:
|
|
3222
|
-
}, e.field) : /* @__PURE__ */
|
|
3219
|
+
children: a
|
|
3220
|
+
}, e.field) : /* @__PURE__ */ Y("article", {
|
|
3223
3221
|
className: "rounded border border-border bg-card p-3",
|
|
3224
|
-
children:
|
|
3222
|
+
children: a
|
|
3225
3223
|
}, e.field);
|
|
3226
3224
|
})
|
|
3227
3225
|
}),
|
|
3228
|
-
|
|
3226
|
+
p && /* @__PURE__ */ Y("div", {
|
|
3229
3227
|
className: "min-w-0 overflow-x-auto rounded border border-border",
|
|
3230
|
-
children: /* @__PURE__ */
|
|
3228
|
+
children: /* @__PURE__ */ X("table", {
|
|
3231
3229
|
className: "w-full border-collapse text-sm",
|
|
3232
|
-
children: [/* @__PURE__ */
|
|
3230
|
+
children: [/* @__PURE__ */ Y("thead", {
|
|
3233
3231
|
className: "bg-surface text-left text-xs text-muted-foreground",
|
|
3234
|
-
children: /* @__PURE__ */
|
|
3232
|
+
children: /* @__PURE__ */ Y("tr", { children: p.columns.map((e) => /* @__PURE__ */ Y("th", {
|
|
3235
3233
|
className: "border-b border-divider px-3 py-2 font-medium",
|
|
3236
|
-
children:
|
|
3234
|
+
children: b(e.label, r) || e.field
|
|
3237
3235
|
}, e.field)) })
|
|
3238
|
-
}), /* @__PURE__ */
|
|
3236
|
+
}), /* @__PURE__ */ X("tbody", { children: [x.map((e, t) => /* @__PURE__ */ Y("tr", {
|
|
3239
3237
|
className: "border-b border-divider last:border-0",
|
|
3240
|
-
children:
|
|
3238
|
+
children: p.columns.map((t) => /* @__PURE__ */ Y("td", {
|
|
3241
3239
|
className: "px-3 py-2 text-foreground",
|
|
3242
|
-
children: ln(e[t.field], t.format,
|
|
3240
|
+
children: ln(e[t.field], t.format, r)
|
|
3243
3241
|
}, t.field))
|
|
3244
|
-
}, un(e, t))), !
|
|
3245
|
-
colSpan: Math.max(1,
|
|
3242
|
+
}, un(e, t))), !h.isLoading && x.length === 0 && /* @__PURE__ */ Y("tr", { children: /* @__PURE__ */ Y("td", {
|
|
3243
|
+
colSpan: Math.max(1, p.columns.length),
|
|
3246
3244
|
className: "px-3 py-6 text-center text-muted-foreground",
|
|
3247
|
-
children:
|
|
3245
|
+
children: b(p.empty_label, r) || "No breakdown rows."
|
|
3248
3246
|
}) })] })]
|
|
3249
3247
|
})
|
|
3250
3248
|
})
|
|
@@ -3255,27 +3253,27 @@ function fn({ values: e, options: t }) {
|
|
|
3255
3253
|
//#region src/components/detail-layout/widgets/builtins.ts
|
|
3256
3254
|
var pn = !1;
|
|
3257
3255
|
function mn() {
|
|
3258
|
-
pn ||= (
|
|
3256
|
+
pn ||= (V("json_diff", on), V("entity_scorecard", fn), !0);
|
|
3259
3257
|
}
|
|
3260
3258
|
//#endregion
|
|
3261
3259
|
//#region src/components/detail-layout/widgets/WidgetHost.tsx
|
|
3262
3260
|
mn();
|
|
3263
3261
|
function hn({ config: e, ctx: t }) {
|
|
3264
|
-
let n =
|
|
3265
|
-
if (!n) return /* @__PURE__ */
|
|
3262
|
+
let n = te(e.type);
|
|
3263
|
+
if (!n) return /* @__PURE__ */ Y("span", {
|
|
3266
3264
|
className: "text-sm text-muted-foreground",
|
|
3267
3265
|
children: `unknown widget: ${e.type}`
|
|
3268
3266
|
});
|
|
3269
3267
|
let r = e.inputs ?? {}, i = t.record, a = {};
|
|
3270
3268
|
for (let [e, t] of Object.entries(r)) a[e] = i[t];
|
|
3271
|
-
return /* @__PURE__ */
|
|
3269
|
+
return /* @__PURE__ */ Y("div", {
|
|
3272
3270
|
style: {
|
|
3273
3271
|
minWidth: 0,
|
|
3274
3272
|
maxWidth: "100%",
|
|
3275
3273
|
overflowX: "auto",
|
|
3276
3274
|
WebkitOverflowScrolling: "touch"
|
|
3277
3275
|
},
|
|
3278
|
-
children: /* @__PURE__ */
|
|
3276
|
+
children: /* @__PURE__ */ Y(n, {
|
|
3279
3277
|
inputs: r,
|
|
3280
3278
|
values: a,
|
|
3281
3279
|
record: i,
|
|
@@ -3287,41 +3285,41 @@ function hn({ config: e, ctx: t }) {
|
|
|
3287
3285
|
//#endregion
|
|
3288
3286
|
//#region src/components/detail-layout/LayoutRenderer.tsx
|
|
3289
3287
|
function gn({ nodes: e, ctx: t }) {
|
|
3290
|
-
return /* @__PURE__ */ J
|
|
3288
|
+
return /* @__PURE__ */ Y(J, { children: e.map((e, n) => /* @__PURE__ */ Y(_n, {
|
|
3291
3289
|
node: e,
|
|
3292
3290
|
ctx: t
|
|
3293
3291
|
}, n)) });
|
|
3294
3292
|
}
|
|
3295
|
-
function
|
|
3296
|
-
return e.row ? /* @__PURE__ */
|
|
3293
|
+
function _n({ node: e, ctx: t }) {
|
|
3294
|
+
return e.row ? /* @__PURE__ */ Y(Te, {
|
|
3297
3295
|
config: e.row,
|
|
3298
3296
|
ctx: t
|
|
3299
|
-
}) : e.column ? /* @__PURE__ */
|
|
3297
|
+
}) : e.column ? /* @__PURE__ */ Y(Oe, {
|
|
3300
3298
|
config: e.column,
|
|
3301
3299
|
node: e,
|
|
3302
3300
|
ctx: t
|
|
3303
|
-
}) : e.tabs ? /* @__PURE__ */
|
|
3301
|
+
}) : e.tabs ? /* @__PURE__ */ Y(Me, {
|
|
3304
3302
|
config: e.tabs,
|
|
3305
3303
|
ctx: t
|
|
3306
|
-
}) : e.section ? /* @__PURE__ */
|
|
3304
|
+
}) : e.section ? /* @__PURE__ */ Y(Ne, {
|
|
3307
3305
|
config: e.section,
|
|
3308
3306
|
ctx: t
|
|
3309
|
-
}) : e.children ? /* @__PURE__ */
|
|
3307
|
+
}) : e.children ? /* @__PURE__ */ Y(At, {
|
|
3310
3308
|
node: e,
|
|
3311
3309
|
ctx: t
|
|
3312
|
-
}) : e.associated ? /* @__PURE__ */
|
|
3310
|
+
}) : e.associated ? /* @__PURE__ */ Y(H, {
|
|
3313
3311
|
node: e,
|
|
3314
3312
|
ctx: t
|
|
3315
|
-
}) : e.fields ? /* @__PURE__ */
|
|
3313
|
+
}) : e.fields ? /* @__PURE__ */ Y(Bt, {
|
|
3316
3314
|
fields: e.fields,
|
|
3317
3315
|
ctx: t
|
|
3318
|
-
}) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */
|
|
3316
|
+
}) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ Y(hn, {
|
|
3319
3317
|
config: e.widget,
|
|
3320
3318
|
ctx: t
|
|
3321
|
-
}) : null : /* @__PURE__ */
|
|
3319
|
+
}) : null : /* @__PURE__ */ Y(Jt, {
|
|
3322
3320
|
node: e,
|
|
3323
3321
|
ctx: t
|
|
3324
|
-
}) : /* @__PURE__ */
|
|
3322
|
+
}) : /* @__PURE__ */ Y(Ut, {
|
|
3325
3323
|
node: e,
|
|
3326
3324
|
ctx: t
|
|
3327
3325
|
});
|