ding-react-admin 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +670 -641
- package/dist/src/crud/fields/ReferenceField.d.ts.map +1 -1
- package/dist/src/crud/fields/ReferenceManyField.d.ts.map +1 -1
- package/dist/src/crud/filters/ReferenceFilter.d.ts.map +1 -1
- package/dist/src/crud/utils/choiceSelectionUtils.d.ts +7 -0
- package/dist/src/crud/utils/choiceSelectionUtils.d.ts.map +1 -1
- package/dist/src/crud/utils/referenceSelectSelectedProps.d.ts +6 -0
- package/dist/src/crud/utils/referenceSelectSelectedProps.d.ts.map +1 -0
- package/dist/src/crud/utils/useChoices.d.ts +1 -0
- package/dist/src/crud/utils/useChoices.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/crud/fields/ReferenceField.tsx +28 -18
- package/src/crud/fields/ReferenceManyField.tsx +15 -6
- package/src/crud/filters/ReferenceFilter.tsx +19 -4
- package/src/crud/utils/choiceSelectionUtils.test.ts +23 -0
- package/src/crud/utils/choiceSelectionUtils.ts +25 -0
- package/src/crud/utils/referenceSelectSelectedProps.ts +22 -0
- package/src/crud/utils/useChoices.ts +78 -19
package/dist/index.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { Children as e, createContext as t, createElement as n, forwardRef as r, isValidElement as i, useCallback as a, useContext as o, useEffect as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
2
2
|
import { Link as f, Navigate as p, Outlet as m, RouterProvider as h, createBrowserRouter as g, useLocation as _, useNavigate as v, useParams as y, useSearchParams as b } from "react-router-dom";
|
|
3
|
-
import { Alert as x, App as S, Avatar as C, Button as w, Card as T, Col as E, ConfigProvider as D, DatePicker as O, Drawer as k, Dropdown as A, Flex as j, Form as M, Grid as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { AppstoreOutlined as
|
|
6
|
-
import { Controller as
|
|
7
|
-
import
|
|
3
|
+
import { Alert as x, App as S, Avatar as C, Button as w, Card as T, Col as E, ConfigProvider as D, DatePicker as O, Drawer as k, Dropdown as A, Flex as j, Form as M, Grid as N, Image as P, Input as F, InputNumber as I, Layout as L, List as ee, Menu as R, Modal as te, Pagination as ne, Popover as re, Row as z, Segmented as ie, Select as B, Space as V, Spin as ae, Steps as H, Switch as oe, Table as se, Tabs as U, TimePicker as ce, Tooltip as W, Typography as G, theme as K } from "antd";
|
|
4
|
+
import { Fragment as q, jsx as J, jsxs as Y } 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 X, SunOutlined as we, 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 Ze({ children: e, modeStorageKey: t = Ye, densityStorageKey: n = Xe })
|
|
|
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" ? K.darkAlgorithm : K.defaultAlgorithm;
|
|
56
|
+
return { algorithm: a === "compact" ? [e, K.compactAlgorithm] : e };
|
|
57
57
|
}, [m, a]), g = l(() => ({
|
|
58
58
|
mode: r,
|
|
59
59
|
setMode: f,
|
|
@@ -67,104 +67,104 @@ function Ze({ children: e, modeStorageKey: t = Ye, densityStorageKey: n = Xe })
|
|
|
67
67
|
f,
|
|
68
68
|
p
|
|
69
69
|
]);
|
|
70
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ J(We.Provider, {
|
|
71
71
|
value: g,
|
|
72
|
-
children: /* @__PURE__ */
|
|
72
|
+
children: /* @__PURE__ */ J(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__ */ J(_e, {})
|
|
89
89
|
}, {
|
|
90
90
|
label: "Compact",
|
|
91
91
|
value: "compact",
|
|
92
|
-
icon: /* @__PURE__ */
|
|
92
|
+
icon: /* @__PURE__ */ J(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__ */ J(ie, {
|
|
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__ */ J(we, {})
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
label: "Dark",
|
|
113
113
|
value: "dark",
|
|
114
|
-
icon: /* @__PURE__ */
|
|
114
|
+
icon: /* @__PURE__ */ J(be, {})
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
label: "Auto",
|
|
118
118
|
value: "system",
|
|
119
|
-
icon: /* @__PURE__ */
|
|
119
|
+
icon: /* @__PURE__ */ J(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__ */ J(ie, {
|
|
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 } = K.useToken();
|
|
135
|
+
return /* @__PURE__ */ J(re, {
|
|
136
|
+
placement: N.useBreakpoint().lg ? "bottomRight" : "bottom",
|
|
137
137
|
trigger: "click",
|
|
138
|
-
content: /* @__PURE__ */
|
|
138
|
+
content: /* @__PURE__ */ Y(V, {
|
|
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__ */ J(tt, {}), /* @__PURE__ */ J($e, {})]
|
|
146
146
|
}),
|
|
147
147
|
styles: { content: { padding: e.paddingSM } },
|
|
148
|
-
children: /* @__PURE__ */
|
|
148
|
+
children: /* @__PURE__ */ J(w, {
|
|
149
149
|
type: "default",
|
|
150
|
-
icon: /* @__PURE__ */
|
|
150
|
+
icon: /* @__PURE__ */ J(X, {}),
|
|
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 } = K.useToken(), a = r === "on-dark";
|
|
159
|
+
return /* @__PURE__ */ J("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__ */ J(D, {
|
|
166
166
|
theme: a ? { token: { colorTextPlaceholder: "rgba(255, 255, 255, 0.45)" } } : void 0,
|
|
167
|
-
children: /* @__PURE__ */
|
|
167
|
+
children: /* @__PURE__ */ J(F, {
|
|
168
168
|
allowClear: !0,
|
|
169
169
|
size: "small",
|
|
170
170
|
value: e,
|
|
@@ -172,7 +172,7 @@ function it({ 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__ */ J(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 it({ 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 } = K.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__ */ J("div", {
|
|
195
195
|
ref: i,
|
|
196
196
|
className: ["ding-admin-scroll", t].filter(Boolean).join(" "),
|
|
197
197
|
style: {
|
|
@@ -202,15 +202,15 @@ var at = 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 lt({ children: e, adapter: t }) {
|
|
|
222
222
|
s,
|
|
223
223
|
c
|
|
224
224
|
]);
|
|
225
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ J(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,16 +249,16 @@ function ft(e = dt) {
|
|
|
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__ */ J(ft.Provider, {
|
|
256
256
|
value: n,
|
|
257
257
|
children: e
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
let e = o(
|
|
260
|
+
function mt() {
|
|
261
|
+
let e = o(ft);
|
|
262
262
|
if (!e) throw Error("usePermissions must be used within PermissionsProvider");
|
|
263
263
|
return e;
|
|
264
264
|
}
|
|
@@ -266,7 +266,7 @@ function ht(e) {
|
|
|
266
266
|
return (t) => e()?.includes(t) ?? !1;
|
|
267
267
|
}
|
|
268
268
|
function gt(e) {
|
|
269
|
-
let t =
|
|
269
|
+
let t = mt();
|
|
270
270
|
return a(() => t(e), [t, e]);
|
|
271
271
|
}
|
|
272
272
|
//#endregion
|
|
@@ -323,16 +323,16 @@ function xt(e) {
|
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/components/NavMenuLabel.tsx
|
|
325
325
|
function St({ label: e, title: t }) {
|
|
326
|
-
return t ? /* @__PURE__ */
|
|
326
|
+
return t ? /* @__PURE__ */ J(W, {
|
|
327
327
|
title: t,
|
|
328
328
|
placement: "right",
|
|
329
329
|
mouseEnterDelay: 0,
|
|
330
330
|
destroyOnHidden: !0,
|
|
331
|
-
children: /* @__PURE__ */
|
|
331
|
+
children: /* @__PURE__ */ J("span", {
|
|
332
332
|
className: "ding-admin-menu-label",
|
|
333
333
|
children: e
|
|
334
334
|
})
|
|
335
|
-
}) : /* @__PURE__ */
|
|
335
|
+
}) : /* @__PURE__ */ J("span", {
|
|
336
336
|
className: "ding-admin-menu-label",
|
|
337
337
|
children: e
|
|
338
338
|
});
|
|
@@ -342,10 +342,10 @@ function St({ label: e, title: t }) {
|
|
|
342
342
|
function Ct(e, t) {
|
|
343
343
|
let n = t?.showLabelTooltip !== !1, r = t?.wrapLabels === !0, i = t?.collapsed === !0;
|
|
344
344
|
return e.map((e) => {
|
|
345
|
-
let a = e.Icon, o = a ? /* @__PURE__ */
|
|
345
|
+
let a = e.Icon, o = a ? /* @__PURE__ */ J(a, {}) : void 0, s = _t(e), c = s && n ? /* @__PURE__ */ J(St, {
|
|
346
346
|
label: e.label,
|
|
347
347
|
title: s
|
|
348
|
-
}) : r ? /* @__PURE__ */
|
|
348
|
+
}) : r ? /* @__PURE__ */ J(St, {
|
|
349
349
|
label: e.label,
|
|
350
350
|
title: ""
|
|
351
351
|
}) : e.label, l = i && s ? { title: s } : {};
|
|
@@ -393,7 +393,7 @@ function Dt(e) {
|
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
function Ot() {
|
|
396
|
-
return
|
|
396
|
+
return N.useBreakpoint().lg !== !0;
|
|
397
397
|
}
|
|
398
398
|
function kt(e) {
|
|
399
399
|
let t = /* @__PURE__ */ new Set();
|
|
@@ -417,12 +417,12 @@ function jt({ wrapLabels: e, itemDivider: t = "none" }) {
|
|
|
417
417
|
return e && n.push("ding-admin-nav-menu--wrap-labels"), t === "full" ? n.push("ding-admin-nav-menu--item-divider-full") : t === "inset" && n.push("ding-admin-nav-menu--item-divider-inset"), n.join(" ");
|
|
418
418
|
}
|
|
419
419
|
function Mt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, onOpenChange: i, onNavigate: a, navQuery: o, onNavQueryChange: s, showNavSearch: c, navSearchPlaceholder: l, scrollVariant: u, searchVariant: d, wrapLabels: f, itemDivider: p }) {
|
|
420
|
-
return /* @__PURE__ */
|
|
420
|
+
return /* @__PURE__ */ Y(q, { children: [c && !n ? /* @__PURE__ */ J(rt, {
|
|
421
421
|
value: o,
|
|
422
422
|
onChange: s,
|
|
423
423
|
placeholder: l,
|
|
424
424
|
variant: d
|
|
425
|
-
}) : null, /* @__PURE__ */
|
|
425
|
+
}) : null, /* @__PURE__ */ J(it, {
|
|
426
426
|
variant: u,
|
|
427
427
|
style: {
|
|
428
428
|
flex: 1,
|
|
@@ -430,7 +430,7 @@ function Mt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
430
430
|
overflowY: "auto",
|
|
431
431
|
overflowX: "hidden"
|
|
432
432
|
},
|
|
433
|
-
children: /* @__PURE__ */
|
|
433
|
+
children: /* @__PURE__ */ J(Nt, {
|
|
434
434
|
menuItems: e,
|
|
435
435
|
selectedKeys: t,
|
|
436
436
|
inlineCollapsed: n,
|
|
@@ -443,7 +443,7 @@ function Mt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
443
443
|
})] });
|
|
444
444
|
}
|
|
445
445
|
function Nt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, onOpenChange: i, onNavigate: a, wrapLabels: o, itemDivider: s }) {
|
|
446
|
-
return /* @__PURE__ */
|
|
446
|
+
return /* @__PURE__ */ J(R, {
|
|
447
447
|
className: jt({
|
|
448
448
|
wrapLabels: o,
|
|
449
449
|
itemDivider: s
|
|
@@ -469,87 +469,87 @@ function Nt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
|
|
|
469
469
|
});
|
|
470
470
|
}
|
|
471
471
|
function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDrawerTitle: r, headerExtras: i, userMenuItems: o, onUserMenuClick: c, loginPath: f = "/login", siderCollapsedStorageKey: p = Et, navSearch: h = !0, navMenu: g, hideSider: y = !1 }) {
|
|
472
|
-
let b = v(), x = _(), { resolved: S } =
|
|
472
|
+
let b = v(), x = _(), { resolved: S } = Ze(), T = S === "dark", { logout: E, userLabel: D } = lt(), O = mt(), [j, M] = d(() => Dt(p)), [N, P] = d(!1), F = Ot(), { token: I } = K.useToken(), ee = u(null), [R, te] = d(""), ne = h !== !1, re = typeof h == "object" ? h.placeholder : void 0, z = g?.wrapLabels !== !1, ie = g?.itemDivider ?? "inset", B = r ?? t, V = () => {
|
|
473
473
|
E(), b(f, { replace: !0 });
|
|
474
|
-
},
|
|
474
|
+
}, ae = a((e) => {
|
|
475
475
|
M(e);
|
|
476
476
|
try {
|
|
477
477
|
localStorage.setItem(p, e ? "1" : "0");
|
|
478
478
|
} catch {}
|
|
479
479
|
}, [p]);
|
|
480
480
|
s(() => {
|
|
481
|
-
|
|
482
|
-
}, [
|
|
483
|
-
|
|
481
|
+
F || P(!1);
|
|
482
|
+
}, [F]), s(() => {
|
|
483
|
+
P(!1);
|
|
484
484
|
}, [x.pathname]), s(() => {
|
|
485
|
-
|
|
485
|
+
ee.current?.scrollTo({
|
|
486
486
|
top: 0,
|
|
487
487
|
left: 0
|
|
488
488
|
});
|
|
489
489
|
}, [x.pathname]), s(() => {
|
|
490
|
-
j &&
|
|
490
|
+
j && te("");
|
|
491
491
|
}, [j]);
|
|
492
|
-
let
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
]),
|
|
497
|
-
showLabelTooltip: !j && !
|
|
498
|
-
wrapLabels:
|
|
492
|
+
let H = l(() => wt(e, O), [e, O]), oe = R.trim(), se = oe.length > 0, U = l(() => se ? vt(H, oe) : H, [
|
|
493
|
+
H,
|
|
494
|
+
oe,
|
|
495
|
+
se
|
|
496
|
+
]), ce = l(() => kt(U), [U]), W = l(() => Ct(U, {
|
|
497
|
+
showLabelTooltip: !j && !z,
|
|
498
|
+
wrapLabels: z && !j,
|
|
499
499
|
collapsed: j
|
|
500
500
|
}), [
|
|
501
|
-
|
|
501
|
+
U,
|
|
502
502
|
j,
|
|
503
|
-
|
|
504
|
-
]),
|
|
503
|
+
z
|
|
504
|
+
]), q = l(() => xt(U), [U]), le = l(() => At(H, x.pathname), [H, x.pathname]), [ue, de] = d(() => At(H, x.pathname));
|
|
505
505
|
s(() => {
|
|
506
|
-
|
|
507
|
-
}, [
|
|
508
|
-
let
|
|
509
|
-
|
|
510
|
-
}, []),
|
|
511
|
-
|
|
512
|
-
}, []),
|
|
506
|
+
de((e) => [...new Set([...e, ...le])]);
|
|
507
|
+
}, [le]);
|
|
508
|
+
let fe = a((e) => {
|
|
509
|
+
de(e);
|
|
510
|
+
}, []), pe = se ? q : ue, me = a((e) => {
|
|
511
|
+
te(e);
|
|
512
|
+
}, []), he = l(() => [{
|
|
513
513
|
key: "logout",
|
|
514
|
-
icon: /* @__PURE__ */
|
|
514
|
+
icon: /* @__PURE__ */ J(ve, {}),
|
|
515
515
|
label: "Log out",
|
|
516
516
|
danger: !0
|
|
517
|
-
}], []),
|
|
517
|
+
}], []), ge = o ?? he, _e = (e) => {
|
|
518
518
|
if (c) {
|
|
519
519
|
c(e);
|
|
520
520
|
return;
|
|
521
521
|
}
|
|
522
|
-
e.key === "logout" &&
|
|
523
|
-
},
|
|
524
|
-
|
|
522
|
+
e.key === "logout" && V();
|
|
523
|
+
}, be = T ? I.colorBgContainer : Tt, xe = T ? "default" : "on-dark", Se = T ? "app" : "on-dark", Ce = [x.pathname], X = (e) => {
|
|
524
|
+
ce.has(e) && (b(e), F && P(!1));
|
|
525
525
|
};
|
|
526
|
-
return /* @__PURE__ */
|
|
526
|
+
return /* @__PURE__ */ Y(L, {
|
|
527
527
|
style: {
|
|
528
528
|
height: "100vh",
|
|
529
529
|
width: "100%",
|
|
530
530
|
overflow: "hidden",
|
|
531
|
-
background:
|
|
531
|
+
background: I.colorBgLayout
|
|
532
532
|
},
|
|
533
533
|
children: [
|
|
534
|
-
!y && !
|
|
534
|
+
!y && !F && /* @__PURE__ */ J(L.Sider, {
|
|
535
535
|
collapsible: !0,
|
|
536
536
|
collapsed: j,
|
|
537
|
-
onCollapse:
|
|
537
|
+
onCollapse: ae,
|
|
538
538
|
collapsedWidth: 64,
|
|
539
539
|
style: {
|
|
540
|
-
background:
|
|
540
|
+
background: be,
|
|
541
541
|
height: "100vh",
|
|
542
542
|
overflow: "hidden",
|
|
543
|
-
borderInlineEnd: T ? `1px solid ${
|
|
543
|
+
borderInlineEnd: T ? `1px solid ${I.colorSplit}` : void 0
|
|
544
544
|
},
|
|
545
|
-
children: /* @__PURE__ */
|
|
545
|
+
children: /* @__PURE__ */ Y("div", {
|
|
546
546
|
style: {
|
|
547
547
|
display: "flex",
|
|
548
548
|
flexDirection: "column",
|
|
549
549
|
height: "100%",
|
|
550
550
|
overflow: "hidden"
|
|
551
551
|
},
|
|
552
|
-
children: [/* @__PURE__ */
|
|
552
|
+
children: [/* @__PURE__ */ J("div", {
|
|
553
553
|
style: {
|
|
554
554
|
height: 64,
|
|
555
555
|
flexShrink: 0,
|
|
@@ -558,76 +558,76 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
558
558
|
justifyContent: "center",
|
|
559
559
|
fontWeight: 600
|
|
560
560
|
},
|
|
561
|
-
children: /* @__PURE__ */
|
|
561
|
+
children: /* @__PURE__ */ J(G.Text, {
|
|
562
562
|
strong: !0,
|
|
563
|
-
style: { color:
|
|
563
|
+
style: { color: I.colorTextLightSolid },
|
|
564
564
|
children: j ? n : t
|
|
565
565
|
})
|
|
566
|
-
}), /* @__PURE__ */
|
|
567
|
-
menuItems:
|
|
568
|
-
selectedKeys:
|
|
566
|
+
}), /* @__PURE__ */ J(Mt, {
|
|
567
|
+
menuItems: W,
|
|
568
|
+
selectedKeys: Ce,
|
|
569
569
|
inlineCollapsed: j,
|
|
570
|
-
openKeys:
|
|
571
|
-
onOpenChange:
|
|
572
|
-
onNavigate:
|
|
573
|
-
navQuery:
|
|
574
|
-
onNavQueryChange:
|
|
575
|
-
showNavSearch:
|
|
576
|
-
navSearchPlaceholder:
|
|
577
|
-
scrollVariant:
|
|
578
|
-
searchVariant:
|
|
579
|
-
wrapLabels:
|
|
580
|
-
itemDivider:
|
|
570
|
+
openKeys: pe,
|
|
571
|
+
onOpenChange: fe,
|
|
572
|
+
onNavigate: X,
|
|
573
|
+
navQuery: R,
|
|
574
|
+
onNavQueryChange: me,
|
|
575
|
+
showNavSearch: ne,
|
|
576
|
+
navSearchPlaceholder: re,
|
|
577
|
+
scrollVariant: xe,
|
|
578
|
+
searchVariant: Se,
|
|
579
|
+
wrapLabels: z,
|
|
580
|
+
itemDivider: ie
|
|
581
581
|
})]
|
|
582
582
|
})
|
|
583
583
|
}),
|
|
584
|
-
!y &&
|
|
585
|
-
title: /* @__PURE__ */
|
|
584
|
+
!y && F && /* @__PURE__ */ J(k, {
|
|
585
|
+
title: /* @__PURE__ */ J(G.Text, {
|
|
586
586
|
strong: !0,
|
|
587
|
-
style: { color:
|
|
588
|
-
children:
|
|
587
|
+
style: { color: I.colorTextLightSolid },
|
|
588
|
+
children: B
|
|
589
589
|
}),
|
|
590
590
|
placement: "left",
|
|
591
591
|
size: 280,
|
|
592
|
-
onClose: () =>
|
|
593
|
-
open:
|
|
592
|
+
onClose: () => P(!1),
|
|
593
|
+
open: N,
|
|
594
594
|
styles: {
|
|
595
595
|
header: {
|
|
596
|
-
background:
|
|
597
|
-
borderBottom: `1px solid ${
|
|
596
|
+
background: be,
|
|
597
|
+
borderBottom: `1px solid ${I.colorSplit}`
|
|
598
598
|
},
|
|
599
599
|
body: {
|
|
600
600
|
padding: 0,
|
|
601
|
-
background:
|
|
601
|
+
background: be
|
|
602
602
|
}
|
|
603
603
|
},
|
|
604
604
|
destroyOnHidden: !0,
|
|
605
|
-
children: /* @__PURE__ */
|
|
605
|
+
children: /* @__PURE__ */ J("div", {
|
|
606
606
|
style: {
|
|
607
607
|
display: "flex",
|
|
608
608
|
flexDirection: "column",
|
|
609
609
|
height: "100%",
|
|
610
610
|
overflow: "hidden"
|
|
611
611
|
},
|
|
612
|
-
children: /* @__PURE__ */
|
|
613
|
-
menuItems:
|
|
614
|
-
selectedKeys:
|
|
612
|
+
children: /* @__PURE__ */ J(Mt, {
|
|
613
|
+
menuItems: W,
|
|
614
|
+
selectedKeys: Ce,
|
|
615
615
|
inlineCollapsed: !1,
|
|
616
|
-
openKeys:
|
|
617
|
-
onOpenChange:
|
|
618
|
-
onNavigate:
|
|
619
|
-
navQuery:
|
|
620
|
-
onNavQueryChange:
|
|
621
|
-
showNavSearch:
|
|
622
|
-
navSearchPlaceholder:
|
|
623
|
-
scrollVariant:
|
|
624
|
-
searchVariant:
|
|
625
|
-
wrapLabels:
|
|
626
|
-
itemDivider:
|
|
616
|
+
openKeys: pe,
|
|
617
|
+
onOpenChange: fe,
|
|
618
|
+
onNavigate: X,
|
|
619
|
+
navQuery: R,
|
|
620
|
+
onNavQueryChange: me,
|
|
621
|
+
showNavSearch: ne,
|
|
622
|
+
navSearchPlaceholder: re,
|
|
623
|
+
scrollVariant: xe,
|
|
624
|
+
searchVariant: Se,
|
|
625
|
+
wrapLabels: z,
|
|
626
|
+
itemDivider: ie
|
|
627
627
|
})
|
|
628
628
|
})
|
|
629
629
|
}),
|
|
630
|
-
/* @__PURE__ */
|
|
630
|
+
/* @__PURE__ */ Y(L, {
|
|
631
631
|
style: {
|
|
632
632
|
minWidth: 0,
|
|
633
633
|
flex: 1,
|
|
@@ -636,49 +636,49 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
636
636
|
display: "flex",
|
|
637
637
|
flexDirection: "column"
|
|
638
638
|
},
|
|
639
|
-
children: [/* @__PURE__ */
|
|
639
|
+
children: [/* @__PURE__ */ Y(L.Header, {
|
|
640
640
|
style: {
|
|
641
|
-
background:
|
|
642
|
-
paddingInline:
|
|
641
|
+
background: I.colorBgContainer,
|
|
642
|
+
paddingInline: I.paddingLG,
|
|
643
643
|
display: "flex",
|
|
644
644
|
alignItems: "center",
|
|
645
|
-
gap:
|
|
645
|
+
gap: I.marginSM,
|
|
646
646
|
lineHeight: "normal",
|
|
647
647
|
flexShrink: 0
|
|
648
648
|
},
|
|
649
649
|
children: [
|
|
650
|
-
!y &&
|
|
650
|
+
!y && F && /* @__PURE__ */ J(w, {
|
|
651
651
|
type: "text",
|
|
652
|
-
icon: /* @__PURE__ */
|
|
653
|
-
onClick: () =>
|
|
652
|
+
icon: /* @__PURE__ */ J(ye, {}),
|
|
653
|
+
onClick: () => P(!0),
|
|
654
654
|
"aria-label": "Open navigation"
|
|
655
655
|
}),
|
|
656
|
-
/* @__PURE__ */
|
|
656
|
+
/* @__PURE__ */ J("div", { style: {
|
|
657
657
|
flex: 1,
|
|
658
658
|
minWidth: 0
|
|
659
659
|
} }),
|
|
660
660
|
i,
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ J(nt, {}),
|
|
662
|
+
/* @__PURE__ */ J(A, {
|
|
663
663
|
menu: {
|
|
664
|
-
items:
|
|
665
|
-
onClick:
|
|
664
|
+
items: ge,
|
|
665
|
+
onClick: _e
|
|
666
666
|
},
|
|
667
667
|
trigger: ["click"],
|
|
668
|
-
children: /* @__PURE__ */
|
|
668
|
+
children: /* @__PURE__ */ Y(w, {
|
|
669
669
|
type: "text",
|
|
670
670
|
style: {
|
|
671
671
|
display: "inline-flex",
|
|
672
672
|
alignItems: "center",
|
|
673
|
-
gap:
|
|
674
|
-
maxWidth:
|
|
675
|
-
paddingInline:
|
|
673
|
+
gap: I.marginXS,
|
|
674
|
+
maxWidth: F ? 44 : void 0,
|
|
675
|
+
paddingInline: F ? I.paddingXS : void 0
|
|
676
676
|
},
|
|
677
677
|
"aria-label": "Account menu",
|
|
678
|
-
children: [/* @__PURE__ */
|
|
678
|
+
children: [/* @__PURE__ */ J(C, {
|
|
679
679
|
size: "small",
|
|
680
|
-
icon: /* @__PURE__ */
|
|
681
|
-
}), !
|
|
680
|
+
icon: /* @__PURE__ */ J(Ee, {})
|
|
681
|
+
}), !F && /* @__PURE__ */ J(G.Text, {
|
|
682
682
|
type: "secondary",
|
|
683
683
|
ellipsis: !0,
|
|
684
684
|
style: { maxWidth: 160 },
|
|
@@ -687,7 +687,7 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
687
687
|
})
|
|
688
688
|
})
|
|
689
689
|
]
|
|
690
|
-
}), /* @__PURE__ */
|
|
690
|
+
}), /* @__PURE__ */ J(L.Content, {
|
|
691
691
|
style: {
|
|
692
692
|
minWidth: 0,
|
|
693
693
|
flex: 1,
|
|
@@ -695,15 +695,15 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
695
695
|
display: "flex",
|
|
696
696
|
flexDirection: "column"
|
|
697
697
|
},
|
|
698
|
-
children: /* @__PURE__ */
|
|
699
|
-
ref:
|
|
698
|
+
children: /* @__PURE__ */ J(it, {
|
|
699
|
+
ref: ee,
|
|
700
700
|
style: {
|
|
701
|
-
margin:
|
|
701
|
+
margin: F ? I.marginSM : I.marginLG,
|
|
702
702
|
flex: 1,
|
|
703
703
|
minHeight: 0,
|
|
704
704
|
overflow: "auto"
|
|
705
705
|
},
|
|
706
|
-
children: /* @__PURE__ */
|
|
706
|
+
children: /* @__PURE__ */ J(m, {})
|
|
707
707
|
})
|
|
708
708
|
})]
|
|
709
709
|
})
|
|
@@ -713,30 +713,30 @@ function Pt({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
|
|
|
713
713
|
//#endregion
|
|
714
714
|
//#region src/router/guards.tsx
|
|
715
715
|
function Ft({ when: e, redirect: t, children: n }) {
|
|
716
|
-
return e ? n : /* @__PURE__ */
|
|
716
|
+
return e ? n : /* @__PURE__ */ J(p, {
|
|
717
717
|
to: t,
|
|
718
718
|
replace: !0
|
|
719
719
|
});
|
|
720
720
|
}
|
|
721
721
|
function It({ children: e, redirectTo: t = "/login" }) {
|
|
722
|
-
let { isAuthenticated: n } =
|
|
723
|
-
return /* @__PURE__ */
|
|
722
|
+
let { isAuthenticated: n } = lt();
|
|
723
|
+
return /* @__PURE__ */ J(Ft, {
|
|
724
724
|
when: n,
|
|
725
725
|
redirect: t,
|
|
726
726
|
children: e
|
|
727
727
|
});
|
|
728
728
|
}
|
|
729
729
|
function Lt({ children: e, redirectTo: t = "/" }) {
|
|
730
|
-
let { isAuthenticated: n } =
|
|
731
|
-
return /* @__PURE__ */
|
|
730
|
+
let { isAuthenticated: n } = lt();
|
|
731
|
+
return /* @__PURE__ */ J(Ft, {
|
|
732
732
|
when: !n,
|
|
733
733
|
redirect: t,
|
|
734
734
|
children: e
|
|
735
735
|
});
|
|
736
736
|
}
|
|
737
737
|
function Rt({ permission: e, redirect: t, children: n }) {
|
|
738
|
-
return /* @__PURE__ */
|
|
739
|
-
when:
|
|
738
|
+
return /* @__PURE__ */ J(Ft, {
|
|
739
|
+
when: mt()(e),
|
|
740
740
|
redirect: t,
|
|
741
741
|
children: n
|
|
742
742
|
});
|
|
@@ -790,7 +790,7 @@ function Gt({ navItems: e, children: t, layoutProps: n, redirects: r }) {
|
|
|
790
790
|
let { loginPath: i, homePath: a } = Ut(t, r), { guest: o, public: s, protected: c } = Bt(t), l = [];
|
|
791
791
|
for (let e of o) !("path" in e) || !e.path || l.push({
|
|
792
792
|
path: Vt(e.path),
|
|
793
|
-
element: /* @__PURE__ */
|
|
793
|
+
element: /* @__PURE__ */ J(Lt, {
|
|
794
794
|
redirectTo: a,
|
|
795
795
|
children: e.element
|
|
796
796
|
})
|
|
@@ -801,9 +801,9 @@ function Gt({ navItems: e, children: t, layoutProps: n, redirects: r }) {
|
|
|
801
801
|
});
|
|
802
802
|
return c.length > 0 && l.push({
|
|
803
803
|
path: "/",
|
|
804
|
-
element: /* @__PURE__ */
|
|
804
|
+
element: /* @__PURE__ */ J(It, {
|
|
805
805
|
redirectTo: i,
|
|
806
|
-
children: /* @__PURE__ */
|
|
806
|
+
children: /* @__PURE__ */ J(Pt, {
|
|
807
807
|
navItems: e,
|
|
808
808
|
loginPath: i,
|
|
809
809
|
...n
|
|
@@ -812,7 +812,7 @@ function Gt({ navItems: e, children: t, layoutProps: n, redirects: r }) {
|
|
|
812
812
|
children: c.map(Wt)
|
|
813
813
|
}), l.push({
|
|
814
814
|
path: "*",
|
|
815
|
-
element: /* @__PURE__ */
|
|
815
|
+
element: /* @__PURE__ */ J(p, {
|
|
816
816
|
to: a,
|
|
817
817
|
replace: !0
|
|
818
818
|
})
|
|
@@ -832,9 +832,9 @@ function Kt({ navItems: e, routes: t, authRedirects: n, layoutProps: r, theme: i
|
|
|
832
832
|
r,
|
|
833
833
|
n
|
|
834
834
|
]);
|
|
835
|
-
return /* @__PURE__ */
|
|
835
|
+
return /* @__PURE__ */ J(Xe, {
|
|
836
836
|
...i,
|
|
837
|
-
children: /* @__PURE__ */
|
|
837
|
+
children: /* @__PURE__ */ J(h, { router: a })
|
|
838
838
|
});
|
|
839
839
|
}
|
|
840
840
|
//#endregion
|
|
@@ -842,7 +842,7 @@ function Kt({ navItems: e, routes: t, authRedirects: n, layoutProps: r, theme: i
|
|
|
842
842
|
var qt = t(null);
|
|
843
843
|
function Jt({ children: e, value: t }) {
|
|
844
844
|
let n = l(() => t, [t]);
|
|
845
|
-
return /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ J(qt.Provider, {
|
|
846
846
|
value: n,
|
|
847
847
|
children: e
|
|
848
848
|
});
|
|
@@ -1188,7 +1188,7 @@ function Fn(e) {
|
|
|
1188
1188
|
//#endregion
|
|
1189
1189
|
//#region src/components/AuthAlternateLink.tsx
|
|
1190
1190
|
function In({ prompt: e, linkText: t, to: n }) {
|
|
1191
|
-
return /* @__PURE__ */
|
|
1191
|
+
return /* @__PURE__ */ Y(G.Paragraph, {
|
|
1192
1192
|
type: "secondary",
|
|
1193
1193
|
style: {
|
|
1194
1194
|
textAlign: "center",
|
|
@@ -1197,7 +1197,7 @@ function In({ prompt: e, linkText: t, to: n }) {
|
|
|
1197
1197
|
children: [
|
|
1198
1198
|
e,
|
|
1199
1199
|
" ",
|
|
1200
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ J(f, {
|
|
1201
1201
|
to: n,
|
|
1202
1202
|
children: t
|
|
1203
1203
|
})
|
|
@@ -1207,8 +1207,8 @@ function In({ prompt: e, linkText: t, to: n }) {
|
|
|
1207
1207
|
//#endregion
|
|
1208
1208
|
//#region src/layouts/AuthPageLayout.tsx
|
|
1209
1209
|
function Ln({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
1210
|
-
let { token: i } =
|
|
1211
|
-
return /* @__PURE__ */
|
|
1210
|
+
let { token: i } = K.useToken();
|
|
1211
|
+
return /* @__PURE__ */ Y(j, {
|
|
1212
1212
|
vertical: !0,
|
|
1213
1213
|
align: "stretch",
|
|
1214
1214
|
style: {
|
|
@@ -1219,7 +1219,7 @@ function Ln({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1219
1219
|
background: i.colorBgLayout
|
|
1220
1220
|
},
|
|
1221
1221
|
children: [
|
|
1222
|
-
r ? /* @__PURE__ */
|
|
1222
|
+
r ? /* @__PURE__ */ J(j, {
|
|
1223
1223
|
justify: "flex-end",
|
|
1224
1224
|
style: {
|
|
1225
1225
|
flexShrink: 0,
|
|
@@ -1227,9 +1227,9 @@ function Ln({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1227
1227
|
padding: 16,
|
|
1228
1228
|
background: i.colorBgLayout
|
|
1229
1229
|
},
|
|
1230
|
-
children: /* @__PURE__ */
|
|
1230
|
+
children: /* @__PURE__ */ J(nt, {})
|
|
1231
1231
|
}) : null,
|
|
1232
|
-
t ? /* @__PURE__ */
|
|
1232
|
+
t ? /* @__PURE__ */ J("div", {
|
|
1233
1233
|
style: {
|
|
1234
1234
|
flexShrink: 0,
|
|
1235
1235
|
textAlign: "center",
|
|
@@ -1237,14 +1237,14 @@ function Ln({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1237
1237
|
},
|
|
1238
1238
|
children: t
|
|
1239
1239
|
}) : null,
|
|
1240
|
-
/* @__PURE__ */
|
|
1240
|
+
/* @__PURE__ */ J(it, {
|
|
1241
1241
|
style: {
|
|
1242
1242
|
flex: 1,
|
|
1243
1243
|
minHeight: 0,
|
|
1244
1244
|
width: "100%",
|
|
1245
1245
|
background: i.colorBgLayout
|
|
1246
1246
|
},
|
|
1247
|
-
children: /* @__PURE__ */
|
|
1247
|
+
children: /* @__PURE__ */ Y(j, {
|
|
1248
1248
|
vertical: !0,
|
|
1249
1249
|
align: "center",
|
|
1250
1250
|
justify: "flex-start",
|
|
@@ -1253,7 +1253,7 @@ function Ln({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1253
1253
|
minHeight: "100%",
|
|
1254
1254
|
padding: "0 24px 24px"
|
|
1255
1255
|
},
|
|
1256
|
-
children: [e, n ? /* @__PURE__ */
|
|
1256
|
+
children: [e, n ? /* @__PURE__ */ J("div", {
|
|
1257
1257
|
style: {
|
|
1258
1258
|
marginTop: 16,
|
|
1259
1259
|
width: "100%",
|
|
@@ -1269,26 +1269,26 @@ function Ln({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
|
|
|
1269
1269
|
//#endregion
|
|
1270
1270
|
//#region src/pages/LoginPage.tsx
|
|
1271
1271
|
function Rn({ title: e = "Sign in", description: t = "Use any username and password to continue.", logo: n, brand: r, extraFields: i, showThemeToolbar: a = !0, afterLoginPath: o = "/", alternateAuth: s, footer: c }) {
|
|
1272
|
-
let { login: l } =
|
|
1273
|
-
return /* @__PURE__ */
|
|
1272
|
+
let { login: l } = lt(), u = v();
|
|
1273
|
+
return /* @__PURE__ */ J(Ln, {
|
|
1274
1274
|
brand: r ?? n,
|
|
1275
|
-
footer: c ?? (s ? /* @__PURE__ */
|
|
1275
|
+
footer: c ?? (s ? /* @__PURE__ */ J(In, {
|
|
1276
1276
|
prompt: s.prompt ?? "Don't have an account?",
|
|
1277
1277
|
linkText: s.linkText,
|
|
1278
1278
|
to: s.to
|
|
1279
1279
|
}) : null),
|
|
1280
1280
|
showThemeToolbar: a,
|
|
1281
|
-
children: /* @__PURE__ */
|
|
1281
|
+
children: /* @__PURE__ */ Y(T, {
|
|
1282
1282
|
style: {
|
|
1283
1283
|
width: "100%",
|
|
1284
1284
|
maxWidth: 360
|
|
1285
1285
|
},
|
|
1286
1286
|
title: e,
|
|
1287
|
-
children: [t ? /* @__PURE__ */
|
|
1287
|
+
children: [t ? /* @__PURE__ */ J(G.Paragraph, {
|
|
1288
1288
|
type: "secondary",
|
|
1289
1289
|
style: { marginTop: 0 },
|
|
1290
1290
|
children: t
|
|
1291
|
-
}) : null, /* @__PURE__ */
|
|
1291
|
+
}) : null, /* @__PURE__ */ Y(M, {
|
|
1292
1292
|
layout: "vertical",
|
|
1293
1293
|
onFinish: async (e) => {
|
|
1294
1294
|
await l({
|
|
@@ -1298,28 +1298,28 @@ function Rn({ title: e = "Sign in", description: t = "Use any username and passw
|
|
|
1298
1298
|
}), u(o, { replace: !0 });
|
|
1299
1299
|
},
|
|
1300
1300
|
children: [
|
|
1301
|
-
/* @__PURE__ */
|
|
1301
|
+
/* @__PURE__ */ J(M.Item, {
|
|
1302
1302
|
name: "username",
|
|
1303
1303
|
label: "Username",
|
|
1304
1304
|
rules: [{
|
|
1305
1305
|
required: !0,
|
|
1306
1306
|
message: "Required"
|
|
1307
1307
|
}],
|
|
1308
|
-
children: /* @__PURE__ */
|
|
1308
|
+
children: /* @__PURE__ */ J(F, { autoComplete: "username" })
|
|
1309
1309
|
}),
|
|
1310
|
-
/* @__PURE__ */
|
|
1310
|
+
/* @__PURE__ */ J(M.Item, {
|
|
1311
1311
|
name: "password",
|
|
1312
1312
|
label: "Password",
|
|
1313
1313
|
rules: [{
|
|
1314
1314
|
required: !0,
|
|
1315
1315
|
message: "Required"
|
|
1316
1316
|
}],
|
|
1317
|
-
children: /* @__PURE__ */
|
|
1317
|
+
children: /* @__PURE__ */ J(F.Password, { autoComplete: "current-password" })
|
|
1318
1318
|
}),
|
|
1319
1319
|
i,
|
|
1320
|
-
/* @__PURE__ */
|
|
1320
|
+
/* @__PURE__ */ J(M.Item, {
|
|
1321
1321
|
style: { marginBottom: 0 },
|
|
1322
|
-
children: /* @__PURE__ */
|
|
1322
|
+
children: /* @__PURE__ */ J(w, {
|
|
1323
1323
|
type: "primary",
|
|
1324
1324
|
htmlType: "submit",
|
|
1325
1325
|
block: !0,
|
|
@@ -1334,7 +1334,7 @@ function Rn({ title: e = "Sign in", description: t = "Use any username and passw
|
|
|
1334
1334
|
//#endregion
|
|
1335
1335
|
//#region src/pages/PlaceholderPage.tsx
|
|
1336
1336
|
function zn({ title: e }) {
|
|
1337
|
-
return /* @__PURE__ */
|
|
1337
|
+
return /* @__PURE__ */ J(G.Title, {
|
|
1338
1338
|
level: 3,
|
|
1339
1339
|
style: { marginTop: 0 },
|
|
1340
1340
|
children: e
|
|
@@ -1343,7 +1343,7 @@ function zn({ title: e }) {
|
|
|
1343
1343
|
//#endregion
|
|
1344
1344
|
//#region src/components/AppHub.tsx
|
|
1345
1345
|
function Bn({ apps: e, menuItems: t, onAppClick: n, onMenuClick: r, menuSearchPlaceholder: i = "Search menus across apps…", className: a, maxWidth: o = 960, loading: s = !1 }) {
|
|
1346
|
-
let c = v(), { token: u } =
|
|
1346
|
+
let c = v(), { token: u } = K.useToken(), [f, p] = d(""), m = (e) => {
|
|
1347
1347
|
if (n) {
|
|
1348
1348
|
n(e);
|
|
1349
1349
|
return;
|
|
@@ -1356,7 +1356,7 @@ function Bn({ apps: e, menuItems: t, onAppClick: n, onMenuClick: r, menuSearchPl
|
|
|
1356
1356
|
}
|
|
1357
1357
|
c(e.path);
|
|
1358
1358
|
}, g = f.trim(), _ = l(() => t && g ? bt(t, g) : [], [t, g]), y = !!(t && g);
|
|
1359
|
-
return /* @__PURE__ */
|
|
1359
|
+
return /* @__PURE__ */ Y("div", {
|
|
1360
1360
|
className: a,
|
|
1361
1361
|
style: {
|
|
1362
1362
|
width: "100%",
|
|
@@ -1364,25 +1364,25 @@ function Bn({ apps: e, menuItems: t, onAppClick: n, onMenuClick: r, menuSearchPl
|
|
|
1364
1364
|
marginInline: "auto",
|
|
1365
1365
|
paddingInline: u.paddingMD
|
|
1366
1366
|
},
|
|
1367
|
-
children: [t?.length && !s ? /* @__PURE__ */
|
|
1367
|
+
children: [t?.length && !s ? /* @__PURE__ */ J("div", {
|
|
1368
1368
|
style: {
|
|
1369
1369
|
maxWidth: 480,
|
|
1370
1370
|
margin: "0 auto 24px"
|
|
1371
1371
|
},
|
|
1372
|
-
children: /* @__PURE__ */
|
|
1372
|
+
children: /* @__PURE__ */ J(rt, {
|
|
1373
1373
|
value: f,
|
|
1374
1374
|
onChange: p,
|
|
1375
1375
|
placeholder: i,
|
|
1376
1376
|
variant: "app"
|
|
1377
1377
|
})
|
|
1378
|
-
}) : null, s ? /* @__PURE__ */
|
|
1378
|
+
}) : null, s ? /* @__PURE__ */ J("div", {
|
|
1379
1379
|
style: {
|
|
1380
1380
|
display: "flex",
|
|
1381
1381
|
justifyContent: "center",
|
|
1382
1382
|
padding: u.paddingXL
|
|
1383
1383
|
},
|
|
1384
|
-
children: /* @__PURE__ */
|
|
1385
|
-
}) : y ? /* @__PURE__ */
|
|
1384
|
+
children: /* @__PURE__ */ J(ae, { size: "large" })
|
|
1385
|
+
}) : y ? /* @__PURE__ */ J(ee, {
|
|
1386
1386
|
bordered: !0,
|
|
1387
1387
|
dataSource: _,
|
|
1388
1388
|
locale: { emptyText: "No menus match your search." },
|
|
@@ -1392,50 +1392,50 @@ function Bn({ apps: e, menuItems: t, onAppClick: n, onMenuClick: r, menuSearchPl
|
|
|
1392
1392
|
},
|
|
1393
1393
|
renderItem: (e) => {
|
|
1394
1394
|
let t = e.Icon;
|
|
1395
|
-
return /* @__PURE__ */
|
|
1395
|
+
return /* @__PURE__ */ J(ee.Item, {
|
|
1396
1396
|
style: { cursor: "pointer" },
|
|
1397
1397
|
onClick: () => h(e),
|
|
1398
|
-
children: /* @__PURE__ */
|
|
1399
|
-
avatar: t ? /* @__PURE__ */
|
|
1398
|
+
children: /* @__PURE__ */ J(ee.Item.Meta, {
|
|
1399
|
+
avatar: t ? /* @__PURE__ */ J("span", {
|
|
1400
1400
|
style: {
|
|
1401
1401
|
fontSize: 20,
|
|
1402
1402
|
lineHeight: 1
|
|
1403
1403
|
},
|
|
1404
|
-
children: /* @__PURE__ */
|
|
1404
|
+
children: /* @__PURE__ */ J(t, {})
|
|
1405
1405
|
}) : void 0,
|
|
1406
1406
|
title: _t(e),
|
|
1407
1407
|
description: e.group
|
|
1408
1408
|
})
|
|
1409
1409
|
});
|
|
1410
1410
|
}
|
|
1411
|
-
}) : /* @__PURE__ */
|
|
1411
|
+
}) : /* @__PURE__ */ J(z, {
|
|
1412
1412
|
gutter: [16, 16],
|
|
1413
1413
|
justify: "center",
|
|
1414
1414
|
children: e.map((e) => {
|
|
1415
1415
|
let t = e.Icon;
|
|
1416
|
-
return /* @__PURE__ */
|
|
1416
|
+
return /* @__PURE__ */ J(E, {
|
|
1417
1417
|
xs: 12,
|
|
1418
1418
|
sm: 8,
|
|
1419
1419
|
md: 6,
|
|
1420
1420
|
lg: 4,
|
|
1421
1421
|
style: { maxWidth: 200 },
|
|
1422
|
-
children: /* @__PURE__ */
|
|
1422
|
+
children: /* @__PURE__ */ J(T, {
|
|
1423
1423
|
hoverable: !0,
|
|
1424
1424
|
onClick: () => m(e),
|
|
1425
1425
|
styles: { body: {
|
|
1426
1426
|
textAlign: "center",
|
|
1427
1427
|
padding: u.paddingLG
|
|
1428
1428
|
} },
|
|
1429
|
-
children: /* @__PURE__ */
|
|
1429
|
+
children: /* @__PURE__ */ Y(V, {
|
|
1430
1430
|
orientation: "vertical",
|
|
1431
1431
|
size: "middle",
|
|
1432
|
-
children: [t ? /* @__PURE__ */
|
|
1432
|
+
children: [t ? /* @__PURE__ */ J("span", {
|
|
1433
1433
|
style: {
|
|
1434
1434
|
fontSize: 40,
|
|
1435
1435
|
lineHeight: 1
|
|
1436
1436
|
},
|
|
1437
|
-
children: /* @__PURE__ */
|
|
1438
|
-
}) : null, /* @__PURE__ */
|
|
1437
|
+
children: /* @__PURE__ */ J(t, {})
|
|
1438
|
+
}) : null, /* @__PURE__ */ J(G.Text, {
|
|
1439
1439
|
strong: !0,
|
|
1440
1440
|
children: e.label
|
|
1441
1441
|
})]
|
|
@@ -1450,9 +1450,9 @@ function Bn({ apps: e, menuItems: t, onAppClick: n, onMenuClick: r, menuSearchPl
|
|
|
1450
1450
|
//#region src/components/AppLauncherButton.tsx
|
|
1451
1451
|
function Vn({ hubPath: e = "/", label: t = "Apps", onClick: n }) {
|
|
1452
1452
|
let r = v();
|
|
1453
|
-
return /* @__PURE__ */
|
|
1453
|
+
return /* @__PURE__ */ J(w, {
|
|
1454
1454
|
type: "text",
|
|
1455
|
-
icon: /* @__PURE__ */
|
|
1455
|
+
icon: /* @__PURE__ */ J(le, {}),
|
|
1456
1456
|
onClick: () => {
|
|
1457
1457
|
if (n) {
|
|
1458
1458
|
n();
|
|
@@ -1522,7 +1522,7 @@ function Kn({ children: e, toggleSort: t, sort: n }) {
|
|
|
1522
1522
|
c,
|
|
1523
1523
|
u
|
|
1524
1524
|
]);
|
|
1525
|
-
return /* @__PURE__ */
|
|
1525
|
+
return /* @__PURE__ */ J(Gn.Provider, {
|
|
1526
1526
|
value: f,
|
|
1527
1527
|
children: e
|
|
1528
1528
|
});
|
|
@@ -1569,7 +1569,7 @@ function Qn({ value: e, onChange: t, placeholder: n, debounceMs: r }) {
|
|
|
1569
1569
|
r,
|
|
1570
1570
|
t,
|
|
1571
1571
|
e
|
|
1572
|
-
]), /* @__PURE__ */
|
|
1572
|
+
]), /* @__PURE__ */ J(F, {
|
|
1573
1573
|
allowClear: !0,
|
|
1574
1574
|
placeholder: n,
|
|
1575
1575
|
value: i,
|
|
@@ -1586,7 +1586,7 @@ function $n({ source: e, label: t, placeholder: n, debounceMs: r }) {
|
|
|
1586
1586
|
key: e,
|
|
1587
1587
|
source: e,
|
|
1588
1588
|
label: t,
|
|
1589
|
-
render: ({ value: r, onChange: i }) => /* @__PURE__ */
|
|
1589
|
+
render: ({ value: r, onChange: i }) => /* @__PURE__ */ J(Qn, {
|
|
1590
1590
|
value: r,
|
|
1591
1591
|
onChange: i,
|
|
1592
1592
|
placeholder: n ?? t ?? e,
|
|
@@ -1624,7 +1624,7 @@ function tr({ children: e, values: t, setFilterValue: n, textFilterDebounceMs: r
|
|
|
1624
1624
|
s,
|
|
1625
1625
|
r
|
|
1626
1626
|
]);
|
|
1627
|
-
return /* @__PURE__ */
|
|
1627
|
+
return /* @__PURE__ */ J(er.Provider, {
|
|
1628
1628
|
value: c,
|
|
1629
1629
|
children: e
|
|
1630
1630
|
});
|
|
@@ -1642,7 +1642,7 @@ function rr(e) {
|
|
|
1642
1642
|
//#region src/crud/context/FormContext.tsx
|
|
1643
1643
|
var ir = t(null);
|
|
1644
1644
|
function ar({ children: e, resource: t, isNew: n, disabled: r }) {
|
|
1645
|
-
return /* @__PURE__ */
|
|
1645
|
+
return /* @__PURE__ */ J(ir.Provider, {
|
|
1646
1646
|
value: {
|
|
1647
1647
|
resource: t,
|
|
1648
1648
|
isNew: n,
|
|
@@ -1658,7 +1658,7 @@ function or() {
|
|
|
1658
1658
|
//#region src/crud/context/FormSectionContext.tsx
|
|
1659
1659
|
var sr = t(null);
|
|
1660
1660
|
function cr({ sourcesRef: e, children: t }) {
|
|
1661
|
-
return /* @__PURE__ */
|
|
1661
|
+
return /* @__PURE__ */ J(sr.Provider, {
|
|
1662
1662
|
value: e,
|
|
1663
1663
|
children: t
|
|
1664
1664
|
});
|
|
@@ -1670,7 +1670,7 @@ function lr() {
|
|
|
1670
1670
|
//#region src/crud/context/PayloadFieldsContext.tsx
|
|
1671
1671
|
var ur = t(null);
|
|
1672
1672
|
function dr({ children: e, fieldsRef: t }) {
|
|
1673
|
-
return /* @__PURE__ */
|
|
1673
|
+
return /* @__PURE__ */ J(ur.Provider, {
|
|
1674
1674
|
value: t,
|
|
1675
1675
|
children: e
|
|
1676
1676
|
});
|
|
@@ -1706,7 +1706,7 @@ function mr(e, t = !0) {
|
|
|
1706
1706
|
//#region src/crud/context/InlineFieldsRegistry.tsx
|
|
1707
1707
|
var hr = t(null);
|
|
1708
1708
|
function gr({ children: e, registryRef: t }) {
|
|
1709
|
-
return /* @__PURE__ */
|
|
1709
|
+
return /* @__PURE__ */ J(hr.Provider, {
|
|
1710
1710
|
value: t,
|
|
1711
1711
|
children: e
|
|
1712
1712
|
});
|
|
@@ -1737,22 +1737,22 @@ function vr(e, t, n, r, i = !0) {
|
|
|
1737
1737
|
//#endregion
|
|
1738
1738
|
//#region src/crud/FormGlobalErrorsAlert.tsx
|
|
1739
1739
|
function yr({ errors: e }) {
|
|
1740
|
-
return e.length ? e.length === 1 ? /* @__PURE__ */
|
|
1740
|
+
return e.length ? e.length === 1 ? /* @__PURE__ */ J(x, {
|
|
1741
1741
|
type: "error",
|
|
1742
1742
|
title: e[0],
|
|
1743
1743
|
showIcon: !0,
|
|
1744
1744
|
style: { marginBottom: 16 }
|
|
1745
|
-
}) : /* @__PURE__ */
|
|
1745
|
+
}) : /* @__PURE__ */ J(x, {
|
|
1746
1746
|
type: "error",
|
|
1747
1747
|
title: "Could not save",
|
|
1748
1748
|
showIcon: !0,
|
|
1749
1749
|
style: { marginBottom: 16 },
|
|
1750
|
-
description: /* @__PURE__ */
|
|
1750
|
+
description: /* @__PURE__ */ J("ul", {
|
|
1751
1751
|
style: {
|
|
1752
1752
|
margin: 0,
|
|
1753
1753
|
paddingLeft: 20
|
|
1754
1754
|
},
|
|
1755
|
-
children: e.map((e) => /* @__PURE__ */
|
|
1755
|
+
children: e.map((e) => /* @__PURE__ */ J("li", { children: e }, e))
|
|
1756
1756
|
})
|
|
1757
1757
|
}) : null;
|
|
1758
1758
|
}
|
|
@@ -2031,7 +2031,7 @@ function Vr({ dp: e, resource: t, id: n, isNew: r, form: i, message: o, payloadF
|
|
|
2031
2031
|
//#endregion
|
|
2032
2032
|
//#region src/crud/ResourceRecordForm.tsx
|
|
2033
2033
|
function Hr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0, canSave: o = !0, onCancel: s, cancelHref: c, onSuccess: l, loadingMode: p = "overlay" }) {
|
|
2034
|
-
let m = t === "new" || !t, h = m ? void 0 : t, g = Yt(), { message: _ } = S.useApp(), v = u(/* @__PURE__ */ new Set()), y = u(/* @__PURE__ */ new Map()), [b, x] = d([]), C =
|
|
2034
|
+
let m = t === "new" || !t, h = m ? void 0 : t, g = Yt(), { message: _ } = S.useApp(), v = u(/* @__PURE__ */ new Set()), y = u(/* @__PURE__ */ new Map()), [b, x] = d([]), C = Ae({ defaultValues: i }), { loading: T, formVersion: E } = Br({
|
|
2035
2035
|
dp: g,
|
|
2036
2036
|
resource: e,
|
|
2037
2037
|
id: h,
|
|
@@ -2055,20 +2055,20 @@ function Hr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2055
2055
|
C.handleSubmit(D, () => {
|
|
2056
2056
|
_.warning("Please fix the errors below.");
|
|
2057
2057
|
})();
|
|
2058
|
-
}, j = /* @__PURE__ */
|
|
2058
|
+
}, j = /* @__PURE__ */ J(w, {
|
|
2059
2059
|
disabled: k,
|
|
2060
2060
|
onClick: c ? void 0 : s,
|
|
2061
2061
|
children: "Cancel"
|
|
2062
|
-
}),
|
|
2062
|
+
}), N = /* @__PURE__ */ J(ar, {
|
|
2063
2063
|
resource: e,
|
|
2064
2064
|
isNew: m,
|
|
2065
|
-
children: /* @__PURE__ */
|
|
2065
|
+
children: /* @__PURE__ */ J(dr, {
|
|
2066
2066
|
fieldsRef: v,
|
|
2067
|
-
children: /* @__PURE__ */
|
|
2067
|
+
children: /* @__PURE__ */ J(gr, {
|
|
2068
2068
|
registryRef: y,
|
|
2069
|
-
children: /* @__PURE__ */
|
|
2069
|
+
children: /* @__PURE__ */ Y("div", {
|
|
2070
2070
|
style: { position: "relative" },
|
|
2071
|
-
children: [k && p === "overlay" ? /* @__PURE__ */
|
|
2071
|
+
children: [k && p === "overlay" ? /* @__PURE__ */ J("div", {
|
|
2072
2072
|
style: {
|
|
2073
2073
|
position: "absolute",
|
|
2074
2074
|
inset: 0,
|
|
@@ -2077,11 +2077,11 @@ function Hr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2077
2077
|
justifyContent: "center",
|
|
2078
2078
|
zIndex: 1
|
|
2079
2079
|
},
|
|
2080
|
-
children: /* @__PURE__ */
|
|
2081
|
-
}) : null, /* @__PURE__ */ n(
|
|
2080
|
+
children: /* @__PURE__ */ J(ae, {})
|
|
2081
|
+
}) : null, /* @__PURE__ */ n(Oe, {
|
|
2082
2082
|
...C,
|
|
2083
2083
|
key: E
|
|
2084
|
-
}, /* @__PURE__ */
|
|
2084
|
+
}, /* @__PURE__ */ Y(M, {
|
|
2085
2085
|
layout: "vertical",
|
|
2086
2086
|
onFinish: A,
|
|
2087
2087
|
style: p === "overlay" ? {
|
|
@@ -2089,20 +2089,20 @@ function Hr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2089
2089
|
pointerEvents: k ? "none" : void 0
|
|
2090
2090
|
} : void 0,
|
|
2091
2091
|
children: [
|
|
2092
|
-
/* @__PURE__ */
|
|
2092
|
+
/* @__PURE__ */ J(yr, { errors: b }),
|
|
2093
2093
|
r,
|
|
2094
|
-
/* @__PURE__ */
|
|
2094
|
+
/* @__PURE__ */ J(M.Item, {
|
|
2095
2095
|
style: {
|
|
2096
2096
|
marginTop: 16,
|
|
2097
2097
|
marginBottom: 0
|
|
2098
2098
|
},
|
|
2099
|
-
children: /* @__PURE__ */
|
|
2099
|
+
children: /* @__PURE__ */ Y(V, { children: [/* @__PURE__ */ J(w, {
|
|
2100
2100
|
type: "primary",
|
|
2101
2101
|
htmlType: "submit",
|
|
2102
2102
|
loading: O,
|
|
2103
2103
|
disabled: k || !o,
|
|
2104
2104
|
children: "Save"
|
|
2105
|
-
}), c ? /* @__PURE__ */
|
|
2105
|
+
}), c ? /* @__PURE__ */ J(f, {
|
|
2106
2106
|
to: c,
|
|
2107
2107
|
children: j
|
|
2108
2108
|
}) : j] })
|
|
@@ -2113,13 +2113,13 @@ function Hr({ resource: e, id: t, children: r, defaultValues: i, enabled: a = !0
|
|
|
2113
2113
|
})
|
|
2114
2114
|
})
|
|
2115
2115
|
});
|
|
2116
|
-
return T && !O && p === "replace" ? /* @__PURE__ */
|
|
2116
|
+
return T && !O && p === "replace" ? /* @__PURE__ */ J(ae, {}) : N;
|
|
2117
2117
|
}
|
|
2118
2118
|
//#endregion
|
|
2119
2119
|
//#region src/crud/ResourceFormModal.tsx
|
|
2120
2120
|
function Ur({ resource: e, editId: t, onClose: n, children: r, title: i, permissions: a, defaultValues: o, width: s = 560, onSuccess: c }) {
|
|
2121
|
-
let l = t === "new", u = t != null, d =
|
|
2122
|
-
return /* @__PURE__ */
|
|
2121
|
+
let l = t === "new", u = t != null, d = mt(), f = i ?? (l ? `New ${e}` : `Edit ${e}`), p = a ? Z(d, a, l ? "add" : "change") : !0;
|
|
2122
|
+
return /* @__PURE__ */ J(te, {
|
|
2123
2123
|
open: u,
|
|
2124
2124
|
title: f,
|
|
2125
2125
|
onCancel: n,
|
|
@@ -2127,7 +2127,7 @@ function Ur({ resource: e, editId: t, onClose: n, children: r, title: i, permiss
|
|
|
2127
2127
|
destroyOnHidden: !0,
|
|
2128
2128
|
width: s,
|
|
2129
2129
|
maskClosable: !1,
|
|
2130
|
-
children: /* @__PURE__ */
|
|
2130
|
+
children: /* @__PURE__ */ J(S, { children: /* @__PURE__ */ J(Hr, {
|
|
2131
2131
|
resource: e,
|
|
2132
2132
|
id: t ?? void 0,
|
|
2133
2133
|
enabled: u,
|
|
@@ -2158,7 +2158,7 @@ function Wr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2158
2158
|
e,
|
|
2159
2159
|
u
|
|
2160
2160
|
]), _ = n && !r && t > e;
|
|
2161
|
-
return /* @__PURE__ */
|
|
2161
|
+
return /* @__PURE__ */ Y(V, {
|
|
2162
2162
|
wrap: !0,
|
|
2163
2163
|
style: {
|
|
2164
2164
|
marginBottom: 16,
|
|
@@ -2166,7 +2166,7 @@ function Wr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2166
2166
|
},
|
|
2167
2167
|
align: "center",
|
|
2168
2168
|
children: [
|
|
2169
|
-
/* @__PURE__ */
|
|
2169
|
+
/* @__PURE__ */ Y(G.Text, {
|
|
2170
2170
|
type: "secondary",
|
|
2171
2171
|
children: [
|
|
2172
2172
|
e,
|
|
@@ -2175,17 +2175,17 @@ function Wr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2175
2175
|
" selected"
|
|
2176
2176
|
]
|
|
2177
2177
|
}),
|
|
2178
|
-
e > 0 ? /* @__PURE__ */
|
|
2178
|
+
e > 0 ? /* @__PURE__ */ J(w, {
|
|
2179
2179
|
type: "link",
|
|
2180
2180
|
size: "small",
|
|
2181
2181
|
onClick: o,
|
|
2182
2182
|
style: { padding: 0 },
|
|
2183
2183
|
children: "Clear selection"
|
|
2184
2184
|
}) : null,
|
|
2185
|
-
_ ? /* @__PURE__ */
|
|
2185
|
+
_ ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(G.Text, {
|
|
2186
2186
|
type: "secondary",
|
|
2187
2187
|
children: "·"
|
|
2188
|
-
}), /* @__PURE__ */
|
|
2188
|
+
}), /* @__PURE__ */ Y(w, {
|
|
2189
2189
|
type: "link",
|
|
2190
2190
|
size: "small",
|
|
2191
2191
|
onClick: i,
|
|
@@ -2196,10 +2196,10 @@ function Wr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2196
2196
|
" items matching filter"
|
|
2197
2197
|
]
|
|
2198
2198
|
})] }) : null,
|
|
2199
|
-
r && t > 0 ? /* @__PURE__ */
|
|
2199
|
+
r && t > 0 ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(G.Text, {
|
|
2200
2200
|
type: "secondary",
|
|
2201
2201
|
children: "·"
|
|
2202
|
-
}), /* @__PURE__ */
|
|
2202
|
+
}), /* @__PURE__ */ Y(G.Text, {
|
|
2203
2203
|
type: "success",
|
|
2204
2204
|
children: [
|
|
2205
2205
|
"All ",
|
|
@@ -2207,7 +2207,7 @@ function Wr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2207
2207
|
" items selected"
|
|
2208
2208
|
]
|
|
2209
2209
|
})] }) : null,
|
|
2210
|
-
/* @__PURE__ */
|
|
2210
|
+
/* @__PURE__ */ J(B, {
|
|
2211
2211
|
placeholder: "Action",
|
|
2212
2212
|
style: { minWidth: 200 },
|
|
2213
2213
|
options: h,
|
|
@@ -2216,7 +2216,7 @@ function Wr({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
|
|
|
2216
2216
|
disabled: e === 0 || f,
|
|
2217
2217
|
allowClear: !0
|
|
2218
2218
|
}),
|
|
2219
|
-
/* @__PURE__ */
|
|
2219
|
+
/* @__PURE__ */ J(w, {
|
|
2220
2220
|
type: "primary",
|
|
2221
2221
|
onClick: () => void g(),
|
|
2222
2222
|
disabled: !p || e === 0 || f,
|
|
@@ -2349,11 +2349,11 @@ function ei(e, t) {
|
|
|
2349
2349
|
...n,
|
|
2350
2350
|
render: (e, n, r) => {
|
|
2351
2351
|
let a = i ? i(e, n, r) : $r(e);
|
|
2352
|
-
return t.showEdit ? /* @__PURE__ */
|
|
2352
|
+
return t.showEdit ? /* @__PURE__ */ J(f, {
|
|
2353
2353
|
to: `${t.pathPrefix}/${String(n.id)}`,
|
|
2354
2354
|
className: "ding-admin-row-edit-link",
|
|
2355
2355
|
children: a
|
|
2356
|
-
}) : /* @__PURE__ */
|
|
2356
|
+
}) : /* @__PURE__ */ J(w, {
|
|
2357
2357
|
type: "link",
|
|
2358
2358
|
size: "small",
|
|
2359
2359
|
className: "ding-admin-row-edit-link",
|
|
@@ -2369,12 +2369,12 @@ function ei(e, t) {
|
|
|
2369
2369
|
}, ...r];
|
|
2370
2370
|
}
|
|
2371
2371
|
function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "page", formChildren: o, actions: s, rowActions: p, headerExtra: m, bulkActions: h, bulkDelete: g = !0, bulkActionsEnabled: _ = !0, permissions: v, queryState: y, queryActions: b }) {
|
|
2372
|
-
let x = Yt(), C =
|
|
2373
|
-
|
|
2374
|
-
}, []),
|
|
2372
|
+
let x = Yt(), C = mt(), { message: E, modal: D } = S.useApp(), { token: O } = K.useToken(), { columns: k, sortOrders: A, sortPriorities: j } = qn(), M = u(null), [N, P] = d(), [F, I] = d(!1), [L, ee] = d([]), [R, te] = d(0), [re, z] = d(() => /* @__PURE__ */ new Set()), [ie, B] = d(!1), ae = r ?? `${n}/new`, H = Z(C, v, "add"), oe = Z(C, v, "change"), U = Z(C, v, "delete"), ce = oe && (i === "page" || i === "both") && s?.edit !== !1, W = oe && (i === "modal" || i === "both") && s?.quickEdit !== !1, le = U && s?.delete !== !1, ue = ce || W || le || p, pe = a(() => {
|
|
2373
|
+
z(/* @__PURE__ */ new Set());
|
|
2374
|
+
}, []), me = l(() => {
|
|
2375
2375
|
if (!_) return [];
|
|
2376
2376
|
let t = [];
|
|
2377
|
-
return g &&
|
|
2377
|
+
return g && U && t.push({
|
|
2378
2378
|
key: "__delete",
|
|
2379
2379
|
label: "Delete selected",
|
|
2380
2380
|
confirm: (e) => `Delete ${e.length} selected item(s)? This cannot be undone.`,
|
|
@@ -2385,12 +2385,12 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2385
2385
|
}, [
|
|
2386
2386
|
_,
|
|
2387
2387
|
g,
|
|
2388
|
-
|
|
2388
|
+
U,
|
|
2389
2389
|
h,
|
|
2390
2390
|
x,
|
|
2391
2391
|
e,
|
|
2392
2392
|
E
|
|
2393
|
-
]),
|
|
2393
|
+
]), he = me.length > 0, ge = re.size;
|
|
2394
2394
|
c(() => {
|
|
2395
2395
|
let e = M.current;
|
|
2396
2396
|
if (!e) return;
|
|
@@ -2399,7 +2399,7 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2399
2399
|
let n = () => {
|
|
2400
2400
|
if (e.clientHeight <= 0) return;
|
|
2401
2401
|
let t = e.querySelector(".ding-admin-resource-list-pagination"), n = e.querySelector(".ant-table-header"), r = t?.offsetHeight ?? 0, i = t ? parseFloat(getComputedStyle(t).marginTop) + parseFloat(getComputedStyle(t).marginBottom) : 0, a = n?.offsetHeight ?? 0, o = e.querySelector(".ant-table-body"), s = o && o.scrollWidth > o.clientWidth ? o.offsetHeight - o.clientHeight : 0, c = Math.max(120, Math.floor(e.clientHeight - a - r - i - s - 8));
|
|
2402
|
-
|
|
2402
|
+
P((e) => e === c ? e : c);
|
|
2403
2403
|
};
|
|
2404
2404
|
n();
|
|
2405
2405
|
let r = new ResizeObserver(() => n());
|
|
@@ -2407,45 +2407,45 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2407
2407
|
t?.classList.remove("ding-admin-resource-list-scroll"), r.disconnect(), window.removeEventListener("resize", n);
|
|
2408
2408
|
};
|
|
2409
2409
|
}, [
|
|
2410
|
+
he,
|
|
2410
2411
|
ge,
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
P
|
|
2412
|
+
R,
|
|
2413
|
+
F
|
|
2414
2414
|
]);
|
|
2415
|
-
let
|
|
2416
|
-
|
|
2417
|
-
let n = new Set(t), r =
|
|
2415
|
+
let _e = L.length > 0 && L.every((e) => re.has(e.id)), ve = R > 0 && ge >= R, ye = l(() => L.filter((e) => re.has(e.id)).map((e) => e.id), [L, re]), be = a((e) => {
|
|
2416
|
+
z((t) => {
|
|
2417
|
+
let n = new Set(t), r = L.map((e) => e.id);
|
|
2418
2418
|
for (let t of r) e.includes(t) || n.delete(t);
|
|
2419
2419
|
for (let t of e) n.add(t);
|
|
2420
2420
|
return n;
|
|
2421
2421
|
});
|
|
2422
|
-
}, [
|
|
2423
|
-
if (!(
|
|
2424
|
-
|
|
2422
|
+
}, [L]), xe = a(async () => {
|
|
2423
|
+
if (!(R <= 0)) {
|
|
2424
|
+
B(!0);
|
|
2425
2425
|
try {
|
|
2426
2426
|
let t = y.sort.length === 0 ? void 0 : y.sort.length === 1 ? y.sort[0] : y.sort, n = await x.getList(e, {
|
|
2427
2427
|
pagination: {
|
|
2428
2428
|
page: 1,
|
|
2429
|
-
perPage:
|
|
2429
|
+
perPage: R
|
|
2430
2430
|
},
|
|
2431
2431
|
sort: t,
|
|
2432
2432
|
filter: y.filter
|
|
2433
2433
|
});
|
|
2434
|
-
|
|
2434
|
+
z(new Set(n.data.map((e) => e.id)));
|
|
2435
2435
|
} catch (e) {
|
|
2436
2436
|
E.error(e instanceof Error ? e.message : "Load failed");
|
|
2437
2437
|
} finally {
|
|
2438
|
-
|
|
2438
|
+
B(!1);
|
|
2439
2439
|
}
|
|
2440
2440
|
}
|
|
2441
2441
|
}, [
|
|
2442
2442
|
x,
|
|
2443
2443
|
e,
|
|
2444
|
-
|
|
2444
|
+
R,
|
|
2445
2445
|
y.sort,
|
|
2446
2446
|
y.filter,
|
|
2447
2447
|
E
|
|
2448
|
-
]),
|
|
2448
|
+
]), Se = a((e) => {
|
|
2449
2449
|
let t = (e) => {
|
|
2450
2450
|
let t = e?.columnKey ?? e?.field;
|
|
2451
2451
|
return t == null ? null : String(Array.isArray(t) ? t[0] : t);
|
|
@@ -2466,7 +2466,7 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2466
2466
|
return;
|
|
2467
2467
|
}
|
|
2468
2468
|
!e?.order && y.sort.length > 0 && b.setSort([]);
|
|
2469
|
-
}, [b, y.sort.length]),
|
|
2469
|
+
}, [b, y.sort.length]), Ce = l(() => {
|
|
2470
2470
|
let e = y.sort.length === 0 ? void 0 : y.sort.length === 1 ? y.sort[0] : y.sort;
|
|
2471
2471
|
return {
|
|
2472
2472
|
pagination: {
|
|
@@ -2476,33 +2476,33 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2476
2476
|
sort: e,
|
|
2477
2477
|
filter: y.filter
|
|
2478
2478
|
};
|
|
2479
|
-
}, [y]),
|
|
2480
|
-
|
|
2479
|
+
}, [y]), X = a(async (t) => {
|
|
2480
|
+
I(!0);
|
|
2481
2481
|
try {
|
|
2482
2482
|
let n = await x.getList(e, {
|
|
2483
|
-
...
|
|
2483
|
+
...Ce,
|
|
2484
2484
|
signal: t
|
|
2485
2485
|
});
|
|
2486
2486
|
if (t?.aborted) return;
|
|
2487
|
-
|
|
2487
|
+
ee(n.data), te(n.total);
|
|
2488
2488
|
} catch (e) {
|
|
2489
2489
|
$t(e) || E.error(e instanceof Error ? e.message : "Load failed");
|
|
2490
2490
|
} finally {
|
|
2491
|
-
t?.aborted ||
|
|
2491
|
+
t?.aborted || I(!1);
|
|
2492
2492
|
}
|
|
2493
2493
|
}, [
|
|
2494
2494
|
x,
|
|
2495
2495
|
e,
|
|
2496
|
-
|
|
2496
|
+
Ce,
|
|
2497
2497
|
E
|
|
2498
2498
|
]);
|
|
2499
|
-
zr((e) =>
|
|
2500
|
-
let
|
|
2501
|
-
reload: () => void
|
|
2502
|
-
clearSelection:
|
|
2503
|
-
}), [
|
|
2499
|
+
zr((e) => X(e), [X]);
|
|
2500
|
+
let we = l(() => ({
|
|
2501
|
+
reload: () => void X(),
|
|
2502
|
+
clearSelection: pe
|
|
2503
|
+
}), [X, pe]), Te = a(async (e, t) => {
|
|
2504
2504
|
if (e.confirm) {
|
|
2505
|
-
let n = typeof e.confirm == "function" ? await e.confirm(t,
|
|
2505
|
+
let n = typeof e.confirm == "function" ? await e.confirm(t, we) : e.confirm;
|
|
2506
2506
|
if (n === !1 || !await new Promise((t) => {
|
|
2507
2507
|
D.confirm({
|
|
2508
2508
|
title: n,
|
|
@@ -2512,35 +2512,35 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2512
2512
|
});
|
|
2513
2513
|
})) return;
|
|
2514
2514
|
}
|
|
2515
|
-
|
|
2515
|
+
B(!0);
|
|
2516
2516
|
try {
|
|
2517
|
-
await e.execute(t,
|
|
2517
|
+
await e.execute(t, we);
|
|
2518
2518
|
} catch (e) {
|
|
2519
2519
|
E.error(e instanceof Error ? e.message : "Action failed");
|
|
2520
2520
|
} finally {
|
|
2521
|
-
|
|
2521
|
+
B(!1);
|
|
2522
2522
|
}
|
|
2523
2523
|
}, [
|
|
2524
|
-
|
|
2524
|
+
we,
|
|
2525
2525
|
D,
|
|
2526
2526
|
E
|
|
2527
|
-
]),
|
|
2528
|
-
if (
|
|
2529
|
-
await x.delete(e, t.id), E.success("Deleted"),
|
|
2527
|
+
]), Ee = a(async (t) => {
|
|
2528
|
+
if (U) try {
|
|
2529
|
+
await x.delete(e, t.id), E.success("Deleted"), X();
|
|
2530
2530
|
} catch (e) {
|
|
2531
2531
|
E.error(e instanceof Error ? e.message : "Delete failed");
|
|
2532
2532
|
}
|
|
2533
2533
|
}, [
|
|
2534
|
-
|
|
2534
|
+
U,
|
|
2535
2535
|
x,
|
|
2536
2536
|
e,
|
|
2537
|
-
|
|
2537
|
+
X,
|
|
2538
2538
|
E
|
|
2539
|
-
]),
|
|
2539
|
+
]), De = l(() => {
|
|
2540
2540
|
let e = k.map((e) => {
|
|
2541
2541
|
let t = e.buildColumn();
|
|
2542
2542
|
if (e.sortable) {
|
|
2543
|
-
let n = A.get(e.source), r = j.get(e.source), i = n === "ASC" ? "ascend" : n === "DESC" ? "descend" : void 0, a = i == null ? void 0 : /* @__PURE__ */
|
|
2543
|
+
let n = A.get(e.source), r = j.get(e.source), i = n === "ASC" ? "ascend" : n === "DESC" ? "descend" : void 0, a = i == null ? void 0 : /* @__PURE__ */ Y("span", {
|
|
2544
2544
|
style: {
|
|
2545
2545
|
display: "inline-flex",
|
|
2546
2546
|
alignItems: "center",
|
|
@@ -2548,7 +2548,7 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2548
2548
|
marginInlineStart: 4,
|
|
2549
2549
|
color: "var(--ant-color-primary)"
|
|
2550
2550
|
},
|
|
2551
|
-
children: [r == null ? null : /* @__PURE__ */
|
|
2551
|
+
children: [r == null ? null : /* @__PURE__ */ J("span", {
|
|
2552
2552
|
style: {
|
|
2553
2553
|
fontSize: 11,
|
|
2554
2554
|
fontWeight: 600,
|
|
@@ -2557,7 +2557,7 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2557
2557
|
textAlign: "center"
|
|
2558
2558
|
},
|
|
2559
2559
|
children: r
|
|
2560
|
-
}),
|
|
2560
|
+
}), J(i === "ascend" ? fe : de, { style: { fontSize: 11 } })]
|
|
2561
2561
|
});
|
|
2562
2562
|
return {
|
|
2563
2563
|
...t,
|
|
@@ -2568,39 +2568,39 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2568
2568
|
}
|
|
2569
2569
|
return t;
|
|
2570
2570
|
});
|
|
2571
|
-
if (!
|
|
2572
|
-
showEdit:
|
|
2573
|
-
showQuickEdit:
|
|
2571
|
+
if (!ue) return ei(e, {
|
|
2572
|
+
showEdit: ce,
|
|
2573
|
+
showQuickEdit: W,
|
|
2574
2574
|
pathPrefix: n,
|
|
2575
2575
|
openEditModal: b.openEditModal
|
|
2576
2576
|
});
|
|
2577
2577
|
let t = {
|
|
2578
|
-
reload: () => void
|
|
2578
|
+
reload: () => void X(),
|
|
2579
2579
|
openEditModal: b.openEditModal
|
|
2580
2580
|
}, r = {
|
|
2581
2581
|
title: "Actions",
|
|
2582
2582
|
key: "__actions",
|
|
2583
2583
|
width: i === "both" ? 200 : 160,
|
|
2584
|
-
render: (e, r) => /* @__PURE__ */
|
|
2584
|
+
render: (e, r) => /* @__PURE__ */ Y(V, {
|
|
2585
2585
|
size: "small",
|
|
2586
2586
|
wrap: !0,
|
|
2587
2587
|
children: [
|
|
2588
|
-
|
|
2588
|
+
ce ? /* @__PURE__ */ J(f, {
|
|
2589
2589
|
to: `${n}/${String(r.id)}`,
|
|
2590
2590
|
children: "Edit"
|
|
2591
2591
|
}) : null,
|
|
2592
|
-
|
|
2592
|
+
W ? /* @__PURE__ */ J(w, {
|
|
2593
2593
|
type: "link",
|
|
2594
2594
|
size: "small",
|
|
2595
2595
|
style: { padding: 0 },
|
|
2596
2596
|
onClick: () => b.openEditModal(r.id),
|
|
2597
2597
|
children: i === "both" ? "Quick edit" : "Edit"
|
|
2598
2598
|
}) : null,
|
|
2599
|
-
|
|
2599
|
+
le ? /* @__PURE__ */ J(w, {
|
|
2600
2600
|
type: "link",
|
|
2601
2601
|
danger: !0,
|
|
2602
2602
|
size: "small",
|
|
2603
|
-
onClick: () => void
|
|
2603
|
+
onClick: () => void Ee(r),
|
|
2604
2604
|
style: { padding: 0 },
|
|
2605
2605
|
children: "Delete"
|
|
2606
2606
|
}) : null,
|
|
@@ -2609,26 +2609,26 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2609
2609
|
})
|
|
2610
2610
|
};
|
|
2611
2611
|
return ei([...e, r], {
|
|
2612
|
-
showEdit:
|
|
2613
|
-
showQuickEdit:
|
|
2612
|
+
showEdit: ce,
|
|
2613
|
+
showQuickEdit: W,
|
|
2614
2614
|
pathPrefix: n,
|
|
2615
2615
|
openEditModal: b.openEditModal
|
|
2616
2616
|
});
|
|
2617
2617
|
}, [
|
|
2618
2618
|
k,
|
|
2619
|
-
de,
|
|
2620
|
-
le,
|
|
2621
|
-
U,
|
|
2622
2619
|
ue,
|
|
2620
|
+
ce,
|
|
2621
|
+
W,
|
|
2622
|
+
le,
|
|
2623
2623
|
i,
|
|
2624
2624
|
n,
|
|
2625
|
-
|
|
2625
|
+
Ee,
|
|
2626
2626
|
A,
|
|
2627
2627
|
j,
|
|
2628
2628
|
b,
|
|
2629
2629
|
p,
|
|
2630
|
-
|
|
2631
|
-
]),
|
|
2630
|
+
X
|
|
2631
|
+
]), Oe = a((e, t) => {
|
|
2632
2632
|
if (t !== y.perPage) {
|
|
2633
2633
|
b.setPerPage(t);
|
|
2634
2634
|
return;
|
|
@@ -2638,79 +2638,79 @@ function ti({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: i = "p
|
|
|
2638
2638
|
b,
|
|
2639
2639
|
y.page,
|
|
2640
2640
|
y.perPage
|
|
2641
|
-
]),
|
|
2642
|
-
return /* @__PURE__ */
|
|
2643
|
-
title: /* @__PURE__ */
|
|
2641
|
+
]), ke = o && (y.createModal || y.editId != null) && (i === "modal" || i === "both");
|
|
2642
|
+
return /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y(T, {
|
|
2643
|
+
title: /* @__PURE__ */ J(G.Title, {
|
|
2644
2644
|
level: 5,
|
|
2645
2645
|
style: { margin: 0 },
|
|
2646
2646
|
children: t
|
|
2647
2647
|
}),
|
|
2648
|
-
extra: m ||
|
|
2649
|
-
to:
|
|
2650
|
-
children: /* @__PURE__ */
|
|
2651
|
-
}) : null, /* @__PURE__ */
|
|
2648
|
+
extra: m || H ? /* @__PURE__ */ Y(V, { children: [m, H ? i === "modal" || i === "both" ? /* @__PURE__ */ Y(q, { children: [i === "both" ? /* @__PURE__ */ J(f, {
|
|
2649
|
+
to: ae,
|
|
2650
|
+
children: /* @__PURE__ */ J(w, { children: "New page" })
|
|
2651
|
+
}) : null, /* @__PURE__ */ J(w, {
|
|
2652
2652
|
type: "primary",
|
|
2653
2653
|
onClick: () => b.openCreateModal(),
|
|
2654
2654
|
children: "New"
|
|
2655
|
-
})] }) : /* @__PURE__ */
|
|
2656
|
-
to:
|
|
2657
|
-
children: /* @__PURE__ */
|
|
2655
|
+
})] }) : /* @__PURE__ */ J(f, {
|
|
2656
|
+
to: ae,
|
|
2657
|
+
children: /* @__PURE__ */ J(w, {
|
|
2658
2658
|
type: "primary",
|
|
2659
2659
|
children: "New"
|
|
2660
2660
|
})
|
|
2661
2661
|
}) : null] }) : null,
|
|
2662
|
-
children: [
|
|
2663
|
-
selectedCount:
|
|
2664
|
-
total:
|
|
2665
|
-
allPageSelected:
|
|
2666
|
-
allMatchingSelected:
|
|
2667
|
-
onSelectAllMatching: () => void
|
|
2668
|
-
onClearSelection:
|
|
2669
|
-
actions:
|
|
2670
|
-
onExecute:
|
|
2671
|
-
selectedIds: [...
|
|
2672
|
-
running:
|
|
2673
|
-
}) : null, /* @__PURE__ */
|
|
2662
|
+
children: [he ? /* @__PURE__ */ J(Wr, {
|
|
2663
|
+
selectedCount: ge,
|
|
2664
|
+
total: R,
|
|
2665
|
+
allPageSelected: _e,
|
|
2666
|
+
allMatchingSelected: ve,
|
|
2667
|
+
onSelectAllMatching: () => void xe(),
|
|
2668
|
+
onClearSelection: pe,
|
|
2669
|
+
actions: me,
|
|
2670
|
+
onExecute: Te,
|
|
2671
|
+
selectedIds: [...re],
|
|
2672
|
+
running: ie || F
|
|
2673
|
+
}) : null, /* @__PURE__ */ Y("div", {
|
|
2674
2674
|
ref: M,
|
|
2675
2675
|
className: "ding-admin-resource-list-table",
|
|
2676
2676
|
style: {
|
|
2677
2677
|
"--ding-scroll-thumb": O.colorTextQuaternary,
|
|
2678
2678
|
"--ding-scroll-thumb-hover": O.colorTextTertiary
|
|
2679
2679
|
},
|
|
2680
|
-
children: [/* @__PURE__ */
|
|
2680
|
+
children: [/* @__PURE__ */ J(se, {
|
|
2681
2681
|
rowKey: "id",
|
|
2682
|
-
loading:
|
|
2683
|
-
columns:
|
|
2684
|
-
dataSource:
|
|
2682
|
+
loading: F,
|
|
2683
|
+
columns: De,
|
|
2684
|
+
dataSource: L,
|
|
2685
2685
|
scroll: {
|
|
2686
2686
|
x: "max-content",
|
|
2687
|
-
...
|
|
2687
|
+
...N ? { y: N } : {}
|
|
2688
2688
|
},
|
|
2689
|
-
rowSelection:
|
|
2690
|
-
selectedRowKeys:
|
|
2691
|
-
onChange:
|
|
2689
|
+
rowSelection: he ? {
|
|
2690
|
+
selectedRowKeys: ye,
|
|
2691
|
+
onChange: be,
|
|
2692
2692
|
preserveSelectedRowKeys: !0
|
|
2693
2693
|
} : void 0,
|
|
2694
2694
|
pagination: !1,
|
|
2695
2695
|
onChange: (e, t, n) => {
|
|
2696
|
-
|
|
2696
|
+
Se(n);
|
|
2697
2697
|
}
|
|
2698
|
-
}), /* @__PURE__ */
|
|
2698
|
+
}), /* @__PURE__ */ J("div", {
|
|
2699
2699
|
className: "ding-admin-resource-list-pagination",
|
|
2700
|
-
children: /* @__PURE__ */
|
|
2700
|
+
children: /* @__PURE__ */ J(ne, {
|
|
2701
2701
|
current: y.page,
|
|
2702
2702
|
pageSize: y.perPage,
|
|
2703
|
-
total:
|
|
2703
|
+
total: R,
|
|
2704
2704
|
showSizeChanger: !0,
|
|
2705
|
-
onChange:
|
|
2705
|
+
onChange: Oe
|
|
2706
2706
|
})
|
|
2707
2707
|
})]
|
|
2708
2708
|
})]
|
|
2709
|
-
}),
|
|
2709
|
+
}), ke ? /* @__PURE__ */ J(Ur, {
|
|
2710
2710
|
resource: e,
|
|
2711
2711
|
editId: y.createModal ? "new" : y.editId,
|
|
2712
2712
|
onClose: () => {
|
|
2713
|
-
b.closeModal(),
|
|
2713
|
+
b.closeModal(), X();
|
|
2714
2714
|
},
|
|
2715
2715
|
children: o
|
|
2716
2716
|
}) : null] });
|
|
@@ -2731,18 +2731,18 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2731
2731
|
filterValues: x,
|
|
2732
2732
|
setFilterValue: S
|
|
2733
2733
|
}), [x, S]);
|
|
2734
|
-
return /* @__PURE__ */
|
|
2734
|
+
return /* @__PURE__ */ J(Zr.Provider, {
|
|
2735
2735
|
value: C,
|
|
2736
|
-
children: /* @__PURE__ */
|
|
2736
|
+
children: /* @__PURE__ */ J(tr, {
|
|
2737
2737
|
values: x,
|
|
2738
2738
|
setFilterValue: S,
|
|
2739
2739
|
textFilterDebounceMs: o,
|
|
2740
|
-
children: /* @__PURE__ */
|
|
2740
|
+
children: /* @__PURE__ */ J(Kn, {
|
|
2741
2741
|
toggleSort: b.toggleSort,
|
|
2742
2742
|
sort: y.sort,
|
|
2743
|
-
children: /* @__PURE__ */
|
|
2743
|
+
children: /* @__PURE__ */ Y("div", {
|
|
2744
2744
|
className: "ding-admin-resource-list-root",
|
|
2745
|
-
children: [u, /* @__PURE__ */
|
|
2745
|
+
children: [u, /* @__PURE__ */ J(ti, {
|
|
2746
2746
|
resource: e,
|
|
2747
2747
|
title: t,
|
|
2748
2748
|
pathPrefix: n,
|
|
@@ -2768,14 +2768,14 @@ function ni({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: i,
|
|
|
2768
2768
|
//#region src/crud/FilterBar.tsx
|
|
2769
2769
|
function ri() {
|
|
2770
2770
|
let e = nr();
|
|
2771
|
-
return !e || e.filters.length === 0 ? null : /* @__PURE__ */
|
|
2771
|
+
return !e || e.filters.length === 0 ? null : /* @__PURE__ */ J(V, {
|
|
2772
2772
|
wrap: !0,
|
|
2773
2773
|
size: "middle",
|
|
2774
2774
|
style: { marginBottom: 16 },
|
|
2775
|
-
children: e.filters.map((t) => /* @__PURE__ */
|
|
2775
|
+
children: e.filters.map((t) => /* @__PURE__ */ Y(V, {
|
|
2776
2776
|
orientation: "vertical",
|
|
2777
2777
|
size: 2,
|
|
2778
|
-
children: [t.label ? /* @__PURE__ */
|
|
2778
|
+
children: [t.label ? /* @__PURE__ */ J(G.Text, {
|
|
2779
2779
|
type: "secondary",
|
|
2780
2780
|
style: { fontSize: 12 },
|
|
2781
2781
|
children: t.label
|
|
@@ -2787,12 +2787,12 @@ function ri() {
|
|
|
2787
2787
|
});
|
|
2788
2788
|
}
|
|
2789
2789
|
function ii({ children: e }) {
|
|
2790
|
-
return /* @__PURE__ */
|
|
2790
|
+
return /* @__PURE__ */ Y(q, { children: [e, /* @__PURE__ */ J(ri, {})] });
|
|
2791
2791
|
}
|
|
2792
2792
|
//#endregion
|
|
2793
2793
|
//#region src/crud/ResourceForm.tsx
|
|
2794
2794
|
function ai({ resource: e, title: t, listPath: n, children: r, defaultValues: i, onSaved: a, stayOnPage: o, permissions: c }) {
|
|
2795
|
-
let { id: l } = y(), u = l === "new" || !l, d =
|
|
2795
|
+
let { id: l } = y(), u = l === "new" || !l, d = mt(), p = v(), { token: m } = K.useToken();
|
|
2796
2796
|
s(() => {
|
|
2797
2797
|
c && (Z(d, c, u ? "add" : "change") || p(n, { replace: !0 }));
|
|
2798
2798
|
}, [
|
|
@@ -2803,17 +2803,17 @@ function ai({ resource: e, title: t, listPath: n, children: r, defaultValues: i,
|
|
|
2803
2803
|
n
|
|
2804
2804
|
]);
|
|
2805
2805
|
let h = c ? Z(d, c, u ? "add" : "change") : !0;
|
|
2806
|
-
return /* @__PURE__ */
|
|
2807
|
-
title: /* @__PURE__ */
|
|
2806
|
+
return /* @__PURE__ */ J(T, {
|
|
2807
|
+
title: /* @__PURE__ */ Y(V, { children: [/* @__PURE__ */ Y(f, {
|
|
2808
2808
|
to: n,
|
|
2809
2809
|
style: { color: m.colorText },
|
|
2810
|
-
children: [/* @__PURE__ */
|
|
2811
|
-
}), /* @__PURE__ */
|
|
2810
|
+
children: [/* @__PURE__ */ J(ue, {}), " Back"]
|
|
2811
|
+
}), /* @__PURE__ */ J(G.Title, {
|
|
2812
2812
|
level: 5,
|
|
2813
2813
|
style: { margin: 0 },
|
|
2814
2814
|
children: t
|
|
2815
2815
|
})] }),
|
|
2816
|
-
children: /* @__PURE__ */
|
|
2816
|
+
children: /* @__PURE__ */ J(Hr, {
|
|
2817
2817
|
resource: e,
|
|
2818
2818
|
id: l,
|
|
2819
2819
|
defaultValues: i,
|
|
@@ -2840,7 +2840,7 @@ function si(e, t) {
|
|
|
2840
2840
|
return n;
|
|
2841
2841
|
}
|
|
2842
2842
|
function ci(e, t, n) {
|
|
2843
|
-
let { control: r } =
|
|
2843
|
+
let { control: r } = je(), { fields: i, append: a, remove: o } = ke({
|
|
2844
2844
|
control: r,
|
|
2845
2845
|
name: e,
|
|
2846
2846
|
keyName: "rowKey"
|
|
@@ -2866,14 +2866,14 @@ function li({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2866
2866
|
field: e
|
|
2867
2867
|
})
|
|
2868
2868
|
})), [i, e]);
|
|
2869
|
-
return /* @__PURE__ */
|
|
2869
|
+
return /* @__PURE__ */ Y("div", {
|
|
2870
2870
|
style: { marginTop: 24 },
|
|
2871
2871
|
children: [
|
|
2872
|
-
/* @__PURE__ */
|
|
2872
|
+
/* @__PURE__ */ J(G.Title, {
|
|
2873
2873
|
level: 5,
|
|
2874
2874
|
children: t ?? "Related items"
|
|
2875
2875
|
}),
|
|
2876
|
-
/* @__PURE__ */
|
|
2876
|
+
/* @__PURE__ */ J(se, {
|
|
2877
2877
|
size: "small",
|
|
2878
2878
|
pagination: !1,
|
|
2879
2879
|
scroll: { x: "max-content" },
|
|
@@ -2885,7 +2885,7 @@ function li({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2885
2885
|
title: "",
|
|
2886
2886
|
key: "__remove",
|
|
2887
2887
|
width: 80,
|
|
2888
|
-
render: (e, t, n) => /* @__PURE__ */
|
|
2888
|
+
render: (e, t, n) => /* @__PURE__ */ J(w, {
|
|
2889
2889
|
type: "link",
|
|
2890
2890
|
danger: !0,
|
|
2891
2891
|
size: "small",
|
|
@@ -2894,7 +2894,7 @@ function li({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2894
2894
|
})
|
|
2895
2895
|
}]
|
|
2896
2896
|
}),
|
|
2897
|
-
/* @__PURE__ */
|
|
2897
|
+
/* @__PURE__ */ J(w, {
|
|
2898
2898
|
type: "dashed",
|
|
2899
2899
|
style: { marginTop: 8 },
|
|
2900
2900
|
onClick: u,
|
|
@@ -2905,14 +2905,14 @@ function li({ field: e, label: t, payloadKey: n, transformRows: r, columns: i, d
|
|
|
2905
2905
|
}
|
|
2906
2906
|
function ui({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, renderRow: a, getCardTitle: o, footer: s, defaultRow: c }) {
|
|
2907
2907
|
let { fields: l, remove: u, appendEmpty: d } = ci(e, i, c);
|
|
2908
|
-
return pr(e), vr(e, i, n, r), /* @__PURE__ */
|
|
2908
|
+
return pr(e), vr(e, i, n, r), /* @__PURE__ */ Y("div", {
|
|
2909
2909
|
style: { marginTop: 24 },
|
|
2910
2910
|
children: [
|
|
2911
|
-
/* @__PURE__ */
|
|
2911
|
+
/* @__PURE__ */ J(G.Title, {
|
|
2912
2912
|
level: 5,
|
|
2913
2913
|
children: t ?? "Related items"
|
|
2914
2914
|
}),
|
|
2915
|
-
/* @__PURE__ */
|
|
2915
|
+
/* @__PURE__ */ J(V, {
|
|
2916
2916
|
orientation: "vertical",
|
|
2917
2917
|
size: "middle",
|
|
2918
2918
|
style: { width: "100%" },
|
|
@@ -2922,10 +2922,10 @@ function ui({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2922
2922
|
index: n,
|
|
2923
2923
|
name: (t) => oi(e, n, t)
|
|
2924
2924
|
};
|
|
2925
|
-
return /* @__PURE__ */
|
|
2925
|
+
return /* @__PURE__ */ J(T, {
|
|
2926
2926
|
size: "small",
|
|
2927
2927
|
title: o?.(r) ?? `Item ${n + 1}`,
|
|
2928
|
-
extra: /* @__PURE__ */
|
|
2928
|
+
extra: /* @__PURE__ */ J(w, {
|
|
2929
2929
|
type: "link",
|
|
2930
2930
|
danger: !0,
|
|
2931
2931
|
size: "small",
|
|
@@ -2936,7 +2936,7 @@ function ui({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, r
|
|
|
2936
2936
|
}, t.rowKey);
|
|
2937
2937
|
})
|
|
2938
2938
|
}),
|
|
2939
|
-
/* @__PURE__ */
|
|
2939
|
+
/* @__PURE__ */ J(w, {
|
|
2940
2940
|
type: "dashed",
|
|
2941
2941
|
style: { marginTop: 8 },
|
|
2942
2942
|
onClick: d,
|
|
@@ -2958,7 +2958,7 @@ function fi(e) {
|
|
|
2958
2958
|
return t.current.length > e && (t.current.length = e), t.current;
|
|
2959
2959
|
}
|
|
2960
2960
|
function pi(e, t) {
|
|
2961
|
-
let { control: n, getFieldState: r, setFocus: i } =
|
|
2961
|
+
let { control: n, getFieldState: r, setFocus: i } = je(), a = Me({ control: n }), o = u(0), c = u(0);
|
|
2962
2962
|
s(() => {
|
|
2963
2963
|
if (a.submitCount === 0) return;
|
|
2964
2964
|
let n = Object.keys(a.errors).length, s = a.submitCount !== o.current, l = !s && n > 0 && c.current === 0;
|
|
@@ -2989,7 +2989,7 @@ function hi(e) {
|
|
|
2989
2989
|
return i(e) && e.type === mi;
|
|
2990
2990
|
}
|
|
2991
2991
|
function gi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o }) {
|
|
2992
|
-
let { token: s } =
|
|
2992
|
+
let { token: s } = K.useToken(), c = l(() => e.toArray(t).filter(hi).map((e, t) => ({
|
|
2993
2993
|
key: e.key ?? String(t),
|
|
2994
2994
|
label: e.props.label,
|
|
2995
2995
|
disabled: e.props.disabled,
|
|
@@ -3001,19 +3001,19 @@ function gi({ children: t, defaultActiveKey: n, activeKey: r, onChange: i, ...o
|
|
|
3001
3001
|
let t = c[e]?.key;
|
|
3002
3002
|
t != null && g(t);
|
|
3003
3003
|
}, [g, c]));
|
|
3004
|
-
let { control: _, getFieldState: v } =
|
|
3005
|
-
return /* @__PURE__ */
|
|
3004
|
+
let { control: _, getFieldState: v } = je(), y = Me({ control: _ });
|
|
3005
|
+
return /* @__PURE__ */ J(U, {
|
|
3006
3006
|
destroyOnHidden: !1,
|
|
3007
3007
|
items: l(() => c.map((e, t) => {
|
|
3008
3008
|
let n = di(u[t].current, v, y);
|
|
3009
3009
|
return {
|
|
3010
3010
|
key: e.key,
|
|
3011
|
-
label: n ? /* @__PURE__ */
|
|
3011
|
+
label: n ? /* @__PURE__ */ J("span", {
|
|
3012
3012
|
style: { color: s.colorError },
|
|
3013
3013
|
children: e.label
|
|
3014
3014
|
}) : e.label,
|
|
3015
3015
|
disabled: e.disabled,
|
|
3016
|
-
children: /* @__PURE__ */
|
|
3016
|
+
children: /* @__PURE__ */ J(cr, {
|
|
3017
3017
|
sourcesRef: u[t],
|
|
3018
3018
|
children: e.children
|
|
3019
3019
|
})
|
|
@@ -3041,7 +3041,7 @@ function vi(e) {
|
|
|
3041
3041
|
function yi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStepSelect: i = !1, stepsStyle: o, navigationStyle: s, size: c, direction: u, type: f, status: p }) {
|
|
3042
3042
|
let m = l(() => e.toArray(t).filter(vi), [t]), h = fi(m.length), [g, _] = d(n), v = m.length - 1;
|
|
3043
3043
|
pi(h, _);
|
|
3044
|
-
let { control: y, getFieldState: b } =
|
|
3044
|
+
let { control: y, getFieldState: b } = je(), x = Me({ control: y }), S = l(() => m.map((e, t) => {
|
|
3045
3045
|
let n = di(h[t].current, b, x);
|
|
3046
3046
|
return {
|
|
3047
3047
|
title: e.props.title,
|
|
@@ -3056,8 +3056,8 @@ function yi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
3056
3056
|
]), C = a((e) => {
|
|
3057
3057
|
_(e);
|
|
3058
3058
|
}, []);
|
|
3059
|
-
return /* @__PURE__ */
|
|
3060
|
-
/* @__PURE__ */
|
|
3059
|
+
return /* @__PURE__ */ Y(q, { children: [
|
|
3060
|
+
/* @__PURE__ */ J(H, {
|
|
3061
3061
|
current: g,
|
|
3062
3062
|
items: S,
|
|
3063
3063
|
style: {
|
|
@@ -3070,23 +3070,23 @@ function yi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
3070
3070
|
type: f,
|
|
3071
3071
|
status: p
|
|
3072
3072
|
}),
|
|
3073
|
-
m.map((e, t) => /* @__PURE__ */
|
|
3073
|
+
m.map((e, t) => /* @__PURE__ */ J("div", {
|
|
3074
3074
|
style: { display: g === t ? void 0 : "none" },
|
|
3075
|
-
children: /* @__PURE__ */
|
|
3075
|
+
children: /* @__PURE__ */ J(cr, {
|
|
3076
3076
|
sourcesRef: h[t],
|
|
3077
3077
|
children: e.props.children
|
|
3078
3078
|
})
|
|
3079
3079
|
}, e.key ?? String(t))),
|
|
3080
|
-
r && m.length > 1 ? /* @__PURE__ */
|
|
3080
|
+
r && m.length > 1 ? /* @__PURE__ */ Y(V, {
|
|
3081
3081
|
style: {
|
|
3082
3082
|
marginTop: 16,
|
|
3083
3083
|
...s
|
|
3084
3084
|
},
|
|
3085
|
-
children: [/* @__PURE__ */
|
|
3085
|
+
children: [/* @__PURE__ */ J(w, {
|
|
3086
3086
|
disabled: g === 0,
|
|
3087
3087
|
onClick: () => _((e) => e - 1),
|
|
3088
3088
|
children: "Previous"
|
|
3089
|
-
}), /* @__PURE__ */
|
|
3089
|
+
}), /* @__PURE__ */ J(w, {
|
|
3090
3090
|
type: "primary",
|
|
3091
3091
|
disabled: g === v,
|
|
3092
3092
|
onClick: () => _((e) => e + 1),
|
|
@@ -3098,15 +3098,15 @@ function yi({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
|
|
|
3098
3098
|
//#endregion
|
|
3099
3099
|
//#region src/crud/fields/FieldWrapper.tsx
|
|
3100
3100
|
function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, children: o }) {
|
|
3101
|
-
let s = t ?? e, c = !s.includes("."), { control: l } =
|
|
3102
|
-
return pr(e, c), mr(e, c), /* @__PURE__ */
|
|
3101
|
+
let s = t ?? e, c = !s.includes("."), { control: l } = je(), u = or(), d = a ? void 0 : n ?? e, f = n ?? e;
|
|
3102
|
+
return pr(e, c), mr(e, c), /* @__PURE__ */ J(De, {
|
|
3103
3103
|
name: s,
|
|
3104
3104
|
control: l,
|
|
3105
3105
|
rules: {
|
|
3106
3106
|
required: r ? `${f} is required` : !1,
|
|
3107
3107
|
...i
|
|
3108
3108
|
},
|
|
3109
|
-
render: ({ field: e, fieldState: t }) => /* @__PURE__ */
|
|
3109
|
+
render: ({ field: e, fieldState: t }) => /* @__PURE__ */ J(M.Item, {
|
|
3110
3110
|
label: d,
|
|
3111
3111
|
validateStatus: t.error ? "error" : void 0,
|
|
3112
3112
|
help: t.error?.message,
|
|
@@ -3125,14 +3125,14 @@ function $({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3125
3125
|
//#endregion
|
|
3126
3126
|
//#region src/crud/fields/TextField.tsx
|
|
3127
3127
|
function bi({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s }) {
|
|
3128
|
-
return /* @__PURE__ */
|
|
3128
|
+
return /* @__PURE__ */ J($, {
|
|
3129
3129
|
source: e,
|
|
3130
3130
|
name: t,
|
|
3131
3131
|
label: n,
|
|
3132
3132
|
required: r,
|
|
3133
3133
|
rules: i,
|
|
3134
3134
|
hideLabel: s,
|
|
3135
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3135
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(F, {
|
|
3136
3136
|
value: e,
|
|
3137
3137
|
onChange: (e) => t(e.target.value),
|
|
3138
3138
|
onBlur: n,
|
|
@@ -3145,14 +3145,14 @@ function bi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3145
3145
|
//#endregion
|
|
3146
3146
|
//#region src/crud/fields/TextAreaField.tsx
|
|
3147
3147
|
function xi({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s, rows: c = 4, maxLength: l, showCount: u, autoSize: d }) {
|
|
3148
|
-
return /* @__PURE__ */
|
|
3148
|
+
return /* @__PURE__ */ J($, {
|
|
3149
3149
|
source: e,
|
|
3150
3150
|
name: t,
|
|
3151
3151
|
label: n,
|
|
3152
3152
|
required: r,
|
|
3153
3153
|
rules: i,
|
|
3154
3154
|
hideLabel: s,
|
|
3155
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3155
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(F.TextArea, {
|
|
3156
3156
|
value: e,
|
|
3157
3157
|
onChange: (e) => t(e.target.value),
|
|
3158
3158
|
onBlur: n,
|
|
@@ -3169,14 +3169,14 @@ function xi({ source: e, name: t, label: n, required: r, rules: i, placeholder:
|
|
|
3169
3169
|
//#endregion
|
|
3170
3170
|
//#region src/crud/fields/NumberField.tsx
|
|
3171
3171
|
function Si({ source: e, name: t, label: n, required: r, rules: i, min: a, max: o, step: s, inputStyle: c, hideLabel: l }) {
|
|
3172
|
-
return /* @__PURE__ */
|
|
3172
|
+
return /* @__PURE__ */ J($, {
|
|
3173
3173
|
source: e,
|
|
3174
3174
|
name: t,
|
|
3175
3175
|
label: n,
|
|
3176
3176
|
required: r,
|
|
3177
3177
|
rules: i,
|
|
3178
3178
|
hideLabel: l,
|
|
3179
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3179
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(I, {
|
|
3180
3180
|
value: e,
|
|
3181
3181
|
onChange: (e) => t(e),
|
|
3182
3182
|
onBlur: n,
|
|
@@ -3194,14 +3194,14 @@ function Si({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
|
|
|
3194
3194
|
//#endregion
|
|
3195
3195
|
//#region src/crud/fields/BooleanField.tsx
|
|
3196
3196
|
function Ci({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, disabled: o }) {
|
|
3197
|
-
return /* @__PURE__ */
|
|
3197
|
+
return /* @__PURE__ */ J($, {
|
|
3198
3198
|
source: e,
|
|
3199
3199
|
name: t,
|
|
3200
3200
|
label: n,
|
|
3201
3201
|
required: r,
|
|
3202
3202
|
rules: i,
|
|
3203
3203
|
hideLabel: a,
|
|
3204
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */
|
|
3204
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(oe, {
|
|
3205
3205
|
checked: !!e,
|
|
3206
3206
|
onChange: t,
|
|
3207
3207
|
disabled: n || o
|
|
@@ -3210,7 +3210,7 @@ function Ci({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3210
3210
|
}
|
|
3211
3211
|
//#endregion
|
|
3212
3212
|
//#region src/crud/utils/parseDayjsValue.ts
|
|
3213
|
-
var wi = /* @__PURE__ */
|
|
3213
|
+
var wi = /* @__PURE__ */ Ue((/* @__PURE__ */ Ve(((e, t) => {
|
|
3214
3214
|
(function(n, r) {
|
|
3215
3215
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_customParseFormat = r();
|
|
3216
3216
|
})(e, (function() {
|
|
@@ -3367,12 +3367,12 @@ var wi = /* @__PURE__ */ We((/* @__PURE__ */ He(((e, t) => {
|
|
|
3367
3367
|
};
|
|
3368
3368
|
}));
|
|
3369
3369
|
})))(), 1);
|
|
3370
|
-
|
|
3370
|
+
Pe.extend(wi.default);
|
|
3371
3371
|
function Ti(e, t) {
|
|
3372
3372
|
if (e == null || e === "") return null;
|
|
3373
|
-
if (
|
|
3374
|
-
let n =
|
|
3375
|
-
return n.isValid() ? n :
|
|
3373
|
+
if (Pe.isDayjs(e)) return e;
|
|
3374
|
+
let n = Pe(String(e), t, !0);
|
|
3375
|
+
return n.isValid() ? n : Pe(String(e)).isValid() ? Pe(String(e)) : null;
|
|
3376
3376
|
}
|
|
3377
3377
|
//#endregion
|
|
3378
3378
|
//#region src/crud/fields/DateField.tsx
|
|
@@ -3383,14 +3383,14 @@ var Ei = "YYYY-MM-DD", Di = `${Ei} HH:mm:ss`, Oi = [
|
|
|
3383
3383
|
"YYYY-MM-DDTHH:mm:ssZ"
|
|
3384
3384
|
];
|
|
3385
3385
|
function ki({ source: e, name: t, label: n, required: r, rules: i, showTime: a, hideLabel: o }) {
|
|
3386
|
-
return /* @__PURE__ */
|
|
3386
|
+
return /* @__PURE__ */ J($, {
|
|
3387
3387
|
source: e,
|
|
3388
3388
|
name: t,
|
|
3389
3389
|
label: n,
|
|
3390
3390
|
required: r,
|
|
3391
3391
|
rules: i,
|
|
3392
3392
|
hideLabel: o,
|
|
3393
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3393
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(O, {
|
|
3394
3394
|
value: Ti(e, a ? [...Oi, Di] : Oi),
|
|
3395
3395
|
onChange: (e) => t(e ? e.format(a ? Di : Ei) : null),
|
|
3396
3396
|
onBlur: n,
|
|
@@ -3404,7 +3404,7 @@ function ki({ source: e, name: t, label: n, required: r, rules: i, showTime: a,
|
|
|
3404
3404
|
//#endregion
|
|
3405
3405
|
//#region src/crud/fields/DateTimeField.tsx
|
|
3406
3406
|
function Ai(e) {
|
|
3407
|
-
return /* @__PURE__ */
|
|
3407
|
+
return /* @__PURE__ */ J(ki, {
|
|
3408
3408
|
showTime: !0,
|
|
3409
3409
|
...e
|
|
3410
3410
|
});
|
|
@@ -3418,14 +3418,14 @@ var ji = "HH:mm:ss", Mi = [
|
|
|
3418
3418
|
"H:mm"
|
|
3419
3419
|
];
|
|
3420
3420
|
function Ni({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, format: o = ji }) {
|
|
3421
|
-
return /* @__PURE__ */
|
|
3421
|
+
return /* @__PURE__ */ J($, {
|
|
3422
3422
|
source: e,
|
|
3423
3423
|
name: t,
|
|
3424
3424
|
label: n,
|
|
3425
3425
|
required: r,
|
|
3426
3426
|
rules: i,
|
|
3427
3427
|
hideLabel: a,
|
|
3428
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3428
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(ce, {
|
|
3429
3429
|
value: Ti(e, Mi),
|
|
3430
3430
|
onChange: (e) => t(e ? e.format(o) : null),
|
|
3431
3431
|
onBlur: n,
|
|
@@ -3438,14 +3438,14 @@ function Ni({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
3438
3438
|
//#endregion
|
|
3439
3439
|
//#region src/crud/fields/SelectField.tsx
|
|
3440
3440
|
function Pi({ source: e, name: t, label: n, required: r, rules: i, choices: a, mode: o, allowClear: s, hideLabel: c }) {
|
|
3441
|
-
return /* @__PURE__ */
|
|
3441
|
+
return /* @__PURE__ */ J($, {
|
|
3442
3442
|
source: e,
|
|
3443
3443
|
name: t,
|
|
3444
3444
|
label: n,
|
|
3445
3445
|
required: r,
|
|
3446
3446
|
rules: i,
|
|
3447
3447
|
hideLabel: c,
|
|
3448
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */
|
|
3448
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(B, {
|
|
3449
3449
|
value: e,
|
|
3450
3450
|
onChange: t,
|
|
3451
3451
|
options: a,
|
|
@@ -3459,14 +3459,14 @@ function Pi({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
|
|
|
3459
3459
|
//#endregion
|
|
3460
3460
|
//#region src/crud/fields/PasswordField.tsx
|
|
3461
3461
|
function Fi({ source: e, name: t, label: n, required: r, rules: i, autoComplete: a, hideLabel: o }) {
|
|
3462
|
-
return /* @__PURE__ */
|
|
3462
|
+
return /* @__PURE__ */ J($, {
|
|
3463
3463
|
source: e,
|
|
3464
3464
|
name: t,
|
|
3465
3465
|
label: n,
|
|
3466
3466
|
required: r,
|
|
3467
3467
|
rules: i,
|
|
3468
3468
|
hideLabel: o,
|
|
3469
|
-
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */
|
|
3469
|
+
children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ J(F.Password, {
|
|
3470
3470
|
value: e,
|
|
3471
3471
|
onChange: (e) => t(e.target.value),
|
|
3472
3472
|
onBlur: n,
|
|
@@ -3476,11 +3476,11 @@ function Fi({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
|
|
|
3476
3476
|
});
|
|
3477
3477
|
}
|
|
3478
3478
|
function Ii({ source: e, name: t, label: n, required: r, rules: i, confirmSource: a, confirmLabel: o = "Confirm password", autoComplete: s = "new-password", hideLabel: c }) {
|
|
3479
|
-
let l =
|
|
3479
|
+
let l = Ne({
|
|
3480
3480
|
name: t ?? e,
|
|
3481
3481
|
disabled: !a
|
|
3482
3482
|
});
|
|
3483
|
-
return a ? /* @__PURE__ */
|
|
3483
|
+
return a ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(Fi, {
|
|
3484
3484
|
source: e,
|
|
3485
3485
|
name: t,
|
|
3486
3486
|
label: n,
|
|
@@ -3488,14 +3488,14 @@ function Ii({ source: e, name: t, label: n, required: r, rules: i, confirmSource
|
|
|
3488
3488
|
rules: i,
|
|
3489
3489
|
autoComplete: s,
|
|
3490
3490
|
hideLabel: c
|
|
3491
|
-
}), /* @__PURE__ */
|
|
3491
|
+
}), /* @__PURE__ */ J(Fi, {
|
|
3492
3492
|
source: a,
|
|
3493
3493
|
label: o,
|
|
3494
3494
|
required: r,
|
|
3495
3495
|
autoComplete: s,
|
|
3496
3496
|
hideLabel: c,
|
|
3497
3497
|
rules: { validate: (e) => !l || e === l || "Passwords do not match" }
|
|
3498
|
-
})] }) : /* @__PURE__ */
|
|
3498
|
+
})] }) : /* @__PURE__ */ J(Fi, {
|
|
3499
3499
|
source: e,
|
|
3500
3500
|
name: t,
|
|
3501
3501
|
label: n,
|
|
@@ -3548,7 +3548,13 @@ function Wi(e, t) {
|
|
|
3548
3548
|
for (let e of t) n.set(e.value, e);
|
|
3549
3549
|
return Array.from(n.values());
|
|
3550
3550
|
}
|
|
3551
|
-
function Gi(e
|
|
3551
|
+
function Gi(e, t) {
|
|
3552
|
+
return e.filter((e) => !t.some((t) => t.value === e));
|
|
3553
|
+
}
|
|
3554
|
+
function Ki(e, t, n = []) {
|
|
3555
|
+
return Wi(n, e.filter((e) => t.some((t) => e.value === t)));
|
|
3556
|
+
}
|
|
3557
|
+
function qi(e = {}) {
|
|
3552
3558
|
let t = e.popupMatchSelectWidth ?? !1;
|
|
3553
3559
|
return t === !1 ? {
|
|
3554
3560
|
popupMatchSelectWidth: !1,
|
|
@@ -3557,16 +3563,27 @@ function Gi(e = {}) {
|
|
|
3557
3563
|
}
|
|
3558
3564
|
//#endregion
|
|
3559
3565
|
//#region src/crud/utils/referenceSelectNotFoundContent.tsx
|
|
3560
|
-
function
|
|
3561
|
-
return e ? /* @__PURE__ */
|
|
3566
|
+
function Ji(e) {
|
|
3567
|
+
return e ? /* @__PURE__ */ J(ae, { size: "small" }) : void 0;
|
|
3568
|
+
}
|
|
3569
|
+
//#endregion
|
|
3570
|
+
//#region src/crud/utils/referenceSelectSelectedProps.ts
|
|
3571
|
+
function Yi(e, t, n) {
|
|
3572
|
+
return {
|
|
3573
|
+
loading: e || t,
|
|
3574
|
+
disabled: !!(n || t)
|
|
3575
|
+
};
|
|
3576
|
+
}
|
|
3577
|
+
function Xi(e, t, n) {
|
|
3578
|
+
return e ? n : t;
|
|
3562
3579
|
}
|
|
3563
3580
|
//#endregion
|
|
3564
3581
|
//#region src/crud/utils/useChoices.ts
|
|
3565
|
-
var
|
|
3566
|
-
function
|
|
3582
|
+
var Zi = /* @__PURE__ */ new Map(), Qi = /* @__PURE__ */ new Map();
|
|
3583
|
+
function $i(e, t) {
|
|
3567
3584
|
return typeof e == "function" ? `fn:${t ?? ""}` : Array.isArray(e) ? `static:${e.length}` : `res:${e.resource}:${JSON.stringify(e.filter ?? {})}:${t ?? ""}`;
|
|
3568
3585
|
}
|
|
3569
|
-
async function
|
|
3586
|
+
async function ea(e, t, n, r, i) {
|
|
3570
3587
|
return typeof e == "function" ? e({
|
|
3571
3588
|
dataProvider: t,
|
|
3572
3589
|
search: i
|
|
@@ -3585,21 +3602,21 @@ async function Xi(e, t, n, r, i) {
|
|
|
3585
3602
|
record: e
|
|
3586
3603
|
}));
|
|
3587
3604
|
}
|
|
3588
|
-
function
|
|
3589
|
-
let o =
|
|
3605
|
+
function ta(e, t, n, r, i, a) {
|
|
3606
|
+
let o = $i(e, i);
|
|
3590
3607
|
if (a) {
|
|
3591
|
-
let e =
|
|
3608
|
+
let e = Zi.get(o);
|
|
3592
3609
|
if (e && !i) return Promise.resolve(e);
|
|
3593
3610
|
}
|
|
3594
|
-
let s =
|
|
3611
|
+
let s = Qi.get(o);
|
|
3595
3612
|
if (s) return s;
|
|
3596
|
-
let c =
|
|
3597
|
-
|
|
3613
|
+
let c = ea(e, t, n, r, i).then((e) => (a && !i && Zi.set(o, e), e)).finally(() => {
|
|
3614
|
+
Qi.delete(o);
|
|
3598
3615
|
});
|
|
3599
|
-
return
|
|
3616
|
+
return Qi.set(o, c), c;
|
|
3600
3617
|
}
|
|
3601
|
-
function
|
|
3602
|
-
let { lazy: c = !1, active:
|
|
3618
|
+
function na(e, t, n = "name", r = "id", i, o = {}) {
|
|
3619
|
+
let { lazy: c = !1, active: f = !1, selectedValues: p, selectedRecords: m, fetchSelected: h = !0, cache: g } = o, _ = g ?? !c, v = Yt(), y = l(() => {
|
|
3603
3620
|
if (e) return e;
|
|
3604
3621
|
if (t) return {
|
|
3605
3622
|
resource: t,
|
|
@@ -3609,65 +3626,75 @@ function Qi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3609
3626
|
e,
|
|
3610
3627
|
t,
|
|
3611
3628
|
i
|
|
3612
|
-
]),
|
|
3613
|
-
f,
|
|
3629
|
+
]), b = y ? $i(y, i) : void 0, x = l(() => Bi(p, r), [p, r]), S = l(() => Ui(Vi(p, m, r), n, r), [
|
|
3614
3630
|
p,
|
|
3631
|
+
m,
|
|
3615
3632
|
n,
|
|
3616
3633
|
r
|
|
3617
|
-
]),
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3634
|
+
]), C = !!(y && (!c || f || Array.isArray(y))), [w, T] = d(() => S.length ? S : !b || i || c || !_ ? [] : Zi.get(b) ?? []), [E, D] = d(() => C ? !_ || !b || i ? !!y : !Zi.has(b) : !1), [O, k] = d(() => !!(h && t && Gi(x, S).length)), A = u(w);
|
|
3635
|
+
A.current = w;
|
|
3636
|
+
let j = u(x);
|
|
3637
|
+
j.current = x, s(() => {
|
|
3638
|
+
S.length && T((e) => Wi(e, S));
|
|
3639
|
+
}, [S]);
|
|
3640
|
+
let M = a(async () => {
|
|
3641
|
+
if (!y || !C) {
|
|
3642
|
+
y || T(S), D(!1);
|
|
3624
3643
|
return;
|
|
3625
3644
|
}
|
|
3626
|
-
if (
|
|
3627
|
-
let e =
|
|
3645
|
+
if (_) {
|
|
3646
|
+
let e = $i(y, i), t = Zi.get(e);
|
|
3628
3647
|
if (t && !i) {
|
|
3629
|
-
|
|
3648
|
+
T((e) => Wi(Ki(e, j.current, S), t)), D(!1);
|
|
3630
3649
|
return;
|
|
3631
3650
|
}
|
|
3632
3651
|
}
|
|
3633
|
-
|
|
3652
|
+
D(!0), c && T((e) => Ki(e, j.current, S));
|
|
3634
3653
|
try {
|
|
3635
|
-
|
|
3654
|
+
let e = await ta(y, v, n, r, i, _);
|
|
3655
|
+
T((t) => Wi(Ki(t, j.current, S), e));
|
|
3636
3656
|
} catch {
|
|
3637
|
-
!
|
|
3657
|
+
!x.length && !S.length ? T([]) : c && T((e) => Ki(e, j.current, S));
|
|
3638
3658
|
} finally {
|
|
3639
|
-
|
|
3659
|
+
D(!1);
|
|
3640
3660
|
}
|
|
3641
3661
|
}, [
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
g,
|
|
3662
|
+
y,
|
|
3663
|
+
C,
|
|
3645
3664
|
_,
|
|
3665
|
+
v,
|
|
3646
3666
|
n,
|
|
3647
3667
|
r,
|
|
3648
3668
|
i,
|
|
3649
3669
|
c,
|
|
3650
|
-
|
|
3651
|
-
|
|
3670
|
+
x.length,
|
|
3671
|
+
S
|
|
3652
3672
|
]);
|
|
3653
3673
|
s(() => {
|
|
3654
|
-
|
|
3655
|
-
}, [
|
|
3656
|
-
c && !
|
|
3674
|
+
M();
|
|
3675
|
+
}, [M]), s(() => {
|
|
3676
|
+
c && !f && !i && (T((e) => Ki(e, x, S)), D(!1));
|
|
3657
3677
|
}, [
|
|
3658
3678
|
c,
|
|
3659
|
-
|
|
3679
|
+
f,
|
|
3660
3680
|
i,
|
|
3681
|
+
S,
|
|
3661
3682
|
x
|
|
3662
3683
|
]), s(() => {
|
|
3663
|
-
if (!
|
|
3664
|
-
|
|
3665
|
-
|
|
3684
|
+
if (!h || !t || !x.length) {
|
|
3685
|
+
k(!1);
|
|
3686
|
+
return;
|
|
3687
|
+
}
|
|
3688
|
+
let e = Gi(x, Wi(S, A.current));
|
|
3689
|
+
if (!e.length) {
|
|
3690
|
+
k(!1);
|
|
3691
|
+
return;
|
|
3692
|
+
}
|
|
3666
3693
|
let i = !1;
|
|
3667
|
-
return (async () => {
|
|
3694
|
+
return k(!0), (async () => {
|
|
3668
3695
|
let a = [];
|
|
3669
3696
|
for (let i of e) try {
|
|
3670
|
-
let e = (await
|
|
3697
|
+
let e = (await v.getOne(t, i)).data;
|
|
3671
3698
|
a.push({
|
|
3672
3699
|
label: Hi(e, n),
|
|
3673
3700
|
value: e[r],
|
|
@@ -3679,58 +3706,59 @@ function Qi(e, t, n = "name", r = "id", i, o = {}) {
|
|
|
3679
3706
|
value: i
|
|
3680
3707
|
});
|
|
3681
3708
|
}
|
|
3682
|
-
i ||
|
|
3709
|
+
i || (a.length && T((e) => {
|
|
3683
3710
|
let t = a.filter((t) => !e.some((e) => e.value === t.value));
|
|
3684
3711
|
return t.length ? Wi(e, t) : e;
|
|
3685
|
-
});
|
|
3712
|
+
}), k(!1));
|
|
3686
3713
|
})(), () => {
|
|
3687
3714
|
i = !0;
|
|
3688
3715
|
};
|
|
3689
3716
|
}, [
|
|
3690
|
-
|
|
3717
|
+
h,
|
|
3691
3718
|
t,
|
|
3692
|
-
|
|
3719
|
+
v,
|
|
3693
3720
|
n,
|
|
3694
3721
|
r,
|
|
3695
|
-
|
|
3696
|
-
|
|
3722
|
+
x,
|
|
3723
|
+
S
|
|
3697
3724
|
]);
|
|
3698
|
-
let
|
|
3725
|
+
let N = a((e) => w.find((t) => t.value === e)?.label ?? String(e ?? "—"), [w]);
|
|
3699
3726
|
return {
|
|
3700
|
-
options:
|
|
3701
|
-
loading:
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3727
|
+
options: w,
|
|
3728
|
+
loading: E,
|
|
3729
|
+
selectedLoading: O,
|
|
3730
|
+
labelForValue: N,
|
|
3731
|
+
labelsForValues: a((e) => e?.length ? e.map((e) => N(e)).join(", ") : "—", [N]),
|
|
3732
|
+
optionForValue: a((e) => w.find((t) => t.value === e), [w]),
|
|
3733
|
+
reload: M
|
|
3706
3734
|
};
|
|
3707
3735
|
}
|
|
3708
3736
|
//#endregion
|
|
3709
3737
|
//#region src/crud/fields/ReferenceInputActions.tsx
|
|
3710
|
-
function
|
|
3711
|
-
let u =
|
|
3712
|
-
return !p && !m ? null : /* @__PURE__ */
|
|
3738
|
+
function ra({ reference: e, referenceForm: t, referencePermissions: n, referenceTitle: r, referenceDefaultValues: i, referenceModalWidth: a, selectedId: o, disabled: s, onCreated: c, onUpdated: l }) {
|
|
3739
|
+
let u = mt(), f = r ?? e, p = !!(e && t) && Z(u, n, "add"), m = !!(e && t && o != null && o !== "") && Z(u, n, "change"), [h, g] = d(null);
|
|
3740
|
+
return !p && !m ? null : /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y(V, {
|
|
3713
3741
|
size: 4,
|
|
3714
|
-
children: [p ? /* @__PURE__ */
|
|
3742
|
+
children: [p ? /* @__PURE__ */ J(W, {
|
|
3715
3743
|
title: `Add ${f ?? "record"}`,
|
|
3716
|
-
children: /* @__PURE__ */
|
|
3744
|
+
children: /* @__PURE__ */ J(w, {
|
|
3717
3745
|
type: "default",
|
|
3718
|
-
icon: /* @__PURE__ */
|
|
3746
|
+
icon: /* @__PURE__ */ J(Se, {}),
|
|
3719
3747
|
disabled: s,
|
|
3720
3748
|
"aria-label": `Add ${f ?? "record"}`,
|
|
3721
3749
|
onClick: () => g("new")
|
|
3722
3750
|
})
|
|
3723
|
-
}) : null, m ? /* @__PURE__ */
|
|
3751
|
+
}) : null, m ? /* @__PURE__ */ J(W, {
|
|
3724
3752
|
title: `Edit ${f ?? "record"}`,
|
|
3725
|
-
children: /* @__PURE__ */
|
|
3753
|
+
children: /* @__PURE__ */ J(w, {
|
|
3726
3754
|
type: "default",
|
|
3727
|
-
icon: /* @__PURE__ */
|
|
3755
|
+
icon: /* @__PURE__ */ J(ge, {}),
|
|
3728
3756
|
disabled: s,
|
|
3729
3757
|
"aria-label": `Edit ${f ?? "record"}`,
|
|
3730
3758
|
onClick: () => g(String(o))
|
|
3731
3759
|
})
|
|
3732
3760
|
}) : null]
|
|
3733
|
-
}), e && t && h != null ? /* @__PURE__ */
|
|
3761
|
+
}), e && t && h != null ? /* @__PURE__ */ J(Ur, {
|
|
3734
3762
|
resource: e,
|
|
3735
3763
|
editId: h,
|
|
3736
3764
|
onClose: () => g(null),
|
|
@@ -3747,35 +3775,35 @@ function $i({ reference: e, referenceForm: t, referencePermissions: n, reference
|
|
|
3747
3775
|
}
|
|
3748
3776
|
//#endregion
|
|
3749
3777
|
//#region src/crud/fields/ReferenceField.tsx
|
|
3750
|
-
function
|
|
3751
|
-
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A = Ri(p, r), { options: j, loading: M, optionForValue:
|
|
3778
|
+
function ia({ 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 }) {
|
|
3779
|
+
let [T, E] = d(), [D, O] = d(!1), k = D || !!T, A = Ri(p, r), { options: j, loading: M, selectedLoading: N, optionForValue: P, reload: F } = na(t, e, n, r, i ? T : void 0, {
|
|
3752
3780
|
lazy: u,
|
|
3753
3781
|
active: k,
|
|
3754
3782
|
selectedValues: p,
|
|
3755
3783
|
selectedRecords: g,
|
|
3756
3784
|
fetchSelected: f
|
|
3757
|
-
}),
|
|
3785
|
+
}), I = Yi(M, N, o), L = l(() => j.map((e) => ({
|
|
3758
3786
|
label: e.label,
|
|
3759
3787
|
value: e.value
|
|
3760
|
-
})), [j]),
|
|
3788
|
+
})), [j]), ee = (e) => {
|
|
3761
3789
|
let t = e[r];
|
|
3762
3790
|
m(t), c?.(t, {
|
|
3763
3791
|
label: Hi(e, n),
|
|
3764
3792
|
value: t,
|
|
3765
3793
|
record: e
|
|
3766
|
-
}, { name: h }),
|
|
3767
|
-
},
|
|
3768
|
-
...
|
|
3794
|
+
}, { name: h }), F();
|
|
3795
|
+
}, R = /* @__PURE__ */ J(B, {
|
|
3796
|
+
...qi({
|
|
3769
3797
|
popupMatchSelectWidth: C,
|
|
3770
3798
|
popupMinWidth: w
|
|
3771
3799
|
}),
|
|
3772
|
-
value: A,
|
|
3800
|
+
value: Xi(N, A, void 0),
|
|
3773
3801
|
onChange: (e) => {
|
|
3774
|
-
m(e), c?.(e,
|
|
3802
|
+
m(e), c?.(e, P(e), { name: h });
|
|
3775
3803
|
},
|
|
3776
|
-
options:
|
|
3777
|
-
loading:
|
|
3778
|
-
notFoundContent:
|
|
3804
|
+
options: L,
|
|
3805
|
+
loading: I.loading,
|
|
3806
|
+
notFoundContent: Ji(I.loading),
|
|
3779
3807
|
showSearch: i,
|
|
3780
3808
|
filterOption: i ? !1 : void 0,
|
|
3781
3809
|
onSearch: i ? E : void 0,
|
|
@@ -3783,7 +3811,7 @@ function ea({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3783
3811
|
O(e), e || E(void 0);
|
|
3784
3812
|
},
|
|
3785
3813
|
allowClear: a,
|
|
3786
|
-
disabled:
|
|
3814
|
+
disabled: I.disabled,
|
|
3787
3815
|
optionFilterProp: "label",
|
|
3788
3816
|
style: {
|
|
3789
3817
|
width: "100%",
|
|
@@ -3791,20 +3819,20 @@ function ea({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3791
3819
|
...s
|
|
3792
3820
|
}
|
|
3793
3821
|
});
|
|
3794
|
-
return S ? /* @__PURE__ */
|
|
3822
|
+
return S ? /* @__PURE__ */ Y("div", {
|
|
3795
3823
|
style: {
|
|
3796
3824
|
display: "flex",
|
|
3797
3825
|
gap: 8,
|
|
3798
3826
|
width: "100%",
|
|
3799
3827
|
alignItems: "flex-start"
|
|
3800
3828
|
},
|
|
3801
|
-
children: [/* @__PURE__ */
|
|
3829
|
+
children: [/* @__PURE__ */ J("div", {
|
|
3802
3830
|
style: {
|
|
3803
3831
|
flex: 1,
|
|
3804
3832
|
minWidth: 0
|
|
3805
3833
|
},
|
|
3806
|
-
children:
|
|
3807
|
-
}), /* @__PURE__ */
|
|
3834
|
+
children: R
|
|
3835
|
+
}), /* @__PURE__ */ J(ra, {
|
|
3808
3836
|
reference: e,
|
|
3809
3837
|
referenceForm: _,
|
|
3810
3838
|
referencePermissions: v,
|
|
@@ -3812,25 +3840,25 @@ function ea({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3812
3840
|
referenceDefaultValues: b,
|
|
3813
3841
|
referenceModalWidth: x,
|
|
3814
3842
|
selectedId: A,
|
|
3815
|
-
disabled:
|
|
3816
|
-
onCreated:
|
|
3817
|
-
onUpdated: () => void
|
|
3843
|
+
disabled: I.disabled,
|
|
3844
|
+
onCreated: ee,
|
|
3845
|
+
onUpdated: () => void F()
|
|
3818
3846
|
})]
|
|
3819
|
-
}) :
|
|
3847
|
+
}) : R;
|
|
3820
3848
|
}
|
|
3821
|
-
function
|
|
3822
|
-
let E =
|
|
3849
|
+
function aa({ source: e, name: t, label: n, reference: r, choices: i, optionLabel: a = "name", optionValue: o = "id", required: s, rules: c, search: l, allowClear: u, disabled: d, hideLabel: f, inputStyle: p, onValueChange: m, lazy: h = !0, recordSource: g, fetchSelected: _ = !0, referenceForm: v, referencePermissions: y, referenceTitle: b, referenceDefaultValues: x, referenceModalWidth: S, referenceActions: C = !0, popupMatchSelectWidth: w, popupMinWidth: T }) {
|
|
3850
|
+
let E = Ne({
|
|
3823
3851
|
name: g ?? "",
|
|
3824
3852
|
disabled: !g
|
|
3825
3853
|
});
|
|
3826
|
-
return /* @__PURE__ */
|
|
3854
|
+
return /* @__PURE__ */ J($, {
|
|
3827
3855
|
source: e,
|
|
3828
3856
|
name: t,
|
|
3829
3857
|
label: n,
|
|
3830
3858
|
required: s,
|
|
3831
3859
|
rules: c,
|
|
3832
3860
|
hideLabel: f,
|
|
3833
|
-
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */
|
|
3861
|
+
children: ({ value: e, onChange: t, disabled: n, name: s }) => /* @__PURE__ */ J(ia, {
|
|
3834
3862
|
reference: r,
|
|
3835
3863
|
choices: i,
|
|
3836
3864
|
optionLabel: a,
|
|
@@ -3859,27 +3887,27 @@ function ta({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3859
3887
|
}
|
|
3860
3888
|
//#endregion
|
|
3861
3889
|
//#region src/crud/fields/ReferenceManyField.tsx
|
|
3862
|
-
function
|
|
3863
|
-
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D = zi(c, r), { options: O, loading: k,
|
|
3890
|
+
function oa({ 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 }) {
|
|
3891
|
+
let [S, C] = d(), [w, T] = d(!1), E = w || !!S, D = zi(c, r), { options: O, loading: k, selectedLoading: A, reload: j } = na(t, e, n, r, i ? S : void 0, {
|
|
3864
3892
|
lazy: o,
|
|
3865
3893
|
active: E,
|
|
3866
3894
|
selectedValues: c,
|
|
3867
3895
|
selectedRecords: p,
|
|
3868
3896
|
fetchSelected: s
|
|
3869
|
-
}),
|
|
3897
|
+
}), M = Yi(k, A, f), N = l(() => O.map((e) => ({
|
|
3870
3898
|
label: e.label,
|
|
3871
3899
|
value: e.value
|
|
3872
|
-
})), [O]),
|
|
3873
|
-
...
|
|
3900
|
+
})), [O]), P = /* @__PURE__ */ J(B, {
|
|
3901
|
+
...qi({
|
|
3874
3902
|
popupMatchSelectWidth: b,
|
|
3875
3903
|
popupMinWidth: x
|
|
3876
3904
|
}),
|
|
3877
3905
|
mode: "multiple",
|
|
3878
|
-
value: D,
|
|
3906
|
+
value: Xi(A, D, []),
|
|
3879
3907
|
onChange: u,
|
|
3880
|
-
options:
|
|
3881
|
-
loading:
|
|
3882
|
-
notFoundContent:
|
|
3908
|
+
options: N,
|
|
3909
|
+
loading: M.loading,
|
|
3910
|
+
notFoundContent: Ji(M.loading),
|
|
3883
3911
|
showSearch: i,
|
|
3884
3912
|
filterOption: i ? !1 : void 0,
|
|
3885
3913
|
onSearch: i ? C : void 0,
|
|
@@ -3887,55 +3915,55 @@ function na({ reference: e, choices: t, optionLabel: n = "name", optionValue: r
|
|
|
3887
3915
|
T(e), e || C(void 0);
|
|
3888
3916
|
},
|
|
3889
3917
|
allowClear: a,
|
|
3890
|
-
disabled:
|
|
3918
|
+
disabled: M.disabled,
|
|
3891
3919
|
optionFilterProp: "label",
|
|
3892
3920
|
style: { width: "100%" }
|
|
3893
3921
|
});
|
|
3894
|
-
return y ? /* @__PURE__ */
|
|
3922
|
+
return y ? /* @__PURE__ */ Y("div", {
|
|
3895
3923
|
style: {
|
|
3896
3924
|
display: "flex",
|
|
3897
3925
|
gap: 8,
|
|
3898
3926
|
width: "100%",
|
|
3899
3927
|
alignItems: "flex-start"
|
|
3900
3928
|
},
|
|
3901
|
-
children: [/* @__PURE__ */
|
|
3929
|
+
children: [/* @__PURE__ */ J("div", {
|
|
3902
3930
|
style: {
|
|
3903
3931
|
flex: 1,
|
|
3904
3932
|
minWidth: 0
|
|
3905
3933
|
},
|
|
3906
|
-
children:
|
|
3907
|
-
}), /* @__PURE__ */
|
|
3934
|
+
children: P
|
|
3935
|
+
}), /* @__PURE__ */ J(ra, {
|
|
3908
3936
|
reference: e,
|
|
3909
3937
|
referenceForm: m,
|
|
3910
3938
|
referencePermissions: h,
|
|
3911
3939
|
referenceTitle: g,
|
|
3912
3940
|
referenceDefaultValues: _,
|
|
3913
3941
|
referenceModalWidth: v,
|
|
3914
|
-
disabled:
|
|
3942
|
+
disabled: M.disabled,
|
|
3915
3943
|
onCreated: (e) => {
|
|
3916
3944
|
let t = e[r], n = Array.isArray(D) ? D : [];
|
|
3917
3945
|
if (n.some((e) => e === t)) {
|
|
3918
|
-
|
|
3946
|
+
j();
|
|
3919
3947
|
return;
|
|
3920
3948
|
}
|
|
3921
|
-
u([...n, t]),
|
|
3949
|
+
u([...n, t]), j();
|
|
3922
3950
|
}
|
|
3923
3951
|
})]
|
|
3924
|
-
}) :
|
|
3952
|
+
}) : P;
|
|
3925
3953
|
}
|
|
3926
|
-
function
|
|
3927
|
-
let w =
|
|
3954
|
+
function sa({ source: e, name: t, label: n, reference: r, choices: i, optionLabel: a = "name", optionValue: o = "id", required: s, rules: c, search: l, allowClear: u = !0, hideLabel: d, disabled: f, lazy: p = !0, recordSource: m, fetchSelected: h = !0, referenceForm: g, referencePermissions: _, referenceTitle: v, referenceDefaultValues: y, referenceModalWidth: b, referenceActions: x = !0, popupMatchSelectWidth: S, popupMinWidth: C }) {
|
|
3955
|
+
let w = Ne({
|
|
3928
3956
|
name: m ?? "",
|
|
3929
3957
|
disabled: !m
|
|
3930
3958
|
});
|
|
3931
|
-
return /* @__PURE__ */
|
|
3959
|
+
return /* @__PURE__ */ J($, {
|
|
3932
3960
|
source: e,
|
|
3933
3961
|
name: t,
|
|
3934
3962
|
label: n,
|
|
3935
3963
|
required: s,
|
|
3936
3964
|
rules: c,
|
|
3937
3965
|
hideLabel: d,
|
|
3938
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */
|
|
3966
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(oa, {
|
|
3939
3967
|
reference: r,
|
|
3940
3968
|
choices: i,
|
|
3941
3969
|
optionLabel: a,
|
|
@@ -3961,10 +3989,10 @@ function ra({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
|
|
|
3961
3989
|
}
|
|
3962
3990
|
//#endregion
|
|
3963
3991
|
//#region src/crud/fields/uploadFieldUtils.ts
|
|
3964
|
-
function
|
|
3992
|
+
function ca(e) {
|
|
3965
3993
|
return e instanceof File ? !0 : typeof e == "string" && e.length > 0;
|
|
3966
3994
|
}
|
|
3967
|
-
function
|
|
3995
|
+
function la(e) {
|
|
3968
3996
|
if (e instanceof File) return e.name;
|
|
3969
3997
|
if (typeof e == "string" && e.length > 0) try {
|
|
3970
3998
|
return new URL(e, "http://local").pathname.split("/").filter(Boolean).pop() || e;
|
|
@@ -3974,7 +4002,7 @@ function aa(e) {
|
|
|
3974
4002
|
}
|
|
3975
4003
|
//#endregion
|
|
3976
4004
|
//#region src/crud/fields/useUploadPreviewUrl.ts
|
|
3977
|
-
function
|
|
4005
|
+
function ua(e) {
|
|
3978
4006
|
let [t, n] = d();
|
|
3979
4007
|
if (s(() => {
|
|
3980
4008
|
if (e instanceof File) {
|
|
@@ -3987,14 +4015,14 @@ function oa(e) {
|
|
|
3987
4015
|
}
|
|
3988
4016
|
//#endregion
|
|
3989
4017
|
//#region src/crud/fields/ImageField.tsx
|
|
3990
|
-
function
|
|
3991
|
-
let o = u(null), s =
|
|
3992
|
-
return /* @__PURE__ */
|
|
4018
|
+
function da({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "image/*", previewWidth: a = 200 }) {
|
|
4019
|
+
let o = u(null), s = ua(e), c = r && ca(e);
|
|
4020
|
+
return /* @__PURE__ */ Y(V, {
|
|
3993
4021
|
direction: "vertical",
|
|
3994
4022
|
size: "middle",
|
|
3995
4023
|
style: { width: "100%" },
|
|
3996
4024
|
children: [
|
|
3997
|
-
s ? /* @__PURE__ */
|
|
4025
|
+
s ? /* @__PURE__ */ J(P, {
|
|
3998
4026
|
src: s,
|
|
3999
4027
|
alt: "",
|
|
4000
4028
|
style: {
|
|
@@ -4003,15 +4031,15 @@ function sa({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
4003
4031
|
objectFit: "contain"
|
|
4004
4032
|
}
|
|
4005
4033
|
}) : null,
|
|
4006
|
-
/* @__PURE__ */
|
|
4034
|
+
/* @__PURE__ */ Y(V, {
|
|
4007
4035
|
wrap: !0,
|
|
4008
|
-
children: [/* @__PURE__ */
|
|
4009
|
-
icon: /* @__PURE__ */
|
|
4036
|
+
children: [/* @__PURE__ */ J(w, {
|
|
4037
|
+
icon: /* @__PURE__ */ J(Te, {}),
|
|
4010
4038
|
disabled: n,
|
|
4011
4039
|
onClick: () => o.current?.click(),
|
|
4012
4040
|
children: "Choose image"
|
|
4013
|
-
}), c ? /* @__PURE__ */
|
|
4014
|
-
icon: /* @__PURE__ */
|
|
4041
|
+
}), c ? /* @__PURE__ */ J(w, {
|
|
4042
|
+
icon: /* @__PURE__ */ J(me, {}),
|
|
4015
4043
|
disabled: n,
|
|
4016
4044
|
onClick: () => {
|
|
4017
4045
|
t(null), o.current && (o.current.value = "");
|
|
@@ -4019,7 +4047,7 @@ function sa({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
4019
4047
|
children: "Clear"
|
|
4020
4048
|
}) : null]
|
|
4021
4049
|
}),
|
|
4022
|
-
/* @__PURE__ */
|
|
4050
|
+
/* @__PURE__ */ J("input", {
|
|
4023
4051
|
ref: o,
|
|
4024
4052
|
type: "file",
|
|
4025
4053
|
accept: i,
|
|
@@ -4035,15 +4063,15 @@ function sa({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "ima
|
|
|
4035
4063
|
]
|
|
4036
4064
|
});
|
|
4037
4065
|
}
|
|
4038
|
-
function
|
|
4039
|
-
return /* @__PURE__ */
|
|
4066
|
+
function fa({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s, previewWidth: c }) {
|
|
4067
|
+
return /* @__PURE__ */ J($, {
|
|
4040
4068
|
source: e,
|
|
4041
4069
|
name: t,
|
|
4042
4070
|
label: n,
|
|
4043
4071
|
required: r,
|
|
4044
4072
|
rules: i,
|
|
4045
4073
|
hideLabel: a,
|
|
4046
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */
|
|
4074
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(da, {
|
|
4047
4075
|
value: e,
|
|
4048
4076
|
onChange: t,
|
|
4049
4077
|
disabled: n,
|
|
@@ -4055,28 +4083,28 @@ function ca({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4055
4083
|
}
|
|
4056
4084
|
//#endregion
|
|
4057
4085
|
//#region src/crud/fields/FileField.tsx
|
|
4058
|
-
function
|
|
4059
|
-
let a = u(null), o =
|
|
4060
|
-
return /* @__PURE__ */
|
|
4086
|
+
function pa({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
4087
|
+
let a = u(null), o = la(e), s = typeof e == "string" && e.length > 0 ? e : void 0, c = r && ca(e);
|
|
4088
|
+
return /* @__PURE__ */ Y(V, {
|
|
4061
4089
|
direction: "vertical",
|
|
4062
4090
|
size: "middle",
|
|
4063
4091
|
style: { width: "100%" },
|
|
4064
4092
|
children: [
|
|
4065
|
-
o ? /* @__PURE__ */
|
|
4093
|
+
o ? /* @__PURE__ */ Y(V, { children: [/* @__PURE__ */ J(xe, {}), s ? /* @__PURE__ */ J(G.Link, {
|
|
4066
4094
|
href: s,
|
|
4067
4095
|
target: "_blank",
|
|
4068
4096
|
rel: "noopener noreferrer",
|
|
4069
4097
|
children: o
|
|
4070
|
-
}) : /* @__PURE__ */
|
|
4071
|
-
/* @__PURE__ */
|
|
4098
|
+
}) : /* @__PURE__ */ J(G.Text, { children: o })] }) : null,
|
|
4099
|
+
/* @__PURE__ */ Y(V, {
|
|
4072
4100
|
wrap: !0,
|
|
4073
|
-
children: [/* @__PURE__ */
|
|
4074
|
-
icon: /* @__PURE__ */
|
|
4101
|
+
children: [/* @__PURE__ */ J(w, {
|
|
4102
|
+
icon: /* @__PURE__ */ J(Te, {}),
|
|
4075
4103
|
disabled: n,
|
|
4076
4104
|
onClick: () => a.current?.click(),
|
|
4077
4105
|
children: "Choose file"
|
|
4078
|
-
}), c ? /* @__PURE__ */
|
|
4079
|
-
icon: /* @__PURE__ */
|
|
4106
|
+
}), c ? /* @__PURE__ */ J(w, {
|
|
4107
|
+
icon: /* @__PURE__ */ J(me, {}),
|
|
4080
4108
|
disabled: n,
|
|
4081
4109
|
onClick: () => {
|
|
4082
4110
|
t(null), a.current && (a.current.value = "");
|
|
@@ -4084,7 +4112,7 @@ function la({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
4084
4112
|
children: "Clear"
|
|
4085
4113
|
}) : null]
|
|
4086
4114
|
}),
|
|
4087
|
-
/* @__PURE__ */
|
|
4115
|
+
/* @__PURE__ */ J("input", {
|
|
4088
4116
|
ref: a,
|
|
4089
4117
|
type: "file",
|
|
4090
4118
|
accept: i,
|
|
@@ -4100,15 +4128,15 @@ function la({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
|
|
|
4100
4128
|
]
|
|
4101
4129
|
});
|
|
4102
4130
|
}
|
|
4103
|
-
function
|
|
4104
|
-
return /* @__PURE__ */
|
|
4131
|
+
function ma({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s }) {
|
|
4132
|
+
return /* @__PURE__ */ J($, {
|
|
4105
4133
|
source: e,
|
|
4106
4134
|
name: t,
|
|
4107
4135
|
label: n,
|
|
4108
4136
|
required: r,
|
|
4109
4137
|
rules: i,
|
|
4110
4138
|
hideLabel: a,
|
|
4111
|
-
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */
|
|
4139
|
+
children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ J(pa, {
|
|
4112
4140
|
value: e,
|
|
4113
4141
|
onChange: t,
|
|
4114
4142
|
disabled: n,
|
|
@@ -4119,7 +4147,7 @@ function ua({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
|
|
|
4119
4147
|
}
|
|
4120
4148
|
//#endregion
|
|
4121
4149
|
//#region src/crud/columns/TextColumn.tsx
|
|
4122
|
-
function
|
|
4150
|
+
function ha({ source: e, label: t, sortable: n = !0 }) {
|
|
4123
4151
|
return Jn(l(() => ({
|
|
4124
4152
|
key: e,
|
|
4125
4153
|
source: e,
|
|
@@ -4137,12 +4165,12 @@ function da({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4137
4165
|
n
|
|
4138
4166
|
])), null;
|
|
4139
4167
|
}
|
|
4140
|
-
function
|
|
4168
|
+
function ga(e, t, n) {
|
|
4141
4169
|
return typeof n == "function" ? n(e) : n ? br(e, n) : e[t];
|
|
4142
4170
|
}
|
|
4143
4171
|
//#endregion
|
|
4144
4172
|
//#region src/crud/columns/NumberColumn.tsx
|
|
4145
|
-
function
|
|
4173
|
+
function _a({ source: e, label: t, sortable: n = !0 }) {
|
|
4146
4174
|
return Jn(l(() => ({
|
|
4147
4175
|
key: e,
|
|
4148
4176
|
source: e,
|
|
@@ -4162,7 +4190,7 @@ function pa({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4162
4190
|
}
|
|
4163
4191
|
//#endregion
|
|
4164
4192
|
//#region src/crud/columns/BooleanColumn.tsx
|
|
4165
|
-
function
|
|
4193
|
+
function va({ source: e, label: t, sortable: n = !0 }) {
|
|
4166
4194
|
return Jn(l(() => ({
|
|
4167
4195
|
key: e,
|
|
4168
4196
|
source: e,
|
|
@@ -4183,7 +4211,7 @@ function ma({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4183
4211
|
}
|
|
4184
4212
|
//#endregion
|
|
4185
4213
|
//#region src/crud/columns/DateColumn.tsx
|
|
4186
|
-
function
|
|
4214
|
+
function ya({ source: e, label: t, sortable: n = !0 }) {
|
|
4187
4215
|
return Jn(l(() => ({
|
|
4188
4216
|
key: e,
|
|
4189
4217
|
source: e,
|
|
@@ -4204,16 +4232,16 @@ function ha({ source: e, label: t, sortable: n = !0 }) {
|
|
|
4204
4232
|
}
|
|
4205
4233
|
//#endregion
|
|
4206
4234
|
//#region src/crud/columns/ReferenceColumn.tsx
|
|
4207
|
-
function
|
|
4208
|
-
let { labelForValue: s } =
|
|
4209
|
-
if (typeof n == "function") return /* @__PURE__ */ q
|
|
4235
|
+
function ba({ record: e, source: t, display: n, reference: r, choices: i, optionLabel: a, optionValue: o }) {
|
|
4236
|
+
let { labelForValue: s } = na(i, r, a, o), c = e[t];
|
|
4237
|
+
if (typeof n == "function") return /* @__PURE__ */ J(q, { children: n(e) });
|
|
4210
4238
|
if (n && n !== t) {
|
|
4211
|
-
let r =
|
|
4212
|
-
return /* @__PURE__ */ q
|
|
4239
|
+
let r = ga(e, t, n);
|
|
4240
|
+
return /* @__PURE__ */ J(q, { children: r == null ? "—" : String(r) });
|
|
4213
4241
|
}
|
|
4214
|
-
return /* @__PURE__ */ q
|
|
4242
|
+
return /* @__PURE__ */ J(q, { children: s(c) });
|
|
4215
4243
|
}
|
|
4216
|
-
function
|
|
4244
|
+
function xa({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: s = !0 }) {
|
|
4217
4245
|
return Jn(l(() => ({
|
|
4218
4246
|
key: e,
|
|
4219
4247
|
source: e,
|
|
@@ -4224,7 +4252,7 @@ function _a({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4224
4252
|
dataIndex: e,
|
|
4225
4253
|
key: e,
|
|
4226
4254
|
sorter: s ? !0 : void 0,
|
|
4227
|
-
render: (s, c) => /* @__PURE__ */
|
|
4255
|
+
render: (s, c) => /* @__PURE__ */ J(ba, {
|
|
4228
4256
|
record: c,
|
|
4229
4257
|
source: e,
|
|
4230
4258
|
label: t,
|
|
@@ -4248,11 +4276,11 @@ function _a({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4248
4276
|
}
|
|
4249
4277
|
//#endregion
|
|
4250
4278
|
//#region src/crud/columns/ReferenceManyColumn.tsx
|
|
4251
|
-
function
|
|
4252
|
-
let { labelsForValues: o } =
|
|
4253
|
-
return /* @__PURE__ */ q
|
|
4279
|
+
function Sa({ record: e, source: t, reference: n, choices: r, optionLabel: i, optionValue: a }) {
|
|
4280
|
+
let { labelsForValues: o } = na(r, n, i, a), s = e[t];
|
|
4281
|
+
return /* @__PURE__ */ J(q, { children: o(Array.isArray(s) ? s : []) });
|
|
4254
4282
|
}
|
|
4255
|
-
function
|
|
4283
|
+
function Ca({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
|
|
4256
4284
|
return Jn(l(() => ({
|
|
4257
4285
|
key: e,
|
|
4258
4286
|
source: e,
|
|
@@ -4263,7 +4291,7 @@ function ya({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4263
4291
|
dataIndex: e,
|
|
4264
4292
|
key: e,
|
|
4265
4293
|
sorter: o ? !0 : void 0,
|
|
4266
|
-
render: (t, o) => /* @__PURE__ */
|
|
4294
|
+
render: (t, o) => /* @__PURE__ */ J(Sa, {
|
|
4267
4295
|
record: o,
|
|
4268
4296
|
source: e,
|
|
4269
4297
|
reference: n,
|
|
@@ -4284,7 +4312,7 @@ function ya({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4284
4312
|
}
|
|
4285
4313
|
//#endregion
|
|
4286
4314
|
//#region src/crud/columns/ImageColumn.tsx
|
|
4287
|
-
function
|
|
4315
|
+
function wa({ source: e, label: t, sortable: n = !1, width: r = 40, height: i = 40, objectFit: a = "cover", borderRadius: o = 4, alt: s = "" }) {
|
|
4288
4316
|
return Jn(l(() => ({
|
|
4289
4317
|
key: e,
|
|
4290
4318
|
source: e,
|
|
@@ -4295,7 +4323,7 @@ function ba({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4295
4323
|
dataIndex: e,
|
|
4296
4324
|
key: e,
|
|
4297
4325
|
sorter: n ? !0 : void 0,
|
|
4298
|
-
render: (e) => e == null || e === "" ? null : /* @__PURE__ */
|
|
4326
|
+
render: (e) => e == null || e === "" ? null : /* @__PURE__ */ J("img", {
|
|
4299
4327
|
src: String(e),
|
|
4300
4328
|
alt: s,
|
|
4301
4329
|
style: {
|
|
@@ -4319,7 +4347,7 @@ function ba({ source: e, label: t, sortable: n = !1, width: r = 40, height: i =
|
|
|
4319
4347
|
}
|
|
4320
4348
|
//#endregion
|
|
4321
4349
|
//#region src/crud/columns/CustomColumn.tsx
|
|
4322
|
-
function
|
|
4350
|
+
function Ta({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
4323
4351
|
return Jn(l(() => ({
|
|
4324
4352
|
key: e,
|
|
4325
4353
|
source: e,
|
|
@@ -4339,12 +4367,12 @@ function xa({ source: e, label: t, sortable: n = !1, render: r }) {
|
|
|
4339
4367
|
}
|
|
4340
4368
|
//#endregion
|
|
4341
4369
|
//#region src/crud/filters/NumberFilter.tsx
|
|
4342
|
-
function
|
|
4370
|
+
function Ea({ source: e, label: t }) {
|
|
4343
4371
|
return rr(l(() => ({
|
|
4344
4372
|
key: e,
|
|
4345
4373
|
source: e,
|
|
4346
4374
|
label: t,
|
|
4347
|
-
render: ({ value: n, onChange: r }) => /* @__PURE__ */
|
|
4375
|
+
render: ({ value: n, onChange: r }) => /* @__PURE__ */ J(I, {
|
|
4348
4376
|
placeholder: t ?? e,
|
|
4349
4377
|
value: n,
|
|
4350
4378
|
onChange: (e) => r(e ?? void 0),
|
|
@@ -4354,12 +4382,12 @@ function Sa({ source: e, label: t }) {
|
|
|
4354
4382
|
}
|
|
4355
4383
|
//#endregion
|
|
4356
4384
|
//#region src/crud/filters/BooleanFilter.tsx
|
|
4357
|
-
function
|
|
4385
|
+
function Da({ source: e, label: t }) {
|
|
4358
4386
|
return rr(l(() => ({
|
|
4359
4387
|
key: e,
|
|
4360
4388
|
source: e,
|
|
4361
4389
|
label: t,
|
|
4362
|
-
render: ({ value: n, onChange: r }) => /* @__PURE__ */
|
|
4390
|
+
render: ({ value: n, onChange: r }) => /* @__PURE__ */ J(B, {
|
|
4363
4391
|
allowClear: !0,
|
|
4364
4392
|
placeholder: t ?? e,
|
|
4365
4393
|
value: n,
|
|
@@ -4377,15 +4405,15 @@ function Ca({ source: e, label: t }) {
|
|
|
4377
4405
|
}
|
|
4378
4406
|
//#endregion
|
|
4379
4407
|
//#region src/crud/filters/DateFilter.tsx
|
|
4380
|
-
function
|
|
4408
|
+
function Oa({ source: e, label: t }) {
|
|
4381
4409
|
return rr(l(() => ({
|
|
4382
4410
|
key: e,
|
|
4383
4411
|
source: e,
|
|
4384
4412
|
label: t,
|
|
4385
|
-
render: ({ value: n, onChange: r }) => /* @__PURE__ */
|
|
4413
|
+
render: ({ value: n, onChange: r }) => /* @__PURE__ */ J(O, {
|
|
4386
4414
|
allowClear: !0,
|
|
4387
4415
|
placeholder: t ?? e,
|
|
4388
|
-
value: n ?
|
|
4416
|
+
value: n ? Pe(String(n)) : null,
|
|
4389
4417
|
onChange: (e) => r(e ? e.format("YYYY-MM-DD") : void 0),
|
|
4390
4418
|
style: { minWidth: 160 }
|
|
4391
4419
|
})
|
|
@@ -4393,12 +4421,12 @@ function wa({ source: e, label: t }) {
|
|
|
4393
4421
|
}
|
|
4394
4422
|
//#endregion
|
|
4395
4423
|
//#region src/crud/filters/SelectFilter.tsx
|
|
4396
|
-
function
|
|
4424
|
+
function ka({ source: e, label: t, choices: n, multiple: r }) {
|
|
4397
4425
|
return rr(l(() => ({
|
|
4398
4426
|
key: e,
|
|
4399
4427
|
source: e,
|
|
4400
4428
|
label: t,
|
|
4401
|
-
render: ({ value: i, onChange: a }) => /* @__PURE__ */
|
|
4429
|
+
render: ({ value: i, onChange: a }) => /* @__PURE__ */ J(B, {
|
|
4402
4430
|
allowClear: !0,
|
|
4403
4431
|
mode: r ? "multiple" : void 0,
|
|
4404
4432
|
placeholder: t ?? e,
|
|
@@ -4416,29 +4444,30 @@ function Ta({ source: e, label: t, choices: n, multiple: r }) {
|
|
|
4416
4444
|
}
|
|
4417
4445
|
//#endregion
|
|
4418
4446
|
//#region src/crud/filters/ReferenceFilter.tsx
|
|
4419
|
-
function
|
|
4420
|
-
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b } =
|
|
4447
|
+
function Aa({ 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 }) {
|
|
4448
|
+
let [h, g] = d(), [_, v] = d(!1), { options: y, loading: b, selectedLoading: x } = na(r, n, i, a, s ? h : void 0, {
|
|
4421
4449
|
lazy: c,
|
|
4422
4450
|
active: _ || !!h,
|
|
4423
4451
|
selectedValues: p,
|
|
4424
4452
|
fetchSelected: l
|
|
4425
|
-
});
|
|
4426
|
-
return /* @__PURE__ */
|
|
4427
|
-
...
|
|
4453
|
+
}), S = Yi(b, x), C = p;
|
|
4454
|
+
return /* @__PURE__ */ J(B, {
|
|
4455
|
+
...qi({
|
|
4428
4456
|
popupMatchSelectWidth: u,
|
|
4429
4457
|
popupMinWidth: f
|
|
4430
4458
|
}),
|
|
4431
4459
|
allowClear: !0,
|
|
4432
4460
|
mode: o ? "multiple" : void 0,
|
|
4433
4461
|
placeholder: t ?? e,
|
|
4434
|
-
value:
|
|
4462
|
+
value: Xi(x, C, o ? [] : void 0),
|
|
4435
4463
|
onChange: m,
|
|
4436
4464
|
options: y.map((e) => ({
|
|
4437
4465
|
label: e.label,
|
|
4438
4466
|
value: e.value
|
|
4439
4467
|
})),
|
|
4440
|
-
loading:
|
|
4441
|
-
|
|
4468
|
+
loading: S.loading,
|
|
4469
|
+
disabled: S.disabled,
|
|
4470
|
+
notFoundContent: Ji(S.loading),
|
|
4442
4471
|
showSearch: s,
|
|
4443
4472
|
filterOption: s ? !1 : void 0,
|
|
4444
4473
|
onSearch: s ? g : void 0,
|
|
@@ -4449,12 +4478,12 @@ function Ea({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
|
|
|
4449
4478
|
style: { minWidth: 180 }
|
|
4450
4479
|
});
|
|
4451
4480
|
}
|
|
4452
|
-
function
|
|
4481
|
+
function ja({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", multiple: o, search: s, lazy: c = !0, fetchSelected: u = !0, popupMatchSelectWidth: d, popupMinWidth: f }) {
|
|
4453
4482
|
return rr(l(() => ({
|
|
4454
4483
|
key: e,
|
|
4455
4484
|
source: e,
|
|
4456
4485
|
label: t,
|
|
4457
|
-
render: ({ value: l, onChange: p }) => /* @__PURE__ */
|
|
4486
|
+
render: ({ value: l, onChange: p }) => /* @__PURE__ */ J(Aa, {
|
|
4458
4487
|
source: e,
|
|
4459
4488
|
label: t,
|
|
4460
4489
|
reference: n,
|
|
@@ -4485,11 +4514,11 @@ function Da({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
|
|
|
4485
4514
|
f
|
|
4486
4515
|
])), null;
|
|
4487
4516
|
}
|
|
4488
|
-
function
|
|
4489
|
-
return /* @__PURE__ */
|
|
4517
|
+
function Ma(e) {
|
|
4518
|
+
return /* @__PURE__ */ J(ja, {
|
|
4490
4519
|
...e,
|
|
4491
4520
|
multiple: !0
|
|
4492
4521
|
});
|
|
4493
4522
|
}
|
|
4494
4523
|
//#endregion
|
|
4495
|
-
export { Kt as AdminApp, Pt as AdminLayout, Bn as AppHub, Vn as AppLauncherButton,
|
|
4524
|
+
export { Kt as AdminApp, Pt as AdminLayout, Bn as AppHub, Vn as AppLauncherButton, Xe as AppThemeProvider, In as AuthAlternateLink, Ln as AuthPageLayout, ct as AuthProvider, va as BooleanColumn, Ci as BooleanField, Da as BooleanFilter, Ta as CustomColumn, Xn as DEFAULT_TEXT_FILTER_DEBOUNCE_MS, Jt as DataProvider, ya as DateColumn, ki as DateField, Oa as DateFilter, Ai as DateTimeField, $e as DensitySwitch, en as EXPECTED_VALIDATION_BODY_HINT, $ as FieldWrapper, ma as FileField, ii as FilterBar, _i as FormStep, yi as FormSteps, mi as FormTab, gi as FormTabs, Ft as Guard, Lt as GuestOnly, wa as ImageColumn, fa as ImageField, li as InlineFormSet, ui as InlineFormSetStacked, Rn as LoginPage, _a as NumberColumn, Si as NumberField, Ea as NumberFilter, Ii as PasswordField, pt as PermissionsProvider, zn as PlaceholderPage, It as Protected, xa as ReferenceColumn, aa as ReferenceField, ja as ReferenceFilter, Ca as ReferenceManyColumn, sa as ReferenceManyField, Ma as ReferenceManyFilter, Rt as RequirePermission, ai as ResourceForm, Ur as ResourceFormModal, ni as ResourceList, Pi as SelectField, ka as SelectFilter, xi as TextAreaField, ha as TextColumn, bi as TextField, $n as TextFilter, tt as ThemeSwitch, nt as ThemeToolbar, Ni as TimeField, kn as applyInMemoryListParams, Q as asStringMessages, Sr as buildFormPayload, Cr as buildInlineRowsPayload, jr as buildResourceFormSubmitBody, Qt as combineResourceHandlers, Gt as createAdminRouter, An as createMemoryResourceHandlers, ht as createPermissionsChecker, jn as createRestResourceHandlers, dt as createSessionStorageAuthAdapter, Ut as deriveAuthPaths, sn as describeNonStandardValidationBody, bt as filterFlatNavItems, wt as filterNavByPermission, vt as filterNavItems, Dn as filterRows, hn as finalizeFormErrors, yt as flattenNavLeaves, mn as flattenNestedArrayErrors, un as getErrorBody, br as getFormValue, _t as getNavItemLabel, zt as getRouteAccess, wn as getRowById, wr as hasUploadValues, $t as isAbortError, oi as nestedFieldPath, vn as parseDjangoDRFFormErrors, yn as parseDotNetFormErrors, bn as parseNodeFormErrors, Bt as partitionAdminRoutes, Ar as prepareFormSubmitBody, fn as resolveErrorBody, xr as setFormValue, Nn as toDjangoRestOrdering, kr as toFormData, Fn as toJsonApiSort, Pn as toODataOrderBy, zr as useAbortableEffect, lt as useAuth, gt as useCan, na as useChoices, Yt as useDataProvider, Xr as useListQueryState, mt as usePermissions, pr as useRegisterPayloadField, mr as useRegisterSectionField, Qr as useResourceListContext, Ze as useThemeMode };
|