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