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