@declarion/react 0.106.0 → 0.109.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/api/agents.js +8 -7
- package/dist-lib/api/client.js +48 -49
- package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
- package/dist-lib/components/agents/ChatAttachments.js +144 -0
- package/dist-lib/components/agents/transcript-runs.js +1 -1
- package/dist-lib/components/chrome/AssociationTabs.js +89 -75
- package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
- package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
- package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
- package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
- package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
- package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
- package/dist-lib/components/fields/RefCombobox.js +53 -48
- package/dist-lib/components/fields/index.js +1 -0
- package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
- package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
- package/dist-lib/components/params/ParamsBlock.js +18 -15
- package/dist-lib/components/params/param-editors.js +60 -54
- package/dist-lib/components/primitives/RetryButton.js +14 -0
- package/dist-lib/components/primitives/StatTile.js +42 -34
- package/dist-lib/hooks/useAgentConversation.js +18 -13
- package/dist-lib/hooks/useParams.js +54 -52
- package/dist-lib/hooks/useSchema.js +5 -2
- package/dist-lib/hooks/useTimelineData.js +26 -24
- package/dist-lib/index.d.ts +89 -5
- package/dist-lib/index.js +95 -93
- package/dist-lib/lib/read-display-state.js +19 -0
- package/dist-lib/stores/auth.js +1 -0
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/types/fieldType.js +1 -1
- package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-DODbtSrY.d.ts} +3 -0
- package/package.json +1 -1
|
@@ -1,69 +1,71 @@
|
|
|
1
1
|
import { formatOffsetTimestamp as e } from "../../../lib/timestamp.js";
|
|
2
2
|
import { failureTitle as t } from "../../../lib/failure.js";
|
|
3
3
|
import { useText as n } from "../../../hooks/useText.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { RetryButton as r } from "../../primitives/RetryButton.js";
|
|
5
|
+
import { readDisplayState as i } from "../../../lib/read-display-state.js";
|
|
6
|
+
import { useTabNavigate as a } from "../../../hooks/useTabNavigate.js";
|
|
7
|
+
import { useEntityData as o } from "../../../hooks/useEntityData.js";
|
|
8
|
+
import { useEffect as s, useMemo as c, useState as l } from "react";
|
|
9
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
10
|
//#region src/components/detail-layout/widgets/EntityScorecardWidget.tsx
|
|
9
|
-
function
|
|
11
|
+
function p(e) {
|
|
10
12
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
11
13
|
}
|
|
12
|
-
function
|
|
13
|
-
let t =
|
|
14
|
+
function m(e) {
|
|
15
|
+
let t = p(e);
|
|
14
16
|
if (!t) return;
|
|
15
17
|
let n = Object.entries(t).filter((e) => typeof e[1] == "string");
|
|
16
18
|
return n.length > 0 ? Object.fromEntries(n) : void 0;
|
|
17
19
|
}
|
|
18
|
-
function
|
|
20
|
+
function h(e) {
|
|
19
21
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
20
|
-
let t =
|
|
22
|
+
let t = p(e);
|
|
21
23
|
return !t || typeof t.field != "string" ? [] : [{
|
|
22
24
|
field: t.field,
|
|
23
|
-
label:
|
|
25
|
+
label: m(t.label),
|
|
24
26
|
format: t.format
|
|
25
27
|
}];
|
|
26
28
|
}) : [];
|
|
27
29
|
}
|
|
28
|
-
function
|
|
30
|
+
function g(e) {
|
|
29
31
|
if (!e || typeof e.entity != "string" || typeof e.scope_field != "string" || typeof e.window_field != "string") return;
|
|
30
32
|
let t = Array.isArray(e.windows) ? e.windows.flatMap((e) => {
|
|
31
|
-
let t =
|
|
33
|
+
let t = p(e);
|
|
32
34
|
return t && typeof t.code == "string" ? [{
|
|
33
35
|
code: t.code,
|
|
34
|
-
label:
|
|
36
|
+
label: m(t.label)
|
|
35
37
|
}] : [];
|
|
36
38
|
}) : [], n = Array.isArray(e.metrics) ? e.metrics.flatMap((e) => {
|
|
37
|
-
let t =
|
|
39
|
+
let t = p(e);
|
|
38
40
|
if (!t || typeof t.field != "string") return [];
|
|
39
|
-
let n =
|
|
41
|
+
let n = p(t.filtered);
|
|
40
42
|
return [{
|
|
41
43
|
field: t.field,
|
|
42
|
-
label:
|
|
43
|
-
help:
|
|
44
|
+
label: m(t.label),
|
|
45
|
+
help: m(t.help),
|
|
44
46
|
format: t.format,
|
|
45
47
|
attention: t.attention === !0,
|
|
46
48
|
drillthrough_value: typeof t.drillthrough_value == "string" ? t.drillthrough_value : void 0,
|
|
47
49
|
drillthrough_filter: t.drillthrough_filter !== !1,
|
|
48
50
|
filtered: n && typeof n.field == "string" ? {
|
|
49
51
|
field: n.field,
|
|
50
|
-
where:
|
|
52
|
+
where: p(n.where)
|
|
51
53
|
} : void 0
|
|
52
54
|
}];
|
|
53
55
|
}) : [];
|
|
54
56
|
if (t.length === 0 || n.length === 0) return;
|
|
55
|
-
let r =
|
|
57
|
+
let r = p(e.breakdown), i = r && typeof r.entity == "string" && typeof r.scope_field == "string" && typeof r.window_field == "string" ? {
|
|
56
58
|
entity: r.entity,
|
|
57
59
|
scope_field: r.scope_field,
|
|
58
60
|
window_field: r.window_field,
|
|
59
61
|
filter_field: typeof r.filter_field == "string" ? r.filter_field : void 0,
|
|
60
|
-
filter_label:
|
|
61
|
-
all_label:
|
|
62
|
-
empty_label:
|
|
63
|
-
columns:
|
|
62
|
+
filter_label: m(r.filter_label),
|
|
63
|
+
all_label: m(r.all_label),
|
|
64
|
+
empty_label: m(r.empty_label),
|
|
65
|
+
columns: h(r.columns),
|
|
64
66
|
sort: typeof r.sort == "string" ? r.sort : void 0,
|
|
65
67
|
limit: typeof r.limit == "number" ? Math.min(500, Math.max(1, r.limit)) : 200
|
|
66
|
-
} : void 0, a =
|
|
68
|
+
} : void 0, a = p(e.drillthrough), o = a && typeof a.route == "string" && typeof a.scope_field == "string" && typeof a.window_field == "string" ? {
|
|
67
69
|
route: a.route,
|
|
68
70
|
scope_field: a.scope_field,
|
|
69
71
|
window_field: a.window_field,
|
|
@@ -77,15 +79,15 @@ function m(e) {
|
|
|
77
79
|
windows: t,
|
|
78
80
|
default_window: typeof e.default_window == "string" ? e.default_window : void 0,
|
|
79
81
|
metrics: n,
|
|
80
|
-
title:
|
|
81
|
-
description:
|
|
82
|
-
intended_note:
|
|
83
|
-
empty_label:
|
|
82
|
+
title: m(e.title),
|
|
83
|
+
description: m(e.description),
|
|
84
|
+
intended_note: m(e.intended_note),
|
|
85
|
+
empty_label: m(e.empty_label),
|
|
84
86
|
breakdown: i,
|
|
85
87
|
drillthrough: o
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
|
-
function
|
|
90
|
+
function _(e, t) {
|
|
89
91
|
let n = (e, n) => new Intl.NumberFormat(t, {
|
|
90
92
|
style: "unit",
|
|
91
93
|
unit: e,
|
|
@@ -93,7 +95,7 @@ function h(e, t) {
|
|
|
93
95
|
}).format(n);
|
|
94
96
|
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)));
|
|
95
97
|
}
|
|
96
|
-
function
|
|
98
|
+
function v(t, n, r) {
|
|
97
99
|
let i = t("record.scorecard.not_available", "N/A"), a = t.language;
|
|
98
100
|
if (n == null || n === "") return i;
|
|
99
101
|
if (r === "number") return new Intl.NumberFormat(a).format(Number(n));
|
|
@@ -103,7 +105,7 @@ function g(t, n, r) {
|
|
|
103
105
|
}).format(Number(n));
|
|
104
106
|
if (r === "duration_seconds") {
|
|
105
107
|
let e = Number(n);
|
|
106
|
-
return Number.isFinite(e) ?
|
|
108
|
+
return Number.isFinite(e) ? _(e, a) : i;
|
|
107
109
|
}
|
|
108
110
|
if (r === "timestamp") {
|
|
109
111
|
if (typeof n != "string" && typeof n != "number" && !(n instanceof Date)) return i;
|
|
@@ -112,116 +114,116 @@ function g(t, n, r) {
|
|
|
112
114
|
}
|
|
113
115
|
return typeof n == "string" ? n : typeof n == "number" || typeof n == "bigint" || typeof n == "boolean" ? String(n) : i;
|
|
114
116
|
}
|
|
115
|
-
function
|
|
117
|
+
function y(e, t) {
|
|
116
118
|
return typeof e.id == "string" || typeof e.id == "number" ? String(e.id) : `row-${t}`;
|
|
117
119
|
}
|
|
118
|
-
function
|
|
120
|
+
function b(e, t) {
|
|
119
121
|
return !t || Object.entries(t).every(([t, n]) => e[t] === n);
|
|
120
122
|
}
|
|
121
|
-
function
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
C
|
|
125
|
-
}, [
|
|
126
|
-
|
|
127
|
-
}, [
|
|
128
|
-
let
|
|
129
|
-
field:
|
|
123
|
+
function x({ values: e, options: p }) {
|
|
124
|
+
let m = n(), h = n("errors"), _ = c(() => g(p), [p]), x = a(), S = e.scope, C = _?.windows.some((e) => e.code === _.default_window) ? _.default_window : _?.windows[0]?.code ?? "", [w, T] = l(C), [E, D] = l("");
|
|
125
|
+
s(() => {
|
|
126
|
+
T(C);
|
|
127
|
+
}, [C]), s(() => {
|
|
128
|
+
D("");
|
|
129
|
+
}, [w]);
|
|
130
|
+
let O = _ ? [{
|
|
131
|
+
field: _.scope_field,
|
|
130
132
|
op: "eq",
|
|
131
|
-
value:
|
|
133
|
+
value: S
|
|
132
134
|
}, {
|
|
133
|
-
field:
|
|
135
|
+
field: _.window_field,
|
|
134
136
|
op: "eq",
|
|
135
|
-
value:
|
|
136
|
-
}] : [],
|
|
137
|
+
value: w
|
|
138
|
+
}] : [], k = o(_?.entity, {
|
|
137
139
|
per_page: 1,
|
|
138
|
-
filters:
|
|
139
|
-
}, !!(
|
|
140
|
-
field:
|
|
140
|
+
filters: O
|
|
141
|
+
}, !!(_ && S && w)), A = _?.breakdown, j = A ? [{
|
|
142
|
+
field: A.scope_field,
|
|
141
143
|
op: "eq",
|
|
142
|
-
value:
|
|
144
|
+
value: S
|
|
143
145
|
}, {
|
|
144
|
-
field:
|
|
146
|
+
field: A.window_field,
|
|
145
147
|
op: "eq",
|
|
146
|
-
value:
|
|
147
|
-
}] : [],
|
|
148
|
-
per_page:
|
|
149
|
-
sort:
|
|
150
|
-
filters:
|
|
151
|
-
}, !!(
|
|
152
|
-
if (!
|
|
148
|
+
value: w
|
|
149
|
+
}] : [], M = o(A?.entity, {
|
|
150
|
+
per_page: A?.limit ?? 200,
|
|
151
|
+
sort: A?.sort,
|
|
152
|
+
filters: j
|
|
153
|
+
}, !!(A && S && w));
|
|
154
|
+
if (!_ || !S) return /* @__PURE__ */ d("div", {
|
|
153
155
|
role: "alert",
|
|
154
156
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
155
|
-
children:
|
|
157
|
+
children: h("record.scorecard_config_invalid", "Invalid entity_scorecard configuration.")
|
|
156
158
|
});
|
|
157
|
-
let
|
|
158
|
-
let t =
|
|
159
|
+
let N = k.data?.data?.[0], P = M.data?.data ?? [], F = A?.filter_field ? Array.from(new Set(P.map((e) => e[A.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], I = E && A?.filter_field ? P.filter((e) => e[A.filter_field] === E) : P, L = (e) => !E || !e.filtered || !A?.filter_field ? N?.[e.field] : P.find((t) => t[A.filter_field] === E && b(t, e.filtered?.where))?.[e.filtered.field], R = (e) => {
|
|
160
|
+
let t = _.drillthrough;
|
|
159
161
|
if (!t || !e.drillthrough_value) return;
|
|
160
162
|
let n = [{
|
|
161
163
|
field: t.scope_field,
|
|
162
164
|
op: "eq",
|
|
163
|
-
value:
|
|
165
|
+
value: S
|
|
164
166
|
}, {
|
|
165
167
|
field: t.window_field,
|
|
166
168
|
op: "eq",
|
|
167
|
-
value:
|
|
169
|
+
value: w
|
|
168
170
|
}];
|
|
169
|
-
t.filter_field &&
|
|
171
|
+
t.filter_field && E && e.drillthrough_filter !== !1 && n.push({
|
|
170
172
|
field: t.filter_field,
|
|
171
173
|
op: "eq",
|
|
172
|
-
value:
|
|
174
|
+
value: E
|
|
173
175
|
}), t.metric_field && n.push({
|
|
174
176
|
field: t.metric_field,
|
|
175
177
|
op: "eq",
|
|
176
178
|
value: e.drillthrough_value
|
|
177
|
-
}),
|
|
178
|
-
},
|
|
179
|
-
return /* @__PURE__ */
|
|
179
|
+
}), x(t.route, { search: new URLSearchParams({ filters: JSON.stringify(n) }).toString() });
|
|
180
|
+
}, z = i(k), B = i(M), V = z.error === null ? B.error === null ? null : B : z, H = V?.error, U = m(A?.filter_label) || m("record.scorecard.filter", "Filter");
|
|
181
|
+
return /* @__PURE__ */ f("div", {
|
|
180
182
|
className: "flex min-w-0 flex-col gap-4",
|
|
181
|
-
"aria-label":
|
|
183
|
+
"aria-label": m(_.title) || m("record.scorecard.title", "Scorecard"),
|
|
182
184
|
children: [
|
|
183
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ f("div", {
|
|
184
186
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
185
|
-
children: [/* @__PURE__ */
|
|
187
|
+
children: [/* @__PURE__ */ f("div", {
|
|
186
188
|
className: "min-w-0",
|
|
187
189
|
children: [
|
|
188
|
-
|
|
190
|
+
_.title && /* @__PURE__ */ d("h3", {
|
|
189
191
|
className: "text-base font-semibold text-foreground",
|
|
190
|
-
children:
|
|
192
|
+
children: m(_.title)
|
|
191
193
|
}),
|
|
192
|
-
|
|
194
|
+
_.description && /* @__PURE__ */ d("p", {
|
|
193
195
|
className: "mt-1 text-sm text-muted-foreground",
|
|
194
|
-
children:
|
|
196
|
+
children: m(_.description)
|
|
195
197
|
}),
|
|
196
|
-
|
|
198
|
+
_.intended_note && /* @__PURE__ */ d("p", {
|
|
197
199
|
className: "mt-1 text-xs text-muted-foreground",
|
|
198
|
-
children:
|
|
200
|
+
children: m(_.intended_note)
|
|
199
201
|
})
|
|
200
202
|
]
|
|
201
|
-
}), /* @__PURE__ */
|
|
203
|
+
}), /* @__PURE__ */ f("div", {
|
|
202
204
|
className: "flex flex-wrap items-center gap-2",
|
|
203
|
-
children: [/* @__PURE__ */
|
|
205
|
+
children: [/* @__PURE__ */ d("div", {
|
|
204
206
|
role: "group",
|
|
205
|
-
"aria-label":
|
|
207
|
+
"aria-label": m("record.scorecard.window", "Scorecard window"),
|
|
206
208
|
className: "inline-flex rounded border border-border p-1",
|
|
207
|
-
children:
|
|
209
|
+
children: _.windows.map((e) => /* @__PURE__ */ d("button", {
|
|
208
210
|
type: "button",
|
|
209
|
-
"aria-pressed":
|
|
210
|
-
onClick: () =>
|
|
211
|
-
className: `rounded px-3 py-1.5 text-xs font-medium ${
|
|
212
|
-
children:
|
|
211
|
+
"aria-pressed": w === e.code,
|
|
212
|
+
onClick: () => T(e.code),
|
|
213
|
+
className: `rounded px-3 py-1.5 text-xs font-medium ${w === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
|
|
214
|
+
children: m(e.label) || e.code
|
|
213
215
|
}, e.code))
|
|
214
|
-
}),
|
|
216
|
+
}), A?.filter_field && /* @__PURE__ */ f("label", {
|
|
215
217
|
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
216
|
-
children: [
|
|
217
|
-
"aria-label":
|
|
218
|
-
value:
|
|
219
|
-
onChange: (e) =>
|
|
218
|
+
children: [U, /* @__PURE__ */ f("select", {
|
|
219
|
+
"aria-label": U,
|
|
220
|
+
value: E,
|
|
221
|
+
onChange: (e) => D(e.target.value),
|
|
220
222
|
className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
|
|
221
|
-
children: [/* @__PURE__ */
|
|
223
|
+
children: [/* @__PURE__ */ d("option", {
|
|
222
224
|
value: "",
|
|
223
|
-
children:
|
|
224
|
-
}),
|
|
225
|
+
children: m(A.all_label) || m("record.scorecard.all", "All")
|
|
226
|
+
}), F.map((e) => /* @__PURE__ */ d("option", {
|
|
225
227
|
value: e,
|
|
226
228
|
children: e
|
|
227
229
|
}, e))]
|
|
@@ -229,63 +231,67 @@ function y({ values: e, options: d }) {
|
|
|
229
231
|
})]
|
|
230
232
|
})]
|
|
231
233
|
}),
|
|
232
|
-
|
|
234
|
+
V && /* @__PURE__ */ f("div", {
|
|
233
235
|
role: "alert",
|
|
234
236
|
className: "rounded border border-destructive p-3 text-sm text-destructive",
|
|
235
|
-
children:
|
|
237
|
+
children: [
|
|
238
|
+
t(h, H),
|
|
239
|
+
" ",
|
|
240
|
+
/* @__PURE__ */ d(r, { onRetry: V.retry })
|
|
241
|
+
]
|
|
236
242
|
}),
|
|
237
|
-
!
|
|
243
|
+
!V && !z.loading && !N && /* @__PURE__ */ d("div", {
|
|
238
244
|
className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
|
|
239
|
-
children:
|
|
245
|
+
children: m(_.empty_label) || m("record.scorecard.empty", "No scorecard data.")
|
|
240
246
|
}),
|
|
241
|
-
|
|
247
|
+
N && /* @__PURE__ */ d("div", {
|
|
242
248
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
243
|
-
children:
|
|
244
|
-
let t =
|
|
245
|
-
/* @__PURE__ */
|
|
249
|
+
children: _.metrics.map((e) => {
|
|
250
|
+
let t = L(e), n = !!(_.drillthrough && e.drillthrough_value), r = /* @__PURE__ */ f(u, { children: [
|
|
251
|
+
/* @__PURE__ */ d("span", {
|
|
246
252
|
className: "text-xs font-medium text-muted-foreground",
|
|
247
|
-
children:
|
|
253
|
+
children: m(e.label) || e.field
|
|
248
254
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ d("strong", {
|
|
250
256
|
className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
|
|
251
|
-
children:
|
|
257
|
+
children: v(m, t, e.format)
|
|
252
258
|
}),
|
|
253
|
-
e.help && /* @__PURE__ */
|
|
259
|
+
e.help && /* @__PURE__ */ d("span", {
|
|
254
260
|
className: "mt-1 block text-xs text-muted-foreground",
|
|
255
|
-
children:
|
|
261
|
+
children: m(e.help)
|
|
256
262
|
})
|
|
257
263
|
] });
|
|
258
|
-
return n ? /* @__PURE__ */
|
|
264
|
+
return n ? /* @__PURE__ */ d("button", {
|
|
259
265
|
type: "button",
|
|
260
|
-
onClick: () =>
|
|
266
|
+
onClick: () => R(e),
|
|
261
267
|
className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
|
|
262
268
|
children: r
|
|
263
|
-
}, e.field) : /* @__PURE__ */
|
|
269
|
+
}, e.field) : /* @__PURE__ */ d("article", {
|
|
264
270
|
className: "rounded border border-border bg-card p-3",
|
|
265
271
|
children: r
|
|
266
272
|
}, e.field);
|
|
267
273
|
})
|
|
268
274
|
}),
|
|
269
|
-
|
|
275
|
+
A && /* @__PURE__ */ d("div", {
|
|
270
276
|
className: "min-w-0 overflow-x-auto rounded border border-border",
|
|
271
|
-
children: /* @__PURE__ */
|
|
277
|
+
children: /* @__PURE__ */ f("table", {
|
|
272
278
|
className: "w-full border-collapse text-sm",
|
|
273
|
-
children: [/* @__PURE__ */
|
|
279
|
+
children: [/* @__PURE__ */ d("thead", {
|
|
274
280
|
className: "bg-surface text-left text-xs text-muted-foreground",
|
|
275
|
-
children: /* @__PURE__ */
|
|
281
|
+
children: /* @__PURE__ */ d("tr", { children: A.columns.map((e) => /* @__PURE__ */ d("th", {
|
|
276
282
|
className: "border-b border-divider px-3 py-2 font-medium",
|
|
277
|
-
children:
|
|
283
|
+
children: m(e.label) || e.field
|
|
278
284
|
}, e.field)) })
|
|
279
|
-
}), /* @__PURE__ */
|
|
285
|
+
}), /* @__PURE__ */ f("tbody", { children: [I.map((e, t) => /* @__PURE__ */ d("tr", {
|
|
280
286
|
className: "border-b border-divider last:border-0",
|
|
281
|
-
children:
|
|
287
|
+
children: A.columns.map((t) => /* @__PURE__ */ d("td", {
|
|
282
288
|
className: "px-3 py-2 text-foreground",
|
|
283
|
-
children:
|
|
289
|
+
children: v(m, e[t.field], t.format)
|
|
284
290
|
}, t.field))
|
|
285
|
-
},
|
|
286
|
-
colSpan: Math.max(1,
|
|
291
|
+
}, y(e, t))), !B.loading && I.length === 0 && /* @__PURE__ */ d("tr", { children: /* @__PURE__ */ d("td", {
|
|
292
|
+
colSpan: Math.max(1, A.columns.length),
|
|
287
293
|
className: "px-3 py-6 text-center text-muted-foreground",
|
|
288
|
-
children:
|
|
294
|
+
children: m(A.empty_label) || m("record.scorecard.breakdown_empty", "No breakdown rows.")
|
|
289
295
|
}) })] })]
|
|
290
296
|
})
|
|
291
297
|
})
|
|
@@ -293,4 +299,4 @@ function y({ values: e, options: d }) {
|
|
|
293
299
|
});
|
|
294
300
|
}
|
|
295
301
|
//#endregion
|
|
296
|
-
export {
|
|
302
|
+
export { x as EntityScorecardWidget };
|
|
@@ -1,75 +1,77 @@
|
|
|
1
1
|
import { coerceDisplayString as e } from "../../lib/display-value.js";
|
|
2
2
|
import { getPrimaryKeyFields as t, resolveRefRecordLabel as n } from "../../types/schema.js";
|
|
3
3
|
import { useText as r } from "../../hooks/useText.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import { RetryButton as i } from "../primitives/RetryButton.js";
|
|
5
|
+
import { Select as a } from "../primitives/Fields.js";
|
|
6
|
+
import { readDisplayState as ee } from "../../lib/read-display-state.js";
|
|
7
|
+
import { useEntityData as o } from "../../hooks/useEntityData.js";
|
|
8
|
+
import { useEntity as s } from "../../hooks/useEntity.js";
|
|
9
|
+
import { readableFilters as c, readableSort as l } from "../../lib/field-classification.js";
|
|
10
|
+
import { useDebounce as u } from "../../hooks/useDebounce.js";
|
|
11
|
+
import { refChoicesEntity as te } from "../../lib/ref-choices.js";
|
|
10
12
|
import { useMemo as d, useRef as f, useState as p } from "react";
|
|
11
|
-
import { jsx as m } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
14
|
//#region src/components/fields/RefCombobox.tsx
|
|
13
|
-
var
|
|
14
|
-
function
|
|
15
|
-
let D = r(), O = r("errors"), k =
|
|
16
|
-
per_page:
|
|
17
|
-
sort:
|
|
15
|
+
var g = 200;
|
|
16
|
+
function _({ ref: _, value: v, onChange: y, refs: b, displayFieldOverride: ne, id: x, labelId: S, ariaLabel: C, required: w, placeholder: T, specialValues: E }) {
|
|
17
|
+
let D = r(), O = r("errors"), k = _?.entity, A = te(k), j = s(A), M = ne ?? _?.display?.field ?? (j?.display?.display_template ? "$display" : j?.display?.display_field) ?? "$display", N = M === "$display" ? j?.display?.display_field : M, P = d(() => j ? t(j)[0] ?? "id" : "id", [j]), F = _?.field || P, [I, L] = p(""), R = u(I, 300), z = o(A, {
|
|
18
|
+
per_page: g,
|
|
19
|
+
sort: l(j, N ? `${N}:asc` : void 0),
|
|
18
20
|
search: R || void 0,
|
|
19
|
-
filters:
|
|
20
|
-
}), H = d(() =>
|
|
21
|
-
|
|
21
|
+
filters: _?.options_filter && c(j, _.options_filter)
|
|
22
|
+
}), B = z.data, V = ee(z), H = V.loading, U = V.error !== null, W = d(() => B?.data ?? [], [B?.data]), G = U ? O("record.ref_choices_unreadable", "The choices could not be loaded.") : T ?? D("field.select_placeholder", "Select…"), K = v == null ? "" : e(v), q = d(() => W.some((e) => String(e[F]) === K), [
|
|
23
|
+
W,
|
|
22
24
|
F,
|
|
23
|
-
|
|
24
|
-
]),
|
|
25
|
+
K
|
|
26
|
+
]), J = b && k ? b[k]?.[K] : void 0, Y = !!E?.some((e) => e.code === K), { data: X } = o(K && !q && !Y && !J && !H ? A : void 0, {
|
|
25
27
|
per_page: 1,
|
|
26
28
|
filters: [{
|
|
27
29
|
field: F,
|
|
28
30
|
op: "eq",
|
|
29
|
-
value:
|
|
31
|
+
value: K
|
|
30
32
|
}]
|
|
31
|
-
}),
|
|
32
|
-
if (!
|
|
33
|
+
}), Z = f(null), Q = d(() => {
|
|
34
|
+
if (!K) return "";
|
|
33
35
|
let e;
|
|
34
|
-
if (
|
|
36
|
+
if (J) e = n(D, J, M, K);
|
|
35
37
|
else {
|
|
36
|
-
let t =
|
|
37
|
-
if (t) e = n(D, t, M,
|
|
38
|
+
let t = W.find((e) => String(e[F]) === K);
|
|
39
|
+
if (t) e = n(D, t, M, K);
|
|
38
40
|
else {
|
|
39
|
-
let t =
|
|
40
|
-
t && (e = n(D, t, M,
|
|
41
|
+
let t = X?.data?.find((e) => String(e[F]) === K);
|
|
42
|
+
t && (e = n(D, t, M, K));
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
|
-
return e === void 0 ?
|
|
44
|
-
value:
|
|
45
|
+
return e === void 0 ? Z.current?.value === K ? Z.current.label : K : (Z.current = {
|
|
46
|
+
value: K,
|
|
45
47
|
label: e
|
|
46
48
|
}, e);
|
|
47
49
|
}, [
|
|
48
50
|
D,
|
|
49
|
-
W,
|
|
50
51
|
K,
|
|
51
|
-
|
|
52
|
+
J,
|
|
53
|
+
W,
|
|
52
54
|
F,
|
|
53
55
|
M,
|
|
54
|
-
|
|
55
|
-
]),
|
|
56
|
+
X
|
|
57
|
+
]), re = d(() => {
|
|
56
58
|
let t = (E ?? []).map((e) => ({
|
|
57
59
|
value: e.code,
|
|
58
60
|
label: D(e.label) || e.code
|
|
59
|
-
})), r =
|
|
61
|
+
})), r = W.map((t) => {
|
|
60
62
|
let r = e(t[F]);
|
|
61
63
|
return {
|
|
62
64
|
value: r,
|
|
63
65
|
label: n(D, t, M, r)
|
|
64
66
|
};
|
|
65
|
-
}), i =
|
|
66
|
-
value:
|
|
67
|
-
label:
|
|
67
|
+
}), i = K && !q && !Y ? [{
|
|
68
|
+
value: K,
|
|
69
|
+
label: Q
|
|
68
70
|
}] : [], a = r.length > 0 || i.length > 0;
|
|
69
71
|
return [
|
|
70
72
|
{
|
|
71
73
|
value: "",
|
|
72
|
-
label:
|
|
74
|
+
label: G
|
|
73
75
|
},
|
|
74
76
|
...t.length > 0 ? [{
|
|
75
77
|
value: "",
|
|
@@ -86,27 +88,30 @@ function g({ ref: g, value: _, onChange: v, refs: y, displayFieldOverride: b, id
|
|
|
86
88
|
];
|
|
87
89
|
}, [
|
|
88
90
|
D,
|
|
89
|
-
U,
|
|
90
|
-
E,
|
|
91
|
-
W,
|
|
92
91
|
G,
|
|
92
|
+
E,
|
|
93
|
+
K,
|
|
93
94
|
q,
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
Y,
|
|
96
|
+
Q,
|
|
97
|
+
W,
|
|
96
98
|
F,
|
|
97
99
|
M
|
|
98
|
-
])
|
|
99
|
-
return /* @__PURE__ */ m(i, {
|
|
100
|
+
]), $ = /* @__PURE__ */ m(a, {
|
|
100
101
|
id: x,
|
|
101
102
|
"aria-label": C,
|
|
102
103
|
"aria-labelledby": S,
|
|
103
104
|
"aria-required": w || void 0,
|
|
104
|
-
value:
|
|
105
|
-
options:
|
|
106
|
-
onChange: (e) =>
|
|
105
|
+
value: K,
|
|
106
|
+
options: re,
|
|
107
|
+
onChange: (e) => y(e || null),
|
|
107
108
|
onSearchChange: L,
|
|
108
|
-
placeholder:
|
|
109
|
+
placeholder: G
|
|
109
110
|
});
|
|
111
|
+
return U ? /* @__PURE__ */ h("span", {
|
|
112
|
+
className: "inline-flex items-center gap-2",
|
|
113
|
+
children: [$, /* @__PURE__ */ m(i, { onRetry: V.retry })]
|
|
114
|
+
}) : $;
|
|
110
115
|
}
|
|
111
116
|
//#endregion
|
|
112
|
-
export {
|
|
117
|
+
export { _ as RefCombobox };
|