ding-react-admin 2.2.2 → 2.3.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
CHANGED
|
@@ -1832,7 +1832,10 @@ function Dr(e, t = !0) {
|
|
|
1832
1832
|
}
|
|
1833
1833
|
//#endregion
|
|
1834
1834
|
//#region src/crud/utils/toFormData.ts
|
|
1835
|
-
function Or(e, t
|
|
1835
|
+
function Or(e, t) {
|
|
1836
|
+
return /\[[0-9]+\]$/.test(e) ? `${e}${t}` : `${e}.${t}`;
|
|
1837
|
+
}
|
|
1838
|
+
function kr(e, t, n, r) {
|
|
1836
1839
|
if (n !== void 0) {
|
|
1837
1840
|
if (n === null) {
|
|
1838
1841
|
e.append(t, "");
|
|
@@ -1853,80 +1856,80 @@ function Or(e, t, n, r) {
|
|
|
1853
1856
|
}
|
|
1854
1857
|
if (Array.isArray(n)) {
|
|
1855
1858
|
n.forEach((n, i) => {
|
|
1856
|
-
|
|
1859
|
+
kr(e, `${t}[${i}]`, n, r);
|
|
1857
1860
|
});
|
|
1858
1861
|
return;
|
|
1859
1862
|
}
|
|
1860
1863
|
if (typeof n == "object") {
|
|
1861
|
-
for (let [i, a] of Object.entries(n))
|
|
1864
|
+
for (let [i, a] of Object.entries(n)) kr(e, Or(t, i), a, r);
|
|
1862
1865
|
return;
|
|
1863
1866
|
}
|
|
1864
1867
|
e.append(t, String(n));
|
|
1865
1868
|
}
|
|
1866
1869
|
}
|
|
1867
|
-
function
|
|
1870
|
+
function Ar(e, t) {
|
|
1868
1871
|
let n = { skipExistingUploadUrls: t?.skipExistingUploadUrls ?? !0 }, r = new FormData();
|
|
1869
|
-
for (let [t, i] of Object.entries(e))
|
|
1872
|
+
for (let [t, i] of Object.entries(e)) kr(r, t, i, n);
|
|
1870
1873
|
return r;
|
|
1871
1874
|
}
|
|
1872
1875
|
//#endregion
|
|
1873
1876
|
//#region src/crud/utils/prepareFormSubmitBody.ts
|
|
1874
|
-
function
|
|
1877
|
+
function jr(e, t) {
|
|
1875
1878
|
let n = t?.skipExistingUploadUrls ?? !0;
|
|
1876
|
-
return wr(e) ?
|
|
1879
|
+
return wr(e) ? Ar(e, t) : Dr(e, n);
|
|
1877
1880
|
}
|
|
1878
1881
|
//#endregion
|
|
1879
1882
|
//#region src/crud/utils/buildResourceFormSubmitBody.ts
|
|
1880
|
-
function
|
|
1883
|
+
function Mr(e, t, n, r) {
|
|
1881
1884
|
let i = Sr(e, t);
|
|
1882
1885
|
if (n) for (let t of n) {
|
|
1883
1886
|
let n = e[t.field], r = t.payloadKey ?? t.field;
|
|
1884
1887
|
i[r] = Cr(n, t.sources, { transformRows: t.transformRows });
|
|
1885
1888
|
}
|
|
1886
|
-
return
|
|
1889
|
+
return jr(i, r);
|
|
1887
1890
|
}
|
|
1888
1891
|
//#endregion
|
|
1889
1892
|
//#region src/crud/utils/formErrors.ts
|
|
1890
|
-
function
|
|
1893
|
+
function Nr(e) {
|
|
1891
1894
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
1892
1895
|
}
|
|
1893
|
-
function
|
|
1896
|
+
function Pr(e) {
|
|
1894
1897
|
return Array.isArray(e) ? e.join(", ") : e;
|
|
1895
1898
|
}
|
|
1896
|
-
function
|
|
1899
|
+
function Fr(e, t, n) {
|
|
1897
1900
|
if (t.has(e)) return !0;
|
|
1898
1901
|
let r = e.match(/^([^.]+)\.(\d+)\.([^.]+)$/);
|
|
1899
1902
|
if (!r) return !1;
|
|
1900
1903
|
let [, i, , a] = r;
|
|
1901
1904
|
return n.get(i)?.sources.includes(a) ?? !1;
|
|
1902
1905
|
}
|
|
1903
|
-
function
|
|
1904
|
-
let r = {}, i = [...
|
|
1905
|
-
for (let [a, o] of Object.entries(e.fields ?? {}))
|
|
1906
|
+
function Ir(e, t, n) {
|
|
1907
|
+
let r = {}, i = [...Nr(e.global)];
|
|
1908
|
+
for (let [a, o] of Object.entries(e.fields ?? {})) Fr(a, t, n) ? r[a] = o : i.push(Pr(o));
|
|
1906
1909
|
return {
|
|
1907
1910
|
fieldErrors: r,
|
|
1908
1911
|
globalErrors: i
|
|
1909
1912
|
};
|
|
1910
1913
|
}
|
|
1911
|
-
function
|
|
1914
|
+
function Lr(e, t) {
|
|
1912
1915
|
for (let [n, r] of Object.entries(t)) e.setError(n, {
|
|
1913
1916
|
type: "server",
|
|
1914
|
-
message:
|
|
1917
|
+
message: Pr(r)
|
|
1915
1918
|
});
|
|
1916
1919
|
}
|
|
1917
|
-
function
|
|
1920
|
+
function Rr(e) {
|
|
1918
1921
|
let t = ln(e);
|
|
1919
1922
|
if (t && !/application\/json/i.test(t)) return `non-JSON response (Content-Type: ${t})`;
|
|
1920
1923
|
}
|
|
1921
|
-
async function
|
|
1924
|
+
async function zr(e, t, n, r, i) {
|
|
1922
1925
|
let a = await fn(n);
|
|
1923
1926
|
if (a != null) {
|
|
1924
1927
|
let n = e.parseFormError?.({ body: a }, r);
|
|
1925
1928
|
if (n) {
|
|
1926
1929
|
let e = new Set(i.payloadFields), r = /* @__PURE__ */ new Map();
|
|
1927
1930
|
for (let e of i.inlineRegistry) r.set(e.field, e);
|
|
1928
|
-
let { fieldErrors: a, globalErrors: o } =
|
|
1929
|
-
if (Object.keys(a).length || o.length) return
|
|
1931
|
+
let { fieldErrors: a, globalErrors: o } = Ir(n, e, r);
|
|
1932
|
+
if (Object.keys(a).length || o.length) return Lr(t, a), {
|
|
1930
1933
|
handled: !0,
|
|
1931
1934
|
globalErrors: o
|
|
1932
1935
|
};
|
|
@@ -1941,12 +1944,12 @@ async function Rr(e, t, n, r, i) {
|
|
|
1941
1944
|
globalErrors: []
|
|
1942
1945
|
} : {
|
|
1943
1946
|
handled: !0,
|
|
1944
|
-
globalErrors: [sn(null, { hint:
|
|
1947
|
+
globalErrors: [sn(null, { hint: Rr(n) })]
|
|
1945
1948
|
};
|
|
1946
1949
|
}
|
|
1947
1950
|
//#endregion
|
|
1948
1951
|
//#region src/crud/utils/useAbortableEffect.ts
|
|
1949
|
-
function
|
|
1952
|
+
function Br(e, t) {
|
|
1950
1953
|
s(() => {
|
|
1951
1954
|
let t = new AbortController();
|
|
1952
1955
|
return e(t.signal), () => t.abort();
|
|
@@ -1954,7 +1957,7 @@ function zr(e, t) {
|
|
|
1954
1957
|
}
|
|
1955
1958
|
//#endregion
|
|
1956
1959
|
//#region src/crud/utils/useFormRecord.ts
|
|
1957
|
-
function
|
|
1960
|
+
function Vr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultValues: s, enabled: c = !0 }) {
|
|
1958
1961
|
let [l, u] = d(!r), [f, p] = d(0), m = a(async (a) => {
|
|
1959
1962
|
if (r || !n) {
|
|
1960
1963
|
s ? i.reset({ ...s }) : i.reset({}), u(!1);
|
|
@@ -1979,20 +1982,20 @@ function Br({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultV
|
|
|
1979
1982
|
o,
|
|
1980
1983
|
s
|
|
1981
1984
|
]);
|
|
1982
|
-
return
|
|
1985
|
+
return Br((e) => {
|
|
1983
1986
|
if (c) return m(e);
|
|
1984
1987
|
}, [c, m]), {
|
|
1985
1988
|
loading: l,
|
|
1986
1989
|
formVersion: f
|
|
1987
1990
|
};
|
|
1988
1991
|
}
|
|
1989
|
-
function
|
|
1992
|
+
function Hr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadFieldsRef: s, inlineRegistryRef: c, setGlobalErrors: l, onSuccess: u }) {
|
|
1990
1993
|
let [f, p] = d(!1);
|
|
1991
1994
|
return {
|
|
1992
1995
|
onSubmit: a(async (a) => {
|
|
1993
1996
|
l([]), p(!0);
|
|
1994
1997
|
try {
|
|
1995
|
-
let i =
|
|
1998
|
+
let i = Mr(a, Array.from(s.current), c.current.values()), l;
|
|
1996
1999
|
if (r) l = (await e.create(t, i)).data, o.success("Created");
|
|
1997
2000
|
else if (n) l = (await e.update(t, {
|
|
1998
2001
|
id: n,
|
|
@@ -2001,7 +2004,7 @@ function Vr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
2001
2004
|
else return;
|
|
2002
2005
|
u?.(l);
|
|
2003
2006
|
} catch (n) {
|
|
2004
|
-
let { handled: a, globalErrors: u } = await
|
|
2007
|
+
let { handled: a, globalErrors: u } = await zr(e, i, n, {
|
|
2005
2008
|
resource: t,
|
|
2006
2009
|
mutation: r ? "create" : "update",
|
|
2007
2010
|
inlineFieldPaths: Array.from(c.current.keys())
|
|
@@ -2030,8 +2033,8 @@ function Vr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
2030
2033
|
}
|
|
2031
2034
|
//#endregion
|
|
2032
2035
|
//#region src/crud/ResourceRecordForm.tsx
|
|
2033
|
-
function
|
|
2034
|
-
let m = t === "new" || !t, h = m ? void 0 : t, g = Yt(), { message: _ } = S.useApp(), v = u(/* @__PURE__ */ new Set()), y = u(/* @__PURE__ */ new Map()), [b, x] = d([]), C = Ae({ defaultValues: i }), { loading: T, formVersion: E } =
|
|
2036
|
+
function Ur({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0, canSave: o = !0, onCancel: s, cancelHref: c, onSuccess: l, loadingMode: p = "overlay" }) {
|
|
2037
|
+
let m = t === "new" || !t, h = m ? void 0 : t, g = Yt(), { message: _ } = S.useApp(), v = u(/* @__PURE__ */ new Set()), y = u(/* @__PURE__ */ new Map()), [b, x] = d([]), C = Ae({ defaultValues: i }), { loading: T, formVersion: E } = Vr({
|
|
2035
2038
|
dp: g,
|
|
2036
2039
|
resource: e,
|
|
2037
2040
|
id: h,
|
|
@@ -2040,7 +2043,7 @@ function Hr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2040
2043
|
message: _,
|
|
2041
2044
|
defaultValues: i,
|
|
2042
2045
|
enabled: a
|
|
2043
|
-
}), { onSubmit: D, saving: O } =
|
|
2046
|
+
}), { onSubmit: D, saving: O } = Hr({
|
|
2044
2047
|
dp: g,
|
|
2045
2048
|
resource: e,
|
|
2046
2049
|
id: h,
|
|
@@ -2117,7 +2120,7 @@ function Hr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2117
2120
|
}
|
|
2118
2121
|
//#endregion
|
|
2119
2122
|
//#region src/crud/ResourceFormModal.tsx
|
|
2120
|
-
function
|
|
2123
|
+
function Wr({ resource: e, editId: t, onClose: n, children: r, title: i, permissions: a, defaultValues: o, width: s = 560, onSuccess: c }) {
|
|
2121
2124
|
let l = t === "new", u = t != null, d = mt(), f = i ?? (l ? `New ${e}` : `Edit ${e}`), p = a ? Z(d, a, l ? "add" : "change") : !0;
|
|
2122
2125
|
return /* @__PURE__ */ J(te, {
|
|
2123
2126
|
open: u,
|
|
@@ -2127,7 +2130,7 @@ function Ur({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
2127
2130
|
destroyOnHidden: !0,
|
|
2128
2131
|
width: s,
|
|
2129
2132
|
maskClosable: !1,
|
|
2130
|
-
children: /* @__PURE__ */ J(S, { children: /* @__PURE__ */ J(
|
|
2133
|
+
children: /* @__PURE__ */ J(S, { children: /* @__PURE__ */ J(Ur, {
|
|
2131
2134
|
resource: e,
|
|
2132
2135
|
id: t ?? void 0,
|
|
2133
2136
|
enabled: u,
|
|
@@ -2144,7 +2147,7 @@ function Ur({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
2144
2147
|
}
|
|
2145
2148
|
//#endregion
|
|
2146
2149
|
//#region src/crud/ListActionsBar.tsx
|
|
2147
|
-
function
|
|
2150
|
+
function Gr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelected: r, onSelectAllMatching: i, onClearSelection: o, actions: s, onExecute: c, selectedIds: u, running: f = !1 }) {
|
|
2148
2151
|
let [p, m] = d(), h = l(() => s.map((e) => ({
|
|
2149
2152
|
value: e.key,
|
|
2150
2153
|
label: e.label
|
|
@@ -2228,14 +2231,14 @@ function Wr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2228
2231
|
}
|
|
2229
2232
|
//#endregion
|
|
2230
2233
|
//#region src/crud/types.ts
|
|
2231
|
-
var
|
|
2234
|
+
var Kr = new Set([
|
|
2232
2235
|
"page",
|
|
2233
2236
|
"perPage",
|
|
2234
2237
|
"sort",
|
|
2235
2238
|
"create",
|
|
2236
2239
|
"edit"
|
|
2237
|
-
]),
|
|
2238
|
-
function
|
|
2240
|
+
]), qr = 1, Jr = 10;
|
|
2241
|
+
function Yr(e) {
|
|
2239
2242
|
if (e.includes(",")) {
|
|
2240
2243
|
let t = e.split(",").map((e) => e.trim()), n = t.map(Number);
|
|
2241
2244
|
return n.every((e) => Number.isFinite(e)) ? n : t;
|
|
@@ -2243,16 +2246,16 @@ function Jr(e) {
|
|
|
2243
2246
|
let t = Number(e);
|
|
2244
2247
|
return e !== "" && Number.isFinite(t) && String(t) === e ? t : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
2245
2248
|
}
|
|
2246
|
-
function
|
|
2249
|
+
function Xr(e) {
|
|
2247
2250
|
return e == null || e === "" ? null : Array.isArray(e) ? e.length === 0 ? null : e.map(String).join(",") : String(e);
|
|
2248
2251
|
}
|
|
2249
|
-
function
|
|
2252
|
+
function Zr(e) {
|
|
2250
2253
|
let [t, n] = b(), r = l(() => {
|
|
2251
|
-
let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) ||
|
|
2254
|
+
let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) || qr) : qr, a = r ? Math.max(1, Number(r) || Jr) : Jr, o = t.getAll("sort"), s = o.length > 0 ? o.flatMap((e) => Hn(e)) : Hn(t.get("sort")), c = { ...e };
|
|
2252
2255
|
return t.forEach((e, n) => {
|
|
2253
|
-
if (
|
|
2256
|
+
if (Kr.has(n)) return;
|
|
2254
2257
|
let r = c[n];
|
|
2255
|
-
r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(
|
|
2258
|
+
r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(Yr) : c[n] = Yr(e) : c[n] = [...Array.isArray(r) ? r : [r], Yr(e)];
|
|
2256
2259
|
}), {
|
|
2257
2260
|
page: i,
|
|
2258
2261
|
perPage: a,
|
|
@@ -2275,7 +2278,7 @@ function Xr(e) {
|
|
|
2275
2278
|
},
|
|
2276
2279
|
setPerPage: (e) => {
|
|
2277
2280
|
i((t) => {
|
|
2278
|
-
e ===
|
|
2281
|
+
e === Jr ? t.delete("perPage") : t.set("perPage", String(e)), t.delete("page");
|
|
2279
2282
|
});
|
|
2280
2283
|
},
|
|
2281
2284
|
setSort: (e) => {
|
|
@@ -2302,15 +2305,15 @@ function Xr(e) {
|
|
|
2302
2305
|
setFilter: (e, t) => {
|
|
2303
2306
|
i((n) => {
|
|
2304
2307
|
n.delete(e);
|
|
2305
|
-
let r =
|
|
2308
|
+
let r = Xr(t);
|
|
2306
2309
|
r != null && n.set(e, r), n.delete("page");
|
|
2307
2310
|
});
|
|
2308
2311
|
},
|
|
2309
2312
|
setFilters: (e) => {
|
|
2310
2313
|
i((t) => {
|
|
2311
|
-
for (let e of [...t.keys()])
|
|
2314
|
+
for (let e of [...t.keys()]) Kr.has(e) || t.delete(e);
|
|
2312
2315
|
for (let [n, r] of Object.entries(e)) {
|
|
2313
|
-
let e =
|
|
2316
|
+
let e = Xr(r);
|
|
2314
2317
|
e != null && t.set(n, e);
|
|
2315
2318
|
}
|
|
2316
2319
|
t.delete("page");
|
|
@@ -2335,20 +2338,20 @@ function Xr(e) {
|
|
|
2335
2338
|
}
|
|
2336
2339
|
//#endregion
|
|
2337
2340
|
//#region src/crud/ResourceList.tsx
|
|
2338
|
-
var
|
|
2339
|
-
function
|
|
2340
|
-
return o(
|
|
2341
|
+
var Qr = t(null);
|
|
2342
|
+
function $r() {
|
|
2343
|
+
return o(Qr);
|
|
2341
2344
|
}
|
|
2342
|
-
function
|
|
2345
|
+
function ei(e) {
|
|
2343
2346
|
return e == null || e === "" ? "—" : String(e);
|
|
2344
2347
|
}
|
|
2345
|
-
function
|
|
2348
|
+
function ti(e, t) {
|
|
2346
2349
|
if (e.length === 0 || !t.showEdit && !t.showQuickEdit) return e;
|
|
2347
2350
|
let [n, ...r] = e, i = n.render;
|
|
2348
2351
|
return [{
|
|
2349
2352
|
...n,
|
|
2350
2353
|
render: (e, n, r) => {
|
|
2351
|
-
let a = i ? i(e, n, r) :
|
|
2354
|
+
let a = i ? i(e, n, r) : ei(e);
|
|
2352
2355
|
return t.showEdit ? /* @__PURE__ */ J(f, {
|
|
2353
2356
|
to: `${t.pathPrefix}/${String(n.id)}`,
|
|
2354
2357
|
className: "ding-admin-row-edit-link",
|
|
@@ -2368,7 +2371,7 @@ function ei(e, t) {
|
|
|
2368
2371
|
}
|
|
2369
2372
|
}, ...r];
|
|
2370
2373
|
}
|
|
2371
|
-
function
|
|
2374
|
+
function ni({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "page", formChildren: o, actions: s, rowActions: p, headerExtra: m, bulkActions: h, bulkDelete: g = !0, bulkActionsEnabled: _ = !0, permissions: v, queryState: y, queryActions: b }) {
|
|
2372
2375
|
let x = Yt(), C = mt(), { message: E, modal: D } = S.useApp(), { token: O } = K.useToken(), { columns: k, sortOrders: A, sortPriorities: j } = qn(), M = u(null), [N, P] = d(), [F, I] = d(!1), [L, ee] = d([]), [R, te] = d(0), [re, z] = d(() => /* @__PURE__ */ new Set()), [ie, B] = d(!1), ae = r ?? `${n}/new`, H = Z(C, v, "add"), oe = Z(C, v, "change"), U = Z(C, v, "delete"), ce = oe && (i === "page" || i === "both") && s?.edit !== !1, W = oe && (i === "modal" || i === "both") && s?.quickEdit !== !1, le = U && s?.delete !== !1, ue = ce || W || le || p, pe = a(() => {
|
|
2373
2376
|
z(/* @__PURE__ */ new Set());
|
|
2374
2377
|
}, []), me = l(() => {
|
|
@@ -2496,7 +2499,7 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2496
2499
|
Ce,
|
|
2497
2500
|
E
|
|
2498
2501
|
]);
|
|
2499
|
-
|
|
2502
|
+
Br((e) => X(e), [X]);
|
|
2500
2503
|
let we = l(() => ({
|
|
2501
2504
|
reload: () => void X(),
|
|
2502
2505
|
clearSelection: pe
|
|
@@ -2568,7 +2571,7 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2568
2571
|
}
|
|
2569
2572
|
return t;
|
|
2570
2573
|
});
|
|
2571
|
-
if (!ue) return
|
|
2574
|
+
if (!ue) return ti(e, {
|
|
2572
2575
|
showEdit: ce,
|
|
2573
2576
|
showQuickEdit: W,
|
|
2574
2577
|
pathPrefix: n,
|
|
@@ -2608,7 +2611,7 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2608
2611
|
]
|
|
2609
2612
|
})
|
|
2610
2613
|
};
|
|
2611
|
-
return
|
|
2614
|
+
return ti([...e, r], {
|
|
2612
2615
|
showEdit: ce,
|
|
2613
2616
|
showQuickEdit: W,
|
|
2614
2617
|
pathPrefix: n,
|
|
@@ -2659,7 +2662,7 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2659
2662
|
children: "New"
|
|
2660
2663
|
})
|
|
2661
2664
|
}) : null] }) : null,
|
|
2662
|
-
children: [he ? /* @__PURE__ */ J(
|
|
2665
|
+
children: [he ? /* @__PURE__ */ J(Gr, {
|
|
2663
2666
|
selectedCount: ge,
|
|
2664
2667
|
total: R,
|
|
2665
2668
|
allPageSelected: _e,
|
|
@@ -2706,7 +2709,7 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2706
2709
|
})
|
|
2707
2710
|
})]
|
|
2708
2711
|
})]
|
|
2709
|
-
}), ke ? /* @__PURE__ */ J(
|
|
2712
|
+
}), ke ? /* @__PURE__ */ J(Wr, {
|
|
2710
2713
|
resource: e,
|
|
2711
2714
|
editId: y.createModal ? "new" : y.editId,
|
|
2712
2715
|
onClose: () => {
|
|
@@ -2715,8 +2718,8 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2715
2718
|
children: o
|
|
2716
2719
|
}) : null] });
|
|
2717
2720
|
}
|
|
2718
|
-
function
|
|
2719
|
-
let [y, b] =
|
|
2721
|
+
function ri({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i, textFilterDebounceMs: o, editMode: s = "page", syncQueryParams: c = !0, children: u, formChildren: d, actions: f, rowActions: p, headerExtra: m, bulkActions: h, bulkDelete: g, bulkActionsEnabled: _, permissions: v }) {
|
|
2722
|
+
let [y, b] = Zr(i), x = l(() => {
|
|
2720
2723
|
if (!c) return i ?? {};
|
|
2721
2724
|
let e = {};
|
|
2722
2725
|
for (let [t, n] of Object.entries(y.filter)) i && t in i || (e[t] = n);
|
|
@@ -2731,7 +2734,7 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2731
2734
|
filterValues: x,
|
|
2732
2735
|
setFilterValue: S
|
|
2733
2736
|
}), [x, S]);
|
|
2734
|
-
return /* @__PURE__ */ J(
|
|
2737
|
+
return /* @__PURE__ */ J(Qr.Provider, {
|
|
2735
2738
|
value: C,
|
|
2736
2739
|
children: /* @__PURE__ */ J(tr, {
|
|
2737
2740
|
values: x,
|
|
@@ -2742,7 +2745,7 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2742
2745
|
sort: y.sort,
|
|
2743
2746
|
children: /* @__PURE__ */ Y("div", {
|
|
2744
2747
|
className: "ding-admin-resource-list-root",
|
|
2745
|
-
children: [u, /* @__PURE__ */ J(
|
|
2748
|
+
children: [u, /* @__PURE__ */ J(ni, {
|
|
2746
2749
|
resource: e,
|
|
2747
2750
|
title: t,
|
|
2748
2751
|
pathPrefix: n,
|
|
@@ -2766,7 +2769,7 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2766
2769
|
}
|
|
2767
2770
|
//#endregion
|
|
2768
2771
|
//#region src/crud/FilterBar.tsx
|
|
2769
|
-
function
|
|
2772
|
+
function ii() {
|
|
2770
2773
|
let e = nr();
|
|
2771
2774
|
return !e || e.filters.length === 0 ? null : /* @__PURE__ */ J(V, {
|
|
2772
2775
|
wrap: !0,
|
|
@@ -2786,12 +2789,12 @@ function ri() {
|
|
|
2786
2789
|
}, t.key))
|
|
2787
2790
|
});
|
|
2788
2791
|
}
|
|
2789
|
-
function
|
|
2790
|
-
return /* @__PURE__ */ Y(q, { children: [e, /* @__PURE__ */ J(
|
|
2792
|
+
function ai({ children: e }) {
|
|
2793
|
+
return /* @__PURE__ */ Y(q, { children: [e, /* @__PURE__ */ J(ii, {})] });
|
|
2791
2794
|
}
|
|
2792
2795
|
//#endregion
|
|
2793
2796
|
//#region src/crud/ResourceForm.tsx
|
|
2794
|
-
function
|
|
2797
|
+
function oi({ resource: e, title: t, listPath: n, children: r, defaultValues: i, onSaved: a, stayOnPage: o, permissions: c }) {
|
|
2795
2798
|
let { id: l } = y(), u = l === "new" || !l, d = mt(), p = v(), { token: m } = K.useToken();
|
|
2796
2799
|
s(() => {
|
|
2797
2800
|
c && (Z(d, c, u ? "add" : "change") || p(n, { replace: !0 }));
|
|
@@ -2813,7 +2816,7 @@ function ai({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2813
2816
|
style: { margin: 0 },
|
|
2814
2817
|
children: t
|
|
2815
2818
|
})] }),
|
|
2816
|
-
children: /* @__PURE__ */ J(
|
|
2819
|
+
children: /* @__PURE__ */ J(Ur, {
|
|
2817
2820
|
resource: e,
|
|
2818
2821
|
id: l,
|
|
2819
2822
|
defaultValues: i,
|
|
@@ -2829,17 +2832,17 @@ function ai({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2829
2832
|
}
|
|
2830
2833
|
//#endregion
|
|
2831
2834
|
//#region src/crud/utils/nestedFieldPath.ts
|
|
2832
|
-
function
|
|
2835
|
+
function si(e, t, n) {
|
|
2833
2836
|
return `${e}.${t}.${n}`;
|
|
2834
2837
|
}
|
|
2835
2838
|
//#endregion
|
|
2836
2839
|
//#region src/crud/InlineFormSet.tsx
|
|
2837
|
-
function
|
|
2840
|
+
function ci(e, t) {
|
|
2838
2841
|
let n = {};
|
|
2839
2842
|
for (let r of e) n[r] = t?.[r] ?? void 0;
|
|
2840
2843
|
return n;
|
|
2841
2844
|
}
|
|
2842
|
-
function
|
|
2845
|
+
function li(e, t, n) {
|
|
2843
2846
|
let { control: r } = je(), { fields: i, append: a, remove: o } = ke({
|
|
2844
2847
|
control: r,
|
|
2845
2848
|
name: e,
|
|
@@ -2848,11 +2851,11 @@ function ci(e, t, n) {
|
|
|
2848
2851
|
return {
|
|
2849
2852
|
fields: i,
|
|
2850
2853
|
remove: o,
|
|
2851
|
-
appendEmpty: () => a(
|
|
2854
|
+
appendEmpty: () => a(ci(t, n))
|
|
2852
2855
|
};
|
|
2853
2856
|
}
|
|
2854
|
-
function
|
|
2855
|
-
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } =
|
|
2857
|
+
function ui({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, defaultRow: a }) {
|
|
2858
|
+
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } = li(e, o, a);
|
|
2856
2859
|
pr(e), vr(e, o, n, r);
|
|
2857
2860
|
let d = l(() => i.map((t) => ({
|
|
2858
2861
|
title: t.label ?? t.source,
|
|
@@ -2861,7 +2864,7 @@ function li({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2861
2864
|
onHeaderCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2862
2865
|
onCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2863
2866
|
render: (n, r, i) => t.cell({
|
|
2864
|
-
name:
|
|
2867
|
+
name: si(e, i, t.source),
|
|
2865
2868
|
index: i,
|
|
2866
2869
|
field: e
|
|
2867
2870
|
})
|
|
@@ -2903,8 +2906,8 @@ function li({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2903
2906
|
]
|
|
2904
2907
|
});
|
|
2905
2908
|
}
|
|
2906
|
-
function
|
|
2907
|
-
let { fields: l, remove: u, appendEmpty: d } =
|
|
2909
|
+
function di({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, renderRow: a, getCardTitle: o, footer: s, defaultRow: c }) {
|
|
2910
|
+
let { fields: l, remove: u, appendEmpty: d } = li(e, i, c);
|
|
2908
2911
|
return pr(e), vr(e, i, n, r), /* @__PURE__ */ Y("div", {
|
|
2909
2912
|
style: { marginTop: 24 },
|
|
2910
2913
|
children: [
|
|
@@ -2920,7 +2923,7 @@ function ui({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2920
2923
|
let r = {
|
|
2921
2924
|
field: e,
|
|
2922
2925
|
index: n,
|
|
2923
|
-
name: (t) =>
|
|
2926
|
+
name: (t) => si(e, n, t)
|
|
2924
2927
|
};
|
|
2925
2928
|
return /* @__PURE__ */ J(T, {
|
|
2926
2929
|
size: "small",
|
|
@@ -2948,22 +2951,22 @@ function ui({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2948
2951
|
}
|
|
2949
2952
|
//#endregion
|
|
2950
2953
|
//#region src/crud/utils/formSectionErrors.ts
|
|
2951
|
-
function
|
|
2954
|
+
function fi(e, t, n) {
|
|
2952
2955
|
for (let r of e) if (t(r, n).invalid) return !0;
|
|
2953
2956
|
return !1;
|
|
2954
2957
|
}
|
|
2955
|
-
function
|
|
2958
|
+
function pi(e) {
|
|
2956
2959
|
let t = u([]);
|
|
2957
2960
|
for (; t.current.length < e;) t.current.push({ current: /* @__PURE__ */ new Set() });
|
|
2958
2961
|
return t.current.length > e && (t.current.length = e), t.current;
|
|
2959
2962
|
}
|
|
2960
|
-
function
|
|
2963
|
+
function mi(e, t) {
|
|
2961
2964
|
let { control: n, getFieldState: r, setFocus: i } = je(), a = Me({ control: n }), o = u(0), c = u(0);
|
|
2962
2965
|
s(() => {
|
|
2963
2966
|
if (a.submitCount === 0) return;
|
|
2964
2967
|
let n = Object.keys(a.errors).length, s = a.submitCount !== o.current, l = !s && n > 0 && c.current === 0;
|
|
2965
2968
|
if (o.current = a.submitCount, c.current = n, !s && !l || n === 0) return;
|
|
2966
|
-
let u = e.findIndex((e) =>
|
|
2969
|
+
let u = e.findIndex((e) => fi(e.current, r, a));
|
|
2967
2970
|
if (u < 0) return;
|
|
2968
2971
|
t(u);
|
|
2969
2972
|
let d = [...e[u].current].find((e) => r(e, a).invalid);
|
|
@@ -2982,22 +2985,22 @@ function pi(e, t) {
|
|
|
2982
2985
|
}
|
|
2983
2986
|
//#endregion
|
|
2984
2987
|
//#region src/crud/FormTabs.tsx
|
|
2985
|
-
function
|
|
2988
|
+
function hi(e) {
|
|
2986
2989
|
return null;
|
|
2987
2990
|
}
|
|
2988
|
-
function
|
|
2989
|
-
return i(e) && e.type ===
|
|
2991
|
+
function gi(e) {
|
|
2992
|
+
return i(e) && e.type === hi;
|
|
2990
2993
|
}
|
|
2991
|
-
function
|
|
2992
|
-
let { token: s } = K.useToken(), c = l(() => e.toArray(t).filter(
|
|
2994
|
+
function _i({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o }) {
|
|
2995
|
+
let { token: s } = K.useToken(), c = l(() => e.toArray(t).filter(gi).map((e, t) => ({
|
|
2993
2996
|
key: e.key ?? String(t),
|
|
2994
2997
|
label: e.props.label,
|
|
2995
2998
|
disabled: e.props.disabled,
|
|
2996
2999
|
children: e.props.children
|
|
2997
|
-
})), [t]), u =
|
|
3000
|
+
})), [t]), u = pi(c.length), f = r !== void 0, [p, m] = d(() => n ?? c[0]?.key ?? "0"), h = f ? r : p, g = a((e) => {
|
|
2998
3001
|
f || m(e), i?.(e);
|
|
2999
3002
|
}, [f, i]);
|
|
3000
|
-
|
|
3003
|
+
mi(u, a((e) => {
|
|
3001
3004
|
let t = c[e]?.key;
|
|
3002
3005
|
t != null && g(t);
|
|
3003
3006
|
}, [g, c]));
|
|
@@ -3005,7 +3008,7 @@ function gi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
3005
3008
|
return /* @__PURE__ */ J(U, {
|
|
3006
3009
|
destroyOnHidden: !1,
|
|
3007
3010
|
items: l(() => c.map((e, t) => {
|
|
3008
|
-
let n =
|
|
3011
|
+
let n = fi(u[t].current, v, y);
|
|
3009
3012
|
return {
|
|
3010
3013
|
key: e.key,
|
|
3011
3014
|
label: n ? /* @__PURE__ */ J("span", {
|
|
@@ -3032,17 +3035,17 @@ function gi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
3032
3035
|
}
|
|
3033
3036
|
//#endregion
|
|
3034
3037
|
//#region src/crud/FormSteps.tsx
|
|
3035
|
-
function
|
|
3038
|
+
function vi(e) {
|
|
3036
3039
|
return null;
|
|
3037
3040
|
}
|
|
3038
|
-
function
|
|
3039
|
-
return i(e) && e.type ===
|
|
3041
|
+
function yi(e) {
|
|
3042
|
+
return i(e) && e.type === vi;
|
|
3040
3043
|
}
|
|
3041
|
-
function
|
|
3042
|
-
let m = l(() => e.toArray(t).filter(
|
|
3043
|
-
|
|
3044
|
+
function bi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStepSelect: i = !1, stepsStyle: o, navigationStyle: s, size: c, direction: u, type: f, status: p }) {
|
|
3045
|
+
let m = l(() => e.toArray(t).filter(yi), [t]), h = pi(m.length), [g, _] = d(n), v = m.length - 1;
|
|
3046
|
+
mi(h, _);
|
|
3044
3047
|
let { control: y, getFieldState: b } = je(), x = Me({ control: y }), S = l(() => m.map((e, t) => {
|
|
3045
|
-
let n =
|
|
3048
|
+
let n = fi(h[t].current, b, x);
|
|
3046
3049
|
return {
|
|
3047
3050
|
title: e.props.title,
|
|
3048
3051
|
description: e.props.description,
|
|
@@ -3124,7 +3127,7 @@ function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3124
3127
|
}
|
|
3125
3128
|
//#endregion
|
|
3126
3129
|
//#region src/crud/fields/TextField.tsx
|
|
3127
|
-
function
|
|
3130
|
+
function xi({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s }) {
|
|
3128
3131
|
return /* @__PURE__ */ J($, {
|
|
3129
3132
|
source: e,
|
|
3130
3133
|
name: t,
|
|
@@ -3144,7 +3147,7 @@ function bi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3144
3147
|
}
|
|
3145
3148
|
//#endregion
|
|
3146
3149
|
//#region src/crud/fields/TextAreaField.tsx
|
|
3147
|
-
function
|
|
3150
|
+
function Si({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s, rows: c = 4, maxLength: l, showCount: u, autoSize: d }) {
|
|
3148
3151
|
return /* @__PURE__ */ J($, {
|
|
3149
3152
|
source: e,
|
|
3150
3153
|
name: t,
|
|
@@ -3168,7 +3171,7 @@ function xi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3168
3171
|
}
|
|
3169
3172
|
//#endregion
|
|
3170
3173
|
//#region src/crud/fields/NumberField.tsx
|
|
3171
|
-
function
|
|
3174
|
+
function Ci({ source: e, name: t, label: n, required: r, rules: i, min: a, max: o, step: s, inputStyle: c, hideLabel: l }) {
|
|
3172
3175
|
return /* @__PURE__ */ J($, {
|
|
3173
3176
|
source: e,
|
|
3174
3177
|
name: t,
|
|
@@ -3193,7 +3196,7 @@ function Si({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3193
3196
|
}
|
|
3194
3197
|
//#endregion
|
|
3195
3198
|
//#region src/crud/fields/BooleanField.tsx
|
|
3196
|
-
function
|
|
3199
|
+
function wi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, disabled: o }) {
|
|
3197
3200
|
return /* @__PURE__ */ J($, {
|
|
3198
3201
|
source: e,
|
|
3199
3202
|
name: t,
|
|
@@ -3210,7 +3213,7 @@ function Ci({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3210
3213
|
}
|
|
3211
3214
|
//#endregion
|
|
3212
3215
|
//#region src/crud/utils/parseDayjsValue.ts
|
|
3213
|
-
var
|
|
3216
|
+
var Ti = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
3214
3217
|
(function(n, r) {
|
|
3215
3218
|
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();
|
|
3216
3219
|
})(e, (function() {
|
|
@@ -3367,8 +3370,8 @@ var wi = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
|
3367
3370
|
};
|
|
3368
3371
|
}));
|
|
3369
3372
|
})))(), 1);
|
|
3370
|
-
Pe.extend(
|
|
3371
|
-
function
|
|
3373
|
+
Pe.extend(Ti.default);
|
|
3374
|
+
function Ei(e, t) {
|
|
3372
3375
|
if (e == null || e === "") return null;
|
|
3373
3376
|
if (Pe.isDayjs(e)) return e;
|
|
3374
3377
|
let n = Pe(String(e), t, !0);
|
|
@@ -3376,13 +3379,13 @@ function Ti(e, t) {
|
|
|
3376
3379
|
}
|
|
3377
3380
|
//#endregion
|
|
3378
3381
|
//#region src/crud/fields/DateField.tsx
|
|
3379
|
-
var
|
|
3380
|
-
Ei,
|
|
3382
|
+
var Di = "YYYY-MM-DD", Oi = `${Di} HH:mm:ss`, ki = [
|
|
3381
3383
|
Di,
|
|
3384
|
+
Oi,
|
|
3382
3385
|
"YYYY-MM-DDTHH:mm:ss",
|
|
3383
3386
|
"YYYY-MM-DDTHH:mm:ssZ"
|
|
3384
3387
|
];
|
|
3385
|
-
function
|
|
3388
|
+
function Ai({ source: e, name: t, label: n, required: r, rules: i, showTime: a, hideLabel: o }) {
|
|
3386
3389
|
return /* @__PURE__ */ J($, {
|
|
3387
3390
|
source: e,
|
|
3388
3391
|
name: t,
|
|
@@ -3391,33 +3394,33 @@ function ki({ source: e, name: t, label: n, required: r, rules: i, showTime: a,
|
|
|
3391
3394
|
rules: i,
|
|
3392
3395
|
hideLabel: o,
|
|
3393
3396
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(O, {
|
|
3394
|
-
value:
|
|
3395
|
-
onChange: (e) => t(e ? e.format(a ?
|
|
3397
|
+
value: Ei(e, a ? [...ki, Oi] : ki),
|
|
3398
|
+
onChange: (e) => t(e ? e.format(a ? Oi : Di) : null),
|
|
3396
3399
|
onBlur: n,
|
|
3397
3400
|
showTime: a,
|
|
3398
3401
|
disabled: r,
|
|
3399
|
-
format: a ?
|
|
3402
|
+
format: a ? Oi : Di,
|
|
3400
3403
|
style: { width: "100%" }
|
|
3401
3404
|
})
|
|
3402
3405
|
});
|
|
3403
3406
|
}
|
|
3404
3407
|
//#endregion
|
|
3405
3408
|
//#region src/crud/fields/DateTimeField.tsx
|
|
3406
|
-
function
|
|
3407
|
-
return /* @__PURE__ */ J(
|
|
3409
|
+
function ji(e) {
|
|
3410
|
+
return /* @__PURE__ */ J(Ai, {
|
|
3408
3411
|
showTime: !0,
|
|
3409
3412
|
...e
|
|
3410
3413
|
});
|
|
3411
3414
|
}
|
|
3412
3415
|
//#endregion
|
|
3413
3416
|
//#region src/crud/fields/TimeField.tsx
|
|
3414
|
-
var
|
|
3415
|
-
|
|
3417
|
+
var Mi = "HH:mm:ss", Ni = [
|
|
3418
|
+
Mi,
|
|
3416
3419
|
"HH:mm",
|
|
3417
3420
|
"H:mm:ss",
|
|
3418
3421
|
"H:mm"
|
|
3419
3422
|
];
|
|
3420
|
-
function
|
|
3423
|
+
function Pi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, format: o = Mi }) {
|
|
3421
3424
|
return /* @__PURE__ */ J($, {
|
|
3422
3425
|
source: e,
|
|
3423
3426
|
name: t,
|
|
@@ -3426,7 +3429,7 @@ function Ni({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3426
3429
|
rules: i,
|
|
3427
3430
|
hideLabel: a,
|
|
3428
3431
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(ce, {
|
|
3429
|
-
value:
|
|
3432
|
+
value: Ei(e, Ni),
|
|
3430
3433
|
onChange: (e) => t(e ? e.format(o) : null),
|
|
3431
3434
|
onBlur: n,
|
|
3432
3435
|
disabled: r,
|
|
@@ -3437,7 +3440,7 @@ function Ni({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3437
3440
|
}
|
|
3438
3441
|
//#endregion
|
|
3439
3442
|
//#region src/crud/fields/SelectField.tsx
|
|
3440
|
-
function
|
|
3443
|
+
function Fi({ source: e, name: t, label: n, required: r, rules: i, choices: a, mode: o, allowClear: s, hideLabel: c }) {
|
|
3441
3444
|
return /* @__PURE__ */ J($, {
|
|
3442
3445
|
source: e,
|
|
3443
3446
|
name: t,
|
|
@@ -3458,7 +3461,7 @@ function Pi({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3458
3461
|
}
|
|
3459
3462
|
//#endregion
|
|
3460
3463
|
//#region src/crud/fields/PasswordField.tsx
|
|
3461
|
-
function
|
|
3464
|
+
function Ii({ source: e, name: t, label: n, required: r, rules: i, autoComplete: a, hideLabel: o }) {
|
|
3462
3465
|
return /* @__PURE__ */ J($, {
|
|
3463
3466
|
source: e,
|
|
3464
3467
|
name: t,
|
|
@@ -3475,12 +3478,12 @@ function Fi({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3475
3478
|
})
|
|
3476
3479
|
});
|
|
3477
3480
|
}
|
|
3478
|
-
function
|
|
3481
|
+
function Li({ source: e, name: t, label: n, required: r, rules: i, confirmSource: a, confirmLabel: o = "Confirm password", autoComplete: s = "new-password", hideLabel: c }) {
|
|
3479
3482
|
let l = Ne({
|
|
3480
3483
|
name: t ?? e,
|
|
3481
3484
|
disabled: !a
|
|
3482
3485
|
});
|
|
3483
|
-
return a ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(
|
|
3486
|
+
return a ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(Ii, {
|
|
3484
3487
|
source: e,
|
|
3485
3488
|
name: t,
|
|
3486
3489
|
label: n,
|
|
@@ -3488,14 +3491,14 @@ function Ii({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3488
3491
|
rules: i,
|
|
3489
3492
|
autoComplete: s,
|
|
3490
3493
|
hideLabel: c
|
|
3491
|
-
}), /* @__PURE__ */ J(
|
|
3494
|
+
}), /* @__PURE__ */ J(Ii, {
|
|
3492
3495
|
source: a,
|
|
3493
3496
|
label: o,
|
|
3494
3497
|
required: r,
|
|
3495
3498
|
autoComplete: s,
|
|
3496
3499
|
hideLabel: c,
|
|
3497
3500
|
rules: { validate: (e) => !l || e === l || "Passwords do not match" }
|
|
3498
|
-
})] }) : /* @__PURE__ */ J(
|
|
3501
|
+
})] }) : /* @__PURE__ */ J(Ii, {
|
|
3499
3502
|
source: e,
|
|
3500
3503
|
name: t,
|
|
3501
3504
|
label: n,
|
|
@@ -3507,54 +3510,54 @@ function Ii({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3507
3510
|
}
|
|
3508
3511
|
//#endregion
|
|
3509
3512
|
//#region src/crud/utils/choiceSelectionUtils.ts
|
|
3510
|
-
function
|
|
3513
|
+
function Ri(e, t) {
|
|
3511
3514
|
return typeof e == "object" && !!e && !Array.isArray(e) && t in e;
|
|
3512
3515
|
}
|
|
3513
|
-
function
|
|
3516
|
+
function zi(e, t) {
|
|
3514
3517
|
if (!(e == null || e === "")) {
|
|
3515
|
-
if (
|
|
3518
|
+
if (Ri(e, t)) {
|
|
3516
3519
|
let n = e[t];
|
|
3517
3520
|
return typeof n == "string" || typeof n == "number" ? n : void 0;
|
|
3518
3521
|
}
|
|
3519
3522
|
if (typeof e == "string" || typeof e == "number") return e;
|
|
3520
3523
|
}
|
|
3521
3524
|
}
|
|
3522
|
-
function zi(e, t) {
|
|
3523
|
-
return Array.isArray(e) ? e.map((e) => Ri(e, t)).filter((e) => e != null) : [];
|
|
3524
|
-
}
|
|
3525
3525
|
function Bi(e, t) {
|
|
3526
|
-
return
|
|
3526
|
+
return Array.isArray(e) ? e.map((e) => zi(e, t)).filter((e) => e != null) : [];
|
|
3527
|
+
}
|
|
3528
|
+
function Vi(e, t) {
|
|
3529
|
+
return e == null ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "").map((e) => Ri(e, t) ? e[t] : e);
|
|
3527
3530
|
}
|
|
3528
|
-
function
|
|
3531
|
+
function Hi(e, t, n) {
|
|
3529
3532
|
let r = [];
|
|
3530
|
-
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) =>
|
|
3533
|
+
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) => Ri(e, n))) : Ri(t, n) && r.push(t)), e == null) return r;
|
|
3531
3534
|
let i = Array.isArray(e) ? e : [e];
|
|
3532
|
-
for (let e of i)
|
|
3535
|
+
for (let e of i) Ri(e, n) && r.push(e);
|
|
3533
3536
|
return r;
|
|
3534
3537
|
}
|
|
3535
|
-
function
|
|
3538
|
+
function Ui(e, t) {
|
|
3536
3539
|
return typeof t == "function" ? t(e) : String(e[t] ?? "");
|
|
3537
3540
|
}
|
|
3538
|
-
function
|
|
3541
|
+
function Wi(e, t, n) {
|
|
3539
3542
|
return e.map((e) => ({
|
|
3540
|
-
label:
|
|
3543
|
+
label: Ui(e, t),
|
|
3541
3544
|
value: e[n],
|
|
3542
3545
|
record: e
|
|
3543
3546
|
}));
|
|
3544
3547
|
}
|
|
3545
|
-
function
|
|
3548
|
+
function Gi(e, t) {
|
|
3546
3549
|
let n = /* @__PURE__ */ new Map();
|
|
3547
3550
|
for (let t of e) n.set(t.value, t);
|
|
3548
3551
|
for (let e of t) n.set(e.value, e);
|
|
3549
3552
|
return Array.from(n.values());
|
|
3550
3553
|
}
|
|
3551
|
-
function
|
|
3554
|
+
function Ki(e, t) {
|
|
3552
3555
|
return e.filter((e) => !t.some((t) => t.value === e));
|
|
3553
3556
|
}
|
|
3554
|
-
function
|
|
3555
|
-
return
|
|
3557
|
+
function qi(e, t, n = []) {
|
|
3558
|
+
return Gi(n, e.filter((e) => t.some((t) => e.value === t)));
|
|
3556
3559
|
}
|
|
3557
|
-
function
|
|
3560
|
+
function Ji(e = {}) {
|
|
3558
3561
|
let t = e.popupMatchSelectWidth ?? !1;
|
|
3559
3562
|
return t === !1 ? {
|
|
3560
3563
|
popupMatchSelectWidth: !1,
|
|
@@ -3563,27 +3566,27 @@ function qi(e = {}) {
|
|
|
3563
3566
|
}
|
|
3564
3567
|
//#endregion
|
|
3565
3568
|
//#region src/crud/utils/referenceSelectNotFoundContent.tsx
|
|
3566
|
-
function
|
|
3569
|
+
function Yi(e) {
|
|
3567
3570
|
return e ? /* @__PURE__ */ J(ae, { size: "small" }) : void 0;
|
|
3568
3571
|
}
|
|
3569
3572
|
//#endregion
|
|
3570
3573
|
//#region src/crud/utils/referenceSelectSelectedProps.ts
|
|
3571
|
-
function
|
|
3574
|
+
function Xi(e, t, n) {
|
|
3572
3575
|
return {
|
|
3573
3576
|
loading: e || t,
|
|
3574
3577
|
disabled: !!(n || t)
|
|
3575
3578
|
};
|
|
3576
3579
|
}
|
|
3577
|
-
function
|
|
3580
|
+
function Zi(e, t, n) {
|
|
3578
3581
|
return e ? n : t;
|
|
3579
3582
|
}
|
|
3580
3583
|
//#endregion
|
|
3581
3584
|
//#region src/crud/utils/useChoices.ts
|
|
3582
|
-
var
|
|
3583
|
-
function
|
|
3585
|
+
var Qi = /* @__PURE__ */ new Map(), $i = /* @__PURE__ */ new Map();
|
|
3586
|
+
function ea(e, t) {
|
|
3584
3587
|
return typeof e == "function" ? `fn:${t ?? ""}` : Array.isArray(e) ? `static:${e.length}` : `res:${e.resource}:${JSON.stringify(e.filter ?? {})}:${t ?? ""}`;
|
|
3585
3588
|
}
|
|
3586
|
-
async function
|
|
3589
|
+
async function ta(e, t, n, r, i) {
|
|
3587
3590
|
return typeof e == "function" ? e({
|
|
3588
3591
|
dataProvider: t,
|
|
3589
3592
|
search: i
|
|
@@ -3597,25 +3600,25 @@ async function ea(e, t, n, r, i) {
|
|
|
3597
3600
|
perPage: 500
|
|
3598
3601
|
}
|
|
3599
3602
|
})).data.map((e) => ({
|
|
3600
|
-
label:
|
|
3603
|
+
label: Ui(e, n),
|
|
3601
3604
|
value: e[r],
|
|
3602
3605
|
record: e
|
|
3603
3606
|
}));
|
|
3604
3607
|
}
|
|
3605
|
-
function
|
|
3606
|
-
let o =
|
|
3608
|
+
function na(e, t, n, r, i, a) {
|
|
3609
|
+
let o = ea(e, i);
|
|
3607
3610
|
if (a) {
|
|
3608
|
-
let e =
|
|
3611
|
+
let e = Qi.get(o);
|
|
3609
3612
|
if (e && !i) return Promise.resolve(e);
|
|
3610
3613
|
}
|
|
3611
|
-
let s =
|
|
3614
|
+
let s = $i.get(o);
|
|
3612
3615
|
if (s) return s;
|
|
3613
|
-
let c =
|
|
3614
|
-
|
|
3616
|
+
let c = ta(e, t, n, r, i).then((e) => (a && !i && Qi.set(o, e), e)).finally(() => {
|
|
3617
|
+
$i.delete(o);
|
|
3615
3618
|
});
|
|
3616
|
-
return
|
|
3619
|
+
return $i.set(o, c), c;
|
|
3617
3620
|
}
|
|
3618
|
-
function
|
|
3621
|
+
function ra(e, t, n = "name", r = "id", i, o = {}) {
|
|
3619
3622
|
let { lazy: c = !1, active: f = !1, selectedValues: p, selectedRecords: m, fetchSelected: h = !0, cache: g } = o, _ = g ?? !c, v = Yt(), y = l(() => {
|
|
3620
3623
|
if (e) return e;
|
|
3621
3624
|
if (t) return {
|
|
@@ -3626,16 +3629,16 @@ function na(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3626
3629
|
e,
|
|
3627
3630
|
t,
|
|
3628
3631
|
i
|
|
3629
|
-
]), b = y ?
|
|
3632
|
+
]), b = y ? ea(y, i) : void 0, x = l(() => Vi(p, r), [p, r]), S = l(() => Wi(Hi(p, m, r), n, r), [
|
|
3630
3633
|
p,
|
|
3631
3634
|
m,
|
|
3632
3635
|
n,
|
|
3633
3636
|
r
|
|
3634
|
-
]), C = !!(y && (!c || f || Array.isArray(y))), [w, T] = d(() => S.length ? S : !b || i || c || !_ ? [] :
|
|
3637
|
+
]), C = !!(y && (!c || f || Array.isArray(y))), [w, T] = d(() => S.length ? S : !b || i || c || !_ ? [] : Qi.get(b) ?? []), [E, D] = d(() => C ? !_ || !b || i ? !!y : !Qi.has(b) : !1), [O, k] = d(() => !!(h && t && Ki(x, S).length)), A = u(w);
|
|
3635
3638
|
A.current = w;
|
|
3636
3639
|
let j = u(x);
|
|
3637
3640
|
j.current = x, s(() => {
|
|
3638
|
-
S.length && T((e) =>
|
|
3641
|
+
S.length && T((e) => Gi(e, S));
|
|
3639
3642
|
}, [S]);
|
|
3640
3643
|
let M = a(async () => {
|
|
3641
3644
|
if (!y || !C) {
|
|
@@ -3643,18 +3646,18 @@ function na(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3643
3646
|
return;
|
|
3644
3647
|
}
|
|
3645
3648
|
if (_) {
|
|
3646
|
-
let e =
|
|
3649
|
+
let e = ea(y, i), t = Qi.get(e);
|
|
3647
3650
|
if (t && !i) {
|
|
3648
|
-
T((e) =>
|
|
3651
|
+
T((e) => Gi(qi(e, j.current, S), t)), D(!1);
|
|
3649
3652
|
return;
|
|
3650
3653
|
}
|
|
3651
3654
|
}
|
|
3652
|
-
D(!0), c && T((e) =>
|
|
3655
|
+
D(!0), c && T((e) => qi(e, j.current, S));
|
|
3653
3656
|
try {
|
|
3654
|
-
let e = await
|
|
3655
|
-
T((t) =>
|
|
3657
|
+
let e = await na(y, v, n, r, i, _);
|
|
3658
|
+
T((t) => Gi(qi(t, j.current, S), e));
|
|
3656
3659
|
} catch {
|
|
3657
|
-
!x.length && !S.length ? T([]) : c && T((e) =>
|
|
3660
|
+
!x.length && !S.length ? T([]) : c && T((e) => qi(e, j.current, S));
|
|
3658
3661
|
} finally {
|
|
3659
3662
|
D(!1);
|
|
3660
3663
|
}
|
|
@@ -3673,7 +3676,7 @@ function na(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3673
3676
|
s(() => {
|
|
3674
3677
|
M();
|
|
3675
3678
|
}, [M]), s(() => {
|
|
3676
|
-
c && !f && !i && (T((e) =>
|
|
3679
|
+
c && !f && !i && (T((e) => qi(e, x, S)), D(!1));
|
|
3677
3680
|
}, [
|
|
3678
3681
|
c,
|
|
3679
3682
|
f,
|
|
@@ -3685,7 +3688,7 @@ function na(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3685
3688
|
k(!1);
|
|
3686
3689
|
return;
|
|
3687
3690
|
}
|
|
3688
|
-
let e =
|
|
3691
|
+
let e = Ki(x, Gi(S, A.current));
|
|
3689
3692
|
if (!e.length) {
|
|
3690
3693
|
k(!1);
|
|
3691
3694
|
return;
|
|
@@ -3696,7 +3699,7 @@ function na(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3696
3699
|
for (let i of e) try {
|
|
3697
3700
|
let e = (await v.getOne(t, i)).data;
|
|
3698
3701
|
a.push({
|
|
3699
|
-
label:
|
|
3702
|
+
label: Ui(e, n),
|
|
3700
3703
|
value: e[r],
|
|
3701
3704
|
record: e
|
|
3702
3705
|
});
|
|
@@ -3708,7 +3711,7 @@ function na(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3708
3711
|
}
|
|
3709
3712
|
i || (a.length && T((e) => {
|
|
3710
3713
|
let t = a.filter((t) => !e.some((e) => e.value === t.value));
|
|
3711
|
-
return t.length ?
|
|
3714
|
+
return t.length ? Gi(e, t) : e;
|
|
3712
3715
|
}), k(!1));
|
|
3713
3716
|
})(), () => {
|
|
3714
3717
|
i = !0;
|
|
@@ -3735,7 +3738,7 @@ function na(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3735
3738
|
}
|
|
3736
3739
|
//#endregion
|
|
3737
3740
|
//#region src/crud/fields/ReferenceInputActions.tsx
|
|
3738
|
-
function
|
|
3741
|
+
function ia({ reference: e, referenceForm: t, referencePermissions: n, referenceTitle: r, referenceDefaultValues: i, referenceModalWidth: a, selectedId: o, disabled: s, onCreated: c, onUpdated: l }) {
|
|
3739
3742
|
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);
|
|
3740
3743
|
return !p && !m ? null : /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y(V, {
|
|
3741
3744
|
size: 4,
|
|
@@ -3758,7 +3761,7 @@ function ra({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3758
3761
|
onClick: () => g(String(o))
|
|
3759
3762
|
})
|
|
3760
3763
|
}) : null]
|
|
3761
|
-
}), e && t && h != null ? /* @__PURE__ */ J(
|
|
3764
|
+
}), e && t && h != null ? /* @__PURE__ */ J(Wr, {
|
|
3762
3765
|
resource: e,
|
|
3763
3766
|
editId: h,
|
|
3764
3767
|
onClose: () => g(null),
|
|
@@ -3775,35 +3778,35 @@ function ra({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3775
3778
|
}
|
|
3776
3779
|
//#endregion
|
|
3777
3780
|
//#region src/crud/fields/ReferenceField.tsx
|
|
3778
|
-
function
|
|
3779
|
-
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A =
|
|
3781
|
+
function aa({ 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 }) {
|
|
3782
|
+
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A = zi(p, r), { options: j, loading: M, selectedLoading: N, optionForValue: P, reload: F } = ra(t, e, n, r, i ? T : void 0, {
|
|
3780
3783
|
lazy: u,
|
|
3781
3784
|
active: k,
|
|
3782
3785
|
selectedValues: p,
|
|
3783
3786
|
selectedRecords: g,
|
|
3784
3787
|
fetchSelected: f
|
|
3785
|
-
}), I =
|
|
3788
|
+
}), I = Xi(M, N, o), L = l(() => j.map((e) => ({
|
|
3786
3789
|
label: e.label,
|
|
3787
3790
|
value: e.value
|
|
3788
3791
|
})), [j]), ee = (e) => {
|
|
3789
3792
|
let t = e[r];
|
|
3790
3793
|
m(t), c?.(t, {
|
|
3791
|
-
label:
|
|
3794
|
+
label: Ui(e, n),
|
|
3792
3795
|
value: t,
|
|
3793
3796
|
record: e
|
|
3794
3797
|
}, { name: h }), F();
|
|
3795
3798
|
}, R = /* @__PURE__ */ J(B, {
|
|
3796
|
-
...
|
|
3799
|
+
...Ji({
|
|
3797
3800
|
popupMatchSelectWidth: C,
|
|
3798
3801
|
popupMinWidth: w
|
|
3799
3802
|
}),
|
|
3800
|
-
value:
|
|
3803
|
+
value: Zi(N, A, void 0),
|
|
3801
3804
|
onChange: (e) => {
|
|
3802
3805
|
m(e), c?.(e, P(e), { name: h });
|
|
3803
3806
|
},
|
|
3804
3807
|
options: L,
|
|
3805
3808
|
loading: I.loading,
|
|
3806
|
-
notFoundContent:
|
|
3809
|
+
notFoundContent: Yi(I.loading),
|
|
3807
3810
|
showSearch: i,
|
|
3808
3811
|
filterOption: i ? !1 : void 0,
|
|
3809
3812
|
onSearch: i ? E : void 0,
|
|
@@ -3832,7 +3835,7 @@ function ia({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3832
3835
|
minWidth: 0
|
|
3833
3836
|
},
|
|
3834
3837
|
children: R
|
|
3835
|
-
}), /* @__PURE__ */ J(
|
|
3838
|
+
}), /* @__PURE__ */ J(ia, {
|
|
3836
3839
|
reference: e,
|
|
3837
3840
|
referenceForm: _,
|
|
3838
3841
|
referencePermissions: v,
|
|
@@ -3846,7 +3849,7 @@ function ia({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3846
3849
|
})]
|
|
3847
3850
|
}) : R;
|
|
3848
3851
|
}
|
|
3849
|
-
function
|
|
3852
|
+
function oa({ 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, inputStyle: p, onValueChange: m, lazy: h = !0, recordSource: g, fetchSelected: _ = !0, referenceForm: v, referencePermissions: y, referenceTitle: b, referenceDefaultValues: x, referenceModalWidth: S, referenceActions: C = !0, popupMatchSelectWidth: w, popupMinWidth: T }) {
|
|
3850
3853
|
let E = Ne({
|
|
3851
3854
|
name: g ?? "",
|
|
3852
3855
|
disabled: !g
|
|
@@ -3858,7 +3861,7 @@ function aa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3858
3861
|
required: s,
|
|
3859
3862
|
rules: c,
|
|
3860
3863
|
hideLabel: f,
|
|
3861
|
-
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ J(
|
|
3864
|
+
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ J(aa, {
|
|
3862
3865
|
reference: r,
|
|
3863
3866
|
choices: i,
|
|
3864
3867
|
optionLabel: a,
|
|
@@ -3887,27 +3890,27 @@ function aa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3887
3890
|
}
|
|
3888
3891
|
//#endregion
|
|
3889
3892
|
//#region src/crud/fields/ReferenceManyField.tsx
|
|
3890
|
-
function
|
|
3891
|
-
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D =
|
|
3893
|
+
function sa({ 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 }) {
|
|
3894
|
+
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D = Bi(c, r), { options: O, loading: k, selectedLoading: A, reload: j } = ra(t, e, n, r, i ? S : void 0, {
|
|
3892
3895
|
lazy: o,
|
|
3893
3896
|
active: E,
|
|
3894
3897
|
selectedValues: c,
|
|
3895
3898
|
selectedRecords: p,
|
|
3896
3899
|
fetchSelected: s
|
|
3897
|
-
}), M =
|
|
3900
|
+
}), M = Xi(k, A, f), N = l(() => O.map((e) => ({
|
|
3898
3901
|
label: e.label,
|
|
3899
3902
|
value: e.value
|
|
3900
3903
|
})), [O]), P = /* @__PURE__ */ J(B, {
|
|
3901
|
-
...
|
|
3904
|
+
...Ji({
|
|
3902
3905
|
popupMatchSelectWidth: b,
|
|
3903
3906
|
popupMinWidth: x
|
|
3904
3907
|
}),
|
|
3905
3908
|
mode: "multiple",
|
|
3906
|
-
value:
|
|
3909
|
+
value: Zi(A, D, []),
|
|
3907
3910
|
onChange: u,
|
|
3908
3911
|
options: N,
|
|
3909
3912
|
loading: M.loading,
|
|
3910
|
-
notFoundContent:
|
|
3913
|
+
notFoundContent: Yi(M.loading),
|
|
3911
3914
|
showSearch: i,
|
|
3912
3915
|
filterOption: i ? !1 : void 0,
|
|
3913
3916
|
onSearch: i ? C : void 0,
|
|
@@ -3932,7 +3935,7 @@ function oa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3932
3935
|
minWidth: 0
|
|
3933
3936
|
},
|
|
3934
3937
|
children: P
|
|
3935
|
-
}), /* @__PURE__ */ J(
|
|
3938
|
+
}), /* @__PURE__ */ J(ia, {
|
|
3936
3939
|
reference: e,
|
|
3937
3940
|
referenceForm: m,
|
|
3938
3941
|
referencePermissions: h,
|
|
@@ -3951,7 +3954,7 @@ function oa({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3951
3954
|
})]
|
|
3952
3955
|
}) : P;
|
|
3953
3956
|
}
|
|
3954
|
-
function
|
|
3957
|
+
function ca({ 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, disabled: f, lazy: p = !0, recordSource: m, fetchSelected: h = !0, referenceForm: g, referencePermissions: _, referenceTitle: v, referenceDefaultValues: y, referenceModalWidth: b, referenceActions: x = !0, popupMatchSelectWidth: S, popupMinWidth: C }) {
|
|
3955
3958
|
let w = Ne({
|
|
3956
3959
|
name: m ?? "",
|
|
3957
3960
|
disabled: !m
|
|
@@ -3963,7 +3966,7 @@ function sa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3963
3966
|
required: s,
|
|
3964
3967
|
rules: c,
|
|
3965
3968
|
hideLabel: d,
|
|
3966
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(
|
|
3969
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(sa, {
|
|
3967
3970
|
reference: r,
|
|
3968
3971
|
choices: i,
|
|
3969
3972
|
optionLabel: a,
|
|
@@ -3989,10 +3992,10 @@ function sa({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3989
3992
|
}
|
|
3990
3993
|
//#endregion
|
|
3991
3994
|
//#region src/crud/fields/uploadFieldUtils.ts
|
|
3992
|
-
function
|
|
3995
|
+
function la(e) {
|
|
3993
3996
|
return e instanceof File ? !0 : typeof e == "string" && e.length > 0;
|
|
3994
3997
|
}
|
|
3995
|
-
function
|
|
3998
|
+
function ua(e) {
|
|
3996
3999
|
if (e instanceof File) return e.name;
|
|
3997
4000
|
if (typeof e == "string" && e.length > 0) try {
|
|
3998
4001
|
return new URL(e, "http://local").pathname.split("/").filter(Boolean).pop() || e;
|
|
@@ -4002,7 +4005,7 @@ function la(e) {
|
|
|
4002
4005
|
}
|
|
4003
4006
|
//#endregion
|
|
4004
4007
|
//#region src/crud/fields/useUploadPreviewUrl.ts
|
|
4005
|
-
function
|
|
4008
|
+
function da(e) {
|
|
4006
4009
|
let [t, n] = d();
|
|
4007
4010
|
if (s(() => {
|
|
4008
4011
|
if (e instanceof File) {
|
|
@@ -4015,8 +4018,8 @@ function ua(e) {
|
|
|
4015
4018
|
}
|
|
4016
4019
|
//#endregion
|
|
4017
4020
|
//#region src/crud/fields/ImageField.tsx
|
|
4018
|
-
function
|
|
4019
|
-
let o = u(null), s =
|
|
4021
|
+
function fa({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "image/*", previewWidth: a = 200 }) {
|
|
4022
|
+
let o = u(null), s = da(e), c = r && la(e);
|
|
4020
4023
|
return /* @__PURE__ */ Y(V, {
|
|
4021
4024
|
direction: "vertical",
|
|
4022
4025
|
size: "middle",
|
|
@@ -4063,7 +4066,7 @@ function da({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
4063
4066
|
]
|
|
4064
4067
|
});
|
|
4065
4068
|
}
|
|
4066
|
-
function
|
|
4069
|
+
function pa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s, previewWidth: c }) {
|
|
4067
4070
|
return /* @__PURE__ */ J($, {
|
|
4068
4071
|
source: e,
|
|
4069
4072
|
name: t,
|
|
@@ -4071,7 +4074,7 @@ function fa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4071
4074
|
required: r,
|
|
4072
4075
|
rules: i,
|
|
4073
4076
|
hideLabel: a,
|
|
4074
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(
|
|
4077
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(fa, {
|
|
4075
4078
|
value: e,
|
|
4076
4079
|
onChange: t,
|
|
4077
4080
|
disabled: n,
|
|
@@ -4083,8 +4086,8 @@ function fa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4083
4086
|
}
|
|
4084
4087
|
//#endregion
|
|
4085
4088
|
//#region src/crud/fields/FileField.tsx
|
|
4086
|
-
function
|
|
4087
|
-
let a = u(null), o =
|
|
4089
|
+
function ma({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
4090
|
+
let a = u(null), o = ua(e), s = typeof e == "string" && e.length > 0 ? e : void 0, c = r && la(e);
|
|
4088
4091
|
return /* @__PURE__ */ Y(V, {
|
|
4089
4092
|
direction: "vertical",
|
|
4090
4093
|
size: "middle",
|
|
@@ -4128,7 +4131,7 @@ function pa({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
4128
4131
|
]
|
|
4129
4132
|
});
|
|
4130
4133
|
}
|
|
4131
|
-
function
|
|
4134
|
+
function ha({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s }) {
|
|
4132
4135
|
return /* @__PURE__ */ J($, {
|
|
4133
4136
|
source: e,
|
|
4134
4137
|
name: t,
|
|
@@ -4136,7 +4139,7 @@ function ma({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4136
4139
|
required: r,
|
|
4137
4140
|
rules: i,
|
|
4138
4141
|
hideLabel: a,
|
|
4139
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(
|
|
4142
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(ma, {
|
|
4140
4143
|
value: e,
|
|
4141
4144
|
onChange: t,
|
|
4142
4145
|
disabled: n,
|
|
@@ -4147,7 +4150,7 @@ function ma({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4147
4150
|
}
|
|
4148
4151
|
//#endregion
|
|
4149
4152
|
//#region src/crud/columns/TextColumn.tsx
|
|
4150
|
-
function
|
|
4153
|
+
function ga({ source: e, label: t, sortable: n = !0 }) {
|
|
4151
4154
|
return Jn(l(() => ({
|
|
4152
4155
|
key: e,
|
|
4153
4156
|
source: e,
|
|
@@ -4165,12 +4168,12 @@ function ha({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4165
4168
|
n
|
|
4166
4169
|
])), null;
|
|
4167
4170
|
}
|
|
4168
|
-
function
|
|
4171
|
+
function _a(e, t, n) {
|
|
4169
4172
|
return typeof n == "function" ? n(e) : n ? br(e, n) : e[t];
|
|
4170
4173
|
}
|
|
4171
4174
|
//#endregion
|
|
4172
4175
|
//#region src/crud/columns/NumberColumn.tsx
|
|
4173
|
-
function
|
|
4176
|
+
function va({ source: e, label: t, sortable: n = !0 }) {
|
|
4174
4177
|
return Jn(l(() => ({
|
|
4175
4178
|
key: e,
|
|
4176
4179
|
source: e,
|
|
@@ -4190,7 +4193,7 @@ function _a({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4190
4193
|
}
|
|
4191
4194
|
//#endregion
|
|
4192
4195
|
//#region src/crud/columns/BooleanColumn.tsx
|
|
4193
|
-
function
|
|
4196
|
+
function ya({ source: e, label: t, sortable: n = !0 }) {
|
|
4194
4197
|
return Jn(l(() => ({
|
|
4195
4198
|
key: e,
|
|
4196
4199
|
source: e,
|
|
@@ -4211,7 +4214,7 @@ function va({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4211
4214
|
}
|
|
4212
4215
|
//#endregion
|
|
4213
4216
|
//#region src/crud/columns/DateColumn.tsx
|
|
4214
|
-
function
|
|
4217
|
+
function ba({ source: e, label: t, sortable: n = !0 }) {
|
|
4215
4218
|
return Jn(l(() => ({
|
|
4216
4219
|
key: e,
|
|
4217
4220
|
source: e,
|
|
@@ -4232,16 +4235,16 @@ function ya({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4232
4235
|
}
|
|
4233
4236
|
//#endregion
|
|
4234
4237
|
//#region src/crud/columns/ReferenceColumn.tsx
|
|
4235
|
-
function
|
|
4236
|
-
let { labelForValue: s } =
|
|
4238
|
+
function xa({ record: e, source: t, display: n, reference: r, choices: i, optionLabel: a, optionValue: o }) {
|
|
4239
|
+
let { labelForValue: s } = ra(i, r, a, o), c = e[t];
|
|
4237
4240
|
if (typeof n == "function") return /* @__PURE__ */ J(q, { children: n(e) });
|
|
4238
4241
|
if (n && n !== t) {
|
|
4239
|
-
let r =
|
|
4242
|
+
let r = _a(e, t, n);
|
|
4240
4243
|
return /* @__PURE__ */ J(q, { children: r == null ? "—" : String(r) });
|
|
4241
4244
|
}
|
|
4242
4245
|
return /* @__PURE__ */ J(q, { children: s(c) });
|
|
4243
4246
|
}
|
|
4244
|
-
function
|
|
4247
|
+
function Sa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: s = !0 }) {
|
|
4245
4248
|
return Jn(l(() => ({
|
|
4246
4249
|
key: e,
|
|
4247
4250
|
source: e,
|
|
@@ -4252,7 +4255,7 @@ function xa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4252
4255
|
dataIndex: e,
|
|
4253
4256
|
key: e,
|
|
4254
4257
|
sorter: s ? !0 : void 0,
|
|
4255
|
-
render: (s, c) => /* @__PURE__ */ J(
|
|
4258
|
+
render: (s, c) => /* @__PURE__ */ J(xa, {
|
|
4256
4259
|
record: c,
|
|
4257
4260
|
source: e,
|
|
4258
4261
|
label: t,
|
|
@@ -4276,11 +4279,11 @@ function xa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4276
4279
|
}
|
|
4277
4280
|
//#endregion
|
|
4278
4281
|
//#region src/crud/columns/ReferenceManyColumn.tsx
|
|
4279
|
-
function
|
|
4280
|
-
let { labelsForValues: o } =
|
|
4282
|
+
function Ca({ record: e, source: t, reference: n, choices: r, optionLabel: i, optionValue: a }) {
|
|
4283
|
+
let { labelsForValues: o } = ra(r, n, i, a), s = e[t];
|
|
4281
4284
|
return /* @__PURE__ */ J(q, { children: o(Array.isArray(s) ? s : []) });
|
|
4282
4285
|
}
|
|
4283
|
-
function
|
|
4286
|
+
function wa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
|
|
4284
4287
|
return Jn(l(() => ({
|
|
4285
4288
|
key: e,
|
|
4286
4289
|
source: e,
|
|
@@ -4291,7 +4294,7 @@ function Ca({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4291
4294
|
dataIndex: e,
|
|
4292
4295
|
key: e,
|
|
4293
4296
|
sorter: o ? !0 : void 0,
|
|
4294
|
-
render: (t, o) => /* @__PURE__ */ J(
|
|
4297
|
+
render: (t, o) => /* @__PURE__ */ J(Ca, {
|
|
4295
4298
|
record: o,
|
|
4296
4299
|
source: e,
|
|
4297
4300
|
reference: n,
|
|
@@ -4312,7 +4315,7 @@ function Ca({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4312
4315
|
}
|
|
4313
4316
|
//#endregion
|
|
4314
4317
|
//#region src/crud/columns/ImageColumn.tsx
|
|
4315
|
-
function
|
|
4318
|
+
function Ta({ source: e, label: t, sortable: n = !1, width: r = 40, height: i = 40, objectFit: a = "cover", borderRadius: o = 4, alt: s = "" }) {
|
|
4316
4319
|
return Jn(l(() => ({
|
|
4317
4320
|
key: e,
|
|
4318
4321
|
source: e,
|
|
@@ -4347,7 +4350,7 @@ function wa({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4347
4350
|
}
|
|
4348
4351
|
//#endregion
|
|
4349
4352
|
//#region src/crud/columns/CustomColumn.tsx
|
|
4350
|
-
function
|
|
4353
|
+
function Ea({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
4351
4354
|
return Jn(l(() => ({
|
|
4352
4355
|
key: e,
|
|
4353
4356
|
source: e,
|
|
@@ -4367,7 +4370,7 @@ function Ta({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
|
4367
4370
|
}
|
|
4368
4371
|
//#endregion
|
|
4369
4372
|
//#region src/crud/filters/NumberFilter.tsx
|
|
4370
|
-
function
|
|
4373
|
+
function Da({ source: e, label: t }) {
|
|
4371
4374
|
return rr(l(() => ({
|
|
4372
4375
|
key: e,
|
|
4373
4376
|
source: e,
|
|
@@ -4382,7 +4385,7 @@ function Ea({ source: e, label: t }) {
|
|
|
4382
4385
|
}
|
|
4383
4386
|
//#endregion
|
|
4384
4387
|
//#region src/crud/filters/BooleanFilter.tsx
|
|
4385
|
-
function
|
|
4388
|
+
function Oa({ source: e, label: t }) {
|
|
4386
4389
|
return rr(l(() => ({
|
|
4387
4390
|
key: e,
|
|
4388
4391
|
source: e,
|
|
@@ -4405,7 +4408,7 @@ function Da({ source: e, label: t }) {
|
|
|
4405
4408
|
}
|
|
4406
4409
|
//#endregion
|
|
4407
4410
|
//#region src/crud/filters/DateFilter.tsx
|
|
4408
|
-
function
|
|
4411
|
+
function ka({ source: e, label: t }) {
|
|
4409
4412
|
return rr(l(() => ({
|
|
4410
4413
|
key: e,
|
|
4411
4414
|
source: e,
|
|
@@ -4421,7 +4424,7 @@ function Oa({ source: e, label: t }) {
|
|
|
4421
4424
|
}
|
|
4422
4425
|
//#endregion
|
|
4423
4426
|
//#region src/crud/filters/SelectFilter.tsx
|
|
4424
|
-
function
|
|
4427
|
+
function Aa({ source: e, label: t, choices: n, multiple: r }) {
|
|
4425
4428
|
return rr(l(() => ({
|
|
4426
4429
|
key: e,
|
|
4427
4430
|
source: e,
|
|
@@ -4444,22 +4447,22 @@ function ka({ source: e, label: t, choices: n, multiple: r }) {
|
|
|
4444
4447
|
}
|
|
4445
4448
|
//#endregion
|
|
4446
4449
|
//#region src/crud/filters/ReferenceFilter.tsx
|
|
4447
|
-
function
|
|
4448
|
-
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b, selectedLoading: x } =
|
|
4450
|
+
function ja({ 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 }) {
|
|
4451
|
+
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b, selectedLoading: x } = ra(r, n, i, a, s ? h : void 0, {
|
|
4449
4452
|
lazy: c,
|
|
4450
4453
|
active: _ || !!h,
|
|
4451
4454
|
selectedValues: p,
|
|
4452
4455
|
fetchSelected: l
|
|
4453
|
-
}), S =
|
|
4456
|
+
}), S = Xi(b, x), C = p;
|
|
4454
4457
|
return /* @__PURE__ */ J(B, {
|
|
4455
|
-
...
|
|
4458
|
+
...Ji({
|
|
4456
4459
|
popupMatchSelectWidth: u,
|
|
4457
4460
|
popupMinWidth: f
|
|
4458
4461
|
}),
|
|
4459
4462
|
allowClear: !0,
|
|
4460
4463
|
mode: o ? "multiple" : void 0,
|
|
4461
4464
|
placeholder: t ?? e,
|
|
4462
|
-
value:
|
|
4465
|
+
value: Zi(x, C, o ? [] : void 0),
|
|
4463
4466
|
onChange: m,
|
|
4464
4467
|
options: y.map((e) => ({
|
|
4465
4468
|
label: e.label,
|
|
@@ -4467,7 +4470,7 @@ function Aa({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4467
4470
|
})),
|
|
4468
4471
|
loading: S.loading,
|
|
4469
4472
|
disabled: S.disabled,
|
|
4470
|
-
notFoundContent:
|
|
4473
|
+
notFoundContent: Yi(S.loading),
|
|
4471
4474
|
showSearch: s,
|
|
4472
4475
|
filterOption: s ? !1 : void 0,
|
|
4473
4476
|
onSearch: s ? g : void 0,
|
|
@@ -4478,12 +4481,12 @@ function Aa({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4478
4481
|
style: { minWidth: 180 }
|
|
4479
4482
|
});
|
|
4480
4483
|
}
|
|
4481
|
-
function
|
|
4484
|
+
function Ma({ 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 }) {
|
|
4482
4485
|
return rr(l(() => ({
|
|
4483
4486
|
key: e,
|
|
4484
4487
|
source: e,
|
|
4485
4488
|
label: t,
|
|
4486
|
-
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(
|
|
4489
|
+
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(ja, {
|
|
4487
4490
|
source: e,
|
|
4488
4491
|
label: t,
|
|
4489
4492
|
reference: n,
|
|
@@ -4514,11 +4517,11 @@ function ja({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4514
4517
|
f
|
|
4515
4518
|
])), null;
|
|
4516
4519
|
}
|
|
4517
|
-
function
|
|
4518
|
-
return /* @__PURE__ */ J(
|
|
4520
|
+
function Na(e) {
|
|
4521
|
+
return /* @__PURE__ */ J(Ma, {
|
|
4519
4522
|
...e,
|
|
4520
4523
|
multiple: !0
|
|
4521
4524
|
});
|
|
4522
4525
|
}
|
|
4523
4526
|
//#endregion
|
|
4524
|
-
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,
|
|
4527
|
+
export { Kt as AdminApp, Pt as AdminLayout, Bn as AppHub, Vn as AppLauncherButton, Xe as AppThemeProvider, In as AuthAlternateLink, Ln as AuthPageLayout, ct as AuthProvider, ya as BooleanColumn, wi as BooleanField, Oa as BooleanFilter, Ea as CustomColumn, Xn as DEFAULT_TEXT_FILTER_DEBOUNCE_MS, Jt as DataProvider, ba as DateColumn, Ai as DateField, ka as DateFilter, ji as DateTimeField, $e as DensitySwitch, en as EXPECTED_VALIDATION_BODY_HINT, $ as FieldWrapper, ha as FileField, ai as FilterBar, vi as FormStep, bi as FormSteps, hi as FormTab, _i as FormTabs, Ft as Guard, Lt as GuestOnly, Ta as ImageColumn, pa as ImageField, ui as InlineFormSet, di as InlineFormSetStacked, Rn as LoginPage, va as NumberColumn, Ci as NumberField, Da as NumberFilter, Li as PasswordField, pt as PermissionsProvider, zn as PlaceholderPage, It as Protected, Sa as ReferenceColumn, oa as ReferenceField, Ma as ReferenceFilter, wa as ReferenceManyColumn, ca as ReferenceManyField, Na as ReferenceManyFilter, Rt as RequirePermission, oi as ResourceForm, Wr as ResourceFormModal, ri as ResourceList, Fi as SelectField, Aa as SelectFilter, Si as TextAreaField, ga as TextColumn, xi as TextField, $n as TextFilter, tt as ThemeSwitch, nt as ThemeToolbar, Pi as TimeField, kn as applyInMemoryListParams, Q as asStringMessages, Sr as buildFormPayload, Cr as buildInlineRowsPayload, Mr as buildResourceFormSubmitBody, 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, si 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, ra as useChoices, Yt as useDataProvider, Zr as useListQueryState, mt as usePermissions, pr as useRegisterPayloadField, mr as useRegisterSectionField, $r as useResourceListContext, Ze as useThemeMode };
|