@declarion/react 0.87.0 → 0.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/app.js +28 -28
- package/dist-lib/components/actions/ActionButton.js +86 -85
- package/dist-lib/components/actions/ActionResultDialog.impl.js +47 -47
- package/dist-lib/components/actions/ActionRunner.js +47 -47
- package/dist-lib/components/actions/ObjectActionBar.js +9 -9
- package/dist-lib/components/actions/RowActionsKebab.js +19 -19
- package/dist-lib/components/agents/AgentChatPanel.impl.js +53 -53
- package/dist-lib/components/chrome/AssociationTabs.js +21 -21
- package/dist-lib/components/chrome/RecordHeader.js +33 -40
- package/dist-lib/components/detail-layout/AssociatedBlock.js +387 -381
- package/dist-lib/components/detail-layout/ChildrenBlock.js +12 -13
- package/dist-lib/components/detail-layout/ChildrenTimeline.js +198 -198
- package/dist-lib/components/detail-layout/DraggableChildrenTable.js +114 -114
- package/dist-lib/components/detail-layout/EditableChildrenTable.js +160 -160
- package/dist-lib/components/detail-layout/EvidenceBlock.js +20 -21
- package/dist-lib/components/detail-layout/PropertiesBlock.js +45 -39
- package/dist-lib/components/detail-layout/QuickAddForm.js +9 -9
- package/dist-lib/components/detail-layout/TimelineComposer.js +87 -89
- package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +100 -99
- package/dist-lib/components/fields/FileReferenceField.js +9 -9
- package/dist-lib/components/fields/StructureField.js +57 -47
- package/dist-lib/components/fields/TimestampField.js +59 -54
- package/dist-lib/components/fields/cells/factories/money.js +14 -23
- package/dist-lib/components/fields/cells/factories/nextRun.js +1 -1
- package/dist-lib/components/fields/cells/factories/text.js +18 -3
- package/dist-lib/components/fields/cells/factories/timestamp.js +24 -12
- package/dist-lib/components/file-widgets/DocumentCard.js +108 -106
- package/dist-lib/components/layout/Layout.js +306 -361
- package/dist-lib/components/layout/Rail.js +42 -41
- package/dist-lib/components/layout/Sidebar.js +132 -117
- package/dist-lib/components/layout/TabStrip.js +116 -115
- package/dist-lib/components/layout/TenantChip.js +47 -54
- package/dist-lib/components/layout/TopBar.js +108 -105
- package/dist-lib/components/list/InlineEditCell.js +23 -23
- package/dist-lib/components/list/QuickPeek.js +65 -66
- package/dist-lib/components/pages/DocumentsMenu.js +42 -42
- package/dist-lib/components/pages/ExportMenu.js +25 -25
- package/dist-lib/components/pages/RecordDocumentsPanel.js +35 -35
- package/dist-lib/components/pages/RecordNotesPanel.js +94 -93
- package/dist-lib/components/pages/SmartDetailPage.impl.js +421 -417
- package/dist-lib/components/pages/SmartListPage.impl.js +293 -295
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +310 -310
- package/dist-lib/components/pages/auth/AuthShell.js +73 -73
- package/dist-lib/components/pages/auth/SignIn.js +32 -32
- package/dist-lib/components/pages/auth/SignUp.impl.js +3 -3
- package/dist-lib/components/pages/auth/SignUpCode.js +9 -9
- package/dist-lib/components/pages/list/ListFloatbar.js +12 -12
- package/dist-lib/components/pages/list/ListHeader.js +19 -19
- package/dist-lib/components/pages/list/ListNoRows.js +15 -15
- package/dist-lib/components/pages/list/ListToolbar.js +145 -145
- package/dist-lib/components/pages/list/useActiveView.js +14 -5
- package/dist-lib/components/pages/list/useListQuery.js +121 -81
- package/dist-lib/components/pages/list/useListRowInteraction.js +70 -70
- package/dist-lib/components/pages/list/useRowMenu.js +7 -7
- package/dist-lib/components/pages/profile/Preferences.impl.js +81 -78
- package/dist-lib/components/pages/profile/Profile.impl.js +191 -189
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +166 -158
- package/dist-lib/components/shared/ChangePasswordDialog.impl.js +23 -23
- package/dist-lib/components/shared/MarkdownRenderer.js +9 -9
- package/dist-lib/hooks/useAuth.js +11 -11
- package/dist-lib/hooks/useBranding.js +4 -4
- package/dist-lib/hooks/useDisplayTimeZone.js +8 -0
- package/dist-lib/hooks/useFollowAgentOpen.js +24 -24
- package/dist-lib/hooks/useImpersonation.js +6 -6
- package/dist-lib/hooks/useMutations.js +23 -23
- package/dist-lib/hooks/useObjectStatus.js +5 -5
- package/dist-lib/hooks/useParams.js +59 -51
- package/dist-lib/hooks/useProperties.js +8 -8
- package/dist-lib/hooks/useRowTenant.js +18 -6
- package/dist-lib/hooks/useText.js +9 -7
- package/dist-lib/hooks/useUiPreferences.js +71 -0
- package/dist-lib/index.d.ts +22 -6
- package/dist-lib/index.js +127 -126
- package/dist-lib/lib/actions.js +116 -84
- package/dist-lib/lib/child-config.js +10 -1
- package/dist-lib/lib/format-count.js +16 -1
- package/dist-lib/lib/language.js +23 -21
- package/dist-lib/lib/money-text.js +29 -0
- package/dist-lib/lib/profile.js +4 -0
- package/dist-lib/lib/role-label.js +8 -0
- package/dist-lib/lib/schema-routing.js +34 -14
- package/dist-lib/lib/shortcut.js +10 -0
- package/dist-lib/lib/timestamp.js +93 -31
- package/dist-lib/stores/auth.js +9 -8
- package/dist-lib/stores/preferences.js +56 -17
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/testing.js +25 -28
- package/dist-lib/types/schema.js +33 -27
- package/dist-lib/{useResponsiveMode-D3SKz5z4.d.ts → useResponsiveMode-9_eJT18k.d.ts} +5 -5
- package/package.json +1 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { OrderedMap as e } from "../../types/ordmap.js";
|
|
2
2
|
import { coerceDisplayString as t } from "../../lib/display-value.js";
|
|
3
|
-
import { entityAllowsMutation as n, extractPkValues as r, fieldDisplayName as i, getPrimaryKeyFields as a,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { useTabNavigate as
|
|
15
|
-
import { applyRowState as
|
|
16
|
-
import { ENTITY_CHILDREN_KEY as
|
|
17
|
-
import { useActionRunner as
|
|
18
|
-
import { renderField as
|
|
19
|
-
import { dispatchAction as
|
|
20
|
-
import { ResponsiveActionBar as
|
|
21
|
-
import { useRowTenant as
|
|
22
|
-
import { dataTableCellStyle as N, dataTableHeadCellStyle as
|
|
23
|
-
import { ActionButton as
|
|
3
|
+
import { entityAllowsMutation as n, extractPkValues as r, fieldDisplayName as i, getPrimaryKeyFields as a, isUserEditableField as o, resolveDetailRoute as s, rowSetInTenant as c } from "../../types/schema.js";
|
|
4
|
+
import { buildActionBody as l, createEntity as u, deleteObject as d, encodeObjectId as f, executeAction as p, updateEntity as m } from "../../api/data.js";
|
|
5
|
+
import { failureTitle as h } from "../../lib/failure.js";
|
|
6
|
+
import { Icon as g } from "../primitives/Icons.js";
|
|
7
|
+
import { Btn as _ } from "../primitives/Btn.js";
|
|
8
|
+
import { IconBtn as v } from "../primitives/IconBtn.js";
|
|
9
|
+
import { useText as y } from "../../hooks/useText.js";
|
|
10
|
+
import { SectionCard as b } from "../primitives/SectionCard.js";
|
|
11
|
+
import { useResponsiveMode as x } from "../../hooks/useResponsiveMode.js";
|
|
12
|
+
import { Spinner as S } from "../primitives/Spinner.js";
|
|
13
|
+
import { DynamicIcon as C } from "../shared/DynamicIcon.js";
|
|
14
|
+
import { useTabNavigate as w } from "../../hooks/useTabNavigate.js";
|
|
15
|
+
import { applyRowState as T, defaultFlatForSlot as E } from "../../lib/actions.js";
|
|
16
|
+
import { ENTITY_CHILDREN_KEY as D, useChildrenData as O } from "../../hooks/useChildrenData.js";
|
|
17
|
+
import { useActionRunner as k } from "../actions/ActionRunner.js";
|
|
18
|
+
import { renderField as A } from "../fields/index.js";
|
|
19
|
+
import { dispatchAction as j } from "../../lib/action-dispatch.js";
|
|
20
|
+
import { ResponsiveActionBar as M } from "../actions/ResponsiveActionBar.js";
|
|
21
|
+
import { useRowTenant as ee } from "../../hooks/useRowTenant.js";
|
|
22
|
+
import { dataTableCellStyle as N, dataTableHeadCellStyle as te, dataTableStyle as P } from "../primitives/dataTableStyles.js";
|
|
23
|
+
import { ActionButton as ne } from "../actions/ActionButton.js";
|
|
24
24
|
import { useAssociatedData as F } from "../../hooks/useAssociatedData.js";
|
|
25
25
|
import { RowActionsKebab as I } from "../actions/RowActionsKebab.js";
|
|
26
|
-
import { AssociatedToolbar as
|
|
27
|
-
import { useCallback as
|
|
28
|
-
import { useQueryClient as
|
|
29
|
-
import { Fragment as ie, jsx as
|
|
26
|
+
import { AssociatedToolbar as L } from "./AssociatedToolbar.js";
|
|
27
|
+
import { useCallback as R, useEffect as re, useId as z, useMemo as B, useRef as V, useState as H } from "react";
|
|
28
|
+
import { useQueryClient as U } from "@tanstack/react-query";
|
|
29
|
+
import { Fragment as ie, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
30
30
|
//#region src/components/detail-layout/AssociatedBlock.tsx
|
|
31
31
|
function ae(e) {
|
|
32
32
|
if (!e) return [];
|
|
@@ -37,7 +37,7 @@ function ae(e) {
|
|
|
37
37
|
}));
|
|
38
38
|
return t;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function K(t, n, r) {
|
|
41
41
|
if (!t) return [];
|
|
42
42
|
let i = [];
|
|
43
43
|
for (let [a, o] of Object.entries(t)) {
|
|
@@ -63,7 +63,7 @@ function oe(t, n, r) {
|
|
|
63
63
|
}
|
|
64
64
|
return i;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function oe(e, t, n) {
|
|
67
67
|
let r = e[n];
|
|
68
68
|
if (!r) return null;
|
|
69
69
|
let i = e[t], a = i?.children?.find((e) => e.entity === n);
|
|
@@ -85,12 +85,18 @@ function G(e, t, n) {
|
|
|
85
85
|
}
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
|
+
function q(e, t, n, r, i) {
|
|
89
|
+
let o = e.fields.get(t)?.ref?.field;
|
|
90
|
+
if (!o || a(n).includes(o)) return i;
|
|
91
|
+
let s = r[o];
|
|
92
|
+
return typeof s == "string" || typeof s == "number" ? String(s) : "";
|
|
93
|
+
}
|
|
88
94
|
function se(e, t, n) {
|
|
89
95
|
let r = new Set(a(e));
|
|
90
96
|
return new Set(t.filter((t) => {
|
|
91
97
|
if (t === n || r.has(t)) return !1;
|
|
92
98
|
let i = e.fields.get(t);
|
|
93
|
-
return
|
|
99
|
+
return i ? o(i) : !1;
|
|
94
100
|
}));
|
|
95
101
|
}
|
|
96
102
|
function ce(e, t, n) {
|
|
@@ -110,19 +116,19 @@ function le(e, t, n, r) {
|
|
|
110
116
|
}
|
|
111
117
|
return i;
|
|
112
118
|
}
|
|
113
|
-
function
|
|
114
|
-
let n =
|
|
119
|
+
function J({ node: e, ctx: t }) {
|
|
120
|
+
let n = y("errors"), r = e.associated;
|
|
115
121
|
if (!r || t.isNew) return null;
|
|
116
122
|
let i = t.schema.entities[r];
|
|
117
123
|
if (!i) return null;
|
|
118
|
-
let a = e.foreign_key ??
|
|
119
|
-
return a ? /* @__PURE__ */
|
|
124
|
+
let a = e.foreign_key ?? oe(t.schema.entities, t.entityCode, r);
|
|
125
|
+
return a ? /* @__PURE__ */ W(Y, {
|
|
120
126
|
node: e,
|
|
121
127
|
ctx: t,
|
|
122
128
|
assocCode: r,
|
|
123
129
|
assocEntity: i,
|
|
124
130
|
fkField: a
|
|
125
|
-
}) : /* @__PURE__ */
|
|
131
|
+
}) : /* @__PURE__ */ G("div", {
|
|
126
132
|
style: {
|
|
127
133
|
fontSize: 12.5,
|
|
128
134
|
color: "var(--text-3)",
|
|
@@ -137,28 +143,28 @@ function ue({ node: e, ctx: t }) {
|
|
|
137
143
|
]
|
|
138
144
|
});
|
|
139
145
|
}
|
|
140
|
-
function
|
|
141
|
-
let o =
|
|
146
|
+
function Y({ node: e, ctx: t, assocCode: r, assocEntity: i, fkField: a }) {
|
|
147
|
+
let o = y(), s = y("errors"), c = e.columns && e.columns.length > 0 ? e.columns.filter((e) => e !== a && !!i.fields.get(e)) : i.fields.names().filter((e) => {
|
|
142
148
|
if (e === a) return !1;
|
|
143
149
|
let t = i.fields.get(e);
|
|
144
150
|
return !(!t || t.primary || t.display?.is_listable === !1);
|
|
145
|
-
}),
|
|
151
|
+
}), u = n(i, "update"), d = ee(i), f = e.interaction ?? "navigate", m = (f === "inline_edit" || f === "row_edit") && u && e.editable !== !1, h = o(i.display?.name_plural) || o(i.display?.name) || r, v = e.searchable === !0 || e.filters && e.filters.length > 0, x = q(i, a, t.entity, t.record, t.recordId), S = B(() => K(i.actions, a, x), [
|
|
146
152
|
i.actions,
|
|
147
153
|
a,
|
|
148
|
-
|
|
149
|
-
]),
|
|
154
|
+
x
|
|
155
|
+
]), D = B(() => {
|
|
150
156
|
let e = {};
|
|
151
157
|
for (let { code: t, action: n } of S) e[t] = n;
|
|
152
158
|
return e;
|
|
153
|
-
}, [S]),
|
|
159
|
+
}, [S]), O = B(() => {
|
|
154
160
|
let e = i.action_layout ?? null;
|
|
155
|
-
return
|
|
161
|
+
return T(o, e ?? E(D, "list_toolbar"), D, void 0, {}, [], d);
|
|
156
162
|
}, [
|
|
157
163
|
o,
|
|
158
164
|
i.action_layout,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
]), { run:
|
|
165
|
+
D,
|
|
166
|
+
d
|
|
167
|
+
]), { run: A } = k(), N = w(), te = B(() => ({
|
|
162
168
|
entity: i,
|
|
163
169
|
entityCode: r,
|
|
164
170
|
screenRoute: typeof window < "u" ? window.location.pathname : "",
|
|
@@ -170,34 +176,34 @@ function K({ node: e, ctx: t, assocCode: r, assocEntity: i, fkField: a }) {
|
|
|
170
176
|
icon: t?.icon,
|
|
171
177
|
search: t?.search
|
|
172
178
|
}),
|
|
173
|
-
runActionApi: (e, t) =>
|
|
179
|
+
runActionApi: (e, t) => p(e, t)
|
|
174
180
|
}), [
|
|
175
181
|
i,
|
|
176
182
|
r,
|
|
177
183
|
o,
|
|
178
184
|
N
|
|
179
|
-
]),
|
|
180
|
-
|
|
185
|
+
]), P = U(), F = R(() => {
|
|
186
|
+
P.invalidateQueries({ predicate: (e) => {
|
|
181
187
|
let t = e.queryKey;
|
|
182
188
|
return t[0] === "entity-children" && t[3] === r;
|
|
183
189
|
} });
|
|
184
|
-
}, [
|
|
185
|
-
let n =
|
|
186
|
-
if (n !== null) return
|
|
190
|
+
}, [P, r]), I = R((e, t) => {
|
|
191
|
+
let n = j(s, e, t, {}, r);
|
|
192
|
+
if (n !== null) return A({
|
|
187
193
|
action: t,
|
|
188
194
|
title: o(t.display?.name) || e,
|
|
189
195
|
execute: async (e) => {
|
|
190
|
-
let t = await
|
|
196
|
+
let t = await p(n, l(e, void 0));
|
|
191
197
|
return F(), t;
|
|
192
198
|
}
|
|
193
199
|
});
|
|
194
200
|
}, [
|
|
195
201
|
o,
|
|
196
202
|
s,
|
|
197
|
-
|
|
203
|
+
A,
|
|
198
204
|
r,
|
|
199
205
|
F
|
|
200
|
-
]), [
|
|
206
|
+
]), [L, re] = H(0), z = /* @__PURE__ */ G("div", {
|
|
201
207
|
style: {
|
|
202
208
|
display: "flex",
|
|
203
209
|
alignItems: "center",
|
|
@@ -206,75 +212,75 @@ function K({ node: e, ctx: t, assocCode: r, assocEntity: i, fkField: a }) {
|
|
|
206
212
|
minWidth: 0,
|
|
207
213
|
justifyContent: "flex-end"
|
|
208
214
|
},
|
|
209
|
-
children: [i.action_layout ?
|
|
215
|
+
children: [i.action_layout ? O.length > 0 && /* @__PURE__ */ W(M, {
|
|
210
216
|
kind: "toolbar",
|
|
211
|
-
layout:
|
|
212
|
-
entityActions:
|
|
217
|
+
layout: O,
|
|
218
|
+
entityActions: D,
|
|
213
219
|
onRun: I,
|
|
214
|
-
widgetContext:
|
|
215
|
-
ariaLabel: o("record.associated.toolbar_actions", "{name} toolbar actions", { name:
|
|
216
|
-
}) : S.map(({ code: e, action: t }) => /* @__PURE__ */
|
|
220
|
+
widgetContext: te,
|
|
221
|
+
ariaLabel: o("record.associated.toolbar_actions", "{name} toolbar actions", { name: h })
|
|
222
|
+
}) : S.map(({ code: e, action: t }) => /* @__PURE__ */ W(ne, {
|
|
217
223
|
actionCode: e,
|
|
218
224
|
action: t,
|
|
219
225
|
entityCode: r,
|
|
220
226
|
variant: "ghost",
|
|
221
227
|
size: "sm",
|
|
222
228
|
onSuccess: F
|
|
223
|
-
}, e)),
|
|
229
|
+
}, e)), m && /* @__PURE__ */ W(_, {
|
|
224
230
|
kind: "ghost",
|
|
225
231
|
size: "xs",
|
|
226
|
-
icon: /* @__PURE__ */
|
|
232
|
+
icon: /* @__PURE__ */ W(g.plus, { size: 12 }),
|
|
227
233
|
onClick: () => re((e) => e + 1),
|
|
228
234
|
children: o("record.row.add", "Add row")
|
|
229
235
|
})]
|
|
230
|
-
}),
|
|
236
|
+
}), V = v ? /* @__PURE__ */ W(X, {
|
|
231
237
|
entityCode: r,
|
|
232
238
|
entity: i,
|
|
233
239
|
parentEntity: t.entityCode,
|
|
234
|
-
parentId:
|
|
240
|
+
parentId: x,
|
|
235
241
|
foreignKey: a,
|
|
236
|
-
columns:
|
|
237
|
-
editable:
|
|
238
|
-
interaction:
|
|
242
|
+
columns: c,
|
|
243
|
+
editable: m,
|
|
244
|
+
interaction: f,
|
|
239
245
|
ctx: t,
|
|
240
246
|
searchable: e.searchable,
|
|
241
247
|
filterFields: e.filters,
|
|
242
248
|
sort: e.sort,
|
|
243
|
-
startDraftSignal:
|
|
244
|
-
}) : /* @__PURE__ */
|
|
249
|
+
startDraftSignal: L
|
|
250
|
+
}) : /* @__PURE__ */ W(ue, {
|
|
245
251
|
entityCode: r,
|
|
246
252
|
entity: i,
|
|
247
253
|
parentEntity: t.entityCode,
|
|
248
|
-
parentId:
|
|
254
|
+
parentId: x,
|
|
249
255
|
foreignKey: a,
|
|
250
|
-
columns:
|
|
251
|
-
editable:
|
|
252
|
-
interaction:
|
|
256
|
+
columns: c,
|
|
257
|
+
editable: m,
|
|
258
|
+
interaction: f,
|
|
253
259
|
ctx: t,
|
|
254
260
|
sort: e.sort,
|
|
255
|
-
startDraftSignal:
|
|
261
|
+
startDraftSignal: L
|
|
256
262
|
});
|
|
257
|
-
return t.withinCard ? /* @__PURE__ */
|
|
263
|
+
return t.withinCard ? /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("div", {
|
|
258
264
|
style: {
|
|
259
265
|
display: "flex",
|
|
260
266
|
justifyContent: "flex-end",
|
|
261
267
|
marginBottom: 8
|
|
262
268
|
},
|
|
263
|
-
children:
|
|
264
|
-
}),
|
|
265
|
-
title:
|
|
266
|
-
icon: i.display?.icon ? /* @__PURE__ */
|
|
269
|
+
children: z
|
|
270
|
+
}), V] }) : /* @__PURE__ */ W(b, {
|
|
271
|
+
title: h,
|
|
272
|
+
icon: i.display?.icon ? /* @__PURE__ */ W(C, {
|
|
267
273
|
name: i.display.icon,
|
|
268
274
|
size: 14
|
|
269
275
|
}) : void 0,
|
|
270
|
-
right:
|
|
271
|
-
children:
|
|
276
|
+
right: z,
|
|
277
|
+
children: V
|
|
272
278
|
});
|
|
273
279
|
}
|
|
274
|
-
function
|
|
275
|
-
let d =
|
|
280
|
+
function ue({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
|
|
281
|
+
let d = U(), { data: f, isLoading: p, isError: m } = O(n, r, e, i, l), h = f?.data ?? [], g = f?.$refs, _ = R(() => {
|
|
276
282
|
d.invalidateQueries({ queryKey: [
|
|
277
|
-
|
|
283
|
+
D,
|
|
278
284
|
n,
|
|
279
285
|
r,
|
|
280
286
|
e
|
|
@@ -285,7 +291,7 @@ function q({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey:
|
|
|
285
291
|
r,
|
|
286
292
|
e
|
|
287
293
|
]);
|
|
288
|
-
return /* @__PURE__ */
|
|
294
|
+
return /* @__PURE__ */ W(Z, {
|
|
289
295
|
entityCode: e,
|
|
290
296
|
entity: t,
|
|
291
297
|
parentId: r,
|
|
@@ -302,14 +308,14 @@ function q({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey:
|
|
|
302
308
|
startDraftSignal: u
|
|
303
309
|
});
|
|
304
310
|
}
|
|
305
|
-
function
|
|
306
|
-
let
|
|
311
|
+
function X({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, searchable: l, filterFields: u, sort: d, startDraftSignal: f }) {
|
|
312
|
+
let p = y(), m = U(), [h, g] = H(""), [v, b] = H(""), [x, C] = H({}), w = V(void 0);
|
|
307
313
|
re(() => (w.current && clearTimeout(w.current), w.current = setTimeout(() => {
|
|
308
|
-
|
|
314
|
+
b(h);
|
|
309
315
|
}, 300), () => {
|
|
310
316
|
w.current && clearTimeout(w.current);
|
|
311
|
-
}), [
|
|
312
|
-
let T =
|
|
317
|
+
}), [h]);
|
|
318
|
+
let T = R((e, t) => {
|
|
313
319
|
C((n) => {
|
|
314
320
|
if (t === "__all__") {
|
|
315
321
|
let { [e]: t, ...r } = n;
|
|
@@ -320,7 +326,7 @@ function J({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey:
|
|
|
320
326
|
[e]: t
|
|
321
327
|
};
|
|
322
328
|
});
|
|
323
|
-
}, []), E =
|
|
329
|
+
}, []), E = B(() => Object.keys(x).length > 0 ? x : void 0, [x]), { data: D, isLoading: O, isError: k, hasNextPage: A, fetchNextPage: j, isFetchingNextPage: M } = F(n, r, e, i, d, void 0, v || void 0, E), { rows: ee, refs: N } = B(() => {
|
|
324
330
|
if (!D?.pages) return {
|
|
325
331
|
rows: [],
|
|
326
332
|
refs: void 0
|
|
@@ -337,24 +343,24 @@ function J({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey:
|
|
|
337
343
|
rows: e,
|
|
338
344
|
refs: t
|
|
339
345
|
};
|
|
340
|
-
}, [D]), te =
|
|
341
|
-
|
|
346
|
+
}, [D]), te = R(() => {
|
|
347
|
+
m.invalidateQueries({ predicate: (t) => {
|
|
342
348
|
let n = t.queryKey;
|
|
343
349
|
return n[0] === "entity-children" && n[3] === e;
|
|
344
350
|
} });
|
|
345
|
-
}, [
|
|
346
|
-
return /* @__PURE__ */
|
|
347
|
-
/* @__PURE__ */
|
|
351
|
+
}, [m, e]);
|
|
352
|
+
return /* @__PURE__ */ G("div", { children: [
|
|
353
|
+
/* @__PURE__ */ W(L, {
|
|
348
354
|
entity: t,
|
|
349
|
-
searchable:
|
|
350
|
-
filterFields:
|
|
351
|
-
searchValue:
|
|
352
|
-
onSearchChange:
|
|
353
|
-
filters:
|
|
355
|
+
searchable: l,
|
|
356
|
+
filterFields: u,
|
|
357
|
+
searchValue: h,
|
|
358
|
+
onSearchChange: g,
|
|
359
|
+
filters: x,
|
|
354
360
|
onFilterChange: T,
|
|
355
361
|
allEntities: c.schema.entities
|
|
356
362
|
}),
|
|
357
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ W(Z, {
|
|
358
364
|
entityCode: e,
|
|
359
365
|
entity: t,
|
|
360
366
|
parentId: r,
|
|
@@ -363,65 +369,65 @@ function J({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey:
|
|
|
363
369
|
editable: o,
|
|
364
370
|
interaction: s,
|
|
365
371
|
ctx: c,
|
|
366
|
-
rows:
|
|
367
|
-
refs:
|
|
372
|
+
rows: ee,
|
|
373
|
+
refs: N,
|
|
368
374
|
isLoading: O,
|
|
369
375
|
isError: k,
|
|
370
376
|
invalidateQuery: te,
|
|
371
|
-
startDraftSignal:
|
|
377
|
+
startDraftSignal: f
|
|
372
378
|
}),
|
|
373
|
-
A && /* @__PURE__ */
|
|
379
|
+
A && /* @__PURE__ */ W("div", {
|
|
374
380
|
style: { marginTop: 4 },
|
|
375
|
-
children: /* @__PURE__ */
|
|
381
|
+
children: /* @__PURE__ */ W(_, {
|
|
376
382
|
kind: "ghost",
|
|
377
383
|
size: "xs",
|
|
378
|
-
icon: M ? /* @__PURE__ */
|
|
384
|
+
icon: M ? /* @__PURE__ */ W(S, { size: 12 }) : void 0,
|
|
379
385
|
onClick: () => j(),
|
|
380
386
|
disabled: M,
|
|
381
|
-
children:
|
|
387
|
+
children: p("record.associated.load_more", "Load more")
|
|
382
388
|
})
|
|
383
389
|
})
|
|
384
390
|
] });
|
|
385
391
|
}
|
|
386
|
-
function
|
|
387
|
-
let T =
|
|
388
|
-
|
|
392
|
+
function Z({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: o, editable: l, interaction: p, ctx: g, rows: _, refs: v, isLoading: b, isError: S, invalidateQuery: C, startDraftSignal: w }) {
|
|
393
|
+
let T = y(), E = y("errors"), D = x(), O = ee(t), A = D.isPhone && g.relatedRecordsPresentation === "table", j = o.find((e) => e !== a), M = B(() => p === "navigate" ? s(void 0, t, g.schema.screens) : null, [
|
|
394
|
+
p,
|
|
389
395
|
t,
|
|
390
|
-
|
|
391
|
-
]),
|
|
392
|
-
|
|
396
|
+
g.schema.screens
|
|
397
|
+
]), N = B(() => l ? se(t, o, a) : /* @__PURE__ */ new Set(), [
|
|
398
|
+
o,
|
|
393
399
|
a,
|
|
394
400
|
t,
|
|
395
401
|
l
|
|
396
|
-
]),
|
|
397
|
-
|
|
402
|
+
]), ne = B(() => ce(t, o, a), [
|
|
403
|
+
o,
|
|
398
404
|
a,
|
|
399
405
|
t
|
|
400
|
-
]),
|
|
406
|
+
]), F = B(() => {
|
|
401
407
|
let e = /* @__PURE__ */ new Map();
|
|
402
|
-
for (let n of
|
|
408
|
+
for (let n of _) {
|
|
403
409
|
let i = r(t, n);
|
|
404
|
-
e.set(
|
|
410
|
+
e.set(f(i), i);
|
|
405
411
|
}
|
|
406
412
|
return e;
|
|
407
|
-
}, [
|
|
413
|
+
}, [_, t]), I = B(() => {
|
|
408
414
|
let e = /* @__PURE__ */ new Map();
|
|
409
|
-
for (let n of
|
|
415
|
+
for (let n of _) {
|
|
410
416
|
let i = n.$row_version;
|
|
411
|
-
typeof i == "string" && i !== "" && e.set(
|
|
417
|
+
typeof i == "string" && i !== "" && e.set(f(r(t, n)), i);
|
|
412
418
|
}
|
|
413
419
|
return e;
|
|
414
|
-
}, [
|
|
415
|
-
|
|
416
|
-
let X =
|
|
420
|
+
}, [_, t]), L = B(() => ae(t.actions), [t.actions]), [z, U] = H(null), [ie, K] = H(null), [oe, q] = H([]), [J, Y] = H({}), ue = V(J);
|
|
421
|
+
ue.current = J;
|
|
422
|
+
let X = V({});
|
|
417
423
|
re(() => {
|
|
418
424
|
let e = X.current;
|
|
419
425
|
return () => {
|
|
420
426
|
for (let t of Object.values(e)) clearTimeout(t);
|
|
421
427
|
};
|
|
422
428
|
}, []);
|
|
423
|
-
let [Z, Q] =
|
|
424
|
-
|
|
429
|
+
let [Z, Q] = H(null), [pe, $] = H([]), [ge, _e] = H(!1), { run: ve } = k(), [ye, be] = H(/* @__PURE__ */ new Set()), xe = R(async (t, n, r) => {
|
|
430
|
+
Y((e) => ({
|
|
425
431
|
...e,
|
|
426
432
|
[t]: {
|
|
427
433
|
...e[t],
|
|
@@ -430,11 +436,11 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
430
436
|
}
|
|
431
437
|
}));
|
|
432
438
|
try {
|
|
433
|
-
let i =
|
|
439
|
+
let i = I.get(t), a = i ? {
|
|
434
440
|
...n,
|
|
435
441
|
$row_version: i
|
|
436
442
|
} : n;
|
|
437
|
-
return await
|
|
443
|
+
return await m(e, F.get(t) ?? t, a), Y((e) => {
|
|
438
444
|
let n = e[t];
|
|
439
445
|
if (!n) return e;
|
|
440
446
|
if (n.ver > r) return {
|
|
@@ -448,8 +454,8 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
448
454
|
return a;
|
|
449
455
|
}), C(), !0;
|
|
450
456
|
} catch (e) {
|
|
451
|
-
let n =
|
|
452
|
-
return
|
|
457
|
+
let n = h(E, e);
|
|
458
|
+
return Y((e) => ({
|
|
453
459
|
...e,
|
|
454
460
|
[t]: {
|
|
455
461
|
...e[t],
|
|
@@ -462,10 +468,10 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
462
468
|
e,
|
|
463
469
|
E,
|
|
464
470
|
C,
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
]), Se =
|
|
468
|
-
|
|
471
|
+
F,
|
|
472
|
+
I
|
|
473
|
+
]), Se = R((e, t, n) => {
|
|
474
|
+
Y((r) => {
|
|
469
475
|
let i = r[e] ?? {
|
|
470
476
|
buffer: {},
|
|
471
477
|
ver: 0,
|
|
@@ -482,14 +488,14 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
482
488
|
ver: a
|
|
483
489
|
}
|
|
484
490
|
};
|
|
485
|
-
}),
|
|
486
|
-
let t =
|
|
491
|
+
}), p === "inline_edit" && (X.current[e] && clearTimeout(X.current[e]), X.current[e] = setTimeout(() => {
|
|
492
|
+
let t = ue.current[e];
|
|
487
493
|
t && Object.keys(t.buffer).length > 0 && xe(e, { ...t.buffer }, t.ver);
|
|
488
494
|
}, 500));
|
|
489
|
-
}, [xe,
|
|
495
|
+
}, [xe, p]), Ce = R(() => {
|
|
490
496
|
let e = {};
|
|
491
497
|
e[a] = n;
|
|
492
|
-
for (let n of
|
|
498
|
+
for (let n of o) {
|
|
493
499
|
let r = t.fields.get(n);
|
|
494
500
|
r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
|
|
495
501
|
}
|
|
@@ -497,9 +503,9 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
497
503
|
}, [
|
|
498
504
|
a,
|
|
499
505
|
n,
|
|
500
|
-
|
|
506
|
+
o,
|
|
501
507
|
t.fields
|
|
502
|
-
]), we =
|
|
508
|
+
]), we = V(w);
|
|
503
509
|
re(() => {
|
|
504
510
|
w !== void 0 && w !== we.current && (we.current = w, !Z && Ce());
|
|
505
511
|
}, [
|
|
@@ -507,16 +513,16 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
507
513
|
Z,
|
|
508
514
|
Ce
|
|
509
515
|
]);
|
|
510
|
-
let Te =
|
|
516
|
+
let Te = R(async () => {
|
|
511
517
|
if (!Z) return;
|
|
512
|
-
let n = le(Z,
|
|
518
|
+
let n = le(Z, o, t, a);
|
|
513
519
|
if (n.length > 0) $(n);
|
|
514
520
|
else {
|
|
515
521
|
_e(!0);
|
|
516
522
|
try {
|
|
517
|
-
await
|
|
523
|
+
await u(e, Z), Q(null), $([]), C();
|
|
518
524
|
} catch (e) {
|
|
519
|
-
let t =
|
|
525
|
+
let t = h(E, e);
|
|
520
526
|
$([`_error:${t}`]);
|
|
521
527
|
} finally {
|
|
522
528
|
_e(!1);
|
|
@@ -524,39 +530,39 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
524
530
|
}
|
|
525
531
|
}, [
|
|
526
532
|
Z,
|
|
527
|
-
|
|
533
|
+
o,
|
|
528
534
|
t,
|
|
529
535
|
a,
|
|
530
536
|
e,
|
|
531
537
|
E,
|
|
532
538
|
C
|
|
533
|
-
]), Ee =
|
|
534
|
-
|
|
535
|
-
}, []), De =
|
|
536
|
-
let n =
|
|
539
|
+
]), Ee = R((e) => {
|
|
540
|
+
Y({}), q([]), K(e);
|
|
541
|
+
}, []), De = R(async (e) => {
|
|
542
|
+
let n = ue.current[e], i = n?.buffer ?? {};
|
|
537
543
|
if (Object.keys(i).length === 0) {
|
|
538
|
-
|
|
544
|
+
K(null), q([]);
|
|
539
545
|
return;
|
|
540
546
|
}
|
|
541
|
-
let
|
|
542
|
-
...
|
|
547
|
+
let s = le({
|
|
548
|
+
..._.find((n) => f(r(t, n)) === e) ?? {},
|
|
543
549
|
...i
|
|
544
|
-
},
|
|
545
|
-
|
|
550
|
+
}, o, t, a);
|
|
551
|
+
s.length > 0 ? q(s) : await xe(e, { ...i }, n?.ver ?? 0) && (K(null), q([]));
|
|
546
552
|
}, [
|
|
547
|
-
|
|
553
|
+
_,
|
|
548
554
|
t,
|
|
549
|
-
|
|
555
|
+
o,
|
|
550
556
|
a,
|
|
551
557
|
xe
|
|
552
|
-
]), Oe =
|
|
553
|
-
|
|
558
|
+
]), Oe = R((e) => {
|
|
559
|
+
Y((t) => {
|
|
554
560
|
if (!t[e]) return t;
|
|
555
561
|
let { [e]: n, ...r } = t;
|
|
556
562
|
return r;
|
|
557
|
-
}),
|
|
558
|
-
}, []), ke =
|
|
559
|
-
let i =
|
|
563
|
+
}), q([]), K(null);
|
|
564
|
+
}, []), ke = R((n, r) => {
|
|
565
|
+
let i = F.get(n) ?? n;
|
|
560
566
|
return ve({
|
|
561
567
|
action: t.actions?.__delete,
|
|
562
568
|
destructive: !0,
|
|
@@ -566,7 +572,7 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
566
572
|
execute: async () => {
|
|
567
573
|
be((e) => new Set(e).add(n));
|
|
568
574
|
try {
|
|
569
|
-
return await
|
|
575
|
+
return await d(e, i);
|
|
570
576
|
} finally {
|
|
571
577
|
be((e) => {
|
|
572
578
|
let t = new Set(e);
|
|
@@ -582,9 +588,9 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
582
588
|
t,
|
|
583
589
|
e,
|
|
584
590
|
C,
|
|
585
|
-
|
|
591
|
+
F
|
|
586
592
|
]);
|
|
587
|
-
if (
|
|
593
|
+
if (S) return /* @__PURE__ */ W("div", {
|
|
588
594
|
style: {
|
|
589
595
|
fontSize: 12.5,
|
|
590
596
|
color: "var(--danger)",
|
|
@@ -592,74 +598,74 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
592
598
|
},
|
|
593
599
|
children: E("record.related_rows_unreadable", "The related records could not be loaded.")
|
|
594
600
|
});
|
|
595
|
-
if (
|
|
601
|
+
if (b) return /* @__PURE__ */ G("div", {
|
|
596
602
|
style: {
|
|
597
603
|
display: "flex",
|
|
598
604
|
flexDirection: "column",
|
|
599
605
|
gap: 8,
|
|
600
606
|
padding: "8px 0"
|
|
601
607
|
},
|
|
602
|
-
children: [/* @__PURE__ */
|
|
608
|
+
children: [/* @__PURE__ */ W("div", { style: {
|
|
603
609
|
height: 32,
|
|
604
610
|
background: "var(--surface-3)",
|
|
605
611
|
borderRadius: "var(--radius-md)"
|
|
606
|
-
} }), /* @__PURE__ */
|
|
612
|
+
} }), /* @__PURE__ */ W("div", { style: {
|
|
607
613
|
height: 32,
|
|
608
614
|
background: "var(--surface-3)",
|
|
609
615
|
borderRadius: "var(--radius-md)"
|
|
610
616
|
} })]
|
|
611
617
|
});
|
|
612
|
-
let Ae =
|
|
613
|
-
return D.isPhone && !A ? /* @__PURE__ */
|
|
618
|
+
let Ae = _.length === 0 && !Z;
|
|
619
|
+
return D.isPhone && !A ? /* @__PURE__ */ G("div", { children: [Ae && /* @__PURE__ */ W("div", {
|
|
614
620
|
style: {
|
|
615
621
|
fontSize: 12.5,
|
|
616
622
|
color: "var(--text-3)",
|
|
617
623
|
padding: "12px 0"
|
|
618
624
|
},
|
|
619
625
|
children: T("record.related.empty", "No records yet.")
|
|
620
|
-
}), !Ae && /* @__PURE__ */
|
|
626
|
+
}), !Ae && /* @__PURE__ */ G("div", {
|
|
621
627
|
style: {
|
|
622
628
|
display: "flex",
|
|
623
629
|
flexDirection: "column",
|
|
624
630
|
gap: 10
|
|
625
631
|
},
|
|
626
|
-
children: [
|
|
627
|
-
let i =
|
|
628
|
-
return /* @__PURE__ */
|
|
632
|
+
children: [_.map((n) => {
|
|
633
|
+
let i = f(r(t, n)), a = ye.has(i), s = J[i], u = M && i ? M.replace(/:\w+/, i) : void 0;
|
|
634
|
+
return /* @__PURE__ */ W(de, {
|
|
629
635
|
rowId: i,
|
|
630
636
|
row: n,
|
|
631
637
|
entity: t,
|
|
632
|
-
entities:
|
|
633
|
-
screens:
|
|
634
|
-
columns:
|
|
635
|
-
editableColumns:
|
|
636
|
-
editable: l &&
|
|
637
|
-
interaction:
|
|
638
|
-
isEditing:
|
|
639
|
-
editErrors:
|
|
638
|
+
entities: g.schema.entities,
|
|
639
|
+
screens: g.schema.screens,
|
|
640
|
+
columns: o,
|
|
641
|
+
editableColumns: N,
|
|
642
|
+
editable: l && c(t, n, O.tenantId),
|
|
643
|
+
interaction: p,
|
|
644
|
+
isEditing: ie === i,
|
|
645
|
+
editErrors: oe,
|
|
640
646
|
isDeleting: a,
|
|
641
|
-
activeCell:
|
|
642
|
-
setActiveCell:
|
|
643
|
-
rowState:
|
|
647
|
+
activeCell: z,
|
|
648
|
+
setActiveCell: U,
|
|
649
|
+
rowState: s,
|
|
644
650
|
onCellChange: Se,
|
|
645
651
|
onDeleteClick: (e) => void ke(e, n),
|
|
646
652
|
onStartEdit: Ee,
|
|
647
653
|
onConfirmEdit: De,
|
|
648
654
|
onCancelEdit: Oe,
|
|
649
|
-
refs:
|
|
655
|
+
refs: v,
|
|
650
656
|
identityCol: j,
|
|
651
|
-
href:
|
|
652
|
-
rowActions:
|
|
657
|
+
href: u,
|
|
658
|
+
rowActions: L,
|
|
653
659
|
entityCode: e,
|
|
654
660
|
onRowActionSuccess: C
|
|
655
661
|
}, i);
|
|
656
|
-
}), Z && /* @__PURE__ */
|
|
662
|
+
}), Z && /* @__PURE__ */ W(he, {
|
|
657
663
|
draftRow: Z,
|
|
658
664
|
entity: t,
|
|
659
|
-
columns:
|
|
660
|
-
editableColumns:
|
|
665
|
+
columns: o,
|
|
666
|
+
editableColumns: ne,
|
|
661
667
|
foreignKey: a,
|
|
662
|
-
draftErrors:
|
|
668
|
+
draftErrors: pe,
|
|
663
669
|
draftSaving: ge,
|
|
664
670
|
onChange: (e, t) => Q((n) => n && {
|
|
665
671
|
...n,
|
|
@@ -669,72 +675,72 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
669
675
|
onCancel: () => {
|
|
670
676
|
Q(null), $([]);
|
|
671
677
|
},
|
|
672
|
-
refs:
|
|
678
|
+
refs: v
|
|
673
679
|
})]
|
|
674
|
-
})] }) : /* @__PURE__ */
|
|
680
|
+
})] }) : /* @__PURE__ */ G("div", { children: [Ae && /* @__PURE__ */ W("div", {
|
|
675
681
|
style: {
|
|
676
682
|
fontSize: 12.5,
|
|
677
683
|
color: "var(--text-3)",
|
|
678
684
|
padding: "12px 0"
|
|
679
685
|
},
|
|
680
686
|
children: T("record.related.empty", "No records yet.")
|
|
681
|
-
}), !Ae && /* @__PURE__ */
|
|
687
|
+
}), !Ae && /* @__PURE__ */ W("div", {
|
|
682
688
|
style: { overflowX: "auto" },
|
|
683
|
-
children: /* @__PURE__ */
|
|
684
|
-
style:
|
|
685
|
-
children: [/* @__PURE__ */
|
|
686
|
-
|
|
689
|
+
children: /* @__PURE__ */ G("table", {
|
|
690
|
+
style: P,
|
|
691
|
+
children: [/* @__PURE__ */ W("thead", { children: /* @__PURE__ */ G("tr", { children: [
|
|
692
|
+
o.map((e) => {
|
|
687
693
|
let n = t.fields.get(e);
|
|
688
|
-
return /* @__PURE__ */
|
|
689
|
-
style:
|
|
690
|
-
children: n ? i(T, n, e,
|
|
694
|
+
return /* @__PURE__ */ W("th", {
|
|
695
|
+
style: te,
|
|
696
|
+
children: n ? i(T, n, e, g.schema.entities) : e
|
|
691
697
|
}, e);
|
|
692
698
|
}),
|
|
693
|
-
l && /* @__PURE__ */
|
|
699
|
+
l && /* @__PURE__ */ W("th", { style: {
|
|
694
700
|
height: 30,
|
|
695
701
|
width: 72
|
|
696
702
|
} }),
|
|
697
|
-
!l &&
|
|
703
|
+
!l && L.length > 0 && /* @__PURE__ */ W("th", { style: {
|
|
698
704
|
height: 30,
|
|
699
705
|
width: 40
|
|
700
706
|
} })
|
|
701
|
-
] }) }), /* @__PURE__ */
|
|
702
|
-
let i =
|
|
703
|
-
return /* @__PURE__ */
|
|
707
|
+
] }) }), /* @__PURE__ */ G("tbody", { children: [_.map((n) => {
|
|
708
|
+
let i = f(r(t, n)), a = ye.has(i), s = J[i], u = M && i ? M.replace(/:\w+/, i) : void 0;
|
|
709
|
+
return /* @__PURE__ */ W(fe, {
|
|
704
710
|
rowId: i,
|
|
705
711
|
row: n,
|
|
706
712
|
entity: t,
|
|
707
|
-
entities:
|
|
708
|
-
screens:
|
|
709
|
-
columns:
|
|
710
|
-
editableColumns:
|
|
711
|
-
editable: l &&
|
|
712
|
-
interaction:
|
|
713
|
-
isEditing:
|
|
714
|
-
editErrors:
|
|
713
|
+
entities: g.schema.entities,
|
|
714
|
+
screens: g.schema.screens,
|
|
715
|
+
columns: o,
|
|
716
|
+
editableColumns: N,
|
|
717
|
+
editable: l && c(t, n, O.tenantId),
|
|
718
|
+
interaction: p,
|
|
719
|
+
isEditing: ie === i,
|
|
720
|
+
editErrors: oe,
|
|
715
721
|
isDeleting: a,
|
|
716
|
-
activeCell:
|
|
717
|
-
setActiveCell:
|
|
718
|
-
rowState:
|
|
722
|
+
activeCell: z,
|
|
723
|
+
setActiveCell: U,
|
|
724
|
+
rowState: s,
|
|
719
725
|
onCellChange: Se,
|
|
720
726
|
onDeleteClick: (e) => void ke(e, n),
|
|
721
727
|
onStartEdit: Ee,
|
|
722
728
|
onConfirmEdit: De,
|
|
723
729
|
onCancelEdit: Oe,
|
|
724
|
-
refs:
|
|
730
|
+
refs: v,
|
|
725
731
|
identityCol: j,
|
|
726
|
-
href:
|
|
727
|
-
rowActions:
|
|
732
|
+
href: u,
|
|
733
|
+
rowActions: L,
|
|
728
734
|
entityCode: e,
|
|
729
735
|
onRowActionSuccess: C
|
|
730
736
|
}, i);
|
|
731
|
-
}), Z && /* @__PURE__ */
|
|
737
|
+
}), Z && /* @__PURE__ */ W(me, {
|
|
732
738
|
draftRow: Z,
|
|
733
739
|
entity: t,
|
|
734
|
-
columns:
|
|
735
|
-
editableColumns:
|
|
740
|
+
columns: o,
|
|
741
|
+
editableColumns: ne,
|
|
736
742
|
foreignKey: a,
|
|
737
|
-
draftErrors:
|
|
743
|
+
draftErrors: pe,
|
|
738
744
|
draftSaving: ge,
|
|
739
745
|
onChange: (e, t) => Q((n) => n && {
|
|
740
746
|
...n,
|
|
@@ -744,40 +750,40 @@ function Y({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: c, e
|
|
|
744
750
|
onCancel: () => {
|
|
745
751
|
Q(null), $([]);
|
|
746
752
|
},
|
|
747
|
-
refs:
|
|
753
|
+
refs: v
|
|
748
754
|
})] })]
|
|
749
755
|
})
|
|
750
756
|
})] });
|
|
751
757
|
}
|
|
752
|
-
function de({ rowId: e, row: n, entity: r, entities: a, screens: o, columns: s, editableColumns:
|
|
753
|
-
let
|
|
758
|
+
function de({ rowId: e, row: n, entity: r, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: p, rowState: m, onCellChange: h, onDeleteClick: _, onStartEdit: b, onConfirmEdit: x, onCancelEdit: C, refs: w, identityCol: T, href: E, rowActions: D, onRowActionSuccess: O }) {
|
|
759
|
+
let k = y(), j = z(), M = B(() => !m || Object.keys(m.buffer).length === 0 ? n : {
|
|
754
760
|
...n,
|
|
755
|
-
...
|
|
756
|
-
}, [n,
|
|
757
|
-
if (
|
|
758
|
-
let t =
|
|
759
|
-
return /* @__PURE__ */
|
|
761
|
+
...m.buffer
|
|
762
|
+
}, [n, m]);
|
|
763
|
+
if (u === "row_edit" && d) {
|
|
764
|
+
let t = m?.error ? [...f, `_error:${m.error}`] : f;
|
|
765
|
+
return /* @__PURE__ */ W(pe, {
|
|
760
766
|
values: M,
|
|
761
767
|
entity: r,
|
|
762
768
|
columns: s,
|
|
763
|
-
editableColumns:
|
|
769
|
+
editableColumns: c,
|
|
764
770
|
errors: t,
|
|
765
|
-
saving:
|
|
766
|
-
onChange: (t, n) =>
|
|
767
|
-
onConfirm: () =>
|
|
771
|
+
saving: m?.saving ?? !1,
|
|
772
|
+
onChange: (t, n) => h(e, t, n),
|
|
773
|
+
onConfirm: () => x(e),
|
|
768
774
|
onCancel: () => C(e),
|
|
769
775
|
refs: w
|
|
770
776
|
});
|
|
771
777
|
}
|
|
772
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ G("div", {
|
|
773
779
|
style: {
|
|
774
780
|
border: "1px solid var(--border)",
|
|
775
781
|
borderRadius: "var(--radius-md)",
|
|
776
782
|
background: "var(--surface)",
|
|
777
|
-
opacity:
|
|
783
|
+
opacity: p ? .58 : 1,
|
|
778
784
|
overflow: "hidden"
|
|
779
785
|
},
|
|
780
|
-
children: [/* @__PURE__ */
|
|
786
|
+
children: [/* @__PURE__ */ W("div", {
|
|
781
787
|
style: {
|
|
782
788
|
padding: 10,
|
|
783
789
|
display: "flex",
|
|
@@ -785,57 +791,57 @@ function de({ rowId: e, row: n, entity: r, entities: a, screens: o, columns: s,
|
|
|
785
791
|
gap: 12
|
|
786
792
|
},
|
|
787
793
|
children: s.map((n) => {
|
|
788
|
-
let s = r.fields.get(n),
|
|
794
|
+
let s = r.fields.get(n), d = l && u === "inline_edit" && c.has(n), f = E && n === T, p = s ? i(k, s, n, a) : n, m = `${j}-${e}-${n}`, g = `${m}-label`, _ = {
|
|
789
795
|
fontSize: 11.5,
|
|
790
796
|
fontWeight: 600,
|
|
791
797
|
color: "var(--text-3)"
|
|
792
|
-
},
|
|
798
|
+
}, v = s ? A({
|
|
793
799
|
field: s,
|
|
794
800
|
fieldName: n,
|
|
795
801
|
value: M[n],
|
|
796
|
-
mode:
|
|
797
|
-
onChange:
|
|
802
|
+
mode: d ? "edit" : "display",
|
|
803
|
+
onChange: d ? (t) => h(e, n, t) : void 0,
|
|
798
804
|
record: M,
|
|
799
805
|
refs: w,
|
|
800
|
-
compact:
|
|
806
|
+
compact: d,
|
|
801
807
|
entity: r,
|
|
802
808
|
entities: a,
|
|
803
|
-
screens:
|
|
809
|
+
screens: f ? void 0 : o,
|
|
804
810
|
fieldId: m,
|
|
805
|
-
labelId:
|
|
806
|
-
t:
|
|
811
|
+
labelId: g,
|
|
812
|
+
t: k
|
|
807
813
|
}) : t(M[n]);
|
|
808
|
-
return /* @__PURE__ */
|
|
814
|
+
return /* @__PURE__ */ G("div", {
|
|
809
815
|
style: {
|
|
810
816
|
display: "flex",
|
|
811
817
|
flexDirection: "column",
|
|
812
818
|
gap: 5,
|
|
813
819
|
minWidth: 0
|
|
814
820
|
},
|
|
815
|
-
children: [
|
|
816
|
-
id:
|
|
821
|
+
children: [d && s ? /* @__PURE__ */ W("label", {
|
|
822
|
+
id: g,
|
|
817
823
|
htmlFor: m,
|
|
818
|
-
style:
|
|
819
|
-
children:
|
|
820
|
-
}) : /* @__PURE__ */
|
|
821
|
-
id:
|
|
822
|
-
style:
|
|
823
|
-
children:
|
|
824
|
-
}), /* @__PURE__ */
|
|
824
|
+
style: _,
|
|
825
|
+
children: p
|
|
826
|
+
}) : /* @__PURE__ */ W("div", {
|
|
827
|
+
id: g,
|
|
828
|
+
style: _,
|
|
829
|
+
children: p
|
|
830
|
+
}), /* @__PURE__ */ W("div", {
|
|
825
831
|
style: { minWidth: 0 },
|
|
826
|
-
children:
|
|
832
|
+
children: f && !d ? /* @__PURE__ */ W("a", {
|
|
827
833
|
href: E,
|
|
828
834
|
style: {
|
|
829
835
|
color: "var(--accent-text)",
|
|
830
836
|
textDecoration: "none",
|
|
831
837
|
fontWeight: 500
|
|
832
838
|
},
|
|
833
|
-
children:
|
|
834
|
-
}) :
|
|
839
|
+
children: v
|
|
840
|
+
}) : v
|
|
835
841
|
})]
|
|
836
842
|
}, n);
|
|
837
843
|
})
|
|
838
|
-
}), (
|
|
844
|
+
}), (l || D && D.length > 0) && /* @__PURE__ */ G("div", {
|
|
839
845
|
style: {
|
|
840
846
|
minHeight: 42,
|
|
841
847
|
padding: "6px 8px",
|
|
@@ -845,29 +851,29 @@ function de({ rowId: e, row: n, entity: r, entities: a, screens: o, columns: s,
|
|
|
845
851
|
justifyContent: "flex-end",
|
|
846
852
|
gap: 6
|
|
847
853
|
},
|
|
848
|
-
children: [
|
|
849
|
-
|
|
850
|
-
|
|
854
|
+
children: [l && /* @__PURE__ */ G(ie, { children: [
|
|
855
|
+
m?.saving && /* @__PURE__ */ W(S, { size: 12 }),
|
|
856
|
+
m?.error && /* @__PURE__ */ W("span", {
|
|
851
857
|
style: {
|
|
852
858
|
fontSize: 11,
|
|
853
859
|
color: "var(--danger)"
|
|
854
860
|
},
|
|
855
|
-
title:
|
|
861
|
+
title: m.error,
|
|
856
862
|
children: "!"
|
|
857
863
|
}),
|
|
858
|
-
|
|
864
|
+
u === "row_edit" && /* @__PURE__ */ W(v, {
|
|
859
865
|
size: 32,
|
|
860
|
-
icon: /* @__PURE__ */
|
|
861
|
-
onClick: () =>
|
|
862
|
-
title:
|
|
866
|
+
icon: /* @__PURE__ */ W(g.edit, { size: 14 }),
|
|
867
|
+
onClick: () => b(e),
|
|
868
|
+
title: k("record.row.edit", "Edit row")
|
|
863
869
|
}),
|
|
864
|
-
/* @__PURE__ */
|
|
870
|
+
/* @__PURE__ */ W(v, {
|
|
865
871
|
size: 32,
|
|
866
|
-
icon: /* @__PURE__ */
|
|
867
|
-
onClick: () =>
|
|
868
|
-
title:
|
|
872
|
+
icon: /* @__PURE__ */ W(g.trash, { size: 14 }),
|
|
873
|
+
onClick: () => _(e),
|
|
874
|
+
title: k("record.row.delete", "Delete row")
|
|
869
875
|
})
|
|
870
|
-
] }), !
|
|
876
|
+
] }), !l && D && D.length > 0 && /* @__PURE__ */ W(I, {
|
|
871
877
|
entity: r,
|
|
872
878
|
actions: D,
|
|
873
879
|
objectIds: [e],
|
|
@@ -877,21 +883,21 @@ function de({ rowId: e, row: n, entity: r, entities: a, screens: o, columns: s,
|
|
|
877
883
|
})]
|
|
878
884
|
});
|
|
879
885
|
}
|
|
880
|
-
function fe({ rowId: e, row: n, entity: r, entities: i, screens: a, columns: o, editableColumns: s, editable:
|
|
881
|
-
let j =
|
|
886
|
+
function fe({ rowId: e, row: n, entity: r, entities: i, screens: a, columns: o, editableColumns: s, editable: c, interaction: l, isEditing: u, editErrors: d, isDeleting: f, activeCell: p, setActiveCell: m, rowState: h, onCellChange: _, onDeleteClick: b, onStartEdit: x, onConfirmEdit: C, onCancelEdit: w, refs: T, identityCol: E, href: D, rowActions: O, onRowActionSuccess: k }) {
|
|
887
|
+
let j = y(), M = B(() => !h || Object.keys(h.buffer).length === 0 ? n : {
|
|
882
888
|
...n,
|
|
883
|
-
...
|
|
884
|
-
}, [n,
|
|
885
|
-
if (
|
|
886
|
-
let t =
|
|
887
|
-
return /* @__PURE__ */
|
|
889
|
+
...h.buffer
|
|
890
|
+
}, [n, h]);
|
|
891
|
+
if (l === "row_edit" && u) {
|
|
892
|
+
let t = h?.error ? [...d, `_error:${h.error}`] : d;
|
|
893
|
+
return /* @__PURE__ */ W(Q, {
|
|
888
894
|
values: M,
|
|
889
895
|
entity: r,
|
|
890
896
|
columns: o,
|
|
891
897
|
editableColumns: s,
|
|
892
898
|
errors: t,
|
|
893
|
-
saving:
|
|
894
|
-
onChange: (t, n) =>
|
|
899
|
+
saving: h?.saving ?? !1,
|
|
900
|
+
onChange: (t, n) => _(e, t, n),
|
|
895
901
|
onConfirm: () => C(e),
|
|
896
902
|
onCancel: () => w(e),
|
|
897
903
|
refs: T
|
|
@@ -901,27 +907,27 @@ function fe({ rowId: e, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
901
907
|
padding: "4px 4px",
|
|
902
908
|
borderBottom: "1px solid var(--divider)",
|
|
903
909
|
verticalAlign: "middle"
|
|
904
|
-
}, P =
|
|
905
|
-
return /* @__PURE__ */
|
|
906
|
-
style: { opacity:
|
|
910
|
+
}, P = l === "inline_edit";
|
|
911
|
+
return /* @__PURE__ */ G("tr", {
|
|
912
|
+
style: { opacity: f ? .5 : 1 },
|
|
907
913
|
children: [
|
|
908
914
|
o.map((n) => {
|
|
909
915
|
let o = r.fields.get(n), c = s.has(n);
|
|
910
|
-
if (P &&
|
|
916
|
+
if (P && p?.rowId === e && p?.col === n && c) return /* @__PURE__ */ W("td", {
|
|
911
917
|
style: te,
|
|
912
|
-
children: o ?
|
|
918
|
+
children: o ? A({
|
|
913
919
|
field: o,
|
|
914
920
|
fieldName: n,
|
|
915
921
|
value: M[n],
|
|
916
922
|
mode: "edit",
|
|
917
|
-
onChange: (t) =>
|
|
923
|
+
onChange: (t) => _(e, n, t),
|
|
918
924
|
record: M,
|
|
919
925
|
refs: T,
|
|
920
926
|
compact: !0,
|
|
921
927
|
t: j
|
|
922
928
|
}) : t(M[n])
|
|
923
929
|
}, n);
|
|
924
|
-
let l = D && n === E, u = o ?
|
|
930
|
+
let l = D && n === E, u = o ? A({
|
|
925
931
|
field: o,
|
|
926
932
|
fieldName: n,
|
|
927
933
|
value: M[n],
|
|
@@ -932,17 +938,17 @@ function fe({ rowId: e, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
932
938
|
entities: i,
|
|
933
939
|
screens: l ? void 0 : a,
|
|
934
940
|
t: j
|
|
935
|
-
}) : t(M[n]), d = P && c && !
|
|
936
|
-
return /* @__PURE__ */
|
|
941
|
+
}) : t(M[n]), d = P && c && !f;
|
|
942
|
+
return /* @__PURE__ */ W("td", {
|
|
937
943
|
style: {
|
|
938
944
|
...ee,
|
|
939
945
|
cursor: d ? "pointer" : "default"
|
|
940
946
|
},
|
|
941
|
-
onClick: d ? () =>
|
|
947
|
+
onClick: d ? () => m({
|
|
942
948
|
rowId: e,
|
|
943
949
|
col: n
|
|
944
950
|
}) : void 0,
|
|
945
|
-
children: l ? /* @__PURE__ */
|
|
951
|
+
children: l ? /* @__PURE__ */ W("a", {
|
|
946
952
|
href: D,
|
|
947
953
|
style: {
|
|
948
954
|
color: "var(--accent-text)",
|
|
@@ -955,111 +961,111 @@ function fe({ rowId: e, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
955
961
|
}) : u
|
|
956
962
|
}, n);
|
|
957
963
|
}),
|
|
958
|
-
|
|
964
|
+
c && /* @__PURE__ */ W("td", {
|
|
959
965
|
style: {
|
|
960
966
|
padding: "4px 8px",
|
|
961
967
|
borderBottom: "1px solid var(--divider)",
|
|
962
968
|
verticalAlign: "middle"
|
|
963
969
|
},
|
|
964
|
-
children: /* @__PURE__ */
|
|
970
|
+
children: /* @__PURE__ */ G("div", {
|
|
965
971
|
style: {
|
|
966
972
|
display: "flex",
|
|
967
973
|
alignItems: "center",
|
|
968
974
|
gap: 4
|
|
969
975
|
},
|
|
970
976
|
children: [
|
|
971
|
-
|
|
972
|
-
|
|
977
|
+
h?.saving && /* @__PURE__ */ W(S, { size: 12 }),
|
|
978
|
+
h?.error && /* @__PURE__ */ W("span", {
|
|
973
979
|
style: {
|
|
974
980
|
fontSize: 11,
|
|
975
981
|
color: "var(--danger)"
|
|
976
982
|
},
|
|
977
|
-
title:
|
|
983
|
+
title: h.error,
|
|
978
984
|
children: "!"
|
|
979
985
|
}),
|
|
980
|
-
|
|
986
|
+
l === "row_edit" && /* @__PURE__ */ W(v, {
|
|
981
987
|
size: 24,
|
|
982
|
-
icon: /* @__PURE__ */
|
|
983
|
-
onClick: () =>
|
|
988
|
+
icon: /* @__PURE__ */ W(g.edit, { size: 12 }),
|
|
989
|
+
onClick: () => x(e),
|
|
984
990
|
title: j("record.row.edit", "Edit row")
|
|
985
991
|
}),
|
|
986
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ W(v, {
|
|
987
993
|
size: 24,
|
|
988
|
-
icon: /* @__PURE__ */
|
|
989
|
-
onClick: () =>
|
|
994
|
+
icon: /* @__PURE__ */ W(g.trash, { size: 12 }),
|
|
995
|
+
onClick: () => b(e),
|
|
990
996
|
title: j("record.row.delete", "Delete row")
|
|
991
997
|
})
|
|
992
998
|
]
|
|
993
999
|
})
|
|
994
1000
|
}),
|
|
995
|
-
!
|
|
1001
|
+
!c && O && O.length > 0 && /* @__PURE__ */ W("td", {
|
|
996
1002
|
style: {
|
|
997
1003
|
padding: "4px 8px",
|
|
998
1004
|
borderBottom: "1px solid var(--divider)",
|
|
999
1005
|
verticalAlign: "middle"
|
|
1000
1006
|
},
|
|
1001
|
-
children: /* @__PURE__ */
|
|
1007
|
+
children: /* @__PURE__ */ W(I, {
|
|
1002
1008
|
entity: r,
|
|
1003
1009
|
actions: O,
|
|
1004
1010
|
objectIds: [e],
|
|
1005
1011
|
row: M,
|
|
1006
|
-
onSuccess:
|
|
1012
|
+
onSuccess: k
|
|
1007
1013
|
})
|
|
1008
1014
|
})
|
|
1009
1015
|
]
|
|
1010
1016
|
});
|
|
1011
1017
|
}
|
|
1012
|
-
function
|
|
1013
|
-
let
|
|
1018
|
+
function Q({ values: e, entity: n, columns: r, editableColumns: i, errors: a, saving: o, onChange: s, onConfirm: c, onCancel: l, refs: u, accent: d }) {
|
|
1019
|
+
let f = y(), p = a.find((e) => e.startsWith("_error:")), m = new Set(a.filter((e) => !e.startsWith("_error:"))), h = {
|
|
1014
1020
|
padding: "6px 12px",
|
|
1015
1021
|
borderBottom: "1px solid var(--divider)",
|
|
1016
1022
|
verticalAlign: "middle",
|
|
1017
1023
|
height: 40,
|
|
1018
1024
|
minWidth: 0
|
|
1019
|
-
},
|
|
1025
|
+
}, _ = {
|
|
1020
1026
|
display: "block",
|
|
1021
1027
|
width: "100%",
|
|
1022
1028
|
maxWidth: "100%",
|
|
1023
1029
|
minWidth: 0
|
|
1024
1030
|
};
|
|
1025
|
-
return /* @__PURE__ */
|
|
1026
|
-
style:
|
|
1031
|
+
return /* @__PURE__ */ G("tr", {
|
|
1032
|
+
style: d ? { boxShadow: "inset 3px 0 0 var(--accent)" } : void 0,
|
|
1027
1033
|
onKeyDown: (e) => {
|
|
1028
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(),
|
|
1034
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), c()) : e.key === "Escape" && (e.preventDefault(), l());
|
|
1029
1035
|
},
|
|
1030
1036
|
children: [r.map((r) => {
|
|
1031
|
-
let a = n.fields.get(r), o = i.has(r), c =
|
|
1032
|
-
return o ? /* @__PURE__ */
|
|
1037
|
+
let a = n.fields.get(r), o = i.has(r), c = m.has(r);
|
|
1038
|
+
return o ? /* @__PURE__ */ W("td", {
|
|
1033
1039
|
style: {
|
|
1034
|
-
...
|
|
1040
|
+
...h,
|
|
1035
1041
|
outline: c ? "1px solid var(--danger)" : "none",
|
|
1036
1042
|
outlineOffset: -1
|
|
1037
1043
|
},
|
|
1038
|
-
title: c ?
|
|
1039
|
-
children: /* @__PURE__ */
|
|
1040
|
-
style:
|
|
1041
|
-
children: a ?
|
|
1044
|
+
title: c ? f("record.row.field_required", "{field} is required", { field: r }) : void 0,
|
|
1045
|
+
children: /* @__PURE__ */ W("div", {
|
|
1046
|
+
style: _,
|
|
1047
|
+
children: a ? A({
|
|
1042
1048
|
field: a,
|
|
1043
1049
|
fieldName: r,
|
|
1044
1050
|
value: e[r],
|
|
1045
1051
|
mode: "edit",
|
|
1046
1052
|
onChange: (e) => s(r, e),
|
|
1047
1053
|
record: e,
|
|
1048
|
-
refs:
|
|
1054
|
+
refs: u,
|
|
1049
1055
|
compact: !0,
|
|
1050
|
-
t:
|
|
1056
|
+
t: f
|
|
1051
1057
|
}) : t(e[r])
|
|
1052
1058
|
})
|
|
1053
|
-
}, r) : /* @__PURE__ */
|
|
1059
|
+
}, r) : /* @__PURE__ */ W("td", {
|
|
1054
1060
|
style: {
|
|
1055
|
-
...
|
|
1061
|
+
...h,
|
|
1056
1062
|
color: "var(--text-3)"
|
|
1057
1063
|
},
|
|
1058
1064
|
children: a?.auto ? "—" : t(e[r])
|
|
1059
1065
|
}, r);
|
|
1060
|
-
}), /* @__PURE__ */
|
|
1061
|
-
style:
|
|
1062
|
-
children: /* @__PURE__ */
|
|
1066
|
+
}), /* @__PURE__ */ W("td", {
|
|
1067
|
+
style: h,
|
|
1068
|
+
children: /* @__PURE__ */ G("div", {
|
|
1063
1069
|
style: {
|
|
1064
1070
|
display: "flex",
|
|
1065
1071
|
alignItems: "center",
|
|
@@ -1067,45 +1073,45 @@ function X({ values: e, entity: n, columns: r, editableColumns: i, errors: a, sa
|
|
|
1067
1073
|
justifyContent: "flex-end"
|
|
1068
1074
|
},
|
|
1069
1075
|
children: [
|
|
1070
|
-
|
|
1076
|
+
p && /* @__PURE__ */ W("span", {
|
|
1071
1077
|
style: {
|
|
1072
1078
|
fontSize: 11,
|
|
1073
1079
|
color: "var(--danger)"
|
|
1074
1080
|
},
|
|
1075
|
-
title:
|
|
1081
|
+
title: p.slice(7),
|
|
1076
1082
|
children: "!"
|
|
1077
1083
|
}),
|
|
1078
|
-
/* @__PURE__ */
|
|
1084
|
+
/* @__PURE__ */ W(v, {
|
|
1079
1085
|
size: 24,
|
|
1080
|
-
icon:
|
|
1081
|
-
onClick:
|
|
1082
|
-
title:
|
|
1086
|
+
icon: W(o ? S : g.check, { size: 12 }),
|
|
1087
|
+
onClick: c,
|
|
1088
|
+
title: f("record.row.confirm", "Confirm (Enter)")
|
|
1083
1089
|
}),
|
|
1084
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ W(v, {
|
|
1085
1091
|
size: 24,
|
|
1086
|
-
icon: /* @__PURE__ */
|
|
1087
|
-
onClick:
|
|
1088
|
-
title:
|
|
1092
|
+
icon: /* @__PURE__ */ W(g.x, { size: 12 }),
|
|
1093
|
+
onClick: l,
|
|
1094
|
+
title: f("record.row.cancel", "Cancel (Esc)")
|
|
1089
1095
|
})
|
|
1090
1096
|
]
|
|
1091
1097
|
})
|
|
1092
1098
|
})]
|
|
1093
1099
|
});
|
|
1094
1100
|
}
|
|
1095
|
-
function
|
|
1096
|
-
let
|
|
1097
|
-
return /* @__PURE__ */
|
|
1101
|
+
function pe({ values: e, entity: n, columns: r, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
|
|
1102
|
+
let p = y(), m = z(), h = o.find((e) => e.startsWith("_error:")), _ = new Set(o.filter((e) => !e.startsWith("_error:")));
|
|
1103
|
+
return /* @__PURE__ */ G("div", {
|
|
1098
1104
|
style: {
|
|
1099
1105
|
border: "1px solid var(--border)",
|
|
1100
1106
|
borderRadius: "var(--radius-md)",
|
|
1101
1107
|
background: "var(--surface)",
|
|
1102
1108
|
overflow: "hidden",
|
|
1103
|
-
boxShadow:
|
|
1109
|
+
boxShadow: f ? "inset 3px 0 0 var(--accent)" : void 0
|
|
1104
1110
|
},
|
|
1105
1111
|
onKeyDown: (e) => {
|
|
1106
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(),
|
|
1112
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), u());
|
|
1107
1113
|
},
|
|
1108
|
-
children: [/* @__PURE__ */
|
|
1114
|
+
children: [/* @__PURE__ */ W("div", {
|
|
1109
1115
|
style: {
|
|
1110
1116
|
padding: 10,
|
|
1111
1117
|
display: "flex",
|
|
@@ -1113,52 +1119,52 @@ function Z({ values: e, entity: n, columns: r, editableColumns: a, errors: o, sa
|
|
|
1113
1119
|
gap: 12
|
|
1114
1120
|
},
|
|
1115
1121
|
children: r.map((r) => {
|
|
1116
|
-
let o = n.fields.get(r), s = a.has(r),
|
|
1122
|
+
let o = n.fields.get(r), s = a.has(r), l = _.has(r), u = o ? i(p, o, r) : r, f = `${m}-${r}`, h = `${f}-label`, g = {
|
|
1117
1123
|
fontSize: 11.5,
|
|
1118
1124
|
fontWeight: 600,
|
|
1119
1125
|
color: "var(--text-3)"
|
|
1120
1126
|
};
|
|
1121
|
-
return /* @__PURE__ */
|
|
1127
|
+
return /* @__PURE__ */ G("div", {
|
|
1122
1128
|
style: {
|
|
1123
1129
|
display: "flex",
|
|
1124
1130
|
flexDirection: "column",
|
|
1125
1131
|
gap: 5,
|
|
1126
1132
|
minWidth: 0
|
|
1127
1133
|
},
|
|
1128
|
-
children: [s && o ? /* @__PURE__ */
|
|
1129
|
-
id:
|
|
1130
|
-
htmlFor:
|
|
1131
|
-
style:
|
|
1134
|
+
children: [s && o ? /* @__PURE__ */ W("label", {
|
|
1135
|
+
id: h,
|
|
1136
|
+
htmlFor: f,
|
|
1137
|
+
style: g,
|
|
1132
1138
|
children: u
|
|
1133
|
-
}) : /* @__PURE__ */
|
|
1134
|
-
id:
|
|
1135
|
-
style:
|
|
1139
|
+
}) : /* @__PURE__ */ W("div", {
|
|
1140
|
+
id: h,
|
|
1141
|
+
style: g,
|
|
1136
1142
|
children: u
|
|
1137
|
-
}), /* @__PURE__ */
|
|
1143
|
+
}), /* @__PURE__ */ W("div", {
|
|
1138
1144
|
style: {
|
|
1139
1145
|
minWidth: 0,
|
|
1140
|
-
outline:
|
|
1146
|
+
outline: l ? "1px solid var(--danger)" : "none",
|
|
1141
1147
|
outlineOffset: 3,
|
|
1142
|
-
borderRadius:
|
|
1148
|
+
borderRadius: l ? "var(--radius-sm)" : 0
|
|
1143
1149
|
},
|
|
1144
|
-
title:
|
|
1145
|
-
children: s ? o ?
|
|
1150
|
+
title: l ? p("record.row.field_required", "{field} is required", { field: r }) : void 0,
|
|
1151
|
+
children: s ? o ? A({
|
|
1146
1152
|
field: o,
|
|
1147
1153
|
fieldName: r,
|
|
1148
1154
|
value: e[r],
|
|
1149
1155
|
mode: "edit",
|
|
1150
|
-
onChange: (e) =>
|
|
1156
|
+
onChange: (e) => c(r, e),
|
|
1151
1157
|
record: e,
|
|
1152
|
-
refs:
|
|
1158
|
+
refs: d,
|
|
1153
1159
|
compact: !0,
|
|
1154
|
-
fieldId:
|
|
1155
|
-
labelId:
|
|
1156
|
-
t:
|
|
1160
|
+
fieldId: f,
|
|
1161
|
+
labelId: h,
|
|
1162
|
+
t: p
|
|
1157
1163
|
}) : t(e[r]) : o?.auto ? "—" : t(e[r])
|
|
1158
1164
|
})]
|
|
1159
1165
|
}, r);
|
|
1160
1166
|
})
|
|
1161
|
-
}), /* @__PURE__ */
|
|
1167
|
+
}), /* @__PURE__ */ G("div", {
|
|
1162
1168
|
style: {
|
|
1163
1169
|
minHeight: 42,
|
|
1164
1170
|
padding: "6px 8px",
|
|
@@ -1169,36 +1175,36 @@ function Z({ values: e, entity: n, columns: r, editableColumns: a, errors: o, sa
|
|
|
1169
1175
|
gap: 6
|
|
1170
1176
|
},
|
|
1171
1177
|
children: [
|
|
1172
|
-
|
|
1178
|
+
h && /* @__PURE__ */ W("span", {
|
|
1173
1179
|
style: {
|
|
1174
1180
|
fontSize: 11,
|
|
1175
1181
|
color: "var(--danger)"
|
|
1176
1182
|
},
|
|
1177
|
-
title:
|
|
1183
|
+
title: h.slice(7),
|
|
1178
1184
|
children: "!"
|
|
1179
1185
|
}),
|
|
1180
|
-
/* @__PURE__ */
|
|
1186
|
+
/* @__PURE__ */ W(v, {
|
|
1181
1187
|
size: 32,
|
|
1182
|
-
icon:
|
|
1183
|
-
onClick:
|
|
1184
|
-
title:
|
|
1188
|
+
icon: W(s ? S : g.check, { size: 14 }),
|
|
1189
|
+
onClick: l,
|
|
1190
|
+
title: p("record.row.confirm", "Confirm (Enter)")
|
|
1185
1191
|
}),
|
|
1186
|
-
/* @__PURE__ */
|
|
1192
|
+
/* @__PURE__ */ W(v, {
|
|
1187
1193
|
size: 32,
|
|
1188
|
-
icon: /* @__PURE__ */
|
|
1189
|
-
onClick:
|
|
1190
|
-
title:
|
|
1194
|
+
icon: /* @__PURE__ */ W(g.x, { size: 14 }),
|
|
1195
|
+
onClick: u,
|
|
1196
|
+
title: p("record.row.cancel", "Cancel (Esc)")
|
|
1191
1197
|
})
|
|
1192
1198
|
]
|
|
1193
1199
|
})]
|
|
1194
1200
|
});
|
|
1195
1201
|
}
|
|
1196
|
-
function
|
|
1197
|
-
let d =
|
|
1202
|
+
function me({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
1203
|
+
let d = B(() => {
|
|
1198
1204
|
let e = new Set(r);
|
|
1199
1205
|
return e.delete(i), e;
|
|
1200
1206
|
}, [r, i]);
|
|
1201
|
-
return /* @__PURE__ */
|
|
1207
|
+
return /* @__PURE__ */ W(Q, {
|
|
1202
1208
|
values: e,
|
|
1203
1209
|
entity: t,
|
|
1204
1210
|
columns: n,
|
|
@@ -1212,12 +1218,12 @@ function pe({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
|
|
|
1212
1218
|
accent: !0
|
|
1213
1219
|
});
|
|
1214
1220
|
}
|
|
1215
|
-
function
|
|
1216
|
-
let d =
|
|
1221
|
+
function he({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
1222
|
+
let d = B(() => {
|
|
1217
1223
|
let e = new Set(r);
|
|
1218
1224
|
return e.delete(i), e;
|
|
1219
1225
|
}, [r, i]);
|
|
1220
|
-
return /* @__PURE__ */
|
|
1226
|
+
return /* @__PURE__ */ W(pe, {
|
|
1221
1227
|
values: e,
|
|
1222
1228
|
entity: t,
|
|
1223
1229
|
columns: n,
|
|
@@ -1232,4 +1238,4 @@ function me({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
|
|
|
1232
1238
|
});
|
|
1233
1239
|
}
|
|
1234
1240
|
//#endregion
|
|
1235
|
-
export {
|
|
1241
|
+
export { J as AssociatedBlock, ce as associatedDraftEditableColumns, se as associatedEditableColumns, q as associatedParentValue, le as findMissingRequiredAssociatedFields, oe as resolveAssociatedForeignKey, ae as resolveAssociatedRowActions, K as resolveAssociatedToolbarActions };
|