iglooform 2.4.16 → 2.4.20
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/es/locale/zh-TW/messages.json +74 -74
- package/es/upload-photo/index.d.ts +1 -0
- package/es/upload-photo/index.js +187 -99
- package/lib/locale/zh-TW/messages.json +74 -74
- package/lib/upload-photo/index.d.ts +1 -0
- package/lib/upload-photo/index.js +187 -99
- package/package.json +1 -1
package/es/upload-photo/index.js
CHANGED
|
@@ -61,6 +61,52 @@ import FormContext from '../form-context';
|
|
|
61
61
|
var useBreakpoint = _Grid.useBreakpoint;
|
|
62
62
|
var prefix = 'igloo-upload-photo';
|
|
63
63
|
|
|
64
|
+
function ClassifyType(type) {
|
|
65
|
+
if (type.includes('image')) {
|
|
66
|
+
return 'image';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (type.includes('video')) {
|
|
70
|
+
return 'video';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (type.includes('pdf')) {
|
|
74
|
+
return 'pdf';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return 'unknown';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var getFileType = /*#__PURE__*/function () {
|
|
81
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(src) {
|
|
82
|
+
var r, contentType;
|
|
83
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
84
|
+
while (1) {
|
|
85
|
+
switch (_context.prev = _context.next) {
|
|
86
|
+
case 0:
|
|
87
|
+
_context.next = 2;
|
|
88
|
+
return fetch(src, {
|
|
89
|
+
cache: 'force-cache'
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
case 2:
|
|
93
|
+
r = _context.sent;
|
|
94
|
+
contentType = r.headers.get('content-type');
|
|
95
|
+
return _context.abrupt("return", ClassifyType(contentType));
|
|
96
|
+
|
|
97
|
+
case 5:
|
|
98
|
+
case "end":
|
|
99
|
+
return _context.stop();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, _callee);
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
return function getFileType(_x) {
|
|
106
|
+
return _ref.apply(this, arguments);
|
|
107
|
+
};
|
|
108
|
+
}();
|
|
109
|
+
|
|
64
110
|
var UploadPhoto = function UploadPhoto(props) {
|
|
65
111
|
var _classnames3, _classnames4;
|
|
66
112
|
|
|
@@ -84,46 +130,48 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
84
130
|
bizKey = props.bizKey,
|
|
85
131
|
_props$handleUpload = props.handleUpload,
|
|
86
132
|
handleUpload = _props$handleUpload === void 0 ? /*#__PURE__*/function () {
|
|
87
|
-
var
|
|
133
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(file) {
|
|
88
134
|
var formData, response, rst;
|
|
89
|
-
return regeneratorRuntime.wrap(function
|
|
135
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
90
136
|
while (1) {
|
|
91
|
-
switch (
|
|
137
|
+
switch (_context2.prev = _context2.next) {
|
|
92
138
|
case 0:
|
|
93
139
|
formData = new FormData();
|
|
94
140
|
formData.append('file', file);
|
|
95
141
|
formData.append('biz_key', bizKey);
|
|
96
|
-
|
|
142
|
+
_context2.next = 5;
|
|
97
143
|
return fetch(uploadApi, {
|
|
98
144
|
method: 'post',
|
|
99
145
|
body: formData
|
|
100
146
|
});
|
|
101
147
|
|
|
102
148
|
case 5:
|
|
103
|
-
response =
|
|
104
|
-
|
|
149
|
+
response = _context2.sent;
|
|
150
|
+
_context2.next = 8;
|
|
105
151
|
return response.json();
|
|
106
152
|
|
|
107
153
|
case 8:
|
|
108
|
-
rst =
|
|
109
|
-
return
|
|
154
|
+
rst = _context2.sent;
|
|
155
|
+
return _context2.abrupt("return", rst.url);
|
|
110
156
|
|
|
111
157
|
case 10:
|
|
112
158
|
case "end":
|
|
113
|
-
return
|
|
159
|
+
return _context2.stop();
|
|
114
160
|
}
|
|
115
161
|
}
|
|
116
|
-
},
|
|
162
|
+
}, _callee2);
|
|
117
163
|
}));
|
|
118
164
|
|
|
119
|
-
return function (
|
|
120
|
-
return
|
|
165
|
+
return function (_x2) {
|
|
166
|
+
return _ref2.apply(this, arguments);
|
|
121
167
|
};
|
|
122
168
|
}() : _props$handleUpload,
|
|
123
169
|
setFieldError = props.setFieldError,
|
|
124
170
|
className = props.className,
|
|
125
171
|
id = props.id,
|
|
126
|
-
validateField = props.validateField
|
|
172
|
+
validateField = props.validateField,
|
|
173
|
+
_props$capture = props.capture,
|
|
174
|
+
capture = _props$capture === void 0 ? false : _props$capture;
|
|
127
175
|
|
|
128
176
|
var _useContext2 = useContext(LocaleContext),
|
|
129
177
|
formatMessage = _useContext2.formatMessage;
|
|
@@ -132,17 +180,7 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
132
180
|
_useState2 = _slicedToArray(_useState, 1),
|
|
133
181
|
isMobile = _useState2[0];
|
|
134
182
|
|
|
135
|
-
var _useState3 = useState(
|
|
136
|
-
return {
|
|
137
|
-
url: url,
|
|
138
|
-
dataUrl: url,
|
|
139
|
-
status: 'success',
|
|
140
|
-
type: '',
|
|
141
|
-
name: "File".concat(index + 1),
|
|
142
|
-
size: 0,
|
|
143
|
-
uid: index
|
|
144
|
-
};
|
|
145
|
-
})),
|
|
183
|
+
var _useState3 = useState([]),
|
|
146
184
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
147
185
|
files = _useState4[0],
|
|
148
186
|
setFiles = _useState4[1];
|
|
@@ -155,14 +193,64 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
155
193
|
var _useBreakpoint = useBreakpoint(),
|
|
156
194
|
md = _useBreakpoint.md;
|
|
157
195
|
|
|
196
|
+
var mapFilesFromValue = function mapFilesFromValue(urls) {
|
|
197
|
+
var _files = [];
|
|
198
|
+
Promise.all(urls.map( /*#__PURE__*/function () {
|
|
199
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(url, index) {
|
|
200
|
+
var type;
|
|
201
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
202
|
+
while (1) {
|
|
203
|
+
switch (_context3.prev = _context3.next) {
|
|
204
|
+
case 0:
|
|
205
|
+
_context3.next = 2;
|
|
206
|
+
return getFileType(url);
|
|
207
|
+
|
|
208
|
+
case 2:
|
|
209
|
+
type = _context3.sent;
|
|
210
|
+
|
|
211
|
+
_files.push({
|
|
212
|
+
url: url,
|
|
213
|
+
dataUrl: url,
|
|
214
|
+
status: 'success',
|
|
215
|
+
type: type,
|
|
216
|
+
name: "File".concat(index + 1),
|
|
217
|
+
size: 0,
|
|
218
|
+
uid: index
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
case 4:
|
|
222
|
+
case "end":
|
|
223
|
+
return _context3.stop();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}, _callee3);
|
|
227
|
+
}));
|
|
228
|
+
|
|
229
|
+
return function (_x3, _x4) {
|
|
230
|
+
return _ref3.apply(this, arguments);
|
|
231
|
+
};
|
|
232
|
+
}())).then(function () {
|
|
233
|
+
return setFiles(_files);
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
useEffect(function () {
|
|
238
|
+
if (Array.isArray(value) && value.some(function (url) {
|
|
239
|
+
return typeof url === 'string' && !files.find(function (file) {
|
|
240
|
+
return file.url === url;
|
|
241
|
+
});
|
|
242
|
+
})) {
|
|
243
|
+
mapFilesFromValue(value);
|
|
244
|
+
}
|
|
245
|
+
}, [value, files]);
|
|
158
246
|
var uploadId = useMemo(function () {
|
|
159
247
|
return "igloo-upload-photo-input-".concat(Math.random());
|
|
160
248
|
}, []);
|
|
161
249
|
var uploadIndex = useRef((value === null || value === void 0 ? void 0 : value.length) ? value.length : 0);
|
|
162
250
|
useEffect(function () {
|
|
163
251
|
return function () {
|
|
164
|
-
files.forEach(function (
|
|
165
|
-
var dataUrl =
|
|
252
|
+
files.forEach(function (_ref4) {
|
|
253
|
+
var dataUrl = _ref4.dataUrl;
|
|
166
254
|
URL.revokeObjectURL(dataUrl);
|
|
167
255
|
});
|
|
168
256
|
};
|
|
@@ -232,12 +320,12 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
232
320
|
};
|
|
233
321
|
|
|
234
322
|
var uploadFile = /*#__PURE__*/function () {
|
|
235
|
-
var
|
|
323
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(file, currentIndex) {
|
|
236
324
|
var uid, dataUrl, name, size, mimeType, type, errorMsg, _errorMsg;
|
|
237
325
|
|
|
238
|
-
return regeneratorRuntime.wrap(function
|
|
326
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
239
327
|
while (1) {
|
|
240
|
-
switch (
|
|
328
|
+
switch (_context4.prev = _context4.next) {
|
|
241
329
|
case 0:
|
|
242
330
|
uid = ++uploadIndex.current;
|
|
243
331
|
dataUrl = URL.createObjectURL(file);
|
|
@@ -245,7 +333,7 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
245
333
|
type = classifyType(mimeType);
|
|
246
334
|
|
|
247
335
|
if (!(type === 'unknown')) {
|
|
248
|
-
|
|
336
|
+
_context4.next = 9;
|
|
249
337
|
break;
|
|
250
338
|
}
|
|
251
339
|
|
|
@@ -254,11 +342,11 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
254
342
|
});
|
|
255
343
|
limitNumError.current = errorMsg;
|
|
256
344
|
setFieldError && setFieldError(errorMsg);
|
|
257
|
-
return
|
|
345
|
+
return _context4.abrupt("return", Promise.reject(errorMsg));
|
|
258
346
|
|
|
259
347
|
case 9:
|
|
260
348
|
if (!(limit && currentIndex > limit)) {
|
|
261
|
-
|
|
349
|
+
_context4.next = 14;
|
|
262
350
|
break;
|
|
263
351
|
}
|
|
264
352
|
|
|
@@ -270,7 +358,7 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
270
358
|
});
|
|
271
359
|
limitNumError.current = _errorMsg;
|
|
272
360
|
setFieldError && setFieldError(_errorMsg);
|
|
273
|
-
return
|
|
361
|
+
return _context4.abrupt("return", Promise.reject(_errorMsg));
|
|
274
362
|
|
|
275
363
|
case 14:
|
|
276
364
|
limitNumError.current = undefined;
|
|
@@ -285,7 +373,7 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
285
373
|
uid: uid
|
|
286
374
|
}]);
|
|
287
375
|
});
|
|
288
|
-
return
|
|
376
|
+
return _context4.abrupt("return", handleUploadPromise(file, function (url) {
|
|
289
377
|
var urls = [];
|
|
290
378
|
setFiles(function (files) {
|
|
291
379
|
return files.map(function (f) {
|
|
@@ -348,63 +436,63 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
348
436
|
|
|
349
437
|
case 17:
|
|
350
438
|
case "end":
|
|
351
|
-
return
|
|
439
|
+
return _context4.stop();
|
|
352
440
|
}
|
|
353
441
|
}
|
|
354
|
-
},
|
|
442
|
+
}, _callee4);
|
|
355
443
|
}));
|
|
356
444
|
|
|
357
|
-
return function uploadFile(
|
|
358
|
-
return
|
|
445
|
+
return function uploadFile(_x5, _x6) {
|
|
446
|
+
return _ref5.apply(this, arguments);
|
|
359
447
|
};
|
|
360
448
|
}();
|
|
361
449
|
|
|
362
450
|
var handleUploadPromise = /*#__PURE__*/function () {
|
|
363
|
-
var
|
|
451
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(file, onSuccess, onFailed) {
|
|
364
452
|
var rst, errorMsg;
|
|
365
|
-
return regeneratorRuntime.wrap(function
|
|
453
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
366
454
|
while (1) {
|
|
367
|
-
switch (
|
|
455
|
+
switch (_context5.prev = _context5.next) {
|
|
368
456
|
case 0:
|
|
369
|
-
|
|
370
|
-
|
|
457
|
+
_context5.prev = 0;
|
|
458
|
+
_context5.next = 3;
|
|
371
459
|
return handleUpload(file);
|
|
372
460
|
|
|
373
461
|
case 3:
|
|
374
|
-
rst =
|
|
462
|
+
rst = _context5.sent;
|
|
375
463
|
onSuccess(rst);
|
|
376
|
-
return
|
|
464
|
+
return _context5.abrupt("return", Promise.resolve(rst));
|
|
377
465
|
|
|
378
466
|
case 8:
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
errorMsg = _typeof(
|
|
467
|
+
_context5.prev = 8;
|
|
468
|
+
_context5.t0 = _context5["catch"](0);
|
|
469
|
+
errorMsg = _typeof(_context5.t0) === 'object' ? _context5.t0.message : _context5.t0;
|
|
382
470
|
onFailed(errorMsg);
|
|
383
|
-
return
|
|
471
|
+
return _context5.abrupt("return", Promise.reject(errorMsg));
|
|
384
472
|
|
|
385
473
|
case 13:
|
|
386
474
|
case "end":
|
|
387
|
-
return
|
|
475
|
+
return _context5.stop();
|
|
388
476
|
}
|
|
389
477
|
}
|
|
390
|
-
},
|
|
478
|
+
}, _callee5, null, [[0, 8]]);
|
|
391
479
|
}));
|
|
392
480
|
|
|
393
|
-
return function handleUploadPromise(
|
|
394
|
-
return
|
|
481
|
+
return function handleUploadPromise(_x7, _x8, _x9) {
|
|
482
|
+
return _ref6.apply(this, arguments);
|
|
395
483
|
};
|
|
396
484
|
}();
|
|
397
485
|
|
|
398
486
|
var handleDelete = /*#__PURE__*/function () {
|
|
399
|
-
var
|
|
487
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(index) {
|
|
400
488
|
var arr, hasError, rst;
|
|
401
|
-
return regeneratorRuntime.wrap(function
|
|
489
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
402
490
|
while (1) {
|
|
403
|
-
switch (
|
|
491
|
+
switch (_context6.prev = _context6.next) {
|
|
404
492
|
case 0:
|
|
405
493
|
limitNumError.current = null;
|
|
406
494
|
arr = files;
|
|
407
|
-
|
|
495
|
+
_context6.next = 4;
|
|
408
496
|
return setFiles(function (files) {
|
|
409
497
|
var newArr = files.filter(function (_, i) {
|
|
410
498
|
return i !== index;
|
|
@@ -414,7 +502,7 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
414
502
|
});
|
|
415
503
|
|
|
416
504
|
case 4:
|
|
417
|
-
|
|
505
|
+
_context6.next = 6;
|
|
418
506
|
return setMasks(function (masks) {
|
|
419
507
|
return masks.filter(function (_, i) {
|
|
420
508
|
return i !== index;
|
|
@@ -428,7 +516,7 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
428
516
|
});
|
|
429
517
|
|
|
430
518
|
if (!hasError) {
|
|
431
|
-
|
|
519
|
+
_context6.next = 10;
|
|
432
520
|
break;
|
|
433
521
|
}
|
|
434
522
|
|
|
@@ -441,46 +529,46 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
441
529
|
|
|
442
530
|
return f.url;
|
|
443
531
|
});
|
|
444
|
-
return
|
|
532
|
+
return _context6.abrupt("return", typeof onChange === 'function' && onChange(rst));
|
|
445
533
|
|
|
446
534
|
case 10:
|
|
447
|
-
typeof onChange === 'function' && onChange(arr.map(function (
|
|
448
|
-
var url =
|
|
535
|
+
typeof onChange === 'function' && onChange(arr.map(function (_ref8) {
|
|
536
|
+
var url = _ref8.url;
|
|
449
537
|
return url;
|
|
450
538
|
}));
|
|
451
539
|
|
|
452
540
|
case 11:
|
|
453
541
|
case "end":
|
|
454
|
-
return
|
|
542
|
+
return _context6.stop();
|
|
455
543
|
}
|
|
456
544
|
}
|
|
457
|
-
},
|
|
545
|
+
}, _callee6);
|
|
458
546
|
}));
|
|
459
547
|
|
|
460
|
-
return function handleDelete(
|
|
461
|
-
return
|
|
548
|
+
return function handleDelete(_x10) {
|
|
549
|
+
return _ref7.apply(this, arguments);
|
|
462
550
|
};
|
|
463
551
|
}();
|
|
464
552
|
|
|
465
553
|
var handleReUpload = /*#__PURE__*/function () {
|
|
466
|
-
var
|
|
554
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(index) {
|
|
467
555
|
var _files$index, originFile, reUpUid, rst, latestFiles, fileListWithError, newList, _rst;
|
|
468
556
|
|
|
469
|
-
return regeneratorRuntime.wrap(function
|
|
557
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
470
558
|
while (1) {
|
|
471
|
-
switch (
|
|
559
|
+
switch (_context7.prev = _context7.next) {
|
|
472
560
|
case 0:
|
|
473
561
|
_files$index = files[index], originFile = _files$index.originFile, reUpUid = _files$index.uid;
|
|
474
562
|
|
|
475
563
|
if (originFile) {
|
|
476
|
-
|
|
564
|
+
_context7.next = 3;
|
|
477
565
|
break;
|
|
478
566
|
}
|
|
479
567
|
|
|
480
|
-
return
|
|
568
|
+
return _context7.abrupt("return");
|
|
481
569
|
|
|
482
570
|
case 3:
|
|
483
|
-
|
|
571
|
+
_context7.next = 5;
|
|
484
572
|
return setFiles(function (files) {
|
|
485
573
|
var newFiles = _toConsumableArray(files);
|
|
486
574
|
|
|
@@ -489,14 +577,14 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
489
577
|
});
|
|
490
578
|
|
|
491
579
|
case 5:
|
|
492
|
-
|
|
493
|
-
|
|
580
|
+
_context7.prev = 5;
|
|
581
|
+
_context7.next = 8;
|
|
494
582
|
return handleUpload(originFile);
|
|
495
583
|
|
|
496
584
|
case 8:
|
|
497
|
-
rst =
|
|
585
|
+
rst = _context7.sent;
|
|
498
586
|
latestFiles = [];
|
|
499
|
-
|
|
587
|
+
_context7.next = 12;
|
|
500
588
|
return setFiles(function (files) {
|
|
501
589
|
var newFiles = _toConsumableArray(files);
|
|
502
590
|
|
|
@@ -524,19 +612,19 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
524
612
|
return url;
|
|
525
613
|
});
|
|
526
614
|
onChange && onChange(fileListWithError);
|
|
527
|
-
|
|
615
|
+
_context7.next = 23;
|
|
528
616
|
break;
|
|
529
617
|
|
|
530
618
|
case 16:
|
|
531
|
-
|
|
532
|
-
|
|
619
|
+
_context7.prev = 16;
|
|
620
|
+
_context7.t0 = _context7["catch"](5);
|
|
533
621
|
newList = [];
|
|
534
|
-
|
|
622
|
+
_context7.next = 21;
|
|
535
623
|
return setFiles(function (files) {
|
|
536
624
|
var newFiles = _toConsumableArray(files);
|
|
537
625
|
|
|
538
626
|
newFiles[index].status = 'failed';
|
|
539
|
-
newFiles[index].errorMsg =
|
|
627
|
+
newFiles[index].errorMsg = _context7.t0;
|
|
540
628
|
newList = newFiles;
|
|
541
629
|
return newFiles;
|
|
542
630
|
});
|
|
@@ -567,14 +655,14 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
567
655
|
|
|
568
656
|
case 24:
|
|
569
657
|
case "end":
|
|
570
|
-
return
|
|
658
|
+
return _context7.stop();
|
|
571
659
|
}
|
|
572
660
|
}
|
|
573
|
-
},
|
|
661
|
+
}, _callee7, null, [[5, 16]]);
|
|
574
662
|
}));
|
|
575
663
|
|
|
576
|
-
return function handleReUpload(
|
|
577
|
-
return
|
|
664
|
+
return function handleReUpload(_x11) {
|
|
665
|
+
return _ref9.apply(this, arguments);
|
|
578
666
|
};
|
|
579
667
|
}();
|
|
580
668
|
|
|
@@ -667,12 +755,12 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
667
755
|
children: _jsxs(_Row, {
|
|
668
756
|
gutter: [isMobile ? 16 : 32, 16],
|
|
669
757
|
wrap: true,
|
|
670
|
-
children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (
|
|
758
|
+
children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (_ref10, index) {
|
|
671
759
|
var _classnames, _classnames2;
|
|
672
760
|
|
|
673
|
-
var src =
|
|
674
|
-
label =
|
|
675
|
-
type =
|
|
761
|
+
var src = _ref10.src,
|
|
762
|
+
label = _ref10.label,
|
|
763
|
+
type = _ref10.type;
|
|
676
764
|
return _jsxs(_Col, {
|
|
677
765
|
span: sampleSpan,
|
|
678
766
|
children: [_jsx("img", {
|
|
@@ -708,7 +796,7 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
708
796
|
accept: "image/*,video/*,application/pdf",
|
|
709
797
|
value: [],
|
|
710
798
|
multiple: true,
|
|
711
|
-
capture:
|
|
799
|
+
capture: capture
|
|
712
800
|
}, void 0), _jsxs(_Space, {
|
|
713
801
|
className: "".concat(prefix, "-content"),
|
|
714
802
|
size: [16, 16],
|
|
@@ -732,13 +820,13 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
732
820
|
children: buttonText || 'Upload'
|
|
733
821
|
}, void 0)
|
|
734
822
|
}, void 0)]
|
|
735
|
-
}, void 0), files.map(function (
|
|
823
|
+
}, void 0), files.map(function (_ref11, index) {
|
|
736
824
|
var _classnames5;
|
|
737
825
|
|
|
738
|
-
var dataUrl =
|
|
739
|
-
status =
|
|
740
|
-
type =
|
|
741
|
-
uid =
|
|
826
|
+
var dataUrl = _ref11.dataUrl,
|
|
827
|
+
status = _ref11.status,
|
|
828
|
+
type = _ref11.type,
|
|
829
|
+
uid = _ref11.uid;
|
|
742
830
|
return _jsx(_Badge, {
|
|
743
831
|
count: getBadge(status, index, limit),
|
|
744
832
|
children: _jsxs("div", {
|
|
@@ -806,10 +894,10 @@ function checkFileList(value) {
|
|
|
806
894
|
return Promise.resolve();
|
|
807
895
|
}
|
|
808
896
|
|
|
809
|
-
UploadPhoto.formItemPropsHandler = function (
|
|
810
|
-
var limit =
|
|
811
|
-
previewFormater =
|
|
812
|
-
label =
|
|
897
|
+
UploadPhoto.formItemPropsHandler = function (_ref12) {
|
|
898
|
+
var limit = _ref12.limit,
|
|
899
|
+
previewFormater = _ref12.previewFormater,
|
|
900
|
+
label = _ref12.label;
|
|
813
901
|
return {
|
|
814
902
|
previewFormater: previewFormater || function (value) {
|
|
815
903
|
return _jsx(UploadPreview, {
|