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