@declarion/react 0.106.0 → 0.109.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/api/agents.js +8 -7
- package/dist-lib/api/client.js +48 -49
- package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
- package/dist-lib/components/agents/ChatAttachments.js +144 -0
- package/dist-lib/components/agents/transcript-runs.js +1 -1
- package/dist-lib/components/chrome/AssociationTabs.js +89 -75
- package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
- package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
- package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
- package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
- package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
- package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
- package/dist-lib/components/fields/RefCombobox.js +53 -48
- package/dist-lib/components/fields/index.js +1 -0
- package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
- package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
- package/dist-lib/components/params/ParamsBlock.js +18 -15
- package/dist-lib/components/params/param-editors.js +60 -54
- package/dist-lib/components/primitives/RetryButton.js +14 -0
- package/dist-lib/components/primitives/StatTile.js +42 -34
- package/dist-lib/hooks/useAgentConversation.js +18 -13
- package/dist-lib/hooks/useParams.js +54 -52
- package/dist-lib/hooks/useSchema.js +5 -2
- package/dist-lib/hooks/useTimelineData.js +26 -24
- package/dist-lib/index.d.ts +89 -5
- package/dist-lib/index.js +95 -93
- package/dist-lib/lib/read-display-state.js +19 -0
- package/dist-lib/stores/auth.js +1 -0
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/types/fieldType.js +1 -1
- package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-DODbtSrY.d.ts} +3 -0
- package/package.json +1 -1
|
@@ -8,27 +8,29 @@ import { Btn as _ } from "../primitives/Btn.js";
|
|
|
8
8
|
import { IconBtn as v } from "../primitives/IconBtn.js";
|
|
9
9
|
import { useText as y } from "../../hooks/useText.js";
|
|
10
10
|
import { SectionCard as b } from "../primitives/SectionCard.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
11
|
+
import { RetryButton as x } from "../primitives/RetryButton.js";
|
|
12
|
+
import { useResponsiveMode as S } from "../../hooks/useResponsiveMode.js";
|
|
13
|
+
import { Spinner as C } from "../primitives/Spinner.js";
|
|
14
|
+
import { readDisplayState as w } from "../../lib/read-display-state.js";
|
|
15
|
+
import { DynamicIcon as T } from "../shared/DynamicIcon.js";
|
|
16
|
+
import { useTabNavigate as E } from "../../hooks/useTabNavigate.js";
|
|
17
|
+
import { applyRowState as D, defaultFlatForSlot as O } from "../../lib/actions.js";
|
|
18
|
+
import { ENTITY_CHILDREN_KEY as k, useChildrenData as A } from "../../hooks/useChildrenData.js";
|
|
19
|
+
import { useActionRunner as j } from "../actions/ActionRunner.js";
|
|
20
|
+
import { renderField as M } from "../fields/index.js";
|
|
21
|
+
import { dispatchAction as N } from "../../lib/action-dispatch.js";
|
|
22
|
+
import { ResponsiveActionBar as P } from "../actions/ResponsiveActionBar.js";
|
|
21
23
|
import { useRowTenant as ee } from "../../hooks/useRowTenant.js";
|
|
22
|
-
import { dataTableCellStyle as
|
|
23
|
-
import { ActionButton as
|
|
24
|
-
import { useAssociatedData as
|
|
25
|
-
import { RowActionsKebab as
|
|
26
|
-
import { AssociatedToolbar as
|
|
27
|
-
import { useCallback as
|
|
24
|
+
import { dataTableCellStyle as F, dataTableHeadCellStyle as te, dataTableStyle as ne } from "../primitives/dataTableStyles.js";
|
|
25
|
+
import { ActionButton as re } from "../actions/ActionButton.js";
|
|
26
|
+
import { useAssociatedData as I } from "../../hooks/useAssociatedData.js";
|
|
27
|
+
import { RowActionsKebab as L } from "../actions/RowActionsKebab.js";
|
|
28
|
+
import { AssociatedToolbar as R } from "./AssociatedToolbar.js";
|
|
29
|
+
import { useCallback as z, useEffect as B, useId as ie, useMemo as V, useRef as ae, useState as H } from "react";
|
|
28
30
|
import { useQueryClient as U } from "@tanstack/react-query";
|
|
29
|
-
import { Fragment as
|
|
31
|
+
import { Fragment as oe, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
30
32
|
//#region src/components/detail-layout/AssociatedBlock.tsx
|
|
31
|
-
function
|
|
33
|
+
function se(e) {
|
|
32
34
|
if (!e) return [];
|
|
33
35
|
let t = [];
|
|
34
36
|
for (let [n, r] of Object.entries(e)) (r.visibility ?? []).includes("list_row") && (r.association || r.href || n.startsWith("__") || t.push({
|
|
@@ -63,7 +65,7 @@ function K(t, n, r) {
|
|
|
63
65
|
}
|
|
64
66
|
return i;
|
|
65
67
|
}
|
|
66
|
-
function
|
|
68
|
+
function ce(e, t, n) {
|
|
67
69
|
let r = e[n];
|
|
68
70
|
if (!r) return null;
|
|
69
71
|
let i = e[t], a = i?.children?.find((e) => e.entity === n);
|
|
@@ -91,7 +93,7 @@ function q(e, t, n, r, i) {
|
|
|
91
93
|
let s = r[o];
|
|
92
94
|
return typeof s == "string" || typeof s == "number" ? String(s) : "";
|
|
93
95
|
}
|
|
94
|
-
function
|
|
96
|
+
function le(e, t, n) {
|
|
95
97
|
let r = new Set(a(e));
|
|
96
98
|
return new Set(t.filter((t) => {
|
|
97
99
|
if (t === n || r.has(t)) return !1;
|
|
@@ -99,14 +101,14 @@ function se(e, t, n) {
|
|
|
99
101
|
return i ? o(i) : !1;
|
|
100
102
|
}));
|
|
101
103
|
}
|
|
102
|
-
function
|
|
104
|
+
function ue(e, t, n) {
|
|
103
105
|
return new Set(t.filter((t) => {
|
|
104
106
|
if (t === n) return !1;
|
|
105
107
|
let r = e.fields.get(t);
|
|
106
108
|
return !(!r || r.auto);
|
|
107
109
|
}));
|
|
108
110
|
}
|
|
109
|
-
function
|
|
111
|
+
function de(e, t, n, r) {
|
|
110
112
|
let i = [];
|
|
111
113
|
for (let a of t) {
|
|
112
114
|
let t = n.fields.get(a);
|
|
@@ -121,7 +123,7 @@ function J({ node: e, ctx: t }) {
|
|
|
121
123
|
if (!r || t.isNew) return null;
|
|
122
124
|
let i = t.schema.entities[r];
|
|
123
125
|
if (!i) return null;
|
|
124
|
-
let a = e.foreign_key ??
|
|
126
|
+
let a = e.foreign_key ?? ce(t.schema.entities, t.entityCode, r);
|
|
125
127
|
return a ? /* @__PURE__ */ W(Y, {
|
|
126
128
|
node: e,
|
|
127
129
|
ctx: t,
|
|
@@ -148,30 +150,30 @@ function Y({ node: e, ctx: t, assocCode: r, assocEntity: i, fkField: a }) {
|
|
|
148
150
|
if (e === a) return !1;
|
|
149
151
|
let t = i.fields.get(e);
|
|
150
152
|
return !(!t || t.primary || t.display?.is_listable === !1);
|
|
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 =
|
|
153
|
+
}), 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 = V(() => K(i.actions, a, x), [
|
|
152
154
|
i.actions,
|
|
153
155
|
a,
|
|
154
156
|
x
|
|
155
|
-
]),
|
|
157
|
+
]), C = V(() => {
|
|
156
158
|
let e = {};
|
|
157
159
|
for (let { code: t, action: n } of S) e[t] = n;
|
|
158
160
|
return e;
|
|
159
|
-
}, [S]),
|
|
161
|
+
}, [S]), w = V(() => {
|
|
160
162
|
let e = i.action_layout ?? null;
|
|
161
|
-
return
|
|
163
|
+
return D(o, e ?? O(C, "list_toolbar"), C, void 0, {}, [], d);
|
|
162
164
|
}, [
|
|
163
165
|
o,
|
|
164
166
|
i.action_layout,
|
|
165
|
-
|
|
167
|
+
C,
|
|
166
168
|
d
|
|
167
|
-
]), { run:
|
|
169
|
+
]), { run: k } = j(), A = E(), M = V(() => ({
|
|
168
170
|
entity: i,
|
|
169
171
|
entityCode: r,
|
|
170
172
|
screenRoute: typeof window < "u" ? window.location.pathname : "",
|
|
171
173
|
selectedRows: [],
|
|
172
174
|
selectedIds: [],
|
|
173
175
|
t: o,
|
|
174
|
-
tabNavigate: (e, t) =>
|
|
176
|
+
tabNavigate: (e, t) => A(e, {
|
|
175
177
|
title: t?.title,
|
|
176
178
|
icon: t?.icon,
|
|
177
179
|
search: t?.search
|
|
@@ -181,29 +183,29 @@ function Y({ node: e, ctx: t, assocCode: r, assocEntity: i, fkField: a }) {
|
|
|
181
183
|
i,
|
|
182
184
|
r,
|
|
183
185
|
o,
|
|
184
|
-
|
|
185
|
-
]),
|
|
186
|
-
|
|
186
|
+
A
|
|
187
|
+
]), F = U(), te = z(() => {
|
|
188
|
+
F.invalidateQueries({ predicate: (e) => {
|
|
187
189
|
let t = e.queryKey;
|
|
188
190
|
return t[0] === "entity-children" && t[3] === r;
|
|
189
191
|
} });
|
|
190
|
-
}, [
|
|
191
|
-
let n =
|
|
192
|
-
if (n !== null) return
|
|
192
|
+
}, [F, r]), ne = z((e, t) => {
|
|
193
|
+
let n = N(s, e, t, {}, r);
|
|
194
|
+
if (n !== null) return k({
|
|
193
195
|
action: t,
|
|
194
196
|
title: o(t.display?.name) || e,
|
|
195
197
|
execute: async (e) => {
|
|
196
198
|
let t = await p(n, l(e, void 0));
|
|
197
|
-
return
|
|
199
|
+
return te(), t;
|
|
198
200
|
}
|
|
199
201
|
});
|
|
200
202
|
}, [
|
|
201
203
|
o,
|
|
202
204
|
s,
|
|
203
|
-
|
|
205
|
+
k,
|
|
204
206
|
r,
|
|
205
|
-
|
|
206
|
-
]), [
|
|
207
|
+
te
|
|
208
|
+
]), [I, L] = H(0), R = /* @__PURE__ */ G("div", {
|
|
207
209
|
style: {
|
|
208
210
|
display: "flex",
|
|
209
211
|
alignItems: "center",
|
|
@@ -212,28 +214,28 @@ function Y({ node: e, ctx: t, assocCode: r, assocEntity: i, fkField: a }) {
|
|
|
212
214
|
minWidth: 0,
|
|
213
215
|
justifyContent: "flex-end"
|
|
214
216
|
},
|
|
215
|
-
children: [i.action_layout ?
|
|
217
|
+
children: [i.action_layout ? w.length > 0 && /* @__PURE__ */ W(P, {
|
|
216
218
|
kind: "toolbar",
|
|
217
|
-
layout:
|
|
218
|
-
entityActions:
|
|
219
|
-
onRun:
|
|
220
|
-
widgetContext:
|
|
219
|
+
layout: w,
|
|
220
|
+
entityActions: C,
|
|
221
|
+
onRun: ne,
|
|
222
|
+
widgetContext: M,
|
|
221
223
|
ariaLabel: o("record.associated.toolbar_actions", "{name} toolbar actions", { name: h })
|
|
222
|
-
}) : S.map(({ code: e, action: t }) => /* @__PURE__ */ W(
|
|
224
|
+
}) : S.map(({ code: e, action: t }) => /* @__PURE__ */ W(re, {
|
|
223
225
|
actionCode: e,
|
|
224
226
|
action: t,
|
|
225
227
|
entityCode: r,
|
|
226
228
|
variant: "ghost",
|
|
227
229
|
size: "sm",
|
|
228
|
-
onSuccess:
|
|
230
|
+
onSuccess: te
|
|
229
231
|
}, e)), m && /* @__PURE__ */ W(_, {
|
|
230
232
|
kind: "ghost",
|
|
231
233
|
size: "xs",
|
|
232
234
|
icon: /* @__PURE__ */ W(g.plus, { size: 12 }),
|
|
233
|
-
onClick: () =>
|
|
235
|
+
onClick: () => L((e) => e + 1),
|
|
234
236
|
children: o("record.row.add", "Add row")
|
|
235
237
|
})]
|
|
236
|
-
}),
|
|
238
|
+
}), B = v ? /* @__PURE__ */ W(X, {
|
|
237
239
|
entityCode: r,
|
|
238
240
|
entity: i,
|
|
239
241
|
parentEntity: t.entityCode,
|
|
@@ -246,8 +248,8 @@ function Y({ node: e, ctx: t, assocCode: r, assocEntity: i, fkField: a }) {
|
|
|
246
248
|
searchable: e.searchable,
|
|
247
249
|
filterFields: e.filters,
|
|
248
250
|
sort: e.sort,
|
|
249
|
-
startDraftSignal:
|
|
250
|
-
}) : /* @__PURE__ */ W(
|
|
251
|
+
startDraftSignal: I
|
|
252
|
+
}) : /* @__PURE__ */ W(fe, {
|
|
251
253
|
entityCode: r,
|
|
252
254
|
entity: i,
|
|
253
255
|
parentEntity: t.entityCode,
|
|
@@ -258,7 +260,7 @@ function Y({ node: e, ctx: t, assocCode: r, assocEntity: i, fkField: a }) {
|
|
|
258
260
|
interaction: f,
|
|
259
261
|
ctx: t,
|
|
260
262
|
sort: e.sort,
|
|
261
|
-
startDraftSignal:
|
|
263
|
+
startDraftSignal: I
|
|
262
264
|
});
|
|
263
265
|
return t.withinCard ? /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("div", {
|
|
264
266
|
style: {
|
|
@@ -266,21 +268,21 @@ function Y({ node: e, ctx: t, assocCode: r, assocEntity: i, fkField: a }) {
|
|
|
266
268
|
justifyContent: "flex-end",
|
|
267
269
|
marginBottom: 8
|
|
268
270
|
},
|
|
269
|
-
children:
|
|
270
|
-
}),
|
|
271
|
+
children: R
|
|
272
|
+
}), B] }) : /* @__PURE__ */ W(b, {
|
|
271
273
|
title: h,
|
|
272
|
-
icon: i.display?.icon ? /* @__PURE__ */ W(
|
|
274
|
+
icon: i.display?.icon ? /* @__PURE__ */ W(T, {
|
|
273
275
|
name: i.display.icon,
|
|
274
276
|
size: 14
|
|
275
277
|
}) : void 0,
|
|
276
|
-
right:
|
|
277
|
-
children:
|
|
278
|
+
right: R,
|
|
279
|
+
children: B
|
|
278
280
|
});
|
|
279
281
|
}
|
|
280
|
-
function
|
|
281
|
-
let d = U(),
|
|
282
|
+
function fe({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
|
|
283
|
+
let d = U(), f = A(n, r, e, i, l), p = f.data, m = w(f), h = p?.data ?? [], g = p?.$refs, _ = z(() => {
|
|
282
284
|
d.invalidateQueries({ queryKey: [
|
|
283
|
-
|
|
285
|
+
k,
|
|
284
286
|
n,
|
|
285
287
|
r,
|
|
286
288
|
e
|
|
@@ -302,21 +304,22 @@ function ue({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
302
304
|
ctx: c,
|
|
303
305
|
rows: h,
|
|
304
306
|
refs: g,
|
|
305
|
-
isLoading:
|
|
306
|
-
isError: m,
|
|
307
|
+
isLoading: m.loading,
|
|
308
|
+
isError: m.error !== null,
|
|
309
|
+
onRetry: m.retry,
|
|
307
310
|
invalidateQuery: _,
|
|
308
311
|
startDraftSignal: u
|
|
309
312
|
});
|
|
310
313
|
}
|
|
311
314
|
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,
|
|
313
|
-
|
|
315
|
+
let p = y(), m = U(), [h, g] = H(""), [v, b] = H(""), [x, S] = H({}), T = ae(void 0);
|
|
316
|
+
B(() => (T.current && clearTimeout(T.current), T.current = setTimeout(() => {
|
|
314
317
|
b(h);
|
|
315
318
|
}, 300), () => {
|
|
316
|
-
|
|
319
|
+
T.current && clearTimeout(T.current);
|
|
317
320
|
}), [h]);
|
|
318
|
-
let
|
|
319
|
-
|
|
321
|
+
let E = z((e, t) => {
|
|
322
|
+
S((n) => {
|
|
320
323
|
if (t === "__all__") {
|
|
321
324
|
let { [e]: t, ...r } = n;
|
|
322
325
|
return r;
|
|
@@ -326,13 +329,13 @@ function X({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey:
|
|
|
326
329
|
[e]: t
|
|
327
330
|
};
|
|
328
331
|
});
|
|
329
|
-
}, []),
|
|
330
|
-
if (!
|
|
332
|
+
}, []), D = V(() => Object.keys(x).length > 0 ? x : void 0, [x]), O = I(n, r, e, i, d, void 0, v || void 0, D), { data: k, hasNextPage: A, fetchNextPage: j, isFetchingNextPage: M } = O, N = w(O), { rows: P, refs: ee } = V(() => {
|
|
333
|
+
if (!k?.pages) return {
|
|
331
334
|
rows: [],
|
|
332
335
|
refs: void 0
|
|
333
336
|
};
|
|
334
337
|
let e = [], t;
|
|
335
|
-
for (let n of
|
|
338
|
+
for (let n of k.pages) if (e.push(...n.data), n.$refs) {
|
|
336
339
|
if (!t) t = { ...n.$refs };
|
|
337
340
|
else for (let [e, r] of Object.entries(n.$refs)) t[e] = {
|
|
338
341
|
...t[e],
|
|
@@ -343,21 +346,21 @@ function X({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey:
|
|
|
343
346
|
rows: e,
|
|
344
347
|
refs: t
|
|
345
348
|
};
|
|
346
|
-
}, [
|
|
349
|
+
}, [k]), F = z(() => {
|
|
347
350
|
m.invalidateQueries({ predicate: (t) => {
|
|
348
351
|
let n = t.queryKey;
|
|
349
352
|
return n[0] === "entity-children" && n[3] === e;
|
|
350
353
|
} });
|
|
351
354
|
}, [m, e]);
|
|
352
355
|
return /* @__PURE__ */ G("div", { children: [
|
|
353
|
-
/* @__PURE__ */ W(
|
|
356
|
+
/* @__PURE__ */ W(R, {
|
|
354
357
|
entity: t,
|
|
355
358
|
searchable: l,
|
|
356
359
|
filterFields: u,
|
|
357
360
|
searchValue: h,
|
|
358
361
|
onSearchChange: g,
|
|
359
362
|
filters: x,
|
|
360
|
-
onFilterChange:
|
|
363
|
+
onFilterChange: E,
|
|
361
364
|
allEntities: c.schema.entities
|
|
362
365
|
}),
|
|
363
366
|
/* @__PURE__ */ W(Z, {
|
|
@@ -369,11 +372,12 @@ function X({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey:
|
|
|
369
372
|
editable: o,
|
|
370
373
|
interaction: s,
|
|
371
374
|
ctx: c,
|
|
372
|
-
rows:
|
|
373
|
-
refs:
|
|
374
|
-
isLoading:
|
|
375
|
-
isError:
|
|
376
|
-
|
|
375
|
+
rows: P,
|
|
376
|
+
refs: ee,
|
|
377
|
+
isLoading: N.loading,
|
|
378
|
+
isError: N.error !== null,
|
|
379
|
+
onRetry: N.retry,
|
|
380
|
+
invalidateQuery: F,
|
|
377
381
|
startDraftSignal: f
|
|
378
382
|
}),
|
|
379
383
|
A && /* @__PURE__ */ W("div", {
|
|
@@ -381,7 +385,7 @@ function X({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey:
|
|
|
381
385
|
children: /* @__PURE__ */ W(_, {
|
|
382
386
|
kind: "ghost",
|
|
383
387
|
size: "xs",
|
|
384
|
-
icon: M ? /* @__PURE__ */ W(
|
|
388
|
+
icon: M ? /* @__PURE__ */ W(C, { size: 12 }) : void 0,
|
|
385
389
|
onClick: () => j(),
|
|
386
390
|
disabled: M,
|
|
387
391
|
children: p("record.associated.load_more", "Load more")
|
|
@@ -389,44 +393,44 @@ function X({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey:
|
|
|
389
393
|
})
|
|
390
394
|
] });
|
|
391
395
|
}
|
|
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:
|
|
393
|
-
let
|
|
396
|
+
function Z({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: o, editable: l, interaction: p, ctx: g, rows: _, refs: v, isLoading: b, isError: C, onRetry: w, invalidateQuery: T, startDraftSignal: E }) {
|
|
397
|
+
let D = y(), O = y("errors"), k = S(), A = ee(t), M = k.isPhone && g.relatedRecordsPresentation === "table", N = o.find((e) => e !== a), P = V(() => p === "navigate" ? s(void 0, t, g.schema.screens) : null, [
|
|
394
398
|
p,
|
|
395
399
|
t,
|
|
396
400
|
g.schema.screens
|
|
397
|
-
]),
|
|
401
|
+
]), F = V(() => l ? le(t, o, a) : /* @__PURE__ */ new Set(), [
|
|
398
402
|
o,
|
|
399
403
|
a,
|
|
400
404
|
t,
|
|
401
405
|
l
|
|
402
|
-
]),
|
|
406
|
+
]), re = V(() => ue(t, o, a), [
|
|
403
407
|
o,
|
|
404
408
|
a,
|
|
405
409
|
t
|
|
406
|
-
]),
|
|
410
|
+
]), I = V(() => {
|
|
407
411
|
let e = /* @__PURE__ */ new Map();
|
|
408
412
|
for (let n of _) {
|
|
409
413
|
let i = r(t, n);
|
|
410
414
|
e.set(f(i), i);
|
|
411
415
|
}
|
|
412
416
|
return e;
|
|
413
|
-
}, [_, t]),
|
|
417
|
+
}, [_, t]), L = V(() => {
|
|
414
418
|
let e = /* @__PURE__ */ new Map();
|
|
415
419
|
for (let n of _) {
|
|
416
420
|
let i = n.$row_version;
|
|
417
421
|
typeof i == "string" && i !== "" && e.set(f(r(t, n)), i);
|
|
418
422
|
}
|
|
419
423
|
return e;
|
|
420
|
-
}, [_, t]),
|
|
421
|
-
|
|
422
|
-
let X =
|
|
423
|
-
|
|
424
|
+
}, [_, t]), R = V(() => se(t.actions), [t.actions]), [ie, U] = H(null), [oe, K] = H(null), [ce, q] = H([]), [J, Y] = H({}), fe = ae(J);
|
|
425
|
+
fe.current = J;
|
|
426
|
+
let X = ae({});
|
|
427
|
+
B(() => {
|
|
424
428
|
let e = X.current;
|
|
425
429
|
return () => {
|
|
426
430
|
for (let t of Object.values(e)) clearTimeout(t);
|
|
427
431
|
};
|
|
428
432
|
}, []);
|
|
429
|
-
let [Z, Q] = H(null), [
|
|
433
|
+
let [Z, Q] = H(null), [he, $] = H([]), [ve, ye] = H(!1), { run: be } = j(), [xe, Se] = H(/* @__PURE__ */ new Set()), Ce = z(async (t, n, r) => {
|
|
430
434
|
Y((e) => ({
|
|
431
435
|
...e,
|
|
432
436
|
[t]: {
|
|
@@ -436,11 +440,11 @@ function Z({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: o, e
|
|
|
436
440
|
}
|
|
437
441
|
}));
|
|
438
442
|
try {
|
|
439
|
-
let i =
|
|
443
|
+
let i = L.get(t), a = i ? {
|
|
440
444
|
...n,
|
|
441
445
|
$row_version: i
|
|
442
446
|
} : n;
|
|
443
|
-
return await m(e,
|
|
447
|
+
return await m(e, I.get(t) ?? t, a), Y((e) => {
|
|
444
448
|
let n = e[t];
|
|
445
449
|
if (!n) return e;
|
|
446
450
|
if (n.ver > r) return {
|
|
@@ -452,9 +456,9 @@ function Z({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: o, e
|
|
|
452
456
|
};
|
|
453
457
|
let { [t]: i, ...a } = e;
|
|
454
458
|
return a;
|
|
455
|
-
}),
|
|
459
|
+
}), T(), !0;
|
|
456
460
|
} catch (e) {
|
|
457
|
-
let n = h(
|
|
461
|
+
let n = h(O, e);
|
|
458
462
|
return Y((e) => ({
|
|
459
463
|
...e,
|
|
460
464
|
[t]: {
|
|
@@ -466,11 +470,11 @@ function Z({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: o, e
|
|
|
466
470
|
}
|
|
467
471
|
}, [
|
|
468
472
|
e,
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
]),
|
|
473
|
+
O,
|
|
474
|
+
T,
|
|
475
|
+
I,
|
|
476
|
+
L
|
|
477
|
+
]), we = z((e, t, n) => {
|
|
474
478
|
Y((r) => {
|
|
475
479
|
let i = r[e] ?? {
|
|
476
480
|
buffer: {},
|
|
@@ -489,10 +493,10 @@ function Z({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: o, e
|
|
|
489
493
|
}
|
|
490
494
|
};
|
|
491
495
|
}), p === "inline_edit" && (X.current[e] && clearTimeout(X.current[e]), X.current[e] = setTimeout(() => {
|
|
492
|
-
let t =
|
|
493
|
-
t && Object.keys(t.buffer).length > 0 &&
|
|
496
|
+
let t = fe.current[e];
|
|
497
|
+
t && Object.keys(t.buffer).length > 0 && Ce(e, { ...t.buffer }, t.ver);
|
|
494
498
|
}, 500));
|
|
495
|
-
}, [
|
|
499
|
+
}, [Ce, p]), Te = z(() => {
|
|
496
500
|
let e = {};
|
|
497
501
|
e[a] = n;
|
|
498
502
|
for (let n of o) {
|
|
@@ -505,27 +509,27 @@ function Z({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: o, e
|
|
|
505
509
|
n,
|
|
506
510
|
o,
|
|
507
511
|
t.fields
|
|
508
|
-
]),
|
|
509
|
-
|
|
510
|
-
|
|
512
|
+
]), Ee = ae(E);
|
|
513
|
+
B(() => {
|
|
514
|
+
E !== void 0 && E !== Ee.current && (Ee.current = E, !Z && Te());
|
|
511
515
|
}, [
|
|
512
|
-
|
|
516
|
+
E,
|
|
513
517
|
Z,
|
|
514
|
-
|
|
518
|
+
Te
|
|
515
519
|
]);
|
|
516
|
-
let
|
|
520
|
+
let De = z(async () => {
|
|
517
521
|
if (!Z) return;
|
|
518
|
-
let n =
|
|
522
|
+
let n = de(Z, o, t, a);
|
|
519
523
|
if (n.length > 0) $(n);
|
|
520
524
|
else {
|
|
521
|
-
|
|
525
|
+
ye(!0);
|
|
522
526
|
try {
|
|
523
|
-
await u(e, Z), Q(null), $([]),
|
|
527
|
+
await u(e, Z), Q(null), $([]), T();
|
|
524
528
|
} catch (e) {
|
|
525
|
-
let t = h(
|
|
529
|
+
let t = h(O, e);
|
|
526
530
|
$([`_error:${t}`]);
|
|
527
531
|
} finally {
|
|
528
|
-
|
|
532
|
+
ye(!1);
|
|
529
533
|
}
|
|
530
534
|
}
|
|
531
535
|
}, [
|
|
@@ -534,69 +538,73 @@ function Z({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: o, e
|
|
|
534
538
|
t,
|
|
535
539
|
a,
|
|
536
540
|
e,
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
]),
|
|
541
|
+
O,
|
|
542
|
+
T
|
|
543
|
+
]), Oe = z((e) => {
|
|
540
544
|
Y({}), q([]), K(e);
|
|
541
|
-
}, []),
|
|
542
|
-
let n =
|
|
545
|
+
}, []), ke = z(async (e) => {
|
|
546
|
+
let n = fe.current[e], i = n?.buffer ?? {};
|
|
543
547
|
if (Object.keys(i).length === 0) {
|
|
544
548
|
K(null), q([]);
|
|
545
549
|
return;
|
|
546
550
|
}
|
|
547
|
-
let s =
|
|
551
|
+
let s = de({
|
|
548
552
|
..._.find((n) => f(r(t, n)) === e) ?? {},
|
|
549
553
|
...i
|
|
550
554
|
}, o, t, a);
|
|
551
|
-
s.length > 0 ? q(s) : await
|
|
555
|
+
s.length > 0 ? q(s) : await Ce(e, { ...i }, n?.ver ?? 0) && (K(null), q([]));
|
|
552
556
|
}, [
|
|
553
557
|
_,
|
|
554
558
|
t,
|
|
555
559
|
o,
|
|
556
560
|
a,
|
|
557
|
-
|
|
558
|
-
]),
|
|
561
|
+
Ce
|
|
562
|
+
]), Ae = z((e) => {
|
|
559
563
|
Y((t) => {
|
|
560
564
|
if (!t[e]) return t;
|
|
561
565
|
let { [e]: n, ...r } = t;
|
|
562
566
|
return r;
|
|
563
567
|
}), q([]), K(null);
|
|
564
|
-
}, []),
|
|
565
|
-
let i =
|
|
566
|
-
return
|
|
568
|
+
}, []), je = z((n, r) => {
|
|
569
|
+
let i = I.get(n) ?? n;
|
|
570
|
+
return be({
|
|
567
571
|
action: t.actions?.__delete,
|
|
568
572
|
destructive: !0,
|
|
569
|
-
title:
|
|
573
|
+
title: D(t.display?.name) || D("record.action.delete", "Delete"),
|
|
570
574
|
row: r,
|
|
571
575
|
entity: e,
|
|
572
576
|
execute: async () => {
|
|
573
|
-
|
|
577
|
+
Se((e) => new Set(e).add(n));
|
|
574
578
|
try {
|
|
575
579
|
return await d(e, i);
|
|
576
580
|
} finally {
|
|
577
|
-
|
|
581
|
+
Se((e) => {
|
|
578
582
|
let t = new Set(e);
|
|
579
583
|
return t.delete(n), t;
|
|
580
584
|
});
|
|
581
585
|
}
|
|
582
586
|
},
|
|
583
|
-
onSuccess: () =>
|
|
587
|
+
onSuccess: () => T()
|
|
584
588
|
});
|
|
585
589
|
}, [
|
|
586
|
-
|
|
587
|
-
|
|
590
|
+
D,
|
|
591
|
+
be,
|
|
588
592
|
t,
|
|
589
593
|
e,
|
|
590
|
-
|
|
591
|
-
|
|
594
|
+
T,
|
|
595
|
+
I
|
|
592
596
|
]);
|
|
593
|
-
if (
|
|
597
|
+
if (C) return /* @__PURE__ */ G("div", {
|
|
594
598
|
style: {
|
|
595
599
|
fontSize: 12.5,
|
|
596
600
|
color: "var(--danger)",
|
|
597
601
|
padding: "8px 0"
|
|
598
602
|
},
|
|
599
|
-
children:
|
|
603
|
+
children: [
|
|
604
|
+
O("record.related_rows_unreadable", "The related records could not be loaded."),
|
|
605
|
+
" ",
|
|
606
|
+
/* @__PURE__ */ W(x, { onRetry: w })
|
|
607
|
+
]
|
|
600
608
|
});
|
|
601
609
|
if (b) return /* @__PURE__ */ G("div", {
|
|
602
610
|
style: {
|
|
@@ -615,138 +623,138 @@ function Z({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: o, e
|
|
|
615
623
|
borderRadius: "var(--radius-md)"
|
|
616
624
|
} })]
|
|
617
625
|
});
|
|
618
|
-
let
|
|
619
|
-
return
|
|
626
|
+
let Me = _.length === 0 && !Z;
|
|
627
|
+
return k.isPhone && !M ? /* @__PURE__ */ G("div", { children: [Me && /* @__PURE__ */ W("div", {
|
|
620
628
|
style: {
|
|
621
629
|
fontSize: 12.5,
|
|
622
630
|
color: "var(--text-3)",
|
|
623
631
|
padding: "12px 0"
|
|
624
632
|
},
|
|
625
|
-
children:
|
|
626
|
-
}), !
|
|
633
|
+
children: D("record.related.empty", "No records yet.")
|
|
634
|
+
}), !Me && /* @__PURE__ */ G("div", {
|
|
627
635
|
style: {
|
|
628
636
|
display: "flex",
|
|
629
637
|
flexDirection: "column",
|
|
630
638
|
gap: 10
|
|
631
639
|
},
|
|
632
640
|
children: [_.map((n) => {
|
|
633
|
-
let i = f(r(t, n)), a =
|
|
634
|
-
return /* @__PURE__ */ W(
|
|
641
|
+
let i = f(r(t, n)), a = xe.has(i), s = J[i], u = P && i ? P.replace(/:\w+/, i) : void 0;
|
|
642
|
+
return /* @__PURE__ */ W(pe, {
|
|
635
643
|
rowId: i,
|
|
636
644
|
row: n,
|
|
637
645
|
entity: t,
|
|
638
646
|
entities: g.schema.entities,
|
|
639
647
|
screens: g.schema.screens,
|
|
640
648
|
columns: o,
|
|
641
|
-
editableColumns:
|
|
642
|
-
editable: l && c(t, n,
|
|
649
|
+
editableColumns: F,
|
|
650
|
+
editable: l && c(t, n, A.tenantId),
|
|
643
651
|
interaction: p,
|
|
644
|
-
isEditing:
|
|
645
|
-
editErrors:
|
|
652
|
+
isEditing: oe === i,
|
|
653
|
+
editErrors: ce,
|
|
646
654
|
isDeleting: a,
|
|
647
|
-
activeCell:
|
|
655
|
+
activeCell: ie,
|
|
648
656
|
setActiveCell: U,
|
|
649
657
|
rowState: s,
|
|
650
|
-
onCellChange:
|
|
651
|
-
onDeleteClick: (e) => void
|
|
652
|
-
onStartEdit:
|
|
653
|
-
onConfirmEdit:
|
|
654
|
-
onCancelEdit:
|
|
658
|
+
onCellChange: we,
|
|
659
|
+
onDeleteClick: (e) => void je(e, n),
|
|
660
|
+
onStartEdit: Oe,
|
|
661
|
+
onConfirmEdit: ke,
|
|
662
|
+
onCancelEdit: Ae,
|
|
655
663
|
refs: v,
|
|
656
|
-
identityCol:
|
|
664
|
+
identityCol: N,
|
|
657
665
|
href: u,
|
|
658
|
-
rowActions:
|
|
666
|
+
rowActions: R,
|
|
659
667
|
entityCode: e,
|
|
660
|
-
onRowActionSuccess:
|
|
668
|
+
onRowActionSuccess: T
|
|
661
669
|
}, i);
|
|
662
|
-
}), Z && /* @__PURE__ */ W(
|
|
670
|
+
}), Z && /* @__PURE__ */ W(_e, {
|
|
663
671
|
draftRow: Z,
|
|
664
672
|
entity: t,
|
|
665
673
|
columns: o,
|
|
666
|
-
editableColumns:
|
|
674
|
+
editableColumns: re,
|
|
667
675
|
foreignKey: a,
|
|
668
|
-
draftErrors:
|
|
669
|
-
draftSaving:
|
|
676
|
+
draftErrors: he,
|
|
677
|
+
draftSaving: ve,
|
|
670
678
|
onChange: (e, t) => Q((n) => n && {
|
|
671
679
|
...n,
|
|
672
680
|
[e]: t
|
|
673
681
|
}),
|
|
674
|
-
onConfirm:
|
|
682
|
+
onConfirm: De,
|
|
675
683
|
onCancel: () => {
|
|
676
684
|
Q(null), $([]);
|
|
677
685
|
},
|
|
678
686
|
refs: v
|
|
679
687
|
})]
|
|
680
|
-
})] }) : /* @__PURE__ */ G("div", { children: [
|
|
688
|
+
})] }) : /* @__PURE__ */ G("div", { children: [Me && /* @__PURE__ */ W("div", {
|
|
681
689
|
style: {
|
|
682
690
|
fontSize: 12.5,
|
|
683
691
|
color: "var(--text-3)",
|
|
684
692
|
padding: "12px 0"
|
|
685
693
|
},
|
|
686
|
-
children:
|
|
687
|
-
}), !
|
|
694
|
+
children: D("record.related.empty", "No records yet.")
|
|
695
|
+
}), !Me && /* @__PURE__ */ W("div", {
|
|
688
696
|
style: { overflowX: "auto" },
|
|
689
697
|
children: /* @__PURE__ */ G("table", {
|
|
690
|
-
style:
|
|
698
|
+
style: ne,
|
|
691
699
|
children: [/* @__PURE__ */ W("thead", { children: /* @__PURE__ */ G("tr", { children: [
|
|
692
700
|
o.map((e) => {
|
|
693
701
|
let n = t.fields.get(e);
|
|
694
702
|
return /* @__PURE__ */ W("th", {
|
|
695
703
|
style: te,
|
|
696
|
-
children: n ? i(
|
|
704
|
+
children: n ? i(D, n, e, g.schema.entities) : e
|
|
697
705
|
}, e);
|
|
698
706
|
}),
|
|
699
707
|
l && /* @__PURE__ */ W("th", { style: {
|
|
700
708
|
height: 30,
|
|
701
709
|
width: 72
|
|
702
710
|
} }),
|
|
703
|
-
!l &&
|
|
711
|
+
!l && R.length > 0 && /* @__PURE__ */ W("th", { style: {
|
|
704
712
|
height: 30,
|
|
705
713
|
width: 40
|
|
706
714
|
} })
|
|
707
715
|
] }) }), /* @__PURE__ */ G("tbody", { children: [_.map((n) => {
|
|
708
|
-
let i = f(r(t, n)), a =
|
|
709
|
-
return /* @__PURE__ */ W(
|
|
716
|
+
let i = f(r(t, n)), a = xe.has(i), s = J[i], u = P && i ? P.replace(/:\w+/, i) : void 0;
|
|
717
|
+
return /* @__PURE__ */ W(me, {
|
|
710
718
|
rowId: i,
|
|
711
719
|
row: n,
|
|
712
720
|
entity: t,
|
|
713
721
|
entities: g.schema.entities,
|
|
714
722
|
screens: g.schema.screens,
|
|
715
723
|
columns: o,
|
|
716
|
-
editableColumns:
|
|
717
|
-
editable: l && c(t, n,
|
|
724
|
+
editableColumns: F,
|
|
725
|
+
editable: l && c(t, n, A.tenantId),
|
|
718
726
|
interaction: p,
|
|
719
|
-
isEditing:
|
|
720
|
-
editErrors:
|
|
727
|
+
isEditing: oe === i,
|
|
728
|
+
editErrors: ce,
|
|
721
729
|
isDeleting: a,
|
|
722
|
-
activeCell:
|
|
730
|
+
activeCell: ie,
|
|
723
731
|
setActiveCell: U,
|
|
724
732
|
rowState: s,
|
|
725
|
-
onCellChange:
|
|
726
|
-
onDeleteClick: (e) => void
|
|
727
|
-
onStartEdit:
|
|
728
|
-
onConfirmEdit:
|
|
729
|
-
onCancelEdit:
|
|
733
|
+
onCellChange: we,
|
|
734
|
+
onDeleteClick: (e) => void je(e, n),
|
|
735
|
+
onStartEdit: Oe,
|
|
736
|
+
onConfirmEdit: ke,
|
|
737
|
+
onCancelEdit: Ae,
|
|
730
738
|
refs: v,
|
|
731
|
-
identityCol:
|
|
739
|
+
identityCol: N,
|
|
732
740
|
href: u,
|
|
733
|
-
rowActions:
|
|
741
|
+
rowActions: R,
|
|
734
742
|
entityCode: e,
|
|
735
|
-
onRowActionSuccess:
|
|
743
|
+
onRowActionSuccess: T
|
|
736
744
|
}, i);
|
|
737
|
-
}), Z && /* @__PURE__ */ W(
|
|
745
|
+
}), Z && /* @__PURE__ */ W(ge, {
|
|
738
746
|
draftRow: Z,
|
|
739
747
|
entity: t,
|
|
740
748
|
columns: o,
|
|
741
|
-
editableColumns:
|
|
749
|
+
editableColumns: re,
|
|
742
750
|
foreignKey: a,
|
|
743
|
-
draftErrors:
|
|
744
|
-
draftSaving:
|
|
751
|
+
draftErrors: he,
|
|
752
|
+
draftSaving: ve,
|
|
745
753
|
onChange: (e, t) => Q((n) => n && {
|
|
746
754
|
...n,
|
|
747
755
|
[e]: t
|
|
748
756
|
}),
|
|
749
|
-
onConfirm:
|
|
757
|
+
onConfirm: De,
|
|
750
758
|
onCancel: () => {
|
|
751
759
|
Q(null), $([]);
|
|
752
760
|
},
|
|
@@ -755,15 +763,15 @@ function Z({ entityCode: e, entity: t, parentId: n, foreignKey: a, columns: o, e
|
|
|
755
763
|
})
|
|
756
764
|
})] });
|
|
757
765
|
}
|
|
758
|
-
function
|
|
759
|
-
let k = y(),
|
|
766
|
+
function pe({ 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: S, refs: w, identityCol: T, href: E, rowActions: D, onRowActionSuccess: O }) {
|
|
767
|
+
let k = y(), A = ie(), j = V(() => !m || Object.keys(m.buffer).length === 0 ? n : {
|
|
760
768
|
...n,
|
|
761
769
|
...m.buffer
|
|
762
770
|
}, [n, m]);
|
|
763
771
|
if (u === "row_edit" && d) {
|
|
764
772
|
let t = m?.error ? [...f, `_error:${m.error}`] : f;
|
|
765
|
-
return /* @__PURE__ */ W(
|
|
766
|
-
values:
|
|
773
|
+
return /* @__PURE__ */ W(he, {
|
|
774
|
+
values: j,
|
|
767
775
|
entity: r,
|
|
768
776
|
columns: s,
|
|
769
777
|
editableColumns: c,
|
|
@@ -771,7 +779,7 @@ function de({ rowId: e, row: n, entity: r, entities: a, screens: o, columns: s,
|
|
|
771
779
|
saving: m?.saving ?? !1,
|
|
772
780
|
onChange: (t, n) => h(e, t, n),
|
|
773
781
|
onConfirm: () => x(e),
|
|
774
|
-
onCancel: () =>
|
|
782
|
+
onCancel: () => S(e),
|
|
775
783
|
refs: w
|
|
776
784
|
});
|
|
777
785
|
}
|
|
@@ -791,17 +799,17 @@ function de({ rowId: e, row: n, entity: r, entities: a, screens: o, columns: s,
|
|
|
791
799
|
gap: 12
|
|
792
800
|
},
|
|
793
801
|
children: s.map((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 = `${
|
|
802
|
+
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 = `${A}-${e}-${n}`, g = `${m}-label`, _ = {
|
|
795
803
|
fontSize: 11.5,
|
|
796
804
|
fontWeight: 600,
|
|
797
805
|
color: "var(--text-3)"
|
|
798
|
-
}, v = s ?
|
|
806
|
+
}, v = s ? M({
|
|
799
807
|
field: s,
|
|
800
808
|
fieldName: n,
|
|
801
|
-
value:
|
|
809
|
+
value: j[n],
|
|
802
810
|
mode: d ? "edit" : "display",
|
|
803
811
|
onChange: d ? (t) => h(e, n, t) : void 0,
|
|
804
|
-
record:
|
|
812
|
+
record: j,
|
|
805
813
|
refs: w,
|
|
806
814
|
compact: d,
|
|
807
815
|
entity: r,
|
|
@@ -810,7 +818,7 @@ function de({ rowId: e, row: n, entity: r, entities: a, screens: o, columns: s,
|
|
|
810
818
|
fieldId: m,
|
|
811
819
|
labelId: g,
|
|
812
820
|
t: k
|
|
813
|
-
}) : t(
|
|
821
|
+
}) : t(j[n]);
|
|
814
822
|
return /* @__PURE__ */ G("div", {
|
|
815
823
|
style: {
|
|
816
824
|
display: "flex",
|
|
@@ -851,8 +859,8 @@ function de({ rowId: e, row: n, entity: r, entities: a, screens: o, columns: s,
|
|
|
851
859
|
justifyContent: "flex-end",
|
|
852
860
|
gap: 6
|
|
853
861
|
},
|
|
854
|
-
children: [l && /* @__PURE__ */ G(
|
|
855
|
-
m?.saving && /* @__PURE__ */ W(
|
|
862
|
+
children: [l && /* @__PURE__ */ G(oe, { children: [
|
|
863
|
+
m?.saving && /* @__PURE__ */ W(C, { size: 12 }),
|
|
856
864
|
m?.error && /* @__PURE__ */ W("span", {
|
|
857
865
|
style: {
|
|
858
866
|
fontSize: 11,
|
|
@@ -873,75 +881,75 @@ function de({ rowId: e, row: n, entity: r, entities: a, screens: o, columns: s,
|
|
|
873
881
|
onClick: () => _(e),
|
|
874
882
|
title: k("record.row.delete", "Delete row")
|
|
875
883
|
})
|
|
876
|
-
] }), !l && D && D.length > 0 && /* @__PURE__ */ W(
|
|
884
|
+
] }), !l && D && D.length > 0 && /* @__PURE__ */ W(L, {
|
|
877
885
|
entity: r,
|
|
878
886
|
actions: D,
|
|
879
887
|
objectIds: [e],
|
|
880
|
-
row:
|
|
888
|
+
row: j,
|
|
881
889
|
onSuccess: O
|
|
882
890
|
})]
|
|
883
891
|
})]
|
|
884
892
|
});
|
|
885
893
|
}
|
|
886
|
-
function
|
|
887
|
-
let
|
|
894
|
+
function me({ 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: S, onCancelEdit: w, refs: T, identityCol: E, href: D, rowActions: O, onRowActionSuccess: k }) {
|
|
895
|
+
let A = y(), j = V(() => !h || Object.keys(h.buffer).length === 0 ? n : {
|
|
888
896
|
...n,
|
|
889
897
|
...h.buffer
|
|
890
898
|
}, [n, h]);
|
|
891
899
|
if (l === "row_edit" && u) {
|
|
892
900
|
let t = h?.error ? [...d, `_error:${h.error}`] : d;
|
|
893
901
|
return /* @__PURE__ */ W(Q, {
|
|
894
|
-
values:
|
|
902
|
+
values: j,
|
|
895
903
|
entity: r,
|
|
896
904
|
columns: o,
|
|
897
905
|
editableColumns: s,
|
|
898
906
|
errors: t,
|
|
899
907
|
saving: h?.saving ?? !1,
|
|
900
908
|
onChange: (t, n) => _(e, t, n),
|
|
901
|
-
onConfirm: () =>
|
|
909
|
+
onConfirm: () => S(e),
|
|
902
910
|
onCancel: () => w(e),
|
|
903
911
|
refs: T
|
|
904
912
|
});
|
|
905
913
|
}
|
|
906
|
-
let
|
|
914
|
+
let N = F, P = {
|
|
907
915
|
padding: "4px 4px",
|
|
908
916
|
borderBottom: "1px solid var(--divider)",
|
|
909
917
|
verticalAlign: "middle"
|
|
910
|
-
},
|
|
918
|
+
}, ee = l === "inline_edit";
|
|
911
919
|
return /* @__PURE__ */ G("tr", {
|
|
912
920
|
style: { opacity: f ? .5 : 1 },
|
|
913
921
|
children: [
|
|
914
922
|
o.map((n) => {
|
|
915
923
|
let o = r.fields.get(n), c = s.has(n);
|
|
916
|
-
if (
|
|
917
|
-
style:
|
|
918
|
-
children: o ?
|
|
924
|
+
if (ee && p?.rowId === e && p?.col === n && c) return /* @__PURE__ */ W("td", {
|
|
925
|
+
style: P,
|
|
926
|
+
children: o ? M({
|
|
919
927
|
field: o,
|
|
920
928
|
fieldName: n,
|
|
921
|
-
value:
|
|
929
|
+
value: j[n],
|
|
922
930
|
mode: "edit",
|
|
923
931
|
onChange: (t) => _(e, n, t),
|
|
924
|
-
record:
|
|
932
|
+
record: j,
|
|
925
933
|
refs: T,
|
|
926
934
|
compact: !0,
|
|
927
|
-
t:
|
|
928
|
-
}) : t(
|
|
935
|
+
t: A
|
|
936
|
+
}) : t(j[n])
|
|
929
937
|
}, n);
|
|
930
|
-
let l = D && n === E, u = o ?
|
|
938
|
+
let l = D && n === E, u = o ? M({
|
|
931
939
|
field: o,
|
|
932
940
|
fieldName: n,
|
|
933
|
-
value:
|
|
941
|
+
value: j[n],
|
|
934
942
|
mode: "display",
|
|
935
|
-
record:
|
|
943
|
+
record: j,
|
|
936
944
|
refs: T,
|
|
937
945
|
entity: r,
|
|
938
946
|
entities: i,
|
|
939
947
|
screens: l ? void 0 : a,
|
|
940
|
-
t:
|
|
941
|
-
}) : t(
|
|
948
|
+
t: A
|
|
949
|
+
}) : t(j[n]), d = ee && c && !f;
|
|
942
950
|
return /* @__PURE__ */ W("td", {
|
|
943
951
|
style: {
|
|
944
|
-
...
|
|
952
|
+
...N,
|
|
945
953
|
cursor: d ? "pointer" : "default"
|
|
946
954
|
},
|
|
947
955
|
onClick: d ? () => m({
|
|
@@ -974,7 +982,7 @@ function fe({ rowId: e, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
974
982
|
gap: 4
|
|
975
983
|
},
|
|
976
984
|
children: [
|
|
977
|
-
h?.saving && /* @__PURE__ */ W(
|
|
985
|
+
h?.saving && /* @__PURE__ */ W(C, { size: 12 }),
|
|
978
986
|
h?.error && /* @__PURE__ */ W("span", {
|
|
979
987
|
style: {
|
|
980
988
|
fontSize: 11,
|
|
@@ -987,13 +995,13 @@ function fe({ rowId: e, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
987
995
|
size: 24,
|
|
988
996
|
icon: /* @__PURE__ */ W(g.edit, { size: 12 }),
|
|
989
997
|
onClick: () => x(e),
|
|
990
|
-
title:
|
|
998
|
+
title: A("record.row.edit", "Edit row")
|
|
991
999
|
}),
|
|
992
1000
|
/* @__PURE__ */ W(v, {
|
|
993
1001
|
size: 24,
|
|
994
1002
|
icon: /* @__PURE__ */ W(g.trash, { size: 12 }),
|
|
995
1003
|
onClick: () => b(e),
|
|
996
|
-
title:
|
|
1004
|
+
title: A("record.row.delete", "Delete row")
|
|
997
1005
|
})
|
|
998
1006
|
]
|
|
999
1007
|
})
|
|
@@ -1004,11 +1012,11 @@ function fe({ rowId: e, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
1004
1012
|
borderBottom: "1px solid var(--divider)",
|
|
1005
1013
|
verticalAlign: "middle"
|
|
1006
1014
|
},
|
|
1007
|
-
children: /* @__PURE__ */ W(
|
|
1015
|
+
children: /* @__PURE__ */ W(L, {
|
|
1008
1016
|
entity: r,
|
|
1009
1017
|
actions: O,
|
|
1010
1018
|
objectIds: [e],
|
|
1011
|
-
row:
|
|
1019
|
+
row: j,
|
|
1012
1020
|
onSuccess: k
|
|
1013
1021
|
})
|
|
1014
1022
|
})
|
|
@@ -1044,7 +1052,7 @@ function Q({ values: e, entity: n, columns: r, editableColumns: i, errors: a, sa
|
|
|
1044
1052
|
title: c ? f("record.row.field_required", "{field} is required", { field: r }) : void 0,
|
|
1045
1053
|
children: /* @__PURE__ */ W("div", {
|
|
1046
1054
|
style: _,
|
|
1047
|
-
children: a ?
|
|
1055
|
+
children: a ? M({
|
|
1048
1056
|
field: a,
|
|
1049
1057
|
fieldName: r,
|
|
1050
1058
|
value: e[r],
|
|
@@ -1083,7 +1091,7 @@ function Q({ values: e, entity: n, columns: r, editableColumns: i, errors: a, sa
|
|
|
1083
1091
|
}),
|
|
1084
1092
|
/* @__PURE__ */ W(v, {
|
|
1085
1093
|
size: 24,
|
|
1086
|
-
icon: W(o ?
|
|
1094
|
+
icon: W(o ? C : g.check, { size: 12 }),
|
|
1087
1095
|
onClick: c,
|
|
1088
1096
|
title: f("record.row.confirm", "Confirm (Enter)")
|
|
1089
1097
|
}),
|
|
@@ -1098,8 +1106,8 @@ function Q({ values: e, entity: n, columns: r, editableColumns: i, errors: a, sa
|
|
|
1098
1106
|
})]
|
|
1099
1107
|
});
|
|
1100
1108
|
}
|
|
1101
|
-
function
|
|
1102
|
-
let p = y(), m =
|
|
1109
|
+
function he({ values: e, entity: n, columns: r, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
|
|
1110
|
+
let p = y(), m = ie(), h = o.find((e) => e.startsWith("_error:")), _ = new Set(o.filter((e) => !e.startsWith("_error:")));
|
|
1103
1111
|
return /* @__PURE__ */ G("div", {
|
|
1104
1112
|
style: {
|
|
1105
1113
|
border: "1px solid var(--border)",
|
|
@@ -1148,7 +1156,7 @@ function pe({ values: e, entity: n, columns: r, editableColumns: a, errors: o, s
|
|
|
1148
1156
|
borderRadius: l ? "var(--radius-sm)" : 0
|
|
1149
1157
|
},
|
|
1150
1158
|
title: l ? p("record.row.field_required", "{field} is required", { field: r }) : void 0,
|
|
1151
|
-
children: s ? o ?
|
|
1159
|
+
children: s ? o ? M({
|
|
1152
1160
|
field: o,
|
|
1153
1161
|
fieldName: r,
|
|
1154
1162
|
value: e[r],
|
|
@@ -1185,7 +1193,7 @@ function pe({ values: e, entity: n, columns: r, editableColumns: a, errors: o, s
|
|
|
1185
1193
|
}),
|
|
1186
1194
|
/* @__PURE__ */ W(v, {
|
|
1187
1195
|
size: 32,
|
|
1188
|
-
icon: W(s ?
|
|
1196
|
+
icon: W(s ? C : g.check, { size: 14 }),
|
|
1189
1197
|
onClick: l,
|
|
1190
1198
|
title: p("record.row.confirm", "Confirm (Enter)")
|
|
1191
1199
|
}),
|
|
@@ -1199,8 +1207,8 @@ function pe({ values: e, entity: n, columns: r, editableColumns: a, errors: o, s
|
|
|
1199
1207
|
})]
|
|
1200
1208
|
});
|
|
1201
1209
|
}
|
|
1202
|
-
function
|
|
1203
|
-
let d =
|
|
1210
|
+
function ge({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
1211
|
+
let d = V(() => {
|
|
1204
1212
|
let e = new Set(r);
|
|
1205
1213
|
return e.delete(i), e;
|
|
1206
1214
|
}, [r, i]);
|
|
@@ -1218,12 +1226,12 @@ function me({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
|
|
|
1218
1226
|
accent: !0
|
|
1219
1227
|
});
|
|
1220
1228
|
}
|
|
1221
|
-
function
|
|
1222
|
-
let d =
|
|
1229
|
+
function _e({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
1230
|
+
let d = V(() => {
|
|
1223
1231
|
let e = new Set(r);
|
|
1224
1232
|
return e.delete(i), e;
|
|
1225
1233
|
}, [r, i]);
|
|
1226
|
-
return /* @__PURE__ */ W(
|
|
1234
|
+
return /* @__PURE__ */ W(he, {
|
|
1227
1235
|
values: e,
|
|
1228
1236
|
entity: t,
|
|
1229
1237
|
columns: n,
|
|
@@ -1238,4 +1246,4 @@ function he({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
|
|
|
1238
1246
|
});
|
|
1239
1247
|
}
|
|
1240
1248
|
//#endregion
|
|
1241
|
-
export { J as AssociatedBlock,
|
|
1249
|
+
export { J as AssociatedBlock, ue as associatedDraftEditableColumns, le as associatedEditableColumns, q as associatedParentValue, de as findMissingRequiredAssociatedFields, ce as resolveAssociatedForeignKey, se as resolveAssociatedRowActions, K as resolveAssociatedToolbarActions };
|