ding-react-admin 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +284 -231
- package/dist/src/crud/HiddenSources.d.ts +9 -0
- package/dist/src/crud/HiddenSources.d.ts.map +1 -0
- package/dist/src/crud/InlineFormSet.d.ts.map +1 -1
- package/dist/src/crud/ResourceList.d.ts.map +1 -1
- package/dist/src/crud/columns/BooleanColumn.d.ts.map +1 -1
- package/dist/src/crud/columns/DateColumn.d.ts.map +1 -1
- package/dist/src/crud/columns/ImageColumn.d.ts.map +1 -1
- package/dist/src/crud/columns/NumberColumn.d.ts.map +1 -1
- package/dist/src/crud/columns/ReferenceColumn.d.ts.map +1 -1
- package/dist/src/crud/columns/ReferenceManyColumn.d.ts.map +1 -1
- package/dist/src/crud/columns/TextColumn.d.ts.map +1 -1
- package/dist/src/crud/fields/BooleanField.d.ts +3 -3
- package/dist/src/crud/fields/BooleanField.d.ts.map +1 -1
- package/dist/src/crud/fields/DateField.d.ts +3 -3
- package/dist/src/crud/fields/DateField.d.ts.map +1 -1
- package/dist/src/crud/fields/FieldWrapper.d.ts +3 -1
- package/dist/src/crud/fields/FieldWrapper.d.ts.map +1 -1
- package/dist/src/crud/fields/FileField.d.ts +3 -3
- package/dist/src/crud/fields/FileField.d.ts.map +1 -1
- package/dist/src/crud/fields/ImageField.d.ts +3 -3
- package/dist/src/crud/fields/ImageField.d.ts.map +1 -1
- package/dist/src/crud/fields/NumberField.d.ts +3 -3
- package/dist/src/crud/fields/NumberField.d.ts.map +1 -1
- package/dist/src/crud/fields/PasswordField.d.ts +3 -3
- package/dist/src/crud/fields/PasswordField.d.ts.map +1 -1
- package/dist/src/crud/fields/ReferenceField.d.ts +3 -3
- package/dist/src/crud/fields/ReferenceField.d.ts.map +1 -1
- package/dist/src/crud/fields/ReferenceManyField.d.ts +3 -3
- package/dist/src/crud/fields/ReferenceManyField.d.ts.map +1 -1
- package/dist/src/crud/fields/SelectField.d.ts +3 -3
- package/dist/src/crud/fields/SelectField.d.ts.map +1 -1
- package/dist/src/crud/fields/TextAreaField.d.ts +3 -3
- package/dist/src/crud/fields/TextAreaField.d.ts.map +1 -1
- package/dist/src/crud/fields/TextField.d.ts +3 -3
- package/dist/src/crud/fields/TextField.d.ts.map +1 -1
- package/dist/src/crud/fields/TimeField.d.ts +3 -3
- package/dist/src/crud/fields/TimeField.d.ts.map +1 -1
- package/dist/src/crud/index.d.ts +3 -1
- package/dist/src/crud/index.d.ts.map +1 -1
- package/dist/src/crud/types.d.ts +5 -0
- package/dist/src/crud/types.d.ts.map +1 -1
- package/dist/src/crud/utils/buildInlineRowsPayload.d.ts.map +1 -1
- package/dist/src/crud/utils/columnDataIndex.d.ts +5 -0
- package/dist/src/crud/utils/columnDataIndex.d.ts.map +1 -0
- package/dist/src/crud/utils/shouldRegisterSourceInPayload.d.ts +6 -0
- package/dist/src/crud/utils/shouldRegisterSourceInPayload.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/crud/HiddenSources.tsx +37 -0
- package/src/crud/InlineFormSet.tsx +4 -1
- package/src/crud/ResourceList.tsx +10 -1
- package/src/crud/columns/BooleanColumn.tsx +2 -1
- package/src/crud/columns/DateColumn.tsx +2 -1
- package/src/crud/columns/ImageColumn.tsx +2 -1
- package/src/crud/columns/NumberColumn.tsx +2 -1
- package/src/crud/columns/ReferenceColumn.tsx +2 -1
- package/src/crud/columns/ReferenceManyColumn.tsx +2 -1
- package/src/crud/columns/TextColumn.tsx +3 -2
- package/src/crud/fields/BooleanField.tsx +4 -2
- package/src/crud/fields/DateField.tsx +4 -2
- package/src/crud/fields/FieldWrapper.tsx +20 -7
- package/src/crud/fields/FileField.tsx +4 -2
- package/src/crud/fields/ImageField.tsx +4 -2
- package/src/crud/fields/NumberField.tsx +4 -2
- package/src/crud/fields/PasswordField.tsx +8 -2
- package/src/crud/fields/ReferenceField.tsx +4 -2
- package/src/crud/fields/ReferenceManyField.tsx +4 -2
- package/src/crud/fields/SelectField.tsx +4 -2
- package/src/crud/fields/TextAreaField.tsx +4 -2
- package/src/crud/fields/TextField.tsx +4 -2
- package/src/crud/fields/TimeField.tsx +4 -2
- package/src/crud/index.ts +3 -0
- package/src/crud/types.ts +6 -0
- package/src/crud/utils/buildInlineRowsPayload.ts +5 -2
- package/src/crud/utils/columnDataIndex.ts +6 -0
- package/src/crud/utils/shouldRegisterSourceInPayload.ts +10 -0
- package/src/data/dataUtils.test.ts +52 -1
- package/src/index.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -1795,8 +1795,8 @@ function Cr(e, t, n) {
|
|
|
1795
1795
|
if (!e || typeof e != "object") return {};
|
|
1796
1796
|
let n = e, r = {};
|
|
1797
1797
|
for (let e of t) {
|
|
1798
|
-
let t = n
|
|
1799
|
-
t !== void 0 && (r
|
|
1798
|
+
let t = br(n, e);
|
|
1799
|
+
t !== void 0 && xr(r, e, t);
|
|
1800
1800
|
}
|
|
1801
1801
|
let i = n.id;
|
|
1802
1802
|
return i != null && (r.id = i), r;
|
|
@@ -2528,7 +2528,14 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2528
2528
|
D,
|
|
2529
2529
|
E
|
|
2530
2530
|
]), Ee = a(async (t) => {
|
|
2531
|
-
if (U)
|
|
2531
|
+
if (U && await new Promise((e) => {
|
|
2532
|
+
D.confirm({
|
|
2533
|
+
title: "Delete this item? This cannot be undone.",
|
|
2534
|
+
okType: "danger",
|
|
2535
|
+
onOk: () => e(!0),
|
|
2536
|
+
onCancel: () => e(!1)
|
|
2537
|
+
});
|
|
2538
|
+
})) try {
|
|
2532
2539
|
await x.delete(e, t.id), E.success("Deleted"), X();
|
|
2533
2540
|
} catch (e) {
|
|
2534
2541
|
E.error(e instanceof Error ? e.message : "Delete failed");
|
|
@@ -2538,7 +2545,8 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2538
2545
|
x,
|
|
2539
2546
|
e,
|
|
2540
2547
|
X,
|
|
2541
|
-
E
|
|
2548
|
+
E,
|
|
2549
|
+
D
|
|
2542
2550
|
]), De = l(() => {
|
|
2543
2551
|
let e = k.map((e) => {
|
|
2544
2552
|
let t = e.buildColumn();
|
|
@@ -2831,18 +2839,34 @@ function oi({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2831
2839
|
});
|
|
2832
2840
|
}
|
|
2833
2841
|
//#endregion
|
|
2842
|
+
//#region src/crud/HiddenSources.tsx
|
|
2843
|
+
var si = t(/* @__PURE__ */ new Set());
|
|
2844
|
+
function ci(e, t, n) {
|
|
2845
|
+
return !!t || n.has(e);
|
|
2846
|
+
}
|
|
2847
|
+
function li() {
|
|
2848
|
+
return o(si);
|
|
2849
|
+
}
|
|
2850
|
+
function ui({ sources: e, children: t }) {
|
|
2851
|
+
let n = l(() => e instanceof Set ? e : new Set(e), [e]);
|
|
2852
|
+
return n.size === 0 ? t : /* @__PURE__ */ J(si.Provider, {
|
|
2853
|
+
value: n,
|
|
2854
|
+
children: t
|
|
2855
|
+
});
|
|
2856
|
+
}
|
|
2857
|
+
//#endregion
|
|
2834
2858
|
//#region src/crud/utils/nestedFieldPath.ts
|
|
2835
|
-
function
|
|
2859
|
+
function di(e, t, n) {
|
|
2836
2860
|
return `${e}.${t}.${n}`;
|
|
2837
2861
|
}
|
|
2838
2862
|
//#endregion
|
|
2839
2863
|
//#region src/crud/InlineFormSet.tsx
|
|
2840
|
-
function
|
|
2864
|
+
function fi(e, t) {
|
|
2841
2865
|
let n = {};
|
|
2842
|
-
for (let r of e) n
|
|
2866
|
+
for (let r of e) xr(n, r, t ? br(t, r) : void 0);
|
|
2843
2867
|
return n;
|
|
2844
2868
|
}
|
|
2845
|
-
function
|
|
2869
|
+
function pi(e, t, n) {
|
|
2846
2870
|
let { control: r } = je(), { fields: i, append: a, remove: o } = ke({
|
|
2847
2871
|
control: r,
|
|
2848
2872
|
name: e,
|
|
@@ -2851,11 +2875,11 @@ function li(e, t, n) {
|
|
|
2851
2875
|
return {
|
|
2852
2876
|
fields: i,
|
|
2853
2877
|
remove: o,
|
|
2854
|
-
appendEmpty: () => a(
|
|
2878
|
+
appendEmpty: () => a(fi(t, n))
|
|
2855
2879
|
};
|
|
2856
2880
|
}
|
|
2857
|
-
function
|
|
2858
|
-
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } =
|
|
2881
|
+
function mi({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, defaultRow: a }) {
|
|
2882
|
+
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } = pi(e, o, a);
|
|
2859
2883
|
pr(e), vr(e, o, n, r);
|
|
2860
2884
|
let d = l(() => i.map((t) => ({
|
|
2861
2885
|
title: t.label ?? t.source,
|
|
@@ -2864,7 +2888,7 @@ function ui({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2864
2888
|
onHeaderCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2865
2889
|
onCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2866
2890
|
render: (n, r, i) => t.cell({
|
|
2867
|
-
name:
|
|
2891
|
+
name: di(e, i, t.source),
|
|
2868
2892
|
index: i,
|
|
2869
2893
|
field: e
|
|
2870
2894
|
})
|
|
@@ -2906,8 +2930,8 @@ function ui({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2906
2930
|
]
|
|
2907
2931
|
});
|
|
2908
2932
|
}
|
|
2909
|
-
function
|
|
2910
|
-
let { fields: l, remove: u, appendEmpty: d } =
|
|
2933
|
+
function hi({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, renderRow: a, getCardTitle: o, footer: s, defaultRow: c }) {
|
|
2934
|
+
let { fields: l, remove: u, appendEmpty: d } = pi(e, i, c);
|
|
2911
2935
|
return pr(e), vr(e, i, n, r), /* @__PURE__ */ Y("div", {
|
|
2912
2936
|
style: { marginTop: 24 },
|
|
2913
2937
|
children: [
|
|
@@ -2923,7 +2947,7 @@ function di({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2923
2947
|
let r = {
|
|
2924
2948
|
field: e,
|
|
2925
2949
|
index: n,
|
|
2926
|
-
name: (t) =>
|
|
2950
|
+
name: (t) => di(e, n, t)
|
|
2927
2951
|
};
|
|
2928
2952
|
return /* @__PURE__ */ J(T, {
|
|
2929
2953
|
size: "small",
|
|
@@ -2951,22 +2975,22 @@ function di({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2951
2975
|
}
|
|
2952
2976
|
//#endregion
|
|
2953
2977
|
//#region src/crud/utils/formSectionErrors.ts
|
|
2954
|
-
function
|
|
2978
|
+
function gi(e, t, n) {
|
|
2955
2979
|
for (let r of e) if (t(r, n).invalid) return !0;
|
|
2956
2980
|
return !1;
|
|
2957
2981
|
}
|
|
2958
|
-
function
|
|
2982
|
+
function _i(e) {
|
|
2959
2983
|
let t = u([]);
|
|
2960
2984
|
for (; t.current.length < e;) t.current.push({ current: /* @__PURE__ */ new Set() });
|
|
2961
2985
|
return t.current.length > e && (t.current.length = e), t.current;
|
|
2962
2986
|
}
|
|
2963
|
-
function
|
|
2987
|
+
function vi(e, t) {
|
|
2964
2988
|
let { control: n, getFieldState: r, setFocus: i } = je(), a = Me({ control: n }), o = u(0), c = u(0);
|
|
2965
2989
|
s(() => {
|
|
2966
2990
|
if (a.submitCount === 0) return;
|
|
2967
2991
|
let n = Object.keys(a.errors).length, s = a.submitCount !== o.current, l = !s && n > 0 && c.current === 0;
|
|
2968
2992
|
if (o.current = a.submitCount, c.current = n, !s && !l || n === 0) return;
|
|
2969
|
-
let u = e.findIndex((e) =>
|
|
2993
|
+
let u = e.findIndex((e) => gi(e.current, r, a));
|
|
2970
2994
|
if (u < 0) return;
|
|
2971
2995
|
t(u);
|
|
2972
2996
|
let d = [...e[u].current].find((e) => r(e, a).invalid);
|
|
@@ -2985,22 +3009,22 @@ function mi(e, t) {
|
|
|
2985
3009
|
}
|
|
2986
3010
|
//#endregion
|
|
2987
3011
|
//#region src/crud/FormTabs.tsx
|
|
2988
|
-
function
|
|
3012
|
+
function yi(e) {
|
|
2989
3013
|
return null;
|
|
2990
3014
|
}
|
|
2991
|
-
function
|
|
2992
|
-
return i(e) && e.type ===
|
|
3015
|
+
function bi(e) {
|
|
3016
|
+
return i(e) && e.type === yi;
|
|
2993
3017
|
}
|
|
2994
|
-
function
|
|
2995
|
-
let { token: s } = K.useToken(), c = l(() => e.toArray(t).filter(
|
|
3018
|
+
function xi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o }) {
|
|
3019
|
+
let { token: s } = K.useToken(), c = l(() => e.toArray(t).filter(bi).map((e, t) => ({
|
|
2996
3020
|
key: e.key ?? String(t),
|
|
2997
3021
|
label: e.props.label,
|
|
2998
3022
|
disabled: e.props.disabled,
|
|
2999
3023
|
children: e.props.children
|
|
3000
|
-
})), [t]), u =
|
|
3024
|
+
})), [t]), u = _i(c.length), f = r !== void 0, [p, m] = d(() => n ?? c[0]?.key ?? "0"), h = f ? r : p, g = a((e) => {
|
|
3001
3025
|
f || m(e), i?.(e);
|
|
3002
3026
|
}, [f, i]);
|
|
3003
|
-
|
|
3027
|
+
vi(u, a((e) => {
|
|
3004
3028
|
let t = c[e]?.key;
|
|
3005
3029
|
t != null && g(t);
|
|
3006
3030
|
}, [g, c]));
|
|
@@ -3008,7 +3032,7 @@ function _i({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
3008
3032
|
return /* @__PURE__ */ J(U, {
|
|
3009
3033
|
destroyOnHidden: !1,
|
|
3010
3034
|
items: l(() => c.map((e, t) => {
|
|
3011
|
-
let n =
|
|
3035
|
+
let n = gi(u[t].current, v, y);
|
|
3012
3036
|
return {
|
|
3013
3037
|
key: e.key,
|
|
3014
3038
|
label: n ? /* @__PURE__ */ J("span", {
|
|
@@ -3035,17 +3059,17 @@ function _i({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
3035
3059
|
}
|
|
3036
3060
|
//#endregion
|
|
3037
3061
|
//#region src/crud/FormSteps.tsx
|
|
3038
|
-
function
|
|
3062
|
+
function Si(e) {
|
|
3039
3063
|
return null;
|
|
3040
3064
|
}
|
|
3041
|
-
function
|
|
3042
|
-
return i(e) && e.type ===
|
|
3065
|
+
function Ci(e) {
|
|
3066
|
+
return i(e) && e.type === Si;
|
|
3043
3067
|
}
|
|
3044
|
-
function
|
|
3045
|
-
let m = l(() => e.toArray(t).filter(
|
|
3046
|
-
|
|
3068
|
+
function wi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStepSelect: i = !1, stepsStyle: o, navigationStyle: s, size: c, direction: u, type: f, status: p }) {
|
|
3069
|
+
let m = l(() => e.toArray(t).filter(Ci), [t]), h = _i(m.length), [g, _] = d(n), v = m.length - 1;
|
|
3070
|
+
vi(h, _);
|
|
3047
3071
|
let { control: y, getFieldState: b } = je(), x = Me({ control: y }), S = l(() => m.map((e, t) => {
|
|
3048
|
-
let n =
|
|
3072
|
+
let n = gi(h[t].current, b, x);
|
|
3049
3073
|
return {
|
|
3050
3074
|
title: e.props.title,
|
|
3051
3075
|
description: e.props.description,
|
|
@@ -3099,35 +3123,44 @@ function bi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
3099
3123
|
] });
|
|
3100
3124
|
}
|
|
3101
3125
|
//#endregion
|
|
3126
|
+
//#region src/crud/utils/shouldRegisterSourceInPayload.ts
|
|
3127
|
+
function Ti(e, t) {
|
|
3128
|
+
return t == null || t === e;
|
|
3129
|
+
}
|
|
3130
|
+
//#endregion
|
|
3102
3131
|
//#region src/crud/fields/FieldWrapper.tsx
|
|
3103
|
-
function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
3104
|
-
let
|
|
3105
|
-
return pr(e,
|
|
3106
|
-
name:
|
|
3107
|
-
control:
|
|
3132
|
+
function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, children: s }) {
|
|
3133
|
+
let c = t ?? e, l = Ti(e, t), u = ci(e, o, li()), { control: d } = je(), f = or(), p = a ? void 0 : n ?? e, m = n ?? e;
|
|
3134
|
+
return pr(e, l), mr(e, l), u ? /* @__PURE__ */ J(De, {
|
|
3135
|
+
name: c,
|
|
3136
|
+
control: d,
|
|
3137
|
+
render: () => /* @__PURE__ */ J(q, {})
|
|
3138
|
+
}) : /* @__PURE__ */ J(De, {
|
|
3139
|
+
name: c,
|
|
3140
|
+
control: d,
|
|
3108
3141
|
rules: {
|
|
3109
|
-
required: r ? `${
|
|
3142
|
+
required: r ? `${m} is required` : !1,
|
|
3110
3143
|
...i
|
|
3111
3144
|
},
|
|
3112
3145
|
render: ({ field: e, fieldState: t }) => /* @__PURE__ */ J(M.Item, {
|
|
3113
|
-
label:
|
|
3146
|
+
label: p,
|
|
3114
3147
|
validateStatus: t.error ? "error" : void 0,
|
|
3115
3148
|
help: t.error?.message,
|
|
3116
3149
|
required: r && !a,
|
|
3117
3150
|
style: a ? { marginBottom: 0 } : void 0,
|
|
3118
|
-
children:
|
|
3151
|
+
children: s({
|
|
3119
3152
|
value: e.value,
|
|
3120
3153
|
onChange: e.onChange,
|
|
3121
3154
|
onBlur: e.onBlur,
|
|
3122
|
-
disabled:
|
|
3123
|
-
name:
|
|
3155
|
+
disabled: f?.disabled,
|
|
3156
|
+
name: c
|
|
3124
3157
|
})
|
|
3125
3158
|
})
|
|
3126
3159
|
});
|
|
3127
3160
|
}
|
|
3128
3161
|
//#endregion
|
|
3129
3162
|
//#region src/crud/fields/TextField.tsx
|
|
3130
|
-
function
|
|
3163
|
+
function Ei({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s, hidden: c }) {
|
|
3131
3164
|
return /* @__PURE__ */ J($, {
|
|
3132
3165
|
source: e,
|
|
3133
3166
|
name: t,
|
|
@@ -3135,6 +3168,7 @@ function xi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3135
3168
|
required: r,
|
|
3136
3169
|
rules: i,
|
|
3137
3170
|
hideLabel: s,
|
|
3171
|
+
hidden: c,
|
|
3138
3172
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(F, {
|
|
3139
3173
|
value: e,
|
|
3140
3174
|
onChange: (e) => t(e.target.value),
|
|
@@ -3147,7 +3181,7 @@ function xi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3147
3181
|
}
|
|
3148
3182
|
//#endregion
|
|
3149
3183
|
//#region src/crud/fields/TextAreaField.tsx
|
|
3150
|
-
function
|
|
3184
|
+
function Di({ 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 }) {
|
|
3151
3185
|
return /* @__PURE__ */ J($, {
|
|
3152
3186
|
source: e,
|
|
3153
3187
|
name: t,
|
|
@@ -3155,6 +3189,7 @@ function Si({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3155
3189
|
required: r,
|
|
3156
3190
|
rules: i,
|
|
3157
3191
|
hideLabel: s,
|
|
3192
|
+
hidden: c,
|
|
3158
3193
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(F.TextArea, {
|
|
3159
3194
|
value: e,
|
|
3160
3195
|
onChange: (e) => t(e.target.value),
|
|
@@ -3162,16 +3197,16 @@ function Si({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3162
3197
|
placeholder: a,
|
|
3163
3198
|
disabled: r,
|
|
3164
3199
|
style: o,
|
|
3165
|
-
rows:
|
|
3166
|
-
maxLength:
|
|
3167
|
-
showCount:
|
|
3168
|
-
autoSize:
|
|
3200
|
+
rows: f ? void 0 : l,
|
|
3201
|
+
maxLength: u,
|
|
3202
|
+
showCount: d,
|
|
3203
|
+
autoSize: f
|
|
3169
3204
|
})
|
|
3170
3205
|
});
|
|
3171
3206
|
}
|
|
3172
3207
|
//#endregion
|
|
3173
3208
|
//#region src/crud/fields/NumberField.tsx
|
|
3174
|
-
function
|
|
3209
|
+
function Oi({ source: e, name: t, label: n, required: r, rules: i, min: a, max: o, step: s, inputStyle: c, hideLabel: l, hidden: u }) {
|
|
3175
3210
|
return /* @__PURE__ */ J($, {
|
|
3176
3211
|
source: e,
|
|
3177
3212
|
name: t,
|
|
@@ -3179,6 +3214,7 @@ function Ci({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3179
3214
|
required: r,
|
|
3180
3215
|
rules: i,
|
|
3181
3216
|
hideLabel: l,
|
|
3217
|
+
hidden: u,
|
|
3182
3218
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(I, {
|
|
3183
3219
|
value: e,
|
|
3184
3220
|
onChange: (e) => t(e),
|
|
@@ -3196,7 +3232,7 @@ function Ci({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3196
3232
|
}
|
|
3197
3233
|
//#endregion
|
|
3198
3234
|
//#region src/crud/fields/BooleanField.tsx
|
|
3199
|
-
function
|
|
3235
|
+
function ki({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, disabled: s }) {
|
|
3200
3236
|
return /* @__PURE__ */ J($, {
|
|
3201
3237
|
source: e,
|
|
3202
3238
|
name: t,
|
|
@@ -3204,16 +3240,17 @@ function wi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3204
3240
|
required: r,
|
|
3205
3241
|
rules: i,
|
|
3206
3242
|
hideLabel: a,
|
|
3243
|
+
hidden: o,
|
|
3207
3244
|
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(oe, {
|
|
3208
3245
|
checked: !!e,
|
|
3209
3246
|
onChange: t,
|
|
3210
|
-
disabled: n ||
|
|
3247
|
+
disabled: n || s
|
|
3211
3248
|
})
|
|
3212
3249
|
});
|
|
3213
3250
|
}
|
|
3214
3251
|
//#endregion
|
|
3215
3252
|
//#region src/crud/utils/parseDayjsValue.ts
|
|
3216
|
-
var
|
|
3253
|
+
var Ai = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
3217
3254
|
(function(n, r) {
|
|
3218
3255
|
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();
|
|
3219
3256
|
})(e, (function() {
|
|
@@ -3370,8 +3407,8 @@ var Ti = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
|
3370
3407
|
};
|
|
3371
3408
|
}));
|
|
3372
3409
|
})))(), 1);
|
|
3373
|
-
Pe.extend(
|
|
3374
|
-
function
|
|
3410
|
+
Pe.extend(Ai.default);
|
|
3411
|
+
function ji(e, t) {
|
|
3375
3412
|
if (e == null || e === "") return null;
|
|
3376
3413
|
if (Pe.isDayjs(e)) return e;
|
|
3377
3414
|
let n = Pe(String(e), t, !0);
|
|
@@ -3379,13 +3416,13 @@ function Ei(e, t) {
|
|
|
3379
3416
|
}
|
|
3380
3417
|
//#endregion
|
|
3381
3418
|
//#region src/crud/fields/DateField.tsx
|
|
3382
|
-
var
|
|
3383
|
-
|
|
3384
|
-
|
|
3419
|
+
var Mi = "YYYY-MM-DD", Ni = `${Mi} HH:mm:ss`, Pi = [
|
|
3420
|
+
Mi,
|
|
3421
|
+
Ni,
|
|
3385
3422
|
"YYYY-MM-DDTHH:mm:ss",
|
|
3386
3423
|
"YYYY-MM-DDTHH:mm:ssZ"
|
|
3387
3424
|
];
|
|
3388
|
-
function
|
|
3425
|
+
function Fi({ source: e, name: t, label: n, required: r, rules: i, showTime: a, hideLabel: o, hidden: s }) {
|
|
3389
3426
|
return /* @__PURE__ */ J($, {
|
|
3390
3427
|
source: e,
|
|
3391
3428
|
name: t,
|
|
@@ -3393,34 +3430,35 @@ function Ai({ source: e, name: t, label: n, required: r, rules: i, showTime: a,
|
|
|
3393
3430
|
required: r,
|
|
3394
3431
|
rules: i,
|
|
3395
3432
|
hideLabel: o,
|
|
3433
|
+
hidden: s,
|
|
3396
3434
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(O, {
|
|
3397
|
-
value:
|
|
3398
|
-
onChange: (e) => t(e ? e.format(a ?
|
|
3435
|
+
value: ji(e, a ? [...Pi, Ni] : Pi),
|
|
3436
|
+
onChange: (e) => t(e ? e.format(a ? Ni : Mi) : null),
|
|
3399
3437
|
onBlur: n,
|
|
3400
3438
|
showTime: a,
|
|
3401
3439
|
disabled: r,
|
|
3402
|
-
format: a ?
|
|
3440
|
+
format: a ? Ni : Mi,
|
|
3403
3441
|
style: { width: "100%" }
|
|
3404
3442
|
})
|
|
3405
3443
|
});
|
|
3406
3444
|
}
|
|
3407
3445
|
//#endregion
|
|
3408
3446
|
//#region src/crud/fields/DateTimeField.tsx
|
|
3409
|
-
function
|
|
3410
|
-
return /* @__PURE__ */ J(
|
|
3447
|
+
function Ii(e) {
|
|
3448
|
+
return /* @__PURE__ */ J(Fi, {
|
|
3411
3449
|
showTime: !0,
|
|
3412
3450
|
...e
|
|
3413
3451
|
});
|
|
3414
3452
|
}
|
|
3415
3453
|
//#endregion
|
|
3416
3454
|
//#region src/crud/fields/TimeField.tsx
|
|
3417
|
-
var
|
|
3418
|
-
|
|
3455
|
+
var Li = "HH:mm:ss", Ri = [
|
|
3456
|
+
Li,
|
|
3419
3457
|
"HH:mm",
|
|
3420
3458
|
"H:mm:ss",
|
|
3421
3459
|
"H:mm"
|
|
3422
3460
|
];
|
|
3423
|
-
function
|
|
3461
|
+
function zi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, format: s = Li }) {
|
|
3424
3462
|
return /* @__PURE__ */ J($, {
|
|
3425
3463
|
source: e,
|
|
3426
3464
|
name: t,
|
|
@@ -3428,19 +3466,20 @@ function Pi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3428
3466
|
required: r,
|
|
3429
3467
|
rules: i,
|
|
3430
3468
|
hideLabel: a,
|
|
3469
|
+
hidden: o,
|
|
3431
3470
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(ce, {
|
|
3432
|
-
value:
|
|
3433
|
-
onChange: (e) => t(e ? e.format(
|
|
3471
|
+
value: ji(e, Ri),
|
|
3472
|
+
onChange: (e) => t(e ? e.format(s) : null),
|
|
3434
3473
|
onBlur: n,
|
|
3435
3474
|
disabled: r,
|
|
3436
|
-
format:
|
|
3475
|
+
format: s,
|
|
3437
3476
|
style: { width: "100%" }
|
|
3438
3477
|
})
|
|
3439
3478
|
});
|
|
3440
3479
|
}
|
|
3441
3480
|
//#endregion
|
|
3442
3481
|
//#region src/crud/fields/SelectField.tsx
|
|
3443
|
-
function
|
|
3482
|
+
function Bi({ source: e, name: t, label: n, required: r, rules: i, choices: a, mode: o, allowClear: s, hideLabel: c, hidden: l }) {
|
|
3444
3483
|
return /* @__PURE__ */ J($, {
|
|
3445
3484
|
source: e,
|
|
3446
3485
|
name: t,
|
|
@@ -3448,6 +3487,7 @@ function Fi({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3448
3487
|
required: r,
|
|
3449
3488
|
rules: i,
|
|
3450
3489
|
hideLabel: c,
|
|
3490
|
+
hidden: l,
|
|
3451
3491
|
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(B, {
|
|
3452
3492
|
value: e,
|
|
3453
3493
|
onChange: t,
|
|
@@ -3461,7 +3501,7 @@ function Fi({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3461
3501
|
}
|
|
3462
3502
|
//#endregion
|
|
3463
3503
|
//#region src/crud/fields/PasswordField.tsx
|
|
3464
|
-
function
|
|
3504
|
+
function Vi({ source: e, name: t, label: n, required: r, rules: i, autoComplete: a, hideLabel: o, hidden: s }) {
|
|
3465
3505
|
return /* @__PURE__ */ J($, {
|
|
3466
3506
|
source: e,
|
|
3467
3507
|
name: t,
|
|
@@ -3469,6 +3509,7 @@ function Ii({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3469
3509
|
required: r,
|
|
3470
3510
|
rules: i,
|
|
3471
3511
|
hideLabel: o,
|
|
3512
|
+
hidden: s,
|
|
3472
3513
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(F.Password, {
|
|
3473
3514
|
value: e,
|
|
3474
3515
|
onChange: (e) => t(e.target.value),
|
|
@@ -3478,86 +3519,89 @@ function Ii({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3478
3519
|
})
|
|
3479
3520
|
});
|
|
3480
3521
|
}
|
|
3481
|
-
function
|
|
3482
|
-
let
|
|
3522
|
+
function Hi({ 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
|
+
let u = Ne({
|
|
3483
3524
|
name: t ?? e,
|
|
3484
3525
|
disabled: !a
|
|
3485
3526
|
});
|
|
3486
|
-
return a ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(
|
|
3527
|
+
return a ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(Vi, {
|
|
3487
3528
|
source: e,
|
|
3488
3529
|
name: t,
|
|
3489
3530
|
label: n,
|
|
3490
3531
|
required: r,
|
|
3491
3532
|
rules: i,
|
|
3492
3533
|
autoComplete: s,
|
|
3493
|
-
hideLabel: c
|
|
3494
|
-
|
|
3534
|
+
hideLabel: c,
|
|
3535
|
+
hidden: l
|
|
3536
|
+
}), /* @__PURE__ */ J(Vi, {
|
|
3495
3537
|
source: a,
|
|
3496
3538
|
label: o,
|
|
3497
3539
|
required: r,
|
|
3498
3540
|
autoComplete: s,
|
|
3499
3541
|
hideLabel: c,
|
|
3500
|
-
rules: { validate: (e) => !
|
|
3501
|
-
|
|
3542
|
+
rules: { validate: (e) => !u || e === u || "Passwords do not match" },
|
|
3543
|
+
hidden: l
|
|
3544
|
+
})] }) : /* @__PURE__ */ J(Vi, {
|
|
3502
3545
|
source: e,
|
|
3503
3546
|
name: t,
|
|
3504
3547
|
label: n,
|
|
3505
3548
|
required: r,
|
|
3506
3549
|
rules: i,
|
|
3507
3550
|
autoComplete: s,
|
|
3508
|
-
hideLabel: c
|
|
3551
|
+
hideLabel: c,
|
|
3552
|
+
hidden: l
|
|
3509
3553
|
});
|
|
3510
3554
|
}
|
|
3511
3555
|
//#endregion
|
|
3512
3556
|
//#region src/crud/utils/choiceSelectionUtils.ts
|
|
3513
|
-
function
|
|
3557
|
+
function Ui(e, t) {
|
|
3514
3558
|
return typeof e == "object" && !!e && !Array.isArray(e) && t in e;
|
|
3515
3559
|
}
|
|
3516
|
-
function
|
|
3560
|
+
function Wi(e, t) {
|
|
3517
3561
|
if (!(e == null || e === "")) {
|
|
3518
|
-
if (
|
|
3562
|
+
if (Ui(e, t)) {
|
|
3519
3563
|
let n = e[t];
|
|
3520
3564
|
return typeof n == "string" || typeof n == "number" ? n : void 0;
|
|
3521
3565
|
}
|
|
3522
3566
|
if (typeof e == "string" || typeof e == "number") return e;
|
|
3523
3567
|
}
|
|
3524
3568
|
}
|
|
3525
|
-
function
|
|
3526
|
-
return Array.isArray(e) ? e.map((e) =>
|
|
3569
|
+
function Gi(e, t) {
|
|
3570
|
+
return Array.isArray(e) ? e.map((e) => Wi(e, t)).filter((e) => e != null) : [];
|
|
3527
3571
|
}
|
|
3528
|
-
function
|
|
3529
|
-
return e == null ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "").map((e) =>
|
|
3572
|
+
function Ki(e, t) {
|
|
3573
|
+
return e == null ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "").map((e) => Ui(e, t) ? e[t] : e);
|
|
3530
3574
|
}
|
|
3531
|
-
function
|
|
3575
|
+
function qi(e, t, n) {
|
|
3532
3576
|
let r = [];
|
|
3533
|
-
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) =>
|
|
3577
|
+
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) => Ui(e, n))) : Ui(t, n) && r.push(t)), e == null) return r;
|
|
3534
3578
|
let i = Array.isArray(e) ? e : [e];
|
|
3535
|
-
for (let e of i)
|
|
3579
|
+
for (let e of i) Ui(e, n) && r.push(e);
|
|
3536
3580
|
return r;
|
|
3537
3581
|
}
|
|
3538
|
-
function
|
|
3582
|
+
function Ji(e, t) {
|
|
3539
3583
|
return typeof t == "function" ? t(e) : String(e[t] ?? "");
|
|
3540
3584
|
}
|
|
3541
|
-
function
|
|
3585
|
+
function Yi(e, t, n) {
|
|
3542
3586
|
return e.map((e) => ({
|
|
3543
|
-
label:
|
|
3587
|
+
label: Ji(e, t),
|
|
3544
3588
|
value: e[n],
|
|
3545
3589
|
record: e
|
|
3546
3590
|
}));
|
|
3547
3591
|
}
|
|
3548
|
-
function
|
|
3592
|
+
function Xi(e, t) {
|
|
3549
3593
|
let n = /* @__PURE__ */ new Map();
|
|
3550
3594
|
for (let t of e) n.set(t.value, t);
|
|
3551
3595
|
for (let e of t) n.set(e.value, e);
|
|
3552
3596
|
return Array.from(n.values());
|
|
3553
3597
|
}
|
|
3554
|
-
function
|
|
3598
|
+
function Zi(e, t) {
|
|
3555
3599
|
return e.filter((e) => !t.some((t) => t.value === e));
|
|
3556
3600
|
}
|
|
3557
|
-
function
|
|
3558
|
-
return
|
|
3601
|
+
function Qi(e, t, n = []) {
|
|
3602
|
+
return Xi(n, e.filter((e) => t.some((t) => e.value === t)));
|
|
3559
3603
|
}
|
|
3560
|
-
function
|
|
3604
|
+
function $i(e = {}) {
|
|
3561
3605
|
let t = e.popupMatchSelectWidth ?? !1;
|
|
3562
3606
|
return t === !1 ? {
|
|
3563
3607
|
popupMatchSelectWidth: !1,
|
|
@@ -3566,27 +3610,27 @@ function Ji(e = {}) {
|
|
|
3566
3610
|
}
|
|
3567
3611
|
//#endregion
|
|
3568
3612
|
//#region src/crud/utils/referenceSelectNotFoundContent.tsx
|
|
3569
|
-
function
|
|
3613
|
+
function ea(e) {
|
|
3570
3614
|
return e ? /* @__PURE__ */ J(ae, { size: "small" }) : void 0;
|
|
3571
3615
|
}
|
|
3572
3616
|
//#endregion
|
|
3573
3617
|
//#region src/crud/utils/referenceSelectSelectedProps.ts
|
|
3574
|
-
function
|
|
3618
|
+
function ta(e, t, n) {
|
|
3575
3619
|
return {
|
|
3576
3620
|
loading: e || t,
|
|
3577
3621
|
disabled: !!(n || t)
|
|
3578
3622
|
};
|
|
3579
3623
|
}
|
|
3580
|
-
function
|
|
3624
|
+
function na(e, t, n) {
|
|
3581
3625
|
return e ? n : t;
|
|
3582
3626
|
}
|
|
3583
3627
|
//#endregion
|
|
3584
3628
|
//#region src/crud/utils/useChoices.ts
|
|
3585
|
-
var
|
|
3586
|
-
function
|
|
3629
|
+
var ra = /* @__PURE__ */ new Map(), ia = /* @__PURE__ */ new Map();
|
|
3630
|
+
function aa(e, t) {
|
|
3587
3631
|
return typeof e == "function" ? `fn:${t ?? ""}` : Array.isArray(e) ? `static:${e.length}` : `res:${e.resource}:${JSON.stringify(e.filter ?? {})}:${t ?? ""}`;
|
|
3588
3632
|
}
|
|
3589
|
-
async function
|
|
3633
|
+
async function oa(e, t, n, r, i) {
|
|
3590
3634
|
return typeof e == "function" ? e({
|
|
3591
3635
|
dataProvider: t,
|
|
3592
3636
|
search: i
|
|
@@ -3600,25 +3644,25 @@ async function ta(e, t, n, r, i) {
|
|
|
3600
3644
|
perPage: 500
|
|
3601
3645
|
}
|
|
3602
3646
|
})).data.map((e) => ({
|
|
3603
|
-
label:
|
|
3647
|
+
label: Ji(e, n),
|
|
3604
3648
|
value: e[r],
|
|
3605
3649
|
record: e
|
|
3606
3650
|
}));
|
|
3607
3651
|
}
|
|
3608
|
-
function
|
|
3609
|
-
let o =
|
|
3652
|
+
function sa(e, t, n, r, i, a) {
|
|
3653
|
+
let o = aa(e, i);
|
|
3610
3654
|
if (a) {
|
|
3611
|
-
let e =
|
|
3655
|
+
let e = ra.get(o);
|
|
3612
3656
|
if (e && !i) return Promise.resolve(e);
|
|
3613
3657
|
}
|
|
3614
|
-
let s =
|
|
3658
|
+
let s = ia.get(o);
|
|
3615
3659
|
if (s) return s;
|
|
3616
|
-
let c =
|
|
3617
|
-
|
|
3660
|
+
let c = oa(e, t, n, r, i).then((e) => (a && !i && ra.set(o, e), e)).finally(() => {
|
|
3661
|
+
ia.delete(o);
|
|
3618
3662
|
});
|
|
3619
|
-
return
|
|
3663
|
+
return ia.set(o, c), c;
|
|
3620
3664
|
}
|
|
3621
|
-
function
|
|
3665
|
+
function ca(e, t, n = "name", r = "id", i, o = {}) {
|
|
3622
3666
|
let { lazy: c = !1, active: f = !1, selectedValues: p, selectedRecords: m, fetchSelected: h = !0, cache: g } = o, _ = g ?? !c, v = Yt(), y = l(() => {
|
|
3623
3667
|
if (e) return e;
|
|
3624
3668
|
if (t) return {
|
|
@@ -3629,16 +3673,16 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3629
3673
|
e,
|
|
3630
3674
|
t,
|
|
3631
3675
|
i
|
|
3632
|
-
]), b = y ?
|
|
3676
|
+
]), b = y ? aa(y, i) : void 0, x = l(() => Ki(p, r), [p, r]), S = l(() => Yi(qi(p, m, r), n, r), [
|
|
3633
3677
|
p,
|
|
3634
3678
|
m,
|
|
3635
3679
|
n,
|
|
3636
3680
|
r
|
|
3637
|
-
]), C = !!(y && (!c || f || Array.isArray(y))), [w, T] = d(() => S.length ? S : !b || i || c || !_ ? [] :
|
|
3681
|
+
]), C = !!(y && (!c || f || Array.isArray(y))), [w, T] = d(() => S.length ? S : !b || i || c || !_ ? [] : ra.get(b) ?? []), [E, D] = d(() => C ? !_ || !b || i ? !!y : !ra.has(b) : !1), [O, k] = d(() => !!(h && t && Zi(x, S).length)), A = u(w);
|
|
3638
3682
|
A.current = w;
|
|
3639
3683
|
let j = u(x);
|
|
3640
3684
|
j.current = x, s(() => {
|
|
3641
|
-
S.length && T((e) =>
|
|
3685
|
+
S.length && T((e) => Xi(e, S));
|
|
3642
3686
|
}, [S]);
|
|
3643
3687
|
let M = a(async () => {
|
|
3644
3688
|
if (!y || !C) {
|
|
@@ -3646,18 +3690,18 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3646
3690
|
return;
|
|
3647
3691
|
}
|
|
3648
3692
|
if (_) {
|
|
3649
|
-
let e =
|
|
3693
|
+
let e = aa(y, i), t = ra.get(e);
|
|
3650
3694
|
if (t && !i) {
|
|
3651
|
-
T((e) =>
|
|
3695
|
+
T((e) => Xi(Qi(e, j.current, S), t)), D(!1);
|
|
3652
3696
|
return;
|
|
3653
3697
|
}
|
|
3654
3698
|
}
|
|
3655
|
-
D(!0), c && T((e) =>
|
|
3699
|
+
D(!0), c && T((e) => Qi(e, j.current, S));
|
|
3656
3700
|
try {
|
|
3657
|
-
let e = await
|
|
3658
|
-
T((t) =>
|
|
3701
|
+
let e = await sa(y, v, n, r, i, _);
|
|
3702
|
+
T((t) => Xi(Qi(t, j.current, S), e));
|
|
3659
3703
|
} catch {
|
|
3660
|
-
!x.length && !S.length ? T([]) : c && T((e) =>
|
|
3704
|
+
!x.length && !S.length ? T([]) : c && T((e) => Qi(e, j.current, S));
|
|
3661
3705
|
} finally {
|
|
3662
3706
|
D(!1);
|
|
3663
3707
|
}
|
|
@@ -3676,7 +3720,7 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3676
3720
|
s(() => {
|
|
3677
3721
|
M();
|
|
3678
3722
|
}, [M]), s(() => {
|
|
3679
|
-
c && !f && !i && (T((e) =>
|
|
3723
|
+
c && !f && !i && (T((e) => Qi(e, x, S)), D(!1));
|
|
3680
3724
|
}, [
|
|
3681
3725
|
c,
|
|
3682
3726
|
f,
|
|
@@ -3688,7 +3732,7 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3688
3732
|
k(!1);
|
|
3689
3733
|
return;
|
|
3690
3734
|
}
|
|
3691
|
-
let e =
|
|
3735
|
+
let e = Zi(x, Xi(S, A.current));
|
|
3692
3736
|
if (!e.length) {
|
|
3693
3737
|
k(!1);
|
|
3694
3738
|
return;
|
|
@@ -3699,7 +3743,7 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3699
3743
|
for (let i of e) try {
|
|
3700
3744
|
let e = (await v.getOne(t, i)).data;
|
|
3701
3745
|
a.push({
|
|
3702
|
-
label:
|
|
3746
|
+
label: Ji(e, n),
|
|
3703
3747
|
value: e[r],
|
|
3704
3748
|
record: e
|
|
3705
3749
|
});
|
|
@@ -3711,7 +3755,7 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3711
3755
|
}
|
|
3712
3756
|
i || (a.length && T((e) => {
|
|
3713
3757
|
let t = a.filter((t) => !e.some((e) => e.value === t.value));
|
|
3714
|
-
return t.length ?
|
|
3758
|
+
return t.length ? Xi(e, t) : e;
|
|
3715
3759
|
}), k(!1));
|
|
3716
3760
|
})(), () => {
|
|
3717
3761
|
i = !0;
|
|
@@ -3738,7 +3782,7 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3738
3782
|
}
|
|
3739
3783
|
//#endregion
|
|
3740
3784
|
//#region src/crud/fields/ReferenceInputActions.tsx
|
|
3741
|
-
function
|
|
3785
|
+
function la({ reference: e, referenceForm: t, referencePermissions: n, referenceTitle: r, referenceDefaultValues: i, referenceModalWidth: a, selectedId: o, disabled: s, onCreated: c, onUpdated: l }) {
|
|
3742
3786
|
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);
|
|
3743
3787
|
return !p && !m ? null : /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y(V, {
|
|
3744
3788
|
size: 4,
|
|
@@ -3778,35 +3822,35 @@ function ia({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3778
3822
|
}
|
|
3779
3823
|
//#endregion
|
|
3780
3824
|
//#region src/crud/fields/ReferenceField.tsx
|
|
3781
|
-
function
|
|
3782
|
-
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A =
|
|
3825
|
+
function ua({ 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 }) {
|
|
3826
|
+
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A = Wi(p, r), { options: j, loading: M, selectedLoading: N, optionForValue: P, reload: F } = ca(t, e, n, r, i ? T : void 0, {
|
|
3783
3827
|
lazy: u,
|
|
3784
3828
|
active: k,
|
|
3785
3829
|
selectedValues: p,
|
|
3786
3830
|
selectedRecords: g,
|
|
3787
3831
|
fetchSelected: f
|
|
3788
|
-
}), I =
|
|
3832
|
+
}), I = ta(M, N, o), L = l(() => j.map((e) => ({
|
|
3789
3833
|
label: e.label,
|
|
3790
3834
|
value: e.value
|
|
3791
3835
|
})), [j]), ee = (e) => {
|
|
3792
3836
|
let t = e[r];
|
|
3793
3837
|
m(t), c?.(t, {
|
|
3794
|
-
label:
|
|
3838
|
+
label: Ji(e, n),
|
|
3795
3839
|
value: t,
|
|
3796
3840
|
record: e
|
|
3797
3841
|
}, { name: h }), F();
|
|
3798
3842
|
}, R = /* @__PURE__ */ J(B, {
|
|
3799
|
-
|
|
3843
|
+
...$i({
|
|
3800
3844
|
popupMatchSelectWidth: C,
|
|
3801
3845
|
popupMinWidth: w
|
|
3802
3846
|
}),
|
|
3803
|
-
value:
|
|
3847
|
+
value: na(N, A, void 0),
|
|
3804
3848
|
onChange: (e) => {
|
|
3805
3849
|
m(e), c?.(e, P(e), { name: h });
|
|
3806
3850
|
},
|
|
3807
3851
|
options: L,
|
|
3808
3852
|
loading: I.loading,
|
|
3809
|
-
notFoundContent:
|
|
3853
|
+
notFoundContent: ea(I.loading),
|
|
3810
3854
|
showSearch: i,
|
|
3811
3855
|
filterOption: i ? !1 : void 0,
|
|
3812
3856
|
onSearch: i ? E : void 0,
|
|
@@ -3835,7 +3879,7 @@ function aa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3835
3879
|
minWidth: 0
|
|
3836
3880
|
},
|
|
3837
3881
|
children: R
|
|
3838
|
-
}), /* @__PURE__ */ J(
|
|
3882
|
+
}), /* @__PURE__ */ J(la, {
|
|
3839
3883
|
reference: e,
|
|
3840
3884
|
referenceForm: _,
|
|
3841
3885
|
referencePermissions: v,
|
|
@@ -3849,10 +3893,10 @@ function aa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3849
3893
|
})]
|
|
3850
3894
|
}) : R;
|
|
3851
3895
|
}
|
|
3852
|
-
function
|
|
3853
|
-
let
|
|
3854
|
-
name:
|
|
3855
|
-
disabled: !
|
|
3896
|
+
function da({ 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
|
+
let D = Ne({
|
|
3898
|
+
name: _ ?? "",
|
|
3899
|
+
disabled: !_
|
|
3856
3900
|
});
|
|
3857
3901
|
return /* @__PURE__ */ J($, {
|
|
3858
3902
|
source: e,
|
|
@@ -3861,7 +3905,8 @@ function oa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3861
3905
|
required: s,
|
|
3862
3906
|
rules: c,
|
|
3863
3907
|
hideLabel: f,
|
|
3864
|
-
|
|
3908
|
+
hidden: p,
|
|
3909
|
+
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ J(ua, {
|
|
3865
3910
|
reference: r,
|
|
3866
3911
|
choices: i,
|
|
3867
3912
|
optionLabel: a,
|
|
@@ -3869,48 +3914,48 @@ function oa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3869
3914
|
search: l,
|
|
3870
3915
|
allowClear: u,
|
|
3871
3916
|
disabled: n || d,
|
|
3872
|
-
inputStyle:
|
|
3873
|
-
onValueChange:
|
|
3874
|
-
lazy:
|
|
3875
|
-
fetchSelected:
|
|
3917
|
+
inputStyle: m,
|
|
3918
|
+
onValueChange: h,
|
|
3919
|
+
lazy: g,
|
|
3920
|
+
fetchSelected: v,
|
|
3876
3921
|
value: e,
|
|
3877
3922
|
onChange: t,
|
|
3878
3923
|
fieldName: s,
|
|
3879
|
-
selectedRecords:
|
|
3880
|
-
referenceForm:
|
|
3881
|
-
referencePermissions:
|
|
3882
|
-
referenceTitle:
|
|
3883
|
-
referenceDefaultValues:
|
|
3884
|
-
referenceModalWidth:
|
|
3885
|
-
referenceActions:
|
|
3886
|
-
popupMatchSelectWidth:
|
|
3887
|
-
popupMinWidth:
|
|
3924
|
+
selectedRecords: _ ? D : void 0,
|
|
3925
|
+
referenceForm: y,
|
|
3926
|
+
referencePermissions: b,
|
|
3927
|
+
referenceTitle: x,
|
|
3928
|
+
referenceDefaultValues: S,
|
|
3929
|
+
referenceModalWidth: C,
|
|
3930
|
+
referenceActions: w,
|
|
3931
|
+
popupMatchSelectWidth: T,
|
|
3932
|
+
popupMinWidth: E
|
|
3888
3933
|
})
|
|
3889
3934
|
});
|
|
3890
3935
|
}
|
|
3891
3936
|
//#endregion
|
|
3892
3937
|
//#region src/crud/fields/ReferenceManyField.tsx
|
|
3893
|
-
function
|
|
3894
|
-
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D =
|
|
3938
|
+
function fa({ 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 }) {
|
|
3939
|
+
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D = Gi(c, r), { options: O, loading: k, selectedLoading: A, reload: j } = ca(t, e, n, r, i ? S : void 0, {
|
|
3895
3940
|
lazy: o,
|
|
3896
3941
|
active: E,
|
|
3897
3942
|
selectedValues: c,
|
|
3898
3943
|
selectedRecords: p,
|
|
3899
3944
|
fetchSelected: s
|
|
3900
|
-
}), M =
|
|
3945
|
+
}), M = ta(k, A, f), N = l(() => O.map((e) => ({
|
|
3901
3946
|
label: e.label,
|
|
3902
3947
|
value: e.value
|
|
3903
3948
|
})), [O]), P = /* @__PURE__ */ J(B, {
|
|
3904
|
-
|
|
3949
|
+
...$i({
|
|
3905
3950
|
popupMatchSelectWidth: b,
|
|
3906
3951
|
popupMinWidth: x
|
|
3907
3952
|
}),
|
|
3908
3953
|
mode: "multiple",
|
|
3909
|
-
value:
|
|
3954
|
+
value: na(A, D, []),
|
|
3910
3955
|
onChange: u,
|
|
3911
3956
|
options: N,
|
|
3912
3957
|
loading: M.loading,
|
|
3913
|
-
notFoundContent:
|
|
3958
|
+
notFoundContent: ea(M.loading),
|
|
3914
3959
|
showSearch: i,
|
|
3915
3960
|
filterOption: i ? !1 : void 0,
|
|
3916
3961
|
onSearch: i ? C : void 0,
|
|
@@ -3935,7 +3980,7 @@ function sa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3935
3980
|
minWidth: 0
|
|
3936
3981
|
},
|
|
3937
3982
|
children: P
|
|
3938
|
-
}), /* @__PURE__ */ J(
|
|
3983
|
+
}), /* @__PURE__ */ J(la, {
|
|
3939
3984
|
reference: e,
|
|
3940
3985
|
referenceForm: m,
|
|
3941
3986
|
referencePermissions: h,
|
|
@@ -3954,10 +3999,10 @@ function sa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3954
3999
|
})]
|
|
3955
4000
|
}) : P;
|
|
3956
4001
|
}
|
|
3957
|
-
function
|
|
3958
|
-
let
|
|
3959
|
-
name:
|
|
3960
|
-
disabled: !
|
|
4002
|
+
function pa({ 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
|
+
let T = Ne({
|
|
4004
|
+
name: h ?? "",
|
|
4005
|
+
disabled: !h
|
|
3961
4006
|
});
|
|
3962
4007
|
return /* @__PURE__ */ J($, {
|
|
3963
4008
|
source: e,
|
|
@@ -3966,36 +4011,37 @@ function ca({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3966
4011
|
required: s,
|
|
3967
4012
|
rules: c,
|
|
3968
4013
|
hideLabel: d,
|
|
3969
|
-
|
|
4014
|
+
hidden: f,
|
|
4015
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(fa, {
|
|
3970
4016
|
reference: r,
|
|
3971
4017
|
choices: i,
|
|
3972
4018
|
optionLabel: a,
|
|
3973
4019
|
optionValue: o,
|
|
3974
4020
|
search: l,
|
|
3975
4021
|
allowClear: u,
|
|
3976
|
-
lazy:
|
|
3977
|
-
fetchSelected:
|
|
4022
|
+
lazy: m,
|
|
4023
|
+
fetchSelected: g,
|
|
3978
4024
|
value: e,
|
|
3979
4025
|
onChange: t,
|
|
3980
|
-
disabled: n ||
|
|
3981
|
-
selectedRecords:
|
|
3982
|
-
referenceForm:
|
|
3983
|
-
referencePermissions:
|
|
3984
|
-
referenceTitle:
|
|
3985
|
-
referenceDefaultValues:
|
|
3986
|
-
referenceModalWidth:
|
|
3987
|
-
referenceActions:
|
|
3988
|
-
popupMatchSelectWidth:
|
|
3989
|
-
popupMinWidth:
|
|
4026
|
+
disabled: n || p,
|
|
4027
|
+
selectedRecords: h ? T : void 0,
|
|
4028
|
+
referenceForm: _,
|
|
4029
|
+
referencePermissions: v,
|
|
4030
|
+
referenceTitle: y,
|
|
4031
|
+
referenceDefaultValues: b,
|
|
4032
|
+
referenceModalWidth: x,
|
|
4033
|
+
referenceActions: S,
|
|
4034
|
+
popupMatchSelectWidth: C,
|
|
4035
|
+
popupMinWidth: w
|
|
3990
4036
|
})
|
|
3991
4037
|
});
|
|
3992
4038
|
}
|
|
3993
4039
|
//#endregion
|
|
3994
4040
|
//#region src/crud/fields/uploadFieldUtils.ts
|
|
3995
|
-
function
|
|
4041
|
+
function ma(e) {
|
|
3996
4042
|
return e instanceof File ? !0 : typeof e == "string" && e.length > 0;
|
|
3997
4043
|
}
|
|
3998
|
-
function
|
|
4044
|
+
function ha(e) {
|
|
3999
4045
|
if (e instanceof File) return e.name;
|
|
4000
4046
|
if (typeof e == "string" && e.length > 0) try {
|
|
4001
4047
|
return new URL(e, "http://local").pathname.split("/").filter(Boolean).pop() || e;
|
|
@@ -4005,7 +4051,7 @@ function ua(e) {
|
|
|
4005
4051
|
}
|
|
4006
4052
|
//#endregion
|
|
4007
4053
|
//#region src/crud/fields/useUploadPreviewUrl.ts
|
|
4008
|
-
function
|
|
4054
|
+
function ga(e) {
|
|
4009
4055
|
let [t, n] = d();
|
|
4010
4056
|
if (s(() => {
|
|
4011
4057
|
if (e instanceof File) {
|
|
@@ -4018,8 +4064,8 @@ function da(e) {
|
|
|
4018
4064
|
}
|
|
4019
4065
|
//#endregion
|
|
4020
4066
|
//#region src/crud/fields/ImageField.tsx
|
|
4021
|
-
function
|
|
4022
|
-
let o = u(null), s =
|
|
4067
|
+
function _a({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "image/*", previewWidth: a = 200 }) {
|
|
4068
|
+
let o = u(null), s = ga(e), c = r && ma(e);
|
|
4023
4069
|
return /* @__PURE__ */ Y(V, {
|
|
4024
4070
|
direction: "vertical",
|
|
4025
4071
|
size: "middle",
|
|
@@ -4066,7 +4112,7 @@ function fa({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
4066
4112
|
]
|
|
4067
4113
|
});
|
|
4068
4114
|
}
|
|
4069
|
-
function
|
|
4115
|
+
function va({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, clearable: s, accept: c, previewWidth: l }) {
|
|
4070
4116
|
return /* @__PURE__ */ J($, {
|
|
4071
4117
|
source: e,
|
|
4072
4118
|
name: t,
|
|
@@ -4074,20 +4120,21 @@ function pa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4074
4120
|
required: r,
|
|
4075
4121
|
rules: i,
|
|
4076
4122
|
hideLabel: a,
|
|
4077
|
-
|
|
4123
|
+
hidden: o,
|
|
4124
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(_a, {
|
|
4078
4125
|
value: e,
|
|
4079
4126
|
onChange: t,
|
|
4080
4127
|
disabled: n,
|
|
4081
|
-
clearable:
|
|
4082
|
-
accept:
|
|
4083
|
-
previewWidth:
|
|
4128
|
+
clearable: s,
|
|
4129
|
+
accept: c,
|
|
4130
|
+
previewWidth: l
|
|
4084
4131
|
})
|
|
4085
4132
|
});
|
|
4086
4133
|
}
|
|
4087
4134
|
//#endregion
|
|
4088
4135
|
//#region src/crud/fields/FileField.tsx
|
|
4089
|
-
function
|
|
4090
|
-
let a = u(null), o =
|
|
4136
|
+
function ya({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
4137
|
+
let a = u(null), o = ha(e), s = typeof e == "string" && e.length > 0 ? e : void 0, c = r && ma(e);
|
|
4091
4138
|
return /* @__PURE__ */ Y(V, {
|
|
4092
4139
|
direction: "vertical",
|
|
4093
4140
|
size: "middle",
|
|
@@ -4131,7 +4178,7 @@ function ma({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
4131
4178
|
]
|
|
4132
4179
|
});
|
|
4133
4180
|
}
|
|
4134
|
-
function
|
|
4181
|
+
function ba({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, clearable: s, accept: c }) {
|
|
4135
4182
|
return /* @__PURE__ */ J($, {
|
|
4136
4183
|
source: e,
|
|
4137
4184
|
name: t,
|
|
@@ -4139,18 +4186,24 @@ function ha({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4139
4186
|
required: r,
|
|
4140
4187
|
rules: i,
|
|
4141
4188
|
hideLabel: a,
|
|
4142
|
-
|
|
4189
|
+
hidden: o,
|
|
4190
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(ya, {
|
|
4143
4191
|
value: e,
|
|
4144
4192
|
onChange: t,
|
|
4145
4193
|
disabled: n,
|
|
4146
|
-
clearable:
|
|
4147
|
-
accept:
|
|
4194
|
+
clearable: s,
|
|
4195
|
+
accept: c
|
|
4148
4196
|
})
|
|
4149
4197
|
});
|
|
4150
4198
|
}
|
|
4151
4199
|
//#endregion
|
|
4200
|
+
//#region src/crud/utils/columnDataIndex.ts
|
|
4201
|
+
function xa(e) {
|
|
4202
|
+
return e.includes(".") ? e.split(".") : e;
|
|
4203
|
+
}
|
|
4204
|
+
//#endregion
|
|
4152
4205
|
//#region src/crud/columns/TextColumn.tsx
|
|
4153
|
-
function
|
|
4206
|
+
function Sa({ source: e, label: t, sortable: n = !0 }) {
|
|
4154
4207
|
return Jn(l(() => ({
|
|
4155
4208
|
key: e,
|
|
4156
4209
|
source: e,
|
|
@@ -4158,7 +4211,7 @@ function ga({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4158
4211
|
sortable: n,
|
|
4159
4212
|
buildColumn: () => ({
|
|
4160
4213
|
title: t ?? e,
|
|
4161
|
-
dataIndex: e,
|
|
4214
|
+
dataIndex: xa(e),
|
|
4162
4215
|
key: e,
|
|
4163
4216
|
sorter: n ? !0 : void 0
|
|
4164
4217
|
})
|
|
@@ -4168,12 +4221,12 @@ function ga({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4168
4221
|
n
|
|
4169
4222
|
])), null;
|
|
4170
4223
|
}
|
|
4171
|
-
function
|
|
4172
|
-
return typeof n == "function" ? n(e) : n ? br(e, n) : e
|
|
4224
|
+
function Ca(e, t, n) {
|
|
4225
|
+
return typeof n == "function" ? n(e) : n ? br(e, n) : br(e, t);
|
|
4173
4226
|
}
|
|
4174
4227
|
//#endregion
|
|
4175
4228
|
//#region src/crud/columns/NumberColumn.tsx
|
|
4176
|
-
function
|
|
4229
|
+
function wa({ source: e, label: t, sortable: n = !0 }) {
|
|
4177
4230
|
return Jn(l(() => ({
|
|
4178
4231
|
key: e,
|
|
4179
4232
|
source: e,
|
|
@@ -4181,7 +4234,7 @@ function va({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4181
4234
|
sortable: n,
|
|
4182
4235
|
buildColumn: () => ({
|
|
4183
4236
|
title: t ?? e,
|
|
4184
|
-
dataIndex: e,
|
|
4237
|
+
dataIndex: xa(e),
|
|
4185
4238
|
key: e,
|
|
4186
4239
|
sorter: n ? !0 : void 0
|
|
4187
4240
|
})
|
|
@@ -4193,7 +4246,7 @@ function va({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4193
4246
|
}
|
|
4194
4247
|
//#endregion
|
|
4195
4248
|
//#region src/crud/columns/BooleanColumn.tsx
|
|
4196
|
-
function
|
|
4249
|
+
function Ta({ source: e, label: t, sortable: n = !0 }) {
|
|
4197
4250
|
return Jn(l(() => ({
|
|
4198
4251
|
key: e,
|
|
4199
4252
|
source: e,
|
|
@@ -4201,7 +4254,7 @@ function ya({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4201
4254
|
sortable: n,
|
|
4202
4255
|
buildColumn: () => ({
|
|
4203
4256
|
title: t ?? e,
|
|
4204
|
-
dataIndex: e,
|
|
4257
|
+
dataIndex: xa(e),
|
|
4205
4258
|
key: e,
|
|
4206
4259
|
sorter: n ? !0 : void 0,
|
|
4207
4260
|
render: (e) => e ? "Yes" : "No"
|
|
@@ -4214,7 +4267,7 @@ function ya({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4214
4267
|
}
|
|
4215
4268
|
//#endregion
|
|
4216
4269
|
//#region src/crud/columns/DateColumn.tsx
|
|
4217
|
-
function
|
|
4270
|
+
function Ea({ source: e, label: t, sortable: n = !0 }) {
|
|
4218
4271
|
return Jn(l(() => ({
|
|
4219
4272
|
key: e,
|
|
4220
4273
|
source: e,
|
|
@@ -4222,7 +4275,7 @@ function ba({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4222
4275
|
sortable: n,
|
|
4223
4276
|
buildColumn: () => ({
|
|
4224
4277
|
title: t ?? e,
|
|
4225
|
-
dataIndex: e,
|
|
4278
|
+
dataIndex: xa(e),
|
|
4226
4279
|
key: e,
|
|
4227
4280
|
sorter: n ? !0 : void 0,
|
|
4228
4281
|
render: (e) => e ? String(e).slice(0, 10) : "—"
|
|
@@ -4235,16 +4288,16 @@ function ba({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4235
4288
|
}
|
|
4236
4289
|
//#endregion
|
|
4237
4290
|
//#region src/crud/columns/ReferenceColumn.tsx
|
|
4238
|
-
function
|
|
4239
|
-
let { labelForValue: s } =
|
|
4291
|
+
function Da({ record: e, source: t, display: n, reference: r, choices: i, optionLabel: a, optionValue: o }) {
|
|
4292
|
+
let { labelForValue: s } = ca(i, r, a, o), c = br(e, t);
|
|
4240
4293
|
if (typeof n == "function") return /* @__PURE__ */ J(q, { children: n(e) });
|
|
4241
4294
|
if (n && n !== t) {
|
|
4242
|
-
let r =
|
|
4295
|
+
let r = Ca(e, t, n);
|
|
4243
4296
|
return /* @__PURE__ */ J(q, { children: r == null ? "—" : String(r) });
|
|
4244
4297
|
}
|
|
4245
4298
|
return /* @__PURE__ */ J(q, { children: s(c) });
|
|
4246
4299
|
}
|
|
4247
|
-
function
|
|
4300
|
+
function Oa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: s = !0 }) {
|
|
4248
4301
|
return Jn(l(() => ({
|
|
4249
4302
|
key: e,
|
|
4250
4303
|
source: e,
|
|
@@ -4255,7 +4308,7 @@ function Sa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4255
4308
|
dataIndex: e,
|
|
4256
4309
|
key: e,
|
|
4257
4310
|
sorter: s ? !0 : void 0,
|
|
4258
|
-
render: (s, c) => /* @__PURE__ */ J(
|
|
4311
|
+
render: (s, c) => /* @__PURE__ */ J(Da, {
|
|
4259
4312
|
record: c,
|
|
4260
4313
|
source: e,
|
|
4261
4314
|
label: t,
|
|
@@ -4279,11 +4332,11 @@ function Sa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4279
4332
|
}
|
|
4280
4333
|
//#endregion
|
|
4281
4334
|
//#region src/crud/columns/ReferenceManyColumn.tsx
|
|
4282
|
-
function
|
|
4283
|
-
let { labelsForValues: o } =
|
|
4335
|
+
function ka({ record: e, source: t, reference: n, choices: r, optionLabel: i, optionValue: a }) {
|
|
4336
|
+
let { labelsForValues: o } = ca(r, n, i, a), s = br(e, t);
|
|
4284
4337
|
return /* @__PURE__ */ J(q, { children: o(Array.isArray(s) ? s : []) });
|
|
4285
4338
|
}
|
|
4286
|
-
function
|
|
4339
|
+
function Aa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
|
|
4287
4340
|
return Jn(l(() => ({
|
|
4288
4341
|
key: e,
|
|
4289
4342
|
source: e,
|
|
@@ -4294,7 +4347,7 @@ function wa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4294
4347
|
dataIndex: e,
|
|
4295
4348
|
key: e,
|
|
4296
4349
|
sorter: o ? !0 : void 0,
|
|
4297
|
-
render: (t, o) => /* @__PURE__ */ J(
|
|
4350
|
+
render: (t, o) => /* @__PURE__ */ J(ka, {
|
|
4298
4351
|
record: o,
|
|
4299
4352
|
source: e,
|
|
4300
4353
|
reference: n,
|
|
@@ -4315,7 +4368,7 @@ function wa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4315
4368
|
}
|
|
4316
4369
|
//#endregion
|
|
4317
4370
|
//#region src/crud/columns/ImageColumn.tsx
|
|
4318
|
-
function
|
|
4371
|
+
function ja({ source: e, label: t, sortable: n = !1, width: r = 40, height: i = 40, objectFit: a = "cover", borderRadius: o = 4, alt: s = "" }) {
|
|
4319
4372
|
return Jn(l(() => ({
|
|
4320
4373
|
key: e,
|
|
4321
4374
|
source: e,
|
|
@@ -4323,7 +4376,7 @@ function Ta({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4323
4376
|
sortable: n,
|
|
4324
4377
|
buildColumn: () => ({
|
|
4325
4378
|
title: t ?? e,
|
|
4326
|
-
dataIndex: e,
|
|
4379
|
+
dataIndex: xa(e),
|
|
4327
4380
|
key: e,
|
|
4328
4381
|
sorter: n ? !0 : void 0,
|
|
4329
4382
|
render: (e) => e == null || e === "" ? null : /* @__PURE__ */ J("img", {
|
|
@@ -4350,7 +4403,7 @@ function Ta({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4350
4403
|
}
|
|
4351
4404
|
//#endregion
|
|
4352
4405
|
//#region src/crud/columns/CustomColumn.tsx
|
|
4353
|
-
function
|
|
4406
|
+
function Ma({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
4354
4407
|
return Jn(l(() => ({
|
|
4355
4408
|
key: e,
|
|
4356
4409
|
source: e,
|
|
@@ -4370,7 +4423,7 @@ function Ea({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
|
4370
4423
|
}
|
|
4371
4424
|
//#endregion
|
|
4372
4425
|
//#region src/crud/filters/NumberFilter.tsx
|
|
4373
|
-
function
|
|
4426
|
+
function Na({ source: e, label: t }) {
|
|
4374
4427
|
return rr(l(() => ({
|
|
4375
4428
|
key: e,
|
|
4376
4429
|
source: e,
|
|
@@ -4385,7 +4438,7 @@ function Da({ source: e, label: t }) {
|
|
|
4385
4438
|
}
|
|
4386
4439
|
//#endregion
|
|
4387
4440
|
//#region src/crud/filters/BooleanFilter.tsx
|
|
4388
|
-
function
|
|
4441
|
+
function Pa({ source: e, label: t }) {
|
|
4389
4442
|
return rr(l(() => ({
|
|
4390
4443
|
key: e,
|
|
4391
4444
|
source: e,
|
|
@@ -4408,7 +4461,7 @@ function Oa({ source: e, label: t }) {
|
|
|
4408
4461
|
}
|
|
4409
4462
|
//#endregion
|
|
4410
4463
|
//#region src/crud/filters/DateFilter.tsx
|
|
4411
|
-
function
|
|
4464
|
+
function Fa({ source: e, label: t }) {
|
|
4412
4465
|
return rr(l(() => ({
|
|
4413
4466
|
key: e,
|
|
4414
4467
|
source: e,
|
|
@@ -4424,7 +4477,7 @@ function ka({ source: e, label: t }) {
|
|
|
4424
4477
|
}
|
|
4425
4478
|
//#endregion
|
|
4426
4479
|
//#region src/crud/filters/SelectFilter.tsx
|
|
4427
|
-
function
|
|
4480
|
+
function Ia({ source: e, label: t, choices: n, multiple: r }) {
|
|
4428
4481
|
return rr(l(() => ({
|
|
4429
4482
|
key: e,
|
|
4430
4483
|
source: e,
|
|
@@ -4447,22 +4500,22 @@ function Aa({ source: e, label: t, choices: n, multiple: r }) {
|
|
|
4447
4500
|
}
|
|
4448
4501
|
//#endregion
|
|
4449
4502
|
//#region src/crud/filters/ReferenceFilter.tsx
|
|
4450
|
-
function
|
|
4451
|
-
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b, selectedLoading: x } =
|
|
4503
|
+
function La({ 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 }) {
|
|
4504
|
+
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b, selectedLoading: x } = ca(r, n, i, a, s ? h : void 0, {
|
|
4452
4505
|
lazy: c,
|
|
4453
4506
|
active: _ || !!h,
|
|
4454
4507
|
selectedValues: p,
|
|
4455
4508
|
fetchSelected: l
|
|
4456
|
-
}), S =
|
|
4509
|
+
}), S = ta(b, x), C = p;
|
|
4457
4510
|
return /* @__PURE__ */ J(B, {
|
|
4458
|
-
|
|
4511
|
+
...$i({
|
|
4459
4512
|
popupMatchSelectWidth: u,
|
|
4460
4513
|
popupMinWidth: f
|
|
4461
4514
|
}),
|
|
4462
4515
|
allowClear: !0,
|
|
4463
4516
|
mode: o ? "multiple" : void 0,
|
|
4464
4517
|
placeholder: t ?? e,
|
|
4465
|
-
value:
|
|
4518
|
+
value: na(x, C, o ? [] : void 0),
|
|
4466
4519
|
onChange: m,
|
|
4467
4520
|
options: y.map((e) => ({
|
|
4468
4521
|
label: e.label,
|
|
@@ -4470,7 +4523,7 @@ function ja({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4470
4523
|
})),
|
|
4471
4524
|
loading: S.loading,
|
|
4472
4525
|
disabled: S.disabled,
|
|
4473
|
-
notFoundContent:
|
|
4526
|
+
notFoundContent: ea(S.loading),
|
|
4474
4527
|
showSearch: s,
|
|
4475
4528
|
filterOption: s ? !1 : void 0,
|
|
4476
4529
|
onSearch: s ? g : void 0,
|
|
@@ -4481,12 +4534,12 @@ function ja({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4481
4534
|
style: { minWidth: 180 }
|
|
4482
4535
|
});
|
|
4483
4536
|
}
|
|
4484
|
-
function
|
|
4537
|
+
function Ra({ 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 }) {
|
|
4485
4538
|
return rr(l(() => ({
|
|
4486
4539
|
key: e,
|
|
4487
4540
|
source: e,
|
|
4488
4541
|
label: t,
|
|
4489
|
-
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(
|
|
4542
|
+
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(La, {
|
|
4490
4543
|
source: e,
|
|
4491
4544
|
label: t,
|
|
4492
4545
|
reference: n,
|
|
@@ -4517,11 +4570,11 @@ function Ma({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4517
4570
|
f
|
|
4518
4571
|
])), null;
|
|
4519
4572
|
}
|
|
4520
|
-
function
|
|
4521
|
-
return /* @__PURE__ */ J(
|
|
4573
|
+
function za(e) {
|
|
4574
|
+
return /* @__PURE__ */ J(Ra, {
|
|
4522
4575
|
...e,
|
|
4523
4576
|
multiple: !0
|
|
4524
4577
|
});
|
|
4525
4578
|
}
|
|
4526
4579
|
//#endregion
|
|
4527
|
-
export { Kt as AdminApp, Pt as AdminLayout, Bn as AppHub, Vn as AppLauncherButton, Xe as AppThemeProvider, In as AuthAlternateLink, Ln as AuthPageLayout, ct as AuthProvider,
|
|
4580
|
+
export { Kt as AdminApp, Pt as AdminLayout, Bn as AppHub, Vn as AppLauncherButton, Xe as AppThemeProvider, In as AuthAlternateLink, Ln as AuthPageLayout, ct as AuthProvider, Ta as BooleanColumn, ki as BooleanField, Pa as BooleanFilter, Ma as CustomColumn, Xn as DEFAULT_TEXT_FILTER_DEBOUNCE_MS, Jt as DataProvider, Ea as DateColumn, Fi as DateField, Fa as DateFilter, Ii as DateTimeField, $e as DensitySwitch, en as EXPECTED_VALIDATION_BODY_HINT, $ as FieldWrapper, ba as FileField, ai as FilterBar, Si as FormStep, wi as FormSteps, yi as FormTab, xi as FormTabs, Ft as Guard, Lt as GuestOnly, ui as HiddenSources, ja as ImageColumn, va as ImageField, mi as InlineFormSet, hi as InlineFormSetStacked, Rn as LoginPage, wa as NumberColumn, Oi as NumberField, Na as NumberFilter, Hi as PasswordField, pt as PermissionsProvider, zn as PlaceholderPage, It as Protected, Oa as ReferenceColumn, da as ReferenceField, Ra as ReferenceFilter, Aa as ReferenceManyColumn, pa as ReferenceManyField, za as ReferenceManyFilter, Rt as RequirePermission, oi as ResourceForm, Wr as ResourceFormModal, ri as ResourceList, Bi as SelectField, Ia as SelectFilter, Di as TextAreaField, Sa as TextColumn, Ei as TextField, $n as TextFilter, tt as ThemeSwitch, nt as ThemeToolbar, zi as TimeField, kn as applyInMemoryListParams, Q as asStringMessages, Sr as buildFormPayload, Cr as buildInlineRowsPayload, Mr as buildResourceFormSubmitBody, xa as columnDataIndex, Qt as combineResourceHandlers, Gt as createAdminRouter, An as createMemoryResourceHandlers, ht as createPermissionsChecker, jn as createRestResourceHandlers, dt as createSessionStorageAuthAdapter, Ut as deriveAuthPaths, sn as describeNonStandardValidationBody, bt as filterFlatNavItems, wt as filterNavByPermission, vt as filterNavItems, Dn as filterRows, hn as finalizeFormErrors, yt as flattenNavLeaves, mn as flattenNestedArrayErrors, un as getErrorBody, br as getFormValue, _t as getNavItemLabel, zt as getRouteAccess, wn as getRowById, wr as hasUploadValues, $t as isAbortError, di as nestedFieldPath, vn as parseDjangoDRFFormErrors, yn as parseDotNetFormErrors, bn as parseNodeFormErrors, Bt as partitionAdminRoutes, jr as prepareFormSubmitBody, fn as resolveErrorBody, xr as setFormValue, Nn as toDjangoRestOrdering, Ar as toFormData, Fn as toJsonApiSort, Pn as toODataOrderBy, Br as useAbortableEffect, lt as useAuth, gt as useCan, ca as useChoices, Yt as useDataProvider, Zr as useListQueryState, mt as usePermissions, pr as useRegisterPayloadField, mr as useRegisterSectionField, $r as useResourceListContext, Ze as useThemeMode };
|