ding-react-admin 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +860 -778
- package/dist/src/components/AppHub.d.ts +10 -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 +125 -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,117 @@ 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, loading: s = !1 }) {
|
|
1346
|
+
let c = v(), { token: u } = G.useToken(), [f, p] = d(""), m = (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
|
+
c(e.path);
|
|
1352
|
+
}, h = (e) => {
|
|
1353
|
+
if (r) {
|
|
1354
|
+
r(e);
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
c(e.path);
|
|
1358
|
+
}, g = f.trim(), _ = l(() => t && g ? bt(t, g) : [], [t, g]), y = !!(t && g);
|
|
1359
|
+
return /* @__PURE__ */ J("div", {
|
|
1360
|
+
className: a,
|
|
1361
|
+
style: {
|
|
1362
|
+
width: "100%",
|
|
1363
|
+
maxWidth: o,
|
|
1364
|
+
marginInline: "auto",
|
|
1365
|
+
paddingInline: u.paddingMD
|
|
1366
|
+
},
|
|
1367
|
+
children: [t?.length && !s ? /* @__PURE__ */ q("div", {
|
|
1368
|
+
style: {
|
|
1369
|
+
maxWidth: 480,
|
|
1370
|
+
margin: "0 auto 24px"
|
|
1371
|
+
},
|
|
1372
|
+
children: /* @__PURE__ */ q(it, {
|
|
1373
|
+
value: f,
|
|
1374
|
+
onChange: p,
|
|
1375
|
+
placeholder: i,
|
|
1376
|
+
variant: "app"
|
|
1377
|
+
})
|
|
1378
|
+
}) : null, s ? /* @__PURE__ */ q("div", {
|
|
1379
|
+
style: {
|
|
1380
|
+
display: "flex",
|
|
1381
|
+
justifyContent: "center",
|
|
1382
|
+
padding: u.paddingXL
|
|
1383
|
+
},
|
|
1384
|
+
children: /* @__PURE__ */ q(oe, { size: "large" })
|
|
1385
|
+
}) : y ? /* @__PURE__ */ q(te, {
|
|
1386
|
+
bordered: !0,
|
|
1387
|
+
dataSource: _,
|
|
1388
|
+
locale: { emptyText: "No menus match your search." },
|
|
1389
|
+
style: {
|
|
1390
|
+
background: u.colorBgContainer,
|
|
1391
|
+
borderRadius: u.borderRadiusLG
|
|
1392
|
+
},
|
|
1393
|
+
renderItem: (e) => {
|
|
1394
|
+
let t = e.Icon;
|
|
1395
|
+
return /* @__PURE__ */ q(te.Item, {
|
|
1396
|
+
style: { cursor: "pointer" },
|
|
1397
|
+
onClick: () => h(e),
|
|
1398
|
+
children: /* @__PURE__ */ q(te.Item.Meta, {
|
|
1399
|
+
avatar: t ? /* @__PURE__ */ q("span", {
|
|
1352
1400
|
style: {
|
|
1353
|
-
fontSize:
|
|
1401
|
+
fontSize: 20,
|
|
1354
1402
|
lineHeight: 1
|
|
1355
1403
|
},
|
|
1356
1404
|
children: /* @__PURE__ */ q(t, {})
|
|
1357
|
-
}) :
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
})]
|
|
1405
|
+
}) : void 0,
|
|
1406
|
+
title: _t(e),
|
|
1407
|
+
description: e.group
|
|
1361
1408
|
})
|
|
1362
|
-
})
|
|
1363
|
-
}
|
|
1364
|
-
})
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
}) : /* @__PURE__ */ q(R, {
|
|
1412
|
+
gutter: [16, 16],
|
|
1413
|
+
justify: "center",
|
|
1414
|
+
children: e.map((e) => {
|
|
1415
|
+
let t = e.Icon;
|
|
1416
|
+
return /* @__PURE__ */ q(E, {
|
|
1417
|
+
xs: 12,
|
|
1418
|
+
sm: 8,
|
|
1419
|
+
md: 6,
|
|
1420
|
+
lg: 4,
|
|
1421
|
+
style: { maxWidth: 200 },
|
|
1422
|
+
children: /* @__PURE__ */ q(T, {
|
|
1423
|
+
hoverable: !0,
|
|
1424
|
+
onClick: () => m(e),
|
|
1425
|
+
styles: { body: {
|
|
1426
|
+
textAlign: "center",
|
|
1427
|
+
padding: u.paddingLG
|
|
1428
|
+
} },
|
|
1429
|
+
children: /* @__PURE__ */ J(B, {
|
|
1430
|
+
orientation: "vertical",
|
|
1431
|
+
size: "middle",
|
|
1432
|
+
children: [t ? /* @__PURE__ */ q("span", {
|
|
1433
|
+
style: {
|
|
1434
|
+
fontSize: 40,
|
|
1435
|
+
lineHeight: 1
|
|
1436
|
+
},
|
|
1437
|
+
children: /* @__PURE__ */ q(t, {})
|
|
1438
|
+
}) : null, /* @__PURE__ */ q(W.Text, {
|
|
1439
|
+
strong: !0,
|
|
1440
|
+
children: e.label
|
|
1441
|
+
})]
|
|
1442
|
+
})
|
|
1443
|
+
})
|
|
1444
|
+
}, e.path);
|
|
1445
|
+
})
|
|
1446
|
+
})]
|
|
1365
1447
|
});
|
|
1366
1448
|
}
|
|
1367
1449
|
//#endregion
|
|
1368
1450
|
//#region src/components/AppLauncherButton.tsx
|
|
1369
|
-
function
|
|
1451
|
+
function Vn({ hubPath: e = "/", label: t = "Apps", onClick: n }) {
|
|
1370
1452
|
let r = v();
|
|
1371
1453
|
return /* @__PURE__ */ q(w, {
|
|
1372
1454
|
type: "text",
|
|
1373
|
-
icon: /* @__PURE__ */ q(
|
|
1455
|
+
icon: /* @__PURE__ */ q(ue, {}),
|
|
1374
1456
|
onClick: () => {
|
|
1375
1457
|
if (n) {
|
|
1376
1458
|
n();
|
|
@@ -1383,7 +1465,7 @@ function Rn({ hubPath: e = "/", label: t = "Apps", onClick: n }) {
|
|
|
1383
1465
|
}
|
|
1384
1466
|
//#endregion
|
|
1385
1467
|
//#region src/crud/utils/sortQueryParam.ts
|
|
1386
|
-
function
|
|
1468
|
+
function Hn(e) {
|
|
1387
1469
|
if (!e) return [];
|
|
1388
1470
|
let t = [];
|
|
1389
1471
|
for (let n of e.split(",").map((e) => e.trim()).filter(Boolean)) {
|
|
@@ -1407,17 +1489,17 @@ function zn(e) {
|
|
|
1407
1489
|
}
|
|
1408
1490
|
return t;
|
|
1409
1491
|
}
|
|
1410
|
-
function
|
|
1492
|
+
function Un(e) {
|
|
1411
1493
|
return e.length === 0 ? null : e.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
|
|
1412
1494
|
}
|
|
1413
|
-
function
|
|
1495
|
+
function Wn(e) {
|
|
1414
1496
|
return new Map(e.map((e, t) => [e.field, t + 1]));
|
|
1415
1497
|
}
|
|
1416
1498
|
//#endregion
|
|
1417
1499
|
//#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(() =>
|
|
1500
|
+
var Gn = t(null);
|
|
1501
|
+
function Kn({ children: e, toggleSort: t, sort: n }) {
|
|
1502
|
+
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
1503
|
let n = t.findIndex((t) => t.key === e.key);
|
|
1422
1504
|
if (n < 0) return [...t, e];
|
|
1423
1505
|
if (t[n] === e) return t;
|
|
@@ -1440,23 +1522,23 @@ function Un({ children: e, toggleSort: t, sort: n }) {
|
|
|
1440
1522
|
c,
|
|
1441
1523
|
u
|
|
1442
1524
|
]);
|
|
1443
|
-
return /* @__PURE__ */ q(
|
|
1525
|
+
return /* @__PURE__ */ q(Gn.Provider, {
|
|
1444
1526
|
value: f,
|
|
1445
1527
|
children: e
|
|
1446
1528
|
});
|
|
1447
1529
|
}
|
|
1448
|
-
function
|
|
1449
|
-
let e = o(
|
|
1530
|
+
function qn() {
|
|
1531
|
+
let e = o(Gn);
|
|
1450
1532
|
if (!e) throw Error("Column components must be used within ResourceList");
|
|
1451
1533
|
return e;
|
|
1452
1534
|
}
|
|
1453
|
-
function
|
|
1454
|
-
let { registerColumn: t } =
|
|
1535
|
+
function Jn(e) {
|
|
1536
|
+
let { registerColumn: t } = qn();
|
|
1455
1537
|
s(() => t(e), [t, e]);
|
|
1456
1538
|
}
|
|
1457
1539
|
//#endregion
|
|
1458
1540
|
//#region src/crud/utils/useDebouncedValue.ts
|
|
1459
|
-
function
|
|
1541
|
+
function Yn(e, t) {
|
|
1460
1542
|
let [n, r] = d(e);
|
|
1461
1543
|
return s(() => {
|
|
1462
1544
|
if (t <= 0) {
|
|
@@ -1469,42 +1551,42 @@ function Kn(e, t) {
|
|
|
1469
1551
|
}
|
|
1470
1552
|
//#endregion
|
|
1471
1553
|
//#region src/crud/filters/TextFilter.tsx
|
|
1472
|
-
var
|
|
1473
|
-
function
|
|
1554
|
+
var Xn = 300;
|
|
1555
|
+
function Zn(e) {
|
|
1474
1556
|
if (!(e == null || e === "")) return String(e);
|
|
1475
1557
|
}
|
|
1476
|
-
function
|
|
1477
|
-
let [i, a] = d(() => e ?? ""), o =
|
|
1558
|
+
function Qn({ value: e, onChange: t, placeholder: n, debounceMs: r }) {
|
|
1559
|
+
let [i, a] = d(() => e ?? ""), o = Yn(i, r);
|
|
1478
1560
|
return s(() => {
|
|
1479
1561
|
a(e ?? "");
|
|
1480
1562
|
}, [e]), s(() => {
|
|
1481
1563
|
if (r <= 0 || o !== i) return;
|
|
1482
|
-
let n =
|
|
1483
|
-
n !==
|
|
1564
|
+
let n = Zn(o);
|
|
1565
|
+
n !== Zn(e) && t(n);
|
|
1484
1566
|
}, [
|
|
1485
1567
|
o,
|
|
1486
1568
|
i,
|
|
1487
1569
|
r,
|
|
1488
1570
|
t,
|
|
1489
1571
|
e
|
|
1490
|
-
]), /* @__PURE__ */ q(
|
|
1572
|
+
]), /* @__PURE__ */ q(P, {
|
|
1491
1573
|
allowClear: !0,
|
|
1492
1574
|
placeholder: n,
|
|
1493
1575
|
value: i,
|
|
1494
1576
|
onChange: (e) => {
|
|
1495
1577
|
let n = e.target.value;
|
|
1496
|
-
a(n), (r <= 0 || n === "") && t(
|
|
1578
|
+
a(n), (r <= 0 || n === "") && t(Zn(n));
|
|
1497
1579
|
},
|
|
1498
1580
|
style: { minWidth: 160 }
|
|
1499
1581
|
});
|
|
1500
1582
|
}
|
|
1501
|
-
function
|
|
1502
|
-
let i =
|
|
1503
|
-
return
|
|
1583
|
+
function $n({ source: e, label: t, placeholder: n, debounceMs: r }) {
|
|
1584
|
+
let i = nr(), a = r ?? i?.textFilterDebounceMs ?? 300;
|
|
1585
|
+
return rr(l(() => ({
|
|
1504
1586
|
key: e,
|
|
1505
1587
|
source: e,
|
|
1506
1588
|
label: t,
|
|
1507
|
-
render: ({ value: r, onChange: i }) => /* @__PURE__ */ q(
|
|
1589
|
+
render: ({ value: r, onChange: i }) => /* @__PURE__ */ q(Qn, {
|
|
1508
1590
|
value: r,
|
|
1509
1591
|
onChange: i,
|
|
1510
1592
|
placeholder: n ?? t ?? e,
|
|
@@ -1519,8 +1601,8 @@ function Xn({ source: e, label: t, placeholder: n, debounceMs: r }) {
|
|
|
1519
1601
|
}
|
|
1520
1602
|
//#endregion
|
|
1521
1603
|
//#region src/crud/context/FilterContext.tsx
|
|
1522
|
-
var
|
|
1523
|
-
function
|
|
1604
|
+
var er = t(null);
|
|
1605
|
+
function tr({ children: e, values: t, setFilterValue: n, textFilterDebounceMs: r = 300 }) {
|
|
1524
1606
|
let [i, o] = d([]), s = a((e) => (o((t) => {
|
|
1525
1607
|
let n = t.findIndex((t) => t.key === e.key);
|
|
1526
1608
|
if (n < 0) return [...t, e];
|
|
@@ -1542,25 +1624,25 @@ function Qn({ children: e, values: t, setFilterValue: n, textFilterDebounceMs: r
|
|
|
1542
1624
|
s,
|
|
1543
1625
|
r
|
|
1544
1626
|
]);
|
|
1545
|
-
return /* @__PURE__ */ q(
|
|
1627
|
+
return /* @__PURE__ */ q(er.Provider, {
|
|
1546
1628
|
value: c,
|
|
1547
1629
|
children: e
|
|
1548
1630
|
});
|
|
1549
1631
|
}
|
|
1550
|
-
function
|
|
1551
|
-
return o(
|
|
1632
|
+
function nr() {
|
|
1633
|
+
return o(er);
|
|
1552
1634
|
}
|
|
1553
|
-
function
|
|
1554
|
-
let t =
|
|
1635
|
+
function rr(e) {
|
|
1636
|
+
let t = nr()?.registerFilter;
|
|
1555
1637
|
s(() => {
|
|
1556
1638
|
if (t) return t(e);
|
|
1557
1639
|
}, [t, e]);
|
|
1558
1640
|
}
|
|
1559
1641
|
//#endregion
|
|
1560
1642
|
//#region src/crud/context/FormContext.tsx
|
|
1561
|
-
var
|
|
1562
|
-
function
|
|
1563
|
-
return /* @__PURE__ */ q(
|
|
1643
|
+
var ir = t(null);
|
|
1644
|
+
function ar({ children: e, resource: t, isNew: n, disabled: r }) {
|
|
1645
|
+
return /* @__PURE__ */ q(ir.Provider, {
|
|
1564
1646
|
value: {
|
|
1565
1647
|
resource: t,
|
|
1566
1648
|
isNew: n,
|
|
@@ -1569,35 +1651,35 @@ function nr({ children: e, resource: t, isNew: n, disabled: r }) {
|
|
|
1569
1651
|
children: e
|
|
1570
1652
|
});
|
|
1571
1653
|
}
|
|
1572
|
-
function
|
|
1573
|
-
return o(
|
|
1654
|
+
function or() {
|
|
1655
|
+
return o(ir);
|
|
1574
1656
|
}
|
|
1575
1657
|
//#endregion
|
|
1576
1658
|
//#region src/crud/context/FormSectionContext.tsx
|
|
1577
|
-
var
|
|
1578
|
-
function
|
|
1579
|
-
return /* @__PURE__ */ q(
|
|
1659
|
+
var sr = t(null);
|
|
1660
|
+
function cr({ sourcesRef: e, children: t }) {
|
|
1661
|
+
return /* @__PURE__ */ q(sr.Provider, {
|
|
1580
1662
|
value: e,
|
|
1581
1663
|
children: t
|
|
1582
1664
|
});
|
|
1583
1665
|
}
|
|
1584
|
-
function
|
|
1585
|
-
return o(
|
|
1666
|
+
function lr() {
|
|
1667
|
+
return o(sr);
|
|
1586
1668
|
}
|
|
1587
1669
|
//#endregion
|
|
1588
1670
|
//#region src/crud/context/PayloadFieldsContext.tsx
|
|
1589
|
-
var
|
|
1590
|
-
function
|
|
1591
|
-
return /* @__PURE__ */ q(
|
|
1671
|
+
var ur = t(null);
|
|
1672
|
+
function dr({ children: e, fieldsRef: t }) {
|
|
1673
|
+
return /* @__PURE__ */ q(ur.Provider, {
|
|
1592
1674
|
value: t,
|
|
1593
1675
|
children: e
|
|
1594
1676
|
});
|
|
1595
1677
|
}
|
|
1596
|
-
function
|
|
1597
|
-
return o(
|
|
1678
|
+
function fr() {
|
|
1679
|
+
return o(ur);
|
|
1598
1680
|
}
|
|
1599
|
-
function
|
|
1600
|
-
let n =
|
|
1681
|
+
function pr(e, t = !0) {
|
|
1682
|
+
let n = fr();
|
|
1601
1683
|
s(() => {
|
|
1602
1684
|
if (!(!t || !n)) return n.current.add(e), () => {
|
|
1603
1685
|
n.current.delete(e);
|
|
@@ -1608,8 +1690,8 @@ function ur(e, t = !0) {
|
|
|
1608
1690
|
t
|
|
1609
1691
|
]);
|
|
1610
1692
|
}
|
|
1611
|
-
function
|
|
1612
|
-
let n =
|
|
1693
|
+
function mr(e, t = !0) {
|
|
1694
|
+
let n = lr();
|
|
1613
1695
|
s(() => {
|
|
1614
1696
|
if (!(!t || !n)) return n.current.add(e), () => {
|
|
1615
1697
|
n.current.delete(e);
|
|
@@ -1622,18 +1704,18 @@ function dr(e, t = !0) {
|
|
|
1622
1704
|
}
|
|
1623
1705
|
//#endregion
|
|
1624
1706
|
//#region src/crud/context/InlineFieldsRegistry.tsx
|
|
1625
|
-
var
|
|
1626
|
-
function
|
|
1627
|
-
return /* @__PURE__ */ q(
|
|
1707
|
+
var hr = t(null);
|
|
1708
|
+
function gr({ children: e, registryRef: t }) {
|
|
1709
|
+
return /* @__PURE__ */ q(hr.Provider, {
|
|
1628
1710
|
value: t,
|
|
1629
1711
|
children: e
|
|
1630
1712
|
});
|
|
1631
1713
|
}
|
|
1632
|
-
function
|
|
1633
|
-
return o(
|
|
1714
|
+
function _r() {
|
|
1715
|
+
return o(hr);
|
|
1634
1716
|
}
|
|
1635
|
-
function
|
|
1636
|
-
let a =
|
|
1717
|
+
function vr(e, t, n, r, i = !0) {
|
|
1718
|
+
let a = _r();
|
|
1637
1719
|
s(() => {
|
|
1638
1720
|
if (!(!i || !a)) return a.current.set(e, {
|
|
1639
1721
|
field: e,
|
|
@@ -1654,7 +1736,7 @@ function hr(e, t, n, r, i = !0) {
|
|
|
1654
1736
|
}
|
|
1655
1737
|
//#endregion
|
|
1656
1738
|
//#region src/crud/FormGlobalErrorsAlert.tsx
|
|
1657
|
-
function
|
|
1739
|
+
function yr({ errors: e }) {
|
|
1658
1740
|
return e.length ? e.length === 1 ? /* @__PURE__ */ q(x, {
|
|
1659
1741
|
type: "error",
|
|
1660
1742
|
title: e[0],
|
|
@@ -1676,7 +1758,7 @@ function gr({ errors: e }) {
|
|
|
1676
1758
|
}
|
|
1677
1759
|
//#endregion
|
|
1678
1760
|
//#region src/crud/utils/getFormValue.ts
|
|
1679
|
-
function
|
|
1761
|
+
function br(e, t) {
|
|
1680
1762
|
let n = t.split("."), r = e;
|
|
1681
1763
|
for (let e of n) {
|
|
1682
1764
|
if (typeof r != "object" || !r) return;
|
|
@@ -1686,7 +1768,7 @@ function _r(e, t) {
|
|
|
1686
1768
|
}
|
|
1687
1769
|
//#endregion
|
|
1688
1770
|
//#region src/crud/utils/setFormValue.ts
|
|
1689
|
-
function
|
|
1771
|
+
function xr(e, t, n) {
|
|
1690
1772
|
let r = t.split("."), i = e;
|
|
1691
1773
|
for (let e = 0; e < r.length - 1; e++) {
|
|
1692
1774
|
let t = r[e], n = i[t];
|
|
@@ -1696,18 +1778,18 @@ function vr(e, t, n) {
|
|
|
1696
1778
|
}
|
|
1697
1779
|
//#endregion
|
|
1698
1780
|
//#region src/crud/utils/buildFormPayload.ts
|
|
1699
|
-
function
|
|
1781
|
+
function Sr(e, t) {
|
|
1700
1782
|
if (t.length === 0) return { ...e };
|
|
1701
1783
|
let n = {};
|
|
1702
1784
|
for (let r of t) {
|
|
1703
|
-
let t =
|
|
1704
|
-
t !== void 0 &&
|
|
1785
|
+
let t = br(e, r);
|
|
1786
|
+
t !== void 0 && xr(n, r, t);
|
|
1705
1787
|
}
|
|
1706
1788
|
return n;
|
|
1707
1789
|
}
|
|
1708
1790
|
//#endregion
|
|
1709
1791
|
//#region src/crud/utils/buildInlineRowsPayload.ts
|
|
1710
|
-
function
|
|
1792
|
+
function Cr(e, t, n) {
|
|
1711
1793
|
if (!Array.isArray(e)) return [];
|
|
1712
1794
|
let r = e.map((e) => {
|
|
1713
1795
|
if (!e || typeof e != "object") return {};
|
|
@@ -1723,34 +1805,34 @@ function br(e, t, n) {
|
|
|
1723
1805
|
}
|
|
1724
1806
|
//#endregion
|
|
1725
1807
|
//#region src/crud/utils/hasUploadValues.ts
|
|
1726
|
-
function
|
|
1727
|
-
return e instanceof Blob ? !0 : Array.isArray(e) ? e.some(
|
|
1808
|
+
function wr(e) {
|
|
1809
|
+
return e instanceof Blob ? !0 : Array.isArray(e) ? e.some(wr) : e && typeof e == "object" ? Object.values(e).some(wr) : !1;
|
|
1728
1810
|
}
|
|
1729
1811
|
//#endregion
|
|
1730
1812
|
//#region src/crud/utils/uploadReferenceUtils.ts
|
|
1731
|
-
function
|
|
1813
|
+
function Tr(e) {
|
|
1732
1814
|
return /^https?:\/\//i.test(e) || e.startsWith("/media/");
|
|
1733
1815
|
}
|
|
1734
|
-
function
|
|
1816
|
+
function Er(e, t) {
|
|
1735
1817
|
if (!t) return e;
|
|
1736
|
-
if (typeof e == "string") return
|
|
1737
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
1818
|
+
if (typeof e == "string") return Tr(e) ? void 0 : e;
|
|
1819
|
+
if (Array.isArray(e)) return e.map((e) => Er(e, t)).filter((e) => e !== void 0);
|
|
1738
1820
|
if (e && typeof e == "object" && !(e instanceof Blob)) {
|
|
1739
1821
|
let n = {};
|
|
1740
1822
|
for (let [r, i] of Object.entries(e)) {
|
|
1741
|
-
let e =
|
|
1823
|
+
let e = Er(i, t);
|
|
1742
1824
|
e !== void 0 && (n[r] = e);
|
|
1743
1825
|
}
|
|
1744
1826
|
return n;
|
|
1745
1827
|
}
|
|
1746
1828
|
return e;
|
|
1747
1829
|
}
|
|
1748
|
-
function
|
|
1749
|
-
return
|
|
1830
|
+
function Dr(e, t = !0) {
|
|
1831
|
+
return Er(e, t);
|
|
1750
1832
|
}
|
|
1751
1833
|
//#endregion
|
|
1752
1834
|
//#region src/crud/utils/toFormData.ts
|
|
1753
|
-
function
|
|
1835
|
+
function Or(e, t, n, r) {
|
|
1754
1836
|
if (n !== void 0) {
|
|
1755
1837
|
if (n === null) {
|
|
1756
1838
|
e.append(t, "");
|
|
@@ -1765,106 +1847,106 @@ function Tr(e, t, n, r) {
|
|
|
1765
1847
|
return;
|
|
1766
1848
|
}
|
|
1767
1849
|
if (typeof n == "string") {
|
|
1768
|
-
if (r.skipExistingUploadUrls &&
|
|
1850
|
+
if (r.skipExistingUploadUrls && Tr(n)) return;
|
|
1769
1851
|
e.append(t, n);
|
|
1770
1852
|
return;
|
|
1771
1853
|
}
|
|
1772
1854
|
if (Array.isArray(n)) {
|
|
1773
1855
|
n.forEach((n, i) => {
|
|
1774
|
-
|
|
1856
|
+
Or(e, `${t}[${i}]`, n, r);
|
|
1775
1857
|
});
|
|
1776
1858
|
return;
|
|
1777
1859
|
}
|
|
1778
1860
|
if (typeof n == "object") {
|
|
1779
|
-
for (let [i, a] of Object.entries(n))
|
|
1861
|
+
for (let [i, a] of Object.entries(n)) Or(e, `${t}[${i}]`, a, r);
|
|
1780
1862
|
return;
|
|
1781
1863
|
}
|
|
1782
1864
|
e.append(t, String(n));
|
|
1783
1865
|
}
|
|
1784
1866
|
}
|
|
1785
|
-
function
|
|
1867
|
+
function kr(e, t) {
|
|
1786
1868
|
let n = { skipExistingUploadUrls: t?.skipExistingUploadUrls ?? !0 }, r = new FormData();
|
|
1787
|
-
for (let [t, i] of Object.entries(e))
|
|
1869
|
+
for (let [t, i] of Object.entries(e)) Or(r, t, i, n);
|
|
1788
1870
|
return r;
|
|
1789
1871
|
}
|
|
1790
1872
|
//#endregion
|
|
1791
1873
|
//#region src/crud/utils/prepareFormSubmitBody.ts
|
|
1792
|
-
function
|
|
1874
|
+
function Ar(e, t) {
|
|
1793
1875
|
let n = t?.skipExistingUploadUrls ?? !0;
|
|
1794
|
-
return
|
|
1876
|
+
return wr(e) ? kr(e, t) : Dr(e, n);
|
|
1795
1877
|
}
|
|
1796
1878
|
//#endregion
|
|
1797
1879
|
//#region src/crud/utils/buildResourceFormSubmitBody.ts
|
|
1798
|
-
function
|
|
1799
|
-
let i =
|
|
1880
|
+
function jr(e, t, n, r) {
|
|
1881
|
+
let i = Sr(e, t);
|
|
1800
1882
|
if (n) for (let t of n) {
|
|
1801
1883
|
let n = e[t.field], r = t.payloadKey ?? t.field;
|
|
1802
|
-
i[r] =
|
|
1884
|
+
i[r] = Cr(n, t.sources, { transformRows: t.transformRows });
|
|
1803
1885
|
}
|
|
1804
|
-
return
|
|
1886
|
+
return Ar(i, r);
|
|
1805
1887
|
}
|
|
1806
1888
|
//#endregion
|
|
1807
1889
|
//#region src/crud/utils/formErrors.ts
|
|
1808
|
-
function
|
|
1890
|
+
function Mr(e) {
|
|
1809
1891
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
1810
1892
|
}
|
|
1811
|
-
function
|
|
1893
|
+
function Nr(e) {
|
|
1812
1894
|
return Array.isArray(e) ? e.join(", ") : e;
|
|
1813
1895
|
}
|
|
1814
|
-
function
|
|
1896
|
+
function Pr(e, t, n) {
|
|
1815
1897
|
if (t.has(e)) return !0;
|
|
1816
1898
|
let r = e.match(/^([^.]+)\.(\d+)\.([^.]+)$/);
|
|
1817
1899
|
if (!r) return !1;
|
|
1818
1900
|
let [, i, , a] = r;
|
|
1819
1901
|
return n.get(i)?.sources.includes(a) ?? !1;
|
|
1820
1902
|
}
|
|
1821
|
-
function
|
|
1822
|
-
let r = {}, i = [...
|
|
1823
|
-
for (let [a, o] of Object.entries(e.fields ?? {}))
|
|
1903
|
+
function Fr(e, t, n) {
|
|
1904
|
+
let r = {}, i = [...Mr(e.global)];
|
|
1905
|
+
for (let [a, o] of Object.entries(e.fields ?? {})) Pr(a, t, n) ? r[a] = o : i.push(Nr(o));
|
|
1824
1906
|
return {
|
|
1825
1907
|
fieldErrors: r,
|
|
1826
1908
|
globalErrors: i
|
|
1827
1909
|
};
|
|
1828
1910
|
}
|
|
1829
|
-
function
|
|
1911
|
+
function Ir(e, t) {
|
|
1830
1912
|
for (let [n, r] of Object.entries(t)) e.setError(n, {
|
|
1831
1913
|
type: "server",
|
|
1832
|
-
message:
|
|
1914
|
+
message: Nr(r)
|
|
1833
1915
|
});
|
|
1834
1916
|
}
|
|
1835
|
-
function
|
|
1836
|
-
let t =
|
|
1917
|
+
function Lr(e) {
|
|
1918
|
+
let t = ln(e);
|
|
1837
1919
|
if (t && !/application\/json/i.test(t)) return `non-JSON response (Content-Type: ${t})`;
|
|
1838
1920
|
}
|
|
1839
|
-
async function
|
|
1840
|
-
let a = await
|
|
1921
|
+
async function Rr(e, t, n, r, i) {
|
|
1922
|
+
let a = await fn(n);
|
|
1841
1923
|
if (a != null) {
|
|
1842
1924
|
let n = e.parseFormError?.({ body: a }, r);
|
|
1843
1925
|
if (n) {
|
|
1844
1926
|
let e = new Set(i.payloadFields), r = /* @__PURE__ */ new Map();
|
|
1845
1927
|
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
|
|
1928
|
+
let { fieldErrors: a, globalErrors: o } = Fr(n, e, r);
|
|
1929
|
+
if (Object.keys(a).length || o.length) return Ir(t, a), {
|
|
1848
1930
|
handled: !0,
|
|
1849
1931
|
globalErrors: o
|
|
1850
1932
|
};
|
|
1851
1933
|
}
|
|
1852
1934
|
return {
|
|
1853
1935
|
handled: !0,
|
|
1854
|
-
globalErrors: [
|
|
1936
|
+
globalErrors: [sn(a)]
|
|
1855
1937
|
};
|
|
1856
1938
|
}
|
|
1857
|
-
return
|
|
1939
|
+
return cn(n) == null ? {
|
|
1858
1940
|
handled: !1,
|
|
1859
1941
|
globalErrors: []
|
|
1860
1942
|
} : {
|
|
1861
1943
|
handled: !0,
|
|
1862
|
-
globalErrors: [
|
|
1944
|
+
globalErrors: [sn(null, { hint: Lr(n) })]
|
|
1863
1945
|
};
|
|
1864
1946
|
}
|
|
1865
1947
|
//#endregion
|
|
1866
1948
|
//#region src/crud/utils/useAbortableEffect.ts
|
|
1867
|
-
function
|
|
1949
|
+
function zr(e, t) {
|
|
1868
1950
|
s(() => {
|
|
1869
1951
|
let t = new AbortController();
|
|
1870
1952
|
return e(t.signal), () => t.abort();
|
|
@@ -1872,7 +1954,7 @@ function Ir(e, t) {
|
|
|
1872
1954
|
}
|
|
1873
1955
|
//#endregion
|
|
1874
1956
|
//#region src/crud/utils/useFormRecord.ts
|
|
1875
|
-
function
|
|
1957
|
+
function Br({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultValues: s, enabled: c = !0 }) {
|
|
1876
1958
|
let [l, u] = d(!r), [f, p] = d(0), m = a(async (a) => {
|
|
1877
1959
|
if (r || !n) {
|
|
1878
1960
|
s ? i.reset({ ...s }) : i.reset({}), u(!1);
|
|
@@ -1884,7 +1966,7 @@ function Lr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultV
|
|
|
1884
1966
|
if (a?.aborted) return;
|
|
1885
1967
|
i.reset(r.data), p((e) => e + 1);
|
|
1886
1968
|
} catch (e) {
|
|
1887
|
-
|
|
1969
|
+
$t(e) || o.error(e instanceof Error ? e.message : "Load failed");
|
|
1888
1970
|
} finally {
|
|
1889
1971
|
a?.aborted || u(!1);
|
|
1890
1972
|
}
|
|
@@ -1897,20 +1979,20 @@ function Lr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultV
|
|
|
1897
1979
|
o,
|
|
1898
1980
|
s
|
|
1899
1981
|
]);
|
|
1900
|
-
return
|
|
1982
|
+
return zr((e) => {
|
|
1901
1983
|
if (c) return m(e);
|
|
1902
1984
|
}, [c, m]), {
|
|
1903
1985
|
loading: l,
|
|
1904
1986
|
formVersion: f
|
|
1905
1987
|
};
|
|
1906
1988
|
}
|
|
1907
|
-
function
|
|
1989
|
+
function Vr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadFieldsRef: s, inlineRegistryRef: c, setGlobalErrors: l, onSuccess: u }) {
|
|
1908
1990
|
let [f, p] = d(!1);
|
|
1909
1991
|
return {
|
|
1910
1992
|
onSubmit: a(async (a) => {
|
|
1911
1993
|
l([]), p(!0);
|
|
1912
1994
|
try {
|
|
1913
|
-
let i =
|
|
1995
|
+
let i = jr(a, Array.from(s.current), c.current.values()), l;
|
|
1914
1996
|
if (r) l = (await e.create(t, i)).data, o.success("Created");
|
|
1915
1997
|
else if (n) l = (await e.update(t, {
|
|
1916
1998
|
id: n,
|
|
@@ -1919,7 +2001,7 @@ function Rr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
1919
2001
|
else return;
|
|
1920
2002
|
u?.(l);
|
|
1921
2003
|
} catch (n) {
|
|
1922
|
-
let { handled: a, globalErrors: u } = await
|
|
2004
|
+
let { handled: a, globalErrors: u } = await Rr(e, i, n, {
|
|
1923
2005
|
resource: t,
|
|
1924
2006
|
mutation: r ? "create" : "update",
|
|
1925
2007
|
inlineFieldPaths: Array.from(c.current.keys())
|
|
@@ -1948,8 +2030,8 @@ function Rr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
1948
2030
|
}
|
|
1949
2031
|
//#endregion
|
|
1950
2032
|
//#region src/crud/ResourceRecordForm.tsx
|
|
1951
|
-
function
|
|
1952
|
-
let m = t === "new" || !t, h = m ? void 0 : t, g =
|
|
2033
|
+
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" }) {
|
|
2034
|
+
let m = t === "new" || !t, h = m ? void 0 : t, g = Yt(), { message: _ } = S.useApp(), v = u(/* @__PURE__ */ new Set()), y = u(/* @__PURE__ */ new Map()), [b, x] = d([]), C = je({ defaultValues: i }), { loading: T, formVersion: E } = Br({
|
|
1953
2035
|
dp: g,
|
|
1954
2036
|
resource: e,
|
|
1955
2037
|
id: h,
|
|
@@ -1958,7 +2040,7 @@ function zr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1958
2040
|
message: _,
|
|
1959
2041
|
defaultValues: i,
|
|
1960
2042
|
enabled: a
|
|
1961
|
-
}), { onSubmit: D, saving: O } =
|
|
2043
|
+
}), { onSubmit: D, saving: O } = Vr({
|
|
1962
2044
|
dp: g,
|
|
1963
2045
|
resource: e,
|
|
1964
2046
|
id: h,
|
|
@@ -1969,20 +2051,20 @@ function zr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1969
2051
|
inlineRegistryRef: y,
|
|
1970
2052
|
setGlobalErrors: x,
|
|
1971
2053
|
onSuccess: l
|
|
1972
|
-
}), k = T || O,
|
|
2054
|
+
}), k = T || O, A = () => {
|
|
1973
2055
|
C.handleSubmit(D, () => {
|
|
1974
2056
|
_.warning("Please fix the errors below.");
|
|
1975
2057
|
})();
|
|
1976
|
-
},
|
|
2058
|
+
}, j = /* @__PURE__ */ q(w, {
|
|
1977
2059
|
disabled: k,
|
|
1978
2060
|
onClick: c ? void 0 : s,
|
|
1979
2061
|
children: "Cancel"
|
|
1980
|
-
}),
|
|
2062
|
+
}), ee = /* @__PURE__ */ q(ar, {
|
|
1981
2063
|
resource: e,
|
|
1982
2064
|
isNew: m,
|
|
1983
|
-
children: /* @__PURE__ */ q(
|
|
2065
|
+
children: /* @__PURE__ */ q(dr, {
|
|
1984
2066
|
fieldsRef: v,
|
|
1985
|
-
children: /* @__PURE__ */ q(
|
|
2067
|
+
children: /* @__PURE__ */ q(gr, {
|
|
1986
2068
|
registryRef: y,
|
|
1987
2069
|
children: /* @__PURE__ */ J("div", {
|
|
1988
2070
|
style: { position: "relative" },
|
|
@@ -1995,26 +2077,26 @@ function zr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1995
2077
|
justifyContent: "center",
|
|
1996
2078
|
zIndex: 1
|
|
1997
2079
|
},
|
|
1998
|
-
children: /* @__PURE__ */ q(
|
|
1999
|
-
}) : null, /* @__PURE__ */ n(
|
|
2080
|
+
children: /* @__PURE__ */ q(oe, {})
|
|
2081
|
+
}) : null, /* @__PURE__ */ n(ke, {
|
|
2000
2082
|
...C,
|
|
2001
2083
|
key: E
|
|
2002
|
-
}, /* @__PURE__ */ J(
|
|
2084
|
+
}, /* @__PURE__ */ J(M, {
|
|
2003
2085
|
layout: "vertical",
|
|
2004
|
-
onFinish:
|
|
2086
|
+
onFinish: A,
|
|
2005
2087
|
style: p === "overlay" ? {
|
|
2006
2088
|
opacity: k ? .4 : 1,
|
|
2007
2089
|
pointerEvents: k ? "none" : void 0
|
|
2008
2090
|
} : void 0,
|
|
2009
2091
|
children: [
|
|
2010
|
-
/* @__PURE__ */ q(
|
|
2092
|
+
/* @__PURE__ */ q(yr, { errors: b }),
|
|
2011
2093
|
r,
|
|
2012
|
-
/* @__PURE__ */ q(
|
|
2094
|
+
/* @__PURE__ */ q(M.Item, {
|
|
2013
2095
|
style: {
|
|
2014
2096
|
marginTop: 16,
|
|
2015
2097
|
marginBottom: 0
|
|
2016
2098
|
},
|
|
2017
|
-
children: /* @__PURE__ */ J(
|
|
2099
|
+
children: /* @__PURE__ */ J(B, { children: [/* @__PURE__ */ q(w, {
|
|
2018
2100
|
type: "primary",
|
|
2019
2101
|
htmlType: "submit",
|
|
2020
2102
|
loading: O,
|
|
@@ -2022,8 +2104,8 @@ function zr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2022
2104
|
children: "Save"
|
|
2023
2105
|
}), c ? /* @__PURE__ */ q(f, {
|
|
2024
2106
|
to: c,
|
|
2025
|
-
children:
|
|
2026
|
-
}) :
|
|
2107
|
+
children: j
|
|
2108
|
+
}) : j] })
|
|
2027
2109
|
})
|
|
2028
2110
|
]
|
|
2029
2111
|
}))]
|
|
@@ -2031,13 +2113,13 @@ function zr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2031
2113
|
})
|
|
2032
2114
|
})
|
|
2033
2115
|
});
|
|
2034
|
-
return T && !O && p === "replace" ? /* @__PURE__ */ q(
|
|
2116
|
+
return T && !O && p === "replace" ? /* @__PURE__ */ q(oe, {}) : ee;
|
|
2035
2117
|
}
|
|
2036
2118
|
//#endregion
|
|
2037
2119
|
//#region src/crud/ResourceFormModal.tsx
|
|
2038
|
-
function
|
|
2120
|
+
function Ur({ resource: e, editId: t, onClose: n, children: r, title: i, permissions: a, defaultValues: o, width: s = 560, onSuccess: c }) {
|
|
2039
2121
|
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(
|
|
2122
|
+
return /* @__PURE__ */ q(ne, {
|
|
2041
2123
|
open: u,
|
|
2042
2124
|
title: f,
|
|
2043
2125
|
onCancel: n,
|
|
@@ -2045,7 +2127,7 @@ function Br({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
2045
2127
|
destroyOnHidden: !0,
|
|
2046
2128
|
width: s,
|
|
2047
2129
|
maskClosable: !1,
|
|
2048
|
-
children: /* @__PURE__ */ q(S, { children: /* @__PURE__ */ q(
|
|
2130
|
+
children: /* @__PURE__ */ q(S, { children: /* @__PURE__ */ q(Hr, {
|
|
2049
2131
|
resource: e,
|
|
2050
2132
|
id: t ?? void 0,
|
|
2051
2133
|
enabled: u,
|
|
@@ -2062,7 +2144,7 @@ function Br({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
2062
2144
|
}
|
|
2063
2145
|
//#endregion
|
|
2064
2146
|
//#region src/crud/ListActionsBar.tsx
|
|
2065
|
-
function
|
|
2147
|
+
function Wr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelected: r, onSelectAllMatching: i, onClearSelection: o, actions: s, onExecute: c, selectedIds: u, running: f = !1 }) {
|
|
2066
2148
|
let [p, m] = d(), h = l(() => s.map((e) => ({
|
|
2067
2149
|
value: e.key,
|
|
2068
2150
|
label: e.label
|
|
@@ -2076,7 +2158,7 @@ function Vr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2076
2158
|
e,
|
|
2077
2159
|
u
|
|
2078
2160
|
]), _ = n && !r && t > e;
|
|
2079
|
-
return /* @__PURE__ */ J(
|
|
2161
|
+
return /* @__PURE__ */ J(B, {
|
|
2080
2162
|
wrap: !0,
|
|
2081
2163
|
style: {
|
|
2082
2164
|
marginBottom: 16,
|
|
@@ -2125,7 +2207,7 @@ function Vr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2125
2207
|
" items selected"
|
|
2126
2208
|
]
|
|
2127
2209
|
})] }) : null,
|
|
2128
|
-
/* @__PURE__ */ q(
|
|
2210
|
+
/* @__PURE__ */ q(z, {
|
|
2129
2211
|
placeholder: "Action",
|
|
2130
2212
|
style: { minWidth: 200 },
|
|
2131
2213
|
options: h,
|
|
@@ -2146,14 +2228,14 @@ function Vr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2146
2228
|
}
|
|
2147
2229
|
//#endregion
|
|
2148
2230
|
//#region src/crud/types.ts
|
|
2149
|
-
var
|
|
2231
|
+
var Gr = new Set([
|
|
2150
2232
|
"page",
|
|
2151
2233
|
"perPage",
|
|
2152
2234
|
"sort",
|
|
2153
2235
|
"create",
|
|
2154
2236
|
"edit"
|
|
2155
|
-
]),
|
|
2156
|
-
function
|
|
2237
|
+
]), Kr = 1, qr = 10;
|
|
2238
|
+
function Jr(e) {
|
|
2157
2239
|
if (e.includes(",")) {
|
|
2158
2240
|
let t = e.split(",").map((e) => e.trim()), n = t.map(Number);
|
|
2159
2241
|
return n.every((e) => Number.isFinite(e)) ? n : t;
|
|
@@ -2161,16 +2243,16 @@ function Gr(e) {
|
|
|
2161
2243
|
let t = Number(e);
|
|
2162
2244
|
return e !== "" && Number.isFinite(t) && String(t) === e ? t : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
2163
2245
|
}
|
|
2164
|
-
function
|
|
2246
|
+
function Yr(e) {
|
|
2165
2247
|
return e == null || e === "" ? null : Array.isArray(e) ? e.length === 0 ? null : e.map(String).join(",") : String(e);
|
|
2166
2248
|
}
|
|
2167
|
-
function
|
|
2249
|
+
function Xr(e) {
|
|
2168
2250
|
let [t, n] = b(), r = l(() => {
|
|
2169
|
-
let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) ||
|
|
2251
|
+
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
2252
|
return t.forEach((e, n) => {
|
|
2171
|
-
if (
|
|
2253
|
+
if (Gr.has(n)) return;
|
|
2172
2254
|
let r = c[n];
|
|
2173
|
-
r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(
|
|
2255
|
+
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
2256
|
}), {
|
|
2175
2257
|
page: i,
|
|
2176
2258
|
perPage: a,
|
|
@@ -2193,19 +2275,19 @@ function qr(e) {
|
|
|
2193
2275
|
},
|
|
2194
2276
|
setPerPage: (e) => {
|
|
2195
2277
|
i((t) => {
|
|
2196
|
-
e ===
|
|
2278
|
+
e === qr ? t.delete("perPage") : t.set("perPage", String(e)), t.delete("page");
|
|
2197
2279
|
});
|
|
2198
2280
|
},
|
|
2199
2281
|
setSort: (e) => {
|
|
2200
2282
|
i((t) => {
|
|
2201
2283
|
t.delete("sort");
|
|
2202
|
-
let n =
|
|
2284
|
+
let n = Un(e);
|
|
2203
2285
|
n && t.set("sort", n);
|
|
2204
2286
|
});
|
|
2205
2287
|
},
|
|
2206
2288
|
toggleSort: (e) => {
|
|
2207
2289
|
i((t) => {
|
|
2208
|
-
let n = t.getAll("sort").flatMap((e) =>
|
|
2290
|
+
let n = t.getAll("sort").flatMap((e) => Hn(e)), r = n.findIndex((t) => t.field === e), i;
|
|
2209
2291
|
i = r < 0 ? [...n, {
|
|
2210
2292
|
field: e,
|
|
2211
2293
|
order: "ASC"
|
|
@@ -2213,22 +2295,22 @@ function qr(e) {
|
|
|
2213
2295
|
...e,
|
|
2214
2296
|
order: "DESC"
|
|
2215
2297
|
} : e) : n.filter((e, t) => t !== r), t.delete("sort");
|
|
2216
|
-
let a =
|
|
2298
|
+
let a = Un(i);
|
|
2217
2299
|
a && t.set("sort", a);
|
|
2218
2300
|
});
|
|
2219
2301
|
},
|
|
2220
2302
|
setFilter: (e, t) => {
|
|
2221
2303
|
i((n) => {
|
|
2222
2304
|
n.delete(e);
|
|
2223
|
-
let r =
|
|
2305
|
+
let r = Yr(t);
|
|
2224
2306
|
r != null && n.set(e, r), n.delete("page");
|
|
2225
2307
|
});
|
|
2226
2308
|
},
|
|
2227
2309
|
setFilters: (e) => {
|
|
2228
2310
|
i((t) => {
|
|
2229
|
-
for (let e of [...t.keys()])
|
|
2311
|
+
for (let e of [...t.keys()]) Gr.has(e) || t.delete(e);
|
|
2230
2312
|
for (let [n, r] of Object.entries(e)) {
|
|
2231
|
-
let e =
|
|
2313
|
+
let e = Yr(r);
|
|
2232
2314
|
e != null && t.set(n, e);
|
|
2233
2315
|
}
|
|
2234
2316
|
t.delete("page");
|
|
@@ -2253,20 +2335,20 @@ function qr(e) {
|
|
|
2253
2335
|
}
|
|
2254
2336
|
//#endregion
|
|
2255
2337
|
//#region src/crud/ResourceList.tsx
|
|
2256
|
-
var
|
|
2257
|
-
function
|
|
2258
|
-
return o(
|
|
2338
|
+
var Zr = t(null);
|
|
2339
|
+
function Qr() {
|
|
2340
|
+
return o(Zr);
|
|
2259
2341
|
}
|
|
2260
|
-
function
|
|
2342
|
+
function $r(e) {
|
|
2261
2343
|
return e == null || e === "" ? "—" : String(e);
|
|
2262
2344
|
}
|
|
2263
|
-
function
|
|
2345
|
+
function ei(e, t) {
|
|
2264
2346
|
if (e.length === 0 || !t.showEdit && !t.showQuickEdit) return e;
|
|
2265
2347
|
let [n, ...r] = e, i = n.render;
|
|
2266
2348
|
return [{
|
|
2267
2349
|
...n,
|
|
2268
2350
|
render: (e, n, r) => {
|
|
2269
|
-
let a = i ? i(e, n, r) :
|
|
2351
|
+
let a = i ? i(e, n, r) : $r(e);
|
|
2270
2352
|
return t.showEdit ? /* @__PURE__ */ q(f, {
|
|
2271
2353
|
to: `${t.pathPrefix}/${String(n.id)}`,
|
|
2272
2354
|
className: "ding-admin-row-edit-link",
|
|
@@ -2286,9 +2368,9 @@ function Zr(e, t) {
|
|
|
2286
2368
|
}
|
|
2287
2369
|
}, ...r];
|
|
2288
2370
|
}
|
|
2289
|
-
function
|
|
2290
|
-
let x =
|
|
2291
|
-
|
|
2371
|
+
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 }) {
|
|
2372
|
+
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(() => {
|
|
2373
|
+
R(/* @__PURE__ */ new Set());
|
|
2292
2374
|
}, []), he = l(() => {
|
|
2293
2375
|
if (!_) return [];
|
|
2294
2376
|
let t = [];
|
|
@@ -2308,16 +2390,16 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2308
2390
|
x,
|
|
2309
2391
|
e,
|
|
2310
2392
|
E
|
|
2311
|
-
]), ge = he.length > 0, _e =
|
|
2393
|
+
]), ge = he.length > 0, _e = ie.size;
|
|
2312
2394
|
c(() => {
|
|
2313
|
-
let e =
|
|
2395
|
+
let e = M.current;
|
|
2314
2396
|
if (!e) return;
|
|
2315
2397
|
let t = e.closest(".ding-admin-scroll");
|
|
2316
2398
|
t?.classList.add("ding-admin-resource-list-scroll");
|
|
2317
2399
|
let n = () => {
|
|
2318
2400
|
if (e.clientHeight <= 0) return;
|
|
2319
2401
|
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
|
-
|
|
2402
|
+
N((e) => e === c ? e : c);
|
|
2321
2403
|
};
|
|
2322
2404
|
n();
|
|
2323
2405
|
let r = new ResizeObserver(() => n());
|
|
@@ -2327,39 +2409,39 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2327
2409
|
}, [
|
|
2328
2410
|
ge,
|
|
2329
2411
|
_e,
|
|
2330
|
-
|
|
2331
|
-
|
|
2412
|
+
L,
|
|
2413
|
+
P
|
|
2332
2414
|
]);
|
|
2333
|
-
let ve =
|
|
2334
|
-
|
|
2335
|
-
let n = new Set(t), r =
|
|
2415
|
+
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) => {
|
|
2416
|
+
R((t) => {
|
|
2417
|
+
let n = new Set(t), r = I.map((e) => e.id);
|
|
2336
2418
|
for (let t of r) e.includes(t) || n.delete(t);
|
|
2337
2419
|
for (let t of e) n.add(t);
|
|
2338
2420
|
return n;
|
|
2339
2421
|
});
|
|
2340
|
-
}, [
|
|
2341
|
-
if (!(
|
|
2342
|
-
|
|
2422
|
+
}, [I]), Se = a(async () => {
|
|
2423
|
+
if (!(L <= 0)) {
|
|
2424
|
+
z(!0);
|
|
2343
2425
|
try {
|
|
2344
2426
|
let t = y.sort.length === 0 ? void 0 : y.sort.length === 1 ? y.sort[0] : y.sort, n = await x.getList(e, {
|
|
2345
2427
|
pagination: {
|
|
2346
2428
|
page: 1,
|
|
2347
|
-
perPage:
|
|
2429
|
+
perPage: L
|
|
2348
2430
|
},
|
|
2349
2431
|
sort: t,
|
|
2350
2432
|
filter: y.filter
|
|
2351
2433
|
});
|
|
2352
|
-
|
|
2434
|
+
R(new Set(n.data.map((e) => e.id)));
|
|
2353
2435
|
} catch (e) {
|
|
2354
2436
|
E.error(e instanceof Error ? e.message : "Load failed");
|
|
2355
2437
|
} finally {
|
|
2356
|
-
|
|
2438
|
+
z(!1);
|
|
2357
2439
|
}
|
|
2358
2440
|
}
|
|
2359
2441
|
}, [
|
|
2360
2442
|
x,
|
|
2361
2443
|
e,
|
|
2362
|
-
|
|
2444
|
+
L,
|
|
2363
2445
|
y.sort,
|
|
2364
2446
|
y.filter,
|
|
2365
2447
|
E
|
|
@@ -2395,18 +2477,18 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2395
2477
|
filter: y.filter
|
|
2396
2478
|
};
|
|
2397
2479
|
}, [y]), Y = a(async (t) => {
|
|
2398
|
-
|
|
2480
|
+
F(!0);
|
|
2399
2481
|
try {
|
|
2400
2482
|
let n = await x.getList(e, {
|
|
2401
2483
|
...we,
|
|
2402
2484
|
signal: t
|
|
2403
2485
|
});
|
|
2404
2486
|
if (t?.aborted) return;
|
|
2405
|
-
|
|
2487
|
+
te(n.data), ne(n.total);
|
|
2406
2488
|
} catch (e) {
|
|
2407
|
-
|
|
2489
|
+
$t(e) || E.error(e instanceof Error ? e.message : "Load failed");
|
|
2408
2490
|
} finally {
|
|
2409
|
-
t?.aborted ||
|
|
2491
|
+
t?.aborted || F(!1);
|
|
2410
2492
|
}
|
|
2411
2493
|
}, [
|
|
2412
2494
|
x,
|
|
@@ -2414,7 +2496,7 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2414
2496
|
we,
|
|
2415
2497
|
E
|
|
2416
2498
|
]);
|
|
2417
|
-
|
|
2499
|
+
zr((e) => Y(e), [Y]);
|
|
2418
2500
|
let Te = l(() => ({
|
|
2419
2501
|
reload: () => void Y(),
|
|
2420
2502
|
clearSelection: me
|
|
@@ -2430,13 +2512,13 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2430
2512
|
});
|
|
2431
2513
|
})) return;
|
|
2432
2514
|
}
|
|
2433
|
-
|
|
2515
|
+
z(!0);
|
|
2434
2516
|
try {
|
|
2435
2517
|
await e.execute(t, Te);
|
|
2436
2518
|
} catch (e) {
|
|
2437
2519
|
E.error(e instanceof Error ? e.message : "Action failed");
|
|
2438
2520
|
} finally {
|
|
2439
|
-
|
|
2521
|
+
z(!1);
|
|
2440
2522
|
}
|
|
2441
2523
|
}, [
|
|
2442
2524
|
Te,
|
|
@@ -2458,7 +2540,7 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2458
2540
|
let e = k.map((e) => {
|
|
2459
2541
|
let t = e.buildColumn();
|
|
2460
2542
|
if (e.sortable) {
|
|
2461
|
-
let n =
|
|
2543
|
+
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
2544
|
style: {
|
|
2463
2545
|
display: "inline-flex",
|
|
2464
2546
|
alignItems: "center",
|
|
@@ -2475,7 +2557,7 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2475
2557
|
textAlign: "center"
|
|
2476
2558
|
},
|
|
2477
2559
|
children: r
|
|
2478
|
-
}), q(i === "ascend" ?
|
|
2560
|
+
}), q(i === "ascend" ? pe : fe, { style: { fontSize: 11 } })]
|
|
2479
2561
|
});
|
|
2480
2562
|
return {
|
|
2481
2563
|
...t,
|
|
@@ -2486,9 +2568,9 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2486
2568
|
}
|
|
2487
2569
|
return t;
|
|
2488
2570
|
});
|
|
2489
|
-
if (!
|
|
2490
|
-
showEdit:
|
|
2491
|
-
showQuickEdit:
|
|
2571
|
+
if (!de) return ei(e, {
|
|
2572
|
+
showEdit: le,
|
|
2573
|
+
showQuickEdit: U,
|
|
2492
2574
|
pathPrefix: n,
|
|
2493
2575
|
openEditModal: b.openEditModal
|
|
2494
2576
|
});
|
|
@@ -2499,15 +2581,15 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2499
2581
|
title: "Actions",
|
|
2500
2582
|
key: "__actions",
|
|
2501
2583
|
width: i === "both" ? 200 : 160,
|
|
2502
|
-
render: (e, r) => /* @__PURE__ */ J(
|
|
2584
|
+
render: (e, r) => /* @__PURE__ */ J(B, {
|
|
2503
2585
|
size: "small",
|
|
2504
2586
|
wrap: !0,
|
|
2505
2587
|
children: [
|
|
2506
|
-
|
|
2588
|
+
le ? /* @__PURE__ */ q(f, {
|
|
2507
2589
|
to: `${n}/${String(r.id)}`,
|
|
2508
2590
|
children: "Edit"
|
|
2509
2591
|
}) : null,
|
|
2510
|
-
|
|
2592
|
+
U ? /* @__PURE__ */ q(w, {
|
|
2511
2593
|
type: "link",
|
|
2512
2594
|
size: "small",
|
|
2513
2595
|
style: { padding: 0 },
|
|
@@ -2526,23 +2608,23 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2526
2608
|
]
|
|
2527
2609
|
})
|
|
2528
2610
|
};
|
|
2529
|
-
return
|
|
2530
|
-
showEdit:
|
|
2531
|
-
showQuickEdit:
|
|
2611
|
+
return ei([...e, r], {
|
|
2612
|
+
showEdit: le,
|
|
2613
|
+
showQuickEdit: U,
|
|
2532
2614
|
pathPrefix: n,
|
|
2533
2615
|
openEditModal: b.openEditModal
|
|
2534
2616
|
});
|
|
2535
2617
|
}, [
|
|
2536
2618
|
k,
|
|
2537
|
-
|
|
2538
|
-
U,
|
|
2619
|
+
de,
|
|
2539
2620
|
le,
|
|
2621
|
+
U,
|
|
2540
2622
|
ue,
|
|
2541
2623
|
i,
|
|
2542
2624
|
n,
|
|
2543
2625
|
De,
|
|
2544
|
-
ee,
|
|
2545
2626
|
A,
|
|
2627
|
+
j,
|
|
2546
2628
|
b,
|
|
2547
2629
|
p,
|
|
2548
2630
|
Y
|
|
@@ -2563,7 +2645,7 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2563
2645
|
style: { margin: 0 },
|
|
2564
2646
|
children: t
|
|
2565
2647
|
}),
|
|
2566
|
-
extra: m || V ? /* @__PURE__ */ J(
|
|
2648
|
+
extra: m || V ? /* @__PURE__ */ J(B, { children: [m, V ? i === "modal" || i === "both" ? /* @__PURE__ */ J(K, { children: [i === "both" ? /* @__PURE__ */ q(f, {
|
|
2567
2649
|
to: oe,
|
|
2568
2650
|
children: /* @__PURE__ */ q(w, { children: "New page" })
|
|
2569
2651
|
}) : null, /* @__PURE__ */ q(w, {
|
|
@@ -2577,32 +2659,32 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2577
2659
|
children: "New"
|
|
2578
2660
|
})
|
|
2579
2661
|
}) : null] }) : null,
|
|
2580
|
-
children: [ge ? /* @__PURE__ */ q(
|
|
2662
|
+
children: [ge ? /* @__PURE__ */ q(Wr, {
|
|
2581
2663
|
selectedCount: _e,
|
|
2582
|
-
total:
|
|
2664
|
+
total: L,
|
|
2583
2665
|
allPageSelected: ve,
|
|
2584
2666
|
allMatchingSelected: ye,
|
|
2585
2667
|
onSelectAllMatching: () => void Se(),
|
|
2586
2668
|
onClearSelection: me,
|
|
2587
2669
|
actions: he,
|
|
2588
2670
|
onExecute: Ee,
|
|
2589
|
-
selectedIds: [...
|
|
2590
|
-
running:
|
|
2671
|
+
selectedIds: [...ie],
|
|
2672
|
+
running: ae || P
|
|
2591
2673
|
}) : null, /* @__PURE__ */ J("div", {
|
|
2592
|
-
ref:
|
|
2674
|
+
ref: M,
|
|
2593
2675
|
className: "ding-admin-resource-list-table",
|
|
2594
2676
|
style: {
|
|
2595
2677
|
"--ding-scroll-thumb": O.colorTextQuaternary,
|
|
2596
2678
|
"--ding-scroll-thumb-hover": O.colorTextTertiary
|
|
2597
2679
|
},
|
|
2598
|
-
children: [/* @__PURE__ */ q(
|
|
2680
|
+
children: [/* @__PURE__ */ q(ce, {
|
|
2599
2681
|
rowKey: "id",
|
|
2600
|
-
loading:
|
|
2682
|
+
loading: P,
|
|
2601
2683
|
columns: Oe,
|
|
2602
|
-
dataSource:
|
|
2684
|
+
dataSource: I,
|
|
2603
2685
|
scroll: {
|
|
2604
2686
|
x: "max-content",
|
|
2605
|
-
...
|
|
2687
|
+
...ee ? { y: ee } : {}
|
|
2606
2688
|
},
|
|
2607
2689
|
rowSelection: ge ? {
|
|
2608
2690
|
selectedRowKeys: be,
|
|
@@ -2618,13 +2700,13 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2618
2700
|
children: /* @__PURE__ */ q(re, {
|
|
2619
2701
|
current: y.page,
|
|
2620
2702
|
pageSize: y.perPage,
|
|
2621
|
-
total:
|
|
2703
|
+
total: L,
|
|
2622
2704
|
showSizeChanger: !0,
|
|
2623
2705
|
onChange: ke
|
|
2624
2706
|
})
|
|
2625
2707
|
})]
|
|
2626
2708
|
})]
|
|
2627
|
-
}), Ae ? /* @__PURE__ */ q(
|
|
2709
|
+
}), Ae ? /* @__PURE__ */ q(Ur, {
|
|
2628
2710
|
resource: e,
|
|
2629
2711
|
editId: y.createModal ? "new" : y.editId,
|
|
2630
2712
|
onClose: () => {
|
|
@@ -2633,8 +2715,8 @@ function Qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2633
2715
|
children: o
|
|
2634
2716
|
}) : null] });
|
|
2635
2717
|
}
|
|
2636
|
-
function
|
|
2637
|
-
let [y, b] =
|
|
2718
|
+
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 }) {
|
|
2719
|
+
let [y, b] = Xr(i), x = l(() => {
|
|
2638
2720
|
if (!c) return i ?? {};
|
|
2639
2721
|
let e = {};
|
|
2640
2722
|
for (let [t, n] of Object.entries(y.filter)) i && t in i || (e[t] = n);
|
|
@@ -2649,18 +2731,18 @@ function $r({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2649
2731
|
filterValues: x,
|
|
2650
2732
|
setFilterValue: S
|
|
2651
2733
|
}), [x, S]);
|
|
2652
|
-
return /* @__PURE__ */ q(
|
|
2734
|
+
return /* @__PURE__ */ q(Zr.Provider, {
|
|
2653
2735
|
value: C,
|
|
2654
|
-
children: /* @__PURE__ */ q(
|
|
2736
|
+
children: /* @__PURE__ */ q(tr, {
|
|
2655
2737
|
values: x,
|
|
2656
2738
|
setFilterValue: S,
|
|
2657
2739
|
textFilterDebounceMs: o,
|
|
2658
|
-
children: /* @__PURE__ */ q(
|
|
2740
|
+
children: /* @__PURE__ */ q(Kn, {
|
|
2659
2741
|
toggleSort: b.toggleSort,
|
|
2660
2742
|
sort: y.sort,
|
|
2661
2743
|
children: /* @__PURE__ */ J("div", {
|
|
2662
2744
|
className: "ding-admin-resource-list-root",
|
|
2663
|
-
children: [u, /* @__PURE__ */ q(
|
|
2745
|
+
children: [u, /* @__PURE__ */ q(ti, {
|
|
2664
2746
|
resource: e,
|
|
2665
2747
|
title: t,
|
|
2666
2748
|
pathPrefix: n,
|
|
@@ -2684,13 +2766,13 @@ function $r({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2684
2766
|
}
|
|
2685
2767
|
//#endregion
|
|
2686
2768
|
//#region src/crud/FilterBar.tsx
|
|
2687
|
-
function
|
|
2688
|
-
let e =
|
|
2689
|
-
return !e || e.filters.length === 0 ? null : /* @__PURE__ */ q(
|
|
2769
|
+
function ri() {
|
|
2770
|
+
let e = nr();
|
|
2771
|
+
return !e || e.filters.length === 0 ? null : /* @__PURE__ */ q(B, {
|
|
2690
2772
|
wrap: !0,
|
|
2691
2773
|
size: "middle",
|
|
2692
2774
|
style: { marginBottom: 16 },
|
|
2693
|
-
children: e.filters.map((t) => /* @__PURE__ */ J(
|
|
2775
|
+
children: e.filters.map((t) => /* @__PURE__ */ J(B, {
|
|
2694
2776
|
orientation: "vertical",
|
|
2695
2777
|
size: 2,
|
|
2696
2778
|
children: [t.label ? /* @__PURE__ */ q(W.Text, {
|
|
@@ -2704,12 +2786,12 @@ function ei() {
|
|
|
2704
2786
|
}, t.key))
|
|
2705
2787
|
});
|
|
2706
2788
|
}
|
|
2707
|
-
function
|
|
2708
|
-
return /* @__PURE__ */ J(K, { children: [e, /* @__PURE__ */ q(
|
|
2789
|
+
function ii({ children: e }) {
|
|
2790
|
+
return /* @__PURE__ */ J(K, { children: [e, /* @__PURE__ */ q(ri, {})] });
|
|
2709
2791
|
}
|
|
2710
2792
|
//#endregion
|
|
2711
2793
|
//#region src/crud/ResourceForm.tsx
|
|
2712
|
-
function
|
|
2794
|
+
function ai({ resource: e, title: t, listPath: n, children: r, defaultValues: i, onSaved: a, stayOnPage: o, permissions: c }) {
|
|
2713
2795
|
let { id: l } = y(), u = l === "new" || !l, d = X(), p = v(), { token: m } = G.useToken();
|
|
2714
2796
|
s(() => {
|
|
2715
2797
|
c && (Z(d, c, u ? "add" : "change") || p(n, { replace: !0 }));
|
|
@@ -2722,16 +2804,16 @@ function ni({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2722
2804
|
]);
|
|
2723
2805
|
let h = c ? Z(d, c, u ? "add" : "change") : !0;
|
|
2724
2806
|
return /* @__PURE__ */ q(T, {
|
|
2725
|
-
title: /* @__PURE__ */ J(
|
|
2807
|
+
title: /* @__PURE__ */ J(B, { children: [/* @__PURE__ */ J(f, {
|
|
2726
2808
|
to: n,
|
|
2727
2809
|
style: { color: m.colorText },
|
|
2728
|
-
children: [/* @__PURE__ */ q(
|
|
2810
|
+
children: [/* @__PURE__ */ q(de, {}), " Back"]
|
|
2729
2811
|
}), /* @__PURE__ */ q(W.Title, {
|
|
2730
2812
|
level: 5,
|
|
2731
2813
|
style: { margin: 0 },
|
|
2732
2814
|
children: t
|
|
2733
2815
|
})] }),
|
|
2734
|
-
children: /* @__PURE__ */ q(
|
|
2816
|
+
children: /* @__PURE__ */ q(Hr, {
|
|
2735
2817
|
resource: e,
|
|
2736
2818
|
id: l,
|
|
2737
2819
|
defaultValues: i,
|
|
@@ -2747,18 +2829,18 @@ function ni({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2747
2829
|
}
|
|
2748
2830
|
//#endregion
|
|
2749
2831
|
//#region src/crud/utils/nestedFieldPath.ts
|
|
2750
|
-
function
|
|
2832
|
+
function oi(e, t, n) {
|
|
2751
2833
|
return `${e}.${t}.${n}`;
|
|
2752
2834
|
}
|
|
2753
2835
|
//#endregion
|
|
2754
2836
|
//#region src/crud/InlineFormSet.tsx
|
|
2755
|
-
function
|
|
2837
|
+
function si(e, t) {
|
|
2756
2838
|
let n = {};
|
|
2757
2839
|
for (let r of e) n[r] = t?.[r] ?? void 0;
|
|
2758
2840
|
return n;
|
|
2759
2841
|
}
|
|
2760
|
-
function
|
|
2761
|
-
let { control: r } =
|
|
2842
|
+
function ci(e, t, n) {
|
|
2843
|
+
let { control: r } = Me(), { fields: i, append: a, remove: o } = Ae({
|
|
2762
2844
|
control: r,
|
|
2763
2845
|
name: e,
|
|
2764
2846
|
keyName: "rowKey"
|
|
@@ -2766,12 +2848,12 @@ function ai(e, t, n) {
|
|
|
2766
2848
|
return {
|
|
2767
2849
|
fields: i,
|
|
2768
2850
|
remove: o,
|
|
2769
|
-
appendEmpty: () => a(
|
|
2851
|
+
appendEmpty: () => a(si(t, n))
|
|
2770
2852
|
};
|
|
2771
2853
|
}
|
|
2772
|
-
function
|
|
2773
|
-
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } =
|
|
2774
|
-
|
|
2854
|
+
function li({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, defaultRow: a }) {
|
|
2855
|
+
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } = ci(e, o, a);
|
|
2856
|
+
pr(e), vr(e, o, n, r);
|
|
2775
2857
|
let d = l(() => i.map((t) => ({
|
|
2776
2858
|
title: t.label ?? t.source,
|
|
2777
2859
|
key: t.source,
|
|
@@ -2779,7 +2861,7 @@ function oi({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2779
2861
|
onHeaderCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2780
2862
|
onCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2781
2863
|
render: (n, r, i) => t.cell({
|
|
2782
|
-
name:
|
|
2864
|
+
name: oi(e, i, t.source),
|
|
2783
2865
|
index: i,
|
|
2784
2866
|
field: e
|
|
2785
2867
|
})
|
|
@@ -2791,7 +2873,7 @@ function oi({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2791
2873
|
level: 5,
|
|
2792
2874
|
children: t ?? "Related items"
|
|
2793
2875
|
}),
|
|
2794
|
-
/* @__PURE__ */ q(
|
|
2876
|
+
/* @__PURE__ */ q(ce, {
|
|
2795
2877
|
size: "small",
|
|
2796
2878
|
pagination: !1,
|
|
2797
2879
|
scroll: { x: "max-content" },
|
|
@@ -2821,16 +2903,16 @@ function oi({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2821
2903
|
]
|
|
2822
2904
|
});
|
|
2823
2905
|
}
|
|
2824
|
-
function
|
|
2825
|
-
let { fields: l, remove: u, appendEmpty: d } =
|
|
2826
|
-
return
|
|
2906
|
+
function ui({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, renderRow: a, getCardTitle: o, footer: s, defaultRow: c }) {
|
|
2907
|
+
let { fields: l, remove: u, appendEmpty: d } = ci(e, i, c);
|
|
2908
|
+
return pr(e), vr(e, i, n, r), /* @__PURE__ */ J("div", {
|
|
2827
2909
|
style: { marginTop: 24 },
|
|
2828
2910
|
children: [
|
|
2829
2911
|
/* @__PURE__ */ q(W.Title, {
|
|
2830
2912
|
level: 5,
|
|
2831
2913
|
children: t ?? "Related items"
|
|
2832
2914
|
}),
|
|
2833
|
-
/* @__PURE__ */ q(
|
|
2915
|
+
/* @__PURE__ */ q(B, {
|
|
2834
2916
|
orientation: "vertical",
|
|
2835
2917
|
size: "middle",
|
|
2836
2918
|
style: { width: "100%" },
|
|
@@ -2838,7 +2920,7 @@ function si({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2838
2920
|
let r = {
|
|
2839
2921
|
field: e,
|
|
2840
2922
|
index: n,
|
|
2841
|
-
name: (t) =>
|
|
2923
|
+
name: (t) => oi(e, n, t)
|
|
2842
2924
|
};
|
|
2843
2925
|
return /* @__PURE__ */ q(T, {
|
|
2844
2926
|
size: "small",
|
|
@@ -2866,22 +2948,22 @@ function si({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2866
2948
|
}
|
|
2867
2949
|
//#endregion
|
|
2868
2950
|
//#region src/crud/utils/formSectionErrors.ts
|
|
2869
|
-
function
|
|
2951
|
+
function di(e, t, n) {
|
|
2870
2952
|
for (let r of e) if (t(r, n).invalid) return !0;
|
|
2871
2953
|
return !1;
|
|
2872
2954
|
}
|
|
2873
|
-
function
|
|
2955
|
+
function fi(e) {
|
|
2874
2956
|
let t = u([]);
|
|
2875
2957
|
for (; t.current.length < e;) t.current.push({ current: /* @__PURE__ */ new Set() });
|
|
2876
2958
|
return t.current.length > e && (t.current.length = e), t.current;
|
|
2877
2959
|
}
|
|
2878
|
-
function
|
|
2879
|
-
let { control: n, getFieldState: r, setFocus: i } =
|
|
2960
|
+
function pi(e, t) {
|
|
2961
|
+
let { control: n, getFieldState: r, setFocus: i } = Me(), a = Ne({ control: n }), o = u(0), c = u(0);
|
|
2880
2962
|
s(() => {
|
|
2881
2963
|
if (a.submitCount === 0) return;
|
|
2882
2964
|
let n = Object.keys(a.errors).length, s = a.submitCount !== o.current, l = !s && n > 0 && c.current === 0;
|
|
2883
2965
|
if (o.current = a.submitCount, c.current = n, !s && !l || n === 0) return;
|
|
2884
|
-
let u = e.findIndex((e) =>
|
|
2966
|
+
let u = e.findIndex((e) => di(e.current, r, a));
|
|
2885
2967
|
if (u < 0) return;
|
|
2886
2968
|
t(u);
|
|
2887
2969
|
let d = [...e[u].current].find((e) => r(e, a).invalid);
|
|
@@ -2900,30 +2982,30 @@ function ui(e, t) {
|
|
|
2900
2982
|
}
|
|
2901
2983
|
//#endregion
|
|
2902
2984
|
//#region src/crud/FormTabs.tsx
|
|
2903
|
-
function
|
|
2985
|
+
function mi(e) {
|
|
2904
2986
|
return null;
|
|
2905
2987
|
}
|
|
2906
|
-
function
|
|
2907
|
-
return i(e) && e.type ===
|
|
2988
|
+
function hi(e) {
|
|
2989
|
+
return i(e) && e.type === mi;
|
|
2908
2990
|
}
|
|
2909
|
-
function
|
|
2910
|
-
let { token: s } = G.useToken(), c = l(() => e.toArray(t).filter(
|
|
2991
|
+
function gi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o }) {
|
|
2992
|
+
let { token: s } = G.useToken(), c = l(() => e.toArray(t).filter(hi).map((e, t) => ({
|
|
2911
2993
|
key: e.key ?? String(t),
|
|
2912
2994
|
label: e.props.label,
|
|
2913
2995
|
disabled: e.props.disabled,
|
|
2914
2996
|
children: e.props.children
|
|
2915
|
-
})), [t]), u =
|
|
2997
|
+
})), [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
2998
|
f || m(e), i?.(e);
|
|
2917
2999
|
}, [f, i]);
|
|
2918
|
-
|
|
3000
|
+
pi(u, a((e) => {
|
|
2919
3001
|
let t = c[e]?.key;
|
|
2920
3002
|
t != null && g(t);
|
|
2921
3003
|
}, [g, c]));
|
|
2922
|
-
let { control: _, getFieldState: v } =
|
|
2923
|
-
return /* @__PURE__ */ q(
|
|
3004
|
+
let { control: _, getFieldState: v } = Me(), y = Ne({ control: _ });
|
|
3005
|
+
return /* @__PURE__ */ q(H, {
|
|
2924
3006
|
destroyOnHidden: !1,
|
|
2925
3007
|
items: l(() => c.map((e, t) => {
|
|
2926
|
-
let n =
|
|
3008
|
+
let n = di(u[t].current, v, y);
|
|
2927
3009
|
return {
|
|
2928
3010
|
key: e.key,
|
|
2929
3011
|
label: n ? /* @__PURE__ */ q("span", {
|
|
@@ -2931,7 +3013,7 @@ function pi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
2931
3013
|
children: e.label
|
|
2932
3014
|
}) : e.label,
|
|
2933
3015
|
disabled: e.disabled,
|
|
2934
|
-
children: /* @__PURE__ */ q(
|
|
3016
|
+
children: /* @__PURE__ */ q(cr, {
|
|
2935
3017
|
sourcesRef: u[t],
|
|
2936
3018
|
children: e.children
|
|
2937
3019
|
})
|
|
@@ -2950,17 +3032,17 @@ function pi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
2950
3032
|
}
|
|
2951
3033
|
//#endregion
|
|
2952
3034
|
//#region src/crud/FormSteps.tsx
|
|
2953
|
-
function
|
|
3035
|
+
function _i(e) {
|
|
2954
3036
|
return null;
|
|
2955
3037
|
}
|
|
2956
|
-
function
|
|
2957
|
-
return i(e) && e.type ===
|
|
3038
|
+
function vi(e) {
|
|
3039
|
+
return i(e) && e.type === _i;
|
|
2958
3040
|
}
|
|
2959
|
-
function
|
|
2960
|
-
let m = l(() => e.toArray(t).filter(
|
|
2961
|
-
|
|
2962
|
-
let { control: y, getFieldState: b } =
|
|
2963
|
-
let n =
|
|
3041
|
+
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 }) {
|
|
3042
|
+
let m = l(() => e.toArray(t).filter(vi), [t]), h = fi(m.length), [g, _] = d(n), v = m.length - 1;
|
|
3043
|
+
pi(h, _);
|
|
3044
|
+
let { control: y, getFieldState: b } = Me(), x = Ne({ control: y }), S = l(() => m.map((e, t) => {
|
|
3045
|
+
let n = di(h[t].current, b, x);
|
|
2964
3046
|
return {
|
|
2965
3047
|
title: e.props.title,
|
|
2966
3048
|
description: e.props.description,
|
|
@@ -2975,7 +3057,7 @@ function gi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
2975
3057
|
_(e);
|
|
2976
3058
|
}, []);
|
|
2977
3059
|
return /* @__PURE__ */ J(K, { children: [
|
|
2978
|
-
/* @__PURE__ */ q(
|
|
3060
|
+
/* @__PURE__ */ q(V, {
|
|
2979
3061
|
current: g,
|
|
2980
3062
|
items: S,
|
|
2981
3063
|
style: {
|
|
@@ -2990,12 +3072,12 @@ function gi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
2990
3072
|
}),
|
|
2991
3073
|
m.map((e, t) => /* @__PURE__ */ q("div", {
|
|
2992
3074
|
style: { display: g === t ? void 0 : "none" },
|
|
2993
|
-
children: /* @__PURE__ */ q(
|
|
3075
|
+
children: /* @__PURE__ */ q(cr, {
|
|
2994
3076
|
sourcesRef: h[t],
|
|
2995
3077
|
children: e.props.children
|
|
2996
3078
|
})
|
|
2997
3079
|
}, e.key ?? String(t))),
|
|
2998
|
-
r && m.length > 1 ? /* @__PURE__ */ J(
|
|
3080
|
+
r && m.length > 1 ? /* @__PURE__ */ J(B, {
|
|
2999
3081
|
style: {
|
|
3000
3082
|
marginTop: 16,
|
|
3001
3083
|
...s
|
|
@@ -3016,15 +3098,15 @@ function gi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
3016
3098
|
//#endregion
|
|
3017
3099
|
//#region src/crud/fields/FieldWrapper.tsx
|
|
3018
3100
|
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
|
|
3101
|
+
let s = t ?? e, c = !s.includes("."), { control: l } = Me(), u = or(), d = a ? void 0 : n ?? e, f = n ?? e;
|
|
3102
|
+
return pr(e, c), mr(e, c), /* @__PURE__ */ q(Oe, {
|
|
3021
3103
|
name: s,
|
|
3022
3104
|
control: l,
|
|
3023
3105
|
rules: {
|
|
3024
3106
|
required: r ? `${f} is required` : !1,
|
|
3025
3107
|
...i
|
|
3026
3108
|
},
|
|
3027
|
-
render: ({ field: e, fieldState: t }) => /* @__PURE__ */ q(
|
|
3109
|
+
render: ({ field: e, fieldState: t }) => /* @__PURE__ */ q(M.Item, {
|
|
3028
3110
|
label: d,
|
|
3029
3111
|
validateStatus: t.error ? "error" : void 0,
|
|
3030
3112
|
help: t.error?.message,
|
|
@@ -3042,7 +3124,7 @@ function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3042
3124
|
}
|
|
3043
3125
|
//#endregion
|
|
3044
3126
|
//#region src/crud/fields/TextField.tsx
|
|
3045
|
-
function
|
|
3127
|
+
function bi({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s }) {
|
|
3046
3128
|
return /* @__PURE__ */ q($, {
|
|
3047
3129
|
source: e,
|
|
3048
3130
|
name: t,
|
|
@@ -3050,7 +3132,7 @@ function _i({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3050
3132
|
required: r,
|
|
3051
3133
|
rules: i,
|
|
3052
3134
|
hideLabel: s,
|
|
3053
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(
|
|
3135
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(P, {
|
|
3054
3136
|
value: e,
|
|
3055
3137
|
onChange: (e) => t(e.target.value),
|
|
3056
3138
|
onBlur: n,
|
|
@@ -3062,7 +3144,7 @@ function _i({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3062
3144
|
}
|
|
3063
3145
|
//#endregion
|
|
3064
3146
|
//#region src/crud/fields/TextAreaField.tsx
|
|
3065
|
-
function
|
|
3147
|
+
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
3148
|
return /* @__PURE__ */ q($, {
|
|
3067
3149
|
source: e,
|
|
3068
3150
|
name: t,
|
|
@@ -3070,7 +3152,7 @@ function vi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3070
3152
|
required: r,
|
|
3071
3153
|
rules: i,
|
|
3072
3154
|
hideLabel: s,
|
|
3073
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(
|
|
3155
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(P.TextArea, {
|
|
3074
3156
|
value: e,
|
|
3075
3157
|
onChange: (e) => t(e.target.value),
|
|
3076
3158
|
onBlur: n,
|
|
@@ -3086,7 +3168,7 @@ function vi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3086
3168
|
}
|
|
3087
3169
|
//#endregion
|
|
3088
3170
|
//#region src/crud/fields/NumberField.tsx
|
|
3089
|
-
function
|
|
3171
|
+
function Si({ source: e, name: t, label: n, required: r, rules: i, min: a, max: o, step: s, inputStyle: c, hideLabel: l }) {
|
|
3090
3172
|
return /* @__PURE__ */ q($, {
|
|
3091
3173
|
source: e,
|
|
3092
3174
|
name: t,
|
|
@@ -3094,7 +3176,7 @@ function yi({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3094
3176
|
required: r,
|
|
3095
3177
|
rules: i,
|
|
3096
3178
|
hideLabel: l,
|
|
3097
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(
|
|
3179
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(F, {
|
|
3098
3180
|
value: e,
|
|
3099
3181
|
onChange: (e) => t(e),
|
|
3100
3182
|
onBlur: n,
|
|
@@ -3111,7 +3193,7 @@ function yi({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3111
3193
|
}
|
|
3112
3194
|
//#endregion
|
|
3113
3195
|
//#region src/crud/fields/BooleanField.tsx
|
|
3114
|
-
function
|
|
3196
|
+
function Ci({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, disabled: o }) {
|
|
3115
3197
|
return /* @__PURE__ */ q($, {
|
|
3116
3198
|
source: e,
|
|
3117
3199
|
name: t,
|
|
@@ -3119,7 +3201,7 @@ function bi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3119
3201
|
required: r,
|
|
3120
3202
|
rules: i,
|
|
3121
3203
|
hideLabel: a,
|
|
3122
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(
|
|
3204
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(se, {
|
|
3123
3205
|
checked: !!e,
|
|
3124
3206
|
onChange: t,
|
|
3125
3207
|
disabled: n || o
|
|
@@ -3128,7 +3210,7 @@ function bi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3128
3210
|
}
|
|
3129
3211
|
//#endregion
|
|
3130
3212
|
//#region src/crud/utils/parseDayjsValue.ts
|
|
3131
|
-
var
|
|
3213
|
+
var wi = /* @__PURE__ */ We((/* @__PURE__ */ He(((e, t) => {
|
|
3132
3214
|
(function(n, r) {
|
|
3133
3215
|
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
3216
|
})(e, (function() {
|
|
@@ -3285,22 +3367,22 @@ var xi = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
|
3285
3367
|
};
|
|
3286
3368
|
}));
|
|
3287
3369
|
})))(), 1);
|
|
3288
|
-
|
|
3289
|
-
function
|
|
3370
|
+
Fe.extend(wi.default);
|
|
3371
|
+
function Ti(e, t) {
|
|
3290
3372
|
if (e == null || e === "") return null;
|
|
3291
|
-
if (
|
|
3292
|
-
let n =
|
|
3293
|
-
return n.isValid() ? n :
|
|
3373
|
+
if (Fe.isDayjs(e)) return e;
|
|
3374
|
+
let n = Fe(String(e), t, !0);
|
|
3375
|
+
return n.isValid() ? n : Fe(String(e)).isValid() ? Fe(String(e)) : null;
|
|
3294
3376
|
}
|
|
3295
3377
|
//#endregion
|
|
3296
3378
|
//#region src/crud/fields/DateField.tsx
|
|
3297
|
-
var
|
|
3298
|
-
|
|
3299
|
-
|
|
3379
|
+
var Ei = "YYYY-MM-DD", Di = `${Ei} HH:mm:ss`, Oi = [
|
|
3380
|
+
Ei,
|
|
3381
|
+
Di,
|
|
3300
3382
|
"YYYY-MM-DDTHH:mm:ss",
|
|
3301
3383
|
"YYYY-MM-DDTHH:mm:ssZ"
|
|
3302
3384
|
];
|
|
3303
|
-
function
|
|
3385
|
+
function ki({ source: e, name: t, label: n, required: r, rules: i, showTime: a, hideLabel: o }) {
|
|
3304
3386
|
return /* @__PURE__ */ q($, {
|
|
3305
3387
|
source: e,
|
|
3306
3388
|
name: t,
|
|
@@ -3309,33 +3391,33 @@ function Ei({ source: e, name: t, label: n, required: r, rules: i, showTime: a,
|
|
|
3309
3391
|
rules: i,
|
|
3310
3392
|
hideLabel: o,
|
|
3311
3393
|
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(O, {
|
|
3312
|
-
value:
|
|
3313
|
-
onChange: (e) => t(e ? e.format(a ?
|
|
3394
|
+
value: Ti(e, a ? [...Oi, Di] : Oi),
|
|
3395
|
+
onChange: (e) => t(e ? e.format(a ? Di : Ei) : null),
|
|
3314
3396
|
onBlur: n,
|
|
3315
3397
|
showTime: a,
|
|
3316
3398
|
disabled: r,
|
|
3317
|
-
format: a ?
|
|
3399
|
+
format: a ? Di : Ei,
|
|
3318
3400
|
style: { width: "100%" }
|
|
3319
3401
|
})
|
|
3320
3402
|
});
|
|
3321
3403
|
}
|
|
3322
3404
|
//#endregion
|
|
3323
3405
|
//#region src/crud/fields/DateTimeField.tsx
|
|
3324
|
-
function
|
|
3325
|
-
return /* @__PURE__ */ q(
|
|
3406
|
+
function Ai(e) {
|
|
3407
|
+
return /* @__PURE__ */ q(ki, {
|
|
3326
3408
|
showTime: !0,
|
|
3327
3409
|
...e
|
|
3328
3410
|
});
|
|
3329
3411
|
}
|
|
3330
3412
|
//#endregion
|
|
3331
3413
|
//#region src/crud/fields/TimeField.tsx
|
|
3332
|
-
var
|
|
3333
|
-
|
|
3414
|
+
var ji = "HH:mm:ss", Mi = [
|
|
3415
|
+
ji,
|
|
3334
3416
|
"HH:mm",
|
|
3335
3417
|
"H:mm:ss",
|
|
3336
3418
|
"H:mm"
|
|
3337
3419
|
];
|
|
3338
|
-
function
|
|
3420
|
+
function Ni({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, format: o = ji }) {
|
|
3339
3421
|
return /* @__PURE__ */ q($, {
|
|
3340
3422
|
source: e,
|
|
3341
3423
|
name: t,
|
|
@@ -3343,8 +3425,8 @@ function Ai({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3343
3425
|
required: r,
|
|
3344
3426
|
rules: i,
|
|
3345
3427
|
hideLabel: a,
|
|
3346
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(
|
|
3347
|
-
value:
|
|
3428
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(le, {
|
|
3429
|
+
value: Ti(e, Mi),
|
|
3348
3430
|
onChange: (e) => t(e ? e.format(o) : null),
|
|
3349
3431
|
onBlur: n,
|
|
3350
3432
|
disabled: r,
|
|
@@ -3355,7 +3437,7 @@ function Ai({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3355
3437
|
}
|
|
3356
3438
|
//#endregion
|
|
3357
3439
|
//#region src/crud/fields/SelectField.tsx
|
|
3358
|
-
function
|
|
3440
|
+
function Pi({ source: e, name: t, label: n, required: r, rules: i, choices: a, mode: o, allowClear: s, hideLabel: c }) {
|
|
3359
3441
|
return /* @__PURE__ */ q($, {
|
|
3360
3442
|
source: e,
|
|
3361
3443
|
name: t,
|
|
@@ -3363,7 +3445,7 @@ function ji({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3363
3445
|
required: r,
|
|
3364
3446
|
rules: i,
|
|
3365
3447
|
hideLabel: c,
|
|
3366
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(
|
|
3448
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(z, {
|
|
3367
3449
|
value: e,
|
|
3368
3450
|
onChange: t,
|
|
3369
3451
|
options: a,
|
|
@@ -3376,7 +3458,7 @@ function ji({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3376
3458
|
}
|
|
3377
3459
|
//#endregion
|
|
3378
3460
|
//#region src/crud/fields/PasswordField.tsx
|
|
3379
|
-
function
|
|
3461
|
+
function Fi({ source: e, name: t, label: n, required: r, rules: i, autoComplete: a, hideLabel: o }) {
|
|
3380
3462
|
return /* @__PURE__ */ q($, {
|
|
3381
3463
|
source: e,
|
|
3382
3464
|
name: t,
|
|
@@ -3384,7 +3466,7 @@ function Mi({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3384
3466
|
required: r,
|
|
3385
3467
|
rules: i,
|
|
3386
3468
|
hideLabel: o,
|
|
3387
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(
|
|
3469
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(P.Password, {
|
|
3388
3470
|
value: e,
|
|
3389
3471
|
onChange: (e) => t(e.target.value),
|
|
3390
3472
|
onBlur: n,
|
|
@@ -3393,12 +3475,12 @@ function Mi({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3393
3475
|
})
|
|
3394
3476
|
});
|
|
3395
3477
|
}
|
|
3396
|
-
function
|
|
3397
|
-
let l =
|
|
3478
|
+
function Ii({ source: e, name: t, label: n, required: r, rules: i, confirmSource: a, confirmLabel: o = "Confirm password", autoComplete: s = "new-password", hideLabel: c }) {
|
|
3479
|
+
let l = Pe({
|
|
3398
3480
|
name: t ?? e,
|
|
3399
3481
|
disabled: !a
|
|
3400
3482
|
});
|
|
3401
|
-
return a ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(
|
|
3483
|
+
return a ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(Fi, {
|
|
3402
3484
|
source: e,
|
|
3403
3485
|
name: t,
|
|
3404
3486
|
label: n,
|
|
@@ -3406,14 +3488,14 @@ function Ni({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3406
3488
|
rules: i,
|
|
3407
3489
|
autoComplete: s,
|
|
3408
3490
|
hideLabel: c
|
|
3409
|
-
}), /* @__PURE__ */ q(
|
|
3491
|
+
}), /* @__PURE__ */ q(Fi, {
|
|
3410
3492
|
source: a,
|
|
3411
3493
|
label: o,
|
|
3412
3494
|
required: r,
|
|
3413
3495
|
autoComplete: s,
|
|
3414
3496
|
hideLabel: c,
|
|
3415
3497
|
rules: { validate: (e) => !l || e === l || "Passwords do not match" }
|
|
3416
|
-
})] }) : /* @__PURE__ */ q(
|
|
3498
|
+
})] }) : /* @__PURE__ */ q(Fi, {
|
|
3417
3499
|
source: e,
|
|
3418
3500
|
name: t,
|
|
3419
3501
|
label: n,
|
|
@@ -3425,48 +3507,48 @@ function Ni({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3425
3507
|
}
|
|
3426
3508
|
//#endregion
|
|
3427
3509
|
//#region src/crud/utils/choiceSelectionUtils.ts
|
|
3428
|
-
function
|
|
3510
|
+
function Li(e, t) {
|
|
3429
3511
|
return typeof e == "object" && !!e && !Array.isArray(e) && t in e;
|
|
3430
3512
|
}
|
|
3431
|
-
function
|
|
3513
|
+
function Ri(e, t) {
|
|
3432
3514
|
if (!(e == null || e === "")) {
|
|
3433
|
-
if (
|
|
3515
|
+
if (Li(e, t)) {
|
|
3434
3516
|
let n = e[t];
|
|
3435
3517
|
return typeof n == "string" || typeof n == "number" ? n : void 0;
|
|
3436
3518
|
}
|
|
3437
3519
|
if (typeof e == "string" || typeof e == "number") return e;
|
|
3438
3520
|
}
|
|
3439
3521
|
}
|
|
3440
|
-
function
|
|
3441
|
-
return Array.isArray(e) ? e.map((e) =>
|
|
3522
|
+
function zi(e, t) {
|
|
3523
|
+
return Array.isArray(e) ? e.map((e) => Ri(e, t)).filter((e) => e != null) : [];
|
|
3442
3524
|
}
|
|
3443
|
-
function
|
|
3444
|
-
return e == null ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "").map((e) =>
|
|
3525
|
+
function Bi(e, t) {
|
|
3526
|
+
return e == null ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "").map((e) => Li(e, t) ? e[t] : e);
|
|
3445
3527
|
}
|
|
3446
|
-
function
|
|
3528
|
+
function Vi(e, t, n) {
|
|
3447
3529
|
let r = [];
|
|
3448
|
-
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) =>
|
|
3530
|
+
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
3531
|
let i = Array.isArray(e) ? e : [e];
|
|
3450
|
-
for (let e of i)
|
|
3532
|
+
for (let e of i) Li(e, n) && r.push(e);
|
|
3451
3533
|
return r;
|
|
3452
3534
|
}
|
|
3453
|
-
function
|
|
3535
|
+
function Hi(e, t) {
|
|
3454
3536
|
return typeof t == "function" ? t(e) : String(e[t] ?? "");
|
|
3455
3537
|
}
|
|
3456
|
-
function
|
|
3538
|
+
function Ui(e, t, n) {
|
|
3457
3539
|
return e.map((e) => ({
|
|
3458
|
-
label:
|
|
3540
|
+
label: Hi(e, t),
|
|
3459
3541
|
value: e[n],
|
|
3460
3542
|
record: e
|
|
3461
3543
|
}));
|
|
3462
3544
|
}
|
|
3463
|
-
function
|
|
3545
|
+
function Wi(e, t) {
|
|
3464
3546
|
let n = /* @__PURE__ */ new Map();
|
|
3465
3547
|
for (let t of e) n.set(t.value, t);
|
|
3466
3548
|
for (let e of t) n.set(e.value, e);
|
|
3467
3549
|
return Array.from(n.values());
|
|
3468
3550
|
}
|
|
3469
|
-
function
|
|
3551
|
+
function Gi(e = {}) {
|
|
3470
3552
|
let t = e.popupMatchSelectWidth ?? !1;
|
|
3471
3553
|
return t === !1 ? {
|
|
3472
3554
|
popupMatchSelectWidth: !1,
|
|
@@ -3475,16 +3557,16 @@ function Hi(e = {}) {
|
|
|
3475
3557
|
}
|
|
3476
3558
|
//#endregion
|
|
3477
3559
|
//#region src/crud/utils/referenceSelectNotFoundContent.tsx
|
|
3478
|
-
function
|
|
3479
|
-
return e ? /* @__PURE__ */ q(
|
|
3560
|
+
function Ki(e) {
|
|
3561
|
+
return e ? /* @__PURE__ */ q(oe, { size: "small" }) : void 0;
|
|
3480
3562
|
}
|
|
3481
3563
|
//#endregion
|
|
3482
3564
|
//#region src/crud/utils/useChoices.ts
|
|
3483
|
-
var
|
|
3484
|
-
function
|
|
3565
|
+
var qi = /* @__PURE__ */ new Map(), Ji = /* @__PURE__ */ new Map();
|
|
3566
|
+
function Yi(e, t) {
|
|
3485
3567
|
return typeof e == "function" ? `fn:${t ?? ""}` : Array.isArray(e) ? `static:${e.length}` : `res:${e.resource}:${JSON.stringify(e.filter ?? {})}:${t ?? ""}`;
|
|
3486
3568
|
}
|
|
3487
|
-
async function
|
|
3569
|
+
async function Xi(e, t, n, r, i) {
|
|
3488
3570
|
return typeof e == "function" ? e({
|
|
3489
3571
|
dataProvider: t,
|
|
3490
3572
|
search: i
|
|
@@ -3498,26 +3580,26 @@ async function qi(e, t, n, r, i) {
|
|
|
3498
3580
|
perPage: 500
|
|
3499
3581
|
}
|
|
3500
3582
|
})).data.map((e) => ({
|
|
3501
|
-
label:
|
|
3583
|
+
label: Hi(e, n),
|
|
3502
3584
|
value: e[r],
|
|
3503
3585
|
record: e
|
|
3504
3586
|
}));
|
|
3505
3587
|
}
|
|
3506
|
-
function
|
|
3507
|
-
let o =
|
|
3588
|
+
function Zi(e, t, n, r, i, a) {
|
|
3589
|
+
let o = Yi(e, i);
|
|
3508
3590
|
if (a) {
|
|
3509
|
-
let e =
|
|
3591
|
+
let e = qi.get(o);
|
|
3510
3592
|
if (e && !i) return Promise.resolve(e);
|
|
3511
3593
|
}
|
|
3512
|
-
let s =
|
|
3594
|
+
let s = Ji.get(o);
|
|
3513
3595
|
if (s) return s;
|
|
3514
|
-
let c =
|
|
3515
|
-
|
|
3596
|
+
let c = Xi(e, t, n, r, i).then((e) => (a && !i && qi.set(o, e), e)).finally(() => {
|
|
3597
|
+
Ji.delete(o);
|
|
3516
3598
|
});
|
|
3517
|
-
return
|
|
3599
|
+
return Ji.set(o, c), c;
|
|
3518
3600
|
}
|
|
3519
|
-
function
|
|
3520
|
-
let { lazy: c = !1, active: u = !1, selectedValues: f, selectedRecords: p, fetchSelected: m = !0, cache: h } = o, g = h ?? !c, _ =
|
|
3601
|
+
function Qi(e, t, n = "name", r = "id", i, o = {}) {
|
|
3602
|
+
let { lazy: c = !1, active: u = !1, selectedValues: f, selectedRecords: p, fetchSelected: m = !0, cache: h } = o, g = h ?? !c, _ = Yt(), v = l(() => {
|
|
3521
3603
|
if (e) return e;
|
|
3522
3604
|
if (t) return {
|
|
3523
3605
|
resource: t,
|
|
@@ -3527,14 +3609,14 @@ function Yi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3527
3609
|
e,
|
|
3528
3610
|
t,
|
|
3529
3611
|
i
|
|
3530
|
-
]), y = v ?
|
|
3612
|
+
]), y = v ? Yi(v, i) : void 0, b = l(() => Bi(f, r), [f, r]), x = l(() => Ui(Vi(f, p, r), n, r), [
|
|
3531
3613
|
f,
|
|
3532
3614
|
p,
|
|
3533
3615
|
n,
|
|
3534
3616
|
r
|
|
3535
|
-
]), S = !!(v && (!c || u || Array.isArray(v))), [C, w] = d(() => x.length ? x : !y || i || c || !g ? [] :
|
|
3617
|
+
]), 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
3618
|
s(() => {
|
|
3537
|
-
x.length && w((e) =>
|
|
3619
|
+
x.length && w((e) => Wi(e, x));
|
|
3538
3620
|
}, [x]);
|
|
3539
3621
|
let D = a(async () => {
|
|
3540
3622
|
if (!v || !S) {
|
|
@@ -3542,15 +3624,15 @@ function Yi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3542
3624
|
return;
|
|
3543
3625
|
}
|
|
3544
3626
|
if (g) {
|
|
3545
|
-
let e =
|
|
3627
|
+
let e = Yi(v, i), t = qi.get(e);
|
|
3546
3628
|
if (t && !i) {
|
|
3547
|
-
w(
|
|
3629
|
+
w(Wi(x, t)), E(!1);
|
|
3548
3630
|
return;
|
|
3549
3631
|
}
|
|
3550
3632
|
}
|
|
3551
3633
|
E(!0), c && w(x);
|
|
3552
3634
|
try {
|
|
3553
|
-
w(
|
|
3635
|
+
w(Wi(x, await Zi(v, _, n, r, i, g)));
|
|
3554
3636
|
} catch {
|
|
3555
3637
|
!b.length && !x.length ? w([]) : c && w(x);
|
|
3556
3638
|
} finally {
|
|
@@ -3587,7 +3669,7 @@ function Yi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3587
3669
|
for (let i of e) try {
|
|
3588
3670
|
let e = (await _.getOne(t, i)).data;
|
|
3589
3671
|
a.push({
|
|
3590
|
-
label:
|
|
3672
|
+
label: Hi(e, n),
|
|
3591
3673
|
value: e[r],
|
|
3592
3674
|
record: e
|
|
3593
3675
|
});
|
|
@@ -3599,7 +3681,7 @@ function Yi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3599
3681
|
}
|
|
3600
3682
|
i || !a.length || w((e) => {
|
|
3601
3683
|
let t = a.filter((t) => !e.some((e) => e.value === t.value));
|
|
3602
|
-
return t.length ?
|
|
3684
|
+
return t.length ? Wi(e, t) : e;
|
|
3603
3685
|
});
|
|
3604
3686
|
})(), () => {
|
|
3605
3687
|
i = !0;
|
|
@@ -3625,15 +3707,15 @@ function Yi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3625
3707
|
}
|
|
3626
3708
|
//#endregion
|
|
3627
3709
|
//#region src/crud/fields/ReferenceInputActions.tsx
|
|
3628
|
-
function
|
|
3710
|
+
function $i({ reference: e, referenceForm: t, referencePermissions: n, referenceTitle: r, referenceDefaultValues: i, referenceModalWidth: a, selectedId: o, disabled: s, onCreated: c, onUpdated: l }) {
|
|
3629
3711
|
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(
|
|
3712
|
+
return !p && !m ? null : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J(B, {
|
|
3631
3713
|
size: 4,
|
|
3632
3714
|
children: [p ? /* @__PURE__ */ q(U, {
|
|
3633
3715
|
title: `Add ${f ?? "record"}`,
|
|
3634
3716
|
children: /* @__PURE__ */ q(w, {
|
|
3635
3717
|
type: "default",
|
|
3636
|
-
icon: /* @__PURE__ */ q(
|
|
3718
|
+
icon: /* @__PURE__ */ q(Ce, {}),
|
|
3637
3719
|
disabled: s,
|
|
3638
3720
|
"aria-label": `Add ${f ?? "record"}`,
|
|
3639
3721
|
onClick: () => g("new")
|
|
@@ -3642,13 +3724,13 @@ function Xi({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3642
3724
|
title: `Edit ${f ?? "record"}`,
|
|
3643
3725
|
children: /* @__PURE__ */ q(w, {
|
|
3644
3726
|
type: "default",
|
|
3645
|
-
icon: /* @__PURE__ */ q(
|
|
3727
|
+
icon: /* @__PURE__ */ q(_e, {}),
|
|
3646
3728
|
disabled: s,
|
|
3647
3729
|
"aria-label": `Edit ${f ?? "record"}`,
|
|
3648
3730
|
onClick: () => g(String(o))
|
|
3649
3731
|
})
|
|
3650
3732
|
}) : null]
|
|
3651
|
-
}), e && t && h != null ? /* @__PURE__ */ q(
|
|
3733
|
+
}), e && t && h != null ? /* @__PURE__ */ q(Ur, {
|
|
3652
3734
|
resource: e,
|
|
3653
3735
|
editId: h,
|
|
3654
3736
|
onClose: () => g(null),
|
|
@@ -3665,35 +3747,35 @@ function Xi({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3665
3747
|
}
|
|
3666
3748
|
//#endregion
|
|
3667
3749
|
//#region src/crud/fields/ReferenceField.tsx
|
|
3668
|
-
function
|
|
3669
|
-
let [T, E] = d(), [D, O] = d(!1), k = D || !!T,
|
|
3750
|
+
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 }) {
|
|
3751
|
+
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
3752
|
lazy: u,
|
|
3671
3753
|
active: k,
|
|
3672
3754
|
selectedValues: p,
|
|
3673
3755
|
selectedRecords: g,
|
|
3674
3756
|
fetchSelected: f
|
|
3675
|
-
}),
|
|
3757
|
+
}), P = l(() => j.map((e) => ({
|
|
3676
3758
|
label: e.label,
|
|
3677
3759
|
value: e.value
|
|
3678
|
-
})), [
|
|
3760
|
+
})), [j]), F = (e) => {
|
|
3679
3761
|
let t = e[r];
|
|
3680
3762
|
m(t), c?.(t, {
|
|
3681
|
-
label:
|
|
3763
|
+
label: Hi(e, n),
|
|
3682
3764
|
value: t,
|
|
3683
3765
|
record: e
|
|
3684
|
-
}, { name: h }),
|
|
3685
|
-
},
|
|
3686
|
-
...
|
|
3766
|
+
}, { name: h }), N();
|
|
3767
|
+
}, I = /* @__PURE__ */ q(z, {
|
|
3768
|
+
...Gi({
|
|
3687
3769
|
popupMatchSelectWidth: C,
|
|
3688
3770
|
popupMinWidth: w
|
|
3689
3771
|
}),
|
|
3690
|
-
value:
|
|
3772
|
+
value: A,
|
|
3691
3773
|
onChange: (e) => {
|
|
3692
|
-
m(e), c?.(e,
|
|
3774
|
+
m(e), c?.(e, ee(e), { name: h });
|
|
3693
3775
|
},
|
|
3694
|
-
options:
|
|
3695
|
-
loading:
|
|
3696
|
-
notFoundContent:
|
|
3776
|
+
options: P,
|
|
3777
|
+
loading: M,
|
|
3778
|
+
notFoundContent: Ki(M),
|
|
3697
3779
|
showSearch: i,
|
|
3698
3780
|
filterOption: i ? !1 : void 0,
|
|
3699
3781
|
onSearch: i ? E : void 0,
|
|
@@ -3721,23 +3803,23 @@ function Zi({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3721
3803
|
flex: 1,
|
|
3722
3804
|
minWidth: 0
|
|
3723
3805
|
},
|
|
3724
|
-
children:
|
|
3725
|
-
}), /* @__PURE__ */ q(
|
|
3806
|
+
children: I
|
|
3807
|
+
}), /* @__PURE__ */ q($i, {
|
|
3726
3808
|
reference: e,
|
|
3727
3809
|
referenceForm: _,
|
|
3728
3810
|
referencePermissions: v,
|
|
3729
3811
|
referenceTitle: y,
|
|
3730
3812
|
referenceDefaultValues: b,
|
|
3731
3813
|
referenceModalWidth: x,
|
|
3732
|
-
selectedId:
|
|
3814
|
+
selectedId: A,
|
|
3733
3815
|
disabled: o,
|
|
3734
|
-
onCreated:
|
|
3735
|
-
onUpdated: () => void
|
|
3816
|
+
onCreated: F,
|
|
3817
|
+
onUpdated: () => void N()
|
|
3736
3818
|
})]
|
|
3737
|
-
}) :
|
|
3819
|
+
}) : I;
|
|
3738
3820
|
}
|
|
3739
|
-
function
|
|
3740
|
-
let E =
|
|
3821
|
+
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 }) {
|
|
3822
|
+
let E = Pe({
|
|
3741
3823
|
name: g ?? "",
|
|
3742
3824
|
disabled: !g
|
|
3743
3825
|
});
|
|
@@ -3748,7 +3830,7 @@ function Qi({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3748
3830
|
required: s,
|
|
3749
3831
|
rules: c,
|
|
3750
3832
|
hideLabel: f,
|
|
3751
|
-
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ q(
|
|
3833
|
+
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ q(ea, {
|
|
3752
3834
|
reference: r,
|
|
3753
3835
|
choices: i,
|
|
3754
3836
|
optionLabel: a,
|
|
@@ -3777,27 +3859,27 @@ function Qi({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3777
3859
|
}
|
|
3778
3860
|
//#endregion
|
|
3779
3861
|
//#region src/crud/fields/ReferenceManyField.tsx
|
|
3780
|
-
function
|
|
3781
|
-
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D =
|
|
3862
|
+
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 }) {
|
|
3863
|
+
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
3864
|
lazy: o,
|
|
3783
3865
|
active: E,
|
|
3784
3866
|
selectedValues: c,
|
|
3785
3867
|
selectedRecords: p,
|
|
3786
3868
|
fetchSelected: s
|
|
3787
|
-
}),
|
|
3869
|
+
}), j = l(() => O.map((e) => ({
|
|
3788
3870
|
label: e.label,
|
|
3789
3871
|
value: e.value
|
|
3790
|
-
})), [O]),
|
|
3791
|
-
...
|
|
3872
|
+
})), [O]), M = /* @__PURE__ */ q(z, {
|
|
3873
|
+
...Gi({
|
|
3792
3874
|
popupMatchSelectWidth: b,
|
|
3793
3875
|
popupMinWidth: x
|
|
3794
3876
|
}),
|
|
3795
3877
|
mode: "multiple",
|
|
3796
3878
|
value: D,
|
|
3797
3879
|
onChange: u,
|
|
3798
|
-
options:
|
|
3880
|
+
options: j,
|
|
3799
3881
|
loading: k,
|
|
3800
|
-
notFoundContent:
|
|
3882
|
+
notFoundContent: Ki(k),
|
|
3801
3883
|
showSearch: i,
|
|
3802
3884
|
filterOption: i ? !1 : void 0,
|
|
3803
3885
|
onSearch: i ? C : void 0,
|
|
@@ -3821,8 +3903,8 @@ function $i({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3821
3903
|
flex: 1,
|
|
3822
3904
|
minWidth: 0
|
|
3823
3905
|
},
|
|
3824
|
-
children:
|
|
3825
|
-
}), /* @__PURE__ */ q(
|
|
3906
|
+
children: M
|
|
3907
|
+
}), /* @__PURE__ */ q($i, {
|
|
3826
3908
|
reference: e,
|
|
3827
3909
|
referenceForm: m,
|
|
3828
3910
|
referencePermissions: h,
|
|
@@ -3833,16 +3915,16 @@ function $i({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3833
3915
|
onCreated: (e) => {
|
|
3834
3916
|
let t = e[r], n = Array.isArray(D) ? D : [];
|
|
3835
3917
|
if (n.some((e) => e === t)) {
|
|
3836
|
-
|
|
3918
|
+
A();
|
|
3837
3919
|
return;
|
|
3838
3920
|
}
|
|
3839
|
-
u([...n, t]),
|
|
3921
|
+
u([...n, t]), A();
|
|
3840
3922
|
}
|
|
3841
3923
|
})]
|
|
3842
|
-
}) :
|
|
3924
|
+
}) : M;
|
|
3843
3925
|
}
|
|
3844
|
-
function
|
|
3845
|
-
let w =
|
|
3926
|
+
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 }) {
|
|
3927
|
+
let w = Pe({
|
|
3846
3928
|
name: m ?? "",
|
|
3847
3929
|
disabled: !m
|
|
3848
3930
|
});
|
|
@@ -3853,7 +3935,7 @@ function ea({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3853
3935
|
required: s,
|
|
3854
3936
|
rules: c,
|
|
3855
3937
|
hideLabel: d,
|
|
3856
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(
|
|
3938
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(na, {
|
|
3857
3939
|
reference: r,
|
|
3858
3940
|
choices: i,
|
|
3859
3941
|
optionLabel: a,
|
|
@@ -3879,10 +3961,10 @@ function ea({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3879
3961
|
}
|
|
3880
3962
|
//#endregion
|
|
3881
3963
|
//#region src/crud/fields/uploadFieldUtils.ts
|
|
3882
|
-
function
|
|
3964
|
+
function ia(e) {
|
|
3883
3965
|
return e instanceof File ? !0 : typeof e == "string" && e.length > 0;
|
|
3884
3966
|
}
|
|
3885
|
-
function
|
|
3967
|
+
function aa(e) {
|
|
3886
3968
|
if (e instanceof File) return e.name;
|
|
3887
3969
|
if (typeof e == "string" && e.length > 0) try {
|
|
3888
3970
|
return new URL(e, "http://local").pathname.split("/").filter(Boolean).pop() || e;
|
|
@@ -3892,7 +3974,7 @@ function na(e) {
|
|
|
3892
3974
|
}
|
|
3893
3975
|
//#endregion
|
|
3894
3976
|
//#region src/crud/fields/useUploadPreviewUrl.ts
|
|
3895
|
-
function
|
|
3977
|
+
function oa(e) {
|
|
3896
3978
|
let [t, n] = d();
|
|
3897
3979
|
if (s(() => {
|
|
3898
3980
|
if (e instanceof File) {
|
|
@@ -3905,14 +3987,14 @@ function ra(e) {
|
|
|
3905
3987
|
}
|
|
3906
3988
|
//#endregion
|
|
3907
3989
|
//#region src/crud/fields/ImageField.tsx
|
|
3908
|
-
function
|
|
3909
|
-
let o = u(null), s =
|
|
3910
|
-
return /* @__PURE__ */ J(
|
|
3990
|
+
function sa({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "image/*", previewWidth: a = 200 }) {
|
|
3991
|
+
let o = u(null), s = oa(e), c = r && ia(e);
|
|
3992
|
+
return /* @__PURE__ */ J(B, {
|
|
3911
3993
|
direction: "vertical",
|
|
3912
3994
|
size: "middle",
|
|
3913
3995
|
style: { width: "100%" },
|
|
3914
3996
|
children: [
|
|
3915
|
-
s ? /* @__PURE__ */ q(
|
|
3997
|
+
s ? /* @__PURE__ */ q(N, {
|
|
3916
3998
|
src: s,
|
|
3917
3999
|
alt: "",
|
|
3918
4000
|
style: {
|
|
@@ -3921,15 +4003,15 @@ function ia({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
3921
4003
|
objectFit: "contain"
|
|
3922
4004
|
}
|
|
3923
4005
|
}) : null,
|
|
3924
|
-
/* @__PURE__ */ J(
|
|
4006
|
+
/* @__PURE__ */ J(B, {
|
|
3925
4007
|
wrap: !0,
|
|
3926
4008
|
children: [/* @__PURE__ */ q(w, {
|
|
3927
|
-
icon: /* @__PURE__ */ q(
|
|
4009
|
+
icon: /* @__PURE__ */ q(Ee, {}),
|
|
3928
4010
|
disabled: n,
|
|
3929
4011
|
onClick: () => o.current?.click(),
|
|
3930
4012
|
children: "Choose image"
|
|
3931
4013
|
}), c ? /* @__PURE__ */ q(w, {
|
|
3932
|
-
icon: /* @__PURE__ */ q(
|
|
4014
|
+
icon: /* @__PURE__ */ q(he, {}),
|
|
3933
4015
|
disabled: n,
|
|
3934
4016
|
onClick: () => {
|
|
3935
4017
|
t(null), o.current && (o.current.value = "");
|
|
@@ -3953,7 +4035,7 @@ function ia({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
3953
4035
|
]
|
|
3954
4036
|
});
|
|
3955
4037
|
}
|
|
3956
|
-
function
|
|
4038
|
+
function ca({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s, previewWidth: c }) {
|
|
3957
4039
|
return /* @__PURE__ */ q($, {
|
|
3958
4040
|
source: e,
|
|
3959
4041
|
name: t,
|
|
@@ -3961,7 +4043,7 @@ function aa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3961
4043
|
required: r,
|
|
3962
4044
|
rules: i,
|
|
3963
4045
|
hideLabel: a,
|
|
3964
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(
|
|
4046
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(sa, {
|
|
3965
4047
|
value: e,
|
|
3966
4048
|
onChange: t,
|
|
3967
4049
|
disabled: n,
|
|
@@ -3973,28 +4055,28 @@ function aa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3973
4055
|
}
|
|
3974
4056
|
//#endregion
|
|
3975
4057
|
//#region src/crud/fields/FileField.tsx
|
|
3976
|
-
function
|
|
3977
|
-
let a = u(null), o =
|
|
3978
|
-
return /* @__PURE__ */ J(
|
|
4058
|
+
function la({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
4059
|
+
let a = u(null), o = aa(e), s = typeof e == "string" && e.length > 0 ? e : void 0, c = r && ia(e);
|
|
4060
|
+
return /* @__PURE__ */ J(B, {
|
|
3979
4061
|
direction: "vertical",
|
|
3980
4062
|
size: "middle",
|
|
3981
4063
|
style: { width: "100%" },
|
|
3982
4064
|
children: [
|
|
3983
|
-
o ? /* @__PURE__ */ J(
|
|
4065
|
+
o ? /* @__PURE__ */ J(B, { children: [/* @__PURE__ */ q(Se, {}), s ? /* @__PURE__ */ q(W.Link, {
|
|
3984
4066
|
href: s,
|
|
3985
4067
|
target: "_blank",
|
|
3986
4068
|
rel: "noopener noreferrer",
|
|
3987
4069
|
children: o
|
|
3988
4070
|
}) : /* @__PURE__ */ q(W.Text, { children: o })] }) : null,
|
|
3989
|
-
/* @__PURE__ */ J(
|
|
4071
|
+
/* @__PURE__ */ J(B, {
|
|
3990
4072
|
wrap: !0,
|
|
3991
4073
|
children: [/* @__PURE__ */ q(w, {
|
|
3992
|
-
icon: /* @__PURE__ */ q(
|
|
4074
|
+
icon: /* @__PURE__ */ q(Ee, {}),
|
|
3993
4075
|
disabled: n,
|
|
3994
4076
|
onClick: () => a.current?.click(),
|
|
3995
4077
|
children: "Choose file"
|
|
3996
4078
|
}), c ? /* @__PURE__ */ q(w, {
|
|
3997
|
-
icon: /* @__PURE__ */ q(
|
|
4079
|
+
icon: /* @__PURE__ */ q(he, {}),
|
|
3998
4080
|
disabled: n,
|
|
3999
4081
|
onClick: () => {
|
|
4000
4082
|
t(null), a.current && (a.current.value = "");
|
|
@@ -4018,7 +4100,7 @@ function oa({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
4018
4100
|
]
|
|
4019
4101
|
});
|
|
4020
4102
|
}
|
|
4021
|
-
function
|
|
4103
|
+
function ua({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s }) {
|
|
4022
4104
|
return /* @__PURE__ */ q($, {
|
|
4023
4105
|
source: e,
|
|
4024
4106
|
name: t,
|
|
@@ -4026,7 +4108,7 @@ function sa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4026
4108
|
required: r,
|
|
4027
4109
|
rules: i,
|
|
4028
4110
|
hideLabel: a,
|
|
4029
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(
|
|
4111
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(la, {
|
|
4030
4112
|
value: e,
|
|
4031
4113
|
onChange: t,
|
|
4032
4114
|
disabled: n,
|
|
@@ -4037,8 +4119,8 @@ function sa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4037
4119
|
}
|
|
4038
4120
|
//#endregion
|
|
4039
4121
|
//#region src/crud/columns/TextColumn.tsx
|
|
4040
|
-
function
|
|
4041
|
-
return
|
|
4122
|
+
function da({ source: e, label: t, sortable: n = !0 }) {
|
|
4123
|
+
return Jn(l(() => ({
|
|
4042
4124
|
key: e,
|
|
4043
4125
|
source: e,
|
|
4044
4126
|
label: t,
|
|
@@ -4055,13 +4137,13 @@ function ca({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4055
4137
|
n
|
|
4056
4138
|
])), null;
|
|
4057
4139
|
}
|
|
4058
|
-
function
|
|
4059
|
-
return typeof n == "function" ? n(e) : n ?
|
|
4140
|
+
function fa(e, t, n) {
|
|
4141
|
+
return typeof n == "function" ? n(e) : n ? br(e, n) : e[t];
|
|
4060
4142
|
}
|
|
4061
4143
|
//#endregion
|
|
4062
4144
|
//#region src/crud/columns/NumberColumn.tsx
|
|
4063
|
-
function
|
|
4064
|
-
return
|
|
4145
|
+
function pa({ source: e, label: t, sortable: n = !0 }) {
|
|
4146
|
+
return Jn(l(() => ({
|
|
4065
4147
|
key: e,
|
|
4066
4148
|
source: e,
|
|
4067
4149
|
label: t,
|
|
@@ -4080,8 +4162,8 @@ function ua({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4080
4162
|
}
|
|
4081
4163
|
//#endregion
|
|
4082
4164
|
//#region src/crud/columns/BooleanColumn.tsx
|
|
4083
|
-
function
|
|
4084
|
-
return
|
|
4165
|
+
function ma({ source: e, label: t, sortable: n = !0 }) {
|
|
4166
|
+
return Jn(l(() => ({
|
|
4085
4167
|
key: e,
|
|
4086
4168
|
source: e,
|
|
4087
4169
|
label: t,
|
|
@@ -4101,8 +4183,8 @@ function da({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4101
4183
|
}
|
|
4102
4184
|
//#endregion
|
|
4103
4185
|
//#region src/crud/columns/DateColumn.tsx
|
|
4104
|
-
function
|
|
4105
|
-
return
|
|
4186
|
+
function ha({ source: e, label: t, sortable: n = !0 }) {
|
|
4187
|
+
return Jn(l(() => ({
|
|
4106
4188
|
key: e,
|
|
4107
4189
|
source: e,
|
|
4108
4190
|
label: t,
|
|
@@ -4122,17 +4204,17 @@ function fa({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4122
4204
|
}
|
|
4123
4205
|
//#endregion
|
|
4124
4206
|
//#region src/crud/columns/ReferenceColumn.tsx
|
|
4125
|
-
function
|
|
4126
|
-
let { labelForValue: s } =
|
|
4207
|
+
function ga({ record: e, source: t, display: n, reference: r, choices: i, optionLabel: a, optionValue: o }) {
|
|
4208
|
+
let { labelForValue: s } = Qi(i, r, a, o), c = e[t];
|
|
4127
4209
|
if (typeof n == "function") return /* @__PURE__ */ q(K, { children: n(e) });
|
|
4128
4210
|
if (n && n !== t) {
|
|
4129
|
-
let r =
|
|
4211
|
+
let r = fa(e, t, n);
|
|
4130
4212
|
return /* @__PURE__ */ q(K, { children: r == null ? "—" : String(r) });
|
|
4131
4213
|
}
|
|
4132
4214
|
return /* @__PURE__ */ q(K, { children: s(c) });
|
|
4133
4215
|
}
|
|
4134
|
-
function
|
|
4135
|
-
return
|
|
4216
|
+
function _a({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: s = !0 }) {
|
|
4217
|
+
return Jn(l(() => ({
|
|
4136
4218
|
key: e,
|
|
4137
4219
|
source: e,
|
|
4138
4220
|
label: t,
|
|
@@ -4142,7 +4224,7 @@ function ma({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4142
4224
|
dataIndex: e,
|
|
4143
4225
|
key: e,
|
|
4144
4226
|
sorter: s ? !0 : void 0,
|
|
4145
|
-
render: (s, c) => /* @__PURE__ */ q(
|
|
4227
|
+
render: (s, c) => /* @__PURE__ */ q(ga, {
|
|
4146
4228
|
record: c,
|
|
4147
4229
|
source: e,
|
|
4148
4230
|
label: t,
|
|
@@ -4166,12 +4248,12 @@ function ma({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4166
4248
|
}
|
|
4167
4249
|
//#endregion
|
|
4168
4250
|
//#region src/crud/columns/ReferenceManyColumn.tsx
|
|
4169
|
-
function
|
|
4170
|
-
let { labelsForValues: o } =
|
|
4251
|
+
function va({ record: e, source: t, reference: n, choices: r, optionLabel: i, optionValue: a }) {
|
|
4252
|
+
let { labelsForValues: o } = Qi(r, n, i, a), s = e[t];
|
|
4171
4253
|
return /* @__PURE__ */ q(K, { children: o(Array.isArray(s) ? s : []) });
|
|
4172
4254
|
}
|
|
4173
|
-
function
|
|
4174
|
-
return
|
|
4255
|
+
function ya({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
|
|
4256
|
+
return Jn(l(() => ({
|
|
4175
4257
|
key: e,
|
|
4176
4258
|
source: e,
|
|
4177
4259
|
label: t,
|
|
@@ -4181,7 +4263,7 @@ function ga({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4181
4263
|
dataIndex: e,
|
|
4182
4264
|
key: e,
|
|
4183
4265
|
sorter: o ? !0 : void 0,
|
|
4184
|
-
render: (t, o) => /* @__PURE__ */ q(
|
|
4266
|
+
render: (t, o) => /* @__PURE__ */ q(va, {
|
|
4185
4267
|
record: o,
|
|
4186
4268
|
source: e,
|
|
4187
4269
|
reference: n,
|
|
@@ -4202,8 +4284,8 @@ function ga({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4202
4284
|
}
|
|
4203
4285
|
//#endregion
|
|
4204
4286
|
//#region src/crud/columns/ImageColumn.tsx
|
|
4205
|
-
function
|
|
4206
|
-
return
|
|
4287
|
+
function ba({ source: e, label: t, sortable: n = !1, width: r = 40, height: i = 40, objectFit: a = "cover", borderRadius: o = 4, alt: s = "" }) {
|
|
4288
|
+
return Jn(l(() => ({
|
|
4207
4289
|
key: e,
|
|
4208
4290
|
source: e,
|
|
4209
4291
|
label: t,
|
|
@@ -4237,8 +4319,8 @@ function _a({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4237
4319
|
}
|
|
4238
4320
|
//#endregion
|
|
4239
4321
|
//#region src/crud/columns/CustomColumn.tsx
|
|
4240
|
-
function
|
|
4241
|
-
return
|
|
4322
|
+
function xa({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
4323
|
+
return Jn(l(() => ({
|
|
4242
4324
|
key: e,
|
|
4243
4325
|
source: e,
|
|
4244
4326
|
label: t,
|
|
@@ -4257,12 +4339,12 @@ function va({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
|
4257
4339
|
}
|
|
4258
4340
|
//#endregion
|
|
4259
4341
|
//#region src/crud/filters/NumberFilter.tsx
|
|
4260
|
-
function
|
|
4261
|
-
return
|
|
4342
|
+
function Sa({ source: e, label: t }) {
|
|
4343
|
+
return rr(l(() => ({
|
|
4262
4344
|
key: e,
|
|
4263
4345
|
source: e,
|
|
4264
4346
|
label: t,
|
|
4265
|
-
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(
|
|
4347
|
+
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(F, {
|
|
4266
4348
|
placeholder: t ?? e,
|
|
4267
4349
|
value: n,
|
|
4268
4350
|
onChange: (e) => r(e ?? void 0),
|
|
@@ -4272,12 +4354,12 @@ function ya({ source: e, label: t }) {
|
|
|
4272
4354
|
}
|
|
4273
4355
|
//#endregion
|
|
4274
4356
|
//#region src/crud/filters/BooleanFilter.tsx
|
|
4275
|
-
function
|
|
4276
|
-
return
|
|
4357
|
+
function Ca({ source: e, label: t }) {
|
|
4358
|
+
return rr(l(() => ({
|
|
4277
4359
|
key: e,
|
|
4278
4360
|
source: e,
|
|
4279
4361
|
label: t,
|
|
4280
|
-
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(
|
|
4362
|
+
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(z, {
|
|
4281
4363
|
allowClear: !0,
|
|
4282
4364
|
placeholder: t ?? e,
|
|
4283
4365
|
value: n,
|
|
@@ -4295,15 +4377,15 @@ function ba({ source: e, label: t }) {
|
|
|
4295
4377
|
}
|
|
4296
4378
|
//#endregion
|
|
4297
4379
|
//#region src/crud/filters/DateFilter.tsx
|
|
4298
|
-
function
|
|
4299
|
-
return
|
|
4380
|
+
function wa({ source: e, label: t }) {
|
|
4381
|
+
return rr(l(() => ({
|
|
4300
4382
|
key: e,
|
|
4301
4383
|
source: e,
|
|
4302
4384
|
label: t,
|
|
4303
4385
|
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(O, {
|
|
4304
4386
|
allowClear: !0,
|
|
4305
4387
|
placeholder: t ?? e,
|
|
4306
|
-
value: n ?
|
|
4388
|
+
value: n ? Fe(String(n)) : null,
|
|
4307
4389
|
onChange: (e) => r(e ? e.format("YYYY-MM-DD") : void 0),
|
|
4308
4390
|
style: { minWidth: 160 }
|
|
4309
4391
|
})
|
|
@@ -4311,12 +4393,12 @@ function xa({ source: e, label: t }) {
|
|
|
4311
4393
|
}
|
|
4312
4394
|
//#endregion
|
|
4313
4395
|
//#region src/crud/filters/SelectFilter.tsx
|
|
4314
|
-
function
|
|
4315
|
-
return
|
|
4396
|
+
function Ta({ source: e, label: t, choices: n, multiple: r }) {
|
|
4397
|
+
return rr(l(() => ({
|
|
4316
4398
|
key: e,
|
|
4317
4399
|
source: e,
|
|
4318
4400
|
label: t,
|
|
4319
|
-
render: ({ value: i, onChange: a }) => /* @__PURE__ */ q(
|
|
4401
|
+
render: ({ value: i, onChange: a }) => /* @__PURE__ */ q(z, {
|
|
4320
4402
|
allowClear: !0,
|
|
4321
4403
|
mode: r ? "multiple" : void 0,
|
|
4322
4404
|
placeholder: t ?? e,
|
|
@@ -4334,15 +4416,15 @@ function Sa({ source: e, label: t, choices: n, multiple: r }) {
|
|
|
4334
4416
|
}
|
|
4335
4417
|
//#endregion
|
|
4336
4418
|
//#region src/crud/filters/ReferenceFilter.tsx
|
|
4337
|
-
function
|
|
4338
|
-
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b } =
|
|
4419
|
+
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 }) {
|
|
4420
|
+
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b } = Qi(r, n, i, a, s ? h : void 0, {
|
|
4339
4421
|
lazy: c,
|
|
4340
4422
|
active: _ || !!h,
|
|
4341
4423
|
selectedValues: p,
|
|
4342
4424
|
fetchSelected: l
|
|
4343
4425
|
});
|
|
4344
|
-
return /* @__PURE__ */ q(
|
|
4345
|
-
...
|
|
4426
|
+
return /* @__PURE__ */ q(z, {
|
|
4427
|
+
...Gi({
|
|
4346
4428
|
popupMatchSelectWidth: u,
|
|
4347
4429
|
popupMinWidth: f
|
|
4348
4430
|
}),
|
|
@@ -4356,7 +4438,7 @@ function Ca({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4356
4438
|
value: e.value
|
|
4357
4439
|
})),
|
|
4358
4440
|
loading: b,
|
|
4359
|
-
notFoundContent:
|
|
4441
|
+
notFoundContent: Ki(b),
|
|
4360
4442
|
showSearch: s,
|
|
4361
4443
|
filterOption: s ? !1 : void 0,
|
|
4362
4444
|
onSearch: s ? g : void 0,
|
|
@@ -4367,12 +4449,12 @@ function Ca({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4367
4449
|
style: { minWidth: 180 }
|
|
4368
4450
|
});
|
|
4369
4451
|
}
|
|
4370
|
-
function
|
|
4371
|
-
return
|
|
4452
|
+
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 }) {
|
|
4453
|
+
return rr(l(() => ({
|
|
4372
4454
|
key: e,
|
|
4373
4455
|
source: e,
|
|
4374
4456
|
label: t,
|
|
4375
|
-
render: ({ value: l, onChange: p }) => /* @__PURE__ */ q(
|
|
4457
|
+
render: ({ value: l, onChange: p }) => /* @__PURE__ */ q(Ea, {
|
|
4376
4458
|
source: e,
|
|
4377
4459
|
label: t,
|
|
4378
4460
|
reference: n,
|
|
@@ -4403,11 +4485,11 @@ function wa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4403
4485
|
f
|
|
4404
4486
|
])), null;
|
|
4405
4487
|
}
|
|
4406
|
-
function
|
|
4407
|
-
return /* @__PURE__ */ q(
|
|
4488
|
+
function Oa(e) {
|
|
4489
|
+
return /* @__PURE__ */ q(Da, {
|
|
4408
4490
|
...e,
|
|
4409
4491
|
multiple: !0
|
|
4410
4492
|
});
|
|
4411
4493
|
}
|
|
4412
4494
|
//#endregion
|
|
4413
|
-
export {
|
|
4495
|
+
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 };
|