iglooform 2.4.18 → 2.4.22

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.
@@ -307,7 +307,9 @@ var Element = function Element(_ref) {
307
307
  className: "igloo-element-preview-value",
308
308
  children: [error && !!error.length && _jsx(AlertFilled, {
309
309
  className: "igloo-element-preview-value-icon"
310
- }, void 0), previewFormater ? previewFormater(value, form) : value || '-']
310
+ }, void 0), _jsx("div", {
311
+ children: previewFormater ? previewFormater(value, form) : _typeof(value) === 'object' ? JSON.stringify(value) : value
312
+ }, void 0)]
311
313
  }, void 0)]
312
314
  }, void 0)
313
315
  }), void 0)
@@ -262,7 +262,9 @@ var Element = function Element(props) {
262
262
  className: "igloo-freeform-element-preview-value",
263
263
  children: [error && !!error.length && _jsx(AlertFilled, {
264
264
  className: "igloo-freeform-element-preview-value-icon"
265
- }, void 0), previewFormater ? previewFormater(value, form) : value || '-']
265
+ }, void 0), _jsx("div", {
266
+ children: previewFormater ? previewFormater(value, form) : _typeof(value) === 'object' ? JSON.stringify(value) : value
267
+ }, void 0)]
266
268
  }, void 0)]
267
269
  }, void 0)
268
270
  }), void 0)
@@ -214,7 +214,8 @@ function checkCard(value, cardRules) {
214
214
  }
215
215
 
216
216
  IglooCredit.formItemPropsHandler = function (config) {
217
- var cardConfig = config.cardConfig;
217
+ var _config$cardConfig = config.cardConfig,
218
+ cardConfig = _config$cardConfig === void 0 ? [] : _config$cardConfig;
218
219
  return {
219
220
  rules: [{
220
221
  validator: function validator(_, value) {
@@ -280,7 +280,12 @@ IglooExpiryDate.formItemPropsHandler = function (config) {
280
280
  validator: function validator(_, value) {
281
281
  return checkTime(value, check);
282
282
  }
283
- }]
283
+ }],
284
+ previewFormater: function previewFormater(_ref2) {
285
+ var year = _ref2.year,
286
+ month = _ref2.month;
287
+ return "".concat(month, "/").concat(year);
288
+ }
284
289
  };
285
290
  };
286
291
 
@@ -70,7 +70,7 @@
70
70
  "{canInputNum} characters left": "{canInputNum}剩餘字符",
71
71
  "{canInputNum} characters over": "{canInputNum}超出字符",
72
72
  "{count} files attached.": "{count}附加文件。",
73
- "{currentStep} of {allSteps}": "{allSteps}{currentStep}",
73
+ "{currentStep} of {allSteps}": "{currentStep} / {allSteps}",
74
74
  "{doneNumber} files imported.": "{doneNumber}導入的文件。",
75
75
  "{processingNumber} files in progress...": "{processingNumber}正在進行的文件。。。"
76
76
  }
@@ -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,40 +130,40 @@ 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 _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(file) {
133
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(file) {
88
134
  var formData, response, rst;
89
- return regeneratorRuntime.wrap(function _callee$(_context) {
135
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
90
136
  while (1) {
91
- switch (_context.prev = _context.next) {
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
- _context.next = 5;
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 = _context.sent;
104
- _context.next = 8;
149
+ response = _context2.sent;
150
+ _context2.next = 8;
105
151
  return response.json();
106
152
 
107
153
  case 8:
108
- rst = _context.sent;
109
- return _context.abrupt("return", rst.url);
154
+ rst = _context2.sent;
155
+ return _context2.abrupt("return", rst.url);
110
156
 
111
157
  case 10:
112
158
  case "end":
113
- return _context.stop();
159
+ return _context2.stop();
114
160
  }
115
161
  }
116
- }, _callee);
162
+ }, _callee2);
117
163
  }));
118
164
 
119
- return function (_x) {
120
- return _ref.apply(this, arguments);
165
+ return function (_x2) {
166
+ return _ref2.apply(this, arguments);
121
167
  };
122
168
  }() : _props$handleUpload,
123
169
  setFieldError = props.setFieldError,
@@ -125,7 +171,7 @@ var UploadPhoto = function UploadPhoto(props) {
125
171
  id = props.id,
126
172
  validateField = props.validateField,
127
173
  _props$capture = props.capture,
128
- capture = _props$capture === void 0 ? true : _props$capture;
174
+ capture = _props$capture === void 0 ? false : _props$capture;
129
175
 
130
176
  var _useContext2 = useContext(LocaleContext),
131
177
  formatMessage = _useContext2.formatMessage;
@@ -134,17 +180,7 @@ var UploadPhoto = function UploadPhoto(props) {
134
180
  _useState2 = _slicedToArray(_useState, 1),
135
181
  isMobile = _useState2[0];
136
182
 
137
- var _useState3 = useState(value.map(function (url, index) {
138
- return {
139
- url: url,
140
- dataUrl: url,
141
- status: 'success',
142
- type: '',
143
- name: "File".concat(index + 1),
144
- size: 0,
145
- uid: index
146
- };
147
- })),
183
+ var _useState3 = useState([]),
148
184
  _useState4 = _slicedToArray(_useState3, 2),
149
185
  files = _useState4[0],
150
186
  setFiles = _useState4[1];
@@ -157,14 +193,64 @@ var UploadPhoto = function UploadPhoto(props) {
157
193
  var _useBreakpoint = useBreakpoint(),
158
194
  md = _useBreakpoint.md;
159
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]);
160
246
  var uploadId = useMemo(function () {
161
247
  return "igloo-upload-photo-input-".concat(Math.random());
162
248
  }, []);
163
249
  var uploadIndex = useRef((value === null || value === void 0 ? void 0 : value.length) ? value.length : 0);
164
250
  useEffect(function () {
165
251
  return function () {
166
- files.forEach(function (_ref2) {
167
- var dataUrl = _ref2.dataUrl;
252
+ files.forEach(function (_ref4) {
253
+ var dataUrl = _ref4.dataUrl;
168
254
  URL.revokeObjectURL(dataUrl);
169
255
  });
170
256
  };
@@ -234,12 +320,12 @@ var UploadPhoto = function UploadPhoto(props) {
234
320
  };
235
321
 
236
322
  var uploadFile = /*#__PURE__*/function () {
237
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(file, currentIndex) {
323
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(file, currentIndex) {
238
324
  var uid, dataUrl, name, size, mimeType, type, errorMsg, _errorMsg;
239
325
 
240
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
326
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
241
327
  while (1) {
242
- switch (_context2.prev = _context2.next) {
328
+ switch (_context4.prev = _context4.next) {
243
329
  case 0:
244
330
  uid = ++uploadIndex.current;
245
331
  dataUrl = URL.createObjectURL(file);
@@ -247,7 +333,7 @@ var UploadPhoto = function UploadPhoto(props) {
247
333
  type = classifyType(mimeType);
248
334
 
249
335
  if (!(type === 'unknown')) {
250
- _context2.next = 9;
336
+ _context4.next = 9;
251
337
  break;
252
338
  }
253
339
 
@@ -256,11 +342,11 @@ var UploadPhoto = function UploadPhoto(props) {
256
342
  });
257
343
  limitNumError.current = errorMsg;
258
344
  setFieldError && setFieldError(errorMsg);
259
- return _context2.abrupt("return", Promise.reject(errorMsg));
345
+ return _context4.abrupt("return", Promise.reject(errorMsg));
260
346
 
261
347
  case 9:
262
348
  if (!(limit && currentIndex > limit)) {
263
- _context2.next = 14;
349
+ _context4.next = 14;
264
350
  break;
265
351
  }
266
352
 
@@ -272,7 +358,7 @@ var UploadPhoto = function UploadPhoto(props) {
272
358
  });
273
359
  limitNumError.current = _errorMsg;
274
360
  setFieldError && setFieldError(_errorMsg);
275
- return _context2.abrupt("return", Promise.reject(_errorMsg));
361
+ return _context4.abrupt("return", Promise.reject(_errorMsg));
276
362
 
277
363
  case 14:
278
364
  limitNumError.current = undefined;
@@ -287,7 +373,7 @@ var UploadPhoto = function UploadPhoto(props) {
287
373
  uid: uid
288
374
  }]);
289
375
  });
290
- return _context2.abrupt("return", handleUploadPromise(file, function (url) {
376
+ return _context4.abrupt("return", handleUploadPromise(file, function (url) {
291
377
  var urls = [];
292
378
  setFiles(function (files) {
293
379
  return files.map(function (f) {
@@ -350,63 +436,63 @@ var UploadPhoto = function UploadPhoto(props) {
350
436
 
351
437
  case 17:
352
438
  case "end":
353
- return _context2.stop();
439
+ return _context4.stop();
354
440
  }
355
441
  }
356
- }, _callee2);
442
+ }, _callee4);
357
443
  }));
358
444
 
359
- return function uploadFile(_x2, _x3) {
360
- return _ref3.apply(this, arguments);
445
+ return function uploadFile(_x5, _x6) {
446
+ return _ref5.apply(this, arguments);
361
447
  };
362
448
  }();
363
449
 
364
450
  var handleUploadPromise = /*#__PURE__*/function () {
365
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(file, onSuccess, onFailed) {
451
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(file, onSuccess, onFailed) {
366
452
  var rst, errorMsg;
367
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
453
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
368
454
  while (1) {
369
- switch (_context3.prev = _context3.next) {
455
+ switch (_context5.prev = _context5.next) {
370
456
  case 0:
371
- _context3.prev = 0;
372
- _context3.next = 3;
457
+ _context5.prev = 0;
458
+ _context5.next = 3;
373
459
  return handleUpload(file);
374
460
 
375
461
  case 3:
376
- rst = _context3.sent;
462
+ rst = _context5.sent;
377
463
  onSuccess(rst);
378
- return _context3.abrupt("return", Promise.resolve(rst));
464
+ return _context5.abrupt("return", Promise.resolve(rst));
379
465
 
380
466
  case 8:
381
- _context3.prev = 8;
382
- _context3.t0 = _context3["catch"](0);
383
- errorMsg = _typeof(_context3.t0) === 'object' ? _context3.t0.message : _context3.t0;
467
+ _context5.prev = 8;
468
+ _context5.t0 = _context5["catch"](0);
469
+ errorMsg = _typeof(_context5.t0) === 'object' ? _context5.t0.message : _context5.t0;
384
470
  onFailed(errorMsg);
385
- return _context3.abrupt("return", Promise.reject(errorMsg));
471
+ return _context5.abrupt("return", Promise.reject(errorMsg));
386
472
 
387
473
  case 13:
388
474
  case "end":
389
- return _context3.stop();
475
+ return _context5.stop();
390
476
  }
391
477
  }
392
- }, _callee3, null, [[0, 8]]);
478
+ }, _callee5, null, [[0, 8]]);
393
479
  }));
394
480
 
395
- return function handleUploadPromise(_x4, _x5, _x6) {
396
- return _ref4.apply(this, arguments);
481
+ return function handleUploadPromise(_x7, _x8, _x9) {
482
+ return _ref6.apply(this, arguments);
397
483
  };
398
484
  }();
399
485
 
400
486
  var handleDelete = /*#__PURE__*/function () {
401
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(index) {
487
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(index) {
402
488
  var arr, hasError, rst;
403
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
489
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
404
490
  while (1) {
405
- switch (_context4.prev = _context4.next) {
491
+ switch (_context6.prev = _context6.next) {
406
492
  case 0:
407
493
  limitNumError.current = null;
408
494
  arr = files;
409
- _context4.next = 4;
495
+ _context6.next = 4;
410
496
  return setFiles(function (files) {
411
497
  var newArr = files.filter(function (_, i) {
412
498
  return i !== index;
@@ -416,7 +502,7 @@ var UploadPhoto = function UploadPhoto(props) {
416
502
  });
417
503
 
418
504
  case 4:
419
- _context4.next = 6;
505
+ _context6.next = 6;
420
506
  return setMasks(function (masks) {
421
507
  return masks.filter(function (_, i) {
422
508
  return i !== index;
@@ -430,7 +516,7 @@ var UploadPhoto = function UploadPhoto(props) {
430
516
  });
431
517
 
432
518
  if (!hasError) {
433
- _context4.next = 10;
519
+ _context6.next = 10;
434
520
  break;
435
521
  }
436
522
 
@@ -443,46 +529,46 @@ var UploadPhoto = function UploadPhoto(props) {
443
529
 
444
530
  return f.url;
445
531
  });
446
- return _context4.abrupt("return", typeof onChange === 'function' && onChange(rst));
532
+ return _context6.abrupt("return", typeof onChange === 'function' && onChange(rst));
447
533
 
448
534
  case 10:
449
- typeof onChange === 'function' && onChange(arr.map(function (_ref6) {
450
- var url = _ref6.url;
535
+ typeof onChange === 'function' && onChange(arr.map(function (_ref8) {
536
+ var url = _ref8.url;
451
537
  return url;
452
538
  }));
453
539
 
454
540
  case 11:
455
541
  case "end":
456
- return _context4.stop();
542
+ return _context6.stop();
457
543
  }
458
544
  }
459
- }, _callee4);
545
+ }, _callee6);
460
546
  }));
461
547
 
462
- return function handleDelete(_x7) {
463
- return _ref5.apply(this, arguments);
548
+ return function handleDelete(_x10) {
549
+ return _ref7.apply(this, arguments);
464
550
  };
465
551
  }();
466
552
 
467
553
  var handleReUpload = /*#__PURE__*/function () {
468
- var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(index) {
554
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(index) {
469
555
  var _files$index, originFile, reUpUid, rst, latestFiles, fileListWithError, newList, _rst;
470
556
 
471
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
557
+ return regeneratorRuntime.wrap(function _callee7$(_context7) {
472
558
  while (1) {
473
- switch (_context5.prev = _context5.next) {
559
+ switch (_context7.prev = _context7.next) {
474
560
  case 0:
475
561
  _files$index = files[index], originFile = _files$index.originFile, reUpUid = _files$index.uid;
476
562
 
477
563
  if (originFile) {
478
- _context5.next = 3;
564
+ _context7.next = 3;
479
565
  break;
480
566
  }
481
567
 
482
- return _context5.abrupt("return");
568
+ return _context7.abrupt("return");
483
569
 
484
570
  case 3:
485
- _context5.next = 5;
571
+ _context7.next = 5;
486
572
  return setFiles(function (files) {
487
573
  var newFiles = _toConsumableArray(files);
488
574
 
@@ -491,14 +577,14 @@ var UploadPhoto = function UploadPhoto(props) {
491
577
  });
492
578
 
493
579
  case 5:
494
- _context5.prev = 5;
495
- _context5.next = 8;
580
+ _context7.prev = 5;
581
+ _context7.next = 8;
496
582
  return handleUpload(originFile);
497
583
 
498
584
  case 8:
499
- rst = _context5.sent;
585
+ rst = _context7.sent;
500
586
  latestFiles = [];
501
- _context5.next = 12;
587
+ _context7.next = 12;
502
588
  return setFiles(function (files) {
503
589
  var newFiles = _toConsumableArray(files);
504
590
 
@@ -526,19 +612,19 @@ var UploadPhoto = function UploadPhoto(props) {
526
612
  return url;
527
613
  });
528
614
  onChange && onChange(fileListWithError);
529
- _context5.next = 23;
615
+ _context7.next = 23;
530
616
  break;
531
617
 
532
618
  case 16:
533
- _context5.prev = 16;
534
- _context5.t0 = _context5["catch"](5);
619
+ _context7.prev = 16;
620
+ _context7.t0 = _context7["catch"](5);
535
621
  newList = [];
536
- _context5.next = 21;
622
+ _context7.next = 21;
537
623
  return setFiles(function (files) {
538
624
  var newFiles = _toConsumableArray(files);
539
625
 
540
626
  newFiles[index].status = 'failed';
541
- newFiles[index].errorMsg = _context5.t0;
627
+ newFiles[index].errorMsg = _context7.t0;
542
628
  newList = newFiles;
543
629
  return newFiles;
544
630
  });
@@ -569,14 +655,14 @@ var UploadPhoto = function UploadPhoto(props) {
569
655
 
570
656
  case 24:
571
657
  case "end":
572
- return _context5.stop();
658
+ return _context7.stop();
573
659
  }
574
660
  }
575
- }, _callee5, null, [[5, 16]]);
661
+ }, _callee7, null, [[5, 16]]);
576
662
  }));
577
663
 
578
- return function handleReUpload(_x8) {
579
- return _ref7.apply(this, arguments);
664
+ return function handleReUpload(_x11) {
665
+ return _ref9.apply(this, arguments);
580
666
  };
581
667
  }();
582
668
 
@@ -669,12 +755,12 @@ var UploadPhoto = function UploadPhoto(props) {
669
755
  children: _jsxs(_Row, {
670
756
  gutter: [isMobile ? 16 : 32, 16],
671
757
  wrap: true,
672
- children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (_ref8, index) {
758
+ children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (_ref10, index) {
673
759
  var _classnames, _classnames2;
674
760
 
675
- var src = _ref8.src,
676
- label = _ref8.label,
677
- type = _ref8.type;
761
+ var src = _ref10.src,
762
+ label = _ref10.label,
763
+ type = _ref10.type;
678
764
  return _jsxs(_Col, {
679
765
  span: sampleSpan,
680
766
  children: [_jsx("img", {
@@ -734,13 +820,13 @@ var UploadPhoto = function UploadPhoto(props) {
734
820
  children: buttonText || 'Upload'
735
821
  }, void 0)
736
822
  }, void 0)]
737
- }, void 0), files.map(function (_ref9, index) {
823
+ }, void 0), files.map(function (_ref11, index) {
738
824
  var _classnames5;
739
825
 
740
- var dataUrl = _ref9.dataUrl,
741
- status = _ref9.status,
742
- type = _ref9.type,
743
- uid = _ref9.uid;
826
+ var dataUrl = _ref11.dataUrl,
827
+ status = _ref11.status,
828
+ type = _ref11.type,
829
+ uid = _ref11.uid;
744
830
  return _jsx(_Badge, {
745
831
  count: getBadge(status, index, limit),
746
832
  children: _jsxs("div", {
@@ -808,10 +894,10 @@ function checkFileList(value) {
808
894
  return Promise.resolve();
809
895
  }
810
896
 
811
- UploadPhoto.formItemPropsHandler = function (_ref10) {
812
- var limit = _ref10.limit,
813
- previewFormater = _ref10.previewFormater,
814
- label = _ref10.label;
897
+ UploadPhoto.formItemPropsHandler = function (_ref12) {
898
+ var limit = _ref12.limit,
899
+ previewFormater = _ref12.previewFormater,
900
+ label = _ref12.label;
815
901
  return {
816
902
  previewFormater: previewFormater || function (value) {
817
903
  return _jsx(UploadPreview, {
@@ -336,7 +336,9 @@ var Element = function Element(_ref) {
336
336
  className: "igloo-element-preview-value",
337
337
  children: [error && !!error.length && (0, _jsxRuntime.jsx)(_iglooicon.AlertFilled, {
338
338
  className: "igloo-element-preview-value-icon"
339
- }, void 0), previewFormater ? previewFormater(value, form) : value || '-']
339
+ }, void 0), (0, _jsxRuntime.jsx)("div", {
340
+ children: previewFormater ? previewFormater(value, form) : _typeof(value) === 'object' ? JSON.stringify(value) : value
341
+ }, void 0)]
340
342
  }, void 0)]
341
343
  }, void 0)
342
344
  }), void 0)
@@ -288,7 +288,9 @@ var Element = function Element(props) {
288
288
  className: "igloo-freeform-element-preview-value",
289
289
  children: [error && !!error.length && (0, _jsxRuntime.jsx)(_iglooicon.AlertFilled, {
290
290
  className: "igloo-freeform-element-preview-value-icon"
291
- }, void 0), previewFormater ? previewFormater(value, form) : value || '-']
291
+ }, void 0), (0, _jsxRuntime.jsx)("div", {
292
+ children: previewFormater ? previewFormater(value, form) : _typeof(value) === 'object' ? JSON.stringify(value) : value
293
+ }, void 0)]
292
294
  }, void 0)]
293
295
  }, void 0)
294
296
  }), void 0)
@@ -229,7 +229,8 @@ function checkCard(value, cardRules) {
229
229
  }
230
230
 
231
231
  IglooCredit.formItemPropsHandler = function (config) {
232
- var cardConfig = config.cardConfig;
232
+ var _config$cardConfig = config.cardConfig,
233
+ cardConfig = _config$cardConfig === void 0 ? [] : _config$cardConfig;
233
234
  return {
234
235
  rules: [{
235
236
  validator: function validator(_, value) {
@@ -296,7 +296,12 @@ IglooExpiryDate.formItemPropsHandler = function (config) {
296
296
  validator: function validator(_, value) {
297
297
  return checkTime(value, check);
298
298
  }
299
- }]
299
+ }],
300
+ previewFormater: function previewFormater(_ref2) {
301
+ var year = _ref2.year,
302
+ month = _ref2.month;
303
+ return "".concat(month, "/").concat(year);
304
+ }
300
305
  };
301
306
  };
302
307
 
@@ -70,7 +70,7 @@
70
70
  "{canInputNum} characters left": "{canInputNum}剩餘字符",
71
71
  "{canInputNum} characters over": "{canInputNum}超出字符",
72
72
  "{count} files attached.": "{count}附加文件。",
73
- "{currentStep} of {allSteps}": "{allSteps}{currentStep}",
73
+ "{currentStep} of {allSteps}": "{currentStep} / {allSteps}",
74
74
  "{doneNumber} files imported.": "{doneNumber}導入的文件。",
75
75
  "{processingNumber} files in progress...": "{processingNumber}正在進行的文件。。。"
76
76
  }
@@ -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, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "2.4.18",
3
+ "version": "2.4.22",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",