ding-react-admin 2.0.9 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +1002 -867
- package/dist/src/components/AppHub.d.ts +15 -0
- package/dist/src/components/AppHub.d.ts.map +1 -0
- package/dist/src/components/AppLauncherButton.d.ts +7 -0
- package/dist/src/components/AppLauncherButton.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +2 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/layouts/AdminLayout.d.ts +1 -1
- package/dist/src/layouts/AdminLayout.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/dist/src/router/createAdminRouter.d.ts.map +1 -1
- package/dist/src/types.d.ts +7 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/AppHub.tsx +139 -0
- package/src/components/AppLauncherButton.tsx +33 -0
- package/src/components/index.ts +2 -0
- package/src/index.ts +11 -0
- package/src/layouts/AdminLayout.tsx +4 -3
- package/src/layouts/navFilter.ts +50 -1
- package/src/router/createAdminRouter.tsx +3 -1
- package/src/types.ts +7 -0
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,
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { ArrowLeftOutlined as
|
|
6
|
-
import { Controller as
|
|
7
|
-
import
|
|
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
|
+
import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
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);
|
|
@@ -52,8 +52,8 @@ function qe({ children: e, modeStorageKey: t = Ge, densityStorageKey: n = Ke })
|
|
|
52
52
|
localStorage.setItem(n, e);
|
|
53
53
|
} catch {}
|
|
54
54
|
}, m = r === "system" ? c ? "dark" : "light" : r, h = l(() => {
|
|
55
|
-
let e = m === "dark" ?
|
|
56
|
-
return { algorithm: a === "compact" ? [e,
|
|
55
|
+
let e = m === "dark" ? G.darkAlgorithm : G.defaultAlgorithm;
|
|
56
|
+
return { algorithm: a === "compact" ? [e, G.compactAlgorithm] : e };
|
|
57
57
|
}, [m, a]), g = l(() => ({
|
|
58
58
|
mode: r,
|
|
59
59
|
setMode: f,
|
|
@@ -67,104 +67,104 @@ function qe({ children: e, modeStorageKey: t = Ge, densityStorageKey: n = Ke })
|
|
|
67
67
|
f,
|
|
68
68
|
p
|
|
69
69
|
]);
|
|
70
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ q(Ge.Provider, {
|
|
71
71
|
value: g,
|
|
72
|
-
children: /* @__PURE__ */
|
|
72
|
+
children: /* @__PURE__ */ q(D, {
|
|
73
73
|
theme: h,
|
|
74
74
|
children: e
|
|
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__ */
|
|
88
|
+
icon: /* @__PURE__ */ q(ve, {})
|
|
89
89
|
}, {
|
|
90
90
|
label: "Compact",
|
|
91
91
|
value: "compact",
|
|
92
|
-
icon: /* @__PURE__ */
|
|
92
|
+
icon: /* @__PURE__ */ q(me, {})
|
|
93
93
|
}];
|
|
94
|
-
function
|
|
95
|
-
let { density: e, setDensity: t } =
|
|
96
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
109
|
+
icon: /* @__PURE__ */ q(Te, {})
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
label: "Dark",
|
|
113
113
|
value: "dark",
|
|
114
|
-
icon: /* @__PURE__ */
|
|
114
|
+
icon: /* @__PURE__ */ q(xe, {})
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
label: "Auto",
|
|
118
118
|
value: "system",
|
|
119
|
-
icon: /* @__PURE__ */
|
|
119
|
+
icon: /* @__PURE__ */ q(ge, {})
|
|
120
120
|
}
|
|
121
121
|
];
|
|
122
|
-
function
|
|
123
|
-
let { mode: e, setMode: t } =
|
|
124
|
-
return /* @__PURE__ */
|
|
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
|
|
134
|
-
let { token: e } =
|
|
135
|
-
return /* @__PURE__ */
|
|
136
|
-
placement:
|
|
133
|
+
function rt() {
|
|
134
|
+
let { token: e } = G.useToken();
|
|
135
|
+
return /* @__PURE__ */ q(ie, {
|
|
136
|
+
placement: ee.useBreakpoint().lg ? "bottomRight" : "bottom",
|
|
137
137
|
trigger: "click",
|
|
138
|
-
content: /* @__PURE__ */
|
|
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__ */
|
|
145
|
+
children: [/* @__PURE__ */ q(nt, {}), /* @__PURE__ */ q(et, {})]
|
|
146
146
|
}),
|
|
147
147
|
styles: { content: { padding: e.paddingSM } },
|
|
148
|
-
children: /* @__PURE__ */
|
|
148
|
+
children: /* @__PURE__ */ q(w, {
|
|
149
149
|
type: "default",
|
|
150
|
-
icon: /* @__PURE__ */
|
|
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
|
|
158
|
-
let { token: i } =
|
|
159
|
-
return /* @__PURE__ */
|
|
157
|
+
function it({ value: e, onChange: t, placeholder: n = "Search menu…", variant: r = "on-dark" }) {
|
|
158
|
+
let { token: i } = G.useToken(), a = r === "on-dark";
|
|
159
|
+
return /* @__PURE__ */ q("div", {
|
|
160
160
|
style: {
|
|
161
161
|
flexShrink: 0,
|
|
162
162
|
paddingInline: i.paddingSM,
|
|
163
163
|
paddingBlock: i.paddingXS
|
|
164
164
|
},
|
|
165
|
-
children: /* @__PURE__ */
|
|
165
|
+
children: /* @__PURE__ */ q(D, {
|
|
166
166
|
theme: a ? { token: { colorTextPlaceholder: "rgba(255, 255, 255, 0.45)" } } : void 0,
|
|
167
|
-
children: /* @__PURE__ */
|
|
167
|
+
children: /* @__PURE__ */ q(P, {
|
|
168
168
|
allowClear: !0,
|
|
169
169
|
size: "small",
|
|
170
170
|
value: e,
|
|
@@ -172,7 +172,7 @@ function et({ value: e, onChange: t, placeholder: n = "Search menu…", variant:
|
|
|
172
172
|
t(e.target.value);
|
|
173
173
|
},
|
|
174
174
|
placeholder: n,
|
|
175
|
-
prefix: /* @__PURE__ */
|
|
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,9 +189,9 @@ function et({ value: e, onChange: t, placeholder: n = "Search menu…", variant:
|
|
|
189
189
|
}
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/components/ScrollableArea.tsx
|
|
192
|
-
var
|
|
193
|
-
let { token: a } =
|
|
194
|
-
return /* @__PURE__ */
|
|
192
|
+
var at = r(function({ children: e, className: t, style: n, variant: r = "default" }, i) {
|
|
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
|
+
return /* @__PURE__ */ q("div", {
|
|
195
195
|
ref: i,
|
|
196
196
|
className: ["ding-admin-scroll", t].filter(Boolean).join(" "),
|
|
197
197
|
style: {
|
|
@@ -202,15 +202,15 @@ var tt = 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 at({ children: e, adapter: t }) {
|
|
|
222
222
|
s,
|
|
223
223
|
c
|
|
224
224
|
]);
|
|
225
|
-
return /* @__PURE__ */
|
|
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 ct(e = st) {
|
|
|
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__ */
|
|
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 mt(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,30 +322,30 @@ function ht(e) {
|
|
|
303
322
|
}
|
|
304
323
|
//#endregion
|
|
305
324
|
//#region src/components/NavMenuLabel.tsx
|
|
306
|
-
function
|
|
307
|
-
return t ? /* @__PURE__ */
|
|
325
|
+
function St({ label: e, title: t }) {
|
|
326
|
+
return t ? /* @__PURE__ */ q(U, {
|
|
308
327
|
title: t,
|
|
309
328
|
placement: "right",
|
|
310
329
|
mouseEnterDelay: 0,
|
|
311
330
|
destroyOnHidden: !0,
|
|
312
|
-
children: /* @__PURE__ */
|
|
331
|
+
children: /* @__PURE__ */ q("span", {
|
|
313
332
|
className: "ding-admin-menu-label",
|
|
314
333
|
children: e
|
|
315
334
|
})
|
|
316
|
-
}) : /* @__PURE__ */
|
|
335
|
+
}) : /* @__PURE__ */ q("span", {
|
|
317
336
|
className: "ding-admin-menu-label",
|
|
318
337
|
children: e
|
|
319
338
|
});
|
|
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__ */
|
|
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__ */
|
|
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 _t(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 vt(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 wt(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__ */ K
|
|
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__ */
|
|
425
|
+
}) : null, /* @__PURE__ */ q(at, {
|
|
407
426
|
variant: u,
|
|
408
427
|
style: {
|
|
409
428
|
flex: 1,
|
|
@@ -411,7 +430,7 @@ function Et({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
411
430
|
overflowY: "auto",
|
|
412
431
|
overflowX: "hidden"
|
|
413
432
|
},
|
|
414
|
-
children: /* @__PURE__ */
|
|
433
|
+
children: /* @__PURE__ */ q(Nt, {
|
|
415
434
|
menuItems: e,
|
|
416
435
|
selectedKeys: t,
|
|
417
436
|
inlineCollapsed: n,
|
|
@@ -423,9 +442,9 @@ function Et({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
423
442
|
})
|
|
424
443
|
})] });
|
|
425
444
|
}
|
|
426
|
-
function
|
|
427
|
-
return /* @__PURE__ */
|
|
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,11 +468,11 @@ function Dt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
449
468
|
}
|
|
450
469
|
});
|
|
451
470
|
}
|
|
452
|
-
function
|
|
453
|
-
let
|
|
454
|
-
|
|
455
|
-
},
|
|
456
|
-
|
|
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 = () => {
|
|
473
|
+
E(), b(f, { replace: !0 });
|
|
474
|
+
}, oe = a((e) => {
|
|
475
|
+
M(e);
|
|
457
476
|
try {
|
|
458
477
|
localStorage.setItem(p, e ? "1" : "0");
|
|
459
478
|
} catch {}
|
|
@@ -462,49 +481,49 @@ function Ot({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
462
481
|
P || N(!1);
|
|
463
482
|
}, [P]), s(() => {
|
|
464
483
|
N(!1);
|
|
465
|
-
}, [
|
|
466
|
-
|
|
484
|
+
}, [x.pathname]), s(() => {
|
|
485
|
+
te.current?.scrollTo({
|
|
467
486
|
top: 0,
|
|
468
487
|
left: 0
|
|
469
488
|
});
|
|
470
|
-
}, [
|
|
471
|
-
|
|
472
|
-
}, [
|
|
473
|
-
let
|
|
474
|
-
|
|
489
|
+
}, [x.pathname]), s(() => {
|
|
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, [
|
|
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
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
]),
|
|
501
|
+
H,
|
|
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
|
-
let
|
|
490
|
-
|
|
491
|
-
}, []),
|
|
492
|
-
|
|
493
|
-
}, []),
|
|
508
|
+
let pe = a((e) => {
|
|
509
|
+
fe(e);
|
|
510
|
+
}, []), me = ce ? K : de, he = a((e) => {
|
|
511
|
+
ne(e);
|
|
512
|
+
}, []), ge = l(() => [{
|
|
494
513
|
key: "logout",
|
|
495
|
-
icon: /* @__PURE__ */
|
|
514
|
+
icon: /* @__PURE__ */ q(ye, {}),
|
|
496
515
|
label: "Log out",
|
|
497
516
|
danger: !0
|
|
498
|
-
}], []),
|
|
517
|
+
}], []), _e = o ?? ge, ve = (e) => {
|
|
499
518
|
if (c) {
|
|
500
519
|
c(e);
|
|
501
520
|
return;
|
|
502
521
|
}
|
|
503
|
-
e.key === "logout" &&
|
|
504
|
-
},
|
|
505
|
-
|
|
522
|
+
e.key === "logout" && B();
|
|
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__ */
|
|
526
|
+
return /* @__PURE__ */ J(I, {
|
|
508
527
|
style: {
|
|
509
528
|
height: "100vh",
|
|
510
529
|
width: "100%",
|
|
@@ -512,25 +531,25 @@ function Ot({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
512
531
|
background: F.colorBgLayout
|
|
513
532
|
},
|
|
514
533
|
children: [
|
|
515
|
-
!P && /* @__PURE__ */
|
|
534
|
+
!y && !P && /* @__PURE__ */ q(I.Sider, {
|
|
516
535
|
collapsible: !0,
|
|
517
|
-
collapsed:
|
|
518
|
-
onCollapse:
|
|
536
|
+
collapsed: j,
|
|
537
|
+
onCollapse: oe,
|
|
519
538
|
collapsedWidth: 64,
|
|
520
539
|
style: {
|
|
521
|
-
background:
|
|
540
|
+
background: xe,
|
|
522
541
|
height: "100vh",
|
|
523
542
|
overflow: "hidden",
|
|
524
|
-
borderInlineEnd:
|
|
543
|
+
borderInlineEnd: T ? `1px solid ${F.colorSplit}` : void 0
|
|
525
544
|
},
|
|
526
|
-
children: /* @__PURE__ */
|
|
545
|
+
children: /* @__PURE__ */ J("div", {
|
|
527
546
|
style: {
|
|
528
547
|
display: "flex",
|
|
529
548
|
flexDirection: "column",
|
|
530
549
|
height: "100%",
|
|
531
550
|
overflow: "hidden"
|
|
532
551
|
},
|
|
533
|
-
children: [/* @__PURE__ */
|
|
552
|
+
children: [/* @__PURE__ */ q("div", {
|
|
534
553
|
style: {
|
|
535
554
|
height: 64,
|
|
536
555
|
flexShrink: 0,
|
|
@@ -539,76 +558,76 @@ function Ot({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
539
558
|
justifyContent: "center",
|
|
540
559
|
fontWeight: 600
|
|
541
560
|
},
|
|
542
|
-
children: /* @__PURE__ */
|
|
561
|
+
children: /* @__PURE__ */ q(W.Text, {
|
|
543
562
|
strong: !0,
|
|
544
563
|
style: { color: F.colorTextLightSolid },
|
|
545
|
-
children:
|
|
564
|
+
children: j ? n : t
|
|
546
565
|
})
|
|
547
|
-
}), /* @__PURE__ */
|
|
548
|
-
menuItems:
|
|
549
|
-
selectedKeys:
|
|
550
|
-
inlineCollapsed:
|
|
551
|
-
openKeys:
|
|
552
|
-
onOpenChange:
|
|
566
|
+
}), /* @__PURE__ */ q(Mt, {
|
|
567
|
+
menuItems: U,
|
|
568
|
+
selectedKeys: we,
|
|
569
|
+
inlineCollapsed: j,
|
|
570
|
+
openKeys: me,
|
|
571
|
+
onOpenChange: pe,
|
|
553
572
|
onNavigate: Y,
|
|
554
|
-
navQuery:
|
|
555
|
-
onNavQueryChange:
|
|
556
|
-
showNavSearch:
|
|
557
|
-
navSearchPlaceholder:
|
|
558
|
-
scrollVariant:
|
|
559
|
-
searchVariant:
|
|
560
|
-
wrapLabels:
|
|
561
|
-
itemDivider:
|
|
573
|
+
navQuery: L,
|
|
574
|
+
onNavQueryChange: he,
|
|
575
|
+
showNavSearch: re,
|
|
576
|
+
navSearchPlaceholder: ie,
|
|
577
|
+
scrollVariant: Se,
|
|
578
|
+
searchVariant: Ce,
|
|
579
|
+
wrapLabels: R,
|
|
580
|
+
itemDivider: ae
|
|
562
581
|
})]
|
|
563
582
|
})
|
|
564
583
|
}),
|
|
565
|
-
P && /* @__PURE__ */
|
|
566
|
-
title: /* @__PURE__ */
|
|
584
|
+
!y && P && /* @__PURE__ */ q(k, {
|
|
585
|
+
title: /* @__PURE__ */ q(W.Text, {
|
|
567
586
|
strong: !0,
|
|
568
587
|
style: { color: F.colorTextLightSolid },
|
|
569
|
-
children:
|
|
588
|
+
children: z
|
|
570
589
|
}),
|
|
571
590
|
placement: "left",
|
|
572
591
|
size: 280,
|
|
573
592
|
onClose: () => N(!1),
|
|
574
|
-
open:
|
|
593
|
+
open: ee,
|
|
575
594
|
styles: {
|
|
576
595
|
header: {
|
|
577
|
-
background:
|
|
596
|
+
background: xe,
|
|
578
597
|
borderBottom: `1px solid ${F.colorSplit}`
|
|
579
598
|
},
|
|
580
599
|
body: {
|
|
581
600
|
padding: 0,
|
|
582
|
-
background:
|
|
601
|
+
background: xe
|
|
583
602
|
}
|
|
584
603
|
},
|
|
585
604
|
destroyOnHidden: !0,
|
|
586
|
-
children: /* @__PURE__ */
|
|
605
|
+
children: /* @__PURE__ */ q("div", {
|
|
587
606
|
style: {
|
|
588
607
|
display: "flex",
|
|
589
608
|
flexDirection: "column",
|
|
590
609
|
height: "100%",
|
|
591
610
|
overflow: "hidden"
|
|
592
611
|
},
|
|
593
|
-
children: /* @__PURE__ */
|
|
594
|
-
menuItems:
|
|
595
|
-
selectedKeys:
|
|
612
|
+
children: /* @__PURE__ */ q(Mt, {
|
|
613
|
+
menuItems: U,
|
|
614
|
+
selectedKeys: we,
|
|
596
615
|
inlineCollapsed: !1,
|
|
597
|
-
openKeys:
|
|
598
|
-
onOpenChange:
|
|
616
|
+
openKeys: me,
|
|
617
|
+
onOpenChange: pe,
|
|
599
618
|
onNavigate: Y,
|
|
600
|
-
navQuery:
|
|
601
|
-
onNavQueryChange:
|
|
602
|
-
showNavSearch:
|
|
603
|
-
navSearchPlaceholder:
|
|
604
|
-
scrollVariant:
|
|
605
|
-
searchVariant:
|
|
606
|
-
wrapLabels:
|
|
607
|
-
itemDivider:
|
|
619
|
+
navQuery: L,
|
|
620
|
+
onNavQueryChange: he,
|
|
621
|
+
showNavSearch: re,
|
|
622
|
+
navSearchPlaceholder: ie,
|
|
623
|
+
scrollVariant: Se,
|
|
624
|
+
searchVariant: Ce,
|
|
625
|
+
wrapLabels: R,
|
|
626
|
+
itemDivider: ae
|
|
608
627
|
})
|
|
609
628
|
})
|
|
610
629
|
}),
|
|
611
|
-
/* @__PURE__ */
|
|
630
|
+
/* @__PURE__ */ J(I, {
|
|
612
631
|
style: {
|
|
613
632
|
minWidth: 0,
|
|
614
633
|
flex: 1,
|
|
@@ -617,7 +636,7 @@ function Ot({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
617
636
|
display: "flex",
|
|
618
637
|
flexDirection: "column"
|
|
619
638
|
},
|
|
620
|
-
children: [/* @__PURE__ */
|
|
639
|
+
children: [/* @__PURE__ */ J(I.Header, {
|
|
621
640
|
style: {
|
|
622
641
|
background: F.colorBgContainer,
|
|
623
642
|
paddingInline: F.paddingLG,
|
|
@@ -628,25 +647,25 @@ function Ot({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
628
647
|
flexShrink: 0
|
|
629
648
|
},
|
|
630
649
|
children: [
|
|
631
|
-
P && /* @__PURE__ */
|
|
650
|
+
!y && P && /* @__PURE__ */ q(w, {
|
|
632
651
|
type: "text",
|
|
633
|
-
icon: /* @__PURE__ */
|
|
652
|
+
icon: /* @__PURE__ */ q(be, {}),
|
|
634
653
|
onClick: () => N(!0),
|
|
635
654
|
"aria-label": "Open navigation"
|
|
636
655
|
}),
|
|
637
|
-
/* @__PURE__ */
|
|
656
|
+
/* @__PURE__ */ q("div", { style: {
|
|
638
657
|
flex: 1,
|
|
639
658
|
minWidth: 0
|
|
640
659
|
} }),
|
|
641
660
|
i,
|
|
642
|
-
/* @__PURE__ */
|
|
643
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ q(rt, {}),
|
|
662
|
+
/* @__PURE__ */ q(A, {
|
|
644
663
|
menu: {
|
|
645
|
-
items:
|
|
646
|
-
onClick:
|
|
664
|
+
items: _e,
|
|
665
|
+
onClick: ve
|
|
647
666
|
},
|
|
648
667
|
trigger: ["click"],
|
|
649
|
-
children: /* @__PURE__ */
|
|
668
|
+
children: /* @__PURE__ */ J(w, {
|
|
650
669
|
type: "text",
|
|
651
670
|
style: {
|
|
652
671
|
display: "inline-flex",
|
|
@@ -656,19 +675,19 @@ function Ot({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
656
675
|
paddingInline: P ? F.paddingXS : void 0
|
|
657
676
|
},
|
|
658
677
|
"aria-label": "Account menu",
|
|
659
|
-
children: [/* @__PURE__ */
|
|
678
|
+
children: [/* @__PURE__ */ q(C, {
|
|
660
679
|
size: "small",
|
|
661
|
-
icon: /* @__PURE__ */
|
|
662
|
-
}), !P && /* @__PURE__ */
|
|
680
|
+
icon: /* @__PURE__ */ q(De, {})
|
|
681
|
+
}), !P && /* @__PURE__ */ q(W.Text, {
|
|
663
682
|
type: "secondary",
|
|
664
683
|
ellipsis: !0,
|
|
665
684
|
style: { maxWidth: 160 },
|
|
666
|
-
children:
|
|
685
|
+
children: D
|
|
667
686
|
})]
|
|
668
687
|
})
|
|
669
688
|
})
|
|
670
689
|
]
|
|
671
|
-
}), /* @__PURE__ */
|
|
690
|
+
}), /* @__PURE__ */ q(I.Content, {
|
|
672
691
|
style: {
|
|
673
692
|
minWidth: 0,
|
|
674
693
|
flex: 1,
|
|
@@ -676,15 +695,15 @@ function Ot({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
676
695
|
display: "flex",
|
|
677
696
|
flexDirection: "column"
|
|
678
697
|
},
|
|
679
|
-
children: /* @__PURE__ */
|
|
680
|
-
ref:
|
|
698
|
+
children: /* @__PURE__ */ q(at, {
|
|
699
|
+
ref: te,
|
|
681
700
|
style: {
|
|
682
701
|
margin: P ? F.marginSM : F.marginLG,
|
|
683
702
|
flex: 1,
|
|
684
703
|
minHeight: 0,
|
|
685
704
|
overflow: "auto"
|
|
686
705
|
},
|
|
687
|
-
children: /* @__PURE__ */
|
|
706
|
+
children: /* @__PURE__ */ q(m, {})
|
|
688
707
|
})
|
|
689
708
|
})]
|
|
690
709
|
})
|
|
@@ -693,30 +712,30 @@ function Ot({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
693
712
|
}
|
|
694
713
|
//#endregion
|
|
695
714
|
//#region src/router/guards.tsx
|
|
696
|
-
function
|
|
697
|
-
return e ? n : /* @__PURE__ */
|
|
715
|
+
function Ft({ when: e, redirect: t, children: n }) {
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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 Mt({ 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 Pt(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,42 +786,42 @@ function Rt(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__ */
|
|
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__ */
|
|
804
|
+
element: /* @__PURE__ */ q(It, {
|
|
786
805
|
redirectTo: i,
|
|
787
|
-
children: /* @__PURE__ */
|
|
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
|
-
element: /* @__PURE__ */
|
|
815
|
+
element: /* @__PURE__ */ q(p, {
|
|
797
816
|
to: a,
|
|
798
817
|
replace: !0
|
|
799
818
|
})
|
|
800
|
-
}), g(l);
|
|
819
|
+
}), g(l, { basename: "/".replace(/\/$/, "") || void 0 });
|
|
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 Bt({ navItems: e, routes: t, authRedirects: n, layoutProps: r, theme: i
|
|
|
813
832
|
r,
|
|
814
833
|
n
|
|
815
834
|
]);
|
|
816
|
-
return /* @__PURE__ */
|
|
835
|
+
return /* @__PURE__ */ q(Ze, {
|
|
817
836
|
...i,
|
|
818
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
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 mn(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 hn(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 yn(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 wn(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 wn(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,25 +1170,25 @@ function Tn(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
|
|
1172
|
-
return /* @__PURE__ */
|
|
1190
|
+
function In({ prompt: e, linkText: t, to: n }) {
|
|
1191
|
+
return /* @__PURE__ */ J(W.Paragraph, {
|
|
1173
1192
|
type: "secondary",
|
|
1174
1193
|
style: {
|
|
1175
1194
|
textAlign: "center",
|
|
@@ -1178,7 +1197,7 @@ function An({ prompt: e, linkText: t, to: n }) {
|
|
|
1178
1197
|
children: [
|
|
1179
1198
|
e,
|
|
1180
1199
|
" ",
|
|
1181
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ q(f, {
|
|
1182
1201
|
to: n,
|
|
1183
1202
|
children: t
|
|
1184
1203
|
})
|
|
@@ -1187,9 +1206,9 @@ function An({ prompt: e, linkText: t, to: n }) {
|
|
|
1187
1206
|
}
|
|
1188
1207
|
//#endregion
|
|
1189
1208
|
//#region src/layouts/AuthPageLayout.tsx
|
|
1190
|
-
function
|
|
1191
|
-
let { token: i } =
|
|
1192
|
-
return /* @__PURE__ */
|
|
1209
|
+
function Ln({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
1210
|
+
let { token: i } = G.useToken();
|
|
1211
|
+
return /* @__PURE__ */ J(j, {
|
|
1193
1212
|
vertical: !0,
|
|
1194
1213
|
align: "stretch",
|
|
1195
1214
|
style: {
|
|
@@ -1200,7 +1219,7 @@ function jn({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1200
1219
|
background: i.colorBgLayout
|
|
1201
1220
|
},
|
|
1202
1221
|
children: [
|
|
1203
|
-
r ? /* @__PURE__ */
|
|
1222
|
+
r ? /* @__PURE__ */ q(j, {
|
|
1204
1223
|
justify: "flex-end",
|
|
1205
1224
|
style: {
|
|
1206
1225
|
flexShrink: 0,
|
|
@@ -1208,9 +1227,9 @@ function jn({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1208
1227
|
padding: 16,
|
|
1209
1228
|
background: i.colorBgLayout
|
|
1210
1229
|
},
|
|
1211
|
-
children: /* @__PURE__ */
|
|
1230
|
+
children: /* @__PURE__ */ q(rt, {})
|
|
1212
1231
|
}) : null,
|
|
1213
|
-
t ? /* @__PURE__ */
|
|
1232
|
+
t ? /* @__PURE__ */ q("div", {
|
|
1214
1233
|
style: {
|
|
1215
1234
|
flexShrink: 0,
|
|
1216
1235
|
textAlign: "center",
|
|
@@ -1218,14 +1237,14 @@ function jn({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1218
1237
|
},
|
|
1219
1238
|
children: t
|
|
1220
1239
|
}) : null,
|
|
1221
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1247
|
+
children: /* @__PURE__ */ J(j, {
|
|
1229
1248
|
vertical: !0,
|
|
1230
1249
|
align: "center",
|
|
1231
1250
|
justify: "flex-start",
|
|
@@ -1234,7 +1253,7 @@ function jn({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1234
1253
|
minHeight: "100%",
|
|
1235
1254
|
padding: "0 24px 24px"
|
|
1236
1255
|
},
|
|
1237
|
-
children: [e, n ? /* @__PURE__ */
|
|
1256
|
+
children: [e, n ? /* @__PURE__ */ q("div", {
|
|
1238
1257
|
style: {
|
|
1239
1258
|
marginTop: 16,
|
|
1240
1259
|
width: "100%",
|
|
@@ -1249,27 +1268,27 @@ function jn({ 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__ */
|
|
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__ */
|
|
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
|
|
1260
1279
|
}) : null),
|
|
1261
1280
|
showThemeToolbar: a,
|
|
1262
|
-
children: /* @__PURE__ */
|
|
1281
|
+
children: /* @__PURE__ */ J(T, {
|
|
1263
1282
|
style: {
|
|
1264
1283
|
width: "100%",
|
|
1265
1284
|
maxWidth: 360
|
|
1266
1285
|
},
|
|
1267
1286
|
title: e,
|
|
1268
|
-
children: [t ? /* @__PURE__ */
|
|
1287
|
+
children: [t ? /* @__PURE__ */ q(W.Paragraph, {
|
|
1269
1288
|
type: "secondary",
|
|
1270
1289
|
style: { marginTop: 0 },
|
|
1271
1290
|
children: t
|
|
1272
|
-
}) : null, /* @__PURE__ */
|
|
1291
|
+
}) : null, /* @__PURE__ */ J(M, {
|
|
1273
1292
|
layout: "vertical",
|
|
1274
1293
|
onFinish: async (e) => {
|
|
1275
1294
|
await l({
|
|
@@ -1279,28 +1298,28 @@ function Mn({ title: e = "Sign in", description: t = "Use any username and passw
|
|
|
1279
1298
|
}), u(o, { replace: !0 });
|
|
1280
1299
|
},
|
|
1281
1300
|
children: [
|
|
1282
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1308
|
+
children: /* @__PURE__ */ q(P, { autoComplete: "username" })
|
|
1290
1309
|
}),
|
|
1291
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1317
|
+
children: /* @__PURE__ */ q(P.Password, { autoComplete: "current-password" })
|
|
1299
1318
|
}),
|
|
1300
1319
|
i,
|
|
1301
|
-
/* @__PURE__ */
|
|
1320
|
+
/* @__PURE__ */ q(M.Item, {
|
|
1302
1321
|
style: { marginBottom: 0 },
|
|
1303
|
-
children: /* @__PURE__ */
|
|
1322
|
+
children: /* @__PURE__ */ q(w, {
|
|
1304
1323
|
type: "primary",
|
|
1305
1324
|
htmlType: "submit",
|
|
1306
1325
|
block: !0,
|
|
@@ -1314,16 +1333,132 @@ function Mn({ 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
|
|
1318
|
-
return /* @__PURE__ */
|
|
1336
|
+
function zn({ title: e }) {
|
|
1337
|
+
return /* @__PURE__ */ q(W.Title, {
|
|
1319
1338
|
level: 3,
|
|
1320
1339
|
style: { marginTop: 0 },
|
|
1321
1340
|
children: e
|
|
1322
1341
|
});
|
|
1323
1342
|
}
|
|
1324
1343
|
//#endregion
|
|
1344
|
+
//#region src/components/AppHub.tsx
|
|
1345
|
+
function Bn({ apps: e, menuItems: t, onAppClick: n, onMenuClick: r, menuSearchPlaceholder: i = "Search menus across apps…", className: a, maxWidth: o = 960 }) {
|
|
1346
|
+
let s = v(), { token: c } = G.useToken(), [u, f] = d(""), p = (e) => {
|
|
1347
|
+
if (n) {
|
|
1348
|
+
n(e);
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
s(e.path);
|
|
1352
|
+
}, m = (e) => {
|
|
1353
|
+
if (r) {
|
|
1354
|
+
r(e);
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
s(e.path);
|
|
1358
|
+
}, h = u.trim(), g = l(() => t && h ? bt(t, h) : [], [t, h]), _ = !!(t && h);
|
|
1359
|
+
return /* @__PURE__ */ J("div", {
|
|
1360
|
+
className: a,
|
|
1361
|
+
style: {
|
|
1362
|
+
width: "100%",
|
|
1363
|
+
maxWidth: o,
|
|
1364
|
+
marginInline: "auto",
|
|
1365
|
+
paddingInline: c.paddingMD
|
|
1366
|
+
},
|
|
1367
|
+
children: [t?.length ? /* @__PURE__ */ q("div", {
|
|
1368
|
+
style: {
|
|
1369
|
+
maxWidth: 480,
|
|
1370
|
+
margin: "0 auto 24px"
|
|
1371
|
+
},
|
|
1372
|
+
children: /* @__PURE__ */ q(it, {
|
|
1373
|
+
value: u,
|
|
1374
|
+
onChange: f,
|
|
1375
|
+
placeholder: i,
|
|
1376
|
+
variant: "app"
|
|
1377
|
+
})
|
|
1378
|
+
}) : null, _ ? /* @__PURE__ */ q(te, {
|
|
1379
|
+
bordered: !0,
|
|
1380
|
+
dataSource: g,
|
|
1381
|
+
locale: { emptyText: "No menus match your search." },
|
|
1382
|
+
style: {
|
|
1383
|
+
background: c.colorBgContainer,
|
|
1384
|
+
borderRadius: c.borderRadiusLG
|
|
1385
|
+
},
|
|
1386
|
+
renderItem: (e) => {
|
|
1387
|
+
let t = e.Icon;
|
|
1388
|
+
return /* @__PURE__ */ q(te.Item, {
|
|
1389
|
+
style: { cursor: "pointer" },
|
|
1390
|
+
onClick: () => m(e),
|
|
1391
|
+
children: /* @__PURE__ */ q(te.Item.Meta, {
|
|
1392
|
+
avatar: t ? /* @__PURE__ */ q("span", {
|
|
1393
|
+
style: {
|
|
1394
|
+
fontSize: 20,
|
|
1395
|
+
lineHeight: 1
|
|
1396
|
+
},
|
|
1397
|
+
children: /* @__PURE__ */ q(t, {})
|
|
1398
|
+
}) : void 0,
|
|
1399
|
+
title: _t(e),
|
|
1400
|
+
description: e.group
|
|
1401
|
+
})
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
}) : /* @__PURE__ */ q(R, {
|
|
1405
|
+
gutter: [16, 16],
|
|
1406
|
+
justify: "center",
|
|
1407
|
+
children: e.map((e) => {
|
|
1408
|
+
let t = e.Icon;
|
|
1409
|
+
return /* @__PURE__ */ q(E, {
|
|
1410
|
+
xs: 12,
|
|
1411
|
+
sm: 8,
|
|
1412
|
+
md: 6,
|
|
1413
|
+
lg: 4,
|
|
1414
|
+
style: { maxWidth: 200 },
|
|
1415
|
+
children: /* @__PURE__ */ q(T, {
|
|
1416
|
+
hoverable: !0,
|
|
1417
|
+
onClick: () => p(e),
|
|
1418
|
+
styles: { body: {
|
|
1419
|
+
textAlign: "center",
|
|
1420
|
+
padding: c.paddingLG
|
|
1421
|
+
} },
|
|
1422
|
+
children: /* @__PURE__ */ J(B, {
|
|
1423
|
+
orientation: "vertical",
|
|
1424
|
+
size: "middle",
|
|
1425
|
+
children: [t ? /* @__PURE__ */ q("span", {
|
|
1426
|
+
style: {
|
|
1427
|
+
fontSize: 40,
|
|
1428
|
+
lineHeight: 1
|
|
1429
|
+
},
|
|
1430
|
+
children: /* @__PURE__ */ q(t, {})
|
|
1431
|
+
}) : null, /* @__PURE__ */ q(W.Text, {
|
|
1432
|
+
strong: !0,
|
|
1433
|
+
children: e.label
|
|
1434
|
+
})]
|
|
1435
|
+
})
|
|
1436
|
+
})
|
|
1437
|
+
}, e.path);
|
|
1438
|
+
})
|
|
1439
|
+
})]
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
//#endregion
|
|
1443
|
+
//#region src/components/AppLauncherButton.tsx
|
|
1444
|
+
function Vn({ hubPath: e = "/", label: t = "Apps", onClick: n }) {
|
|
1445
|
+
let r = v();
|
|
1446
|
+
return /* @__PURE__ */ q(w, {
|
|
1447
|
+
type: "text",
|
|
1448
|
+
icon: /* @__PURE__ */ q(ue, {}),
|
|
1449
|
+
onClick: () => {
|
|
1450
|
+
if (n) {
|
|
1451
|
+
n();
|
|
1452
|
+
return;
|
|
1453
|
+
}
|
|
1454
|
+
r(e);
|
|
1455
|
+
},
|
|
1456
|
+
children: t
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
//#endregion
|
|
1325
1460
|
//#region src/crud/utils/sortQueryParam.ts
|
|
1326
|
-
function
|
|
1461
|
+
function Hn(e) {
|
|
1327
1462
|
if (!e) return [];
|
|
1328
1463
|
let t = [];
|
|
1329
1464
|
for (let n of e.split(",").map((e) => e.trim()).filter(Boolean)) {
|
|
@@ -1347,17 +1482,17 @@ function Pn(e) {
|
|
|
1347
1482
|
}
|
|
1348
1483
|
return t;
|
|
1349
1484
|
}
|
|
1350
|
-
function
|
|
1485
|
+
function Un(e) {
|
|
1351
1486
|
return e.length === 0 ? null : e.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
|
|
1352
1487
|
}
|
|
1353
|
-
function
|
|
1488
|
+
function Wn(e) {
|
|
1354
1489
|
return new Map(e.map((e, t) => [e.field, t + 1]));
|
|
1355
1490
|
}
|
|
1356
1491
|
//#endregion
|
|
1357
1492
|
//#region src/crud/context/ListContext.tsx
|
|
1358
|
-
var
|
|
1359
|
-
function
|
|
1360
|
-
let [r, i] = d([]), o = l(() => new Set(n.map((e) => e.field)), [n]), s = l(() => new Map(n.map((e) => [e.field, e.order])), [n]), c = l(() =>
|
|
1493
|
+
var Gn = t(null);
|
|
1494
|
+
function Kn({ children: e, toggleSort: t, sort: n }) {
|
|
1495
|
+
let [r, i] = d([]), o = l(() => new Set(n.map((e) => e.field)), [n]), s = l(() => new Map(n.map((e) => [e.field, e.order])), [n]), c = l(() => Wn(n), [n]), u = a((e) => (i((t) => {
|
|
1361
1496
|
let n = t.findIndex((t) => t.key === e.key);
|
|
1362
1497
|
if (n < 0) return [...t, e];
|
|
1363
1498
|
if (t[n] === e) return t;
|
|
@@ -1380,23 +1515,23 @@ function Rn({ children: e, toggleSort: t, sort: n }) {
|
|
|
1380
1515
|
c,
|
|
1381
1516
|
u
|
|
1382
1517
|
]);
|
|
1383
|
-
return /* @__PURE__ */
|
|
1518
|
+
return /* @__PURE__ */ q(Gn.Provider, {
|
|
1384
1519
|
value: f,
|
|
1385
1520
|
children: e
|
|
1386
1521
|
});
|
|
1387
1522
|
}
|
|
1388
|
-
function
|
|
1389
|
-
let e = o(
|
|
1523
|
+
function qn() {
|
|
1524
|
+
let e = o(Gn);
|
|
1390
1525
|
if (!e) throw Error("Column components must be used within ResourceList");
|
|
1391
1526
|
return e;
|
|
1392
1527
|
}
|
|
1393
|
-
function
|
|
1394
|
-
let { registerColumn: t } =
|
|
1528
|
+
function Jn(e) {
|
|
1529
|
+
let { registerColumn: t } = qn();
|
|
1395
1530
|
s(() => t(e), [t, e]);
|
|
1396
1531
|
}
|
|
1397
1532
|
//#endregion
|
|
1398
1533
|
//#region src/crud/utils/useDebouncedValue.ts
|
|
1399
|
-
function
|
|
1534
|
+
function Yn(e, t) {
|
|
1400
1535
|
let [n, r] = d(e);
|
|
1401
1536
|
return s(() => {
|
|
1402
1537
|
if (t <= 0) {
|
|
@@ -1409,42 +1544,42 @@ function Vn(e, t) {
|
|
|
1409
1544
|
}
|
|
1410
1545
|
//#endregion
|
|
1411
1546
|
//#region src/crud/filters/TextFilter.tsx
|
|
1412
|
-
var
|
|
1413
|
-
function
|
|
1547
|
+
var Xn = 300;
|
|
1548
|
+
function Zn(e) {
|
|
1414
1549
|
if (!(e == null || e === "")) return String(e);
|
|
1415
1550
|
}
|
|
1416
|
-
function
|
|
1417
|
-
let [i, a] = d(() => e ?? ""), o =
|
|
1551
|
+
function Qn({ value: e, onChange: t, placeholder: n, debounceMs: r }) {
|
|
1552
|
+
let [i, a] = d(() => e ?? ""), o = Yn(i, r);
|
|
1418
1553
|
return s(() => {
|
|
1419
1554
|
a(e ?? "");
|
|
1420
1555
|
}, [e]), s(() => {
|
|
1421
1556
|
if (r <= 0 || o !== i) return;
|
|
1422
|
-
let n =
|
|
1423
|
-
n !==
|
|
1557
|
+
let n = Zn(o);
|
|
1558
|
+
n !== Zn(e) && t(n);
|
|
1424
1559
|
}, [
|
|
1425
1560
|
o,
|
|
1426
1561
|
i,
|
|
1427
1562
|
r,
|
|
1428
1563
|
t,
|
|
1429
1564
|
e
|
|
1430
|
-
]), /* @__PURE__ */
|
|
1565
|
+
]), /* @__PURE__ */ q(P, {
|
|
1431
1566
|
allowClear: !0,
|
|
1432
1567
|
placeholder: n,
|
|
1433
1568
|
value: i,
|
|
1434
1569
|
onChange: (e) => {
|
|
1435
1570
|
let n = e.target.value;
|
|
1436
|
-
a(n), (r <= 0 || n === "") && t(
|
|
1571
|
+
a(n), (r <= 0 || n === "") && t(Zn(n));
|
|
1437
1572
|
},
|
|
1438
1573
|
style: { minWidth: 160 }
|
|
1439
1574
|
});
|
|
1440
1575
|
}
|
|
1441
|
-
function
|
|
1442
|
-
let i =
|
|
1443
|
-
return
|
|
1576
|
+
function $n({ source: e, label: t, placeholder: n, debounceMs: r }) {
|
|
1577
|
+
let i = nr(), a = r ?? i?.textFilterDebounceMs ?? 300;
|
|
1578
|
+
return rr(l(() => ({
|
|
1444
1579
|
key: e,
|
|
1445
1580
|
source: e,
|
|
1446
1581
|
label: t,
|
|
1447
|
-
render: ({ value: r, onChange: i }) => /* @__PURE__ */
|
|
1582
|
+
render: ({ value: r, onChange: i }) => /* @__PURE__ */ q(Qn, {
|
|
1448
1583
|
value: r,
|
|
1449
1584
|
onChange: i,
|
|
1450
1585
|
placeholder: n ?? t ?? e,
|
|
@@ -1459,8 +1594,8 @@ function Gn({ source: e, label: t, placeholder: n, debounceMs: r }) {
|
|
|
1459
1594
|
}
|
|
1460
1595
|
//#endregion
|
|
1461
1596
|
//#region src/crud/context/FilterContext.tsx
|
|
1462
|
-
var
|
|
1463
|
-
function
|
|
1597
|
+
var er = t(null);
|
|
1598
|
+
function tr({ children: e, values: t, setFilterValue: n, textFilterDebounceMs: r = 300 }) {
|
|
1464
1599
|
let [i, o] = d([]), s = a((e) => (o((t) => {
|
|
1465
1600
|
let n = t.findIndex((t) => t.key === e.key);
|
|
1466
1601
|
if (n < 0) return [...t, e];
|
|
@@ -1482,25 +1617,25 @@ function qn({ children: e, values: t, setFilterValue: n, textFilterDebounceMs: r
|
|
|
1482
1617
|
s,
|
|
1483
1618
|
r
|
|
1484
1619
|
]);
|
|
1485
|
-
return /* @__PURE__ */
|
|
1620
|
+
return /* @__PURE__ */ q(er.Provider, {
|
|
1486
1621
|
value: c,
|
|
1487
1622
|
children: e
|
|
1488
1623
|
});
|
|
1489
1624
|
}
|
|
1490
|
-
function
|
|
1491
|
-
return o(
|
|
1625
|
+
function nr() {
|
|
1626
|
+
return o(er);
|
|
1492
1627
|
}
|
|
1493
|
-
function
|
|
1494
|
-
let t =
|
|
1628
|
+
function rr(e) {
|
|
1629
|
+
let t = nr()?.registerFilter;
|
|
1495
1630
|
s(() => {
|
|
1496
1631
|
if (t) return t(e);
|
|
1497
1632
|
}, [t, e]);
|
|
1498
1633
|
}
|
|
1499
1634
|
//#endregion
|
|
1500
1635
|
//#region src/crud/context/FormContext.tsx
|
|
1501
|
-
var
|
|
1502
|
-
function
|
|
1503
|
-
return /* @__PURE__ */
|
|
1636
|
+
var ir = t(null);
|
|
1637
|
+
function ar({ children: e, resource: t, isNew: n, disabled: r }) {
|
|
1638
|
+
return /* @__PURE__ */ q(ir.Provider, {
|
|
1504
1639
|
value: {
|
|
1505
1640
|
resource: t,
|
|
1506
1641
|
isNew: n,
|
|
@@ -1509,35 +1644,35 @@ function Zn({ children: e, resource: t, isNew: n, disabled: r }) {
|
|
|
1509
1644
|
children: e
|
|
1510
1645
|
});
|
|
1511
1646
|
}
|
|
1512
|
-
function
|
|
1513
|
-
return o(
|
|
1647
|
+
function or() {
|
|
1648
|
+
return o(ir);
|
|
1514
1649
|
}
|
|
1515
1650
|
//#endregion
|
|
1516
1651
|
//#region src/crud/context/FormSectionContext.tsx
|
|
1517
|
-
var
|
|
1518
|
-
function
|
|
1519
|
-
return /* @__PURE__ */
|
|
1652
|
+
var sr = t(null);
|
|
1653
|
+
function cr({ sourcesRef: e, children: t }) {
|
|
1654
|
+
return /* @__PURE__ */ q(sr.Provider, {
|
|
1520
1655
|
value: e,
|
|
1521
1656
|
children: t
|
|
1522
1657
|
});
|
|
1523
1658
|
}
|
|
1524
|
-
function
|
|
1525
|
-
return o(
|
|
1659
|
+
function lr() {
|
|
1660
|
+
return o(sr);
|
|
1526
1661
|
}
|
|
1527
1662
|
//#endregion
|
|
1528
1663
|
//#region src/crud/context/PayloadFieldsContext.tsx
|
|
1529
|
-
var
|
|
1530
|
-
function
|
|
1531
|
-
return /* @__PURE__ */
|
|
1664
|
+
var ur = t(null);
|
|
1665
|
+
function dr({ children: e, fieldsRef: t }) {
|
|
1666
|
+
return /* @__PURE__ */ q(ur.Provider, {
|
|
1532
1667
|
value: t,
|
|
1533
1668
|
children: e
|
|
1534
1669
|
});
|
|
1535
1670
|
}
|
|
1536
|
-
function
|
|
1537
|
-
return o(
|
|
1671
|
+
function fr() {
|
|
1672
|
+
return o(ur);
|
|
1538
1673
|
}
|
|
1539
|
-
function
|
|
1540
|
-
let n =
|
|
1674
|
+
function pr(e, t = !0) {
|
|
1675
|
+
let n = fr();
|
|
1541
1676
|
s(() => {
|
|
1542
1677
|
if (!(!t || !n)) return n.current.add(e), () => {
|
|
1543
1678
|
n.current.delete(e);
|
|
@@ -1548,8 +1683,8 @@ function ar(e, t = !0) {
|
|
|
1548
1683
|
t
|
|
1549
1684
|
]);
|
|
1550
1685
|
}
|
|
1551
|
-
function
|
|
1552
|
-
let n =
|
|
1686
|
+
function mr(e, t = !0) {
|
|
1687
|
+
let n = lr();
|
|
1553
1688
|
s(() => {
|
|
1554
1689
|
if (!(!t || !n)) return n.current.add(e), () => {
|
|
1555
1690
|
n.current.delete(e);
|
|
@@ -1562,18 +1697,18 @@ function or(e, t = !0) {
|
|
|
1562
1697
|
}
|
|
1563
1698
|
//#endregion
|
|
1564
1699
|
//#region src/crud/context/InlineFieldsRegistry.tsx
|
|
1565
|
-
var
|
|
1566
|
-
function
|
|
1567
|
-
return /* @__PURE__ */
|
|
1700
|
+
var hr = t(null);
|
|
1701
|
+
function gr({ children: e, registryRef: t }) {
|
|
1702
|
+
return /* @__PURE__ */ q(hr.Provider, {
|
|
1568
1703
|
value: t,
|
|
1569
1704
|
children: e
|
|
1570
1705
|
});
|
|
1571
1706
|
}
|
|
1572
|
-
function
|
|
1573
|
-
return o(
|
|
1707
|
+
function _r() {
|
|
1708
|
+
return o(hr);
|
|
1574
1709
|
}
|
|
1575
|
-
function
|
|
1576
|
-
let a =
|
|
1710
|
+
function vr(e, t, n, r, i = !0) {
|
|
1711
|
+
let a = _r();
|
|
1577
1712
|
s(() => {
|
|
1578
1713
|
if (!(!i || !a)) return a.current.set(e, {
|
|
1579
1714
|
field: e,
|
|
@@ -1594,29 +1729,29 @@ function ur(e, t, n, r, i = !0) {
|
|
|
1594
1729
|
}
|
|
1595
1730
|
//#endregion
|
|
1596
1731
|
//#region src/crud/FormGlobalErrorsAlert.tsx
|
|
1597
|
-
function
|
|
1598
|
-
return e.length ? e.length === 1 ? /* @__PURE__ */
|
|
1732
|
+
function yr({ errors: e }) {
|
|
1733
|
+
return e.length ? e.length === 1 ? /* @__PURE__ */ q(x, {
|
|
1599
1734
|
type: "error",
|
|
1600
1735
|
title: e[0],
|
|
1601
1736
|
showIcon: !0,
|
|
1602
1737
|
style: { marginBottom: 16 }
|
|
1603
|
-
}) : /* @__PURE__ */
|
|
1738
|
+
}) : /* @__PURE__ */ q(x, {
|
|
1604
1739
|
type: "error",
|
|
1605
1740
|
title: "Could not save",
|
|
1606
1741
|
showIcon: !0,
|
|
1607
1742
|
style: { marginBottom: 16 },
|
|
1608
|
-
description: /* @__PURE__ */
|
|
1743
|
+
description: /* @__PURE__ */ q("ul", {
|
|
1609
1744
|
style: {
|
|
1610
1745
|
margin: 0,
|
|
1611
1746
|
paddingLeft: 20
|
|
1612
1747
|
},
|
|
1613
|
-
children: e.map((e) => /* @__PURE__ */
|
|
1748
|
+
children: e.map((e) => /* @__PURE__ */ q("li", { children: e }, e))
|
|
1614
1749
|
})
|
|
1615
1750
|
}) : null;
|
|
1616
1751
|
}
|
|
1617
1752
|
//#endregion
|
|
1618
1753
|
//#region src/crud/utils/getFormValue.ts
|
|
1619
|
-
function
|
|
1754
|
+
function br(e, t) {
|
|
1620
1755
|
let n = t.split("."), r = e;
|
|
1621
1756
|
for (let e of n) {
|
|
1622
1757
|
if (typeof r != "object" || !r) return;
|
|
@@ -1626,7 +1761,7 @@ function fr(e, t) {
|
|
|
1626
1761
|
}
|
|
1627
1762
|
//#endregion
|
|
1628
1763
|
//#region src/crud/utils/setFormValue.ts
|
|
1629
|
-
function
|
|
1764
|
+
function xr(e, t, n) {
|
|
1630
1765
|
let r = t.split("."), i = e;
|
|
1631
1766
|
for (let e = 0; e < r.length - 1; e++) {
|
|
1632
1767
|
let t = r[e], n = i[t];
|
|
@@ -1636,18 +1771,18 @@ function pr(e, t, n) {
|
|
|
1636
1771
|
}
|
|
1637
1772
|
//#endregion
|
|
1638
1773
|
//#region src/crud/utils/buildFormPayload.ts
|
|
1639
|
-
function
|
|
1774
|
+
function Sr(e, t) {
|
|
1640
1775
|
if (t.length === 0) return { ...e };
|
|
1641
1776
|
let n = {};
|
|
1642
1777
|
for (let r of t) {
|
|
1643
|
-
let t =
|
|
1644
|
-
t !== void 0 &&
|
|
1778
|
+
let t = br(e, r);
|
|
1779
|
+
t !== void 0 && xr(n, r, t);
|
|
1645
1780
|
}
|
|
1646
1781
|
return n;
|
|
1647
1782
|
}
|
|
1648
1783
|
//#endregion
|
|
1649
1784
|
//#region src/crud/utils/buildInlineRowsPayload.ts
|
|
1650
|
-
function
|
|
1785
|
+
function Cr(e, t, n) {
|
|
1651
1786
|
if (!Array.isArray(e)) return [];
|
|
1652
1787
|
let r = e.map((e) => {
|
|
1653
1788
|
if (!e || typeof e != "object") return {};
|
|
@@ -1663,34 +1798,34 @@ function hr(e, t, n) {
|
|
|
1663
1798
|
}
|
|
1664
1799
|
//#endregion
|
|
1665
1800
|
//#region src/crud/utils/hasUploadValues.ts
|
|
1666
|
-
function
|
|
1667
|
-
return e instanceof Blob ? !0 : Array.isArray(e) ? e.some(
|
|
1801
|
+
function wr(e) {
|
|
1802
|
+
return e instanceof Blob ? !0 : Array.isArray(e) ? e.some(wr) : e && typeof e == "object" ? Object.values(e).some(wr) : !1;
|
|
1668
1803
|
}
|
|
1669
1804
|
//#endregion
|
|
1670
1805
|
//#region src/crud/utils/uploadReferenceUtils.ts
|
|
1671
|
-
function
|
|
1806
|
+
function Tr(e) {
|
|
1672
1807
|
return /^https?:\/\//i.test(e) || e.startsWith("/media/");
|
|
1673
1808
|
}
|
|
1674
|
-
function
|
|
1809
|
+
function Er(e, t) {
|
|
1675
1810
|
if (!t) return e;
|
|
1676
|
-
if (typeof e == "string") return
|
|
1677
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
1811
|
+
if (typeof e == "string") return Tr(e) ? void 0 : e;
|
|
1812
|
+
if (Array.isArray(e)) return e.map((e) => Er(e, t)).filter((e) => e !== void 0);
|
|
1678
1813
|
if (e && typeof e == "object" && !(e instanceof Blob)) {
|
|
1679
1814
|
let n = {};
|
|
1680
1815
|
for (let [r, i] of Object.entries(e)) {
|
|
1681
|
-
let e =
|
|
1816
|
+
let e = Er(i, t);
|
|
1682
1817
|
e !== void 0 && (n[r] = e);
|
|
1683
1818
|
}
|
|
1684
1819
|
return n;
|
|
1685
1820
|
}
|
|
1686
1821
|
return e;
|
|
1687
1822
|
}
|
|
1688
|
-
function
|
|
1689
|
-
return
|
|
1823
|
+
function Dr(e, t = !0) {
|
|
1824
|
+
return Er(e, t);
|
|
1690
1825
|
}
|
|
1691
1826
|
//#endregion
|
|
1692
1827
|
//#region src/crud/utils/toFormData.ts
|
|
1693
|
-
function
|
|
1828
|
+
function Or(e, t, n, r) {
|
|
1694
1829
|
if (n !== void 0) {
|
|
1695
1830
|
if (n === null) {
|
|
1696
1831
|
e.append(t, "");
|
|
@@ -1705,106 +1840,106 @@ function br(e, t, n, r) {
|
|
|
1705
1840
|
return;
|
|
1706
1841
|
}
|
|
1707
1842
|
if (typeof n == "string") {
|
|
1708
|
-
if (r.skipExistingUploadUrls &&
|
|
1843
|
+
if (r.skipExistingUploadUrls && Tr(n)) return;
|
|
1709
1844
|
e.append(t, n);
|
|
1710
1845
|
return;
|
|
1711
1846
|
}
|
|
1712
1847
|
if (Array.isArray(n)) {
|
|
1713
1848
|
n.forEach((n, i) => {
|
|
1714
|
-
|
|
1849
|
+
Or(e, `${t}[${i}]`, n, r);
|
|
1715
1850
|
});
|
|
1716
1851
|
return;
|
|
1717
1852
|
}
|
|
1718
1853
|
if (typeof n == "object") {
|
|
1719
|
-
for (let [i, a] of Object.entries(n))
|
|
1854
|
+
for (let [i, a] of Object.entries(n)) Or(e, `${t}[${i}]`, a, r);
|
|
1720
1855
|
return;
|
|
1721
1856
|
}
|
|
1722
1857
|
e.append(t, String(n));
|
|
1723
1858
|
}
|
|
1724
1859
|
}
|
|
1725
|
-
function
|
|
1860
|
+
function kr(e, t) {
|
|
1726
1861
|
let n = { skipExistingUploadUrls: t?.skipExistingUploadUrls ?? !0 }, r = new FormData();
|
|
1727
|
-
for (let [t, i] of Object.entries(e))
|
|
1862
|
+
for (let [t, i] of Object.entries(e)) Or(r, t, i, n);
|
|
1728
1863
|
return r;
|
|
1729
1864
|
}
|
|
1730
1865
|
//#endregion
|
|
1731
1866
|
//#region src/crud/utils/prepareFormSubmitBody.ts
|
|
1732
|
-
function
|
|
1867
|
+
function Ar(e, t) {
|
|
1733
1868
|
let n = t?.skipExistingUploadUrls ?? !0;
|
|
1734
|
-
return
|
|
1869
|
+
return wr(e) ? kr(e, t) : Dr(e, n);
|
|
1735
1870
|
}
|
|
1736
1871
|
//#endregion
|
|
1737
1872
|
//#region src/crud/utils/buildResourceFormSubmitBody.ts
|
|
1738
|
-
function
|
|
1739
|
-
let i =
|
|
1873
|
+
function jr(e, t, n, r) {
|
|
1874
|
+
let i = Sr(e, t);
|
|
1740
1875
|
if (n) for (let t of n) {
|
|
1741
1876
|
let n = e[t.field], r = t.payloadKey ?? t.field;
|
|
1742
|
-
i[r] =
|
|
1877
|
+
i[r] = Cr(n, t.sources, { transformRows: t.transformRows });
|
|
1743
1878
|
}
|
|
1744
|
-
return
|
|
1879
|
+
return Ar(i, r);
|
|
1745
1880
|
}
|
|
1746
1881
|
//#endregion
|
|
1747
1882
|
//#region src/crud/utils/formErrors.ts
|
|
1748
|
-
function
|
|
1883
|
+
function Mr(e) {
|
|
1749
1884
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
1750
1885
|
}
|
|
1751
|
-
function
|
|
1886
|
+
function Nr(e) {
|
|
1752
1887
|
return Array.isArray(e) ? e.join(", ") : e;
|
|
1753
1888
|
}
|
|
1754
|
-
function
|
|
1889
|
+
function Pr(e, t, n) {
|
|
1755
1890
|
if (t.has(e)) return !0;
|
|
1756
1891
|
let r = e.match(/^([^.]+)\.(\d+)\.([^.]+)$/);
|
|
1757
1892
|
if (!r) return !1;
|
|
1758
1893
|
let [, i, , a] = r;
|
|
1759
1894
|
return n.get(i)?.sources.includes(a) ?? !1;
|
|
1760
1895
|
}
|
|
1761
|
-
function
|
|
1762
|
-
let r = {}, i = [...
|
|
1763
|
-
for (let [a, o] of Object.entries(e.fields ?? {}))
|
|
1896
|
+
function Fr(e, t, n) {
|
|
1897
|
+
let r = {}, i = [...Mr(e.global)];
|
|
1898
|
+
for (let [a, o] of Object.entries(e.fields ?? {})) Pr(a, t, n) ? r[a] = o : i.push(Nr(o));
|
|
1764
1899
|
return {
|
|
1765
1900
|
fieldErrors: r,
|
|
1766
1901
|
globalErrors: i
|
|
1767
1902
|
};
|
|
1768
1903
|
}
|
|
1769
|
-
function
|
|
1904
|
+
function Ir(e, t) {
|
|
1770
1905
|
for (let [n, r] of Object.entries(t)) e.setError(n, {
|
|
1771
1906
|
type: "server",
|
|
1772
|
-
message:
|
|
1907
|
+
message: Nr(r)
|
|
1773
1908
|
});
|
|
1774
1909
|
}
|
|
1775
|
-
function
|
|
1776
|
-
let t =
|
|
1910
|
+
function Lr(e) {
|
|
1911
|
+
let t = ln(e);
|
|
1777
1912
|
if (t && !/application\/json/i.test(t)) return `non-JSON response (Content-Type: ${t})`;
|
|
1778
1913
|
}
|
|
1779
|
-
async function
|
|
1780
|
-
let a = await
|
|
1914
|
+
async function Rr(e, t, n, r, i) {
|
|
1915
|
+
let a = await fn(n);
|
|
1781
1916
|
if (a != null) {
|
|
1782
1917
|
let n = e.parseFormError?.({ body: a }, r);
|
|
1783
1918
|
if (n) {
|
|
1784
1919
|
let e = new Set(i.payloadFields), r = /* @__PURE__ */ new Map();
|
|
1785
1920
|
for (let e of i.inlineRegistry) r.set(e.field, e);
|
|
1786
|
-
let { fieldErrors: a, globalErrors: o } =
|
|
1787
|
-
if (Object.keys(a).length || o.length) return
|
|
1921
|
+
let { fieldErrors: a, globalErrors: o } = Fr(n, e, r);
|
|
1922
|
+
if (Object.keys(a).length || o.length) return Ir(t, a), {
|
|
1788
1923
|
handled: !0,
|
|
1789
1924
|
globalErrors: o
|
|
1790
1925
|
};
|
|
1791
1926
|
}
|
|
1792
1927
|
return {
|
|
1793
1928
|
handled: !0,
|
|
1794
|
-
globalErrors: [
|
|
1929
|
+
globalErrors: [sn(a)]
|
|
1795
1930
|
};
|
|
1796
1931
|
}
|
|
1797
|
-
return
|
|
1932
|
+
return cn(n) == null ? {
|
|
1798
1933
|
handled: !1,
|
|
1799
1934
|
globalErrors: []
|
|
1800
1935
|
} : {
|
|
1801
1936
|
handled: !0,
|
|
1802
|
-
globalErrors: [
|
|
1937
|
+
globalErrors: [sn(null, { hint: Lr(n) })]
|
|
1803
1938
|
};
|
|
1804
1939
|
}
|
|
1805
1940
|
//#endregion
|
|
1806
1941
|
//#region src/crud/utils/useAbortableEffect.ts
|
|
1807
|
-
function
|
|
1942
|
+
function zr(e, t) {
|
|
1808
1943
|
s(() => {
|
|
1809
1944
|
let t = new AbortController();
|
|
1810
1945
|
return e(t.signal), () => t.abort();
|
|
@@ -1812,7 +1947,7 @@ function jr(e, t) {
|
|
|
1812
1947
|
}
|
|
1813
1948
|
//#endregion
|
|
1814
1949
|
//#region src/crud/utils/useFormRecord.ts
|
|
1815
|
-
function
|
|
1950
|
+
function Br({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultValues: s, enabled: c = !0 }) {
|
|
1816
1951
|
let [l, u] = d(!r), [f, p] = d(0), m = a(async (a) => {
|
|
1817
1952
|
if (r || !n) {
|
|
1818
1953
|
s ? i.reset({ ...s }) : i.reset({}), u(!1);
|
|
@@ -1824,7 +1959,7 @@ function Mr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultV
|
|
|
1824
1959
|
if (a?.aborted) return;
|
|
1825
1960
|
i.reset(r.data), p((e) => e + 1);
|
|
1826
1961
|
} catch (e) {
|
|
1827
|
-
|
|
1962
|
+
$t(e) || o.error(e instanceof Error ? e.message : "Load failed");
|
|
1828
1963
|
} finally {
|
|
1829
1964
|
a?.aborted || u(!1);
|
|
1830
1965
|
}
|
|
@@ -1837,20 +1972,20 @@ function Mr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, defaultV
|
|
|
1837
1972
|
o,
|
|
1838
1973
|
s
|
|
1839
1974
|
]);
|
|
1840
|
-
return
|
|
1975
|
+
return zr((e) => {
|
|
1841
1976
|
if (c) return m(e);
|
|
1842
1977
|
}, [c, m]), {
|
|
1843
1978
|
loading: l,
|
|
1844
1979
|
formVersion: f
|
|
1845
1980
|
};
|
|
1846
1981
|
}
|
|
1847
|
-
function
|
|
1982
|
+
function Vr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadFieldsRef: s, inlineRegistryRef: c, setGlobalErrors: l, onSuccess: u }) {
|
|
1848
1983
|
let [f, p] = d(!1);
|
|
1849
1984
|
return {
|
|
1850
1985
|
onSubmit: a(async (a) => {
|
|
1851
1986
|
l([]), p(!0);
|
|
1852
1987
|
try {
|
|
1853
|
-
let i =
|
|
1988
|
+
let i = jr(a, Array.from(s.current), c.current.values()), l;
|
|
1854
1989
|
if (r) l = (await e.create(t, i)).data, o.success("Created");
|
|
1855
1990
|
else if (n) l = (await e.update(t, {
|
|
1856
1991
|
id: n,
|
|
@@ -1859,7 +1994,7 @@ function Nr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
1859
1994
|
else return;
|
|
1860
1995
|
u?.(l);
|
|
1861
1996
|
} catch (n) {
|
|
1862
|
-
let { handled: a, globalErrors: u } = await
|
|
1997
|
+
let { handled: a, globalErrors: u } = await Rr(e, i, n, {
|
|
1863
1998
|
resource: t,
|
|
1864
1999
|
mutation: r ? "create" : "update",
|
|
1865
2000
|
inlineFieldPaths: Array.from(c.current.keys())
|
|
@@ -1888,8 +2023,8 @@ function Nr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
1888
2023
|
}
|
|
1889
2024
|
//#endregion
|
|
1890
2025
|
//#region src/crud/ResourceRecordForm.tsx
|
|
1891
|
-
function
|
|
1892
|
-
let m = t === "new" || !t, h = m ? void 0 : t, g =
|
|
2026
|
+
function Hr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0, canSave: o = !0, onCancel: s, cancelHref: c, onSuccess: l, loadingMode: p = "overlay" }) {
|
|
2027
|
+
let m = t === "new" || !t, h = m ? void 0 : t, g = Yt(), { message: _ } = S.useApp(), v = u(/* @__PURE__ */ new Set()), y = u(/* @__PURE__ */ new Map()), [b, x] = d([]), C = je({ defaultValues: i }), { loading: T, formVersion: E } = Br({
|
|
1893
2028
|
dp: g,
|
|
1894
2029
|
resource: e,
|
|
1895
2030
|
id: h,
|
|
@@ -1898,7 +2033,7 @@ function Pr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1898
2033
|
message: _,
|
|
1899
2034
|
defaultValues: i,
|
|
1900
2035
|
enabled: a
|
|
1901
|
-
}), { onSubmit: D, saving: O } =
|
|
2036
|
+
}), { onSubmit: D, saving: O } = Vr({
|
|
1902
2037
|
dp: g,
|
|
1903
2038
|
resource: e,
|
|
1904
2039
|
id: h,
|
|
@@ -1913,20 +2048,20 @@ function Pr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1913
2048
|
C.handleSubmit(D, () => {
|
|
1914
2049
|
_.warning("Please fix the errors below.");
|
|
1915
2050
|
})();
|
|
1916
|
-
},
|
|
2051
|
+
}, j = /* @__PURE__ */ q(w, {
|
|
1917
2052
|
disabled: k,
|
|
1918
2053
|
onClick: c ? void 0 : s,
|
|
1919
2054
|
children: "Cancel"
|
|
1920
|
-
}),
|
|
2055
|
+
}), ee = /* @__PURE__ */ q(ar, {
|
|
1921
2056
|
resource: e,
|
|
1922
2057
|
isNew: m,
|
|
1923
|
-
children: /* @__PURE__ */
|
|
2058
|
+
children: /* @__PURE__ */ q(dr, {
|
|
1924
2059
|
fieldsRef: v,
|
|
1925
|
-
children: /* @__PURE__ */
|
|
2060
|
+
children: /* @__PURE__ */ q(gr, {
|
|
1926
2061
|
registryRef: y,
|
|
1927
|
-
children: /* @__PURE__ */
|
|
2062
|
+
children: /* @__PURE__ */ J("div", {
|
|
1928
2063
|
style: { position: "relative" },
|
|
1929
|
-
children: [k && p === "overlay" ? /* @__PURE__ */
|
|
2064
|
+
children: [k && p === "overlay" ? /* @__PURE__ */ q("div", {
|
|
1930
2065
|
style: {
|
|
1931
2066
|
position: "absolute",
|
|
1932
2067
|
inset: 0,
|
|
@@ -1935,11 +2070,11 @@ function Pr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1935
2070
|
justifyContent: "center",
|
|
1936
2071
|
zIndex: 1
|
|
1937
2072
|
},
|
|
1938
|
-
children: /* @__PURE__ */
|
|
1939
|
-
}) : null, /* @__PURE__ */ n(
|
|
2073
|
+
children: /* @__PURE__ */ q(oe, {})
|
|
2074
|
+
}) : null, /* @__PURE__ */ n(ke, {
|
|
1940
2075
|
...C,
|
|
1941
2076
|
key: E
|
|
1942
|
-
}, /* @__PURE__ */
|
|
2077
|
+
}, /* @__PURE__ */ J(M, {
|
|
1943
2078
|
layout: "vertical",
|
|
1944
2079
|
onFinish: A,
|
|
1945
2080
|
style: p === "overlay" ? {
|
|
@@ -1947,23 +2082,23 @@ function Pr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1947
2082
|
pointerEvents: k ? "none" : void 0
|
|
1948
2083
|
} : void 0,
|
|
1949
2084
|
children: [
|
|
1950
|
-
/* @__PURE__ */
|
|
2085
|
+
/* @__PURE__ */ q(yr, { errors: b }),
|
|
1951
2086
|
r,
|
|
1952
|
-
/* @__PURE__ */
|
|
2087
|
+
/* @__PURE__ */ q(M.Item, {
|
|
1953
2088
|
style: {
|
|
1954
2089
|
marginTop: 16,
|
|
1955
2090
|
marginBottom: 0
|
|
1956
2091
|
},
|
|
1957
|
-
children: /* @__PURE__ */
|
|
2092
|
+
children: /* @__PURE__ */ J(B, { children: [/* @__PURE__ */ q(w, {
|
|
1958
2093
|
type: "primary",
|
|
1959
2094
|
htmlType: "submit",
|
|
1960
2095
|
loading: O,
|
|
1961
2096
|
disabled: k || !o,
|
|
1962
2097
|
children: "Save"
|
|
1963
|
-
}), c ? /* @__PURE__ */
|
|
2098
|
+
}), c ? /* @__PURE__ */ q(f, {
|
|
1964
2099
|
to: c,
|
|
1965
|
-
children:
|
|
1966
|
-
}) :
|
|
2100
|
+
children: j
|
|
2101
|
+
}) : j] })
|
|
1967
2102
|
})
|
|
1968
2103
|
]
|
|
1969
2104
|
}))]
|
|
@@ -1971,13 +2106,13 @@ function Pr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
1971
2106
|
})
|
|
1972
2107
|
})
|
|
1973
2108
|
});
|
|
1974
|
-
return T && !O && p === "replace" ? /* @__PURE__ */
|
|
2109
|
+
return T && !O && p === "replace" ? /* @__PURE__ */ q(oe, {}) : ee;
|
|
1975
2110
|
}
|
|
1976
2111
|
//#endregion
|
|
1977
2112
|
//#region src/crud/ResourceFormModal.tsx
|
|
1978
|
-
function
|
|
2113
|
+
function Ur({ resource: e, editId: t, onClose: n, children: r, title: i, permissions: a, defaultValues: o, width: s = 560, onSuccess: c }) {
|
|
1979
2114
|
let l = t === "new", u = t != null, d = X(), f = i ?? (l ? `New ${e}` : `Edit ${e}`), p = a ? Z(d, a, l ? "add" : "change") : !0;
|
|
1980
|
-
return /* @__PURE__ */
|
|
2115
|
+
return /* @__PURE__ */ q(ne, {
|
|
1981
2116
|
open: u,
|
|
1982
2117
|
title: f,
|
|
1983
2118
|
onCancel: n,
|
|
@@ -1985,7 +2120,7 @@ function Fr({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
1985
2120
|
destroyOnHidden: !0,
|
|
1986
2121
|
width: s,
|
|
1987
2122
|
maskClosable: !1,
|
|
1988
|
-
children: /* @__PURE__ */
|
|
2123
|
+
children: /* @__PURE__ */ q(S, { children: /* @__PURE__ */ q(Hr, {
|
|
1989
2124
|
resource: e,
|
|
1990
2125
|
id: t ?? void 0,
|
|
1991
2126
|
enabled: u,
|
|
@@ -2002,7 +2137,7 @@ function Fr({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
2002
2137
|
}
|
|
2003
2138
|
//#endregion
|
|
2004
2139
|
//#region src/crud/ListActionsBar.tsx
|
|
2005
|
-
function
|
|
2140
|
+
function Wr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelected: r, onSelectAllMatching: i, onClearSelection: o, actions: s, onExecute: c, selectedIds: u, running: f = !1 }) {
|
|
2006
2141
|
let [p, m] = d(), h = l(() => s.map((e) => ({
|
|
2007
2142
|
value: e.key,
|
|
2008
2143
|
label: e.label
|
|
@@ -2016,7 +2151,7 @@ function Ir({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2016
2151
|
e,
|
|
2017
2152
|
u
|
|
2018
2153
|
]), _ = n && !r && t > e;
|
|
2019
|
-
return /* @__PURE__ */
|
|
2154
|
+
return /* @__PURE__ */ J(B, {
|
|
2020
2155
|
wrap: !0,
|
|
2021
2156
|
style: {
|
|
2022
2157
|
marginBottom: 16,
|
|
@@ -2024,7 +2159,7 @@ function Ir({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2024
2159
|
},
|
|
2025
2160
|
align: "center",
|
|
2026
2161
|
children: [
|
|
2027
|
-
/* @__PURE__ */
|
|
2162
|
+
/* @__PURE__ */ J(W.Text, {
|
|
2028
2163
|
type: "secondary",
|
|
2029
2164
|
children: [
|
|
2030
2165
|
e,
|
|
@@ -2033,17 +2168,17 @@ function Ir({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2033
2168
|
" selected"
|
|
2034
2169
|
]
|
|
2035
2170
|
}),
|
|
2036
|
-
e > 0 ? /* @__PURE__ */
|
|
2171
|
+
e > 0 ? /* @__PURE__ */ q(w, {
|
|
2037
2172
|
type: "link",
|
|
2038
2173
|
size: "small",
|
|
2039
2174
|
onClick: o,
|
|
2040
2175
|
style: { padding: 0 },
|
|
2041
2176
|
children: "Clear selection"
|
|
2042
2177
|
}) : null,
|
|
2043
|
-
_ ? /* @__PURE__ */ K
|
|
2178
|
+
_ ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(W.Text, {
|
|
2044
2179
|
type: "secondary",
|
|
2045
2180
|
children: "·"
|
|
2046
|
-
}), /* @__PURE__ */
|
|
2181
|
+
}), /* @__PURE__ */ J(w, {
|
|
2047
2182
|
type: "link",
|
|
2048
2183
|
size: "small",
|
|
2049
2184
|
onClick: i,
|
|
@@ -2054,10 +2189,10 @@ function Ir({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2054
2189
|
" items matching filter"
|
|
2055
2190
|
]
|
|
2056
2191
|
})] }) : null,
|
|
2057
|
-
r && t > 0 ? /* @__PURE__ */ K
|
|
2192
|
+
r && t > 0 ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(W.Text, {
|
|
2058
2193
|
type: "secondary",
|
|
2059
2194
|
children: "·"
|
|
2060
|
-
}), /* @__PURE__ */
|
|
2195
|
+
}), /* @__PURE__ */ J(W.Text, {
|
|
2061
2196
|
type: "success",
|
|
2062
2197
|
children: [
|
|
2063
2198
|
"All ",
|
|
@@ -2065,7 +2200,7 @@ function Ir({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2065
2200
|
" items selected"
|
|
2066
2201
|
]
|
|
2067
2202
|
})] }) : null,
|
|
2068
|
-
/* @__PURE__ */
|
|
2203
|
+
/* @__PURE__ */ q(z, {
|
|
2069
2204
|
placeholder: "Action",
|
|
2070
2205
|
style: { minWidth: 200 },
|
|
2071
2206
|
options: h,
|
|
@@ -2074,7 +2209,7 @@ function Ir({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2074
2209
|
disabled: e === 0 || f,
|
|
2075
2210
|
allowClear: !0
|
|
2076
2211
|
}),
|
|
2077
|
-
/* @__PURE__ */
|
|
2212
|
+
/* @__PURE__ */ q(w, {
|
|
2078
2213
|
type: "primary",
|
|
2079
2214
|
onClick: () => void g(),
|
|
2080
2215
|
disabled: !p || e === 0 || f,
|
|
@@ -2086,14 +2221,14 @@ function Ir({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2086
2221
|
}
|
|
2087
2222
|
//#endregion
|
|
2088
2223
|
//#region src/crud/types.ts
|
|
2089
|
-
var
|
|
2224
|
+
var Gr = new Set([
|
|
2090
2225
|
"page",
|
|
2091
2226
|
"perPage",
|
|
2092
2227
|
"sort",
|
|
2093
2228
|
"create",
|
|
2094
2229
|
"edit"
|
|
2095
|
-
]),
|
|
2096
|
-
function
|
|
2230
|
+
]), Kr = 1, qr = 10;
|
|
2231
|
+
function Jr(e) {
|
|
2097
2232
|
if (e.includes(",")) {
|
|
2098
2233
|
let t = e.split(",").map((e) => e.trim()), n = t.map(Number);
|
|
2099
2234
|
return n.every((e) => Number.isFinite(e)) ? n : t;
|
|
@@ -2101,16 +2236,16 @@ function Br(e) {
|
|
|
2101
2236
|
let t = Number(e);
|
|
2102
2237
|
return e !== "" && Number.isFinite(t) && String(t) === e ? t : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
2103
2238
|
}
|
|
2104
|
-
function
|
|
2239
|
+
function Yr(e) {
|
|
2105
2240
|
return e == null || e === "" ? null : Array.isArray(e) ? e.length === 0 ? null : e.map(String).join(",") : String(e);
|
|
2106
2241
|
}
|
|
2107
|
-
function
|
|
2242
|
+
function Xr(e) {
|
|
2108
2243
|
let [t, n] = b(), r = l(() => {
|
|
2109
|
-
let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) ||
|
|
2244
|
+
let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) || Kr) : Kr, a = r ? Math.max(1, Number(r) || qr) : qr, o = t.getAll("sort"), s = o.length > 0 ? o.flatMap((e) => Hn(e)) : Hn(t.get("sort")), c = { ...e };
|
|
2110
2245
|
return t.forEach((e, n) => {
|
|
2111
|
-
if (
|
|
2246
|
+
if (Gr.has(n)) return;
|
|
2112
2247
|
let r = c[n];
|
|
2113
|
-
r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(
|
|
2248
|
+
r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(Jr) : c[n] = Jr(e) : c[n] = [...Array.isArray(r) ? r : [r], Jr(e)];
|
|
2114
2249
|
}), {
|
|
2115
2250
|
page: i,
|
|
2116
2251
|
perPage: a,
|
|
@@ -2133,19 +2268,19 @@ function Hr(e) {
|
|
|
2133
2268
|
},
|
|
2134
2269
|
setPerPage: (e) => {
|
|
2135
2270
|
i((t) => {
|
|
2136
|
-
e ===
|
|
2271
|
+
e === qr ? t.delete("perPage") : t.set("perPage", String(e)), t.delete("page");
|
|
2137
2272
|
});
|
|
2138
2273
|
},
|
|
2139
2274
|
setSort: (e) => {
|
|
2140
2275
|
i((t) => {
|
|
2141
2276
|
t.delete("sort");
|
|
2142
|
-
let n =
|
|
2277
|
+
let n = Un(e);
|
|
2143
2278
|
n && t.set("sort", n);
|
|
2144
2279
|
});
|
|
2145
2280
|
},
|
|
2146
2281
|
toggleSort: (e) => {
|
|
2147
2282
|
i((t) => {
|
|
2148
|
-
let n = t.getAll("sort").flatMap((e) =>
|
|
2283
|
+
let n = t.getAll("sort").flatMap((e) => Hn(e)), r = n.findIndex((t) => t.field === e), i;
|
|
2149
2284
|
i = r < 0 ? [...n, {
|
|
2150
2285
|
field: e,
|
|
2151
2286
|
order: "ASC"
|
|
@@ -2153,22 +2288,22 @@ function Hr(e) {
|
|
|
2153
2288
|
...e,
|
|
2154
2289
|
order: "DESC"
|
|
2155
2290
|
} : e) : n.filter((e, t) => t !== r), t.delete("sort");
|
|
2156
|
-
let a =
|
|
2291
|
+
let a = Un(i);
|
|
2157
2292
|
a && t.set("sort", a);
|
|
2158
2293
|
});
|
|
2159
2294
|
},
|
|
2160
2295
|
setFilter: (e, t) => {
|
|
2161
2296
|
i((n) => {
|
|
2162
2297
|
n.delete(e);
|
|
2163
|
-
let r =
|
|
2298
|
+
let r = Yr(t);
|
|
2164
2299
|
r != null && n.set(e, r), n.delete("page");
|
|
2165
2300
|
});
|
|
2166
2301
|
},
|
|
2167
2302
|
setFilters: (e) => {
|
|
2168
2303
|
i((t) => {
|
|
2169
|
-
for (let e of [...t.keys()])
|
|
2304
|
+
for (let e of [...t.keys()]) Gr.has(e) || t.delete(e);
|
|
2170
2305
|
for (let [n, r] of Object.entries(e)) {
|
|
2171
|
-
let e =
|
|
2306
|
+
let e = Yr(r);
|
|
2172
2307
|
e != null && t.set(n, e);
|
|
2173
2308
|
}
|
|
2174
2309
|
t.delete("page");
|
|
@@ -2193,25 +2328,25 @@ function Hr(e) {
|
|
|
2193
2328
|
}
|
|
2194
2329
|
//#endregion
|
|
2195
2330
|
//#region src/crud/ResourceList.tsx
|
|
2196
|
-
var
|
|
2197
|
-
function
|
|
2198
|
-
return o(
|
|
2331
|
+
var Zr = t(null);
|
|
2332
|
+
function Qr() {
|
|
2333
|
+
return o(Zr);
|
|
2199
2334
|
}
|
|
2200
|
-
function
|
|
2335
|
+
function $r(e) {
|
|
2201
2336
|
return e == null || e === "" ? "—" : String(e);
|
|
2202
2337
|
}
|
|
2203
|
-
function
|
|
2338
|
+
function ei(e, t) {
|
|
2204
2339
|
if (e.length === 0 || !t.showEdit && !t.showQuickEdit) return e;
|
|
2205
2340
|
let [n, ...r] = e, i = n.render;
|
|
2206
2341
|
return [{
|
|
2207
2342
|
...n,
|
|
2208
2343
|
render: (e, n, r) => {
|
|
2209
|
-
let a = i ? i(e, n, r) :
|
|
2210
|
-
return t.showEdit ? /* @__PURE__ */
|
|
2344
|
+
let a = i ? i(e, n, r) : $r(e);
|
|
2345
|
+
return t.showEdit ? /* @__PURE__ */ q(f, {
|
|
2211
2346
|
to: `${t.pathPrefix}/${String(n.id)}`,
|
|
2212
2347
|
className: "ding-admin-row-edit-link",
|
|
2213
2348
|
children: a
|
|
2214
|
-
}) : /* @__PURE__ */
|
|
2349
|
+
}) : /* @__PURE__ */ q(w, {
|
|
2215
2350
|
type: "link",
|
|
2216
2351
|
size: "small",
|
|
2217
2352
|
className: "ding-admin-row-edit-link",
|
|
@@ -2226,13 +2361,13 @@ function Kr(e, t) {
|
|
|
2226
2361
|
}
|
|
2227
2362
|
}, ...r];
|
|
2228
2363
|
}
|
|
2229
|
-
function
|
|
2230
|
-
let x =
|
|
2231
|
-
|
|
2364
|
+
function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "page", formChildren: o, actions: s, rowActions: p, headerExtra: m, bulkActions: h, bulkDelete: g = !0, bulkActionsEnabled: _ = !0, permissions: v, queryState: y, queryActions: b }) {
|
|
2365
|
+
let x = Yt(), C = X(), { message: E, modal: D } = S.useApp(), { token: O } = G.useToken(), { columns: k, sortOrders: A, sortPriorities: j } = qn(), M = u(null), [ee, N] = d(), [P, F] = d(!1), [I, te] = d([]), [L, ne] = d(0), [ie, R] = d(() => /* @__PURE__ */ new Set()), [ae, z] = d(!1), oe = r ?? `${n}/new`, V = Z(C, v, "add"), se = Z(C, v, "change"), H = Z(C, v, "delete"), le = se && (i === "page" || i === "both") && s?.edit !== !1, U = se && (i === "modal" || i === "both") && s?.quickEdit !== !1, ue = H && s?.delete !== !1, de = le || U || ue || p, me = a(() => {
|
|
2366
|
+
R(/* @__PURE__ */ new Set());
|
|
2232
2367
|
}, []), he = l(() => {
|
|
2233
2368
|
if (!_) return [];
|
|
2234
2369
|
let t = [];
|
|
2235
|
-
return g &&
|
|
2370
|
+
return g && H && t.push({
|
|
2236
2371
|
key: "__delete",
|
|
2237
2372
|
label: "Delete selected",
|
|
2238
2373
|
confirm: (e) => `Delete ${e.length} selected item(s)? This cannot be undone.`,
|
|
@@ -2243,12 +2378,12 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2243
2378
|
}, [
|
|
2244
2379
|
_,
|
|
2245
2380
|
g,
|
|
2246
|
-
|
|
2381
|
+
H,
|
|
2247
2382
|
h,
|
|
2248
2383
|
x,
|
|
2249
2384
|
e,
|
|
2250
2385
|
E
|
|
2251
|
-
]), ge = he.length > 0, _e =
|
|
2386
|
+
]), ge = he.length > 0, _e = ie.size;
|
|
2252
2387
|
c(() => {
|
|
2253
2388
|
let e = M.current;
|
|
2254
2389
|
if (!e) return;
|
|
@@ -2257,7 +2392,7 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2257
2392
|
let n = () => {
|
|
2258
2393
|
if (e.clientHeight <= 0) return;
|
|
2259
2394
|
let t = e.querySelector(".ding-admin-resource-list-pagination"), n = e.querySelector(".ant-table-header"), r = t?.offsetHeight ?? 0, i = t ? parseFloat(getComputedStyle(t).marginTop) + parseFloat(getComputedStyle(t).marginBottom) : 0, a = n?.offsetHeight ?? 0, o = e.querySelector(".ant-table-body"), s = o && o.scrollWidth > o.clientWidth ? o.offsetHeight - o.clientHeight : 0, c = Math.max(120, Math.floor(e.clientHeight - a - r - i - s - 8));
|
|
2260
|
-
|
|
2395
|
+
N((e) => e === c ? e : c);
|
|
2261
2396
|
};
|
|
2262
2397
|
n();
|
|
2263
2398
|
let r = new ResizeObserver(() => n());
|
|
@@ -2267,39 +2402,39 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2267
2402
|
}, [
|
|
2268
2403
|
ge,
|
|
2269
2404
|
_e,
|
|
2270
|
-
|
|
2271
|
-
|
|
2405
|
+
L,
|
|
2406
|
+
P
|
|
2272
2407
|
]);
|
|
2273
|
-
let ve =
|
|
2274
|
-
|
|
2275
|
-
let n = new Set(t), r =
|
|
2408
|
+
let ve = I.length > 0 && I.every((e) => ie.has(e.id)), ye = L > 0 && _e >= L, be = l(() => I.filter((e) => ie.has(e.id)).map((e) => e.id), [I, ie]), xe = a((e) => {
|
|
2409
|
+
R((t) => {
|
|
2410
|
+
let n = new Set(t), r = I.map((e) => e.id);
|
|
2276
2411
|
for (let t of r) e.includes(t) || n.delete(t);
|
|
2277
2412
|
for (let t of e) n.add(t);
|
|
2278
2413
|
return n;
|
|
2279
2414
|
});
|
|
2280
|
-
}, [
|
|
2281
|
-
if (!(
|
|
2282
|
-
|
|
2415
|
+
}, [I]), Se = a(async () => {
|
|
2416
|
+
if (!(L <= 0)) {
|
|
2417
|
+
z(!0);
|
|
2283
2418
|
try {
|
|
2284
2419
|
let t = y.sort.length === 0 ? void 0 : y.sort.length === 1 ? y.sort[0] : y.sort, n = await x.getList(e, {
|
|
2285
2420
|
pagination: {
|
|
2286
2421
|
page: 1,
|
|
2287
|
-
perPage:
|
|
2422
|
+
perPage: L
|
|
2288
2423
|
},
|
|
2289
2424
|
sort: t,
|
|
2290
2425
|
filter: y.filter
|
|
2291
2426
|
});
|
|
2292
|
-
|
|
2427
|
+
R(new Set(n.data.map((e) => e.id)));
|
|
2293
2428
|
} catch (e) {
|
|
2294
2429
|
E.error(e instanceof Error ? e.message : "Load failed");
|
|
2295
2430
|
} finally {
|
|
2296
|
-
|
|
2431
|
+
z(!1);
|
|
2297
2432
|
}
|
|
2298
2433
|
}
|
|
2299
2434
|
}, [
|
|
2300
2435
|
x,
|
|
2301
2436
|
e,
|
|
2302
|
-
|
|
2437
|
+
L,
|
|
2303
2438
|
y.sort,
|
|
2304
2439
|
y.filter,
|
|
2305
2440
|
E
|
|
@@ -2335,18 +2470,18 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2335
2470
|
filter: y.filter
|
|
2336
2471
|
};
|
|
2337
2472
|
}, [y]), Y = a(async (t) => {
|
|
2338
|
-
|
|
2473
|
+
F(!0);
|
|
2339
2474
|
try {
|
|
2340
2475
|
let n = await x.getList(e, {
|
|
2341
2476
|
...we,
|
|
2342
2477
|
signal: t
|
|
2343
2478
|
});
|
|
2344
2479
|
if (t?.aborted) return;
|
|
2345
|
-
|
|
2480
|
+
te(n.data), ne(n.total);
|
|
2346
2481
|
} catch (e) {
|
|
2347
|
-
|
|
2482
|
+
$t(e) || E.error(e instanceof Error ? e.message : "Load failed");
|
|
2348
2483
|
} finally {
|
|
2349
|
-
t?.aborted ||
|
|
2484
|
+
t?.aborted || F(!1);
|
|
2350
2485
|
}
|
|
2351
2486
|
}, [
|
|
2352
2487
|
x,
|
|
@@ -2354,7 +2489,7 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2354
2489
|
we,
|
|
2355
2490
|
E
|
|
2356
2491
|
]);
|
|
2357
|
-
|
|
2492
|
+
zr((e) => Y(e), [Y]);
|
|
2358
2493
|
let Te = l(() => ({
|
|
2359
2494
|
reload: () => void Y(),
|
|
2360
2495
|
clearSelection: me
|
|
@@ -2370,26 +2505,26 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2370
2505
|
});
|
|
2371
2506
|
})) return;
|
|
2372
2507
|
}
|
|
2373
|
-
|
|
2508
|
+
z(!0);
|
|
2374
2509
|
try {
|
|
2375
2510
|
await e.execute(t, Te);
|
|
2376
2511
|
} catch (e) {
|
|
2377
2512
|
E.error(e instanceof Error ? e.message : "Action failed");
|
|
2378
2513
|
} finally {
|
|
2379
|
-
|
|
2514
|
+
z(!1);
|
|
2380
2515
|
}
|
|
2381
2516
|
}, [
|
|
2382
2517
|
Te,
|
|
2383
2518
|
D,
|
|
2384
2519
|
E
|
|
2385
2520
|
]), De = a(async (t) => {
|
|
2386
|
-
if (
|
|
2521
|
+
if (H) try {
|
|
2387
2522
|
await x.delete(e, t.id), E.success("Deleted"), Y();
|
|
2388
2523
|
} catch (e) {
|
|
2389
2524
|
E.error(e instanceof Error ? e.message : "Delete failed");
|
|
2390
2525
|
}
|
|
2391
2526
|
}, [
|
|
2392
|
-
|
|
2527
|
+
H,
|
|
2393
2528
|
x,
|
|
2394
2529
|
e,
|
|
2395
2530
|
Y,
|
|
@@ -2398,7 +2533,7 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2398
2533
|
let e = k.map((e) => {
|
|
2399
2534
|
let t = e.buildColumn();
|
|
2400
2535
|
if (e.sortable) {
|
|
2401
|
-
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__ */
|
|
2536
|
+
let n = A.get(e.source), r = j.get(e.source), i = n === "ASC" ? "ascend" : n === "DESC" ? "descend" : void 0, a = i == null ? void 0 : /* @__PURE__ */ J("span", {
|
|
2402
2537
|
style: {
|
|
2403
2538
|
display: "inline-flex",
|
|
2404
2539
|
alignItems: "center",
|
|
@@ -2406,7 +2541,7 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2406
2541
|
marginInlineStart: 4,
|
|
2407
2542
|
color: "var(--ant-color-primary)"
|
|
2408
2543
|
},
|
|
2409
|
-
children: [r == null ? null : /* @__PURE__ */
|
|
2544
|
+
children: [r == null ? null : /* @__PURE__ */ q("span", {
|
|
2410
2545
|
style: {
|
|
2411
2546
|
fontSize: 11,
|
|
2412
2547
|
fontWeight: 600,
|
|
@@ -2415,7 +2550,7 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2415
2550
|
textAlign: "center"
|
|
2416
2551
|
},
|
|
2417
2552
|
children: r
|
|
2418
|
-
}),
|
|
2553
|
+
}), q(i === "ascend" ? pe : fe, { style: { fontSize: 11 } })]
|
|
2419
2554
|
});
|
|
2420
2555
|
return {
|
|
2421
2556
|
...t,
|
|
@@ -2426,9 +2561,9 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2426
2561
|
}
|
|
2427
2562
|
return t;
|
|
2428
2563
|
});
|
|
2429
|
-
if (!
|
|
2430
|
-
showEdit:
|
|
2431
|
-
showQuickEdit:
|
|
2564
|
+
if (!de) return ei(e, {
|
|
2565
|
+
showEdit: le,
|
|
2566
|
+
showQuickEdit: U,
|
|
2432
2567
|
pathPrefix: n,
|
|
2433
2568
|
openEditModal: b.openEditModal
|
|
2434
2569
|
});
|
|
@@ -2439,22 +2574,22 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2439
2574
|
title: "Actions",
|
|
2440
2575
|
key: "__actions",
|
|
2441
2576
|
width: i === "both" ? 200 : 160,
|
|
2442
|
-
render: (e, r) => /* @__PURE__ */
|
|
2577
|
+
render: (e, r) => /* @__PURE__ */ J(B, {
|
|
2443
2578
|
size: "small",
|
|
2444
2579
|
wrap: !0,
|
|
2445
2580
|
children: [
|
|
2446
|
-
|
|
2581
|
+
le ? /* @__PURE__ */ q(f, {
|
|
2447
2582
|
to: `${n}/${String(r.id)}`,
|
|
2448
2583
|
children: "Edit"
|
|
2449
2584
|
}) : null,
|
|
2450
|
-
|
|
2585
|
+
U ? /* @__PURE__ */ q(w, {
|
|
2451
2586
|
type: "link",
|
|
2452
2587
|
size: "small",
|
|
2453
2588
|
style: { padding: 0 },
|
|
2454
2589
|
onClick: () => b.openEditModal(r.id),
|
|
2455
2590
|
children: i === "both" ? "Quick edit" : "Edit"
|
|
2456
2591
|
}) : null,
|
|
2457
|
-
|
|
2592
|
+
ue ? /* @__PURE__ */ q(w, {
|
|
2458
2593
|
type: "link",
|
|
2459
2594
|
danger: !0,
|
|
2460
2595
|
size: "small",
|
|
@@ -2466,18 +2601,18 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2466
2601
|
]
|
|
2467
2602
|
})
|
|
2468
2603
|
};
|
|
2469
|
-
return
|
|
2470
|
-
showEdit:
|
|
2471
|
-
showQuickEdit:
|
|
2604
|
+
return ei([...e, r], {
|
|
2605
|
+
showEdit: le,
|
|
2606
|
+
showQuickEdit: U,
|
|
2472
2607
|
pathPrefix: n,
|
|
2473
2608
|
openEditModal: b.openEditModal
|
|
2474
2609
|
});
|
|
2475
2610
|
}, [
|
|
2476
2611
|
k,
|
|
2477
|
-
pe,
|
|
2478
2612
|
de,
|
|
2479
|
-
|
|
2480
|
-
|
|
2613
|
+
le,
|
|
2614
|
+
U,
|
|
2615
|
+
ue,
|
|
2481
2616
|
i,
|
|
2482
2617
|
n,
|
|
2483
2618
|
De,
|
|
@@ -2497,52 +2632,52 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2497
2632
|
y.page,
|
|
2498
2633
|
y.perPage
|
|
2499
2634
|
]), Ae = o && (y.createModal || y.editId != null) && (i === "modal" || i === "both");
|
|
2500
|
-
return /* @__PURE__ */ K
|
|
2501
|
-
title: /* @__PURE__ */
|
|
2635
|
+
return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J(T, {
|
|
2636
|
+
title: /* @__PURE__ */ q(W.Title, {
|
|
2502
2637
|
level: 5,
|
|
2503
2638
|
style: { margin: 0 },
|
|
2504
2639
|
children: t
|
|
2505
2640
|
}),
|
|
2506
|
-
extra: m ||
|
|
2507
|
-
to:
|
|
2508
|
-
children: /* @__PURE__ */
|
|
2509
|
-
}) : null, /* @__PURE__ */
|
|
2641
|
+
extra: m || V ? /* @__PURE__ */ J(B, { children: [m, V ? i === "modal" || i === "both" ? /* @__PURE__ */ J(K, { children: [i === "both" ? /* @__PURE__ */ q(f, {
|
|
2642
|
+
to: oe,
|
|
2643
|
+
children: /* @__PURE__ */ q(w, { children: "New page" })
|
|
2644
|
+
}) : null, /* @__PURE__ */ q(w, {
|
|
2510
2645
|
type: "primary",
|
|
2511
2646
|
onClick: () => b.openCreateModal(),
|
|
2512
2647
|
children: "New"
|
|
2513
|
-
})] }) : /* @__PURE__ */
|
|
2514
|
-
to:
|
|
2515
|
-
children: /* @__PURE__ */
|
|
2648
|
+
})] }) : /* @__PURE__ */ q(f, {
|
|
2649
|
+
to: oe,
|
|
2650
|
+
children: /* @__PURE__ */ q(w, {
|
|
2516
2651
|
type: "primary",
|
|
2517
2652
|
children: "New"
|
|
2518
2653
|
})
|
|
2519
2654
|
}) : null] }) : null,
|
|
2520
|
-
children: [ge ? /* @__PURE__ */
|
|
2655
|
+
children: [ge ? /* @__PURE__ */ q(Wr, {
|
|
2521
2656
|
selectedCount: _e,
|
|
2522
|
-
total:
|
|
2657
|
+
total: L,
|
|
2523
2658
|
allPageSelected: ve,
|
|
2524
2659
|
allMatchingSelected: ye,
|
|
2525
2660
|
onSelectAllMatching: () => void Se(),
|
|
2526
2661
|
onClearSelection: me,
|
|
2527
2662
|
actions: he,
|
|
2528
2663
|
onExecute: Ee,
|
|
2529
|
-
selectedIds: [...
|
|
2530
|
-
running:
|
|
2531
|
-
}) : null, /* @__PURE__ */
|
|
2664
|
+
selectedIds: [...ie],
|
|
2665
|
+
running: ae || P
|
|
2666
|
+
}) : null, /* @__PURE__ */ J("div", {
|
|
2532
2667
|
ref: M,
|
|
2533
2668
|
className: "ding-admin-resource-list-table",
|
|
2534
2669
|
style: {
|
|
2535
2670
|
"--ding-scroll-thumb": O.colorTextQuaternary,
|
|
2536
2671
|
"--ding-scroll-thumb-hover": O.colorTextTertiary
|
|
2537
2672
|
},
|
|
2538
|
-
children: [/* @__PURE__ */
|
|
2673
|
+
children: [/* @__PURE__ */ q(ce, {
|
|
2539
2674
|
rowKey: "id",
|
|
2540
|
-
loading:
|
|
2675
|
+
loading: P,
|
|
2541
2676
|
columns: Oe,
|
|
2542
|
-
dataSource:
|
|
2677
|
+
dataSource: I,
|
|
2543
2678
|
scroll: {
|
|
2544
2679
|
x: "max-content",
|
|
2545
|
-
...
|
|
2680
|
+
...ee ? { y: ee } : {}
|
|
2546
2681
|
},
|
|
2547
2682
|
rowSelection: ge ? {
|
|
2548
2683
|
selectedRowKeys: be,
|
|
@@ -2553,18 +2688,18 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2553
2688
|
onChange: (e, t, n) => {
|
|
2554
2689
|
Ce(n);
|
|
2555
2690
|
}
|
|
2556
|
-
}), /* @__PURE__ */
|
|
2691
|
+
}), /* @__PURE__ */ q("div", {
|
|
2557
2692
|
className: "ding-admin-resource-list-pagination",
|
|
2558
|
-
children: /* @__PURE__ */
|
|
2693
|
+
children: /* @__PURE__ */ q(re, {
|
|
2559
2694
|
current: y.page,
|
|
2560
2695
|
pageSize: y.perPage,
|
|
2561
|
-
total:
|
|
2696
|
+
total: L,
|
|
2562
2697
|
showSizeChanger: !0,
|
|
2563
2698
|
onChange: ke
|
|
2564
2699
|
})
|
|
2565
2700
|
})]
|
|
2566
2701
|
})]
|
|
2567
|
-
}), Ae ? /* @__PURE__ */
|
|
2702
|
+
}), Ae ? /* @__PURE__ */ q(Ur, {
|
|
2568
2703
|
resource: e,
|
|
2569
2704
|
editId: y.createModal ? "new" : y.editId,
|
|
2570
2705
|
onClose: () => {
|
|
@@ -2573,8 +2708,8 @@ function qr({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2573
2708
|
children: o
|
|
2574
2709
|
}) : null] });
|
|
2575
2710
|
}
|
|
2576
|
-
function
|
|
2577
|
-
let [y, b] =
|
|
2711
|
+
function ni({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i, textFilterDebounceMs: o, editMode: s = "page", syncQueryParams: c = !0, children: u, formChildren: d, actions: f, rowActions: p, headerExtra: m, bulkActions: h, bulkDelete: g, bulkActionsEnabled: _, permissions: v }) {
|
|
2712
|
+
let [y, b] = Xr(i), x = l(() => {
|
|
2578
2713
|
if (!c) return i ?? {};
|
|
2579
2714
|
let e = {};
|
|
2580
2715
|
for (let [t, n] of Object.entries(y.filter)) i && t in i || (e[t] = n);
|
|
@@ -2589,18 +2724,18 @@ function Jr({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2589
2724
|
filterValues: x,
|
|
2590
2725
|
setFilterValue: S
|
|
2591
2726
|
}), [x, S]);
|
|
2592
|
-
return /* @__PURE__ */
|
|
2727
|
+
return /* @__PURE__ */ q(Zr.Provider, {
|
|
2593
2728
|
value: C,
|
|
2594
|
-
children: /* @__PURE__ */
|
|
2729
|
+
children: /* @__PURE__ */ q(tr, {
|
|
2595
2730
|
values: x,
|
|
2596
2731
|
setFilterValue: S,
|
|
2597
2732
|
textFilterDebounceMs: o,
|
|
2598
|
-
children: /* @__PURE__ */
|
|
2733
|
+
children: /* @__PURE__ */ q(Kn, {
|
|
2599
2734
|
toggleSort: b.toggleSort,
|
|
2600
2735
|
sort: y.sort,
|
|
2601
|
-
children: /* @__PURE__ */
|
|
2736
|
+
children: /* @__PURE__ */ J("div", {
|
|
2602
2737
|
className: "ding-admin-resource-list-root",
|
|
2603
|
-
children: [u, /* @__PURE__ */
|
|
2738
|
+
children: [u, /* @__PURE__ */ q(ti, {
|
|
2604
2739
|
resource: e,
|
|
2605
2740
|
title: t,
|
|
2606
2741
|
pathPrefix: n,
|
|
@@ -2624,16 +2759,16 @@ function Jr({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2624
2759
|
}
|
|
2625
2760
|
//#endregion
|
|
2626
2761
|
//#region src/crud/FilterBar.tsx
|
|
2627
|
-
function
|
|
2628
|
-
let e =
|
|
2629
|
-
return !e || e.filters.length === 0 ? null : /* @__PURE__ */
|
|
2762
|
+
function ri() {
|
|
2763
|
+
let e = nr();
|
|
2764
|
+
return !e || e.filters.length === 0 ? null : /* @__PURE__ */ q(B, {
|
|
2630
2765
|
wrap: !0,
|
|
2631
2766
|
size: "middle",
|
|
2632
2767
|
style: { marginBottom: 16 },
|
|
2633
|
-
children: e.filters.map((t) => /* @__PURE__ */
|
|
2768
|
+
children: e.filters.map((t) => /* @__PURE__ */ J(B, {
|
|
2634
2769
|
orientation: "vertical",
|
|
2635
2770
|
size: 2,
|
|
2636
|
-
children: [t.label ? /* @__PURE__ */
|
|
2771
|
+
children: [t.label ? /* @__PURE__ */ q(W.Text, {
|
|
2637
2772
|
type: "secondary",
|
|
2638
2773
|
style: { fontSize: 12 },
|
|
2639
2774
|
children: t.label
|
|
@@ -2644,13 +2779,13 @@ function Yr() {
|
|
|
2644
2779
|
}, t.key))
|
|
2645
2780
|
});
|
|
2646
2781
|
}
|
|
2647
|
-
function
|
|
2648
|
-
return /* @__PURE__ */ K
|
|
2782
|
+
function ii({ children: e }) {
|
|
2783
|
+
return /* @__PURE__ */ J(K, { children: [e, /* @__PURE__ */ q(ri, {})] });
|
|
2649
2784
|
}
|
|
2650
2785
|
//#endregion
|
|
2651
2786
|
//#region src/crud/ResourceForm.tsx
|
|
2652
|
-
function
|
|
2653
|
-
let { id: l } = y(), u = l === "new" || !l, d = X(), p = v(), { token: m } =
|
|
2787
|
+
function ai({ resource: e, title: t, listPath: n, children: r, defaultValues: i, onSaved: a, stayOnPage: o, permissions: c }) {
|
|
2788
|
+
let { id: l } = y(), u = l === "new" || !l, d = X(), p = v(), { token: m } = G.useToken();
|
|
2654
2789
|
s(() => {
|
|
2655
2790
|
c && (Z(d, c, u ? "add" : "change") || p(n, { replace: !0 }));
|
|
2656
2791
|
}, [
|
|
@@ -2661,17 +2796,17 @@ function Zr({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2661
2796
|
n
|
|
2662
2797
|
]);
|
|
2663
2798
|
let h = c ? Z(d, c, u ? "add" : "change") : !0;
|
|
2664
|
-
return /* @__PURE__ */
|
|
2665
|
-
title: /* @__PURE__ */
|
|
2799
|
+
return /* @__PURE__ */ q(T, {
|
|
2800
|
+
title: /* @__PURE__ */ J(B, { children: [/* @__PURE__ */ J(f, {
|
|
2666
2801
|
to: n,
|
|
2667
2802
|
style: { color: m.colorText },
|
|
2668
|
-
children: [/* @__PURE__ */
|
|
2669
|
-
}), /* @__PURE__ */
|
|
2803
|
+
children: [/* @__PURE__ */ q(de, {}), " Back"]
|
|
2804
|
+
}), /* @__PURE__ */ q(W.Title, {
|
|
2670
2805
|
level: 5,
|
|
2671
2806
|
style: { margin: 0 },
|
|
2672
2807
|
children: t
|
|
2673
2808
|
})] }),
|
|
2674
|
-
children: /* @__PURE__ */
|
|
2809
|
+
children: /* @__PURE__ */ q(Hr, {
|
|
2675
2810
|
resource: e,
|
|
2676
2811
|
id: l,
|
|
2677
2812
|
defaultValues: i,
|
|
@@ -2687,18 +2822,18 @@ function Zr({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2687
2822
|
}
|
|
2688
2823
|
//#endregion
|
|
2689
2824
|
//#region src/crud/utils/nestedFieldPath.ts
|
|
2690
|
-
function
|
|
2825
|
+
function oi(e, t, n) {
|
|
2691
2826
|
return `${e}.${t}.${n}`;
|
|
2692
2827
|
}
|
|
2693
2828
|
//#endregion
|
|
2694
2829
|
//#region src/crud/InlineFormSet.tsx
|
|
2695
|
-
function
|
|
2830
|
+
function si(e, t) {
|
|
2696
2831
|
let n = {};
|
|
2697
2832
|
for (let r of e) n[r] = t?.[r] ?? void 0;
|
|
2698
2833
|
return n;
|
|
2699
2834
|
}
|
|
2700
|
-
function
|
|
2701
|
-
let { control: r } =
|
|
2835
|
+
function ci(e, t, n) {
|
|
2836
|
+
let { control: r } = Me(), { fields: i, append: a, remove: o } = Ae({
|
|
2702
2837
|
control: r,
|
|
2703
2838
|
name: e,
|
|
2704
2839
|
keyName: "rowKey"
|
|
@@ -2706,12 +2841,12 @@ function ei(e, t, n) {
|
|
|
2706
2841
|
return {
|
|
2707
2842
|
fields: i,
|
|
2708
2843
|
remove: o,
|
|
2709
|
-
appendEmpty: () => a(
|
|
2844
|
+
appendEmpty: () => a(si(t, n))
|
|
2710
2845
|
};
|
|
2711
2846
|
}
|
|
2712
|
-
function
|
|
2713
|
-
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } =
|
|
2714
|
-
|
|
2847
|
+
function li({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, defaultRow: a }) {
|
|
2848
|
+
let o = l(() => i.map((e) => e.source), [i]), { fields: s, remove: c, appendEmpty: u } = ci(e, o, a);
|
|
2849
|
+
pr(e), vr(e, o, n, r);
|
|
2715
2850
|
let d = l(() => i.map((t) => ({
|
|
2716
2851
|
title: t.label ?? t.source,
|
|
2717
2852
|
key: t.source,
|
|
@@ -2719,19 +2854,19 @@ function ti({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2719
2854
|
onHeaderCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2720
2855
|
onCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
|
|
2721
2856
|
render: (n, r, i) => t.cell({
|
|
2722
|
-
name:
|
|
2857
|
+
name: oi(e, i, t.source),
|
|
2723
2858
|
index: i,
|
|
2724
2859
|
field: e
|
|
2725
2860
|
})
|
|
2726
2861
|
})), [i, e]);
|
|
2727
|
-
return /* @__PURE__ */
|
|
2862
|
+
return /* @__PURE__ */ J("div", {
|
|
2728
2863
|
style: { marginTop: 24 },
|
|
2729
2864
|
children: [
|
|
2730
|
-
/* @__PURE__ */
|
|
2865
|
+
/* @__PURE__ */ q(W.Title, {
|
|
2731
2866
|
level: 5,
|
|
2732
2867
|
children: t ?? "Related items"
|
|
2733
2868
|
}),
|
|
2734
|
-
/* @__PURE__ */
|
|
2869
|
+
/* @__PURE__ */ q(ce, {
|
|
2735
2870
|
size: "small",
|
|
2736
2871
|
pagination: !1,
|
|
2737
2872
|
scroll: { x: "max-content" },
|
|
@@ -2743,7 +2878,7 @@ function ti({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2743
2878
|
title: "",
|
|
2744
2879
|
key: "__remove",
|
|
2745
2880
|
width: 80,
|
|
2746
|
-
render: (e, t, n) => /* @__PURE__ */
|
|
2881
|
+
render: (e, t, n) => /* @__PURE__ */ q(w, {
|
|
2747
2882
|
type: "link",
|
|
2748
2883
|
danger: !0,
|
|
2749
2884
|
size: "small",
|
|
@@ -2752,7 +2887,7 @@ function ti({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2752
2887
|
})
|
|
2753
2888
|
}]
|
|
2754
2889
|
}),
|
|
2755
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ q(w, {
|
|
2756
2891
|
type: "dashed",
|
|
2757
2892
|
style: { marginTop: 8 },
|
|
2758
2893
|
onClick: u,
|
|
@@ -2761,16 +2896,16 @@ function ti({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2761
2896
|
]
|
|
2762
2897
|
});
|
|
2763
2898
|
}
|
|
2764
|
-
function
|
|
2765
|
-
let { fields: l, remove: u, appendEmpty: d } =
|
|
2766
|
-
return
|
|
2899
|
+
function ui({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, renderRow: a, getCardTitle: o, footer: s, defaultRow: c }) {
|
|
2900
|
+
let { fields: l, remove: u, appendEmpty: d } = ci(e, i, c);
|
|
2901
|
+
return pr(e), vr(e, i, n, r), /* @__PURE__ */ J("div", {
|
|
2767
2902
|
style: { marginTop: 24 },
|
|
2768
2903
|
children: [
|
|
2769
|
-
/* @__PURE__ */
|
|
2904
|
+
/* @__PURE__ */ q(W.Title, {
|
|
2770
2905
|
level: 5,
|
|
2771
2906
|
children: t ?? "Related items"
|
|
2772
2907
|
}),
|
|
2773
|
-
/* @__PURE__ */
|
|
2908
|
+
/* @__PURE__ */ q(B, {
|
|
2774
2909
|
orientation: "vertical",
|
|
2775
2910
|
size: "middle",
|
|
2776
2911
|
style: { width: "100%" },
|
|
@@ -2778,12 +2913,12 @@ function ni({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2778
2913
|
let r = {
|
|
2779
2914
|
field: e,
|
|
2780
2915
|
index: n,
|
|
2781
|
-
name: (t) =>
|
|
2916
|
+
name: (t) => oi(e, n, t)
|
|
2782
2917
|
};
|
|
2783
|
-
return /* @__PURE__ */
|
|
2918
|
+
return /* @__PURE__ */ q(T, {
|
|
2784
2919
|
size: "small",
|
|
2785
2920
|
title: o?.(r) ?? `Item ${n + 1}`,
|
|
2786
|
-
extra: /* @__PURE__ */
|
|
2921
|
+
extra: /* @__PURE__ */ q(w, {
|
|
2787
2922
|
type: "link",
|
|
2788
2923
|
danger: !0,
|
|
2789
2924
|
size: "small",
|
|
@@ -2794,7 +2929,7 @@ function ni({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2794
2929
|
}, t.rowKey);
|
|
2795
2930
|
})
|
|
2796
2931
|
}),
|
|
2797
|
-
/* @__PURE__ */
|
|
2932
|
+
/* @__PURE__ */ q(w, {
|
|
2798
2933
|
type: "dashed",
|
|
2799
2934
|
style: { marginTop: 8 },
|
|
2800
2935
|
onClick: d,
|
|
@@ -2806,22 +2941,22 @@ function ni({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2806
2941
|
}
|
|
2807
2942
|
//#endregion
|
|
2808
2943
|
//#region src/crud/utils/formSectionErrors.ts
|
|
2809
|
-
function
|
|
2944
|
+
function di(e, t, n) {
|
|
2810
2945
|
for (let r of e) if (t(r, n).invalid) return !0;
|
|
2811
2946
|
return !1;
|
|
2812
2947
|
}
|
|
2813
|
-
function
|
|
2948
|
+
function fi(e) {
|
|
2814
2949
|
let t = u([]);
|
|
2815
2950
|
for (; t.current.length < e;) t.current.push({ current: /* @__PURE__ */ new Set() });
|
|
2816
2951
|
return t.current.length > e && (t.current.length = e), t.current;
|
|
2817
2952
|
}
|
|
2818
|
-
function
|
|
2819
|
-
let { control: n, getFieldState: r, setFocus: i } =
|
|
2953
|
+
function pi(e, t) {
|
|
2954
|
+
let { control: n, getFieldState: r, setFocus: i } = Me(), a = Ne({ control: n }), o = u(0), c = u(0);
|
|
2820
2955
|
s(() => {
|
|
2821
2956
|
if (a.submitCount === 0) return;
|
|
2822
2957
|
let n = Object.keys(a.errors).length, s = a.submitCount !== o.current, l = !s && n > 0 && c.current === 0;
|
|
2823
2958
|
if (o.current = a.submitCount, c.current = n, !s && !l || n === 0) return;
|
|
2824
|
-
let u = e.findIndex((e) =>
|
|
2959
|
+
let u = e.findIndex((e) => di(e.current, r, a));
|
|
2825
2960
|
if (u < 0) return;
|
|
2826
2961
|
t(u);
|
|
2827
2962
|
let d = [...e[u].current].find((e) => r(e, a).invalid);
|
|
@@ -2840,38 +2975,38 @@ function ai(e, t) {
|
|
|
2840
2975
|
}
|
|
2841
2976
|
//#endregion
|
|
2842
2977
|
//#region src/crud/FormTabs.tsx
|
|
2843
|
-
function
|
|
2978
|
+
function mi(e) {
|
|
2844
2979
|
return null;
|
|
2845
2980
|
}
|
|
2846
|
-
function
|
|
2847
|
-
return i(e) && e.type ===
|
|
2981
|
+
function hi(e) {
|
|
2982
|
+
return i(e) && e.type === mi;
|
|
2848
2983
|
}
|
|
2849
|
-
function
|
|
2850
|
-
let { token: s } =
|
|
2984
|
+
function gi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o }) {
|
|
2985
|
+
let { token: s } = G.useToken(), c = l(() => e.toArray(t).filter(hi).map((e, t) => ({
|
|
2851
2986
|
key: e.key ?? String(t),
|
|
2852
2987
|
label: e.props.label,
|
|
2853
2988
|
disabled: e.props.disabled,
|
|
2854
2989
|
children: e.props.children
|
|
2855
|
-
})), [t]), u =
|
|
2990
|
+
})), [t]), u = fi(c.length), f = r !== void 0, [p, m] = d(() => n ?? c[0]?.key ?? "0"), h = f ? r : p, g = a((e) => {
|
|
2856
2991
|
f || m(e), i?.(e);
|
|
2857
2992
|
}, [f, i]);
|
|
2858
|
-
|
|
2993
|
+
pi(u, a((e) => {
|
|
2859
2994
|
let t = c[e]?.key;
|
|
2860
2995
|
t != null && g(t);
|
|
2861
2996
|
}, [g, c]));
|
|
2862
|
-
let { control: _, getFieldState: v } =
|
|
2863
|
-
return /* @__PURE__ */
|
|
2997
|
+
let { control: _, getFieldState: v } = Me(), y = Ne({ control: _ });
|
|
2998
|
+
return /* @__PURE__ */ q(H, {
|
|
2864
2999
|
destroyOnHidden: !1,
|
|
2865
3000
|
items: l(() => c.map((e, t) => {
|
|
2866
|
-
let n =
|
|
3001
|
+
let n = di(u[t].current, v, y);
|
|
2867
3002
|
return {
|
|
2868
3003
|
key: e.key,
|
|
2869
|
-
label: n ? /* @__PURE__ */
|
|
3004
|
+
label: n ? /* @__PURE__ */ q("span", {
|
|
2870
3005
|
style: { color: s.colorError },
|
|
2871
3006
|
children: e.label
|
|
2872
3007
|
}) : e.label,
|
|
2873
3008
|
disabled: e.disabled,
|
|
2874
|
-
children: /* @__PURE__ */
|
|
3009
|
+
children: /* @__PURE__ */ q(cr, {
|
|
2875
3010
|
sourcesRef: u[t],
|
|
2876
3011
|
children: e.children
|
|
2877
3012
|
})
|
|
@@ -2890,17 +3025,17 @@ function ci({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
2890
3025
|
}
|
|
2891
3026
|
//#endregion
|
|
2892
3027
|
//#region src/crud/FormSteps.tsx
|
|
2893
|
-
function
|
|
3028
|
+
function _i(e) {
|
|
2894
3029
|
return null;
|
|
2895
3030
|
}
|
|
2896
|
-
function
|
|
2897
|
-
return i(e) && e.type ===
|
|
3031
|
+
function vi(e) {
|
|
3032
|
+
return i(e) && e.type === _i;
|
|
2898
3033
|
}
|
|
2899
|
-
function
|
|
2900
|
-
let m = l(() => e.toArray(t).filter(
|
|
2901
|
-
|
|
2902
|
-
let { control: y, getFieldState: b } =
|
|
2903
|
-
let n =
|
|
3034
|
+
function yi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStepSelect: i = !1, stepsStyle: o, navigationStyle: s, size: c, direction: u, type: f, status: p }) {
|
|
3035
|
+
let m = l(() => e.toArray(t).filter(vi), [t]), h = fi(m.length), [g, _] = d(n), v = m.length - 1;
|
|
3036
|
+
pi(h, _);
|
|
3037
|
+
let { control: y, getFieldState: b } = Me(), x = Ne({ control: y }), S = l(() => m.map((e, t) => {
|
|
3038
|
+
let n = di(h[t].current, b, x);
|
|
2904
3039
|
return {
|
|
2905
3040
|
title: e.props.title,
|
|
2906
3041
|
description: e.props.description,
|
|
@@ -2914,8 +3049,8 @@ function di({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
2914
3049
|
]), C = a((e) => {
|
|
2915
3050
|
_(e);
|
|
2916
3051
|
}, []);
|
|
2917
|
-
return /* @__PURE__ */ K
|
|
2918
|
-
/* @__PURE__ */
|
|
3052
|
+
return /* @__PURE__ */ J(K, { children: [
|
|
3053
|
+
/* @__PURE__ */ q(V, {
|
|
2919
3054
|
current: g,
|
|
2920
3055
|
items: S,
|
|
2921
3056
|
style: {
|
|
@@ -2928,23 +3063,23 @@ function di({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
2928
3063
|
type: f,
|
|
2929
3064
|
status: p
|
|
2930
3065
|
}),
|
|
2931
|
-
m.map((e, t) => /* @__PURE__ */
|
|
3066
|
+
m.map((e, t) => /* @__PURE__ */ q("div", {
|
|
2932
3067
|
style: { display: g === t ? void 0 : "none" },
|
|
2933
|
-
children: /* @__PURE__ */
|
|
3068
|
+
children: /* @__PURE__ */ q(cr, {
|
|
2934
3069
|
sourcesRef: h[t],
|
|
2935
3070
|
children: e.props.children
|
|
2936
3071
|
})
|
|
2937
3072
|
}, e.key ?? String(t))),
|
|
2938
|
-
r && m.length > 1 ? /* @__PURE__ */
|
|
3073
|
+
r && m.length > 1 ? /* @__PURE__ */ J(B, {
|
|
2939
3074
|
style: {
|
|
2940
3075
|
marginTop: 16,
|
|
2941
3076
|
...s
|
|
2942
3077
|
},
|
|
2943
|
-
children: [/* @__PURE__ */
|
|
3078
|
+
children: [/* @__PURE__ */ q(w, {
|
|
2944
3079
|
disabled: g === 0,
|
|
2945
3080
|
onClick: () => _((e) => e - 1),
|
|
2946
3081
|
children: "Previous"
|
|
2947
|
-
}), /* @__PURE__ */
|
|
3082
|
+
}), /* @__PURE__ */ q(w, {
|
|
2948
3083
|
type: "primary",
|
|
2949
3084
|
disabled: g === v,
|
|
2950
3085
|
onClick: () => _((e) => e + 1),
|
|
@@ -2956,15 +3091,15 @@ function di({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
2956
3091
|
//#endregion
|
|
2957
3092
|
//#region src/crud/fields/FieldWrapper.tsx
|
|
2958
3093
|
function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, children: o }) {
|
|
2959
|
-
let s = t ?? e, c = !s.includes("."), { control: l } =
|
|
2960
|
-
return
|
|
3094
|
+
let s = t ?? e, c = !s.includes("."), { control: l } = Me(), u = or(), d = a ? void 0 : n ?? e, f = n ?? e;
|
|
3095
|
+
return pr(e, c), mr(e, c), /* @__PURE__ */ q(Oe, {
|
|
2961
3096
|
name: s,
|
|
2962
3097
|
control: l,
|
|
2963
3098
|
rules: {
|
|
2964
3099
|
required: r ? `${f} is required` : !1,
|
|
2965
3100
|
...i
|
|
2966
3101
|
},
|
|
2967
|
-
render: ({ field: e, fieldState: t }) => /* @__PURE__ */
|
|
3102
|
+
render: ({ field: e, fieldState: t }) => /* @__PURE__ */ q(M.Item, {
|
|
2968
3103
|
label: d,
|
|
2969
3104
|
validateStatus: t.error ? "error" : void 0,
|
|
2970
3105
|
help: t.error?.message,
|
|
@@ -2982,15 +3117,15 @@ function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
2982
3117
|
}
|
|
2983
3118
|
//#endregion
|
|
2984
3119
|
//#region src/crud/fields/TextField.tsx
|
|
2985
|
-
function
|
|
2986
|
-
return /* @__PURE__ */
|
|
3120
|
+
function bi({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s }) {
|
|
3121
|
+
return /* @__PURE__ */ q($, {
|
|
2987
3122
|
source: e,
|
|
2988
3123
|
name: t,
|
|
2989
3124
|
label: n,
|
|
2990
3125
|
required: r,
|
|
2991
3126
|
rules: i,
|
|
2992
3127
|
hideLabel: s,
|
|
2993
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3128
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(P, {
|
|
2994
3129
|
value: e,
|
|
2995
3130
|
onChange: (e) => t(e.target.value),
|
|
2996
3131
|
onBlur: n,
|
|
@@ -3002,15 +3137,15 @@ function fi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3002
3137
|
}
|
|
3003
3138
|
//#endregion
|
|
3004
3139
|
//#region src/crud/fields/TextAreaField.tsx
|
|
3005
|
-
function
|
|
3006
|
-
return /* @__PURE__ */
|
|
3140
|
+
function xi({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s, rows: c = 4, maxLength: l, showCount: u, autoSize: d }) {
|
|
3141
|
+
return /* @__PURE__ */ q($, {
|
|
3007
3142
|
source: e,
|
|
3008
3143
|
name: t,
|
|
3009
3144
|
label: n,
|
|
3010
3145
|
required: r,
|
|
3011
3146
|
rules: i,
|
|
3012
3147
|
hideLabel: s,
|
|
3013
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3148
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(P.TextArea, {
|
|
3014
3149
|
value: e,
|
|
3015
3150
|
onChange: (e) => t(e.target.value),
|
|
3016
3151
|
onBlur: n,
|
|
@@ -3026,15 +3161,15 @@ function pi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3026
3161
|
}
|
|
3027
3162
|
//#endregion
|
|
3028
3163
|
//#region src/crud/fields/NumberField.tsx
|
|
3029
|
-
function
|
|
3030
|
-
return /* @__PURE__ */
|
|
3164
|
+
function Si({ source: e, name: t, label: n, required: r, rules: i, min: a, max: o, step: s, inputStyle: c, hideLabel: l }) {
|
|
3165
|
+
return /* @__PURE__ */ q($, {
|
|
3031
3166
|
source: e,
|
|
3032
3167
|
name: t,
|
|
3033
3168
|
label: n,
|
|
3034
3169
|
required: r,
|
|
3035
3170
|
rules: i,
|
|
3036
3171
|
hideLabel: l,
|
|
3037
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3172
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(F, {
|
|
3038
3173
|
value: e,
|
|
3039
3174
|
onChange: (e) => t(e),
|
|
3040
3175
|
onBlur: n,
|
|
@@ -3051,15 +3186,15 @@ function mi({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3051
3186
|
}
|
|
3052
3187
|
//#endregion
|
|
3053
3188
|
//#region src/crud/fields/BooleanField.tsx
|
|
3054
|
-
function
|
|
3055
|
-
return /* @__PURE__ */
|
|
3189
|
+
function Ci({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, disabled: o }) {
|
|
3190
|
+
return /* @__PURE__ */ q($, {
|
|
3056
3191
|
source: e,
|
|
3057
3192
|
name: t,
|
|
3058
3193
|
label: n,
|
|
3059
3194
|
required: r,
|
|
3060
3195
|
rules: i,
|
|
3061
3196
|
hideLabel: a,
|
|
3062
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */
|
|
3197
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(se, {
|
|
3063
3198
|
checked: !!e,
|
|
3064
3199
|
onChange: t,
|
|
3065
3200
|
disabled: n || o
|
|
@@ -3068,7 +3203,7 @@ function hi({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3068
3203
|
}
|
|
3069
3204
|
//#endregion
|
|
3070
3205
|
//#region src/crud/utils/parseDayjsValue.ts
|
|
3071
|
-
var
|
|
3206
|
+
var wi = /* @__PURE__ */ We((/* @__PURE__ */ He(((e, t) => {
|
|
3072
3207
|
(function(n, r) {
|
|
3073
3208
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_customParseFormat = r();
|
|
3074
3209
|
})(e, (function() {
|
|
@@ -3225,66 +3360,66 @@ var gi = /* @__PURE__ */ Be((/* @__PURE__ */ Re(((e, t) => {
|
|
|
3225
3360
|
};
|
|
3226
3361
|
}));
|
|
3227
3362
|
})))(), 1);
|
|
3228
|
-
|
|
3229
|
-
function
|
|
3363
|
+
Fe.extend(wi.default);
|
|
3364
|
+
function Ti(e, t) {
|
|
3230
3365
|
if (e == null || e === "") return null;
|
|
3231
|
-
if (
|
|
3232
|
-
let n =
|
|
3233
|
-
return n.isValid() ? n :
|
|
3366
|
+
if (Fe.isDayjs(e)) return e;
|
|
3367
|
+
let n = Fe(String(e), t, !0);
|
|
3368
|
+
return n.isValid() ? n : Fe(String(e)).isValid() ? Fe(String(e)) : null;
|
|
3234
3369
|
}
|
|
3235
3370
|
//#endregion
|
|
3236
3371
|
//#region src/crud/fields/DateField.tsx
|
|
3237
|
-
var
|
|
3238
|
-
|
|
3239
|
-
|
|
3372
|
+
var Ei = "YYYY-MM-DD", Di = `${Ei} HH:mm:ss`, Oi = [
|
|
3373
|
+
Ei,
|
|
3374
|
+
Di,
|
|
3240
3375
|
"YYYY-MM-DDTHH:mm:ss",
|
|
3241
3376
|
"YYYY-MM-DDTHH:mm:ssZ"
|
|
3242
3377
|
];
|
|
3243
|
-
function
|
|
3244
|
-
return /* @__PURE__ */
|
|
3378
|
+
function ki({ source: e, name: t, label: n, required: r, rules: i, showTime: a, hideLabel: o }) {
|
|
3379
|
+
return /* @__PURE__ */ q($, {
|
|
3245
3380
|
source: e,
|
|
3246
3381
|
name: t,
|
|
3247
3382
|
label: n,
|
|
3248
3383
|
required: r,
|
|
3249
3384
|
rules: i,
|
|
3250
3385
|
hideLabel: o,
|
|
3251
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3252
|
-
value:
|
|
3253
|
-
onChange: (e) => t(e ? e.format(a ?
|
|
3386
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(O, {
|
|
3387
|
+
value: Ti(e, a ? [...Oi, Di] : Oi),
|
|
3388
|
+
onChange: (e) => t(e ? e.format(a ? Di : Ei) : null),
|
|
3254
3389
|
onBlur: n,
|
|
3255
3390
|
showTime: a,
|
|
3256
3391
|
disabled: r,
|
|
3257
|
-
format: a ?
|
|
3392
|
+
format: a ? Di : Ei,
|
|
3258
3393
|
style: { width: "100%" }
|
|
3259
3394
|
})
|
|
3260
3395
|
});
|
|
3261
3396
|
}
|
|
3262
3397
|
//#endregion
|
|
3263
3398
|
//#region src/crud/fields/DateTimeField.tsx
|
|
3264
|
-
function
|
|
3265
|
-
return /* @__PURE__ */
|
|
3399
|
+
function Ai(e) {
|
|
3400
|
+
return /* @__PURE__ */ q(ki, {
|
|
3266
3401
|
showTime: !0,
|
|
3267
3402
|
...e
|
|
3268
3403
|
});
|
|
3269
3404
|
}
|
|
3270
3405
|
//#endregion
|
|
3271
3406
|
//#region src/crud/fields/TimeField.tsx
|
|
3272
|
-
var
|
|
3273
|
-
|
|
3407
|
+
var ji = "HH:mm:ss", Mi = [
|
|
3408
|
+
ji,
|
|
3274
3409
|
"HH:mm",
|
|
3275
3410
|
"H:mm:ss",
|
|
3276
3411
|
"H:mm"
|
|
3277
3412
|
];
|
|
3278
|
-
function
|
|
3279
|
-
return /* @__PURE__ */
|
|
3413
|
+
function Ni({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, format: o = ji }) {
|
|
3414
|
+
return /* @__PURE__ */ q($, {
|
|
3280
3415
|
source: e,
|
|
3281
3416
|
name: t,
|
|
3282
3417
|
label: n,
|
|
3283
3418
|
required: r,
|
|
3284
3419
|
rules: i,
|
|
3285
3420
|
hideLabel: a,
|
|
3286
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3287
|
-
value:
|
|
3421
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(le, {
|
|
3422
|
+
value: Ti(e, Mi),
|
|
3288
3423
|
onChange: (e) => t(e ? e.format(o) : null),
|
|
3289
3424
|
onBlur: n,
|
|
3290
3425
|
disabled: r,
|
|
@@ -3295,15 +3430,15 @@ function Ti({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3295
3430
|
}
|
|
3296
3431
|
//#endregion
|
|
3297
3432
|
//#region src/crud/fields/SelectField.tsx
|
|
3298
|
-
function
|
|
3299
|
-
return /* @__PURE__ */
|
|
3433
|
+
function Pi({ source: e, name: t, label: n, required: r, rules: i, choices: a, mode: o, allowClear: s, hideLabel: c }) {
|
|
3434
|
+
return /* @__PURE__ */ q($, {
|
|
3300
3435
|
source: e,
|
|
3301
3436
|
name: t,
|
|
3302
3437
|
label: n,
|
|
3303
3438
|
required: r,
|
|
3304
3439
|
rules: i,
|
|
3305
3440
|
hideLabel: c,
|
|
3306
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */
|
|
3441
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(z, {
|
|
3307
3442
|
value: e,
|
|
3308
3443
|
onChange: t,
|
|
3309
3444
|
options: a,
|
|
@@ -3316,15 +3451,15 @@ function Ei({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3316
3451
|
}
|
|
3317
3452
|
//#endregion
|
|
3318
3453
|
//#region src/crud/fields/PasswordField.tsx
|
|
3319
|
-
function
|
|
3320
|
-
return /* @__PURE__ */
|
|
3454
|
+
function Fi({ source: e, name: t, label: n, required: r, rules: i, autoComplete: a, hideLabel: o }) {
|
|
3455
|
+
return /* @__PURE__ */ q($, {
|
|
3321
3456
|
source: e,
|
|
3322
3457
|
name: t,
|
|
3323
3458
|
label: n,
|
|
3324
3459
|
required: r,
|
|
3325
3460
|
rules: i,
|
|
3326
3461
|
hideLabel: o,
|
|
3327
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3462
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ q(P.Password, {
|
|
3328
3463
|
value: e,
|
|
3329
3464
|
onChange: (e) => t(e.target.value),
|
|
3330
3465
|
onBlur: n,
|
|
@@ -3333,12 +3468,12 @@ function Di({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3333
3468
|
})
|
|
3334
3469
|
});
|
|
3335
3470
|
}
|
|
3336
|
-
function
|
|
3337
|
-
let l =
|
|
3471
|
+
function Ii({ source: e, name: t, label: n, required: r, rules: i, confirmSource: a, confirmLabel: o = "Confirm password", autoComplete: s = "new-password", hideLabel: c }) {
|
|
3472
|
+
let l = Pe({
|
|
3338
3473
|
name: t ?? e,
|
|
3339
3474
|
disabled: !a
|
|
3340
3475
|
});
|
|
3341
|
-
return a ? /* @__PURE__ */ K
|
|
3476
|
+
return a ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(Fi, {
|
|
3342
3477
|
source: e,
|
|
3343
3478
|
name: t,
|
|
3344
3479
|
label: n,
|
|
@@ -3346,14 +3481,14 @@ function Oi({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3346
3481
|
rules: i,
|
|
3347
3482
|
autoComplete: s,
|
|
3348
3483
|
hideLabel: c
|
|
3349
|
-
}), /* @__PURE__ */
|
|
3484
|
+
}), /* @__PURE__ */ q(Fi, {
|
|
3350
3485
|
source: a,
|
|
3351
3486
|
label: o,
|
|
3352
3487
|
required: r,
|
|
3353
3488
|
autoComplete: s,
|
|
3354
3489
|
hideLabel: c,
|
|
3355
3490
|
rules: { validate: (e) => !l || e === l || "Passwords do not match" }
|
|
3356
|
-
})] }) : /* @__PURE__ */
|
|
3491
|
+
})] }) : /* @__PURE__ */ q(Fi, {
|
|
3357
3492
|
source: e,
|
|
3358
3493
|
name: t,
|
|
3359
3494
|
label: n,
|
|
@@ -3365,48 +3500,48 @@ function Oi({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3365
3500
|
}
|
|
3366
3501
|
//#endregion
|
|
3367
3502
|
//#region src/crud/utils/choiceSelectionUtils.ts
|
|
3368
|
-
function
|
|
3503
|
+
function Li(e, t) {
|
|
3369
3504
|
return typeof e == "object" && !!e && !Array.isArray(e) && t in e;
|
|
3370
3505
|
}
|
|
3371
|
-
function
|
|
3506
|
+
function Ri(e, t) {
|
|
3372
3507
|
if (!(e == null || e === "")) {
|
|
3373
|
-
if (
|
|
3508
|
+
if (Li(e, t)) {
|
|
3374
3509
|
let n = e[t];
|
|
3375
3510
|
return typeof n == "string" || typeof n == "number" ? n : void 0;
|
|
3376
3511
|
}
|
|
3377
3512
|
if (typeof e == "string" || typeof e == "number") return e;
|
|
3378
3513
|
}
|
|
3379
3514
|
}
|
|
3380
|
-
function
|
|
3381
|
-
return Array.isArray(e) ? e.map((e) =>
|
|
3515
|
+
function zi(e, t) {
|
|
3516
|
+
return Array.isArray(e) ? e.map((e) => Ri(e, t)).filter((e) => e != null) : [];
|
|
3382
3517
|
}
|
|
3383
|
-
function
|
|
3384
|
-
return e == null ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "").map((e) =>
|
|
3518
|
+
function Bi(e, t) {
|
|
3519
|
+
return e == null ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "").map((e) => Li(e, t) ? e[t] : e);
|
|
3385
3520
|
}
|
|
3386
|
-
function
|
|
3521
|
+
function Vi(e, t, n) {
|
|
3387
3522
|
let r = [];
|
|
3388
|
-
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) =>
|
|
3523
|
+
if (t != null && (Array.isArray(t) ? r.push(...t.filter((e) => Li(e, n))) : Li(t, n) && r.push(t)), e == null) return r;
|
|
3389
3524
|
let i = Array.isArray(e) ? e : [e];
|
|
3390
|
-
for (let e of i)
|
|
3525
|
+
for (let e of i) Li(e, n) && r.push(e);
|
|
3391
3526
|
return r;
|
|
3392
3527
|
}
|
|
3393
|
-
function
|
|
3528
|
+
function Hi(e, t) {
|
|
3394
3529
|
return typeof t == "function" ? t(e) : String(e[t] ?? "");
|
|
3395
3530
|
}
|
|
3396
|
-
function
|
|
3531
|
+
function Ui(e, t, n) {
|
|
3397
3532
|
return e.map((e) => ({
|
|
3398
|
-
label:
|
|
3533
|
+
label: Hi(e, t),
|
|
3399
3534
|
value: e[n],
|
|
3400
3535
|
record: e
|
|
3401
3536
|
}));
|
|
3402
3537
|
}
|
|
3403
|
-
function
|
|
3538
|
+
function Wi(e, t) {
|
|
3404
3539
|
let n = /* @__PURE__ */ new Map();
|
|
3405
3540
|
for (let t of e) n.set(t.value, t);
|
|
3406
3541
|
for (let e of t) n.set(e.value, e);
|
|
3407
3542
|
return Array.from(n.values());
|
|
3408
3543
|
}
|
|
3409
|
-
function
|
|
3544
|
+
function Gi(e = {}) {
|
|
3410
3545
|
let t = e.popupMatchSelectWidth ?? !1;
|
|
3411
3546
|
return t === !1 ? {
|
|
3412
3547
|
popupMatchSelectWidth: !1,
|
|
@@ -3415,16 +3550,16 @@ function Li(e = {}) {
|
|
|
3415
3550
|
}
|
|
3416
3551
|
//#endregion
|
|
3417
3552
|
//#region src/crud/utils/referenceSelectNotFoundContent.tsx
|
|
3418
|
-
function
|
|
3419
|
-
return e ? /* @__PURE__ */
|
|
3553
|
+
function Ki(e) {
|
|
3554
|
+
return e ? /* @__PURE__ */ q(oe, { size: "small" }) : void 0;
|
|
3420
3555
|
}
|
|
3421
3556
|
//#endregion
|
|
3422
3557
|
//#region src/crud/utils/useChoices.ts
|
|
3423
|
-
var
|
|
3424
|
-
function
|
|
3558
|
+
var qi = /* @__PURE__ */ new Map(), Ji = /* @__PURE__ */ new Map();
|
|
3559
|
+
function Yi(e, t) {
|
|
3425
3560
|
return typeof e == "function" ? `fn:${t ?? ""}` : Array.isArray(e) ? `static:${e.length}` : `res:${e.resource}:${JSON.stringify(e.filter ?? {})}:${t ?? ""}`;
|
|
3426
3561
|
}
|
|
3427
|
-
async function
|
|
3562
|
+
async function Xi(e, t, n, r, i) {
|
|
3428
3563
|
return typeof e == "function" ? e({
|
|
3429
3564
|
dataProvider: t,
|
|
3430
3565
|
search: i
|
|
@@ -3438,26 +3573,26 @@ async function Hi(e, t, n, r, i) {
|
|
|
3438
3573
|
perPage: 500
|
|
3439
3574
|
}
|
|
3440
3575
|
})).data.map((e) => ({
|
|
3441
|
-
label:
|
|
3576
|
+
label: Hi(e, n),
|
|
3442
3577
|
value: e[r],
|
|
3443
3578
|
record: e
|
|
3444
3579
|
}));
|
|
3445
3580
|
}
|
|
3446
|
-
function
|
|
3447
|
-
let o =
|
|
3581
|
+
function Zi(e, t, n, r, i, a) {
|
|
3582
|
+
let o = Yi(e, i);
|
|
3448
3583
|
if (a) {
|
|
3449
|
-
let e =
|
|
3584
|
+
let e = qi.get(o);
|
|
3450
3585
|
if (e && !i) return Promise.resolve(e);
|
|
3451
3586
|
}
|
|
3452
|
-
let s =
|
|
3587
|
+
let s = Ji.get(o);
|
|
3453
3588
|
if (s) return s;
|
|
3454
|
-
let c =
|
|
3455
|
-
|
|
3589
|
+
let c = Xi(e, t, n, r, i).then((e) => (a && !i && qi.set(o, e), e)).finally(() => {
|
|
3590
|
+
Ji.delete(o);
|
|
3456
3591
|
});
|
|
3457
|
-
return
|
|
3592
|
+
return Ji.set(o, c), c;
|
|
3458
3593
|
}
|
|
3459
|
-
function
|
|
3460
|
-
let { lazy: c = !1, active: u = !1, selectedValues: f, selectedRecords: p, fetchSelected: m = !0, cache: h } = o, g = h ?? !c, _ =
|
|
3594
|
+
function Qi(e, t, n = "name", r = "id", i, o = {}) {
|
|
3595
|
+
let { lazy: c = !1, active: u = !1, selectedValues: f, selectedRecords: p, fetchSelected: m = !0, cache: h } = o, g = h ?? !c, _ = Yt(), v = l(() => {
|
|
3461
3596
|
if (e) return e;
|
|
3462
3597
|
if (t) return {
|
|
3463
3598
|
resource: t,
|
|
@@ -3467,14 +3602,14 @@ function Wi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3467
3602
|
e,
|
|
3468
3603
|
t,
|
|
3469
3604
|
i
|
|
3470
|
-
]), y = v ?
|
|
3605
|
+
]), y = v ? Yi(v, i) : void 0, b = l(() => Bi(f, r), [f, r]), x = l(() => Ui(Vi(f, p, r), n, r), [
|
|
3471
3606
|
f,
|
|
3472
3607
|
p,
|
|
3473
3608
|
n,
|
|
3474
3609
|
r
|
|
3475
|
-
]), S = !!(v && (!c || u || Array.isArray(v))), [C, w] = d(() => x.length ? x : !y || i || c || !g ? [] :
|
|
3610
|
+
]), S = !!(v && (!c || u || Array.isArray(v))), [C, w] = d(() => x.length ? x : !y || i || c || !g ? [] : qi.get(y) ?? []), [T, E] = d(() => S ? !g || !y || i ? !!v : !qi.has(y) : !1);
|
|
3476
3611
|
s(() => {
|
|
3477
|
-
x.length && w((e) =>
|
|
3612
|
+
x.length && w((e) => Wi(e, x));
|
|
3478
3613
|
}, [x]);
|
|
3479
3614
|
let D = a(async () => {
|
|
3480
3615
|
if (!v || !S) {
|
|
@@ -3482,15 +3617,15 @@ function Wi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3482
3617
|
return;
|
|
3483
3618
|
}
|
|
3484
3619
|
if (g) {
|
|
3485
|
-
let e =
|
|
3620
|
+
let e = Yi(v, i), t = qi.get(e);
|
|
3486
3621
|
if (t && !i) {
|
|
3487
|
-
w(
|
|
3622
|
+
w(Wi(x, t)), E(!1);
|
|
3488
3623
|
return;
|
|
3489
3624
|
}
|
|
3490
3625
|
}
|
|
3491
3626
|
E(!0), c && w(x);
|
|
3492
3627
|
try {
|
|
3493
|
-
w(
|
|
3628
|
+
w(Wi(x, await Zi(v, _, n, r, i, g)));
|
|
3494
3629
|
} catch {
|
|
3495
3630
|
!b.length && !x.length ? w([]) : c && w(x);
|
|
3496
3631
|
} finally {
|
|
@@ -3527,7 +3662,7 @@ function Wi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3527
3662
|
for (let i of e) try {
|
|
3528
3663
|
let e = (await _.getOne(t, i)).data;
|
|
3529
3664
|
a.push({
|
|
3530
|
-
label:
|
|
3665
|
+
label: Hi(e, n),
|
|
3531
3666
|
value: e[r],
|
|
3532
3667
|
record: e
|
|
3533
3668
|
});
|
|
@@ -3539,7 +3674,7 @@ function Wi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3539
3674
|
}
|
|
3540
3675
|
i || !a.length || w((e) => {
|
|
3541
3676
|
let t = a.filter((t) => !e.some((e) => e.value === t.value));
|
|
3542
|
-
return t.length ?
|
|
3677
|
+
return t.length ? Wi(e, t) : e;
|
|
3543
3678
|
});
|
|
3544
3679
|
})(), () => {
|
|
3545
3680
|
i = !0;
|
|
@@ -3565,30 +3700,30 @@ function Wi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3565
3700
|
}
|
|
3566
3701
|
//#endregion
|
|
3567
3702
|
//#region src/crud/fields/ReferenceInputActions.tsx
|
|
3568
|
-
function
|
|
3703
|
+
function $i({ reference: e, referenceForm: t, referencePermissions: n, referenceTitle: r, referenceDefaultValues: i, referenceModalWidth: a, selectedId: o, disabled: s, onCreated: c, onUpdated: l }) {
|
|
3569
3704
|
let u = X(), f = r ?? e, p = !!(e && t) && Z(u, n, "add"), m = !!(e && t && o != null && o !== "") && Z(u, n, "change"), [h, g] = d(null);
|
|
3570
|
-
return !p && !m ? null : /* @__PURE__ */ K
|
|
3705
|
+
return !p && !m ? null : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J(B, {
|
|
3571
3706
|
size: 4,
|
|
3572
|
-
children: [p ? /* @__PURE__ */
|
|
3707
|
+
children: [p ? /* @__PURE__ */ q(U, {
|
|
3573
3708
|
title: `Add ${f ?? "record"}`,
|
|
3574
|
-
children: /* @__PURE__ */
|
|
3709
|
+
children: /* @__PURE__ */ q(w, {
|
|
3575
3710
|
type: "default",
|
|
3576
|
-
icon: /* @__PURE__ */
|
|
3711
|
+
icon: /* @__PURE__ */ q(Ce, {}),
|
|
3577
3712
|
disabled: s,
|
|
3578
3713
|
"aria-label": `Add ${f ?? "record"}`,
|
|
3579
3714
|
onClick: () => g("new")
|
|
3580
3715
|
})
|
|
3581
|
-
}) : null, m ? /* @__PURE__ */
|
|
3716
|
+
}) : null, m ? /* @__PURE__ */ q(U, {
|
|
3582
3717
|
title: `Edit ${f ?? "record"}`,
|
|
3583
|
-
children: /* @__PURE__ */
|
|
3718
|
+
children: /* @__PURE__ */ q(w, {
|
|
3584
3719
|
type: "default",
|
|
3585
|
-
icon: /* @__PURE__ */
|
|
3720
|
+
icon: /* @__PURE__ */ q(_e, {}),
|
|
3586
3721
|
disabled: s,
|
|
3587
3722
|
"aria-label": `Edit ${f ?? "record"}`,
|
|
3588
3723
|
onClick: () => g(String(o))
|
|
3589
3724
|
})
|
|
3590
3725
|
}) : null]
|
|
3591
|
-
}), e && t && h != null ? /* @__PURE__ */
|
|
3726
|
+
}), e && t && h != null ? /* @__PURE__ */ q(Ur, {
|
|
3592
3727
|
resource: e,
|
|
3593
3728
|
editId: h,
|
|
3594
3729
|
onClose: () => g(null),
|
|
@@ -3605,35 +3740,35 @@ function Gi({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3605
3740
|
}
|
|
3606
3741
|
//#endregion
|
|
3607
3742
|
//#region src/crud/fields/ReferenceField.tsx
|
|
3608
|
-
function
|
|
3609
|
-
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A =
|
|
3743
|
+
function ea({ reference: e, choices: t, optionLabel: n = "name", optionValue: r = "id", search: i, allowClear: a, disabled: o, inputStyle: s, onValueChange: c, lazy: u = !0, fetchSelected: f = !0, value: p, onChange: m, fieldName: h, selectedRecords: g, referenceForm: _, referencePermissions: v, referenceTitle: y, referenceDefaultValues: b, referenceModalWidth: x, referenceActions: S = !0, popupMatchSelectWidth: C, popupMinWidth: w }) {
|
|
3744
|
+
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A = Ri(p, r), { options: j, loading: M, optionForValue: ee, reload: N } = Qi(t, e, n, r, i ? T : void 0, {
|
|
3610
3745
|
lazy: u,
|
|
3611
3746
|
active: k,
|
|
3612
3747
|
selectedValues: p,
|
|
3613
3748
|
selectedRecords: g,
|
|
3614
3749
|
fetchSelected: f
|
|
3615
|
-
}),
|
|
3750
|
+
}), P = l(() => j.map((e) => ({
|
|
3616
3751
|
label: e.label,
|
|
3617
3752
|
value: e.value
|
|
3618
|
-
})), [j]),
|
|
3753
|
+
})), [j]), F = (e) => {
|
|
3619
3754
|
let t = e[r];
|
|
3620
3755
|
m(t), c?.(t, {
|
|
3621
|
-
label:
|
|
3756
|
+
label: Hi(e, n),
|
|
3622
3757
|
value: t,
|
|
3623
3758
|
record: e
|
|
3624
|
-
}, { name: h }),
|
|
3625
|
-
},
|
|
3626
|
-
...
|
|
3759
|
+
}, { name: h }), N();
|
|
3760
|
+
}, I = /* @__PURE__ */ q(z, {
|
|
3761
|
+
...Gi({
|
|
3627
3762
|
popupMatchSelectWidth: C,
|
|
3628
3763
|
popupMinWidth: w
|
|
3629
3764
|
}),
|
|
3630
3765
|
value: A,
|
|
3631
3766
|
onChange: (e) => {
|
|
3632
|
-
m(e), c?.(e,
|
|
3767
|
+
m(e), c?.(e, ee(e), { name: h });
|
|
3633
3768
|
},
|
|
3634
|
-
options:
|
|
3769
|
+
options: P,
|
|
3635
3770
|
loading: M,
|
|
3636
|
-
notFoundContent:
|
|
3771
|
+
notFoundContent: Ki(M),
|
|
3637
3772
|
showSearch: i,
|
|
3638
3773
|
filterOption: i ? !1 : void 0,
|
|
3639
3774
|
onSearch: i ? E : void 0,
|
|
@@ -3649,20 +3784,20 @@ function Ki({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3649
3784
|
...s
|
|
3650
3785
|
}
|
|
3651
3786
|
});
|
|
3652
|
-
return S ? /* @__PURE__ */
|
|
3787
|
+
return S ? /* @__PURE__ */ J("div", {
|
|
3653
3788
|
style: {
|
|
3654
3789
|
display: "flex",
|
|
3655
3790
|
gap: 8,
|
|
3656
3791
|
width: "100%",
|
|
3657
3792
|
alignItems: "flex-start"
|
|
3658
3793
|
},
|
|
3659
|
-
children: [/* @__PURE__ */
|
|
3794
|
+
children: [/* @__PURE__ */ q("div", {
|
|
3660
3795
|
style: {
|
|
3661
3796
|
flex: 1,
|
|
3662
3797
|
minWidth: 0
|
|
3663
3798
|
},
|
|
3664
|
-
children:
|
|
3665
|
-
}), /* @__PURE__ */
|
|
3799
|
+
children: I
|
|
3800
|
+
}), /* @__PURE__ */ q($i, {
|
|
3666
3801
|
reference: e,
|
|
3667
3802
|
referenceForm: _,
|
|
3668
3803
|
referencePermissions: v,
|
|
@@ -3671,24 +3806,24 @@ function Ki({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3671
3806
|
referenceModalWidth: x,
|
|
3672
3807
|
selectedId: A,
|
|
3673
3808
|
disabled: o,
|
|
3674
|
-
onCreated:
|
|
3675
|
-
onUpdated: () => void
|
|
3809
|
+
onCreated: F,
|
|
3810
|
+
onUpdated: () => void N()
|
|
3676
3811
|
})]
|
|
3677
|
-
}) :
|
|
3812
|
+
}) : I;
|
|
3678
3813
|
}
|
|
3679
|
-
function
|
|
3680
|
-
let E =
|
|
3814
|
+
function ta({ source: e, name: t, label: n, reference: r, choices: i, optionLabel: a = "name", optionValue: o = "id", required: s, rules: c, search: l, allowClear: u, disabled: d, hideLabel: f, inputStyle: p, onValueChange: m, lazy: h = !0, recordSource: g, fetchSelected: _ = !0, referenceForm: v, referencePermissions: y, referenceTitle: b, referenceDefaultValues: x, referenceModalWidth: S, referenceActions: C = !0, popupMatchSelectWidth: w, popupMinWidth: T }) {
|
|
3815
|
+
let E = Pe({
|
|
3681
3816
|
name: g ?? "",
|
|
3682
3817
|
disabled: !g
|
|
3683
3818
|
});
|
|
3684
|
-
return /* @__PURE__ */
|
|
3819
|
+
return /* @__PURE__ */ q($, {
|
|
3685
3820
|
source: e,
|
|
3686
3821
|
name: t,
|
|
3687
3822
|
label: n,
|
|
3688
3823
|
required: s,
|
|
3689
3824
|
rules: c,
|
|
3690
3825
|
hideLabel: f,
|
|
3691
|
-
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */
|
|
3826
|
+
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ q(ea, {
|
|
3692
3827
|
reference: r,
|
|
3693
3828
|
choices: i,
|
|
3694
3829
|
optionLabel: a,
|
|
@@ -3717,8 +3852,8 @@ function qi({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3717
3852
|
}
|
|
3718
3853
|
//#endregion
|
|
3719
3854
|
//#region src/crud/fields/ReferenceManyField.tsx
|
|
3720
|
-
function
|
|
3721
|
-
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D =
|
|
3855
|
+
function na({ reference: e, choices: t, optionLabel: n = "name", optionValue: r = "id", search: i, allowClear: a = !0, lazy: o = !0, fetchSelected: s = !0, value: c, onChange: u, disabled: f, selectedRecords: p, referenceForm: m, referencePermissions: h, referenceTitle: g, referenceDefaultValues: _, referenceModalWidth: v, referenceActions: y = !0, popupMatchSelectWidth: b, popupMinWidth: x }) {
|
|
3856
|
+
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D = zi(c, r), { options: O, loading: k, reload: A } = Qi(t, e, n, r, i ? S : void 0, {
|
|
3722
3857
|
lazy: o,
|
|
3723
3858
|
active: E,
|
|
3724
3859
|
selectedValues: c,
|
|
@@ -3727,8 +3862,8 @@ function Ji({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3727
3862
|
}), j = l(() => O.map((e) => ({
|
|
3728
3863
|
label: e.label,
|
|
3729
3864
|
value: e.value
|
|
3730
|
-
})), [O]), M = /* @__PURE__ */
|
|
3731
|
-
...
|
|
3865
|
+
})), [O]), M = /* @__PURE__ */ q(z, {
|
|
3866
|
+
...Gi({
|
|
3732
3867
|
popupMatchSelectWidth: b,
|
|
3733
3868
|
popupMinWidth: x
|
|
3734
3869
|
}),
|
|
@@ -3737,7 +3872,7 @@ function Ji({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3737
3872
|
onChange: u,
|
|
3738
3873
|
options: j,
|
|
3739
3874
|
loading: k,
|
|
3740
|
-
notFoundContent:
|
|
3875
|
+
notFoundContent: Ki(k),
|
|
3741
3876
|
showSearch: i,
|
|
3742
3877
|
filterOption: i ? !1 : void 0,
|
|
3743
3878
|
onSearch: i ? C : void 0,
|
|
@@ -3749,20 +3884,20 @@ function Ji({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3749
3884
|
optionFilterProp: "label",
|
|
3750
3885
|
style: { width: "100%" }
|
|
3751
3886
|
});
|
|
3752
|
-
return y ? /* @__PURE__ */
|
|
3887
|
+
return y ? /* @__PURE__ */ J("div", {
|
|
3753
3888
|
style: {
|
|
3754
3889
|
display: "flex",
|
|
3755
3890
|
gap: 8,
|
|
3756
3891
|
width: "100%",
|
|
3757
3892
|
alignItems: "flex-start"
|
|
3758
3893
|
},
|
|
3759
|
-
children: [/* @__PURE__ */
|
|
3894
|
+
children: [/* @__PURE__ */ q("div", {
|
|
3760
3895
|
style: {
|
|
3761
3896
|
flex: 1,
|
|
3762
3897
|
minWidth: 0
|
|
3763
3898
|
},
|
|
3764
3899
|
children: M
|
|
3765
|
-
}), /* @__PURE__ */
|
|
3900
|
+
}), /* @__PURE__ */ q($i, {
|
|
3766
3901
|
reference: e,
|
|
3767
3902
|
referenceForm: m,
|
|
3768
3903
|
referencePermissions: h,
|
|
@@ -3781,19 +3916,19 @@ function Ji({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3781
3916
|
})]
|
|
3782
3917
|
}) : M;
|
|
3783
3918
|
}
|
|
3784
|
-
function
|
|
3785
|
-
let w =
|
|
3919
|
+
function ra({ source: e, name: t, label: n, reference: r, choices: i, optionLabel: a = "name", optionValue: o = "id", required: s, rules: c, search: l, allowClear: u = !0, hideLabel: d, disabled: f, lazy: p = !0, recordSource: m, fetchSelected: h = !0, referenceForm: g, referencePermissions: _, referenceTitle: v, referenceDefaultValues: y, referenceModalWidth: b, referenceActions: x = !0, popupMatchSelectWidth: S, popupMinWidth: C }) {
|
|
3920
|
+
let w = Pe({
|
|
3786
3921
|
name: m ?? "",
|
|
3787
3922
|
disabled: !m
|
|
3788
3923
|
});
|
|
3789
|
-
return /* @__PURE__ */
|
|
3924
|
+
return /* @__PURE__ */ q($, {
|
|
3790
3925
|
source: e,
|
|
3791
3926
|
name: t,
|
|
3792
3927
|
label: n,
|
|
3793
3928
|
required: s,
|
|
3794
3929
|
rules: c,
|
|
3795
3930
|
hideLabel: d,
|
|
3796
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */
|
|
3931
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(na, {
|
|
3797
3932
|
reference: r,
|
|
3798
3933
|
choices: i,
|
|
3799
3934
|
optionLabel: a,
|
|
@@ -3819,10 +3954,10 @@ function Yi({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3819
3954
|
}
|
|
3820
3955
|
//#endregion
|
|
3821
3956
|
//#region src/crud/fields/uploadFieldUtils.ts
|
|
3822
|
-
function
|
|
3957
|
+
function ia(e) {
|
|
3823
3958
|
return e instanceof File ? !0 : typeof e == "string" && e.length > 0;
|
|
3824
3959
|
}
|
|
3825
|
-
function
|
|
3960
|
+
function aa(e) {
|
|
3826
3961
|
if (e instanceof File) return e.name;
|
|
3827
3962
|
if (typeof e == "string" && e.length > 0) try {
|
|
3828
3963
|
return new URL(e, "http://local").pathname.split("/").filter(Boolean).pop() || e;
|
|
@@ -3832,7 +3967,7 @@ function Zi(e) {
|
|
|
3832
3967
|
}
|
|
3833
3968
|
//#endregion
|
|
3834
3969
|
//#region src/crud/fields/useUploadPreviewUrl.ts
|
|
3835
|
-
function
|
|
3970
|
+
function oa(e) {
|
|
3836
3971
|
let [t, n] = d();
|
|
3837
3972
|
if (s(() => {
|
|
3838
3973
|
if (e instanceof File) {
|
|
@@ -3845,14 +3980,14 @@ function Qi(e) {
|
|
|
3845
3980
|
}
|
|
3846
3981
|
//#endregion
|
|
3847
3982
|
//#region src/crud/fields/ImageField.tsx
|
|
3848
|
-
function
|
|
3849
|
-
let o = u(null), s =
|
|
3850
|
-
return /* @__PURE__ */
|
|
3983
|
+
function sa({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "image/*", previewWidth: a = 200 }) {
|
|
3984
|
+
let o = u(null), s = oa(e), c = r && ia(e);
|
|
3985
|
+
return /* @__PURE__ */ J(B, {
|
|
3851
3986
|
direction: "vertical",
|
|
3852
3987
|
size: "middle",
|
|
3853
3988
|
style: { width: "100%" },
|
|
3854
3989
|
children: [
|
|
3855
|
-
s ? /* @__PURE__ */
|
|
3990
|
+
s ? /* @__PURE__ */ q(N, {
|
|
3856
3991
|
src: s,
|
|
3857
3992
|
alt: "",
|
|
3858
3993
|
style: {
|
|
@@ -3861,15 +3996,15 @@ function $i({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
3861
3996
|
objectFit: "contain"
|
|
3862
3997
|
}
|
|
3863
3998
|
}) : null,
|
|
3864
|
-
/* @__PURE__ */
|
|
3999
|
+
/* @__PURE__ */ J(B, {
|
|
3865
4000
|
wrap: !0,
|
|
3866
|
-
children: [/* @__PURE__ */
|
|
3867
|
-
icon: /* @__PURE__ */
|
|
4001
|
+
children: [/* @__PURE__ */ q(w, {
|
|
4002
|
+
icon: /* @__PURE__ */ q(Ee, {}),
|
|
3868
4003
|
disabled: n,
|
|
3869
4004
|
onClick: () => o.current?.click(),
|
|
3870
4005
|
children: "Choose image"
|
|
3871
|
-
}), c ? /* @__PURE__ */
|
|
3872
|
-
icon: /* @__PURE__ */
|
|
4006
|
+
}), c ? /* @__PURE__ */ q(w, {
|
|
4007
|
+
icon: /* @__PURE__ */ q(he, {}),
|
|
3873
4008
|
disabled: n,
|
|
3874
4009
|
onClick: () => {
|
|
3875
4010
|
t(null), o.current && (o.current.value = "");
|
|
@@ -3877,7 +4012,7 @@ function $i({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
3877
4012
|
children: "Clear"
|
|
3878
4013
|
}) : null]
|
|
3879
4014
|
}),
|
|
3880
|
-
/* @__PURE__ */
|
|
4015
|
+
/* @__PURE__ */ q("input", {
|
|
3881
4016
|
ref: o,
|
|
3882
4017
|
type: "file",
|
|
3883
4018
|
accept: i,
|
|
@@ -3893,15 +4028,15 @@ function $i({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
3893
4028
|
]
|
|
3894
4029
|
});
|
|
3895
4030
|
}
|
|
3896
|
-
function
|
|
3897
|
-
return /* @__PURE__ */
|
|
4031
|
+
function ca({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s, previewWidth: c }) {
|
|
4032
|
+
return /* @__PURE__ */ q($, {
|
|
3898
4033
|
source: e,
|
|
3899
4034
|
name: t,
|
|
3900
4035
|
label: n,
|
|
3901
4036
|
required: r,
|
|
3902
4037
|
rules: i,
|
|
3903
4038
|
hideLabel: a,
|
|
3904
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */
|
|
4039
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(sa, {
|
|
3905
4040
|
value: e,
|
|
3906
4041
|
onChange: t,
|
|
3907
4042
|
disabled: n,
|
|
@@ -3913,28 +4048,28 @@ function ea({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3913
4048
|
}
|
|
3914
4049
|
//#endregion
|
|
3915
4050
|
//#region src/crud/fields/FileField.tsx
|
|
3916
|
-
function
|
|
3917
|
-
let a = u(null), o =
|
|
3918
|
-
return /* @__PURE__ */
|
|
4051
|
+
function la({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
4052
|
+
let a = u(null), o = aa(e), s = typeof e == "string" && e.length > 0 ? e : void 0, c = r && ia(e);
|
|
4053
|
+
return /* @__PURE__ */ J(B, {
|
|
3919
4054
|
direction: "vertical",
|
|
3920
4055
|
size: "middle",
|
|
3921
4056
|
style: { width: "100%" },
|
|
3922
4057
|
children: [
|
|
3923
|
-
o ? /* @__PURE__ */
|
|
4058
|
+
o ? /* @__PURE__ */ J(B, { children: [/* @__PURE__ */ q(Se, {}), s ? /* @__PURE__ */ q(W.Link, {
|
|
3924
4059
|
href: s,
|
|
3925
4060
|
target: "_blank",
|
|
3926
4061
|
rel: "noopener noreferrer",
|
|
3927
4062
|
children: o
|
|
3928
|
-
}) : /* @__PURE__ */
|
|
3929
|
-
/* @__PURE__ */
|
|
4063
|
+
}) : /* @__PURE__ */ q(W.Text, { children: o })] }) : null,
|
|
4064
|
+
/* @__PURE__ */ J(B, {
|
|
3930
4065
|
wrap: !0,
|
|
3931
|
-
children: [/* @__PURE__ */
|
|
3932
|
-
icon: /* @__PURE__ */
|
|
4066
|
+
children: [/* @__PURE__ */ q(w, {
|
|
4067
|
+
icon: /* @__PURE__ */ q(Ee, {}),
|
|
3933
4068
|
disabled: n,
|
|
3934
4069
|
onClick: () => a.current?.click(),
|
|
3935
4070
|
children: "Choose file"
|
|
3936
|
-
}), c ? /* @__PURE__ */
|
|
3937
|
-
icon: /* @__PURE__ */
|
|
4071
|
+
}), c ? /* @__PURE__ */ q(w, {
|
|
4072
|
+
icon: /* @__PURE__ */ q(he, {}),
|
|
3938
4073
|
disabled: n,
|
|
3939
4074
|
onClick: () => {
|
|
3940
4075
|
t(null), a.current && (a.current.value = "");
|
|
@@ -3942,7 +4077,7 @@ function ta({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
3942
4077
|
children: "Clear"
|
|
3943
4078
|
}) : null]
|
|
3944
4079
|
}),
|
|
3945
|
-
/* @__PURE__ */
|
|
4080
|
+
/* @__PURE__ */ q("input", {
|
|
3946
4081
|
ref: a,
|
|
3947
4082
|
type: "file",
|
|
3948
4083
|
accept: i,
|
|
@@ -3958,15 +4093,15 @@ function ta({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
3958
4093
|
]
|
|
3959
4094
|
});
|
|
3960
4095
|
}
|
|
3961
|
-
function
|
|
3962
|
-
return /* @__PURE__ */
|
|
4096
|
+
function ua({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s }) {
|
|
4097
|
+
return /* @__PURE__ */ q($, {
|
|
3963
4098
|
source: e,
|
|
3964
4099
|
name: t,
|
|
3965
4100
|
label: n,
|
|
3966
4101
|
required: r,
|
|
3967
4102
|
rules: i,
|
|
3968
4103
|
hideLabel: a,
|
|
3969
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */
|
|
4104
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ q(la, {
|
|
3970
4105
|
value: e,
|
|
3971
4106
|
onChange: t,
|
|
3972
4107
|
disabled: n,
|
|
@@ -3977,8 +4112,8 @@ function na({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3977
4112
|
}
|
|
3978
4113
|
//#endregion
|
|
3979
4114
|
//#region src/crud/columns/TextColumn.tsx
|
|
3980
|
-
function
|
|
3981
|
-
return
|
|
4115
|
+
function da({ source: e, label: t, sortable: n = !0 }) {
|
|
4116
|
+
return Jn(l(() => ({
|
|
3982
4117
|
key: e,
|
|
3983
4118
|
source: e,
|
|
3984
4119
|
label: t,
|
|
@@ -3995,13 +4130,13 @@ function ra({ source: e, label: t, sortable: n = !0 }) {
|
|
|
3995
4130
|
n
|
|
3996
4131
|
])), null;
|
|
3997
4132
|
}
|
|
3998
|
-
function
|
|
3999
|
-
return typeof n == "function" ? n(e) : n ?
|
|
4133
|
+
function fa(e, t, n) {
|
|
4134
|
+
return typeof n == "function" ? n(e) : n ? br(e, n) : e[t];
|
|
4000
4135
|
}
|
|
4001
4136
|
//#endregion
|
|
4002
4137
|
//#region src/crud/columns/NumberColumn.tsx
|
|
4003
|
-
function
|
|
4004
|
-
return
|
|
4138
|
+
function pa({ source: e, label: t, sortable: n = !0 }) {
|
|
4139
|
+
return Jn(l(() => ({
|
|
4005
4140
|
key: e,
|
|
4006
4141
|
source: e,
|
|
4007
4142
|
label: t,
|
|
@@ -4020,8 +4155,8 @@ function aa({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4020
4155
|
}
|
|
4021
4156
|
//#endregion
|
|
4022
4157
|
//#region src/crud/columns/BooleanColumn.tsx
|
|
4023
|
-
function
|
|
4024
|
-
return
|
|
4158
|
+
function ma({ source: e, label: t, sortable: n = !0 }) {
|
|
4159
|
+
return Jn(l(() => ({
|
|
4025
4160
|
key: e,
|
|
4026
4161
|
source: e,
|
|
4027
4162
|
label: t,
|
|
@@ -4041,8 +4176,8 @@ function oa({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4041
4176
|
}
|
|
4042
4177
|
//#endregion
|
|
4043
4178
|
//#region src/crud/columns/DateColumn.tsx
|
|
4044
|
-
function
|
|
4045
|
-
return
|
|
4179
|
+
function ha({ source: e, label: t, sortable: n = !0 }) {
|
|
4180
|
+
return Jn(l(() => ({
|
|
4046
4181
|
key: e,
|
|
4047
4182
|
source: e,
|
|
4048
4183
|
label: t,
|
|
@@ -4062,17 +4197,17 @@ function sa({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4062
4197
|
}
|
|
4063
4198
|
//#endregion
|
|
4064
4199
|
//#region src/crud/columns/ReferenceColumn.tsx
|
|
4065
|
-
function
|
|
4066
|
-
let { labelForValue: s } =
|
|
4067
|
-
if (typeof n == "function") return /* @__PURE__ */
|
|
4200
|
+
function ga({ record: e, source: t, display: n, reference: r, choices: i, optionLabel: a, optionValue: o }) {
|
|
4201
|
+
let { labelForValue: s } = Qi(i, r, a, o), c = e[t];
|
|
4202
|
+
if (typeof n == "function") return /* @__PURE__ */ q(K, { children: n(e) });
|
|
4068
4203
|
if (n && n !== t) {
|
|
4069
|
-
let r =
|
|
4070
|
-
return /* @__PURE__ */
|
|
4204
|
+
let r = fa(e, t, n);
|
|
4205
|
+
return /* @__PURE__ */ q(K, { children: r == null ? "—" : String(r) });
|
|
4071
4206
|
}
|
|
4072
|
-
return /* @__PURE__ */
|
|
4207
|
+
return /* @__PURE__ */ q(K, { children: s(c) });
|
|
4073
4208
|
}
|
|
4074
|
-
function
|
|
4075
|
-
return
|
|
4209
|
+
function _a({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: s = !0 }) {
|
|
4210
|
+
return Jn(l(() => ({
|
|
4076
4211
|
key: e,
|
|
4077
4212
|
source: e,
|
|
4078
4213
|
label: t,
|
|
@@ -4082,7 +4217,7 @@ function la({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4082
4217
|
dataIndex: e,
|
|
4083
4218
|
key: e,
|
|
4084
4219
|
sorter: s ? !0 : void 0,
|
|
4085
|
-
render: (s, c) => /* @__PURE__ */
|
|
4220
|
+
render: (s, c) => /* @__PURE__ */ q(ga, {
|
|
4086
4221
|
record: c,
|
|
4087
4222
|
source: e,
|
|
4088
4223
|
label: t,
|
|
@@ -4106,12 +4241,12 @@ function la({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4106
4241
|
}
|
|
4107
4242
|
//#endregion
|
|
4108
4243
|
//#region src/crud/columns/ReferenceManyColumn.tsx
|
|
4109
|
-
function
|
|
4110
|
-
let { labelsForValues: o } =
|
|
4111
|
-
return /* @__PURE__ */
|
|
4244
|
+
function va({ record: e, source: t, reference: n, choices: r, optionLabel: i, optionValue: a }) {
|
|
4245
|
+
let { labelsForValues: o } = Qi(r, n, i, a), s = e[t];
|
|
4246
|
+
return /* @__PURE__ */ q(K, { children: o(Array.isArray(s) ? s : []) });
|
|
4112
4247
|
}
|
|
4113
|
-
function
|
|
4114
|
-
return
|
|
4248
|
+
function ya({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
|
|
4249
|
+
return Jn(l(() => ({
|
|
4115
4250
|
key: e,
|
|
4116
4251
|
source: e,
|
|
4117
4252
|
label: t,
|
|
@@ -4121,7 +4256,7 @@ function da({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4121
4256
|
dataIndex: e,
|
|
4122
4257
|
key: e,
|
|
4123
4258
|
sorter: o ? !0 : void 0,
|
|
4124
|
-
render: (t, o) => /* @__PURE__ */
|
|
4259
|
+
render: (t, o) => /* @__PURE__ */ q(va, {
|
|
4125
4260
|
record: o,
|
|
4126
4261
|
source: e,
|
|
4127
4262
|
reference: n,
|
|
@@ -4142,8 +4277,8 @@ function da({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4142
4277
|
}
|
|
4143
4278
|
//#endregion
|
|
4144
4279
|
//#region src/crud/columns/ImageColumn.tsx
|
|
4145
|
-
function
|
|
4146
|
-
return
|
|
4280
|
+
function ba({ source: e, label: t, sortable: n = !1, width: r = 40, height: i = 40, objectFit: a = "cover", borderRadius: o = 4, alt: s = "" }) {
|
|
4281
|
+
return Jn(l(() => ({
|
|
4147
4282
|
key: e,
|
|
4148
4283
|
source: e,
|
|
4149
4284
|
label: t,
|
|
@@ -4153,7 +4288,7 @@ function fa({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4153
4288
|
dataIndex: e,
|
|
4154
4289
|
key: e,
|
|
4155
4290
|
sorter: n ? !0 : void 0,
|
|
4156
|
-
render: (e) => e == null || e === "" ? null : /* @__PURE__ */
|
|
4291
|
+
render: (e) => e == null || e === "" ? null : /* @__PURE__ */ q("img", {
|
|
4157
4292
|
src: String(e),
|
|
4158
4293
|
alt: s,
|
|
4159
4294
|
style: {
|
|
@@ -4177,8 +4312,8 @@ function fa({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4177
4312
|
}
|
|
4178
4313
|
//#endregion
|
|
4179
4314
|
//#region src/crud/columns/CustomColumn.tsx
|
|
4180
|
-
function
|
|
4181
|
-
return
|
|
4315
|
+
function xa({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
4316
|
+
return Jn(l(() => ({
|
|
4182
4317
|
key: e,
|
|
4183
4318
|
source: e,
|
|
4184
4319
|
label: t,
|
|
@@ -4197,12 +4332,12 @@ function pa({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
|
4197
4332
|
}
|
|
4198
4333
|
//#endregion
|
|
4199
4334
|
//#region src/crud/filters/NumberFilter.tsx
|
|
4200
|
-
function
|
|
4201
|
-
return
|
|
4335
|
+
function Sa({ source: e, label: t }) {
|
|
4336
|
+
return rr(l(() => ({
|
|
4202
4337
|
key: e,
|
|
4203
4338
|
source: e,
|
|
4204
4339
|
label: t,
|
|
4205
|
-
render: ({ value: n, onChange: r }) => /* @__PURE__ */
|
|
4340
|
+
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(F, {
|
|
4206
4341
|
placeholder: t ?? e,
|
|
4207
4342
|
value: n,
|
|
4208
4343
|
onChange: (e) => r(e ?? void 0),
|
|
@@ -4212,12 +4347,12 @@ function ma({ source: e, label: t }) {
|
|
|
4212
4347
|
}
|
|
4213
4348
|
//#endregion
|
|
4214
4349
|
//#region src/crud/filters/BooleanFilter.tsx
|
|
4215
|
-
function
|
|
4216
|
-
return
|
|
4350
|
+
function Ca({ source: e, label: t }) {
|
|
4351
|
+
return rr(l(() => ({
|
|
4217
4352
|
key: e,
|
|
4218
4353
|
source: e,
|
|
4219
4354
|
label: t,
|
|
4220
|
-
render: ({ value: n, onChange: r }) => /* @__PURE__ */
|
|
4355
|
+
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(z, {
|
|
4221
4356
|
allowClear: !0,
|
|
4222
4357
|
placeholder: t ?? e,
|
|
4223
4358
|
value: n,
|
|
@@ -4235,15 +4370,15 @@ function ha({ source: e, label: t }) {
|
|
|
4235
4370
|
}
|
|
4236
4371
|
//#endregion
|
|
4237
4372
|
//#region src/crud/filters/DateFilter.tsx
|
|
4238
|
-
function
|
|
4239
|
-
return
|
|
4373
|
+
function wa({ source: e, label: t }) {
|
|
4374
|
+
return rr(l(() => ({
|
|
4240
4375
|
key: e,
|
|
4241
4376
|
source: e,
|
|
4242
4377
|
label: t,
|
|
4243
|
-
render: ({ value: n, onChange: r }) => /* @__PURE__ */
|
|
4378
|
+
render: ({ value: n, onChange: r }) => /* @__PURE__ */ q(O, {
|
|
4244
4379
|
allowClear: !0,
|
|
4245
4380
|
placeholder: t ?? e,
|
|
4246
|
-
value: n ?
|
|
4381
|
+
value: n ? Fe(String(n)) : null,
|
|
4247
4382
|
onChange: (e) => r(e ? e.format("YYYY-MM-DD") : void 0),
|
|
4248
4383
|
style: { minWidth: 160 }
|
|
4249
4384
|
})
|
|
@@ -4251,12 +4386,12 @@ function ga({ source: e, label: t }) {
|
|
|
4251
4386
|
}
|
|
4252
4387
|
//#endregion
|
|
4253
4388
|
//#region src/crud/filters/SelectFilter.tsx
|
|
4254
|
-
function
|
|
4255
|
-
return
|
|
4389
|
+
function Ta({ source: e, label: t, choices: n, multiple: r }) {
|
|
4390
|
+
return rr(l(() => ({
|
|
4256
4391
|
key: e,
|
|
4257
4392
|
source: e,
|
|
4258
4393
|
label: t,
|
|
4259
|
-
render: ({ value: i, onChange: a }) => /* @__PURE__ */
|
|
4394
|
+
render: ({ value: i, onChange: a }) => /* @__PURE__ */ q(z, {
|
|
4260
4395
|
allowClear: !0,
|
|
4261
4396
|
mode: r ? "multiple" : void 0,
|
|
4262
4397
|
placeholder: t ?? e,
|
|
@@ -4274,15 +4409,15 @@ function _a({ source: e, label: t, choices: n, multiple: r }) {
|
|
|
4274
4409
|
}
|
|
4275
4410
|
//#endregion
|
|
4276
4411
|
//#region src/crud/filters/ReferenceFilter.tsx
|
|
4277
|
-
function
|
|
4278
|
-
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b } =
|
|
4412
|
+
function Ea({ source: e, label: t, reference: n, choices: r, optionLabel: i, optionValue: a, multiple: o, search: s, lazy: c = !0, fetchSelected: l = !0, popupMatchSelectWidth: u, popupMinWidth: f, value: p, onChange: m }) {
|
|
4413
|
+
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b } = Qi(r, n, i, a, s ? h : void 0, {
|
|
4279
4414
|
lazy: c,
|
|
4280
4415
|
active: _ || !!h,
|
|
4281
4416
|
selectedValues: p,
|
|
4282
4417
|
fetchSelected: l
|
|
4283
4418
|
});
|
|
4284
|
-
return /* @__PURE__ */
|
|
4285
|
-
...
|
|
4419
|
+
return /* @__PURE__ */ q(z, {
|
|
4420
|
+
...Gi({
|
|
4286
4421
|
popupMatchSelectWidth: u,
|
|
4287
4422
|
popupMinWidth: f
|
|
4288
4423
|
}),
|
|
@@ -4296,7 +4431,7 @@ function va({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4296
4431
|
value: e.value
|
|
4297
4432
|
})),
|
|
4298
4433
|
loading: b,
|
|
4299
|
-
notFoundContent:
|
|
4434
|
+
notFoundContent: Ki(b),
|
|
4300
4435
|
showSearch: s,
|
|
4301
4436
|
filterOption: s ? !1 : void 0,
|
|
4302
4437
|
onSearch: s ? g : void 0,
|
|
@@ -4307,12 +4442,12 @@ function va({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4307
4442
|
style: { minWidth: 180 }
|
|
4308
4443
|
});
|
|
4309
4444
|
}
|
|
4310
|
-
function
|
|
4311
|
-
return
|
|
4445
|
+
function Da({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", multiple: o, search: s, lazy: c = !0, fetchSelected: u = !0, popupMatchSelectWidth: d, popupMinWidth: f }) {
|
|
4446
|
+
return rr(l(() => ({
|
|
4312
4447
|
key: e,
|
|
4313
4448
|
source: e,
|
|
4314
4449
|
label: t,
|
|
4315
|
-
render: ({ value: l, onChange: p }) => /* @__PURE__ */
|
|
4450
|
+
render: ({ value: l, onChange: p }) => /* @__PURE__ */ q(Ea, {
|
|
4316
4451
|
source: e,
|
|
4317
4452
|
label: t,
|
|
4318
4453
|
reference: n,
|
|
@@ -4343,11 +4478,11 @@ function ya({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4343
4478
|
f
|
|
4344
4479
|
])), null;
|
|
4345
4480
|
}
|
|
4346
|
-
function
|
|
4347
|
-
return /* @__PURE__ */
|
|
4481
|
+
function Oa(e) {
|
|
4482
|
+
return /* @__PURE__ */ q(Da, {
|
|
4348
4483
|
...e,
|
|
4349
4484
|
multiple: !0
|
|
4350
4485
|
});
|
|
4351
4486
|
}
|
|
4352
4487
|
//#endregion
|
|
4353
|
-
export {
|
|
4488
|
+
export { Kt as AdminApp, Pt as AdminLayout, Bn as AppHub, Vn as AppLauncherButton, Ze as AppThemeProvider, In as AuthAlternateLink, Ln as AuthPageLayout, lt as AuthProvider, ma as BooleanColumn, Ci as BooleanField, Ca as BooleanFilter, xa as CustomColumn, Xn as DEFAULT_TEXT_FILTER_DEBOUNCE_MS, Jt as DataProvider, ha as DateColumn, ki as DateField, wa as DateFilter, Ai as DateTimeField, et as DensitySwitch, en as EXPECTED_VALIDATION_BODY_HINT, $ as FieldWrapper, ua as FileField, ii as FilterBar, _i as FormStep, yi as FormSteps, mi as FormTab, gi as FormTabs, Ft as Guard, Lt as GuestOnly, ba as ImageColumn, ca as ImageField, li as InlineFormSet, ui as InlineFormSetStacked, Rn as LoginPage, pa as NumberColumn, Si as NumberField, Sa as NumberFilter, Ii as PasswordField, mt as PermissionsProvider, zn as PlaceholderPage, It as Protected, _a as ReferenceColumn, ta as ReferenceField, Da as ReferenceFilter, ya as ReferenceManyColumn, ra as ReferenceManyField, Oa as ReferenceManyFilter, Rt as RequirePermission, ai as ResourceForm, Ur as ResourceFormModal, ni as ResourceList, Pi as SelectField, Ta as SelectFilter, xi as TextAreaField, da as TextColumn, bi as TextField, $n as TextFilter, nt as ThemeSwitch, rt as ThemeToolbar, Ni as TimeField, kn as applyInMemoryListParams, Q as asStringMessages, Sr as buildFormPayload, Cr as buildInlineRowsPayload, jr as buildResourceFormSubmitBody, Qt as combineResourceHandlers, Gt as createAdminRouter, An as createMemoryResourceHandlers, ht as createPermissionsChecker, jn as createRestResourceHandlers, ft as createSessionStorageAuthAdapter, Ut as deriveAuthPaths, sn as describeNonStandardValidationBody, bt as filterFlatNavItems, wt as filterNavByPermission, vt as filterNavItems, Dn as filterRows, hn as finalizeFormErrors, yt as flattenNavLeaves, mn as flattenNestedArrayErrors, un as getErrorBody, br as getFormValue, _t as getNavItemLabel, zt as getRouteAccess, wn as getRowById, wr as hasUploadValues, $t as isAbortError, oi as nestedFieldPath, vn as parseDjangoDRFFormErrors, yn as parseDotNetFormErrors, bn as parseNodeFormErrors, Bt as partitionAdminRoutes, Ar as prepareFormSubmitBody, fn as resolveErrorBody, xr as setFormValue, Nn as toDjangoRestOrdering, kr as toFormData, Fn as toJsonApiSort, Pn as toODataOrderBy, zr as useAbortableEffect, ut as useAuth, gt as useCan, Qi as useChoices, Yt as useDataProvider, Xr as useListQueryState, X as usePermissions, pr as useRegisterPayloadField, mr as useRegisterSectionField, Qr as useResourceListContext, Qe as useThemeMode };
|