@declarion/react 0.56.0 → 0.59.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 (167) hide show
  1. package/README.md +0 -2
  2. package/dist-lib/AgentChatPanel.impl-DBH1Ff4G.js +1200 -0
  3. package/dist-lib/DetailAuditStrip-GNRA_eP5.js +289 -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-Ds2RGg6K.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/detail-layout/ChildrenBlock.d.ts +1 -1
  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/ErrorBoundary.d.ts +1 -1
  88. package/dist-lib/components/shared/LoadingSkeleton.d.ts +1 -0
  89. package/dist-lib/components/shared/LucideIcon.d.ts +1 -1
  90. package/dist-lib/components/shared/useOwnRefresh.d.ts +1 -1
  91. package/dist-lib/declarion-react.css +1 -1
  92. package/dist-lib/embed/theme.d.ts +1 -1
  93. package/dist-lib/embed/useEmbedNavigate.d.ts +1 -1
  94. package/dist-lib/failure-v-uGSpbX.js +158 -0
  95. package/dist-lib/{field-classification-D6xQYn-h.js → field-classification-C28XE-_P.js} +514 -307
  96. package/dist-lib/format-count-DA4wmmWR.js +1771 -0
  97. package/dist-lib/hooks/useEntityData.d.ts +1 -1
  98. package/dist-lib/hooks/useFilters.d.ts +7 -5
  99. package/dist-lib/hooks/useLanguage.d.ts +4 -0
  100. package/dist-lib/hooks/useParams.d.ts +4 -51
  101. package/dist-lib/hooks/useRegisterScreenTab.d.ts +1 -1
  102. package/dist-lib/hooks/useSSE.d.ts +3 -3
  103. package/dist-lib/hooks/useTabTitle.d.ts +2 -0
  104. package/dist-lib/hooks/useText.d.ts +3 -3
  105. package/dist-lib/hooks/useVersionWatcher.d.ts +1 -1
  106. package/dist-lib/hooks/useViews.d.ts +20 -0
  107. package/dist-lib/index.d.ts +8 -7
  108. package/dist-lib/index.js +2716 -5795
  109. package/dist-lib/lib/action-dispatch.d.ts +2 -1
  110. package/dist-lib/lib/actions.d.ts +30 -42
  111. package/dist-lib/lib/anchor.d.ts +3 -4
  112. package/dist-lib/lib/decimal-text.d.ts +1 -0
  113. package/dist-lib/lib/document-templates.d.ts +1 -2
  114. package/dist-lib/lib/download.d.ts +2 -1
  115. package/dist-lib/lib/evidence-verdict.d.ts +2 -1
  116. package/dist-lib/lib/failure.d.ts +2 -0
  117. package/dist-lib/lib/field-classification.d.ts +3 -3
  118. package/dist-lib/lib/filters.d.ts +18 -2
  119. package/dist-lib/lib/format-count.d.ts +8 -7
  120. package/dist-lib/lib/language.d.ts +19 -0
  121. package/dist-lib/lib/mass-edit.d.ts +2 -1
  122. package/dist-lib/lib/realtime-query-keys.d.ts +1 -1
  123. package/dist-lib/lib/realtime-reconcile.d.ts +3 -4
  124. package/dist-lib/lib/screen-back.d.ts +4 -6
  125. package/dist-lib/lib/sort.d.ts +9 -9
  126. package/dist-lib/lib/timestamp.d.ts +5 -7
  127. package/dist-lib/lib/ui-actions.d.ts +2 -1
  128. package/dist-lib/peekDraftStore-D-cTbiIr.js +199 -0
  129. package/dist-lib/registry-Cb3W-czW.js +1950 -0
  130. package/dist-lib/safe-url-oSJw5pzO.js +34 -0
  131. package/dist-lib/stores/icon-registry.d.ts +2 -2
  132. package/dist-lib/stores/list-layout.d.ts +3 -4
  133. package/dist-lib/stores/realtime.d.ts +1 -1
  134. package/dist-lib/stores/tabs.d.ts +3 -2
  135. package/dist-lib/testing.d.ts +6 -0
  136. package/dist-lib/testing.js +98 -76
  137. package/dist-lib/types/api.d.ts +7 -8
  138. package/dist-lib/types/fieldType.d.ts +1 -1
  139. package/dist-lib/types/files.d.ts +4 -4
  140. package/dist-lib/types/schema.d.ts +44 -50
  141. package/dist-lib/useAgentConversation-D97IqE-J.js +623 -0
  142. package/dist-lib/{useCurrentScreen-CzwzQpoW.js → useCurrentScreen-BL5NZFCw.js} +2777 -3768
  143. package/dist-lib/useListQuery-BG1GyKtJ.js +103 -0
  144. package/dist-lib/useProperties-4Lg3odrt.js +83 -0
  145. package/dist-lib/{useTabSearchMirror-C39U85cg.js → useTabSearchMirror-ZVLlINBX.js} +49 -51
  146. package/dist-lib/useText-BFDCTUSo.js +952 -0
  147. package/dist-lib/{value-Bo8C8WMU.js → value-By1-WJ8J.js} +74 -76
  148. package/dist-lib/vite/fingerprint-plugin.d.ts +2 -3
  149. package/package.json +13 -12
  150. package/dist-lib/Grid-DWgUPuZ3.js +0 -404
  151. package/dist-lib/MarkdownRenderer-CcSFc2N3.js +0 -85
  152. package/dist-lib/RecordIdBadge-CGxPR-8q.js +0 -24
  153. package/dist-lib/SmartDetailPage.impl-lskCd-WG.js +0 -1846
  154. package/dist-lib/SmartListPage.impl-CrGbdzyK.js +0 -2854
  155. package/dist-lib/SortHeaderMenu-SYSAaqQJ.js +0 -106
  156. package/dist-lib/action-dispatch-CR4ajBtT.js +0 -1985
  157. package/dist-lib/cardProjection-CW5RIMko.js +0 -699
  158. package/dist-lib/components/pages/home/HomeStub.d.ts +0 -6
  159. package/dist-lib/components/pages/jobs/Jobs.d.ts +0 -1
  160. package/dist-lib/components/pages/pipeline/Pipeline.d.ts +0 -1
  161. package/dist-lib/format-count-Dobmi-Ji.js +0 -1551
  162. package/dist-lib/hooks/useUserLocale.d.ts +0 -1
  163. package/dist-lib/lib/messages.d.ts +0 -12
  164. package/dist-lib/peekDraftStore-5wQ7lq_V.js +0 -194
  165. package/dist-lib/registry-CjgUaF7C.js +0 -1768
  166. package/dist-lib/useListQuery-D7Hr5WM1.js +0 -96
  167. package/dist-lib/useProperties-CqtCzFCr.js +0 -81
@@ -0,0 +1,289 @@
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
+ style: {
45
+ flexShrink: 0,
46
+ paddingTop: i.isPhone ? 14 : 24,
47
+ paddingBottom: 8,
48
+ ...a
49
+ },
50
+ children: e
51
+ }), /* @__PURE__ */ d("div", {
52
+ ref: n,
53
+ style: {
54
+ flex: 1,
55
+ minHeight: 0,
56
+ overflowY: "auto",
57
+ paddingTop: 4,
58
+ paddingBottom: "calc(24px + var(--safe-area-bottom))",
59
+ ...a,
60
+ display: "flex",
61
+ flexDirection: "column",
62
+ gap: 16,
63
+ minWidth: 0,
64
+ WebkitOverflowScrolling: "touch"
65
+ },
66
+ children: t
67
+ })]
68
+ });
69
+ }
70
+ //#endregion
71
+ //#region src/components/chrome/RecordHeader.tsx
72
+ var _ = 180, v = 160;
73
+ 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 }) {
74
+ let C = a();
75
+ return /* @__PURE__ */ f("div", {
76
+ style: {
77
+ display: "flex",
78
+ alignItems: "flex-start",
79
+ gap: 10,
80
+ flexWrap: "wrap",
81
+ minWidth: 0
82
+ },
83
+ children: [
84
+ S && g && /* @__PURE__ */ d("div", {
85
+ style: {
86
+ paddingTop: 4,
87
+ flexShrink: 0
88
+ },
89
+ children: /* @__PURE__ */ d(n, {
90
+ size: 26,
91
+ icon: /* @__PURE__ */ d(e.back, { size: 14 }),
92
+ title: C("shell.back", "Back"),
93
+ onClick: y
94
+ })
95
+ }),
96
+ S && r && /* @__PURE__ */ d("div", {
97
+ style: {
98
+ flexShrink: 0,
99
+ paddingTop: 2
100
+ },
101
+ children: /* @__PURE__ */ d("span", {
102
+ style: {
103
+ width: 32,
104
+ height: 32,
105
+ borderRadius: 8,
106
+ background: "var(--accent-soft)",
107
+ color: "var(--accent)",
108
+ display: "flex",
109
+ alignItems: "center",
110
+ justifyContent: "center"
111
+ },
112
+ children: r
113
+ })
114
+ }),
115
+ S && /* @__PURE__ */ f(u, { children: [
116
+ /* @__PURE__ */ d("h1", {
117
+ style: {
118
+ margin: 0,
119
+ fontSize: "var(--page-title-size, var(--page-title-size-detail))",
120
+ fontWeight: 600,
121
+ letterSpacing: 0,
122
+ lineHeight: "var(--page-title-line-height, var(--page-title-line-height-detail))",
123
+ color: "var(--text)",
124
+ minWidth: v,
125
+ overflow: "hidden",
126
+ textOverflow: "ellipsis",
127
+ whiteSpace: "nowrap",
128
+ overflowWrap: "anywhere",
129
+ maxWidth: "100%",
130
+ flexGrow: 0,
131
+ flexShrink: 1,
132
+ flexBasis: "auto"
133
+ },
134
+ children: o
135
+ }),
136
+ s && /* @__PURE__ */ d(h, { value: s }),
137
+ c && /* @__PURE__ */ d(i, {
138
+ label: c,
139
+ "data-testid": "detail-description-info"
140
+ }),
141
+ x,
142
+ p === "edit" && m && /* @__PURE__ */ f("span", {
143
+ style: {
144
+ display: "inline-flex",
145
+ alignItems: "center",
146
+ gap: 5,
147
+ fontSize: 11,
148
+ color: "var(--warn)"
149
+ },
150
+ children: [/* @__PURE__ */ d("span", { style: {
151
+ width: 6,
152
+ height: 6,
153
+ borderRadius: 999,
154
+ background: "var(--warn)"
155
+ } }), C("shell.record.unsaved", "Unsaved")]
156
+ }),
157
+ p === "create" && /* @__PURE__ */ d(t, {
158
+ tone: "violet",
159
+ size: "xs",
160
+ dot: !0,
161
+ children: C("shell.record.new", "New record")
162
+ })
163
+ ] }),
164
+ b && /* @__PURE__ */ d("div", {
165
+ role: "toolbar",
166
+ "aria-label": C("shell.record.page_actions", "Page actions"),
167
+ style: {
168
+ display: "flex",
169
+ alignItems: "center",
170
+ gap: 6,
171
+ flexGrow: 1,
172
+ flexShrink: 1,
173
+ flexBasis: "auto",
174
+ marginLeft: "auto",
175
+ minWidth: _,
176
+ flexWrap: "wrap",
177
+ justifyContent: "flex-end"
178
+ },
179
+ children: b
180
+ }),
181
+ l && p === "display" && /* @__PURE__ */ d("div", {
182
+ style: {
183
+ flexBasis: "100%",
184
+ minWidth: 0
185
+ },
186
+ children: l
187
+ })
188
+ ]
189
+ });
190
+ }
191
+ //#endregion
192
+ //#region src/components/chrome/AuditMetaStrip.tsx
193
+ function b(e) {
194
+ return e.by != null || e.at != null;
195
+ }
196
+ function x({ lines: e }) {
197
+ let t = e.filter(b);
198
+ return t.length === 0 ? null : /* @__PURE__ */ d("div", {
199
+ style: {
200
+ display: "flex",
201
+ flexWrap: "wrap",
202
+ gap: "8px 24px",
203
+ padding: "10px 14px",
204
+ background: "var(--surface-2)",
205
+ border: "1px solid var(--border)",
206
+ borderRadius: 8,
207
+ fontSize: 11.5,
208
+ color: "var(--text-3)"
209
+ },
210
+ children: t.map((e, t) => /* @__PURE__ */ d(S, { line: e }, t))
211
+ });
212
+ }
213
+ function S({ line: e }) {
214
+ return /* @__PURE__ */ f("div", {
215
+ style: {
216
+ display: "flex",
217
+ alignItems: "center",
218
+ gap: 8,
219
+ minWidth: 0
220
+ },
221
+ children: [/* @__PURE__ */ d("span", {
222
+ style: {
223
+ fontSize: 11,
224
+ fontWeight: 600,
225
+ color: "var(--text-4)",
226
+ flexShrink: 0
227
+ },
228
+ children: e.label
229
+ }), /* @__PURE__ */ f("span", {
230
+ style: {
231
+ display: "inline-flex",
232
+ alignItems: "center",
233
+ gap: 6,
234
+ minWidth: 0
235
+ },
236
+ children: [
237
+ e.by != null && /* @__PURE__ */ d("span", {
238
+ style: { color: "var(--text-2)" },
239
+ children: e.by
240
+ }),
241
+ e.by != null && e.at != null && /* @__PURE__ */ d("span", {
242
+ style: { color: "var(--text-4)" },
243
+ children: "·"
244
+ }),
245
+ e.at != null && /* @__PURE__ */ d("span", {
246
+ className: "num",
247
+ children: e.at
248
+ })
249
+ ]
250
+ })]
251
+ });
252
+ }
253
+ //#endregion
254
+ //#region src/components/detail-layout/DetailAuditStrip.tsx
255
+ function C({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: o }) {
256
+ let c = a(), l = e.audit;
257
+ if (l?.enabled === !1) return null;
258
+ let u = (e) => {
259
+ if (!e || !t.fields.get(e)) return;
260
+ let a = r[e];
261
+ if (a != null && a !== "") return s({
262
+ entity: t,
263
+ entityCode: n,
264
+ fieldName: e,
265
+ record: r,
266
+ mode: "display",
267
+ refs: i,
268
+ entities: o.entities,
269
+ screens: o.screens,
270
+ surface: "list",
271
+ t: c
272
+ });
273
+ }, f = l?.lines && l.lines.length > 0 ? l.lines.map((e) => ({
274
+ label: c(e.label),
275
+ at: u(e.at),
276
+ by: u(e.by)
277
+ })) : [{
278
+ label: c("record.audit.created", "Created"),
279
+ at: u("created_at"),
280
+ by: u("created_by")
281
+ }, {
282
+ label: c("record.audit.updated", "Updated"),
283
+ at: u("updated_at"),
284
+ by: u("updated_by")
285
+ }];
286
+ return /* @__PURE__ */ d(x, { lines: f });
287
+ }
288
+ //#endregion
289
+ export { h as i, y as n, g 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
  ]