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