@kingteza/crud-component 1.44.1 → 1.44.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/picker/ImagePicker.cjs.js +1 -1
- package/dist/common/picker/ImagePicker.d.ts +4 -2
- package/dist/common/picker/ImagePicker.es.js +291 -251
- package/dist/crud/ImageCrudField.cjs.js +1 -1
- package/dist/crud/ImageCrudField.d.ts +1 -1
- package/dist/crud/ImageCrudField.es.js +127 -92
- package/dist/crud/modal/index.cjs.js +1 -1
- package/dist/crud/modal/index.es.js +120 -109
- package/package.json +1 -1
|
@@ -1,368 +1,408 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Cropper as
|
|
3
|
-
import { RotateLeftOutlined as
|
|
4
|
-
import { Form as
|
|
5
|
-
import
|
|
6
|
-
import { useTranslationLib as
|
|
7
|
-
import
|
|
1
|
+
import { jsx as o, jsxs as U, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
+
import { Cropper as ze } from "react-advanced-cropper";
|
|
3
|
+
import { RotateLeftOutlined as Be, RotateRightOutlined as Re, UploadOutlined as we, LoadingOutlined as Te } from "@ant-design/icons";
|
|
4
|
+
import { Form as Le, Modal as ue, Space as me, Upload as De } from "antd";
|
|
5
|
+
import A, { useRef as G, useState as I, useCallback as _, useEffect as E, useMemo as fe } from "react";
|
|
6
|
+
import { useTranslationLib as He } from "../../locale/index.es.js";
|
|
7
|
+
import x from "../button/Button.es.js";
|
|
8
8
|
import ge from "../../util/ImageUtil.es.js";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
return new Promise((
|
|
14
|
-
const
|
|
15
|
-
|
|
9
|
+
import Ve from "../../icons/FlipHIcon.es.js";
|
|
10
|
+
import _e from "../../icons/FlipVIcon.es.js";
|
|
11
|
+
const Ee = Le.Item, he = "crud-component.image-picker.button-state";
|
|
12
|
+
function K(c) {
|
|
13
|
+
return new Promise((b, y) => {
|
|
14
|
+
const n = new FileReader();
|
|
15
|
+
n.readAsDataURL(c), n.onload = () => b(n.result), n.onerror = (m) => y(m);
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
const et = ({
|
|
19
|
-
values:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
values: c = [],
|
|
20
|
+
getRealUrl: b,
|
|
21
|
+
required: y,
|
|
22
|
+
buttonType: n,
|
|
23
|
+
label: m,
|
|
24
|
+
name: M,
|
|
25
|
+
onChange: C,
|
|
26
|
+
aspectRatio: F,
|
|
27
|
+
buttonTitle: z,
|
|
28
|
+
hidePreview: k,
|
|
29
|
+
buttonSize: O = "large",
|
|
30
|
+
showButtonText: B = !0,
|
|
31
|
+
showOnlyIcon: Q = !1,
|
|
32
|
+
icon: R = /* @__PURE__ */ o(we, {}),
|
|
33
|
+
loading: N,
|
|
34
|
+
maxCount: s = 1,
|
|
35
|
+
onAdd: S,
|
|
36
|
+
onRemove: T,
|
|
37
|
+
listType: X,
|
|
37
38
|
showSkipCropButton: ve,
|
|
38
|
-
skipResize:
|
|
39
|
-
asyncUpload:
|
|
40
|
-
...
|
|
39
|
+
skipResize: J,
|
|
40
|
+
asyncUpload: L,
|
|
41
|
+
...Y
|
|
41
42
|
}) => {
|
|
42
|
-
const [be,
|
|
43
|
-
!e.url && !e.preview && (e.preview = await
|
|
44
|
-
}, [
|
|
43
|
+
const [be, ye] = A.useState(""), [Fe, Ie] = A.useState(""), [Ce, Z] = A.useState(!1), D = G(), f = G(null), [d, g] = I([]), [j, H] = I(), ke = G(), Oe = () => Z(!1), Se = async (e) => {
|
|
44
|
+
!e.url && !e.preview && (e.preview = await K(e.originFileObj)), Ie(e.url || e.preview), Z(!0), ye(e.name);
|
|
45
|
+
}, [q, P] = I(!1), ee = (e) => {
|
|
45
46
|
var t;
|
|
46
|
-
(t =
|
|
47
|
-
},
|
|
47
|
+
(t = f.current) == null || t.rotateImage(e ? -90 : 90);
|
|
48
|
+
}, te = _((e) => {
|
|
48
49
|
var t;
|
|
49
|
-
|
|
50
|
+
f.current && ((t = f.current) == null || t.flipImage(e === "h", e === "v"));
|
|
50
51
|
}, []);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
-
const [
|
|
52
|
+
E(() => {
|
|
53
|
+
C == null || C(d[0], d);
|
|
54
|
+
}, [d, C]);
|
|
55
|
+
const [V, W] = I(), oe = _(
|
|
55
56
|
async (e) => {
|
|
56
|
-
var
|
|
57
|
-
const { type: t, size:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
name: I,
|
|
62
|
-
uid: k,
|
|
63
|
-
type: t,
|
|
64
|
-
size: a,
|
|
65
|
-
thumbUrl: U,
|
|
66
|
-
originFileObj: E,
|
|
67
|
-
status: j ? "uploading" : void 0
|
|
68
|
-
};
|
|
69
|
-
if (n)
|
|
57
|
+
var ce;
|
|
58
|
+
const { type: t, size: i, name: w, uid: a } = D.current;
|
|
59
|
+
W(e ? "skip-crop" : "crop"), P(!0);
|
|
60
|
+
const v = async (r) => {
|
|
61
|
+
if (S)
|
|
70
62
|
try {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
(
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
if (P(!0), L)
|
|
64
|
+
g(
|
|
65
|
+
(l) => s <= 1 ? [r] : [r, ...l]
|
|
66
|
+
), S(r).then((l) => {
|
|
67
|
+
g(
|
|
68
|
+
(p) => p.map(
|
|
69
|
+
(u) => u.uid === r.uid ? {
|
|
70
|
+
...u,
|
|
71
|
+
status: "done",
|
|
72
|
+
response: l ?? u.response
|
|
73
|
+
} : u
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
else {
|
|
78
|
+
const l = await S(r), p = {
|
|
79
|
+
...r,
|
|
80
|
+
response: l ?? r.response,
|
|
81
|
+
status: "done"
|
|
82
|
+
};
|
|
83
|
+
g(
|
|
84
|
+
(u) => s <= 1 ? [p] : [p, ...u]
|
|
76
85
|
);
|
|
77
|
-
}
|
|
86
|
+
}
|
|
78
87
|
} finally {
|
|
79
|
-
|
|
88
|
+
P(!1);
|
|
80
89
|
}
|
|
81
|
-
|
|
90
|
+
else
|
|
91
|
+
g((l) => s <= 1 ? [r] : [r, ...l]);
|
|
92
|
+
};
|
|
93
|
+
if (e) {
|
|
94
|
+
const r = D.current, l = J ? r : await ge.resizeImage(r), p = await K(l);
|
|
95
|
+
await v({
|
|
96
|
+
url: p,
|
|
97
|
+
name: w,
|
|
98
|
+
uid: a,
|
|
99
|
+
type: t,
|
|
100
|
+
size: i,
|
|
101
|
+
thumbUrl: p,
|
|
102
|
+
originFileObj: l,
|
|
103
|
+
status: L ? "uploading" : void 0
|
|
104
|
+
}), P(!1), H(void 0), W(void 0);
|
|
82
105
|
} else {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
uid:
|
|
87
|
-
}), u =
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
106
|
+
const r = (ce = f.current) == null ? void 0 : ce.getCanvas();
|
|
107
|
+
r == null || r.toBlob(async (l) => {
|
|
108
|
+
const p = Object.assign(new File([l], w, { type: t }), {
|
|
109
|
+
uid: a
|
|
110
|
+
}), u = J ? p : await ge.resizeImage(p), de = await K(u);
|
|
111
|
+
await v({
|
|
112
|
+
url: de,
|
|
113
|
+
name: w,
|
|
114
|
+
uid: a,
|
|
91
115
|
type: t,
|
|
92
|
-
size:
|
|
93
|
-
thumbUrl:
|
|
116
|
+
size: i,
|
|
117
|
+
thumbUrl: de,
|
|
94
118
|
originFileObj: u,
|
|
95
|
-
status:
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
b(
|
|
99
|
-
(Ue) => Ue.map(
|
|
100
|
-
(G) => G.uid === d.uid ? { ...G, status: "done" } : G
|
|
101
|
-
)
|
|
102
|
-
);
|
|
103
|
-
}) : await n(d)), b([d, ...s]), z(!1);
|
|
104
|
-
}), V(void 0), $(void 0);
|
|
119
|
+
status: L ? "uploading" : void 0
|
|
120
|
+
}), P(!1), H(void 0), W(void 0);
|
|
121
|
+
});
|
|
105
122
|
}
|
|
106
123
|
},
|
|
107
|
-
[
|
|
108
|
-
),
|
|
109
|
-
|
|
110
|
-
},
|
|
124
|
+
[L, s, S, J]
|
|
125
|
+
), je = () => {
|
|
126
|
+
H(void 0), D.current = void 0;
|
|
127
|
+
}, re = _((e) => {
|
|
111
128
|
const t = e;
|
|
112
129
|
if (t) {
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
var
|
|
117
|
-
if (typeof
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
130
|
+
D.current = t;
|
|
131
|
+
const i = new FileReader();
|
|
132
|
+
i.addEventListener("load", () => {
|
|
133
|
+
var w;
|
|
134
|
+
if (typeof i.result == "string") {
|
|
135
|
+
H(i.result);
|
|
136
|
+
const a = localStorage.getItem(he), v = a ? JSON.parse(a) : void 0;
|
|
137
|
+
v && ((w = f.current) == null || w.setState(v)), setTimeout(() => {
|
|
138
|
+
le(f.current);
|
|
122
139
|
}, 100);
|
|
123
140
|
}
|
|
124
|
-
}),
|
|
141
|
+
}), i.readAsDataURL(t);
|
|
125
142
|
}
|
|
126
143
|
}, []);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
144
|
+
E(() => {
|
|
145
|
+
let e = !1;
|
|
146
|
+
return (async () => {
|
|
147
|
+
if (c == null || c === "") {
|
|
148
|
+
e || g([]);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const i = typeof c == "string" ? [c] : c;
|
|
152
|
+
if (!i.length) {
|
|
153
|
+
e || g([]);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const w = await Promise.all(
|
|
157
|
+
i.map(async (a) => {
|
|
158
|
+
const v = b ? await b(a) : a;
|
|
159
|
+
return {
|
|
160
|
+
uid: a,
|
|
161
|
+
url: v,
|
|
162
|
+
thumbUrl: v,
|
|
163
|
+
response: a,
|
|
164
|
+
name: a.split("/").pop() ?? a
|
|
165
|
+
};
|
|
166
|
+
})
|
|
167
|
+
);
|
|
168
|
+
e || g(w);
|
|
169
|
+
})(), () => {
|
|
170
|
+
e = !0;
|
|
171
|
+
};
|
|
172
|
+
}, [c, b]);
|
|
173
|
+
const { t: h } = He(), xe = fe(
|
|
174
|
+
() => y ? {
|
|
175
|
+
required: y,
|
|
176
|
+
validator: (e, t, i) => {
|
|
177
|
+
j || d != null && d.length ? i() : i(`${m ?? ""} ${h("err.validation.required")}`);
|
|
138
178
|
}
|
|
139
179
|
} : void 0,
|
|
140
|
-
[
|
|
141
|
-
),
|
|
142
|
-
() => /* @__PURE__ */
|
|
143
|
-
|
|
180
|
+
[y, j, d == null ? void 0 : d.length, m, h]
|
|
181
|
+
), ie = z ?? h("message.uploadButtonText"), ne = fe(
|
|
182
|
+
() => /* @__PURE__ */ o(
|
|
183
|
+
Me,
|
|
144
184
|
{
|
|
145
|
-
showLoadingIndicator:
|
|
146
|
-
_buttonTitle:
|
|
147
|
-
buttonSize:
|
|
148
|
-
buttonType:
|
|
149
|
-
fileList:
|
|
150
|
-
hidePreview:
|
|
151
|
-
icon:
|
|
152
|
-
loading:
|
|
153
|
-
listType:
|
|
154
|
-
maxCount:
|
|
155
|
-
onChangeFile:
|
|
156
|
-
onRemove:
|
|
157
|
-
showButtonText:
|
|
158
|
-
handlePreview:
|
|
159
|
-
setFileList:
|
|
185
|
+
showLoadingIndicator: q,
|
|
186
|
+
_buttonTitle: ie,
|
|
187
|
+
buttonSize: O,
|
|
188
|
+
buttonType: n,
|
|
189
|
+
fileList: d,
|
|
190
|
+
hidePreview: k,
|
|
191
|
+
icon: R,
|
|
192
|
+
loading: N,
|
|
193
|
+
listType: X,
|
|
194
|
+
maxCount: s,
|
|
195
|
+
onChangeFile: re,
|
|
196
|
+
onRemove: T,
|
|
197
|
+
showButtonText: B,
|
|
198
|
+
handlePreview: Se,
|
|
199
|
+
setFileList: g
|
|
160
200
|
}
|
|
161
201
|
),
|
|
162
202
|
[
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
203
|
+
q,
|
|
204
|
+
ie,
|
|
205
|
+
O,
|
|
206
|
+
n,
|
|
207
|
+
d,
|
|
208
|
+
k,
|
|
209
|
+
R,
|
|
210
|
+
N,
|
|
211
|
+
X,
|
|
167
212
|
s,
|
|
168
|
-
|
|
169
|
-
P,
|
|
213
|
+
re,
|
|
170
214
|
T,
|
|
171
|
-
|
|
172
|
-
R,
|
|
173
|
-
ne,
|
|
174
|
-
D,
|
|
175
|
-
v
|
|
215
|
+
B
|
|
176
216
|
]
|
|
177
217
|
);
|
|
178
|
-
|
|
179
|
-
const [
|
|
180
|
-
|
|
218
|
+
ke.current = ne.props.beforeUpload;
|
|
219
|
+
const [Ne, se] = I(0), [Pe, ae] = I(0), [$, Ue] = I();
|
|
220
|
+
E(() => {
|
|
181
221
|
const e = setTimeout(() => {
|
|
182
|
-
|
|
222
|
+
$ && localStorage.setItem(he, JSON.stringify($));
|
|
183
223
|
}, 400);
|
|
184
224
|
return () => clearTimeout(e);
|
|
185
|
-
}, [
|
|
186
|
-
if (!
|
|
187
|
-
|
|
225
|
+
}, [$]), E(() => {
|
|
226
|
+
if (!j) {
|
|
227
|
+
se(0), ae(0);
|
|
188
228
|
const e = setTimeout(() => {
|
|
189
229
|
var t;
|
|
190
|
-
(t =
|
|
230
|
+
(t = f.current) == null || t.reset();
|
|
191
231
|
}, 1500);
|
|
192
232
|
return () => clearTimeout(e);
|
|
193
233
|
}
|
|
194
|
-
}, [
|
|
195
|
-
const
|
|
234
|
+
}, [j]);
|
|
235
|
+
const le = _(async (e) => {
|
|
196
236
|
if (e) {
|
|
197
237
|
const t = e.getCoordinates();
|
|
198
|
-
|
|
238
|
+
Ue(e.getState()), se((t == null ? void 0 : t.width) ?? 10), ae((t == null ? void 0 : t.height) ?? 10);
|
|
199
239
|
}
|
|
200
240
|
}, []);
|
|
201
|
-
return /* @__PURE__ */
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
|
|
241
|
+
return /* @__PURE__ */ U(pe, { children: [
|
|
242
|
+
/* @__PURE__ */ o(
|
|
243
|
+
Ee,
|
|
204
244
|
{
|
|
205
|
-
label:
|
|
206
|
-
...
|
|
207
|
-
name:
|
|
245
|
+
label: m,
|
|
246
|
+
...Y,
|
|
247
|
+
name: M,
|
|
208
248
|
className: "mb-0",
|
|
209
|
-
rules: [
|
|
210
|
-
children:
|
|
249
|
+
rules: [xe, ...Y.rules ?? []],
|
|
250
|
+
children: ne
|
|
211
251
|
}
|
|
212
252
|
),
|
|
213
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ U(
|
|
214
254
|
ue,
|
|
215
255
|
{
|
|
216
|
-
open: !!
|
|
256
|
+
open: !!j,
|
|
217
257
|
maskClosable: !1,
|
|
218
|
-
onOk: () =>
|
|
258
|
+
onOk: () => oe(!1),
|
|
219
259
|
closable: !1,
|
|
220
260
|
okButtonProps: {
|
|
221
|
-
loading:
|
|
222
|
-
disabled:
|
|
261
|
+
loading: V === "crop",
|
|
262
|
+
disabled: V === "skip-crop"
|
|
223
263
|
},
|
|
224
|
-
onCancel:
|
|
225
|
-
footer: (e, { CancelBtn: t, OkBtn:
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
|
|
264
|
+
onCancel: je,
|
|
265
|
+
footer: (e, { CancelBtn: t, OkBtn: i }) => ve ? /* @__PURE__ */ U(me, { children: [
|
|
266
|
+
/* @__PURE__ */ o(t, {}),
|
|
267
|
+
/* @__PURE__ */ o(
|
|
268
|
+
x,
|
|
229
269
|
{
|
|
230
270
|
type: "primary",
|
|
231
|
-
loading:
|
|
232
|
-
disabled:
|
|
233
|
-
onClick: () =>
|
|
234
|
-
children:
|
|
271
|
+
loading: V === "skip-crop",
|
|
272
|
+
disabled: V === "crop",
|
|
273
|
+
onClick: () => oe(!0),
|
|
274
|
+
children: h("str.skipCrop")
|
|
235
275
|
}
|
|
236
276
|
),
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
-
] }) : /* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ o(i, {})
|
|
278
|
+
] }) : /* @__PURE__ */ o(pe, { children: e }),
|
|
239
279
|
destroyOnHidden: !0,
|
|
240
280
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
|
|
281
|
+
/* @__PURE__ */ o(
|
|
282
|
+
ze,
|
|
243
283
|
{
|
|
244
|
-
ref:
|
|
284
|
+
ref: f,
|
|
245
285
|
stencilProps: {
|
|
246
286
|
grid: !0
|
|
247
287
|
},
|
|
248
288
|
style: { border: "1px solid black" },
|
|
249
|
-
src:
|
|
289
|
+
src: j,
|
|
250
290
|
onChange: (e) => {
|
|
251
|
-
|
|
291
|
+
le(e);
|
|
252
292
|
},
|
|
253
|
-
aspectRatio:
|
|
254
|
-
minimum:
|
|
255
|
-
maximum:
|
|
293
|
+
aspectRatio: F ? {
|
|
294
|
+
minimum: F,
|
|
295
|
+
maximum: F
|
|
256
296
|
} : void 0
|
|
257
297
|
}
|
|
258
298
|
),
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
/* @__PURE__ */
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
|
|
299
|
+
/* @__PURE__ */ o("p", { className: "text-center", children: [Ne, Pe].join(" ⨉ ") }),
|
|
300
|
+
/* @__PURE__ */ o("div", { className: "mt-2 d-flex justify-content-center", children: /* @__PURE__ */ U(me.Compact, { children: [
|
|
301
|
+
/* @__PURE__ */ o(
|
|
302
|
+
x,
|
|
263
303
|
{
|
|
264
304
|
size: "large",
|
|
265
|
-
tooltip:
|
|
266
|
-
icon: /* @__PURE__ */
|
|
267
|
-
onClick: () =>
|
|
305
|
+
tooltip: h("str.rotateLeft"),
|
|
306
|
+
icon: /* @__PURE__ */ o(Be, {}),
|
|
307
|
+
onClick: () => ee(!0)
|
|
268
308
|
}
|
|
269
309
|
),
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
|
|
310
|
+
/* @__PURE__ */ o(
|
|
311
|
+
x,
|
|
272
312
|
{
|
|
273
313
|
size: "large",
|
|
274
|
-
icon: /* @__PURE__ */
|
|
275
|
-
tooltip:
|
|
276
|
-
onClick: () =>
|
|
314
|
+
icon: /* @__PURE__ */ o(Re, {}),
|
|
315
|
+
tooltip: h("str.rotateRight"),
|
|
316
|
+
onClick: () => ee(!1)
|
|
277
317
|
}
|
|
278
318
|
),
|
|
279
|
-
/* @__PURE__ */
|
|
280
|
-
|
|
319
|
+
/* @__PURE__ */ o(
|
|
320
|
+
x,
|
|
281
321
|
{
|
|
282
322
|
size: "large",
|
|
283
|
-
icon: /* @__PURE__ */
|
|
284
|
-
tooltip:
|
|
285
|
-
onClick: () =>
|
|
323
|
+
icon: /* @__PURE__ */ o(Ve, {}),
|
|
324
|
+
tooltip: h("str.flipHorizontal"),
|
|
325
|
+
onClick: () => te("h")
|
|
286
326
|
}
|
|
287
327
|
),
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
|
|
328
|
+
/* @__PURE__ */ o(
|
|
329
|
+
x,
|
|
290
330
|
{
|
|
291
331
|
size: "large",
|
|
292
|
-
icon: /* @__PURE__ */
|
|
293
|
-
tooltip:
|
|
294
|
-
onClick: () =>
|
|
332
|
+
icon: /* @__PURE__ */ o(_e, {}),
|
|
333
|
+
tooltip: h("str.flipVertical"),
|
|
334
|
+
onClick: () => te("v")
|
|
295
335
|
}
|
|
296
336
|
)
|
|
297
337
|
] }) })
|
|
298
338
|
]
|
|
299
339
|
}
|
|
300
340
|
),
|
|
301
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ o(
|
|
302
342
|
ue,
|
|
303
343
|
{
|
|
304
|
-
open:
|
|
344
|
+
open: Ce,
|
|
305
345
|
title: be,
|
|
306
346
|
footer: null,
|
|
307
347
|
onCancel: Oe,
|
|
308
|
-
children: /* @__PURE__ */
|
|
348
|
+
children: /* @__PURE__ */ o("div", { className: "text-center", children: /* @__PURE__ */ o("img", { alt: "example", style: { maxWidth: "400px" }, src: Fe }) })
|
|
309
349
|
}
|
|
310
350
|
)
|
|
311
351
|
] });
|
|
312
|
-
},
|
|
313
|
-
_buttonTitle:
|
|
314
|
-
buttonSize:
|
|
315
|
-
buttonType:
|
|
316
|
-
fileList:
|
|
317
|
-
hidePreview:
|
|
318
|
-
icon:
|
|
319
|
-
loading:
|
|
320
|
-
maxCount:
|
|
321
|
-
onChangeFile:
|
|
322
|
-
onRemove:
|
|
323
|
-
showButtonText:
|
|
324
|
-
handlePreview:
|
|
325
|
-
setFileList:
|
|
326
|
-
showLoadingIndicator:
|
|
327
|
-
listType:
|
|
328
|
-
}) => /* @__PURE__ */
|
|
329
|
-
|
|
352
|
+
}, Me = ({
|
|
353
|
+
_buttonTitle: c,
|
|
354
|
+
buttonSize: b,
|
|
355
|
+
buttonType: y,
|
|
356
|
+
fileList: n,
|
|
357
|
+
hidePreview: m,
|
|
358
|
+
icon: M,
|
|
359
|
+
loading: C,
|
|
360
|
+
maxCount: F,
|
|
361
|
+
onChangeFile: z,
|
|
362
|
+
onRemove: k,
|
|
363
|
+
showButtonText: O,
|
|
364
|
+
handlePreview: B,
|
|
365
|
+
setFileList: Q,
|
|
366
|
+
showLoadingIndicator: R,
|
|
367
|
+
listType: N = "picture"
|
|
368
|
+
}) => /* @__PURE__ */ U(
|
|
369
|
+
De,
|
|
330
370
|
{
|
|
331
371
|
accept: "image/x-png,image/gif,image/jpeg",
|
|
332
|
-
fileList:
|
|
333
|
-
defaultFileList:
|
|
372
|
+
fileList: n,
|
|
373
|
+
defaultFileList: n,
|
|
334
374
|
onChange: () => {
|
|
335
375
|
},
|
|
336
|
-
className: (
|
|
376
|
+
className: (n.length >= F ? " hide-upload " : "") + " mb-0",
|
|
337
377
|
multiple: !1,
|
|
338
|
-
onPreview:
|
|
339
|
-
onDrop: (
|
|
340
|
-
listType:
|
|
341
|
-
showUploadList: !
|
|
342
|
-
onRemove: (
|
|
343
|
-
const
|
|
344
|
-
|
|
378
|
+
onPreview: m ? void 0 : B,
|
|
379
|
+
onDrop: (s) => (z(s.dataTransfer.files.item(0)), !1),
|
|
380
|
+
listType: N,
|
|
381
|
+
showUploadList: !m,
|
|
382
|
+
onRemove: (s) => {
|
|
383
|
+
const S = n.filter((T) => s.uid !== T.uid);
|
|
384
|
+
k == null || k(s), Q(S);
|
|
345
385
|
},
|
|
346
|
-
beforeUpload: async (
|
|
347
|
-
maxCount:
|
|
386
|
+
beforeUpload: async (s) => (z(s), !1),
|
|
387
|
+
maxCount: F,
|
|
348
388
|
children: [
|
|
349
|
-
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
|
|
389
|
+
R && /* @__PURE__ */ o(Te, {}),
|
|
390
|
+
/* @__PURE__ */ o("div", { className: "d-flex flex-column", children: n.length < F && (N === "picture-circle" ? /* @__PURE__ */ o(we, {}) : /* @__PURE__ */ o(
|
|
391
|
+
x,
|
|
352
392
|
{
|
|
353
|
-
loading:
|
|
354
|
-
tooltip:
|
|
355
|
-
size:
|
|
356
|
-
icon:
|
|
357
|
-
type:
|
|
358
|
-
children:
|
|
393
|
+
loading: C,
|
|
394
|
+
tooltip: O ? void 0 : c,
|
|
395
|
+
size: b,
|
|
396
|
+
icon: M,
|
|
397
|
+
type: O ? y : "text",
|
|
398
|
+
children: O ? c : void 0
|
|
359
399
|
}
|
|
360
400
|
)) })
|
|
361
401
|
]
|
|
362
402
|
},
|
|
363
|
-
|
|
403
|
+
n.length
|
|
364
404
|
);
|
|
365
405
|
export {
|
|
366
|
-
|
|
406
|
+
Me as UploadComponent,
|
|
367
407
|
et as default
|
|
368
408
|
};
|