ding-react-admin 2.4.0 → 2.5.1
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 +278 -232
- 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/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/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 +8 -4
- package/src/crud/fields/ReferenceManyField.tsx +5 -3
- package/src/crud/fields/SelectField.tsx +5 -3
- 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;
|
|
@@ -2839,18 +2839,34 @@ function oi({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2839
2839
|
});
|
|
2840
2840
|
}
|
|
2841
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
|
|
2842
2858
|
//#region src/crud/utils/nestedFieldPath.ts
|
|
2843
|
-
function
|
|
2859
|
+
function di(e, t, n) {
|
|
2844
2860
|
return `${e}.${t}.${n}`;
|
|
2845
2861
|
}
|
|
2846
2862
|
//#endregion
|
|
2847
2863
|
//#region src/crud/InlineFormSet.tsx
|
|
2848
|
-
function
|
|
2864
|
+
function fi(e, t) {
|
|
2849
2865
|
let n = {};
|
|
2850
|
-
for (let r of e) n
|
|
2866
|
+
for (let r of e) xr(n, r, t ? br(t, r) : void 0);
|
|
2851
2867
|
return n;
|
|
2852
2868
|
}
|
|
2853
|
-
function
|
|
2869
|
+
function pi(e, t, n) {
|
|
2854
2870
|
let { control: r } = je(), { fields: i, append: a, remove: o } = ke({
|
|
2855
2871
|
control: r,
|
|
2856
2872
|
name: e,
|
|
@@ -2859,11 +2875,11 @@ function li(e, t, n) {
|
|
|
2859
2875
|
return {
|
|
2860
2876
|
fields: i,
|
|
2861
2877
|
remove: o,
|
|
2862
|
-
appendEmpty: () => a(
|
|
2878
|
+
appendEmpty: () => a(fi(t, n))
|
|
2863
2879
|
};
|
|
2864
2880
|
}
|
|
2865
|
-
function
|
|
2866
|
-
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);
|
|
2867
2883
|
pr(e), vr(e, o, n, r);
|
|
2868
2884
|
let d = l(() => i.map((t) => ({
|
|
2869
2885
|
title: t.label ?? t.source,
|
|
@@ -2872,7 +2888,7 @@ function ui({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2872
2888
|
onHeaderCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2873
2889
|
onCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2874
2890
|
render: (n, r, i) => t.cell({
|
|
2875
|
-
name:
|
|
2891
|
+
name: di(e, i, t.source),
|
|
2876
2892
|
index: i,
|
|
2877
2893
|
field: e
|
|
2878
2894
|
})
|
|
@@ -2914,8 +2930,8 @@ function ui({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2914
2930
|
]
|
|
2915
2931
|
});
|
|
2916
2932
|
}
|
|
2917
|
-
function
|
|
2918
|
-
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);
|
|
2919
2935
|
return pr(e), vr(e, i, n, r), /* @__PURE__ */ Y("div", {
|
|
2920
2936
|
style: { marginTop: 24 },
|
|
2921
2937
|
children: [
|
|
@@ -2931,7 +2947,7 @@ function di({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2931
2947
|
let r = {
|
|
2932
2948
|
field: e,
|
|
2933
2949
|
index: n,
|
|
2934
|
-
name: (t) =>
|
|
2950
|
+
name: (t) => di(e, n, t)
|
|
2935
2951
|
};
|
|
2936
2952
|
return /* @__PURE__ */ J(T, {
|
|
2937
2953
|
size: "small",
|
|
@@ -2959,22 +2975,22 @@ function di({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2959
2975
|
}
|
|
2960
2976
|
//#endregion
|
|
2961
2977
|
//#region src/crud/utils/formSectionErrors.ts
|
|
2962
|
-
function
|
|
2978
|
+
function gi(e, t, n) {
|
|
2963
2979
|
for (let r of e) if (t(r, n).invalid) return !0;
|
|
2964
2980
|
return !1;
|
|
2965
2981
|
}
|
|
2966
|
-
function
|
|
2982
|
+
function _i(e) {
|
|
2967
2983
|
let t = u([]);
|
|
2968
2984
|
for (; t.current.length < e;) t.current.push({ current: /* @__PURE__ */ new Set() });
|
|
2969
2985
|
return t.current.length > e && (t.current.length = e), t.current;
|
|
2970
2986
|
}
|
|
2971
|
-
function
|
|
2987
|
+
function vi(e, t) {
|
|
2972
2988
|
let { control: n, getFieldState: r, setFocus: i } = je(), a = Me({ control: n }), o = u(0), c = u(0);
|
|
2973
2989
|
s(() => {
|
|
2974
2990
|
if (a.submitCount === 0) return;
|
|
2975
2991
|
let n = Object.keys(a.errors).length, s = a.submitCount !== o.current, l = !s && n > 0 && c.current === 0;
|
|
2976
2992
|
if (o.current = a.submitCount, c.current = n, !s && !l || n === 0) return;
|
|
2977
|
-
let u = e.findIndex((e) =>
|
|
2993
|
+
let u = e.findIndex((e) => gi(e.current, r, a));
|
|
2978
2994
|
if (u < 0) return;
|
|
2979
2995
|
t(u);
|
|
2980
2996
|
let d = [...e[u].current].find((e) => r(e, a).invalid);
|
|
@@ -2993,22 +3009,22 @@ function mi(e, t) {
|
|
|
2993
3009
|
}
|
|
2994
3010
|
//#endregion
|
|
2995
3011
|
//#region src/crud/FormTabs.tsx
|
|
2996
|
-
function
|
|
3012
|
+
function yi(e) {
|
|
2997
3013
|
return null;
|
|
2998
3014
|
}
|
|
2999
|
-
function
|
|
3000
|
-
return i(e) && e.type ===
|
|
3015
|
+
function bi(e) {
|
|
3016
|
+
return i(e) && e.type === yi;
|
|
3001
3017
|
}
|
|
3002
|
-
function
|
|
3003
|
-
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) => ({
|
|
3004
3020
|
key: e.key ?? String(t),
|
|
3005
3021
|
label: e.props.label,
|
|
3006
3022
|
disabled: e.props.disabled,
|
|
3007
3023
|
children: e.props.children
|
|
3008
|
-
})), [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) => {
|
|
3009
3025
|
f || m(e), i?.(e);
|
|
3010
3026
|
}, [f, i]);
|
|
3011
|
-
|
|
3027
|
+
vi(u, a((e) => {
|
|
3012
3028
|
let t = c[e]?.key;
|
|
3013
3029
|
t != null && g(t);
|
|
3014
3030
|
}, [g, c]));
|
|
@@ -3016,7 +3032,7 @@ function _i({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
3016
3032
|
return /* @__PURE__ */ J(U, {
|
|
3017
3033
|
destroyOnHidden: !1,
|
|
3018
3034
|
items: l(() => c.map((e, t) => {
|
|
3019
|
-
let n =
|
|
3035
|
+
let n = gi(u[t].current, v, y);
|
|
3020
3036
|
return {
|
|
3021
3037
|
key: e.key,
|
|
3022
3038
|
label: n ? /* @__PURE__ */ J("span", {
|
|
@@ -3043,17 +3059,17 @@ function _i({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
3043
3059
|
}
|
|
3044
3060
|
//#endregion
|
|
3045
3061
|
//#region src/crud/FormSteps.tsx
|
|
3046
|
-
function
|
|
3062
|
+
function Si(e) {
|
|
3047
3063
|
return null;
|
|
3048
3064
|
}
|
|
3049
|
-
function
|
|
3050
|
-
return i(e) && e.type ===
|
|
3065
|
+
function Ci(e) {
|
|
3066
|
+
return i(e) && e.type === Si;
|
|
3051
3067
|
}
|
|
3052
|
-
function
|
|
3053
|
-
let m = l(() => e.toArray(t).filter(
|
|
3054
|
-
|
|
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, _);
|
|
3055
3071
|
let { control: y, getFieldState: b } = je(), x = Me({ control: y }), S = l(() => m.map((e, t) => {
|
|
3056
|
-
let n =
|
|
3072
|
+
let n = gi(h[t].current, b, x);
|
|
3057
3073
|
return {
|
|
3058
3074
|
title: e.props.title,
|
|
3059
3075
|
description: e.props.description,
|
|
@@ -3107,35 +3123,44 @@ function bi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
3107
3123
|
] });
|
|
3108
3124
|
}
|
|
3109
3125
|
//#endregion
|
|
3126
|
+
//#region src/crud/utils/shouldRegisterSourceInPayload.ts
|
|
3127
|
+
function Ti(e, t) {
|
|
3128
|
+
return t == null || t === e;
|
|
3129
|
+
}
|
|
3130
|
+
//#endregion
|
|
3110
3131
|
//#region src/crud/fields/FieldWrapper.tsx
|
|
3111
|
-
function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
3112
|
-
let
|
|
3113
|
-
return pr(e,
|
|
3114
|
-
name:
|
|
3115
|
-
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,
|
|
3116
3141
|
rules: {
|
|
3117
|
-
required: r ? `${
|
|
3142
|
+
required: r ? `${m} is required` : !1,
|
|
3118
3143
|
...i
|
|
3119
3144
|
},
|
|
3120
3145
|
render: ({ field: e, fieldState: t }) => /* @__PURE__ */ J(M.Item, {
|
|
3121
|
-
label:
|
|
3146
|
+
label: p,
|
|
3122
3147
|
validateStatus: t.error ? "error" : void 0,
|
|
3123
3148
|
help: t.error?.message,
|
|
3124
3149
|
required: r && !a,
|
|
3125
3150
|
style: a ? { marginBottom: 0 } : void 0,
|
|
3126
|
-
children:
|
|
3151
|
+
children: s({
|
|
3127
3152
|
value: e.value,
|
|
3128
3153
|
onChange: e.onChange,
|
|
3129
3154
|
onBlur: e.onBlur,
|
|
3130
|
-
disabled:
|
|
3131
|
-
name:
|
|
3155
|
+
disabled: f?.disabled,
|
|
3156
|
+
name: c
|
|
3132
3157
|
})
|
|
3133
3158
|
})
|
|
3134
3159
|
});
|
|
3135
3160
|
}
|
|
3136
3161
|
//#endregion
|
|
3137
3162
|
//#region src/crud/fields/TextField.tsx
|
|
3138
|
-
function
|
|
3163
|
+
function Ei({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s, hidden: c }) {
|
|
3139
3164
|
return /* @__PURE__ */ J($, {
|
|
3140
3165
|
source: e,
|
|
3141
3166
|
name: t,
|
|
@@ -3143,6 +3168,7 @@ function xi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3143
3168
|
required: r,
|
|
3144
3169
|
rules: i,
|
|
3145
3170
|
hideLabel: s,
|
|
3171
|
+
hidden: c,
|
|
3146
3172
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(F, {
|
|
3147
3173
|
value: e,
|
|
3148
3174
|
onChange: (e) => t(e.target.value),
|
|
@@ -3155,7 +3181,7 @@ function xi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3155
3181
|
}
|
|
3156
3182
|
//#endregion
|
|
3157
3183
|
//#region src/crud/fields/TextAreaField.tsx
|
|
3158
|
-
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 }) {
|
|
3159
3185
|
return /* @__PURE__ */ J($, {
|
|
3160
3186
|
source: e,
|
|
3161
3187
|
name: t,
|
|
@@ -3163,6 +3189,7 @@ function Si({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3163
3189
|
required: r,
|
|
3164
3190
|
rules: i,
|
|
3165
3191
|
hideLabel: s,
|
|
3192
|
+
hidden: c,
|
|
3166
3193
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(F.TextArea, {
|
|
3167
3194
|
value: e,
|
|
3168
3195
|
onChange: (e) => t(e.target.value),
|
|
@@ -3170,16 +3197,16 @@ function Si({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3170
3197
|
placeholder: a,
|
|
3171
3198
|
disabled: r,
|
|
3172
3199
|
style: o,
|
|
3173
|
-
rows:
|
|
3174
|
-
maxLength:
|
|
3175
|
-
showCount:
|
|
3176
|
-
autoSize:
|
|
3200
|
+
rows: f ? void 0 : l,
|
|
3201
|
+
maxLength: u,
|
|
3202
|
+
showCount: d,
|
|
3203
|
+
autoSize: f
|
|
3177
3204
|
})
|
|
3178
3205
|
});
|
|
3179
3206
|
}
|
|
3180
3207
|
//#endregion
|
|
3181
3208
|
//#region src/crud/fields/NumberField.tsx
|
|
3182
|
-
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 }) {
|
|
3183
3210
|
return /* @__PURE__ */ J($, {
|
|
3184
3211
|
source: e,
|
|
3185
3212
|
name: t,
|
|
@@ -3187,6 +3214,7 @@ function Ci({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3187
3214
|
required: r,
|
|
3188
3215
|
rules: i,
|
|
3189
3216
|
hideLabel: l,
|
|
3217
|
+
hidden: u,
|
|
3190
3218
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(I, {
|
|
3191
3219
|
value: e,
|
|
3192
3220
|
onChange: (e) => t(e),
|
|
@@ -3204,7 +3232,7 @@ function Ci({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3204
3232
|
}
|
|
3205
3233
|
//#endregion
|
|
3206
3234
|
//#region src/crud/fields/BooleanField.tsx
|
|
3207
|
-
function
|
|
3235
|
+
function ki({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, disabled: s }) {
|
|
3208
3236
|
return /* @__PURE__ */ J($, {
|
|
3209
3237
|
source: e,
|
|
3210
3238
|
name: t,
|
|
@@ -3212,16 +3240,17 @@ function wi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3212
3240
|
required: r,
|
|
3213
3241
|
rules: i,
|
|
3214
3242
|
hideLabel: a,
|
|
3243
|
+
hidden: o,
|
|
3215
3244
|
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(oe, {
|
|
3216
3245
|
checked: !!e,
|
|
3217
3246
|
onChange: t,
|
|
3218
|
-
disabled: n ||
|
|
3247
|
+
disabled: n || s
|
|
3219
3248
|
})
|
|
3220
3249
|
});
|
|
3221
3250
|
}
|
|
3222
3251
|
//#endregion
|
|
3223
3252
|
//#region src/crud/utils/parseDayjsValue.ts
|
|
3224
|
-
var
|
|
3253
|
+
var Ai = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
3225
3254
|
(function(n, r) {
|
|
3226
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();
|
|
3227
3256
|
})(e, (function() {
|
|
@@ -3378,8 +3407,8 @@ var Ti = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
|
3378
3407
|
};
|
|
3379
3408
|
}));
|
|
3380
3409
|
})))(), 1);
|
|
3381
|
-
Pe.extend(
|
|
3382
|
-
function
|
|
3410
|
+
Pe.extend(Ai.default);
|
|
3411
|
+
function ji(e, t) {
|
|
3383
3412
|
if (e == null || e === "") return null;
|
|
3384
3413
|
if (Pe.isDayjs(e)) return e;
|
|
3385
3414
|
let n = Pe(String(e), t, !0);
|
|
@@ -3387,13 +3416,13 @@ function Ei(e, t) {
|
|
|
3387
3416
|
}
|
|
3388
3417
|
//#endregion
|
|
3389
3418
|
//#region src/crud/fields/DateField.tsx
|
|
3390
|
-
var
|
|
3391
|
-
|
|
3392
|
-
|
|
3419
|
+
var Mi = "YYYY-MM-DD", Ni = `${Mi} HH:mm:ss`, Pi = [
|
|
3420
|
+
Mi,
|
|
3421
|
+
Ni,
|
|
3393
3422
|
"YYYY-MM-DDTHH:mm:ss",
|
|
3394
3423
|
"YYYY-MM-DDTHH:mm:ssZ"
|
|
3395
3424
|
];
|
|
3396
|
-
function
|
|
3425
|
+
function Fi({ source: e, name: t, label: n, required: r, rules: i, showTime: a, hideLabel: o, hidden: s }) {
|
|
3397
3426
|
return /* @__PURE__ */ J($, {
|
|
3398
3427
|
source: e,
|
|
3399
3428
|
name: t,
|
|
@@ -3401,34 +3430,35 @@ function Ai({ source: e, name: t, label: n, required: r, rules: i, showTime: a,
|
|
|
3401
3430
|
required: r,
|
|
3402
3431
|
rules: i,
|
|
3403
3432
|
hideLabel: o,
|
|
3433
|
+
hidden: s,
|
|
3404
3434
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(O, {
|
|
3405
|
-
value:
|
|
3406
|
-
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),
|
|
3407
3437
|
onBlur: n,
|
|
3408
3438
|
showTime: a,
|
|
3409
3439
|
disabled: r,
|
|
3410
|
-
format: a ?
|
|
3440
|
+
format: a ? Ni : Mi,
|
|
3411
3441
|
style: { width: "100%" }
|
|
3412
3442
|
})
|
|
3413
3443
|
});
|
|
3414
3444
|
}
|
|
3415
3445
|
//#endregion
|
|
3416
3446
|
//#region src/crud/fields/DateTimeField.tsx
|
|
3417
|
-
function
|
|
3418
|
-
return /* @__PURE__ */ J(
|
|
3447
|
+
function Ii(e) {
|
|
3448
|
+
return /* @__PURE__ */ J(Fi, {
|
|
3419
3449
|
showTime: !0,
|
|
3420
3450
|
...e
|
|
3421
3451
|
});
|
|
3422
3452
|
}
|
|
3423
3453
|
//#endregion
|
|
3424
3454
|
//#region src/crud/fields/TimeField.tsx
|
|
3425
|
-
var
|
|
3426
|
-
|
|
3455
|
+
var Li = "HH:mm:ss", Ri = [
|
|
3456
|
+
Li,
|
|
3427
3457
|
"HH:mm",
|
|
3428
3458
|
"H:mm:ss",
|
|
3429
3459
|
"H:mm"
|
|
3430
3460
|
];
|
|
3431
|
-
function
|
|
3461
|
+
function zi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, format: s = Li }) {
|
|
3432
3462
|
return /* @__PURE__ */ J($, {
|
|
3433
3463
|
source: e,
|
|
3434
3464
|
name: t,
|
|
@@ -3436,19 +3466,20 @@ function Pi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3436
3466
|
required: r,
|
|
3437
3467
|
rules: i,
|
|
3438
3468
|
hideLabel: a,
|
|
3469
|
+
hidden: o,
|
|
3439
3470
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(ce, {
|
|
3440
|
-
value:
|
|
3441
|
-
onChange: (e) => t(e ? e.format(
|
|
3471
|
+
value: ji(e, Ri),
|
|
3472
|
+
onChange: (e) => t(e ? e.format(s) : null),
|
|
3442
3473
|
onBlur: n,
|
|
3443
3474
|
disabled: r,
|
|
3444
|
-
format:
|
|
3475
|
+
format: s,
|
|
3445
3476
|
style: { width: "100%" }
|
|
3446
3477
|
})
|
|
3447
3478
|
});
|
|
3448
3479
|
}
|
|
3449
3480
|
//#endregion
|
|
3450
3481
|
//#region src/crud/fields/SelectField.tsx
|
|
3451
|
-
function
|
|
3482
|
+
function Bi({ source: e, name: t, label: n, required: r, rules: i, choices: a, mode: o, allowClear: s, hideLabel: c, hidden: l }) {
|
|
3452
3483
|
return /* @__PURE__ */ J($, {
|
|
3453
3484
|
source: e,
|
|
3454
3485
|
name: t,
|
|
@@ -3456,9 +3487,10 @@ function Fi({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3456
3487
|
required: r,
|
|
3457
3488
|
rules: i,
|
|
3458
3489
|
hideLabel: c,
|
|
3490
|
+
hidden: l,
|
|
3459
3491
|
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(B, {
|
|
3460
3492
|
value: e,
|
|
3461
|
-
onChange: t,
|
|
3493
|
+
onChange: (e) => t(e ?? null),
|
|
3462
3494
|
options: a,
|
|
3463
3495
|
mode: o,
|
|
3464
3496
|
allowClear: s,
|
|
@@ -3469,7 +3501,7 @@ function Fi({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3469
3501
|
}
|
|
3470
3502
|
//#endregion
|
|
3471
3503
|
//#region src/crud/fields/PasswordField.tsx
|
|
3472
|
-
function
|
|
3504
|
+
function Vi({ source: e, name: t, label: n, required: r, rules: i, autoComplete: a, hideLabel: o, hidden: s }) {
|
|
3473
3505
|
return /* @__PURE__ */ J($, {
|
|
3474
3506
|
source: e,
|
|
3475
3507
|
name: t,
|
|
@@ -3477,6 +3509,7 @@ function Ii({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3477
3509
|
required: r,
|
|
3478
3510
|
rules: i,
|
|
3479
3511
|
hideLabel: o,
|
|
3512
|
+
hidden: s,
|
|
3480
3513
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(F.Password, {
|
|
3481
3514
|
value: e,
|
|
3482
3515
|
onChange: (e) => t(e.target.value),
|
|
@@ -3486,86 +3519,89 @@ function Ii({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3486
3519
|
})
|
|
3487
3520
|
});
|
|
3488
3521
|
}
|
|
3489
|
-
function
|
|
3490
|
-
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({
|
|
3491
3524
|
name: t ?? e,
|
|
3492
3525
|
disabled: !a
|
|
3493
3526
|
});
|
|
3494
|
-
return a ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(
|
|
3527
|
+
return a ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(Vi, {
|
|
3495
3528
|
source: e,
|
|
3496
3529
|
name: t,
|
|
3497
3530
|
label: n,
|
|
3498
3531
|
required: r,
|
|
3499
3532
|
rules: i,
|
|
3500
3533
|
autoComplete: s,
|
|
3501
|
-
hideLabel: c
|
|
3502
|
-
|
|
3534
|
+
hideLabel: c,
|
|
3535
|
+
hidden: l
|
|
3536
|
+
}), /* @__PURE__ */ J(Vi, {
|
|
3503
3537
|
source: a,
|
|
3504
3538
|
label: o,
|
|
3505
3539
|
required: r,
|
|
3506
3540
|
autoComplete: s,
|
|
3507
3541
|
hideLabel: c,
|
|
3508
|
-
rules: { validate: (e) => !
|
|
3509
|
-
|
|
3542
|
+
rules: { validate: (e) => !u || e === u || "Passwords do not match" },
|
|
3543
|
+
hidden: l
|
|
3544
|
+
})] }) : /* @__PURE__ */ J(Vi, {
|
|
3510
3545
|
source: e,
|
|
3511
3546
|
name: t,
|
|
3512
3547
|
label: n,
|
|
3513
3548
|
required: r,
|
|
3514
3549
|
rules: i,
|
|
3515
3550
|
autoComplete: s,
|
|
3516
|
-
hideLabel: c
|
|
3551
|
+
hideLabel: c,
|
|
3552
|
+
hidden: l
|
|
3517
3553
|
});
|
|
3518
3554
|
}
|
|
3519
3555
|
//#endregion
|
|
3520
3556
|
//#region src/crud/utils/choiceSelectionUtils.ts
|
|
3521
|
-
function
|
|
3557
|
+
function Ui(e, t) {
|
|
3522
3558
|
return typeof e == "object" && !!e && !Array.isArray(e) && t in e;
|
|
3523
3559
|
}
|
|
3524
|
-
function
|
|
3560
|
+
function Wi(e, t) {
|
|
3525
3561
|
if (!(e == null || e === "")) {
|
|
3526
|
-
if (
|
|
3562
|
+
if (Ui(e, t)) {
|
|
3527
3563
|
let n = e[t];
|
|
3528
3564
|
return typeof n == "string" || typeof n == "number" ? n : void 0;
|
|
3529
3565
|
}
|
|
3530
3566
|
if (typeof e == "string" || typeof e == "number") return e;
|
|
3531
3567
|
}
|
|
3532
3568
|
}
|
|
3533
|
-
function
|
|
3534
|
-
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) : [];
|
|
3535
3571
|
}
|
|
3536
|
-
function
|
|
3537
|
-
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);
|
|
3538
3574
|
}
|
|
3539
|
-
function
|
|
3575
|
+
function qi(e, t, n) {
|
|
3540
3576
|
let r = [];
|
|
3541
|
-
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;
|
|
3542
3578
|
let i = Array.isArray(e) ? e : [e];
|
|
3543
|
-
for (let e of i)
|
|
3579
|
+
for (let e of i) Ui(e, n) && r.push(e);
|
|
3544
3580
|
return r;
|
|
3545
3581
|
}
|
|
3546
|
-
function
|
|
3582
|
+
function Ji(e, t) {
|
|
3547
3583
|
return typeof t == "function" ? t(e) : String(e[t] ?? "");
|
|
3548
3584
|
}
|
|
3549
|
-
function
|
|
3585
|
+
function Yi(e, t, n) {
|
|
3550
3586
|
return e.map((e) => ({
|
|
3551
|
-
label:
|
|
3587
|
+
label: Ji(e, t),
|
|
3552
3588
|
value: e[n],
|
|
3553
3589
|
record: e
|
|
3554
3590
|
}));
|
|
3555
3591
|
}
|
|
3556
|
-
function
|
|
3592
|
+
function Xi(e, t) {
|
|
3557
3593
|
let n = /* @__PURE__ */ new Map();
|
|
3558
3594
|
for (let t of e) n.set(t.value, t);
|
|
3559
3595
|
for (let e of t) n.set(e.value, e);
|
|
3560
3596
|
return Array.from(n.values());
|
|
3561
3597
|
}
|
|
3562
|
-
function
|
|
3598
|
+
function Zi(e, t) {
|
|
3563
3599
|
return e.filter((e) => !t.some((t) => t.value === e));
|
|
3564
3600
|
}
|
|
3565
|
-
function
|
|
3566
|
-
return
|
|
3601
|
+
function Qi(e, t, n = []) {
|
|
3602
|
+
return Xi(n, e.filter((e) => t.some((t) => e.value === t)));
|
|
3567
3603
|
}
|
|
3568
|
-
function
|
|
3604
|
+
function $i(e = {}) {
|
|
3569
3605
|
let t = e.popupMatchSelectWidth ?? !1;
|
|
3570
3606
|
return t === !1 ? {
|
|
3571
3607
|
popupMatchSelectWidth: !1,
|
|
@@ -3574,27 +3610,27 @@ function Ji(e = {}) {
|
|
|
3574
3610
|
}
|
|
3575
3611
|
//#endregion
|
|
3576
3612
|
//#region src/crud/utils/referenceSelectNotFoundContent.tsx
|
|
3577
|
-
function
|
|
3613
|
+
function ea(e) {
|
|
3578
3614
|
return e ? /* @__PURE__ */ J(ae, { size: "small" }) : void 0;
|
|
3579
3615
|
}
|
|
3580
3616
|
//#endregion
|
|
3581
3617
|
//#region src/crud/utils/referenceSelectSelectedProps.ts
|
|
3582
|
-
function
|
|
3618
|
+
function ta(e, t, n) {
|
|
3583
3619
|
return {
|
|
3584
3620
|
loading: e || t,
|
|
3585
3621
|
disabled: !!(n || t)
|
|
3586
3622
|
};
|
|
3587
3623
|
}
|
|
3588
|
-
function
|
|
3624
|
+
function na(e, t, n) {
|
|
3589
3625
|
return e ? n : t;
|
|
3590
3626
|
}
|
|
3591
3627
|
//#endregion
|
|
3592
3628
|
//#region src/crud/utils/useChoices.ts
|
|
3593
|
-
var
|
|
3594
|
-
function
|
|
3629
|
+
var ra = /* @__PURE__ */ new Map(), ia = /* @__PURE__ */ new Map();
|
|
3630
|
+
function aa(e, t) {
|
|
3595
3631
|
return typeof e == "function" ? `fn:${t ?? ""}` : Array.isArray(e) ? `static:${e.length}` : `res:${e.resource}:${JSON.stringify(e.filter ?? {})}:${t ?? ""}`;
|
|
3596
3632
|
}
|
|
3597
|
-
async function
|
|
3633
|
+
async function oa(e, t, n, r, i) {
|
|
3598
3634
|
return typeof e == "function" ? e({
|
|
3599
3635
|
dataProvider: t,
|
|
3600
3636
|
search: i
|
|
@@ -3608,25 +3644,25 @@ async function ta(e, t, n, r, i) {
|
|
|
3608
3644
|
perPage: 500
|
|
3609
3645
|
}
|
|
3610
3646
|
})).data.map((e) => ({
|
|
3611
|
-
label:
|
|
3647
|
+
label: Ji(e, n),
|
|
3612
3648
|
value: e[r],
|
|
3613
3649
|
record: e
|
|
3614
3650
|
}));
|
|
3615
3651
|
}
|
|
3616
|
-
function
|
|
3617
|
-
let o =
|
|
3652
|
+
function sa(e, t, n, r, i, a) {
|
|
3653
|
+
let o = aa(e, i);
|
|
3618
3654
|
if (a) {
|
|
3619
|
-
let e =
|
|
3655
|
+
let e = ra.get(o);
|
|
3620
3656
|
if (e && !i) return Promise.resolve(e);
|
|
3621
3657
|
}
|
|
3622
|
-
let s =
|
|
3658
|
+
let s = ia.get(o);
|
|
3623
3659
|
if (s) return s;
|
|
3624
|
-
let c =
|
|
3625
|
-
|
|
3660
|
+
let c = oa(e, t, n, r, i).then((e) => (a && !i && ra.set(o, e), e)).finally(() => {
|
|
3661
|
+
ia.delete(o);
|
|
3626
3662
|
});
|
|
3627
|
-
return
|
|
3663
|
+
return ia.set(o, c), c;
|
|
3628
3664
|
}
|
|
3629
|
-
function
|
|
3665
|
+
function ca(e, t, n = "name", r = "id", i, o = {}) {
|
|
3630
3666
|
let { lazy: c = !1, active: f = !1, selectedValues: p, selectedRecords: m, fetchSelected: h = !0, cache: g } = o, _ = g ?? !c, v = Yt(), y = l(() => {
|
|
3631
3667
|
if (e) return e;
|
|
3632
3668
|
if (t) return {
|
|
@@ -3637,16 +3673,16 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3637
3673
|
e,
|
|
3638
3674
|
t,
|
|
3639
3675
|
i
|
|
3640
|
-
]), 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), [
|
|
3641
3677
|
p,
|
|
3642
3678
|
m,
|
|
3643
3679
|
n,
|
|
3644
3680
|
r
|
|
3645
|
-
]), 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);
|
|
3646
3682
|
A.current = w;
|
|
3647
3683
|
let j = u(x);
|
|
3648
3684
|
j.current = x, s(() => {
|
|
3649
|
-
S.length && T((e) =>
|
|
3685
|
+
S.length && T((e) => Xi(e, S));
|
|
3650
3686
|
}, [S]);
|
|
3651
3687
|
let M = a(async () => {
|
|
3652
3688
|
if (!y || !C) {
|
|
@@ -3654,18 +3690,18 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3654
3690
|
return;
|
|
3655
3691
|
}
|
|
3656
3692
|
if (_) {
|
|
3657
|
-
let e =
|
|
3693
|
+
let e = aa(y, i), t = ra.get(e);
|
|
3658
3694
|
if (t && !i) {
|
|
3659
|
-
T((e) =>
|
|
3695
|
+
T((e) => Xi(Qi(e, j.current, S), t)), D(!1);
|
|
3660
3696
|
return;
|
|
3661
3697
|
}
|
|
3662
3698
|
}
|
|
3663
|
-
D(!0), c && T((e) =>
|
|
3699
|
+
D(!0), c && T((e) => Qi(e, j.current, S));
|
|
3664
3700
|
try {
|
|
3665
|
-
let e = await
|
|
3666
|
-
T((t) =>
|
|
3701
|
+
let e = await sa(y, v, n, r, i, _);
|
|
3702
|
+
T((t) => Xi(Qi(t, j.current, S), e));
|
|
3667
3703
|
} catch {
|
|
3668
|
-
!x.length && !S.length ? T([]) : c && T((e) =>
|
|
3704
|
+
!x.length && !S.length ? T([]) : c && T((e) => Qi(e, j.current, S));
|
|
3669
3705
|
} finally {
|
|
3670
3706
|
D(!1);
|
|
3671
3707
|
}
|
|
@@ -3684,7 +3720,7 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3684
3720
|
s(() => {
|
|
3685
3721
|
M();
|
|
3686
3722
|
}, [M]), s(() => {
|
|
3687
|
-
c && !f && !i && (T((e) =>
|
|
3723
|
+
c && !f && !i && (T((e) => Qi(e, x, S)), D(!1));
|
|
3688
3724
|
}, [
|
|
3689
3725
|
c,
|
|
3690
3726
|
f,
|
|
@@ -3696,7 +3732,7 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3696
3732
|
k(!1);
|
|
3697
3733
|
return;
|
|
3698
3734
|
}
|
|
3699
|
-
let e =
|
|
3735
|
+
let e = Zi(x, Xi(S, A.current));
|
|
3700
3736
|
if (!e.length) {
|
|
3701
3737
|
k(!1);
|
|
3702
3738
|
return;
|
|
@@ -3707,7 +3743,7 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3707
3743
|
for (let i of e) try {
|
|
3708
3744
|
let e = (await v.getOne(t, i)).data;
|
|
3709
3745
|
a.push({
|
|
3710
|
-
label:
|
|
3746
|
+
label: Ji(e, n),
|
|
3711
3747
|
value: e[r],
|
|
3712
3748
|
record: e
|
|
3713
3749
|
});
|
|
@@ -3719,7 +3755,7 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3719
3755
|
}
|
|
3720
3756
|
i || (a.length && T((e) => {
|
|
3721
3757
|
let t = a.filter((t) => !e.some((e) => e.value === t.value));
|
|
3722
|
-
return t.length ?
|
|
3758
|
+
return t.length ? Xi(e, t) : e;
|
|
3723
3759
|
}), k(!1));
|
|
3724
3760
|
})(), () => {
|
|
3725
3761
|
i = !0;
|
|
@@ -3746,7 +3782,7 @@ function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3746
3782
|
}
|
|
3747
3783
|
//#endregion
|
|
3748
3784
|
//#region src/crud/fields/ReferenceInputActions.tsx
|
|
3749
|
-
function
|
|
3785
|
+
function la({ reference: e, referenceForm: t, referencePermissions: n, referenceTitle: r, referenceDefaultValues: i, referenceModalWidth: a, selectedId: o, disabled: s, onCreated: c, onUpdated: l }) {
|
|
3750
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);
|
|
3751
3787
|
return !p && !m ? null : /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y(V, {
|
|
3752
3788
|
size: 4,
|
|
@@ -3786,35 +3822,36 @@ function ia({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3786
3822
|
}
|
|
3787
3823
|
//#endregion
|
|
3788
3824
|
//#region src/crud/fields/ReferenceField.tsx
|
|
3789
|
-
function
|
|
3790
|
-
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, {
|
|
3791
3827
|
lazy: u,
|
|
3792
3828
|
active: k,
|
|
3793
3829
|
selectedValues: p,
|
|
3794
3830
|
selectedRecords: g,
|
|
3795
3831
|
fetchSelected: f
|
|
3796
|
-
}), I =
|
|
3832
|
+
}), I = ta(M, N, o), L = l(() => j.map((e) => ({
|
|
3797
3833
|
label: e.label,
|
|
3798
3834
|
value: e.value
|
|
3799
3835
|
})), [j]), ee = (e) => {
|
|
3800
3836
|
let t = e[r];
|
|
3801
3837
|
m(t), c?.(t, {
|
|
3802
|
-
label:
|
|
3838
|
+
label: Ji(e, n),
|
|
3803
3839
|
value: t,
|
|
3804
3840
|
record: e
|
|
3805
3841
|
}, { name: h }), F();
|
|
3806
3842
|
}, R = /* @__PURE__ */ J(B, {
|
|
3807
|
-
|
|
3843
|
+
...$i({
|
|
3808
3844
|
popupMatchSelectWidth: C,
|
|
3809
3845
|
popupMinWidth: w
|
|
3810
3846
|
}),
|
|
3811
|
-
value:
|
|
3847
|
+
value: na(N, A, void 0),
|
|
3812
3848
|
onChange: (e) => {
|
|
3813
|
-
|
|
3849
|
+
let t = e ?? null;
|
|
3850
|
+
m(t), c?.(t, P(e), { name: h });
|
|
3814
3851
|
},
|
|
3815
3852
|
options: L,
|
|
3816
3853
|
loading: I.loading,
|
|
3817
|
-
notFoundContent:
|
|
3854
|
+
notFoundContent: ea(I.loading),
|
|
3818
3855
|
showSearch: i,
|
|
3819
3856
|
filterOption: i ? !1 : void 0,
|
|
3820
3857
|
onSearch: i ? E : void 0,
|
|
@@ -3843,7 +3880,7 @@ function aa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3843
3880
|
minWidth: 0
|
|
3844
3881
|
},
|
|
3845
3882
|
children: R
|
|
3846
|
-
}), /* @__PURE__ */ J(
|
|
3883
|
+
}), /* @__PURE__ */ J(la, {
|
|
3847
3884
|
reference: e,
|
|
3848
3885
|
referenceForm: _,
|
|
3849
3886
|
referencePermissions: v,
|
|
@@ -3857,10 +3894,10 @@ function aa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3857
3894
|
})]
|
|
3858
3895
|
}) : R;
|
|
3859
3896
|
}
|
|
3860
|
-
function
|
|
3861
|
-
let
|
|
3862
|
-
name:
|
|
3863
|
-
disabled: !
|
|
3897
|
+
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 }) {
|
|
3898
|
+
let D = Ne({
|
|
3899
|
+
name: _ ?? "",
|
|
3900
|
+
disabled: !_
|
|
3864
3901
|
});
|
|
3865
3902
|
return /* @__PURE__ */ J($, {
|
|
3866
3903
|
source: e,
|
|
@@ -3869,7 +3906,8 @@ function oa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3869
3906
|
required: s,
|
|
3870
3907
|
rules: c,
|
|
3871
3908
|
hideLabel: f,
|
|
3872
|
-
|
|
3909
|
+
hidden: p,
|
|
3910
|
+
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ J(ua, {
|
|
3873
3911
|
reference: r,
|
|
3874
3912
|
choices: i,
|
|
3875
3913
|
optionLabel: a,
|
|
@@ -3877,48 +3915,48 @@ function oa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3877
3915
|
search: l,
|
|
3878
3916
|
allowClear: u,
|
|
3879
3917
|
disabled: n || d,
|
|
3880
|
-
inputStyle:
|
|
3881
|
-
onValueChange:
|
|
3882
|
-
lazy:
|
|
3883
|
-
fetchSelected:
|
|
3918
|
+
inputStyle: m,
|
|
3919
|
+
onValueChange: h,
|
|
3920
|
+
lazy: g,
|
|
3921
|
+
fetchSelected: v,
|
|
3884
3922
|
value: e,
|
|
3885
3923
|
onChange: t,
|
|
3886
3924
|
fieldName: s,
|
|
3887
|
-
selectedRecords:
|
|
3888
|
-
referenceForm:
|
|
3889
|
-
referencePermissions:
|
|
3890
|
-
referenceTitle:
|
|
3891
|
-
referenceDefaultValues:
|
|
3892
|
-
referenceModalWidth:
|
|
3893
|
-
referenceActions:
|
|
3894
|
-
popupMatchSelectWidth:
|
|
3895
|
-
popupMinWidth:
|
|
3925
|
+
selectedRecords: _ ? D : void 0,
|
|
3926
|
+
referenceForm: y,
|
|
3927
|
+
referencePermissions: b,
|
|
3928
|
+
referenceTitle: x,
|
|
3929
|
+
referenceDefaultValues: S,
|
|
3930
|
+
referenceModalWidth: C,
|
|
3931
|
+
referenceActions: w,
|
|
3932
|
+
popupMatchSelectWidth: T,
|
|
3933
|
+
popupMinWidth: E
|
|
3896
3934
|
})
|
|
3897
3935
|
});
|
|
3898
3936
|
}
|
|
3899
3937
|
//#endregion
|
|
3900
3938
|
//#region src/crud/fields/ReferenceManyField.tsx
|
|
3901
|
-
function
|
|
3902
|
-
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D =
|
|
3939
|
+
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 }) {
|
|
3940
|
+
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, {
|
|
3903
3941
|
lazy: o,
|
|
3904
3942
|
active: E,
|
|
3905
3943
|
selectedValues: c,
|
|
3906
3944
|
selectedRecords: p,
|
|
3907
3945
|
fetchSelected: s
|
|
3908
|
-
}), M =
|
|
3946
|
+
}), M = ta(k, A, f), N = l(() => O.map((e) => ({
|
|
3909
3947
|
label: e.label,
|
|
3910
3948
|
value: e.value
|
|
3911
3949
|
})), [O]), P = /* @__PURE__ */ J(B, {
|
|
3912
|
-
|
|
3950
|
+
...$i({
|
|
3913
3951
|
popupMatchSelectWidth: b,
|
|
3914
3952
|
popupMinWidth: x
|
|
3915
3953
|
}),
|
|
3916
3954
|
mode: "multiple",
|
|
3917
|
-
value:
|
|
3918
|
-
onChange: u,
|
|
3955
|
+
value: na(A, D, []),
|
|
3956
|
+
onChange: (e) => u(e ?? []),
|
|
3919
3957
|
options: N,
|
|
3920
3958
|
loading: M.loading,
|
|
3921
|
-
notFoundContent:
|
|
3959
|
+
notFoundContent: ea(M.loading),
|
|
3922
3960
|
showSearch: i,
|
|
3923
3961
|
filterOption: i ? !1 : void 0,
|
|
3924
3962
|
onSearch: i ? C : void 0,
|
|
@@ -3943,7 +3981,7 @@ function sa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3943
3981
|
minWidth: 0
|
|
3944
3982
|
},
|
|
3945
3983
|
children: P
|
|
3946
|
-
}), /* @__PURE__ */ J(
|
|
3984
|
+
}), /* @__PURE__ */ J(la, {
|
|
3947
3985
|
reference: e,
|
|
3948
3986
|
referenceForm: m,
|
|
3949
3987
|
referencePermissions: h,
|
|
@@ -3962,10 +4000,10 @@ function sa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3962
4000
|
})]
|
|
3963
4001
|
}) : P;
|
|
3964
4002
|
}
|
|
3965
|
-
function
|
|
3966
|
-
let
|
|
3967
|
-
name:
|
|
3968
|
-
disabled: !
|
|
4003
|
+
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 }) {
|
|
4004
|
+
let T = Ne({
|
|
4005
|
+
name: h ?? "",
|
|
4006
|
+
disabled: !h
|
|
3969
4007
|
});
|
|
3970
4008
|
return /* @__PURE__ */ J($, {
|
|
3971
4009
|
source: e,
|
|
@@ -3974,36 +4012,37 @@ function ca({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3974
4012
|
required: s,
|
|
3975
4013
|
rules: c,
|
|
3976
4014
|
hideLabel: d,
|
|
3977
|
-
|
|
4015
|
+
hidden: f,
|
|
4016
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(fa, {
|
|
3978
4017
|
reference: r,
|
|
3979
4018
|
choices: i,
|
|
3980
4019
|
optionLabel: a,
|
|
3981
4020
|
optionValue: o,
|
|
3982
4021
|
search: l,
|
|
3983
4022
|
allowClear: u,
|
|
3984
|
-
lazy:
|
|
3985
|
-
fetchSelected:
|
|
4023
|
+
lazy: m,
|
|
4024
|
+
fetchSelected: g,
|
|
3986
4025
|
value: e,
|
|
3987
4026
|
onChange: t,
|
|
3988
|
-
disabled: n ||
|
|
3989
|
-
selectedRecords:
|
|
3990
|
-
referenceForm:
|
|
3991
|
-
referencePermissions:
|
|
3992
|
-
referenceTitle:
|
|
3993
|
-
referenceDefaultValues:
|
|
3994
|
-
referenceModalWidth:
|
|
3995
|
-
referenceActions:
|
|
3996
|
-
popupMatchSelectWidth:
|
|
3997
|
-
popupMinWidth:
|
|
4027
|
+
disabled: n || p,
|
|
4028
|
+
selectedRecords: h ? T : void 0,
|
|
4029
|
+
referenceForm: _,
|
|
4030
|
+
referencePermissions: v,
|
|
4031
|
+
referenceTitle: y,
|
|
4032
|
+
referenceDefaultValues: b,
|
|
4033
|
+
referenceModalWidth: x,
|
|
4034
|
+
referenceActions: S,
|
|
4035
|
+
popupMatchSelectWidth: C,
|
|
4036
|
+
popupMinWidth: w
|
|
3998
4037
|
})
|
|
3999
4038
|
});
|
|
4000
4039
|
}
|
|
4001
4040
|
//#endregion
|
|
4002
4041
|
//#region src/crud/fields/uploadFieldUtils.ts
|
|
4003
|
-
function
|
|
4042
|
+
function ma(e) {
|
|
4004
4043
|
return e instanceof File ? !0 : typeof e == "string" && e.length > 0;
|
|
4005
4044
|
}
|
|
4006
|
-
function
|
|
4045
|
+
function ha(e) {
|
|
4007
4046
|
if (e instanceof File) return e.name;
|
|
4008
4047
|
if (typeof e == "string" && e.length > 0) try {
|
|
4009
4048
|
return new URL(e, "http://local").pathname.split("/").filter(Boolean).pop() || e;
|
|
@@ -4013,7 +4052,7 @@ function ua(e) {
|
|
|
4013
4052
|
}
|
|
4014
4053
|
//#endregion
|
|
4015
4054
|
//#region src/crud/fields/useUploadPreviewUrl.ts
|
|
4016
|
-
function
|
|
4055
|
+
function ga(e) {
|
|
4017
4056
|
let [t, n] = d();
|
|
4018
4057
|
if (s(() => {
|
|
4019
4058
|
if (e instanceof File) {
|
|
@@ -4026,8 +4065,8 @@ function da(e) {
|
|
|
4026
4065
|
}
|
|
4027
4066
|
//#endregion
|
|
4028
4067
|
//#region src/crud/fields/ImageField.tsx
|
|
4029
|
-
function
|
|
4030
|
-
let o = u(null), s =
|
|
4068
|
+
function _a({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "image/*", previewWidth: a = 200 }) {
|
|
4069
|
+
let o = u(null), s = ga(e), c = r && ma(e);
|
|
4031
4070
|
return /* @__PURE__ */ Y(V, {
|
|
4032
4071
|
direction: "vertical",
|
|
4033
4072
|
size: "middle",
|
|
@@ -4074,7 +4113,7 @@ function fa({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
4074
4113
|
]
|
|
4075
4114
|
});
|
|
4076
4115
|
}
|
|
4077
|
-
function
|
|
4116
|
+
function va({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, clearable: s, accept: c, previewWidth: l }) {
|
|
4078
4117
|
return /* @__PURE__ */ J($, {
|
|
4079
4118
|
source: e,
|
|
4080
4119
|
name: t,
|
|
@@ -4082,20 +4121,21 @@ function pa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4082
4121
|
required: r,
|
|
4083
4122
|
rules: i,
|
|
4084
4123
|
hideLabel: a,
|
|
4085
|
-
|
|
4124
|
+
hidden: o,
|
|
4125
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(_a, {
|
|
4086
4126
|
value: e,
|
|
4087
4127
|
onChange: t,
|
|
4088
4128
|
disabled: n,
|
|
4089
|
-
clearable:
|
|
4090
|
-
accept:
|
|
4091
|
-
previewWidth:
|
|
4129
|
+
clearable: s,
|
|
4130
|
+
accept: c,
|
|
4131
|
+
previewWidth: l
|
|
4092
4132
|
})
|
|
4093
4133
|
});
|
|
4094
4134
|
}
|
|
4095
4135
|
//#endregion
|
|
4096
4136
|
//#region src/crud/fields/FileField.tsx
|
|
4097
|
-
function
|
|
4098
|
-
let a = u(null), o =
|
|
4137
|
+
function ya({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
4138
|
+
let a = u(null), o = ha(e), s = typeof e == "string" && e.length > 0 ? e : void 0, c = r && ma(e);
|
|
4099
4139
|
return /* @__PURE__ */ Y(V, {
|
|
4100
4140
|
direction: "vertical",
|
|
4101
4141
|
size: "middle",
|
|
@@ -4139,7 +4179,7 @@ function ma({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
4139
4179
|
]
|
|
4140
4180
|
});
|
|
4141
4181
|
}
|
|
4142
|
-
function
|
|
4182
|
+
function ba({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, clearable: s, accept: c }) {
|
|
4143
4183
|
return /* @__PURE__ */ J($, {
|
|
4144
4184
|
source: e,
|
|
4145
4185
|
name: t,
|
|
@@ -4147,18 +4187,24 @@ function ha({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4147
4187
|
required: r,
|
|
4148
4188
|
rules: i,
|
|
4149
4189
|
hideLabel: a,
|
|
4150
|
-
|
|
4190
|
+
hidden: o,
|
|
4191
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(ya, {
|
|
4151
4192
|
value: e,
|
|
4152
4193
|
onChange: t,
|
|
4153
4194
|
disabled: n,
|
|
4154
|
-
clearable:
|
|
4155
|
-
accept:
|
|
4195
|
+
clearable: s,
|
|
4196
|
+
accept: c
|
|
4156
4197
|
})
|
|
4157
4198
|
});
|
|
4158
4199
|
}
|
|
4159
4200
|
//#endregion
|
|
4201
|
+
//#region src/crud/utils/columnDataIndex.ts
|
|
4202
|
+
function xa(e) {
|
|
4203
|
+
return e.includes(".") ? e.split(".") : e;
|
|
4204
|
+
}
|
|
4205
|
+
//#endregion
|
|
4160
4206
|
//#region src/crud/columns/TextColumn.tsx
|
|
4161
|
-
function
|
|
4207
|
+
function Sa({ source: e, label: t, sortable: n = !0 }) {
|
|
4162
4208
|
return Jn(l(() => ({
|
|
4163
4209
|
key: e,
|
|
4164
4210
|
source: e,
|
|
@@ -4166,7 +4212,7 @@ function ga({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4166
4212
|
sortable: n,
|
|
4167
4213
|
buildColumn: () => ({
|
|
4168
4214
|
title: t ?? e,
|
|
4169
|
-
dataIndex: e,
|
|
4215
|
+
dataIndex: xa(e),
|
|
4170
4216
|
key: e,
|
|
4171
4217
|
sorter: n ? !0 : void 0
|
|
4172
4218
|
})
|
|
@@ -4176,12 +4222,12 @@ function ga({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4176
4222
|
n
|
|
4177
4223
|
])), null;
|
|
4178
4224
|
}
|
|
4179
|
-
function
|
|
4180
|
-
return typeof n == "function" ? n(e) : n ? br(e, n) : e
|
|
4225
|
+
function Ca(e, t, n) {
|
|
4226
|
+
return typeof n == "function" ? n(e) : n ? br(e, n) : br(e, t);
|
|
4181
4227
|
}
|
|
4182
4228
|
//#endregion
|
|
4183
4229
|
//#region src/crud/columns/NumberColumn.tsx
|
|
4184
|
-
function
|
|
4230
|
+
function wa({ source: e, label: t, sortable: n = !0 }) {
|
|
4185
4231
|
return Jn(l(() => ({
|
|
4186
4232
|
key: e,
|
|
4187
4233
|
source: e,
|
|
@@ -4189,7 +4235,7 @@ function va({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4189
4235
|
sortable: n,
|
|
4190
4236
|
buildColumn: () => ({
|
|
4191
4237
|
title: t ?? e,
|
|
4192
|
-
dataIndex: e,
|
|
4238
|
+
dataIndex: xa(e),
|
|
4193
4239
|
key: e,
|
|
4194
4240
|
sorter: n ? !0 : void 0
|
|
4195
4241
|
})
|
|
@@ -4201,7 +4247,7 @@ function va({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4201
4247
|
}
|
|
4202
4248
|
//#endregion
|
|
4203
4249
|
//#region src/crud/columns/BooleanColumn.tsx
|
|
4204
|
-
function
|
|
4250
|
+
function Ta({ source: e, label: t, sortable: n = !0 }) {
|
|
4205
4251
|
return Jn(l(() => ({
|
|
4206
4252
|
key: e,
|
|
4207
4253
|
source: e,
|
|
@@ -4209,7 +4255,7 @@ function ya({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4209
4255
|
sortable: n,
|
|
4210
4256
|
buildColumn: () => ({
|
|
4211
4257
|
title: t ?? e,
|
|
4212
|
-
dataIndex: e,
|
|
4258
|
+
dataIndex: xa(e),
|
|
4213
4259
|
key: e,
|
|
4214
4260
|
sorter: n ? !0 : void 0,
|
|
4215
4261
|
render: (e) => e ? "Yes" : "No"
|
|
@@ -4222,7 +4268,7 @@ function ya({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4222
4268
|
}
|
|
4223
4269
|
//#endregion
|
|
4224
4270
|
//#region src/crud/columns/DateColumn.tsx
|
|
4225
|
-
function
|
|
4271
|
+
function Ea({ source: e, label: t, sortable: n = !0 }) {
|
|
4226
4272
|
return Jn(l(() => ({
|
|
4227
4273
|
key: e,
|
|
4228
4274
|
source: e,
|
|
@@ -4230,7 +4276,7 @@ function ba({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4230
4276
|
sortable: n,
|
|
4231
4277
|
buildColumn: () => ({
|
|
4232
4278
|
title: t ?? e,
|
|
4233
|
-
dataIndex: e,
|
|
4279
|
+
dataIndex: xa(e),
|
|
4234
4280
|
key: e,
|
|
4235
4281
|
sorter: n ? !0 : void 0,
|
|
4236
4282
|
render: (e) => e ? String(e).slice(0, 10) : "—"
|
|
@@ -4243,16 +4289,16 @@ function ba({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4243
4289
|
}
|
|
4244
4290
|
//#endregion
|
|
4245
4291
|
//#region src/crud/columns/ReferenceColumn.tsx
|
|
4246
|
-
function
|
|
4247
|
-
let { labelForValue: s } =
|
|
4292
|
+
function Da({ record: e, source: t, display: n, reference: r, choices: i, optionLabel: a, optionValue: o }) {
|
|
4293
|
+
let { labelForValue: s } = ca(i, r, a, o), c = br(e, t);
|
|
4248
4294
|
if (typeof n == "function") return /* @__PURE__ */ J(q, { children: n(e) });
|
|
4249
4295
|
if (n && n !== t) {
|
|
4250
|
-
let r =
|
|
4296
|
+
let r = Ca(e, t, n);
|
|
4251
4297
|
return /* @__PURE__ */ J(q, { children: r == null ? "—" : String(r) });
|
|
4252
4298
|
}
|
|
4253
4299
|
return /* @__PURE__ */ J(q, { children: s(c) });
|
|
4254
4300
|
}
|
|
4255
|
-
function
|
|
4301
|
+
function Oa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: s = !0 }) {
|
|
4256
4302
|
return Jn(l(() => ({
|
|
4257
4303
|
key: e,
|
|
4258
4304
|
source: e,
|
|
@@ -4263,7 +4309,7 @@ function Sa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4263
4309
|
dataIndex: e,
|
|
4264
4310
|
key: e,
|
|
4265
4311
|
sorter: s ? !0 : void 0,
|
|
4266
|
-
render: (s, c) => /* @__PURE__ */ J(
|
|
4312
|
+
render: (s, c) => /* @__PURE__ */ J(Da, {
|
|
4267
4313
|
record: c,
|
|
4268
4314
|
source: e,
|
|
4269
4315
|
label: t,
|
|
@@ -4287,11 +4333,11 @@ function Sa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4287
4333
|
}
|
|
4288
4334
|
//#endregion
|
|
4289
4335
|
//#region src/crud/columns/ReferenceManyColumn.tsx
|
|
4290
|
-
function
|
|
4291
|
-
let { labelsForValues: o } =
|
|
4336
|
+
function ka({ record: e, source: t, reference: n, choices: r, optionLabel: i, optionValue: a }) {
|
|
4337
|
+
let { labelsForValues: o } = ca(r, n, i, a), s = br(e, t);
|
|
4292
4338
|
return /* @__PURE__ */ J(q, { children: o(Array.isArray(s) ? s : []) });
|
|
4293
4339
|
}
|
|
4294
|
-
function
|
|
4340
|
+
function Aa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
|
|
4295
4341
|
return Jn(l(() => ({
|
|
4296
4342
|
key: e,
|
|
4297
4343
|
source: e,
|
|
@@ -4302,7 +4348,7 @@ function wa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4302
4348
|
dataIndex: e,
|
|
4303
4349
|
key: e,
|
|
4304
4350
|
sorter: o ? !0 : void 0,
|
|
4305
|
-
render: (t, o) => /* @__PURE__ */ J(
|
|
4351
|
+
render: (t, o) => /* @__PURE__ */ J(ka, {
|
|
4306
4352
|
record: o,
|
|
4307
4353
|
source: e,
|
|
4308
4354
|
reference: n,
|
|
@@ -4323,7 +4369,7 @@ function wa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4323
4369
|
}
|
|
4324
4370
|
//#endregion
|
|
4325
4371
|
//#region src/crud/columns/ImageColumn.tsx
|
|
4326
|
-
function
|
|
4372
|
+
function ja({ source: e, label: t, sortable: n = !1, width: r = 40, height: i = 40, objectFit: a = "cover", borderRadius: o = 4, alt: s = "" }) {
|
|
4327
4373
|
return Jn(l(() => ({
|
|
4328
4374
|
key: e,
|
|
4329
4375
|
source: e,
|
|
@@ -4331,7 +4377,7 @@ function Ta({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4331
4377
|
sortable: n,
|
|
4332
4378
|
buildColumn: () => ({
|
|
4333
4379
|
title: t ?? e,
|
|
4334
|
-
dataIndex: e,
|
|
4380
|
+
dataIndex: xa(e),
|
|
4335
4381
|
key: e,
|
|
4336
4382
|
sorter: n ? !0 : void 0,
|
|
4337
4383
|
render: (e) => e == null || e === "" ? null : /* @__PURE__ */ J("img", {
|
|
@@ -4358,7 +4404,7 @@ function Ta({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4358
4404
|
}
|
|
4359
4405
|
//#endregion
|
|
4360
4406
|
//#region src/crud/columns/CustomColumn.tsx
|
|
4361
|
-
function
|
|
4407
|
+
function Ma({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
4362
4408
|
return Jn(l(() => ({
|
|
4363
4409
|
key: e,
|
|
4364
4410
|
source: e,
|
|
@@ -4378,7 +4424,7 @@ function Ea({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
|
4378
4424
|
}
|
|
4379
4425
|
//#endregion
|
|
4380
4426
|
//#region src/crud/filters/NumberFilter.tsx
|
|
4381
|
-
function
|
|
4427
|
+
function Na({ source: e, label: t }) {
|
|
4382
4428
|
return rr(l(() => ({
|
|
4383
4429
|
key: e,
|
|
4384
4430
|
source: e,
|
|
@@ -4393,7 +4439,7 @@ function Da({ source: e, label: t }) {
|
|
|
4393
4439
|
}
|
|
4394
4440
|
//#endregion
|
|
4395
4441
|
//#region src/crud/filters/BooleanFilter.tsx
|
|
4396
|
-
function
|
|
4442
|
+
function Pa({ source: e, label: t }) {
|
|
4397
4443
|
return rr(l(() => ({
|
|
4398
4444
|
key: e,
|
|
4399
4445
|
source: e,
|
|
@@ -4416,7 +4462,7 @@ function Oa({ source: e, label: t }) {
|
|
|
4416
4462
|
}
|
|
4417
4463
|
//#endregion
|
|
4418
4464
|
//#region src/crud/filters/DateFilter.tsx
|
|
4419
|
-
function
|
|
4465
|
+
function Fa({ source: e, label: t }) {
|
|
4420
4466
|
return rr(l(() => ({
|
|
4421
4467
|
key: e,
|
|
4422
4468
|
source: e,
|
|
@@ -4432,7 +4478,7 @@ function ka({ source: e, label: t }) {
|
|
|
4432
4478
|
}
|
|
4433
4479
|
//#endregion
|
|
4434
4480
|
//#region src/crud/filters/SelectFilter.tsx
|
|
4435
|
-
function
|
|
4481
|
+
function Ia({ source: e, label: t, choices: n, multiple: r }) {
|
|
4436
4482
|
return rr(l(() => ({
|
|
4437
4483
|
key: e,
|
|
4438
4484
|
source: e,
|
|
@@ -4455,22 +4501,22 @@ function Aa({ source: e, label: t, choices: n, multiple: r }) {
|
|
|
4455
4501
|
}
|
|
4456
4502
|
//#endregion
|
|
4457
4503
|
//#region src/crud/filters/ReferenceFilter.tsx
|
|
4458
|
-
function
|
|
4459
|
-
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b, selectedLoading: x } =
|
|
4504
|
+
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 }) {
|
|
4505
|
+
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b, selectedLoading: x } = ca(r, n, i, a, s ? h : void 0, {
|
|
4460
4506
|
lazy: c,
|
|
4461
4507
|
active: _ || !!h,
|
|
4462
4508
|
selectedValues: p,
|
|
4463
4509
|
fetchSelected: l
|
|
4464
|
-
}), S =
|
|
4510
|
+
}), S = ta(b, x), C = p;
|
|
4465
4511
|
return /* @__PURE__ */ J(B, {
|
|
4466
|
-
|
|
4512
|
+
...$i({
|
|
4467
4513
|
popupMatchSelectWidth: u,
|
|
4468
4514
|
popupMinWidth: f
|
|
4469
4515
|
}),
|
|
4470
4516
|
allowClear: !0,
|
|
4471
4517
|
mode: o ? "multiple" : void 0,
|
|
4472
4518
|
placeholder: t ?? e,
|
|
4473
|
-
value:
|
|
4519
|
+
value: na(x, C, o ? [] : void 0),
|
|
4474
4520
|
onChange: m,
|
|
4475
4521
|
options: y.map((e) => ({
|
|
4476
4522
|
label: e.label,
|
|
@@ -4478,7 +4524,7 @@ function ja({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4478
4524
|
})),
|
|
4479
4525
|
loading: S.loading,
|
|
4480
4526
|
disabled: S.disabled,
|
|
4481
|
-
notFoundContent:
|
|
4527
|
+
notFoundContent: ea(S.loading),
|
|
4482
4528
|
showSearch: s,
|
|
4483
4529
|
filterOption: s ? !1 : void 0,
|
|
4484
4530
|
onSearch: s ? g : void 0,
|
|
@@ -4489,12 +4535,12 @@ function ja({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4489
4535
|
style: { minWidth: 180 }
|
|
4490
4536
|
});
|
|
4491
4537
|
}
|
|
4492
|
-
function
|
|
4538
|
+
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 }) {
|
|
4493
4539
|
return rr(l(() => ({
|
|
4494
4540
|
key: e,
|
|
4495
4541
|
source: e,
|
|
4496
4542
|
label: t,
|
|
4497
|
-
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(
|
|
4543
|
+
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(La, {
|
|
4498
4544
|
source: e,
|
|
4499
4545
|
label: t,
|
|
4500
4546
|
reference: n,
|
|
@@ -4525,11 +4571,11 @@ function Ma({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4525
4571
|
f
|
|
4526
4572
|
])), null;
|
|
4527
4573
|
}
|
|
4528
|
-
function
|
|
4529
|
-
return /* @__PURE__ */ J(
|
|
4574
|
+
function za(e) {
|
|
4575
|
+
return /* @__PURE__ */ J(Ra, {
|
|
4530
4576
|
...e,
|
|
4531
4577
|
multiple: !0
|
|
4532
4578
|
});
|
|
4533
4579
|
}
|
|
4534
4580
|
//#endregion
|
|
4535
|
-
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,
|
|
4581
|
+
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 };
|