@declarion/react 0.87.0 → 0.89.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/app.js +28 -28
- package/dist-lib/components/actions/ActionButton.js +86 -85
- package/dist-lib/components/actions/ActionResultDialog.impl.js +47 -47
- package/dist-lib/components/actions/ActionRunner.js +47 -47
- package/dist-lib/components/actions/ObjectActionBar.js +9 -9
- package/dist-lib/components/actions/RowActionsKebab.js +19 -19
- package/dist-lib/components/agents/AgentChatPanel.impl.js +53 -53
- package/dist-lib/components/chrome/AssociationTabs.js +21 -21
- package/dist-lib/components/chrome/RecordHeader.js +33 -40
- package/dist-lib/components/detail-layout/AssociatedBlock.js +387 -381
- package/dist-lib/components/detail-layout/ChildrenBlock.js +12 -13
- package/dist-lib/components/detail-layout/ChildrenTimeline.js +198 -198
- package/dist-lib/components/detail-layout/DraggableChildrenTable.js +114 -114
- package/dist-lib/components/detail-layout/EditableChildrenTable.js +160 -160
- package/dist-lib/components/detail-layout/EvidenceBlock.js +20 -21
- package/dist-lib/components/detail-layout/PropertiesBlock.js +45 -39
- package/dist-lib/components/detail-layout/QuickAddForm.js +9 -9
- package/dist-lib/components/detail-layout/TimelineComposer.js +87 -89
- package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +100 -99
- package/dist-lib/components/fields/FileReferenceField.js +9 -9
- package/dist-lib/components/fields/StructureField.js +57 -47
- package/dist-lib/components/fields/TimestampField.js +59 -54
- package/dist-lib/components/fields/cells/factories/money.js +14 -23
- package/dist-lib/components/fields/cells/factories/nextRun.js +1 -1
- package/dist-lib/components/fields/cells/factories/text.js +18 -3
- package/dist-lib/components/fields/cells/factories/timestamp.js +24 -12
- package/dist-lib/components/file-widgets/DocumentCard.js +108 -106
- package/dist-lib/components/layout/Layout.js +306 -361
- package/dist-lib/components/layout/Rail.js +42 -41
- package/dist-lib/components/layout/Sidebar.js +132 -117
- package/dist-lib/components/layout/TabStrip.js +116 -115
- package/dist-lib/components/layout/TenantChip.js +47 -54
- package/dist-lib/components/layout/TopBar.js +108 -105
- package/dist-lib/components/list/InlineEditCell.js +23 -23
- package/dist-lib/components/list/QuickPeek.js +65 -66
- package/dist-lib/components/pages/DocumentsMenu.js +42 -42
- package/dist-lib/components/pages/ExportMenu.js +25 -25
- package/dist-lib/components/pages/RecordDocumentsPanel.js +35 -35
- package/dist-lib/components/pages/RecordNotesPanel.js +94 -93
- package/dist-lib/components/pages/SmartDetailPage.impl.js +421 -417
- package/dist-lib/components/pages/SmartListPage.impl.js +293 -295
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +310 -310
- package/dist-lib/components/pages/auth/AuthShell.js +73 -73
- package/dist-lib/components/pages/auth/SignIn.js +32 -32
- package/dist-lib/components/pages/auth/SignUp.impl.js +3 -3
- package/dist-lib/components/pages/auth/SignUpCode.js +9 -9
- package/dist-lib/components/pages/list/ListFloatbar.js +12 -12
- package/dist-lib/components/pages/list/ListHeader.js +19 -19
- package/dist-lib/components/pages/list/ListNoRows.js +15 -15
- package/dist-lib/components/pages/list/ListToolbar.js +145 -145
- package/dist-lib/components/pages/list/useActiveView.js +14 -5
- package/dist-lib/components/pages/list/useListQuery.js +121 -81
- package/dist-lib/components/pages/list/useListRowInteraction.js +70 -70
- package/dist-lib/components/pages/list/useRowMenu.js +7 -7
- package/dist-lib/components/pages/profile/Preferences.impl.js +81 -78
- package/dist-lib/components/pages/profile/Profile.impl.js +191 -189
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +166 -158
- package/dist-lib/components/shared/ChangePasswordDialog.impl.js +23 -23
- package/dist-lib/components/shared/MarkdownRenderer.js +9 -9
- package/dist-lib/hooks/useAuth.js +11 -11
- package/dist-lib/hooks/useBranding.js +4 -4
- package/dist-lib/hooks/useDisplayTimeZone.js +8 -0
- package/dist-lib/hooks/useFollowAgentOpen.js +24 -24
- package/dist-lib/hooks/useImpersonation.js +6 -6
- package/dist-lib/hooks/useMutations.js +23 -23
- package/dist-lib/hooks/useObjectStatus.js +5 -5
- package/dist-lib/hooks/useParams.js +59 -51
- package/dist-lib/hooks/useProperties.js +8 -8
- package/dist-lib/hooks/useRowTenant.js +18 -6
- package/dist-lib/hooks/useText.js +9 -7
- package/dist-lib/hooks/useUiPreferences.js +71 -0
- package/dist-lib/index.d.ts +22 -6
- package/dist-lib/index.js +127 -126
- package/dist-lib/lib/actions.js +116 -84
- package/dist-lib/lib/child-config.js +10 -1
- package/dist-lib/lib/format-count.js +16 -1
- package/dist-lib/lib/language.js +23 -21
- package/dist-lib/lib/money-text.js +29 -0
- package/dist-lib/lib/profile.js +4 -0
- package/dist-lib/lib/role-label.js +8 -0
- package/dist-lib/lib/schema-routing.js +34 -14
- package/dist-lib/lib/shortcut.js +10 -0
- package/dist-lib/lib/timestamp.js +93 -31
- package/dist-lib/stores/auth.js +9 -8
- package/dist-lib/stores/preferences.js +56 -17
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/testing.js +25 -28
- package/dist-lib/types/schema.js +33 -27
- package/dist-lib/{useResponsiveMode-D3SKz5z4.d.ts → useResponsiveMode-9_eJT18k.d.ts} +5 -5
- package/package.json +1 -1
|
@@ -1,80 +1,80 @@
|
|
|
1
1
|
import { coerceDisplayString as e } from "../../lib/display-value.js";
|
|
2
|
-
import { fieldDisplayName as t } from "../../types/schema.js";
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { Btn as
|
|
5
|
-
import { IconBtn as
|
|
6
|
-
import { useText as
|
|
7
|
-
import { useResponsiveMode as
|
|
8
|
-
import { renderField as
|
|
9
|
-
import { dataTableHeadCellStyle as
|
|
10
|
-
import { useCallback as
|
|
11
|
-
import { Fragment as
|
|
2
|
+
import { fieldDisplayName as t, isUserEditableField as n } from "../../types/schema.js";
|
|
3
|
+
import { Icon as r } from "../primitives/Icons.js";
|
|
4
|
+
import { Btn as i } from "../primitives/Btn.js";
|
|
5
|
+
import { IconBtn as a } from "../primitives/IconBtn.js";
|
|
6
|
+
import { useText as o } from "../../hooks/useText.js";
|
|
7
|
+
import { useResponsiveMode as s } from "../../hooks/useResponsiveMode.js";
|
|
8
|
+
import { renderField as c } from "../fields/index.js";
|
|
9
|
+
import { dataTableHeadCellStyle as l, dataTableStyle as u } from "../primitives/dataTableStyles.js";
|
|
10
|
+
import { useCallback as d, useRef as f } from "react";
|
|
11
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
12
|
//#region src/components/detail-layout/EditableChildrenTable.tsx
|
|
13
|
-
function
|
|
14
|
-
let
|
|
15
|
-
if (
|
|
16
|
-
let t =
|
|
17
|
-
return !(!t || t
|
|
18
|
-
}),
|
|
19
|
-
if (
|
|
20
|
-
let t =
|
|
21
|
-
return t && (t
|
|
22
|
-
})),
|
|
23
|
-
y
|
|
13
|
+
function g({ config: g, childEntity: _, schema: v, rows: y, onChange: b, validationErrors: x, refs: S, forceTablePresentation: C = !1 }) {
|
|
14
|
+
let w = o(), T = s(), E = f(null), D = g.columns, O = g.position_field, k = new Set(Array.isArray(g.foreign_key) ? g.foreign_key : [g.foreign_key]), A = D.filter((e) => {
|
|
15
|
+
if (k.has(e) || g.position_field && e === g.position_field) return !1;
|
|
16
|
+
let t = _.fields.get(e);
|
|
17
|
+
return !(!t || !n(t));
|
|
18
|
+
}), j = new Set(D.filter((e) => {
|
|
19
|
+
if (g.position_field && e === g.position_field) return !0;
|
|
20
|
+
let t = _.fields.get(e);
|
|
21
|
+
return t && !n(t);
|
|
22
|
+
})), M = d((e, t, n) => {
|
|
23
|
+
b(y.map((r) => r._key === e ? {
|
|
24
24
|
...r,
|
|
25
25
|
[t]: n,
|
|
26
26
|
_dirty: !0
|
|
27
27
|
} : r));
|
|
28
|
-
}, [
|
|
28
|
+
}, [y, b]), N = d(() => {
|
|
29
29
|
let e = {
|
|
30
30
|
_key: crypto.randomUUID(),
|
|
31
31
|
_dirty: !0
|
|
32
32
|
};
|
|
33
|
-
if (
|
|
34
|
-
let t =
|
|
35
|
-
let n = typeof t[
|
|
33
|
+
if (O) {
|
|
34
|
+
let t = y.filter((e) => !e._deleted).reduce((e, t) => {
|
|
35
|
+
let n = typeof t[O] == "number" ? t[O] : -1;
|
|
36
36
|
return Math.max(e, n);
|
|
37
37
|
}, -1);
|
|
38
|
-
e[
|
|
38
|
+
e[O] = t + 1;
|
|
39
39
|
}
|
|
40
|
-
let t =
|
|
41
|
-
for (let n of
|
|
42
|
-
let r =
|
|
40
|
+
let t = g.quick_add?.defaults ?? {};
|
|
41
|
+
for (let n of A) {
|
|
42
|
+
let r = _.fields.get(n);
|
|
43
43
|
r && (t[n] === void 0 ? r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default : e[n] = t[n]);
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
b([...y, e]);
|
|
46
46
|
}, [
|
|
47
|
-
v,
|
|
48
47
|
y,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
b,
|
|
49
|
+
A,
|
|
50
|
+
_,
|
|
51
|
+
g.quick_add?.defaults,
|
|
52
|
+
O
|
|
53
|
+
]), P = d((e) => {
|
|
54
|
+
b(y.map((t) => t._key === e ? {
|
|
55
55
|
...t,
|
|
56
56
|
_deleted: !0
|
|
57
57
|
} : t));
|
|
58
|
-
}, [
|
|
59
|
-
y
|
|
58
|
+
}, [y, b]), F = d((e) => {
|
|
59
|
+
b(y.map((t) => t._key === e ? {
|
|
60
60
|
...t,
|
|
61
61
|
_deleted: !1
|
|
62
62
|
} : t));
|
|
63
|
-
}, [
|
|
64
|
-
if (!
|
|
65
|
-
let n =
|
|
63
|
+
}, [y, b]), I = d((e, t) => {
|
|
64
|
+
if (!O) return;
|
|
65
|
+
let n = y.filter((e) => !e._deleted), r = y.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), a = i + t;
|
|
66
66
|
if (i < 0 || a < 0 || a >= n.length) return;
|
|
67
67
|
let o = [...n], [s] = o.splice(i, 1);
|
|
68
|
-
o.splice(a, 0, s),
|
|
68
|
+
o.splice(a, 0, s), b([...o.map((e, t) => ({
|
|
69
69
|
...e,
|
|
70
|
-
[
|
|
71
|
-
_dirty: e[
|
|
70
|
+
[O]: t,
|
|
71
|
+
_dirty: e[O] !== t || e._dirty
|
|
72
72
|
})), ...r]);
|
|
73
73
|
}, [
|
|
74
|
-
v,
|
|
75
74
|
y,
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
b,
|
|
76
|
+
O
|
|
77
|
+
]), L = d((e) => {
|
|
78
78
|
let t = e.target, n = t.closest("td");
|
|
79
79
|
if (!n) return;
|
|
80
80
|
let r = n.closest("tr");
|
|
@@ -98,7 +98,7 @@ function h({ config: h, childEntity: g, schema: _, rows: v, onChange: y, validat
|
|
|
98
98
|
if (o < t.length - 1) {
|
|
99
99
|
let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
|
|
100
100
|
e && e.focus();
|
|
101
|
-
} else
|
|
101
|
+
} else N(), requestAnimationFrame(() => {
|
|
102
102
|
let e = i.querySelectorAll("tr"), t = e[e.length - 1];
|
|
103
103
|
if (t) {
|
|
104
104
|
let e = t.querySelector("input, select, textarea, [tabindex]");
|
|
@@ -106,16 +106,16 @@ function h({ config: h, childEntity: g, schema: _, rows: v, onChange: y, validat
|
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
} else e.key === "Escape" && t.blur?.();
|
|
109
|
-
}, [
|
|
110
|
-
return
|
|
109
|
+
}, [N]), R = l;
|
|
110
|
+
return T.isPhone && !C ? /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
|
|
111
111
|
style: {
|
|
112
112
|
display: "flex",
|
|
113
113
|
flexDirection: "column",
|
|
114
114
|
gap: 10
|
|
115
115
|
},
|
|
116
|
-
children:
|
|
117
|
-
let o = !!
|
|
118
|
-
return /* @__PURE__ */
|
|
116
|
+
children: y.map((n, i) => {
|
|
117
|
+
let o = !!n._deleted, s = x?.[n._key], l = O ? y.filter((e) => !e._deleted) : [], u = O ? l.findIndex((e) => e._key === n._key) : -1;
|
|
118
|
+
return /* @__PURE__ */ h("div", {
|
|
119
119
|
style: {
|
|
120
120
|
border: "1px solid var(--border)",
|
|
121
121
|
borderRadius: "var(--radius-md)",
|
|
@@ -123,7 +123,7 @@ function h({ config: h, childEntity: g, schema: _, rows: v, onChange: y, validat
|
|
|
123
123
|
opacity: o ? .58 : 1,
|
|
124
124
|
overflow: "hidden"
|
|
125
125
|
},
|
|
126
|
-
children: [/* @__PURE__ */
|
|
126
|
+
children: [/* @__PURE__ */ h("div", {
|
|
127
127
|
style: {
|
|
128
128
|
minHeight: 38,
|
|
129
129
|
padding: "8px 10px",
|
|
@@ -133,61 +133,61 @@ function h({ config: h, childEntity: g, schema: _, rows: v, onChange: y, validat
|
|
|
133
133
|
justifyContent: "space-between",
|
|
134
134
|
gap: 8
|
|
135
135
|
},
|
|
136
|
-
children: [/* @__PURE__ */
|
|
136
|
+
children: [/* @__PURE__ */ m("div", {
|
|
137
137
|
style: {
|
|
138
138
|
fontSize: 12,
|
|
139
139
|
fontWeight: 600,
|
|
140
140
|
color: "var(--text-2)"
|
|
141
141
|
},
|
|
142
|
-
children:
|
|
143
|
-
}), /* @__PURE__ */
|
|
142
|
+
children: w("record.row.number", "Row {number}", { number: i + 1 })
|
|
143
|
+
}), /* @__PURE__ */ h("div", {
|
|
144
144
|
style: {
|
|
145
145
|
display: "flex",
|
|
146
146
|
alignItems: "center",
|
|
147
147
|
gap: 4
|
|
148
148
|
},
|
|
149
|
-
children: [
|
|
149
|
+
children: [O && !o && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(a, {
|
|
150
150
|
size: 32,
|
|
151
|
-
icon: /* @__PURE__ */
|
|
152
|
-
onClick: () =>
|
|
151
|
+
icon: /* @__PURE__ */ m(r.up, { size: 14 }),
|
|
152
|
+
onClick: () => I(n._key, -1),
|
|
153
153
|
disabled: u <= 0,
|
|
154
|
-
title:
|
|
155
|
-
}), /* @__PURE__ */
|
|
154
|
+
title: w("record.row.move_up", "Move row up")
|
|
155
|
+
}), /* @__PURE__ */ m(a, {
|
|
156
156
|
size: 32,
|
|
157
|
-
icon: /* @__PURE__ */
|
|
158
|
-
onClick: () =>
|
|
157
|
+
icon: /* @__PURE__ */ m(r.down, { size: 14 }),
|
|
158
|
+
onClick: () => I(n._key, 1),
|
|
159
159
|
disabled: u === -1 || u >= l.length - 1,
|
|
160
|
-
title:
|
|
161
|
-
})] }), o ? /* @__PURE__ */
|
|
160
|
+
title: w("record.row.move_down", "Move row down")
|
|
161
|
+
})] }), o ? /* @__PURE__ */ m(a, {
|
|
162
162
|
size: 32,
|
|
163
|
-
icon: /* @__PURE__ */
|
|
164
|
-
onClick: () =>
|
|
165
|
-
title:
|
|
166
|
-
}) : /* @__PURE__ */
|
|
163
|
+
icon: /* @__PURE__ */ m(r.refresh, { size: 14 }),
|
|
164
|
+
onClick: () => F(n._key),
|
|
165
|
+
title: w("record.row.undo_delete", "Undo delete")
|
|
166
|
+
}) : /* @__PURE__ */ m(a, {
|
|
167
167
|
size: 32,
|
|
168
|
-
icon: /* @__PURE__ */
|
|
169
|
-
onClick: () =>
|
|
170
|
-
title:
|
|
168
|
+
icon: /* @__PURE__ */ m(r.trash, { size: 14 }),
|
|
169
|
+
onClick: () => P(n._key),
|
|
170
|
+
title: w("record.row.delete", "Delete row")
|
|
171
171
|
})]
|
|
172
172
|
})]
|
|
173
|
-
}), /* @__PURE__ */
|
|
173
|
+
}), /* @__PURE__ */ m("div", {
|
|
174
174
|
style: {
|
|
175
175
|
padding: 10,
|
|
176
176
|
display: "flex",
|
|
177
177
|
flexDirection: "column",
|
|
178
178
|
gap: 12
|
|
179
179
|
},
|
|
180
|
-
children:
|
|
181
|
-
let i =
|
|
180
|
+
children: D.map((r) => {
|
|
181
|
+
let i = _.fields.get(r), a = s?.includes(r), l = j.has(r), u = i ? t(w, i, r, v.entities) : r, d = `child-${n._key}-${r}`, f = `${d}-label`, p = {
|
|
182
182
|
outline: a ? "1px solid var(--danger)" : "none",
|
|
183
183
|
outlineOffset: 3,
|
|
184
184
|
borderRadius: a ? "var(--radius-sm)" : 0
|
|
185
|
-
},
|
|
185
|
+
}, g = {
|
|
186
186
|
fontSize: 11.5,
|
|
187
187
|
fontWeight: 600,
|
|
188
188
|
color: "var(--text-3)"
|
|
189
189
|
}, y = !o && !l && !!i;
|
|
190
|
-
return /* @__PURE__ */
|
|
190
|
+
return /* @__PURE__ */ h("div", {
|
|
191
191
|
style: {
|
|
192
192
|
display: "flex",
|
|
193
193
|
flexDirection: "column",
|
|
@@ -195,95 +195,95 @@ function h({ config: h, childEntity: g, schema: _, rows: v, onChange: y, validat
|
|
|
195
195
|
minWidth: 0,
|
|
196
196
|
textDecoration: o ? "line-through" : "none"
|
|
197
197
|
},
|
|
198
|
-
title: a ?
|
|
199
|
-
children: [y ? /* @__PURE__ */
|
|
198
|
+
title: a ? w("record.row.field_required", "{field} is required", { field: r }) : void 0,
|
|
199
|
+
children: [y ? /* @__PURE__ */ m("label", {
|
|
200
200
|
id: f,
|
|
201
201
|
htmlFor: d,
|
|
202
|
-
style:
|
|
202
|
+
style: g,
|
|
203
203
|
children: u
|
|
204
|
-
}) : /* @__PURE__ */
|
|
204
|
+
}) : /* @__PURE__ */ m("div", {
|
|
205
205
|
id: f,
|
|
206
|
-
style:
|
|
206
|
+
style: g,
|
|
207
207
|
children: u
|
|
208
|
-
}), /* @__PURE__ */
|
|
209
|
-
style:
|
|
210
|
-
children: o || l ? i ?
|
|
208
|
+
}), /* @__PURE__ */ m("div", {
|
|
209
|
+
style: p,
|
|
210
|
+
children: o || l ? i ? c({
|
|
211
211
|
field: i,
|
|
212
|
-
fieldName:
|
|
213
|
-
value: r
|
|
212
|
+
fieldName: r,
|
|
213
|
+
value: n[r],
|
|
214
214
|
mode: "display",
|
|
215
|
-
record:
|
|
216
|
-
refs:
|
|
215
|
+
record: n,
|
|
216
|
+
refs: S,
|
|
217
217
|
fieldId: d,
|
|
218
218
|
labelId: f,
|
|
219
|
-
t:
|
|
220
|
-
}) : e(r
|
|
219
|
+
t: w
|
|
220
|
+
}) : e(n[r]) : i ? c({
|
|
221
221
|
field: i,
|
|
222
|
-
fieldName:
|
|
223
|
-
value: r
|
|
222
|
+
fieldName: r,
|
|
223
|
+
value: n[r],
|
|
224
224
|
mode: "edit",
|
|
225
|
-
onChange: (e) =>
|
|
226
|
-
record:
|
|
227
|
-
refs:
|
|
225
|
+
onChange: (e) => M(n._key, r, e),
|
|
226
|
+
record: n,
|
|
227
|
+
refs: S,
|
|
228
228
|
compact: !0,
|
|
229
229
|
fieldId: d,
|
|
230
230
|
labelId: f,
|
|
231
|
-
t:
|
|
232
|
-
}) : e(r
|
|
231
|
+
t: w
|
|
232
|
+
}) : e(n[r])
|
|
233
233
|
})]
|
|
234
|
-
},
|
|
234
|
+
}, r);
|
|
235
235
|
})
|
|
236
236
|
})]
|
|
237
|
-
},
|
|
237
|
+
}, n._key);
|
|
238
238
|
})
|
|
239
|
-
}), /* @__PURE__ */
|
|
239
|
+
}), /* @__PURE__ */ m("div", {
|
|
240
240
|
style: { marginTop: 10 },
|
|
241
|
-
children: /* @__PURE__ */
|
|
241
|
+
children: /* @__PURE__ */ m(i, {
|
|
242
242
|
kind: "ghost",
|
|
243
243
|
size: "sm",
|
|
244
|
-
icon: /* @__PURE__ */
|
|
245
|
-
onClick:
|
|
246
|
-
children:
|
|
244
|
+
icon: /* @__PURE__ */ m(r.plus, { size: 14 }),
|
|
245
|
+
onClick: N,
|
|
246
|
+
children: w("record.row.add", "Add row")
|
|
247
247
|
})
|
|
248
|
-
})] }) : /* @__PURE__ */
|
|
248
|
+
})] }) : /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
|
|
249
249
|
style: { overflowX: "auto" },
|
|
250
|
-
children: /* @__PURE__ */
|
|
251
|
-
ref:
|
|
252
|
-
style:
|
|
253
|
-
onKeyDown:
|
|
254
|
-
children: [/* @__PURE__ */
|
|
255
|
-
let n =
|
|
256
|
-
return /* @__PURE__ */
|
|
257
|
-
style:
|
|
258
|
-
children: n ? t(
|
|
250
|
+
children: /* @__PURE__ */ h("table", {
|
|
251
|
+
ref: E,
|
|
252
|
+
style: u,
|
|
253
|
+
onKeyDown: L,
|
|
254
|
+
children: [/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [D.map((e) => {
|
|
255
|
+
let n = _.fields.get(e);
|
|
256
|
+
return /* @__PURE__ */ m("th", {
|
|
257
|
+
style: R,
|
|
258
|
+
children: n ? t(w, n, e, v.entities) : e
|
|
259
259
|
}, e);
|
|
260
|
-
}), /* @__PURE__ */
|
|
261
|
-
...
|
|
260
|
+
}), /* @__PURE__ */ m("th", { style: {
|
|
261
|
+
...R,
|
|
262
262
|
width: 40
|
|
263
|
-
} })] }) }), /* @__PURE__ */
|
|
264
|
-
let
|
|
265
|
-
return /* @__PURE__ */
|
|
266
|
-
style: { opacity:
|
|
267
|
-
children: [
|
|
268
|
-
let
|
|
269
|
-
return
|
|
263
|
+
} })] }) }), /* @__PURE__ */ m("tbody", { children: y.map((t) => {
|
|
264
|
+
let n = !!t._deleted, i = x?.[t._key];
|
|
265
|
+
return /* @__PURE__ */ h("tr", {
|
|
266
|
+
style: { opacity: n ? .5 : 1 },
|
|
267
|
+
children: [D.map((r) => {
|
|
268
|
+
let a = _.fields.get(r), o = i?.includes(r), s = j.has(r);
|
|
269
|
+
return n || s ? /* @__PURE__ */ m("td", {
|
|
270
270
|
style: {
|
|
271
271
|
padding: "6px 12px",
|
|
272
272
|
borderBottom: "1px solid var(--divider)",
|
|
273
273
|
verticalAlign: "middle",
|
|
274
|
-
textDecoration:
|
|
274
|
+
textDecoration: n ? "line-through" : "none",
|
|
275
275
|
color: "var(--text-2)"
|
|
276
276
|
},
|
|
277
|
-
children:
|
|
278
|
-
field:
|
|
279
|
-
fieldName:
|
|
280
|
-
value: t[
|
|
277
|
+
children: a ? c({
|
|
278
|
+
field: a,
|
|
279
|
+
fieldName: r,
|
|
280
|
+
value: t[r],
|
|
281
281
|
mode: "display",
|
|
282
282
|
record: t,
|
|
283
|
-
refs:
|
|
284
|
-
t:
|
|
285
|
-
}) : e(t[
|
|
286
|
-
},
|
|
283
|
+
refs: S,
|
|
284
|
+
t: w
|
|
285
|
+
}) : e(t[r])
|
|
286
|
+
}, r) : /* @__PURE__ */ m("td", {
|
|
287
287
|
style: {
|
|
288
288
|
padding: "4px 4px",
|
|
289
289
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -292,50 +292,50 @@ function h({ config: h, childEntity: g, schema: _, rows: v, onChange: y, validat
|
|
|
292
292
|
outlineOffset: -1,
|
|
293
293
|
borderRadius: o ? "var(--radius-sm)" : 0
|
|
294
294
|
},
|
|
295
|
-
title: o ?
|
|
296
|
-
children:
|
|
297
|
-
field:
|
|
298
|
-
fieldName:
|
|
299
|
-
value: t[
|
|
295
|
+
title: o ? w("record.row.field_required", "{field} is required", { field: r }) : void 0,
|
|
296
|
+
children: a ? c({
|
|
297
|
+
field: a,
|
|
298
|
+
fieldName: r,
|
|
299
|
+
value: t[r],
|
|
300
300
|
mode: "edit",
|
|
301
|
-
onChange: (e) =>
|
|
301
|
+
onChange: (e) => M(t._key, r, e),
|
|
302
302
|
record: t,
|
|
303
|
-
refs:
|
|
303
|
+
refs: S,
|
|
304
304
|
compact: !0,
|
|
305
|
-
t:
|
|
306
|
-
}) : e(t[
|
|
307
|
-
},
|
|
308
|
-
}), /* @__PURE__ */
|
|
305
|
+
t: w
|
|
306
|
+
}) : e(t[r])
|
|
307
|
+
}, r);
|
|
308
|
+
}), /* @__PURE__ */ m("td", {
|
|
309
309
|
style: {
|
|
310
310
|
padding: "4px 8px",
|
|
311
311
|
borderBottom: "1px solid var(--divider)",
|
|
312
312
|
verticalAlign: "middle"
|
|
313
313
|
},
|
|
314
|
-
children:
|
|
314
|
+
children: n ? /* @__PURE__ */ m(a, {
|
|
315
315
|
size: 24,
|
|
316
|
-
icon: /* @__PURE__ */
|
|
317
|
-
onClick: () =>
|
|
318
|
-
title:
|
|
319
|
-
}) : /* @__PURE__ */
|
|
316
|
+
icon: /* @__PURE__ */ m(r.refresh, { size: 12 }),
|
|
317
|
+
onClick: () => F(t._key),
|
|
318
|
+
title: w("record.row.undo_delete", "Undo delete")
|
|
319
|
+
}) : /* @__PURE__ */ m(a, {
|
|
320
320
|
size: 24,
|
|
321
|
-
icon: /* @__PURE__ */
|
|
322
|
-
onClick: () =>
|
|
323
|
-
title:
|
|
321
|
+
icon: /* @__PURE__ */ m(r.trash, { size: 12 }),
|
|
322
|
+
onClick: () => P(t._key),
|
|
323
|
+
title: w("record.row.delete", "Delete row")
|
|
324
324
|
})
|
|
325
325
|
})]
|
|
326
326
|
}, t._key);
|
|
327
327
|
}) })]
|
|
328
328
|
})
|
|
329
|
-
}), /* @__PURE__ */
|
|
329
|
+
}), /* @__PURE__ */ m("div", {
|
|
330
330
|
style: { marginTop: 8 },
|
|
331
|
-
children: /* @__PURE__ */
|
|
331
|
+
children: /* @__PURE__ */ m(i, {
|
|
332
332
|
kind: "ghost",
|
|
333
333
|
size: "xs",
|
|
334
|
-
icon: /* @__PURE__ */
|
|
335
|
-
onClick:
|
|
336
|
-
children:
|
|
334
|
+
icon: /* @__PURE__ */ m(r.plus, { size: 12 }),
|
|
335
|
+
onClick: N,
|
|
336
|
+
children: w("record.row.add", "Add row")
|
|
337
337
|
})
|
|
338
338
|
})] });
|
|
339
339
|
}
|
|
340
340
|
//#endregion
|
|
341
|
-
export {
|
|
341
|
+
export { g as EditableChildrenTable };
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { formatOffsetTimestamp as e } from "../../lib/timestamp.js";
|
|
2
|
+
import { Pill as t } from "../primitives/Pill.js";
|
|
3
|
+
import { useText as n } from "../../hooks/useText.js";
|
|
4
|
+
import { verdictLabel as r, verdictTone as i } from "../../lib/evidence-verdict.js";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/detail-layout/EvidenceBlock.tsx
|
|
6
|
-
function
|
|
7
|
-
if (!
|
|
8
|
-
let n = new Date(e);
|
|
9
|
-
if (!Number.isNaN(n.getTime())) return n.toLocaleString(t);
|
|
7
|
+
function s(t, n) {
|
|
8
|
+
if (t && !Number.isNaN(new Date(t).getTime())) return e(t, { zone: n });
|
|
10
9
|
}
|
|
11
|
-
function
|
|
12
|
-
let c =
|
|
13
|
-
return
|
|
10
|
+
function c({ evidence: e }) {
|
|
11
|
+
let c = n(), l = e?.verdict ?? "unverified", u = s(e?.verified_at, c.timeZone), d = [];
|
|
12
|
+
return e?.seq && d.push(c("record.evidence.chain", "chain #{seq}", { seq: e.seq })), e?.generation && d.push(c("record.evidence.generation", "generation {number}", { number: e.generation })), /* @__PURE__ */ o("div", {
|
|
14
13
|
style: {
|
|
15
14
|
display: "flex",
|
|
16
15
|
flexDirection: "column",
|
|
17
16
|
gap: 6
|
|
18
17
|
},
|
|
19
|
-
children: [/* @__PURE__ */
|
|
18
|
+
children: [/* @__PURE__ */ o("div", {
|
|
20
19
|
style: {
|
|
21
20
|
display: "flex",
|
|
22
21
|
alignItems: "center",
|
|
@@ -24,7 +23,7 @@ function s({ evidence: s }) {
|
|
|
24
23
|
flexWrap: "wrap"
|
|
25
24
|
},
|
|
26
25
|
children: [
|
|
27
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ a("span", {
|
|
28
27
|
style: {
|
|
29
28
|
fontSize: 12,
|
|
30
29
|
fontWeight: 600,
|
|
@@ -32,20 +31,20 @@ function s({ evidence: s }) {
|
|
|
32
31
|
},
|
|
33
32
|
children: c("record.evidence.title", "Evidence")
|
|
34
33
|
}),
|
|
35
|
-
d.length > 0 && /* @__PURE__ */
|
|
34
|
+
d.length > 0 && /* @__PURE__ */ a("span", {
|
|
36
35
|
style: {
|
|
37
36
|
fontSize: 12,
|
|
38
37
|
color: "var(--muted-foreground)"
|
|
39
38
|
},
|
|
40
39
|
children: d.join(" · ")
|
|
41
40
|
}),
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
tone:
|
|
41
|
+
/* @__PURE__ */ a(t, {
|
|
42
|
+
tone: i(l),
|
|
44
43
|
size: "sm",
|
|
45
44
|
dot: !0,
|
|
46
|
-
children:
|
|
45
|
+
children: r(c, l)
|
|
47
46
|
}),
|
|
48
|
-
u && /* @__PURE__ */
|
|
47
|
+
u && /* @__PURE__ */ a("span", {
|
|
49
48
|
style: {
|
|
50
49
|
fontSize: 12,
|
|
51
50
|
color: "var(--muted-foreground)"
|
|
@@ -53,14 +52,14 @@ function s({ evidence: s }) {
|
|
|
53
52
|
children: c("record.evidence.verified", "Verified {when}", { when: u })
|
|
54
53
|
})
|
|
55
54
|
]
|
|
56
|
-
}),
|
|
55
|
+
}), e?.reason && /* @__PURE__ */ a("span", {
|
|
57
56
|
style: {
|
|
58
57
|
fontSize: 12,
|
|
59
58
|
color: "var(--destructive)"
|
|
60
59
|
},
|
|
61
|
-
children:
|
|
60
|
+
children: e.reason
|
|
62
61
|
})]
|
|
63
62
|
});
|
|
64
63
|
}
|
|
65
64
|
//#endregion
|
|
66
|
-
export {
|
|
65
|
+
export { c as EvidenceBlock };
|