@declarion/react 0.255.0 → 0.302.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/detail-layout/DetailHighlights.js +40 -40
- package/dist-lib/components/detail-layout/useQuickAdd.js +45 -47
- package/dist-lib/components/fields/EnumField.js +25 -25
- package/dist-lib/components/fields/cells/factories/badge.js +14 -27
- package/dist-lib/components/fields/cells/factories/statusPill.js +13 -26
- package/dist-lib/components/fields/cells/factories/tagList.js +13 -26
- package/dist-lib/components/pages/SmartDetailPage.impl.js +416 -415
- package/dist-lib/components/pages/auth/AuthShell.js +57 -76
- package/dist-lib/components/pages/list/ListCardRow.js +66 -66
- package/dist-lib/components/pages/list/columns.js +89 -89
- package/dist-lib/components/pages/profile/Profile.impl.js +130 -126
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +107 -109
- package/dist-lib/components/params/ParamsBlock.js +42 -37
- package/dist-lib/components/params/param-editors.js +20 -33
- package/dist-lib/components/primitives/Pill.js +36 -15
- package/dist-lib/components/shared/StatusGroupsDisplay.js +49 -49
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useDeclaredEnum.js +38 -0
- package/dist-lib/index.d.ts +34 -12
- package/dist-lib/index.js +123 -122
- package/dist-lib/lib/evidence-verdict.js +6 -5
- package/dist-lib/lib/fill-from.js +15 -0
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/{useResponsiveMode-CgwjOaEE.d.ts → useResponsiveMode-CBSHZBY5.d.ts} +1 -0
- package/package.json +1 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { Check as e } from "../../primitives/Check.js";
|
|
2
2
|
import { Icon as t } from "../../primitives/Icons.js";
|
|
3
|
-
import { Pill as n } from "../../primitives/Pill.js";
|
|
4
|
-
import { resolveCellRenderer as
|
|
5
|
-
import { fieldDisplayName as
|
|
6
|
-
import { fieldAccessInfo as
|
|
7
|
-
import { coerceDisplayString as
|
|
8
|
-
import { evidenceVerdictPill as
|
|
9
|
-
import { renderSchemaField as
|
|
10
|
-
import { RowActionsCell as
|
|
11
|
-
import { MAX_COL_WIDTH as
|
|
12
|
-
import { createElement as
|
|
3
|
+
import { Pill as n, pillColor as r } from "../../primitives/Pill.js";
|
|
4
|
+
import { resolveCellRenderer as i } from "../../fields/cells/registry.js";
|
|
5
|
+
import { fieldDisplayName as a } from "../../../types/schema.js";
|
|
6
|
+
import { fieldAccessInfo as o, isFieldReadable as s } from "../../../lib/field-classification.js";
|
|
7
|
+
import { coerceDisplayString as c } from "../../../lib/display-value.js";
|
|
8
|
+
import { evidenceVerdictPill as l } from "../../../lib/evidence-verdict.js";
|
|
9
|
+
import { renderSchemaField as u, resolveSchemaFieldLabel as d } from "../../file-widgets/host.js";
|
|
10
|
+
import { RowActionsCell as f } from "./RowActionsCell.js";
|
|
11
|
+
import { MAX_COL_WIDTH as p } from "../../../stores/list-layout.js";
|
|
12
|
+
import { createElement as m } from "react";
|
|
13
13
|
// src/components/pages/list/columns.ts
|
|
14
|
-
function
|
|
15
|
-
let s =
|
|
16
|
-
if (!s || s.read !== "denied") return
|
|
14
|
+
function h(e, n, r, i, a) {
|
|
15
|
+
let s = o(r, i);
|
|
16
|
+
if (!s || s.read !== "denied") return a ? m("span", { title: a }, 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 m("span", {
|
|
19
19
|
title: c,
|
|
20
20
|
"aria-label": c,
|
|
21
21
|
className: "inline-flex items-center gap-1"
|
|
22
|
-
},
|
|
22
|
+
}, m(t.lock, { size: 12 }), n);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function g(e) {
|
|
25
25
|
return {
|
|
26
26
|
minSize: Math.min(60, e),
|
|
27
|
-
maxSize: Math.max(
|
|
27
|
+
maxSize: Math.max(p, e)
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var _ = 150, v = {
|
|
31
31
|
date: 104,
|
|
32
32
|
time: 84,
|
|
33
33
|
bool: 80,
|
|
@@ -38,77 +38,77 @@ var g = 150, _ = {
|
|
|
38
38
|
enum: 130,
|
|
39
39
|
uuid: 110,
|
|
40
40
|
text: 240
|
|
41
|
-
},
|
|
42
|
-
function
|
|
41
|
+
}, y = 7, b = 40;
|
|
42
|
+
function x(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 * y + b);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
let { visibleCols:
|
|
48
|
-
if (
|
|
49
|
-
let
|
|
50
|
-
|
|
46
|
+
function S(t) {
|
|
47
|
+
let { visibleCols: o, entity: p, screen: y, schema: b, entityCode: S, rowActions: C, hasBatchActions: w, hasExplicitRowActions: T, canUpdate: E, canDelete: D, peekEnabled: O, hasDetailTarget: k, t: A, tabNavigate: j, refsRef: M, rowSelectionKey: N, setPeekRow: P } = t;
|
|
48
|
+
if (o.length === 0 || !p) return [];
|
|
49
|
+
let F = [];
|
|
50
|
+
w && F.push({
|
|
51
51
|
id: "_select",
|
|
52
52
|
enableResizing: !1,
|
|
53
|
-
header: ({ table: t }) =>
|
|
53
|
+
header: ({ table: t }) => m(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 }) => m("span", { "data-testid": "row-select-checkbox" }, m(e, {
|
|
60
60
|
checked: t.getIsSelected(),
|
|
61
61
|
onChange: () => t.toggleSelected()
|
|
62
62
|
}))
|
|
63
63
|
});
|
|
64
|
-
for (let e of
|
|
64
|
+
for (let e of o) {
|
|
65
65
|
if (e.startsWith("$status.")) {
|
|
66
|
-
let t = e.slice(8),
|
|
67
|
-
if (!
|
|
68
|
-
let
|
|
69
|
-
|
|
66
|
+
let t = e.slice(8), i = p.status_groups?.[t];
|
|
67
|
+
if (!i) continue;
|
|
68
|
+
let a = new Map(i.statuses.map((e) => [e.code, e])), o = x(i.statuses.map((e) => A(e.name) || e.code));
|
|
69
|
+
F.push({
|
|
70
70
|
id: e,
|
|
71
|
-
header:
|
|
72
|
-
size:
|
|
73
|
-
...
|
|
71
|
+
header: A(i.name) || t,
|
|
72
|
+
size: o,
|
|
73
|
+
...g(o),
|
|
74
74
|
cell: ({ row: e }) => {
|
|
75
|
-
let
|
|
76
|
-
if (!
|
|
77
|
-
let
|
|
78
|
-
return
|
|
79
|
-
tone:
|
|
75
|
+
let i = e.original.$statuses?.find((e) => e.group_code === t);
|
|
76
|
+
if (!i) return m("span", { className: "text-sm text-muted-foreground" }, "-");
|
|
77
|
+
let o = a.get(i.status_code);
|
|
78
|
+
return m(n, {
|
|
79
|
+
tone: r(o?.color),
|
|
80
80
|
size: "xs"
|
|
81
|
-
},
|
|
81
|
+
}, A(o?.name) || i.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 = p.properties?.[t];
|
|
88
88
|
if (!n) continue;
|
|
89
|
-
|
|
89
|
+
F.push({
|
|
90
90
|
id: e,
|
|
91
|
-
header: () =>
|
|
91
|
+
header: () => h(A, A(n.name) || t, p, t, A(n.description) || void 0),
|
|
92
92
|
size: 150,
|
|
93
|
-
...
|
|
93
|
+
...g(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 ? m("span", { className: "text-sm text-muted-foreground" }, "-") : m("span", { className: "text-sm" }, c(n.value));
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
continue;
|
|
101
101
|
}
|
|
102
102
|
if (e === "$evidence") {
|
|
103
|
-
|
|
103
|
+
F.push({
|
|
104
104
|
id: e,
|
|
105
|
-
header:
|
|
105
|
+
header: A("list.columns.evidence", "Evidence"),
|
|
106
106
|
size: 140,
|
|
107
|
-
...
|
|
107
|
+
...g(140),
|
|
108
108
|
enableSorting: !1,
|
|
109
109
|
cell: ({ row: e }) => {
|
|
110
|
-
let t = e.original.$evidence, r =
|
|
111
|
-
return
|
|
110
|
+
let t = e.original.$evidence, r = l(A, b?.enums, t?.verdict ?? "unverified");
|
|
111
|
+
return m(n, {
|
|
112
112
|
tone: r.tone,
|
|
113
113
|
size: "xs",
|
|
114
114
|
dot: !0
|
|
@@ -117,67 +117,67 @@ function x(t) {
|
|
|
117
117
|
});
|
|
118
118
|
continue;
|
|
119
119
|
}
|
|
120
|
-
if (
|
|
121
|
-
|
|
120
|
+
if (p.files?.get(e)) {
|
|
121
|
+
F.push({
|
|
122
122
|
id: e,
|
|
123
123
|
accessorFn: (t) => t.$files?.[e] ?? null,
|
|
124
|
-
header: () =>
|
|
124
|
+
header: () => h(A, d(A, p, e, b?.entities), p, e),
|
|
125
125
|
size: 150,
|
|
126
|
-
...
|
|
127
|
-
cell: ({ row: t }) =>
|
|
128
|
-
entity:
|
|
129
|
-
entityCode:
|
|
126
|
+
...g(150),
|
|
127
|
+
cell: ({ row: t }) => u({
|
|
128
|
+
entity: p,
|
|
129
|
+
entityCode: S,
|
|
130
130
|
fieldName: e,
|
|
131
131
|
record: t.original,
|
|
132
132
|
mode: "display",
|
|
133
133
|
surface: "list",
|
|
134
|
-
refs:
|
|
135
|
-
t:
|
|
134
|
+
refs: M.current,
|
|
135
|
+
t: A
|
|
136
136
|
})
|
|
137
137
|
});
|
|
138
138
|
continue;
|
|
139
139
|
}
|
|
140
|
-
let t =
|
|
140
|
+
let t = p.fields.get(e);
|
|
141
141
|
if (!t) continue;
|
|
142
|
-
let
|
|
142
|
+
let o = a(A, t, e, b?.entities), f = t.display?.width ?? v[t.type] ?? _, y = i({
|
|
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: p,
|
|
147
|
+
entityCode: S,
|
|
148
|
+
entities: b?.entities,
|
|
149
|
+
screens: b?.screens,
|
|
150
|
+
refs: () => M.current,
|
|
151
|
+
t: A
|
|
152
152
|
});
|
|
153
|
-
|
|
153
|
+
F.push({
|
|
154
154
|
id: e,
|
|
155
155
|
accessorKey: e,
|
|
156
|
-
header: () =>
|
|
157
|
-
enableSorting: t.type !== "json" &&
|
|
158
|
-
size:
|
|
159
|
-
...
|
|
160
|
-
cell: ({ getValue: e, row: t }) =>
|
|
156
|
+
header: () => h(A, o, p, e, A(t.display?.description) || void 0),
|
|
157
|
+
enableSorting: t.type !== "json" && s(p, e),
|
|
158
|
+
size: f,
|
|
159
|
+
...g(f),
|
|
160
|
+
cell: ({ getValue: e, row: t }) => y(e(), t.original)
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
return (!
|
|
163
|
+
return (!T && E || !T && D || C.length > 0) && F.push({
|
|
164
164
|
id: "_actions",
|
|
165
165
|
enableResizing: !1,
|
|
166
166
|
header: "",
|
|
167
167
|
size: 40,
|
|
168
|
-
cell: ({ row: e }) =>
|
|
168
|
+
cell: ({ row: e }) => m(f, {
|
|
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: N(p, e.original),
|
|
171
|
+
screen: y,
|
|
172
|
+
fullScreen: y,
|
|
173
|
+
entity: p,
|
|
174
|
+
entityCode: S,
|
|
175
|
+
rowActions: C,
|
|
176
|
+
tabNavigate: j,
|
|
177
|
+
peekAllowed: O,
|
|
178
|
+
hasDetailTarget: k,
|
|
179
|
+
onPeek: P
|
|
180
180
|
})
|
|
181
|
-
}),
|
|
181
|
+
}), F;
|
|
182
182
|
}
|
|
183
|
-
export {
|
|
183
|
+
export { S as buildListColumns };
|