@declarion/react 0.86.0 → 0.88.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/app.js +28 -28
- package/dist-lib/components/actions/ActionButton.js +86 -85
- package/dist-lib/components/actions/ActionResultDialog.impl.js +47 -47
- package/dist-lib/components/actions/ActionRunner.js +47 -47
- package/dist-lib/components/actions/ObjectActionBar.js +9 -9
- package/dist-lib/components/actions/RowActionsKebab.js +19 -19
- package/dist-lib/components/agents/AgentChatPanel.impl.js +53 -53
- package/dist-lib/components/chrome/AssociationTabs.js +21 -21
- package/dist-lib/components/chrome/RecordHeader.js +33 -40
- package/dist-lib/components/detail-layout/AssociatedBlock.js +387 -381
- package/dist-lib/components/detail-layout/ChildrenBlock.js +12 -13
- package/dist-lib/components/detail-layout/ChildrenTimeline.js +198 -198
- package/dist-lib/components/detail-layout/DraggableChildrenTable.js +114 -114
- package/dist-lib/components/detail-layout/EditableChildrenTable.js +160 -160
- package/dist-lib/components/detail-layout/EvidenceBlock.js +20 -21
- package/dist-lib/components/detail-layout/PropertiesBlock.js +45 -39
- package/dist-lib/components/detail-layout/QuickAddForm.js +9 -9
- package/dist-lib/components/detail-layout/TimelineComposer.js +87 -89
- package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +100 -99
- package/dist-lib/components/fields/FileReferenceField.js +9 -9
- package/dist-lib/components/fields/StructureField.js +57 -47
- package/dist-lib/components/fields/TimestampField.js +59 -54
- package/dist-lib/components/fields/cells/factories/money.js +14 -23
- package/dist-lib/components/fields/cells/factories/nextRun.js +1 -1
- package/dist-lib/components/fields/cells/factories/text.js +18 -3
- package/dist-lib/components/fields/cells/factories/timestamp.js +24 -12
- package/dist-lib/components/file-widgets/DocumentCard.js +108 -106
- package/dist-lib/components/layout/Layout.js +306 -361
- package/dist-lib/components/layout/Rail.js +42 -41
- package/dist-lib/components/layout/Sidebar.js +132 -117
- package/dist-lib/components/layout/TabStrip.js +116 -115
- package/dist-lib/components/layout/TenantChip.js +47 -54
- package/dist-lib/components/layout/TopBar.js +108 -105
- package/dist-lib/components/list/InlineEditCell.js +23 -23
- package/dist-lib/components/list/QuickPeek.js +65 -66
- package/dist-lib/components/pages/DocumentsMenu.js +42 -42
- package/dist-lib/components/pages/ExportMenu.js +25 -25
- package/dist-lib/components/pages/RecordDocumentsPanel.js +35 -35
- package/dist-lib/components/pages/RecordNotesPanel.js +94 -93
- package/dist-lib/components/pages/SmartDetailPage.impl.js +421 -417
- package/dist-lib/components/pages/SmartListPage.impl.js +293 -295
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +310 -310
- package/dist-lib/components/pages/auth/AuthShell.js +73 -73
- package/dist-lib/components/pages/auth/SignIn.js +32 -32
- package/dist-lib/components/pages/auth/SignUp.impl.js +3 -3
- package/dist-lib/components/pages/auth/SignUpCode.js +9 -9
- package/dist-lib/components/pages/list/ListFloatbar.js +12 -12
- package/dist-lib/components/pages/list/ListHeader.js +19 -19
- package/dist-lib/components/pages/list/ListNoRows.js +15 -15
- package/dist-lib/components/pages/list/ListToolbar.js +145 -145
- package/dist-lib/components/pages/list/useActiveView.js +14 -5
- package/dist-lib/components/pages/list/useListQuery.js +121 -81
- package/dist-lib/components/pages/list/useListRowInteraction.js +70 -70
- package/dist-lib/components/pages/list/useRowMenu.js +7 -7
- package/dist-lib/components/pages/profile/Preferences.impl.js +81 -78
- package/dist-lib/components/pages/profile/Profile.impl.js +191 -189
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +166 -158
- package/dist-lib/components/shared/ChangePasswordDialog.impl.js +23 -23
- package/dist-lib/components/shared/MarkdownRenderer.js +9 -9
- package/dist-lib/hooks/useAuth.js +11 -11
- package/dist-lib/hooks/useBranding.js +4 -4
- package/dist-lib/hooks/useDisplayTimeZone.js +8 -0
- package/dist-lib/hooks/useFollowAgentOpen.js +24 -24
- package/dist-lib/hooks/useImpersonation.js +6 -6
- package/dist-lib/hooks/useMutations.js +23 -23
- package/dist-lib/hooks/useObjectStatus.js +5 -5
- package/dist-lib/hooks/useParams.js +59 -51
- package/dist-lib/hooks/useProperties.js +8 -8
- package/dist-lib/hooks/useRowTenant.js +18 -6
- package/dist-lib/hooks/useText.js +9 -7
- package/dist-lib/hooks/useUiPreferences.js +71 -0
- package/dist-lib/index.d.ts +22 -6
- package/dist-lib/index.js +127 -126
- package/dist-lib/lib/actions.js +116 -84
- package/dist-lib/lib/child-config.js +10 -1
- package/dist-lib/lib/format-count.js +16 -1
- package/dist-lib/lib/language.js +23 -21
- package/dist-lib/lib/money-text.js +29 -0
- package/dist-lib/lib/profile.js +4 -0
- package/dist-lib/lib/role-label.js +8 -0
- package/dist-lib/lib/schema-routing.js +34 -14
- package/dist-lib/lib/shortcut.js +10 -0
- package/dist-lib/lib/timestamp.js +93 -31
- package/dist-lib/stores/auth.js +9 -8
- package/dist-lib/stores/preferences.js +56 -17
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/testing.js +25 -28
- package/dist-lib/types/schema.js +33 -27
- package/dist-lib/{useResponsiveMode-D3SKz5z4.d.ts → useResponsiveMode-9_eJT18k.d.ts} +5 -5
- package/package.json +1 -1
|
@@ -1,68 +1,69 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatOffsetTimestamp as e } from "../../../lib/timestamp.js";
|
|
2
2
|
import { failureTitle as t } from "../../../lib/failure.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useText as n } from "../../../hooks/useText.js";
|
|
4
|
+
import { useTabNavigate as r } from "../../../hooks/useTabNavigate.js";
|
|
5
|
+
import { useEntityData as i } from "../../../hooks/useEntityData.js";
|
|
6
|
+
import { useEffect as a, useMemo as o, useState as s } from "react";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/detail-layout/widgets/EntityScorecardWidget.tsx
|
|
8
|
-
function
|
|
9
|
+
function d(e) {
|
|
9
10
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
let t =
|
|
12
|
+
function f(e) {
|
|
13
|
+
let t = d(e);
|
|
13
14
|
if (!t) return;
|
|
14
15
|
let n = Object.entries(t).filter((e) => typeof e[1] == "string");
|
|
15
16
|
return n.length > 0 ? Object.fromEntries(n) : void 0;
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function p(e) {
|
|
18
19
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
19
|
-
let t =
|
|
20
|
+
let t = d(e);
|
|
20
21
|
return !t || typeof t.field != "string" ? [] : [{
|
|
21
22
|
field: t.field,
|
|
22
|
-
label:
|
|
23
|
+
label: f(t.label),
|
|
23
24
|
format: t.format
|
|
24
25
|
}];
|
|
25
26
|
}) : [];
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function m(e) {
|
|
28
29
|
if (!e || typeof e.entity != "string" || typeof e.scope_field != "string" || typeof e.window_field != "string") return;
|
|
29
30
|
let t = Array.isArray(e.windows) ? e.windows.flatMap((e) => {
|
|
30
|
-
let t =
|
|
31
|
+
let t = d(e);
|
|
31
32
|
return t && typeof t.code == "string" ? [{
|
|
32
33
|
code: t.code,
|
|
33
|
-
label:
|
|
34
|
+
label: f(t.label)
|
|
34
35
|
}] : [];
|
|
35
36
|
}) : [], n = Array.isArray(e.metrics) ? e.metrics.flatMap((e) => {
|
|
36
|
-
let t =
|
|
37
|
+
let t = d(e);
|
|
37
38
|
if (!t || typeof t.field != "string") return [];
|
|
38
|
-
let n =
|
|
39
|
+
let n = d(t.filtered);
|
|
39
40
|
return [{
|
|
40
41
|
field: t.field,
|
|
41
|
-
label:
|
|
42
|
-
help:
|
|
42
|
+
label: f(t.label),
|
|
43
|
+
help: f(t.help),
|
|
43
44
|
format: t.format,
|
|
44
45
|
attention: t.attention === !0,
|
|
45
46
|
drillthrough_value: typeof t.drillthrough_value == "string" ? t.drillthrough_value : void 0,
|
|
46
47
|
drillthrough_filter: t.drillthrough_filter !== !1,
|
|
47
48
|
filtered: n && typeof n.field == "string" ? {
|
|
48
49
|
field: n.field,
|
|
49
|
-
where:
|
|
50
|
+
where: d(n.where)
|
|
50
51
|
} : void 0
|
|
51
52
|
}];
|
|
52
53
|
}) : [];
|
|
53
54
|
if (t.length === 0 || n.length === 0) return;
|
|
54
|
-
let r =
|
|
55
|
+
let r = d(e.breakdown), i = r && typeof r.entity == "string" && typeof r.scope_field == "string" && typeof r.window_field == "string" ? {
|
|
55
56
|
entity: r.entity,
|
|
56
57
|
scope_field: r.scope_field,
|
|
57
58
|
window_field: r.window_field,
|
|
58
59
|
filter_field: typeof r.filter_field == "string" ? r.filter_field : void 0,
|
|
59
|
-
filter_label:
|
|
60
|
-
all_label:
|
|
61
|
-
empty_label:
|
|
62
|
-
columns:
|
|
60
|
+
filter_label: f(r.filter_label),
|
|
61
|
+
all_label: f(r.all_label),
|
|
62
|
+
empty_label: f(r.empty_label),
|
|
63
|
+
columns: p(r.columns),
|
|
63
64
|
sort: typeof r.sort == "string" ? r.sort : void 0,
|
|
64
65
|
limit: typeof r.limit == "number" ? Math.min(500, Math.max(1, r.limit)) : 200
|
|
65
|
-
} : void 0, a =
|
|
66
|
+
} : void 0, a = d(e.drillthrough), o = a && typeof a.route == "string" && typeof a.scope_field == "string" && typeof a.window_field == "string" ? {
|
|
66
67
|
route: a.route,
|
|
67
68
|
scope_field: a.scope_field,
|
|
68
69
|
window_field: a.window_field,
|
|
@@ -76,15 +77,15 @@ function p(e) {
|
|
|
76
77
|
windows: t,
|
|
77
78
|
default_window: typeof e.default_window == "string" ? e.default_window : void 0,
|
|
78
79
|
metrics: n,
|
|
79
|
-
title:
|
|
80
|
-
description:
|
|
81
|
-
intended_note:
|
|
82
|
-
empty_label:
|
|
80
|
+
title: f(e.title),
|
|
81
|
+
description: f(e.description),
|
|
82
|
+
intended_note: f(e.intended_note),
|
|
83
|
+
empty_label: f(e.empty_label),
|
|
83
84
|
breakdown: i,
|
|
84
85
|
drillthrough: o
|
|
85
86
|
};
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
+
function h(e, t) {
|
|
88
89
|
let n = (e, n) => new Intl.NumberFormat(t, {
|
|
89
90
|
style: "unit",
|
|
90
91
|
unit: e,
|
|
@@ -92,50 +93,50 @@ function m(e, t) {
|
|
|
92
93
|
}).format(n);
|
|
93
94
|
return e >= 86400 ? n("day", Math.floor(e / 86400)) : e >= 3600 ? n("hour", Math.floor(e / 3600)) : e >= 60 ? n("minute", Math.floor(e / 60)) : n("second", Math.max(0, Math.floor(e)));
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
-
let
|
|
97
|
-
if (
|
|
98
|
-
if (
|
|
99
|
-
if (
|
|
96
|
+
function g(t, n, r) {
|
|
97
|
+
let i = t("record.scorecard.not_available", "N/A"), a = t.language;
|
|
98
|
+
if (n == null || n === "") return i;
|
|
99
|
+
if (r === "number") return new Intl.NumberFormat(a).format(Number(n));
|
|
100
|
+
if (r === "percent_ratio") return new Intl.NumberFormat(a, {
|
|
100
101
|
style: "percent",
|
|
101
102
|
maximumFractionDigits: 2
|
|
102
|
-
}).format(Number(
|
|
103
|
-
if (
|
|
104
|
-
let e = Number(
|
|
105
|
-
return Number.isFinite(e) ?
|
|
103
|
+
}).format(Number(n));
|
|
104
|
+
if (r === "duration_seconds") {
|
|
105
|
+
let e = Number(n);
|
|
106
|
+
return Number.isFinite(e) ? h(e, a) : i;
|
|
106
107
|
}
|
|
107
|
-
if (
|
|
108
|
-
if (typeof
|
|
109
|
-
let
|
|
110
|
-
return Number.isNaN(
|
|
108
|
+
if (r === "timestamp") {
|
|
109
|
+
if (typeof n != "string" && typeof n != "number" && !(n instanceof Date)) return i;
|
|
110
|
+
let r = new Date(n);
|
|
111
|
+
return Number.isNaN(r.getTime()) ? i : e(typeof n == "string" ? n : r.toISOString(), { zone: t.timeZone });
|
|
111
112
|
}
|
|
112
|
-
return typeof
|
|
113
|
+
return typeof n == "string" ? n : typeof n == "number" || typeof n == "bigint" || typeof n == "boolean" ? String(n) : i;
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
+
function _(e, t) {
|
|
115
116
|
return typeof e.id == "string" || typeof e.id == "number" ? String(e.id) : `row-${t}`;
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
+
function v(e, t) {
|
|
118
119
|
return !t || Object.entries(t).every(([t, n]) => e[t] === n);
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
-
let f =
|
|
122
|
-
|
|
121
|
+
function y({ values: e, options: d }) {
|
|
122
|
+
let f = n(), p = n("errors"), h = o(() => m(d), [d]), y = r(), b = e.scope, x = h?.windows.some((e) => e.code === h.default_window) ? h.default_window : h?.windows[0]?.code ?? "", [S, C] = s(x), [w, T] = s("");
|
|
123
|
+
a(() => {
|
|
123
124
|
C(x);
|
|
124
|
-
}, [x]),
|
|
125
|
+
}, [x]), a(() => {
|
|
125
126
|
T("");
|
|
126
127
|
}, [S]);
|
|
127
|
-
let E =
|
|
128
|
-
field:
|
|
128
|
+
let E = h ? [{
|
|
129
|
+
field: h.scope_field,
|
|
129
130
|
op: "eq",
|
|
130
131
|
value: b
|
|
131
132
|
}, {
|
|
132
|
-
field:
|
|
133
|
+
field: h.window_field,
|
|
133
134
|
op: "eq",
|
|
134
135
|
value: S
|
|
135
|
-
}] : [], D =
|
|
136
|
+
}] : [], D = i(h?.entity, {
|
|
136
137
|
per_page: 1,
|
|
137
138
|
filters: E
|
|
138
|
-
}, !!(
|
|
139
|
+
}, !!(h && b && S)), O = h?.breakdown, k = O ? [{
|
|
139
140
|
field: O.scope_field,
|
|
140
141
|
op: "eq",
|
|
141
142
|
value: b
|
|
@@ -143,18 +144,18 @@ function v({ values: u, options: d }) {
|
|
|
143
144
|
field: O.window_field,
|
|
144
145
|
op: "eq",
|
|
145
146
|
value: S
|
|
146
|
-
}] : [], A =
|
|
147
|
+
}] : [], A = i(O?.entity, {
|
|
147
148
|
per_page: O?.limit ?? 200,
|
|
148
149
|
sort: O?.sort,
|
|
149
150
|
filters: k
|
|
150
151
|
}, !!(O && b && S));
|
|
151
|
-
if (!
|
|
152
|
+
if (!h || !b) return /* @__PURE__ */ l("div", {
|
|
152
153
|
role: "alert",
|
|
153
154
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
154
|
-
children:
|
|
155
|
+
children: p("record.scorecard_config_invalid", "Invalid entity_scorecard configuration.")
|
|
155
156
|
});
|
|
156
|
-
let j = D.data?.data?.[0], M = A.data?.data ?? [], N = O?.filter_field ? Array.from(new Set(M.map((e) => e[O.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], P = w && O?.filter_field ? M.filter((e) => e[O.filter_field] === w) : M, F = (e) => !w || !e.filtered || !O?.filter_field ? j?.[e.field] : M.find((t) => t[O.filter_field] === w &&
|
|
157
|
-
let t =
|
|
157
|
+
let j = D.data?.data?.[0], M = A.data?.data ?? [], N = O?.filter_field ? Array.from(new Set(M.map((e) => e[O.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], P = w && O?.filter_field ? M.filter((e) => e[O.filter_field] === w) : M, F = (e) => !w || !e.filtered || !O?.filter_field ? j?.[e.field] : M.find((t) => t[O.filter_field] === w && v(t, e.filtered?.where))?.[e.filtered.field], I = (e) => {
|
|
158
|
+
let t = h.drillthrough;
|
|
158
159
|
if (!t || !e.drillthrough_value) return;
|
|
159
160
|
let n = [{
|
|
160
161
|
field: t.scope_field,
|
|
@@ -175,52 +176,52 @@ function v({ values: u, options: d }) {
|
|
|
175
176
|
value: e.drillthrough_value
|
|
176
177
|
}), y(t.route, { search: new URLSearchParams({ filters: JSON.stringify(n) }).toString() });
|
|
177
178
|
}, L = D.error ?? A.error, R = f(O?.filter_label) || f("record.scorecard.filter", "Filter");
|
|
178
|
-
return /* @__PURE__ */
|
|
179
|
+
return /* @__PURE__ */ u("div", {
|
|
179
180
|
className: "flex min-w-0 flex-col gap-4",
|
|
180
|
-
"aria-label": f(
|
|
181
|
+
"aria-label": f(h.title) || f("record.scorecard.title", "Scorecard"),
|
|
181
182
|
children: [
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ u("div", {
|
|
183
184
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
184
|
-
children: [/* @__PURE__ */
|
|
185
|
+
children: [/* @__PURE__ */ u("div", {
|
|
185
186
|
className: "min-w-0",
|
|
186
187
|
children: [
|
|
187
|
-
|
|
188
|
+
h.title && /* @__PURE__ */ l("h3", {
|
|
188
189
|
className: "text-base font-semibold text-foreground",
|
|
189
|
-
children: f(
|
|
190
|
+
children: f(h.title)
|
|
190
191
|
}),
|
|
191
|
-
|
|
192
|
+
h.description && /* @__PURE__ */ l("p", {
|
|
192
193
|
className: "mt-1 text-sm text-muted-foreground",
|
|
193
|
-
children: f(
|
|
194
|
+
children: f(h.description)
|
|
194
195
|
}),
|
|
195
|
-
|
|
196
|
+
h.intended_note && /* @__PURE__ */ l("p", {
|
|
196
197
|
className: "mt-1 text-xs text-muted-foreground",
|
|
197
|
-
children: f(
|
|
198
|
+
children: f(h.intended_note)
|
|
198
199
|
})
|
|
199
200
|
]
|
|
200
|
-
}), /* @__PURE__ */
|
|
201
|
+
}), /* @__PURE__ */ u("div", {
|
|
201
202
|
className: "flex flex-wrap items-center gap-2",
|
|
202
|
-
children: [/* @__PURE__ */
|
|
203
|
+
children: [/* @__PURE__ */ l("div", {
|
|
203
204
|
role: "group",
|
|
204
205
|
"aria-label": f("record.scorecard.window", "Scorecard window"),
|
|
205
206
|
className: "inline-flex rounded border border-border p-1",
|
|
206
|
-
children:
|
|
207
|
+
children: h.windows.map((e) => /* @__PURE__ */ l("button", {
|
|
207
208
|
type: "button",
|
|
208
209
|
"aria-pressed": S === e.code,
|
|
209
210
|
onClick: () => C(e.code),
|
|
210
211
|
className: `rounded px-3 py-1.5 text-xs font-medium ${S === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
|
|
211
212
|
children: f(e.label) || e.code
|
|
212
213
|
}, e.code))
|
|
213
|
-
}), O?.filter_field && /* @__PURE__ */
|
|
214
|
+
}), O?.filter_field && /* @__PURE__ */ u("label", {
|
|
214
215
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
215
|
-
children: [R, /* @__PURE__ */
|
|
216
|
+
children: [R, /* @__PURE__ */ u("select", {
|
|
216
217
|
"aria-label": R,
|
|
217
218
|
value: w,
|
|
218
219
|
onChange: (e) => T(e.target.value),
|
|
219
220
|
className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
|
|
220
|
-
children: [/* @__PURE__ */
|
|
221
|
+
children: [/* @__PURE__ */ l("option", {
|
|
221
222
|
value: "",
|
|
222
223
|
children: f(O.all_label) || f("record.scorecard.all", "All")
|
|
223
|
-
}), N.map((e) => /* @__PURE__ */
|
|
224
|
+
}), N.map((e) => /* @__PURE__ */ l("option", {
|
|
224
225
|
value: e,
|
|
225
226
|
children: e
|
|
226
227
|
}, e))]
|
|
@@ -228,60 +229,60 @@ function v({ values: u, options: d }) {
|
|
|
228
229
|
})]
|
|
229
230
|
})]
|
|
230
231
|
}),
|
|
231
|
-
L && /* @__PURE__ */
|
|
232
|
+
L && /* @__PURE__ */ l("div", {
|
|
232
233
|
role: "alert",
|
|
233
234
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
234
|
-
children: t(
|
|
235
|
+
children: t(p, L)
|
|
235
236
|
}),
|
|
236
|
-
!L && !D.isLoading && !j && /* @__PURE__ */
|
|
237
|
+
!L && !D.isLoading && !j && /* @__PURE__ */ l("div", {
|
|
237
238
|
className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
|
|
238
|
-
children: f(
|
|
239
|
+
children: f(h.empty_label) || f("record.scorecard.empty", "No scorecard data.")
|
|
239
240
|
}),
|
|
240
|
-
j && /* @__PURE__ */
|
|
241
|
+
j && /* @__PURE__ */ l("div", {
|
|
241
242
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
242
|
-
children:
|
|
243
|
-
let t = F(e), n = !!(
|
|
244
|
-
/* @__PURE__ */
|
|
243
|
+
children: h.metrics.map((e) => {
|
|
244
|
+
let t = F(e), n = !!(h.drillthrough && e.drillthrough_value), r = /* @__PURE__ */ u(c, { children: [
|
|
245
|
+
/* @__PURE__ */ l("span", {
|
|
245
246
|
className: "text-xs font-medium text-muted-foreground",
|
|
246
247
|
children: f(e.label) || e.field
|
|
247
248
|
}),
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ l("strong", {
|
|
249
250
|
className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
|
|
250
|
-
children:
|
|
251
|
+
children: g(f, t, e.format)
|
|
251
252
|
}),
|
|
252
|
-
e.help && /* @__PURE__ */
|
|
253
|
+
e.help && /* @__PURE__ */ l("span", {
|
|
253
254
|
className: "mt-1 block text-xs text-muted-foreground",
|
|
254
255
|
children: f(e.help)
|
|
255
256
|
})
|
|
256
257
|
] });
|
|
257
|
-
return n ? /* @__PURE__ */
|
|
258
|
+
return n ? /* @__PURE__ */ l("button", {
|
|
258
259
|
type: "button",
|
|
259
260
|
onClick: () => I(e),
|
|
260
261
|
className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
|
|
261
262
|
children: r
|
|
262
|
-
}, e.field) : /* @__PURE__ */
|
|
263
|
+
}, e.field) : /* @__PURE__ */ l("article", {
|
|
263
264
|
className: "rounded border border-border bg-card p-3",
|
|
264
265
|
children: r
|
|
265
266
|
}, e.field);
|
|
266
267
|
})
|
|
267
268
|
}),
|
|
268
|
-
O && /* @__PURE__ */
|
|
269
|
+
O && /* @__PURE__ */ l("div", {
|
|
269
270
|
className: "min-w-0 overflow-x-auto rounded border border-border",
|
|
270
|
-
children: /* @__PURE__ */
|
|
271
|
+
children: /* @__PURE__ */ u("table", {
|
|
271
272
|
className: "w-full border-collapse text-sm",
|
|
272
|
-
children: [/* @__PURE__ */
|
|
273
|
+
children: [/* @__PURE__ */ l("thead", {
|
|
273
274
|
className: "bg-surface text-left text-xs text-muted-foreground",
|
|
274
|
-
children: /* @__PURE__ */
|
|
275
|
+
children: /* @__PURE__ */ l("tr", { children: O.columns.map((e) => /* @__PURE__ */ l("th", {
|
|
275
276
|
className: "border-b border-divider px-3 py-2 font-medium",
|
|
276
277
|
children: f(e.label) || e.field
|
|
277
278
|
}, e.field)) })
|
|
278
|
-
}), /* @__PURE__ */
|
|
279
|
+
}), /* @__PURE__ */ u("tbody", { children: [P.map((e, t) => /* @__PURE__ */ l("tr", {
|
|
279
280
|
className: "border-b border-divider last:border-0",
|
|
280
|
-
children: O.columns.map((t) => /* @__PURE__ */
|
|
281
|
+
children: O.columns.map((t) => /* @__PURE__ */ l("td", {
|
|
281
282
|
className: "px-3 py-2 text-foreground",
|
|
282
|
-
children:
|
|
283
|
+
children: g(f, e[t.field], t.format)
|
|
283
284
|
}, t.field))
|
|
284
|
-
},
|
|
285
|
+
}, _(e, t))), !A.isLoading && P.length === 0 && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", {
|
|
285
286
|
colSpan: Math.max(1, O.columns.length),
|
|
286
287
|
className: "px-3 py-6 text-center text-muted-foreground",
|
|
287
288
|
children: f(O.empty_label) || f("record.scorecard.breakdown_empty", "No breakdown rows.")
|
|
@@ -292,4 +293,4 @@ function v({ values: u, options: d }) {
|
|
|
292
293
|
});
|
|
293
294
|
}
|
|
294
295
|
//#endregion
|
|
295
|
-
export {
|
|
296
|
+
export { y as EntityScorecardWidget };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { extractPkValues as e } from "../../types/schema.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { saveBlob as t } from "../../lib/download.js";
|
|
3
|
+
import { failureTitle as n } from "../../lib/failure.js";
|
|
4
|
+
import { Btn as r } from "../primitives/Btn.js";
|
|
5
|
+
import { useText as i } from "../../hooks/useText.js";
|
|
6
6
|
import { readFileReference as a } from "../../api/fileReferences.js";
|
|
7
7
|
import { useState as o } from "react";
|
|
8
8
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/fields/FileReferenceField.tsx
|
|
10
10
|
function l({ entityCode: e, pkValues: l, fieldCode: u, t: d }) {
|
|
11
|
-
let f =
|
|
11
|
+
let f = i("errors"), [p, m] = o(!1), [h, g] = o(null);
|
|
12
12
|
async function _() {
|
|
13
13
|
if (e && l && !p) {
|
|
14
14
|
m(!0), g(null);
|
|
15
15
|
try {
|
|
16
|
-
let
|
|
17
|
-
|
|
16
|
+
let n = await a(e, l, u);
|
|
17
|
+
t(n.blob, n.filename || `${e}-${u}.bin`);
|
|
18
18
|
} catch (e) {
|
|
19
|
-
g(
|
|
19
|
+
g(n(f, e));
|
|
20
20
|
} finally {
|
|
21
21
|
m(!1);
|
|
22
22
|
}
|
|
@@ -30,7 +30,7 @@ function l({ entityCode: e, pkValues: l, fieldCode: u, t: d }) {
|
|
|
30
30
|
gap: 4,
|
|
31
31
|
minWidth: 0
|
|
32
32
|
},
|
|
33
|
-
children: [/* @__PURE__ */ s(
|
|
33
|
+
children: [/* @__PURE__ */ s(r, {
|
|
34
34
|
kind: "ghost",
|
|
35
35
|
size: "xs",
|
|
36
36
|
disabled: p || !e || !l,
|
|
@@ -10,27 +10,31 @@ import { useId as c } from "react";
|
|
|
10
10
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/fields/StructureField.tsx
|
|
12
12
|
function d(t) {
|
|
13
|
-
let { field: n, value: r, mode: i, onChange: a, fieldId: s, labelId: c, nested: u } = t, { data:
|
|
14
|
-
return
|
|
15
|
-
structDef:
|
|
13
|
+
let { field: n, value: r, mode: i, onChange: a, fieldId: s, labelId: c, nested: u, refs: d, entities: m } = t, { data: h } = e(), g = n.structure ? h?.structures?.[n.structure] : void 0;
|
|
14
|
+
return g ? n.array ? /* @__PURE__ */ l(p, {
|
|
15
|
+
structDef: g,
|
|
16
16
|
value: r,
|
|
17
17
|
mode: i,
|
|
18
18
|
onChange: a,
|
|
19
19
|
fieldId: s,
|
|
20
20
|
labelId: c,
|
|
21
|
-
nested: u
|
|
21
|
+
nested: u,
|
|
22
|
+
refs: d,
|
|
23
|
+
entities: m
|
|
22
24
|
}) : /* @__PURE__ */ l(f, {
|
|
23
|
-
structDef:
|
|
25
|
+
structDef: g,
|
|
24
26
|
value: r,
|
|
25
27
|
mode: i,
|
|
26
28
|
onChange: a,
|
|
27
29
|
fieldId: s,
|
|
28
30
|
labelId: c,
|
|
29
|
-
nested: u
|
|
31
|
+
nested: u,
|
|
32
|
+
refs: d,
|
|
33
|
+
entities: m
|
|
30
34
|
}) : /* @__PURE__ */ l(o, { ...t });
|
|
31
35
|
}
|
|
32
|
-
function f({ structDef: e, value: t, mode: n, onChange: r, fieldId: o, labelId: f, nested: p = !1 }) {
|
|
33
|
-
let
|
|
36
|
+
function f({ structDef: e, value: t, mode: n, onChange: r, fieldId: o, labelId: f, nested: p = !1, refs: m, entities: h }) {
|
|
37
|
+
let g = i(), _ = c(), v = o ?? _, y = typeof t == "object" && t && !Array.isArray(t) ? t : {}, b = e.fields.names(), x = {
|
|
34
38
|
display: "flex",
|
|
35
39
|
flexDirection: "column",
|
|
36
40
|
gap: n === "display" ? 8 : 12,
|
|
@@ -39,16 +43,16 @@ function f({ structDef: e, value: t, mode: n, onChange: r, fieldId: o, labelId:
|
|
|
39
43
|
padding: 12,
|
|
40
44
|
background: "var(--surface-2)"
|
|
41
45
|
};
|
|
42
|
-
if (n === "display") return
|
|
46
|
+
if (n === "display") return b.some((e) => y[e] != null && y[e] !== "") ? /* @__PURE__ */ l("div", {
|
|
43
47
|
style: p ? {
|
|
44
48
|
display: "flex",
|
|
45
49
|
flexDirection: "column",
|
|
46
50
|
gap: 8
|
|
47
|
-
} :
|
|
48
|
-
children:
|
|
51
|
+
} : x,
|
|
52
|
+
children: b.map((t) => {
|
|
49
53
|
let n = e.fields.get(t);
|
|
50
54
|
if (!n) return null;
|
|
51
|
-
let r =
|
|
55
|
+
let r = y[t];
|
|
52
56
|
return r == null ? null : /* @__PURE__ */ u("div", {
|
|
53
57
|
style: {
|
|
54
58
|
display: "flex",
|
|
@@ -64,8 +68,8 @@ function f({ structDef: e, value: t, mode: n, onChange: r, fieldId: o, labelId:
|
|
|
64
68
|
minWidth: 100,
|
|
65
69
|
flexShrink: 0
|
|
66
70
|
},
|
|
67
|
-
title:
|
|
68
|
-
children: n.display ?
|
|
71
|
+
title: g(n.display?.description) || void 0,
|
|
72
|
+
children: n.display ? g(n.display.name) : t
|
|
69
73
|
}), /* @__PURE__ */ l("div", {
|
|
70
74
|
style: {
|
|
71
75
|
minWidth: 0,
|
|
@@ -76,14 +80,18 @@ function f({ structDef: e, value: t, mode: n, onChange: r, fieldId: o, labelId:
|
|
|
76
80
|
fieldName: t,
|
|
77
81
|
value: r,
|
|
78
82
|
mode: "display",
|
|
79
|
-
t:
|
|
80
|
-
nested: !0
|
|
83
|
+
t: g,
|
|
84
|
+
nested: !0,
|
|
85
|
+
refs: m,
|
|
86
|
+
entities: h
|
|
81
87
|
}) : s({
|
|
82
88
|
field: n,
|
|
83
89
|
fieldName: t,
|
|
84
90
|
value: r,
|
|
85
91
|
mode: "display",
|
|
86
|
-
t:
|
|
92
|
+
t: g,
|
|
93
|
+
refs: m,
|
|
94
|
+
entities: h
|
|
87
95
|
})
|
|
88
96
|
})]
|
|
89
97
|
}, t);
|
|
@@ -95,21 +103,21 @@ function f({ structDef: e, value: t, mode: n, onChange: r, fieldId: o, labelId:
|
|
|
95
103
|
},
|
|
96
104
|
children: "—"
|
|
97
105
|
});
|
|
98
|
-
let
|
|
106
|
+
let S = (e) => (t) => {
|
|
99
107
|
r?.({
|
|
100
|
-
...
|
|
108
|
+
...y,
|
|
101
109
|
[e]: t
|
|
102
110
|
});
|
|
103
111
|
};
|
|
104
112
|
return /* @__PURE__ */ l("div", {
|
|
105
|
-
style:
|
|
113
|
+
style: x,
|
|
106
114
|
id: o,
|
|
107
115
|
role: "group",
|
|
108
116
|
"aria-labelledby": f,
|
|
109
|
-
children:
|
|
117
|
+
children: b.map((t) => {
|
|
110
118
|
let n = e.fields.get(t);
|
|
111
119
|
if (!n) return null;
|
|
112
|
-
let r = n.type === "structure" && !!n.structure, i = `${
|
|
120
|
+
let r = n.type === "structure" && !!n.structure, i = `${v}-${t}`, o = `${i}-label`;
|
|
113
121
|
return /* @__PURE__ */ u("div", {
|
|
114
122
|
style: {
|
|
115
123
|
display: "flex",
|
|
@@ -120,33 +128,33 @@ function f({ structDef: e, value: t, mode: n, onChange: r, fieldId: o, labelId:
|
|
|
120
128
|
required: n.required,
|
|
121
129
|
id: o,
|
|
122
130
|
htmlFor: r ? void 0 : i,
|
|
123
|
-
children: n.display ?
|
|
131
|
+
children: n.display ? g(n.display.name) : t
|
|
124
132
|
}), r ? /* @__PURE__ */ l(d, {
|
|
125
133
|
field: n,
|
|
126
|
-
t:
|
|
134
|
+
t: g,
|
|
127
135
|
fieldName: t,
|
|
128
|
-
value:
|
|
136
|
+
value: y[t],
|
|
129
137
|
mode: "edit",
|
|
130
|
-
onChange:
|
|
138
|
+
onChange: S(t),
|
|
131
139
|
fieldId: i,
|
|
132
140
|
labelId: o
|
|
133
141
|
}) : s({
|
|
134
142
|
field: n,
|
|
135
143
|
fieldName: t,
|
|
136
|
-
value:
|
|
144
|
+
value: y[t],
|
|
137
145
|
mode: "edit",
|
|
138
|
-
onChange:
|
|
146
|
+
onChange: S(t),
|
|
139
147
|
fieldId: i,
|
|
140
148
|
labelId: o,
|
|
141
|
-
t:
|
|
149
|
+
t: g
|
|
142
150
|
})]
|
|
143
151
|
}, t);
|
|
144
152
|
})
|
|
145
153
|
});
|
|
146
154
|
}
|
|
147
|
-
function p({ structDef: e, value: a, mode: o, onChange: s, fieldId: d, labelId: p, nested: m = !1 }) {
|
|
148
|
-
let
|
|
149
|
-
if (o === "display") return
|
|
155
|
+
function p({ structDef: e, value: a, mode: o, onChange: s, fieldId: d, labelId: p, nested: m = !1, refs: h, entities: g }) {
|
|
156
|
+
let _ = i(), v = c(), y = d ?? v, b = Array.isArray(a) ? a : [];
|
|
157
|
+
if (o === "display") return b.length === 0 ? /* @__PURE__ */ l("span", {
|
|
150
158
|
style: {
|
|
151
159
|
fontSize: 12.5,
|
|
152
160
|
color: "var(--text-4)"
|
|
@@ -158,7 +166,7 @@ function p({ structDef: e, value: a, mode: o, onChange: s, fieldId: d, labelId:
|
|
|
158
166
|
flexDirection: "column",
|
|
159
167
|
gap: 8
|
|
160
168
|
},
|
|
161
|
-
children:
|
|
169
|
+
children: b.map((t, n) => /* @__PURE__ */ l("div", {
|
|
162
170
|
style: m && n > 0 ? {
|
|
163
171
|
borderTop: "1px solid var(--border)",
|
|
164
172
|
paddingTop: 8
|
|
@@ -167,17 +175,19 @@ function p({ structDef: e, value: a, mode: o, onChange: s, fieldId: d, labelId:
|
|
|
167
175
|
structDef: e,
|
|
168
176
|
value: t,
|
|
169
177
|
mode: "display",
|
|
170
|
-
nested: m
|
|
178
|
+
nested: m,
|
|
179
|
+
refs: h,
|
|
180
|
+
entities: g
|
|
171
181
|
})
|
|
172
182
|
}, n))
|
|
173
183
|
});
|
|
174
|
-
let
|
|
175
|
-
let n = [...
|
|
184
|
+
let x = (e) => (t) => {
|
|
185
|
+
let n = [...b];
|
|
176
186
|
n[e] = t, s?.(n);
|
|
177
|
-
},
|
|
178
|
-
s?.([...
|
|
179
|
-
},
|
|
180
|
-
let t =
|
|
187
|
+
}, S = () => {
|
|
188
|
+
s?.([...b, {}]);
|
|
189
|
+
}, C = (e) => () => {
|
|
190
|
+
let t = b.filter((t, n) => n !== e);
|
|
181
191
|
s?.(t);
|
|
182
192
|
};
|
|
183
193
|
return /* @__PURE__ */ u("div", {
|
|
@@ -189,14 +199,14 @@ function p({ structDef: e, value: a, mode: o, onChange: s, fieldId: d, labelId:
|
|
|
189
199
|
id: d,
|
|
190
200
|
role: "group",
|
|
191
201
|
"aria-labelledby": p,
|
|
192
|
-
children: [
|
|
202
|
+
children: [b.map((n, i) => /* @__PURE__ */ u("div", {
|
|
193
203
|
style: { position: "relative" },
|
|
194
204
|
children: [/* @__PURE__ */ l(f, {
|
|
195
205
|
structDef: e,
|
|
196
206
|
value: n,
|
|
197
207
|
mode: "edit",
|
|
198
|
-
onChange:
|
|
199
|
-
fieldId: `${
|
|
208
|
+
onChange: x(i),
|
|
209
|
+
fieldId: `${y}-${i}`
|
|
200
210
|
}), /* @__PURE__ */ l("div", {
|
|
201
211
|
style: {
|
|
202
212
|
position: "absolute",
|
|
@@ -206,14 +216,14 @@ function p({ structDef: e, value: a, mode: o, onChange: s, fieldId: d, labelId:
|
|
|
206
216
|
children: /* @__PURE__ */ l(r, {
|
|
207
217
|
size: 24,
|
|
208
218
|
icon: /* @__PURE__ */ l(t.trash, { size: 12 }),
|
|
209
|
-
onClick:
|
|
210
|
-
title:
|
|
219
|
+
onClick: C(i),
|
|
220
|
+
title: _("field.structure.remove", "Remove")
|
|
211
221
|
})
|
|
212
222
|
})]
|
|
213
223
|
}, i)), /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(n, {
|
|
214
224
|
icon: /* @__PURE__ */ l(t.plus, { size: 13 }),
|
|
215
|
-
onClick:
|
|
216
|
-
children:
|
|
225
|
+
onClick: S,
|
|
226
|
+
children: _("field.array.add", "Add")
|
|
217
227
|
}) })]
|
|
218
228
|
});
|
|
219
229
|
}
|