@mxmweb/zui-components 1.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 +185 -0
- package/assets/style.css +1 -0
- package/index.js +4190 -0
- package/lib_enter.d.ts +107 -0
- package/package.json +28 -0
package/index.js
ADDED
|
@@ -0,0 +1,4190 @@
|
|
|
1
|
+
import { jsxs as H, jsx as n, Fragment as Qe } from "react/jsx-runtime";
|
|
2
|
+
import oe, { useState as ne, useMemo as he, useEffect as fe, useRef as me, useCallback as te } from "react";
|
|
3
|
+
import Z, { createGlobalStyle as lr } from "styled-components";
|
|
4
|
+
import { deepMergeTheme as er, defaultTheme as ue } from "@mxmweb/zui-theme";
|
|
5
|
+
import qe from "animejs/lib/anime.es.js";
|
|
6
|
+
import { CircleHelp as rr, Trash as ir, File as pe, AlertCircle as Re, Upload as dr, ChevronDown as cr, ChevronRight as ur } from "lucide-react";
|
|
7
|
+
import { Form as E, Input as se, Select as $e, InputNumber as ve, Slider as Le, Switch as Ie, DatePicker as we, Radio as Oe, Checkbox as je, TimePicker as Be, Tooltip as Te, Button as Ye, Tag as pr } from "antd";
|
|
8
|
+
import { Button as be, DropdownMenu as hr, SharedPagination as fr } from "@mxmweb/zui-elements";
|
|
9
|
+
const mr = Z.div`
|
|
10
|
+
background-color: #ffffff;
|
|
11
|
+
box-shadow: 0 2px 12px rgba(0,0,0,0.08);
|
|
12
|
+
border-radius: ${(e) => {
|
|
13
|
+
var a, t;
|
|
14
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.space) == null ? void 0 : t.radius) || "8px";
|
|
15
|
+
}};
|
|
16
|
+
height: 90vh;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
position: relative;
|
|
19
|
+
`, br = () => {
|
|
20
|
+
fe(() => {
|
|
21
|
+
const e = "goggle-nav-icon-styles";
|
|
22
|
+
if (!document.getElementById(e)) {
|
|
23
|
+
const a = document.createElement("style");
|
|
24
|
+
a.id = e, a.innerHTML = `
|
|
25
|
+
:root { --color-gray: #64748b; --color-blue: #3b82f6; }
|
|
26
|
+
.g-nav-item { position: relative; transition: all .3s ease; border-radius: 8px; }
|
|
27
|
+
.g-nav-icon img { transition: all .3s ease; filter: grayscale(100%) brightness(100%) opacity(.7); }
|
|
28
|
+
.g-nav-text { color: var(--color-gray); transition: color .3s ease; }
|
|
29
|
+
.g-nav-item:not(.active):hover .g-nav-icon img { filter: sepia(100%) saturate(1000%) hue-rotate(200deg) brightness(80%) opacity(1); transform: scale(1.05); }
|
|
30
|
+
.g-nav-item:not(.active):hover .g-nav-text { color: var(--color-blue); font-weight: 500; }
|
|
31
|
+
.g-nav-item.active { background-color: rgba(219,234,254,0.6); }
|
|
32
|
+
.g-nav-item.active .g-nav-icon img { filter: sepia(100%) saturate(1000%) hue-rotate(200deg) brightness(100%) opacity(1); transform: scale(1.05); }
|
|
33
|
+
.g-nav-item.active .g-nav-text { color: var(--color-blue); opacity: .8; font-weight: 500; }
|
|
34
|
+
.g-nav-item.active::before { content: ''; position: absolute; left: 0; top: 30%; bottom: 30%; width: 3px; background: var(--color-blue); border-radius: 0 2px 2px 0; }
|
|
35
|
+
`, document.head.appendChild(a);
|
|
36
|
+
}
|
|
37
|
+
}, []);
|
|
38
|
+
}, xa = ({
|
|
39
|
+
items: e,
|
|
40
|
+
activePath: a,
|
|
41
|
+
defaultOpen: t = !0,
|
|
42
|
+
open: i,
|
|
43
|
+
onOpenChange: u,
|
|
44
|
+
onItemClick: h,
|
|
45
|
+
logo: v,
|
|
46
|
+
className: d,
|
|
47
|
+
style: p,
|
|
48
|
+
styles: M
|
|
49
|
+
}) => {
|
|
50
|
+
const C = er(
|
|
51
|
+
{ theme: ue, mode: (M == null ? void 0 : M.mode) ?? "light" },
|
|
52
|
+
M
|
|
53
|
+
);
|
|
54
|
+
br();
|
|
55
|
+
const [_, I] = ne(t), o = typeof i == "boolean" ? i : _, F = (m) => {
|
|
56
|
+
typeof i == "boolean" || I(m), u == null || u(m);
|
|
57
|
+
}, [U, Q] = ne(!1), X = (m) => m ? typeof m == "string" ? /* @__PURE__ */ n("img", { src: m, className: "w-6 h-6 transition-all duration-200", alt: "nav" }) : m : null, r = he(() => ({
|
|
58
|
+
width: o ? "60px" : "20px",
|
|
59
|
+
minWidth: o ? "60px" : "20px",
|
|
60
|
+
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
61
|
+
}), [o]);
|
|
62
|
+
return /* @__PURE__ */ H(mr, { $theme: C.theme || ue, className: `relative ${d || ""}`, style: { ...r, ...p }, children: [
|
|
63
|
+
/* @__PURE__ */ n(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
onMouseEnter: () => Q(!0),
|
|
67
|
+
onMouseLeave: () => Q(!1),
|
|
68
|
+
className: "absolute top-1/2 -translate-y-1/2 right-1 w-6 h-6 cursor-pointer z-20 transition-all duration-300",
|
|
69
|
+
onClick: () => F(!o),
|
|
70
|
+
"aria-label": o ? "收起" : "展开",
|
|
71
|
+
role: "button",
|
|
72
|
+
children: /* @__PURE__ */ n("div", { className: "group flex items-center justify-center w-6 h-6 rounded-full transition-all duration-200", children: /* @__PURE__ */ H("div", { className: "relative w-4 h-4 flex items-center justify-center", children: [
|
|
73
|
+
/* @__PURE__ */ n("div", { className: `absolute w-[2px] h-3 bg-gray-400 rounded-full transition-all duration-300 ${U ? "opacity-0 scale-0" : "opacity-100 scale-100"}` }),
|
|
74
|
+
/* @__PURE__ */ n(
|
|
75
|
+
"svg",
|
|
76
|
+
{
|
|
77
|
+
viewBox: "0 0 24 24",
|
|
78
|
+
fill: "none",
|
|
79
|
+
className: `absolute w-4 h-4 stroke-gray-400 transition-all duration-300 ${U ? "opacity-100 scale-100" : "opacity-0 scale-0"} ${o ? "rotate-0" : "rotate-180"}`,
|
|
80
|
+
strokeWidth: "2",
|
|
81
|
+
strokeLinecap: "round",
|
|
82
|
+
strokeLinejoin: "round",
|
|
83
|
+
children: /* @__PURE__ */ n("polyline", { points: "15 18 9 12 15 6" })
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] }) })
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ H(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
className: "h-full py-6 px-[2px] flex flex-col items-center",
|
|
93
|
+
style: {
|
|
94
|
+
opacity: o ? 1 : 0,
|
|
95
|
+
transform: o ? "translateX(0)" : "translateX(-10px)",
|
|
96
|
+
transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
97
|
+
},
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ n("div", { className: "mb-6 transition-transform duration-300 hover:scale-105", children: typeof v == "string" ? /* @__PURE__ */ n("img", { src: v, className: "w-7 h-7", alt: "logo" }) : v || /* @__PURE__ */ n("div", { className: "w-7 h-7 rounded bg-gray-100 flex items-center justify-center text-xs text-gray-500", children: "G" }) }),
|
|
100
|
+
/* @__PURE__ */ n("div", { className: "w-full gap-y-[2px] mb-10 flex-1 overflow-x-hidden overflow-y-auto scrollbar-none flex flex-col items-center", children: e.map((m) => {
|
|
101
|
+
const V = !!(a && m.path && a.startsWith(m.path)), q = V && m.activeIcon ? m.activeIcon : m.icon;
|
|
102
|
+
return /* @__PURE__ */ H(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
onClick: () => !m.disabled && (h == null ? void 0 : h(m)),
|
|
106
|
+
className: `g-nav-item group relative w-full flex flex-col items-center justify-center py-3 px-2 rounded-lg cursor-pointer transition-all duration-200 ${V ? "active bg-blue-50" : "text-gray-500 hover:bg-gray-50"}`,
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ H("div", { className: "relative g-nav-icon transition-transform duration-200 group-hover:scale-105", children: [
|
|
109
|
+
X(q),
|
|
110
|
+
m.badge && m.badge > 0 && /* @__PURE__ */ n("span", { className: "absolute -top-1 -right-1 min-w-[16px] h-4 px-1 rounded-full bg-red-500 text-white text-[10px] leading-4 text-center", children: m.badge > 99 ? "99+" : m.badge })
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ n("div", { className: "mt-1 text-xs text-center g-nav-text transition-colors duration-200", children: m.name })
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
m.key
|
|
116
|
+
);
|
|
117
|
+
}) })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] });
|
|
122
|
+
}, gr = Z.div.withConfig({
|
|
123
|
+
shouldForwardProp: (e) => !["itemWidth", "itemGap"].includes(e)
|
|
124
|
+
})`
|
|
125
|
+
position: relative;
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: flex-end;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
padding: 12px 20px;
|
|
130
|
+
background: rgba(255, 255, 255, 0.18);
|
|
131
|
+
backdrop-filter: saturate(180%) blur(20px);
|
|
132
|
+
-webkit-backdrop-filter: saturate(180%) blur(20px);
|
|
133
|
+
border: 1px solid rgba(255, 255, 255, 0.28);
|
|
134
|
+
border-radius: 14px;
|
|
135
|
+
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25), inset 0 0.5px 0 rgba(255, 255, 255, 0.4);
|
|
136
|
+
width: fit-content;
|
|
137
|
+
margin: 0 auto;
|
|
138
|
+
min-width: ${(e) => e.itemWidth * 2}px;
|
|
139
|
+
`, xr = Z.div.withConfig({
|
|
140
|
+
shouldForwardProp: (e) => !["itemWidth", "itemHeight", "itemGap", "isHovered", "magnification"].includes(e)
|
|
141
|
+
})`
|
|
142
|
+
position: relative;
|
|
143
|
+
width: ${(e) => e.itemWidth}px;
|
|
144
|
+
height: ${(e) => e.itemHeight}px;
|
|
145
|
+
margin: 0 ${(e) => e.itemGap / 2}px;
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
148
|
+
transform: ${(e) => e.isHovered ? `scale(${e.magnification})` : "scale(1)"};
|
|
149
|
+
transform-origin: center bottom;
|
|
150
|
+
z-index: ${(e) => e.isHovered ? 10 : 1};
|
|
151
|
+
`, yr = Z.img.withConfig({
|
|
152
|
+
shouldForwardProp: (e) => !["isActive"].includes(e)
|
|
153
|
+
})`
|
|
154
|
+
width: 80%;
|
|
155
|
+
height: 80%;
|
|
156
|
+
object-fit: contain;
|
|
157
|
+
border-radius: 8px;
|
|
158
|
+
transition: all 0.15s ease;
|
|
159
|
+
filter: ${(e) => e.isActive ? "none" : "grayscale(0.3) brightness(0.8)"};
|
|
160
|
+
|
|
161
|
+
&:hover {
|
|
162
|
+
filter: none;
|
|
163
|
+
}
|
|
164
|
+
`, $r = Z.div.withConfig({
|
|
165
|
+
shouldForwardProp: (e) => !["isActive"].includes(e)
|
|
166
|
+
})`
|
|
167
|
+
position: absolute;
|
|
168
|
+
bottom: -4px;
|
|
169
|
+
left: 40%;
|
|
170
|
+
transform: translateX(-50%);
|
|
171
|
+
width: 6px;
|
|
172
|
+
height: 6px;
|
|
173
|
+
background: #007AFF;
|
|
174
|
+
border-radius: 50%;
|
|
175
|
+
opacity: ${(e) => e.isActive ? 1 : 0};
|
|
176
|
+
transition: opacity 0.2s ease;
|
|
177
|
+
`, vr = Z.div.withConfig({
|
|
178
|
+
shouldForwardProp: (e) => !["visible"].includes(e)
|
|
179
|
+
})`
|
|
180
|
+
position: absolute;
|
|
181
|
+
bottom: 100%;
|
|
182
|
+
left: 40%;
|
|
183
|
+
transform: translateX(-50%) translateY(-8px);
|
|
184
|
+
background: rgba(0, 0, 0, 0.8);
|
|
185
|
+
color: white;
|
|
186
|
+
padding: 4px 8px;
|
|
187
|
+
border-radius: 4px;
|
|
188
|
+
font-size: 10px;
|
|
189
|
+
white-space: nowrap;
|
|
190
|
+
opacity: ${(e) => e.visible ? 1 : 0};
|
|
191
|
+
visibility: ${(e) => e.visible ? "visible" : "hidden"};
|
|
192
|
+
transition: all 0.2s ease;
|
|
193
|
+
z-index: 1000;
|
|
194
|
+
|
|
195
|
+
&::after {
|
|
196
|
+
content: '';
|
|
197
|
+
position: absolute;
|
|
198
|
+
top: 100%;
|
|
199
|
+
left: 50%;
|
|
200
|
+
transform: translateX(-50%);
|
|
201
|
+
border: 4px solid transparent;
|
|
202
|
+
border-top-color: rgba(0, 0, 0, 0.8);
|
|
203
|
+
}
|
|
204
|
+
`, ya = ({
|
|
205
|
+
items: e,
|
|
206
|
+
itemWidth: a = 48,
|
|
207
|
+
itemHeight: t = 48,
|
|
208
|
+
magnification: i = 1.2,
|
|
209
|
+
itemGap: u = 13,
|
|
210
|
+
activeMode: h = "single",
|
|
211
|
+
defaultActiveId: v,
|
|
212
|
+
defaultActiveIds: d = [],
|
|
213
|
+
onItemClick: p,
|
|
214
|
+
onActiveChange: M,
|
|
215
|
+
onActiveChangeMultiple: C,
|
|
216
|
+
className: _
|
|
217
|
+
}) => {
|
|
218
|
+
const [I, o] = ne(null), [F, U] = ne(null), Q = () => h === "multiple" ? d || [] : v || (e.length > 0 ? e[0].id : null), [X, r] = ne(
|
|
219
|
+
h === "single" ? Q() : null
|
|
220
|
+
), [m, V] = ne(
|
|
221
|
+
h === "multiple" ? Q() : []
|
|
222
|
+
), q = me(null), R = me([]), B = (A) => {
|
|
223
|
+
o(A), U(A);
|
|
224
|
+
const k = R.current[A];
|
|
225
|
+
k && qe({
|
|
226
|
+
targets: k,
|
|
227
|
+
scale: i,
|
|
228
|
+
duration: 200,
|
|
229
|
+
easing: "easeOutCubic"
|
|
230
|
+
});
|
|
231
|
+
}, J = (A) => {
|
|
232
|
+
o(null), U(null);
|
|
233
|
+
const k = R.current[A];
|
|
234
|
+
k && qe({
|
|
235
|
+
targets: k,
|
|
236
|
+
scale: 1,
|
|
237
|
+
duration: 200,
|
|
238
|
+
easing: "easeOutCubic"
|
|
239
|
+
});
|
|
240
|
+
}, G = (A, k) => {
|
|
241
|
+
if (h === "single")
|
|
242
|
+
X !== A.id && (r(A.id), M && M(A.id, A));
|
|
243
|
+
else {
|
|
244
|
+
const K = m.includes(A.id) ? m.filter((ee) => ee !== A.id) : [...m, A.id];
|
|
245
|
+
if (V(K), C) {
|
|
246
|
+
const ee = e.filter((l) => K.includes(l.id));
|
|
247
|
+
C(K, ee);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
p && p(A, k), A.onClick && A.onClick();
|
|
251
|
+
};
|
|
252
|
+
return fe(() => {
|
|
253
|
+
R.current = R.current.slice(0, e.length);
|
|
254
|
+
}, [e.length]), /* @__PURE__ */ n(
|
|
255
|
+
gr,
|
|
256
|
+
{
|
|
257
|
+
ref: q,
|
|
258
|
+
itemWidth: a,
|
|
259
|
+
itemGap: u,
|
|
260
|
+
className: _,
|
|
261
|
+
children: e.map((A, k) => /* @__PURE__ */ H(
|
|
262
|
+
xr,
|
|
263
|
+
{
|
|
264
|
+
ref: (K) => R.current[k] = K,
|
|
265
|
+
itemWidth: a,
|
|
266
|
+
itemHeight: t,
|
|
267
|
+
itemGap: u,
|
|
268
|
+
isHovered: I === k,
|
|
269
|
+
magnification: i,
|
|
270
|
+
onMouseEnter: () => B(k),
|
|
271
|
+
onMouseLeave: () => J(k),
|
|
272
|
+
onClick: () => G(A, k),
|
|
273
|
+
children: [
|
|
274
|
+
/* @__PURE__ */ n(
|
|
275
|
+
yr,
|
|
276
|
+
{
|
|
277
|
+
src: A.icon,
|
|
278
|
+
alt: A.label,
|
|
279
|
+
isActive: h === "single" ? X === A.id : m.includes(A.id)
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
/* @__PURE__ */ n($r, { isActive: h === "single" ? X === A.id : m.includes(A.id) }),
|
|
283
|
+
/* @__PURE__ */ n(vr, { visible: F === k, children: A.label })
|
|
284
|
+
]
|
|
285
|
+
},
|
|
286
|
+
A.id
|
|
287
|
+
))
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
}, ar = (e) => {
|
|
291
|
+
if (e === 0) return "0 B";
|
|
292
|
+
const a = 1024, t = ["B", "KB", "MB", "GB"], i = Math.floor(Math.log(e) / Math.log(a));
|
|
293
|
+
return parseFloat((e / Math.pow(a, i)).toFixed(2)) + " " + t[i];
|
|
294
|
+
}, He = () => Math.random().toString(36).substr(2, 9), wr = (e, a) => {
|
|
295
|
+
const t = { ...e.formData }, i = ["name", "filename", "title", "displayName", "fileName"], u = ["size", "fileSize", "file_size"], h = ["type", "fileType", "mimeType", "contentType"];
|
|
296
|
+
return a.forEach((v) => {
|
|
297
|
+
const d = v.name || v.field;
|
|
298
|
+
d && (i.includes(d.toLowerCase()) && !t[d] && (t[d] = e.name), u.includes(d.toLowerCase()) && !t[d] && (t[d] = ar(e.size)), h.includes(d.toLowerCase()) && !t[d] && (t[d] = e.type));
|
|
299
|
+
}), t;
|
|
300
|
+
}, kr = async (e, a, t = {}, i = {}, u) => new Promise((h, v) => {
|
|
301
|
+
var _;
|
|
302
|
+
const d = new XMLHttpRequest(), p = new URL(a);
|
|
303
|
+
if (Object.entries(i).forEach(([I, o]) => {
|
|
304
|
+
p.searchParams.append(I, o);
|
|
305
|
+
}), (_ = t["Content-Type"]) == null ? void 0 : _.includes("application/json")) {
|
|
306
|
+
const I = new FileReader();
|
|
307
|
+
I.onload = () => {
|
|
308
|
+
const o = I.result, F = JSON.stringify({
|
|
309
|
+
file: o.split(",")[1]
|
|
310
|
+
// 移除 data:application/octet-stream;base64, 前缀
|
|
311
|
+
});
|
|
312
|
+
C(F);
|
|
313
|
+
}, I.onerror = () => v(new Error("文件读取失败")), I.readAsDataURL(e);
|
|
314
|
+
} else {
|
|
315
|
+
const I = new FormData();
|
|
316
|
+
I.append("tableFile", e), C(I);
|
|
317
|
+
}
|
|
318
|
+
function C(I) {
|
|
319
|
+
d.upload.addEventListener("progress", (o) => {
|
|
320
|
+
if (o.lengthComputable) {
|
|
321
|
+
const F = Math.round(o.loaded / o.total * 100);
|
|
322
|
+
u == null || u(F);
|
|
323
|
+
}
|
|
324
|
+
}), d.addEventListener("load", () => {
|
|
325
|
+
if (d.status >= 200 && d.status < 300)
|
|
326
|
+
try {
|
|
327
|
+
const o = JSON.parse(d.responseText);
|
|
328
|
+
o.data ? h(o.data) : h(d.responseText);
|
|
329
|
+
} catch {
|
|
330
|
+
h(d.responseText);
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
console.log("====xhr.responseText", d.responseText);
|
|
334
|
+
let o = "";
|
|
335
|
+
try {
|
|
336
|
+
const U = JSON.parse(d.responseText);
|
|
337
|
+
U.errorMsg ? o = U.errorMsg : U.message ? o = U.message : U.error ? o = U.error : o = `上传失败: ${d.status} ${d.statusText}`;
|
|
338
|
+
} catch {
|
|
339
|
+
o = `上传失败: ${d.status} ${d.statusText}`;
|
|
340
|
+
}
|
|
341
|
+
const F = new Error(o);
|
|
342
|
+
F.response = {
|
|
343
|
+
status: d.status,
|
|
344
|
+
statusText: d.statusText,
|
|
345
|
+
data: d.responseText ? JSON.parse(d.responseText) : null,
|
|
346
|
+
headers: d.getAllResponseHeaders()
|
|
347
|
+
}, v(F);
|
|
348
|
+
}
|
|
349
|
+
}), d.addEventListener("error", () => {
|
|
350
|
+
const o = new Error("网络错误,上传失败");
|
|
351
|
+
o.request = d, o.type = "network", v(o);
|
|
352
|
+
}), d.addEventListener("timeout", () => {
|
|
353
|
+
const o = new Error("请求超时,上传失败");
|
|
354
|
+
o.request = d, o.type = "timeout", v(o);
|
|
355
|
+
}), d.open("POST", p.toString()), Object.entries(t).forEach(([o, F]) => {
|
|
356
|
+
d.setRequestHeader(o, F);
|
|
357
|
+
}), d.send(I);
|
|
358
|
+
}
|
|
359
|
+
}), Sr = Z.div`
|
|
360
|
+
border: 2px dashed ${(e) => {
|
|
361
|
+
var a, t, i, u;
|
|
362
|
+
return e.$isDragOver ? ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff" : ((u = (i = e.$theme) == null ? void 0 : i.colors) == null ? void 0 : u.border) || "#dee2e6";
|
|
363
|
+
}};
|
|
364
|
+
border-radius: 4px;
|
|
365
|
+
background: ${(e) => {
|
|
366
|
+
var a, t, i, u;
|
|
367
|
+
return e.$isDragOver ? `${((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff"}10` : ((u = (i = e.$theme) == null ? void 0 : i.colors) == null ? void 0 : u.background) || "#f8f9fa";
|
|
368
|
+
}};
|
|
369
|
+
padding: 24px;
|
|
370
|
+
text-align: center;
|
|
371
|
+
transition: all 0.2s ease;
|
|
372
|
+
cursor: pointer;
|
|
373
|
+
min-height: 200px;
|
|
374
|
+
display: flex;
|
|
375
|
+
flex-direction: column;
|
|
376
|
+
align-items: center;
|
|
377
|
+
justify-content: center;
|
|
378
|
+
gap: 16px;
|
|
379
|
+
|
|
380
|
+
&:hover {
|
|
381
|
+
border-color: ${(e) => {
|
|
382
|
+
var a, t;
|
|
383
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff";
|
|
384
|
+
}};
|
|
385
|
+
background: ${(e) => {
|
|
386
|
+
var a, t;
|
|
387
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.background) || "#f8f9fa";
|
|
388
|
+
}};
|
|
389
|
+
}
|
|
390
|
+
`, Nr = Z.div`
|
|
391
|
+
color: ${(e) => {
|
|
392
|
+
var a, t;
|
|
393
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff";
|
|
394
|
+
}};
|
|
395
|
+
font-size: 48px;
|
|
396
|
+
margin-bottom: 8px;
|
|
397
|
+
`, Mr = Z.div`
|
|
398
|
+
color: ${(e) => {
|
|
399
|
+
var a, t;
|
|
400
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.text) || "#343a40";
|
|
401
|
+
}};
|
|
402
|
+
font-size: 16px;
|
|
403
|
+
font-weight: 500;
|
|
404
|
+
margin-bottom: 4px;
|
|
405
|
+
`, Ue = Z.div`
|
|
406
|
+
color: ${(e) => {
|
|
407
|
+
var a, t, i, u;
|
|
408
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.textSecondary) || ((u = (i = e.$theme) == null ? void 0 : i.colors) == null ? void 0 : u.disabledText) || "#6b7280";
|
|
409
|
+
}};
|
|
410
|
+
font-size: 14px;
|
|
411
|
+
`, Tr = Z.input`
|
|
412
|
+
display: none;
|
|
413
|
+
`, Dr = Z.div`
|
|
414
|
+
|
|
415
|
+
width: 100%;
|
|
416
|
+
max-width: 600px;
|
|
417
|
+
`, Cr = Z.div.attrs({
|
|
418
|
+
className: "upload-item"
|
|
419
|
+
})`
|
|
420
|
+
display: flex;
|
|
421
|
+
align-items: center;
|
|
422
|
+
padding: 8px 12px;
|
|
423
|
+
border-bottom: 1px solid ${(e) => {
|
|
424
|
+
var a, t;
|
|
425
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.border) || "#dee2e6";
|
|
426
|
+
}};
|
|
427
|
+
border: ${(e) => {
|
|
428
|
+
var a, t, i, u;
|
|
429
|
+
return e.$hasForm ? "none" : e.$status === "error" ? `1px solid ${((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.error) || "#FF0000"}` : `1px solid ${((u = (i = e.$theme) == null ? void 0 : i.colors) == null ? void 0 : u.border) || "#dee2e6"}`;
|
|
430
|
+
}};
|
|
431
|
+
border-radius: 4px;
|
|
432
|
+
background: ${(e) => {
|
|
433
|
+
var a, t;
|
|
434
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.background) || "#ffffff";
|
|
435
|
+
}};
|
|
436
|
+
transition: all 0.2s ease;
|
|
437
|
+
|
|
438
|
+
&:hover {
|
|
439
|
+
border-color: ${(e) => {
|
|
440
|
+
var a, t, i, u;
|
|
441
|
+
return e.$hasForm ? "transparent" : e.$status === "error" ? ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.error) || "#FF0000" : ((u = (i = e.$theme) == null ? void 0 : i.colors) == null ? void 0 : u.primary) || "#007bff";
|
|
442
|
+
}};
|
|
443
|
+
}
|
|
444
|
+
`, Fr = Z.div`
|
|
445
|
+
color: ${(e) => {
|
|
446
|
+
var a, t;
|
|
447
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff";
|
|
448
|
+
}};
|
|
449
|
+
margin-right: 12px;
|
|
450
|
+
flex-shrink: 0;
|
|
451
|
+
`, zr = Z.div`
|
|
452
|
+
flex: 1;
|
|
453
|
+
min-width: 0;
|
|
454
|
+
`, _r = Z.div`
|
|
455
|
+
color: ${(e) => {
|
|
456
|
+
var a, t;
|
|
457
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.text) || "#343a40";
|
|
458
|
+
}};
|
|
459
|
+
font-size: 12px;
|
|
460
|
+
font-weight: 400;
|
|
461
|
+
margin-bottom: 2px;
|
|
462
|
+
white-space: nowrap;
|
|
463
|
+
overflow: hidden;
|
|
464
|
+
text-overflow: ellipsis;
|
|
465
|
+
`, Ar = Z.div`
|
|
466
|
+
color: ${(e) => {
|
|
467
|
+
var a, t, i, u;
|
|
468
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.textSecondary) || ((u = (i = e.$theme) == null ? void 0 : i.colors) == null ? void 0 : u.disabledText) || "#6b7280";
|
|
469
|
+
}};
|
|
470
|
+
font-size: 10px;
|
|
471
|
+
`, Wr = Z.div`
|
|
472
|
+
width: 100%;
|
|
473
|
+
height: 4px;
|
|
474
|
+
background: ${(e) => {
|
|
475
|
+
var a, t;
|
|
476
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.border) || "#dee2e6";
|
|
477
|
+
}};
|
|
478
|
+
border-radius: 2px;
|
|
479
|
+
overflow: hidden;
|
|
480
|
+
margin-top: 8px;
|
|
481
|
+
position: relative;
|
|
482
|
+
|
|
483
|
+
&::after {
|
|
484
|
+
content: '';
|
|
485
|
+
position: absolute;
|
|
486
|
+
top: 0;
|
|
487
|
+
left: 0;
|
|
488
|
+
height: 100%;
|
|
489
|
+
width: ${(e) => e.$progress}%;
|
|
490
|
+
background: ${(e) => {
|
|
491
|
+
var a, t;
|
|
492
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff";
|
|
493
|
+
}};
|
|
494
|
+
transition: width 0.3s ease;
|
|
495
|
+
}
|
|
496
|
+
`, qr = Z.div`
|
|
497
|
+
margin-left: 12px;
|
|
498
|
+
flex-shrink: 0;
|
|
499
|
+
color: ${(e) => {
|
|
500
|
+
var a, t, i, u, h, v, d, p, M, C;
|
|
501
|
+
switch (e.$status) {
|
|
502
|
+
case "success":
|
|
503
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.success) || "#008000";
|
|
504
|
+
case "error":
|
|
505
|
+
return ((u = (i = e.$theme) == null ? void 0 : i.colors) == null ? void 0 : u.error) || "#FF0000";
|
|
506
|
+
case "uploading":
|
|
507
|
+
return ((v = (h = e.$theme) == null ? void 0 : h.colors) == null ? void 0 : v.primary) || "#007bff";
|
|
508
|
+
case "pending":
|
|
509
|
+
return ((p = (d = e.$theme) == null ? void 0 : d.colors) == null ? void 0 : p.warning) || "#FFA500";
|
|
510
|
+
default:
|
|
511
|
+
return ((C = (M = e.$theme) == null ? void 0 : M.colors) == null ? void 0 : C.disabledText) || "#808080";
|
|
512
|
+
}
|
|
513
|
+
}};
|
|
514
|
+
`, Rr = Z.button`
|
|
515
|
+
background: none;
|
|
516
|
+
border: none;
|
|
517
|
+
color: ${(e) => {
|
|
518
|
+
var a, t;
|
|
519
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.error) || "#FF0000";
|
|
520
|
+
}};
|
|
521
|
+
cursor: pointer;
|
|
522
|
+
padding: 4px;
|
|
523
|
+
border-radius: 4px;
|
|
524
|
+
margin-left: 8px;
|
|
525
|
+
transition: all 0.2s ease;
|
|
526
|
+
|
|
527
|
+
&:hover {
|
|
528
|
+
background: ${(e) => {
|
|
529
|
+
var a, t;
|
|
530
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.error) || "#FF0000";
|
|
531
|
+
}}20;
|
|
532
|
+
}
|
|
533
|
+
`;
|
|
534
|
+
Z.button`
|
|
535
|
+
background: ${(e) => {
|
|
536
|
+
var a, t;
|
|
537
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.background) || "#f8f9fa";
|
|
538
|
+
}};
|
|
539
|
+
border: 1px solid ${(e) => {
|
|
540
|
+
var a, t;
|
|
541
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.border) || "#dee2e6";
|
|
542
|
+
}};
|
|
543
|
+
color: ${(e) => {
|
|
544
|
+
var a, t;
|
|
545
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff";
|
|
546
|
+
}};
|
|
547
|
+
padding: 8px 16px;
|
|
548
|
+
border-radius: 4px;
|
|
549
|
+
cursor: pointer;
|
|
550
|
+
display: flex;
|
|
551
|
+
align-items: center;
|
|
552
|
+
gap: 8px;
|
|
553
|
+
font-size: 14px;
|
|
554
|
+
transition: all 0.2s ease;
|
|
555
|
+
|
|
556
|
+
&:hover {
|
|
557
|
+
border-color: ${(e) => {
|
|
558
|
+
var a, t;
|
|
559
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff";
|
|
560
|
+
}};
|
|
561
|
+
background: ${(e) => {
|
|
562
|
+
var a, t;
|
|
563
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff";
|
|
564
|
+
}}10;
|
|
565
|
+
}
|
|
566
|
+
`;
|
|
567
|
+
Z.button`
|
|
568
|
+
background: none;
|
|
569
|
+
border: none;
|
|
570
|
+
color: ${(e) => {
|
|
571
|
+
var a, t;
|
|
572
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff";
|
|
573
|
+
}};
|
|
574
|
+
cursor: pointer;
|
|
575
|
+
padding: 4px;
|
|
576
|
+
border-radius: 4px;
|
|
577
|
+
margin-left: 8px;
|
|
578
|
+
transition: all 0.2s ease;
|
|
579
|
+
display: flex;
|
|
580
|
+
align-items: center;
|
|
581
|
+
|
|
582
|
+
&:hover {
|
|
583
|
+
background: ${(e) => {
|
|
584
|
+
var a, t;
|
|
585
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff";
|
|
586
|
+
}}20;
|
|
587
|
+
}
|
|
588
|
+
`;
|
|
589
|
+
const Lr = Z.div`
|
|
590
|
+
padding: 0px;
|
|
591
|
+
background: ${(e) => {
|
|
592
|
+
var a, t;
|
|
593
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.background) || "#f8f9fa";
|
|
594
|
+
}};
|
|
595
|
+
|
|
596
|
+
/* 移除边框,避免与外层容器边框重叠 */
|
|
597
|
+
border: none;
|
|
598
|
+
border-radius: 0;
|
|
599
|
+
|
|
600
|
+
/* 添加上方隔离线 */
|
|
601
|
+
border-top: 1px solid ${(e) => {
|
|
602
|
+
var a, t;
|
|
603
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.border) || "#dee2e6";
|
|
604
|
+
}};
|
|
605
|
+
|
|
606
|
+
/* 当有错误时,使用错误状态的隔离线颜色 */
|
|
607
|
+
${(e) => {
|
|
608
|
+
var a, t;
|
|
609
|
+
return e.$hasError && `
|
|
610
|
+
border-top-color: ${((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.error) || "#FF0000"};
|
|
611
|
+
`;
|
|
612
|
+
}}
|
|
613
|
+
|
|
614
|
+
/* 添加左右内边距,与外层容器对齐 */
|
|
615
|
+
margin: 0 1px;
|
|
616
|
+
|
|
617
|
+
/* 添加背景色区分 */
|
|
618
|
+
background: ${(e) => {
|
|
619
|
+
var a, t;
|
|
620
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.listBackground) || "#f9f9f9";
|
|
621
|
+
}};
|
|
622
|
+
`;
|
|
623
|
+
Z.input`
|
|
624
|
+
border: 1px solid ${(e) => {
|
|
625
|
+
var a, t;
|
|
626
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.border) || "#dee2e6";
|
|
627
|
+
}};
|
|
628
|
+
border-radius: 4px;
|
|
629
|
+
padding: 8px 12px;
|
|
630
|
+
font-size: 14px;
|
|
631
|
+
width: 100%;
|
|
632
|
+
margin-top: 8px;
|
|
633
|
+
background: ${(e) => {
|
|
634
|
+
var a, t;
|
|
635
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.background) || "#f8f9fa";
|
|
636
|
+
}};
|
|
637
|
+
color: ${(e) => {
|
|
638
|
+
var a, t;
|
|
639
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.text) || "#343a40";
|
|
640
|
+
}};
|
|
641
|
+
|
|
642
|
+
&:focus {
|
|
643
|
+
outline: none;
|
|
644
|
+
border-color: ${(e) => {
|
|
645
|
+
var a, t;
|
|
646
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.primary) || "#007bff";
|
|
647
|
+
}};
|
|
648
|
+
}
|
|
649
|
+
`;
|
|
650
|
+
const Ir = Z.div`
|
|
651
|
+
/* 基础样式 */
|
|
652
|
+
margin-top: 5px;
|
|
653
|
+
background: ${(e) => {
|
|
654
|
+
var a, t;
|
|
655
|
+
return ((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.background) || "#f8f9fa";
|
|
656
|
+
}};
|
|
657
|
+
transition: all 0.2s ease;
|
|
658
|
+
|
|
659
|
+
/* 边框逻辑:有表单时显示边框,无表单时不显示 */
|
|
660
|
+
border: ${(e) => {
|
|
661
|
+
var a, t, i, u;
|
|
662
|
+
return e.$hasForm ? e.$status === "error" ? `1px solid ${((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.error) || "#FF0000"}` : `1px solid ${((u = (i = e.$theme) == null ? void 0 : i.colors) == null ? void 0 : u.border) || "#dee2e6"}` : "none";
|
|
663
|
+
}};
|
|
664
|
+
|
|
665
|
+
/* 圆角设置:有表单时设置圆角,无表单时不设置 */
|
|
666
|
+
border-radius: ${(e) => e.$hasForm ? "4px" : "0"};
|
|
667
|
+
|
|
668
|
+
/* 当有表单时的特殊样式 */
|
|
669
|
+
${(e) => e.$hasForm && `
|
|
670
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
671
|
+
|
|
672
|
+
/* 确保边框完整包裹整个容器 */
|
|
673
|
+
overflow: hidden;
|
|
674
|
+
`}
|
|
675
|
+
|
|
676
|
+
/* 错误状态的特殊样式 */
|
|
677
|
+
${(e) => {
|
|
678
|
+
var a, t;
|
|
679
|
+
return e.$status === "error" && `
|
|
680
|
+
background: ${((t = (a = e.$theme) == null ? void 0 : a.colors) == null ? void 0 : t.error) || "#FF0000"}05;
|
|
681
|
+
`;
|
|
682
|
+
}}
|
|
683
|
+
|
|
684
|
+
/* 样式覆盖 */
|
|
685
|
+
.list-my div{
|
|
686
|
+
padding: 2px 2px !important;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
:where(.css-dev-only-do-not-override-1v28nim).ant-input-textarea-affix-wrapper.ant-input-affix-wrapper >textarea.ant-input{
|
|
690
|
+
min-height: 32px !important;
|
|
691
|
+
}
|
|
692
|
+
`;
|
|
693
|
+
function re(e) {
|
|
694
|
+
return e.label ? /* @__PURE__ */ H("div", { className: "flex items-center gap-2", children: [
|
|
695
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-gray-800 text-sm", children: e.label }),
|
|
696
|
+
e.required && /* @__PURE__ */ n("span", { className: "text-red-500 font-bold text-sm", children: "*" }),
|
|
697
|
+
(e.helpText || e.description) && /* @__PURE__ */ n(Te, { title: e.helpText || e.description, placement: "top", children: /* @__PURE__ */ n(
|
|
698
|
+
rr,
|
|
699
|
+
{
|
|
700
|
+
className: "text-gray-400 hover:text-gray-600 cursor-help transition-colors",
|
|
701
|
+
size: 14
|
|
702
|
+
}
|
|
703
|
+
) })
|
|
704
|
+
] }) : null;
|
|
705
|
+
}
|
|
706
|
+
function Or(e = [], a, t = {}, i = "md") {
|
|
707
|
+
const u = i === "sm" ? "28px" : "40px", h = i === "sm" ? "28px" : "40px", v = i === "sm" ? "0 8px" : "0 12px", d = i === "sm" ? "16px" : "24px", p = i === "sm" ? "12px" : "14px", M = oe.useMemo(
|
|
708
|
+
() => {
|
|
709
|
+
var V, q, R, B, J, G;
|
|
710
|
+
(q = (V = a == null ? void 0 : a.theme) == null ? void 0 : V.colors) != null && q.border;
|
|
711
|
+
const r = ((B = (R = a == null ? void 0 : a.theme) == null ? void 0 : R.colors) == null ? void 0 : B.primary) || "#3b82f6", m = ((G = (J = a == null ? void 0 : a.theme) == null ? void 0 : J.colors) == null ? void 0 : G.textSecondary) || "#9ca3af";
|
|
712
|
+
return `
|
|
713
|
+
.dynamic-form .ant-form-item-label > label {
|
|
714
|
+
height: auto !important;
|
|
715
|
+
line-height: 1.5 !important;
|
|
716
|
+
margin-bottom: ${i === "sm" ? "6px" : "8px"} !important;
|
|
717
|
+
font-weight: 500 !important;
|
|
718
|
+
color: #374151 !important;
|
|
719
|
+
font-size: ${p} !important;
|
|
720
|
+
}
|
|
721
|
+
.dynamic-form .ant-form-item {
|
|
722
|
+
margin-bottom: ${d} !important;
|
|
723
|
+
animation: df-fade-in 200ms ease-out both;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/* 受控项出现的轻微动画 */
|
|
727
|
+
@keyframes df-fade-in {
|
|
728
|
+
from { opacity: 0; transform: translateY(6px); }
|
|
729
|
+
to { opacity: 1; transform: translateY(0); }
|
|
730
|
+
}
|
|
731
|
+
.df-stagger { animation: df-fade-in 200ms ease-out both; }
|
|
732
|
+
|
|
733
|
+
/* 隐藏Ant Design的必填星号 */
|
|
734
|
+
.dynamic-form .ant-form-item-required::before {
|
|
735
|
+
display: none !important;
|
|
736
|
+
}
|
|
737
|
+
.dynamic-form .ant-form-item-required::after {
|
|
738
|
+
display: none !important;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
.dynamic-form .ant-input,
|
|
742
|
+
.dynamic-form .ant-select-selector,
|
|
743
|
+
{
|
|
744
|
+
border-radius: 6px !important;
|
|
745
|
+
border: none !important;
|
|
746
|
+
transition: all 0.2s !important;
|
|
747
|
+
|
|
748
|
+
line-height: ${h} !important;
|
|
749
|
+
padding: ${v} !important;
|
|
750
|
+
font-size: ${p} !important;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/* smooth show/hide for controlled items */
|
|
754
|
+
.df-hidden {
|
|
755
|
+
opacity: 0 !important;
|
|
756
|
+
transform: translateY(-4px) !important;
|
|
757
|
+
max-height: 0 !important;
|
|
758
|
+
margin-bottom: 0 !important;
|
|
759
|
+
overflow: hidden !important;
|
|
760
|
+
pointer-events: none !important;
|
|
761
|
+
transition: all 180ms ease !important;
|
|
762
|
+
}
|
|
763
|
+
.df-stagger { transition: all 200ms ease; }
|
|
764
|
+
|
|
765
|
+
.dynamic-form .ant-input-number,
|
|
766
|
+
.dynamic-form .ant-picker {
|
|
767
|
+
line-height: ${h} !important;
|
|
768
|
+
padding: ${v} !important;
|
|
769
|
+
font-size: ${p} !important;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
.dynamic-form .ant-input{
|
|
773
|
+
padding: 0 6px !important;
|
|
774
|
+
}
|
|
775
|
+
.ant-input-affix-wrapper:where(.css-dev-only-do-not-override-1vjf2v5).ant-input-affix-wrapper {
|
|
776
|
+
padding:0 6px !important;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
.dynamic-form .ant-input-textarea .ant-input {
|
|
780
|
+
border: none !important;
|
|
781
|
+
background: transparent !important;
|
|
782
|
+
padding: ${i === "sm" ? "6px 8px" : "8px 12px"} !important;
|
|
783
|
+
min-height: ${i === "sm" ? "56px" : "80px"} !important;
|
|
784
|
+
resize: vertical !important;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/* textarea 样式修复 */
|
|
788
|
+
.dynamic-form .ant-input-textarea {
|
|
789
|
+
border-radius: 6px !important;
|
|
790
|
+
border: 1px solid #d1d5db !important;
|
|
791
|
+
transition: all 0.2s !important;
|
|
792
|
+
font-size: ${p} !important;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/* 密码框样式修复 */
|
|
796
|
+
.dynamic-form .ant-input-password {
|
|
797
|
+
height: ${u} !important;
|
|
798
|
+
line-height: ${h} !important;
|
|
799
|
+
padding: 0 0px !important;
|
|
800
|
+
}
|
|
801
|
+
.dynamic-form .ant-input-number .ant-input-number-input {
|
|
802
|
+
padding: 0 0px !important;
|
|
803
|
+
}
|
|
804
|
+
.dynamic-form :where(.css-dev-only-do-not-override-1d4w9r2).ant-input-number .ant-input-number-input{
|
|
805
|
+
padding: 0 0px !important;
|
|
806
|
+
}
|
|
807
|
+
.dynamic-form .ant-input-password .ant-input {
|
|
808
|
+
height: ${i === "sm" ? "26px" : "38px"} !important;
|
|
809
|
+
line-height: ${i === "sm" ? "26px" : "38px"} !important;
|
|
810
|
+
padding: ${v} !important;
|
|
811
|
+
border: none !important;
|
|
812
|
+
background: transparent !important;
|
|
813
|
+
}
|
|
814
|
+
/* 数字框样式修复 */
|
|
815
|
+
.dynamic-form .ant-input-number {
|
|
816
|
+
height: ${u} !important;
|
|
817
|
+
line-height: ${h} !important;
|
|
818
|
+
width: 100% !important;
|
|
819
|
+
}
|
|
820
|
+
.dynamic-form .ant-input-number .ant-input-number-input {
|
|
821
|
+
height: ${i === "sm" ? "26px" : "38px"} !important;
|
|
822
|
+
line-height: ${i === "sm" ? "26px" : "38px"} !important;
|
|
823
|
+
text-align: left !important;
|
|
824
|
+
}
|
|
825
|
+
.dynamic-form .ant-input:focus,
|
|
826
|
+
.dynamic-form .ant-select-focused .ant-select-selector,
|
|
827
|
+
.dynamic-form .ant-input-number-focused,
|
|
828
|
+
.dynamic-form .ant-picker-focused {
|
|
829
|
+
border-color: ${r} !important;
|
|
830
|
+
box-shadow: 0 0 0 2px ${r}1A !important;
|
|
831
|
+
}
|
|
832
|
+
.dynamic-form .ant-input:hover,
|
|
833
|
+
.dynamic-form .ant-select:hover .ant-select-selector,
|
|
834
|
+
.dynamic-form .ant-input-number:hover,
|
|
835
|
+
.dynamic-form .ant-picker:hover {
|
|
836
|
+
border-color: ${m} !important;
|
|
837
|
+
}
|
|
838
|
+
.ant-form input[type="file"] {
|
|
839
|
+
display: none !important;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
/* 计数器样式优化,避免与自定义样式冲突 */
|
|
845
|
+
.dynamic-form .ant-input-show-count-suffix {
|
|
846
|
+
color: #6b7280 !important;
|
|
847
|
+
font-size: 12px !important;
|
|
848
|
+
margin-left: 8px !important;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
.dynamic-form .ant-input-textarea-show-count-suffix {
|
|
852
|
+
color: #6b7280 !important;
|
|
853
|
+
font-size: 12px !important;
|
|
854
|
+
text-align: right !important;
|
|
855
|
+
margin-top: 4px !important;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
/* 确保计数器不与其他元素重叠 */
|
|
859
|
+
.dynamic-form .ant-form-item-control-input {
|
|
860
|
+
position: relative !important;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
.dynamic-form .ant-form-item-control-input-content {
|
|
864
|
+
position: relative !important;
|
|
865
|
+
}
|
|
866
|
+
`;
|
|
867
|
+
},
|
|
868
|
+
[i, u, h, v, d, p, a]
|
|
869
|
+
);
|
|
870
|
+
oe.useEffect(() => {
|
|
871
|
+
const r = document.createElement("style");
|
|
872
|
+
return r.textContent = M, document.head.appendChild(r), () => {
|
|
873
|
+
document.head.removeChild(r);
|
|
874
|
+
};
|
|
875
|
+
}, [M]);
|
|
876
|
+
const [C, _] = oe.useState(() => {
|
|
877
|
+
const r = {};
|
|
878
|
+
return e.forEach((m) => {
|
|
879
|
+
m.name && (m.type === "switch" ? r[m.name] = t[m.name] ?? m.defaultValue ?? !1 : ["select", "radio", "checkbox"].includes(m.type) && (r[m.name] = t[m.name] ?? m.defaultValue ?? (m.type === "checkbox" ? [] : "")));
|
|
880
|
+
}), r;
|
|
881
|
+
}), I = oe.useRef();
|
|
882
|
+
oe.useEffect(() => {
|
|
883
|
+
a && a.formInstance && !I.current && (I.current = a.formInstance);
|
|
884
|
+
}, [a]);
|
|
885
|
+
const o = (r, m, V) => {
|
|
886
|
+
var q;
|
|
887
|
+
if (_((R) => ({ ...R, [r]: m })), I.current && V) {
|
|
888
|
+
let R = [];
|
|
889
|
+
if (Array.isArray(V))
|
|
890
|
+
R = V;
|
|
891
|
+
else if (typeof V == "object") {
|
|
892
|
+
const B = String(m);
|
|
893
|
+
Object.keys(V).forEach((J) => {
|
|
894
|
+
J !== B && V[J].forEach((G) => {
|
|
895
|
+
G && I.current.setFieldsValue({ [G]: void 0 });
|
|
896
|
+
});
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
Array.isArray(V) && ((q = e.find((J) => J.name === r)) == null ? void 0 : q.type) === "switch" && !m && R.forEach((J) => {
|
|
900
|
+
J && I.current.setFieldsValue({ [J]: void 0 });
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
}, F = /* @__PURE__ */ new Set(), U = (() => {
|
|
904
|
+
var r, m;
|
|
905
|
+
try {
|
|
906
|
+
return ((m = (r = a == null ? void 0 : a.formInstance) == null ? void 0 : r.getFieldsValue) == null ? void 0 : m.call(r)) || {};
|
|
907
|
+
} catch {
|
|
908
|
+
return {};
|
|
909
|
+
}
|
|
910
|
+
})(), Q = (r) => {
|
|
911
|
+
r.forEach((m) => {
|
|
912
|
+
if (!m) return;
|
|
913
|
+
if (m.controlledItems && m.name) {
|
|
914
|
+
const q = C[m.name];
|
|
915
|
+
if (Array.isArray(m.controlledItems))
|
|
916
|
+
m.type === "switch" && q === !1 && m.controlledItems.forEach((R) => {
|
|
917
|
+
R && F.add(R);
|
|
918
|
+
});
|
|
919
|
+
else if (typeof m.controlledItems == "object") {
|
|
920
|
+
const R = /* @__PURE__ */ new Set();
|
|
921
|
+
Object.values(m.controlledItems).forEach((G) => {
|
|
922
|
+
(G || []).forEach((A) => A && R.add(A));
|
|
923
|
+
});
|
|
924
|
+
const B = String(q ?? ""), J = new Set((m.controlledItems[B] || []).filter(Boolean));
|
|
925
|
+
R.forEach((G) => {
|
|
926
|
+
J.has(G) || F.add(G);
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
(typeof m.hidden == "function" ? m.hidden(U) : m.hidden === !0) && m.name && F.add(m.name), m.type === "col" && Array.isArray(m.children) && Q(m.children);
|
|
931
|
+
});
|
|
932
|
+
};
|
|
933
|
+
Q(e);
|
|
934
|
+
const X = e.map((r, m) => {
|
|
935
|
+
var V, q, R, B, J, G, A;
|
|
936
|
+
if (r.name && F.has(r.name)) return null;
|
|
937
|
+
if (r.type === "divider")
|
|
938
|
+
return /* @__PURE__ */ n(
|
|
939
|
+
"div",
|
|
940
|
+
{
|
|
941
|
+
className: "my-3 border-b border-solid border-gray-200"
|
|
942
|
+
},
|
|
943
|
+
r.name || `divider-${Math.random()}`
|
|
944
|
+
);
|
|
945
|
+
if (r.type === "title") {
|
|
946
|
+
const k = r.level || 1, K = {
|
|
947
|
+
1: "text-[16px]",
|
|
948
|
+
2: "text-[14px]",
|
|
949
|
+
3: "text-[12px]"
|
|
950
|
+
}, ee = K[k] || K[1];
|
|
951
|
+
return /* @__PURE__ */ n(
|
|
952
|
+
"div",
|
|
953
|
+
{
|
|
954
|
+
className: `${ee} text-gray-800 mb-4 mt-6 ${r.className || ""} df-stagger`,
|
|
955
|
+
style: {
|
|
956
|
+
color: "#1f2937",
|
|
957
|
+
lineHeight: "1.4",
|
|
958
|
+
fontWeight: k === 1 ? 700 : k === 2 ? 600 : 500,
|
|
959
|
+
animationDelay: `${m * 30}ms`
|
|
960
|
+
},
|
|
961
|
+
children: /* @__PURE__ */ H("div", { className: "flex items-center", children: [
|
|
962
|
+
/* @__PURE__ */ n("span", { className: "mr-3", children: r.label }),
|
|
963
|
+
/* @__PURE__ */ n(
|
|
964
|
+
"div",
|
|
965
|
+
{
|
|
966
|
+
className: "flex-1 border-b-[1px] border-dashed border-gray-200",
|
|
967
|
+
style: {
|
|
968
|
+
borderBottomStyle: "dashed",
|
|
969
|
+
borderBottomWidth: "1px",
|
|
970
|
+
borderBottomColor: "#e5e7eb"
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
)
|
|
974
|
+
] })
|
|
975
|
+
},
|
|
976
|
+
r.name || `title-${Math.random()}`
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
if (r.type === "col") {
|
|
980
|
+
if (!r.children || r.children.length === 0) return null;
|
|
981
|
+
const k = (l, $) => {
|
|
982
|
+
var g, b, O, z, T, c, S;
|
|
983
|
+
const y = typeof l.hidden == "function" ? l.hidden(U) : l.hidden === !0;
|
|
984
|
+
if (l.name && F.has(l.name) || y) return null;
|
|
985
|
+
const N = {
|
|
986
|
+
label: l.label ? re(l) : void 0,
|
|
987
|
+
name: l.name,
|
|
988
|
+
rules: l.name ? [
|
|
989
|
+
{
|
|
990
|
+
required: l.required,
|
|
991
|
+
message: l.error || `请输入${l.label}`
|
|
992
|
+
}
|
|
993
|
+
] : void 0,
|
|
994
|
+
className: "mb-6 df-stagger",
|
|
995
|
+
style: { animationDelay: `${$ * 30}ms` },
|
|
996
|
+
labelCol: { span: 24 },
|
|
997
|
+
wrapperCol: { span: 24 },
|
|
998
|
+
required: !1
|
|
999
|
+
}, x = l.name || l.id || `form-item-${$}`, f = `${l.className || ""} ${i === "sm" ? "h-7" : "h-10"}`;
|
|
1000
|
+
switch (l.type) {
|
|
1001
|
+
case "divider":
|
|
1002
|
+
return /* @__PURE__ */ n(
|
|
1003
|
+
"div",
|
|
1004
|
+
{
|
|
1005
|
+
className: "my-3 border-b border-solid border-gray-200"
|
|
1006
|
+
},
|
|
1007
|
+
l.name || l.id || `divider-${$}`
|
|
1008
|
+
);
|
|
1009
|
+
case "input":
|
|
1010
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1011
|
+
se,
|
|
1012
|
+
{
|
|
1013
|
+
placeholder: l.placeholder,
|
|
1014
|
+
disabled: l.disabled,
|
|
1015
|
+
className: f
|
|
1016
|
+
}
|
|
1017
|
+
) }, x);
|
|
1018
|
+
case "select":
|
|
1019
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1020
|
+
$e,
|
|
1021
|
+
{
|
|
1022
|
+
placeholder: l.placeholder,
|
|
1023
|
+
disabled: l.disabled,
|
|
1024
|
+
className: f,
|
|
1025
|
+
value: C[l.name || ""],
|
|
1026
|
+
onChange: (w) => o(l.name || "", w, l.controlledItems),
|
|
1027
|
+
children: (g = l.options) == null ? void 0 : g.map((w, s) => /* @__PURE__ */ n($e.Option, { value: w.value, children: w.render ? w.render() : w.label }, w.value || s))
|
|
1028
|
+
}
|
|
1029
|
+
) }, x);
|
|
1030
|
+
case "number":
|
|
1031
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1032
|
+
ve,
|
|
1033
|
+
{
|
|
1034
|
+
addonAfter: l.unit ? /* @__PURE__ */ n("span", { className: "text-[10px] text-gray-300", children: l.unit }) : null,
|
|
1035
|
+
min: (b = l.range) == null ? void 0 : b.min,
|
|
1036
|
+
max: (O = l.range) == null ? void 0 : O.max,
|
|
1037
|
+
step: l.step,
|
|
1038
|
+
placeholder: l.placeholder,
|
|
1039
|
+
disabled: l.disabled,
|
|
1040
|
+
className: f,
|
|
1041
|
+
style: { width: "100%" }
|
|
1042
|
+
}
|
|
1043
|
+
) }, x);
|
|
1044
|
+
case "password":
|
|
1045
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1046
|
+
se.Password,
|
|
1047
|
+
{
|
|
1048
|
+
placeholder: l.placeholder,
|
|
1049
|
+
disabled: l.disabled,
|
|
1050
|
+
className: f
|
|
1051
|
+
}
|
|
1052
|
+
) }, x);
|
|
1053
|
+
case "textarea":
|
|
1054
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1055
|
+
se.TextArea,
|
|
1056
|
+
{
|
|
1057
|
+
placeholder: l.placeholder,
|
|
1058
|
+
disabled: l.disabled,
|
|
1059
|
+
className: f,
|
|
1060
|
+
rows: i === "sm" ? 3 : 4
|
|
1061
|
+
}
|
|
1062
|
+
) }, x);
|
|
1063
|
+
case "date":
|
|
1064
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1065
|
+
we,
|
|
1066
|
+
{
|
|
1067
|
+
placeholder: l.placeholder,
|
|
1068
|
+
disabled: l.disabled,
|
|
1069
|
+
className: f,
|
|
1070
|
+
style: { width: "100%" }
|
|
1071
|
+
}
|
|
1072
|
+
) }, x);
|
|
1073
|
+
case "radio":
|
|
1074
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1075
|
+
Oe.Group,
|
|
1076
|
+
{
|
|
1077
|
+
options: l.options,
|
|
1078
|
+
disabled: l.disabled,
|
|
1079
|
+
className: l.className
|
|
1080
|
+
}
|
|
1081
|
+
) }, x);
|
|
1082
|
+
case "switch":
|
|
1083
|
+
return /* @__PURE__ */ n(
|
|
1084
|
+
E.Item,
|
|
1085
|
+
{
|
|
1086
|
+
label: null,
|
|
1087
|
+
colon: !1,
|
|
1088
|
+
className: "mb-6",
|
|
1089
|
+
labelCol: { span: 24 },
|
|
1090
|
+
wrapperCol: { span: 24 },
|
|
1091
|
+
children: /* @__PURE__ */ H("div", { className: "flex items-center justify-between", children: [
|
|
1092
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: l.label ? re(l) : null }),
|
|
1093
|
+
/* @__PURE__ */ n(E.Item, { name: l.name, valuePropName: "checked", noStyle: !0, children: /* @__PURE__ */ n(
|
|
1094
|
+
Ie,
|
|
1095
|
+
{
|
|
1096
|
+
disabled: l.disabled,
|
|
1097
|
+
checked: C[l.name || ""],
|
|
1098
|
+
onChange: (w) => o(l.name || "", w, l.controlledItems)
|
|
1099
|
+
}
|
|
1100
|
+
) })
|
|
1101
|
+
] })
|
|
1102
|
+
},
|
|
1103
|
+
l.name || `switch-${Math.random()}`
|
|
1104
|
+
);
|
|
1105
|
+
case "slider":
|
|
1106
|
+
return /* @__PURE__ */ H("div", { className: "mb-6", children: [
|
|
1107
|
+
/* @__PURE__ */ H("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1108
|
+
/* @__PURE__ */ n("div", { className: "flex items-center", children: l.label ? re(l) : null }),
|
|
1109
|
+
/* @__PURE__ */ H("div", { className: "flex items-center gap-2", children: [
|
|
1110
|
+
/* @__PURE__ */ n(E.Item, { name: l.name, noStyle: !0, children: /* @__PURE__ */ n(
|
|
1111
|
+
ve,
|
|
1112
|
+
{
|
|
1113
|
+
min: (z = l.range) == null ? void 0 : z.min,
|
|
1114
|
+
max: (T = l.range) == null ? void 0 : T.max,
|
|
1115
|
+
step: l.step,
|
|
1116
|
+
disabled: l.disabled,
|
|
1117
|
+
className: "h-8 w-20"
|
|
1118
|
+
}
|
|
1119
|
+
) }),
|
|
1120
|
+
l.unit && /* @__PURE__ */ n("span", { className: "text-sm text-gray-500", children: l.unit })
|
|
1121
|
+
] })
|
|
1122
|
+
] }),
|
|
1123
|
+
/* @__PURE__ */ n(E.Item, { name: l.name, noStyle: !0, children: /* @__PURE__ */ n(
|
|
1124
|
+
Le,
|
|
1125
|
+
{
|
|
1126
|
+
min: (c = l.range) == null ? void 0 : c.min,
|
|
1127
|
+
max: (S = l.range) == null ? void 0 : S.max,
|
|
1128
|
+
step: l.step,
|
|
1129
|
+
disabled: l.disabled,
|
|
1130
|
+
className: l.className
|
|
1131
|
+
}
|
|
1132
|
+
) })
|
|
1133
|
+
] }, l.name || `slider-${Math.random()}`);
|
|
1134
|
+
case "checkbox":
|
|
1135
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1136
|
+
je.Group,
|
|
1137
|
+
{
|
|
1138
|
+
options: l.options,
|
|
1139
|
+
disabled: l.disabled,
|
|
1140
|
+
className: l.className
|
|
1141
|
+
}
|
|
1142
|
+
) }, x);
|
|
1143
|
+
case "email":
|
|
1144
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1145
|
+
se,
|
|
1146
|
+
{
|
|
1147
|
+
type: "email",
|
|
1148
|
+
placeholder: l.placeholder,
|
|
1149
|
+
disabled: l.disabled,
|
|
1150
|
+
className: f
|
|
1151
|
+
}
|
|
1152
|
+
) }, x);
|
|
1153
|
+
case "time":
|
|
1154
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1155
|
+
Be,
|
|
1156
|
+
{
|
|
1157
|
+
placeholder: l.placeholder,
|
|
1158
|
+
disabled: l.disabled,
|
|
1159
|
+
className: f,
|
|
1160
|
+
style: { width: "100%" }
|
|
1161
|
+
}
|
|
1162
|
+
) }, x);
|
|
1163
|
+
case "datetime":
|
|
1164
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1165
|
+
we,
|
|
1166
|
+
{
|
|
1167
|
+
showTime: !0,
|
|
1168
|
+
placeholder: l.placeholder,
|
|
1169
|
+
disabled: l.disabled,
|
|
1170
|
+
className: f,
|
|
1171
|
+
style: { width: "100%" }
|
|
1172
|
+
}
|
|
1173
|
+
) }, x);
|
|
1174
|
+
case "file":
|
|
1175
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1176
|
+
se,
|
|
1177
|
+
{
|
|
1178
|
+
type: "file",
|
|
1179
|
+
placeholder: l.placeholder,
|
|
1180
|
+
disabled: l.disabled,
|
|
1181
|
+
className: f
|
|
1182
|
+
}
|
|
1183
|
+
) }, x);
|
|
1184
|
+
case "color":
|
|
1185
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1186
|
+
se,
|
|
1187
|
+
{
|
|
1188
|
+
type: "color",
|
|
1189
|
+
placeholder: l.placeholder,
|
|
1190
|
+
disabled: l.disabled,
|
|
1191
|
+
className: f,
|
|
1192
|
+
style: {
|
|
1193
|
+
width: "65px",
|
|
1194
|
+
height: "40px",
|
|
1195
|
+
padding: "4px !important"
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
) }, x);
|
|
1199
|
+
case "json":
|
|
1200
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1201
|
+
se.TextArea,
|
|
1202
|
+
{
|
|
1203
|
+
placeholder: l.placeholder,
|
|
1204
|
+
disabled: l.disabled,
|
|
1205
|
+
className: f,
|
|
1206
|
+
rows: 4
|
|
1207
|
+
}
|
|
1208
|
+
) }, x);
|
|
1209
|
+
case "markdown":
|
|
1210
|
+
return /* @__PURE__ */ n(E.Item, { ...N, children: /* @__PURE__ */ n(
|
|
1211
|
+
se.TextArea,
|
|
1212
|
+
{
|
|
1213
|
+
placeholder: l.placeholder,
|
|
1214
|
+
disabled: l.disabled,
|
|
1215
|
+
className: f,
|
|
1216
|
+
rows: 6
|
|
1217
|
+
}
|
|
1218
|
+
) }, x);
|
|
1219
|
+
case "uploader":
|
|
1220
|
+
return null;
|
|
1221
|
+
// return (
|
|
1222
|
+
// <Form.Item key={formItemKey} {...baseFormItemProps}>
|
|
1223
|
+
// <React.Suspense fallback={<div>加载中...</div>}>
|
|
1224
|
+
// <UploaderComponent
|
|
1225
|
+
// // 合并默认配置和用户配置
|
|
1226
|
+
// multiple={childItem.uploaderConfig?.multiple ?? true}
|
|
1227
|
+
// accept={childItem.uploaderConfig?.accept ?? '*/*'}
|
|
1228
|
+
// maxSize={childItem.uploaderConfig?.maxSize ?? 100 * 1024 * 1024} // 100MB
|
|
1229
|
+
// maxFiles={childItem.uploaderConfig?.maxFiles ?? 10}
|
|
1230
|
+
// autoUpload={childItem.uploaderConfig?.autoUpload ?? true}
|
|
1231
|
+
// url={childItem.uploaderConfig?.url}
|
|
1232
|
+
// headers={childItem.uploaderConfig?.headers ?? {}}
|
|
1233
|
+
// queryParams={childItem.uploaderConfig?.queryParams ?? {}}
|
|
1234
|
+
// itemForm={childItem.uploaderConfig?.itemForm ?? []}
|
|
1235
|
+
// buttons={childItem.uploaderConfig?.buttons || []}
|
|
1236
|
+
// icons={childItem.uploaderConfig?.icons} // 传递图标配置
|
|
1237
|
+
// // 新增:文案定制
|
|
1238
|
+
// placeholder={childItem.uploaderConfig?.placeholder}
|
|
1239
|
+
// listName={childItem.uploaderConfig?.listName}
|
|
1240
|
+
// // 新增:错误提示配置
|
|
1241
|
+
// errorMessages={childItem.uploaderConfig?.errorMessages}
|
|
1242
|
+
// // 新增:暴露方法给父组件
|
|
1243
|
+
// onRef={childItem.uploaderConfig?.onRef}
|
|
1244
|
+
// styles={styles}
|
|
1245
|
+
// eventsEmit={(eventName, data) => {
|
|
1246
|
+
// // 将Uploader的事件转发给表单,避免重复前缀
|
|
1247
|
+
// if (styles && typeof styles.eventsEmit === 'function') {
|
|
1248
|
+
// // 如果事件名已经包含 uploader: 前缀,则直接转发
|
|
1249
|
+
// // 否则添加前缀
|
|
1250
|
+
// const finalEventName = eventName.startsWith('uploader:')
|
|
1251
|
+
// ? eventName
|
|
1252
|
+
// : `uploader:${eventName}`;
|
|
1253
|
+
// styles.eventsEmit(finalEventName, {
|
|
1254
|
+
// fieldName: childItem.name,
|
|
1255
|
+
// ...data,
|
|
1256
|
+
// });
|
|
1257
|
+
// }
|
|
1258
|
+
// }}
|
|
1259
|
+
// />
|
|
1260
|
+
// </React.Suspense>
|
|
1261
|
+
// </Form.Item>
|
|
1262
|
+
// );
|
|
1263
|
+
default:
|
|
1264
|
+
return null;
|
|
1265
|
+
}
|
|
1266
|
+
}, K = r.children.map((l, $) => k(l, $)), ee = (l) => {
|
|
1267
|
+
if (!r.percentage || r.percentage.length === 0)
|
|
1268
|
+
return "flex-1";
|
|
1269
|
+
const $ = r.percentage[l];
|
|
1270
|
+
return $ && $ > 0 ? `${$ / 12 * 100}%` : "flex-1";
|
|
1271
|
+
};
|
|
1272
|
+
return /* @__PURE__ */ n(
|
|
1273
|
+
"div",
|
|
1274
|
+
{
|
|
1275
|
+
className: `flex justify-between items-start gap-x-2 ${r.className || ""}`,
|
|
1276
|
+
style: {
|
|
1277
|
+
flexDirection: r.direction === "column" ? "column" : "row",
|
|
1278
|
+
flexWrap: r.wrap ? "wrap" : "nowrap",
|
|
1279
|
+
gap: r.gap ? `${r.gap}px` : "8px",
|
|
1280
|
+
justifyContent: r.justify || "space-between",
|
|
1281
|
+
alignItems: r.align || "start"
|
|
1282
|
+
},
|
|
1283
|
+
children: K.map((l, $) => /* @__PURE__ */ n(
|
|
1284
|
+
"div",
|
|
1285
|
+
{
|
|
1286
|
+
style: {
|
|
1287
|
+
width: ee($),
|
|
1288
|
+
flex: r.percentage ? "none" : "1"
|
|
1289
|
+
// 有比例时固定宽度,无比例时弹性
|
|
1290
|
+
},
|
|
1291
|
+
children: l
|
|
1292
|
+
},
|
|
1293
|
+
`col-child-${$}`
|
|
1294
|
+
))
|
|
1295
|
+
},
|
|
1296
|
+
r.name || `col-${Math.random()}`
|
|
1297
|
+
);
|
|
1298
|
+
}
|
|
1299
|
+
if (r.type === "input") {
|
|
1300
|
+
const k = [];
|
|
1301
|
+
return r.required && k.push({ required: !0, message: r.error || `请输入${r.label}` }), r.validate && k.push({
|
|
1302
|
+
validator: async (K, ee) => {
|
|
1303
|
+
if (ee && r.validate) {
|
|
1304
|
+
const l = r.validate(ee);
|
|
1305
|
+
if (l)
|
|
1306
|
+
throw new Error(l);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}), /* @__PURE__ */ n(
|
|
1310
|
+
E.Item,
|
|
1311
|
+
{
|
|
1312
|
+
label: r.label ? re(r) : void 0,
|
|
1313
|
+
name: r.name,
|
|
1314
|
+
rules: k.length > 0 ? k : void 0,
|
|
1315
|
+
className: "mb-6",
|
|
1316
|
+
labelCol: { span: 24 },
|
|
1317
|
+
wrapperCol: { span: 24 },
|
|
1318
|
+
required: !1,
|
|
1319
|
+
children: /* @__PURE__ */ n(
|
|
1320
|
+
se,
|
|
1321
|
+
{
|
|
1322
|
+
placeholder: r.placeholder,
|
|
1323
|
+
disabled: r.disabled,
|
|
1324
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`,
|
|
1325
|
+
maxLength: r.counter,
|
|
1326
|
+
showCount: !!r.counter
|
|
1327
|
+
}
|
|
1328
|
+
)
|
|
1329
|
+
},
|
|
1330
|
+
r.name || `input-${Math.random()}`
|
|
1331
|
+
);
|
|
1332
|
+
}
|
|
1333
|
+
if (r.type === "select")
|
|
1334
|
+
return /* @__PURE__ */ n(
|
|
1335
|
+
E.Item,
|
|
1336
|
+
{
|
|
1337
|
+
label: r.label ? re(r) : void 0,
|
|
1338
|
+
name: r.name,
|
|
1339
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请选择${r.label}` }] : void 0,
|
|
1340
|
+
className: "mb-6",
|
|
1341
|
+
labelCol: { span: 24 },
|
|
1342
|
+
wrapperCol: { span: 24 },
|
|
1343
|
+
required: !1,
|
|
1344
|
+
children: /* @__PURE__ */ n(
|
|
1345
|
+
$e,
|
|
1346
|
+
{
|
|
1347
|
+
placeholder: r.placeholder,
|
|
1348
|
+
disabled: r.disabled,
|
|
1349
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`,
|
|
1350
|
+
value: C[r.name || ""],
|
|
1351
|
+
onChange: (k) => o(r.name || "", k, r.controlledItems),
|
|
1352
|
+
children: (V = r.options) == null ? void 0 : V.map((k, K) => /* @__PURE__ */ n($e.Option, { value: k.value, children: k.render ? k.render() : k.label }, k.value || K))
|
|
1353
|
+
}
|
|
1354
|
+
)
|
|
1355
|
+
},
|
|
1356
|
+
r.name || `select-${Math.random()}`
|
|
1357
|
+
);
|
|
1358
|
+
if (r.type === "number")
|
|
1359
|
+
return /* @__PURE__ */ n(
|
|
1360
|
+
E.Item,
|
|
1361
|
+
{
|
|
1362
|
+
label: r.label ? re(r) : void 0,
|
|
1363
|
+
name: r.name,
|
|
1364
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请输入${r.label}` }] : void 0,
|
|
1365
|
+
className: "mb-6",
|
|
1366
|
+
labelCol: { span: 24 },
|
|
1367
|
+
wrapperCol: { span: 24 },
|
|
1368
|
+
required: !1,
|
|
1369
|
+
children: /* @__PURE__ */ n(
|
|
1370
|
+
ve,
|
|
1371
|
+
{
|
|
1372
|
+
addonAfter: r.unit ? /* @__PURE__ */ n("span", { className: "text-[10px] text-gray-300", children: r.unit }) : null,
|
|
1373
|
+
min: (q = r.range) == null ? void 0 : q.min,
|
|
1374
|
+
max: (R = r.range) == null ? void 0 : R.max,
|
|
1375
|
+
step: r.step,
|
|
1376
|
+
placeholder: r.placeholder,
|
|
1377
|
+
disabled: r.disabled,
|
|
1378
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`,
|
|
1379
|
+
style: { width: "100%" }
|
|
1380
|
+
}
|
|
1381
|
+
)
|
|
1382
|
+
},
|
|
1383
|
+
r.name || `number-${Math.random()}`
|
|
1384
|
+
);
|
|
1385
|
+
if (r.type === "slider")
|
|
1386
|
+
return /* @__PURE__ */ H("div", { className: "mb-6", children: [
|
|
1387
|
+
/* @__PURE__ */ H("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1388
|
+
/* @__PURE__ */ n("div", { className: "flex items-center", children: r.label ? re(r) : null }),
|
|
1389
|
+
/* @__PURE__ */ H("div", { className: "flex items-center gap-2", children: [
|
|
1390
|
+
/* @__PURE__ */ n(E.Item, { name: r.name, noStyle: !0, children: /* @__PURE__ */ n(
|
|
1391
|
+
ve,
|
|
1392
|
+
{
|
|
1393
|
+
min: (B = r.range) == null ? void 0 : B.min,
|
|
1394
|
+
max: (J = r.range) == null ? void 0 : J.max,
|
|
1395
|
+
step: r.step,
|
|
1396
|
+
disabled: r.disabled,
|
|
1397
|
+
className: "h-8 w-20"
|
|
1398
|
+
}
|
|
1399
|
+
) }),
|
|
1400
|
+
r.unit && /* @__PURE__ */ n("span", { className: "text-sm text-gray-500", children: r.unit })
|
|
1401
|
+
] })
|
|
1402
|
+
] }),
|
|
1403
|
+
/* @__PURE__ */ n(E.Item, { name: r.name, noStyle: !0, children: /* @__PURE__ */ n(
|
|
1404
|
+
Le,
|
|
1405
|
+
{
|
|
1406
|
+
min: (G = r.range) == null ? void 0 : G.min,
|
|
1407
|
+
max: (A = r.range) == null ? void 0 : A.max,
|
|
1408
|
+
step: r.step,
|
|
1409
|
+
disabled: r.disabled,
|
|
1410
|
+
className: r.className
|
|
1411
|
+
}
|
|
1412
|
+
) })
|
|
1413
|
+
] }, r.name || `slider-${Math.random()}`);
|
|
1414
|
+
if (r.type === "switch")
|
|
1415
|
+
return /* @__PURE__ */ n(
|
|
1416
|
+
E.Item,
|
|
1417
|
+
{
|
|
1418
|
+
label: null,
|
|
1419
|
+
colon: !1,
|
|
1420
|
+
className: "mb-6",
|
|
1421
|
+
labelCol: { span: 24 },
|
|
1422
|
+
wrapperCol: { span: 24 },
|
|
1423
|
+
children: /* @__PURE__ */ H("div", { className: "flex items-center justify-between", children: [
|
|
1424
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: r.label ? re(r) : null }),
|
|
1425
|
+
/* @__PURE__ */ n(E.Item, { name: r.name, valuePropName: "checked", noStyle: !0, children: /* @__PURE__ */ n(
|
|
1426
|
+
Ie,
|
|
1427
|
+
{
|
|
1428
|
+
disabled: r.disabled,
|
|
1429
|
+
checked: r.name ? C[r.name] : !1,
|
|
1430
|
+
className: r.className,
|
|
1431
|
+
onChange: (k) => r.name && o(r.name, k, r.controlledItems)
|
|
1432
|
+
}
|
|
1433
|
+
) })
|
|
1434
|
+
] })
|
|
1435
|
+
},
|
|
1436
|
+
r.name || `switch-${Math.random()}`
|
|
1437
|
+
);
|
|
1438
|
+
if (r.type === "textarea") {
|
|
1439
|
+
const k = [];
|
|
1440
|
+
return r.required && k.push({ required: !0, message: r.error || `请输入${r.label}` }), r.validate && k.push({
|
|
1441
|
+
validator: async (K, ee) => {
|
|
1442
|
+
if (ee && r.validate) {
|
|
1443
|
+
const l = r.validate(ee);
|
|
1444
|
+
if (l)
|
|
1445
|
+
throw new Error(l);
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
}), /* @__PURE__ */ n(
|
|
1449
|
+
E.Item,
|
|
1450
|
+
{
|
|
1451
|
+
label: r.label ? re(r) : void 0,
|
|
1452
|
+
name: r.name,
|
|
1453
|
+
rules: k.length > 0 ? k : void 0,
|
|
1454
|
+
className: "mb-6",
|
|
1455
|
+
labelCol: { span: 24 },
|
|
1456
|
+
wrapperCol: { span: 24 },
|
|
1457
|
+
required: !1,
|
|
1458
|
+
children: /* @__PURE__ */ n(
|
|
1459
|
+
se.TextArea,
|
|
1460
|
+
{
|
|
1461
|
+
placeholder: r.placeholder,
|
|
1462
|
+
disabled: r.disabled,
|
|
1463
|
+
rows: i === "sm" ? 2 : 3,
|
|
1464
|
+
style: {
|
|
1465
|
+
height: "auto !important"
|
|
1466
|
+
},
|
|
1467
|
+
maxLength: r.counter,
|
|
1468
|
+
showCount: !!r.counter
|
|
1469
|
+
}
|
|
1470
|
+
)
|
|
1471
|
+
},
|
|
1472
|
+
r.name || `textarea-${Math.random()}`
|
|
1473
|
+
);
|
|
1474
|
+
}
|
|
1475
|
+
return r.type === "date" ? /* @__PURE__ */ n(
|
|
1476
|
+
E.Item,
|
|
1477
|
+
{
|
|
1478
|
+
label: r.label ? re(r) : void 0,
|
|
1479
|
+
name: r.name,
|
|
1480
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请选择${r.label}` }] : void 0,
|
|
1481
|
+
className: "mb-6",
|
|
1482
|
+
labelCol: { span: 24 },
|
|
1483
|
+
wrapperCol: { span: 24 },
|
|
1484
|
+
required: !1,
|
|
1485
|
+
children: /* @__PURE__ */ n(
|
|
1486
|
+
we,
|
|
1487
|
+
{
|
|
1488
|
+
placeholder: r.placeholder,
|
|
1489
|
+
disabled: r.disabled,
|
|
1490
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`,
|
|
1491
|
+
style: { width: "100%" }
|
|
1492
|
+
}
|
|
1493
|
+
)
|
|
1494
|
+
},
|
|
1495
|
+
r.name || `date-${Math.random()}`
|
|
1496
|
+
) : r.type === "radio" ? /* @__PURE__ */ n(
|
|
1497
|
+
E.Item,
|
|
1498
|
+
{
|
|
1499
|
+
label: r.label ? re(r) : void 0,
|
|
1500
|
+
name: r.name,
|
|
1501
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请选择${r.label}` }] : void 0,
|
|
1502
|
+
className: "mb-6",
|
|
1503
|
+
labelCol: { span: 24 },
|
|
1504
|
+
wrapperCol: { span: 24 },
|
|
1505
|
+
required: !1,
|
|
1506
|
+
children: /* @__PURE__ */ n(Oe.Group, { options: r.options, disabled: r.disabled, className: r.className })
|
|
1507
|
+
},
|
|
1508
|
+
r.name || `radio-${Math.random()}`
|
|
1509
|
+
) : r.type === "password" ? /* @__PURE__ */ n(
|
|
1510
|
+
E.Item,
|
|
1511
|
+
{
|
|
1512
|
+
label: r.label ? re(r) : void 0,
|
|
1513
|
+
name: r.name,
|
|
1514
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请输入${r.label}` }] : void 0,
|
|
1515
|
+
className: "mb-6",
|
|
1516
|
+
labelCol: { span: 24 },
|
|
1517
|
+
wrapperCol: { span: 24 },
|
|
1518
|
+
required: !1,
|
|
1519
|
+
children: /* @__PURE__ */ n(
|
|
1520
|
+
se.Password,
|
|
1521
|
+
{
|
|
1522
|
+
placeholder: r.placeholder,
|
|
1523
|
+
disabled: r.disabled,
|
|
1524
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`
|
|
1525
|
+
}
|
|
1526
|
+
)
|
|
1527
|
+
},
|
|
1528
|
+
r.name || `password-${Math.random()}`
|
|
1529
|
+
) : r.type === "checkbox" ? /* @__PURE__ */ n(
|
|
1530
|
+
E.Item,
|
|
1531
|
+
{
|
|
1532
|
+
label: r.label ? re(r) : void 0,
|
|
1533
|
+
name: r.name,
|
|
1534
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请选择${r.label}` }] : void 0,
|
|
1535
|
+
className: "mb-6",
|
|
1536
|
+
labelCol: { span: 24 },
|
|
1537
|
+
wrapperCol: { span: 24 },
|
|
1538
|
+
required: !1,
|
|
1539
|
+
children: /* @__PURE__ */ n(
|
|
1540
|
+
je.Group,
|
|
1541
|
+
{
|
|
1542
|
+
options: r.options,
|
|
1543
|
+
disabled: r.disabled,
|
|
1544
|
+
className: r.className
|
|
1545
|
+
}
|
|
1546
|
+
)
|
|
1547
|
+
},
|
|
1548
|
+
r.name || `checkbox-${Math.random()}`
|
|
1549
|
+
) : r.type === "email" ? /* @__PURE__ */ n(
|
|
1550
|
+
E.Item,
|
|
1551
|
+
{
|
|
1552
|
+
label: r.label ? re(r) : void 0,
|
|
1553
|
+
name: r.name,
|
|
1554
|
+
rules: r.name ? [
|
|
1555
|
+
{ required: r.required, message: r.error || `请输入${r.label}` },
|
|
1556
|
+
{ type: "email", message: "请输入有效的邮箱地址" }
|
|
1557
|
+
] : void 0,
|
|
1558
|
+
className: "mb-6",
|
|
1559
|
+
labelCol: { span: 24 },
|
|
1560
|
+
wrapperCol: { span: 24 },
|
|
1561
|
+
required: !1,
|
|
1562
|
+
children: /* @__PURE__ */ n(
|
|
1563
|
+
se,
|
|
1564
|
+
{
|
|
1565
|
+
type: "email",
|
|
1566
|
+
placeholder: r.placeholder,
|
|
1567
|
+
disabled: r.disabled,
|
|
1568
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`
|
|
1569
|
+
}
|
|
1570
|
+
)
|
|
1571
|
+
},
|
|
1572
|
+
r.name || `email-${Math.random()}`
|
|
1573
|
+
) : r.type === "time" ? /* @__PURE__ */ n(
|
|
1574
|
+
E.Item,
|
|
1575
|
+
{
|
|
1576
|
+
label: r.label ? re(r) : void 0,
|
|
1577
|
+
name: r.name,
|
|
1578
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请选择${r.label}` }] : void 0,
|
|
1579
|
+
className: "mb-6",
|
|
1580
|
+
labelCol: { span: 24 },
|
|
1581
|
+
wrapperCol: { span: 24 },
|
|
1582
|
+
required: !1,
|
|
1583
|
+
children: /* @__PURE__ */ n(
|
|
1584
|
+
Be,
|
|
1585
|
+
{
|
|
1586
|
+
placeholder: r.placeholder,
|
|
1587
|
+
disabled: r.disabled,
|
|
1588
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`,
|
|
1589
|
+
style: { width: "100%" }
|
|
1590
|
+
}
|
|
1591
|
+
)
|
|
1592
|
+
},
|
|
1593
|
+
r.name || `time-${Math.random()}`
|
|
1594
|
+
) : r.type === "datetime" ? /* @__PURE__ */ n(
|
|
1595
|
+
E.Item,
|
|
1596
|
+
{
|
|
1597
|
+
label: r.label ? re(r) : void 0,
|
|
1598
|
+
name: r.name,
|
|
1599
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请选择${r.label}` }] : void 0,
|
|
1600
|
+
className: "mb-6",
|
|
1601
|
+
labelCol: { span: 24 },
|
|
1602
|
+
wrapperCol: { span: 24 },
|
|
1603
|
+
required: !1,
|
|
1604
|
+
children: /* @__PURE__ */ n(
|
|
1605
|
+
we,
|
|
1606
|
+
{
|
|
1607
|
+
showTime: !0,
|
|
1608
|
+
placeholder: r.placeholder,
|
|
1609
|
+
disabled: r.disabled,
|
|
1610
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`,
|
|
1611
|
+
style: { width: "100%" }
|
|
1612
|
+
}
|
|
1613
|
+
)
|
|
1614
|
+
},
|
|
1615
|
+
r.name || `datetime-${Math.random()}`
|
|
1616
|
+
) : r.type === "file" ? /* @__PURE__ */ n(
|
|
1617
|
+
E.Item,
|
|
1618
|
+
{
|
|
1619
|
+
label: r.label ? re(r) : void 0,
|
|
1620
|
+
name: r.name,
|
|
1621
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请选择${r.label}` }] : void 0,
|
|
1622
|
+
className: "mb-6",
|
|
1623
|
+
labelCol: { span: 24 },
|
|
1624
|
+
wrapperCol: { span: 24 },
|
|
1625
|
+
required: !1,
|
|
1626
|
+
children: /* @__PURE__ */ n(
|
|
1627
|
+
se,
|
|
1628
|
+
{
|
|
1629
|
+
type: "file",
|
|
1630
|
+
placeholder: r.placeholder,
|
|
1631
|
+
disabled: r.disabled,
|
|
1632
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`
|
|
1633
|
+
}
|
|
1634
|
+
)
|
|
1635
|
+
},
|
|
1636
|
+
r.name || `file-${Math.random()}`
|
|
1637
|
+
) : r.type === "color" ? /* @__PURE__ */ n(
|
|
1638
|
+
E.Item,
|
|
1639
|
+
{
|
|
1640
|
+
label: r.label ? re(r) : void 0,
|
|
1641
|
+
name: r.name,
|
|
1642
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请选择${r.label}` }] : void 0,
|
|
1643
|
+
className: "mb-6",
|
|
1644
|
+
labelCol: { span: 24 },
|
|
1645
|
+
wrapperCol: { span: 24 },
|
|
1646
|
+
required: !1,
|
|
1647
|
+
children: /* @__PURE__ */ n(
|
|
1648
|
+
se,
|
|
1649
|
+
{
|
|
1650
|
+
type: "color",
|
|
1651
|
+
placeholder: r.placeholder,
|
|
1652
|
+
disabled: r.disabled,
|
|
1653
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`,
|
|
1654
|
+
style: { width: "100%", height: i === "sm" ? "28px" : "40px" }
|
|
1655
|
+
}
|
|
1656
|
+
)
|
|
1657
|
+
},
|
|
1658
|
+
r.name || `color-${Math.random()}`
|
|
1659
|
+
) : r.type === "json" ? /* @__PURE__ */ n(
|
|
1660
|
+
E.Item,
|
|
1661
|
+
{
|
|
1662
|
+
label: r.label ? re(r) : void 0,
|
|
1663
|
+
name: r.name,
|
|
1664
|
+
rules: r.name ? [
|
|
1665
|
+
{ required: r.required, message: r.error || `请输入${r.label}` },
|
|
1666
|
+
{
|
|
1667
|
+
validator: (k, K) => {
|
|
1668
|
+
if (!K) return Promise.resolve();
|
|
1669
|
+
try {
|
|
1670
|
+
return JSON.parse(K), Promise.resolve();
|
|
1671
|
+
} catch {
|
|
1672
|
+
return Promise.reject(new Error("请输入有效的JSON格式"));
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
] : void 0,
|
|
1677
|
+
className: "mb-6",
|
|
1678
|
+
labelCol: { span: 24 },
|
|
1679
|
+
wrapperCol: { span: 24 },
|
|
1680
|
+
required: !1,
|
|
1681
|
+
children: /* @__PURE__ */ n(
|
|
1682
|
+
se.TextArea,
|
|
1683
|
+
{
|
|
1684
|
+
placeholder: r.placeholder,
|
|
1685
|
+
disabled: r.disabled,
|
|
1686
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`,
|
|
1687
|
+
rows: 4
|
|
1688
|
+
}
|
|
1689
|
+
)
|
|
1690
|
+
},
|
|
1691
|
+
r.name || `json-${Math.random()}`
|
|
1692
|
+
) : r.type === "markdown" ? /* @__PURE__ */ n(
|
|
1693
|
+
E.Item,
|
|
1694
|
+
{
|
|
1695
|
+
label: r.label ? re(r) : void 0,
|
|
1696
|
+
name: r.name,
|
|
1697
|
+
rules: r.name ? [{ required: r.required, message: r.error || `请输入${r.label}` }] : void 0,
|
|
1698
|
+
className: "mb-6",
|
|
1699
|
+
labelCol: { span: 24 },
|
|
1700
|
+
wrapperCol: { span: 24 },
|
|
1701
|
+
required: !1,
|
|
1702
|
+
children: /* @__PURE__ */ n(
|
|
1703
|
+
se.TextArea,
|
|
1704
|
+
{
|
|
1705
|
+
placeholder: r.placeholder,
|
|
1706
|
+
disabled: r.disabled,
|
|
1707
|
+
className: `${r.className || ""} ${i === "sm" ? "h-7" : "h-10"}`,
|
|
1708
|
+
rows: 6
|
|
1709
|
+
}
|
|
1710
|
+
)
|
|
1711
|
+
},
|
|
1712
|
+
r.name || `markdown-${Math.random()}`
|
|
1713
|
+
) : (r.type === "uploader", null);
|
|
1714
|
+
});
|
|
1715
|
+
return oe.useEffect(() => {
|
|
1716
|
+
a && typeof a.setFormRef == "function" && a.setFormRef(I);
|
|
1717
|
+
}, [a]), X;
|
|
1718
|
+
}
|
|
1719
|
+
const jr = `
|
|
1720
|
+
.ant-input-password .ant-input-suffix {
|
|
1721
|
+
position: absolute !important;
|
|
1722
|
+
right: 8px !important;
|
|
1723
|
+
top: 50% !important;
|
|
1724
|
+
transform: translateY(-50%) !important;
|
|
1725
|
+
display: flex !important;
|
|
1726
|
+
align-items: center !important;
|
|
1727
|
+
justify-content: center !important;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
.ant-input-password .ant-input-suffix .anticon {
|
|
1731
|
+
font-size: 14px !important;
|
|
1732
|
+
color: rgba(0, 0, 0, 0.45) !important;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
.ant-input-password:hover .ant-input-suffix .anticon {
|
|
1736
|
+
color: rgba(0, 0, 0, 0.65) !important;
|
|
1737
|
+
}
|
|
1738
|
+
`, tr = oe.forwardRef(
|
|
1739
|
+
({
|
|
1740
|
+
formItems: e,
|
|
1741
|
+
formProps: a = {},
|
|
1742
|
+
initialValues: t = {},
|
|
1743
|
+
eventsEmit: i,
|
|
1744
|
+
databaseType: u,
|
|
1745
|
+
styles: h,
|
|
1746
|
+
size: v = "md",
|
|
1747
|
+
formConfig: d,
|
|
1748
|
+
title: p,
|
|
1749
|
+
description: M,
|
|
1750
|
+
formWidth: C,
|
|
1751
|
+
..._
|
|
1752
|
+
}, I) => {
|
|
1753
|
+
var K, ee, l, $, y, N, x;
|
|
1754
|
+
const [o] = E.useForm(), F = h == null ? void 0 : h.theme, U = me({}), Q = () => {
|
|
1755
|
+
const f = o.getFieldsValue(), g = [], b = (z) => {
|
|
1756
|
+
z == null || z.forEach((T) => {
|
|
1757
|
+
T && (T.type === "col" && Array.isArray(T.children) ? b(T.children) : T.name && g.push({ name: T.name, type: T.type }));
|
|
1758
|
+
});
|
|
1759
|
+
};
|
|
1760
|
+
b(e);
|
|
1761
|
+
const O = g.map((z) => {
|
|
1762
|
+
const c = z.type === "uploader" ? U.current[z.name] || f[z.name] || [] : f[z.name];
|
|
1763
|
+
return { name: z.name, type: z.type, value: c };
|
|
1764
|
+
});
|
|
1765
|
+
return {
|
|
1766
|
+
formName: (a == null ? void 0 : a.name) || "",
|
|
1767
|
+
values: f,
|
|
1768
|
+
fields: O,
|
|
1769
|
+
files: U.current,
|
|
1770
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1771
|
+
};
|
|
1772
|
+
}, X = (f, g) => {
|
|
1773
|
+
typeof i == "function" && (i("form:change", {
|
|
1774
|
+
formName: (a == null ? void 0 : a.name) || "",
|
|
1775
|
+
values: g,
|
|
1776
|
+
changedValues: f
|
|
1777
|
+
}), Object.keys(f).forEach((b) => {
|
|
1778
|
+
i("form:fieldChange", {
|
|
1779
|
+
formName: (a == null ? void 0 : a.name) || "",
|
|
1780
|
+
field: b,
|
|
1781
|
+
value: f[b],
|
|
1782
|
+
allValues: g
|
|
1783
|
+
});
|
|
1784
|
+
}));
|
|
1785
|
+
}, r = (f, g) => {
|
|
1786
|
+
if (f.startsWith("uploader:")) {
|
|
1787
|
+
const b = g == null ? void 0 : g.fieldName;
|
|
1788
|
+
if (b) {
|
|
1789
|
+
const O = U.current[b] || [];
|
|
1790
|
+
let z = O;
|
|
1791
|
+
switch (f) {
|
|
1792
|
+
case "uploader:success": {
|
|
1793
|
+
const T = g == null ? void 0 : g.item;
|
|
1794
|
+
if (T) {
|
|
1795
|
+
const c = {
|
|
1796
|
+
id: T.id,
|
|
1797
|
+
name: T.name,
|
|
1798
|
+
size: T.size,
|
|
1799
|
+
type: T.type,
|
|
1800
|
+
uploadApiRes: T.uploadApiRes || {},
|
|
1801
|
+
formData: T.formData || {}
|
|
1802
|
+
}, S = O.findIndex((w) => w.id === c.id);
|
|
1803
|
+
S >= 0 ? (O[S] = c, z = [...O]) : z = [...O, c];
|
|
1804
|
+
}
|
|
1805
|
+
break;
|
|
1806
|
+
}
|
|
1807
|
+
case "uploader:remove": {
|
|
1808
|
+
const T = g == null ? void 0 : g.itemId;
|
|
1809
|
+
z = O.filter((c) => c.id !== T);
|
|
1810
|
+
break;
|
|
1811
|
+
}
|
|
1812
|
+
case "uploader:formDataChange": {
|
|
1813
|
+
const T = g == null ? void 0 : g.itemId, c = (g == null ? void 0 : g.formData) || {};
|
|
1814
|
+
z = O.map((S) => S.id === T ? { ...S, formData: c } : S);
|
|
1815
|
+
break;
|
|
1816
|
+
}
|
|
1817
|
+
case "uploader:dataChange": {
|
|
1818
|
+
Array.isArray(g == null ? void 0 : g.items) && (z = g.items.map((T) => ({
|
|
1819
|
+
id: T.id,
|
|
1820
|
+
name: T.name,
|
|
1821
|
+
size: T.size,
|
|
1822
|
+
type: T.type,
|
|
1823
|
+
uploadApiRes: T.uploadApiRes || {},
|
|
1824
|
+
formData: T.formData || {}
|
|
1825
|
+
})));
|
|
1826
|
+
break;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
U.current[b] = z, o.setFieldsValue({ [b]: z });
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
if (typeof i == "function") {
|
|
1833
|
+
const b = {
|
|
1834
|
+
formName: (a == null ? void 0 : a.name) || "",
|
|
1835
|
+
...g
|
|
1836
|
+
};
|
|
1837
|
+
f === "uploader:error" && b.data === void 0 && (b.data = Q()), i(f, b);
|
|
1838
|
+
}
|
|
1839
|
+
}, [m, V] = ne(e);
|
|
1840
|
+
fe(() => {
|
|
1841
|
+
V(e);
|
|
1842
|
+
}, [e]);
|
|
1843
|
+
const q = (f, g) => {
|
|
1844
|
+
const b = (O) => O.map((z) => z && (z.type === "col" && Array.isArray(z.children) ? { ...z, children: b(z.children) } : z.name === f ? { ...z, ...g } : z));
|
|
1845
|
+
V((O) => b(O));
|
|
1846
|
+
}, R = (f) => {
|
|
1847
|
+
const g = [...m];
|
|
1848
|
+
for (; g.length; ) {
|
|
1849
|
+
const b = g.shift();
|
|
1850
|
+
if (b) {
|
|
1851
|
+
if (b.type === "col" && Array.isArray(b.children))
|
|
1852
|
+
g.push(...b.children);
|
|
1853
|
+
else if (b.name === f)
|
|
1854
|
+
return b;
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
}, B = Or(
|
|
1858
|
+
m,
|
|
1859
|
+
{ ...h, eventsEmit: r, formInstance: o },
|
|
1860
|
+
t,
|
|
1861
|
+
v
|
|
1862
|
+
), J = async () => {
|
|
1863
|
+
try {
|
|
1864
|
+
const f = await o.validateFields();
|
|
1865
|
+
typeof i == "function" ? i("form:submit", {
|
|
1866
|
+
formName: (a == null ? void 0 : a.name) || "",
|
|
1867
|
+
values: f,
|
|
1868
|
+
data: Q()
|
|
1869
|
+
}) : o.submit(), d != null && d.onSubmit ? d.onSubmit(f) : o.resetFields();
|
|
1870
|
+
} catch (f) {
|
|
1871
|
+
typeof i == "function" && i("form:submit_error", {
|
|
1872
|
+
formName: (a == null ? void 0 : a.name) || "",
|
|
1873
|
+
error: f,
|
|
1874
|
+
data: Q()
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
}, G = () => {
|
|
1878
|
+
o.resetFields(), typeof i == "function" && i("form:reset", {
|
|
1879
|
+
formName: (a == null ? void 0 : a.name) || "",
|
|
1880
|
+
data: Q()
|
|
1881
|
+
}), d != null && d.onReset && d.onReset();
|
|
1882
|
+
}, A = () => {
|
|
1883
|
+
o.resetFields(), typeof i == "function" && i("form:cancel", {
|
|
1884
|
+
formName: (a == null ? void 0 : a.name) || "",
|
|
1885
|
+
data: Q()
|
|
1886
|
+
});
|
|
1887
|
+
}, k = async () => {
|
|
1888
|
+
try {
|
|
1889
|
+
const f = await o.validateFields(), g = [], b = (z) => {
|
|
1890
|
+
z == null || z.forEach((T) => {
|
|
1891
|
+
T && (T.type === "col" && Array.isArray(T.children) ? b(T.children) : T.name && g.push({ name: T.name, type: T.type }));
|
|
1892
|
+
});
|
|
1893
|
+
};
|
|
1894
|
+
b(e);
|
|
1895
|
+
const O = g.map((z) => {
|
|
1896
|
+
const c = z.type === "uploader" ? U.current[z.name] || f[z.name] || [] : f[z.name];
|
|
1897
|
+
return { name: z.name, type: z.type, value: c };
|
|
1898
|
+
});
|
|
1899
|
+
return {
|
|
1900
|
+
fields: O,
|
|
1901
|
+
formName: (a == null ? void 0 : a.name) || "",
|
|
1902
|
+
fieldCount: O.length,
|
|
1903
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1904
|
+
isValid: !0
|
|
1905
|
+
};
|
|
1906
|
+
} catch (f) {
|
|
1907
|
+
const g = o.getFieldsValue(), b = [], O = (T) => {
|
|
1908
|
+
T == null || T.forEach((c) => {
|
|
1909
|
+
c && (c.type === "col" && Array.isArray(c.children) ? O(c.children) : c.name && b.push({ name: c.name, type: c.type }));
|
|
1910
|
+
});
|
|
1911
|
+
};
|
|
1912
|
+
O(e);
|
|
1913
|
+
const z = b.map((T) => {
|
|
1914
|
+
const S = T.type === "uploader" ? U.current[T.name] || g[T.name] || [] : g[T.name];
|
|
1915
|
+
return { name: T.name, type: T.type, value: S };
|
|
1916
|
+
});
|
|
1917
|
+
return {
|
|
1918
|
+
fields: z,
|
|
1919
|
+
formName: (a == null ? void 0 : a.name) || "",
|
|
1920
|
+
fieldCount: z.length,
|
|
1921
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1922
|
+
isValid: !1,
|
|
1923
|
+
errors: f
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
};
|
|
1927
|
+
return oe.useImperativeHandle(
|
|
1928
|
+
I,
|
|
1929
|
+
() => ({
|
|
1930
|
+
form: o,
|
|
1931
|
+
getAllData: k,
|
|
1932
|
+
submit: J,
|
|
1933
|
+
reset: G,
|
|
1934
|
+
cancel: A,
|
|
1935
|
+
validate: () => o.validateFields(),
|
|
1936
|
+
getValue: (f) => o.getFieldValue(f),
|
|
1937
|
+
getValues: () => o.getFieldsValue(),
|
|
1938
|
+
setValues: (f) => o.setFieldsValue(f),
|
|
1939
|
+
setFieldProps: (f, g) => q(f, g),
|
|
1940
|
+
getFieldProps: (f) => R(f)
|
|
1941
|
+
}),
|
|
1942
|
+
[o, k, J, G, A]
|
|
1943
|
+
), /* @__PURE__ */ H(Qe, { children: [
|
|
1944
|
+
/* @__PURE__ */ n("style", { children: jr }),
|
|
1945
|
+
/* @__PURE__ */ H(
|
|
1946
|
+
"div",
|
|
1947
|
+
{
|
|
1948
|
+
style: {
|
|
1949
|
+
position: "relative",
|
|
1950
|
+
height: "100%",
|
|
1951
|
+
padding: "24px",
|
|
1952
|
+
width: C || "100%",
|
|
1953
|
+
// 使用传入的表单宽度或默认100%
|
|
1954
|
+
maxWidth: C || "100%"
|
|
1955
|
+
// 确保最大宽度不超过设定值
|
|
1956
|
+
},
|
|
1957
|
+
children: [
|
|
1958
|
+
(p || M) && /* @__PURE__ */ H("div", { style: { marginBottom: "24px" }, children: [
|
|
1959
|
+
p && /* @__PURE__ */ n(
|
|
1960
|
+
"h2",
|
|
1961
|
+
{
|
|
1962
|
+
style: {
|
|
1963
|
+
fontSize: "24px",
|
|
1964
|
+
fontWeight: "600",
|
|
1965
|
+
color: ((K = F == null ? void 0 : F.colors) == null ? void 0 : K.text) || "#1f2937",
|
|
1966
|
+
margin: "0 0 8px 0"
|
|
1967
|
+
},
|
|
1968
|
+
children: p
|
|
1969
|
+
}
|
|
1970
|
+
),
|
|
1971
|
+
M && /* @__PURE__ */ n(
|
|
1972
|
+
"p",
|
|
1973
|
+
{
|
|
1974
|
+
style: {
|
|
1975
|
+
fontSize: "14px",
|
|
1976
|
+
color: ((ee = F == null ? void 0 : F.colors) == null ? void 0 : ee.secondary) || "#6b7280",
|
|
1977
|
+
margin: "0",
|
|
1978
|
+
lineHeight: "1.5"
|
|
1979
|
+
},
|
|
1980
|
+
children: M
|
|
1981
|
+
}
|
|
1982
|
+
)
|
|
1983
|
+
] }),
|
|
1984
|
+
/* @__PURE__ */ H(
|
|
1985
|
+
E,
|
|
1986
|
+
{
|
|
1987
|
+
form: o,
|
|
1988
|
+
...a,
|
|
1989
|
+
initialValues: t,
|
|
1990
|
+
onValuesChange: X,
|
|
1991
|
+
..._,
|
|
1992
|
+
style: {
|
|
1993
|
+
...a == null ? void 0 : a.style,
|
|
1994
|
+
width: "100%",
|
|
1995
|
+
// 表单内容占满容器宽度
|
|
1996
|
+
paddingBottom: "30px"
|
|
1997
|
+
},
|
|
1998
|
+
className: "dynamic-form",
|
|
1999
|
+
loading: (a == null ? void 0 : a.loading) === !0 ? !0 : void 0,
|
|
2000
|
+
children: [
|
|
2001
|
+
B,
|
|
2002
|
+
((d == null ? void 0 : d.showSubmit) || (d == null ? void 0 : d.showReset)) && /* @__PURE__ */ H(
|
|
2003
|
+
"div",
|
|
2004
|
+
{
|
|
2005
|
+
style: {
|
|
2006
|
+
marginTop: "32px",
|
|
2007
|
+
paddingTop: "24px",
|
|
2008
|
+
borderTop: `1px solid ${((l = F == null ? void 0 : F.colors) == null ? void 0 : l.border) || "#e5e7eb"}`,
|
|
2009
|
+
display: "flex",
|
|
2010
|
+
gap: "12px",
|
|
2011
|
+
justifyContent: "flex-end"
|
|
2012
|
+
},
|
|
2013
|
+
children: [
|
|
2014
|
+
(d == null ? void 0 : d.showReset) && /* @__PURE__ */ n(
|
|
2015
|
+
Ye,
|
|
2016
|
+
{
|
|
2017
|
+
onClick: G,
|
|
2018
|
+
style: {
|
|
2019
|
+
borderColor: (($ = F == null ? void 0 : F.colors) == null ? void 0 : $.border) || "#e5e7eb",
|
|
2020
|
+
color: ((y = F == null ? void 0 : F.colors) == null ? void 0 : y.text) || "#1f2937"
|
|
2021
|
+
},
|
|
2022
|
+
children: (d == null ? void 0 : d.resetText) || "重置"
|
|
2023
|
+
}
|
|
2024
|
+
),
|
|
2025
|
+
(d == null ? void 0 : d.showSubmit) && /* @__PURE__ */ n(
|
|
2026
|
+
Ye,
|
|
2027
|
+
{
|
|
2028
|
+
type: "primary",
|
|
2029
|
+
onClick: J,
|
|
2030
|
+
style: {
|
|
2031
|
+
backgroundColor: ((N = F == null ? void 0 : F.colors) == null ? void 0 : N.primary) || "#2563eb",
|
|
2032
|
+
borderColor: ((x = F == null ? void 0 : F.colors) == null ? void 0 : x.primary) || "#2563eb"
|
|
2033
|
+
},
|
|
2034
|
+
children: (d == null ? void 0 : d.submitText) || "提交"
|
|
2035
|
+
}
|
|
2036
|
+
)
|
|
2037
|
+
]
|
|
2038
|
+
}
|
|
2039
|
+
)
|
|
2040
|
+
]
|
|
2041
|
+
}
|
|
2042
|
+
)
|
|
2043
|
+
]
|
|
2044
|
+
}
|
|
2045
|
+
)
|
|
2046
|
+
] });
|
|
2047
|
+
}
|
|
2048
|
+
);
|
|
2049
|
+
oe.memo(tr);
|
|
2050
|
+
const Ve = !1, Br = (e, a) => a != null && a.fileType ? e.startsWith("image/") ? a.fileType.image || /* @__PURE__ */ n(pe, { size: 20 }) : e.includes("document") || e.includes("pdf") || e.includes("text") ? a.fileType.document || /* @__PURE__ */ n(pe, { size: 20 }) : e.includes("spreadsheet") || e.includes("excel") || e.includes("csv") ? a.fileType.spreadsheet || /* @__PURE__ */ n(pe, { size: 20 }) : e.includes("zip") || e.includes("rar") || e.includes("7z") ? a.fileType.archive || /* @__PURE__ */ n(pe, { size: 20 }) : e.startsWith("video/") ? a.fileType.video || /* @__PURE__ */ n(pe, { size: 20 }) : e.startsWith("audio/") ? a.fileType.audio || /* @__PURE__ */ n(pe, { size: 20 }) : a.fileType.default || /* @__PURE__ */ n(pe, { size: 20 }) : /* @__PURE__ */ n(pe, { size: 20 }), Yr = (e, a, t) => {
|
|
2051
|
+
var i, u, h, v;
|
|
2052
|
+
if (t != null && t.itemStatus)
|
|
2053
|
+
switch (e) {
|
|
2054
|
+
case "error":
|
|
2055
|
+
return t.itemStatus.error || /* @__PURE__ */ n(Re, { size: 20 });
|
|
2056
|
+
case "uploading":
|
|
2057
|
+
return t.itemStatus.uploading || /* @__PURE__ */ n("span", { style: { fontSize: "12px", color: ((i = a == null ? void 0 : a.colors) == null ? void 0 : i.primary) || "#007bff" }, children: "上传中..." });
|
|
2058
|
+
case "success":
|
|
2059
|
+
return t.itemStatus.success || null;
|
|
2060
|
+
case "pending":
|
|
2061
|
+
return t.itemStatus.pending || /* @__PURE__ */ n("span", { style: { fontSize: "12px", color: ((u = a == null ? void 0 : a.colors) == null ? void 0 : u.warning) || "#FFA500" }, children: "等待中" });
|
|
2062
|
+
default:
|
|
2063
|
+
return null;
|
|
2064
|
+
}
|
|
2065
|
+
switch (e) {
|
|
2066
|
+
case "error":
|
|
2067
|
+
return /* @__PURE__ */ n(Re, { size: 20 });
|
|
2068
|
+
case "uploading":
|
|
2069
|
+
return /* @__PURE__ */ n("span", { style: { fontSize: "12px", color: ((h = a == null ? void 0 : a.colors) == null ? void 0 : h.primary) || "#007bff" }, children: "上传中..." });
|
|
2070
|
+
case "pending":
|
|
2071
|
+
return /* @__PURE__ */ n("span", { style: { fontSize: "12px", color: ((v = a == null ? void 0 : a.colors) == null ? void 0 : v.warning) || "#FFA500" }, children: "等待中" });
|
|
2072
|
+
default:
|
|
2073
|
+
return null;
|
|
2074
|
+
}
|
|
2075
|
+
};
|
|
2076
|
+
lr`
|
|
2077
|
+
.upload-item-container .upload-item {
|
|
2078
|
+
padding: 0px !important;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
.upload-item-container .list-item {
|
|
2082
|
+
padding: 0px !important;
|
|
2083
|
+
}
|
|
2084
|
+
`;
|
|
2085
|
+
const Hr = ({
|
|
2086
|
+
item: e,
|
|
2087
|
+
index: a,
|
|
2088
|
+
theme: t,
|
|
2089
|
+
itemForm: i,
|
|
2090
|
+
onRemove: u,
|
|
2091
|
+
onToggleExpand: h,
|
|
2092
|
+
onFormDataChange: v,
|
|
2093
|
+
icons: d
|
|
2094
|
+
}) => {
|
|
2095
|
+
var p;
|
|
2096
|
+
return /* @__PURE__ */ H(Ir, { $theme: t, $status: e.status, $hasForm: i.length > 0, children: [
|
|
2097
|
+
/* @__PURE__ */ H(Cr, { $theme: t, $status: e.status, $hasForm: i.length > 0, children: [
|
|
2098
|
+
/* @__PURE__ */ n(Fr, { $theme: t, children: Br(e.type, d) }),
|
|
2099
|
+
/* @__PURE__ */ H(zr, { children: [
|
|
2100
|
+
/* @__PURE__ */ H("div", { className: "flex items-center gap-1 line-clamp-1", children: [
|
|
2101
|
+
/* @__PURE__ */ n(_r, { $theme: t, children: e.name }),
|
|
2102
|
+
/* @__PURE__ */ n(Ar, { $theme: t, children: ar(e.size) })
|
|
2103
|
+
] }),
|
|
2104
|
+
e.status === "uploading" && /* @__PURE__ */ n(Wr, { $theme: t, $progress: e.progress }),
|
|
2105
|
+
e.status === "error" && e.error && /* @__PURE__ */ n("div", { style: { color: ((p = t == null ? void 0 : t.colors) == null ? void 0 : p.error) || "#FF0000", fontSize: "12px", marginTop: "4px" }, children: typeof e.error == "string" ? e.error : String(e.error) })
|
|
2106
|
+
] }),
|
|
2107
|
+
(() => {
|
|
2108
|
+
const M = Yr(e.status, t, d);
|
|
2109
|
+
return M && /* @__PURE__ */ n(qr, { $theme: t, $status: e.status, children: M });
|
|
2110
|
+
})(),
|
|
2111
|
+
Ve,
|
|
2112
|
+
/* @__PURE__ */ n(
|
|
2113
|
+
Rr,
|
|
2114
|
+
{
|
|
2115
|
+
$theme: t,
|
|
2116
|
+
onClick: () => u(e.id),
|
|
2117
|
+
title: "移除文件",
|
|
2118
|
+
children: /* @__PURE__ */ n(ir, { size: 16 })
|
|
2119
|
+
}
|
|
2120
|
+
)
|
|
2121
|
+
] }),
|
|
2122
|
+
(i.length > 0 || Ve) && /* @__PURE__ */ n(
|
|
2123
|
+
Lr,
|
|
2124
|
+
{
|
|
2125
|
+
$theme: t,
|
|
2126
|
+
$hasError: e.status === "error",
|
|
2127
|
+
className: "list-my",
|
|
2128
|
+
children: /* @__PURE__ */ n(
|
|
2129
|
+
tr,
|
|
2130
|
+
{
|
|
2131
|
+
formItems: i,
|
|
2132
|
+
initialValues: e.formData || {},
|
|
2133
|
+
size: "sm",
|
|
2134
|
+
formProps: { component: !1 },
|
|
2135
|
+
eventsEmit: (M, C) => {
|
|
2136
|
+
switch (console.log("DynamicForm Event:", M, C), M) {
|
|
2137
|
+
case "form:submit":
|
|
2138
|
+
v(e.id, C.values);
|
|
2139
|
+
break;
|
|
2140
|
+
case "form:change":
|
|
2141
|
+
v(e.id, C.values);
|
|
2142
|
+
break;
|
|
2143
|
+
case "form:fieldChange":
|
|
2144
|
+
if (C.field && C.value !== void 0) {
|
|
2145
|
+
const _ = {
|
|
2146
|
+
...e.formData,
|
|
2147
|
+
[C.field]: C.value
|
|
2148
|
+
};
|
|
2149
|
+
v(e.id, _);
|
|
2150
|
+
}
|
|
2151
|
+
break;
|
|
2152
|
+
case "form:reset":
|
|
2153
|
+
v(e.id, {});
|
|
2154
|
+
break;
|
|
2155
|
+
case "form:validate":
|
|
2156
|
+
C.values && v(e.id, C.values);
|
|
2157
|
+
break;
|
|
2158
|
+
}
|
|
2159
|
+
},
|
|
2160
|
+
styles: { theme: t },
|
|
2161
|
+
style: {
|
|
2162
|
+
padding: "0px"
|
|
2163
|
+
}
|
|
2164
|
+
},
|
|
2165
|
+
`form-${e.id}-always`
|
|
2166
|
+
)
|
|
2167
|
+
}
|
|
2168
|
+
)
|
|
2169
|
+
] });
|
|
2170
|
+
}, $a = ({
|
|
2171
|
+
multiple: e = !0,
|
|
2172
|
+
accept: a = "*/*",
|
|
2173
|
+
maxSize: t = 100,
|
|
2174
|
+
// 100MB
|
|
2175
|
+
maxFiles: i = 10,
|
|
2176
|
+
// 预留接口,后续可扩展文件数量限制功能
|
|
2177
|
+
autoUpload: u = !0,
|
|
2178
|
+
url: h = "http://localhost:3000/upload",
|
|
2179
|
+
// 默认上传地址
|
|
2180
|
+
headers: v = {},
|
|
2181
|
+
// 默认请求头
|
|
2182
|
+
queryParams: d = {},
|
|
2183
|
+
// 默认查询参数
|
|
2184
|
+
itemForm: p = [],
|
|
2185
|
+
styles: M,
|
|
2186
|
+
buttons: C = [],
|
|
2187
|
+
// 新增:自定义按钮数组
|
|
2188
|
+
errorMessages: _ = {},
|
|
2189
|
+
// 新增:错误提示配置
|
|
2190
|
+
icons: I,
|
|
2191
|
+
// 新增:图标配置
|
|
2192
|
+
eventsEmit: o,
|
|
2193
|
+
onRef: F,
|
|
2194
|
+
placeholder: U,
|
|
2195
|
+
listName: Q
|
|
2196
|
+
}) => {
|
|
2197
|
+
var z, T;
|
|
2198
|
+
const X = er({ theme: ue, mode: "light" }, M), r = me(null), [m, V] = ne(!1), [q, R] = ne([]), B = te((c) => (c ?? q).map((w) => ({
|
|
2199
|
+
id: w.id,
|
|
2200
|
+
name: w.name,
|
|
2201
|
+
status: w.status,
|
|
2202
|
+
error: w.error,
|
|
2203
|
+
uploadApiRes: w.uploadApiRes || {},
|
|
2204
|
+
formData: w.formData || {},
|
|
2205
|
+
file: w.file,
|
|
2206
|
+
size: w.size,
|
|
2207
|
+
type: w.type
|
|
2208
|
+
})), [q]), J = he(() => {
|
|
2209
|
+
if (!U) return null;
|
|
2210
|
+
if (typeof U == "string") {
|
|
2211
|
+
let c = U;
|
|
2212
|
+
return c = c.replace(/<br\s*\/?>(?=\s*)/gi, `
|
|
2213
|
+
`), c = c.replace(/\s*\/n\s*/gi, `
|
|
2214
|
+
`), c = c.replace(/\\n/g, `
|
|
2215
|
+
`), /* @__PURE__ */ n(
|
|
2216
|
+
Ue,
|
|
2217
|
+
{
|
|
2218
|
+
$theme: X.theme || ue,
|
|
2219
|
+
style: {
|
|
2220
|
+
textAlign: "center",
|
|
2221
|
+
whiteSpace: "pre-line"
|
|
2222
|
+
},
|
|
2223
|
+
children: c
|
|
2224
|
+
}
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
return U;
|
|
2228
|
+
}, [U, X.theme]), G = {
|
|
2229
|
+
noUrl: "请提供上传接口地址 (url)",
|
|
2230
|
+
uploadFailed: "上传失败,请重试",
|
|
2231
|
+
fileTooLarge: `文件大小不能超过 ${t}MB`,
|
|
2232
|
+
invalidFileType: "不支持的文件类型"
|
|
2233
|
+
}, A = { ...G, ..._ }, k = (c, S) => A[c] ? A[c] : S || G[c], K = (c) => {
|
|
2234
|
+
const S = c / 1048576;
|
|
2235
|
+
return `${Number(S.toFixed(2))}MB`;
|
|
2236
|
+
}, ee = te(
|
|
2237
|
+
(c, S) => {
|
|
2238
|
+
const w = t * 1024 * 1024, s = [], L = [];
|
|
2239
|
+
if (c.forEach((D) => {
|
|
2240
|
+
D.size > w ? s.push(D) : L.push(D);
|
|
2241
|
+
}), s.length > 0) {
|
|
2242
|
+
const D = s.map((ae) => `${ae.name}(${K(ae.size)})`).join("、"), P = `${k("fileTooLarge")}:${D}`;
|
|
2243
|
+
o == null || o("uploader:error", {
|
|
2244
|
+
type: "fileTooLarge",
|
|
2245
|
+
message: P,
|
|
2246
|
+
files: s.map((ae) => ({ name: ae.name, size: ae.size })),
|
|
2247
|
+
limit: `${t}MB`,
|
|
2248
|
+
data: B()
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
const j = Math.max(0, i - S);
|
|
2252
|
+
if (j <= 0) {
|
|
2253
|
+
const D = `最多只能上传 ${i} 个文件,已存在 ${S} 个,无法继续添加。`;
|
|
2254
|
+
return o == null || o("uploader:error", {
|
|
2255
|
+
type: "tooManyFiles",
|
|
2256
|
+
message: D,
|
|
2257
|
+
currentCount: S,
|
|
2258
|
+
tryAdd: c.length,
|
|
2259
|
+
limit: i,
|
|
2260
|
+
data: B()
|
|
2261
|
+
}), [];
|
|
2262
|
+
}
|
|
2263
|
+
const W = L.slice(0, j);
|
|
2264
|
+
if (L.length > j) {
|
|
2265
|
+
const D = L.length - W.length, P = `最多只能上传 ${i} 个文件,本次仅接受 ${W.length} 个,忽略 ${D} 个。`;
|
|
2266
|
+
o == null || o("uploader:error", {
|
|
2267
|
+
type: "tooManyFiles",
|
|
2268
|
+
message: P,
|
|
2269
|
+
currentCount: S,
|
|
2270
|
+
accepted: W.length,
|
|
2271
|
+
dropped: D,
|
|
2272
|
+
limit: i,
|
|
2273
|
+
data: B()
|
|
2274
|
+
});
|
|
2275
|
+
}
|
|
2276
|
+
return W;
|
|
2277
|
+
},
|
|
2278
|
+
[t, i, k, o, B]
|
|
2279
|
+
), l = he(
|
|
2280
|
+
() => ({
|
|
2281
|
+
// 获取所有上传项
|
|
2282
|
+
getUploadItems: () => q,
|
|
2283
|
+
// 获取所有上传项的数据(包含表单数据)
|
|
2284
|
+
getUploadItemsData: (c) => {
|
|
2285
|
+
let S = q;
|
|
2286
|
+
return c != null && c.includeStatus && (S = S.filter(
|
|
2287
|
+
(w) => c.includeStatus.includes(w.status)
|
|
2288
|
+
)), c != null && c.excludeStatus && (S = S.filter(
|
|
2289
|
+
(w) => !c.excludeStatus.includes(w.status)
|
|
2290
|
+
)), S.map((w) => ({
|
|
2291
|
+
id: w.id,
|
|
2292
|
+
name: w.name,
|
|
2293
|
+
status: w.status,
|
|
2294
|
+
error: w.error,
|
|
2295
|
+
// 新增:错误信息
|
|
2296
|
+
uploadApiRes: w.uploadApiRes || {},
|
|
2297
|
+
formData: w.formData || {},
|
|
2298
|
+
file: w.file,
|
|
2299
|
+
size: w.size,
|
|
2300
|
+
type: w.type
|
|
2301
|
+
}));
|
|
2302
|
+
},
|
|
2303
|
+
// 清空所有上传项
|
|
2304
|
+
clearUploadItems: () => {
|
|
2305
|
+
R([]), o == null || o("uploader:clear", {});
|
|
2306
|
+
},
|
|
2307
|
+
// 新增:设置某个 item 的错误信息
|
|
2308
|
+
setItemError: (c, S) => {
|
|
2309
|
+
R((w) => w.map(
|
|
2310
|
+
(s) => s.id === c ? { ...s, status: "error", error: S } : s
|
|
2311
|
+
)), o == null || o("uploader:errorSet", { itemId: c, error: S, data: B() });
|
|
2312
|
+
},
|
|
2313
|
+
// 新增:清除某个 item 的错误信息
|
|
2314
|
+
clearItemError: (c) => {
|
|
2315
|
+
R((S) => S.map(
|
|
2316
|
+
(w) => w.id === c ? { ...w, status: "pending", error: void 0 } : w
|
|
2317
|
+
)), o == null || o("uploader:errorCleared", { itemId: c, data: B() });
|
|
2318
|
+
},
|
|
2319
|
+
// 添加新的上传项(对外方法也应用限流)
|
|
2320
|
+
addUploadItems: (c) => {
|
|
2321
|
+
const S = ee(c, q.length);
|
|
2322
|
+
if (S.length === 0) return;
|
|
2323
|
+
const w = S.map((s) => ({
|
|
2324
|
+
id: He(),
|
|
2325
|
+
file: s,
|
|
2326
|
+
name: s.name,
|
|
2327
|
+
size: s.size,
|
|
2328
|
+
type: s.type,
|
|
2329
|
+
status: "pending",
|
|
2330
|
+
progress: 0,
|
|
2331
|
+
formData: {},
|
|
2332
|
+
isExpanded: !1
|
|
2333
|
+
}));
|
|
2334
|
+
R((s) => [...s, ...w]), u && f(w);
|
|
2335
|
+
},
|
|
2336
|
+
// 移除指定上传项
|
|
2337
|
+
removeUploadItem: (c) => {
|
|
2338
|
+
R((S) => {
|
|
2339
|
+
const w = S.find((s) => s.id === c);
|
|
2340
|
+
return w && (o == null || o("uploader:remove", {
|
|
2341
|
+
itemId: c,
|
|
2342
|
+
item: w,
|
|
2343
|
+
data: B(S)
|
|
2344
|
+
})), S.filter((s) => s.id !== c);
|
|
2345
|
+
});
|
|
2346
|
+
},
|
|
2347
|
+
// 验证表单数据
|
|
2348
|
+
validateFormData: async () => !(q.some((s) => s.status === "error") || q.some((s) => s.status === "uploading") || !q.some((s) => s.status === "success"))
|
|
2349
|
+
}),
|
|
2350
|
+
[q, u, o, ee, B]
|
|
2351
|
+
);
|
|
2352
|
+
fe(() => {
|
|
2353
|
+
F && F(l);
|
|
2354
|
+
}, [l, F]);
|
|
2355
|
+
const $ = te(
|
|
2356
|
+
(c) => {
|
|
2357
|
+
if (!c) return;
|
|
2358
|
+
const S = ee(Array.from(c), q.length);
|
|
2359
|
+
if (S.length === 0) return;
|
|
2360
|
+
const w = S.map((s) => ({
|
|
2361
|
+
id: He(),
|
|
2362
|
+
file: s,
|
|
2363
|
+
name: s.name,
|
|
2364
|
+
size: s.size,
|
|
2365
|
+
type: s.type,
|
|
2366
|
+
status: "pending",
|
|
2367
|
+
progress: 0,
|
|
2368
|
+
formData: {},
|
|
2369
|
+
// 每个item独立的表单数据
|
|
2370
|
+
isExpanded: !1
|
|
2371
|
+
}));
|
|
2372
|
+
R((s) => [...s, ...w]), u && f(w);
|
|
2373
|
+
},
|
|
2374
|
+
[u, q.length, ee]
|
|
2375
|
+
), y = te((c) => {
|
|
2376
|
+
c.preventDefault(), V(!0);
|
|
2377
|
+
}, []), N = te((c) => {
|
|
2378
|
+
c.preventDefault(), V(!1);
|
|
2379
|
+
}, []), x = te(
|
|
2380
|
+
(c) => {
|
|
2381
|
+
c.preventDefault(), V(!1), $(c.dataTransfer.files);
|
|
2382
|
+
},
|
|
2383
|
+
[$]
|
|
2384
|
+
), f = te(
|
|
2385
|
+
async (c) => {
|
|
2386
|
+
if (!h) {
|
|
2387
|
+
console.error(k("noUrl"));
|
|
2388
|
+
return;
|
|
2389
|
+
}
|
|
2390
|
+
o == null || o("uploader:start", { items: c, data: B() });
|
|
2391
|
+
for (const S of c)
|
|
2392
|
+
try {
|
|
2393
|
+
R(
|
|
2394
|
+
(W) => W.map((D) => D.id === S.id ? { ...D, status: "uploading" } : D)
|
|
2395
|
+
);
|
|
2396
|
+
const w = await kr(S.file, h, v, d, (W) => {
|
|
2397
|
+
R((D) => D.map((P) => P.id === S.id ? { ...P, progress: W } : P)), o == null || o("uploader:progress", { item: { ...S, progress: W }, data: B() });
|
|
2398
|
+
}), s = wr(S, p), L = {
|
|
2399
|
+
...S,
|
|
2400
|
+
status: "success",
|
|
2401
|
+
uploadApiRes: w,
|
|
2402
|
+
progress: 100,
|
|
2403
|
+
formData: s,
|
|
2404
|
+
// 使用自动填充后的表单数据
|
|
2405
|
+
isExpanded: p.length > 0
|
|
2406
|
+
// 上传成功后,如果有表单配置则默认展开
|
|
2407
|
+
}, j = q.map((W) => W.id === S.id ? L : W);
|
|
2408
|
+
R((W) => W.map((D) => D.id === S.id ? L : D)), o == null || o("uploader:success", { item: L, data: B(j) });
|
|
2409
|
+
} catch (w) {
|
|
2410
|
+
let s = "";
|
|
2411
|
+
if (console.log("上传错误详情:", w), w && typeof w == "object") {
|
|
2412
|
+
const W = w;
|
|
2413
|
+
if (W.response && W.response.data) {
|
|
2414
|
+
const D = W.response.data;
|
|
2415
|
+
if (console.log("错误响应数据:", D), D.errorMsg)
|
|
2416
|
+
s = D.errorMsg;
|
|
2417
|
+
else if (D.message)
|
|
2418
|
+
s = D.message;
|
|
2419
|
+
else if (D.error)
|
|
2420
|
+
s = D.error;
|
|
2421
|
+
else if (D.errorCode)
|
|
2422
|
+
switch (D.errorCode) {
|
|
2423
|
+
case "30013":
|
|
2424
|
+
s = "登录失效已过期,请重新登录";
|
|
2425
|
+
break;
|
|
2426
|
+
case "30014":
|
|
2427
|
+
s = "没有权限执行此操作";
|
|
2428
|
+
break;
|
|
2429
|
+
case "30015":
|
|
2430
|
+
s = "文件格式不支持";
|
|
2431
|
+
break;
|
|
2432
|
+
case "30016":
|
|
2433
|
+
s = "文件大小超出限制";
|
|
2434
|
+
break;
|
|
2435
|
+
default:
|
|
2436
|
+
s = `操作失败 (${D.errorCode})`;
|
|
2437
|
+
}
|
|
2438
|
+
} else if (W.message)
|
|
2439
|
+
try {
|
|
2440
|
+
const D = JSON.parse(W.message);
|
|
2441
|
+
if (console.log("解析的错误数据:", D), D.errorMsg)
|
|
2442
|
+
s = D.errorMsg;
|
|
2443
|
+
else if (D.message)
|
|
2444
|
+
s = D.message;
|
|
2445
|
+
else if (D.error)
|
|
2446
|
+
s = D.error;
|
|
2447
|
+
else if (D.errorCode)
|
|
2448
|
+
switch (D.errorCode) {
|
|
2449
|
+
case "30013":
|
|
2450
|
+
s = "登录失效已过期,请重新登录";
|
|
2451
|
+
break;
|
|
2452
|
+
case "30014":
|
|
2453
|
+
s = "没有权限执行此操作";
|
|
2454
|
+
break;
|
|
2455
|
+
case "30015":
|
|
2456
|
+
s = "文件格式不支持";
|
|
2457
|
+
break;
|
|
2458
|
+
case "30016":
|
|
2459
|
+
s = "文件大小超出限制";
|
|
2460
|
+
break;
|
|
2461
|
+
default:
|
|
2462
|
+
s = `操作失败 (${D.errorCode})`;
|
|
2463
|
+
}
|
|
2464
|
+
} catch (D) {
|
|
2465
|
+
console.log("错误消息解析失败:", D), s = W.message;
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
s || (s = k("uploadFailed")), console.log("最终使用的错误信息:", s);
|
|
2469
|
+
const L = { ...S, status: "error", error: s }, j = q.map((W) => W.id === S.id ? L : W);
|
|
2470
|
+
R((W) => W.map((D) => D.id === S.id ? L : D)), o == null || o("uploader:error", { item: L, error: s, data: B(j) });
|
|
2471
|
+
}
|
|
2472
|
+
o == null || o("uploader:complete", { items: q, data: B() });
|
|
2473
|
+
},
|
|
2474
|
+
[h, v, d, o, q, p, A.uploadFailed, B]
|
|
2475
|
+
), g = te(
|
|
2476
|
+
(c) => {
|
|
2477
|
+
R((S) => {
|
|
2478
|
+
const w = S.find((s) => s.id === c);
|
|
2479
|
+
return w && (o == null || o("uploader:remove", {
|
|
2480
|
+
itemId: c,
|
|
2481
|
+
item: w,
|
|
2482
|
+
data: B(S)
|
|
2483
|
+
})), S.filter((s) => s.id !== c);
|
|
2484
|
+
});
|
|
2485
|
+
},
|
|
2486
|
+
[o, B]
|
|
2487
|
+
), b = te(
|
|
2488
|
+
(c) => {
|
|
2489
|
+
R(
|
|
2490
|
+
(S) => S.map((w) => {
|
|
2491
|
+
if (w.id === c) {
|
|
2492
|
+
const s = {
|
|
2493
|
+
...w,
|
|
2494
|
+
isExpanded: !w.isExpanded
|
|
2495
|
+
};
|
|
2496
|
+
return console.log("Toggle Expand:", c, s.isExpanded, s.formData), o == null || o("uploader:toggleExpand", {
|
|
2497
|
+
itemId: c,
|
|
2498
|
+
isExpanded: s.isExpanded,
|
|
2499
|
+
item: s,
|
|
2500
|
+
data: B(S)
|
|
2501
|
+
}), s;
|
|
2502
|
+
}
|
|
2503
|
+
return w;
|
|
2504
|
+
})
|
|
2505
|
+
);
|
|
2506
|
+
},
|
|
2507
|
+
[o, B]
|
|
2508
|
+
), O = te(
|
|
2509
|
+
(c, S) => {
|
|
2510
|
+
console.log("FormData Change:", c, S), R((w) => {
|
|
2511
|
+
const s = w.map((L) => {
|
|
2512
|
+
if (L.id === c) {
|
|
2513
|
+
const j = {
|
|
2514
|
+
...L,
|
|
2515
|
+
formData: { ...S }
|
|
2516
|
+
// 确保数据是深拷贝
|
|
2517
|
+
};
|
|
2518
|
+
return o == null || o("uploader:formDataChange", {
|
|
2519
|
+
itemId: c,
|
|
2520
|
+
formData: j.formData,
|
|
2521
|
+
item: j,
|
|
2522
|
+
data: B(w)
|
|
2523
|
+
}), j;
|
|
2524
|
+
}
|
|
2525
|
+
return L;
|
|
2526
|
+
});
|
|
2527
|
+
return o == null || o("uploader:dataChange", {
|
|
2528
|
+
items: s,
|
|
2529
|
+
changedItemId: c,
|
|
2530
|
+
changedFormData: S,
|
|
2531
|
+
data: B(s)
|
|
2532
|
+
}), s;
|
|
2533
|
+
});
|
|
2534
|
+
},
|
|
2535
|
+
[o, B]
|
|
2536
|
+
);
|
|
2537
|
+
return /* @__PURE__ */ H("div", { children: [
|
|
2538
|
+
/* @__PURE__ */ H(
|
|
2539
|
+
Sr,
|
|
2540
|
+
{
|
|
2541
|
+
$theme: X.theme || ue,
|
|
2542
|
+
$isDragOver: m,
|
|
2543
|
+
onDragOver: y,
|
|
2544
|
+
onDragLeave: N,
|
|
2545
|
+
onDrop: x,
|
|
2546
|
+
onClick: () => {
|
|
2547
|
+
var c;
|
|
2548
|
+
r.current && (r.current.value = ""), (c = r.current) == null || c.click();
|
|
2549
|
+
},
|
|
2550
|
+
children: [
|
|
2551
|
+
/* @__PURE__ */ n(Nr, { $theme: X.theme || ue, children: (I == null ? void 0 : I.dragUpload) || /* @__PURE__ */ n(dr, { size: 48 }) }),
|
|
2552
|
+
J || /* @__PURE__ */ H(Qe, { children: [
|
|
2553
|
+
/* @__PURE__ */ n(Mr, { $theme: X.theme || ue, children: "拖拽文件到此处或点击选择文件" }),
|
|
2554
|
+
/* @__PURE__ */ H(Ue, { $theme: X.theme || ue, children: [
|
|
2555
|
+
"支持 ",
|
|
2556
|
+
a,
|
|
2557
|
+
" 格式,单个文件最大 ",
|
|
2558
|
+
t,
|
|
2559
|
+
"MB",
|
|
2560
|
+
!h && /* @__PURE__ */ n("div", { style: { color: ((T = (z = X.theme) == null ? void 0 : z.colors) == null ? void 0 : T.error) || "#FF0000", marginTop: "8px", fontSize: "12px" }, children: k("noUrl") })
|
|
2561
|
+
] })
|
|
2562
|
+
] })
|
|
2563
|
+
]
|
|
2564
|
+
}
|
|
2565
|
+
),
|
|
2566
|
+
/* @__PURE__ */ n(
|
|
2567
|
+
Tr,
|
|
2568
|
+
{
|
|
2569
|
+
ref: r,
|
|
2570
|
+
type: "file",
|
|
2571
|
+
multiple: e,
|
|
2572
|
+
accept: a,
|
|
2573
|
+
onChange: (c) => {
|
|
2574
|
+
$(c.target.files), c.target.value = "";
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
),
|
|
2578
|
+
q.length > 0 && /* @__PURE__ */ H("div", { children: [
|
|
2579
|
+
/* @__PURE__ */ H("div", { style: {
|
|
2580
|
+
display: "flex",
|
|
2581
|
+
justifyContent: "space-between",
|
|
2582
|
+
alignItems: "center",
|
|
2583
|
+
margin: "6px 0px"
|
|
2584
|
+
}, children: [
|
|
2585
|
+
/* @__PURE__ */ n("div", { className: "text-[14px] font-bold opacity-60", children: Q || "上传文件列表" }),
|
|
2586
|
+
C.length > 0 && /* @__PURE__ */ n("div", { style: {
|
|
2587
|
+
display: "flex",
|
|
2588
|
+
gap: "8px",
|
|
2589
|
+
alignItems: "center"
|
|
2590
|
+
}, children: C.map((c, S) => /* @__PURE__ */ n(
|
|
2591
|
+
be,
|
|
2592
|
+
{
|
|
2593
|
+
mode: c.mode || "default",
|
|
2594
|
+
label: c.label,
|
|
2595
|
+
icon: c.icon,
|
|
2596
|
+
disabled: c.disabled,
|
|
2597
|
+
onClick: c.onClick,
|
|
2598
|
+
styles: M
|
|
2599
|
+
},
|
|
2600
|
+
S
|
|
2601
|
+
)) })
|
|
2602
|
+
] }),
|
|
2603
|
+
/* @__PURE__ */ n(Dr, { $theme: X.theme || ue, children: q.map((c, S) => /* @__PURE__ */ n(
|
|
2604
|
+
Hr,
|
|
2605
|
+
{
|
|
2606
|
+
item: c,
|
|
2607
|
+
index: S,
|
|
2608
|
+
itemForm: p,
|
|
2609
|
+
onRemove: g,
|
|
2610
|
+
onToggleExpand: b,
|
|
2611
|
+
onFormDataChange: O,
|
|
2612
|
+
theme: X.theme || ue,
|
|
2613
|
+
icons: I
|
|
2614
|
+
},
|
|
2615
|
+
c.id
|
|
2616
|
+
)) })
|
|
2617
|
+
] })
|
|
2618
|
+
] });
|
|
2619
|
+
}, va = (e) => {
|
|
2620
|
+
const a = {};
|
|
2621
|
+
return e.forEach((t) => {
|
|
2622
|
+
const i = t.name ?? t.key;
|
|
2623
|
+
t.defaultValue !== void 0 && i && (a[i] = t.defaultValue);
|
|
2624
|
+
}), a;
|
|
2625
|
+
}, wa = (e, a) => {
|
|
2626
|
+
const t = {};
|
|
2627
|
+
return a.forEach((i) => {
|
|
2628
|
+
var d;
|
|
2629
|
+
const u = i.name ?? i.key, h = e[u], v = i.validation || [];
|
|
2630
|
+
if (i.required && (h == null || h === "")) {
|
|
2631
|
+
t[u] = ((d = v.find((p) => p.required)) == null ? void 0 : d.message) || `${i.label}是必填项`;
|
|
2632
|
+
return;
|
|
2633
|
+
}
|
|
2634
|
+
v.forEach((p) => {
|
|
2635
|
+
if (p.required && (h == null || h === "")) {
|
|
2636
|
+
t[u] = p.message || `${i.label}是必填项`;
|
|
2637
|
+
return;
|
|
2638
|
+
}
|
|
2639
|
+
if (p.pattern && h && !p.pattern.test(h)) {
|
|
2640
|
+
t[u] = p.message || `${i.label}格式不正确`;
|
|
2641
|
+
return;
|
|
2642
|
+
}
|
|
2643
|
+
if (p.min !== void 0 && h < p.min) {
|
|
2644
|
+
t[u] = p.message || `${i.label}不能小于${p.min}`;
|
|
2645
|
+
return;
|
|
2646
|
+
}
|
|
2647
|
+
if (p.max !== void 0 && h > p.max) {
|
|
2648
|
+
t[u] = p.message || `${i.label}不能大于${p.max}`;
|
|
2649
|
+
return;
|
|
2650
|
+
}
|
|
2651
|
+
if (p.validator && typeof p.validator == "function") {
|
|
2652
|
+
const M = p.validator(h);
|
|
2653
|
+
if (M !== !0) {
|
|
2654
|
+
t[u] = typeof M == "string" ? M : `${i.label}验证失败`;
|
|
2655
|
+
return;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
});
|
|
2659
|
+
}), t;
|
|
2660
|
+
}, ka = (e = 5) => {
|
|
2661
|
+
const a = [];
|
|
2662
|
+
for (let t = 0; t < e; t++) {
|
|
2663
|
+
const i = ["input", "select", "radio", "checkbox", "date", "number"], u = i[t % i.length];
|
|
2664
|
+
a.push({
|
|
2665
|
+
key: `field_${t + 1}`,
|
|
2666
|
+
label: `字段 ${t + 1}`,
|
|
2667
|
+
type: u,
|
|
2668
|
+
required: t < 2,
|
|
2669
|
+
placeholder: `请输入字段 ${t + 1}`,
|
|
2670
|
+
...u === "select" && {
|
|
2671
|
+
options: [
|
|
2672
|
+
{ label: "选项 1", value: "option1" },
|
|
2673
|
+
{ label: "选项 2", value: "option2" },
|
|
2674
|
+
{ label: "选项 3", value: "option3" }
|
|
2675
|
+
]
|
|
2676
|
+
},
|
|
2677
|
+
...u === "radio" && {
|
|
2678
|
+
options: [
|
|
2679
|
+
{ label: "选项 A", value: "a" },
|
|
2680
|
+
{ label: "选项 B", value: "b" },
|
|
2681
|
+
{ label: "选项 C", value: "c" }
|
|
2682
|
+
]
|
|
2683
|
+
},
|
|
2684
|
+
...u === "number" && {
|
|
2685
|
+
validation: [
|
|
2686
|
+
{ min: 0, max: 100, message: "数值必须在 0-100 之间" }
|
|
2687
|
+
]
|
|
2688
|
+
}
|
|
2689
|
+
});
|
|
2690
|
+
}
|
|
2691
|
+
return a;
|
|
2692
|
+
}, Sa = (e) => Object.keys(e).length === 0, Na = (e) => Object.values(e).filter(Boolean);
|
|
2693
|
+
function nr(e) {
|
|
2694
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2695
|
+
}
|
|
2696
|
+
var ke = { exports: {} }, Ur = ke.exports, Ee;
|
|
2697
|
+
function sr() {
|
|
2698
|
+
return Ee || (Ee = 1, (function(e, a) {
|
|
2699
|
+
(function(t, i) {
|
|
2700
|
+
e.exports = i();
|
|
2701
|
+
})(Ur, (function() {
|
|
2702
|
+
var t = 1e3, i = 6e4, u = 36e5, h = "millisecond", v = "second", d = "minute", p = "hour", M = "day", C = "week", _ = "month", I = "quarter", o = "year", F = "date", U = "Invalid Date", Q = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, X = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, r = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(l) {
|
|
2703
|
+
var $ = ["th", "st", "nd", "rd"], y = l % 100;
|
|
2704
|
+
return "[" + l + ($[(y - 20) % 10] || $[y] || $[0]) + "]";
|
|
2705
|
+
} }, m = function(l, $, y) {
|
|
2706
|
+
var N = String(l);
|
|
2707
|
+
return !N || N.length >= $ ? l : "" + Array($ + 1 - N.length).join(y) + l;
|
|
2708
|
+
}, V = { s: m, z: function(l) {
|
|
2709
|
+
var $ = -l.utcOffset(), y = Math.abs($), N = Math.floor(y / 60), x = y % 60;
|
|
2710
|
+
return ($ <= 0 ? "+" : "-") + m(N, 2, "0") + ":" + m(x, 2, "0");
|
|
2711
|
+
}, m: function l($, y) {
|
|
2712
|
+
if ($.date() < y.date()) return -l(y, $);
|
|
2713
|
+
var N = 12 * (y.year() - $.year()) + (y.month() - $.month()), x = $.clone().add(N, _), f = y - x < 0, g = $.clone().add(N + (f ? -1 : 1), _);
|
|
2714
|
+
return +(-(N + (y - x) / (f ? x - g : g - x)) || 0);
|
|
2715
|
+
}, a: function(l) {
|
|
2716
|
+
return l < 0 ? Math.ceil(l) || 0 : Math.floor(l);
|
|
2717
|
+
}, p: function(l) {
|
|
2718
|
+
return { M: _, y: o, w: C, d: M, D: F, h: p, m: d, s: v, ms: h, Q: I }[l] || String(l || "").toLowerCase().replace(/s$/, "");
|
|
2719
|
+
}, u: function(l) {
|
|
2720
|
+
return l === void 0;
|
|
2721
|
+
} }, q = "en", R = {};
|
|
2722
|
+
R[q] = r;
|
|
2723
|
+
var B = "$isDayjsObject", J = function(l) {
|
|
2724
|
+
return l instanceof K || !(!l || !l[B]);
|
|
2725
|
+
}, G = function l($, y, N) {
|
|
2726
|
+
var x;
|
|
2727
|
+
if (!$) return q;
|
|
2728
|
+
if (typeof $ == "string") {
|
|
2729
|
+
var f = $.toLowerCase();
|
|
2730
|
+
R[f] && (x = f), y && (R[f] = y, x = f);
|
|
2731
|
+
var g = $.split("-");
|
|
2732
|
+
if (!x && g.length > 1) return l(g[0]);
|
|
2733
|
+
} else {
|
|
2734
|
+
var b = $.name;
|
|
2735
|
+
R[b] = $, x = b;
|
|
2736
|
+
}
|
|
2737
|
+
return !N && x && (q = x), x || !N && q;
|
|
2738
|
+
}, A = function(l, $) {
|
|
2739
|
+
if (J(l)) return l.clone();
|
|
2740
|
+
var y = typeof $ == "object" ? $ : {};
|
|
2741
|
+
return y.date = l, y.args = arguments, new K(y);
|
|
2742
|
+
}, k = V;
|
|
2743
|
+
k.l = G, k.i = J, k.w = function(l, $) {
|
|
2744
|
+
return A(l, { locale: $.$L, utc: $.$u, x: $.$x, $offset: $.$offset });
|
|
2745
|
+
};
|
|
2746
|
+
var K = (function() {
|
|
2747
|
+
function l(y) {
|
|
2748
|
+
this.$L = G(y.locale, null, !0), this.parse(y), this.$x = this.$x || y.x || {}, this[B] = !0;
|
|
2749
|
+
}
|
|
2750
|
+
var $ = l.prototype;
|
|
2751
|
+
return $.parse = function(y) {
|
|
2752
|
+
this.$d = (function(N) {
|
|
2753
|
+
var x = N.date, f = N.utc;
|
|
2754
|
+
if (x === null) return /* @__PURE__ */ new Date(NaN);
|
|
2755
|
+
if (k.u(x)) return /* @__PURE__ */ new Date();
|
|
2756
|
+
if (x instanceof Date) return new Date(x);
|
|
2757
|
+
if (typeof x == "string" && !/Z$/i.test(x)) {
|
|
2758
|
+
var g = x.match(Q);
|
|
2759
|
+
if (g) {
|
|
2760
|
+
var b = g[2] - 1 || 0, O = (g[7] || "0").substring(0, 3);
|
|
2761
|
+
return f ? new Date(Date.UTC(g[1], b, g[3] || 1, g[4] || 0, g[5] || 0, g[6] || 0, O)) : new Date(g[1], b, g[3] || 1, g[4] || 0, g[5] || 0, g[6] || 0, O);
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
return new Date(x);
|
|
2765
|
+
})(y), this.init();
|
|
2766
|
+
}, $.init = function() {
|
|
2767
|
+
var y = this.$d;
|
|
2768
|
+
this.$y = y.getFullYear(), this.$M = y.getMonth(), this.$D = y.getDate(), this.$W = y.getDay(), this.$H = y.getHours(), this.$m = y.getMinutes(), this.$s = y.getSeconds(), this.$ms = y.getMilliseconds();
|
|
2769
|
+
}, $.$utils = function() {
|
|
2770
|
+
return k;
|
|
2771
|
+
}, $.isValid = function() {
|
|
2772
|
+
return this.$d.toString() !== U;
|
|
2773
|
+
}, $.isSame = function(y, N) {
|
|
2774
|
+
var x = A(y);
|
|
2775
|
+
return this.startOf(N) <= x && x <= this.endOf(N);
|
|
2776
|
+
}, $.isAfter = function(y, N) {
|
|
2777
|
+
return A(y) < this.startOf(N);
|
|
2778
|
+
}, $.isBefore = function(y, N) {
|
|
2779
|
+
return this.endOf(N) < A(y);
|
|
2780
|
+
}, $.$g = function(y, N, x) {
|
|
2781
|
+
return k.u(y) ? this[N] : this.set(x, y);
|
|
2782
|
+
}, $.unix = function() {
|
|
2783
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
2784
|
+
}, $.valueOf = function() {
|
|
2785
|
+
return this.$d.getTime();
|
|
2786
|
+
}, $.startOf = function(y, N) {
|
|
2787
|
+
var x = this, f = !!k.u(N) || N, g = k.p(y), b = function(L, j) {
|
|
2788
|
+
var W = k.w(x.$u ? Date.UTC(x.$y, j, L) : new Date(x.$y, j, L), x);
|
|
2789
|
+
return f ? W : W.endOf(M);
|
|
2790
|
+
}, O = function(L, j) {
|
|
2791
|
+
return k.w(x.toDate()[L].apply(x.toDate("s"), (f ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(j)), x);
|
|
2792
|
+
}, z = this.$W, T = this.$M, c = this.$D, S = "set" + (this.$u ? "UTC" : "");
|
|
2793
|
+
switch (g) {
|
|
2794
|
+
case o:
|
|
2795
|
+
return f ? b(1, 0) : b(31, 11);
|
|
2796
|
+
case _:
|
|
2797
|
+
return f ? b(1, T) : b(0, T + 1);
|
|
2798
|
+
case C:
|
|
2799
|
+
var w = this.$locale().weekStart || 0, s = (z < w ? z + 7 : z) - w;
|
|
2800
|
+
return b(f ? c - s : c + (6 - s), T);
|
|
2801
|
+
case M:
|
|
2802
|
+
case F:
|
|
2803
|
+
return O(S + "Hours", 0);
|
|
2804
|
+
case p:
|
|
2805
|
+
return O(S + "Minutes", 1);
|
|
2806
|
+
case d:
|
|
2807
|
+
return O(S + "Seconds", 2);
|
|
2808
|
+
case v:
|
|
2809
|
+
return O(S + "Milliseconds", 3);
|
|
2810
|
+
default:
|
|
2811
|
+
return this.clone();
|
|
2812
|
+
}
|
|
2813
|
+
}, $.endOf = function(y) {
|
|
2814
|
+
return this.startOf(y, !1);
|
|
2815
|
+
}, $.$set = function(y, N) {
|
|
2816
|
+
var x, f = k.p(y), g = "set" + (this.$u ? "UTC" : ""), b = (x = {}, x[M] = g + "Date", x[F] = g + "Date", x[_] = g + "Month", x[o] = g + "FullYear", x[p] = g + "Hours", x[d] = g + "Minutes", x[v] = g + "Seconds", x[h] = g + "Milliseconds", x)[f], O = f === M ? this.$D + (N - this.$W) : N;
|
|
2817
|
+
if (f === _ || f === o) {
|
|
2818
|
+
var z = this.clone().set(F, 1);
|
|
2819
|
+
z.$d[b](O), z.init(), this.$d = z.set(F, Math.min(this.$D, z.daysInMonth())).$d;
|
|
2820
|
+
} else b && this.$d[b](O);
|
|
2821
|
+
return this.init(), this;
|
|
2822
|
+
}, $.set = function(y, N) {
|
|
2823
|
+
return this.clone().$set(y, N);
|
|
2824
|
+
}, $.get = function(y) {
|
|
2825
|
+
return this[k.p(y)]();
|
|
2826
|
+
}, $.add = function(y, N) {
|
|
2827
|
+
var x, f = this;
|
|
2828
|
+
y = Number(y);
|
|
2829
|
+
var g = k.p(N), b = function(T) {
|
|
2830
|
+
var c = A(f);
|
|
2831
|
+
return k.w(c.date(c.date() + Math.round(T * y)), f);
|
|
2832
|
+
};
|
|
2833
|
+
if (g === _) return this.set(_, this.$M + y);
|
|
2834
|
+
if (g === o) return this.set(o, this.$y + y);
|
|
2835
|
+
if (g === M) return b(1);
|
|
2836
|
+
if (g === C) return b(7);
|
|
2837
|
+
var O = (x = {}, x[d] = i, x[p] = u, x[v] = t, x)[g] || 1, z = this.$d.getTime() + y * O;
|
|
2838
|
+
return k.w(z, this);
|
|
2839
|
+
}, $.subtract = function(y, N) {
|
|
2840
|
+
return this.add(-1 * y, N);
|
|
2841
|
+
}, $.format = function(y) {
|
|
2842
|
+
var N = this, x = this.$locale();
|
|
2843
|
+
if (!this.isValid()) return x.invalidDate || U;
|
|
2844
|
+
var f = y || "YYYY-MM-DDTHH:mm:ssZ", g = k.z(this), b = this.$H, O = this.$m, z = this.$M, T = x.weekdays, c = x.months, S = x.meridiem, w = function(j, W, D, P) {
|
|
2845
|
+
return j && (j[W] || j(N, f)) || D[W].slice(0, P);
|
|
2846
|
+
}, s = function(j) {
|
|
2847
|
+
return k.s(b % 12 || 12, j, "0");
|
|
2848
|
+
}, L = S || function(j, W, D) {
|
|
2849
|
+
var P = j < 12 ? "AM" : "PM";
|
|
2850
|
+
return D ? P.toLowerCase() : P;
|
|
2851
|
+
};
|
|
2852
|
+
return f.replace(X, (function(j, W) {
|
|
2853
|
+
return W || (function(D) {
|
|
2854
|
+
switch (D) {
|
|
2855
|
+
case "YY":
|
|
2856
|
+
return String(N.$y).slice(-2);
|
|
2857
|
+
case "YYYY":
|
|
2858
|
+
return k.s(N.$y, 4, "0");
|
|
2859
|
+
case "M":
|
|
2860
|
+
return z + 1;
|
|
2861
|
+
case "MM":
|
|
2862
|
+
return k.s(z + 1, 2, "0");
|
|
2863
|
+
case "MMM":
|
|
2864
|
+
return w(x.monthsShort, z, c, 3);
|
|
2865
|
+
case "MMMM":
|
|
2866
|
+
return w(c, z);
|
|
2867
|
+
case "D":
|
|
2868
|
+
return N.$D;
|
|
2869
|
+
case "DD":
|
|
2870
|
+
return k.s(N.$D, 2, "0");
|
|
2871
|
+
case "d":
|
|
2872
|
+
return String(N.$W);
|
|
2873
|
+
case "dd":
|
|
2874
|
+
return w(x.weekdaysMin, N.$W, T, 2);
|
|
2875
|
+
case "ddd":
|
|
2876
|
+
return w(x.weekdaysShort, N.$W, T, 3);
|
|
2877
|
+
case "dddd":
|
|
2878
|
+
return T[N.$W];
|
|
2879
|
+
case "H":
|
|
2880
|
+
return String(b);
|
|
2881
|
+
case "HH":
|
|
2882
|
+
return k.s(b, 2, "0");
|
|
2883
|
+
case "h":
|
|
2884
|
+
return s(1);
|
|
2885
|
+
case "hh":
|
|
2886
|
+
return s(2);
|
|
2887
|
+
case "a":
|
|
2888
|
+
return L(b, O, !0);
|
|
2889
|
+
case "A":
|
|
2890
|
+
return L(b, O, !1);
|
|
2891
|
+
case "m":
|
|
2892
|
+
return String(O);
|
|
2893
|
+
case "mm":
|
|
2894
|
+
return k.s(O, 2, "0");
|
|
2895
|
+
case "s":
|
|
2896
|
+
return String(N.$s);
|
|
2897
|
+
case "ss":
|
|
2898
|
+
return k.s(N.$s, 2, "0");
|
|
2899
|
+
case "SSS":
|
|
2900
|
+
return k.s(N.$ms, 3, "0");
|
|
2901
|
+
case "Z":
|
|
2902
|
+
return g;
|
|
2903
|
+
}
|
|
2904
|
+
return null;
|
|
2905
|
+
})(j) || g.replace(":", "");
|
|
2906
|
+
}));
|
|
2907
|
+
}, $.utcOffset = function() {
|
|
2908
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
2909
|
+
}, $.diff = function(y, N, x) {
|
|
2910
|
+
var f, g = this, b = k.p(N), O = A(y), z = (O.utcOffset() - this.utcOffset()) * i, T = this - O, c = function() {
|
|
2911
|
+
return k.m(g, O);
|
|
2912
|
+
};
|
|
2913
|
+
switch (b) {
|
|
2914
|
+
case o:
|
|
2915
|
+
f = c() / 12;
|
|
2916
|
+
break;
|
|
2917
|
+
case _:
|
|
2918
|
+
f = c();
|
|
2919
|
+
break;
|
|
2920
|
+
case I:
|
|
2921
|
+
f = c() / 3;
|
|
2922
|
+
break;
|
|
2923
|
+
case C:
|
|
2924
|
+
f = (T - z) / 6048e5;
|
|
2925
|
+
break;
|
|
2926
|
+
case M:
|
|
2927
|
+
f = (T - z) / 864e5;
|
|
2928
|
+
break;
|
|
2929
|
+
case p:
|
|
2930
|
+
f = T / u;
|
|
2931
|
+
break;
|
|
2932
|
+
case d:
|
|
2933
|
+
f = T / i;
|
|
2934
|
+
break;
|
|
2935
|
+
case v:
|
|
2936
|
+
f = T / t;
|
|
2937
|
+
break;
|
|
2938
|
+
default:
|
|
2939
|
+
f = T;
|
|
2940
|
+
}
|
|
2941
|
+
return x ? f : k.a(f);
|
|
2942
|
+
}, $.daysInMonth = function() {
|
|
2943
|
+
return this.endOf(_).$D;
|
|
2944
|
+
}, $.$locale = function() {
|
|
2945
|
+
return R[this.$L];
|
|
2946
|
+
}, $.locale = function(y, N) {
|
|
2947
|
+
if (!y) return this.$L;
|
|
2948
|
+
var x = this.clone(), f = G(y, N, !0);
|
|
2949
|
+
return f && (x.$L = f), x;
|
|
2950
|
+
}, $.clone = function() {
|
|
2951
|
+
return k.w(this.$d, this);
|
|
2952
|
+
}, $.toDate = function() {
|
|
2953
|
+
return new Date(this.valueOf());
|
|
2954
|
+
}, $.toJSON = function() {
|
|
2955
|
+
return this.isValid() ? this.toISOString() : null;
|
|
2956
|
+
}, $.toISOString = function() {
|
|
2957
|
+
return this.$d.toISOString();
|
|
2958
|
+
}, $.toString = function() {
|
|
2959
|
+
return this.$d.toUTCString();
|
|
2960
|
+
}, l;
|
|
2961
|
+
})(), ee = K.prototype;
|
|
2962
|
+
return A.prototype = ee, [["$ms", h], ["$s", v], ["$m", d], ["$H", p], ["$W", M], ["$M", _], ["$y", o], ["$D", F]].forEach((function(l) {
|
|
2963
|
+
ee[l[1]] = function($) {
|
|
2964
|
+
return this.$g($, l[0], l[1]);
|
|
2965
|
+
};
|
|
2966
|
+
})), A.extend = function(l, $) {
|
|
2967
|
+
return l.$i || (l($, K, A), l.$i = !0), A;
|
|
2968
|
+
}, A.locale = G, A.isDayjs = J, A.unix = function(l) {
|
|
2969
|
+
return A(1e3 * l);
|
|
2970
|
+
}, A.en = R[q], A.Ls = R, A.p = {}, A;
|
|
2971
|
+
}));
|
|
2972
|
+
})(ke)), ke.exports;
|
|
2973
|
+
}
|
|
2974
|
+
var Vr = sr();
|
|
2975
|
+
const De = /* @__PURE__ */ nr(Vr);
|
|
2976
|
+
var Se = { exports: {} }, Er = Se.exports, Je;
|
|
2977
|
+
function Jr() {
|
|
2978
|
+
return Je || (Je = 1, (function(e, a) {
|
|
2979
|
+
(function(t, i) {
|
|
2980
|
+
e.exports = i();
|
|
2981
|
+
})(Er, (function() {
|
|
2982
|
+
return function(t, i, u) {
|
|
2983
|
+
t = t || {};
|
|
2984
|
+
var h = i.prototype, v = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
|
|
2985
|
+
function d(M, C, _, I) {
|
|
2986
|
+
return h.fromToBase(M, C, _, I);
|
|
2987
|
+
}
|
|
2988
|
+
u.en.relativeTime = v, h.fromToBase = function(M, C, _, I, o) {
|
|
2989
|
+
for (var F, U, Q, X = _.$locale().relativeTime || v, r = t.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m = r.length, V = 0; V < m; V += 1) {
|
|
2990
|
+
var q = r[V];
|
|
2991
|
+
q.d && (F = I ? u(M).diff(_, q.d, !0) : _.diff(M, q.d, !0));
|
|
2992
|
+
var R = (t.rounding || Math.round)(Math.abs(F));
|
|
2993
|
+
if (Q = F > 0, R <= q.r || !q.r) {
|
|
2994
|
+
R <= 1 && V > 0 && (q = r[V - 1]);
|
|
2995
|
+
var B = X[q.l];
|
|
2996
|
+
o && (R = o("" + R)), U = typeof B == "string" ? B.replace("%d", R) : B(R, C, q.l, Q);
|
|
2997
|
+
break;
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
if (C) return U;
|
|
3001
|
+
var J = Q ? X.future : X.past;
|
|
3002
|
+
return typeof J == "function" ? J(U) : J.replace("%s", U);
|
|
3003
|
+
}, h.to = function(M, C) {
|
|
3004
|
+
return d(M, C, this, !0);
|
|
3005
|
+
}, h.from = function(M, C) {
|
|
3006
|
+
return d(M, C, this);
|
|
3007
|
+
};
|
|
3008
|
+
var p = function(M) {
|
|
3009
|
+
return M.$u ? u.utc() : u();
|
|
3010
|
+
};
|
|
3011
|
+
h.toNow = function(M) {
|
|
3012
|
+
return this.to(p(this), M);
|
|
3013
|
+
}, h.fromNow = function(M) {
|
|
3014
|
+
return this.from(p(this), M);
|
|
3015
|
+
};
|
|
3016
|
+
};
|
|
3017
|
+
}));
|
|
3018
|
+
})(Se)), Se.exports;
|
|
3019
|
+
}
|
|
3020
|
+
var Gr = Jr();
|
|
3021
|
+
const Xr = /* @__PURE__ */ nr(Gr);
|
|
3022
|
+
var Ne = { exports: {} }, Zr = Ne.exports, Ge;
|
|
3023
|
+
function Kr() {
|
|
3024
|
+
return Ge || (Ge = 1, (function(e, a) {
|
|
3025
|
+
(function(t, i) {
|
|
3026
|
+
e.exports = i(sr());
|
|
3027
|
+
})(Zr, (function(t) {
|
|
3028
|
+
function i(v) {
|
|
3029
|
+
return v && typeof v == "object" && "default" in v ? v : { default: v };
|
|
3030
|
+
}
|
|
3031
|
+
var u = i(t), h = { name: "zh-cn", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(v, d) {
|
|
3032
|
+
return d === "W" ? v + "周" : v + "日";
|
|
3033
|
+
}, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s内", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(v, d) {
|
|
3034
|
+
var p = 100 * v + d;
|
|
3035
|
+
return p < 600 ? "凌晨" : p < 900 ? "早上" : p < 1100 ? "上午" : p < 1300 ? "中午" : p < 1800 ? "下午" : "晚上";
|
|
3036
|
+
} };
|
|
3037
|
+
return u.default.locale(h, null, !0), h;
|
|
3038
|
+
}));
|
|
3039
|
+
})(Ne)), Ne.exports;
|
|
3040
|
+
}
|
|
3041
|
+
Kr();
|
|
3042
|
+
De.locale("zh-cn");
|
|
3043
|
+
De.extend(Xr);
|
|
3044
|
+
const Xe = {
|
|
3045
|
+
success: "green",
|
|
3046
|
+
error: "red",
|
|
3047
|
+
warning: "orange",
|
|
3048
|
+
processing: "blue",
|
|
3049
|
+
info: "cyan",
|
|
3050
|
+
default: "default"
|
|
3051
|
+
};
|
|
3052
|
+
function Pr(e) {
|
|
3053
|
+
if (!e) return "-";
|
|
3054
|
+
const a = De(e), t = a.format("YYYY年M月D日 HH:mm"), i = a.fromNow();
|
|
3055
|
+
return /* @__PURE__ */ n(
|
|
3056
|
+
Te,
|
|
3057
|
+
{
|
|
3058
|
+
title: /* @__PURE__ */ n("div", { style: { minWidth: 120 }, children: /* @__PURE__ */ n("div", { style: { color: "#aaa", fontSize: 12, marginTop: 2 }, children: i }) }),
|
|
3059
|
+
children: /* @__PURE__ */ n("span", { style: { fontWeight: 500, opacity: 0.6 }, children: t })
|
|
3060
|
+
}
|
|
3061
|
+
);
|
|
3062
|
+
}
|
|
3063
|
+
function Qr(e, a) {
|
|
3064
|
+
if (e == null || e === "") return "-";
|
|
3065
|
+
const t = Number(e);
|
|
3066
|
+
if (isNaN(t)) return e;
|
|
3067
|
+
switch (a) {
|
|
3068
|
+
case "rmb":
|
|
3069
|
+
return `¥${t.toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
3070
|
+
case "usd":
|
|
3071
|
+
return `$${t.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
3072
|
+
case "filesize":
|
|
3073
|
+
return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(2)} KB` : t < 1024 * 1024 * 1024 ? `${(t / 1024 / 1024).toFixed(2)} MB` : `${(t / 1024 / 1024 / 1024).toFixed(2)} GB`;
|
|
3074
|
+
case "float":
|
|
3075
|
+
default:
|
|
3076
|
+
return t.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
function ea(e, a, t = {}) {
|
|
3080
|
+
const { eventsEmit: i } = a || {};
|
|
3081
|
+
return oe.useMemo(
|
|
3082
|
+
() => e.map((u) => {
|
|
3083
|
+
if (u.render) return u;
|
|
3084
|
+
switch (u.type) {
|
|
3085
|
+
case "customized":
|
|
3086
|
+
return {
|
|
3087
|
+
...u,
|
|
3088
|
+
render: (h, v, d) => {
|
|
3089
|
+
var X, r;
|
|
3090
|
+
const p = d == null ? void 0 : d.value;
|
|
3091
|
+
let C = p && typeof p == "object" && (p.component || p.Comp) ? p.component || p.Comp : u.component;
|
|
3092
|
+
if (typeof C == "string" && (C = ((X = a == null ? void 0 : a.customizeComponents) == null ? void 0 : X[C]) || ((r = t == null ? void 0 : t.customizeComponents) == null ? void 0 : r[C])), !C)
|
|
3093
|
+
return u.fallback ?? null;
|
|
3094
|
+
const _ = p && typeof p == "object" && "data" in p ? p.data : d == null ? void 0 : d.value, I = typeof u.componentProps == "function" ? u.componentProps({ value: _, row: v, cell: d, col: u }) : u.componentProps || {}, o = p && typeof p == "object" && "props" in p ? p.props || {} : {};
|
|
3095
|
+
let F = {};
|
|
3096
|
+
if (p && typeof p == "object") {
|
|
3097
|
+
const m = /* @__PURE__ */ new Set(["component", "Comp", "props"]);
|
|
3098
|
+
Object.keys(p).forEach((V) => {
|
|
3099
|
+
m.has(V) || (F[V] = p[V]);
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
const Q = {
|
|
3103
|
+
value: _,
|
|
3104
|
+
row: v,
|
|
3105
|
+
cell: d,
|
|
3106
|
+
col: u,
|
|
3107
|
+
emit: (m, V) => {
|
|
3108
|
+
var q;
|
|
3109
|
+
return (q = a == null ? void 0 : a.eventsEmit) == null ? void 0 : q.call(a, m, { row: v, cell: d, col: u, data: V });
|
|
3110
|
+
},
|
|
3111
|
+
...I,
|
|
3112
|
+
...F,
|
|
3113
|
+
...o
|
|
3114
|
+
};
|
|
3115
|
+
if (oe.isValidElement(C))
|
|
3116
|
+
return oe.cloneElement(C, Q);
|
|
3117
|
+
if (typeof C == "function") {
|
|
3118
|
+
const m = C;
|
|
3119
|
+
return oe.createElement(m, Q);
|
|
3120
|
+
}
|
|
3121
|
+
return u.fallback ?? null;
|
|
3122
|
+
}
|
|
3123
|
+
};
|
|
3124
|
+
case "status":
|
|
3125
|
+
return {
|
|
3126
|
+
...u,
|
|
3127
|
+
render: (h, v, d) => {
|
|
3128
|
+
const p = (d == null ? void 0 : d.statusType) || "default", M = Xe[p] || Xe.default;
|
|
3129
|
+
return /* @__PURE__ */ n(pr, { color: M, children: h });
|
|
3130
|
+
}
|
|
3131
|
+
};
|
|
3132
|
+
case "date":
|
|
3133
|
+
return {
|
|
3134
|
+
...u,
|
|
3135
|
+
render: (h) => Pr(h)
|
|
3136
|
+
};
|
|
3137
|
+
case "number":
|
|
3138
|
+
return {
|
|
3139
|
+
...u,
|
|
3140
|
+
render: (h) => {
|
|
3141
|
+
const v = u.numberStyle || "float";
|
|
3142
|
+
return /* @__PURE__ */ n(
|
|
3143
|
+
"span",
|
|
3144
|
+
{
|
|
3145
|
+
style: {
|
|
3146
|
+
textAlign: "right",
|
|
3147
|
+
display: "block",
|
|
3148
|
+
color: "#2563eb",
|
|
3149
|
+
fontWeight: 500,
|
|
3150
|
+
fontVariantNumeric: "tabular-nums",
|
|
3151
|
+
fontFamily: "Consolas, Menlo, monospace"
|
|
3152
|
+
},
|
|
3153
|
+
children: Qr(h, v)
|
|
3154
|
+
}
|
|
3155
|
+
);
|
|
3156
|
+
}
|
|
3157
|
+
};
|
|
3158
|
+
case "image":
|
|
3159
|
+
return {
|
|
3160
|
+
...u,
|
|
3161
|
+
render: (h) => h ? /* @__PURE__ */ n(
|
|
3162
|
+
"img",
|
|
3163
|
+
{
|
|
3164
|
+
src: h,
|
|
3165
|
+
style: {
|
|
3166
|
+
width: 36,
|
|
3167
|
+
height: 36,
|
|
3168
|
+
borderRadius: 8,
|
|
3169
|
+
objectFit: "cover",
|
|
3170
|
+
boxShadow: "0 1px 4px 0 rgba(0,0,0,0.04)"
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
) : null
|
|
3174
|
+
};
|
|
3175
|
+
case "longText":
|
|
3176
|
+
return {
|
|
3177
|
+
...u,
|
|
3178
|
+
render: (h) => {
|
|
3179
|
+
const v = u.maxRow || 1, d = u.maxWidth || 240, p = u.areaStyle || "default", M = 13, C = 1.6, _ = M * C, I = v * _;
|
|
3180
|
+
let o = {
|
|
3181
|
+
maxWidth: typeof d == "number" ? `${d}px` : d,
|
|
3182
|
+
maxHeight: I,
|
|
3183
|
+
overflowY: "auto",
|
|
3184
|
+
color: p === "code" ? "#d4d4d4" : "#666",
|
|
3185
|
+
opacity: p === "code" ? 1 : 0.85,
|
|
3186
|
+
fontSize: M,
|
|
3187
|
+
lineHeight: C,
|
|
3188
|
+
padding: "6px 10px",
|
|
3189
|
+
background: p === "code" ? "#1e1e1e" : "#f6f8fa",
|
|
3190
|
+
borderRadius: 6,
|
|
3191
|
+
fontFamily: p === "code" ? '"SF Mono", "Consolas", "Menlo", monospace' : void 0,
|
|
3192
|
+
border: p === "code" ? "1px solid #232323" : "1px solid #e5e7eb",
|
|
3193
|
+
whiteSpace: "pre-wrap",
|
|
3194
|
+
wordBreak: "break-all",
|
|
3195
|
+
boxSizing: "border-box",
|
|
3196
|
+
width: "100%",
|
|
3197
|
+
display: "block"
|
|
3198
|
+
};
|
|
3199
|
+
return /* @__PURE__ */ n("span", { style: o, children: h });
|
|
3200
|
+
}
|
|
3201
|
+
};
|
|
3202
|
+
case "tag":
|
|
3203
|
+
return {
|
|
3204
|
+
...u,
|
|
3205
|
+
render: (h) => Array.isArray(h) ? /* @__PURE__ */ n(
|
|
3206
|
+
"div",
|
|
3207
|
+
{
|
|
3208
|
+
style: {
|
|
3209
|
+
display: "flex",
|
|
3210
|
+
flexWrap: "wrap",
|
|
3211
|
+
gap: "6px",
|
|
3212
|
+
minWidth: "200px",
|
|
3213
|
+
maxWidth: "100%"
|
|
3214
|
+
},
|
|
3215
|
+
children: h.map((v, d) => /* @__PURE__ */ n(
|
|
3216
|
+
"span",
|
|
3217
|
+
{
|
|
3218
|
+
style: {
|
|
3219
|
+
display: "inline-block",
|
|
3220
|
+
background: "#EBF4FF",
|
|
3221
|
+
color: "#2563eb",
|
|
3222
|
+
borderRadius: 12,
|
|
3223
|
+
padding: "4px 12px",
|
|
3224
|
+
fontSize: 12,
|
|
3225
|
+
border: "1px solid #BFDBFE",
|
|
3226
|
+
fontWeight: 500,
|
|
3227
|
+
lineHeight: "16px",
|
|
3228
|
+
whiteSpace: "nowrap",
|
|
3229
|
+
boxShadow: "0 1px 2px rgba(37, 99, 235, 0.1)",
|
|
3230
|
+
flexShrink: 0
|
|
3231
|
+
},
|
|
3232
|
+
children: v
|
|
3233
|
+
},
|
|
3234
|
+
d
|
|
3235
|
+
))
|
|
3236
|
+
}
|
|
3237
|
+
) : null
|
|
3238
|
+
};
|
|
3239
|
+
case "action":
|
|
3240
|
+
return {
|
|
3241
|
+
...u,
|
|
3242
|
+
render: (h, v, d) => {
|
|
3243
|
+
const p = a != null && a.isPending ? a.isPending(v.id) : !1;
|
|
3244
|
+
if (Array.isArray(h)) {
|
|
3245
|
+
const C = h.map((_) => _ && typeof _ == "object" && (_.columnId === "actions" || _.type === "action") && "value" in _ && !("mode" in _) ? {
|
|
3246
|
+
value: _.value,
|
|
3247
|
+
label: _.label || _.value,
|
|
3248
|
+
icon: _.icon,
|
|
3249
|
+
disabled: _.disabled,
|
|
3250
|
+
key: _.key
|
|
3251
|
+
} : _);
|
|
3252
|
+
if (C.length >= 3) {
|
|
3253
|
+
const _ = C.slice(0, 2), I = C.slice(2);
|
|
3254
|
+
return /* @__PURE__ */ H(
|
|
3255
|
+
"div",
|
|
3256
|
+
{
|
|
3257
|
+
style: {
|
|
3258
|
+
display: "flex",
|
|
3259
|
+
gap: 4,
|
|
3260
|
+
justifyContent: "center",
|
|
3261
|
+
alignItems: "center"
|
|
3262
|
+
},
|
|
3263
|
+
children: [
|
|
3264
|
+
_.map((o, F) => /* @__PURE__ */ n(
|
|
3265
|
+
be,
|
|
3266
|
+
{
|
|
3267
|
+
mode: o.mode || "text",
|
|
3268
|
+
label: o.label || o.value || "",
|
|
3269
|
+
icon: o.icon,
|
|
3270
|
+
disabled: o.disabled || p && o.value === "delete",
|
|
3271
|
+
styles: t,
|
|
3272
|
+
style: { padding: "0 8px", minWidth: 0 },
|
|
3273
|
+
onClick: () => i == null ? void 0 : i(`table_action_${o.value}`, v)
|
|
3274
|
+
},
|
|
3275
|
+
F
|
|
3276
|
+
)),
|
|
3277
|
+
/* @__PURE__ */ n(
|
|
3278
|
+
hr,
|
|
3279
|
+
{
|
|
3280
|
+
actions: I.map((o, F) => ({
|
|
3281
|
+
key: o.value || String(F),
|
|
3282
|
+
label: o.label || o.value || "",
|
|
3283
|
+
icon: o.icon,
|
|
3284
|
+
disabled: o.disabled || p && o.value === "delete"
|
|
3285
|
+
})),
|
|
3286
|
+
onAction: (o) => {
|
|
3287
|
+
const F = I.find((U) => (U.value || String(U.key)) === o);
|
|
3288
|
+
F && !F.disabled && !(p && F.value === "delete") && (i == null || i(`table_action_${F.value}`, v));
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
)
|
|
3292
|
+
]
|
|
3293
|
+
}
|
|
3294
|
+
);
|
|
3295
|
+
} else
|
|
3296
|
+
return /* @__PURE__ */ n("div", { style: { display: "flex", gap: 4, justifyContent: "center" }, children: C.map((_, I) => /* @__PURE__ */ n(
|
|
3297
|
+
be,
|
|
3298
|
+
{
|
|
3299
|
+
mode: _.mode || "text",
|
|
3300
|
+
label: _.label || _.value || "",
|
|
3301
|
+
icon: _.icon,
|
|
3302
|
+
disabled: _.disabled || p && _.value === "delete",
|
|
3303
|
+
styles: t,
|
|
3304
|
+
style: { padding: "0 8px", minWidth: 0 },
|
|
3305
|
+
onClick: () => i == null ? void 0 : i(`table_action_${_.value}`, v)
|
|
3306
|
+
},
|
|
3307
|
+
I
|
|
3308
|
+
)) });
|
|
3309
|
+
}
|
|
3310
|
+
const M = d || {};
|
|
3311
|
+
return /* @__PURE__ */ n(
|
|
3312
|
+
be,
|
|
3313
|
+
{
|
|
3314
|
+
mode: M.mode || "text",
|
|
3315
|
+
label: M.label || M.value || "",
|
|
3316
|
+
icon: M.icon,
|
|
3317
|
+
disabled: M.disabled || p && M.value === "delete",
|
|
3318
|
+
styles: t,
|
|
3319
|
+
style: { padding: "0 8px", minWidth: 0 },
|
|
3320
|
+
onClick: () => i == null ? void 0 : i(`table_action_${M.value}`, v)
|
|
3321
|
+
}
|
|
3322
|
+
);
|
|
3323
|
+
}
|
|
3324
|
+
};
|
|
3325
|
+
case "label":
|
|
3326
|
+
return {
|
|
3327
|
+
...u,
|
|
3328
|
+
render: (h) => /* @__PURE__ */ n("span", { className: "font-bold", children: h })
|
|
3329
|
+
// 移除 text-center,让 getColWidth 控制对齐
|
|
3330
|
+
};
|
|
3331
|
+
case "title":
|
|
3332
|
+
return {
|
|
3333
|
+
...u,
|
|
3334
|
+
render: (h, v, d) => {
|
|
3335
|
+
const p = (d == null ? void 0 : d.level) || 1, M = {
|
|
3336
|
+
1: "text-xl font-bold",
|
|
3337
|
+
2: "text-lg font-semibold",
|
|
3338
|
+
3: "text-base font-medium"
|
|
3339
|
+
}, C = M[p] || M[1];
|
|
3340
|
+
return /* @__PURE__ */ H(
|
|
3341
|
+
"div",
|
|
3342
|
+
{
|
|
3343
|
+
className: `${C} text-gray-800 ${(d == null ? void 0 : d.className) || ""}`,
|
|
3344
|
+
style: {
|
|
3345
|
+
color: "#1f2937",
|
|
3346
|
+
lineHeight: "1.4",
|
|
3347
|
+
fontWeight: p === 1 ? 700 : p === 2 ? 600 : 400
|
|
3348
|
+
},
|
|
3349
|
+
children: [
|
|
3350
|
+
/* @__PURE__ */ n("span", { className: "h-full w-1 bg-gray-500 rounded-full mr-2" }),
|
|
3351
|
+
/* @__PURE__ */ n("span", { className: "text-gray-500", children: h })
|
|
3352
|
+
]
|
|
3353
|
+
}
|
|
3354
|
+
);
|
|
3355
|
+
}
|
|
3356
|
+
};
|
|
3357
|
+
case "paragraph":
|
|
3358
|
+
return {
|
|
3359
|
+
...u,
|
|
3360
|
+
render: (h) => /* @__PURE__ */ n("div", { style: {
|
|
3361
|
+
maxWidth: 240,
|
|
3362
|
+
whiteSpace: "nowrap",
|
|
3363
|
+
overflow: "hidden",
|
|
3364
|
+
textOverflow: "ellipsis"
|
|
3365
|
+
}, title: h, children: h })
|
|
3366
|
+
};
|
|
3367
|
+
case "text":
|
|
3368
|
+
return {
|
|
3369
|
+
...u,
|
|
3370
|
+
render: (h) => /* @__PURE__ */ n("span", { children: h })
|
|
3371
|
+
// 移除 text-center,让 getColWidth 控制对齐
|
|
3372
|
+
};
|
|
3373
|
+
default:
|
|
3374
|
+
return {
|
|
3375
|
+
...u,
|
|
3376
|
+
render: (h) => /* @__PURE__ */ n("span", { children: h })
|
|
3377
|
+
// 移除 text-center,让 getColWidth 控制对齐
|
|
3378
|
+
};
|
|
3379
|
+
}
|
|
3380
|
+
}),
|
|
3381
|
+
[
|
|
3382
|
+
e,
|
|
3383
|
+
i,
|
|
3384
|
+
a == null ? void 0 : a.isPending,
|
|
3385
|
+
a == null ? void 0 : a.customizeComponents,
|
|
3386
|
+
t == null ? void 0 : t.customizeComponents
|
|
3387
|
+
]
|
|
3388
|
+
);
|
|
3389
|
+
}
|
|
3390
|
+
function ra(e) {
|
|
3391
|
+
return /* @__PURE__ */ H("div", { className: "flex items-center gap-2", children: [
|
|
3392
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-gray-800 text-sm", children: e.title }),
|
|
3393
|
+
e.helpText && /* @__PURE__ */ n(Te, { title: e.helpText, placement: "top", children: /* @__PURE__ */ n(
|
|
3394
|
+
rr,
|
|
3395
|
+
{
|
|
3396
|
+
className: "text-gray-400 hover:text-gray-600 cursor-help transition-colors",
|
|
3397
|
+
size: 14
|
|
3398
|
+
}
|
|
3399
|
+
) })
|
|
3400
|
+
] });
|
|
3401
|
+
}
|
|
3402
|
+
const aa = Z.div`
|
|
3403
|
+
background: ${({ theme: e }) => e.colors.background};
|
|
3404
|
+
border-radius: ${({ theme: e }) => e.space.radius};
|
|
3405
|
+
box-shadow: ${({ theme: e }) => e.colors.shadow};
|
|
3406
|
+
padding: ${({ theme: e }) => e.space.padding};
|
|
3407
|
+
overflow-x: auto;
|
|
3408
|
+
width: 100%;
|
|
3409
|
+
max-width: 100%;
|
|
3410
|
+
box-sizing: border-box;
|
|
3411
|
+
min-height: 240px;
|
|
3412
|
+
display: flex;
|
|
3413
|
+
flex-direction: column;
|
|
3414
|
+
`, ta = Z.div`
|
|
3415
|
+
background: ${({ theme: e }) => e.colors.background};
|
|
3416
|
+
border-radius: ${({ theme: e }) => e.space.radius};
|
|
3417
|
+
padding: ${({ theme: e }) => e.space.padding};
|
|
3418
|
+
width: 100%;
|
|
3419
|
+
max-width: 100%;
|
|
3420
|
+
box-sizing: border-box;
|
|
3421
|
+
display: flex;
|
|
3422
|
+
flex-direction: column;
|
|
3423
|
+
overflow: visible; // 子table不产生滚动条,由外层容器处理
|
|
3424
|
+
`, na = Z.div`
|
|
3425
|
+
overflow-x: auto;
|
|
3426
|
+
overflow-y: hidden;
|
|
3427
|
+
width: 100%;
|
|
3428
|
+
max-width: 100%;
|
|
3429
|
+
border: 1px solid ${({ theme: e }) => e.colors.border};
|
|
3430
|
+
border-radius: ${({ theme: e }) => e.space.radius};
|
|
3431
|
+
background: ${({ theme: e }) => e.colors.background};
|
|
3432
|
+
position: relative; // 为sticky列提供定位上下文
|
|
3433
|
+
isolation: isolate; // 创建新的层叠上下文
|
|
3434
|
+
height: auto; // 确保容器高度自适应内容
|
|
3435
|
+
min-height: 200px; // 最小高度确保滚动条可见
|
|
3436
|
+
box-sizing: border-box; // 确保padding和border包含在宽度内
|
|
3437
|
+
|
|
3438
|
+
/* 子table内容宽度控制 - 根据父容器动态计算 */
|
|
3439
|
+
& > div {
|
|
3440
|
+
min-width: 100%; // 使用父容器的100%宽度作为最小宽度
|
|
3441
|
+
width: 100%; // 确保宽度填满父容器
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
/* 自定义滚动条样式 */
|
|
3445
|
+
&::-webkit-scrollbar {
|
|
3446
|
+
height: 6px;
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
&::-webkit-scrollbar-track {
|
|
3450
|
+
background: ${({ theme: e }) => e.colors.disabledBackground};
|
|
3451
|
+
border-radius: 3px;
|
|
3452
|
+
}
|
|
3453
|
+
|
|
3454
|
+
&::-webkit-scrollbar-thumb {
|
|
3455
|
+
background: ${({ theme: e }) => e.colors.border};
|
|
3456
|
+
border-radius: 3px;
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3459
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
3460
|
+
background: ${({ theme: e }) => e.colors.disabled};
|
|
3461
|
+
}
|
|
3462
|
+
`, Ze = (e) => {
|
|
3463
|
+
switch (e) {
|
|
3464
|
+
case "avatar":
|
|
3465
|
+
return { minWidth: 48, textAlign: "center" };
|
|
3466
|
+
case "status":
|
|
3467
|
+
return { minWidth: 56, textAlign: "center" };
|
|
3468
|
+
case "number":
|
|
3469
|
+
return { minWidth: 56, textAlign: "right" };
|
|
3470
|
+
// 数字列右对齐
|
|
3471
|
+
case "longText":
|
|
3472
|
+
return { minWidth: 120, textAlign: "left" };
|
|
3473
|
+
// 长文本列左对齐
|
|
3474
|
+
case "tag":
|
|
3475
|
+
return { minWidth: 200, textAlign: "left" };
|
|
3476
|
+
// 标签列左对齐
|
|
3477
|
+
case "action":
|
|
3478
|
+
return { minWidth: 112, textAlign: "center" };
|
|
3479
|
+
// 操作列居中对齐
|
|
3480
|
+
case "label":
|
|
3481
|
+
return { minWidth: 120, textAlign: "left" };
|
|
3482
|
+
// 标签列左对齐
|
|
3483
|
+
case "title":
|
|
3484
|
+
return { minWidth: 150, textAlign: "left" };
|
|
3485
|
+
// 标题列左对齐
|
|
3486
|
+
case "text":
|
|
3487
|
+
return { minWidth: 80, textAlign: "left" };
|
|
3488
|
+
// 文本列左对齐
|
|
3489
|
+
default:
|
|
3490
|
+
return { minWidth: 80, textAlign: "left" };
|
|
3491
|
+
}
|
|
3492
|
+
}, Ke = Z.th`
|
|
3493
|
+
background: ${({ theme: e }) => e.colors.disabledBackground};
|
|
3494
|
+
color: ${({ theme: e }) => e.colors.text};
|
|
3495
|
+
font-weight: 600;
|
|
3496
|
+
font-size: 13px;
|
|
3497
|
+
padding: 0.5rem 0.75rem;
|
|
3498
|
+
border-bottom: 1px solid ${({ theme: e }) => e.colors.border};
|
|
3499
|
+
min-width: 48px;
|
|
3500
|
+
white-space: nowrap;
|
|
3501
|
+
/* 移除默认的 text-align: center,让每列使用自己的对齐方式 */
|
|
3502
|
+
`, Pe = Z.td`
|
|
3503
|
+
padding: 0.5rem 0.75rem;
|
|
3504
|
+
border-bottom: 1px solid ${({ theme: e }) => e.colors.border};
|
|
3505
|
+
color: ${({ theme: e }) => e.colors.text};
|
|
3506
|
+
font-size: 14px;
|
|
3507
|
+
vertical-align: middle;
|
|
3508
|
+
white-space: nowrap;
|
|
3509
|
+
overflow: hidden;
|
|
3510
|
+
text-overflow: ellipsis;
|
|
3511
|
+
`, sa = Z.tr`
|
|
3512
|
+
&:hover {
|
|
3513
|
+
background: ${({ theme: e }) => e.colors.disabledBackground};
|
|
3514
|
+
}
|
|
3515
|
+
`, oa = oe.forwardRef(
|
|
3516
|
+
(e, a) => /* @__PURE__ */ n(sa, { ...e, ref: a })
|
|
3517
|
+
), la = `
|
|
3518
|
+
.sticky-shadow-left {
|
|
3519
|
+
box-shadow: 4px 0 8px -4px rgba(0,0,0,0.08);
|
|
3520
|
+
transition: box-shadow 0.2s;
|
|
3521
|
+
}
|
|
3522
|
+
.sticky-shadow-right {
|
|
3523
|
+
box-shadow: -4px 0 8px -4px rgba(0,0,0,0.08);
|
|
3524
|
+
transition: box-shadow 0.2s;
|
|
3525
|
+
}
|
|
3526
|
+
`;
|
|
3527
|
+
if (typeof window < "u" && !document.getElementById("dynamic-table-sticky-shadow")) {
|
|
3528
|
+
const e = document.createElement("style");
|
|
3529
|
+
e.id = "dynamic-table-sticky-shadow", e.innerHTML = la, document.head.appendChild(e);
|
|
3530
|
+
}
|
|
3531
|
+
const ia = oe.memo((e) => {
|
|
3532
|
+
var w;
|
|
3533
|
+
const a = e.dataSource || [], t = e.columns || [], i = e.size || "md", u = e.level || 0, { viewId: h, total: v, requestPagesize: d = 50, viewPageSize: p } = e, [M, C] = ne(p);
|
|
3534
|
+
fe(() => {
|
|
3535
|
+
typeof p == "number" && p > 0 && C(p);
|
|
3536
|
+
}, [p]);
|
|
3537
|
+
const [_, I] = ne(/* @__PURE__ */ new Set());
|
|
3538
|
+
fe(() => {
|
|
3539
|
+
I(/* @__PURE__ */ new Set());
|
|
3540
|
+
}, [h]);
|
|
3541
|
+
const [o, F] = ne(!1), [U, Q] = ne(!1), [X, r] = ne(/* @__PURE__ */ new Set()), m = me(null), V = me(null), [q, R] = ne(0), B = i === "sm" ? 0.7 : 1, J = ea(
|
|
3542
|
+
t,
|
|
3543
|
+
{
|
|
3544
|
+
eventsEmit: e.eventsEmit,
|
|
3545
|
+
isPending: e.isPending,
|
|
3546
|
+
customizeComponents: e.customizeComponents
|
|
3547
|
+
},
|
|
3548
|
+
e.styles
|
|
3549
|
+
), [G, A] = ne([]), k = te(
|
|
3550
|
+
(s, L) => {
|
|
3551
|
+
var D;
|
|
3552
|
+
A((P) => {
|
|
3553
|
+
let ae;
|
|
3554
|
+
return L ? ae = [...P, s] : ae = P.filter((ge) => ge !== s), ae;
|
|
3555
|
+
});
|
|
3556
|
+
const j = L ? [...G, s] : G.filter((P) => P !== s), W = a.filter((P) => j.includes(P.id));
|
|
3557
|
+
(D = e.eventsEmit) == null || D.call(e, "table_row_select", {
|
|
3558
|
+
rowId: s,
|
|
3559
|
+
checked: L,
|
|
3560
|
+
selectedItems: W
|
|
3561
|
+
});
|
|
3562
|
+
},
|
|
3563
|
+
[G, a, e.eventsEmit]
|
|
3564
|
+
), K = he(
|
|
3565
|
+
() => a.length > 0 && G.length === a.length,
|
|
3566
|
+
[a.length, G.length]
|
|
3567
|
+
), ee = te(
|
|
3568
|
+
(s) => {
|
|
3569
|
+
var W;
|
|
3570
|
+
const L = s ? a.map((D) => D.id) : [];
|
|
3571
|
+
A(L);
|
|
3572
|
+
const j = s ? a : [];
|
|
3573
|
+
(W = e.eventsEmit) == null || W.call(e, "table_select_all", {
|
|
3574
|
+
checked: s,
|
|
3575
|
+
selectedItems: j,
|
|
3576
|
+
totalCount: a.length
|
|
3577
|
+
});
|
|
3578
|
+
},
|
|
3579
|
+
[a, e.eventsEmit]
|
|
3580
|
+
), [l, $] = ne(1), y = typeof M == "number" && M > 0 ? M : p ?? (e.isSubTable ? 5 : 10), N = v || a.length;
|
|
3581
|
+
he(
|
|
3582
|
+
() => Math.ceil(N / y),
|
|
3583
|
+
[N, y]
|
|
3584
|
+
);
|
|
3585
|
+
const x = he(() => {
|
|
3586
|
+
if (e.viewBehavior !== "pagination") return a;
|
|
3587
|
+
const s = (l - 1) * y, L = s + y;
|
|
3588
|
+
if (a.some((W) => typeof W.__absIndex == "number")) {
|
|
3589
|
+
const W = [];
|
|
3590
|
+
for (let D = s; D < L; D++) {
|
|
3591
|
+
const P = a.find((ae) => ae.__absIndex === D);
|
|
3592
|
+
P && W.push(P);
|
|
3593
|
+
}
|
|
3594
|
+
return W;
|
|
3595
|
+
}
|
|
3596
|
+
return a.slice(s, L);
|
|
3597
|
+
}, [e.viewBehavior, a, l, y]), f = te(
|
|
3598
|
+
(s) => {
|
|
3599
|
+
var L;
|
|
3600
|
+
if ($(s), v && d && h) {
|
|
3601
|
+
const j = (s - 1) * y, W = Math.floor(j / d) + 1;
|
|
3602
|
+
(!_.has(W) || j >= a.length) && (I((P) => {
|
|
3603
|
+
const ae = new Set(P);
|
|
3604
|
+
return ae.add(W), ae;
|
|
3605
|
+
}), (L = e.eventsEmit) == null || L.call(
|
|
3606
|
+
e,
|
|
3607
|
+
"pagination:request_merge_data",
|
|
3608
|
+
{
|
|
3609
|
+
viewId: h,
|
|
3610
|
+
request: {
|
|
3611
|
+
pageNo: W,
|
|
3612
|
+
pageSize: d
|
|
3613
|
+
}
|
|
3614
|
+
},
|
|
3615
|
+
void 0
|
|
3616
|
+
));
|
|
3617
|
+
}
|
|
3618
|
+
},
|
|
3619
|
+
[v, d, h, y, a.length, e.eventsEmit, _]
|
|
3620
|
+
), g = he(
|
|
3621
|
+
() => ({
|
|
3622
|
+
colors: {
|
|
3623
|
+
background: "#fff",
|
|
3624
|
+
text: "#222",
|
|
3625
|
+
border: "#d1d5db",
|
|
3626
|
+
disabledBackground: "#f5f5f5",
|
|
3627
|
+
shadow: "none"
|
|
3628
|
+
},
|
|
3629
|
+
space: { radius: "6px", padding: "8px" }
|
|
3630
|
+
}),
|
|
3631
|
+
[]
|
|
3632
|
+
), b = he(
|
|
3633
|
+
() => {
|
|
3634
|
+
var s;
|
|
3635
|
+
return ((s = e.styles) == null ? void 0 : s.theme) || g;
|
|
3636
|
+
},
|
|
3637
|
+
[(w = e.styles) == null ? void 0 : w.theme, g]
|
|
3638
|
+
), O = te((s) => {
|
|
3639
|
+
r((L) => {
|
|
3640
|
+
const j = new Set(L);
|
|
3641
|
+
return j.has(s) ? j.delete(s) : (j.add(s), setTimeout(() => {
|
|
3642
|
+
var W, D;
|
|
3643
|
+
(D = e.eventsEmit) == null || D.call(e, "table_expand", {
|
|
3644
|
+
tableId: s,
|
|
3645
|
+
children: ((W = a.find((P) => P.id === s)) == null ? void 0 : W.children) || []
|
|
3646
|
+
});
|
|
3647
|
+
}, 0)), j;
|
|
3648
|
+
});
|
|
3649
|
+
}, [a, e.eventsEmit]), z = te((s) => s.hasOwnProperty("children") && s.children !== void 0, []), T = te(
|
|
3650
|
+
(s) => X.has(s),
|
|
3651
|
+
[X]
|
|
3652
|
+
), c = te(() => {
|
|
3653
|
+
const s = m.current;
|
|
3654
|
+
s && (e.isSubTable || (F(s.scrollLeft > 0), Q(s.scrollLeft < s.scrollWidth - s.offsetWidth - 1)));
|
|
3655
|
+
}, [e.isSubTable]);
|
|
3656
|
+
fe(() => {
|
|
3657
|
+
const s = m.current;
|
|
3658
|
+
if (s)
|
|
3659
|
+
return c(), s.addEventListener("scroll", c), window.addEventListener("resize", c), () => {
|
|
3660
|
+
s.removeEventListener("scroll", c), window.removeEventListener("resize", c);
|
|
3661
|
+
};
|
|
3662
|
+
}, [c]), fe(() => {
|
|
3663
|
+
const s = m.current;
|
|
3664
|
+
if (!s) return;
|
|
3665
|
+
const L = () => {
|
|
3666
|
+
const W = s.getBoundingClientRect();
|
|
3667
|
+
R(W.width);
|
|
3668
|
+
};
|
|
3669
|
+
L(), window.addEventListener("resize", L);
|
|
3670
|
+
const j = new ResizeObserver(L);
|
|
3671
|
+
return j.observe(s), () => {
|
|
3672
|
+
window.removeEventListener("resize", L), j.disconnect();
|
|
3673
|
+
};
|
|
3674
|
+
}, []);
|
|
3675
|
+
const S = e.isSubTable ? ta : aa;
|
|
3676
|
+
return /* @__PURE__ */ H(
|
|
3677
|
+
S,
|
|
3678
|
+
{
|
|
3679
|
+
theme: b,
|
|
3680
|
+
className: "w-full",
|
|
3681
|
+
style: {
|
|
3682
|
+
transform: `scale(${B})`,
|
|
3683
|
+
transformOrigin: "top left",
|
|
3684
|
+
height: "100%",
|
|
3685
|
+
display: "flex",
|
|
3686
|
+
flexDirection: "column"
|
|
3687
|
+
},
|
|
3688
|
+
children: [
|
|
3689
|
+
/* @__PURE__ */ n("style", { children: `
|
|
3690
|
+
.removing-row {
|
|
3691
|
+
pointer-events: none;
|
|
3692
|
+
overflow: hidden;
|
|
3693
|
+
will-change: opacity, transform;
|
|
3694
|
+
}
|
|
3695
|
+
.stagger-row {
|
|
3696
|
+
will-change: transform;
|
|
3697
|
+
}
|
|
3698
|
+
.adding-row {
|
|
3699
|
+
animation: row-slide-in 0.6s ease-out forwards;
|
|
3700
|
+
will-change: transform, opacity;
|
|
3701
|
+
}
|
|
3702
|
+
@keyframes row-slide-in {
|
|
3703
|
+
0% {
|
|
3704
|
+
opacity: 0;
|
|
3705
|
+
transform: translateY(-10px);
|
|
3706
|
+
}
|
|
3707
|
+
100% {
|
|
3708
|
+
opacity: 1;
|
|
3709
|
+
transform: translateY(0);
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
@keyframes spin {
|
|
3713
|
+
0% { transform: rotate(0deg); }
|
|
3714
|
+
100% { transform: rotate(360deg); }
|
|
3715
|
+
}
|
|
3716
|
+
` }),
|
|
3717
|
+
/* @__PURE__ */ n(
|
|
3718
|
+
"div",
|
|
3719
|
+
{
|
|
3720
|
+
ref: m,
|
|
3721
|
+
style: {
|
|
3722
|
+
width: (e.isSubTable, "100%"),
|
|
3723
|
+
maxWidth: (e.isSubTable, "100%"),
|
|
3724
|
+
overflowX: e.isSubTable ? "visible" : "auto",
|
|
3725
|
+
overflowY: e.isSubTable ? "visible" : "auto",
|
|
3726
|
+
flex: e.isSubTable ? void 0 : 1,
|
|
3727
|
+
// 主表:占据剩余高度
|
|
3728
|
+
height: e.isSubTable ? "auto" : void 0,
|
|
3729
|
+
position: "relative",
|
|
3730
|
+
boxSizing: "border-box"
|
|
3731
|
+
},
|
|
3732
|
+
children: /* @__PURE__ */ H(
|
|
3733
|
+
"table",
|
|
3734
|
+
{
|
|
3735
|
+
ref: V,
|
|
3736
|
+
className: "border-collapse",
|
|
3737
|
+
style: {
|
|
3738
|
+
minWidth: "max-content",
|
|
3739
|
+
width: "100%",
|
|
3740
|
+
tableLayout: "auto"
|
|
3741
|
+
},
|
|
3742
|
+
children: [
|
|
3743
|
+
/* @__PURE__ */ n(
|
|
3744
|
+
"thead",
|
|
3745
|
+
{
|
|
3746
|
+
style: {
|
|
3747
|
+
position: e.isSubTable ? void 0 : "sticky",
|
|
3748
|
+
top: 0,
|
|
3749
|
+
zIndex: 3,
|
|
3750
|
+
background: b.colors.disabledBackground
|
|
3751
|
+
},
|
|
3752
|
+
children: /* @__PURE__ */ H("tr", { children: [
|
|
3753
|
+
e.allowMultiSelect && /* @__PURE__ */ n(
|
|
3754
|
+
Ke,
|
|
3755
|
+
{
|
|
3756
|
+
theme: b,
|
|
3757
|
+
style: {
|
|
3758
|
+
position: "sticky",
|
|
3759
|
+
left: 0,
|
|
3760
|
+
zIndex: 3,
|
|
3761
|
+
background: b.colors.disabledBackground,
|
|
3762
|
+
width: 40,
|
|
3763
|
+
minWidth: 40,
|
|
3764
|
+
maxWidth: 40,
|
|
3765
|
+
textAlign: "center"
|
|
3766
|
+
},
|
|
3767
|
+
className: o ? "sticky-shadow-left" : "",
|
|
3768
|
+
children: /* @__PURE__ */ n(
|
|
3769
|
+
"input",
|
|
3770
|
+
{
|
|
3771
|
+
type: "checkbox",
|
|
3772
|
+
checked: K,
|
|
3773
|
+
onChange: (s) => ee(s.target.checked)
|
|
3774
|
+
}
|
|
3775
|
+
)
|
|
3776
|
+
}
|
|
3777
|
+
),
|
|
3778
|
+
J.map((s, L) => {
|
|
3779
|
+
const j = L === 0, W = L === J.length - 1, D = j ? {
|
|
3780
|
+
position: "sticky",
|
|
3781
|
+
left: e.allowMultiSelect ? 40 : 0,
|
|
3782
|
+
zIndex: 2,
|
|
3783
|
+
background: b.colors.disabledBackground
|
|
3784
|
+
} : W ? {
|
|
3785
|
+
position: "sticky",
|
|
3786
|
+
right: 0,
|
|
3787
|
+
zIndex: 2,
|
|
3788
|
+
background: b.colors.disabledBackground
|
|
3789
|
+
} : {};
|
|
3790
|
+
return /* @__PURE__ */ n(
|
|
3791
|
+
Ke,
|
|
3792
|
+
{
|
|
3793
|
+
theme: b,
|
|
3794
|
+
style: {
|
|
3795
|
+
...Ze(s.type),
|
|
3796
|
+
...D,
|
|
3797
|
+
...s.maxWidth !== void 0 ? {
|
|
3798
|
+
maxWidth: typeof s.maxWidth == "number" ? `${s.maxWidth}px` : s.maxWidth
|
|
3799
|
+
} : {}
|
|
3800
|
+
},
|
|
3801
|
+
className: j && o ? "sticky-shadow-left" : W && U ? "sticky-shadow-right" : "",
|
|
3802
|
+
children: ra(s)
|
|
3803
|
+
},
|
|
3804
|
+
s.id
|
|
3805
|
+
);
|
|
3806
|
+
})
|
|
3807
|
+
] })
|
|
3808
|
+
}
|
|
3809
|
+
),
|
|
3810
|
+
/* @__PURE__ */ n("tbody", { children: x.map((s, L) => {
|
|
3811
|
+
var P, ae, ge, Ce, Fe, ze, _e, Ae;
|
|
3812
|
+
const j = e.rowProps ? e.rowProps(s, L) : {}, W = z(s), D = T(s.id) || s.__autoExpand && W;
|
|
3813
|
+
return /* @__PURE__ */ H(oe.Fragment, { children: [
|
|
3814
|
+
/* @__PURE__ */ H(
|
|
3815
|
+
oa,
|
|
3816
|
+
{
|
|
3817
|
+
theme: b,
|
|
3818
|
+
...j,
|
|
3819
|
+
className: `${j.className || ""} ${(P = e.addingIds) != null && P.includes(s.id) ? "adding-row" : ""}`,
|
|
3820
|
+
onAnimationEnd: (Y) => {
|
|
3821
|
+
var le, de;
|
|
3822
|
+
Y.animationName === "row-slide-in" && ((le = e.addingIds) != null && le.includes(s.id)) && ((de = e.onRowAddAnimationComplete) == null || de.call(e, s.id));
|
|
3823
|
+
},
|
|
3824
|
+
children: [
|
|
3825
|
+
e.allowMultiSelect && /* @__PURE__ */ n(
|
|
3826
|
+
Pe,
|
|
3827
|
+
{
|
|
3828
|
+
theme: b,
|
|
3829
|
+
style: {
|
|
3830
|
+
position: "sticky",
|
|
3831
|
+
left: 0,
|
|
3832
|
+
zIndex: 2,
|
|
3833
|
+
background: b.colors.background,
|
|
3834
|
+
width: 40,
|
|
3835
|
+
minWidth: 40,
|
|
3836
|
+
maxWidth: 40,
|
|
3837
|
+
textAlign: "center"
|
|
3838
|
+
},
|
|
3839
|
+
className: o ? "sticky-shadow-left" : "",
|
|
3840
|
+
children: /* @__PURE__ */ n(
|
|
3841
|
+
"input",
|
|
3842
|
+
{
|
|
3843
|
+
type: "checkbox",
|
|
3844
|
+
checked: G.includes(s.id),
|
|
3845
|
+
onChange: (Y) => k(s.id, Y.target.checked)
|
|
3846
|
+
}
|
|
3847
|
+
)
|
|
3848
|
+
}
|
|
3849
|
+
),
|
|
3850
|
+
J.map((Y, le) => {
|
|
3851
|
+
var We;
|
|
3852
|
+
const de = le === 0, xe = le === J.length - 1, ye = de ? {
|
|
3853
|
+
position: "sticky",
|
|
3854
|
+
left: e.allowMultiSelect ? 40 : 0,
|
|
3855
|
+
zIndex: 1,
|
|
3856
|
+
background: b.colors.background
|
|
3857
|
+
} : xe ? {
|
|
3858
|
+
position: "sticky",
|
|
3859
|
+
right: 0,
|
|
3860
|
+
zIndex: 1,
|
|
3861
|
+
background: b.colors.background
|
|
3862
|
+
} : {}, ie = ((We = s.data) == null ? void 0 : We.filter((ce) => ce.columnId === Y.id)) || [], or = Object.assign(
|
|
3863
|
+
{},
|
|
3864
|
+
Ze(Y.type),
|
|
3865
|
+
ye,
|
|
3866
|
+
Y.maxWidth !== void 0 ? {
|
|
3867
|
+
maxWidth: typeof Y.maxWidth == "number" ? `${Y.maxWidth}px` : Y.maxWidth
|
|
3868
|
+
} : {}
|
|
3869
|
+
);
|
|
3870
|
+
return /* @__PURE__ */ n(
|
|
3871
|
+
Pe,
|
|
3872
|
+
{
|
|
3873
|
+
theme: b,
|
|
3874
|
+
style: or,
|
|
3875
|
+
className: de && o ? "sticky-shadow-left" : xe && U ? "sticky-shadow-right" : "",
|
|
3876
|
+
children: de && W ? /* @__PURE__ */ H("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
3877
|
+
/* @__PURE__ */ n(
|
|
3878
|
+
"button",
|
|
3879
|
+
{
|
|
3880
|
+
onClick: () => O(s.id),
|
|
3881
|
+
style: {
|
|
3882
|
+
background: "none",
|
|
3883
|
+
border: "none",
|
|
3884
|
+
cursor: "pointer",
|
|
3885
|
+
padding: 4,
|
|
3886
|
+
display: "flex",
|
|
3887
|
+
alignItems: "center",
|
|
3888
|
+
justifyContent: "center",
|
|
3889
|
+
color: b.colors.text
|
|
3890
|
+
},
|
|
3891
|
+
children: D ? /* @__PURE__ */ n(cr, { size: 16 }) : /* @__PURE__ */ n(ur, { size: 16 })
|
|
3892
|
+
}
|
|
3893
|
+
),
|
|
3894
|
+
/* @__PURE__ */ H("span", { style: { paddingLeft: u * 16 }, children: [
|
|
3895
|
+
" ",
|
|
3896
|
+
ie.length > 0 ? Y.type === "action" ? Y.render ? Y.render(
|
|
3897
|
+
ie.length > 1 ? ie.map((ce) => ce) : ie[0],
|
|
3898
|
+
s,
|
|
3899
|
+
ie.length > 1 ? void 0 : ie[0]
|
|
3900
|
+
) : null : ie.map((ce, Me) => /* @__PURE__ */ n(
|
|
3901
|
+
"span",
|
|
3902
|
+
{
|
|
3903
|
+
style: {
|
|
3904
|
+
marginRight: 4,
|
|
3905
|
+
display: "inline-block",
|
|
3906
|
+
maxWidth: Y.maxWidth ? typeof Y.maxWidth == "number" ? `${Y.maxWidth}px` : Y.maxWidth : void 0,
|
|
3907
|
+
overflow: "hidden",
|
|
3908
|
+
textOverflow: "ellipsis",
|
|
3909
|
+
verticalAlign: "middle"
|
|
3910
|
+
},
|
|
3911
|
+
children: Y.render ? Y.render(ce.value, s, ce) : /* @__PURE__ */ n("span", { children: ce.value })
|
|
3912
|
+
},
|
|
3913
|
+
Me
|
|
3914
|
+
)) : null
|
|
3915
|
+
] })
|
|
3916
|
+
] }) : /* @__PURE__ */ H("span", { style: { paddingLeft: u * 16 }, children: [
|
|
3917
|
+
" ",
|
|
3918
|
+
ie.length > 0 ? Y.type === "action" ? Y.render ? Y.render(
|
|
3919
|
+
ie.length > 1 ? ie.map((ce) => ce) : ie[0],
|
|
3920
|
+
s,
|
|
3921
|
+
ie.length > 1 ? void 0 : ie[0]
|
|
3922
|
+
) : null : ie.map((ce, Me) => /* @__PURE__ */ n(
|
|
3923
|
+
"span",
|
|
3924
|
+
{
|
|
3925
|
+
style: {
|
|
3926
|
+
marginRight: 4,
|
|
3927
|
+
display: "inline-block",
|
|
3928
|
+
maxWidth: Y.maxWidth ? typeof Y.maxWidth == "number" ? `${Y.maxWidth}px` : Y.maxWidth : void 0,
|
|
3929
|
+
overflow: "hidden",
|
|
3930
|
+
textOverflow: "ellipsis",
|
|
3931
|
+
verticalAlign: "middle"
|
|
3932
|
+
},
|
|
3933
|
+
children: Y.render ? Y.render(ce.value, s, ce) : /* @__PURE__ */ n("span", { children: ce.value })
|
|
3934
|
+
},
|
|
3935
|
+
Me
|
|
3936
|
+
)) : null
|
|
3937
|
+
] })
|
|
3938
|
+
},
|
|
3939
|
+
Y.id
|
|
3940
|
+
);
|
|
3941
|
+
})
|
|
3942
|
+
]
|
|
3943
|
+
}
|
|
3944
|
+
),
|
|
3945
|
+
W && D && s.children !== void 0 && /* @__PURE__ */ n(
|
|
3946
|
+
"tr",
|
|
3947
|
+
{
|
|
3948
|
+
className: " relative ",
|
|
3949
|
+
style: {
|
|
3950
|
+
width: q > 0 ? `${q}px` : "100%"
|
|
3951
|
+
},
|
|
3952
|
+
children: /* @__PURE__ */ n(
|
|
3953
|
+
"td",
|
|
3954
|
+
{
|
|
3955
|
+
style: {
|
|
3956
|
+
width: q > 0 ? `${q}px` : "100%"
|
|
3957
|
+
},
|
|
3958
|
+
colSpan: J.length + (e.allowMultiSelect ? 1 : 0),
|
|
3959
|
+
children: /* @__PURE__ */ H(
|
|
3960
|
+
"div",
|
|
3961
|
+
{
|
|
3962
|
+
style: {
|
|
3963
|
+
position: "sticky",
|
|
3964
|
+
left: 0,
|
|
3965
|
+
padding: "15px 18px",
|
|
3966
|
+
width: q > 0 ? `${q}px` : "100%",
|
|
3967
|
+
// 使用父容器实际宽度
|
|
3968
|
+
minWidth: "800px",
|
|
3969
|
+
// 最小宽度确保内容显示
|
|
3970
|
+
maxWidth: "100%",
|
|
3971
|
+
// 最大宽度不超过父容器
|
|
3972
|
+
background: b.colors.disabledBackground,
|
|
3973
|
+
boxSizing: "border-box"
|
|
3974
|
+
},
|
|
3975
|
+
children: [
|
|
3976
|
+
s.tableLoading && /* @__PURE__ */ n(
|
|
3977
|
+
"div",
|
|
3978
|
+
{
|
|
3979
|
+
style: {
|
|
3980
|
+
position: "absolute",
|
|
3981
|
+
top: 0,
|
|
3982
|
+
left: 0,
|
|
3983
|
+
right: 0,
|
|
3984
|
+
bottom: 0,
|
|
3985
|
+
background: "rgba(255, 255, 255, 0.9)",
|
|
3986
|
+
display: "flex",
|
|
3987
|
+
alignItems: "center",
|
|
3988
|
+
justifyContent: "center",
|
|
3989
|
+
zIndex: 10,
|
|
3990
|
+
borderRadius: b.space.radius
|
|
3991
|
+
},
|
|
3992
|
+
children: /* @__PURE__ */ H(
|
|
3993
|
+
"div",
|
|
3994
|
+
{
|
|
3995
|
+
style: {
|
|
3996
|
+
display: "flex",
|
|
3997
|
+
flexDirection: "column",
|
|
3998
|
+
alignItems: "center",
|
|
3999
|
+
gap: 8
|
|
4000
|
+
},
|
|
4001
|
+
children: [
|
|
4002
|
+
/* @__PURE__ */ n(
|
|
4003
|
+
"div",
|
|
4004
|
+
{
|
|
4005
|
+
style: {
|
|
4006
|
+
width: 24,
|
|
4007
|
+
height: 24,
|
|
4008
|
+
border: `2px solid ${b.colors.border}`,
|
|
4009
|
+
borderTop: `2px solid ${b.colors.primary || "#2563eb"}`,
|
|
4010
|
+
borderRadius: "50%",
|
|
4011
|
+
animation: "spin 1s linear infinite"
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
4014
|
+
),
|
|
4015
|
+
/* @__PURE__ */ n("span", { style: { fontSize: 14, color: b.colors.text }, children: "加载中..." })
|
|
4016
|
+
]
|
|
4017
|
+
}
|
|
4018
|
+
)
|
|
4019
|
+
}
|
|
4020
|
+
),
|
|
4021
|
+
/* @__PURE__ */ H("div", { style: { marginBottom: "16px" }, children: [
|
|
4022
|
+
Array.isArray((ae = e.subTableConfig) == null ? void 0 : ae.toolbar) && e.subTableConfig.toolbar.length > 0 && /* @__PURE__ */ n(
|
|
4023
|
+
"div",
|
|
4024
|
+
{
|
|
4025
|
+
style: {
|
|
4026
|
+
display: "flex",
|
|
4027
|
+
gap: 8,
|
|
4028
|
+
alignItems: "center",
|
|
4029
|
+
marginBottom: 8
|
|
4030
|
+
},
|
|
4031
|
+
children: e.subTableConfig.toolbar.map((Y, le) => {
|
|
4032
|
+
const xe = {
|
|
4033
|
+
primary: "primary",
|
|
4034
|
+
error: "danger",
|
|
4035
|
+
default: "text"
|
|
4036
|
+
}[Y.btnType] || "text";
|
|
4037
|
+
return /* @__PURE__ */ n(
|
|
4038
|
+
be,
|
|
4039
|
+
{
|
|
4040
|
+
mode: xe,
|
|
4041
|
+
label: Y.label,
|
|
4042
|
+
icon: Y.icon,
|
|
4043
|
+
onClick: () => {
|
|
4044
|
+
var ye;
|
|
4045
|
+
return (ye = e.eventsEmit) == null ? void 0 : ye.call(e, "table_action_add", {
|
|
4046
|
+
tableId: s.id,
|
|
4047
|
+
action: Y
|
|
4048
|
+
});
|
|
4049
|
+
}
|
|
4050
|
+
},
|
|
4051
|
+
le
|
|
4052
|
+
);
|
|
4053
|
+
})
|
|
4054
|
+
}
|
|
4055
|
+
),
|
|
4056
|
+
/* @__PURE__ */ n(
|
|
4057
|
+
na,
|
|
4058
|
+
{
|
|
4059
|
+
theme: b,
|
|
4060
|
+
onWheel: (Y) => {
|
|
4061
|
+
Y.stopPropagation();
|
|
4062
|
+
},
|
|
4063
|
+
onScroll: (Y) => {
|
|
4064
|
+
Y.stopPropagation();
|
|
4065
|
+
},
|
|
4066
|
+
style: {
|
|
4067
|
+
position: "relative",
|
|
4068
|
+
overflow: "auto",
|
|
4069
|
+
maxHeight: "400px",
|
|
4070
|
+
width: "100%",
|
|
4071
|
+
maxWidth: "100%"
|
|
4072
|
+
},
|
|
4073
|
+
children: /* @__PURE__ */ n(
|
|
4074
|
+
ia,
|
|
4075
|
+
{
|
|
4076
|
+
columns: ((ge = e.subTableConfig) == null ? void 0 : ge.columns) || [],
|
|
4077
|
+
dataSource: s.children || [],
|
|
4078
|
+
isSubTable: !0,
|
|
4079
|
+
isPending: (Y) => {
|
|
4080
|
+
var le, de;
|
|
4081
|
+
return ((de = (le = e.subTablePendingIds) == null ? void 0 : le[s.id]) == null ? void 0 : de.includes(Y)) || !1;
|
|
4082
|
+
},
|
|
4083
|
+
onRowAnimationComplete: (Y) => {
|
|
4084
|
+
var le;
|
|
4085
|
+
(le = e.onSubTableRowAnimationComplete) == null || le.call(e, s.id, Y), e.eventsEmit && e.eventsEmit("_internal:subtable_animation_complete", {
|
|
4086
|
+
rowId: Y,
|
|
4087
|
+
tableId: s.id
|
|
4088
|
+
});
|
|
4089
|
+
},
|
|
4090
|
+
eventsEmit: (Y, le) => {
|
|
4091
|
+
var de;
|
|
4092
|
+
(de = e.eventsEmit) == null || de.call(e, Y, { ...le, tableId: s.id });
|
|
4093
|
+
},
|
|
4094
|
+
allowMultiSelect: (Ce = e.subTableConfig) == null ? void 0 : Ce.allowMultiSelect,
|
|
4095
|
+
size: e.size,
|
|
4096
|
+
level: u + 1,
|
|
4097
|
+
subTableConfig: e.subTableConfig,
|
|
4098
|
+
styles: e.styles,
|
|
4099
|
+
onRowAddAnimationComplete: e.onRowAddAnimationComplete,
|
|
4100
|
+
addingIds: e.addingIds,
|
|
4101
|
+
viewBehavior: (Fe = e.subTableConfig) == null ? void 0 : Fe.viewBehavior,
|
|
4102
|
+
viewPageSize: (ze = e.subTableConfig) == null ? void 0 : ze.viewPageSize,
|
|
4103
|
+
total: (_e = e.subTableConfig) == null ? void 0 : _e.total,
|
|
4104
|
+
requestPagesize: (Ae = e.subTableConfig) == null ? void 0 : Ae.requestPagesize
|
|
4105
|
+
}
|
|
4106
|
+
)
|
|
4107
|
+
}
|
|
4108
|
+
)
|
|
4109
|
+
] })
|
|
4110
|
+
]
|
|
4111
|
+
}
|
|
4112
|
+
)
|
|
4113
|
+
}
|
|
4114
|
+
)
|
|
4115
|
+
}
|
|
4116
|
+
)
|
|
4117
|
+
] }, s.id ?? L);
|
|
4118
|
+
}) })
|
|
4119
|
+
]
|
|
4120
|
+
}
|
|
4121
|
+
)
|
|
4122
|
+
}
|
|
4123
|
+
),
|
|
4124
|
+
e.viewBehavior === "pagination" && /* @__PURE__ */ n(
|
|
4125
|
+
"div",
|
|
4126
|
+
{
|
|
4127
|
+
style: {
|
|
4128
|
+
height: 48,
|
|
4129
|
+
display: "flex",
|
|
4130
|
+
justifyContent: "end",
|
|
4131
|
+
alignItems: "center",
|
|
4132
|
+
background: b.colors.background,
|
|
4133
|
+
borderTop: `1px solid ${b.colors.border}`,
|
|
4134
|
+
flexShrink: 0,
|
|
4135
|
+
paddingRight: 16
|
|
4136
|
+
},
|
|
4137
|
+
children: /* @__PURE__ */ n(
|
|
4138
|
+
fr,
|
|
4139
|
+
{
|
|
4140
|
+
current: l,
|
|
4141
|
+
pageSize: y,
|
|
4142
|
+
total: N,
|
|
4143
|
+
onChange: f,
|
|
4144
|
+
onPageSizeChange: (s) => {
|
|
4145
|
+
var L;
|
|
4146
|
+
$(1), C(s), v && d && h && e.eventsEmit && (I(/* @__PURE__ */ new Set()), e.eventsEmit(
|
|
4147
|
+
"pagination:request_merge_data",
|
|
4148
|
+
{
|
|
4149
|
+
viewId: h,
|
|
4150
|
+
request: { pageNo: 1, pageSize: d }
|
|
4151
|
+
},
|
|
4152
|
+
void 0
|
|
4153
|
+
)), (L = e.eventsEmit) == null || L.call(e, "pagination:pageSizeChange", { viewId: h, pageSize: s });
|
|
4154
|
+
},
|
|
4155
|
+
showSizeChanger: !0,
|
|
4156
|
+
pageSizeOptions: [5, 10, 20, 30, 50],
|
|
4157
|
+
theme: {
|
|
4158
|
+
colors: {
|
|
4159
|
+
background: b.colors.background,
|
|
4160
|
+
text: b.colors.text,
|
|
4161
|
+
border: b.colors.border,
|
|
4162
|
+
disabledBackground: b.colors.disabledBackground,
|
|
4163
|
+
primary: b.colors.primary || "#2563eb"
|
|
4164
|
+
},
|
|
4165
|
+
space: { radius: b.space.radius }
|
|
4166
|
+
},
|
|
4167
|
+
size: e.size,
|
|
4168
|
+
showPageNumbers: !0
|
|
4169
|
+
}
|
|
4170
|
+
)
|
|
4171
|
+
}
|
|
4172
|
+
)
|
|
4173
|
+
]
|
|
4174
|
+
}
|
|
4175
|
+
);
|
|
4176
|
+
});
|
|
4177
|
+
export {
|
|
4178
|
+
ya as CustomDock,
|
|
4179
|
+
tr as DynamicForm,
|
|
4180
|
+
ia as DynamicTable,
|
|
4181
|
+
xa as GoogleNavbar,
|
|
4182
|
+
$a as Uploader,
|
|
4183
|
+
ka as generateFormItems,
|
|
4184
|
+
va as getFormDefaultValues,
|
|
4185
|
+
Na as getFormErrors,
|
|
4186
|
+
Sa as isFormValid,
|
|
4187
|
+
Or as useDynamicFormItems,
|
|
4188
|
+
ea as useDynamicTableColumns,
|
|
4189
|
+
wa as validateFormData
|
|
4190
|
+
};
|