@declarion/react 0.38.5 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/{DraggableChildrenTable-DvJO6-m0.js → DraggableChildrenTable-Ctmn0liO.js} +27 -27
- package/dist-lib/{Grid-D2ArPFCz.js → Grid-BsIkTp3u.js} +42 -42
- package/dist-lib/{LayoutRenderer-C8DQ61Vo.js → LayoutRenderer-D4oTfZhV.js} +833 -731
- package/dist-lib/{MarkdownRenderer-CSuODN70.js → MarkdownRenderer-B-2CrtjU.js} +1 -1
- package/dist-lib/{RefreshControl-CHvOUn0o.js → RefreshControl-VQf34HKZ.js} +302 -220
- package/dist-lib/SmartDetailPage.impl-HMaLVDlV.js +1802 -0
- package/dist-lib/SmartRecordListPage.impl-Cxm7qvlZ.js +763 -0
- package/dist-lib/api/params.d.ts +12 -11
- package/dist-lib/components/columns/ColumnPicker.d.ts +11 -1
- package/dist-lib/components/detail-layout/EvidenceBlock.d.ts +6 -0
- package/dist-lib/components/detail-layout/useManualColumnResize.d.ts +25 -0
- package/dist-lib/components/list/QuickPeek.d.ts +11 -2
- package/dist-lib/components/pages/list/{ListBulkBar.d.ts → ListFloatbar.d.ts} +3 -3
- package/dist-lib/components/pages/list/RowActionsCell.d.ts +8 -10
- package/dist-lib/components/pages/list/RowContextMenu.d.ts +29 -0
- package/dist-lib/components/pages/list/SaveViewDialog.d.ts +5 -1
- package/dist-lib/components/pages/list/cardProjection.d.ts +1 -1
- package/dist-lib/components/pages/list/column-sizing.d.ts +15 -0
- package/dist-lib/components/pages/list/columns.d.ts +3 -0
- package/dist-lib/components/pages/list/useHeaderReorder.d.ts +26 -0
- package/dist-lib/components/pages/list/useRowMenu.d.ts +47 -0
- package/dist-lib/components/pages/profile/Profile.d.ts +3 -0
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.d.ts +2 -0
- package/dist-lib/components/params/ParamsBlock.d.ts +25 -0
- package/dist-lib/components/params/param-editors.d.ts +28 -0
- package/dist-lib/components/primitives/Dropdown.d.ts +10 -1
- package/dist-lib/components/shared/ActionButton.d.ts +1 -7
- package/dist-lib/components/shared/ActionDialog.d.ts +2 -2
- package/dist-lib/components/shared/ResponsiveActionBar.d.ts +45 -23
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useParams.d.ts +45 -1
- package/dist-lib/index.d.ts +0 -2
- package/dist-lib/index.js +3561 -2570
- package/dist-lib/lib/actions.d.ts +44 -3
- package/dist-lib/lib/evidence-verdict.d.ts +11 -0
- package/dist-lib/lib/rowClickGesture.d.ts +14 -0
- package/dist-lib/registry-DFtAh6zc.js +4991 -0
- package/dist-lib/stores/list-layout.d.ts +86 -0
- package/dist-lib/testing.js +27 -27
- package/dist-lib/types/api.d.ts +29 -1
- package/dist-lib/types/schema.d.ts +12 -0
- package/dist-lib/{useCurrentScreen-DD3KdlMj.js → useCurrentScreen-mw8TfE8q.js} +596 -382
- package/dist-lib/{useProperties-CliP5qvg.js → useProperties-gMdnhdhO.js} +117 -117
- package/dist-lib/{value-CNy3_xCA.js → value-t9ETvWIJ.js} +4 -4
- package/package.json +1 -1
- package/dist-lib/SmartDetailPage.impl-Cl306lX3.js +0 -1768
- package/dist-lib/SmartRecordListPage.impl-j8bhyL4e.js +0 -763
- package/dist-lib/components/list/RowMenu.d.ts +0 -23
- package/dist-lib/components/shared/ActionConfirmDialog.d.ts +0 -10
- package/dist-lib/registry-C3hbFTDQ.js +0 -5400
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import { Suspense as
|
|
6
|
-
import { useInfiniteQuery as
|
|
2
|
+
import { $ as n, A as r, An as i, At as a, Dn as o, En as s, Fn as c, Jn as l, Kt as u, M as d, Q as f, Sn as p, Tn as m, Un as h, X as g, ar as _, bn as v, bt as y, er as b, f as x, hn as S, it as C, j as w, jn as T, or as E, sr as D, vt as O, wn as k, xn as A, yt as j } from "./useCurrentScreen-mw8TfE8q.js";
|
|
3
|
+
import { A as M, F as ee, I as N, J as P, L as F, P as I, R as L, T as R, V as z, at as B, d as V, it as te, mt as ne, o as re, pt as ie, q as ae, r as oe, t as se, u as ce, z as le } from "./registry-DFtAh6zc.js";
|
|
4
|
+
import { n as ue, r as de, t as fe } from "./dataTableStyles-vwD1mVOP.js";
|
|
5
|
+
import { Suspense as pe, createContext as me, lazy as he, useCallback as H, useContext as ge, useEffect as U, useId as _e, useLayoutEffect as ve, useMemo as W, useRef as G, useState as K } from "react";
|
|
6
|
+
import { useInfiniteQuery as ye, useMutation as be, useQueryClient as xe } from "@tanstack/react-query";
|
|
7
7
|
import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
8
8
|
//#region src/lib/size-value.ts
|
|
9
|
-
var
|
|
10
|
-
function
|
|
9
|
+
var Se = /^(\d+)px$/;
|
|
10
|
+
function Ce(e) {
|
|
11
11
|
if (e == null || e === "") return null;
|
|
12
12
|
if (e === "auto") return { kind: "auto" };
|
|
13
13
|
if (e === "fill") return { kind: "fill" };
|
|
14
|
-
let t =
|
|
14
|
+
let t = Se.exec(e);
|
|
15
15
|
if (t) {
|
|
16
16
|
let e = parseInt(t[1], 10);
|
|
17
17
|
return e > 0 ? {
|
|
@@ -27,7 +27,7 @@ function xe(e) {
|
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/components/detail-layout/LayoutRow.tsx
|
|
30
|
-
function
|
|
30
|
+
function we({ config: e, ctx: t }) {
|
|
31
31
|
let { items: n, gap: r = 0, resizable: i = !1, stack_below: a } = e, o = a === "never" ? 0 : a ?? 768, [s, c] = K(!1), l = G(null);
|
|
32
32
|
U(() => {
|
|
33
33
|
if (o === 0) return;
|
|
@@ -39,7 +39,7 @@ function Se({ config: e, ctx: t }) {
|
|
|
39
39
|
return t.observe(e), () => t.disconnect();
|
|
40
40
|
}, [o]);
|
|
41
41
|
let [u, d] = K(null), f = G(null), p = H(() => n.map((t) => {
|
|
42
|
-
let n =
|
|
42
|
+
let n = Ce(t.width ?? t.column?.width ?? t.row?.width ?? e.width);
|
|
43
43
|
return n && n.kind === "weight" ? n.value : 1;
|
|
44
44
|
}), [n, e.width]), m = H((e, t) => {
|
|
45
45
|
t.preventDefault();
|
|
@@ -58,19 +58,19 @@ function Se({ config: e, ctx: t }) {
|
|
|
58
58
|
f.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
59
59
|
};
|
|
60
60
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
61
|
-
}, [u, p]), h = u ?? p(), g = e.height ?
|
|
61
|
+
}, [u, p]), h = u ?? p(), g = e.height ? Ee(e.height) : void 0;
|
|
62
62
|
return /* @__PURE__ */ J("div", {
|
|
63
63
|
ref: l,
|
|
64
|
-
className:
|
|
64
|
+
className: B("flex", s && "flex-col"),
|
|
65
65
|
style: {
|
|
66
66
|
gap: r ? `${r}px` : void 0,
|
|
67
67
|
...g
|
|
68
68
|
},
|
|
69
69
|
children: n.map((r, a) => /* @__PURE__ */ Y("div", {
|
|
70
|
-
className:
|
|
71
|
-
style: s ? void 0 :
|
|
70
|
+
className: B("min-w-0 flex items-stretch", s && "w-full"),
|
|
71
|
+
style: s ? void 0 : Te(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
|
|
72
72
|
children: [/* @__PURE__ */ J("div", {
|
|
73
|
-
className:
|
|
73
|
+
className: B("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
|
|
74
74
|
children: /* @__PURE__ */ J($, {
|
|
75
75
|
node: r,
|
|
76
76
|
ctx: t
|
|
@@ -82,17 +82,17 @@ function Se({ config: e, ctx: t }) {
|
|
|
82
82
|
}, a))
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
let i =
|
|
85
|
+
function Te(e, t, n, r) {
|
|
86
|
+
let i = Ce(e), a;
|
|
87
87
|
return a = !i || i.kind === "weight" ? `${t} 1 0%` : i.kind === "px" ? `0 0 ${i.value}px` : i.kind === "fill" ? "1 1 0%" : "0 0 auto", {
|
|
88
88
|
flex: a,
|
|
89
89
|
minWidth: n,
|
|
90
90
|
maxWidth: r
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function Ee(e) {
|
|
94
94
|
if (!e) return;
|
|
95
|
-
let t =
|
|
95
|
+
let t = Ce(e);
|
|
96
96
|
if (t?.kind === "px") return {
|
|
97
97
|
height: `${t.value}px`,
|
|
98
98
|
overflow: "hidden"
|
|
@@ -104,7 +104,7 @@ function we(e) {
|
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/components/detail-layout/LayoutColumn.tsx
|
|
107
|
-
function
|
|
107
|
+
function De({ config: e, ctx: t }) {
|
|
108
108
|
let { items: n, gap: r = 12 } = e;
|
|
109
109
|
return /* @__PURE__ */ J("div", {
|
|
110
110
|
className: "flex flex-col h-full",
|
|
@@ -117,23 +117,23 @@ function Te({ config: e, ctx: t }) {
|
|
|
117
117
|
}
|
|
118
118
|
//#endregion
|
|
119
119
|
//#region src/components/detail-layout/blockMeta.ts
|
|
120
|
-
function
|
|
120
|
+
function Oe(e) {
|
|
121
121
|
return e.children ?? e.associated;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
let n =
|
|
123
|
+
function ke(e, t) {
|
|
124
|
+
let n = Oe(e);
|
|
125
125
|
if (n) {
|
|
126
|
-
if (e.label) return
|
|
126
|
+
if (e.label) return m(e.label);
|
|
127
127
|
let r = t.entity.children?.find((e) => e.entity === n);
|
|
128
|
-
if (r?.display?.name) return
|
|
128
|
+
if (r?.display?.name) return m(r.display.name);
|
|
129
129
|
let i = t.schema.entities[n];
|
|
130
|
-
return i && (
|
|
130
|
+
return i && (m(i.display.name_plural) || m(i.display.name)) || n;
|
|
131
131
|
}
|
|
132
|
-
return e.section ?
|
|
132
|
+
return e.section ? m(e.section.name) : "Tab";
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Ae(e, t) {
|
|
135
135
|
if (e.icon) return e.icon;
|
|
136
|
-
let n =
|
|
136
|
+
let n = Oe(e);
|
|
137
137
|
if (n) {
|
|
138
138
|
let e = t.entity.children?.find((e) => e.entity === n);
|
|
139
139
|
if (e?.display?.icon) return e.display.icon;
|
|
@@ -143,8 +143,8 @@ function Oe(e, t) {
|
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/components/detail-layout/LayoutTabs.tsx
|
|
146
|
-
function
|
|
147
|
-
let { items: r } = e, [i, a] = K(0), o =
|
|
146
|
+
function je({ config: e, ctx: n }) {
|
|
147
|
+
let { items: r } = e, [i, a] = K(0), o = b(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
|
|
148
148
|
if (r.length === 0) return null;
|
|
149
149
|
if (s === "sections") {
|
|
150
150
|
let e = r.map((e, t) => `detail-tab-section-${t}`);
|
|
@@ -165,7 +165,7 @@ function ke({ config: e, ctx: n }) {
|
|
|
165
165
|
WebkitOverflowScrolling: "touch"
|
|
166
166
|
},
|
|
167
167
|
children: r.map((r, i) => {
|
|
168
|
-
let a =
|
|
168
|
+
let a = ke(r, n), o = Ae(r, n);
|
|
169
169
|
return /* @__PURE__ */ Y("button", {
|
|
170
170
|
type: "button",
|
|
171
171
|
onClick: () => document.getElementById(e[i])?.scrollIntoView({
|
|
@@ -201,7 +201,7 @@ function ke({ config: e, ctx: n }) {
|
|
|
201
201
|
}, i);
|
|
202
202
|
})
|
|
203
203
|
}), r.map((r, i) => {
|
|
204
|
-
let a =
|
|
204
|
+
let a = ke(r, n), o = Ae(r, n);
|
|
205
205
|
return /* @__PURE__ */ Y("section", {
|
|
206
206
|
id: e[i],
|
|
207
207
|
style: {
|
|
@@ -268,7 +268,7 @@ function ke({ config: e, ctx: n }) {
|
|
|
268
268
|
overflowX: "auto"
|
|
269
269
|
},
|
|
270
270
|
children: r.map((e, r) => {
|
|
271
|
-
let o =
|
|
271
|
+
let o = ke(e, n), s = Ae(e, n), c = r === i;
|
|
272
272
|
return /* @__PURE__ */ Y("button", {
|
|
273
273
|
role: "tab",
|
|
274
274
|
"aria-selected": c,
|
|
@@ -330,7 +330,7 @@ function ke({ config: e, ctx: n }) {
|
|
|
330
330
|
}
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region src/components/detail-layout/SectionBlock.tsx
|
|
333
|
-
function
|
|
333
|
+
function Me({ config: e, ctx: n }) {
|
|
334
334
|
let { name: r, items: i, collapsed: a = !1, columns: o, icon: s, badge: c, emphasis: l } = e, u = {
|
|
335
335
|
...n,
|
|
336
336
|
withinCard: !0,
|
|
@@ -339,18 +339,18 @@ function Ae({ config: e, ctx: n }) {
|
|
|
339
339
|
name: s,
|
|
340
340
|
size: 14
|
|
341
341
|
}) : void 0, f = c ? {
|
|
342
|
-
text:
|
|
342
|
+
text: m(c.text),
|
|
343
343
|
tone: c.tone,
|
|
344
344
|
dot: c.dot
|
|
345
345
|
} : void 0;
|
|
346
|
-
return /* @__PURE__ */ J(
|
|
347
|
-
title:
|
|
346
|
+
return /* @__PURE__ */ J(ne, {
|
|
347
|
+
title: m(r),
|
|
348
348
|
defaultOpen: !a,
|
|
349
349
|
icon: d,
|
|
350
350
|
badge: f,
|
|
351
351
|
emphasis: l,
|
|
352
352
|
headingLevel: n.withinCard ? 3 : 2,
|
|
353
|
-
children: /* @__PURE__ */ J(
|
|
353
|
+
children: /* @__PURE__ */ J(ln, {
|
|
354
354
|
nodes: i,
|
|
355
355
|
ctx: u
|
|
356
356
|
})
|
|
@@ -358,22 +358,22 @@ function Ae({ config: e, ctx: n }) {
|
|
|
358
358
|
}
|
|
359
359
|
//#endregion
|
|
360
360
|
//#region src/lib/child-config.ts
|
|
361
|
-
function
|
|
361
|
+
function Ne(e, t, n) {
|
|
362
362
|
let r = e.display, i = X(n?.mode, r?.mode, "table"), a = i === "timeline" ? 50 : 20, o = {
|
|
363
363
|
entity: e.entity,
|
|
364
364
|
foreign_key: e.foreign_key,
|
|
365
|
-
name: X(n?.label, r?.name,
|
|
365
|
+
name: X(n?.label, r?.name, Fe(t)),
|
|
366
366
|
icon: X(n?.icon, r?.icon, t.display.icon) ?? "",
|
|
367
367
|
mode: i,
|
|
368
|
-
columns: X(n?.columns, r?.columns,
|
|
369
|
-
sort: X(n?.sort, r?.sort,
|
|
368
|
+
columns: X(n?.columns, r?.columns, Le(t, e.foreign_key)),
|
|
369
|
+
sort: X(n?.sort, r?.sort, Ie(t)),
|
|
370
370
|
limit: X(n?.limit, r?.limit, a),
|
|
371
371
|
editable: X(n?.editable, r?.editable, !0),
|
|
372
|
-
interaction: X(n?.interaction, r?.interaction,
|
|
372
|
+
interaction: X(n?.interaction, r?.interaction, Pe(t))
|
|
373
373
|
}, s = X(n?.position_field, r?.position_field, void 0);
|
|
374
374
|
s && (o.position_field = s, o.sort = s + ":asc");
|
|
375
375
|
let c = n?.timeline ?? r?.timeline;
|
|
376
|
-
o.mode === "timeline" ? o.timeline =
|
|
376
|
+
o.mode === "timeline" ? o.timeline = Re(c ?? {}, t) : c && (o.timeline = c);
|
|
377
377
|
let l = n?.cards ?? r?.cards;
|
|
378
378
|
l && (o.cards = l);
|
|
379
379
|
let u = n?.quick_add ?? e.quick_add;
|
|
@@ -382,13 +382,13 @@ function je(e, t, n) {
|
|
|
382
382
|
function X(e, t, n) {
|
|
383
383
|
return e ?? t ?? n;
|
|
384
384
|
}
|
|
385
|
-
function
|
|
386
|
-
return
|
|
385
|
+
function Pe(e) {
|
|
386
|
+
return v(e, "update") ? "inline_edit" : "readonly";
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function Fe(e) {
|
|
389
389
|
return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function Ie(e) {
|
|
392
392
|
if (e.fields.get("created_at")?.type === "timestamp") return "created_at:desc";
|
|
393
393
|
if (e.fields.get("updated_at")?.type === "timestamp") return "updated_at:desc";
|
|
394
394
|
for (let t of e.fields.names()) {
|
|
@@ -399,10 +399,10 @@ function Pe(e) {
|
|
|
399
399
|
let n = e.fields.get(t);
|
|
400
400
|
if (n && n.type === "date") return t + ":desc";
|
|
401
401
|
}
|
|
402
|
-
let t =
|
|
402
|
+
let t = We(e);
|
|
403
403
|
return t ? t + ":asc" : "";
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function Le(e, t) {
|
|
406
406
|
let n = new Set(Array.isArray(t) ? t : [t]), r = [];
|
|
407
407
|
for (let t of e.fields.names()) {
|
|
408
408
|
if (r.length >= 6) break;
|
|
@@ -411,11 +411,11 @@ function Fe(e, t) {
|
|
|
411
411
|
}
|
|
412
412
|
return r;
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function Re(e, t) {
|
|
415
415
|
let n = { ...e };
|
|
416
|
-
return n.time_field ||=
|
|
416
|
+
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;
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function ze(e) {
|
|
419
419
|
let t = e.fields.get("direction");
|
|
420
420
|
if (t && t.type === "enum") return "direction";
|
|
421
421
|
for (let t of [
|
|
@@ -428,11 +428,11 @@ function Le(e) {
|
|
|
428
428
|
if (n && n.type === "bool") return t;
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function Be(e) {
|
|
432
432
|
let t = e.fields.get("intent");
|
|
433
433
|
if (t && t.type === "enum") return "intent";
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function Ve(e) {
|
|
436
436
|
for (let t of e.fields.names()) {
|
|
437
437
|
let n = e.fields.get(t);
|
|
438
438
|
if (n && n.type === "timestamp" && !n.auto) return t;
|
|
@@ -444,13 +444,13 @@ function ze(e) {
|
|
|
444
444
|
if (n && n.type === "timestamp") return t;
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function He(e, t) {
|
|
448
448
|
for (let n of e.fields.names()) {
|
|
449
449
|
let r = e.fields.get(n);
|
|
450
450
|
if (r && r.type === t) return n;
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function Ue(e, ...t) {
|
|
454
454
|
for (let n of e.fields.names()) {
|
|
455
455
|
let r = e.fields.get(n);
|
|
456
456
|
if (r) {
|
|
@@ -458,28 +458,28 @@ function Ve(e, ...t) {
|
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
function
|
|
462
|
-
let t =
|
|
461
|
+
function We(e) {
|
|
462
|
+
let t = k(e);
|
|
463
463
|
return t.length > 0 ? t[0] : void 0;
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function Ge(e, t) {
|
|
466
466
|
return e.children?.find((e) => e.entity === t);
|
|
467
467
|
}
|
|
468
468
|
//#endregion
|
|
469
469
|
//#region src/lib/quick-add.ts
|
|
470
|
-
function
|
|
470
|
+
function Ke(e, t, n, r) {
|
|
471
471
|
let i = {
|
|
472
472
|
...t ?? {},
|
|
473
473
|
...e
|
|
474
474
|
};
|
|
475
475
|
if (Array.isArray(n)) {
|
|
476
|
-
let e = Array.isArray(r) ? r.map(String) :
|
|
476
|
+
let e = Array.isArray(r) ? r.map(String) : o(String(r), n.length);
|
|
477
477
|
if (!e || e.length !== n.length) throw Error("invalid composite parent id");
|
|
478
478
|
for (let t = 0; t < n.length; t++) i[n[t]] = e[t];
|
|
479
479
|
} else i[n] = Array.isArray(r) ? r[0] : r;
|
|
480
480
|
return i;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function qe(e, t) {
|
|
483
483
|
for (let n of t) {
|
|
484
484
|
let t = e[n];
|
|
485
485
|
if (t == null || t === "") return !1;
|
|
@@ -488,27 +488,27 @@ function Ge(e, t) {
|
|
|
488
488
|
}
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/components/detail-layout/useQuickAdd.ts
|
|
491
|
-
function
|
|
492
|
-
let [i,
|
|
491
|
+
function Je(e, t, n, r) {
|
|
492
|
+
let [i, a] = K(() => {
|
|
493
493
|
let t = e.quick_add, n = r.entities[e.entity], i = {};
|
|
494
|
-
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] =
|
|
494
|
+
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = f()) : i[e] = t.defaults[e];
|
|
495
495
|
return i;
|
|
496
|
-
}),
|
|
496
|
+
}), o = xe(), { mutate: c, isPending: l, error: u, reset: d } = be({
|
|
497
497
|
mutationFn: (t) => O(e.entity, t),
|
|
498
498
|
onMutate: async (r) => {
|
|
499
499
|
let i = [
|
|
500
|
-
|
|
500
|
+
F,
|
|
501
501
|
t,
|
|
502
|
-
Array.isArray(n) ?
|
|
502
|
+
Array.isArray(n) ? s(n.map(String)) : n,
|
|
503
503
|
e.entity
|
|
504
504
|
];
|
|
505
|
-
await
|
|
506
|
-
let a =
|
|
505
|
+
await o.cancelQueries({ queryKey: i });
|
|
506
|
+
let a = o.getQueriesData({ queryKey: i }), c = {
|
|
507
507
|
...r,
|
|
508
508
|
id: `__optimistic_${crypto.randomUUID()}`,
|
|
509
509
|
__optimistic: !0
|
|
510
510
|
};
|
|
511
|
-
return
|
|
511
|
+
return o.setQueriesData({ queryKey: i }, (e) => {
|
|
512
512
|
if (!e || typeof e != "object") return e;
|
|
513
513
|
if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
|
|
514
514
|
let t = e, [n, ...r] = t.pages;
|
|
@@ -516,7 +516,7 @@ function Ke(e, t, n, r) {
|
|
|
516
516
|
...t,
|
|
517
517
|
pages: [{
|
|
518
518
|
...n,
|
|
519
|
-
data: [
|
|
519
|
+
data: [c, ...n.data]
|
|
520
520
|
}, ...r]
|
|
521
521
|
};
|
|
522
522
|
}
|
|
@@ -524,54 +524,54 @@ function Ke(e, t, n, r) {
|
|
|
524
524
|
}), { snapshots: a };
|
|
525
525
|
},
|
|
526
526
|
onError: (e, t, n) => {
|
|
527
|
-
if (n?.snapshots) for (let [e, t] of n.snapshots)
|
|
527
|
+
if (n?.snapshots) for (let [e, t] of n.snapshots) o.setQueryData(e, t);
|
|
528
528
|
},
|
|
529
529
|
onSuccess: () => {
|
|
530
530
|
let t = e.quick_add, n = r.entities[e.entity], i = {};
|
|
531
|
-
if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? i[e] =
|
|
532
|
-
|
|
531
|
+
if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? i[e] = f() : i[e] = "" : i[e] = t.defaults[e];
|
|
532
|
+
a(i);
|
|
533
533
|
},
|
|
534
534
|
onSettled: () => {
|
|
535
|
-
let r = Array.isArray(n) ?
|
|
536
|
-
|
|
537
|
-
|
|
535
|
+
let r = Array.isArray(n) ? s(n.map(String)) : n;
|
|
536
|
+
o.invalidateQueries({ queryKey: [
|
|
537
|
+
F,
|
|
538
538
|
t,
|
|
539
539
|
r,
|
|
540
540
|
e.entity
|
|
541
541
|
] });
|
|
542
542
|
}
|
|
543
|
-
}),
|
|
543
|
+
}), p = e.quick_add, m = r.entities[e.entity], h = qe(i, p?.fields.filter((e) => m?.fields.get(e)?.required) ?? []);
|
|
544
544
|
function g(t) {
|
|
545
|
-
if (t.preventDefault(), !
|
|
546
|
-
let r =
|
|
545
|
+
if (t.preventDefault(), !p) return;
|
|
546
|
+
let r = Ke(i, p.defaults, e.foreign_key, n);
|
|
547
547
|
c(r);
|
|
548
548
|
}
|
|
549
549
|
function _(e, t) {
|
|
550
|
-
u && d(),
|
|
550
|
+
u && d(), a((n) => ({
|
|
551
551
|
...n,
|
|
552
552
|
[e]: t
|
|
553
553
|
}));
|
|
554
554
|
}
|
|
555
555
|
return {
|
|
556
556
|
values: i,
|
|
557
|
-
quickAdd:
|
|
558
|
-
childEntity:
|
|
557
|
+
quickAdd: p,
|
|
558
|
+
childEntity: m,
|
|
559
559
|
isPending: l,
|
|
560
560
|
error: u,
|
|
561
|
-
isReady:
|
|
561
|
+
isReady: h,
|
|
562
562
|
handleSubmit: g,
|
|
563
563
|
handleFieldChange: _
|
|
564
564
|
};
|
|
565
565
|
}
|
|
566
566
|
//#endregion
|
|
567
567
|
//#region src/components/detail-layout/QuickAddForm.tsx
|
|
568
|
-
function
|
|
569
|
-
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange:
|
|
568
|
+
function Ye({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
569
|
+
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: m } = Je(t, n, i, a), h = r(), g = b(), _ = _e();
|
|
570
570
|
return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ Y("form", {
|
|
571
571
|
onSubmit: f,
|
|
572
572
|
style: {
|
|
573
573
|
display: "flex",
|
|
574
|
-
flexDirection:
|
|
574
|
+
flexDirection: g.isPhone ? "column" : "row",
|
|
575
575
|
alignItems: "flex-end",
|
|
576
576
|
gap: 8,
|
|
577
577
|
padding: "8px 0",
|
|
@@ -581,12 +581,12 @@ function qe({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
581
581
|
s.fields.map((e) => {
|
|
582
582
|
let n = c.fields.get(e);
|
|
583
583
|
if (!n) return null;
|
|
584
|
-
let r = `${
|
|
584
|
+
let r = `${_}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
|
|
585
585
|
return /* @__PURE__ */ Y("div", {
|
|
586
586
|
style: {
|
|
587
587
|
flex: 1,
|
|
588
588
|
minWidth: 0,
|
|
589
|
-
width:
|
|
589
|
+
width: g.isPhone ? "100%" : void 0
|
|
590
590
|
},
|
|
591
591
|
children: [/* @__PURE__ */ J("label", {
|
|
592
592
|
id: i,
|
|
@@ -598,27 +598,27 @@ function qe({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
598
598
|
display: "block",
|
|
599
599
|
fontWeight: 500
|
|
600
600
|
},
|
|
601
|
-
children:
|
|
602
|
-
}),
|
|
601
|
+
children: p(n, e, a.entities)
|
|
602
|
+
}), w({
|
|
603
603
|
field: n,
|
|
604
604
|
fieldName: e,
|
|
605
605
|
value: o[e] ?? "",
|
|
606
606
|
mode: "edit",
|
|
607
|
-
onChange: (t) =>
|
|
607
|
+
onChange: (t) => m(e, t),
|
|
608
608
|
record: o,
|
|
609
609
|
fieldId: r,
|
|
610
610
|
labelId: i,
|
|
611
|
-
locale:
|
|
611
|
+
locale: h
|
|
612
612
|
})]
|
|
613
613
|
}, e);
|
|
614
614
|
}),
|
|
615
|
-
/* @__PURE__ */ J(
|
|
615
|
+
/* @__PURE__ */ J(D, {
|
|
616
616
|
type: "submit",
|
|
617
617
|
kind: "primary",
|
|
618
|
-
size:
|
|
618
|
+
size: g.isPhone ? "md" : "sm",
|
|
619
619
|
icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
|
|
620
620
|
disabled: l || !d,
|
|
621
|
-
style:
|
|
621
|
+
style: g.isPhone ? { alignSelf: "flex-end" } : void 0,
|
|
622
622
|
children: "Add"
|
|
623
623
|
}),
|
|
624
624
|
u != null && /* @__PURE__ */ J("span", {
|
|
@@ -634,35 +634,125 @@ function qe({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
636
|
//#endregion
|
|
637
|
+
//#region src/components/detail-layout/useManualColumnResize.tsx
|
|
638
|
+
function Xe(e, t, n) {
|
|
639
|
+
return `${e}::child::${t}.${n}`;
|
|
640
|
+
}
|
|
641
|
+
function Ze(e) {
|
|
642
|
+
return Math.min(le, Math.max(60, Math.round(e)));
|
|
643
|
+
}
|
|
644
|
+
function Qe(e) {
|
|
645
|
+
let { widths: t, setWidths: n, resetWidths: r } = z(e), [i, a] = K({}), o = G(null);
|
|
646
|
+
U(() => {
|
|
647
|
+
let e = (e) => {
|
|
648
|
+
let t = o.current;
|
|
649
|
+
if (!t) return;
|
|
650
|
+
let n = Ze(t.startWidth + (e.clientX - t.startX));
|
|
651
|
+
t.current = n, a({ [t.colId]: n });
|
|
652
|
+
}, t = () => {
|
|
653
|
+
let e = o.current;
|
|
654
|
+
e && (o.current = null, n({ [e.colId]: e.current }), a({}));
|
|
655
|
+
};
|
|
656
|
+
return window.addEventListener("mousemove", e), window.addEventListener("mouseup", t), () => {
|
|
657
|
+
window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", t);
|
|
658
|
+
};
|
|
659
|
+
}, [n]);
|
|
660
|
+
let s = H((e, n) => {
|
|
661
|
+
n.preventDefault(), n.stopPropagation();
|
|
662
|
+
let r = n.currentTarget.closest("th")?.getBoundingClientRect().width, i = t[e] ?? (r && r > 0 ? r : 150);
|
|
663
|
+
o.current = {
|
|
664
|
+
colId: e,
|
|
665
|
+
startX: n.clientX,
|
|
666
|
+
startWidth: Math.round(i),
|
|
667
|
+
current: Math.round(i)
|
|
668
|
+
};
|
|
669
|
+
}, [t]);
|
|
670
|
+
return {
|
|
671
|
+
headerStyle: H((e, n) => {
|
|
672
|
+
let r = i[e] ?? t[e];
|
|
673
|
+
return r == null ? {
|
|
674
|
+
...n,
|
|
675
|
+
position: "relative"
|
|
676
|
+
} : {
|
|
677
|
+
...n,
|
|
678
|
+
position: "relative",
|
|
679
|
+
width: r,
|
|
680
|
+
minWidth: r,
|
|
681
|
+
maxWidth: r
|
|
682
|
+
};
|
|
683
|
+
}, [i, t]),
|
|
684
|
+
cellStyle: H((e, n) => {
|
|
685
|
+
let r = i[e] ?? t[e];
|
|
686
|
+
return r == null ? n : {
|
|
687
|
+
...n,
|
|
688
|
+
width: r,
|
|
689
|
+
maxWidth: r,
|
|
690
|
+
overflow: "hidden",
|
|
691
|
+
textOverflow: "ellipsis",
|
|
692
|
+
whiteSpace: "nowrap"
|
|
693
|
+
};
|
|
694
|
+
}, [i, t]),
|
|
695
|
+
onHandleMouseDown: s,
|
|
696
|
+
hasWidths: Object.keys(t).length > 0,
|
|
697
|
+
resetWidths: r
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
function $e({ colId: e, onMouseDown: t }) {
|
|
701
|
+
return /* @__PURE__ */ J("span", {
|
|
702
|
+
"data-testid": "col-resize-handle",
|
|
703
|
+
"aria-hidden": "true",
|
|
704
|
+
onMouseDown: (n) => t(e, n),
|
|
705
|
+
onClick: (e) => e.stopPropagation(),
|
|
706
|
+
style: {
|
|
707
|
+
position: "absolute",
|
|
708
|
+
top: 0,
|
|
709
|
+
right: 0,
|
|
710
|
+
height: "100%",
|
|
711
|
+
width: 9,
|
|
712
|
+
display: "flex",
|
|
713
|
+
justifyContent: "center",
|
|
714
|
+
cursor: "col-resize",
|
|
715
|
+
userSelect: "none"
|
|
716
|
+
},
|
|
717
|
+
children: /* @__PURE__ */ J("span", { style: {
|
|
718
|
+
width: 2,
|
|
719
|
+
height: "55%",
|
|
720
|
+
alignSelf: "center",
|
|
721
|
+
background: "var(--border)",
|
|
722
|
+
borderRadius: 1
|
|
723
|
+
} })
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
//#endregion
|
|
637
727
|
//#region src/components/detail-layout/ChildrenTable.tsx
|
|
638
|
-
function
|
|
639
|
-
let
|
|
640
|
-
|
|
641
|
-
let
|
|
728
|
+
function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
729
|
+
let o = a.entities[t.entity], s = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, u = Qe(Xe(n, t.entity, s)), f = r(), m = N((e) => e.degradedEntities), { data: h, isLoading: g, isError: v, isFetching: y, refetch: b } = L(n, i, t.entity, t.foreign_key, t.sort, t.limit), x = h?.data ?? [], S = h?.$refs, C = G(S);
|
|
730
|
+
C.current = S;
|
|
731
|
+
let w = t.columns, D = t.interaction === "navigate", O = w[0], k = D && o ? T(void 0, o, a.screens) : null, A = o ? We(o) : void 0, j = W(() => {
|
|
642
732
|
let e = /* @__PURE__ */ new Map();
|
|
643
|
-
if (!
|
|
644
|
-
for (let t of
|
|
645
|
-
let n =
|
|
733
|
+
if (!o) return e;
|
|
734
|
+
for (let t of w) {
|
|
735
|
+
let n = o.fields.get(t);
|
|
646
736
|
n && e.set(t, d({
|
|
647
737
|
field: n,
|
|
648
738
|
fieldName: t,
|
|
649
739
|
surface: "list",
|
|
650
|
-
entity:
|
|
740
|
+
entity: o,
|
|
651
741
|
entities: a.entities,
|
|
652
742
|
screens: a.screens,
|
|
653
|
-
refs: () =>
|
|
654
|
-
locale:
|
|
743
|
+
refs: () => C.current,
|
|
744
|
+
locale: f
|
|
655
745
|
}));
|
|
656
746
|
}
|
|
657
747
|
return e;
|
|
658
748
|
}, [
|
|
659
|
-
|
|
660
|
-
|
|
749
|
+
o,
|
|
750
|
+
w,
|
|
661
751
|
a.entities,
|
|
662
752
|
a.screens,
|
|
663
|
-
|
|
753
|
+
f
|
|
664
754
|
]);
|
|
665
|
-
if (!
|
|
755
|
+
if (!o) return /* @__PURE__ */ J("div", {
|
|
666
756
|
style: {
|
|
667
757
|
fontSize: 12.5,
|
|
668
758
|
color: "var(--text-3)",
|
|
@@ -670,12 +760,12 @@ function Je({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
670
760
|
},
|
|
671
761
|
children: "Entity not found."
|
|
672
762
|
});
|
|
673
|
-
let
|
|
763
|
+
let M = /* @__PURE__ */ J(Ye, {
|
|
674
764
|
config: t,
|
|
675
765
|
parentEntity: n,
|
|
676
766
|
parentId: i,
|
|
677
767
|
schema: a
|
|
678
|
-
}),
|
|
768
|
+
}), P = ee(o.realtime, m, t.entity), F = /* @__PURE__ */ Y("div", {
|
|
679
769
|
style: {
|
|
680
770
|
display: "flex",
|
|
681
771
|
alignItems: "center",
|
|
@@ -683,32 +773,41 @@ function Je({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
683
773
|
padding: "4px 0",
|
|
684
774
|
justifyContent: "flex-end"
|
|
685
775
|
},
|
|
686
|
-
children: [
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
776
|
+
children: [
|
|
777
|
+
u.hasWidths && /* @__PURE__ */ J(E, {
|
|
778
|
+
icon: /* @__PURE__ */ J(e.columns, { size: 13 }),
|
|
779
|
+
title: "Reset column widths (this device)",
|
|
780
|
+
size: 24,
|
|
781
|
+
onClick: u.resetWidths
|
|
782
|
+
}),
|
|
783
|
+
P && /* @__PURE__ */ J("span", {
|
|
784
|
+
"data-testid": "children-live-indicator",
|
|
785
|
+
title: "This table updates automatically in realtime.",
|
|
786
|
+
children: /* @__PURE__ */ J(_, {
|
|
787
|
+
tone: "emerald",
|
|
788
|
+
size: "xs",
|
|
789
|
+
dot: !0,
|
|
790
|
+
children: "Live"
|
|
791
|
+
})
|
|
792
|
+
}),
|
|
793
|
+
/* @__PURE__ */ J(E, {
|
|
794
|
+
icon: y ? /* @__PURE__ */ J("span", {
|
|
795
|
+
"data-testid": "children-refresh-spinner",
|
|
796
|
+
style: { display: "inline-flex" },
|
|
797
|
+
children: /* @__PURE__ */ J(l, { size: 13 })
|
|
798
|
+
}) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
|
|
799
|
+
title: "Refresh",
|
|
800
|
+
size: 24,
|
|
801
|
+
disabled: y,
|
|
802
|
+
onClick: () => {
|
|
803
|
+
b();
|
|
804
|
+
}
|
|
694
805
|
})
|
|
695
|
-
|
|
696
|
-
icon: g ? /* @__PURE__ */ J("span", {
|
|
697
|
-
"data-testid": "children-refresh-spinner",
|
|
698
|
-
style: { display: "inline-flex" },
|
|
699
|
-
children: /* @__PURE__ */ J(o, { size: 13 })
|
|
700
|
-
}) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
|
|
701
|
-
title: "Refresh",
|
|
702
|
-
size: 24,
|
|
703
|
-
disabled: g,
|
|
704
|
-
onClick: () => {
|
|
705
|
-
_();
|
|
706
|
-
}
|
|
707
|
-
})]
|
|
806
|
+
]
|
|
708
807
|
});
|
|
709
|
-
return
|
|
710
|
-
|
|
711
|
-
|
|
808
|
+
return v ? /* @__PURE__ */ Y("div", { children: [
|
|
809
|
+
M,
|
|
810
|
+
F,
|
|
712
811
|
/* @__PURE__ */ J("div", {
|
|
713
812
|
style: {
|
|
714
813
|
fontSize: 12.5,
|
|
@@ -717,9 +816,9 @@ function Je({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
717
816
|
},
|
|
718
817
|
children: "Failed to load. Try again."
|
|
719
818
|
})
|
|
720
|
-
] }) :
|
|
721
|
-
|
|
722
|
-
|
|
819
|
+
] }) : g ? /* @__PURE__ */ Y("div", { children: [
|
|
820
|
+
M,
|
|
821
|
+
F,
|
|
723
822
|
/* @__PURE__ */ J("div", {
|
|
724
823
|
style: {
|
|
725
824
|
display: "flex",
|
|
@@ -737,9 +836,9 @@ function Je({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
737
836
|
borderRadius: 4
|
|
738
837
|
} }, e))
|
|
739
838
|
})
|
|
740
|
-
] }) :
|
|
741
|
-
|
|
742
|
-
|
|
839
|
+
] }) : x.length === 0 ? /* @__PURE__ */ Y("div", { children: [
|
|
840
|
+
M,
|
|
841
|
+
F,
|
|
743
842
|
/* @__PURE__ */ J("div", {
|
|
744
843
|
style: {
|
|
745
844
|
fontSize: 12.5,
|
|
@@ -749,25 +848,28 @@ function Je({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
749
848
|
children: "No records yet."
|
|
750
849
|
})
|
|
751
850
|
] }) : /* @__PURE__ */ Y("div", { children: [
|
|
752
|
-
|
|
753
|
-
|
|
851
|
+
M,
|
|
852
|
+
F,
|
|
754
853
|
/* @__PURE__ */ J("div", {
|
|
755
854
|
style: { overflowX: "auto" },
|
|
756
855
|
children: /* @__PURE__ */ Y("table", {
|
|
757
|
-
style:
|
|
758
|
-
children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children:
|
|
759
|
-
let t =
|
|
760
|
-
return /* @__PURE__ */
|
|
761
|
-
style:
|
|
762
|
-
children: t ?
|
|
856
|
+
style: de,
|
|
857
|
+
children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: w.map((e) => {
|
|
858
|
+
let t = o.fields.get(e);
|
|
859
|
+
return /* @__PURE__ */ Y("th", {
|
|
860
|
+
style: u.headerStyle(e, ue),
|
|
861
|
+
children: [t ? p(t, e, a.entities) : e, /* @__PURE__ */ J($e, {
|
|
862
|
+
colId: e,
|
|
863
|
+
onMouseDown: u.onHandleMouseDown
|
|
864
|
+
})]
|
|
763
865
|
}, e);
|
|
764
|
-
}) }) }), /* @__PURE__ */ J("tbody", { children:
|
|
765
|
-
let n =
|
|
766
|
-
return /* @__PURE__ */ J("tr", { children:
|
|
767
|
-
let n = t ===
|
|
866
|
+
}) }) }), /* @__PURE__ */ J("tbody", { children: x.map((e, t) => {
|
|
867
|
+
let n = A ? c(e[A]) : "", r = D && k && n ? k.replace(/:\w+/, n) : void 0;
|
|
868
|
+
return /* @__PURE__ */ J("tr", { children: w.map((t) => {
|
|
869
|
+
let n = t === O, i = j.get(t), a = i ? i(e[t], e) : c(e[t]);
|
|
768
870
|
return /* @__PURE__ */ J("td", {
|
|
769
871
|
title: typeof a == "string" ? a : void 0,
|
|
770
|
-
style:
|
|
872
|
+
style: u.cellStyle(t, fe),
|
|
771
873
|
children: n && r ? /* @__PURE__ */ J("a", {
|
|
772
874
|
href: r,
|
|
773
875
|
style: {
|
|
@@ -780,7 +882,7 @@ function Je({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
780
882
|
children: a
|
|
781
883
|
}) : a
|
|
782
884
|
}, t);
|
|
783
|
-
}) },
|
|
885
|
+
}) }, c(e.id ?? t));
|
|
784
886
|
}) })]
|
|
785
887
|
})
|
|
786
888
|
})
|
|
@@ -788,9 +890,9 @@ function Je({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
788
890
|
}
|
|
789
891
|
//#endregion
|
|
790
892
|
//#region src/components/detail-layout/ChildrenList.tsx
|
|
791
|
-
function
|
|
792
|
-
let
|
|
793
|
-
if (!
|
|
893
|
+
function tt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
894
|
+
let a = i.entities[e.entity], o = r(), { data: s, isLoading: l, isError: u } = L(t, n, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns;
|
|
895
|
+
if (!a) return /* @__PURE__ */ J("div", {
|
|
794
896
|
style: {
|
|
795
897
|
fontSize: 12.5,
|
|
796
898
|
color: "var(--text-3)",
|
|
@@ -798,13 +900,13 @@ function Ye({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
798
900
|
},
|
|
799
901
|
children: "Entity not found."
|
|
800
902
|
});
|
|
801
|
-
let
|
|
903
|
+
let m = /* @__PURE__ */ J(Ye, {
|
|
802
904
|
config: e,
|
|
803
905
|
parentEntity: t,
|
|
804
906
|
parentId: n,
|
|
805
|
-
schema:
|
|
907
|
+
schema: i
|
|
806
908
|
});
|
|
807
|
-
if (
|
|
909
|
+
if (u) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
|
|
808
910
|
style: {
|
|
809
911
|
fontSize: 12.5,
|
|
810
912
|
color: "var(--danger)",
|
|
@@ -812,7 +914,7 @@ function Ye({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
812
914
|
},
|
|
813
915
|
children: "Failed to load. Try again."
|
|
814
916
|
})] });
|
|
815
|
-
if (
|
|
917
|
+
if (l) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ Y("div", {
|
|
816
918
|
style: {
|
|
817
919
|
display: "flex",
|
|
818
920
|
flexDirection: "column",
|
|
@@ -838,7 +940,7 @@ function Ye({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
838
940
|
} })
|
|
839
941
|
]
|
|
840
942
|
})] });
|
|
841
|
-
if (
|
|
943
|
+
if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
|
|
842
944
|
style: {
|
|
843
945
|
fontSize: 12.5,
|
|
844
946
|
color: "var(--text-3)",
|
|
@@ -846,13 +948,13 @@ function Ye({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
846
948
|
},
|
|
847
949
|
children: "No records yet."
|
|
848
950
|
})] });
|
|
849
|
-
let
|
|
850
|
-
return /* @__PURE__ */ Y("div", { children: [
|
|
951
|
+
let h = p.length > 0 ? a.display.display_field ?? p[0] : a.display.display_field;
|
|
952
|
+
return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
|
|
851
953
|
style: {
|
|
852
954
|
display: "flex",
|
|
853
955
|
flexDirection: "column"
|
|
854
956
|
},
|
|
855
|
-
children:
|
|
957
|
+
children: d.map((e, t) => /* @__PURE__ */ J("div", {
|
|
856
958
|
style: {
|
|
857
959
|
display: "flex",
|
|
858
960
|
alignItems: "center",
|
|
@@ -872,17 +974,17 @@ function Ye({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
872
974
|
textOverflow: "ellipsis",
|
|
873
975
|
whiteSpace: "nowrap"
|
|
874
976
|
},
|
|
875
|
-
children: (typeof e.$display == "string" ? e[
|
|
876
|
-
field:
|
|
877
|
-
fieldName:
|
|
878
|
-
value: e[
|
|
977
|
+
children: (typeof e.$display == "string" ? e[S] : "") || (h && a.fields.get(h) ? w({
|
|
978
|
+
field: a.fields.get(h),
|
|
979
|
+
fieldName: h,
|
|
980
|
+
value: e[h],
|
|
879
981
|
mode: "display",
|
|
880
982
|
record: e,
|
|
881
|
-
refs:
|
|
882
|
-
locale:
|
|
883
|
-
}) :
|
|
884
|
-
}),
|
|
885
|
-
let t =
|
|
983
|
+
refs: f,
|
|
984
|
+
locale: o
|
|
985
|
+
}) : h && e[h] != null ? c(e[h]) : null)
|
|
986
|
+
}), p.length > 1 && (() => {
|
|
987
|
+
let t = p.slice(1, 3).filter((t) => e[t] != null);
|
|
886
988
|
return t.length === 0 ? null : /* @__PURE__ */ J("div", {
|
|
887
989
|
style: {
|
|
888
990
|
fontSize: 11.5,
|
|
@@ -891,26 +993,26 @@ function Ye({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
891
993
|
textOverflow: "ellipsis",
|
|
892
994
|
whiteSpace: "nowrap"
|
|
893
995
|
},
|
|
894
|
-
children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ",
|
|
895
|
-
field:
|
|
996
|
+
children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", a.fields.get(t) ? w({
|
|
997
|
+
field: a.fields.get(t),
|
|
896
998
|
fieldName: t,
|
|
897
999
|
value: e[t],
|
|
898
1000
|
mode: "display",
|
|
899
1001
|
record: e,
|
|
900
|
-
refs:
|
|
901
|
-
locale:
|
|
1002
|
+
refs: f,
|
|
1003
|
+
locale: o
|
|
902
1004
|
}) : String(e[t])] }, t))
|
|
903
1005
|
});
|
|
904
1006
|
})()]
|
|
905
1007
|
})
|
|
906
|
-
},
|
|
1008
|
+
}, c(e.id ?? t)))
|
|
907
1009
|
})] });
|
|
908
1010
|
}
|
|
909
1011
|
//#endregion
|
|
910
1012
|
//#region src/components/detail-layout/ChildrenCards.tsx
|
|
911
|
-
function
|
|
912
|
-
let
|
|
913
|
-
if (!
|
|
1013
|
+
function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
|
|
1014
|
+
let a = i.entities[e.entity], o = r(), { data: s, isLoading: l, isError: u } = L(t, n, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns, m = e.cards, h = m?.header_field ?? p[0], g = m?.badge_field, v = m?.columns_count ?? 3;
|
|
1015
|
+
if (!a) return /* @__PURE__ */ J("div", {
|
|
914
1016
|
style: {
|
|
915
1017
|
fontSize: 12.5,
|
|
916
1018
|
color: "var(--text-3)",
|
|
@@ -920,15 +1022,15 @@ function Xe({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
920
1022
|
});
|
|
921
1023
|
let y = {
|
|
922
1024
|
display: "grid",
|
|
923
|
-
gridTemplateColumns: `repeat(auto-fill, minmax(${
|
|
1025
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${v >= 4 ? 180 : 240}px, 1fr))`,
|
|
924
1026
|
gap: 12
|
|
925
|
-
},
|
|
1027
|
+
}, b = /* @__PURE__ */ J(Ye, {
|
|
926
1028
|
config: e,
|
|
927
1029
|
parentEntity: t,
|
|
928
1030
|
parentId: n,
|
|
929
|
-
schema:
|
|
1031
|
+
schema: i
|
|
930
1032
|
});
|
|
931
|
-
if (
|
|
1033
|
+
if (u) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
|
|
932
1034
|
style: {
|
|
933
1035
|
fontSize: 12.5,
|
|
934
1036
|
color: "var(--danger)",
|
|
@@ -936,7 +1038,7 @@ function Xe({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
936
1038
|
},
|
|
937
1039
|
children: "Failed to load. Try again."
|
|
938
1040
|
})] });
|
|
939
|
-
if (
|
|
1041
|
+
if (l) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
|
|
940
1042
|
style: y,
|
|
941
1043
|
children: [
|
|
942
1044
|
0,
|
|
@@ -948,7 +1050,7 @@ function Xe({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
948
1050
|
borderRadius: 10
|
|
949
1051
|
} }, e))
|
|
950
1052
|
})] });
|
|
951
|
-
if (
|
|
1053
|
+
if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
|
|
952
1054
|
style: {
|
|
953
1055
|
fontSize: 12.5,
|
|
954
1056
|
color: "var(--text-3)",
|
|
@@ -956,10 +1058,10 @@ function Xe({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
956
1058
|
},
|
|
957
1059
|
children: "No records yet."
|
|
958
1060
|
})] });
|
|
959
|
-
let
|
|
960
|
-
return /* @__PURE__ */ Y("div", { children: [
|
|
1061
|
+
let x = p.filter((e) => e !== h && e !== g);
|
|
1062
|
+
return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
|
|
961
1063
|
style: y,
|
|
962
|
-
children:
|
|
1064
|
+
children: d.map((t, n) => /* @__PURE__ */ Y("div", {
|
|
963
1065
|
style: {
|
|
964
1066
|
background: "var(--surface)",
|
|
965
1067
|
border: "1px solid var(--border)",
|
|
@@ -973,7 +1075,7 @@ function Xe({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
973
1075
|
alignItems: "center",
|
|
974
1076
|
justifyContent: "space-between",
|
|
975
1077
|
gap: 8,
|
|
976
|
-
borderBottom:
|
|
1078
|
+
borderBottom: x.length > 0 ? "1px solid var(--divider)" : "none"
|
|
977
1079
|
},
|
|
978
1080
|
children: [/* @__PURE__ */ J("div", {
|
|
979
1081
|
style: {
|
|
@@ -983,38 +1085,38 @@ function Xe({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
983
1085
|
textOverflow: "ellipsis",
|
|
984
1086
|
whiteSpace: "nowrap"
|
|
985
1087
|
},
|
|
986
|
-
children: h &&
|
|
987
|
-
field:
|
|
1088
|
+
children: h && a.fields.get(h) ? w({
|
|
1089
|
+
field: a.fields.get(h),
|
|
988
1090
|
fieldName: h,
|
|
989
1091
|
value: t[h],
|
|
990
1092
|
mode: "display",
|
|
991
1093
|
record: t,
|
|
992
|
-
refs:
|
|
993
|
-
locale:
|
|
1094
|
+
refs: f,
|
|
1095
|
+
locale: o
|
|
994
1096
|
}) : `Record ${n + 1}`
|
|
995
|
-
}), g && t[g] != null && /* @__PURE__ */ J(
|
|
1097
|
+
}), g && t[g] != null && /* @__PURE__ */ J(_, {
|
|
996
1098
|
tone: "slate",
|
|
997
1099
|
size: "xs",
|
|
998
|
-
children:
|
|
999
|
-
field:
|
|
1100
|
+
children: a.fields.get(g) ? w({
|
|
1101
|
+
field: a.fields.get(g),
|
|
1000
1102
|
fieldName: g,
|
|
1001
1103
|
value: t[g],
|
|
1002
1104
|
mode: "display",
|
|
1003
1105
|
record: t,
|
|
1004
|
-
refs:
|
|
1005
|
-
locale:
|
|
1006
|
-
}) :
|
|
1106
|
+
refs: f,
|
|
1107
|
+
locale: o
|
|
1108
|
+
}) : c(t[g])
|
|
1007
1109
|
})]
|
|
1008
|
-
}),
|
|
1110
|
+
}), x.length > 0 && /* @__PURE__ */ J("div", {
|
|
1009
1111
|
style: {
|
|
1010
1112
|
padding: "10px 14px",
|
|
1011
1113
|
display: "flex",
|
|
1012
1114
|
flexDirection: "column",
|
|
1013
1115
|
gap: 4
|
|
1014
1116
|
},
|
|
1015
|
-
children:
|
|
1016
|
-
let
|
|
1017
|
-
return
|
|
1117
|
+
children: x.slice(0, 4).map((n) => {
|
|
1118
|
+
let r = a.fields.get(n);
|
|
1119
|
+
return r ? /* @__PURE__ */ Y("div", {
|
|
1018
1120
|
style: {
|
|
1019
1121
|
display: "flex",
|
|
1020
1122
|
alignItems: "baseline",
|
|
@@ -1026,100 +1128,100 @@ function Xe({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1026
1128
|
color: "var(--text-3)",
|
|
1027
1129
|
flexShrink: 0
|
|
1028
1130
|
},
|
|
1029
|
-
children: [
|
|
1131
|
+
children: [i.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(i.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
|
|
1030
1132
|
}), /* @__PURE__ */ J("span", {
|
|
1031
1133
|
style: {
|
|
1032
1134
|
overflow: "hidden",
|
|
1033
1135
|
textOverflow: "ellipsis",
|
|
1034
1136
|
whiteSpace: "nowrap"
|
|
1035
1137
|
},
|
|
1036
|
-
children:
|
|
1037
|
-
field:
|
|
1138
|
+
children: w({
|
|
1139
|
+
field: r,
|
|
1038
1140
|
fieldName: n,
|
|
1039
1141
|
value: t[n],
|
|
1040
1142
|
mode: "display",
|
|
1041
1143
|
record: t,
|
|
1042
|
-
refs:
|
|
1043
|
-
locale:
|
|
1144
|
+
refs: f,
|
|
1145
|
+
locale: o
|
|
1044
1146
|
})
|
|
1045
1147
|
})]
|
|
1046
1148
|
}, n) : null;
|
|
1047
1149
|
})
|
|
1048
1150
|
})]
|
|
1049
|
-
},
|
|
1151
|
+
}, c(t.id ?? n)))
|
|
1050
1152
|
})] });
|
|
1051
1153
|
}
|
|
1052
1154
|
//#endregion
|
|
1053
1155
|
//#region src/hooks/useTimelineData.ts
|
|
1054
|
-
var
|
|
1055
|
-
function
|
|
1056
|
-
let
|
|
1156
|
+
var rt = 50;
|
|
1157
|
+
function it(e, t, n, r, i, a) {
|
|
1158
|
+
let s = Array.isArray(r) ? r : [r], c = Array.isArray(r) ? o(t, s.length) : [t], l = a ?? rt, d = ye({
|
|
1057
1159
|
queryKey: [
|
|
1058
|
-
|
|
1160
|
+
F,
|
|
1059
1161
|
e,
|
|
1060
1162
|
t,
|
|
1061
1163
|
n,
|
|
1062
1164
|
"timeline",
|
|
1063
1165
|
i,
|
|
1064
|
-
|
|
1166
|
+
l
|
|
1065
1167
|
],
|
|
1066
1168
|
queryFn: ({ pageParam: e }) => {
|
|
1067
1169
|
let t = new URLSearchParams();
|
|
1068
|
-
if (!
|
|
1069
|
-
let r =
|
|
1170
|
+
if (!c) throw Error("invalid composite parent id");
|
|
1171
|
+
let r = s.map((e, t) => ({
|
|
1070
1172
|
field: e,
|
|
1071
1173
|
op: "eq",
|
|
1072
|
-
value:
|
|
1174
|
+
value: c[t]
|
|
1073
1175
|
}));
|
|
1074
|
-
return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(
|
|
1176
|
+
return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(l)), e && t.set("after", e), u(`/api/data/${n}?${t.toString()}`);
|
|
1075
1177
|
},
|
|
1076
1178
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
1077
1179
|
initialPageParam: void 0,
|
|
1078
|
-
enabled: !!e && !!t && !!n && !!r &&
|
|
1180
|
+
enabled: !!e && !!t && !!n && !!r && c !== null
|
|
1079
1181
|
});
|
|
1080
1182
|
return {
|
|
1081
|
-
rows: W(() =>
|
|
1082
|
-
refs:
|
|
1083
|
-
fetchNextPage:
|
|
1084
|
-
hasOlder: !!
|
|
1085
|
-
isFetchingOlder:
|
|
1086
|
-
isLoading:
|
|
1087
|
-
isError:
|
|
1183
|
+
rows: W(() => d.data?.pages.flatMap((e) => e.data) ?? [], [d.data?.pages]),
|
|
1184
|
+
refs: d.data?.pages[0]?.$refs,
|
|
1185
|
+
fetchNextPage: d.fetchNextPage,
|
|
1186
|
+
hasOlder: !!d.hasNextPage,
|
|
1187
|
+
isFetchingOlder: d.isFetchingNextPage,
|
|
1188
|
+
isLoading: d.isLoading,
|
|
1189
|
+
isError: d.isError
|
|
1088
1190
|
};
|
|
1089
1191
|
}
|
|
1090
1192
|
//#endregion
|
|
1091
1193
|
//#region src/components/detail-layout/TimelineComposer.tsx
|
|
1092
|
-
var
|
|
1093
|
-
function
|
|
1094
|
-
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } =
|
|
1194
|
+
var at = "quick_entry", ot = 100, st = 240, ct = 800, lt = 80;
|
|
1195
|
+
function ut({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
1196
|
+
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n, i, a), m = r(), [h, g] = K(st), _ = G(null), v = G(null), [y, b] = K(ct);
|
|
1095
1197
|
U(() => {
|
|
1096
|
-
let e =
|
|
1198
|
+
let e = v.current?.parentElement;
|
|
1097
1199
|
if (!e) return;
|
|
1098
1200
|
let t = () => {
|
|
1099
|
-
let t = Math.max(
|
|
1100
|
-
|
|
1201
|
+
let t = Math.max(ot, e.clientHeight - lt);
|
|
1202
|
+
b(Math.min(ct, t));
|
|
1101
1203
|
};
|
|
1102
1204
|
t();
|
|
1103
1205
|
let n = new ResizeObserver(t);
|
|
1104
1206
|
return n.observe(e), () => n.disconnect();
|
|
1105
1207
|
}, []), U(() => {
|
|
1106
|
-
g((e) => Math.min(e,
|
|
1107
|
-
}, [
|
|
1108
|
-
let
|
|
1109
|
-
|
|
1110
|
-
let
|
|
1111
|
-
|
|
1112
|
-
let T = G({}),
|
|
1113
|
-
getField: (e) =>
|
|
1208
|
+
g((e) => Math.min(e, y));
|
|
1209
|
+
}, [y]);
|
|
1210
|
+
let S = G(o);
|
|
1211
|
+
S.current = o;
|
|
1212
|
+
let C = G(p);
|
|
1213
|
+
C.current = p;
|
|
1214
|
+
let T = G({}), E = W(() => ({
|
|
1215
|
+
getField: (e) => S.current[e],
|
|
1114
1216
|
setField: (e, t) => {
|
|
1115
|
-
|
|
1217
|
+
C.current(e, t);
|
|
1116
1218
|
},
|
|
1117
1219
|
focusField: (e) => {
|
|
1118
1220
|
let t = T.current[e];
|
|
1119
1221
|
t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
|
|
1120
1222
|
}
|
|
1121
1223
|
}), []);
|
|
1122
|
-
U(() =>
|
|
1224
|
+
U(() => x(at, E), [E]);
|
|
1123
1225
|
let O = H((e) => {
|
|
1124
1226
|
e.preventDefault(), _.current = {
|
|
1125
1227
|
startY: e.clientY,
|
|
@@ -1127,13 +1229,13 @@ function it({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1127
1229
|
};
|
|
1128
1230
|
let t = (e) => {
|
|
1129
1231
|
if (!_.current) return;
|
|
1130
|
-
let t = _.current.startY - e.clientY, n = Math.min(
|
|
1232
|
+
let t = _.current.startY - e.clientY, n = Math.min(y, Math.max(ot, _.current.startHeight + t));
|
|
1131
1233
|
g(n);
|
|
1132
1234
|
}, n = () => {
|
|
1133
1235
|
_.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
1134
1236
|
};
|
|
1135
1237
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
1136
|
-
}, [h,
|
|
1238
|
+
}, [h, y]);
|
|
1137
1239
|
if (!s || s.fields.length === 0 || !c) return null;
|
|
1138
1240
|
let k = s.fields.find((e) => {
|
|
1139
1241
|
let t = c.fields.get(e);
|
|
@@ -1150,7 +1252,7 @@ function it({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1150
1252
|
ref: (t) => {
|
|
1151
1253
|
T.current[e] = t;
|
|
1152
1254
|
},
|
|
1153
|
-
children:
|
|
1255
|
+
children: w({
|
|
1154
1256
|
field: t,
|
|
1155
1257
|
fieldName: e,
|
|
1156
1258
|
value: o[e] ?? "",
|
|
@@ -1162,7 +1264,7 @@ function it({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1162
1264
|
}, e) : null;
|
|
1163
1265
|
};
|
|
1164
1266
|
return /* @__PURE__ */ Y("div", {
|
|
1165
|
-
ref:
|
|
1267
|
+
ref: v,
|
|
1166
1268
|
style: {
|
|
1167
1269
|
flexShrink: 0,
|
|
1168
1270
|
borderTop: "1px solid var(--divider)",
|
|
@@ -1221,7 +1323,7 @@ function it({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1221
1323
|
ref: (e) => {
|
|
1222
1324
|
T.current[k] = e;
|
|
1223
1325
|
},
|
|
1224
|
-
children:
|
|
1326
|
+
children: w({
|
|
1225
1327
|
field: c.fields.get(k),
|
|
1226
1328
|
fieldName: k,
|
|
1227
1329
|
value: o[k] ?? "",
|
|
@@ -1263,7 +1365,7 @@ function it({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1263
1365
|
}),
|
|
1264
1366
|
" to add"
|
|
1265
1367
|
]
|
|
1266
|
-
}), /* @__PURE__ */ J(
|
|
1368
|
+
}), /* @__PURE__ */ J(D, {
|
|
1267
1369
|
type: "submit",
|
|
1268
1370
|
kind: "primary",
|
|
1269
1371
|
icon: /* @__PURE__ */ J(e.plus, { size: 13 }),
|
|
@@ -1287,33 +1389,33 @@ function it({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1287
1389
|
}
|
|
1288
1390
|
//#endregion
|
|
1289
1391
|
//#region src/components/detail-layout/ChildrenTimeline.tsx
|
|
1290
|
-
var
|
|
1291
|
-
function
|
|
1292
|
-
if (
|
|
1392
|
+
var dt = 80, ft = 200;
|
|
1393
|
+
function pt(e, t) {
|
|
1394
|
+
if (mt(t)) {
|
|
1293
1395
|
let e = t.id;
|
|
1294
|
-
return e == null ? "" :
|
|
1396
|
+
return e == null ? "" : c(e);
|
|
1295
1397
|
}
|
|
1296
|
-
return
|
|
1398
|
+
return y(A(e, t));
|
|
1297
1399
|
}
|
|
1298
|
-
function
|
|
1400
|
+
function mt(e) {
|
|
1299
1401
|
return e.__optimistic === !0;
|
|
1300
1402
|
}
|
|
1301
|
-
function
|
|
1302
|
-
let
|
|
1403
|
+
function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1404
|
+
let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: u, isLoading: d, isError: f } = it(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), p = e.timeline, h = p?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = W(() => g ? [...a].reverse() : a, [a, g]), v = p?.auto_scroll ?? "none", y = G(null), b = G(null), x = G(!1), S = G(0), C = G(null), w = G(null), T = G(!0), E = G(null);
|
|
1303
1405
|
U(() => {
|
|
1304
1406
|
x.current = !1, S.current = 0, C.current = null, w.current = null, T.current = !0, E.current = null;
|
|
1305
|
-
}, [n]),
|
|
1306
|
-
!
|
|
1407
|
+
}, [n]), ve(() => {
|
|
1408
|
+
!u || !y.current || (E.current = {
|
|
1307
1409
|
scrollHeight: y.current.scrollHeight,
|
|
1308
1410
|
scrollTop: y.current.scrollTop
|
|
1309
1411
|
});
|
|
1310
|
-
}, [
|
|
1412
|
+
}, [u]), ve(() => {
|
|
1311
1413
|
let e = y.current;
|
|
1312
|
-
if (!e || _.length === 0 || !
|
|
1414
|
+
if (!e || _.length === 0 || !i) {
|
|
1313
1415
|
S.current = _.length;
|
|
1314
1416
|
return;
|
|
1315
1417
|
}
|
|
1316
|
-
let t =
|
|
1418
|
+
let t = pt(i, _[0]), n = pt(i, _[_.length - 1]), r = !x.current, a = _.length > S.current && S.current > 0, o = a && (g && t !== C.current && n === w.current || !g && n !== w.current && t === C.current), s = a && !o;
|
|
1317
1419
|
if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
|
|
1318
1420
|
else if (o && E.current) {
|
|
1319
1421
|
let t = E.current;
|
|
@@ -1324,30 +1426,30 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1324
1426
|
_,
|
|
1325
1427
|
v,
|
|
1326
1428
|
g,
|
|
1327
|
-
|
|
1429
|
+
i
|
|
1328
1430
|
]);
|
|
1329
|
-
let
|
|
1431
|
+
let O = H(() => {
|
|
1330
1432
|
let e = y.current;
|
|
1331
|
-
e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight <
|
|
1433
|
+
e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight < dt);
|
|
1332
1434
|
}, []);
|
|
1333
1435
|
U(() => {
|
|
1334
1436
|
let e = b.current;
|
|
1335
1437
|
if (!e || typeof IntersectionObserver > "u") return;
|
|
1336
1438
|
let t = new IntersectionObserver((e) => {
|
|
1337
|
-
for (let t of e) t.isIntersecting &&
|
|
1439
|
+
for (let t of e) t.isIntersecting && c && !u && s();
|
|
1338
1440
|
}, {
|
|
1339
1441
|
root: y.current ?? null,
|
|
1340
|
-
rootMargin: `${
|
|
1442
|
+
rootMargin: `${ft}px 0px 0px 0px`,
|
|
1341
1443
|
threshold: 0
|
|
1342
1444
|
});
|
|
1343
1445
|
return t.observe(e), () => t.disconnect();
|
|
1344
1446
|
}, [
|
|
1447
|
+
c,
|
|
1345
1448
|
u,
|
|
1346
|
-
|
|
1347
|
-
l
|
|
1449
|
+
s
|
|
1348
1450
|
]);
|
|
1349
|
-
let [
|
|
1350
|
-
if (!
|
|
1451
|
+
let [k, A] = K(null);
|
|
1452
|
+
if (!i) return /* @__PURE__ */ J("div", {
|
|
1351
1453
|
style: {
|
|
1352
1454
|
fontSize: 12.5,
|
|
1353
1455
|
color: "var(--text-3)",
|
|
@@ -1355,25 +1457,25 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1355
1457
|
},
|
|
1356
1458
|
children: "Entity not found."
|
|
1357
1459
|
});
|
|
1358
|
-
let j = e.quick_add?.fields ?? [
|
|
1460
|
+
let j = e.quick_add?.fields ?? [p?.content_field].filter(Boolean), M = m(i.display?.name_plural) || m(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ J("div", {
|
|
1359
1461
|
style: {
|
|
1360
1462
|
display: "flex",
|
|
1361
1463
|
justifyContent: "center",
|
|
1362
1464
|
padding: "6px 0"
|
|
1363
1465
|
},
|
|
1364
|
-
children: /* @__PURE__ */ J(
|
|
1466
|
+
children: /* @__PURE__ */ J(D, {
|
|
1365
1467
|
size: "xs",
|
|
1366
|
-
onClick: () =>
|
|
1367
|
-
disabled:
|
|
1368
|
-
icon:
|
|
1369
|
-
children:
|
|
1468
|
+
onClick: () => s(),
|
|
1469
|
+
disabled: u,
|
|
1470
|
+
icon: u ? /* @__PURE__ */ J(l, { size: 11 }) : void 0,
|
|
1471
|
+
children: u ? "Loading…" : "Load older"
|
|
1370
1472
|
})
|
|
1371
|
-
}) : null,
|
|
1473
|
+
}) : null, N = /* @__PURE__ */ J("div", {
|
|
1372
1474
|
ref: b,
|
|
1373
1475
|
"aria-hidden": "true",
|
|
1374
1476
|
style: { height: 1 }
|
|
1375
1477
|
}), P;
|
|
1376
|
-
if (
|
|
1478
|
+
if (f) P = /* @__PURE__ */ J("div", {
|
|
1377
1479
|
style: {
|
|
1378
1480
|
fontSize: 12.5,
|
|
1379
1481
|
color: "var(--danger)",
|
|
@@ -1381,7 +1483,7 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1381
1483
|
},
|
|
1382
1484
|
children: "Failed to load."
|
|
1383
1485
|
});
|
|
1384
|
-
else if (
|
|
1486
|
+
else if (d) P = /* @__PURE__ */ Y("div", {
|
|
1385
1487
|
style: {
|
|
1386
1488
|
display: "flex",
|
|
1387
1489
|
flexDirection: "column",
|
|
@@ -1398,7 +1500,7 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1398
1500
|
borderRadius: 8
|
|
1399
1501
|
} })]
|
|
1400
1502
|
});
|
|
1401
|
-
else if (_.length === 0) P = /* @__PURE__ */ Y(q, { children: [
|
|
1503
|
+
else if (_.length === 0) P = /* @__PURE__ */ Y(q, { children: [N, /* @__PURE__ */ J("div", {
|
|
1402
1504
|
style: {
|
|
1403
1505
|
fontSize: 12.5,
|
|
1404
1506
|
color: "var(--text-3)",
|
|
@@ -1407,33 +1509,33 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1407
1509
|
children: "No activity yet."
|
|
1408
1510
|
})] });
|
|
1409
1511
|
else {
|
|
1410
|
-
let
|
|
1411
|
-
let
|
|
1412
|
-
return /* @__PURE__ */ J(
|
|
1413
|
-
row:
|
|
1414
|
-
rowId:
|
|
1415
|
-
childEntity:
|
|
1512
|
+
let a = (a, s) => {
|
|
1513
|
+
let c = pt(i, a) || String(s);
|
|
1514
|
+
return /* @__PURE__ */ J(gt, {
|
|
1515
|
+
row: a,
|
|
1516
|
+
rowId: c,
|
|
1517
|
+
childEntity: i,
|
|
1416
1518
|
entityCode: e.entity,
|
|
1417
1519
|
parentEntity: t,
|
|
1418
1520
|
parentId: n,
|
|
1419
|
-
timeline:
|
|
1521
|
+
timeline: p,
|
|
1420
1522
|
editableFields: j,
|
|
1421
|
-
refs:
|
|
1422
|
-
isEditing:
|
|
1423
|
-
onStartEdit: () =>
|
|
1424
|
-
onCancelEdit: () =>
|
|
1425
|
-
onSaved: () =>
|
|
1523
|
+
refs: o,
|
|
1524
|
+
isEditing: k === c,
|
|
1525
|
+
onStartEdit: () => A(c),
|
|
1526
|
+
onCancelEdit: () => A(null),
|
|
1527
|
+
onSaved: () => A(null),
|
|
1426
1528
|
schema: r,
|
|
1427
|
-
optimistic:
|
|
1428
|
-
},
|
|
1429
|
-
},
|
|
1430
|
-
if (
|
|
1529
|
+
optimistic: mt(a)
|
|
1530
|
+
}, c);
|
|
1531
|
+
}, s = p?.time_field, c;
|
|
1532
|
+
if (s) {
|
|
1431
1533
|
let e = [];
|
|
1432
1534
|
_.forEach((t, n) => {
|
|
1433
|
-
let r = t[
|
|
1535
|
+
let r = t[s], i = _t(r), a = e[e.length - 1];
|
|
1434
1536
|
!a || a.key !== i ? e.push({
|
|
1435
1537
|
key: i,
|
|
1436
|
-
label:
|
|
1538
|
+
label: vt(r),
|
|
1437
1539
|
rows: [{
|
|
1438
1540
|
row: t,
|
|
1439
1541
|
idx: n
|
|
@@ -1442,22 +1544,22 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1442
1544
|
row: t,
|
|
1443
1545
|
idx: n
|
|
1444
1546
|
});
|
|
1445
|
-
}),
|
|
1547
|
+
}), c = e.map((e) => /* @__PURE__ */ Y("div", {
|
|
1446
1548
|
style: {
|
|
1447
1549
|
display: "flex",
|
|
1448
1550
|
flexDirection: "column",
|
|
1449
1551
|
gap: 8
|
|
1450
1552
|
},
|
|
1451
|
-
children: [/* @__PURE__ */ J(
|
|
1553
|
+
children: [/* @__PURE__ */ J(yt, {
|
|
1452
1554
|
label: e.label,
|
|
1453
1555
|
count: e.rows.length
|
|
1454
|
-
}), e.rows.map(({ row: e, idx: t }) =>
|
|
1556
|
+
}), e.rows.map(({ row: e, idx: t }) => a(e, t))]
|
|
1455
1557
|
}, `day-${e.key}`));
|
|
1456
|
-
} else
|
|
1558
|
+
} else c = _.map((e, t) => a(e, t));
|
|
1457
1559
|
P = /* @__PURE__ */ Y(q, { children: [
|
|
1458
|
-
ee,
|
|
1459
1560
|
N,
|
|
1460
|
-
|
|
1561
|
+
ee,
|
|
1562
|
+
c
|
|
1461
1563
|
] });
|
|
1462
1564
|
}
|
|
1463
1565
|
return h ? /* @__PURE__ */ Y("div", {
|
|
@@ -1487,7 +1589,7 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1487
1589
|
}),
|
|
1488
1590
|
/* @__PURE__ */ J("div", {
|
|
1489
1591
|
ref: y,
|
|
1490
|
-
onScroll:
|
|
1592
|
+
onScroll: O,
|
|
1491
1593
|
style: {
|
|
1492
1594
|
flex: 1,
|
|
1493
1595
|
overflowY: "auto",
|
|
@@ -1498,7 +1600,7 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1498
1600
|
},
|
|
1499
1601
|
children: P
|
|
1500
1602
|
}),
|
|
1501
|
-
/* @__PURE__ */ J(
|
|
1603
|
+
/* @__PURE__ */ J(ut, {
|
|
1502
1604
|
config: e,
|
|
1503
1605
|
parentEntity: t,
|
|
1504
1606
|
parentId: n,
|
|
@@ -1512,59 +1614,59 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1512
1614
|
gap: 8
|
|
1513
1615
|
},
|
|
1514
1616
|
children: P
|
|
1515
|
-
}), /* @__PURE__ */ J(
|
|
1617
|
+
}), /* @__PURE__ */ J(ut, {
|
|
1516
1618
|
config: e,
|
|
1517
1619
|
parentEntity: t,
|
|
1518
1620
|
parentId: n,
|
|
1519
1621
|
schema: r
|
|
1520
1622
|
})] });
|
|
1521
1623
|
}
|
|
1522
|
-
function
|
|
1523
|
-
let
|
|
1524
|
-
|
|
1525
|
-
|
|
1624
|
+
function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s, parentId: c, timeline: u, editableFields: d, refs: f, isEditing: m, onStartEdit: h, onCancelEdit: g, onSaved: v, schema: y, optimistic: b = !1 }) {
|
|
1625
|
+
let x = xe(), S = r(), [T, O] = K({}), k = H(() => {
|
|
1626
|
+
x.invalidateQueries({ queryKey: [
|
|
1627
|
+
F,
|
|
1628
|
+
s,
|
|
1526
1629
|
c,
|
|
1527
|
-
|
|
1528
|
-
s
|
|
1630
|
+
o
|
|
1529
1631
|
] });
|
|
1530
1632
|
}, [
|
|
1531
|
-
|
|
1633
|
+
x,
|
|
1634
|
+
s,
|
|
1532
1635
|
c,
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
]), j = ve({
|
|
1636
|
+
o
|
|
1637
|
+
]), A = be({
|
|
1536
1638
|
mutationFn: (e) => {
|
|
1537
1639
|
let r = t.$row_version;
|
|
1538
|
-
return
|
|
1640
|
+
return a(o, n, typeof r == "string" && r !== "" ? {
|
|
1539
1641
|
...e,
|
|
1540
1642
|
$row_version: r
|
|
1541
1643
|
} : e);
|
|
1542
1644
|
},
|
|
1543
1645
|
onSuccess: () => {
|
|
1544
|
-
|
|
1646
|
+
k(), C.success("Updated"), v();
|
|
1545
1647
|
},
|
|
1546
|
-
onError: (e) =>
|
|
1547
|
-
}), M =
|
|
1548
|
-
mutationFn: () =>
|
|
1648
|
+
onError: (e) => C.error(e.message)
|
|
1649
|
+
}), M = be({
|
|
1650
|
+
mutationFn: () => j(o, n),
|
|
1549
1651
|
onSuccess: () => {
|
|
1550
|
-
|
|
1652
|
+
k(), C.success("Deleted");
|
|
1551
1653
|
},
|
|
1552
|
-
onError: (e) =>
|
|
1654
|
+
onError: (e) => C.error(e.message)
|
|
1553
1655
|
}), ee = H(() => {
|
|
1554
1656
|
let e = {};
|
|
1555
|
-
for (let n of
|
|
1556
|
-
O(e),
|
|
1657
|
+
for (let n of d) e[n] = t[n] ?? "";
|
|
1658
|
+
O(e), h();
|
|
1557
1659
|
}, [
|
|
1558
1660
|
t,
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
]),
|
|
1661
|
+
d,
|
|
1662
|
+
h
|
|
1663
|
+
]), N = H((e, t) => {
|
|
1562
1664
|
O((n) => ({
|
|
1563
1665
|
...n,
|
|
1564
1666
|
[e]: t
|
|
1565
1667
|
}));
|
|
1566
|
-
}, []),
|
|
1567
|
-
return
|
|
1668
|
+
}, []), P = u?.time_field, I = u?.type_field, L = u?.summary_field, R = u?.content_field, z = u?.author_field, B = u?.direction_field, V = u?.intent_field;
|
|
1669
|
+
return m ? /* @__PURE__ */ Y("div", {
|
|
1568
1670
|
style: {
|
|
1569
1671
|
borderRadius: 10,
|
|
1570
1672
|
border: "1px solid var(--accent)",
|
|
@@ -1574,8 +1676,8 @@ function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1574
1676
|
flexDirection: "column",
|
|
1575
1677
|
gap: 8
|
|
1576
1678
|
},
|
|
1577
|
-
children: [
|
|
1578
|
-
let t =
|
|
1679
|
+
children: [d.map((e) => {
|
|
1680
|
+
let t = i.fields.get(e);
|
|
1579
1681
|
return t ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("label", {
|
|
1580
1682
|
style: {
|
|
1581
1683
|
fontSize: 11,
|
|
@@ -1583,15 +1685,15 @@ function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1583
1685
|
marginBottom: 4,
|
|
1584
1686
|
display: "block"
|
|
1585
1687
|
},
|
|
1586
|
-
children:
|
|
1587
|
-
}),
|
|
1688
|
+
children: p(t, e, y.entities)
|
|
1689
|
+
}), w({
|
|
1588
1690
|
field: t,
|
|
1589
1691
|
fieldName: e,
|
|
1590
|
-
value:
|
|
1692
|
+
value: T[e] ?? "",
|
|
1591
1693
|
mode: "edit",
|
|
1592
|
-
onChange: (t) =>
|
|
1593
|
-
record:
|
|
1594
|
-
locale:
|
|
1694
|
+
onChange: (t) => N(e, t),
|
|
1695
|
+
record: T,
|
|
1696
|
+
locale: S
|
|
1595
1697
|
})] }, e) : null;
|
|
1596
1698
|
}), /* @__PURE__ */ Y("div", {
|
|
1597
1699
|
style: {
|
|
@@ -1600,33 +1702,33 @@ function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1600
1702
|
gap: 6,
|
|
1601
1703
|
paddingTop: 4
|
|
1602
1704
|
},
|
|
1603
|
-
children: [/* @__PURE__ */ J(
|
|
1705
|
+
children: [/* @__PURE__ */ J(D, {
|
|
1604
1706
|
kind: "primary",
|
|
1605
1707
|
size: "xs",
|
|
1606
|
-
icon:
|
|
1607
|
-
onClick: () =>
|
|
1608
|
-
disabled:
|
|
1609
|
-
children:
|
|
1610
|
-
}), /* @__PURE__ */ J(
|
|
1708
|
+
icon: A.isPending ? /* @__PURE__ */ J(l, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
|
|
1709
|
+
onClick: () => A.mutate(T),
|
|
1710
|
+
disabled: A.isPending,
|
|
1711
|
+
children: A.isPending ? "Saving…" : "Save"
|
|
1712
|
+
}), /* @__PURE__ */ J(D, {
|
|
1611
1713
|
size: "xs",
|
|
1612
1714
|
icon: /* @__PURE__ */ J(e.x, { size: 12 }),
|
|
1613
1715
|
onClick: () => {
|
|
1614
|
-
O({}),
|
|
1716
|
+
O({}), g();
|
|
1615
1717
|
},
|
|
1616
|
-
disabled:
|
|
1718
|
+
disabled: A.isPending,
|
|
1617
1719
|
children: "Cancel"
|
|
1618
1720
|
})]
|
|
1619
1721
|
})]
|
|
1620
1722
|
}) : /* @__PURE__ */ Y("div", {
|
|
1621
1723
|
className: "group",
|
|
1622
|
-
"data-optimistic":
|
|
1724
|
+
"data-optimistic": b || void 0,
|
|
1623
1725
|
style: {
|
|
1624
1726
|
borderRadius: 10,
|
|
1625
1727
|
border: "1px solid var(--border)",
|
|
1626
1728
|
background: "var(--surface)",
|
|
1627
1729
|
padding: 12,
|
|
1628
1730
|
transition: "border-color .12s",
|
|
1629
|
-
opacity:
|
|
1731
|
+
opacity: b ? .6 : 1
|
|
1630
1732
|
},
|
|
1631
1733
|
onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
|
|
1632
1734
|
onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
|
|
@@ -1641,74 +1743,74 @@ function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1641
1743
|
color: "var(--text-3)"
|
|
1642
1744
|
},
|
|
1643
1745
|
children: [
|
|
1644
|
-
|
|
1746
|
+
P && t[P] != null && i.fields.get(P) && /* @__PURE__ */ J("span", {
|
|
1645
1747
|
style: { fontWeight: 500 },
|
|
1646
|
-
children:
|
|
1647
|
-
field:
|
|
1648
|
-
fieldName:
|
|
1649
|
-
value: t[
|
|
1748
|
+
children: w({
|
|
1749
|
+
field: i.fields.get(P),
|
|
1750
|
+
fieldName: P,
|
|
1751
|
+
value: t[P],
|
|
1650
1752
|
mode: "display",
|
|
1651
1753
|
record: t,
|
|
1652
|
-
refs:
|
|
1653
|
-
locale:
|
|
1754
|
+
refs: f,
|
|
1755
|
+
locale: S
|
|
1654
1756
|
})
|
|
1655
1757
|
}),
|
|
1656
|
-
I && t[I] != null &&
|
|
1758
|
+
I && t[I] != null && i.fields.get(I) && /* @__PURE__ */ J(_, {
|
|
1657
1759
|
tone: "slate",
|
|
1658
1760
|
size: "xs",
|
|
1659
|
-
children:
|
|
1660
|
-
field:
|
|
1761
|
+
children: w({
|
|
1762
|
+
field: i.fields.get(I),
|
|
1661
1763
|
fieldName: I,
|
|
1662
1764
|
value: t[I],
|
|
1663
1765
|
mode: "display",
|
|
1664
1766
|
record: t,
|
|
1665
|
-
refs:
|
|
1666
|
-
locale:
|
|
1767
|
+
refs: f,
|
|
1768
|
+
locale: S
|
|
1667
1769
|
})
|
|
1668
1770
|
}),
|
|
1669
|
-
B && t[B] != null &&
|
|
1771
|
+
B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ J(bt, {
|
|
1670
1772
|
value: t[B],
|
|
1671
|
-
field:
|
|
1773
|
+
field: i.fields.get(B)
|
|
1672
1774
|
}),
|
|
1673
|
-
V && t[V] != null &&
|
|
1775
|
+
V && t[V] != null && i.fields.get(V) && /* @__PURE__ */ J(_, {
|
|
1674
1776
|
tone: "slate",
|
|
1675
1777
|
size: "xs",
|
|
1676
|
-
children:
|
|
1677
|
-
field:
|
|
1778
|
+
children: w({
|
|
1779
|
+
field: i.fields.get(V),
|
|
1678
1780
|
fieldName: V,
|
|
1679
1781
|
value: t[V],
|
|
1680
1782
|
mode: "display",
|
|
1681
1783
|
record: t,
|
|
1682
|
-
refs:
|
|
1683
|
-
locale:
|
|
1784
|
+
refs: f,
|
|
1785
|
+
locale: S
|
|
1684
1786
|
})
|
|
1685
1787
|
}),
|
|
1686
|
-
z && t[z] != null &&
|
|
1788
|
+
z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ Y("span", { children: [
|
|
1687
1789
|
"by",
|
|
1688
1790
|
" ",
|
|
1689
|
-
|
|
1690
|
-
field:
|
|
1791
|
+
w({
|
|
1792
|
+
field: i.fields.get(z),
|
|
1691
1793
|
fieldName: z,
|
|
1692
1794
|
value: t[z],
|
|
1693
1795
|
mode: "display",
|
|
1694
1796
|
record: t,
|
|
1695
|
-
refs:
|
|
1696
|
-
locale:
|
|
1797
|
+
refs: f,
|
|
1798
|
+
locale: S
|
|
1697
1799
|
})
|
|
1698
1800
|
] }),
|
|
1699
|
-
!
|
|
1801
|
+
!b && /* @__PURE__ */ Y("div", {
|
|
1700
1802
|
style: {
|
|
1701
1803
|
marginLeft: "auto",
|
|
1702
1804
|
display: "flex",
|
|
1703
1805
|
alignItems: "center",
|
|
1704
1806
|
gap: 2
|
|
1705
1807
|
},
|
|
1706
|
-
children: [/* @__PURE__ */ J(
|
|
1808
|
+
children: [/* @__PURE__ */ J(E, {
|
|
1707
1809
|
size: 22,
|
|
1708
1810
|
icon: /* @__PURE__ */ J(e.edit, { size: 11 }),
|
|
1709
1811
|
onClick: ee,
|
|
1710
1812
|
title: "Edit"
|
|
1711
|
-
}), /* @__PURE__ */ J(
|
|
1813
|
+
}), /* @__PURE__ */ J(E, {
|
|
1712
1814
|
size: 22,
|
|
1713
1815
|
icon: /* @__PURE__ */ J(e.trash, { size: 11 }),
|
|
1714
1816
|
onClick: () => M.mutate(),
|
|
@@ -1717,49 +1819,49 @@ function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1717
1819
|
})
|
|
1718
1820
|
]
|
|
1719
1821
|
}),
|
|
1720
|
-
L && t[L] != null &&
|
|
1822
|
+
L && t[L] != null && i.fields.get(L) && /* @__PURE__ */ J("div", {
|
|
1721
1823
|
style: {
|
|
1722
1824
|
fontSize: 12.5,
|
|
1723
1825
|
fontWeight: 500,
|
|
1724
1826
|
marginTop: 6
|
|
1725
1827
|
},
|
|
1726
|
-
children:
|
|
1727
|
-
field:
|
|
1828
|
+
children: w({
|
|
1829
|
+
field: i.fields.get(L),
|
|
1728
1830
|
fieldName: L,
|
|
1729
1831
|
value: t[L],
|
|
1730
1832
|
mode: "display",
|
|
1731
1833
|
record: t,
|
|
1732
|
-
refs:
|
|
1733
|
-
locale:
|
|
1834
|
+
refs: f,
|
|
1835
|
+
locale: S
|
|
1734
1836
|
})
|
|
1735
1837
|
}),
|
|
1736
|
-
R && t[R] != null && R !== L &&
|
|
1838
|
+
R && t[R] != null && R !== L && i.fields.get(R) && /* @__PURE__ */ J("div", {
|
|
1737
1839
|
style: {
|
|
1738
1840
|
fontSize: 12.5,
|
|
1739
1841
|
fontWeight: 400,
|
|
1740
1842
|
marginTop: 6
|
|
1741
1843
|
},
|
|
1742
|
-
children:
|
|
1743
|
-
field:
|
|
1844
|
+
children: w({
|
|
1845
|
+
field: i.fields.get(R),
|
|
1744
1846
|
fieldName: R,
|
|
1745
1847
|
value: t[R],
|
|
1746
1848
|
mode: "display",
|
|
1747
1849
|
record: t,
|
|
1748
|
-
refs:
|
|
1749
|
-
locale:
|
|
1850
|
+
refs: f,
|
|
1851
|
+
locale: S
|
|
1750
1852
|
})
|
|
1751
1853
|
})
|
|
1752
1854
|
]
|
|
1753
1855
|
});
|
|
1754
1856
|
}
|
|
1755
|
-
function
|
|
1857
|
+
function _t(e) {
|
|
1756
1858
|
if (e == null) return "";
|
|
1757
|
-
let t = new Date(
|
|
1859
|
+
let t = new Date(c(e));
|
|
1758
1860
|
return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
|
|
1759
1861
|
}
|
|
1760
|
-
function
|
|
1862
|
+
function vt(e) {
|
|
1761
1863
|
if (e == null) return "—";
|
|
1762
|
-
let t = new Date(
|
|
1864
|
+
let t = new Date(c(e));
|
|
1763
1865
|
if (Number.isNaN(t.getTime())) return "—";
|
|
1764
1866
|
let n = /* @__PURE__ */ new Date(), r = /* @__PURE__ */ new Date();
|
|
1765
1867
|
r.setDate(n.getDate() - 1);
|
|
@@ -1770,7 +1872,7 @@ function ft(e) {
|
|
|
1770
1872
|
day: "numeric"
|
|
1771
1873
|
});
|
|
1772
1874
|
}
|
|
1773
|
-
function
|
|
1875
|
+
function yt({ label: e, count: t }) {
|
|
1774
1876
|
return /* @__PURE__ */ Y("div", {
|
|
1775
1877
|
style: {
|
|
1776
1878
|
position: "sticky",
|
|
@@ -1807,8 +1909,8 @@ function pt({ label: e, count: t }) {
|
|
|
1807
1909
|
]
|
|
1808
1910
|
});
|
|
1809
1911
|
}
|
|
1810
|
-
function
|
|
1811
|
-
let r =
|
|
1912
|
+
function bt({ value: t, field: n }) {
|
|
1913
|
+
let r = xt(t, n);
|
|
1812
1914
|
return r === null ? null : /* @__PURE__ */ Y("span", {
|
|
1813
1915
|
style: {
|
|
1814
1916
|
display: "inline-flex",
|
|
@@ -1824,7 +1926,7 @@ function mt({ value: t, field: n }) {
|
|
|
1824
1926
|
children: [J(r ? e.arrowUp : e.arrowDown, { size: 10 }), r ? "Out" : "In"]
|
|
1825
1927
|
});
|
|
1826
1928
|
}
|
|
1827
|
-
function
|
|
1929
|
+
function xt(e, t) {
|
|
1828
1930
|
if (t.type === "bool") return e === !0;
|
|
1829
1931
|
if (typeof e == "string") {
|
|
1830
1932
|
let t = e.toLowerCase();
|
|
@@ -1835,68 +1937,68 @@ function ht(e, t) {
|
|
|
1835
1937
|
}
|
|
1836
1938
|
//#endregion
|
|
1837
1939
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
1838
|
-
function
|
|
1839
|
-
let d =
|
|
1940
|
+
function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, validationErrors: s, refs: l, forceTablePresentation: u = !1 }) {
|
|
1941
|
+
let d = r(), f = b(), m = G(null), h = t.columns, g = t.position_field, _ = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), v = h.filter((e) => {
|
|
1840
1942
|
if (_.has(e) || t.position_field && e === t.position_field) return !1;
|
|
1841
1943
|
let r = n.fields.get(e);
|
|
1842
1944
|
return !(!r || r.auto || r.primary || r.source);
|
|
1843
|
-
}),
|
|
1945
|
+
}), y = new Set(h.filter((e) => {
|
|
1844
1946
|
if (t.position_field && e === t.position_field) return !0;
|
|
1845
1947
|
let r = n.fields.get(e);
|
|
1846
1948
|
return r && (r.auto || r.primary || r.source);
|
|
1847
|
-
})),
|
|
1848
|
-
|
|
1949
|
+
})), x = H((e, t, n) => {
|
|
1950
|
+
o(a.map((r) => r._key === e ? {
|
|
1849
1951
|
...r,
|
|
1850
1952
|
[t]: n,
|
|
1851
1953
|
_dirty: !0
|
|
1852
1954
|
} : r));
|
|
1853
|
-
}, [
|
|
1955
|
+
}, [a, o]), S = H(() => {
|
|
1854
1956
|
let e = {
|
|
1855
1957
|
_key: crypto.randomUUID(),
|
|
1856
1958
|
_dirty: !0
|
|
1857
1959
|
};
|
|
1858
|
-
g && (e[g] =
|
|
1960
|
+
g && (e[g] = a.filter((e) => !e._deleted).reduce((e, t) => {
|
|
1859
1961
|
let n = typeof t[g] == "number" ? t[g] : -1;
|
|
1860
1962
|
return Math.max(e, n);
|
|
1861
1963
|
}, -1) + 1);
|
|
1862
1964
|
let r = t.quick_add?.defaults ?? {};
|
|
1863
|
-
for (let t of
|
|
1965
|
+
for (let t of v) {
|
|
1864
1966
|
let i = n.fields.get(t);
|
|
1865
1967
|
i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
|
|
1866
1968
|
}
|
|
1867
|
-
|
|
1969
|
+
o([...a, e]);
|
|
1868
1970
|
}, [
|
|
1971
|
+
a,
|
|
1869
1972
|
o,
|
|
1870
|
-
|
|
1871
|
-
y,
|
|
1973
|
+
v,
|
|
1872
1974
|
n,
|
|
1873
1975
|
t.quick_add?.defaults,
|
|
1874
1976
|
g
|
|
1875
|
-
]),
|
|
1876
|
-
|
|
1977
|
+
]), C = H((e) => {
|
|
1978
|
+
o(a.map((t) => t._key === e ? {
|
|
1877
1979
|
...t,
|
|
1878
1980
|
_deleted: !0
|
|
1879
1981
|
} : t));
|
|
1880
|
-
}, [
|
|
1881
|
-
|
|
1982
|
+
}, [a, o]), T = H((e) => {
|
|
1983
|
+
o(a.map((t) => t._key === e ? {
|
|
1882
1984
|
...t,
|
|
1883
1985
|
_deleted: !1
|
|
1884
1986
|
} : t));
|
|
1885
|
-
}, [
|
|
1987
|
+
}, [a, o]), O = H((e, t) => {
|
|
1886
1988
|
if (!g) return;
|
|
1887
|
-
let n =
|
|
1888
|
-
if (i < 0 ||
|
|
1989
|
+
let n = a.filter((e) => !e._deleted), r = a.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), s = i + t;
|
|
1990
|
+
if (i < 0 || s < 0 || s >= n.length) return;
|
|
1889
1991
|
let c = [...n], [l] = c.splice(i, 1);
|
|
1890
|
-
c.splice(
|
|
1992
|
+
c.splice(s, 0, l), o([...c.map((e, t) => ({
|
|
1891
1993
|
...e,
|
|
1892
1994
|
[g]: t,
|
|
1893
1995
|
_dirty: e[g] !== t || e._dirty
|
|
1894
1996
|
})), ...r]);
|
|
1895
1997
|
}, [
|
|
1998
|
+
a,
|
|
1896
1999
|
o,
|
|
1897
|
-
s,
|
|
1898
2000
|
g
|
|
1899
|
-
]),
|
|
2001
|
+
]), k = H((e) => {
|
|
1900
2002
|
let t = e.target, n = t.closest("td");
|
|
1901
2003
|
if (!n) return;
|
|
1902
2004
|
let r = n.closest("tr");
|
|
@@ -1920,7 +2022,7 @@ function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
1920
2022
|
if (o < t.length - 1) {
|
|
1921
2023
|
let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
|
|
1922
2024
|
e && e.focus();
|
|
1923
|
-
} else
|
|
2025
|
+
} else S(), requestAnimationFrame(() => {
|
|
1924
2026
|
let e = i.querySelectorAll("tr"), t = e[e.length - 1];
|
|
1925
2027
|
if (t) {
|
|
1926
2028
|
let e = t.querySelector("input, select, textarea, [tabindex]");
|
|
@@ -1928,21 +2030,21 @@ function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
1928
2030
|
}
|
|
1929
2031
|
});
|
|
1930
2032
|
} else e.key === "Escape" && t.blur?.();
|
|
1931
|
-
}, [
|
|
2033
|
+
}, [S]), A = ue;
|
|
1932
2034
|
return f.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
|
|
1933
2035
|
style: {
|
|
1934
2036
|
display: "flex",
|
|
1935
2037
|
flexDirection: "column",
|
|
1936
2038
|
gap: 10
|
|
1937
2039
|
},
|
|
1938
|
-
children:
|
|
1939
|
-
let
|
|
2040
|
+
children: a.map((t, r) => {
|
|
2041
|
+
let o = !!t._deleted, u = s?.[t._key], f = g ? a.filter((e) => !e._deleted) : [], m = g ? f.findIndex((e) => e._key === t._key) : -1;
|
|
1940
2042
|
return /* @__PURE__ */ Y("div", {
|
|
1941
2043
|
style: {
|
|
1942
2044
|
border: "1px solid var(--border)",
|
|
1943
2045
|
borderRadius: 8,
|
|
1944
2046
|
background: "var(--surface)",
|
|
1945
|
-
opacity:
|
|
2047
|
+
opacity: o ? .58 : 1,
|
|
1946
2048
|
overflow: "hidden"
|
|
1947
2049
|
},
|
|
1948
2050
|
children: [/* @__PURE__ */ Y("div", {
|
|
@@ -1961,34 +2063,34 @@ function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
1961
2063
|
fontWeight: 600,
|
|
1962
2064
|
color: "var(--text-2)"
|
|
1963
2065
|
},
|
|
1964
|
-
children: ["Row ",
|
|
2066
|
+
children: ["Row ", r + 1]
|
|
1965
2067
|
}), /* @__PURE__ */ Y("div", {
|
|
1966
2068
|
style: {
|
|
1967
2069
|
display: "flex",
|
|
1968
2070
|
alignItems: "center",
|
|
1969
2071
|
gap: 4
|
|
1970
2072
|
},
|
|
1971
|
-
children: [g && !
|
|
2073
|
+
children: [g && !o && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(E, {
|
|
1972
2074
|
size: 32,
|
|
1973
2075
|
icon: /* @__PURE__ */ J(e.up, { size: 14 }),
|
|
1974
|
-
onClick: () =>
|
|
1975
|
-
disabled:
|
|
2076
|
+
onClick: () => O(t._key, -1),
|
|
2077
|
+
disabled: m <= 0,
|
|
1976
2078
|
title: "Move row up"
|
|
1977
|
-
}), /* @__PURE__ */ J(
|
|
2079
|
+
}), /* @__PURE__ */ J(E, {
|
|
1978
2080
|
size: 32,
|
|
1979
2081
|
icon: /* @__PURE__ */ J(e.down, { size: 14 }),
|
|
1980
|
-
onClick: () =>
|
|
1981
|
-
disabled:
|
|
2082
|
+
onClick: () => O(t._key, 1),
|
|
2083
|
+
disabled: m === -1 || m >= f.length - 1,
|
|
1982
2084
|
title: "Move row down"
|
|
1983
|
-
})] }),
|
|
2085
|
+
})] }), o ? /* @__PURE__ */ J(E, {
|
|
1984
2086
|
size: 32,
|
|
1985
2087
|
icon: /* @__PURE__ */ J(e.refresh, { size: 14 }),
|
|
1986
2088
|
onClick: () => T(t._key),
|
|
1987
2089
|
title: "Undo delete"
|
|
1988
|
-
}) : /* @__PURE__ */ J(
|
|
2090
|
+
}) : /* @__PURE__ */ J(E, {
|
|
1989
2091
|
size: 32,
|
|
1990
2092
|
icon: /* @__PURE__ */ J(e.trash, { size: 14 }),
|
|
1991
|
-
onClick: () =>
|
|
2093
|
+
onClick: () => C(t._key),
|
|
1992
2094
|
title: "Delete row"
|
|
1993
2095
|
})]
|
|
1994
2096
|
})]
|
|
@@ -2000,58 +2102,58 @@ function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2000
2102
|
gap: 12
|
|
2001
2103
|
},
|
|
2002
2104
|
children: h.map((e) => {
|
|
2003
|
-
let r = n.fields.get(e),
|
|
2004
|
-
outline:
|
|
2105
|
+
let r = n.fields.get(e), a = u?.includes(e), s = y.has(e), f = r ? p(r, e, i.entities) : e, m = `child-${t._key}-${e}`, h = `${m}-label`, g = {
|
|
2106
|
+
outline: a ? "1px solid var(--danger)" : "none",
|
|
2005
2107
|
outlineOffset: 3,
|
|
2006
|
-
borderRadius:
|
|
2007
|
-
},
|
|
2108
|
+
borderRadius: a ? 5 : 0
|
|
2109
|
+
}, _ = {
|
|
2008
2110
|
fontSize: 11.5,
|
|
2009
2111
|
fontWeight: 600,
|
|
2010
2112
|
color: "var(--text-3)"
|
|
2011
|
-
},
|
|
2113
|
+
}, v = !o && !s && !!r;
|
|
2012
2114
|
return /* @__PURE__ */ Y("div", {
|
|
2013
2115
|
style: {
|
|
2014
2116
|
display: "flex",
|
|
2015
2117
|
flexDirection: "column",
|
|
2016
2118
|
gap: 5,
|
|
2017
2119
|
minWidth: 0,
|
|
2018
|
-
textDecoration:
|
|
2120
|
+
textDecoration: o ? "line-through" : "none"
|
|
2019
2121
|
},
|
|
2020
|
-
title:
|
|
2021
|
-
children: [
|
|
2022
|
-
id:
|
|
2023
|
-
htmlFor:
|
|
2024
|
-
style:
|
|
2025
|
-
children:
|
|
2122
|
+
title: a ? `${e} is required` : void 0,
|
|
2123
|
+
children: [v ? /* @__PURE__ */ J("label", {
|
|
2124
|
+
id: h,
|
|
2125
|
+
htmlFor: m,
|
|
2126
|
+
style: _,
|
|
2127
|
+
children: f
|
|
2026
2128
|
}) : /* @__PURE__ */ J("div", {
|
|
2027
|
-
id:
|
|
2028
|
-
style:
|
|
2029
|
-
children:
|
|
2129
|
+
id: h,
|
|
2130
|
+
style: _,
|
|
2131
|
+
children: f
|
|
2030
2132
|
}), /* @__PURE__ */ J("div", {
|
|
2031
|
-
style:
|
|
2032
|
-
children:
|
|
2133
|
+
style: g,
|
|
2134
|
+
children: o || s ? r ? w({
|
|
2033
2135
|
field: r,
|
|
2034
2136
|
fieldName: e,
|
|
2035
2137
|
value: t[e],
|
|
2036
2138
|
mode: "display",
|
|
2037
2139
|
record: t,
|
|
2038
2140
|
refs: l,
|
|
2039
|
-
fieldId:
|
|
2040
|
-
labelId:
|
|
2141
|
+
fieldId: m,
|
|
2142
|
+
labelId: h,
|
|
2041
2143
|
locale: d
|
|
2042
|
-
}) :
|
|
2144
|
+
}) : c(t[e]) : r ? w({
|
|
2043
2145
|
field: r,
|
|
2044
2146
|
fieldName: e,
|
|
2045
2147
|
value: t[e],
|
|
2046
2148
|
mode: "edit",
|
|
2047
|
-
onChange: (n) =>
|
|
2149
|
+
onChange: (n) => x(t._key, e, n),
|
|
2048
2150
|
record: t,
|
|
2049
2151
|
refs: l,
|
|
2050
2152
|
compact: !0,
|
|
2051
|
-
fieldId:
|
|
2052
|
-
labelId:
|
|
2153
|
+
fieldId: m,
|
|
2154
|
+
labelId: h,
|
|
2053
2155
|
locale: d
|
|
2054
|
-
}) :
|
|
2156
|
+
}) : c(t[e])
|
|
2055
2157
|
})]
|
|
2056
2158
|
}, e);
|
|
2057
2159
|
})
|
|
@@ -2060,51 +2162,51 @@ function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2060
2162
|
})
|
|
2061
2163
|
}), /* @__PURE__ */ J("div", {
|
|
2062
2164
|
style: { marginTop: 10 },
|
|
2063
|
-
children: /* @__PURE__ */ J(
|
|
2165
|
+
children: /* @__PURE__ */ J(D, {
|
|
2064
2166
|
kind: "ghost",
|
|
2065
2167
|
size: "sm",
|
|
2066
2168
|
icon: /* @__PURE__ */ J(e.plus, { size: 14 }),
|
|
2067
|
-
onClick:
|
|
2169
|
+
onClick: S,
|
|
2068
2170
|
children: "Add row"
|
|
2069
2171
|
})
|
|
2070
2172
|
})] }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
|
|
2071
2173
|
style: { overflowX: "auto" },
|
|
2072
2174
|
children: /* @__PURE__ */ Y("table", {
|
|
2073
|
-
ref:
|
|
2074
|
-
style:
|
|
2075
|
-
onKeyDown:
|
|
2175
|
+
ref: m,
|
|
2176
|
+
style: de,
|
|
2177
|
+
onKeyDown: k,
|
|
2076
2178
|
children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [h.map((e) => {
|
|
2077
2179
|
let t = n.fields.get(e);
|
|
2078
2180
|
return /* @__PURE__ */ J("th", {
|
|
2079
|
-
style:
|
|
2080
|
-
children: t ?
|
|
2181
|
+
style: A,
|
|
2182
|
+
children: t ? p(t, e, i.entities) : e
|
|
2081
2183
|
}, e);
|
|
2082
2184
|
}), /* @__PURE__ */ J("th", { style: {
|
|
2083
|
-
...
|
|
2185
|
+
...A,
|
|
2084
2186
|
width: 40
|
|
2085
|
-
} })] }) }), /* @__PURE__ */ J("tbody", { children:
|
|
2086
|
-
let
|
|
2187
|
+
} })] }) }), /* @__PURE__ */ J("tbody", { children: a.map((t) => {
|
|
2188
|
+
let r = !!t._deleted, i = s?.[t._key];
|
|
2087
2189
|
return /* @__PURE__ */ Y("tr", {
|
|
2088
|
-
style: { opacity:
|
|
2190
|
+
style: { opacity: r ? .5 : 1 },
|
|
2089
2191
|
children: [h.map((e) => {
|
|
2090
|
-
let
|
|
2091
|
-
return
|
|
2192
|
+
let a = n.fields.get(e), o = i?.includes(e), s = y.has(e);
|
|
2193
|
+
return r || s ? /* @__PURE__ */ J("td", {
|
|
2092
2194
|
style: {
|
|
2093
2195
|
padding: "6px 12px",
|
|
2094
2196
|
borderBottom: "1px solid var(--divider)",
|
|
2095
2197
|
verticalAlign: "middle",
|
|
2096
|
-
textDecoration:
|
|
2198
|
+
textDecoration: r ? "line-through" : "none",
|
|
2097
2199
|
color: "var(--text-2)"
|
|
2098
2200
|
},
|
|
2099
|
-
children:
|
|
2100
|
-
field:
|
|
2201
|
+
children: a ? w({
|
|
2202
|
+
field: a,
|
|
2101
2203
|
fieldName: e,
|
|
2102
2204
|
value: t[e],
|
|
2103
2205
|
mode: "display",
|
|
2104
2206
|
record: t,
|
|
2105
2207
|
refs: l,
|
|
2106
2208
|
locale: d
|
|
2107
|
-
}) :
|
|
2209
|
+
}) : c(t[e])
|
|
2108
2210
|
}, e) : /* @__PURE__ */ J("td", {
|
|
2109
2211
|
style: {
|
|
2110
2212
|
padding: "4px 4px",
|
|
@@ -2115,17 +2217,17 @@ function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2115
2217
|
borderRadius: o ? 4 : 0
|
|
2116
2218
|
},
|
|
2117
2219
|
title: o ? `${e} is required` : void 0,
|
|
2118
|
-
children:
|
|
2119
|
-
field:
|
|
2220
|
+
children: a ? w({
|
|
2221
|
+
field: a,
|
|
2120
2222
|
fieldName: e,
|
|
2121
2223
|
value: t[e],
|
|
2122
2224
|
mode: "edit",
|
|
2123
|
-
onChange: (n) =>
|
|
2225
|
+
onChange: (n) => x(t._key, e, n),
|
|
2124
2226
|
record: t,
|
|
2125
2227
|
refs: l,
|
|
2126
2228
|
compact: !0,
|
|
2127
2229
|
locale: d
|
|
2128
|
-
}) :
|
|
2230
|
+
}) : c(t[e])
|
|
2129
2231
|
}, e);
|
|
2130
2232
|
}), /* @__PURE__ */ J("td", {
|
|
2131
2233
|
style: {
|
|
@@ -2133,15 +2235,15 @@ function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2133
2235
|
borderBottom: "1px solid var(--divider)",
|
|
2134
2236
|
verticalAlign: "middle"
|
|
2135
2237
|
},
|
|
2136
|
-
children:
|
|
2238
|
+
children: r ? /* @__PURE__ */ J(E, {
|
|
2137
2239
|
size: 24,
|
|
2138
2240
|
icon: /* @__PURE__ */ J(e.refresh, { size: 12 }),
|
|
2139
2241
|
onClick: () => T(t._key),
|
|
2140
2242
|
title: "Undo delete"
|
|
2141
|
-
}) : /* @__PURE__ */ J(
|
|
2243
|
+
}) : /* @__PURE__ */ J(E, {
|
|
2142
2244
|
size: 24,
|
|
2143
2245
|
icon: /* @__PURE__ */ J(e.trash, { size: 12 }),
|
|
2144
|
-
onClick: () =>
|
|
2246
|
+
onClick: () => C(t._key),
|
|
2145
2247
|
title: "Delete row"
|
|
2146
2248
|
})
|
|
2147
2249
|
})]
|
|
@@ -2150,24 +2252,24 @@ function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2150
2252
|
})
|
|
2151
2253
|
}), /* @__PURE__ */ J("div", {
|
|
2152
2254
|
style: { marginTop: 8 },
|
|
2153
|
-
children: /* @__PURE__ */ J(
|
|
2255
|
+
children: /* @__PURE__ */ J(D, {
|
|
2154
2256
|
kind: "ghost",
|
|
2155
2257
|
size: "xs",
|
|
2156
2258
|
icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
|
|
2157
|
-
onClick:
|
|
2259
|
+
onClick: S,
|
|
2158
2260
|
children: "Add row"
|
|
2159
2261
|
})
|
|
2160
2262
|
})] });
|
|
2161
2263
|
}
|
|
2162
2264
|
//#endregion
|
|
2163
2265
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
2164
|
-
var
|
|
2165
|
-
function
|
|
2166
|
-
let r =
|
|
2266
|
+
var Ct = he(() => import("./DraggableChildrenTable-Ctmn0liO.js").then((e) => ({ default: e.DraggableChildrenTable })));
|
|
2267
|
+
function wt({ node: e, ctx: n }) {
|
|
2268
|
+
let r = b(), i = e.children;
|
|
2167
2269
|
if (!i) return null;
|
|
2168
2270
|
let a = r.isPhone && n.relatedRecordsPresentation === "table";
|
|
2169
2271
|
if (n.isNew && n.mode !== "edit") return null;
|
|
2170
|
-
let o =
|
|
2272
|
+
let o = Ge(n.entity, i);
|
|
2171
2273
|
if (!o) return /* @__PURE__ */ Y("div", {
|
|
2172
2274
|
className: "text-sm text-muted-foreground py-2",
|
|
2173
2275
|
children: ["Unknown child relation: ", i]
|
|
@@ -2177,7 +2279,7 @@ function vt({ node: e, ctx: n }) {
|
|
|
2177
2279
|
className: "text-sm text-muted-foreground py-2",
|
|
2178
2280
|
children: ["Entity not found: ", o.entity]
|
|
2179
2281
|
});
|
|
2180
|
-
let c =
|
|
2282
|
+
let c = Ne(o, s, e), l = ke(e, n), u = Ae(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(ne, {
|
|
2181
2283
|
title: l,
|
|
2182
2284
|
icon: u ? /* @__PURE__ */ J(t, {
|
|
2183
2285
|
name: u,
|
|
@@ -2185,10 +2287,10 @@ function vt({ node: e, ctx: n }) {
|
|
|
2185
2287
|
}) : void 0,
|
|
2186
2288
|
children: e
|
|
2187
2289
|
});
|
|
2188
|
-
if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" &&
|
|
2189
|
-
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ?
|
|
2190
|
-
return d(/* @__PURE__ */ J(
|
|
2191
|
-
fallback: /* @__PURE__ */ J(
|
|
2290
|
+
if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && v(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
|
|
2291
|
+
let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ? St : Ct : St;
|
|
2292
|
+
return d(/* @__PURE__ */ J(pe, {
|
|
2293
|
+
fallback: /* @__PURE__ */ J(R, {}),
|
|
2192
2294
|
children: /* @__PURE__ */ J(o, {
|
|
2193
2295
|
config: c,
|
|
2194
2296
|
childEntity: s,
|
|
@@ -2202,40 +2304,40 @@ function vt({ node: e, ctx: n }) {
|
|
|
2202
2304
|
}));
|
|
2203
2305
|
}
|
|
2204
2306
|
if (n.isNew) return null;
|
|
2205
|
-
let
|
|
2307
|
+
let f = {
|
|
2206
2308
|
config: c,
|
|
2207
2309
|
parentEntity: n.entityCode,
|
|
2208
2310
|
parentId: n.recordId,
|
|
2209
2311
|
schema: n.schema
|
|
2210
2312
|
};
|
|
2211
2313
|
switch (c.mode) {
|
|
2212
|
-
case "list": return d(/* @__PURE__ */ J(
|
|
2213
|
-
case "cards": return d(/* @__PURE__ */ J(
|
|
2214
|
-
case "timeline": return d(/* @__PURE__ */ J(
|
|
2215
|
-
default: return r.isPhone && !a ? d(/* @__PURE__ */ J(
|
|
2314
|
+
case "list": return d(/* @__PURE__ */ J(tt, { ...f }));
|
|
2315
|
+
case "cards": return d(/* @__PURE__ */ J(nt, { ...f }));
|
|
2316
|
+
case "timeline": return d(/* @__PURE__ */ J(ht, { ...f }));
|
|
2317
|
+
default: return r.isPhone && !a ? d(/* @__PURE__ */ J(nt, { ...f })) : d(/* @__PURE__ */ J(et, { ...f }));
|
|
2216
2318
|
}
|
|
2217
2319
|
}
|
|
2218
2320
|
//#endregion
|
|
2219
2321
|
//#region src/components/detail-layout/FieldRow.tsx
|
|
2220
|
-
var
|
|
2322
|
+
var Tt = 150, Et = 560, Dt = "20px", Ot = 4, kt = /* @__PURE__ */ new Set([
|
|
2221
2323
|
"text",
|
|
2222
2324
|
"rich_text",
|
|
2223
2325
|
"json",
|
|
2224
2326
|
"structure",
|
|
2225
2327
|
"multilang_text"
|
|
2226
|
-
]),
|
|
2227
|
-
function
|
|
2328
|
+
]), At = me({ columns: 2 });
|
|
2329
|
+
function jt({ columns: e = 2, children: t }) {
|
|
2228
2330
|
let n = G(null), [r, i] = K(!1);
|
|
2229
2331
|
U(() => {
|
|
2230
2332
|
let t = n.current;
|
|
2231
2333
|
if (!t || e === 1 || typeof ResizeObserver > "u") return;
|
|
2232
2334
|
let r = new ResizeObserver(([e]) => {
|
|
2233
|
-
i(e.contentRect.width <
|
|
2335
|
+
i(e.contentRect.width < Et);
|
|
2234
2336
|
});
|
|
2235
2337
|
return r.observe(t), () => r.disconnect();
|
|
2236
2338
|
}, [e]);
|
|
2237
2339
|
let a = e === 1 || r ? 1 : e;
|
|
2238
|
-
return /* @__PURE__ */ J(
|
|
2340
|
+
return /* @__PURE__ */ J(At.Provider, {
|
|
2239
2341
|
value: { columns: a },
|
|
2240
2342
|
children: /* @__PURE__ */ J("div", {
|
|
2241
2343
|
ref: n,
|
|
@@ -2249,8 +2351,8 @@ function Tt({ columns: e = 2, children: t }) {
|
|
|
2249
2351
|
})
|
|
2250
2352
|
});
|
|
2251
2353
|
}
|
|
2252
|
-
function
|
|
2253
|
-
let h =
|
|
2354
|
+
function Mt({ label: t, children: r, span: i = !1, required: a, error: o, hint: s, actions: c, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
|
|
2355
|
+
let h = ge(At), g = i || h.columns === 1, _ = !!o;
|
|
2254
2356
|
return /* @__PURE__ */ Y("div", {
|
|
2255
2357
|
className: "detail-row",
|
|
2256
2358
|
"data-error": _ || void 0,
|
|
@@ -2261,15 +2363,15 @@ function Et({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2261
2363
|
gap: g ? 4 : 16,
|
|
2262
2364
|
alignItems: g ? "stretch" : "flex-start",
|
|
2263
2365
|
padding: "6px 0",
|
|
2264
|
-
...
|
|
2366
|
+
...i ? { gridColumn: "1 / -1" } : null
|
|
2265
2367
|
},
|
|
2266
2368
|
children: [/* @__PURE__ */ Y("div", {
|
|
2267
2369
|
style: {
|
|
2268
|
-
width: g ? "auto" :
|
|
2370
|
+
width: g ? "auto" : Tt,
|
|
2269
2371
|
flexShrink: 0,
|
|
2270
|
-
paddingTop: g ? 0 :
|
|
2372
|
+
paddingTop: g ? 0 : Ot,
|
|
2271
2373
|
fontSize: 12,
|
|
2272
|
-
lineHeight:
|
|
2374
|
+
lineHeight: Dt,
|
|
2273
2375
|
fontWeight: 500,
|
|
2274
2376
|
color: "var(--text-3)",
|
|
2275
2377
|
display: "flex",
|
|
@@ -2285,7 +2387,7 @@ function Et({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2285
2387
|
id: f,
|
|
2286
2388
|
title: p || void 0,
|
|
2287
2389
|
children: t
|
|
2288
|
-
}),
|
|
2390
|
+
}), a && u === "edit" && /* @__PURE__ */ J("span", {
|
|
2289
2391
|
"aria-hidden": "true",
|
|
2290
2392
|
style: {
|
|
2291
2393
|
color: "var(--danger)",
|
|
@@ -2313,19 +2415,19 @@ function Et({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2313
2415
|
flex: 1,
|
|
2314
2416
|
minWidth: 0,
|
|
2315
2417
|
fontSize: 13,
|
|
2316
|
-
lineHeight:
|
|
2418
|
+
lineHeight: Dt,
|
|
2317
2419
|
color: "var(--text)",
|
|
2318
2420
|
overflowWrap: "anywhere",
|
|
2319
|
-
paddingTop: u === "display" && !g ?
|
|
2421
|
+
paddingTop: u === "display" && !g ? Ot : 0
|
|
2320
2422
|
},
|
|
2321
2423
|
children: _ && u === "edit" ? /* @__PURE__ */ J("div", {
|
|
2322
2424
|
style: {
|
|
2323
2425
|
borderRadius: 6,
|
|
2324
2426
|
boxShadow: "0 0 0 1.5px var(--danger)"
|
|
2325
2427
|
},
|
|
2326
|
-
children:
|
|
2327
|
-
}) :
|
|
2328
|
-
}), (l ||
|
|
2428
|
+
children: r
|
|
2429
|
+
}) : r
|
|
2430
|
+
}), (l || c) && /* @__PURE__ */ Y("div", {
|
|
2329
2431
|
className: "detail-row-action",
|
|
2330
2432
|
style: {
|
|
2331
2433
|
display: "flex",
|
|
@@ -2333,13 +2435,13 @@ function Et({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2333
2435
|
flexShrink: 0,
|
|
2334
2436
|
marginTop: -2
|
|
2335
2437
|
},
|
|
2336
|
-
children: [l && /* @__PURE__ */ J(
|
|
2438
|
+
children: [l && /* @__PURE__ */ J(n, {
|
|
2337
2439
|
value: l,
|
|
2338
2440
|
size: "sm",
|
|
2339
2441
|
title: "Copy value"
|
|
2340
|
-
}),
|
|
2442
|
+
}), c]
|
|
2341
2443
|
})]
|
|
2342
|
-
}), (_ ||
|
|
2444
|
+
}), (_ || s != null) && /* @__PURE__ */ Y("div", {
|
|
2343
2445
|
style: {
|
|
2344
2446
|
fontSize: 11.5,
|
|
2345
2447
|
lineHeight: 1.4,
|
|
@@ -2348,78 +2450,78 @@ function Et({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2348
2450
|
alignItems: "center",
|
|
2349
2451
|
gap: 4
|
|
2350
2452
|
},
|
|
2351
|
-
children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ?
|
|
2453
|
+
children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ? o : s })]
|
|
2352
2454
|
})]
|
|
2353
2455
|
})]
|
|
2354
2456
|
});
|
|
2355
2457
|
}
|
|
2356
2458
|
//#endregion
|
|
2357
2459
|
//#region src/components/detail-layout/FieldsBlock.tsx
|
|
2358
|
-
function
|
|
2359
|
-
let { entity: n, entityCode:
|
|
2360
|
-
return /* @__PURE__ */ J(
|
|
2361
|
-
columns:
|
|
2460
|
+
function Nt({ fields: e, ctx: t }) {
|
|
2461
|
+
let { entity: n, entityCode: i, record: a, mode: o, onFieldChange: s, schema: l } = t, u = r(), d = t.columns ?? 2, f = d === 1 && e.length === 1;
|
|
2462
|
+
return /* @__PURE__ */ J(jt, {
|
|
2463
|
+
columns: d,
|
|
2362
2464
|
children: e.map((e) => {
|
|
2363
|
-
let
|
|
2364
|
-
tier:
|
|
2365
|
-
tierDef:
|
|
2366
|
-
requiredPermission:
|
|
2367
|
-
locale:
|
|
2368
|
-
variant:
|
|
2369
|
-
}) :
|
|
2465
|
+
let r = e.name, d = `${i ?? "field"}-${r}`, p = `${d}-label`, h = n.fields.get(r), g = !!(h?.auto || h?.readonly || h?.source), _ = V(n, r), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = g || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ J(ie, {
|
|
2466
|
+
tier: _.classification,
|
|
2467
|
+
tierDef: ce(l, n, r),
|
|
2468
|
+
requiredPermission: _?.required_permission,
|
|
2469
|
+
locale: u,
|
|
2470
|
+
variant: x === "edit" ? "input" : "value"
|
|
2471
|
+
}) : ae({
|
|
2370
2472
|
entity: n,
|
|
2371
|
-
entityCode:
|
|
2372
|
-
fieldName:
|
|
2373
|
-
record:
|
|
2374
|
-
mode:
|
|
2375
|
-
onChange:
|
|
2473
|
+
entityCode: i,
|
|
2474
|
+
fieldName: r,
|
|
2475
|
+
record: a,
|
|
2476
|
+
mode: x,
|
|
2477
|
+
onChange: s && !g ? (e) => s(r, e) : void 0,
|
|
2376
2478
|
refs: t.refs,
|
|
2377
|
-
entities:
|
|
2378
|
-
screens:
|
|
2379
|
-
locale:
|
|
2479
|
+
entities: l?.entities,
|
|
2480
|
+
screens: l?.screens,
|
|
2481
|
+
locale: u,
|
|
2380
2482
|
fieldId: d,
|
|
2381
|
-
labelId:
|
|
2483
|
+
labelId: p
|
|
2382
2484
|
});
|
|
2383
|
-
if (!
|
|
2384
|
-
let
|
|
2385
|
-
actionCode: `${
|
|
2485
|
+
if (!S) return null;
|
|
2486
|
+
let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(I, {
|
|
2487
|
+
actionCode: `${r}.action[${t}]`,
|
|
2386
2488
|
action: e,
|
|
2387
|
-
entityCode:
|
|
2388
|
-
row:
|
|
2489
|
+
entityCode: i,
|
|
2490
|
+
row: a,
|
|
2389
2491
|
variant: "ghost",
|
|
2390
2492
|
size: "icon"
|
|
2391
|
-
}, t)) }) : void 0,
|
|
2392
|
-
return
|
|
2493
|
+
}, t)) }) : void 0, w = !!h && kt.has(h.type), T = a?.[r], E = x === "display" && (h?.copyable || h?.type === "uuid") && T != null && T !== "" ? c(T) : void 0, D = m(h?.display?.description);
|
|
2494
|
+
return f ? /* @__PURE__ */ Y("div", {
|
|
2393
2495
|
style: { gridColumn: "1 / -1" },
|
|
2394
|
-
children: [
|
|
2496
|
+
children: [S, x === "edit" && D && /* @__PURE__ */ J("div", {
|
|
2395
2497
|
style: {
|
|
2396
2498
|
fontSize: 11.5,
|
|
2397
2499
|
lineHeight: 1.4,
|
|
2398
2500
|
color: "var(--text-3)",
|
|
2399
2501
|
marginTop: 3
|
|
2400
2502
|
},
|
|
2401
|
-
children:
|
|
2503
|
+
children: D
|
|
2402
2504
|
})]
|
|
2403
|
-
},
|
|
2404
|
-
label:
|
|
2405
|
-
htmlFor:
|
|
2406
|
-
labelId:
|
|
2407
|
-
labelTitle:
|
|
2408
|
-
required:
|
|
2409
|
-
mode:
|
|
2410
|
-
span:
|
|
2411
|
-
error: t.fieldErrors?.[
|
|
2412
|
-
hint:
|
|
2413
|
-
actions:
|
|
2414
|
-
copyValue:
|
|
2415
|
-
children:
|
|
2416
|
-
},
|
|
2505
|
+
}, r) : /* @__PURE__ */ J(Mt, {
|
|
2506
|
+
label: P(n, r, l.entities),
|
|
2507
|
+
htmlFor: x === "edit" ? d : void 0,
|
|
2508
|
+
labelId: p,
|
|
2509
|
+
labelTitle: D || void 0,
|
|
2510
|
+
required: h?.required ?? !1,
|
|
2511
|
+
mode: x,
|
|
2512
|
+
span: w,
|
|
2513
|
+
error: t.fieldErrors?.[r],
|
|
2514
|
+
hint: x === "edit" && D ? D : void 0,
|
|
2515
|
+
actions: C,
|
|
2516
|
+
copyValue: E,
|
|
2517
|
+
children: S
|
|
2518
|
+
}, r);
|
|
2417
2519
|
})
|
|
2418
2520
|
});
|
|
2419
2521
|
}
|
|
2420
2522
|
//#endregion
|
|
2421
2523
|
//#region src/components/detail-layout/PropertiesBlock.tsx
|
|
2422
|
-
var
|
|
2524
|
+
var Pt = /* @__PURE__ */ new Set([
|
|
2423
2525
|
"string",
|
|
2424
2526
|
"text",
|
|
2425
2527
|
"int",
|
|
@@ -2427,65 +2529,65 @@ var Ot = /* @__PURE__ */ new Set([
|
|
|
2427
2529
|
"decimal",
|
|
2428
2530
|
"email",
|
|
2429
2531
|
"url"
|
|
2430
|
-
]),
|
|
2431
|
-
function
|
|
2432
|
-
let { entity: n, objectProperties: r, onSetProperty:
|
|
2433
|
-
if (
|
|
2434
|
-
let
|
|
2435
|
-
return
|
|
2532
|
+
]), Ft = 500;
|
|
2533
|
+
function It({ node: e, ctx: t }) {
|
|
2534
|
+
let { entity: n, objectProperties: r, onSetProperty: a, isNew: o, mode: s, refs: c } = t, l = n.properties ?? {};
|
|
2535
|
+
if (o) return null;
|
|
2536
|
+
let u = e.properties === !0 || e.properties, d = u === !0 ? Object.entries(l).sort(([e], [t]) => e.localeCompare(t)) : u.filter((e) => l[e] != null).map((e) => [e, l[e]]);
|
|
2537
|
+
return d.length === 0 ? null : /* @__PURE__ */ J(jt, {
|
|
2436
2538
|
columns: 2,
|
|
2437
|
-
children:
|
|
2438
|
-
let
|
|
2439
|
-
return /* @__PURE__ */ J(
|
|
2539
|
+
children: d.map(([e, o]) => {
|
|
2540
|
+
let l = r?.find((t) => t.property_code === e), u = i(o), d = o.readonly || !a ? "display" : s;
|
|
2541
|
+
return /* @__PURE__ */ J(Lt, {
|
|
2440
2542
|
propCode: e,
|
|
2441
|
-
prop:
|
|
2442
|
-
field:
|
|
2443
|
-
value:
|
|
2444
|
-
mode:
|
|
2445
|
-
onSetProperty:
|
|
2446
|
-
refs:
|
|
2543
|
+
prop: o,
|
|
2544
|
+
field: u,
|
|
2545
|
+
value: l?.value,
|
|
2546
|
+
mode: d,
|
|
2547
|
+
onSetProperty: a,
|
|
2548
|
+
refs: c,
|
|
2447
2549
|
entity: n,
|
|
2448
2550
|
schema: t.schema
|
|
2449
2551
|
}, e);
|
|
2450
2552
|
})
|
|
2451
2553
|
});
|
|
2452
2554
|
}
|
|
2453
|
-
function
|
|
2454
|
-
let
|
|
2555
|
+
function Lt({ propCode: e, prop: t, field: n, value: i, mode: a, onSetProperty: o, refs: s, entity: c, schema: l }) {
|
|
2556
|
+
let u = r(), d = G(null);
|
|
2455
2557
|
U(() => () => {
|
|
2456
|
-
|
|
2558
|
+
d.current && clearTimeout(d.current);
|
|
2457
2559
|
}, []);
|
|
2458
|
-
let
|
|
2459
|
-
|
|
2560
|
+
let f = H((n) => {
|
|
2561
|
+
o && (Pt.has(t.type) ? (d.current && clearTimeout(d.current), d.current = setTimeout(() => o(e, n), Ft)) : o(e, n));
|
|
2460
2562
|
}, [
|
|
2461
2563
|
e,
|
|
2462
2564
|
t.type,
|
|
2463
|
-
|
|
2464
|
-
]),
|
|
2465
|
-
return /* @__PURE__ */ J(
|
|
2466
|
-
label:
|
|
2467
|
-
mode:
|
|
2468
|
-
span:
|
|
2469
|
-
children:
|
|
2470
|
-
tier:
|
|
2471
|
-
tierDef:
|
|
2472
|
-
requiredPermission:
|
|
2473
|
-
locale:
|
|
2474
|
-
variant:
|
|
2475
|
-
}) :
|
|
2565
|
+
o
|
|
2566
|
+
]), p = V(c, e), h = p?.read === "denied", g = p?.write === "denied", _ = a === "display" ? h : g || h, v = a === "edit" && g ? "display" : a;
|
|
2567
|
+
return /* @__PURE__ */ J(Mt, {
|
|
2568
|
+
label: m(t.display?.name ?? t.name),
|
|
2569
|
+
mode: v,
|
|
2570
|
+
span: kt.has(t.type),
|
|
2571
|
+
children: _ ? /* @__PURE__ */ J(ie, {
|
|
2572
|
+
tier: p.classification,
|
|
2573
|
+
tierDef: ce(l, c, e),
|
|
2574
|
+
requiredPermission: p?.required_permission,
|
|
2575
|
+
locale: u,
|
|
2576
|
+
variant: v === "edit" ? "input" : "value"
|
|
2577
|
+
}) : w({
|
|
2476
2578
|
field: n,
|
|
2477
2579
|
fieldName: e,
|
|
2478
|
-
value:
|
|
2479
|
-
mode:
|
|
2480
|
-
onChange:
|
|
2481
|
-
refs:
|
|
2482
|
-
locale:
|
|
2580
|
+
value: i,
|
|
2581
|
+
mode: v,
|
|
2582
|
+
onChange: v === "edit" ? f : void 0,
|
|
2583
|
+
refs: s,
|
|
2584
|
+
locale: u
|
|
2483
2585
|
})
|
|
2484
2586
|
});
|
|
2485
2587
|
}
|
|
2486
2588
|
//#endregion
|
|
2487
2589
|
//#region src/components/shared/StatusStepper.tsx
|
|
2488
|
-
function
|
|
2590
|
+
function Rt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1 }) {
|
|
2489
2591
|
let o = t.findIndex((e) => e.code === n);
|
|
2490
2592
|
return /* @__PURE__ */ J("div", {
|
|
2491
2593
|
role: "list",
|
|
@@ -2552,7 +2654,7 @@ function Mt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
|
|
|
2552
2654
|
}
|
|
2553
2655
|
//#endregion
|
|
2554
2656
|
//#region src/components/shared/StatusGroupsDisplay.tsx
|
|
2555
|
-
function
|
|
2657
|
+
function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r, mode: i = "edit" }) {
|
|
2556
2658
|
return /* @__PURE__ */ J("div", {
|
|
2557
2659
|
style: {
|
|
2558
2660
|
display: "flex",
|
|
@@ -2561,7 +2663,7 @@ function Nt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2561
2663
|
gap: 16
|
|
2562
2664
|
},
|
|
2563
2665
|
children: Object.entries(e).map(([e, a]) => {
|
|
2564
|
-
let o = t?.find((t) => t.group_code === e)?.status_code,
|
|
2666
|
+
let o = t?.find((t) => t.group_code === e)?.status_code, s = o ? a.statuses.find((e) => e.code === o) : void 0;
|
|
2565
2667
|
if (a.display_mode === "stepper") {
|
|
2566
2668
|
let t = i === "edit", s = t ? a.transitions && o ? /* @__PURE__ */ new Set([o, ...a.transitions[o] ?? []]) : new Set(a.statuses.map((e) => e.code)) : void 0;
|
|
2567
2669
|
return /* @__PURE__ */ Y("div", {
|
|
@@ -2577,17 +2679,17 @@ function Nt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2577
2679
|
color: "var(--text-3)",
|
|
2578
2680
|
flexShrink: 0
|
|
2579
2681
|
},
|
|
2580
|
-
children: [
|
|
2682
|
+
children: [m(a.name), ":"]
|
|
2581
2683
|
}), /* @__PURE__ */ J("div", {
|
|
2582
2684
|
style: {
|
|
2583
2685
|
minWidth: 240,
|
|
2584
2686
|
opacity: r ? .6 : 1,
|
|
2585
2687
|
pointerEvents: r ? "none" : "auto"
|
|
2586
2688
|
},
|
|
2587
|
-
children: /* @__PURE__ */ J(
|
|
2689
|
+
children: /* @__PURE__ */ J(Rt, {
|
|
2588
2690
|
stages: a.statuses.map((e) => ({
|
|
2589
2691
|
code: e.code,
|
|
2590
|
-
label:
|
|
2692
|
+
label: m(e.name)
|
|
2591
2693
|
})),
|
|
2592
2694
|
current: o,
|
|
2593
2695
|
selectable: s,
|
|
@@ -2608,11 +2710,11 @@ function Nt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2608
2710
|
fontSize: 12,
|
|
2609
2711
|
color: "var(--text-3)"
|
|
2610
2712
|
},
|
|
2611
|
-
children: [
|
|
2612
|
-
}),
|
|
2613
|
-
tone:
|
|
2713
|
+
children: [m(a.name), ":"]
|
|
2714
|
+
}), s ? /* @__PURE__ */ J(_, {
|
|
2715
|
+
tone: s.color ?? "slate",
|
|
2614
2716
|
size: "xs",
|
|
2615
|
-
children:
|
|
2717
|
+
children: m(s.name)
|
|
2616
2718
|
}) : /* @__PURE__ */ J("span", {
|
|
2617
2719
|
style: {
|
|
2618
2720
|
fontSize: 12.5,
|
|
@@ -2621,7 +2723,7 @@ function Nt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2621
2723
|
children: "—"
|
|
2622
2724
|
})]
|
|
2623
2725
|
}, e);
|
|
2624
|
-
let
|
|
2726
|
+
let c = (a.transitions && o ? a.statuses.filter((e) => e.code === o || (a.transitions[o]?.includes(e.code) ?? !1)) : a.statuses).map((e) => ({
|
|
2625
2727
|
value: e.code,
|
|
2626
2728
|
label: /* @__PURE__ */ Y("span", {
|
|
2627
2729
|
style: {
|
|
@@ -2635,7 +2737,7 @@ function Nt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2635
2737
|
borderRadius: 999,
|
|
2636
2738
|
background: `var(--pill-${e.color}, ${e.color})`,
|
|
2637
2739
|
display: "inline-block"
|
|
2638
|
-
} }),
|
|
2740
|
+
} }), m(e.name)]
|
|
2639
2741
|
})
|
|
2640
2742
|
}));
|
|
2641
2743
|
return /* @__PURE__ */ Y("div", {
|
|
@@ -2649,16 +2751,16 @@ function Nt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2649
2751
|
fontSize: 12,
|
|
2650
2752
|
color: "var(--text-3)"
|
|
2651
2753
|
},
|
|
2652
|
-
children: [
|
|
2754
|
+
children: [m(a.name), ":"]
|
|
2653
2755
|
}), /* @__PURE__ */ J("div", {
|
|
2654
2756
|
style: {
|
|
2655
2757
|
minWidth: 180,
|
|
2656
2758
|
opacity: r ? .6 : 1,
|
|
2657
2759
|
pointerEvents: r ? "none" : "auto"
|
|
2658
2760
|
},
|
|
2659
|
-
children: /* @__PURE__ */ J(
|
|
2761
|
+
children: /* @__PURE__ */ J(h, {
|
|
2660
2762
|
value: o ?? "",
|
|
2661
|
-
options:
|
|
2763
|
+
options: c,
|
|
2662
2764
|
onChange: (t) => n(e, t),
|
|
2663
2765
|
placeholder: "Select…"
|
|
2664
2766
|
})
|
|
@@ -2669,31 +2771,31 @@ function Nt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
2669
2771
|
}
|
|
2670
2772
|
//#endregion
|
|
2671
2773
|
//#region src/components/detail-layout/StatusesBlock.tsx
|
|
2672
|
-
var
|
|
2673
|
-
function
|
|
2774
|
+
var Bt = () => {};
|
|
2775
|
+
function Vt({ node: e, ctx: t }) {
|
|
2674
2776
|
let { entity: n, objectStatuses: r, onSetStatus: i, isStatusPending: a, isNew: o } = t, s = n.status_groups ?? {};
|
|
2675
2777
|
if (o) return null;
|
|
2676
2778
|
let c = e.statuses === !0 || e.statuses, l = Object.fromEntries(Object.entries(s).filter(([e]) => c === !0 || c.includes(e)));
|
|
2677
|
-
return Object.keys(l).length === 0 ? null : /* @__PURE__ */ J(
|
|
2779
|
+
return Object.keys(l).length === 0 ? null : /* @__PURE__ */ J(zt, {
|
|
2678
2780
|
statusGroups: l,
|
|
2679
2781
|
objectStatuses: r,
|
|
2680
|
-
onSetStatus: i ??
|
|
2782
|
+
onSetStatus: i ?? Bt,
|
|
2681
2783
|
isPending: a ?? !1,
|
|
2682
2784
|
mode: t.mode
|
|
2683
2785
|
});
|
|
2684
2786
|
}
|
|
2685
2787
|
//#endregion
|
|
2686
2788
|
//#region src/components/detail-layout/widgets/canonicalizeJson.ts
|
|
2687
|
-
function
|
|
2688
|
-
if (Array.isArray(e)) return e.map(
|
|
2789
|
+
function Ht(e) {
|
|
2790
|
+
if (Array.isArray(e)) return e.map(Ht);
|
|
2689
2791
|
if (typeof e == "object" && e) {
|
|
2690
2792
|
let t = e, n = {};
|
|
2691
|
-
for (let e of Object.keys(t).sort()) n[e] =
|
|
2793
|
+
for (let e of Object.keys(t).sort()) n[e] = Ht(t[e]);
|
|
2692
2794
|
return n;
|
|
2693
2795
|
}
|
|
2694
2796
|
return e;
|
|
2695
2797
|
}
|
|
2696
|
-
function
|
|
2798
|
+
function Ut(e) {
|
|
2697
2799
|
switch (typeof e) {
|
|
2698
2800
|
case "string": return e;
|
|
2699
2801
|
case "number":
|
|
@@ -2705,39 +2807,39 @@ function Lt(e) {
|
|
|
2705
2807
|
default: return "";
|
|
2706
2808
|
}
|
|
2707
2809
|
}
|
|
2708
|
-
function
|
|
2810
|
+
function Wt(e) {
|
|
2709
2811
|
if (e == null) return "";
|
|
2710
2812
|
try {
|
|
2711
|
-
return JSON.stringify(
|
|
2813
|
+
return JSON.stringify(Ht(e), null, 2) ?? Ut(e);
|
|
2712
2814
|
} catch {
|
|
2713
|
-
return
|
|
2815
|
+
return Ut(e);
|
|
2714
2816
|
}
|
|
2715
2817
|
}
|
|
2716
2818
|
//#endregion
|
|
2717
2819
|
//#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
|
|
2718
|
-
var
|
|
2719
|
-
function
|
|
2820
|
+
var Gt = "Audit change diff", Kt = he(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonDiff }))), qt = he(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonSource }))), Jt = he(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
|
|
2821
|
+
function Yt() {
|
|
2720
2822
|
return /* @__PURE__ */ J("div", {
|
|
2721
2823
|
className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
|
|
2722
2824
|
children: "Loading editor…"
|
|
2723
2825
|
});
|
|
2724
2826
|
}
|
|
2725
|
-
function
|
|
2726
|
-
return /* @__PURE__ */ J(
|
|
2727
|
-
fallback: /* @__PURE__ */ J(
|
|
2827
|
+
function Xt({ before: e, after: t }) {
|
|
2828
|
+
return /* @__PURE__ */ J(pe, {
|
|
2829
|
+
fallback: /* @__PURE__ */ J(Yt, {}),
|
|
2728
2830
|
children: /* @__PURE__ */ Y("div", {
|
|
2729
2831
|
className: "flex h-full w-full gap-2",
|
|
2730
2832
|
role: "group",
|
|
2731
|
-
"aria-label":
|
|
2833
|
+
"aria-label": Gt,
|
|
2732
2834
|
children: [/* @__PURE__ */ J("div", {
|
|
2733
2835
|
className: "min-w-0 flex-1",
|
|
2734
|
-
children: /* @__PURE__ */ J(
|
|
2836
|
+
children: /* @__PURE__ */ J(Jt, {
|
|
2735
2837
|
value: e,
|
|
2736
2838
|
readOnly: !0
|
|
2737
2839
|
})
|
|
2738
2840
|
}), /* @__PURE__ */ J("div", {
|
|
2739
2841
|
className: "min-w-0 flex-1",
|
|
2740
|
-
children: /* @__PURE__ */ J(
|
|
2842
|
+
children: /* @__PURE__ */ J(Jt, {
|
|
2741
2843
|
value: t,
|
|
2742
2844
|
readOnly: !0
|
|
2743
2845
|
})
|
|
@@ -2745,7 +2847,7 @@ function Wt({ before: e, after: t }) {
|
|
|
2745
2847
|
})
|
|
2746
2848
|
});
|
|
2747
2849
|
}
|
|
2748
|
-
function
|
|
2850
|
+
function Zt({ mode: e, onChange: t }) {
|
|
2749
2851
|
return /* @__PURE__ */ Y("div", {
|
|
2750
2852
|
className: "inline-flex gap-1",
|
|
2751
2853
|
role: "group",
|
|
@@ -2765,13 +2867,13 @@ function Gt({ mode: e, onChange: t }) {
|
|
|
2765
2867
|
})]
|
|
2766
2868
|
});
|
|
2767
2869
|
}
|
|
2768
|
-
function
|
|
2769
|
-
let n = e.before, r = e.after, [i, a] = K(t?.default_mode === "source" ? "source" : "diff"), o =
|
|
2870
|
+
function Qt({ values: e, options: t }) {
|
|
2871
|
+
let n = e.before, r = e.after, [i, a] = K(t?.default_mode === "source" ? "source" : "diff"), o = Wt(n), s = Wt(r);
|
|
2770
2872
|
return /* @__PURE__ */ Y("div", {
|
|
2771
2873
|
className: "flex flex-col gap-2",
|
|
2772
2874
|
children: [/* @__PURE__ */ Y("div", {
|
|
2773
2875
|
className: "flex items-center justify-between",
|
|
2774
|
-
children: [/* @__PURE__ */ J(
|
|
2876
|
+
children: [/* @__PURE__ */ J(Zt, {
|
|
2775
2877
|
mode: i,
|
|
2776
2878
|
onChange: a
|
|
2777
2879
|
}), o === s && /* @__PURE__ */ J("span", {
|
|
@@ -2782,25 +2884,25 @@ function Kt({ values: e, options: t }) {
|
|
|
2782
2884
|
}), /* @__PURE__ */ J("div", {
|
|
2783
2885
|
className: "h-[480px] w-full overflow-hidden rounded border",
|
|
2784
2886
|
role: "group",
|
|
2785
|
-
"aria-label":
|
|
2786
|
-
children: /* @__PURE__ */ J(
|
|
2787
|
-
fallback: /* @__PURE__ */ J(
|
|
2887
|
+
"aria-label": Gt,
|
|
2888
|
+
children: /* @__PURE__ */ J(re, {
|
|
2889
|
+
fallback: /* @__PURE__ */ J(Xt, {
|
|
2788
2890
|
before: n,
|
|
2789
2891
|
after: r
|
|
2790
2892
|
}),
|
|
2791
|
-
children: /* @__PURE__ */ J(
|
|
2792
|
-
fallback: /* @__PURE__ */ J(
|
|
2793
|
-
children: i === "diff" ? /* @__PURE__ */ J(
|
|
2893
|
+
children: /* @__PURE__ */ J(pe, {
|
|
2894
|
+
fallback: /* @__PURE__ */ J(Yt, {}),
|
|
2895
|
+
children: i === "diff" ? /* @__PURE__ */ J(Kt, {
|
|
2794
2896
|
before: o,
|
|
2795
2897
|
after: s
|
|
2796
2898
|
}) : /* @__PURE__ */ Y("div", {
|
|
2797
2899
|
className: "flex h-full w-full gap-2",
|
|
2798
2900
|
children: [/* @__PURE__ */ J("div", {
|
|
2799
2901
|
className: "min-w-0 flex-1",
|
|
2800
|
-
children: /* @__PURE__ */ J(
|
|
2902
|
+
children: /* @__PURE__ */ J(qt, { value: o })
|
|
2801
2903
|
}), /* @__PURE__ */ J("div", {
|
|
2802
2904
|
className: "min-w-0 flex-1",
|
|
2803
|
-
children: /* @__PURE__ */ J(
|
|
2905
|
+
children: /* @__PURE__ */ J(qt, { value: s })
|
|
2804
2906
|
})]
|
|
2805
2907
|
})
|
|
2806
2908
|
})
|
|
@@ -2819,7 +2921,7 @@ function Q(e) {
|
|
|
2819
2921
|
let n = Object.entries(t).filter((e) => typeof e[1] == "string");
|
|
2820
2922
|
return n.length > 0 ? Object.fromEntries(n) : void 0;
|
|
2821
2923
|
}
|
|
2822
|
-
function
|
|
2924
|
+
function $t(e) {
|
|
2823
2925
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
2824
2926
|
let t = Z(e);
|
|
2825
2927
|
return !t || typeof t.field != "string" ? [] : [{
|
|
@@ -2829,7 +2931,7 @@ function qt(e) {
|
|
|
2829
2931
|
}];
|
|
2830
2932
|
}) : [];
|
|
2831
2933
|
}
|
|
2832
|
-
function
|
|
2934
|
+
function en(e) {
|
|
2833
2935
|
if (!e || typeof e.entity != "string" || typeof e.scope_field != "string" || typeof e.window_field != "string") return;
|
|
2834
2936
|
let t = Array.isArray(e.windows) ? e.windows.flatMap((e) => {
|
|
2835
2937
|
let t = Z(e);
|
|
@@ -2864,7 +2966,7 @@ function Jt(e) {
|
|
|
2864
2966
|
filter_label: Q(r.filter_label),
|
|
2865
2967
|
all_label: Q(r.all_label),
|
|
2866
2968
|
empty_label: Q(r.empty_label),
|
|
2867
|
-
columns:
|
|
2969
|
+
columns: $t(r.columns),
|
|
2868
2970
|
sort: typeof r.sort == "string" ? r.sort : void 0,
|
|
2869
2971
|
limit: typeof r.limit == "number" ? Math.min(500, Math.max(1, r.limit)) : 200
|
|
2870
2972
|
} : void 0, a = Z(e.drillthrough), o = a && typeof a.route == "string" && typeof a.scope_field == "string" && typeof a.window_field == "string" ? {
|
|
@@ -2889,7 +2991,7 @@ function Jt(e) {
|
|
|
2889
2991
|
drillthrough: o
|
|
2890
2992
|
};
|
|
2891
2993
|
}
|
|
2892
|
-
function
|
|
2994
|
+
function tn(e, t, n) {
|
|
2893
2995
|
if (e == null || e === "") return "N/A";
|
|
2894
2996
|
if (t === "number") return new Intl.NumberFormat(n).format(Number(e));
|
|
2895
2997
|
if (t === "percent_ratio") return new Intl.NumberFormat(n, {
|
|
@@ -2907,52 +3009,52 @@ function Yt(e, t, n) {
|
|
|
2907
3009
|
}
|
|
2908
3010
|
return typeof e == "string" ? e : typeof e == "number" || typeof e == "bigint" || typeof e == "boolean" ? String(e) : "N/A";
|
|
2909
3011
|
}
|
|
2910
|
-
function
|
|
3012
|
+
function nn(e, t) {
|
|
2911
3013
|
return typeof e.id == "string" || typeof e.id == "number" ? String(e.id) : `row-${t}`;
|
|
2912
3014
|
}
|
|
2913
|
-
function
|
|
3015
|
+
function rn(e, t) {
|
|
2914
3016
|
return !t || Object.entries(t).every(([t, n]) => e[t] === n);
|
|
2915
3017
|
}
|
|
2916
|
-
function
|
|
2917
|
-
let
|
|
3018
|
+
function an({ values: e, options: t }) {
|
|
3019
|
+
let n = W(() => en(t), [t]), i = r(), a = te(), o = e.scope, s = n?.windows.some((e) => e.code === n.default_window) ? n.default_window : n?.windows[0]?.code ?? "", [c, l] = K(s), [u, d] = K("");
|
|
2918
3020
|
U(() => {
|
|
2919
3021
|
l(s);
|
|
2920
3022
|
}, [s]), U(() => {
|
|
2921
3023
|
d("");
|
|
2922
3024
|
}, [c]);
|
|
2923
|
-
let f =
|
|
2924
|
-
field:
|
|
3025
|
+
let f = n ? [{
|
|
3026
|
+
field: n.scope_field,
|
|
2925
3027
|
op: "eq",
|
|
2926
3028
|
value: o
|
|
2927
3029
|
}, {
|
|
2928
|
-
field:
|
|
3030
|
+
field: n.window_field,
|
|
2929
3031
|
op: "eq",
|
|
2930
3032
|
value: c
|
|
2931
|
-
}] : [], p = n
|
|
3033
|
+
}] : [], p = g(n?.entity, {
|
|
2932
3034
|
per_page: 1,
|
|
2933
3035
|
filters: f
|
|
2934
|
-
}, !!(
|
|
2935
|
-
field:
|
|
3036
|
+
}, !!(n && o && c)), h = n?.breakdown, _ = h ? [{
|
|
3037
|
+
field: h.scope_field,
|
|
2936
3038
|
op: "eq",
|
|
2937
3039
|
value: o
|
|
2938
3040
|
}, {
|
|
2939
|
-
field:
|
|
3041
|
+
field: h.window_field,
|
|
2940
3042
|
op: "eq",
|
|
2941
3043
|
value: c
|
|
2942
|
-
}] : [],
|
|
2943
|
-
per_page:
|
|
2944
|
-
sort:
|
|
2945
|
-
filters:
|
|
2946
|
-
}, !!(
|
|
2947
|
-
if (!
|
|
3044
|
+
}] : [], v = g(h?.entity, {
|
|
3045
|
+
per_page: h?.limit ?? 200,
|
|
3046
|
+
sort: h?.sort,
|
|
3047
|
+
filters: _
|
|
3048
|
+
}, !!(h && o && c));
|
|
3049
|
+
if (!n || !o) return /* @__PURE__ */ J("div", {
|
|
2948
3050
|
role: "alert",
|
|
2949
3051
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
2950
3052
|
children: "Invalid entity_scorecard configuration."
|
|
2951
3053
|
});
|
|
2952
|
-
let
|
|
2953
|
-
let t =
|
|
3054
|
+
let y = p.data?.data?.[0], b = v.data?.data ?? [], x = h?.filter_field ? Array.from(new Set(b.map((e) => e[h.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], S = u && h?.filter_field ? b.filter((e) => e[h.filter_field] === u) : b, C = (e) => !u || !e.filtered || !h?.filter_field ? y?.[e.field] : b.find((t) => t[h.filter_field] === u && rn(t, e.filtered?.where))?.[e.filtered.field], w = (e) => {
|
|
3055
|
+
let t = n.drillthrough;
|
|
2954
3056
|
if (!t || !e.drillthrough_value) return;
|
|
2955
|
-
let
|
|
3057
|
+
let r = [{
|
|
2956
3058
|
field: t.scope_field,
|
|
2957
3059
|
op: "eq",
|
|
2958
3060
|
value: o
|
|
@@ -2961,36 +3063,36 @@ function Qt({ values: e, options: t }) {
|
|
|
2961
3063
|
op: "eq",
|
|
2962
3064
|
value: c
|
|
2963
3065
|
}];
|
|
2964
|
-
t.filter_field && u && e.drillthrough_filter !== !1 &&
|
|
3066
|
+
t.filter_field && u && e.drillthrough_filter !== !1 && r.push({
|
|
2965
3067
|
field: t.filter_field,
|
|
2966
3068
|
op: "eq",
|
|
2967
3069
|
value: u
|
|
2968
|
-
}), t.metric_field &&
|
|
3070
|
+
}), t.metric_field && r.push({
|
|
2969
3071
|
field: t.metric_field,
|
|
2970
3072
|
op: "eq",
|
|
2971
3073
|
value: e.drillthrough_value
|
|
2972
|
-
}), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(
|
|
2973
|
-
},
|
|
3074
|
+
}), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(r) }).toString() });
|
|
3075
|
+
}, T = p.error ?? v.error;
|
|
2974
3076
|
return /* @__PURE__ */ Y("div", {
|
|
2975
3077
|
className: "flex min-w-0 flex-col gap-4",
|
|
2976
|
-
"aria-label":
|
|
3078
|
+
"aria-label": m(n.title, i) || "Scorecard",
|
|
2977
3079
|
children: [
|
|
2978
3080
|
/* @__PURE__ */ Y("div", {
|
|
2979
3081
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
2980
3082
|
children: [/* @__PURE__ */ Y("div", {
|
|
2981
3083
|
className: "min-w-0",
|
|
2982
3084
|
children: [
|
|
2983
|
-
|
|
3085
|
+
n.title && /* @__PURE__ */ J("h3", {
|
|
2984
3086
|
className: "text-base font-semibold text-foreground",
|
|
2985
|
-
children:
|
|
3087
|
+
children: m(n.title, i)
|
|
2986
3088
|
}),
|
|
2987
|
-
|
|
3089
|
+
n.description && /* @__PURE__ */ J("p", {
|
|
2988
3090
|
className: "mt-1 text-sm text-muted-foreground",
|
|
2989
|
-
children:
|
|
3091
|
+
children: m(n.description, i)
|
|
2990
3092
|
}),
|
|
2991
|
-
|
|
3093
|
+
n.intended_note && /* @__PURE__ */ J("p", {
|
|
2992
3094
|
className: "mt-1 text-xs text-muted-foreground",
|
|
2993
|
-
children:
|
|
3095
|
+
children: m(n.intended_note, i)
|
|
2994
3096
|
})
|
|
2995
3097
|
]
|
|
2996
3098
|
}), /* @__PURE__ */ Y("div", {
|
|
@@ -2999,24 +3101,24 @@ function Qt({ values: e, options: t }) {
|
|
|
2999
3101
|
role: "group",
|
|
3000
3102
|
"aria-label": "Scorecard window",
|
|
3001
3103
|
className: "inline-flex rounded border border-border p-1",
|
|
3002
|
-
children:
|
|
3104
|
+
children: n.windows.map((e) => /* @__PURE__ */ J("button", {
|
|
3003
3105
|
type: "button",
|
|
3004
3106
|
"aria-pressed": c === e.code,
|
|
3005
3107
|
onClick: () => l(e.code),
|
|
3006
3108
|
className: `rounded px-3 py-1.5 text-xs font-medium ${c === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
|
|
3007
|
-
children:
|
|
3109
|
+
children: m(e.label, i) || e.code
|
|
3008
3110
|
}, e.code))
|
|
3009
|
-
}),
|
|
3111
|
+
}), h?.filter_field && /* @__PURE__ */ Y("label", {
|
|
3010
3112
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
3011
|
-
children: [
|
|
3012
|
-
"aria-label":
|
|
3113
|
+
children: [m(h.filter_label, i) || "Filter", /* @__PURE__ */ Y("select", {
|
|
3114
|
+
"aria-label": m(h.filter_label, i) || "Filter",
|
|
3013
3115
|
value: u,
|
|
3014
3116
|
onChange: (e) => d(e.target.value),
|
|
3015
3117
|
className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
|
|
3016
3118
|
children: [/* @__PURE__ */ J("option", {
|
|
3017
3119
|
value: "",
|
|
3018
|
-
children:
|
|
3019
|
-
}),
|
|
3120
|
+
children: m(h.all_label, i) || "All"
|
|
3121
|
+
}), x.map((e) => /* @__PURE__ */ J("option", {
|
|
3020
3122
|
value: e,
|
|
3021
3123
|
children: e
|
|
3022
3124
|
}, e))]
|
|
@@ -3024,35 +3126,35 @@ function Qt({ values: e, options: t }) {
|
|
|
3024
3126
|
})]
|
|
3025
3127
|
})]
|
|
3026
3128
|
}),
|
|
3027
|
-
|
|
3129
|
+
T && /* @__PURE__ */ J("div", {
|
|
3028
3130
|
role: "alert",
|
|
3029
3131
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
3030
|
-
children:
|
|
3132
|
+
children: T instanceof Error ? T.message : "Scorecard data could not be loaded."
|
|
3031
3133
|
}),
|
|
3032
|
-
!
|
|
3134
|
+
!T && !p.isLoading && !y && /* @__PURE__ */ J("div", {
|
|
3033
3135
|
className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
|
|
3034
|
-
children:
|
|
3136
|
+
children: m(n.empty_label, i) || "No scorecard data."
|
|
3035
3137
|
}),
|
|
3036
|
-
|
|
3138
|
+
y && /* @__PURE__ */ J("div", {
|
|
3037
3139
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
3038
|
-
children:
|
|
3039
|
-
let t =
|
|
3140
|
+
children: n.metrics.map((e) => {
|
|
3141
|
+
let t = C(e), r = !!(n.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ Y(q, { children: [
|
|
3040
3142
|
/* @__PURE__ */ J("span", {
|
|
3041
3143
|
className: "text-xs font-medium text-muted-foreground",
|
|
3042
|
-
children:
|
|
3144
|
+
children: m(e.label, i) || e.field
|
|
3043
3145
|
}),
|
|
3044
3146
|
/* @__PURE__ */ J("strong", {
|
|
3045
3147
|
className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
|
|
3046
|
-
children:
|
|
3148
|
+
children: tn(t, e.format, i)
|
|
3047
3149
|
}),
|
|
3048
3150
|
e.help && /* @__PURE__ */ J("span", {
|
|
3049
3151
|
className: "mt-1 block text-xs text-muted-foreground",
|
|
3050
|
-
children:
|
|
3152
|
+
children: m(e.help, i)
|
|
3051
3153
|
})
|
|
3052
3154
|
] });
|
|
3053
|
-
return
|
|
3155
|
+
return r ? /* @__PURE__ */ J("button", {
|
|
3054
3156
|
type: "button",
|
|
3055
|
-
onClick: () =>
|
|
3157
|
+
onClick: () => w(e),
|
|
3056
3158
|
className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
|
|
3057
3159
|
children: a
|
|
3058
3160
|
}, e.field) : /* @__PURE__ */ J("article", {
|
|
@@ -3061,26 +3163,26 @@ function Qt({ values: e, options: t }) {
|
|
|
3061
3163
|
}, e.field);
|
|
3062
3164
|
})
|
|
3063
3165
|
}),
|
|
3064
|
-
|
|
3166
|
+
h && /* @__PURE__ */ J("div", {
|
|
3065
3167
|
className: "min-w-0 overflow-x-auto rounded border border-border",
|
|
3066
3168
|
children: /* @__PURE__ */ Y("table", {
|
|
3067
3169
|
className: "w-full border-collapse text-sm",
|
|
3068
3170
|
children: [/* @__PURE__ */ J("thead", {
|
|
3069
3171
|
className: "bg-surface text-left text-xs text-muted-foreground",
|
|
3070
|
-
children: /* @__PURE__ */ J("tr", { children:
|
|
3172
|
+
children: /* @__PURE__ */ J("tr", { children: h.columns.map((e) => /* @__PURE__ */ J("th", {
|
|
3071
3173
|
className: "border-b border-divider px-3 py-2 font-medium",
|
|
3072
|
-
children:
|
|
3174
|
+
children: m(e.label, i) || e.field
|
|
3073
3175
|
}, e.field)) })
|
|
3074
|
-
}), /* @__PURE__ */ Y("tbody", { children: [
|
|
3176
|
+
}), /* @__PURE__ */ Y("tbody", { children: [S.map((e, t) => /* @__PURE__ */ J("tr", {
|
|
3075
3177
|
className: "border-b border-divider last:border-0",
|
|
3076
|
-
children:
|
|
3178
|
+
children: h.columns.map((t) => /* @__PURE__ */ J("td", {
|
|
3077
3179
|
className: "px-3 py-2 text-foreground",
|
|
3078
|
-
children:
|
|
3180
|
+
children: tn(e[t.field], t.format, i)
|
|
3079
3181
|
}, t.field))
|
|
3080
|
-
},
|
|
3081
|
-
colSpan: Math.max(1,
|
|
3182
|
+
}, nn(e, t))), !v.isLoading && S.length === 0 && /* @__PURE__ */ J("tr", { children: /* @__PURE__ */ J("td", {
|
|
3183
|
+
colSpan: Math.max(1, h.columns.length),
|
|
3082
3184
|
className: "px-3 py-6 text-center text-muted-foreground",
|
|
3083
|
-
children:
|
|
3185
|
+
children: m(h.empty_label, i) || "No breakdown rows."
|
|
3084
3186
|
}) })] })]
|
|
3085
3187
|
})
|
|
3086
3188
|
})
|
|
@@ -3089,15 +3191,15 @@ function Qt({ values: e, options: t }) {
|
|
|
3089
3191
|
}
|
|
3090
3192
|
//#endregion
|
|
3091
3193
|
//#region src/components/detail-layout/widgets/builtins.ts
|
|
3092
|
-
var
|
|
3093
|
-
function
|
|
3094
|
-
|
|
3194
|
+
var on = !1;
|
|
3195
|
+
function sn() {
|
|
3196
|
+
on ||= (oe("json_diff", Qt), oe("entity_scorecard", an), !0);
|
|
3095
3197
|
}
|
|
3096
3198
|
//#endregion
|
|
3097
3199
|
//#region src/components/detail-layout/widgets/WidgetHost.tsx
|
|
3098
|
-
|
|
3099
|
-
function
|
|
3100
|
-
let n =
|
|
3200
|
+
sn();
|
|
3201
|
+
function cn({ config: e, ctx: t }) {
|
|
3202
|
+
let n = se(e.type);
|
|
3101
3203
|
if (!n) return /* @__PURE__ */ J("span", {
|
|
3102
3204
|
className: "text-sm text-muted-foreground",
|
|
3103
3205
|
children: `unknown widget: ${e.type}`
|
|
@@ -3122,45 +3224,45 @@ function tn({ config: e, ctx: t }) {
|
|
|
3122
3224
|
}
|
|
3123
3225
|
//#endregion
|
|
3124
3226
|
//#region src/components/detail-layout/LayoutRenderer.tsx
|
|
3125
|
-
function
|
|
3227
|
+
function ln({ nodes: e, ctx: t }) {
|
|
3126
3228
|
return /* @__PURE__ */ J(q, { children: e.map((e, n) => /* @__PURE__ */ J($, {
|
|
3127
3229
|
node: e,
|
|
3128
3230
|
ctx: t
|
|
3129
3231
|
}, n)) });
|
|
3130
3232
|
}
|
|
3131
3233
|
function $({ node: e, ctx: t }) {
|
|
3132
|
-
return e.row ? /* @__PURE__ */ J(
|
|
3234
|
+
return e.row ? /* @__PURE__ */ J(we, {
|
|
3133
3235
|
config: e.row,
|
|
3134
3236
|
ctx: t
|
|
3135
|
-
}) : e.column ? /* @__PURE__ */ J(
|
|
3237
|
+
}) : e.column ? /* @__PURE__ */ J(De, {
|
|
3136
3238
|
config: e.column,
|
|
3137
3239
|
node: e,
|
|
3138
3240
|
ctx: t
|
|
3139
|
-
}) : e.tabs ? /* @__PURE__ */ J(
|
|
3241
|
+
}) : e.tabs ? /* @__PURE__ */ J(je, {
|
|
3140
3242
|
config: e.tabs,
|
|
3141
3243
|
ctx: t
|
|
3142
|
-
}) : e.section ? /* @__PURE__ */ J(
|
|
3244
|
+
}) : e.section ? /* @__PURE__ */ J(Me, {
|
|
3143
3245
|
config: e.section,
|
|
3144
3246
|
ctx: t
|
|
3145
|
-
}) : e.children ? /* @__PURE__ */ J(
|
|
3247
|
+
}) : e.children ? /* @__PURE__ */ J(wt, {
|
|
3146
3248
|
node: e,
|
|
3147
3249
|
ctx: t
|
|
3148
3250
|
}) : e.associated ? /* @__PURE__ */ J(M, {
|
|
3149
3251
|
node: e,
|
|
3150
3252
|
ctx: t
|
|
3151
|
-
}) : e.fields ? /* @__PURE__ */ J(
|
|
3253
|
+
}) : e.fields ? /* @__PURE__ */ J(Nt, {
|
|
3152
3254
|
fields: e.fields,
|
|
3153
3255
|
ctx: t
|
|
3154
|
-
}) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ J(
|
|
3256
|
+
}) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ J(cn, {
|
|
3155
3257
|
config: e.widget,
|
|
3156
3258
|
ctx: t
|
|
3157
|
-
}) : null : /* @__PURE__ */ J(
|
|
3259
|
+
}) : null : /* @__PURE__ */ J(Vt, {
|
|
3158
3260
|
node: e,
|
|
3159
3261
|
ctx: t
|
|
3160
|
-
}) : /* @__PURE__ */ J(
|
|
3262
|
+
}) : /* @__PURE__ */ J(It, {
|
|
3161
3263
|
node: e,
|
|
3162
3264
|
ctx: t
|
|
3163
3265
|
});
|
|
3164
3266
|
}
|
|
3165
3267
|
//#endregion
|
|
3166
|
-
export {
|
|
3268
|
+
export { zt as n, ln as t };
|