ding-react-admin 2.5.0 → 2.5.2
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/index.js +524 -520
- package/dist/src/crud/fields/ReferenceField.d.ts.map +1 -1
- package/dist/src/layouts/AdminLayout.d.ts.map +1 -1
- package/dist/src/layouts/navFilter.d.ts +2 -0
- package/dist/src/layouts/navFilter.d.ts.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/crud/fields/FileField.tsx +1 -1
- package/src/crud/fields/ImageField.tsx +1 -1
- package/src/crud/fields/ReferenceField.tsx +5 -3
- package/src/crud/fields/ReferenceManyField.tsx +2 -2
- package/src/crud/fields/SelectField.tsx +1 -1
- package/src/crud/filters/ReferenceFilter.tsx +1 -1
- package/src/layouts/AdminLayout.tsx +2 -1
- package/src/layouts/navFilter.ts +6 -1
- package/src/layouts/navMenuItems.tsx +2 -2
- package/src/types.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -314,15 +314,18 @@ function bt(e, t) {
|
|
|
314
314
|
}) : [];
|
|
315
315
|
}
|
|
316
316
|
function xt(e) {
|
|
317
|
+
return `${e}__submenu`;
|
|
318
|
+
}
|
|
319
|
+
function St(e) {
|
|
317
320
|
let t = [];
|
|
318
321
|
function n(e) {
|
|
319
|
-
for (let r of e) r.children?.length && (t.push(r.path), n(r.children));
|
|
322
|
+
for (let r of e) r.children?.length && (t.push(xt(r.path)), n(r.children));
|
|
320
323
|
}
|
|
321
324
|
return n(e), t;
|
|
322
325
|
}
|
|
323
326
|
//#endregion
|
|
324
327
|
//#region src/components/NavMenuLabel.tsx
|
|
325
|
-
function
|
|
328
|
+
function Ct({ label: e, title: t }) {
|
|
326
329
|
return t ? /* @__PURE__ */ J(W, {
|
|
327
330
|
title: t,
|
|
328
331
|
placement: "right",
|
|
@@ -339,22 +342,22 @@ function St({ label: e, title: t }) {
|
|
|
339
342
|
}
|
|
340
343
|
//#endregion
|
|
341
344
|
//#region src/layouts/navMenuItems.tsx
|
|
342
|
-
function
|
|
345
|
+
function wt(e, t) {
|
|
343
346
|
let n = t?.showLabelTooltip !== !1, r = t?.wrapLabels === !0, i = t?.collapsed === !0;
|
|
344
347
|
return e.map((e) => {
|
|
345
|
-
let a = e.Icon, o = a ? /* @__PURE__ */ J(a, {}) : void 0, s = _t(e), c = s && n ? /* @__PURE__ */ J(
|
|
348
|
+
let a = e.Icon, o = a ? /* @__PURE__ */ J(a, {}) : void 0, s = _t(e), c = s && n ? /* @__PURE__ */ J(Ct, {
|
|
346
349
|
label: e.label,
|
|
347
350
|
title: s
|
|
348
|
-
}) : r ? /* @__PURE__ */ J(
|
|
351
|
+
}) : r ? /* @__PURE__ */ J(Ct, {
|
|
349
352
|
label: e.label,
|
|
350
353
|
title: ""
|
|
351
354
|
}) : e.label, l = i && s ? { title: s } : {};
|
|
352
355
|
return e.children?.length ? {
|
|
353
|
-
key: e.path,
|
|
356
|
+
key: xt(e.path),
|
|
354
357
|
icon: o,
|
|
355
358
|
label: c,
|
|
356
359
|
...l,
|
|
357
|
-
children:
|
|
360
|
+
children: wt(e.children, t)
|
|
358
361
|
} : {
|
|
359
362
|
key: e.path,
|
|
360
363
|
icon: o,
|
|
@@ -370,10 +373,10 @@ function Z(e, t, n) {
|
|
|
370
373
|
let r = t[n];
|
|
371
374
|
return n === "read" && !r && (r = t.list), r ? e(r) : !1;
|
|
372
375
|
}
|
|
373
|
-
function
|
|
376
|
+
function Tt(e, t) {
|
|
374
377
|
return e.map((e) => {
|
|
375
378
|
if (e.children?.length) {
|
|
376
|
-
let n =
|
|
379
|
+
let n = Tt(e.children, t);
|
|
377
380
|
return n.length === 0 ? null : {
|
|
378
381
|
...e,
|
|
379
382
|
children: n
|
|
@@ -384,39 +387,39 @@ function wt(e, t) {
|
|
|
384
387
|
}
|
|
385
388
|
//#endregion
|
|
386
389
|
//#region src/layouts/AdminLayout.tsx
|
|
387
|
-
var
|
|
388
|
-
function
|
|
390
|
+
var Et = "#001529", Dt = "ding-react-admin-sider-collapsed";
|
|
391
|
+
function Ot(e) {
|
|
389
392
|
try {
|
|
390
393
|
return localStorage.getItem(e) === "1";
|
|
391
394
|
} catch {
|
|
392
395
|
return !1;
|
|
393
396
|
}
|
|
394
397
|
}
|
|
395
|
-
function
|
|
398
|
+
function kt() {
|
|
396
399
|
return N.useBreakpoint().lg !== !0;
|
|
397
400
|
}
|
|
398
|
-
function
|
|
401
|
+
function At(e) {
|
|
399
402
|
let t = /* @__PURE__ */ new Set();
|
|
400
403
|
function n(e) {
|
|
401
404
|
for (let r of e) r.children?.length ? n(r.children) : t.add(r.path);
|
|
402
405
|
}
|
|
403
406
|
return n(e), t;
|
|
404
407
|
}
|
|
405
|
-
function
|
|
408
|
+
function jt(e, t) {
|
|
406
409
|
function n(e) {
|
|
407
410
|
for (let r of e) if (r.children?.length) {
|
|
408
411
|
let e = n(r.children);
|
|
409
|
-
if (e !== null) return [r.path, ...e];
|
|
412
|
+
if (e !== null) return [xt(r.path), ...e];
|
|
410
413
|
} else if (r.path === t) return [];
|
|
411
414
|
return null;
|
|
412
415
|
}
|
|
413
416
|
return n(e) ?? [];
|
|
414
417
|
}
|
|
415
|
-
function
|
|
418
|
+
function Mt({ wrapLabels: e, itemDivider: t = "none" }) {
|
|
416
419
|
let n = ["ding-admin-nav-menu"];
|
|
417
420
|
return e && n.push("ding-admin-nav-menu--wrap-labels"), t === "full" ? n.push("ding-admin-nav-menu--item-divider-full") : t === "inset" && n.push("ding-admin-nav-menu--item-divider-inset"), n.join(" ");
|
|
418
421
|
}
|
|
419
|
-
function
|
|
422
|
+
function Nt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, onOpenChange: i, onNavigate: a, navQuery: o, onNavQueryChange: s, showNavSearch: c, navSearchPlaceholder: l, scrollVariant: u, searchVariant: d, wrapLabels: f, itemDivider: p }) {
|
|
420
423
|
return /* @__PURE__ */ Y(q, { children: [c && !n ? /* @__PURE__ */ J(rt, {
|
|
421
424
|
value: o,
|
|
422
425
|
onChange: s,
|
|
@@ -430,7 +433,7 @@ function Mt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
430
433
|
overflowY: "auto",
|
|
431
434
|
overflowX: "hidden"
|
|
432
435
|
},
|
|
433
|
-
children: /* @__PURE__ */ J(
|
|
436
|
+
children: /* @__PURE__ */ J(Pt, {
|
|
434
437
|
menuItems: e,
|
|
435
438
|
selectedKeys: t,
|
|
436
439
|
inlineCollapsed: n,
|
|
@@ -442,9 +445,9 @@ function Mt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
442
445
|
})
|
|
443
446
|
})] });
|
|
444
447
|
}
|
|
445
|
-
function
|
|
448
|
+
function Pt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, onOpenChange: i, onNavigate: a, wrapLabels: o, itemDivider: s }) {
|
|
446
449
|
return /* @__PURE__ */ J(R, {
|
|
447
|
-
className:
|
|
450
|
+
className: Mt({
|
|
448
451
|
wrapLabels: o,
|
|
449
452
|
itemDivider: s
|
|
450
453
|
}),
|
|
@@ -468,8 +471,8 @@ function Nt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
468
471
|
}
|
|
469
472
|
});
|
|
470
473
|
}
|
|
471
|
-
function
|
|
472
|
-
let b = v(), x = _(), { resolved: S } = Ze(), T = S === "dark", { logout: E, userLabel: D } = lt(), O = mt(), [j, M] = d(() =>
|
|
474
|
+
function Ft({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDrawerTitle: r, headerExtras: i, userMenuItems: o, onUserMenuClick: c, loginPath: f = "/login", siderCollapsedStorageKey: p = Dt, navSearch: h = !0, navMenu: g, hideSider: y = !1 }) {
|
|
475
|
+
let b = v(), x = _(), { resolved: S } = Ze(), T = S === "dark", { logout: E, userLabel: D } = lt(), O = mt(), [j, M] = d(() => Ot(p)), [N, P] = d(!1), F = kt(), { token: I } = K.useToken(), ee = u(null), [R, te] = d(""), ne = h !== !1, re = typeof h == "object" ? h.placeholder : void 0, z = g?.wrapLabels !== !1, ie = g?.itemDivider ?? "inset", B = r ?? t, V = () => {
|
|
473
476
|
E(), b(f, { replace: !0 });
|
|
474
477
|
}, ae = a((e) => {
|
|
475
478
|
M(e);
|
|
@@ -489,11 +492,11 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
489
492
|
}, [x.pathname]), s(() => {
|
|
490
493
|
j && te("");
|
|
491
494
|
}, [j]);
|
|
492
|
-
let H = l(() =>
|
|
495
|
+
let H = l(() => Tt(e, O), [e, O]), oe = R.trim(), se = oe.length > 0, U = l(() => se ? vt(H, oe) : H, [
|
|
493
496
|
H,
|
|
494
497
|
oe,
|
|
495
498
|
se
|
|
496
|
-
]), ce = l(() =>
|
|
499
|
+
]), ce = l(() => At(U), [U]), W = l(() => wt(U, {
|
|
497
500
|
showLabelTooltip: !j && !z,
|
|
498
501
|
wrapLabels: z && !j,
|
|
499
502
|
collapsed: j
|
|
@@ -501,7 +504,7 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
501
504
|
U,
|
|
502
505
|
j,
|
|
503
506
|
z
|
|
504
|
-
]), q = l(() =>
|
|
507
|
+
]), q = l(() => St(U), [U]), le = l(() => jt(H, x.pathname), [H, x.pathname]), [ue, de] = d(() => jt(H, x.pathname));
|
|
505
508
|
s(() => {
|
|
506
509
|
de((e) => [...new Set([...e, ...le])]);
|
|
507
510
|
}, [le]);
|
|
@@ -520,7 +523,7 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
520
523
|
return;
|
|
521
524
|
}
|
|
522
525
|
e.key === "logout" && V();
|
|
523
|
-
}, be = T ? I.colorBgContainer :
|
|
526
|
+
}, be = T ? I.colorBgContainer : Et, xe = T ? "default" : "on-dark", Se = T ? "app" : "on-dark", Ce = [x.pathname], X = (e) => {
|
|
524
527
|
ce.has(e) && (b(e), F && P(!1));
|
|
525
528
|
};
|
|
526
529
|
return /* @__PURE__ */ Y(L, {
|
|
@@ -563,7 +566,7 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
563
566
|
style: { color: I.colorTextLightSolid },
|
|
564
567
|
children: j ? n : t
|
|
565
568
|
})
|
|
566
|
-
}), /* @__PURE__ */ J(
|
|
569
|
+
}), /* @__PURE__ */ J(Nt, {
|
|
567
570
|
menuItems: W,
|
|
568
571
|
selectedKeys: Ce,
|
|
569
572
|
inlineCollapsed: j,
|
|
@@ -609,7 +612,7 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
609
612
|
height: "100%",
|
|
610
613
|
overflow: "hidden"
|
|
611
614
|
},
|
|
612
|
-
children: /* @__PURE__ */ J(
|
|
615
|
+
children: /* @__PURE__ */ J(Nt, {
|
|
613
616
|
menuItems: W,
|
|
614
617
|
selectedKeys: Ce,
|
|
615
618
|
inlineCollapsed: !1,
|
|
@@ -712,30 +715,30 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
712
715
|
}
|
|
713
716
|
//#endregion
|
|
714
717
|
//#region src/router/guards.tsx
|
|
715
|
-
function
|
|
718
|
+
function It({ when: e, redirect: t, children: n }) {
|
|
716
719
|
return e ? n : /* @__PURE__ */ J(p, {
|
|
717
720
|
to: t,
|
|
718
721
|
replace: !0
|
|
719
722
|
});
|
|
720
723
|
}
|
|
721
|
-
function
|
|
724
|
+
function Lt({ children: e, redirectTo: t = "/login" }) {
|
|
722
725
|
let { isAuthenticated: n } = lt();
|
|
723
|
-
return /* @__PURE__ */ J(
|
|
726
|
+
return /* @__PURE__ */ J(It, {
|
|
724
727
|
when: n,
|
|
725
728
|
redirect: t,
|
|
726
729
|
children: e
|
|
727
730
|
});
|
|
728
731
|
}
|
|
729
|
-
function
|
|
732
|
+
function Rt({ children: e, redirectTo: t = "/" }) {
|
|
730
733
|
let { isAuthenticated: n } = lt();
|
|
731
|
-
return /* @__PURE__ */ J(
|
|
734
|
+
return /* @__PURE__ */ J(It, {
|
|
732
735
|
when: !n,
|
|
733
736
|
redirect: t,
|
|
734
737
|
children: e
|
|
735
738
|
});
|
|
736
739
|
}
|
|
737
|
-
function
|
|
738
|
-
return /* @__PURE__ */ J(
|
|
740
|
+
function zt({ permission: e, redirect: t, children: n }) {
|
|
741
|
+
return /* @__PURE__ */ J(It, {
|
|
739
742
|
when: mt()(e),
|
|
740
743
|
redirect: t,
|
|
741
744
|
children: n
|
|
@@ -743,13 +746,13 @@ function Rt({ permission: e, redirect: t, children: n }) {
|
|
|
743
746
|
}
|
|
744
747
|
//#endregion
|
|
745
748
|
//#region src/router/routeAccess.ts
|
|
746
|
-
function
|
|
749
|
+
function Bt(e) {
|
|
747
750
|
return e.access ?? "protected";
|
|
748
751
|
}
|
|
749
|
-
function
|
|
752
|
+
function Vt(e) {
|
|
750
753
|
let t = [], n = [], r = [];
|
|
751
754
|
for (let i of e) {
|
|
752
|
-
let e =
|
|
755
|
+
let e = Bt(i);
|
|
753
756
|
e === "guest" ? t.push(i) : e === "public" ? n.push(i) : r.push(i);
|
|
754
757
|
}
|
|
755
758
|
return {
|
|
@@ -758,24 +761,24 @@ function Bt(e) {
|
|
|
758
761
|
protected: r
|
|
759
762
|
};
|
|
760
763
|
}
|
|
761
|
-
function
|
|
764
|
+
function Ht(e) {
|
|
762
765
|
return e.replace(/^\/+/, "");
|
|
763
766
|
}
|
|
764
|
-
function
|
|
765
|
-
return `/${
|
|
767
|
+
function Ut(e) {
|
|
768
|
+
return `/${Ht(e)}`;
|
|
766
769
|
}
|
|
767
|
-
function
|
|
768
|
-
let { guest: n, protected: r } =
|
|
769
|
-
!s && i && "path" in i && i.path && (s =
|
|
770
|
+
function Wt(e, t) {
|
|
771
|
+
let { guest: n, protected: r } = Vt(e), i = n.find((e) => "path" in e && e.path), a = r.find((e) => "index" in e && e.index), o = r.find((e) => "path" in e && e.path), s = t?.unauthenticated;
|
|
772
|
+
!s && i && "path" in i && i.path && (s = Ut(i.path));
|
|
770
773
|
let c = t?.afterLogin;
|
|
771
|
-
if (c || (a ? c = "/" : o && "path" in o && o.path && (c =
|
|
774
|
+
if (c || (a ? c = "/" : o && "path" in o && o.path && (c = Ut(o.path))), r.length > 0 && !s) throw Error("createAdminRouter: protected routes require redirects.unauthenticated or a guest route (access: \"guest\").");
|
|
772
775
|
if (n.length > 0 && !c) throw Error("createAdminRouter: guest routes require redirects.afterLogin or a protected route (index or path).");
|
|
773
776
|
return {
|
|
774
777
|
loginPath: s ?? "/",
|
|
775
778
|
homePath: c ?? "/"
|
|
776
779
|
};
|
|
777
780
|
}
|
|
778
|
-
function
|
|
781
|
+
function Gt(e) {
|
|
779
782
|
return "index" in e && e.index ? {
|
|
780
783
|
index: !0,
|
|
781
784
|
element: e.element
|
|
@@ -786,30 +789,30 @@ function Wt(e) {
|
|
|
786
789
|
}
|
|
787
790
|
//#endregion
|
|
788
791
|
//#region src/router/createAdminRouter.tsx
|
|
789
|
-
function
|
|
790
|
-
let { loginPath: i, homePath: a } =
|
|
792
|
+
function Kt({ navItems: e, children: t, layoutProps: n, redirects: r }) {
|
|
793
|
+
let { loginPath: i, homePath: a } = Wt(t, r), { guest: o, public: s, protected: c } = Vt(t), l = [];
|
|
791
794
|
for (let e of o) !("path" in e) || !e.path || l.push({
|
|
792
|
-
path:
|
|
793
|
-
element: /* @__PURE__ */ J(
|
|
795
|
+
path: Ht(e.path),
|
|
796
|
+
element: /* @__PURE__ */ J(Rt, {
|
|
794
797
|
redirectTo: a,
|
|
795
798
|
children: e.element
|
|
796
799
|
})
|
|
797
800
|
});
|
|
798
801
|
for (let e of s) !("path" in e) || !e.path || l.push({
|
|
799
|
-
path:
|
|
802
|
+
path: Ht(e.path),
|
|
800
803
|
element: e.element
|
|
801
804
|
});
|
|
802
805
|
return c.length > 0 && l.push({
|
|
803
806
|
path: "/",
|
|
804
|
-
element: /* @__PURE__ */ J(
|
|
807
|
+
element: /* @__PURE__ */ J(Lt, {
|
|
805
808
|
redirectTo: i,
|
|
806
|
-
children: /* @__PURE__ */ J(
|
|
809
|
+
children: /* @__PURE__ */ J(Ft, {
|
|
807
810
|
navItems: e,
|
|
808
811
|
loginPath: i,
|
|
809
812
|
...n
|
|
810
813
|
})
|
|
811
814
|
}),
|
|
812
|
-
children: c.map(
|
|
815
|
+
children: c.map(Gt)
|
|
813
816
|
}), l.push({
|
|
814
817
|
path: "*",
|
|
815
818
|
element: /* @__PURE__ */ J(p, {
|
|
@@ -820,8 +823,8 @@ function Gt({ navItems: e, children: t, layoutProps: n, redirects: r }) {
|
|
|
820
823
|
}
|
|
821
824
|
//#endregion
|
|
822
825
|
//#region src/app/AdminApp.tsx
|
|
823
|
-
function
|
|
824
|
-
let a = l(() =>
|
|
826
|
+
function qt({ navItems: e, routes: t, authRedirects: n, layoutProps: r, theme: i }) {
|
|
827
|
+
let a = l(() => Kt({
|
|
825
828
|
navItems: e,
|
|
826
829
|
children: t,
|
|
827
830
|
layoutProps: r,
|
|
@@ -839,67 +842,67 @@ function Kt({ navItems: e, routes: t, authRedirects: n, layoutProps: r, theme: i
|
|
|
839
842
|
}
|
|
840
843
|
//#endregion
|
|
841
844
|
//#region src/context/DataProvider.tsx
|
|
842
|
-
var
|
|
843
|
-
function
|
|
845
|
+
var Jt = t(null);
|
|
846
|
+
function Yt({ children: e, value: t }) {
|
|
844
847
|
let n = l(() => t, [t]);
|
|
845
|
-
return /* @__PURE__ */ J(
|
|
848
|
+
return /* @__PURE__ */ J(Jt.Provider, {
|
|
846
849
|
value: n,
|
|
847
850
|
children: e
|
|
848
851
|
});
|
|
849
852
|
}
|
|
850
|
-
function
|
|
851
|
-
let e = o(
|
|
853
|
+
function Xt() {
|
|
854
|
+
let e = o(Jt);
|
|
852
855
|
if (!e) throw Error("useDataProvider must be used within DataProvider");
|
|
853
856
|
return e;
|
|
854
857
|
}
|
|
855
858
|
//#endregion
|
|
856
859
|
//#region src/data/resourceHandlers.ts
|
|
857
|
-
function
|
|
860
|
+
function Zt(e) {
|
|
858
861
|
return "handlers" in e ? e : { handlers: e };
|
|
859
862
|
}
|
|
860
|
-
function
|
|
863
|
+
function Qt(e, t, n) {
|
|
861
864
|
if (!(!e || !t) && !Z(e, t, n)) throw Error("Forbidden");
|
|
862
865
|
}
|
|
863
|
-
function
|
|
866
|
+
function $t(e, t) {
|
|
864
867
|
let { can: n, guard: r, parseFormError: i } = t ?? {}, a = (t) => {
|
|
865
868
|
let n = e[t];
|
|
866
869
|
if (!n) throw Error(`Unknown resource: ${t}`);
|
|
867
|
-
return
|
|
870
|
+
return Zt(n);
|
|
868
871
|
};
|
|
869
872
|
return {
|
|
870
873
|
async getList(e, t) {
|
|
871
874
|
let { handlers: i, permissions: o } = a(e);
|
|
872
|
-
return r?.(e, "list"),
|
|
875
|
+
return r?.(e, "list"), Qt(n, o, "list"), i.getList(t);
|
|
873
876
|
},
|
|
874
877
|
async getOne(e, t, i) {
|
|
875
878
|
let { handlers: o, permissions: s } = a(e);
|
|
876
|
-
return r?.(e, "read"),
|
|
879
|
+
return r?.(e, "read"), Qt(n, s, "read"), o.getOne(t, i);
|
|
877
880
|
},
|
|
878
881
|
async create(e, t) {
|
|
879
882
|
let { handlers: i, permissions: o } = a(e);
|
|
880
|
-
return r?.(e, "add"),
|
|
883
|
+
return r?.(e, "add"), Qt(n, o, "add"), i.create(t);
|
|
881
884
|
},
|
|
882
885
|
async update(e, t) {
|
|
883
886
|
let { handlers: i, permissions: o } = a(e);
|
|
884
|
-
return r?.(e, "change"),
|
|
887
|
+
return r?.(e, "change"), Qt(n, o, "change"), i.update(t);
|
|
885
888
|
},
|
|
886
889
|
async delete(e, t) {
|
|
887
890
|
let { handlers: i, permissions: o } = a(e);
|
|
888
|
-
return r?.(e, "delete"),
|
|
891
|
+
return r?.(e, "delete"), Qt(n, o, "delete"), i.delete(t);
|
|
889
892
|
},
|
|
890
893
|
parseFormError: i
|
|
891
894
|
};
|
|
892
895
|
}
|
|
893
896
|
//#endregion
|
|
894
897
|
//#region src/data/abortError.ts
|
|
895
|
-
function
|
|
898
|
+
function en(e) {
|
|
896
899
|
if (typeof e != "object" || !e) return !1;
|
|
897
900
|
let t = e;
|
|
898
901
|
return t.name === "AbortError" || t.name === "CanceledError" || t.code === "ERR_CANCELED";
|
|
899
902
|
}
|
|
900
903
|
//#endregion
|
|
901
904
|
//#region src/data/parseFormErrorHelpers.ts
|
|
902
|
-
var
|
|
905
|
+
var tn = "Expected HTTP 400 with a JSON object such as `{ \"field_name\": [\"message\"] }` or `{ \"non_field_errors\": [\"message\"] }`.", nn = 300;
|
|
903
906
|
function Q(e) {
|
|
904
907
|
if (typeof e == "string") return [e];
|
|
905
908
|
if (Array.isArray(e)) {
|
|
@@ -908,136 +911,136 @@ function Q(e) {
|
|
|
908
911
|
}
|
|
909
912
|
return [];
|
|
910
913
|
}
|
|
911
|
-
function
|
|
914
|
+
function rn(e) {
|
|
912
915
|
return e.length === 1 ? e[0] : e;
|
|
913
916
|
}
|
|
914
|
-
function
|
|
917
|
+
function an(e) {
|
|
915
918
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
916
919
|
}
|
|
917
|
-
function
|
|
920
|
+
function on(e) {
|
|
918
921
|
return typeof Response < "u" && e instanceof Response ? !0 : typeof e == "object" && !!e && typeof e.json == "function" && typeof e.status == "number" && e.headers != null;
|
|
919
922
|
}
|
|
920
|
-
function
|
|
923
|
+
function sn(e, t) {
|
|
921
924
|
if (t) return t;
|
|
922
925
|
if (e === null) return "(no JSON body)";
|
|
923
926
|
try {
|
|
924
927
|
let t = JSON.stringify(e);
|
|
925
|
-
return t.length >
|
|
928
|
+
return t.length > nn ? `${t.slice(0, nn)}…` : t;
|
|
926
929
|
} catch {
|
|
927
930
|
return String(e);
|
|
928
931
|
}
|
|
929
932
|
}
|
|
930
|
-
function
|
|
931
|
-
return `Non-standard validation response. ${
|
|
933
|
+
function cn(e, t) {
|
|
934
|
+
return `Non-standard validation response. ${tn} Received: ${sn(e, t?.hint)}`;
|
|
932
935
|
}
|
|
933
|
-
function
|
|
936
|
+
function ln(e) {
|
|
934
937
|
if (!e || typeof e != "object") return null;
|
|
935
938
|
let t = e.response;
|
|
936
939
|
if (!t || typeof t != "object") return null;
|
|
937
940
|
let n = t.status;
|
|
938
941
|
return typeof n == "number" && (n === 400 || n === 422) ? n : null;
|
|
939
942
|
}
|
|
940
|
-
function
|
|
943
|
+
function un(e) {
|
|
941
944
|
if (!e || typeof e != "object") return null;
|
|
942
945
|
let t = e.response;
|
|
943
|
-
return
|
|
946
|
+
return on(t) ? t.headers.get("content-type") : null;
|
|
944
947
|
}
|
|
945
|
-
function
|
|
948
|
+
function dn(e) {
|
|
946
949
|
if (!e || typeof e != "object") return null;
|
|
947
950
|
let t = e;
|
|
948
|
-
if (
|
|
949
|
-
if (
|
|
951
|
+
if (an(t.body)) return t.body;
|
|
952
|
+
if (an(t.data)) return t.data;
|
|
950
953
|
let n = t.response;
|
|
951
954
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
952
955
|
let e = n.data;
|
|
953
|
-
if (
|
|
956
|
+
if (an(e)) return e;
|
|
954
957
|
}
|
|
955
958
|
return null;
|
|
956
959
|
}
|
|
957
|
-
function
|
|
958
|
-
if (
|
|
960
|
+
function fn(e) {
|
|
961
|
+
if (an(e)) return e;
|
|
959
962
|
if (Array.isArray(e)) {
|
|
960
963
|
let t = Q(e);
|
|
961
|
-
return t.length ? { non_field_errors:
|
|
964
|
+
return t.length ? { non_field_errors: rn(t) } : null;
|
|
962
965
|
}
|
|
963
966
|
return null;
|
|
964
967
|
}
|
|
965
|
-
async function
|
|
966
|
-
let t =
|
|
968
|
+
async function pn(e) {
|
|
969
|
+
let t = dn(e);
|
|
967
970
|
if (t) return t;
|
|
968
971
|
if (!e || typeof e != "object") return null;
|
|
969
972
|
let n = e.response;
|
|
970
|
-
if (!
|
|
973
|
+
if (!on(n)) return null;
|
|
971
974
|
let r = n.headers.get("content-type");
|
|
972
975
|
if (!r || !/application\/json/i.test(r)) return null;
|
|
973
976
|
try {
|
|
974
|
-
return
|
|
977
|
+
return fn(await n.clone().json());
|
|
975
978
|
} catch {
|
|
976
979
|
return null;
|
|
977
980
|
}
|
|
978
981
|
}
|
|
979
|
-
function
|
|
982
|
+
function mn(e) {
|
|
980
983
|
return Array.isArray(e) ? e.some((e) => e && typeof e == "object" && !Array.isArray(e) && Object.values(e).some((e) => Q(e).length > 0)) : !1;
|
|
981
984
|
}
|
|
982
|
-
function
|
|
985
|
+
function hn(e, t, n) {
|
|
983
986
|
t.forEach((t, r) => {
|
|
984
987
|
if (!(!t || typeof t != "object" || Array.isArray(t))) for (let [i, a] of Object.entries(t)) {
|
|
985
988
|
let t = Q(a);
|
|
986
|
-
t.length && (n[`${e}.${r}.${i}`] =
|
|
989
|
+
t.length && (n[`${e}.${r}.${i}`] = rn(t));
|
|
987
990
|
}
|
|
988
991
|
});
|
|
989
992
|
}
|
|
990
|
-
function
|
|
993
|
+
function gn(e, t) {
|
|
991
994
|
return {
|
|
992
995
|
fields: Object.keys(e).length ? e : void 0,
|
|
993
996
|
global: t.length ? t : void 0
|
|
994
997
|
};
|
|
995
998
|
}
|
|
996
|
-
var
|
|
997
|
-
function
|
|
999
|
+
var _n = new Set(["non_field_errors", "detail"]);
|
|
1000
|
+
function vn(e) {
|
|
998
1001
|
let t = {}, n = [];
|
|
999
1002
|
for (let [r, i] of Object.entries(e)) {
|
|
1000
|
-
if (
|
|
1003
|
+
if (_n.has(r)) {
|
|
1001
1004
|
n.push(...Q(i));
|
|
1002
1005
|
continue;
|
|
1003
1006
|
}
|
|
1004
|
-
if (
|
|
1005
|
-
|
|
1007
|
+
if (mn(i)) {
|
|
1008
|
+
hn(r, i, t);
|
|
1006
1009
|
continue;
|
|
1007
1010
|
}
|
|
1008
1011
|
let e = Q(i);
|
|
1009
|
-
e.length && (t[r] =
|
|
1012
|
+
e.length && (t[r] = rn(e));
|
|
1010
1013
|
}
|
|
1011
|
-
return !Object.keys(t).length && !n.length ? null :
|
|
1014
|
+
return !Object.keys(t).length && !n.length ? null : gn(t, n);
|
|
1012
1015
|
}
|
|
1013
|
-
function
|
|
1014
|
-
let n =
|
|
1015
|
-
return n ?
|
|
1016
|
+
function yn(e, t) {
|
|
1017
|
+
let n = dn(e);
|
|
1018
|
+
return n ? vn(n) : null;
|
|
1016
1019
|
}
|
|
1017
|
-
function
|
|
1018
|
-
let r =
|
|
1020
|
+
function bn(e, t, n) {
|
|
1021
|
+
let r = dn(e);
|
|
1019
1022
|
if (!r) return null;
|
|
1020
1023
|
let i = n?.camelCase ?? !0, a = n?.fieldMap, o = {}, s = [];
|
|
1021
1024
|
n?.includeSummary && (s.push(...Q(r.title)), s.push(...Q(r.message)));
|
|
1022
1025
|
let c = r.errors;
|
|
1023
1026
|
if (c && typeof c == "object" && !Array.isArray(c)) for (let [e, t] of Object.entries(c)) {
|
|
1024
|
-
let n = a?.[e] ?? (i ?
|
|
1025
|
-
r.length && (o[n] =
|
|
1027
|
+
let n = a?.[e] ?? (i ? Cn(e) : e), r = Q(t);
|
|
1028
|
+
r.length && (o[n] = rn(r));
|
|
1026
1029
|
}
|
|
1027
|
-
return !Object.keys(o).length && !s.length ? null :
|
|
1030
|
+
return !Object.keys(o).length && !s.length ? null : gn(o, s);
|
|
1028
1031
|
}
|
|
1029
|
-
function
|
|
1030
|
-
let r =
|
|
1032
|
+
function xn(e, t, n) {
|
|
1033
|
+
let r = dn(e);
|
|
1031
1034
|
if (!r) return null;
|
|
1032
1035
|
let i = {}, a = [], o = n?.fieldMap, s = r.errors;
|
|
1033
1036
|
if (Array.isArray(s)) for (let e of s) {
|
|
1034
1037
|
if (!e || typeof e != "object") continue;
|
|
1035
1038
|
let t = e, n = typeof t.path == "string" && t.path || typeof t.param == "string" && t.param || typeof t.field == "string" && t.field, r = Q(t.msg)[0] ?? Q(t.message)[0];
|
|
1036
|
-
r && (n ?
|
|
1039
|
+
r && (n ? Sn(i, o?.[n] ?? n, r) : a.push(r));
|
|
1037
1040
|
}
|
|
1038
1041
|
else if (s && typeof s == "object") for (let [e, t] of Object.entries(s)) {
|
|
1039
1042
|
let n = o?.[e] ?? e, r = Q(t);
|
|
1040
|
-
r.length && (i[n] =
|
|
1043
|
+
r.length && (i[n] = rn(r));
|
|
1041
1044
|
}
|
|
1042
1045
|
let c = r.details;
|
|
1043
1046
|
if (Array.isArray(c)) for (let e of c) {
|
|
@@ -1048,9 +1051,9 @@ function bn(e, t, n) {
|
|
|
1048
1051
|
i[e] = r;
|
|
1049
1052
|
} else a.push(r);
|
|
1050
1053
|
}
|
|
1051
|
-
return a.push(...Q(r.error)), !Object.keys(i).length && !a.length ? null :
|
|
1054
|
+
return a.push(...Q(r.error)), !Object.keys(i).length && !a.length ? null : gn(i, a);
|
|
1052
1055
|
}
|
|
1053
|
-
function
|
|
1056
|
+
function Sn(e, t, n) {
|
|
1054
1057
|
let r = e[t];
|
|
1055
1058
|
if (!r) {
|
|
1056
1059
|
e[t] = n;
|
|
@@ -1058,20 +1061,20 @@ function xn(e, t, n) {
|
|
|
1058
1061
|
}
|
|
1059
1062
|
e[t] = Array.isArray(r) ? [...r, n] : [r, n];
|
|
1060
1063
|
}
|
|
1061
|
-
function
|
|
1064
|
+
function Cn(e) {
|
|
1062
1065
|
return e && e.charAt(0).toLowerCase() + e.slice(1);
|
|
1063
1066
|
}
|
|
1064
1067
|
//#endregion
|
|
1065
1068
|
//#region src/data/inMemoryList.ts
|
|
1066
|
-
function
|
|
1069
|
+
function wn(e, t) {
|
|
1067
1070
|
return e === t || String(e) === String(t);
|
|
1068
1071
|
}
|
|
1069
|
-
function
|
|
1070
|
-
let n = e.find((e) =>
|
|
1072
|
+
function Tn(e, t) {
|
|
1073
|
+
let n = e.find((e) => wn(e.id, t));
|
|
1071
1074
|
if (!n) throw Error("Not found");
|
|
1072
1075
|
return n;
|
|
1073
1076
|
}
|
|
1074
|
-
function
|
|
1077
|
+
function En(e, t) {
|
|
1075
1078
|
if (t.length === 0) return e;
|
|
1076
1079
|
let n = (e) => e === "DESC" ? -1 : 1;
|
|
1077
1080
|
return [...e].sort((e, r) => {
|
|
@@ -1087,33 +1090,33 @@ function Tn(e, t) {
|
|
|
1087
1090
|
return 0;
|
|
1088
1091
|
});
|
|
1089
1092
|
}
|
|
1090
|
-
function
|
|
1093
|
+
function Dn(e, t) {
|
|
1091
1094
|
return t == null || t === "" ? !0 : Array.isArray(t) ? t.length === 0 ? !0 : Array.isArray(e) ? t.some((t) => e.includes(t)) : t.includes(e) : Array.isArray(e) ? e.includes(t) : typeof t == "string" && typeof e == "string" ? e.toLowerCase().includes(t.toLowerCase()) : e === t;
|
|
1092
1095
|
}
|
|
1093
|
-
function
|
|
1094
|
-
return t ? e.filter((e) => Object.entries(t).every(([t, n]) =>
|
|
1096
|
+
function On(e, t) {
|
|
1097
|
+
return t ? e.filter((e) => Object.entries(t).every(([t, n]) => Dn(e[t], n))) : e;
|
|
1095
1098
|
}
|
|
1096
|
-
function
|
|
1099
|
+
function kn(e, t, n) {
|
|
1097
1100
|
let r = (t - 1) * n;
|
|
1098
1101
|
return {
|
|
1099
1102
|
data: e.slice(r, r + n),
|
|
1100
1103
|
total: e.length
|
|
1101
1104
|
};
|
|
1102
1105
|
}
|
|
1103
|
-
function
|
|
1104
|
-
let { pagination: n, sort: r, filter: i } = t, a =
|
|
1106
|
+
function An(e, t) {
|
|
1107
|
+
let { pagination: n, sort: r, filter: i } = t, a = On(e, i);
|
|
1105
1108
|
if (r) {
|
|
1106
1109
|
let e = Array.isArray(r) ? r : [r];
|
|
1107
|
-
e.length > 0 && e[0]?.field && (a =
|
|
1110
|
+
e.length > 0 && e[0]?.field && (a = En(a, e));
|
|
1108
1111
|
}
|
|
1109
|
-
return n ?
|
|
1112
|
+
return n ? kn(a, n.page, n.perPage) : {
|
|
1110
1113
|
data: a,
|
|
1111
1114
|
total: a.length
|
|
1112
1115
|
};
|
|
1113
1116
|
}
|
|
1114
1117
|
//#endregion
|
|
1115
1118
|
//#region src/data/createMemoryResourceHandlers.ts
|
|
1116
|
-
function
|
|
1119
|
+
function jn(e) {
|
|
1117
1120
|
let t = (e) => e, n = e.mapCreate ?? ((e, t) => ({
|
|
1118
1121
|
...e,
|
|
1119
1122
|
id: t
|
|
@@ -1124,21 +1127,21 @@ function An(e) {
|
|
|
1124
1127
|
}));
|
|
1125
1128
|
return {
|
|
1126
1129
|
async getList(n) {
|
|
1127
|
-
return
|
|
1130
|
+
return An(t(e.scopeList ? e.scopeList(e.getRows(), n) : e.getRows()), n);
|
|
1128
1131
|
},
|
|
1129
1132
|
async getOne(t, n) {
|
|
1130
|
-
return { data:
|
|
1133
|
+
return { data: Tn(e.getRows(), t) };
|
|
1131
1134
|
},
|
|
1132
1135
|
async create(t) {
|
|
1133
1136
|
let r = n(t, e.nextId());
|
|
1134
1137
|
return e.getRows().push(r), { data: r };
|
|
1135
1138
|
},
|
|
1136
1139
|
async update({ id: t, data: n }) {
|
|
1137
|
-
let i =
|
|
1140
|
+
let i = Tn(e.getRows(), t), a = r(i, n);
|
|
1138
1141
|
return Object.assign(i, a), { data: i };
|
|
1139
1142
|
},
|
|
1140
1143
|
async delete(t) {
|
|
1141
|
-
let n = e.getRows(), r = n.findIndex((e) =>
|
|
1144
|
+
let n = e.getRows(), r = n.findIndex((e) => wn(e.id, t));
|
|
1142
1145
|
if (r < 0) return { data: null };
|
|
1143
1146
|
let [i] = n.splice(r, 1);
|
|
1144
1147
|
return e.afterDelete?.(i), { data: i };
|
|
@@ -1147,7 +1150,7 @@ function An(e) {
|
|
|
1147
1150
|
}
|
|
1148
1151
|
//#endregion
|
|
1149
1152
|
//#region src/data/createRestResourceHandlers.ts
|
|
1150
|
-
function
|
|
1153
|
+
function Mn(e) {
|
|
1151
1154
|
return {
|
|
1152
1155
|
async getList(t) {
|
|
1153
1156
|
return e.list(t);
|
|
@@ -1170,24 +1173,24 @@ function jn(e) {
|
|
|
1170
1173
|
}
|
|
1171
1174
|
//#endregion
|
|
1172
1175
|
//#region src/data/sortHelpers.ts
|
|
1173
|
-
function
|
|
1176
|
+
function Nn(e) {
|
|
1174
1177
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
1175
1178
|
}
|
|
1176
|
-
function
|
|
1177
|
-
let t =
|
|
1179
|
+
function Pn(e) {
|
|
1180
|
+
let t = Nn(e);
|
|
1178
1181
|
if (t.length !== 0) return t.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
|
|
1179
1182
|
}
|
|
1180
|
-
function
|
|
1181
|
-
let t =
|
|
1183
|
+
function Fn(e) {
|
|
1184
|
+
let t = Nn(e);
|
|
1182
1185
|
if (t.length !== 0) return t.map((e) => `${e.field} ${e.order === "DESC" ? "desc" : "asc"}`).join(",");
|
|
1183
1186
|
}
|
|
1184
|
-
function
|
|
1185
|
-
let t =
|
|
1187
|
+
function In(e) {
|
|
1188
|
+
let t = Nn(e);
|
|
1186
1189
|
if (t.length !== 0) return t.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
|
|
1187
1190
|
}
|
|
1188
1191
|
//#endregion
|
|
1189
1192
|
//#region src/components/AuthAlternateLink.tsx
|
|
1190
|
-
function
|
|
1193
|
+
function Ln({ prompt: e, linkText: t, to: n }) {
|
|
1191
1194
|
return /* @__PURE__ */ Y(G.Paragraph, {
|
|
1192
1195
|
type: "secondary",
|
|
1193
1196
|
style: {
|
|
@@ -1206,7 +1209,7 @@ function In({ prompt: e, linkText: t, to: n }) {
|
|
|
1206
1209
|
}
|
|
1207
1210
|
//#endregion
|
|
1208
1211
|
//#region src/layouts/AuthPageLayout.tsx
|
|
1209
|
-
function
|
|
1212
|
+
function Rn({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
1210
1213
|
let { token: i } = K.useToken();
|
|
1211
1214
|
return /* @__PURE__ */ Y(j, {
|
|
1212
1215
|
vertical: !0,
|
|
@@ -1268,11 +1271,11 @@ function Ln({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1268
1271
|
}
|
|
1269
1272
|
//#endregion
|
|
1270
1273
|
//#region src/pages/LoginPage.tsx
|
|
1271
|
-
function
|
|
1274
|
+
function zn({ title: e = "Sign in", description: t = "Use any username and password to continue.", logo: n, brand: r, extraFields: i, showThemeToolbar: a = !0, afterLoginPath: o = "/", alternateAuth: s, footer: c }) {
|
|
1272
1275
|
let { login: l } = lt(), u = v();
|
|
1273
|
-
return /* @__PURE__ */ J(
|
|
1276
|
+
return /* @__PURE__ */ J(Rn, {
|
|
1274
1277
|
brand: r ?? n,
|
|
1275
|
-
footer: c ?? (s ? /* @__PURE__ */ J(
|
|
1278
|
+
footer: c ?? (s ? /* @__PURE__ */ J(Ln, {
|
|
1276
1279
|
prompt: s.prompt ?? "Don't have an account?",
|
|
1277
1280
|
linkText: s.linkText,
|
|
1278
1281
|
to: s.to
|
|
@@ -1333,7 +1336,7 @@ function Rn({ title: e = "Sign in", description: t = "Use any username and passw
|
|
|
1333
1336
|
}
|
|
1334
1337
|
//#endregion
|
|
1335
1338
|
//#region src/pages/PlaceholderPage.tsx
|
|
1336
|
-
function
|
|
1339
|
+
function Bn({ title: e }) {
|
|
1337
1340
|
return /* @__PURE__ */ J(G.Title, {
|
|
1338
1341
|
level: 3,
|
|
1339
1342
|
style: { marginTop: 0 },
|
|
@@ -1342,7 +1345,7 @@ function zn({ title: e }) {
|
|
|
1342
1345
|
}
|
|
1343
1346
|
//#endregion
|
|
1344
1347
|
//#region src/components/AppHub.tsx
|
|
1345
|
-
function
|
|
1348
|
+
function Vn({ apps: e, menuItems: t, onAppClick: n, onMenuClick: r, menuSearchPlaceholder: i = "Search menus across apps…", className: a, maxWidth: o = 960, loading: s = !1 }) {
|
|
1346
1349
|
let c = v(), { token: u } = K.useToken(), [f, p] = d(""), m = (e) => {
|
|
1347
1350
|
if (n) {
|
|
1348
1351
|
n(e);
|
|
@@ -1448,7 +1451,7 @@ function Bn({ apps: e, menuItems: t, onAppClick: n, onMenuClick: r, menuSearchPl
|
|
|
1448
1451
|
}
|
|
1449
1452
|
//#endregion
|
|
1450
1453
|
//#region src/components/AppLauncherButton.tsx
|
|
1451
|
-
function
|
|
1454
|
+
function Hn({ hubPath: e = "/", label: t = "Apps", onClick: n }) {
|
|
1452
1455
|
let r = v();
|
|
1453
1456
|
return /* @__PURE__ */ J(w, {
|
|
1454
1457
|
type: "text",
|
|
@@ -1465,7 +1468,7 @@ function Vn({ hubPath: e = "/", label: t = "Apps", onClick: n }) {
|
|
|
1465
1468
|
}
|
|
1466
1469
|
//#endregion
|
|
1467
1470
|
//#region src/crud/utils/sortQueryParam.ts
|
|
1468
|
-
function
|
|
1471
|
+
function Un(e) {
|
|
1469
1472
|
if (!e) return [];
|
|
1470
1473
|
let t = [];
|
|
1471
1474
|
for (let n of e.split(",").map((e) => e.trim()).filter(Boolean)) {
|
|
@@ -1489,17 +1492,17 @@ function Hn(e) {
|
|
|
1489
1492
|
}
|
|
1490
1493
|
return t;
|
|
1491
1494
|
}
|
|
1492
|
-
function
|
|
1495
|
+
function Wn(e) {
|
|
1493
1496
|
return e.length === 0 ? null : e.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
|
|
1494
1497
|
}
|
|
1495
|
-
function
|
|
1498
|
+
function Gn(e) {
|
|
1496
1499
|
return new Map(e.map((e, t) => [e.field, t + 1]));
|
|
1497
1500
|
}
|
|
1498
1501
|
//#endregion
|
|
1499
1502
|
//#region src/crud/context/ListContext.tsx
|
|
1500
|
-
var
|
|
1501
|
-
function
|
|
1502
|
-
let [r, i] = d([]), o = l(() => new Set(n.map((e) => e.field)), [n]), s = l(() => new Map(n.map((e) => [e.field, e.order])), [n]), c = l(() =>
|
|
1503
|
+
var Kn = t(null);
|
|
1504
|
+
function qn({ children: e, toggleSort: t, sort: n }) {
|
|
1505
|
+
let [r, i] = d([]), o = l(() => new Set(n.map((e) => e.field)), [n]), s = l(() => new Map(n.map((e) => [e.field, e.order])), [n]), c = l(() => Gn(n), [n]), u = a((e) => (i((t) => {
|
|
1503
1506
|
let n = t.findIndex((t) => t.key === e.key);
|
|
1504
1507
|
if (n < 0) return [...t, e];
|
|
1505
1508
|
if (t[n] === e) return t;
|
|
@@ -1522,23 +1525,23 @@ function Kn({ children: e, toggleSort: t, sort: n }) {
|
|
|
1522
1525
|
c,
|
|
1523
1526
|
u
|
|
1524
1527
|
]);
|
|
1525
|
-
return /* @__PURE__ */ J(
|
|
1528
|
+
return /* @__PURE__ */ J(Kn.Provider, {
|
|
1526
1529
|
value: f,
|
|
1527
1530
|
children: e
|
|
1528
1531
|
});
|
|
1529
1532
|
}
|
|
1530
|
-
function
|
|
1531
|
-
let e = o(
|
|
1533
|
+
function Jn() {
|
|
1534
|
+
let e = o(Kn);
|
|
1532
1535
|
if (!e) throw Error("Column components must be used within ResourceList");
|
|
1533
1536
|
return e;
|
|
1534
1537
|
}
|
|
1535
|
-
function
|
|
1536
|
-
let { registerColumn: t } =
|
|
1538
|
+
function Yn(e) {
|
|
1539
|
+
let { registerColumn: t } = Jn();
|
|
1537
1540
|
s(() => t(e), [t, e]);
|
|
1538
1541
|
}
|
|
1539
1542
|
//#endregion
|
|
1540
1543
|
//#region src/crud/utils/useDebouncedValue.ts
|
|
1541
|
-
function
|
|
1544
|
+
function Xn(e, t) {
|
|
1542
1545
|
let [n, r] = d(e);
|
|
1543
1546
|
return s(() => {
|
|
1544
1547
|
if (t <= 0) {
|
|
@@ -1551,18 +1554,18 @@ function Yn(e, t) {
|
|
|
1551
1554
|
}
|
|
1552
1555
|
//#endregion
|
|
1553
1556
|
//#region src/crud/filters/TextFilter.tsx
|
|
1554
|
-
var
|
|
1555
|
-
function
|
|
1557
|
+
var Zn = 300;
|
|
1558
|
+
function Qn(e) {
|
|
1556
1559
|
if (!(e == null || e === "")) return String(e);
|
|
1557
1560
|
}
|
|
1558
|
-
function
|
|
1559
|
-
let [i, a] = d(() => e ?? ""), o =
|
|
1561
|
+
function $n({ value: e, onChange: t, placeholder: n, debounceMs: r }) {
|
|
1562
|
+
let [i, a] = d(() => e ?? ""), o = Xn(i, r);
|
|
1560
1563
|
return s(() => {
|
|
1561
1564
|
a(e ?? "");
|
|
1562
1565
|
}, [e]), s(() => {
|
|
1563
1566
|
if (r <= 0 || o !== i) return;
|
|
1564
|
-
let n =
|
|
1565
|
-
n !==
|
|
1567
|
+
let n = Qn(o);
|
|
1568
|
+
n !== Qn(e) && t(n);
|
|
1566
1569
|
}, [
|
|
1567
1570
|
o,
|
|
1568
1571
|
i,
|
|
@@ -1575,18 +1578,18 @@ function Qn({ value: e, onChange: t, placeholder: n, debounceMs: r }) {
|
|
|
1575
1578
|
value: i,
|
|
1576
1579
|
onChange: (e) => {
|
|
1577
1580
|
let n = e.target.value;
|
|
1578
|
-
a(n), (r <= 0 || n === "") && t(
|
|
1581
|
+
a(n), (r <= 0 || n === "") && t(Qn(n));
|
|
1579
1582
|
},
|
|
1580
1583
|
style: { minWidth: 160 }
|
|
1581
1584
|
});
|
|
1582
1585
|
}
|
|
1583
|
-
function
|
|
1584
|
-
let i =
|
|
1585
|
-
return
|
|
1586
|
+
function er({ source: e, label: t, placeholder: n, debounceMs: r }) {
|
|
1587
|
+
let i = rr(), a = r ?? i?.textFilterDebounceMs ?? 300;
|
|
1588
|
+
return ir(l(() => ({
|
|
1586
1589
|
key: e,
|
|
1587
1590
|
source: e,
|
|
1588
1591
|
label: t,
|
|
1589
|
-
render: ({ value: r, onChange: i }) => /* @__PURE__ */ J(
|
|
1592
|
+
render: ({ value: r, onChange: i }) => /* @__PURE__ */ J($n, {
|
|
1590
1593
|
value: r,
|
|
1591
1594
|
onChange: i,
|
|
1592
1595
|
placeholder: n ?? t ?? e,
|
|
@@ -1601,8 +1604,8 @@ function $n({ source: e, label: t, placeholder: n, debounceMs: r }) {
|
|
|
1601
1604
|
}
|
|
1602
1605
|
//#endregion
|
|
1603
1606
|
//#region src/crud/context/FilterContext.tsx
|
|
1604
|
-
var
|
|
1605
|
-
function
|
|
1607
|
+
var tr = t(null);
|
|
1608
|
+
function nr({ children: e, values: t, setFilterValue: n, textFilterDebounceMs: r = 300 }) {
|
|
1606
1609
|
let [i, o] = d([]), s = a((e) => (o((t) => {
|
|
1607
1610
|
let n = t.findIndex((t) => t.key === e.key);
|
|
1608
1611
|
if (n < 0) return [...t, e];
|
|
@@ -1624,25 +1627,25 @@ function tr({ children: e, values: t, setFilterValue: n, textFilterDebounceMs: r
|
|
|
1624
1627
|
s,
|
|
1625
1628
|
r
|
|
1626
1629
|
]);
|
|
1627
|
-
return /* @__PURE__ */ J(
|
|
1630
|
+
return /* @__PURE__ */ J(tr.Provider, {
|
|
1628
1631
|
value: c,
|
|
1629
1632
|
children: e
|
|
1630
1633
|
});
|
|
1631
1634
|
}
|
|
1632
|
-
function
|
|
1633
|
-
return o(
|
|
1635
|
+
function rr() {
|
|
1636
|
+
return o(tr);
|
|
1634
1637
|
}
|
|
1635
|
-
function
|
|
1636
|
-
let t =
|
|
1638
|
+
function ir(e) {
|
|
1639
|
+
let t = rr()?.registerFilter;
|
|
1637
1640
|
s(() => {
|
|
1638
1641
|
if (t) return t(e);
|
|
1639
1642
|
}, [t, e]);
|
|
1640
1643
|
}
|
|
1641
1644
|
//#endregion
|
|
1642
1645
|
//#region src/crud/context/FormContext.tsx
|
|
1643
|
-
var
|
|
1644
|
-
function
|
|
1645
|
-
return /* @__PURE__ */ J(
|
|
1646
|
+
var ar = t(null);
|
|
1647
|
+
function or({ children: e, resource: t, isNew: n, disabled: r }) {
|
|
1648
|
+
return /* @__PURE__ */ J(ar.Provider, {
|
|
1646
1649
|
value: {
|
|
1647
1650
|
resource: t,
|
|
1648
1651
|
isNew: n,
|
|
@@ -1651,35 +1654,35 @@ function ar({ children: e, resource: t, isNew: n, disabled: r }) {
|
|
|
1651
1654
|
children: e
|
|
1652
1655
|
});
|
|
1653
1656
|
}
|
|
1654
|
-
function
|
|
1655
|
-
return o(
|
|
1657
|
+
function sr() {
|
|
1658
|
+
return o(ar);
|
|
1656
1659
|
}
|
|
1657
1660
|
//#endregion
|
|
1658
1661
|
//#region src/crud/context/FormSectionContext.tsx
|
|
1659
|
-
var
|
|
1660
|
-
function
|
|
1661
|
-
return /* @__PURE__ */ J(
|
|
1662
|
+
var cr = t(null);
|
|
1663
|
+
function lr({ sourcesRef: e, children: t }) {
|
|
1664
|
+
return /* @__PURE__ */ J(cr.Provider, {
|
|
1662
1665
|
value: e,
|
|
1663
1666
|
children: t
|
|
1664
1667
|
});
|
|
1665
1668
|
}
|
|
1666
|
-
function
|
|
1667
|
-
return o(
|
|
1669
|
+
function ur() {
|
|
1670
|
+
return o(cr);
|
|
1668
1671
|
}
|
|
1669
1672
|
//#endregion
|
|
1670
1673
|
//#region src/crud/context/PayloadFieldsContext.tsx
|
|
1671
|
-
var
|
|
1672
|
-
function
|
|
1673
|
-
return /* @__PURE__ */ J(
|
|
1674
|
+
var dr = t(null);
|
|
1675
|
+
function fr({ children: e, fieldsRef: t }) {
|
|
1676
|
+
return /* @__PURE__ */ J(dr.Provider, {
|
|
1674
1677
|
value: t,
|
|
1675
1678
|
children: e
|
|
1676
1679
|
});
|
|
1677
1680
|
}
|
|
1678
|
-
function
|
|
1679
|
-
return o(
|
|
1681
|
+
function pr() {
|
|
1682
|
+
return o(dr);
|
|
1680
1683
|
}
|
|
1681
|
-
function
|
|
1682
|
-
let n =
|
|
1684
|
+
function mr(e, t = !0) {
|
|
1685
|
+
let n = pr();
|
|
1683
1686
|
s(() => {
|
|
1684
1687
|
if (!(!t || !n)) return n.current.add(e), () => {
|
|
1685
1688
|
n.current.delete(e);
|
|
@@ -1690,8 +1693,8 @@ function pr(e, t = !0) {
|
|
|
1690
1693
|
t
|
|
1691
1694
|
]);
|
|
1692
1695
|
}
|
|
1693
|
-
function
|
|
1694
|
-
let n =
|
|
1696
|
+
function hr(e, t = !0) {
|
|
1697
|
+
let n = ur();
|
|
1695
1698
|
s(() => {
|
|
1696
1699
|
if (!(!t || !n)) return n.current.add(e), () => {
|
|
1697
1700
|
n.current.delete(e);
|
|
@@ -1704,18 +1707,18 @@ function mr(e, t = !0) {
|
|
|
1704
1707
|
}
|
|
1705
1708
|
//#endregion
|
|
1706
1709
|
//#region src/crud/context/InlineFieldsRegistry.tsx
|
|
1707
|
-
var
|
|
1708
|
-
function
|
|
1709
|
-
return /* @__PURE__ */ J(
|
|
1710
|
+
var gr = t(null);
|
|
1711
|
+
function _r({ children: e, registryRef: t }) {
|
|
1712
|
+
return /* @__PURE__ */ J(gr.Provider, {
|
|
1710
1713
|
value: t,
|
|
1711
1714
|
children: e
|
|
1712
1715
|
});
|
|
1713
1716
|
}
|
|
1714
|
-
function
|
|
1715
|
-
return o(
|
|
1717
|
+
function vr() {
|
|
1718
|
+
return o(gr);
|
|
1716
1719
|
}
|
|
1717
|
-
function
|
|
1718
|
-
let a =
|
|
1720
|
+
function yr(e, t, n, r, i = !0) {
|
|
1721
|
+
let a = vr();
|
|
1719
1722
|
s(() => {
|
|
1720
1723
|
if (!(!i || !a)) return a.current.set(e, {
|
|
1721
1724
|
field: e,
|
|
@@ -1736,7 +1739,7 @@ function vr(e, t, n, r, i = !0) {
|
|
|
1736
1739
|
}
|
|
1737
1740
|
//#endregion
|
|
1738
1741
|
//#region src/crud/FormGlobalErrorsAlert.tsx
|
|
1739
|
-
function
|
|
1742
|
+
function br({ errors: e }) {
|
|
1740
1743
|
return e.length ? e.length === 1 ? /* @__PURE__ */ J(x, {
|
|
1741
1744
|
type: "error",
|
|
1742
1745
|
title: e[0],
|
|
@@ -1758,7 +1761,7 @@ function yr({ errors: e }) {
|
|
|
1758
1761
|
}
|
|
1759
1762
|
//#endregion
|
|
1760
1763
|
//#region src/crud/utils/getFormValue.ts
|
|
1761
|
-
function
|
|
1764
|
+
function xr(e, t) {
|
|
1762
1765
|
let n = t.split("."), r = e;
|
|
1763
1766
|
for (let e of n) {
|
|
1764
1767
|
if (typeof r != "object" || !r) return;
|
|
@@ -1768,7 +1771,7 @@ function br(e, t) {
|
|
|
1768
1771
|
}
|
|
1769
1772
|
//#endregion
|
|
1770
1773
|
//#region src/crud/utils/setFormValue.ts
|
|
1771
|
-
function
|
|
1774
|
+
function Sr(e, t, n) {
|
|
1772
1775
|
let r = t.split("."), i = e;
|
|
1773
1776
|
for (let e = 0; e < r.length - 1; e++) {
|
|
1774
1777
|
let t = r[e], n = i[t];
|
|
@@ -1778,25 +1781,25 @@ function xr(e, t, n) {
|
|
|
1778
1781
|
}
|
|
1779
1782
|
//#endregion
|
|
1780
1783
|
//#region src/crud/utils/buildFormPayload.ts
|
|
1781
|
-
function
|
|
1784
|
+
function Cr(e, t) {
|
|
1782
1785
|
if (t.length === 0) return { ...e };
|
|
1783
1786
|
let n = {};
|
|
1784
1787
|
for (let r of t) {
|
|
1785
|
-
let t =
|
|
1786
|
-
t !== void 0 &&
|
|
1788
|
+
let t = xr(e, r);
|
|
1789
|
+
t !== void 0 && Sr(n, r, t);
|
|
1787
1790
|
}
|
|
1788
1791
|
return n;
|
|
1789
1792
|
}
|
|
1790
1793
|
//#endregion
|
|
1791
1794
|
//#region src/crud/utils/buildInlineRowsPayload.ts
|
|
1792
|
-
function
|
|
1795
|
+
function wr(e, t, n) {
|
|
1793
1796
|
if (!Array.isArray(e)) return [];
|
|
1794
1797
|
let r = e.map((e) => {
|
|
1795
1798
|
if (!e || typeof e != "object") return {};
|
|
1796
1799
|
let n = e, r = {};
|
|
1797
1800
|
for (let e of t) {
|
|
1798
|
-
let t =
|
|
1799
|
-
t !== void 0 &&
|
|
1801
|
+
let t = xr(n, e);
|
|
1802
|
+
t !== void 0 && Sr(r, e, t);
|
|
1800
1803
|
}
|
|
1801
1804
|
let i = n.id;
|
|
1802
1805
|
return i != null && (r.id = i), r;
|
|
@@ -1805,37 +1808,37 @@ function Cr(e, t, n) {
|
|
|
1805
1808
|
}
|
|
1806
1809
|
//#endregion
|
|
1807
1810
|
//#region src/crud/utils/hasUploadValues.ts
|
|
1808
|
-
function
|
|
1809
|
-
return e instanceof Blob ? !0 : Array.isArray(e) ? e.some(
|
|
1811
|
+
function Tr(e) {
|
|
1812
|
+
return e instanceof Blob ? !0 : Array.isArray(e) ? e.some(Tr) : e && typeof e == "object" ? Object.values(e).some(Tr) : !1;
|
|
1810
1813
|
}
|
|
1811
1814
|
//#endregion
|
|
1812
1815
|
//#region src/crud/utils/uploadReferenceUtils.ts
|
|
1813
|
-
function
|
|
1816
|
+
function Er(e) {
|
|
1814
1817
|
return /^https?:\/\//i.test(e) || e.startsWith("/media/");
|
|
1815
1818
|
}
|
|
1816
|
-
function
|
|
1819
|
+
function Dr(e, t) {
|
|
1817
1820
|
if (!t) return e;
|
|
1818
|
-
if (typeof e == "string") return
|
|
1819
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
1821
|
+
if (typeof e == "string") return Er(e) ? void 0 : e;
|
|
1822
|
+
if (Array.isArray(e)) return e.map((e) => Dr(e, t)).filter((e) => e !== void 0);
|
|
1820
1823
|
if (e && typeof e == "object" && !(e instanceof Blob)) {
|
|
1821
1824
|
let n = {};
|
|
1822
1825
|
for (let [r, i] of Object.entries(e)) {
|
|
1823
|
-
let e =
|
|
1826
|
+
let e = Dr(i, t);
|
|
1824
1827
|
e !== void 0 && (n[r] = e);
|
|
1825
1828
|
}
|
|
1826
1829
|
return n;
|
|
1827
1830
|
}
|
|
1828
1831
|
return e;
|
|
1829
1832
|
}
|
|
1830
|
-
function
|
|
1831
|
-
return
|
|
1833
|
+
function Or(e, t = !0) {
|
|
1834
|
+
return Dr(e, t);
|
|
1832
1835
|
}
|
|
1833
1836
|
//#endregion
|
|
1834
1837
|
//#region src/crud/utils/toFormData.ts
|
|
1835
|
-
function
|
|
1838
|
+
function kr(e, t) {
|
|
1836
1839
|
return /\[[0-9]+\]$/.test(e) ? `${e}${t}` : `${e}.${t}`;
|
|
1837
1840
|
}
|
|
1838
|
-
function
|
|
1841
|
+
function Ar(e, t, n, r) {
|
|
1839
1842
|
if (n !== void 0) {
|
|
1840
1843
|
if (n === null) {
|
|
1841
1844
|
e.append(t, "");
|
|
@@ -1850,106 +1853,106 @@ function kr(e, t, n, r) {
|
|
|
1850
1853
|
return;
|
|
1851
1854
|
}
|
|
1852
1855
|
if (typeof n == "string") {
|
|
1853
|
-
if (r.skipExistingUploadUrls &&
|
|
1856
|
+
if (r.skipExistingUploadUrls && Er(n)) return;
|
|
1854
1857
|
e.append(t, n);
|
|
1855
1858
|
return;
|
|
1856
1859
|
}
|
|
1857
1860
|
if (Array.isArray(n)) {
|
|
1858
1861
|
n.forEach((n, i) => {
|
|
1859
|
-
|
|
1862
|
+
Ar(e, `${t}[${i}]`, n, r);
|
|
1860
1863
|
});
|
|
1861
1864
|
return;
|
|
1862
1865
|
}
|
|
1863
1866
|
if (typeof n == "object") {
|
|
1864
|
-
for (let [i, a] of Object.entries(n))
|
|
1867
|
+
for (let [i, a] of Object.entries(n)) Ar(e, kr(t, i), a, r);
|
|
1865
1868
|
return;
|
|
1866
1869
|
}
|
|
1867
1870
|
e.append(t, String(n));
|
|
1868
1871
|
}
|
|
1869
1872
|
}
|
|
1870
|
-
function
|
|
1873
|
+
function jr(e, t) {
|
|
1871
1874
|
let n = { skipExistingUploadUrls: t?.skipExistingUploadUrls ?? !0 }, r = new FormData();
|
|
1872
|
-
for (let [t, i] of Object.entries(e))
|
|
1875
|
+
for (let [t, i] of Object.entries(e)) Ar(r, t, i, n);
|
|
1873
1876
|
return r;
|
|
1874
1877
|
}
|
|
1875
1878
|
//#endregion
|
|
1876
1879
|
//#region src/crud/utils/prepareFormSubmitBody.ts
|
|
1877
|
-
function
|
|
1880
|
+
function Mr(e, t) {
|
|
1878
1881
|
let n = t?.skipExistingUploadUrls ?? !0;
|
|
1879
|
-
return
|
|
1882
|
+
return Tr(e) ? jr(e, t) : Or(e, n);
|
|
1880
1883
|
}
|
|
1881
1884
|
//#endregion
|
|
1882
1885
|
//#region src/crud/utils/buildResourceFormSubmitBody.ts
|
|
1883
|
-
function
|
|
1884
|
-
let i =
|
|
1886
|
+
function Nr(e, t, n, r) {
|
|
1887
|
+
let i = Cr(e, t);
|
|
1885
1888
|
if (n) for (let t of n) {
|
|
1886
1889
|
let n = e[t.field], r = t.payloadKey ?? t.field;
|
|
1887
|
-
i[r] =
|
|
1890
|
+
i[r] = wr(n, t.sources, { transformRows: t.transformRows });
|
|
1888
1891
|
}
|
|
1889
|
-
return
|
|
1892
|
+
return Mr(i, r);
|
|
1890
1893
|
}
|
|
1891
1894
|
//#endregion
|
|
1892
1895
|
//#region src/crud/utils/formErrors.ts
|
|
1893
|
-
function
|
|
1896
|
+
function Pr(e) {
|
|
1894
1897
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
1895
1898
|
}
|
|
1896
|
-
function
|
|
1899
|
+
function Fr(e) {
|
|
1897
1900
|
return Array.isArray(e) ? e.join(", ") : e;
|
|
1898
1901
|
}
|
|
1899
|
-
function
|
|
1902
|
+
function Ir(e, t, n) {
|
|
1900
1903
|
if (t.has(e)) return !0;
|
|
1901
1904
|
let r = e.match(/^([^.]+)\.(\d+)\.([^.]+)$/);
|
|
1902
1905
|
if (!r) return !1;
|
|
1903
1906
|
let [, i, , a] = r;
|
|
1904
1907
|
return n.get(i)?.sources.includes(a) ?? !1;
|
|
1905
1908
|
}
|
|
1906
|
-
function
|
|
1907
|
-
let r = {}, i = [...
|
|
1908
|
-
for (let [a, o] of Object.entries(e.fields ?? {}))
|
|
1909
|
+
function Lr(e, t, n) {
|
|
1910
|
+
let r = {}, i = [...Pr(e.global)];
|
|
1911
|
+
for (let [a, o] of Object.entries(e.fields ?? {})) Ir(a, t, n) ? r[a] = o : i.push(Fr(o));
|
|
1909
1912
|
return {
|
|
1910
1913
|
fieldErrors: r,
|
|
1911
1914
|
globalErrors: i
|
|
1912
1915
|
};
|
|
1913
1916
|
}
|
|
1914
|
-
function
|
|
1917
|
+
function Rr(e, t) {
|
|
1915
1918
|
for (let [n, r] of Object.entries(t)) e.setError(n, {
|
|
1916
1919
|
type: "server",
|
|
1917
|
-
message:
|
|
1920
|
+
message: Fr(r)
|
|
1918
1921
|
});
|
|
1919
1922
|
}
|
|
1920
|
-
function
|
|
1921
|
-
let t =
|
|
1923
|
+
function zr(e) {
|
|
1924
|
+
let t = un(e);
|
|
1922
1925
|
if (t && !/application\/json/i.test(t)) return `non-JSON response (Content-Type: ${t})`;
|
|
1923
1926
|
}
|
|
1924
|
-
async function
|
|
1925
|
-
let a = await
|
|
1927
|
+
async function Br(e, t, n, r, i) {
|
|
1928
|
+
let a = await pn(n);
|
|
1926
1929
|
if (a != null) {
|
|
1927
1930
|
let n = e.parseFormError?.({ body: a }, r);
|
|
1928
1931
|
if (n) {
|
|
1929
1932
|
let e = new Set(i.payloadFields), r = /* @__PURE__ */ new Map();
|
|
1930
1933
|
for (let e of i.inlineRegistry) r.set(e.field, e);
|
|
1931
|
-
let { fieldErrors: a, globalErrors: o } =
|
|
1932
|
-
if (Object.keys(a).length || o.length) return
|
|
1934
|
+
let { fieldErrors: a, globalErrors: o } = Lr(n, e, r);
|
|
1935
|
+
if (Object.keys(a).length || o.length) return Rr(t, a), {
|
|
1933
1936
|
handled: !0,
|
|
1934
1937
|
globalErrors: o
|
|
1935
1938
|
};
|
|
1936
1939
|
}
|
|
1937
1940
|
return {
|
|
1938
1941
|
handled: !0,
|
|
1939
|
-
globalErrors: [
|
|
1942
|
+
globalErrors: [cn(a)]
|
|
1940
1943
|
};
|
|
1941
1944
|
}
|
|
1942
|
-
return
|
|
1945
|
+
return ln(n) == null ? {
|
|
1943
1946
|
handled: !1,
|
|
1944
1947
|
globalErrors: []
|
|
1945
1948
|
} : {
|
|
1946
1949
|
handled: !0,
|
|
1947
|
-
globalErrors: [
|
|
1950
|
+
globalErrors: [cn(null, { hint: zr(n) })]
|
|
1948
1951
|
};
|
|
1949
1952
|
}
|
|
1950
1953
|
//#endregion
|
|
1951
1954
|
//#region src/crud/utils/useAbortableEffect.ts
|
|
1952
|
-
function
|
|
1955
|
+
function Vr(e, t) {
|
|
1953
1956
|
s(() => {
|
|
1954
1957
|
let t = new AbortController();
|
|
1955
1958
|
return e(t.signal), () => t.abort();
|
|
@@ -1957,7 +1960,7 @@ function Br(e, t) {
|
|
|
1957
1960
|
}
|
|
1958
1961
|
//#endregion
|
|
1959
1962
|
//#region src/crud/utils/useFormRecord.ts
|
|
1960
|
-
function
|
|
1963
|
+
function Hr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultValues: s, enabled: c = !0 }) {
|
|
1961
1964
|
let [l, u] = d(!r), [f, p] = d(0), m = a(async (a) => {
|
|
1962
1965
|
if (r || !n) {
|
|
1963
1966
|
s ? i.reset({ ...s }) : i.reset({}), u(!1);
|
|
@@ -1969,7 +1972,7 @@ function Vr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultV
|
|
|
1969
1972
|
if (a?.aborted) return;
|
|
1970
1973
|
i.reset(r.data), p((e) => e + 1);
|
|
1971
1974
|
} catch (e) {
|
|
1972
|
-
|
|
1975
|
+
en(e) || o.error(e instanceof Error ? e.message : "Load failed");
|
|
1973
1976
|
} finally {
|
|
1974
1977
|
a?.aborted || u(!1);
|
|
1975
1978
|
}
|
|
@@ -1982,20 +1985,20 @@ function Vr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultV
|
|
|
1982
1985
|
o,
|
|
1983
1986
|
s
|
|
1984
1987
|
]);
|
|
1985
|
-
return
|
|
1988
|
+
return Vr((e) => {
|
|
1986
1989
|
if (c) return m(e);
|
|
1987
1990
|
}, [c, m]), {
|
|
1988
1991
|
loading: l,
|
|
1989
1992
|
formVersion: f
|
|
1990
1993
|
};
|
|
1991
1994
|
}
|
|
1992
|
-
function
|
|
1995
|
+
function Ur({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadFieldsRef: s, inlineRegistryRef: c, setGlobalErrors: l, onSuccess: u }) {
|
|
1993
1996
|
let [f, p] = d(!1);
|
|
1994
1997
|
return {
|
|
1995
1998
|
onSubmit: a(async (a) => {
|
|
1996
1999
|
l([]), p(!0);
|
|
1997
2000
|
try {
|
|
1998
|
-
let i =
|
|
2001
|
+
let i = Nr(a, Array.from(s.current), c.current.values()), l;
|
|
1999
2002
|
if (r) l = (await e.create(t, i)).data, o.success("Created");
|
|
2000
2003
|
else if (n) l = (await e.update(t, {
|
|
2001
2004
|
id: n,
|
|
@@ -2004,7 +2007,7 @@ function Hr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
2004
2007
|
else return;
|
|
2005
2008
|
u?.(l);
|
|
2006
2009
|
} catch (n) {
|
|
2007
|
-
let { handled: a, globalErrors: u } = await
|
|
2010
|
+
let { handled: a, globalErrors: u } = await Br(e, i, n, {
|
|
2008
2011
|
resource: t,
|
|
2009
2012
|
mutation: r ? "create" : "update",
|
|
2010
2013
|
inlineFieldPaths: Array.from(c.current.keys())
|
|
@@ -2033,8 +2036,8 @@ function Hr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
2033
2036
|
}
|
|
2034
2037
|
//#endregion
|
|
2035
2038
|
//#region src/crud/ResourceRecordForm.tsx
|
|
2036
|
-
function
|
|
2037
|
-
let m = t === "new" || !t, h = m ? void 0 : t, g =
|
|
2039
|
+
function Wr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0, canSave: o = !0, onCancel: s, cancelHref: c, onSuccess: l, loadingMode: p = "overlay" }) {
|
|
2040
|
+
let m = t === "new" || !t, h = m ? void 0 : t, g = Xt(), { message: _ } = S.useApp(), v = u(/* @__PURE__ */ new Set()), y = u(/* @__PURE__ */ new Map()), [b, x] = d([]), C = Ae({ defaultValues: i }), { loading: T, formVersion: E } = Hr({
|
|
2038
2041
|
dp: g,
|
|
2039
2042
|
resource: e,
|
|
2040
2043
|
id: h,
|
|
@@ -2043,7 +2046,7 @@ function Ur({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2043
2046
|
message: _,
|
|
2044
2047
|
defaultValues: i,
|
|
2045
2048
|
enabled: a
|
|
2046
|
-
}), { onSubmit: D, saving: O } =
|
|
2049
|
+
}), { onSubmit: D, saving: O } = Ur({
|
|
2047
2050
|
dp: g,
|
|
2048
2051
|
resource: e,
|
|
2049
2052
|
id: h,
|
|
@@ -2062,12 +2065,12 @@ function Ur({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2062
2065
|
disabled: k,
|
|
2063
2066
|
onClick: c ? void 0 : s,
|
|
2064
2067
|
children: "Cancel"
|
|
2065
|
-
}), N = /* @__PURE__ */ J(
|
|
2068
|
+
}), N = /* @__PURE__ */ J(or, {
|
|
2066
2069
|
resource: e,
|
|
2067
2070
|
isNew: m,
|
|
2068
|
-
children: /* @__PURE__ */ J(
|
|
2071
|
+
children: /* @__PURE__ */ J(fr, {
|
|
2069
2072
|
fieldsRef: v,
|
|
2070
|
-
children: /* @__PURE__ */ J(
|
|
2073
|
+
children: /* @__PURE__ */ J(_r, {
|
|
2071
2074
|
registryRef: y,
|
|
2072
2075
|
children: /* @__PURE__ */ Y("div", {
|
|
2073
2076
|
style: { position: "relative" },
|
|
@@ -2092,7 +2095,7 @@ function Ur({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2092
2095
|
pointerEvents: k ? "none" : void 0
|
|
2093
2096
|
} : void 0,
|
|
2094
2097
|
children: [
|
|
2095
|
-
/* @__PURE__ */ J(
|
|
2098
|
+
/* @__PURE__ */ J(br, { errors: b }),
|
|
2096
2099
|
r,
|
|
2097
2100
|
/* @__PURE__ */ J(M.Item, {
|
|
2098
2101
|
style: {
|
|
@@ -2120,7 +2123,7 @@ function Ur({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2120
2123
|
}
|
|
2121
2124
|
//#endregion
|
|
2122
2125
|
//#region src/crud/ResourceFormModal.tsx
|
|
2123
|
-
function
|
|
2126
|
+
function Gr({ resource: e, editId: t, onClose: n, children: r, title: i, permissions: a, defaultValues: o, width: s = 560, onSuccess: c }) {
|
|
2124
2127
|
let l = t === "new", u = t != null, d = mt(), f = i ?? (l ? `New ${e}` : `Edit ${e}`), p = a ? Z(d, a, l ? "add" : "change") : !0;
|
|
2125
2128
|
return /* @__PURE__ */ J(te, {
|
|
2126
2129
|
open: u,
|
|
@@ -2130,7 +2133,7 @@ function Wr({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
2130
2133
|
destroyOnHidden: !0,
|
|
2131
2134
|
width: s,
|
|
2132
2135
|
maskClosable: !1,
|
|
2133
|
-
children: /* @__PURE__ */ J(S, { children: /* @__PURE__ */ J(
|
|
2136
|
+
children: /* @__PURE__ */ J(S, { children: /* @__PURE__ */ J(Wr, {
|
|
2134
2137
|
resource: e,
|
|
2135
2138
|
id: t ?? void 0,
|
|
2136
2139
|
enabled: u,
|
|
@@ -2147,7 +2150,7 @@ function Wr({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
2147
2150
|
}
|
|
2148
2151
|
//#endregion
|
|
2149
2152
|
//#region src/crud/ListActionsBar.tsx
|
|
2150
|
-
function
|
|
2153
|
+
function Kr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelected: r, onSelectAllMatching: i, onClearSelection: o, actions: s, onExecute: c, selectedIds: u, running: f = !1 }) {
|
|
2151
2154
|
let [p, m] = d(), h = l(() => s.map((e) => ({
|
|
2152
2155
|
value: e.key,
|
|
2153
2156
|
label: e.label
|
|
@@ -2231,14 +2234,14 @@ function Gr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2231
2234
|
}
|
|
2232
2235
|
//#endregion
|
|
2233
2236
|
//#region src/crud/types.ts
|
|
2234
|
-
var
|
|
2237
|
+
var qr = new Set([
|
|
2235
2238
|
"page",
|
|
2236
2239
|
"perPage",
|
|
2237
2240
|
"sort",
|
|
2238
2241
|
"create",
|
|
2239
2242
|
"edit"
|
|
2240
|
-
]),
|
|
2241
|
-
function
|
|
2243
|
+
]), Jr = 1, Yr = 10;
|
|
2244
|
+
function Xr(e) {
|
|
2242
2245
|
if (e.includes(",")) {
|
|
2243
2246
|
let t = e.split(",").map((e) => e.trim()), n = t.map(Number);
|
|
2244
2247
|
return n.every((e) => Number.isFinite(e)) ? n : t;
|
|
@@ -2246,16 +2249,16 @@ function Yr(e) {
|
|
|
2246
2249
|
let t = Number(e);
|
|
2247
2250
|
return e !== "" && Number.isFinite(t) && String(t) === e ? t : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
2248
2251
|
}
|
|
2249
|
-
function
|
|
2252
|
+
function Zr(e) {
|
|
2250
2253
|
return e == null || e === "" ? null : Array.isArray(e) ? e.length === 0 ? null : e.map(String).join(",") : String(e);
|
|
2251
2254
|
}
|
|
2252
|
-
function
|
|
2255
|
+
function Qr(e) {
|
|
2253
2256
|
let [t, n] = b(), r = l(() => {
|
|
2254
|
-
let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) ||
|
|
2257
|
+
let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) || Jr) : Jr, a = r ? Math.max(1, Number(r) || Yr) : Yr, o = t.getAll("sort"), s = o.length > 0 ? o.flatMap((e) => Un(e)) : Un(t.get("sort")), c = { ...e };
|
|
2255
2258
|
return t.forEach((e, n) => {
|
|
2256
|
-
if (
|
|
2259
|
+
if (qr.has(n)) return;
|
|
2257
2260
|
let r = c[n];
|
|
2258
|
-
r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(
|
|
2261
|
+
r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(Xr) : c[n] = Xr(e) : c[n] = [...Array.isArray(r) ? r : [r], Xr(e)];
|
|
2259
2262
|
}), {
|
|
2260
2263
|
page: i,
|
|
2261
2264
|
perPage: a,
|
|
@@ -2278,19 +2281,19 @@ function Zr(e) {
|
|
|
2278
2281
|
},
|
|
2279
2282
|
setPerPage: (e) => {
|
|
2280
2283
|
i((t) => {
|
|
2281
|
-
e ===
|
|
2284
|
+
e === Yr ? t.delete("perPage") : t.set("perPage", String(e)), t.delete("page");
|
|
2282
2285
|
});
|
|
2283
2286
|
},
|
|
2284
2287
|
setSort: (e) => {
|
|
2285
2288
|
i((t) => {
|
|
2286
2289
|
t.delete("sort");
|
|
2287
|
-
let n =
|
|
2290
|
+
let n = Wn(e);
|
|
2288
2291
|
n && t.set("sort", n);
|
|
2289
2292
|
});
|
|
2290
2293
|
},
|
|
2291
2294
|
toggleSort: (e) => {
|
|
2292
2295
|
i((t) => {
|
|
2293
|
-
let n = t.getAll("sort").flatMap((e) =>
|
|
2296
|
+
let n = t.getAll("sort").flatMap((e) => Un(e)), r = n.findIndex((t) => t.field === e), i;
|
|
2294
2297
|
i = r < 0 ? [...n, {
|
|
2295
2298
|
field: e,
|
|
2296
2299
|
order: "ASC"
|
|
@@ -2298,22 +2301,22 @@ function Zr(e) {
|
|
|
2298
2301
|
...e,
|
|
2299
2302
|
order: "DESC"
|
|
2300
2303
|
} : e) : n.filter((e, t) => t !== r), t.delete("sort");
|
|
2301
|
-
let a =
|
|
2304
|
+
let a = Wn(i);
|
|
2302
2305
|
a && t.set("sort", a);
|
|
2303
2306
|
});
|
|
2304
2307
|
},
|
|
2305
2308
|
setFilter: (e, t) => {
|
|
2306
2309
|
i((n) => {
|
|
2307
2310
|
n.delete(e);
|
|
2308
|
-
let r =
|
|
2311
|
+
let r = Zr(t);
|
|
2309
2312
|
r != null && n.set(e, r), n.delete("page");
|
|
2310
2313
|
});
|
|
2311
2314
|
},
|
|
2312
2315
|
setFilters: (e) => {
|
|
2313
2316
|
i((t) => {
|
|
2314
|
-
for (let e of [...t.keys()])
|
|
2317
|
+
for (let e of [...t.keys()]) qr.has(e) || t.delete(e);
|
|
2315
2318
|
for (let [n, r] of Object.entries(e)) {
|
|
2316
|
-
let e =
|
|
2319
|
+
let e = Zr(r);
|
|
2317
2320
|
e != null && t.set(n, e);
|
|
2318
2321
|
}
|
|
2319
2322
|
t.delete("page");
|
|
@@ -2338,20 +2341,20 @@ function Zr(e) {
|
|
|
2338
2341
|
}
|
|
2339
2342
|
//#endregion
|
|
2340
2343
|
//#region src/crud/ResourceList.tsx
|
|
2341
|
-
var
|
|
2342
|
-
function
|
|
2343
|
-
return o(
|
|
2344
|
+
var $r = t(null);
|
|
2345
|
+
function ei() {
|
|
2346
|
+
return o($r);
|
|
2344
2347
|
}
|
|
2345
|
-
function
|
|
2348
|
+
function ti(e) {
|
|
2346
2349
|
return e == null || e === "" ? "—" : String(e);
|
|
2347
2350
|
}
|
|
2348
|
-
function
|
|
2351
|
+
function ni(e, t) {
|
|
2349
2352
|
if (e.length === 0 || !t.showEdit && !t.showQuickEdit) return e;
|
|
2350
2353
|
let [n, ...r] = e, i = n.render;
|
|
2351
2354
|
return [{
|
|
2352
2355
|
...n,
|
|
2353
2356
|
render: (e, n, r) => {
|
|
2354
|
-
let a = i ? i(e, n, r) :
|
|
2357
|
+
let a = i ? i(e, n, r) : ti(e);
|
|
2355
2358
|
return t.showEdit ? /* @__PURE__ */ J(f, {
|
|
2356
2359
|
to: `${t.pathPrefix}/${String(n.id)}`,
|
|
2357
2360
|
className: "ding-admin-row-edit-link",
|
|
@@ -2371,8 +2374,8 @@ function ti(e, t) {
|
|
|
2371
2374
|
}
|
|
2372
2375
|
}, ...r];
|
|
2373
2376
|
}
|
|
2374
|
-
function
|
|
2375
|
-
let x =
|
|
2377
|
+
function ri({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "page", formChildren: o, actions: s, rowActions: p, headerExtra: m, bulkActions: h, bulkDelete: g = !0, bulkActionsEnabled: _ = !0, permissions: v, queryState: y, queryActions: b }) {
|
|
2378
|
+
let x = Xt(), C = mt(), { message: E, modal: D } = S.useApp(), { token: O } = K.useToken(), { columns: k, sortOrders: A, sortPriorities: j } = Jn(), M = u(null), [N, P] = d(), [F, I] = d(!1), [L, ee] = d([]), [R, te] = d(0), [re, z] = d(() => /* @__PURE__ */ new Set()), [ie, B] = d(!1), ae = r ?? `${n}/new`, H = Z(C, v, "add"), oe = Z(C, v, "change"), U = Z(C, v, "delete"), ce = oe && (i === "page" || i === "both") && s?.edit !== !1, W = oe && (i === "modal" || i === "both") && s?.quickEdit !== !1, le = U && s?.delete !== !1, ue = ce || W || le || p, pe = a(() => {
|
|
2376
2379
|
z(/* @__PURE__ */ new Set());
|
|
2377
2380
|
}, []), me = l(() => {
|
|
2378
2381
|
if (!_) return [];
|
|
@@ -2489,7 +2492,7 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2489
2492
|
if (t?.aborted) return;
|
|
2490
2493
|
ee(n.data), te(n.total);
|
|
2491
2494
|
} catch (e) {
|
|
2492
|
-
|
|
2495
|
+
en(e) || E.error(e instanceof Error ? e.message : "Load failed");
|
|
2493
2496
|
} finally {
|
|
2494
2497
|
t?.aborted || I(!1);
|
|
2495
2498
|
}
|
|
@@ -2499,7 +2502,7 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2499
2502
|
Ce,
|
|
2500
2503
|
E
|
|
2501
2504
|
]);
|
|
2502
|
-
|
|
2505
|
+
Vr((e) => X(e), [X]);
|
|
2503
2506
|
let we = l(() => ({
|
|
2504
2507
|
reload: () => void X(),
|
|
2505
2508
|
clearSelection: pe
|
|
@@ -2579,7 +2582,7 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2579
2582
|
}
|
|
2580
2583
|
return t;
|
|
2581
2584
|
});
|
|
2582
|
-
if (!ue) return
|
|
2585
|
+
if (!ue) return ni(e, {
|
|
2583
2586
|
showEdit: ce,
|
|
2584
2587
|
showQuickEdit: W,
|
|
2585
2588
|
pathPrefix: n,
|
|
@@ -2619,7 +2622,7 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2619
2622
|
]
|
|
2620
2623
|
})
|
|
2621
2624
|
};
|
|
2622
|
-
return
|
|
2625
|
+
return ni([...e, r], {
|
|
2623
2626
|
showEdit: ce,
|
|
2624
2627
|
showQuickEdit: W,
|
|
2625
2628
|
pathPrefix: n,
|
|
@@ -2670,7 +2673,7 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2670
2673
|
children: "New"
|
|
2671
2674
|
})
|
|
2672
2675
|
}) : null] }) : null,
|
|
2673
|
-
children: [he ? /* @__PURE__ */ J(
|
|
2676
|
+
children: [he ? /* @__PURE__ */ J(Kr, {
|
|
2674
2677
|
selectedCount: ge,
|
|
2675
2678
|
total: R,
|
|
2676
2679
|
allPageSelected: _e,
|
|
@@ -2717,7 +2720,7 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2717
2720
|
})
|
|
2718
2721
|
})]
|
|
2719
2722
|
})]
|
|
2720
|
-
}), ke ? /* @__PURE__ */ J(
|
|
2723
|
+
}), ke ? /* @__PURE__ */ J(Gr, {
|
|
2721
2724
|
resource: e,
|
|
2722
2725
|
editId: y.createModal ? "new" : y.editId,
|
|
2723
2726
|
onClose: () => {
|
|
@@ -2726,8 +2729,8 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2726
2729
|
children: o
|
|
2727
2730
|
}) : null] });
|
|
2728
2731
|
}
|
|
2729
|
-
function
|
|
2730
|
-
let [y, b] =
|
|
2732
|
+
function ii({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i, textFilterDebounceMs: o, editMode: s = "page", syncQueryParams: c = !0, children: u, formChildren: d, actions: f, rowActions: p, headerExtra: m, bulkActions: h, bulkDelete: g, bulkActionsEnabled: _, permissions: v }) {
|
|
2733
|
+
let [y, b] = Qr(i), x = l(() => {
|
|
2731
2734
|
if (!c) return i ?? {};
|
|
2732
2735
|
let e = {};
|
|
2733
2736
|
for (let [t, n] of Object.entries(y.filter)) i && t in i || (e[t] = n);
|
|
@@ -2742,18 +2745,18 @@ function ri({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2742
2745
|
filterValues: x,
|
|
2743
2746
|
setFilterValue: S
|
|
2744
2747
|
}), [x, S]);
|
|
2745
|
-
return /* @__PURE__ */ J(
|
|
2748
|
+
return /* @__PURE__ */ J($r.Provider, {
|
|
2746
2749
|
value: C,
|
|
2747
|
-
children: /* @__PURE__ */ J(
|
|
2750
|
+
children: /* @__PURE__ */ J(nr, {
|
|
2748
2751
|
values: x,
|
|
2749
2752
|
setFilterValue: S,
|
|
2750
2753
|
textFilterDebounceMs: o,
|
|
2751
|
-
children: /* @__PURE__ */ J(
|
|
2754
|
+
children: /* @__PURE__ */ J(qn, {
|
|
2752
2755
|
toggleSort: b.toggleSort,
|
|
2753
2756
|
sort: y.sort,
|
|
2754
2757
|
children: /* @__PURE__ */ Y("div", {
|
|
2755
2758
|
className: "ding-admin-resource-list-root",
|
|
2756
|
-
children: [u, /* @__PURE__ */ J(
|
|
2759
|
+
children: [u, /* @__PURE__ */ J(ri, {
|
|
2757
2760
|
resource: e,
|
|
2758
2761
|
title: t,
|
|
2759
2762
|
pathPrefix: n,
|
|
@@ -2777,8 +2780,8 @@ function ri({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2777
2780
|
}
|
|
2778
2781
|
//#endregion
|
|
2779
2782
|
//#region src/crud/FilterBar.tsx
|
|
2780
|
-
function
|
|
2781
|
-
let e =
|
|
2783
|
+
function ai() {
|
|
2784
|
+
let e = rr();
|
|
2782
2785
|
return !e || e.filters.length === 0 ? null : /* @__PURE__ */ J(V, {
|
|
2783
2786
|
wrap: !0,
|
|
2784
2787
|
size: "middle",
|
|
@@ -2797,12 +2800,12 @@ function ii() {
|
|
|
2797
2800
|
}, t.key))
|
|
2798
2801
|
});
|
|
2799
2802
|
}
|
|
2800
|
-
function
|
|
2801
|
-
return /* @__PURE__ */ Y(q, { children: [e, /* @__PURE__ */ J(
|
|
2803
|
+
function oi({ children: e }) {
|
|
2804
|
+
return /* @__PURE__ */ Y(q, { children: [e, /* @__PURE__ */ J(ai, {})] });
|
|
2802
2805
|
}
|
|
2803
2806
|
//#endregion
|
|
2804
2807
|
//#region src/crud/ResourceForm.tsx
|
|
2805
|
-
function
|
|
2808
|
+
function si({ resource: e, title: t, listPath: n, children: r, defaultValues: i, onSaved: a, stayOnPage: o, permissions: c }) {
|
|
2806
2809
|
let { id: l } = y(), u = l === "new" || !l, d = mt(), p = v(), { token: m } = K.useToken();
|
|
2807
2810
|
s(() => {
|
|
2808
2811
|
c && (Z(d, c, u ? "add" : "change") || p(n, { replace: !0 }));
|
|
@@ -2824,7 +2827,7 @@ function oi({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2824
2827
|
style: { margin: 0 },
|
|
2825
2828
|
children: t
|
|
2826
2829
|
})] }),
|
|
2827
|
-
children: /* @__PURE__ */ J(
|
|
2830
|
+
children: /* @__PURE__ */ J(Wr, {
|
|
2828
2831
|
resource: e,
|
|
2829
2832
|
id: l,
|
|
2830
2833
|
defaultValues: i,
|
|
@@ -2840,33 +2843,33 @@ function oi({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2840
2843
|
}
|
|
2841
2844
|
//#endregion
|
|
2842
2845
|
//#region src/crud/HiddenSources.tsx
|
|
2843
|
-
var
|
|
2844
|
-
function
|
|
2846
|
+
var ci = t(/* @__PURE__ */ new Set());
|
|
2847
|
+
function li(e, t, n) {
|
|
2845
2848
|
return !!t || n.has(e);
|
|
2846
2849
|
}
|
|
2847
|
-
function
|
|
2848
|
-
return o(
|
|
2850
|
+
function ui() {
|
|
2851
|
+
return o(ci);
|
|
2849
2852
|
}
|
|
2850
|
-
function
|
|
2853
|
+
function di({ sources: e, children: t }) {
|
|
2851
2854
|
let n = l(() => e instanceof Set ? e : new Set(e), [e]);
|
|
2852
|
-
return n.size === 0 ? t : /* @__PURE__ */ J(
|
|
2855
|
+
return n.size === 0 ? t : /* @__PURE__ */ J(ci.Provider, {
|
|
2853
2856
|
value: n,
|
|
2854
2857
|
children: t
|
|
2855
2858
|
});
|
|
2856
2859
|
}
|
|
2857
2860
|
//#endregion
|
|
2858
2861
|
//#region src/crud/utils/nestedFieldPath.ts
|
|
2859
|
-
function
|
|
2862
|
+
function fi(e, t, n) {
|
|
2860
2863
|
return `${e}.${t}.${n}`;
|
|
2861
2864
|
}
|
|
2862
2865
|
//#endregion
|
|
2863
2866
|
//#region src/crud/InlineFormSet.tsx
|
|
2864
|
-
function
|
|
2867
|
+
function pi(e, t) {
|
|
2865
2868
|
let n = {};
|
|
2866
|
-
for (let r of e)
|
|
2869
|
+
for (let r of e) Sr(n, r, t ? xr(t, r) : void 0);
|
|
2867
2870
|
return n;
|
|
2868
2871
|
}
|
|
2869
|
-
function
|
|
2872
|
+
function mi(e, t, n) {
|
|
2870
2873
|
let { control: r } = je(), { fields: i, append: a, remove: o } = ke({
|
|
2871
2874
|
control: r,
|
|
2872
2875
|
name: e,
|
|
@@ -2875,12 +2878,12 @@ function pi(e, t, n) {
|
|
|
2875
2878
|
return {
|
|
2876
2879
|
fields: i,
|
|
2877
2880
|
remove: o,
|
|
2878
|
-
appendEmpty: () => a(
|
|
2881
|
+
appendEmpty: () => a(pi(t, n))
|
|
2879
2882
|
};
|
|
2880
2883
|
}
|
|
2881
|
-
function
|
|
2882
|
-
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } =
|
|
2883
|
-
|
|
2884
|
+
function hi({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, defaultRow: a }) {
|
|
2885
|
+
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } = mi(e, o, a);
|
|
2886
|
+
mr(e), yr(e, o, n, r);
|
|
2884
2887
|
let d = l(() => i.map((t) => ({
|
|
2885
2888
|
title: t.label ?? t.source,
|
|
2886
2889
|
key: t.source,
|
|
@@ -2888,7 +2891,7 @@ function mi({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2888
2891
|
onHeaderCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2889
2892
|
onCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2890
2893
|
render: (n, r, i) => t.cell({
|
|
2891
|
-
name:
|
|
2894
|
+
name: fi(e, i, t.source),
|
|
2892
2895
|
index: i,
|
|
2893
2896
|
field: e
|
|
2894
2897
|
})
|
|
@@ -2930,9 +2933,9 @@ function mi({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2930
2933
|
]
|
|
2931
2934
|
});
|
|
2932
2935
|
}
|
|
2933
|
-
function
|
|
2934
|
-
let { fields: l, remove: u, appendEmpty: d } =
|
|
2935
|
-
return
|
|
2936
|
+
function gi({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, renderRow: a, getCardTitle: o, footer: s, defaultRow: c }) {
|
|
2937
|
+
let { fields: l, remove: u, appendEmpty: d } = mi(e, i, c);
|
|
2938
|
+
return mr(e), yr(e, i, n, r), /* @__PURE__ */ Y("div", {
|
|
2936
2939
|
style: { marginTop: 24 },
|
|
2937
2940
|
children: [
|
|
2938
2941
|
/* @__PURE__ */ J(G.Title, {
|
|
@@ -2947,7 +2950,7 @@ function hi({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2947
2950
|
let r = {
|
|
2948
2951
|
field: e,
|
|
2949
2952
|
index: n,
|
|
2950
|
-
name: (t) =>
|
|
2953
|
+
name: (t) => fi(e, n, t)
|
|
2951
2954
|
};
|
|
2952
2955
|
return /* @__PURE__ */ J(T, {
|
|
2953
2956
|
size: "small",
|
|
@@ -2975,22 +2978,22 @@ function hi({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2975
2978
|
}
|
|
2976
2979
|
//#endregion
|
|
2977
2980
|
//#region src/crud/utils/formSectionErrors.ts
|
|
2978
|
-
function
|
|
2981
|
+
function _i(e, t, n) {
|
|
2979
2982
|
for (let r of e) if (t(r, n).invalid) return !0;
|
|
2980
2983
|
return !1;
|
|
2981
2984
|
}
|
|
2982
|
-
function
|
|
2985
|
+
function vi(e) {
|
|
2983
2986
|
let t = u([]);
|
|
2984
2987
|
for (; t.current.length < e;) t.current.push({ current: /* @__PURE__ */ new Set() });
|
|
2985
2988
|
return t.current.length > e && (t.current.length = e), t.current;
|
|
2986
2989
|
}
|
|
2987
|
-
function
|
|
2990
|
+
function yi(e, t) {
|
|
2988
2991
|
let { control: n, getFieldState: r, setFocus: i } = je(), a = Me({ control: n }), o = u(0), c = u(0);
|
|
2989
2992
|
s(() => {
|
|
2990
2993
|
if (a.submitCount === 0) return;
|
|
2991
2994
|
let n = Object.keys(a.errors).length, s = a.submitCount !== o.current, l = !s && n > 0 && c.current === 0;
|
|
2992
2995
|
if (o.current = a.submitCount, c.current = n, !s && !l || n === 0) return;
|
|
2993
|
-
let u = e.findIndex((e) =>
|
|
2996
|
+
let u = e.findIndex((e) => _i(e.current, r, a));
|
|
2994
2997
|
if (u < 0) return;
|
|
2995
2998
|
t(u);
|
|
2996
2999
|
let d = [...e[u].current].find((e) => r(e, a).invalid);
|
|
@@ -3009,22 +3012,22 @@ function vi(e, t) {
|
|
|
3009
3012
|
}
|
|
3010
3013
|
//#endregion
|
|
3011
3014
|
//#region src/crud/FormTabs.tsx
|
|
3012
|
-
function
|
|
3015
|
+
function bi(e) {
|
|
3013
3016
|
return null;
|
|
3014
3017
|
}
|
|
3015
|
-
function
|
|
3016
|
-
return i(e) && e.type ===
|
|
3018
|
+
function xi(e) {
|
|
3019
|
+
return i(e) && e.type === bi;
|
|
3017
3020
|
}
|
|
3018
|
-
function
|
|
3019
|
-
let { token: s } = K.useToken(), c = l(() => e.toArray(t).filter(
|
|
3021
|
+
function Si({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o }) {
|
|
3022
|
+
let { token: s } = K.useToken(), c = l(() => e.toArray(t).filter(xi).map((e, t) => ({
|
|
3020
3023
|
key: e.key ?? String(t),
|
|
3021
3024
|
label: e.props.label,
|
|
3022
3025
|
disabled: e.props.disabled,
|
|
3023
3026
|
children: e.props.children
|
|
3024
|
-
})), [t]), u =
|
|
3027
|
+
})), [t]), u = vi(c.length), f = r !== void 0, [p, m] = d(() => n ?? c[0]?.key ?? "0"), h = f ? r : p, g = a((e) => {
|
|
3025
3028
|
f || m(e), i?.(e);
|
|
3026
3029
|
}, [f, i]);
|
|
3027
|
-
|
|
3030
|
+
yi(u, a((e) => {
|
|
3028
3031
|
let t = c[e]?.key;
|
|
3029
3032
|
t != null && g(t);
|
|
3030
3033
|
}, [g, c]));
|
|
@@ -3032,7 +3035,7 @@ function xi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
3032
3035
|
return /* @__PURE__ */ J(U, {
|
|
3033
3036
|
destroyOnHidden: !1,
|
|
3034
3037
|
items: l(() => c.map((e, t) => {
|
|
3035
|
-
let n =
|
|
3038
|
+
let n = _i(u[t].current, v, y);
|
|
3036
3039
|
return {
|
|
3037
3040
|
key: e.key,
|
|
3038
3041
|
label: n ? /* @__PURE__ */ J("span", {
|
|
@@ -3040,7 +3043,7 @@ function xi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
3040
3043
|
children: e.label
|
|
3041
3044
|
}) : e.label,
|
|
3042
3045
|
disabled: e.disabled,
|
|
3043
|
-
children: /* @__PURE__ */ J(
|
|
3046
|
+
children: /* @__PURE__ */ J(lr, {
|
|
3044
3047
|
sourcesRef: u[t],
|
|
3045
3048
|
children: e.children
|
|
3046
3049
|
})
|
|
@@ -3059,17 +3062,17 @@ function xi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
3059
3062
|
}
|
|
3060
3063
|
//#endregion
|
|
3061
3064
|
//#region src/crud/FormSteps.tsx
|
|
3062
|
-
function
|
|
3065
|
+
function Ci(e) {
|
|
3063
3066
|
return null;
|
|
3064
3067
|
}
|
|
3065
|
-
function
|
|
3066
|
-
return i(e) && e.type ===
|
|
3068
|
+
function wi(e) {
|
|
3069
|
+
return i(e) && e.type === Ci;
|
|
3067
3070
|
}
|
|
3068
|
-
function
|
|
3069
|
-
let m = l(() => e.toArray(t).filter(
|
|
3070
|
-
|
|
3071
|
+
function Ti({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStepSelect: i = !1, stepsStyle: o, navigationStyle: s, size: c, direction: u, type: f, status: p }) {
|
|
3072
|
+
let m = l(() => e.toArray(t).filter(wi), [t]), h = vi(m.length), [g, _] = d(n), v = m.length - 1;
|
|
3073
|
+
yi(h, _);
|
|
3071
3074
|
let { control: y, getFieldState: b } = je(), x = Me({ control: y }), S = l(() => m.map((e, t) => {
|
|
3072
|
-
let n =
|
|
3075
|
+
let n = _i(h[t].current, b, x);
|
|
3073
3076
|
return {
|
|
3074
3077
|
title: e.props.title,
|
|
3075
3078
|
description: e.props.description,
|
|
@@ -3099,7 +3102,7 @@ function wi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
3099
3102
|
}),
|
|
3100
3103
|
m.map((e, t) => /* @__PURE__ */ J("div", {
|
|
3101
3104
|
style: { display: g === t ? void 0 : "none" },
|
|
3102
|
-
children: /* @__PURE__ */ J(
|
|
3105
|
+
children: /* @__PURE__ */ J(lr, {
|
|
3103
3106
|
sourcesRef: h[t],
|
|
3104
3107
|
children: e.props.children
|
|
3105
3108
|
})
|
|
@@ -3124,14 +3127,14 @@ function wi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
3124
3127
|
}
|
|
3125
3128
|
//#endregion
|
|
3126
3129
|
//#region src/crud/utils/shouldRegisterSourceInPayload.ts
|
|
3127
|
-
function
|
|
3130
|
+
function Ei(e, t) {
|
|
3128
3131
|
return t == null || t === e;
|
|
3129
3132
|
}
|
|
3130
3133
|
//#endregion
|
|
3131
3134
|
//#region src/crud/fields/FieldWrapper.tsx
|
|
3132
3135
|
function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, children: s }) {
|
|
3133
|
-
let c = t ?? e, l =
|
|
3134
|
-
return
|
|
3136
|
+
let c = t ?? e, l = Ei(e, t), u = li(e, o, ui()), { control: d } = je(), f = sr(), p = a ? void 0 : n ?? e, m = n ?? e;
|
|
3137
|
+
return mr(e, l), hr(e, l), u ? /* @__PURE__ */ J(De, {
|
|
3135
3138
|
name: c,
|
|
3136
3139
|
control: d,
|
|
3137
3140
|
render: () => /* @__PURE__ */ J(q, {})
|
|
@@ -3160,7 +3163,7 @@ function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3160
3163
|
}
|
|
3161
3164
|
//#endregion
|
|
3162
3165
|
//#region src/crud/fields/TextField.tsx
|
|
3163
|
-
function
|
|
3166
|
+
function Di({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s, hidden: c }) {
|
|
3164
3167
|
return /* @__PURE__ */ J($, {
|
|
3165
3168
|
source: e,
|
|
3166
3169
|
name: t,
|
|
@@ -3181,7 +3184,7 @@ function Ei({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3181
3184
|
}
|
|
3182
3185
|
//#endregion
|
|
3183
3186
|
//#region src/crud/fields/TextAreaField.tsx
|
|
3184
|
-
function
|
|
3187
|
+
function Oi({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s, hidden: c, rows: l = 4, maxLength: u, showCount: d, autoSize: f }) {
|
|
3185
3188
|
return /* @__PURE__ */ J($, {
|
|
3186
3189
|
source: e,
|
|
3187
3190
|
name: t,
|
|
@@ -3206,7 +3209,7 @@ function Di({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3206
3209
|
}
|
|
3207
3210
|
//#endregion
|
|
3208
3211
|
//#region src/crud/fields/NumberField.tsx
|
|
3209
|
-
function
|
|
3212
|
+
function ki({ source: e, name: t, label: n, required: r, rules: i, min: a, max: o, step: s, inputStyle: c, hideLabel: l, hidden: u }) {
|
|
3210
3213
|
return /* @__PURE__ */ J($, {
|
|
3211
3214
|
source: e,
|
|
3212
3215
|
name: t,
|
|
@@ -3232,7 +3235,7 @@ function Oi({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3232
3235
|
}
|
|
3233
3236
|
//#endregion
|
|
3234
3237
|
//#region src/crud/fields/BooleanField.tsx
|
|
3235
|
-
function
|
|
3238
|
+
function Ai({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, disabled: s }) {
|
|
3236
3239
|
return /* @__PURE__ */ J($, {
|
|
3237
3240
|
source: e,
|
|
3238
3241
|
name: t,
|
|
@@ -3250,7 +3253,7 @@ function ki({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3250
3253
|
}
|
|
3251
3254
|
//#endregion
|
|
3252
3255
|
//#region src/crud/utils/parseDayjsValue.ts
|
|
3253
|
-
var
|
|
3256
|
+
var ji = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
3254
3257
|
(function(n, r) {
|
|
3255
3258
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_customParseFormat = r();
|
|
3256
3259
|
})(e, (function() {
|
|
@@ -3407,8 +3410,8 @@ var Ai = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
|
3407
3410
|
};
|
|
3408
3411
|
}));
|
|
3409
3412
|
})))(), 1);
|
|
3410
|
-
Pe.extend(
|
|
3411
|
-
function
|
|
3413
|
+
Pe.extend(ji.default);
|
|
3414
|
+
function Mi(e, t) {
|
|
3412
3415
|
if (e == null || e === "") return null;
|
|
3413
3416
|
if (Pe.isDayjs(e)) return e;
|
|
3414
3417
|
let n = Pe(String(e), t, !0);
|
|
@@ -3416,13 +3419,13 @@ function ji(e, t) {
|
|
|
3416
3419
|
}
|
|
3417
3420
|
//#endregion
|
|
3418
3421
|
//#region src/crud/fields/DateField.tsx
|
|
3419
|
-
var
|
|
3420
|
-
Mi,
|
|
3422
|
+
var Ni = "YYYY-MM-DD", Pi = `${Ni} HH:mm:ss`, Fi = [
|
|
3421
3423
|
Ni,
|
|
3424
|
+
Pi,
|
|
3422
3425
|
"YYYY-MM-DDTHH:mm:ss",
|
|
3423
3426
|
"YYYY-MM-DDTHH:mm:ssZ"
|
|
3424
3427
|
];
|
|
3425
|
-
function
|
|
3428
|
+
function Ii({ source: e, name: t, label: n, required: r, rules: i, showTime: a, hideLabel: o, hidden: s }) {
|
|
3426
3429
|
return /* @__PURE__ */ J($, {
|
|
3427
3430
|
source: e,
|
|
3428
3431
|
name: t,
|
|
@@ -3432,33 +3435,33 @@ function Fi({ source: e, name: t, label: n, required: r, rules: i, showTime: a,
|
|
|
3432
3435
|
hideLabel: o,
|
|
3433
3436
|
hidden: s,
|
|
3434
3437
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(O, {
|
|
3435
|
-
value:
|
|
3436
|
-
onChange: (e) => t(e ? e.format(a ?
|
|
3438
|
+
value: Mi(e, a ? [...Fi, Pi] : Fi),
|
|
3439
|
+
onChange: (e) => t(e ? e.format(a ? Pi : Ni) : null),
|
|
3437
3440
|
onBlur: n,
|
|
3438
3441
|
showTime: a,
|
|
3439
3442
|
disabled: r,
|
|
3440
|
-
format: a ?
|
|
3443
|
+
format: a ? Pi : Ni,
|
|
3441
3444
|
style: { width: "100%" }
|
|
3442
3445
|
})
|
|
3443
3446
|
});
|
|
3444
3447
|
}
|
|
3445
3448
|
//#endregion
|
|
3446
3449
|
//#region src/crud/fields/DateTimeField.tsx
|
|
3447
|
-
function
|
|
3448
|
-
return /* @__PURE__ */ J(
|
|
3450
|
+
function Li(e) {
|
|
3451
|
+
return /* @__PURE__ */ J(Ii, {
|
|
3449
3452
|
showTime: !0,
|
|
3450
3453
|
...e
|
|
3451
3454
|
});
|
|
3452
3455
|
}
|
|
3453
3456
|
//#endregion
|
|
3454
3457
|
//#region src/crud/fields/TimeField.tsx
|
|
3455
|
-
var
|
|
3456
|
-
|
|
3458
|
+
var Ri = "HH:mm:ss", zi = [
|
|
3459
|
+
Ri,
|
|
3457
3460
|
"HH:mm",
|
|
3458
3461
|
"H:mm:ss",
|
|
3459
3462
|
"H:mm"
|
|
3460
3463
|
];
|
|
3461
|
-
function
|
|
3464
|
+
function Bi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, format: s = Ri }) {
|
|
3462
3465
|
return /* @__PURE__ */ J($, {
|
|
3463
3466
|
source: e,
|
|
3464
3467
|
name: t,
|
|
@@ -3468,7 +3471,7 @@ function zi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3468
3471
|
hideLabel: a,
|
|
3469
3472
|
hidden: o,
|
|
3470
3473
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(ce, {
|
|
3471
|
-
value:
|
|
3474
|
+
value: Mi(e, zi),
|
|
3472
3475
|
onChange: (e) => t(e ? e.format(s) : null),
|
|
3473
3476
|
onBlur: n,
|
|
3474
3477
|
disabled: r,
|
|
@@ -3479,7 +3482,7 @@ function zi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3479
3482
|
}
|
|
3480
3483
|
//#endregion
|
|
3481
3484
|
//#region src/crud/fields/SelectField.tsx
|
|
3482
|
-
function
|
|
3485
|
+
function Vi({ source: e, name: t, label: n, required: r, rules: i, choices: a, mode: o, allowClear: s, hideLabel: c, hidden: l }) {
|
|
3483
3486
|
return /* @__PURE__ */ J($, {
|
|
3484
3487
|
source: e,
|
|
3485
3488
|
name: t,
|
|
@@ -3490,7 +3493,7 @@ function Bi({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3490
3493
|
hidden: l,
|
|
3491
3494
|
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(B, {
|
|
3492
3495
|
value: e,
|
|
3493
|
-
onChange: t,
|
|
3496
|
+
onChange: (e) => t(e ?? null),
|
|
3494
3497
|
options: a,
|
|
3495
3498
|
mode: o,
|
|
3496
3499
|
allowClear: s,
|
|
@@ -3501,7 +3504,7 @@ function Bi({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3501
3504
|
}
|
|
3502
3505
|
//#endregion
|
|
3503
3506
|
//#region src/crud/fields/PasswordField.tsx
|
|
3504
|
-
function
|
|
3507
|
+
function Hi({ source: e, name: t, label: n, required: r, rules: i, autoComplete: a, hideLabel: o, hidden: s }) {
|
|
3505
3508
|
return /* @__PURE__ */ J($, {
|
|
3506
3509
|
source: e,
|
|
3507
3510
|
name: t,
|
|
@@ -3519,12 +3522,12 @@ function Vi({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3519
3522
|
})
|
|
3520
3523
|
});
|
|
3521
3524
|
}
|
|
3522
|
-
function
|
|
3525
|
+
function Ui({ source: e, name: t, label: n, required: r, rules: i, confirmSource: a, confirmLabel: o = "Confirm password", autoComplete: s = "new-password", hideLabel: c, hidden: l }) {
|
|
3523
3526
|
let u = Ne({
|
|
3524
3527
|
name: t ?? e,
|
|
3525
3528
|
disabled: !a
|
|
3526
3529
|
});
|
|
3527
|
-
return a ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(
|
|
3530
|
+
return a ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(Hi, {
|
|
3528
3531
|
source: e,
|
|
3529
3532
|
name: t,
|
|
3530
3533
|
label: n,
|
|
@@ -3533,7 +3536,7 @@ function Hi({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3533
3536
|
autoComplete: s,
|
|
3534
3537
|
hideLabel: c,
|
|
3535
3538
|
hidden: l
|
|
3536
|
-
}), /* @__PURE__ */ J(
|
|
3539
|
+
}), /* @__PURE__ */ J(Hi, {
|
|
3537
3540
|
source: a,
|
|
3538
3541
|
label: o,
|
|
3539
3542
|
required: r,
|
|
@@ -3541,7 +3544,7 @@ function Hi({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3541
3544
|
hideLabel: c,
|
|
3542
3545
|
rules: { validate: (e) => !u || e === u || "Passwords do not match" },
|
|
3543
3546
|
hidden: l
|
|
3544
|
-
})] }) : /* @__PURE__ */ J(
|
|
3547
|
+
})] }) : /* @__PURE__ */ J(Hi, {
|
|
3545
3548
|
source: e,
|
|
3546
3549
|
name: t,
|
|
3547
3550
|
label: n,
|
|
@@ -3554,54 +3557,54 @@ function Hi({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3554
3557
|
}
|
|
3555
3558
|
//#endregion
|
|
3556
3559
|
//#region src/crud/utils/choiceSelectionUtils.ts
|
|
3557
|
-
function
|
|
3560
|
+
function Wi(e, t) {
|
|
3558
3561
|
return typeof e == "object" && !!e && !Array.isArray(e) && t in e;
|
|
3559
3562
|
}
|
|
3560
|
-
function
|
|
3563
|
+
function Gi(e, t) {
|
|
3561
3564
|
if (!(e == null || e === "")) {
|
|
3562
|
-
if (
|
|
3565
|
+
if (Wi(e, t)) {
|
|
3563
3566
|
let n = e[t];
|
|
3564
3567
|
return typeof n == "string" || typeof n == "number" ? n : void 0;
|
|
3565
3568
|
}
|
|
3566
3569
|
if (typeof e == "string" || typeof e == "number") return e;
|
|
3567
3570
|
}
|
|
3568
3571
|
}
|
|
3569
|
-
function Gi(e, t) {
|
|
3570
|
-
return Array.isArray(e) ? e.map((e) => Wi(e, t)).filter((e) => e != null) : [];
|
|
3571
|
-
}
|
|
3572
3572
|
function Ki(e, t) {
|
|
3573
|
-
return
|
|
3573
|
+
return Array.isArray(e) ? e.map((e) => Gi(e, t)).filter((e) => e != null) : [];
|
|
3574
3574
|
}
|
|
3575
|
-
function qi(e, t
|
|
3575
|
+
function qi(e, t) {
|
|
3576
|
+
return e == null ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "").map((e) => Wi(e, t) ? e[t] : e);
|
|
3577
|
+
}
|
|
3578
|
+
function Ji(e, t, n) {
|
|
3576
3579
|
let r = [];
|
|
3577
|
-
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) =>
|
|
3580
|
+
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) => Wi(e, n))) : Wi(t, n) && r.push(t)), e == null) return r;
|
|
3578
3581
|
let i = Array.isArray(e) ? e : [e];
|
|
3579
|
-
for (let e of i)
|
|
3582
|
+
for (let e of i) Wi(e, n) && r.push(e);
|
|
3580
3583
|
return r;
|
|
3581
3584
|
}
|
|
3582
|
-
function
|
|
3585
|
+
function Yi(e, t) {
|
|
3583
3586
|
return typeof t == "function" ? t(e) : String(e[t] ?? "");
|
|
3584
3587
|
}
|
|
3585
|
-
function
|
|
3588
|
+
function Xi(e, t, n) {
|
|
3586
3589
|
return e.map((e) => ({
|
|
3587
|
-
label:
|
|
3590
|
+
label: Yi(e, t),
|
|
3588
3591
|
value: e[n],
|
|
3589
3592
|
record: e
|
|
3590
3593
|
}));
|
|
3591
3594
|
}
|
|
3592
|
-
function
|
|
3595
|
+
function Zi(e, t) {
|
|
3593
3596
|
let n = /* @__PURE__ */ new Map();
|
|
3594
3597
|
for (let t of e) n.set(t.value, t);
|
|
3595
3598
|
for (let e of t) n.set(e.value, e);
|
|
3596
3599
|
return Array.from(n.values());
|
|
3597
3600
|
}
|
|
3598
|
-
function
|
|
3601
|
+
function Qi(e, t) {
|
|
3599
3602
|
return e.filter((e) => !t.some((t) => t.value === e));
|
|
3600
3603
|
}
|
|
3601
|
-
function
|
|
3602
|
-
return
|
|
3604
|
+
function $i(e, t, n = []) {
|
|
3605
|
+
return Zi(n, e.filter((e) => t.some((t) => e.value === t)));
|
|
3603
3606
|
}
|
|
3604
|
-
function
|
|
3607
|
+
function ea(e = {}) {
|
|
3605
3608
|
let t = e.popupMatchSelectWidth ?? !1;
|
|
3606
3609
|
return t === !1 ? {
|
|
3607
3610
|
popupMatchSelectWidth: !1,
|
|
@@ -3610,27 +3613,27 @@ function $i(e = {}) {
|
|
|
3610
3613
|
}
|
|
3611
3614
|
//#endregion
|
|
3612
3615
|
//#region src/crud/utils/referenceSelectNotFoundContent.tsx
|
|
3613
|
-
function
|
|
3616
|
+
function ta(e) {
|
|
3614
3617
|
return e ? /* @__PURE__ */ J(ae, { size: "small" }) : void 0;
|
|
3615
3618
|
}
|
|
3616
3619
|
//#endregion
|
|
3617
3620
|
//#region src/crud/utils/referenceSelectSelectedProps.ts
|
|
3618
|
-
function
|
|
3621
|
+
function na(e, t, n) {
|
|
3619
3622
|
return {
|
|
3620
3623
|
loading: e || t,
|
|
3621
3624
|
disabled: !!(n || t)
|
|
3622
3625
|
};
|
|
3623
3626
|
}
|
|
3624
|
-
function
|
|
3627
|
+
function ra(e, t, n) {
|
|
3625
3628
|
return e ? n : t;
|
|
3626
3629
|
}
|
|
3627
3630
|
//#endregion
|
|
3628
3631
|
//#region src/crud/utils/useChoices.ts
|
|
3629
|
-
var
|
|
3630
|
-
function
|
|
3632
|
+
var ia = /* @__PURE__ */ new Map(), aa = /* @__PURE__ */ new Map();
|
|
3633
|
+
function oa(e, t) {
|
|
3631
3634
|
return typeof e == "function" ? `fn:${t ?? ""}` : Array.isArray(e) ? `static:${e.length}` : `res:${e.resource}:${JSON.stringify(e.filter ?? {})}:${t ?? ""}`;
|
|
3632
3635
|
}
|
|
3633
|
-
async function
|
|
3636
|
+
async function sa(e, t, n, r, i) {
|
|
3634
3637
|
return typeof e == "function" ? e({
|
|
3635
3638
|
dataProvider: t,
|
|
3636
3639
|
search: i
|
|
@@ -3644,26 +3647,26 @@ async function oa(e, t, n, r, i) {
|
|
|
3644
3647
|
perPage: 500
|
|
3645
3648
|
}
|
|
3646
3649
|
})).data.map((e) => ({
|
|
3647
|
-
label:
|
|
3650
|
+
label: Yi(e, n),
|
|
3648
3651
|
value: e[r],
|
|
3649
3652
|
record: e
|
|
3650
3653
|
}));
|
|
3651
3654
|
}
|
|
3652
|
-
function
|
|
3653
|
-
let o =
|
|
3655
|
+
function ca(e, t, n, r, i, a) {
|
|
3656
|
+
let o = oa(e, i);
|
|
3654
3657
|
if (a) {
|
|
3655
|
-
let e =
|
|
3658
|
+
let e = ia.get(o);
|
|
3656
3659
|
if (e && !i) return Promise.resolve(e);
|
|
3657
3660
|
}
|
|
3658
|
-
let s =
|
|
3661
|
+
let s = aa.get(o);
|
|
3659
3662
|
if (s) return s;
|
|
3660
|
-
let c =
|
|
3661
|
-
|
|
3663
|
+
let c = sa(e, t, n, r, i).then((e) => (a && !i && ia.set(o, e), e)).finally(() => {
|
|
3664
|
+
aa.delete(o);
|
|
3662
3665
|
});
|
|
3663
|
-
return
|
|
3666
|
+
return aa.set(o, c), c;
|
|
3664
3667
|
}
|
|
3665
|
-
function
|
|
3666
|
-
let { lazy: c = !1, active: f = !1, selectedValues: p, selectedRecords: m, fetchSelected: h = !0, cache: g } = o, _ = g ?? !c, v =
|
|
3668
|
+
function la(e, t, n = "name", r = "id", i, o = {}) {
|
|
3669
|
+
let { lazy: c = !1, active: f = !1, selectedValues: p, selectedRecords: m, fetchSelected: h = !0, cache: g } = o, _ = g ?? !c, v = Xt(), y = l(() => {
|
|
3667
3670
|
if (e) return e;
|
|
3668
3671
|
if (t) return {
|
|
3669
3672
|
resource: t,
|
|
@@ -3673,16 +3676,16 @@ function ca(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3673
3676
|
e,
|
|
3674
3677
|
t,
|
|
3675
3678
|
i
|
|
3676
|
-
]), b = y ?
|
|
3679
|
+
]), b = y ? oa(y, i) : void 0, x = l(() => qi(p, r), [p, r]), S = l(() => Xi(Ji(p, m, r), n, r), [
|
|
3677
3680
|
p,
|
|
3678
3681
|
m,
|
|
3679
3682
|
n,
|
|
3680
3683
|
r
|
|
3681
|
-
]), C = !!(y && (!c || f || Array.isArray(y))), [w, T] = d(() => S.length ? S : !b || i || c || !_ ? [] :
|
|
3684
|
+
]), C = !!(y && (!c || f || Array.isArray(y))), [w, T] = d(() => S.length ? S : !b || i || c || !_ ? [] : ia.get(b) ?? []), [E, D] = d(() => C ? !_ || !b || i ? !!y : !ia.has(b) : !1), [O, k] = d(() => !!(h && t && Qi(x, S).length)), A = u(w);
|
|
3682
3685
|
A.current = w;
|
|
3683
3686
|
let j = u(x);
|
|
3684
3687
|
j.current = x, s(() => {
|
|
3685
|
-
S.length && T((e) =>
|
|
3688
|
+
S.length && T((e) => Zi(e, S));
|
|
3686
3689
|
}, [S]);
|
|
3687
3690
|
let M = a(async () => {
|
|
3688
3691
|
if (!y || !C) {
|
|
@@ -3690,18 +3693,18 @@ function ca(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3690
3693
|
return;
|
|
3691
3694
|
}
|
|
3692
3695
|
if (_) {
|
|
3693
|
-
let e =
|
|
3696
|
+
let e = oa(y, i), t = ia.get(e);
|
|
3694
3697
|
if (t && !i) {
|
|
3695
|
-
T((e) =>
|
|
3698
|
+
T((e) => Zi($i(e, j.current, S), t)), D(!1);
|
|
3696
3699
|
return;
|
|
3697
3700
|
}
|
|
3698
3701
|
}
|
|
3699
|
-
D(!0), c && T((e) =>
|
|
3702
|
+
D(!0), c && T((e) => $i(e, j.current, S));
|
|
3700
3703
|
try {
|
|
3701
|
-
let e = await
|
|
3702
|
-
T((t) =>
|
|
3704
|
+
let e = await ca(y, v, n, r, i, _);
|
|
3705
|
+
T((t) => Zi($i(t, j.current, S), e));
|
|
3703
3706
|
} catch {
|
|
3704
|
-
!x.length && !S.length ? T([]) : c && T((e) =>
|
|
3707
|
+
!x.length && !S.length ? T([]) : c && T((e) => $i(e, j.current, S));
|
|
3705
3708
|
} finally {
|
|
3706
3709
|
D(!1);
|
|
3707
3710
|
}
|
|
@@ -3720,7 +3723,7 @@ function ca(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3720
3723
|
s(() => {
|
|
3721
3724
|
M();
|
|
3722
3725
|
}, [M]), s(() => {
|
|
3723
|
-
c && !f && !i && (T((e) =>
|
|
3726
|
+
c && !f && !i && (T((e) => $i(e, x, S)), D(!1));
|
|
3724
3727
|
}, [
|
|
3725
3728
|
c,
|
|
3726
3729
|
f,
|
|
@@ -3732,7 +3735,7 @@ function ca(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3732
3735
|
k(!1);
|
|
3733
3736
|
return;
|
|
3734
3737
|
}
|
|
3735
|
-
let e =
|
|
3738
|
+
let e = Qi(x, Zi(S, A.current));
|
|
3736
3739
|
if (!e.length) {
|
|
3737
3740
|
k(!1);
|
|
3738
3741
|
return;
|
|
@@ -3743,7 +3746,7 @@ function ca(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3743
3746
|
for (let i of e) try {
|
|
3744
3747
|
let e = (await v.getOne(t, i)).data;
|
|
3745
3748
|
a.push({
|
|
3746
|
-
label:
|
|
3749
|
+
label: Yi(e, n),
|
|
3747
3750
|
value: e[r],
|
|
3748
3751
|
record: e
|
|
3749
3752
|
});
|
|
@@ -3755,7 +3758,7 @@ function ca(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3755
3758
|
}
|
|
3756
3759
|
i || (a.length && T((e) => {
|
|
3757
3760
|
let t = a.filter((t) => !e.some((e) => e.value === t.value));
|
|
3758
|
-
return t.length ?
|
|
3761
|
+
return t.length ? Zi(e, t) : e;
|
|
3759
3762
|
}), k(!1));
|
|
3760
3763
|
})(), () => {
|
|
3761
3764
|
i = !0;
|
|
@@ -3782,7 +3785,7 @@ function ca(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3782
3785
|
}
|
|
3783
3786
|
//#endregion
|
|
3784
3787
|
//#region src/crud/fields/ReferenceInputActions.tsx
|
|
3785
|
-
function
|
|
3788
|
+
function ua({ reference: e, referenceForm: t, referencePermissions: n, referenceTitle: r, referenceDefaultValues: i, referenceModalWidth: a, selectedId: o, disabled: s, onCreated: c, onUpdated: l }) {
|
|
3786
3789
|
let u = mt(), f = r ?? e, p = !!(e && t) && Z(u, n, "add"), m = !!(e && t && o != null && o !== "") && Z(u, n, "change"), [h, g] = d(null);
|
|
3787
3790
|
return !p && !m ? null : /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y(V, {
|
|
3788
3791
|
size: 4,
|
|
@@ -3805,7 +3808,7 @@ function la({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3805
3808
|
onClick: () => g(String(o))
|
|
3806
3809
|
})
|
|
3807
3810
|
}) : null]
|
|
3808
|
-
}), e && t && h != null ? /* @__PURE__ */ J(
|
|
3811
|
+
}), e && t && h != null ? /* @__PURE__ */ J(Gr, {
|
|
3809
3812
|
resource: e,
|
|
3810
3813
|
editId: h,
|
|
3811
3814
|
onClose: () => g(null),
|
|
@@ -3822,39 +3825,40 @@ function la({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3822
3825
|
}
|
|
3823
3826
|
//#endregion
|
|
3824
3827
|
//#region src/crud/fields/ReferenceField.tsx
|
|
3825
|
-
function
|
|
3826
|
-
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A =
|
|
3828
|
+
function da({ reference: e, choices: t, optionLabel: n = "name", optionValue: r = "id", search: i, allowClear: a, disabled: o, inputStyle: s, onValueChange: c, lazy: u = !0, fetchSelected: f = !0, value: p, onChange: m, fieldName: h, selectedRecords: g, referenceForm: _, referencePermissions: v, referenceTitle: y, referenceDefaultValues: b, referenceModalWidth: x, referenceActions: S = !0, popupMatchSelectWidth: C, popupMinWidth: w }) {
|
|
3829
|
+
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A = Gi(p, r), { options: j, loading: M, selectedLoading: N, optionForValue: P, reload: F } = la(t, e, n, r, i ? T : void 0, {
|
|
3827
3830
|
lazy: u,
|
|
3828
3831
|
active: k,
|
|
3829
3832
|
selectedValues: p,
|
|
3830
3833
|
selectedRecords: g,
|
|
3831
3834
|
fetchSelected: f
|
|
3832
|
-
}), I =
|
|
3835
|
+
}), I = na(M, N, o), L = l(() => j.map((e) => ({
|
|
3833
3836
|
label: e.label,
|
|
3834
3837
|
value: e.value
|
|
3835
3838
|
})), [j]), ee = (e) => {
|
|
3836
3839
|
let t = e[r];
|
|
3837
3840
|
m(t), c?.(t, {
|
|
3838
|
-
label:
|
|
3841
|
+
label: Yi(e, n),
|
|
3839
3842
|
value: t,
|
|
3840
3843
|
record: e
|
|
3841
3844
|
}, { name: h }), F();
|
|
3842
3845
|
}, R = /* @__PURE__ */ J(B, {
|
|
3843
|
-
|
|
3846
|
+
...ea({
|
|
3844
3847
|
popupMatchSelectWidth: C,
|
|
3845
3848
|
popupMinWidth: w
|
|
3846
3849
|
}),
|
|
3847
|
-
value:
|
|
3850
|
+
value: ra(N, A, void 0),
|
|
3848
3851
|
onChange: (e) => {
|
|
3849
|
-
|
|
3852
|
+
let t = e ?? null;
|
|
3853
|
+
m(t), c?.(t, P(e), { name: h });
|
|
3850
3854
|
},
|
|
3851
3855
|
options: L,
|
|
3852
3856
|
loading: I.loading,
|
|
3853
|
-
notFoundContent:
|
|
3857
|
+
notFoundContent: ta(I.loading),
|
|
3854
3858
|
showSearch: i,
|
|
3855
3859
|
filterOption: i ? !1 : void 0,
|
|
3856
3860
|
onSearch: i ? E : void 0,
|
|
3857
|
-
|
|
3861
|
+
onOpenChange: (e) => {
|
|
3858
3862
|
O(e), e || E(void 0);
|
|
3859
3863
|
},
|
|
3860
3864
|
allowClear: a,
|
|
@@ -3879,7 +3883,7 @@ function ua({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3879
3883
|
minWidth: 0
|
|
3880
3884
|
},
|
|
3881
3885
|
children: R
|
|
3882
|
-
}), /* @__PURE__ */ J(
|
|
3886
|
+
}), /* @__PURE__ */ J(ua, {
|
|
3883
3887
|
reference: e,
|
|
3884
3888
|
referenceForm: _,
|
|
3885
3889
|
referencePermissions: v,
|
|
@@ -3893,7 +3897,7 @@ function ua({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3893
3897
|
})]
|
|
3894
3898
|
}) : R;
|
|
3895
3899
|
}
|
|
3896
|
-
function
|
|
3900
|
+
function fa({ source: e, name: t, label: n, reference: r, choices: i, optionLabel: a = "name", optionValue: o = "id", required: s, rules: c, search: l, allowClear: u, disabled: d, hideLabel: f, hidden: p, inputStyle: m, onValueChange: h, lazy: g = !0, recordSource: _, fetchSelected: v = !0, referenceForm: y, referencePermissions: b, referenceTitle: x, referenceDefaultValues: S, referenceModalWidth: C, referenceActions: w = !0, popupMatchSelectWidth: T, popupMinWidth: E }) {
|
|
3897
3901
|
let D = Ne({
|
|
3898
3902
|
name: _ ?? "",
|
|
3899
3903
|
disabled: !_
|
|
@@ -3906,7 +3910,7 @@ function da({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3906
3910
|
rules: c,
|
|
3907
3911
|
hideLabel: f,
|
|
3908
3912
|
hidden: p,
|
|
3909
|
-
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ J(
|
|
3913
|
+
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ J(da, {
|
|
3910
3914
|
reference: r,
|
|
3911
3915
|
choices: i,
|
|
3912
3916
|
optionLabel: a,
|
|
@@ -3935,31 +3939,31 @@ function da({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3935
3939
|
}
|
|
3936
3940
|
//#endregion
|
|
3937
3941
|
//#region src/crud/fields/ReferenceManyField.tsx
|
|
3938
|
-
function
|
|
3939
|
-
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D =
|
|
3942
|
+
function pa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r = "id", search: i, allowClear: a = !0, lazy: o = !0, fetchSelected: s = !0, value: c, onChange: u, disabled: f, selectedRecords: p, referenceForm: m, referencePermissions: h, referenceTitle: g, referenceDefaultValues: _, referenceModalWidth: v, referenceActions: y = !0, popupMatchSelectWidth: b, popupMinWidth: x }) {
|
|
3943
|
+
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D = Ki(c, r), { options: O, loading: k, selectedLoading: A, reload: j } = la(t, e, n, r, i ? S : void 0, {
|
|
3940
3944
|
lazy: o,
|
|
3941
3945
|
active: E,
|
|
3942
3946
|
selectedValues: c,
|
|
3943
3947
|
selectedRecords: p,
|
|
3944
3948
|
fetchSelected: s
|
|
3945
|
-
}), M =
|
|
3949
|
+
}), M = na(k, A, f), N = l(() => O.map((e) => ({
|
|
3946
3950
|
label: e.label,
|
|
3947
3951
|
value: e.value
|
|
3948
3952
|
})), [O]), P = /* @__PURE__ */ J(B, {
|
|
3949
|
-
|
|
3953
|
+
...ea({
|
|
3950
3954
|
popupMatchSelectWidth: b,
|
|
3951
3955
|
popupMinWidth: x
|
|
3952
3956
|
}),
|
|
3953
3957
|
mode: "multiple",
|
|
3954
|
-
value:
|
|
3955
|
-
onChange: u,
|
|
3958
|
+
value: ra(A, D, []),
|
|
3959
|
+
onChange: (e) => u(e ?? []),
|
|
3956
3960
|
options: N,
|
|
3957
3961
|
loading: M.loading,
|
|
3958
|
-
notFoundContent:
|
|
3962
|
+
notFoundContent: ta(M.loading),
|
|
3959
3963
|
showSearch: i,
|
|
3960
3964
|
filterOption: i ? !1 : void 0,
|
|
3961
3965
|
onSearch: i ? C : void 0,
|
|
3962
|
-
|
|
3966
|
+
onOpenChange: (e) => {
|
|
3963
3967
|
T(e), e || C(void 0);
|
|
3964
3968
|
},
|
|
3965
3969
|
allowClear: a,
|
|
@@ -3980,7 +3984,7 @@ function fa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3980
3984
|
minWidth: 0
|
|
3981
3985
|
},
|
|
3982
3986
|
children: P
|
|
3983
|
-
}), /* @__PURE__ */ J(
|
|
3987
|
+
}), /* @__PURE__ */ J(ua, {
|
|
3984
3988
|
reference: e,
|
|
3985
3989
|
referenceForm: m,
|
|
3986
3990
|
referencePermissions: h,
|
|
@@ -3999,7 +4003,7 @@ function fa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3999
4003
|
})]
|
|
4000
4004
|
}) : P;
|
|
4001
4005
|
}
|
|
4002
|
-
function
|
|
4006
|
+
function ma({ source: e, name: t, label: n, reference: r, choices: i, optionLabel: a = "name", optionValue: o = "id", required: s, rules: c, search: l, allowClear: u = !0, hideLabel: d, hidden: f, disabled: p, lazy: m = !0, recordSource: h, fetchSelected: g = !0, referenceForm: _, referencePermissions: v, referenceTitle: y, referenceDefaultValues: b, referenceModalWidth: x, referenceActions: S = !0, popupMatchSelectWidth: C, popupMinWidth: w }) {
|
|
4003
4007
|
let T = Ne({
|
|
4004
4008
|
name: h ?? "",
|
|
4005
4009
|
disabled: !h
|
|
@@ -4012,7 +4016,7 @@ function pa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
4012
4016
|
rules: c,
|
|
4013
4017
|
hideLabel: d,
|
|
4014
4018
|
hidden: f,
|
|
4015
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(
|
|
4019
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(pa, {
|
|
4016
4020
|
reference: r,
|
|
4017
4021
|
choices: i,
|
|
4018
4022
|
optionLabel: a,
|
|
@@ -4038,10 +4042,10 @@ function pa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
4038
4042
|
}
|
|
4039
4043
|
//#endregion
|
|
4040
4044
|
//#region src/crud/fields/uploadFieldUtils.ts
|
|
4041
|
-
function
|
|
4045
|
+
function ha(e) {
|
|
4042
4046
|
return e instanceof File ? !0 : typeof e == "string" && e.length > 0;
|
|
4043
4047
|
}
|
|
4044
|
-
function
|
|
4048
|
+
function ga(e) {
|
|
4045
4049
|
if (e instanceof File) return e.name;
|
|
4046
4050
|
if (typeof e == "string" && e.length > 0) try {
|
|
4047
4051
|
return new URL(e, "http://local").pathname.split("/").filter(Boolean).pop() || e;
|
|
@@ -4051,7 +4055,7 @@ function ha(e) {
|
|
|
4051
4055
|
}
|
|
4052
4056
|
//#endregion
|
|
4053
4057
|
//#region src/crud/fields/useUploadPreviewUrl.ts
|
|
4054
|
-
function
|
|
4058
|
+
function _a(e) {
|
|
4055
4059
|
let [t, n] = d();
|
|
4056
4060
|
if (s(() => {
|
|
4057
4061
|
if (e instanceof File) {
|
|
@@ -4064,10 +4068,10 @@ function ga(e) {
|
|
|
4064
4068
|
}
|
|
4065
4069
|
//#endregion
|
|
4066
4070
|
//#region src/crud/fields/ImageField.tsx
|
|
4067
|
-
function
|
|
4068
|
-
let o = u(null), s =
|
|
4071
|
+
function va({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "image/*", previewWidth: a = 200 }) {
|
|
4072
|
+
let o = u(null), s = _a(e), c = r && ha(e);
|
|
4069
4073
|
return /* @__PURE__ */ Y(V, {
|
|
4070
|
-
|
|
4074
|
+
orientation: "vertical",
|
|
4071
4075
|
size: "middle",
|
|
4072
4076
|
style: { width: "100%" },
|
|
4073
4077
|
children: [
|
|
@@ -4112,7 +4116,7 @@ function _a({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
4112
4116
|
]
|
|
4113
4117
|
});
|
|
4114
4118
|
}
|
|
4115
|
-
function
|
|
4119
|
+
function ya({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, clearable: s, accept: c, previewWidth: l }) {
|
|
4116
4120
|
return /* @__PURE__ */ J($, {
|
|
4117
4121
|
source: e,
|
|
4118
4122
|
name: t,
|
|
@@ -4121,7 +4125,7 @@ function va({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4121
4125
|
rules: i,
|
|
4122
4126
|
hideLabel: a,
|
|
4123
4127
|
hidden: o,
|
|
4124
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(
|
|
4128
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(va, {
|
|
4125
4129
|
value: e,
|
|
4126
4130
|
onChange: t,
|
|
4127
4131
|
disabled: n,
|
|
@@ -4133,10 +4137,10 @@ function va({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4133
4137
|
}
|
|
4134
4138
|
//#endregion
|
|
4135
4139
|
//#region src/crud/fields/FileField.tsx
|
|
4136
|
-
function
|
|
4137
|
-
let a = u(null), o =
|
|
4140
|
+
function ba({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
4141
|
+
let a = u(null), o = ga(e), s = typeof e == "string" && e.length > 0 ? e : void 0, c = r && ha(e);
|
|
4138
4142
|
return /* @__PURE__ */ Y(V, {
|
|
4139
|
-
|
|
4143
|
+
orientation: "vertical",
|
|
4140
4144
|
size: "middle",
|
|
4141
4145
|
style: { width: "100%" },
|
|
4142
4146
|
children: [
|
|
@@ -4178,7 +4182,7 @@ function ya({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
4178
4182
|
]
|
|
4179
4183
|
});
|
|
4180
4184
|
}
|
|
4181
|
-
function
|
|
4185
|
+
function xa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, clearable: s, accept: c }) {
|
|
4182
4186
|
return /* @__PURE__ */ J($, {
|
|
4183
4187
|
source: e,
|
|
4184
4188
|
name: t,
|
|
@@ -4187,7 +4191,7 @@ function ba({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4187
4191
|
rules: i,
|
|
4188
4192
|
hideLabel: a,
|
|
4189
4193
|
hidden: o,
|
|
4190
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(
|
|
4194
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(ba, {
|
|
4191
4195
|
value: e,
|
|
4192
4196
|
onChange: t,
|
|
4193
4197
|
disabled: n,
|
|
@@ -4198,20 +4202,20 @@ function ba({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4198
4202
|
}
|
|
4199
4203
|
//#endregion
|
|
4200
4204
|
//#region src/crud/utils/columnDataIndex.ts
|
|
4201
|
-
function
|
|
4205
|
+
function Sa(e) {
|
|
4202
4206
|
return e.includes(".") ? e.split(".") : e;
|
|
4203
4207
|
}
|
|
4204
4208
|
//#endregion
|
|
4205
4209
|
//#region src/crud/columns/TextColumn.tsx
|
|
4206
|
-
function
|
|
4207
|
-
return
|
|
4210
|
+
function Ca({ source: e, label: t, sortable: n = !0 }) {
|
|
4211
|
+
return Yn(l(() => ({
|
|
4208
4212
|
key: e,
|
|
4209
4213
|
source: e,
|
|
4210
4214
|
label: t,
|
|
4211
4215
|
sortable: n,
|
|
4212
4216
|
buildColumn: () => ({
|
|
4213
4217
|
title: t ?? e,
|
|
4214
|
-
dataIndex:
|
|
4218
|
+
dataIndex: Sa(e),
|
|
4215
4219
|
key: e,
|
|
4216
4220
|
sorter: n ? !0 : void 0
|
|
4217
4221
|
})
|
|
@@ -4221,20 +4225,20 @@ function Sa({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4221
4225
|
n
|
|
4222
4226
|
])), null;
|
|
4223
4227
|
}
|
|
4224
|
-
function
|
|
4225
|
-
return typeof n == "function" ? n(e) : n ?
|
|
4228
|
+
function wa(e, t, n) {
|
|
4229
|
+
return typeof n == "function" ? n(e) : n ? xr(e, n) : xr(e, t);
|
|
4226
4230
|
}
|
|
4227
4231
|
//#endregion
|
|
4228
4232
|
//#region src/crud/columns/NumberColumn.tsx
|
|
4229
|
-
function
|
|
4230
|
-
return
|
|
4233
|
+
function Ta({ source: e, label: t, sortable: n = !0 }) {
|
|
4234
|
+
return Yn(l(() => ({
|
|
4231
4235
|
key: e,
|
|
4232
4236
|
source: e,
|
|
4233
4237
|
label: t,
|
|
4234
4238
|
sortable: n,
|
|
4235
4239
|
buildColumn: () => ({
|
|
4236
4240
|
title: t ?? e,
|
|
4237
|
-
dataIndex:
|
|
4241
|
+
dataIndex: Sa(e),
|
|
4238
4242
|
key: e,
|
|
4239
4243
|
sorter: n ? !0 : void 0
|
|
4240
4244
|
})
|
|
@@ -4246,15 +4250,15 @@ function wa({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4246
4250
|
}
|
|
4247
4251
|
//#endregion
|
|
4248
4252
|
//#region src/crud/columns/BooleanColumn.tsx
|
|
4249
|
-
function
|
|
4250
|
-
return
|
|
4253
|
+
function Ea({ source: e, label: t, sortable: n = !0 }) {
|
|
4254
|
+
return Yn(l(() => ({
|
|
4251
4255
|
key: e,
|
|
4252
4256
|
source: e,
|
|
4253
4257
|
label: t,
|
|
4254
4258
|
sortable: n,
|
|
4255
4259
|
buildColumn: () => ({
|
|
4256
4260
|
title: t ?? e,
|
|
4257
|
-
dataIndex:
|
|
4261
|
+
dataIndex: Sa(e),
|
|
4258
4262
|
key: e,
|
|
4259
4263
|
sorter: n ? !0 : void 0,
|
|
4260
4264
|
render: (e) => e ? "Yes" : "No"
|
|
@@ -4267,15 +4271,15 @@ function Ta({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4267
4271
|
}
|
|
4268
4272
|
//#endregion
|
|
4269
4273
|
//#region src/crud/columns/DateColumn.tsx
|
|
4270
|
-
function
|
|
4271
|
-
return
|
|
4274
|
+
function Da({ source: e, label: t, sortable: n = !0 }) {
|
|
4275
|
+
return Yn(l(() => ({
|
|
4272
4276
|
key: e,
|
|
4273
4277
|
source: e,
|
|
4274
4278
|
label: t,
|
|
4275
4279
|
sortable: n,
|
|
4276
4280
|
buildColumn: () => ({
|
|
4277
4281
|
title: t ?? e,
|
|
4278
|
-
dataIndex:
|
|
4282
|
+
dataIndex: Sa(e),
|
|
4279
4283
|
key: e,
|
|
4280
4284
|
sorter: n ? !0 : void 0,
|
|
4281
4285
|
render: (e) => e ? String(e).slice(0, 10) : "—"
|
|
@@ -4288,17 +4292,17 @@ function Ea({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4288
4292
|
}
|
|
4289
4293
|
//#endregion
|
|
4290
4294
|
//#region src/crud/columns/ReferenceColumn.tsx
|
|
4291
|
-
function
|
|
4292
|
-
let { labelForValue: s } =
|
|
4295
|
+
function Oa({ record: e, source: t, display: n, reference: r, choices: i, optionLabel: a, optionValue: o }) {
|
|
4296
|
+
let { labelForValue: s } = la(i, r, a, o), c = xr(e, t);
|
|
4293
4297
|
if (typeof n == "function") return /* @__PURE__ */ J(q, { children: n(e) });
|
|
4294
4298
|
if (n && n !== t) {
|
|
4295
|
-
let r =
|
|
4299
|
+
let r = wa(e, t, n);
|
|
4296
4300
|
return /* @__PURE__ */ J(q, { children: r == null ? "—" : String(r) });
|
|
4297
4301
|
}
|
|
4298
4302
|
return /* @__PURE__ */ J(q, { children: s(c) });
|
|
4299
4303
|
}
|
|
4300
|
-
function
|
|
4301
|
-
return
|
|
4304
|
+
function ka({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: s = !0 }) {
|
|
4305
|
+
return Yn(l(() => ({
|
|
4302
4306
|
key: e,
|
|
4303
4307
|
source: e,
|
|
4304
4308
|
label: t,
|
|
@@ -4308,7 +4312,7 @@ function Oa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4308
4312
|
dataIndex: e,
|
|
4309
4313
|
key: e,
|
|
4310
4314
|
sorter: s ? !0 : void 0,
|
|
4311
|
-
render: (s, c) => /* @__PURE__ */ J(
|
|
4315
|
+
render: (s, c) => /* @__PURE__ */ J(Oa, {
|
|
4312
4316
|
record: c,
|
|
4313
4317
|
source: e,
|
|
4314
4318
|
label: t,
|
|
@@ -4332,12 +4336,12 @@ function Oa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4332
4336
|
}
|
|
4333
4337
|
//#endregion
|
|
4334
4338
|
//#region src/crud/columns/ReferenceManyColumn.tsx
|
|
4335
|
-
function
|
|
4336
|
-
let { labelsForValues: o } =
|
|
4339
|
+
function Aa({ record: e, source: t, reference: n, choices: r, optionLabel: i, optionValue: a }) {
|
|
4340
|
+
let { labelsForValues: o } = la(r, n, i, a), s = xr(e, t);
|
|
4337
4341
|
return /* @__PURE__ */ J(q, { children: o(Array.isArray(s) ? s : []) });
|
|
4338
4342
|
}
|
|
4339
|
-
function
|
|
4340
|
-
return
|
|
4343
|
+
function ja({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
|
|
4344
|
+
return Yn(l(() => ({
|
|
4341
4345
|
key: e,
|
|
4342
4346
|
source: e,
|
|
4343
4347
|
label: t,
|
|
@@ -4347,7 +4351,7 @@ function Aa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4347
4351
|
dataIndex: e,
|
|
4348
4352
|
key: e,
|
|
4349
4353
|
sorter: o ? !0 : void 0,
|
|
4350
|
-
render: (t, o) => /* @__PURE__ */ J(
|
|
4354
|
+
render: (t, o) => /* @__PURE__ */ J(Aa, {
|
|
4351
4355
|
record: o,
|
|
4352
4356
|
source: e,
|
|
4353
4357
|
reference: n,
|
|
@@ -4368,15 +4372,15 @@ function Aa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4368
4372
|
}
|
|
4369
4373
|
//#endregion
|
|
4370
4374
|
//#region src/crud/columns/ImageColumn.tsx
|
|
4371
|
-
function
|
|
4372
|
-
return
|
|
4375
|
+
function Ma({ source: e, label: t, sortable: n = !1, width: r = 40, height: i = 40, objectFit: a = "cover", borderRadius: o = 4, alt: s = "" }) {
|
|
4376
|
+
return Yn(l(() => ({
|
|
4373
4377
|
key: e,
|
|
4374
4378
|
source: e,
|
|
4375
4379
|
label: t,
|
|
4376
4380
|
sortable: n,
|
|
4377
4381
|
buildColumn: () => ({
|
|
4378
4382
|
title: t ?? e,
|
|
4379
|
-
dataIndex:
|
|
4383
|
+
dataIndex: Sa(e),
|
|
4380
4384
|
key: e,
|
|
4381
4385
|
sorter: n ? !0 : void 0,
|
|
4382
4386
|
render: (e) => e == null || e === "" ? null : /* @__PURE__ */ J("img", {
|
|
@@ -4403,8 +4407,8 @@ function ja({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4403
4407
|
}
|
|
4404
4408
|
//#endregion
|
|
4405
4409
|
//#region src/crud/columns/CustomColumn.tsx
|
|
4406
|
-
function
|
|
4407
|
-
return
|
|
4410
|
+
function Na({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
4411
|
+
return Yn(l(() => ({
|
|
4408
4412
|
key: e,
|
|
4409
4413
|
source: e,
|
|
4410
4414
|
label: t,
|
|
@@ -4423,8 +4427,8 @@ function Ma({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
|
4423
4427
|
}
|
|
4424
4428
|
//#endregion
|
|
4425
4429
|
//#region src/crud/filters/NumberFilter.tsx
|
|
4426
|
-
function
|
|
4427
|
-
return
|
|
4430
|
+
function Pa({ source: e, label: t }) {
|
|
4431
|
+
return ir(l(() => ({
|
|
4428
4432
|
key: e,
|
|
4429
4433
|
source: e,
|
|
4430
4434
|
label: t,
|
|
@@ -4438,8 +4442,8 @@ function Na({ source: e, label: t }) {
|
|
|
4438
4442
|
}
|
|
4439
4443
|
//#endregion
|
|
4440
4444
|
//#region src/crud/filters/BooleanFilter.tsx
|
|
4441
|
-
function
|
|
4442
|
-
return
|
|
4445
|
+
function Fa({ source: e, label: t }) {
|
|
4446
|
+
return ir(l(() => ({
|
|
4443
4447
|
key: e,
|
|
4444
4448
|
source: e,
|
|
4445
4449
|
label: t,
|
|
@@ -4461,8 +4465,8 @@ function Pa({ source: e, label: t }) {
|
|
|
4461
4465
|
}
|
|
4462
4466
|
//#endregion
|
|
4463
4467
|
//#region src/crud/filters/DateFilter.tsx
|
|
4464
|
-
function
|
|
4465
|
-
return
|
|
4468
|
+
function Ia({ source: e, label: t }) {
|
|
4469
|
+
return ir(l(() => ({
|
|
4466
4470
|
key: e,
|
|
4467
4471
|
source: e,
|
|
4468
4472
|
label: t,
|
|
@@ -4477,8 +4481,8 @@ function Fa({ source: e, label: t }) {
|
|
|
4477
4481
|
}
|
|
4478
4482
|
//#endregion
|
|
4479
4483
|
//#region src/crud/filters/SelectFilter.tsx
|
|
4480
|
-
function
|
|
4481
|
-
return
|
|
4484
|
+
function La({ source: e, label: t, choices: n, multiple: r }) {
|
|
4485
|
+
return ir(l(() => ({
|
|
4482
4486
|
key: e,
|
|
4483
4487
|
source: e,
|
|
4484
4488
|
label: t,
|
|
@@ -4500,22 +4504,22 @@ function Ia({ source: e, label: t, choices: n, multiple: r }) {
|
|
|
4500
4504
|
}
|
|
4501
4505
|
//#endregion
|
|
4502
4506
|
//#region src/crud/filters/ReferenceFilter.tsx
|
|
4503
|
-
function
|
|
4504
|
-
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b, selectedLoading: x } =
|
|
4507
|
+
function Ra({ source: e, label: t, reference: n, choices: r, optionLabel: i, optionValue: a, multiple: o, search: s, lazy: c = !0, fetchSelected: l = !0, popupMatchSelectWidth: u, popupMinWidth: f, value: p, onChange: m }) {
|
|
4508
|
+
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b, selectedLoading: x } = la(r, n, i, a, s ? h : void 0, {
|
|
4505
4509
|
lazy: c,
|
|
4506
4510
|
active: _ || !!h,
|
|
4507
4511
|
selectedValues: p,
|
|
4508
4512
|
fetchSelected: l
|
|
4509
|
-
}), S =
|
|
4513
|
+
}), S = na(b, x), C = p;
|
|
4510
4514
|
return /* @__PURE__ */ J(B, {
|
|
4511
|
-
|
|
4515
|
+
...ea({
|
|
4512
4516
|
popupMatchSelectWidth: u,
|
|
4513
4517
|
popupMinWidth: f
|
|
4514
4518
|
}),
|
|
4515
4519
|
allowClear: !0,
|
|
4516
4520
|
mode: o ? "multiple" : void 0,
|
|
4517
4521
|
placeholder: t ?? e,
|
|
4518
|
-
value:
|
|
4522
|
+
value: ra(x, C, o ? [] : void 0),
|
|
4519
4523
|
onChange: m,
|
|
4520
4524
|
options: y.map((e) => ({
|
|
4521
4525
|
label: e.label,
|
|
@@ -4523,23 +4527,23 @@ function La({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4523
4527
|
})),
|
|
4524
4528
|
loading: S.loading,
|
|
4525
4529
|
disabled: S.disabled,
|
|
4526
|
-
notFoundContent:
|
|
4530
|
+
notFoundContent: ta(S.loading),
|
|
4527
4531
|
showSearch: s,
|
|
4528
4532
|
filterOption: s ? !1 : void 0,
|
|
4529
4533
|
onSearch: s ? g : void 0,
|
|
4530
|
-
|
|
4534
|
+
onOpenChange: (e) => {
|
|
4531
4535
|
v(e), e || g(void 0);
|
|
4532
4536
|
},
|
|
4533
4537
|
optionFilterProp: "label",
|
|
4534
4538
|
style: { minWidth: 180 }
|
|
4535
4539
|
});
|
|
4536
4540
|
}
|
|
4537
|
-
function
|
|
4538
|
-
return
|
|
4541
|
+
function za({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", multiple: o, search: s, lazy: c = !0, fetchSelected: u = !0, popupMatchSelectWidth: d, popupMinWidth: f }) {
|
|
4542
|
+
return ir(l(() => ({
|
|
4539
4543
|
key: e,
|
|
4540
4544
|
source: e,
|
|
4541
4545
|
label: t,
|
|
4542
|
-
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(
|
|
4546
|
+
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(Ra, {
|
|
4543
4547
|
source: e,
|
|
4544
4548
|
label: t,
|
|
4545
4549
|
reference: n,
|
|
@@ -4570,11 +4574,11 @@ function Ra({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4570
4574
|
f
|
|
4571
4575
|
])), null;
|
|
4572
4576
|
}
|
|
4573
|
-
function
|
|
4574
|
-
return /* @__PURE__ */ J(
|
|
4577
|
+
function Ba(e) {
|
|
4578
|
+
return /* @__PURE__ */ J(za, {
|
|
4575
4579
|
...e,
|
|
4576
4580
|
multiple: !0
|
|
4577
4581
|
});
|
|
4578
4582
|
}
|
|
4579
4583
|
//#endregion
|
|
4580
|
-
export {
|
|
4584
|
+
export { qt as AdminApp, Ft as AdminLayout, Vn as AppHub, Hn as AppLauncherButton, Xe as AppThemeProvider, Ln as AuthAlternateLink, Rn as AuthPageLayout, ct as AuthProvider, Ea as BooleanColumn, Ai as BooleanField, Fa as BooleanFilter, Na as CustomColumn, Zn as DEFAULT_TEXT_FILTER_DEBOUNCE_MS, Yt as DataProvider, Da as DateColumn, Ii as DateField, Ia as DateFilter, Li as DateTimeField, $e as DensitySwitch, tn as EXPECTED_VALIDATION_BODY_HINT, $ as FieldWrapper, xa as FileField, oi as FilterBar, Ci as FormStep, Ti as FormSteps, bi as FormTab, Si as FormTabs, It as Guard, Rt as GuestOnly, di as HiddenSources, Ma as ImageColumn, ya as ImageField, hi as InlineFormSet, gi as InlineFormSetStacked, zn as LoginPage, Ta as NumberColumn, ki as NumberField, Pa as NumberFilter, Ui as PasswordField, pt as PermissionsProvider, Bn as PlaceholderPage, Lt as Protected, ka as ReferenceColumn, fa as ReferenceField, za as ReferenceFilter, ja as ReferenceManyColumn, ma as ReferenceManyField, Ba as ReferenceManyFilter, zt as RequirePermission, si as ResourceForm, Gr as ResourceFormModal, ii as ResourceList, Vi as SelectField, La as SelectFilter, Oi as TextAreaField, Ca as TextColumn, Di as TextField, er as TextFilter, tt as ThemeSwitch, nt as ThemeToolbar, Bi as TimeField, An as applyInMemoryListParams, Q as asStringMessages, Cr as buildFormPayload, wr as buildInlineRowsPayload, Nr as buildResourceFormSubmitBody, Sa as columnDataIndex, $t as combineResourceHandlers, Kt as createAdminRouter, jn as createMemoryResourceHandlers, ht as createPermissionsChecker, Mn as createRestResourceHandlers, dt as createSessionStorageAuthAdapter, Wt as deriveAuthPaths, cn as describeNonStandardValidationBody, bt as filterFlatNavItems, Tt as filterNavByPermission, vt as filterNavItems, On as filterRows, gn as finalizeFormErrors, yt as flattenNavLeaves, hn as flattenNestedArrayErrors, dn as getErrorBody, xr as getFormValue, _t as getNavItemLabel, Bt as getRouteAccess, Tn as getRowById, Tr as hasUploadValues, en as isAbortError, fi as nestedFieldPath, yn as parseDjangoDRFFormErrors, bn as parseDotNetFormErrors, xn as parseNodeFormErrors, Vt as partitionAdminRoutes, Mr as prepareFormSubmitBody, pn as resolveErrorBody, Sr as setFormValue, Pn as toDjangoRestOrdering, jr as toFormData, In as toJsonApiSort, Fn as toODataOrderBy, Vr as useAbortableEffect, lt as useAuth, gt as useCan, la as useChoices, Xt as useDataProvider, Qr as useListQueryState, mt as usePermissions, mr as useRegisterPayloadField, hr as useRegisterSectionField, ei as useResourceListContext, Ze as useThemeMode };
|