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