@declarion/react 0.87.0 → 0.88.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,135 +1,136 @@
|
|
|
1
1
|
import { coerceDisplayString as e } from "../../lib/display-value.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
2
|
+
import { displayDay as t } from "../../lib/timestamp.js";
|
|
3
|
+
import { extractPkValues as n, fieldDisplayName as r } from "../../types/schema.js";
|
|
4
|
+
import { textWithNodes as i } from "../../lib/language.js";
|
|
5
|
+
import { deleteObject as a, encodeObjectId as o, updateEntity as s } from "../../api/data.js";
|
|
6
|
+
import { failureTitle as c } from "../../lib/failure.js";
|
|
7
|
+
import { Icon as l } from "../primitives/Icons.js";
|
|
8
|
+
import { Btn as u } from "../primitives/Btn.js";
|
|
9
|
+
import { IconBtn as d } from "../primitives/IconBtn.js";
|
|
10
|
+
import { Pill as f } from "../primitives/Pill.js";
|
|
11
|
+
import { HoverCard as p } from "../primitives/HoverCard.js";
|
|
12
|
+
import { useText as m } from "../../hooks/useText.js";
|
|
13
|
+
import { Spinner as h } from "../primitives/Spinner.js";
|
|
14
|
+
import { toast as g } from "../../lib/toast.js";
|
|
15
|
+
import { ENTITY_CHILDREN_KEY as _ } from "../../hooks/useChildrenData.js";
|
|
16
|
+
import { renderField as v } from "../fields/index.js";
|
|
17
|
+
import { useTimelineData as y } from "../../hooks/useTimelineData.js";
|
|
18
|
+
import { TimelineComposer as b } from "./TimelineComposer.js";
|
|
19
|
+
import { useCallback as x, useEffect as S, useLayoutEffect as C, useMemo as w, useRef as T, useState as E } from "react";
|
|
20
|
+
import { useMutation as D, useQueryClient as O } from "@tanstack/react-query";
|
|
21
|
+
import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
21
22
|
//#region src/components/detail-layout/ChildrenTimeline.tsx
|
|
22
|
-
var
|
|
23
|
-
function
|
|
24
|
-
if (e.length >
|
|
23
|
+
var ee = 80, te = 200, M = 6, N = 2e4, P = 280;
|
|
24
|
+
function F(e) {
|
|
25
|
+
if (e.length > P) return !0;
|
|
25
26
|
let t = 0;
|
|
26
|
-
for (let n of e) if (n === "\n" && ++t >=
|
|
27
|
+
for (let n of e) if (n === "\n" && ++t >= M) return !0;
|
|
27
28
|
return !1;
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
-
if (
|
|
30
|
+
function I(t, r) {
|
|
31
|
+
if (L(r)) {
|
|
31
32
|
let t = r.id;
|
|
32
33
|
return t == null ? "" : e(t);
|
|
33
34
|
}
|
|
34
|
-
return
|
|
35
|
+
return o(n(t, r));
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function L(e) {
|
|
37
38
|
return e.__optimistic === !0;
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
let i =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, [n]),
|
|
44
|
-
|
|
40
|
+
function R({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
41
|
+
let i = m(), a = m("errors"), o = r.entities[e.entity], { rows: s, refs: c, fetchNextPage: l, hasOlder: d, isFetchingOlder: f, isLoading: p, isError: g } = y(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), _ = e.timeline, v = _?.scroll ?? !1, D = (e.sort ?? "").endsWith(":asc"), O = w(() => D ? [...s].reverse() : s, [s, D]), M = _?.auto_scroll ?? "none", N = T(null), P = T(null), F = T(!1), R = T(0), B = T(null), W = T(null), G = T(!0), K = T(null);
|
|
42
|
+
S(() => {
|
|
43
|
+
F.current = !1, R.current = 0, B.current = null, W.current = null, G.current = !0, K.current = null;
|
|
44
|
+
}, [n]), C(() => {
|
|
45
|
+
f && N.current && (K.current = {
|
|
45
46
|
scrollHeight: N.current.scrollHeight,
|
|
46
47
|
scrollTop: N.current.scrollTop
|
|
47
48
|
});
|
|
48
|
-
}, [
|
|
49
|
+
}, [f]), C(() => {
|
|
49
50
|
let e = N.current;
|
|
50
|
-
if (!e ||
|
|
51
|
-
|
|
51
|
+
if (!e || O.length === 0 || !o) {
|
|
52
|
+
R.current = O.length;
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
|
-
let t =
|
|
55
|
-
if (r)
|
|
55
|
+
let t = I(o, O[0]), n = I(o, O[O.length - 1]), r = !F.current, i = O.length > R.current && R.current > 0, a = i && (D && t !== B.current && n === W.current || !D && n !== W.current && t === B.current), s = i && !a;
|
|
56
|
+
if (r) D && M === "bottom" && (e.scrollTop = e.scrollHeight), F.current = !0;
|
|
56
57
|
else if (a && K.current) {
|
|
57
58
|
let t = K.current;
|
|
58
|
-
|
|
59
|
-
} else
|
|
60
|
-
|
|
59
|
+
D && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), K.current = null;
|
|
60
|
+
} else s && D && G.current && (e.scrollTop = e.scrollHeight);
|
|
61
|
+
R.current = O.length, B.current = t, W.current = n;
|
|
61
62
|
}, [
|
|
62
|
-
|
|
63
|
+
O,
|
|
63
64
|
M,
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
D,
|
|
66
|
+
o
|
|
66
67
|
]);
|
|
67
|
-
let q =
|
|
68
|
+
let q = x(() => {
|
|
68
69
|
let e = N.current;
|
|
69
|
-
e && (G.current = e.scrollHeight - e.scrollTop - e.clientHeight <
|
|
70
|
+
e && (G.current = e.scrollHeight - e.scrollTop - e.clientHeight < ee);
|
|
70
71
|
}, []);
|
|
71
|
-
|
|
72
|
+
S(() => {
|
|
72
73
|
let e = P.current;
|
|
73
74
|
if (!e || typeof IntersectionObserver > "u") return;
|
|
74
75
|
let t = new IntersectionObserver((e) => {
|
|
75
|
-
for (let t of e) t.isIntersecting &&
|
|
76
|
+
for (let t of e) t.isIntersecting && d && !f && l();
|
|
76
77
|
}, {
|
|
77
78
|
root: N.current ?? null,
|
|
78
|
-
rootMargin: `${
|
|
79
|
+
rootMargin: `${te}px 0px 0px 0px`,
|
|
79
80
|
threshold: 0
|
|
80
81
|
});
|
|
81
82
|
return t.observe(e), () => t.disconnect();
|
|
82
83
|
}, [
|
|
84
|
+
d,
|
|
83
85
|
f,
|
|
84
|
-
|
|
85
|
-
d
|
|
86
|
+
l
|
|
86
87
|
]);
|
|
87
|
-
let [J, Y] =
|
|
88
|
-
if (!
|
|
89
|
-
let X = e.quick_add?.fields ?? [
|
|
88
|
+
let [J, Y] = E(null);
|
|
89
|
+
if (!o) return null;
|
|
90
|
+
let X = e.quick_add?.fields ?? [_?.content_field].filter(Boolean), Z = i(o.display?.name_plural) || i(o.display?.name) || e.entity, Q = d ? /* @__PURE__ */ A("div", {
|
|
90
91
|
style: {
|
|
91
92
|
display: "flex",
|
|
92
93
|
justifyContent: "center",
|
|
93
94
|
padding: "6px 0"
|
|
94
95
|
},
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ A(u, {
|
|
96
97
|
size: "xs",
|
|
97
|
-
onClick: () =>
|
|
98
|
-
disabled:
|
|
99
|
-
icon:
|
|
100
|
-
children:
|
|
98
|
+
onClick: () => l(),
|
|
99
|
+
disabled: f,
|
|
100
|
+
icon: f ? /* @__PURE__ */ A(h, { size: 11 }) : void 0,
|
|
101
|
+
children: f ? i("record.loading", "Loading…") : i("record.timeline.load_older", "Load older")
|
|
101
102
|
})
|
|
102
|
-
}) : null, ne = /* @__PURE__ */
|
|
103
|
+
}) : null, ne = /* @__PURE__ */ A("div", {
|
|
103
104
|
ref: P,
|
|
104
105
|
"aria-hidden": "true",
|
|
105
106
|
style: { height: 1 }
|
|
106
107
|
}), $;
|
|
107
|
-
if (
|
|
108
|
+
if (g) $ = /* @__PURE__ */ A("div", {
|
|
108
109
|
style: {
|
|
109
110
|
fontSize: 12.5,
|
|
110
111
|
color: "var(--danger)",
|
|
111
112
|
padding: 12
|
|
112
113
|
},
|
|
113
|
-
children:
|
|
114
|
+
children: a("record.related_rows_unreadable", "The related records could not be loaded.")
|
|
114
115
|
});
|
|
115
|
-
else if (
|
|
116
|
+
else if (p) $ = /* @__PURE__ */ j("div", {
|
|
116
117
|
style: {
|
|
117
118
|
display: "flex",
|
|
118
119
|
flexDirection: "column",
|
|
119
120
|
gap: 8,
|
|
120
121
|
padding: 12
|
|
121
122
|
},
|
|
122
|
-
children: [/* @__PURE__ */
|
|
123
|
+
children: [/* @__PURE__ */ A("div", { style: {
|
|
123
124
|
height: 64,
|
|
124
125
|
background: "var(--surface-3)",
|
|
125
126
|
borderRadius: "var(--radius-md)"
|
|
126
|
-
} }), /* @__PURE__ */
|
|
127
|
+
} }), /* @__PURE__ */ A("div", { style: {
|
|
127
128
|
height: 64,
|
|
128
129
|
background: "var(--surface-3)",
|
|
129
130
|
borderRadius: "var(--radius-md)"
|
|
130
131
|
} })]
|
|
131
132
|
});
|
|
132
|
-
else if (
|
|
133
|
+
else if (O.length === 0) $ = /* @__PURE__ */ j(k, { children: [ne, /* @__PURE__ */ A("div", {
|
|
133
134
|
style: {
|
|
134
135
|
fontSize: 12.5,
|
|
135
136
|
color: "var(--text-3)",
|
|
@@ -139,59 +140,62 @@ function L({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
139
140
|
})] });
|
|
140
141
|
else {
|
|
141
142
|
let a = (i, a) => {
|
|
142
|
-
let
|
|
143
|
-
return /* @__PURE__ */
|
|
143
|
+
let s = I(o, i) || String(a);
|
|
144
|
+
return /* @__PURE__ */ A(z, {
|
|
144
145
|
row: i,
|
|
145
|
-
rowId:
|
|
146
|
-
childEntity:
|
|
146
|
+
rowId: s,
|
|
147
|
+
childEntity: o,
|
|
147
148
|
entityCode: e.entity,
|
|
148
149
|
parentEntity: t,
|
|
149
150
|
parentId: n,
|
|
150
|
-
timeline:
|
|
151
|
+
timeline: _,
|
|
151
152
|
editableFields: X,
|
|
152
|
-
refs:
|
|
153
|
-
isEditing: J ===
|
|
154
|
-
onStartEdit: () => Y(
|
|
153
|
+
refs: c,
|
|
154
|
+
isEditing: J === s,
|
|
155
|
+
onStartEdit: () => Y(s),
|
|
155
156
|
onCancelEdit: () => Y(null),
|
|
156
157
|
onSaved: () => Y(null),
|
|
157
158
|
schema: r,
|
|
158
|
-
optimistic:
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
if (
|
|
162
|
-
let e = []
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
optimistic: L(i)
|
|
160
|
+
}, s);
|
|
161
|
+
}, s = _?.time_field, l;
|
|
162
|
+
if (s) {
|
|
163
|
+
let e = [], t = o?.fields?.get(s), n = {
|
|
164
|
+
zone: i.timeZone,
|
|
165
|
+
declared: !!(t?.timezone || o?.default_timezone)
|
|
166
|
+
};
|
|
167
|
+
O.forEach((t, r) => {
|
|
168
|
+
let a = t[s], o = V(a, n), c = e[e.length - 1];
|
|
169
|
+
!c || c.key !== o ? e.push({
|
|
170
|
+
key: o,
|
|
171
|
+
label: H(i, a, n),
|
|
168
172
|
rows: [{
|
|
169
173
|
row: t,
|
|
170
|
-
idx:
|
|
174
|
+
idx: r
|
|
171
175
|
}]
|
|
172
|
-
}) :
|
|
176
|
+
}) : c.rows.push({
|
|
173
177
|
row: t,
|
|
174
|
-
idx:
|
|
178
|
+
idx: r
|
|
175
179
|
});
|
|
176
|
-
}),
|
|
180
|
+
}), l = e.map((e) => /* @__PURE__ */ j("div", {
|
|
177
181
|
style: {
|
|
178
182
|
display: "flex",
|
|
179
183
|
flexDirection: "column",
|
|
180
184
|
gap: 8
|
|
181
185
|
},
|
|
182
|
-
children: [/* @__PURE__ */
|
|
186
|
+
children: [/* @__PURE__ */ A(U, {
|
|
183
187
|
label: e.label,
|
|
184
188
|
count: e.rows.length
|
|
185
189
|
}), e.rows.map(({ row: e, idx: t }) => a(e, t))]
|
|
186
190
|
}, `day-${e.key}`));
|
|
187
|
-
} else
|
|
188
|
-
$ = /* @__PURE__ */
|
|
191
|
+
} else l = O.map((e, t) => a(e, t));
|
|
192
|
+
$ = /* @__PURE__ */ j(k, { children: [
|
|
189
193
|
ne,
|
|
190
194
|
Q,
|
|
191
|
-
|
|
195
|
+
l
|
|
192
196
|
] });
|
|
193
197
|
}
|
|
194
|
-
return
|
|
198
|
+
return v ? /* @__PURE__ */ j("div", {
|
|
195
199
|
style: {
|
|
196
200
|
display: "flex",
|
|
197
201
|
flexDirection: "column",
|
|
@@ -201,13 +205,13 @@ function L({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
201
205
|
color: "var(--text)"
|
|
202
206
|
},
|
|
203
207
|
children: [
|
|
204
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ A("div", {
|
|
205
209
|
style: {
|
|
206
210
|
padding: "10px 16px",
|
|
207
211
|
borderBottom: "1px solid var(--divider)",
|
|
208
212
|
background: "var(--surface)"
|
|
209
213
|
},
|
|
210
|
-
children: /* @__PURE__ */
|
|
214
|
+
children: /* @__PURE__ */ A("h3", {
|
|
211
215
|
style: {
|
|
212
216
|
margin: 0,
|
|
213
217
|
fontSize: 12.5,
|
|
@@ -216,7 +220,7 @@ function L({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
216
220
|
children: Z
|
|
217
221
|
})
|
|
218
222
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ A("div", {
|
|
220
224
|
ref: N,
|
|
221
225
|
onScroll: q,
|
|
222
226
|
style: {
|
|
@@ -229,73 +233,73 @@ function L({ config: e, parentEntity: t, parentId: n, schema: r }) {
|
|
|
229
233
|
},
|
|
230
234
|
children: $
|
|
231
235
|
}),
|
|
232
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ A(b, {
|
|
233
237
|
config: e,
|
|
234
238
|
parentEntity: t,
|
|
235
239
|
parentId: n,
|
|
236
240
|
schema: r
|
|
237
241
|
})
|
|
238
242
|
]
|
|
239
|
-
}) : /* @__PURE__ */
|
|
243
|
+
}) : /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("div", {
|
|
240
244
|
style: {
|
|
241
245
|
display: "flex",
|
|
242
246
|
flexDirection: "column",
|
|
243
247
|
gap: 8
|
|
244
248
|
},
|
|
245
249
|
children: $
|
|
246
|
-
}), /* @__PURE__ */
|
|
250
|
+
}), /* @__PURE__ */ A(b, {
|
|
247
251
|
config: e,
|
|
248
252
|
parentEntity: t,
|
|
249
253
|
parentId: n,
|
|
250
254
|
schema: r
|
|
251
255
|
})] });
|
|
252
256
|
}
|
|
253
|
-
function
|
|
254
|
-
let P =
|
|
257
|
+
function z({ row: t, rowId: n, childEntity: o, entityCode: p, parentEntity: y, parentId: b, timeline: S, editableFields: C, refs: w, isEditing: T, onStartEdit: k, onCancelEdit: ee, onSaved: te, schema: M, optimistic: N = !1 }) {
|
|
258
|
+
let P = m(), F = m("errors"), I = O(), [L, R] = E({}), z = x(() => {
|
|
255
259
|
I.invalidateQueries({ queryKey: [
|
|
256
|
-
te,
|
|
257
260
|
_,
|
|
258
261
|
y,
|
|
259
|
-
|
|
262
|
+
b,
|
|
263
|
+
p
|
|
260
264
|
] });
|
|
261
265
|
}, [
|
|
262
266
|
I,
|
|
263
|
-
_,
|
|
264
267
|
y,
|
|
265
|
-
|
|
266
|
-
|
|
268
|
+
b,
|
|
269
|
+
p
|
|
270
|
+
]), V = D({
|
|
267
271
|
mutationFn: (e) => {
|
|
268
|
-
let
|
|
272
|
+
let r = t.$row_version, i = typeof r == "string" && r !== "" ? {
|
|
269
273
|
...e,
|
|
270
|
-
$row_version:
|
|
274
|
+
$row_version: r
|
|
271
275
|
} : e;
|
|
272
|
-
return
|
|
276
|
+
return s(p, n, i);
|
|
273
277
|
},
|
|
274
278
|
onSuccess: () => {
|
|
275
|
-
|
|
279
|
+
z(), g.success(P("record.timeline.updated", "Updated")), te();
|
|
276
280
|
},
|
|
277
|
-
onError: (e) =>
|
|
278
|
-
}), H =
|
|
279
|
-
mutationFn: () =>
|
|
281
|
+
onError: (e) => g.error(c(F, e))
|
|
282
|
+
}), H = D({
|
|
283
|
+
mutationFn: () => a(p, n),
|
|
280
284
|
onSuccess: () => {
|
|
281
|
-
|
|
285
|
+
z(), g.success(P("record.timeline.deleted", "Deleted"));
|
|
282
286
|
},
|
|
283
|
-
onError: (e) =>
|
|
284
|
-
}),
|
|
287
|
+
onError: (e) => g.error(c(F, e))
|
|
288
|
+
}), U = x(() => {
|
|
285
289
|
let e = {};
|
|
286
|
-
for (let n of
|
|
290
|
+
for (let n of C) e[n] = t[n] ?? "";
|
|
287
291
|
R(e), k();
|
|
288
292
|
}, [
|
|
289
293
|
t,
|
|
290
|
-
|
|
294
|
+
C,
|
|
291
295
|
k
|
|
292
|
-
]), G =
|
|
296
|
+
]), G = x((e, t) => {
|
|
293
297
|
R((n) => ({
|
|
294
298
|
...n,
|
|
295
299
|
[e]: t
|
|
296
300
|
}));
|
|
297
|
-
}, []), K =
|
|
298
|
-
return
|
|
301
|
+
}, []), K = S?.time_field, q = S?.type_field, J = S?.summary_field, Y = S?.content_field, X = S?.author_field, Z = S?.direction_field, Q = S?.intent_field;
|
|
302
|
+
return T ? /* @__PURE__ */ j("div", {
|
|
299
303
|
style: {
|
|
300
304
|
borderRadius: "var(--radius-lg)",
|
|
301
305
|
border: "1px solid var(--accent)",
|
|
@@ -305,17 +309,17 @@ function R({ row: t, rowId: c, childEntity: d, entityCode: g, parentEntity: _, p
|
|
|
305
309
|
flexDirection: "column",
|
|
306
310
|
gap: 8
|
|
307
311
|
},
|
|
308
|
-
children: [
|
|
309
|
-
let t =
|
|
310
|
-
return t ? /* @__PURE__ */
|
|
312
|
+
children: [C.map((e) => {
|
|
313
|
+
let t = o.fields.get(e);
|
|
314
|
+
return t ? /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
|
|
311
315
|
style: {
|
|
312
316
|
fontSize: 11,
|
|
313
317
|
color: "var(--text-3)",
|
|
314
318
|
marginBottom: 4,
|
|
315
319
|
display: "block"
|
|
316
320
|
},
|
|
317
|
-
children:
|
|
318
|
-
}),
|
|
321
|
+
children: r(P, t, e, M.entities)
|
|
322
|
+
}), v({
|
|
319
323
|
field: t,
|
|
320
324
|
fieldName: e,
|
|
321
325
|
value: L[e] ?? "",
|
|
@@ -324,31 +328,31 @@ function R({ row: t, rowId: c, childEntity: d, entityCode: g, parentEntity: _, p
|
|
|
324
328
|
record: L,
|
|
325
329
|
t: P
|
|
326
330
|
})] }, e) : null;
|
|
327
|
-
}), /* @__PURE__ */
|
|
331
|
+
}), /* @__PURE__ */ j("div", {
|
|
328
332
|
style: {
|
|
329
333
|
display: "flex",
|
|
330
334
|
alignItems: "center",
|
|
331
335
|
gap: 6,
|
|
332
336
|
paddingTop: 4
|
|
333
337
|
},
|
|
334
|
-
children: [/* @__PURE__ */
|
|
338
|
+
children: [/* @__PURE__ */ A(u, {
|
|
335
339
|
kind: "primary",
|
|
336
340
|
size: "xs",
|
|
337
|
-
icon: V.isPending ? /* @__PURE__ */
|
|
341
|
+
icon: V.isPending ? /* @__PURE__ */ A(h, { size: 12 }) : /* @__PURE__ */ A(l.check, { size: 12 }),
|
|
338
342
|
onClick: () => V.mutate(L),
|
|
339
343
|
disabled: V.isPending,
|
|
340
344
|
children: V.isPending ? P("dialog.saving", "Saving…") : P("dialog.save", "Save")
|
|
341
|
-
}), /* @__PURE__ */
|
|
345
|
+
}), /* @__PURE__ */ A(u, {
|
|
342
346
|
size: "xs",
|
|
343
|
-
icon: /* @__PURE__ */
|
|
347
|
+
icon: /* @__PURE__ */ A(l.x, { size: 12 }),
|
|
344
348
|
onClick: () => {
|
|
345
|
-
R({}),
|
|
349
|
+
R({}), ee();
|
|
346
350
|
},
|
|
347
351
|
disabled: V.isPending,
|
|
348
352
|
children: P("dialog.cancel", "Cancel")
|
|
349
353
|
})]
|
|
350
354
|
})]
|
|
351
|
-
}) : /* @__PURE__ */
|
|
355
|
+
}) : /* @__PURE__ */ j("div", {
|
|
352
356
|
className: "group",
|
|
353
357
|
"data-optimistic": N || void 0,
|
|
354
358
|
style: {
|
|
@@ -362,7 +366,7 @@ function R({ row: t, rowId: c, childEntity: d, entityCode: g, parentEntity: _, p
|
|
|
362
366
|
onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
|
|
363
367
|
onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
|
|
364
368
|
children: [
|
|
365
|
-
/* @__PURE__ */
|
|
369
|
+
/* @__PURE__ */ j("div", {
|
|
366
370
|
style: {
|
|
367
371
|
display: "flex",
|
|
368
372
|
alignItems: "center",
|
|
@@ -372,102 +376,102 @@ function R({ row: t, rowId: c, childEntity: d, entityCode: g, parentEntity: _, p
|
|
|
372
376
|
color: "var(--text-3)"
|
|
373
377
|
},
|
|
374
378
|
children: [
|
|
375
|
-
K && t[K] != null &&
|
|
379
|
+
K && t[K] != null && o.fields.get(K) && /* @__PURE__ */ A("span", {
|
|
376
380
|
style: { fontWeight: 500 },
|
|
377
|
-
children:
|
|
378
|
-
field:
|
|
381
|
+
children: v({
|
|
382
|
+
field: o.fields.get(K),
|
|
379
383
|
fieldName: K,
|
|
380
384
|
value: t[K],
|
|
381
385
|
mode: "display",
|
|
382
386
|
record: t,
|
|
383
|
-
refs:
|
|
387
|
+
refs: w,
|
|
384
388
|
t: P
|
|
385
389
|
})
|
|
386
390
|
}),
|
|
387
|
-
q && t[q] != null &&
|
|
391
|
+
q && t[q] != null && o.fields.get(q) && /* @__PURE__ */ A(f, {
|
|
388
392
|
tone: "slate",
|
|
389
393
|
size: "xs",
|
|
390
|
-
children:
|
|
391
|
-
field:
|
|
394
|
+
children: v({
|
|
395
|
+
field: o.fields.get(q),
|
|
392
396
|
fieldName: q,
|
|
393
397
|
value: t[q],
|
|
394
398
|
mode: "display",
|
|
395
399
|
record: t,
|
|
396
|
-
refs:
|
|
400
|
+
refs: w,
|
|
397
401
|
t: P
|
|
398
402
|
})
|
|
399
403
|
}),
|
|
400
|
-
Z && t[Z] != null &&
|
|
404
|
+
Z && t[Z] != null && o.fields.get(Z) && /* @__PURE__ */ A(W, {
|
|
401
405
|
value: t[Z],
|
|
402
|
-
field:
|
|
406
|
+
field: o.fields.get(Z)
|
|
403
407
|
}),
|
|
404
|
-
Q && t[Q] != null &&
|
|
408
|
+
Q && t[Q] != null && o.fields.get(Q) && /* @__PURE__ */ A(f, {
|
|
405
409
|
tone: "slate",
|
|
406
410
|
size: "xs",
|
|
407
|
-
children:
|
|
408
|
-
field:
|
|
411
|
+
children: v({
|
|
412
|
+
field: o.fields.get(Q),
|
|
409
413
|
fieldName: Q,
|
|
410
414
|
value: t[Q],
|
|
411
415
|
mode: "display",
|
|
412
416
|
record: t,
|
|
413
|
-
refs:
|
|
417
|
+
refs: w,
|
|
414
418
|
t: P
|
|
415
419
|
})
|
|
416
420
|
}),
|
|
417
|
-
X && t[X] != null &&
|
|
418
|
-
field:
|
|
421
|
+
X && t[X] != null && o.fields.get(X) && /* @__PURE__ */ A("span", { children: i(P("record.timeline.by_author", "by {author}"), { author: v({
|
|
422
|
+
field: o.fields.get(X),
|
|
419
423
|
fieldName: X,
|
|
420
424
|
value: t[X],
|
|
421
425
|
mode: "display",
|
|
422
426
|
record: t,
|
|
423
|
-
refs:
|
|
427
|
+
refs: w,
|
|
424
428
|
t: P
|
|
425
429
|
}) }) }),
|
|
426
|
-
!N && /* @__PURE__ */
|
|
430
|
+
!N && /* @__PURE__ */ j("div", {
|
|
427
431
|
style: {
|
|
428
432
|
marginLeft: "auto",
|
|
429
433
|
display: "flex",
|
|
430
434
|
alignItems: "center",
|
|
431
435
|
gap: 2
|
|
432
436
|
},
|
|
433
|
-
children: [/* @__PURE__ */
|
|
437
|
+
children: [/* @__PURE__ */ A(d, {
|
|
434
438
|
size: 22,
|
|
435
|
-
icon: /* @__PURE__ */
|
|
436
|
-
onClick:
|
|
439
|
+
icon: /* @__PURE__ */ A(l.edit, { size: 11 }),
|
|
440
|
+
onClick: U,
|
|
437
441
|
title: P("record.action.edit", "Edit")
|
|
438
|
-
}), /* @__PURE__ */
|
|
442
|
+
}), /* @__PURE__ */ A(d, {
|
|
439
443
|
size: 22,
|
|
440
|
-
icon: /* @__PURE__ */
|
|
444
|
+
icon: /* @__PURE__ */ A(l.trash, { size: 11 }),
|
|
441
445
|
onClick: () => H.mutate(),
|
|
442
446
|
title: P("record.action.delete", "Delete")
|
|
443
447
|
})]
|
|
444
448
|
})
|
|
445
449
|
]
|
|
446
450
|
}),
|
|
447
|
-
J && t[J] != null &&
|
|
451
|
+
J && t[J] != null && o.fields.get(J) && /* @__PURE__ */ A("div", {
|
|
448
452
|
style: {
|
|
449
453
|
fontSize: 12.5,
|
|
450
454
|
fontWeight: 500,
|
|
451
455
|
marginTop: 6
|
|
452
456
|
},
|
|
453
|
-
children:
|
|
454
|
-
field:
|
|
457
|
+
children: v({
|
|
458
|
+
field: o.fields.get(J),
|
|
455
459
|
fieldName: J,
|
|
456
460
|
value: t[J],
|
|
457
461
|
mode: "display",
|
|
458
462
|
record: t,
|
|
459
|
-
refs:
|
|
463
|
+
refs: w,
|
|
460
464
|
t: P
|
|
461
465
|
})
|
|
462
466
|
}),
|
|
463
|
-
Y && t[Y] != null && Y !== J &&
|
|
464
|
-
rendered:
|
|
465
|
-
field:
|
|
467
|
+
Y && t[Y] != null && Y !== J && o.fields.get(Y) && /* @__PURE__ */ A(B, {
|
|
468
|
+
rendered: v({
|
|
469
|
+
field: o.fields.get(Y),
|
|
466
470
|
fieldName: Y,
|
|
467
471
|
value: t[Y],
|
|
468
472
|
mode: "display",
|
|
469
473
|
record: t,
|
|
470
|
-
refs:
|
|
474
|
+
refs: w,
|
|
471
475
|
t: P
|
|
472
476
|
}),
|
|
473
477
|
text: e(t[Y])
|
|
@@ -475,36 +479,36 @@ function R({ row: t, rowId: c, childEntity: d, entityCode: g, parentEntity: _, p
|
|
|
475
479
|
]
|
|
476
480
|
});
|
|
477
481
|
}
|
|
478
|
-
function
|
|
479
|
-
let n =
|
|
482
|
+
function B({ rendered: e, text: t }) {
|
|
483
|
+
let n = m(), r = {
|
|
480
484
|
fontSize: 12.5,
|
|
481
485
|
fontWeight: 400,
|
|
482
486
|
marginTop: 6
|
|
483
487
|
};
|
|
484
|
-
if (!
|
|
488
|
+
if (!F(t)) return /* @__PURE__ */ A("div", {
|
|
485
489
|
style: r,
|
|
486
490
|
children: e
|
|
487
491
|
});
|
|
488
|
-
let i = t.length >
|
|
489
|
-
return /* @__PURE__ */
|
|
492
|
+
let i = t.length > N, a = i ? t.slice(0, N) : t;
|
|
493
|
+
return /* @__PURE__ */ A("div", {
|
|
490
494
|
style: {
|
|
491
495
|
...r,
|
|
492
496
|
display: "-webkit-box",
|
|
493
497
|
WebkitBoxOrient: "vertical",
|
|
494
|
-
WebkitLineClamp:
|
|
498
|
+
WebkitLineClamp: M,
|
|
495
499
|
overflow: "hidden",
|
|
496
500
|
whiteSpace: "pre-wrap",
|
|
497
501
|
overflowWrap: "anywhere"
|
|
498
502
|
},
|
|
499
|
-
children: /* @__PURE__ */
|
|
503
|
+
children: /* @__PURE__ */ A(p, {
|
|
500
504
|
width: 380,
|
|
501
|
-
content: /* @__PURE__ */
|
|
505
|
+
content: /* @__PURE__ */ j("div", {
|
|
502
506
|
style: {
|
|
503
507
|
fontSize: 12.5,
|
|
504
508
|
whiteSpace: "pre-wrap",
|
|
505
509
|
overflowWrap: "anywhere"
|
|
506
510
|
},
|
|
507
|
-
children: [a, i && /* @__PURE__ */
|
|
511
|
+
children: [a, i && /* @__PURE__ */ A("div", {
|
|
508
512
|
style: {
|
|
509
513
|
marginTop: 8,
|
|
510
514
|
fontSize: 11,
|
|
@@ -517,26 +521,22 @@ function z({ rendered: e, text: t }) {
|
|
|
517
521
|
})
|
|
518
522
|
});
|
|
519
523
|
}
|
|
520
|
-
function
|
|
521
|
-
|
|
522
|
-
let n = new Date(e(t));
|
|
523
|
-
return Number.isNaN(n.getTime()) ? "" : `${n.getFullYear()}-${n.getMonth()}-${n.getDate()}`;
|
|
524
|
+
function V(n, r) {
|
|
525
|
+
return n == null ? "" : t(e(n), r) ?? "";
|
|
524
526
|
}
|
|
525
|
-
function
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
a.setDate(i.getDate() - 1);
|
|
531
|
-
let o = (e, t) => e.toDateString() === t.toDateString();
|
|
532
|
-
return o(r, i) ? t("record.timeline.today", "Today") : o(r, a) ? t("record.timeline.yesterday", "Yesterday") : r.toLocaleDateString(t.language, {
|
|
527
|
+
function H(n, r, i) {
|
|
528
|
+
let a = r == null ? null : t(e(r), i);
|
|
529
|
+
if (!a) return "—";
|
|
530
|
+
let o = Date.now();
|
|
531
|
+
return a === t(new Date(o).toISOString(), i) ? n("record.timeline.today", "Today") : a === t((/* @__PURE__ */ new Date(o - 864e5)).toISOString(), i) ? n("record.timeline.yesterday", "Yesterday") : (/* @__PURE__ */ new Date(`${a}T12:00:00Z`)).toLocaleDateString(n.language, {
|
|
533
532
|
weekday: "short",
|
|
534
533
|
month: "short",
|
|
535
|
-
day: "numeric"
|
|
534
|
+
day: "numeric",
|
|
535
|
+
timeZone: "UTC"
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
|
-
function
|
|
539
|
-
return /* @__PURE__ */
|
|
538
|
+
function U({ label: e, count: t }) {
|
|
539
|
+
return /* @__PURE__ */ j("div", {
|
|
540
540
|
style: {
|
|
541
541
|
position: "sticky",
|
|
542
542
|
top: -4,
|
|
@@ -548,7 +548,7 @@ function H({ label: e, count: t }) {
|
|
|
548
548
|
background: "linear-gradient(180deg, var(--surface-2) 0%, var(--surface-2) 65%, transparent 100%)"
|
|
549
549
|
},
|
|
550
550
|
children: [
|
|
551
|
-
/* @__PURE__ */
|
|
551
|
+
/* @__PURE__ */ A("span", {
|
|
552
552
|
style: {
|
|
553
553
|
fontSize: 11,
|
|
554
554
|
fontWeight: 600,
|
|
@@ -556,12 +556,12 @@ function H({ label: e, count: t }) {
|
|
|
556
556
|
},
|
|
557
557
|
children: e
|
|
558
558
|
}),
|
|
559
|
-
/* @__PURE__ */
|
|
559
|
+
/* @__PURE__ */ A("span", { style: {
|
|
560
560
|
flex: 1,
|
|
561
561
|
height: 1,
|
|
562
562
|
background: "var(--divider)"
|
|
563
563
|
} }),
|
|
564
|
-
/* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ A("span", {
|
|
565
565
|
className: "num",
|
|
566
566
|
style: {
|
|
567
567
|
fontSize: 10.5,
|
|
@@ -572,9 +572,9 @@ function H({ label: e, count: t }) {
|
|
|
572
572
|
]
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
let n =
|
|
577
|
-
return r === null ? null : /* @__PURE__ */
|
|
575
|
+
function W({ value: e, field: t }) {
|
|
576
|
+
let n = m(), r = G(e, t);
|
|
577
|
+
return r === null ? null : /* @__PURE__ */ j("span", {
|
|
578
578
|
style: {
|
|
579
579
|
display: "inline-flex",
|
|
580
580
|
alignItems: "center",
|
|
@@ -586,10 +586,10 @@ function U({ value: e, field: t }) {
|
|
|
586
586
|
background: r ? "var(--accent-soft)" : "var(--info-soft)",
|
|
587
587
|
color: r ? "var(--accent)" : "var(--info)"
|
|
588
588
|
},
|
|
589
|
-
children: [
|
|
589
|
+
children: [A(r ? l.arrowUp : l.arrowDown, { size: 10 }), r ? n("record.timeline.outbound", "Out") : n("record.timeline.inbound", "In")]
|
|
590
590
|
});
|
|
591
591
|
}
|
|
592
|
-
function
|
|
592
|
+
function G(e, t) {
|
|
593
593
|
if (t.type === "bool") return e === !0;
|
|
594
594
|
if (typeof e == "string") {
|
|
595
595
|
let t = e.toLowerCase();
|
|
@@ -599,4 +599,4 @@ function W(e, t) {
|
|
|
599
599
|
return null;
|
|
600
600
|
}
|
|
601
601
|
//#endregion
|
|
602
|
-
export {
|
|
602
|
+
export { R as ChildrenTimeline };
|