@declarion/react 0.54.0 → 0.54.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/dist-lib/{DraggableChildrenTable-CPoUY99R.js → DraggableChildrenTable-Djc7QDzR.js} +32 -32
- package/dist-lib/{Grid--QAEby8k.js → Grid-Bd2r0_4J.js} +45 -45
- package/dist-lib/{LayoutRenderer-BxZ7Nd9b.js → LayoutRenderer-V6nf9aa_.js} +716 -714
- package/dist-lib/{ListCardsBody-BPV4GPrv.js → ListCardsBody-Cdsvu0Vs.js} +29 -29
- package/dist-lib/{MarkdownRenderer-CIKuh_0i.js → MarkdownRenderer-CZo5ZgM7.js} +1 -1
- package/dist-lib/{RefreshControl-DMLkZP3R.js → RefreshControl-CJm3vz9p.js} +40 -40
- package/dist-lib/{SmartDetailPage.impl-SnNu6Ug-.js → SmartDetailPage.impl-DoIjCzjQ.js} +492 -492
- package/dist-lib/{SmartListPage.impl-C73pR7Iw.js → SmartListPage.impl-DnM8e14t.js} +743 -742
- package/dist-lib/{SmartRecordListPage.impl-rJjQZe1V.js → SmartRecordListPage.impl-BmHGYbD9.js} +128 -128
- package/dist-lib/{SortHeaderMenu-DQ_KrkWk.js → SortHeaderMenu-CA53NerB.js} +1 -1
- package/dist-lib/{action-dispatch-DsuUS7ae.js → action-dispatch-JcUrLFaW.js} +177 -177
- package/dist-lib/api/events.d.ts +13 -4
- package/dist-lib/{cardProjection-BadzqyeQ.js → cardProjection-Q2kwqv8V.js} +19 -19
- package/dist-lib/components/pages/list/ListToolbar.d.ts +5 -3
- package/dist-lib/components/pages/list/useListQuery.d.ts +1 -5
- package/dist-lib/{field-classification-sMkkAEg9.js → field-classification-ssZvtr8J.js} +268 -397
- package/dist-lib/{format-count-B5SLlNOb.js → format-count-DHuivNT7.js} +236 -236
- package/dist-lib/hooks/useEntityData.d.ts +7 -0
- package/dist-lib/hooks/useRealtimeThresholds.d.ts +1 -0
- package/dist-lib/hooks/useSSE.d.ts +0 -1
- package/dist-lib/index.js +806 -806
- package/dist-lib/lib/realtime-query-keys.d.ts +22 -0
- package/dist-lib/lib/realtime-reconcile.d.ts +0 -9
- package/dist-lib/lib/realtime-resync.d.ts +23 -0
- package/dist-lib/{peekDraftStore-CbHFwz_F.js → peekDraftStore-lm9ViVLA.js} +17 -17
- package/dist-lib/{registry-D0RhCnEL.js → registry-DsQFhEAD.js} +511 -511
- package/dist-lib/stores/realtime.d.ts +86 -19
- package/dist-lib/testing.js +40 -40
- package/dist-lib/{useCurrentScreen-DVTXCj_K.js → useCurrentScreen-aHx9HH1m.js} +2472 -1963
- package/dist-lib/useListQuery-DZn2BAxY.js +96 -0
- package/dist-lib/{useProperties-BcIz-MyO.js → useProperties-CAqKmUKg.js} +25 -25
- package/dist-lib/{useTabSearchMirror-UYCsopxP.js → useTabSearchMirror-DYW9WoK7.js} +10 -10
- package/dist-lib/{value-CQzGOI0F.js → value-CzKQPJOp.js} +4 -4
- package/package.json +4 -4
- package/dist-lib/useListQuery-C2nq58YV.js +0 -90
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
-
import { $n as n,
|
|
3
|
-
import { c as
|
|
4
|
-
import { C as
|
|
5
|
-
import { m as
|
|
6
|
-
import { o as
|
|
7
|
-
import { n as
|
|
8
|
-
import { Suspense as
|
|
9
|
-
import { useInfiniteQuery as
|
|
2
|
+
import { $n as n, $t as r, Br as i, Cr as a, D as o, Gn as s, I as c, Ir as l, Mr as u, O as d, Or as f, Qn as p, Qt as m, St as h, Vr as g, Zn as _, Zt as v, b as y, cr as b, et as x, ir as S, jt as C, ln as w, mr as T, nr as E, nt as D, pr as O, rr as k, sr as A, tr as j, tt as M, wn as ee, xt as N, zr as P } from "./useCurrentScreen-aHx9HH1m.js";
|
|
3
|
+
import { c as F, d as I, f as L, l as R, o as z, r as B, s as V, t as H } from "./registry-DsQFhEAD.js";
|
|
4
|
+
import { C as te, O as ne, c as re, n as ie, t as ae, x as oe } from "./field-classification-ssZvtr8J.js";
|
|
5
|
+
import { m as se, p as ce } from "./action-dispatch-JcUrLFaW.js";
|
|
6
|
+
import { o as le } from "./cardProjection-Q2kwqv8V.js";
|
|
7
|
+
import { n as ue, r as de, t as fe } from "./dataTableStyles-vwD1mVOP.js";
|
|
8
|
+
import { Suspense as pe, createContext as me, lazy as he, useCallback as U, useContext as ge, useEffect as W, useId as _e, useLayoutEffect as ve, useMemo as G, useRef as K, useState as q } from "react";
|
|
9
|
+
import { useInfiniteQuery as ye, useMutation as be, useQueryClient as xe } from "@tanstack/react-query";
|
|
10
10
|
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
11
11
|
//#region src/lib/size-value.ts
|
|
12
|
-
var
|
|
13
|
-
function
|
|
12
|
+
var Se = /^(\d+)px$/;
|
|
13
|
+
function Ce(e) {
|
|
14
14
|
if (e == null || e === "") return null;
|
|
15
15
|
if (e === "auto") return { kind: "auto" };
|
|
16
16
|
if (e === "fill") return { kind: "fill" };
|
|
17
|
-
let t =
|
|
17
|
+
let t = Se.exec(e);
|
|
18
18
|
if (t) {
|
|
19
19
|
let e = parseInt(t[1], 10);
|
|
20
20
|
return e > 0 ? {
|
|
@@ -30,7 +30,7 @@ function we(e) {
|
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/components/detail-layout/LayoutRow.tsx
|
|
33
|
-
function
|
|
33
|
+
function we({ config: e, ctx: t }) {
|
|
34
34
|
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);
|
|
35
35
|
W(() => {
|
|
36
36
|
if (o === 0) return;
|
|
@@ -42,7 +42,7 @@ function Te({ config: e, ctx: t }) {
|
|
|
42
42
|
return t.observe(e), () => t.disconnect();
|
|
43
43
|
}, [o]);
|
|
44
44
|
let [u, d] = q(null), f = K(null), p = U(() => n.map((t) => {
|
|
45
|
-
let n =
|
|
45
|
+
let n = Ce(t.width ?? t.column?.width ?? t.row?.width ?? e.width);
|
|
46
46
|
return n && n.kind === "weight" ? n.value : 1;
|
|
47
47
|
}), [n, e.width]), m = U((e, t) => {
|
|
48
48
|
t.preventDefault();
|
|
@@ -61,20 +61,20 @@ function Te({ config: e, ctx: t }) {
|
|
|
61
61
|
f.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
62
62
|
};
|
|
63
63
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
64
|
-
}, [u, p]), h = u ?? p(), g = e.height ?
|
|
64
|
+
}, [u, p]), h = u ?? p(), g = e.height ? Ee(e.height) : void 0;
|
|
65
65
|
return /* @__PURE__ */ Y("div", {
|
|
66
66
|
ref: l,
|
|
67
|
-
className:
|
|
67
|
+
className: R("flex", s && "flex-col"),
|
|
68
68
|
style: {
|
|
69
69
|
gap: r ? `${r}px` : void 0,
|
|
70
70
|
...g
|
|
71
71
|
},
|
|
72
72
|
children: n.map((r, a) => /* @__PURE__ */ X("div", {
|
|
73
|
-
className:
|
|
74
|
-
style: s ? void 0 :
|
|
73
|
+
className: R("min-w-0 flex items-stretch", s && "w-full"),
|
|
74
|
+
style: s ? void 0 : Te(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
|
|
75
75
|
children: [/* @__PURE__ */ Y("div", {
|
|
76
|
-
className:
|
|
77
|
-
children: /* @__PURE__ */ Y(
|
|
76
|
+
className: R("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
|
|
77
|
+
children: /* @__PURE__ */ Y(gn, {
|
|
78
78
|
node: r,
|
|
79
79
|
ctx: t
|
|
80
80
|
})
|
|
@@ -85,17 +85,17 @@ function Te({ config: e, ctx: t }) {
|
|
|
85
85
|
}, a))
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
let i =
|
|
88
|
+
function Te(e, t, n, r) {
|
|
89
|
+
let i = Ce(e), a;
|
|
90
90
|
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", {
|
|
91
91
|
flex: a,
|
|
92
92
|
minWidth: n,
|
|
93
93
|
maxWidth: r
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Ee(e) {
|
|
97
97
|
if (!e) return;
|
|
98
|
-
let t =
|
|
98
|
+
let t = Ce(e);
|
|
99
99
|
if (t?.kind === "px") return {
|
|
100
100
|
height: `${t.value}px`,
|
|
101
101
|
overflow: "hidden"
|
|
@@ -107,12 +107,12 @@ function De(e) {
|
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region src/components/detail-layout/LayoutColumn.tsx
|
|
110
|
-
function
|
|
110
|
+
function De({ config: e, ctx: t }) {
|
|
111
111
|
let { items: n, gap: r = 12 } = e;
|
|
112
112
|
return /* @__PURE__ */ Y("div", {
|
|
113
113
|
className: "flex flex-col h-full",
|
|
114
114
|
style: { gap: r ? `${r}px` : void 0 },
|
|
115
|
-
children: n.map((e, n) => /* @__PURE__ */ Y(
|
|
115
|
+
children: n.map((e, n) => /* @__PURE__ */ Y(gn, {
|
|
116
116
|
node: e,
|
|
117
117
|
ctx: t
|
|
118
118
|
}, n))
|
|
@@ -120,23 +120,23 @@ function Oe({ config: e, ctx: t }) {
|
|
|
120
120
|
}
|
|
121
121
|
//#endregion
|
|
122
122
|
//#region src/components/detail-layout/blockMeta.ts
|
|
123
|
-
function
|
|
123
|
+
function Oe(e) {
|
|
124
124
|
return e.children ?? e.associated;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
let n =
|
|
126
|
+
function ke(e, t) {
|
|
127
|
+
let n = Oe(e);
|
|
128
128
|
if (n) {
|
|
129
|
-
if (e.label) return
|
|
129
|
+
if (e.label) return E(e.label);
|
|
130
130
|
let r = t.entity.children?.find((e) => e.entity === n);
|
|
131
|
-
if (r?.display?.name) return
|
|
131
|
+
if (r?.display?.name) return E(r.display.name);
|
|
132
132
|
let i = t.schema.entities[n];
|
|
133
|
-
return i && (
|
|
133
|
+
return i && (E(i.display.name_plural) || E(i.display.name)) || n;
|
|
134
134
|
}
|
|
135
|
-
return e.section ?
|
|
135
|
+
return e.section ? E(e.section.name) : "Tab";
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function Ae(e, t) {
|
|
138
138
|
if (e.icon) return e.icon;
|
|
139
|
-
let n =
|
|
139
|
+
let n = Oe(e);
|
|
140
140
|
if (n) {
|
|
141
141
|
let e = t.entity.children?.find((e) => e.entity === n);
|
|
142
142
|
if (e?.display?.icon) return e.display.icon;
|
|
@@ -146,10 +146,10 @@ function je(e, t) {
|
|
|
146
146
|
}
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/components/detail-layout/LayoutTabs.tsx
|
|
149
|
-
function
|
|
150
|
-
let { items: r } = e, [i, a] = q(0), o =
|
|
149
|
+
function je({ config: e, ctx: n }) {
|
|
150
|
+
let { items: r } = e, [i, a] = q(0), o = u(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
|
|
151
151
|
if (r.length === 0) return null;
|
|
152
|
-
if (
|
|
152
|
+
if (s === "sections") {
|
|
153
153
|
let e = r.map((e, t) => `detail-tab-section-${t}`);
|
|
154
154
|
return /* @__PURE__ */ X("div", {
|
|
155
155
|
style: {
|
|
@@ -168,7 +168,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
168
168
|
WebkitOverflowScrolling: "touch"
|
|
169
169
|
},
|
|
170
170
|
children: r.map((r, i) => {
|
|
171
|
-
let a =
|
|
171
|
+
let a = ke(r, n), o = Ae(r, n);
|
|
172
172
|
return /* @__PURE__ */ X("button", {
|
|
173
173
|
type: "button",
|
|
174
174
|
onClick: () => document.getElementById(e[i])?.scrollIntoView({
|
|
@@ -204,7 +204,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
204
204
|
}, i);
|
|
205
205
|
})
|
|
206
206
|
}), r.map((r, i) => {
|
|
207
|
-
let a =
|
|
207
|
+
let a = ke(r, n), o = Ae(r, n);
|
|
208
208
|
return /* @__PURE__ */ X("section", {
|
|
209
209
|
id: e[i],
|
|
210
210
|
style: {
|
|
@@ -239,7 +239,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
239
239
|
padding: 14,
|
|
240
240
|
minWidth: 0
|
|
241
241
|
},
|
|
242
|
-
children: /* @__PURE__ */ Y(
|
|
242
|
+
children: /* @__PURE__ */ Y(gn, {
|
|
243
243
|
node: r,
|
|
244
244
|
ctx: {
|
|
245
245
|
...n,
|
|
@@ -271,7 +271,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
271
271
|
overflowX: "auto"
|
|
272
272
|
},
|
|
273
273
|
children: r.map((e, r) => {
|
|
274
|
-
let o =
|
|
274
|
+
let o = ke(e, n), s = Ae(e, n), c = r === i;
|
|
275
275
|
return /* @__PURE__ */ X("button", {
|
|
276
276
|
role: "tab",
|
|
277
277
|
"aria-selected": c,
|
|
@@ -321,7 +321,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
321
321
|
}), /* @__PURE__ */ Y("div", {
|
|
322
322
|
role: "tabpanel",
|
|
323
323
|
style: { padding: 14 },
|
|
324
|
-
children: /* @__PURE__ */ Y(
|
|
324
|
+
children: /* @__PURE__ */ Y(gn, {
|
|
325
325
|
node: r[i],
|
|
326
326
|
ctx: {
|
|
327
327
|
...n,
|
|
@@ -333,7 +333,7 @@ function Me({ config: e, ctx: n }) {
|
|
|
333
333
|
}
|
|
334
334
|
//#endregion
|
|
335
335
|
//#region src/components/detail-layout/SectionBlock.tsx
|
|
336
|
-
function
|
|
336
|
+
function Me({ config: e, ctx: n }) {
|
|
337
337
|
let { name: r, items: i, collapsed: a = !1, columns: o, icon: s, badge: c, emphasis: l } = e, u = {
|
|
338
338
|
...n,
|
|
339
339
|
withinCard: !0,
|
|
@@ -342,18 +342,18 @@ function Ne({ config: e, ctx: n }) {
|
|
|
342
342
|
name: s,
|
|
343
343
|
size: 14
|
|
344
344
|
}) : void 0, f = c ? {
|
|
345
|
-
text:
|
|
345
|
+
text: E(c.text),
|
|
346
346
|
tone: c.tone,
|
|
347
347
|
dot: c.dot
|
|
348
348
|
} : void 0;
|
|
349
|
-
return /* @__PURE__ */ Y(
|
|
350
|
-
title:
|
|
349
|
+
return /* @__PURE__ */ Y(L, {
|
|
350
|
+
title: E(r),
|
|
351
351
|
defaultOpen: !a,
|
|
352
352
|
icon: d,
|
|
353
353
|
badge: f,
|
|
354
354
|
emphasis: l,
|
|
355
355
|
headingLevel: n.withinCard ? 3 : 2,
|
|
356
|
-
children: /* @__PURE__ */ Y(
|
|
356
|
+
children: /* @__PURE__ */ Y(hn, {
|
|
357
357
|
nodes: i,
|
|
358
358
|
ctx: u
|
|
359
359
|
})
|
|
@@ -361,22 +361,22 @@ function Ne({ config: e, ctx: n }) {
|
|
|
361
361
|
}
|
|
362
362
|
//#endregion
|
|
363
363
|
//#region src/lib/child-config.ts
|
|
364
|
-
function
|
|
364
|
+
function Ne(e, t, n) {
|
|
365
365
|
let r = e.display, i = Z(n?.mode, r?.mode, "table"), a = i === "timeline" ? 50 : 20, o = {
|
|
366
366
|
entity: e.entity,
|
|
367
367
|
foreign_key: e.foreign_key,
|
|
368
|
-
name: Z(n?.label, r?.name,
|
|
368
|
+
name: Z(n?.label, r?.name, Fe(t)),
|
|
369
369
|
icon: Z(n?.icon, r?.icon, t.display.icon) ?? "",
|
|
370
370
|
mode: i,
|
|
371
|
-
columns: Z(n?.columns, r?.columns,
|
|
372
|
-
sort: Z(n?.sort, r?.sort,
|
|
371
|
+
columns: Z(n?.columns, r?.columns, Le(t, e.foreign_key)),
|
|
372
|
+
sort: Z(n?.sort, r?.sort, Ie(t)),
|
|
373
373
|
limit: Z(n?.limit, r?.limit, a),
|
|
374
374
|
editable: Z(n?.editable, r?.editable, !0),
|
|
375
|
-
interaction: Z(n?.interaction, r?.interaction,
|
|
375
|
+
interaction: Z(n?.interaction, r?.interaction, Pe(t))
|
|
376
376
|
}, s = Z(n?.position_field, r?.position_field, void 0);
|
|
377
377
|
s && (o.position_field = s, o.sort = s + ":asc");
|
|
378
378
|
let c = n?.timeline ?? r?.timeline;
|
|
379
|
-
o.mode === "timeline" ? o.timeline =
|
|
379
|
+
o.mode === "timeline" ? o.timeline = Re(c ?? {}, t) : c && (o.timeline = c);
|
|
380
380
|
let l = n?.cards ?? r?.cards;
|
|
381
381
|
l && (o.cards = l);
|
|
382
382
|
let u = n?.quick_add ?? e.quick_add;
|
|
@@ -385,13 +385,13 @@ function Pe(e, t, n) {
|
|
|
385
385
|
function Z(e, t, n) {
|
|
386
386
|
return e ?? t ?? n;
|
|
387
387
|
}
|
|
388
|
-
function
|
|
389
|
-
return
|
|
388
|
+
function Pe(e) {
|
|
389
|
+
return _(e, "update") ? "inline_edit" : "readonly";
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function Fe(e) {
|
|
392
392
|
return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function Ie(e) {
|
|
395
395
|
if (e.fields.get("created_at")?.type === "timestamp") return "created_at:desc";
|
|
396
396
|
if (e.fields.get("updated_at")?.type === "timestamp") return "updated_at:desc";
|
|
397
397
|
for (let t of e.fields.names()) {
|
|
@@ -402,10 +402,10 @@ function Le(e) {
|
|
|
402
402
|
let n = e.fields.get(t);
|
|
403
403
|
if (n && n.type === "date") return t + ":desc";
|
|
404
404
|
}
|
|
405
|
-
let t =
|
|
405
|
+
let t = We(e);
|
|
406
406
|
return t ? t + ":asc" : "";
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function Le(e, t) {
|
|
409
409
|
let n = new Set(Array.isArray(t) ? t : [t]), r = [];
|
|
410
410
|
for (let t of e.fields.names()) {
|
|
411
411
|
if (r.length >= 6) break;
|
|
@@ -414,11 +414,11 @@ function Re(e, t) {
|
|
|
414
414
|
}
|
|
415
415
|
return r;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function Re(e, t) {
|
|
418
418
|
let n = { ...e };
|
|
419
|
-
return n.time_field ||=
|
|
419
|
+
return n.time_field ||= Ve(t), n.type_field ||= He(t, "enum"), n.summary_field ||= Ue(t, "string", "text", "rich_text"), n.content_field ||= Ue(t, "rich_text", "text"), n.summary_field && n.content_field && n.summary_field === n.content_field && (n.summary_field = void 0), n.author_field || t.fields.get("created_by") && (n.author_field = "created_by"), n.direction_field ||= ze(t), n.intent_field ||= Be(t), n;
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function ze(e) {
|
|
422
422
|
let t = e.fields.get("direction");
|
|
423
423
|
if (t && t.type === "enum") return "direction";
|
|
424
424
|
for (let t of [
|
|
@@ -431,11 +431,11 @@ function Be(e) {
|
|
|
431
431
|
if (n && n.type === "bool") return t;
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Be(e) {
|
|
435
435
|
let t = e.fields.get("intent");
|
|
436
436
|
if (t && t.type === "enum") return "intent";
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function Ve(e) {
|
|
439
439
|
for (let t of e.fields.names()) {
|
|
440
440
|
let n = e.fields.get(t);
|
|
441
441
|
if (n && n.type === "timestamp" && !n.auto) return t;
|
|
@@ -447,13 +447,13 @@ function He(e) {
|
|
|
447
447
|
if (n && n.type === "timestamp") return t;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function He(e, t) {
|
|
451
451
|
for (let n of e.fields.names()) {
|
|
452
452
|
let r = e.fields.get(n);
|
|
453
453
|
if (r && r.type === t) return n;
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function Ue(e, ...t) {
|
|
457
457
|
for (let n of e.fields.names()) {
|
|
458
458
|
let r = e.fields.get(n);
|
|
459
459
|
if (r) {
|
|
@@ -461,28 +461,28 @@ function We(e, ...t) {
|
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
function
|
|
465
|
-
let t =
|
|
464
|
+
function We(e) {
|
|
465
|
+
let t = j(e);
|
|
466
466
|
return t.length > 0 ? t[0] : void 0;
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function Ge(e, t) {
|
|
469
469
|
return e.children?.find((e) => e.entity === t);
|
|
470
470
|
}
|
|
471
471
|
//#endregion
|
|
472
472
|
//#region src/lib/quick-add.ts
|
|
473
|
-
function
|
|
474
|
-
let
|
|
473
|
+
function Ke(e, t, n, r) {
|
|
474
|
+
let i = {
|
|
475
475
|
...t ?? {},
|
|
476
476
|
...e
|
|
477
477
|
};
|
|
478
|
-
if (Array.isArray(
|
|
479
|
-
let e = Array.isArray(
|
|
480
|
-
if (!e || e.length !==
|
|
481
|
-
for (let t = 0; t <
|
|
482
|
-
} else
|
|
483
|
-
return
|
|
484
|
-
}
|
|
485
|
-
function
|
|
478
|
+
if (Array.isArray(n)) {
|
|
479
|
+
let e = Array.isArray(r) ? r.map(String) : S(String(r), n.length);
|
|
480
|
+
if (!e || e.length !== n.length) throw Error("invalid composite parent id");
|
|
481
|
+
for (let t = 0; t < n.length; t++) i[n[t]] = e[t];
|
|
482
|
+
} else i[n] = Array.isArray(r) ? r[0] : r;
|
|
483
|
+
return i;
|
|
484
|
+
}
|
|
485
|
+
function qe(e, t) {
|
|
486
486
|
for (let n of t) {
|
|
487
487
|
let t = e[n];
|
|
488
488
|
if (t == null || t === "") return !1;
|
|
@@ -491,27 +491,27 @@ function Je(e, t) {
|
|
|
491
491
|
}
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region src/components/detail-layout/useQuickAdd.ts
|
|
494
|
-
function
|
|
494
|
+
function Je(e, t, n, r) {
|
|
495
495
|
let [i, a] = q(() => {
|
|
496
496
|
let t = e.quick_add, n = r.entities[e.entity], i = {};
|
|
497
|
-
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] =
|
|
497
|
+
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = O()) : i[e] = t.defaults[e];
|
|
498
498
|
return i;
|
|
499
|
-
}),
|
|
500
|
-
mutationFn: (t) =>
|
|
499
|
+
}), s = xe(), { mutate: c, isPending: l, error: u, reset: d } = be({
|
|
500
|
+
mutationFn: (t) => v(e.entity, t),
|
|
501
501
|
onMutate: async (r) => {
|
|
502
|
-
let i = Array.isArray(n) ?
|
|
503
|
-
|
|
502
|
+
let i = Array.isArray(n) ? k(n.map(String)) : n, a = [
|
|
503
|
+
o,
|
|
504
504
|
t,
|
|
505
505
|
i,
|
|
506
506
|
e.entity
|
|
507
507
|
];
|
|
508
|
-
await
|
|
509
|
-
let
|
|
508
|
+
await s.cancelQueries({ queryKey: a });
|
|
509
|
+
let c = s.getQueriesData({ queryKey: a }), l = {
|
|
510
510
|
...r,
|
|
511
511
|
id: `__optimistic_${crypto.randomUUID()}`,
|
|
512
512
|
__optimistic: !0
|
|
513
513
|
};
|
|
514
|
-
return
|
|
514
|
+
return s.setQueriesData({ queryKey: a }, (e) => {
|
|
515
515
|
if (!e || typeof e != "object") return e;
|
|
516
516
|
if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
|
|
517
517
|
let t = e, [n, ...r] = t.pages;
|
|
@@ -519,59 +519,59 @@ function Ye(e, t, n, r) {
|
|
|
519
519
|
...t,
|
|
520
520
|
pages: [{
|
|
521
521
|
...n,
|
|
522
|
-
data: [
|
|
522
|
+
data: [l, ...n.data]
|
|
523
523
|
}, ...r]
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
526
|
return e;
|
|
527
|
-
}), { snapshots:
|
|
527
|
+
}), { snapshots: c };
|
|
528
528
|
},
|
|
529
529
|
onError: (e, t, n) => {
|
|
530
|
-
if (n?.snapshots) for (let [e, t] of n.snapshots)
|
|
530
|
+
if (n?.snapshots) for (let [e, t] of n.snapshots) s.setQueryData(e, t);
|
|
531
531
|
},
|
|
532
532
|
onSuccess: () => {
|
|
533
533
|
let t = e.quick_add, n = r.entities[e.entity], i = {};
|
|
534
|
-
if (t?.fields) for (let e of t.fields) i[e] = t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ?
|
|
534
|
+
if (t?.fields) for (let e of t.fields) i[e] = t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? O() : "" : t.defaults[e];
|
|
535
535
|
a(i);
|
|
536
536
|
},
|
|
537
537
|
onSettled: () => {
|
|
538
|
-
let r = Array.isArray(n) ?
|
|
539
|
-
|
|
540
|
-
|
|
538
|
+
let r = Array.isArray(n) ? k(n.map(String)) : n;
|
|
539
|
+
s.invalidateQueries({ queryKey: [
|
|
540
|
+
o,
|
|
541
541
|
t,
|
|
542
542
|
r,
|
|
543
543
|
e.entity
|
|
544
544
|
] });
|
|
545
545
|
}
|
|
546
|
-
}),
|
|
546
|
+
}), f = e.quick_add, p = r.entities[e.entity], m = qe(i, f?.fields.filter((e) => p?.fields.get(e)?.required) ?? []);
|
|
547
547
|
function h(t) {
|
|
548
|
-
if (t.preventDefault(), !
|
|
549
|
-
let r =
|
|
550
|
-
|
|
548
|
+
if (t.preventDefault(), !f) return;
|
|
549
|
+
let r = Ke(i, f.defaults, e.foreign_key, n);
|
|
550
|
+
c(r);
|
|
551
551
|
}
|
|
552
|
-
function
|
|
553
|
-
|
|
552
|
+
function g(e, t) {
|
|
553
|
+
u && d(), a((n) => ({
|
|
554
554
|
...n,
|
|
555
555
|
[e]: t
|
|
556
556
|
}));
|
|
557
557
|
}
|
|
558
558
|
return {
|
|
559
559
|
values: i,
|
|
560
|
-
quickAdd:
|
|
561
|
-
childEntity:
|
|
562
|
-
isPending:
|
|
563
|
-
error:
|
|
560
|
+
quickAdd: f,
|
|
561
|
+
childEntity: p,
|
|
562
|
+
isPending: l,
|
|
563
|
+
error: u,
|
|
564
564
|
isReady: m,
|
|
565
565
|
handleSubmit: h,
|
|
566
|
-
handleFieldChange:
|
|
566
|
+
handleFieldChange: g
|
|
567
567
|
};
|
|
568
568
|
}
|
|
569
569
|
//#endregion
|
|
570
570
|
//#region src/components/detail-layout/QuickAddForm.tsx
|
|
571
|
-
function
|
|
572
|
-
let { values:
|
|
573
|
-
return !
|
|
574
|
-
onSubmit:
|
|
571
|
+
function Ye({ config: t, parentEntity: r, parentId: i, schema: a }) {
|
|
572
|
+
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: d, isReady: f, handleSubmit: p, handleFieldChange: m } = Je(t, r, i, a), h = x(), _ = u(), v = _e();
|
|
573
|
+
return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ X("form", {
|
|
574
|
+
onSubmit: p,
|
|
575
575
|
style: {
|
|
576
576
|
display: "flex",
|
|
577
577
|
flexDirection: _.isPhone ? "column" : "row",
|
|
@@ -581,10 +581,10 @@ function Xe({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
581
581
|
borderBottom: "1px solid var(--divider)"
|
|
582
582
|
},
|
|
583
583
|
children: [
|
|
584
|
-
|
|
585
|
-
let
|
|
586
|
-
if (!
|
|
587
|
-
let
|
|
584
|
+
s.fields.map((e) => {
|
|
585
|
+
let r = c.fields.get(e);
|
|
586
|
+
if (!r) return null;
|
|
587
|
+
let i = `${v}-quick-add-${t.entity}-${e}`, s = `${i}-label`;
|
|
588
588
|
return /* @__PURE__ */ X("div", {
|
|
589
589
|
style: {
|
|
590
590
|
flex: 1,
|
|
@@ -592,8 +592,8 @@ function Xe({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
592
592
|
width: _.isPhone ? "100%" : void 0
|
|
593
593
|
},
|
|
594
594
|
children: [/* @__PURE__ */ Y("label", {
|
|
595
|
-
id:
|
|
596
|
-
htmlFor:
|
|
595
|
+
id: s,
|
|
596
|
+
htmlFor: i,
|
|
597
597
|
style: {
|
|
598
598
|
fontSize: 11,
|
|
599
599
|
color: "var(--text-3)",
|
|
@@ -601,56 +601,56 @@ function Xe({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
601
601
|
display: "block",
|
|
602
602
|
fontWeight: 500
|
|
603
603
|
},
|
|
604
|
-
children:
|
|
605
|
-
}),
|
|
606
|
-
field:
|
|
604
|
+
children: n(r, e, a.entities)
|
|
605
|
+
}), M({
|
|
606
|
+
field: r,
|
|
607
607
|
fieldName: e,
|
|
608
|
-
value:
|
|
608
|
+
value: o[e] ?? "",
|
|
609
609
|
mode: "edit",
|
|
610
|
-
onChange: (t) =>
|
|
611
|
-
record:
|
|
612
|
-
fieldId:
|
|
613
|
-
labelId:
|
|
614
|
-
locale:
|
|
610
|
+
onChange: (t) => m(e, t),
|
|
611
|
+
record: o,
|
|
612
|
+
fieldId: i,
|
|
613
|
+
labelId: s,
|
|
614
|
+
locale: h
|
|
615
615
|
})]
|
|
616
616
|
}, e);
|
|
617
617
|
}),
|
|
618
|
-
/* @__PURE__ */ Y(
|
|
618
|
+
/* @__PURE__ */ Y(g, {
|
|
619
619
|
type: "submit",
|
|
620
620
|
kind: "primary",
|
|
621
621
|
size: _.isPhone ? "md" : "sm",
|
|
622
622
|
icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
|
|
623
|
-
disabled:
|
|
623
|
+
disabled: l || !f,
|
|
624
624
|
style: _.isPhone ? { alignSelf: "flex-end" } : void 0,
|
|
625
625
|
children: "Add"
|
|
626
626
|
}),
|
|
627
|
-
|
|
627
|
+
d != null && /* @__PURE__ */ Y("span", {
|
|
628
628
|
style: {
|
|
629
629
|
fontSize: 11,
|
|
630
630
|
color: "var(--danger)",
|
|
631
631
|
alignSelf: "flex-end",
|
|
632
632
|
marginBottom: 4
|
|
633
633
|
},
|
|
634
|
-
children:
|
|
634
|
+
children: d.message
|
|
635
635
|
})
|
|
636
636
|
]
|
|
637
637
|
});
|
|
638
638
|
}
|
|
639
639
|
//#endregion
|
|
640
640
|
//#region src/components/detail-layout/useManualColumnResize.tsx
|
|
641
|
-
function
|
|
641
|
+
function Xe(e, t, n) {
|
|
642
642
|
return `${e}::child::${t}.${n}`;
|
|
643
643
|
}
|
|
644
|
-
function
|
|
645
|
-
return Math.min(
|
|
644
|
+
function Ze(e) {
|
|
645
|
+
return Math.min(oe, Math.max(60, Math.round(e)));
|
|
646
646
|
}
|
|
647
|
-
function
|
|
648
|
-
let { widths: t, setWidths: n, resetWidths: r } =
|
|
647
|
+
function Qe(e) {
|
|
648
|
+
let { widths: t, setWidths: n, resetWidths: r } = te(e), [i, a] = q({}), o = K(null);
|
|
649
649
|
W(() => {
|
|
650
650
|
let e = (e) => {
|
|
651
651
|
let t = o.current;
|
|
652
652
|
if (!t) return;
|
|
653
|
-
let n =
|
|
653
|
+
let n = Ze(t.startWidth + (e.clientX - t.startX));
|
|
654
654
|
t.current = n, a({ [t.colId]: n });
|
|
655
655
|
}, t = () => {
|
|
656
656
|
let e = o.current;
|
|
@@ -700,7 +700,7 @@ function $e(e) {
|
|
|
700
700
|
resetWidths: r
|
|
701
701
|
};
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function $e({ colId: e, onMouseDown: t }) {
|
|
704
704
|
return /* @__PURE__ */ Y("span", {
|
|
705
705
|
"data-testid": "col-resize-handle",
|
|
706
706
|
"aria-hidden": "true",
|
|
@@ -728,32 +728,32 @@ function et({ colId: e, onMouseDown: t }) {
|
|
|
728
728
|
}
|
|
729
729
|
//#endregion
|
|
730
730
|
//#region src/components/detail-layout/ChildrenTable.tsx
|
|
731
|
-
function
|
|
732
|
-
let s = o.entities[t.entity],
|
|
733
|
-
|
|
734
|
-
let
|
|
731
|
+
function et({ config: t, parentEntity: r, parentId: a, schema: o }) {
|
|
732
|
+
let s = o.entities[t.entity], c = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, l = Qe(Xe(r, t.entity, c)), u = x(), p = y(s?.realtime, t.entity), { data: m, isLoading: h, isError: g, refetch: _ } = d(r, a, t.entity, t.foreign_key, t.sort, t.limit), { refreshing: v, refresh: S } = re(_), C = m?.data ?? [], w = m?.$refs, E = K(w);
|
|
733
|
+
E.current = w;
|
|
734
|
+
let O = t.columns, k = t.interaction === "navigate", A = O[0], j = k && s ? b(void 0, s, o.screens) : null, M = s ? We(s) : void 0, ee = G(() => {
|
|
735
735
|
let e = /* @__PURE__ */ new Map();
|
|
736
736
|
if (!s) return e;
|
|
737
|
-
for (let t of
|
|
737
|
+
for (let t of O) {
|
|
738
738
|
let n = s.fields.get(t);
|
|
739
|
-
n && e.set(t,
|
|
739
|
+
n && e.set(t, D({
|
|
740
740
|
field: n,
|
|
741
741
|
fieldName: t,
|
|
742
742
|
surface: "list",
|
|
743
743
|
entity: s,
|
|
744
744
|
entities: o.entities,
|
|
745
745
|
screens: o.screens,
|
|
746
|
-
refs: () =>
|
|
747
|
-
locale:
|
|
746
|
+
refs: () => E.current,
|
|
747
|
+
locale: u
|
|
748
748
|
}));
|
|
749
749
|
}
|
|
750
750
|
return e;
|
|
751
751
|
}, [
|
|
752
752
|
s,
|
|
753
|
-
|
|
753
|
+
O,
|
|
754
754
|
o.entities,
|
|
755
755
|
o.screens,
|
|
756
|
-
|
|
756
|
+
u
|
|
757
757
|
]);
|
|
758
758
|
if (!s) return /* @__PURE__ */ Y("div", {
|
|
759
759
|
style: {
|
|
@@ -763,12 +763,12 @@ function tt({ config: t, parentEntity: n, parentId: i, schema: o }) {
|
|
|
763
763
|
},
|
|
764
764
|
children: "Entity not found."
|
|
765
765
|
});
|
|
766
|
-
let
|
|
766
|
+
let N = /* @__PURE__ */ Y(Ye, {
|
|
767
767
|
config: t,
|
|
768
|
-
parentEntity:
|
|
769
|
-
parentId:
|
|
768
|
+
parentEntity: r,
|
|
769
|
+
parentId: a,
|
|
770
770
|
schema: o
|
|
771
|
-
}),
|
|
771
|
+
}), F = /* @__PURE__ */ X("div", {
|
|
772
772
|
style: {
|
|
773
773
|
display: "flex",
|
|
774
774
|
alignItems: "center",
|
|
@@ -777,38 +777,40 @@ function tt({ config: t, parentEntity: n, parentId: i, schema: o }) {
|
|
|
777
777
|
justifyContent: "flex-end"
|
|
778
778
|
},
|
|
779
779
|
children: [
|
|
780
|
-
|
|
780
|
+
l.hasWidths && /* @__PURE__ */ Y(i, {
|
|
781
781
|
icon: /* @__PURE__ */ Y(e.columns, { size: 13 }),
|
|
782
782
|
title: "Reset column widths (this device)",
|
|
783
783
|
size: 24,
|
|
784
|
-
onClick:
|
|
784
|
+
onClick: l.resetWidths
|
|
785
785
|
}),
|
|
786
|
-
|
|
786
|
+
s.realtime === !0 && /* @__PURE__ */ Y("span", {
|
|
787
787
|
"data-testid": "children-live-indicator",
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
788
|
+
role: "status",
|
|
789
|
+
"aria-label": p ? "Live" : "Updates paused",
|
|
790
|
+
title: p ? "This table updates automatically in realtime." : "Realtime updates are paused. Refresh manually to load the latest data.",
|
|
791
|
+
children: /* @__PURE__ */ Y(P, {
|
|
792
|
+
tone: p ? "emerald" : "amber",
|
|
791
793
|
size: "xs",
|
|
792
794
|
dot: !0,
|
|
793
|
-
children: "Live"
|
|
795
|
+
children: p ? "Live" : "Updates paused"
|
|
794
796
|
})
|
|
795
797
|
}),
|
|
796
|
-
/* @__PURE__ */ Y(
|
|
797
|
-
icon:
|
|
798
|
+
/* @__PURE__ */ Y(i, {
|
|
799
|
+
icon: v ? /* @__PURE__ */ Y("span", {
|
|
798
800
|
"data-testid": "children-refresh-spinner",
|
|
799
801
|
style: { display: "inline-flex" },
|
|
800
|
-
children: /* @__PURE__ */ Y(
|
|
802
|
+
children: /* @__PURE__ */ Y(f, { size: 13 })
|
|
801
803
|
}) : /* @__PURE__ */ Y(e.refresh, { size: 13 }),
|
|
802
804
|
title: "Refresh",
|
|
803
805
|
size: 24,
|
|
804
|
-
disabled:
|
|
805
|
-
onClick:
|
|
806
|
+
disabled: v,
|
|
807
|
+
onClick: S
|
|
806
808
|
})
|
|
807
809
|
]
|
|
808
810
|
});
|
|
809
|
-
return
|
|
811
|
+
return g ? /* @__PURE__ */ X("div", { children: [
|
|
812
|
+
N,
|
|
810
813
|
F,
|
|
811
|
-
L,
|
|
812
814
|
/* @__PURE__ */ Y("div", {
|
|
813
815
|
style: {
|
|
814
816
|
fontSize: 12.5,
|
|
@@ -817,9 +819,9 @@ function tt({ config: t, parentEntity: n, parentId: i, schema: o }) {
|
|
|
817
819
|
},
|
|
818
820
|
children: "Failed to load. Try again."
|
|
819
821
|
})
|
|
820
|
-
] }) :
|
|
822
|
+
] }) : h ? /* @__PURE__ */ X("div", { children: [
|
|
823
|
+
N,
|
|
821
824
|
F,
|
|
822
|
-
L,
|
|
823
825
|
/* @__PURE__ */ Y("div", {
|
|
824
826
|
style: {
|
|
825
827
|
display: "flex",
|
|
@@ -837,9 +839,9 @@ function tt({ config: t, parentEntity: n, parentId: i, schema: o }) {
|
|
|
837
839
|
borderRadius: 4
|
|
838
840
|
} }, e))
|
|
839
841
|
})
|
|
840
|
-
] }) :
|
|
842
|
+
] }) : C.length === 0 ? /* @__PURE__ */ X("div", { children: [
|
|
843
|
+
N,
|
|
841
844
|
F,
|
|
842
|
-
L,
|
|
843
845
|
/* @__PURE__ */ Y("div", {
|
|
844
846
|
style: {
|
|
845
847
|
fontSize: 12.5,
|
|
@@ -849,28 +851,28 @@ function tt({ config: t, parentEntity: n, parentId: i, schema: o }) {
|
|
|
849
851
|
children: "No records yet."
|
|
850
852
|
})
|
|
851
853
|
] }) : /* @__PURE__ */ X("div", { children: [
|
|
854
|
+
N,
|
|
852
855
|
F,
|
|
853
|
-
L,
|
|
854
856
|
/* @__PURE__ */ Y("div", {
|
|
855
857
|
style: { overflowX: "auto" },
|
|
856
858
|
children: /* @__PURE__ */ X("table", {
|
|
857
|
-
style:
|
|
858
|
-
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children:
|
|
859
|
+
style: de,
|
|
860
|
+
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: O.map((e) => {
|
|
859
861
|
let t = s.fields.get(e);
|
|
860
862
|
return /* @__PURE__ */ X("th", {
|
|
861
|
-
style:
|
|
862
|
-
children: [t ?
|
|
863
|
+
style: l.headerStyle(e, ue),
|
|
864
|
+
children: [t ? n(t, e, o.entities) : e, /* @__PURE__ */ Y($e, {
|
|
863
865
|
colId: e,
|
|
864
|
-
onMouseDown:
|
|
866
|
+
onMouseDown: l.onHandleMouseDown
|
|
865
867
|
})]
|
|
866
868
|
}, e);
|
|
867
|
-
}) }) }), /* @__PURE__ */ Y("tbody", { children:
|
|
868
|
-
let n =
|
|
869
|
-
return /* @__PURE__ */ Y("tr", { children:
|
|
870
|
-
let n = t === A, i =
|
|
869
|
+
}) }) }), /* @__PURE__ */ Y("tbody", { children: C.map((e, t) => {
|
|
870
|
+
let n = M ? T(e[M]) : "", r = k && j && n ? j.replace(/:\w+/, n) : void 0;
|
|
871
|
+
return /* @__PURE__ */ Y("tr", { children: O.map((t) => {
|
|
872
|
+
let n = t === A, i = ee.get(t), a = i ? i(e[t], e) : T(e[t]);
|
|
871
873
|
return /* @__PURE__ */ Y("td", {
|
|
872
874
|
title: typeof a == "string" ? a : void 0,
|
|
873
|
-
style:
|
|
875
|
+
style: l.cellStyle(t, fe),
|
|
874
876
|
children: n && r ? /* @__PURE__ */ Y("a", {
|
|
875
877
|
href: r,
|
|
876
878
|
style: {
|
|
@@ -883,7 +885,7 @@ function tt({ config: t, parentEntity: n, parentId: i, schema: o }) {
|
|
|
883
885
|
children: a
|
|
884
886
|
}) : a
|
|
885
887
|
}, t);
|
|
886
|
-
}) },
|
|
888
|
+
}) }, T(e.id ?? t));
|
|
887
889
|
}) })]
|
|
888
890
|
})
|
|
889
891
|
})
|
|
@@ -891,9 +893,9 @@ function tt({ config: t, parentEntity: n, parentId: i, schema: o }) {
|
|
|
891
893
|
}
|
|
892
894
|
//#endregion
|
|
893
895
|
//#region src/components/detail-layout/ChildrenList.tsx
|
|
894
|
-
function
|
|
895
|
-
let
|
|
896
|
-
if (!
|
|
896
|
+
function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
897
|
+
let i = r.entities[e.entity], a = x(), { data: o, isLoading: c, isError: l } = d(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = o?.data ?? [], f = o?.$refs, p = e.columns;
|
|
898
|
+
if (!i) return /* @__PURE__ */ Y("div", {
|
|
897
899
|
style: {
|
|
898
900
|
fontSize: 12.5,
|
|
899
901
|
color: "var(--text-3)",
|
|
@@ -901,13 +903,13 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: a }) {
|
|
|
901
903
|
},
|
|
902
904
|
children: "Entity not found."
|
|
903
905
|
});
|
|
904
|
-
let m = /* @__PURE__ */ Y(
|
|
906
|
+
let m = /* @__PURE__ */ Y(Ye, {
|
|
905
907
|
config: e,
|
|
906
908
|
parentEntity: t,
|
|
907
909
|
parentId: n,
|
|
908
|
-
schema:
|
|
910
|
+
schema: r
|
|
909
911
|
});
|
|
910
|
-
if (
|
|
912
|
+
if (l) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ Y("div", {
|
|
911
913
|
style: {
|
|
912
914
|
fontSize: 12.5,
|
|
913
915
|
color: "var(--danger)",
|
|
@@ -915,7 +917,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: a }) {
|
|
|
915
917
|
},
|
|
916
918
|
children: "Failed to load. Try again."
|
|
917
919
|
})] });
|
|
918
|
-
if (
|
|
920
|
+
if (c) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ X("div", {
|
|
919
921
|
style: {
|
|
920
922
|
display: "flex",
|
|
921
923
|
flexDirection: "column",
|
|
@@ -941,7 +943,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: a }) {
|
|
|
941
943
|
} })
|
|
942
944
|
]
|
|
943
945
|
})] });
|
|
944
|
-
if (
|
|
946
|
+
if (u.length === 0) return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ Y("div", {
|
|
945
947
|
style: {
|
|
946
948
|
fontSize: 12.5,
|
|
947
949
|
color: "var(--text-3)",
|
|
@@ -949,14 +951,14 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: a }) {
|
|
|
949
951
|
},
|
|
950
952
|
children: "No records yet."
|
|
951
953
|
})] });
|
|
952
|
-
let h = p.length > 0 ?
|
|
954
|
+
let h = p.length > 0 ? i.display.display_field ?? p[0] : i.display.display_field;
|
|
953
955
|
return /* @__PURE__ */ X("div", { children: [m, /* @__PURE__ */ Y("div", {
|
|
954
956
|
style: {
|
|
955
957
|
display: "flex",
|
|
956
958
|
flexDirection: "column"
|
|
957
959
|
},
|
|
958
|
-
children:
|
|
959
|
-
let n = typeof e.$display == "string" ? e[
|
|
960
|
+
children: u.map((e, t) => {
|
|
961
|
+
let n = typeof e.$display == "string" ? e[s] : "";
|
|
960
962
|
return /* @__PURE__ */ Y("div", {
|
|
961
963
|
style: {
|
|
962
964
|
display: "flex",
|
|
@@ -977,15 +979,15 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: a }) {
|
|
|
977
979
|
textOverflow: "ellipsis",
|
|
978
980
|
whiteSpace: "nowrap"
|
|
979
981
|
},
|
|
980
|
-
children: n || (h &&
|
|
981
|
-
field:
|
|
982
|
+
children: n || (h && i.fields.get(h) ? M({
|
|
983
|
+
field: i.fields.get(h),
|
|
982
984
|
fieldName: h,
|
|
983
985
|
value: e[h],
|
|
984
986
|
mode: "display",
|
|
985
987
|
record: e,
|
|
986
988
|
refs: f,
|
|
987
|
-
locale:
|
|
988
|
-
}) : h && e[h] != null ?
|
|
989
|
+
locale: a
|
|
990
|
+
}) : h && e[h] != null ? T(e[h]) : null)
|
|
989
991
|
}), p.length > 1 && (() => {
|
|
990
992
|
let t = p.slice(1, 3).filter((t) => e[t] != null);
|
|
991
993
|
return t.length === 0 ? null : /* @__PURE__ */ Y("div", {
|
|
@@ -996,27 +998,27 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: a }) {
|
|
|
996
998
|
textOverflow: "ellipsis",
|
|
997
999
|
whiteSpace: "nowrap"
|
|
998
1000
|
},
|
|
999
|
-
children: t.map((t, n) => /* @__PURE__ */ X("span", { children: [n > 0 && " · ",
|
|
1000
|
-
field:
|
|
1001
|
+
children: t.map((t, n) => /* @__PURE__ */ X("span", { children: [n > 0 && " · ", i.fields.get(t) ? M({
|
|
1002
|
+
field: i.fields.get(t),
|
|
1001
1003
|
fieldName: t,
|
|
1002
1004
|
value: e[t],
|
|
1003
1005
|
mode: "display",
|
|
1004
1006
|
record: e,
|
|
1005
1007
|
refs: f,
|
|
1006
|
-
locale:
|
|
1008
|
+
locale: a
|
|
1007
1009
|
}) : String(e[t])] }, t))
|
|
1008
1010
|
});
|
|
1009
1011
|
})()]
|
|
1010
1012
|
})
|
|
1011
|
-
},
|
|
1013
|
+
}, T(e.id ?? t));
|
|
1012
1014
|
})
|
|
1013
1015
|
})] });
|
|
1014
1016
|
}
|
|
1015
1017
|
//#endregion
|
|
1016
1018
|
//#region src/components/detail-layout/ChildrenCards.tsx
|
|
1017
|
-
function
|
|
1018
|
-
let
|
|
1019
|
-
if (!
|
|
1019
|
+
function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1020
|
+
let i = r.entities[e.entity], a = x(), { data: o, isLoading: s, isError: c } = d(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], u = o?.$refs, f = e.columns, p = e.cards, m = p?.header_field ?? f[0], h = p?.badge_field, g = p?.columns_count ?? 3;
|
|
1021
|
+
if (!i) return /* @__PURE__ */ Y("div", {
|
|
1020
1022
|
style: {
|
|
1021
1023
|
fontSize: 12.5,
|
|
1022
1024
|
color: "var(--text-3)",
|
|
@@ -1024,17 +1026,17 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1024
1026
|
},
|
|
1025
1027
|
children: "Entity not found."
|
|
1026
1028
|
});
|
|
1027
|
-
let
|
|
1029
|
+
let _ = {
|
|
1028
1030
|
display: "grid",
|
|
1029
|
-
gridTemplateColumns: `repeat(auto-fill, minmax(${
|
|
1031
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${g >= 4 ? 180 : 240}px, 1fr))`,
|
|
1030
1032
|
gap: 12
|
|
1031
|
-
},
|
|
1033
|
+
}, v = /* @__PURE__ */ Y(Ye, {
|
|
1032
1034
|
config: e,
|
|
1033
1035
|
parentEntity: t,
|
|
1034
1036
|
parentId: n,
|
|
1035
|
-
schema:
|
|
1037
|
+
schema: r
|
|
1036
1038
|
});
|
|
1037
|
-
if (
|
|
1039
|
+
if (c) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
1038
1040
|
style: {
|
|
1039
1041
|
fontSize: 12.5,
|
|
1040
1042
|
color: "var(--danger)",
|
|
@@ -1042,8 +1044,8 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1042
1044
|
},
|
|
1043
1045
|
children: "Failed to load. Try again."
|
|
1044
1046
|
})] });
|
|
1045
|
-
if (
|
|
1046
|
-
style:
|
|
1047
|
+
if (s) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
1048
|
+
style: _,
|
|
1047
1049
|
children: [
|
|
1048
1050
|
0,
|
|
1049
1051
|
1,
|
|
@@ -1054,7 +1056,7 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1054
1056
|
borderRadius: 10
|
|
1055
1057
|
} }, e))
|
|
1056
1058
|
})] });
|
|
1057
|
-
if (
|
|
1059
|
+
if (l.length === 0) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
1058
1060
|
style: {
|
|
1059
1061
|
fontSize: 12.5,
|
|
1060
1062
|
color: "var(--text-3)",
|
|
@@ -1062,10 +1064,10 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1062
1064
|
},
|
|
1063
1065
|
children: "No records yet."
|
|
1064
1066
|
})] });
|
|
1065
|
-
let
|
|
1066
|
-
return /* @__PURE__ */ X("div", { children: [
|
|
1067
|
-
style:
|
|
1068
|
-
children:
|
|
1067
|
+
let y = f.filter((e) => e !== m && e !== h);
|
|
1068
|
+
return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
|
|
1069
|
+
style: _,
|
|
1070
|
+
children: l.map((t, n) => /* @__PURE__ */ X("div", {
|
|
1069
1071
|
style: {
|
|
1070
1072
|
background: "var(--surface)",
|
|
1071
1073
|
border: "1px solid var(--border)",
|
|
@@ -1079,7 +1081,7 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1079
1081
|
alignItems: "center",
|
|
1080
1082
|
justifyContent: "space-between",
|
|
1081
1083
|
gap: 8,
|
|
1082
|
-
borderBottom:
|
|
1084
|
+
borderBottom: y.length > 0 ? "1px solid var(--divider)" : "none"
|
|
1083
1085
|
},
|
|
1084
1086
|
children: [/* @__PURE__ */ Y("div", {
|
|
1085
1087
|
style: {
|
|
@@ -1089,38 +1091,38 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1089
1091
|
textOverflow: "ellipsis",
|
|
1090
1092
|
whiteSpace: "nowrap"
|
|
1091
1093
|
},
|
|
1092
|
-
children: m &&
|
|
1093
|
-
field:
|
|
1094
|
+
children: m && i.fields.get(m) ? M({
|
|
1095
|
+
field: i.fields.get(m),
|
|
1094
1096
|
fieldName: m,
|
|
1095
1097
|
value: t[m],
|
|
1096
1098
|
mode: "display",
|
|
1097
1099
|
record: t,
|
|
1098
|
-
refs:
|
|
1099
|
-
locale:
|
|
1100
|
+
refs: u,
|
|
1101
|
+
locale: a
|
|
1100
1102
|
}) : `Record ${n + 1}`
|
|
1101
|
-
}),
|
|
1103
|
+
}), h && t[h] != null && /* @__PURE__ */ Y(P, {
|
|
1102
1104
|
tone: "slate",
|
|
1103
1105
|
size: "xs",
|
|
1104
|
-
children:
|
|
1105
|
-
field:
|
|
1106
|
-
fieldName:
|
|
1107
|
-
value: t[
|
|
1106
|
+
children: i.fields.get(h) ? M({
|
|
1107
|
+
field: i.fields.get(h),
|
|
1108
|
+
fieldName: h,
|
|
1109
|
+
value: t[h],
|
|
1108
1110
|
mode: "display",
|
|
1109
1111
|
record: t,
|
|
1110
|
-
refs:
|
|
1111
|
-
locale:
|
|
1112
|
-
}) :
|
|
1112
|
+
refs: u,
|
|
1113
|
+
locale: a
|
|
1114
|
+
}) : T(t[h])
|
|
1113
1115
|
})]
|
|
1114
|
-
}),
|
|
1116
|
+
}), y.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1115
1117
|
style: {
|
|
1116
1118
|
padding: "10px 14px",
|
|
1117
1119
|
display: "flex",
|
|
1118
1120
|
flexDirection: "column",
|
|
1119
1121
|
gap: 4
|
|
1120
1122
|
},
|
|
1121
|
-
children:
|
|
1122
|
-
let
|
|
1123
|
-
return
|
|
1123
|
+
children: y.slice(0, 4).map((n) => {
|
|
1124
|
+
let o = i.fields.get(n);
|
|
1125
|
+
return o ? /* @__PURE__ */ X("div", {
|
|
1124
1126
|
style: {
|
|
1125
1127
|
display: "flex",
|
|
1126
1128
|
alignItems: "baseline",
|
|
@@ -1132,56 +1134,56 @@ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
|
1132
1134
|
color: "var(--text-3)",
|
|
1133
1135
|
flexShrink: 0
|
|
1134
1136
|
},
|
|
1135
|
-
children: [
|
|
1137
|
+
children: [r.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(r.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
|
|
1136
1138
|
}), /* @__PURE__ */ Y("span", {
|
|
1137
1139
|
style: {
|
|
1138
1140
|
overflow: "hidden",
|
|
1139
1141
|
textOverflow: "ellipsis",
|
|
1140
1142
|
whiteSpace: "nowrap"
|
|
1141
1143
|
},
|
|
1142
|
-
children:
|
|
1143
|
-
field:
|
|
1144
|
+
children: M({
|
|
1145
|
+
field: o,
|
|
1144
1146
|
fieldName: n,
|
|
1145
1147
|
value: t[n],
|
|
1146
1148
|
mode: "display",
|
|
1147
1149
|
record: t,
|
|
1148
|
-
refs:
|
|
1149
|
-
locale:
|
|
1150
|
+
refs: u,
|
|
1151
|
+
locale: a
|
|
1150
1152
|
})
|
|
1151
1153
|
})]
|
|
1152
1154
|
}, n) : null;
|
|
1153
1155
|
})
|
|
1154
1156
|
})]
|
|
1155
|
-
},
|
|
1157
|
+
}, T(t.id ?? n)))
|
|
1156
1158
|
})] });
|
|
1157
1159
|
}
|
|
1158
1160
|
//#endregion
|
|
1159
1161
|
//#region src/hooks/useTimelineData.ts
|
|
1160
|
-
var
|
|
1161
|
-
function
|
|
1162
|
-
let s = Array.isArray(
|
|
1162
|
+
var rt = 50;
|
|
1163
|
+
function it(e, t, n, r, i, a) {
|
|
1164
|
+
let s = Array.isArray(r) ? r : [r], c = Array.isArray(r) ? S(t, s.length) : [t], l = a ?? rt, u = ye({
|
|
1163
1165
|
queryKey: [
|
|
1164
|
-
|
|
1166
|
+
o,
|
|
1165
1167
|
e,
|
|
1166
1168
|
t,
|
|
1167
|
-
|
|
1169
|
+
n,
|
|
1168
1170
|
"timeline",
|
|
1169
|
-
|
|
1171
|
+
i,
|
|
1170
1172
|
l
|
|
1171
1173
|
],
|
|
1172
1174
|
queryFn: ({ pageParam: e }) => {
|
|
1173
1175
|
let t = new URLSearchParams();
|
|
1174
1176
|
if (!c) throw Error("invalid composite parent id");
|
|
1175
|
-
let
|
|
1177
|
+
let r = s.map((e, t) => ({
|
|
1176
1178
|
field: e,
|
|
1177
1179
|
op: "eq",
|
|
1178
1180
|
value: c[t]
|
|
1179
1181
|
}));
|
|
1180
|
-
return t.set("filters", JSON.stringify(
|
|
1182
|
+
return t.set("filters", JSON.stringify(r)), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(l)), e && t.set("after", e), ee(`/api/data/${n}?${t.toString()}`);
|
|
1181
1183
|
},
|
|
1182
1184
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
1183
1185
|
initialPageParam: void 0,
|
|
1184
|
-
enabled: !!e && !!t && !!
|
|
1186
|
+
enabled: !!e && !!t && !!n && !!r && c !== null
|
|
1185
1187
|
});
|
|
1186
1188
|
return {
|
|
1187
1189
|
rows: G(() => u.data?.pages.flatMap((e) => e.data) ?? [], [u.data?.pages]),
|
|
@@ -1195,68 +1197,68 @@ function at(e, t, r, i, a, o) {
|
|
|
1195
1197
|
}
|
|
1196
1198
|
//#endregion
|
|
1197
1199
|
//#region src/components/detail-layout/TimelineComposer.tsx
|
|
1198
|
-
var
|
|
1199
|
-
function
|
|
1200
|
-
let { values: a, quickAdd: o, childEntity: s, isPending:
|
|
1200
|
+
var at = "quick_entry", ot = 100, st = 240, ct = 800, lt = 80;
|
|
1201
|
+
function ut({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
1202
|
+
let { values: a, quickAdd: o, childEntity: s, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n, r, i), m = x(), [h, _] = q(st), v = K(null), y = K(null), [b, S] = q(ct);
|
|
1201
1203
|
W(() => {
|
|
1202
1204
|
let e = y.current?.parentElement;
|
|
1203
1205
|
if (!e) return;
|
|
1204
1206
|
let t = () => {
|
|
1205
|
-
let t = Math.max(
|
|
1206
|
-
|
|
1207
|
+
let t = Math.max(ot, e.clientHeight - lt);
|
|
1208
|
+
S(Math.min(ct, t));
|
|
1207
1209
|
};
|
|
1208
1210
|
t();
|
|
1209
1211
|
let n = new ResizeObserver(t);
|
|
1210
1212
|
return n.observe(e), () => n.disconnect();
|
|
1211
1213
|
}, []), W(() => {
|
|
1212
|
-
|
|
1214
|
+
_((e) => Math.min(e, b));
|
|
1213
1215
|
}, [b]);
|
|
1214
|
-
let
|
|
1215
|
-
|
|
1216
|
-
let
|
|
1217
|
-
|
|
1218
|
-
let
|
|
1219
|
-
getField: (e) =>
|
|
1216
|
+
let C = K(a);
|
|
1217
|
+
C.current = a;
|
|
1218
|
+
let w = K(p);
|
|
1219
|
+
w.current = p;
|
|
1220
|
+
let T = K({}), E = G(() => ({
|
|
1221
|
+
getField: (e) => C.current[e],
|
|
1220
1222
|
setField: (e, t) => {
|
|
1221
|
-
|
|
1223
|
+
w.current(e, t);
|
|
1222
1224
|
},
|
|
1223
1225
|
focusField: (e) => {
|
|
1224
|
-
let t =
|
|
1226
|
+
let t = T.current[e];
|
|
1225
1227
|
t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
|
|
1226
1228
|
}
|
|
1227
1229
|
}), []);
|
|
1228
|
-
W(() =>
|
|
1229
|
-
let
|
|
1230
|
+
W(() => c(at, E), [E]);
|
|
1231
|
+
let D = U((e) => {
|
|
1230
1232
|
e.preventDefault(), v.current = {
|
|
1231
1233
|
startY: e.clientY,
|
|
1232
1234
|
startHeight: h
|
|
1233
1235
|
};
|
|
1234
1236
|
let t = (e) => {
|
|
1235
1237
|
if (!v.current) return;
|
|
1236
|
-
let t = v.current.startY - e.clientY, n = Math.min(b, Math.max(
|
|
1237
|
-
|
|
1238
|
+
let t = v.current.startY - e.clientY, n = Math.min(b, Math.max(ot, v.current.startHeight + t));
|
|
1239
|
+
_(n);
|
|
1238
1240
|
}, n = () => {
|
|
1239
1241
|
v.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
1240
1242
|
};
|
|
1241
1243
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
1242
1244
|
}, [h, b]);
|
|
1243
1245
|
if (!o || o.fields.length === 0 || !s) return null;
|
|
1244
|
-
let
|
|
1246
|
+
let O = o.fields.find((e) => {
|
|
1245
1247
|
let t = s.fields.get(e);
|
|
1246
1248
|
return t && (t.type === "text" || t.type === "string");
|
|
1247
|
-
}),
|
|
1249
|
+
}), k = [], A = [];
|
|
1248
1250
|
for (let e of o.fields) {
|
|
1249
|
-
if (e ===
|
|
1251
|
+
if (e === O) continue;
|
|
1250
1252
|
let t = s.fields.get(e);
|
|
1251
|
-
t && (t.type === "enum" ?
|
|
1253
|
+
t && (t.type === "enum" ? k.push(e) : A.push(e));
|
|
1252
1254
|
}
|
|
1253
1255
|
let j = (e) => {
|
|
1254
1256
|
let t = s.fields.get(e);
|
|
1255
1257
|
return t ? /* @__PURE__ */ Y("div", {
|
|
1256
1258
|
ref: (t) => {
|
|
1257
|
-
|
|
1259
|
+
T.current[e] = t;
|
|
1258
1260
|
},
|
|
1259
|
-
children:
|
|
1261
|
+
children: M({
|
|
1260
1262
|
field: t,
|
|
1261
1263
|
fieldName: e,
|
|
1262
1264
|
value: a[e] ?? "",
|
|
@@ -1278,7 +1280,7 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1278
1280
|
height: `${h}px`
|
|
1279
1281
|
},
|
|
1280
1282
|
children: [/* @__PURE__ */ Y("div", {
|
|
1281
|
-
onMouseDown:
|
|
1283
|
+
onMouseDown: D,
|
|
1282
1284
|
title: "Drag to resize",
|
|
1283
1285
|
style: {
|
|
1284
1286
|
height: 12,
|
|
@@ -1308,7 +1310,7 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1308
1310
|
padding: "0 12px 8px"
|
|
1309
1311
|
},
|
|
1310
1312
|
children: [
|
|
1311
|
-
|
|
1313
|
+
k.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1312
1314
|
style: {
|
|
1313
1315
|
display: "flex",
|
|
1314
1316
|
flexWrap: "wrap",
|
|
@@ -1316,23 +1318,23 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1316
1318
|
gap: 6,
|
|
1317
1319
|
flexShrink: 0
|
|
1318
1320
|
},
|
|
1319
|
-
children:
|
|
1321
|
+
children: k.map(j)
|
|
1320
1322
|
}),
|
|
1321
|
-
|
|
1323
|
+
O && s.fields.get(O) && /* @__PURE__ */ Y("div", {
|
|
1322
1324
|
style: {
|
|
1323
1325
|
flex: 1,
|
|
1324
1326
|
minHeight: 0,
|
|
1325
1327
|
display: "flex"
|
|
1326
1328
|
},
|
|
1327
1329
|
ref: (e) => {
|
|
1328
|
-
|
|
1330
|
+
T.current[O] = e;
|
|
1329
1331
|
},
|
|
1330
|
-
children:
|
|
1331
|
-
field: s.fields.get(
|
|
1332
|
-
fieldName:
|
|
1333
|
-
value: a[
|
|
1332
|
+
children: M({
|
|
1333
|
+
field: s.fields.get(O),
|
|
1334
|
+
fieldName: O,
|
|
1335
|
+
value: a[O] ?? "",
|
|
1334
1336
|
mode: "edit",
|
|
1335
|
-
onChange: (e) => p(
|
|
1337
|
+
onChange: (e) => p(O, e),
|
|
1336
1338
|
record: a,
|
|
1337
1339
|
fill: !0,
|
|
1338
1340
|
locale: m
|
|
@@ -1369,11 +1371,11 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1369
1371
|
}),
|
|
1370
1372
|
" to add"
|
|
1371
1373
|
]
|
|
1372
|
-
}), /* @__PURE__ */ Y(
|
|
1374
|
+
}), /* @__PURE__ */ Y(g, {
|
|
1373
1375
|
type: "submit",
|
|
1374
1376
|
kind: "primary",
|
|
1375
1377
|
icon: /* @__PURE__ */ Y(e.plus, { size: 13 }),
|
|
1376
|
-
disabled:
|
|
1378
|
+
disabled: l || !d,
|
|
1377
1379
|
children: "Add"
|
|
1378
1380
|
})]
|
|
1379
1381
|
})]
|
|
@@ -1393,70 +1395,70 @@ function dt({ config: t, parentEntity: n, parentId: r, schema: i }) {
|
|
|
1393
1395
|
}
|
|
1394
1396
|
//#endregion
|
|
1395
1397
|
//#region src/components/detail-layout/ChildrenTimeline.tsx
|
|
1396
|
-
var
|
|
1397
|
-
function
|
|
1398
|
-
if (e.length >
|
|
1398
|
+
var dt = 80, ft = 200, pt = 6, mt = 2e4, ht = 280;
|
|
1399
|
+
function gt(e) {
|
|
1400
|
+
if (e.length > ht) return !0;
|
|
1399
1401
|
let t = 0;
|
|
1400
|
-
for (let n of e) if (n === "\n" && ++t >=
|
|
1402
|
+
for (let n of e) if (n === "\n" && ++t >= pt) return !0;
|
|
1401
1403
|
return !1;
|
|
1402
1404
|
}
|
|
1403
|
-
function
|
|
1404
|
-
if (
|
|
1405
|
+
function _t(e, t) {
|
|
1406
|
+
if (vt(t)) {
|
|
1405
1407
|
let e = t.id;
|
|
1406
|
-
return e == null ? "" :
|
|
1408
|
+
return e == null ? "" : T(e);
|
|
1407
1409
|
}
|
|
1408
|
-
return
|
|
1410
|
+
return r(p(e, t));
|
|
1409
1411
|
}
|
|
1410
|
-
function
|
|
1412
|
+
function vt(e) {
|
|
1411
1413
|
return e.__optimistic === !0;
|
|
1412
1414
|
}
|
|
1413
|
-
function
|
|
1414
|
-
let i = r.entities[e.entity], { rows:
|
|
1415
|
+
function yt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1416
|
+
let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: l, isLoading: u, isError: d } = it(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), p = e.timeline, m = p?.scroll ?? !1, h = (e.sort ?? "").endsWith(":asc"), _ = G(() => h ? [...a].reverse() : a, [a, h]), v = p?.auto_scroll ?? "none", y = K(null), b = K(null), x = K(!1), S = K(0), C = K(null), w = K(null), T = K(!0), D = K(null);
|
|
1415
1417
|
W(() => {
|
|
1416
|
-
|
|
1417
|
-
}, [n]),
|
|
1418
|
-
!
|
|
1418
|
+
x.current = !1, S.current = 0, C.current = null, w.current = null, T.current = !0, D.current = null;
|
|
1419
|
+
}, [n]), ve(() => {
|
|
1420
|
+
!l || !y.current || (D.current = {
|
|
1419
1421
|
scrollHeight: y.current.scrollHeight,
|
|
1420
1422
|
scrollTop: y.current.scrollTop
|
|
1421
1423
|
});
|
|
1422
|
-
}, [
|
|
1424
|
+
}, [l]), ve(() => {
|
|
1423
1425
|
let e = y.current;
|
|
1424
1426
|
if (!e || _.length === 0 || !i) {
|
|
1425
|
-
|
|
1427
|
+
S.current = _.length;
|
|
1426
1428
|
return;
|
|
1427
1429
|
}
|
|
1428
|
-
let t =
|
|
1429
|
-
if (r)
|
|
1430
|
+
let t = _t(i, _[0]), n = _t(i, _[_.length - 1]), r = !x.current, a = _.length > S.current && S.current > 0, o = a && (h && t !== C.current && n === w.current || !h && n !== w.current && t === C.current), s = a && !o;
|
|
1431
|
+
if (r) h && v === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
|
|
1430
1432
|
else if (o && D.current) {
|
|
1431
1433
|
let t = D.current;
|
|
1432
|
-
|
|
1433
|
-
} else s &&
|
|
1434
|
-
|
|
1434
|
+
h && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), D.current = null;
|
|
1435
|
+
} else s && h && T.current && (e.scrollTop = e.scrollHeight);
|
|
1436
|
+
S.current = _.length, C.current = t, w.current = n;
|
|
1435
1437
|
}, [
|
|
1436
1438
|
_,
|
|
1437
1439
|
v,
|
|
1438
|
-
|
|
1440
|
+
h,
|
|
1439
1441
|
i
|
|
1440
1442
|
]);
|
|
1441
1443
|
let O = U(() => {
|
|
1442
1444
|
let e = y.current;
|
|
1443
|
-
e && (
|
|
1445
|
+
e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight < dt);
|
|
1444
1446
|
}, []);
|
|
1445
1447
|
W(() => {
|
|
1446
|
-
let e =
|
|
1448
|
+
let e = b.current;
|
|
1447
1449
|
if (!e || typeof IntersectionObserver > "u") return;
|
|
1448
1450
|
let t = new IntersectionObserver((e) => {
|
|
1449
|
-
for (let t of e) t.isIntersecting &&
|
|
1451
|
+
for (let t of e) t.isIntersecting && c && !l && s();
|
|
1450
1452
|
}, {
|
|
1451
1453
|
root: y.current ?? null,
|
|
1452
|
-
rootMargin: `${
|
|
1454
|
+
rootMargin: `${ft}px 0px 0px 0px`,
|
|
1453
1455
|
threshold: 0
|
|
1454
1456
|
});
|
|
1455
1457
|
return t.observe(e), () => t.disconnect();
|
|
1456
1458
|
}, [
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1459
|
+
c,
|
|
1460
|
+
l,
|
|
1461
|
+
s
|
|
1460
1462
|
]);
|
|
1461
1463
|
let [k, A] = q(null);
|
|
1462
1464
|
if (!i) return /* @__PURE__ */ Y("div", {
|
|
@@ -1467,25 +1469,25 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1467
1469
|
},
|
|
1468
1470
|
children: "Entity not found."
|
|
1469
1471
|
});
|
|
1470
|
-
let j = e.quick_add?.fields ?? [
|
|
1472
|
+
let j = e.quick_add?.fields ?? [p?.content_field].filter(Boolean), M = E(i.display?.name_plural) || E(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ Y("div", {
|
|
1471
1473
|
style: {
|
|
1472
1474
|
display: "flex",
|
|
1473
1475
|
justifyContent: "center",
|
|
1474
1476
|
padding: "6px 0"
|
|
1475
1477
|
},
|
|
1476
|
-
children: /* @__PURE__ */ Y(
|
|
1478
|
+
children: /* @__PURE__ */ Y(g, {
|
|
1477
1479
|
size: "xs",
|
|
1478
|
-
onClick: () =>
|
|
1479
|
-
disabled:
|
|
1480
|
-
icon:
|
|
1481
|
-
children:
|
|
1480
|
+
onClick: () => s(),
|
|
1481
|
+
disabled: l,
|
|
1482
|
+
icon: l ? /* @__PURE__ */ Y(f, { size: 11 }) : void 0,
|
|
1483
|
+
children: l ? "Loading…" : "Load older"
|
|
1482
1484
|
})
|
|
1483
|
-
}) : null,
|
|
1484
|
-
ref:
|
|
1485
|
+
}) : null, N = /* @__PURE__ */ Y("div", {
|
|
1486
|
+
ref: b,
|
|
1485
1487
|
"aria-hidden": "true",
|
|
1486
1488
|
style: { height: 1 }
|
|
1487
1489
|
}), P;
|
|
1488
|
-
if (
|
|
1490
|
+
if (d) P = /* @__PURE__ */ Y("div", {
|
|
1489
1491
|
style: {
|
|
1490
1492
|
fontSize: 12.5,
|
|
1491
1493
|
color: "var(--danger)",
|
|
@@ -1493,7 +1495,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1493
1495
|
},
|
|
1494
1496
|
children: "Failed to load."
|
|
1495
1497
|
});
|
|
1496
|
-
else if (
|
|
1498
|
+
else if (u) P = /* @__PURE__ */ X("div", {
|
|
1497
1499
|
style: {
|
|
1498
1500
|
display: "flex",
|
|
1499
1501
|
flexDirection: "column",
|
|
@@ -1510,7 +1512,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1510
1512
|
borderRadius: 8
|
|
1511
1513
|
} })]
|
|
1512
1514
|
});
|
|
1513
|
-
else if (_.length === 0) P = /* @__PURE__ */ X(J, { children: [
|
|
1515
|
+
else if (_.length === 0) P = /* @__PURE__ */ X(J, { children: [N, /* @__PURE__ */ Y("div", {
|
|
1514
1516
|
style: {
|
|
1515
1517
|
fontSize: 12.5,
|
|
1516
1518
|
color: "var(--text-3)",
|
|
@@ -1519,33 +1521,33 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1519
1521
|
children: "No activity yet."
|
|
1520
1522
|
})] });
|
|
1521
1523
|
else {
|
|
1522
|
-
let a = (a,
|
|
1523
|
-
let c =
|
|
1524
|
-
return /* @__PURE__ */ Y(
|
|
1524
|
+
let a = (a, s) => {
|
|
1525
|
+
let c = _t(i, a) || String(s);
|
|
1526
|
+
return /* @__PURE__ */ Y(bt, {
|
|
1525
1527
|
row: a,
|
|
1526
1528
|
rowId: c,
|
|
1527
1529
|
childEntity: i,
|
|
1528
1530
|
entityCode: e.entity,
|
|
1529
1531
|
parentEntity: t,
|
|
1530
1532
|
parentId: n,
|
|
1531
|
-
timeline:
|
|
1533
|
+
timeline: p,
|
|
1532
1534
|
editableFields: j,
|
|
1533
|
-
refs:
|
|
1535
|
+
refs: o,
|
|
1534
1536
|
isEditing: k === c,
|
|
1535
1537
|
onStartEdit: () => A(c),
|
|
1536
1538
|
onCancelEdit: () => A(null),
|
|
1537
1539
|
onSaved: () => A(null),
|
|
1538
1540
|
schema: r,
|
|
1539
|
-
optimistic:
|
|
1541
|
+
optimistic: vt(a)
|
|
1540
1542
|
}, c);
|
|
1541
|
-
},
|
|
1542
|
-
if (
|
|
1543
|
+
}, s = p?.time_field, c;
|
|
1544
|
+
if (s) {
|
|
1543
1545
|
let e = [];
|
|
1544
1546
|
_.forEach((t, n) => {
|
|
1545
|
-
let r = t[
|
|
1547
|
+
let r = t[s], i = St(r), a = e[e.length - 1];
|
|
1546
1548
|
!a || a.key !== i ? e.push({
|
|
1547
1549
|
key: i,
|
|
1548
|
-
label:
|
|
1550
|
+
label: Ct(r),
|
|
1549
1551
|
rows: [{
|
|
1550
1552
|
row: t,
|
|
1551
1553
|
idx: n
|
|
@@ -1560,19 +1562,19 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1560
1562
|
flexDirection: "column",
|
|
1561
1563
|
gap: 8
|
|
1562
1564
|
},
|
|
1563
|
-
children: [/* @__PURE__ */ Y(
|
|
1565
|
+
children: [/* @__PURE__ */ Y(wt, {
|
|
1564
1566
|
label: e.label,
|
|
1565
1567
|
count: e.rows.length
|
|
1566
1568
|
}), e.rows.map(({ row: e, idx: t }) => a(e, t))]
|
|
1567
1569
|
}, `day-${e.key}`));
|
|
1568
1570
|
} else c = _.map((e, t) => a(e, t));
|
|
1569
1571
|
P = /* @__PURE__ */ X(J, { children: [
|
|
1570
|
-
ee,
|
|
1571
1572
|
N,
|
|
1573
|
+
ee,
|
|
1572
1574
|
c
|
|
1573
1575
|
] });
|
|
1574
1576
|
}
|
|
1575
|
-
return
|
|
1577
|
+
return m ? /* @__PURE__ */ X("div", {
|
|
1576
1578
|
style: {
|
|
1577
1579
|
display: "flex",
|
|
1578
1580
|
flexDirection: "column",
|
|
@@ -1610,7 +1612,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1610
1612
|
},
|
|
1611
1613
|
children: P
|
|
1612
1614
|
}),
|
|
1613
|
-
/* @__PURE__ */ Y(
|
|
1615
|
+
/* @__PURE__ */ Y(ut, {
|
|
1614
1616
|
config: e,
|
|
1615
1617
|
parentEntity: t,
|
|
1616
1618
|
parentId: n,
|
|
@@ -1624,59 +1626,59 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1624
1626
|
gap: 8
|
|
1625
1627
|
},
|
|
1626
1628
|
children: P
|
|
1627
|
-
}), /* @__PURE__ */ Y(
|
|
1629
|
+
}), /* @__PURE__ */ Y(ut, {
|
|
1628
1630
|
config: e,
|
|
1629
1631
|
parentEntity: t,
|
|
1630
1632
|
parentId: n,
|
|
1631
1633
|
schema: r
|
|
1632
1634
|
})] });
|
|
1633
1635
|
}
|
|
1634
|
-
function
|
|
1635
|
-
let
|
|
1636
|
-
|
|
1637
|
-
E,
|
|
1636
|
+
function bt({ row: t, rowId: r, childEntity: a, entityCode: s, parentEntity: c, parentId: l, timeline: u, editableFields: d, refs: p, isEditing: h, onStartEdit: _, onCancelEdit: v, onSaved: y, schema: b, optimistic: S = !1 }) {
|
|
1637
|
+
let E = xe(), D = x(), [O, k] = q({}), A = U(() => {
|
|
1638
|
+
E.invalidateQueries({ queryKey: [
|
|
1638
1639
|
o,
|
|
1639
|
-
|
|
1640
|
-
|
|
1640
|
+
c,
|
|
1641
|
+
l,
|
|
1642
|
+
s
|
|
1641
1643
|
] });
|
|
1642
1644
|
}, [
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
]),
|
|
1645
|
+
E,
|
|
1646
|
+
c,
|
|
1647
|
+
l,
|
|
1648
|
+
s
|
|
1649
|
+
]), j = be({
|
|
1648
1650
|
mutationFn: (e) => {
|
|
1649
|
-
let
|
|
1651
|
+
let n = t.$row_version, i = typeof n == "string" && n !== "" ? {
|
|
1650
1652
|
...e,
|
|
1651
|
-
$row_version:
|
|
1653
|
+
$row_version: n
|
|
1652
1654
|
} : e;
|
|
1653
|
-
return
|
|
1655
|
+
return w(s, r, i);
|
|
1654
1656
|
},
|
|
1655
1657
|
onSuccess: () => {
|
|
1656
|
-
A(),
|
|
1658
|
+
A(), C.success("Updated"), y();
|
|
1657
1659
|
},
|
|
1658
|
-
onError: (e) =>
|
|
1659
|
-
}), ee =
|
|
1660
|
-
mutationFn: () =>
|
|
1660
|
+
onError: (e) => C.error(e.message)
|
|
1661
|
+
}), ee = be({
|
|
1662
|
+
mutationFn: () => m(s, r),
|
|
1661
1663
|
onSuccess: () => {
|
|
1662
|
-
A(),
|
|
1664
|
+
A(), C.success("Deleted");
|
|
1663
1665
|
},
|
|
1664
|
-
onError: (e) =>
|
|
1665
|
-
}),
|
|
1666
|
+
onError: (e) => C.error(e.message)
|
|
1667
|
+
}), N = U(() => {
|
|
1666
1668
|
let e = {};
|
|
1667
|
-
for (let n of
|
|
1668
|
-
|
|
1669
|
+
for (let n of d) e[n] = t[n] ?? "";
|
|
1670
|
+
k(e), _();
|
|
1669
1671
|
}, [
|
|
1670
1672
|
t,
|
|
1671
|
-
|
|
1673
|
+
d,
|
|
1672
1674
|
_
|
|
1673
1675
|
]), F = U((e, t) => {
|
|
1674
|
-
|
|
1676
|
+
k((n) => ({
|
|
1675
1677
|
...n,
|
|
1676
1678
|
[e]: t
|
|
1677
1679
|
}));
|
|
1678
|
-
}, []), I =
|
|
1679
|
-
return
|
|
1680
|
+
}, []), I = u?.time_field, L = u?.type_field, R = u?.summary_field, z = u?.content_field, B = u?.author_field, V = u?.direction_field, H = u?.intent_field;
|
|
1681
|
+
return h ? /* @__PURE__ */ X("div", {
|
|
1680
1682
|
style: {
|
|
1681
1683
|
borderRadius: 10,
|
|
1682
1684
|
border: "1px solid var(--accent)",
|
|
@@ -1686,8 +1688,8 @@ function xt({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1686
1688
|
flexDirection: "column",
|
|
1687
1689
|
gap: 8
|
|
1688
1690
|
},
|
|
1689
|
-
children: [
|
|
1690
|
-
let t =
|
|
1691
|
+
children: [d.map((e) => {
|
|
1692
|
+
let t = a.fields.get(e);
|
|
1691
1693
|
return t ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("label", {
|
|
1692
1694
|
style: {
|
|
1693
1695
|
fontSize: 11,
|
|
@@ -1695,15 +1697,15 @@ function xt({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1695
1697
|
marginBottom: 4,
|
|
1696
1698
|
display: "block"
|
|
1697
1699
|
},
|
|
1698
|
-
children:
|
|
1699
|
-
}),
|
|
1700
|
+
children: n(t, e, b.entities)
|
|
1701
|
+
}), M({
|
|
1700
1702
|
field: t,
|
|
1701
1703
|
fieldName: e,
|
|
1702
|
-
value:
|
|
1704
|
+
value: O[e] ?? "",
|
|
1703
1705
|
mode: "edit",
|
|
1704
1706
|
onChange: (t) => F(e, t),
|
|
1705
|
-
record:
|
|
1706
|
-
locale:
|
|
1707
|
+
record: O,
|
|
1708
|
+
locale: D
|
|
1707
1709
|
})] }, e) : null;
|
|
1708
1710
|
}), /* @__PURE__ */ X("div", {
|
|
1709
1711
|
style: {
|
|
@@ -1712,33 +1714,33 @@ function xt({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1712
1714
|
gap: 6,
|
|
1713
1715
|
paddingTop: 4
|
|
1714
1716
|
},
|
|
1715
|
-
children: [/* @__PURE__ */ Y(
|
|
1717
|
+
children: [/* @__PURE__ */ Y(g, {
|
|
1716
1718
|
kind: "primary",
|
|
1717
1719
|
size: "xs",
|
|
1718
|
-
icon:
|
|
1719
|
-
onClick: () =>
|
|
1720
|
-
disabled:
|
|
1721
|
-
children:
|
|
1722
|
-
}), /* @__PURE__ */ Y(
|
|
1720
|
+
icon: j.isPending ? /* @__PURE__ */ Y(f, { size: 12 }) : /* @__PURE__ */ Y(e.check, { size: 12 }),
|
|
1721
|
+
onClick: () => j.mutate(O),
|
|
1722
|
+
disabled: j.isPending,
|
|
1723
|
+
children: j.isPending ? "Saving…" : "Save"
|
|
1724
|
+
}), /* @__PURE__ */ Y(g, {
|
|
1723
1725
|
size: "xs",
|
|
1724
1726
|
icon: /* @__PURE__ */ Y(e.x, { size: 12 }),
|
|
1725
1727
|
onClick: () => {
|
|
1726
|
-
|
|
1728
|
+
k({}), v();
|
|
1727
1729
|
},
|
|
1728
|
-
disabled:
|
|
1730
|
+
disabled: j.isPending,
|
|
1729
1731
|
children: "Cancel"
|
|
1730
1732
|
})]
|
|
1731
1733
|
})]
|
|
1732
1734
|
}) : /* @__PURE__ */ X("div", {
|
|
1733
1735
|
className: "group",
|
|
1734
|
-
"data-optimistic":
|
|
1736
|
+
"data-optimistic": S || void 0,
|
|
1735
1737
|
style: {
|
|
1736
1738
|
borderRadius: 10,
|
|
1737
1739
|
border: "1px solid var(--border)",
|
|
1738
1740
|
background: "var(--surface)",
|
|
1739
1741
|
padding: 12,
|
|
1740
1742
|
transition: "border-color .12s",
|
|
1741
|
-
opacity:
|
|
1743
|
+
opacity: S ? .6 : 1
|
|
1742
1744
|
},
|
|
1743
1745
|
onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
|
|
1744
1746
|
onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
|
|
@@ -1753,74 +1755,74 @@ function xt({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1753
1755
|
color: "var(--text-3)"
|
|
1754
1756
|
},
|
|
1755
1757
|
children: [
|
|
1756
|
-
I && t[I] != null &&
|
|
1758
|
+
I && t[I] != null && a.fields.get(I) && /* @__PURE__ */ Y("span", {
|
|
1757
1759
|
style: { fontWeight: 500 },
|
|
1758
|
-
children:
|
|
1759
|
-
field:
|
|
1760
|
+
children: M({
|
|
1761
|
+
field: a.fields.get(I),
|
|
1760
1762
|
fieldName: I,
|
|
1761
1763
|
value: t[I],
|
|
1762
1764
|
mode: "display",
|
|
1763
1765
|
record: t,
|
|
1764
1766
|
refs: p,
|
|
1765
|
-
locale:
|
|
1767
|
+
locale: D
|
|
1766
1768
|
})
|
|
1767
1769
|
}),
|
|
1768
|
-
L && t[L] != null &&
|
|
1770
|
+
L && t[L] != null && a.fields.get(L) && /* @__PURE__ */ Y(P, {
|
|
1769
1771
|
tone: "slate",
|
|
1770
1772
|
size: "xs",
|
|
1771
|
-
children:
|
|
1772
|
-
field:
|
|
1773
|
+
children: M({
|
|
1774
|
+
field: a.fields.get(L),
|
|
1773
1775
|
fieldName: L,
|
|
1774
1776
|
value: t[L],
|
|
1775
1777
|
mode: "display",
|
|
1776
1778
|
record: t,
|
|
1777
1779
|
refs: p,
|
|
1778
|
-
locale:
|
|
1780
|
+
locale: D
|
|
1779
1781
|
})
|
|
1780
1782
|
}),
|
|
1781
|
-
V && t[V] != null &&
|
|
1783
|
+
V && t[V] != null && a.fields.get(V) && /* @__PURE__ */ Y(Tt, {
|
|
1782
1784
|
value: t[V],
|
|
1783
|
-
field:
|
|
1785
|
+
field: a.fields.get(V)
|
|
1784
1786
|
}),
|
|
1785
|
-
H && t[H] != null &&
|
|
1787
|
+
H && t[H] != null && a.fields.get(H) && /* @__PURE__ */ Y(P, {
|
|
1786
1788
|
tone: "slate",
|
|
1787
1789
|
size: "xs",
|
|
1788
|
-
children:
|
|
1789
|
-
field:
|
|
1790
|
+
children: M({
|
|
1791
|
+
field: a.fields.get(H),
|
|
1790
1792
|
fieldName: H,
|
|
1791
1793
|
value: t[H],
|
|
1792
1794
|
mode: "display",
|
|
1793
1795
|
record: t,
|
|
1794
1796
|
refs: p,
|
|
1795
|
-
locale:
|
|
1797
|
+
locale: D
|
|
1796
1798
|
})
|
|
1797
1799
|
}),
|
|
1798
|
-
B && t[B] != null &&
|
|
1800
|
+
B && t[B] != null && a.fields.get(B) && /* @__PURE__ */ X("span", { children: [
|
|
1799
1801
|
"by",
|
|
1800
1802
|
" ",
|
|
1801
|
-
|
|
1802
|
-
field:
|
|
1803
|
+
M({
|
|
1804
|
+
field: a.fields.get(B),
|
|
1803
1805
|
fieldName: B,
|
|
1804
1806
|
value: t[B],
|
|
1805
1807
|
mode: "display",
|
|
1806
1808
|
record: t,
|
|
1807
1809
|
refs: p,
|
|
1808
|
-
locale:
|
|
1810
|
+
locale: D
|
|
1809
1811
|
})
|
|
1810
1812
|
] }),
|
|
1811
|
-
!
|
|
1813
|
+
!S && /* @__PURE__ */ X("div", {
|
|
1812
1814
|
style: {
|
|
1813
1815
|
marginLeft: "auto",
|
|
1814
1816
|
display: "flex",
|
|
1815
1817
|
alignItems: "center",
|
|
1816
1818
|
gap: 2
|
|
1817
1819
|
},
|
|
1818
|
-
children: [/* @__PURE__ */ Y(
|
|
1820
|
+
children: [/* @__PURE__ */ Y(i, {
|
|
1819
1821
|
size: 22,
|
|
1820
1822
|
icon: /* @__PURE__ */ Y(e.edit, { size: 11 }),
|
|
1821
|
-
onClick:
|
|
1823
|
+
onClick: N,
|
|
1822
1824
|
title: "Edit"
|
|
1823
|
-
}), /* @__PURE__ */ Y(
|
|
1825
|
+
}), /* @__PURE__ */ Y(i, {
|
|
1824
1826
|
size: 22,
|
|
1825
1827
|
icon: /* @__PURE__ */ Y(e.trash, { size: 11 }),
|
|
1826
1828
|
onClick: () => ee.mutate(),
|
|
@@ -1829,59 +1831,59 @@ function xt({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o,
|
|
|
1829
1831
|
})
|
|
1830
1832
|
]
|
|
1831
1833
|
}),
|
|
1832
|
-
R && t[R] != null &&
|
|
1834
|
+
R && t[R] != null && a.fields.get(R) && /* @__PURE__ */ Y("div", {
|
|
1833
1835
|
style: {
|
|
1834
1836
|
fontSize: 12.5,
|
|
1835
1837
|
fontWeight: 500,
|
|
1836
1838
|
marginTop: 6
|
|
1837
1839
|
},
|
|
1838
|
-
children:
|
|
1839
|
-
field:
|
|
1840
|
+
children: M({
|
|
1841
|
+
field: a.fields.get(R),
|
|
1840
1842
|
fieldName: R,
|
|
1841
1843
|
value: t[R],
|
|
1842
1844
|
mode: "display",
|
|
1843
1845
|
record: t,
|
|
1844
1846
|
refs: p,
|
|
1845
|
-
locale:
|
|
1847
|
+
locale: D
|
|
1846
1848
|
})
|
|
1847
1849
|
}),
|
|
1848
|
-
z && t[z] != null && z !== R &&
|
|
1849
|
-
rendered:
|
|
1850
|
-
field:
|
|
1850
|
+
z && t[z] != null && z !== R && a.fields.get(z) && /* @__PURE__ */ Y(xt, {
|
|
1851
|
+
rendered: M({
|
|
1852
|
+
field: a.fields.get(z),
|
|
1851
1853
|
fieldName: z,
|
|
1852
1854
|
value: t[z],
|
|
1853
1855
|
mode: "display",
|
|
1854
1856
|
record: t,
|
|
1855
1857
|
refs: p,
|
|
1856
|
-
locale:
|
|
1858
|
+
locale: D
|
|
1857
1859
|
}),
|
|
1858
|
-
text:
|
|
1860
|
+
text: T(t[z])
|
|
1859
1861
|
})
|
|
1860
1862
|
]
|
|
1861
1863
|
});
|
|
1862
1864
|
}
|
|
1863
|
-
function
|
|
1865
|
+
function xt({ rendered: e, text: t }) {
|
|
1864
1866
|
let n = {
|
|
1865
1867
|
fontSize: 12.5,
|
|
1866
1868
|
fontWeight: 400,
|
|
1867
1869
|
marginTop: 6
|
|
1868
1870
|
};
|
|
1869
|
-
if (!
|
|
1871
|
+
if (!gt(t)) return /* @__PURE__ */ Y("div", {
|
|
1870
1872
|
style: n,
|
|
1871
1873
|
children: e
|
|
1872
1874
|
});
|
|
1873
|
-
let r = t.length >
|
|
1875
|
+
let r = t.length > mt, i = r ? t.slice(0, mt) : t;
|
|
1874
1876
|
return /* @__PURE__ */ Y("div", {
|
|
1875
1877
|
style: {
|
|
1876
1878
|
...n,
|
|
1877
1879
|
display: "-webkit-box",
|
|
1878
1880
|
WebkitBoxOrient: "vertical",
|
|
1879
|
-
WebkitLineClamp:
|
|
1881
|
+
WebkitLineClamp: pt,
|
|
1880
1882
|
overflow: "hidden",
|
|
1881
1883
|
whiteSpace: "pre-wrap",
|
|
1882
1884
|
overflowWrap: "anywhere"
|
|
1883
1885
|
},
|
|
1884
|
-
children: /* @__PURE__ */ Y(
|
|
1886
|
+
children: /* @__PURE__ */ Y(l, {
|
|
1885
1887
|
width: 380,
|
|
1886
1888
|
content: /* @__PURE__ */ X("div", {
|
|
1887
1889
|
style: {
|
|
@@ -1902,14 +1904,14 @@ function St({ rendered: e, text: t }) {
|
|
|
1902
1904
|
})
|
|
1903
1905
|
});
|
|
1904
1906
|
}
|
|
1905
|
-
function
|
|
1907
|
+
function St(e) {
|
|
1906
1908
|
if (e == null) return "";
|
|
1907
|
-
let t = new Date(
|
|
1909
|
+
let t = new Date(T(e));
|
|
1908
1910
|
return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
|
|
1909
1911
|
}
|
|
1910
|
-
function
|
|
1912
|
+
function Ct(e) {
|
|
1911
1913
|
if (e == null) return "—";
|
|
1912
|
-
let t = new Date(
|
|
1914
|
+
let t = new Date(T(e));
|
|
1913
1915
|
if (Number.isNaN(t.getTime())) return "—";
|
|
1914
1916
|
let n = /* @__PURE__ */ new Date(), r = /* @__PURE__ */ new Date();
|
|
1915
1917
|
r.setDate(n.getDate() - 1);
|
|
@@ -1920,7 +1922,7 @@ function wt(e) {
|
|
|
1920
1922
|
day: "numeric"
|
|
1921
1923
|
});
|
|
1922
1924
|
}
|
|
1923
|
-
function
|
|
1925
|
+
function wt({ label: e, count: t }) {
|
|
1924
1926
|
return /* @__PURE__ */ X("div", {
|
|
1925
1927
|
style: {
|
|
1926
1928
|
position: "sticky",
|
|
@@ -1957,8 +1959,8 @@ function Tt({ label: e, count: t }) {
|
|
|
1957
1959
|
]
|
|
1958
1960
|
});
|
|
1959
1961
|
}
|
|
1960
|
-
function
|
|
1961
|
-
let r =
|
|
1962
|
+
function Tt({ value: t, field: n }) {
|
|
1963
|
+
let r = Et(t, n);
|
|
1962
1964
|
return r === null ? null : /* @__PURE__ */ X("span", {
|
|
1963
1965
|
style: {
|
|
1964
1966
|
display: "inline-flex",
|
|
@@ -1974,7 +1976,7 @@ function Et({ value: t, field: n }) {
|
|
|
1974
1976
|
children: [Y(r ? e.arrowUp : e.arrowDown, { size: 10 }), r ? "Out" : "In"]
|
|
1975
1977
|
});
|
|
1976
1978
|
}
|
|
1977
|
-
function
|
|
1979
|
+
function Et(e, t) {
|
|
1978
1980
|
if (t.type === "bool") return e === !0;
|
|
1979
1981
|
if (typeof e == "string") {
|
|
1980
1982
|
let t = e.toLowerCase();
|
|
@@ -1985,71 +1987,71 @@ function Dt(e, t) {
|
|
|
1985
1987
|
}
|
|
1986
1988
|
//#endregion
|
|
1987
1989
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
1988
|
-
function
|
|
1989
|
-
let
|
|
1990
|
+
function Dt({ config: t, childEntity: r, schema: a, rows: o, onChange: s, validationErrors: c, refs: l, forceTablePresentation: d = !1 }) {
|
|
1991
|
+
let f = x(), p = u(), m = K(null), h = t.columns, _ = t.position_field, v = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), y = h.filter((e) => {
|
|
1990
1992
|
if (v.has(e) || t.position_field && e === t.position_field) return !1;
|
|
1991
|
-
let
|
|
1992
|
-
return !(!
|
|
1993
|
-
}), b = new Set(
|
|
1993
|
+
let n = r.fields.get(e);
|
|
1994
|
+
return !(!n || n.auto || n.primary || n.source);
|
|
1995
|
+
}), b = new Set(h.filter((e) => {
|
|
1994
1996
|
if (t.position_field && e === t.position_field) return !0;
|
|
1995
|
-
let
|
|
1996
|
-
return
|
|
1997
|
-
})),
|
|
1998
|
-
|
|
1997
|
+
let n = r.fields.get(e);
|
|
1998
|
+
return n && (n.auto || n.primary || n.source);
|
|
1999
|
+
})), S = U((e, t, n) => {
|
|
2000
|
+
s(o.map((r) => r._key === e ? {
|
|
1999
2001
|
...r,
|
|
2000
2002
|
[t]: n,
|
|
2001
2003
|
_dirty: !0
|
|
2002
2004
|
} : r));
|
|
2003
|
-
}, [
|
|
2005
|
+
}, [o, s]), C = U(() => {
|
|
2004
2006
|
let e = {
|
|
2005
2007
|
_key: crypto.randomUUID(),
|
|
2006
2008
|
_dirty: !0
|
|
2007
2009
|
};
|
|
2008
2010
|
if (_) {
|
|
2009
|
-
let t =
|
|
2011
|
+
let t = o.filter((e) => !e._deleted).reduce((e, t) => {
|
|
2010
2012
|
let n = typeof t[_] == "number" ? t[_] : -1;
|
|
2011
2013
|
return Math.max(e, n);
|
|
2012
2014
|
}, -1);
|
|
2013
2015
|
e[_] = t + 1;
|
|
2014
2016
|
}
|
|
2015
|
-
let
|
|
2017
|
+
let n = t.quick_add?.defaults ?? {};
|
|
2016
2018
|
for (let t of y) {
|
|
2017
|
-
let i =
|
|
2018
|
-
i && (
|
|
2019
|
+
let i = r.fields.get(t);
|
|
2020
|
+
i && (n[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = n[t]);
|
|
2019
2021
|
}
|
|
2020
|
-
|
|
2022
|
+
s([...o, e]);
|
|
2021
2023
|
}, [
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
+
o,
|
|
2025
|
+
s,
|
|
2024
2026
|
y,
|
|
2025
|
-
|
|
2027
|
+
r,
|
|
2026
2028
|
t.quick_add?.defaults,
|
|
2027
2029
|
_
|
|
2028
|
-
]),
|
|
2029
|
-
|
|
2030
|
+
]), w = U((e) => {
|
|
2031
|
+
s(o.map((t) => t._key === e ? {
|
|
2030
2032
|
...t,
|
|
2031
2033
|
_deleted: !0
|
|
2032
2034
|
} : t));
|
|
2033
|
-
}, [
|
|
2034
|
-
|
|
2035
|
+
}, [o, s]), E = U((e) => {
|
|
2036
|
+
s(o.map((t) => t._key === e ? {
|
|
2035
2037
|
...t,
|
|
2036
2038
|
_deleted: !1
|
|
2037
2039
|
} : t));
|
|
2038
|
-
}, [
|
|
2040
|
+
}, [o, s]), D = U((e, t) => {
|
|
2039
2041
|
if (!_) return;
|
|
2040
|
-
let n =
|
|
2041
|
-
if (
|
|
2042
|
-
let c = [...n], [l] = c.splice(
|
|
2043
|
-
c.splice(
|
|
2042
|
+
let n = o.filter((e) => !e._deleted), r = o.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), a = i + t;
|
|
2043
|
+
if (i < 0 || a < 0 || a >= n.length) return;
|
|
2044
|
+
let c = [...n], [l] = c.splice(i, 1);
|
|
2045
|
+
c.splice(a, 0, l), s([...c.map((e, t) => ({
|
|
2044
2046
|
...e,
|
|
2045
2047
|
[_]: t,
|
|
2046
2048
|
_dirty: e[_] !== t || e._dirty
|
|
2047
2049
|
})), ...r]);
|
|
2048
2050
|
}, [
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
+
o,
|
|
2052
|
+
s,
|
|
2051
2053
|
_
|
|
2052
|
-
]),
|
|
2054
|
+
]), O = U((e) => {
|
|
2053
2055
|
let t = e.target, n = t.closest("td");
|
|
2054
2056
|
if (!n) return;
|
|
2055
2057
|
let r = n.closest("tr");
|
|
@@ -2073,7 +2075,7 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2073
2075
|
if (o < t.length - 1) {
|
|
2074
2076
|
let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
|
|
2075
2077
|
e && e.focus();
|
|
2076
|
-
} else
|
|
2078
|
+
} else C(), requestAnimationFrame(() => {
|
|
2077
2079
|
let e = i.querySelectorAll("tr"), t = e[e.length - 1];
|
|
2078
2080
|
if (t) {
|
|
2079
2081
|
let e = t.querySelector("input, select, textarea, [tabindex]");
|
|
@@ -2081,21 +2083,21 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2081
2083
|
}
|
|
2082
2084
|
});
|
|
2083
2085
|
} else e.key === "Escape" && t.blur?.();
|
|
2084
|
-
}, [
|
|
2085
|
-
return
|
|
2086
|
+
}, [C]), k = ue;
|
|
2087
|
+
return p.isPhone && !d ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
2086
2088
|
style: {
|
|
2087
2089
|
display: "flex",
|
|
2088
2090
|
flexDirection: "column",
|
|
2089
2091
|
gap: 10
|
|
2090
2092
|
},
|
|
2091
|
-
children:
|
|
2092
|
-
let
|
|
2093
|
+
children: o.map((t, s) => {
|
|
2094
|
+
let u = !!t._deleted, d = c?.[t._key], p = _ ? o.filter((e) => !e._deleted) : [], m = _ ? p.findIndex((e) => e._key === t._key) : -1;
|
|
2093
2095
|
return /* @__PURE__ */ X("div", {
|
|
2094
2096
|
style: {
|
|
2095
2097
|
border: "1px solid var(--border)",
|
|
2096
2098
|
borderRadius: 8,
|
|
2097
2099
|
background: "var(--surface)",
|
|
2098
|
-
opacity:
|
|
2100
|
+
opacity: u ? .58 : 1,
|
|
2099
2101
|
overflow: "hidden"
|
|
2100
2102
|
},
|
|
2101
2103
|
children: [/* @__PURE__ */ X("div", {
|
|
@@ -2114,34 +2116,34 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2114
2116
|
fontWeight: 600,
|
|
2115
2117
|
color: "var(--text-2)"
|
|
2116
2118
|
},
|
|
2117
|
-
children: ["Row ",
|
|
2119
|
+
children: ["Row ", s + 1]
|
|
2118
2120
|
}), /* @__PURE__ */ X("div", {
|
|
2119
2121
|
style: {
|
|
2120
2122
|
display: "flex",
|
|
2121
2123
|
alignItems: "center",
|
|
2122
2124
|
gap: 4
|
|
2123
2125
|
},
|
|
2124
|
-
children: [_ && !
|
|
2126
|
+
children: [_ && !u && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(i, {
|
|
2125
2127
|
size: 32,
|
|
2126
2128
|
icon: /* @__PURE__ */ Y(e.up, { size: 14 }),
|
|
2127
|
-
onClick: () =>
|
|
2129
|
+
onClick: () => D(t._key, -1),
|
|
2128
2130
|
disabled: m <= 0,
|
|
2129
2131
|
title: "Move row up"
|
|
2130
|
-
}), /* @__PURE__ */ Y(
|
|
2132
|
+
}), /* @__PURE__ */ Y(i, {
|
|
2131
2133
|
size: 32,
|
|
2132
2134
|
icon: /* @__PURE__ */ Y(e.down, { size: 14 }),
|
|
2133
|
-
onClick: () =>
|
|
2134
|
-
disabled: m === -1 || m >=
|
|
2135
|
+
onClick: () => D(t._key, 1),
|
|
2136
|
+
disabled: m === -1 || m >= p.length - 1,
|
|
2135
2137
|
title: "Move row down"
|
|
2136
|
-
})] }),
|
|
2138
|
+
})] }), u ? /* @__PURE__ */ Y(i, {
|
|
2137
2139
|
size: 32,
|
|
2138
2140
|
icon: /* @__PURE__ */ Y(e.refresh, { size: 14 }),
|
|
2139
|
-
onClick: () =>
|
|
2141
|
+
onClick: () => E(t._key),
|
|
2140
2142
|
title: "Undo delete"
|
|
2141
|
-
}) : /* @__PURE__ */ Y(
|
|
2143
|
+
}) : /* @__PURE__ */ Y(i, {
|
|
2142
2144
|
size: 32,
|
|
2143
2145
|
icon: /* @__PURE__ */ Y(e.trash, { size: 14 }),
|
|
2144
|
-
onClick: () =>
|
|
2146
|
+
onClick: () => w(t._key),
|
|
2145
2147
|
title: "Delete row"
|
|
2146
2148
|
})]
|
|
2147
2149
|
})]
|
|
@@ -2152,28 +2154,28 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2152
2154
|
flexDirection: "column",
|
|
2153
2155
|
gap: 12
|
|
2154
2156
|
},
|
|
2155
|
-
children:
|
|
2156
|
-
let i =
|
|
2157
|
-
outline:
|
|
2157
|
+
children: h.map((e) => {
|
|
2158
|
+
let i = r.fields.get(e), o = d?.includes(e), s = b.has(e), c = i ? n(i, e, a.entities) : e, p = `child-${t._key}-${e}`, m = `${p}-label`, h = {
|
|
2159
|
+
outline: o ? "1px solid var(--danger)" : "none",
|
|
2158
2160
|
outlineOffset: 3,
|
|
2159
|
-
borderRadius:
|
|
2161
|
+
borderRadius: o ? 5 : 0
|
|
2160
2162
|
}, g = {
|
|
2161
2163
|
fontSize: 11.5,
|
|
2162
2164
|
fontWeight: 600,
|
|
2163
2165
|
color: "var(--text-3)"
|
|
2164
|
-
}, _ = !
|
|
2166
|
+
}, _ = !u && !s && !!i;
|
|
2165
2167
|
return /* @__PURE__ */ X("div", {
|
|
2166
2168
|
style: {
|
|
2167
2169
|
display: "flex",
|
|
2168
2170
|
flexDirection: "column",
|
|
2169
2171
|
gap: 5,
|
|
2170
2172
|
minWidth: 0,
|
|
2171
|
-
textDecoration:
|
|
2173
|
+
textDecoration: u ? "line-through" : "none"
|
|
2172
2174
|
},
|
|
2173
|
-
title:
|
|
2175
|
+
title: o ? `${e} is required` : void 0,
|
|
2174
2176
|
children: [_ ? /* @__PURE__ */ Y("label", {
|
|
2175
2177
|
id: m,
|
|
2176
|
-
htmlFor:
|
|
2178
|
+
htmlFor: p,
|
|
2177
2179
|
style: g,
|
|
2178
2180
|
children: c
|
|
2179
2181
|
}) : /* @__PURE__ */ Y("div", {
|
|
@@ -2182,29 +2184,29 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2182
2184
|
children: c
|
|
2183
2185
|
}), /* @__PURE__ */ Y("div", {
|
|
2184
2186
|
style: h,
|
|
2185
|
-
children:
|
|
2187
|
+
children: u || s ? i ? M({
|
|
2186
2188
|
field: i,
|
|
2187
2189
|
fieldName: e,
|
|
2188
2190
|
value: t[e],
|
|
2189
2191
|
mode: "display",
|
|
2190
2192
|
record: t,
|
|
2191
|
-
refs:
|
|
2192
|
-
fieldId:
|
|
2193
|
+
refs: l,
|
|
2194
|
+
fieldId: p,
|
|
2193
2195
|
labelId: m,
|
|
2194
|
-
locale:
|
|
2195
|
-
}) :
|
|
2196
|
+
locale: f
|
|
2197
|
+
}) : T(t[e]) : i ? M({
|
|
2196
2198
|
field: i,
|
|
2197
2199
|
fieldName: e,
|
|
2198
2200
|
value: t[e],
|
|
2199
2201
|
mode: "edit",
|
|
2200
|
-
onChange: (n) =>
|
|
2202
|
+
onChange: (n) => S(t._key, e, n),
|
|
2201
2203
|
record: t,
|
|
2202
|
-
refs:
|
|
2204
|
+
refs: l,
|
|
2203
2205
|
compact: !0,
|
|
2204
|
-
fieldId:
|
|
2206
|
+
fieldId: p,
|
|
2205
2207
|
labelId: m,
|
|
2206
|
-
locale:
|
|
2207
|
-
}) :
|
|
2208
|
+
locale: f
|
|
2209
|
+
}) : T(t[e])
|
|
2208
2210
|
})]
|
|
2209
2211
|
}, e);
|
|
2210
2212
|
})
|
|
@@ -2213,51 +2215,51 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2213
2215
|
})
|
|
2214
2216
|
}), /* @__PURE__ */ Y("div", {
|
|
2215
2217
|
style: { marginTop: 10 },
|
|
2216
|
-
children: /* @__PURE__ */ Y(
|
|
2218
|
+
children: /* @__PURE__ */ Y(g, {
|
|
2217
2219
|
kind: "ghost",
|
|
2218
2220
|
size: "sm",
|
|
2219
2221
|
icon: /* @__PURE__ */ Y(e.plus, { size: 14 }),
|
|
2220
|
-
onClick:
|
|
2222
|
+
onClick: C,
|
|
2221
2223
|
children: "Add row"
|
|
2222
2224
|
})
|
|
2223
2225
|
})] }) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
|
|
2224
2226
|
style: { overflowX: "auto" },
|
|
2225
2227
|
children: /* @__PURE__ */ X("table", {
|
|
2226
|
-
ref:
|
|
2227
|
-
style:
|
|
2228
|
-
onKeyDown:
|
|
2229
|
-
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", { children: [
|
|
2230
|
-
let t =
|
|
2228
|
+
ref: m,
|
|
2229
|
+
style: de,
|
|
2230
|
+
onKeyDown: O,
|
|
2231
|
+
children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", { children: [h.map((e) => {
|
|
2232
|
+
let t = r.fields.get(e);
|
|
2231
2233
|
return /* @__PURE__ */ Y("th", {
|
|
2232
|
-
style:
|
|
2233
|
-
children: t ?
|
|
2234
|
+
style: k,
|
|
2235
|
+
children: t ? n(t, e, a.entities) : e
|
|
2234
2236
|
}, e);
|
|
2235
2237
|
}), /* @__PURE__ */ Y("th", { style: {
|
|
2236
|
-
...
|
|
2238
|
+
...k,
|
|
2237
2239
|
width: 40
|
|
2238
|
-
} })] }) }), /* @__PURE__ */ Y("tbody", { children:
|
|
2239
|
-
let
|
|
2240
|
+
} })] }) }), /* @__PURE__ */ Y("tbody", { children: o.map((t) => {
|
|
2241
|
+
let n = !!t._deleted, a = c?.[t._key];
|
|
2240
2242
|
return /* @__PURE__ */ X("tr", {
|
|
2241
|
-
style: { opacity:
|
|
2242
|
-
children: [
|
|
2243
|
-
let
|
|
2244
|
-
return
|
|
2243
|
+
style: { opacity: n ? .5 : 1 },
|
|
2244
|
+
children: [h.map((e) => {
|
|
2245
|
+
let i = r.fields.get(e), o = a?.includes(e), s = b.has(e);
|
|
2246
|
+
return n || s ? /* @__PURE__ */ Y("td", {
|
|
2245
2247
|
style: {
|
|
2246
2248
|
padding: "6px 12px",
|
|
2247
2249
|
borderBottom: "1px solid var(--divider)",
|
|
2248
2250
|
verticalAlign: "middle",
|
|
2249
|
-
textDecoration:
|
|
2251
|
+
textDecoration: n ? "line-through" : "none",
|
|
2250
2252
|
color: "var(--text-2)"
|
|
2251
2253
|
},
|
|
2252
|
-
children:
|
|
2253
|
-
field:
|
|
2254
|
+
children: i ? M({
|
|
2255
|
+
field: i,
|
|
2254
2256
|
fieldName: e,
|
|
2255
2257
|
value: t[e],
|
|
2256
2258
|
mode: "display",
|
|
2257
2259
|
record: t,
|
|
2258
|
-
refs:
|
|
2259
|
-
locale:
|
|
2260
|
-
}) :
|
|
2260
|
+
refs: l,
|
|
2261
|
+
locale: f
|
|
2262
|
+
}) : T(t[e])
|
|
2261
2263
|
}, e) : /* @__PURE__ */ Y("td", {
|
|
2262
2264
|
style: {
|
|
2263
2265
|
padding: "4px 4px",
|
|
@@ -2268,17 +2270,17 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2268
2270
|
borderRadius: o ? 4 : 0
|
|
2269
2271
|
},
|
|
2270
2272
|
title: o ? `${e} is required` : void 0,
|
|
2271
|
-
children:
|
|
2272
|
-
field:
|
|
2273
|
+
children: i ? M({
|
|
2274
|
+
field: i,
|
|
2273
2275
|
fieldName: e,
|
|
2274
2276
|
value: t[e],
|
|
2275
2277
|
mode: "edit",
|
|
2276
|
-
onChange: (n) =>
|
|
2278
|
+
onChange: (n) => S(t._key, e, n),
|
|
2277
2279
|
record: t,
|
|
2278
|
-
refs:
|
|
2280
|
+
refs: l,
|
|
2279
2281
|
compact: !0,
|
|
2280
|
-
locale:
|
|
2281
|
-
}) :
|
|
2282
|
+
locale: f
|
|
2283
|
+
}) : T(t[e])
|
|
2282
2284
|
}, e);
|
|
2283
2285
|
}), /* @__PURE__ */ Y("td", {
|
|
2284
2286
|
style: {
|
|
@@ -2286,15 +2288,15 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2286
2288
|
borderBottom: "1px solid var(--divider)",
|
|
2287
2289
|
verticalAlign: "middle"
|
|
2288
2290
|
},
|
|
2289
|
-
children:
|
|
2291
|
+
children: n ? /* @__PURE__ */ Y(i, {
|
|
2290
2292
|
size: 24,
|
|
2291
2293
|
icon: /* @__PURE__ */ Y(e.refresh, { size: 12 }),
|
|
2292
|
-
onClick: () =>
|
|
2294
|
+
onClick: () => E(t._key),
|
|
2293
2295
|
title: "Undo delete"
|
|
2294
|
-
}) : /* @__PURE__ */ Y(
|
|
2296
|
+
}) : /* @__PURE__ */ Y(i, {
|
|
2295
2297
|
size: 24,
|
|
2296
2298
|
icon: /* @__PURE__ */ Y(e.trash, { size: 12 }),
|
|
2297
|
-
onClick: () =>
|
|
2299
|
+
onClick: () => w(t._key),
|
|
2298
2300
|
title: "Delete row"
|
|
2299
2301
|
})
|
|
2300
2302
|
})]
|
|
@@ -2303,48 +2305,48 @@ function Ot({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
|
|
|
2303
2305
|
})
|
|
2304
2306
|
}), /* @__PURE__ */ Y("div", {
|
|
2305
2307
|
style: { marginTop: 8 },
|
|
2306
|
-
children: /* @__PURE__ */ Y(
|
|
2308
|
+
children: /* @__PURE__ */ Y(g, {
|
|
2307
2309
|
kind: "ghost",
|
|
2308
2310
|
size: "xs",
|
|
2309
2311
|
icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
|
|
2310
|
-
onClick:
|
|
2312
|
+
onClick: C,
|
|
2311
2313
|
children: "Add row"
|
|
2312
2314
|
})
|
|
2313
2315
|
})] });
|
|
2314
2316
|
}
|
|
2315
2317
|
//#endregion
|
|
2316
2318
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
2317
|
-
var
|
|
2318
|
-
function
|
|
2319
|
-
let r =
|
|
2319
|
+
var Ot = he(() => import("./DraggableChildrenTable-Djc7QDzR.js").then((e) => ({ default: e.DraggableChildrenTable })));
|
|
2320
|
+
function kt({ node: e, ctx: n }) {
|
|
2321
|
+
let r = u(), i = e.children;
|
|
2320
2322
|
if (!i) return null;
|
|
2321
2323
|
let a = r.isPhone && n.relatedRecordsPresentation === "table";
|
|
2322
2324
|
if (n.isNew && n.mode !== "edit") return null;
|
|
2323
|
-
let o =
|
|
2325
|
+
let o = Ge(n.entity, i);
|
|
2324
2326
|
if (!o) return /* @__PURE__ */ X("div", {
|
|
2325
2327
|
className: "text-sm text-muted-foreground py-2",
|
|
2326
2328
|
children: ["Unknown child relation: ", i]
|
|
2327
2329
|
});
|
|
2328
|
-
let
|
|
2329
|
-
if (!
|
|
2330
|
+
let s = n.schema.entities[o.entity];
|
|
2331
|
+
if (!s) return /* @__PURE__ */ X("div", {
|
|
2330
2332
|
className: "text-sm text-muted-foreground py-2",
|
|
2331
2333
|
children: ["Entity not found: ", o.entity]
|
|
2332
2334
|
});
|
|
2333
|
-
let
|
|
2334
|
-
title:
|
|
2335
|
+
let c = Ne(o, s, e), l = ke(e, n), d = Ae(e, n), f = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ Y(L, {
|
|
2336
|
+
title: l,
|
|
2335
2337
|
icon: d ? /* @__PURE__ */ Y(t, {
|
|
2336
2338
|
name: d,
|
|
2337
2339
|
size: 14
|
|
2338
2340
|
}) : void 0,
|
|
2339
2341
|
children: e
|
|
2340
2342
|
});
|
|
2341
|
-
if (n.mode === "edit" &&
|
|
2342
|
-
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o =
|
|
2343
|
-
return
|
|
2344
|
-
fallback: /* @__PURE__ */ Y(
|
|
2343
|
+
if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && _(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
|
|
2344
|
+
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ? Dt : Ot : Dt;
|
|
2345
|
+
return f(/* @__PURE__ */ Y(pe, {
|
|
2346
|
+
fallback: /* @__PURE__ */ Y(le, {}),
|
|
2345
2347
|
children: /* @__PURE__ */ Y(o, {
|
|
2346
|
-
config:
|
|
2347
|
-
childEntity:
|
|
2348
|
+
config: c,
|
|
2349
|
+
childEntity: s,
|
|
2348
2350
|
schema: n.schema,
|
|
2349
2351
|
rows: e,
|
|
2350
2352
|
onChange: (e) => n.onChildrenChange(i, e),
|
|
@@ -2355,32 +2357,32 @@ function At({ node: e, ctx: n }) {
|
|
|
2355
2357
|
}));
|
|
2356
2358
|
}
|
|
2357
2359
|
if (n.isNew) return null;
|
|
2358
|
-
let
|
|
2359
|
-
config:
|
|
2360
|
+
let p = {
|
|
2361
|
+
config: c,
|
|
2360
2362
|
parentEntity: n.entityCode,
|
|
2361
2363
|
parentId: n.recordId,
|
|
2362
2364
|
schema: n.schema
|
|
2363
2365
|
};
|
|
2364
|
-
switch (
|
|
2365
|
-
case "list": return
|
|
2366
|
-
case "cards": return
|
|
2367
|
-
case "timeline": return
|
|
2368
|
-
default: return r.isPhone && !a ?
|
|
2366
|
+
switch (c.mode) {
|
|
2367
|
+
case "list": return f(/* @__PURE__ */ Y(tt, { ...p }));
|
|
2368
|
+
case "cards": return f(/* @__PURE__ */ Y(nt, { ...p }));
|
|
2369
|
+
case "timeline": return f(/* @__PURE__ */ Y(yt, { ...p }));
|
|
2370
|
+
default: return r.isPhone && !a ? f(/* @__PURE__ */ Y(nt, { ...p })) : f(/* @__PURE__ */ Y(et, { ...p }));
|
|
2369
2371
|
}
|
|
2370
2372
|
}
|
|
2371
2373
|
//#endregion
|
|
2372
2374
|
//#region src/components/detail-layout/FieldRow.tsx
|
|
2373
|
-
var
|
|
2375
|
+
var At = 150, jt = 560, Mt = 270, Nt = "20px", Pt = 4, Ft = /* @__PURE__ */ new Set([
|
|
2374
2376
|
"text",
|
|
2375
2377
|
"rich_text",
|
|
2376
2378
|
"json",
|
|
2377
2379
|
"structure",
|
|
2378
2380
|
"multilang_text"
|
|
2379
|
-
]),
|
|
2381
|
+
]), It = me({
|
|
2380
2382
|
columns: 2,
|
|
2381
2383
|
stackPairs: !1
|
|
2382
2384
|
});
|
|
2383
|
-
function
|
|
2385
|
+
function Lt({ columns: e = 2, children: t }) {
|
|
2384
2386
|
let n = K(null), [r, i] = q(null);
|
|
2385
2387
|
W(() => {
|
|
2386
2388
|
let e = n.current;
|
|
@@ -2390,8 +2392,8 @@ function Rt({ columns: e = 2, children: t }) {
|
|
|
2390
2392
|
});
|
|
2391
2393
|
return t.observe(e), () => t.disconnect();
|
|
2392
2394
|
}, []);
|
|
2393
|
-
let a = e === 1 || r !== null && r <
|
|
2394
|
-
return /* @__PURE__ */ Y(
|
|
2395
|
+
let a = e === 1 || r !== null && r < jt ? 1 : e, o = r === null ? null : (r - (a - 1) * 24) / a, s = o !== null && o < Mt;
|
|
2396
|
+
return /* @__PURE__ */ Y(It.Provider, {
|
|
2395
2397
|
value: {
|
|
2396
2398
|
columns: a,
|
|
2397
2399
|
stackPairs: s
|
|
@@ -2408,12 +2410,12 @@ function Rt({ columns: e = 2, children: t }) {
|
|
|
2408
2410
|
})
|
|
2409
2411
|
});
|
|
2410
2412
|
}
|
|
2411
|
-
function
|
|
2412
|
-
let
|
|
2413
|
+
function Rt({ label: t, children: n, span: r = !1, required: i, error: a, hint: o, actions: s, copyValue: c, mode: l = "display", htmlFor: u, labelId: d, labelTitle: f, "data-testid": p }) {
|
|
2414
|
+
let m = ge(It), g = r || m.stackPairs, _ = !!a;
|
|
2413
2415
|
return /* @__PURE__ */ X("div", {
|
|
2414
2416
|
className: "detail-row",
|
|
2415
2417
|
"data-error": _ || void 0,
|
|
2416
|
-
"data-testid":
|
|
2418
|
+
"data-testid": p,
|
|
2417
2419
|
style: {
|
|
2418
2420
|
display: "flex",
|
|
2419
2421
|
flexDirection: g ? "column" : "row",
|
|
@@ -2424,27 +2426,27 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2424
2426
|
},
|
|
2425
2427
|
children: [/* @__PURE__ */ X("div", {
|
|
2426
2428
|
style: {
|
|
2427
|
-
width: g ? "auto" :
|
|
2429
|
+
width: g ? "auto" : At,
|
|
2428
2430
|
flexShrink: 0,
|
|
2429
|
-
paddingTop: g ? 0 :
|
|
2431
|
+
paddingTop: g ? 0 : Pt,
|
|
2430
2432
|
fontSize: 12,
|
|
2431
|
-
lineHeight:
|
|
2433
|
+
lineHeight: Nt,
|
|
2432
2434
|
fontWeight: 500,
|
|
2433
2435
|
color: "var(--text-3)",
|
|
2434
2436
|
display: "flex",
|
|
2435
2437
|
alignItems: "flex-start",
|
|
2436
2438
|
gap: 2
|
|
2437
2439
|
},
|
|
2438
|
-
children: [
|
|
2439
|
-
id:
|
|
2440
|
-
htmlFor:
|
|
2441
|
-
title:
|
|
2440
|
+
children: [u ? /* @__PURE__ */ Y("label", {
|
|
2441
|
+
id: d,
|
|
2442
|
+
htmlFor: u,
|
|
2443
|
+
title: f || void 0,
|
|
2442
2444
|
children: t
|
|
2443
2445
|
}) : /* @__PURE__ */ Y("span", {
|
|
2444
|
-
id:
|
|
2445
|
-
title:
|
|
2446
|
+
id: d,
|
|
2447
|
+
title: f || void 0,
|
|
2446
2448
|
children: t
|
|
2447
|
-
}), i &&
|
|
2449
|
+
}), i && l === "edit" && /* @__PURE__ */ Y("span", {
|
|
2448
2450
|
"aria-hidden": "true",
|
|
2449
2451
|
style: {
|
|
2450
2452
|
color: "var(--danger)",
|
|
@@ -2472,19 +2474,19 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2472
2474
|
flex: 1,
|
|
2473
2475
|
minWidth: 0,
|
|
2474
2476
|
fontSize: 13,
|
|
2475
|
-
lineHeight:
|
|
2477
|
+
lineHeight: Nt,
|
|
2476
2478
|
color: "var(--text)",
|
|
2477
2479
|
overflowWrap: "anywhere",
|
|
2478
|
-
paddingTop:
|
|
2480
|
+
paddingTop: l === "display" && !g ? Pt : 0
|
|
2479
2481
|
},
|
|
2480
|
-
children: _ &&
|
|
2482
|
+
children: _ && l === "edit" ? /* @__PURE__ */ Y("div", {
|
|
2481
2483
|
style: {
|
|
2482
2484
|
borderRadius: 6,
|
|
2483
2485
|
boxShadow: "0 0 0 1.5px var(--danger)"
|
|
2484
2486
|
},
|
|
2485
2487
|
children: n
|
|
2486
2488
|
}) : n
|
|
2487
|
-
}), (
|
|
2489
|
+
}), (c || s) && /* @__PURE__ */ X("div", {
|
|
2488
2490
|
className: "detail-row-action",
|
|
2489
2491
|
style: {
|
|
2490
2492
|
display: "flex",
|
|
@@ -2492,13 +2494,13 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2492
2494
|
flexShrink: 0,
|
|
2493
2495
|
marginTop: -2
|
|
2494
2496
|
},
|
|
2495
|
-
children: [
|
|
2496
|
-
value:
|
|
2497
|
+
children: [c && /* @__PURE__ */ Y(h, {
|
|
2498
|
+
value: c,
|
|
2497
2499
|
size: "sm",
|
|
2498
2500
|
title: "Copy value"
|
|
2499
|
-
}),
|
|
2501
|
+
}), s]
|
|
2500
2502
|
})]
|
|
2501
|
-
}), (_ ||
|
|
2503
|
+
}), (_ || o != null) && /* @__PURE__ */ X("div", {
|
|
2502
2504
|
style: {
|
|
2503
2505
|
fontSize: 11.5,
|
|
2504
2506
|
lineHeight: 1.4,
|
|
@@ -2507,25 +2509,25 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2507
2509
|
alignItems: "center",
|
|
2508
2510
|
gap: 4
|
|
2509
2511
|
},
|
|
2510
|
-
children: [_ && /* @__PURE__ */ Y(e.warning, { size: 11 }), /* @__PURE__ */ Y("span", { children: _ ? a :
|
|
2512
|
+
children: [_ && /* @__PURE__ */ Y(e.warning, { size: 11 }), /* @__PURE__ */ Y("span", { children: _ ? a : o })]
|
|
2511
2513
|
})]
|
|
2512
2514
|
})]
|
|
2513
2515
|
});
|
|
2514
2516
|
}
|
|
2515
2517
|
//#endregion
|
|
2516
2518
|
//#region src/components/detail-layout/FieldsBlock.tsx
|
|
2517
|
-
function
|
|
2518
|
-
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c =
|
|
2519
|
-
return /* @__PURE__ */ Y(
|
|
2519
|
+
function zt({ fields: e, ctx: t }) {
|
|
2520
|
+
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = x(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
|
|
2521
|
+
return /* @__PURE__ */ Y(Lt, {
|
|
2520
2522
|
columns: l,
|
|
2521
2523
|
children: e.map((e) => {
|
|
2522
|
-
let l = e.code, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), m = !!(p?.auto || p?.readonly || p?.source), h =
|
|
2524
|
+
let l = e.code, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), m = !!(p?.auto || p?.readonly || p?.source), h = ie(n, l), g = h?.read === "denied", _ = h?.write === "denied", v = a === "display" ? g : _ || g, y = m || a === "edit" && _ ? "display" : a, b = v ? /* @__PURE__ */ Y(I, {
|
|
2523
2525
|
tier: h.classification,
|
|
2524
|
-
tierDef:
|
|
2526
|
+
tierDef: ae(s, n, l),
|
|
2525
2527
|
requiredPermission: h?.required_permission,
|
|
2526
2528
|
locale: c,
|
|
2527
2529
|
variant: y === "edit" ? "input" : "value"
|
|
2528
|
-
}) :
|
|
2530
|
+
}) : ce({
|
|
2529
2531
|
entity: n,
|
|
2530
2532
|
entityCode: r,
|
|
2531
2533
|
fieldName: l,
|
|
@@ -2541,47 +2543,47 @@ function Bt({ fields: e, ctx: t }) {
|
|
|
2541
2543
|
structure: e.structure,
|
|
2542
2544
|
detailScreen: e.detail_screen
|
|
2543
2545
|
});
|
|
2544
|
-
if (!
|
|
2545
|
-
let
|
|
2546
|
+
if (!b) return null;
|
|
2547
|
+
let x = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ Y(J, { children: e.actions.map((e, t) => /* @__PURE__ */ Y(F, {
|
|
2546
2548
|
actionCode: `${l}.action[${t}]`,
|
|
2547
2549
|
action: e,
|
|
2548
2550
|
entityCode: r,
|
|
2549
2551
|
row: i,
|
|
2550
2552
|
variant: "ghost",
|
|
2551
2553
|
size: "icon"
|
|
2552
|
-
}, t)) }) : void 0,
|
|
2554
|
+
}, t)) }) : void 0, S = !!p && Ft.has(p.type), C = i?.[l], w = y === "display" && (p?.copyable || p?.type === "uuid") && C != null && C !== "" ? T(C) : void 0, D = E(p?.display?.description);
|
|
2553
2555
|
return u ? /* @__PURE__ */ X("div", {
|
|
2554
2556
|
style: { gridColumn: "1 / -1" },
|
|
2555
|
-
children: [
|
|
2557
|
+
children: [b, y === "edit" && D && /* @__PURE__ */ Y("div", {
|
|
2556
2558
|
style: {
|
|
2557
2559
|
fontSize: 11.5,
|
|
2558
2560
|
lineHeight: 1.4,
|
|
2559
2561
|
color: "var(--text-3)",
|
|
2560
2562
|
marginTop: 3
|
|
2561
2563
|
},
|
|
2562
|
-
children:
|
|
2564
|
+
children: D
|
|
2563
2565
|
})]
|
|
2564
|
-
}, l) : /* @__PURE__ */ Y(
|
|
2566
|
+
}, l) : /* @__PURE__ */ Y(Rt, {
|
|
2565
2567
|
"data-testid": `field-${l}`,
|
|
2566
|
-
label:
|
|
2568
|
+
label: se(n, l, s.entities),
|
|
2567
2569
|
htmlFor: y === "edit" ? d : void 0,
|
|
2568
2570
|
labelId: f,
|
|
2569
|
-
labelTitle:
|
|
2571
|
+
labelTitle: D || void 0,
|
|
2570
2572
|
required: p?.required ?? !1,
|
|
2571
2573
|
mode: y,
|
|
2572
|
-
span:
|
|
2574
|
+
span: S,
|
|
2573
2575
|
error: t.fieldErrors?.[l],
|
|
2574
|
-
hint: y === "edit" &&
|
|
2575
|
-
actions:
|
|
2576
|
-
copyValue:
|
|
2577
|
-
children:
|
|
2576
|
+
hint: y === "edit" && D ? D : void 0,
|
|
2577
|
+
actions: x,
|
|
2578
|
+
copyValue: w,
|
|
2579
|
+
children: b
|
|
2578
2580
|
}, l);
|
|
2579
2581
|
})
|
|
2580
2582
|
});
|
|
2581
2583
|
}
|
|
2582
2584
|
//#endregion
|
|
2583
2585
|
//#region src/components/detail-layout/PropertiesBlock.tsx
|
|
2584
|
-
var
|
|
2586
|
+
var Bt = /* @__PURE__ */ new Set([
|
|
2585
2587
|
"string",
|
|
2586
2588
|
"text",
|
|
2587
2589
|
"int",
|
|
@@ -2589,16 +2591,16 @@ var Vt = /* @__PURE__ */ new Set([
|
|
|
2589
2591
|
"decimal",
|
|
2590
2592
|
"email",
|
|
2591
2593
|
"url"
|
|
2592
|
-
]),
|
|
2593
|
-
function
|
|
2594
|
+
]), Vt = 500;
|
|
2595
|
+
function Ht({ node: e, ctx: t }) {
|
|
2594
2596
|
let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
|
|
2595
2597
|
if (a) return null;
|
|
2596
2598
|
let l = e.properties === !0 || e.properties, u = l === !0 ? Object.entries(c).sort(([e], [t]) => e.localeCompare(t)) : l.filter((e) => c[e] != null).map((e) => [e, c[e]]);
|
|
2597
|
-
return u.length === 0 ? null : /* @__PURE__ */ Y(
|
|
2599
|
+
return u.length === 0 ? null : /* @__PURE__ */ Y(Lt, {
|
|
2598
2600
|
columns: 2,
|
|
2599
2601
|
children: u.map(([e, a]) => {
|
|
2600
|
-
let c = r?.find((t) => t.property_code === e), l =
|
|
2601
|
-
return /* @__PURE__ */ Y(
|
|
2602
|
+
let c = r?.find((t) => t.property_code === e), l = A(a), u = a.readonly || !i ? "display" : o;
|
|
2603
|
+
return /* @__PURE__ */ Y(Ut, {
|
|
2602
2604
|
propCode: e,
|
|
2603
2605
|
prop: a,
|
|
2604
2606
|
field: l,
|
|
@@ -2612,29 +2614,29 @@ function Ut({ node: e, ctx: t }) {
|
|
|
2612
2614
|
})
|
|
2613
2615
|
});
|
|
2614
2616
|
}
|
|
2615
|
-
function
|
|
2616
|
-
let l =
|
|
2617
|
+
function Ut({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: s, schema: c }) {
|
|
2618
|
+
let l = x(), u = K(null);
|
|
2617
2619
|
W(() => () => {
|
|
2618
2620
|
u.current && clearTimeout(u.current);
|
|
2619
2621
|
}, []);
|
|
2620
2622
|
let d = U((n) => {
|
|
2621
|
-
a && (
|
|
2623
|
+
a && (Bt.has(t.type) ? (u.current && clearTimeout(u.current), u.current = setTimeout(() => a(e, n), Vt)) : a(e, n));
|
|
2622
2624
|
}, [
|
|
2623
2625
|
e,
|
|
2624
2626
|
t.type,
|
|
2625
2627
|
a
|
|
2626
|
-
]), f =
|
|
2627
|
-
return /* @__PURE__ */ Y(
|
|
2628
|
-
label:
|
|
2628
|
+
]), f = ie(s, e), p = f?.read === "denied", m = f?.write === "denied", h = i === "display" ? p : m || p, g = i === "edit" && m ? "display" : i;
|
|
2629
|
+
return /* @__PURE__ */ Y(Rt, {
|
|
2630
|
+
label: E(t.display?.name ?? t.name),
|
|
2629
2631
|
mode: g,
|
|
2630
|
-
span:
|
|
2631
|
-
children: h ? /* @__PURE__ */ Y(
|
|
2632
|
+
span: Ft.has(t.type),
|
|
2633
|
+
children: h ? /* @__PURE__ */ Y(I, {
|
|
2632
2634
|
tier: f.classification,
|
|
2633
|
-
tierDef:
|
|
2635
|
+
tierDef: ae(c, s, e),
|
|
2634
2636
|
requiredPermission: f?.required_permission,
|
|
2635
2637
|
locale: l,
|
|
2636
2638
|
variant: g === "edit" ? "input" : "value"
|
|
2637
|
-
}) :
|
|
2639
|
+
}) : M({
|
|
2638
2640
|
field: n,
|
|
2639
2641
|
fieldName: e,
|
|
2640
2642
|
value: r,
|
|
@@ -2647,7 +2649,7 @@ function Wt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty:
|
|
|
2647
2649
|
}
|
|
2648
2650
|
//#endregion
|
|
2649
2651
|
//#region src/components/shared/StatusStepper.tsx
|
|
2650
|
-
function
|
|
2652
|
+
function Wt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1 }) {
|
|
2651
2653
|
let o = t.findIndex((e) => e.code === n);
|
|
2652
2654
|
return /* @__PURE__ */ Y("div", {
|
|
2653
2655
|
role: "list",
|
|
@@ -2714,7 +2716,7 @@ function Gt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2714
2716
|
}
|
|
2715
2717
|
//#endregion
|
|
2716
2718
|
//#region src/components/shared/StatusGroupsDisplay.tsx
|
|
2717
|
-
function
|
|
2719
|
+
function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r, mode: i = "edit" }) {
|
|
2718
2720
|
return /* @__PURE__ */ Y("div", {
|
|
2719
2721
|
style: {
|
|
2720
2722
|
display: "flex",
|
|
@@ -2722,10 +2724,10 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2722
2724
|
alignItems: "center",
|
|
2723
2725
|
gap: 16
|
|
2724
2726
|
},
|
|
2725
|
-
children: Object.entries(e).map(([e,
|
|
2726
|
-
let
|
|
2727
|
-
if (
|
|
2728
|
-
let t = i === "edit",
|
|
2727
|
+
children: Object.entries(e).map(([e, o]) => {
|
|
2728
|
+
let s = t?.find((t) => t.group_code === e)?.status_code, c = s ? o.statuses.find((e) => e.code === s) : void 0;
|
|
2729
|
+
if (o.display_mode === "stepper") {
|
|
2730
|
+
let t = i === "edit", a = t ? o.transitions && s ? /* @__PURE__ */ new Set([s, ...o.transitions[s] ?? []]) : new Set(o.statuses.map((e) => e.code)) : void 0;
|
|
2729
2731
|
return /* @__PURE__ */ X("div", {
|
|
2730
2732
|
style: {
|
|
2731
2733
|
display: "flex",
|
|
@@ -2739,20 +2741,20 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2739
2741
|
color: "var(--text-3)",
|
|
2740
2742
|
flexShrink: 0
|
|
2741
2743
|
},
|
|
2742
|
-
children: [
|
|
2744
|
+
children: [E(o.name), ":"]
|
|
2743
2745
|
}), /* @__PURE__ */ Y("div", {
|
|
2744
2746
|
style: {
|
|
2745
2747
|
minWidth: 240,
|
|
2746
2748
|
opacity: r ? .6 : 1,
|
|
2747
2749
|
pointerEvents: r ? "none" : "auto"
|
|
2748
2750
|
},
|
|
2749
|
-
children: /* @__PURE__ */ Y(
|
|
2750
|
-
stages:
|
|
2751
|
+
children: /* @__PURE__ */ Y(Wt, {
|
|
2752
|
+
stages: o.statuses.map((e) => ({
|
|
2751
2753
|
code: e.code,
|
|
2752
|
-
label:
|
|
2754
|
+
label: E(e.name)
|
|
2753
2755
|
})),
|
|
2754
|
-
current:
|
|
2755
|
-
selectable:
|
|
2756
|
+
current: s,
|
|
2757
|
+
selectable: a,
|
|
2756
2758
|
onSelect: t ? (t) => n(e, t) : void 0,
|
|
2757
2759
|
compact: !0
|
|
2758
2760
|
})
|
|
@@ -2770,11 +2772,11 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2770
2772
|
fontSize: 12,
|
|
2771
2773
|
color: "var(--text-3)"
|
|
2772
2774
|
},
|
|
2773
|
-
children: [
|
|
2774
|
-
}),
|
|
2775
|
-
tone:
|
|
2775
|
+
children: [E(o.name), ":"]
|
|
2776
|
+
}), c ? /* @__PURE__ */ Y(P, {
|
|
2777
|
+
tone: c.color ?? "slate",
|
|
2776
2778
|
size: "xs",
|
|
2777
|
-
children:
|
|
2779
|
+
children: E(c.name)
|
|
2778
2780
|
}) : /* @__PURE__ */ Y("span", {
|
|
2779
2781
|
style: {
|
|
2780
2782
|
fontSize: 12.5,
|
|
@@ -2783,7 +2785,7 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2783
2785
|
children: "—"
|
|
2784
2786
|
})]
|
|
2785
2787
|
}, e);
|
|
2786
|
-
let
|
|
2788
|
+
let l = (o.transitions && s ? o.statuses.filter((e) => e.code === s || (o.transitions[s]?.includes(e.code) ?? !1)) : o.statuses).map((e) => ({
|
|
2787
2789
|
value: e.code,
|
|
2788
2790
|
label: /* @__PURE__ */ X("span", {
|
|
2789
2791
|
style: {
|
|
@@ -2797,7 +2799,7 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2797
2799
|
borderRadius: 999,
|
|
2798
2800
|
background: `var(--pill-${e.color}, ${e.color})`,
|
|
2799
2801
|
display: "inline-block"
|
|
2800
|
-
} }),
|
|
2802
|
+
} }), E(e.name)]
|
|
2801
2803
|
})
|
|
2802
2804
|
}));
|
|
2803
2805
|
return /* @__PURE__ */ X("div", {
|
|
@@ -2811,16 +2813,16 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2811
2813
|
fontSize: 12,
|
|
2812
2814
|
color: "var(--text-3)"
|
|
2813
2815
|
},
|
|
2814
|
-
children: [
|
|
2816
|
+
children: [E(o.name), ":"]
|
|
2815
2817
|
}), /* @__PURE__ */ Y("div", {
|
|
2816
2818
|
style: {
|
|
2817
2819
|
minWidth: 180,
|
|
2818
2820
|
opacity: r ? .6 : 1,
|
|
2819
2821
|
pointerEvents: r ? "none" : "auto"
|
|
2820
2822
|
},
|
|
2821
|
-
children: /* @__PURE__ */ Y(
|
|
2822
|
-
value:
|
|
2823
|
-
options:
|
|
2823
|
+
children: /* @__PURE__ */ Y(a, {
|
|
2824
|
+
value: s ?? "",
|
|
2825
|
+
options: l,
|
|
2824
2826
|
onChange: (t) => n(e, t),
|
|
2825
2827
|
placeholder: "Select…"
|
|
2826
2828
|
})
|
|
@@ -2831,31 +2833,31 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2831
2833
|
}
|
|
2832
2834
|
//#endregion
|
|
2833
2835
|
//#region src/components/detail-layout/StatusesBlock.tsx
|
|
2834
|
-
var
|
|
2835
|
-
function
|
|
2836
|
+
var Kt = () => {};
|
|
2837
|
+
function qt({ node: e, ctx: t }) {
|
|
2836
2838
|
let { entity: n, objectStatuses: r, onSetStatus: i, isStatusPending: a, isNew: o } = t, s = n.status_groups ?? {};
|
|
2837
2839
|
if (o) return null;
|
|
2838
2840
|
let c = e.statuses === !0 || e.statuses, l = Object.fromEntries(Object.entries(s).filter(([e]) => c === !0 || c.includes(e)));
|
|
2839
|
-
return Object.keys(l).length === 0 ? null : /* @__PURE__ */ Y(
|
|
2841
|
+
return Object.keys(l).length === 0 ? null : /* @__PURE__ */ Y(Gt, {
|
|
2840
2842
|
statusGroups: l,
|
|
2841
2843
|
objectStatuses: r,
|
|
2842
|
-
onSetStatus: i ??
|
|
2844
|
+
onSetStatus: i ?? Kt,
|
|
2843
2845
|
isPending: a ?? !1,
|
|
2844
2846
|
mode: t.mode
|
|
2845
2847
|
});
|
|
2846
2848
|
}
|
|
2847
2849
|
//#endregion
|
|
2848
2850
|
//#region src/components/detail-layout/widgets/canonicalizeJson.ts
|
|
2849
|
-
function
|
|
2850
|
-
if (Array.isArray(e)) return e.map(
|
|
2851
|
+
function Jt(e) {
|
|
2852
|
+
if (Array.isArray(e)) return e.map(Jt);
|
|
2851
2853
|
if (typeof e == "object" && e) {
|
|
2852
2854
|
let t = e, n = {};
|
|
2853
|
-
for (let e of Object.keys(t).sort()) n[e] =
|
|
2855
|
+
for (let e of Object.keys(t).sort()) n[e] = Jt(t[e]);
|
|
2854
2856
|
return n;
|
|
2855
2857
|
}
|
|
2856
2858
|
return e;
|
|
2857
2859
|
}
|
|
2858
|
-
function
|
|
2860
|
+
function Yt(e) {
|
|
2859
2861
|
switch (typeof e) {
|
|
2860
2862
|
case "string": return e;
|
|
2861
2863
|
case "number":
|
|
@@ -2867,39 +2869,39 @@ function Xt(e) {
|
|
|
2867
2869
|
default: return "";
|
|
2868
2870
|
}
|
|
2869
2871
|
}
|
|
2870
|
-
function
|
|
2872
|
+
function Xt(e) {
|
|
2871
2873
|
if (e == null) return "";
|
|
2872
2874
|
try {
|
|
2873
|
-
return JSON.stringify(
|
|
2875
|
+
return JSON.stringify(Jt(e), null, 2) ?? Yt(e);
|
|
2874
2876
|
} catch {
|
|
2875
|
-
return
|
|
2877
|
+
return Yt(e);
|
|
2876
2878
|
}
|
|
2877
2879
|
}
|
|
2878
2880
|
//#endregion
|
|
2879
2881
|
//#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
|
|
2880
|
-
var
|
|
2881
|
-
function
|
|
2882
|
+
var Zt = "Audit change diff", Qt = he(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonDiff }))), $t = he(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonSource }))), en = he(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
|
|
2883
|
+
function tn() {
|
|
2882
2884
|
return /* @__PURE__ */ Y("div", {
|
|
2883
2885
|
className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
|
|
2884
2886
|
children: "Loading editor…"
|
|
2885
2887
|
});
|
|
2886
2888
|
}
|
|
2887
|
-
function
|
|
2888
|
-
return /* @__PURE__ */ Y(
|
|
2889
|
-
fallback: /* @__PURE__ */ Y(
|
|
2889
|
+
function nn({ before: e, after: t }) {
|
|
2890
|
+
return /* @__PURE__ */ Y(pe, {
|
|
2891
|
+
fallback: /* @__PURE__ */ Y(tn, {}),
|
|
2890
2892
|
children: /* @__PURE__ */ X("div", {
|
|
2891
2893
|
className: "flex h-full w-full gap-2",
|
|
2892
2894
|
role: "group",
|
|
2893
|
-
"aria-label":
|
|
2895
|
+
"aria-label": Zt,
|
|
2894
2896
|
children: [/* @__PURE__ */ Y("div", {
|
|
2895
2897
|
className: "min-w-0 flex-1",
|
|
2896
|
-
children: /* @__PURE__ */ Y(
|
|
2898
|
+
children: /* @__PURE__ */ Y(en, {
|
|
2897
2899
|
value: e,
|
|
2898
2900
|
readOnly: !0
|
|
2899
2901
|
})
|
|
2900
2902
|
}), /* @__PURE__ */ Y("div", {
|
|
2901
2903
|
className: "min-w-0 flex-1",
|
|
2902
|
-
children: /* @__PURE__ */ Y(
|
|
2904
|
+
children: /* @__PURE__ */ Y(en, {
|
|
2903
2905
|
value: t,
|
|
2904
2906
|
readOnly: !0
|
|
2905
2907
|
})
|
|
@@ -2907,7 +2909,7 @@ function rn({ before: e, after: t }) {
|
|
|
2907
2909
|
})
|
|
2908
2910
|
});
|
|
2909
2911
|
}
|
|
2910
|
-
function
|
|
2912
|
+
function rn({ mode: e, onChange: t }) {
|
|
2911
2913
|
return /* @__PURE__ */ X("div", {
|
|
2912
2914
|
className: "inline-flex gap-1",
|
|
2913
2915
|
role: "group",
|
|
@@ -2927,13 +2929,13 @@ function an({ mode: e, onChange: t }) {
|
|
|
2927
2929
|
})]
|
|
2928
2930
|
});
|
|
2929
2931
|
}
|
|
2930
|
-
function
|
|
2931
|
-
let n = e.before, r = e.after, i = t?.default_mode === "source" ? "source" : "diff", [a, o] = q(i), s =
|
|
2932
|
+
function an({ values: e, options: t }) {
|
|
2933
|
+
let n = e.before, r = e.after, i = t?.default_mode === "source" ? "source" : "diff", [a, o] = q(i), s = Xt(n), c = Xt(r);
|
|
2932
2934
|
return /* @__PURE__ */ X("div", {
|
|
2933
2935
|
className: "flex flex-col gap-2",
|
|
2934
2936
|
children: [/* @__PURE__ */ X("div", {
|
|
2935
2937
|
className: "flex items-center justify-between",
|
|
2936
|
-
children: [/* @__PURE__ */ Y(
|
|
2938
|
+
children: [/* @__PURE__ */ Y(rn, {
|
|
2937
2939
|
mode: a,
|
|
2938
2940
|
onChange: o
|
|
2939
2941
|
}), s === c && /* @__PURE__ */ Y("span", {
|
|
@@ -2944,25 +2946,25 @@ function on({ values: e, options: t }) {
|
|
|
2944
2946
|
}), /* @__PURE__ */ Y("div", {
|
|
2945
2947
|
className: "h-[480px] w-full overflow-hidden rounded border",
|
|
2946
2948
|
role: "group",
|
|
2947
|
-
"aria-label":
|
|
2948
|
-
children: /* @__PURE__ */ Y(
|
|
2949
|
-
fallback: /* @__PURE__ */ Y(
|
|
2949
|
+
"aria-label": Zt,
|
|
2950
|
+
children: /* @__PURE__ */ Y(z, {
|
|
2951
|
+
fallback: /* @__PURE__ */ Y(nn, {
|
|
2950
2952
|
before: n,
|
|
2951
2953
|
after: r
|
|
2952
2954
|
}),
|
|
2953
|
-
children: /* @__PURE__ */ Y(
|
|
2954
|
-
fallback: /* @__PURE__ */ Y(
|
|
2955
|
-
children: a === "diff" ? /* @__PURE__ */ Y(
|
|
2955
|
+
children: /* @__PURE__ */ Y(pe, {
|
|
2956
|
+
fallback: /* @__PURE__ */ Y(tn, {}),
|
|
2957
|
+
children: a === "diff" ? /* @__PURE__ */ Y(Qt, {
|
|
2956
2958
|
before: s,
|
|
2957
2959
|
after: c
|
|
2958
2960
|
}) : /* @__PURE__ */ X("div", {
|
|
2959
2961
|
className: "flex h-full w-full gap-2",
|
|
2960
2962
|
children: [/* @__PURE__ */ Y("div", {
|
|
2961
2963
|
className: "min-w-0 flex-1",
|
|
2962
|
-
children: /* @__PURE__ */ Y(
|
|
2964
|
+
children: /* @__PURE__ */ Y($t, { value: s })
|
|
2963
2965
|
}), /* @__PURE__ */ Y("div", {
|
|
2964
2966
|
className: "min-w-0 flex-1",
|
|
2965
|
-
children: /* @__PURE__ */ Y(
|
|
2967
|
+
children: /* @__PURE__ */ Y($t, { value: c })
|
|
2966
2968
|
})]
|
|
2967
2969
|
})
|
|
2968
2970
|
})
|
|
@@ -2981,7 +2983,7 @@ function $(e) {
|
|
|
2981
2983
|
let n = Object.entries(t).filter((e) => typeof e[1] == "string");
|
|
2982
2984
|
return n.length > 0 ? Object.fromEntries(n) : void 0;
|
|
2983
2985
|
}
|
|
2984
|
-
function
|
|
2986
|
+
function on(e) {
|
|
2985
2987
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
2986
2988
|
let t = Q(e);
|
|
2987
2989
|
return !t || typeof t.field != "string" ? [] : [{
|
|
@@ -2991,7 +2993,7 @@ function sn(e) {
|
|
|
2991
2993
|
}];
|
|
2992
2994
|
}) : [];
|
|
2993
2995
|
}
|
|
2994
|
-
function
|
|
2996
|
+
function sn(e) {
|
|
2995
2997
|
if (!e || typeof e.entity != "string" || typeof e.scope_field != "string" || typeof e.window_field != "string") return;
|
|
2996
2998
|
let t = Array.isArray(e.windows) ? e.windows.flatMap((e) => {
|
|
2997
2999
|
let t = Q(e);
|
|
@@ -3026,7 +3028,7 @@ function cn(e) {
|
|
|
3026
3028
|
filter_label: $(r.filter_label),
|
|
3027
3029
|
all_label: $(r.all_label),
|
|
3028
3030
|
empty_label: $(r.empty_label),
|
|
3029
|
-
columns:
|
|
3031
|
+
columns: on(r.columns),
|
|
3030
3032
|
sort: typeof r.sort == "string" ? r.sort : void 0,
|
|
3031
3033
|
limit: typeof r.limit == "number" ? Math.min(500, Math.max(1, r.limit)) : 200
|
|
3032
3034
|
} : void 0, a = Q(e.drillthrough), o = a && typeof a.route == "string" && typeof a.scope_field == "string" && typeof a.window_field == "string" ? {
|
|
@@ -3051,7 +3053,7 @@ function cn(e) {
|
|
|
3051
3053
|
drillthrough: o
|
|
3052
3054
|
};
|
|
3053
3055
|
}
|
|
3054
|
-
function
|
|
3056
|
+
function cn(e, t, n) {
|
|
3055
3057
|
if (e == null || e === "") return "N/A";
|
|
3056
3058
|
if (t === "number") return new Intl.NumberFormat(n).format(Number(e));
|
|
3057
3059
|
if (t === "percent_ratio") return new Intl.NumberFormat(n, {
|
|
@@ -3069,14 +3071,14 @@ function ln(e, t, n) {
|
|
|
3069
3071
|
}
|
|
3070
3072
|
return typeof e == "string" ? e : typeof e == "number" || typeof e == "bigint" || typeof e == "boolean" ? String(e) : "N/A";
|
|
3071
3073
|
}
|
|
3072
|
-
function
|
|
3074
|
+
function ln(e, t) {
|
|
3073
3075
|
return typeof e.id == "string" || typeof e.id == "number" ? String(e.id) : `row-${t}`;
|
|
3074
3076
|
}
|
|
3075
|
-
function
|
|
3077
|
+
function un(e, t) {
|
|
3076
3078
|
return !t || Object.entries(t).every(([t, n]) => e[t] === n);
|
|
3077
3079
|
}
|
|
3078
|
-
function
|
|
3079
|
-
let n = G(() =>
|
|
3080
|
+
function dn({ values: e, options: t }) {
|
|
3081
|
+
let n = G(() => sn(t), [t]), r = x(), i = ne(), a = e.scope, o = n?.windows.some((e) => e.code === n.default_window) ? n.default_window : n?.windows[0]?.code ?? "", [s, c] = q(o), [l, u] = q("");
|
|
3080
3082
|
W(() => {
|
|
3081
3083
|
c(o);
|
|
3082
3084
|
}, [o]), W(() => {
|
|
@@ -3090,7 +3092,7 @@ function fn({ values: e, options: t }) {
|
|
|
3090
3092
|
field: n.window_field,
|
|
3091
3093
|
op: "eq",
|
|
3092
3094
|
value: s
|
|
3093
|
-
}] : [], f =
|
|
3095
|
+
}] : [], f = N(n?.entity, {
|
|
3094
3096
|
per_page: 1,
|
|
3095
3097
|
filters: d
|
|
3096
3098
|
}, !!(n && a && s)), p = n?.breakdown, m = p ? [{
|
|
@@ -3101,7 +3103,7 @@ function fn({ values: e, options: t }) {
|
|
|
3101
3103
|
field: p.window_field,
|
|
3102
3104
|
op: "eq",
|
|
3103
3105
|
value: s
|
|
3104
|
-
}] : [], h =
|
|
3106
|
+
}] : [], h = N(p?.entity, {
|
|
3105
3107
|
per_page: p?.limit ?? 200,
|
|
3106
3108
|
sort: p?.sort,
|
|
3107
3109
|
filters: m
|
|
@@ -3111,7 +3113,7 @@ function fn({ values: e, options: t }) {
|
|
|
3111
3113
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
3112
3114
|
children: "Invalid entity_scorecard configuration."
|
|
3113
3115
|
});
|
|
3114
|
-
let g = f.data?.data?.[0], _ = h.data?.data ?? [],
|
|
3116
|
+
let g = f.data?.data?.[0], _ = h.data?.data ?? [], v = p?.filter_field ? Array.from(new Set(_.map((e) => e[p.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], y = l && p?.filter_field ? _.filter((e) => e[p.filter_field] === l) : _, b = (e) => !l || !e.filtered || !p?.filter_field ? g?.[e.field] : _.find((t) => t[p.filter_field] === l && un(t, e.filtered?.where))?.[e.filtered.field], S = (e) => {
|
|
3115
3117
|
let t = n.drillthrough;
|
|
3116
3118
|
if (!t || !e.drillthrough_value) return;
|
|
3117
3119
|
let r = [{
|
|
@@ -3132,10 +3134,10 @@ function fn({ values: e, options: t }) {
|
|
|
3132
3134
|
op: "eq",
|
|
3133
3135
|
value: e.drillthrough_value
|
|
3134
3136
|
}), i(t.route, { search: new URLSearchParams({ filters: JSON.stringify(r) }).toString() });
|
|
3135
|
-
},
|
|
3137
|
+
}, C = f.error ?? h.error;
|
|
3136
3138
|
return /* @__PURE__ */ X("div", {
|
|
3137
3139
|
className: "flex min-w-0 flex-col gap-4",
|
|
3138
|
-
"aria-label":
|
|
3140
|
+
"aria-label": E(n.title, r) || "Scorecard",
|
|
3139
3141
|
children: [
|
|
3140
3142
|
/* @__PURE__ */ X("div", {
|
|
3141
3143
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
@@ -3144,15 +3146,15 @@ function fn({ values: e, options: t }) {
|
|
|
3144
3146
|
children: [
|
|
3145
3147
|
n.title && /* @__PURE__ */ Y("h3", {
|
|
3146
3148
|
className: "text-base font-semibold text-foreground",
|
|
3147
|
-
children:
|
|
3149
|
+
children: E(n.title, r)
|
|
3148
3150
|
}),
|
|
3149
3151
|
n.description && /* @__PURE__ */ Y("p", {
|
|
3150
3152
|
className: "mt-1 text-sm text-muted-foreground",
|
|
3151
|
-
children:
|
|
3153
|
+
children: E(n.description, r)
|
|
3152
3154
|
}),
|
|
3153
3155
|
n.intended_note && /* @__PURE__ */ Y("p", {
|
|
3154
3156
|
className: "mt-1 text-xs text-muted-foreground",
|
|
3155
|
-
children:
|
|
3157
|
+
children: E(n.intended_note, r)
|
|
3156
3158
|
})
|
|
3157
3159
|
]
|
|
3158
3160
|
}), /* @__PURE__ */ X("div", {
|
|
@@ -3166,19 +3168,19 @@ function fn({ values: e, options: t }) {
|
|
|
3166
3168
|
"aria-pressed": s === e.code,
|
|
3167
3169
|
onClick: () => c(e.code),
|
|
3168
3170
|
className: `rounded px-3 py-1.5 text-xs font-medium ${s === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
|
|
3169
|
-
children:
|
|
3171
|
+
children: E(e.label, r) || e.code
|
|
3170
3172
|
}, e.code))
|
|
3171
3173
|
}), p?.filter_field && /* @__PURE__ */ X("label", {
|
|
3172
3174
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
3173
|
-
children: [
|
|
3174
|
-
"aria-label":
|
|
3175
|
+
children: [E(p.filter_label, r) || "Filter", /* @__PURE__ */ X("select", {
|
|
3176
|
+
"aria-label": E(p.filter_label, r) || "Filter",
|
|
3175
3177
|
value: l,
|
|
3176
3178
|
onChange: (e) => u(e.target.value),
|
|
3177
3179
|
className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
|
|
3178
3180
|
children: [/* @__PURE__ */ Y("option", {
|
|
3179
3181
|
value: "",
|
|
3180
|
-
children:
|
|
3181
|
-
}),
|
|
3182
|
+
children: E(p.all_label, r) || "All"
|
|
3183
|
+
}), v.map((e) => /* @__PURE__ */ Y("option", {
|
|
3182
3184
|
value: e,
|
|
3183
3185
|
children: e
|
|
3184
3186
|
}, e))]
|
|
@@ -3186,35 +3188,35 @@ function fn({ values: e, options: t }) {
|
|
|
3186
3188
|
})]
|
|
3187
3189
|
})]
|
|
3188
3190
|
}),
|
|
3189
|
-
|
|
3191
|
+
C && /* @__PURE__ */ Y("div", {
|
|
3190
3192
|
role: "alert",
|
|
3191
3193
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
3192
|
-
children:
|
|
3194
|
+
children: C instanceof Error ? C.message : "Scorecard data could not be loaded."
|
|
3193
3195
|
}),
|
|
3194
|
-
!
|
|
3196
|
+
!C && !f.isLoading && !g && /* @__PURE__ */ Y("div", {
|
|
3195
3197
|
className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
|
|
3196
|
-
children:
|
|
3198
|
+
children: E(n.empty_label, r) || "No scorecard data."
|
|
3197
3199
|
}),
|
|
3198
3200
|
g && /* @__PURE__ */ Y("div", {
|
|
3199
3201
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
3200
3202
|
children: n.metrics.map((e) => {
|
|
3201
|
-
let t =
|
|
3203
|
+
let t = b(e), i = !!(n.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ X(J, { children: [
|
|
3202
3204
|
/* @__PURE__ */ Y("span", {
|
|
3203
3205
|
className: "text-xs font-medium text-muted-foreground",
|
|
3204
|
-
children:
|
|
3206
|
+
children: E(e.label, r) || e.field
|
|
3205
3207
|
}),
|
|
3206
3208
|
/* @__PURE__ */ Y("strong", {
|
|
3207
3209
|
className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
|
|
3208
|
-
children:
|
|
3210
|
+
children: cn(t, e.format, r)
|
|
3209
3211
|
}),
|
|
3210
3212
|
e.help && /* @__PURE__ */ Y("span", {
|
|
3211
3213
|
className: "mt-1 block text-xs text-muted-foreground",
|
|
3212
|
-
children:
|
|
3214
|
+
children: E(e.help, r)
|
|
3213
3215
|
})
|
|
3214
3216
|
] });
|
|
3215
3217
|
return i ? /* @__PURE__ */ Y("button", {
|
|
3216
3218
|
type: "button",
|
|
3217
|
-
onClick: () =>
|
|
3219
|
+
onClick: () => S(e),
|
|
3218
3220
|
className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
|
|
3219
3221
|
children: a
|
|
3220
3222
|
}, e.field) : /* @__PURE__ */ Y("article", {
|
|
@@ -3231,18 +3233,18 @@ function fn({ values: e, options: t }) {
|
|
|
3231
3233
|
className: "bg-surface text-left text-xs text-muted-foreground",
|
|
3232
3234
|
children: /* @__PURE__ */ Y("tr", { children: p.columns.map((e) => /* @__PURE__ */ Y("th", {
|
|
3233
3235
|
className: "border-b border-divider px-3 py-2 font-medium",
|
|
3234
|
-
children:
|
|
3236
|
+
children: E(e.label, r) || e.field
|
|
3235
3237
|
}, e.field)) })
|
|
3236
|
-
}), /* @__PURE__ */ X("tbody", { children: [
|
|
3238
|
+
}), /* @__PURE__ */ X("tbody", { children: [y.map((e, t) => /* @__PURE__ */ Y("tr", {
|
|
3237
3239
|
className: "border-b border-divider last:border-0",
|
|
3238
3240
|
children: p.columns.map((t) => /* @__PURE__ */ Y("td", {
|
|
3239
3241
|
className: "px-3 py-2 text-foreground",
|
|
3240
|
-
children:
|
|
3242
|
+
children: cn(e[t.field], t.format, r)
|
|
3241
3243
|
}, t.field))
|
|
3242
|
-
},
|
|
3244
|
+
}, ln(e, t))), !h.isLoading && y.length === 0 && /* @__PURE__ */ Y("tr", { children: /* @__PURE__ */ Y("td", {
|
|
3243
3245
|
colSpan: Math.max(1, p.columns.length),
|
|
3244
3246
|
className: "px-3 py-6 text-center text-muted-foreground",
|
|
3245
|
-
children:
|
|
3247
|
+
children: E(p.empty_label, r) || "No breakdown rows."
|
|
3246
3248
|
}) })] })]
|
|
3247
3249
|
})
|
|
3248
3250
|
})
|
|
@@ -3251,15 +3253,15 @@ function fn({ values: e, options: t }) {
|
|
|
3251
3253
|
}
|
|
3252
3254
|
//#endregion
|
|
3253
3255
|
//#region src/components/detail-layout/widgets/builtins.ts
|
|
3254
|
-
var
|
|
3255
|
-
function
|
|
3256
|
-
|
|
3256
|
+
var fn = !1;
|
|
3257
|
+
function pn() {
|
|
3258
|
+
fn ||= (B("json_diff", an), B("entity_scorecard", dn), !0);
|
|
3257
3259
|
}
|
|
3258
3260
|
//#endregion
|
|
3259
3261
|
//#region src/components/detail-layout/widgets/WidgetHost.tsx
|
|
3260
|
-
|
|
3261
|
-
function
|
|
3262
|
-
let n =
|
|
3262
|
+
pn();
|
|
3263
|
+
function mn({ config: e, ctx: t }) {
|
|
3264
|
+
let n = H(e.type);
|
|
3263
3265
|
if (!n) return /* @__PURE__ */ Y("span", {
|
|
3264
3266
|
className: "text-sm text-muted-foreground",
|
|
3265
3267
|
children: `unknown widget: ${e.type}`
|
|
@@ -3284,45 +3286,45 @@ function hn({ config: e, ctx: t }) {
|
|
|
3284
3286
|
}
|
|
3285
3287
|
//#endregion
|
|
3286
3288
|
//#region src/components/detail-layout/LayoutRenderer.tsx
|
|
3287
|
-
function
|
|
3288
|
-
return /* @__PURE__ */ Y(J, { children: e.map((e, n) => /* @__PURE__ */ Y(
|
|
3289
|
+
function hn({ nodes: e, ctx: t }) {
|
|
3290
|
+
return /* @__PURE__ */ Y(J, { children: e.map((e, n) => /* @__PURE__ */ Y(gn, {
|
|
3289
3291
|
node: e,
|
|
3290
3292
|
ctx: t
|
|
3291
3293
|
}, n)) });
|
|
3292
3294
|
}
|
|
3293
|
-
function
|
|
3294
|
-
return e.row ? /* @__PURE__ */ Y(
|
|
3295
|
+
function gn({ node: e, ctx: t }) {
|
|
3296
|
+
return e.row ? /* @__PURE__ */ Y(we, {
|
|
3295
3297
|
config: e.row,
|
|
3296
3298
|
ctx: t
|
|
3297
|
-
}) : e.column ? /* @__PURE__ */ Y(
|
|
3299
|
+
}) : e.column ? /* @__PURE__ */ Y(De, {
|
|
3298
3300
|
config: e.column,
|
|
3299
3301
|
node: e,
|
|
3300
3302
|
ctx: t
|
|
3301
|
-
}) : e.tabs ? /* @__PURE__ */ Y(
|
|
3303
|
+
}) : e.tabs ? /* @__PURE__ */ Y(je, {
|
|
3302
3304
|
config: e.tabs,
|
|
3303
3305
|
ctx: t
|
|
3304
|
-
}) : e.section ? /* @__PURE__ */ Y(
|
|
3306
|
+
}) : e.section ? /* @__PURE__ */ Y(Me, {
|
|
3305
3307
|
config: e.section,
|
|
3306
3308
|
ctx: t
|
|
3307
|
-
}) : e.children ? /* @__PURE__ */ Y(
|
|
3309
|
+
}) : e.children ? /* @__PURE__ */ Y(kt, {
|
|
3308
3310
|
node: e,
|
|
3309
3311
|
ctx: t
|
|
3310
|
-
}) : e.associated ? /* @__PURE__ */ Y(
|
|
3312
|
+
}) : e.associated ? /* @__PURE__ */ Y(V, {
|
|
3311
3313
|
node: e,
|
|
3312
3314
|
ctx: t
|
|
3313
|
-
}) : e.fields ? /* @__PURE__ */ Y(
|
|
3315
|
+
}) : e.fields ? /* @__PURE__ */ Y(zt, {
|
|
3314
3316
|
fields: e.fields,
|
|
3315
3317
|
ctx: t
|
|
3316
|
-
}) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ Y(
|
|
3318
|
+
}) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ Y(mn, {
|
|
3317
3319
|
config: e.widget,
|
|
3318
3320
|
ctx: t
|
|
3319
|
-
}) : null : /* @__PURE__ */ Y(
|
|
3321
|
+
}) : null : /* @__PURE__ */ Y(qt, {
|
|
3320
3322
|
node: e,
|
|
3321
3323
|
ctx: t
|
|
3322
|
-
}) : /* @__PURE__ */ Y(
|
|
3324
|
+
}) : /* @__PURE__ */ Y(Ht, {
|
|
3323
3325
|
node: e,
|
|
3324
3326
|
ctx: t
|
|
3325
3327
|
});
|
|
3326
3328
|
}
|
|
3327
3329
|
//#endregion
|
|
3328
|
-
export {
|
|
3330
|
+
export { Gt as n, hn as t };
|