@declarion/react 0.104.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
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Icon as e } from "../primitives/Icons.js";
|
|
2
|
+
import { IconBtn as t } from "../primitives/IconBtn.js";
|
|
3
|
+
import { useText as n } from "../../hooks/useText.js";
|
|
4
|
+
import { formatBytes as r } from "../file-widgets/upload.js";
|
|
5
|
+
import { UploadFailureText as i } from "../file-widgets/UploadFailureText.js";
|
|
6
|
+
import { downloadFileURL as a } from "../file-widgets/helpers.js";
|
|
7
|
+
import { useEmbedFileOpener as o } from "../file-widgets/useEmbedFileSrc.js";
|
|
8
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/agents/ChatAttachments.tsx
|
|
10
|
+
var l = {
|
|
11
|
+
display: "flex",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
gap: 6,
|
|
14
|
+
padding: "4px 6px 4px 8px",
|
|
15
|
+
fontSize: 11.5,
|
|
16
|
+
background: "var(--surface)",
|
|
17
|
+
border: "1px solid var(--border)",
|
|
18
|
+
borderRadius: "var(--radius-md)",
|
|
19
|
+
color: "var(--text)",
|
|
20
|
+
maxWidth: "100%"
|
|
21
|
+
};
|
|
22
|
+
function u({ selections: r, onCancel: i, onRemove: a }) {
|
|
23
|
+
let o = n();
|
|
24
|
+
return r.length === 0 ? null : /* @__PURE__ */ s("ul", {
|
|
25
|
+
"aria-label": o("agent.panel.selected_files", "Selected files"),
|
|
26
|
+
style: {
|
|
27
|
+
listStyle: "none",
|
|
28
|
+
margin: 0,
|
|
29
|
+
padding: "0 0 6px",
|
|
30
|
+
display: "flex",
|
|
31
|
+
flexDirection: "column",
|
|
32
|
+
gap: 4
|
|
33
|
+
},
|
|
34
|
+
children: r.map((n) => /* @__PURE__ */ c("li", {
|
|
35
|
+
"data-selection-state": n.state,
|
|
36
|
+
style: {
|
|
37
|
+
...l,
|
|
38
|
+
borderColor: n.state === "failed" ? "var(--destructive)" : "var(--border)"
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ s(e.paperclip, { size: 11 }),
|
|
42
|
+
/* @__PURE__ */ s("span", {
|
|
43
|
+
style: {
|
|
44
|
+
flex: 1,
|
|
45
|
+
minWidth: 0,
|
|
46
|
+
overflow: "hidden",
|
|
47
|
+
textOverflow: "ellipsis",
|
|
48
|
+
whiteSpace: "nowrap"
|
|
49
|
+
},
|
|
50
|
+
title: n.filename,
|
|
51
|
+
children: n.filename
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ s(d, { selection: n }),
|
|
54
|
+
n.state === "uploading" ? /* @__PURE__ */ s(t, {
|
|
55
|
+
size: 20,
|
|
56
|
+
icon: /* @__PURE__ */ s(e.x, { size: 11 }),
|
|
57
|
+
onClick: () => i(n.localId),
|
|
58
|
+
title: o("file.upload.cancel", "Cancel")
|
|
59
|
+
}) : /* @__PURE__ */ s(t, {
|
|
60
|
+
size: 20,
|
|
61
|
+
icon: /* @__PURE__ */ s(e.x, { size: 11 }),
|
|
62
|
+
onClick: () => a(n.localId),
|
|
63
|
+
title: o("file.remove", "Remove")
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
}, n.localId))
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function d({ selection: e }) {
|
|
70
|
+
let t = n();
|
|
71
|
+
switch (e.state) {
|
|
72
|
+
case "uploading": {
|
|
73
|
+
let n = e.progress?.pct ?? 0;
|
|
74
|
+
return /* @__PURE__ */ s("span", {
|
|
75
|
+
role: "progressbar",
|
|
76
|
+
"aria-valuenow": n,
|
|
77
|
+
"aria-valuemin": 0,
|
|
78
|
+
"aria-valuemax": 100,
|
|
79
|
+
style: { color: "var(--text-3)" },
|
|
80
|
+
children: t("file.upload.progress", "Uploading {pct}%", { pct: n })
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
case "failed": return /* @__PURE__ */ s("span", {
|
|
84
|
+
role: "alert",
|
|
85
|
+
style: { color: "var(--destructive)" },
|
|
86
|
+
children: e.failure ? /* @__PURE__ */ s(i, { failure: e.failure }) : t("file.selection.failed", "Failed")
|
|
87
|
+
});
|
|
88
|
+
case "cancelled": return /* @__PURE__ */ s("span", {
|
|
89
|
+
style: { color: "var(--text-3)" },
|
|
90
|
+
children: t("file.selection.cancelled", "Cancelled")
|
|
91
|
+
});
|
|
92
|
+
case "ready": return /* @__PURE__ */ s("span", {
|
|
93
|
+
style: { color: "var(--text-3)" },
|
|
94
|
+
children: r(e.sizeBytes)
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function f(e, t) {
|
|
99
|
+
return e.role !== "assistant" || t.some((t) => t.id === e.turn_id && t.status === "completed");
|
|
100
|
+
}
|
|
101
|
+
function p({ files: i, align: u }) {
|
|
102
|
+
let d = n(), { open: f } = o();
|
|
103
|
+
return !i || i.length === 0 ? null : /* @__PURE__ */ s("ul", {
|
|
104
|
+
"aria-label": d("agent.panel.message_files", "Files"),
|
|
105
|
+
style: {
|
|
106
|
+
listStyle: "none",
|
|
107
|
+
margin: "4px 0 0",
|
|
108
|
+
padding: 0,
|
|
109
|
+
display: "flex",
|
|
110
|
+
flexDirection: "column",
|
|
111
|
+
gap: 4,
|
|
112
|
+
alignItems: u === "end" ? "flex-end" : "flex-start"
|
|
113
|
+
},
|
|
114
|
+
children: i.map((n, i) => /* @__PURE__ */ c("li", {
|
|
115
|
+
"data-file-id": n.id,
|
|
116
|
+
style: l,
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ s(e.paperclip, { size: 11 }),
|
|
119
|
+
/* @__PURE__ */ s("span", {
|
|
120
|
+
style: {
|
|
121
|
+
minWidth: 0,
|
|
122
|
+
overflow: "hidden",
|
|
123
|
+
textOverflow: "ellipsis",
|
|
124
|
+
whiteSpace: "nowrap"
|
|
125
|
+
},
|
|
126
|
+
title: n.filename,
|
|
127
|
+
children: n.filename
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ s("span", {
|
|
130
|
+
style: { color: "var(--text-3)" },
|
|
131
|
+
children: r(n.size_bytes)
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ s(t, {
|
|
134
|
+
size: 20,
|
|
135
|
+
icon: /* @__PURE__ */ s(e.download, { size: 11 }),
|
|
136
|
+
onClick: () => f(n.id, "download", a(n)),
|
|
137
|
+
title: d("file.download", "Download")
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
}, `${i}:${n.id}`))
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { u as ComposerAttachments, p as MessageAttachments, f as replyFilesVisible };
|
|
@@ -4,21 +4,23 @@ import { Icon as r } from "../primitives/Icons.js";
|
|
|
4
4
|
import { Btn as i } from "../primitives/Btn.js";
|
|
5
5
|
import { useText as a } from "../../hooks/useText.js";
|
|
6
6
|
import { SectionCard as o } from "../primitives/SectionCard.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
7
|
+
import { RetryButton as s } from "../primitives/RetryButton.js";
|
|
8
|
+
import { readDisplayState as c } from "../../lib/read-display-state.js";
|
|
9
|
+
import { DynamicIcon as l } from "../shared/DynamicIcon.js";
|
|
10
|
+
import { useTabNavigate as u } from "../../hooks/useTabNavigate.js";
|
|
11
|
+
import { findListScreenForEntity as d } from "../../lib/actions.js";
|
|
12
|
+
import { renderField as f } from "../fields/index.js";
|
|
13
|
+
import { dataTableCellStyle as p, dataTableHeadCellStyle as m, dataTableStyle as h } from "../primitives/dataTableStyles.js";
|
|
14
|
+
import { useMemo as g, useState as _ } from "react";
|
|
15
|
+
import { useQuery as v } from "@tanstack/react-query";
|
|
16
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
15
17
|
//#region src/components/chrome/AssociationTabs.tsx
|
|
16
|
-
function
|
|
17
|
-
let i = a(),
|
|
18
|
-
if (
|
|
19
|
-
let [d, f] = c
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
title: /* @__PURE__ */
|
|
18
|
+
function x({ entityCode: e, recordId: t, associations: n, schema: r }) {
|
|
19
|
+
let i = a(), s = g(() => Object.entries(n).filter(([, e]) => !!r.entities[e.target]), [n, r.entities]), [c, u] = _(0);
|
|
20
|
+
if (s.length === 0) return null;
|
|
21
|
+
let [d, f] = s[c];
|
|
22
|
+
return /* @__PURE__ */ y(o, {
|
|
23
|
+
title: /* @__PURE__ */ y("div", {
|
|
22
24
|
style: {
|
|
23
25
|
display: "flex",
|
|
24
26
|
alignItems: "center",
|
|
@@ -27,9 +29,9 @@ function y({ entityCode: e, recordId: t, associations: n, schema: r }) {
|
|
|
27
29
|
margin: "-10px -14px 0 -14px",
|
|
28
30
|
padding: "0 14px"
|
|
29
31
|
},
|
|
30
|
-
children:
|
|
31
|
-
let r = n ===
|
|
32
|
-
return /* @__PURE__ */
|
|
32
|
+
children: s.map(([e, t], n) => {
|
|
33
|
+
let r = n === c;
|
|
34
|
+
return /* @__PURE__ */ b("button", {
|
|
33
35
|
onClick: (e) => {
|
|
34
36
|
e.stopPropagation(), u(n);
|
|
35
37
|
},
|
|
@@ -47,7 +49,7 @@ function y({ entityCode: e, recordId: t, associations: n, schema: r }) {
|
|
|
47
49
|
cursor: "pointer",
|
|
48
50
|
fontWeight: r ? 600 : 500
|
|
49
51
|
},
|
|
50
|
-
children: [t.display?.icon && /* @__PURE__ */
|
|
52
|
+
children: [t.display?.icon && /* @__PURE__ */ y(l, {
|
|
51
53
|
name: t.display.icon,
|
|
52
54
|
size: 13
|
|
53
55
|
}), i(t.display?.name) || e]
|
|
@@ -56,7 +58,7 @@ function y({ entityCode: e, recordId: t, associations: n, schema: r }) {
|
|
|
56
58
|
}),
|
|
57
59
|
collapsible: !1,
|
|
58
60
|
padding: "0",
|
|
59
|
-
children: /* @__PURE__ */
|
|
61
|
+
children: /* @__PURE__ */ y(S, {
|
|
60
62
|
entityCode: e,
|
|
61
63
|
recordId: t,
|
|
62
64
|
assocKey: d,
|
|
@@ -65,109 +67,121 @@ function y({ entityCode: e, recordId: t, associations: n, schema: r }) {
|
|
|
65
67
|
})
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
|
-
function
|
|
69
|
-
let
|
|
70
|
+
function S({ entityCode: o, recordId: l, assocKey: _, association: x, schema: S }) {
|
|
71
|
+
let C = a(), w = a("errors"), T = u(), E = `${o}.${_}`, D = v({
|
|
70
72
|
queryKey: [
|
|
71
73
|
"association",
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
E,
|
|
75
|
+
l
|
|
74
76
|
],
|
|
75
|
-
queryFn: () => n(
|
|
76
|
-
}),
|
|
77
|
+
queryFn: () => n(E, [l])
|
|
78
|
+
}), O = D.data, k = c(D), A = O?.target_entity ?? x.target, j = S.entities[A], M = g(() => O?.ids ?? [], [O?.ids]), N = g(() => j?.fields.names().find((e) => j.fields.get(e)?.primary) ?? "id", [j]), P = g(() => M.slice(0, 50), [M]), F = v({
|
|
77
79
|
queryKey: [
|
|
78
80
|
"association-records",
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
A,
|
|
82
|
+
P
|
|
81
83
|
],
|
|
82
|
-
queryFn: () => t(
|
|
84
|
+
queryFn: () => t(A, {
|
|
83
85
|
per_page: 50,
|
|
84
86
|
filters: [{
|
|
85
|
-
field:
|
|
87
|
+
field: N,
|
|
86
88
|
op: "in",
|
|
87
|
-
value:
|
|
89
|
+
value: P
|
|
88
90
|
}]
|
|
89
91
|
}),
|
|
90
|
-
enabled:
|
|
91
|
-
}),
|
|
92
|
-
let t =
|
|
92
|
+
enabled: P.length > 0 && !!j
|
|
93
|
+
}), I = F.data, L = c(F), R = I?.data ?? [], z = I?.$refs, B = g(() => j ? j.fields.names().filter((e) => {
|
|
94
|
+
let t = j.fields.get(e);
|
|
93
95
|
return t && !t.primary && !t.auto && t.display?.is_listable !== !1;
|
|
94
|
-
}).slice(0, 6) : [], [
|
|
95
|
-
let e =
|
|
96
|
+
}).slice(0, 6) : [], [j]), V = () => {
|
|
97
|
+
let e = d(S, A);
|
|
96
98
|
if (!e) return;
|
|
97
|
-
let t = x
|
|
99
|
+
let t = C(x.display?.name) || _, n = new URLSearchParams();
|
|
98
100
|
n.set("filters", JSON.stringify([{
|
|
99
|
-
field:
|
|
101
|
+
field: N,
|
|
100
102
|
op: "in",
|
|
101
|
-
value:
|
|
102
|
-
}])),
|
|
103
|
+
value: M
|
|
104
|
+
}])), T(e.route, {
|
|
103
105
|
title: t,
|
|
104
|
-
icon:
|
|
106
|
+
icon: x.display?.icon || e.icon,
|
|
105
107
|
search: n.toString()
|
|
106
108
|
});
|
|
107
|
-
},
|
|
109
|
+
}, H = {
|
|
108
110
|
fontSize: 12.5,
|
|
109
111
|
color: "var(--text-3)",
|
|
110
112
|
padding: "14px 16px"
|
|
111
|
-
};
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
}, U = k.error === null ? L.error === null ? null : L : k;
|
|
114
|
+
if (U) return /* @__PURE__ */ b("div", {
|
|
115
|
+
role: "alert",
|
|
116
|
+
style: {
|
|
117
|
+
...H,
|
|
118
|
+
color: "var(--danger)"
|
|
119
|
+
},
|
|
120
|
+
children: [
|
|
121
|
+
w("record.related_rows_unreadable", "The related records could not be loaded."),
|
|
122
|
+
" ",
|
|
123
|
+
/* @__PURE__ */ y(s, { onRetry: U.retry })
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
if (k.loading || L.loading) return /* @__PURE__ */ y("div", {
|
|
127
|
+
style: H,
|
|
128
|
+
children: C("shell.loading", "Loading…")
|
|
115
129
|
});
|
|
116
|
-
if (!
|
|
117
|
-
if (
|
|
118
|
-
style:
|
|
119
|
-
children:
|
|
130
|
+
if (!j) return null;
|
|
131
|
+
if (M.length === 0) return /* @__PURE__ */ y("div", {
|
|
132
|
+
style: H,
|
|
133
|
+
children: C("shell.association.empty", "No related records.")
|
|
120
134
|
});
|
|
121
|
-
let
|
|
122
|
-
return /* @__PURE__ */
|
|
135
|
+
let W = d(S, A);
|
|
136
|
+
return /* @__PURE__ */ b("div", {
|
|
123
137
|
style: { padding: "8px 0" },
|
|
124
138
|
children: [
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
style:
|
|
127
|
-
children: [/* @__PURE__ */
|
|
128
|
-
style:
|
|
129
|
-
children: e(
|
|
130
|
-
}, t)) }) }), /* @__PURE__ */
|
|
131
|
-
let n =
|
|
132
|
-
return n ? /* @__PURE__ */
|
|
133
|
-
style:
|
|
134
|
-
children:
|
|
139
|
+
/* @__PURE__ */ b("table", {
|
|
140
|
+
style: h,
|
|
141
|
+
children: [/* @__PURE__ */ y("thead", { children: /* @__PURE__ */ y("tr", { children: B.map((t) => /* @__PURE__ */ y("th", {
|
|
142
|
+
style: m,
|
|
143
|
+
children: e(C, j.fields.get(t), t, S.entities)
|
|
144
|
+
}, t)) }) }), /* @__PURE__ */ y("tbody", { children: R.map((e, t) => /* @__PURE__ */ y("tr", { children: B.map((t) => {
|
|
145
|
+
let n = j.fields.get(t);
|
|
146
|
+
return n ? /* @__PURE__ */ y("td", {
|
|
147
|
+
style: p,
|
|
148
|
+
children: f({
|
|
135
149
|
field: n,
|
|
136
150
|
fieldName: t,
|
|
137
151
|
value: e[t],
|
|
138
152
|
mode: "display",
|
|
139
153
|
record: e,
|
|
140
|
-
refs:
|
|
141
|
-
t:
|
|
154
|
+
refs: z,
|
|
155
|
+
t: C
|
|
142
156
|
})
|
|
143
|
-
}, t) : /* @__PURE__ */
|
|
157
|
+
}, t) : /* @__PURE__ */ y("td", {}, t);
|
|
144
158
|
}) }, t)) })]
|
|
145
159
|
}),
|
|
146
|
-
|
|
160
|
+
W && O && O.count > R.length && /* @__PURE__ */ y("div", {
|
|
147
161
|
style: {
|
|
148
162
|
padding: "10px 16px",
|
|
149
163
|
textAlign: "center"
|
|
150
164
|
},
|
|
151
|
-
children: /* @__PURE__ */
|
|
152
|
-
icon: /* @__PURE__ */
|
|
153
|
-
onClick:
|
|
154
|
-
children:
|
|
165
|
+
children: /* @__PURE__ */ y(i, {
|
|
166
|
+
icon: /* @__PURE__ */ y(r.external, { size: 12 }),
|
|
167
|
+
onClick: V,
|
|
168
|
+
children: C("shell.association.view_all", "View all {count} records", { count: O.count })
|
|
155
169
|
})
|
|
156
170
|
}),
|
|
157
|
-
|
|
171
|
+
W && R.length > 0 && O && O.count <= R.length && /* @__PURE__ */ y("div", {
|
|
158
172
|
style: {
|
|
159
173
|
padding: "10px 16px",
|
|
160
174
|
textAlign: "center"
|
|
161
175
|
},
|
|
162
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ y(i, {
|
|
163
177
|
kind: "ghost",
|
|
164
|
-
icon: /* @__PURE__ */
|
|
165
|
-
onClick:
|
|
166
|
-
children:
|
|
178
|
+
icon: /* @__PURE__ */ y(r.external, { size: 12 }),
|
|
179
|
+
onClick: V,
|
|
180
|
+
children: C("shell.association.open_list", "Open in list view")
|
|
167
181
|
})
|
|
168
182
|
})
|
|
169
183
|
]
|
|
170
184
|
});
|
|
171
185
|
}
|
|
172
186
|
//#endregion
|
|
173
|
-
export {
|
|
187
|
+
export { x as AssociationTabs };
|