@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,7 +1,7 @@
|
|
|
1
1
|
import { renderSchemaField as e } from "../file-widgets/host.js";
|
|
2
2
|
import { AuditMetaStrip as t } from "../chrome/AuditMetaStrip.js";
|
|
3
3
|
import { useText as n } from "../../hooks/useText.js";
|
|
4
|
-
import {
|
|
4
|
+
import { IdBadge as r } from "../primitives/IdBadge.js";
|
|
5
5
|
import { jsx as i } from "react/jsx-runtime";
|
|
6
6
|
// src/components/detail-layout/DetailAuditStrip.tsx
|
|
7
7
|
function a({ screen: a, entity: o, entityCode: s, record: c, recordId: l, refs: u, schema: d }) {
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import { Pill as e } from "../primitives/Pill.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { bucketReference as t } from "../../lib/reference.js";
|
|
3
|
+
import { RefChip as n } from "../shared/RefChip.js";
|
|
4
|
+
import { evidenceVerdictPill as r } from "../../lib/evidence-verdict.js";
|
|
5
|
+
import { useSchema as i } from "../../hooks/useSchema.js";
|
|
6
|
+
import { useText as a } from "../../hooks/useText.js";
|
|
7
|
+
import { formatOffsetTimestamp as o } from "../../lib/timestamp.js";
|
|
8
|
+
import { messageText as s } from "../../lib/message.js";
|
|
9
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
10
|
// src/components/detail-layout/EvidenceBlock.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
var u = "$evidence@evidence_record";
|
|
12
|
+
function d(e, t) {
|
|
13
|
+
if (e && !Number.isNaN(new Date(e).getTime())) return o(e, { zone: t });
|
|
11
14
|
}
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
+
function f({ evidence: o, refs: f }) {
|
|
16
|
+
let p = a(), { data: m } = i(), h = r(p, m?.enums, o?.verdict ?? "unverified"), g = d(o?.verified_at, p.timeZone), _ = s(p, o?.reason), v = o?.record_id ? t({
|
|
17
|
+
entities: m?.entities,
|
|
18
|
+
screens: m?.screens,
|
|
19
|
+
t: p
|
|
20
|
+
}, f, u, "evidence_record", o.record_id) : void 0, y = [];
|
|
21
|
+
return o?.seq && !v?.resolved && y.push(p("record.evidence.chain", "chain #{seq}", { seq: o.seq })), o?.generation && y.push(p("record.evidence.generation", "generation {number}", { number: o.generation })), /* @__PURE__ */ l("div", {
|
|
15
22
|
style: {
|
|
16
23
|
display: "flex",
|
|
17
24
|
flexDirection: "column",
|
|
18
25
|
gap: 6
|
|
19
26
|
},
|
|
20
|
-
children: [/* @__PURE__ */
|
|
27
|
+
children: [/* @__PURE__ */ l("div", {
|
|
21
28
|
style: {
|
|
22
29
|
display: "flex",
|
|
23
30
|
alignItems: "center",
|
|
@@ -25,42 +32,47 @@ function l({ evidence: i }) {
|
|
|
25
32
|
flexWrap: "wrap"
|
|
26
33
|
},
|
|
27
34
|
children: [
|
|
28
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ c("span", {
|
|
29
36
|
style: {
|
|
30
37
|
fontSize: 12,
|
|
31
38
|
fontWeight: 600,
|
|
32
39
|
color: "var(--muted-foreground)"
|
|
33
40
|
},
|
|
34
|
-
children:
|
|
41
|
+
children: p("record.evidence.title", "Evidence")
|
|
35
42
|
}),
|
|
36
|
-
|
|
43
|
+
v?.resolved && /* @__PURE__ */ c(n, {
|
|
44
|
+
label: v.label,
|
|
45
|
+
href: v.href,
|
|
46
|
+
icon: v.icon
|
|
47
|
+
}),
|
|
48
|
+
y.length > 0 && /* @__PURE__ */ c("span", {
|
|
37
49
|
style: {
|
|
38
50
|
fontSize: 12,
|
|
39
51
|
color: "var(--muted-foreground)"
|
|
40
52
|
},
|
|
41
|
-
children:
|
|
53
|
+
children: y.join(" · ")
|
|
42
54
|
}),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
tone:
|
|
55
|
+
/* @__PURE__ */ c(e, {
|
|
56
|
+
tone: h.tone,
|
|
45
57
|
size: "sm",
|
|
46
58
|
dot: !0,
|
|
47
|
-
children:
|
|
59
|
+
children: h.label
|
|
48
60
|
}),
|
|
49
|
-
|
|
61
|
+
g && /* @__PURE__ */ c("span", {
|
|
50
62
|
style: {
|
|
51
63
|
fontSize: 12,
|
|
52
64
|
color: "var(--muted-foreground)"
|
|
53
65
|
},
|
|
54
|
-
children:
|
|
66
|
+
children: p("record.evidence.verified", "Checked {when}", { when: g })
|
|
55
67
|
})
|
|
56
68
|
]
|
|
57
|
-
}),
|
|
69
|
+
}), _ && /* @__PURE__ */ c("span", {
|
|
58
70
|
style: {
|
|
59
71
|
fontSize: 12,
|
|
60
72
|
color: "var(--destructive)"
|
|
61
73
|
},
|
|
62
|
-
children:
|
|
74
|
+
children: _
|
|
63
75
|
})]
|
|
64
76
|
});
|
|
65
77
|
}
|
|
66
|
-
export {
|
|
78
|
+
export { u as EVIDENCE_RECORD_BUCKET, f as EvidenceBlock };
|
|
@@ -2,27 +2,25 @@ import { Icon as e } from "../primitives/Icons.js";
|
|
|
2
2
|
import { CopyButton as t } from "../shared/CopyButton.js";
|
|
3
3
|
import { useText as n } from "../../hooks/useText.js";
|
|
4
4
|
import { coerceDisplayString as r } from "../../lib/display-value.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { LABEL_TEXT_STYLE as i, LabelLayoutContext as a, NestedBlock as o, useLabelLayout as s } from "./labelLayout.js";
|
|
6
|
+
import { useLayoutEffect as c, useRef as l, useState as u } from "react";
|
|
7
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
8
|
// src/components/detail-layout/FieldRow.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
9
|
+
var p = 560, m = 374, h = "20px", g = 4;
|
|
10
|
+
function _(e, t) {
|
|
11
|
+
if (e?.copyable && e.display?.widget !== "id" && t != null && t !== "") return r(t);
|
|
11
12
|
}
|
|
12
|
-
var
|
|
13
|
+
var v = /* @__PURE__ */ new Set(["json", "structure"]), y = /* @__PURE__ */ new Set([
|
|
13
14
|
"text",
|
|
14
15
|
"rich_text",
|
|
15
16
|
"json",
|
|
16
17
|
"structure",
|
|
17
18
|
"multilang_text",
|
|
18
19
|
"multilang_array"
|
|
19
|
-
])
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
function y({ columns: e = 2, children: t }) {
|
|
24
|
-
let n = s(null), [r, i] = c(null);
|
|
25
|
-
o(() => {
|
|
20
|
+
]);
|
|
21
|
+
function b({ columns: e = 2, children: t }) {
|
|
22
|
+
let n = l(null), [r, i] = u(null);
|
|
23
|
+
c(() => {
|
|
26
24
|
let e = n.current;
|
|
27
25
|
if (!e) return;
|
|
28
26
|
let t = (e) => i(e > 0 ? e : null);
|
|
@@ -32,17 +30,17 @@ function y({ columns: e = 2, children: t }) {
|
|
|
32
30
|
});
|
|
33
31
|
return r.observe(e), () => r.disconnect();
|
|
34
32
|
}, []);
|
|
35
|
-
let
|
|
36
|
-
return /* @__PURE__ */
|
|
33
|
+
let o = e === 1 || r !== null && r < p ? 1 : e, s = r === null ? null : (r - (o - 1) * 24) / o, f = s !== null && s < m;
|
|
34
|
+
return /* @__PURE__ */ d(a.Provider, {
|
|
37
35
|
value: {
|
|
38
|
-
columns:
|
|
39
|
-
stackPairs:
|
|
36
|
+
columns: o,
|
|
37
|
+
stackPairs: f
|
|
40
38
|
},
|
|
41
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ d("div", {
|
|
42
40
|
ref: n,
|
|
43
41
|
style: {
|
|
44
42
|
display: "grid",
|
|
45
|
-
gridTemplateColumns: `repeat(${
|
|
43
|
+
gridTemplateColumns: `repeat(${o}, minmax(0, 1fr))`,
|
|
46
44
|
columnGap: 24,
|
|
47
45
|
rowGap: 2
|
|
48
46
|
},
|
|
@@ -50,43 +48,41 @@ function y({ columns: e = 2, children: t }) {
|
|
|
50
48
|
})
|
|
51
49
|
});
|
|
52
50
|
}
|
|
53
|
-
function
|
|
54
|
-
let
|
|
55
|
-
return /* @__PURE__ */
|
|
51
|
+
function x({ label: r, children: a, span: c = !1, nested: l = !1, required: u, error: p, hint: m, actions: _, copyValue: v, mode: y = "display", htmlFor: b, labelId: x, labelTitle: S, "data-testid": C }) {
|
|
52
|
+
let w = n(), T = s(), E = c || T.stackPairs, D = !!p;
|
|
53
|
+
return /* @__PURE__ */ f("div", {
|
|
56
54
|
className: "detail-row",
|
|
57
|
-
"data-error":
|
|
58
|
-
"data-testid":
|
|
55
|
+
"data-error": D || void 0,
|
|
56
|
+
"data-testid": C,
|
|
59
57
|
style: {
|
|
60
58
|
display: "flex",
|
|
61
|
-
flexDirection:
|
|
62
|
-
gap:
|
|
63
|
-
alignItems:
|
|
59
|
+
flexDirection: E ? "column" : "row",
|
|
60
|
+
gap: E ? 4 : 16,
|
|
61
|
+
alignItems: E ? "stretch" : "flex-start",
|
|
64
62
|
padding: "6px 0",
|
|
65
|
-
...
|
|
63
|
+
...c ? { gridColumn: "1 / -1" } : null
|
|
66
64
|
},
|
|
67
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ f("div", {
|
|
68
66
|
style: {
|
|
69
|
-
width:
|
|
67
|
+
width: E ? "auto" : 150,
|
|
70
68
|
flexShrink: 0,
|
|
71
|
-
paddingTop:
|
|
72
|
-
|
|
73
|
-
lineHeight:
|
|
74
|
-
fontWeight: 500,
|
|
75
|
-
color: "var(--text-3)",
|
|
69
|
+
paddingTop: E ? 0 : g,
|
|
70
|
+
...i,
|
|
71
|
+
lineHeight: h,
|
|
76
72
|
display: "flex",
|
|
77
73
|
alignItems: "flex-start",
|
|
78
74
|
gap: 2
|
|
79
75
|
},
|
|
80
|
-
children: [
|
|
81
|
-
id:
|
|
82
|
-
htmlFor:
|
|
83
|
-
title:
|
|
76
|
+
children: [b ? /* @__PURE__ */ d("label", {
|
|
77
|
+
id: x,
|
|
78
|
+
htmlFor: b,
|
|
79
|
+
title: S || void 0,
|
|
84
80
|
children: r
|
|
85
|
-
}) : /* @__PURE__ */
|
|
86
|
-
id:
|
|
87
|
-
title:
|
|
81
|
+
}) : /* @__PURE__ */ d("span", {
|
|
82
|
+
id: x,
|
|
83
|
+
title: S || void 0,
|
|
88
84
|
children: r
|
|
89
|
-
}),
|
|
85
|
+
}), u && y === "edit" && /* @__PURE__ */ d("span", {
|
|
90
86
|
"aria-hidden": "true",
|
|
91
87
|
style: {
|
|
92
88
|
color: "var(--danger)",
|
|
@@ -94,7 +90,7 @@ function b({ label: r, children: i, span: o = !1, required: s, error: c, hint: f
|
|
|
94
90
|
},
|
|
95
91
|
children: "*"
|
|
96
92
|
})]
|
|
97
|
-
}), /* @__PURE__ */
|
|
93
|
+
}), /* @__PURE__ */ f("div", {
|
|
98
94
|
style: {
|
|
99
95
|
flex: 1,
|
|
100
96
|
minWidth: 0,
|
|
@@ -102,31 +98,31 @@ function b({ label: r, children: i, span: o = !1, required: s, error: c, hint: f
|
|
|
102
98
|
flexDirection: "column",
|
|
103
99
|
gap: 3
|
|
104
100
|
},
|
|
105
|
-
children: [/* @__PURE__ */
|
|
101
|
+
children: [/* @__PURE__ */ f("div", {
|
|
106
102
|
style: {
|
|
107
103
|
display: "flex",
|
|
108
104
|
alignItems: "flex-start",
|
|
109
105
|
gap: 6,
|
|
110
106
|
minHeight: 24
|
|
111
107
|
},
|
|
112
|
-
children: [/* @__PURE__ */
|
|
108
|
+
children: [/* @__PURE__ */ d("div", {
|
|
113
109
|
style: {
|
|
114
110
|
flex: 1,
|
|
115
111
|
minWidth: 0,
|
|
116
112
|
fontSize: 13,
|
|
117
|
-
lineHeight:
|
|
113
|
+
lineHeight: h,
|
|
118
114
|
color: "var(--text)",
|
|
119
115
|
overflowWrap: "anywhere",
|
|
120
|
-
paddingTop:
|
|
116
|
+
paddingTop: y === "display" && !E ? g : 0
|
|
121
117
|
},
|
|
122
|
-
children:
|
|
118
|
+
children: D && y === "edit" ? /* @__PURE__ */ d("div", {
|
|
123
119
|
style: {
|
|
124
120
|
borderRadius: "var(--radius-md)",
|
|
125
121
|
boxShadow: "0 0 0 1.5px var(--danger)"
|
|
126
122
|
},
|
|
127
|
-
children:
|
|
128
|
-
}) :
|
|
129
|
-
}), (
|
|
123
|
+
children: a
|
|
124
|
+
}) : l && y === "display" ? /* @__PURE__ */ d(o, { children: a }) : a
|
|
125
|
+
}), (v || _) && /* @__PURE__ */ f("div", {
|
|
130
126
|
className: "detail-row-action",
|
|
131
127
|
style: {
|
|
132
128
|
display: "flex",
|
|
@@ -134,24 +130,24 @@ function b({ label: r, children: i, span: o = !1, required: s, error: c, hint: f
|
|
|
134
130
|
flexShrink: 0,
|
|
135
131
|
marginTop: -2
|
|
136
132
|
},
|
|
137
|
-
children: [
|
|
138
|
-
value:
|
|
133
|
+
children: [v && /* @__PURE__ */ d(t, {
|
|
134
|
+
value: v,
|
|
139
135
|
size: "sm",
|
|
140
|
-
title:
|
|
141
|
-
}),
|
|
136
|
+
title: w("record.field.copy_value", "Copy value")
|
|
137
|
+
}), _]
|
|
142
138
|
})]
|
|
143
|
-
}), (
|
|
139
|
+
}), (D || m != null) && /* @__PURE__ */ f("div", {
|
|
144
140
|
style: {
|
|
145
141
|
fontSize: 11.5,
|
|
146
142
|
lineHeight: 1.4,
|
|
147
|
-
color:
|
|
143
|
+
color: D ? "var(--danger)" : "var(--text-3)",
|
|
148
144
|
display: "flex",
|
|
149
145
|
alignItems: "center",
|
|
150
146
|
gap: 4
|
|
151
147
|
},
|
|
152
|
-
children: [
|
|
148
|
+
children: [D && /* @__PURE__ */ d(e.warning, { size: 11 }), /* @__PURE__ */ d("span", { children: D ? p : m })]
|
|
153
149
|
})]
|
|
154
150
|
})]
|
|
155
151
|
});
|
|
156
152
|
}
|
|
157
|
-
export {
|
|
153
|
+
export { x as FieldRow, b as FieldsGrid, v as NESTED_FIELD_TYPES, y as SPAN_FIELD_TYPES, _ as copyableValue };
|
|
@@ -2,75 +2,76 @@ import { ActionButton as e } from "../actions/ActionButton.js";
|
|
|
2
2
|
import { renderSchemaField as t, resolveSchemaFieldLabel as n, schemaFieldHasValue as r } from "../file-widgets/host.js";
|
|
3
3
|
import { ClassifiedFieldLocked as i } from "../primitives/ClassifiedFieldLocked.js";
|
|
4
4
|
import { classificationTier as a, fieldAccessInfo as o } from "../../lib/field-classification.js";
|
|
5
|
-
import { FieldRow as s, FieldsGrid as c,
|
|
6
|
-
import { useText as
|
|
7
|
-
import { Fragment as
|
|
5
|
+
import { FieldRow as s, FieldsGrid as c, NESTED_FIELD_TYPES as l, SPAN_FIELD_TYPES as u, copyableValue as d } from "./FieldRow.js";
|
|
6
|
+
import { useText as f } from "../../hooks/useText.js";
|
|
7
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
8
|
// src/components/detail-layout/FieldsBlock.tsx
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
return
|
|
12
|
-
columns:
|
|
13
|
-
children:
|
|
14
|
-
let c = r.code,
|
|
15
|
-
tier:
|
|
16
|
-
tierDef: a(
|
|
17
|
-
requiredPermission:
|
|
18
|
-
variant:
|
|
9
|
+
function g({ fields: r, ctx: g }) {
|
|
10
|
+
let v = f(), { entity: y, entityCode: b, record: x, mode: S, onFieldChange: C, schema: w, isNew: T } = g, E = g.columns ?? 2, D = r.filter((e) => _(g, e.code)), O = E === 1 && r.length === 1;
|
|
11
|
+
return D.length === 0 ? null : /* @__PURE__ */ m(c, {
|
|
12
|
+
columns: E,
|
|
13
|
+
children: D.map((r) => {
|
|
14
|
+
let c = r.code, f = `${b ?? "field"}-${c}`, _ = `${f}-label`, E = y.fields.get(c), D = !!(E?.auto || E?.readonly || E?.source || E?.immutable && !T), k = o(y, c), A = k?.read === "denied", j = k?.write === "denied", M = S === "display" ? A : j || A, N = D || S === "edit" && j ? "display" : S, P = M ? /* @__PURE__ */ m(i, {
|
|
15
|
+
tier: k.classification,
|
|
16
|
+
tierDef: a(w, y, c),
|
|
17
|
+
requiredPermission: k?.required_permission,
|
|
18
|
+
variant: N === "edit" ? "input" : "value"
|
|
19
19
|
}) : t({
|
|
20
|
-
entity:
|
|
21
|
-
entityCode:
|
|
20
|
+
entity: y,
|
|
21
|
+
entityCode: b,
|
|
22
22
|
fieldName: c,
|
|
23
|
-
record:
|
|
24
|
-
mode:
|
|
25
|
-
onChange:
|
|
26
|
-
refs:
|
|
27
|
-
entities:
|
|
28
|
-
screens:
|
|
29
|
-
t:
|
|
30
|
-
fieldId:
|
|
31
|
-
labelId:
|
|
23
|
+
record: x,
|
|
24
|
+
mode: N,
|
|
25
|
+
onChange: C && !D ? (e) => C(c, e) : void 0,
|
|
26
|
+
refs: g.refs,
|
|
27
|
+
entities: w?.entities,
|
|
28
|
+
screens: w?.screens,
|
|
29
|
+
t: v,
|
|
30
|
+
fieldId: f,
|
|
31
|
+
labelId: _,
|
|
32
32
|
structure: r.structure,
|
|
33
33
|
detailScreen: r.detail_screen
|
|
34
34
|
});
|
|
35
|
-
if (!
|
|
36
|
-
let
|
|
35
|
+
if (!P) return null;
|
|
36
|
+
let F = S === "display" && r.actions && r.actions.length > 0 ? /* @__PURE__ */ m(p, { children: r.actions.map((t, n) => /* @__PURE__ */ m(e, {
|
|
37
37
|
actionCode: `${c}.action[${n}]`,
|
|
38
38
|
action: t,
|
|
39
|
-
entityCode:
|
|
40
|
-
row:
|
|
39
|
+
entityCode: b,
|
|
40
|
+
row: x,
|
|
41
41
|
variant: "ghost",
|
|
42
42
|
size: "icon"
|
|
43
|
-
}, n)) }) : void 0,
|
|
44
|
-
return
|
|
43
|
+
}, n)) }) : void 0, I = !!E && u.has(E.type), L = N === "display" ? d(E, x?.[c]) : void 0, R = v(E?.display?.description);
|
|
44
|
+
return O && (I || r.structure || y.files?.get(c)) ? /* @__PURE__ */ h("div", {
|
|
45
45
|
style: { gridColumn: "1 / -1" },
|
|
46
|
-
children: [
|
|
46
|
+
children: [P, N === "edit" && R && /* @__PURE__ */ m("div", {
|
|
47
47
|
style: {
|
|
48
48
|
fontSize: 11.5,
|
|
49
49
|
lineHeight: 1.4,
|
|
50
50
|
color: "var(--text-3)",
|
|
51
51
|
marginTop: 3
|
|
52
52
|
},
|
|
53
|
-
children:
|
|
53
|
+
children: R
|
|
54
54
|
})]
|
|
55
|
-
}, c) : /* @__PURE__ */
|
|
55
|
+
}, c) : /* @__PURE__ */ m(s, {
|
|
56
56
|
"data-testid": `field-${c}`,
|
|
57
|
-
label: n(
|
|
58
|
-
htmlFor:
|
|
59
|
-
labelId:
|
|
60
|
-
labelTitle:
|
|
61
|
-
required:
|
|
62
|
-
mode:
|
|
63
|
-
span:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
label: n(v, y, c, w.entities),
|
|
58
|
+
htmlFor: N === "edit" ? f : void 0,
|
|
59
|
+
labelId: _,
|
|
60
|
+
labelTitle: R || void 0,
|
|
61
|
+
required: E?.required ?? !1,
|
|
62
|
+
mode: N,
|
|
63
|
+
span: I,
|
|
64
|
+
nested: !!E && (l.has(E.type) || !!r.structure),
|
|
65
|
+
error: g.fieldErrors?.[c],
|
|
66
|
+
hint: N === "edit" && R ? R : void 0,
|
|
67
|
+
actions: F,
|
|
68
|
+
copyValue: L,
|
|
69
|
+
children: P
|
|
69
70
|
}, c);
|
|
70
71
|
})
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function _(e, t) {
|
|
74
75
|
return e.mode === "display" ? e.headerFields?.has(t) ? !1 : !e.hideEmptyFields || r(e.entity, e.record, t) : !0;
|
|
75
76
|
}
|
|
76
|
-
export {
|
|
77
|
+
export { g as FieldsBlock, _ as displaysField };
|
|
@@ -2,13 +2,13 @@ import { renderField as e } from "../fields/index.js";
|
|
|
2
2
|
import { propertyToField as t } from "../../types/schema.js";
|
|
3
3
|
import { ClassifiedFieldLocked as n } from "../primitives/ClassifiedFieldLocked.js";
|
|
4
4
|
import { classificationTier as r, fieldAccessInfo as i } from "../../lib/field-classification.js";
|
|
5
|
-
import { FieldRow as a, FieldsGrid as o,
|
|
6
|
-
import { useText as
|
|
7
|
-
import { SectionCard as
|
|
8
|
-
import { useCallback as
|
|
9
|
-
import { jsx as
|
|
5
|
+
import { FieldRow as a, FieldsGrid as o, NESTED_FIELD_TYPES as s, SPAN_FIELD_TYPES as c } from "./FieldRow.js";
|
|
6
|
+
import { useText as l } from "../../hooks/useText.js";
|
|
7
|
+
import { SectionCard as u } from "../primitives/SectionCard.js";
|
|
8
|
+
import { useCallback as d, useEffect as f, useRef as p } from "react";
|
|
9
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
10
10
|
// src/components/detail-layout/PropertiesBlock.tsx
|
|
11
|
-
var
|
|
11
|
+
var h = /* @__PURE__ */ new Set([
|
|
12
12
|
"string",
|
|
13
13
|
"text",
|
|
14
14
|
"int",
|
|
@@ -16,22 +16,22 @@ var m = /* @__PURE__ */ new Set([
|
|
|
16
16
|
"decimal",
|
|
17
17
|
"email",
|
|
18
18
|
"url"
|
|
19
|
-
]),
|
|
20
|
-
function
|
|
21
|
-
let { entity: r, objectProperties: i, onSetProperty: a, isNew: s, mode:
|
|
19
|
+
]), g = 500;
|
|
20
|
+
function _({ node: e, ctx: n }) {
|
|
21
|
+
let { entity: r, objectProperties: i, onSetProperty: a, isNew: s, mode: c, refs: d } = n, f = l(), p = r.properties ?? {};
|
|
22
22
|
if (s) return null;
|
|
23
|
-
let h = e.properties === !0 || e.properties, g = h === !0 ? Object.entries(
|
|
23
|
+
let h = e.properties === !0 || e.properties, g = h === !0 ? Object.entries(p).sort(([e], [t]) => e.localeCompare(t)) : h.filter((e) => p[e] != null).map((e) => [e, p[e]]);
|
|
24
24
|
if (g.length === 0) return null;
|
|
25
|
-
let
|
|
25
|
+
let _ = /* @__PURE__ */ m(o, {
|
|
26
26
|
columns: 2,
|
|
27
27
|
children: g.map(([e, o]) => {
|
|
28
|
-
let s = i?.find((t) => t.property_code === e),
|
|
29
|
-
return /* @__PURE__ */
|
|
28
|
+
let s = i?.find((t) => t.property_code === e), l = t(o), u = o.readonly || !a ? "display" : c;
|
|
29
|
+
return /* @__PURE__ */ m(v, {
|
|
30
30
|
propCode: e,
|
|
31
31
|
prop: o,
|
|
32
|
-
field:
|
|
32
|
+
field: l,
|
|
33
33
|
value: s?.value,
|
|
34
|
-
mode:
|
|
34
|
+
mode: u,
|
|
35
35
|
onSetProperty: a,
|
|
36
36
|
refs: d,
|
|
37
37
|
entity: r,
|
|
@@ -39,41 +39,42 @@ function g({ node: e, ctx: n }) {
|
|
|
39
39
|
}, e);
|
|
40
40
|
})
|
|
41
41
|
});
|
|
42
|
-
return n.withinCard ?
|
|
42
|
+
return n.withinCard ? _ : /* @__PURE__ */ m(u, {
|
|
43
43
|
title: f("record.properties", "Properties"),
|
|
44
|
-
children:
|
|
44
|
+
children: _
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
function v({ propCode: t, prop: o, field: u, value: _, mode: v, onSetProperty: y, refs: b, entity: x, schema: S }) {
|
|
48
|
+
let C = l(), w = p(null);
|
|
49
|
+
f(() => () => {
|
|
50
|
+
w.current && clearTimeout(w.current);
|
|
51
51
|
}, []);
|
|
52
|
-
let
|
|
53
|
-
|
|
52
|
+
let T = d((e) => {
|
|
53
|
+
y && (h.has(o.type) ? (w.current && clearTimeout(w.current), w.current = setTimeout(() => y(t, e), g)) : y(t, e));
|
|
54
54
|
}, [
|
|
55
55
|
t,
|
|
56
56
|
o.type,
|
|
57
|
-
|
|
58
|
-
]),
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
label:
|
|
61
|
-
mode:
|
|
62
|
-
span:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
y
|
|
58
|
+
]), E = i(x, t), D = E?.read === "denied", O = E?.write === "denied", k = v === "display" ? D : O || D, A = v === "edit" && O ? "display" : v;
|
|
59
|
+
return /* @__PURE__ */ m(a, {
|
|
60
|
+
label: C(o.display?.name ?? o.name),
|
|
61
|
+
mode: A,
|
|
62
|
+
span: c.has(o.type),
|
|
63
|
+
nested: s.has(o.type),
|
|
64
|
+
children: k ? /* @__PURE__ */ m(n, {
|
|
65
|
+
tier: E.classification,
|
|
66
|
+
tierDef: r(S, x, t),
|
|
67
|
+
requiredPermission: E?.required_permission,
|
|
68
|
+
variant: A === "edit" ? "input" : "value"
|
|
68
69
|
}) : e({
|
|
69
|
-
field:
|
|
70
|
+
field: u,
|
|
70
71
|
fieldName: t,
|
|
71
|
-
value:
|
|
72
|
-
mode:
|
|
73
|
-
onChange:
|
|
74
|
-
refs:
|
|
75
|
-
t:
|
|
72
|
+
value: _,
|
|
73
|
+
mode: A,
|
|
74
|
+
onChange: A === "edit" ? T : void 0,
|
|
75
|
+
refs: b,
|
|
76
|
+
t: C
|
|
76
77
|
})
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
|
-
export {
|
|
80
|
+
export { _ as PropertiesBlock };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
var r = {
|
|
4
|
+
fontSize: 12,
|
|
5
|
+
fontWeight: 500,
|
|
6
|
+
color: "var(--text-3)",
|
|
7
|
+
overflowWrap: "break-word"
|
|
8
|
+
}, i = 2, a = 10, o = 6, s = e({
|
|
9
|
+
columns: 2,
|
|
10
|
+
stackPairs: !1
|
|
11
|
+
});
|
|
12
|
+
function c() {
|
|
13
|
+
return t(s);
|
|
14
|
+
}
|
|
15
|
+
var l = e(0);
|
|
16
|
+
function u() {
|
|
17
|
+
return 150 - Math.min(t(l), o) * 12;
|
|
18
|
+
}
|
|
19
|
+
function d({ children: e }) {
|
|
20
|
+
let r = t(l);
|
|
21
|
+
return /* @__PURE__ */ n("div", {
|
|
22
|
+
style: r < o ? {
|
|
23
|
+
borderLeftWidth: i,
|
|
24
|
+
borderLeftStyle: "solid",
|
|
25
|
+
borderLeftColor: "var(--border)",
|
|
26
|
+
paddingLeft: a,
|
|
27
|
+
minWidth: 0
|
|
28
|
+
} : { minWidth: 0 },
|
|
29
|
+
children: /* @__PURE__ */ n(l.Provider, {
|
|
30
|
+
value: r + 1,
|
|
31
|
+
children: e
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export { r as LABEL_TEXT_STYLE, s as LabelLayoutContext, d as NestedBlock, c as useLabelLayout, u as useNestedLabelWidth };
|