@declarion/react 0.57.0 → 0.59.2

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 (166) hide show
  1. package/README.md +0 -2
  2. package/dist-lib/AgentChatPanel.impl-DBH1Ff4G.js +1200 -0
  3. package/dist-lib/DetailAuditStrip-9eJM2Fml.js +288 -0
  4. package/dist-lib/{DraggableChildrenTable-BV5sb8Uo.js → DraggableChildrenTable-4RZC351U.js} +87 -86
  5. package/dist-lib/Grid-CQabaBLx.js +405 -0
  6. package/dist-lib/{LayoutRenderer-C9AH9cXf.js → LayoutRenderer-DGKWZKpW.js} +1000 -1114
  7. package/dist-lib/{ListCardsBody-DXcDg536.js → ListCardsBody-DfGmyNIu.js} +84 -84
  8. package/dist-lib/MarkdownRenderer-BDbzDv_y.js +87 -0
  9. package/dist-lib/{RefreshControl-CNtN8zSl.js → RefreshControl-Bhoib0ZA.js} +126 -155
  10. package/dist-lib/SmartDetailPage.impl-DFjz29Ff.js +1565 -0
  11. package/dist-lib/SmartListPage.impl-BrZLE_Gb.js +3046 -0
  12. package/dist-lib/{SmartRecordListPage.impl-Bkl9aZJ8.js → SmartRecordListPage.impl-C1FJLr80.js} +281 -280
  13. package/dist-lib/SortHeaderMenu-Cijxk4cX.js +107 -0
  14. package/dist-lib/action-dispatch-DY0c8U81.js +1967 -0
  15. package/dist-lib/api/client.d.ts +5 -0
  16. package/dist-lib/api/data.d.ts +2 -4
  17. package/dist-lib/api/entities.d.ts +8 -15
  18. package/dist-lib/api/events.d.ts +3 -3
  19. package/dist-lib/cardProjection-Bkl2SSYz.js +499 -0
  20. package/dist-lib/components/actions/ResponsiveActionBar.d.ts +17 -16
  21. package/dist-lib/components/agents/AgentChatPanel.d.ts +3 -13
  22. package/dist-lib/components/agents/AgentChatPanel.impl.d.ts +14 -0
  23. package/dist-lib/components/agents/AgentPicker.d.ts +1 -2
  24. package/dist-lib/components/chrome/PageShell.d.ts +7 -0
  25. package/dist-lib/components/chrome/RecordHeader.d.ts +1 -2
  26. package/dist-lib/components/chrome/headerActionZone.d.ts +27 -0
  27. package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +1 -2
  28. package/dist-lib/components/detail-layout/DetailHighlights.d.ts +1 -2
  29. package/dist-lib/components/detail-layout/blockMeta.d.ts +2 -1
  30. package/dist-lib/components/fields/BoolField.d.ts +1 -1
  31. package/dist-lib/components/fields/EnumField.d.ts +1 -1
  32. package/dist-lib/components/fields/IntArrayField.d.ts +1 -1
  33. package/dist-lib/components/fields/MultilangArrayField.d.ts +2 -0
  34. package/dist-lib/components/fields/MultilangField.d.ts +1 -1
  35. package/dist-lib/components/fields/MultilangTextField.d.ts +1 -1
  36. package/dist-lib/components/fields/NumberField.d.ts +1 -1
  37. package/dist-lib/components/fields/PasswordField.d.ts +1 -1
  38. package/dist-lib/components/fields/RefCombobox.d.ts +1 -1
  39. package/dist-lib/components/fields/SecretField.d.ts +1 -1
  40. package/dist-lib/components/fields/StringArrayField.d.ts +1 -1
  41. package/dist-lib/components/fields/TimestampField.d.ts +1 -1
  42. package/dist-lib/components/fields/cells/registry.d.ts +2 -1
  43. package/dist-lib/components/fields/index.d.ts +2 -1
  44. package/dist-lib/components/fields/langMap.d.ts +2 -0
  45. package/dist-lib/components/fields/secretValue.d.ts +2 -0
  46. package/dist-lib/components/file-widgets/UnknownFileWidget.d.ts +3 -0
  47. package/dist-lib/components/file-widgets/UploadFailureText.d.ts +4 -0
  48. package/dist-lib/components/file-widgets/helpers.d.ts +1 -1
  49. package/dist-lib/components/file-widgets/host.d.ts +4 -3
  50. package/dist-lib/components/file-widgets/types.d.ts +1 -0
  51. package/dist-lib/components/file-widgets/upload.d.ts +18 -3
  52. package/dist-lib/components/filters/filter-op-label.d.ts +3 -0
  53. package/dist-lib/components/layout/ImpersonationBanner.d.ts +1 -1
  54. package/dist-lib/components/layout/ImpersonationFrame.d.ts +1 -1
  55. package/dist-lib/components/layout/Layout.d.ts +2 -1
  56. package/dist-lib/components/layout/Sidebar.d.ts +2 -1
  57. package/dist-lib/components/layout/TenantChip.d.ts +1 -1
  58. package/dist-lib/components/list/ViewSwitcher.d.ts +4 -2
  59. package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -2
  60. package/dist-lib/components/pages/ExportMenu.d.ts +3 -5
  61. package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +1 -2
  62. package/dist-lib/components/pages/auth/AuthShell.d.ts +4 -31
  63. package/dist-lib/components/pages/exportRequest.d.ts +4 -6
  64. package/dist-lib/components/pages/list/DeleteViewDialog.d.ts +8 -0
  65. package/dist-lib/components/pages/list/ListCardRow.d.ts +1 -2
  66. package/dist-lib/components/pages/list/ListCardsBody.d.ts +0 -1
  67. package/dist-lib/components/pages/list/ListFloatbar.d.ts +2 -2
  68. package/dist-lib/components/pages/list/ListHeader.d.ts +2 -2
  69. package/dist-lib/components/pages/list/ListNoRows.d.ts +4 -5
  70. package/dist-lib/components/pages/list/ListToolbar.d.ts +3 -2
  71. package/dist-lib/components/pages/list/ListUrlBanner.d.ts +10 -0
  72. package/dist-lib/components/pages/list/RowActionsCell.d.ts +2 -4
  73. package/dist-lib/components/pages/list/RowContextMenu.d.ts +1 -2
  74. package/dist-lib/components/pages/list/columns.d.ts +2 -1
  75. package/dist-lib/components/pages/list/filter-meta.d.ts +2 -1
  76. package/dist-lib/components/pages/list/useActiveView.d.ts +38 -0
  77. package/dist-lib/components/pages/list/useListColumnLayout.d.ts +6 -5
  78. package/dist-lib/components/pages/list/useListQuery.d.ts +4 -4
  79. package/dist-lib/components/pages/list/useListSort.d.ts +5 -4
  80. package/dist-lib/components/pages/list/useListViews.d.ts +18 -8
  81. package/dist-lib/components/pages/list/useRowMenu.d.ts +2 -3
  82. package/dist-lib/components/pages/profile/Profile.d.ts +3 -0
  83. package/dist-lib/components/params/ParamsBlock.d.ts +1 -13
  84. package/dist-lib/components/params/param-editors.d.ts +3 -11
  85. package/dist-lib/components/primitives/ClassifiedFieldLocked.d.ts +1 -2
  86. package/dist-lib/components/shared/DynamicIcon.d.ts +2 -2
  87. package/dist-lib/components/shared/LoadingSkeleton.d.ts +1 -0
  88. package/dist-lib/components/shared/LucideIcon.d.ts +1 -1
  89. package/dist-lib/components/shared/useOwnRefresh.d.ts +1 -1
  90. package/dist-lib/declarion-react.css +1 -1
  91. package/dist-lib/embed/theme.d.ts +1 -1
  92. package/dist-lib/embed/useEmbedNavigate.d.ts +1 -1
  93. package/dist-lib/failure-v-uGSpbX.js +158 -0
  94. package/dist-lib/{field-classification-D6xQYn-h.js → field-classification-C28XE-_P.js} +514 -307
  95. package/dist-lib/format-count-DA4wmmWR.js +1771 -0
  96. package/dist-lib/hooks/useEntityData.d.ts +1 -1
  97. package/dist-lib/hooks/useFilters.d.ts +7 -5
  98. package/dist-lib/hooks/useLanguage.d.ts +4 -0
  99. package/dist-lib/hooks/useParams.d.ts +4 -51
  100. package/dist-lib/hooks/useRegisterScreenTab.d.ts +1 -1
  101. package/dist-lib/hooks/useSSE.d.ts +3 -3
  102. package/dist-lib/hooks/useTabTitle.d.ts +2 -0
  103. package/dist-lib/hooks/useText.d.ts +3 -3
  104. package/dist-lib/hooks/useVersionWatcher.d.ts +1 -1
  105. package/dist-lib/hooks/useViews.d.ts +20 -0
  106. package/dist-lib/index.d.ts +8 -7
  107. package/dist-lib/index.js +2716 -5803
  108. package/dist-lib/lib/action-dispatch.d.ts +2 -1
  109. package/dist-lib/lib/actions.d.ts +30 -42
  110. package/dist-lib/lib/anchor.d.ts +3 -4
  111. package/dist-lib/lib/decimal-text.d.ts +1 -0
  112. package/dist-lib/lib/document-templates.d.ts +1 -2
  113. package/dist-lib/lib/download.d.ts +2 -1
  114. package/dist-lib/lib/evidence-verdict.d.ts +2 -1
  115. package/dist-lib/lib/failure.d.ts +2 -0
  116. package/dist-lib/lib/field-classification.d.ts +3 -3
  117. package/dist-lib/lib/filters.d.ts +18 -2
  118. package/dist-lib/lib/format-count.d.ts +8 -7
  119. package/dist-lib/lib/language.d.ts +19 -0
  120. package/dist-lib/lib/mass-edit.d.ts +2 -1
  121. package/dist-lib/lib/realtime-query-keys.d.ts +1 -1
  122. package/dist-lib/lib/realtime-reconcile.d.ts +3 -4
  123. package/dist-lib/lib/screen-back.d.ts +4 -6
  124. package/dist-lib/lib/sort.d.ts +9 -9
  125. package/dist-lib/lib/timestamp.d.ts +5 -7
  126. package/dist-lib/lib/ui-actions.d.ts +2 -1
  127. package/dist-lib/peekDraftStore-D-cTbiIr.js +199 -0
  128. package/dist-lib/registry-Cb3W-czW.js +1950 -0
  129. package/dist-lib/safe-url-oSJw5pzO.js +34 -0
  130. package/dist-lib/stores/icon-registry.d.ts +2 -2
  131. package/dist-lib/stores/list-layout.d.ts +3 -4
  132. package/dist-lib/stores/realtime.d.ts +1 -1
  133. package/dist-lib/stores/tabs.d.ts +3 -2
  134. package/dist-lib/testing.d.ts +6 -0
  135. package/dist-lib/testing.js +98 -76
  136. package/dist-lib/types/api.d.ts +7 -8
  137. package/dist-lib/types/fieldType.d.ts +1 -1
  138. package/dist-lib/types/files.d.ts +4 -4
  139. package/dist-lib/types/schema.d.ts +44 -50
  140. package/dist-lib/useAgentConversation-D97IqE-J.js +623 -0
  141. package/dist-lib/{useCurrentScreen-CzwzQpoW.js → useCurrentScreen-BL5NZFCw.js} +2777 -3768
  142. package/dist-lib/useListQuery-BG1GyKtJ.js +103 -0
  143. package/dist-lib/useProperties-4Lg3odrt.js +83 -0
  144. package/dist-lib/{useTabSearchMirror-C39U85cg.js → useTabSearchMirror-ZVLlINBX.js} +49 -51
  145. package/dist-lib/useText-BFDCTUSo.js +952 -0
  146. package/dist-lib/{value-Bo8C8WMU.js → value-By1-WJ8J.js} +74 -76
  147. package/dist-lib/vite/fingerprint-plugin.d.ts +2 -3
  148. package/package.json +9 -9
  149. package/dist-lib/Grid-DWgUPuZ3.js +0 -404
  150. package/dist-lib/MarkdownRenderer-CcSFc2N3.js +0 -85
  151. package/dist-lib/RecordIdBadge-CGxPR-8q.js +0 -24
  152. package/dist-lib/SmartDetailPage.impl-lskCd-WG.js +0 -1846
  153. package/dist-lib/SmartListPage.impl-CrGbdzyK.js +0 -2854
  154. package/dist-lib/SortHeaderMenu-SYSAaqQJ.js +0 -106
  155. package/dist-lib/action-dispatch-CR4ajBtT.js +0 -1985
  156. package/dist-lib/cardProjection-CW5RIMko.js +0 -699
  157. package/dist-lib/components/pages/home/HomeStub.d.ts +0 -6
  158. package/dist-lib/components/pages/jobs/Jobs.d.ts +0 -1
  159. package/dist-lib/components/pages/pipeline/Pipeline.d.ts +0 -1
  160. package/dist-lib/format-count-Dobmi-Ji.js +0 -1551
  161. package/dist-lib/hooks/useUserLocale.d.ts +0 -1
  162. package/dist-lib/lib/messages.d.ts +0 -12
  163. package/dist-lib/peekDraftStore-5wQ7lq_V.js +0 -194
  164. package/dist-lib/registry-CjgUaF7C.js +0 -1768
  165. package/dist-lib/useListQuery-D7Hr5WM1.js +0 -96
  166. package/dist-lib/useProperties-CqtCzFCr.js +0 -81
@@ -0,0 +1,288 @@
1
+ import { s as e } from "./DynamicIcon-DW5krHuX.js";
2
+ import { In as t, Ln as n, on as r } from "./useCurrentScreen-BL5NZFCw.js";
3
+ import { h as i } from "./RefreshControl-Bhoib0ZA.js";
4
+ import { t as a } from "./useText-BFDCTUSo.js";
5
+ import { A as o } from "./field-classification-C28XE-_P.js";
6
+ import { p as s } from "./action-dispatch-DY0c8U81.js";
7
+ import { useCallback as c, useState as l } from "react";
8
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ //#region src/components/primitives/RecordIdBadge.tsx
10
+ var p = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, m = 1200;
11
+ function h({ value: t }) {
12
+ let n = a(), [r, i] = l(!1), o = p.test(t) ? `${t.slice(0, 8)}…` : t, s = c(async () => {
13
+ try {
14
+ await navigator.clipboard.writeText(t), i(!0), window.setTimeout(() => i(!1), m);
15
+ } catch {}
16
+ }, [t]);
17
+ return /* @__PURE__ */ f("button", {
18
+ type: "button",
19
+ onClick: s,
20
+ title: r ? n("control.copied", "Copied") : n("control.copy_value", "Copy {value}", { value: t }),
21
+ className: "mono inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-text-4 hover:bg-surface-2 hover:text-text-3 transition-colors shrink-0 border border-transparent hover:border-border",
22
+ children: [/* @__PURE__ */ d("span", { children: o }), r ? /* @__PURE__ */ d(e.check, { size: 10 }) : /* @__PURE__ */ d(e.copy, {
23
+ size: 10,
24
+ style: { opacity: .6 }
25
+ })]
26
+ });
27
+ }
28
+ //#endregion
29
+ //#region src/components/chrome/PageShell.tsx
30
+ function g({ header: e, children: t, scrollRef: n }) {
31
+ let i = r(), a = i.isPhone ? o(12) : {
32
+ paddingLeft: "24px",
33
+ paddingRight: "24px"
34
+ };
35
+ return /* @__PURE__ */ f("div", {
36
+ style: {
37
+ height: "100%",
38
+ display: "flex",
39
+ flexDirection: "column",
40
+ overflow: "hidden",
41
+ background: "var(--background)"
42
+ },
43
+ children: [/* @__PURE__ */ d("div", {
44
+ "data-testid": "page-shell-header",
45
+ style: {
46
+ flexShrink: 0,
47
+ paddingTop: i.isPhone ? 14 : 24,
48
+ paddingBottom: 8,
49
+ ...a
50
+ },
51
+ children: e
52
+ }), /* @__PURE__ */ d("div", {
53
+ ref: n,
54
+ style: {
55
+ flex: 1,
56
+ minHeight: 0,
57
+ overflowY: "auto",
58
+ paddingTop: 4,
59
+ paddingBottom: "calc(24px + var(--safe-area-bottom))",
60
+ ...a,
61
+ display: "flex",
62
+ flexDirection: "column",
63
+ gap: 16,
64
+ minWidth: 0,
65
+ WebkitOverflowScrolling: "touch"
66
+ },
67
+ children: t
68
+ })]
69
+ });
70
+ }
71
+ var _ = {
72
+ display: "flex",
73
+ alignItems: "center",
74
+ gap: 6,
75
+ flexGrow: 1,
76
+ flexShrink: 1,
77
+ flexBasis: "auto",
78
+ marginLeft: "auto",
79
+ minWidth: 180,
80
+ flexWrap: "wrap",
81
+ justifyContent: "flex-end"
82
+ }, v = 160;
83
+ function y({ icon: r, title: o, recordId: s, description: c, highlights: l, mode: p, dirty: m = !1, showBack: g = !1, onBack: y, right: b, identityControls: x, showTitle: S = !0 }) {
84
+ let C = a();
85
+ return /* @__PURE__ */ f("div", {
86
+ style: {
87
+ display: "flex",
88
+ alignItems: "flex-start",
89
+ gap: 10,
90
+ flexWrap: "wrap",
91
+ minWidth: 0
92
+ },
93
+ children: [
94
+ S && g && /* @__PURE__ */ d("div", {
95
+ style: {
96
+ paddingTop: 4,
97
+ flexShrink: 0
98
+ },
99
+ children: /* @__PURE__ */ d(n, {
100
+ size: 26,
101
+ icon: /* @__PURE__ */ d(e.back, { size: 14 }),
102
+ title: C("shell.back", "Back"),
103
+ onClick: y
104
+ })
105
+ }),
106
+ S && r && /* @__PURE__ */ d("div", {
107
+ style: {
108
+ flexShrink: 0,
109
+ paddingTop: 2
110
+ },
111
+ children: /* @__PURE__ */ d("span", {
112
+ style: {
113
+ width: 32,
114
+ height: 32,
115
+ borderRadius: 8,
116
+ background: "var(--accent-soft)",
117
+ color: "var(--accent)",
118
+ display: "flex",
119
+ alignItems: "center",
120
+ justifyContent: "center"
121
+ },
122
+ children: r
123
+ })
124
+ }),
125
+ S && /* @__PURE__ */ f(u, { children: [
126
+ /* @__PURE__ */ d("h1", {
127
+ style: {
128
+ margin: 0,
129
+ fontSize: "var(--page-title-size, var(--page-title-size-detail))",
130
+ fontWeight: 600,
131
+ letterSpacing: 0,
132
+ lineHeight: "var(--page-title-line-height, var(--page-title-line-height-detail))",
133
+ color: "var(--text)",
134
+ minWidth: v,
135
+ overflow: "hidden",
136
+ textOverflow: "ellipsis",
137
+ whiteSpace: "nowrap",
138
+ overflowWrap: "anywhere",
139
+ maxWidth: "100%",
140
+ flexGrow: 0,
141
+ flexShrink: 1,
142
+ flexBasis: "auto"
143
+ },
144
+ children: o
145
+ }),
146
+ s && /* @__PURE__ */ d(h, { value: s }),
147
+ c && /* @__PURE__ */ d(i, {
148
+ label: c,
149
+ "data-testid": "detail-description-info"
150
+ }),
151
+ x,
152
+ p === "edit" && m && /* @__PURE__ */ f("span", {
153
+ style: {
154
+ display: "inline-flex",
155
+ alignItems: "center",
156
+ gap: 5,
157
+ fontSize: 11,
158
+ color: "var(--warn)"
159
+ },
160
+ children: [/* @__PURE__ */ d("span", { style: {
161
+ width: 6,
162
+ height: 6,
163
+ borderRadius: 999,
164
+ background: "var(--warn)"
165
+ } }), C("shell.record.unsaved", "Unsaved")]
166
+ }),
167
+ p === "create" && /* @__PURE__ */ d(t, {
168
+ tone: "violet",
169
+ size: "xs",
170
+ dot: !0,
171
+ children: C("shell.record.new", "New record")
172
+ })
173
+ ] }),
174
+ b && /* @__PURE__ */ d("div", {
175
+ role: "toolbar",
176
+ "aria-label": C("shell.record.page_actions", "Page actions"),
177
+ style: _,
178
+ children: b
179
+ }),
180
+ l && p === "display" && /* @__PURE__ */ d("div", {
181
+ style: {
182
+ flexBasis: "100%",
183
+ minWidth: 0
184
+ },
185
+ children: l
186
+ })
187
+ ]
188
+ });
189
+ }
190
+ //#endregion
191
+ //#region src/components/chrome/AuditMetaStrip.tsx
192
+ function b(e) {
193
+ return e.by != null || e.at != null;
194
+ }
195
+ function x({ lines: e }) {
196
+ let t = e.filter(b);
197
+ return t.length === 0 ? null : /* @__PURE__ */ d("div", {
198
+ style: {
199
+ display: "flex",
200
+ flexWrap: "wrap",
201
+ gap: "8px 24px",
202
+ padding: "10px 14px",
203
+ background: "var(--surface-2)",
204
+ border: "1px solid var(--border)",
205
+ borderRadius: 8,
206
+ fontSize: 11.5,
207
+ color: "var(--text-3)"
208
+ },
209
+ children: t.map((e, t) => /* @__PURE__ */ d(S, { line: e }, t))
210
+ });
211
+ }
212
+ function S({ line: e }) {
213
+ return /* @__PURE__ */ f("div", {
214
+ style: {
215
+ display: "flex",
216
+ alignItems: "center",
217
+ gap: 8,
218
+ minWidth: 0
219
+ },
220
+ children: [/* @__PURE__ */ d("span", {
221
+ style: {
222
+ fontSize: 11,
223
+ fontWeight: 600,
224
+ color: "var(--text-4)",
225
+ flexShrink: 0
226
+ },
227
+ children: e.label
228
+ }), /* @__PURE__ */ f("span", {
229
+ style: {
230
+ display: "inline-flex",
231
+ alignItems: "center",
232
+ gap: 6,
233
+ minWidth: 0
234
+ },
235
+ children: [
236
+ e.by != null && /* @__PURE__ */ d("span", {
237
+ style: { color: "var(--text-2)" },
238
+ children: e.by
239
+ }),
240
+ e.by != null && e.at != null && /* @__PURE__ */ d("span", {
241
+ style: { color: "var(--text-4)" },
242
+ children: "·"
243
+ }),
244
+ e.at != null && /* @__PURE__ */ d("span", {
245
+ className: "num",
246
+ children: e.at
247
+ })
248
+ ]
249
+ })]
250
+ });
251
+ }
252
+ //#endregion
253
+ //#region src/components/detail-layout/DetailAuditStrip.tsx
254
+ function C({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: o }) {
255
+ let c = a(), l = e.audit;
256
+ if (l?.enabled === !1) return null;
257
+ let u = (e) => {
258
+ if (!e || !t.fields.get(e)) return;
259
+ let a = r[e];
260
+ if (a != null && a !== "") return s({
261
+ entity: t,
262
+ entityCode: n,
263
+ fieldName: e,
264
+ record: r,
265
+ mode: "display",
266
+ refs: i,
267
+ entities: o.entities,
268
+ screens: o.screens,
269
+ surface: "list",
270
+ t: c
271
+ });
272
+ }, f = l?.lines && l.lines.length > 0 ? l.lines.map((e) => ({
273
+ label: c(e.label),
274
+ at: u(e.at),
275
+ by: u(e.by)
276
+ })) : [{
277
+ label: c("record.audit.created", "Created"),
278
+ at: u("created_at"),
279
+ by: u("created_by")
280
+ }, {
281
+ label: c("record.audit.updated", "Updated"),
282
+ at: u("updated_at"),
283
+ by: u("updated_by")
284
+ }];
285
+ return /* @__PURE__ */ d(x, { lines: f });
286
+ }
287
+ //#endregion
288
+ export { h as a, g as i, y as n, _ as r, C as t };
@@ -1,5 +1,6 @@
1
1
  import { s as e } from "./DynamicIcon-DW5krHuX.js";
2
- import { $n as t, Br as n, Vr as r, et as i, mr as a, tt as o } from "./useCurrentScreen-CzwzQpoW.js";
2
+ import { Ln as t, Rn as n, _n as r, jn as i, rt as a } from "./useCurrentScreen-BL5NZFCw.js";
3
+ import { t as o } from "./useText-BFDCTUSo.js";
3
4
  import { n as s, r as c, t as l } from "./dataTableStyles-vwD1mVOP.js";
4
5
  import { useCallback as u, useMemo as d, useRef as f } from "react";
5
6
  import { jsx as p, jsxs as m } from "react/jsx-runtime";
@@ -7,68 +8,68 @@ import { DndContext as h, PointerSensor as g, closestCenter as _, useSensor as v
7
8
  import { SortableContext as b, useSortable as x, verticalListSortingStrategy as S } from "@dnd-kit/sortable";
8
9
  import { CSS as C } from "@dnd-kit/utilities";
9
10
  //#region src/components/detail-layout/DraggableChildrenTable.tsx
10
- function w({ config: n, childEntity: i, schema: a, rows: o, onChange: l, validationErrors: x, refs: C }) {
11
- let w = f(null), E = n.position_field, D = n.columns, O = y(v(g, { activationConstraint: { distance: 5 } })), k = new Set(Array.isArray(n.foreign_key) ? n.foreign_key : [n.foreign_key]), A = D.filter((e) => {
12
- if (k.has(e) || e === E) return !1;
11
+ function w({ config: t, childEntity: i, schema: a, rows: l, onChange: x, validationErrors: C, refs: w }) {
12
+ let E = o(), D = f(null), O = t.position_field, k = t.columns, A = y(v(g, { activationConstraint: { distance: 5 } })), j = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), M = k.filter((e) => {
13
+ if (j.has(e) || e === O) return !1;
13
14
  let t = i.fields.get(e);
14
15
  return !(!t || t.auto || t.primary || t.source);
15
- }), j = new Set(D.filter((e) => {
16
- if (e === E) return !0;
16
+ }), N = new Set(k.filter((e) => {
17
+ if (e === O) return !0;
17
18
  let t = i.fields.get(e);
18
19
  return t && (t.auto || t.primary || t.source);
19
- })), M = D.filter((e) => e !== E), N = d(() => o.filter((e) => !e._deleted).map((e) => e._key), [o]), P = u((e, t, n) => {
20
- l(o.map((r) => r._key === e ? {
20
+ })), P = k.filter((e) => e !== O), F = d(() => l.filter((e) => !e._deleted).map((e) => e._key), [l]), I = u((e, t, n) => {
21
+ x(l.map((r) => r._key === e ? {
21
22
  ...r,
22
23
  [t]: n,
23
24
  _dirty: !0
24
25
  } : r));
25
- }, [o, l]), F = u(() => {
26
- let e = o.filter((e) => !e._deleted).reduce((e, t) => {
27
- let n = typeof t[E] == "number" ? t[E] : -1;
26
+ }, [l, x]), L = u(() => {
27
+ let e = l.filter((e) => !e._deleted).reduce((e, t) => {
28
+ let n = typeof t[O] == "number" ? t[O] : -1;
28
29
  return Math.max(e, n);
29
- }, -1), t = {
30
+ }, -1), n = {
30
31
  _key: crypto.randomUUID(),
31
32
  _dirty: !0,
32
- [E]: e + 1
33
- }, r = n.quick_add?.defaults ?? {};
34
- for (let e of A) {
35
- let n = i.fields.get(e);
36
- n && (r[e] === void 0 ? n.default === void 0 ? n.type === "bool" && (t[e] = !1) : t[e] = n.default : t[e] = r[e]);
33
+ [O]: e + 1
34
+ }, r = t.quick_add?.defaults ?? {};
35
+ for (let e of M) {
36
+ let t = i.fields.get(e);
37
+ t && (r[e] === void 0 ? t.default === void 0 ? t.type === "bool" && (n[e] = !1) : n[e] = t.default : n[e] = r[e]);
37
38
  }
38
- l([...o, t]);
39
+ x([...l, n]);
39
40
  }, [
40
- o,
41
41
  l,
42
- A,
42
+ x,
43
+ M,
43
44
  i,
44
- n.quick_add?.defaults,
45
- E
46
- ]), I = u((e) => {
47
- l(o.map((t) => t._key === e ? {
45
+ t.quick_add?.defaults,
46
+ O
47
+ ]), R = u((e) => {
48
+ x(l.map((t) => t._key === e ? {
48
49
  ...t,
49
50
  _deleted: !0
50
51
  } : t));
51
- }, [o, l]), L = u((e) => {
52
- l(o.map((t) => t._key === e ? {
52
+ }, [l, x]), z = u((e) => {
53
+ x(l.map((t) => t._key === e ? {
53
54
  ...t,
54
55
  _deleted: !1
55
56
  } : t));
56
- }, [o, l]), R = u((e) => {
57
+ }, [l, x]), B = u((e) => {
57
58
  let { active: t, over: n } = e;
58
59
  if (!n || t.id === n.id) return;
59
- let r = o.filter((e) => !e._deleted), i = o.filter((e) => e._deleted), a = r.findIndex((e) => e._key === String(t.id)), s = r.findIndex((e) => e._key === String(n.id));
60
- if (a === -1 || s === -1) return;
61
- let c = [...r], [u] = c.splice(a, 1);
62
- c.splice(s, 0, u), l([...c.map((e, t) => ({
60
+ let r = l.filter((e) => !e._deleted), i = l.filter((e) => e._deleted), a = r.findIndex((e) => e._key === String(t.id)), o = r.findIndex((e) => e._key === String(n.id));
61
+ if (a === -1 || o === -1) return;
62
+ let s = [...r], [c] = s.splice(a, 1);
63
+ s.splice(o, 0, c), x([...s.map((e, t) => ({
63
64
  ...e,
64
- [E]: t,
65
- _dirty: e[E] !== t || e._dirty
65
+ [O]: t,
66
+ _dirty: e[O] !== t || e._dirty
66
67
  })), ...i]);
67
68
  }, [
68
- o,
69
69
  l,
70
- E
71
- ]), z = u((e) => {
70
+ x,
71
+ O
72
+ ]), V = u((e) => {
72
73
  let t = e.target, n = t.closest("td");
73
74
  if (!n) return;
74
75
  let r = n.closest("tr");
@@ -92,7 +93,7 @@ function w({ config: n, childEntity: i, schema: a, rows: o, onChange: l, validat
92
93
  if (o < t.length - 1) {
93
94
  let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
94
95
  e && e.focus();
95
- } else F(), requestAnimationFrame(() => {
96
+ } else L(), requestAnimationFrame(() => {
96
97
  let e = i.querySelectorAll("tr"), t = e[e.length - 1];
97
98
  if (t) {
98
99
  let e = t.querySelector("input, select, textarea, [tabindex]");
@@ -100,66 +101,66 @@ function w({ config: n, childEntity: i, schema: a, rows: o, onChange: l, validat
100
101
  }
101
102
  });
102
103
  } else e.key === "Escape" && t.blur?.();
103
- }, [F]), B = s;
104
+ }, [L]), H = s;
104
105
  return /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("div", {
105
106
  style: { overflowX: "auto" },
106
107
  children: /* @__PURE__ */ p(h, {
107
- sensors: O,
108
+ sensors: A,
108
109
  collisionDetection: _,
109
- onDragEnd: R,
110
+ onDragEnd: B,
110
111
  children: /* @__PURE__ */ m("table", {
111
- ref: w,
112
+ ref: D,
112
113
  style: c,
113
- onKeyDown: z,
114
+ onKeyDown: V,
114
115
  children: [/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
115
116
  /* @__PURE__ */ p("th", { style: {
116
- ...B,
117
+ ...H,
117
118
  width: 32,
118
119
  padding: "0 4px"
119
120
  } }),
120
- M.map((e) => {
121
- let n = i.fields.get(e);
121
+ P.map((e) => {
122
+ let t = i.fields.get(e);
122
123
  return /* @__PURE__ */ p("th", {
123
- style: B,
124
- children: n ? t(n, e, a.entities) : e
124
+ style: H,
125
+ children: t ? r(E, t, e, a.entities) : e
125
126
  }, e);
126
127
  }),
127
128
  /* @__PURE__ */ p("th", { style: {
128
- ...B,
129
+ ...H,
129
130
  width: 40
130
131
  } })
131
132
  ] }) }), /* @__PURE__ */ p(b, {
132
- items: N,
133
+ items: F,
133
134
  strategy: S,
134
- children: /* @__PURE__ */ p("tbody", { children: o.map((e) => /* @__PURE__ */ p(T, {
135
+ children: /* @__PURE__ */ p("tbody", { children: l.map((e) => /* @__PURE__ */ p(T, {
135
136
  row: e,
136
- columns: M,
137
- editableColumns: A,
138
- displayOnlyColumns: j,
137
+ columns: P,
138
+ editableColumns: M,
139
+ displayOnlyColumns: N,
139
140
  childEntity: i,
140
- validationErrors: x,
141
- refs: C,
142
- onCellChange: P,
143
- onDelete: I,
144
- onUndoDelete: L
141
+ validationErrors: C,
142
+ refs: w,
143
+ onCellChange: I,
144
+ onDelete: R,
145
+ onUndoDelete: z
145
146
  }, e._key)) })
146
147
  })]
147
148
  })
148
149
  })
149
150
  }), /* @__PURE__ */ p("div", {
150
151
  style: { marginTop: 8 },
151
- children: /* @__PURE__ */ p(r, {
152
+ children: /* @__PURE__ */ p(n, {
152
153
  kind: "ghost",
153
154
  size: "xs",
154
155
  icon: /* @__PURE__ */ p(e.plus, { size: 12 }),
155
- onClick: F,
156
- children: "Add row"
156
+ onClick: L,
157
+ children: E("record.row.add", "Add row")
157
158
  })
158
159
  })] });
159
160
  }
160
- function T({ row: t, columns: r, editableColumns: s, displayOnlyColumns: c, childEntity: u, validationErrors: d, refs: f, onCellChange: h, onDelete: g, onUndoDelete: _ }) {
161
- let v = i(), y = !!t._deleted, b = d?.[t._key], { attributes: S, listeners: w, setNodeRef: T, transform: E, transition: D, isDragging: O } = x({
162
- id: t._key,
161
+ function T({ row: n, columns: r, editableColumns: s, displayOnlyColumns: c, childEntity: u, validationErrors: d, refs: f, onCellChange: h, onDelete: g, onUndoDelete: _ }) {
162
+ let v = o(), y = !!n._deleted, b = d?.[n._key], { attributes: S, listeners: w, setNodeRef: T, transform: E, transition: D, isDragging: O } = x({
163
+ id: n._key,
163
164
  disabled: y
164
165
  }), k = {
165
166
  transform: C.Translate.toString(E),
@@ -201,21 +202,21 @@ function T({ row: t, columns: r, editableColumns: s, displayOnlyColumns: c, chil
201
202
  })
202
203
  }),
203
204
  r.map((e) => {
204
- let n = u.fields.get(e), r = b?.includes(e), i = c.has(e), l = s.includes(e);
205
- return y || i || !l ? /* @__PURE__ */ p("td", {
205
+ let t = u.fields.get(e), r = b?.includes(e), o = c.has(e), l = s.includes(e);
206
+ return y || o || !l ? /* @__PURE__ */ p("td", {
206
207
  style: {
207
208
  ...A,
208
209
  textDecoration: y ? "line-through" : "none"
209
210
  },
210
- children: n ? o({
211
- field: n,
211
+ children: t ? a({
212
+ field: t,
212
213
  fieldName: e,
213
- value: t[e],
214
+ value: n[e],
214
215
  mode: "display",
215
- record: t,
216
+ record: n,
216
217
  refs: f,
217
- locale: v
218
- }) : a(t[e])
218
+ t: v
219
+ }) : i(n[e])
219
220
  }, e) : /* @__PURE__ */ p("td", {
220
221
  style: {
221
222
  ...j,
@@ -223,17 +224,17 @@ function T({ row: t, columns: r, editableColumns: s, displayOnlyColumns: c, chil
223
224
  outlineOffset: -1,
224
225
  borderRadius: r ? 4 : 0
225
226
  },
226
- title: r ? `${e} is required` : void 0,
227
- children: n ? o({
228
- field: n,
227
+ title: r ? v("record.row.field_required", "{field} is required", { field: e }) : void 0,
228
+ children: t ? a({
229
+ field: t,
229
230
  fieldName: e,
230
- value: t[e],
231
+ value: n[e],
231
232
  mode: "edit",
232
- onChange: (n) => h(t._key, e, n),
233
- record: t,
233
+ onChange: (t) => h(n._key, e, t),
234
+ record: n,
234
235
  refs: f,
235
- locale: v
236
- }) : a(t[e])
236
+ t: v
237
+ }) : i(n[e])
237
238
  }, e);
238
239
  }),
239
240
  /* @__PURE__ */ p("td", {
@@ -242,16 +243,16 @@ function T({ row: t, columns: r, editableColumns: s, displayOnlyColumns: c, chil
242
243
  borderBottom: "1px solid var(--divider)",
243
244
  verticalAlign: "middle"
244
245
  },
245
- children: y ? /* @__PURE__ */ p(n, {
246
+ children: y ? /* @__PURE__ */ p(t, {
246
247
  size: 24,
247
248
  icon: /* @__PURE__ */ p(e.refresh, { size: 12 }),
248
- onClick: () => _(t._key),
249
- title: "Undo delete"
250
- }) : /* @__PURE__ */ p(n, {
249
+ onClick: () => _(n._key),
250
+ title: v("record.row.undo_delete", "Undo delete")
251
+ }) : /* @__PURE__ */ p(t, {
251
252
  size: 24,
252
253
  icon: /* @__PURE__ */ p(e.trash, { size: 12 }),
253
- onClick: () => g(t._key),
254
- title: "Delete row"
254
+ onClick: () => g(n._key),
255
+ title: v("record.row.delete", "Delete row")
255
256
  })
256
257
  })
257
258
  ]