ding-react-admin 2.4.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 +274 -229
- 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 +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;
|
|
@@ -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,6 +3487,7 @@ 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
3493
|
onChange: t,
|
|
@@ -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,35 @@ 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
|
m(e), c?.(e, P(e), { name: h });
|
|
3814
3850
|
},
|
|
3815
3851
|
options: L,
|
|
3816
3852
|
loading: I.loading,
|
|
3817
|
-
notFoundContent:
|
|
3853
|
+
notFoundContent: ea(I.loading),
|
|
3818
3854
|
showSearch: i,
|
|
3819
3855
|
filterOption: i ? !1 : void 0,
|
|
3820
3856
|
onSearch: i ? E : void 0,
|
|
@@ -3843,7 +3879,7 @@ function aa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3843
3879
|
minWidth: 0
|
|
3844
3880
|
},
|
|
3845
3881
|
children: R
|
|
3846
|
-
}), /* @__PURE__ */ J(
|
|
3882
|
+
}), /* @__PURE__ */ J(la, {
|
|
3847
3883
|
reference: e,
|
|
3848
3884
|
referenceForm: _,
|
|
3849
3885
|
referencePermissions: v,
|
|
@@ -3857,10 +3893,10 @@ function aa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3857
3893
|
})]
|
|
3858
3894
|
}) : R;
|
|
3859
3895
|
}
|
|
3860
|
-
function
|
|
3861
|
-
let
|
|
3862
|
-
name:
|
|
3863
|
-
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: !_
|
|
3864
3900
|
});
|
|
3865
3901
|
return /* @__PURE__ */ J($, {
|
|
3866
3902
|
source: e,
|
|
@@ -3869,7 +3905,8 @@ function oa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3869
3905
|
required: s,
|
|
3870
3906
|
rules: c,
|
|
3871
3907
|
hideLabel: f,
|
|
3872
|
-
|
|
3908
|
+
hidden: p,
|
|
3909
|
+
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ J(ua, {
|
|
3873
3910
|
reference: r,
|
|
3874
3911
|
choices: i,
|
|
3875
3912
|
optionLabel: a,
|
|
@@ -3877,48 +3914,48 @@ function oa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3877
3914
|
search: l,
|
|
3878
3915
|
allowClear: u,
|
|
3879
3916
|
disabled: n || d,
|
|
3880
|
-
inputStyle:
|
|
3881
|
-
onValueChange:
|
|
3882
|
-
lazy:
|
|
3883
|
-
fetchSelected:
|
|
3917
|
+
inputStyle: m,
|
|
3918
|
+
onValueChange: h,
|
|
3919
|
+
lazy: g,
|
|
3920
|
+
fetchSelected: v,
|
|
3884
3921
|
value: e,
|
|
3885
3922
|
onChange: t,
|
|
3886
3923
|
fieldName: s,
|
|
3887
|
-
selectedRecords:
|
|
3888
|
-
referenceForm:
|
|
3889
|
-
referencePermissions:
|
|
3890
|
-
referenceTitle:
|
|
3891
|
-
referenceDefaultValues:
|
|
3892
|
-
referenceModalWidth:
|
|
3893
|
-
referenceActions:
|
|
3894
|
-
popupMatchSelectWidth:
|
|
3895
|
-
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
|
|
3896
3933
|
})
|
|
3897
3934
|
});
|
|
3898
3935
|
}
|
|
3899
3936
|
//#endregion
|
|
3900
3937
|
//#region src/crud/fields/ReferenceManyField.tsx
|
|
3901
|
-
function
|
|
3902
|
-
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, {
|
|
3903
3940
|
lazy: o,
|
|
3904
3941
|
active: E,
|
|
3905
3942
|
selectedValues: c,
|
|
3906
3943
|
selectedRecords: p,
|
|
3907
3944
|
fetchSelected: s
|
|
3908
|
-
}), M =
|
|
3945
|
+
}), M = ta(k, A, f), N = l(() => O.map((e) => ({
|
|
3909
3946
|
label: e.label,
|
|
3910
3947
|
value: e.value
|
|
3911
3948
|
})), [O]), P = /* @__PURE__ */ J(B, {
|
|
3912
|
-
|
|
3949
|
+
...$i({
|
|
3913
3950
|
popupMatchSelectWidth: b,
|
|
3914
3951
|
popupMinWidth: x
|
|
3915
3952
|
}),
|
|
3916
3953
|
mode: "multiple",
|
|
3917
|
-
value:
|
|
3954
|
+
value: na(A, D, []),
|
|
3918
3955
|
onChange: u,
|
|
3919
3956
|
options: N,
|
|
3920
3957
|
loading: M.loading,
|
|
3921
|
-
notFoundContent:
|
|
3958
|
+
notFoundContent: ea(M.loading),
|
|
3922
3959
|
showSearch: i,
|
|
3923
3960
|
filterOption: i ? !1 : void 0,
|
|
3924
3961
|
onSearch: i ? C : void 0,
|
|
@@ -3943,7 +3980,7 @@ function sa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3943
3980
|
minWidth: 0
|
|
3944
3981
|
},
|
|
3945
3982
|
children: P
|
|
3946
|
-
}), /* @__PURE__ */ J(
|
|
3983
|
+
}), /* @__PURE__ */ J(la, {
|
|
3947
3984
|
reference: e,
|
|
3948
3985
|
referenceForm: m,
|
|
3949
3986
|
referencePermissions: h,
|
|
@@ -3962,10 +3999,10 @@ function sa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3962
3999
|
})]
|
|
3963
4000
|
}) : P;
|
|
3964
4001
|
}
|
|
3965
|
-
function
|
|
3966
|
-
let
|
|
3967
|
-
name:
|
|
3968
|
-
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
|
|
3969
4006
|
});
|
|
3970
4007
|
return /* @__PURE__ */ J($, {
|
|
3971
4008
|
source: e,
|
|
@@ -3974,36 +4011,37 @@ function ca({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3974
4011
|
required: s,
|
|
3975
4012
|
rules: c,
|
|
3976
4013
|
hideLabel: d,
|
|
3977
|
-
|
|
4014
|
+
hidden: f,
|
|
4015
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(fa, {
|
|
3978
4016
|
reference: r,
|
|
3979
4017
|
choices: i,
|
|
3980
4018
|
optionLabel: a,
|
|
3981
4019
|
optionValue: o,
|
|
3982
4020
|
search: l,
|
|
3983
4021
|
allowClear: u,
|
|
3984
|
-
lazy:
|
|
3985
|
-
fetchSelected:
|
|
4022
|
+
lazy: m,
|
|
4023
|
+
fetchSelected: g,
|
|
3986
4024
|
value: e,
|
|
3987
4025
|
onChange: t,
|
|
3988
|
-
disabled: n ||
|
|
3989
|
-
selectedRecords:
|
|
3990
|
-
referenceForm:
|
|
3991
|
-
referencePermissions:
|
|
3992
|
-
referenceTitle:
|
|
3993
|
-
referenceDefaultValues:
|
|
3994
|
-
referenceModalWidth:
|
|
3995
|
-
referenceActions:
|
|
3996
|
-
popupMatchSelectWidth:
|
|
3997
|
-
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
|
|
3998
4036
|
})
|
|
3999
4037
|
});
|
|
4000
4038
|
}
|
|
4001
4039
|
//#endregion
|
|
4002
4040
|
//#region src/crud/fields/uploadFieldUtils.ts
|
|
4003
|
-
function
|
|
4041
|
+
function ma(e) {
|
|
4004
4042
|
return e instanceof File ? !0 : typeof e == "string" && e.length > 0;
|
|
4005
4043
|
}
|
|
4006
|
-
function
|
|
4044
|
+
function ha(e) {
|
|
4007
4045
|
if (e instanceof File) return e.name;
|
|
4008
4046
|
if (typeof e == "string" && e.length > 0) try {
|
|
4009
4047
|
return new URL(e, "http://local").pathname.split("/").filter(Boolean).pop() || e;
|
|
@@ -4013,7 +4051,7 @@ function ua(e) {
|
|
|
4013
4051
|
}
|
|
4014
4052
|
//#endregion
|
|
4015
4053
|
//#region src/crud/fields/useUploadPreviewUrl.ts
|
|
4016
|
-
function
|
|
4054
|
+
function ga(e) {
|
|
4017
4055
|
let [t, n] = d();
|
|
4018
4056
|
if (s(() => {
|
|
4019
4057
|
if (e instanceof File) {
|
|
@@ -4026,8 +4064,8 @@ function da(e) {
|
|
|
4026
4064
|
}
|
|
4027
4065
|
//#endregion
|
|
4028
4066
|
//#region src/crud/fields/ImageField.tsx
|
|
4029
|
-
function
|
|
4030
|
-
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);
|
|
4031
4069
|
return /* @__PURE__ */ Y(V, {
|
|
4032
4070
|
direction: "vertical",
|
|
4033
4071
|
size: "middle",
|
|
@@ -4074,7 +4112,7 @@ function fa({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
4074
4112
|
]
|
|
4075
4113
|
});
|
|
4076
4114
|
}
|
|
4077
|
-
function
|
|
4115
|
+
function va({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, clearable: s, accept: c, previewWidth: l }) {
|
|
4078
4116
|
return /* @__PURE__ */ J($, {
|
|
4079
4117
|
source: e,
|
|
4080
4118
|
name: t,
|
|
@@ -4082,20 +4120,21 @@ function pa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4082
4120
|
required: r,
|
|
4083
4121
|
rules: i,
|
|
4084
4122
|
hideLabel: a,
|
|
4085
|
-
|
|
4123
|
+
hidden: o,
|
|
4124
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(_a, {
|
|
4086
4125
|
value: e,
|
|
4087
4126
|
onChange: t,
|
|
4088
4127
|
disabled: n,
|
|
4089
|
-
clearable:
|
|
4090
|
-
accept:
|
|
4091
|
-
previewWidth:
|
|
4128
|
+
clearable: s,
|
|
4129
|
+
accept: c,
|
|
4130
|
+
previewWidth: l
|
|
4092
4131
|
})
|
|
4093
4132
|
});
|
|
4094
4133
|
}
|
|
4095
4134
|
//#endregion
|
|
4096
4135
|
//#region src/crud/fields/FileField.tsx
|
|
4097
|
-
function
|
|
4098
|
-
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);
|
|
4099
4138
|
return /* @__PURE__ */ Y(V, {
|
|
4100
4139
|
direction: "vertical",
|
|
4101
4140
|
size: "middle",
|
|
@@ -4139,7 +4178,7 @@ function ma({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
4139
4178
|
]
|
|
4140
4179
|
});
|
|
4141
4180
|
}
|
|
4142
|
-
function
|
|
4181
|
+
function ba({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, hidden: o, clearable: s, accept: c }) {
|
|
4143
4182
|
return /* @__PURE__ */ J($, {
|
|
4144
4183
|
source: e,
|
|
4145
4184
|
name: t,
|
|
@@ -4147,18 +4186,24 @@ function ha({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4147
4186
|
required: r,
|
|
4148
4187
|
rules: i,
|
|
4149
4188
|
hideLabel: a,
|
|
4150
|
-
|
|
4189
|
+
hidden: o,
|
|
4190
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(ya, {
|
|
4151
4191
|
value: e,
|
|
4152
4192
|
onChange: t,
|
|
4153
4193
|
disabled: n,
|
|
4154
|
-
clearable:
|
|
4155
|
-
accept:
|
|
4194
|
+
clearable: s,
|
|
4195
|
+
accept: c
|
|
4156
4196
|
})
|
|
4157
4197
|
});
|
|
4158
4198
|
}
|
|
4159
4199
|
//#endregion
|
|
4200
|
+
//#region src/crud/utils/columnDataIndex.ts
|
|
4201
|
+
function xa(e) {
|
|
4202
|
+
return e.includes(".") ? e.split(".") : e;
|
|
4203
|
+
}
|
|
4204
|
+
//#endregion
|
|
4160
4205
|
//#region src/crud/columns/TextColumn.tsx
|
|
4161
|
-
function
|
|
4206
|
+
function Sa({ source: e, label: t, sortable: n = !0 }) {
|
|
4162
4207
|
return Jn(l(() => ({
|
|
4163
4208
|
key: e,
|
|
4164
4209
|
source: e,
|
|
@@ -4166,7 +4211,7 @@ function ga({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4166
4211
|
sortable: n,
|
|
4167
4212
|
buildColumn: () => ({
|
|
4168
4213
|
title: t ?? e,
|
|
4169
|
-
dataIndex: e,
|
|
4214
|
+
dataIndex: xa(e),
|
|
4170
4215
|
key: e,
|
|
4171
4216
|
sorter: n ? !0 : void 0
|
|
4172
4217
|
})
|
|
@@ -4176,12 +4221,12 @@ function ga({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4176
4221
|
n
|
|
4177
4222
|
])), null;
|
|
4178
4223
|
}
|
|
4179
|
-
function
|
|
4180
|
-
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);
|
|
4181
4226
|
}
|
|
4182
4227
|
//#endregion
|
|
4183
4228
|
//#region src/crud/columns/NumberColumn.tsx
|
|
4184
|
-
function
|
|
4229
|
+
function wa({ source: e, label: t, sortable: n = !0 }) {
|
|
4185
4230
|
return Jn(l(() => ({
|
|
4186
4231
|
key: e,
|
|
4187
4232
|
source: e,
|
|
@@ -4189,7 +4234,7 @@ function va({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4189
4234
|
sortable: n,
|
|
4190
4235
|
buildColumn: () => ({
|
|
4191
4236
|
title: t ?? e,
|
|
4192
|
-
dataIndex: e,
|
|
4237
|
+
dataIndex: xa(e),
|
|
4193
4238
|
key: e,
|
|
4194
4239
|
sorter: n ? !0 : void 0
|
|
4195
4240
|
})
|
|
@@ -4201,7 +4246,7 @@ function va({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4201
4246
|
}
|
|
4202
4247
|
//#endregion
|
|
4203
4248
|
//#region src/crud/columns/BooleanColumn.tsx
|
|
4204
|
-
function
|
|
4249
|
+
function Ta({ source: e, label: t, sortable: n = !0 }) {
|
|
4205
4250
|
return Jn(l(() => ({
|
|
4206
4251
|
key: e,
|
|
4207
4252
|
source: e,
|
|
@@ -4209,7 +4254,7 @@ function ya({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4209
4254
|
sortable: n,
|
|
4210
4255
|
buildColumn: () => ({
|
|
4211
4256
|
title: t ?? e,
|
|
4212
|
-
dataIndex: e,
|
|
4257
|
+
dataIndex: xa(e),
|
|
4213
4258
|
key: e,
|
|
4214
4259
|
sorter: n ? !0 : void 0,
|
|
4215
4260
|
render: (e) => e ? "Yes" : "No"
|
|
@@ -4222,7 +4267,7 @@ function ya({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4222
4267
|
}
|
|
4223
4268
|
//#endregion
|
|
4224
4269
|
//#region src/crud/columns/DateColumn.tsx
|
|
4225
|
-
function
|
|
4270
|
+
function Ea({ source: e, label: t, sortable: n = !0 }) {
|
|
4226
4271
|
return Jn(l(() => ({
|
|
4227
4272
|
key: e,
|
|
4228
4273
|
source: e,
|
|
@@ -4230,7 +4275,7 @@ function ba({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4230
4275
|
sortable: n,
|
|
4231
4276
|
buildColumn: () => ({
|
|
4232
4277
|
title: t ?? e,
|
|
4233
|
-
dataIndex: e,
|
|
4278
|
+
dataIndex: xa(e),
|
|
4234
4279
|
key: e,
|
|
4235
4280
|
sorter: n ? !0 : void 0,
|
|
4236
4281
|
render: (e) => e ? String(e).slice(0, 10) : "—"
|
|
@@ -4243,16 +4288,16 @@ function ba({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4243
4288
|
}
|
|
4244
4289
|
//#endregion
|
|
4245
4290
|
//#region src/crud/columns/ReferenceColumn.tsx
|
|
4246
|
-
function
|
|
4247
|
-
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);
|
|
4248
4293
|
if (typeof n == "function") return /* @__PURE__ */ J(q, { children: n(e) });
|
|
4249
4294
|
if (n && n !== t) {
|
|
4250
|
-
let r =
|
|
4295
|
+
let r = Ca(e, t, n);
|
|
4251
4296
|
return /* @__PURE__ */ J(q, { children: r == null ? "—" : String(r) });
|
|
4252
4297
|
}
|
|
4253
4298
|
return /* @__PURE__ */ J(q, { children: s(c) });
|
|
4254
4299
|
}
|
|
4255
|
-
function
|
|
4300
|
+
function Oa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: s = !0 }) {
|
|
4256
4301
|
return Jn(l(() => ({
|
|
4257
4302
|
key: e,
|
|
4258
4303
|
source: e,
|
|
@@ -4263,7 +4308,7 @@ function Sa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4263
4308
|
dataIndex: e,
|
|
4264
4309
|
key: e,
|
|
4265
4310
|
sorter: s ? !0 : void 0,
|
|
4266
|
-
render: (s, c) => /* @__PURE__ */ J(
|
|
4311
|
+
render: (s, c) => /* @__PURE__ */ J(Da, {
|
|
4267
4312
|
record: c,
|
|
4268
4313
|
source: e,
|
|
4269
4314
|
label: t,
|
|
@@ -4287,11 +4332,11 @@ function Sa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4287
4332
|
}
|
|
4288
4333
|
//#endregion
|
|
4289
4334
|
//#region src/crud/columns/ReferenceManyColumn.tsx
|
|
4290
|
-
function
|
|
4291
|
-
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);
|
|
4292
4337
|
return /* @__PURE__ */ J(q, { children: o(Array.isArray(s) ? s : []) });
|
|
4293
4338
|
}
|
|
4294
|
-
function
|
|
4339
|
+
function Aa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
|
|
4295
4340
|
return Jn(l(() => ({
|
|
4296
4341
|
key: e,
|
|
4297
4342
|
source: e,
|
|
@@ -4302,7 +4347,7 @@ function wa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4302
4347
|
dataIndex: e,
|
|
4303
4348
|
key: e,
|
|
4304
4349
|
sorter: o ? !0 : void 0,
|
|
4305
|
-
render: (t, o) => /* @__PURE__ */ J(
|
|
4350
|
+
render: (t, o) => /* @__PURE__ */ J(ka, {
|
|
4306
4351
|
record: o,
|
|
4307
4352
|
source: e,
|
|
4308
4353
|
reference: n,
|
|
@@ -4323,7 +4368,7 @@ function wa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4323
4368
|
}
|
|
4324
4369
|
//#endregion
|
|
4325
4370
|
//#region src/crud/columns/ImageColumn.tsx
|
|
4326
|
-
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 = "" }) {
|
|
4327
4372
|
return Jn(l(() => ({
|
|
4328
4373
|
key: e,
|
|
4329
4374
|
source: e,
|
|
@@ -4331,7 +4376,7 @@ function Ta({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4331
4376
|
sortable: n,
|
|
4332
4377
|
buildColumn: () => ({
|
|
4333
4378
|
title: t ?? e,
|
|
4334
|
-
dataIndex: e,
|
|
4379
|
+
dataIndex: xa(e),
|
|
4335
4380
|
key: e,
|
|
4336
4381
|
sorter: n ? !0 : void 0,
|
|
4337
4382
|
render: (e) => e == null || e === "" ? null : /* @__PURE__ */ J("img", {
|
|
@@ -4358,7 +4403,7 @@ function Ta({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4358
4403
|
}
|
|
4359
4404
|
//#endregion
|
|
4360
4405
|
//#region src/crud/columns/CustomColumn.tsx
|
|
4361
|
-
function
|
|
4406
|
+
function Ma({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
4362
4407
|
return Jn(l(() => ({
|
|
4363
4408
|
key: e,
|
|
4364
4409
|
source: e,
|
|
@@ -4378,7 +4423,7 @@ function Ea({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
|
4378
4423
|
}
|
|
4379
4424
|
//#endregion
|
|
4380
4425
|
//#region src/crud/filters/NumberFilter.tsx
|
|
4381
|
-
function
|
|
4426
|
+
function Na({ source: e, label: t }) {
|
|
4382
4427
|
return rr(l(() => ({
|
|
4383
4428
|
key: e,
|
|
4384
4429
|
source: e,
|
|
@@ -4393,7 +4438,7 @@ function Da({ source: e, label: t }) {
|
|
|
4393
4438
|
}
|
|
4394
4439
|
//#endregion
|
|
4395
4440
|
//#region src/crud/filters/BooleanFilter.tsx
|
|
4396
|
-
function
|
|
4441
|
+
function Pa({ source: e, label: t }) {
|
|
4397
4442
|
return rr(l(() => ({
|
|
4398
4443
|
key: e,
|
|
4399
4444
|
source: e,
|
|
@@ -4416,7 +4461,7 @@ function Oa({ source: e, label: t }) {
|
|
|
4416
4461
|
}
|
|
4417
4462
|
//#endregion
|
|
4418
4463
|
//#region src/crud/filters/DateFilter.tsx
|
|
4419
|
-
function
|
|
4464
|
+
function Fa({ source: e, label: t }) {
|
|
4420
4465
|
return rr(l(() => ({
|
|
4421
4466
|
key: e,
|
|
4422
4467
|
source: e,
|
|
@@ -4432,7 +4477,7 @@ function ka({ source: e, label: t }) {
|
|
|
4432
4477
|
}
|
|
4433
4478
|
//#endregion
|
|
4434
4479
|
//#region src/crud/filters/SelectFilter.tsx
|
|
4435
|
-
function
|
|
4480
|
+
function Ia({ source: e, label: t, choices: n, multiple: r }) {
|
|
4436
4481
|
return rr(l(() => ({
|
|
4437
4482
|
key: e,
|
|
4438
4483
|
source: e,
|
|
@@ -4455,22 +4500,22 @@ function Aa({ source: e, label: t, choices: n, multiple: r }) {
|
|
|
4455
4500
|
}
|
|
4456
4501
|
//#endregion
|
|
4457
4502
|
//#region src/crud/filters/ReferenceFilter.tsx
|
|
4458
|
-
function
|
|
4459
|
-
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, {
|
|
4460
4505
|
lazy: c,
|
|
4461
4506
|
active: _ || !!h,
|
|
4462
4507
|
selectedValues: p,
|
|
4463
4508
|
fetchSelected: l
|
|
4464
|
-
}), S =
|
|
4509
|
+
}), S = ta(b, x), C = p;
|
|
4465
4510
|
return /* @__PURE__ */ J(B, {
|
|
4466
|
-
|
|
4511
|
+
...$i({
|
|
4467
4512
|
popupMatchSelectWidth: u,
|
|
4468
4513
|
popupMinWidth: f
|
|
4469
4514
|
}),
|
|
4470
4515
|
allowClear: !0,
|
|
4471
4516
|
mode: o ? "multiple" : void 0,
|
|
4472
4517
|
placeholder: t ?? e,
|
|
4473
|
-
value:
|
|
4518
|
+
value: na(x, C, o ? [] : void 0),
|
|
4474
4519
|
onChange: m,
|
|
4475
4520
|
options: y.map((e) => ({
|
|
4476
4521
|
label: e.label,
|
|
@@ -4478,7 +4523,7 @@ function ja({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4478
4523
|
})),
|
|
4479
4524
|
loading: S.loading,
|
|
4480
4525
|
disabled: S.disabled,
|
|
4481
|
-
notFoundContent:
|
|
4526
|
+
notFoundContent: ea(S.loading),
|
|
4482
4527
|
showSearch: s,
|
|
4483
4528
|
filterOption: s ? !1 : void 0,
|
|
4484
4529
|
onSearch: s ? g : void 0,
|
|
@@ -4489,12 +4534,12 @@ function ja({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4489
4534
|
style: { minWidth: 180 }
|
|
4490
4535
|
});
|
|
4491
4536
|
}
|
|
4492
|
-
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 }) {
|
|
4493
4538
|
return rr(l(() => ({
|
|
4494
4539
|
key: e,
|
|
4495
4540
|
source: e,
|
|
4496
4541
|
label: t,
|
|
4497
|
-
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(
|
|
4542
|
+
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(La, {
|
|
4498
4543
|
source: e,
|
|
4499
4544
|
label: t,
|
|
4500
4545
|
reference: n,
|
|
@@ -4525,11 +4570,11 @@ function Ma({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4525
4570
|
f
|
|
4526
4571
|
])), null;
|
|
4527
4572
|
}
|
|
4528
|
-
function
|
|
4529
|
-
return /* @__PURE__ */ J(
|
|
4573
|
+
function za(e) {
|
|
4574
|
+
return /* @__PURE__ */ J(Ra, {
|
|
4530
4575
|
...e,
|
|
4531
4576
|
multiple: !0
|
|
4532
4577
|
});
|
|
4533
4578
|
}
|
|
4534
4579
|
//#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,
|
|
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 };
|