@declarion/react 0.86.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.
Files changed (90) hide show
  1. package/dist-lib/app.js +28 -28
  2. package/dist-lib/components/actions/ActionButton.js +86 -85
  3. package/dist-lib/components/actions/ActionResultDialog.impl.js +47 -47
  4. package/dist-lib/components/actions/ActionRunner.js +47 -47
  5. package/dist-lib/components/actions/ObjectActionBar.js +9 -9
  6. package/dist-lib/components/actions/RowActionsKebab.js +19 -19
  7. package/dist-lib/components/agents/AgentChatPanel.impl.js +53 -53
  8. package/dist-lib/components/chrome/AssociationTabs.js +21 -21
  9. package/dist-lib/components/chrome/RecordHeader.js +33 -40
  10. package/dist-lib/components/detail-layout/AssociatedBlock.js +387 -381
  11. package/dist-lib/components/detail-layout/ChildrenBlock.js +12 -13
  12. package/dist-lib/components/detail-layout/ChildrenTimeline.js +198 -198
  13. package/dist-lib/components/detail-layout/DraggableChildrenTable.js +114 -114
  14. package/dist-lib/components/detail-layout/EditableChildrenTable.js +160 -160
  15. package/dist-lib/components/detail-layout/EvidenceBlock.js +20 -21
  16. package/dist-lib/components/detail-layout/PropertiesBlock.js +45 -39
  17. package/dist-lib/components/detail-layout/QuickAddForm.js +9 -9
  18. package/dist-lib/components/detail-layout/TimelineComposer.js +87 -89
  19. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +100 -99
  20. package/dist-lib/components/fields/FileReferenceField.js +9 -9
  21. package/dist-lib/components/fields/StructureField.js +57 -47
  22. package/dist-lib/components/fields/TimestampField.js +59 -54
  23. package/dist-lib/components/fields/cells/factories/money.js +14 -23
  24. package/dist-lib/components/fields/cells/factories/nextRun.js +1 -1
  25. package/dist-lib/components/fields/cells/factories/text.js +18 -3
  26. package/dist-lib/components/fields/cells/factories/timestamp.js +24 -12
  27. package/dist-lib/components/file-widgets/DocumentCard.js +108 -106
  28. package/dist-lib/components/layout/Layout.js +306 -361
  29. package/dist-lib/components/layout/Rail.js +42 -41
  30. package/dist-lib/components/layout/Sidebar.js +132 -117
  31. package/dist-lib/components/layout/TabStrip.js +116 -115
  32. package/dist-lib/components/layout/TenantChip.js +47 -54
  33. package/dist-lib/components/layout/TopBar.js +108 -105
  34. package/dist-lib/components/list/InlineEditCell.js +23 -23
  35. package/dist-lib/components/list/QuickPeek.js +65 -66
  36. package/dist-lib/components/pages/DocumentsMenu.js +42 -42
  37. package/dist-lib/components/pages/ExportMenu.js +25 -25
  38. package/dist-lib/components/pages/RecordDocumentsPanel.js +35 -35
  39. package/dist-lib/components/pages/RecordNotesPanel.js +94 -93
  40. package/dist-lib/components/pages/SmartDetailPage.impl.js +421 -417
  41. package/dist-lib/components/pages/SmartListPage.impl.js +293 -295
  42. package/dist-lib/components/pages/SmartRecordListPage.impl.js +310 -310
  43. package/dist-lib/components/pages/auth/AuthShell.js +73 -73
  44. package/dist-lib/components/pages/auth/SignIn.js +32 -32
  45. package/dist-lib/components/pages/auth/SignUp.impl.js +3 -3
  46. package/dist-lib/components/pages/auth/SignUpCode.js +9 -9
  47. package/dist-lib/components/pages/list/ListFloatbar.js +12 -12
  48. package/dist-lib/components/pages/list/ListHeader.js +19 -19
  49. package/dist-lib/components/pages/list/ListNoRows.js +15 -15
  50. package/dist-lib/components/pages/list/ListToolbar.js +145 -145
  51. package/dist-lib/components/pages/list/useActiveView.js +14 -5
  52. package/dist-lib/components/pages/list/useListQuery.js +121 -81
  53. package/dist-lib/components/pages/list/useListRowInteraction.js +70 -70
  54. package/dist-lib/components/pages/list/useRowMenu.js +7 -7
  55. package/dist-lib/components/pages/profile/Preferences.impl.js +81 -78
  56. package/dist-lib/components/pages/profile/Profile.impl.js +191 -189
  57. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +166 -158
  58. package/dist-lib/components/shared/ChangePasswordDialog.impl.js +23 -23
  59. package/dist-lib/components/shared/MarkdownRenderer.js +9 -9
  60. package/dist-lib/hooks/useAuth.js +11 -11
  61. package/dist-lib/hooks/useBranding.js +4 -4
  62. package/dist-lib/hooks/useDisplayTimeZone.js +8 -0
  63. package/dist-lib/hooks/useFollowAgentOpen.js +24 -24
  64. package/dist-lib/hooks/useImpersonation.js +6 -6
  65. package/dist-lib/hooks/useMutations.js +23 -23
  66. package/dist-lib/hooks/useObjectStatus.js +5 -5
  67. package/dist-lib/hooks/useParams.js +59 -51
  68. package/dist-lib/hooks/useProperties.js +8 -8
  69. package/dist-lib/hooks/useRowTenant.js +18 -6
  70. package/dist-lib/hooks/useText.js +9 -7
  71. package/dist-lib/hooks/useUiPreferences.js +71 -0
  72. package/dist-lib/index.d.ts +22 -6
  73. package/dist-lib/index.js +127 -126
  74. package/dist-lib/lib/actions.js +116 -84
  75. package/dist-lib/lib/child-config.js +10 -1
  76. package/dist-lib/lib/format-count.js +16 -1
  77. package/dist-lib/lib/language.js +23 -21
  78. package/dist-lib/lib/money-text.js +29 -0
  79. package/dist-lib/lib/profile.js +4 -0
  80. package/dist-lib/lib/role-label.js +8 -0
  81. package/dist-lib/lib/schema-routing.js +34 -14
  82. package/dist-lib/lib/shortcut.js +10 -0
  83. package/dist-lib/lib/timestamp.js +93 -31
  84. package/dist-lib/stores/auth.js +9 -8
  85. package/dist-lib/stores/preferences.js +56 -17
  86. package/dist-lib/testing.d.ts +1 -1
  87. package/dist-lib/testing.js +25 -28
  88. package/dist-lib/types/schema.js +33 -27
  89. package/dist-lib/{useResponsiveMode-D3SKz5z4.d.ts → useResponsiveMode-9_eJT18k.d.ts} +5 -5
  90. package/package.json +1 -1
@@ -1,135 +1,136 @@
1
1
  import { coerceDisplayString as e } from "../../lib/display-value.js";
2
- import { extractPkValues as t, fieldDisplayName as n } from "../../types/schema.js";
3
- import { textWithNodes as r } from "../../lib/language.js";
4
- import { Icon as i } from "../primitives/Icons.js";
5
- import { Btn as a } from "../primitives/Btn.js";
6
- import { IconBtn as o } from "../primitives/IconBtn.js";
7
- import { Pill as s } from "../primitives/Pill.js";
8
- import { HoverCard as c } from "../primitives/HoverCard.js";
9
- import { useText as l } from "../../hooks/useText.js";
10
- import { Spinner as ee } from "../primitives/Spinner.js";
11
- import { deleteObject as u, encodeObjectId as d, updateEntity as f } from "../../api/data.js";
12
- import { failureTitle as p } from "../../lib/failure.js";
13
- import { toast as m } from "../../lib/toast.js";
14
- import { ENTITY_CHILDREN_KEY as te } from "../../hooks/useChildrenData.js";
15
- import { renderField as h } from "../fields/index.js";
16
- import { useTimelineData as g } from "../../hooks/useTimelineData.js";
17
- import { TimelineComposer as _ } from "./TimelineComposer.js";
18
- import { useCallback as v, useEffect as y, useLayoutEffect as b, useMemo as x, useRef as S, useState as C } from "react";
19
- import { useMutation as w, useQueryClient as T } from "@tanstack/react-query";
20
- import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
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 k = 80, A = 200, j = 6, M = 2e4, N = 280;
23
- function P(e) {
24
- if (e.length > N) return !0;
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 >= j) return !0;
27
+ for (let n of e) if (n === "\n" && ++t >= M) return !0;
27
28
  return !1;
28
29
  }
29
- function F(n, r) {
30
- if (I(r)) {
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 d(t(n, r));
35
+ return o(n(t, r));
35
36
  }
36
- function I(e) {
37
+ function L(e) {
37
38
  return e.__optimistic === !0;
38
39
  }
39
- function L({ config: e, parentEntity: t, parentId: n, schema: r }) {
40
- let i = l(), o = l("errors"), s = r.entities[e.entity], { rows: c, refs: u, fetchNextPage: d, hasOlder: f, isFetchingOlder: p, isLoading: m, isError: te } = g(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), h = e.timeline, w = h?.scroll ?? !1, T = (e.sort ?? "").endsWith(":asc"), j = x(() => T ? [...c].reverse() : c, [c, T]), M = h?.auto_scroll ?? "none", N = S(null), P = S(null), L = S(!1), z = S(0), U = S(null), W = S(null), G = S(!0), K = S(null);
41
- y(() => {
42
- L.current = !1, z.current = 0, U.current = null, W.current = null, G.current = !0, K.current = null;
43
- }, [n]), b(() => {
44
- p && N.current && (K.current = {
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
- }, [p]), b(() => {
49
+ }, [f]), C(() => {
49
50
  let e = N.current;
50
- if (!e || j.length === 0 || !s) {
51
- z.current = j.length;
51
+ if (!e || O.length === 0 || !o) {
52
+ R.current = O.length;
52
53
  return;
53
54
  }
54
- let t = F(s, j[0]), n = F(s, j[j.length - 1]), r = !L.current, i = j.length > z.current && z.current > 0, a = i && (T && t !== U.current && n === W.current || !T && n !== W.current && t === U.current), o = i && !a;
55
- if (r) T && M === "bottom" && (e.scrollTop = e.scrollHeight), L.current = !0;
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
- T && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), K.current = null;
59
- } else o && T && G.current && (e.scrollTop = e.scrollHeight);
60
- z.current = j.length, U.current = t, W.current = n;
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
- j,
63
+ O,
63
64
  M,
64
- T,
65
- s
65
+ D,
66
+ o
66
67
  ]);
67
- let q = v(() => {
68
+ let q = x(() => {
68
69
  let e = N.current;
69
- e && (G.current = e.scrollHeight - e.scrollTop - e.clientHeight < k);
70
+ e && (G.current = e.scrollHeight - e.scrollTop - e.clientHeight < ee);
70
71
  }, []);
71
- y(() => {
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 && f && !p && d();
76
+ for (let t of e) t.isIntersecting && d && !f && l();
76
77
  }, {
77
78
  root: N.current ?? null,
78
- rootMargin: `${A}px 0px 0px 0px`,
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
- p,
85
- d
86
+ l
86
87
  ]);
87
- let [J, Y] = C(null);
88
- if (!s) return null;
89
- let X = e.quick_add?.fields ?? [h?.content_field].filter(Boolean), Z = i(s.display?.name_plural) || i(s.display?.name) || e.entity, Q = f ? /* @__PURE__ */ D("div", {
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__ */ D(a, {
96
+ children: /* @__PURE__ */ A(u, {
96
97
  size: "xs",
97
- onClick: () => d(),
98
- disabled: p,
99
- icon: p ? /* @__PURE__ */ D(ee, { size: 11 }) : void 0,
100
- children: p ? i("record.loading", "Loading…") : i("record.timeline.load_older", "Load older")
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__ */ D("div", {
103
+ }) : null, ne = /* @__PURE__ */ A("div", {
103
104
  ref: P,
104
105
  "aria-hidden": "true",
105
106
  style: { height: 1 }
106
107
  }), $;
107
- if (te) $ = /* @__PURE__ */ D("div", {
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: o("record.related_rows_unreadable", "The related records could not be loaded.")
114
+ children: a("record.related_rows_unreadable", "The related records could not be loaded.")
114
115
  });
115
- else if (m) $ = /* @__PURE__ */ O("div", {
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__ */ D("div", { style: {
123
+ children: [/* @__PURE__ */ A("div", { style: {
123
124
  height: 64,
124
125
  background: "var(--surface-3)",
125
126
  borderRadius: "var(--radius-md)"
126
- } }), /* @__PURE__ */ D("div", { style: {
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 (j.length === 0) $ = /* @__PURE__ */ O(E, { children: [ne, /* @__PURE__ */ D("div", {
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 o = F(s, i) || String(a);
143
- return /* @__PURE__ */ D(R, {
143
+ let s = I(o, i) || String(a);
144
+ return /* @__PURE__ */ A(z, {
144
145
  row: i,
145
- rowId: o,
146
- childEntity: s,
146
+ rowId: s,
147
+ childEntity: o,
147
148
  entityCode: e.entity,
148
149
  parentEntity: t,
149
150
  parentId: n,
150
- timeline: h,
151
+ timeline: _,
151
152
  editableFields: X,
152
- refs: u,
153
- isEditing: J === o,
154
- onStartEdit: () => Y(o),
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: I(i)
159
- }, o);
160
- }, o = h?.time_field, c;
161
- if (o) {
162
- let e = [];
163
- j.forEach((t, n) => {
164
- let r = t[o], a = B(r), s = e[e.length - 1];
165
- !s || s.key !== a ? e.push({
166
- key: a,
167
- label: V(i, r),
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: n
174
+ idx: r
171
175
  }]
172
- }) : s.rows.push({
176
+ }) : c.rows.push({
173
177
  row: t,
174
- idx: n
178
+ idx: r
175
179
  });
176
- }), c = e.map((e) => /* @__PURE__ */ O("div", {
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__ */ D(H, {
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 c = j.map((e, t) => a(e, t));
188
- $ = /* @__PURE__ */ O(E, { children: [
191
+ } else l = O.map((e, t) => a(e, t));
192
+ $ = /* @__PURE__ */ j(k, { children: [
189
193
  ne,
190
194
  Q,
191
- c
195
+ l
192
196
  ] });
193
197
  }
194
- return w ? /* @__PURE__ */ O("div", {
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__ */ D("div", {
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__ */ D("h3", {
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__ */ D("div", {
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__ */ D(_, {
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__ */ O("div", { children: [/* @__PURE__ */ D("div", {
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__ */ D(_, {
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 R({ row: t, rowId: c, childEntity: d, entityCode: g, parentEntity: _, parentId: y, timeline: b, editableFields: x, refs: S, isEditing: E, onStartEdit: k, onCancelEdit: A, onSaved: j, schema: M, optimistic: N = !1 }) {
254
- let P = l(), F = l("errors"), I = T(), [L, R] = C({}), B = v(() => {
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
- g
262
+ b,
263
+ p
260
264
  ] });
261
265
  }, [
262
266
  I,
263
- _,
264
267
  y,
265
- g
266
- ]), V = w({
268
+ b,
269
+ p
270
+ ]), V = D({
267
271
  mutationFn: (e) => {
268
- let n = t.$row_version, r = typeof n == "string" && n !== "" ? {
272
+ let r = t.$row_version, i = typeof r == "string" && r !== "" ? {
269
273
  ...e,
270
- $row_version: n
274
+ $row_version: r
271
275
  } : e;
272
- return f(g, c, r);
276
+ return s(p, n, i);
273
277
  },
274
278
  onSuccess: () => {
275
- B(), m.success(P("record.timeline.updated", "Updated")), j();
279
+ z(), g.success(P("record.timeline.updated", "Updated")), te();
276
280
  },
277
- onError: (e) => m.error(p(F, e))
278
- }), H = w({
279
- mutationFn: () => u(g, c),
281
+ onError: (e) => g.error(c(F, e))
282
+ }), H = D({
283
+ mutationFn: () => a(p, n),
280
284
  onSuccess: () => {
281
- B(), m.success(P("record.timeline.deleted", "Deleted"));
285
+ z(), g.success(P("record.timeline.deleted", "Deleted"));
282
286
  },
283
- onError: (e) => m.error(p(F, e))
284
- }), W = v(() => {
287
+ onError: (e) => g.error(c(F, e))
288
+ }), U = x(() => {
285
289
  let e = {};
286
- for (let n of x) e[n] = t[n] ?? "";
290
+ for (let n of C) e[n] = t[n] ?? "";
287
291
  R(e), k();
288
292
  }, [
289
293
  t,
290
- x,
294
+ C,
291
295
  k
292
- ]), G = v((e, t) => {
296
+ ]), G = x((e, t) => {
293
297
  R((n) => ({
294
298
  ...n,
295
299
  [e]: t
296
300
  }));
297
- }, []), K = b?.time_field, q = b?.type_field, J = b?.summary_field, Y = b?.content_field, X = b?.author_field, Z = b?.direction_field, Q = b?.intent_field;
298
- return E ? /* @__PURE__ */ O("div", {
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: [x.map((e) => {
309
- let t = d.fields.get(e);
310
- return t ? /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("label", {
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: n(P, t, e, M.entities)
318
- }), h({
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__ */ O("div", {
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__ */ D(a, {
338
+ children: [/* @__PURE__ */ A(u, {
335
339
  kind: "primary",
336
340
  size: "xs",
337
- icon: V.isPending ? /* @__PURE__ */ D(ee, { size: 12 }) : /* @__PURE__ */ D(i.check, { size: 12 }),
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__ */ D(a, {
345
+ }), /* @__PURE__ */ A(u, {
342
346
  size: "xs",
343
- icon: /* @__PURE__ */ D(i.x, { size: 12 }),
347
+ icon: /* @__PURE__ */ A(l.x, { size: 12 }),
344
348
  onClick: () => {
345
- R({}), A();
349
+ R({}), ee();
346
350
  },
347
351
  disabled: V.isPending,
348
352
  children: P("dialog.cancel", "Cancel")
349
353
  })]
350
354
  })]
351
- }) : /* @__PURE__ */ O("div", {
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__ */ O("div", {
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 && d.fields.get(K) && /* @__PURE__ */ D("span", {
379
+ K && t[K] != null && o.fields.get(K) && /* @__PURE__ */ A("span", {
376
380
  style: { fontWeight: 500 },
377
- children: h({
378
- field: d.fields.get(K),
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: S,
387
+ refs: w,
384
388
  t: P
385
389
  })
386
390
  }),
387
- q && t[q] != null && d.fields.get(q) && /* @__PURE__ */ D(s, {
391
+ q && t[q] != null && o.fields.get(q) && /* @__PURE__ */ A(f, {
388
392
  tone: "slate",
389
393
  size: "xs",
390
- children: h({
391
- field: d.fields.get(q),
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: S,
400
+ refs: w,
397
401
  t: P
398
402
  })
399
403
  }),
400
- Z && t[Z] != null && d.fields.get(Z) && /* @__PURE__ */ D(U, {
404
+ Z && t[Z] != null && o.fields.get(Z) && /* @__PURE__ */ A(W, {
401
405
  value: t[Z],
402
- field: d.fields.get(Z)
406
+ field: o.fields.get(Z)
403
407
  }),
404
- Q && t[Q] != null && d.fields.get(Q) && /* @__PURE__ */ D(s, {
408
+ Q && t[Q] != null && o.fields.get(Q) && /* @__PURE__ */ A(f, {
405
409
  tone: "slate",
406
410
  size: "xs",
407
- children: h({
408
- field: d.fields.get(Q),
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: S,
417
+ refs: w,
414
418
  t: P
415
419
  })
416
420
  }),
417
- X && t[X] != null && d.fields.get(X) && /* @__PURE__ */ D("span", { children: r(P("record.timeline.by_author", "by {author}"), { author: h({
418
- field: d.fields.get(X),
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: S,
427
+ refs: w,
424
428
  t: P
425
429
  }) }) }),
426
- !N && /* @__PURE__ */ O("div", {
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__ */ D(o, {
437
+ children: [/* @__PURE__ */ A(d, {
434
438
  size: 22,
435
- icon: /* @__PURE__ */ D(i.edit, { size: 11 }),
436
- onClick: W,
439
+ icon: /* @__PURE__ */ A(l.edit, { size: 11 }),
440
+ onClick: U,
437
441
  title: P("record.action.edit", "Edit")
438
- }), /* @__PURE__ */ D(o, {
442
+ }), /* @__PURE__ */ A(d, {
439
443
  size: 22,
440
- icon: /* @__PURE__ */ D(i.trash, { size: 11 }),
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 && d.fields.get(J) && /* @__PURE__ */ D("div", {
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: h({
454
- field: d.fields.get(J),
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: S,
463
+ refs: w,
460
464
  t: P
461
465
  })
462
466
  }),
463
- Y && t[Y] != null && Y !== J && d.fields.get(Y) && /* @__PURE__ */ D(z, {
464
- rendered: h({
465
- field: d.fields.get(Y),
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: S,
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 z({ rendered: e, text: t }) {
479
- let n = l(), r = {
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 (!P(t)) return /* @__PURE__ */ D("div", {
488
+ if (!F(t)) return /* @__PURE__ */ A("div", {
485
489
  style: r,
486
490
  children: e
487
491
  });
488
- let i = t.length > M, a = i ? t.slice(0, M) : t;
489
- return /* @__PURE__ */ D("div", {
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: j,
498
+ WebkitLineClamp: M,
495
499
  overflow: "hidden",
496
500
  whiteSpace: "pre-wrap",
497
501
  overflowWrap: "anywhere"
498
502
  },
499
- children: /* @__PURE__ */ D(c, {
503
+ children: /* @__PURE__ */ A(p, {
500
504
  width: 380,
501
- content: /* @__PURE__ */ O("div", {
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__ */ D("div", {
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 B(t) {
521
- if (t == null) return "";
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 V(t, n) {
526
- if (n == null) return "—";
527
- let r = new Date(e(n));
528
- if (Number.isNaN(r.getTime())) return "—";
529
- let i = /* @__PURE__ */ new Date(), a = /* @__PURE__ */ new Date();
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 H({ label: e, count: t }) {
539
- return /* @__PURE__ */ O("div", {
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__ */ D("span", {
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__ */ D("span", { style: {
559
+ /* @__PURE__ */ A("span", { style: {
560
560
  flex: 1,
561
561
  height: 1,
562
562
  background: "var(--divider)"
563
563
  } }),
564
- /* @__PURE__ */ D("span", {
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 U({ value: e, field: t }) {
576
- let n = l(), r = W(e, t);
577
- return r === null ? null : /* @__PURE__ */ O("span", {
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: [D(r ? i.arrowUp : i.arrowDown, { size: 10 }), r ? n("record.timeline.outbound", "Out") : n("record.timeline.inbound", "In")]
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 W(e, t) {
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 { L as ChildrenTimeline };
602
+ export { R as ChildrenTimeline };