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