iglooform 2.4.19 → 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.
Files changed (119) hide show
  1. package/es/admin-upload/index.js +2 -2
  2. package/es/admin-upload/job-list.js +2 -2
  3. package/es/alert-message/index.js +2 -2
  4. package/es/amount/index.js +2 -2
  5. package/es/back-top/index.js +2 -2
  6. package/es/button/index.js +2 -2
  7. package/es/card-detail/card-item.js +1 -1
  8. package/es/card-detail/card.js +2 -2
  9. package/es/card-detail/utils.js +3 -3
  10. package/es/checkbox/index.js +2 -2
  11. package/es/claim-list/index.js +2 -2
  12. package/es/date-picker/buddhist.js +2 -2
  13. package/es/date-picker/index.js +2 -2
  14. package/es/declaration/index.js +2 -2
  15. package/es/detail-panel/index.js +2 -2
  16. package/es/example/index.js +2 -2
  17. package/es/filter/index.js +3 -3
  18. package/es/form/addable-section/index.js +2 -2
  19. package/es/form/divider/index.js +2 -2
  20. package/es/form/element/index.js +3 -3
  21. package/es/form/index.js +2 -2
  22. package/es/form/section/index.js +2 -2
  23. package/es/free-form/addable-section/index.js +3 -3
  24. package/es/free-form/element/index.js +3 -3
  25. package/es/free-form/index.js +2 -2
  26. package/es/free-form/page/index.js +2 -2
  27. package/es/free-form/pages/index.js +2 -2
  28. package/es/free-form/section/index.js +3 -3
  29. package/es/free-form/step/index.js +2 -2
  30. package/es/free-form/steps/index.js +2 -2
  31. package/es/global-message/index.js +1 -1
  32. package/es/input/amount.js +2 -2
  33. package/es/input/credit-card.js +2 -2
  34. package/es/input/email.js +2 -2
  35. package/es/input/expiry-date.js +2 -2
  36. package/es/input/input-number.js +2 -2
  37. package/es/input/input.js +2 -2
  38. package/es/input/otp.js +2 -2
  39. package/es/input/password.js +2 -2
  40. package/es/input/text-area.js +2 -2
  41. package/es/layout/header.js +3 -3
  42. package/es/layout/index.js +2 -2
  43. package/es/locale/locale-provider.js +2 -2
  44. package/es/media/preview.js +2 -2
  45. package/es/mobile-insurer-detail/index.js +2 -2
  46. package/es/mobile-insurer-list/index.js +2 -2
  47. package/es/modal/index.js +2 -2
  48. package/es/policy-list/index.js +2 -2
  49. package/es/policy-list/policy-card.js +2 -2
  50. package/es/radio/index.js +2 -2
  51. package/es/select/attached-select.js +2 -2
  52. package/es/select/select.js +2 -2
  53. package/es/status-box/index.js +2 -2
  54. package/es/table/index.js +3 -3
  55. package/es/tabs/index.js +2 -2
  56. package/es/upload/index.js +3 -3
  57. package/es/upload-photo/index.js +187 -101
  58. package/es/utils/form-utils.js +2 -2
  59. package/lib/admin-upload/index.js +2 -2
  60. package/lib/admin-upload/job-list.js +2 -2
  61. package/lib/alert-message/index.js +2 -2
  62. package/lib/amount/index.js +2 -2
  63. package/lib/back-top/index.js +2 -2
  64. package/lib/button/index.js +2 -2
  65. package/lib/card-detail/card-item.js +1 -1
  66. package/lib/card-detail/card.js +2 -2
  67. package/lib/card-detail/utils.js +3 -3
  68. package/lib/checkbox/index.js +2 -2
  69. package/lib/claim-list/index.js +2 -2
  70. package/lib/date-picker/buddhist.js +2 -2
  71. package/lib/date-picker/index.js +2 -2
  72. package/lib/declaration/index.js +2 -2
  73. package/lib/detail-panel/index.js +2 -2
  74. package/lib/example/index.js +3 -3
  75. package/lib/filter/index.js +3 -3
  76. package/lib/form/addable-section/index.js +2 -2
  77. package/lib/form/divider/index.js +2 -2
  78. package/lib/form/element/index.js +3 -3
  79. package/lib/form/elements.js +1 -1
  80. package/lib/form/index.js +2 -2
  81. package/lib/form/section/index.js +2 -2
  82. package/lib/free-form/addable-section/index.js +3 -3
  83. package/lib/free-form/element/index.js +3 -3
  84. package/lib/free-form/index.js +2 -2
  85. package/lib/free-form/page/index.js +2 -2
  86. package/lib/free-form/pages/index.js +2 -2
  87. package/lib/free-form/section/index.js +3 -3
  88. package/lib/free-form/step/index.js +2 -2
  89. package/lib/free-form/steps/index.js +3 -3
  90. package/lib/global-message/index.js +1 -1
  91. package/lib/index.js +1 -1
  92. package/lib/input/amount.js +2 -2
  93. package/lib/input/credit-card.js +2 -2
  94. package/lib/input/email.js +2 -2
  95. package/lib/input/expiry-date.js +2 -2
  96. package/lib/input/input-number.js +2 -2
  97. package/lib/input/input.js +2 -2
  98. package/lib/input/otp.js +2 -2
  99. package/lib/input/password.js +2 -2
  100. package/lib/input/text-area.js +2 -2
  101. package/lib/layout/header.js +3 -3
  102. package/lib/layout/index.js +2 -2
  103. package/lib/locale/locale-provider.js +2 -2
  104. package/lib/media/preview.js +2 -2
  105. package/lib/mobile-insurer-detail/index.js +2 -2
  106. package/lib/mobile-insurer-list/index.js +2 -2
  107. package/lib/modal/index.js +2 -2
  108. package/lib/policy-list/index.js +2 -2
  109. package/lib/policy-list/policy-card.js +2 -2
  110. package/lib/radio/index.js +2 -2
  111. package/lib/select/attached-select.js +2 -2
  112. package/lib/select/select.js +2 -2
  113. package/lib/status-box/index.js +2 -2
  114. package/lib/table/index.js +3 -3
  115. package/lib/tabs/index.js +2 -2
  116. package/lib/upload/index.js +3 -3
  117. package/lib/upload-photo/index.js +187 -101
  118. package/lib/utils/form-utils.js +2 -2
  119. package/package.json +1 -1
@@ -57,11 +57,11 @@ var _formContext = _interopRequireDefault(require("../form-context"));
57
57
 
58
58
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
59
59
 
60
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
60
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
61
61
 
62
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
62
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
63
63
 
64
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
64
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
65
65
 
66
66
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
67
67
 
@@ -94,6 +94,52 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
94
94
  var useBreakpoint = _grid.default.useBreakpoint;
95
95
  var prefix = 'igloo-upload-photo';
96
96
 
97
+ function ClassifyType(type) {
98
+ if (type.includes('image')) {
99
+ return 'image';
100
+ }
101
+
102
+ if (type.includes('video')) {
103
+ return 'video';
104
+ }
105
+
106
+ if (type.includes('pdf')) {
107
+ return 'pdf';
108
+ }
109
+
110
+ return 'unknown';
111
+ }
112
+
113
+ var getFileType = /*#__PURE__*/function () {
114
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(src) {
115
+ var r, contentType;
116
+ return regeneratorRuntime.wrap(function _callee$(_context) {
117
+ while (1) {
118
+ switch (_context.prev = _context.next) {
119
+ case 0:
120
+ _context.next = 2;
121
+ return fetch(src, {
122
+ cache: 'force-cache'
123
+ });
124
+
125
+ case 2:
126
+ r = _context.sent;
127
+ contentType = r.headers.get('content-type');
128
+ return _context.abrupt("return", ClassifyType(contentType));
129
+
130
+ case 5:
131
+ case "end":
132
+ return _context.stop();
133
+ }
134
+ }
135
+ }, _callee);
136
+ }));
137
+
138
+ return function getFileType(_x) {
139
+ return _ref.apply(this, arguments);
140
+ };
141
+ }();
142
+
97
143
  var UploadPhoto = function UploadPhoto(props) {
98
144
  var _classnames3, _classnames4;
99
145
 
@@ -117,40 +163,40 @@ var UploadPhoto = function UploadPhoto(props) {
117
163
  bizKey = props.bizKey,
118
164
  _props$handleUpload = props.handleUpload,
119
165
  handleUpload = _props$handleUpload === void 0 ? /*#__PURE__*/function () {
120
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(file) {
166
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(file) {
121
167
  var formData, response, rst;
122
- return regeneratorRuntime.wrap(function _callee$(_context) {
168
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
123
169
  while (1) {
124
- switch (_context.prev = _context.next) {
170
+ switch (_context2.prev = _context2.next) {
125
171
  case 0:
126
172
  formData = new FormData();
127
173
  formData.append('file', file);
128
174
  formData.append('biz_key', bizKey);
129
- _context.next = 5;
175
+ _context2.next = 5;
130
176
  return fetch(uploadApi, {
131
177
  method: 'post',
132
178
  body: formData
133
179
  });
134
180
 
135
181
  case 5:
136
- response = _context.sent;
137
- _context.next = 8;
182
+ response = _context2.sent;
183
+ _context2.next = 8;
138
184
  return response.json();
139
185
 
140
186
  case 8:
141
- rst = _context.sent;
142
- return _context.abrupt("return", rst.url);
187
+ rst = _context2.sent;
188
+ return _context2.abrupt("return", rst.url);
143
189
 
144
190
  case 10:
145
191
  case "end":
146
- return _context.stop();
192
+ return _context2.stop();
147
193
  }
148
194
  }
149
- }, _callee);
195
+ }, _callee2);
150
196
  }));
151
197
 
152
- return function (_x) {
153
- return _ref.apply(this, arguments);
198
+ return function (_x2) {
199
+ return _ref2.apply(this, arguments);
154
200
  };
155
201
  }() : _props$handleUpload,
156
202
  setFieldError = props.setFieldError,
@@ -158,7 +204,7 @@ var UploadPhoto = function UploadPhoto(props) {
158
204
  id = props.id,
159
205
  validateField = props.validateField,
160
206
  _props$capture = props.capture,
161
- capture = _props$capture === void 0 ? true : _props$capture;
207
+ capture = _props$capture === void 0 ? false : _props$capture;
162
208
 
163
209
  var _useContext2 = (0, _react.useContext)(_locale.LocaleContext),
164
210
  formatMessage = _useContext2.formatMessage;
@@ -167,17 +213,7 @@ var UploadPhoto = function UploadPhoto(props) {
167
213
  _useState2 = _slicedToArray(_useState, 1),
168
214
  isMobile = _useState2[0];
169
215
 
170
- var _useState3 = (0, _react.useState)(value.map(function (url, index) {
171
- return {
172
- url: url,
173
- dataUrl: url,
174
- status: 'success',
175
- type: '',
176
- name: "File".concat(index + 1),
177
- size: 0,
178
- uid: index
179
- };
180
- })),
216
+ var _useState3 = (0, _react.useState)([]),
181
217
  _useState4 = _slicedToArray(_useState3, 2),
182
218
  files = _useState4[0],
183
219
  setFiles = _useState4[1];
@@ -190,14 +226,64 @@ var UploadPhoto = function UploadPhoto(props) {
190
226
  var _useBreakpoint = useBreakpoint(),
191
227
  md = _useBreakpoint.md;
192
228
 
229
+ var mapFilesFromValue = function mapFilesFromValue(urls) {
230
+ var _files = [];
231
+ Promise.all(urls.map( /*#__PURE__*/function () {
232
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(url, index) {
233
+ var type;
234
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
235
+ while (1) {
236
+ switch (_context3.prev = _context3.next) {
237
+ case 0:
238
+ _context3.next = 2;
239
+ return getFileType(url);
240
+
241
+ case 2:
242
+ type = _context3.sent;
243
+
244
+ _files.push({
245
+ url: url,
246
+ dataUrl: url,
247
+ status: 'success',
248
+ type: type,
249
+ name: "File".concat(index + 1),
250
+ size: 0,
251
+ uid: index
252
+ });
253
+
254
+ case 4:
255
+ case "end":
256
+ return _context3.stop();
257
+ }
258
+ }
259
+ }, _callee3);
260
+ }));
261
+
262
+ return function (_x3, _x4) {
263
+ return _ref3.apply(this, arguments);
264
+ };
265
+ }())).then(function () {
266
+ return setFiles(_files);
267
+ });
268
+ };
269
+
270
+ (0, _react.useEffect)(function () {
271
+ if (Array.isArray(value) && value.some(function (url) {
272
+ return typeof url === 'string' && !files.find(function (file) {
273
+ return file.url === url;
274
+ });
275
+ })) {
276
+ mapFilesFromValue(value);
277
+ }
278
+ }, [value, files]);
193
279
  var uploadId = (0, _react.useMemo)(function () {
194
280
  return "igloo-upload-photo-input-".concat(Math.random());
195
281
  }, []);
196
282
  var uploadIndex = (0, _react.useRef)((value === null || value === void 0 ? void 0 : value.length) ? value.length : 0);
197
283
  (0, _react.useEffect)(function () {
198
284
  return function () {
199
- files.forEach(function (_ref2) {
200
- var dataUrl = _ref2.dataUrl;
285
+ files.forEach(function (_ref4) {
286
+ var dataUrl = _ref4.dataUrl;
201
287
  URL.revokeObjectURL(dataUrl);
202
288
  });
203
289
  };
@@ -267,12 +353,12 @@ var UploadPhoto = function UploadPhoto(props) {
267
353
  };
268
354
 
269
355
  var uploadFile = /*#__PURE__*/function () {
270
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(file, currentIndex) {
356
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(file, currentIndex) {
271
357
  var uid, dataUrl, name, size, mimeType, type, errorMsg, _errorMsg;
272
358
 
273
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
359
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
274
360
  while (1) {
275
- switch (_context2.prev = _context2.next) {
361
+ switch (_context4.prev = _context4.next) {
276
362
  case 0:
277
363
  uid = ++uploadIndex.current;
278
364
  dataUrl = URL.createObjectURL(file);
@@ -280,7 +366,7 @@ var UploadPhoto = function UploadPhoto(props) {
280
366
  type = (0, _tools.classifyType)(mimeType);
281
367
 
282
368
  if (!(type === 'unknown')) {
283
- _context2.next = 9;
369
+ _context4.next = 9;
284
370
  break;
285
371
  }
286
372
 
@@ -289,11 +375,11 @@ var UploadPhoto = function UploadPhoto(props) {
289
375
  });
290
376
  limitNumError.current = errorMsg;
291
377
  setFieldError && setFieldError(errorMsg);
292
- return _context2.abrupt("return", Promise.reject(errorMsg));
378
+ return _context4.abrupt("return", Promise.reject(errorMsg));
293
379
 
294
380
  case 9:
295
381
  if (!(limit && currentIndex > limit)) {
296
- _context2.next = 14;
382
+ _context4.next = 14;
297
383
  break;
298
384
  }
299
385
 
@@ -305,7 +391,7 @@ var UploadPhoto = function UploadPhoto(props) {
305
391
  });
306
392
  limitNumError.current = _errorMsg;
307
393
  setFieldError && setFieldError(_errorMsg);
308
- return _context2.abrupt("return", Promise.reject(_errorMsg));
394
+ return _context4.abrupt("return", Promise.reject(_errorMsg));
309
395
 
310
396
  case 14:
311
397
  limitNumError.current = undefined;
@@ -320,7 +406,7 @@ var UploadPhoto = function UploadPhoto(props) {
320
406
  uid: uid
321
407
  }]);
322
408
  });
323
- return _context2.abrupt("return", handleUploadPromise(file, function (url) {
409
+ return _context4.abrupt("return", handleUploadPromise(file, function (url) {
324
410
  var urls = [];
325
411
  setFiles(function (files) {
326
412
  return files.map(function (f) {
@@ -383,63 +469,63 @@ var UploadPhoto = function UploadPhoto(props) {
383
469
 
384
470
  case 17:
385
471
  case "end":
386
- return _context2.stop();
472
+ return _context4.stop();
387
473
  }
388
474
  }
389
- }, _callee2);
475
+ }, _callee4);
390
476
  }));
391
477
 
392
- return function uploadFile(_x2, _x3) {
393
- return _ref3.apply(this, arguments);
478
+ return function uploadFile(_x5, _x6) {
479
+ return _ref5.apply(this, arguments);
394
480
  };
395
481
  }();
396
482
 
397
483
  var handleUploadPromise = /*#__PURE__*/function () {
398
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(file, onSuccess, onFailed) {
484
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(file, onSuccess, onFailed) {
399
485
  var rst, errorMsg;
400
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
486
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
401
487
  while (1) {
402
- switch (_context3.prev = _context3.next) {
488
+ switch (_context5.prev = _context5.next) {
403
489
  case 0:
404
- _context3.prev = 0;
405
- _context3.next = 3;
490
+ _context5.prev = 0;
491
+ _context5.next = 3;
406
492
  return handleUpload(file);
407
493
 
408
494
  case 3:
409
- rst = _context3.sent;
495
+ rst = _context5.sent;
410
496
  onSuccess(rst);
411
- return _context3.abrupt("return", Promise.resolve(rst));
497
+ return _context5.abrupt("return", Promise.resolve(rst));
412
498
 
413
499
  case 8:
414
- _context3.prev = 8;
415
- _context3.t0 = _context3["catch"](0);
416
- errorMsg = _typeof(_context3.t0) === 'object' ? _context3.t0.message : _context3.t0;
500
+ _context5.prev = 8;
501
+ _context5.t0 = _context5["catch"](0);
502
+ errorMsg = _typeof(_context5.t0) === 'object' ? _context5.t0.message : _context5.t0;
417
503
  onFailed(errorMsg);
418
- return _context3.abrupt("return", Promise.reject(errorMsg));
504
+ return _context5.abrupt("return", Promise.reject(errorMsg));
419
505
 
420
506
  case 13:
421
507
  case "end":
422
- return _context3.stop();
508
+ return _context5.stop();
423
509
  }
424
510
  }
425
- }, _callee3, null, [[0, 8]]);
511
+ }, _callee5, null, [[0, 8]]);
426
512
  }));
427
513
 
428
- return function handleUploadPromise(_x4, _x5, _x6) {
429
- return _ref4.apply(this, arguments);
514
+ return function handleUploadPromise(_x7, _x8, _x9) {
515
+ return _ref6.apply(this, arguments);
430
516
  };
431
517
  }();
432
518
 
433
519
  var handleDelete = /*#__PURE__*/function () {
434
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(index) {
520
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(index) {
435
521
  var arr, hasError, rst;
436
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
522
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
437
523
  while (1) {
438
- switch (_context4.prev = _context4.next) {
524
+ switch (_context6.prev = _context6.next) {
439
525
  case 0:
440
526
  limitNumError.current = null;
441
527
  arr = files;
442
- _context4.next = 4;
528
+ _context6.next = 4;
443
529
  return setFiles(function (files) {
444
530
  var newArr = files.filter(function (_, i) {
445
531
  return i !== index;
@@ -449,7 +535,7 @@ var UploadPhoto = function UploadPhoto(props) {
449
535
  });
450
536
 
451
537
  case 4:
452
- _context4.next = 6;
538
+ _context6.next = 6;
453
539
  return setMasks(function (masks) {
454
540
  return masks.filter(function (_, i) {
455
541
  return i !== index;
@@ -463,7 +549,7 @@ var UploadPhoto = function UploadPhoto(props) {
463
549
  });
464
550
 
465
551
  if (!hasError) {
466
- _context4.next = 10;
552
+ _context6.next = 10;
467
553
  break;
468
554
  }
469
555
 
@@ -476,46 +562,46 @@ var UploadPhoto = function UploadPhoto(props) {
476
562
 
477
563
  return f.url;
478
564
  });
479
- return _context4.abrupt("return", typeof onChange === 'function' && onChange(rst));
565
+ return _context6.abrupt("return", typeof onChange === 'function' && onChange(rst));
480
566
 
481
567
  case 10:
482
- typeof onChange === 'function' && onChange(arr.map(function (_ref6) {
483
- var url = _ref6.url;
568
+ typeof onChange === 'function' && onChange(arr.map(function (_ref8) {
569
+ var url = _ref8.url;
484
570
  return url;
485
571
  }));
486
572
 
487
573
  case 11:
488
574
  case "end":
489
- return _context4.stop();
575
+ return _context6.stop();
490
576
  }
491
577
  }
492
- }, _callee4);
578
+ }, _callee6);
493
579
  }));
494
580
 
495
- return function handleDelete(_x7) {
496
- return _ref5.apply(this, arguments);
581
+ return function handleDelete(_x10) {
582
+ return _ref7.apply(this, arguments);
497
583
  };
498
584
  }();
499
585
 
500
586
  var handleReUpload = /*#__PURE__*/function () {
501
- var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(index) {
587
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(index) {
502
588
  var _files$index, originFile, reUpUid, rst, latestFiles, fileListWithError, newList, _rst;
503
589
 
504
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
590
+ return regeneratorRuntime.wrap(function _callee7$(_context7) {
505
591
  while (1) {
506
- switch (_context5.prev = _context5.next) {
592
+ switch (_context7.prev = _context7.next) {
507
593
  case 0:
508
594
  _files$index = files[index], originFile = _files$index.originFile, reUpUid = _files$index.uid;
509
595
 
510
596
  if (originFile) {
511
- _context5.next = 3;
597
+ _context7.next = 3;
512
598
  break;
513
599
  }
514
600
 
515
- return _context5.abrupt("return");
601
+ return _context7.abrupt("return");
516
602
 
517
603
  case 3:
518
- _context5.next = 5;
604
+ _context7.next = 5;
519
605
  return setFiles(function (files) {
520
606
  var newFiles = _toConsumableArray(files);
521
607
 
@@ -524,14 +610,14 @@ var UploadPhoto = function UploadPhoto(props) {
524
610
  });
525
611
 
526
612
  case 5:
527
- _context5.prev = 5;
528
- _context5.next = 8;
613
+ _context7.prev = 5;
614
+ _context7.next = 8;
529
615
  return handleUpload(originFile);
530
616
 
531
617
  case 8:
532
- rst = _context5.sent;
618
+ rst = _context7.sent;
533
619
  latestFiles = [];
534
- _context5.next = 12;
620
+ _context7.next = 12;
535
621
  return setFiles(function (files) {
536
622
  var newFiles = _toConsumableArray(files);
537
623
 
@@ -559,19 +645,19 @@ var UploadPhoto = function UploadPhoto(props) {
559
645
  return url;
560
646
  });
561
647
  onChange && onChange(fileListWithError);
562
- _context5.next = 23;
648
+ _context7.next = 23;
563
649
  break;
564
650
 
565
651
  case 16:
566
- _context5.prev = 16;
567
- _context5.t0 = _context5["catch"](5);
652
+ _context7.prev = 16;
653
+ _context7.t0 = _context7["catch"](5);
568
654
  newList = [];
569
- _context5.next = 21;
655
+ _context7.next = 21;
570
656
  return setFiles(function (files) {
571
657
  var newFiles = _toConsumableArray(files);
572
658
 
573
659
  newFiles[index].status = 'failed';
574
- newFiles[index].errorMsg = _context5.t0;
660
+ newFiles[index].errorMsg = _context7.t0;
575
661
  newList = newFiles;
576
662
  return newFiles;
577
663
  });
@@ -602,14 +688,14 @@ var UploadPhoto = function UploadPhoto(props) {
602
688
 
603
689
  case 24:
604
690
  case "end":
605
- return _context5.stop();
691
+ return _context7.stop();
606
692
  }
607
693
  }
608
- }, _callee5, null, [[5, 16]]);
694
+ }, _callee7, null, [[5, 16]]);
609
695
  }));
610
696
 
611
- return function handleReUpload(_x8) {
612
- return _ref7.apply(this, arguments);
697
+ return function handleReUpload(_x11) {
698
+ return _ref9.apply(this, arguments);
613
699
  };
614
700
  }();
615
701
 
@@ -703,12 +789,12 @@ var UploadPhoto = function UploadPhoto(props) {
703
789
  children: (0, _jsxRuntime.jsxs)(_row.default, {
704
790
  gutter: [isMobile ? 16 : 32, 16],
705
791
  wrap: true,
706
- children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (_ref8, index) {
792
+ children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (_ref10, index) {
707
793
  var _classnames, _classnames2;
708
794
 
709
- var src = _ref8.src,
710
- label = _ref8.label,
711
- type = _ref8.type;
795
+ var src = _ref10.src,
796
+ label = _ref10.label,
797
+ type = _ref10.type;
712
798
  return (0, _jsxRuntime.jsxs)(_col.default, {
713
799
  span: sampleSpan,
714
800
  children: [(0, _jsxRuntime.jsx)("img", {
@@ -768,13 +854,13 @@ var UploadPhoto = function UploadPhoto(props) {
768
854
  children: buttonText || 'Upload'
769
855
  }, void 0)
770
856
  }, void 0)]
771
- }, void 0), files.map(function (_ref9, index) {
857
+ }, void 0), files.map(function (_ref11, index) {
772
858
  var _classnames5;
773
859
 
774
- var dataUrl = _ref9.dataUrl,
775
- status = _ref9.status,
776
- type = _ref9.type,
777
- uid = _ref9.uid;
860
+ var dataUrl = _ref11.dataUrl,
861
+ status = _ref11.status,
862
+ type = _ref11.type,
863
+ uid = _ref11.uid;
778
864
  return (0, _jsxRuntime.jsx)(_badge.default, {
779
865
  count: getBadge(status, index, limit),
780
866
  children: (0, _jsxRuntime.jsxs)("div", {
@@ -842,10 +928,10 @@ function checkFileList(value) {
842
928
  return Promise.resolve();
843
929
  }
844
930
 
845
- UploadPhoto.formItemPropsHandler = function (_ref10) {
846
- var limit = _ref10.limit,
847
- previewFormater = _ref10.previewFormater,
848
- label = _ref10.label;
931
+ UploadPhoto.formItemPropsHandler = function (_ref12) {
932
+ var limit = _ref12.limit,
933
+ previewFormater = _ref12.previewFormater,
934
+ label = _ref12.label;
849
935
  return {
850
936
  previewFormater: previewFormater || function (value) {
851
937
  return (0, _jsxRuntime.jsx)(_uploadPreview.default, {
@@ -20,9 +20,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
 
21
21
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
22
22
 
23
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
24
24
 
25
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
26
 
27
27
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
28
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "2.4.19",
3
+ "version": "2.4.20",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",