ding-react-admin 2.1.0 → 2.2.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/README.md +1 -1
- package/dist/index.js +853 -778
- package/dist/src/components/AppHub.d.ts +8 -1
- package/dist/src/components/AppHub.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/layouts/navFilter.d.ts +13 -1
- package/dist/src/layouts/navFilter.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/AppHub.tsx +118 -26
- package/src/index.ts +7 -0
- package/src/layouts/navFilter.ts +50 -1
package/dist/index.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { Children as e, createContext as t, createElement as n, forwardRef as r, isValidElement as i, useCallback as a, useContext as o, useEffect as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
2
2
|
import { Link as f, Navigate as p, Outlet as m, RouterProvider as h, createBrowserRouter as g, useLocation as _, useNavigate as v, useParams as y, useSearchParams as b } from "react-router-dom";
|
|
3
|
-
import { Alert as x, App as S, Avatar as C, Button as w, Card as T, Col as E, ConfigProvider as D, DatePicker as O, Drawer as k, Dropdown as
|
|
3
|
+
import { Alert as x, App as S, Avatar as C, Button as w, Card as T, Col as E, ConfigProvider as D, DatePicker as O, Drawer as k, Dropdown as A, Flex as j, Form as M, Grid as ee, Image as N, Input as P, InputNumber as F, Layout as I, List as te, Menu as L, Modal as ne, Pagination as re, Popover as ie, Row as R, Segmented as ae, Select as z, Space as B, Spin as oe, Steps as V, Switch as se, Table as ce, Tabs as H, TimePicker as le, Tooltip as U, Typography as W, theme as G } from "antd";
|
|
4
4
|
import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
5
|
-
import { AppstoreOutlined as
|
|
6
|
-
import { Controller as
|
|
7
|
-
import
|
|
5
|
+
import { AppstoreOutlined as ue, ArrowLeftOutlined as de, CaretDownOutlined as fe, CaretUpOutlined as pe, ColumnHeightOutlined as me, DeleteOutlined as he, DesktopOutlined as ge, EditOutlined as _e, LayoutOutlined as ve, LogoutOutlined as ye, MenuOutlined as be, MoonOutlined as xe, PaperClipOutlined as Se, PlusOutlined as Ce, SearchOutlined as we, SettingOutlined as Y, SunOutlined as Te, UploadOutlined as Ee, UserOutlined as De } from "@ant-design/icons";
|
|
6
|
+
import { Controller as Oe, FormProvider as ke, useFieldArray as Ae, useForm as je, useFormContext as Me, useFormState as Ne, useWatch as Pe } from "react-hook-form";
|
|
7
|
+
import Fe from "dayjs";
|
|
8
8
|
import './index.css';//#region \0rolldown/runtime.js
|
|
9
|
-
var
|
|
10
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i =
|
|
9
|
+
var Ie = Object.create, Le = Object.defineProperty, Re = Object.getOwnPropertyDescriptor, ze = Object.getOwnPropertyNames, Be = Object.getPrototypeOf, Ve = Object.prototype.hasOwnProperty, He = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), Ue = (e, t, n, r) => {
|
|
10
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = ze(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Ve.call(e, s) && s !== n && Le(e, s, {
|
|
11
11
|
get: ((e) => t[e]).bind(null, s),
|
|
12
|
-
enumerable: !(r =
|
|
12
|
+
enumerable: !(r = Re(t, s)) || r.enumerable
|
|
13
13
|
});
|
|
14
14
|
return e;
|
|
15
|
-
},
|
|
15
|
+
}, We = (e, t, n) => (n = e == null ? {} : Ie(Be(e)), Ue(t || !e || !e.__esModule ? Le(n, "default", {
|
|
16
16
|
value: e,
|
|
17
17
|
enumerable: !0
|
|
18
|
-
}) : n, e)),
|
|
19
|
-
function
|
|
18
|
+
}) : n, e)), Ge = t(null);
|
|
19
|
+
function Ke(e) {
|
|
20
20
|
try {
|
|
21
21
|
let t = localStorage.getItem(e);
|
|
22
22
|
if (t === "light" || t === "dark" || t === "system") return t;
|
|
23
23
|
} catch {}
|
|
24
24
|
return "system";
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function qe() {
|
|
27
27
|
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Je(e) {
|
|
30
30
|
try {
|
|
31
31
|
let t = localStorage.getItem(e);
|
|
32
32
|
if (t === "comfortable" || t === "compact") return t;
|
|
33
33
|
} catch {}
|
|
34
34
|
return "compact";
|
|
35
35
|
}
|
|
36
|
-
var
|
|
37
|
-
function
|
|
38
|
-
let [r, i] = d(() =>
|
|
36
|
+
var Ye = "ding-react-admin-theme-mode", Xe = "ding-react-admin-theme-density";
|
|
37
|
+
function Ze({ children: e, modeStorageKey: t = Ye, densityStorageKey: n = Xe }) {
|
|
38
|
+
let [r, i] = d(() => Ke(t)), [a, o] = d(() => Je(n)), [c, u] = d(qe);
|
|
39
39
|
s(() => {
|
|
40
40
|
if (r !== "system") return;
|
|
41
41
|
let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => u(e.matches);
|
|
@@ -67,7 +67,7 @@ function Xe({ children: e, modeStorageKey: t = Je, densityStorageKey: n = Ye })
|
|
|
67
67
|
f,
|
|
68
68
|
p
|
|
69
69
|
]);
|
|
70
|
-
return /* @__PURE__ */ q(
|
|
70
|
+
return /* @__PURE__ */ q(Ge.Provider, {
|
|
71
71
|
value: g,
|
|
72
72
|
children: /* @__PURE__ */ q(D, {
|
|
73
73
|
theme: h,
|
|
@@ -75,86 +75,86 @@ function Xe({ children: e, modeStorageKey: t = Je, densityStorageKey: n = Ye })
|
|
|
75
75
|
})
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
let e = o(
|
|
78
|
+
function Qe() {
|
|
79
|
+
let e = o(Ge);
|
|
80
80
|
if (!e) throw Error("useThemeMode must be used within AppThemeProvider");
|
|
81
81
|
return e;
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region src/components/DensitySwitch.tsx
|
|
85
|
-
var
|
|
85
|
+
var $e = [{
|
|
86
86
|
label: "Comfortable",
|
|
87
87
|
value: "comfortable",
|
|
88
|
-
icon: /* @__PURE__ */ q(
|
|
88
|
+
icon: /* @__PURE__ */ q(ve, {})
|
|
89
89
|
}, {
|
|
90
90
|
label: "Compact",
|
|
91
91
|
value: "compact",
|
|
92
|
-
icon: /* @__PURE__ */ q(
|
|
92
|
+
icon: /* @__PURE__ */ q(me, {})
|
|
93
93
|
}];
|
|
94
|
-
function
|
|
95
|
-
let { density: e, setDensity: t } =
|
|
96
|
-
return /* @__PURE__ */ q(
|
|
94
|
+
function et() {
|
|
95
|
+
let { density: e, setDensity: t } = Qe();
|
|
96
|
+
return /* @__PURE__ */ q(ae, {
|
|
97
97
|
size: "small",
|
|
98
98
|
value: e,
|
|
99
|
-
options:
|
|
99
|
+
options: $e,
|
|
100
100
|
onChange: (e) => t(e)
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
//#endregion
|
|
104
104
|
//#region src/components/ThemeSwitch.tsx
|
|
105
|
-
var
|
|
105
|
+
var tt = [
|
|
106
106
|
{
|
|
107
107
|
label: "Light",
|
|
108
108
|
value: "light",
|
|
109
|
-
icon: /* @__PURE__ */ q(
|
|
109
|
+
icon: /* @__PURE__ */ q(Te, {})
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
label: "Dark",
|
|
113
113
|
value: "dark",
|
|
114
|
-
icon: /* @__PURE__ */ q(
|
|
114
|
+
icon: /* @__PURE__ */ q(xe, {})
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
label: "Auto",
|
|
118
118
|
value: "system",
|
|
119
|
-
icon: /* @__PURE__ */ q(
|
|
119
|
+
icon: /* @__PURE__ */ q(ge, {})
|
|
120
120
|
}
|
|
121
121
|
];
|
|
122
|
-
function
|
|
123
|
-
let { mode: e, setMode: t } =
|
|
124
|
-
return /* @__PURE__ */ q(
|
|
122
|
+
function nt() {
|
|
123
|
+
let { mode: e, setMode: t } = Qe();
|
|
124
|
+
return /* @__PURE__ */ q(ae, {
|
|
125
125
|
size: "small",
|
|
126
126
|
value: e,
|
|
127
|
-
options:
|
|
127
|
+
options: tt,
|
|
128
128
|
onChange: (e) => t(e)
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
//#endregion
|
|
132
132
|
//#region src/components/ThemeToolbar.tsx
|
|
133
|
-
function
|
|
133
|
+
function rt() {
|
|
134
134
|
let { token: e } = G.useToken();
|
|
135
135
|
return /* @__PURE__ */ q(ie, {
|
|
136
|
-
placement:
|
|
136
|
+
placement: ee.useBreakpoint().lg ? "bottomRight" : "bottom",
|
|
137
137
|
trigger: "click",
|
|
138
|
-
content: /* @__PURE__ */ J(
|
|
138
|
+
content: /* @__PURE__ */ J(B, {
|
|
139
139
|
orientation: "vertical",
|
|
140
140
|
size: "middle",
|
|
141
141
|
style: {
|
|
142
142
|
minWidth: 240,
|
|
143
143
|
maxWidth: "min(92vw, 320px)"
|
|
144
144
|
},
|
|
145
|
-
children: [/* @__PURE__ */ q(
|
|
145
|
+
children: [/* @__PURE__ */ q(nt, {}), /* @__PURE__ */ q(et, {})]
|
|
146
146
|
}),
|
|
147
147
|
styles: { content: { padding: e.paddingSM } },
|
|
148
148
|
children: /* @__PURE__ */ q(w, {
|
|
149
149
|
type: "default",
|
|
150
|
-
icon: /* @__PURE__ */ q(
|
|
150
|
+
icon: /* @__PURE__ */ q(Y, {}),
|
|
151
151
|
"aria-label": "Display and theme settings"
|
|
152
152
|
})
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
//#endregion
|
|
156
156
|
//#region src/components/NavMenuSearch.tsx
|
|
157
|
-
function
|
|
157
|
+
function it({ value: e, onChange: t, placeholder: n = "Search menu…", variant: r = "on-dark" }) {
|
|
158
158
|
let { token: i } = G.useToken(), a = r === "on-dark";
|
|
159
159
|
return /* @__PURE__ */ q("div", {
|
|
160
160
|
style: {
|
|
@@ -164,7 +164,7 @@ function rt({ value: e, onChange: t, placeholder: n = "Search menu…", variant:
|
|
|
164
164
|
},
|
|
165
165
|
children: /* @__PURE__ */ q(D, {
|
|
166
166
|
theme: a ? { token: { colorTextPlaceholder: "rgba(255, 255, 255, 0.45)" } } : void 0,
|
|
167
|
-
children: /* @__PURE__ */ q(
|
|
167
|
+
children: /* @__PURE__ */ q(P, {
|
|
168
168
|
allowClear: !0,
|
|
169
169
|
size: "small",
|
|
170
170
|
value: e,
|
|
@@ -172,7 +172,7 @@ function rt({ value: e, onChange: t, placeholder: n = "Search menu…", variant:
|
|
|
172
172
|
t(e.target.value);
|
|
173
173
|
},
|
|
174
174
|
placeholder: n,
|
|
175
|
-
prefix: /* @__PURE__ */ q(
|
|
175
|
+
prefix: /* @__PURE__ */ q(we, { style: { color: a ? "rgba(255, 255, 255, 0.45)" : i.colorTextDescription } }),
|
|
176
176
|
"aria-label": n,
|
|
177
177
|
styles: {
|
|
178
178
|
input: a ? { color: "rgba(255, 255, 255, 0.88)" } : void 0,
|
|
@@ -189,7 +189,7 @@ function rt({ value: e, onChange: t, placeholder: n = "Search menu…", variant:
|
|
|
189
189
|
}
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/components/ScrollableArea.tsx
|
|
192
|
-
var
|
|
192
|
+
var at = r(function({ children: e, className: t, style: n, variant: r = "default" }, i) {
|
|
193
193
|
let { token: a } = G.useToken(), o = r === "on-dark" ? "rgba(255, 255, 255, 0.22)" : a.colorTextQuaternary, s = r === "on-dark" ? "rgba(255, 255, 255, 0.38)" : a.colorTextTertiary;
|
|
194
194
|
return /* @__PURE__ */ q("div", {
|
|
195
195
|
ref: i,
|
|
@@ -202,15 +202,15 @@ var it = r(function({ children: e, className: t, style: n, variant: r = "default
|
|
|
202
202
|
},
|
|
203
203
|
children: e
|
|
204
204
|
});
|
|
205
|
-
}),
|
|
206
|
-
function
|
|
207
|
-
return e.getUserLabel?.() ??
|
|
205
|
+
}), ot = t(null), st = "User";
|
|
206
|
+
function ct(e) {
|
|
207
|
+
return e.getUserLabel?.() ?? st;
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
let [n, r] = d(() => t.getToken()), [i, o] = d(() =>
|
|
211
|
-
await t.login(e), r(t.getToken()), o(
|
|
209
|
+
function lt({ children: e, adapter: t }) {
|
|
210
|
+
let [n, r] = d(() => t.getToken()), [i, o] = d(() => ct(t)), s = a(async (e) => {
|
|
211
|
+
await t.login(e), r(t.getToken()), o(ct(t));
|
|
212
212
|
}, [t]), c = a(() => {
|
|
213
|
-
t.logout(), r(t.getToken()), o(
|
|
213
|
+
t.logout(), r(t.getToken()), o(ct(t));
|
|
214
214
|
}, [t]), u = l(() => ({
|
|
215
215
|
isAuthenticated: !!n,
|
|
216
216
|
userLabel: i,
|
|
@@ -222,18 +222,18 @@ function ct({ children: e, adapter: t }) {
|
|
|
222
222
|
s,
|
|
223
223
|
c
|
|
224
224
|
]);
|
|
225
|
-
return /* @__PURE__ */ q(
|
|
225
|
+
return /* @__PURE__ */ q(ot.Provider, {
|
|
226
226
|
value: u,
|
|
227
227
|
children: e
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
|
-
function
|
|
231
|
-
let e = o(
|
|
230
|
+
function ut() {
|
|
231
|
+
let e = o(ot);
|
|
232
232
|
if (!e) throw Error("useAuth must be used within AuthProvider");
|
|
233
233
|
return e;
|
|
234
234
|
}
|
|
235
|
-
var
|
|
236
|
-
function
|
|
235
|
+
var dt = "ding-react-admin-auth";
|
|
236
|
+
function ft(e = dt) {
|
|
237
237
|
return {
|
|
238
238
|
async login({ username: t, password: n }) {
|
|
239
239
|
if (!t.trim() || !n) throw Error("Invalid credentials");
|
|
@@ -249,39 +249,39 @@ function dt(e = ut) {
|
|
|
249
249
|
}
|
|
250
250
|
//#endregion
|
|
251
251
|
//#region src/context/PermissionsProvider.tsx
|
|
252
|
-
var
|
|
253
|
-
function
|
|
252
|
+
var pt = t(null);
|
|
253
|
+
function mt({ children: e, can: t }) {
|
|
254
254
|
let n = l(() => t, [t]);
|
|
255
|
-
return /* @__PURE__ */ q(
|
|
255
|
+
return /* @__PURE__ */ q(pt.Provider, {
|
|
256
256
|
value: n,
|
|
257
257
|
children: e
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
260
|
function X() {
|
|
261
|
-
let e = o(
|
|
261
|
+
let e = o(pt);
|
|
262
262
|
if (!e) throw Error("usePermissions must be used within PermissionsProvider");
|
|
263
263
|
return e;
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function ht(e) {
|
|
266
266
|
return (t) => e()?.includes(t) ?? !1;
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function gt(e) {
|
|
269
269
|
let t = X();
|
|
270
270
|
return a(() => t(e), [t, e]);
|
|
271
271
|
}
|
|
272
272
|
//#endregion
|
|
273
273
|
//#region src/layouts/navFilter.ts
|
|
274
|
-
function
|
|
274
|
+
function _t(e) {
|
|
275
275
|
let { label: t } = e;
|
|
276
276
|
return typeof t == "string" ? t : typeof t == "number" ? String(t) : "";
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function vt(e, t) {
|
|
279
279
|
let n = t.trim().toLowerCase();
|
|
280
280
|
if (!n) return e;
|
|
281
281
|
function r(e) {
|
|
282
282
|
let t = [];
|
|
283
283
|
for (let i of e) {
|
|
284
|
-
let e =
|
|
284
|
+
let e = _t(i).toLowerCase().includes(n);
|
|
285
285
|
if (i.children?.length) {
|
|
286
286
|
let n = r(i.children);
|
|
287
287
|
e ? t.push(i) : n.length > 0 && t.push({
|
|
@@ -294,7 +294,26 @@ function _t(e, t) {
|
|
|
294
294
|
}
|
|
295
295
|
return r(e);
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function yt(e, t) {
|
|
298
|
+
let n = t?.group, r = [];
|
|
299
|
+
function i(e) {
|
|
300
|
+
for (let t of e) t.children?.length ? i(t.children) : r.push({
|
|
301
|
+
path: t.path,
|
|
302
|
+
label: t.label,
|
|
303
|
+
Icon: t.Icon,
|
|
304
|
+
group: n
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
return i(e), r;
|
|
308
|
+
}
|
|
309
|
+
function bt(e, t) {
|
|
310
|
+
let n = t.trim().toLowerCase();
|
|
311
|
+
return n ? e.filter((e) => {
|
|
312
|
+
let t = _t(e).toLowerCase(), r = (e.group ?? "").toLowerCase();
|
|
313
|
+
return t.includes(n) || r.includes(n);
|
|
314
|
+
}) : [];
|
|
315
|
+
}
|
|
316
|
+
function xt(e) {
|
|
298
317
|
let t = [];
|
|
299
318
|
function n(e) {
|
|
300
319
|
for (let r of e) r.children?.length && (t.push(r.path), n(r.children));
|
|
@@ -303,7 +322,7 @@ function vt(e) {
|
|
|
303
322
|
}
|
|
304
323
|
//#endregion
|
|
305
324
|
//#region src/components/NavMenuLabel.tsx
|
|
306
|
-
function
|
|
325
|
+
function St({ label: e, title: t }) {
|
|
307
326
|
return t ? /* @__PURE__ */ q(U, {
|
|
308
327
|
title: t,
|
|
309
328
|
placement: "right",
|
|
@@ -320,13 +339,13 @@ function yt({ label: e, title: t }) {
|
|
|
320
339
|
}
|
|
321
340
|
//#endregion
|
|
322
341
|
//#region src/layouts/navMenuItems.tsx
|
|
323
|
-
function
|
|
342
|
+
function Ct(e, t) {
|
|
324
343
|
let n = t?.showLabelTooltip !== !1, r = t?.wrapLabels === !0, i = t?.collapsed === !0;
|
|
325
344
|
return e.map((e) => {
|
|
326
|
-
let a = e.Icon, o = a ? /* @__PURE__ */ q(a, {}) : void 0, s =
|
|
345
|
+
let a = e.Icon, o = a ? /* @__PURE__ */ q(a, {}) : void 0, s = _t(e), c = s && n ? /* @__PURE__ */ q(St, {
|
|
327
346
|
label: e.label,
|
|
328
347
|
title: s
|
|
329
|
-
}) : r ? /* @__PURE__ */ q(
|
|
348
|
+
}) : r ? /* @__PURE__ */ q(St, {
|
|
330
349
|
label: e.label,
|
|
331
350
|
title: ""
|
|
332
351
|
}) : e.label, l = i && s ? { title: s } : {};
|
|
@@ -335,7 +354,7 @@ function bt(e, t) {
|
|
|
335
354
|
icon: o,
|
|
336
355
|
label: c,
|
|
337
356
|
...l,
|
|
338
|
-
children:
|
|
357
|
+
children: Ct(e.children, t)
|
|
339
358
|
} : {
|
|
340
359
|
key: e.path,
|
|
341
360
|
icon: o,
|
|
@@ -351,10 +370,10 @@ function Z(e, t, n) {
|
|
|
351
370
|
let r = t[n];
|
|
352
371
|
return n === "read" && !r && (r = t.list), r ? e(r) : !1;
|
|
353
372
|
}
|
|
354
|
-
function
|
|
373
|
+
function wt(e, t) {
|
|
355
374
|
return e.map((e) => {
|
|
356
375
|
if (e.children?.length) {
|
|
357
|
-
let n =
|
|
376
|
+
let n = wt(e.children, t);
|
|
358
377
|
return n.length === 0 ? null : {
|
|
359
378
|
...e,
|
|
360
379
|
children: n
|
|
@@ -365,25 +384,25 @@ function xt(e, t) {
|
|
|
365
384
|
}
|
|
366
385
|
//#endregion
|
|
367
386
|
//#region src/layouts/AdminLayout.tsx
|
|
368
|
-
var
|
|
369
|
-
function
|
|
387
|
+
var Tt = "#001529", Et = "ding-react-admin-sider-collapsed";
|
|
388
|
+
function Dt(e) {
|
|
370
389
|
try {
|
|
371
390
|
return localStorage.getItem(e) === "1";
|
|
372
391
|
} catch {
|
|
373
392
|
return !1;
|
|
374
393
|
}
|
|
375
394
|
}
|
|
376
|
-
function
|
|
377
|
-
return
|
|
395
|
+
function Ot() {
|
|
396
|
+
return ee.useBreakpoint().lg !== !0;
|
|
378
397
|
}
|
|
379
|
-
function
|
|
398
|
+
function kt(e) {
|
|
380
399
|
let t = /* @__PURE__ */ new Set();
|
|
381
400
|
function n(e) {
|
|
382
401
|
for (let r of e) r.children?.length ? n(r.children) : t.add(r.path);
|
|
383
402
|
}
|
|
384
403
|
return n(e), t;
|
|
385
404
|
}
|
|
386
|
-
function
|
|
405
|
+
function At(e, t) {
|
|
387
406
|
function n(e) {
|
|
388
407
|
for (let r of e) if (r.children?.length) {
|
|
389
408
|
let e = n(r.children);
|
|
@@ -393,17 +412,17 @@ function Dt(e, t) {
|
|
|
393
412
|
}
|
|
394
413
|
return n(e) ?? [];
|
|
395
414
|
}
|
|
396
|
-
function
|
|
415
|
+
function jt({ wrapLabels: e, itemDivider: t = "none" }) {
|
|
397
416
|
let n = ["ding-admin-nav-menu"];
|
|
398
417
|
return e && n.push("ding-admin-nav-menu--wrap-labels"), t === "full" ? n.push("ding-admin-nav-menu--item-divider-full") : t === "inset" && n.push("ding-admin-nav-menu--item-divider-inset"), n.join(" ");
|
|
399
418
|
}
|
|
400
|
-
function
|
|
401
|
-
return /* @__PURE__ */ J(K, { children: [c && !n ? /* @__PURE__ */ q(
|
|
419
|
+
function Mt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, onOpenChange: i, onNavigate: a, navQuery: o, onNavQueryChange: s, showNavSearch: c, navSearchPlaceholder: l, scrollVariant: u, searchVariant: d, wrapLabels: f, itemDivider: p }) {
|
|
420
|
+
return /* @__PURE__ */ J(K, { children: [c && !n ? /* @__PURE__ */ q(it, {
|
|
402
421
|
value: o,
|
|
403
422
|
onChange: s,
|
|
404
423
|
placeholder: l,
|
|
405
424
|
variant: d
|
|
406
|
-
}) : null, /* @__PURE__ */ q(
|
|
425
|
+
}) : null, /* @__PURE__ */ q(at, {
|
|
407
426
|
variant: u,
|
|
408
427
|
style: {
|
|
409
428
|
flex: 1,
|
|
@@ -411,7 +430,7 @@ function kt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
411
430
|
overflowY: "auto",
|
|
412
431
|
overflowX: "hidden"
|
|
413
432
|
},
|
|
414
|
-
children: /* @__PURE__ */ q(
|
|
433
|
+
children: /* @__PURE__ */ q(Nt, {
|
|
415
434
|
menuItems: e,
|
|
416
435
|
selectedKeys: t,
|
|
417
436
|
inlineCollapsed: n,
|
|
@@ -423,9 +442,9 @@ function kt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
423
442
|
})
|
|
424
443
|
})] });
|
|
425
444
|
}
|
|
426
|
-
function
|
|
427
|
-
return /* @__PURE__ */ q(
|
|
428
|
-
className:
|
|
445
|
+
function Nt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, onOpenChange: i, onNavigate: a, wrapLabels: o, itemDivider: s }) {
|
|
446
|
+
return /* @__PURE__ */ q(L, {
|
|
447
|
+
className: jt({
|
|
429
448
|
wrapLabels: o,
|
|
430
449
|
itemDivider: s
|
|
431
450
|
}),
|
|
@@ -449,79 +468,79 @@ function At({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
449
468
|
}
|
|
450
469
|
});
|
|
451
470
|
}
|
|
452
|
-
function
|
|
453
|
-
let b = v(), x = _(), { resolved: S } =
|
|
471
|
+
function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDrawerTitle: r, headerExtras: i, userMenuItems: o, onUserMenuClick: c, loginPath: f = "/login", siderCollapsedStorageKey: p = Et, navSearch: h = !0, navMenu: g, hideSider: y = !1 }) {
|
|
472
|
+
let b = v(), x = _(), { resolved: S } = Qe(), T = S === "dark", { logout: E, userLabel: D } = ut(), O = X(), [j, M] = d(() => Dt(p)), [ee, N] = d(!1), P = Ot(), { token: F } = G.useToken(), te = u(null), [L, ne] = d(""), re = h !== !1, ie = typeof h == "object" ? h.placeholder : void 0, R = g?.wrapLabels !== !1, ae = g?.itemDivider ?? "inset", z = r ?? t, B = () => {
|
|
454
473
|
E(), b(f, { replace: !0 });
|
|
455
474
|
}, oe = a((e) => {
|
|
456
|
-
|
|
475
|
+
M(e);
|
|
457
476
|
try {
|
|
458
477
|
localStorage.setItem(p, e ? "1" : "0");
|
|
459
478
|
} catch {}
|
|
460
479
|
}, [p]);
|
|
461
480
|
s(() => {
|
|
462
|
-
|
|
463
|
-
}, [
|
|
464
|
-
|
|
481
|
+
P || N(!1);
|
|
482
|
+
}, [P]), s(() => {
|
|
483
|
+
N(!1);
|
|
465
484
|
}, [x.pathname]), s(() => {
|
|
466
|
-
|
|
485
|
+
te.current?.scrollTo({
|
|
467
486
|
top: 0,
|
|
468
487
|
left: 0
|
|
469
488
|
});
|
|
470
489
|
}, [x.pathname]), s(() => {
|
|
471
|
-
|
|
472
|
-
}, [
|
|
473
|
-
let V = l(() =>
|
|
490
|
+
j && ne("");
|
|
491
|
+
}, [j]);
|
|
492
|
+
let V = l(() => wt(e, O), [e, O]), se = L.trim(), ce = se.length > 0, H = l(() => ce ? vt(V, se) : V, [
|
|
474
493
|
V,
|
|
475
494
|
se,
|
|
476
495
|
ce
|
|
477
|
-
]),
|
|
478
|
-
showLabelTooltip: !
|
|
479
|
-
wrapLabels:
|
|
480
|
-
collapsed:
|
|
496
|
+
]), le = l(() => kt(H), [H]), U = l(() => Ct(H, {
|
|
497
|
+
showLabelTooltip: !j && !R,
|
|
498
|
+
wrapLabels: R && !j,
|
|
499
|
+
collapsed: j
|
|
481
500
|
}), [
|
|
482
501
|
H,
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
]),
|
|
502
|
+
j,
|
|
503
|
+
R
|
|
504
|
+
]), K = l(() => xt(H), [H]), ue = l(() => At(V, x.pathname), [V, x.pathname]), [de, fe] = d(() => At(V, x.pathname));
|
|
486
505
|
s(() => {
|
|
487
506
|
fe((e) => [...new Set([...e, ...ue])]);
|
|
488
507
|
}, [ue]);
|
|
489
508
|
let pe = a((e) => {
|
|
490
509
|
fe(e);
|
|
491
|
-
}, []), me = ce ?
|
|
492
|
-
|
|
510
|
+
}, []), me = ce ? K : de, he = a((e) => {
|
|
511
|
+
ne(e);
|
|
493
512
|
}, []), ge = l(() => [{
|
|
494
513
|
key: "logout",
|
|
495
|
-
icon: /* @__PURE__ */ q(
|
|
514
|
+
icon: /* @__PURE__ */ q(ye, {}),
|
|
496
515
|
label: "Log out",
|
|
497
516
|
danger: !0
|
|
498
|
-
}], []), _e = o ?? ge,
|
|
517
|
+
}], []), _e = o ?? ge, ve = (e) => {
|
|
499
518
|
if (c) {
|
|
500
519
|
c(e);
|
|
501
520
|
return;
|
|
502
521
|
}
|
|
503
522
|
e.key === "logout" && B();
|
|
504
|
-
}, xe = T ?
|
|
505
|
-
|
|
523
|
+
}, xe = T ? F.colorBgContainer : Tt, Se = T ? "default" : "on-dark", Ce = T ? "app" : "on-dark", we = [x.pathname], Y = (e) => {
|
|
524
|
+
le.has(e) && (b(e), P && N(!1));
|
|
506
525
|
};
|
|
507
|
-
return /* @__PURE__ */ J(
|
|
526
|
+
return /* @__PURE__ */ J(I, {
|
|
508
527
|
style: {
|
|
509
528
|
height: "100vh",
|
|
510
529
|
width: "100%",
|
|
511
530
|
overflow: "hidden",
|
|
512
|
-
background:
|
|
531
|
+
background: F.colorBgLayout
|
|
513
532
|
},
|
|
514
533
|
children: [
|
|
515
|
-
!y && !
|
|
534
|
+
!y && !P && /* @__PURE__ */ q(I.Sider, {
|
|
516
535
|
collapsible: !0,
|
|
517
|
-
collapsed:
|
|
536
|
+
collapsed: j,
|
|
518
537
|
onCollapse: oe,
|
|
519
538
|
collapsedWidth: 64,
|
|
520
539
|
style: {
|
|
521
540
|
background: xe,
|
|
522
541
|
height: "100vh",
|
|
523
542
|
overflow: "hidden",
|
|
524
|
-
borderInlineEnd: T ? `1px solid ${
|
|
543
|
+
borderInlineEnd: T ? `1px solid ${F.colorSplit}` : void 0
|
|
525
544
|
},
|
|
526
545
|
children: /* @__PURE__ */ J("div", {
|
|
527
546
|
style: {
|
|
@@ -541,41 +560,41 @@ function jt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
541
560
|
},
|
|
542
561
|
children: /* @__PURE__ */ q(W.Text, {
|
|
543
562
|
strong: !0,
|
|
544
|
-
style: { color:
|
|
545
|
-
children:
|
|
563
|
+
style: { color: F.colorTextLightSolid },
|
|
564
|
+
children: j ? n : t
|
|
546
565
|
})
|
|
547
|
-
}), /* @__PURE__ */ q(
|
|
548
|
-
menuItems:
|
|
566
|
+
}), /* @__PURE__ */ q(Mt, {
|
|
567
|
+
menuItems: U,
|
|
549
568
|
selectedKeys: we,
|
|
550
|
-
inlineCollapsed:
|
|
569
|
+
inlineCollapsed: j,
|
|
551
570
|
openKeys: me,
|
|
552
571
|
onOpenChange: pe,
|
|
553
572
|
onNavigate: Y,
|
|
554
|
-
navQuery:
|
|
573
|
+
navQuery: L,
|
|
555
574
|
onNavQueryChange: he,
|
|
556
|
-
showNavSearch:
|
|
557
|
-
navSearchPlaceholder:
|
|
575
|
+
showNavSearch: re,
|
|
576
|
+
navSearchPlaceholder: ie,
|
|
558
577
|
scrollVariant: Se,
|
|
559
578
|
searchVariant: Ce,
|
|
560
|
-
wrapLabels:
|
|
561
|
-
itemDivider:
|
|
579
|
+
wrapLabels: R,
|
|
580
|
+
itemDivider: ae
|
|
562
581
|
})]
|
|
563
582
|
})
|
|
564
583
|
}),
|
|
565
|
-
!y &&
|
|
584
|
+
!y && P && /* @__PURE__ */ q(k, {
|
|
566
585
|
title: /* @__PURE__ */ q(W.Text, {
|
|
567
586
|
strong: !0,
|
|
568
|
-
style: { color:
|
|
587
|
+
style: { color: F.colorTextLightSolid },
|
|
569
588
|
children: z
|
|
570
589
|
}),
|
|
571
590
|
placement: "left",
|
|
572
591
|
size: 280,
|
|
573
|
-
onClose: () =>
|
|
574
|
-
open:
|
|
592
|
+
onClose: () => N(!1),
|
|
593
|
+
open: ee,
|
|
575
594
|
styles: {
|
|
576
595
|
header: {
|
|
577
596
|
background: xe,
|
|
578
|
-
borderBottom: `1px solid ${
|
|
597
|
+
borderBottom: `1px solid ${F.colorSplit}`
|
|
579
598
|
},
|
|
580
599
|
body: {
|
|
581
600
|
padding: 0,
|
|
@@ -590,25 +609,25 @@ function jt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
590
609
|
height: "100%",
|
|
591
610
|
overflow: "hidden"
|
|
592
611
|
},
|
|
593
|
-
children: /* @__PURE__ */ q(
|
|
594
|
-
menuItems:
|
|
612
|
+
children: /* @__PURE__ */ q(Mt, {
|
|
613
|
+
menuItems: U,
|
|
595
614
|
selectedKeys: we,
|
|
596
615
|
inlineCollapsed: !1,
|
|
597
616
|
openKeys: me,
|
|
598
617
|
onOpenChange: pe,
|
|
599
618
|
onNavigate: Y,
|
|
600
|
-
navQuery:
|
|
619
|
+
navQuery: L,
|
|
601
620
|
onNavQueryChange: he,
|
|
602
|
-
showNavSearch:
|
|
603
|
-
navSearchPlaceholder:
|
|
621
|
+
showNavSearch: re,
|
|
622
|
+
navSearchPlaceholder: ie,
|
|
604
623
|
scrollVariant: Se,
|
|
605
624
|
searchVariant: Ce,
|
|
606
|
-
wrapLabels:
|
|
607
|
-
itemDivider:
|
|
625
|
+
wrapLabels: R,
|
|
626
|
+
itemDivider: ae
|
|
608
627
|
})
|
|
609
628
|
})
|
|
610
629
|
}),
|
|
611
|
-
/* @__PURE__ */ J(
|
|
630
|
+
/* @__PURE__ */ J(I, {
|
|
612
631
|
style: {
|
|
613
632
|
minWidth: 0,
|
|
614
633
|
flex: 1,
|
|
@@ -617,21 +636,21 @@ function jt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
617
636
|
display: "flex",
|
|
618
637
|
flexDirection: "column"
|
|
619
638
|
},
|
|
620
|
-
children: [/* @__PURE__ */ J(
|
|
639
|
+
children: [/* @__PURE__ */ J(I.Header, {
|
|
621
640
|
style: {
|
|
622
|
-
background:
|
|
623
|
-
paddingInline:
|
|
641
|
+
background: F.colorBgContainer,
|
|
642
|
+
paddingInline: F.paddingLG,
|
|
624
643
|
display: "flex",
|
|
625
644
|
alignItems: "center",
|
|
626
|
-
gap:
|
|
645
|
+
gap: F.marginSM,
|
|
627
646
|
lineHeight: "normal",
|
|
628
647
|
flexShrink: 0
|
|
629
648
|
},
|
|
630
649
|
children: [
|
|
631
|
-
!y &&
|
|
650
|
+
!y && P && /* @__PURE__ */ q(w, {
|
|
632
651
|
type: "text",
|
|
633
|
-
icon: /* @__PURE__ */ q(
|
|
634
|
-
onClick: () =>
|
|
652
|
+
icon: /* @__PURE__ */ q(be, {}),
|
|
653
|
+
onClick: () => N(!0),
|
|
635
654
|
"aria-label": "Open navigation"
|
|
636
655
|
}),
|
|
637
656
|
/* @__PURE__ */ q("div", { style: {
|
|
@@ -639,11 +658,11 @@ function jt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
639
658
|
minWidth: 0
|
|
640
659
|
} }),
|
|
641
660
|
i,
|
|
642
|
-
/* @__PURE__ */ q(
|
|
643
|
-
/* @__PURE__ */ q(
|
|
661
|
+
/* @__PURE__ */ q(rt, {}),
|
|
662
|
+
/* @__PURE__ */ q(A, {
|
|
644
663
|
menu: {
|
|
645
664
|
items: _e,
|
|
646
|
-
onClick:
|
|
665
|
+
onClick: ve
|
|
647
666
|
},
|
|
648
667
|
trigger: ["click"],
|
|
649
668
|
children: /* @__PURE__ */ J(w, {
|
|
@@ -651,15 +670,15 @@ function jt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
651
670
|
style: {
|
|
652
671
|
display: "inline-flex",
|
|
653
672
|
alignItems: "center",
|
|
654
|
-
gap:
|
|
655
|
-
maxWidth:
|
|
656
|
-
paddingInline:
|
|
673
|
+
gap: F.marginXS,
|
|
674
|
+
maxWidth: P ? 44 : void 0,
|
|
675
|
+
paddingInline: P ? F.paddingXS : void 0
|
|
657
676
|
},
|
|
658
677
|
"aria-label": "Account menu",
|
|
659
678
|
children: [/* @__PURE__ */ q(C, {
|
|
660
679
|
size: "small",
|
|
661
|
-
icon: /* @__PURE__ */ q(
|
|
662
|
-
}), !
|
|
680
|
+
icon: /* @__PURE__ */ q(De, {})
|
|
681
|
+
}), !P && /* @__PURE__ */ q(W.Text, {
|
|
663
682
|
type: "secondary",
|
|
664
683
|
ellipsis: !0,
|
|
665
684
|
style: { maxWidth: 160 },
|
|
@@ -668,7 +687,7 @@ function jt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
668
687
|
})
|
|
669
688
|
})
|
|
670
689
|
]
|
|
671
|
-
}), /* @__PURE__ */ q(
|
|
690
|
+
}), /* @__PURE__ */ q(I.Content, {
|
|
672
691
|
style: {
|
|
673
692
|
minWidth: 0,
|
|
674
693
|
flex: 1,
|
|
@@ -676,10 +695,10 @@ function jt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
676
695
|
display: "flex",
|
|
677
696
|
flexDirection: "column"
|
|
678
697
|
},
|
|
679
|
-
children: /* @__PURE__ */ q(
|
|
680
|
-
ref:
|
|
698
|
+
children: /* @__PURE__ */ q(at, {
|
|
699
|
+
ref: te,
|
|
681
700
|
style: {
|
|
682
|
-
margin:
|
|
701
|
+
margin: P ? F.marginSM : F.marginLG,
|
|
683
702
|
flex: 1,
|
|
684
703
|
minHeight: 0,
|
|
685
704
|
overflow: "auto"
|
|
@@ -693,30 +712,30 @@ function jt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
693
712
|
}
|
|
694
713
|
//#endregion
|
|
695
714
|
//#region src/router/guards.tsx
|
|
696
|
-
function
|
|
715
|
+
function Ft({ when: e, redirect: t, children: n }) {
|
|
697
716
|
return e ? n : /* @__PURE__ */ q(p, {
|
|
698
717
|
to: t,
|
|
699
718
|
replace: !0
|
|
700
719
|
});
|
|
701
720
|
}
|
|
702
|
-
function
|
|
703
|
-
let { isAuthenticated: n } =
|
|
704
|
-
return /* @__PURE__ */ q(
|
|
721
|
+
function It({ children: e, redirectTo: t = "/login" }) {
|
|
722
|
+
let { isAuthenticated: n } = ut();
|
|
723
|
+
return /* @__PURE__ */ q(Ft, {
|
|
705
724
|
when: n,
|
|
706
725
|
redirect: t,
|
|
707
726
|
children: e
|
|
708
727
|
});
|
|
709
728
|
}
|
|
710
|
-
function
|
|
711
|
-
let { isAuthenticated: n } =
|
|
712
|
-
return /* @__PURE__ */ q(
|
|
729
|
+
function Lt({ children: e, redirectTo: t = "/" }) {
|
|
730
|
+
let { isAuthenticated: n } = ut();
|
|
731
|
+
return /* @__PURE__ */ q(Ft, {
|
|
713
732
|
when: !n,
|
|
714
733
|
redirect: t,
|
|
715
734
|
children: e
|
|
716
735
|
});
|
|
717
736
|
}
|
|
718
|
-
function
|
|
719
|
-
return /* @__PURE__ */ q(
|
|
737
|
+
function Rt({ permission: e, redirect: t, children: n }) {
|
|
738
|
+
return /* @__PURE__ */ q(Ft, {
|
|
720
739
|
when: X()(e),
|
|
721
740
|
redirect: t,
|
|
722
741
|
children: n
|
|
@@ -724,13 +743,13 @@ function Ft({ permission: e, redirect: t, children: n }) {
|
|
|
724
743
|
}
|
|
725
744
|
//#endregion
|
|
726
745
|
//#region src/router/routeAccess.ts
|
|
727
|
-
function
|
|
746
|
+
function zt(e) {
|
|
728
747
|
return e.access ?? "protected";
|
|
729
748
|
}
|
|
730
|
-
function
|
|
749
|
+
function Bt(e) {
|
|
731
750
|
let t = [], n = [], r = [];
|
|
732
751
|
for (let i of e) {
|
|
733
|
-
let e =
|
|
752
|
+
let e = zt(i);
|
|
734
753
|
e === "guest" ? t.push(i) : e === "public" ? n.push(i) : r.push(i);
|
|
735
754
|
}
|
|
736
755
|
return {
|
|
@@ -739,24 +758,24 @@ function Lt(e) {
|
|
|
739
758
|
protected: r
|
|
740
759
|
};
|
|
741
760
|
}
|
|
742
|
-
function
|
|
761
|
+
function Vt(e) {
|
|
743
762
|
return e.replace(/^\/+/, "");
|
|
744
763
|
}
|
|
745
|
-
function
|
|
746
|
-
return `/${
|
|
764
|
+
function Ht(e) {
|
|
765
|
+
return `/${Vt(e)}`;
|
|
747
766
|
}
|
|
748
|
-
function
|
|
749
|
-
let { guest: n, protected: r } =
|
|
750
|
-
!s && i && "path" in i && i.path && (s =
|
|
767
|
+
function Ut(e, t) {
|
|
768
|
+
let { guest: n, protected: r } = Bt(e), i = n.find((e) => "path" in e && e.path), a = r.find((e) => "index" in e && e.index), o = r.find((e) => "path" in e && e.path), s = t?.unauthenticated;
|
|
769
|
+
!s && i && "path" in i && i.path && (s = Ht(i.path));
|
|
751
770
|
let c = t?.afterLogin;
|
|
752
|
-
if (c || (a ? c = "/" : o && "path" in o && o.path && (c =
|
|
771
|
+
if (c || (a ? c = "/" : o && "path" in o && o.path && (c = Ht(o.path))), r.length > 0 && !s) throw Error("createAdminRouter: protected routes require redirects.unauthenticated or a guest route (access: \"guest\").");
|
|
753
772
|
if (n.length > 0 && !c) throw Error("createAdminRouter: guest routes require redirects.afterLogin or a protected route (index or path).");
|
|
754
773
|
return {
|
|
755
774
|
loginPath: s ?? "/",
|
|
756
775
|
homePath: c ?? "/"
|
|
757
776
|
};
|
|
758
777
|
}
|
|
759
|
-
function
|
|
778
|
+
function Wt(e) {
|
|
760
779
|
return "index" in e && e.index ? {
|
|
761
780
|
index: !0,
|
|
762
781
|
element: e.element
|
|
@@ -767,30 +786,30 @@ function Vt(e) {
|
|
|
767
786
|
}
|
|
768
787
|
//#endregion
|
|
769
788
|
//#region src/router/createAdminRouter.tsx
|
|
770
|
-
function
|
|
771
|
-
let { loginPath: i, homePath: a } =
|
|
789
|
+
function Gt({ navItems: e, children: t, layoutProps: n, redirects: r }) {
|
|
790
|
+
let { loginPath: i, homePath: a } = Ut(t, r), { guest: o, public: s, protected: c } = Bt(t), l = [];
|
|
772
791
|
for (let e of o) !("path" in e) || !e.path || l.push({
|
|
773
|
-
path:
|
|
774
|
-
element: /* @__PURE__ */ q(
|
|
792
|
+
path: Vt(e.path),
|
|
793
|
+
element: /* @__PURE__ */ q(Lt, {
|
|
775
794
|
redirectTo: a,
|
|
776
795
|
children: e.element
|
|
777
796
|
})
|
|
778
797
|
});
|
|
779
798
|
for (let e of s) !("path" in e) || !e.path || l.push({
|
|
780
|
-
path:
|
|
799
|
+
path: Vt(e.path),
|
|
781
800
|
element: e.element
|
|
782
801
|
});
|
|
783
802
|
return c.length > 0 && l.push({
|
|
784
803
|
path: "/",
|
|
785
|
-
element: /* @__PURE__ */ q(
|
|
804
|
+
element: /* @__PURE__ */ q(It, {
|
|
786
805
|
redirectTo: i,
|
|
787
|
-
children: /* @__PURE__ */ q(
|
|
806
|
+
children: /* @__PURE__ */ q(Pt, {
|
|
788
807
|
navItems: e,
|
|
789
808
|
loginPath: i,
|
|
790
809
|
...n
|
|
791
810
|
})
|
|
792
811
|
}),
|
|
793
|
-
children: c.map(
|
|
812
|
+
children: c.map(Wt)
|
|
794
813
|
}), l.push({
|
|
795
814
|
path: "*",
|
|
796
815
|
element: /* @__PURE__ */ q(p, {
|
|
@@ -801,8 +820,8 @@ function Ht({ navItems: e, children: t, layoutProps: n, redirects: r }) {
|
|
|
801
820
|
}
|
|
802
821
|
//#endregion
|
|
803
822
|
//#region src/app/AdminApp.tsx
|
|
804
|
-
function
|
|
805
|
-
let a = l(() =>
|
|
823
|
+
function Kt({ navItems: e, routes: t, authRedirects: n, layoutProps: r, theme: i }) {
|
|
824
|
+
let a = l(() => Gt({
|
|
806
825
|
navItems: e,
|
|
807
826
|
children: t,
|
|
808
827
|
layoutProps: r,
|
|
@@ -813,74 +832,74 @@ function Ut({ navItems: e, routes: t, authRedirects: n, layoutProps: r, theme: i
|
|
|
813
832
|
r,
|
|
814
833
|
n
|
|
815
834
|
]);
|
|
816
|
-
return /* @__PURE__ */ q(
|
|
835
|
+
return /* @__PURE__ */ q(Ze, {
|
|
817
836
|
...i,
|
|
818
837
|
children: /* @__PURE__ */ q(h, { router: a })
|
|
819
838
|
});
|
|
820
839
|
}
|
|
821
840
|
//#endregion
|
|
822
841
|
//#region src/context/DataProvider.tsx
|
|
823
|
-
var
|
|
824
|
-
function
|
|
842
|
+
var qt = t(null);
|
|
843
|
+
function Jt({ children: e, value: t }) {
|
|
825
844
|
let n = l(() => t, [t]);
|
|
826
|
-
return /* @__PURE__ */ q(
|
|
845
|
+
return /* @__PURE__ */ q(qt.Provider, {
|
|
827
846
|
value: n,
|
|
828
847
|
children: e
|
|
829
848
|
});
|
|
830
849
|
}
|
|
831
|
-
function
|
|
832
|
-
let e = o(
|
|
850
|
+
function Yt() {
|
|
851
|
+
let e = o(qt);
|
|
833
852
|
if (!e) throw Error("useDataProvider must be used within DataProvider");
|
|
834
853
|
return e;
|
|
835
854
|
}
|
|
836
855
|
//#endregion
|
|
837
856
|
//#region src/data/resourceHandlers.ts
|
|
838
|
-
function
|
|
857
|
+
function Xt(e) {
|
|
839
858
|
return "handlers" in e ? e : { handlers: e };
|
|
840
859
|
}
|
|
841
|
-
function
|
|
860
|
+
function Zt(e, t, n) {
|
|
842
861
|
if (!(!e || !t) && !Z(e, t, n)) throw Error("Forbidden");
|
|
843
862
|
}
|
|
844
|
-
function
|
|
863
|
+
function Qt(e, t) {
|
|
845
864
|
let { can: n, guard: r, parseFormError: i } = t ?? {}, a = (t) => {
|
|
846
865
|
let n = e[t];
|
|
847
866
|
if (!n) throw Error(`Unknown resource: ${t}`);
|
|
848
|
-
return
|
|
867
|
+
return Xt(n);
|
|
849
868
|
};
|
|
850
869
|
return {
|
|
851
870
|
async getList(e, t) {
|
|
852
871
|
let { handlers: i, permissions: o } = a(e);
|
|
853
|
-
return r?.(e, "list"),
|
|
872
|
+
return r?.(e, "list"), Zt(n, o, "list"), i.getList(t);
|
|
854
873
|
},
|
|
855
874
|
async getOne(e, t, i) {
|
|
856
875
|
let { handlers: o, permissions: s } = a(e);
|
|
857
|
-
return r?.(e, "read"),
|
|
876
|
+
return r?.(e, "read"), Zt(n, s, "read"), o.getOne(t, i);
|
|
858
877
|
},
|
|
859
878
|
async create(e, t) {
|
|
860
879
|
let { handlers: i, permissions: o } = a(e);
|
|
861
|
-
return r?.(e, "add"),
|
|
880
|
+
return r?.(e, "add"), Zt(n, o, "add"), i.create(t);
|
|
862
881
|
},
|
|
863
882
|
async update(e, t) {
|
|
864
883
|
let { handlers: i, permissions: o } = a(e);
|
|
865
|
-
return r?.(e, "change"),
|
|
884
|
+
return r?.(e, "change"), Zt(n, o, "change"), i.update(t);
|
|
866
885
|
},
|
|
867
886
|
async delete(e, t) {
|
|
868
887
|
let { handlers: i, permissions: o } = a(e);
|
|
869
|
-
return r?.(e, "delete"),
|
|
888
|
+
return r?.(e, "delete"), Zt(n, o, "delete"), i.delete(t);
|
|
870
889
|
},
|
|
871
890
|
parseFormError: i
|
|
872
891
|
};
|
|
873
892
|
}
|
|
874
893
|
//#endregion
|
|
875
894
|
//#region src/data/abortError.ts
|
|
876
|
-
function
|
|
895
|
+
function $t(e) {
|
|
877
896
|
if (typeof e != "object" || !e) return !1;
|
|
878
897
|
let t = e;
|
|
879
898
|
return t.name === "AbortError" || t.name === "CanceledError" || t.code === "ERR_CANCELED";
|
|
880
899
|
}
|
|
881
900
|
//#endregion
|
|
882
901
|
//#region src/data/parseFormErrorHelpers.ts
|
|
883
|
-
var
|
|
902
|
+
var en = "Expected HTTP 400 with a JSON object such as `{ \"field_name\": [\"message\"] }` or `{ \"non_field_errors\": [\"message\"] }`.", tn = 300;
|
|
884
903
|
function Q(e) {
|
|
885
904
|
if (typeof e == "string") return [e];
|
|
886
905
|
if (Array.isArray(e)) {
|
|
@@ -889,136 +908,136 @@ function Q(e) {
|
|
|
889
908
|
}
|
|
890
909
|
return [];
|
|
891
910
|
}
|
|
892
|
-
function
|
|
911
|
+
function nn(e) {
|
|
893
912
|
return e.length === 1 ? e[0] : e;
|
|
894
913
|
}
|
|
895
|
-
function
|
|
914
|
+
function rn(e) {
|
|
896
915
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
897
916
|
}
|
|
898
|
-
function
|
|
917
|
+
function an(e) {
|
|
899
918
|
return typeof Response < "u" && e instanceof Response ? !0 : typeof e == "object" && !!e && typeof e.json == "function" && typeof e.status == "number" && e.headers != null;
|
|
900
919
|
}
|
|
901
|
-
function
|
|
920
|
+
function on(e, t) {
|
|
902
921
|
if (t) return t;
|
|
903
922
|
if (e === null) return "(no JSON body)";
|
|
904
923
|
try {
|
|
905
924
|
let t = JSON.stringify(e);
|
|
906
|
-
return t.length >
|
|
925
|
+
return t.length > tn ? `${t.slice(0, tn)}…` : t;
|
|
907
926
|
} catch {
|
|
908
927
|
return String(e);
|
|
909
928
|
}
|
|
910
929
|
}
|
|
911
|
-
function
|
|
912
|
-
return `Non-standard validation response. ${
|
|
930
|
+
function sn(e, t) {
|
|
931
|
+
return `Non-standard validation response. ${en} Received: ${on(e, t?.hint)}`;
|
|
913
932
|
}
|
|
914
|
-
function
|
|
933
|
+
function cn(e) {
|
|
915
934
|
if (!e || typeof e != "object") return null;
|
|
916
935
|
let t = e.response;
|
|
917
936
|
if (!t || typeof t != "object") return null;
|
|
918
937
|
let n = t.status;
|
|
919
938
|
return typeof n == "number" && (n === 400 || n === 422) ? n : null;
|
|
920
939
|
}
|
|
921
|
-
function
|
|
940
|
+
function ln(e) {
|
|
922
941
|
if (!e || typeof e != "object") return null;
|
|
923
942
|
let t = e.response;
|
|
924
|
-
return
|
|
943
|
+
return an(t) ? t.headers.get("content-type") : null;
|
|
925
944
|
}
|
|
926
|
-
function
|
|
945
|
+
function un(e) {
|
|
927
946
|
if (!e || typeof e != "object") return null;
|
|
928
947
|
let t = e;
|
|
929
|
-
if (
|
|
930
|
-
if (
|
|
948
|
+
if (rn(t.body)) return t.body;
|
|
949
|
+
if (rn(t.data)) return t.data;
|
|
931
950
|
let n = t.response;
|
|
932
951
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
933
952
|
let e = n.data;
|
|
934
|
-
if (
|
|
953
|
+
if (rn(e)) return e;
|
|
935
954
|
}
|
|
936
955
|
return null;
|
|
937
956
|
}
|
|
938
|
-
function
|
|
939
|
-
if (
|
|
957
|
+
function dn(e) {
|
|
958
|
+
if (rn(e)) return e;
|
|
940
959
|
if (Array.isArray(e)) {
|
|
941
960
|
let t = Q(e);
|
|
942
|
-
return t.length ? { non_field_errors:
|
|
961
|
+
return t.length ? { non_field_errors: nn(t) } : null;
|
|
943
962
|
}
|
|
944
963
|
return null;
|
|
945
964
|
}
|
|
946
|
-
async function
|
|
947
|
-
let t =
|
|
965
|
+
async function fn(e) {
|
|
966
|
+
let t = un(e);
|
|
948
967
|
if (t) return t;
|
|
949
968
|
if (!e || typeof e != "object") return null;
|
|
950
969
|
let n = e.response;
|
|
951
|
-
if (!
|
|
970
|
+
if (!an(n)) return null;
|
|
952
971
|
let r = n.headers.get("content-type");
|
|
953
972
|
if (!r || !/application\/json/i.test(r)) return null;
|
|
954
973
|
try {
|
|
955
|
-
return
|
|
974
|
+
return dn(await n.clone().json());
|
|
956
975
|
} catch {
|
|
957
976
|
return null;
|
|
958
977
|
}
|
|
959
978
|
}
|
|
960
|
-
function
|
|
979
|
+
function pn(e) {
|
|
961
980
|
return Array.isArray(e) ? e.some((e) => e && typeof e == "object" && !Array.isArray(e) && Object.values(e).some((e) => Q(e).length > 0)) : !1;
|
|
962
981
|
}
|
|
963
|
-
function
|
|
982
|
+
function mn(e, t, n) {
|
|
964
983
|
t.forEach((t, r) => {
|
|
965
984
|
if (!(!t || typeof t != "object" || Array.isArray(t))) for (let [i, a] of Object.entries(t)) {
|
|
966
985
|
let t = Q(a);
|
|
967
|
-
t.length && (n[`${e}.${r}.${i}`] =
|
|
986
|
+
t.length && (n[`${e}.${r}.${i}`] = nn(t));
|
|
968
987
|
}
|
|
969
988
|
});
|
|
970
989
|
}
|
|
971
|
-
function
|
|
990
|
+
function hn(e, t) {
|
|
972
991
|
return {
|
|
973
992
|
fields: Object.keys(e).length ? e : void 0,
|
|
974
993
|
global: t.length ? t : void 0
|
|
975
994
|
};
|
|
976
995
|
}
|
|
977
|
-
var
|
|
978
|
-
function
|
|
996
|
+
var gn = new Set(["non_field_errors", "detail"]);
|
|
997
|
+
function _n(e) {
|
|
979
998
|
let t = {}, n = [];
|
|
980
999
|
for (let [r, i] of Object.entries(e)) {
|
|
981
|
-
if (
|
|
1000
|
+
if (gn.has(r)) {
|
|
982
1001
|
n.push(...Q(i));
|
|
983
1002
|
continue;
|
|
984
1003
|
}
|
|
985
|
-
if (
|
|
986
|
-
|
|
1004
|
+
if (pn(i)) {
|
|
1005
|
+
mn(r, i, t);
|
|
987
1006
|
continue;
|
|
988
1007
|
}
|
|
989
1008
|
let e = Q(i);
|
|
990
|
-
e.length && (t[r] =
|
|
1009
|
+
e.length && (t[r] = nn(e));
|
|
991
1010
|
}
|
|
992
|
-
return !Object.keys(t).length && !n.length ? null :
|
|
1011
|
+
return !Object.keys(t).length && !n.length ? null : hn(t, n);
|
|
993
1012
|
}
|
|
994
|
-
function
|
|
995
|
-
let n =
|
|
996
|
-
return n ?
|
|
1013
|
+
function vn(e, t) {
|
|
1014
|
+
let n = un(e);
|
|
1015
|
+
return n ? _n(n) : null;
|
|
997
1016
|
}
|
|
998
|
-
function
|
|
999
|
-
let r =
|
|
1017
|
+
function yn(e, t, n) {
|
|
1018
|
+
let r = un(e);
|
|
1000
1019
|
if (!r) return null;
|
|
1001
1020
|
let i = n?.camelCase ?? !0, a = n?.fieldMap, o = {}, s = [];
|
|
1002
1021
|
n?.includeSummary && (s.push(...Q(r.title)), s.push(...Q(r.message)));
|
|
1003
1022
|
let c = r.errors;
|
|
1004
1023
|
if (c && typeof c == "object" && !Array.isArray(c)) for (let [e, t] of Object.entries(c)) {
|
|
1005
|
-
let n = a?.[e] ?? (i ?
|
|
1006
|
-
r.length && (o[n] =
|
|
1024
|
+
let n = a?.[e] ?? (i ? Sn(e) : e), r = Q(t);
|
|
1025
|
+
r.length && (o[n] = nn(r));
|
|
1007
1026
|
}
|
|
1008
|
-
return !Object.keys(o).length && !s.length ? null :
|
|
1027
|
+
return !Object.keys(o).length && !s.length ? null : hn(o, s);
|
|
1009
1028
|
}
|
|
1010
|
-
function
|
|
1011
|
-
let r =
|
|
1029
|
+
function bn(e, t, n) {
|
|
1030
|
+
let r = un(e);
|
|
1012
1031
|
if (!r) return null;
|
|
1013
1032
|
let i = {}, a = [], o = n?.fieldMap, s = r.errors;
|
|
1014
1033
|
if (Array.isArray(s)) for (let e of s) {
|
|
1015
1034
|
if (!e || typeof e != "object") continue;
|
|
1016
1035
|
let t = e, n = typeof t.path == "string" && t.path || typeof t.param == "string" && t.param || typeof t.field == "string" && t.field, r = Q(t.msg)[0] ?? Q(t.message)[0];
|
|
1017
|
-
r && (n ?
|
|
1036
|
+
r && (n ? xn(i, o?.[n] ?? n, r) : a.push(r));
|
|
1018
1037
|
}
|
|
1019
1038
|
else if (s && typeof s == "object") for (let [e, t] of Object.entries(s)) {
|
|
1020
1039
|
let n = o?.[e] ?? e, r = Q(t);
|
|
1021
|
-
r.length && (i[n] =
|
|
1040
|
+
r.length && (i[n] = nn(r));
|
|
1022
1041
|
}
|
|
1023
1042
|
let c = r.details;
|
|
1024
1043
|
if (Array.isArray(c)) for (let e of c) {
|
|
@@ -1029,9 +1048,9 @@ function _n(e, t, n) {
|
|
|
1029
1048
|
i[e] = r;
|
|
1030
1049
|
} else a.push(r);
|
|
1031
1050
|
}
|
|
1032
|
-
return a.push(...Q(r.error)), !Object.keys(i).length && !a.length ? null :
|
|
1051
|
+
return a.push(...Q(r.error)), !Object.keys(i).length && !a.length ? null : hn(i, a);
|
|
1033
1052
|
}
|
|
1034
|
-
function
|
|
1053
|
+
function xn(e, t, n) {
|
|
1035
1054
|
let r = e[t];
|
|
1036
1055
|
if (!r) {
|
|
1037
1056
|
e[t] = n;
|
|
@@ -1039,20 +1058,20 @@ function vn(e, t, n) {
|
|
|
1039
1058
|
}
|
|
1040
1059
|
e[t] = Array.isArray(r) ? [...r, n] : [r, n];
|
|
1041
1060
|
}
|
|
1042
|
-
function
|
|
1061
|
+
function Sn(e) {
|
|
1043
1062
|
return e && e.charAt(0).toLowerCase() + e.slice(1);
|
|
1044
1063
|
}
|
|
1045
1064
|
//#endregion
|
|
1046
1065
|
//#region src/data/inMemoryList.ts
|
|
1047
|
-
function
|
|
1066
|
+
function Cn(e, t) {
|
|
1048
1067
|
return e === t || String(e) === String(t);
|
|
1049
1068
|
}
|
|
1050
|
-
function
|
|
1051
|
-
let n = e.find((e) =>
|
|
1069
|
+
function wn(e, t) {
|
|
1070
|
+
let n = e.find((e) => Cn(e.id, t));
|
|
1052
1071
|
if (!n) throw Error("Not found");
|
|
1053
1072
|
return n;
|
|
1054
1073
|
}
|
|
1055
|
-
function
|
|
1074
|
+
function Tn(e, t) {
|
|
1056
1075
|
if (t.length === 0) return e;
|
|
1057
1076
|
let n = (e) => e === "DESC" ? -1 : 1;
|
|
1058
1077
|
return [...e].sort((e, r) => {
|
|
@@ -1068,33 +1087,33 @@ function Sn(e, t) {
|
|
|
1068
1087
|
return 0;
|
|
1069
1088
|
});
|
|
1070
1089
|
}
|
|
1071
|
-
function
|
|
1090
|
+
function En(e, t) {
|
|
1072
1091
|
return t == null || t === "" ? !0 : Array.isArray(t) ? t.length === 0 ? !0 : Array.isArray(e) ? t.some((t) => e.includes(t)) : t.includes(e) : Array.isArray(e) ? e.includes(t) : typeof t == "string" && typeof e == "string" ? e.toLowerCase().includes(t.toLowerCase()) : e === t;
|
|
1073
1092
|
}
|
|
1074
|
-
function
|
|
1075
|
-
return t ? e.filter((e) => Object.entries(t).every(([t, n]) =>
|
|
1093
|
+
function Dn(e, t) {
|
|
1094
|
+
return t ? e.filter((e) => Object.entries(t).every(([t, n]) => En(e[t], n))) : e;
|
|
1076
1095
|
}
|
|
1077
|
-
function
|
|
1096
|
+
function On(e, t, n) {
|
|
1078
1097
|
let r = (t - 1) * n;
|
|
1079
1098
|
return {
|
|
1080
1099
|
data: e.slice(r, r + n),
|
|
1081
1100
|
total: e.length
|
|
1082
1101
|
};
|
|
1083
1102
|
}
|
|
1084
|
-
function
|
|
1085
|
-
let { pagination: n, sort: r, filter: i } = t, a =
|
|
1103
|
+
function kn(e, t) {
|
|
1104
|
+
let { pagination: n, sort: r, filter: i } = t, a = Dn(e, i);
|
|
1086
1105
|
if (r) {
|
|
1087
1106
|
let e = Array.isArray(r) ? r : [r];
|
|
1088
|
-
e.length > 0 && e[0]?.field && (a =
|
|
1107
|
+
e.length > 0 && e[0]?.field && (a = Tn(a, e));
|
|
1089
1108
|
}
|
|
1090
|
-
return n ?
|
|
1109
|
+
return n ? On(a, n.page, n.perPage) : {
|
|
1091
1110
|
data: a,
|
|
1092
1111
|
total: a.length
|
|
1093
1112
|
};
|
|
1094
1113
|
}
|
|
1095
1114
|
//#endregion
|
|
1096
1115
|
//#region src/data/createMemoryResourceHandlers.ts
|
|
1097
|
-
function
|
|
1116
|
+
function An(e) {
|
|
1098
1117
|
let t = (e) => e, n = e.mapCreate ?? ((e, t) => ({
|
|
1099
1118
|
...e,
|
|
1100
1119
|
id: t
|
|
@@ -1105,21 +1124,21 @@ function Dn(e) {
|
|
|
1105
1124
|
}));
|
|
1106
1125
|
return {
|
|
1107
1126
|
async getList(n) {
|
|
1108
|
-
return
|
|
1127
|
+
return kn(t(e.scopeList ? e.scopeList(e.getRows(), n) : e.getRows()), n);
|
|
1109
1128
|
},
|
|
1110
1129
|
async getOne(t, n) {
|
|
1111
|
-
return { data:
|
|
1130
|
+
return { data: wn(e.getRows(), t) };
|
|
1112
1131
|
},
|
|
1113
1132
|
async create(t) {
|
|
1114
1133
|
let r = n(t, e.nextId());
|
|
1115
1134
|
return e.getRows().push(r), { data: r };
|
|
1116
1135
|
},
|
|
1117
1136
|
async update({ id: t, data: n }) {
|
|
1118
|
-
let i =
|
|
1137
|
+
let i = wn(e.getRows(), t), a = r(i, n);
|
|
1119
1138
|
return Object.assign(i, a), { data: i };
|
|
1120
1139
|
},
|
|
1121
1140
|
async delete(t) {
|
|
1122
|
-
let n = e.getRows(), r = n.findIndex((e) =>
|
|
1141
|
+
let n = e.getRows(), r = n.findIndex((e) => Cn(e.id, t));
|
|
1123
1142
|
if (r < 0) return { data: null };
|
|
1124
1143
|
let [i] = n.splice(r, 1);
|
|
1125
1144
|
return e.afterDelete?.(i), { data: i };
|
|
@@ -1128,7 +1147,7 @@ function Dn(e) {
|
|
|
1128
1147
|
}
|
|
1129
1148
|
//#endregion
|
|
1130
1149
|
//#region src/data/createRestResourceHandlers.ts
|
|
1131
|
-
function
|
|
1150
|
+
function jn(e) {
|
|
1132
1151
|
return {
|
|
1133
1152
|
async getList(t) {
|
|
1134
1153
|
return e.list(t);
|
|
@@ -1151,24 +1170,24 @@ function On(e) {
|
|
|
1151
1170
|
}
|
|
1152
1171
|
//#endregion
|
|
1153
1172
|
//#region src/data/sortHelpers.ts
|
|
1154
|
-
function
|
|
1173
|
+
function Mn(e) {
|
|
1155
1174
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
1156
1175
|
}
|
|
1157
|
-
function
|
|
1158
|
-
let t =
|
|
1176
|
+
function Nn(e) {
|
|
1177
|
+
let t = Mn(e);
|
|
1159
1178
|
if (t.length !== 0) return t.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
|
|
1160
1179
|
}
|
|
1161
|
-
function
|
|
1162
|
-
let t =
|
|
1180
|
+
function Pn(e) {
|
|
1181
|
+
let t = Mn(e);
|
|
1163
1182
|
if (t.length !== 0) return t.map((e) => `${e.field} ${e.order === "DESC" ? "desc" : "asc"}`).join(",");
|
|
1164
1183
|
}
|
|
1165
|
-
function
|
|
1166
|
-
let t =
|
|
1184
|
+
function Fn(e) {
|
|
1185
|
+
let t = Mn(e);
|
|
1167
1186
|
if (t.length !== 0) return t.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
|
|
1168
1187
|
}
|
|
1169
1188
|
//#endregion
|
|
1170
1189
|
//#region src/components/AuthAlternateLink.tsx
|
|
1171
|
-
function
|
|
1190
|
+
function In({ prompt: e, linkText: t, to: n }) {
|
|
1172
1191
|
return /* @__PURE__ */ J(W.Paragraph, {
|
|
1173
1192
|
type: "secondary",
|
|
1174
1193
|
style: {
|
|
@@ -1187,9 +1206,9 @@ function Nn({ prompt: e, linkText: t, to: n }) {
|
|
|
1187
1206
|
}
|
|
1188
1207
|
//#endregion
|
|
1189
1208
|
//#region src/layouts/AuthPageLayout.tsx
|
|
1190
|
-
function
|
|
1209
|
+
function Ln({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
1191
1210
|
let { token: i } = G.useToken();
|
|
1192
|
-
return /* @__PURE__ */ J(
|
|
1211
|
+
return /* @__PURE__ */ J(j, {
|
|
1193
1212
|
vertical: !0,
|
|
1194
1213
|
align: "stretch",
|
|
1195
1214
|
style: {
|
|
@@ -1200,7 +1219,7 @@ function Pn({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1200
1219
|
background: i.colorBgLayout
|
|
1201
1220
|
},
|
|
1202
1221
|
children: [
|
|
1203
|
-
r ? /* @__PURE__ */ q(
|
|
1222
|
+
r ? /* @__PURE__ */ q(j, {
|
|
1204
1223
|
justify: "flex-end",
|
|
1205
1224
|
style: {
|
|
1206
1225
|
flexShrink: 0,
|
|
@@ -1208,7 +1227,7 @@ function Pn({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1208
1227
|
padding: 16,
|
|
1209
1228
|
background: i.colorBgLayout
|
|
1210
1229
|
},
|
|
1211
|
-
children: /* @__PURE__ */ q(
|
|
1230
|
+
children: /* @__PURE__ */ q(rt, {})
|
|
1212
1231
|
}) : null,
|
|
1213
1232
|
t ? /* @__PURE__ */ q("div", {
|
|
1214
1233
|
style: {
|
|
@@ -1218,14 +1237,14 @@ function Pn({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1218
1237
|
},
|
|
1219
1238
|
children: t
|
|
1220
1239
|
}) : null,
|
|
1221
|
-
/* @__PURE__ */ q(
|
|
1240
|
+
/* @__PURE__ */ q(at, {
|
|
1222
1241
|
style: {
|
|
1223
1242
|
flex: 1,
|
|
1224
1243
|
minHeight: 0,
|
|
1225
1244
|
width: "100%",
|
|
1226
1245
|
background: i.colorBgLayout
|
|
1227
1246
|
},
|
|
1228
|
-
children: /* @__PURE__ */ J(
|
|
1247
|
+
children: /* @__PURE__ */ J(j, {
|
|
1229
1248
|
vertical: !0,
|
|
1230
1249
|
align: "center",
|
|
1231
1250
|
justify: "flex-start",
|
|
@@ -1249,11 +1268,11 @@ function Pn({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1249
1268
|
}
|
|
1250
1269
|
//#endregion
|
|
1251
1270
|
//#region src/pages/LoginPage.tsx
|
|
1252
|
-
function
|
|
1253
|
-
let { login: l } =
|
|
1254
|
-
return /* @__PURE__ */ q(
|
|
1271
|
+
function Rn({ title: e = "Sign in", description: t = "Use any username and password to continue.", logo: n, brand: r, extraFields: i, showThemeToolbar: a = !0, afterLoginPath: o = "/", alternateAuth: s, footer: c }) {
|
|
1272
|
+
let { login: l } = ut(), u = v();
|
|
1273
|
+
return /* @__PURE__ */ q(Ln, {
|
|
1255
1274
|
brand: r ?? n,
|
|
1256
|
-
footer: c ?? (s ? /* @__PURE__ */ q(
|
|
1275
|
+
footer: c ?? (s ? /* @__PURE__ */ q(In, {
|
|
1257
1276
|
prompt: s.prompt ?? "Don't have an account?",
|
|
1258
1277
|
linkText: s.linkText,
|
|
1259
1278
|
to: s.to
|
|
@@ -1269,7 +1288,7 @@ function Fn({ title: e = "Sign in", description: t = "Use any username and passw
|
|
|
1269
1288
|
type: "secondary",
|
|
1270
1289
|
style: { marginTop: 0 },
|
|
1271
1290
|
children: t
|
|
1272
|
-
}) : null, /* @__PURE__ */ J(
|
|
1291
|
+
}) : null, /* @__PURE__ */ J(M, {
|
|
1273
1292
|
layout: "vertical",
|
|
1274
1293
|
onFinish: async (e) => {
|
|
1275
1294
|
await l({
|
|
@@ -1279,26 +1298,26 @@ function Fn({ title: e = "Sign in", description: t = "Use any username and passw
|
|
|
1279
1298
|
}), u(o, { replace: !0 });
|
|
1280
1299
|
},
|
|
1281
1300
|
children: [
|
|
1282
|
-
/* @__PURE__ */ q(
|
|
1301
|
+
/* @__PURE__ */ q(M.Item, {
|
|
1283
1302
|
name: "username",
|
|
1284
1303
|
label: "Username",
|
|
1285
1304
|
rules: [{
|
|
1286
1305
|
required: !0,
|
|
1287
1306
|
message: "Required"
|
|
1288
1307
|
}],
|
|
1289
|
-
children: /* @__PURE__ */ q(
|
|
1308
|
+
children: /* @__PURE__ */ q(P, { autoComplete: "username" })
|
|
1290
1309
|
}),
|
|
1291
|
-
/* @__PURE__ */ q(
|
|
1310
|
+
/* @__PURE__ */ q(M.Item, {
|
|
1292
1311
|
name: "password",
|
|
1293
1312
|
label: "Password",
|
|
1294
1313
|
rules: [{
|
|
1295
1314
|
required: !0,
|
|
1296
1315
|
message: "Required"
|
|
1297
1316
|
}],
|
|
1298
|
-
children: /* @__PURE__ */ q(
|
|
1317
|
+
children: /* @__PURE__ */ q(P.Password, { autoComplete: "current-password" })
|
|
1299
1318
|
}),
|
|
1300
1319
|
i,
|
|
1301
|
-
/* @__PURE__ */ q(
|
|
1320
|
+
/* @__PURE__ */ q(M.Item, {
|
|
1302
1321
|
style: { marginBottom: 0 },
|
|
1303
1322
|
children: /* @__PURE__ */ q(w, {
|
|
1304
1323
|
type: "primary",
|
|
@@ -1314,7 +1333,7 @@ function Fn({ title: e = "Sign in", description: t = "Use any username and passw
|
|
|
1314
1333
|
}
|
|
1315
1334
|
//#endregion
|
|
1316
1335
|
//#region src/pages/PlaceholderPage.tsx
|
|
1317
|
-
function
|
|
1336
|
+
function zn({ title: e }) {
|
|
1318
1337
|
return /* @__PURE__ */ q(W.Title, {
|
|
1319
1338
|
level: 3,
|
|
1320
1339
|
style: { marginTop: 0 },
|
|
@@ -1323,54 +1342,110 @@ function In({ title: e }) {
|
|
|
1323
1342
|
}
|
|
1324
1343
|
//#endregion
|
|
1325
1344
|
//#region src/components/AppHub.tsx
|
|
1326
|
-
function
|
|
1327
|
-
let
|
|
1328
|
-
if (
|
|
1329
|
-
|
|
1345
|
+
function Bn({ apps: e, menuItems: t, onAppClick: n, onMenuClick: r, menuSearchPlaceholder: i = "Search menus across apps…", className: a, maxWidth: o = 960 }) {
|
|
1346
|
+
let s = v(), { token: c } = G.useToken(), [u, f] = d(""), p = (e) => {
|
|
1347
|
+
if (n) {
|
|
1348
|
+
n(e);
|
|
1330
1349
|
return;
|
|
1331
1350
|
}
|
|
1332
|
-
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1351
|
+
s(e.path);
|
|
1352
|
+
}, m = (e) => {
|
|
1353
|
+
if (r) {
|
|
1354
|
+
r(e);
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
s(e.path);
|
|
1358
|
+
}, h = u.trim(), g = l(() => t && h ? bt(t, h) : [], [t, h]), _ = !!(t && h);
|
|
1359
|
+
return /* @__PURE__ */ J("div", {
|
|
1360
|
+
className: a,
|
|
1361
|
+
style: {
|
|
1362
|
+
width: "100%",
|
|
1363
|
+
maxWidth: o,
|
|
1364
|
+
marginInline: "auto",
|
|
1365
|
+
paddingInline: c.paddingMD
|
|
1366
|
+
},
|
|
1367
|
+
children: [t?.length ? /* @__PURE__ */ q("div", {
|
|
1368
|
+
style: {
|
|
1369
|
+
maxWidth: 480,
|
|
1370
|
+
margin: "0 auto 24px"
|
|
1371
|
+
},
|
|
1372
|
+
children: /* @__PURE__ */ q(it, {
|
|
1373
|
+
value: u,
|
|
1374
|
+
onChange: f,
|
|
1375
|
+
placeholder: i,
|
|
1376
|
+
variant: "app"
|
|
1377
|
+
})
|
|
1378
|
+
}) : null, _ ? /* @__PURE__ */ q(te, {
|
|
1379
|
+
bordered: !0,
|
|
1380
|
+
dataSource: g,
|
|
1381
|
+
locale: { emptyText: "No menus match your search." },
|
|
1382
|
+
style: {
|
|
1383
|
+
background: c.colorBgContainer,
|
|
1384
|
+
borderRadius: c.borderRadiusLG
|
|
1385
|
+
},
|
|
1386
|
+
renderItem: (e) => {
|
|
1387
|
+
let t = e.Icon;
|
|
1388
|
+
return /* @__PURE__ */ q(te.Item, {
|
|
1389
|
+
style: { cursor: "pointer" },
|
|
1390
|
+
onClick: () => m(e),
|
|
1391
|
+
children: /* @__PURE__ */ q(te.Item.Meta, {
|
|
1392
|
+
avatar: t ? /* @__PURE__ */ q("span", {
|
|
1352
1393
|
style: {
|
|
1353
|
-
fontSize:
|
|
1394
|
+
fontSize: 20,
|
|
1354
1395
|
lineHeight: 1
|
|
1355
1396
|
},
|
|
1356
1397
|
children: /* @__PURE__ */ q(t, {})
|
|
1357
|
-
}) :
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
})]
|
|
1398
|
+
}) : void 0,
|
|
1399
|
+
title: _t(e),
|
|
1400
|
+
description: e.group
|
|
1361
1401
|
})
|
|
1362
|
-
})
|
|
1363
|
-
}
|
|
1364
|
-
})
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
}) : /* @__PURE__ */ q(R, {
|
|
1405
|
+
gutter: [16, 16],
|
|
1406
|
+
justify: "center",
|
|
1407
|
+
children: e.map((e) => {
|
|
1408
|
+
let t = e.Icon;
|
|
1409
|
+
return /* @__PURE__ */ q(E, {
|
|
1410
|
+
xs: 12,
|
|
1411
|
+
sm: 8,
|
|
1412
|
+
md: 6,
|
|
1413
|
+
lg: 4,
|
|
1414
|
+
style: { maxWidth: 200 },
|
|
1415
|
+
children: /* @__PURE__ */ q(T, {
|
|
1416
|
+
hoverable: !0,
|
|
1417
|
+
onClick: () => p(e),
|
|
1418
|
+
styles: { body: {
|
|
1419
|
+
textAlign: "center",
|
|
1420
|
+
padding: c.paddingLG
|
|
1421
|
+
} },
|
|
1422
|
+
children: /* @__PURE__ */ J(B, {
|
|
1423
|
+
orientation: "vertical",
|
|
1424
|
+
size: "middle",
|
|
1425
|
+
children: [t ? /* @__PURE__ */ q("span", {
|
|
1426
|
+
style: {
|
|
1427
|
+
fontSize: 40,
|
|
1428
|
+
lineHeight: 1
|
|
1429
|
+
},
|
|
1430
|
+
children: /* @__PURE__ */ q(t, {})
|
|
1431
|
+
}) : null, /* @__PURE__ */ q(W.Text, {
|
|
1432
|
+
strong: !0,
|
|
1433
|
+
children: e.label
|
|
1434
|
+
})]
|
|
1435
|
+
})
|
|
1436
|
+
})
|
|
1437
|
+
}, e.path);
|
|
1438
|
+
})
|
|
1439
|
+
})]
|
|
1365
1440
|
});
|
|
1366
1441
|
}
|
|
1367
1442
|
//#endregion
|
|
1368
1443
|
//#region src/components/AppLauncherButton.tsx
|
|
1369
|
-
function
|
|
1444
|
+
function Vn({ hubPath: e = "/", label: t = "Apps", onClick: n }) {
|
|
1370
1445
|
let r = v();
|
|
1371
1446
|
return /* @__PURE__ */ q(w, {
|
|
1372
1447
|
type: "text",
|
|
1373
|
-
icon: /* @__PURE__ */ q(
|
|
1448
|
+
icon: /* @__PURE__ */ q(ue, {}),
|
|
1374
1449
|
onClick: () => {
|
|
1375
1450
|
if (n) {
|
|
1376
1451
|
n();
|
|
@@ -1383,7 +1458,7 @@ function Rn({ hubPath: e = "/", label: t = "Apps", onClick: n }) {
|
|
|
1383
1458
|
}
|
|
1384
1459
|
//#endregion
|
|
1385
1460
|
//#region src/crud/utils/sortQueryParam.ts
|
|
1386
|
-
function
|
|
1461
|
+
function Hn(e) {
|
|
1387
1462
|
if (!e) return [];
|
|
1388
1463
|
let t = [];
|
|
1389
1464
|
for (let n of e.split(",").map((e) => e.trim()).filter(Boolean)) {
|
|
@@ -1407,17 +1482,17 @@ function zn(e) {
|
|
|
1407
1482
|
}
|
|
1408
1483
|
return t;
|
|
1409
1484
|
}
|
|
1410
|
-
function
|
|
1485
|
+
function Un(e) {
|
|
1411
1486
|
return e.length === 0 ? null : e.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
|
|
1412
1487
|
}
|
|
1413
|
-
function
|
|
1488
|
+
function Wn(e) {
|
|
1414
1489
|
return new Map(e.map((e, t) => [e.field, t + 1]));
|
|
1415
1490
|
}
|
|
1416
1491
|
//#endregion
|
|
1417
1492
|
//#region src/crud/context/ListContext.tsx
|
|
1418
|
-
var
|
|
1419
|
-
function
|
|
1420
|
-
let [r, i] = d([]), o = l(() => new Set(n.map((e) => e.field)), [n]), s = l(() => new Map(n.map((e) => [e.field, e.order])), [n]), c = l(() =>
|
|
1493
|
+
var Gn = t(null);
|
|
1494
|
+
function Kn({ children: e, toggleSort: t, sort: n }) {
|
|
1495
|
+
let [r, i] = d([]), o = l(() => new Set(n.map((e) => e.field)), [n]), s = l(() => new Map(n.map((e) => [e.field, e.order])), [n]), c = l(() => Wn(n), [n]), u = a((e) => (i((t) => {
|
|
1421
1496
|
let n = t.findIndex((t) => t.key === e.key);
|
|
1422
1497
|
if (n < 0) return [...t, e];
|
|
1423
1498
|
if (t[n] === e) return t;
|
|
@@ -1440,23 +1515,23 @@ function Un({ children: e, toggleSort: t, sort: n }) {
|
|
|
1440
1515
|
c,
|
|
1441
1516
|
u
|
|
1442
1517
|
]);
|
|
1443
|
-
return /* @__PURE__ */ q(
|
|
1518
|
+
return /* @__PURE__ */ q(Gn.Provider, {
|
|
1444
1519
|
value: f,
|
|
1445
1520
|
children: e
|
|
1446
1521
|
});
|
|
1447
1522
|
}
|
|
1448
|
-
function
|
|
1449
|
-
let e = o(
|
|
1523
|
+
function qn() {
|
|
1524
|
+
let e = o(Gn);
|
|
1450
1525
|
if (!e) throw Error("Column components must be used within ResourceList");
|
|
1451
1526
|
return e;
|
|
1452
1527
|
}
|
|
1453
|
-
function
|
|
1454
|
-
let { registerColumn: t } =
|
|
1528
|
+
function Jn(e) {
|
|
1529
|
+
let { registerColumn: t } = qn();
|
|
1455
1530
|
s(() => t(e), [t, e]);
|
|
1456
1531
|
}
|
|
1457
1532
|
//#endregion
|
|
1458
1533
|
//#region src/crud/utils/useDebouncedValue.ts
|
|
1459
|
-
function
|
|
1534
|
+
function Yn(e, t) {
|
|
1460
1535
|
let [n, r] = d(e);
|
|
1461
1536
|
return s(() => {
|
|
1462
1537
|
if (t <= 0) {
|
|
@@ -1469,42 +1544,42 @@ function Kn(e, t) {
|
|
|
1469
1544
|
}
|
|
1470
1545
|
//#endregion
|
|
1471
1546
|
//#region src/crud/filters/TextFilter.tsx
|
|
1472
|
-
var
|
|
1473
|
-
function
|
|
1547
|
+
var Xn = 300;
|
|
1548
|
+
function Zn(e) {
|
|
1474
1549
|
if (!(e == null || e === "")) return String(e);
|
|
1475
1550
|
}
|
|
1476
|
-
function
|
|
1477
|
-
let [i, a] = d(() => e ?? ""), o =
|
|
1551
|
+
function Qn({ value: e, onChange: t, placeholder: n, debounceMs: r }) {
|
|
1552
|
+
let [i, a] = d(() => e ?? ""), o = Yn(i, r);
|
|
1478
1553
|
return s(() => {
|
|
1479
1554
|
a(e ?? "");
|
|
1480
1555
|
}, [e]), s(() => {
|
|
1481
1556
|
if (r <= 0 || o !== i) return;
|
|
1482
|
-
let n =
|
|
1483
|
-
n !==
|
|
1557
|
+
let n = Zn(o);
|
|
1558
|
+
n !== Zn(e) && t(n);
|
|
1484
1559
|
}, [
|
|
1485
1560
|
o,
|
|
1486
1561
|
i,
|
|
1487
1562
|
r,
|
|
1488
1563
|
t,
|
|
1489
1564
|
e
|
|
1490
|
-
]), /* @__PURE__ */ q(
|
|
1565
|
+
]), /* @__PURE__ */ q(P, {
|
|
1491
1566
|
allowClear: !0,
|
|
1492
1567
|
placeholder: n,
|
|
1493
1568
|
value: i,
|
|
1494
1569
|
onChange: (e) => {
|
|
1495
1570
|
let n = e.target.value;
|
|
1496
|
-
a(n), (r <= 0 || n === "") && t(
|
|
1571
|
+
a(n), (r <= 0 || n === "") && t(Zn(n));
|
|
1497
1572
|
},
|
|
1498
1573
|
style: { minWidth: 160 }
|
|
1499
1574
|
});
|
|
1500
1575
|
}
|
|
1501
|
-
function
|
|
1502
|
-
let i =
|
|
1503
|
-
return
|
|
1576
|
+
function $n({ source: e, label: t, placeholder: n, debounceMs: r }) {
|
|
1577
|
+
let i = nr(), a = r ?? i?.textFilterDebounceMs ?? 300;
|
|
1578
|
+
return rr(l(() => ({
|
|
1504
1579
|
key: e,
|
|
1505
1580
|
source: e,
|
|
1506
1581
|
label: t,
|
|
1507
|
-
render: ({ value: r, onChange: i }) => /* @__PURE__ */ q(
|
|
1582
|
+
render: ({ value: r, onChange: i }) => /* @__PURE__ */ q(Qn, {
|
|
1508
1583
|
value: r,
|
|
1509
1584
|
onChange: i,
|
|
1510
1585
|
placeholder: n ?? t ?? e,
|
|
@@ -1519,8 +1594,8 @@ function Xn({ source: e, label: t, placeholder: n, debounceMs: r }) {
|
|
|
1519
1594
|
}
|
|
1520
1595
|
//#endregion
|
|
1521
1596
|
//#region src/crud/context/FilterContext.tsx
|
|
1522
|
-
var
|
|
1523
|
-
function
|
|
1597
|
+
var er = t(null);
|
|
1598
|
+
function tr({ children: e, values: t, setFilterValue: n, textFilterDebounceMs: r = 300 }) {
|
|
1524
1599
|
let [i, o] = d([]), s = a((e) => (o((t) => {
|
|
1525
1600
|
let n = t.findIndex((t) => t.key === e.key);
|
|
1526
1601
|
if (n < 0) return [...t, e];
|
|
@@ -1542,25 +1617,25 @@ function Qn({ children: e, values: t, setFilterValue: n, textFilterDebounceMs: r
|
|
|
1542
1617
|
s,
|
|
1543
1618
|
r
|
|
1544
1619
|
]);
|
|
1545
|
-
return /* @__PURE__ */ q(
|
|
1620
|
+
return /* @__PURE__ */ q(er.Provider, {
|
|
1546
1621
|
value: c,
|
|
1547
1622
|
children: e
|
|
1548
1623
|
});
|
|
1549
1624
|
}
|
|
1550
|
-
function
|
|
1551
|
-
return o(
|
|
1625
|
+
function nr() {
|
|
1626
|
+
return o(er);
|
|
1552
1627
|
}
|
|
1553
|
-
function
|
|
1554
|
-
let t =
|
|
1628
|
+
function rr(e) {
|
|
1629
|
+
let t = nr()?.registerFilter;
|
|
1555
1630
|
s(() => {
|
|
1556
1631
|
if (t) return t(e);
|
|
1557
1632
|
}, [t, e]);
|
|
1558
1633
|
}
|
|
1559
1634
|
//#endregion
|
|
1560
1635
|
//#region src/crud/context/FormContext.tsx
|
|
1561
|
-
var
|
|
1562
|
-
function
|
|
1563
|
-
return /* @__PURE__ */ q(
|
|
1636
|
+
var ir = t(null);
|
|
1637
|
+
function ar({ children: e, resource: t, isNew: n, disabled: r }) {
|
|
1638
|
+
return /* @__PURE__ */ q(ir.Provider, {
|
|
1564
1639
|
value: {
|
|
1565
1640
|
resource: t,
|
|
1566
1641
|
isNew: n,
|
|
@@ -1569,35 +1644,35 @@ function nr({ children: e, resource: t, isNew: n, disabled: r }) {
|
|
|
1569
1644
|
children: e
|
|
1570
1645
|
});
|
|
1571
1646
|
}
|
|
1572
|
-
function
|
|
1573
|
-
return o(
|
|
1647
|
+
function or() {
|
|
1648
|
+
return o(ir);
|
|
1574
1649
|
}
|
|
1575
1650
|
//#endregion
|
|
1576
1651
|
//#region src/crud/context/FormSectionContext.tsx
|
|
1577
|
-
var
|
|
1578
|
-
function
|
|
1579
|
-
return /* @__PURE__ */ q(
|
|
1652
|
+
var sr = t(null);
|
|
1653
|
+
function cr({ sourcesRef: e, children: t }) {
|
|
1654
|
+
return /* @__PURE__ */ q(sr.Provider, {
|
|
1580
1655
|
value: e,
|
|
1581
1656
|
children: t
|
|
1582
1657
|
});
|
|
1583
1658
|
}
|
|
1584
|
-
function
|
|
1585
|
-
return o(
|
|
1659
|
+
function lr() {
|
|
1660
|
+
return o(sr);
|
|
1586
1661
|
}
|
|
1587
1662
|
//#endregion
|
|
1588
1663
|
//#region src/crud/context/PayloadFieldsContext.tsx
|
|
1589
|
-
var
|
|
1590
|
-
function
|
|
1591
|
-
return /* @__PURE__ */ q(
|
|
1664
|
+
var ur = t(null);
|
|
1665
|
+
function dr({ children: e, fieldsRef: t }) {
|
|
1666
|
+
return /* @__PURE__ */ q(ur.Provider, {
|
|
1592
1667
|
value: t,
|
|
1593
1668
|
children: e
|
|
1594
1669
|
});
|
|
1595
1670
|
}
|
|
1596
|
-
function
|
|
1597
|
-
return o(
|
|
1671
|
+
function fr() {
|
|
1672
|
+
return o(ur);
|
|
1598
1673
|
}
|
|
1599
|
-
function
|
|
1600
|
-
let n =
|
|
1674
|
+
function pr(e, t = !0) {
|
|
1675
|
+
let n = fr();
|
|
1601
1676
|
s(() => {
|
|
1602
1677
|
if (!(!t || !n)) return n.current.add(e), () => {
|
|
1603
1678
|
n.current.delete(e);
|
|
@@ -1608,8 +1683,8 @@ function ur(e, t = !0) {
|
|
|
1608
1683
|
t
|
|
1609
1684
|
]);
|
|
1610
1685
|
}
|
|
1611
|
-
function
|
|
1612
|
-
let n =
|
|
1686
|
+
function mr(e, t = !0) {
|
|
1687
|
+
let n = lr();
|
|
1613
1688
|
s(() => {
|
|
1614
1689
|
if (!(!t || !n)) return n.current.add(e), () => {
|
|
1615
1690
|
n.current.delete(e);
|
|
@@ -1622,18 +1697,18 @@ function dr(e, t = !0) {
|
|
|
1622
1697
|
}
|
|
1623
1698
|
//#endregion
|
|
1624
1699
|
//#region src/crud/context/InlineFieldsRegistry.tsx
|
|
1625
|
-
var
|
|
1626
|
-
function
|
|
1627
|
-
return /* @__PURE__ */ q(
|
|
1700
|
+
var hr = t(null);
|
|
1701
|
+
function gr({ children: e, registryRef: t }) {
|
|
1702
|
+
return /* @__PURE__ */ q(hr.Provider, {
|
|
1628
1703
|
value: t,
|
|
1629
1704
|
children: e
|
|
1630
1705
|
});
|
|
1631
1706
|
}
|
|
1632
|
-
function
|
|
1633
|
-
return o(
|
|
1707
|
+
function _r() {
|
|
1708
|
+
return o(hr);
|
|
1634
1709
|
}
|
|
1635
|
-
function
|
|
1636
|
-
let a =
|
|
1710
|
+
function vr(e, t, n, r, i = !0) {
|
|
1711
|
+
let a = _r();
|
|
1637
1712
|
s(() => {
|
|
1638
1713
|
if (!(!i || !a)) return a.current.set(e, {
|
|
1639
1714
|
field: e,
|
|
@@ -1654,7 +1729,7 @@ function hr(e, t, n, r, i = !0) {
|
|
|
1654
1729
|
}
|
|
1655
1730
|
//#endregion
|
|
1656
1731
|
//#region src/crud/FormGlobalErrorsAlert.tsx
|
|
1657
|
-
function
|
|
1732
|
+
function yr({ errors: e }) {
|
|
1658
1733
|
return e.length ? e.length === 1 ? /* @__PURE__ */ q(x, {
|
|
1659
1734
|
type: "error",
|
|
1660
1735
|
title: e[0],
|
|
@@ -1676,7 +1751,7 @@ function gr({ errors: e }) {
|
|
|
1676
1751
|
}
|
|
1677
1752
|
//#endregion
|
|
1678
1753
|
//#region src/crud/utils/getFormValue.ts
|
|
1679
|
-
function
|
|
1754
|
+
function br(e, t) {
|
|
1680
1755
|
let n = t.split("."), r = e;
|
|
1681
1756
|
for (let e of n) {
|
|
1682
1757
|
if (typeof r != "object" || !r) return;
|
|
@@ -1686,7 +1761,7 @@ function _r(e, t) {
|
|
|
1686
1761
|
}
|
|
1687
1762
|
//#endregion
|
|
1688
1763
|
//#region src/crud/utils/setFormValue.ts
|
|
1689
|
-
function
|
|
1764
|
+
function xr(e, t, n) {
|
|
1690
1765
|
let r = t.split("."), i = e;
|
|
1691
1766
|
for (let e = 0; e < r.length - 1; e++) {
|
|
1692
1767
|
let t = r[e], n = i[t];
|
|
@@ -1696,18 +1771,18 @@ function vr(e, t, n) {
|
|
|
1696
1771
|
}
|
|
1697
1772
|
//#endregion
|
|
1698
1773
|
//#region src/crud/utils/buildFormPayload.ts
|
|
1699
|
-
function
|
|
1774
|
+
function Sr(e, t) {
|
|
1700
1775
|
if (t.length === 0) return { ...e };
|
|
1701
1776
|
let n = {};
|
|
1702
1777
|
for (let r of t) {
|
|
1703
|
-
let t =
|
|
1704
|
-
t !== void 0 &&
|
|
1778
|
+
let t = br(e, r);
|
|
1779
|
+
t !== void 0 && xr(n, r, t);
|
|
1705
1780
|
}
|
|
1706
1781
|
return n;
|
|
1707
1782
|
}
|
|
1708
1783
|
//#endregion
|
|
1709
1784
|
//#region src/crud/utils/buildInlineRowsPayload.ts
|
|
1710
|
-
function
|
|
1785
|
+
function Cr(e, t, n) {
|
|
1711
1786
|
if (!Array.isArray(e)) return [];
|
|
1712
1787
|
let r = e.map((e) => {
|
|
1713
1788
|
if (!e || typeof e != "object") return {};
|
|
@@ -1723,34 +1798,34 @@ function br(e, t, n) {
|
|
|
1723
1798
|
}
|
|
1724
1799
|
//#endregion
|
|
1725
1800
|
//#region src/crud/utils/hasUploadValues.ts
|
|
1726
|
-
function
|
|
1727
|
-
return e instanceof Blob ? !0 : Array.isArray(e) ? e.some(
|
|
1801
|
+
function wr(e) {
|
|
1802
|
+
return e instanceof Blob ? !0 : Array.isArray(e) ? e.some(wr) : e && typeof e == "object" ? Object.values(e).some(wr) : !1;
|
|
1728
1803
|
}
|
|
1729
1804
|
//#endregion
|
|
1730
1805
|
//#region src/crud/utils/uploadReferenceUtils.ts
|
|
1731
|
-
function
|
|
1806
|
+
function Tr(e) {
|
|
1732
1807
|
return /^https?:\/\//i.test(e) || e.startsWith("/media/");
|
|
1733
1808
|
}
|
|
1734
|
-
function
|
|
1809
|
+
function Er(e, t) {
|
|
1735
1810
|
if (!t) return e;
|
|
1736
|
-
if (typeof e == "string") return
|
|
1737
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
1811
|
+
if (typeof e == "string") return Tr(e) ? void 0 : e;
|
|
1812
|
+
if (Array.isArray(e)) return e.map((e) => Er(e, t)).filter((e) => e !== void 0);
|
|
1738
1813
|
if (e && typeof e == "object" && !(e instanceof Blob)) {
|
|
1739
1814
|
let n = {};
|
|
1740
1815
|
for (let [r, i] of Object.entries(e)) {
|
|
1741
|
-
let e =
|
|
1816
|
+
let e = Er(i, t);
|
|
1742
1817
|
e !== void 0 && (n[r] = e);
|
|
1743
1818
|
}
|
|
1744
1819
|
return n;
|
|
1745
1820
|
}
|
|
1746
1821
|
return e;
|
|
1747
1822
|
}
|
|
1748
|
-
function
|
|
1749
|
-
return
|
|
1823
|
+
function Dr(e, t = !0) {
|
|
1824
|
+
return Er(e, t);
|
|
1750
1825
|
}
|
|
1751
1826
|
//#endregion
|
|
1752
1827
|
//#region src/crud/utils/toFormData.ts
|
|
1753
|
-
function
|
|
1828
|
+
function Or(e, t, n, r) {
|
|
1754
1829
|
if (n !== void 0) {
|
|
1755
1830
|
if (n === null) {
|
|
1756
1831
|
e.append(t, "");
|
|
@@ -1765,106 +1840,106 @@ function Tr(e, t, n, r) {
|
|
|
1765
1840
|
return;
|
|
1766
1841
|
}
|
|
1767
1842
|
if (typeof n == "string") {
|
|
1768
|
-
if (r.skipExistingUploadUrls &&
|
|
1843
|
+
if (r.skipExistingUploadUrls && Tr(n)) return;
|
|
1769
1844
|
e.append(t, n);
|
|
1770
1845
|
return;
|
|
1771
1846
|
}
|
|
1772
1847
|
if (Array.isArray(n)) {
|
|
1773
1848
|
n.forEach((n, i) => {
|
|
1774
|
-
|
|
1849
|
+
Or(e, `${t}[${i}]`, n, r);
|
|
1775
1850
|
});
|
|
1776
1851
|
return;
|
|
1777
1852
|
}
|
|
1778
1853
|
if (typeof n == "object") {
|
|
1779
|
-
for (let [i, a] of Object.entries(n))
|
|
1854
|
+
for (let [i, a] of Object.entries(n)) Or(e, `${t}[${i}]`, a, r);
|
|
1780
1855
|
return;
|
|
1781
1856
|
}
|
|
1782
1857
|
e.append(t, String(n));
|
|
1783
1858
|
}
|
|
1784
1859
|
}
|
|
1785
|
-
function
|
|
1860
|
+
function kr(e, t) {
|
|
1786
1861
|
let n = { skipExistingUploadUrls: t?.skipExistingUploadUrls ?? !0 }, r = new FormData();
|
|
1787
|
-
for (let [t, i] of Object.entries(e))
|
|
1862
|
+
for (let [t, i] of Object.entries(e)) Or(r, t, i, n);
|
|
1788
1863
|
return r;
|
|
1789
1864
|
}
|
|
1790
1865
|
//#endregion
|
|
1791
1866
|
//#region src/crud/utils/prepareFormSubmitBody.ts
|
|
1792
|
-
function
|
|
1867
|
+
function Ar(e, t) {
|
|
1793
1868
|
let n = t?.skipExistingUploadUrls ?? !0;
|
|
1794
|
-
return
|
|
1869
|
+
return wr(e) ? kr(e, t) : Dr(e, n);
|
|
1795
1870
|
}
|
|
1796
1871
|
//#endregion
|
|
1797
1872
|
//#region src/crud/utils/buildResourceFormSubmitBody.ts
|
|
1798
|
-
function
|
|
1799
|
-
let i =
|
|
1873
|
+
function jr(e, t, n, r) {
|
|
1874
|
+
let i = Sr(e, t);
|
|
1800
1875
|
if (n) for (let t of n) {
|
|
1801
1876
|
let n = e[t.field], r = t.payloadKey ?? t.field;
|
|
1802
|
-
i[r] =
|
|
1877
|
+
i[r] = Cr(n, t.sources, { transformRows: t.transformRows });
|
|
1803
1878
|
}
|
|
1804
|
-
return
|
|
1879
|
+
return Ar(i, r);
|
|
1805
1880
|
}
|
|
1806
1881
|
//#endregion
|
|
1807
1882
|
//#region src/crud/utils/formErrors.ts
|
|
1808
|
-
function
|
|
1883
|
+
function Mr(e) {
|
|
1809
1884
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
1810
1885
|
}
|
|
1811
|
-
function
|
|
1886
|
+
function Nr(e) {
|
|
1812
1887
|
return Array.isArray(e) ? e.join(", ") : e;
|
|
1813
1888
|
}
|
|
1814
|
-
function
|
|
1889
|
+
function Pr(e, t, n) {
|
|
1815
1890
|
if (t.has(e)) return !0;
|
|
1816
1891
|
let r = e.match(/^([^.]+)\.(\d+)\.([^.]+)$/);
|
|
1817
1892
|
if (!r) return !1;
|
|
1818
1893
|
let [, i, , a] = r;
|
|
1819
1894
|
return n.get(i)?.sources.includes(a) ?? !1;
|
|
1820
1895
|
}
|
|
1821
|
-
function
|
|
1822
|
-
let r = {}, i = [...
|
|
1823
|
-
for (let [a, o] of Object.entries(e.fields ?? {}))
|
|
1896
|
+
function Fr(e, t, n) {
|
|
1897
|
+
let r = {}, i = [...Mr(e.global)];
|
|
1898
|
+
for (let [a, o] of Object.entries(e.fields ?? {})) Pr(a, t, n) ? r[a] = o : i.push(Nr(o));
|
|
1824
1899
|
return {
|
|
1825
1900
|
fieldErrors: r,
|
|
1826
1901
|
globalErrors: i
|
|
1827
1902
|
};
|
|
1828
1903
|
}
|
|
1829
|
-
function
|
|
1904
|
+
function Ir(e, t) {
|
|
1830
1905
|
for (let [n, r] of Object.entries(t)) e.setError(n, {
|
|
1831
1906
|
type: "server",
|
|
1832
|
-
message:
|
|
1907
|
+
message: Nr(r)
|
|
1833
1908
|
});
|
|
1834
1909
|
}
|
|
1835
|
-
function
|
|
1836
|
-
let t =
|
|
1910
|
+
function Lr(e) {
|
|
1911
|
+
let t = ln(e);
|
|
1837
1912
|
if (t && !/application\/json/i.test(t)) return `non-JSON response (Content-Type: ${t})`;
|
|
1838
1913
|
}
|
|
1839
|
-
async function
|
|
1840
|
-
let a = await
|
|
1914
|
+
async function Rr(e, t, n, r, i) {
|
|
1915
|
+
let a = await fn(n);
|
|
1841
1916
|
if (a != null) {
|
|
1842
1917
|
let n = e.parseFormError?.({ body: a }, r);
|
|
1843
1918
|
if (n) {
|
|
1844
1919
|
let e = new Set(i.payloadFields), r = /* @__PURE__ */ new Map();
|
|
1845
1920
|
for (let e of i.inlineRegistry) r.set(e.field, e);
|
|
1846
|
-
let { fieldErrors: a, globalErrors: o } =
|
|
1847
|
-
if (Object.keys(a).length || o.length) return
|
|
1921
|
+
let { fieldErrors: a, globalErrors: o } = Fr(n, e, r);
|
|
1922
|
+
if (Object.keys(a).length || o.length) return Ir(t, a), {
|
|
1848
1923
|
handled: !0,
|
|
1849
1924
|
globalErrors: o
|
|
1850
1925
|
};
|
|
1851
1926
|
}
|
|
1852
1927
|
return {
|
|
1853
1928
|
handled: !0,
|
|
1854
|
-
globalErrors: [
|
|
1929
|
+
globalErrors: [sn(a)]
|
|
1855
1930
|
};
|
|
1856
1931
|
}
|
|
1857
|
-
return
|
|
1932
|
+
return cn(n) == null ? {
|
|
1858
1933
|
handled: !1,
|
|
1859
1934
|
globalErrors: []
|
|
1860
1935
|
} : {
|
|
1861
1936
|
handled: !0,
|
|
1862
|
-
globalErrors: [
|
|
1937
|
+
globalErrors: [sn(null, { hint: Lr(n) })]
|
|
1863
1938
|
};
|
|
1864
1939
|
}
|
|
1865
1940
|
//#endregion
|
|
1866
1941
|
//#region src/crud/utils/useAbortableEffect.ts
|
|
1867
|
-
function
|
|
1942
|
+
function zr(e, t) {
|
|
1868
1943
|
s(() => {
|
|
1869
1944
|
let t = new AbortController();
|
|
1870
1945
|
return e(t.signal), () => t.abort();
|
|
@@ -1872,7 +1947,7 @@ function Ir(e, t) {
|
|
|
1872
1947
|
}
|
|
1873
1948
|
//#endregion
|
|
1874
1949
|
//#region src/crud/utils/useFormRecord.ts
|
|
1875
|
-
function
|
|
1950
|
+
function Br({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultValues: s, enabled: c = !0 }) {
|
|
1876
1951
|
let [l, u] = d(!r), [f, p] = d(0), m = a(async (a) => {
|
|
1877
1952
|
if (r || !n) {
|
|
1878
1953
|
s ? i.reset({ ...s }) : i.reset({}), u(!1);
|
|
@@ -1884,7 +1959,7 @@ function Lr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultV
|
|
|
1884
1959
|
if (a?.aborted) return;
|
|
1885
1960
|
i.reset(r.data), p((e) => e + 1);
|
|
1886
1961
|
} catch (e) {
|
|
1887
|
-
|
|
1962
|
+
$t(e) || o.error(e instanceof Error ? e.message : "Load failed");
|
|
1888
1963
|
} finally {
|
|
1889
1964
|
a?.aborted || u(!1);
|
|
1890
1965
|
}
|
|
@@ -1897,20 +1972,20 @@ function Lr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultV
|
|
|
1897
1972
|
o,
|
|
1898
1973
|
s
|
|
1899
1974
|
]);
|
|
1900
|
-
return
|
|
1975
|
+
return zr((e) => {
|
|
1901
1976
|
if (c) return m(e);
|
|
1902
1977
|
}, [c, m]), {
|
|
1903
1978
|
loading: l,
|
|
1904
1979
|
formVersion: f
|
|
1905
1980
|
};
|
|
1906
1981
|
}
|
|
1907
|
-
function
|
|
1982
|
+
function Vr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadFieldsRef: s, inlineRegistryRef: c, setGlobalErrors: l, onSuccess: u }) {
|
|
1908
1983
|
let [f, p] = d(!1);
|
|
1909
1984
|
return {
|
|
1910
1985
|
onSubmit: a(async (a) => {
|
|
1911
1986
|
l([]), p(!0);
|
|
1912
1987
|
try {
|
|
1913
|
-
let i =
|
|
1988
|
+
let i = jr(a, Array.from(s.current), c.current.values()), l;
|
|
1914
1989
|
if (r) l = (await e.create(t, i)).data, o.success("Created");
|
|
1915
1990
|
else if (n) l = (await e.update(t, {
|
|
1916
1991
|
id: n,
|
|
@@ -1919,7 +1994,7 @@ function Rr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
1919
1994
|
else return;
|
|
1920
1995
|
u?.(l);
|
|
1921
1996
|
} catch (n) {
|
|
1922
|
-
let { handled: a, globalErrors: u } = await
|
|
1997
|
+
let { handled: a, globalErrors: u } = await Rr(e, i, n, {
|
|
1923
1998
|
resource: t,
|
|
1924
1999
|
mutation: r ? "create" : "update",
|
|
1925
2000
|
inlineFieldPaths: Array.from(c.current.keys())
|
|
@@ -1948,8 +2023,8 @@ function Rr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
1948
2023
|
}
|
|
1949
2024
|
//#endregion
|
|
1950
2025
|
//#region src/crud/ResourceRecordForm.tsx
|
|
1951
|
-
function
|
|
1952
|
-
let m = t === "new" || !t, h = m ? void 0 : t, g =
|
|
2026
|
+
function Hr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0, canSave: o = !0, onCancel: s, cancelHref: c, onSuccess: l, loadingMode: p = "overlay" }) {
|
|
2027
|
+
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 = je({ defaultValues: i }), { loading: T, formVersion: E } = Br({
|
|
1953
2028
|
dp: g,
|
|
1954
2029
|
resource: e,
|
|
1955
2030
|
id: h,
|
|
@@ -1958,7 +2033,7 @@ function zr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1958
2033
|
message: _,
|
|
1959
2034
|
defaultValues: i,
|
|
1960
2035
|
enabled: a
|
|
1961
|
-
}), { onSubmit: D, saving: O } =
|
|
2036
|
+
}), { onSubmit: D, saving: O } = Vr({
|
|
1962
2037
|
dp: g,
|
|
1963
2038
|
resource: e,
|
|
1964
2039
|
id: h,
|
|
@@ -1969,20 +2044,20 @@ function zr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1969
2044
|
inlineRegistryRef: y,
|
|
1970
2045
|
setGlobalErrors: x,
|
|
1971
2046
|
onSuccess: l
|
|
1972
|
-
}), k = T || O,
|
|
2047
|
+
}), k = T || O, A = () => {
|
|
1973
2048
|
C.handleSubmit(D, () => {
|
|
1974
2049
|
_.warning("Please fix the errors below.");
|
|
1975
2050
|
})();
|
|
1976
|
-
},
|
|
2051
|
+
}, j = /* @__PURE__ */ q(w, {
|
|
1977
2052
|
disabled: k,
|
|
1978
2053
|
onClick: c ? void 0 : s,
|
|
1979
2054
|
children: "Cancel"
|
|
1980
|
-
}),
|
|
2055
|
+
}), ee = /* @__PURE__ */ q(ar, {
|
|
1981
2056
|
resource: e,
|
|
1982
2057
|
isNew: m,
|
|
1983
|
-
children: /* @__PURE__ */ q(
|
|
2058
|
+
children: /* @__PURE__ */ q(dr, {
|
|
1984
2059
|
fieldsRef: v,
|
|
1985
|
-
children: /* @__PURE__ */ q(
|
|
2060
|
+
children: /* @__PURE__ */ q(gr, {
|
|
1986
2061
|
registryRef: y,
|
|
1987
2062
|
children: /* @__PURE__ */ J("div", {
|
|
1988
2063
|
style: { position: "relative" },
|
|
@@ -1995,26 +2070,26 @@ function zr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1995
2070
|
justifyContent: "center",
|
|
1996
2071
|
zIndex: 1
|
|
1997
2072
|
},
|
|
1998
|
-
children: /* @__PURE__ */ q(
|
|
1999
|
-
}) : null, /* @__PURE__ */ n(
|
|
2073
|
+
children: /* @__PURE__ */ q(oe, {})
|
|
2074
|
+
}) : null, /* @__PURE__ */ n(ke, {
|
|
2000
2075
|
...C,
|
|
2001
2076
|
key: E
|
|
2002
|
-
}, /* @__PURE__ */ J(
|
|
2077
|
+
}, /* @__PURE__ */ J(M, {
|
|
2003
2078
|
layout: "vertical",
|
|
2004
|
-
onFinish:
|
|
2079
|
+
onFinish: A,
|
|
2005
2080
|
style: p === "overlay" ? {
|
|
2006
2081
|
opacity: k ? .4 : 1,
|
|
2007
2082
|
pointerEvents: k ? "none" : void 0
|
|
2008
2083
|
} : void 0,
|
|
2009
2084
|
children: [
|
|
2010
|
-
/* @__PURE__ */ q(
|
|
2085
|
+
/* @__PURE__ */ q(yr, { errors: b }),
|
|
2011
2086
|
r,
|
|
2012
|
-
/* @__PURE__ */ q(
|
|
2087
|
+
/* @__PURE__ */ q(M.Item, {
|
|
2013
2088
|
style: {
|
|
2014
2089
|
marginTop: 16,
|
|
2015
2090
|
marginBottom: 0
|
|
2016
2091
|
},
|
|
2017
|
-
children: /* @__PURE__ */ J(
|
|
2092
|
+
children: /* @__PURE__ */ J(B, { children: [/* @__PURE__ */ q(w, {
|
|
2018
2093
|
type: "primary",
|
|
2019
2094
|
htmlType: "submit",
|
|
2020
2095
|
loading: O,
|
|
@@ -2022,8 +2097,8 @@ function zr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2022
2097
|
children: "Save"
|
|
2023
2098
|
}), c ? /* @__PURE__ */ q(f, {
|
|
2024
2099
|
to: c,
|
|
2025
|
-
children:
|
|
2026
|
-
}) :
|
|
2100
|
+
children: j
|
|
2101
|
+
}) : j] })
|
|
2027
2102
|
})
|
|
2028
2103
|
]
|
|
2029
2104
|
}))]
|
|
@@ -2031,13 +2106,13 @@ function zr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2031
2106
|
})
|
|
2032
2107
|
})
|
|
2033
2108
|
});
|
|
2034
|
-
return T && !O && p === "replace" ? /* @__PURE__ */ q(
|
|
2109
|
+
return T && !O && p === "replace" ? /* @__PURE__ */ q(oe, {}) : ee;
|
|
2035
2110
|
}
|
|
2036
2111
|
//#endregion
|
|
2037
2112
|
//#region src/crud/ResourceFormModal.tsx
|
|
2038
|
-
function
|
|
2113
|
+
function Ur({ resource: e, editId: t, onClose: n, children: r, title: i, permissions: a, defaultValues: o, width: s = 560, onSuccess: c }) {
|
|
2039
2114
|
let l = t === "new", u = t != null, d = X(), f = i ?? (l ? `New ${e}` : `Edit ${e}`), p = a ? Z(d, a, l ? "add" : "change") : !0;
|
|
2040
|
-
return /* @__PURE__ */ q(
|
|
2115
|
+
return /* @__PURE__ */ q(ne, {
|
|
2041
2116
|
open: u,
|
|
2042
2117
|
title: f,
|
|
2043
2118
|
onCancel: n,
|
|
@@ -2045,7 +2120,7 @@ function Br({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
2045
2120
|
destroyOnHidden: !0,
|
|
2046
2121
|
width: s,
|
|
2047
2122
|
maskClosable: !1,
|
|
2048
|
-
children: /* @__PURE__ */ q(S, { children: /* @__PURE__ */ q(
|
|
2123
|
+
children: /* @__PURE__ */ q(S, { children: /* @__PURE__ */ q(Hr, {
|
|
2049
2124
|
resource: e,
|
|
2050
2125
|
id: t ?? void 0,
|
|
2051
2126
|
enabled: u,
|
|
@@ -2062,7 +2137,7 @@ function Br({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
2062
2137
|
}
|
|
2063
2138
|
//#endregion
|
|
2064
2139
|
//#region src/crud/ListActionsBar.tsx
|
|
2065
|
-
function
|
|
2140
|
+
function Wr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelected: r, onSelectAllMatching: i, onClearSelection: o, actions: s, onExecute: c, selectedIds: u, running: f = !1 }) {
|
|
2066
2141
|
let [p, m] = d(), h = l(() => s.map((e) => ({
|
|
2067
2142
|
value: e.key,
|
|
2068
2143
|
label: e.label
|
|
@@ -2076,7 +2151,7 @@ function Vr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2076
2151
|
e,
|
|
2077
2152
|
u
|
|
2078
2153
|
]), _ = n && !r && t > e;
|
|
2079
|
-
return /* @__PURE__ */ J(
|
|
2154
|
+
return /* @__PURE__ */ J(B, {
|
|
2080
2155
|
wrap: !0,
|
|
2081
2156
|
style: {
|
|
2082
2157
|
marginBottom: 16,
|
|
@@ -2125,7 +2200,7 @@ function Vr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2125
2200
|
" items selected"
|
|
2126
2201
|
]
|
|
2127
2202
|
})] }) : null,
|
|
2128
|
-
/* @__PURE__ */ q(
|
|
2203
|
+
/* @__PURE__ */ q(z, {
|
|
2129
2204
|
placeholder: "Action",
|
|
2130
2205
|
style: { minWidth: 200 },
|
|
2131
2206
|
options: h,
|
|
@@ -2146,14 +2221,14 @@ function Vr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2146
2221
|
}
|
|
2147
2222
|
//#endregion
|
|
2148
2223
|
//#region src/crud/types.ts
|
|
2149
|
-
var
|
|
2224
|
+
var Gr = new Set([
|
|
2150
2225
|
"page",
|
|
2151
2226
|
"perPage",
|
|
2152
2227
|
"sort",
|
|
2153
2228
|
"create",
|
|
2154
2229
|
"edit"
|
|
2155
|
-
]),
|
|
2156
|
-
function
|
|
2230
|
+
]), Kr = 1, qr = 10;
|
|
2231
|
+
function Jr(e) {
|
|
2157
2232
|
if (e.includes(",")) {
|
|
2158
2233
|
let t = e.split(",").map((e) => e.trim()), n = t.map(Number);
|
|
2159
2234
|
return n.every((e) => Number.isFinite(e)) ? n : t;
|
|
@@ -2161,16 +2236,16 @@ function Gr(e) {
|
|
|
2161
2236
|
let t = Number(e);
|
|
2162
2237
|
return e !== "" && Number.isFinite(t) && String(t) === e ? t : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
2163
2238
|
}
|
|
2164
|
-
function
|
|
2239
|
+
function Yr(e) {
|
|
2165
2240
|
return e == null || e === "" ? null : Array.isArray(e) ? e.length === 0 ? null : e.map(String).join(",") : String(e);
|
|
2166
2241
|
}
|
|
2167
|
-
function
|
|
2242
|
+
function Xr(e) {
|
|
2168
2243
|
let [t, n] = b(), r = l(() => {
|
|
2169
|
-
let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) ||
|
|
2244
|
+
let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) || Kr) : Kr, a = r ? Math.max(1, Number(r) || qr) : qr, o = t.getAll("sort"), s = o.length > 0 ? o.flatMap((e) => Hn(e)) : Hn(t.get("sort")), c = { ...e };
|
|
2170
2245
|
return t.forEach((e, n) => {
|
|
2171
|
-
if (
|
|
2246
|
+
if (Gr.has(n)) return;
|
|
2172
2247
|
let r = c[n];
|
|
2173
|
-
r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(
|
|
2248
|
+
r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(Jr) : c[n] = Jr(e) : c[n] = [...Array.isArray(r) ? r : [r], Jr(e)];
|
|
2174
2249
|
}), {
|
|
2175
2250
|
page: i,
|
|
2176
2251
|
perPage: a,
|
|
@@ -2193,19 +2268,19 @@ function qr(e) {
|
|
|
2193
2268
|
},
|
|
2194
2269
|
setPerPage: (e) => {
|
|
2195
2270
|
i((t) => {
|
|
2196
|
-
e ===
|
|
2271
|
+
e === qr ? t.delete("perPage") : t.set("perPage", String(e)), t.delete("page");
|
|
2197
2272
|
});
|
|
2198
2273
|
},
|
|
2199
2274
|
setSort: (e) => {
|
|
2200
2275
|
i((t) => {
|
|
2201
2276
|
t.delete("sort");
|
|
2202
|
-
let n =
|
|
2277
|
+
let n = Un(e);
|
|
2203
2278
|
n && t.set("sort", n);
|
|
2204
2279
|
});
|
|
2205
2280
|
},
|
|
2206
2281
|
toggleSort: (e) => {
|
|
2207
2282
|
i((t) => {
|
|
2208
|
-
let n = t.getAll("sort").flatMap((e) =>
|
|
2283
|
+
let n = t.getAll("sort").flatMap((e) => Hn(e)), r = n.findIndex((t) => t.field === e), i;
|
|
2209
2284
|
i = r < 0 ? [...n, {
|
|
2210
2285
|
field: e,
|
|
2211
2286
|
order: "ASC"
|
|
@@ -2213,22 +2288,22 @@ function qr(e) {
|
|
|
2213
2288
|
...e,
|
|
2214
2289
|
order: "DESC"
|
|
2215
2290
|
} : e) : n.filter((e, t) => t !== r), t.delete("sort");
|
|
2216
|
-
let a =
|
|
2291
|
+
let a = Un(i);
|
|
2217
2292
|
a && t.set("sort", a);
|
|
2218
2293
|
});
|
|
2219
2294
|
},
|
|
2220
2295
|
setFilter: (e, t) => {
|
|
2221
2296
|
i((n) => {
|
|
2222
2297
|
n.delete(e);
|
|
2223
|
-
let r =
|
|
2298
|
+
let r = Yr(t);
|
|
2224
2299
|
r != null && n.set(e, r), n.delete("page");
|
|
2225
2300
|
});
|
|
2226
2301
|
},
|
|
2227
2302
|
setFilters: (e) => {
|
|
2228
2303
|
i((t) => {
|
|
2229
|
-
for (let e of [...t.keys()])
|
|
2304
|
+
for (let e of [...t.keys()]) Gr.has(e) || t.delete(e);
|
|
2230
2305
|
for (let [n, r] of Object.entries(e)) {
|
|
2231
|
-
let e =
|
|
2306
|
+
let e = Yr(r);
|
|
2232
2307
|
e != null && t.set(n, e);
|
|
2233
2308
|
}
|
|
2234
2309
|
t.delete("page");
|
|
@@ -2253,20 +2328,20 @@ function qr(e) {
|
|
|
2253
2328
|
}
|
|
2254
2329
|
//#endregion
|
|
2255
2330
|
//#region src/crud/ResourceList.tsx
|
|
2256
|
-
var
|
|
2257
|
-
function
|
|
2258
|
-
return o(
|
|
2331
|
+
var Zr = t(null);
|
|
2332
|
+
function Qr() {
|
|
2333
|
+
return o(Zr);
|
|
2259
2334
|
}
|
|
2260
|
-
function
|
|
2335
|
+
function $r(e) {
|
|
2261
2336
|
return e == null || e === "" ? "—" : String(e);
|
|
2262
2337
|
}
|
|
2263
|
-
function
|
|
2338
|
+
function ei(e, t) {
|
|
2264
2339
|
if (e.length === 0 || !t.showEdit && !t.showQuickEdit) return e;
|
|
2265
2340
|
let [n, ...r] = e, i = n.render;
|
|
2266
2341
|
return [{
|
|
2267
2342
|
...n,
|
|
2268
2343
|
render: (e, n, r) => {
|
|
2269
|
-
let a = i ? i(e, n, r) :
|
|
2344
|
+
let a = i ? i(e, n, r) : $r(e);
|
|
2270
2345
|
return t.showEdit ? /* @__PURE__ */ q(f, {
|
|
2271
2346
|
to: `${t.pathPrefix}/${String(n.id)}`,
|
|
2272
2347
|
className: "ding-admin-row-edit-link",
|
|
@@ -2286,9 +2361,9 @@ function Zr(e, t) {
|
|
|
2286
2361
|
}
|
|
2287
2362
|
}, ...r];
|
|
2288
2363
|
}
|
|
2289
|
-
function
|
|
2290
|
-
let x =
|
|
2291
|
-
|
|
2364
|
+
function ti({ 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 }) {
|
|
2365
|
+
let x = Yt(), C = X(), { message: E, modal: D } = S.useApp(), { token: O } = G.useToken(), { columns: k, sortOrders: A, sortPriorities: j } = qn(), M = u(null), [ee, N] = d(), [P, F] = d(!1), [I, te] = d([]), [L, ne] = d(0), [ie, R] = d(() => /* @__PURE__ */ new Set()), [ae, z] = d(!1), oe = r ?? `${n}/new`, V = Z(C, v, "add"), se = Z(C, v, "change"), H = Z(C, v, "delete"), le = se && (i === "page" || i === "both") && s?.edit !== !1, U = se && (i === "modal" || i === "both") && s?.quickEdit !== !1, ue = H && s?.delete !== !1, de = le || U || ue || p, me = a(() => {
|
|
2366
|
+
R(/* @__PURE__ */ new Set());
|
|
2292
2367
|
}, []), he = l(() => {
|
|
2293
2368
|
if (!_) return [];
|
|
2294
2369
|
let t = [];
|
|
@@ -2308,16 +2383,16 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2308
2383
|
x,
|
|
2309
2384
|
e,
|
|
2310
2385
|
E
|
|
2311
|
-
]), ge = he.length > 0, _e =
|
|
2386
|
+
]), ge = he.length > 0, _e = ie.size;
|
|
2312
2387
|
c(() => {
|
|
2313
|
-
let e =
|
|
2388
|
+
let e = M.current;
|
|
2314
2389
|
if (!e) return;
|
|
2315
2390
|
let t = e.closest(".ding-admin-scroll");
|
|
2316
2391
|
t?.classList.add("ding-admin-resource-list-scroll");
|
|
2317
2392
|
let n = () => {
|
|
2318
2393
|
if (e.clientHeight <= 0) return;
|
|
2319
2394
|
let t = e.querySelector(".ding-admin-resource-list-pagination"), n = e.querySelector(".ant-table-header"), r = t?.offsetHeight ?? 0, i = t ? parseFloat(getComputedStyle(t).marginTop) + parseFloat(getComputedStyle(t).marginBottom) : 0, a = n?.offsetHeight ?? 0, o = e.querySelector(".ant-table-body"), s = o && o.scrollWidth > o.clientWidth ? o.offsetHeight - o.clientHeight : 0, c = Math.max(120, Math.floor(e.clientHeight - a - r - i - s - 8));
|
|
2320
|
-
|
|
2395
|
+
N((e) => e === c ? e : c);
|
|
2321
2396
|
};
|
|
2322
2397
|
n();
|
|
2323
2398
|
let r = new ResizeObserver(() => n());
|
|
@@ -2327,39 +2402,39 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2327
2402
|
}, [
|
|
2328
2403
|
ge,
|
|
2329
2404
|
_e,
|
|
2330
|
-
|
|
2331
|
-
|
|
2405
|
+
L,
|
|
2406
|
+
P
|
|
2332
2407
|
]);
|
|
2333
|
-
let ve =
|
|
2334
|
-
|
|
2335
|
-
let n = new Set(t), r =
|
|
2408
|
+
let ve = I.length > 0 && I.every((e) => ie.has(e.id)), ye = L > 0 && _e >= L, be = l(() => I.filter((e) => ie.has(e.id)).map((e) => e.id), [I, ie]), xe = a((e) => {
|
|
2409
|
+
R((t) => {
|
|
2410
|
+
let n = new Set(t), r = I.map((e) => e.id);
|
|
2336
2411
|
for (let t of r) e.includes(t) || n.delete(t);
|
|
2337
2412
|
for (let t of e) n.add(t);
|
|
2338
2413
|
return n;
|
|
2339
2414
|
});
|
|
2340
|
-
}, [
|
|
2341
|
-
if (!(
|
|
2342
|
-
|
|
2415
|
+
}, [I]), Se = a(async () => {
|
|
2416
|
+
if (!(L <= 0)) {
|
|
2417
|
+
z(!0);
|
|
2343
2418
|
try {
|
|
2344
2419
|
let t = y.sort.length === 0 ? void 0 : y.sort.length === 1 ? y.sort[0] : y.sort, n = await x.getList(e, {
|
|
2345
2420
|
pagination: {
|
|
2346
2421
|
page: 1,
|
|
2347
|
-
perPage:
|
|
2422
|
+
perPage: L
|
|
2348
2423
|
},
|
|
2349
2424
|
sort: t,
|
|
2350
2425
|
filter: y.filter
|
|
2351
2426
|
});
|
|
2352
|
-
|
|
2427
|
+
R(new Set(n.data.map((e) => e.id)));
|
|
2353
2428
|
} catch (e) {
|
|
2354
2429
|
E.error(e instanceof Error ? e.message : "Load failed");
|
|
2355
2430
|
} finally {
|
|
2356
|
-
|
|
2431
|
+
z(!1);
|
|
2357
2432
|
}
|
|
2358
2433
|
}
|
|
2359
2434
|
}, [
|
|
2360
2435
|
x,
|
|
2361
2436
|
e,
|
|
2362
|
-
|
|
2437
|
+
L,
|
|
2363
2438
|
y.sort,
|
|
2364
2439
|
y.filter,
|
|
2365
2440
|
E
|
|
@@ -2395,18 +2470,18 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2395
2470
|
filter: y.filter
|
|
2396
2471
|
};
|
|
2397
2472
|
}, [y]), Y = a(async (t) => {
|
|
2398
|
-
|
|
2473
|
+
F(!0);
|
|
2399
2474
|
try {
|
|
2400
2475
|
let n = await x.getList(e, {
|
|
2401
2476
|
...we,
|
|
2402
2477
|
signal: t
|
|
2403
2478
|
});
|
|
2404
2479
|
if (t?.aborted) return;
|
|
2405
|
-
|
|
2480
|
+
te(n.data), ne(n.total);
|
|
2406
2481
|
} catch (e) {
|
|
2407
|
-
|
|
2482
|
+
$t(e) || E.error(e instanceof Error ? e.message : "Load failed");
|
|
2408
2483
|
} finally {
|
|
2409
|
-
t?.aborted ||
|
|
2484
|
+
t?.aborted || F(!1);
|
|
2410
2485
|
}
|
|
2411
2486
|
}, [
|
|
2412
2487
|
x,
|
|
@@ -2414,7 +2489,7 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2414
2489
|
we,
|
|
2415
2490
|
E
|
|
2416
2491
|
]);
|
|
2417
|
-
|
|
2492
|
+
zr((e) => Y(e), [Y]);
|
|
2418
2493
|
let Te = l(() => ({
|
|
2419
2494
|
reload: () => void Y(),
|
|
2420
2495
|
clearSelection: me
|
|
@@ -2430,13 +2505,13 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2430
2505
|
});
|
|
2431
2506
|
})) return;
|
|
2432
2507
|
}
|
|
2433
|
-
|
|
2508
|
+
z(!0);
|
|
2434
2509
|
try {
|
|
2435
2510
|
await e.execute(t, Te);
|
|
2436
2511
|
} catch (e) {
|
|
2437
2512
|
E.error(e instanceof Error ? e.message : "Action failed");
|
|
2438
2513
|
} finally {
|
|
2439
|
-
|
|
2514
|
+
z(!1);
|
|
2440
2515
|
}
|
|
2441
2516
|
}, [
|
|
2442
2517
|
Te,
|
|
@@ -2458,7 +2533,7 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2458
2533
|
let e = k.map((e) => {
|
|
2459
2534
|
let t = e.buildColumn();
|
|
2460
2535
|
if (e.sortable) {
|
|
2461
|
-
let n =
|
|
2536
|
+
let n = A.get(e.source), r = j.get(e.source), i = n === "ASC" ? "ascend" : n === "DESC" ? "descend" : void 0, a = i == null ? void 0 : /* @__PURE__ */ J("span", {
|
|
2462
2537
|
style: {
|
|
2463
2538
|
display: "inline-flex",
|
|
2464
2539
|
alignItems: "center",
|
|
@@ -2475,7 +2550,7 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2475
2550
|
textAlign: "center"
|
|
2476
2551
|
},
|
|
2477
2552
|
children: r
|
|
2478
|
-
}), q(i === "ascend" ?
|
|
2553
|
+
}), q(i === "ascend" ? pe : fe, { style: { fontSize: 11 } })]
|
|
2479
2554
|
});
|
|
2480
2555
|
return {
|
|
2481
2556
|
...t,
|
|
@@ -2486,9 +2561,9 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2486
2561
|
}
|
|
2487
2562
|
return t;
|
|
2488
2563
|
});
|
|
2489
|
-
if (!
|
|
2490
|
-
showEdit:
|
|
2491
|
-
showQuickEdit:
|
|
2564
|
+
if (!de) return ei(e, {
|
|
2565
|
+
showEdit: le,
|
|
2566
|
+
showQuickEdit: U,
|
|
2492
2567
|
pathPrefix: n,
|
|
2493
2568
|
openEditModal: b.openEditModal
|
|
2494
2569
|
});
|
|
@@ -2499,15 +2574,15 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2499
2574
|
title: "Actions",
|
|
2500
2575
|
key: "__actions",
|
|
2501
2576
|
width: i === "both" ? 200 : 160,
|
|
2502
|
-
render: (e, r) => /* @__PURE__ */ J(
|
|
2577
|
+
render: (e, r) => /* @__PURE__ */ J(B, {
|
|
2503
2578
|
size: "small",
|
|
2504
2579
|
wrap: !0,
|
|
2505
2580
|
children: [
|
|
2506
|
-
|
|
2581
|
+
le ? /* @__PURE__ */ q(f, {
|
|
2507
2582
|
to: `${n}/${String(r.id)}`,
|
|
2508
2583
|
children: "Edit"
|
|
2509
2584
|
}) : null,
|
|
2510
|
-
|
|
2585
|
+
U ? /* @__PURE__ */ q(w, {
|
|
2511
2586
|
type: "link",
|
|
2512
2587
|
size: "small",
|
|
2513
2588
|
style: { padding: 0 },
|
|
@@ -2526,23 +2601,23 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2526
2601
|
]
|
|
2527
2602
|
})
|
|
2528
2603
|
};
|
|
2529
|
-
return
|
|
2530
|
-
showEdit:
|
|
2531
|
-
showQuickEdit:
|
|
2604
|
+
return ei([...e, r], {
|
|
2605
|
+
showEdit: le,
|
|
2606
|
+
showQuickEdit: U,
|
|
2532
2607
|
pathPrefix: n,
|
|
2533
2608
|
openEditModal: b.openEditModal
|
|
2534
2609
|
});
|
|
2535
2610
|
}, [
|
|
2536
2611
|
k,
|
|
2537
|
-
|
|
2538
|
-
U,
|
|
2612
|
+
de,
|
|
2539
2613
|
le,
|
|
2614
|
+
U,
|
|
2540
2615
|
ue,
|
|
2541
2616
|
i,
|
|
2542
2617
|
n,
|
|
2543
2618
|
De,
|
|
2544
|
-
ee,
|
|
2545
2619
|
A,
|
|
2620
|
+
j,
|
|
2546
2621
|
b,
|
|
2547
2622
|
p,
|
|
2548
2623
|
Y
|
|
@@ -2563,7 +2638,7 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2563
2638
|
style: { margin: 0 },
|
|
2564
2639
|
children: t
|
|
2565
2640
|
}),
|
|
2566
|
-
extra: m || V ? /* @__PURE__ */ J(
|
|
2641
|
+
extra: m || V ? /* @__PURE__ */ J(B, { children: [m, V ? i === "modal" || i === "both" ? /* @__PURE__ */ J(K, { children: [i === "both" ? /* @__PURE__ */ q(f, {
|
|
2567
2642
|
to: oe,
|
|
2568
2643
|
children: /* @__PURE__ */ q(w, { children: "New page" })
|
|
2569
2644
|
}) : null, /* @__PURE__ */ q(w, {
|
|
@@ -2577,32 +2652,32 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2577
2652
|
children: "New"
|
|
2578
2653
|
})
|
|
2579
2654
|
}) : null] }) : null,
|
|
2580
|
-
children: [ge ? /* @__PURE__ */ q(
|
|
2655
|
+
children: [ge ? /* @__PURE__ */ q(Wr, {
|
|
2581
2656
|
selectedCount: _e,
|
|
2582
|
-
total:
|
|
2657
|
+
total: L,
|
|
2583
2658
|
allPageSelected: ve,
|
|
2584
2659
|
allMatchingSelected: ye,
|
|
2585
2660
|
onSelectAllMatching: () => void Se(),
|
|
2586
2661
|
onClearSelection: me,
|
|
2587
2662
|
actions: he,
|
|
2588
2663
|
onExecute: Ee,
|
|
2589
|
-
selectedIds: [...
|
|
2590
|
-
running:
|
|
2664
|
+
selectedIds: [...ie],
|
|
2665
|
+
running: ae || P
|
|
2591
2666
|
}) : null, /* @__PURE__ */ J("div", {
|
|
2592
|
-
ref:
|
|
2667
|
+
ref: M,
|
|
2593
2668
|
className: "ding-admin-resource-list-table",
|
|
2594
2669
|
style: {
|
|
2595
2670
|
"--ding-scroll-thumb": O.colorTextQuaternary,
|
|
2596
2671
|
"--ding-scroll-thumb-hover": O.colorTextTertiary
|
|
2597
2672
|
},
|
|
2598
|
-
children: [/* @__PURE__ */ q(
|
|
2673
|
+
children: [/* @__PURE__ */ q(ce, {
|
|
2599
2674
|
rowKey: "id",
|
|
2600
|
-
loading:
|
|
2675
|
+
loading: P,
|
|
2601
2676
|
columns: Oe,
|
|
2602
|
-
dataSource:
|
|
2677
|
+
dataSource: I,
|
|
2603
2678
|
scroll: {
|
|
2604
2679
|
x: "max-content",
|
|
2605
|
-
...
|
|
2680
|
+
...ee ? { y: ee } : {}
|
|
2606
2681
|
},
|
|
2607
2682
|
rowSelection: ge ? {
|
|
2608
2683
|
selectedRowKeys: be,
|
|
@@ -2618,13 +2693,13 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2618
2693
|
children: /* @__PURE__ */ q(re, {
|
|
2619
2694
|
current: y.page,
|
|
2620
2695
|
pageSize: y.perPage,
|
|
2621
|
-
total:
|
|
2696
|
+
total: L,
|
|
2622
2697
|
showSizeChanger: !0,
|
|
2623
2698
|
onChange: ke
|
|
2624
2699
|
})
|
|
2625
2700
|
})]
|
|
2626
2701
|
})]
|
|
2627
|
-
}), Ae ? /* @__PURE__ */ q(
|
|
2702
|
+
}), Ae ? /* @__PURE__ */ q(Ur, {
|
|
2628
2703
|
resource: e,
|
|
2629
2704
|
editId: y.createModal ? "new" : y.editId,
|
|
2630
2705
|
onClose: () => {
|
|
@@ -2633,8 +2708,8 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2633
2708
|
children: o
|
|
2634
2709
|
}) : null] });
|
|
2635
2710
|
}
|
|
2636
|
-
function
|
|
2637
|
-
let [y, b] =
|
|
2711
|
+
function ni({ 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 }) {
|
|
2712
|
+
let [y, b] = Xr(i), x = l(() => {
|
|
2638
2713
|
if (!c) return i ?? {};
|
|
2639
2714
|
let e = {};
|
|
2640
2715
|
for (let [t, n] of Object.entries(y.filter)) i && t in i || (e[t] = n);
|
|
@@ -2649,18 +2724,18 @@ function $r({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2649
2724
|
filterValues: x,
|
|
2650
2725
|
setFilterValue: S
|
|
2651
2726
|
}), [x, S]);
|
|
2652
|
-
return /* @__PURE__ */ q(
|
|
2727
|
+
return /* @__PURE__ */ q(Zr.Provider, {
|
|
2653
2728
|
value: C,
|
|
2654
|
-
children: /* @__PURE__ */ q(
|
|
2729
|
+
children: /* @__PURE__ */ q(tr, {
|
|
2655
2730
|
values: x,
|
|
2656
2731
|
setFilterValue: S,
|
|
2657
2732
|
textFilterDebounceMs: o,
|
|
2658
|
-
children: /* @__PURE__ */ q(
|
|
2733
|
+
children: /* @__PURE__ */ q(Kn, {
|
|
2659
2734
|
toggleSort: b.toggleSort,
|
|
2660
2735
|
sort: y.sort,
|
|
2661
2736
|
children: /* @__PURE__ */ J("div", {
|
|
2662
2737
|
className: "ding-admin-resource-list-root",
|
|
2663
|
-
children: [u, /* @__PURE__ */ q(
|
|
2738
|
+
children: [u, /* @__PURE__ */ q(ti, {
|
|
2664
2739
|
resource: e,
|
|
2665
2740
|
title: t,
|
|
2666
2741
|
pathPrefix: n,
|
|
@@ -2684,13 +2759,13 @@ function $r({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2684
2759
|
}
|
|
2685
2760
|
//#endregion
|
|
2686
2761
|
//#region src/crud/FilterBar.tsx
|
|
2687
|
-
function
|
|
2688
|
-
let e =
|
|
2689
|
-
return !e || e.filters.length === 0 ? null : /* @__PURE__ */ q(
|
|
2762
|
+
function ri() {
|
|
2763
|
+
let e = nr();
|
|
2764
|
+
return !e || e.filters.length === 0 ? null : /* @__PURE__ */ q(B, {
|
|
2690
2765
|
wrap: !0,
|
|
2691
2766
|
size: "middle",
|
|
2692
2767
|
style: { marginBottom: 16 },
|
|
2693
|
-
children: e.filters.map((t) => /* @__PURE__ */ J(
|
|
2768
|
+
children: e.filters.map((t) => /* @__PURE__ */ J(B, {
|
|
2694
2769
|
orientation: "vertical",
|
|
2695
2770
|
size: 2,
|
|
2696
2771
|
children: [t.label ? /* @__PURE__ */ q(W.Text, {
|
|
@@ -2704,12 +2779,12 @@ function ei() {
|
|
|
2704
2779
|
}, t.key))
|
|
2705
2780
|
});
|
|
2706
2781
|
}
|
|
2707
|
-
function
|
|
2708
|
-
return /* @__PURE__ */ J(K, { children: [e, /* @__PURE__ */ q(
|
|
2782
|
+
function ii({ children: e }) {
|
|
2783
|
+
return /* @__PURE__ */ J(K, { children: [e, /* @__PURE__ */ q(ri, {})] });
|
|
2709
2784
|
}
|
|
2710
2785
|
//#endregion
|
|
2711
2786
|
//#region src/crud/ResourceForm.tsx
|
|
2712
|
-
function
|
|
2787
|
+
function ai({ resource: e, title: t, listPath: n, children: r, defaultValues: i, onSaved: a, stayOnPage: o, permissions: c }) {
|
|
2713
2788
|
let { id: l } = y(), u = l === "new" || !l, d = X(), p = v(), { token: m } = G.useToken();
|
|
2714
2789
|
s(() => {
|
|
2715
2790
|
c && (Z(d, c, u ? "add" : "change") || p(n, { replace: !0 }));
|
|
@@ -2722,16 +2797,16 @@ function ni({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2722
2797
|
]);
|
|
2723
2798
|
let h = c ? Z(d, c, u ? "add" : "change") : !0;
|
|
2724
2799
|
return /* @__PURE__ */ q(T, {
|
|
2725
|
-
title: /* @__PURE__ */ J(
|
|
2800
|
+
title: /* @__PURE__ */ J(B, { children: [/* @__PURE__ */ J(f, {
|
|
2726
2801
|
to: n,
|
|
2727
2802
|
style: { color: m.colorText },
|
|
2728
|
-
children: [/* @__PURE__ */ q(
|
|
2803
|
+
children: [/* @__PURE__ */ q(de, {}), " Back"]
|
|
2729
2804
|
}), /* @__PURE__ */ q(W.Title, {
|
|
2730
2805
|
level: 5,
|
|
2731
2806
|
style: { margin: 0 },
|
|
2732
2807
|
children: t
|
|
2733
2808
|
})] }),
|
|
2734
|
-
children: /* @__PURE__ */ q(
|
|
2809
|
+
children: /* @__PURE__ */ q(Hr, {
|
|
2735
2810
|
resource: e,
|
|
2736
2811
|
id: l,
|
|
2737
2812
|
defaultValues: i,
|
|
@@ -2747,18 +2822,18 @@ function ni({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2747
2822
|
}
|
|
2748
2823
|
//#endregion
|
|
2749
2824
|
//#region src/crud/utils/nestedFieldPath.ts
|
|
2750
|
-
function
|
|
2825
|
+
function oi(e, t, n) {
|
|
2751
2826
|
return `${e}.${t}.${n}`;
|
|
2752
2827
|
}
|
|
2753
2828
|
//#endregion
|
|
2754
2829
|
//#region src/crud/InlineFormSet.tsx
|
|
2755
|
-
function
|
|
2830
|
+
function si(e, t) {
|
|
2756
2831
|
let n = {};
|
|
2757
2832
|
for (let r of e) n[r] = t?.[r] ?? void 0;
|
|
2758
2833
|
return n;
|
|
2759
2834
|
}
|
|
2760
|
-
function
|
|
2761
|
-
let { control: r } =
|
|
2835
|
+
function ci(e, t, n) {
|
|
2836
|
+
let { control: r } = Me(), { fields: i, append: a, remove: o } = Ae({
|
|
2762
2837
|
control: r,
|
|
2763
2838
|
name: e,
|
|
2764
2839
|
keyName: "rowKey"
|
|
@@ -2766,12 +2841,12 @@ function ai(e, t, n) {
|
|
|
2766
2841
|
return {
|
|
2767
2842
|
fields: i,
|
|
2768
2843
|
remove: o,
|
|
2769
|
-
appendEmpty: () => a(
|
|
2844
|
+
appendEmpty: () => a(si(t, n))
|
|
2770
2845
|
};
|
|
2771
2846
|
}
|
|
2772
|
-
function
|
|
2773
|
-
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } =
|
|
2774
|
-
|
|
2847
|
+
function li({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, defaultRow: a }) {
|
|
2848
|
+
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } = ci(e, o, a);
|
|
2849
|
+
pr(e), vr(e, o, n, r);
|
|
2775
2850
|
let d = l(() => i.map((t) => ({
|
|
2776
2851
|
title: t.label ?? t.source,
|
|
2777
2852
|
key: t.source,
|
|
@@ -2779,7 +2854,7 @@ function oi({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2779
2854
|
onHeaderCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2780
2855
|
onCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2781
2856
|
render: (n, r, i) => t.cell({
|
|
2782
|
-
name:
|
|
2857
|
+
name: oi(e, i, t.source),
|
|
2783
2858
|
index: i,
|
|
2784
2859
|
field: e
|
|
2785
2860
|
})
|
|
@@ -2791,7 +2866,7 @@ function oi({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2791
2866
|
level: 5,
|
|
2792
2867
|
children: t ?? "Related items"
|
|
2793
2868
|
}),
|
|
2794
|
-
/* @__PURE__ */ q(
|
|
2869
|
+
/* @__PURE__ */ q(ce, {
|
|
2795
2870
|
size: "small",
|
|
2796
2871
|
pagination: !1,
|
|
2797
2872
|
scroll: { x: "max-content" },
|
|
@@ -2821,16 +2896,16 @@ function oi({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2821
2896
|
]
|
|
2822
2897
|
});
|
|
2823
2898
|
}
|
|
2824
|
-
function
|
|
2825
|
-
let { fields: l, remove: u, appendEmpty: d } =
|
|
2826
|
-
return
|
|
2899
|
+
function ui({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, renderRow: a, getCardTitle: o, footer: s, defaultRow: c }) {
|
|
2900
|
+
let { fields: l, remove: u, appendEmpty: d } = ci(e, i, c);
|
|
2901
|
+
return pr(e), vr(e, i, n, r), /* @__PURE__ */ J("div", {
|
|
2827
2902
|
style: { marginTop: 24 },
|
|
2828
2903
|
children: [
|
|
2829
2904
|
/* @__PURE__ */ q(W.Title, {
|
|
2830
2905
|
level: 5,
|
|
2831
2906
|
children: t ?? "Related items"
|
|
2832
2907
|
}),
|
|
2833
|
-
/* @__PURE__ */ q(
|
|
2908
|
+
/* @__PURE__ */ q(B, {
|
|
2834
2909
|
orientation: "vertical",
|
|
2835
2910
|
size: "middle",
|
|
2836
2911
|
style: { width: "100%" },
|
|
@@ -2838,7 +2913,7 @@ function si({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2838
2913
|
let r = {
|
|
2839
2914
|
field: e,
|
|
2840
2915
|
index: n,
|
|
2841
|
-
name: (t) =>
|
|
2916
|
+
name: (t) => oi(e, n, t)
|
|
2842
2917
|
};
|
|
2843
2918
|
return /* @__PURE__ */ q(T, {
|
|
2844
2919
|
size: "small",
|
|
@@ -2866,22 +2941,22 @@ function si({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2866
2941
|
}
|
|
2867
2942
|
//#endregion
|
|
2868
2943
|
//#region src/crud/utils/formSectionErrors.ts
|
|
2869
|
-
function
|
|
2944
|
+
function di(e, t, n) {
|
|
2870
2945
|
for (let r of e) if (t(r, n).invalid) return !0;
|
|
2871
2946
|
return !1;
|
|
2872
2947
|
}
|
|
2873
|
-
function
|
|
2948
|
+
function fi(e) {
|
|
2874
2949
|
let t = u([]);
|
|
2875
2950
|
for (; t.current.length < e;) t.current.push({ current: /* @__PURE__ */ new Set() });
|
|
2876
2951
|
return t.current.length > e && (t.current.length = e), t.current;
|
|
2877
2952
|
}
|
|
2878
|
-
function
|
|
2879
|
-
let { control: n, getFieldState: r, setFocus: i } =
|
|
2953
|
+
function pi(e, t) {
|
|
2954
|
+
let { control: n, getFieldState: r, setFocus: i } = Me(), a = Ne({ control: n }), o = u(0), c = u(0);
|
|
2880
2955
|
s(() => {
|
|
2881
2956
|
if (a.submitCount === 0) return;
|
|
2882
2957
|
let n = Object.keys(a.errors).length, s = a.submitCount !== o.current, l = !s && n > 0 && c.current === 0;
|
|
2883
2958
|
if (o.current = a.submitCount, c.current = n, !s && !l || n === 0) return;
|
|
2884
|
-
let u = e.findIndex((e) =>
|
|
2959
|
+
let u = e.findIndex((e) => di(e.current, r, a));
|
|
2885
2960
|
if (u < 0) return;
|
|
2886
2961
|
t(u);
|
|
2887
2962
|
let d = [...e[u].current].find((e) => r(e, a).invalid);
|
|
@@ -2900,30 +2975,30 @@ function ui(e, t) {
|
|
|
2900
2975
|
}
|
|
2901
2976
|
//#endregion
|
|
2902
2977
|
//#region src/crud/FormTabs.tsx
|
|
2903
|
-
function
|
|
2978
|
+
function mi(e) {
|
|
2904
2979
|
return null;
|
|
2905
2980
|
}
|
|
2906
|
-
function
|
|
2907
|
-
return i(e) && e.type ===
|
|
2981
|
+
function hi(e) {
|
|
2982
|
+
return i(e) && e.type === mi;
|
|
2908
2983
|
}
|
|
2909
|
-
function
|
|
2910
|
-
let { token: s } = G.useToken(), c = l(() => e.toArray(t).filter(
|
|
2984
|
+
function gi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o }) {
|
|
2985
|
+
let { token: s } = G.useToken(), c = l(() => e.toArray(t).filter(hi).map((e, t) => ({
|
|
2911
2986
|
key: e.key ?? String(t),
|
|
2912
2987
|
label: e.props.label,
|
|
2913
2988
|
disabled: e.props.disabled,
|
|
2914
2989
|
children: e.props.children
|
|
2915
|
-
})), [t]), u =
|
|
2990
|
+
})), [t]), u = fi(c.length), f = r !== void 0, [p, m] = d(() => n ?? c[0]?.key ?? "0"), h = f ? r : p, g = a((e) => {
|
|
2916
2991
|
f || m(e), i?.(e);
|
|
2917
2992
|
}, [f, i]);
|
|
2918
|
-
|
|
2993
|
+
pi(u, a((e) => {
|
|
2919
2994
|
let t = c[e]?.key;
|
|
2920
2995
|
t != null && g(t);
|
|
2921
2996
|
}, [g, c]));
|
|
2922
|
-
let { control: _, getFieldState: v } =
|
|
2923
|
-
return /* @__PURE__ */ q(
|
|
2997
|
+
let { control: _, getFieldState: v } = Me(), y = Ne({ control: _ });
|
|
2998
|
+
return /* @__PURE__ */ q(H, {
|
|
2924
2999
|
destroyOnHidden: !1,
|
|
2925
3000
|
items: l(() => c.map((e, t) => {
|
|
2926
|
-
let n =
|
|
3001
|
+
let n = di(u[t].current, v, y);
|
|
2927
3002
|
return {
|
|
2928
3003
|
key: e.key,
|
|
2929
3004
|
label: n ? /* @__PURE__ */ q("span", {
|
|
@@ -2931,7 +3006,7 @@ function pi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
2931
3006
|
children: e.label
|
|
2932
3007
|
}) : e.label,
|
|
2933
3008
|
disabled: e.disabled,
|
|
2934
|
-
children: /* @__PURE__ */ q(
|
|
3009
|
+
children: /* @__PURE__ */ q(cr, {
|
|
2935
3010
|
sourcesRef: u[t],
|
|
2936
3011
|
children: e.children
|
|
2937
3012
|
})
|
|
@@ -2950,17 +3025,17 @@ function pi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
2950
3025
|
}
|
|
2951
3026
|
//#endregion
|
|
2952
3027
|
//#region src/crud/FormSteps.tsx
|
|
2953
|
-
function
|
|
3028
|
+
function _i(e) {
|
|
2954
3029
|
return null;
|
|
2955
3030
|
}
|
|
2956
|
-
function
|
|
2957
|
-
return i(e) && e.type ===
|
|
3031
|
+
function vi(e) {
|
|
3032
|
+
return i(e) && e.type === _i;
|
|
2958
3033
|
}
|
|
2959
|
-
function
|
|
2960
|
-
let m = l(() => e.toArray(t).filter(
|
|
2961
|
-
|
|
2962
|
-
let { control: y, getFieldState: b } =
|
|
2963
|
-
let n =
|
|
3034
|
+
function yi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStepSelect: i = !1, stepsStyle: o, navigationStyle: s, size: c, direction: u, type: f, status: p }) {
|
|
3035
|
+
let m = l(() => e.toArray(t).filter(vi), [t]), h = fi(m.length), [g, _] = d(n), v = m.length - 1;
|
|
3036
|
+
pi(h, _);
|
|
3037
|
+
let { control: y, getFieldState: b } = Me(), x = Ne({ control: y }), S = l(() => m.map((e, t) => {
|
|
3038
|
+
let n = di(h[t].current, b, x);
|
|
2964
3039
|
return {
|
|
2965
3040
|
title: e.props.title,
|
|
2966
3041
|
description: e.props.description,
|
|
@@ -2975,7 +3050,7 @@ function gi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
2975
3050
|
_(e);
|
|
2976
3051
|
}, []);
|
|
2977
3052
|
return /* @__PURE__ */ J(K, { children: [
|
|
2978
|
-
/* @__PURE__ */ q(
|
|
3053
|
+
/* @__PURE__ */ q(V, {
|
|
2979
3054
|
current: g,
|
|
2980
3055
|
items: S,
|
|
2981
3056
|
style: {
|
|
@@ -2990,12 +3065,12 @@ function gi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
2990
3065
|
}),
|
|
2991
3066
|
m.map((e, t) => /* @__PURE__ */ q("div", {
|
|
2992
3067
|
style: { display: g === t ? void 0 : "none" },
|
|
2993
|
-
children: /* @__PURE__ */ q(
|
|
3068
|
+
children: /* @__PURE__ */ q(cr, {
|
|
2994
3069
|
sourcesRef: h[t],
|
|
2995
3070
|
children: e.props.children
|
|
2996
3071
|
})
|
|
2997
3072
|
}, e.key ?? String(t))),
|
|
2998
|
-
r && m.length > 1 ? /* @__PURE__ */ J(
|
|
3073
|
+
r && m.length > 1 ? /* @__PURE__ */ J(B, {
|
|
2999
3074
|
style: {
|
|
3000
3075
|
marginTop: 16,
|
|
3001
3076
|
...s
|
|
@@ -3016,15 +3091,15 @@ function gi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
3016
3091
|
//#endregion
|
|
3017
3092
|
//#region src/crud/fields/FieldWrapper.tsx
|
|
3018
3093
|
function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, children: o }) {
|
|
3019
|
-
let s = t ?? e, c = !s.includes("."), { control: l } =
|
|
3020
|
-
return
|
|
3094
|
+
let s = t ?? e, c = !s.includes("."), { control: l } = Me(), u = or(), d = a ? void 0 : n ?? e, f = n ?? e;
|
|
3095
|
+
return pr(e, c), mr(e, c), /* @__PURE__ */ q(Oe, {
|
|
3021
3096
|
name: s,
|
|
3022
3097
|
control: l,
|
|
3023
3098
|
rules: {
|
|
3024
3099
|
required: r ? `${f} is required` : !1,
|
|
3025
3100
|
...i
|
|
3026
3101
|
},
|
|
3027
|
-
render: ({ field: e, fieldState: t }) => /* @__PURE__ */ q(
|
|
3102
|
+
render: ({ field: e, fieldState: t }) => /* @__PURE__ */ q(M.Item, {
|
|
3028
3103
|
label: d,
|
|
3029
3104
|
validateStatus: t.error ? "error" : void 0,
|
|
3030
3105
|
help: t.error?.message,
|
|
@@ -3042,7 +3117,7 @@ function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3042
3117
|
}
|
|
3043
3118
|
//#endregion
|
|
3044
3119
|
//#region src/crud/fields/TextField.tsx
|
|
3045
|
-
function
|
|
3120
|
+
function bi({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s }) {
|
|
3046
3121
|
return /* @__PURE__ */ q($, {
|
|
3047
3122
|
source: e,
|
|
3048
3123
|
name: t,
|
|
@@ -3050,7 +3125,7 @@ function _i({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3050
3125
|
required: r,
|
|
3051
3126
|
rules: i,
|
|
3052
3127
|
hideLabel: s,
|
|
3053
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(
|
|
3128
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(P, {
|
|
3054
3129
|
value: e,
|
|
3055
3130
|
onChange: (e) => t(e.target.value),
|
|
3056
3131
|
onBlur: n,
|
|
@@ -3062,7 +3137,7 @@ function _i({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3062
3137
|
}
|
|
3063
3138
|
//#endregion
|
|
3064
3139
|
//#region src/crud/fields/TextAreaField.tsx
|
|
3065
|
-
function
|
|
3140
|
+
function xi({ 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 }) {
|
|
3066
3141
|
return /* @__PURE__ */ q($, {
|
|
3067
3142
|
source: e,
|
|
3068
3143
|
name: t,
|
|
@@ -3070,7 +3145,7 @@ function vi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3070
3145
|
required: r,
|
|
3071
3146
|
rules: i,
|
|
3072
3147
|
hideLabel: s,
|
|
3073
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(
|
|
3148
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(P.TextArea, {
|
|
3074
3149
|
value: e,
|
|
3075
3150
|
onChange: (e) => t(e.target.value),
|
|
3076
3151
|
onBlur: n,
|
|
@@ -3086,7 +3161,7 @@ function vi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3086
3161
|
}
|
|
3087
3162
|
//#endregion
|
|
3088
3163
|
//#region src/crud/fields/NumberField.tsx
|
|
3089
|
-
function
|
|
3164
|
+
function Si({ source: e, name: t, label: n, required: r, rules: i, min: a, max: o, step: s, inputStyle: c, hideLabel: l }) {
|
|
3090
3165
|
return /* @__PURE__ */ q($, {
|
|
3091
3166
|
source: e,
|
|
3092
3167
|
name: t,
|
|
@@ -3094,7 +3169,7 @@ function yi({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3094
3169
|
required: r,
|
|
3095
3170
|
rules: i,
|
|
3096
3171
|
hideLabel: l,
|
|
3097
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(
|
|
3172
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(F, {
|
|
3098
3173
|
value: e,
|
|
3099
3174
|
onChange: (e) => t(e),
|
|
3100
3175
|
onBlur: n,
|
|
@@ -3111,7 +3186,7 @@ function yi({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3111
3186
|
}
|
|
3112
3187
|
//#endregion
|
|
3113
3188
|
//#region src/crud/fields/BooleanField.tsx
|
|
3114
|
-
function
|
|
3189
|
+
function Ci({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, disabled: o }) {
|
|
3115
3190
|
return /* @__PURE__ */ q($, {
|
|
3116
3191
|
source: e,
|
|
3117
3192
|
name: t,
|
|
@@ -3119,7 +3194,7 @@ function bi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3119
3194
|
required: r,
|
|
3120
3195
|
rules: i,
|
|
3121
3196
|
hideLabel: a,
|
|
3122
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(
|
|
3197
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(se, {
|
|
3123
3198
|
checked: !!e,
|
|
3124
3199
|
onChange: t,
|
|
3125
3200
|
disabled: n || o
|
|
@@ -3128,7 +3203,7 @@ function bi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3128
3203
|
}
|
|
3129
3204
|
//#endregion
|
|
3130
3205
|
//#region src/crud/utils/parseDayjsValue.ts
|
|
3131
|
-
var
|
|
3206
|
+
var wi = /* @__PURE__ */ We((/* @__PURE__ */ He(((e, t) => {
|
|
3132
3207
|
(function(n, r) {
|
|
3133
3208
|
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();
|
|
3134
3209
|
})(e, (function() {
|
|
@@ -3285,22 +3360,22 @@ var xi = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
|
3285
3360
|
};
|
|
3286
3361
|
}));
|
|
3287
3362
|
})))(), 1);
|
|
3288
|
-
|
|
3289
|
-
function
|
|
3363
|
+
Fe.extend(wi.default);
|
|
3364
|
+
function Ti(e, t) {
|
|
3290
3365
|
if (e == null || e === "") return null;
|
|
3291
|
-
if (
|
|
3292
|
-
let n =
|
|
3293
|
-
return n.isValid() ? n :
|
|
3366
|
+
if (Fe.isDayjs(e)) return e;
|
|
3367
|
+
let n = Fe(String(e), t, !0);
|
|
3368
|
+
return n.isValid() ? n : Fe(String(e)).isValid() ? Fe(String(e)) : null;
|
|
3294
3369
|
}
|
|
3295
3370
|
//#endregion
|
|
3296
3371
|
//#region src/crud/fields/DateField.tsx
|
|
3297
|
-
var
|
|
3298
|
-
|
|
3299
|
-
|
|
3372
|
+
var Ei = "YYYY-MM-DD", Di = `${Ei} HH:mm:ss`, Oi = [
|
|
3373
|
+
Ei,
|
|
3374
|
+
Di,
|
|
3300
3375
|
"YYYY-MM-DDTHH:mm:ss",
|
|
3301
3376
|
"YYYY-MM-DDTHH:mm:ssZ"
|
|
3302
3377
|
];
|
|
3303
|
-
function
|
|
3378
|
+
function ki({ source: e, name: t, label: n, required: r, rules: i, showTime: a, hideLabel: o }) {
|
|
3304
3379
|
return /* @__PURE__ */ q($, {
|
|
3305
3380
|
source: e,
|
|
3306
3381
|
name: t,
|
|
@@ -3309,33 +3384,33 @@ function Ei({ source: e, name: t, label: n, required: r, rules: i, showTime: a,
|
|
|
3309
3384
|
rules: i,
|
|
3310
3385
|
hideLabel: o,
|
|
3311
3386
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(O, {
|
|
3312
|
-
value:
|
|
3313
|
-
onChange: (e) => t(e ? e.format(a ?
|
|
3387
|
+
value: Ti(e, a ? [...Oi, Di] : Oi),
|
|
3388
|
+
onChange: (e) => t(e ? e.format(a ? Di : Ei) : null),
|
|
3314
3389
|
onBlur: n,
|
|
3315
3390
|
showTime: a,
|
|
3316
3391
|
disabled: r,
|
|
3317
|
-
format: a ?
|
|
3392
|
+
format: a ? Di : Ei,
|
|
3318
3393
|
style: { width: "100%" }
|
|
3319
3394
|
})
|
|
3320
3395
|
});
|
|
3321
3396
|
}
|
|
3322
3397
|
//#endregion
|
|
3323
3398
|
//#region src/crud/fields/DateTimeField.tsx
|
|
3324
|
-
function
|
|
3325
|
-
return /* @__PURE__ */ q(
|
|
3399
|
+
function Ai(e) {
|
|
3400
|
+
return /* @__PURE__ */ q(ki, {
|
|
3326
3401
|
showTime: !0,
|
|
3327
3402
|
...e
|
|
3328
3403
|
});
|
|
3329
3404
|
}
|
|
3330
3405
|
//#endregion
|
|
3331
3406
|
//#region src/crud/fields/TimeField.tsx
|
|
3332
|
-
var
|
|
3333
|
-
|
|
3407
|
+
var ji = "HH:mm:ss", Mi = [
|
|
3408
|
+
ji,
|
|
3334
3409
|
"HH:mm",
|
|
3335
3410
|
"H:mm:ss",
|
|
3336
3411
|
"H:mm"
|
|
3337
3412
|
];
|
|
3338
|
-
function
|
|
3413
|
+
function Ni({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, format: o = ji }) {
|
|
3339
3414
|
return /* @__PURE__ */ q($, {
|
|
3340
3415
|
source: e,
|
|
3341
3416
|
name: t,
|
|
@@ -3343,8 +3418,8 @@ function Ai({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3343
3418
|
required: r,
|
|
3344
3419
|
rules: i,
|
|
3345
3420
|
hideLabel: a,
|
|
3346
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(
|
|
3347
|
-
value:
|
|
3421
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(le, {
|
|
3422
|
+
value: Ti(e, Mi),
|
|
3348
3423
|
onChange: (e) => t(e ? e.format(o) : null),
|
|
3349
3424
|
onBlur: n,
|
|
3350
3425
|
disabled: r,
|
|
@@ -3355,7 +3430,7 @@ function Ai({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3355
3430
|
}
|
|
3356
3431
|
//#endregion
|
|
3357
3432
|
//#region src/crud/fields/SelectField.tsx
|
|
3358
|
-
function
|
|
3433
|
+
function Pi({ source: e, name: t, label: n, required: r, rules: i, choices: a, mode: o, allowClear: s, hideLabel: c }) {
|
|
3359
3434
|
return /* @__PURE__ */ q($, {
|
|
3360
3435
|
source: e,
|
|
3361
3436
|
name: t,
|
|
@@ -3363,7 +3438,7 @@ function ji({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3363
3438
|
required: r,
|
|
3364
3439
|
rules: i,
|
|
3365
3440
|
hideLabel: c,
|
|
3366
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(
|
|
3441
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(z, {
|
|
3367
3442
|
value: e,
|
|
3368
3443
|
onChange: t,
|
|
3369
3444
|
options: a,
|
|
@@ -3376,7 +3451,7 @@ function ji({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3376
3451
|
}
|
|
3377
3452
|
//#endregion
|
|
3378
3453
|
//#region src/crud/fields/PasswordField.tsx
|
|
3379
|
-
function
|
|
3454
|
+
function Fi({ source: e, name: t, label: n, required: r, rules: i, autoComplete: a, hideLabel: o }) {
|
|
3380
3455
|
return /* @__PURE__ */ q($, {
|
|
3381
3456
|
source: e,
|
|
3382
3457
|
name: t,
|
|
@@ -3384,7 +3459,7 @@ function Mi({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3384
3459
|
required: r,
|
|
3385
3460
|
rules: i,
|
|
3386
3461
|
hideLabel: o,
|
|
3387
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(
|
|
3462
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(P.Password, {
|
|
3388
3463
|
value: e,
|
|
3389
3464
|
onChange: (e) => t(e.target.value),
|
|
3390
3465
|
onBlur: n,
|
|
@@ -3393,12 +3468,12 @@ function Mi({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3393
3468
|
})
|
|
3394
3469
|
});
|
|
3395
3470
|
}
|
|
3396
|
-
function
|
|
3397
|
-
let l =
|
|
3471
|
+
function Ii({ source: e, name: t, label: n, required: r, rules: i, confirmSource: a, confirmLabel: o = "Confirm password", autoComplete: s = "new-password", hideLabel: c }) {
|
|
3472
|
+
let l = Pe({
|
|
3398
3473
|
name: t ?? e,
|
|
3399
3474
|
disabled: !a
|
|
3400
3475
|
});
|
|
3401
|
-
return a ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(
|
|
3476
|
+
return a ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(Fi, {
|
|
3402
3477
|
source: e,
|
|
3403
3478
|
name: t,
|
|
3404
3479
|
label: n,
|
|
@@ -3406,14 +3481,14 @@ function Ni({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3406
3481
|
rules: i,
|
|
3407
3482
|
autoComplete: s,
|
|
3408
3483
|
hideLabel: c
|
|
3409
|
-
}), /* @__PURE__ */ q(
|
|
3484
|
+
}), /* @__PURE__ */ q(Fi, {
|
|
3410
3485
|
source: a,
|
|
3411
3486
|
label: o,
|
|
3412
3487
|
required: r,
|
|
3413
3488
|
autoComplete: s,
|
|
3414
3489
|
hideLabel: c,
|
|
3415
3490
|
rules: { validate: (e) => !l || e === l || "Passwords do not match" }
|
|
3416
|
-
})] }) : /* @__PURE__ */ q(
|
|
3491
|
+
})] }) : /* @__PURE__ */ q(Fi, {
|
|
3417
3492
|
source: e,
|
|
3418
3493
|
name: t,
|
|
3419
3494
|
label: n,
|
|
@@ -3425,48 +3500,48 @@ function Ni({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3425
3500
|
}
|
|
3426
3501
|
//#endregion
|
|
3427
3502
|
//#region src/crud/utils/choiceSelectionUtils.ts
|
|
3428
|
-
function
|
|
3503
|
+
function Li(e, t) {
|
|
3429
3504
|
return typeof e == "object" && !!e && !Array.isArray(e) && t in e;
|
|
3430
3505
|
}
|
|
3431
|
-
function
|
|
3506
|
+
function Ri(e, t) {
|
|
3432
3507
|
if (!(e == null || e === "")) {
|
|
3433
|
-
if (
|
|
3508
|
+
if (Li(e, t)) {
|
|
3434
3509
|
let n = e[t];
|
|
3435
3510
|
return typeof n == "string" || typeof n == "number" ? n : void 0;
|
|
3436
3511
|
}
|
|
3437
3512
|
if (typeof e == "string" || typeof e == "number") return e;
|
|
3438
3513
|
}
|
|
3439
3514
|
}
|
|
3440
|
-
function
|
|
3441
|
-
return Array.isArray(e) ? e.map((e) =>
|
|
3515
|
+
function zi(e, t) {
|
|
3516
|
+
return Array.isArray(e) ? e.map((e) => Ri(e, t)).filter((e) => e != null) : [];
|
|
3442
3517
|
}
|
|
3443
|
-
function
|
|
3444
|
-
return e == null ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "").map((e) =>
|
|
3518
|
+
function Bi(e, t) {
|
|
3519
|
+
return e == null ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "").map((e) => Li(e, t) ? e[t] : e);
|
|
3445
3520
|
}
|
|
3446
|
-
function
|
|
3521
|
+
function Vi(e, t, n) {
|
|
3447
3522
|
let r = [];
|
|
3448
|
-
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) =>
|
|
3523
|
+
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) => Li(e, n))) : Li(t, n) && r.push(t)), e == null) return r;
|
|
3449
3524
|
let i = Array.isArray(e) ? e : [e];
|
|
3450
|
-
for (let e of i)
|
|
3525
|
+
for (let e of i) Li(e, n) && r.push(e);
|
|
3451
3526
|
return r;
|
|
3452
3527
|
}
|
|
3453
|
-
function
|
|
3528
|
+
function Hi(e, t) {
|
|
3454
3529
|
return typeof t == "function" ? t(e) : String(e[t] ?? "");
|
|
3455
3530
|
}
|
|
3456
|
-
function
|
|
3531
|
+
function Ui(e, t, n) {
|
|
3457
3532
|
return e.map((e) => ({
|
|
3458
|
-
label:
|
|
3533
|
+
label: Hi(e, t),
|
|
3459
3534
|
value: e[n],
|
|
3460
3535
|
record: e
|
|
3461
3536
|
}));
|
|
3462
3537
|
}
|
|
3463
|
-
function
|
|
3538
|
+
function Wi(e, t) {
|
|
3464
3539
|
let n = /* @__PURE__ */ new Map();
|
|
3465
3540
|
for (let t of e) n.set(t.value, t);
|
|
3466
3541
|
for (let e of t) n.set(e.value, e);
|
|
3467
3542
|
return Array.from(n.values());
|
|
3468
3543
|
}
|
|
3469
|
-
function
|
|
3544
|
+
function Gi(e = {}) {
|
|
3470
3545
|
let t = e.popupMatchSelectWidth ?? !1;
|
|
3471
3546
|
return t === !1 ? {
|
|
3472
3547
|
popupMatchSelectWidth: !1,
|
|
@@ -3475,16 +3550,16 @@ function Hi(e = {}) {
|
|
|
3475
3550
|
}
|
|
3476
3551
|
//#endregion
|
|
3477
3552
|
//#region src/crud/utils/referenceSelectNotFoundContent.tsx
|
|
3478
|
-
function
|
|
3479
|
-
return e ? /* @__PURE__ */ q(
|
|
3553
|
+
function Ki(e) {
|
|
3554
|
+
return e ? /* @__PURE__ */ q(oe, { size: "small" }) : void 0;
|
|
3480
3555
|
}
|
|
3481
3556
|
//#endregion
|
|
3482
3557
|
//#region src/crud/utils/useChoices.ts
|
|
3483
|
-
var
|
|
3484
|
-
function
|
|
3558
|
+
var qi = /* @__PURE__ */ new Map(), Ji = /* @__PURE__ */ new Map();
|
|
3559
|
+
function Yi(e, t) {
|
|
3485
3560
|
return typeof e == "function" ? `fn:${t ?? ""}` : Array.isArray(e) ? `static:${e.length}` : `res:${e.resource}:${JSON.stringify(e.filter ?? {})}:${t ?? ""}`;
|
|
3486
3561
|
}
|
|
3487
|
-
async function
|
|
3562
|
+
async function Xi(e, t, n, r, i) {
|
|
3488
3563
|
return typeof e == "function" ? e({
|
|
3489
3564
|
dataProvider: t,
|
|
3490
3565
|
search: i
|
|
@@ -3498,26 +3573,26 @@ async function qi(e, t, n, r, i) {
|
|
|
3498
3573
|
perPage: 500
|
|
3499
3574
|
}
|
|
3500
3575
|
})).data.map((e) => ({
|
|
3501
|
-
label:
|
|
3576
|
+
label: Hi(e, n),
|
|
3502
3577
|
value: e[r],
|
|
3503
3578
|
record: e
|
|
3504
3579
|
}));
|
|
3505
3580
|
}
|
|
3506
|
-
function
|
|
3507
|
-
let o =
|
|
3581
|
+
function Zi(e, t, n, r, i, a) {
|
|
3582
|
+
let o = Yi(e, i);
|
|
3508
3583
|
if (a) {
|
|
3509
|
-
let e =
|
|
3584
|
+
let e = qi.get(o);
|
|
3510
3585
|
if (e && !i) return Promise.resolve(e);
|
|
3511
3586
|
}
|
|
3512
|
-
let s =
|
|
3587
|
+
let s = Ji.get(o);
|
|
3513
3588
|
if (s) return s;
|
|
3514
|
-
let c =
|
|
3515
|
-
|
|
3589
|
+
let c = Xi(e, t, n, r, i).then((e) => (a && !i && qi.set(o, e), e)).finally(() => {
|
|
3590
|
+
Ji.delete(o);
|
|
3516
3591
|
});
|
|
3517
|
-
return
|
|
3592
|
+
return Ji.set(o, c), c;
|
|
3518
3593
|
}
|
|
3519
|
-
function
|
|
3520
|
-
let { lazy: c = !1, active: u = !1, selectedValues: f, selectedRecords: p, fetchSelected: m = !0, cache: h } = o, g = h ?? !c, _ =
|
|
3594
|
+
function Qi(e, t, n = "name", r = "id", i, o = {}) {
|
|
3595
|
+
let { lazy: c = !1, active: u = !1, selectedValues: f, selectedRecords: p, fetchSelected: m = !0, cache: h } = o, g = h ?? !c, _ = Yt(), v = l(() => {
|
|
3521
3596
|
if (e) return e;
|
|
3522
3597
|
if (t) return {
|
|
3523
3598
|
resource: t,
|
|
@@ -3527,14 +3602,14 @@ function Yi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3527
3602
|
e,
|
|
3528
3603
|
t,
|
|
3529
3604
|
i
|
|
3530
|
-
]), y = v ?
|
|
3605
|
+
]), y = v ? Yi(v, i) : void 0, b = l(() => Bi(f, r), [f, r]), x = l(() => Ui(Vi(f, p, r), n, r), [
|
|
3531
3606
|
f,
|
|
3532
3607
|
p,
|
|
3533
3608
|
n,
|
|
3534
3609
|
r
|
|
3535
|
-
]), S = !!(v && (!c || u || Array.isArray(v))), [C, w] = d(() => x.length ? x : !y || i || c || !g ? [] :
|
|
3610
|
+
]), S = !!(v && (!c || u || Array.isArray(v))), [C, w] = d(() => x.length ? x : !y || i || c || !g ? [] : qi.get(y) ?? []), [T, E] = d(() => S ? !g || !y || i ? !!v : !qi.has(y) : !1);
|
|
3536
3611
|
s(() => {
|
|
3537
|
-
x.length && w((e) =>
|
|
3612
|
+
x.length && w((e) => Wi(e, x));
|
|
3538
3613
|
}, [x]);
|
|
3539
3614
|
let D = a(async () => {
|
|
3540
3615
|
if (!v || !S) {
|
|
@@ -3542,15 +3617,15 @@ function Yi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3542
3617
|
return;
|
|
3543
3618
|
}
|
|
3544
3619
|
if (g) {
|
|
3545
|
-
let e =
|
|
3620
|
+
let e = Yi(v, i), t = qi.get(e);
|
|
3546
3621
|
if (t && !i) {
|
|
3547
|
-
w(
|
|
3622
|
+
w(Wi(x, t)), E(!1);
|
|
3548
3623
|
return;
|
|
3549
3624
|
}
|
|
3550
3625
|
}
|
|
3551
3626
|
E(!0), c && w(x);
|
|
3552
3627
|
try {
|
|
3553
|
-
w(
|
|
3628
|
+
w(Wi(x, await Zi(v, _, n, r, i, g)));
|
|
3554
3629
|
} catch {
|
|
3555
3630
|
!b.length && !x.length ? w([]) : c && w(x);
|
|
3556
3631
|
} finally {
|
|
@@ -3587,7 +3662,7 @@ function Yi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3587
3662
|
for (let i of e) try {
|
|
3588
3663
|
let e = (await _.getOne(t, i)).data;
|
|
3589
3664
|
a.push({
|
|
3590
|
-
label:
|
|
3665
|
+
label: Hi(e, n),
|
|
3591
3666
|
value: e[r],
|
|
3592
3667
|
record: e
|
|
3593
3668
|
});
|
|
@@ -3599,7 +3674,7 @@ function Yi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3599
3674
|
}
|
|
3600
3675
|
i || !a.length || w((e) => {
|
|
3601
3676
|
let t = a.filter((t) => !e.some((e) => e.value === t.value));
|
|
3602
|
-
return t.length ?
|
|
3677
|
+
return t.length ? Wi(e, t) : e;
|
|
3603
3678
|
});
|
|
3604
3679
|
})(), () => {
|
|
3605
3680
|
i = !0;
|
|
@@ -3625,15 +3700,15 @@ function Yi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3625
3700
|
}
|
|
3626
3701
|
//#endregion
|
|
3627
3702
|
//#region src/crud/fields/ReferenceInputActions.tsx
|
|
3628
|
-
function
|
|
3703
|
+
function $i({ reference: e, referenceForm: t, referencePermissions: n, referenceTitle: r, referenceDefaultValues: i, referenceModalWidth: a, selectedId: o, disabled: s, onCreated: c, onUpdated: l }) {
|
|
3629
3704
|
let u = X(), f = r ?? e, p = !!(e && t) && Z(u, n, "add"), m = !!(e && t && o != null && o !== "") && Z(u, n, "change"), [h, g] = d(null);
|
|
3630
|
-
return !p && !m ? null : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J(
|
|
3705
|
+
return !p && !m ? null : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J(B, {
|
|
3631
3706
|
size: 4,
|
|
3632
3707
|
children: [p ? /* @__PURE__ */ q(U, {
|
|
3633
3708
|
title: `Add ${f ?? "record"}`,
|
|
3634
3709
|
children: /* @__PURE__ */ q(w, {
|
|
3635
3710
|
type: "default",
|
|
3636
|
-
icon: /* @__PURE__ */ q(
|
|
3711
|
+
icon: /* @__PURE__ */ q(Ce, {}),
|
|
3637
3712
|
disabled: s,
|
|
3638
3713
|
"aria-label": `Add ${f ?? "record"}`,
|
|
3639
3714
|
onClick: () => g("new")
|
|
@@ -3642,13 +3717,13 @@ function Xi({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3642
3717
|
title: `Edit ${f ?? "record"}`,
|
|
3643
3718
|
children: /* @__PURE__ */ q(w, {
|
|
3644
3719
|
type: "default",
|
|
3645
|
-
icon: /* @__PURE__ */ q(
|
|
3720
|
+
icon: /* @__PURE__ */ q(_e, {}),
|
|
3646
3721
|
disabled: s,
|
|
3647
3722
|
"aria-label": `Edit ${f ?? "record"}`,
|
|
3648
3723
|
onClick: () => g(String(o))
|
|
3649
3724
|
})
|
|
3650
3725
|
}) : null]
|
|
3651
|
-
}), e && t && h != null ? /* @__PURE__ */ q(
|
|
3726
|
+
}), e && t && h != null ? /* @__PURE__ */ q(Ur, {
|
|
3652
3727
|
resource: e,
|
|
3653
3728
|
editId: h,
|
|
3654
3729
|
onClose: () => g(null),
|
|
@@ -3665,35 +3740,35 @@ function Xi({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3665
3740
|
}
|
|
3666
3741
|
//#endregion
|
|
3667
3742
|
//#region src/crud/fields/ReferenceField.tsx
|
|
3668
|
-
function
|
|
3669
|
-
let [T, E] = d(), [D, O] = d(!1), k = D || !!T,
|
|
3743
|
+
function ea({ 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 }) {
|
|
3744
|
+
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A = Ri(p, r), { options: j, loading: M, optionForValue: ee, reload: N } = Qi(t, e, n, r, i ? T : void 0, {
|
|
3670
3745
|
lazy: u,
|
|
3671
3746
|
active: k,
|
|
3672
3747
|
selectedValues: p,
|
|
3673
3748
|
selectedRecords: g,
|
|
3674
3749
|
fetchSelected: f
|
|
3675
|
-
}),
|
|
3750
|
+
}), P = l(() => j.map((e) => ({
|
|
3676
3751
|
label: e.label,
|
|
3677
3752
|
value: e.value
|
|
3678
|
-
})), [
|
|
3753
|
+
})), [j]), F = (e) => {
|
|
3679
3754
|
let t = e[r];
|
|
3680
3755
|
m(t), c?.(t, {
|
|
3681
|
-
label:
|
|
3756
|
+
label: Hi(e, n),
|
|
3682
3757
|
value: t,
|
|
3683
3758
|
record: e
|
|
3684
|
-
}, { name: h }),
|
|
3685
|
-
},
|
|
3686
|
-
...
|
|
3759
|
+
}, { name: h }), N();
|
|
3760
|
+
}, I = /* @__PURE__ */ q(z, {
|
|
3761
|
+
...Gi({
|
|
3687
3762
|
popupMatchSelectWidth: C,
|
|
3688
3763
|
popupMinWidth: w
|
|
3689
3764
|
}),
|
|
3690
|
-
value:
|
|
3765
|
+
value: A,
|
|
3691
3766
|
onChange: (e) => {
|
|
3692
|
-
m(e), c?.(e,
|
|
3767
|
+
m(e), c?.(e, ee(e), { name: h });
|
|
3693
3768
|
},
|
|
3694
|
-
options:
|
|
3695
|
-
loading:
|
|
3696
|
-
notFoundContent:
|
|
3769
|
+
options: P,
|
|
3770
|
+
loading: M,
|
|
3771
|
+
notFoundContent: Ki(M),
|
|
3697
3772
|
showSearch: i,
|
|
3698
3773
|
filterOption: i ? !1 : void 0,
|
|
3699
3774
|
onSearch: i ? E : void 0,
|
|
@@ -3721,23 +3796,23 @@ function Zi({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3721
3796
|
flex: 1,
|
|
3722
3797
|
minWidth: 0
|
|
3723
3798
|
},
|
|
3724
|
-
children:
|
|
3725
|
-
}), /* @__PURE__ */ q(
|
|
3799
|
+
children: I
|
|
3800
|
+
}), /* @__PURE__ */ q($i, {
|
|
3726
3801
|
reference: e,
|
|
3727
3802
|
referenceForm: _,
|
|
3728
3803
|
referencePermissions: v,
|
|
3729
3804
|
referenceTitle: y,
|
|
3730
3805
|
referenceDefaultValues: b,
|
|
3731
3806
|
referenceModalWidth: x,
|
|
3732
|
-
selectedId:
|
|
3807
|
+
selectedId: A,
|
|
3733
3808
|
disabled: o,
|
|
3734
|
-
onCreated:
|
|
3735
|
-
onUpdated: () => void
|
|
3809
|
+
onCreated: F,
|
|
3810
|
+
onUpdated: () => void N()
|
|
3736
3811
|
})]
|
|
3737
|
-
}) :
|
|
3812
|
+
}) : I;
|
|
3738
3813
|
}
|
|
3739
|
-
function
|
|
3740
|
-
let E =
|
|
3814
|
+
function ta({ 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 }) {
|
|
3815
|
+
let E = Pe({
|
|
3741
3816
|
name: g ?? "",
|
|
3742
3817
|
disabled: !g
|
|
3743
3818
|
});
|
|
@@ -3748,7 +3823,7 @@ function Qi({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3748
3823
|
required: s,
|
|
3749
3824
|
rules: c,
|
|
3750
3825
|
hideLabel: f,
|
|
3751
|
-
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ q(
|
|
3826
|
+
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ q(ea, {
|
|
3752
3827
|
reference: r,
|
|
3753
3828
|
choices: i,
|
|
3754
3829
|
optionLabel: a,
|
|
@@ -3777,27 +3852,27 @@ function Qi({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3777
3852
|
}
|
|
3778
3853
|
//#endregion
|
|
3779
3854
|
//#region src/crud/fields/ReferenceManyField.tsx
|
|
3780
|
-
function
|
|
3781
|
-
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D =
|
|
3855
|
+
function na({ 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 }) {
|
|
3856
|
+
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D = zi(c, r), { options: O, loading: k, reload: A } = Qi(t, e, n, r, i ? S : void 0, {
|
|
3782
3857
|
lazy: o,
|
|
3783
3858
|
active: E,
|
|
3784
3859
|
selectedValues: c,
|
|
3785
3860
|
selectedRecords: p,
|
|
3786
3861
|
fetchSelected: s
|
|
3787
|
-
}),
|
|
3862
|
+
}), j = l(() => O.map((e) => ({
|
|
3788
3863
|
label: e.label,
|
|
3789
3864
|
value: e.value
|
|
3790
|
-
})), [O]),
|
|
3791
|
-
...
|
|
3865
|
+
})), [O]), M = /* @__PURE__ */ q(z, {
|
|
3866
|
+
...Gi({
|
|
3792
3867
|
popupMatchSelectWidth: b,
|
|
3793
3868
|
popupMinWidth: x
|
|
3794
3869
|
}),
|
|
3795
3870
|
mode: "multiple",
|
|
3796
3871
|
value: D,
|
|
3797
3872
|
onChange: u,
|
|
3798
|
-
options:
|
|
3873
|
+
options: j,
|
|
3799
3874
|
loading: k,
|
|
3800
|
-
notFoundContent:
|
|
3875
|
+
notFoundContent: Ki(k),
|
|
3801
3876
|
showSearch: i,
|
|
3802
3877
|
filterOption: i ? !1 : void 0,
|
|
3803
3878
|
onSearch: i ? C : void 0,
|
|
@@ -3821,8 +3896,8 @@ function $i({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3821
3896
|
flex: 1,
|
|
3822
3897
|
minWidth: 0
|
|
3823
3898
|
},
|
|
3824
|
-
children:
|
|
3825
|
-
}), /* @__PURE__ */ q(
|
|
3899
|
+
children: M
|
|
3900
|
+
}), /* @__PURE__ */ q($i, {
|
|
3826
3901
|
reference: e,
|
|
3827
3902
|
referenceForm: m,
|
|
3828
3903
|
referencePermissions: h,
|
|
@@ -3833,16 +3908,16 @@ function $i({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3833
3908
|
onCreated: (e) => {
|
|
3834
3909
|
let t = e[r], n = Array.isArray(D) ? D : [];
|
|
3835
3910
|
if (n.some((e) => e === t)) {
|
|
3836
|
-
|
|
3911
|
+
A();
|
|
3837
3912
|
return;
|
|
3838
3913
|
}
|
|
3839
|
-
u([...n, t]),
|
|
3914
|
+
u([...n, t]), A();
|
|
3840
3915
|
}
|
|
3841
3916
|
})]
|
|
3842
|
-
}) :
|
|
3917
|
+
}) : M;
|
|
3843
3918
|
}
|
|
3844
|
-
function
|
|
3845
|
-
let w =
|
|
3919
|
+
function ra({ 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 }) {
|
|
3920
|
+
let w = Pe({
|
|
3846
3921
|
name: m ?? "",
|
|
3847
3922
|
disabled: !m
|
|
3848
3923
|
});
|
|
@@ -3853,7 +3928,7 @@ function ea({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3853
3928
|
required: s,
|
|
3854
3929
|
rules: c,
|
|
3855
3930
|
hideLabel: d,
|
|
3856
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(
|
|
3931
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(na, {
|
|
3857
3932
|
reference: r,
|
|
3858
3933
|
choices: i,
|
|
3859
3934
|
optionLabel: a,
|
|
@@ -3879,10 +3954,10 @@ function ea({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3879
3954
|
}
|
|
3880
3955
|
//#endregion
|
|
3881
3956
|
//#region src/crud/fields/uploadFieldUtils.ts
|
|
3882
|
-
function
|
|
3957
|
+
function ia(e) {
|
|
3883
3958
|
return e instanceof File ? !0 : typeof e == "string" && e.length > 0;
|
|
3884
3959
|
}
|
|
3885
|
-
function
|
|
3960
|
+
function aa(e) {
|
|
3886
3961
|
if (e instanceof File) return e.name;
|
|
3887
3962
|
if (typeof e == "string" && e.length > 0) try {
|
|
3888
3963
|
return new URL(e, "http://local").pathname.split("/").filter(Boolean).pop() || e;
|
|
@@ -3892,7 +3967,7 @@ function na(e) {
|
|
|
3892
3967
|
}
|
|
3893
3968
|
//#endregion
|
|
3894
3969
|
//#region src/crud/fields/useUploadPreviewUrl.ts
|
|
3895
|
-
function
|
|
3970
|
+
function oa(e) {
|
|
3896
3971
|
let [t, n] = d();
|
|
3897
3972
|
if (s(() => {
|
|
3898
3973
|
if (e instanceof File) {
|
|
@@ -3905,14 +3980,14 @@ function ra(e) {
|
|
|
3905
3980
|
}
|
|
3906
3981
|
//#endregion
|
|
3907
3982
|
//#region src/crud/fields/ImageField.tsx
|
|
3908
|
-
function
|
|
3909
|
-
let o = u(null), s =
|
|
3910
|
-
return /* @__PURE__ */ J(
|
|
3983
|
+
function sa({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "image/*", previewWidth: a = 200 }) {
|
|
3984
|
+
let o = u(null), s = oa(e), c = r && ia(e);
|
|
3985
|
+
return /* @__PURE__ */ J(B, {
|
|
3911
3986
|
direction: "vertical",
|
|
3912
3987
|
size: "middle",
|
|
3913
3988
|
style: { width: "100%" },
|
|
3914
3989
|
children: [
|
|
3915
|
-
s ? /* @__PURE__ */ q(
|
|
3990
|
+
s ? /* @__PURE__ */ q(N, {
|
|
3916
3991
|
src: s,
|
|
3917
3992
|
alt: "",
|
|
3918
3993
|
style: {
|
|
@@ -3921,15 +3996,15 @@ function ia({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
3921
3996
|
objectFit: "contain"
|
|
3922
3997
|
}
|
|
3923
3998
|
}) : null,
|
|
3924
|
-
/* @__PURE__ */ J(
|
|
3999
|
+
/* @__PURE__ */ J(B, {
|
|
3925
4000
|
wrap: !0,
|
|
3926
4001
|
children: [/* @__PURE__ */ q(w, {
|
|
3927
|
-
icon: /* @__PURE__ */ q(
|
|
4002
|
+
icon: /* @__PURE__ */ q(Ee, {}),
|
|
3928
4003
|
disabled: n,
|
|
3929
4004
|
onClick: () => o.current?.click(),
|
|
3930
4005
|
children: "Choose image"
|
|
3931
4006
|
}), c ? /* @__PURE__ */ q(w, {
|
|
3932
|
-
icon: /* @__PURE__ */ q(
|
|
4007
|
+
icon: /* @__PURE__ */ q(he, {}),
|
|
3933
4008
|
disabled: n,
|
|
3934
4009
|
onClick: () => {
|
|
3935
4010
|
t(null), o.current && (o.current.value = "");
|
|
@@ -3953,7 +4028,7 @@ function ia({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
3953
4028
|
]
|
|
3954
4029
|
});
|
|
3955
4030
|
}
|
|
3956
|
-
function
|
|
4031
|
+
function ca({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s, previewWidth: c }) {
|
|
3957
4032
|
return /* @__PURE__ */ q($, {
|
|
3958
4033
|
source: e,
|
|
3959
4034
|
name: t,
|
|
@@ -3961,7 +4036,7 @@ function aa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3961
4036
|
required: r,
|
|
3962
4037
|
rules: i,
|
|
3963
4038
|
hideLabel: a,
|
|
3964
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(
|
|
4039
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(sa, {
|
|
3965
4040
|
value: e,
|
|
3966
4041
|
onChange: t,
|
|
3967
4042
|
disabled: n,
|
|
@@ -3973,28 +4048,28 @@ function aa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3973
4048
|
}
|
|
3974
4049
|
//#endregion
|
|
3975
4050
|
//#region src/crud/fields/FileField.tsx
|
|
3976
|
-
function
|
|
3977
|
-
let a = u(null), o =
|
|
3978
|
-
return /* @__PURE__ */ J(
|
|
4051
|
+
function la({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
4052
|
+
let a = u(null), o = aa(e), s = typeof e == "string" && e.length > 0 ? e : void 0, c = r && ia(e);
|
|
4053
|
+
return /* @__PURE__ */ J(B, {
|
|
3979
4054
|
direction: "vertical",
|
|
3980
4055
|
size: "middle",
|
|
3981
4056
|
style: { width: "100%" },
|
|
3982
4057
|
children: [
|
|
3983
|
-
o ? /* @__PURE__ */ J(
|
|
4058
|
+
o ? /* @__PURE__ */ J(B, { children: [/* @__PURE__ */ q(Se, {}), s ? /* @__PURE__ */ q(W.Link, {
|
|
3984
4059
|
href: s,
|
|
3985
4060
|
target: "_blank",
|
|
3986
4061
|
rel: "noopener noreferrer",
|
|
3987
4062
|
children: o
|
|
3988
4063
|
}) : /* @__PURE__ */ q(W.Text, { children: o })] }) : null,
|
|
3989
|
-
/* @__PURE__ */ J(
|
|
4064
|
+
/* @__PURE__ */ J(B, {
|
|
3990
4065
|
wrap: !0,
|
|
3991
4066
|
children: [/* @__PURE__ */ q(w, {
|
|
3992
|
-
icon: /* @__PURE__ */ q(
|
|
4067
|
+
icon: /* @__PURE__ */ q(Ee, {}),
|
|
3993
4068
|
disabled: n,
|
|
3994
4069
|
onClick: () => a.current?.click(),
|
|
3995
4070
|
children: "Choose file"
|
|
3996
4071
|
}), c ? /* @__PURE__ */ q(w, {
|
|
3997
|
-
icon: /* @__PURE__ */ q(
|
|
4072
|
+
icon: /* @__PURE__ */ q(he, {}),
|
|
3998
4073
|
disabled: n,
|
|
3999
4074
|
onClick: () => {
|
|
4000
4075
|
t(null), a.current && (a.current.value = "");
|
|
@@ -4018,7 +4093,7 @@ function oa({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
4018
4093
|
]
|
|
4019
4094
|
});
|
|
4020
4095
|
}
|
|
4021
|
-
function
|
|
4096
|
+
function ua({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s }) {
|
|
4022
4097
|
return /* @__PURE__ */ q($, {
|
|
4023
4098
|
source: e,
|
|
4024
4099
|
name: t,
|
|
@@ -4026,7 +4101,7 @@ function sa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4026
4101
|
required: r,
|
|
4027
4102
|
rules: i,
|
|
4028
4103
|
hideLabel: a,
|
|
4029
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(
|
|
4104
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(la, {
|
|
4030
4105
|
value: e,
|
|
4031
4106
|
onChange: t,
|
|
4032
4107
|
disabled: n,
|
|
@@ -4037,8 +4112,8 @@ function sa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4037
4112
|
}
|
|
4038
4113
|
//#endregion
|
|
4039
4114
|
//#region src/crud/columns/TextColumn.tsx
|
|
4040
|
-
function
|
|
4041
|
-
return
|
|
4115
|
+
function da({ source: e, label: t, sortable: n = !0 }) {
|
|
4116
|
+
return Jn(l(() => ({
|
|
4042
4117
|
key: e,
|
|
4043
4118
|
source: e,
|
|
4044
4119
|
label: t,
|
|
@@ -4055,13 +4130,13 @@ function ca({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4055
4130
|
n
|
|
4056
4131
|
])), null;
|
|
4057
4132
|
}
|
|
4058
|
-
function
|
|
4059
|
-
return typeof n == "function" ? n(e) : n ?
|
|
4133
|
+
function fa(e, t, n) {
|
|
4134
|
+
return typeof n == "function" ? n(e) : n ? br(e, n) : e[t];
|
|
4060
4135
|
}
|
|
4061
4136
|
//#endregion
|
|
4062
4137
|
//#region src/crud/columns/NumberColumn.tsx
|
|
4063
|
-
function
|
|
4064
|
-
return
|
|
4138
|
+
function pa({ source: e, label: t, sortable: n = !0 }) {
|
|
4139
|
+
return Jn(l(() => ({
|
|
4065
4140
|
key: e,
|
|
4066
4141
|
source: e,
|
|
4067
4142
|
label: t,
|
|
@@ -4080,8 +4155,8 @@ function ua({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4080
4155
|
}
|
|
4081
4156
|
//#endregion
|
|
4082
4157
|
//#region src/crud/columns/BooleanColumn.tsx
|
|
4083
|
-
function
|
|
4084
|
-
return
|
|
4158
|
+
function ma({ source: e, label: t, sortable: n = !0 }) {
|
|
4159
|
+
return Jn(l(() => ({
|
|
4085
4160
|
key: e,
|
|
4086
4161
|
source: e,
|
|
4087
4162
|
label: t,
|
|
@@ -4101,8 +4176,8 @@ function da({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4101
4176
|
}
|
|
4102
4177
|
//#endregion
|
|
4103
4178
|
//#region src/crud/columns/DateColumn.tsx
|
|
4104
|
-
function
|
|
4105
|
-
return
|
|
4179
|
+
function ha({ source: e, label: t, sortable: n = !0 }) {
|
|
4180
|
+
return Jn(l(() => ({
|
|
4106
4181
|
key: e,
|
|
4107
4182
|
source: e,
|
|
4108
4183
|
label: t,
|
|
@@ -4122,17 +4197,17 @@ function fa({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4122
4197
|
}
|
|
4123
4198
|
//#endregion
|
|
4124
4199
|
//#region src/crud/columns/ReferenceColumn.tsx
|
|
4125
|
-
function
|
|
4126
|
-
let { labelForValue: s } =
|
|
4200
|
+
function ga({ record: e, source: t, display: n, reference: r, choices: i, optionLabel: a, optionValue: o }) {
|
|
4201
|
+
let { labelForValue: s } = Qi(i, r, a, o), c = e[t];
|
|
4127
4202
|
if (typeof n == "function") return /* @__PURE__ */ q(K, { children: n(e) });
|
|
4128
4203
|
if (n && n !== t) {
|
|
4129
|
-
let r =
|
|
4204
|
+
let r = fa(e, t, n);
|
|
4130
4205
|
return /* @__PURE__ */ q(K, { children: r == null ? "—" : String(r) });
|
|
4131
4206
|
}
|
|
4132
4207
|
return /* @__PURE__ */ q(K, { children: s(c) });
|
|
4133
4208
|
}
|
|
4134
|
-
function
|
|
4135
|
-
return
|
|
4209
|
+
function _a({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: s = !0 }) {
|
|
4210
|
+
return Jn(l(() => ({
|
|
4136
4211
|
key: e,
|
|
4137
4212
|
source: e,
|
|
4138
4213
|
label: t,
|
|
@@ -4142,7 +4217,7 @@ function ma({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4142
4217
|
dataIndex: e,
|
|
4143
4218
|
key: e,
|
|
4144
4219
|
sorter: s ? !0 : void 0,
|
|
4145
|
-
render: (s, c) => /* @__PURE__ */ q(
|
|
4220
|
+
render: (s, c) => /* @__PURE__ */ q(ga, {
|
|
4146
4221
|
record: c,
|
|
4147
4222
|
source: e,
|
|
4148
4223
|
label: t,
|
|
@@ -4166,12 +4241,12 @@ function ma({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4166
4241
|
}
|
|
4167
4242
|
//#endregion
|
|
4168
4243
|
//#region src/crud/columns/ReferenceManyColumn.tsx
|
|
4169
|
-
function
|
|
4170
|
-
let { labelsForValues: o } =
|
|
4244
|
+
function va({ record: e, source: t, reference: n, choices: r, optionLabel: i, optionValue: a }) {
|
|
4245
|
+
let { labelsForValues: o } = Qi(r, n, i, a), s = e[t];
|
|
4171
4246
|
return /* @__PURE__ */ q(K, { children: o(Array.isArray(s) ? s : []) });
|
|
4172
4247
|
}
|
|
4173
|
-
function
|
|
4174
|
-
return
|
|
4248
|
+
function ya({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
|
|
4249
|
+
return Jn(l(() => ({
|
|
4175
4250
|
key: e,
|
|
4176
4251
|
source: e,
|
|
4177
4252
|
label: t,
|
|
@@ -4181,7 +4256,7 @@ function ga({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4181
4256
|
dataIndex: e,
|
|
4182
4257
|
key: e,
|
|
4183
4258
|
sorter: o ? !0 : void 0,
|
|
4184
|
-
render: (t, o) => /* @__PURE__ */ q(
|
|
4259
|
+
render: (t, o) => /* @__PURE__ */ q(va, {
|
|
4185
4260
|
record: o,
|
|
4186
4261
|
source: e,
|
|
4187
4262
|
reference: n,
|
|
@@ -4202,8 +4277,8 @@ function ga({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4202
4277
|
}
|
|
4203
4278
|
//#endregion
|
|
4204
4279
|
//#region src/crud/columns/ImageColumn.tsx
|
|
4205
|
-
function
|
|
4206
|
-
return
|
|
4280
|
+
function ba({ source: e, label: t, sortable: n = !1, width: r = 40, height: i = 40, objectFit: a = "cover", borderRadius: o = 4, alt: s = "" }) {
|
|
4281
|
+
return Jn(l(() => ({
|
|
4207
4282
|
key: e,
|
|
4208
4283
|
source: e,
|
|
4209
4284
|
label: t,
|
|
@@ -4237,8 +4312,8 @@ function _a({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4237
4312
|
}
|
|
4238
4313
|
//#endregion
|
|
4239
4314
|
//#region src/crud/columns/CustomColumn.tsx
|
|
4240
|
-
function
|
|
4241
|
-
return
|
|
4315
|
+
function xa({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
4316
|
+
return Jn(l(() => ({
|
|
4242
4317
|
key: e,
|
|
4243
4318
|
source: e,
|
|
4244
4319
|
label: t,
|
|
@@ -4257,12 +4332,12 @@ function va({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
|
4257
4332
|
}
|
|
4258
4333
|
//#endregion
|
|
4259
4334
|
//#region src/crud/filters/NumberFilter.tsx
|
|
4260
|
-
function
|
|
4261
|
-
return
|
|
4335
|
+
function Sa({ source: e, label: t }) {
|
|
4336
|
+
return rr(l(() => ({
|
|
4262
4337
|
key: e,
|
|
4263
4338
|
source: e,
|
|
4264
4339
|
label: t,
|
|
4265
|
-
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(
|
|
4340
|
+
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(F, {
|
|
4266
4341
|
placeholder: t ?? e,
|
|
4267
4342
|
value: n,
|
|
4268
4343
|
onChange: (e) => r(e ?? void 0),
|
|
@@ -4272,12 +4347,12 @@ function ya({ source: e, label: t }) {
|
|
|
4272
4347
|
}
|
|
4273
4348
|
//#endregion
|
|
4274
4349
|
//#region src/crud/filters/BooleanFilter.tsx
|
|
4275
|
-
function
|
|
4276
|
-
return
|
|
4350
|
+
function Ca({ source: e, label: t }) {
|
|
4351
|
+
return rr(l(() => ({
|
|
4277
4352
|
key: e,
|
|
4278
4353
|
source: e,
|
|
4279
4354
|
label: t,
|
|
4280
|
-
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(
|
|
4355
|
+
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(z, {
|
|
4281
4356
|
allowClear: !0,
|
|
4282
4357
|
placeholder: t ?? e,
|
|
4283
4358
|
value: n,
|
|
@@ -4295,15 +4370,15 @@ function ba({ source: e, label: t }) {
|
|
|
4295
4370
|
}
|
|
4296
4371
|
//#endregion
|
|
4297
4372
|
//#region src/crud/filters/DateFilter.tsx
|
|
4298
|
-
function
|
|
4299
|
-
return
|
|
4373
|
+
function wa({ source: e, label: t }) {
|
|
4374
|
+
return rr(l(() => ({
|
|
4300
4375
|
key: e,
|
|
4301
4376
|
source: e,
|
|
4302
4377
|
label: t,
|
|
4303
4378
|
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(O, {
|
|
4304
4379
|
allowClear: !0,
|
|
4305
4380
|
placeholder: t ?? e,
|
|
4306
|
-
value: n ?
|
|
4381
|
+
value: n ? Fe(String(n)) : null,
|
|
4307
4382
|
onChange: (e) => r(e ? e.format("YYYY-MM-DD") : void 0),
|
|
4308
4383
|
style: { minWidth: 160 }
|
|
4309
4384
|
})
|
|
@@ -4311,12 +4386,12 @@ function xa({ source: e, label: t }) {
|
|
|
4311
4386
|
}
|
|
4312
4387
|
//#endregion
|
|
4313
4388
|
//#region src/crud/filters/SelectFilter.tsx
|
|
4314
|
-
function
|
|
4315
|
-
return
|
|
4389
|
+
function Ta({ source: e, label: t, choices: n, multiple: r }) {
|
|
4390
|
+
return rr(l(() => ({
|
|
4316
4391
|
key: e,
|
|
4317
4392
|
source: e,
|
|
4318
4393
|
label: t,
|
|
4319
|
-
render: ({ value: i, onChange: a }) => /* @__PURE__ */ q(
|
|
4394
|
+
render: ({ value: i, onChange: a }) => /* @__PURE__ */ q(z, {
|
|
4320
4395
|
allowClear: !0,
|
|
4321
4396
|
mode: r ? "multiple" : void 0,
|
|
4322
4397
|
placeholder: t ?? e,
|
|
@@ -4334,15 +4409,15 @@ function Sa({ source: e, label: t, choices: n, multiple: r }) {
|
|
|
4334
4409
|
}
|
|
4335
4410
|
//#endregion
|
|
4336
4411
|
//#region src/crud/filters/ReferenceFilter.tsx
|
|
4337
|
-
function
|
|
4338
|
-
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b } =
|
|
4412
|
+
function Ea({ 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 }) {
|
|
4413
|
+
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b } = Qi(r, n, i, a, s ? h : void 0, {
|
|
4339
4414
|
lazy: c,
|
|
4340
4415
|
active: _ || !!h,
|
|
4341
4416
|
selectedValues: p,
|
|
4342
4417
|
fetchSelected: l
|
|
4343
4418
|
});
|
|
4344
|
-
return /* @__PURE__ */ q(
|
|
4345
|
-
...
|
|
4419
|
+
return /* @__PURE__ */ q(z, {
|
|
4420
|
+
...Gi({
|
|
4346
4421
|
popupMatchSelectWidth: u,
|
|
4347
4422
|
popupMinWidth: f
|
|
4348
4423
|
}),
|
|
@@ -4356,7 +4431,7 @@ function Ca({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4356
4431
|
value: e.value
|
|
4357
4432
|
})),
|
|
4358
4433
|
loading: b,
|
|
4359
|
-
notFoundContent:
|
|
4434
|
+
notFoundContent: Ki(b),
|
|
4360
4435
|
showSearch: s,
|
|
4361
4436
|
filterOption: s ? !1 : void 0,
|
|
4362
4437
|
onSearch: s ? g : void 0,
|
|
@@ -4367,12 +4442,12 @@ function Ca({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4367
4442
|
style: { minWidth: 180 }
|
|
4368
4443
|
});
|
|
4369
4444
|
}
|
|
4370
|
-
function
|
|
4371
|
-
return
|
|
4445
|
+
function Da({ 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 }) {
|
|
4446
|
+
return rr(l(() => ({
|
|
4372
4447
|
key: e,
|
|
4373
4448
|
source: e,
|
|
4374
4449
|
label: t,
|
|
4375
|
-
render: ({ value: l, onChange: p }) => /* @__PURE__ */ q(
|
|
4450
|
+
render: ({ value: l, onChange: p }) => /* @__PURE__ */ q(Ea, {
|
|
4376
4451
|
source: e,
|
|
4377
4452
|
label: t,
|
|
4378
4453
|
reference: n,
|
|
@@ -4403,11 +4478,11 @@ function wa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4403
4478
|
f
|
|
4404
4479
|
])), null;
|
|
4405
4480
|
}
|
|
4406
|
-
function
|
|
4407
|
-
return /* @__PURE__ */ q(
|
|
4481
|
+
function Oa(e) {
|
|
4482
|
+
return /* @__PURE__ */ q(Da, {
|
|
4408
4483
|
...e,
|
|
4409
4484
|
multiple: !0
|
|
4410
4485
|
});
|
|
4411
4486
|
}
|
|
4412
4487
|
//#endregion
|
|
4413
|
-
export {
|
|
4488
|
+
export { Kt as AdminApp, Pt as AdminLayout, Bn as AppHub, Vn as AppLauncherButton, Ze as AppThemeProvider, In as AuthAlternateLink, Ln as AuthPageLayout, lt as AuthProvider, ma as BooleanColumn, Ci as BooleanField, Ca as BooleanFilter, xa as CustomColumn, Xn as DEFAULT_TEXT_FILTER_DEBOUNCE_MS, Jt as DataProvider, ha as DateColumn, ki as DateField, wa as DateFilter, Ai as DateTimeField, et as DensitySwitch, en as EXPECTED_VALIDATION_BODY_HINT, $ as FieldWrapper, ua as FileField, ii as FilterBar, _i as FormStep, yi as FormSteps, mi as FormTab, gi as FormTabs, Ft as Guard, Lt as GuestOnly, ba as ImageColumn, ca as ImageField, li as InlineFormSet, ui as InlineFormSetStacked, Rn as LoginPage, pa as NumberColumn, Si as NumberField, Sa as NumberFilter, Ii as PasswordField, mt as PermissionsProvider, zn as PlaceholderPage, It as Protected, _a as ReferenceColumn, ta as ReferenceField, Da as ReferenceFilter, ya as ReferenceManyColumn, ra as ReferenceManyField, Oa as ReferenceManyFilter, Rt as RequirePermission, ai as ResourceForm, Ur as ResourceFormModal, ni as ResourceList, Pi as SelectField, Ta as SelectFilter, xi as TextAreaField, da as TextColumn, bi as TextField, $n as TextFilter, nt as ThemeSwitch, rt as ThemeToolbar, Ni as TimeField, kn as applyInMemoryListParams, Q as asStringMessages, Sr as buildFormPayload, Cr as buildInlineRowsPayload, jr as buildResourceFormSubmitBody, Qt as combineResourceHandlers, Gt as createAdminRouter, An as createMemoryResourceHandlers, ht as createPermissionsChecker, jn as createRestResourceHandlers, ft 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, oi as nestedFieldPath, vn as parseDjangoDRFFormErrors, yn as parseDotNetFormErrors, bn as parseNodeFormErrors, Bt as partitionAdminRoutes, Ar as prepareFormSubmitBody, fn as resolveErrorBody, xr as setFormValue, Nn as toDjangoRestOrdering, kr as toFormData, Fn as toJsonApiSort, Pn as toODataOrderBy, zr as useAbortableEffect, ut as useAuth, gt as useCan, Qi as useChoices, Yt as useDataProvider, Xr as useListQueryState, X as usePermissions, pr as useRegisterPayloadField, mr as useRegisterSectionField, Qr as useResourceListContext, Qe as useThemeMode };
|