@declarion/react 0.45.0 → 0.48.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/{DraggableChildrenTable-BDnJK0AU.js → DraggableChildrenTable-p2ZSdwzj.js} +2 -2
- package/dist-lib/{DynamicIcon-DeRpAaXm.js → DynamicIcon-Dc2j-rg_.js} +19 -17
- package/dist-lib/{Grid-CcCveEE7.js → Grid-CjLFAKMZ.js} +2 -2
- package/dist-lib/{LayoutRenderer-BReuhVdX.js → LayoutRenderer-X3p4yfo_.js} +598 -585
- package/dist-lib/{MarkdownRenderer-DPKDFR60.js → MarkdownRenderer-Sb7zcvj0.js} +10 -10
- package/dist-lib/{RefreshControl-KddgOhUG.js → RefreshControl-Cnl9nE0x.js} +268 -238
- package/dist-lib/{SmartDetailPage.impl-D_hMxiHy.js → SmartDetailPage.impl-bb0UNOII.js} +545 -532
- package/dist-lib/{SmartRecordListPage.impl-GIo_mPIJ.js → SmartRecordListPage.impl-BFh8auUZ.js} +171 -158
- package/dist-lib/api/agents.d.ts +47 -18
- package/dist-lib/components/agents/AgentChatPanel.d.ts +7 -1
- package/dist-lib/components/agents/AgentPicker.d.ts +9 -0
- package/dist-lib/components/agents/transcript-runs.d.ts +29 -0
- package/dist-lib/components/file-widgets/host.d.ts +1 -0
- package/dist-lib/components/list/QuickPeek.d.ts +1 -1
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +4 -2
- package/dist-lib/components/pages/list/cardProjection.d.ts +2 -1
- package/dist-lib/components/primitives/Tooltip.d.ts +4 -0
- package/dist-lib/components/shared/ResponsiveActionBar.d.ts +10 -5
- package/dist-lib/components/shared/RowActionsKebab.d.ts +3 -2
- package/dist-lib/components/views/ViewSwitcher.d.ts +2 -1
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useAgentConversation.d.ts +10 -24
- package/dist-lib/hooks/useBrandingChrome.d.ts +11 -0
- package/dist-lib/hooks/useFilters.d.ts +1 -0
- package/dist-lib/hooks/useLongPress.d.ts +29 -0
- package/dist-lib/hooks/useResponsiveMode.d.ts +2 -21
- package/dist-lib/icons.js +1 -1
- package/dist-lib/index.d.ts +10 -3
- package/dist-lib/index.js +3305 -2741
- package/dist-lib/lib/actions.d.ts +13 -5
- package/dist-lib/lib/filter-evaluator.d.ts +16 -0
- package/dist-lib/lib/filters.d.ts +10 -4
- package/dist-lib/lib/longPressGesture.d.ts +55 -0
- package/dist-lib/lib/messages.d.ts +1 -0
- package/dist-lib/lib/page-inset.d.ts +3 -0
- package/dist-lib/lib/variants.d.ts +7 -0
- package/dist-lib/lib/viewport-category.d.ts +44 -0
- package/dist-lib/{registry-DJKp0yaV.js → registry-CWDnxiLJ.js} +1291 -1008
- package/dist-lib/testing.js +10 -10
- package/dist-lib/types/api.d.ts +15 -2
- package/dist-lib/types/schema.d.ts +26 -0
- package/dist-lib/{useCurrentScreen-A3xZDs7U.js → useCurrentScreen-BshVTPVq.js} +1124 -1088
- package/dist-lib/{useProperties-TlltWwLv.js → useProperties-B5p9mIH8.js} +92 -61
- package/dist-lib/{value-CHY7LgZ-.js → value-B1O6QikE.js} +1 -1
- package/dist-lib/vite/index.js +23 -22
- package/package.json +12 -12
- package/dist-lib/components/agents/AgentVisualHints.d.ts +0 -6
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { s as e, t } from "./DynamicIcon-
|
|
2
|
-
import { A as n, At as r, B as i, C as a, Dn as o, E as s, Gt as c, I as l, K as u, Kn as d, L as f, Ln as p, Nn as m, O as h, P as g, Qn as _, R as v, Rn as y, Sn as b, St as x, T as S, Tn as C, Tt as w, U as T, V as E, W as D, X as O, Yn as k, Zn as A, _ as j, _t as M, b as N, bn as P, bt as F, cr as I, d as L, g as
|
|
3
|
-
import { a as
|
|
4
|
-
import { n as
|
|
5
|
-
import { Component as Ne, Suspense as Pe, lazy as Fe, useCallback as
|
|
1
|
+
import { s as e, t } from "./DynamicIcon-Dc2j-rg_.js";
|
|
2
|
+
import { A as n, At as r, B as i, C as a, Dn as o, E as s, Gt as c, I as l, K as u, Kn as d, L as f, Ln as p, Nn as m, O as h, P as g, Qn as _, R as v, Rn as y, Sn as b, St as x, T as S, Tn as C, Tt as w, U as T, V as E, W as D, X as O, Yn as k, Zn as A, _ as j, _t as M, b as N, bn as P, bt as F, cr as I, d as L, g as R, gt as z, i as ee, j as B, jn as te, kt as ne, lr as V, mn as re, or as H, ot as ie, pt as ae, rt as U, st as oe, tr as se, u as ce, ur as W, v as le, vt as ue, wn as de, wt as fe, xn as pe, yt as me, z as he } from "./useCurrentScreen-BshVTPVq.js";
|
|
3
|
+
import { a as ge, c as _e, d as ve, f as ye, i as be, l as xe, n as Se, o as Ce, p as we, r as Te, s as Ee, t as De, u as Oe } from "./value-B1O6QikE.js";
|
|
4
|
+
import { n as ke, r as Ae, t as je } from "./dataTableStyles-vwD1mVOP.js";
|
|
5
|
+
import { Component as Me, Fragment as Ne, Suspense as Pe, lazy as Fe, useCallback as G, useEffect as K, useId as Ie, useLayoutEffect as Le, useMemo as q, useRef as J, useState as Y } from "react";
|
|
6
6
|
import { parsePath as Re, useNavigate as ze } from "react-router";
|
|
7
7
|
import { useInfiniteQuery as Be, useMutation as Ve, useQuery as He, useQueryClient as Ue } from "@tanstack/react-query";
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { create as
|
|
10
|
-
import { clsx as
|
|
11
|
-
import { twMerge as
|
|
8
|
+
import { Fragment as We, jsx as X, jsxs as Z } from "react/jsx-runtime";
|
|
9
|
+
import { create as Ge } from "zustand";
|
|
10
|
+
import { clsx as Ke } from "clsx";
|
|
11
|
+
import { twMerge as qe } from "tailwind-merge";
|
|
12
12
|
//#region src/components/primitives/SectionCard.tsx
|
|
13
|
-
var
|
|
13
|
+
var Je = {
|
|
14
14
|
primary: {
|
|
15
15
|
surface: "var(--surface)",
|
|
16
16
|
shadow: "var(--shadow-xs)"
|
|
@@ -20,8 +20,8 @@ var qe = {
|
|
|
20
20
|
shadow: "none"
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
function
|
|
24
|
-
let [m, h] =
|
|
23
|
+
function Ye({ title: t, subtitle: n, right: r, badge: i, count: a, children: o, footer: s, collapsible: c = !0, defaultOpen: l = !0, icon: u, emphasis: d = "primary", headingLevel: f = 2, padding: p = "16px" }) {
|
|
24
|
+
let [m, h] = Y(l), g = Je[d] ?? Je.primary;
|
|
25
25
|
return /* @__PURE__ */ Z("div", {
|
|
26
26
|
"data-emphasis": d,
|
|
27
27
|
style: {
|
|
@@ -126,7 +126,7 @@ function Je({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
126
126
|
children: i.text
|
|
127
127
|
}),
|
|
128
128
|
r,
|
|
129
|
-
c && /* @__PURE__ */ X(
|
|
129
|
+
c && /* @__PURE__ */ X(V, {
|
|
130
130
|
size: 24,
|
|
131
131
|
icon: X(m ? e.up : e.down, { size: 14 }),
|
|
132
132
|
onClick: () => h((e) => !e),
|
|
@@ -153,7 +153,7 @@ function Je({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
153
153
|
}
|
|
154
154
|
//#endregion
|
|
155
155
|
//#region src/components/primitives/ClassifiedFieldLocked.tsx
|
|
156
|
-
function
|
|
156
|
+
function Xe({ tier: t, tierDef: n, requiredPermission: r, locale: i = "en", variant: a = "value" }) {
|
|
157
157
|
let o = n?.name?.[i] ?? n?.name?.en ?? t, s = r ? `Locked: requires permission "${r}". Ask your administrator to grant it to your role.` : `Locked: ${o} classification — requires explicit grant.`;
|
|
158
158
|
return /* @__PURE__ */ Z("span", {
|
|
159
159
|
title: s,
|
|
@@ -164,7 +164,7 @@ function Ye({ tier: t, tierDef: n, requiredPermission: r, locale: i = "en", vari
|
|
|
164
164
|
}
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region src/stores/preferences.ts
|
|
167
|
-
var
|
|
167
|
+
var Ze = {
|
|
168
168
|
colorScheme: "light",
|
|
169
169
|
accent: "violet",
|
|
170
170
|
density: "compact",
|
|
@@ -176,22 +176,22 @@ var Xe = {
|
|
|
176
176
|
zebra: !0,
|
|
177
177
|
aiSurface: "both",
|
|
178
178
|
toastPosition: "bottom-right"
|
|
179
|
-
},
|
|
179
|
+
}, Qe = ["light", "dark"], $e = [
|
|
180
180
|
"violet",
|
|
181
181
|
"blue",
|
|
182
182
|
"teal",
|
|
183
183
|
"amber",
|
|
184
184
|
"rose"
|
|
185
|
-
],
|
|
185
|
+
], et = [
|
|
186
186
|
"compact",
|
|
187
187
|
"comfortable",
|
|
188
188
|
"cozy"
|
|
189
|
-
],
|
|
189
|
+
], tt = ["wide", "collapsed"], nt = ["top", "bottom"], rt = [
|
|
190
190
|
"command",
|
|
191
191
|
"panel",
|
|
192
192
|
"both",
|
|
193
193
|
"off"
|
|
194
|
-
],
|
|
194
|
+
], it = [
|
|
195
195
|
"top-left",
|
|
196
196
|
"top-center",
|
|
197
197
|
"top-right",
|
|
@@ -199,37 +199,37 @@ var Xe = {
|
|
|
199
199
|
"bottom-center",
|
|
200
200
|
"bottom-right"
|
|
201
201
|
];
|
|
202
|
-
function
|
|
202
|
+
function at(e, t) {
|
|
203
203
|
return typeof t == "string" && e.includes(t) ? t : void 0;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
let t = {}, n =
|
|
205
|
+
function ot(e) {
|
|
206
|
+
let t = {}, n = at(Qe, e.colorScheme);
|
|
207
207
|
n && (t.colorScheme = n);
|
|
208
|
-
let r =
|
|
208
|
+
let r = at($e, e.accent);
|
|
209
209
|
r && (t.accent = r);
|
|
210
|
-
let i =
|
|
210
|
+
let i = at(et, e.density);
|
|
211
211
|
i && (t.density = i);
|
|
212
|
-
let a =
|
|
212
|
+
let a = at(tt, e.sidebar);
|
|
213
213
|
a && (t.sidebar = a);
|
|
214
|
-
let o =
|
|
214
|
+
let o = at(nt, e.tabsPosition);
|
|
215
215
|
o && (t.tabsPosition = o);
|
|
216
|
-
let s =
|
|
216
|
+
let s = at(rt, e.aiSurface);
|
|
217
217
|
s && (t.aiSurface = s);
|
|
218
|
-
let c = it
|
|
218
|
+
let c = at(it, e.toastPosition);
|
|
219
219
|
return c && (t.toastPosition = c), typeof e.tabsMaxOpen == "number" && e.tabsMaxOpen > 0 && (t.tabsMaxOpen = e.tabsMaxOpen), typeof e.radius == "number" && e.radius >= 0 && e.radius <= 32 && (t.radius = e.radius), typeof e.zebra == "boolean" && (t.zebra = e.zebra), typeof e.tabsPersist == "boolean" && (t.tabsPersist = e.tabsPersist), t;
|
|
220
220
|
}
|
|
221
|
-
var
|
|
222
|
-
function
|
|
221
|
+
var st = ["declarion-preferences", "declarion-appearance"];
|
|
222
|
+
function ct() {
|
|
223
223
|
if (!(typeof window > "u")) try {
|
|
224
|
-
for (let e of
|
|
224
|
+
for (let e of st) localStorage.removeItem(e);
|
|
225
225
|
} catch {}
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function lt(e) {
|
|
228
228
|
if (typeof document > "u") return;
|
|
229
229
|
let t = document.documentElement;
|
|
230
230
|
t.dataset.colorScheme = e.colorScheme, t.dataset.accent = e.accent, t.dataset.density = e.density, t.dataset.sidebar = e.sidebar, t.dataset.tabbar = e.tabsPosition, t.dataset.zebra = e.zebra ? "on" : "off", t.dataset.ai = e.aiSurface, t.style.setProperty("--radius-md", `${e.radius}px`), t.style.setProperty("--radius-lg", `${e.radius + 3}px`);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function ut(e) {
|
|
233
233
|
return {
|
|
234
234
|
colorScheme: e.color_scheme,
|
|
235
235
|
accent: e.accent,
|
|
@@ -244,70 +244,70 @@ function lt(e) {
|
|
|
244
244
|
toastPosition: e.toast_position
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
|
-
|
|
248
|
-
var
|
|
249
|
-
typeof window < "u" &&
|
|
250
|
-
var
|
|
251
|
-
...
|
|
247
|
+
ct();
|
|
248
|
+
var dt = /* @__PURE__ */ new Set(), ft = { ...Ze };
|
|
249
|
+
typeof window < "u" && lt(ft);
|
|
250
|
+
var pt = Ge((e, t) => ({
|
|
251
|
+
...ft,
|
|
252
252
|
set: (n, r) => {
|
|
253
|
-
let i =
|
|
254
|
-
i[n] !== void 0 && (
|
|
253
|
+
let i = ot({ [n]: r });
|
|
254
|
+
i[n] !== void 0 && (lt({
|
|
255
255
|
...t(),
|
|
256
256
|
...i
|
|
257
|
-
}),
|
|
257
|
+
}), dt.add(n), e(i));
|
|
258
258
|
},
|
|
259
259
|
setMany: (n) => {
|
|
260
|
-
let r =
|
|
260
|
+
let r = ot(n);
|
|
261
261
|
if (Object.keys(r).length) {
|
|
262
|
-
|
|
262
|
+
lt({
|
|
263
263
|
...t(),
|
|
264
264
|
...r
|
|
265
265
|
});
|
|
266
|
-
for (let e of Object.keys(r))
|
|
266
|
+
for (let e of Object.keys(r)) dt.add(e);
|
|
267
267
|
e(r);
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
270
|
hydrateFromBranding: (t) => {
|
|
271
271
|
if (!t) return;
|
|
272
|
-
let n =
|
|
273
|
-
for (let [e, t] of Object.entries(n))
|
|
274
|
-
let i =
|
|
275
|
-
Object.keys(i).length && (
|
|
276
|
-
...
|
|
272
|
+
let n = ut(t), r = {};
|
|
273
|
+
for (let [e, t] of Object.entries(n)) dt.has(e) || t !== void 0 && (r[e] = t);
|
|
274
|
+
let i = ot(r);
|
|
275
|
+
Object.keys(i).length && (lt({
|
|
276
|
+
...pt.getState(),
|
|
277
277
|
...i
|
|
278
278
|
}), e(i));
|
|
279
279
|
},
|
|
280
280
|
resetToDefaults: (t) => {
|
|
281
|
-
|
|
282
|
-
let n = t ?
|
|
283
|
-
...
|
|
281
|
+
dt.clear(), ct();
|
|
282
|
+
let n = t ? ot(ut(t)) : {}, r = {
|
|
283
|
+
...Ze,
|
|
284
284
|
...n
|
|
285
285
|
};
|
|
286
|
-
|
|
286
|
+
lt(r), e(r);
|
|
287
287
|
}
|
|
288
|
-
})),
|
|
289
|
-
function mt(e) {
|
|
290
|
-
return pt.includes(e);
|
|
291
|
-
}
|
|
288
|
+
})), mt = ["/login", "/signup"];
|
|
292
289
|
function ht(e) {
|
|
293
|
-
return
|
|
290
|
+
return mt.includes(e);
|
|
294
291
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return typeof e == "string" && e.length <= gt;
|
|
292
|
+
function gt(e) {
|
|
293
|
+
return typeof e == "string" && e.startsWith("/") && !e.startsWith("//");
|
|
298
294
|
}
|
|
295
|
+
var _t = 4096;
|
|
299
296
|
function vt(e) {
|
|
297
|
+
return typeof e == "string" && e.length <= _t;
|
|
298
|
+
}
|
|
299
|
+
function yt(e) {
|
|
300
300
|
if (e === null) return null;
|
|
301
301
|
if (e === void 0 || typeof e != "object" || Array.isArray(e)) return;
|
|
302
302
|
let t = e;
|
|
303
|
-
if (!
|
|
303
|
+
if (!gt(t.pathname) || t.pathname.length > _t || t.pathname.includes("?") || t.pathname.includes("#")) return;
|
|
304
304
|
let n = { pathname: t.pathname };
|
|
305
305
|
if (t.search !== void 0) {
|
|
306
|
-
if (!
|
|
306
|
+
if (!vt(t.search) || t.search.startsWith("?")) return;
|
|
307
307
|
t.search && (n.search = t.search);
|
|
308
308
|
}
|
|
309
309
|
if (t.hash !== void 0) {
|
|
310
|
-
if (!
|
|
310
|
+
if (!vt(t.hash) || t.hash && !t.hash.startsWith("#")) return;
|
|
311
311
|
t.hash && (n.hash = t.hash);
|
|
312
312
|
}
|
|
313
313
|
for (let e of [
|
|
@@ -316,29 +316,29 @@ function vt(e) {
|
|
|
316
316
|
"icon",
|
|
317
317
|
"screen"
|
|
318
318
|
]) if (t[e] !== void 0) {
|
|
319
|
-
if (!
|
|
319
|
+
if (!vt(t[e])) return;
|
|
320
320
|
t[e] && (n[e] = t[e]);
|
|
321
321
|
}
|
|
322
322
|
return n;
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function bt(e) {
|
|
325
325
|
return e.closable !== !1;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
if (n === "all") return e.filter(
|
|
327
|
+
function xt(e, t, n, r) {
|
|
328
|
+
if (n === "all") return e.filter(bt).map((e) => e.id);
|
|
329
329
|
let i = r ?? t;
|
|
330
330
|
if (!i) return [];
|
|
331
331
|
let a = e.findIndex((e) => e.id === i);
|
|
332
|
-
return a === -1 ? [] : n === "current" ?
|
|
332
|
+
return a === -1 ? [] : n === "current" ? bt(e[a]) ? [e[a].id] : [] : n === "others" ? e.filter((e, t) => t !== a && bt(e)).map((e) => e.id) : e.slice(a + 1).filter(bt).map((e) => e.id);
|
|
333
333
|
}
|
|
334
|
-
var
|
|
335
|
-
function
|
|
334
|
+
var St = null, Ct = null;
|
|
335
|
+
function wt(e, t) {
|
|
336
336
|
return `declarion::${e}::${t}::tabs`;
|
|
337
337
|
}
|
|
338
|
-
function
|
|
339
|
-
return !
|
|
338
|
+
function Tt() {
|
|
339
|
+
return !St || !Ct ? null : wt(St, Ct);
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function Et(e) {
|
|
342
342
|
let t;
|
|
343
343
|
try {
|
|
344
344
|
t = JSON.parse(e);
|
|
@@ -349,7 +349,7 @@ function Tt(e) {
|
|
|
349
349
|
let n = t;
|
|
350
350
|
return Array.isArray(n.tabs) ? {
|
|
351
351
|
tabs: n.tabs.filter((e) => typeof e == "object" && !!e && typeof e.id == "string" && typeof e.pathname == "string").map((e) => {
|
|
352
|
-
let t =
|
|
352
|
+
let t = yt(e.returnTo);
|
|
353
353
|
if (t === void 0) {
|
|
354
354
|
let { returnTo: t, ...n } = e;
|
|
355
355
|
return n;
|
|
@@ -362,22 +362,22 @@ function Tt(e) {
|
|
|
362
362
|
activeTabId: typeof n.activeTabId == "string" ? n.activeTabId : null
|
|
363
363
|
} : null;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function Dt(e, t) {
|
|
366
366
|
if (typeof window > "u") return null;
|
|
367
|
-
let n = localStorage.getItem(
|
|
367
|
+
let n = localStorage.getItem(wt(e, t));
|
|
368
368
|
if (!n) return null;
|
|
369
|
-
let r =
|
|
369
|
+
let r = Et(n);
|
|
370
370
|
if (!r) return null;
|
|
371
371
|
let i = r.tabs.find((e) => e.id === r.activeTabId), a = i?.pathname;
|
|
372
|
-
if (
|
|
372
|
+
if (gt(a)) {
|
|
373
373
|
let e = typeof i?.search == "string" ? i.search : "", t = e.startsWith("?") ? e.slice(1) : e;
|
|
374
374
|
return t ? `${a}?${t}` : a;
|
|
375
375
|
}
|
|
376
376
|
return null;
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function Ot(e, t) {
|
|
379
379
|
if (typeof window > "u") return;
|
|
380
|
-
let n =
|
|
380
|
+
let n = pt.getState().tabsPersist, r = Tt();
|
|
381
381
|
if (r) {
|
|
382
382
|
if (!n) {
|
|
383
383
|
try {
|
|
@@ -393,24 +393,24 @@ function Dt(e, t) {
|
|
|
393
393
|
} catch {}
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
function
|
|
397
|
-
if (typeof window > "u" || !
|
|
398
|
-
let e =
|
|
396
|
+
function kt() {
|
|
397
|
+
if (typeof window > "u" || !pt.getState().tabsPersist) return null;
|
|
398
|
+
let e = Tt();
|
|
399
399
|
if (!e) return null;
|
|
400
400
|
let t = localStorage.getItem(e);
|
|
401
|
-
return t ?
|
|
401
|
+
return t ? Et(t) : null;
|
|
402
402
|
}
|
|
403
|
-
var
|
|
403
|
+
var At = Ge((e, t) => ({
|
|
404
404
|
tabs: [],
|
|
405
405
|
activeTabId: null,
|
|
406
406
|
openTab: (n) => {
|
|
407
|
-
if (
|
|
407
|
+
if (ht(n.pathname)) return "";
|
|
408
408
|
let r = t(), i = r.tabs.find((e) => e.pathname === n.pathname);
|
|
409
|
-
if (i) return e({ activeTabId: i.id }),
|
|
409
|
+
if (i) return e({ activeTabId: i.id }), Ot(r.tabs, i.id), i.id;
|
|
410
410
|
let a = crypto.randomUUID(), o = {
|
|
411
411
|
...n,
|
|
412
412
|
id: a
|
|
413
|
-
}, s = [...r.tabs, o], c =
|
|
413
|
+
}, s = [...r.tabs, o], c = pt.getState().tabsMaxOpen;
|
|
414
414
|
if (c > 0 && s.length > c) {
|
|
415
415
|
let e = s.findIndex((e) => e.id !== a && e.closable !== !1 && !e.dirty);
|
|
416
416
|
e !== -1 && (s = s.filter((t, n) => n !== e));
|
|
@@ -418,7 +418,7 @@ var kt = We((e, t) => ({
|
|
|
418
418
|
return e({
|
|
419
419
|
tabs: s,
|
|
420
420
|
activeTabId: a
|
|
421
|
-
}),
|
|
421
|
+
}), Ot(s, a), a;
|
|
422
422
|
},
|
|
423
423
|
closeTab: (e) => {
|
|
424
424
|
let n = t(), r = n.tabs.findIndex((t) => t.id === e);
|
|
@@ -427,14 +427,14 @@ var kt = We((e, t) => ({
|
|
|
427
427
|
closeTabs: (n) => {
|
|
428
428
|
let r = t(), i = new Set(n);
|
|
429
429
|
if (i.size === 0) return r.tabs.find((e) => e.id === r.activeTabId) ?? null;
|
|
430
|
-
let a = r.tabs.findIndex((e) => e.id === r.activeTabId), o = r.tabs.filter((e) => !(i.has(e.id) &&
|
|
430
|
+
let a = r.tabs.findIndex((e) => e.id === r.activeTabId), o = r.tabs.filter((e) => !(i.has(e.id) && bt(e))), s = r.activeTabId;
|
|
431
431
|
return s && !o.some((e) => e.id === s) ? s = o.length === 0 ? null : o[Math.min(Math.max(a, 0), o.length - 1)].id : o.length === 0 && (s = null), e({
|
|
432
432
|
tabs: o,
|
|
433
433
|
activeTabId: s
|
|
434
|
-
}),
|
|
434
|
+
}), Ot(o, s), o.find((e) => e.id === s) ?? null;
|
|
435
435
|
},
|
|
436
436
|
switchTab: (n) => {
|
|
437
|
-
e({ activeTabId: n }),
|
|
437
|
+
e({ activeTabId: n }), Ot(t().tabs, n);
|
|
438
438
|
},
|
|
439
439
|
reorderTabs: (t, n) => {
|
|
440
440
|
e((e) => {
|
|
@@ -461,7 +461,7 @@ var kt = We((e, t) => ({
|
|
|
461
461
|
e((e) => ({ tabs: e.tabs.map((e) => e.id === n ? {
|
|
462
462
|
...e,
|
|
463
463
|
returnTo: r
|
|
464
|
-
} : e) })),
|
|
464
|
+
} : e) })), Ot(t().tabs, t().activeTabId);
|
|
465
465
|
},
|
|
466
466
|
commitTabNavigation: (n, r) => {
|
|
467
467
|
let i = "returnTo" in r;
|
|
@@ -472,37 +472,37 @@ var kt = We((e, t) => ({
|
|
|
472
472
|
...i ? { returnTo: r.returnTo } : {}
|
|
473
473
|
} : e),
|
|
474
474
|
activeTabId: n
|
|
475
|
-
})),
|
|
475
|
+
})), Ot(t().tabs, t().activeTabId);
|
|
476
476
|
},
|
|
477
477
|
setDirty: (n, r) => {
|
|
478
478
|
e((e) => ({ tabs: e.tabs.map((e) => e.id === n ? {
|
|
479
479
|
...e,
|
|
480
480
|
dirty: r
|
|
481
|
-
} : e) })),
|
|
481
|
+
} : e) })), Ot(t().tabs, t().activeTabId);
|
|
482
482
|
},
|
|
483
483
|
setMode: (n, r) => {
|
|
484
484
|
e((e) => ({ tabs: e.tabs.map((e) => e.id === n ? {
|
|
485
485
|
...e,
|
|
486
486
|
mode: r
|
|
487
|
-
} : e) })),
|
|
487
|
+
} : e) })), Ot(t().tabs, t().activeTabId);
|
|
488
488
|
},
|
|
489
489
|
updateTab: (n, r) => {
|
|
490
490
|
e((e) => ({ tabs: e.tabs.map((e) => e.id === n ? {
|
|
491
491
|
...e,
|
|
492
492
|
...r
|
|
493
|
-
} : e) })),
|
|
493
|
+
} : e) })), Ot(t().tabs, t().activeTabId);
|
|
494
494
|
},
|
|
495
495
|
setScope: (e, t) => {
|
|
496
|
-
|
|
496
|
+
St = e, Ct = t;
|
|
497
497
|
},
|
|
498
498
|
hydrate: () => {
|
|
499
|
-
let t =
|
|
499
|
+
let t = kt();
|
|
500
500
|
t && e({
|
|
501
501
|
tabs: t.tabs,
|
|
502
502
|
activeTabId: t.activeTabId
|
|
503
503
|
});
|
|
504
504
|
}
|
|
505
|
-
})),
|
|
505
|
+
})), jt = Ge((e) => ({
|
|
506
506
|
depth: 0,
|
|
507
507
|
nextIsRoot: !1,
|
|
508
508
|
applyNavigation: (t) => e((e) => e.nextIsRoot ? {
|
|
@@ -517,33 +517,33 @@ var kt = We((e, t) => ({
|
|
|
517
517
|
}));
|
|
518
518
|
//#endregion
|
|
519
519
|
//#region src/lib/utils.ts
|
|
520
|
-
function
|
|
521
|
-
return Ke(
|
|
520
|
+
function Mt(...e) {
|
|
521
|
+
return qe(Ke(e));
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function Nt(e) {
|
|
524
524
|
return e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0;
|
|
525
525
|
}
|
|
526
526
|
//#endregion
|
|
527
527
|
//#region src/lib/screen-back.ts
|
|
528
|
-
function
|
|
528
|
+
function Pt(e) {
|
|
529
529
|
return e ? e.startsWith("?") ? e.slice(1) : e : "";
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function Ft(e) {
|
|
532
532
|
if (e) return e.startsWith("?") ? e : `?${e}`;
|
|
533
533
|
}
|
|
534
|
-
function
|
|
535
|
-
if (!
|
|
536
|
-
let r =
|
|
534
|
+
function It(e, t, n) {
|
|
535
|
+
if (!gt(e.pathname) || ht(e.pathname) || e.pathname === t) return;
|
|
536
|
+
let r = Pt(e.search), i = { pathname: e.pathname };
|
|
537
537
|
return r && (i.search = r), e.hash && (i.hash = e.hash), n?.id && (i.tabId = n.id), n?.title && (i.title = n.title), n?.icon && (i.icon = n.icon), n?.screen && (i.screen = n.screen), i;
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function Lt(e, t) {
|
|
540
540
|
return t ? {
|
|
541
541
|
hasOriginBack: !1,
|
|
542
542
|
allowFallbackBack: !0
|
|
543
543
|
} : e === null ? {
|
|
544
544
|
hasOriginBack: !1,
|
|
545
545
|
allowFallbackBack: !1
|
|
546
|
-
} : e &&
|
|
546
|
+
} : e && gt(e.pathname) ? {
|
|
547
547
|
hasOriginBack: !0,
|
|
548
548
|
allowFallbackBack: !0
|
|
549
549
|
} : {
|
|
@@ -551,8 +551,8 @@ function It(e, t) {
|
|
|
551
551
|
allowFallbackBack: !0
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
|
-
function
|
|
555
|
-
if (n || !e || !
|
|
554
|
+
function Rt(e, t, n) {
|
|
555
|
+
if (n || !e || !gt(e.pathname)) return null;
|
|
556
556
|
let r = (e.tabId ? t.find((t) => t.id === e.tabId) : void 0) ?? t.find((t) => t.pathname === e.pathname);
|
|
557
557
|
return {
|
|
558
558
|
kind: r ? "live" : "reopen",
|
|
@@ -567,26 +567,26 @@ function Lt(e, t, n) {
|
|
|
567
567
|
}
|
|
568
568
|
//#endregion
|
|
569
569
|
//#region src/hooks/useTabNavigate.ts
|
|
570
|
-
function
|
|
570
|
+
function zt(e, t) {
|
|
571
571
|
let n = Re(e);
|
|
572
572
|
return {
|
|
573
573
|
pathname: n.pathname ?? e,
|
|
574
|
-
search:
|
|
574
|
+
search: Bt(n.search) ?? Bt(t),
|
|
575
575
|
hash: n.hash
|
|
576
576
|
};
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function Bt(e) {
|
|
579
579
|
if (!(!e || e === "?")) return e.startsWith("?") ? e : `?${e}`;
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
let e = ze(), { data: t } = r(), n =
|
|
583
|
-
return
|
|
584
|
-
let { pathname: o, search: s, hash: c } =
|
|
581
|
+
function Vt() {
|
|
582
|
+
let e = ze(), { data: t } = r(), n = ae(), i = oe();
|
|
583
|
+
return G((r, a) => {
|
|
584
|
+
let { pathname: o, search: s, hash: c } = zt(r, a?.search);
|
|
585
585
|
if (n.enabled) {
|
|
586
586
|
i(`${o}${s ?? ""}${c ?? ""}`, { replace: a?.replace });
|
|
587
587
|
return;
|
|
588
588
|
}
|
|
589
|
-
let l =
|
|
589
|
+
let l = At.getState(), u = a?.topLevel ?? !1, d = Pt(s), f = u || typeof window > "u" ? void 0 : It({
|
|
590
590
|
pathname: window.location.pathname,
|
|
591
591
|
search: window.location.search,
|
|
592
592
|
hash: window.location.hash
|
|
@@ -636,49 +636,57 @@ function Bt() {
|
|
|
636
636
|
]);
|
|
637
637
|
}
|
|
638
638
|
//#endregion
|
|
639
|
+
//#region src/lib/page-inset.ts
|
|
640
|
+
function Ht(e) {
|
|
641
|
+
return {
|
|
642
|
+
paddingLeft: `calc(${e}px + var(--safe-area-left))`,
|
|
643
|
+
paddingRight: `calc(${e}px + var(--safe-area-right))`
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
//#endregion
|
|
639
647
|
//#region src/components/file-widgets/registry.ts
|
|
640
|
-
var
|
|
641
|
-
function
|
|
642
|
-
|
|
648
|
+
var Ut = /* @__PURE__ */ new Map();
|
|
649
|
+
function Wt(e, t) {
|
|
650
|
+
Ut.set(e, t);
|
|
643
651
|
}
|
|
644
|
-
function
|
|
645
|
-
return
|
|
652
|
+
function Gt(e) {
|
|
653
|
+
return Ut.get(e);
|
|
646
654
|
}
|
|
647
|
-
function
|
|
648
|
-
return
|
|
655
|
+
function Kt(e) {
|
|
656
|
+
return Ut.has(e);
|
|
649
657
|
}
|
|
650
658
|
//#endregion
|
|
651
659
|
//#region src/components/file-widgets/cropper.ts
|
|
652
|
-
var
|
|
660
|
+
var qt = ({ file: e }) => Promise.resolve({
|
|
653
661
|
blob: e,
|
|
654
662
|
filename: e.name
|
|
655
|
-
}),
|
|
656
|
-
function
|
|
657
|
-
|
|
663
|
+
}), Jt = qt;
|
|
664
|
+
function Yt(e) {
|
|
665
|
+
Jt = e ?? qt;
|
|
658
666
|
}
|
|
659
|
-
function
|
|
660
|
-
return
|
|
667
|
+
function Xt() {
|
|
668
|
+
return Jt;
|
|
661
669
|
}
|
|
662
670
|
//#endregion
|
|
663
671
|
//#region src/components/file-widgets/ImageWidget.tsx
|
|
664
|
-
function
|
|
665
|
-
return
|
|
672
|
+
function Zt(e, t) {
|
|
673
|
+
return _e(e, t);
|
|
666
674
|
}
|
|
667
|
-
function
|
|
675
|
+
function Qt(e) {
|
|
668
676
|
let t = e.trim().split(/\s+/).filter(Boolean);
|
|
669
677
|
return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[1][0]).toUpperCase();
|
|
670
678
|
}
|
|
671
|
-
function
|
|
672
|
-
let { field: t, fieldName: n, value: r, onChange: a, mode: o, alt: s, disabled: c, visual: u, uploadFieldCode: d, uploadSlotCode: p } = e, m =
|
|
673
|
-
|
|
679
|
+
function $t(e) {
|
|
680
|
+
let { field: t, fieldName: n, value: r, onChange: a, mode: o, alt: s, disabled: c, visual: u, uploadFieldCode: d, uploadSlotCode: p } = e, m = Se(r), [h, _] = Y("idle"), [v, y] = Y(null), [b, x] = Y(null), [S, C] = Y(null), [w, T] = Y(!1), E = J(null), D = J(!1), O = J(null), { register: k, unregister: A, isDraft: j } = g();
|
|
681
|
+
K(() => () => {
|
|
674
682
|
E.current && E.current.abort();
|
|
675
683
|
}, []);
|
|
676
|
-
let M =
|
|
684
|
+
let M = q(() => ye(m, s, t.display?.placeholder || n), [
|
|
677
685
|
s,
|
|
678
686
|
t.display?.placeholder,
|
|
679
687
|
n,
|
|
680
688
|
m
|
|
681
|
-
]), N = (t.accepts ?? ["image/*"]).join(","), P =
|
|
689
|
+
]), N = (t.accepts ?? ["image/*"]).join(","), P = G(async (r) => {
|
|
682
690
|
let o = i(r, t.accepts, t.max_size_bytes);
|
|
683
691
|
if (o) {
|
|
684
692
|
x(o), _("error");
|
|
@@ -686,9 +694,9 @@ function Zt(e) {
|
|
|
686
694
|
}
|
|
687
695
|
let s = r;
|
|
688
696
|
if (t.display?.crop_on_upload) try {
|
|
689
|
-
let { blob: e, filename: n } = await
|
|
697
|
+
let { blob: e, filename: n } = await Xt()({
|
|
690
698
|
file: r,
|
|
691
|
-
aspectRatio:
|
|
699
|
+
aspectRatio: rn(t.display.aspect_ratio)
|
|
692
700
|
});
|
|
693
701
|
s = new File([e], n, { type: e.type || r.type });
|
|
694
702
|
} catch (e) {
|
|
@@ -706,7 +714,7 @@ function Zt(e) {
|
|
|
706
714
|
let c = new AbortController();
|
|
707
715
|
E.current = c;
|
|
708
716
|
try {
|
|
709
|
-
let r = await
|
|
717
|
+
let r = await he({
|
|
710
718
|
file: s,
|
|
711
719
|
entityCode: e.entityCode,
|
|
712
720
|
fieldCode: d ?? n,
|
|
@@ -757,13 +765,13 @@ function Zt(e) {
|
|
|
757
765
|
A,
|
|
758
766
|
d,
|
|
759
767
|
p
|
|
760
|
-
]), F =
|
|
768
|
+
]), F = G(() => {
|
|
761
769
|
h === "uploading" && E.current && (D.current = !0, E.current.abort(), E.current = null, _("idle"), y(null)), S && (f(S).catch(() => {}), A(S), C(null));
|
|
762
770
|
}, [
|
|
763
771
|
h,
|
|
764
772
|
S,
|
|
765
773
|
A
|
|
766
|
-
]), I =
|
|
774
|
+
]), I = G(() => {
|
|
767
775
|
m && j(m.id) && (f(m.id).catch(() => {}), A(m.id), C(null)), a?.(t.mode === "array" ? [] : null);
|
|
768
776
|
}, [
|
|
769
777
|
m,
|
|
@@ -771,30 +779,30 @@ function Zt(e) {
|
|
|
771
779
|
j,
|
|
772
780
|
a,
|
|
773
781
|
A
|
|
774
|
-
]), L =
|
|
782
|
+
]), L = G(() => {
|
|
775
783
|
x(null), _("idle"), O.current?.click();
|
|
776
|
-
}, []),
|
|
784
|
+
}, []), R = G(() => {
|
|
777
785
|
c || O.current?.click();
|
|
778
|
-
}, [c]),
|
|
779
|
-
c || (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
780
|
-
}, [c,
|
|
786
|
+
}, [c]), z = G((e) => {
|
|
787
|
+
c || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), R());
|
|
788
|
+
}, [c, R]), ee = G((e) => {
|
|
781
789
|
c || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
|
|
782
|
-
}, [c]),
|
|
790
|
+
}, [c]), B = G((e) => {
|
|
783
791
|
if (c) return;
|
|
784
792
|
e.preventDefault();
|
|
785
793
|
let t = e.dataTransfer.files?.[0];
|
|
786
794
|
t && P(t);
|
|
787
|
-
}, [c, P]),
|
|
795
|
+
}, [c, P]), te = G((e) => {
|
|
788
796
|
let t = e.target.files?.[0];
|
|
789
797
|
e.target.value = "", t && P(t);
|
|
790
|
-
}, [P]),
|
|
791
|
-
aspectRatio:
|
|
798
|
+
}, [P]), ne = u.aspectRatio ?? nn(u.shape, t.display?.aspect_ratio), V = ve(m), re = {
|
|
799
|
+
aspectRatio: ne,
|
|
792
800
|
width: u.width ?? (u.shape === "wide" ? "100%" : "120px")
|
|
793
|
-
},
|
|
801
|
+
}, H = !!m, ie = Zt(m, t.display?.listable_thumbnail), ae = xe(m, t.display?.listable_thumbnail), U = be(m?.id, ae, ie), oe = o === "display", se = G((e) => {
|
|
794
802
|
e.stopPropagation(), T((e) => !e);
|
|
795
|
-
}, []),
|
|
803
|
+
}, []), ce = G((e) => {
|
|
796
804
|
if (!m || !w) return;
|
|
797
|
-
let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5, i = n.height > 0 ? (e.clientY - n.top) / n.height : .5, o =
|
|
805
|
+
let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5, i = n.height > 0 ? (e.clientY - n.top) / n.height : .5, o = we(m, {
|
|
798
806
|
x: Math.max(0, Math.min(1, r)),
|
|
799
807
|
y: Math.max(0, Math.min(1, i))
|
|
800
808
|
});
|
|
@@ -805,69 +813,69 @@ function Zt(e) {
|
|
|
805
813
|
w,
|
|
806
814
|
a
|
|
807
815
|
]);
|
|
808
|
-
return
|
|
809
|
-
className:
|
|
810
|
-
style:
|
|
816
|
+
return oe ? /* @__PURE__ */ X("div", {
|
|
817
|
+
className: en(u.shape, !1),
|
|
818
|
+
style: re,
|
|
811
819
|
"aria-label": M,
|
|
812
|
-
children:
|
|
813
|
-
src:
|
|
820
|
+
children: H && U ? /* @__PURE__ */ X("img", {
|
|
821
|
+
src: U,
|
|
814
822
|
alt: M,
|
|
815
|
-
className:
|
|
816
|
-
style: { objectPosition:
|
|
823
|
+
className: tn(u.shape),
|
|
824
|
+
style: { objectPosition: Ee(V) },
|
|
817
825
|
loading: "lazy"
|
|
818
|
-
}) : /* @__PURE__ */ X(
|
|
826
|
+
}) : /* @__PURE__ */ X(an, {
|
|
819
827
|
shape: u.shape,
|
|
820
828
|
label: M,
|
|
821
829
|
placeholder: t.display?.placeholder
|
|
822
830
|
})
|
|
823
831
|
}) : /* @__PURE__ */ Z("div", {
|
|
824
|
-
className:
|
|
825
|
-
style:
|
|
832
|
+
className: en(u.shape, !c),
|
|
833
|
+
style: re,
|
|
826
834
|
tabIndex: c ? -1 : 0,
|
|
827
835
|
role: "button",
|
|
828
836
|
"aria-label": M,
|
|
829
837
|
"aria-disabled": c || void 0,
|
|
830
838
|
"aria-busy": h === "uploading" || void 0,
|
|
831
839
|
"aria-invalid": h === "error" || void 0,
|
|
832
|
-
onClick: h === "idle" && !
|
|
833
|
-
onMouseDown: w ?
|
|
834
|
-
onKeyDown:
|
|
835
|
-
onDragOver:
|
|
836
|
-
onDrop:
|
|
840
|
+
onClick: h === "idle" && !H ? R : void 0,
|
|
841
|
+
onMouseDown: w ? ce : void 0,
|
|
842
|
+
onKeyDown: z,
|
|
843
|
+
onDragOver: ee,
|
|
844
|
+
onDrop: B,
|
|
837
845
|
"data-testid": w ? "focal-point-target" : `file-widget-${n}`,
|
|
838
846
|
children: [
|
|
839
847
|
/* @__PURE__ */ X("input", {
|
|
840
848
|
ref: O,
|
|
841
849
|
type: "file",
|
|
842
850
|
accept: N,
|
|
843
|
-
onChange:
|
|
851
|
+
onChange: te,
|
|
844
852
|
style: { display: "none" },
|
|
845
853
|
"data-testid": `file-input-${n}`
|
|
846
854
|
}),
|
|
847
|
-
|
|
848
|
-
src:
|
|
855
|
+
H && U ? /* @__PURE__ */ X("img", {
|
|
856
|
+
src: U,
|
|
849
857
|
alt: M,
|
|
850
|
-
className:
|
|
851
|
-
style: { objectPosition:
|
|
858
|
+
className: tn(u.shape),
|
|
859
|
+
style: { objectPosition: Ee(V) },
|
|
852
860
|
loading: "lazy"
|
|
853
|
-
}) : h === "uploading" ? null : /* @__PURE__ */ X(
|
|
861
|
+
}) : h === "uploading" ? null : /* @__PURE__ */ X(an, {
|
|
854
862
|
shape: u.shape,
|
|
855
863
|
label: M,
|
|
856
864
|
placeholder: t.display?.placeholder
|
|
857
865
|
}),
|
|
858
|
-
h === "uploading" && /* @__PURE__ */ X(
|
|
866
|
+
h === "uploading" && /* @__PURE__ */ X(on, { pct: v?.pct ?? 0 }),
|
|
859
867
|
S && /* @__PURE__ */ X("span", {
|
|
860
868
|
className: "absolute right-1 top-1 h-2 w-2 rounded-full bg-warning",
|
|
861
869
|
"aria-hidden": "true",
|
|
862
870
|
"data-testid": "draft-indicator"
|
|
863
871
|
}),
|
|
864
|
-
|
|
872
|
+
H && h === "idle" && !c && /* @__PURE__ */ Z("div", {
|
|
865
873
|
className: "absolute inset-0 flex items-center justify-center gap-2 bg-black/40 opacity-0 transition-opacity hover:opacity-100 focus-within:opacity-100",
|
|
866
874
|
children: [
|
|
867
875
|
t.display?.focal_point && /* @__PURE__ */ X("button", {
|
|
868
876
|
type: "button",
|
|
869
877
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
870
|
-
onClick:
|
|
878
|
+
onClick: se,
|
|
871
879
|
"data-testid": "focal-point-toggle",
|
|
872
880
|
children: w ? "Cancel focus" : "Set focus"
|
|
873
881
|
}),
|
|
@@ -875,7 +883,7 @@ function Zt(e) {
|
|
|
875
883
|
type: "button",
|
|
876
884
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
877
885
|
onClick: (e) => {
|
|
878
|
-
e.stopPropagation(),
|
|
886
|
+
e.stopPropagation(), R();
|
|
879
887
|
},
|
|
880
888
|
children: "Change"
|
|
881
889
|
}),
|
|
@@ -889,11 +897,11 @@ function Zt(e) {
|
|
|
889
897
|
})
|
|
890
898
|
]
|
|
891
899
|
}),
|
|
892
|
-
|
|
900
|
+
V && H && /* @__PURE__ */ X("span", {
|
|
893
901
|
className: "absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white bg-black/70",
|
|
894
902
|
style: {
|
|
895
|
-
left: `${
|
|
896
|
-
top: `${
|
|
903
|
+
left: `${V.x * 100}%`,
|
|
904
|
+
top: `${V.y * 100}%`
|
|
897
905
|
},
|
|
898
906
|
"data-testid": "focal-point-marker"
|
|
899
907
|
}),
|
|
@@ -926,32 +934,32 @@ function Zt(e) {
|
|
|
926
934
|
]
|
|
927
935
|
});
|
|
928
936
|
}
|
|
929
|
-
function
|
|
937
|
+
function en(e, t) {
|
|
930
938
|
return [
|
|
931
939
|
"relative overflow-hidden border border-border bg-surface-2",
|
|
932
940
|
e === "circle" ? "rounded-full" : "rounded-md",
|
|
933
941
|
t ? "cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent" : ""
|
|
934
942
|
].filter(Boolean).join(" ");
|
|
935
943
|
}
|
|
936
|
-
function
|
|
944
|
+
function tn(e) {
|
|
937
945
|
return "h-full w-full object-cover";
|
|
938
946
|
}
|
|
939
|
-
function
|
|
947
|
+
function nn(e, t) {
|
|
940
948
|
return t ? t.replace(":", " / ") : e === "wide" ? "16 / 9" : "1 / 1";
|
|
941
949
|
}
|
|
942
|
-
function
|
|
950
|
+
function rn(e) {
|
|
943
951
|
if (!e) return;
|
|
944
952
|
let t = e.replace(/\s/g, "").match(/^(\d+(?:\.\d+)?)[:/](\d+(?:\.\d+)?)$/);
|
|
945
953
|
if (!t) return;
|
|
946
954
|
let n = Number(t[1]), r = Number(t[2]);
|
|
947
955
|
if (!(!n || !r)) return n / r;
|
|
948
956
|
}
|
|
949
|
-
function
|
|
957
|
+
function an({ shape: e, label: t, placeholder: n }) {
|
|
950
958
|
return n === "initials" ? /* @__PURE__ */ X("div", {
|
|
951
959
|
className: "flex h-full w-full items-center justify-center bg-surface-3 text-text-3",
|
|
952
960
|
children: /* @__PURE__ */ X("span", {
|
|
953
961
|
className: e === "circle" ? "text-lg font-medium" : "text-base font-medium",
|
|
954
|
-
children:
|
|
962
|
+
children: Qt(t)
|
|
955
963
|
})
|
|
956
964
|
}) : /* @__PURE__ */ X("div", {
|
|
957
965
|
className: "flex h-full w-full items-center justify-center bg-surface-3 text-text-4",
|
|
@@ -961,7 +969,7 @@ function nn({ shape: e, label: t, placeholder: n }) {
|
|
|
961
969
|
})
|
|
962
970
|
});
|
|
963
971
|
}
|
|
964
|
-
function
|
|
972
|
+
function on({ pct: e }) {
|
|
965
973
|
let t = 2 * Math.PI * 18, n = t - Math.max(0, Math.min(100, e)) / 100 * t;
|
|
966
974
|
return /* @__PURE__ */ Z("div", {
|
|
967
975
|
className: "absolute inset-0 flex items-center justify-center bg-black/30",
|
|
@@ -1005,56 +1013,57 @@ function rn({ pct: e }) {
|
|
|
1005
1013
|
}
|
|
1006
1014
|
//#endregion
|
|
1007
1015
|
//#region src/components/file-widgets/SquareImage.tsx
|
|
1008
|
-
function
|
|
1009
|
-
return /* @__PURE__ */ X(
|
|
1016
|
+
function sn(e) {
|
|
1017
|
+
return /* @__PURE__ */ X($t, {
|
|
1010
1018
|
...e,
|
|
1011
1019
|
visual: { shape: "square" }
|
|
1012
1020
|
});
|
|
1013
1021
|
}
|
|
1014
1022
|
//#endregion
|
|
1015
1023
|
//#region src/components/file-widgets/CircleImage.tsx
|
|
1016
|
-
function
|
|
1017
|
-
return /* @__PURE__ */ X(
|
|
1024
|
+
function cn(e) {
|
|
1025
|
+
return /* @__PURE__ */ X($t, {
|
|
1018
1026
|
...e,
|
|
1019
1027
|
visual: { shape: "circle" }
|
|
1020
1028
|
});
|
|
1021
1029
|
}
|
|
1022
1030
|
//#endregion
|
|
1023
1031
|
//#region src/components/file-widgets/WideBanner.tsx
|
|
1024
|
-
function
|
|
1025
|
-
return /* @__PURE__ */ X(
|
|
1032
|
+
function ln(e) {
|
|
1033
|
+
return /* @__PURE__ */ X($t, {
|
|
1026
1034
|
...e,
|
|
1027
1035
|
visual: { shape: "wide" }
|
|
1028
1036
|
});
|
|
1029
1037
|
}
|
|
1030
1038
|
//#endregion
|
|
1031
1039
|
//#region src/components/file-widgets/GridLazy.tsx
|
|
1032
|
-
var
|
|
1033
|
-
function
|
|
1040
|
+
var un = Fe(() => import("./Grid-CjLFAKMZ.js").then((e) => ({ default: e.Grid })));
|
|
1041
|
+
function dn() {
|
|
1034
1042
|
return /* @__PURE__ */ X("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
|
|
1035
1043
|
}
|
|
1036
|
-
function
|
|
1044
|
+
function fn(e) {
|
|
1037
1045
|
return /* @__PURE__ */ X(Pe, {
|
|
1038
|
-
fallback: /* @__PURE__ */ X(
|
|
1039
|
-
children: /* @__PURE__ */ X(
|
|
1046
|
+
fallback: /* @__PURE__ */ X(dn, {}),
|
|
1047
|
+
children: /* @__PURE__ */ X(un, { ...e })
|
|
1040
1048
|
});
|
|
1041
1049
|
}
|
|
1042
1050
|
//#endregion
|
|
1043
1051
|
//#region src/components/file-widgets/DocumentCard.tsx
|
|
1044
|
-
function
|
|
1052
|
+
function pn({ contentType: e }) {
|
|
1053
|
+
let t = e ? e.includes("pdf") ? "PDF" : e.includes("word") ? "DOC" : e.includes("sheet") || e.includes("excel") ? "XLS" : e.startsWith("image/") ? "IMG" : e.split("/")[1]?.slice(0, 4).toUpperCase() ?? "FILE" : "FILE";
|
|
1045
1054
|
return /* @__PURE__ */ X("div", {
|
|
1046
1055
|
className: "flex h-16 w-16 flex-none items-center justify-center rounded-md border border-border bg-surface-3 text-xs font-medium text-muted-foreground",
|
|
1047
|
-
children:
|
|
1056
|
+
children: t
|
|
1048
1057
|
});
|
|
1049
1058
|
}
|
|
1050
|
-
function
|
|
1051
|
-
let { field: t, fieldName: n, value: r, onChange: a, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: u } = e, d =
|
|
1052
|
-
|
|
1059
|
+
function mn(e) {
|
|
1060
|
+
let { field: t, fieldName: n, value: r, onChange: a, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: u } = e, d = Se(r), [p, m] = Y("idle"), [h, _] = Y(null), [y, b] = Y(null), [x, S] = Y(!1), [C, w] = Y(d?.filename ?? ""), T = J(null), E = J(!1), D = J(null), { register: O, unregister: k, isDraft: A } = g(), { open: j } = Te();
|
|
1061
|
+
K(() => () => {
|
|
1053
1062
|
T.current && T.current.abort();
|
|
1054
|
-
}, []),
|
|
1063
|
+
}, []), K(() => {
|
|
1055
1064
|
w(d?.filename ?? "");
|
|
1056
1065
|
}, [d?.filename]);
|
|
1057
|
-
let M = (t.accepts ?? []).join(","), N =
|
|
1066
|
+
let M = (t.accepts ?? []).join(","), N = G(async (r) => {
|
|
1058
1067
|
let o = i(r, t.accepts, t.max_size_bytes);
|
|
1059
1068
|
if (o) {
|
|
1060
1069
|
b(o), m("error");
|
|
@@ -1068,7 +1077,7 @@ function fn(e) {
|
|
|
1068
1077
|
let s = new AbortController();
|
|
1069
1078
|
T.current = s;
|
|
1070
1079
|
try {
|
|
1071
|
-
let i = await
|
|
1080
|
+
let i = await he({
|
|
1072
1081
|
file: r,
|
|
1073
1082
|
entityCode: e.entityCode,
|
|
1074
1083
|
fieldCode: c ?? n,
|
|
@@ -1117,12 +1126,12 @@ function fn(e) {
|
|
|
1117
1126
|
k,
|
|
1118
1127
|
c,
|
|
1119
1128
|
u
|
|
1120
|
-
]), P =
|
|
1129
|
+
]), P = G(() => {
|
|
1121
1130
|
s || D.current?.click();
|
|
1122
|
-
}, [s]), F =
|
|
1131
|
+
}, [s]), F = G((e) => {
|
|
1123
1132
|
let t = e.target.files?.[0];
|
|
1124
1133
|
e.target.value = "", t && N(t);
|
|
1125
|
-
}, [N]), I =
|
|
1134
|
+
}, [N]), I = G(() => {
|
|
1126
1135
|
d && A(d.id) && (f(d.id).catch(() => {}), k(d.id)), a?.(t.mode === "array" ? [] : null);
|
|
1127
1136
|
}, [
|
|
1128
1137
|
d,
|
|
@@ -1130,13 +1139,13 @@ function fn(e) {
|
|
|
1130
1139
|
A,
|
|
1131
1140
|
a,
|
|
1132
1141
|
k
|
|
1133
|
-
]), L =
|
|
1142
|
+
]), L = G(() => {
|
|
1134
1143
|
p === "uploading" && T.current && (E.current = !0, T.current.abort(), T.current = null, m("idle"), _(null));
|
|
1135
|
-
}, [p]),
|
|
1136
|
-
d && j(d.id, "download",
|
|
1137
|
-
}, [d, j]),
|
|
1138
|
-
!d || !
|
|
1139
|
-
}, [d, j]),
|
|
1144
|
+
}, [p]), R = G(() => {
|
|
1145
|
+
d && j(d.id, "download", Ce(d));
|
|
1146
|
+
}, [d, j]), z = d ? ge(d) : !1, ee = G(() => {
|
|
1147
|
+
!d || !ge(d) || j(d.id, "preview", Oe(d));
|
|
1148
|
+
}, [d, j]), B = G(() => {
|
|
1140
1149
|
if (!d) {
|
|
1141
1150
|
S(!1);
|
|
1142
1151
|
return;
|
|
@@ -1156,18 +1165,18 @@ function fn(e) {
|
|
|
1156
1165
|
d,
|
|
1157
1166
|
a,
|
|
1158
1167
|
t.mode
|
|
1159
|
-
]),
|
|
1168
|
+
]), te = o === "display";
|
|
1160
1169
|
return !d && p !== "uploading" ? /* @__PURE__ */ Z("div", {
|
|
1161
1170
|
"data-testid": `file-widget-${n}`,
|
|
1162
1171
|
className: "flex items-center gap-3 rounded-md border border-dashed border-border bg-surface p-3",
|
|
1163
1172
|
children: [
|
|
1164
|
-
/* @__PURE__ */ X(
|
|
1173
|
+
/* @__PURE__ */ X(pn, {}),
|
|
1165
1174
|
/* @__PURE__ */ Z("div", {
|
|
1166
1175
|
className: "flex flex-col gap-1",
|
|
1167
1176
|
children: [/* @__PURE__ */ X("span", {
|
|
1168
1177
|
className: "text-sm text-foreground",
|
|
1169
1178
|
children: t.display?.placeholder || "No document attached"
|
|
1170
|
-
}), !
|
|
1179
|
+
}), !te && /* @__PURE__ */ X("button", {
|
|
1171
1180
|
type: "button",
|
|
1172
1181
|
className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
1173
1182
|
onClick: P,
|
|
@@ -1176,7 +1185,7 @@ function fn(e) {
|
|
|
1176
1185
|
children: "Upload"
|
|
1177
1186
|
})]
|
|
1178
1187
|
}),
|
|
1179
|
-
!
|
|
1188
|
+
!te && /* @__PURE__ */ X("input", {
|
|
1180
1189
|
ref: D,
|
|
1181
1190
|
type: "file",
|
|
1182
1191
|
accept: M || void 0,
|
|
@@ -1196,7 +1205,7 @@ function fn(e) {
|
|
|
1196
1205
|
"aria-busy": p === "uploading" || void 0,
|
|
1197
1206
|
"aria-invalid": p === "error" || void 0,
|
|
1198
1207
|
children: [
|
|
1199
|
-
/* @__PURE__ */ X(
|
|
1208
|
+
/* @__PURE__ */ X(pn, { contentType: d?.content_type }),
|
|
1200
1209
|
/* @__PURE__ */ Z("div", {
|
|
1201
1210
|
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
1202
1211
|
children: [
|
|
@@ -1206,16 +1215,16 @@ function fn(e) {
|
|
|
1206
1215
|
value: C,
|
|
1207
1216
|
autoFocus: !0,
|
|
1208
1217
|
onChange: (e) => w(e.target.value),
|
|
1209
|
-
onBlur:
|
|
1218
|
+
onBlur: B,
|
|
1210
1219
|
onKeyDown: (e) => {
|
|
1211
|
-
e.key === "Enter" ?
|
|
1220
|
+
e.key === "Enter" ? B() : e.key === "Escape" && (S(!1), w(d.filename));
|
|
1212
1221
|
},
|
|
1213
1222
|
"data-testid": "filename-input"
|
|
1214
1223
|
}) : /* @__PURE__ */ X("button", {
|
|
1215
1224
|
type: "button",
|
|
1216
1225
|
className: "truncate text-left text-sm font-medium text-foreground hover:underline",
|
|
1217
|
-
onClick: () => !
|
|
1218
|
-
disabled:
|
|
1226
|
+
onClick: () => !te && d && S(!0),
|
|
1227
|
+
disabled: te || s || !d,
|
|
1219
1228
|
title: d?.filename,
|
|
1220
1229
|
"data-testid": "filename",
|
|
1221
1230
|
children: d?.filename ?? "Uploading…"
|
|
@@ -1225,7 +1234,7 @@ function fn(e) {
|
|
|
1225
1234
|
children: [
|
|
1226
1235
|
d && /* @__PURE__ */ X("span", { children: v(d.size_bytes) }),
|
|
1227
1236
|
d?.page_count != null && /* @__PURE__ */ Z("span", { children: [d.page_count, " pages"] }),
|
|
1228
|
-
d?.uploaded_at && /* @__PURE__ */ X("span", { children:
|
|
1237
|
+
d?.uploaded_at && /* @__PURE__ */ X("span", { children: hn(d.uploaded_at) }),
|
|
1229
1238
|
d?.uploaded_by && /* @__PURE__ */ Z("span", { children: ["by ", d.uploaded_by] }),
|
|
1230
1239
|
d?.version?.number != null && /* @__PURE__ */ Z("span", {
|
|
1231
1240
|
"data-testid": "version-badge",
|
|
@@ -1255,24 +1264,24 @@ function fn(e) {
|
|
|
1255
1264
|
}),
|
|
1256
1265
|
/* @__PURE__ */ Z("div", {
|
|
1257
1266
|
className: "flex flex-none items-center gap-1",
|
|
1258
|
-
children: [d && p !== "uploading" && /* @__PURE__ */ Z(
|
|
1267
|
+
children: [d && p !== "uploading" && /* @__PURE__ */ Z(We, { children: [
|
|
1259
1268
|
/* @__PURE__ */ X("button", {
|
|
1260
1269
|
type: "button",
|
|
1261
1270
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
1262
|
-
onClick:
|
|
1271
|
+
onClick: R,
|
|
1263
1272
|
"data-testid": "download",
|
|
1264
1273
|
children: "Download"
|
|
1265
1274
|
}),
|
|
1266
1275
|
/* @__PURE__ */ X("button", {
|
|
1267
1276
|
type: "button",
|
|
1268
1277
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1269
|
-
onClick:
|
|
1270
|
-
disabled: !
|
|
1271
|
-
title:
|
|
1278
|
+
onClick: ee,
|
|
1279
|
+
disabled: !z,
|
|
1280
|
+
title: z ? void 0 : "Preview is available only for images and PDFs",
|
|
1272
1281
|
"data-testid": "preview",
|
|
1273
1282
|
children: "Preview"
|
|
1274
1283
|
}),
|
|
1275
|
-
!
|
|
1284
|
+
!te && /* @__PURE__ */ Z(We, { children: [/* @__PURE__ */ X("button", {
|
|
1276
1285
|
type: "button",
|
|
1277
1286
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
1278
1287
|
onClick: P,
|
|
@@ -1295,7 +1304,7 @@ function fn(e) {
|
|
|
1295
1304
|
children: "Cancel"
|
|
1296
1305
|
})]
|
|
1297
1306
|
}),
|
|
1298
|
-
!
|
|
1307
|
+
!te && /* @__PURE__ */ X("input", {
|
|
1299
1308
|
ref: D,
|
|
1300
1309
|
type: "file",
|
|
1301
1310
|
accept: M || void 0,
|
|
@@ -1306,25 +1315,25 @@ function fn(e) {
|
|
|
1306
1315
|
]
|
|
1307
1316
|
});
|
|
1308
1317
|
}
|
|
1309
|
-
function
|
|
1318
|
+
function hn(e) {
|
|
1310
1319
|
let t = new Date(e);
|
|
1311
1320
|
return isNaN(t.getTime()) ? e : t.toISOString().slice(0, 10);
|
|
1312
1321
|
}
|
|
1313
1322
|
//#endregion
|
|
1314
1323
|
//#region src/components/file-widgets/FileList.tsx
|
|
1315
|
-
function
|
|
1324
|
+
function gn(e) {
|
|
1316
1325
|
return e ? (e.split("/")[1] ?? e).toUpperCase().slice(0, 6) : "";
|
|
1317
1326
|
}
|
|
1318
|
-
function
|
|
1319
|
-
let { field: t, fieldName: n, value: r, onChange: a, mode: o, disabled: s } = e, c =
|
|
1327
|
+
function _n(e) {
|
|
1328
|
+
let { field: t, fieldName: n, value: r, onChange: a, mode: o, disabled: s } = e, c = De(r), [u, d] = Y([]), { register: p, unregister: m, isDraft: h } = g(), _ = J(c);
|
|
1320
1329
|
_.current = c;
|
|
1321
|
-
let y =
|
|
1330
|
+
let y = J(null), b = J(/* @__PURE__ */ new Set()), x = J([]);
|
|
1322
1331
|
x.current = u;
|
|
1323
|
-
let { open: S } =
|
|
1324
|
-
|
|
1332
|
+
let { open: S } = Te();
|
|
1333
|
+
K(() => () => {
|
|
1325
1334
|
x.current.forEach((e) => e.abort());
|
|
1326
1335
|
}, []);
|
|
1327
|
-
let C = (t.accepts ?? []).join(","), w = o === "display", T =
|
|
1336
|
+
let C = (t.accepts ?? []).join(","), w = o === "display", T = G(async (r) => {
|
|
1328
1337
|
let o = i(r, t.accepts, t.max_size_bytes), s = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, c = new AbortController();
|
|
1329
1338
|
if (o) {
|
|
1330
1339
|
d((e) => [...e, {
|
|
@@ -1348,7 +1357,7 @@ function hn(e) {
|
|
|
1348
1357
|
abort: () => c.abort()
|
|
1349
1358
|
}]);
|
|
1350
1359
|
try {
|
|
1351
|
-
let t = await
|
|
1360
|
+
let t = await he({
|
|
1352
1361
|
file: r,
|
|
1353
1362
|
entityCode: e.entityCode,
|
|
1354
1363
|
fieldCode: n,
|
|
@@ -1402,22 +1411,22 @@ function hn(e) {
|
|
|
1402
1411
|
e.entityCode,
|
|
1403
1412
|
p,
|
|
1404
1413
|
m
|
|
1405
|
-
]), E =
|
|
1414
|
+
]), E = G((e) => {
|
|
1406
1415
|
Array.from(e).forEach((e) => void T(e));
|
|
1407
|
-
}, [T]), D =
|
|
1416
|
+
}, [T]), D = G(() => {
|
|
1408
1417
|
s || y.current?.click();
|
|
1409
|
-
}, [s]), O =
|
|
1418
|
+
}, [s]), O = G((e) => {
|
|
1410
1419
|
let t = e.target.files;
|
|
1411
1420
|
e.target.value = "", t && t.length > 0 && E(t);
|
|
1412
|
-
}, [E]), k =
|
|
1421
|
+
}, [E]), k = G((e) => {
|
|
1413
1422
|
h(e) && (f(e).catch(() => {}), m(e)), a?.(c.filter((t) => t.id !== e));
|
|
1414
1423
|
}, [
|
|
1415
1424
|
h,
|
|
1416
1425
|
c,
|
|
1417
1426
|
a,
|
|
1418
1427
|
m
|
|
1419
|
-
]), A =
|
|
1420
|
-
S(e.id, "download",
|
|
1428
|
+
]), A = G((e) => {
|
|
1429
|
+
S(e.id, "download", Ce(e));
|
|
1421
1430
|
}, [S]);
|
|
1422
1431
|
return /* @__PURE__ */ Z("div", {
|
|
1423
1432
|
"data-testid": `file-widget-${n}`,
|
|
@@ -1435,7 +1444,7 @@ function hn(e) {
|
|
|
1435
1444
|
children: [
|
|
1436
1445
|
/* @__PURE__ */ X("span", {
|
|
1437
1446
|
className: "flex-none rounded-sm border border-border bg-surface-3 px-1.5 py-0.5 text-[10px] text-muted-foreground",
|
|
1438
|
-
children:
|
|
1447
|
+
children: gn(e.content_type)
|
|
1439
1448
|
}),
|
|
1440
1449
|
/* @__PURE__ */ X("button", {
|
|
1441
1450
|
type: "button",
|
|
@@ -1500,7 +1509,7 @@ function hn(e) {
|
|
|
1500
1509
|
]
|
|
1501
1510
|
}, e.localId))
|
|
1502
1511
|
]
|
|
1503
|
-
}), !w && /* @__PURE__ */ Z(
|
|
1512
|
+
}), !w && /* @__PURE__ */ Z(We, { children: [/* @__PURE__ */ X("button", {
|
|
1504
1513
|
type: "button",
|
|
1505
1514
|
className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
1506
1515
|
onClick: D,
|
|
@@ -1520,16 +1529,16 @@ function hn(e) {
|
|
|
1520
1529
|
}
|
|
1521
1530
|
//#endregion
|
|
1522
1531
|
//#region src/components/file-widgets/LabeledSlots.tsx
|
|
1523
|
-
function
|
|
1532
|
+
function vn(e) {
|
|
1524
1533
|
return !e || Array.isArray(e) || typeof e != "object" ? {} : e;
|
|
1525
1534
|
}
|
|
1526
|
-
function
|
|
1535
|
+
function yn(e) {
|
|
1527
1536
|
return e.split("_").filter(Boolean).map((e) => e.slice(0, 1).toUpperCase() + e.slice(1)).join(" ");
|
|
1528
1537
|
}
|
|
1529
|
-
function
|
|
1538
|
+
function bn(e, t) {
|
|
1530
1539
|
return t?.content_type?.startsWith("image/") ? !0 : (e?.accepts ?? []).some((e) => e === "image/*" || e.startsWith("image/"));
|
|
1531
1540
|
}
|
|
1532
|
-
function
|
|
1541
|
+
function xn(e, t, n, r) {
|
|
1533
1542
|
return {
|
|
1534
1543
|
...e,
|
|
1535
1544
|
name: `${e.name}.${t}`,
|
|
@@ -1539,14 +1548,14 @@ function yn(e, t, n, r) {
|
|
|
1539
1548
|
slots: void 0,
|
|
1540
1549
|
display: {
|
|
1541
1550
|
...e.display ?? { widget: "document_card" },
|
|
1542
|
-
widget:
|
|
1551
|
+
widget: bn(n, r) ? "square_image" : "document_card",
|
|
1543
1552
|
aspect_ratio: n?.aspect_ratio ?? e.display?.aspect_ratio,
|
|
1544
|
-
placeholder: e.display?.placeholder ??
|
|
1553
|
+
placeholder: e.display?.placeholder ?? yn(t)
|
|
1545
1554
|
}
|
|
1546
1555
|
};
|
|
1547
1556
|
}
|
|
1548
|
-
function
|
|
1549
|
-
let { field: t, fieldName: n, entityCode: r, value: i, onChange: a, mode: o, disabled: s } = e, c = Object.entries(t.slots ?? {}), l =
|
|
1557
|
+
function Sn(e) {
|
|
1558
|
+
let { field: t, fieldName: n, entityCode: r, value: i, onChange: a, mode: o, disabled: s } = e, c = Object.entries(t.slots ?? {}), l = vn(i);
|
|
1550
1559
|
return c.length === 0 ? /* @__PURE__ */ X("span", {
|
|
1551
1560
|
className: "text-sm text-muted-foreground",
|
|
1552
1561
|
children: "No slots configured"
|
|
@@ -1556,7 +1565,7 @@ function bn(e) {
|
|
|
1556
1565
|
gap: 12
|
|
1557
1566
|
},
|
|
1558
1567
|
children: c.map(([e, i]) => {
|
|
1559
|
-
let c = l[e] ?? null, u =
|
|
1568
|
+
let c = l[e] ?? null, u = xn(t, e, i, c), d = u.display?.widget ?? "document_card", f = Gt(d);
|
|
1560
1569
|
return f ? /* @__PURE__ */ Z("div", {
|
|
1561
1570
|
style: {
|
|
1562
1571
|
display: "grid",
|
|
@@ -1568,7 +1577,7 @@ function bn(e) {
|
|
|
1568
1577
|
fontWeight: 600,
|
|
1569
1578
|
color: "var(--text-2)"
|
|
1570
1579
|
},
|
|
1571
|
-
children:
|
|
1580
|
+
children: yn(e)
|
|
1572
1581
|
}), /* @__PURE__ */ X(f, {
|
|
1573
1582
|
field: u,
|
|
1574
1583
|
fieldName: e,
|
|
@@ -1596,7 +1605,7 @@ function bn(e) {
|
|
|
1596
1605
|
fontWeight: 600,
|
|
1597
1606
|
color: "var(--text-2)"
|
|
1598
1607
|
},
|
|
1599
|
-
children:
|
|
1608
|
+
children: yn(e)
|
|
1600
1609
|
}), /* @__PURE__ */ X("span", {
|
|
1601
1610
|
className: "text-sm text-muted-foreground",
|
|
1602
1611
|
children: `Unknown file widget: ${d}`
|
|
@@ -1607,43 +1616,43 @@ function bn(e) {
|
|
|
1607
1616
|
}
|
|
1608
1617
|
//#endregion
|
|
1609
1618
|
//#region src/components/file-widgets/builtins.ts
|
|
1610
|
-
var
|
|
1611
|
-
function
|
|
1612
|
-
|
|
1619
|
+
var Cn = !1;
|
|
1620
|
+
function wn() {
|
|
1621
|
+
Cn ||= (Wt("square_image", sn), Wt("circle_image", cn), Wt("wide_banner", ln), Wt("grid", fn), Wt("document_card", mn), Wt("file_list", _n), Wt("labeled_slots", Sn), !0);
|
|
1613
1622
|
}
|
|
1614
1623
|
//#endregion
|
|
1615
1624
|
//#region src/components/file-widgets/host.tsx
|
|
1616
|
-
|
|
1617
|
-
function
|
|
1625
|
+
wn();
|
|
1626
|
+
function Tn(e, t) {
|
|
1618
1627
|
return e.files?.get(t);
|
|
1619
1628
|
}
|
|
1620
|
-
function
|
|
1629
|
+
function En(e, t) {
|
|
1621
1630
|
return Object.prototype.hasOwnProperty.call(e, t) ? e[t] ?? null : e.$files?.[t] ?? null;
|
|
1622
1631
|
}
|
|
1623
|
-
function
|
|
1624
|
-
if (
|
|
1632
|
+
function Dn(e, t, n) {
|
|
1633
|
+
if (Tn(e, n)) return En(t, n);
|
|
1625
1634
|
let r = e.fields.get(n);
|
|
1626
|
-
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? E(t[n],
|
|
1635
|
+
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? E(t[n], En(t, n)) : t[n];
|
|
1627
1636
|
}
|
|
1628
|
-
function
|
|
1637
|
+
function On(e, t, n) {
|
|
1629
1638
|
let r = e.fields.get(t);
|
|
1630
1639
|
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? D(n) : n;
|
|
1631
1640
|
}
|
|
1632
|
-
function
|
|
1633
|
-
let r =
|
|
1641
|
+
function kn(e, t, n) {
|
|
1642
|
+
let r = Tn(e, t);
|
|
1634
1643
|
if (r) return r.name || t;
|
|
1635
1644
|
let i = e.fields.get(t);
|
|
1636
1645
|
return i ? b(i, t, n) : t;
|
|
1637
1646
|
}
|
|
1638
|
-
function
|
|
1639
|
-
let { entity: t, entityCode: n, fieldName: r, record: i, mode: a, onChange: o, refs: s, disabled: c, surface: l, entities: u, screens: d, locale: f, fieldId: p, labelId: m } = e,
|
|
1640
|
-
if (
|
|
1641
|
-
let e =
|
|
1647
|
+
function An(e) {
|
|
1648
|
+
let { entity: t, entityCode: n, fieldName: r, record: i, mode: a, onChange: o, refs: s, disabled: c, surface: l, entities: u, screens: d, locale: f, fieldId: p, labelId: m, structure: h } = e, g = Tn(t, r);
|
|
1649
|
+
if (g) {
|
|
1650
|
+
let e = g.display?.widget ?? "", t = Gt(e);
|
|
1642
1651
|
return t ? /* @__PURE__ */ X(t, {
|
|
1643
|
-
field:
|
|
1652
|
+
field: g,
|
|
1644
1653
|
fieldName: r,
|
|
1645
1654
|
entityCode: n,
|
|
1646
|
-
value:
|
|
1655
|
+
value: En(i, r),
|
|
1647
1656
|
mode: a,
|
|
1648
1657
|
onChange: o,
|
|
1649
1658
|
disabled: c,
|
|
@@ -1653,12 +1662,15 @@ function On(e) {
|
|
|
1653
1662
|
children: e ? `Unknown file widget: ${e}` : "Missing file widget"
|
|
1654
1663
|
});
|
|
1655
1664
|
}
|
|
1656
|
-
let
|
|
1657
|
-
|
|
1658
|
-
|
|
1665
|
+
let _ = t.fields.get(r), v = h && a === "display" && _ ? {
|
|
1666
|
+
..._,
|
|
1667
|
+
structure: h
|
|
1668
|
+
} : _;
|
|
1669
|
+
return v ? B({
|
|
1670
|
+
field: v,
|
|
1659
1671
|
entityCode: n,
|
|
1660
1672
|
fieldName: r,
|
|
1661
|
-
value:
|
|
1673
|
+
value: Dn(t, i, r),
|
|
1662
1674
|
mode: a,
|
|
1663
1675
|
onChange: o,
|
|
1664
1676
|
record: i,
|
|
@@ -1674,80 +1686,80 @@ function On(e) {
|
|
|
1674
1686
|
}
|
|
1675
1687
|
//#endregion
|
|
1676
1688
|
//#region src/components/file-widgets/payload.ts
|
|
1677
|
-
function
|
|
1689
|
+
function jn(e) {
|
|
1678
1690
|
return !e || Array.isArray(e) ? null : e;
|
|
1679
1691
|
}
|
|
1680
|
-
function
|
|
1692
|
+
function Mn(e) {
|
|
1681
1693
|
return Array.isArray(e) ? e : [];
|
|
1682
1694
|
}
|
|
1683
|
-
function
|
|
1695
|
+
function Nn(e) {
|
|
1684
1696
|
return !e || Array.isArray(e) || typeof e != "object" ? {} : e;
|
|
1685
1697
|
}
|
|
1686
|
-
function
|
|
1687
|
-
return e.mode === "array" ?
|
|
1698
|
+
function Pn(e, t) {
|
|
1699
|
+
return e.mode === "array" ? Mn(t) : e.mode === "named_map" ? Nn(t) : jn(t);
|
|
1688
1700
|
}
|
|
1689
|
-
function
|
|
1701
|
+
function Fn(e, t, n, r) {
|
|
1690
1702
|
let i = {
|
|
1691
1703
|
file_id: e.id,
|
|
1692
1704
|
filename: e.filename
|
|
1693
1705
|
};
|
|
1694
1706
|
return r && (i.slot = r), n && (i.position = t), e.metadata !== void 0 && (i.metadata = e.metadata), i;
|
|
1695
1707
|
}
|
|
1696
|
-
function
|
|
1708
|
+
function In(e, t) {
|
|
1697
1709
|
if (e.mode === "array") {
|
|
1698
|
-
let e =
|
|
1699
|
-
return e.length === 0 ? { clear: !0 } : { set: e.map((e, t) =>
|
|
1710
|
+
let e = Mn(t);
|
|
1711
|
+
return e.length === 0 ? { clear: !0 } : { set: e.map((e, t) => Fn(e, t, !0)) };
|
|
1700
1712
|
}
|
|
1701
1713
|
if (e.mode === "named_map") {
|
|
1702
|
-
let e =
|
|
1714
|
+
let e = Nn(t), n = Object.entries(e).filter(([, e]) => e != null).map(([e, t]) => Fn(t, 0, !1, e));
|
|
1703
1715
|
return n.length === 0 ? { clear: !0 } : { set: n };
|
|
1704
1716
|
}
|
|
1705
|
-
let n =
|
|
1706
|
-
return n ? { set: [
|
|
1717
|
+
let n = jn(t);
|
|
1718
|
+
return n ? { set: [Fn(n, 0, !0)] } : { clear: !0 };
|
|
1707
1719
|
}
|
|
1708
|
-
function
|
|
1720
|
+
function Ln(e) {
|
|
1709
1721
|
return JSON.stringify(e);
|
|
1710
1722
|
}
|
|
1711
|
-
function
|
|
1723
|
+
function Rn(e) {
|
|
1712
1724
|
let { entity: t, formData: n, record: r, isNew: i } = e, a = {};
|
|
1713
1725
|
for (let e of t.files?.names() ?? []) {
|
|
1714
1726
|
if (!Object.prototype.hasOwnProperty.call(n, e)) continue;
|
|
1715
|
-
let o =
|
|
1727
|
+
let o = Tn(t, e);
|
|
1716
1728
|
if (!o) continue;
|
|
1717
|
-
let s =
|
|
1729
|
+
let s = Pn(o, n[e]);
|
|
1718
1730
|
if (i) {
|
|
1719
|
-
if (o.mode === "array" ?
|
|
1720
|
-
a[e] =
|
|
1731
|
+
if (o.mode === "array" ? Mn(s).length === 0 : o.mode === "named_map" ? Object.values(Nn(s)).every((e) => e == null) : jn(s) == null) continue;
|
|
1732
|
+
a[e] = In(o, s);
|
|
1721
1733
|
continue;
|
|
1722
1734
|
}
|
|
1723
|
-
let c =
|
|
1724
|
-
|
|
1735
|
+
let c = Pn(o, r ? En(r, e) : null), l = In(o, s), u = In(o, c);
|
|
1736
|
+
Ln(l) !== Ln(u) && (a[e] = l);
|
|
1725
1737
|
}
|
|
1726
1738
|
let o = t.fields;
|
|
1727
1739
|
if (!o) return a;
|
|
1728
1740
|
for (let e of o.names()) {
|
|
1729
1741
|
let s = o.get(e)?.files;
|
|
1730
1742
|
if (!s || s.mode !== "rich_text_inline" || !Object.prototype.hasOwnProperty.call(n, e)) continue;
|
|
1731
|
-
let c =
|
|
1743
|
+
let c = Bn(s, n[e]);
|
|
1732
1744
|
if (i) {
|
|
1733
1745
|
if (c.clear) continue;
|
|
1734
1746
|
a[e] = c;
|
|
1735
1747
|
continue;
|
|
1736
1748
|
}
|
|
1737
|
-
let l =
|
|
1749
|
+
let l = Bn(s, r ? Dn({
|
|
1738
1750
|
...t,
|
|
1739
1751
|
fields: o
|
|
1740
1752
|
}, r, e) : null);
|
|
1741
|
-
|
|
1753
|
+
Ln(c) !== Ln(l) && (a[e] = c);
|
|
1742
1754
|
}
|
|
1743
1755
|
return a;
|
|
1744
1756
|
}
|
|
1745
|
-
function
|
|
1757
|
+
function zn(e) {
|
|
1746
1758
|
let t = [];
|
|
1747
1759
|
for (let n of Object.values(e)) for (let e of n.set ?? []) t.push(e.file_id);
|
|
1748
1760
|
return t;
|
|
1749
1761
|
}
|
|
1750
|
-
function
|
|
1762
|
+
function Bn(e, t) {
|
|
1751
1763
|
if (e.mode !== "rich_text_inline") return { clear: !0 };
|
|
1752
1764
|
let n = T(D(t));
|
|
1753
1765
|
return n.length === 0 ? { clear: !0 } : { set: n.map((e, t) => ({
|
|
@@ -1755,24 +1767,24 @@ function Rn(e, t) {
|
|
|
1755
1767
|
position: t
|
|
1756
1768
|
})) };
|
|
1757
1769
|
}
|
|
1758
|
-
var
|
|
1759
|
-
function
|
|
1760
|
-
return !
|
|
1770
|
+
var Vn = 1200, Hn = null, Un = null;
|
|
1771
|
+
function Wn() {
|
|
1772
|
+
return !Hn || !Un ? null : `declarion::${Hn}::${Un}::listlayout`;
|
|
1761
1773
|
}
|
|
1762
|
-
function
|
|
1774
|
+
function Gn() {
|
|
1763
1775
|
return {
|
|
1764
1776
|
v: 2,
|
|
1765
1777
|
widths: {},
|
|
1766
1778
|
resizeEduShown: !1
|
|
1767
1779
|
};
|
|
1768
1780
|
}
|
|
1769
|
-
function
|
|
1781
|
+
function Kn(e) {
|
|
1770
1782
|
if (typeof e != "object" || !e) return {};
|
|
1771
1783
|
let t = {};
|
|
1772
1784
|
for (let [n, r] of Object.entries(e)) typeof r == "number" && Number.isFinite(r) && r >= 60 && (t[n] = r);
|
|
1773
1785
|
return t;
|
|
1774
1786
|
}
|
|
1775
|
-
function
|
|
1787
|
+
function qn(e) {
|
|
1776
1788
|
let t;
|
|
1777
1789
|
try {
|
|
1778
1790
|
t = JSON.parse(e);
|
|
@@ -1783,21 +1795,21 @@ function Gn(e) {
|
|
|
1783
1795
|
let n = t;
|
|
1784
1796
|
if (n.v !== 2) return null;
|
|
1785
1797
|
let r = {};
|
|
1786
|
-
if (n.widths && typeof n.widths == "object") for (let [e, t] of Object.entries(n.widths)) r[e] =
|
|
1798
|
+
if (n.widths && typeof n.widths == "object") for (let [e, t] of Object.entries(n.widths)) r[e] = Kn(t);
|
|
1787
1799
|
return {
|
|
1788
1800
|
v: 2,
|
|
1789
1801
|
widths: r,
|
|
1790
1802
|
resizeEduShown: n.resizeEduShown === !0
|
|
1791
1803
|
};
|
|
1792
1804
|
}
|
|
1793
|
-
function
|
|
1805
|
+
function Jn(e) {
|
|
1794
1806
|
if (typeof window > "u") return;
|
|
1795
|
-
let t =
|
|
1807
|
+
let t = Wn();
|
|
1796
1808
|
if (t) try {
|
|
1797
1809
|
localStorage.setItem(t, JSON.stringify(e));
|
|
1798
1810
|
} catch {}
|
|
1799
1811
|
}
|
|
1800
|
-
function
|
|
1812
|
+
function Yn(e, t) {
|
|
1801
1813
|
return {
|
|
1802
1814
|
v: 2,
|
|
1803
1815
|
widths: {
|
|
@@ -1807,29 +1819,29 @@ function qn(e, t) {
|
|
|
1807
1819
|
resizeEduShown: e.resizeEduShown || t.resizeEduShown
|
|
1808
1820
|
};
|
|
1809
1821
|
}
|
|
1810
|
-
function
|
|
1811
|
-
return Math.min(
|
|
1822
|
+
function Xn(e) {
|
|
1823
|
+
return Math.min(Vn, Math.max(60, Math.round(e)));
|
|
1812
1824
|
}
|
|
1813
|
-
var
|
|
1814
|
-
...
|
|
1825
|
+
var Zn = Ge((e) => ({
|
|
1826
|
+
...Gn(),
|
|
1815
1827
|
setScope: (e, t) => {
|
|
1816
|
-
|
|
1828
|
+
Hn = e, Un = t;
|
|
1817
1829
|
},
|
|
1818
1830
|
hydrate: () => {
|
|
1819
1831
|
if (typeof window > "u") return;
|
|
1820
|
-
let t =
|
|
1832
|
+
let t = Wn();
|
|
1821
1833
|
if (!t) {
|
|
1822
|
-
e(
|
|
1834
|
+
e(Gn());
|
|
1823
1835
|
return;
|
|
1824
1836
|
}
|
|
1825
1837
|
let n = localStorage.getItem(t);
|
|
1826
|
-
e((n ?
|
|
1838
|
+
e((n ? qn(n) : null) ?? Gn());
|
|
1827
1839
|
},
|
|
1828
1840
|
setWidth: (t, n, r) => {
|
|
1829
1841
|
e((e) => {
|
|
1830
1842
|
let i = {
|
|
1831
1843
|
...e.widths[t] ?? {},
|
|
1832
|
-
[n]:
|
|
1844
|
+
[n]: Xn(r)
|
|
1833
1845
|
}, a = {
|
|
1834
1846
|
...e,
|
|
1835
1847
|
widths: {
|
|
@@ -1837,13 +1849,13 @@ var Yn = We((e) => ({
|
|
|
1837
1849
|
[t]: i
|
|
1838
1850
|
}
|
|
1839
1851
|
};
|
|
1840
|
-
return
|
|
1852
|
+
return Jn(a), a;
|
|
1841
1853
|
});
|
|
1842
1854
|
},
|
|
1843
1855
|
setWidths: (t, n) => {
|
|
1844
1856
|
e((e) => {
|
|
1845
1857
|
let r = {};
|
|
1846
|
-
for (let [e, t] of Object.entries(n)) r[e] =
|
|
1858
|
+
for (let [e, t] of Object.entries(n)) r[e] = Xn(t);
|
|
1847
1859
|
let i = {
|
|
1848
1860
|
...e.widths[t] ?? {},
|
|
1849
1861
|
...r
|
|
@@ -1854,7 +1866,7 @@ var Yn = We((e) => ({
|
|
|
1854
1866
|
[t]: i
|
|
1855
1867
|
}
|
|
1856
1868
|
};
|
|
1857
|
-
return
|
|
1869
|
+
return Jn(a), a;
|
|
1858
1870
|
});
|
|
1859
1871
|
},
|
|
1860
1872
|
resetWidths: (t) => {
|
|
@@ -1866,7 +1878,7 @@ var Yn = We((e) => ({
|
|
|
1866
1878
|
[t]: {}
|
|
1867
1879
|
}
|
|
1868
1880
|
};
|
|
1869
|
-
return
|
|
1881
|
+
return Jn(n), n;
|
|
1870
1882
|
});
|
|
1871
1883
|
},
|
|
1872
1884
|
prune: (t, n) => {
|
|
@@ -1884,7 +1896,7 @@ var Yn = We((e) => ({
|
|
|
1884
1896
|
[t]: i
|
|
1885
1897
|
}
|
|
1886
1898
|
};
|
|
1887
|
-
return
|
|
1899
|
+
return Jn(o), o;
|
|
1888
1900
|
});
|
|
1889
1901
|
},
|
|
1890
1902
|
markResizeEduShown: () => {
|
|
@@ -1894,49 +1906,49 @@ var Yn = We((e) => ({
|
|
|
1894
1906
|
...e,
|
|
1895
1907
|
resizeEduShown: !0
|
|
1896
1908
|
};
|
|
1897
|
-
return
|
|
1909
|
+
return Jn(t), t;
|
|
1898
1910
|
});
|
|
1899
1911
|
}
|
|
1900
|
-
})),
|
|
1901
|
-
function
|
|
1902
|
-
typeof window > "u" ||
|
|
1903
|
-
let t =
|
|
1912
|
+
})), Qn = !1;
|
|
1913
|
+
function $n() {
|
|
1914
|
+
typeof window > "u" || Qn || (Qn = !0, window.addEventListener("storage", (e) => {
|
|
1915
|
+
let t = Wn();
|
|
1904
1916
|
if (!t || e.key !== t || e.newValue == null) return;
|
|
1905
|
-
let n =
|
|
1906
|
-
n &&
|
|
1917
|
+
let n = qn(e.newValue);
|
|
1918
|
+
n && Zn.setState((e) => Yn(e, n));
|
|
1907
1919
|
}));
|
|
1908
1920
|
}
|
|
1909
|
-
var
|
|
1910
|
-
function
|
|
1911
|
-
let t = !!e &&
|
|
1912
|
-
t && e &&
|
|
1913
|
-
}, [t, e]), a =
|
|
1914
|
-
t && e &&
|
|
1915
|
-
}, [t, e]), o =
|
|
1916
|
-
t && e &&
|
|
1917
|
-
}, [t, e]), s =
|
|
1918
|
-
t && e &&
|
|
1919
|
-
}, [t, e]), c =
|
|
1920
|
-
t &&
|
|
1921
|
+
var er = {}, tr = () => {};
|
|
1922
|
+
function nr(e) {
|
|
1923
|
+
let t = !!e && Wn() !== null, n = Zn((t) => e ? t.widths[e] : void 0), r = Zn((e) => e.resizeEduShown === !0), i = G((n, r) => {
|
|
1924
|
+
t && e && Zn.getState().setWidth(e, n, r);
|
|
1925
|
+
}, [t, e]), a = G((n) => {
|
|
1926
|
+
t && e && Zn.getState().setWidths(e, n);
|
|
1927
|
+
}, [t, e]), o = G(() => {
|
|
1928
|
+
t && e && Zn.getState().resetWidths(e);
|
|
1929
|
+
}, [t, e]), s = G((n) => {
|
|
1930
|
+
t && e && Zn.getState().prune(e, n);
|
|
1931
|
+
}, [t, e]), c = G(() => {
|
|
1932
|
+
t && Zn.getState().markResizeEduShown();
|
|
1921
1933
|
}, [t]);
|
|
1922
1934
|
return {
|
|
1923
|
-
widths: t ? n ??
|
|
1935
|
+
widths: t ? n ?? er : er,
|
|
1924
1936
|
resizeEduShown: r,
|
|
1925
|
-
setWidth: t ? i :
|
|
1926
|
-
setWidths: t ? a :
|
|
1927
|
-
resetWidths: t ? o :
|
|
1928
|
-
prune: t ? s :
|
|
1929
|
-
markResizeEduShown: t ? c :
|
|
1937
|
+
setWidth: t ? i : tr,
|
|
1938
|
+
setWidths: t ? a : tr,
|
|
1939
|
+
resetWidths: t ? o : tr,
|
|
1940
|
+
prune: t ? s : tr,
|
|
1941
|
+
markResizeEduShown: t ? c : tr
|
|
1930
1942
|
};
|
|
1931
1943
|
}
|
|
1932
1944
|
//#endregion
|
|
1933
1945
|
//#region src/hooks/useChildrenData.ts
|
|
1934
|
-
var
|
|
1935
|
-
function
|
|
1946
|
+
var rr = "entity-children";
|
|
1947
|
+
function ir(e, t, n, r, i, a) {
|
|
1936
1948
|
let s = Array.isArray(r) ? r : [r], l = Array.isArray(r) ? o(t, s.length) : [t];
|
|
1937
1949
|
return He({
|
|
1938
1950
|
queryKey: [
|
|
1939
|
-
|
|
1951
|
+
rr,
|
|
1940
1952
|
e,
|
|
1941
1953
|
t,
|
|
1942
1954
|
n,
|
|
@@ -1958,7 +1970,7 @@ function nr(e, t, n, r, i, a) {
|
|
|
1958
1970
|
}
|
|
1959
1971
|
//#endregion
|
|
1960
1972
|
//#region src/stores/realtime.ts
|
|
1961
|
-
var
|
|
1973
|
+
var ar = Ge((e, t) => ({
|
|
1962
1974
|
degradedEntities: /* @__PURE__ */ new Set(),
|
|
1963
1975
|
markDegraded: (n) => {
|
|
1964
1976
|
if (!n || t().degradedEntities.has(n)) return;
|
|
@@ -1966,22 +1978,23 @@ var rr = We((e, t) => ({
|
|
|
1966
1978
|
r.add(n), e({ degradedEntities: r });
|
|
1967
1979
|
}
|
|
1968
1980
|
}));
|
|
1969
|
-
function
|
|
1981
|
+
function or(e, t, n) {
|
|
1970
1982
|
return e === !0 && !t.has(n);
|
|
1971
1983
|
}
|
|
1972
1984
|
//#endregion
|
|
1973
1985
|
//#region src/hooks/useAssociatedData.ts
|
|
1974
|
-
function
|
|
1986
|
+
function sr(e, t, n, r, i, a, o, s) {
|
|
1987
|
+
let l = s ? JSON.stringify(Object.entries(s).sort()) : void 0;
|
|
1975
1988
|
return Be({
|
|
1976
1989
|
queryKey: [
|
|
1977
|
-
|
|
1990
|
+
rr,
|
|
1978
1991
|
e,
|
|
1979
1992
|
t,
|
|
1980
1993
|
n,
|
|
1981
1994
|
i,
|
|
1982
1995
|
a,
|
|
1983
1996
|
o,
|
|
1984
|
-
|
|
1997
|
+
l
|
|
1985
1998
|
],
|
|
1986
1999
|
queryFn: ({ pageParam: e }) => {
|
|
1987
2000
|
let l = new URLSearchParams(), u = [{
|
|
@@ -2003,29 +2016,29 @@ function ar(e, t, n, r, i, a, o, s) {
|
|
|
2003
2016
|
}
|
|
2004
2017
|
//#endregion
|
|
2005
2018
|
//#region src/components/shared/ActionButton.tsx
|
|
2006
|
-
function
|
|
2007
|
-
let [f, p] =
|
|
2019
|
+
function cr({ actionCode: n, action: i, entityCode: o, objectIds: s = [], row: c, variant: l = "outline", size: u = "default", onSuccess: d }) {
|
|
2020
|
+
let [f, p] = Y(!1), [m, g] = Y(!1), { data: _ } = r(), v = Vt(), { run: y } = ee(), b = S(i), x = !c || N(i.conditions, c), w = G(async () => {
|
|
2008
2021
|
if (!(!i.association || s.length === 0)) {
|
|
2009
2022
|
p(!0);
|
|
2010
2023
|
try {
|
|
2011
|
-
let e =
|
|
2012
|
-
if (!
|
|
2013
|
-
|
|
2024
|
+
let e = o ? `${o}.${i.association}` : i.association, t = await fe(e, s), n = a(_, t.target_entity);
|
|
2025
|
+
if (!n) {
|
|
2026
|
+
U.error(`No list screen found for ${t.target_entity}`);
|
|
2014
2027
|
return;
|
|
2015
2028
|
}
|
|
2016
|
-
let
|
|
2017
|
-
if (
|
|
2018
|
-
|
|
2029
|
+
let r = _?.entities[t.target_entity], c = C(i.display?.name) || t.target_entity;
|
|
2030
|
+
if (t.ids.length === 0) {
|
|
2031
|
+
U.info(`No related ${c} found`);
|
|
2019
2032
|
return;
|
|
2020
2033
|
}
|
|
2021
|
-
let
|
|
2022
|
-
|
|
2023
|
-
title:
|
|
2024
|
-
icon: i.display?.icon ||
|
|
2025
|
-
search:
|
|
2034
|
+
let l = r?.fields.names().find((e) => r.fields.get(e)?.primary) ?? "id", u = new URLSearchParams();
|
|
2035
|
+
u.set(`filter_${l}`, t.ids.join(",")), v(n.route, {
|
|
2036
|
+
title: c,
|
|
2037
|
+
icon: i.display?.icon || n.icon,
|
|
2038
|
+
search: u.toString()
|
|
2026
2039
|
}), d?.();
|
|
2027
2040
|
} catch (e) {
|
|
2028
|
-
|
|
2041
|
+
U.error(e instanceof Error ? e.message : "Failed to resolve association");
|
|
2029
2042
|
} finally {
|
|
2030
2043
|
p(!1);
|
|
2031
2044
|
}
|
|
@@ -2037,13 +2050,13 @@ function or({ actionCode: n, action: i, entityCode: o, objectIds: s = [], row: c
|
|
|
2037
2050
|
_,
|
|
2038
2051
|
v,
|
|
2039
2052
|
d
|
|
2040
|
-
]), T = i.entity ? `${i.entity}.${n}` : n, E = s.length > 0 ? s : void 0, D =
|
|
2053
|
+
]), T = i.entity ? `${i.entity}.${n}` : n, E = s.length > 0 ? s : void 0, D = G(() => {
|
|
2041
2054
|
g(!0), y({
|
|
2042
2055
|
action: i,
|
|
2043
2056
|
title: C(i.display?.name) || n,
|
|
2044
2057
|
row: c,
|
|
2045
2058
|
entity: o,
|
|
2046
|
-
execute: (e) => F(T,
|
|
2059
|
+
execute: (e) => F(T, z(e, E)),
|
|
2047
2060
|
onSuccess: () => d?.()
|
|
2048
2061
|
}).finally(() => g(!1));
|
|
2049
2062
|
}, [
|
|
@@ -2055,9 +2068,9 @@ function or({ actionCode: n, action: i, entityCode: o, objectIds: s = [], row: c
|
|
|
2055
2068
|
T,
|
|
2056
2069
|
E,
|
|
2057
2070
|
d
|
|
2058
|
-
]), O =
|
|
2071
|
+
]), O = G(() => {
|
|
2059
2072
|
if (L(i)) {
|
|
2060
|
-
|
|
2073
|
+
ce(i.ui_steps, { row: c }).then(() => d?.());
|
|
2061
2074
|
return;
|
|
2062
2075
|
}
|
|
2063
2076
|
if (b) {
|
|
@@ -2065,8 +2078,8 @@ function or({ actionCode: n, action: i, entityCode: o, objectIds: s = [], row: c
|
|
|
2065
2078
|
return;
|
|
2066
2079
|
}
|
|
2067
2080
|
if (i.href && !i.handler && !i.association) {
|
|
2068
|
-
let e =
|
|
2069
|
-
o && (
|
|
2081
|
+
let e = o ? _?.entities[o] : void 0, t = h(c, e), r = i.href;
|
|
2082
|
+
o && (r = r.replaceAll("${entity}", o)), t && (r = r.replaceAll("${id}", encodeURIComponent(t))), v(r, {
|
|
2070
2083
|
title: C(i.display?.name) || n,
|
|
2071
2084
|
icon: i.display?.icon
|
|
2072
2085
|
}), d?.();
|
|
@@ -2088,11 +2101,11 @@ function or({ actionCode: n, action: i, entityCode: o, objectIds: s = [], row: c
|
|
|
2088
2101
|
name: A,
|
|
2089
2102
|
size: 13
|
|
2090
2103
|
}) : null, P = !x || m || f;
|
|
2091
|
-
return u === "icon" ? /* @__PURE__ */ X(
|
|
2104
|
+
return u === "icon" ? /* @__PURE__ */ X(V, {
|
|
2092
2105
|
icon: M ?? /* @__PURE__ */ X(e.bolt, { size: 13 }),
|
|
2093
2106
|
onClick: O,
|
|
2094
2107
|
title: k
|
|
2095
|
-
}) : /* @__PURE__ */ X(
|
|
2108
|
+
}) : /* @__PURE__ */ X(W, {
|
|
2096
2109
|
kind: l === "default" ? "primary" : l === "ghost" ? "ghost" : "default",
|
|
2097
2110
|
size: "sm",
|
|
2098
2111
|
icon: M,
|
|
@@ -2106,14 +2119,14 @@ function or({ actionCode: n, action: i, entityCode: o, objectIds: s = [], row: c
|
|
|
2106
2119
|
}
|
|
2107
2120
|
//#endregion
|
|
2108
2121
|
//#region src/components/shared/ResponsiveActionBar.tsx
|
|
2109
|
-
function
|
|
2122
|
+
function lr(e, t) {
|
|
2110
2123
|
return e.replace(/\$\{([^}]+)\}/g, (e, n) => Object.prototype.hasOwnProperty.call(t, n) ? t[n] : e);
|
|
2111
2124
|
}
|
|
2112
|
-
function
|
|
2125
|
+
function ur(e) {
|
|
2113
2126
|
return e.widget ? "widget" : e.href ? "href" : e.handler ? "handler" : e.association ? "association" : e.ui_steps && e.ui_steps.length > 0 ? "ui_steps" : "unknown";
|
|
2114
2127
|
}
|
|
2115
|
-
function
|
|
2116
|
-
let a =
|
|
2128
|
+
function dr(e, t, n, r, i) {
|
|
2129
|
+
let a = ur(t), o = h(n, r?.entity), s = r?.entityCode ?? "";
|
|
2117
2130
|
if (e === "__peek") return i?.({
|
|
2118
2131
|
code: e,
|
|
2119
2132
|
entity: s,
|
|
@@ -2127,7 +2140,7 @@ function lr(e, t, n, r, i) {
|
|
|
2127
2140
|
rowId: o
|
|
2128
2141
|
}), a === "widget") return console.warn(`[ResponsiveActionBar] widget "${t.widget}" requested for action "${e}" but the widget registry ships in Phase 2; falling back to onRun.`), !1;
|
|
2129
2142
|
if (a === "href" && r) {
|
|
2130
|
-
let e =
|
|
2143
|
+
let e = lr(t.href ?? "", {
|
|
2131
2144
|
entity: s,
|
|
2132
2145
|
id: encodeURIComponent(o)
|
|
2133
2146
|
}), n = e.indexOf("?");
|
|
@@ -2135,27 +2148,27 @@ function lr(e, t, n, r, i) {
|
|
|
2135
2148
|
}
|
|
2136
2149
|
return a === "handler" || a === "association" || a === "ui_steps" || a === "unknown" && console.warn(`[ResponsiveActionBar] no dispatch mode set on action "${e}" (none of handler/association/widget/href/ui_steps).`), !1;
|
|
2137
2150
|
}
|
|
2138
|
-
function
|
|
2151
|
+
function fr(e) {
|
|
2139
2152
|
let t = 0;
|
|
2140
|
-
for (let n of e) n.kind === "action" ? t++ : t +=
|
|
2153
|
+
for (let n of e) n.kind === "action" ? t++ : t += fr(n.items);
|
|
2141
2154
|
return t;
|
|
2142
2155
|
}
|
|
2143
|
-
function
|
|
2156
|
+
function pr(e, t, n) {
|
|
2144
2157
|
let r = [], i = [];
|
|
2145
|
-
for (let a of e) a.kind === "action" &&
|
|
2158
|
+
for (let a of e) a.kind === "action" && hr(a.code, t, n)?.destructive ? i.push(a) : r.push(a);
|
|
2146
2159
|
return {
|
|
2147
2160
|
normal: r,
|
|
2148
2161
|
destructive: i
|
|
2149
2162
|
};
|
|
2150
2163
|
}
|
|
2151
|
-
function
|
|
2164
|
+
function mr(e, t, n) {
|
|
2152
2165
|
let r = [], i = [], a = [];
|
|
2153
2166
|
for (let o of e) {
|
|
2154
2167
|
if (o.kind !== "action") {
|
|
2155
2168
|
i.push(o);
|
|
2156
2169
|
continue;
|
|
2157
2170
|
}
|
|
2158
|
-
let e =
|
|
2171
|
+
let e = hr(o.code, t, n), s = e?.destructive === !0, c = e?.display?.primary === !0;
|
|
2159
2172
|
if (s && c) {
|
|
2160
2173
|
console.warn(`[ResponsiveActionBar] action "${o.code}" declares both primary and destructive; treating as destructive.`), a.push(o);
|
|
2161
2174
|
continue;
|
|
@@ -2176,32 +2189,33 @@ function fr(e, t, n) {
|
|
|
2176
2189
|
destructive: a
|
|
2177
2190
|
};
|
|
2178
2191
|
}
|
|
2179
|
-
function
|
|
2192
|
+
function hr(e, t, n) {
|
|
2180
2193
|
if (t && e in t) return t[e];
|
|
2181
2194
|
if (n && e in n) return n[e];
|
|
2182
2195
|
}
|
|
2183
|
-
function
|
|
2184
|
-
|
|
2196
|
+
function gr(e, t, n) {
|
|
2197
|
+
let r = hr(e, t, n);
|
|
2198
|
+
return C(r?.display?.name) || e;
|
|
2185
2199
|
}
|
|
2186
|
-
function
|
|
2187
|
-
return
|
|
2200
|
+
function _r(e, t, n) {
|
|
2201
|
+
return hr(e, t, n)?.display?.icon || void 0;
|
|
2188
2202
|
}
|
|
2189
|
-
function
|
|
2203
|
+
function vr(e) {
|
|
2190
2204
|
return `action-tooltip-${e}`;
|
|
2191
2205
|
}
|
|
2192
|
-
function
|
|
2193
|
-
let
|
|
2194
|
-
if (!(!
|
|
2206
|
+
function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, measureRef: s, style: c, row: l, widgetContext: u, onActionClick: d, iconOnly: f = !1 }) {
|
|
2207
|
+
let p = hr(e.code, n, r), m = gr(e.code, n, r), h = _r(e.code, n, r), g = p?.destructive ?? !1, _ = !g && p?.display?.primary === !0, v = !e.enabled, y = v ? vr(e.code) : void 0, b = G(async () => {
|
|
2208
|
+
if (!(!p || v || a)) {
|
|
2195
2209
|
o(!0);
|
|
2196
2210
|
try {
|
|
2197
|
-
|
|
2211
|
+
dr(e.code, p, l, u, d) || await Promise.resolve(i(e.code, p));
|
|
2198
2212
|
} finally {
|
|
2199
2213
|
o(!1);
|
|
2200
2214
|
}
|
|
2201
2215
|
}
|
|
2202
2216
|
}, [
|
|
2203
|
-
|
|
2204
|
-
|
|
2217
|
+
p,
|
|
2218
|
+
v,
|
|
2205
2219
|
a,
|
|
2206
2220
|
i,
|
|
2207
2221
|
e.code,
|
|
@@ -2209,12 +2223,12 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2209
2223
|
l,
|
|
2210
2224
|
u,
|
|
2211
2225
|
d
|
|
2212
|
-
]),
|
|
2213
|
-
name:
|
|
2226
|
+
]), x = a ? /* @__PURE__ */ X(A, { size: 12 }) : h ? /* @__PURE__ */ X(t, {
|
|
2227
|
+
name: h,
|
|
2214
2228
|
size: 12
|
|
2215
2229
|
}) : null;
|
|
2216
|
-
return /* @__PURE__ */ Z(
|
|
2217
|
-
id:
|
|
2230
|
+
return /* @__PURE__ */ Z(We, { children: [y && e.reason && /* @__PURE__ */ X("span", {
|
|
2231
|
+
id: y,
|
|
2218
2232
|
role: "tooltip",
|
|
2219
2233
|
style: {
|
|
2220
2234
|
position: "absolute",
|
|
@@ -2224,25 +2238,26 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2224
2238
|
clip: "rect(0,0,0,0)"
|
|
2225
2239
|
},
|
|
2226
2240
|
children: e.reason
|
|
2227
|
-
}), /* @__PURE__ */ X(
|
|
2241
|
+
}), /* @__PURE__ */ X(W, {
|
|
2228
2242
|
ref: s,
|
|
2229
|
-
kind:
|
|
2230
|
-
danger:
|
|
2231
|
-
icon:
|
|
2232
|
-
disabled:
|
|
2233
|
-
"aria-disabled":
|
|
2234
|
-
"aria-describedby":
|
|
2235
|
-
|
|
2236
|
-
|
|
2243
|
+
kind: _ ? "primary" : "default",
|
|
2244
|
+
danger: g,
|
|
2245
|
+
icon: x,
|
|
2246
|
+
disabled: v || a,
|
|
2247
|
+
"aria-disabled": v ? "true" : void 0,
|
|
2248
|
+
"aria-describedby": y,
|
|
2249
|
+
"aria-label": f ? m : void 0,
|
|
2250
|
+
title: R(p, m, v, e.reason, f),
|
|
2251
|
+
onClick: b,
|
|
2237
2252
|
style: c,
|
|
2238
|
-
children:
|
|
2253
|
+
children: f ? null : m
|
|
2239
2254
|
})] });
|
|
2240
2255
|
}
|
|
2241
|
-
function
|
|
2242
|
-
let p =
|
|
2256
|
+
function br({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o, onLoadingChange: s, measureRef: c, style: l, row: u, widgetContext: d, onActionClick: f }) {
|
|
2257
|
+
let p = J(null), [m, h] = Y(!1), g = n.name ? C(n.name) : "Actions", _ = G((e) => {
|
|
2243
2258
|
p.current = e, c?.(e);
|
|
2244
|
-
}, [c]), v =
|
|
2245
|
-
return /* @__PURE__ */ Z(
|
|
2259
|
+
}, [c]), v = G((e, t) => (h(!1), a(e, t)), [a]);
|
|
2260
|
+
return /* @__PURE__ */ Z(We, { children: [/* @__PURE__ */ X(W, {
|
|
2246
2261
|
ref: _,
|
|
2247
2262
|
kind: "default",
|
|
2248
2263
|
icon: o == null ? n.icon ? /* @__PURE__ */ X(t, {
|
|
@@ -2256,7 +2271,7 @@ function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
|
|
|
2256
2271
|
onClick: () => h((e) => !e),
|
|
2257
2272
|
style: l,
|
|
2258
2273
|
children: g
|
|
2259
|
-
}), /* @__PURE__ */ X(
|
|
2274
|
+
}), /* @__PURE__ */ X(H, {
|
|
2260
2275
|
open: m,
|
|
2261
2276
|
anchor: p.current,
|
|
2262
2277
|
onClose: () => h(!1),
|
|
@@ -2265,7 +2280,7 @@ function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
|
|
|
2265
2280
|
children: /* @__PURE__ */ X("div", {
|
|
2266
2281
|
role: "menu",
|
|
2267
2282
|
"aria-label": g,
|
|
2268
|
-
children: n.items.map((e) => e.kind === "action" ? /* @__PURE__ */ X(
|
|
2283
|
+
children: n.items.map((e) => e.kind === "action" ? /* @__PURE__ */ X(xr, {
|
|
2269
2284
|
leaf: e,
|
|
2270
2285
|
entityActions: r,
|
|
2271
2286
|
globalActions: i,
|
|
@@ -2275,7 +2290,7 @@ function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
|
|
|
2275
2290
|
row: u,
|
|
2276
2291
|
widgetContext: d,
|
|
2277
2292
|
onActionClick: f
|
|
2278
|
-
}, e.code) : /* @__PURE__ */ X(
|
|
2293
|
+
}, e.code) : /* @__PURE__ */ X(Sr, {
|
|
2279
2294
|
group: e,
|
|
2280
2295
|
entityActions: r,
|
|
2281
2296
|
globalActions: i,
|
|
@@ -2289,12 +2304,12 @@ function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
|
|
|
2289
2304
|
})
|
|
2290
2305
|
})] });
|
|
2291
2306
|
}
|
|
2292
|
-
function
|
|
2293
|
-
let u =
|
|
2307
|
+
function xr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, row: s, widgetContext: c, onActionClick: l }) {
|
|
2308
|
+
let u = hr(e.code, n, r), d = gr(e.code, n, r), f = _r(e.code, n, r), p = u?.destructive ?? !1, m = !e.enabled, h = m ? vr(e.code) : void 0, g = a ? /* @__PURE__ */ X(A, { size: 12 }) : f ? /* @__PURE__ */ X(t, {
|
|
2294
2309
|
name: f,
|
|
2295
2310
|
size: 12
|
|
2296
2311
|
}) : null;
|
|
2297
|
-
return /* @__PURE__ */ Z(
|
|
2312
|
+
return /* @__PURE__ */ Z(We, { children: [h && e.reason && /* @__PURE__ */ X("span", {
|
|
2298
2313
|
id: h,
|
|
2299
2314
|
role: "tooltip",
|
|
2300
2315
|
style: {
|
|
@@ -2309,12 +2324,12 @@ function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2309
2324
|
role: "menuitem",
|
|
2310
2325
|
"aria-disabled": m ? "true" : void 0,
|
|
2311
2326
|
"aria-describedby": h,
|
|
2312
|
-
title:
|
|
2327
|
+
title: R(u, d, m, e.reason),
|
|
2313
2328
|
onClick: async () => {
|
|
2314
2329
|
if (!(!u || m || a)) {
|
|
2315
2330
|
o(!0);
|
|
2316
2331
|
try {
|
|
2317
|
-
|
|
2332
|
+
dr(e.code, u, s, c, l) || await Promise.resolve(i(e.code, u));
|
|
2318
2333
|
} finally {
|
|
2319
2334
|
o(!1);
|
|
2320
2335
|
}
|
|
@@ -2349,9 +2364,9 @@ function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2349
2364
|
})]
|
|
2350
2365
|
})] });
|
|
2351
2366
|
}
|
|
2352
|
-
function
|
|
2367
|
+
function Sr({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c }) {
|
|
2353
2368
|
let l = e.name ? C(e.name) : void 0;
|
|
2354
|
-
return /* @__PURE__ */ Z(
|
|
2369
|
+
return /* @__PURE__ */ Z(We, { children: [l && /* @__PURE__ */ X("div", {
|
|
2355
2370
|
style: {
|
|
2356
2371
|
padding: "4px 10px 2px",
|
|
2357
2372
|
fontSize: 10.5,
|
|
@@ -2361,7 +2376,7 @@ function br({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i
|
|
|
2361
2376
|
letterSpacing: "0.05em"
|
|
2362
2377
|
},
|
|
2363
2378
|
children: l
|
|
2364
|
-
}), e.items.map((e) => e.kind === "action" ? /* @__PURE__ */ X(
|
|
2379
|
+
}), e.items.map((e) => e.kind === "action" ? /* @__PURE__ */ X(xr, {
|
|
2365
2380
|
leaf: e,
|
|
2366
2381
|
entityActions: t,
|
|
2367
2382
|
globalActions: n,
|
|
@@ -2371,7 +2386,7 @@ function br({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i
|
|
|
2371
2386
|
row: o,
|
|
2372
2387
|
widgetContext: s,
|
|
2373
2388
|
onActionClick: c
|
|
2374
|
-
}, e.code) : /* @__PURE__ */ X(
|
|
2389
|
+
}, e.code) : /* @__PURE__ */ X(Sr, {
|
|
2375
2390
|
group: e,
|
|
2376
2391
|
entityActions: t,
|
|
2377
2392
|
globalActions: n,
|
|
@@ -2383,26 +2398,27 @@ function br({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i
|
|
|
2383
2398
|
onActionClick: c
|
|
2384
2399
|
}, e.icon ?? "nested"))] });
|
|
2385
2400
|
}
|
|
2386
|
-
function
|
|
2387
|
-
let c =
|
|
2388
|
-
return
|
|
2401
|
+
function Cr({ layout: t, entityActions: n, globalActions: r, onRun: i, row: a, widgetContext: o, onActionClick: s }) {
|
|
2402
|
+
let c = J(null), [l, u] = Y(!1), [d, f] = Y(null), p = G((e, t) => (u(!1), i(e, t)), [i]);
|
|
2403
|
+
return fr(t) === 0 ? null : /* @__PURE__ */ Z("div", {
|
|
2404
|
+
"data-open": l ? "true" : void 0,
|
|
2389
2405
|
style: {
|
|
2390
2406
|
display: "inline-flex",
|
|
2391
2407
|
alignItems: "center"
|
|
2392
2408
|
},
|
|
2393
|
-
children: [/* @__PURE__ */ X(
|
|
2409
|
+
children: [/* @__PURE__ */ X(V, {
|
|
2394
2410
|
ref: c,
|
|
2395
2411
|
icon: X(d == null ? e.more : A, { size: 14 }),
|
|
2396
2412
|
title: "Actions",
|
|
2397
2413
|
size: 28,
|
|
2398
2414
|
onClick: () => u((e) => !e)
|
|
2399
|
-
}), /* @__PURE__ */ X(
|
|
2415
|
+
}), /* @__PURE__ */ X(H, {
|
|
2400
2416
|
open: l,
|
|
2401
2417
|
anchor: c.current,
|
|
2402
2418
|
onClose: () => u(!1),
|
|
2403
2419
|
align: "end",
|
|
2404
2420
|
width: 220,
|
|
2405
|
-
children: /* @__PURE__ */ X(
|
|
2421
|
+
children: /* @__PURE__ */ X(Tr, {
|
|
2406
2422
|
layout: t,
|
|
2407
2423
|
entityActions: n,
|
|
2408
2424
|
globalActions: r,
|
|
@@ -2416,14 +2432,14 @@ function xr({ layout: t, entityActions: n, globalActions: r, onRun: i, row: a, w
|
|
|
2416
2432
|
})]
|
|
2417
2433
|
});
|
|
2418
2434
|
}
|
|
2419
|
-
function
|
|
2435
|
+
function wr(e) {
|
|
2420
2436
|
let t = 0;
|
|
2421
2437
|
for (let n of e) if (n.kind === "action" && s(n.code)) t++;
|
|
2422
2438
|
else break;
|
|
2423
2439
|
return t;
|
|
2424
2440
|
}
|
|
2425
|
-
function
|
|
2426
|
-
let { normal: u, destructive: d } =
|
|
2441
|
+
function Tr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c, ariaLabel: l = "Row actions" }) {
|
|
2442
|
+
let { normal: u, destructive: d } = pr(e, t, n), f = wr(u), p = u.slice(0, f), m = u.slice(f), h = d.length > 0, g = m.length > 0, v = (e) => /* @__PURE__ */ X(xr, {
|
|
2427
2443
|
leaf: e,
|
|
2428
2444
|
entityActions: t,
|
|
2429
2445
|
globalActions: n,
|
|
@@ -2440,7 +2456,7 @@ function Cr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading:
|
|
|
2440
2456
|
children: [
|
|
2441
2457
|
p.map((e) => e.kind === "action" ? v(e) : null),
|
|
2442
2458
|
p.length > 0 && g && /* @__PURE__ */ X(_, { divider: !0 }),
|
|
2443
|
-
m.map((e) => e.kind === "action" ? v(e) : /* @__PURE__ */ X(
|
|
2459
|
+
m.map((e) => e.kind === "action" ? v(e) : /* @__PURE__ */ X(Sr, {
|
|
2444
2460
|
group: e,
|
|
2445
2461
|
entityActions: t,
|
|
2446
2462
|
globalActions: n,
|
|
@@ -2456,136 +2472,173 @@ function Cr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading:
|
|
|
2456
2472
|
]
|
|
2457
2473
|
});
|
|
2458
2474
|
}
|
|
2459
|
-
var
|
|
2460
|
-
function
|
|
2461
|
-
return e
|
|
2475
|
+
var Er = "__overflow_trigger__", Dr = 90, Or = 4, kr = 8;
|
|
2476
|
+
function Ar(e) {
|
|
2477
|
+
return `icon:${Q(e)}`;
|
|
2462
2478
|
}
|
|
2463
|
-
function
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2479
|
+
function jr() {
|
|
2480
|
+
return kr;
|
|
2481
|
+
}
|
|
2482
|
+
function Mr(e, t, n) {
|
|
2483
|
+
return [
|
|
2484
|
+
...e,
|
|
2485
|
+
...t,
|
|
2486
|
+
...n
|
|
2487
|
+
];
|
|
2488
|
+
}
|
|
2489
|
+
function Nr(e, t) {
|
|
2490
|
+
return t.get(Q(e)) ?? 0;
|
|
2491
|
+
}
|
|
2492
|
+
function Pr(e, t) {
|
|
2493
|
+
return t.get(Ar(e));
|
|
2494
|
+
}
|
|
2495
|
+
function Fr(e, t, n, r, i, a, o, s, c) {
|
|
2496
|
+
let { primary: l, regular: u, destructive: d } = mr(e, i, a), f = Or, p = r.get(Er) ?? Dr, m = t - n, h = Mr(l, u, d), g = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Set();
|
|
2497
|
+
if (o) for (let e of h) o(e) && g.add(Q(e));
|
|
2498
|
+
else {
|
|
2499
|
+
let e = c ?? h.length, t = (e, t) => t ? Pr(e, r) ?? Nr(e, r) : Nr(e, r), n = (e) => s ? e.filter((e) => !s.has(Q(e))).length * jr() : 0, i = (e, r) => {
|
|
2500
|
+
let i = e.length < h.length ? p + f : 0, a = e.length > 1 ? (e.length - 1) * f : 0;
|
|
2501
|
+
return e.reduce((e, n, i) => e + t(n, i >= r), 0) + a + i + n(e) <= m;
|
|
2502
|
+
}, a = 0, o = !1;
|
|
2503
|
+
for (let t = Math.min(e, h.length); t >= 1 && a === 0; t--) i(h.slice(0, t), 1) ? a = t : i(h.slice(0, t), 0) && (a = t, o = !0);
|
|
2504
|
+
let l = o ? 0 : Math.min(1, a), u = h.slice(0, a);
|
|
2505
|
+
for (; l < a && i(u, l + 1);) l++;
|
|
2506
|
+
u.forEach((e, t) => {
|
|
2507
|
+
let n = Q(e);
|
|
2508
|
+
g.add(n), t >= l && _.add(n);
|
|
2509
|
+
});
|
|
2473
2510
|
}
|
|
2511
|
+
let v = (e) => g.has(Q(e)), y = [
|
|
2512
|
+
...l,
|
|
2513
|
+
...u,
|
|
2514
|
+
...d
|
|
2515
|
+
].filter((e) => !v(e));
|
|
2474
2516
|
return {
|
|
2475
|
-
primaryInline:
|
|
2476
|
-
inline:
|
|
2477
|
-
overflow:
|
|
2478
|
-
destructiveInline:
|
|
2517
|
+
primaryInline: l.filter(v),
|
|
2518
|
+
inline: u.filter(v),
|
|
2519
|
+
overflow: y,
|
|
2520
|
+
destructiveInline: d.filter(v),
|
|
2521
|
+
iconOnly: _
|
|
2479
2522
|
};
|
|
2480
2523
|
}
|
|
2481
2524
|
function Q(e) {
|
|
2482
2525
|
return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? C(e.name) : ""}`;
|
|
2483
2526
|
}
|
|
2484
|
-
function
|
|
2485
|
-
let m =
|
|
2486
|
-
|
|
2527
|
+
function Ir({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedRightWidth: o = 0, measurementOverride: s, ariaLabel: c = "Actions", align: l = "trailing", constrain: u = !0, row: d, widgetContext: f, onActionClick: p }) {
|
|
2528
|
+
let m = J(null), h = J(null), [g, v] = Y(0), [y, b] = Y(/* @__PURE__ */ new Map()), [x, S] = Y(!1), [w, T] = Y(null), [E, D] = Y(() => typeof document < "u" && document.documentElement.dir === "rtl");
|
|
2529
|
+
K(() => {
|
|
2487
2530
|
if (typeof MutationObserver > "u") return;
|
|
2488
2531
|
let e = new MutationObserver((e) => {
|
|
2489
|
-
for (let t of e) t.attributeName === "dir" &&
|
|
2532
|
+
for (let t of e) t.attributeName === "dir" && D(document.documentElement.dir === "rtl"), t.attributeName === "lang" && S(!1);
|
|
2490
2533
|
});
|
|
2491
2534
|
return e.observe(document.documentElement, {
|
|
2492
2535
|
attributes: !0,
|
|
2493
2536
|
attributeFilter: ["dir", "lang"]
|
|
2494
2537
|
}), () => e.disconnect();
|
|
2495
2538
|
}, []);
|
|
2496
|
-
let
|
|
2497
|
-
if (
|
|
2539
|
+
let O = J(null), [k, A] = Y(!1), j = G((e, t) => (A(!1), a(e, t)), [a]), M = fr(n), N = !!s, P = G(() => {
|
|
2540
|
+
if (N || !h.current) return;
|
|
2498
2541
|
let e = Array.from(h.current.children), t = /* @__PURE__ */ new Map();
|
|
2499
2542
|
e.forEach((e) => {
|
|
2500
2543
|
let n = e.dataset.nodeKey;
|
|
2501
2544
|
n && t.set(n, e.getBoundingClientRect().width || e.offsetWidth);
|
|
2502
|
-
}),
|
|
2503
|
-
}, [
|
|
2545
|
+
}), b(t), S(!0);
|
|
2546
|
+
}, [N]), F = q(() => JSON.stringify(n.map((e) => Q(e))), [n]);
|
|
2504
2547
|
Le(() => {
|
|
2505
|
-
if (
|
|
2506
|
-
|
|
2548
|
+
if (N) {
|
|
2549
|
+
S(!0);
|
|
2507
2550
|
return;
|
|
2508
2551
|
}
|
|
2509
|
-
|
|
2552
|
+
S(!1);
|
|
2510
2553
|
let e = requestAnimationFrame(() => {
|
|
2511
|
-
|
|
2554
|
+
P();
|
|
2512
2555
|
});
|
|
2513
2556
|
return () => cancelAnimationFrame(e);
|
|
2514
2557
|
}, [
|
|
2558
|
+
F,
|
|
2515
2559
|
P,
|
|
2516
|
-
N
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
if (M || b) return;
|
|
2560
|
+
N
|
|
2561
|
+
]), K(() => {
|
|
2562
|
+
if (N || x) return;
|
|
2520
2563
|
let e = setTimeout(() => {
|
|
2521
|
-
|
|
2564
|
+
P(), S(!0);
|
|
2522
2565
|
}, 16);
|
|
2523
2566
|
return () => clearTimeout(e);
|
|
2524
2567
|
}, [
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
]),
|
|
2529
|
-
if (
|
|
2568
|
+
x,
|
|
2569
|
+
P,
|
|
2570
|
+
N
|
|
2571
|
+
]), K(() => {
|
|
2572
|
+
if (N || !u || !x || g === 0) return;
|
|
2530
2573
|
let e = m.current;
|
|
2531
2574
|
if (!e) return;
|
|
2532
2575
|
let t = [...e.children].filter((e) => e.getAttribute("aria-hidden") !== "true"), n = t.length > 1 ? (t.length - 1) * 4 : 0, r = t.reduce((e, t) => e + t.getBoundingClientRect().width, 0) + n;
|
|
2533
2576
|
r > 0 && Math.abs(g - r) < 1 && console.error(`[declarion] ResponsiveActionBar is measuring itself: its container is ${Math.round(g)}px, exactly the width of what it just rendered. The slot holding this bar is sized by its own content, so it cannot tell the bar how much room there is. Give that slot \`flex: 1 1 auto; min-width: 0\` (and justify its content to the edge the buttons sit on), or pass \`constrain={false}\` if it genuinely has no row to take space from.`);
|
|
2534
2577
|
}, [
|
|
2535
|
-
|
|
2578
|
+
N,
|
|
2536
2579
|
u,
|
|
2537
|
-
|
|
2580
|
+
x,
|
|
2538
2581
|
g,
|
|
2539
|
-
|
|
2540
|
-
]),
|
|
2541
|
-
if (
|
|
2582
|
+
y
|
|
2583
|
+
]), K(() => {
|
|
2584
|
+
if (N) return;
|
|
2542
2585
|
let e = m.current;
|
|
2543
2586
|
if (!e) return;
|
|
2544
2587
|
if (typeof ResizeObserver > "u") {
|
|
2545
|
-
|
|
2588
|
+
v(e.getBoundingClientRect().width);
|
|
2546
2589
|
return;
|
|
2547
2590
|
}
|
|
2548
2591
|
let t = new ResizeObserver((e) => {
|
|
2549
2592
|
let t = e[0];
|
|
2550
|
-
t &&
|
|
2593
|
+
t && v(t.contentRect.width);
|
|
2551
2594
|
});
|
|
2552
|
-
return t.observe(e),
|
|
2553
|
-
}, [
|
|
2554
|
-
let
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
}, [
|
|
2558
|
-
let
|
|
2595
|
+
return t.observe(e), v(e.getBoundingClientRect().width), () => t.disconnect();
|
|
2596
|
+
}, [N]);
|
|
2597
|
+
let I = J(void 0);
|
|
2598
|
+
K(() => {
|
|
2599
|
+
I.current = void 0;
|
|
2600
|
+
}, [F]);
|
|
2601
|
+
let L = q(() => N || !u ? Fr(n, 2 ** 53 - 1, o, y, r, i, s) : x ? g === 0 ? Fr(n, 2 ** 53 - 1, o, y, r, i, s) : Fr(n, g, o, y, r, i, s, I.current) : {
|
|
2559
2602
|
primaryInline: [],
|
|
2560
2603
|
inline: [],
|
|
2561
2604
|
overflow: [],
|
|
2562
|
-
destructiveInline: []
|
|
2605
|
+
destructiveInline: [],
|
|
2606
|
+
iconOnly: /* @__PURE__ */ new Set()
|
|
2563
2607
|
}, [
|
|
2564
|
-
|
|
2608
|
+
N,
|
|
2565
2609
|
u,
|
|
2566
|
-
|
|
2610
|
+
x,
|
|
2567
2611
|
g,
|
|
2568
2612
|
n,
|
|
2569
2613
|
o,
|
|
2570
|
-
|
|
2614
|
+
y,
|
|
2571
2615
|
r,
|
|
2572
2616
|
i,
|
|
2573
2617
|
s
|
|
2574
2618
|
]);
|
|
2575
|
-
if (
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2619
|
+
if (K(() => {
|
|
2620
|
+
!x && !N || (I.current = new Set([
|
|
2621
|
+
...L.primaryInline,
|
|
2622
|
+
...L.inline,
|
|
2623
|
+
...L.destructiveInline
|
|
2624
|
+
].map(Q)));
|
|
2625
|
+
}, [
|
|
2626
|
+
L,
|
|
2627
|
+
x,
|
|
2628
|
+
N
|
|
2629
|
+
]), M === 0) return null;
|
|
2630
|
+
let R = L.overflow.length > 0, { normal: z, destructive: ee } = pr(L.overflow, r, i);
|
|
2579
2631
|
return /* @__PURE__ */ Z("div", {
|
|
2580
2632
|
ref: m,
|
|
2581
2633
|
role: "toolbar",
|
|
2582
2634
|
"aria-label": c,
|
|
2583
2635
|
style: {
|
|
2584
2636
|
display: "flex",
|
|
2585
|
-
flexDirection:
|
|
2637
|
+
flexDirection: E ? "row-reverse" : "row",
|
|
2586
2638
|
alignItems: "center",
|
|
2587
|
-
gap:
|
|
2588
|
-
|
|
2639
|
+
gap: Or,
|
|
2640
|
+
flexWrap: "wrap",
|
|
2641
|
+
visibility: x || N ? "visible" : "hidden",
|
|
2589
2642
|
position: "relative",
|
|
2590
2643
|
flex: u ? "1 1 auto" : "0 1 auto",
|
|
2591
2644
|
justifyContent: l === "trailing" ? "flex-end" : "flex-start",
|
|
@@ -2605,28 +2658,34 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
|
|
|
2605
2658
|
top: 0,
|
|
2606
2659
|
left: 0
|
|
2607
2660
|
},
|
|
2608
|
-
children: [/* @__PURE__ */ X(
|
|
2609
|
-
"data-node-key":
|
|
2661
|
+
children: [/* @__PURE__ */ X(W, {
|
|
2662
|
+
"data-node-key": Er,
|
|
2610
2663
|
iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
|
|
2611
2664
|
tabIndex: -1,
|
|
2612
2665
|
children: "Actions"
|
|
2613
|
-
},
|
|
2666
|
+
}, Er), n.map((n) => {
|
|
2614
2667
|
let a = Q(n);
|
|
2615
2668
|
if (n.kind === "action") {
|
|
2616
|
-
let e =
|
|
2617
|
-
|
|
2669
|
+
let e = hr(n.code, r, i), o = gr(n.code, r, i), s = _r(n.code, r, i), c = s ? /* @__PURE__ */ X(t, {
|
|
2670
|
+
name: s,
|
|
2671
|
+
size: 12
|
|
2672
|
+
}) : null;
|
|
2673
|
+
return /* @__PURE__ */ Z(Ne, { children: [/* @__PURE__ */ X(W, {
|
|
2618
2674
|
"data-node-key": a,
|
|
2619
|
-
icon:
|
|
2620
|
-
name: s,
|
|
2621
|
-
size: 12
|
|
2622
|
-
}) : null,
|
|
2675
|
+
icon: c,
|
|
2623
2676
|
danger: e?.destructive,
|
|
2624
2677
|
tabIndex: -1,
|
|
2625
2678
|
children: o
|
|
2626
|
-
},
|
|
2627
|
-
|
|
2679
|
+
}), c && /* @__PURE__ */ X(W, {
|
|
2680
|
+
"data-node-key": Ar(n),
|
|
2681
|
+
icon: c,
|
|
2682
|
+
danger: e?.destructive,
|
|
2683
|
+
tabIndex: -1
|
|
2684
|
+
})] }, a);
|
|
2685
|
+
}
|
|
2686
|
+
{
|
|
2628
2687
|
let t = n.name ? C(n.name) : "Actions";
|
|
2629
|
-
return /* @__PURE__ */ X(
|
|
2688
|
+
return /* @__PURE__ */ X(W, {
|
|
2630
2689
|
"data-node-key": a,
|
|
2631
2690
|
iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
|
|
2632
2691
|
tabIndex: -1,
|
|
@@ -2635,96 +2694,103 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
|
|
|
2635
2694
|
}
|
|
2636
2695
|
})]
|
|
2637
2696
|
}),
|
|
2638
|
-
|
|
2697
|
+
L.primaryInline.map((e) => /* @__PURE__ */ X(yr, {
|
|
2639
2698
|
leaf: e,
|
|
2640
2699
|
entityActions: r,
|
|
2641
2700
|
globalActions: i,
|
|
2642
2701
|
onRun: a,
|
|
2643
|
-
loading:
|
|
2644
|
-
onLoadingChange: (t) =>
|
|
2702
|
+
loading: w === e.code,
|
|
2703
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
2645
2704
|
row: d,
|
|
2646
2705
|
widgetContext: f,
|
|
2647
|
-
onActionClick: p
|
|
2706
|
+
onActionClick: p,
|
|
2707
|
+
iconOnly: L.iconOnly.has(Q(e))
|
|
2648
2708
|
}, Q(e))),
|
|
2649
|
-
|
|
2709
|
+
L.inline.map((e) => {
|
|
2650
2710
|
let t = Q(e);
|
|
2651
|
-
return e.kind === "action" ? /* @__PURE__ */ X(
|
|
2711
|
+
return e.kind === "action" ? /* @__PURE__ */ X(yr, {
|
|
2652
2712
|
leaf: e,
|
|
2653
2713
|
entityActions: r,
|
|
2654
2714
|
globalActions: i,
|
|
2655
2715
|
onRun: a,
|
|
2656
|
-
loading:
|
|
2657
|
-
onLoadingChange: (t) =>
|
|
2716
|
+
loading: w === e.code,
|
|
2717
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
2658
2718
|
row: d,
|
|
2659
2719
|
widgetContext: f,
|
|
2660
|
-
onActionClick: p
|
|
2661
|
-
|
|
2720
|
+
onActionClick: p,
|
|
2721
|
+
iconOnly: L.iconOnly.has(t)
|
|
2722
|
+
}, t) : /* @__PURE__ */ X(br, {
|
|
2662
2723
|
group: e,
|
|
2663
2724
|
entityActions: r,
|
|
2664
2725
|
globalActions: i,
|
|
2665
2726
|
onRun: a,
|
|
2666
|
-
loading:
|
|
2667
|
-
onLoadingChange:
|
|
2727
|
+
loading: w,
|
|
2728
|
+
onLoadingChange: T,
|
|
2668
2729
|
row: d,
|
|
2669
2730
|
widgetContext: f,
|
|
2670
2731
|
onActionClick: p
|
|
2671
2732
|
}, t);
|
|
2672
2733
|
}),
|
|
2673
|
-
|
|
2674
|
-
ref:
|
|
2734
|
+
R && /* @__PURE__ */ Z(We, { children: [/* @__PURE__ */ X(W, {
|
|
2735
|
+
ref: O,
|
|
2675
2736
|
kind: "default",
|
|
2676
2737
|
iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
|
|
2677
2738
|
"aria-haspopup": "menu",
|
|
2678
|
-
"aria-expanded":
|
|
2679
|
-
onClick: () =>
|
|
2739
|
+
"aria-expanded": k ? "true" : "false",
|
|
2740
|
+
onClick: () => A((e) => !e),
|
|
2680
2741
|
children: "Actions"
|
|
2681
|
-
}), /* @__PURE__ */ X(
|
|
2682
|
-
open:
|
|
2683
|
-
anchor:
|
|
2684
|
-
onClose: () =>
|
|
2685
|
-
align:
|
|
2742
|
+
}), /* @__PURE__ */ X(H, {
|
|
2743
|
+
open: k,
|
|
2744
|
+
anchor: O.current,
|
|
2745
|
+
onClose: () => A(!1),
|
|
2746
|
+
align: E ? "start" : "end",
|
|
2686
2747
|
width: 220,
|
|
2687
2748
|
children: /* @__PURE__ */ X("div", {
|
|
2688
2749
|
role: "menu",
|
|
2689
2750
|
"aria-label": "More actions",
|
|
2690
|
-
children:
|
|
2751
|
+
children: [
|
|
2752
|
+
...z,
|
|
2753
|
+
...ee.length > 0 ? [null] : [],
|
|
2754
|
+
...ee
|
|
2755
|
+
].map((e, t) => e === null ? /* @__PURE__ */ X(_, { divider: !0 }, "destructive-divider") : e.kind === "action" ? /* @__PURE__ */ X(xr, {
|
|
2691
2756
|
leaf: e,
|
|
2692
2757
|
entityActions: r,
|
|
2693
2758
|
globalActions: i,
|
|
2694
|
-
onRun:
|
|
2695
|
-
loading:
|
|
2696
|
-
onLoadingChange: (t) =>
|
|
2759
|
+
onRun: j,
|
|
2760
|
+
loading: w === e.code,
|
|
2761
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
2697
2762
|
row: d,
|
|
2698
2763
|
widgetContext: f,
|
|
2699
2764
|
onActionClick: p
|
|
2700
|
-
}, e.code) : /* @__PURE__ */ X(
|
|
2765
|
+
}, e.code) : /* @__PURE__ */ X(Sr, {
|
|
2701
2766
|
group: e,
|
|
2702
2767
|
entityActions: r,
|
|
2703
2768
|
globalActions: i,
|
|
2704
|
-
onRun:
|
|
2705
|
-
loading:
|
|
2706
|
-
onLoadingChange:
|
|
2769
|
+
onRun: j,
|
|
2770
|
+
loading: w,
|
|
2771
|
+
onLoadingChange: T,
|
|
2707
2772
|
row: d,
|
|
2708
2773
|
widgetContext: f,
|
|
2709
2774
|
onActionClick: p
|
|
2710
|
-
}, Q(e)))
|
|
2775
|
+
}, `${Q(e)}-${t}`))
|
|
2711
2776
|
})
|
|
2712
2777
|
})] }),
|
|
2713
|
-
|
|
2778
|
+
L.destructiveInline.map((e) => /* @__PURE__ */ X(yr, {
|
|
2714
2779
|
leaf: e,
|
|
2715
2780
|
entityActions: r,
|
|
2716
2781
|
globalActions: i,
|
|
2717
2782
|
onRun: a,
|
|
2718
|
-
loading:
|
|
2719
|
-
onLoadingChange: (t) =>
|
|
2783
|
+
loading: w === e.code,
|
|
2784
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
2720
2785
|
row: d,
|
|
2721
2786
|
widgetContext: f,
|
|
2722
|
-
onActionClick: p
|
|
2787
|
+
onActionClick: p,
|
|
2788
|
+
iconOnly: L.iconOnly.has(Q(e))
|
|
2723
2789
|
}, Q(e)))
|
|
2724
2790
|
]
|
|
2725
2791
|
});
|
|
2726
2792
|
}
|
|
2727
|
-
function
|
|
2793
|
+
function Lr({ layout: e, rowSelection: t = [], ...n }) {
|
|
2728
2794
|
let r = t.length > 0;
|
|
2729
2795
|
return /* @__PURE__ */ Z("div", {
|
|
2730
2796
|
style: {
|
|
@@ -2740,7 +2806,7 @@ function Ar({ layout: e, rowSelection: t = [], ...n }) {
|
|
|
2740
2806
|
flex: "1 1 auto",
|
|
2741
2807
|
minWidth: 0
|
|
2742
2808
|
},
|
|
2743
|
-
children: /* @__PURE__ */ X(
|
|
2809
|
+
children: /* @__PURE__ */ X(Ir, {
|
|
2744
2810
|
layout: e,
|
|
2745
2811
|
rowSelection: [],
|
|
2746
2812
|
...n
|
|
@@ -2752,7 +2818,7 @@ function Ar({ layout: e, rowSelection: t = [], ...n }) {
|
|
|
2752
2818
|
flex: "1 1 auto",
|
|
2753
2819
|
minWidth: 0
|
|
2754
2820
|
},
|
|
2755
|
-
children: /* @__PURE__ */ X(
|
|
2821
|
+
children: /* @__PURE__ */ X(Ir, {
|
|
2756
2822
|
layout: e,
|
|
2757
2823
|
rowSelection: t,
|
|
2758
2824
|
...n
|
|
@@ -2760,9 +2826,9 @@ function Ar({ layout: e, rowSelection: t = [], ...n }) {
|
|
|
2760
2826
|
})]
|
|
2761
2827
|
});
|
|
2762
2828
|
}
|
|
2763
|
-
function
|
|
2764
|
-
let m =
|
|
2765
|
-
return a === "row" ? /* @__PURE__ */ X(
|
|
2829
|
+
function Rr({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth: i = 0, kind: a = "toolbar", align: o = "trailing", constrain: s = !0, measurementOverride: c, entityActions: l, globalActions: u, ariaLabel: d = "Actions", widgetContext: f, onActionClick: p }) {
|
|
2830
|
+
let m = fr(e);
|
|
2831
|
+
return a === "row" ? /* @__PURE__ */ X(Cr, {
|
|
2766
2832
|
layout: e,
|
|
2767
2833
|
entityActions: l,
|
|
2768
2834
|
globalActions: u,
|
|
@@ -2770,7 +2836,7 @@ function jr({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth:
|
|
|
2770
2836
|
row: t,
|
|
2771
2837
|
widgetContext: f,
|
|
2772
2838
|
onActionClick: p
|
|
2773
|
-
}) : m === 0 ? null : X(a === "toolbar" ?
|
|
2839
|
+
}) : m === 0 ? null : X(a === "toolbar" ? Lr : Ir, {
|
|
2774
2840
|
layout: e,
|
|
2775
2841
|
row: t,
|
|
2776
2842
|
rowSelection: n,
|
|
@@ -2787,71 +2853,230 @@ function jr({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth:
|
|
|
2787
2853
|
});
|
|
2788
2854
|
}
|
|
2789
2855
|
//#endregion
|
|
2856
|
+
//#region src/lib/filter-evaluator.ts
|
|
2857
|
+
var zr = /* @__PURE__ */ new Set([
|
|
2858
|
+
"string",
|
|
2859
|
+
"text",
|
|
2860
|
+
"rich_text",
|
|
2861
|
+
"email",
|
|
2862
|
+
"url",
|
|
2863
|
+
"phone"
|
|
2864
|
+
]), Br = /* @__PURE__ */ new Set([
|
|
2865
|
+
"int",
|
|
2866
|
+
"float",
|
|
2867
|
+
"decimal"
|
|
2868
|
+
]), Vr = /* @__PURE__ */ new Set([
|
|
2869
|
+
"date",
|
|
2870
|
+
"timestamp",
|
|
2871
|
+
"time"
|
|
2872
|
+
]), Hr = /^(?:eq|not_eq|contains|starts_with|is_empty|is_not_empty)$/, Ur = /^(?:eq|not_eq|in|not_in|is_empty|is_not_empty)$/, Wr = /^(?:eq|not_eq|gt|gte|lt|lte|between|is_empty|is_not_empty)$/, Gr = {
|
|
2873
|
+
string: Hr,
|
|
2874
|
+
text: Hr,
|
|
2875
|
+
rich_text: Hr,
|
|
2876
|
+
email: Hr,
|
|
2877
|
+
url: Hr,
|
|
2878
|
+
phone: Hr,
|
|
2879
|
+
enum: Ur,
|
|
2880
|
+
int: Wr,
|
|
2881
|
+
float: Wr,
|
|
2882
|
+
decimal: Wr,
|
|
2883
|
+
date: Wr,
|
|
2884
|
+
timestamp: Wr,
|
|
2885
|
+
time: Wr,
|
|
2886
|
+
bool: /^(?:eq|is_empty)$/,
|
|
2887
|
+
ref: /^(?:eq|not_eq|is_empty|is_not_empty)$/,
|
|
2888
|
+
uuid: /^(?:eq|not_eq|is_empty|is_not_empty)$/
|
|
2889
|
+
};
|
|
2890
|
+
function Kr(e, t, n) {
|
|
2891
|
+
return e.every((e) => qr(e, t, n));
|
|
2892
|
+
}
|
|
2893
|
+
function qr(e, t, n) {
|
|
2894
|
+
if (e.and) return e.and.every((e) => qr(e, t, n));
|
|
2895
|
+
if (e.or) return e.or.some((e) => qr(e, t, n));
|
|
2896
|
+
if (!e.field || !e.op) return !1;
|
|
2897
|
+
let r = t[e.field];
|
|
2898
|
+
return !r || !Gr[r.type]?.test(e.op) ? !1 : Jr(e, r.type, n[e.field]);
|
|
2899
|
+
}
|
|
2900
|
+
function Jr(e, t, n) {
|
|
2901
|
+
let r = Yr(n);
|
|
2902
|
+
if (e.op === "is_empty") return r;
|
|
2903
|
+
if (e.op === "is_not_empty") return !r;
|
|
2904
|
+
if (r) return !1;
|
|
2905
|
+
let i = e.value;
|
|
2906
|
+
switch (e.op) {
|
|
2907
|
+
case "eq": return Xr(t, n, i);
|
|
2908
|
+
case "not_eq": return !Xr(t, n, i) && Zr(t, n, i);
|
|
2909
|
+
case "in": return Array.isArray(i) && i.some((e) => Xr(t, n, e));
|
|
2910
|
+
case "not_in": return Array.isArray(i) && i.every((e) => Zr(t, n, e) && !Xr(t, n, e));
|
|
2911
|
+
case "contains": return typeof n == "string" && typeof i == "string" && n.toLowerCase().includes(i.toLowerCase());
|
|
2912
|
+
case "starts_with": return typeof n == "string" && typeof i == "string" && n.toLowerCase().startsWith(i.toLowerCase());
|
|
2913
|
+
case "gt": return Qr(t, n, i, (e, t) => e > t);
|
|
2914
|
+
case "gte": return Qr(t, n, i, (e, t) => e >= t);
|
|
2915
|
+
case "lt": return Qr(t, n, i, (e, t) => e < t);
|
|
2916
|
+
case "lte": return Qr(t, n, i, (e, t) => e <= t);
|
|
2917
|
+
case "between": {
|
|
2918
|
+
if (!Array.isArray(i) || i.length !== 2) return !1;
|
|
2919
|
+
let e = $r(t, n, i[0]), r = $r(t, n, i[1]);
|
|
2920
|
+
return e === void 0 || r === void 0 ? !1 : e >= 0 && r <= 0;
|
|
2921
|
+
}
|
|
2922
|
+
default: return !1;
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
function Yr(e) {
|
|
2926
|
+
return e == null || e === "" || Array.isArray(e) && e.length === 0;
|
|
2927
|
+
}
|
|
2928
|
+
function Xr(e, t, n) {
|
|
2929
|
+
return Zr(e, t, n) ? Vr.has(e) ? $r(e, t, n) === 0 : t === n : !1;
|
|
2930
|
+
}
|
|
2931
|
+
function Zr(e, t, n) {
|
|
2932
|
+
return $r(e, t, n) !== void 0;
|
|
2933
|
+
}
|
|
2934
|
+
function Qr(e, t, n, r) {
|
|
2935
|
+
let i = $r(e, t, n);
|
|
2936
|
+
return i !== void 0 && r(i, 0);
|
|
2937
|
+
}
|
|
2938
|
+
function $r(e, t, n) {
|
|
2939
|
+
if (Br.has(e)) return typeof t != "number" || typeof n != "number" || !Number.isFinite(t) || !Number.isFinite(n) ? void 0 : t === n ? 0 : t < n ? -1 : 1;
|
|
2940
|
+
if (Vr.has(e)) return typeof t != "string" || typeof n != "string" || !ei(e, t) || !ei(e, n) ? void 0 : t === n ? 0 : t < n ? -1 : 1;
|
|
2941
|
+
if (zr.has(e) || e === "enum" || e === "ref" || e === "uuid") return typeof t != "string" || typeof n != "string" ? void 0 : t === n ? 0 : t < n ? -1 : 1;
|
|
2942
|
+
if (e === "bool") return typeof t != "boolean" || typeof n != "boolean" ? void 0 : t === n ? 0 : t ? 1 : -1;
|
|
2943
|
+
}
|
|
2944
|
+
function ei(e, t) {
|
|
2945
|
+
switch (e) {
|
|
2946
|
+
case "date": return /^\d{4}-\d{2}-\d{2}$/.test(t);
|
|
2947
|
+
case "time": return /^\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t);
|
|
2948
|
+
case "timestamp": return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(t);
|
|
2949
|
+
default: return !1;
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
//#endregion
|
|
2953
|
+
//#region src/lib/variants.ts
|
|
2954
|
+
function ti(e, t) {
|
|
2955
|
+
let n = e.variants;
|
|
2956
|
+
if (!n || n.length === 0) return;
|
|
2957
|
+
let r = {};
|
|
2958
|
+
for (let [t, n] of e.fields) r[t] = n;
|
|
2959
|
+
for (let [e, i] of n) if (e !== "default" && i.when && Kr(i.when, r, t)) return e;
|
|
2960
|
+
return n.has("default") ? "default" : void 0;
|
|
2961
|
+
}
|
|
2962
|
+
function ni(e, t) {
|
|
2963
|
+
let n = e?.variants;
|
|
2964
|
+
if (!n || !n.items().some((e) => e.actions !== void 0)) return;
|
|
2965
|
+
let r = ti(e, t), i = n.get("default"), a = (r ? n.get(r)?.actions : void 0) ?? i?.actions ?? [];
|
|
2966
|
+
return new Set(a);
|
|
2967
|
+
}
|
|
2968
|
+
function ri(e, t) {
|
|
2969
|
+
if (t.length === 0) return;
|
|
2970
|
+
let n = t.map((t) => ni(e, t));
|
|
2971
|
+
if (n.every((e) => e === void 0)) return;
|
|
2972
|
+
let r = n[0] ?? /* @__PURE__ */ new Set(), i = new Set(r);
|
|
2973
|
+
for (let e of n.slice(1)) {
|
|
2974
|
+
if (!e) {
|
|
2975
|
+
i.clear();
|
|
2976
|
+
break;
|
|
2977
|
+
}
|
|
2978
|
+
for (let t of i) e.has(t) || i.delete(t);
|
|
2979
|
+
}
|
|
2980
|
+
return i;
|
|
2981
|
+
}
|
|
2982
|
+
function ii(e, t, n) {
|
|
2983
|
+
if (!t.variants || t.variants.length === 0) return;
|
|
2984
|
+
if (e.variants) {
|
|
2985
|
+
let r = ti(e, n) ?? "default";
|
|
2986
|
+
return t.variants.has(r) ? r : "default";
|
|
2987
|
+
}
|
|
2988
|
+
let r = {};
|
|
2989
|
+
for (let [t, n] of e.fields) r[t] = n;
|
|
2990
|
+
for (let [e, i] of t.variants) if (e !== "default" && i.when && Kr(i.when, r, n)) return e;
|
|
2991
|
+
return "default";
|
|
2992
|
+
}
|
|
2993
|
+
var ai = [
|
|
2994
|
+
"items",
|
|
2995
|
+
"sidebar",
|
|
2996
|
+
"sidebar_width",
|
|
2997
|
+
"highlights",
|
|
2998
|
+
"audit",
|
|
2999
|
+
"actions",
|
|
3000
|
+
"row_actions",
|
|
3001
|
+
"action_layout",
|
|
3002
|
+
"card",
|
|
3003
|
+
"quick_peek"
|
|
3004
|
+
];
|
|
3005
|
+
function oi(e, t, n) {
|
|
3006
|
+
if (!e || !t?.variants) return t;
|
|
3007
|
+
let r = ii(e, t, n), i = r ? t.variants.get(r) : void 0;
|
|
3008
|
+
if (!i) return t;
|
|
3009
|
+
let a = { ...t };
|
|
3010
|
+
for (let e of ai) i[e] !== void 0 && (a[e] = i[e]);
|
|
3011
|
+
return a;
|
|
3012
|
+
}
|
|
3013
|
+
//#endregion
|
|
2790
3014
|
//#region src/components/shared/RowActionsKebab.tsx
|
|
2791
|
-
function
|
|
2792
|
-
let
|
|
3015
|
+
function si({ actions: t, objectIds: n, row: r, entity: i, onSuccess: a, preMenu: o, divider: s, size: c = 22, align: l = "end" }) {
|
|
3016
|
+
let u = J(null), [d, f] = Y(!1), [p, m] = Y(null), { run: h } = ee(), g = q(() => {
|
|
2793
3017
|
let e = {};
|
|
2794
3018
|
for (let { code: n, action: r } of t) e[n] = r;
|
|
2795
3019
|
return e;
|
|
2796
|
-
}, [t]),
|
|
3020
|
+
}, [t]), v = q(() => {
|
|
2797
3021
|
let e = t.map(({ code: e }) => ({
|
|
2798
3022
|
kind: "action",
|
|
2799
3023
|
code: e,
|
|
2800
3024
|
enabled: !0,
|
|
2801
3025
|
reason: null
|
|
2802
3026
|
}));
|
|
2803
|
-
return r ? j(e,
|
|
3027
|
+
return r ? j(e, g, void 0, r, [], ni(i, r)) : e;
|
|
2804
3028
|
}, [
|
|
2805
3029
|
t,
|
|
2806
|
-
|
|
2807
|
-
r
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
3030
|
+
g,
|
|
3031
|
+
r,
|
|
3032
|
+
i
|
|
3033
|
+
]), y = G((e, t) => {
|
|
3034
|
+
f(!1);
|
|
3035
|
+
let i = t.entity ? `${t.entity}.${e}` : e;
|
|
3036
|
+
return h({
|
|
2812
3037
|
action: t,
|
|
2813
3038
|
title: C(t.display?.name) || e,
|
|
2814
3039
|
row: r,
|
|
2815
3040
|
execute: async (e) => {
|
|
2816
|
-
let t = await F(
|
|
2817
|
-
return
|
|
3041
|
+
let t = await F(i, z(e, n));
|
|
3042
|
+
return a?.(), t;
|
|
2818
3043
|
}
|
|
2819
3044
|
});
|
|
2820
3045
|
}, [
|
|
2821
|
-
|
|
3046
|
+
h,
|
|
2822
3047
|
r,
|
|
2823
3048
|
n,
|
|
2824
|
-
|
|
3049
|
+
a
|
|
2825
3050
|
]);
|
|
2826
|
-
return !
|
|
3051
|
+
return !o && v.length === 0 ? null : /* @__PURE__ */ Z("div", {
|
|
2827
3052
|
className: "sl-row-actions",
|
|
2828
|
-
"data-open":
|
|
3053
|
+
"data-open": d ? "true" : void 0,
|
|
2829
3054
|
style: {
|
|
2830
3055
|
display: "flex",
|
|
2831
3056
|
alignItems: "center",
|
|
2832
3057
|
justifyContent: "flex-end"
|
|
2833
3058
|
},
|
|
2834
|
-
children: [/* @__PURE__ */ X(
|
|
2835
|
-
ref:
|
|
2836
|
-
size:
|
|
2837
|
-
icon: /* @__PURE__ */ X(e.more, { size: Math.round(
|
|
2838
|
-
onClick: () =>
|
|
3059
|
+
children: [/* @__PURE__ */ X(V, {
|
|
3060
|
+
ref: u,
|
|
3061
|
+
size: c,
|
|
3062
|
+
icon: /* @__PURE__ */ X(e.more, { size: Math.round(c * .55) }),
|
|
3063
|
+
onClick: () => f((e) => !e),
|
|
2839
3064
|
title: "Actions"
|
|
2840
|
-
}), /* @__PURE__ */ Z(
|
|
2841
|
-
open:
|
|
2842
|
-
anchor:
|
|
2843
|
-
onClose: () =>
|
|
3065
|
+
}), /* @__PURE__ */ Z(H, {
|
|
3066
|
+
open: d,
|
|
3067
|
+
anchor: u.current,
|
|
3068
|
+
onClose: () => f(!1),
|
|
2844
3069
|
width: 200,
|
|
2845
|
-
align:
|
|
3070
|
+
align: l,
|
|
2846
3071
|
children: [
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
/* @__PURE__ */ X(
|
|
2850
|
-
layout:
|
|
2851
|
-
entityActions:
|
|
2852
|
-
onRun:
|
|
2853
|
-
loading:
|
|
2854
|
-
onLoadingChange:
|
|
3072
|
+
o,
|
|
3073
|
+
o && s && v.length > 0 && /* @__PURE__ */ X(_, { divider: !0 }),
|
|
3074
|
+
/* @__PURE__ */ X(Tr, {
|
|
3075
|
+
layout: v,
|
|
3076
|
+
entityActions: g,
|
|
3077
|
+
onRun: y,
|
|
3078
|
+
loading: p,
|
|
3079
|
+
onLoadingChange: m,
|
|
2855
3080
|
row: r
|
|
2856
3081
|
})
|
|
2857
3082
|
]
|
|
@@ -2860,7 +3085,7 @@ function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
|
|
|
2860
3085
|
}
|
|
2861
3086
|
//#endregion
|
|
2862
3087
|
//#region src/components/detail-layout/AssociatedToolbar.tsx
|
|
2863
|
-
function
|
|
3088
|
+
function ci({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters: o, onFilterChange: s, allEntities: c }) {
|
|
2864
3089
|
let l = n === !0, u = r && r.length > 0;
|
|
2865
3090
|
return !l && !u ? null : /* @__PURE__ */ Z("div", {
|
|
2866
3091
|
style: {
|
|
@@ -2884,31 +3109,34 @@ function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearc
|
|
|
2884
3109
|
let n = t.fields.get(e);
|
|
2885
3110
|
if (!n) return null;
|
|
2886
3111
|
let r = o[e] ?? "__all__", i = b(n, e, c);
|
|
2887
|
-
|
|
3112
|
+
if (n.type === "ref" && n.ref?.entity) return /* @__PURE__ */ X(li, {
|
|
2888
3113
|
field: n,
|
|
2889
3114
|
label: i,
|
|
2890
3115
|
value: r,
|
|
2891
3116
|
onChange: (t) => s(e, t)
|
|
2892
|
-
}, e)
|
|
3117
|
+
}, e);
|
|
3118
|
+
if (!n.values) return null;
|
|
3119
|
+
let a = [{
|
|
3120
|
+
value: "__all__",
|
|
3121
|
+
label: `All ${i}`
|
|
3122
|
+
}, ...n.values.map((e) => ({
|
|
3123
|
+
value: e.code,
|
|
3124
|
+
label: C(e.name) || e.code
|
|
3125
|
+
}))];
|
|
3126
|
+
return /* @__PURE__ */ X("div", {
|
|
2893
3127
|
style: { width: 160 },
|
|
2894
3128
|
children: /* @__PURE__ */ X(d, {
|
|
2895
3129
|
value: r,
|
|
2896
|
-
options:
|
|
2897
|
-
value: "__all__",
|
|
2898
|
-
label: `All ${i}`
|
|
2899
|
-
}, ...n.values.map((e) => ({
|
|
2900
|
-
value: e.code,
|
|
2901
|
-
label: C(e.name) || e.code
|
|
2902
|
-
}))],
|
|
3130
|
+
options: a,
|
|
2903
3131
|
onChange: (t) => s(e, t),
|
|
2904
3132
|
placeholder: i
|
|
2905
3133
|
})
|
|
2906
|
-
}, e)
|
|
3134
|
+
}, e);
|
|
2907
3135
|
})]
|
|
2908
3136
|
});
|
|
2909
3137
|
}
|
|
2910
|
-
function
|
|
2911
|
-
let i = u(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o =
|
|
3138
|
+
function li({ field: e, label: t, value: n, onChange: r }) {
|
|
3139
|
+
let i = u(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o = q(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: s } = O(e.ref?.entity, {
|
|
2912
3140
|
per_page: 200,
|
|
2913
3141
|
sort: a ? `${a}:asc` : void 0
|
|
2914
3142
|
}), c = s?.data ?? [], l = (e) => {
|
|
@@ -2918,21 +3146,21 @@ function Pr({ field: e, label: t, value: n, onChange: r }) {
|
|
|
2918
3146
|
return t == null ? "—" : p(t);
|
|
2919
3147
|
}
|
|
2920
3148
|
return p(e);
|
|
2921
|
-
}
|
|
3149
|
+
}, f = [{
|
|
3150
|
+
value: "__all__",
|
|
3151
|
+
label: `All ${t}`
|
|
3152
|
+
}, ...c.map((e) => {
|
|
3153
|
+
let t = String(e[o]), n = e[re];
|
|
3154
|
+
return {
|
|
3155
|
+
value: t,
|
|
3156
|
+
label: typeof n == "string" && n !== "" ? n : a ? l(e[a] ?? t) : t
|
|
3157
|
+
};
|
|
3158
|
+
})];
|
|
2922
3159
|
return /* @__PURE__ */ X("div", {
|
|
2923
3160
|
style: { width: 160 },
|
|
2924
3161
|
children: /* @__PURE__ */ X(d, {
|
|
2925
3162
|
value: n,
|
|
2926
|
-
options:
|
|
2927
|
-
value: "__all__",
|
|
2928
|
-
label: `All ${t}`
|
|
2929
|
-
}, ...c.map((e) => {
|
|
2930
|
-
let t = String(e[o]), n = e[ie];
|
|
2931
|
-
return {
|
|
2932
|
-
value: t,
|
|
2933
|
-
label: typeof n == "string" && n !== "" ? n : a ? l(e[a] ?? t) : t
|
|
2934
|
-
};
|
|
2935
|
-
})],
|
|
3163
|
+
options: f,
|
|
2936
3164
|
onChange: r,
|
|
2937
3165
|
placeholder: t
|
|
2938
3166
|
})
|
|
@@ -2940,12 +3168,12 @@ function Pr({ field: e, label: t, value: n, onChange: r }) {
|
|
|
2940
3168
|
}
|
|
2941
3169
|
//#endregion
|
|
2942
3170
|
//#region src/lib/action-dispatch.ts
|
|
2943
|
-
function
|
|
2944
|
-
return L(t) ? (
|
|
3171
|
+
function ui(e, t, n, r) {
|
|
3172
|
+
return L(t) ? (ce(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
|
|
2945
3173
|
}
|
|
2946
3174
|
//#endregion
|
|
2947
3175
|
//#region src/components/detail-layout/AssociatedBlock.tsx
|
|
2948
|
-
function
|
|
3176
|
+
function di(e) {
|
|
2949
3177
|
if (!e) return [];
|
|
2950
3178
|
let t = [];
|
|
2951
3179
|
for (let [n, r] of Object.entries(e)) (r.visibility ?? []).includes("list_row") && (r.association || s(n) || t.push({
|
|
@@ -2954,7 +3182,7 @@ function Ir(e) {
|
|
|
2954
3182
|
}));
|
|
2955
3183
|
return t;
|
|
2956
3184
|
}
|
|
2957
|
-
function
|
|
3185
|
+
function fi(e, t, n) {
|
|
2958
3186
|
if (!e) return [];
|
|
2959
3187
|
let r = [];
|
|
2960
3188
|
for (let [i, a] of Object.entries(e)) {
|
|
@@ -2980,7 +3208,7 @@ function Lr(e, t, n) {
|
|
|
2980
3208
|
}
|
|
2981
3209
|
return r;
|
|
2982
3210
|
}
|
|
2983
|
-
function
|
|
3211
|
+
function pi(e, t, n) {
|
|
2984
3212
|
let r = e[n];
|
|
2985
3213
|
if (!r) return null;
|
|
2986
3214
|
let i = e[t], a = i?.children?.find((e) => e.entity === n);
|
|
@@ -3002,22 +3230,22 @@ function Rr(e, t, n) {
|
|
|
3002
3230
|
}
|
|
3003
3231
|
return null;
|
|
3004
3232
|
}
|
|
3005
|
-
function
|
|
3006
|
-
let r = new Set(
|
|
3233
|
+
function mi(e, t, n) {
|
|
3234
|
+
let r = new Set(de(e));
|
|
3007
3235
|
return new Set(t.filter((t) => {
|
|
3008
3236
|
if (t === n || r.has(t)) return !1;
|
|
3009
3237
|
let i = e.fields.get(t);
|
|
3010
3238
|
return !(!i || i.auto || i.primary || i.source);
|
|
3011
3239
|
}));
|
|
3012
3240
|
}
|
|
3013
|
-
function
|
|
3241
|
+
function hi(e, t, n) {
|
|
3014
3242
|
return new Set(t.filter((t) => {
|
|
3015
3243
|
if (t === n) return !1;
|
|
3016
3244
|
let r = e.fields.get(t);
|
|
3017
3245
|
return !(!r || r.auto);
|
|
3018
3246
|
}));
|
|
3019
3247
|
}
|
|
3020
|
-
function
|
|
3248
|
+
function gi(e, t, n, r) {
|
|
3021
3249
|
let i = [];
|
|
3022
3250
|
for (let a of t) {
|
|
3023
3251
|
let t = n.fields.get(a);
|
|
@@ -3027,7 +3255,7 @@ function Vr(e, t, n, r) {
|
|
|
3027
3255
|
}
|
|
3028
3256
|
return i;
|
|
3029
3257
|
}
|
|
3030
|
-
function
|
|
3258
|
+
function _i({ node: e, ctx: t }) {
|
|
3031
3259
|
let n = e.associated;
|
|
3032
3260
|
if (!n || t.isNew) return null;
|
|
3033
3261
|
let r = t.schema.entities[n];
|
|
@@ -3039,8 +3267,8 @@ function Hr({ node: e, ctx: t }) {
|
|
|
3039
3267
|
},
|
|
3040
3268
|
children: ["Entity not found: ", n]
|
|
3041
3269
|
});
|
|
3042
|
-
let i =
|
|
3043
|
-
return i ? /* @__PURE__ */ X(
|
|
3270
|
+
let i = pi(t.schema.entities, t.entityCode, n);
|
|
3271
|
+
return i ? /* @__PURE__ */ X(vi, {
|
|
3044
3272
|
node: e,
|
|
3045
3273
|
ctx: t,
|
|
3046
3274
|
assocCode: n,
|
|
@@ -3060,20 +3288,23 @@ function Hr({ node: e, ctx: t }) {
|
|
|
3060
3288
|
]
|
|
3061
3289
|
});
|
|
3062
3290
|
}
|
|
3063
|
-
function
|
|
3291
|
+
function vi({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
3064
3292
|
let c = r.columns && r.columns.length > 0 ? r.columns.filter((e) => e !== s && !!o.fields.get(e)) : o.fields.names().filter((e) => {
|
|
3065
3293
|
if (e === s) return !1;
|
|
3066
3294
|
let t = o.fields.get(e);
|
|
3067
3295
|
return !(!t || t.primary || t.display?.is_listable === !1);
|
|
3068
|
-
}), l = P(o, "update"), u = r.interaction ?? (l ? "navigate" : "readonly"), d = (u === "inline_edit" || u === "row_edit") && l && r.editable !== !1, f = C(o.display?.name_plural) || C(o.display?.name) || a, p = r.searchable === !0 || r.filters && r.filters.length > 0, m =
|
|
3296
|
+
}), l = P(o, "update"), u = r.interaction ?? (l ? "navigate" : "readonly"), d = (u === "inline_edit" || u === "row_edit") && l && r.editable !== !1, f = C(o.display?.name_plural) || C(o.display?.name) || a, p = r.searchable === !0 || r.filters && r.filters.length > 0, m = q(() => fi(o.actions, s, i.recordId), [
|
|
3069
3297
|
o.actions,
|
|
3070
3298
|
s,
|
|
3071
3299
|
i.recordId
|
|
3072
|
-
]), h =
|
|
3300
|
+
]), h = q(() => {
|
|
3073
3301
|
let e = {};
|
|
3074
3302
|
for (let { code: t, action: n } of m) e[t] = n;
|
|
3075
3303
|
return e;
|
|
3076
|
-
}, [m]), g =
|
|
3304
|
+
}, [m]), g = q(() => {
|
|
3305
|
+
let e = o.action_layout ?? null;
|
|
3306
|
+
return j(e ?? le(h, "list_toolbar"), h, void 0, {}, []);
|
|
3307
|
+
}, [o.action_layout, h]), { run: _ } = ee(), v = Vt(), y = n(), b = q(() => ({
|
|
3077
3308
|
entity: o,
|
|
3078
3309
|
entityCode: a,
|
|
3079
3310
|
screenRoute: typeof window < "u" ? window.location.pathname : "",
|
|
@@ -3091,18 +3322,18 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3091
3322
|
a,
|
|
3092
3323
|
y,
|
|
3093
3324
|
v
|
|
3094
|
-
]), x = Ue(), S =
|
|
3325
|
+
]), x = Ue(), S = G(() => {
|
|
3095
3326
|
x.invalidateQueries({ predicate: (e) => {
|
|
3096
3327
|
let t = e.queryKey;
|
|
3097
3328
|
return t[0] === "entity-children" && t[3] === a;
|
|
3098
3329
|
} });
|
|
3099
|
-
}, [x, a]), w =
|
|
3100
|
-
let n =
|
|
3330
|
+
}, [x, a]), w = G((e, t) => {
|
|
3331
|
+
let n = ui(e, t, {}, a);
|
|
3101
3332
|
if (n !== null) return _({
|
|
3102
3333
|
action: t,
|
|
3103
3334
|
title: C(t.display?.name) || e,
|
|
3104
3335
|
execute: async (e) => {
|
|
3105
|
-
let t = await F(n,
|
|
3336
|
+
let t = await F(n, z(e, void 0));
|
|
3106
3337
|
return S(), t;
|
|
3107
3338
|
}
|
|
3108
3339
|
});
|
|
@@ -3110,7 +3341,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3110
3341
|
_,
|
|
3111
3342
|
a,
|
|
3112
3343
|
S
|
|
3113
|
-
]), [T, E] =
|
|
3344
|
+
]), [T, E] = Y(0), D = /* @__PURE__ */ Z("div", {
|
|
3114
3345
|
style: {
|
|
3115
3346
|
display: "flex",
|
|
3116
3347
|
alignItems: "center",
|
|
@@ -3119,28 +3350,28 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3119
3350
|
minWidth: 0,
|
|
3120
3351
|
justifyContent: "flex-end"
|
|
3121
3352
|
},
|
|
3122
|
-
children: [o.action_layout ? g.length > 0 && /* @__PURE__ */ X(
|
|
3353
|
+
children: [o.action_layout ? g.length > 0 && /* @__PURE__ */ X(Rr, {
|
|
3123
3354
|
kind: "toolbar",
|
|
3124
3355
|
layout: g,
|
|
3125
3356
|
entityActions: h,
|
|
3126
3357
|
onRun: w,
|
|
3127
3358
|
widgetContext: b,
|
|
3128
3359
|
ariaLabel: `${f} toolbar actions`
|
|
3129
|
-
}) : m.map(({ code: e, action: t }) => /* @__PURE__ */ X(
|
|
3360
|
+
}) : m.map(({ code: e, action: t }) => /* @__PURE__ */ X(cr, {
|
|
3130
3361
|
actionCode: e,
|
|
3131
3362
|
action: t,
|
|
3132
3363
|
entityCode: a,
|
|
3133
3364
|
variant: "ghost",
|
|
3134
3365
|
size: "sm",
|
|
3135
3366
|
onSuccess: S
|
|
3136
|
-
}, e)), d && /* @__PURE__ */ X(
|
|
3367
|
+
}, e)), d && /* @__PURE__ */ X(W, {
|
|
3137
3368
|
kind: "ghost",
|
|
3138
3369
|
size: "xs",
|
|
3139
3370
|
icon: /* @__PURE__ */ X(e.plus, { size: 12 }),
|
|
3140
3371
|
onClick: () => E((e) => e + 1),
|
|
3141
3372
|
children: "Add row"
|
|
3142
3373
|
})]
|
|
3143
|
-
}), O = p ? /* @__PURE__ */ X(
|
|
3374
|
+
}), O = p ? /* @__PURE__ */ X(bi, {
|
|
3144
3375
|
entityCode: a,
|
|
3145
3376
|
entity: o,
|
|
3146
3377
|
parentEntity: i.entityCode,
|
|
@@ -3154,7 +3385,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3154
3385
|
filterFields: r.filters,
|
|
3155
3386
|
sort: r.sort,
|
|
3156
3387
|
startDraftSignal: T
|
|
3157
|
-
}) : /* @__PURE__ */ X(
|
|
3388
|
+
}) : /* @__PURE__ */ X(yi, {
|
|
3158
3389
|
entityCode: a,
|
|
3159
3390
|
entity: o,
|
|
3160
3391
|
parentEntity: i.entityCode,
|
|
@@ -3174,7 +3405,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3174
3405
|
marginBottom: 8
|
|
3175
3406
|
},
|
|
3176
3407
|
children: D
|
|
3177
|
-
}), O] }) : /* @__PURE__ */ X(
|
|
3408
|
+
}), O] }) : /* @__PURE__ */ X(Ye, {
|
|
3178
3409
|
title: f,
|
|
3179
3410
|
icon: o.display?.icon ? /* @__PURE__ */ X(t, {
|
|
3180
3411
|
name: o.display.icon,
|
|
@@ -3184,9 +3415,21 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3184
3415
|
children: O
|
|
3185
3416
|
});
|
|
3186
3417
|
}
|
|
3187
|
-
function
|
|
3188
|
-
let d = Ue(), { data: f, isLoading: p, isError: m } =
|
|
3189
|
-
|
|
3418
|
+
function yi({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
|
|
3419
|
+
let d = Ue(), { data: f, isLoading: p, isError: m } = ir(n, r, e, i, l), h = f?.data ?? [], g = f?.$refs, _ = G(() => {
|
|
3420
|
+
d.invalidateQueries({ queryKey: [
|
|
3421
|
+
rr,
|
|
3422
|
+
n,
|
|
3423
|
+
r,
|
|
3424
|
+
e
|
|
3425
|
+
] });
|
|
3426
|
+
}, [
|
|
3427
|
+
d,
|
|
3428
|
+
n,
|
|
3429
|
+
r,
|
|
3430
|
+
e
|
|
3431
|
+
]);
|
|
3432
|
+
return /* @__PURE__ */ X(xi, {
|
|
3190
3433
|
entityCode: e,
|
|
3191
3434
|
entity: t,
|
|
3192
3435
|
parentId: r,
|
|
@@ -3199,30 +3442,18 @@ function Wr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3199
3442
|
refs: g,
|
|
3200
3443
|
isLoading: p,
|
|
3201
3444
|
isError: m,
|
|
3202
|
-
invalidateQuery:
|
|
3203
|
-
d.invalidateQueries({ queryKey: [
|
|
3204
|
-
tr,
|
|
3205
|
-
n,
|
|
3206
|
-
r,
|
|
3207
|
-
e
|
|
3208
|
-
] });
|
|
3209
|
-
}, [
|
|
3210
|
-
d,
|
|
3211
|
-
n,
|
|
3212
|
-
r,
|
|
3213
|
-
e
|
|
3214
|
-
]),
|
|
3445
|
+
invalidateQuery: _,
|
|
3215
3446
|
startDraftSignal: u
|
|
3216
3447
|
});
|
|
3217
3448
|
}
|
|
3218
|
-
function
|
|
3219
|
-
let p = Ue(), [m, h] =
|
|
3220
|
-
|
|
3449
|
+
function bi({ 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 }) {
|
|
3450
|
+
let p = Ue(), [m, h] = Y(""), [g, _] = Y(""), [v, y] = Y({}), b = J(void 0);
|
|
3451
|
+
K(() => (b.current && clearTimeout(b.current), b.current = setTimeout(() => {
|
|
3221
3452
|
_(m);
|
|
3222
3453
|
}, 300), () => {
|
|
3223
3454
|
b.current && clearTimeout(b.current);
|
|
3224
3455
|
}), [m]);
|
|
3225
|
-
let x =
|
|
3456
|
+
let x = G((e, t) => {
|
|
3226
3457
|
y((n) => {
|
|
3227
3458
|
if (t === "__all__") {
|
|
3228
3459
|
let { [e]: t, ...r } = n;
|
|
@@ -3233,29 +3464,31 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3233
3464
|
[e]: t
|
|
3234
3465
|
};
|
|
3235
3466
|
});
|
|
3236
|
-
}, []), S =
|
|
3467
|
+
}, []), S = q(() => Object.keys(v).length > 0 ? v : void 0, [v]), { data: C, isLoading: w, isError: T, hasNextPage: E, fetchNextPage: D, isFetchingNextPage: O } = sr(n, r, e, i, d, void 0, g || void 0, S), { rows: k, refs: j } = q(() => {
|
|
3237
3468
|
if (!C?.pages) return {
|
|
3238
3469
|
rows: [],
|
|
3239
3470
|
refs: void 0
|
|
3240
3471
|
};
|
|
3241
3472
|
let e = [], t;
|
|
3242
|
-
for (let n of C.pages) if (e.push(...n.data), n.$refs)
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3473
|
+
for (let n of C.pages) if (e.push(...n.data), n.$refs) {
|
|
3474
|
+
if (!t) t = { ...n.$refs };
|
|
3475
|
+
else for (let [e, r] of Object.entries(n.$refs)) t[e] = {
|
|
3476
|
+
...t[e],
|
|
3477
|
+
...r
|
|
3478
|
+
};
|
|
3479
|
+
}
|
|
3247
3480
|
return {
|
|
3248
3481
|
rows: e,
|
|
3249
3482
|
refs: t
|
|
3250
3483
|
};
|
|
3251
|
-
}, [C]), M =
|
|
3484
|
+
}, [C]), M = G(() => {
|
|
3252
3485
|
p.invalidateQueries({ predicate: (t) => {
|
|
3253
3486
|
let n = t.queryKey;
|
|
3254
3487
|
return n[0] === "entity-children" && n[3] === e;
|
|
3255
3488
|
} });
|
|
3256
3489
|
}, [p, e]);
|
|
3257
3490
|
return /* @__PURE__ */ Z("div", { children: [
|
|
3258
|
-
/* @__PURE__ */ X(
|
|
3491
|
+
/* @__PURE__ */ X(ci, {
|
|
3259
3492
|
entity: t,
|
|
3260
3493
|
searchable: l,
|
|
3261
3494
|
filterFields: u,
|
|
@@ -3265,7 +3498,7 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3265
3498
|
onFilterChange: x,
|
|
3266
3499
|
allEntities: c.schema.entities
|
|
3267
3500
|
}),
|
|
3268
|
-
/* @__PURE__ */ X(
|
|
3501
|
+
/* @__PURE__ */ X(xi, {
|
|
3269
3502
|
entityCode: e,
|
|
3270
3503
|
entity: t,
|
|
3271
3504
|
parentId: r,
|
|
@@ -3283,7 +3516,7 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3283
3516
|
}),
|
|
3284
3517
|
E && /* @__PURE__ */ X("div", {
|
|
3285
3518
|
style: { marginTop: 4 },
|
|
3286
|
-
children: /* @__PURE__ */ X(
|
|
3519
|
+
children: /* @__PURE__ */ X(W, {
|
|
3287
3520
|
kind: "ghost",
|
|
3288
3521
|
size: "xs",
|
|
3289
3522
|
icon: O ? /* @__PURE__ */ X(A, { size: 12 }) : void 0,
|
|
@@ -3294,44 +3527,44 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3294
3527
|
})
|
|
3295
3528
|
] });
|
|
3296
3529
|
}
|
|
3297
|
-
function
|
|
3298
|
-
let m = se(), h = m.isPhone && s.relatedRecordsPresentation === "table", g = i.find((e) => e !== r), _ =
|
|
3530
|
+
function xi({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: s, rows: c, refs: l, isLoading: u, isError: d, invalidateQuery: f, startDraftSignal: p }) {
|
|
3531
|
+
let m = se(), h = m.isPhone && s.relatedRecordsPresentation === "table", g = i.find((e) => e !== r), _ = q(() => o === "navigate" ? te(void 0, t, s.schema.screens) : null, [
|
|
3299
3532
|
o,
|
|
3300
3533
|
t,
|
|
3301
3534
|
s.schema.screens
|
|
3302
|
-
]), v =
|
|
3535
|
+
]), v = q(() => a ? mi(t, i, r) : /* @__PURE__ */ new Set(), [
|
|
3303
3536
|
i,
|
|
3304
3537
|
r,
|
|
3305
3538
|
t,
|
|
3306
3539
|
a
|
|
3307
|
-
]), y =
|
|
3540
|
+
]), y = q(() => hi(t, i, r), [
|
|
3308
3541
|
i,
|
|
3309
3542
|
r,
|
|
3310
3543
|
t
|
|
3311
|
-
]), x =
|
|
3544
|
+
]), x = q(() => {
|
|
3312
3545
|
let e = /* @__PURE__ */ new Map();
|
|
3313
3546
|
for (let n of c) {
|
|
3314
|
-
let r =
|
|
3315
|
-
e.set(
|
|
3547
|
+
let r = pe(t, n);
|
|
3548
|
+
e.set(me(r), r);
|
|
3316
3549
|
}
|
|
3317
3550
|
return e;
|
|
3318
|
-
}, [c, t]), S =
|
|
3551
|
+
}, [c, t]), S = q(() => {
|
|
3319
3552
|
let e = /* @__PURE__ */ new Map();
|
|
3320
3553
|
for (let n of c) {
|
|
3321
3554
|
let r = n.$row_version;
|
|
3322
|
-
typeof r == "string" && r !== "" && e.set(
|
|
3555
|
+
typeof r == "string" && r !== "" && e.set(me(pe(t, n)), r);
|
|
3323
3556
|
}
|
|
3324
3557
|
return e;
|
|
3325
|
-
}, [c, t]), w =
|
|
3558
|
+
}, [c, t]), w = q(() => di(t.actions), [t.actions]), [T, E] = Y(null), [D, O] = Y(null), [k, A] = Y([]), [j, N] = Y({}), P = J(j);
|
|
3326
3559
|
P.current = j;
|
|
3327
|
-
let F =
|
|
3328
|
-
|
|
3560
|
+
let F = J({});
|
|
3561
|
+
K(() => {
|
|
3329
3562
|
let e = F.current;
|
|
3330
3563
|
return () => {
|
|
3331
3564
|
for (let t of Object.values(e)) clearTimeout(t);
|
|
3332
3565
|
};
|
|
3333
3566
|
}, []);
|
|
3334
|
-
let [I, L] =
|
|
3567
|
+
let [I, L] = Y(null), [R, z] = Y([]), [B, V] = Y(!1), { run: re } = ee(), [H, ie] = Y(/* @__PURE__ */ new Set()), ae = G(async (t, n, r) => {
|
|
3335
3568
|
N((e) => ({
|
|
3336
3569
|
...e,
|
|
3337
3570
|
[t]: {
|
|
@@ -3345,7 +3578,7 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3345
3578
|
...n,
|
|
3346
3579
|
$row_version: i
|
|
3347
3580
|
} : n;
|
|
3348
|
-
return await
|
|
3581
|
+
return await ne(e, x.get(t) ?? t, a), N((e) => {
|
|
3349
3582
|
let n = e[t];
|
|
3350
3583
|
if (!n) return e;
|
|
3351
3584
|
if (n.ver > r) return {
|
|
@@ -3374,7 +3607,7 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3374
3607
|
f,
|
|
3375
3608
|
x,
|
|
3376
3609
|
S
|
|
3377
|
-
]),
|
|
3610
|
+
]), U = G((e, t, n) => {
|
|
3378
3611
|
N((r) => {
|
|
3379
3612
|
let i = r[e] ?? {
|
|
3380
3613
|
buffer: {},
|
|
@@ -3394,44 +3627,44 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3394
3627
|
};
|
|
3395
3628
|
}), o === "inline_edit" && (F.current[e] && clearTimeout(F.current[e]), F.current[e] = setTimeout(() => {
|
|
3396
3629
|
let t = P.current[e];
|
|
3397
|
-
t && Object.keys(t.buffer).length > 0 &&
|
|
3630
|
+
t && Object.keys(t.buffer).length > 0 && ae(e, { ...t.buffer }, t.ver);
|
|
3398
3631
|
}, 500));
|
|
3399
|
-
}, [
|
|
3632
|
+
}, [ae, o]), oe = G(() => {
|
|
3400
3633
|
let e = {};
|
|
3401
3634
|
e[r] = n;
|
|
3402
3635
|
for (let n of i) {
|
|
3403
3636
|
let r = t.fields.get(n);
|
|
3404
3637
|
r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
|
|
3405
3638
|
}
|
|
3406
|
-
L(e),
|
|
3639
|
+
L(e), z([]);
|
|
3407
3640
|
}, [
|
|
3408
3641
|
r,
|
|
3409
3642
|
n,
|
|
3410
3643
|
i,
|
|
3411
3644
|
t.fields
|
|
3412
|
-
]),
|
|
3413
|
-
|
|
3414
|
-
p !== void 0 && p !==
|
|
3645
|
+
]), ce = J(p);
|
|
3646
|
+
K(() => {
|
|
3647
|
+
p !== void 0 && p !== ce.current && (ce.current = p, !I && oe());
|
|
3415
3648
|
}, [
|
|
3416
3649
|
p,
|
|
3417
3650
|
I,
|
|
3418
|
-
|
|
3651
|
+
oe
|
|
3419
3652
|
]);
|
|
3420
|
-
let
|
|
3653
|
+
let W = G(async () => {
|
|
3421
3654
|
if (!I) return;
|
|
3422
|
-
let n =
|
|
3655
|
+
let n = gi(I, i, t, r);
|
|
3423
3656
|
if (n.length > 0) {
|
|
3424
|
-
|
|
3657
|
+
z(n);
|
|
3425
3658
|
return;
|
|
3426
3659
|
}
|
|
3427
|
-
|
|
3660
|
+
V(!0);
|
|
3428
3661
|
try {
|
|
3429
|
-
await M(e, I), L(null),
|
|
3662
|
+
await M(e, I), L(null), z([]), f();
|
|
3430
3663
|
} catch (e) {
|
|
3431
3664
|
let t = e instanceof Error ? e.message : "Create failed";
|
|
3432
|
-
|
|
3665
|
+
z([`_error:${t}`]);
|
|
3433
3666
|
} finally {
|
|
3434
|
-
|
|
3667
|
+
V(!1);
|
|
3435
3668
|
}
|
|
3436
3669
|
}, [
|
|
3437
3670
|
I,
|
|
@@ -3440,49 +3673,49 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3440
3673
|
r,
|
|
3441
3674
|
e,
|
|
3442
3675
|
f
|
|
3443
|
-
]),
|
|
3676
|
+
]), le = G((e) => {
|
|
3444
3677
|
N({}), A([]), O(e);
|
|
3445
|
-
}, []),
|
|
3678
|
+
}, []), de = G(async (e) => {
|
|
3446
3679
|
let n = P.current[e], a = n?.buffer ?? {};
|
|
3447
3680
|
if (Object.keys(a).length === 0) {
|
|
3448
3681
|
O(null), A([]);
|
|
3449
3682
|
return;
|
|
3450
3683
|
}
|
|
3451
|
-
let o =
|
|
3452
|
-
...c.find((n) =>
|
|
3684
|
+
let o = gi({
|
|
3685
|
+
...c.find((n) => me(pe(t, n)) === e) ?? {},
|
|
3453
3686
|
...a
|
|
3454
3687
|
}, i, t, r);
|
|
3455
3688
|
if (o.length > 0) {
|
|
3456
3689
|
A(o);
|
|
3457
3690
|
return;
|
|
3458
3691
|
}
|
|
3459
|
-
await
|
|
3692
|
+
await ae(e, { ...a }, n?.ver ?? 0) && (O(null), A([]));
|
|
3460
3693
|
}, [
|
|
3461
3694
|
c,
|
|
3462
3695
|
t,
|
|
3463
3696
|
i,
|
|
3464
3697
|
r,
|
|
3465
|
-
|
|
3466
|
-
]),
|
|
3698
|
+
ae
|
|
3699
|
+
]), fe = G((e) => {
|
|
3467
3700
|
N((t) => {
|
|
3468
3701
|
if (!t[e]) return t;
|
|
3469
3702
|
let { [e]: n, ...r } = t;
|
|
3470
3703
|
return r;
|
|
3471
3704
|
}), A([]), O(null);
|
|
3472
|
-
}, []),
|
|
3705
|
+
}, []), he = G((n, r) => {
|
|
3473
3706
|
let i = x.get(n) ?? n;
|
|
3474
|
-
return
|
|
3707
|
+
return re({
|
|
3475
3708
|
action: t.actions?.__delete,
|
|
3476
3709
|
destructive: !0,
|
|
3477
3710
|
title: C(t.display?.name) || "Delete",
|
|
3478
3711
|
row: r,
|
|
3479
3712
|
entity: e,
|
|
3480
3713
|
execute: async () => {
|
|
3481
|
-
|
|
3714
|
+
ie((e) => new Set(e).add(n));
|
|
3482
3715
|
try {
|
|
3483
|
-
return await
|
|
3716
|
+
return await ue(e, i);
|
|
3484
3717
|
} finally {
|
|
3485
|
-
|
|
3718
|
+
ie((e) => {
|
|
3486
3719
|
let t = new Set(e);
|
|
3487
3720
|
return t.delete(n), t;
|
|
3488
3721
|
});
|
|
@@ -3491,7 +3724,7 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3491
3724
|
onSuccess: () => f()
|
|
3492
3725
|
});
|
|
3493
3726
|
}, [
|
|
3494
|
-
|
|
3727
|
+
re,
|
|
3495
3728
|
t,
|
|
3496
3729
|
e,
|
|
3497
3730
|
f,
|
|
@@ -3522,23 +3755,23 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3522
3755
|
borderRadius: 6
|
|
3523
3756
|
} })]
|
|
3524
3757
|
});
|
|
3525
|
-
let
|
|
3526
|
-
return m.isPhone && !h ? /* @__PURE__ */ Z("div", { children: [
|
|
3758
|
+
let ge = c.length === 0 && !I;
|
|
3759
|
+
return m.isPhone && !h ? /* @__PURE__ */ Z("div", { children: [ge && !a && /* @__PURE__ */ X("div", {
|
|
3527
3760
|
style: {
|
|
3528
3761
|
fontSize: 12.5,
|
|
3529
3762
|
color: "var(--text-3)",
|
|
3530
3763
|
padding: "12px 0"
|
|
3531
3764
|
},
|
|
3532
3765
|
children: "No records yet."
|
|
3533
|
-
}), (!
|
|
3766
|
+
}), (!ge || a) && /* @__PURE__ */ Z("div", {
|
|
3534
3767
|
style: {
|
|
3535
3768
|
display: "flex",
|
|
3536
3769
|
flexDirection: "column",
|
|
3537
3770
|
gap: 10
|
|
3538
3771
|
},
|
|
3539
3772
|
children: [c.map((n) => {
|
|
3540
|
-
let r =
|
|
3541
|
-
return /* @__PURE__ */ X(
|
|
3773
|
+
let r = me(pe(t, n)), c = H.has(r), u = j[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
|
|
3774
|
+
return /* @__PURE__ */ X(Si, {
|
|
3542
3775
|
rowId: r,
|
|
3543
3776
|
row: n,
|
|
3544
3777
|
entity: t,
|
|
@@ -3554,11 +3787,11 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3554
3787
|
activeCell: T,
|
|
3555
3788
|
setActiveCell: E,
|
|
3556
3789
|
rowState: u,
|
|
3557
|
-
onCellChange:
|
|
3558
|
-
onDeleteClick: (e) => void
|
|
3559
|
-
onStartEdit:
|
|
3560
|
-
onConfirmEdit:
|
|
3561
|
-
onCancelEdit:
|
|
3790
|
+
onCellChange: U,
|
|
3791
|
+
onDeleteClick: (e) => void he(e, n),
|
|
3792
|
+
onStartEdit: le,
|
|
3793
|
+
onConfirmEdit: de,
|
|
3794
|
+
onCancelEdit: fe,
|
|
3562
3795
|
refs: l,
|
|
3563
3796
|
identityCol: g,
|
|
3564
3797
|
href: d,
|
|
@@ -3566,40 +3799,40 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3566
3799
|
entityCode: e,
|
|
3567
3800
|
onRowActionSuccess: f
|
|
3568
3801
|
}, r);
|
|
3569
|
-
}), I && /* @__PURE__ */ X(
|
|
3802
|
+
}), I && /* @__PURE__ */ X(Di, {
|
|
3570
3803
|
draftRow: I,
|
|
3571
3804
|
entity: t,
|
|
3572
3805
|
columns: i,
|
|
3573
3806
|
editableColumns: y,
|
|
3574
3807
|
foreignKey: r,
|
|
3575
|
-
draftErrors:
|
|
3576
|
-
draftSaving:
|
|
3808
|
+
draftErrors: R,
|
|
3809
|
+
draftSaving: B,
|
|
3577
3810
|
onChange: (e, t) => L((n) => n && {
|
|
3578
3811
|
...n,
|
|
3579
3812
|
[e]: t
|
|
3580
3813
|
}),
|
|
3581
|
-
onConfirm:
|
|
3814
|
+
onConfirm: W,
|
|
3582
3815
|
onCancel: () => {
|
|
3583
|
-
L(null),
|
|
3816
|
+
L(null), z([]);
|
|
3584
3817
|
},
|
|
3585
3818
|
refs: l
|
|
3586
3819
|
})]
|
|
3587
|
-
})] }) : /* @__PURE__ */ Z("div", { children: [
|
|
3820
|
+
})] }) : /* @__PURE__ */ Z("div", { children: [ge && !a && /* @__PURE__ */ X("div", {
|
|
3588
3821
|
style: {
|
|
3589
3822
|
fontSize: 12.5,
|
|
3590
3823
|
color: "var(--text-3)",
|
|
3591
3824
|
padding: "12px 0"
|
|
3592
3825
|
},
|
|
3593
3826
|
children: "No records yet."
|
|
3594
|
-
}), (!
|
|
3827
|
+
}), (!ge || a) && /* @__PURE__ */ X("div", {
|
|
3595
3828
|
style: { overflowX: "auto" },
|
|
3596
3829
|
children: /* @__PURE__ */ Z("table", {
|
|
3597
|
-
style:
|
|
3830
|
+
style: Ae,
|
|
3598
3831
|
children: [/* @__PURE__ */ X("thead", { children: /* @__PURE__ */ Z("tr", { children: [
|
|
3599
3832
|
i.map((e) => {
|
|
3600
3833
|
let n = t.fields.get(e);
|
|
3601
3834
|
return /* @__PURE__ */ X("th", {
|
|
3602
|
-
style:
|
|
3835
|
+
style: ke,
|
|
3603
3836
|
children: n ? b(n, e, s.schema.entities) : e
|
|
3604
3837
|
}, e);
|
|
3605
3838
|
}),
|
|
@@ -3612,8 +3845,8 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3612
3845
|
width: 40
|
|
3613
3846
|
} })
|
|
3614
3847
|
] }) }), /* @__PURE__ */ Z("tbody", { children: [c.map((n) => {
|
|
3615
|
-
let r =
|
|
3616
|
-
return /* @__PURE__ */ X(
|
|
3848
|
+
let r = me(pe(t, n)), c = H.has(r), u = j[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
|
|
3849
|
+
return /* @__PURE__ */ X(Ci, {
|
|
3617
3850
|
rowId: r,
|
|
3618
3851
|
row: n,
|
|
3619
3852
|
entity: t,
|
|
@@ -3629,11 +3862,11 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3629
3862
|
activeCell: T,
|
|
3630
3863
|
setActiveCell: E,
|
|
3631
3864
|
rowState: u,
|
|
3632
|
-
onCellChange:
|
|
3633
|
-
onDeleteClick: (e) => void
|
|
3634
|
-
onStartEdit:
|
|
3635
|
-
onConfirmEdit:
|
|
3636
|
-
onCancelEdit:
|
|
3865
|
+
onCellChange: U,
|
|
3866
|
+
onDeleteClick: (e) => void he(e, n),
|
|
3867
|
+
onStartEdit: le,
|
|
3868
|
+
onConfirmEdit: de,
|
|
3869
|
+
onCancelEdit: fe,
|
|
3637
3870
|
refs: l,
|
|
3638
3871
|
identityCol: g,
|
|
3639
3872
|
href: d,
|
|
@@ -3641,44 +3874,48 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3641
3874
|
entityCode: e,
|
|
3642
3875
|
onRowActionSuccess: f
|
|
3643
3876
|
}, r);
|
|
3644
|
-
}), I && /* @__PURE__ */ X(
|
|
3877
|
+
}), I && /* @__PURE__ */ X(Ei, {
|
|
3645
3878
|
draftRow: I,
|
|
3646
3879
|
entity: t,
|
|
3647
3880
|
columns: i,
|
|
3648
3881
|
editableColumns: y,
|
|
3649
3882
|
foreignKey: r,
|
|
3650
|
-
draftErrors:
|
|
3651
|
-
draftSaving:
|
|
3883
|
+
draftErrors: R,
|
|
3884
|
+
draftSaving: B,
|
|
3652
3885
|
onChange: (e, t) => L((n) => n && {
|
|
3653
3886
|
...n,
|
|
3654
3887
|
[e]: t
|
|
3655
3888
|
}),
|
|
3656
|
-
onConfirm:
|
|
3889
|
+
onConfirm: W,
|
|
3657
3890
|
onCancel: () => {
|
|
3658
|
-
L(null),
|
|
3891
|
+
L(null), z([]);
|
|
3659
3892
|
},
|
|
3660
3893
|
refs: l
|
|
3661
3894
|
})] })]
|
|
3662
3895
|
})
|
|
3663
3896
|
})] });
|
|
3664
3897
|
}
|
|
3665
|
-
function
|
|
3666
|
-
let D = n(), O = Ie(), k =
|
|
3898
|
+
function Si({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, rowState: h, onCellChange: g, onDeleteClick: _, onStartEdit: v, onConfirmEdit: y, onCancelEdit: x, refs: S, identityCol: C, href: w, rowActions: T, onRowActionSuccess: E }) {
|
|
3899
|
+
let D = n(), O = Ie(), k = q(() => !h || Object.keys(h.buffer).length === 0 ? r : {
|
|
3667
3900
|
...r,
|
|
3668
3901
|
...h.buffer
|
|
3669
3902
|
}, [r, h]);
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3903
|
+
if (u === "row_edit" && d) {
|
|
3904
|
+
let e = h?.error ? [...f, `_error:${h.error}`] : f;
|
|
3905
|
+
return /* @__PURE__ */ X(Ti, {
|
|
3906
|
+
values: k,
|
|
3907
|
+
entity: i,
|
|
3908
|
+
columns: s,
|
|
3909
|
+
editableColumns: c,
|
|
3910
|
+
errors: e,
|
|
3911
|
+
saving: h?.saving ?? !1,
|
|
3912
|
+
onChange: (e, n) => g(t, e, n),
|
|
3913
|
+
onConfirm: () => y(t),
|
|
3914
|
+
onCancel: () => x(t),
|
|
3915
|
+
refs: S
|
|
3916
|
+
});
|
|
3917
|
+
}
|
|
3918
|
+
return /* @__PURE__ */ Z("div", {
|
|
3682
3919
|
style: {
|
|
3683
3920
|
border: "1px solid var(--border)",
|
|
3684
3921
|
borderRadius: 8,
|
|
@@ -3698,7 +3935,7 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3698
3935
|
fontSize: 11.5,
|
|
3699
3936
|
fontWeight: 600,
|
|
3700
3937
|
color: "var(--text-3)"
|
|
3701
|
-
}, _ = n ?
|
|
3938
|
+
}, _ = n ? B({
|
|
3702
3939
|
field: n,
|
|
3703
3940
|
fieldName: e,
|
|
3704
3941
|
value: k[e],
|
|
@@ -3754,7 +3991,7 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3754
3991
|
justifyContent: "flex-end",
|
|
3755
3992
|
gap: 6
|
|
3756
3993
|
},
|
|
3757
|
-
children: [l && /* @__PURE__ */ Z(
|
|
3994
|
+
children: [l && /* @__PURE__ */ Z(We, { children: [
|
|
3758
3995
|
h?.saving && /* @__PURE__ */ X(A, { size: 12 }),
|
|
3759
3996
|
h?.error && /* @__PURE__ */ X("span", {
|
|
3760
3997
|
style: {
|
|
@@ -3764,19 +4001,20 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3764
4001
|
title: h.error,
|
|
3765
4002
|
children: "!"
|
|
3766
4003
|
}),
|
|
3767
|
-
u === "row_edit" && /* @__PURE__ */ X(
|
|
4004
|
+
u === "row_edit" && /* @__PURE__ */ X(V, {
|
|
3768
4005
|
size: 32,
|
|
3769
4006
|
icon: /* @__PURE__ */ X(e.edit, { size: 14 }),
|
|
3770
4007
|
onClick: () => v(t),
|
|
3771
4008
|
title: "Edit row"
|
|
3772
4009
|
}),
|
|
3773
|
-
/* @__PURE__ */ X(
|
|
4010
|
+
/* @__PURE__ */ X(V, {
|
|
3774
4011
|
size: 32,
|
|
3775
4012
|
icon: /* @__PURE__ */ X(e.trash, { size: 14 }),
|
|
3776
4013
|
onClick: () => _(t),
|
|
3777
4014
|
title: "Delete row"
|
|
3778
4015
|
})
|
|
3779
|
-
] }), !l && T && T.length > 0 && /* @__PURE__ */ X(
|
|
4016
|
+
] }), !l && T && T.length > 0 && /* @__PURE__ */ X(si, {
|
|
4017
|
+
entity: i,
|
|
3780
4018
|
actions: T,
|
|
3781
4019
|
objectIds: [t],
|
|
3782
4020
|
row: k,
|
|
@@ -3785,24 +4023,27 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3785
4023
|
})]
|
|
3786
4024
|
});
|
|
3787
4025
|
}
|
|
3788
|
-
function
|
|
3789
|
-
let O = n(), k =
|
|
4026
|
+
function Ci({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, activeCell: h, setActiveCell: g, rowState: _, onCellChange: v, onDeleteClick: y, onStartEdit: b, onConfirmEdit: x, onCancelEdit: S, refs: C, identityCol: w, href: T, rowActions: E, onRowActionSuccess: D }) {
|
|
4027
|
+
let O = n(), k = q(() => !_ || Object.keys(_.buffer).length === 0 ? r : {
|
|
3790
4028
|
...r,
|
|
3791
4029
|
..._.buffer
|
|
3792
4030
|
}, [r, _]);
|
|
3793
|
-
if (u === "row_edit" && d)
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
4031
|
+
if (u === "row_edit" && d) {
|
|
4032
|
+
let e = _?.error ? [...f, `_error:${_.error}`] : f;
|
|
4033
|
+
return /* @__PURE__ */ X(wi, {
|
|
4034
|
+
values: k,
|
|
4035
|
+
entity: i,
|
|
4036
|
+
columns: s,
|
|
4037
|
+
editableColumns: c,
|
|
4038
|
+
errors: e,
|
|
4039
|
+
saving: _?.saving ?? !1,
|
|
4040
|
+
onChange: (e, n) => v(t, e, n),
|
|
4041
|
+
onConfirm: () => x(t),
|
|
4042
|
+
onCancel: () => S(t),
|
|
4043
|
+
refs: C
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
let j = je, M = {
|
|
3806
4047
|
padding: "4px 4px",
|
|
3807
4048
|
borderBottom: "1px solid var(--divider)",
|
|
3808
4049
|
verticalAlign: "middle"
|
|
@@ -3814,7 +4055,7 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3814
4055
|
let n = i.fields.get(e), r = c.has(e);
|
|
3815
4056
|
if (N && h?.rowId === t && h?.col === e && r) return /* @__PURE__ */ X("td", {
|
|
3816
4057
|
style: M,
|
|
3817
|
-
children: n ?
|
|
4058
|
+
children: n ? B({
|
|
3818
4059
|
field: n,
|
|
3819
4060
|
fieldName: e,
|
|
3820
4061
|
value: k[e],
|
|
@@ -3826,7 +4067,7 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3826
4067
|
locale: O
|
|
3827
4068
|
}) : p(k[e])
|
|
3828
4069
|
}, e);
|
|
3829
|
-
let s = T && e === w, l = n ?
|
|
4070
|
+
let s = T && e === w, l = n ? B({
|
|
3830
4071
|
field: n,
|
|
3831
4072
|
fieldName: e,
|
|
3832
4073
|
value: k[e],
|
|
@@ -3882,13 +4123,13 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3882
4123
|
title: _.error,
|
|
3883
4124
|
children: "!"
|
|
3884
4125
|
}),
|
|
3885
|
-
u === "row_edit" && /* @__PURE__ */ X(
|
|
4126
|
+
u === "row_edit" && /* @__PURE__ */ X(V, {
|
|
3886
4127
|
size: 24,
|
|
3887
4128
|
icon: /* @__PURE__ */ X(e.edit, { size: 12 }),
|
|
3888
4129
|
onClick: () => b(t),
|
|
3889
4130
|
title: "Edit row"
|
|
3890
4131
|
}),
|
|
3891
|
-
/* @__PURE__ */ X(
|
|
4132
|
+
/* @__PURE__ */ X(V, {
|
|
3892
4133
|
size: 24,
|
|
3893
4134
|
icon: /* @__PURE__ */ X(e.trash, { size: 12 }),
|
|
3894
4135
|
onClick: () => y(t),
|
|
@@ -3903,7 +4144,8 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3903
4144
|
borderBottom: "1px solid var(--divider)",
|
|
3904
4145
|
verticalAlign: "middle"
|
|
3905
4146
|
},
|
|
3906
|
-
children: /* @__PURE__ */ X(
|
|
4147
|
+
children: /* @__PURE__ */ X(si, {
|
|
4148
|
+
entity: i,
|
|
3907
4149
|
actions: E,
|
|
3908
4150
|
objectIds: [t],
|
|
3909
4151
|
row: k,
|
|
@@ -3913,7 +4155,7 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3913
4155
|
]
|
|
3914
4156
|
});
|
|
3915
4157
|
}
|
|
3916
|
-
function
|
|
4158
|
+
function wi({ values: t, entity: r, columns: i, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
|
|
3917
4159
|
let m = n(), h = o.find((e) => e.startsWith("_error:")), g = new Set(o.filter((e) => !e.startsWith("_error:"))), _ = {
|
|
3918
4160
|
padding: "6px 12px",
|
|
3919
4161
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -3942,7 +4184,7 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
3942
4184
|
title: o ? `${e} is required` : void 0,
|
|
3943
4185
|
children: /* @__PURE__ */ X("div", {
|
|
3944
4186
|
style: v,
|
|
3945
|
-
children: n ?
|
|
4187
|
+
children: n ? B({
|
|
3946
4188
|
field: n,
|
|
3947
4189
|
fieldName: e,
|
|
3948
4190
|
value: t[e],
|
|
@@ -3979,13 +4221,13 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
3979
4221
|
title: h.slice(7),
|
|
3980
4222
|
children: "!"
|
|
3981
4223
|
}),
|
|
3982
|
-
/* @__PURE__ */ X(
|
|
4224
|
+
/* @__PURE__ */ X(V, {
|
|
3983
4225
|
size: 24,
|
|
3984
4226
|
icon: X(s ? A : e.check, { size: 12 }),
|
|
3985
4227
|
onClick: l,
|
|
3986
4228
|
title: "Confirm (Enter)"
|
|
3987
4229
|
}),
|
|
3988
|
-
/* @__PURE__ */ X(
|
|
4230
|
+
/* @__PURE__ */ X(V, {
|
|
3989
4231
|
size: 24,
|
|
3990
4232
|
icon: /* @__PURE__ */ X(e.x, { size: 12 }),
|
|
3991
4233
|
onClick: u,
|
|
@@ -3996,7 +4238,7 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
3996
4238
|
})]
|
|
3997
4239
|
});
|
|
3998
4240
|
}
|
|
3999
|
-
function
|
|
4241
|
+
function Ti({ values: t, entity: r, columns: i, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
|
|
4000
4242
|
let m = n(), h = Ie(), g = o.find((e) => e.startsWith("_error:")), _ = new Set(o.filter((e) => !e.startsWith("_error:")));
|
|
4001
4243
|
return /* @__PURE__ */ Z("div", {
|
|
4002
4244
|
style: {
|
|
@@ -4046,7 +4288,7 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
4046
4288
|
borderRadius: o ? 5 : 0
|
|
4047
4289
|
},
|
|
4048
4290
|
title: o ? `${e} is required` : void 0,
|
|
4049
|
-
children: i ? n ?
|
|
4291
|
+
children: i ? n ? B({
|
|
4050
4292
|
field: n,
|
|
4051
4293
|
fieldName: e,
|
|
4052
4294
|
value: t[e],
|
|
@@ -4081,13 +4323,13 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
4081
4323
|
title: g.slice(7),
|
|
4082
4324
|
children: "!"
|
|
4083
4325
|
}),
|
|
4084
|
-
/* @__PURE__ */ X(
|
|
4326
|
+
/* @__PURE__ */ X(V, {
|
|
4085
4327
|
size: 32,
|
|
4086
4328
|
icon: X(s ? A : e.check, { size: 14 }),
|
|
4087
4329
|
onClick: l,
|
|
4088
4330
|
title: "Confirm (Enter)"
|
|
4089
4331
|
}),
|
|
4090
|
-
/* @__PURE__ */ X(
|
|
4332
|
+
/* @__PURE__ */ X(V, {
|
|
4091
4333
|
size: 32,
|
|
4092
4334
|
icon: /* @__PURE__ */ X(e.x, { size: 14 }),
|
|
4093
4335
|
onClick: u,
|
|
@@ -4097,15 +4339,16 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
4097
4339
|
})]
|
|
4098
4340
|
});
|
|
4099
4341
|
}
|
|
4100
|
-
function
|
|
4101
|
-
|
|
4342
|
+
function Ei({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
4343
|
+
let d = q(() => {
|
|
4344
|
+
let e = new Set(r);
|
|
4345
|
+
return e.delete(i), e;
|
|
4346
|
+
}, [r, i]);
|
|
4347
|
+
return /* @__PURE__ */ X(wi, {
|
|
4102
4348
|
values: e,
|
|
4103
4349
|
entity: t,
|
|
4104
4350
|
columns: n,
|
|
4105
|
-
editableColumns:
|
|
4106
|
-
let e = new Set(r);
|
|
4107
|
-
return e.delete(i), e;
|
|
4108
|
-
}, [r, i]),
|
|
4351
|
+
editableColumns: d,
|
|
4109
4352
|
errors: a,
|
|
4110
4353
|
saving: o,
|
|
4111
4354
|
onChange: s,
|
|
@@ -4115,15 +4358,16 @@ function Zr({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
|
|
|
4115
4358
|
accent: !0
|
|
4116
4359
|
});
|
|
4117
4360
|
}
|
|
4118
|
-
function
|
|
4119
|
-
|
|
4361
|
+
function Di({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
4362
|
+
let d = q(() => {
|
|
4363
|
+
let e = new Set(r);
|
|
4364
|
+
return e.delete(i), e;
|
|
4365
|
+
}, [r, i]);
|
|
4366
|
+
return /* @__PURE__ */ X(Ti, {
|
|
4120
4367
|
values: e,
|
|
4121
4368
|
entity: t,
|
|
4122
4369
|
columns: n,
|
|
4123
|
-
editableColumns:
|
|
4124
|
-
let e = new Set(r);
|
|
4125
|
-
return e.delete(i), e;
|
|
4126
|
-
}, [r, i]),
|
|
4370
|
+
editableColumns: d,
|
|
4127
4371
|
errors: a,
|
|
4128
4372
|
saving: o,
|
|
4129
4373
|
onChange: s,
|
|
@@ -4135,76 +4379,76 @@ function Qr({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
|
|
|
4135
4379
|
}
|
|
4136
4380
|
//#endregion
|
|
4137
4381
|
//#region src/hooks/useMutations.ts
|
|
4138
|
-
function
|
|
4139
|
-
|
|
4382
|
+
function Oi(e) {
|
|
4383
|
+
U.error(e.message);
|
|
4140
4384
|
}
|
|
4141
|
-
function
|
|
4142
|
-
e.invalidateQueries({ queryKey: ["entity-data", t] }), e.invalidateQueries({ queryKey: ["entity-count", t] }), n.item && e.invalidateQueries({ queryKey: ["entity-item", t] }), n.children && e.invalidateQueries({ queryKey: [
|
|
4385
|
+
function ki(e, t, n = {}) {
|
|
4386
|
+
e.invalidateQueries({ queryKey: ["entity-data", t] }), e.invalidateQueries({ queryKey: ["entity-count", t] }), n.item && e.invalidateQueries({ queryKey: ["entity-item", t] }), n.children && e.invalidateQueries({ queryKey: [rr, t] }), n.objectMeta && (e.invalidateQueries({ queryKey: ["object-status", t] }), e.invalidateQueries({ queryKey: ["object-properties", t] }));
|
|
4143
4387
|
}
|
|
4144
|
-
function
|
|
4388
|
+
function Ai(e) {
|
|
4145
4389
|
let t = Ue();
|
|
4146
4390
|
return Ve({
|
|
4147
4391
|
mutationFn: (t) => M(e, t),
|
|
4148
4392
|
onSuccess: () => {
|
|
4149
|
-
|
|
4393
|
+
ki(t, e), U.success("Record created");
|
|
4150
4394
|
},
|
|
4151
|
-
onError:
|
|
4395
|
+
onError: Oi
|
|
4152
4396
|
});
|
|
4153
4397
|
}
|
|
4154
|
-
function
|
|
4398
|
+
function ji(e) {
|
|
4155
4399
|
let t = Ue();
|
|
4156
4400
|
return Ve({
|
|
4157
|
-
mutationFn: ({ pkValues: t, data: n }) =>
|
|
4401
|
+
mutationFn: ({ pkValues: t, data: n }) => ne(e, t, n),
|
|
4158
4402
|
onSuccess: () => {
|
|
4159
|
-
|
|
4403
|
+
ki(t, e, {
|
|
4160
4404
|
item: !0,
|
|
4161
4405
|
children: !0,
|
|
4162
4406
|
objectMeta: !0
|
|
4163
|
-
}),
|
|
4407
|
+
}), U.success("Record updated");
|
|
4164
4408
|
},
|
|
4165
|
-
onError:
|
|
4409
|
+
onError: Oi
|
|
4166
4410
|
});
|
|
4167
4411
|
}
|
|
4168
|
-
function
|
|
4412
|
+
function Mi(e) {
|
|
4169
4413
|
let t = Ue();
|
|
4170
4414
|
return Ve({
|
|
4171
|
-
mutationFn: (t) =>
|
|
4415
|
+
mutationFn: (t) => ue(e, t),
|
|
4172
4416
|
onSuccess: () => {
|
|
4173
|
-
|
|
4417
|
+
ki(t, e, { item: !0 }), U.success("Record deleted");
|
|
4174
4418
|
},
|
|
4175
|
-
onError:
|
|
4419
|
+
onError: Oi
|
|
4176
4420
|
});
|
|
4177
4421
|
}
|
|
4178
|
-
function
|
|
4422
|
+
function Ni(e) {
|
|
4179
4423
|
let t = Ue();
|
|
4180
4424
|
return Ve({
|
|
4181
4425
|
mutationFn: (t) => w(e, t),
|
|
4182
4426
|
onSuccess: () => {
|
|
4183
|
-
|
|
4427
|
+
ki(t, e, {
|
|
4184
4428
|
item: !0,
|
|
4185
4429
|
objectMeta: !0
|
|
4186
|
-
}),
|
|
4430
|
+
}), U.success("Record restored");
|
|
4187
4431
|
},
|
|
4188
|
-
onError:
|
|
4432
|
+
onError: Oi
|
|
4189
4433
|
});
|
|
4190
4434
|
}
|
|
4191
4435
|
//#endregion
|
|
4192
4436
|
//#region src/components/shared/LoadingSkeleton.tsx
|
|
4193
|
-
var
|
|
4437
|
+
var Pi = {
|
|
4194
4438
|
display: "block",
|
|
4195
4439
|
background: "linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 40%, var(--surface-3) 80%)",
|
|
4196
4440
|
backgroundSize: "200% 100%",
|
|
4197
4441
|
borderRadius: 6,
|
|
4198
4442
|
animation: "declarion-shimmer 1.2s ease-in-out infinite"
|
|
4199
4443
|
};
|
|
4200
|
-
function
|
|
4201
|
-
return /* @__PURE__ */ Z(
|
|
4202
|
-
...
|
|
4444
|
+
function Fi({ height: e, width: t }) {
|
|
4445
|
+
return /* @__PURE__ */ Z(We, { children: [/* @__PURE__ */ X("style", { children: "@keyframes declarion-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}" }), /* @__PURE__ */ X("span", { style: {
|
|
4446
|
+
...Pi,
|
|
4203
4447
|
height: e,
|
|
4204
4448
|
width: t ?? "100%"
|
|
4205
4449
|
} })] });
|
|
4206
4450
|
}
|
|
4207
|
-
function
|
|
4451
|
+
function Ii({ rows: e = 8, cols: t = 4 }) {
|
|
4208
4452
|
return /* @__PURE__ */ Z("div", {
|
|
4209
4453
|
style: {
|
|
4210
4454
|
padding: 16,
|
|
@@ -4219,7 +4463,7 @@ function si({ rows: e = 8, cols: t = 4 }) {
|
|
|
4219
4463
|
},
|
|
4220
4464
|
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ X("div", {
|
|
4221
4465
|
style: { flex: 1 },
|
|
4222
|
-
children: /* @__PURE__ */ X(
|
|
4466
|
+
children: /* @__PURE__ */ X(Fi, { height: 14 })
|
|
4223
4467
|
}, t))
|
|
4224
4468
|
}), Array.from({ length: e }).map((e, n) => /* @__PURE__ */ X("div", {
|
|
4225
4469
|
style: {
|
|
@@ -4228,12 +4472,12 @@ function si({ rows: e = 8, cols: t = 4 }) {
|
|
|
4228
4472
|
},
|
|
4229
4473
|
children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ X("div", {
|
|
4230
4474
|
style: { flex: 1 },
|
|
4231
|
-
children: /* @__PURE__ */ X(
|
|
4475
|
+
children: /* @__PURE__ */ X(Fi, { height: 28 })
|
|
4232
4476
|
}, t))
|
|
4233
4477
|
}, n))]
|
|
4234
4478
|
});
|
|
4235
4479
|
}
|
|
4236
|
-
function
|
|
4480
|
+
function Li() {
|
|
4237
4481
|
return /* @__PURE__ */ Z("div", {
|
|
4238
4482
|
style: {
|
|
4239
4483
|
padding: 20,
|
|
@@ -4242,7 +4486,7 @@ function ci() {
|
|
|
4242
4486
|
gap: 16
|
|
4243
4487
|
},
|
|
4244
4488
|
children: [
|
|
4245
|
-
/* @__PURE__ */ X(
|
|
4489
|
+
/* @__PURE__ */ X(Fi, {
|
|
4246
4490
|
height: 12,
|
|
4247
4491
|
width: 160
|
|
4248
4492
|
}),
|
|
@@ -4253,11 +4497,11 @@ function ci() {
|
|
|
4253
4497
|
gap: 12
|
|
4254
4498
|
},
|
|
4255
4499
|
children: [/* @__PURE__ */ X("span", { style: {
|
|
4256
|
-
...
|
|
4500
|
+
...Pi,
|
|
4257
4501
|
width: 32,
|
|
4258
4502
|
height: 32,
|
|
4259
4503
|
borderRadius: 8
|
|
4260
|
-
} }), /* @__PURE__ */ X(
|
|
4504
|
+
} }), /* @__PURE__ */ X(Fi, {
|
|
4261
4505
|
height: 22,
|
|
4262
4506
|
width: 240
|
|
4263
4507
|
})]
|
|
@@ -4274,7 +4518,7 @@ function ci() {
|
|
|
4274
4518
|
padding: "11px 14px",
|
|
4275
4519
|
borderBottom: "1px solid var(--divider)"
|
|
4276
4520
|
},
|
|
4277
|
-
children: /* @__PURE__ */ X(
|
|
4521
|
+
children: /* @__PURE__ */ X(Fi, {
|
|
4278
4522
|
height: 13,
|
|
4279
4523
|
width: 150
|
|
4280
4524
|
})
|
|
@@ -4290,12 +4534,12 @@ function ci() {
|
|
|
4290
4534
|
display: "flex",
|
|
4291
4535
|
gap: 16
|
|
4292
4536
|
},
|
|
4293
|
-
children: [/* @__PURE__ */ X(
|
|
4537
|
+
children: [/* @__PURE__ */ X(Fi, {
|
|
4294
4538
|
height: 13,
|
|
4295
4539
|
width: 110
|
|
4296
4540
|
}), /* @__PURE__ */ X("div", {
|
|
4297
4541
|
style: { flex: 1 },
|
|
4298
|
-
children: /* @__PURE__ */ X(
|
|
4542
|
+
children: /* @__PURE__ */ X(Fi, { height: 13 })
|
|
4299
4543
|
})]
|
|
4300
4544
|
}, t))
|
|
4301
4545
|
})]
|
|
@@ -4305,11 +4549,11 @@ function ci() {
|
|
|
4305
4549
|
}
|
|
4306
4550
|
//#endregion
|
|
4307
4551
|
//#region src/lib/sort.ts
|
|
4308
|
-
var
|
|
4552
|
+
var Ri = {
|
|
4309
4553
|
nulls_first: "first",
|
|
4310
4554
|
nulls_last: "last"
|
|
4311
4555
|
};
|
|
4312
|
-
function
|
|
4556
|
+
function zi(e) {
|
|
4313
4557
|
if (!e) return [];
|
|
4314
4558
|
let t = [];
|
|
4315
4559
|
for (let n of e.split(",")) {
|
|
@@ -4322,14 +4566,14 @@ function ui(e) {
|
|
|
4322
4566
|
dir: r[1]?.trim().toLowerCase() === "desc" ? "desc" : "asc"
|
|
4323
4567
|
}, o = r[2]?.trim().toLowerCase();
|
|
4324
4568
|
if (o) {
|
|
4325
|
-
let e =
|
|
4569
|
+
let e = Ri[o];
|
|
4326
4570
|
e && (a.nulls = e);
|
|
4327
4571
|
}
|
|
4328
4572
|
t.push(a);
|
|
4329
4573
|
}
|
|
4330
4574
|
return t;
|
|
4331
4575
|
}
|
|
4332
|
-
function
|
|
4576
|
+
function Bi(e) {
|
|
4333
4577
|
if (!e) return;
|
|
4334
4578
|
let t = [];
|
|
4335
4579
|
for (let n of e.split(",")) {
|
|
@@ -4340,39 +4584,39 @@ function di(e) {
|
|
|
4340
4584
|
}
|
|
4341
4585
|
return t.length > 0 ? t.join(",") : void 0;
|
|
4342
4586
|
}
|
|
4343
|
-
function
|
|
4587
|
+
function Vi(e) {
|
|
4344
4588
|
return e.map((e) => {
|
|
4345
4589
|
let t = `${e.field}:${e.dir}`;
|
|
4346
4590
|
return e.nulls === "first" ? `${t}:nulls_first` : e.nulls === "last" ? `${t}:nulls_last` : t;
|
|
4347
4591
|
}).join(",");
|
|
4348
4592
|
}
|
|
4349
|
-
function
|
|
4593
|
+
function Hi(e, t) {
|
|
4350
4594
|
let n = e.findIndex((e) => e.field === t);
|
|
4351
4595
|
return n >= 0 ? [...e.slice(0, n), ...e.slice(n + 1)] : e.length >= 5 ? e : [...e, {
|
|
4352
4596
|
field: t,
|
|
4353
4597
|
dir: "asc"
|
|
4354
4598
|
}];
|
|
4355
4599
|
}
|
|
4356
|
-
function
|
|
4600
|
+
function Ui(e, t) {
|
|
4357
4601
|
let n = e.filter((e) => e.field !== t.field);
|
|
4358
4602
|
return n.length >= 5 ? e : [...n, t];
|
|
4359
4603
|
}
|
|
4360
|
-
function
|
|
4604
|
+
function Wi(e, t) {
|
|
4361
4605
|
let n = e.findIndex((e) => e.field === t);
|
|
4362
4606
|
return n < 0 ? e : [...e.slice(0, n), ...e.slice(n + 1)];
|
|
4363
4607
|
}
|
|
4364
4608
|
//#endregion
|
|
4365
4609
|
//#region src/hooks/useScreenBack.ts
|
|
4366
|
-
function
|
|
4367
|
-
let t = ze(), n =
|
|
4610
|
+
function Gi(e) {
|
|
4611
|
+
let t = ze(), n = ae(), i = ie(), a = jt((e) => e.depth), { data: o } = r(), s = e?.fallback, c = At((e) => {
|
|
4368
4612
|
let t = e.tabs.find((t) => t.id === e.activeTabId);
|
|
4369
4613
|
return t ? t.returnTo : void 0;
|
|
4370
|
-
}), { hasOriginBack: l, allowFallbackBack: u } =
|
|
4614
|
+
}), { hasOriginBack: l, allowFallbackBack: u } = q(() => Lt(c, n.enabled), [c, n.enabled]), d = G(() => {
|
|
4371
4615
|
if (n.enabled) {
|
|
4372
|
-
|
|
4616
|
+
jt.getState().depth > 0 ? i() : s?.();
|
|
4373
4617
|
return;
|
|
4374
4618
|
}
|
|
4375
|
-
let e =
|
|
4619
|
+
let e = At.getState(), r = Rt(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
|
|
4376
4620
|
if (!r) {
|
|
4377
4621
|
s?.();
|
|
4378
4622
|
return;
|
|
@@ -4391,7 +4635,7 @@ function gi(e) {
|
|
|
4391
4635
|
}
|
|
4392
4636
|
t({
|
|
4393
4637
|
pathname: r.pathname,
|
|
4394
|
-
search:
|
|
4638
|
+
search: Ft(r.search),
|
|
4395
4639
|
hash: r.hash || void 0
|
|
4396
4640
|
});
|
|
4397
4641
|
}, [
|
|
@@ -4411,40 +4655,40 @@ function gi(e) {
|
|
|
4411
4655
|
}
|
|
4412
4656
|
//#endregion
|
|
4413
4657
|
//#region src/lib/field-classification.ts
|
|
4414
|
-
function
|
|
4658
|
+
function Ki(e, t) {
|
|
4415
4659
|
let n = e?.field_access?.[t];
|
|
4416
4660
|
return !n || n.read === "granted";
|
|
4417
4661
|
}
|
|
4418
|
-
function
|
|
4662
|
+
function qi(e, t) {
|
|
4419
4663
|
let n = e?.field_access?.[t];
|
|
4420
4664
|
return !n || n.write === "granted";
|
|
4421
4665
|
}
|
|
4422
|
-
function
|
|
4666
|
+
function Ji(e, t) {
|
|
4423
4667
|
return e?.field_access?.[t]?.classification;
|
|
4424
4668
|
}
|
|
4425
|
-
function
|
|
4669
|
+
function Yi(e, t) {
|
|
4426
4670
|
return e?.field_access?.[t]?.required_permission;
|
|
4427
4671
|
}
|
|
4428
|
-
function
|
|
4429
|
-
let r =
|
|
4672
|
+
function Xi(e, t, n) {
|
|
4673
|
+
let r = Ji(t, n);
|
|
4430
4674
|
if (r) return e?.classifications?.[r];
|
|
4431
4675
|
}
|
|
4432
|
-
function
|
|
4433
|
-
return !!
|
|
4676
|
+
function Zi(e, t, n) {
|
|
4677
|
+
return !!Xi(e, t, n)?.sod_protected;
|
|
4434
4678
|
}
|
|
4435
|
-
function
|
|
4679
|
+
function Qi(e, t) {
|
|
4436
4680
|
return e?.field_access?.[t];
|
|
4437
4681
|
}
|
|
4438
4682
|
//#endregion
|
|
4439
4683
|
//#region src/components/pages/list/cardProjection.ts
|
|
4440
|
-
var
|
|
4684
|
+
var $i = 4, ea = 2, ta = 2, na = [
|
|
4441
4685
|
"screen_card",
|
|
4442
4686
|
"entity_card",
|
|
4443
4687
|
"saved_view_columns",
|
|
4444
4688
|
"screen_default_columns",
|
|
4445
4689
|
"screen_columns",
|
|
4446
4690
|
"entity_inference"
|
|
4447
|
-
],
|
|
4691
|
+
], ra = /* @__PURE__ */ new Set(["_select", "_actions"]), ia = /* @__PURE__ */ new Set([
|
|
4448
4692
|
"text",
|
|
4449
4693
|
"rich_text",
|
|
4450
4694
|
"multilang_text",
|
|
@@ -4453,11 +4697,11 @@ var wi = 4, Ti = 2, Ei = 2, Di = [
|
|
|
4453
4697
|
"secret",
|
|
4454
4698
|
"password",
|
|
4455
4699
|
"bytes"
|
|
4456
|
-
]),
|
|
4700
|
+
]), aa = /* @__PURE__ */ new Set(["enum", "bool"]), oa = /* @__PURE__ */ new Set([
|
|
4457
4701
|
"date",
|
|
4458
4702
|
"time",
|
|
4459
4703
|
"timestamp"
|
|
4460
|
-
]),
|
|
4704
|
+
]), sa = /* @__PURE__ */ new Set([
|
|
4461
4705
|
"string",
|
|
4462
4706
|
"text",
|
|
4463
4707
|
"email",
|
|
@@ -4483,58 +4727,88 @@ var wi = 4, Ti = 2, Ei = 2, Di = [
|
|
|
4483
4727
|
"enum",
|
|
4484
4728
|
"status"
|
|
4485
4729
|
]);
|
|
4486
|
-
function
|
|
4730
|
+
function ca(e) {
|
|
4487
4731
|
let { entity: t, screen: n, savedViewColumns: r } = e, i = n?.card;
|
|
4488
|
-
if (i) return
|
|
4489
|
-
if (t?.card) return
|
|
4490
|
-
let a =
|
|
4491
|
-
return
|
|
4492
|
-
}
|
|
4493
|
-
function
|
|
4494
|
-
let { entity: t, screen: n, presentation: r, visibleColumns: i, card: a, rowActions: o, toolbarActions: s, bulkActions: c, sort: l, includeDetailHandoff: u = !0, screens: d } = e, f = new
|
|
4495
|
-
for (let e of p) f.addField(e, "render"),
|
|
4496
|
-
let m
|
|
4732
|
+
if (i) return pa(t, i, "screen_card");
|
|
4733
|
+
if (t?.card) return pa(t, t.card, "entity_card");
|
|
4734
|
+
let a = ga(t, n, r);
|
|
4735
|
+
return ma(t, a.columns, a.source);
|
|
4736
|
+
}
|
|
4737
|
+
function la(e) {
|
|
4738
|
+
let { entity: t, screen: n, presentation: r, visibleColumns: i, card: a, rowActions: o, toolbarActions: s, bulkActions: c, sort: l, includeDetailHandoff: u = !0, screens: d } = e, f = new Ga(), p = r === "cards" ? a.renderFields : va(t, i, { explicit: !0 }), m = r === "cards" ? da(t, n) : [];
|
|
4739
|
+
for (let e of p) f.addField(e, "render"), Ha(t, e, f, "render");
|
|
4740
|
+
for (let e of m) p.includes(e) || (f.addField(e, "variant"), Ha(t, e, f, "variant"));
|
|
4741
|
+
let h = ka(t, f), g = Pa(t, [
|
|
4497
4742
|
o,
|
|
4498
4743
|
s,
|
|
4499
4744
|
c
|
|
4500
|
-
], f),
|
|
4501
|
-
if (u) for (let e of
|
|
4502
|
-
let
|
|
4503
|
-
for (let e of
|
|
4504
|
-
for (let e of
|
|
4505
|
-
for (let e of
|
|
4506
|
-
for (let e of
|
|
4507
|
-
let
|
|
4508
|
-
for (let e of
|
|
4509
|
-
|
|
4510
|
-
let
|
|
4745
|
+
], f), _ = ua(t, n, f), v = Fa(t, l, f), y = Ia(t, n, d, f);
|
|
4746
|
+
if (u) for (let e of h) f.addField(e, "detail_handoff");
|
|
4747
|
+
let b = new $();
|
|
4748
|
+
for (let e of h) b.add(e);
|
|
4749
|
+
for (let e of g) b.add(e);
|
|
4750
|
+
for (let e of _) b.add(e);
|
|
4751
|
+
for (let e of m) b.add(e);
|
|
4752
|
+
for (let e of v) b.add(e);
|
|
4753
|
+
for (let e of y) b.add(e);
|
|
4754
|
+
let x = new $();
|
|
4755
|
+
for (let e of p) Va(t, e, x, f);
|
|
4756
|
+
for (let e of b.values()) Va(t, e, x, f);
|
|
4757
|
+
let S = x.values(), C = Ua(f);
|
|
4511
4758
|
return {
|
|
4512
4759
|
renderFields: p,
|
|
4513
|
-
dependencyFields:
|
|
4514
|
-
conditionFields:
|
|
4515
|
-
identityFields:
|
|
4516
|
-
sortFields:
|
|
4517
|
-
selectFields:
|
|
4518
|
-
expandFields:
|
|
4760
|
+
dependencyFields: b.values().filter((e) => !p.includes(e)),
|
|
4761
|
+
conditionFields: g,
|
|
4762
|
+
identityFields: h,
|
|
4763
|
+
sortFields: v,
|
|
4764
|
+
selectFields: S.length > 0 ? S : void 0,
|
|
4765
|
+
expandFields: C.length > 0 ? C : void 0,
|
|
4519
4766
|
reasons: f.snapshot()
|
|
4520
4767
|
};
|
|
4521
4768
|
}
|
|
4522
|
-
function
|
|
4769
|
+
function ua(e, t, n) {
|
|
4770
|
+
let r = new $(), i = (t) => {
|
|
4771
|
+
for (let n of t) n.and ? i(n.and) : n.or ? i(n.or) : n.field && e?.fields.has(n.field) && r.add(n.field);
|
|
4772
|
+
};
|
|
4773
|
+
for (let t of e?.variants?.items() ?? []) t.when && i(t.when);
|
|
4774
|
+
for (let e of t?.variants?.items() ?? []) e.when && i(e.when);
|
|
4775
|
+
for (let e of r.values()) n.addField(e, "variant");
|
|
4776
|
+
return r.values();
|
|
4777
|
+
}
|
|
4778
|
+
function da(e, t, n) {
|
|
4779
|
+
let r = new $();
|
|
4780
|
+
for (let i of ca({
|
|
4781
|
+
entity: e,
|
|
4782
|
+
screen: t,
|
|
4783
|
+
savedViewColumns: n
|
|
4784
|
+
}).renderFields) r.add(i);
|
|
4785
|
+
for (let i of t?.variants?.items() ?? []) {
|
|
4786
|
+
let a = { ...t };
|
|
4787
|
+
i.card !== void 0 && (a.card = i.card);
|
|
4788
|
+
for (let t of ca({
|
|
4789
|
+
entity: e,
|
|
4790
|
+
screen: a,
|
|
4791
|
+
savedViewColumns: n
|
|
4792
|
+
}).renderFields) r.add(t);
|
|
4793
|
+
}
|
|
4794
|
+
return r.values();
|
|
4795
|
+
}
|
|
4796
|
+
function fa(e, t, n) {
|
|
4523
4797
|
if (!e || t?.on_row_click !== "peek" || t.quick_peek?.enabled === !1) return [];
|
|
4524
4798
|
let r = t.quick_peek?.fields;
|
|
4525
|
-
if (r && r.length > 0) return
|
|
4799
|
+
if (r && r.length > 0) return va(e, r, { explicit: !0 });
|
|
4526
4800
|
let i = t.quick_peek?.sections;
|
|
4527
4801
|
if (i && i.length > 0) {
|
|
4528
4802
|
let r = Object.values(n ?? {}).find((e) => e.type === "detail" && e.entity === t.entity), a = new $();
|
|
4529
|
-
|
|
4530
|
-
let o =
|
|
4803
|
+
La(r?.items, new Set(i.map(String)), a);
|
|
4804
|
+
let o = va(e, a.values(), { explicit: !0 });
|
|
4531
4805
|
if (o.length > 0) return o;
|
|
4532
4806
|
}
|
|
4533
|
-
return
|
|
4807
|
+
return Ba(e);
|
|
4534
4808
|
}
|
|
4535
|
-
function
|
|
4536
|
-
let r = t.max_body_fields ??
|
|
4537
|
-
return
|
|
4809
|
+
function pa(e, t, n) {
|
|
4810
|
+
let r = t.max_body_fields ?? $i, i = ya(e, t.title_field, { explicit: !0 }), a = ya(e, t.subtitle_field, { explicit: !0 }), o = va(e, t.badge_fields ?? [], { explicit: !0 }), s = va(e, t.fields ?? [], { explicit: !0 }), c = va(e, t.meta_fields ?? [], { explicit: !0 });
|
|
4811
|
+
return ha({
|
|
4538
4812
|
source: n,
|
|
4539
4813
|
explicit: !0,
|
|
4540
4814
|
titleField: i,
|
|
@@ -4547,28 +4821,28 @@ function Ii(e, t, n) {
|
|
|
4547
4821
|
maxBodyFields: r
|
|
4548
4822
|
});
|
|
4549
4823
|
}
|
|
4550
|
-
function
|
|
4551
|
-
let r =
|
|
4824
|
+
function ma(e, t, n) {
|
|
4825
|
+
let r = va(e, t, { explicit: !1 }), i = $i, a = ya(e, e?.display?.display_field, { explicit: !1 }), o = a ?? ba(e, r, {
|
|
4552
4826
|
allowLong: !1,
|
|
4553
4827
|
allowAuto: !1
|
|
4554
|
-
}), s = a !== void 0, c = o ? /* @__PURE__ */ new Set([o]) : void 0, l = r.find((t) => !c?.has(t) &&
|
|
4828
|
+
}), s = a !== void 0, c = o ? /* @__PURE__ */ new Set([o]) : void 0, l = r.find((t) => !c?.has(t) && Sa(e, t)), u = new Set([o, l].filter((e) => !!e)), d = wa(e, r).filter((e) => !u.has(e)).slice(0, ea);
|
|
4555
4829
|
for (let e of d) u.add(e);
|
|
4556
|
-
let f = r.filter((t) => !u.has(t) &&
|
|
4830
|
+
let f = r.filter((t) => !u.has(t) && Ta(e, t)).slice(0, ta);
|
|
4557
4831
|
for (let e of f) u.add(e);
|
|
4558
|
-
return
|
|
4832
|
+
return ha({
|
|
4559
4833
|
source: n,
|
|
4560
4834
|
explicit: !1,
|
|
4561
4835
|
titleField: o,
|
|
4562
4836
|
titleUsesDisplay: s,
|
|
4563
4837
|
subtitleField: l,
|
|
4564
4838
|
badgeFields: d,
|
|
4565
|
-
bodyFields: r.filter((t) => !u.has(t) &&
|
|
4839
|
+
bodyFields: r.filter((t) => !u.has(t) && xa(e, t)).slice(0, i),
|
|
4566
4840
|
metaFields: f,
|
|
4567
4841
|
hideEmptyFields: !0,
|
|
4568
4842
|
maxBodyFields: i
|
|
4569
4843
|
});
|
|
4570
4844
|
}
|
|
4571
|
-
function
|
|
4845
|
+
function ha(e) {
|
|
4572
4846
|
let t = new $(), n = [], r = (r, i) => {
|
|
4573
4847
|
!r || t.has(r) || (t.add(r), n.push({
|
|
4574
4848
|
field: r,
|
|
@@ -4593,10 +4867,10 @@ function Ri(e) {
|
|
|
4593
4867
|
maxBodyFields: e.maxBodyFields,
|
|
4594
4868
|
renderFields: t.values(),
|
|
4595
4869
|
fields: n,
|
|
4596
|
-
sourcePrecedence:
|
|
4870
|
+
sourcePrecedence: na
|
|
4597
4871
|
};
|
|
4598
4872
|
}
|
|
4599
|
-
function
|
|
4873
|
+
function ga(e, t, n) {
|
|
4600
4874
|
return n && n.length > 0 ? {
|
|
4601
4875
|
source: "saved_view_columns",
|
|
4602
4876
|
columns: n
|
|
@@ -4608,10 +4882,10 @@ function zi(e, t, n) {
|
|
|
4608
4882
|
columns: t.columns
|
|
4609
4883
|
} : {
|
|
4610
4884
|
source: "entity_inference",
|
|
4611
|
-
columns:
|
|
4885
|
+
columns: _a(e)
|
|
4612
4886
|
};
|
|
4613
4887
|
}
|
|
4614
|
-
function
|
|
4888
|
+
function _a(e) {
|
|
4615
4889
|
if (!e) return [];
|
|
4616
4890
|
let t = [];
|
|
4617
4891
|
e.display.display_field && t.push(e.display.display_field);
|
|
@@ -4621,16 +4895,16 @@ function Bi(e) {
|
|
|
4621
4895
|
if (e.evidence_covered && t.push("$evidence"), e.files) for (let [n] of e.files) t.push(n);
|
|
4622
4896
|
return t;
|
|
4623
4897
|
}
|
|
4624
|
-
function
|
|
4898
|
+
function va(e, t, n) {
|
|
4625
4899
|
let r = new $();
|
|
4626
4900
|
for (let i of t) {
|
|
4627
|
-
let t =
|
|
4901
|
+
let t = ya(e, i, n);
|
|
4628
4902
|
t && r.add(t);
|
|
4629
4903
|
}
|
|
4630
4904
|
return r.values();
|
|
4631
4905
|
}
|
|
4632
|
-
function
|
|
4633
|
-
if (!t ||
|
|
4906
|
+
function ya(e, t, n) {
|
|
4907
|
+
if (!t || ra.has(t)) return;
|
|
4634
4908
|
if (!e) return t.startsWith("$") ? void 0 : t;
|
|
4635
4909
|
if (t.startsWith("$status.")) {
|
|
4636
4910
|
let n = t.slice(8);
|
|
@@ -4645,55 +4919,55 @@ function Hi(e, t, n) {
|
|
|
4645
4919
|
let r = e.fields.get(t), i = e.files?.get(t);
|
|
4646
4920
|
if (!(!r && !i) && (n.explicit || !(r && r.display?.is_listable === !1) && !(i && i.display?.is_listable === !1))) return t;
|
|
4647
4921
|
}
|
|
4648
|
-
function
|
|
4649
|
-
return t.find((t) => n.exclude?.has(t) || !n.allowAuto &&
|
|
4922
|
+
function ba(e, t, n) {
|
|
4923
|
+
return t.find((t) => n.exclude?.has(t) || !n.allowAuto && Da(e, t) || !n.allowLong && Oa(e, t) ? !1 : Ea(e, t));
|
|
4650
4924
|
}
|
|
4651
|
-
function
|
|
4652
|
-
return !(!
|
|
4925
|
+
function xa(e, t) {
|
|
4926
|
+
return !(!Ea(e, t) || Da(e, t) || Oa(e, t));
|
|
4653
4927
|
}
|
|
4654
|
-
function
|
|
4655
|
-
return !(!
|
|
4928
|
+
function Sa(e, t) {
|
|
4929
|
+
return !(!Ea(e, t) || Da(e, t) || Oa(e, t) || Ta(e, t) || Ca(e, t));
|
|
4656
4930
|
}
|
|
4657
|
-
function
|
|
4931
|
+
function Ca(e, t) {
|
|
4658
4932
|
if (t.startsWith("$status.") || t.startsWith("$property.") || t === "$evidence") return !0;
|
|
4659
|
-
let n =
|
|
4660
|
-
return n.kind === "field" &&
|
|
4933
|
+
let n = Wa(e, t);
|
|
4934
|
+
return n.kind === "field" && aa.has(n.field.type);
|
|
4661
4935
|
}
|
|
4662
|
-
function
|
|
4936
|
+
function wa(e, t) {
|
|
4663
4937
|
let n = new $();
|
|
4664
4938
|
for (let e of t) (e.startsWith("$status.") || e.startsWith("$property.") || e === "$evidence") && n.add(e);
|
|
4665
|
-
for (let r of t)
|
|
4939
|
+
for (let r of t) Ca(e, r) && n.add(r);
|
|
4666
4940
|
return n.values();
|
|
4667
4941
|
}
|
|
4668
|
-
function
|
|
4669
|
-
if (
|
|
4670
|
-
let n =
|
|
4671
|
-
return n.kind === "field" &&
|
|
4942
|
+
function Ta(e, t) {
|
|
4943
|
+
if (Da(e, t)) return !1;
|
|
4944
|
+
let n = Wa(e, t);
|
|
4945
|
+
return n.kind === "field" && oa.has(n.field.type);
|
|
4672
4946
|
}
|
|
4673
|
-
function
|
|
4674
|
-
return
|
|
4947
|
+
function Ea(e, t) {
|
|
4948
|
+
return Wa(e, t).kind !== "missing";
|
|
4675
4949
|
}
|
|
4676
|
-
function
|
|
4677
|
-
let n =
|
|
4950
|
+
function Da(e, t) {
|
|
4951
|
+
let n = Wa(e, t);
|
|
4678
4952
|
return n.kind === "field" && (n.field.primary === !0 || n.field.auto === !0);
|
|
4679
4953
|
}
|
|
4680
|
-
function
|
|
4681
|
-
let n =
|
|
4682
|
-
return n.kind === "file" ? n.file.mode !== "single" : n.kind === "field" &&
|
|
4954
|
+
function Oa(e, t) {
|
|
4955
|
+
let n = Wa(e, t);
|
|
4956
|
+
return n.kind === "file" ? n.file.mode !== "single" : n.kind === "field" && ia.has(n.field.type);
|
|
4683
4957
|
}
|
|
4684
|
-
function
|
|
4958
|
+
function ka(e, t) {
|
|
4685
4959
|
if (!e) return [];
|
|
4686
4960
|
let n = new $();
|
|
4687
|
-
for (let r of
|
|
4688
|
-
let r =
|
|
4689
|
-
r && (n.add(r), t.addField(r, "display"),
|
|
4690
|
-
for (let r of
|
|
4691
|
-
let i =
|
|
4692
|
-
i && (n.add(i), t.addField(i, "display_template"),
|
|
4961
|
+
for (let r of de(e)) n.add(r), t.addField(r, "identity");
|
|
4962
|
+
let r = ya(e, e.display.display_field, { explicit: !0 });
|
|
4963
|
+
r && (n.add(r), t.addField(r, "display"), Ha(e, r, t, "display"));
|
|
4964
|
+
for (let r of Aa(e.display.display_template)) {
|
|
4965
|
+
let i = ya(e, r, { explicit: !0 });
|
|
4966
|
+
i && (n.add(i), t.addField(i, "display_template"), Ha(e, i, t, "display_template"));
|
|
4693
4967
|
}
|
|
4694
4968
|
return n.values();
|
|
4695
4969
|
}
|
|
4696
|
-
function
|
|
4970
|
+
function Aa(e) {
|
|
4697
4971
|
if (!e) return [];
|
|
4698
4972
|
let t = new $(), n = 0;
|
|
4699
4973
|
for (; n < e.length;) {
|
|
@@ -4703,14 +4977,14 @@ function $i(e) {
|
|
|
4703
4977
|
n = r + 2;
|
|
4704
4978
|
continue;
|
|
4705
4979
|
}
|
|
4706
|
-
let i =
|
|
4980
|
+
let i = ja(e, r + 2);
|
|
4707
4981
|
if (i < 0) break;
|
|
4708
|
-
for (let n of
|
|
4982
|
+
for (let n of Ma(e.slice(r + 2, i))) t.add(n);
|
|
4709
4983
|
n = i + 1;
|
|
4710
4984
|
}
|
|
4711
4985
|
return t.values();
|
|
4712
4986
|
}
|
|
4713
|
-
function
|
|
4987
|
+
function ja(e, t) {
|
|
4714
4988
|
let n = 0;
|
|
4715
4989
|
for (let r = t; r < e.length; r += 1) {
|
|
4716
4990
|
let t = e[r];
|
|
@@ -4725,62 +4999,71 @@ function ea(e, t) {
|
|
|
4725
4999
|
}
|
|
4726
5000
|
return -1;
|
|
4727
5001
|
}
|
|
4728
|
-
function
|
|
5002
|
+
function Ma(e) {
|
|
4729
5003
|
let t = new $(), n = 0;
|
|
4730
5004
|
for (; n < e.length;) {
|
|
4731
5005
|
let r = e.indexOf("row.", n);
|
|
4732
5006
|
if (r < 0) break;
|
|
4733
|
-
if (r > 0 &&
|
|
5007
|
+
if (r > 0 && Na(e.charCodeAt(r - 1))) {
|
|
4734
5008
|
n = r + 4;
|
|
4735
5009
|
continue;
|
|
4736
5010
|
}
|
|
4737
5011
|
let i = r + 4, a = i;
|
|
4738
|
-
for (; a < e.length &&
|
|
5012
|
+
for (; a < e.length && Na(e.charCodeAt(a));) a += 1;
|
|
4739
5013
|
a > i && t.add(e.slice(i, a)), n = a;
|
|
4740
5014
|
}
|
|
4741
5015
|
return t.values();
|
|
4742
5016
|
}
|
|
4743
|
-
function
|
|
5017
|
+
function Na(e) {
|
|
4744
5018
|
return e >= 48 && e <= 57 || e >= 65 && e <= 90 || e >= 97 && e <= 122 || e === 95;
|
|
4745
5019
|
}
|
|
4746
|
-
function
|
|
5020
|
+
function Pa(e, t, n) {
|
|
4747
5021
|
let r = new $();
|
|
4748
5022
|
for (let i of t) for (let t of i ?? []) for (let i of [
|
|
4749
5023
|
...t.action.visible_if ?? [],
|
|
4750
5024
|
...t.action.enabled_if ?? [],
|
|
4751
5025
|
...t.action.conditions ?? []
|
|
4752
5026
|
]) {
|
|
4753
|
-
let t =
|
|
4754
|
-
t && (r.add(t), n.addField(t, "condition"),
|
|
5027
|
+
let t = ya(e, i.field, { explicit: !0 });
|
|
5028
|
+
t && (r.add(t), n.addField(t, "condition"), Ha(e, t, n, "condition"));
|
|
4755
5029
|
}
|
|
4756
5030
|
return r.values();
|
|
4757
5031
|
}
|
|
4758
|
-
function
|
|
4759
|
-
let r = typeof t == "string" ?
|
|
5032
|
+
function Fa(e, t, n) {
|
|
5033
|
+
let r = typeof t == "string" ? zi(t) : t ?? [], i = new $();
|
|
4760
5034
|
for (let t of r) {
|
|
4761
|
-
let r =
|
|
4762
|
-
r && (i.add(r), n.addField(r, "sort"),
|
|
5035
|
+
let r = ya(e, t.field, { explicit: !0 });
|
|
5036
|
+
r && (i.add(r), n.addField(r, "sort"), Ha(e, r, n, "sort"));
|
|
4763
5037
|
}
|
|
4764
5038
|
return i.values();
|
|
4765
5039
|
}
|
|
4766
|
-
function
|
|
4767
|
-
let i =
|
|
4768
|
-
|
|
4769
|
-
|
|
5040
|
+
function Ia(e, t, n, r) {
|
|
5041
|
+
let i = new $(), a = t?.variants?.items() ?? [];
|
|
5042
|
+
if (a.length === 0 || a.some((e) => e.quick_peek === void 0)) for (let r of fa(e, t, n)) i.add(r);
|
|
5043
|
+
for (let r of a) {
|
|
5044
|
+
if (r.quick_peek === void 0) continue;
|
|
5045
|
+
let a = {
|
|
5046
|
+
...t,
|
|
5047
|
+
quick_peek: r.quick_peek
|
|
5048
|
+
};
|
|
5049
|
+
for (let t of fa(e, a, n)) i.add(t);
|
|
5050
|
+
}
|
|
5051
|
+
for (let t of i.values()) r.addField(t, "quick_peek"), Ha(e, t, r, "quick_peek");
|
|
5052
|
+
return i.values();
|
|
4770
5053
|
}
|
|
4771
|
-
function
|
|
5054
|
+
function La(e, t, n) {
|
|
4772
5055
|
if (Array.isArray(e)) {
|
|
4773
5056
|
for (let r of e) if (!(!r || typeof r != "object")) {
|
|
4774
5057
|
if ("section" in r) {
|
|
4775
|
-
let e = r.section, i =
|
|
4776
|
-
i && t.has(i) &&
|
|
5058
|
+
let e = r.section, i = za(e?.name);
|
|
5059
|
+
i && t.has(i) && Ra(e?.items, n);
|
|
4777
5060
|
continue;
|
|
4778
5061
|
}
|
|
4779
|
-
"fields" in r &&
|
|
5062
|
+
"fields" in r && Ra([r], n);
|
|
4780
5063
|
}
|
|
4781
5064
|
}
|
|
4782
5065
|
}
|
|
4783
|
-
function
|
|
5066
|
+
function Ra(e, t) {
|
|
4784
5067
|
if (Array.isArray(e)) {
|
|
4785
5068
|
for (let n of e) if (!(!n || typeof n != "object")) {
|
|
4786
5069
|
if ("fields" in n) {
|
|
@@ -4793,11 +5076,11 @@ function sa(e, t) {
|
|
|
4793
5076
|
}
|
|
4794
5077
|
}
|
|
4795
5078
|
}
|
|
4796
|
-
"section" in n &&
|
|
5079
|
+
"section" in n && Ra(n.section?.items, t);
|
|
4797
5080
|
}
|
|
4798
5081
|
}
|
|
4799
5082
|
}
|
|
4800
|
-
function
|
|
5083
|
+
function za(e) {
|
|
4801
5084
|
if (typeof e == "string") return e;
|
|
4802
5085
|
if (e && typeof e == "object") {
|
|
4803
5086
|
let t = Object.values(e).find((e) => typeof e == "string");
|
|
@@ -4805,21 +5088,21 @@ function ca(e) {
|
|
|
4805
5088
|
}
|
|
4806
5089
|
return "";
|
|
4807
5090
|
}
|
|
4808
|
-
function
|
|
5091
|
+
function Ba(e) {
|
|
4809
5092
|
let t = [];
|
|
4810
5093
|
for (let [n, r] of e.fields) {
|
|
4811
5094
|
if (r.primary || r.auto || r.ref || r.array || r.structure || r.display?.is_listable === !1) continue;
|
|
4812
5095
|
let e = (r.type || "").toLowerCase(), i = !!(r.enum || r.values);
|
|
4813
|
-
if (!(!
|
|
5096
|
+
if (!(!sa.has(e) && !i) && (t.push(n), t.length >= 8)) break;
|
|
4814
5097
|
}
|
|
4815
5098
|
return t;
|
|
4816
5099
|
}
|
|
4817
|
-
function
|
|
5100
|
+
function Va(e, t, n, r) {
|
|
4818
5101
|
if (!t || t.startsWith("$")) return;
|
|
4819
|
-
let i =
|
|
5102
|
+
let i = Wa(e, t);
|
|
4820
5103
|
i.kind !== "missing" && (n.add(t), i.kind === "file" && r.addField(t, "file_metadata"));
|
|
4821
5104
|
}
|
|
4822
|
-
function
|
|
5105
|
+
function Ha(e, t, n, r) {
|
|
4823
5106
|
if (t.startsWith("$status.")) {
|
|
4824
5107
|
n.addExpand("statuses", "status_expand"), r !== "status_expand" && n.addExpand("statuses", r), r !== "status_expand" && n.addField(t, r);
|
|
4825
5108
|
return;
|
|
@@ -4834,14 +5117,14 @@ function da(e, t, n, r) {
|
|
|
4834
5117
|
n.addExpand("evidence", "evidence_expand"), r !== "evidence_expand" && n.addExpand("evidence", r), r !== "evidence_expand" && n.addField(t, r);
|
|
4835
5118
|
return;
|
|
4836
5119
|
}
|
|
4837
|
-
let i =
|
|
5120
|
+
let i = Wa(e, t);
|
|
4838
5121
|
i.kind === "field" && i.field.type === "ref" && (n.addExpand("refs", "ref_expand"), r !== "ref_expand" && n.addExpand("refs", r));
|
|
4839
5122
|
}
|
|
4840
|
-
function
|
|
5123
|
+
function Ua(e) {
|
|
4841
5124
|
let t = e.snapshot().expand, n = [];
|
|
4842
5125
|
return t.refs && n.push("refs"), t.statuses && n.push("statuses"), t.properties && n.push("properties"), t.evidence && n.push("evidence"), n;
|
|
4843
5126
|
}
|
|
4844
|
-
function
|
|
5127
|
+
function Wa(e, t) {
|
|
4845
5128
|
if (!e) return { kind: t.startsWith("$") ? "synthetic" : "missing" };
|
|
4846
5129
|
if (t.startsWith("$status.")) return e.status_groups?.[t.slice(8)] ? { kind: "synthetic" } : { kind: "missing" };
|
|
4847
5130
|
if (t.startsWith("$property.")) return e.properties?.[t.slice(10)] ? { kind: "synthetic" } : { kind: "missing" };
|
|
@@ -4869,7 +5152,7 @@ var $ = class {
|
|
|
4869
5152
|
values() {
|
|
4870
5153
|
return [...this.#e];
|
|
4871
5154
|
}
|
|
4872
|
-
},
|
|
5155
|
+
}, Ga = class {
|
|
4873
5156
|
#e = /* @__PURE__ */ new Map();
|
|
4874
5157
|
#t = /* @__PURE__ */ new Map();
|
|
4875
5158
|
addField(e, t) {
|
|
@@ -4892,7 +5175,7 @@ var $ = class {
|
|
|
4892
5175
|
}
|
|
4893
5176
|
r.includes(n) || r.push(n);
|
|
4894
5177
|
}
|
|
4895
|
-
},
|
|
5178
|
+
}, Ka = class extends Me {
|
|
4896
5179
|
constructor(e) {
|
|
4897
5180
|
super(e), this.state = {
|
|
4898
5181
|
hasError: !1,
|
|
@@ -4949,7 +5232,7 @@ var $ = class {
|
|
|
4949
5232
|
},
|
|
4950
5233
|
children: this.state.error?.message || "An unexpected error occurred."
|
|
4951
5234
|
}),
|
|
4952
|
-
/* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(
|
|
5235
|
+
/* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(W, {
|
|
4953
5236
|
onClick: this.handleRetry,
|
|
4954
5237
|
children: "Try again"
|
|
4955
5238
|
}) })
|
|
@@ -4960,15 +5243,15 @@ var $ = class {
|
|
|
4960
5243
|
};
|
|
4961
5244
|
//#endregion
|
|
4962
5245
|
//#region src/hooks/useObject.ts
|
|
4963
|
-
function
|
|
5246
|
+
function qa(e, t) {
|
|
4964
5247
|
return [
|
|
4965
5248
|
"entity-item",
|
|
4966
5249
|
e,
|
|
4967
5250
|
t === void 0 || t === "new" ? void 0 : typeof t == "string" ? t : Object.keys(t).sort().map((e) => [e, t[e]])
|
|
4968
5251
|
];
|
|
4969
5252
|
}
|
|
4970
|
-
function
|
|
4971
|
-
let n =
|
|
5253
|
+
function Ja(e, t) {
|
|
5254
|
+
let n = qa(e, t), r = n[2];
|
|
4972
5255
|
return He({
|
|
4973
5256
|
queryKey: n,
|
|
4974
5257
|
queryFn: () => x(e, t),
|
|
@@ -4977,15 +5260,15 @@ function _a(e, t) {
|
|
|
4977
5260
|
}
|
|
4978
5261
|
//#endregion
|
|
4979
5262
|
//#region src/components/detail-layout/widgets/registry.ts
|
|
4980
|
-
var
|
|
4981
|
-
function
|
|
4982
|
-
|
|
5263
|
+
var Ya = /* @__PURE__ */ new Map();
|
|
5264
|
+
function Xa(e, t) {
|
|
5265
|
+
Ya.set(e, t);
|
|
4983
5266
|
}
|
|
4984
|
-
function
|
|
4985
|
-
return
|
|
5267
|
+
function Za(e) {
|
|
5268
|
+
return Ya.get(e);
|
|
4986
5269
|
}
|
|
4987
|
-
function
|
|
4988
|
-
return
|
|
5270
|
+
function Qa(e) {
|
|
5271
|
+
return Ya.has(e);
|
|
4989
5272
|
}
|
|
4990
5273
|
//#endregion
|
|
4991
|
-
export {
|
|
5274
|
+
export { Dn as $, ji as A, Tr as B, Vi as C, Ai as D, Ii as E, ti as F, ir as G, or as H, ii as I, nr as J, Vn as K, ni as L, ui as M, ri as N, Mi as O, oi as P, Tn as Q, Kr as R, Wi as S, Ye as St, Li as T, ar as U, cr as V, rr as W, Rn as X, Zn as Y, zn as Z, qi as _, xt as _t, Ja as a, sn as at, Hi as b, pt as bt, la as c, Gt as ct, Xi as d, Ht as dt, An as et, Qi as f, Vt as ft, Zi as g, Dt as gt, Ki as h, jt as ht, qa as i, cn as it, _i as j, Ni as k, fa as l, Kt as lt, Yi as m, Nt as mt, Qa as n, On as nt, Ka as o, Xt as ot, Ji as p, Mt as pt, $n as q, Xa as r, ln as rt, ca as s, Yt as st, Za as t, kn as tt, da as u, Wt as ut, Gi as v, At as vt, Bi as w, zi as x, Xe as xt, Ui as y, lt as yt, Rr as z };
|