@declarion/react 0.31.2 → 0.34.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/{ActionRunner-BzaZQtiI.js → ActionRunner-UGGvGypS.js} +925 -788
- package/dist-lib/{DraggableChildrenTable-DILqStHQ.js → DraggableChildrenTable-CljdYXd_.js} +30 -30
- package/dist-lib/DynamicIcon-BWO6QtNF.js +261 -0
- package/dist-lib/{Grid-BIsiUwPh.js → Grid-5Y_iPqNW.js} +2 -2
- package/dist-lib/{LayoutRenderer-3RvIsC9M.js → LayoutRenderer-CoTMmvNW.js} +670 -670
- package/dist-lib/{MarkdownRenderer-CaHhWrfm.js → MarkdownRenderer-unbncYEV.js} +1 -1
- package/dist-lib/RefreshControl-oeKhCjEC.js +837 -0
- package/dist-lib/SmartDetailPage.impl-Caxd97q6.js +1771 -0
- package/dist-lib/{SmartRecordListPage.impl-B1iws8yf.js → SmartRecordListPage.impl-BF_ieDc2.js} +253 -253
- package/dist-lib/api/data.d.ts +4 -4
- package/dist-lib/api/params.d.ts +1 -1
- package/dist-lib/components/layout/Rail.d.ts +5 -5
- package/dist-lib/components/layout/TopBar.d.ts +3 -1
- package/dist-lib/components/pages/DocumentsMenu.d.ts +22 -0
- package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +42 -0
- package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
- package/dist-lib/components/pages/list/ListHeader.d.ts +1 -11
- package/dist-lib/components/primitives/BrandLogo.d.ts +1 -1
- package/dist-lib/components/primitives/Icons.d.ts +1 -0
- package/dist-lib/components/primitives/Tooltip.d.ts +30 -0
- package/dist-lib/components/primitives/index.d.ts +2 -0
- package/dist-lib/components/shared/ActionResultDialog.d.ts +4 -0
- package/dist-lib/components/shared/ActionRunner.d.ts +1 -0
- package/dist-lib/components/shared/ObjectActionBar.d.ts +29 -0
- package/dist-lib/components/shared/PageHeader.d.ts +1 -1
- package/dist-lib/components/shared/RecordHeader.d.ts +3 -1
- package/dist-lib/components/shared/RefreshControl.d.ts +6 -0
- package/dist-lib/components/shared/ResponsiveActionBar.d.ts +9 -1
- package/dist-lib/hooks/useBranding.d.ts +8 -0
- package/dist-lib/hooks/useBrandingChrome.d.ts +6 -0
- package/dist-lib/hooks/useLiveObject.d.ts +9 -0
- package/dist-lib/hooks/useMutations.d.ts +3 -3
- package/dist-lib/hooks/useObject.d.ts +10 -0
- package/dist-lib/hooks/usePageStateRuntime.d.ts +1 -1
- package/dist-lib/hooks/useParams.d.ts +10 -1
- package/dist-lib/icons.js +1 -1
- package/dist-lib/index.d.ts +11 -5
- package/dist-lib/index.js +2457 -2335
- package/dist-lib/lib/actions.d.ts +6 -2
- package/dist-lib/lib/branding.d.ts +10 -1
- package/dist-lib/lib/document-templates.d.ts +12 -0
- package/dist-lib/lib/download.d.ts +20 -0
- package/dist-lib/lib/record-documents-key.d.ts +1 -0
- package/dist-lib/{registry-2KliNTHB.js → registry-DnPK3Msj.js} +1658 -1607
- package/dist-lib/testing.d.ts +5 -3
- package/dist-lib/testing.js +37 -33
- package/dist-lib/types/api.d.ts +62 -3
- package/dist-lib/types/schema.d.ts +18 -16
- package/dist-lib/{useProperties-Co3RdtuT.js → useProperties-CgRhBh0k.js} +70 -70
- package/dist-lib/{value-BooGwUik.js → value-GmL5BVFm.js} +29 -29
- package/package.json +1 -1
- package/dist-lib/DynamicIcon-DCRdxxZ7.js +0 -260
- package/dist-lib/SmartDetailPage.impl--EO-9fos.js +0 -1494
- package/dist-lib/hooks/useEntityItem.d.ts +0 -10
- package/dist-lib/peekDraftStore-yyzMbaiI.js +0 -468
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { s as e, t } from "./DynamicIcon-
|
|
2
|
-
import { $ as n,
|
|
3
|
-
import { E as j,
|
|
1
|
+
import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
|
|
2
|
+
import { $t as n, Dn as r, F as i, Gn as a, I as o, Mn as s, Rn as c, Un as l, V as u, Wn as d, an as f, at as p, cn as m, dn as h, f as g, h as _, hn as v, ht as y, in as b, it as x, jt as S, ln as C, m as w, mn as T, on as E, p as D, rt as O, un as k, yn as A } from "./ActionRunner-UGGvGypS.js";
|
|
3
|
+
import { E as j, J as M, K as ee, T as N, Y as P, bt as F, d as I, et as L, k as R, o as z, pt as B, q as V, r as te, t as ne, tt as re, u as ie, yt as ae } from "./registry-DnPK3Msj.js";
|
|
4
4
|
import { n as oe, r as se, t as ce } from "./dataTableStyles-vwD1mVOP.js";
|
|
5
|
-
import { Suspense as le, createContext as ue, lazy as
|
|
6
|
-
import { useInfiniteQuery as
|
|
7
|
-
import { Fragment as
|
|
5
|
+
import { Suspense as le, createContext as ue, lazy as H, useCallback as U, useContext as de, useEffect as W, useId as fe, useLayoutEffect as pe, useMemo as G, useRef as K, useState as q } from "react";
|
|
6
|
+
import { useInfiniteQuery as me, useMutation as he, useQueryClient as ge } from "@tanstack/react-query";
|
|
7
|
+
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
8
8
|
//#region src/lib/size-value.ts
|
|
9
|
-
var
|
|
10
|
-
function
|
|
9
|
+
var _e = /^(\d+)px$/;
|
|
10
|
+
function ve(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 = _e.exec(e);
|
|
15
15
|
if (t) {
|
|
16
16
|
let e = parseInt(t[1], 10);
|
|
17
17
|
return e > 0 ? {
|
|
@@ -27,9 +27,9 @@ function ye(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 ye({ 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] = q(!1), l = K(null);
|
|
32
|
+
W(() => {
|
|
33
33
|
if (o === 0) return;
|
|
34
34
|
let e = l.current;
|
|
35
35
|
if (!e) return;
|
|
@@ -38,10 +38,10 @@ function be({ 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] = q(null), f = K(null), p = U(() => n.map((t) => {
|
|
42
|
+
let n = ve(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 = U((e, t) => {
|
|
45
45
|
t.preventDefault();
|
|
46
46
|
let n = u ?? p();
|
|
47
47
|
f.current = {
|
|
@@ -58,41 +58,41 @@ function be({ 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 ? xe(e.height) : void 0;
|
|
62
|
+
return /* @__PURE__ */ Y("div", {
|
|
63
63
|
ref: l,
|
|
64
|
-
className:
|
|
64
|
+
className: B("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__ */ X("div", {
|
|
70
|
+
className: B("min-w-0 flex items-stretch", s && "w-full"),
|
|
71
|
+
style: s ? void 0 : be(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
|
|
72
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
73
|
+
className: B("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
|
|
74
|
+
children: /* @__PURE__ */ Y($, {
|
|
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__ */ Y("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 be(e, t, n, r) {
|
|
86
|
+
let i = ve(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 xe(e) {
|
|
94
94
|
if (!e) return;
|
|
95
|
-
let t =
|
|
95
|
+
let t = ve(e);
|
|
96
96
|
if (t?.kind === "px") return {
|
|
97
97
|
height: `${t.value}px`,
|
|
98
98
|
overflow: "hidden"
|
|
@@ -104,12 +104,12 @@ function Se(e) {
|
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/components/detail-layout/LayoutColumn.tsx
|
|
107
|
-
function
|
|
107
|
+
function Se({ config: e, ctx: t }) {
|
|
108
108
|
let { items: n, gap: r = 12 } = e;
|
|
109
|
-
return /* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ Y("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__ */ Y($, {
|
|
113
113
|
node: e,
|
|
114
114
|
ctx: t
|
|
115
115
|
}, n))
|
|
@@ -117,23 +117,23 @@ function Ce({ config: e, ctx: t }) {
|
|
|
117
117
|
}
|
|
118
118
|
//#endregion
|
|
119
119
|
//#region src/components/detail-layout/blockMeta.ts
|
|
120
|
-
function
|
|
120
|
+
function Ce(e) {
|
|
121
121
|
return e.children ?? e.associated;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
let n =
|
|
123
|
+
function Z(e, t) {
|
|
124
|
+
let n = Ce(e);
|
|
125
125
|
if (n) {
|
|
126
|
-
if (e.label) return
|
|
126
|
+
if (e.label) return C(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 C(r.display.name);
|
|
129
129
|
let i = t.schema.entities[n];
|
|
130
|
-
return i && (
|
|
130
|
+
return i && (C(i.display.name_plural) || C(i.display.name)) || n;
|
|
131
131
|
}
|
|
132
|
-
return e.section ?
|
|
132
|
+
return e.section ? C(e.section.name) : "Tab";
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function we(e, t) {
|
|
135
135
|
if (e.icon) return e.icon;
|
|
136
|
-
let n =
|
|
136
|
+
let n = Ce(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 Z(e, t) {
|
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/components/detail-layout/LayoutTabs.tsx
|
|
146
146
|
function Te({ config: e, ctx: n }) {
|
|
147
|
-
let { items: r } = e, [i, a] =
|
|
147
|
+
let { items: r } = e, [i, a] = q(0), o = c(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
|
|
148
148
|
if (r.length === 0) return null;
|
|
149
|
-
if (
|
|
149
|
+
if (s === "sections") {
|
|
150
150
|
let e = r.map((e, t) => `detail-tab-section-${t}`);
|
|
151
|
-
return /* @__PURE__ */
|
|
151
|
+
return /* @__PURE__ */ X("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__ */ Y("nav", {
|
|
159
159
|
"aria-label": "Detail sections",
|
|
160
160
|
style: {
|
|
161
161
|
display: "flex",
|
|
@@ -165,8 +165,8 @@ function Te({ config: e, ctx: n }) {
|
|
|
165
165
|
WebkitOverflowScrolling: "touch"
|
|
166
166
|
},
|
|
167
167
|
children: r.map((r, i) => {
|
|
168
|
-
let a =
|
|
169
|
-
return /* @__PURE__ */
|
|
168
|
+
let a = Z(r, n), o = we(r, n);
|
|
169
|
+
return /* @__PURE__ */ X("button", {
|
|
170
170
|
type: "button",
|
|
171
171
|
onClick: () => document.getElementById(e[i])?.scrollIntoView({
|
|
172
172
|
block: "start",
|
|
@@ -188,10 +188,10 @@ function Te({ config: e, ctx: n }) {
|
|
|
188
188
|
whiteSpace: "nowrap",
|
|
189
189
|
cursor: "pointer"
|
|
190
190
|
},
|
|
191
|
-
children: [o && /* @__PURE__ */
|
|
191
|
+
children: [o && /* @__PURE__ */ Y(t, {
|
|
192
192
|
name: o,
|
|
193
193
|
size: 13
|
|
194
|
-
}), /* @__PURE__ */
|
|
194
|
+
}), /* @__PURE__ */ Y("span", {
|
|
195
195
|
style: {
|
|
196
196
|
overflow: "hidden",
|
|
197
197
|
textOverflow: "ellipsis"
|
|
@@ -201,8 +201,8 @@ function Te({ config: e, ctx: n }) {
|
|
|
201
201
|
}, i);
|
|
202
202
|
})
|
|
203
203
|
}), r.map((r, i) => {
|
|
204
|
-
let a =
|
|
205
|
-
return /* @__PURE__ */
|
|
204
|
+
let a = Z(r, n), o = we(r, n);
|
|
205
|
+
return /* @__PURE__ */ X("section", {
|
|
206
206
|
id: e[i],
|
|
207
207
|
style: {
|
|
208
208
|
background: "var(--surface)",
|
|
@@ -213,7 +213,7 @@ function Te({ config: e, ctx: n }) {
|
|
|
213
213
|
minWidth: 0,
|
|
214
214
|
scrollMarginTop: 12
|
|
215
215
|
},
|
|
216
|
-
children: [/* @__PURE__ */
|
|
216
|
+
children: [/* @__PURE__ */ X("div", {
|
|
217
217
|
style: {
|
|
218
218
|
display: "flex",
|
|
219
219
|
alignItems: "center",
|
|
@@ -224,19 +224,19 @@ function Te({ config: e, ctx: n }) {
|
|
|
224
224
|
fontSize: 13,
|
|
225
225
|
fontWeight: 700
|
|
226
226
|
},
|
|
227
|
-
children: [o && /* @__PURE__ */
|
|
227
|
+
children: [o && /* @__PURE__ */ Y(t, {
|
|
228
228
|
name: o,
|
|
229
229
|
size: 14
|
|
230
|
-
}), /* @__PURE__ */
|
|
230
|
+
}), /* @__PURE__ */ Y("span", {
|
|
231
231
|
style: { overflowWrap: "anywhere" },
|
|
232
232
|
children: a
|
|
233
233
|
})]
|
|
234
|
-
}), /* @__PURE__ */
|
|
234
|
+
}), /* @__PURE__ */ Y("div", {
|
|
235
235
|
style: {
|
|
236
236
|
padding: 14,
|
|
237
237
|
minWidth: 0
|
|
238
238
|
},
|
|
239
|
-
children: /* @__PURE__ */
|
|
239
|
+
children: /* @__PURE__ */ Y($, {
|
|
240
240
|
node: r,
|
|
241
241
|
ctx: {
|
|
242
242
|
...n,
|
|
@@ -248,7 +248,7 @@ function Te({ config: e, ctx: n }) {
|
|
|
248
248
|
})]
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
-
return /* @__PURE__ */
|
|
251
|
+
return /* @__PURE__ */ X("div", {
|
|
252
252
|
style: {
|
|
253
253
|
background: "var(--surface)",
|
|
254
254
|
border: "1px solid var(--border)",
|
|
@@ -257,7 +257,7 @@ function Te({ config: e, ctx: n }) {
|
|
|
257
257
|
boxShadow: "var(--shadow-xs)",
|
|
258
258
|
flexShrink: 0
|
|
259
259
|
},
|
|
260
|
-
children: [/* @__PURE__ */
|
|
260
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
261
261
|
role: "tablist",
|
|
262
262
|
style: {
|
|
263
263
|
display: "flex",
|
|
@@ -268,8 +268,8 @@ function Te({ config: e, ctx: n }) {
|
|
|
268
268
|
overflowX: "auto"
|
|
269
269
|
},
|
|
270
270
|
children: r.map((e, r) => {
|
|
271
|
-
let o =
|
|
272
|
-
return /* @__PURE__ */
|
|
271
|
+
let o = Z(e, n), s = we(e, n), c = r === i;
|
|
272
|
+
return /* @__PURE__ */ X("button", {
|
|
273
273
|
role: "tab",
|
|
274
274
|
"aria-selected": c,
|
|
275
275
|
onClick: (e) => {
|
|
@@ -298,12 +298,12 @@ function Te({ config: e, ctx: n }) {
|
|
|
298
298
|
c || (e.currentTarget.style.color = "var(--text-3)");
|
|
299
299
|
},
|
|
300
300
|
children: [
|
|
301
|
-
s && /* @__PURE__ */
|
|
301
|
+
s && /* @__PURE__ */ Y(t, {
|
|
302
302
|
name: s,
|
|
303
303
|
size: 13
|
|
304
304
|
}),
|
|
305
305
|
o,
|
|
306
|
-
c && /* @__PURE__ */
|
|
306
|
+
c && /* @__PURE__ */ Y("span", { style: {
|
|
307
307
|
position: "absolute",
|
|
308
308
|
left: 4,
|
|
309
309
|
right: 4,
|
|
@@ -315,10 +315,10 @@ function Te({ config: e, ctx: n }) {
|
|
|
315
315
|
]
|
|
316
316
|
}, r);
|
|
317
317
|
})
|
|
318
|
-
}), /* @__PURE__ */
|
|
318
|
+
}), /* @__PURE__ */ Y("div", {
|
|
319
319
|
role: "tabpanel",
|
|
320
320
|
style: { padding: 14 },
|
|
321
|
-
children: /* @__PURE__ */
|
|
321
|
+
children: /* @__PURE__ */ Y($, {
|
|
322
322
|
node: r[i],
|
|
323
323
|
ctx: {
|
|
324
324
|
...n,
|
|
@@ -335,22 +335,22 @@ function Ee({ 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__ */ Y(t, {
|
|
339
339
|
name: s,
|
|
340
340
|
size: 14
|
|
341
341
|
}) : void 0, f = c ? {
|
|
342
|
-
text:
|
|
342
|
+
text: C(c.text),
|
|
343
343
|
tone: c.tone,
|
|
344
344
|
dot: c.dot
|
|
345
345
|
} : void 0;
|
|
346
|
-
return /* @__PURE__ */
|
|
347
|
-
title:
|
|
346
|
+
return /* @__PURE__ */ Y(F, {
|
|
347
|
+
title: C(r),
|
|
348
348
|
defaultOpen: !a,
|
|
349
349
|
icon: d,
|
|
350
350
|
badge: f,
|
|
351
351
|
emphasis: l,
|
|
352
352
|
headingLevel: n.withinCard ? 3 : 2,
|
|
353
|
-
children: /* @__PURE__ */
|
|
353
|
+
children: /* @__PURE__ */ Y(Kt, {
|
|
354
354
|
nodes: i,
|
|
355
355
|
ctx: u
|
|
356
356
|
})
|
|
@@ -383,7 +383,7 @@ function Q(e, t, n) {
|
|
|
383
383
|
return e ?? t ?? n;
|
|
384
384
|
}
|
|
385
385
|
function Oe(e) {
|
|
386
|
-
return
|
|
386
|
+
return b(e, "update") ? "inline_edit" : "readonly";
|
|
387
387
|
}
|
|
388
388
|
function ke(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 Le(e, ...t) {
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
function Re(e) {
|
|
462
|
-
let t =
|
|
462
|
+
let t = m(e);
|
|
463
463
|
return t.length > 0 ? t[0] : void 0;
|
|
464
464
|
}
|
|
465
465
|
function ze(e, t) {
|
|
@@ -473,7 +473,7 @@ function Be(e, t, n, r) {
|
|
|
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) : h(String(r), n.length);
|
|
477
477
|
if (!e || e.length !== n.length) throw Error("invalid composite parent id");
|
|
478
478
|
for (let t = 0; t < n.length; t++) i[n[t]] = e[t];
|
|
479
479
|
} else i[n] = Array.isArray(r) ? r[0] : r;
|
|
@@ -488,27 +488,27 @@ function Ve(e, t) {
|
|
|
488
488
|
}
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/components/detail-layout/useQuickAdd.ts
|
|
491
|
-
function He(e, t, n,
|
|
492
|
-
let [
|
|
493
|
-
let t = e.quick_add, n =
|
|
494
|
-
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (
|
|
495
|
-
return
|
|
496
|
-
}),
|
|
497
|
-
mutationFn: (t) =>
|
|
491
|
+
function He(e, t, n, r) {
|
|
492
|
+
let [a, o] = q(() => {
|
|
493
|
+
let t = e.quick_add, n = r.entities[e.entity], a = {};
|
|
494
|
+
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (a[e] = i()) : a[e] = t.defaults[e];
|
|
495
|
+
return a;
|
|
496
|
+
}), s = ge(), { mutate: c, isPending: l, error: u, reset: d } = he({
|
|
497
|
+
mutationFn: (t) => O(e.entity, t),
|
|
498
498
|
onMutate: async (r) => {
|
|
499
499
|
let i = [
|
|
500
500
|
M,
|
|
501
501
|
t,
|
|
502
|
-
Array.isArray(n) ?
|
|
502
|
+
Array.isArray(n) ? k(n.map(String)) : n,
|
|
503
503
|
e.entity
|
|
504
504
|
];
|
|
505
|
-
await
|
|
506
|
-
let a =
|
|
505
|
+
await s.cancelQueries({ queryKey: i });
|
|
506
|
+
let a = s.getQueriesData({ queryKey: i }), o = {
|
|
507
507
|
...r,
|
|
508
508
|
id: `__optimistic_${crypto.randomUUID()}`,
|
|
509
509
|
__optimistic: !0
|
|
510
510
|
};
|
|
511
|
-
return
|
|
511
|
+
return s.setQueriesData({ queryKey: i }, (e) => {
|
|
512
512
|
if (!e || typeof e != "object") return e;
|
|
513
513
|
if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
|
|
514
514
|
let t = e, [n, ...r] = t.pages;
|
|
@@ -524,48 +524,48 @@ function He(e, t, n, i) {
|
|
|
524
524
|
}), { snapshots: a };
|
|
525
525
|
},
|
|
526
526
|
onError: (e, t, n) => {
|
|
527
|
-
if (n?.snapshots) for (let [e, t] of n.snapshots)
|
|
527
|
+
if (n?.snapshots) for (let [e, t] of n.snapshots) s.setQueryData(e, t);
|
|
528
528
|
},
|
|
529
529
|
onSuccess: () => {
|
|
530
|
-
let t = e.quick_add, n =
|
|
531
|
-
if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ?
|
|
532
|
-
|
|
530
|
+
let t = e.quick_add, n = r.entities[e.entity], a = {};
|
|
531
|
+
if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? a[e] = i() : a[e] = "" : a[e] = t.defaults[e];
|
|
532
|
+
o(a);
|
|
533
533
|
},
|
|
534
534
|
onSettled: () => {
|
|
535
|
-
let r = Array.isArray(n) ?
|
|
536
|
-
|
|
535
|
+
let r = Array.isArray(n) ? k(n.map(String)) : n;
|
|
536
|
+
s.invalidateQueries({ queryKey: [
|
|
537
537
|
M,
|
|
538
538
|
t,
|
|
539
539
|
r,
|
|
540
540
|
e.entity
|
|
541
541
|
] });
|
|
542
542
|
}
|
|
543
|
-
}),
|
|
544
|
-
function
|
|
545
|
-
t.preventDefault(),
|
|
543
|
+
}), f = e.quick_add, p = r.entities[e.entity], m = Ve(a, f?.fields.filter((e) => p?.fields.get(e)?.required) ?? []);
|
|
544
|
+
function h(t) {
|
|
545
|
+
t.preventDefault(), f && c(Be(a, f.defaults, e.foreign_key, n));
|
|
546
546
|
}
|
|
547
|
-
function
|
|
548
|
-
|
|
547
|
+
function g(e, t) {
|
|
548
|
+
u && d(), o((n) => ({
|
|
549
549
|
...n,
|
|
550
550
|
[e]: t
|
|
551
551
|
}));
|
|
552
552
|
}
|
|
553
553
|
return {
|
|
554
|
-
values:
|
|
555
|
-
quickAdd:
|
|
556
|
-
childEntity:
|
|
557
|
-
isPending:
|
|
558
|
-
error:
|
|
559
|
-
isReady:
|
|
560
|
-
handleSubmit:
|
|
561
|
-
handleFieldChange:
|
|
554
|
+
values: a,
|
|
555
|
+
quickAdd: f,
|
|
556
|
+
childEntity: p,
|
|
557
|
+
isPending: l,
|
|
558
|
+
error: u,
|
|
559
|
+
isReady: m,
|
|
560
|
+
handleSubmit: h,
|
|
561
|
+
handleFieldChange: g
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
564
|
//#endregion
|
|
565
565
|
//#region src/components/detail-layout/QuickAddForm.tsx
|
|
566
566
|
function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
567
|
-
let { values:
|
|
568
|
-
return !s || s.fields.length === 0 || !l ? null : /* @__PURE__ */
|
|
567
|
+
let { values: o, quickAdd: s, childEntity: l, isPending: u, error: d, isReady: f, handleSubmit: p, handleFieldChange: m } = He(t, n, r, i), h = D(), g = c(), _ = fe();
|
|
568
|
+
return !s || s.fields.length === 0 || !l ? null : /* @__PURE__ */ X("form", {
|
|
569
569
|
onSubmit: p,
|
|
570
570
|
style: {
|
|
571
571
|
display: "flex",
|
|
@@ -579,15 +579,15 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
579
579
|
s.fields.map((e) => {
|
|
580
580
|
let n = l.fields.get(e);
|
|
581
581
|
if (!n) return null;
|
|
582
|
-
let r = `${_}-quick-add-${t.entity}-${e}`,
|
|
583
|
-
return /* @__PURE__ */
|
|
582
|
+
let r = `${_}-quick-add-${t.entity}-${e}`, a = `${r}-label`;
|
|
583
|
+
return /* @__PURE__ */ X("div", {
|
|
584
584
|
style: {
|
|
585
585
|
flex: 1,
|
|
586
586
|
minWidth: 0,
|
|
587
587
|
width: g.isPhone ? "100%" : void 0
|
|
588
588
|
},
|
|
589
|
-
children: [/* @__PURE__ */
|
|
590
|
-
id:
|
|
589
|
+
children: [/* @__PURE__ */ Y("label", {
|
|
590
|
+
id: a,
|
|
591
591
|
htmlFor: r,
|
|
592
592
|
style: {
|
|
593
593
|
fontSize: 11,
|
|
@@ -596,30 +596,30 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
596
596
|
display: "block",
|
|
597
597
|
fontWeight: 500
|
|
598
598
|
},
|
|
599
|
-
children:
|
|
600
|
-
}),
|
|
599
|
+
children: E(n, e, i.entities)
|
|
600
|
+
}), w({
|
|
601
601
|
field: n,
|
|
602
602
|
fieldName: e,
|
|
603
|
-
value:
|
|
603
|
+
value: o[e] ?? "",
|
|
604
604
|
mode: "edit",
|
|
605
605
|
onChange: (t) => m(e, t),
|
|
606
|
-
record:
|
|
606
|
+
record: o,
|
|
607
607
|
fieldId: r,
|
|
608
|
-
labelId:
|
|
608
|
+
labelId: a,
|
|
609
609
|
locale: h
|
|
610
610
|
})]
|
|
611
611
|
}, e);
|
|
612
612
|
}),
|
|
613
|
-
/* @__PURE__ */
|
|
613
|
+
/* @__PURE__ */ Y(a, {
|
|
614
614
|
type: "submit",
|
|
615
615
|
kind: "primary",
|
|
616
616
|
size: g.isPhone ? "md" : "sm",
|
|
617
|
-
icon: /* @__PURE__ */
|
|
617
|
+
icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
|
|
618
618
|
disabled: u || !f,
|
|
619
619
|
style: g.isPhone ? { alignSelf: "flex-end" } : void 0,
|
|
620
620
|
children: "Add"
|
|
621
621
|
}),
|
|
622
|
-
d != null && /* @__PURE__ */
|
|
622
|
+
d != null && /* @__PURE__ */ Y("span", {
|
|
623
623
|
style: {
|
|
624
624
|
fontSize: 11,
|
|
625
625
|
color: "var(--danger)",
|
|
@@ -633,34 +633,34 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
633
633
|
}
|
|
634
634
|
//#endregion
|
|
635
635
|
//#region src/components/detail-layout/ChildrenTable.tsx
|
|
636
|
-
function We({ config: t, parentEntity: n, parentId: r, schema:
|
|
637
|
-
let
|
|
638
|
-
|
|
639
|
-
let
|
|
636
|
+
function We({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
637
|
+
let a = i.entities[t.entity], o = D(), c = V((e) => e.degradedEntities), { data: u, isLoading: f, isError: p, isFetching: m, refetch: h } = P(n, r, t.entity, t.foreign_key, t.sort, t.limit), g = u?.data ?? [], y = u?.$refs, b = K(y);
|
|
638
|
+
b.current = y;
|
|
639
|
+
let x = t.columns, S = t.interaction === "navigate", C = x[0], w = S && a ? v(void 0, a, i.screens) : null, T = a ? Re(a) : void 0, O = G(() => {
|
|
640
640
|
let e = /* @__PURE__ */ new Map();
|
|
641
|
-
if (!
|
|
642
|
-
for (let t of
|
|
643
|
-
let n =
|
|
644
|
-
n && e.set(t,
|
|
641
|
+
if (!a) return e;
|
|
642
|
+
for (let t of x) {
|
|
643
|
+
let n = a.fields.get(t);
|
|
644
|
+
n && e.set(t, _({
|
|
645
645
|
field: n,
|
|
646
646
|
fieldName: t,
|
|
647
647
|
surface: "list",
|
|
648
|
-
entity:
|
|
649
|
-
entities:
|
|
650
|
-
screens:
|
|
651
|
-
refs: () =>
|
|
652
|
-
locale:
|
|
648
|
+
entity: a,
|
|
649
|
+
entities: i.entities,
|
|
650
|
+
screens: i.screens,
|
|
651
|
+
refs: () => b.current,
|
|
652
|
+
locale: o
|
|
653
653
|
}));
|
|
654
654
|
}
|
|
655
655
|
return e;
|
|
656
656
|
}, [
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
657
|
+
a,
|
|
658
|
+
x,
|
|
659
|
+
i.entities,
|
|
660
|
+
i.screens,
|
|
661
|
+
o
|
|
662
662
|
]);
|
|
663
|
-
if (!
|
|
663
|
+
if (!a) return /* @__PURE__ */ Y("div", {
|
|
664
664
|
style: {
|
|
665
665
|
fontSize: 12.5,
|
|
666
666
|
color: "var(--text-3)",
|
|
@@ -668,12 +668,12 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
668
668
|
},
|
|
669
669
|
children: "Entity not found."
|
|
670
670
|
});
|
|
671
|
-
let
|
|
671
|
+
let k = /* @__PURE__ */ Y(Ue, {
|
|
672
672
|
config: t,
|
|
673
673
|
parentEntity: n,
|
|
674
674
|
parentId: r,
|
|
675
|
-
schema:
|
|
676
|
-
}), j = /* @__PURE__ */
|
|
675
|
+
schema: i
|
|
676
|
+
}), j = /* @__PURE__ */ X("div", {
|
|
677
677
|
style: {
|
|
678
678
|
display: "flex",
|
|
679
679
|
alignItems: "center",
|
|
@@ -681,33 +681,33 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
681
681
|
padding: "4px 0",
|
|
682
682
|
justifyContent: "flex-end"
|
|
683
683
|
},
|
|
684
|
-
children: [
|
|
684
|
+
children: [ee(a.realtime, c, t.entity) && /* @__PURE__ */ Y("span", {
|
|
685
685
|
"data-testid": "children-live-indicator",
|
|
686
686
|
title: "This table updates automatically in realtime.",
|
|
687
|
-
children: /* @__PURE__ */
|
|
687
|
+
children: /* @__PURE__ */ Y(l, {
|
|
688
688
|
tone: "emerald",
|
|
689
689
|
size: "xs",
|
|
690
690
|
dot: !0,
|
|
691
691
|
children: "Live"
|
|
692
692
|
})
|
|
693
|
-
}), /* @__PURE__ */
|
|
694
|
-
icon:
|
|
693
|
+
}), /* @__PURE__ */ Y(d, {
|
|
694
|
+
icon: m ? /* @__PURE__ */ Y("span", {
|
|
695
695
|
"data-testid": "children-refresh-spinner",
|
|
696
696
|
style: { display: "inline-flex" },
|
|
697
|
-
children: /* @__PURE__ */
|
|
698
|
-
}) : /* @__PURE__ */
|
|
697
|
+
children: /* @__PURE__ */ Y(s, { size: 13 })
|
|
698
|
+
}) : /* @__PURE__ */ Y(e.refresh, { size: 13 }),
|
|
699
699
|
title: "Refresh",
|
|
700
700
|
size: 24,
|
|
701
|
-
disabled:
|
|
701
|
+
disabled: m,
|
|
702
702
|
onClick: () => {
|
|
703
|
-
|
|
703
|
+
h();
|
|
704
704
|
}
|
|
705
705
|
})]
|
|
706
706
|
});
|
|
707
|
-
return
|
|
708
|
-
|
|
707
|
+
return p ? /* @__PURE__ */ X("div", { children: [
|
|
708
|
+
k,
|
|
709
709
|
j,
|
|
710
|
-
/* @__PURE__ */
|
|
710
|
+
/* @__PURE__ */ Y("div", {
|
|
711
711
|
style: {
|
|
712
712
|
fontSize: 12.5,
|
|
713
713
|
color: "var(--danger)",
|
|
@@ -715,10 +715,10 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
715
715
|
},
|
|
716
716
|
children: "Failed to load. Try again."
|
|
717
717
|
})
|
|
718
|
-
] }) :
|
|
719
|
-
|
|
718
|
+
] }) : f ? /* @__PURE__ */ X("div", { children: [
|
|
719
|
+
k,
|
|
720
720
|
j,
|
|
721
|
-
/* @__PURE__ */
|
|
721
|
+
/* @__PURE__ */ Y("div", {
|
|
722
722
|
style: {
|
|
723
723
|
display: "flex",
|
|
724
724
|
flexDirection: "column",
|
|
@@ -729,16 +729,16 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
729
729
|
0,
|
|
730
730
|
1,
|
|
731
731
|
2
|
|
732
|
-
].map((e) => /* @__PURE__ */
|
|
732
|
+
].map((e) => /* @__PURE__ */ Y("div", { style: {
|
|
733
733
|
height: 32,
|
|
734
734
|
background: "var(--surface-3)",
|
|
735
735
|
borderRadius: 4
|
|
736
736
|
} }, e))
|
|
737
737
|
})
|
|
738
|
-
] }) :
|
|
739
|
-
|
|
738
|
+
] }) : g.length === 0 ? /* @__PURE__ */ X("div", { children: [
|
|
739
|
+
k,
|
|
740
740
|
j,
|
|
741
|
-
/* @__PURE__ */
|
|
741
|
+
/* @__PURE__ */ Y("div", {
|
|
742
742
|
style: {
|
|
743
743
|
fontSize: 12.5,
|
|
744
744
|
color: "var(--text-3)",
|
|
@@ -746,27 +746,27 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
746
746
|
},
|
|
747
747
|
children: "No records yet."
|
|
748
748
|
})
|
|
749
|
-
] }) : /* @__PURE__ */
|
|
750
|
-
|
|
749
|
+
] }) : /* @__PURE__ */ X("div", { children: [
|
|
750
|
+
k,
|
|
751
751
|
j,
|
|
752
|
-
/* @__PURE__ */
|
|
752
|
+
/* @__PURE__ */ Y("div", {
|
|
753
753
|
style: { overflowX: "auto" },
|
|
754
|
-
children: /* @__PURE__ */
|
|
754
|
+
children: /* @__PURE__ */ X("table", {
|
|
755
755
|
style: se,
|
|
756
|
-
children: [/* @__PURE__ */
|
|
757
|
-
let t =
|
|
758
|
-
return /* @__PURE__ */
|
|
756
|
+
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: x.map((e) => {
|
|
757
|
+
let t = a.fields.get(e);
|
|
758
|
+
return /* @__PURE__ */ Y("th", {
|
|
759
759
|
style: oe,
|
|
760
|
-
children: t ?
|
|
760
|
+
children: t ? E(t, e, i.entities) : e
|
|
761
761
|
}, e);
|
|
762
|
-
}) }) }), /* @__PURE__ */
|
|
763
|
-
let n =
|
|
764
|
-
return /* @__PURE__ */
|
|
765
|
-
let n = t ===
|
|
766
|
-
return /* @__PURE__ */
|
|
762
|
+
}) }) }), /* @__PURE__ */ Y("tbody", { children: g.map((e, t) => {
|
|
763
|
+
let n = T ? A(e[T]) : "", r = S && w && n ? w.replace(/:\w+/, n) : void 0;
|
|
764
|
+
return /* @__PURE__ */ Y("tr", { children: x.map((t) => {
|
|
765
|
+
let n = t === C, i = O.get(t), a = i ? i(e[t], e) : A(e[t]);
|
|
766
|
+
return /* @__PURE__ */ Y("td", {
|
|
767
767
|
title: typeof a == "string" ? a : void 0,
|
|
768
768
|
style: ce,
|
|
769
|
-
children: n && r ? /* @__PURE__ */
|
|
769
|
+
children: n && r ? /* @__PURE__ */ Y("a", {
|
|
770
770
|
href: r,
|
|
771
771
|
style: {
|
|
772
772
|
color: "var(--accent)",
|
|
@@ -778,7 +778,7 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
778
778
|
children: a
|
|
779
779
|
}) : a
|
|
780
780
|
}, t);
|
|
781
|
-
}) },
|
|
781
|
+
}) }, A(e.id ?? t));
|
|
782
782
|
}) })]
|
|
783
783
|
})
|
|
784
784
|
})
|
|
@@ -786,9 +786,9 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
786
786
|
}
|
|
787
787
|
//#endregion
|
|
788
788
|
//#region src/components/detail-layout/ChildrenList.tsx
|
|
789
|
-
function Ge({ config: e, parentEntity: t, parentId:
|
|
790
|
-
let
|
|
791
|
-
if (!
|
|
789
|
+
function Ge({ config: e, parentEntity: t, parentId: r, schema: i }) {
|
|
790
|
+
let a = i.entities[e.entity], o = D(), { data: s, isLoading: c, isError: l } = P(t, r, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], d = s?.$refs, f = e.columns;
|
|
791
|
+
if (!a) return /* @__PURE__ */ Y("div", {
|
|
792
792
|
style: {
|
|
793
793
|
fontSize: 12.5,
|
|
794
794
|
color: "var(--text-3)",
|
|
@@ -796,13 +796,13 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
796
796
|
},
|
|
797
797
|
children: "Entity not found."
|
|
798
798
|
});
|
|
799
|
-
let
|
|
799
|
+
let p = /* @__PURE__ */ Y(Ue, {
|
|
800
800
|
config: e,
|
|
801
801
|
parentEntity: t,
|
|
802
|
-
parentId:
|
|
803
|
-
schema:
|
|
802
|
+
parentId: r,
|
|
803
|
+
schema: i
|
|
804
804
|
});
|
|
805
|
-
if (
|
|
805
|
+
if (l) return /* @__PURE__ */ X("div", { children: [p, /* @__PURE__ */ Y("div", {
|
|
806
806
|
style: {
|
|
807
807
|
fontSize: 12.5,
|
|
808
808
|
color: "var(--danger)",
|
|
@@ -810,7 +810,7 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
810
810
|
},
|
|
811
811
|
children: "Failed to load. Try again."
|
|
812
812
|
})] });
|
|
813
|
-
if (
|
|
813
|
+
if (c) return /* @__PURE__ */ X("div", { children: [p, /* @__PURE__ */ X("div", {
|
|
814
814
|
style: {
|
|
815
815
|
display: "flex",
|
|
816
816
|
flexDirection: "column",
|
|
@@ -818,17 +818,17 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
818
818
|
padding: "8px 0"
|
|
819
819
|
},
|
|
820
820
|
children: [
|
|
821
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ Y("div", { style: {
|
|
822
822
|
height: 22,
|
|
823
823
|
background: "var(--surface-3)",
|
|
824
824
|
borderRadius: 4
|
|
825
825
|
} }),
|
|
826
|
-
/* @__PURE__ */
|
|
826
|
+
/* @__PURE__ */ Y("div", { style: {
|
|
827
827
|
height: 22,
|
|
828
828
|
background: "var(--surface-3)",
|
|
829
829
|
borderRadius: 4
|
|
830
830
|
} }),
|
|
831
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ Y("div", { style: {
|
|
832
832
|
height: 22,
|
|
833
833
|
background: "var(--surface-3)",
|
|
834
834
|
borderRadius: 4,
|
|
@@ -836,7 +836,7 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
836
836
|
} })
|
|
837
837
|
]
|
|
838
838
|
})] });
|
|
839
|
-
if (
|
|
839
|
+
if (u.length === 0) return /* @__PURE__ */ X("div", { children: [p, /* @__PURE__ */ Y("div", {
|
|
840
840
|
style: {
|
|
841
841
|
fontSize: 12.5,
|
|
842
842
|
color: "var(--text-3)",
|
|
@@ -844,13 +844,13 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
844
844
|
},
|
|
845
845
|
children: "No records yet."
|
|
846
846
|
})] });
|
|
847
|
-
let
|
|
848
|
-
return /* @__PURE__ */
|
|
847
|
+
let m = f.length > 0 ? a.display.display_field ?? f[0] : a.display.display_field;
|
|
848
|
+
return /* @__PURE__ */ X("div", { children: [p, /* @__PURE__ */ Y("div", {
|
|
849
849
|
style: {
|
|
850
850
|
display: "flex",
|
|
851
851
|
flexDirection: "column"
|
|
852
852
|
},
|
|
853
|
-
children:
|
|
853
|
+
children: u.map((e, t) => /* @__PURE__ */ Y("div", {
|
|
854
854
|
style: {
|
|
855
855
|
display: "flex",
|
|
856
856
|
alignItems: "center",
|
|
@@ -858,30 +858,30 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
858
858
|
padding: "8px 4px",
|
|
859
859
|
borderBottom: "1px solid var(--divider)"
|
|
860
860
|
},
|
|
861
|
-
children: /* @__PURE__ */
|
|
861
|
+
children: /* @__PURE__ */ X("div", {
|
|
862
862
|
style: {
|
|
863
863
|
flex: 1,
|
|
864
864
|
minWidth: 0
|
|
865
865
|
},
|
|
866
|
-
children: [/* @__PURE__ */
|
|
866
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
867
867
|
style: {
|
|
868
868
|
fontSize: 12.5,
|
|
869
869
|
overflow: "hidden",
|
|
870
870
|
textOverflow: "ellipsis",
|
|
871
871
|
whiteSpace: "nowrap"
|
|
872
872
|
},
|
|
873
|
-
children: (typeof e.$display == "string" ? e[
|
|
874
|
-
field:
|
|
875
|
-
fieldName:
|
|
876
|
-
value: e[
|
|
873
|
+
children: (typeof e.$display == "string" ? e[n] : "") || (m && a.fields.get(m) ? w({
|
|
874
|
+
field: a.fields.get(m),
|
|
875
|
+
fieldName: m,
|
|
876
|
+
value: e[m],
|
|
877
877
|
mode: "display",
|
|
878
878
|
record: e,
|
|
879
|
-
refs:
|
|
880
|
-
locale:
|
|
881
|
-
}) :
|
|
882
|
-
}),
|
|
883
|
-
let t =
|
|
884
|
-
return t.length === 0 ? null : /* @__PURE__ */
|
|
879
|
+
refs: d,
|
|
880
|
+
locale: o
|
|
881
|
+
}) : m && e[m] != null ? A(e[m]) : null)
|
|
882
|
+
}), f.length > 1 && (() => {
|
|
883
|
+
let t = f.slice(1, 3).filter((t) => e[t] != null);
|
|
884
|
+
return t.length === 0 ? null : /* @__PURE__ */ Y("div", {
|
|
885
885
|
style: {
|
|
886
886
|
fontSize: 11.5,
|
|
887
887
|
color: "var(--text-3)",
|
|
@@ -889,26 +889,26 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
889
889
|
textOverflow: "ellipsis",
|
|
890
890
|
whiteSpace: "nowrap"
|
|
891
891
|
},
|
|
892
|
-
children: t.map((t, n) => /* @__PURE__ */
|
|
893
|
-
field:
|
|
892
|
+
children: t.map((t, n) => /* @__PURE__ */ X("span", { children: [n > 0 && " · ", a.fields.get(t) ? w({
|
|
893
|
+
field: a.fields.get(t),
|
|
894
894
|
fieldName: t,
|
|
895
895
|
value: e[t],
|
|
896
896
|
mode: "display",
|
|
897
897
|
record: e,
|
|
898
|
-
refs:
|
|
899
|
-
locale:
|
|
898
|
+
refs: d,
|
|
899
|
+
locale: o
|
|
900
900
|
}) : String(e[t])] }, t))
|
|
901
901
|
});
|
|
902
902
|
})()]
|
|
903
903
|
})
|
|
904
|
-
},
|
|
904
|
+
}, A(e.id ?? t)))
|
|
905
905
|
})] });
|
|
906
906
|
}
|
|
907
907
|
//#endregion
|
|
908
908
|
//#region src/components/detail-layout/ChildrenCards.tsx
|
|
909
909
|
function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
910
|
-
let
|
|
911
|
-
if (!
|
|
910
|
+
let i = r.entities[e.entity], a = D(), { data: o, isLoading: s, isError: c } = P(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = o?.data ?? [], d = o?.$refs, f = e.columns, p = e.cards, m = p?.header_field ?? f[0], h = p?.badge_field, g = p?.columns_count ?? 3;
|
|
911
|
+
if (!i) return /* @__PURE__ */ Y("div", {
|
|
912
912
|
style: {
|
|
913
913
|
fontSize: 12.5,
|
|
914
914
|
color: "var(--text-3)",
|
|
@@ -920,13 +920,13 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
920
920
|
display: "grid",
|
|
921
921
|
gridTemplateColumns: `repeat(auto-fill, minmax(${g >= 4 ? 180 : 240}px, 1fr))`,
|
|
922
922
|
gap: 12
|
|
923
|
-
}, v = /* @__PURE__ */
|
|
923
|
+
}, v = /* @__PURE__ */ Y(Ue, {
|
|
924
924
|
config: e,
|
|
925
925
|
parentEntity: t,
|
|
926
926
|
parentId: n,
|
|
927
927
|
schema: r
|
|
928
928
|
});
|
|
929
|
-
if (
|
|
929
|
+
if (c) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
930
930
|
style: {
|
|
931
931
|
fontSize: 12.5,
|
|
932
932
|
color: "var(--danger)",
|
|
@@ -934,19 +934,19 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
934
934
|
},
|
|
935
935
|
children: "Failed to load. Try again."
|
|
936
936
|
})] });
|
|
937
|
-
if (
|
|
937
|
+
if (s) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
938
938
|
style: _,
|
|
939
939
|
children: [
|
|
940
940
|
0,
|
|
941
941
|
1,
|
|
942
942
|
2
|
|
943
|
-
].map((e) => /* @__PURE__ */
|
|
943
|
+
].map((e) => /* @__PURE__ */ Y("div", { style: {
|
|
944
944
|
height: 96,
|
|
945
945
|
background: "var(--surface-3)",
|
|
946
946
|
borderRadius: 10
|
|
947
947
|
} }, e))
|
|
948
948
|
})] });
|
|
949
|
-
if (u.length === 0) return /* @__PURE__ */
|
|
949
|
+
if (u.length === 0) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
950
950
|
style: {
|
|
951
951
|
fontSize: 12.5,
|
|
952
952
|
color: "var(--text-3)",
|
|
@@ -955,16 +955,16 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
955
955
|
children: "No records yet."
|
|
956
956
|
})] });
|
|
957
957
|
let y = f.filter((e) => e !== m && e !== h);
|
|
958
|
-
return /* @__PURE__ */
|
|
958
|
+
return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
959
959
|
style: _,
|
|
960
|
-
children: u.map((t, n) => /* @__PURE__ */
|
|
960
|
+
children: u.map((t, n) => /* @__PURE__ */ X("div", {
|
|
961
961
|
style: {
|
|
962
962
|
background: "var(--surface)",
|
|
963
963
|
border: "1px solid var(--border)",
|
|
964
964
|
borderRadius: 10,
|
|
965
965
|
overflow: "hidden"
|
|
966
966
|
},
|
|
967
|
-
children: [/* @__PURE__ */
|
|
967
|
+
children: [/* @__PURE__ */ X("div", {
|
|
968
968
|
style: {
|
|
969
969
|
padding: "10px 14px",
|
|
970
970
|
display: "flex",
|
|
@@ -973,7 +973,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
973
973
|
gap: 8,
|
|
974
974
|
borderBottom: y.length > 0 ? "1px solid var(--divider)" : "none"
|
|
975
975
|
},
|
|
976
|
-
children: [/* @__PURE__ */
|
|
976
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
977
977
|
style: {
|
|
978
978
|
fontSize: 12.5,
|
|
979
979
|
fontWeight: 600,
|
|
@@ -981,29 +981,29 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
981
981
|
textOverflow: "ellipsis",
|
|
982
982
|
whiteSpace: "nowrap"
|
|
983
983
|
},
|
|
984
|
-
children: m &&
|
|
985
|
-
field:
|
|
984
|
+
children: m && i.fields.get(m) ? w({
|
|
985
|
+
field: i.fields.get(m),
|
|
986
986
|
fieldName: m,
|
|
987
987
|
value: t[m],
|
|
988
988
|
mode: "display",
|
|
989
989
|
record: t,
|
|
990
990
|
refs: d,
|
|
991
|
-
locale:
|
|
991
|
+
locale: a
|
|
992
992
|
}) : `Record ${n + 1}`
|
|
993
|
-
}), h && t[h] != null && /* @__PURE__ */
|
|
993
|
+
}), h && t[h] != null && /* @__PURE__ */ Y(l, {
|
|
994
994
|
tone: "slate",
|
|
995
995
|
size: "xs",
|
|
996
|
-
children:
|
|
997
|
-
field:
|
|
996
|
+
children: i.fields.get(h) ? w({
|
|
997
|
+
field: i.fields.get(h),
|
|
998
998
|
fieldName: h,
|
|
999
999
|
value: t[h],
|
|
1000
1000
|
mode: "display",
|
|
1001
1001
|
record: t,
|
|
1002
1002
|
refs: d,
|
|
1003
|
-
locale:
|
|
1004
|
-
}) :
|
|
1003
|
+
locale: a
|
|
1004
|
+
}) : A(t[h])
|
|
1005
1005
|
})]
|
|
1006
|
-
}), y.length > 0 && /* @__PURE__ */
|
|
1006
|
+
}), y.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1007
1007
|
style: {
|
|
1008
1008
|
padding: "10px 14px",
|
|
1009
1009
|
display: "flex",
|
|
@@ -1011,47 +1011,47 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1011
1011
|
gap: 4
|
|
1012
1012
|
},
|
|
1013
1013
|
children: y.slice(0, 4).map((n) => {
|
|
1014
|
-
let
|
|
1015
|
-
return
|
|
1014
|
+
let o = i.fields.get(n);
|
|
1015
|
+
return o ? /* @__PURE__ */ X("div", {
|
|
1016
1016
|
style: {
|
|
1017
1017
|
display: "flex",
|
|
1018
1018
|
alignItems: "baseline",
|
|
1019
1019
|
gap: 8,
|
|
1020
1020
|
fontSize: 11.5
|
|
1021
1021
|
},
|
|
1022
|
-
children: [/* @__PURE__ */
|
|
1022
|
+
children: [/* @__PURE__ */ X("span", {
|
|
1023
1023
|
style: {
|
|
1024
1024
|
color: "var(--text-3)",
|
|
1025
1025
|
flexShrink: 0
|
|
1026
1026
|
},
|
|
1027
1027
|
children: [r.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(r.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
|
|
1028
|
-
}), /* @__PURE__ */
|
|
1028
|
+
}), /* @__PURE__ */ Y("span", {
|
|
1029
1029
|
style: {
|
|
1030
1030
|
overflow: "hidden",
|
|
1031
1031
|
textOverflow: "ellipsis",
|
|
1032
1032
|
whiteSpace: "nowrap"
|
|
1033
1033
|
},
|
|
1034
|
-
children:
|
|
1035
|
-
field:
|
|
1034
|
+
children: w({
|
|
1035
|
+
field: o,
|
|
1036
1036
|
fieldName: n,
|
|
1037
1037
|
value: t[n],
|
|
1038
1038
|
mode: "display",
|
|
1039
1039
|
record: t,
|
|
1040
1040
|
refs: d,
|
|
1041
|
-
locale:
|
|
1041
|
+
locale: a
|
|
1042
1042
|
})
|
|
1043
1043
|
})]
|
|
1044
1044
|
}, n) : null;
|
|
1045
1045
|
})
|
|
1046
1046
|
})]
|
|
1047
|
-
},
|
|
1047
|
+
}, A(t.id ?? n)))
|
|
1048
1048
|
})] });
|
|
1049
1049
|
}
|
|
1050
1050
|
//#endregion
|
|
1051
1051
|
//#region src/hooks/useTimelineData.ts
|
|
1052
1052
|
var qe = 50;
|
|
1053
1053
|
function Je(e, t, n, r, i, a) {
|
|
1054
|
-
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ?
|
|
1054
|
+
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? h(t, o.length) : [t], c = a ?? qe, l = me({
|
|
1055
1055
|
queryKey: [
|
|
1056
1056
|
M,
|
|
1057
1057
|
e,
|
|
@@ -1069,14 +1069,14 @@ function Je(e, t, n, r, i, a) {
|
|
|
1069
1069
|
op: "eq",
|
|
1070
1070
|
value: s[t]
|
|
1071
1071
|
}));
|
|
1072
|
-
return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(c)), e && t.set("after", e),
|
|
1072
|
+
return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(c)), e && t.set("after", e), S(`/api/data/${n}?${t.toString()}`);
|
|
1073
1073
|
},
|
|
1074
1074
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
1075
1075
|
initialPageParam: void 0,
|
|
1076
1076
|
enabled: !!e && !!t && !!n && !!r && s !== null
|
|
1077
1077
|
});
|
|
1078
1078
|
return {
|
|
1079
|
-
rows:
|
|
1079
|
+
rows: G(() => l.data?.pages.flatMap((e) => e.data) ?? [], [l.data?.pages]),
|
|
1080
1080
|
refs: l.data?.pages[0]?.$refs,
|
|
1081
1081
|
fetchNextPage: l.fetchNextPage,
|
|
1082
1082
|
hasOlder: !!l.hasNextPage,
|
|
@@ -1089,8 +1089,8 @@ function Je(e, t, n, r, i, a) {
|
|
|
1089
1089
|
//#region src/components/detail-layout/TimelineComposer.tsx
|
|
1090
1090
|
var Ye = "quick_entry", Xe = 100, Ze = 240, Qe = 800, $e = 80;
|
|
1091
1091
|
function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
1092
|
-
let { values:
|
|
1093
|
-
|
|
1092
|
+
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = He(t, n, r, i), m = D(), [h, _] = q(Ze), v = K(null), y = K(null), [b, x] = q(Qe);
|
|
1093
|
+
W(() => {
|
|
1094
1094
|
let e = y.current?.parentElement;
|
|
1095
1095
|
if (!e) return;
|
|
1096
1096
|
let t = () => {
|
|
@@ -1100,66 +1100,66 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1100
1100
|
t();
|
|
1101
1101
|
let n = new ResizeObserver(t);
|
|
1102
1102
|
return n.observe(e), () => n.disconnect();
|
|
1103
|
-
}, []),
|
|
1104
|
-
|
|
1103
|
+
}, []), W(() => {
|
|
1104
|
+
_((e) => Math.min(e, b));
|
|
1105
1105
|
}, [b]);
|
|
1106
|
-
let S =
|
|
1107
|
-
S.current =
|
|
1108
|
-
let
|
|
1109
|
-
|
|
1110
|
-
let T =
|
|
1106
|
+
let S = K(o);
|
|
1107
|
+
S.current = o;
|
|
1108
|
+
let C = K(p);
|
|
1109
|
+
C.current = p;
|
|
1110
|
+
let T = K({}), E = G(() => ({
|
|
1111
1111
|
getField: (e) => S.current[e],
|
|
1112
1112
|
setField: (e, t) => {
|
|
1113
|
-
|
|
1113
|
+
C.current(e, t);
|
|
1114
1114
|
},
|
|
1115
1115
|
focusField: (e) => {
|
|
1116
1116
|
let t = T.current[e];
|
|
1117
1117
|
t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
|
|
1118
1118
|
}
|
|
1119
1119
|
}), []);
|
|
1120
|
-
|
|
1121
|
-
let O =
|
|
1122
|
-
e.preventDefault(),
|
|
1120
|
+
W(() => g(Ye, E), [E]);
|
|
1121
|
+
let O = U((e) => {
|
|
1122
|
+
e.preventDefault(), v.current = {
|
|
1123
1123
|
startY: e.clientY,
|
|
1124
1124
|
startHeight: h
|
|
1125
1125
|
};
|
|
1126
1126
|
let t = (e) => {
|
|
1127
|
-
if (!
|
|
1128
|
-
let t =
|
|
1129
|
-
|
|
1127
|
+
if (!v.current) return;
|
|
1128
|
+
let t = v.current.startY - e.clientY;
|
|
1129
|
+
_(Math.min(b, Math.max(Xe, v.current.startHeight + t)));
|
|
1130
1130
|
}, n = () => {
|
|
1131
|
-
|
|
1131
|
+
v.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
1132
1132
|
};
|
|
1133
1133
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
1134
1134
|
}, [h, b]);
|
|
1135
|
-
if (!
|
|
1136
|
-
let k =
|
|
1137
|
-
let t =
|
|
1135
|
+
if (!s || s.fields.length === 0 || !c) return null;
|
|
1136
|
+
let k = s.fields.find((e) => {
|
|
1137
|
+
let t = c.fields.get(e);
|
|
1138
1138
|
return t && (t.type === "text" || t.type === "string");
|
|
1139
1139
|
}), A = [], j = [];
|
|
1140
|
-
for (let e of
|
|
1140
|
+
for (let e of s.fields) {
|
|
1141
1141
|
if (e === k) continue;
|
|
1142
|
-
let t =
|
|
1142
|
+
let t = c.fields.get(e);
|
|
1143
1143
|
t && (t.type === "enum" ? A.push(e) : j.push(e));
|
|
1144
1144
|
}
|
|
1145
1145
|
let M = (e) => {
|
|
1146
|
-
let t =
|
|
1147
|
-
return t ? /* @__PURE__ */
|
|
1146
|
+
let t = c.fields.get(e);
|
|
1147
|
+
return t ? /* @__PURE__ */ Y("div", {
|
|
1148
1148
|
ref: (t) => {
|
|
1149
1149
|
T.current[e] = t;
|
|
1150
1150
|
},
|
|
1151
|
-
children:
|
|
1151
|
+
children: w({
|
|
1152
1152
|
field: t,
|
|
1153
1153
|
fieldName: e,
|
|
1154
|
-
value:
|
|
1154
|
+
value: o[e] ?? "",
|
|
1155
1155
|
mode: "edit",
|
|
1156
1156
|
onChange: (t) => p(e, t),
|
|
1157
|
-
record:
|
|
1157
|
+
record: o,
|
|
1158
1158
|
locale: m
|
|
1159
1159
|
})
|
|
1160
1160
|
}, e) : null;
|
|
1161
1161
|
};
|
|
1162
|
-
return /* @__PURE__ */
|
|
1162
|
+
return /* @__PURE__ */ X("div", {
|
|
1163
1163
|
ref: y,
|
|
1164
1164
|
style: {
|
|
1165
1165
|
flexShrink: 0,
|
|
@@ -1169,7 +1169,7 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1169
1169
|
flexDirection: "column",
|
|
1170
1170
|
height: `${h}px`
|
|
1171
1171
|
},
|
|
1172
|
-
children: [/* @__PURE__ */
|
|
1172
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
1173
1173
|
onMouseDown: O,
|
|
1174
1174
|
title: "Drag to resize",
|
|
1175
1175
|
style: {
|
|
@@ -1180,13 +1180,13 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1180
1180
|
justifyContent: "center",
|
|
1181
1181
|
flexShrink: 0
|
|
1182
1182
|
},
|
|
1183
|
-
children: /* @__PURE__ */
|
|
1183
|
+
children: /* @__PURE__ */ Y("div", { style: {
|
|
1184
1184
|
width: 56,
|
|
1185
1185
|
height: 3,
|
|
1186
1186
|
borderRadius: 999,
|
|
1187
1187
|
background: "var(--border)"
|
|
1188
1188
|
} })
|
|
1189
|
-
}), /* @__PURE__ */
|
|
1189
|
+
}), /* @__PURE__ */ X("form", {
|
|
1190
1190
|
onSubmit: f,
|
|
1191
1191
|
onKeyDown: (e) => {
|
|
1192
1192
|
(e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), e.currentTarget.requestSubmit());
|
|
@@ -1200,7 +1200,7 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1200
1200
|
padding: "0 12px 8px"
|
|
1201
1201
|
},
|
|
1202
1202
|
children: [
|
|
1203
|
-
A.length > 0 && /* @__PURE__ */
|
|
1203
|
+
A.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1204
1204
|
style: {
|
|
1205
1205
|
display: "flex",
|
|
1206
1206
|
flexWrap: "wrap",
|
|
@@ -1210,7 +1210,7 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1210
1210
|
},
|
|
1211
1211
|
children: A.map(M)
|
|
1212
1212
|
}),
|
|
1213
|
-
k &&
|
|
1213
|
+
k && c.fields.get(k) && /* @__PURE__ */ Y("div", {
|
|
1214
1214
|
style: {
|
|
1215
1215
|
flex: 1,
|
|
1216
1216
|
minHeight: 0,
|
|
@@ -1219,18 +1219,18 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1219
1219
|
ref: (e) => {
|
|
1220
1220
|
T.current[k] = e;
|
|
1221
1221
|
},
|
|
1222
|
-
children:
|
|
1223
|
-
field:
|
|
1222
|
+
children: w({
|
|
1223
|
+
field: c.fields.get(k),
|
|
1224
1224
|
fieldName: k,
|
|
1225
|
-
value:
|
|
1225
|
+
value: o[k] ?? "",
|
|
1226
1226
|
mode: "edit",
|
|
1227
1227
|
onChange: (e) => p(k, e),
|
|
1228
|
-
record:
|
|
1228
|
+
record: o,
|
|
1229
1229
|
fill: !0,
|
|
1230
1230
|
locale: m
|
|
1231
1231
|
})
|
|
1232
1232
|
}),
|
|
1233
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ X("div", {
|
|
1234
1234
|
style: {
|
|
1235
1235
|
display: "flex",
|
|
1236
1236
|
flexWrap: "wrap",
|
|
@@ -1238,39 +1238,39 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1238
1238
|
gap: 6,
|
|
1239
1239
|
flexShrink: 0
|
|
1240
1240
|
},
|
|
1241
|
-
children: [j.map(M), /* @__PURE__ */
|
|
1241
|
+
children: [j.map(M), /* @__PURE__ */ X("div", {
|
|
1242
1242
|
style: {
|
|
1243
1243
|
marginLeft: "auto",
|
|
1244
1244
|
display: "flex",
|
|
1245
1245
|
alignItems: "center",
|
|
1246
1246
|
gap: 8
|
|
1247
1247
|
},
|
|
1248
|
-
children: [/* @__PURE__ */
|
|
1248
|
+
children: [/* @__PURE__ */ X("span", {
|
|
1249
1249
|
style: {
|
|
1250
1250
|
fontSize: 10.5,
|
|
1251
1251
|
color: "var(--text-4)"
|
|
1252
1252
|
},
|
|
1253
1253
|
children: [
|
|
1254
|
-
/* @__PURE__ */
|
|
1254
|
+
/* @__PURE__ */ Y("span", {
|
|
1255
1255
|
className: "mono",
|
|
1256
1256
|
children: "⌘"
|
|
1257
1257
|
}),
|
|
1258
|
-
/* @__PURE__ */
|
|
1258
|
+
/* @__PURE__ */ Y("span", {
|
|
1259
1259
|
className: "mono",
|
|
1260
1260
|
children: "↵"
|
|
1261
1261
|
}),
|
|
1262
1262
|
" to add"
|
|
1263
1263
|
]
|
|
1264
|
-
}), /* @__PURE__ */
|
|
1264
|
+
}), /* @__PURE__ */ Y(a, {
|
|
1265
1265
|
type: "submit",
|
|
1266
1266
|
kind: "primary",
|
|
1267
|
-
icon: /* @__PURE__ */
|
|
1267
|
+
icon: /* @__PURE__ */ Y(e.plus, { size: 13 }),
|
|
1268
1268
|
disabled: l || !d,
|
|
1269
1269
|
children: "Add"
|
|
1270
1270
|
})]
|
|
1271
1271
|
})]
|
|
1272
1272
|
}),
|
|
1273
|
-
u != null && /* @__PURE__ */
|
|
1273
|
+
u != null && /* @__PURE__ */ Y("p", {
|
|
1274
1274
|
style: {
|
|
1275
1275
|
fontSize: 11,
|
|
1276
1276
|
color: "var(--danger)",
|
|
@@ -1289,63 +1289,63 @@ var tt = 80, nt = 200;
|
|
|
1289
1289
|
function rt(e, t) {
|
|
1290
1290
|
if (it(t)) {
|
|
1291
1291
|
let e = t.id;
|
|
1292
|
-
return e == null ? "" :
|
|
1292
|
+
return e == null ? "" : A(e);
|
|
1293
1293
|
}
|
|
1294
|
-
return
|
|
1294
|
+
return p(f(e, t));
|
|
1295
1295
|
}
|
|
1296
1296
|
function it(e) {
|
|
1297
1297
|
return e.__optimistic === !0;
|
|
1298
1298
|
}
|
|
1299
1299
|
function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1300
|
-
let i = r.entities[e.entity], { rows:
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
}, [n]),
|
|
1304
|
-
!
|
|
1305
|
-
scrollHeight:
|
|
1306
|
-
scrollTop:
|
|
1300
|
+
let i = r.entities[e.entity], { rows: o, refs: c, fetchNextPage: l, hasOlder: u, isFetchingOlder: d, isLoading: f, isError: p } = Je(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), m = e.timeline, h = m?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = G(() => g ? [...o].reverse() : o, [o, g]), v = m?.auto_scroll ?? "none", y = K(null), b = K(null), x = K(!1), S = K(0), w = K(null), T = K(null), E = K(!0), D = K(null);
|
|
1301
|
+
W(() => {
|
|
1302
|
+
x.current = !1, S.current = 0, w.current = null, T.current = null, E.current = !0, D.current = null;
|
|
1303
|
+
}, [n]), pe(() => {
|
|
1304
|
+
!d || !y.current || (D.current = {
|
|
1305
|
+
scrollHeight: y.current.scrollHeight,
|
|
1306
|
+
scrollTop: y.current.scrollTop
|
|
1307
1307
|
});
|
|
1308
|
-
}, [
|
|
1309
|
-
let e =
|
|
1310
|
-
if (!e ||
|
|
1311
|
-
|
|
1308
|
+
}, [d]), pe(() => {
|
|
1309
|
+
let e = y.current;
|
|
1310
|
+
if (!e || _.length === 0 || !i) {
|
|
1311
|
+
S.current = _.length;
|
|
1312
1312
|
return;
|
|
1313
1313
|
}
|
|
1314
|
-
let t = rt(i,
|
|
1315
|
-
if (r)
|
|
1314
|
+
let t = rt(i, _[0]), n = rt(i, _[_.length - 1]), r = !x.current, a = _.length > S.current && S.current > 0, o = a && (g && t !== w.current && n === T.current || !g && n !== T.current && t === w.current), s = a && !o;
|
|
1315
|
+
if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
|
|
1316
1316
|
else if (o && D.current) {
|
|
1317
1317
|
let t = D.current;
|
|
1318
|
-
|
|
1319
|
-
} else s &&
|
|
1320
|
-
|
|
1318
|
+
g && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), D.current = null;
|
|
1319
|
+
} else s && g && E.current && (e.scrollTop = e.scrollHeight);
|
|
1320
|
+
S.current = _.length, w.current = t, T.current = n;
|
|
1321
1321
|
}, [
|
|
1322
|
-
g,
|
|
1323
1322
|
_,
|
|
1324
|
-
|
|
1323
|
+
v,
|
|
1324
|
+
g,
|
|
1325
1325
|
i
|
|
1326
1326
|
]);
|
|
1327
|
-
let O =
|
|
1328
|
-
let e =
|
|
1327
|
+
let O = U(() => {
|
|
1328
|
+
let e = y.current;
|
|
1329
1329
|
e && (E.current = e.scrollHeight - e.scrollTop - e.clientHeight < tt);
|
|
1330
1330
|
}, []);
|
|
1331
|
-
|
|
1332
|
-
let e =
|
|
1331
|
+
W(() => {
|
|
1332
|
+
let e = b.current;
|
|
1333
1333
|
if (!e || typeof IntersectionObserver > "u") return;
|
|
1334
1334
|
let t = new IntersectionObserver((e) => {
|
|
1335
|
-
for (let t of e) t.isIntersecting &&
|
|
1335
|
+
for (let t of e) t.isIntersecting && u && !d && l();
|
|
1336
1336
|
}, {
|
|
1337
|
-
root:
|
|
1337
|
+
root: y.current ?? null,
|
|
1338
1338
|
rootMargin: `${nt}px 0px 0px 0px`,
|
|
1339
1339
|
threshold: 0
|
|
1340
1340
|
});
|
|
1341
1341
|
return t.observe(e), () => t.disconnect();
|
|
1342
1342
|
}, [
|
|
1343
|
-
l,
|
|
1344
1343
|
u,
|
|
1345
|
-
|
|
1344
|
+
d,
|
|
1345
|
+
l
|
|
1346
1346
|
]);
|
|
1347
|
-
let [k, A] =
|
|
1348
|
-
if (!i) return /* @__PURE__ */
|
|
1347
|
+
let [k, A] = q(null);
|
|
1348
|
+
if (!i) return /* @__PURE__ */ Y("div", {
|
|
1349
1349
|
style: {
|
|
1350
1350
|
fontSize: 12.5,
|
|
1351
1351
|
color: "var(--text-3)",
|
|
@@ -1353,25 +1353,25 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1353
1353
|
},
|
|
1354
1354
|
children: "Entity not found."
|
|
1355
1355
|
});
|
|
1356
|
-
let j = e.quick_add?.fields ?? [
|
|
1356
|
+
let j = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), M = C(i.display?.name_plural) || C(i.display?.name) || e.entity, ee = u ? /* @__PURE__ */ Y("div", {
|
|
1357
1357
|
style: {
|
|
1358
1358
|
display: "flex",
|
|
1359
1359
|
justifyContent: "center",
|
|
1360
1360
|
padding: "6px 0"
|
|
1361
1361
|
},
|
|
1362
|
-
children: /* @__PURE__ */
|
|
1362
|
+
children: /* @__PURE__ */ Y(a, {
|
|
1363
1363
|
size: "xs",
|
|
1364
|
-
onClick: () =>
|
|
1365
|
-
disabled:
|
|
1366
|
-
icon:
|
|
1367
|
-
children:
|
|
1364
|
+
onClick: () => l(),
|
|
1365
|
+
disabled: d,
|
|
1366
|
+
icon: d ? /* @__PURE__ */ Y(s, { size: 11 }) : void 0,
|
|
1367
|
+
children: d ? "Loading…" : "Load older"
|
|
1368
1368
|
})
|
|
1369
|
-
}) : null,
|
|
1370
|
-
ref:
|
|
1369
|
+
}) : null, N = /* @__PURE__ */ Y("div", {
|
|
1370
|
+
ref: b,
|
|
1371
1371
|
"aria-hidden": "true",
|
|
1372
1372
|
style: { height: 1 }
|
|
1373
1373
|
}), P;
|
|
1374
|
-
if (
|
|
1374
|
+
if (p) P = /* @__PURE__ */ Y("div", {
|
|
1375
1375
|
style: {
|
|
1376
1376
|
fontSize: 12.5,
|
|
1377
1377
|
color: "var(--danger)",
|
|
@@ -1379,24 +1379,24 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1379
1379
|
},
|
|
1380
1380
|
children: "Failed to load."
|
|
1381
1381
|
});
|
|
1382
|
-
else if (
|
|
1382
|
+
else if (f) P = /* @__PURE__ */ X("div", {
|
|
1383
1383
|
style: {
|
|
1384
1384
|
display: "flex",
|
|
1385
1385
|
flexDirection: "column",
|
|
1386
1386
|
gap: 8,
|
|
1387
1387
|
padding: 12
|
|
1388
1388
|
},
|
|
1389
|
-
children: [/* @__PURE__ */
|
|
1389
|
+
children: [/* @__PURE__ */ Y("div", { style: {
|
|
1390
1390
|
height: 64,
|
|
1391
1391
|
background: "var(--surface-3)",
|
|
1392
1392
|
borderRadius: 8
|
|
1393
|
-
} }), /* @__PURE__ */
|
|
1393
|
+
} }), /* @__PURE__ */ Y("div", { style: {
|
|
1394
1394
|
height: 64,
|
|
1395
1395
|
background: "var(--surface-3)",
|
|
1396
1396
|
borderRadius: 8
|
|
1397
1397
|
} })]
|
|
1398
1398
|
});
|
|
1399
|
-
else if (
|
|
1399
|
+
else if (_.length === 0) P = /* @__PURE__ */ X(J, { children: [N, /* @__PURE__ */ Y("div", {
|
|
1400
1400
|
style: {
|
|
1401
1401
|
fontSize: 12.5,
|
|
1402
1402
|
color: "var(--text-3)",
|
|
@@ -1405,30 +1405,30 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1405
1405
|
children: "No activity yet."
|
|
1406
1406
|
})] });
|
|
1407
1407
|
else {
|
|
1408
|
-
let a = (a,
|
|
1409
|
-
let
|
|
1410
|
-
return /* @__PURE__ */
|
|
1408
|
+
let a = (a, o) => {
|
|
1409
|
+
let s = rt(i, a) || String(o);
|
|
1410
|
+
return /* @__PURE__ */ Y(ot, {
|
|
1411
1411
|
row: a,
|
|
1412
|
-
rowId:
|
|
1412
|
+
rowId: s,
|
|
1413
1413
|
childEntity: i,
|
|
1414
1414
|
entityCode: e.entity,
|
|
1415
1415
|
parentEntity: t,
|
|
1416
1416
|
parentId: n,
|
|
1417
|
-
timeline:
|
|
1417
|
+
timeline: m,
|
|
1418
1418
|
editableFields: j,
|
|
1419
|
-
refs:
|
|
1420
|
-
isEditing: k ===
|
|
1421
|
-
onStartEdit: () => A(
|
|
1419
|
+
refs: c,
|
|
1420
|
+
isEditing: k === s,
|
|
1421
|
+
onStartEdit: () => A(s),
|
|
1422
1422
|
onCancelEdit: () => A(null),
|
|
1423
1423
|
onSaved: () => A(null),
|
|
1424
1424
|
schema: r,
|
|
1425
1425
|
optimistic: it(a)
|
|
1426
|
-
},
|
|
1427
|
-
},
|
|
1428
|
-
if (
|
|
1426
|
+
}, s);
|
|
1427
|
+
}, o = m?.time_field, s;
|
|
1428
|
+
if (o) {
|
|
1429
1429
|
let e = [];
|
|
1430
|
-
|
|
1431
|
-
let r = t[
|
|
1430
|
+
_.forEach((t, n) => {
|
|
1431
|
+
let r = t[o], i = st(r), a = e[e.length - 1];
|
|
1432
1432
|
!a || a.key !== i ? e.push({
|
|
1433
1433
|
key: i,
|
|
1434
1434
|
label: ct(r),
|
|
@@ -1440,25 +1440,25 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1440
1440
|
row: t,
|
|
1441
1441
|
idx: n
|
|
1442
1442
|
});
|
|
1443
|
-
}),
|
|
1443
|
+
}), s = e.map((e) => /* @__PURE__ */ X("div", {
|
|
1444
1444
|
style: {
|
|
1445
1445
|
display: "flex",
|
|
1446
1446
|
flexDirection: "column",
|
|
1447
1447
|
gap: 8
|
|
1448
1448
|
},
|
|
1449
|
-
children: [/* @__PURE__ */
|
|
1449
|
+
children: [/* @__PURE__ */ Y(lt, {
|
|
1450
1450
|
label: e.label,
|
|
1451
1451
|
count: e.rows.length
|
|
1452
1452
|
}), e.rows.map(({ row: e, idx: t }) => a(e, t))]
|
|
1453
1453
|
}, `day-${e.key}`));
|
|
1454
|
-
} else
|
|
1455
|
-
P = /* @__PURE__ */
|
|
1456
|
-
ee,
|
|
1454
|
+
} else s = _.map((e, t) => a(e, t));
|
|
1455
|
+
P = /* @__PURE__ */ X(J, { children: [
|
|
1457
1456
|
N,
|
|
1458
|
-
|
|
1457
|
+
ee,
|
|
1458
|
+
s
|
|
1459
1459
|
] });
|
|
1460
1460
|
}
|
|
1461
|
-
return
|
|
1461
|
+
return h ? /* @__PURE__ */ X("div", {
|
|
1462
1462
|
style: {
|
|
1463
1463
|
display: "flex",
|
|
1464
1464
|
flexDirection: "column",
|
|
@@ -1468,13 +1468,13 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1468
1468
|
color: "var(--text)"
|
|
1469
1469
|
},
|
|
1470
1470
|
children: [
|
|
1471
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ Y("div", {
|
|
1472
1472
|
style: {
|
|
1473
1473
|
padding: "10px 16px",
|
|
1474
1474
|
borderBottom: "1px solid var(--divider)",
|
|
1475
1475
|
background: "var(--surface)"
|
|
1476
1476
|
},
|
|
1477
|
-
children: /* @__PURE__ */
|
|
1477
|
+
children: /* @__PURE__ */ Y("h3", {
|
|
1478
1478
|
style: {
|
|
1479
1479
|
margin: 0,
|
|
1480
1480
|
fontSize: 12.5,
|
|
@@ -1483,8 +1483,8 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1483
1483
|
children: M
|
|
1484
1484
|
})
|
|
1485
1485
|
}),
|
|
1486
|
-
/* @__PURE__ */
|
|
1487
|
-
ref:
|
|
1486
|
+
/* @__PURE__ */ Y("div", {
|
|
1487
|
+
ref: y,
|
|
1488
1488
|
onScroll: O,
|
|
1489
1489
|
style: {
|
|
1490
1490
|
flex: 1,
|
|
@@ -1496,73 +1496,73 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1496
1496
|
},
|
|
1497
1497
|
children: P
|
|
1498
1498
|
}),
|
|
1499
|
-
/* @__PURE__ */
|
|
1499
|
+
/* @__PURE__ */ Y(et, {
|
|
1500
1500
|
config: e,
|
|
1501
1501
|
parentEntity: t,
|
|
1502
1502
|
parentId: n,
|
|
1503
1503
|
schema: r
|
|
1504
1504
|
})
|
|
1505
1505
|
]
|
|
1506
|
-
}) : /* @__PURE__ */
|
|
1506
|
+
}) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
1507
1507
|
style: {
|
|
1508
1508
|
display: "flex",
|
|
1509
1509
|
flexDirection: "column",
|
|
1510
1510
|
gap: 8
|
|
1511
1511
|
},
|
|
1512
1512
|
children: P
|
|
1513
|
-
}), /* @__PURE__ */
|
|
1513
|
+
}), /* @__PURE__ */ Y(et, {
|
|
1514
1514
|
config: e,
|
|
1515
1515
|
parentEntity: t,
|
|
1516
1516
|
parentId: n,
|
|
1517
1517
|
schema: r
|
|
1518
1518
|
})] });
|
|
1519
1519
|
}
|
|
1520
|
-
function ot({ row: t, rowId:
|
|
1521
|
-
let
|
|
1522
|
-
|
|
1520
|
+
function ot({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o, parentId: c, timeline: f, editableFields: p, refs: m, isEditing: h, onStartEdit: g, onCancelEdit: _, onSaved: v, schema: b, optimistic: S = !1 }) {
|
|
1521
|
+
let C = ge(), T = D(), [O, k] = q({}), A = U(() => {
|
|
1522
|
+
C.invalidateQueries({ queryKey: [
|
|
1523
1523
|
M,
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1524
|
+
o,
|
|
1525
|
+
c,
|
|
1526
|
+
i
|
|
1527
1527
|
] });
|
|
1528
1528
|
}, [
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
]), j =
|
|
1529
|
+
C,
|
|
1530
|
+
o,
|
|
1531
|
+
c,
|
|
1532
|
+
i
|
|
1533
|
+
]), j = he({
|
|
1534
1534
|
mutationFn: (e) => {
|
|
1535
|
-
let
|
|
1536
|
-
return
|
|
1535
|
+
let r = t.$row_version;
|
|
1536
|
+
return y(i, n, typeof r == "string" && r !== "" ? {
|
|
1537
1537
|
...e,
|
|
1538
|
-
$row_version:
|
|
1538
|
+
$row_version: r
|
|
1539
1539
|
} : e);
|
|
1540
1540
|
},
|
|
1541
1541
|
onSuccess: () => {
|
|
1542
|
-
A(),
|
|
1542
|
+
A(), u.success("Updated"), v();
|
|
1543
1543
|
},
|
|
1544
|
-
onError: (e) =>
|
|
1545
|
-
}),
|
|
1546
|
-
mutationFn: () =>
|
|
1544
|
+
onError: (e) => u.error(e.message)
|
|
1545
|
+
}), ee = he({
|
|
1546
|
+
mutationFn: () => x(i, n),
|
|
1547
1547
|
onSuccess: () => {
|
|
1548
|
-
A(),
|
|
1548
|
+
A(), u.success("Deleted");
|
|
1549
1549
|
},
|
|
1550
|
-
onError: (e) =>
|
|
1551
|
-
}),
|
|
1550
|
+
onError: (e) => u.error(e.message)
|
|
1551
|
+
}), N = U(() => {
|
|
1552
1552
|
let e = {};
|
|
1553
|
-
for (let n of
|
|
1554
|
-
k(e),
|
|
1553
|
+
for (let n of p) e[n] = t[n] ?? "";
|
|
1554
|
+
k(e), g();
|
|
1555
1555
|
}, [
|
|
1556
1556
|
t,
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
]), P =
|
|
1557
|
+
p,
|
|
1558
|
+
g
|
|
1559
|
+
]), P = U((e, t) => {
|
|
1560
1560
|
k((n) => ({
|
|
1561
1561
|
...n,
|
|
1562
1562
|
[e]: t
|
|
1563
1563
|
}));
|
|
1564
|
-
}, []), F =
|
|
1565
|
-
return
|
|
1564
|
+
}, []), F = f?.time_field, I = f?.type_field, L = f?.summary_field, R = f?.content_field, z = f?.author_field, B = f?.direction_field, V = f?.intent_field;
|
|
1565
|
+
return h ? /* @__PURE__ */ X("div", {
|
|
1566
1566
|
style: {
|
|
1567
1567
|
borderRadius: 10,
|
|
1568
1568
|
border: "1px solid var(--accent)",
|
|
@@ -1572,17 +1572,17 @@ function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s,
|
|
|
1572
1572
|
flexDirection: "column",
|
|
1573
1573
|
gap: 8
|
|
1574
1574
|
},
|
|
1575
|
-
children: [
|
|
1576
|
-
let t =
|
|
1577
|
-
return t ? /* @__PURE__ */
|
|
1575
|
+
children: [p.map((e) => {
|
|
1576
|
+
let t = r.fields.get(e);
|
|
1577
|
+
return t ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("label", {
|
|
1578
1578
|
style: {
|
|
1579
1579
|
fontSize: 11,
|
|
1580
1580
|
color: "var(--text-3)",
|
|
1581
1581
|
marginBottom: 4,
|
|
1582
1582
|
display: "block"
|
|
1583
1583
|
},
|
|
1584
|
-
children:
|
|
1585
|
-
}),
|
|
1584
|
+
children: E(t, e, b.entities)
|
|
1585
|
+
}), w({
|
|
1586
1586
|
field: t,
|
|
1587
1587
|
fieldName: e,
|
|
1588
1588
|
value: O[e] ?? "",
|
|
@@ -1591,45 +1591,45 @@ function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s,
|
|
|
1591
1591
|
record: O,
|
|
1592
1592
|
locale: T
|
|
1593
1593
|
})] }, e) : null;
|
|
1594
|
-
}), /* @__PURE__ */
|
|
1594
|
+
}), /* @__PURE__ */ X("div", {
|
|
1595
1595
|
style: {
|
|
1596
1596
|
display: "flex",
|
|
1597
1597
|
alignItems: "center",
|
|
1598
1598
|
gap: 6,
|
|
1599
1599
|
paddingTop: 4
|
|
1600
1600
|
},
|
|
1601
|
-
children: [/* @__PURE__ */
|
|
1601
|
+
children: [/* @__PURE__ */ Y(a, {
|
|
1602
1602
|
kind: "primary",
|
|
1603
1603
|
size: "xs",
|
|
1604
|
-
icon: j.isPending ? /* @__PURE__ */
|
|
1604
|
+
icon: j.isPending ? /* @__PURE__ */ Y(s, { size: 12 }) : /* @__PURE__ */ Y(e.check, { size: 12 }),
|
|
1605
1605
|
onClick: () => j.mutate(O),
|
|
1606
1606
|
disabled: j.isPending,
|
|
1607
1607
|
children: j.isPending ? "Saving…" : "Save"
|
|
1608
|
-
}), /* @__PURE__ */
|
|
1608
|
+
}), /* @__PURE__ */ Y(a, {
|
|
1609
1609
|
size: "xs",
|
|
1610
|
-
icon: /* @__PURE__ */
|
|
1610
|
+
icon: /* @__PURE__ */ Y(e.x, { size: 12 }),
|
|
1611
1611
|
onClick: () => {
|
|
1612
|
-
k({}),
|
|
1612
|
+
k({}), _();
|
|
1613
1613
|
},
|
|
1614
1614
|
disabled: j.isPending,
|
|
1615
1615
|
children: "Cancel"
|
|
1616
1616
|
})]
|
|
1617
1617
|
})]
|
|
1618
|
-
}) : /* @__PURE__ */
|
|
1618
|
+
}) : /* @__PURE__ */ X("div", {
|
|
1619
1619
|
className: "group",
|
|
1620
|
-
"data-optimistic":
|
|
1620
|
+
"data-optimistic": S || void 0,
|
|
1621
1621
|
style: {
|
|
1622
1622
|
borderRadius: 10,
|
|
1623
1623
|
border: "1px solid var(--border)",
|
|
1624
1624
|
background: "var(--surface)",
|
|
1625
1625
|
padding: 12,
|
|
1626
1626
|
transition: "border-color .12s",
|
|
1627
|
-
opacity:
|
|
1627
|
+
opacity: S ? .6 : 1
|
|
1628
1628
|
},
|
|
1629
1629
|
onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
|
|
1630
1630
|
onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
|
|
1631
1631
|
children: [
|
|
1632
|
-
/* @__PURE__ */
|
|
1632
|
+
/* @__PURE__ */ X("div", {
|
|
1633
1633
|
style: {
|
|
1634
1634
|
display: "flex",
|
|
1635
1635
|
alignItems: "center",
|
|
@@ -1639,111 +1639,111 @@ function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s,
|
|
|
1639
1639
|
color: "var(--text-3)"
|
|
1640
1640
|
},
|
|
1641
1641
|
children: [
|
|
1642
|
-
F && t[F] != null &&
|
|
1642
|
+
F && t[F] != null && r.fields.get(F) && /* @__PURE__ */ Y("span", {
|
|
1643
1643
|
style: { fontWeight: 500 },
|
|
1644
|
-
children:
|
|
1645
|
-
field:
|
|
1644
|
+
children: w({
|
|
1645
|
+
field: r.fields.get(F),
|
|
1646
1646
|
fieldName: F,
|
|
1647
1647
|
value: t[F],
|
|
1648
1648
|
mode: "display",
|
|
1649
1649
|
record: t,
|
|
1650
|
-
refs:
|
|
1650
|
+
refs: m,
|
|
1651
1651
|
locale: T
|
|
1652
1652
|
})
|
|
1653
1653
|
}),
|
|
1654
|
-
I && t[I] != null &&
|
|
1654
|
+
I && t[I] != null && r.fields.get(I) && /* @__PURE__ */ Y(l, {
|
|
1655
1655
|
tone: "slate",
|
|
1656
1656
|
size: "xs",
|
|
1657
|
-
children:
|
|
1658
|
-
field:
|
|
1657
|
+
children: w({
|
|
1658
|
+
field: r.fields.get(I),
|
|
1659
1659
|
fieldName: I,
|
|
1660
1660
|
value: t[I],
|
|
1661
1661
|
mode: "display",
|
|
1662
1662
|
record: t,
|
|
1663
|
-
refs:
|
|
1663
|
+
refs: m,
|
|
1664
1664
|
locale: T
|
|
1665
1665
|
})
|
|
1666
1666
|
}),
|
|
1667
|
-
B && t[B] != null &&
|
|
1667
|
+
B && t[B] != null && r.fields.get(B) && /* @__PURE__ */ Y(ut, {
|
|
1668
1668
|
value: t[B],
|
|
1669
|
-
field:
|
|
1669
|
+
field: r.fields.get(B)
|
|
1670
1670
|
}),
|
|
1671
|
-
V && t[V] != null &&
|
|
1671
|
+
V && t[V] != null && r.fields.get(V) && /* @__PURE__ */ Y(l, {
|
|
1672
1672
|
tone: "slate",
|
|
1673
1673
|
size: "xs",
|
|
1674
|
-
children:
|
|
1675
|
-
field:
|
|
1674
|
+
children: w({
|
|
1675
|
+
field: r.fields.get(V),
|
|
1676
1676
|
fieldName: V,
|
|
1677
1677
|
value: t[V],
|
|
1678
1678
|
mode: "display",
|
|
1679
1679
|
record: t,
|
|
1680
|
-
refs:
|
|
1680
|
+
refs: m,
|
|
1681
1681
|
locale: T
|
|
1682
1682
|
})
|
|
1683
1683
|
}),
|
|
1684
|
-
z && t[z] != null &&
|
|
1684
|
+
z && t[z] != null && r.fields.get(z) && /* @__PURE__ */ X("span", { children: [
|
|
1685
1685
|
"by",
|
|
1686
1686
|
" ",
|
|
1687
|
-
|
|
1688
|
-
field:
|
|
1687
|
+
w({
|
|
1688
|
+
field: r.fields.get(z),
|
|
1689
1689
|
fieldName: z,
|
|
1690
1690
|
value: t[z],
|
|
1691
1691
|
mode: "display",
|
|
1692
1692
|
record: t,
|
|
1693
|
-
refs:
|
|
1693
|
+
refs: m,
|
|
1694
1694
|
locale: T
|
|
1695
1695
|
})
|
|
1696
1696
|
] }),
|
|
1697
|
-
!
|
|
1697
|
+
!S && /* @__PURE__ */ X("div", {
|
|
1698
1698
|
style: {
|
|
1699
1699
|
marginLeft: "auto",
|
|
1700
1700
|
display: "flex",
|
|
1701
1701
|
alignItems: "center",
|
|
1702
1702
|
gap: 2
|
|
1703
1703
|
},
|
|
1704
|
-
children: [/* @__PURE__ */
|
|
1704
|
+
children: [/* @__PURE__ */ Y(d, {
|
|
1705
1705
|
size: 22,
|
|
1706
|
-
icon: /* @__PURE__ */
|
|
1707
|
-
onClick:
|
|
1706
|
+
icon: /* @__PURE__ */ Y(e.edit, { size: 11 }),
|
|
1707
|
+
onClick: N,
|
|
1708
1708
|
title: "Edit"
|
|
1709
|
-
}), /* @__PURE__ */
|
|
1709
|
+
}), /* @__PURE__ */ Y(d, {
|
|
1710
1710
|
size: 22,
|
|
1711
|
-
icon: /* @__PURE__ */
|
|
1712
|
-
onClick: () =>
|
|
1711
|
+
icon: /* @__PURE__ */ Y(e.trash, { size: 11 }),
|
|
1712
|
+
onClick: () => ee.mutate(),
|
|
1713
1713
|
title: "Delete"
|
|
1714
1714
|
})]
|
|
1715
1715
|
})
|
|
1716
1716
|
]
|
|
1717
1717
|
}),
|
|
1718
|
-
L && t[L] != null &&
|
|
1718
|
+
L && t[L] != null && r.fields.get(L) && /* @__PURE__ */ Y("div", {
|
|
1719
1719
|
style: {
|
|
1720
1720
|
fontSize: 12.5,
|
|
1721
1721
|
fontWeight: 500,
|
|
1722
1722
|
marginTop: 6
|
|
1723
1723
|
},
|
|
1724
|
-
children:
|
|
1725
|
-
field:
|
|
1724
|
+
children: w({
|
|
1725
|
+
field: r.fields.get(L),
|
|
1726
1726
|
fieldName: L,
|
|
1727
1727
|
value: t[L],
|
|
1728
1728
|
mode: "display",
|
|
1729
1729
|
record: t,
|
|
1730
|
-
refs:
|
|
1730
|
+
refs: m,
|
|
1731
1731
|
locale: T
|
|
1732
1732
|
})
|
|
1733
1733
|
}),
|
|
1734
|
-
R && t[R] != null && R !== L &&
|
|
1734
|
+
R && t[R] != null && R !== L && r.fields.get(R) && /* @__PURE__ */ Y("div", {
|
|
1735
1735
|
style: {
|
|
1736
1736
|
fontSize: 12.5,
|
|
1737
1737
|
fontWeight: 400,
|
|
1738
1738
|
marginTop: 6
|
|
1739
1739
|
},
|
|
1740
|
-
children:
|
|
1741
|
-
field:
|
|
1740
|
+
children: w({
|
|
1741
|
+
field: r.fields.get(R),
|
|
1742
1742
|
fieldName: R,
|
|
1743
1743
|
value: t[R],
|
|
1744
1744
|
mode: "display",
|
|
1745
1745
|
record: t,
|
|
1746
|
-
refs:
|
|
1746
|
+
refs: m,
|
|
1747
1747
|
locale: T
|
|
1748
1748
|
})
|
|
1749
1749
|
})
|
|
@@ -1752,12 +1752,12 @@ function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s,
|
|
|
1752
1752
|
}
|
|
1753
1753
|
function st(e) {
|
|
1754
1754
|
if (e == null) return "";
|
|
1755
|
-
let t = new Date(
|
|
1755
|
+
let t = new Date(A(e));
|
|
1756
1756
|
return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
|
|
1757
1757
|
}
|
|
1758
1758
|
function ct(e) {
|
|
1759
1759
|
if (e == null) return "—";
|
|
1760
|
-
let t = new Date(
|
|
1760
|
+
let t = new Date(A(e));
|
|
1761
1761
|
if (Number.isNaN(t.getTime())) return "—";
|
|
1762
1762
|
let n = /* @__PURE__ */ new Date(), r = /* @__PURE__ */ new Date();
|
|
1763
1763
|
r.setDate(n.getDate() - 1);
|
|
@@ -1769,7 +1769,7 @@ function ct(e) {
|
|
|
1769
1769
|
});
|
|
1770
1770
|
}
|
|
1771
1771
|
function lt({ label: e, count: t }) {
|
|
1772
|
-
return /* @__PURE__ */
|
|
1772
|
+
return /* @__PURE__ */ X("div", {
|
|
1773
1773
|
style: {
|
|
1774
1774
|
position: "sticky",
|
|
1775
1775
|
top: -4,
|
|
@@ -1781,7 +1781,7 @@ function lt({ label: e, count: t }) {
|
|
|
1781
1781
|
background: "linear-gradient(180deg, var(--surface-2) 0%, var(--surface-2) 65%, transparent 100%)"
|
|
1782
1782
|
},
|
|
1783
1783
|
children: [
|
|
1784
|
-
/* @__PURE__ */
|
|
1784
|
+
/* @__PURE__ */ Y("span", {
|
|
1785
1785
|
style: {
|
|
1786
1786
|
fontSize: 11,
|
|
1787
1787
|
fontWeight: 600,
|
|
@@ -1789,12 +1789,12 @@ function lt({ label: e, count: t }) {
|
|
|
1789
1789
|
},
|
|
1790
1790
|
children: e
|
|
1791
1791
|
}),
|
|
1792
|
-
/* @__PURE__ */
|
|
1792
|
+
/* @__PURE__ */ Y("span", { style: {
|
|
1793
1793
|
flex: 1,
|
|
1794
1794
|
height: 1,
|
|
1795
1795
|
background: "var(--divider)"
|
|
1796
1796
|
} }),
|
|
1797
|
-
/* @__PURE__ */
|
|
1797
|
+
/* @__PURE__ */ Y("span", {
|
|
1798
1798
|
className: "num",
|
|
1799
1799
|
style: {
|
|
1800
1800
|
fontSize: 10.5,
|
|
@@ -1807,7 +1807,7 @@ function lt({ label: e, count: t }) {
|
|
|
1807
1807
|
}
|
|
1808
1808
|
function ut({ value: t, field: n }) {
|
|
1809
1809
|
let r = dt(t, n);
|
|
1810
|
-
return r === null ? null : /* @__PURE__ */
|
|
1810
|
+
return r === null ? null : /* @__PURE__ */ X("span", {
|
|
1811
1811
|
style: {
|
|
1812
1812
|
display: "inline-flex",
|
|
1813
1813
|
alignItems: "center",
|
|
@@ -1819,7 +1819,7 @@ function ut({ value: t, field: n }) {
|
|
|
1819
1819
|
background: r ? "var(--accent-soft)" : "var(--info-soft)",
|
|
1820
1820
|
color: r ? "var(--accent)" : "var(--info)"
|
|
1821
1821
|
},
|
|
1822
|
-
children: [
|
|
1822
|
+
children: [Y(r ? e.arrowUp : e.arrowDown, { size: 10 }), r ? "Out" : "In"]
|
|
1823
1823
|
});
|
|
1824
1824
|
}
|
|
1825
1825
|
function dt(e, t) {
|
|
@@ -1833,8 +1833,8 @@ function dt(e, t) {
|
|
|
1833
1833
|
}
|
|
1834
1834
|
//#endregion
|
|
1835
1835
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
1836
|
-
function ft({ config: t, childEntity: n, schema: r, rows: i, onChange:
|
|
1837
|
-
let
|
|
1836
|
+
function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, validationErrors: s, refs: l, forceTablePresentation: u = !1 }) {
|
|
1837
|
+
let f = D(), p = c(), m = K(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) => {
|
|
1838
1838
|
if (_.has(e) || t.position_field && e === t.position_field) return !1;
|
|
1839
1839
|
let r = n.fields.get(e);
|
|
1840
1840
|
return !(!r || r.auto || r.primary || r.source);
|
|
@@ -1842,13 +1842,13 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
1842
1842
|
if (t.position_field && e === t.position_field) return !0;
|
|
1843
1843
|
let r = n.fields.get(e);
|
|
1844
1844
|
return r && (r.auto || r.primary || r.source);
|
|
1845
|
-
})),
|
|
1846
|
-
|
|
1845
|
+
})), b = U((e, t, n) => {
|
|
1846
|
+
o(i.map((r) => r._key === e ? {
|
|
1847
1847
|
...r,
|
|
1848
1848
|
[t]: n,
|
|
1849
1849
|
_dirty: !0
|
|
1850
1850
|
} : r));
|
|
1851
|
-
}, [i,
|
|
1851
|
+
}, [i, o]), x = U(() => {
|
|
1852
1852
|
let e = {
|
|
1853
1853
|
_key: crypto.randomUUID(),
|
|
1854
1854
|
_dirty: !0
|
|
@@ -1862,39 +1862,39 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
1862
1862
|
let i = n.fields.get(t);
|
|
1863
1863
|
i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
|
|
1864
1864
|
}
|
|
1865
|
-
|
|
1865
|
+
o([...i, e]);
|
|
1866
1866
|
}, [
|
|
1867
1867
|
i,
|
|
1868
|
-
|
|
1868
|
+
o,
|
|
1869
1869
|
v,
|
|
1870
1870
|
n,
|
|
1871
1871
|
t.quick_add?.defaults,
|
|
1872
1872
|
g
|
|
1873
|
-
]),
|
|
1874
|
-
|
|
1873
|
+
]), S = U((e) => {
|
|
1874
|
+
o(i.map((t) => t._key === e ? {
|
|
1875
1875
|
...t,
|
|
1876
1876
|
_deleted: !0
|
|
1877
1877
|
} : t));
|
|
1878
|
-
}, [i,
|
|
1879
|
-
|
|
1878
|
+
}, [i, o]), C = U((e) => {
|
|
1879
|
+
o(i.map((t) => t._key === e ? {
|
|
1880
1880
|
...t,
|
|
1881
1881
|
_deleted: !1
|
|
1882
1882
|
} : t));
|
|
1883
|
-
}, [i,
|
|
1883
|
+
}, [i, o]), T = U((e, t) => {
|
|
1884
1884
|
if (!g) return;
|
|
1885
|
-
let n = i.filter((e) => !e._deleted), r = i.filter((e) => e._deleted),
|
|
1886
|
-
if (
|
|
1887
|
-
let c = [...n], [l] = c.splice(
|
|
1888
|
-
c.splice(s, 0, l),
|
|
1885
|
+
let n = i.filter((e) => !e._deleted), r = i.filter((e) => e._deleted), a = n.findIndex((t) => t._key === e), s = a + t;
|
|
1886
|
+
if (a < 0 || s < 0 || s >= n.length) return;
|
|
1887
|
+
let c = [...n], [l] = c.splice(a, 1);
|
|
1888
|
+
c.splice(s, 0, l), o([...c.map((e, t) => ({
|
|
1889
1889
|
...e,
|
|
1890
1890
|
[g]: t,
|
|
1891
1891
|
_dirty: e[g] === t ? e._dirty : !0
|
|
1892
1892
|
})), ...r]);
|
|
1893
1893
|
}, [
|
|
1894
1894
|
i,
|
|
1895
|
-
|
|
1895
|
+
o,
|
|
1896
1896
|
g
|
|
1897
|
-
]),
|
|
1897
|
+
]), O = U((e) => {
|
|
1898
1898
|
let t = e.target, n = t.closest("td");
|
|
1899
1899
|
if (!n) return;
|
|
1900
1900
|
let r = n.closest("tr");
|
|
@@ -1918,7 +1918,7 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
1918
1918
|
if (o < t.length - 1) {
|
|
1919
1919
|
let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
|
|
1920
1920
|
e && e.focus();
|
|
1921
|
-
} else
|
|
1921
|
+
} else x(), requestAnimationFrame(() => {
|
|
1922
1922
|
let e = i.querySelectorAll("tr"), t = e[e.length - 1];
|
|
1923
1923
|
if (t) {
|
|
1924
1924
|
let e = t.querySelector("input, select, textarea, [tabindex]");
|
|
@@ -1926,16 +1926,16 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
1926
1926
|
}
|
|
1927
1927
|
});
|
|
1928
1928
|
} else e.key === "Escape" && t.blur?.();
|
|
1929
|
-
}, [
|
|
1930
|
-
return
|
|
1929
|
+
}, [x]), k = oe;
|
|
1930
|
+
return p.isPhone && !u ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
1931
1931
|
style: {
|
|
1932
1932
|
display: "flex",
|
|
1933
1933
|
flexDirection: "column",
|
|
1934
1934
|
gap: 10
|
|
1935
1935
|
},
|
|
1936
1936
|
children: i.map((t, a) => {
|
|
1937
|
-
let o = !!t._deleted, c = s?.[t._key], u = g ? i.filter((e) => !e._deleted) : [],
|
|
1938
|
-
return /* @__PURE__ */
|
|
1937
|
+
let o = !!t._deleted, c = s?.[t._key], u = g ? i.filter((e) => !e._deleted) : [], p = g ? u.findIndex((e) => e._key === t._key) : -1;
|
|
1938
|
+
return /* @__PURE__ */ X("div", {
|
|
1939
1939
|
style: {
|
|
1940
1940
|
border: "1px solid var(--border)",
|
|
1941
1941
|
borderRadius: 8,
|
|
@@ -1943,7 +1943,7 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
1943
1943
|
opacity: o ? .58 : 1,
|
|
1944
1944
|
overflow: "hidden"
|
|
1945
1945
|
},
|
|
1946
|
-
children: [/* @__PURE__ */
|
|
1946
|
+
children: [/* @__PURE__ */ X("div", {
|
|
1947
1947
|
style: {
|
|
1948
1948
|
minHeight: 38,
|
|
1949
1949
|
padding: "8px 10px",
|
|
@@ -1953,44 +1953,44 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
1953
1953
|
justifyContent: "space-between",
|
|
1954
1954
|
gap: 8
|
|
1955
1955
|
},
|
|
1956
|
-
children: [/* @__PURE__ */
|
|
1956
|
+
children: [/* @__PURE__ */ X("div", {
|
|
1957
1957
|
style: {
|
|
1958
1958
|
fontSize: 12,
|
|
1959
1959
|
fontWeight: 600,
|
|
1960
1960
|
color: "var(--text-2)"
|
|
1961
1961
|
},
|
|
1962
1962
|
children: ["Row ", a + 1]
|
|
1963
|
-
}), /* @__PURE__ */
|
|
1963
|
+
}), /* @__PURE__ */ X("div", {
|
|
1964
1964
|
style: {
|
|
1965
1965
|
display: "flex",
|
|
1966
1966
|
alignItems: "center",
|
|
1967
1967
|
gap: 4
|
|
1968
1968
|
},
|
|
1969
|
-
children: [g && !o && /* @__PURE__ */
|
|
1969
|
+
children: [g && !o && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(d, {
|
|
1970
1970
|
size: 32,
|
|
1971
|
-
icon: /* @__PURE__ */
|
|
1972
|
-
onClick: () =>
|
|
1973
|
-
disabled:
|
|
1971
|
+
icon: /* @__PURE__ */ Y(e.up, { size: 14 }),
|
|
1972
|
+
onClick: () => T(t._key, -1),
|
|
1973
|
+
disabled: p <= 0,
|
|
1974
1974
|
title: "Move row up"
|
|
1975
|
-
}), /* @__PURE__ */
|
|
1975
|
+
}), /* @__PURE__ */ Y(d, {
|
|
1976
1976
|
size: 32,
|
|
1977
|
-
icon: /* @__PURE__ */
|
|
1978
|
-
onClick: () =>
|
|
1979
|
-
disabled:
|
|
1977
|
+
icon: /* @__PURE__ */ Y(e.down, { size: 14 }),
|
|
1978
|
+
onClick: () => T(t._key, 1),
|
|
1979
|
+
disabled: p === -1 || p >= u.length - 1,
|
|
1980
1980
|
title: "Move row down"
|
|
1981
|
-
})] }), o ? /* @__PURE__ */
|
|
1981
|
+
})] }), o ? /* @__PURE__ */ Y(d, {
|
|
1982
1982
|
size: 32,
|
|
1983
|
-
icon: /* @__PURE__ */
|
|
1984
|
-
onClick: () =>
|
|
1983
|
+
icon: /* @__PURE__ */ Y(e.refresh, { size: 14 }),
|
|
1984
|
+
onClick: () => C(t._key),
|
|
1985
1985
|
title: "Undo delete"
|
|
1986
|
-
}) : /* @__PURE__ */
|
|
1986
|
+
}) : /* @__PURE__ */ Y(d, {
|
|
1987
1987
|
size: 32,
|
|
1988
|
-
icon: /* @__PURE__ */
|
|
1989
|
-
onClick: () =>
|
|
1988
|
+
icon: /* @__PURE__ */ Y(e.trash, { size: 14 }),
|
|
1989
|
+
onClick: () => S(t._key),
|
|
1990
1990
|
title: "Delete row"
|
|
1991
1991
|
})]
|
|
1992
1992
|
})]
|
|
1993
|
-
}), /* @__PURE__ */
|
|
1993
|
+
}), /* @__PURE__ */ Y("div", {
|
|
1994
1994
|
style: {
|
|
1995
1995
|
padding: 10,
|
|
1996
1996
|
display: "flex",
|
|
@@ -1998,7 +1998,7 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
1998
1998
|
gap: 12
|
|
1999
1999
|
},
|
|
2000
2000
|
children: h.map((e) => {
|
|
2001
|
-
let i = n.fields.get(e), a = c?.includes(e), s = y.has(e), u = i ?
|
|
2001
|
+
let i = n.fields.get(e), a = c?.includes(e), s = y.has(e), u = i ? E(i, e, r.entities) : e, d = `child-${t._key}-${e}`, p = `${d}-label`, m = {
|
|
2002
2002
|
outline: a ? "1px solid var(--danger)" : "none",
|
|
2003
2003
|
outlineOffset: 3,
|
|
2004
2004
|
borderRadius: a ? 5 : 0
|
|
@@ -2007,7 +2007,7 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2007
2007
|
fontWeight: 600,
|
|
2008
2008
|
color: "var(--text-3)"
|
|
2009
2009
|
}, g = !o && !s && !!i;
|
|
2010
|
-
return /* @__PURE__ */
|
|
2010
|
+
return /* @__PURE__ */ X("div", {
|
|
2011
2011
|
style: {
|
|
2012
2012
|
display: "flex",
|
|
2013
2013
|
flexDirection: "column",
|
|
@@ -2016,77 +2016,77 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2016
2016
|
textDecoration: o ? "line-through" : "none"
|
|
2017
2017
|
},
|
|
2018
2018
|
title: a ? `${e} is required` : void 0,
|
|
2019
|
-
children: [g ? /* @__PURE__ */
|
|
2019
|
+
children: [g ? /* @__PURE__ */ Y("label", {
|
|
2020
2020
|
id: p,
|
|
2021
|
-
htmlFor:
|
|
2021
|
+
htmlFor: d,
|
|
2022
2022
|
style: h,
|
|
2023
2023
|
children: u
|
|
2024
|
-
}) : /* @__PURE__ */
|
|
2024
|
+
}) : /* @__PURE__ */ Y("div", {
|
|
2025
2025
|
id: p,
|
|
2026
2026
|
style: h,
|
|
2027
2027
|
children: u
|
|
2028
|
-
}), /* @__PURE__ */
|
|
2028
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2029
2029
|
style: m,
|
|
2030
|
-
children: o || s ? i ?
|
|
2030
|
+
children: o || s ? i ? w({
|
|
2031
2031
|
field: i,
|
|
2032
2032
|
fieldName: e,
|
|
2033
2033
|
value: t[e],
|
|
2034
2034
|
mode: "display",
|
|
2035
2035
|
record: t,
|
|
2036
2036
|
refs: l,
|
|
2037
|
-
fieldId:
|
|
2037
|
+
fieldId: d,
|
|
2038
2038
|
labelId: p,
|
|
2039
|
-
locale:
|
|
2040
|
-
}) :
|
|
2039
|
+
locale: f
|
|
2040
|
+
}) : A(t[e]) : i ? w({
|
|
2041
2041
|
field: i,
|
|
2042
2042
|
fieldName: e,
|
|
2043
2043
|
value: t[e],
|
|
2044
2044
|
mode: "edit",
|
|
2045
|
-
onChange: (n) =>
|
|
2045
|
+
onChange: (n) => b(t._key, e, n),
|
|
2046
2046
|
record: t,
|
|
2047
2047
|
refs: l,
|
|
2048
2048
|
compact: !0,
|
|
2049
|
-
fieldId:
|
|
2049
|
+
fieldId: d,
|
|
2050
2050
|
labelId: p,
|
|
2051
|
-
locale:
|
|
2052
|
-
}) :
|
|
2051
|
+
locale: f
|
|
2052
|
+
}) : A(t[e])
|
|
2053
2053
|
})]
|
|
2054
2054
|
}, e);
|
|
2055
2055
|
})
|
|
2056
2056
|
})]
|
|
2057
2057
|
}, t._key);
|
|
2058
2058
|
})
|
|
2059
|
-
}), /* @__PURE__ */
|
|
2059
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2060
2060
|
style: { marginTop: 10 },
|
|
2061
|
-
children: /* @__PURE__ */
|
|
2061
|
+
children: /* @__PURE__ */ Y(a, {
|
|
2062
2062
|
kind: "ghost",
|
|
2063
2063
|
size: "sm",
|
|
2064
|
-
icon: /* @__PURE__ */
|
|
2065
|
-
onClick:
|
|
2064
|
+
icon: /* @__PURE__ */ Y(e.plus, { size: 14 }),
|
|
2065
|
+
onClick: x,
|
|
2066
2066
|
children: "Add row"
|
|
2067
2067
|
})
|
|
2068
|
-
})] }) : /* @__PURE__ */
|
|
2068
|
+
})] }) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
2069
2069
|
style: { overflowX: "auto" },
|
|
2070
|
-
children: /* @__PURE__ */
|
|
2070
|
+
children: /* @__PURE__ */ X("table", {
|
|
2071
2071
|
ref: m,
|
|
2072
2072
|
style: se,
|
|
2073
|
-
onKeyDown:
|
|
2074
|
-
children: [/* @__PURE__ */
|
|
2073
|
+
onKeyDown: O,
|
|
2074
|
+
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", { children: [h.map((e) => {
|
|
2075
2075
|
let t = n.fields.get(e);
|
|
2076
|
-
return /* @__PURE__ */
|
|
2077
|
-
style:
|
|
2078
|
-
children: t ?
|
|
2076
|
+
return /* @__PURE__ */ Y("th", {
|
|
2077
|
+
style: k,
|
|
2078
|
+
children: t ? E(t, e, r.entities) : e
|
|
2079
2079
|
}, e);
|
|
2080
|
-
}), /* @__PURE__ */
|
|
2081
|
-
...
|
|
2080
|
+
}), /* @__PURE__ */ Y("th", { style: {
|
|
2081
|
+
...k,
|
|
2082
2082
|
width: 40
|
|
2083
|
-
} })] }) }), /* @__PURE__ */
|
|
2083
|
+
} })] }) }), /* @__PURE__ */ Y("tbody", { children: i.map((t) => {
|
|
2084
2084
|
let r = !!t._deleted, i = s?.[t._key];
|
|
2085
|
-
return /* @__PURE__ */
|
|
2085
|
+
return /* @__PURE__ */ X("tr", {
|
|
2086
2086
|
style: { opacity: r ? .5 : 1 },
|
|
2087
2087
|
children: [h.map((e) => {
|
|
2088
2088
|
let a = n.fields.get(e), o = i?.includes(e), s = y.has(e);
|
|
2089
|
-
return r || s ? /* @__PURE__ */
|
|
2089
|
+
return r || s ? /* @__PURE__ */ Y("td", {
|
|
2090
2090
|
style: {
|
|
2091
2091
|
padding: "6px 12px",
|
|
2092
2092
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -2094,16 +2094,16 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2094
2094
|
textDecoration: r ? "line-through" : "none",
|
|
2095
2095
|
color: "var(--text-2)"
|
|
2096
2096
|
},
|
|
2097
|
-
children: a ?
|
|
2097
|
+
children: a ? w({
|
|
2098
2098
|
field: a,
|
|
2099
2099
|
fieldName: e,
|
|
2100
2100
|
value: t[e],
|
|
2101
2101
|
mode: "display",
|
|
2102
2102
|
record: t,
|
|
2103
2103
|
refs: l,
|
|
2104
|
-
locale:
|
|
2105
|
-
}) :
|
|
2106
|
-
}, e) : /* @__PURE__ */
|
|
2104
|
+
locale: f
|
|
2105
|
+
}) : A(t[e])
|
|
2106
|
+
}, e) : /* @__PURE__ */ Y("td", {
|
|
2107
2107
|
style: {
|
|
2108
2108
|
padding: "4px 4px",
|
|
2109
2109
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -2113,83 +2113,83 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2113
2113
|
borderRadius: o ? 4 : 0
|
|
2114
2114
|
},
|
|
2115
2115
|
title: o ? `${e} is required` : void 0,
|
|
2116
|
-
children: a ?
|
|
2116
|
+
children: a ? w({
|
|
2117
2117
|
field: a,
|
|
2118
2118
|
fieldName: e,
|
|
2119
2119
|
value: t[e],
|
|
2120
2120
|
mode: "edit",
|
|
2121
|
-
onChange: (n) =>
|
|
2121
|
+
onChange: (n) => b(t._key, e, n),
|
|
2122
2122
|
record: t,
|
|
2123
2123
|
refs: l,
|
|
2124
2124
|
compact: !0,
|
|
2125
|
-
locale:
|
|
2126
|
-
}) :
|
|
2125
|
+
locale: f
|
|
2126
|
+
}) : A(t[e])
|
|
2127
2127
|
}, e);
|
|
2128
|
-
}), /* @__PURE__ */
|
|
2128
|
+
}), /* @__PURE__ */ Y("td", {
|
|
2129
2129
|
style: {
|
|
2130
2130
|
padding: "4px 8px",
|
|
2131
2131
|
borderBottom: "1px solid var(--divider)",
|
|
2132
2132
|
verticalAlign: "middle"
|
|
2133
2133
|
},
|
|
2134
|
-
children: r ? /* @__PURE__ */
|
|
2134
|
+
children: r ? /* @__PURE__ */ Y(d, {
|
|
2135
2135
|
size: 24,
|
|
2136
|
-
icon: /* @__PURE__ */
|
|
2137
|
-
onClick: () =>
|
|
2136
|
+
icon: /* @__PURE__ */ Y(e.refresh, { size: 12 }),
|
|
2137
|
+
onClick: () => C(t._key),
|
|
2138
2138
|
title: "Undo delete"
|
|
2139
|
-
}) : /* @__PURE__ */
|
|
2139
|
+
}) : /* @__PURE__ */ Y(d, {
|
|
2140
2140
|
size: 24,
|
|
2141
|
-
icon: /* @__PURE__ */
|
|
2142
|
-
onClick: () =>
|
|
2141
|
+
icon: /* @__PURE__ */ Y(e.trash, { size: 12 }),
|
|
2142
|
+
onClick: () => S(t._key),
|
|
2143
2143
|
title: "Delete row"
|
|
2144
2144
|
})
|
|
2145
2145
|
})]
|
|
2146
2146
|
}, t._key);
|
|
2147
2147
|
}) })]
|
|
2148
2148
|
})
|
|
2149
|
-
}), /* @__PURE__ */
|
|
2149
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2150
2150
|
style: { marginTop: 8 },
|
|
2151
|
-
children: /* @__PURE__ */
|
|
2151
|
+
children: /* @__PURE__ */ Y(a, {
|
|
2152
2152
|
kind: "ghost",
|
|
2153
2153
|
size: "xs",
|
|
2154
|
-
icon: /* @__PURE__ */
|
|
2155
|
-
onClick:
|
|
2154
|
+
icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
|
|
2155
|
+
onClick: x,
|
|
2156
2156
|
children: "Add row"
|
|
2157
2157
|
})
|
|
2158
2158
|
})] });
|
|
2159
2159
|
}
|
|
2160
2160
|
//#endregion
|
|
2161
2161
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
2162
|
-
var pt =
|
|
2162
|
+
var pt = H(() => import("./DraggableChildrenTable-CljdYXd_.js").then((e) => ({ default: e.DraggableChildrenTable })));
|
|
2163
2163
|
function mt({ node: e, ctx: n }) {
|
|
2164
|
-
let r =
|
|
2164
|
+
let r = c(), i = e.children;
|
|
2165
2165
|
if (!i) return null;
|
|
2166
2166
|
let a = r.isPhone && n.relatedRecordsPresentation === "table";
|
|
2167
2167
|
if (n.isNew && n.mode !== "edit") return null;
|
|
2168
|
-
let
|
|
2169
|
-
if (!
|
|
2168
|
+
let o = ze(n.entity, i);
|
|
2169
|
+
if (!o) return /* @__PURE__ */ X("div", {
|
|
2170
2170
|
className: "text-sm text-muted-foreground py-2",
|
|
2171
2171
|
children: ["Unknown child relation: ", i]
|
|
2172
2172
|
});
|
|
2173
|
-
let
|
|
2174
|
-
if (!
|
|
2173
|
+
let s = n.schema.entities[o.entity];
|
|
2174
|
+
if (!s) return /* @__PURE__ */ X("div", {
|
|
2175
2175
|
className: "text-sm text-muted-foreground py-2",
|
|
2176
|
-
children: ["Entity not found: ",
|
|
2176
|
+
children: ["Entity not found: ", o.entity]
|
|
2177
2177
|
});
|
|
2178
|
-
let l = De(
|
|
2178
|
+
let l = De(o, s, e), u = Z(e, n), d = we(e, n), f = (e) => l.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ Y(F, {
|
|
2179
2179
|
title: u,
|
|
2180
|
-
icon: d ? /* @__PURE__ */
|
|
2180
|
+
icon: d ? /* @__PURE__ */ Y(t, {
|
|
2181
2181
|
name: d,
|
|
2182
2182
|
size: 14
|
|
2183
2183
|
}) : void 0,
|
|
2184
2184
|
children: e
|
|
2185
2185
|
});
|
|
2186
|
-
if (n.mode === "edit" && l.editable && l.interaction !== "navigate" && l.interaction !== "readonly" &&
|
|
2186
|
+
if (n.mode === "edit" && l.editable && l.interaction !== "navigate" && l.interaction !== "readonly" && b(s, "update") && l.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
|
|
2187
2187
|
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = l.position_field ? r.isPhone && !a ? ft : pt : ft;
|
|
2188
|
-
return f(/* @__PURE__ */
|
|
2189
|
-
fallback: /* @__PURE__ */
|
|
2190
|
-
children: /* @__PURE__ */
|
|
2188
|
+
return f(/* @__PURE__ */ Y(le, {
|
|
2189
|
+
fallback: /* @__PURE__ */ Y(N, {}),
|
|
2190
|
+
children: /* @__PURE__ */ Y(o, {
|
|
2191
2191
|
config: l,
|
|
2192
|
-
childEntity:
|
|
2192
|
+
childEntity: s,
|
|
2193
2193
|
schema: n.schema,
|
|
2194
2194
|
rows: e,
|
|
2195
2195
|
onChange: (e) => n.onChildrenChange(i, e),
|
|
@@ -2207,10 +2207,10 @@ function mt({ node: e, ctx: n }) {
|
|
|
2207
2207
|
schema: n.schema
|
|
2208
2208
|
};
|
|
2209
2209
|
switch (l.mode) {
|
|
2210
|
-
case "list": return f(/* @__PURE__ */
|
|
2211
|
-
case "cards": return f(/* @__PURE__ */
|
|
2212
|
-
case "timeline": return f(/* @__PURE__ */
|
|
2213
|
-
default: return r.isPhone && !a ? f(/* @__PURE__ */
|
|
2210
|
+
case "list": return f(/* @__PURE__ */ Y(Ge, { ...p }));
|
|
2211
|
+
case "cards": return f(/* @__PURE__ */ Y(Ke, { ...p }));
|
|
2212
|
+
case "timeline": return f(/* @__PURE__ */ Y(at, { ...p }));
|
|
2213
|
+
default: return r.isPhone && !a ? f(/* @__PURE__ */ Y(Ke, { ...p })) : f(/* @__PURE__ */ Y(We, { ...p }));
|
|
2214
2214
|
}
|
|
2215
2215
|
}
|
|
2216
2216
|
//#endregion
|
|
@@ -2223,8 +2223,8 @@ var ht = 150, gt = 560, _t = "20px", vt = 4, yt = /* @__PURE__ */ new Set([
|
|
|
2223
2223
|
"multilang_text"
|
|
2224
2224
|
]), bt = ue({ columns: 2 });
|
|
2225
2225
|
function xt({ columns: e = 2, children: t }) {
|
|
2226
|
-
let n =
|
|
2227
|
-
|
|
2226
|
+
let n = K(null), [r, i] = q(!1);
|
|
2227
|
+
W(() => {
|
|
2228
2228
|
let t = n.current;
|
|
2229
2229
|
if (!t || e === 1 || typeof ResizeObserver > "u") return;
|
|
2230
2230
|
let r = new ResizeObserver(([e]) => {
|
|
@@ -2233,9 +2233,9 @@ function xt({ columns: e = 2, children: t }) {
|
|
|
2233
2233
|
return r.observe(t), () => r.disconnect();
|
|
2234
2234
|
}, [e]);
|
|
2235
2235
|
let a = e === 1 || r ? 1 : e;
|
|
2236
|
-
return /* @__PURE__ */
|
|
2236
|
+
return /* @__PURE__ */ Y(bt.Provider, {
|
|
2237
2237
|
value: { columns: a },
|
|
2238
|
-
children: /* @__PURE__ */
|
|
2238
|
+
children: /* @__PURE__ */ Y("div", {
|
|
2239
2239
|
ref: n,
|
|
2240
2240
|
style: {
|
|
2241
2241
|
display: "grid",
|
|
@@ -2247,9 +2247,9 @@ function xt({ columns: e = 2, children: t }) {
|
|
|
2247
2247
|
})
|
|
2248
2248
|
});
|
|
2249
2249
|
}
|
|
2250
|
-
function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
2251
|
-
let h =
|
|
2252
|
-
return /* @__PURE__ */
|
|
2250
|
+
function St({ label: t, children: n, span: r = !1, required: i, error: a, hint: s, actions: c, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
|
|
2251
|
+
let h = de(bt), g = r || h.columns === 1, _ = !!a;
|
|
2252
|
+
return /* @__PURE__ */ X("div", {
|
|
2253
2253
|
className: "detail-row",
|
|
2254
2254
|
"data-error": _ || void 0,
|
|
2255
2255
|
"data-testid": m,
|
|
@@ -2261,7 +2261,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2261
2261
|
padding: "6px 0",
|
|
2262
2262
|
...r ? { gridColumn: "1 / -1" } : null
|
|
2263
2263
|
},
|
|
2264
|
-
children: [/* @__PURE__ */
|
|
2264
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2265
2265
|
style: {
|
|
2266
2266
|
width: g ? "auto" : ht,
|
|
2267
2267
|
flexShrink: 0,
|
|
@@ -2274,16 +2274,16 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2274
2274
|
alignItems: "flex-start",
|
|
2275
2275
|
gap: 2
|
|
2276
2276
|
},
|
|
2277
|
-
children: [d ? /* @__PURE__ */
|
|
2277
|
+
children: [d ? /* @__PURE__ */ Y("label", {
|
|
2278
2278
|
id: f,
|
|
2279
2279
|
htmlFor: d,
|
|
2280
2280
|
title: p || void 0,
|
|
2281
2281
|
children: t
|
|
2282
|
-
}) : /* @__PURE__ */
|
|
2282
|
+
}) : /* @__PURE__ */ Y("span", {
|
|
2283
2283
|
id: f,
|
|
2284
2284
|
title: p || void 0,
|
|
2285
2285
|
children: t
|
|
2286
|
-
}), i && u === "edit" && /* @__PURE__ */
|
|
2286
|
+
}), i && u === "edit" && /* @__PURE__ */ Y("span", {
|
|
2287
2287
|
"aria-hidden": "true",
|
|
2288
2288
|
style: {
|
|
2289
2289
|
color: "var(--danger)",
|
|
@@ -2291,7 +2291,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2291
2291
|
},
|
|
2292
2292
|
children: "*"
|
|
2293
2293
|
})]
|
|
2294
|
-
}), /* @__PURE__ */
|
|
2294
|
+
}), /* @__PURE__ */ X("div", {
|
|
2295
2295
|
style: {
|
|
2296
2296
|
flex: 1,
|
|
2297
2297
|
minWidth: 0,
|
|
@@ -2299,14 +2299,14 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2299
2299
|
flexDirection: "column",
|
|
2300
2300
|
gap: 3
|
|
2301
2301
|
},
|
|
2302
|
-
children: [/* @__PURE__ */
|
|
2302
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2303
2303
|
style: {
|
|
2304
2304
|
display: "flex",
|
|
2305
2305
|
alignItems: "flex-start",
|
|
2306
2306
|
gap: 6,
|
|
2307
2307
|
minHeight: 24
|
|
2308
2308
|
},
|
|
2309
|
-
children: [/* @__PURE__ */
|
|
2309
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2310
2310
|
style: {
|
|
2311
2311
|
flex: 1,
|
|
2312
2312
|
minWidth: 0,
|
|
@@ -2316,14 +2316,14 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2316
2316
|
overflowWrap: "anywhere",
|
|
2317
2317
|
paddingTop: u === "display" && !g ? vt : 0
|
|
2318
2318
|
},
|
|
2319
|
-
children: _ && u === "edit" ? /* @__PURE__ */
|
|
2319
|
+
children: _ && u === "edit" ? /* @__PURE__ */ Y("div", {
|
|
2320
2320
|
style: {
|
|
2321
2321
|
borderRadius: 6,
|
|
2322
2322
|
boxShadow: "0 0 0 1.5px var(--danger)"
|
|
2323
2323
|
},
|
|
2324
2324
|
children: n
|
|
2325
2325
|
}) : n
|
|
2326
|
-
}), (
|
|
2326
|
+
}), (l || c) && /* @__PURE__ */ X("div", {
|
|
2327
2327
|
className: "detail-row-action",
|
|
2328
2328
|
style: {
|
|
2329
2329
|
display: "flex",
|
|
@@ -2331,13 +2331,13 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2331
2331
|
flexShrink: 0,
|
|
2332
2332
|
marginTop: -2
|
|
2333
2333
|
},
|
|
2334
|
-
children: [
|
|
2335
|
-
value:
|
|
2334
|
+
children: [l && /* @__PURE__ */ Y(o, {
|
|
2335
|
+
value: l,
|
|
2336
2336
|
size: "sm",
|
|
2337
2337
|
title: "Copy value"
|
|
2338
|
-
}),
|
|
2338
|
+
}), c]
|
|
2339
2339
|
})]
|
|
2340
|
-
}), (_ ||
|
|
2340
|
+
}), (_ || s != null) && /* @__PURE__ */ X("div", {
|
|
2341
2341
|
style: {
|
|
2342
2342
|
fontSize: 11.5,
|
|
2343
2343
|
lineHeight: 1.4,
|
|
@@ -2346,7 +2346,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2346
2346
|
alignItems: "center",
|
|
2347
2347
|
gap: 4
|
|
2348
2348
|
},
|
|
2349
|
-
children: [_ && /* @__PURE__ */
|
|
2349
|
+
children: [_ && /* @__PURE__ */ Y(e.warning, { size: 11 }), /* @__PURE__ */ Y("span", { children: _ ? a : s })]
|
|
2350
2350
|
})]
|
|
2351
2351
|
})]
|
|
2352
2352
|
});
|
|
@@ -2354,11 +2354,11 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2354
2354
|
//#endregion
|
|
2355
2355
|
//#region src/components/detail-layout/FieldsBlock.tsx
|
|
2356
2356
|
function Ct({ fields: e, ctx: t }) {
|
|
2357
|
-
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c =
|
|
2358
|
-
return /* @__PURE__ */
|
|
2357
|
+
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = D(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
|
|
2358
|
+
return /* @__PURE__ */ Y(xt, {
|
|
2359
2359
|
columns: l,
|
|
2360
2360
|
children: e.map((e) => {
|
|
2361
|
-
let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), m = !!(p?.auto || p?.readonly || p?.source), h =
|
|
2361
|
+
let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), m = !!(p?.auto || p?.readonly || p?.source), h = I(n, l), g = h?.read === "denied", _ = h?.write === "denied", v = a === "display" ? g : _ || g, y = m || a === "edit" && _ ? "display" : a, b = v ? /* @__PURE__ */ Y(ae, {
|
|
2362
2362
|
tier: h.classification,
|
|
2363
2363
|
tierDef: ie(s, n, l),
|
|
2364
2364
|
requiredPermission: h?.required_permission,
|
|
@@ -2378,39 +2378,39 @@ function Ct({ fields: e, ctx: t }) {
|
|
|
2378
2378
|
fieldId: d,
|
|
2379
2379
|
labelId: f
|
|
2380
2380
|
});
|
|
2381
|
-
if (!
|
|
2382
|
-
let
|
|
2381
|
+
if (!b) return null;
|
|
2382
|
+
let x = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ Y(J, { children: e.actions.map((e, t) => /* @__PURE__ */ Y(R, {
|
|
2383
2383
|
actionCode: `${l}.action[${t}]`,
|
|
2384
2384
|
action: e,
|
|
2385
2385
|
entityCode: r,
|
|
2386
2386
|
row: i,
|
|
2387
2387
|
variant: "ghost",
|
|
2388
2388
|
size: "icon"
|
|
2389
|
-
}, t)) }) : void 0,
|
|
2390
|
-
return u ? /* @__PURE__ */
|
|
2389
|
+
}, t)) }) : void 0, S = !!p && yt.has(p.type), w = i?.[l], T = y === "display" && (p?.copyable || p?.type === "uuid") && w != null && w !== "" ? A(w) : void 0, E = C(p?.display?.description);
|
|
2390
|
+
return u ? /* @__PURE__ */ X("div", {
|
|
2391
2391
|
style: { gridColumn: "1 / -1" },
|
|
2392
|
-
children: [
|
|
2392
|
+
children: [b, y === "edit" && E && /* @__PURE__ */ Y("div", {
|
|
2393
2393
|
style: {
|
|
2394
2394
|
fontSize: 11.5,
|
|
2395
2395
|
lineHeight: 1.4,
|
|
2396
2396
|
color: "var(--text-3)",
|
|
2397
2397
|
marginTop: 3
|
|
2398
2398
|
},
|
|
2399
|
-
children:
|
|
2399
|
+
children: E
|
|
2400
2400
|
})]
|
|
2401
|
-
}, l) : /* @__PURE__ */
|
|
2402
|
-
label:
|
|
2401
|
+
}, l) : /* @__PURE__ */ Y(St, {
|
|
2402
|
+
label: re(n, l, s.entities),
|
|
2403
2403
|
htmlFor: y === "edit" ? d : void 0,
|
|
2404
2404
|
labelId: f,
|
|
2405
|
-
labelTitle:
|
|
2405
|
+
labelTitle: E || void 0,
|
|
2406
2406
|
required: p?.required ?? !1,
|
|
2407
2407
|
mode: y,
|
|
2408
|
-
span:
|
|
2408
|
+
span: S,
|
|
2409
2409
|
error: t.fieldErrors?.[l],
|
|
2410
|
-
hint: y === "edit" &&
|
|
2411
|
-
actions:
|
|
2412
|
-
copyValue:
|
|
2413
|
-
children:
|
|
2410
|
+
hint: y === "edit" && E ? E : void 0,
|
|
2411
|
+
actions: x,
|
|
2412
|
+
copyValue: T,
|
|
2413
|
+
children: b
|
|
2414
2414
|
}, l);
|
|
2415
2415
|
})
|
|
2416
2416
|
});
|
|
@@ -2430,11 +2430,11 @@ function Et({ node: e, ctx: t }) {
|
|
|
2430
2430
|
let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
|
|
2431
2431
|
if (a) return null;
|
|
2432
2432
|
let l = e.properties === !0 ? !0 : e.properties, u = l === !0 ? Object.entries(c).sort(([e], [t]) => e.localeCompare(t)) : l.filter((e) => c[e] != null).map((e) => [e, c[e]]);
|
|
2433
|
-
return u.length === 0 ? null : /* @__PURE__ */
|
|
2433
|
+
return u.length === 0 ? null : /* @__PURE__ */ Y(xt, {
|
|
2434
2434
|
columns: 2,
|
|
2435
2435
|
children: u.map(([e, a]) => {
|
|
2436
|
-
let c = r?.find((t) => t.property_code === e), l =
|
|
2437
|
-
return /* @__PURE__ */
|
|
2436
|
+
let c = r?.find((t) => t.property_code === e), l = T(a), u = a.readonly || !i ? "display" : o;
|
|
2437
|
+
return /* @__PURE__ */ Y(Dt, {
|
|
2438
2438
|
propCode: e,
|
|
2439
2439
|
prop: a,
|
|
2440
2440
|
field: l,
|
|
@@ -2449,28 +2449,28 @@ function Et({ node: e, ctx: t }) {
|
|
|
2449
2449
|
});
|
|
2450
2450
|
}
|
|
2451
2451
|
function Dt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: s, schema: c }) {
|
|
2452
|
-
let l =
|
|
2453
|
-
|
|
2452
|
+
let l = D(), u = K(null);
|
|
2453
|
+
W(() => () => {
|
|
2454
2454
|
u.current && clearTimeout(u.current);
|
|
2455
2455
|
}, []);
|
|
2456
|
-
let d =
|
|
2456
|
+
let d = U((n) => {
|
|
2457
2457
|
a && (wt.has(t.type) ? (u.current && clearTimeout(u.current), u.current = setTimeout(() => a(e, n), Tt)) : a(e, n));
|
|
2458
2458
|
}, [
|
|
2459
2459
|
e,
|
|
2460
2460
|
t.type,
|
|
2461
2461
|
a
|
|
2462
|
-
]), f =
|
|
2463
|
-
return /* @__PURE__ */
|
|
2464
|
-
label:
|
|
2462
|
+
]), f = I(s, e), p = f?.read === "denied", m = f?.write === "denied", h = i === "display" ? p : m || p, g = i === "edit" && m ? "display" : i;
|
|
2463
|
+
return /* @__PURE__ */ Y(St, {
|
|
2464
|
+
label: C(t.display?.name ?? t.name),
|
|
2465
2465
|
mode: g,
|
|
2466
2466
|
span: yt.has(t.type),
|
|
2467
|
-
children: h ? /* @__PURE__ */
|
|
2467
|
+
children: h ? /* @__PURE__ */ Y(ae, {
|
|
2468
2468
|
tier: f.classification,
|
|
2469
2469
|
tierDef: ie(c, s, e),
|
|
2470
2470
|
requiredPermission: f?.required_permission,
|
|
2471
2471
|
locale: l,
|
|
2472
2472
|
variant: g === "edit" ? "input" : "value"
|
|
2473
|
-
}) :
|
|
2473
|
+
}) : w({
|
|
2474
2474
|
field: n,
|
|
2475
2475
|
fieldName: e,
|
|
2476
2476
|
value: r,
|
|
@@ -2485,7 +2485,7 @@ function Dt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty:
|
|
|
2485
2485
|
//#region src/components/shared/StatusStepper.tsx
|
|
2486
2486
|
function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1 }) {
|
|
2487
2487
|
let o = t.findIndex((e) => e.code === n);
|
|
2488
|
-
return /* @__PURE__ */
|
|
2488
|
+
return /* @__PURE__ */ Y("div", {
|
|
2489
2489
|
role: "list",
|
|
2490
2490
|
style: {
|
|
2491
2491
|
display: "flex",
|
|
@@ -2497,7 +2497,7 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2497
2497
|
},
|
|
2498
2498
|
children: t.map((n, s) => {
|
|
2499
2499
|
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%)";
|
|
2500
|
-
return /* @__PURE__ */
|
|
2500
|
+
return /* @__PURE__ */ X("button", {
|
|
2501
2501
|
role: "listitem",
|
|
2502
2502
|
type: "button",
|
|
2503
2503
|
disabled: !d,
|
|
@@ -2521,7 +2521,7 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2521
2521
|
clipPath: g,
|
|
2522
2522
|
whiteSpace: "nowrap"
|
|
2523
2523
|
},
|
|
2524
|
-
children: [/* @__PURE__ */
|
|
2524
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
2525
2525
|
style: {
|
|
2526
2526
|
width: 16,
|
|
2527
2527
|
height: 16,
|
|
@@ -2536,8 +2536,8 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2536
2536
|
fontSize: 9.5,
|
|
2537
2537
|
fontWeight: 700
|
|
2538
2538
|
},
|
|
2539
|
-
children: c ? /* @__PURE__ */
|
|
2540
|
-
}), /* @__PURE__ */
|
|
2539
|
+
children: c ? /* @__PURE__ */ Y(e.check, { size: 10 }) : s + 1
|
|
2540
|
+
}), /* @__PURE__ */ Y("span", {
|
|
2541
2541
|
style: {
|
|
2542
2542
|
overflow: "hidden",
|
|
2543
2543
|
textOverflow: "ellipsis"
|
|
@@ -2550,8 +2550,8 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2550
2550
|
}
|
|
2551
2551
|
//#endregion
|
|
2552
2552
|
//#region src/components/shared/StatusGroupsDisplay.tsx
|
|
2553
|
-
function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending:
|
|
2554
|
-
return /* @__PURE__ */
|
|
2553
|
+
function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: i, mode: a = "edit" }) {
|
|
2554
|
+
return /* @__PURE__ */ Y("div", {
|
|
2555
2555
|
style: {
|
|
2556
2556
|
display: "flex",
|
|
2557
2557
|
flexWrap: "wrap",
|
|
@@ -2561,57 +2561,57 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2561
2561
|
children: Object.entries(e).map(([e, o]) => {
|
|
2562
2562
|
let s = t?.find((t) => t.group_code === e)?.status_code, c = s ? o.statuses.find((e) => e.code === s) : void 0;
|
|
2563
2563
|
if (o.display_mode === "stepper") {
|
|
2564
|
-
let t = a === "edit",
|
|
2565
|
-
return /* @__PURE__ */
|
|
2564
|
+
let t = a === "edit", r = t ? o.transitions && s ? /* @__PURE__ */ new Set([s, ...o.transitions[s] ?? []]) : new Set(o.statuses.map((e) => e.code)) : void 0;
|
|
2565
|
+
return /* @__PURE__ */ X("div", {
|
|
2566
2566
|
style: {
|
|
2567
2567
|
display: "flex",
|
|
2568
2568
|
alignItems: "center",
|
|
2569
2569
|
gap: 8,
|
|
2570
2570
|
minWidth: 0
|
|
2571
2571
|
},
|
|
2572
|
-
children: [/* @__PURE__ */
|
|
2572
|
+
children: [/* @__PURE__ */ X("span", {
|
|
2573
2573
|
style: {
|
|
2574
2574
|
fontSize: 12,
|
|
2575
2575
|
color: "var(--text-3)",
|
|
2576
2576
|
flexShrink: 0
|
|
2577
2577
|
},
|
|
2578
|
-
children: [
|
|
2579
|
-
}), /* @__PURE__ */
|
|
2578
|
+
children: [C(o.name), ":"]
|
|
2579
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2580
2580
|
style: {
|
|
2581
2581
|
minWidth: 240,
|
|
2582
|
-
opacity:
|
|
2583
|
-
pointerEvents:
|
|
2582
|
+
opacity: i ? .6 : 1,
|
|
2583
|
+
pointerEvents: i ? "none" : "auto"
|
|
2584
2584
|
},
|
|
2585
|
-
children: /* @__PURE__ */
|
|
2585
|
+
children: /* @__PURE__ */ Y(Ot, {
|
|
2586
2586
|
stages: o.statuses.map((e) => ({
|
|
2587
2587
|
code: e.code,
|
|
2588
|
-
label:
|
|
2588
|
+
label: C(e.name)
|
|
2589
2589
|
})),
|
|
2590
2590
|
current: s,
|
|
2591
|
-
selectable:
|
|
2591
|
+
selectable: r,
|
|
2592
2592
|
onSelect: t ? (t) => n(e, t) : void 0,
|
|
2593
2593
|
compact: !0
|
|
2594
2594
|
})
|
|
2595
2595
|
})]
|
|
2596
2596
|
}, e);
|
|
2597
2597
|
}
|
|
2598
|
-
if (a === "display") return /* @__PURE__ */
|
|
2598
|
+
if (a === "display") return /* @__PURE__ */ X("div", {
|
|
2599
2599
|
style: {
|
|
2600
2600
|
display: "flex",
|
|
2601
2601
|
alignItems: "center",
|
|
2602
2602
|
gap: 8
|
|
2603
2603
|
},
|
|
2604
|
-
children: [/* @__PURE__ */
|
|
2604
|
+
children: [/* @__PURE__ */ X("span", {
|
|
2605
2605
|
style: {
|
|
2606
2606
|
fontSize: 12,
|
|
2607
2607
|
color: "var(--text-3)"
|
|
2608
2608
|
},
|
|
2609
|
-
children: [
|
|
2610
|
-
}), c ? /* @__PURE__ */
|
|
2609
|
+
children: [C(o.name), ":"]
|
|
2610
|
+
}), c ? /* @__PURE__ */ Y(l, {
|
|
2611
2611
|
tone: c.color ?? "slate",
|
|
2612
2612
|
size: "xs",
|
|
2613
|
-
children:
|
|
2614
|
-
}) : /* @__PURE__ */
|
|
2613
|
+
children: C(c.name)
|
|
2614
|
+
}) : /* @__PURE__ */ Y("span", {
|
|
2615
2615
|
style: {
|
|
2616
2616
|
fontSize: 12.5,
|
|
2617
2617
|
color: "var(--text-4)"
|
|
@@ -2619,44 +2619,44 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2619
2619
|
children: "—"
|
|
2620
2620
|
})]
|
|
2621
2621
|
}, e);
|
|
2622
|
-
let
|
|
2622
|
+
let u = (o.transitions && s ? o.statuses.filter((e) => e.code === s || (o.transitions[s]?.includes(e.code) ?? !1)) : o.statuses).map((e) => ({
|
|
2623
2623
|
value: e.code,
|
|
2624
|
-
label: /* @__PURE__ */
|
|
2624
|
+
label: /* @__PURE__ */ X("span", {
|
|
2625
2625
|
style: {
|
|
2626
2626
|
display: "inline-flex",
|
|
2627
2627
|
alignItems: "center",
|
|
2628
2628
|
gap: 6
|
|
2629
2629
|
},
|
|
2630
|
-
children: [e.color && /* @__PURE__ */
|
|
2630
|
+
children: [e.color && /* @__PURE__ */ Y("span", { style: {
|
|
2631
2631
|
width: 8,
|
|
2632
2632
|
height: 8,
|
|
2633
2633
|
borderRadius: 999,
|
|
2634
2634
|
background: `var(--pill-${e.color}, ${e.color})`,
|
|
2635
2635
|
display: "inline-block"
|
|
2636
|
-
} }),
|
|
2636
|
+
} }), C(e.name)]
|
|
2637
2637
|
})
|
|
2638
2638
|
}));
|
|
2639
|
-
return /* @__PURE__ */
|
|
2639
|
+
return /* @__PURE__ */ X("div", {
|
|
2640
2640
|
style: {
|
|
2641
2641
|
display: "flex",
|
|
2642
2642
|
alignItems: "center",
|
|
2643
2643
|
gap: 8
|
|
2644
2644
|
},
|
|
2645
|
-
children: [/* @__PURE__ */
|
|
2645
|
+
children: [/* @__PURE__ */ X("span", {
|
|
2646
2646
|
style: {
|
|
2647
2647
|
fontSize: 12,
|
|
2648
2648
|
color: "var(--text-3)"
|
|
2649
2649
|
},
|
|
2650
|
-
children: [
|
|
2651
|
-
}), /* @__PURE__ */
|
|
2650
|
+
children: [C(o.name), ":"]
|
|
2651
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2652
2652
|
style: {
|
|
2653
2653
|
minWidth: 180,
|
|
2654
|
-
opacity:
|
|
2655
|
-
pointerEvents:
|
|
2654
|
+
opacity: i ? .6 : 1,
|
|
2655
|
+
pointerEvents: i ? "none" : "auto"
|
|
2656
2656
|
},
|
|
2657
|
-
children: /* @__PURE__ */
|
|
2657
|
+
children: /* @__PURE__ */ Y(r, {
|
|
2658
2658
|
value: s ?? "",
|
|
2659
|
-
options:
|
|
2659
|
+
options: u,
|
|
2660
2660
|
onChange: (t) => n(e, t),
|
|
2661
2661
|
placeholder: "Select…"
|
|
2662
2662
|
})
|
|
@@ -2672,7 +2672,7 @@ function jt({ node: e, ctx: t }) {
|
|
|
2672
2672
|
let { entity: n, objectStatuses: r, onSetStatus: i, isStatusPending: a, isNew: o } = t, s = n.status_groups ?? {};
|
|
2673
2673
|
if (o) return null;
|
|
2674
2674
|
let c = e.statuses === !0 ? !0 : e.statuses, l = Object.fromEntries(Object.entries(s).filter(([e]) => c === !0 || c.includes(e)));
|
|
2675
|
-
return Object.keys(l).length === 0 ? null : /* @__PURE__ */
|
|
2675
|
+
return Object.keys(l).length === 0 ? null : /* @__PURE__ */ Y(kt, {
|
|
2676
2676
|
statusGroups: l,
|
|
2677
2677
|
objectStatuses: r,
|
|
2678
2678
|
onSetStatus: i ?? At,
|
|
@@ -2713,29 +2713,29 @@ function Pt(e) {
|
|
|
2713
2713
|
}
|
|
2714
2714
|
//#endregion
|
|
2715
2715
|
//#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
|
|
2716
|
-
var Ft = "Audit change diff", It =
|
|
2716
|
+
var Ft = "Audit change diff", It = H(() => import("./MonacoJson-DVjwsaBK.js").then((e) => ({ default: e.MonacoJsonDiff }))), Lt = H(() => import("./MonacoJson-DVjwsaBK.js").then((e) => ({ default: e.MonacoJsonSource }))), Rt = H(() => import("./JsonEditor-KelPV-OQ.js").then((e) => ({ default: e.JsonEditor })));
|
|
2717
2717
|
function zt() {
|
|
2718
|
-
return /* @__PURE__ */
|
|
2718
|
+
return /* @__PURE__ */ Y("div", {
|
|
2719
2719
|
className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
|
|
2720
2720
|
children: "Loading editor…"
|
|
2721
2721
|
});
|
|
2722
2722
|
}
|
|
2723
2723
|
function Bt({ before: e, after: t }) {
|
|
2724
|
-
return /* @__PURE__ */
|
|
2725
|
-
fallback: /* @__PURE__ */
|
|
2726
|
-
children: /* @__PURE__ */
|
|
2724
|
+
return /* @__PURE__ */ Y(le, {
|
|
2725
|
+
fallback: /* @__PURE__ */ Y(zt, {}),
|
|
2726
|
+
children: /* @__PURE__ */ X("div", {
|
|
2727
2727
|
className: "flex h-full w-full gap-2",
|
|
2728
2728
|
role: "group",
|
|
2729
2729
|
"aria-label": Ft,
|
|
2730
|
-
children: [/* @__PURE__ */
|
|
2730
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2731
2731
|
className: "min-w-0 flex-1",
|
|
2732
|
-
children: /* @__PURE__ */
|
|
2732
|
+
children: /* @__PURE__ */ Y(Rt, {
|
|
2733
2733
|
value: e,
|
|
2734
2734
|
readOnly: !0
|
|
2735
2735
|
})
|
|
2736
|
-
}), /* @__PURE__ */
|
|
2736
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2737
2737
|
className: "min-w-0 flex-1",
|
|
2738
|
-
children: /* @__PURE__ */
|
|
2738
|
+
children: /* @__PURE__ */ Y(Rt, {
|
|
2739
2739
|
value: t,
|
|
2740
2740
|
readOnly: !0
|
|
2741
2741
|
})
|
|
@@ -2744,17 +2744,17 @@ function Bt({ before: e, after: t }) {
|
|
|
2744
2744
|
});
|
|
2745
2745
|
}
|
|
2746
2746
|
function Vt({ mode: e, onChange: t }) {
|
|
2747
|
-
return /* @__PURE__ */
|
|
2747
|
+
return /* @__PURE__ */ X("div", {
|
|
2748
2748
|
className: "inline-flex gap-1",
|
|
2749
2749
|
role: "group",
|
|
2750
2750
|
"aria-label": "Diff view mode",
|
|
2751
|
-
children: [/* @__PURE__ */
|
|
2751
|
+
children: [/* @__PURE__ */ Y("button", {
|
|
2752
2752
|
type: "button",
|
|
2753
2753
|
"aria-pressed": e === "diff",
|
|
2754
2754
|
onClick: () => t("diff"),
|
|
2755
2755
|
className: `rounded px-2 py-0.5 text-xs ${e === "diff" ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
|
|
2756
2756
|
children: "Diff"
|
|
2757
|
-
}), /* @__PURE__ */
|
|
2757
|
+
}), /* @__PURE__ */ Y("button", {
|
|
2758
2758
|
type: "button",
|
|
2759
2759
|
"aria-pressed": e === "source",
|
|
2760
2760
|
onClick: () => t("source"),
|
|
@@ -2764,41 +2764,41 @@ function Vt({ mode: e, onChange: t }) {
|
|
|
2764
2764
|
});
|
|
2765
2765
|
}
|
|
2766
2766
|
function Ht({ values: e, options: t }) {
|
|
2767
|
-
let n = e.before, r = e.after, [i, a] =
|
|
2768
|
-
return /* @__PURE__ */
|
|
2767
|
+
let n = e.before, r = e.after, [i, a] = q(t?.default_mode === "source" ? "source" : "diff"), o = Pt(n), s = Pt(r);
|
|
2768
|
+
return /* @__PURE__ */ X("div", {
|
|
2769
2769
|
className: "flex flex-col gap-2",
|
|
2770
|
-
children: [/* @__PURE__ */
|
|
2770
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2771
2771
|
className: "flex items-center justify-between",
|
|
2772
|
-
children: [/* @__PURE__ */
|
|
2772
|
+
children: [/* @__PURE__ */ Y(Vt, {
|
|
2773
2773
|
mode: i,
|
|
2774
2774
|
onChange: a
|
|
2775
|
-
}), o === s && /* @__PURE__ */
|
|
2775
|
+
}), o === s && /* @__PURE__ */ Y("span", {
|
|
2776
2776
|
className: "text-xs text-muted-foreground",
|
|
2777
2777
|
role: "status",
|
|
2778
2778
|
children: "No field changes"
|
|
2779
2779
|
})]
|
|
2780
|
-
}), /* @__PURE__ */
|
|
2780
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2781
2781
|
className: "h-[480px] w-full overflow-hidden rounded border",
|
|
2782
2782
|
role: "group",
|
|
2783
2783
|
"aria-label": Ft,
|
|
2784
|
-
children: /* @__PURE__ */
|
|
2785
|
-
fallback: /* @__PURE__ */
|
|
2784
|
+
children: /* @__PURE__ */ Y(z, {
|
|
2785
|
+
fallback: /* @__PURE__ */ Y(Bt, {
|
|
2786
2786
|
before: n,
|
|
2787
2787
|
after: r
|
|
2788
2788
|
}),
|
|
2789
|
-
children: /* @__PURE__ */
|
|
2790
|
-
fallback: /* @__PURE__ */
|
|
2791
|
-
children: i === "diff" ? /* @__PURE__ */
|
|
2789
|
+
children: /* @__PURE__ */ Y(le, {
|
|
2790
|
+
fallback: /* @__PURE__ */ Y(zt, {}),
|
|
2791
|
+
children: i === "diff" ? /* @__PURE__ */ Y(It, {
|
|
2792
2792
|
before: o,
|
|
2793
2793
|
after: s
|
|
2794
|
-
}) : /* @__PURE__ */
|
|
2794
|
+
}) : /* @__PURE__ */ X("div", {
|
|
2795
2795
|
className: "flex h-full w-full gap-2",
|
|
2796
|
-
children: [/* @__PURE__ */
|
|
2796
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2797
2797
|
className: "min-w-0 flex-1",
|
|
2798
|
-
children: /* @__PURE__ */
|
|
2799
|
-
}), /* @__PURE__ */
|
|
2798
|
+
children: /* @__PURE__ */ Y(Lt, { value: o })
|
|
2799
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2800
2800
|
className: "min-w-0 flex-1",
|
|
2801
|
-
children: /* @__PURE__ */
|
|
2801
|
+
children: /* @__PURE__ */ Y(Lt, { value: s })
|
|
2802
2802
|
})]
|
|
2803
2803
|
})
|
|
2804
2804
|
})
|
|
@@ -2810,27 +2810,27 @@ function Ht({ values: e, options: t }) {
|
|
|
2810
2810
|
//#region src/components/detail-layout/widgets/builtins.ts
|
|
2811
2811
|
var Ut = !1;
|
|
2812
2812
|
function Wt() {
|
|
2813
|
-
Ut ||= (
|
|
2813
|
+
Ut ||= (te("json_diff", Ht), !0);
|
|
2814
2814
|
}
|
|
2815
2815
|
//#endregion
|
|
2816
2816
|
//#region src/components/detail-layout/widgets/WidgetHost.tsx
|
|
2817
2817
|
Wt();
|
|
2818
2818
|
function Gt({ config: e, ctx: t }) {
|
|
2819
|
-
let n =
|
|
2820
|
-
if (!n) return /* @__PURE__ */
|
|
2819
|
+
let n = ne(e.type);
|
|
2820
|
+
if (!n) return /* @__PURE__ */ Y("span", {
|
|
2821
2821
|
className: "text-sm text-muted-foreground",
|
|
2822
2822
|
children: `unknown widget: ${e.type}`
|
|
2823
2823
|
});
|
|
2824
2824
|
let r = e.inputs ?? {}, i = t.record, a = {};
|
|
2825
2825
|
for (let [e, t] of Object.entries(r)) a[e] = i[t];
|
|
2826
|
-
return /* @__PURE__ */
|
|
2826
|
+
return /* @__PURE__ */ Y("div", {
|
|
2827
2827
|
style: {
|
|
2828
2828
|
minWidth: 0,
|
|
2829
2829
|
maxWidth: "100%",
|
|
2830
2830
|
overflowX: "auto",
|
|
2831
2831
|
WebkitOverflowScrolling: "touch"
|
|
2832
2832
|
},
|
|
2833
|
-
children: /* @__PURE__ */
|
|
2833
|
+
children: /* @__PURE__ */ Y(n, {
|
|
2834
2834
|
inputs: r,
|
|
2835
2835
|
values: a,
|
|
2836
2836
|
record: i,
|
|
@@ -2842,41 +2842,41 @@ function Gt({ config: e, ctx: t }) {
|
|
|
2842
2842
|
//#endregion
|
|
2843
2843
|
//#region src/components/detail-layout/LayoutRenderer.tsx
|
|
2844
2844
|
function Kt({ nodes: e, ctx: t }) {
|
|
2845
|
-
return /* @__PURE__ */ J
|
|
2845
|
+
return /* @__PURE__ */ Y(J, { children: e.map((e, n) => /* @__PURE__ */ Y($, {
|
|
2846
2846
|
node: e,
|
|
2847
2847
|
ctx: t
|
|
2848
2848
|
}, n)) });
|
|
2849
2849
|
}
|
|
2850
2850
|
function $({ node: e, ctx: t }) {
|
|
2851
|
-
return e.row ? /* @__PURE__ */
|
|
2851
|
+
return e.row ? /* @__PURE__ */ Y(ye, {
|
|
2852
2852
|
config: e.row,
|
|
2853
2853
|
ctx: t
|
|
2854
|
-
}) : e.column ? /* @__PURE__ */
|
|
2854
|
+
}) : e.column ? /* @__PURE__ */ Y(Se, {
|
|
2855
2855
|
config: e.column,
|
|
2856
2856
|
node: e,
|
|
2857
2857
|
ctx: t
|
|
2858
|
-
}) : e.tabs ? /* @__PURE__ */
|
|
2858
|
+
}) : e.tabs ? /* @__PURE__ */ Y(Te, {
|
|
2859
2859
|
config: e.tabs,
|
|
2860
2860
|
ctx: t
|
|
2861
|
-
}) : e.section ? /* @__PURE__ */
|
|
2861
|
+
}) : e.section ? /* @__PURE__ */ Y(Ee, {
|
|
2862
2862
|
config: e.section,
|
|
2863
2863
|
ctx: t
|
|
2864
|
-
}) : e.children ? /* @__PURE__ */
|
|
2864
|
+
}) : e.children ? /* @__PURE__ */ Y(mt, {
|
|
2865
2865
|
node: e,
|
|
2866
2866
|
ctx: t
|
|
2867
|
-
}) : e.associated ? /* @__PURE__ */
|
|
2867
|
+
}) : e.associated ? /* @__PURE__ */ Y(j, {
|
|
2868
2868
|
node: e,
|
|
2869
2869
|
ctx: t
|
|
2870
|
-
}) : e.fields ? /* @__PURE__ */
|
|
2870
|
+
}) : e.fields ? /* @__PURE__ */ Y(Ct, {
|
|
2871
2871
|
fields: e.fields,
|
|
2872
2872
|
ctx: t
|
|
2873
|
-
}) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */
|
|
2873
|
+
}) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ Y(Gt, {
|
|
2874
2874
|
config: e.widget,
|
|
2875
2875
|
ctx: t
|
|
2876
|
-
}) : null : /* @__PURE__ */
|
|
2876
|
+
}) : null : /* @__PURE__ */ Y(jt, {
|
|
2877
2877
|
node: e,
|
|
2878
2878
|
ctx: t
|
|
2879
|
-
}) : /* @__PURE__ */
|
|
2879
|
+
}) : /* @__PURE__ */ Y(Et, {
|
|
2880
2880
|
node: e,
|
|
2881
2881
|
ctx: t
|
|
2882
2882
|
});
|