@declarion/react 0.37.0 → 0.38.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-_ZZcNOIn.js → DraggableChildrenTable-CI5a0Emm.js} +2 -2
- package/dist-lib/DynamicIcon-DeRpAaXm.js +273 -0
- package/dist-lib/{Grid-k1alUfJH.js → Grid-BZEMUmjI.js} +2 -2
- package/dist-lib/{LayoutRenderer-C3pdqkHp.js → LayoutRenderer-CnKUYh8M.js} +950 -671
- package/dist-lib/{MarkdownRenderer-jhYOLGsz.js → MarkdownRenderer-DNmOqp_M.js} +1 -1
- package/dist-lib/{RefreshControl-BscVr98E.js → RefreshControl-DsEXi6WF.js} +2 -2
- package/dist-lib/{SmartDetailPage.impl-Ycy0dZkv.js → SmartDetailPage.impl-BrIZmjFF.js} +17 -19
- package/dist-lib/{SmartRecordListPage.impl-W41z1hiJ.js → SmartRecordListPage.impl-Bi_FPbGy.js} +5 -5
- package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.d.ts +2 -0
- package/dist-lib/components/primitives/Icons.d.ts +2 -0
- package/dist-lib/components/shared/RecordHeader.d.ts +2 -1
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/icons.js +1 -1
- package/dist-lib/index.js +10 -10
- package/dist-lib/{registry-D6uzF1n6.js → registry-B_AmhRdj.js} +35 -23
- package/dist-lib/testing.js +1 -1
- package/dist-lib/{useCurrentScreen-CD6xJlyU.js → useCurrentScreen-CcsD2NAk.js} +1701 -1694
- package/dist-lib/{useProperties-BK4ilgGN.js → useProperties-CPtQIWXp.js} +2 -2
- package/dist-lib/{value-DFxS49M5.js → value-BCjHI_Ai.js} +1 -1
- package/package.json +1 -1
- package/dist-lib/DynamicIcon-BWO6QtNF.js +0 -261
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { s as e, t } from "./DynamicIcon-
|
|
2
|
-
import {
|
|
3
|
-
import { E as
|
|
4
|
-
import { n as
|
|
5
|
-
import { Suspense as
|
|
6
|
-
import { useInfiniteQuery as
|
|
7
|
-
import { Fragment as
|
|
1
|
+
import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
|
|
2
|
+
import { F as n, Gn as r, Kn as i, L as a, Nn as o, On as s, R as c, U as l, Wn as u, _ as d, an as f, at as p, bn as m, dn as h, en as g, fn as _, g as v, gn as y, h as b, hn as x, ht as S, it as C, jt as w, ln as T, m as E, on as D, rt as O, sn as k, un as A, zn as j } from "./useCurrentScreen-CcsD2NAk.js";
|
|
3
|
+
import { E as M, J as N, K as ee, St as P, T as F, Y as I, d as L, dt as R, et as z, k as B, o as V, pt as te, q as ne, r as re, t as ie, tt as ae, u as oe, xt as se } from "./registry-B_AmhRdj.js";
|
|
4
|
+
import { n as ce, r as le, t as ue } from "./dataTableStyles-vwD1mVOP.js";
|
|
5
|
+
import { Suspense as de, createContext as fe, lazy as pe, useCallback as H, useContext as me, useEffect as U, useId as he, useLayoutEffect as ge, useMemo as W, useRef as G, useState as K } from "react";
|
|
6
|
+
import { useInfiniteQuery as _e, useMutation as ve, useQueryClient as ye } from "@tanstack/react-query";
|
|
7
|
+
import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
8
8
|
//#region src/lib/size-value.ts
|
|
9
|
-
var
|
|
10
|
-
function
|
|
9
|
+
var be = /^(\d+)px$/;
|
|
10
|
+
function xe(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 = be.exec(e);
|
|
15
15
|
if (t) {
|
|
16
16
|
let e = parseInt(t[1], 10);
|
|
17
17
|
return e > 0 ? {
|
|
@@ -27,9 +27,9 @@ function ve(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 Se({ 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] = K(!1), l = G(null);
|
|
32
|
+
U(() => {
|
|
33
33
|
if (o === 0) return;
|
|
34
34
|
let e = l.current;
|
|
35
35
|
if (!e) return;
|
|
@@ -38,10 +38,10 @@ function ye({ 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] = K(null), f = G(null), p = H(() => n.map((t) => {
|
|
42
|
+
let n = xe(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 = H((e, t) => {
|
|
45
45
|
t.preventDefault();
|
|
46
46
|
let n = u ?? p();
|
|
47
47
|
f.current = {
|
|
@@ -58,41 +58,41 @@ function ye({ 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 ? we(e.height) : void 0;
|
|
62
|
+
return /* @__PURE__ */ J("div", {
|
|
63
63
|
ref: l,
|
|
64
|
-
className:
|
|
64
|
+
className: te("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__ */
|
|
70
|
-
className:
|
|
71
|
-
style: s ? void 0 :
|
|
72
|
-
children: [/* @__PURE__ */
|
|
73
|
-
className:
|
|
74
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: n.map((r, a) => /* @__PURE__ */ Y("div", {
|
|
70
|
+
className: te("min-w-0 flex items-stretch", s && "w-full"),
|
|
71
|
+
style: s ? void 0 : Ce(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
|
|
72
|
+
children: [/* @__PURE__ */ J("div", {
|
|
73
|
+
className: te("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
|
|
74
|
+
children: /* @__PURE__ */ J($, {
|
|
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__ */ J("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 Ce(e, t, n, r) {
|
|
86
|
+
let i = xe(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 we(e) {
|
|
94
94
|
if (!e) return;
|
|
95
|
-
let t =
|
|
95
|
+
let t = xe(e);
|
|
96
96
|
if (t?.kind === "px") return {
|
|
97
97
|
height: `${t.value}px`,
|
|
98
98
|
overflow: "hidden"
|
|
@@ -104,12 +104,12 @@ function xe(e) {
|
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/components/detail-layout/LayoutColumn.tsx
|
|
107
|
-
function
|
|
107
|
+
function Te({ config: e, ctx: t }) {
|
|
108
108
|
let { items: n, gap: r = 12 } = e;
|
|
109
|
-
return /* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ J("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__ */ J($, {
|
|
113
113
|
node: e,
|
|
114
114
|
ctx: t
|
|
115
115
|
}, n))
|
|
@@ -117,23 +117,23 @@ function Se({ config: e, ctx: t }) {
|
|
|
117
117
|
}
|
|
118
118
|
//#endregion
|
|
119
119
|
//#region src/components/detail-layout/blockMeta.ts
|
|
120
|
-
function
|
|
120
|
+
function Ee(e) {
|
|
121
121
|
return e.children ?? e.associated;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
let n =
|
|
123
|
+
function De(e, t) {
|
|
124
|
+
let n = Ee(e);
|
|
125
125
|
if (n) {
|
|
126
|
-
if (e.label) return
|
|
126
|
+
if (e.label) return A(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 A(r.display.name);
|
|
129
129
|
let i = t.schema.entities[n];
|
|
130
|
-
return i && (
|
|
130
|
+
return i && (A(i.display.name_plural) || A(i.display.name)) || n;
|
|
131
131
|
}
|
|
132
|
-
return e.section ?
|
|
132
|
+
return e.section ? A(e.section.name) : "Tab";
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Oe(e, t) {
|
|
135
135
|
if (e.icon) return e.icon;
|
|
136
|
-
let n =
|
|
136
|
+
let n = Ee(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 we(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 ke({ config: e, ctx: n }) {
|
|
147
|
+
let { items: r } = e, [i, a] = K(0), o = j(), 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__ */ Y("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__ */ J("nav", {
|
|
159
159
|
"aria-label": "Detail sections",
|
|
160
160
|
style: {
|
|
161
161
|
display: "flex",
|
|
@@ -165,8 +165,8 @@ function Te({ 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 = De(r, n), o = Oe(r, n);
|
|
169
|
+
return /* @__PURE__ */ Y("button", {
|
|
170
170
|
type: "button",
|
|
171
171
|
onClick: () => document.getElementById(e[i])?.scrollIntoView({
|
|
172
172
|
block: "start",
|
|
@@ -188,10 +188,10 @@ function Te({ config: e, ctx: n }) {
|
|
|
188
188
|
whiteSpace: "nowrap",
|
|
189
189
|
cursor: "pointer"
|
|
190
190
|
},
|
|
191
|
-
children: [o && /* @__PURE__ */
|
|
191
|
+
children: [o && /* @__PURE__ */ J(t, {
|
|
192
192
|
name: o,
|
|
193
193
|
size: 13
|
|
194
|
-
}), /* @__PURE__ */
|
|
194
|
+
}), /* @__PURE__ */ J("span", {
|
|
195
195
|
style: {
|
|
196
196
|
overflow: "hidden",
|
|
197
197
|
textOverflow: "ellipsis"
|
|
@@ -201,8 +201,8 @@ function Te({ config: e, ctx: n }) {
|
|
|
201
201
|
}, i);
|
|
202
202
|
})
|
|
203
203
|
}), r.map((r, i) => {
|
|
204
|
-
let a =
|
|
205
|
-
return /* @__PURE__ */
|
|
204
|
+
let a = De(r, n), o = Oe(r, n);
|
|
205
|
+
return /* @__PURE__ */ Y("section", {
|
|
206
206
|
id: e[i],
|
|
207
207
|
style: {
|
|
208
208
|
background: "var(--surface)",
|
|
@@ -213,7 +213,7 @@ function Te({ config: e, ctx: n }) {
|
|
|
213
213
|
minWidth: 0,
|
|
214
214
|
scrollMarginTop: 12
|
|
215
215
|
},
|
|
216
|
-
children: [/* @__PURE__ */
|
|
216
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
217
217
|
style: {
|
|
218
218
|
display: "flex",
|
|
219
219
|
alignItems: "center",
|
|
@@ -224,19 +224,19 @@ function Te({ config: e, ctx: n }) {
|
|
|
224
224
|
fontSize: 13,
|
|
225
225
|
fontWeight: 700
|
|
226
226
|
},
|
|
227
|
-
children: [o && /* @__PURE__ */
|
|
227
|
+
children: [o && /* @__PURE__ */ J(t, {
|
|
228
228
|
name: o,
|
|
229
229
|
size: 14
|
|
230
|
-
}), /* @__PURE__ */
|
|
230
|
+
}), /* @__PURE__ */ J("span", {
|
|
231
231
|
style: { overflowWrap: "anywhere" },
|
|
232
232
|
children: a
|
|
233
233
|
})]
|
|
234
|
-
}), /* @__PURE__ */
|
|
234
|
+
}), /* @__PURE__ */ J("div", {
|
|
235
235
|
style: {
|
|
236
236
|
padding: 14,
|
|
237
237
|
minWidth: 0
|
|
238
238
|
},
|
|
239
|
-
children: /* @__PURE__ */
|
|
239
|
+
children: /* @__PURE__ */ J($, {
|
|
240
240
|
node: r,
|
|
241
241
|
ctx: {
|
|
242
242
|
...n,
|
|
@@ -248,7 +248,7 @@ function Te({ config: e, ctx: n }) {
|
|
|
248
248
|
})]
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
-
return /* @__PURE__ */
|
|
251
|
+
return /* @__PURE__ */ Y("div", {
|
|
252
252
|
style: {
|
|
253
253
|
background: "var(--surface)",
|
|
254
254
|
border: "1px solid var(--border)",
|
|
@@ -257,7 +257,7 @@ function Te({ config: e, ctx: n }) {
|
|
|
257
257
|
boxShadow: "var(--shadow-xs)",
|
|
258
258
|
flexShrink: 0
|
|
259
259
|
},
|
|
260
|
-
children: [/* @__PURE__ */
|
|
260
|
+
children: [/* @__PURE__ */ J("div", {
|
|
261
261
|
role: "tablist",
|
|
262
262
|
style: {
|
|
263
263
|
display: "flex",
|
|
@@ -268,8 +268,8 @@ function Te({ 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 = De(e, n), s = Oe(e, n), c = r === i;
|
|
272
|
+
return /* @__PURE__ */ Y("button", {
|
|
273
273
|
role: "tab",
|
|
274
274
|
"aria-selected": c,
|
|
275
275
|
onClick: (e) => {
|
|
@@ -298,12 +298,12 @@ function Te({ 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__ */ J(t, {
|
|
302
302
|
name: s,
|
|
303
303
|
size: 13
|
|
304
304
|
}),
|
|
305
305
|
o,
|
|
306
|
-
c && /* @__PURE__ */
|
|
306
|
+
c && /* @__PURE__ */ J("span", { style: {
|
|
307
307
|
position: "absolute",
|
|
308
308
|
left: 4,
|
|
309
309
|
right: 4,
|
|
@@ -315,10 +315,10 @@ function Te({ config: e, ctx: n }) {
|
|
|
315
315
|
]
|
|
316
316
|
}, r);
|
|
317
317
|
})
|
|
318
|
-
}), /* @__PURE__ */
|
|
318
|
+
}), /* @__PURE__ */ J("div", {
|
|
319
319
|
role: "tabpanel",
|
|
320
320
|
style: { padding: 14 },
|
|
321
|
-
children: /* @__PURE__ */
|
|
321
|
+
children: /* @__PURE__ */ J($, {
|
|
322
322
|
node: r[i],
|
|
323
323
|
ctx: {
|
|
324
324
|
...n,
|
|
@@ -330,27 +330,27 @@ function Te({ config: e, ctx: n }) {
|
|
|
330
330
|
}
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region src/components/detail-layout/SectionBlock.tsx
|
|
333
|
-
function
|
|
333
|
+
function Ae({ 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__ */ J(t, {
|
|
339
339
|
name: s,
|
|
340
340
|
size: 14
|
|
341
341
|
}) : void 0, f = c ? {
|
|
342
|
-
text:
|
|
342
|
+
text: A(c.text),
|
|
343
343
|
tone: c.tone,
|
|
344
344
|
dot: c.dot
|
|
345
345
|
} : void 0;
|
|
346
|
-
return /* @__PURE__ */
|
|
347
|
-
title:
|
|
346
|
+
return /* @__PURE__ */ J(P, {
|
|
347
|
+
title: A(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__ */ J(nn, {
|
|
354
354
|
nodes: i,
|
|
355
355
|
ctx: u
|
|
356
356
|
})
|
|
@@ -358,37 +358,37 @@ function Ee({ config: e, ctx: n }) {
|
|
|
358
358
|
}
|
|
359
359
|
//#endregion
|
|
360
360
|
//#region src/lib/child-config.ts
|
|
361
|
-
function
|
|
362
|
-
let r = e.display, i =
|
|
361
|
+
function je(e, t, n) {
|
|
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:
|
|
366
|
-
icon:
|
|
365
|
+
name: X(n?.label, r?.name, Ne(t)),
|
|
366
|
+
icon: X(n?.icon, r?.icon, t.display.icon) ?? "",
|
|
367
367
|
mode: i,
|
|
368
|
-
columns:
|
|
369
|
-
sort:
|
|
370
|
-
limit:
|
|
371
|
-
editable:
|
|
372
|
-
interaction:
|
|
373
|
-
}, s =
|
|
368
|
+
columns: X(n?.columns, r?.columns, Fe(t, e.foreign_key)),
|
|
369
|
+
sort: X(n?.sort, r?.sort, Pe(t)),
|
|
370
|
+
limit: X(n?.limit, r?.limit, a),
|
|
371
|
+
editable: X(n?.editable, r?.editable, !0),
|
|
372
|
+
interaction: X(n?.interaction, r?.interaction, Me(t))
|
|
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 = Ie(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;
|
|
380
380
|
return u && (o.quick_add = u), o;
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function X(e, t, n) {
|
|
383
383
|
return e ?? t ?? n;
|
|
384
384
|
}
|
|
385
|
-
function
|
|
386
|
-
return
|
|
385
|
+
function Me(e) {
|
|
386
|
+
return f(e, "update") ? "inline_edit" : "readonly";
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function Ne(e) {
|
|
389
389
|
return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function Pe(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 Ae(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 = He(e);
|
|
403
403
|
return t ? t + ":asc" : "";
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function Fe(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 je(e, t) {
|
|
|
411
411
|
}
|
|
412
412
|
return r;
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function Ie(e, t) {
|
|
415
415
|
let n = { ...e };
|
|
416
|
-
return n.time_field ||=
|
|
416
|
+
return n.time_field ||= ze(t), n.type_field ||= Be(t, "enum"), n.summary_field ||= Ve(t, "string", "text", "rich_text"), n.content_field ||= Ve(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 ||= Le(t), n.intent_field ||= Re(t), n;
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function Le(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 Ne(e) {
|
|
|
428
428
|
if (n && n.type === "bool") return t;
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function Re(e) {
|
|
432
432
|
let t = e.fields.get("intent");
|
|
433
433
|
if (t && t.type === "enum") return "intent";
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function ze(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 Fe(e) {
|
|
|
444
444
|
if (n && n.type === "timestamp") return t;
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function Be(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 Ve(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 Le(e, ...t) {
|
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
function
|
|
462
|
-
let t =
|
|
461
|
+
function He(e) {
|
|
462
|
+
let t = T(e);
|
|
463
463
|
return t.length > 0 ? t[0] : void 0;
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function Ue(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 We(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) : _(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 Ge(e, t) {
|
|
483
483
|
for (let n of t) {
|
|
484
484
|
let t = e[n];
|
|
485
485
|
if (t == null || t === "") return !1;
|
|
@@ -488,18 +488,18 @@ function Ve(e, t) {
|
|
|
488
488
|
}
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/components/detail-layout/useQuickAdd.ts
|
|
491
|
-
function
|
|
492
|
-
let [
|
|
493
|
-
let t = e.quick_add, n = r.entities[e.entity],
|
|
494
|
-
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (
|
|
495
|
-
return
|
|
496
|
-
}), s =
|
|
497
|
-
mutationFn: (t) =>
|
|
491
|
+
function Ke(e, t, n, r) {
|
|
492
|
+
let [i, o] = K(() => {
|
|
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] = a()) : i[e] = t.defaults[e];
|
|
495
|
+
return i;
|
|
496
|
+
}), s = ye(), { mutate: c, isPending: l, error: u, reset: d } = ve({
|
|
497
|
+
mutationFn: (t) => O(e.entity, t),
|
|
498
498
|
onMutate: async (r) => {
|
|
499
499
|
let i = [
|
|
500
|
-
|
|
500
|
+
N,
|
|
501
501
|
t,
|
|
502
|
-
Array.isArray(n) ?
|
|
502
|
+
Array.isArray(n) ? h(n.map(String)) : n,
|
|
503
503
|
e.entity
|
|
504
504
|
];
|
|
505
505
|
await s.cancelQueries({ queryKey: i });
|
|
@@ -527,23 +527,23 @@ function He(e, t, n, r) {
|
|
|
527
527
|
if (n?.snapshots) for (let [e, t] of n.snapshots) s.setQueryData(e, t);
|
|
528
528
|
},
|
|
529
529
|
onSuccess: () => {
|
|
530
|
-
let t = e.quick_add, n = r.entities[e.entity],
|
|
531
|
-
if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ?
|
|
532
|
-
o(
|
|
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] = a() : i[e] = "" : i[e] = t.defaults[e];
|
|
532
|
+
o(i);
|
|
533
533
|
},
|
|
534
534
|
onSettled: () => {
|
|
535
|
-
let r = Array.isArray(n) ?
|
|
535
|
+
let r = Array.isArray(n) ? h(n.map(String)) : n;
|
|
536
536
|
s.invalidateQueries({ queryKey: [
|
|
537
|
-
|
|
537
|
+
N,
|
|
538
538
|
t,
|
|
539
539
|
r,
|
|
540
540
|
e.entity
|
|
541
541
|
] });
|
|
542
542
|
}
|
|
543
|
-
}), f = e.quick_add, p = r.entities[e.entity],
|
|
543
|
+
}), f = e.quick_add, p = r.entities[e.entity], m = Ge(i, f?.fields.filter((e) => p?.fields.get(e)?.required) ?? []);
|
|
544
544
|
function g(t) {
|
|
545
545
|
if (t.preventDefault(), !f) return;
|
|
546
|
-
let r =
|
|
546
|
+
let r = We(i, f.defaults, e.foreign_key, n);
|
|
547
547
|
c(r);
|
|
548
548
|
}
|
|
549
549
|
function _(e, t) {
|
|
@@ -553,21 +553,21 @@ function He(e, t, n, r) {
|
|
|
553
553
|
}));
|
|
554
554
|
}
|
|
555
555
|
return {
|
|
556
|
-
values:
|
|
556
|
+
values: i,
|
|
557
557
|
quickAdd: f,
|
|
558
558
|
childEntity: p,
|
|
559
559
|
isPending: l,
|
|
560
560
|
error: u,
|
|
561
|
-
isReady:
|
|
561
|
+
isReady: m,
|
|
562
562
|
handleSubmit: g,
|
|
563
563
|
handleFieldChange: _
|
|
564
564
|
};
|
|
565
565
|
}
|
|
566
566
|
//#endregion
|
|
567
567
|
//#region src/components/detail-layout/QuickAddForm.tsx
|
|
568
|
-
function
|
|
569
|
-
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } =
|
|
570
|
-
return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */
|
|
568
|
+
function qe({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
569
|
+
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ke(t, n, r, a), m = b(), h = j(), g = he();
|
|
570
|
+
return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ Y("form", {
|
|
571
571
|
onSubmit: f,
|
|
572
572
|
style: {
|
|
573
573
|
display: "flex",
|
|
@@ -582,13 +582,13 @@ function Ue({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
582
582
|
let n = c.fields.get(e);
|
|
583
583
|
if (!n) return null;
|
|
584
584
|
let r = `${g}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
|
|
585
|
-
return /* @__PURE__ */
|
|
585
|
+
return /* @__PURE__ */ Y("div", {
|
|
586
586
|
style: {
|
|
587
587
|
flex: 1,
|
|
588
588
|
minWidth: 0,
|
|
589
589
|
width: h.isPhone ? "100%" : void 0
|
|
590
590
|
},
|
|
591
|
-
children: [/* @__PURE__ */
|
|
591
|
+
children: [/* @__PURE__ */ J("label", {
|
|
592
592
|
id: i,
|
|
593
593
|
htmlFor: r,
|
|
594
594
|
style: {
|
|
@@ -598,8 +598,8 @@ function Ue({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
598
598
|
display: "block",
|
|
599
599
|
fontWeight: 500
|
|
600
600
|
},
|
|
601
|
-
children:
|
|
602
|
-
}),
|
|
601
|
+
children: k(n, e, a.entities)
|
|
602
|
+
}), v({
|
|
603
603
|
field: n,
|
|
604
604
|
fieldName: e,
|
|
605
605
|
value: o[e] ?? "",
|
|
@@ -612,16 +612,16 @@ function Ue({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
612
612
|
})]
|
|
613
613
|
}, e);
|
|
614
614
|
}),
|
|
615
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ J(i, {
|
|
616
616
|
type: "submit",
|
|
617
617
|
kind: "primary",
|
|
618
618
|
size: h.isPhone ? "md" : "sm",
|
|
619
|
-
icon: /* @__PURE__ */
|
|
619
|
+
icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
|
|
620
620
|
disabled: l || !d,
|
|
621
621
|
style: h.isPhone ? { alignSelf: "flex-end" } : void 0,
|
|
622
622
|
children: "Add"
|
|
623
623
|
}),
|
|
624
|
-
u != null && /* @__PURE__ */
|
|
624
|
+
u != null && /* @__PURE__ */ J("span", {
|
|
625
625
|
style: {
|
|
626
626
|
fontSize: 11,
|
|
627
627
|
color: "var(--danger)",
|
|
@@ -635,21 +635,21 @@ function Ue({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
635
635
|
}
|
|
636
636
|
//#endregion
|
|
637
637
|
//#region src/components/detail-layout/ChildrenTable.tsx
|
|
638
|
-
function
|
|
639
|
-
let s =
|
|
638
|
+
function Je({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
639
|
+
let s = a.entities[t.entity], c = b(), l = ne((e) => e.degradedEntities), { data: f, isLoading: p, isError: h, isFetching: g, refetch: _ } = I(n, i, t.entity, t.foreign_key, t.sort, t.limit), v = f?.data ?? [], x = f?.$refs, S = G(x);
|
|
640
640
|
S.current = x;
|
|
641
|
-
let C = t.columns, w = t.interaction === "navigate", T = C[0], E = w && s ?
|
|
641
|
+
let C = t.columns, w = t.interaction === "navigate", T = C[0], E = w && s ? y(void 0, s, a.screens) : null, D = s ? He(s) : void 0, O = W(() => {
|
|
642
642
|
let e = /* @__PURE__ */ new Map();
|
|
643
643
|
if (!s) return e;
|
|
644
644
|
for (let t of C) {
|
|
645
645
|
let n = s.fields.get(t);
|
|
646
|
-
n && e.set(t,
|
|
646
|
+
n && e.set(t, d({
|
|
647
647
|
field: n,
|
|
648
648
|
fieldName: t,
|
|
649
649
|
surface: "list",
|
|
650
650
|
entity: s,
|
|
651
|
-
entities:
|
|
652
|
-
screens:
|
|
651
|
+
entities: a.entities,
|
|
652
|
+
screens: a.screens,
|
|
653
653
|
refs: () => S.current,
|
|
654
654
|
locale: c
|
|
655
655
|
}));
|
|
@@ -658,11 +658,11 @@ function We({ config: t, parentEntity: r, parentId: i, schema: o }) {
|
|
|
658
658
|
}, [
|
|
659
659
|
s,
|
|
660
660
|
C,
|
|
661
|
-
|
|
662
|
-
|
|
661
|
+
a.entities,
|
|
662
|
+
a.screens,
|
|
663
663
|
c
|
|
664
664
|
]);
|
|
665
|
-
if (!s) return /* @__PURE__ */
|
|
665
|
+
if (!s) return /* @__PURE__ */ J("div", {
|
|
666
666
|
style: {
|
|
667
667
|
fontSize: 12.5,
|
|
668
668
|
color: "var(--text-3)",
|
|
@@ -670,12 +670,12 @@ function We({ config: t, parentEntity: r, parentId: i, schema: o }) {
|
|
|
670
670
|
},
|
|
671
671
|
children: "Entity not found."
|
|
672
672
|
});
|
|
673
|
-
let A = /* @__PURE__ */
|
|
673
|
+
let A = /* @__PURE__ */ J(qe, {
|
|
674
674
|
config: t,
|
|
675
|
-
parentEntity:
|
|
675
|
+
parentEntity: n,
|
|
676
676
|
parentId: i,
|
|
677
|
-
schema:
|
|
678
|
-
}), j = /* @__PURE__ */
|
|
677
|
+
schema: a
|
|
678
|
+
}), j = /* @__PURE__ */ Y("div", {
|
|
679
679
|
style: {
|
|
680
680
|
display: "flex",
|
|
681
681
|
alignItems: "center",
|
|
@@ -683,21 +683,21 @@ function We({ config: t, parentEntity: r, parentId: i, schema: o }) {
|
|
|
683
683
|
padding: "4px 0",
|
|
684
684
|
justifyContent: "flex-end"
|
|
685
685
|
},
|
|
686
|
-
children: [ee(s.realtime,
|
|
686
|
+
children: [ee(s.realtime, l, t.entity) && /* @__PURE__ */ J("span", {
|
|
687
687
|
"data-testid": "children-live-indicator",
|
|
688
688
|
title: "This table updates automatically in realtime.",
|
|
689
|
-
children: /* @__PURE__ */
|
|
689
|
+
children: /* @__PURE__ */ J(u, {
|
|
690
690
|
tone: "emerald",
|
|
691
691
|
size: "xs",
|
|
692
692
|
dot: !0,
|
|
693
693
|
children: "Live"
|
|
694
694
|
})
|
|
695
|
-
}), /* @__PURE__ */
|
|
696
|
-
icon: g ? /* @__PURE__ */
|
|
695
|
+
}), /* @__PURE__ */ J(r, {
|
|
696
|
+
icon: g ? /* @__PURE__ */ J("span", {
|
|
697
697
|
"data-testid": "children-refresh-spinner",
|
|
698
698
|
style: { display: "inline-flex" },
|
|
699
|
-
children: /* @__PURE__ */
|
|
700
|
-
}) : /* @__PURE__ */
|
|
699
|
+
children: /* @__PURE__ */ J(o, { size: 13 })
|
|
700
|
+
}) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
|
|
701
701
|
title: "Refresh",
|
|
702
702
|
size: 24,
|
|
703
703
|
disabled: g,
|
|
@@ -706,10 +706,10 @@ function We({ config: t, parentEntity: r, parentId: i, schema: o }) {
|
|
|
706
706
|
}
|
|
707
707
|
})]
|
|
708
708
|
});
|
|
709
|
-
return h ? /* @__PURE__ */
|
|
709
|
+
return h ? /* @__PURE__ */ Y("div", { children: [
|
|
710
710
|
A,
|
|
711
711
|
j,
|
|
712
|
-
/* @__PURE__ */
|
|
712
|
+
/* @__PURE__ */ J("div", {
|
|
713
713
|
style: {
|
|
714
714
|
fontSize: 12.5,
|
|
715
715
|
color: "var(--danger)",
|
|
@@ -717,10 +717,10 @@ function We({ config: t, parentEntity: r, parentId: i, schema: o }) {
|
|
|
717
717
|
},
|
|
718
718
|
children: "Failed to load. Try again."
|
|
719
719
|
})
|
|
720
|
-
] }) :
|
|
720
|
+
] }) : p ? /* @__PURE__ */ Y("div", { children: [
|
|
721
721
|
A,
|
|
722
722
|
j,
|
|
723
|
-
/* @__PURE__ */
|
|
723
|
+
/* @__PURE__ */ J("div", {
|
|
724
724
|
style: {
|
|
725
725
|
display: "flex",
|
|
726
726
|
flexDirection: "column",
|
|
@@ -731,16 +731,16 @@ function We({ config: t, parentEntity: r, parentId: i, schema: o }) {
|
|
|
731
731
|
0,
|
|
732
732
|
1,
|
|
733
733
|
2
|
|
734
|
-
].map((e) => /* @__PURE__ */
|
|
734
|
+
].map((e) => /* @__PURE__ */ J("div", { style: {
|
|
735
735
|
height: 32,
|
|
736
736
|
background: "var(--surface-3)",
|
|
737
737
|
borderRadius: 4
|
|
738
738
|
} }, e))
|
|
739
739
|
})
|
|
740
|
-
] }) :
|
|
740
|
+
] }) : v.length === 0 ? /* @__PURE__ */ Y("div", { children: [
|
|
741
741
|
A,
|
|
742
742
|
j,
|
|
743
|
-
/* @__PURE__ */
|
|
743
|
+
/* @__PURE__ */ J("div", {
|
|
744
744
|
style: {
|
|
745
745
|
fontSize: 12.5,
|
|
746
746
|
color: "var(--text-3)",
|
|
@@ -748,27 +748,27 @@ function We({ config: t, parentEntity: r, parentId: i, schema: o }) {
|
|
|
748
748
|
},
|
|
749
749
|
children: "No records yet."
|
|
750
750
|
})
|
|
751
|
-
] }) : /* @__PURE__ */
|
|
751
|
+
] }) : /* @__PURE__ */ Y("div", { children: [
|
|
752
752
|
A,
|
|
753
753
|
j,
|
|
754
|
-
/* @__PURE__ */
|
|
754
|
+
/* @__PURE__ */ J("div", {
|
|
755
755
|
style: { overflowX: "auto" },
|
|
756
|
-
children: /* @__PURE__ */
|
|
757
|
-
style:
|
|
758
|
-
children: [/* @__PURE__ */
|
|
756
|
+
children: /* @__PURE__ */ Y("table", {
|
|
757
|
+
style: le,
|
|
758
|
+
children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: C.map((e) => {
|
|
759
759
|
let t = s.fields.get(e);
|
|
760
|
-
return /* @__PURE__ */
|
|
761
|
-
style:
|
|
762
|
-
children: t ?
|
|
760
|
+
return /* @__PURE__ */ J("th", {
|
|
761
|
+
style: ce,
|
|
762
|
+
children: t ? k(t, e, a.entities) : e
|
|
763
763
|
}, e);
|
|
764
|
-
}) }) }), /* @__PURE__ */
|
|
765
|
-
let n = D ?
|
|
766
|
-
return /* @__PURE__ */
|
|
767
|
-
let n = t === T, i =
|
|
768
|
-
return /* @__PURE__ */
|
|
764
|
+
}) }) }), /* @__PURE__ */ J("tbody", { children: v.map((e, t) => {
|
|
765
|
+
let n = D ? m(e[D]) : "", r = w && E && n ? E.replace(/:\w+/, n) : void 0;
|
|
766
|
+
return /* @__PURE__ */ J("tr", { children: C.map((t) => {
|
|
767
|
+
let n = t === T, i = O.get(t), a = i ? i(e[t], e) : m(e[t]);
|
|
768
|
+
return /* @__PURE__ */ J("td", {
|
|
769
769
|
title: typeof a == "string" ? a : void 0,
|
|
770
|
-
style:
|
|
771
|
-
children: n && r ? /* @__PURE__ */
|
|
770
|
+
style: ue,
|
|
771
|
+
children: n && r ? /* @__PURE__ */ J("a", {
|
|
772
772
|
href: r,
|
|
773
773
|
style: {
|
|
774
774
|
color: "var(--accent)",
|
|
@@ -780,7 +780,7 @@ function We({ config: t, parentEntity: r, parentId: i, schema: o }) {
|
|
|
780
780
|
children: a
|
|
781
781
|
}) : a
|
|
782
782
|
}, t);
|
|
783
|
-
}) },
|
|
783
|
+
}) }, m(e.id ?? t));
|
|
784
784
|
}) })]
|
|
785
785
|
})
|
|
786
786
|
})
|
|
@@ -788,9 +788,9 @@ function We({ config: t, parentEntity: r, parentId: i, schema: o }) {
|
|
|
788
788
|
}
|
|
789
789
|
//#endregion
|
|
790
790
|
//#region src/components/detail-layout/ChildrenList.tsx
|
|
791
|
-
function
|
|
792
|
-
let i = r.entities[e.entity], a =
|
|
793
|
-
if (!i) return /* @__PURE__ */
|
|
791
|
+
function Ye({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
792
|
+
let i = r.entities[e.entity], a = b(), { data: o, isLoading: s, isError: c } = I(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], u = o?.$refs, d = e.columns;
|
|
793
|
+
if (!i) return /* @__PURE__ */ J("div", {
|
|
794
794
|
style: {
|
|
795
795
|
fontSize: 12.5,
|
|
796
796
|
color: "var(--text-3)",
|
|
@@ -798,13 +798,13 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
798
798
|
},
|
|
799
799
|
children: "Entity not found."
|
|
800
800
|
});
|
|
801
|
-
let f = /* @__PURE__ */
|
|
801
|
+
let f = /* @__PURE__ */ J(qe, {
|
|
802
802
|
config: e,
|
|
803
803
|
parentEntity: t,
|
|
804
804
|
parentId: n,
|
|
805
805
|
schema: r
|
|
806
806
|
});
|
|
807
|
-
if (c) return /* @__PURE__ */
|
|
807
|
+
if (c) return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ J("div", {
|
|
808
808
|
style: {
|
|
809
809
|
fontSize: 12.5,
|
|
810
810
|
color: "var(--danger)",
|
|
@@ -812,7 +812,7 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
812
812
|
},
|
|
813
813
|
children: "Failed to load. Try again."
|
|
814
814
|
})] });
|
|
815
|
-
if (s) return /* @__PURE__ */
|
|
815
|
+
if (s) return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ Y("div", {
|
|
816
816
|
style: {
|
|
817
817
|
display: "flex",
|
|
818
818
|
flexDirection: "column",
|
|
@@ -820,17 +820,17 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
820
820
|
padding: "8px 0"
|
|
821
821
|
},
|
|
822
822
|
children: [
|
|
823
|
-
/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ J("div", { style: {
|
|
824
824
|
height: 22,
|
|
825
825
|
background: "var(--surface-3)",
|
|
826
826
|
borderRadius: 4
|
|
827
827
|
} }),
|
|
828
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ J("div", { style: {
|
|
829
829
|
height: 22,
|
|
830
830
|
background: "var(--surface-3)",
|
|
831
831
|
borderRadius: 4
|
|
832
832
|
} }),
|
|
833
|
-
/* @__PURE__ */
|
|
833
|
+
/* @__PURE__ */ J("div", { style: {
|
|
834
834
|
height: 22,
|
|
835
835
|
background: "var(--surface-3)",
|
|
836
836
|
borderRadius: 4,
|
|
@@ -838,7 +838,7 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
838
838
|
} })
|
|
839
839
|
]
|
|
840
840
|
})] });
|
|
841
|
-
if (l.length === 0) return /* @__PURE__ */
|
|
841
|
+
if (l.length === 0) return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ J("div", {
|
|
842
842
|
style: {
|
|
843
843
|
fontSize: 12.5,
|
|
844
844
|
color: "var(--text-3)",
|
|
@@ -846,13 +846,13 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
846
846
|
},
|
|
847
847
|
children: "No records yet."
|
|
848
848
|
})] });
|
|
849
|
-
let
|
|
850
|
-
return /* @__PURE__ */
|
|
849
|
+
let p = d.length > 0 ? i.display.display_field ?? d[0] : i.display.display_field;
|
|
850
|
+
return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ J("div", {
|
|
851
851
|
style: {
|
|
852
852
|
display: "flex",
|
|
853
853
|
flexDirection: "column"
|
|
854
854
|
},
|
|
855
|
-
children: l.map((e, t) => /* @__PURE__ */
|
|
855
|
+
children: l.map((e, t) => /* @__PURE__ */ J("div", {
|
|
856
856
|
style: {
|
|
857
857
|
display: "flex",
|
|
858
858
|
alignItems: "center",
|
|
@@ -860,30 +860,30 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
860
860
|
padding: "8px 4px",
|
|
861
861
|
borderBottom: "1px solid var(--divider)"
|
|
862
862
|
},
|
|
863
|
-
children: /* @__PURE__ */
|
|
863
|
+
children: /* @__PURE__ */ Y("div", {
|
|
864
864
|
style: {
|
|
865
865
|
flex: 1,
|
|
866
866
|
minWidth: 0
|
|
867
867
|
},
|
|
868
|
-
children: [/* @__PURE__ */
|
|
868
|
+
children: [/* @__PURE__ */ J("div", {
|
|
869
869
|
style: {
|
|
870
870
|
fontSize: 12.5,
|
|
871
871
|
overflow: "hidden",
|
|
872
872
|
textOverflow: "ellipsis",
|
|
873
873
|
whiteSpace: "nowrap"
|
|
874
874
|
},
|
|
875
|
-
children: (typeof e.$display == "string" ? e[
|
|
876
|
-
field: i.fields.get(
|
|
877
|
-
fieldName:
|
|
878
|
-
value: e[
|
|
875
|
+
children: (typeof e.$display == "string" ? e[g] : "") || (p && i.fields.get(p) ? v({
|
|
876
|
+
field: i.fields.get(p),
|
|
877
|
+
fieldName: p,
|
|
878
|
+
value: e[p],
|
|
879
879
|
mode: "display",
|
|
880
880
|
record: e,
|
|
881
881
|
refs: u,
|
|
882
882
|
locale: a
|
|
883
|
-
}) :
|
|
883
|
+
}) : p && e[p] != null ? m(e[p]) : null)
|
|
884
884
|
}), d.length > 1 && (() => {
|
|
885
885
|
let t = d.slice(1, 3).filter((t) => e[t] != null);
|
|
886
|
-
return t.length === 0 ? null : /* @__PURE__ */
|
|
886
|
+
return t.length === 0 ? null : /* @__PURE__ */ J("div", {
|
|
887
887
|
style: {
|
|
888
888
|
fontSize: 11.5,
|
|
889
889
|
color: "var(--text-3)",
|
|
@@ -891,7 +891,7 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
891
891
|
textOverflow: "ellipsis",
|
|
892
892
|
whiteSpace: "nowrap"
|
|
893
893
|
},
|
|
894
|
-
children: t.map((t, n) => /* @__PURE__ */
|
|
894
|
+
children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", i.fields.get(t) ? v({
|
|
895
895
|
field: i.fields.get(t),
|
|
896
896
|
fieldName: t,
|
|
897
897
|
value: e[t],
|
|
@@ -903,14 +903,14 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
903
903
|
});
|
|
904
904
|
})()]
|
|
905
905
|
})
|
|
906
|
-
},
|
|
906
|
+
}, m(e.id ?? t)))
|
|
907
907
|
})] });
|
|
908
908
|
}
|
|
909
909
|
//#endregion
|
|
910
910
|
//#region src/components/detail-layout/ChildrenCards.tsx
|
|
911
|
-
function
|
|
912
|
-
let i = r.entities[e.entity], a =
|
|
913
|
-
if (!i) return /* @__PURE__ */
|
|
911
|
+
function Xe({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
912
|
+
let i = r.entities[e.entity], a = b(), { data: o, isLoading: s, isError: c } = I(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], d = o?.$refs, f = e.columns, p = e.cards, h = p?.header_field ?? f[0], g = p?.badge_field, _ = p?.columns_count ?? 3;
|
|
913
|
+
if (!i) return /* @__PURE__ */ J("div", {
|
|
914
914
|
style: {
|
|
915
915
|
fontSize: 12.5,
|
|
916
916
|
color: "var(--text-3)",
|
|
@@ -918,17 +918,17 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
918
918
|
},
|
|
919
919
|
children: "Entity not found."
|
|
920
920
|
});
|
|
921
|
-
let
|
|
921
|
+
let y = {
|
|
922
922
|
display: "grid",
|
|
923
|
-
gridTemplateColumns: `repeat(auto-fill, minmax(${
|
|
923
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${_ >= 4 ? 180 : 240}px, 1fr))`,
|
|
924
924
|
gap: 12
|
|
925
|
-
}, x = /* @__PURE__ */
|
|
925
|
+
}, x = /* @__PURE__ */ J(qe, {
|
|
926
926
|
config: e,
|
|
927
927
|
parentEntity: t,
|
|
928
928
|
parentId: n,
|
|
929
929
|
schema: r
|
|
930
930
|
});
|
|
931
|
-
if (c) return /* @__PURE__ */
|
|
931
|
+
if (c) return /* @__PURE__ */ Y("div", { children: [x, /* @__PURE__ */ J("div", {
|
|
932
932
|
style: {
|
|
933
933
|
fontSize: 12.5,
|
|
934
934
|
color: "var(--danger)",
|
|
@@ -936,19 +936,19 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
936
936
|
},
|
|
937
937
|
children: "Failed to load. Try again."
|
|
938
938
|
})] });
|
|
939
|
-
if (s) return /* @__PURE__ */
|
|
940
|
-
style:
|
|
939
|
+
if (s) return /* @__PURE__ */ Y("div", { children: [x, /* @__PURE__ */ J("div", {
|
|
940
|
+
style: y,
|
|
941
941
|
children: [
|
|
942
942
|
0,
|
|
943
943
|
1,
|
|
944
944
|
2
|
|
945
|
-
].map((e) => /* @__PURE__ */
|
|
945
|
+
].map((e) => /* @__PURE__ */ J("div", { style: {
|
|
946
946
|
height: 96,
|
|
947
947
|
background: "var(--surface-3)",
|
|
948
948
|
borderRadius: 10
|
|
949
949
|
} }, e))
|
|
950
950
|
})] });
|
|
951
|
-
if (
|
|
951
|
+
if (l.length === 0) return /* @__PURE__ */ Y("div", { children: [x, /* @__PURE__ */ J("div", {
|
|
952
952
|
style: {
|
|
953
953
|
fontSize: 12.5,
|
|
954
954
|
color: "var(--text-3)",
|
|
@@ -957,16 +957,16 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
957
957
|
children: "No records yet."
|
|
958
958
|
})] });
|
|
959
959
|
let S = f.filter((e) => e !== h && e !== g);
|
|
960
|
-
return /* @__PURE__ */
|
|
961
|
-
style:
|
|
962
|
-
children:
|
|
960
|
+
return /* @__PURE__ */ Y("div", { children: [x, /* @__PURE__ */ J("div", {
|
|
961
|
+
style: y,
|
|
962
|
+
children: l.map((t, n) => /* @__PURE__ */ Y("div", {
|
|
963
963
|
style: {
|
|
964
964
|
background: "var(--surface)",
|
|
965
965
|
border: "1px solid var(--border)",
|
|
966
966
|
borderRadius: 10,
|
|
967
967
|
overflow: "hidden"
|
|
968
968
|
},
|
|
969
|
-
children: [/* @__PURE__ */
|
|
969
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
970
970
|
style: {
|
|
971
971
|
padding: "10px 14px",
|
|
972
972
|
display: "flex",
|
|
@@ -975,7 +975,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
975
975
|
gap: 8,
|
|
976
976
|
borderBottom: S.length > 0 ? "1px solid var(--divider)" : "none"
|
|
977
977
|
},
|
|
978
|
-
children: [/* @__PURE__ */
|
|
978
|
+
children: [/* @__PURE__ */ J("div", {
|
|
979
979
|
style: {
|
|
980
980
|
fontSize: 12.5,
|
|
981
981
|
fontWeight: 600,
|
|
@@ -983,7 +983,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
983
983
|
textOverflow: "ellipsis",
|
|
984
984
|
whiteSpace: "nowrap"
|
|
985
985
|
},
|
|
986
|
-
children: h && i.fields.get(h) ?
|
|
986
|
+
children: h && i.fields.get(h) ? v({
|
|
987
987
|
field: i.fields.get(h),
|
|
988
988
|
fieldName: h,
|
|
989
989
|
value: t[h],
|
|
@@ -992,10 +992,10 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
992
992
|
refs: d,
|
|
993
993
|
locale: a
|
|
994
994
|
}) : `Record ${n + 1}`
|
|
995
|
-
}), g && t[g] != null && /* @__PURE__ */
|
|
995
|
+
}), g && t[g] != null && /* @__PURE__ */ J(u, {
|
|
996
996
|
tone: "slate",
|
|
997
997
|
size: "xs",
|
|
998
|
-
children: i.fields.get(g) ?
|
|
998
|
+
children: i.fields.get(g) ? v({
|
|
999
999
|
field: i.fields.get(g),
|
|
1000
1000
|
fieldName: g,
|
|
1001
1001
|
value: t[g],
|
|
@@ -1003,9 +1003,9 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1003
1003
|
record: t,
|
|
1004
1004
|
refs: d,
|
|
1005
1005
|
locale: a
|
|
1006
|
-
}) :
|
|
1006
|
+
}) : m(t[g])
|
|
1007
1007
|
})]
|
|
1008
|
-
}), S.length > 0 && /* @__PURE__ */
|
|
1008
|
+
}), S.length > 0 && /* @__PURE__ */ J("div", {
|
|
1009
1009
|
style: {
|
|
1010
1010
|
padding: "10px 14px",
|
|
1011
1011
|
display: "flex",
|
|
@@ -1014,26 +1014,26 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1014
1014
|
},
|
|
1015
1015
|
children: S.slice(0, 4).map((n) => {
|
|
1016
1016
|
let o = i.fields.get(n);
|
|
1017
|
-
return o ? /* @__PURE__ */
|
|
1017
|
+
return o ? /* @__PURE__ */ Y("div", {
|
|
1018
1018
|
style: {
|
|
1019
1019
|
display: "flex",
|
|
1020
1020
|
alignItems: "baseline",
|
|
1021
1021
|
gap: 8,
|
|
1022
1022
|
fontSize: 11.5
|
|
1023
1023
|
},
|
|
1024
|
-
children: [/* @__PURE__ */
|
|
1024
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
1025
1025
|
style: {
|
|
1026
1026
|
color: "var(--text-3)",
|
|
1027
1027
|
flexShrink: 0
|
|
1028
1028
|
},
|
|
1029
1029
|
children: [r.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(r.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
|
|
1030
|
-
}), /* @__PURE__ */
|
|
1030
|
+
}), /* @__PURE__ */ J("span", {
|
|
1031
1031
|
style: {
|
|
1032
1032
|
overflow: "hidden",
|
|
1033
1033
|
textOverflow: "ellipsis",
|
|
1034
1034
|
whiteSpace: "nowrap"
|
|
1035
1035
|
},
|
|
1036
|
-
children:
|
|
1036
|
+
children: v({
|
|
1037
1037
|
field: o,
|
|
1038
1038
|
fieldName: n,
|
|
1039
1039
|
value: t[n],
|
|
@@ -1046,16 +1046,16 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1046
1046
|
}, n) : null;
|
|
1047
1047
|
})
|
|
1048
1048
|
})]
|
|
1049
|
-
},
|
|
1049
|
+
}, m(t.id ?? n)))
|
|
1050
1050
|
})] });
|
|
1051
1051
|
}
|
|
1052
1052
|
//#endregion
|
|
1053
1053
|
//#region src/hooks/useTimelineData.ts
|
|
1054
|
-
var
|
|
1055
|
-
function
|
|
1056
|
-
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ?
|
|
1054
|
+
var Ze = 50;
|
|
1055
|
+
function Qe(e, t, n, r, i, a) {
|
|
1056
|
+
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? _(t, o.length) : [t], c = a ?? Ze, l = _e({
|
|
1057
1057
|
queryKey: [
|
|
1058
|
-
|
|
1058
|
+
N,
|
|
1059
1059
|
e,
|
|
1060
1060
|
t,
|
|
1061
1061
|
n,
|
|
@@ -1071,14 +1071,14 @@ function Je(e, t, n, r, i, a) {
|
|
|
1071
1071
|
op: "eq",
|
|
1072
1072
|
value: s[t]
|
|
1073
1073
|
}));
|
|
1074
|
-
return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(c)), e && t.set("after", e),
|
|
1074
|
+
return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(c)), e && t.set("after", e), w(`/api/data/${n}?${t.toString()}`);
|
|
1075
1075
|
},
|
|
1076
1076
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
1077
1077
|
initialPageParam: void 0,
|
|
1078
1078
|
enabled: !!e && !!t && !!n && !!r && s !== null
|
|
1079
1079
|
});
|
|
1080
1080
|
return {
|
|
1081
|
-
rows:
|
|
1081
|
+
rows: W(() => l.data?.pages.flatMap((e) => e.data) ?? [], [l.data?.pages]),
|
|
1082
1082
|
refs: l.data?.pages[0]?.$refs,
|
|
1083
1083
|
fetchNextPage: l.fetchNextPage,
|
|
1084
1084
|
hasOlder: !!l.hasNextPage,
|
|
@@ -1089,48 +1089,48 @@ function Je(e, t, n, r, i, a) {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
//#endregion
|
|
1091
1091
|
//#region src/components/detail-layout/TimelineComposer.tsx
|
|
1092
|
-
var
|
|
1093
|
-
function
|
|
1094
|
-
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } =
|
|
1095
|
-
|
|
1096
|
-
let e =
|
|
1092
|
+
var $e = "quick_entry", et = 100, tt = 240, nt = 800, rt = 80;
|
|
1093
|
+
function it({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
1094
|
+
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ke(t, n, r, a), m = b(), [h, g] = K(tt), _ = G(null), y = G(null), [x, S] = K(nt);
|
|
1095
|
+
U(() => {
|
|
1096
|
+
let e = y.current?.parentElement;
|
|
1097
1097
|
if (!e) return;
|
|
1098
1098
|
let t = () => {
|
|
1099
|
-
let t = Math.max(
|
|
1100
|
-
S(Math.min(
|
|
1099
|
+
let t = Math.max(et, e.clientHeight - rt);
|
|
1100
|
+
S(Math.min(nt, t));
|
|
1101
1101
|
};
|
|
1102
1102
|
t();
|
|
1103
1103
|
let n = new ResizeObserver(t);
|
|
1104
1104
|
return n.observe(e), () => n.disconnect();
|
|
1105
|
-
}, []),
|
|
1105
|
+
}, []), U(() => {
|
|
1106
1106
|
g((e) => Math.min(e, x));
|
|
1107
1107
|
}, [x]);
|
|
1108
|
-
let C =
|
|
1108
|
+
let C = G(o);
|
|
1109
1109
|
C.current = o;
|
|
1110
|
-
let w =
|
|
1110
|
+
let w = G(p);
|
|
1111
1111
|
w.current = p;
|
|
1112
|
-
let
|
|
1112
|
+
let T = G({}), D = W(() => ({
|
|
1113
1113
|
getField: (e) => C.current[e],
|
|
1114
1114
|
setField: (e, t) => {
|
|
1115
1115
|
w.current(e, t);
|
|
1116
1116
|
},
|
|
1117
1117
|
focusField: (e) => {
|
|
1118
|
-
let t =
|
|
1118
|
+
let t = T.current[e];
|
|
1119
1119
|
t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
|
|
1120
1120
|
}
|
|
1121
1121
|
}), []);
|
|
1122
|
-
|
|
1123
|
-
let O =
|
|
1124
|
-
e.preventDefault(),
|
|
1122
|
+
U(() => E($e, D), [D]);
|
|
1123
|
+
let O = H((e) => {
|
|
1124
|
+
e.preventDefault(), _.current = {
|
|
1125
1125
|
startY: e.clientY,
|
|
1126
1126
|
startHeight: h
|
|
1127
1127
|
};
|
|
1128
1128
|
let t = (e) => {
|
|
1129
|
-
if (!
|
|
1130
|
-
let t =
|
|
1129
|
+
if (!_.current) return;
|
|
1130
|
+
let t = _.current.startY - e.clientY, n = Math.min(x, Math.max(et, _.current.startHeight + t));
|
|
1131
1131
|
g(n);
|
|
1132
1132
|
}, n = () => {
|
|
1133
|
-
|
|
1133
|
+
_.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
1134
1134
|
};
|
|
1135
1135
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
1136
1136
|
}, [h, x]);
|
|
@@ -1146,11 +1146,11 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
let M = (e) => {
|
|
1148
1148
|
let t = c.fields.get(e);
|
|
1149
|
-
return t ? /* @__PURE__ */
|
|
1149
|
+
return t ? /* @__PURE__ */ J("div", {
|
|
1150
1150
|
ref: (t) => {
|
|
1151
|
-
|
|
1151
|
+
T.current[e] = t;
|
|
1152
1152
|
},
|
|
1153
|
-
children:
|
|
1153
|
+
children: v({
|
|
1154
1154
|
field: t,
|
|
1155
1155
|
fieldName: e,
|
|
1156
1156
|
value: o[e] ?? "",
|
|
@@ -1161,8 +1161,8 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1161
1161
|
})
|
|
1162
1162
|
}, e) : null;
|
|
1163
1163
|
};
|
|
1164
|
-
return /* @__PURE__ */
|
|
1165
|
-
ref:
|
|
1164
|
+
return /* @__PURE__ */ Y("div", {
|
|
1165
|
+
ref: y,
|
|
1166
1166
|
style: {
|
|
1167
1167
|
flexShrink: 0,
|
|
1168
1168
|
borderTop: "1px solid var(--divider)",
|
|
@@ -1171,7 +1171,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1171
1171
|
flexDirection: "column",
|
|
1172
1172
|
height: `${h}px`
|
|
1173
1173
|
},
|
|
1174
|
-
children: [/* @__PURE__ */
|
|
1174
|
+
children: [/* @__PURE__ */ J("div", {
|
|
1175
1175
|
onMouseDown: O,
|
|
1176
1176
|
title: "Drag to resize",
|
|
1177
1177
|
style: {
|
|
@@ -1182,13 +1182,13 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1182
1182
|
justifyContent: "center",
|
|
1183
1183
|
flexShrink: 0
|
|
1184
1184
|
},
|
|
1185
|
-
children: /* @__PURE__ */
|
|
1185
|
+
children: /* @__PURE__ */ J("div", { style: {
|
|
1186
1186
|
width: 56,
|
|
1187
1187
|
height: 3,
|
|
1188
1188
|
borderRadius: 999,
|
|
1189
1189
|
background: "var(--border)"
|
|
1190
1190
|
} })
|
|
1191
|
-
}), /* @__PURE__ */
|
|
1191
|
+
}), /* @__PURE__ */ Y("form", {
|
|
1192
1192
|
onSubmit: f,
|
|
1193
1193
|
onKeyDown: (e) => {
|
|
1194
1194
|
(e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), e.currentTarget.requestSubmit());
|
|
@@ -1202,7 +1202,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1202
1202
|
padding: "0 12px 8px"
|
|
1203
1203
|
},
|
|
1204
1204
|
children: [
|
|
1205
|
-
A.length > 0 && /* @__PURE__ */
|
|
1205
|
+
A.length > 0 && /* @__PURE__ */ J("div", {
|
|
1206
1206
|
style: {
|
|
1207
1207
|
display: "flex",
|
|
1208
1208
|
flexWrap: "wrap",
|
|
@@ -1212,16 +1212,16 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1212
1212
|
},
|
|
1213
1213
|
children: A.map(M)
|
|
1214
1214
|
}),
|
|
1215
|
-
k && c.fields.get(k) && /* @__PURE__ */
|
|
1215
|
+
k && c.fields.get(k) && /* @__PURE__ */ J("div", {
|
|
1216
1216
|
style: {
|
|
1217
1217
|
flex: 1,
|
|
1218
1218
|
minHeight: 0,
|
|
1219
1219
|
display: "flex"
|
|
1220
1220
|
},
|
|
1221
1221
|
ref: (e) => {
|
|
1222
|
-
|
|
1222
|
+
T.current[k] = e;
|
|
1223
1223
|
},
|
|
1224
|
-
children:
|
|
1224
|
+
children: v({
|
|
1225
1225
|
field: c.fields.get(k),
|
|
1226
1226
|
fieldName: k,
|
|
1227
1227
|
value: o[k] ?? "",
|
|
@@ -1232,7 +1232,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1232
1232
|
locale: m
|
|
1233
1233
|
})
|
|
1234
1234
|
}),
|
|
1235
|
-
/* @__PURE__ */
|
|
1235
|
+
/* @__PURE__ */ Y("div", {
|
|
1236
1236
|
style: {
|
|
1237
1237
|
display: "flex",
|
|
1238
1238
|
flexWrap: "wrap",
|
|
@@ -1240,39 +1240,39 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1240
1240
|
gap: 6,
|
|
1241
1241
|
flexShrink: 0
|
|
1242
1242
|
},
|
|
1243
|
-
children: [j.map(M), /* @__PURE__ */
|
|
1243
|
+
children: [j.map(M), /* @__PURE__ */ Y("div", {
|
|
1244
1244
|
style: {
|
|
1245
1245
|
marginLeft: "auto",
|
|
1246
1246
|
display: "flex",
|
|
1247
1247
|
alignItems: "center",
|
|
1248
1248
|
gap: 8
|
|
1249
1249
|
},
|
|
1250
|
-
children: [/* @__PURE__ */
|
|
1250
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
1251
1251
|
style: {
|
|
1252
1252
|
fontSize: 10.5,
|
|
1253
1253
|
color: "var(--text-4)"
|
|
1254
1254
|
},
|
|
1255
1255
|
children: [
|
|
1256
|
-
/* @__PURE__ */
|
|
1256
|
+
/* @__PURE__ */ J("span", {
|
|
1257
1257
|
className: "mono",
|
|
1258
1258
|
children: "⌘"
|
|
1259
1259
|
}),
|
|
1260
|
-
/* @__PURE__ */
|
|
1260
|
+
/* @__PURE__ */ J("span", {
|
|
1261
1261
|
className: "mono",
|
|
1262
1262
|
children: "↵"
|
|
1263
1263
|
}),
|
|
1264
1264
|
" to add"
|
|
1265
1265
|
]
|
|
1266
|
-
}), /* @__PURE__ */
|
|
1266
|
+
}), /* @__PURE__ */ J(i, {
|
|
1267
1267
|
type: "submit",
|
|
1268
1268
|
kind: "primary",
|
|
1269
|
-
icon: /* @__PURE__ */
|
|
1269
|
+
icon: /* @__PURE__ */ J(e.plus, { size: 13 }),
|
|
1270
1270
|
disabled: l || !d,
|
|
1271
1271
|
children: "Add"
|
|
1272
1272
|
})]
|
|
1273
1273
|
})]
|
|
1274
1274
|
}),
|
|
1275
|
-
u != null && /* @__PURE__ */
|
|
1275
|
+
u != null && /* @__PURE__ */ J("p", {
|
|
1276
1276
|
style: {
|
|
1277
1277
|
fontSize: 11,
|
|
1278
1278
|
color: "var(--danger)",
|
|
@@ -1287,35 +1287,35 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
1287
1287
|
}
|
|
1288
1288
|
//#endregion
|
|
1289
1289
|
//#region src/components/detail-layout/ChildrenTimeline.tsx
|
|
1290
|
-
var
|
|
1291
|
-
function
|
|
1292
|
-
if (
|
|
1290
|
+
var at = 80, ot = 200;
|
|
1291
|
+
function st(e, t) {
|
|
1292
|
+
if (ct(t)) {
|
|
1293
1293
|
let e = t.id;
|
|
1294
|
-
return e == null ? "" :
|
|
1294
|
+
return e == null ? "" : m(e);
|
|
1295
1295
|
}
|
|
1296
|
-
return
|
|
1296
|
+
return p(D(e, t));
|
|
1297
1297
|
}
|
|
1298
|
-
function
|
|
1298
|
+
function ct(e) {
|
|
1299
1299
|
return e.__optimistic === !0;
|
|
1300
1300
|
}
|
|
1301
|
-
function
|
|
1302
|
-
let
|
|
1303
|
-
|
|
1301
|
+
function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1302
|
+
let a = r.entities[e.entity], { rows: s, refs: c, fetchNextPage: l, hasOlder: u, isFetchingOlder: d, isLoading: f, isError: p } = Qe(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), m = e.timeline, h = m?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = W(() => g ? [...s].reverse() : s, [s, g]), v = m?.auto_scroll ?? "none", y = G(null), b = G(null), x = G(!1), S = G(0), C = G(null), w = G(null), T = G(!0), E = G(null);
|
|
1303
|
+
U(() => {
|
|
1304
1304
|
x.current = !1, S.current = 0, C.current = null, w.current = null, T.current = !0, E.current = null;
|
|
1305
|
-
}, [n]),
|
|
1305
|
+
}, [n]), ge(() => {
|
|
1306
1306
|
!d || !y.current || (E.current = {
|
|
1307
1307
|
scrollHeight: y.current.scrollHeight,
|
|
1308
1308
|
scrollTop: y.current.scrollTop
|
|
1309
1309
|
});
|
|
1310
|
-
}, [d]),
|
|
1310
|
+
}, [d]), ge(() => {
|
|
1311
1311
|
let e = y.current;
|
|
1312
|
-
if (!e || _.length === 0 || !
|
|
1312
|
+
if (!e || _.length === 0 || !a) {
|
|
1313
1313
|
S.current = _.length;
|
|
1314
1314
|
return;
|
|
1315
1315
|
}
|
|
1316
|
-
let t =
|
|
1316
|
+
let t = st(a, _[0]), n = st(a, _[_.length - 1]), r = !x.current, i = _.length > S.current && S.current > 0, o = i && (g && t !== C.current && n === w.current || !g && n !== w.current && t === C.current), s = i && !o;
|
|
1317
1317
|
if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
|
|
1318
|
-
else if (
|
|
1318
|
+
else if (o && E.current) {
|
|
1319
1319
|
let t = E.current;
|
|
1320
1320
|
g && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), E.current = null;
|
|
1321
1321
|
} else s && g && T.current && (e.scrollTop = e.scrollHeight);
|
|
@@ -1324,20 +1324,20 @@ function at({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1324
1324
|
_,
|
|
1325
1325
|
v,
|
|
1326
1326
|
g,
|
|
1327
|
-
|
|
1327
|
+
a
|
|
1328
1328
|
]);
|
|
1329
|
-
let D =
|
|
1329
|
+
let D = H(() => {
|
|
1330
1330
|
let e = y.current;
|
|
1331
|
-
e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight <
|
|
1331
|
+
e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight < at);
|
|
1332
1332
|
}, []);
|
|
1333
|
-
|
|
1333
|
+
U(() => {
|
|
1334
1334
|
let e = b.current;
|
|
1335
1335
|
if (!e || typeof IntersectionObserver > "u") return;
|
|
1336
1336
|
let t = new IntersectionObserver((e) => {
|
|
1337
1337
|
for (let t of e) t.isIntersecting && u && !d && l();
|
|
1338
1338
|
}, {
|
|
1339
1339
|
root: y.current ?? null,
|
|
1340
|
-
rootMargin: `${
|
|
1340
|
+
rootMargin: `${ot}px 0px 0px 0px`,
|
|
1341
1341
|
threshold: 0
|
|
1342
1342
|
});
|
|
1343
1343
|
return t.observe(e), () => t.disconnect();
|
|
@@ -1346,8 +1346,8 @@ function at({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1346
1346
|
d,
|
|
1347
1347
|
l
|
|
1348
1348
|
]);
|
|
1349
|
-
let [O,
|
|
1350
|
-
if (!
|
|
1349
|
+
let [O, k] = K(null);
|
|
1350
|
+
if (!a) return /* @__PURE__ */ J("div", {
|
|
1351
1351
|
style: {
|
|
1352
1352
|
fontSize: 12.5,
|
|
1353
1353
|
color: "var(--text-3)",
|
|
@@ -1355,25 +1355,25 @@ function at({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1355
1355
|
},
|
|
1356
1356
|
children: "Entity not found."
|
|
1357
1357
|
});
|
|
1358
|
-
let j = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), M =
|
|
1358
|
+
let j = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), M = A(a.display?.name_plural) || A(a.display?.name) || e.entity, N = u ? /* @__PURE__ */ J("div", {
|
|
1359
1359
|
style: {
|
|
1360
1360
|
display: "flex",
|
|
1361
1361
|
justifyContent: "center",
|
|
1362
1362
|
padding: "6px 0"
|
|
1363
1363
|
},
|
|
1364
|
-
children: /* @__PURE__ */
|
|
1364
|
+
children: /* @__PURE__ */ J(i, {
|
|
1365
1365
|
size: "xs",
|
|
1366
1366
|
onClick: () => l(),
|
|
1367
1367
|
disabled: d,
|
|
1368
|
-
icon: d ? /* @__PURE__ */
|
|
1368
|
+
icon: d ? /* @__PURE__ */ J(o, { size: 11 }) : void 0,
|
|
1369
1369
|
children: d ? "Loading…" : "Load older"
|
|
1370
1370
|
})
|
|
1371
|
-
}) : null,
|
|
1371
|
+
}) : null, ee = /* @__PURE__ */ J("div", {
|
|
1372
1372
|
ref: b,
|
|
1373
1373
|
"aria-hidden": "true",
|
|
1374
1374
|
style: { height: 1 }
|
|
1375
1375
|
}), P;
|
|
1376
|
-
if (p) P = /* @__PURE__ */
|
|
1376
|
+
if (p) P = /* @__PURE__ */ J("div", {
|
|
1377
1377
|
style: {
|
|
1378
1378
|
fontSize: 12.5,
|
|
1379
1379
|
color: "var(--danger)",
|
|
@@ -1381,24 +1381,24 @@ function at({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1381
1381
|
},
|
|
1382
1382
|
children: "Failed to load."
|
|
1383
1383
|
});
|
|
1384
|
-
else if (f) P = /* @__PURE__ */
|
|
1384
|
+
else if (f) P = /* @__PURE__ */ Y("div", {
|
|
1385
1385
|
style: {
|
|
1386
1386
|
display: "flex",
|
|
1387
1387
|
flexDirection: "column",
|
|
1388
1388
|
gap: 8,
|
|
1389
1389
|
padding: 12
|
|
1390
1390
|
},
|
|
1391
|
-
children: [/* @__PURE__ */
|
|
1391
|
+
children: [/* @__PURE__ */ J("div", { style: {
|
|
1392
1392
|
height: 64,
|
|
1393
1393
|
background: "var(--surface-3)",
|
|
1394
1394
|
borderRadius: 8
|
|
1395
|
-
} }), /* @__PURE__ */
|
|
1395
|
+
} }), /* @__PURE__ */ J("div", { style: {
|
|
1396
1396
|
height: 64,
|
|
1397
1397
|
background: "var(--surface-3)",
|
|
1398
1398
|
borderRadius: 8
|
|
1399
1399
|
} })]
|
|
1400
1400
|
});
|
|
1401
|
-
else if (_.length === 0) P = /* @__PURE__ */
|
|
1401
|
+
else if (_.length === 0) P = /* @__PURE__ */ Y(q, { children: [ee, /* @__PURE__ */ J("div", {
|
|
1402
1402
|
style: {
|
|
1403
1403
|
fontSize: 12.5,
|
|
1404
1404
|
color: "var(--text-3)",
|
|
@@ -1407,12 +1407,12 @@ function at({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1407
1407
|
children: "No activity yet."
|
|
1408
1408
|
})] });
|
|
1409
1409
|
else {
|
|
1410
|
-
let
|
|
1411
|
-
let s =
|
|
1412
|
-
return /* @__PURE__ */
|
|
1413
|
-
row:
|
|
1410
|
+
let i = (i, o) => {
|
|
1411
|
+
let s = st(a, i) || String(o);
|
|
1412
|
+
return /* @__PURE__ */ J(ut, {
|
|
1413
|
+
row: i,
|
|
1414
1414
|
rowId: s,
|
|
1415
|
-
childEntity:
|
|
1415
|
+
childEntity: a,
|
|
1416
1416
|
entityCode: e.entity,
|
|
1417
1417
|
parentEntity: t,
|
|
1418
1418
|
parentId: n,
|
|
@@ -1420,47 +1420,47 @@ function at({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1420
1420
|
editableFields: j,
|
|
1421
1421
|
refs: c,
|
|
1422
1422
|
isEditing: O === s,
|
|
1423
|
-
onStartEdit: () =>
|
|
1424
|
-
onCancelEdit: () =>
|
|
1425
|
-
onSaved: () =>
|
|
1426
|
-
schema:
|
|
1427
|
-
optimistic:
|
|
1423
|
+
onStartEdit: () => k(s),
|
|
1424
|
+
onCancelEdit: () => k(null),
|
|
1425
|
+
onSaved: () => k(null),
|
|
1426
|
+
schema: r,
|
|
1427
|
+
optimistic: ct(i)
|
|
1428
1428
|
}, s);
|
|
1429
|
-
},
|
|
1430
|
-
if (
|
|
1429
|
+
}, o = m?.time_field, s;
|
|
1430
|
+
if (o) {
|
|
1431
1431
|
let e = [];
|
|
1432
1432
|
_.forEach((t, n) => {
|
|
1433
|
-
let r = t[
|
|
1434
|
-
!
|
|
1433
|
+
let r = t[o], i = dt(r), a = e[e.length - 1];
|
|
1434
|
+
!a || a.key !== i ? e.push({
|
|
1435
1435
|
key: i,
|
|
1436
|
-
label:
|
|
1436
|
+
label: ft(r),
|
|
1437
1437
|
rows: [{
|
|
1438
1438
|
row: t,
|
|
1439
1439
|
idx: n
|
|
1440
1440
|
}]
|
|
1441
|
-
}) :
|
|
1441
|
+
}) : a.rows.push({
|
|
1442
1442
|
row: t,
|
|
1443
1443
|
idx: n
|
|
1444
1444
|
});
|
|
1445
|
-
}), s = e.map((e) => /* @__PURE__ */
|
|
1445
|
+
}), s = e.map((e) => /* @__PURE__ */ Y("div", {
|
|
1446
1446
|
style: {
|
|
1447
1447
|
display: "flex",
|
|
1448
1448
|
flexDirection: "column",
|
|
1449
1449
|
gap: 8
|
|
1450
1450
|
},
|
|
1451
|
-
children: [/* @__PURE__ */
|
|
1451
|
+
children: [/* @__PURE__ */ J(pt, {
|
|
1452
1452
|
label: e.label,
|
|
1453
1453
|
count: e.rows.length
|
|
1454
|
-
}), e.rows.map(({ row: e, idx: t }) =>
|
|
1454
|
+
}), e.rows.map(({ row: e, idx: t }) => i(e, t))]
|
|
1455
1455
|
}, `day-${e.key}`));
|
|
1456
|
-
} else s = _.map((e, t) =>
|
|
1457
|
-
P = /* @__PURE__ */
|
|
1458
|
-
N,
|
|
1456
|
+
} else s = _.map((e, t) => i(e, t));
|
|
1457
|
+
P = /* @__PURE__ */ Y(q, { children: [
|
|
1459
1458
|
ee,
|
|
1459
|
+
N,
|
|
1460
1460
|
s
|
|
1461
1461
|
] });
|
|
1462
1462
|
}
|
|
1463
|
-
return h ? /* @__PURE__ */
|
|
1463
|
+
return h ? /* @__PURE__ */ Y("div", {
|
|
1464
1464
|
style: {
|
|
1465
1465
|
display: "flex",
|
|
1466
1466
|
flexDirection: "column",
|
|
@@ -1470,13 +1470,13 @@ function at({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1470
1470
|
color: "var(--text)"
|
|
1471
1471
|
},
|
|
1472
1472
|
children: [
|
|
1473
|
-
/* @__PURE__ */
|
|
1473
|
+
/* @__PURE__ */ J("div", {
|
|
1474
1474
|
style: {
|
|
1475
1475
|
padding: "10px 16px",
|
|
1476
1476
|
borderBottom: "1px solid var(--divider)",
|
|
1477
1477
|
background: "var(--surface)"
|
|
1478
1478
|
},
|
|
1479
|
-
children: /* @__PURE__ */
|
|
1479
|
+
children: /* @__PURE__ */ J("h3", {
|
|
1480
1480
|
style: {
|
|
1481
1481
|
margin: 0,
|
|
1482
1482
|
fontSize: 12.5,
|
|
@@ -1485,7 +1485,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1485
1485
|
children: M
|
|
1486
1486
|
})
|
|
1487
1487
|
}),
|
|
1488
|
-
/* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ J("div", {
|
|
1489
1489
|
ref: y,
|
|
1490
1490
|
onScroll: D,
|
|
1491
1491
|
style: {
|
|
@@ -1498,73 +1498,73 @@ function at({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1498
1498
|
},
|
|
1499
1499
|
children: P
|
|
1500
1500
|
}),
|
|
1501
|
-
/* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ J(it, {
|
|
1502
1502
|
config: e,
|
|
1503
1503
|
parentEntity: t,
|
|
1504
1504
|
parentId: n,
|
|
1505
|
-
schema:
|
|
1505
|
+
schema: r
|
|
1506
1506
|
})
|
|
1507
1507
|
]
|
|
1508
|
-
}) : /* @__PURE__ */
|
|
1508
|
+
}) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
|
|
1509
1509
|
style: {
|
|
1510
1510
|
display: "flex",
|
|
1511
1511
|
flexDirection: "column",
|
|
1512
1512
|
gap: 8
|
|
1513
1513
|
},
|
|
1514
1514
|
children: P
|
|
1515
|
-
}), /* @__PURE__ */
|
|
1515
|
+
}), /* @__PURE__ */ J(it, {
|
|
1516
1516
|
config: e,
|
|
1517
1517
|
parentEntity: t,
|
|
1518
1518
|
parentId: n,
|
|
1519
|
-
schema:
|
|
1519
|
+
schema: r
|
|
1520
1520
|
})] });
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1523
|
-
let T =
|
|
1522
|
+
function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c, parentId: d, timeline: f, editableFields: p, refs: m, isEditing: h, onStartEdit: g, onCancelEdit: _, onSaved: y, schema: x, optimistic: w = !1 }) {
|
|
1523
|
+
let T = ye(), E = b(), [D, O] = K({}), A = H(() => {
|
|
1524
1524
|
T.invalidateQueries({ queryKey: [
|
|
1525
|
-
|
|
1526
|
-
|
|
1525
|
+
N,
|
|
1526
|
+
c,
|
|
1527
1527
|
d,
|
|
1528
1528
|
s
|
|
1529
1529
|
] });
|
|
1530
1530
|
}, [
|
|
1531
1531
|
T,
|
|
1532
|
-
|
|
1532
|
+
c,
|
|
1533
1533
|
d,
|
|
1534
1534
|
s
|
|
1535
|
-
]), j =
|
|
1535
|
+
]), j = ve({
|
|
1536
1536
|
mutationFn: (e) => {
|
|
1537
|
-
let
|
|
1538
|
-
return
|
|
1537
|
+
let r = t.$row_version;
|
|
1538
|
+
return S(s, n, typeof r == "string" && r !== "" ? {
|
|
1539
1539
|
...e,
|
|
1540
|
-
$row_version:
|
|
1540
|
+
$row_version: r
|
|
1541
1541
|
} : e);
|
|
1542
1542
|
},
|
|
1543
1543
|
onSuccess: () => {
|
|
1544
|
-
A(),
|
|
1544
|
+
A(), l.success("Updated"), y();
|
|
1545
1545
|
},
|
|
1546
|
-
onError: (e) =>
|
|
1547
|
-
}),
|
|
1548
|
-
mutationFn: () =>
|
|
1546
|
+
onError: (e) => l.error(e.message)
|
|
1547
|
+
}), M = ve({
|
|
1548
|
+
mutationFn: () => C(s, n),
|
|
1549
1549
|
onSuccess: () => {
|
|
1550
|
-
A(),
|
|
1550
|
+
A(), l.success("Deleted");
|
|
1551
1551
|
},
|
|
1552
|
-
onError: (e) =>
|
|
1553
|
-
}),
|
|
1552
|
+
onError: (e) => l.error(e.message)
|
|
1553
|
+
}), ee = H(() => {
|
|
1554
1554
|
let e = {};
|
|
1555
1555
|
for (let n of p) e[n] = t[n] ?? "";
|
|
1556
|
-
|
|
1556
|
+
O(e), g();
|
|
1557
1557
|
}, [
|
|
1558
1558
|
t,
|
|
1559
1559
|
p,
|
|
1560
1560
|
g
|
|
1561
|
-
]), P =
|
|
1562
|
-
|
|
1561
|
+
]), P = H((e, t) => {
|
|
1562
|
+
O((n) => ({
|
|
1563
1563
|
...n,
|
|
1564
1564
|
[e]: t
|
|
1565
1565
|
}));
|
|
1566
1566
|
}, []), F = f?.time_field, I = f?.type_field, L = f?.summary_field, R = f?.content_field, z = f?.author_field, B = f?.direction_field, V = f?.intent_field;
|
|
1567
|
-
return h ? /* @__PURE__ */
|
|
1567
|
+
return h ? /* @__PURE__ */ Y("div", {
|
|
1568
1568
|
style: {
|
|
1569
1569
|
borderRadius: 10,
|
|
1570
1570
|
border: "1px solid var(--accent)",
|
|
@@ -1575,16 +1575,16 @@ function ot({ row: t, rowId: i, childEntity: o, entityCode: s, parentEntity: u,
|
|
|
1575
1575
|
gap: 8
|
|
1576
1576
|
},
|
|
1577
1577
|
children: [p.map((e) => {
|
|
1578
|
-
let t =
|
|
1579
|
-
return t ? /* @__PURE__ */
|
|
1578
|
+
let t = a.fields.get(e);
|
|
1579
|
+
return t ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("label", {
|
|
1580
1580
|
style: {
|
|
1581
1581
|
fontSize: 11,
|
|
1582
1582
|
color: "var(--text-3)",
|
|
1583
1583
|
marginBottom: 4,
|
|
1584
1584
|
display: "block"
|
|
1585
1585
|
},
|
|
1586
|
-
children:
|
|
1587
|
-
}),
|
|
1586
|
+
children: k(t, e, x.entities)
|
|
1587
|
+
}), v({
|
|
1588
1588
|
field: t,
|
|
1589
1589
|
fieldName: e,
|
|
1590
1590
|
value: D[e] ?? "",
|
|
@@ -1593,31 +1593,31 @@ function ot({ row: t, rowId: i, childEntity: o, entityCode: s, parentEntity: u,
|
|
|
1593
1593
|
record: D,
|
|
1594
1594
|
locale: E
|
|
1595
1595
|
})] }, e) : null;
|
|
1596
|
-
}), /* @__PURE__ */
|
|
1596
|
+
}), /* @__PURE__ */ Y("div", {
|
|
1597
1597
|
style: {
|
|
1598
1598
|
display: "flex",
|
|
1599
1599
|
alignItems: "center",
|
|
1600
1600
|
gap: 6,
|
|
1601
1601
|
paddingTop: 4
|
|
1602
1602
|
},
|
|
1603
|
-
children: [/* @__PURE__ */
|
|
1603
|
+
children: [/* @__PURE__ */ J(i, {
|
|
1604
1604
|
kind: "primary",
|
|
1605
1605
|
size: "xs",
|
|
1606
|
-
icon: j.isPending ? /* @__PURE__ */
|
|
1606
|
+
icon: j.isPending ? /* @__PURE__ */ J(o, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
|
|
1607
1607
|
onClick: () => j.mutate(D),
|
|
1608
1608
|
disabled: j.isPending,
|
|
1609
1609
|
children: j.isPending ? "Saving…" : "Save"
|
|
1610
|
-
}), /* @__PURE__ */
|
|
1610
|
+
}), /* @__PURE__ */ J(i, {
|
|
1611
1611
|
size: "xs",
|
|
1612
|
-
icon: /* @__PURE__ */
|
|
1612
|
+
icon: /* @__PURE__ */ J(e.x, { size: 12 }),
|
|
1613
1613
|
onClick: () => {
|
|
1614
|
-
|
|
1614
|
+
O({}), _();
|
|
1615
1615
|
},
|
|
1616
1616
|
disabled: j.isPending,
|
|
1617
1617
|
children: "Cancel"
|
|
1618
1618
|
})]
|
|
1619
1619
|
})]
|
|
1620
|
-
}) : /* @__PURE__ */
|
|
1620
|
+
}) : /* @__PURE__ */ Y("div", {
|
|
1621
1621
|
className: "group",
|
|
1622
1622
|
"data-optimistic": w || void 0,
|
|
1623
1623
|
style: {
|
|
@@ -1631,7 +1631,7 @@ function ot({ row: t, rowId: i, childEntity: o, entityCode: s, parentEntity: u,
|
|
|
1631
1631
|
onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
|
|
1632
1632
|
onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
|
|
1633
1633
|
children: [
|
|
1634
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ Y("div", {
|
|
1635
1635
|
style: {
|
|
1636
1636
|
display: "flex",
|
|
1637
1637
|
alignItems: "center",
|
|
@@ -1641,10 +1641,10 @@ function ot({ row: t, rowId: i, childEntity: o, entityCode: s, parentEntity: u,
|
|
|
1641
1641
|
color: "var(--text-3)"
|
|
1642
1642
|
},
|
|
1643
1643
|
children: [
|
|
1644
|
-
F && t[F] != null &&
|
|
1644
|
+
F && t[F] != null && a.fields.get(F) && /* @__PURE__ */ J("span", {
|
|
1645
1645
|
style: { fontWeight: 500 },
|
|
1646
|
-
children:
|
|
1647
|
-
field:
|
|
1646
|
+
children: v({
|
|
1647
|
+
field: a.fields.get(F),
|
|
1648
1648
|
fieldName: F,
|
|
1649
1649
|
value: t[F],
|
|
1650
1650
|
mode: "display",
|
|
@@ -1653,11 +1653,11 @@ function ot({ row: t, rowId: i, childEntity: o, entityCode: s, parentEntity: u,
|
|
|
1653
1653
|
locale: E
|
|
1654
1654
|
})
|
|
1655
1655
|
}),
|
|
1656
|
-
I && t[I] != null &&
|
|
1656
|
+
I && t[I] != null && a.fields.get(I) && /* @__PURE__ */ J(u, {
|
|
1657
1657
|
tone: "slate",
|
|
1658
1658
|
size: "xs",
|
|
1659
|
-
children:
|
|
1660
|
-
field:
|
|
1659
|
+
children: v({
|
|
1660
|
+
field: a.fields.get(I),
|
|
1661
1661
|
fieldName: I,
|
|
1662
1662
|
value: t[I],
|
|
1663
1663
|
mode: "display",
|
|
@@ -1666,15 +1666,15 @@ function ot({ row: t, rowId: i, childEntity: o, entityCode: s, parentEntity: u,
|
|
|
1666
1666
|
locale: E
|
|
1667
1667
|
})
|
|
1668
1668
|
}),
|
|
1669
|
-
B && t[B] != null &&
|
|
1669
|
+
B && t[B] != null && a.fields.get(B) && /* @__PURE__ */ J(mt, {
|
|
1670
1670
|
value: t[B],
|
|
1671
|
-
field:
|
|
1671
|
+
field: a.fields.get(B)
|
|
1672
1672
|
}),
|
|
1673
|
-
V && t[V] != null &&
|
|
1673
|
+
V && t[V] != null && a.fields.get(V) && /* @__PURE__ */ J(u, {
|
|
1674
1674
|
tone: "slate",
|
|
1675
1675
|
size: "xs",
|
|
1676
|
-
children:
|
|
1677
|
-
field:
|
|
1676
|
+
children: v({
|
|
1677
|
+
field: a.fields.get(V),
|
|
1678
1678
|
fieldName: V,
|
|
1679
1679
|
value: t[V],
|
|
1680
1680
|
mode: "display",
|
|
@@ -1683,11 +1683,11 @@ function ot({ row: t, rowId: i, childEntity: o, entityCode: s, parentEntity: u,
|
|
|
1683
1683
|
locale: E
|
|
1684
1684
|
})
|
|
1685
1685
|
}),
|
|
1686
|
-
z && t[z] != null &&
|
|
1686
|
+
z && t[z] != null && a.fields.get(z) && /* @__PURE__ */ Y("span", { children: [
|
|
1687
1687
|
"by",
|
|
1688
1688
|
" ",
|
|
1689
|
-
|
|
1690
|
-
field:
|
|
1689
|
+
v({
|
|
1690
|
+
field: a.fields.get(z),
|
|
1691
1691
|
fieldName: z,
|
|
1692
1692
|
value: t[z],
|
|
1693
1693
|
mode: "display",
|
|
@@ -1696,35 +1696,35 @@ function ot({ row: t, rowId: i, childEntity: o, entityCode: s, parentEntity: u,
|
|
|
1696
1696
|
locale: E
|
|
1697
1697
|
})
|
|
1698
1698
|
] }),
|
|
1699
|
-
!w && /* @__PURE__ */
|
|
1699
|
+
!w && /* @__PURE__ */ Y("div", {
|
|
1700
1700
|
style: {
|
|
1701
1701
|
marginLeft: "auto",
|
|
1702
1702
|
display: "flex",
|
|
1703
1703
|
alignItems: "center",
|
|
1704
1704
|
gap: 2
|
|
1705
1705
|
},
|
|
1706
|
-
children: [/* @__PURE__ */
|
|
1706
|
+
children: [/* @__PURE__ */ J(r, {
|
|
1707
1707
|
size: 22,
|
|
1708
|
-
icon: /* @__PURE__ */
|
|
1709
|
-
onClick:
|
|
1708
|
+
icon: /* @__PURE__ */ J(e.edit, { size: 11 }),
|
|
1709
|
+
onClick: ee,
|
|
1710
1710
|
title: "Edit"
|
|
1711
|
-
}), /* @__PURE__ */
|
|
1711
|
+
}), /* @__PURE__ */ J(r, {
|
|
1712
1712
|
size: 22,
|
|
1713
|
-
icon: /* @__PURE__ */
|
|
1714
|
-
onClick: () =>
|
|
1713
|
+
icon: /* @__PURE__ */ J(e.trash, { size: 11 }),
|
|
1714
|
+
onClick: () => M.mutate(),
|
|
1715
1715
|
title: "Delete"
|
|
1716
1716
|
})]
|
|
1717
1717
|
})
|
|
1718
1718
|
]
|
|
1719
1719
|
}),
|
|
1720
|
-
L && t[L] != null &&
|
|
1720
|
+
L && t[L] != null && a.fields.get(L) && /* @__PURE__ */ J("div", {
|
|
1721
1721
|
style: {
|
|
1722
1722
|
fontSize: 12.5,
|
|
1723
1723
|
fontWeight: 500,
|
|
1724
1724
|
marginTop: 6
|
|
1725
1725
|
},
|
|
1726
|
-
children:
|
|
1727
|
-
field:
|
|
1726
|
+
children: v({
|
|
1727
|
+
field: a.fields.get(L),
|
|
1728
1728
|
fieldName: L,
|
|
1729
1729
|
value: t[L],
|
|
1730
1730
|
mode: "display",
|
|
@@ -1733,14 +1733,14 @@ function ot({ row: t, rowId: i, childEntity: o, entityCode: s, parentEntity: u,
|
|
|
1733
1733
|
locale: E
|
|
1734
1734
|
})
|
|
1735
1735
|
}),
|
|
1736
|
-
R && t[R] != null && R !== L &&
|
|
1736
|
+
R && t[R] != null && R !== L && a.fields.get(R) && /* @__PURE__ */ J("div", {
|
|
1737
1737
|
style: {
|
|
1738
1738
|
fontSize: 12.5,
|
|
1739
1739
|
fontWeight: 400,
|
|
1740
1740
|
marginTop: 6
|
|
1741
1741
|
},
|
|
1742
|
-
children:
|
|
1743
|
-
field:
|
|
1742
|
+
children: v({
|
|
1743
|
+
field: a.fields.get(R),
|
|
1744
1744
|
fieldName: R,
|
|
1745
1745
|
value: t[R],
|
|
1746
1746
|
mode: "display",
|
|
@@ -1752,14 +1752,14 @@ function ot({ row: t, rowId: i, childEntity: o, entityCode: s, parentEntity: u,
|
|
|
1752
1752
|
]
|
|
1753
1753
|
});
|
|
1754
1754
|
}
|
|
1755
|
-
function
|
|
1755
|
+
function dt(e) {
|
|
1756
1756
|
if (e == null) return "";
|
|
1757
|
-
let t = new Date(
|
|
1757
|
+
let t = new Date(m(e));
|
|
1758
1758
|
return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
|
|
1759
1759
|
}
|
|
1760
|
-
function
|
|
1760
|
+
function ft(e) {
|
|
1761
1761
|
if (e == null) return "—";
|
|
1762
|
-
let t = new Date(
|
|
1762
|
+
let t = new Date(m(e));
|
|
1763
1763
|
if (Number.isNaN(t.getTime())) return "—";
|
|
1764
1764
|
let n = /* @__PURE__ */ new Date(), r = /* @__PURE__ */ new Date();
|
|
1765
1765
|
r.setDate(n.getDate() - 1);
|
|
@@ -1770,8 +1770,8 @@ function ct(e) {
|
|
|
1770
1770
|
day: "numeric"
|
|
1771
1771
|
});
|
|
1772
1772
|
}
|
|
1773
|
-
function
|
|
1774
|
-
return /* @__PURE__ */
|
|
1773
|
+
function pt({ label: e, count: t }) {
|
|
1774
|
+
return /* @__PURE__ */ Y("div", {
|
|
1775
1775
|
style: {
|
|
1776
1776
|
position: "sticky",
|
|
1777
1777
|
top: -4,
|
|
@@ -1783,7 +1783,7 @@ function lt({ label: e, count: t }) {
|
|
|
1783
1783
|
background: "linear-gradient(180deg, var(--surface-2) 0%, var(--surface-2) 65%, transparent 100%)"
|
|
1784
1784
|
},
|
|
1785
1785
|
children: [
|
|
1786
|
-
/* @__PURE__ */
|
|
1786
|
+
/* @__PURE__ */ J("span", {
|
|
1787
1787
|
style: {
|
|
1788
1788
|
fontSize: 11,
|
|
1789
1789
|
fontWeight: 600,
|
|
@@ -1791,12 +1791,12 @@ function lt({ label: e, count: t }) {
|
|
|
1791
1791
|
},
|
|
1792
1792
|
children: e
|
|
1793
1793
|
}),
|
|
1794
|
-
/* @__PURE__ */
|
|
1794
|
+
/* @__PURE__ */ J("span", { style: {
|
|
1795
1795
|
flex: 1,
|
|
1796
1796
|
height: 1,
|
|
1797
1797
|
background: "var(--divider)"
|
|
1798
1798
|
} }),
|
|
1799
|
-
/* @__PURE__ */
|
|
1799
|
+
/* @__PURE__ */ J("span", {
|
|
1800
1800
|
className: "num",
|
|
1801
1801
|
style: {
|
|
1802
1802
|
fontSize: 10.5,
|
|
@@ -1807,9 +1807,9 @@ function lt({ label: e, count: t }) {
|
|
|
1807
1807
|
]
|
|
1808
1808
|
});
|
|
1809
1809
|
}
|
|
1810
|
-
function
|
|
1811
|
-
let r =
|
|
1812
|
-
return r === null ? null : /* @__PURE__ */
|
|
1810
|
+
function mt({ value: t, field: n }) {
|
|
1811
|
+
let r = ht(t, n);
|
|
1812
|
+
return r === null ? null : /* @__PURE__ */ Y("span", {
|
|
1813
1813
|
style: {
|
|
1814
1814
|
display: "inline-flex",
|
|
1815
1815
|
alignItems: "center",
|
|
@@ -1821,10 +1821,10 @@ function ut({ value: t, field: n }) {
|
|
|
1821
1821
|
background: r ? "var(--accent-soft)" : "var(--info-soft)",
|
|
1822
1822
|
color: r ? "var(--accent)" : "var(--info)"
|
|
1823
1823
|
},
|
|
1824
|
-
children: [
|
|
1824
|
+
children: [J(r ? e.arrowUp : e.arrowDown, { size: 10 }), r ? "Out" : "In"]
|
|
1825
1825
|
});
|
|
1826
1826
|
}
|
|
1827
|
-
function
|
|
1827
|
+
function ht(e, t) {
|
|
1828
1828
|
if (t.type === "bool") return e === !0;
|
|
1829
1829
|
if (typeof e == "string") {
|
|
1830
1830
|
let t = e.toLowerCase();
|
|
@@ -1835,22 +1835,22 @@ function dt(e, t) {
|
|
|
1835
1835
|
}
|
|
1836
1836
|
//#endregion
|
|
1837
1837
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
1838
|
-
function
|
|
1839
|
-
let d =
|
|
1840
|
-
if (
|
|
1841
|
-
let
|
|
1842
|
-
return !(!
|
|
1838
|
+
function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, validationErrors: c, refs: l, forceTablePresentation: u = !1 }) {
|
|
1839
|
+
let d = b(), f = j(), p = G(null), h = t.columns, g = t.position_field, _ = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), y = h.filter((e) => {
|
|
1840
|
+
if (_.has(e) || t.position_field && e === t.position_field) return !1;
|
|
1841
|
+
let r = n.fields.get(e);
|
|
1842
|
+
return !(!r || r.auto || r.primary || r.source);
|
|
1843
1843
|
}), x = new Set(h.filter((e) => {
|
|
1844
1844
|
if (t.position_field && e === t.position_field) return !0;
|
|
1845
|
-
let
|
|
1846
|
-
return
|
|
1847
|
-
})), S =
|
|
1845
|
+
let r = n.fields.get(e);
|
|
1846
|
+
return r && (r.auto || r.primary || r.source);
|
|
1847
|
+
})), S = H((e, t, n) => {
|
|
1848
1848
|
s(o.map((r) => r._key === e ? {
|
|
1849
1849
|
...r,
|
|
1850
1850
|
[t]: n,
|
|
1851
1851
|
_dirty: !0
|
|
1852
1852
|
} : r));
|
|
1853
|
-
}, [o, s]), C =
|
|
1853
|
+
}, [o, s]), C = H(() => {
|
|
1854
1854
|
let e = {
|
|
1855
1855
|
_key: crypto.randomUUID(),
|
|
1856
1856
|
_dirty: !0
|
|
@@ -1859,30 +1859,30 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
1859
1859
|
let n = typeof t[g] == "number" ? t[g] : -1;
|
|
1860
1860
|
return Math.max(e, n);
|
|
1861
1861
|
}, -1) + 1);
|
|
1862
|
-
let
|
|
1863
|
-
for (let t of
|
|
1864
|
-
let
|
|
1865
|
-
|
|
1862
|
+
let r = t.quick_add?.defaults ?? {};
|
|
1863
|
+
for (let t of y) {
|
|
1864
|
+
let i = n.fields.get(t);
|
|
1865
|
+
i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
|
|
1866
1866
|
}
|
|
1867
1867
|
s([...o, e]);
|
|
1868
1868
|
}, [
|
|
1869
1869
|
o,
|
|
1870
1870
|
s,
|
|
1871
|
-
|
|
1872
|
-
|
|
1871
|
+
y,
|
|
1872
|
+
n,
|
|
1873
1873
|
t.quick_add?.defaults,
|
|
1874
1874
|
g
|
|
1875
|
-
]), w =
|
|
1875
|
+
]), w = H((e) => {
|
|
1876
1876
|
s(o.map((t) => t._key === e ? {
|
|
1877
1877
|
...t,
|
|
1878
1878
|
_deleted: !0
|
|
1879
1879
|
} : t));
|
|
1880
|
-
}, [o, s]), T =
|
|
1880
|
+
}, [o, s]), T = H((e) => {
|
|
1881
1881
|
s(o.map((t) => t._key === e ? {
|
|
1882
1882
|
...t,
|
|
1883
1883
|
_deleted: !1
|
|
1884
1884
|
} : t));
|
|
1885
|
-
}, [o, s]), E =
|
|
1885
|
+
}, [o, s]), E = H((e, t) => {
|
|
1886
1886
|
if (!g) return;
|
|
1887
1887
|
let n = o.filter((e) => !e._deleted), r = o.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), a = i + t;
|
|
1888
1888
|
if (i < 0 || a < 0 || a >= n.length) return;
|
|
@@ -1896,7 +1896,7 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
1896
1896
|
o,
|
|
1897
1897
|
s,
|
|
1898
1898
|
g
|
|
1899
|
-
]), D =
|
|
1899
|
+
]), D = H((e) => {
|
|
1900
1900
|
let t = e.target, n = t.closest("td");
|
|
1901
1901
|
if (!n) return;
|
|
1902
1902
|
let r = n.closest("tr");
|
|
@@ -1928,16 +1928,16 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
1928
1928
|
}
|
|
1929
1929
|
});
|
|
1930
1930
|
} else e.key === "Escape" && t.blur?.();
|
|
1931
|
-
}, [C]),
|
|
1932
|
-
return f.isPhone && !u ? /* @__PURE__ */
|
|
1931
|
+
}, [C]), O = ce;
|
|
1932
|
+
return f.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
|
|
1933
1933
|
style: {
|
|
1934
1934
|
display: "flex",
|
|
1935
1935
|
flexDirection: "column",
|
|
1936
1936
|
gap: 10
|
|
1937
1937
|
},
|
|
1938
|
-
children: o.map((t,
|
|
1939
|
-
let s = !!t._deleted, u = c?.[t._key], f = g ? o.filter((e) => !e._deleted) : [],
|
|
1940
|
-
return /* @__PURE__ */
|
|
1938
|
+
children: o.map((t, i) => {
|
|
1939
|
+
let s = !!t._deleted, u = c?.[t._key], f = g ? o.filter((e) => !e._deleted) : [], p = g ? f.findIndex((e) => e._key === t._key) : -1;
|
|
1940
|
+
return /* @__PURE__ */ Y("div", {
|
|
1941
1941
|
style: {
|
|
1942
1942
|
border: "1px solid var(--border)",
|
|
1943
1943
|
borderRadius: 8,
|
|
@@ -1945,7 +1945,7 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
1945
1945
|
opacity: s ? .58 : 1,
|
|
1946
1946
|
overflow: "hidden"
|
|
1947
1947
|
},
|
|
1948
|
-
children: [/* @__PURE__ */
|
|
1948
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
1949
1949
|
style: {
|
|
1950
1950
|
minHeight: 38,
|
|
1951
1951
|
padding: "8px 10px",
|
|
@@ -1955,44 +1955,44 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
1955
1955
|
justifyContent: "space-between",
|
|
1956
1956
|
gap: 8
|
|
1957
1957
|
},
|
|
1958
|
-
children: [/* @__PURE__ */
|
|
1958
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
1959
1959
|
style: {
|
|
1960
1960
|
fontSize: 12,
|
|
1961
1961
|
fontWeight: 600,
|
|
1962
1962
|
color: "var(--text-2)"
|
|
1963
1963
|
},
|
|
1964
|
-
children: ["Row ",
|
|
1965
|
-
}), /* @__PURE__ */
|
|
1964
|
+
children: ["Row ", i + 1]
|
|
1965
|
+
}), /* @__PURE__ */ Y("div", {
|
|
1966
1966
|
style: {
|
|
1967
1967
|
display: "flex",
|
|
1968
1968
|
alignItems: "center",
|
|
1969
1969
|
gap: 4
|
|
1970
1970
|
},
|
|
1971
|
-
children: [g && !s && /* @__PURE__ */
|
|
1971
|
+
children: [g && !s && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(r, {
|
|
1972
1972
|
size: 32,
|
|
1973
|
-
icon: /* @__PURE__ */
|
|
1973
|
+
icon: /* @__PURE__ */ J(e.up, { size: 14 }),
|
|
1974
1974
|
onClick: () => E(t._key, -1),
|
|
1975
|
-
disabled:
|
|
1975
|
+
disabled: p <= 0,
|
|
1976
1976
|
title: "Move row up"
|
|
1977
|
-
}), /* @__PURE__ */
|
|
1977
|
+
}), /* @__PURE__ */ J(r, {
|
|
1978
1978
|
size: 32,
|
|
1979
|
-
icon: /* @__PURE__ */
|
|
1979
|
+
icon: /* @__PURE__ */ J(e.down, { size: 14 }),
|
|
1980
1980
|
onClick: () => E(t._key, 1),
|
|
1981
|
-
disabled:
|
|
1981
|
+
disabled: p === -1 || p >= f.length - 1,
|
|
1982
1982
|
title: "Move row down"
|
|
1983
|
-
})] }), s ? /* @__PURE__ */
|
|
1983
|
+
})] }), s ? /* @__PURE__ */ J(r, {
|
|
1984
1984
|
size: 32,
|
|
1985
|
-
icon: /* @__PURE__ */
|
|
1985
|
+
icon: /* @__PURE__ */ J(e.refresh, { size: 14 }),
|
|
1986
1986
|
onClick: () => T(t._key),
|
|
1987
1987
|
title: "Undo delete"
|
|
1988
|
-
}) : /* @__PURE__ */
|
|
1988
|
+
}) : /* @__PURE__ */ J(r, {
|
|
1989
1989
|
size: 32,
|
|
1990
|
-
icon: /* @__PURE__ */
|
|
1990
|
+
icon: /* @__PURE__ */ J(e.trash, { size: 14 }),
|
|
1991
1991
|
onClick: () => w(t._key),
|
|
1992
1992
|
title: "Delete row"
|
|
1993
1993
|
})]
|
|
1994
1994
|
})]
|
|
1995
|
-
}), /* @__PURE__ */
|
|
1995
|
+
}), /* @__PURE__ */ J("div", {
|
|
1996
1996
|
style: {
|
|
1997
1997
|
padding: 10,
|
|
1998
1998
|
display: "flex",
|
|
@@ -2000,16 +2000,16 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
2000
2000
|
gap: 12
|
|
2001
2001
|
},
|
|
2002
2002
|
children: h.map((e) => {
|
|
2003
|
-
let
|
|
2004
|
-
outline:
|
|
2003
|
+
let r = n.fields.get(e), i = u?.includes(e), o = x.has(e), c = r ? k(r, e, a.entities) : e, f = `child-${t._key}-${e}`, p = `${f}-label`, h = {
|
|
2004
|
+
outline: i ? "1px solid var(--danger)" : "none",
|
|
2005
2005
|
outlineOffset: 3,
|
|
2006
|
-
borderRadius:
|
|
2006
|
+
borderRadius: i ? 5 : 0
|
|
2007
2007
|
}, g = {
|
|
2008
2008
|
fontSize: 11.5,
|
|
2009
2009
|
fontWeight: 600,
|
|
2010
2010
|
color: "var(--text-3)"
|
|
2011
|
-
},
|
|
2012
|
-
return /* @__PURE__ */
|
|
2011
|
+
}, _ = !s && !o && !!r;
|
|
2012
|
+
return /* @__PURE__ */ Y("div", {
|
|
2013
2013
|
style: {
|
|
2014
2014
|
display: "flex",
|
|
2015
2015
|
flexDirection: "column",
|
|
@@ -2017,30 +2017,30 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
2017
2017
|
minWidth: 0,
|
|
2018
2018
|
textDecoration: s ? "line-through" : "none"
|
|
2019
2019
|
},
|
|
2020
|
-
title:
|
|
2021
|
-
children: [
|
|
2022
|
-
id:
|
|
2020
|
+
title: i ? `${e} is required` : void 0,
|
|
2021
|
+
children: [_ ? /* @__PURE__ */ J("label", {
|
|
2022
|
+
id: p,
|
|
2023
2023
|
htmlFor: f,
|
|
2024
2024
|
style: g,
|
|
2025
2025
|
children: c
|
|
2026
|
-
}) : /* @__PURE__ */
|
|
2027
|
-
id:
|
|
2026
|
+
}) : /* @__PURE__ */ J("div", {
|
|
2027
|
+
id: p,
|
|
2028
2028
|
style: g,
|
|
2029
2029
|
children: c
|
|
2030
|
-
}), /* @__PURE__ */
|
|
2030
|
+
}), /* @__PURE__ */ J("div", {
|
|
2031
2031
|
style: h,
|
|
2032
|
-
children: s || o ?
|
|
2033
|
-
field:
|
|
2032
|
+
children: s || o ? r ? v({
|
|
2033
|
+
field: r,
|
|
2034
2034
|
fieldName: e,
|
|
2035
2035
|
value: t[e],
|
|
2036
2036
|
mode: "display",
|
|
2037
2037
|
record: t,
|
|
2038
2038
|
refs: l,
|
|
2039
2039
|
fieldId: f,
|
|
2040
|
-
labelId:
|
|
2040
|
+
labelId: p,
|
|
2041
2041
|
locale: d
|
|
2042
|
-
}) :
|
|
2043
|
-
field:
|
|
2042
|
+
}) : m(t[e]) : r ? v({
|
|
2043
|
+
field: r,
|
|
2044
2044
|
fieldName: e,
|
|
2045
2045
|
value: t[e],
|
|
2046
2046
|
mode: "edit",
|
|
@@ -2049,63 +2049,63 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
2049
2049
|
refs: l,
|
|
2050
2050
|
compact: !0,
|
|
2051
2051
|
fieldId: f,
|
|
2052
|
-
labelId:
|
|
2052
|
+
labelId: p,
|
|
2053
2053
|
locale: d
|
|
2054
|
-
}) :
|
|
2054
|
+
}) : m(t[e])
|
|
2055
2055
|
})]
|
|
2056
2056
|
}, e);
|
|
2057
2057
|
})
|
|
2058
2058
|
})]
|
|
2059
2059
|
}, t._key);
|
|
2060
2060
|
})
|
|
2061
|
-
}), /* @__PURE__ */
|
|
2061
|
+
}), /* @__PURE__ */ J("div", {
|
|
2062
2062
|
style: { marginTop: 10 },
|
|
2063
|
-
children: /* @__PURE__ */
|
|
2063
|
+
children: /* @__PURE__ */ J(i, {
|
|
2064
2064
|
kind: "ghost",
|
|
2065
2065
|
size: "sm",
|
|
2066
|
-
icon: /* @__PURE__ */
|
|
2066
|
+
icon: /* @__PURE__ */ J(e.plus, { size: 14 }),
|
|
2067
2067
|
onClick: C,
|
|
2068
2068
|
children: "Add row"
|
|
2069
2069
|
})
|
|
2070
|
-
})] }) : /* @__PURE__ */
|
|
2070
|
+
})] }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
|
|
2071
2071
|
style: { overflowX: "auto" },
|
|
2072
|
-
children: /* @__PURE__ */
|
|
2073
|
-
ref:
|
|
2074
|
-
style:
|
|
2072
|
+
children: /* @__PURE__ */ Y("table", {
|
|
2073
|
+
ref: p,
|
|
2074
|
+
style: le,
|
|
2075
2075
|
onKeyDown: D,
|
|
2076
|
-
children: [/* @__PURE__ */
|
|
2077
|
-
let t =
|
|
2078
|
-
return /* @__PURE__ */
|
|
2079
|
-
style:
|
|
2080
|
-
children: t ?
|
|
2076
|
+
children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [h.map((e) => {
|
|
2077
|
+
let t = n.fields.get(e);
|
|
2078
|
+
return /* @__PURE__ */ J("th", {
|
|
2079
|
+
style: O,
|
|
2080
|
+
children: t ? k(t, e, a.entities) : e
|
|
2081
2081
|
}, e);
|
|
2082
|
-
}), /* @__PURE__ */
|
|
2083
|
-
...
|
|
2082
|
+
}), /* @__PURE__ */ J("th", { style: {
|
|
2083
|
+
...O,
|
|
2084
2084
|
width: 40
|
|
2085
|
-
} })] }) }), /* @__PURE__ */
|
|
2086
|
-
let
|
|
2087
|
-
return /* @__PURE__ */
|
|
2088
|
-
style: { opacity:
|
|
2085
|
+
} })] }) }), /* @__PURE__ */ J("tbody", { children: o.map((t) => {
|
|
2086
|
+
let i = !!t._deleted, a = c?.[t._key];
|
|
2087
|
+
return /* @__PURE__ */ Y("tr", {
|
|
2088
|
+
style: { opacity: i ? .5 : 1 },
|
|
2089
2089
|
children: [h.map((e) => {
|
|
2090
|
-
let
|
|
2091
|
-
return
|
|
2090
|
+
let r = n.fields.get(e), o = a?.includes(e), s = x.has(e);
|
|
2091
|
+
return i || s ? /* @__PURE__ */ J("td", {
|
|
2092
2092
|
style: {
|
|
2093
2093
|
padding: "6px 12px",
|
|
2094
2094
|
borderBottom: "1px solid var(--divider)",
|
|
2095
2095
|
verticalAlign: "middle",
|
|
2096
|
-
textDecoration:
|
|
2096
|
+
textDecoration: i ? "line-through" : "none",
|
|
2097
2097
|
color: "var(--text-2)"
|
|
2098
2098
|
},
|
|
2099
|
-
children:
|
|
2100
|
-
field:
|
|
2099
|
+
children: r ? v({
|
|
2100
|
+
field: r,
|
|
2101
2101
|
fieldName: e,
|
|
2102
2102
|
value: t[e],
|
|
2103
2103
|
mode: "display",
|
|
2104
2104
|
record: t,
|
|
2105
2105
|
refs: l,
|
|
2106
2106
|
locale: d
|
|
2107
|
-
}) :
|
|
2108
|
-
}, e) : /* @__PURE__ */
|
|
2107
|
+
}) : m(t[e])
|
|
2108
|
+
}, e) : /* @__PURE__ */ J("td", {
|
|
2109
2109
|
style: {
|
|
2110
2110
|
padding: "4px 4px",
|
|
2111
2111
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -2115,8 +2115,8 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
2115
2115
|
borderRadius: o ? 4 : 0
|
|
2116
2116
|
},
|
|
2117
2117
|
title: o ? `${e} is required` : void 0,
|
|
2118
|
-
children:
|
|
2119
|
-
field:
|
|
2118
|
+
children: r ? v({
|
|
2119
|
+
field: r,
|
|
2120
2120
|
fieldName: e,
|
|
2121
2121
|
value: t[e],
|
|
2122
2122
|
mode: "edit",
|
|
@@ -2125,22 +2125,22 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
2125
2125
|
refs: l,
|
|
2126
2126
|
compact: !0,
|
|
2127
2127
|
locale: d
|
|
2128
|
-
}) :
|
|
2128
|
+
}) : m(t[e])
|
|
2129
2129
|
}, e);
|
|
2130
|
-
}), /* @__PURE__ */
|
|
2130
|
+
}), /* @__PURE__ */ J("td", {
|
|
2131
2131
|
style: {
|
|
2132
2132
|
padding: "4px 8px",
|
|
2133
2133
|
borderBottom: "1px solid var(--divider)",
|
|
2134
2134
|
verticalAlign: "middle"
|
|
2135
2135
|
},
|
|
2136
|
-
children:
|
|
2136
|
+
children: i ? /* @__PURE__ */ J(r, {
|
|
2137
2137
|
size: 24,
|
|
2138
|
-
icon: /* @__PURE__ */
|
|
2138
|
+
icon: /* @__PURE__ */ J(e.refresh, { size: 12 }),
|
|
2139
2139
|
onClick: () => T(t._key),
|
|
2140
2140
|
title: "Undo delete"
|
|
2141
|
-
}) : /* @__PURE__ */
|
|
2141
|
+
}) : /* @__PURE__ */ J(r, {
|
|
2142
2142
|
size: 24,
|
|
2143
|
-
icon: /* @__PURE__ */
|
|
2143
|
+
icon: /* @__PURE__ */ J(e.trash, { size: 12 }),
|
|
2144
2144
|
onClick: () => w(t._key),
|
|
2145
2145
|
title: "Delete row"
|
|
2146
2146
|
})
|
|
@@ -2148,12 +2148,12 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
2148
2148
|
}, t._key);
|
|
2149
2149
|
}) })]
|
|
2150
2150
|
})
|
|
2151
|
-
}), /* @__PURE__ */
|
|
2151
|
+
}), /* @__PURE__ */ J("div", {
|
|
2152
2152
|
style: { marginTop: 8 },
|
|
2153
|
-
children: /* @__PURE__ */
|
|
2153
|
+
children: /* @__PURE__ */ J(i, {
|
|
2154
2154
|
kind: "ghost",
|
|
2155
2155
|
size: "xs",
|
|
2156
|
-
icon: /* @__PURE__ */
|
|
2156
|
+
icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
|
|
2157
2157
|
onClick: C,
|
|
2158
2158
|
children: "Add row"
|
|
2159
2159
|
})
|
|
@@ -2161,35 +2161,35 @@ function ft({ config: t, childEntity: i, schema: a, rows: o, onChange: s, valida
|
|
|
2161
2161
|
}
|
|
2162
2162
|
//#endregion
|
|
2163
2163
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
2164
|
-
var
|
|
2165
|
-
function
|
|
2166
|
-
let r =
|
|
2164
|
+
var _t = pe(() => import("./DraggableChildrenTable-CI5a0Emm.js").then((e) => ({ default: e.DraggableChildrenTable })));
|
|
2165
|
+
function vt({ node: e, ctx: n }) {
|
|
2166
|
+
let r = j(), i = e.children;
|
|
2167
2167
|
if (!i) return null;
|
|
2168
2168
|
let a = r.isPhone && n.relatedRecordsPresentation === "table";
|
|
2169
2169
|
if (n.isNew && n.mode !== "edit") return null;
|
|
2170
|
-
let o =
|
|
2171
|
-
if (!o) return /* @__PURE__ */
|
|
2170
|
+
let o = Ue(n.entity, i);
|
|
2171
|
+
if (!o) return /* @__PURE__ */ Y("div", {
|
|
2172
2172
|
className: "text-sm text-muted-foreground py-2",
|
|
2173
2173
|
children: ["Unknown child relation: ", i]
|
|
2174
2174
|
});
|
|
2175
2175
|
let s = n.schema.entities[o.entity];
|
|
2176
|
-
if (!s) return /* @__PURE__ */
|
|
2176
|
+
if (!s) return /* @__PURE__ */ Y("div", {
|
|
2177
2177
|
className: "text-sm text-muted-foreground py-2",
|
|
2178
2178
|
children: ["Entity not found: ", o.entity]
|
|
2179
2179
|
});
|
|
2180
|
-
let c =
|
|
2180
|
+
let c = je(o, s, e), l = De(e, n), u = Oe(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(P, {
|
|
2181
2181
|
title: l,
|
|
2182
|
-
icon: u ? /* @__PURE__ */
|
|
2182
|
+
icon: u ? /* @__PURE__ */ J(t, {
|
|
2183
2183
|
name: u,
|
|
2184
2184
|
size: 14
|
|
2185
2185
|
}) : void 0,
|
|
2186
2186
|
children: e
|
|
2187
2187
|
});
|
|
2188
|
-
if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" &&
|
|
2189
|
-
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ?
|
|
2190
|
-
return
|
|
2191
|
-
fallback: /* @__PURE__ */
|
|
2192
|
-
children: /* @__PURE__ */
|
|
2188
|
+
if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && f(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
|
|
2189
|
+
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ? gt : _t : gt;
|
|
2190
|
+
return d(/* @__PURE__ */ J(de, {
|
|
2191
|
+
fallback: /* @__PURE__ */ J(F, {}),
|
|
2192
|
+
children: /* @__PURE__ */ J(o, {
|
|
2193
2193
|
config: c,
|
|
2194
2194
|
childEntity: s,
|
|
2195
2195
|
schema: n.schema,
|
|
@@ -2209,35 +2209,35 @@ function mt({ node: e, ctx: n }) {
|
|
|
2209
2209
|
schema: n.schema
|
|
2210
2210
|
};
|
|
2211
2211
|
switch (c.mode) {
|
|
2212
|
-
case "list": return
|
|
2213
|
-
case "cards": return
|
|
2214
|
-
case "timeline": return
|
|
2215
|
-
default: return r.isPhone && !a ?
|
|
2212
|
+
case "list": return d(/* @__PURE__ */ J(Ye, { ...p }));
|
|
2213
|
+
case "cards": return d(/* @__PURE__ */ J(Xe, { ...p }));
|
|
2214
|
+
case "timeline": return d(/* @__PURE__ */ J(lt, { ...p }));
|
|
2215
|
+
default: return r.isPhone && !a ? d(/* @__PURE__ */ J(Xe, { ...p })) : d(/* @__PURE__ */ J(Je, { ...p }));
|
|
2216
2216
|
}
|
|
2217
2217
|
}
|
|
2218
2218
|
//#endregion
|
|
2219
2219
|
//#region src/components/detail-layout/FieldRow.tsx
|
|
2220
|
-
var
|
|
2220
|
+
var yt = 150, bt = 560, xt = "20px", St = 4, Ct = /* @__PURE__ */ new Set([
|
|
2221
2221
|
"text",
|
|
2222
2222
|
"rich_text",
|
|
2223
2223
|
"json",
|
|
2224
2224
|
"structure",
|
|
2225
2225
|
"multilang_text"
|
|
2226
|
-
]),
|
|
2227
|
-
function
|
|
2228
|
-
let n =
|
|
2229
|
-
|
|
2226
|
+
]), wt = fe({ columns: 2 });
|
|
2227
|
+
function Tt({ columns: e = 2, children: t }) {
|
|
2228
|
+
let n = G(null), [r, i] = K(!1);
|
|
2229
|
+
U(() => {
|
|
2230
2230
|
let t = n.current;
|
|
2231
2231
|
if (!t || e === 1 || typeof ResizeObserver > "u") return;
|
|
2232
2232
|
let r = new ResizeObserver(([e]) => {
|
|
2233
|
-
i(e.contentRect.width <
|
|
2233
|
+
i(e.contentRect.width < bt);
|
|
2234
2234
|
});
|
|
2235
2235
|
return r.observe(t), () => r.disconnect();
|
|
2236
2236
|
}, [e]);
|
|
2237
2237
|
let a = e === 1 || r ? 1 : e;
|
|
2238
|
-
return /* @__PURE__ */
|
|
2238
|
+
return /* @__PURE__ */ J(wt.Provider, {
|
|
2239
2239
|
value: { columns: a },
|
|
2240
|
-
children: /* @__PURE__ */
|
|
2240
|
+
children: /* @__PURE__ */ J("div", {
|
|
2241
2241
|
ref: n,
|
|
2242
2242
|
style: {
|
|
2243
2243
|
display: "grid",
|
|
@@ -2249,9 +2249,9 @@ function xt({ columns: e = 2, children: t }) {
|
|
|
2249
2249
|
})
|
|
2250
2250
|
});
|
|
2251
2251
|
}
|
|
2252
|
-
function
|
|
2253
|
-
let h =
|
|
2254
|
-
return /* @__PURE__ */
|
|
2252
|
+
function Et({ label: t, children: n, span: r = !1, required: i, error: a, hint: o, actions: s, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
|
|
2253
|
+
let h = me(wt), g = r || h.columns === 1, _ = !!a;
|
|
2254
|
+
return /* @__PURE__ */ Y("div", {
|
|
2255
2255
|
className: "detail-row",
|
|
2256
2256
|
"data-error": _ || void 0,
|
|
2257
2257
|
"data-testid": m,
|
|
@@ -2263,29 +2263,29 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2263
2263
|
padding: "6px 0",
|
|
2264
2264
|
...r ? { gridColumn: "1 / -1" } : null
|
|
2265
2265
|
},
|
|
2266
|
-
children: [/* @__PURE__ */
|
|
2266
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2267
2267
|
style: {
|
|
2268
|
-
width: g ? "auto" :
|
|
2268
|
+
width: g ? "auto" : yt,
|
|
2269
2269
|
flexShrink: 0,
|
|
2270
|
-
paddingTop: g ? 0 :
|
|
2270
|
+
paddingTop: g ? 0 : St,
|
|
2271
2271
|
fontSize: 12,
|
|
2272
|
-
lineHeight:
|
|
2272
|
+
lineHeight: xt,
|
|
2273
2273
|
fontWeight: 500,
|
|
2274
2274
|
color: "var(--text-3)",
|
|
2275
2275
|
display: "flex",
|
|
2276
2276
|
alignItems: "flex-start",
|
|
2277
2277
|
gap: 2
|
|
2278
2278
|
},
|
|
2279
|
-
children: [d ? /* @__PURE__ */
|
|
2279
|
+
children: [d ? /* @__PURE__ */ J("label", {
|
|
2280
2280
|
id: f,
|
|
2281
2281
|
htmlFor: d,
|
|
2282
2282
|
title: p || void 0,
|
|
2283
2283
|
children: t
|
|
2284
|
-
}) : /* @__PURE__ */
|
|
2284
|
+
}) : /* @__PURE__ */ J("span", {
|
|
2285
2285
|
id: f,
|
|
2286
2286
|
title: p || void 0,
|
|
2287
2287
|
children: t
|
|
2288
|
-
}), i && u === "edit" && /* @__PURE__ */
|
|
2288
|
+
}), i && u === "edit" && /* @__PURE__ */ J("span", {
|
|
2289
2289
|
"aria-hidden": "true",
|
|
2290
2290
|
style: {
|
|
2291
2291
|
color: "var(--danger)",
|
|
@@ -2293,7 +2293,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2293
2293
|
},
|
|
2294
2294
|
children: "*"
|
|
2295
2295
|
})]
|
|
2296
|
-
}), /* @__PURE__ */
|
|
2296
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2297
2297
|
style: {
|
|
2298
2298
|
flex: 1,
|
|
2299
2299
|
minWidth: 0,
|
|
@@ -2301,31 +2301,31 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2301
2301
|
flexDirection: "column",
|
|
2302
2302
|
gap: 3
|
|
2303
2303
|
},
|
|
2304
|
-
children: [/* @__PURE__ */
|
|
2304
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2305
2305
|
style: {
|
|
2306
2306
|
display: "flex",
|
|
2307
2307
|
alignItems: "flex-start",
|
|
2308
2308
|
gap: 6,
|
|
2309
2309
|
minHeight: 24
|
|
2310
2310
|
},
|
|
2311
|
-
children: [/* @__PURE__ */
|
|
2311
|
+
children: [/* @__PURE__ */ J("div", {
|
|
2312
2312
|
style: {
|
|
2313
2313
|
flex: 1,
|
|
2314
2314
|
minWidth: 0,
|
|
2315
2315
|
fontSize: 13,
|
|
2316
|
-
lineHeight:
|
|
2316
|
+
lineHeight: xt,
|
|
2317
2317
|
color: "var(--text)",
|
|
2318
2318
|
overflowWrap: "anywhere",
|
|
2319
|
-
paddingTop: u === "display" && !g ?
|
|
2319
|
+
paddingTop: u === "display" && !g ? St : 0
|
|
2320
2320
|
},
|
|
2321
|
-
children: _ && u === "edit" ? /* @__PURE__ */
|
|
2321
|
+
children: _ && u === "edit" ? /* @__PURE__ */ J("div", {
|
|
2322
2322
|
style: {
|
|
2323
2323
|
borderRadius: 6,
|
|
2324
2324
|
boxShadow: "0 0 0 1.5px var(--danger)"
|
|
2325
2325
|
},
|
|
2326
2326
|
children: n
|
|
2327
2327
|
}) : n
|
|
2328
|
-
}), (l ||
|
|
2328
|
+
}), (l || s) && /* @__PURE__ */ Y("div", {
|
|
2329
2329
|
className: "detail-row-action",
|
|
2330
2330
|
style: {
|
|
2331
2331
|
display: "flex",
|
|
@@ -2333,13 +2333,13 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2333
2333
|
flexShrink: 0,
|
|
2334
2334
|
marginTop: -2
|
|
2335
2335
|
},
|
|
2336
|
-
children: [l && /* @__PURE__ */
|
|
2336
|
+
children: [l && /* @__PURE__ */ J(c, {
|
|
2337
2337
|
value: l,
|
|
2338
2338
|
size: "sm",
|
|
2339
2339
|
title: "Copy value"
|
|
2340
|
-
}),
|
|
2340
|
+
}), s]
|
|
2341
2341
|
})]
|
|
2342
|
-
}), (_ || o != null) && /* @__PURE__ */
|
|
2342
|
+
}), (_ || o != null) && /* @__PURE__ */ Y("div", {
|
|
2343
2343
|
style: {
|
|
2344
2344
|
fontSize: 11.5,
|
|
2345
2345
|
lineHeight: 1.4,
|
|
@@ -2348,25 +2348,25 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2348
2348
|
alignItems: "center",
|
|
2349
2349
|
gap: 4
|
|
2350
2350
|
},
|
|
2351
|
-
children: [_ && /* @__PURE__ */
|
|
2351
|
+
children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ? a : o })]
|
|
2352
2352
|
})]
|
|
2353
2353
|
})]
|
|
2354
2354
|
});
|
|
2355
2355
|
}
|
|
2356
2356
|
//#endregion
|
|
2357
2357
|
//#region src/components/detail-layout/FieldsBlock.tsx
|
|
2358
|
-
function
|
|
2359
|
-
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c =
|
|
2360
|
-
return /* @__PURE__ */
|
|
2358
|
+
function Dt({ fields: e, ctx: t }) {
|
|
2359
|
+
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = b(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
|
|
2360
|
+
return /* @__PURE__ */ J(Tt, {
|
|
2361
2361
|
columns: l,
|
|
2362
2362
|
children: e.map((e) => {
|
|
2363
|
-
let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`,
|
|
2363
|
+
let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), h = !!(p?.auto || p?.readonly || p?.source), g = L(n, l), _ = g?.read === "denied", v = g?.write === "denied", y = a === "display" ? _ : v || _, b = h || a === "edit" && v ? "display" : a, x = y ? /* @__PURE__ */ J(se, {
|
|
2364
2364
|
tier: g.classification,
|
|
2365
|
-
tierDef:
|
|
2365
|
+
tierDef: oe(s, n, l),
|
|
2366
2366
|
requiredPermission: g?.required_permission,
|
|
2367
2367
|
locale: c,
|
|
2368
2368
|
variant: b === "edit" ? "input" : "value"
|
|
2369
|
-
}) :
|
|
2369
|
+
}) : z({
|
|
2370
2370
|
entity: n,
|
|
2371
2371
|
entityCode: r,
|
|
2372
2372
|
fieldName: l,
|
|
@@ -2381,17 +2381,17 @@ function Ct({ fields: e, ctx: t }) {
|
|
|
2381
2381
|
labelId: f
|
|
2382
2382
|
});
|
|
2383
2383
|
if (!x) return null;
|
|
2384
|
-
let S = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */
|
|
2384
|
+
let S = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(B, {
|
|
2385
2385
|
actionCode: `${l}.action[${t}]`,
|
|
2386
2386
|
action: e,
|
|
2387
2387
|
entityCode: r,
|
|
2388
2388
|
row: i,
|
|
2389
2389
|
variant: "ghost",
|
|
2390
2390
|
size: "icon"
|
|
2391
|
-
}, t)) }) : void 0, C = !!
|
|
2392
|
-
return u ? /* @__PURE__ */
|
|
2391
|
+
}, t)) }) : void 0, C = !!p && Ct.has(p.type), w = i?.[l], T = b === "display" && (p?.copyable || p?.type === "uuid") && w != null && w !== "" ? m(w) : void 0, E = A(p?.display?.description);
|
|
2392
|
+
return u ? /* @__PURE__ */ Y("div", {
|
|
2393
2393
|
style: { gridColumn: "1 / -1" },
|
|
2394
|
-
children: [x, b === "edit" && E && /* @__PURE__ */
|
|
2394
|
+
children: [x, b === "edit" && E && /* @__PURE__ */ J("div", {
|
|
2395
2395
|
style: {
|
|
2396
2396
|
fontSize: 11.5,
|
|
2397
2397
|
lineHeight: 1.4,
|
|
@@ -2400,12 +2400,12 @@ function Ct({ fields: e, ctx: t }) {
|
|
|
2400
2400
|
},
|
|
2401
2401
|
children: E
|
|
2402
2402
|
})]
|
|
2403
|
-
}, l) : /* @__PURE__ */
|
|
2404
|
-
label:
|
|
2403
|
+
}, l) : /* @__PURE__ */ J(Et, {
|
|
2404
|
+
label: ae(n, l, s.entities),
|
|
2405
2405
|
htmlFor: b === "edit" ? d : void 0,
|
|
2406
2406
|
labelId: f,
|
|
2407
2407
|
labelTitle: E || void 0,
|
|
2408
|
-
required:
|
|
2408
|
+
required: p?.required ?? !1,
|
|
2409
2409
|
mode: b,
|
|
2410
2410
|
span: C,
|
|
2411
2411
|
error: t.fieldErrors?.[l],
|
|
@@ -2419,7 +2419,7 @@ function Ct({ fields: e, ctx: t }) {
|
|
|
2419
2419
|
}
|
|
2420
2420
|
//#endregion
|
|
2421
2421
|
//#region src/components/detail-layout/PropertiesBlock.tsx
|
|
2422
|
-
var
|
|
2422
|
+
var Ot = /* @__PURE__ */ new Set([
|
|
2423
2423
|
"string",
|
|
2424
2424
|
"text",
|
|
2425
2425
|
"int",
|
|
@@ -2427,16 +2427,16 @@ var wt = /* @__PURE__ */ new Set([
|
|
|
2427
2427
|
"decimal",
|
|
2428
2428
|
"email",
|
|
2429
2429
|
"url"
|
|
2430
|
-
]),
|
|
2431
|
-
function
|
|
2430
|
+
]), kt = 500;
|
|
2431
|
+
function At({ node: e, ctx: t }) {
|
|
2432
2432
|
let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
|
|
2433
2433
|
if (a) return null;
|
|
2434
2434
|
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]]);
|
|
2435
|
-
return u.length === 0 ? null : /* @__PURE__ */
|
|
2435
|
+
return u.length === 0 ? null : /* @__PURE__ */ J(Tt, {
|
|
2436
2436
|
columns: 2,
|
|
2437
2437
|
children: u.map(([e, a]) => {
|
|
2438
|
-
let c = r?.find((t) => t.property_code === e), l =
|
|
2439
|
-
return /* @__PURE__ */
|
|
2438
|
+
let c = r?.find((t) => t.property_code === e), l = x(a), u = a.readonly || !i ? "display" : o;
|
|
2439
|
+
return /* @__PURE__ */ J(jt, {
|
|
2440
2440
|
propCode: e,
|
|
2441
2441
|
prop: a,
|
|
2442
2442
|
field: l,
|
|
@@ -2450,29 +2450,29 @@ function Et({ node: e, ctx: t }) {
|
|
|
2450
2450
|
})
|
|
2451
2451
|
});
|
|
2452
2452
|
}
|
|
2453
|
-
function
|
|
2454
|
-
let l =
|
|
2455
|
-
|
|
2453
|
+
function jt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: s, schema: c }) {
|
|
2454
|
+
let l = b(), u = G(null);
|
|
2455
|
+
U(() => () => {
|
|
2456
2456
|
u.current && clearTimeout(u.current);
|
|
2457
2457
|
}, []);
|
|
2458
|
-
let d =
|
|
2459
|
-
a && (
|
|
2458
|
+
let d = H((n) => {
|
|
2459
|
+
a && (Ot.has(t.type) ? (u.current && clearTimeout(u.current), u.current = setTimeout(() => a(e, n), kt)) : a(e, n));
|
|
2460
2460
|
}, [
|
|
2461
2461
|
e,
|
|
2462
2462
|
t.type,
|
|
2463
2463
|
a
|
|
2464
|
-
]), f =
|
|
2465
|
-
return /* @__PURE__ */
|
|
2466
|
-
label:
|
|
2464
|
+
]), f = L(s, e), p = f?.read === "denied", m = f?.write === "denied", h = i === "display" ? p : m || p, g = i === "edit" && m ? "display" : i;
|
|
2465
|
+
return /* @__PURE__ */ J(Et, {
|
|
2466
|
+
label: A(t.display?.name ?? t.name),
|
|
2467
2467
|
mode: g,
|
|
2468
|
-
span:
|
|
2469
|
-
children: h ? /* @__PURE__ */
|
|
2468
|
+
span: Ct.has(t.type),
|
|
2469
|
+
children: h ? /* @__PURE__ */ J(se, {
|
|
2470
2470
|
tier: f.classification,
|
|
2471
|
-
tierDef:
|
|
2471
|
+
tierDef: oe(c, s, e),
|
|
2472
2472
|
requiredPermission: f?.required_permission,
|
|
2473
2473
|
locale: l,
|
|
2474
2474
|
variant: g === "edit" ? "input" : "value"
|
|
2475
|
-
}) :
|
|
2475
|
+
}) : v({
|
|
2476
2476
|
field: n,
|
|
2477
2477
|
fieldName: e,
|
|
2478
2478
|
value: r,
|
|
@@ -2485,9 +2485,9 @@ function Dt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty:
|
|
|
2485
2485
|
}
|
|
2486
2486
|
//#endregion
|
|
2487
2487
|
//#region src/components/shared/StatusStepper.tsx
|
|
2488
|
-
function
|
|
2488
|
+
function Mt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1 }) {
|
|
2489
2489
|
let o = t.findIndex((e) => e.code === n);
|
|
2490
|
-
return /* @__PURE__ */
|
|
2490
|
+
return /* @__PURE__ */ J("div", {
|
|
2491
2491
|
role: "list",
|
|
2492
2492
|
style: {
|
|
2493
2493
|
display: "flex",
|
|
@@ -2499,7 +2499,7 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2499
2499
|
},
|
|
2500
2500
|
children: t.map((n, s) => {
|
|
2501
2501
|
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%)";
|
|
2502
|
-
return /* @__PURE__ */
|
|
2502
|
+
return /* @__PURE__ */ Y("button", {
|
|
2503
2503
|
role: "listitem",
|
|
2504
2504
|
type: "button",
|
|
2505
2505
|
disabled: !d,
|
|
@@ -2523,7 +2523,7 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2523
2523
|
clipPath: g,
|
|
2524
2524
|
whiteSpace: "nowrap"
|
|
2525
2525
|
},
|
|
2526
|
-
children: [/* @__PURE__ */
|
|
2526
|
+
children: [/* @__PURE__ */ J("span", {
|
|
2527
2527
|
style: {
|
|
2528
2528
|
width: 16,
|
|
2529
2529
|
height: 16,
|
|
@@ -2538,8 +2538,8 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2538
2538
|
fontSize: 9.5,
|
|
2539
2539
|
fontWeight: 700
|
|
2540
2540
|
},
|
|
2541
|
-
children: c ? /* @__PURE__ */
|
|
2542
|
-
}), /* @__PURE__ */
|
|
2541
|
+
children: c ? /* @__PURE__ */ J(e.check, { size: 10 }) : s + 1
|
|
2542
|
+
}), /* @__PURE__ */ J("span", {
|
|
2543
2543
|
style: {
|
|
2544
2544
|
overflow: "hidden",
|
|
2545
2545
|
textOverflow: "ellipsis"
|
|
@@ -2552,8 +2552,8 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2552
2552
|
}
|
|
2553
2553
|
//#endregion
|
|
2554
2554
|
//#region src/components/shared/StatusGroupsDisplay.tsx
|
|
2555
|
-
function
|
|
2556
|
-
return /* @__PURE__ */
|
|
2555
|
+
function Nt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r, mode: i = "edit" }) {
|
|
2556
|
+
return /* @__PURE__ */ J("div", {
|
|
2557
2557
|
style: {
|
|
2558
2558
|
display: "flex",
|
|
2559
2559
|
flexWrap: "wrap",
|
|
@@ -2561,59 +2561,59 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2561
2561
|
gap: 16
|
|
2562
2562
|
},
|
|
2563
2563
|
children: Object.entries(e).map(([e, a]) => {
|
|
2564
|
-
let
|
|
2564
|
+
let o = t?.find((t) => t.group_code === e)?.status_code, c = o ? a.statuses.find((e) => e.code === o) : void 0;
|
|
2565
2565
|
if (a.display_mode === "stepper") {
|
|
2566
|
-
let t = i === "edit",
|
|
2567
|
-
return /* @__PURE__ */
|
|
2566
|
+
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;
|
|
2567
|
+
return /* @__PURE__ */ Y("div", {
|
|
2568
2568
|
style: {
|
|
2569
2569
|
display: "flex",
|
|
2570
2570
|
alignItems: "center",
|
|
2571
2571
|
gap: 8,
|
|
2572
2572
|
minWidth: 0
|
|
2573
2573
|
},
|
|
2574
|
-
children: [/* @__PURE__ */
|
|
2574
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
2575
2575
|
style: {
|
|
2576
2576
|
fontSize: 12,
|
|
2577
2577
|
color: "var(--text-3)",
|
|
2578
2578
|
flexShrink: 0
|
|
2579
2579
|
},
|
|
2580
|
-
children: [
|
|
2581
|
-
}), /* @__PURE__ */
|
|
2580
|
+
children: [A(a.name), ":"]
|
|
2581
|
+
}), /* @__PURE__ */ J("div", {
|
|
2582
2582
|
style: {
|
|
2583
2583
|
minWidth: 240,
|
|
2584
2584
|
opacity: r ? .6 : 1,
|
|
2585
2585
|
pointerEvents: r ? "none" : "auto"
|
|
2586
2586
|
},
|
|
2587
|
-
children: /* @__PURE__ */
|
|
2587
|
+
children: /* @__PURE__ */ J(Mt, {
|
|
2588
2588
|
stages: a.statuses.map((e) => ({
|
|
2589
2589
|
code: e.code,
|
|
2590
|
-
label:
|
|
2590
|
+
label: A(e.name)
|
|
2591
2591
|
})),
|
|
2592
|
-
current:
|
|
2593
|
-
selectable:
|
|
2592
|
+
current: o,
|
|
2593
|
+
selectable: s,
|
|
2594
2594
|
onSelect: t ? (t) => n(e, t) : void 0,
|
|
2595
2595
|
compact: !0
|
|
2596
2596
|
})
|
|
2597
2597
|
})]
|
|
2598
2598
|
}, e);
|
|
2599
2599
|
}
|
|
2600
|
-
if (i === "display") return /* @__PURE__ */
|
|
2600
|
+
if (i === "display") return /* @__PURE__ */ Y("div", {
|
|
2601
2601
|
style: {
|
|
2602
2602
|
display: "flex",
|
|
2603
2603
|
alignItems: "center",
|
|
2604
2604
|
gap: 8
|
|
2605
2605
|
},
|
|
2606
|
-
children: [/* @__PURE__ */
|
|
2606
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
2607
2607
|
style: {
|
|
2608
2608
|
fontSize: 12,
|
|
2609
2609
|
color: "var(--text-3)"
|
|
2610
2610
|
},
|
|
2611
|
-
children: [
|
|
2612
|
-
}), c ? /* @__PURE__ */
|
|
2611
|
+
children: [A(a.name), ":"]
|
|
2612
|
+
}), c ? /* @__PURE__ */ J(u, {
|
|
2613
2613
|
tone: c.color ?? "slate",
|
|
2614
2614
|
size: "xs",
|
|
2615
|
-
children:
|
|
2616
|
-
}) : /* @__PURE__ */
|
|
2615
|
+
children: A(c.name)
|
|
2616
|
+
}) : /* @__PURE__ */ J("span", {
|
|
2617
2617
|
style: {
|
|
2618
2618
|
fontSize: 12.5,
|
|
2619
2619
|
color: "var(--text-4)"
|
|
@@ -2621,44 +2621,44 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2621
2621
|
children: "—"
|
|
2622
2622
|
})]
|
|
2623
2623
|
}, e);
|
|
2624
|
-
let
|
|
2624
|
+
let l = (a.transitions && o ? a.statuses.filter((e) => e.code === o || (a.transitions[o]?.includes(e.code) ?? !1)) : a.statuses).map((e) => ({
|
|
2625
2625
|
value: e.code,
|
|
2626
|
-
label: /* @__PURE__ */
|
|
2626
|
+
label: /* @__PURE__ */ Y("span", {
|
|
2627
2627
|
style: {
|
|
2628
2628
|
display: "inline-flex",
|
|
2629
2629
|
alignItems: "center",
|
|
2630
2630
|
gap: 6
|
|
2631
2631
|
},
|
|
2632
|
-
children: [e.color && /* @__PURE__ */
|
|
2632
|
+
children: [e.color && /* @__PURE__ */ J("span", { style: {
|
|
2633
2633
|
width: 8,
|
|
2634
2634
|
height: 8,
|
|
2635
2635
|
borderRadius: 999,
|
|
2636
2636
|
background: `var(--pill-${e.color}, ${e.color})`,
|
|
2637
2637
|
display: "inline-block"
|
|
2638
|
-
} }),
|
|
2638
|
+
} }), A(e.name)]
|
|
2639
2639
|
})
|
|
2640
2640
|
}));
|
|
2641
|
-
return /* @__PURE__ */
|
|
2641
|
+
return /* @__PURE__ */ Y("div", {
|
|
2642
2642
|
style: {
|
|
2643
2643
|
display: "flex",
|
|
2644
2644
|
alignItems: "center",
|
|
2645
2645
|
gap: 8
|
|
2646
2646
|
},
|
|
2647
|
-
children: [/* @__PURE__ */
|
|
2647
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
2648
2648
|
style: {
|
|
2649
2649
|
fontSize: 12,
|
|
2650
2650
|
color: "var(--text-3)"
|
|
2651
2651
|
},
|
|
2652
|
-
children: [
|
|
2653
|
-
}), /* @__PURE__ */
|
|
2652
|
+
children: [A(a.name), ":"]
|
|
2653
|
+
}), /* @__PURE__ */ J("div", {
|
|
2654
2654
|
style: {
|
|
2655
2655
|
minWidth: 180,
|
|
2656
2656
|
opacity: r ? .6 : 1,
|
|
2657
2657
|
pointerEvents: r ? "none" : "auto"
|
|
2658
2658
|
},
|
|
2659
|
-
children: /* @__PURE__ */
|
|
2660
|
-
value:
|
|
2661
|
-
options:
|
|
2659
|
+
children: /* @__PURE__ */ J(s, {
|
|
2660
|
+
value: o ?? "",
|
|
2661
|
+
options: l,
|
|
2662
2662
|
onChange: (t) => n(e, t),
|
|
2663
2663
|
placeholder: "Select…"
|
|
2664
2664
|
})
|
|
@@ -2669,31 +2669,31 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2669
2669
|
}
|
|
2670
2670
|
//#endregion
|
|
2671
2671
|
//#region src/components/detail-layout/StatusesBlock.tsx
|
|
2672
|
-
var
|
|
2673
|
-
function
|
|
2672
|
+
var Pt = () => {};
|
|
2673
|
+
function Ft({ node: e, ctx: t }) {
|
|
2674
2674
|
let { entity: n, objectStatuses: r, onSetStatus: i, isStatusPending: a, isNew: o } = t, s = n.status_groups ?? {};
|
|
2675
2675
|
if (o) return null;
|
|
2676
2676
|
let c = e.statuses === !0 || e.statuses, l = Object.fromEntries(Object.entries(s).filter(([e]) => c === !0 || c.includes(e)));
|
|
2677
|
-
return Object.keys(l).length === 0 ? null : /* @__PURE__ */
|
|
2677
|
+
return Object.keys(l).length === 0 ? null : /* @__PURE__ */ J(Nt, {
|
|
2678
2678
|
statusGroups: l,
|
|
2679
2679
|
objectStatuses: r,
|
|
2680
|
-
onSetStatus: i ??
|
|
2680
|
+
onSetStatus: i ?? Pt,
|
|
2681
2681
|
isPending: a ?? !1,
|
|
2682
2682
|
mode: t.mode
|
|
2683
2683
|
});
|
|
2684
2684
|
}
|
|
2685
2685
|
//#endregion
|
|
2686
2686
|
//#region src/components/detail-layout/widgets/canonicalizeJson.ts
|
|
2687
|
-
function
|
|
2688
|
-
if (Array.isArray(e)) return e.map(
|
|
2687
|
+
function It(e) {
|
|
2688
|
+
if (Array.isArray(e)) return e.map(It);
|
|
2689
2689
|
if (typeof e == "object" && e) {
|
|
2690
2690
|
let t = e, n = {};
|
|
2691
|
-
for (let e of Object.keys(t).sort()) n[e] =
|
|
2691
|
+
for (let e of Object.keys(t).sort()) n[e] = It(t[e]);
|
|
2692
2692
|
return n;
|
|
2693
2693
|
}
|
|
2694
2694
|
return e;
|
|
2695
2695
|
}
|
|
2696
|
-
function
|
|
2696
|
+
function Lt(e) {
|
|
2697
2697
|
switch (typeof e) {
|
|
2698
2698
|
case "string": return e;
|
|
2699
2699
|
case "number":
|
|
@@ -2705,39 +2705,39 @@ function Nt(e) {
|
|
|
2705
2705
|
default: return "";
|
|
2706
2706
|
}
|
|
2707
2707
|
}
|
|
2708
|
-
function
|
|
2708
|
+
function Rt(e) {
|
|
2709
2709
|
if (e == null) return "";
|
|
2710
2710
|
try {
|
|
2711
|
-
return JSON.stringify(
|
|
2711
|
+
return JSON.stringify(It(e), null, 2) ?? Lt(e);
|
|
2712
2712
|
} catch {
|
|
2713
|
-
return
|
|
2713
|
+
return Lt(e);
|
|
2714
2714
|
}
|
|
2715
2715
|
}
|
|
2716
2716
|
//#endregion
|
|
2717
2717
|
//#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
|
|
2718
|
-
var
|
|
2719
|
-
function
|
|
2720
|
-
return /* @__PURE__ */
|
|
2718
|
+
var zt = "Audit change diff", Bt = pe(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonDiff }))), Vt = pe(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonSource }))), Ht = pe(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
|
|
2719
|
+
function Ut() {
|
|
2720
|
+
return /* @__PURE__ */ J("div", {
|
|
2721
2721
|
className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
|
|
2722
2722
|
children: "Loading editor…"
|
|
2723
2723
|
});
|
|
2724
2724
|
}
|
|
2725
|
-
function
|
|
2726
|
-
return /* @__PURE__ */
|
|
2727
|
-
fallback: /* @__PURE__ */
|
|
2728
|
-
children: /* @__PURE__ */
|
|
2725
|
+
function Wt({ before: e, after: t }) {
|
|
2726
|
+
return /* @__PURE__ */ J(de, {
|
|
2727
|
+
fallback: /* @__PURE__ */ J(Ut, {}),
|
|
2728
|
+
children: /* @__PURE__ */ Y("div", {
|
|
2729
2729
|
className: "flex h-full w-full gap-2",
|
|
2730
2730
|
role: "group",
|
|
2731
|
-
"aria-label":
|
|
2732
|
-
children: [/* @__PURE__ */
|
|
2731
|
+
"aria-label": zt,
|
|
2732
|
+
children: [/* @__PURE__ */ J("div", {
|
|
2733
2733
|
className: "min-w-0 flex-1",
|
|
2734
|
-
children: /* @__PURE__ */
|
|
2734
|
+
children: /* @__PURE__ */ J(Ht, {
|
|
2735
2735
|
value: e,
|
|
2736
2736
|
readOnly: !0
|
|
2737
2737
|
})
|
|
2738
|
-
}), /* @__PURE__ */
|
|
2738
|
+
}), /* @__PURE__ */ J("div", {
|
|
2739
2739
|
className: "min-w-0 flex-1",
|
|
2740
|
-
children: /* @__PURE__ */
|
|
2740
|
+
children: /* @__PURE__ */ J(Ht, {
|
|
2741
2741
|
value: t,
|
|
2742
2742
|
readOnly: !0
|
|
2743
2743
|
})
|
|
@@ -2745,18 +2745,18 @@ function Bt({ before: e, after: t }) {
|
|
|
2745
2745
|
})
|
|
2746
2746
|
});
|
|
2747
2747
|
}
|
|
2748
|
-
function
|
|
2749
|
-
return /* @__PURE__ */
|
|
2748
|
+
function Gt({ mode: e, onChange: t }) {
|
|
2749
|
+
return /* @__PURE__ */ Y("div", {
|
|
2750
2750
|
className: "inline-flex gap-1",
|
|
2751
2751
|
role: "group",
|
|
2752
2752
|
"aria-label": "Diff view mode",
|
|
2753
|
-
children: [/* @__PURE__ */
|
|
2753
|
+
children: [/* @__PURE__ */ J("button", {
|
|
2754
2754
|
type: "button",
|
|
2755
2755
|
"aria-pressed": e === "diff",
|
|
2756
2756
|
onClick: () => t("diff"),
|
|
2757
2757
|
className: `rounded px-2 py-0.5 text-xs ${e === "diff" ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
|
|
2758
2758
|
children: "Diff"
|
|
2759
|
-
}), /* @__PURE__ */
|
|
2759
|
+
}), /* @__PURE__ */ J("button", {
|
|
2760
2760
|
type: "button",
|
|
2761
2761
|
"aria-pressed": e === "source",
|
|
2762
2762
|
onClick: () => t("source"),
|
|
@@ -2765,42 +2765,42 @@ function Vt({ mode: e, onChange: t }) {
|
|
|
2765
2765
|
})]
|
|
2766
2766
|
});
|
|
2767
2767
|
}
|
|
2768
|
-
function
|
|
2769
|
-
let n = e.before, r = e.after, [i, a] =
|
|
2770
|
-
return /* @__PURE__ */
|
|
2768
|
+
function Kt({ values: e, options: t }) {
|
|
2769
|
+
let n = e.before, r = e.after, [i, a] = K(t?.default_mode === "source" ? "source" : "diff"), o = Rt(n), s = Rt(r);
|
|
2770
|
+
return /* @__PURE__ */ Y("div", {
|
|
2771
2771
|
className: "flex flex-col gap-2",
|
|
2772
|
-
children: [/* @__PURE__ */
|
|
2772
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2773
2773
|
className: "flex items-center justify-between",
|
|
2774
|
-
children: [/* @__PURE__ */
|
|
2774
|
+
children: [/* @__PURE__ */ J(Gt, {
|
|
2775
2775
|
mode: i,
|
|
2776
2776
|
onChange: a
|
|
2777
|
-
}), o === s && /* @__PURE__ */
|
|
2777
|
+
}), o === s && /* @__PURE__ */ J("span", {
|
|
2778
2778
|
className: "text-xs text-muted-foreground",
|
|
2779
2779
|
role: "status",
|
|
2780
2780
|
children: "No field changes"
|
|
2781
2781
|
})]
|
|
2782
|
-
}), /* @__PURE__ */
|
|
2782
|
+
}), /* @__PURE__ */ J("div", {
|
|
2783
2783
|
className: "h-[480px] w-full overflow-hidden rounded border",
|
|
2784
2784
|
role: "group",
|
|
2785
|
-
"aria-label":
|
|
2786
|
-
children: /* @__PURE__ */
|
|
2787
|
-
fallback: /* @__PURE__ */
|
|
2785
|
+
"aria-label": zt,
|
|
2786
|
+
children: /* @__PURE__ */ J(V, {
|
|
2787
|
+
fallback: /* @__PURE__ */ J(Wt, {
|
|
2788
2788
|
before: n,
|
|
2789
2789
|
after: r
|
|
2790
2790
|
}),
|
|
2791
|
-
children: /* @__PURE__ */
|
|
2792
|
-
fallback: /* @__PURE__ */
|
|
2793
|
-
children: i === "diff" ? /* @__PURE__ */
|
|
2791
|
+
children: /* @__PURE__ */ J(de, {
|
|
2792
|
+
fallback: /* @__PURE__ */ J(Ut, {}),
|
|
2793
|
+
children: i === "diff" ? /* @__PURE__ */ J(Bt, {
|
|
2794
2794
|
before: o,
|
|
2795
2795
|
after: s
|
|
2796
|
-
}) : /* @__PURE__ */
|
|
2796
|
+
}) : /* @__PURE__ */ Y("div", {
|
|
2797
2797
|
className: "flex h-full w-full gap-2",
|
|
2798
|
-
children: [/* @__PURE__ */
|
|
2798
|
+
children: [/* @__PURE__ */ J("div", {
|
|
2799
2799
|
className: "min-w-0 flex-1",
|
|
2800
|
-
children: /* @__PURE__ */
|
|
2801
|
-
}), /* @__PURE__ */
|
|
2800
|
+
children: /* @__PURE__ */ J(Vt, { value: o })
|
|
2801
|
+
}), /* @__PURE__ */ J("div", {
|
|
2802
2802
|
className: "min-w-0 flex-1",
|
|
2803
|
-
children: /* @__PURE__ */
|
|
2803
|
+
children: /* @__PURE__ */ J(Vt, { value: s })
|
|
2804
2804
|
})]
|
|
2805
2805
|
})
|
|
2806
2806
|
})
|
|
@@ -2809,30 +2809,309 @@ function Ht({ values: e, options: t }) {
|
|
|
2809
2809
|
});
|
|
2810
2810
|
}
|
|
2811
2811
|
//#endregion
|
|
2812
|
+
//#region src/components/detail-layout/widgets/EntityScorecardWidget.tsx
|
|
2813
|
+
function Z(e) {
|
|
2814
|
+
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
2815
|
+
}
|
|
2816
|
+
function Q(e) {
|
|
2817
|
+
let t = Z(e);
|
|
2818
|
+
if (!t) return;
|
|
2819
|
+
let n = Object.entries(t).filter((e) => typeof e[1] == "string");
|
|
2820
|
+
return n.length > 0 ? Object.fromEntries(n) : void 0;
|
|
2821
|
+
}
|
|
2822
|
+
function qt(e) {
|
|
2823
|
+
return Array.isArray(e) ? e.flatMap((e) => {
|
|
2824
|
+
let t = Z(e);
|
|
2825
|
+
return !t || typeof t.field != "string" ? [] : [{
|
|
2826
|
+
field: t.field,
|
|
2827
|
+
label: Q(t.label),
|
|
2828
|
+
format: t.format
|
|
2829
|
+
}];
|
|
2830
|
+
}) : [];
|
|
2831
|
+
}
|
|
2832
|
+
function Jt(e) {
|
|
2833
|
+
if (!e || typeof e.entity != "string" || typeof e.scope_field != "string" || typeof e.window_field != "string") return;
|
|
2834
|
+
let t = Array.isArray(e.windows) ? e.windows.flatMap((e) => {
|
|
2835
|
+
let t = Z(e);
|
|
2836
|
+
return t && typeof t.code == "string" ? [{
|
|
2837
|
+
code: t.code,
|
|
2838
|
+
label: Q(t.label)
|
|
2839
|
+
}] : [];
|
|
2840
|
+
}) : [], n = Array.isArray(e.metrics) ? e.metrics.flatMap((e) => {
|
|
2841
|
+
let t = Z(e);
|
|
2842
|
+
if (!t || typeof t.field != "string") return [];
|
|
2843
|
+
let n = Z(t.filtered);
|
|
2844
|
+
return [{
|
|
2845
|
+
field: t.field,
|
|
2846
|
+
label: Q(t.label),
|
|
2847
|
+
help: Q(t.help),
|
|
2848
|
+
format: t.format,
|
|
2849
|
+
attention: t.attention === !0,
|
|
2850
|
+
drillthrough_value: typeof t.drillthrough_value == "string" ? t.drillthrough_value : void 0,
|
|
2851
|
+
drillthrough_filter: t.drillthrough_filter !== !1,
|
|
2852
|
+
filtered: n && typeof n.field == "string" ? {
|
|
2853
|
+
field: n.field,
|
|
2854
|
+
where: Z(n.where)
|
|
2855
|
+
} : void 0
|
|
2856
|
+
}];
|
|
2857
|
+
}) : [];
|
|
2858
|
+
if (t.length === 0 || n.length === 0) return;
|
|
2859
|
+
let r = Z(e.breakdown), i = r && typeof r.entity == "string" && typeof r.scope_field == "string" && typeof r.window_field == "string" ? {
|
|
2860
|
+
entity: r.entity,
|
|
2861
|
+
scope_field: r.scope_field,
|
|
2862
|
+
window_field: r.window_field,
|
|
2863
|
+
filter_field: typeof r.filter_field == "string" ? r.filter_field : void 0,
|
|
2864
|
+
filter_label: Q(r.filter_label),
|
|
2865
|
+
all_label: Q(r.all_label),
|
|
2866
|
+
empty_label: Q(r.empty_label),
|
|
2867
|
+
columns: qt(r.columns),
|
|
2868
|
+
sort: typeof r.sort == "string" ? r.sort : void 0,
|
|
2869
|
+
limit: typeof r.limit == "number" ? Math.min(500, Math.max(1, r.limit)) : 200
|
|
2870
|
+
} : void 0, a = Z(e.drillthrough), o = a && typeof a.route == "string" && typeof a.scope_field == "string" && typeof a.window_field == "string" ? {
|
|
2871
|
+
route: a.route,
|
|
2872
|
+
scope_field: a.scope_field,
|
|
2873
|
+
window_field: a.window_field,
|
|
2874
|
+
filter_field: typeof a.filter_field == "string" ? a.filter_field : void 0,
|
|
2875
|
+
metric_field: typeof a.metric_field == "string" ? a.metric_field : void 0
|
|
2876
|
+
} : void 0;
|
|
2877
|
+
return {
|
|
2878
|
+
entity: e.entity,
|
|
2879
|
+
scope_field: e.scope_field,
|
|
2880
|
+
window_field: e.window_field,
|
|
2881
|
+
windows: t,
|
|
2882
|
+
default_window: typeof e.default_window == "string" ? e.default_window : void 0,
|
|
2883
|
+
metrics: n,
|
|
2884
|
+
title: Q(e.title),
|
|
2885
|
+
description: Q(e.description),
|
|
2886
|
+
intended_note: Q(e.intended_note),
|
|
2887
|
+
empty_label: Q(e.empty_label),
|
|
2888
|
+
breakdown: i,
|
|
2889
|
+
drillthrough: o
|
|
2890
|
+
};
|
|
2891
|
+
}
|
|
2892
|
+
function Yt(e, t, n) {
|
|
2893
|
+
if (e == null || e === "") return "N/A";
|
|
2894
|
+
if (t === "number") return new Intl.NumberFormat(n).format(Number(e));
|
|
2895
|
+
if (t === "percent_ratio") return new Intl.NumberFormat(n, {
|
|
2896
|
+
style: "percent",
|
|
2897
|
+
maximumFractionDigits: 2
|
|
2898
|
+
}).format(Number(e));
|
|
2899
|
+
if (t === "duration_seconds") {
|
|
2900
|
+
let t = Number(e);
|
|
2901
|
+
return Number.isFinite(t) ? t >= 86400 ? `${Math.floor(t / 86400)}d` : t >= 3600 ? `${Math.floor(t / 3600)}h` : t >= 60 ? `${Math.floor(t / 60)}m` : `${Math.max(0, Math.floor(t))}s` : "N/A";
|
|
2902
|
+
}
|
|
2903
|
+
if (t === "timestamp") {
|
|
2904
|
+
if (typeof e != "string" && typeof e != "number" && !(e instanceof Date)) return "N/A";
|
|
2905
|
+
let t = new Date(e);
|
|
2906
|
+
return Number.isNaN(t.getTime()) ? "N/A" : t.toLocaleString(n, { timeZoneName: "short" });
|
|
2907
|
+
}
|
|
2908
|
+
return typeof e == "string" ? e : typeof e == "number" || typeof e == "bigint" || typeof e == "boolean" ? String(e) : "N/A";
|
|
2909
|
+
}
|
|
2910
|
+
function Xt(e, t) {
|
|
2911
|
+
return typeof e.id == "string" || typeof e.id == "number" ? String(e.id) : `row-${t}`;
|
|
2912
|
+
}
|
|
2913
|
+
function Zt(e, t) {
|
|
2914
|
+
return !t || Object.entries(t).every(([t, n]) => e[t] === n);
|
|
2915
|
+
}
|
|
2916
|
+
function Qt({ values: e, options: t }) {
|
|
2917
|
+
let r = W(() => Jt(t), [t]), i = b(), a = R(), o = e.scope, s = r?.windows.some((e) => e.code === r.default_window) ? r.default_window : r?.windows[0]?.code ?? "", [c, l] = K(s), [u, d] = K("");
|
|
2918
|
+
U(() => {
|
|
2919
|
+
l(s);
|
|
2920
|
+
}, [s]), U(() => {
|
|
2921
|
+
d("");
|
|
2922
|
+
}, [c]);
|
|
2923
|
+
let f = r ? [{
|
|
2924
|
+
field: r.scope_field,
|
|
2925
|
+
op: "eq",
|
|
2926
|
+
value: o
|
|
2927
|
+
}, {
|
|
2928
|
+
field: r.window_field,
|
|
2929
|
+
op: "eq",
|
|
2930
|
+
value: c
|
|
2931
|
+
}] : [], p = n(r?.entity, {
|
|
2932
|
+
per_page: 1,
|
|
2933
|
+
filters: f
|
|
2934
|
+
}, !!(r && o && c)), m = r?.breakdown, h = m ? [{
|
|
2935
|
+
field: m.scope_field,
|
|
2936
|
+
op: "eq",
|
|
2937
|
+
value: o
|
|
2938
|
+
}, {
|
|
2939
|
+
field: m.window_field,
|
|
2940
|
+
op: "eq",
|
|
2941
|
+
value: c
|
|
2942
|
+
}] : [], g = n(m?.entity, {
|
|
2943
|
+
per_page: m?.limit ?? 200,
|
|
2944
|
+
sort: m?.sort,
|
|
2945
|
+
filters: h
|
|
2946
|
+
}, !!(m && o && c));
|
|
2947
|
+
if (!r || !o) return /* @__PURE__ */ J("div", {
|
|
2948
|
+
role: "alert",
|
|
2949
|
+
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
2950
|
+
children: "Invalid entity_scorecard configuration."
|
|
2951
|
+
});
|
|
2952
|
+
let _ = p.data?.data?.[0], v = g.data?.data ?? [], y = m?.filter_field ? Array.from(new Set(v.map((e) => e[m.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], x = u && m?.filter_field ? v.filter((e) => e[m.filter_field] === u) : v, S = (e) => !u || !e.filtered || !m?.filter_field ? _?.[e.field] : v.find((t) => t[m.filter_field] === u && Zt(t, e.filtered?.where))?.[e.filtered.field], C = (e) => {
|
|
2953
|
+
let t = r.drillthrough;
|
|
2954
|
+
if (!t || !e.drillthrough_value) return;
|
|
2955
|
+
let n = [{
|
|
2956
|
+
field: t.scope_field,
|
|
2957
|
+
op: "eq",
|
|
2958
|
+
value: o
|
|
2959
|
+
}, {
|
|
2960
|
+
field: t.window_field,
|
|
2961
|
+
op: "eq",
|
|
2962
|
+
value: c
|
|
2963
|
+
}];
|
|
2964
|
+
t.filter_field && u && e.drillthrough_filter !== !1 && n.push({
|
|
2965
|
+
field: t.filter_field,
|
|
2966
|
+
op: "eq",
|
|
2967
|
+
value: u
|
|
2968
|
+
}), t.metric_field && n.push({
|
|
2969
|
+
field: t.metric_field,
|
|
2970
|
+
op: "eq",
|
|
2971
|
+
value: e.drillthrough_value
|
|
2972
|
+
}), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(n) }).toString() });
|
|
2973
|
+
}, w = p.error ?? g.error;
|
|
2974
|
+
return /* @__PURE__ */ Y("div", {
|
|
2975
|
+
className: "flex min-w-0 flex-col gap-4",
|
|
2976
|
+
"aria-label": A(r.title, i) || "Scorecard",
|
|
2977
|
+
children: [
|
|
2978
|
+
/* @__PURE__ */ Y("div", {
|
|
2979
|
+
className: "flex flex-wrap items-start justify-between gap-3",
|
|
2980
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2981
|
+
className: "min-w-0",
|
|
2982
|
+
children: [
|
|
2983
|
+
r.title && /* @__PURE__ */ J("h3", {
|
|
2984
|
+
className: "text-base font-semibold text-foreground",
|
|
2985
|
+
children: A(r.title, i)
|
|
2986
|
+
}),
|
|
2987
|
+
r.description && /* @__PURE__ */ J("p", {
|
|
2988
|
+
className: "mt-1 text-sm text-muted-foreground",
|
|
2989
|
+
children: A(r.description, i)
|
|
2990
|
+
}),
|
|
2991
|
+
r.intended_note && /* @__PURE__ */ J("p", {
|
|
2992
|
+
className: "mt-1 text-xs text-muted-foreground",
|
|
2993
|
+
children: A(r.intended_note, i)
|
|
2994
|
+
})
|
|
2995
|
+
]
|
|
2996
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2997
|
+
className: "flex flex-wrap items-center gap-2",
|
|
2998
|
+
children: [/* @__PURE__ */ J("div", {
|
|
2999
|
+
role: "group",
|
|
3000
|
+
"aria-label": "Scorecard window",
|
|
3001
|
+
className: "inline-flex rounded border border-border p-1",
|
|
3002
|
+
children: r.windows.map((e) => /* @__PURE__ */ J("button", {
|
|
3003
|
+
type: "button",
|
|
3004
|
+
"aria-pressed": c === e.code,
|
|
3005
|
+
onClick: () => l(e.code),
|
|
3006
|
+
className: `rounded px-3 py-1.5 text-xs font-medium ${c === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
|
|
3007
|
+
children: A(e.label, i) || e.code
|
|
3008
|
+
}, e.code))
|
|
3009
|
+
}), m?.filter_field && /* @__PURE__ */ Y("label", {
|
|
3010
|
+
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
3011
|
+
children: [A(m.filter_label, i) || "Filter", /* @__PURE__ */ Y("select", {
|
|
3012
|
+
"aria-label": A(m.filter_label, i) || "Filter",
|
|
3013
|
+
value: u,
|
|
3014
|
+
onChange: (e) => d(e.target.value),
|
|
3015
|
+
className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
|
|
3016
|
+
children: [/* @__PURE__ */ J("option", {
|
|
3017
|
+
value: "",
|
|
3018
|
+
children: A(m.all_label, i) || "All"
|
|
3019
|
+
}), y.map((e) => /* @__PURE__ */ J("option", {
|
|
3020
|
+
value: e,
|
|
3021
|
+
children: e
|
|
3022
|
+
}, e))]
|
|
3023
|
+
})]
|
|
3024
|
+
})]
|
|
3025
|
+
})]
|
|
3026
|
+
}),
|
|
3027
|
+
w && /* @__PURE__ */ J("div", {
|
|
3028
|
+
role: "alert",
|
|
3029
|
+
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
3030
|
+
children: w instanceof Error ? w.message : "Scorecard data could not be loaded."
|
|
3031
|
+
}),
|
|
3032
|
+
!w && !p.isLoading && !_ && /* @__PURE__ */ J("div", {
|
|
3033
|
+
className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
|
|
3034
|
+
children: A(r.empty_label, i) || "No scorecard data."
|
|
3035
|
+
}),
|
|
3036
|
+
_ && /* @__PURE__ */ J("div", {
|
|
3037
|
+
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
3038
|
+
children: r.metrics.map((e) => {
|
|
3039
|
+
let t = S(e), n = !!(r.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ Y(q, { children: [
|
|
3040
|
+
/* @__PURE__ */ J("span", {
|
|
3041
|
+
className: "text-xs font-medium text-muted-foreground",
|
|
3042
|
+
children: A(e.label, i) || e.field
|
|
3043
|
+
}),
|
|
3044
|
+
/* @__PURE__ */ J("strong", {
|
|
3045
|
+
className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
|
|
3046
|
+
children: Yt(t, e.format, i)
|
|
3047
|
+
}),
|
|
3048
|
+
e.help && /* @__PURE__ */ J("span", {
|
|
3049
|
+
className: "mt-1 block text-xs text-muted-foreground",
|
|
3050
|
+
children: A(e.help, i)
|
|
3051
|
+
})
|
|
3052
|
+
] });
|
|
3053
|
+
return n ? /* @__PURE__ */ J("button", {
|
|
3054
|
+
type: "button",
|
|
3055
|
+
onClick: () => C(e),
|
|
3056
|
+
className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
|
|
3057
|
+
children: a
|
|
3058
|
+
}, e.field) : /* @__PURE__ */ J("article", {
|
|
3059
|
+
className: "rounded border border-border bg-card p-3",
|
|
3060
|
+
children: a
|
|
3061
|
+
}, e.field);
|
|
3062
|
+
})
|
|
3063
|
+
}),
|
|
3064
|
+
m && /* @__PURE__ */ J("div", {
|
|
3065
|
+
className: "min-w-0 overflow-x-auto rounded border border-border",
|
|
3066
|
+
children: /* @__PURE__ */ Y("table", {
|
|
3067
|
+
className: "w-full border-collapse text-sm",
|
|
3068
|
+
children: [/* @__PURE__ */ J("thead", {
|
|
3069
|
+
className: "bg-surface text-left text-xs text-muted-foreground",
|
|
3070
|
+
children: /* @__PURE__ */ J("tr", { children: m.columns.map((e) => /* @__PURE__ */ J("th", {
|
|
3071
|
+
className: "border-b border-divider px-3 py-2 font-medium",
|
|
3072
|
+
children: A(e.label, i) || e.field
|
|
3073
|
+
}, e.field)) })
|
|
3074
|
+
}), /* @__PURE__ */ Y("tbody", { children: [x.map((e, t) => /* @__PURE__ */ J("tr", {
|
|
3075
|
+
className: "border-b border-divider last:border-0",
|
|
3076
|
+
children: m.columns.map((t) => /* @__PURE__ */ J("td", {
|
|
3077
|
+
className: "px-3 py-2 text-foreground",
|
|
3078
|
+
children: Yt(e[t.field], t.format, i)
|
|
3079
|
+
}, t.field))
|
|
3080
|
+
}, Xt(e, t))), !g.isLoading && x.length === 0 && /* @__PURE__ */ J("tr", { children: /* @__PURE__ */ J("td", {
|
|
3081
|
+
colSpan: Math.max(1, m.columns.length),
|
|
3082
|
+
className: "px-3 py-6 text-center text-muted-foreground",
|
|
3083
|
+
children: A(m.empty_label, i) || "No breakdown rows."
|
|
3084
|
+
}) })] })]
|
|
3085
|
+
})
|
|
3086
|
+
})
|
|
3087
|
+
]
|
|
3088
|
+
});
|
|
3089
|
+
}
|
|
3090
|
+
//#endregion
|
|
2812
3091
|
//#region src/components/detail-layout/widgets/builtins.ts
|
|
2813
|
-
var
|
|
2814
|
-
function
|
|
2815
|
-
|
|
3092
|
+
var $t = !1;
|
|
3093
|
+
function en() {
|
|
3094
|
+
$t ||= (re("json_diff", Kt), re("entity_scorecard", Qt), !0);
|
|
2816
3095
|
}
|
|
2817
3096
|
//#endregion
|
|
2818
3097
|
//#region src/components/detail-layout/widgets/WidgetHost.tsx
|
|
2819
|
-
|
|
2820
|
-
function
|
|
2821
|
-
let n =
|
|
2822
|
-
if (!n) return /* @__PURE__ */
|
|
3098
|
+
en();
|
|
3099
|
+
function tn({ config: e, ctx: t }) {
|
|
3100
|
+
let n = ie(e.type);
|
|
3101
|
+
if (!n) return /* @__PURE__ */ J("span", {
|
|
2823
3102
|
className: "text-sm text-muted-foreground",
|
|
2824
3103
|
children: `unknown widget: ${e.type}`
|
|
2825
3104
|
});
|
|
2826
3105
|
let r = e.inputs ?? {}, i = t.record, a = {};
|
|
2827
3106
|
for (let [e, t] of Object.entries(r)) a[e] = i[t];
|
|
2828
|
-
return /* @__PURE__ */
|
|
3107
|
+
return /* @__PURE__ */ J("div", {
|
|
2829
3108
|
style: {
|
|
2830
3109
|
minWidth: 0,
|
|
2831
3110
|
maxWidth: "100%",
|
|
2832
3111
|
overflowX: "auto",
|
|
2833
3112
|
WebkitOverflowScrolling: "touch"
|
|
2834
3113
|
},
|
|
2835
|
-
children: /* @__PURE__ */
|
|
3114
|
+
children: /* @__PURE__ */ J(n, {
|
|
2836
3115
|
inputs: r,
|
|
2837
3116
|
values: a,
|
|
2838
3117
|
record: i,
|
|
@@ -2843,45 +3122,45 @@ function Gt({ config: e, ctx: t }) {
|
|
|
2843
3122
|
}
|
|
2844
3123
|
//#endregion
|
|
2845
3124
|
//#region src/components/detail-layout/LayoutRenderer.tsx
|
|
2846
|
-
function
|
|
2847
|
-
return /* @__PURE__ */
|
|
3125
|
+
function nn({ nodes: e, ctx: t }) {
|
|
3126
|
+
return /* @__PURE__ */ J(q, { children: e.map((e, n) => /* @__PURE__ */ J($, {
|
|
2848
3127
|
node: e,
|
|
2849
3128
|
ctx: t
|
|
2850
3129
|
}, n)) });
|
|
2851
3130
|
}
|
|
2852
3131
|
function $({ node: e, ctx: t }) {
|
|
2853
|
-
return e.row ? /* @__PURE__ */
|
|
3132
|
+
return e.row ? /* @__PURE__ */ J(Se, {
|
|
2854
3133
|
config: e.row,
|
|
2855
3134
|
ctx: t
|
|
2856
|
-
}) : e.column ? /* @__PURE__ */
|
|
3135
|
+
}) : e.column ? /* @__PURE__ */ J(Te, {
|
|
2857
3136
|
config: e.column,
|
|
2858
3137
|
node: e,
|
|
2859
3138
|
ctx: t
|
|
2860
|
-
}) : e.tabs ? /* @__PURE__ */
|
|
3139
|
+
}) : e.tabs ? /* @__PURE__ */ J(ke, {
|
|
2861
3140
|
config: e.tabs,
|
|
2862
3141
|
ctx: t
|
|
2863
|
-
}) : e.section ? /* @__PURE__ */
|
|
3142
|
+
}) : e.section ? /* @__PURE__ */ J(Ae, {
|
|
2864
3143
|
config: e.section,
|
|
2865
3144
|
ctx: t
|
|
2866
|
-
}) : e.children ? /* @__PURE__ */
|
|
3145
|
+
}) : e.children ? /* @__PURE__ */ J(vt, {
|
|
2867
3146
|
node: e,
|
|
2868
3147
|
ctx: t
|
|
2869
|
-
}) : e.associated ? /* @__PURE__ */
|
|
3148
|
+
}) : e.associated ? /* @__PURE__ */ J(M, {
|
|
2870
3149
|
node: e,
|
|
2871
3150
|
ctx: t
|
|
2872
|
-
}) : e.fields ? /* @__PURE__ */
|
|
3151
|
+
}) : e.fields ? /* @__PURE__ */ J(Dt, {
|
|
2873
3152
|
fields: e.fields,
|
|
2874
3153
|
ctx: t
|
|
2875
|
-
}) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */
|
|
3154
|
+
}) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ J(tn, {
|
|
2876
3155
|
config: e.widget,
|
|
2877
3156
|
ctx: t
|
|
2878
|
-
}) : null : /* @__PURE__ */
|
|
3157
|
+
}) : null : /* @__PURE__ */ J(Ft, {
|
|
2879
3158
|
node: e,
|
|
2880
3159
|
ctx: t
|
|
2881
|
-
}) : /* @__PURE__ */
|
|
3160
|
+
}) : /* @__PURE__ */ J(At, {
|
|
2882
3161
|
node: e,
|
|
2883
3162
|
ctx: t
|
|
2884
3163
|
});
|
|
2885
3164
|
}
|
|
2886
3165
|
//#endregion
|
|
2887
|
-
export {
|
|
3166
|
+
export { Nt as n, nn as t };
|