@declarion/react 0.38.5 → 0.39.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-DziCVhq6.js} +1 -1
- package/dist-lib/{Grid-D2ArPFCz.js → Grid-BTX2tkCT.js} +2 -2
- package/dist-lib/{LayoutRenderer-C8DQ61Vo.js → LayoutRenderer-CwMERoPJ.js} +387 -285
- package/dist-lib/{MarkdownRenderer-CSuODN70.js → MarkdownRenderer-dHOTEhUa.js} +1 -1
- package/dist-lib/{RefreshControl-CHvOUn0o.js → RefreshControl--UAgflh7.js} +291 -209
- package/dist-lib/{SmartDetailPage.impl-Cl306lX3.js → SmartDetailPage.impl-Bj7MtHxi.js} +473 -414
- package/dist-lib/{SmartRecordListPage.impl-j8bhyL4e.js → SmartRecordListPage.impl-CZXzVhPC.js} +164 -164
- 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/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 +3036 -2167
- package/dist-lib/lib/actions.d.ts +17 -3
- package/dist-lib/lib/evidence-verdict.d.ts +11 -0
- package/dist-lib/lib/rowClickGesture.d.ts +14 -0
- package/dist-lib/{registry-C3hbFTDQ.js → registry-DXNFRlbB.js} +780 -560
- package/dist-lib/stores/list-layout.d.ts +86 -0
- package/dist-lib/testing.js +1 -1
- 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-BA2lb-d7.js} +35 -23
- package/dist-lib/{useProperties-CliP5qvg.js → useProperties-Br2DeOQh.js} +81 -81
- package/dist-lib/{value-CNy3_xCA.js → value-C91loRXp.js} +1 -1
- package/package.json +1 -1
- package/dist-lib/components/list/RowMenu.d.ts +0 -23
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
|
|
2
|
-
import { F as n, Gn as r, Kn as i, L as a, Nn as o, On as s, R as c, U as l, Wn as u, _ as d, an as f, at as p, bn as m, dn as h, en as g, fn as _, g as v, gn as y, h as b, hn as x, ht as S, it as C, jt as w, ln as T, m as E, on as D, rt as O, sn as k, un as A, zn as j } from "./useCurrentScreen-
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import { Suspense as
|
|
6
|
-
import { useInfiniteQuery as
|
|
2
|
+
import { F as n, Gn as r, Kn as i, L as a, Nn as o, On as s, R as c, U as l, Wn as u, _ as d, an as f, at as p, bn as m, dn as h, en as g, fn as _, g as v, gn as y, h as b, hn as x, ht as S, it as C, jt as w, ln as T, m as E, on as D, rt as O, sn as k, un as A, zn as j } from "./useCurrentScreen-BA2lb-d7.js";
|
|
3
|
+
import { A as M, Dt as N, E as P, J as F, Ot as I, Q as L, T as R, X as ee, Y as z, Z as B, _t as V, d as te, et as ne, o as re, ot as ie, r as ae, st as oe, t as se, u as ce, yt as le } from "./registry-DXNFRlbB.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: le("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: le("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: le("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,11 +117,11 @@ 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
126
|
if (e.label) return A(e.label);
|
|
127
127
|
let r = t.entity.children?.find((e) => e.entity === n);
|
|
@@ -131,9 +131,9 @@ function De(e, t) {
|
|
|
131
131
|
}
|
|
132
132
|
return e.section ? A(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,7 +143,7 @@ function Oe(e, t) {
|
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/components/detail-layout/LayoutTabs.tsx
|
|
146
|
-
function
|
|
146
|
+
function je({ config: e, ctx: n }) {
|
|
147
147
|
let { items: r } = e, [i, a] = K(0), o = j(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
|
|
148
148
|
if (r.length === 0) return null;
|
|
149
149
|
if (s === "sections") {
|
|
@@ -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,
|
|
@@ -343,14 +343,14 @@ function Ae({ config: e, ctx: n }) {
|
|
|
343
343
|
tone: c.tone,
|
|
344
344
|
dot: c.dot
|
|
345
345
|
} : void 0;
|
|
346
|
-
return /* @__PURE__ */ J(
|
|
346
|
+
return /* @__PURE__ */ J(I, {
|
|
347
347
|
title: A(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
|
|
385
|
+
function Pe(e) {
|
|
386
386
|
return f(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,16 +458,16 @@ function Ve(e, ...t) {
|
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
function
|
|
461
|
+
function We(e) {
|
|
462
462
|
let t = T(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
|
|
@@ -479,7 +479,7 @@ function We(e, t, n, r) {
|
|
|
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,16 +488,16 @@ function Ge(e, t) {
|
|
|
488
488
|
}
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/components/detail-layout/useQuickAdd.ts
|
|
491
|
-
function
|
|
491
|
+
function Je(e, t, n, r) {
|
|
492
492
|
let [i, o] = K(() => {
|
|
493
493
|
let t = e.quick_add, n = r.entities[e.entity], i = {};
|
|
494
494
|
if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = a()) : i[e] = t.defaults[e];
|
|
495
495
|
return i;
|
|
496
|
-
}), s =
|
|
496
|
+
}), s = 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
|
+
ee,
|
|
501
501
|
t,
|
|
502
502
|
Array.isArray(n) ? h(n.map(String)) : n,
|
|
503
503
|
e.entity
|
|
@@ -534,16 +534,16 @@ function Ke(e, t, n, r) {
|
|
|
534
534
|
onSettled: () => {
|
|
535
535
|
let r = Array.isArray(n) ? h(n.map(String)) : n;
|
|
536
536
|
s.invalidateQueries({ queryKey: [
|
|
537
|
-
|
|
537
|
+
ee,
|
|
538
538
|
t,
|
|
539
539
|
r,
|
|
540
540
|
e.entity
|
|
541
541
|
] });
|
|
542
542
|
}
|
|
543
|
-
}), f = e.quick_add, p = r.entities[e.entity], m =
|
|
543
|
+
}), f = e.quick_add, p = r.entities[e.entity], m = qe(i, f?.fields.filter((e) => p?.fields.get(e)?.required) ?? []);
|
|
544
544
|
function g(t) {
|
|
545
545
|
if (t.preventDefault(), !f) return;
|
|
546
|
-
let r =
|
|
546
|
+
let r = Ke(i, f.defaults, e.foreign_key, n);
|
|
547
547
|
c(r);
|
|
548
548
|
}
|
|
549
549
|
function _(e, t) {
|
|
@@ -565,8 +565,8 @@ function Ke(e, t, n, r) {
|
|
|
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: p } =
|
|
568
|
+
function Ye({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
569
|
+
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n, r, a), m = b(), h = j(), g = _e();
|
|
570
570
|
return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ Y("form", {
|
|
571
571
|
onSubmit: f,
|
|
572
572
|
style: {
|
|
@@ -634,14 +634,104 @@ 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(L, Math.max(60, Math.round(e)));
|
|
643
|
+
}
|
|
644
|
+
function Qe(e) {
|
|
645
|
+
let { widths: t, setWidths: n, resetWidths: r } = ne(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 s = a.entities[t.entity], c =
|
|
640
|
-
|
|
641
|
-
let
|
|
728
|
+
function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
729
|
+
let s = a.entities[t.entity], c = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, l = Qe(Xe(n, t.entity, c)), f = b(), p = z((e) => e.degradedEntities), { data: h, isLoading: g, isError: _, isFetching: v, refetch: x } = B(n, i, t.entity, t.foreign_key, t.sort, t.limit), S = h?.data ?? [], C = h?.$refs, w = G(C);
|
|
730
|
+
w.current = C;
|
|
731
|
+
let T = t.columns, E = t.interaction === "navigate", D = T[0], O = E && s ? y(void 0, s, a.screens) : null, A = s ? We(s) : void 0, j = W(() => {
|
|
642
732
|
let e = /* @__PURE__ */ new Map();
|
|
643
733
|
if (!s) return e;
|
|
644
|
-
for (let t of
|
|
734
|
+
for (let t of T) {
|
|
645
735
|
let n = s.fields.get(t);
|
|
646
736
|
n && e.set(t, d({
|
|
647
737
|
field: n,
|
|
@@ -650,17 +740,17 @@ function Je({ config: t, parentEntity: n, parentId: i, schema: a }) {
|
|
|
650
740
|
entity: s,
|
|
651
741
|
entities: a.entities,
|
|
652
742
|
screens: a.screens,
|
|
653
|
-
refs: () =>
|
|
654
|
-
locale:
|
|
743
|
+
refs: () => w.current,
|
|
744
|
+
locale: f
|
|
655
745
|
}));
|
|
656
746
|
}
|
|
657
747
|
return e;
|
|
658
748
|
}, [
|
|
659
749
|
s,
|
|
660
|
-
|
|
750
|
+
T,
|
|
661
751
|
a.entities,
|
|
662
752
|
a.screens,
|
|
663
|
-
|
|
753
|
+
f
|
|
664
754
|
]);
|
|
665
755
|
if (!s) return /* @__PURE__ */ J("div", {
|
|
666
756
|
style: {
|
|
@@ -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
|
+
}), N = F(s.realtime, p, t.entity), P = /* @__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
|
+
l.hasWidths && /* @__PURE__ */ J(r, {
|
|
778
|
+
icon: /* @__PURE__ */ J(e.columns, { size: 13 }),
|
|
779
|
+
title: "Reset column widths (this device)",
|
|
780
|
+
size: 24,
|
|
781
|
+
onClick: l.resetWidths
|
|
782
|
+
}),
|
|
783
|
+
N && /* @__PURE__ */ J("span", {
|
|
784
|
+
"data-testid": "children-live-indicator",
|
|
785
|
+
title: "This table updates automatically in realtime.",
|
|
786
|
+
children: /* @__PURE__ */ J(u, {
|
|
787
|
+
tone: "emerald",
|
|
788
|
+
size: "xs",
|
|
789
|
+
dot: !0,
|
|
790
|
+
children: "Live"
|
|
791
|
+
})
|
|
792
|
+
}),
|
|
793
|
+
/* @__PURE__ */ J(r, {
|
|
794
|
+
icon: v ? /* @__PURE__ */ J("span", {
|
|
795
|
+
"data-testid": "children-refresh-spinner",
|
|
796
|
+
style: { display: "inline-flex" },
|
|
797
|
+
children: /* @__PURE__ */ J(o, { size: 13 })
|
|
798
|
+
}) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
|
|
799
|
+
title: "Refresh",
|
|
800
|
+
size: 24,
|
|
801
|
+
disabled: v,
|
|
802
|
+
onClick: () => {
|
|
803
|
+
x();
|
|
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 _ ? /* @__PURE__ */ Y("div", { children: [
|
|
809
|
+
M,
|
|
810
|
+
P,
|
|
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
|
+
P,
|
|
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
|
+
] }) : S.length === 0 ? /* @__PURE__ */ Y("div", { children: [
|
|
840
|
+
M,
|
|
841
|
+
P,
|
|
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
|
+
P,
|
|
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:
|
|
856
|
+
style: de,
|
|
857
|
+
children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: T.map((e) => {
|
|
759
858
|
let t = s.fields.get(e);
|
|
760
|
-
return /* @__PURE__ */
|
|
761
|
-
style:
|
|
762
|
-
children: t ? k(t, e, a.entities) : e
|
|
859
|
+
return /* @__PURE__ */ Y("th", {
|
|
860
|
+
style: l.headerStyle(e, ue),
|
|
861
|
+
children: [t ? k(t, e, a.entities) : e, /* @__PURE__ */ J($e, {
|
|
862
|
+
colId: e,
|
|
863
|
+
onMouseDown: l.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: S.map((e, t) => {
|
|
867
|
+
let n = A ? m(e[A]) : "", r = E && O && n ? O.replace(/:\w+/, n) : void 0;
|
|
868
|
+
return /* @__PURE__ */ J("tr", { children: T.map((t) => {
|
|
869
|
+
let n = t === D, i = j.get(t), a = i ? i(e[t], e) : m(e[t]);
|
|
768
870
|
return /* @__PURE__ */ J("td", {
|
|
769
871
|
title: typeof a == "string" ? a : void 0,
|
|
770
|
-
style:
|
|
872
|
+
style: l.cellStyle(t, fe),
|
|
771
873
|
children: n && r ? /* @__PURE__ */ J("a", {
|
|
772
874
|
href: r,
|
|
773
875
|
style: {
|
|
@@ -788,8 +890,8 @@ 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 i = r.entities[e.entity], a = b(), { data: o, isLoading: s, isError: c } =
|
|
893
|
+
function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
894
|
+
let i = r.entities[e.entity], a = b(), { data: o, isLoading: s, isError: c } = B(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], u = o?.$refs, d = e.columns;
|
|
793
895
|
if (!i) return /* @__PURE__ */ J("div", {
|
|
794
896
|
style: {
|
|
795
897
|
fontSize: 12.5,
|
|
@@ -798,7 +900,7 @@ function Ye({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
798
900
|
},
|
|
799
901
|
children: "Entity not found."
|
|
800
902
|
});
|
|
801
|
-
let f = /* @__PURE__ */ J(
|
|
903
|
+
let f = /* @__PURE__ */ J(Ye, {
|
|
802
904
|
config: e,
|
|
803
905
|
parentEntity: t,
|
|
804
906
|
parentId: n,
|
|
@@ -908,8 +1010,8 @@ function Ye({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
908
1010
|
}
|
|
909
1011
|
//#endregion
|
|
910
1012
|
//#region src/components/detail-layout/ChildrenCards.tsx
|
|
911
|
-
function
|
|
912
|
-
let i = r.entities[e.entity], a = b(), { data: o, isLoading: s, isError: c } =
|
|
1013
|
+
function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1014
|
+
let i = r.entities[e.entity], a = b(), { data: o, isLoading: s, isError: c } = B(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], d = o?.$refs, f = e.columns, p = e.cards, h = p?.header_field ?? f[0], g = p?.badge_field, _ = p?.columns_count ?? 3;
|
|
913
1015
|
if (!i) return /* @__PURE__ */ J("div", {
|
|
914
1016
|
style: {
|
|
915
1017
|
fontSize: 12.5,
|
|
@@ -922,7 +1024,7 @@ function Xe({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
922
1024
|
display: "grid",
|
|
923
1025
|
gridTemplateColumns: `repeat(auto-fill, minmax(${_ >= 4 ? 180 : 240}px, 1fr))`,
|
|
924
1026
|
gap: 12
|
|
925
|
-
}, x = /* @__PURE__ */ J(
|
|
1027
|
+
}, x = /* @__PURE__ */ J(Ye, {
|
|
926
1028
|
config: e,
|
|
927
1029
|
parentEntity: t,
|
|
928
1030
|
parentId: n,
|
|
@@ -1051,11 +1153,11 @@ function Xe({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1051
1153
|
}
|
|
1052
1154
|
//#endregion
|
|
1053
1155
|
//#region src/hooks/useTimelineData.ts
|
|
1054
|
-
var
|
|
1055
|
-
function
|
|
1056
|
-
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? _(t, o.length) : [t], c = a ??
|
|
1156
|
+
var rt = 50;
|
|
1157
|
+
function it(e, t, n, r, i, a) {
|
|
1158
|
+
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? _(t, o.length) : [t], c = a ?? rt, l = ye({
|
|
1057
1159
|
queryKey: [
|
|
1058
|
-
|
|
1160
|
+
ee,
|
|
1059
1161
|
e,
|
|
1060
1162
|
t,
|
|
1061
1163
|
n,
|
|
@@ -1089,15 +1191,15 @@ function Qe(e, t, n, r, i, a) {
|
|
|
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: r, schema: a }) {
|
|
1196
|
+
let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n, r, a), m = b(), [h, g] = K(st), _ = G(null), y = G(null), [x, S] = K(ct);
|
|
1095
1197
|
U(() => {
|
|
1096
1198
|
let e = y.current?.parentElement;
|
|
1097
1199
|
if (!e) return;
|
|
1098
1200
|
let t = () => {
|
|
1099
|
-
let t = Math.max(
|
|
1100
|
-
S(Math.min(
|
|
1201
|
+
let t = Math.max(ot, e.clientHeight - lt);
|
|
1202
|
+
S(Math.min(ct, t));
|
|
1101
1203
|
};
|
|
1102
1204
|
t();
|
|
1103
1205
|
let n = new ResizeObserver(t);
|
|
@@ -1119,7 +1221,7 @@ function it({ config: t, parentEntity: n, parentId: r, schema: a }) {
|
|
|
1119
1221
|
t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
|
|
1120
1222
|
}
|
|
1121
1223
|
}), []);
|
|
1122
|
-
U(() => E(
|
|
1224
|
+
U(() => E(at, D), [D]);
|
|
1123
1225
|
let O = H((e) => {
|
|
1124
1226
|
e.preventDefault(), _.current = {
|
|
1125
1227
|
startY: e.clientY,
|
|
@@ -1127,7 +1229,7 @@ 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(x, Math.max(
|
|
1232
|
+
let t = _.current.startY - e.clientY, n = Math.min(x, 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);
|
|
@@ -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
1396
|
return e == null ? "" : m(e);
|
|
1295
1397
|
}
|
|
1296
1398
|
return p(D(e, t));
|
|
1297
1399
|
}
|
|
1298
|
-
function
|
|
1400
|
+
function mt(e) {
|
|
1299
1401
|
return e.__optimistic === !0;
|
|
1300
1402
|
}
|
|
1301
|
-
function
|
|
1302
|
-
let a = r.entities[e.entity], { rows: s, refs: c, fetchNextPage: l, hasOlder: u, isFetchingOlder: d, isLoading: f, isError: p } =
|
|
1403
|
+
function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
1404
|
+
let a = r.entities[e.entity], { rows: s, refs: c, fetchNextPage: l, hasOlder: u, isFetchingOlder: d, isLoading: f, isError: p } = it(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), m = e.timeline, h = m?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = W(() => g ? [...s].reverse() : s, [s, g]), v = m?.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]),
|
|
1407
|
+
}, [n]), ve(() => {
|
|
1306
1408
|
!d || !y.current || (E.current = {
|
|
1307
1409
|
scrollHeight: y.current.scrollHeight,
|
|
1308
1410
|
scrollTop: y.current.scrollTop
|
|
1309
1411
|
});
|
|
1310
|
-
}, [d]),
|
|
1412
|
+
}, [d]), ve(() => {
|
|
1311
1413
|
let e = y.current;
|
|
1312
1414
|
if (!e || _.length === 0 || !a) {
|
|
1313
1415
|
S.current = _.length;
|
|
1314
1416
|
return;
|
|
1315
1417
|
}
|
|
1316
|
-
let t =
|
|
1418
|
+
let t = pt(a, _[0]), n = pt(a, _[_.length - 1]), r = !x.current, i = _.length > S.current && S.current > 0, o = i && (g && t !== C.current && n === w.current || !g && n !== w.current && t === C.current), s = i && !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;
|
|
@@ -1328,7 +1430,7 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1328
1430
|
]);
|
|
1329
1431
|
let D = 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;
|
|
@@ -1337,7 +1439,7 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1337
1439
|
for (let t of e) t.isIntersecting && u && !d && l();
|
|
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();
|
|
@@ -1368,12 +1470,12 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1368
1470
|
icon: d ? /* @__PURE__ */ J(o, { size: 11 }) : void 0,
|
|
1369
1471
|
children: d ? "Loading…" : "Load older"
|
|
1370
1472
|
})
|
|
1371
|
-
}) : null,
|
|
1473
|
+
}) : null, P = /* @__PURE__ */ J("div", {
|
|
1372
1474
|
ref: b,
|
|
1373
1475
|
"aria-hidden": "true",
|
|
1374
1476
|
style: { height: 1 }
|
|
1375
|
-
}),
|
|
1376
|
-
if (p)
|
|
1477
|
+
}), F;
|
|
1478
|
+
if (p) F = /* @__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 (f)
|
|
1486
|
+
else if (f) F = /* @__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)
|
|
1503
|
+
else if (_.length === 0) F = /* @__PURE__ */ Y(q, { children: [P, /* @__PURE__ */ J("div", {
|
|
1402
1504
|
style: {
|
|
1403
1505
|
fontSize: 12.5,
|
|
1404
1506
|
color: "var(--text-3)",
|
|
@@ -1408,8 +1510,8 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1408
1510
|
})] });
|
|
1409
1511
|
else {
|
|
1410
1512
|
let i = (i, o) => {
|
|
1411
|
-
let s =
|
|
1412
|
-
return /* @__PURE__ */ J(
|
|
1513
|
+
let s = pt(a, i) || String(o);
|
|
1514
|
+
return /* @__PURE__ */ J(gt, {
|
|
1413
1515
|
row: i,
|
|
1414
1516
|
rowId: s,
|
|
1415
1517
|
childEntity: a,
|
|
@@ -1424,16 +1526,16 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1424
1526
|
onCancelEdit: () => k(null),
|
|
1425
1527
|
onSaved: () => k(null),
|
|
1426
1528
|
schema: r,
|
|
1427
|
-
optimistic:
|
|
1529
|
+
optimistic: mt(i)
|
|
1428
1530
|
}, s);
|
|
1429
1531
|
}, o = m?.time_field, s;
|
|
1430
1532
|
if (o) {
|
|
1431
1533
|
let e = [];
|
|
1432
1534
|
_.forEach((t, n) => {
|
|
1433
|
-
let r = t[o], i =
|
|
1535
|
+
let r = t[o], 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
|
|
@@ -1448,14 +1550,14 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
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
1556
|
}), e.rows.map(({ row: e, idx: t }) => i(e, t))]
|
|
1455
1557
|
}, `day-${e.key}`));
|
|
1456
1558
|
} else s = _.map((e, t) => i(e, t));
|
|
1457
|
-
|
|
1458
|
-
|
|
1559
|
+
F = /* @__PURE__ */ Y(q, { children: [
|
|
1560
|
+
P,
|
|
1459
1561
|
N,
|
|
1460
1562
|
s
|
|
1461
1563
|
] });
|
|
@@ -1496,9 +1598,9 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1496
1598
|
flexDirection: "column",
|
|
1497
1599
|
gap: 8
|
|
1498
1600
|
},
|
|
1499
|
-
children:
|
|
1601
|
+
children: F
|
|
1500
1602
|
}),
|
|
1501
|
-
/* @__PURE__ */ J(
|
|
1603
|
+
/* @__PURE__ */ J(ut, {
|
|
1502
1604
|
config: e,
|
|
1503
1605
|
parentEntity: t,
|
|
1504
1606
|
parentId: n,
|
|
@@ -1511,18 +1613,18 @@ function lt({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
1511
1613
|
flexDirection: "column",
|
|
1512
1614
|
gap: 8
|
|
1513
1615
|
},
|
|
1514
|
-
children:
|
|
1515
|
-
}), /* @__PURE__ */ J(
|
|
1616
|
+
children: F
|
|
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 T =
|
|
1624
|
+
function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c, parentId: d, timeline: f, editableFields: p, refs: m, isEditing: h, onStartEdit: g, onCancelEdit: _, onSaved: y, schema: x, optimistic: w = !1 }) {
|
|
1625
|
+
let T = xe(), E = b(), [D, O] = K({}), A = H(() => {
|
|
1524
1626
|
T.invalidateQueries({ queryKey: [
|
|
1525
|
-
|
|
1627
|
+
ee,
|
|
1526
1628
|
c,
|
|
1527
1629
|
d,
|
|
1528
1630
|
s
|
|
@@ -1532,7 +1634,7 @@ function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1532
1634
|
c,
|
|
1533
1635
|
d,
|
|
1534
1636
|
s
|
|
1535
|
-
]), j =
|
|
1637
|
+
]), j = be({
|
|
1536
1638
|
mutationFn: (e) => {
|
|
1537
1639
|
let r = t.$row_version;
|
|
1538
1640
|
return S(s, n, typeof r == "string" && r !== "" ? {
|
|
@@ -1544,13 +1646,13 @@ function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1544
1646
|
A(), l.success("Updated"), y();
|
|
1545
1647
|
},
|
|
1546
1648
|
onError: (e) => l.error(e.message)
|
|
1547
|
-
}), M =
|
|
1649
|
+
}), M = be({
|
|
1548
1650
|
mutationFn: () => C(s, n),
|
|
1549
1651
|
onSuccess: () => {
|
|
1550
1652
|
A(), l.success("Deleted");
|
|
1551
1653
|
},
|
|
1552
1654
|
onError: (e) => l.error(e.message)
|
|
1553
|
-
}),
|
|
1655
|
+
}), N = H(() => {
|
|
1554
1656
|
let e = {};
|
|
1555
1657
|
for (let n of p) e[n] = t[n] ?? "";
|
|
1556
1658
|
O(e), g();
|
|
@@ -1666,7 +1768,7 @@ function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1666
1768
|
locale: E
|
|
1667
1769
|
})
|
|
1668
1770
|
}),
|
|
1669
|
-
B && t[B] != null && a.fields.get(B) && /* @__PURE__ */ J(
|
|
1771
|
+
B && t[B] != null && a.fields.get(B) && /* @__PURE__ */ J(bt, {
|
|
1670
1772
|
value: t[B],
|
|
1671
1773
|
field: a.fields.get(B)
|
|
1672
1774
|
}),
|
|
@@ -1706,7 +1808,7 @@ function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1706
1808
|
children: [/* @__PURE__ */ J(r, {
|
|
1707
1809
|
size: 22,
|
|
1708
1810
|
icon: /* @__PURE__ */ J(e.edit, { size: 11 }),
|
|
1709
|
-
onClick:
|
|
1811
|
+
onClick: N,
|
|
1710
1812
|
title: "Edit"
|
|
1711
1813
|
}), /* @__PURE__ */ J(r, {
|
|
1712
1814
|
size: 22,
|
|
@@ -1752,12 +1854,12 @@ function ut({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
|
|
|
1752
1854
|
]
|
|
1753
1855
|
});
|
|
1754
1856
|
}
|
|
1755
|
-
function
|
|
1857
|
+
function _t(e) {
|
|
1756
1858
|
if (e == null) return "";
|
|
1757
1859
|
let t = new Date(m(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
1864
|
let t = new Date(m(e));
|
|
1763
1865
|
if (Number.isNaN(t.getTime())) return "—";
|
|
@@ -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,7 +1937,7 @@ function ht(e, t) {
|
|
|
1835
1937
|
}
|
|
1836
1938
|
//#endregion
|
|
1837
1939
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
1838
|
-
function
|
|
1940
|
+
function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, validationErrors: c, refs: l, forceTablePresentation: u = !1 }) {
|
|
1839
1941
|
let d = b(), f = j(), p = G(null), h = t.columns, g = t.position_field, _ = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), y = 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);
|
|
@@ -1928,7 +2030,7 @@ 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
|
-
}, [C]), O =
|
|
2033
|
+
}, [C]), O = ue;
|
|
1932
2034
|
return f.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
|
|
1933
2035
|
style: {
|
|
1934
2036
|
display: "flex",
|
|
@@ -2071,7 +2173,7 @@ function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2071
2173
|
style: { overflowX: "auto" },
|
|
2072
2174
|
children: /* @__PURE__ */ Y("table", {
|
|
2073
2175
|
ref: p,
|
|
2074
|
-
style:
|
|
2176
|
+
style: de,
|
|
2075
2177
|
onKeyDown: D,
|
|
2076
2178
|
children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [h.map((e) => {
|
|
2077
2179
|
let t = n.fields.get(e);
|
|
@@ -2161,13 +2263,13 @@ function gt({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
|
|
|
2161
2263
|
}
|
|
2162
2264
|
//#endregion
|
|
2163
2265
|
//#region src/components/detail-layout/ChildrenBlock.tsx
|
|
2164
|
-
var
|
|
2165
|
-
function
|
|
2266
|
+
var Ct = he(() => import("./DraggableChildrenTable-DziCVhq6.js").then((e) => ({ default: e.DraggableChildrenTable })));
|
|
2267
|
+
function wt({ node: e, ctx: n }) {
|
|
2166
2268
|
let r = j(), 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(I, {
|
|
2181
2283
|
title: l,
|
|
2182
2284
|
icon: u ? /* @__PURE__ */ J(t, {
|
|
2183
2285
|
name: u,
|
|
@@ -2186,9 +2288,9 @@ function vt({ node: e, ctx: n }) {
|
|
|
2186
2288
|
children: e
|
|
2187
2289
|
});
|
|
2188
2290
|
if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && f(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
|
|
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(
|
|
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,
|
|
@@ -2209,33 +2311,33 @@ function vt({ node: e, ctx: n }) {
|
|
|
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, { ...p }));
|
|
2315
|
+
case "cards": return d(/* @__PURE__ */ J(nt, { ...p }));
|
|
2316
|
+
case "timeline": return d(/* @__PURE__ */ J(ht, { ...p }));
|
|
2317
|
+
default: return r.isPhone && !a ? d(/* @__PURE__ */ J(nt, { ...p })) : d(/* @__PURE__ */ J(et, { ...p }));
|
|
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: n, span: r = !1, required: i, error: a, hint: o, actions: s, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
|
|
2355
|
+
let h = ge(At), g = r || h.columns === 1, _ = !!a;
|
|
2254
2356
|
return /* @__PURE__ */ Y("div", {
|
|
2255
2357
|
className: "detail-row",
|
|
2256
2358
|
"data-error": _ || void 0,
|
|
@@ -2265,11 +2367,11 @@ function Et({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
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",
|
|
@@ -2313,10 +2415,10 @@ 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: {
|
|
@@ -2355,18 +2457,18 @@ function Et({ label: t, children: n, span: r = !1, required: i, error: a, hint:
|
|
|
2355
2457
|
}
|
|
2356
2458
|
//#endregion
|
|
2357
2459
|
//#region src/components/detail-layout/FieldsBlock.tsx
|
|
2358
|
-
function
|
|
2460
|
+
function Nt({ fields: e, ctx: t }) {
|
|
2359
2461
|
let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = b(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
|
|
2360
|
-
return /* @__PURE__ */ J(
|
|
2462
|
+
return /* @__PURE__ */ J(jt, {
|
|
2361
2463
|
columns: l,
|
|
2362
2464
|
children: e.map((e) => {
|
|
2363
|
-
let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), h = !!(p?.auto || p?.readonly || p?.source), g =
|
|
2465
|
+
let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), h = !!(p?.auto || p?.readonly || p?.source), g = te(n, l), _ = g?.read === "denied", v = g?.write === "denied", y = a === "display" ? _ : v || _, b = h || a === "edit" && v ? "display" : a, x = y ? /* @__PURE__ */ J(N, {
|
|
2364
2466
|
tier: g.classification,
|
|
2365
|
-
tierDef:
|
|
2467
|
+
tierDef: ce(s, n, l),
|
|
2366
2468
|
requiredPermission: g?.required_permission,
|
|
2367
2469
|
locale: c,
|
|
2368
2470
|
variant: b === "edit" ? "input" : "value"
|
|
2369
|
-
}) :
|
|
2471
|
+
}) : ie({
|
|
2370
2472
|
entity: n,
|
|
2371
2473
|
entityCode: r,
|
|
2372
2474
|
fieldName: l,
|
|
@@ -2381,14 +2483,14 @@ function Dt({ fields: e, ctx: t }) {
|
|
|
2381
2483
|
labelId: f
|
|
2382
2484
|
});
|
|
2383
2485
|
if (!x) return null;
|
|
2384
|
-
let S = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(
|
|
2486
|
+
let S = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(M, {
|
|
2385
2487
|
actionCode: `${l}.action[${t}]`,
|
|
2386
2488
|
action: e,
|
|
2387
2489
|
entityCode: r,
|
|
2388
2490
|
row: i,
|
|
2389
2491
|
variant: "ghost",
|
|
2390
2492
|
size: "icon"
|
|
2391
|
-
}, t)) }) : void 0, C = !!p &&
|
|
2493
|
+
}, t)) }) : void 0, C = !!p && kt.has(p.type), w = i?.[l], T = b === "display" && (p?.copyable || p?.type === "uuid") && w != null && w !== "" ? m(w) : void 0, E = A(p?.display?.description);
|
|
2392
2494
|
return u ? /* @__PURE__ */ Y("div", {
|
|
2393
2495
|
style: { gridColumn: "1 / -1" },
|
|
2394
2496
|
children: [x, b === "edit" && E && /* @__PURE__ */ J("div", {
|
|
@@ -2400,8 +2502,8 @@ function Dt({ fields: e, ctx: t }) {
|
|
|
2400
2502
|
},
|
|
2401
2503
|
children: E
|
|
2402
2504
|
})]
|
|
2403
|
-
}, l) : /* @__PURE__ */ J(
|
|
2404
|
-
label:
|
|
2505
|
+
}, l) : /* @__PURE__ */ J(Mt, {
|
|
2506
|
+
label: oe(n, l, s.entities),
|
|
2405
2507
|
htmlFor: b === "edit" ? d : void 0,
|
|
2406
2508
|
labelId: f,
|
|
2407
2509
|
labelTitle: E || void 0,
|
|
@@ -2419,7 +2521,7 @@ function Dt({ fields: e, ctx: t }) {
|
|
|
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,16 +2529,16 @@ var Ot = /* @__PURE__ */ new Set([
|
|
|
2427
2529
|
"decimal",
|
|
2428
2530
|
"email",
|
|
2429
2531
|
"url"
|
|
2430
|
-
]),
|
|
2431
|
-
function
|
|
2532
|
+
]), Ft = 500;
|
|
2533
|
+
function It({ node: e, ctx: t }) {
|
|
2432
2534
|
let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
|
|
2433
2535
|
if (a) return null;
|
|
2434
2536
|
let l = e.properties === !0 || e.properties, u = l === !0 ? Object.entries(c).sort(([e], [t]) => e.localeCompare(t)) : l.filter((e) => c[e] != null).map((e) => [e, c[e]]);
|
|
2435
|
-
return u.length === 0 ? null : /* @__PURE__ */ J(
|
|
2537
|
+
return u.length === 0 ? null : /* @__PURE__ */ J(jt, {
|
|
2436
2538
|
columns: 2,
|
|
2437
2539
|
children: u.map(([e, a]) => {
|
|
2438
2540
|
let c = r?.find((t) => t.property_code === e), l = x(a), u = a.readonly || !i ? "display" : o;
|
|
2439
|
-
return /* @__PURE__ */ J(
|
|
2541
|
+
return /* @__PURE__ */ J(Lt, {
|
|
2440
2542
|
propCode: e,
|
|
2441
2543
|
prop: a,
|
|
2442
2544
|
field: l,
|
|
@@ -2450,25 +2552,25 @@ function At({ node: e, ctx: t }) {
|
|
|
2450
2552
|
})
|
|
2451
2553
|
});
|
|
2452
2554
|
}
|
|
2453
|
-
function
|
|
2555
|
+
function Lt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: s, schema: c }) {
|
|
2454
2556
|
let l = b(), u = G(null);
|
|
2455
2557
|
U(() => () => {
|
|
2456
2558
|
u.current && clearTimeout(u.current);
|
|
2457
2559
|
}, []);
|
|
2458
2560
|
let d = H((n) => {
|
|
2459
|
-
a && (
|
|
2561
|
+
a && (Pt.has(t.type) ? (u.current && clearTimeout(u.current), u.current = setTimeout(() => a(e, n), Ft)) : a(e, n));
|
|
2460
2562
|
}, [
|
|
2461
2563
|
e,
|
|
2462
2564
|
t.type,
|
|
2463
2565
|
a
|
|
2464
|
-
]), f =
|
|
2465
|
-
return /* @__PURE__ */ J(
|
|
2566
|
+
]), f = te(s, e), p = f?.read === "denied", m = f?.write === "denied", h = i === "display" ? p : m || p, g = i === "edit" && m ? "display" : i;
|
|
2567
|
+
return /* @__PURE__ */ J(Mt, {
|
|
2466
2568
|
label: A(t.display?.name ?? t.name),
|
|
2467
2569
|
mode: g,
|
|
2468
|
-
span:
|
|
2469
|
-
children: h ? /* @__PURE__ */ J(
|
|
2570
|
+
span: kt.has(t.type),
|
|
2571
|
+
children: h ? /* @__PURE__ */ J(N, {
|
|
2470
2572
|
tier: f.classification,
|
|
2471
|
-
tierDef:
|
|
2573
|
+
tierDef: ce(c, s, e),
|
|
2472
2574
|
requiredPermission: f?.required_permission,
|
|
2473
2575
|
locale: l,
|
|
2474
2576
|
variant: g === "edit" ? "input" : "value"
|
|
@@ -2485,7 +2587,7 @@ function jt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty:
|
|
|
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",
|
|
@@ -2584,7 +2686,7 @@ function Nt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
|
|
|
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
2692
|
label: A(e.name)
|
|
@@ -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,14 +3009,14 @@ 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 r = W(() =>
|
|
3018
|
+
function an({ values: e, options: t }) {
|
|
3019
|
+
let r = W(() => en(t), [t]), i = b(), a = V(), o = e.scope, s = r?.windows.some((e) => e.code === r.default_window) ? r.default_window : r?.windows[0]?.code ?? "", [c, l] = K(s), [u, d] = K("");
|
|
2918
3020
|
U(() => {
|
|
2919
3021
|
l(s);
|
|
2920
3022
|
}, [s]), U(() => {
|
|
@@ -2949,7 +3051,7 @@ function Qt({ values: e, options: t }) {
|
|
|
2949
3051
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
2950
3052
|
children: "Invalid entity_scorecard configuration."
|
|
2951
3053
|
});
|
|
2952
|
-
let _ = p.data?.data?.[0], v = g.data?.data ?? [], y = m?.filter_field ? Array.from(new Set(v.map((e) => e[m.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], x = u && m?.filter_field ? v.filter((e) => e[m.filter_field] === u) : v, S = (e) => !u || !e.filtered || !m?.filter_field ? _?.[e.field] : v.find((t) => t[m.filter_field] === u &&
|
|
3054
|
+
let _ = p.data?.data?.[0], v = g.data?.data ?? [], y = m?.filter_field ? Array.from(new Set(v.map((e) => e[m.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], x = u && m?.filter_field ? v.filter((e) => e[m.filter_field] === u) : v, S = (e) => !u || !e.filtered || !m?.filter_field ? _?.[e.field] : v.find((t) => t[m.filter_field] === u && rn(t, e.filtered?.where))?.[e.filtered.field], C = (e) => {
|
|
2953
3055
|
let t = r.drillthrough;
|
|
2954
3056
|
if (!t || !e.drillthrough_value) return;
|
|
2955
3057
|
let n = [{
|
|
@@ -3043,7 +3145,7 @@ function Qt({ values: e, options: t }) {
|
|
|
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",
|
|
@@ -3075,9 +3177,9 @@ function Qt({ values: e, options: t }) {
|
|
|
3075
3177
|
className: "border-b border-divider last:border-0",
|
|
3076
3178
|
children: m.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
|
-
},
|
|
3182
|
+
}, nn(e, t))), !g.isLoading && x.length === 0 && /* @__PURE__ */ J("tr", { children: /* @__PURE__ */ J("td", {
|
|
3081
3183
|
colSpan: Math.max(1, m.columns.length),
|
|
3082
3184
|
className: "px-3 py-6 text-center text-muted-foreground",
|
|
3083
3185
|
children: A(m.empty_label, i) || "No breakdown rows."
|
|
@@ -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 ||= (ae("json_diff", Qt), ae("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
|
-
}) : e.associated ? /* @__PURE__ */ J(
|
|
3250
|
+
}) : e.associated ? /* @__PURE__ */ J(P, {
|
|
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 };
|