@declarion/react 0.254.0 → 0.255.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/actions/ResponsiveActionBar.js +255 -239
- package/dist-lib/components/detail-layout/EvidenceBlock.js +10 -9
- package/dist-lib/components/fields/JsonField.js +8 -5
- package/dist-lib/components/pages/list/columns.js +79 -79
- package/dist-lib/components/primitives/Btn.js +3 -0
- package/dist-lib/components/primitives/IconBtn.js +2 -2
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useResponsiveMode.js +1 -1
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/lib/evidence-verdict.js +7 -20
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/{useResponsiveMode-DjoWkC2n.d.ts → useResponsiveMode-CgwjOaEE.d.ts} +2 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Pill as e } from "../primitives/Pill.js";
|
|
2
|
-
import {
|
|
2
|
+
import { evidenceVerdictPill as t } from "../../lib/evidence-verdict.js";
|
|
3
|
+
import { useSchema as n } from "../../hooks/useSchema.js";
|
|
3
4
|
import { useText as r } from "../../hooks/useText.js";
|
|
4
5
|
import { formatOffsetTimestamp as i } from "../../lib/timestamp.js";
|
|
5
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
@@ -8,8 +9,8 @@ function s(e, t) {
|
|
|
8
9
|
if (e && !Number.isNaN(new Date(e).getTime())) return i(e, { zone: t });
|
|
9
10
|
}
|
|
10
11
|
function c({ evidence: i }) {
|
|
11
|
-
let c = r(), l = i?.verdict ?? "unverified",
|
|
12
|
-
return i?.seq &&
|
|
12
|
+
let c = r(), { data: l } = n(), u = t(c, l?.enums, i?.verdict ?? "unverified"), d = s(i?.verified_at, c.timeZone), f = [];
|
|
13
|
+
return i?.seq && f.push(c("record.evidence.chain", "chain #{seq}", { seq: i.seq })), i?.generation && f.push(c("record.evidence.generation", "generation {number}", { number: i.generation })), /* @__PURE__ */ o("div", {
|
|
13
14
|
style: {
|
|
14
15
|
display: "flex",
|
|
15
16
|
flexDirection: "column",
|
|
@@ -31,25 +32,25 @@ function c({ evidence: i }) {
|
|
|
31
32
|
},
|
|
32
33
|
children: c("record.evidence.title", "Evidence")
|
|
33
34
|
}),
|
|
34
|
-
|
|
35
|
+
f.length > 0 && /* @__PURE__ */ a("span", {
|
|
35
36
|
style: {
|
|
36
37
|
fontSize: 12,
|
|
37
38
|
color: "var(--muted-foreground)"
|
|
38
39
|
},
|
|
39
|
-
children:
|
|
40
|
+
children: f.join(" · ")
|
|
40
41
|
}),
|
|
41
42
|
/* @__PURE__ */ a(e, {
|
|
42
|
-
tone:
|
|
43
|
+
tone: u.tone,
|
|
43
44
|
size: "sm",
|
|
44
45
|
dot: !0,
|
|
45
|
-
children:
|
|
46
|
+
children: u.label
|
|
46
47
|
}),
|
|
47
|
-
|
|
48
|
+
d && /* @__PURE__ */ a("span", {
|
|
48
49
|
style: {
|
|
49
50
|
fontSize: 12,
|
|
50
51
|
color: "var(--muted-foreground)"
|
|
51
52
|
},
|
|
52
|
-
children: c("record.evidence.verified", "Checked {when}", { when:
|
|
53
|
+
children: c("record.evidence.verified", "Checked {when}", { when: d })
|
|
53
54
|
})
|
|
54
55
|
]
|
|
55
56
|
}), i?.reason && /* @__PURE__ */ a("span", {
|
|
@@ -46,7 +46,9 @@ function m({ value: e, mode: t, onChange: n, fieldId: r }) {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
var h = {
|
|
49
|
-
|
|
49
|
+
display: "flex",
|
|
50
|
+
flexDirection: "column",
|
|
51
|
+
gap: 6,
|
|
50
52
|
border: "1px solid var(--border)",
|
|
51
53
|
borderRadius: "var(--radius-md)",
|
|
52
54
|
padding: 12,
|
|
@@ -77,9 +79,8 @@ var h = {
|
|
|
77
79
|
fontSize: 12.5,
|
|
78
80
|
overflowWrap: "anywhere"
|
|
79
81
|
}, x = {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
right: 6
|
|
82
|
+
display: "flex",
|
|
83
|
+
justifyContent: "flex-end"
|
|
83
84
|
};
|
|
84
85
|
function S({ value: r }) {
|
|
85
86
|
let a = n(), [s, f] = o(!1), p = s ? a("field.json.hide_source", "Hide JSON") : a("field.json.show_source", "Show JSON");
|
|
@@ -90,7 +91,9 @@ function S({ value: r }) {
|
|
|
90
91
|
children: /* @__PURE__ */ c(e, {
|
|
91
92
|
size: 22,
|
|
92
93
|
icon: /* @__PURE__ */ c(t.code, { size: 13 }),
|
|
93
|
-
onClick: (
|
|
94
|
+
onClick: (e) => {
|
|
95
|
+
e.stopPropagation(), f((e) => !e);
|
|
96
|
+
},
|
|
94
97
|
title: p,
|
|
95
98
|
"aria-label": p,
|
|
96
99
|
"aria-pressed": s
|
|
@@ -5,29 +5,29 @@ import { resolveCellRenderer as r } from "../../fields/cells/registry.js";
|
|
|
5
5
|
import { fieldDisplayName as i } from "../../../types/schema.js";
|
|
6
6
|
import { fieldAccessInfo as a, isFieldReadable as o } from "../../../lib/field-classification.js";
|
|
7
7
|
import { coerceDisplayString as s } from "../../../lib/display-value.js";
|
|
8
|
-
import {
|
|
9
|
-
import { renderSchemaField as
|
|
10
|
-
import { RowActionsCell as
|
|
11
|
-
import { MAX_COL_WIDTH as
|
|
12
|
-
import { createElement as
|
|
8
|
+
import { evidenceVerdictPill as c } from "../../../lib/evidence-verdict.js";
|
|
9
|
+
import { renderSchemaField as l, resolveSchemaFieldLabel as u } from "../../file-widgets/host.js";
|
|
10
|
+
import { RowActionsCell as d } from "./RowActionsCell.js";
|
|
11
|
+
import { MAX_COL_WIDTH as f } from "../../../stores/list-layout.js";
|
|
12
|
+
import { createElement as p } from "react";
|
|
13
13
|
// src/components/pages/list/columns.ts
|
|
14
|
-
function
|
|
14
|
+
function m(e, n, r, i, o) {
|
|
15
15
|
let s = a(r, i);
|
|
16
|
-
if (!s || s.read !== "denied") return o ?
|
|
16
|
+
if (!s || s.read !== "denied") return o ? p("span", { title: o }, n) : n;
|
|
17
17
|
let c = s.required_permission ? e("list.columns.locked_permission", "Locked column: requires \"{permission}\"", { permission: s.required_permission }) : e("list.columns.locked_classification", "Locked column: {classification} classification", { classification: s.classification });
|
|
18
|
-
return
|
|
18
|
+
return p("span", {
|
|
19
19
|
title: c,
|
|
20
20
|
"aria-label": c,
|
|
21
21
|
className: "inline-flex items-center gap-1"
|
|
22
|
-
},
|
|
22
|
+
}, p(t.lock, { size: 12 }), n);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function h(e) {
|
|
25
25
|
return {
|
|
26
26
|
minSize: Math.min(60, e),
|
|
27
|
-
maxSize: Math.max(
|
|
27
|
+
maxSize: Math.max(f, e)
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var g = 150, _ = {
|
|
31
31
|
date: 104,
|
|
32
32
|
time: 84,
|
|
33
33
|
bool: 80,
|
|
@@ -38,146 +38,146 @@ var _ = 150, v = {
|
|
|
38
38
|
enum: 130,
|
|
39
39
|
uuid: 110,
|
|
40
40
|
text: 240
|
|
41
|
-
},
|
|
42
|
-
function
|
|
41
|
+
}, v = 7, y = 40;
|
|
42
|
+
function b(e) {
|
|
43
43
|
let t = Math.max(0, ...e.map((e) => e.length));
|
|
44
|
-
return Math.max(140, t *
|
|
44
|
+
return Math.max(140, t * v + y);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
let { visibleCols: a, entity:
|
|
48
|
-
if (a.length === 0 || !
|
|
49
|
-
let
|
|
50
|
-
|
|
46
|
+
function x(t) {
|
|
47
|
+
let { visibleCols: a, entity: f, screen: v, schema: y, entityCode: x, rowActions: S, hasBatchActions: C, hasExplicitRowActions: w, canUpdate: T, canDelete: E, peekEnabled: D, hasDetailTarget: O, t: k, tabNavigate: A, refsRef: j, rowSelectionKey: M, setPeekRow: N } = t;
|
|
48
|
+
if (a.length === 0 || !f) return [];
|
|
49
|
+
let P = [];
|
|
50
|
+
C && P.push({
|
|
51
51
|
id: "_select",
|
|
52
52
|
enableResizing: !1,
|
|
53
|
-
header: ({ table: t }) =>
|
|
53
|
+
header: ({ table: t }) => p(e, {
|
|
54
54
|
checked: t.getIsAllRowsSelected(),
|
|
55
55
|
indeterminate: t.getIsSomeRowsSelected(),
|
|
56
56
|
onChange: () => t.toggleAllRowsSelected()
|
|
57
57
|
}),
|
|
58
58
|
size: 34,
|
|
59
|
-
cell: ({ row: t }) =>
|
|
59
|
+
cell: ({ row: t }) => p("span", { "data-testid": "row-select-checkbox" }, p(e, {
|
|
60
60
|
checked: t.getIsSelected(),
|
|
61
61
|
onChange: () => t.toggleSelected()
|
|
62
62
|
}))
|
|
63
63
|
});
|
|
64
64
|
for (let e of a) {
|
|
65
65
|
if (e.startsWith("$status.")) {
|
|
66
|
-
let t = e.slice(8), r =
|
|
66
|
+
let t = e.slice(8), r = f.status_groups?.[t];
|
|
67
67
|
if (!r) continue;
|
|
68
|
-
let i = new Map(r.statuses.map((e) => [e.code, e])), a =
|
|
69
|
-
|
|
68
|
+
let i = new Map(r.statuses.map((e) => [e.code, e])), a = b(r.statuses.map((e) => k(e.name) || e.code));
|
|
69
|
+
P.push({
|
|
70
70
|
id: e,
|
|
71
|
-
header:
|
|
71
|
+
header: k(r.name) || t,
|
|
72
72
|
size: a,
|
|
73
|
-
...
|
|
73
|
+
...h(a),
|
|
74
74
|
cell: ({ row: e }) => {
|
|
75
75
|
let r = e.original.$statuses?.find((e) => e.group_code === t);
|
|
76
|
-
if (!r) return
|
|
76
|
+
if (!r) return p("span", { className: "text-sm text-muted-foreground" }, "-");
|
|
77
77
|
let a = i.get(r.status_code);
|
|
78
|
-
return
|
|
78
|
+
return p(n, {
|
|
79
79
|
tone: a?.color ?? "slate",
|
|
80
80
|
size: "xs"
|
|
81
|
-
},
|
|
81
|
+
}, k(a?.name) || r.status_code);
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
continue;
|
|
85
85
|
}
|
|
86
86
|
if (e.startsWith("$property.")) {
|
|
87
|
-
let t = e.slice(10), n =
|
|
87
|
+
let t = e.slice(10), n = f.properties?.[t];
|
|
88
88
|
if (!n) continue;
|
|
89
|
-
|
|
89
|
+
P.push({
|
|
90
90
|
id: e,
|
|
91
|
-
header: () =>
|
|
91
|
+
header: () => m(k, k(n.name) || t, f, t, k(n.description) || void 0),
|
|
92
92
|
size: 150,
|
|
93
|
-
...
|
|
93
|
+
...h(150),
|
|
94
94
|
enableSorting: !1,
|
|
95
95
|
cell: ({ row: e }) => {
|
|
96
96
|
let n = e.original.$properties?.find((e) => e.property_code === t);
|
|
97
|
-
return !n || n.value == null ?
|
|
97
|
+
return !n || n.value == null ? p("span", { className: "text-sm text-muted-foreground" }, "-") : p("span", { className: "text-sm" }, s(n.value));
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
continue;
|
|
101
101
|
}
|
|
102
102
|
if (e === "$evidence") {
|
|
103
|
-
|
|
103
|
+
P.push({
|
|
104
104
|
id: e,
|
|
105
|
-
header:
|
|
105
|
+
header: k("list.columns.evidence", "Evidence"),
|
|
106
106
|
size: 140,
|
|
107
|
-
...
|
|
107
|
+
...h(140),
|
|
108
108
|
enableSorting: !1,
|
|
109
109
|
cell: ({ row: e }) => {
|
|
110
|
-
let t = e.original.$evidence?.verdict ?? "unverified";
|
|
111
|
-
return
|
|
112
|
-
tone:
|
|
110
|
+
let t = e.original.$evidence, r = c(k, y?.enums, t?.verdict ?? "unverified");
|
|
111
|
+
return p(n, {
|
|
112
|
+
tone: r.tone,
|
|
113
113
|
size: "xs",
|
|
114
114
|
dot: !0
|
|
115
|
-
},
|
|
115
|
+
}, r.label);
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
continue;
|
|
119
119
|
}
|
|
120
|
-
if (
|
|
121
|
-
|
|
120
|
+
if (f.files?.get(e)) {
|
|
121
|
+
P.push({
|
|
122
122
|
id: e,
|
|
123
123
|
accessorFn: (t) => t.$files?.[e] ?? null,
|
|
124
|
-
header: () =>
|
|
124
|
+
header: () => m(k, u(k, f, e, y?.entities), f, e),
|
|
125
125
|
size: 150,
|
|
126
|
-
...
|
|
127
|
-
cell: ({ row: t }) =>
|
|
128
|
-
entity:
|
|
129
|
-
entityCode:
|
|
126
|
+
...h(150),
|
|
127
|
+
cell: ({ row: t }) => l({
|
|
128
|
+
entity: f,
|
|
129
|
+
entityCode: x,
|
|
130
130
|
fieldName: e,
|
|
131
131
|
record: t.original,
|
|
132
132
|
mode: "display",
|
|
133
133
|
surface: "list",
|
|
134
|
-
refs:
|
|
135
|
-
t:
|
|
134
|
+
refs: j.current,
|
|
135
|
+
t: k
|
|
136
136
|
})
|
|
137
137
|
});
|
|
138
138
|
continue;
|
|
139
139
|
}
|
|
140
|
-
let t =
|
|
140
|
+
let t = f.fields.get(e);
|
|
141
141
|
if (!t) continue;
|
|
142
|
-
let a = i(
|
|
142
|
+
let a = i(k, t, e, y?.entities), d = t.display?.width ?? _[t.type] ?? g, v = r({
|
|
143
143
|
field: t,
|
|
144
144
|
fieldName: e,
|
|
145
145
|
surface: "list",
|
|
146
|
-
entity:
|
|
147
|
-
entityCode:
|
|
148
|
-
entities:
|
|
149
|
-
screens:
|
|
150
|
-
refs: () =>
|
|
151
|
-
t:
|
|
146
|
+
entity: f,
|
|
147
|
+
entityCode: x,
|
|
148
|
+
entities: y?.entities,
|
|
149
|
+
screens: y?.screens,
|
|
150
|
+
refs: () => j.current,
|
|
151
|
+
t: k
|
|
152
152
|
});
|
|
153
|
-
|
|
153
|
+
P.push({
|
|
154
154
|
id: e,
|
|
155
155
|
accessorKey: e,
|
|
156
|
-
header: () =>
|
|
157
|
-
enableSorting: t.type !== "json" && o(
|
|
158
|
-
size:
|
|
159
|
-
...
|
|
160
|
-
cell: ({ getValue: e, row: t }) =>
|
|
156
|
+
header: () => m(k, a, f, e, k(t.display?.description) || void 0),
|
|
157
|
+
enableSorting: t.type !== "json" && o(f, e),
|
|
158
|
+
size: d,
|
|
159
|
+
...h(d),
|
|
160
|
+
cell: ({ getValue: e, row: t }) => v(e(), t.original)
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
return (!
|
|
163
|
+
return (!w && T || !w && E || S.length > 0) && P.push({
|
|
164
164
|
id: "_actions",
|
|
165
165
|
enableResizing: !1,
|
|
166
166
|
header: "",
|
|
167
167
|
size: 40,
|
|
168
|
-
cell: ({ row: e }) =>
|
|
168
|
+
cell: ({ row: e }) => p(d, {
|
|
169
169
|
row: e.original,
|
|
170
|
-
rowId:
|
|
171
|
-
screen:
|
|
172
|
-
fullScreen:
|
|
173
|
-
entity:
|
|
174
|
-
entityCode:
|
|
175
|
-
rowActions:
|
|
176
|
-
tabNavigate:
|
|
177
|
-
peekAllowed:
|
|
178
|
-
hasDetailTarget:
|
|
179
|
-
onPeek:
|
|
170
|
+
rowId: M(f, e.original),
|
|
171
|
+
screen: v,
|
|
172
|
+
fullScreen: v,
|
|
173
|
+
entity: f,
|
|
174
|
+
entityCode: x,
|
|
175
|
+
rowActions: S,
|
|
176
|
+
tabNavigate: A,
|
|
177
|
+
peekAllowed: D,
|
|
178
|
+
hasDetailTarget: O,
|
|
179
|
+
onPeek: N
|
|
180
180
|
})
|
|
181
|
-
}),
|
|
181
|
+
}), P;
|
|
182
182
|
}
|
|
183
|
-
export {
|
|
183
|
+
export { x as buildListColumns };
|
|
@@ -8,6 +8,9 @@ var n = e(function({ kind: e = "default", size: n = "sm", icon: r, iconRight: i,
|
|
|
8
8
|
gap: 6,
|
|
9
9
|
height: n === "xs" ? 24 : n === "sm" ? 28 : n === "md" ? 32 : 36,
|
|
10
10
|
padding: `0 ${n === "xs" ? 8 : n === "sm" ? 10 : n === "md" ? 12 : 14}px`,
|
|
11
|
+
minWidth: "var(--touch-target-min-size)",
|
|
12
|
+
minHeight: "var(--touch-target-min-size)",
|
|
13
|
+
justifyContent: "center",
|
|
11
14
|
borderRadius: "var(--radius-md)",
|
|
12
15
|
fontSize: n === "xs" ? 11.5 : 12.5,
|
|
13
16
|
fontWeight: 500,
|
|
@@ -15,8 +15,8 @@ var n = e(function({ icon: e, onClick: n, title: r, size: i = 28, active: a, dis
|
|
|
15
15
|
justifyContent: "center",
|
|
16
16
|
width: i,
|
|
17
17
|
height: i,
|
|
18
|
-
minWidth: "var(--
|
|
19
|
-
minHeight: "var(--
|
|
18
|
+
minWidth: "var(--touch-target-min-size)",
|
|
19
|
+
minHeight: "var(--touch-target-min-size)",
|
|
20
20
|
borderRadius: "var(--radius-md)",
|
|
21
21
|
border: "1px solid transparent",
|
|
22
22
|
background: a ? "var(--surface-3)" : "transparent",
|