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