@declarion/react 0.39.0 → 0.40.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-DziCVhq6.js → DraggableChildrenTable-Ctmn0liO.js} +27 -27
- package/dist-lib/{Grid-BTX2tkCT.js → Grid-BsIkTp3u.js} +42 -42
- package/dist-lib/{LayoutRenderer-CwMERoPJ.js → LayoutRenderer-D4oTfZhV.js} +562 -562
- package/dist-lib/{MarkdownRenderer-dHOTEhUa.js → MarkdownRenderer-B-2CrtjU.js} +1 -1
- package/dist-lib/{RefreshControl--UAgflh7.js → RefreshControl-VQf34HKZ.js} +201 -201
- package/dist-lib/SmartDetailPage.impl-HMaLVDlV.js +1802 -0
- package/dist-lib/{SmartRecordListPage.impl-CZXzVhPC.js → SmartRecordListPage.impl-Cxm7qvlZ.js} +239 -239
- package/dist-lib/components/shared/ActionButton.d.ts +1 -7
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/index.js +1788 -1666
- package/dist-lib/lib/actions.d.ts +27 -0
- package/dist-lib/{registry-DXNFRlbB.js → registry-DFtAh6zc.js} +1798 -2427
- package/dist-lib/testing.js +27 -27
- package/dist-lib/{useCurrentScreen-BA2lb-d7.js → useCurrentScreen-mw8TfE8q.js} +563 -361
- package/dist-lib/{useProperties-Br2DeOQh.js → useProperties-gMdnhdhO.js} +50 -50
- package/dist-lib/{value-C91loRXp.js → value-t9ETvWIJ.js} +4 -4
- package/package.json +1 -1
- package/dist-lib/SmartDetailPage.impl-Bj7MtHxi.js +0 -1827
- package/dist-lib/components/shared/ActionConfirmDialog.d.ts +0 -10
|
@@ -199,7 +199,7 @@ function j({ open: e, onClose: t, anchor: n, anchorPoint: r, children: i, align:
|
|
|
199
199
|
n,
|
|
200
200
|
t
|
|
201
201
|
]), !e || !d) return null;
|
|
202
|
-
let _ = d.placement === "below" ? `calc(var(--app-height) - ${d.top}px - 8px)` : `${Math.max(120, d.top - 8)}px`, v =
|
|
202
|
+
let _ = d.placement === "below" ? `calc(var(--app-height) - ${d.top}px - 8px)` : `${Math.max(120, d.top - 8)}px`, v = N(s?.maxHeight), y = v ? `min(${_}, ${v})` : _;
|
|
203
203
|
return S(/* @__PURE__ */ b("div", {
|
|
204
204
|
ref: c,
|
|
205
205
|
style: {
|
|
@@ -232,19 +232,19 @@ function M() {
|
|
|
232
232
|
let t = window.visualViewport?.height;
|
|
233
233
|
return Number.isFinite(t) && t && t > 0 ? t : window.innerHeight;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function N(e) {
|
|
236
236
|
if (e != null) return typeof e == "number" ? `${e}px` : String(e);
|
|
237
237
|
}
|
|
238
238
|
//#endregion
|
|
239
239
|
//#region src/components/primitives/HoverCard.tsx
|
|
240
|
-
var
|
|
241
|
-
function
|
|
240
|
+
var ee = 400, te = 150, ne = 320, re = 240, ie = 4, ae = 4;
|
|
241
|
+
function oe({ content: e, children: t, width: n = ne, align: r = "center", style: i }) {
|
|
242
242
|
let a = f(null), o = f(null), c = f(null), u = f(null), [d, m] = p(!1), [h, g] = p(null), [_, v] = p(!1), C = s(() => {
|
|
243
243
|
let e = a.current;
|
|
244
244
|
if (!e) return;
|
|
245
|
-
let t = e.getBoundingClientRect(), i = typeof window < "u" ? window.visualViewport : void 0, s = i?.width ?? (typeof window < "u" ? window.innerWidth : 0), c = i?.height ?? (typeof window < "u" ? window.innerHeight : 0), l = i?.offsetLeft ?? 0, u = i?.offsetTop ?? 0, d = Math.min(n, Math.max(160, s -
|
|
245
|
+
let t = e.getBoundingClientRect(), i = typeof window < "u" ? window.visualViewport : void 0, s = i?.width ?? (typeof window < "u" ? window.innerWidth : 0), c = i?.height ?? (typeof window < "u" ? window.innerHeight : 0), l = i?.offsetLeft ?? 0, u = i?.offsetTop ?? 0, d = Math.min(n, Math.max(160, s - ie * 2)), f = o.current?.offsetHeight ?? re, p = u + c - t.bottom < f + ae * 2 && t.top > f + ae * 2 ? "above" : "below", m = p === "below" ? t.bottom + ae : t.top - ae - f, h;
|
|
246
246
|
h = r === "start" ? t.left : r === "end" ? t.right - d : t.left + t.width / 2 - d / 2;
|
|
247
|
-
let _ = l +
|
|
247
|
+
let _ = l + ie, v = l + s - ie;
|
|
248
248
|
h + d > v && (h = Math.max(_, t.right - d)), h < _ && (h = _), g((e) => e && e.top === m && e.left === h && e.width === d && e.placement === p ? e : {
|
|
249
249
|
top: m,
|
|
250
250
|
left: h,
|
|
@@ -263,7 +263,7 @@ function se({ content: e, children: t, width: n = re, align: r = "center", style
|
|
|
263
263
|
}, []), D = () => {
|
|
264
264
|
u.current !== null && (window.clearTimeout(u.current), u.current = null), !(d || c.current !== null) && (c.current = window.setTimeout(() => {
|
|
265
265
|
c.current = null, m(!0);
|
|
266
|
-
},
|
|
266
|
+
}, ee));
|
|
267
267
|
}, O = s(() => {
|
|
268
268
|
E(), m(!0);
|
|
269
269
|
}, [E]), k = s(() => {
|
|
@@ -271,7 +271,7 @@ function se({ content: e, children: t, width: n = re, align: r = "center", style
|
|
|
271
271
|
}, [E]), A = () => {
|
|
272
272
|
c.current !== null && (window.clearTimeout(c.current), c.current = null), u.current === null && (u.current = window.setTimeout(() => {
|
|
273
273
|
u.current = null, m(!1);
|
|
274
|
-
},
|
|
274
|
+
}, te));
|
|
275
275
|
};
|
|
276
276
|
l(() => () => {
|
|
277
277
|
E(), w.current &&= (w.current.disconnect(), null);
|
|
@@ -303,7 +303,7 @@ function se({ content: e, children: t, width: n = re, align: r = "center", style
|
|
|
303
303
|
top: h.top,
|
|
304
304
|
left: h.left,
|
|
305
305
|
width: h.width,
|
|
306
|
-
maxHeight:
|
|
306
|
+
maxHeight: re,
|
|
307
307
|
overflowY: "auto",
|
|
308
308
|
zIndex: 250,
|
|
309
309
|
background: "var(--surface)",
|
|
@@ -349,7 +349,7 @@ function se({ content: e, children: t, width: n = re, align: r = "center", style
|
|
|
349
349
|
}
|
|
350
350
|
//#endregion
|
|
351
351
|
//#region src/components/primitives/Chip.tsx
|
|
352
|
-
function
|
|
352
|
+
function se({ icon: e, children: n, onRemove: r, onClick: i }) {
|
|
353
353
|
return /* @__PURE__ */ x("span", {
|
|
354
354
|
onClick: i,
|
|
355
355
|
style: {
|
|
@@ -922,7 +922,7 @@ function Pe({ value: e = [], onChange: t }) {
|
|
|
922
922
|
padding: "4px 6px",
|
|
923
923
|
alignItems: "center"
|
|
924
924
|
},
|
|
925
|
-
children: [e.map((n, r) => /* @__PURE__ */ b(
|
|
925
|
+
children: [e.map((n, r) => /* @__PURE__ */ b(se, {
|
|
926
926
|
tone: "slate",
|
|
927
927
|
onRemove: () => t(e.filter((e, t) => t !== r)),
|
|
928
928
|
children: n
|
|
@@ -2775,7 +2775,7 @@ var Z = {
|
|
|
2775
2775
|
update: Gr,
|
|
2776
2776
|
dismiss: (e) => v.dismiss(e),
|
|
2777
2777
|
dismissAll: () => v.dismiss()
|
|
2778
|
-
}, Kr = o(() => import("./MarkdownRenderer-
|
|
2778
|
+
}, Kr = o(() => import("./MarkdownRenderer-B-2CrtjU.js").then((e) => ({ default: e.MarkdownRenderer })));
|
|
2779
2779
|
function qr() {
|
|
2780
2780
|
return /* @__PURE__ */ b("div", { className: "h-4 w-2/3 rounded bg-muted animate-pulse" });
|
|
2781
2781
|
}
|
|
@@ -3407,7 +3407,7 @@ function Ni({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3407
3407
|
v,
|
|
3408
3408
|
g,
|
|
3409
3409
|
A
|
|
3410
|
-
]),
|
|
3410
|
+
]), N = d(() => {
|
|
3411
3411
|
let e = (u ?? []).map((e) => ({
|
|
3412
3412
|
value: e.code,
|
|
3413
3413
|
label: L(e.label) || e.code
|
|
@@ -3456,7 +3456,7 @@ function Ni({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3456
3456
|
"aria-labelledby": o,
|
|
3457
3457
|
"aria-required": c || void 0,
|
|
3458
3458
|
value: E,
|
|
3459
|
-
options:
|
|
3459
|
+
options: N,
|
|
3460
3460
|
onChange: (e) => n(e || null),
|
|
3461
3461
|
onSearchChange: x,
|
|
3462
3462
|
placeholder: l
|
|
@@ -3914,7 +3914,7 @@ function Zi({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
3914
3914
|
flexWrap: "wrap",
|
|
3915
3915
|
gap: 4
|
|
3916
3916
|
},
|
|
3917
|
-
children: s.map((e, t) => /* @__PURE__ */ b(
|
|
3917
|
+
children: s.map((e, t) => /* @__PURE__ */ b(se, {
|
|
3918
3918
|
tone: "slate",
|
|
3919
3919
|
children: e
|
|
3920
3920
|
}, t))
|
|
@@ -3937,7 +3937,7 @@ function Zi({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
3937
3937
|
flexWrap: "wrap",
|
|
3938
3938
|
gap: 4
|
|
3939
3939
|
},
|
|
3940
|
-
children: s.map((e, t) => /* @__PURE__ */ b(
|
|
3940
|
+
children: s.map((e, t) => /* @__PURE__ */ b(se, {
|
|
3941
3941
|
tone: "slate",
|
|
3942
3942
|
onRemove: () => d(t),
|
|
3943
3943
|
children: e
|
|
@@ -3987,7 +3987,7 @@ function $i({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
3987
3987
|
flexWrap: "wrap",
|
|
3988
3988
|
gap: 4
|
|
3989
3989
|
},
|
|
3990
|
-
children: s.map((e, t) => /* @__PURE__ */ b(
|
|
3990
|
+
children: s.map((e, t) => /* @__PURE__ */ b(se, {
|
|
3991
3991
|
tone: "slate",
|
|
3992
3992
|
children: e
|
|
3993
3993
|
}, t))
|
|
@@ -4012,7 +4012,7 @@ function $i({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
4012
4012
|
flexWrap: "wrap",
|
|
4013
4013
|
gap: 4
|
|
4014
4014
|
},
|
|
4015
|
-
children: s.map((e, t) => /* @__PURE__ */ b(
|
|
4015
|
+
children: s.map((e, t) => /* @__PURE__ */ b(se, {
|
|
4016
4016
|
tone: "slate",
|
|
4017
4017
|
onRemove: () => d(t),
|
|
4018
4018
|
children: e
|
|
@@ -4305,14 +4305,14 @@ function Da(e) {
|
|
|
4305
4305
|
markdown: e,
|
|
4306
4306
|
files: t
|
|
4307
4307
|
});
|
|
4308
|
-
},
|
|
4308
|
+
}, N = (e, t, n) => {
|
|
4309
4309
|
let r = m.current, i = r?.selectionStart ?? e.markdown.length, a = r?.selectionEnd ?? e.markdown.length, o = `${e.markdown.slice(0, i)}${t}${e.markdown.slice(a)}`, s = n ? ra(e, n).files : e.files;
|
|
4310
4310
|
M(o, s), requestAnimationFrame(() => {
|
|
4311
4311
|
if (!r) return;
|
|
4312
4312
|
let e = i + t.length;
|
|
4313
4313
|
r.focus(), r.setSelectionRange(e, e);
|
|
4314
4314
|
});
|
|
4315
|
-
},
|
|
4315
|
+
}, ee = async (e) => {
|
|
4316
4316
|
if (!r || !n.files) return;
|
|
4317
4317
|
let t = Array.from(e);
|
|
4318
4318
|
if (t.length === 0) return;
|
|
@@ -4337,7 +4337,7 @@ function Da(e) {
|
|
|
4337
4337
|
let s = ka(n, o);
|
|
4338
4338
|
if (w(n.id, () => ya(n.id)), _.current.add(n.id), t.length === 1) {
|
|
4339
4339
|
let e = Oa(a.markdown, ca(s));
|
|
4340
|
-
|
|
4340
|
+
N(a, e, s), a = ra({
|
|
4341
4341
|
markdown: `${a.markdown}${e}`,
|
|
4342
4342
|
files: a.files
|
|
4343
4343
|
}, s);
|
|
@@ -4416,7 +4416,7 @@ function Da(e) {
|
|
|
4416
4416
|
accept: A?.join(","),
|
|
4417
4417
|
multiple: !0,
|
|
4418
4418
|
onChange: (e) => {
|
|
4419
|
-
e.target.files &&
|
|
4419
|
+
e.target.files && ee(e.target.files), e.target.value = "";
|
|
4420
4420
|
}
|
|
4421
4421
|
}),
|
|
4422
4422
|
/* @__PURE__ */ b("textarea", {
|
|
@@ -4428,11 +4428,11 @@ function Da(e) {
|
|
|
4428
4428
|
onChange: (e) => M(e.target.value),
|
|
4429
4429
|
onPaste: (e) => {
|
|
4430
4430
|
let t = Array.from(e.clipboardData.files ?? []).filter((e) => e.size > 0);
|
|
4431
|
-
t.length !== 0 && (e.preventDefault(),
|
|
4431
|
+
t.length !== 0 && (e.preventDefault(), ee(t));
|
|
4432
4432
|
},
|
|
4433
4433
|
onDrop: (e) => {
|
|
4434
4434
|
let t = Array.from(e.dataTransfer.files ?? []).filter((e) => e.size > 0);
|
|
4435
|
-
t.length !== 0 && (e.preventDefault(),
|
|
4435
|
+
t.length !== 0 && (e.preventDefault(), ee(t));
|
|
4436
4436
|
},
|
|
4437
4437
|
onDragOver: (e) => e.preventDefault(),
|
|
4438
4438
|
rows: 12,
|
|
@@ -4653,7 +4653,7 @@ var Ha = (e) => {
|
|
|
4653
4653
|
tone: i.tone,
|
|
4654
4654
|
size: "xs",
|
|
4655
4655
|
children: i.label
|
|
4656
|
-
}, `${n}-${t}`) : /* @__PURE__ */ b(
|
|
4656
|
+
}, `${n}-${t}`) : /* @__PURE__ */ b(se, { children: i?.label ?? n }, `${n}-${t}`);
|
|
4657
4657
|
})
|
|
4658
4658
|
});
|
|
4659
4659
|
}, Ua = () => (e) => {
|
|
@@ -5243,7 +5243,7 @@ var Zo = (e) => {
|
|
|
5243
5243
|
return i ? /* @__PURE__ */ b("span", {
|
|
5244
5244
|
title: r,
|
|
5245
5245
|
children: r
|
|
5246
|
-
}) : /* @__PURE__ */ b(
|
|
5246
|
+
}) : /* @__PURE__ */ b(oe, {
|
|
5247
5247
|
content: Xo(n),
|
|
5248
5248
|
children: /* @__PURE__ */ b("span", {
|
|
5249
5249
|
title: r,
|
|
@@ -5284,7 +5284,7 @@ var rs = (e) => {
|
|
|
5284
5284
|
return s ? /* @__PURE__ */ b("span", {
|
|
5285
5285
|
title: o,
|
|
5286
5286
|
children: o
|
|
5287
|
-
}) : /* @__PURE__ */ b(
|
|
5287
|
+
}) : /* @__PURE__ */ b(oe, {
|
|
5288
5288
|
content: ns(a.markdown, a.files),
|
|
5289
5289
|
children: /* @__PURE__ */ b("span", {
|
|
5290
5290
|
title: o,
|
|
@@ -5426,85 +5426,365 @@ function ms() {
|
|
|
5426
5426
|
return r && r.trim() ? r : ps() || fs;
|
|
5427
5427
|
}
|
|
5428
5428
|
//#endregion
|
|
5429
|
+
//#region src/lib/actions.ts
|
|
5430
|
+
var hs = {
|
|
5431
|
+
__create: "create",
|
|
5432
|
+
__edit: "update",
|
|
5433
|
+
__delete: "delete",
|
|
5434
|
+
__restore: "restore"
|
|
5435
|
+
}, gs = "__peek", _s = "__open";
|
|
5436
|
+
function vs(e) {
|
|
5437
|
+
return e === "__peek" || e === "__open";
|
|
5438
|
+
}
|
|
5439
|
+
function ys(e, t) {
|
|
5440
|
+
if (!e) return "";
|
|
5441
|
+
if (t) try {
|
|
5442
|
+
return $e(t, Xe(t, e));
|
|
5443
|
+
} catch {}
|
|
5444
|
+
let n = e.id;
|
|
5445
|
+
return typeof n == "string" ? n : n == null ? "" : I(n);
|
|
5446
|
+
}
|
|
5447
|
+
function bs(e, t) {
|
|
5448
|
+
if (!e || e.length === 0) return !0;
|
|
5449
|
+
for (let n of e) {
|
|
5450
|
+
if (n.status && n.status.length > 0) {
|
|
5451
|
+
let e = t.status;
|
|
5452
|
+
if (typeof e != "string" || !n.status.includes(e)) return !1;
|
|
5453
|
+
}
|
|
5454
|
+
if (n.field && !xs(n, t)) return !1;
|
|
5455
|
+
}
|
|
5456
|
+
return !0;
|
|
5457
|
+
}
|
|
5458
|
+
function xs(e, t) {
|
|
5459
|
+
let n = Ss(t, e.field), r = e.op || "eq";
|
|
5460
|
+
if (r === "in" || r === "not_in") {
|
|
5461
|
+
let t = Array.isArray(e.value) ? e.value : [e.value], i = I(n), a = t.some((e) => I(e) === i);
|
|
5462
|
+
return r === "in" ? a : !a;
|
|
5463
|
+
}
|
|
5464
|
+
return typeof e.value == "boolean" && r === "eq" ? ws(n) === e.value : typeof n == "number" && typeof e.value == "number" ? Ts(n, e.value, r) : Ts(I(n), I(e.value), r);
|
|
5465
|
+
}
|
|
5466
|
+
function Ss(e, t) {
|
|
5467
|
+
if (Object.prototype.hasOwnProperty.call(e, t)) return e[t];
|
|
5468
|
+
if (t.startsWith("$status.")) {
|
|
5469
|
+
let n = t.slice(8), r = e.$statuses;
|
|
5470
|
+
return Array.isArray(r) ? r.find((e) => !e || typeof e != "object" ? !1 : e.group_code === n)?.status_code : void 0;
|
|
5471
|
+
}
|
|
5472
|
+
if (t.startsWith("$property.")) {
|
|
5473
|
+
let n = t.slice(10), r = e.$properties;
|
|
5474
|
+
return Array.isArray(r) ? r.find((e) => !e || typeof e != "object" ? !1 : e.property_code === n)?.value : void 0;
|
|
5475
|
+
}
|
|
5476
|
+
}
|
|
5477
|
+
function Cs(e) {
|
|
5478
|
+
let t = null, n = (n, r) => {
|
|
5479
|
+
Object.prototype.hasOwnProperty.call(e, n) || (t === null && (t = { ...e }), t[n] = r);
|
|
5480
|
+
}, r = e.$statuses;
|
|
5481
|
+
if (Array.isArray(r)) for (let t of r) {
|
|
5482
|
+
if (!t || typeof t != "object") continue;
|
|
5483
|
+
let r = t.group_code;
|
|
5484
|
+
typeof r == "string" && n(`$status.${r}`, Ss(e, `$status.${r}`));
|
|
5485
|
+
}
|
|
5486
|
+
let i = e.$properties;
|
|
5487
|
+
if (Array.isArray(i)) for (let t of i) {
|
|
5488
|
+
if (!t || typeof t != "object") continue;
|
|
5489
|
+
let r = t.property_code;
|
|
5490
|
+
typeof r == "string" && n(`$property.${r}`, Ss(e, `$property.${r}`));
|
|
5491
|
+
}
|
|
5492
|
+
return t ?? e;
|
|
5493
|
+
}
|
|
5494
|
+
function ws(e) {
|
|
5495
|
+
return e == null ? !1 : typeof e == "boolean" ? e : typeof e == "string" ? e !== "" : typeof e != "number" || e !== 0;
|
|
5496
|
+
}
|
|
5497
|
+
function Ts(e, t, n) {
|
|
5498
|
+
switch (n) {
|
|
5499
|
+
case "eq": return e === t;
|
|
5500
|
+
case "ne": return e !== t;
|
|
5501
|
+
case "gt": return e > t;
|
|
5502
|
+
case "gte":
|
|
5503
|
+
case "ge": return e >= t;
|
|
5504
|
+
case "lt": return e < t;
|
|
5505
|
+
case "lte":
|
|
5506
|
+
case "le": return e <= t;
|
|
5507
|
+
default: return !1;
|
|
5508
|
+
}
|
|
5509
|
+
}
|
|
5510
|
+
function Es(e, t) {
|
|
5511
|
+
return e ? Object.entries(e).filter(([, e]) => e.visibility?.includes(t)).map(([e, t]) => ({
|
|
5512
|
+
code: e,
|
|
5513
|
+
action: t
|
|
5514
|
+
})) : [];
|
|
5515
|
+
}
|
|
5516
|
+
function Ds(e, t, n, r) {
|
|
5517
|
+
return !e && !r ? [] : t === void 0 ? Es(e, n) : t.map((t) => {
|
|
5518
|
+
let n = e?.[t] ?? r?.[t];
|
|
5519
|
+
return n ? {
|
|
5520
|
+
code: t,
|
|
5521
|
+
action: n
|
|
5522
|
+
} : null;
|
|
5523
|
+
}).filter((e) => e !== null);
|
|
5524
|
+
}
|
|
5525
|
+
function Os(e, t) {
|
|
5526
|
+
return e.filter(({ code: e }) => {
|
|
5527
|
+
let n = hs[e];
|
|
5528
|
+
return !n || Ye(t, n);
|
|
5529
|
+
});
|
|
5530
|
+
}
|
|
5531
|
+
var ks = {
|
|
5532
|
+
en: "This action cannot be undone.",
|
|
5533
|
+
ru: "Это действие нельзя отменить."
|
|
5534
|
+
};
|
|
5535
|
+
function As(e) {
|
|
5536
|
+
return !!e?.confirmation && Object.keys(e.confirmation).length > 0;
|
|
5537
|
+
}
|
|
5538
|
+
function js(e, t) {
|
|
5539
|
+
return As(e) ? L(e.confirmation, t) : e?.destructive ? L(ks, t) : null;
|
|
5540
|
+
}
|
|
5541
|
+
function Ms(e) {
|
|
5542
|
+
return As(e) || !!e?.destructive;
|
|
5543
|
+
}
|
|
5544
|
+
function Ns(e, t, n, r) {
|
|
5545
|
+
if (n && r) return r;
|
|
5546
|
+
let i = L(e?.display?.description);
|
|
5547
|
+
return i ? e?.display?.icon_only === !0 ? `${t} - ${i}` : i : t;
|
|
5548
|
+
}
|
|
5549
|
+
function Ps(e) {
|
|
5550
|
+
return !!e.association;
|
|
5551
|
+
}
|
|
5552
|
+
function Fs(e, t) {
|
|
5553
|
+
if (e) {
|
|
5554
|
+
for (let n of Object.values(e.screens)) if (n.entity === t && n.type === "list") {
|
|
5555
|
+
let r = e.entities[t];
|
|
5556
|
+
return {
|
|
5557
|
+
route: n.route,
|
|
5558
|
+
icon: n.display?.icon || r?.display?.icon || ""
|
|
5559
|
+
};
|
|
5560
|
+
}
|
|
5561
|
+
}
|
|
5562
|
+
}
|
|
5563
|
+
function Is(e, t, n, r, i) {
|
|
5564
|
+
let a = [];
|
|
5565
|
+
for (let o of e) {
|
|
5566
|
+
let e = Ls(o, t, n, r, i);
|
|
5567
|
+
e !== null && a.push(e);
|
|
5568
|
+
}
|
|
5569
|
+
return a;
|
|
5570
|
+
}
|
|
5571
|
+
function Ls(e, t, n, r, i) {
|
|
5572
|
+
return e.kind === "group" ? Rs(e, t, n, r, i) : zs(e, t, n, r, i);
|
|
5573
|
+
}
|
|
5574
|
+
function Rs(e, t, n, r, i) {
|
|
5575
|
+
let a = [];
|
|
5576
|
+
for (let o of e.items) {
|
|
5577
|
+
let e = Ls(o, t, n, r, i);
|
|
5578
|
+
e !== null && a.push(e);
|
|
5579
|
+
}
|
|
5580
|
+
return a.length === 0 ? null : {
|
|
5581
|
+
...e,
|
|
5582
|
+
items: a
|
|
5583
|
+
};
|
|
5584
|
+
}
|
|
5585
|
+
function zs(e, t, n, r, i) {
|
|
5586
|
+
let a = Hs(e.code, t, n);
|
|
5587
|
+
if (!a) return null;
|
|
5588
|
+
if (i.length > 0) {
|
|
5589
|
+
let t = Bs(a, i);
|
|
5590
|
+
return t.visible ? {
|
|
5591
|
+
...e,
|
|
5592
|
+
enabled: t.enabled,
|
|
5593
|
+
reason: t.reason
|
|
5594
|
+
} : null;
|
|
5595
|
+
}
|
|
5596
|
+
if (!bs(a.conditions, r) || !bs(Us(a.visible_if), r)) return null;
|
|
5597
|
+
let { enabled: o, reason: s } = Vs(a, r);
|
|
5598
|
+
return {
|
|
5599
|
+
...e,
|
|
5600
|
+
enabled: o,
|
|
5601
|
+
reason: s
|
|
5602
|
+
};
|
|
5603
|
+
}
|
|
5604
|
+
function Bs(e, t) {
|
|
5605
|
+
let n = Us(e.visible_if), r = Us(e.enabled_if), i = e.conditions, a = Ws(e.enabled_if_reason), o = 0, s = 0;
|
|
5606
|
+
for (let e of t) {
|
|
5607
|
+
let t = bs(n, e) && bs(i, e);
|
|
5608
|
+
t && o++;
|
|
5609
|
+
let a = bs(r, e);
|
|
5610
|
+
(!t || !a) && s++;
|
|
5611
|
+
}
|
|
5612
|
+
if (o === 0) return {
|
|
5613
|
+
visible: !1,
|
|
5614
|
+
enabled: !1,
|
|
5615
|
+
reason: null
|
|
5616
|
+
};
|
|
5617
|
+
if (s === 0) return {
|
|
5618
|
+
visible: !0,
|
|
5619
|
+
enabled: !0,
|
|
5620
|
+
reason: null
|
|
5621
|
+
};
|
|
5622
|
+
let c = `(${s} of ${t.length} rows fail)`;
|
|
5623
|
+
return {
|
|
5624
|
+
visible: !0,
|
|
5625
|
+
enabled: !1,
|
|
5626
|
+
reason: a ? `${a} ${c}` : c
|
|
5627
|
+
};
|
|
5628
|
+
}
|
|
5629
|
+
function Vs(e, t) {
|
|
5630
|
+
let n = Us(e.enabled_if);
|
|
5631
|
+
if (!n || n.length === 0) return {
|
|
5632
|
+
enabled: !0,
|
|
5633
|
+
reason: null
|
|
5634
|
+
};
|
|
5635
|
+
let r = Ws(e.enabled_if_reason);
|
|
5636
|
+
return bs(n, t) ? {
|
|
5637
|
+
enabled: !0,
|
|
5638
|
+
reason: null
|
|
5639
|
+
} : {
|
|
5640
|
+
enabled: !1,
|
|
5641
|
+
reason: r
|
|
5642
|
+
};
|
|
5643
|
+
}
|
|
5644
|
+
function Hs(e, t, n) {
|
|
5645
|
+
if (t && e in t) return t[e];
|
|
5646
|
+
if (n && e in n) return n[e];
|
|
5647
|
+
}
|
|
5648
|
+
function Us(e) {
|
|
5649
|
+
return e;
|
|
5650
|
+
}
|
|
5651
|
+
function Ws(e) {
|
|
5652
|
+
if (!e) return null;
|
|
5653
|
+
if (e.en) return e.en;
|
|
5654
|
+
let t = Object.values(e);
|
|
5655
|
+
return t.length > 0 ? t[0] : null;
|
|
5656
|
+
}
|
|
5657
|
+
function Gs(e, t, n, r, i) {
|
|
5658
|
+
let a = [];
|
|
5659
|
+
for (let o of e) {
|
|
5660
|
+
if (o.kind === "group") {
|
|
5661
|
+
let e = Gs(o.items, t, n, r, i);
|
|
5662
|
+
e.length > 0 && a.push({
|
|
5663
|
+
...o,
|
|
5664
|
+
items: e
|
|
5665
|
+
});
|
|
5666
|
+
continue;
|
|
5667
|
+
}
|
|
5668
|
+
let e = Hs(o.code, t, n);
|
|
5669
|
+
e && e.visibility?.includes(r) && (i?.bulkRequired !== void 0 && (i.bulkRequiredPredicate ? i.bulkRequiredPredicate(e) : !1) !== i.bulkRequired || i?.excludeIf && i.excludeIf(e) || a.push(o));
|
|
5670
|
+
}
|
|
5671
|
+
return a;
|
|
5672
|
+
}
|
|
5673
|
+
function Ks(e, t, n, r, i, a) {
|
|
5674
|
+
let o = e ?? t;
|
|
5675
|
+
return o ? Gs(o, n, r, i, a) : Xs(n, i);
|
|
5676
|
+
}
|
|
5677
|
+
function qs(e) {
|
|
5678
|
+
return e.requires_selection === void 0 ? Js(e) : e.requires_selection;
|
|
5679
|
+
}
|
|
5680
|
+
function Js(e) {
|
|
5681
|
+
return e.visibility?.includes("list_floatbar") ?? !1;
|
|
5682
|
+
}
|
|
5683
|
+
function Ys(e, t, n, r, i) {
|
|
5684
|
+
return e.map((e) => {
|
|
5685
|
+
if (e.kind === "group") return {
|
|
5686
|
+
...e,
|
|
5687
|
+
items: Ys(e.items, t, n, r, i)
|
|
5688
|
+
};
|
|
5689
|
+
let a = Hs(e.code, t, n);
|
|
5690
|
+
return a && r(a) ? {
|
|
5691
|
+
...e,
|
|
5692
|
+
enabled: !1,
|
|
5693
|
+
reason: i
|
|
5694
|
+
} : e;
|
|
5695
|
+
});
|
|
5696
|
+
}
|
|
5697
|
+
function Xs(e, t) {
|
|
5698
|
+
return e ? Object.entries(e).filter(([, e]) => e.visibility?.includes(t)).sort(([e, t], [n, r]) => {
|
|
5699
|
+
let i = t.position ?? 0, a = r.position ?? 0;
|
|
5700
|
+
return i === a ? e < n ? -1 : +(e > n) : i - a;
|
|
5701
|
+
}).map(([e]) => ({
|
|
5702
|
+
kind: "action",
|
|
5703
|
+
code: e,
|
|
5704
|
+
enabled: !0,
|
|
5705
|
+
reason: null
|
|
5706
|
+
})) : [];
|
|
5707
|
+
}
|
|
5708
|
+
//#endregion
|
|
5429
5709
|
//#region src/lib/field-regions.ts
|
|
5430
|
-
var
|
|
5431
|
-
function
|
|
5432
|
-
return
|
|
5433
|
-
|
|
5710
|
+
var Zs = /* @__PURE__ */ new Map();
|
|
5711
|
+
function Qs(e, t) {
|
|
5712
|
+
return Zs.set(e, t), () => {
|
|
5713
|
+
Zs.get(e) === t && Zs.delete(e);
|
|
5434
5714
|
};
|
|
5435
5715
|
}
|
|
5436
|
-
function
|
|
5437
|
-
return
|
|
5716
|
+
function $s(e) {
|
|
5717
|
+
return Zs.get(e);
|
|
5438
5718
|
}
|
|
5439
5719
|
//#endregion
|
|
5440
5720
|
//#region src/lib/ui-actions.ts
|
|
5441
|
-
var
|
|
5442
|
-
function
|
|
5443
|
-
let n = e.match(
|
|
5721
|
+
var ec = /\$\{\s*([^}]+?)\s*\}/g, tc = /^\s*\$\{\s*([^}]+?)\s*\}\s*$/, nc = Symbol("unresolved");
|
|
5722
|
+
function rc(e, t) {
|
|
5723
|
+
let n = e.match(tc);
|
|
5444
5724
|
if (n) {
|
|
5445
|
-
let r =
|
|
5446
|
-
return r ===
|
|
5725
|
+
let r = ic(n[1], t);
|
|
5726
|
+
return r === nc ? e : r;
|
|
5447
5727
|
}
|
|
5448
|
-
return e.replace(
|
|
5449
|
-
let r =
|
|
5450
|
-
return r ===
|
|
5728
|
+
return e.replace(ec, (e, n) => {
|
|
5729
|
+
let r = ic(n, t);
|
|
5730
|
+
return r === nc ? e : I(r);
|
|
5451
5731
|
});
|
|
5452
5732
|
}
|
|
5453
|
-
function
|
|
5733
|
+
function ic(e, t) {
|
|
5454
5734
|
if (e === "now") return di();
|
|
5455
5735
|
let [n, ...r] = e.split(".");
|
|
5456
|
-
if (n === "row") return !t.row || r.length === 0 ?
|
|
5736
|
+
if (n === "row") return !t.row || r.length === 0 ? nc : ac(t.row, r);
|
|
5457
5737
|
if (n === "field" && r.length >= 2) {
|
|
5458
|
-
let [e, t] = r, n =
|
|
5459
|
-
return n ? n.getField(t) :
|
|
5738
|
+
let [e, t] = r, n = $s(e);
|
|
5739
|
+
return n ? n.getField(t) : nc;
|
|
5460
5740
|
}
|
|
5461
|
-
return n === "params" ? !t.params || r.length === 0 ?
|
|
5741
|
+
return n === "params" ? !t.params || r.length === 0 ? nc : ac(t.params, r) : nc;
|
|
5462
5742
|
}
|
|
5463
|
-
function
|
|
5743
|
+
function ac(e, t) {
|
|
5464
5744
|
return t.reduce((e, t) => {
|
|
5465
5745
|
if (e && typeof e == "object") return e[t];
|
|
5466
5746
|
}, e);
|
|
5467
5747
|
}
|
|
5468
|
-
async function
|
|
5748
|
+
async function oc(e, t) {
|
|
5469
5749
|
for (let n of e) try {
|
|
5470
|
-
await
|
|
5750
|
+
await sc(n, t);
|
|
5471
5751
|
} catch (e) {
|
|
5472
5752
|
let t = e instanceof Error ? e.message : String(e);
|
|
5473
5753
|
Z.error(`ui_step failed: ${t}`);
|
|
5474
5754
|
return;
|
|
5475
5755
|
}
|
|
5476
5756
|
}
|
|
5477
|
-
async function
|
|
5757
|
+
async function sc(e, t) {
|
|
5478
5758
|
if (e.copy_to_clipboard != null) {
|
|
5479
|
-
let n =
|
|
5759
|
+
let n = lc(e.copy_to_clipboard, t);
|
|
5480
5760
|
await navigator.clipboard.writeText(n);
|
|
5481
5761
|
return;
|
|
5482
5762
|
}
|
|
5483
5763
|
if (e.set_field) {
|
|
5484
|
-
let { target: n, value: r } = e.set_field, { region: i, field: a } =
|
|
5764
|
+
let { target: n, value: r } = e.set_field, { region: i, field: a } = uc(n), o = $s(i);
|
|
5485
5765
|
if (!o) throw Error(`region "${i}" not registered`);
|
|
5486
|
-
o.setField(a,
|
|
5766
|
+
o.setField(a, cc(r, t));
|
|
5487
5767
|
return;
|
|
5488
5768
|
}
|
|
5489
5769
|
if (e.focus_field) {
|
|
5490
|
-
let { region: t, field: n } =
|
|
5770
|
+
let { region: t, field: n } = uc(e.focus_field), r = $s(t);
|
|
5491
5771
|
if (!r) throw Error(`region "${t}" not registered`);
|
|
5492
5772
|
r.focusField(n);
|
|
5493
5773
|
return;
|
|
5494
5774
|
}
|
|
5495
5775
|
if (e.show_toast) {
|
|
5496
|
-
let n =
|
|
5776
|
+
let n = lc(e.show_toast.message, t), r = e.show_toast.kind ?? "info";
|
|
5497
5777
|
r === "success" ? Z.success(n) : r === "error" ? Z.error(n) : Z.info(n);
|
|
5498
5778
|
return;
|
|
5499
5779
|
}
|
|
5500
5780
|
}
|
|
5501
|
-
function
|
|
5502
|
-
return typeof e == "string" ?
|
|
5781
|
+
function cc(e, t) {
|
|
5782
|
+
return typeof e == "string" ? rc(e, t) : e;
|
|
5503
5783
|
}
|
|
5504
|
-
function
|
|
5505
|
-
return I(
|
|
5784
|
+
function lc(e, t) {
|
|
5785
|
+
return I(rc(e, t));
|
|
5506
5786
|
}
|
|
5507
|
-
function
|
|
5787
|
+
function uc(e) {
|
|
5508
5788
|
let t = e.indexOf(".");
|
|
5509
5789
|
if (t <= 0) throw Error(`invalid path "${e}" (expected "region.field")`);
|
|
5510
5790
|
return {
|
|
@@ -5512,12 +5792,12 @@ function Os(e) {
|
|
|
5512
5792
|
field: e.slice(t + 1)
|
|
5513
5793
|
};
|
|
5514
5794
|
}
|
|
5515
|
-
function
|
|
5795
|
+
function dc(e) {
|
|
5516
5796
|
return !e.handler && !!e.ui_steps && e.ui_steps.length > 0;
|
|
5517
5797
|
}
|
|
5518
5798
|
//#endregion
|
|
5519
5799
|
//#region src/lib/mass-edit.ts
|
|
5520
|
-
function
|
|
5800
|
+
function fc(e) {
|
|
5521
5801
|
if (!e) return [];
|
|
5522
5802
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
5523
5803
|
for (let r of e.split(",")) {
|
|
@@ -5526,17 +5806,17 @@ function As(e) {
|
|
|
5526
5806
|
}
|
|
5527
5807
|
return n;
|
|
5528
5808
|
}
|
|
5529
|
-
function
|
|
5809
|
+
function pc(e, t) {
|
|
5530
5810
|
if (!e || !Ye(e, "update")) return [];
|
|
5531
|
-
let n = Array.isArray(t) ? t :
|
|
5811
|
+
let n = Array.isArray(t) ? t : fc(t), r = n.length > 0 ? new Set(n) : null, i = ot(e), a = new Set(z(e)), o = r ? n : mc(e, i, a), s = [];
|
|
5532
5812
|
for (let t of o) {
|
|
5533
5813
|
if (r && !r.has(t)) continue;
|
|
5534
|
-
let n =
|
|
5814
|
+
let n = hc(e, t, i, a);
|
|
5535
5815
|
n && s.push(n);
|
|
5536
5816
|
}
|
|
5537
5817
|
return s;
|
|
5538
5818
|
}
|
|
5539
|
-
function
|
|
5819
|
+
function mc(e, t, n) {
|
|
5540
5820
|
let r = [];
|
|
5541
5821
|
for (let [t, i] of e.fields) n.has(t) || i.auto || r.push(t);
|
|
5542
5822
|
if (!t) {
|
|
@@ -5545,7 +5825,7 @@ function Ms(e, t, n) {
|
|
|
5545
5825
|
}
|
|
5546
5826
|
return r;
|
|
5547
5827
|
}
|
|
5548
|
-
function
|
|
5828
|
+
function hc(e, t, n, r) {
|
|
5549
5829
|
if (t.startsWith("$status.")) {
|
|
5550
5830
|
if (n) return null;
|
|
5551
5831
|
let r = t.slice(8), i = e.status_groups?.[r];
|
|
@@ -5553,7 +5833,7 @@ function Ns(e, t, n, r) {
|
|
|
5553
5833
|
code: t,
|
|
5554
5834
|
bare: r,
|
|
5555
5835
|
kind: "status",
|
|
5556
|
-
label:
|
|
5836
|
+
label: gc(i.name, r),
|
|
5557
5837
|
statusGroup: i
|
|
5558
5838
|
} : null;
|
|
5559
5839
|
}
|
|
@@ -5564,7 +5844,7 @@ function Ns(e, t, n, r) {
|
|
|
5564
5844
|
code: t,
|
|
5565
5845
|
bare: r,
|
|
5566
5846
|
kind: "property",
|
|
5567
|
-
label:
|
|
5847
|
+
label: gc(i.name, r),
|
|
5568
5848
|
property: i
|
|
5569
5849
|
} : null;
|
|
5570
5850
|
}
|
|
@@ -5574,18 +5854,18 @@ function Ns(e, t, n, r) {
|
|
|
5574
5854
|
code: t,
|
|
5575
5855
|
bare: t,
|
|
5576
5856
|
kind: "field",
|
|
5577
|
-
label:
|
|
5857
|
+
label: gc(i.display?.name, t),
|
|
5578
5858
|
field: i
|
|
5579
5859
|
};
|
|
5580
5860
|
}
|
|
5581
|
-
function
|
|
5861
|
+
function gc(e, t) {
|
|
5582
5862
|
return e && L(e) || t;
|
|
5583
5863
|
}
|
|
5584
5864
|
//#endregion
|
|
5585
5865
|
//#region src/components/mass-edit/PropertyGridEditor.tsx
|
|
5586
|
-
var
|
|
5587
|
-
function
|
|
5588
|
-
let a = d(() =>
|
|
5866
|
+
var _c = Symbol.for("declarion.mass-edit.multiple");
|
|
5867
|
+
function vc({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange: i }) {
|
|
5868
|
+
let a = d(() => pc(e, t), [e, t]), o = d(() => Object.keys(r).map((e) => {
|
|
5589
5869
|
let t = a.find((t) => t.code === e);
|
|
5590
5870
|
return t ? {
|
|
5591
5871
|
target: t,
|
|
@@ -5595,8 +5875,8 @@ function Is({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange:
|
|
|
5595
5875
|
let e = new Set(o.map((e) => e.target.code));
|
|
5596
5876
|
return a.filter((t) => !e.has(t.code));
|
|
5597
5877
|
}, [o, a]), l = s((e) => {
|
|
5598
|
-
let t =
|
|
5599
|
-
a[e.code] = t ===
|
|
5878
|
+
let t = Cc(e, n), a = { ...r };
|
|
5879
|
+
a[e.code] = t === _c ? void 0 : t, i(a);
|
|
5600
5880
|
}, [
|
|
5601
5881
|
r,
|
|
5602
5882
|
n,
|
|
@@ -5624,12 +5904,12 @@ function Is({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange:
|
|
|
5624
5904
|
},
|
|
5625
5905
|
children: "No targets selected. Add a field, status, or property to edit across all selected rows."
|
|
5626
5906
|
}),
|
|
5627
|
-
o.map((e) => /* @__PURE__ */ b(
|
|
5907
|
+
o.map((e) => /* @__PURE__ */ b(yc, {
|
|
5628
5908
|
row: e,
|
|
5629
5909
|
onChange: (t) => u(e.target.code, t),
|
|
5630
5910
|
onRemove: () => f(e.target.code)
|
|
5631
5911
|
}, e.target.code)),
|
|
5632
|
-
/* @__PURE__ */ b(
|
|
5912
|
+
/* @__PURE__ */ b(Sc, {
|
|
5633
5913
|
targets: c,
|
|
5634
5914
|
onPick: l
|
|
5635
5915
|
})
|
|
@@ -5642,7 +5922,7 @@ function Is({ entity: e, filterTargets: t, selectedRows: n, value: r, onChange:
|
|
|
5642
5922
|
children: "Entity schema unavailable. Mass edit requires an entity-bound action."
|
|
5643
5923
|
});
|
|
5644
5924
|
}
|
|
5645
|
-
function
|
|
5925
|
+
function yc({ row: e, onChange: n, onRemove: r }) {
|
|
5646
5926
|
let { target: i } = e;
|
|
5647
5927
|
return /* @__PURE__ */ x("div", {
|
|
5648
5928
|
"data-testid": "mass-edit-row",
|
|
@@ -5661,7 +5941,7 @@ function Ls({ row: e, onChange: n, onRemove: r }) {
|
|
|
5661
5941
|
title: i.code,
|
|
5662
5942
|
children: i.label
|
|
5663
5943
|
}),
|
|
5664
|
-
/* @__PURE__ */ b(
|
|
5944
|
+
/* @__PURE__ */ b(bc, {
|
|
5665
5945
|
row: e,
|
|
5666
5946
|
onChange: n
|
|
5667
5947
|
}),
|
|
@@ -5673,8 +5953,8 @@ function Ls({ row: e, onChange: n, onRemove: r }) {
|
|
|
5673
5953
|
]
|
|
5674
5954
|
});
|
|
5675
5955
|
}
|
|
5676
|
-
function
|
|
5677
|
-
let { target: n } = e, r = ms(), i = e.value ===
|
|
5956
|
+
function bc({ row: e, onChange: t }) {
|
|
5957
|
+
let { target: n } = e, r = ms(), i = e.value === _c, a = i ? "<multiple values>" : void 0, o = i ? "" : e.value;
|
|
5678
5958
|
if (n.kind === "status" && n.statusGroup) {
|
|
5679
5959
|
let e = n.statusGroup.statuses.map((e) => ({
|
|
5680
5960
|
value: e.code,
|
|
@@ -5690,7 +5970,7 @@ function Rs({ row: e, onChange: t }) {
|
|
|
5690
5970
|
})
|
|
5691
5971
|
});
|
|
5692
5972
|
}
|
|
5693
|
-
let s =
|
|
5973
|
+
let s = xc(n);
|
|
5694
5974
|
return /* @__PURE__ */ x("div", {
|
|
5695
5975
|
"data-testid": `value-${n.code}`,
|
|
5696
5976
|
style: { position: "relative" },
|
|
@@ -5713,7 +5993,7 @@ function Rs({ row: e, onChange: t }) {
|
|
|
5713
5993
|
})]
|
|
5714
5994
|
});
|
|
5715
5995
|
}
|
|
5716
|
-
function
|
|
5996
|
+
function xc(e) {
|
|
5717
5997
|
if (e.kind === "field" && e.field) return e.field;
|
|
5718
5998
|
if (e.kind === "property" && e.property) {
|
|
5719
5999
|
let t = e.property;
|
|
@@ -5728,7 +6008,7 @@ function zs(e) {
|
|
|
5728
6008
|
}
|
|
5729
6009
|
return { type: "string" };
|
|
5730
6010
|
}
|
|
5731
|
-
function
|
|
6011
|
+
function Sc({ targets: e, onPick: n }) {
|
|
5732
6012
|
let [r, i] = p(!1);
|
|
5733
6013
|
return e.length === 0 ? null : r ? /* @__PURE__ */ b("div", {
|
|
5734
6014
|
"data-testid": "mass-edit-target-picker",
|
|
@@ -5755,7 +6035,7 @@ function Bs({ targets: e, onPick: n }) {
|
|
|
5755
6035
|
children: [/* @__PURE__ */ b(t.plus, { size: 12 }), " Add target"]
|
|
5756
6036
|
});
|
|
5757
6037
|
}
|
|
5758
|
-
function
|
|
6038
|
+
function Cc(e, t) {
|
|
5759
6039
|
if (!t || t.length === 0 || e.kind !== "field") return;
|
|
5760
6040
|
let n, r = !1;
|
|
5761
6041
|
for (let i of t) {
|
|
@@ -5764,16 +6044,16 @@ function Vs(e, t) {
|
|
|
5764
6044
|
n = t, r = !0;
|
|
5765
6045
|
continue;
|
|
5766
6046
|
}
|
|
5767
|
-
if (n !== t) return
|
|
6047
|
+
if (n !== t) return _c;
|
|
5768
6048
|
}
|
|
5769
6049
|
return n;
|
|
5770
6050
|
}
|
|
5771
6051
|
//#endregion
|
|
5772
6052
|
//#region src/components/shared/ActionDialog.tsx
|
|
5773
|
-
var
|
|
5774
|
-
function
|
|
6053
|
+
var wc = /^\$row\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)$/;
|
|
6054
|
+
function Tc(e, t) {
|
|
5775
6055
|
if (typeof e != "string") return e ?? "";
|
|
5776
|
-
let n = e.match(
|
|
6056
|
+
let n = e.match(wc);
|
|
5777
6057
|
if (n) {
|
|
5778
6058
|
let r = n[1].split("."), i = t;
|
|
5779
6059
|
for (let e of r) {
|
|
@@ -5785,9 +6065,9 @@ function Us(e, t) {
|
|
|
5785
6065
|
}
|
|
5786
6066
|
return i === void 0 ? ((t == null || !(r[0] in t)) && typeof console < "u" && console.warn && console.warn(`ActionDialog: prefill template ${e} could not be resolved; row is missing field '${r[0]}'`), "") : i ?? "";
|
|
5787
6067
|
}
|
|
5788
|
-
return
|
|
6068
|
+
return rc(e, { row: t });
|
|
5789
6069
|
}
|
|
5790
|
-
function
|
|
6070
|
+
function Ec(e) {
|
|
5791
6071
|
return {
|
|
5792
6072
|
type: e.type ?? "string",
|
|
5793
6073
|
required: e.required,
|
|
@@ -5801,18 +6081,18 @@ function Ws(e) {
|
|
|
5801
6081
|
ref: Ke(e.ref)
|
|
5802
6082
|
};
|
|
5803
6083
|
}
|
|
5804
|
-
function
|
|
6084
|
+
function Dc(e, t) {
|
|
5805
6085
|
if (!e.includes("${")) return e;
|
|
5806
|
-
let n =
|
|
6086
|
+
let n = rc(e, { params: t });
|
|
5807
6087
|
return n == null ? "" : I(n);
|
|
5808
6088
|
}
|
|
5809
|
-
var
|
|
5810
|
-
function
|
|
6089
|
+
var Oc = /\$\{\s*([^}]+?)\s*\}/g;
|
|
6090
|
+
function kc(e, t) {
|
|
5811
6091
|
let n = `params.${t}`;
|
|
5812
|
-
for (let t of e.matchAll(
|
|
6092
|
+
for (let t of e.matchAll(Oc)) if (t[1] === n) return !0;
|
|
5813
6093
|
return !1;
|
|
5814
6094
|
}
|
|
5815
|
-
function
|
|
6095
|
+
function Ac({ param: e, value: t, onChange: n, statusGroups: r }) {
|
|
5816
6096
|
let i = d(() => {
|
|
5817
6097
|
let t = r ? Object.entries(r) : [];
|
|
5818
6098
|
return [{
|
|
@@ -5830,12 +6110,12 @@ function Js({ param: e, value: t, onChange: n, statusGroups: r }) {
|
|
|
5830
6110
|
placeholder: "Select status group…"
|
|
5831
6111
|
});
|
|
5832
6112
|
}
|
|
5833
|
-
function
|
|
6113
|
+
function jc({ param: e, value: t, onChange: n, statusGroups: r, formData: i }) {
|
|
5834
6114
|
let a = d(() => {
|
|
5835
6115
|
if (!r) return [];
|
|
5836
6116
|
let t = e.filter?.status_group;
|
|
5837
6117
|
if (t) {
|
|
5838
|
-
let e =
|
|
6118
|
+
let e = Dc(t, i);
|
|
5839
6119
|
return e && r[e] ? r[e].statuses : [];
|
|
5840
6120
|
}
|
|
5841
6121
|
return Object.values(r).flatMap((e) => e.statuses);
|
|
@@ -5857,21 +6137,27 @@ function Ys({ param: e, value: t, onChange: n, statusGroups: r, formData: i }) {
|
|
|
5857
6137
|
placeholder: "Select status…"
|
|
5858
6138
|
});
|
|
5859
6139
|
}
|
|
5860
|
-
function
|
|
5861
|
-
let { data:
|
|
5862
|
-
|
|
5863
|
-
}, [
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
6140
|
+
function Mc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, isPending: o, row: c, bulkSelection: u }) {
|
|
6141
|
+
let { data: m } = Y(), h = ms(), g = r.resolved_params, _ = r.resolved_hidden_defaults ?? {}, v = !!r.destructive, S = js(r, h), C = s(() => {
|
|
6142
|
+
o || n(!1);
|
|
6143
|
+
}, [o, n]), w = f(null);
|
|
6144
|
+
l(() => {
|
|
6145
|
+
e && w.current?.focus();
|
|
6146
|
+
}, [e]);
|
|
6147
|
+
let T = d(() => g ? Array.from(g) : [], [g]), E = d(() => {
|
|
6148
|
+
if (!(!r.entity || !m)) return m.entities[r.entity]?.status_groups;
|
|
6149
|
+
}, [r.entity, m]), k = d(() => {
|
|
6150
|
+
if (!(!r.entity || !m)) return m.entities[r.entity];
|
|
6151
|
+
}, [r.entity, m]), A = d(() => {
|
|
6152
|
+
if (k) {
|
|
6153
|
+
for (let [e, t] of k.fields) if (t.primary) return e;
|
|
6154
|
+
return k.primary_key?.[0];
|
|
5869
6155
|
}
|
|
5870
|
-
}, [
|
|
5871
|
-
let e = { ...
|
|
5872
|
-
for (let [t, n] of
|
|
6156
|
+
}, [k]), [j, M] = p(s(() => {
|
|
6157
|
+
let e = { ..._ };
|
|
6158
|
+
for (let [t, n] of T) {
|
|
5873
6159
|
if (n.type === "id_array") {
|
|
5874
|
-
|
|
6160
|
+
u && A ? e[t] = u.map((e) => e[A]).filter((e) => e != null) : e[t] = [];
|
|
5875
6161
|
continue;
|
|
5876
6162
|
}
|
|
5877
6163
|
if (n.type === "entity_patch") {
|
|
@@ -5879,47 +6165,47 @@ function Xs({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
5879
6165
|
continue;
|
|
5880
6166
|
}
|
|
5881
6167
|
if (n.type === "bool") {
|
|
5882
|
-
let r =
|
|
6168
|
+
let r = Tc(n.default, c);
|
|
5883
6169
|
e[t] = r === !0 || r === "true";
|
|
5884
6170
|
continue;
|
|
5885
6171
|
}
|
|
5886
|
-
e[t] =
|
|
6172
|
+
e[t] = Tc(n.default, c);
|
|
5887
6173
|
}
|
|
5888
6174
|
return e;
|
|
5889
6175
|
}, [
|
|
5890
|
-
|
|
6176
|
+
T,
|
|
5891
6177
|
c,
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
])),
|
|
5895
|
-
|
|
6178
|
+
u,
|
|
6179
|
+
A
|
|
6180
|
+
])), N = s((e, t) => {
|
|
6181
|
+
M((n) => {
|
|
5896
6182
|
let r = {
|
|
5897
6183
|
...n,
|
|
5898
6184
|
[e]: t
|
|
5899
6185
|
};
|
|
5900
|
-
if (!
|
|
5901
|
-
for (let [t, n] of
|
|
6186
|
+
if (!g) return r;
|
|
6187
|
+
for (let [t, n] of g) {
|
|
5902
6188
|
if (n.type !== "status") continue;
|
|
5903
6189
|
let i = n.filter?.status_group;
|
|
5904
|
-
i &&
|
|
6190
|
+
i && kc(i, e) && (r[t] = "");
|
|
5905
6191
|
}
|
|
5906
6192
|
return r;
|
|
5907
6193
|
});
|
|
5908
|
-
}, [
|
|
5909
|
-
let e = { ...
|
|
5910
|
-
for (let [t, n] of
|
|
5911
|
-
let r =
|
|
6194
|
+
}, [g]), ee = s(() => {
|
|
6195
|
+
let e = { ...j };
|
|
6196
|
+
for (let [t, n] of T) {
|
|
6197
|
+
let r = j[t], i = r == null || r === "";
|
|
5912
6198
|
if (n.required && i) return;
|
|
5913
6199
|
i && delete e[t];
|
|
5914
6200
|
}
|
|
5915
6201
|
a(e);
|
|
5916
6202
|
}, [
|
|
5917
|
-
|
|
5918
|
-
|
|
6203
|
+
j,
|
|
6204
|
+
T,
|
|
5919
6205
|
a
|
|
5920
6206
|
]);
|
|
5921
6207
|
return e ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("div", {
|
|
5922
|
-
onClick:
|
|
6208
|
+
onClick: C,
|
|
5923
6209
|
style: {
|
|
5924
6210
|
position: "fixed",
|
|
5925
6211
|
inset: 0,
|
|
@@ -5929,9 +6215,15 @@ function Xs({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
5929
6215
|
}
|
|
5930
6216
|
}), /* @__PURE__ */ x("div", {
|
|
5931
6217
|
"data-testid": "action-dialog",
|
|
6218
|
+
ref: w,
|
|
5932
6219
|
role: "dialog",
|
|
5933
6220
|
"aria-modal": "true",
|
|
6221
|
+
"aria-busy": o,
|
|
5934
6222
|
"aria-label": i,
|
|
6223
|
+
tabIndex: -1,
|
|
6224
|
+
onKeyDown: (e) => {
|
|
6225
|
+
e.key === "Escape" && C();
|
|
6226
|
+
},
|
|
5935
6227
|
style: {
|
|
5936
6228
|
position: "fixed",
|
|
5937
6229
|
top: "50%",
|
|
@@ -5948,7 +6240,8 @@ function Xs({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
5948
6240
|
display: "flex",
|
|
5949
6241
|
flexDirection: "column",
|
|
5950
6242
|
boxSizing: "border-box",
|
|
5951
|
-
minWidth: 0
|
|
6243
|
+
minWidth: 0,
|
|
6244
|
+
outline: "none"
|
|
5952
6245
|
},
|
|
5953
6246
|
children: [
|
|
5954
6247
|
/* @__PURE__ */ x("div", {
|
|
@@ -5964,14 +6257,14 @@ function Xs({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
5964
6257
|
width: 28,
|
|
5965
6258
|
height: 28,
|
|
5966
6259
|
borderRadius: 7,
|
|
5967
|
-
background: "var(--accent-soft)",
|
|
5968
|
-
color: "var(--accent)",
|
|
6260
|
+
background: v ? "var(--danger-soft)" : "var(--accent-soft)",
|
|
6261
|
+
color: v ? "var(--danger)" : "var(--accent)",
|
|
5969
6262
|
display: "inline-flex",
|
|
5970
6263
|
alignItems: "center",
|
|
5971
6264
|
justifyContent: "center",
|
|
5972
6265
|
flexShrink: 0
|
|
5973
6266
|
},
|
|
5974
|
-
children:
|
|
6267
|
+
children: b(v ? t.trash : t.bolt, { size: 15 })
|
|
5975
6268
|
}),
|
|
5976
6269
|
/* @__PURE__ */ x("div", {
|
|
5977
6270
|
style: {
|
|
@@ -5991,16 +6284,16 @@ function Xs({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
5991
6284
|
color: "var(--text-3)",
|
|
5992
6285
|
marginTop: 2
|
|
5993
6286
|
},
|
|
5994
|
-
children: L(r.display?.description) || "Fill in the parameters below to execute this action."
|
|
6287
|
+
children: L(r.display?.description) || (T.length > 0 ? "Fill in the parameters below to execute this action." : "")
|
|
5995
6288
|
})]
|
|
5996
6289
|
}),
|
|
5997
6290
|
/* @__PURE__ */ b(O, {
|
|
5998
6291
|
icon: /* @__PURE__ */ b(t.x, { size: 14 }),
|
|
5999
|
-
onClick:
|
|
6292
|
+
onClick: C
|
|
6000
6293
|
})
|
|
6001
6294
|
]
|
|
6002
6295
|
}),
|
|
6003
|
-
/* @__PURE__ */
|
|
6296
|
+
/* @__PURE__ */ x("div", {
|
|
6004
6297
|
style: {
|
|
6005
6298
|
padding: "12px 18px 16px",
|
|
6006
6299
|
display: "flex",
|
|
@@ -6010,59 +6303,84 @@ function Xs({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6010
6303
|
minWidth: 0,
|
|
6011
6304
|
minHeight: 0
|
|
6012
6305
|
},
|
|
6013
|
-
children:
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6306
|
+
children: [S && /* @__PURE__ */ b("div", {
|
|
6307
|
+
style: {
|
|
6308
|
+
fontSize: 12.5,
|
|
6309
|
+
lineHeight: 1.5,
|
|
6310
|
+
color: "var(--text-2)",
|
|
6311
|
+
background: v ? "var(--danger-soft)" : "var(--surface-2)",
|
|
6312
|
+
border: "1px solid var(--divider)",
|
|
6313
|
+
borderRadius: 8,
|
|
6314
|
+
padding: "10px 12px"
|
|
6315
|
+
},
|
|
6316
|
+
children: S
|
|
6317
|
+
}), /* @__PURE__ */ b("fieldset", {
|
|
6318
|
+
disabled: o,
|
|
6319
|
+
style: {
|
|
6320
|
+
border: 0,
|
|
6321
|
+
margin: 0,
|
|
6322
|
+
padding: 0,
|
|
6323
|
+
minInlineSize: 0,
|
|
6324
|
+
display: "flex",
|
|
6325
|
+
flexDirection: "column",
|
|
6326
|
+
gap: 12,
|
|
6327
|
+
pointerEvents: o ? "none" : void 0,
|
|
6328
|
+
opacity: o ? .6 : 1
|
|
6329
|
+
},
|
|
6330
|
+
children: T.map(([e, t]) => {
|
|
6331
|
+
let n = L(t.display?.name) || e;
|
|
6332
|
+
if (t.type === "id_array") return null;
|
|
6333
|
+
let r;
|
|
6334
|
+
if (t.type === "entity_patch") {
|
|
6335
|
+
let n = typeof t.filter?.targets == "string" ? t.filter.targets : void 0;
|
|
6336
|
+
r = /* @__PURE__ */ b(vc, {
|
|
6337
|
+
entity: k,
|
|
6338
|
+
filterTargets: n,
|
|
6339
|
+
selectedRows: u,
|
|
6340
|
+
value: j[e] ?? {},
|
|
6341
|
+
onChange: (t) => N(e, t)
|
|
6342
|
+
});
|
|
6343
|
+
} else r = t.type === "status_group" ? /* @__PURE__ */ b(Ac, {
|
|
6344
|
+
param: t,
|
|
6345
|
+
value: j[e],
|
|
6346
|
+
onChange: (t) => N(e, t),
|
|
6347
|
+
statusGroups: E,
|
|
6348
|
+
formData: j
|
|
6349
|
+
}) : t.type === "status" ? /* @__PURE__ */ b(jc, {
|
|
6350
|
+
param: t,
|
|
6351
|
+
value: j[e],
|
|
6352
|
+
onChange: (t) => N(e, t),
|
|
6353
|
+
statusGroups: E,
|
|
6354
|
+
formData: j
|
|
6355
|
+
}) : ds({
|
|
6356
|
+
field: Ec(t),
|
|
6357
|
+
fieldName: e,
|
|
6358
|
+
value: j[e],
|
|
6359
|
+
mode: "edit",
|
|
6360
|
+
onChange: (t) => N(e, t),
|
|
6361
|
+
locale: h
|
|
6025
6362
|
});
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
})
|
|
6046
|
-
|
|
6047
|
-
style: { minWidth: 0 },
|
|
6048
|
-
children: [
|
|
6049
|
-
/* @__PURE__ */ b(Ce, {
|
|
6050
|
-
required: t.required,
|
|
6051
|
-
children: n
|
|
6052
|
-
}),
|
|
6053
|
-
r,
|
|
6054
|
-
t.display?.description && /* @__PURE__ */ b("p", {
|
|
6055
|
-
style: {
|
|
6056
|
-
fontSize: 11,
|
|
6057
|
-
color: "var(--text-3)",
|
|
6058
|
-
marginTop: 4,
|
|
6059
|
-
marginBottom: 0
|
|
6060
|
-
},
|
|
6061
|
-
children: L(t.display.description)
|
|
6062
|
-
})
|
|
6063
|
-
]
|
|
6064
|
-
}, e);
|
|
6065
|
-
})
|
|
6363
|
+
return /* @__PURE__ */ x("div", {
|
|
6364
|
+
style: { minWidth: 0 },
|
|
6365
|
+
children: [
|
|
6366
|
+
/* @__PURE__ */ b(Ce, {
|
|
6367
|
+
required: t.required,
|
|
6368
|
+
children: n
|
|
6369
|
+
}),
|
|
6370
|
+
r,
|
|
6371
|
+
t.display?.description && /* @__PURE__ */ b("p", {
|
|
6372
|
+
style: {
|
|
6373
|
+
fontSize: 11,
|
|
6374
|
+
color: "var(--text-3)",
|
|
6375
|
+
marginTop: 4,
|
|
6376
|
+
marginBottom: 0
|
|
6377
|
+
},
|
|
6378
|
+
children: L(t.display.description)
|
|
6379
|
+
})
|
|
6380
|
+
]
|
|
6381
|
+
}, e);
|
|
6382
|
+
})
|
|
6383
|
+
})]
|
|
6066
6384
|
}),
|
|
6067
6385
|
/* @__PURE__ */ x("div", {
|
|
6068
6386
|
style: {
|
|
@@ -6079,16 +6397,17 @@ function Xs({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6079
6397
|
children: [
|
|
6080
6398
|
/* @__PURE__ */ b("div", { style: { flex: 1 } }),
|
|
6081
6399
|
/* @__PURE__ */ b(D, {
|
|
6082
|
-
onClick:
|
|
6400
|
+
onClick: C,
|
|
6083
6401
|
disabled: o,
|
|
6084
6402
|
children: "Cancel"
|
|
6085
6403
|
}),
|
|
6086
6404
|
/* @__PURE__ */ b(D, {
|
|
6087
6405
|
kind: "primary",
|
|
6088
|
-
|
|
6089
|
-
|
|
6406
|
+
danger: v,
|
|
6407
|
+
icon: b(o ? Se : v ? t.trash : t.bolt, { size: 13 }),
|
|
6408
|
+
onClick: ee,
|
|
6090
6409
|
disabled: o,
|
|
6091
|
-
children: o ? "Executing…" : "Execute"
|
|
6410
|
+
children: o ? "Executing…" : T.length > 0 ? "Execute" : "Confirm"
|
|
6092
6411
|
})
|
|
6093
6412
|
]
|
|
6094
6413
|
})
|
|
@@ -6097,7 +6416,7 @@ function Xs({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6097
6416
|
}
|
|
6098
6417
|
//#endregion
|
|
6099
6418
|
//#region src/components/shared/ActionResultDialog.tsx
|
|
6100
|
-
function
|
|
6419
|
+
function Nc({ open: e, onClose: n, display: r }) {
|
|
6101
6420
|
let i = f(null);
|
|
6102
6421
|
return l(() => {
|
|
6103
6422
|
e && i.current?.focus();
|
|
@@ -6192,7 +6511,7 @@ function Zs({ open: e, onClose: n, display: r }) {
|
|
|
6192
6511
|
gap: 12,
|
|
6193
6512
|
overflowY: "auto"
|
|
6194
6513
|
},
|
|
6195
|
-
children: r.fields.map((e, t) => /* @__PURE__ */ b(
|
|
6514
|
+
children: r.fields.map((e, t) => /* @__PURE__ */ b(Pc, { field: e }, t))
|
|
6196
6515
|
}),
|
|
6197
6516
|
/* @__PURE__ */ x("div", {
|
|
6198
6517
|
style: {
|
|
@@ -6215,7 +6534,7 @@ function Zs({ open: e, onClose: n, display: r }) {
|
|
|
6215
6534
|
]
|
|
6216
6535
|
})] }) : null;
|
|
6217
6536
|
}
|
|
6218
|
-
function
|
|
6537
|
+
function Pc({ field: e }) {
|
|
6219
6538
|
let n = e.href ?? e.download_url ?? e.value, r = e.type === "download", i = r || e.type === "link", a = n ? Zr(n) : void 0, [o, s] = p(!1), [c, l] = p(null);
|
|
6220
6539
|
async function u() {
|
|
6221
6540
|
if (a) {
|
|
@@ -6345,7 +6664,7 @@ function Qs({ field: e }) {
|
|
|
6345
6664
|
}
|
|
6346
6665
|
//#endregion
|
|
6347
6666
|
//#region src/components/shared/ActionRunner.tsx
|
|
6348
|
-
function
|
|
6667
|
+
function Fc(e) {
|
|
6349
6668
|
if (!e || typeof e != "object") return { kind: "success" };
|
|
6350
6669
|
let t = e, n = t.status, r = t.success?.length ?? 0, i = t.errors?.length ?? 0, a = t.skipped?.length ?? 0, o = t.errors?.[0]?.error;
|
|
6351
6670
|
if (n === "partial") {
|
|
@@ -6360,15 +6679,15 @@ function $s(e) {
|
|
|
6360
6679
|
detail: "No items matched"
|
|
6361
6680
|
} : n === "accepted" ? { kind: "accepted" } : { kind: "success" };
|
|
6362
6681
|
}
|
|
6363
|
-
function
|
|
6682
|
+
function Ic(e) {
|
|
6364
6683
|
if (!e || typeof e != "object") return null;
|
|
6365
6684
|
let t = e.result;
|
|
6366
6685
|
if (!t || typeof t != "object") return null;
|
|
6367
6686
|
let n = t.$display;
|
|
6368
6687
|
return !n || typeof n != "object" ? null : n;
|
|
6369
6688
|
}
|
|
6370
|
-
function
|
|
6371
|
-
let t =
|
|
6689
|
+
function Lc(e) {
|
|
6690
|
+
let t = Ic(e)?.fields;
|
|
6372
6691
|
if (!Array.isArray(t)) return null;
|
|
6373
6692
|
for (let e of t) {
|
|
6374
6693
|
if (e?.type !== "download") continue;
|
|
@@ -6380,12 +6699,12 @@ function tc(e) {
|
|
|
6380
6699
|
}
|
|
6381
6700
|
return null;
|
|
6382
6701
|
}
|
|
6383
|
-
function
|
|
6702
|
+
function Rc(e) {
|
|
6384
6703
|
if (!e || typeof e != "object") return;
|
|
6385
6704
|
let t = e.result;
|
|
6386
6705
|
!t || typeof t != "object" || "impersonation_session_id" in t && window.location.assign("/");
|
|
6387
6706
|
}
|
|
6388
|
-
function
|
|
6707
|
+
function zc(e) {
|
|
6389
6708
|
if (e instanceof $n) {
|
|
6390
6709
|
let t = e.response.errors ?? [];
|
|
6391
6710
|
if (t.length === 1) return {
|
|
@@ -6406,23 +6725,23 @@ function rc(e) {
|
|
|
6406
6725
|
detail: e instanceof Error ? e.message : String(e)
|
|
6407
6726
|
};
|
|
6408
6727
|
}
|
|
6409
|
-
var
|
|
6410
|
-
function
|
|
6411
|
-
let e = c(
|
|
6728
|
+
var Bc = i(null);
|
|
6729
|
+
function Vc() {
|
|
6730
|
+
let e = c(Bc);
|
|
6412
6731
|
if (!e) throw Error("useActionRunner must be used within <ActionRunnerProvider>");
|
|
6413
6732
|
return e;
|
|
6414
6733
|
}
|
|
6415
|
-
function
|
|
6734
|
+
function Hc(e) {
|
|
6416
6735
|
let t = {}, n = e.action?.resolved_hidden_defaults;
|
|
6417
6736
|
if (n) for (let [e, r] of Object.entries(n)) r !== void 0 && (t[e] = r);
|
|
6418
6737
|
return t;
|
|
6419
6738
|
}
|
|
6420
|
-
function
|
|
6739
|
+
function Uc({ children: e }) {
|
|
6421
6740
|
let t = Mr(), { data: n } = Y(), [r, i] = p(null), [a, o] = p(0), [c, l] = p(null), u = s((e) => {
|
|
6422
6741
|
if (e?.progress_screen) return n?.screens[e.progress_screen]?.route;
|
|
6423
6742
|
}, [n?.screens]), f = s((e, n, r, i, a) => {
|
|
6424
6743
|
let o = () => {
|
|
6425
|
-
let n =
|
|
6744
|
+
let n = Wc(a), i = u(r), o = n ? `Job ${n} queued` : "Running in background";
|
|
6426
6745
|
Z.success(`${e} started`, o, i ? { action: {
|
|
6427
6746
|
label: "View",
|
|
6428
6747
|
onClick: () => t(i)
|
|
@@ -6430,7 +6749,7 @@ function sc({ children: e }) {
|
|
|
6430
6749
|
};
|
|
6431
6750
|
switch (i.kind) {
|
|
6432
6751
|
case "success": {
|
|
6433
|
-
let t =
|
|
6752
|
+
let t = Lc(a), r = t ? { action: {
|
|
6434
6753
|
label: "Download",
|
|
6435
6754
|
onClick: () => {
|
|
6436
6755
|
ei(t.url, t.filename).catch((e) => {
|
|
@@ -6465,37 +6784,37 @@ function sc({ children: e }) {
|
|
|
6465
6784
|
}
|
|
6466
6785
|
if (t.kind !== "success" && t.kind !== "accepted") return;
|
|
6467
6786
|
e.onSuccess?.(n);
|
|
6468
|
-
let r =
|
|
6469
|
-
r && l(r),
|
|
6787
|
+
let r = Ic(n);
|
|
6788
|
+
r && l(r), Rc(n);
|
|
6470
6789
|
}, [m]), g = s((e) => {
|
|
6471
|
-
let t = e.action, n = e.
|
|
6472
|
-
return t?.resolved_params && t.resolved_params.length > 0 ? (i({
|
|
6473
|
-
id: Symbol(),
|
|
6474
|
-
opts: e,
|
|
6475
|
-
title: a,
|
|
6476
|
-
kind: "params",
|
|
6477
|
-
pending: !1
|
|
6478
|
-
}), Promise.resolve()) : n ? (i({
|
|
6479
|
-
id: Symbol(),
|
|
6480
|
-
opts: e,
|
|
6481
|
-
title: a,
|
|
6482
|
-
kind: "confirm",
|
|
6483
|
-
pending: !1
|
|
6484
|
-
}), Promise.resolve()) : (async (n) => {
|
|
6790
|
+
let t = e.action, n = e.longRunning ?? t?.long_running ?? !1, r = e.title || L(t?.display?.name) || "Action", a = async (i) => {
|
|
6485
6791
|
o((e) => e + 1);
|
|
6486
6792
|
try {
|
|
6487
|
-
let
|
|
6488
|
-
f(
|
|
6793
|
+
let a = await e.execute(i), o = Fc(a);
|
|
6794
|
+
f(r, n, t, o, a), h(e, o, a);
|
|
6489
6795
|
} catch (e) {
|
|
6490
|
-
f(
|
|
6796
|
+
f(r, n, t, zc(e));
|
|
6491
6797
|
} finally {
|
|
6492
6798
|
o((e) => Math.max(0, e - 1));
|
|
6493
6799
|
}
|
|
6494
|
-
}
|
|
6800
|
+
}, s = t ?? (e.destructive ? {
|
|
6801
|
+
display: {
|
|
6802
|
+
name: { en: r },
|
|
6803
|
+
icon: ""
|
|
6804
|
+
},
|
|
6805
|
+
destructive: !0
|
|
6806
|
+
} : void 0), c = !!(t?.resolved_params && t.resolved_params.length > 0), l = Ms(s);
|
|
6807
|
+
return s && (c || l) ? (i({
|
|
6808
|
+
id: Symbol(),
|
|
6809
|
+
opts: e,
|
|
6810
|
+
title: r,
|
|
6811
|
+
action: s,
|
|
6812
|
+
pending: !1
|
|
6813
|
+
}), Promise.resolve()) : a(Hc(e));
|
|
6495
6814
|
}, [f, h]), v = a > 0 || !!r?.pending, y = d(() => ({
|
|
6496
6815
|
run: g,
|
|
6497
6816
|
isRunning: v
|
|
6498
|
-
}), [g, v]), S = r?.
|
|
6817
|
+
}), [g, v]), S = r?.action, C = s(async (e) => {
|
|
6499
6818
|
if (!r) return;
|
|
6500
6819
|
let t = r.id, n = r, a = n.opts.action, s = n.opts.longRunning ?? a?.long_running ?? !1;
|
|
6501
6820
|
i((e) => e?.id === t ? {
|
|
@@ -6503,10 +6822,10 @@ function sc({ children: e }) {
|
|
|
6503
6822
|
pending: !0
|
|
6504
6823
|
} : e), o((e) => e + 1);
|
|
6505
6824
|
try {
|
|
6506
|
-
let r = await n.opts.execute(e), o =
|
|
6825
|
+
let r = await n.opts.execute(e), o = Fc(r);
|
|
6507
6826
|
f(n.title, s, a, o, r), h(n.opts, o, r), o.kind !== "partial" && i((e) => e?.id === t ? null : e);
|
|
6508
6827
|
} catch (e) {
|
|
6509
|
-
f(n.title, s, a,
|
|
6828
|
+
f(n.title, s, a, zc(e));
|
|
6510
6829
|
} finally {
|
|
6511
6830
|
o((e) => Math.max(0, e - 1)), i((e) => e?.id === t ? {
|
|
6512
6831
|
...e,
|
|
@@ -6518,16 +6837,16 @@ function sc({ children: e }) {
|
|
|
6518
6837
|
f,
|
|
6519
6838
|
h
|
|
6520
6839
|
]);
|
|
6521
|
-
return /* @__PURE__ */ x(
|
|
6840
|
+
return /* @__PURE__ */ x(Bc.Provider, {
|
|
6522
6841
|
value: y,
|
|
6523
6842
|
children: [
|
|
6524
6843
|
e,
|
|
6525
|
-
c && /* @__PURE__ */ b(
|
|
6844
|
+
c && /* @__PURE__ */ b(Nc, {
|
|
6526
6845
|
open: !0,
|
|
6527
6846
|
onClose: () => l(null),
|
|
6528
6847
|
display: c
|
|
6529
6848
|
}),
|
|
6530
|
-
r
|
|
6849
|
+
r && S && /* @__PURE__ */ b(Mc, {
|
|
6531
6850
|
open: !0,
|
|
6532
6851
|
onOpenChange: (e) => {
|
|
6533
6852
|
e || i(null);
|
|
@@ -6538,150 +6857,33 @@ function sc({ children: e }) {
|
|
|
6538
6857
|
isPending: r.pending,
|
|
6539
6858
|
bulkSelection: r.opts.bulkSelection,
|
|
6540
6859
|
row: r.opts.row
|
|
6541
|
-
}),
|
|
6542
|
-
r?.kind === "confirm" && /* @__PURE__ */ b(uc, {
|
|
6543
|
-
state: r,
|
|
6544
|
-
onClose: () => i(null),
|
|
6545
|
-
onExecute: async (e) => {
|
|
6546
|
-
let t = r.id, n = r, a = n.opts.action, s = n.opts.longRunning ?? a?.long_running ?? !1, c = !1;
|
|
6547
|
-
o((e) => e + 1);
|
|
6548
|
-
try {
|
|
6549
|
-
let t = await n.opts.execute(e), r = $s(t);
|
|
6550
|
-
f(n.title, s, a, r, t), h(n.opts, r, t), c = r.kind === "partial";
|
|
6551
|
-
} catch (e) {
|
|
6552
|
-
f(n.title, s, a, rc(e));
|
|
6553
|
-
} finally {
|
|
6554
|
-
o((e) => Math.max(0, e - 1)), c || i((e) => e?.id === t ? null : e);
|
|
6555
|
-
}
|
|
6556
|
-
}
|
|
6557
6860
|
})
|
|
6558
6861
|
]
|
|
6559
6862
|
});
|
|
6560
6863
|
}
|
|
6561
|
-
function
|
|
6562
|
-
return
|
|
6864
|
+
function Wc(e) {
|
|
6865
|
+
return Gc(e) ?? Gc(e?.result);
|
|
6563
6866
|
}
|
|
6564
|
-
function
|
|
6867
|
+
function Gc(e) {
|
|
6565
6868
|
if (!e || typeof e != "object") return;
|
|
6566
6869
|
let t = e, n = t.job_id ?? t.id;
|
|
6567
6870
|
return typeof n == "string" ? n : void 0;
|
|
6568
6871
|
}
|
|
6569
|
-
function uc({ state: e, onClose: n, onExecute: r }) {
|
|
6570
|
-
let { title: i, opts: a } = e, [o, s] = p(!1), c = a.action, l = a.destructive ?? c?.destructive ?? !1;
|
|
6571
|
-
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("div", {
|
|
6572
|
-
onClick: n,
|
|
6573
|
-
style: {
|
|
6574
|
-
position: "fixed",
|
|
6575
|
-
inset: 0,
|
|
6576
|
-
background: "var(--scrim)",
|
|
6577
|
-
zIndex: 60,
|
|
6578
|
-
backdropFilter: "blur(2px)"
|
|
6579
|
-
}
|
|
6580
|
-
}), /* @__PURE__ */ x("div", {
|
|
6581
|
-
style: {
|
|
6582
|
-
position: "fixed",
|
|
6583
|
-
top: "50%",
|
|
6584
|
-
left: "50%",
|
|
6585
|
-
transform: "translate(-50%, -50%)",
|
|
6586
|
-
zIndex: 61,
|
|
6587
|
-
width: 460,
|
|
6588
|
-
background: "var(--surface)",
|
|
6589
|
-
borderRadius: 12,
|
|
6590
|
-
boxShadow: "var(--shadow-lg)",
|
|
6591
|
-
border: "1px solid var(--border)",
|
|
6592
|
-
overflow: "hidden"
|
|
6593
|
-
},
|
|
6594
|
-
children: [/* @__PURE__ */ x("div", {
|
|
6595
|
-
style: {
|
|
6596
|
-
padding: "14px 18px 0",
|
|
6597
|
-
display: "flex",
|
|
6598
|
-
alignItems: "center",
|
|
6599
|
-
gap: 10
|
|
6600
|
-
},
|
|
6601
|
-
children: [
|
|
6602
|
-
/* @__PURE__ */ b("span", {
|
|
6603
|
-
style: {
|
|
6604
|
-
width: 28,
|
|
6605
|
-
height: 28,
|
|
6606
|
-
borderRadius: 7,
|
|
6607
|
-
background: l ? "var(--danger-soft)" : "var(--accent-soft)",
|
|
6608
|
-
color: l ? "var(--danger)" : "var(--accent)",
|
|
6609
|
-
display: "inline-flex",
|
|
6610
|
-
alignItems: "center",
|
|
6611
|
-
justifyContent: "center"
|
|
6612
|
-
},
|
|
6613
|
-
children: b(l ? t.trash : t.bolt, { size: 15 })
|
|
6614
|
-
}),
|
|
6615
|
-
/* @__PURE__ */ x("div", {
|
|
6616
|
-
style: { flex: 1 },
|
|
6617
|
-
children: [/* @__PURE__ */ b("div", {
|
|
6618
|
-
style: {
|
|
6619
|
-
fontSize: 14,
|
|
6620
|
-
fontWeight: 600,
|
|
6621
|
-
color: "var(--text)"
|
|
6622
|
-
},
|
|
6623
|
-
children: i
|
|
6624
|
-
}), /* @__PURE__ */ b("div", {
|
|
6625
|
-
style: {
|
|
6626
|
-
fontSize: 11.5,
|
|
6627
|
-
color: "var(--text-3)"
|
|
6628
|
-
},
|
|
6629
|
-
children: "This cannot be undone. Confirm to proceed."
|
|
6630
|
-
})]
|
|
6631
|
-
}),
|
|
6632
|
-
/* @__PURE__ */ b(O, {
|
|
6633
|
-
icon: /* @__PURE__ */ b(t.x, { size: 14 }),
|
|
6634
|
-
onClick: n
|
|
6635
|
-
})
|
|
6636
|
-
]
|
|
6637
|
-
}), /* @__PURE__ */ x("div", {
|
|
6638
|
-
style: {
|
|
6639
|
-
padding: "10px 16px",
|
|
6640
|
-
borderTop: "1px solid var(--divider)",
|
|
6641
|
-
display: "flex",
|
|
6642
|
-
alignItems: "center",
|
|
6643
|
-
gap: 8,
|
|
6644
|
-
background: "var(--surface-2)"
|
|
6645
|
-
},
|
|
6646
|
-
children: [
|
|
6647
|
-
/* @__PURE__ */ b("div", { style: { flex: 1 } }),
|
|
6648
|
-
/* @__PURE__ */ b(D, {
|
|
6649
|
-
onClick: n,
|
|
6650
|
-
children: "Cancel"
|
|
6651
|
-
}),
|
|
6652
|
-
/* @__PURE__ */ b(D, {
|
|
6653
|
-
kind: "primary",
|
|
6654
|
-
danger: l,
|
|
6655
|
-
icon: b(o ? Se : t.bolt, { size: 13 }),
|
|
6656
|
-
onClick: async () => {
|
|
6657
|
-
s(!0);
|
|
6658
|
-
try {
|
|
6659
|
-
await r(oc(a));
|
|
6660
|
-
} finally {
|
|
6661
|
-
s(!1);
|
|
6662
|
-
}
|
|
6663
|
-
},
|
|
6664
|
-
children: o ? "Executing…" : "Confirm"
|
|
6665
|
-
})
|
|
6666
|
-
]
|
|
6667
|
-
})]
|
|
6668
|
-
})] });
|
|
6669
|
-
}
|
|
6670
6872
|
//#endregion
|
|
6671
6873
|
//#region src/hooks/useCurrentScreen.tsx
|
|
6672
|
-
var
|
|
6673
|
-
function
|
|
6874
|
+
var Kc = i(void 0);
|
|
6875
|
+
function qc({ code: e, children: t }) {
|
|
6674
6876
|
let { data: n } = Y(), r = d(() => ({
|
|
6675
6877
|
code: e,
|
|
6676
6878
|
screen: n?.screens[e]
|
|
6677
6879
|
}), [e, n]);
|
|
6678
|
-
return /* @__PURE__ */ b(
|
|
6880
|
+
return /* @__PURE__ */ b(Kc.Provider, {
|
|
6679
6881
|
value: r,
|
|
6680
6882
|
children: t
|
|
6681
6883
|
});
|
|
6682
6884
|
}
|
|
6683
|
-
function
|
|
6684
|
-
return c(
|
|
6885
|
+
function Jc() {
|
|
6886
|
+
return c(Kc);
|
|
6685
6887
|
}
|
|
6686
6888
|
//#endregion
|
|
6687
|
-
export {
|
|
6889
|
+
export { ri as $, pe as $n, zt as $t, ms as A, Je as An, Jn as At, ba as B, Ne as Bn, Pn as Bt, Fs as C, Ve as Cn, Kn as Ct, Ks as D, tt as Dn, rr as Dt, vs as E, Ze as En, Zn as Et, Ta as F, I as Fn, Nn as Ft, Ni as G, Te as Gn, G as Gt, sa as H, Ie as Hn, Mn as Ht, Q as I, ze as In, Vn as It, Di as J, Se as Jn, hn as Jt, ji as K, P as Kn, q as Kt, ya as L, ke as Ln, zn as Lt, ls as M, R as Mn, Un as Mt, wa as N, We as Nn, Hn as Nt, ys as O, $e as On, sr as Ot, Ea as P, et as Pn, An as Pt, di as Q, ve as Qn, Rt as Qt, Sa as R, Ce as Rn, Bn as Rt, Os as S, Ge as Sn, Qn as St, Ps as T, L as Tn, lr as Tt, oa as U, F as Un, Rn as Ut, na as V, Re as Vn, jn as Vt, ta as W, Pe as Wn, Fn as Wt, Oi as X, be as Xn, gn as Xt, ki as Y, xe as Yn, _n as Yt, pi as Z, ue as Zn, Ft as Zt, Is as _, it as _n, tr as _t, _c as a, Dt as an, k as ar, Mr as at, bs as b, Ye as bn, Xn as bt, pc as c, yt as cn, jr as ct, dc as d, B as dn, wr as dt, kt as en, ye as er, ei as et, Qs as f, ct as fn, Tr as ft, Ns as g, rt as gn, $n as gt, qs as h, Be as hn, mr as ht, Vc as i, Ct as in, A as ir, Z as it, ds as j, nt as jn, Y as jt, Cs as k, Qe as kn, or as kt, fc as l, ht as ln, kr as lt, gs as m, lt as mn, Cr as mt, Jc as n, wt as nn, oe as nr, Zr as nt, vc as o, _t as on, O as or, Pr as ot, _s as p, st as pn, Sr as pt, Ai as q, Le as qn, J as qt, Uc as r, St as rn, j as rr, Jr as rt, Cc as s, vt as sn, D as sr, Nr as st, qc as t, Ot as tn, se as tr, $r as tt, oc as u, mt as un, Er as ut, Xs as v, at as vn, qn as vt, Ds as w, z as wn, Gn as wt, Gs as x, Xe as xn, cr as xt, Ys as y, qe as yn, Yn as yt, ua as z, Fe as zn, Ln as zt };
|