@declarion/react 0.446.0 → 0.517.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/components/agents/AgentChatPanel.impl.js +349 -332
- package/dist-lib/components/detail-layout/DetailAuditStrip.js +1 -1
- package/dist-lib/components/detail-layout/EvidenceBlock.js +36 -24
- package/dist-lib/components/detail-layout/FieldRow.js +56 -60
- package/dist-lib/components/detail-layout/FieldsBlock.js +48 -47
- package/dist-lib/components/detail-layout/PropertiesBlock.js +42 -41
- package/dist-lib/components/detail-layout/labelLayout.js +35 -0
- package/dist-lib/components/fields/JsonField.js +128 -125
- package/dist-lib/components/fields/StringField.js +10 -25
- package/dist-lib/components/fields/StructureField.js +125 -167
- package/dist-lib/components/fields/ValueRows.js +114 -0
- package/dist-lib/components/fields/cells/factories/id.js +10 -0
- package/dist-lib/components/fields/cells/factories/nextRun.js +18 -27
- package/dist-lib/components/fields/cells/factories/refLink.js +15 -41
- package/dist-lib/components/fields/cells/registry.js +25 -23
- package/dist-lib/components/file-widgets/DocumentCard.js +142 -142
- package/dist-lib/components/file-widgets/helpers.js +32 -19
- package/dist-lib/components/file-widgets/host.js +4 -1
- package/dist-lib/components/list/PeekFieldCell.js +57 -55
- package/dist-lib/components/list/QuickPeek.js +109 -121
- package/dist-lib/components/pages/SmartDetailPage.impl.js +403 -400
- package/dist-lib/components/pages/SmartListPage.impl.js +260 -260
- package/dist-lib/components/pages/list/ListCardRow.js +101 -100
- package/dist-lib/components/pages/list/cardProjection.js +117 -112
- package/dist-lib/components/pages/list/useListQuery.js +1 -1
- package/dist-lib/components/pages/list/useListRowInteraction.js +68 -65
- package/dist-lib/components/primitives/IdBadge.js +27 -0
- package/dist-lib/components/primitives/RowField.js +11 -43
- package/dist-lib/components/shared/CopyButton.js +13 -18
- package/dist-lib/components/shared/RefChip.js +33 -0
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useAgentConversation.js +134 -110
- package/dist-lib/hooks/useCopy.js +18 -0
- package/dist-lib/index.d.ts +55 -20
- package/dist-lib/index.js +116 -111
- package/dist-lib/lib/realtime-reconcile.js +70 -59
- package/dist-lib/lib/reference.js +52 -34
- package/dist-lib/lib/short-id.js +12 -0
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/types/schema.js +84 -80
- package/dist-lib/{useResponsiveMode-3hOLBkey.d.ts → useResponsiveMode-BObVfNyN.d.ts} +7 -2
- package/package.json +6 -1
- package/dist-lib/components/primitives/RecordIdBadge.js +0 -25
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import { IconBtn as e } from "../primitives/IconBtn.js";
|
|
2
2
|
import { Icon as t } from "../primitives/Icons.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { IdBadge as n } from "../primitives/IdBadge.js";
|
|
4
|
+
import { useSchema as r } from "../../hooks/useSchema.js";
|
|
5
|
+
import { useText as i } from "../../hooks/useText.js";
|
|
6
|
+
import { coerceDisplayString as a } from "../../lib/display-value.js";
|
|
7
|
+
import { shortId as o } from "../../lib/short-id.js";
|
|
8
|
+
import { ValueRows as s, keySegment as c } from "./ValueRows.js";
|
|
9
|
+
import { EMPTY_CELL as l } from "./cells/factories/emptyCell.js";
|
|
10
|
+
import { Suspense as u, lazy as d, useState as f } from "react";
|
|
11
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
12
|
// src/components/fields/JsonField.tsx
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
return /* @__PURE__ */
|
|
13
|
+
var g = d(() => import("./JsonEditor.js").then((e) => ({ default: e.JsonEditor })));
|
|
14
|
+
function _() {
|
|
15
|
+
return /* @__PURE__ */ m("div", { className: "h-20 rounded-md border border-border bg-muted animate-pulse" });
|
|
12
16
|
}
|
|
13
|
-
function
|
|
17
|
+
function v(e) {
|
|
14
18
|
return e == null ? !0 : typeof e == "string" ? e.trim() === "" : Array.isArray(e) ? e.length === 0 : typeof e == "object" && Object.keys(e).length === 0;
|
|
15
19
|
}
|
|
16
|
-
function
|
|
20
|
+
function y(e) {
|
|
17
21
|
return Array.isArray(e) && e.every((e) => [
|
|
18
22
|
"string",
|
|
19
23
|
"number",
|
|
20
24
|
"boolean"
|
|
21
25
|
].includes(typeof e));
|
|
22
26
|
}
|
|
23
|
-
function
|
|
24
|
-
let s =
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}) :
|
|
32
|
-
value: e,
|
|
33
|
-
body: /* @__PURE__ */ l(E, { value: e })
|
|
34
|
-
}) : m(e) ? /* @__PURE__ */ l("ul", {
|
|
27
|
+
function b({ field: e, value: t, mode: n, onChange: r, fieldId: i, entityCode: a, fieldName: o }) {
|
|
28
|
+
let s = e.display?.flatten === !0, c = D(a, o);
|
|
29
|
+
return n === "display" ? v(t) ? l : c && typeof t == "object" && !Array.isArray(t) ? /* @__PURE__ */ m(k, {
|
|
30
|
+
value: t,
|
|
31
|
+
body: /* @__PURE__ */ m(O, {
|
|
32
|
+
value: t,
|
|
33
|
+
flat: s
|
|
34
|
+
})
|
|
35
|
+
}) : y(t) ? /* @__PURE__ */ m("ul", {
|
|
35
36
|
className: "mono",
|
|
36
37
|
style: {
|
|
37
38
|
margin: 0,
|
|
@@ -40,56 +41,42 @@ function h({ value: e, mode: t, onChange: n, fieldId: r, entityCode: i, fieldNam
|
|
|
40
41
|
fontSize: 12.5,
|
|
41
42
|
lineHeight: 1.7
|
|
42
43
|
},
|
|
43
|
-
children:
|
|
44
|
-
}) : /* @__PURE__ */
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
value:
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
children: t.map((e, t) => /* @__PURE__ */ m("li", { children: String(e) }, t))
|
|
45
|
+
}) : /* @__PURE__ */ m(k, {
|
|
46
|
+
value: t,
|
|
47
|
+
body: /* @__PURE__ */ m(A, {
|
|
48
|
+
value: t,
|
|
49
|
+
flat: s
|
|
50
|
+
})
|
|
51
|
+
}) : /* @__PURE__ */ m(u, {
|
|
52
|
+
fallback: /* @__PURE__ */ m(_, {}),
|
|
53
|
+
children: /* @__PURE__ */ m(g, {
|
|
54
|
+
value: t,
|
|
55
|
+
onChange: r,
|
|
56
|
+
id: i
|
|
50
57
|
})
|
|
51
58
|
});
|
|
52
59
|
}
|
|
53
|
-
var
|
|
60
|
+
var x = {
|
|
54
61
|
display: "flex",
|
|
55
|
-
|
|
56
|
-
gap:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
padding: 12,
|
|
60
|
-
background: "var(--surface-2)"
|
|
61
|
-
}, _ = {
|
|
62
|
+
alignItems: "flex-start",
|
|
63
|
+
gap: 8,
|
|
64
|
+
minWidth: 0
|
|
65
|
+
}, S = {
|
|
62
66
|
display: "flex",
|
|
63
67
|
flexDirection: "column",
|
|
64
68
|
gap: 8
|
|
65
|
-
},
|
|
66
|
-
display: "flex",
|
|
67
|
-
flexWrap: "wrap",
|
|
68
|
-
alignItems: "baseline",
|
|
69
|
-
gap: 8
|
|
70
|
-
}, y = {
|
|
71
|
-
fontSize: 11.5,
|
|
72
|
-
fontWeight: 500,
|
|
73
|
-
color: "var(--text-3)",
|
|
74
|
-
width: 120,
|
|
75
|
-
flexShrink: 0,
|
|
76
|
-
overflowWrap: "anywhere"
|
|
77
|
-
}, b = {
|
|
78
|
-
..._,
|
|
79
|
-
paddingLeft: 10,
|
|
80
|
-
borderLeft: "2px solid var(--border)"
|
|
81
|
-
}, x = {
|
|
69
|
+
}, C = {
|
|
82
70
|
minWidth: 0,
|
|
83
|
-
|
|
84
|
-
fontSize: 12.5,
|
|
71
|
+
fontSize: 13,
|
|
85
72
|
overflowWrap: "anywhere"
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
73
|
+
}, w = {
|
|
74
|
+
flex: 1,
|
|
75
|
+
minWidth: 0
|
|
76
|
+
}, T = {
|
|
90
77
|
fontSize: 12.5,
|
|
91
78
|
fontWeight: 500
|
|
92
|
-
},
|
|
79
|
+
}, E = /* @__PURE__ */ new Set([
|
|
93
80
|
"type",
|
|
94
81
|
"status",
|
|
95
82
|
"title",
|
|
@@ -97,86 +84,102 @@ var g = {
|
|
|
97
84
|
"instance",
|
|
98
85
|
"retryable"
|
|
99
86
|
]);
|
|
100
|
-
function
|
|
101
|
-
let { data:
|
|
87
|
+
function D(e, t) {
|
|
88
|
+
let { data: n } = r(), i = e ? n?.entities[e] : void 0;
|
|
102
89
|
return i ? [...i.fields].some(([, e]) => e.type === "error" && e.source === `$row.${t}.type`) : !1;
|
|
103
90
|
}
|
|
104
|
-
function
|
|
105
|
-
let
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
-
style:
|
|
91
|
+
function O({ value: e, flat: t }) {
|
|
92
|
+
let n = i("errors"), a = i(), { data: o } = r(), c = typeof e.type == "string" ? e.type : "", l = c.startsWith("/errors/") ? c.slice(8) : c, u = Object.fromEntries(Object.entries(e).filter(([e]) => !E.has(e)));
|
|
93
|
+
return /* @__PURE__ */ h("div", {
|
|
94
|
+
style: S,
|
|
108
95
|
children: [
|
|
109
|
-
|
|
110
|
-
style:
|
|
111
|
-
children:
|
|
96
|
+
l ? /* @__PURE__ */ m("span", {
|
|
97
|
+
style: T,
|
|
98
|
+
children: n(l, l)
|
|
112
99
|
}) : null,
|
|
113
|
-
typeof e.detail == "string" && e.detail ? /* @__PURE__ */
|
|
114
|
-
style:
|
|
100
|
+
typeof e.detail == "string" && e.detail ? /* @__PURE__ */ m("span", {
|
|
101
|
+
style: C,
|
|
115
102
|
children: e.detail
|
|
116
103
|
}) : null,
|
|
117
|
-
Object.keys(
|
|
104
|
+
Object.keys(u).length > 0 ? /* @__PURE__ */ m(s, {
|
|
105
|
+
flat: t,
|
|
106
|
+
rows: j(u, (e) => {
|
|
107
|
+
let t = o?.error_fields?.[`${l}.${e}`];
|
|
108
|
+
return t ? a(t) : e;
|
|
109
|
+
})
|
|
110
|
+
}) : null
|
|
118
111
|
]
|
|
119
112
|
});
|
|
120
113
|
}
|
|
121
|
-
function
|
|
122
|
-
let
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
style:
|
|
125
|
-
children: [/* @__PURE__ */
|
|
126
|
-
style:
|
|
127
|
-
children: /* @__PURE__ */
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
})
|
|
114
|
+
function k({ value: n, body: r }) {
|
|
115
|
+
let a = i(), [o, s] = f(!1), c = o ? a("field.json.hide_source", "Hide JSON") : a("field.json.show_source", "Show JSON");
|
|
116
|
+
return /* @__PURE__ */ h("div", {
|
|
117
|
+
style: x,
|
|
118
|
+
children: [/* @__PURE__ */ m("div", {
|
|
119
|
+
style: w,
|
|
120
|
+
children: o ? /* @__PURE__ */ m(u, {
|
|
121
|
+
fallback: /* @__PURE__ */ m(_, {}),
|
|
122
|
+
children: /* @__PURE__ */ m(g, {
|
|
123
|
+
value: n,
|
|
124
|
+
readOnly: !0
|
|
125
|
+
})
|
|
126
|
+
}) : r
|
|
127
|
+
}), /* @__PURE__ */ m(e, {
|
|
128
|
+
size: 22,
|
|
129
|
+
icon: /* @__PURE__ */ m(t.code, { size: 13 }),
|
|
130
|
+
onClick: (e) => {
|
|
131
|
+
e.stopPropagation(), s((e) => !e);
|
|
132
|
+
},
|
|
133
|
+
title: c,
|
|
134
|
+
"aria-label": c,
|
|
135
|
+
"aria-pressed": o
|
|
136
|
+
})]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function A({ value: e, flat: t }) {
|
|
140
|
+
let n = M(e) ?? e;
|
|
141
|
+
return typeof n == "object" && n ? /* @__PURE__ */ m(s, {
|
|
142
|
+
flat: t,
|
|
143
|
+
rows: j(n)
|
|
144
|
+
}) : /* @__PURE__ */ m("span", {
|
|
145
|
+
style: C,
|
|
146
|
+
children: /* @__PURE__ */ m(P, { value: e })
|
|
144
147
|
});
|
|
145
148
|
}
|
|
146
|
-
function
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
value: t,
|
|
159
|
-
nested: !0
|
|
160
|
-
})
|
|
161
|
-
})]
|
|
162
|
-
}, e))
|
|
149
|
+
function j(e, t = (e) => e) {
|
|
150
|
+
return Array.isArray(e) && e.length === 1 && N(e[0]) ? j(e[0], t) : (Array.isArray(e) ? e.map((e, t) => [String(t + 1), e]) : Object.entries(e)).map(([e, n]) => {
|
|
151
|
+
let r = M(n) ?? n;
|
|
152
|
+
return N(r) ? {
|
|
153
|
+
key: c(e),
|
|
154
|
+
label: t(e),
|
|
155
|
+
rows: j(r)
|
|
156
|
+
} : {
|
|
157
|
+
key: c(e),
|
|
158
|
+
label: t(e),
|
|
159
|
+
value: /* @__PURE__ */ m(P, { value: r })
|
|
160
|
+
};
|
|
163
161
|
});
|
|
164
162
|
}
|
|
165
|
-
function
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
163
|
+
function M(e) {
|
|
164
|
+
if (typeof e == "string" && /^\s*[[{]/.test(e)) try {
|
|
165
|
+
let t = JSON.parse(e);
|
|
166
|
+
return typeof t == "object" && t ? t : void 0;
|
|
167
|
+
} catch {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function N(e) {
|
|
172
|
+
return typeof e == "object" && !!e && !v(e) && !y(e);
|
|
173
|
+
}
|
|
174
|
+
function P({ value: e }) {
|
|
175
|
+
let t = i();
|
|
176
|
+
return v(e) ? l : typeof e == "boolean" ? /* @__PURE__ */ m(p, { children: e ? t("field.bool.yes", "Yes") : t("field.bool.no", "No") }) : typeof e == "string" && o(e) !== e ? /* @__PURE__ */ m(n, { value: e }) : y(e) ? /* @__PURE__ */ m(p, { children: e.map((e) => F(e, t.language)).join(", ") }) : /* @__PURE__ */ m(p, { children: F(e, t.language) });
|
|
174
177
|
}
|
|
175
|
-
function
|
|
178
|
+
function F(e, t) {
|
|
176
179
|
if (typeof e == "number" && Number.isFinite(e) && !Number.isInteger(e)) {
|
|
177
180
|
let n = Math.abs(e) < 1 ? { maximumSignificantDigits: 4 } : { maximumFractionDigits: 4 };
|
|
178
181
|
return new Intl.NumberFormat(t, n).format(e);
|
|
179
182
|
}
|
|
180
|
-
return
|
|
183
|
+
return a(e);
|
|
181
184
|
}
|
|
182
|
-
export {
|
|
185
|
+
export { b as JsonField, v as isEmptyJsonValue, N as isNestable, j as jsonRows, M as parseJsonText };
|
|
@@ -1,37 +1,22 @@
|
|
|
1
1
|
import { TextInput as e } from "../primitives/Fields.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { IdBadge as t } from "../primitives/IdBadge.js";
|
|
3
|
+
import { EMPTY_CELL as n } from "./cells/factories/emptyCell.js";
|
|
4
|
+
import { coerceDisplayString as r } from "../../lib/display-value.js";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
6
|
// src/components/fields/StringField.tsx
|
|
6
7
|
function a({ field: a, fieldName: o, value: s, mode: c, onChange: l, fieldId: u }) {
|
|
7
8
|
if (c === "display") {
|
|
8
|
-
let e =
|
|
9
|
-
return a.
|
|
10
|
-
style: {
|
|
11
|
-
display: "inline-flex",
|
|
12
|
-
alignItems: "center",
|
|
13
|
-
gap: 4
|
|
14
|
-
},
|
|
15
|
-
children: [/* @__PURE__ */ r("span", {
|
|
16
|
-
style: { fontSize: 12.5 },
|
|
17
|
-
children: e
|
|
18
|
-
}), /* @__PURE__ */ r(t, {
|
|
19
|
-
value: e,
|
|
20
|
-
size: "sm"
|
|
21
|
-
})]
|
|
22
|
-
}) : /* @__PURE__ */ r("span", {
|
|
9
|
+
let e = r(s);
|
|
10
|
+
return e ? a.display?.widget === "id" ? /* @__PURE__ */ i(t, { value: e }) : /* @__PURE__ */ i("span", {
|
|
23
11
|
style: { fontSize: 12.5 },
|
|
24
|
-
children: e
|
|
25
|
-
|
|
26
|
-
children: "—"
|
|
27
|
-
})
|
|
28
|
-
});
|
|
12
|
+
children: e
|
|
13
|
+
}) : n;
|
|
29
14
|
}
|
|
30
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ i(e, {
|
|
31
16
|
id: u,
|
|
32
17
|
name: o,
|
|
33
18
|
"aria-required": a.required || void 0,
|
|
34
|
-
value:
|
|
19
|
+
value: r(s),
|
|
35
20
|
onChange: (e) => l?.(e)
|
|
36
21
|
});
|
|
37
22
|
}
|