iglooform 2.5.4 → 2.5.7

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 (77) hide show
  1. package/es/checkbox/index.d.ts +7 -7
  2. package/es/checkbox/index.js +85 -5
  3. package/es/filter/checkBox.d.ts +4 -3
  4. package/es/filter/checkBox.js +31 -7
  5. package/es/filter/index.js +4 -2
  6. package/es/filter/radioBox.d.ts +2 -1
  7. package/es/filter/radioBox.js +24 -3
  8. package/es/form/elements.js +3 -1
  9. package/es/index.d.ts +1 -0
  10. package/es/index.js +1 -0
  11. package/es/input/amount.js +14 -3
  12. package/es/input/input-number.js +14 -3
  13. package/es/locale/en-US/messages.json +4 -0
  14. package/es/locale/id-ID/messages.json +4 -0
  15. package/es/locale/th-TH/messages.json +4 -0
  16. package/es/locale/vi-VN/messages.json +4 -0
  17. package/es/locale/zh-CN/messages.json +4 -0
  18. package/es/locale/zh-TW/messages.json +5 -0
  19. package/es/media/media.js +6 -3
  20. package/es/media/preview.js +13 -13
  21. package/es/radio/index.d.ts +6 -6
  22. package/es/radio/index.js +79 -22
  23. package/es/radio/radio-group-with-other.d.ts +1 -1
  24. package/es/radio/radio-group-with-other.js +41 -4
  25. package/es/radio/style/empty.svg +12 -0
  26. package/es/search-box/index.d.ts +19 -0
  27. package/es/search-box/index.js +266 -0
  28. package/es/search-box/style/index.d.ts +1 -0
  29. package/es/search-box/style/index.js +1 -0
  30. package/es/search-box/style/index.less +162 -0
  31. package/es/select/attached-select.d.ts +2 -12
  32. package/es/select/attached-select.js +27 -186
  33. package/es/select/style/index.less +1 -0
  34. package/es/upload-photo/index.js +33 -32
  35. package/es/upload-photo/media.js +6 -7
  36. package/es/upload-preview/media.js +13 -13
  37. package/es/utils/option-utils.d.ts +24 -0
  38. package/es/utils/option-utils.js +237 -0
  39. package/lib/checkbox/index.d.ts +7 -7
  40. package/lib/checkbox/index.js +87 -5
  41. package/lib/filter/checkBox.d.ts +4 -3
  42. package/lib/filter/checkBox.js +31 -7
  43. package/lib/filter/index.js +4 -2
  44. package/lib/filter/radioBox.d.ts +2 -1
  45. package/lib/filter/radioBox.js +24 -3
  46. package/lib/form/elements.js +4 -1
  47. package/lib/index.d.ts +1 -0
  48. package/lib/index.js +9 -0
  49. package/lib/input/amount.js +14 -3
  50. package/lib/input/input-number.js +14 -3
  51. package/lib/locale/en-US/messages.json +4 -0
  52. package/lib/locale/id-ID/messages.json +4 -0
  53. package/lib/locale/th-TH/messages.json +4 -0
  54. package/lib/locale/vi-VN/messages.json +4 -0
  55. package/lib/locale/zh-CN/messages.json +4 -0
  56. package/lib/locale/zh-TW/messages.json +5 -0
  57. package/lib/media/media.js +6 -3
  58. package/lib/media/preview.js +13 -15
  59. package/lib/radio/index.d.ts +6 -6
  60. package/lib/radio/index.js +83 -22
  61. package/lib/radio/radio-group-with-other.d.ts +1 -1
  62. package/lib/radio/radio-group-with-other.js +41 -3
  63. package/lib/radio/style/empty.svg +12 -0
  64. package/lib/search-box/index.d.ts +19 -0
  65. package/lib/search-box/index.js +287 -0
  66. package/lib/search-box/style/index.d.ts +1 -0
  67. package/lib/search-box/style/index.js +3 -0
  68. package/lib/search-box/style/index.less +162 -0
  69. package/lib/select/attached-select.d.ts +2 -12
  70. package/lib/select/attached-select.js +26 -186
  71. package/lib/select/style/index.less +1 -0
  72. package/lib/upload-photo/index.js +33 -32
  73. package/lib/upload-photo/media.js +6 -9
  74. package/lib/upload-preview/media.js +13 -13
  75. package/lib/utils/option-utils.d.ts +24 -0
  76. package/lib/utils/option-utils.js +254 -0
  77. package/package.json +1 -1
@@ -0,0 +1,162 @@
1
+ .igloo-search-box-modal-container {
2
+ .ant-modal-body {
3
+ .igloo-search-box-modal-options {
4
+ max-height: calc(100vh - 340px - 172px);
5
+ overflow: scroll;
6
+ }
7
+
8
+ .ant-input-affix-wrapper-status-error {
9
+ border-color: #d9d9d9 !important;
10
+ }
11
+
12
+ .igloo-search-box-modal-multiple-top {
13
+ padding: 8px;
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: space-between;
17
+ }
18
+
19
+ .igloo-search-box-searching {
20
+ margin-top: 24px;
21
+ display: flex;
22
+ align-items: center;
23
+
24
+ @keyframes rotation {
25
+ from {
26
+ transform: rotate(0deg);
27
+ }
28
+ to {
29
+ transform: rotate(360deg);
30
+ }
31
+ }
32
+
33
+ & > .igloo-icon {
34
+ font-size: 24px;
35
+ color: #5858ff;
36
+ margin-right: 8px;
37
+ animation: rotation 3s linear infinite;
38
+ }
39
+ }
40
+
41
+ .igloo-search-box-modal-select-item {
42
+ padding: 8px;
43
+ display: flex;
44
+ align-items: center;
45
+
46
+ .igloo-search-box-modal-select-item-checkbox {
47
+ margin-right: 10px;
48
+
49
+ .ant-checkbox-checked .ant-checkbox-inner {
50
+ background-color: #666666;
51
+ }
52
+ }
53
+
54
+ &:hover {
55
+ cursor: pointer;
56
+ background: #f9f9f9;
57
+ }
58
+ }
59
+
60
+ .igloo-search-box-active-select-item {
61
+ background-color: #f6f6ff;
62
+ }
63
+ }
64
+ }
65
+
66
+ .igloo-search-box-modal-container-mobile {
67
+ top: 0px !important;
68
+ margin: 0px !important;
69
+ width: 100vw !important;
70
+ max-width: 100vw !important;
71
+ height: 100vh !important;
72
+
73
+ .igloo-search-box-modal-mobile-title {
74
+ display: flex;
75
+ align-items: center;
76
+ width: 100%;
77
+ background-color: white;
78
+
79
+ .igloo-icon {
80
+ font-size: 24px;
81
+ margin-right: 8px;
82
+ }
83
+ }
84
+
85
+ .ant-modal-content {
86
+ position: relative;
87
+ height: 100%;
88
+
89
+ .ant-modal-body {
90
+ height: 100%;
91
+ max-height: calc(100vh - 140px - 60px);
92
+ padding: 24px 16px 0px 16px;
93
+
94
+ .igloo-search-box-modal-options {
95
+ max-height: calc(100vh - 140px - 60px - 150px);
96
+ overflow: scroll;
97
+ }
98
+
99
+ .ant-input-affix-wrapper-status-error {
100
+ border-color: #d9d9d9 !important;
101
+ }
102
+
103
+ .igloo-search-box-modal-multiple-top {
104
+ padding: 8px;
105
+ display: flex;
106
+ align-items: center;
107
+ justify-content: space-between;
108
+ }
109
+
110
+ .igloo-search-box-searching {
111
+ margin-top: 24px;
112
+ display: flex;
113
+ align-items: center;
114
+
115
+ @keyframes rotation {
116
+ from {
117
+ transform: rotate(0deg);
118
+ }
119
+ to {
120
+ transform: rotate(360deg);
121
+ }
122
+ }
123
+
124
+ & > .igloo-icon {
125
+ font-size: 24px;
126
+ color: #5858ff;
127
+ margin-right: 8px;
128
+ animation: rotation 3s linear infinite;
129
+ }
130
+ }
131
+
132
+ .igloo-search-box-modal-select-item {
133
+ padding: 8px;
134
+ display: flex;
135
+ align-items: center;
136
+
137
+ .igloo-search-box-modal-select-item-checkbox {
138
+ margin-right: 10px;
139
+
140
+ .ant-checkbox-checked .ant-checkbox-inner {
141
+ background-color: #666666;
142
+ }
143
+ }
144
+
145
+ &:hover {
146
+ cursor: pointer;
147
+ background: #f9f9f9;
148
+ }
149
+ }
150
+
151
+ .igloo-search-box-active-select-item {
152
+ background-color: #f6f6ff;
153
+ }
154
+ }
155
+
156
+ .ant-modal-footer {
157
+ position: absolute;
158
+ bottom: 0px;
159
+ width: 100%;
160
+ }
161
+ }
162
+ }
@@ -1,21 +1,11 @@
1
1
  import { SelectProps, SelectValue } from 'antd/es/select';
2
2
  import { FC, IglooComponentProps } from '../types';
3
- import { FormInstance } from 'antd/es/form';
4
3
  import './style';
5
- import { NamePath } from 'antd/es/form/interface';
4
+ import { ComponentProps } from '../utils/option-utils';
6
5
  export declare const Option: import("rc-select/lib/Option").OptionFC, OptGroup: import("rc-select/lib/OptGroup").OptionGroupFC;
7
6
  declare type Props = SelectProps<SelectValue> & IglooComponentProps & {
8
- getOptions?: (form: FormInstance) => any[];
9
7
  multiple?: boolean;
10
- clearWhenOptionsUpdated?: boolean;
11
- optionGroups?: {
12
- parentKey: string;
13
- options: Props['options'];
14
- }[];
15
- datasourceKey?: string;
16
- datasourceApi?: string;
17
- dependField?: NamePath;
18
- };
8
+ } & ComponentProps;
19
9
  declare type OptionType = typeof Option;
20
10
  declare type OptGroupType = typeof OptGroup;
21
11
  interface IglooSelectType extends FC<Props> {
@@ -1,13 +1,6 @@
1
1
  import "antd/es/select/style";
2
2
  import _Select from "antd/es/select";
3
- var _excluded = ["value", "className", "placeholder", "onDropdownVisibleChange", "showSearch", "filterOption", "optionFilterProp", "multiple", "options"],
4
- _excluded2 = ["options", "optionGroups", "getOptions", "datasourceKey", "dependField", "children", "clearWhenOptionsUpdated"];
5
-
6
- 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); }
7
-
8
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
-
10
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
3
+ var _excluded = ["value", "className", "placeholder", "onDropdownVisibleChange", "showSearch", "filterOption", "optionFilterProp", "multiple", "options", "clearWhenOptionsUpdated"];
11
4
 
12
5
  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; }
13
6
 
@@ -40,18 +33,17 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
40
33
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
41
34
 
42
35
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
43
- import { useEffect, useState, useContext } from 'react';
36
+ import { useEffect, useState, useContext, useRef } from 'react';
44
37
  import omit from 'omit.js';
45
38
  import formMethods from '../utils/form-methods';
46
39
  import { ArrowDownOutlined, ArrowUpOutlined, SearchOutlined } from 'iglooicon';
47
40
  import classnames from 'classnames';
48
41
  import Checkbox from '../checkbox';
49
42
  import LocaleContext from '../locale/locale-context';
50
- import FormContext from '../form-context';
51
43
  import Button from '../button';
52
44
  import Input from '../input';
53
45
  import './style';
54
- import invariant from 'invariant';
46
+ import { compareOptions, optionsHOC } from '../utils/option-utils';
55
47
  var Option = _Select.Option,
56
48
  OptGroup = _Select.OptGroup;
57
49
  export { Option, OptGroup };
@@ -68,6 +60,8 @@ var IglooSelect = function IglooSelect(_ref) {
68
60
  multiple = _ref.multiple,
69
61
  _ref$options = _ref.options,
70
62
  options = _ref$options === void 0 ? [] : _ref$options,
63
+ _ref$clearWhenOptions = _ref.clearWhenOptionsUpdated,
64
+ clearWhenOptionsUpdated = _ref$clearWhenOptions === void 0 ? false : _ref$clearWhenOptions,
71
65
  rest = _objectWithoutProperties(_ref, _excluded);
72
66
 
73
67
  var _useContext = useContext(LocaleContext),
@@ -88,25 +82,33 @@ var IglooSelect = function IglooSelect(_ref) {
88
82
  displayOptions = _useState6[0],
89
83
  setDisplay = _useState6[1];
90
84
 
85
+ var originOptions = useRef(options);
91
86
  useEffect(function () {
92
87
  typeof rest.onChange === 'function' && valueProp !== selected && rest.onChange(selected, selectedOptions);
93
88
  }, [selected]);
94
89
  useEffect(function () {
95
- setSelected(valueProp);
90
+ valueProp !== selected && setSelected(valueProp);
96
91
  }, [valueProp]);
97
- useEffect(function () {
98
- setDisplay(options);
99
- }, [options]);
100
92
  useEffect(function () {
101
93
  var setFieldValue = rest.setFieldValue;
102
- var foundValue = options.find(function (option) {
103
- return Array.isArray(valueProp) ? valueProp.includes(option.value) : option.value === valueProp;
104
- });
105
94
 
106
- if (!foundValue) {
107
- typeof setFieldValue === 'function' && setFieldValue();
95
+ if (compareOptions(options, originOptions.current)) {
96
+ if (clearWhenOptionsUpdated) {
97
+ typeof setFieldValue === 'function' && setFieldValue();
98
+ } else {
99
+ var foundValue = options.find(function (option) {
100
+ return Array.isArray(valueProp) ? valueProp.includes(option.value) : option.value === valueProp;
101
+ });
102
+
103
+ if (!foundValue && valueProp !== undefined) {
104
+ typeof setFieldValue === 'function' && setFieldValue();
105
+ }
106
+ }
107
+
108
+ setDisplay(options);
109
+ originOptions.current = options;
108
110
  }
109
- }, [valueProp, options]);
111
+ }, [options]);
110
112
 
111
113
  var _useState7 = useState(false),
112
114
  _useState8 = _slicedToArray(_useState7, 2),
@@ -302,174 +304,13 @@ var IglooSelect = function IglooSelect(_ref) {
302
304
  });
303
305
  };
304
306
 
305
- var AttachedSelect = function AttachedSelect(_ref11) {
306
- var options = _ref11.options,
307
- optionGroups = _ref11.optionGroups,
308
- getOptions = _ref11.getOptions,
309
- datasourceKey = _ref11.datasourceKey,
310
- dependField = _ref11.dependField,
311
- children = _ref11.children,
312
- _ref11$clearWhenOptio = _ref11.clearWhenOptionsUpdated,
313
- clearWhenOptionsUpdated = _ref11$clearWhenOptio === void 0 ? false : _ref11$clearWhenOptio,
314
- rest = _objectWithoutProperties(_ref11, _excluded2);
315
-
316
- var _useState9 = useState(options || []),
317
- _useState10 = _slicedToArray(_useState9, 2),
318
- _options = _useState10[0],
319
- setOptions = _useState10[1];
320
-
321
- var _useContext2 = useContext(FormContext),
322
- selectDatasourceApi = _useContext2.selectDatasourceApi;
323
-
324
- var getFormInstance = rest.getFormInstance;
325
- var form = typeof getFormInstance === 'function' && getFormInstance();
326
- var dependFieldValue = form && dependField && form.getFieldValue(dependField);
327
- var optionsFromGetOptions = typeof getOptions === 'function' && form && getOptions(form);
328
- invariant(datasourceKey && selectDatasourceApi || !datasourceKey, 'Please provide selectDatasourceApi in Form props');
329
- useEffect(function () {
330
- var calcOptions = /*#__PURE__*/function () {
331
- var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
332
- var _options2, query, api, rst, _yield$rst$json, data;
333
-
334
- return regeneratorRuntime.wrap(function _callee$(_context) {
335
- while (1) {
336
- switch (_context.prev = _context.next) {
337
- case 0:
338
- if (!Array.isArray(options)) {
339
- _context.next = 2;
340
- break;
341
- }
342
-
343
- return _context.abrupt("return", options);
344
-
345
- case 2:
346
- if (!(Array.isArray(children) || _typeof(children) === 'object')) {
347
- _context.next = 4;
348
- break;
349
- }
350
-
351
- return _context.abrupt("return", Array.isArray(children) ? children.map(function (child) {
352
- return {
353
- label: child.props.children,
354
- value: child.props.value
355
- };
356
- }) : [{
357
- label: children.props.children,
358
- value: children.props.value
359
- }]);
360
-
361
- case 4:
362
- if (!Array.isArray(optionsFromGetOptions)) {
363
- _context.next = 6;
364
- break;
365
- }
366
-
367
- return _context.abrupt("return", optionsFromGetOptions);
368
-
369
- case 6:
370
- if (!optionGroups) {
371
- _context.next = 11;
372
- break;
373
- }
374
-
375
- if (!dependFieldValue) {
376
- _context.next = 11;
377
- break;
378
- }
379
-
380
- _options2 = [];
381
- optionGroups.forEach(function (_ref13) {
382
- var parentKey = _ref13.parentKey,
383
- _ref13$options = _ref13.options,
384
- options = _ref13$options === void 0 ? [] : _ref13$options;
385
-
386
- if (Array.isArray(dependFieldValue) ? dependFieldValue.includes(parentKey) : parentKey === dependFieldValue) {
387
- _options2.push.apply(_options2, _toConsumableArray(options));
388
- }
389
- });
390
- return _context.abrupt("return", _options2);
391
-
392
- case 11:
393
- if (!(selectDatasourceApi && datasourceKey)) {
394
- _context.next = 28;
395
- break;
396
- }
397
-
398
- query = Array.isArray(dependFieldValue) ? dependFieldValue.map(function (v) {
399
- return "parent=".concat(v);
400
- }).join('&') : dependFieldValue ? "parent=".concat(dependFieldValue) : '';
401
- api = "".concat(selectDatasourceApi, "/").concat(datasourceKey);
402
- _context.prev = 14;
403
- _context.next = 17;
404
- return fetch(query ? "".concat(api, "?").concat(query) : api);
405
-
406
- case 17:
407
- rst = _context.sent;
408
- _context.next = 20;
409
- return rst.json();
410
-
411
- case 20:
412
- _yield$rst$json = _context.sent;
413
- data = _yield$rst$json.data;
414
- return _context.abrupt("return", data || []);
415
-
416
- case 25:
417
- _context.prev = 25;
418
- _context.t0 = _context["catch"](14);
419
- return _context.abrupt("return", []);
420
-
421
- case 28:
422
- return _context.abrupt("return", []);
423
-
424
- case 29:
425
- case "end":
426
- return _context.stop();
427
- }
428
- }
429
- }, _callee, null, [[14, 25]]);
430
- }));
431
-
432
- return function calcOptions() {
433
- return _ref12.apply(this, arguments);
434
- };
435
- }();
436
-
437
- var compareOptions = function compareOptions(newOptions) {
438
- var updateOptions = _options.length !== newOptions.length;
439
-
440
- if (!updateOptions) {
441
- for (var i = 0; i < _options.length; i++) {
442
- var newOption = _options[i];
443
- var originOption = newOptions[i];
444
-
445
- if (newOption.label !== originOption.label || newOption.value !== originOption.value) {
446
- updateOptions = true;
447
- break;
448
- }
449
- }
450
- }
451
-
452
- if (updateOptions) {
453
- setOptions(newOptions);
454
- var setFieldValue = rest.setFieldValue;
455
-
456
- if (clearWhenOptionsUpdated) {
457
- typeof setFieldValue === 'function' && setFieldValue();
458
- }
459
- }
460
- };
461
-
462
- calcOptions().then(compareOptions);
463
- }, [options, optionGroups, dependFieldValue, optionsFromGetOptions]);
464
- return _jsx(IglooSelect, _objectSpread({
465
- options: _options
466
- }, rest));
467
- };
307
+ var AttachedSelect = Object.assign(optionsHOC(IglooSelect), {
308
+ Option: Option,
309
+ OptGroup: OptGroup
310
+ });
468
311
 
469
312
  AttachedSelect.formItemPropsHandler = function (config) {
470
313
  return {};
471
314
  };
472
315
 
473
- AttachedSelect.Option = Option;
474
- AttachedSelect.OptGroup = OptGroup;
475
316
  export default AttachedSelect;
@@ -237,6 +237,7 @@
237
237
  position: absolute;
238
238
  top: 0;
239
239
  right: 0;
240
+ margin-inline-end: 0;
240
241
  }
241
242
 
242
243
  .igloo-select-arrow-active {
@@ -112,6 +112,7 @@ var UploadPhoto = function UploadPhoto(props) {
112
112
 
113
113
  var limitNumError = useRef();
114
114
  var DomRef = useRef();
115
+ var dataUrlRef = useRef([]);
115
116
 
116
117
  var _useContext = useContext(FormContext),
117
118
  uploadApi = _useContext.uploadApi;
@@ -244,12 +245,11 @@ var UploadPhoto = function UploadPhoto(props) {
244
245
  var uploadIndex = useRef((value === null || value === void 0 ? void 0 : value.length) ? value.length : 0);
245
246
  useEffect(function () {
246
247
  return function () {
247
- files.forEach(function (_ref4) {
248
- var dataUrl = _ref4.dataUrl;
248
+ dataUrlRef.current.forEach(function (dataUrl) {
249
249
  URL.revokeObjectURL(dataUrl);
250
250
  });
251
251
  };
252
- }, [files]);
252
+ }, []);
253
253
  useEffect(function () {
254
254
  var removeLimitMsg = function removeLimitMsg(e) {
255
255
  if (DomRef.current && !DomRef.current.contains(e.target) && limitNumError.current) {
@@ -315,7 +315,7 @@ var UploadPhoto = function UploadPhoto(props) {
315
315
  };
316
316
 
317
317
  var uploadFile = /*#__PURE__*/function () {
318
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(file, currentIndex) {
318
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(file, currentIndex) {
319
319
  var uid, dataUrl, name, size, mimeType, type, errorMsg, _errorMsg;
320
320
 
321
321
  return regeneratorRuntime.wrap(function _callee4$(_context4) {
@@ -324,11 +324,12 @@ var UploadPhoto = function UploadPhoto(props) {
324
324
  case 0:
325
325
  uid = ++uploadIndex.current;
326
326
  dataUrl = URL.createObjectURL(file);
327
+ dataUrlRef.current.push(dataUrl);
327
328
  name = file.name, size = file.size, mimeType = file.type;
328
329
  type = classifyType(mimeType);
329
330
 
330
331
  if (!(type === 'unknown')) {
331
- _context4.next = 9;
332
+ _context4.next = 10;
332
333
  break;
333
334
  }
334
335
 
@@ -339,9 +340,9 @@ var UploadPhoto = function UploadPhoto(props) {
339
340
  setFieldError && setFieldError(errorMsg);
340
341
  return _context4.abrupt("return", Promise.reject(errorMsg));
341
342
 
342
- case 9:
343
+ case 10:
343
344
  if (!(limit && currentIndex > limit)) {
344
- _context4.next = 14;
345
+ _context4.next = 15;
345
346
  break;
346
347
  }
347
348
 
@@ -355,7 +356,7 @@ var UploadPhoto = function UploadPhoto(props) {
355
356
  setFieldError && setFieldError(_errorMsg);
356
357
  return _context4.abrupt("return", Promise.reject(_errorMsg));
357
358
 
358
- case 14:
359
+ case 15:
359
360
  limitNumError.current = undefined;
360
361
  setFiles(function (files) {
361
362
  return [].concat(_toConsumableArray(files), [{
@@ -429,7 +430,7 @@ var UploadPhoto = function UploadPhoto(props) {
429
430
  typeof onChange === 'function' && onChange(fileListWithError);
430
431
  }));
431
432
 
432
- case 17:
433
+ case 18:
433
434
  case "end":
434
435
  return _context4.stop();
435
436
  }
@@ -438,12 +439,12 @@ var UploadPhoto = function UploadPhoto(props) {
438
439
  }));
439
440
 
440
441
  return function uploadFile(_x5, _x6) {
441
- return _ref5.apply(this, arguments);
442
+ return _ref4.apply(this, arguments);
442
443
  };
443
444
  }();
444
445
 
445
446
  var handleUploadPromise = /*#__PURE__*/function () {
446
- var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(file, onSuccess, onFailed) {
447
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(file, onSuccess, onFailed) {
447
448
  var rst, errorMsg;
448
449
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
449
450
  while (1) {
@@ -474,12 +475,12 @@ var UploadPhoto = function UploadPhoto(props) {
474
475
  }));
475
476
 
476
477
  return function handleUploadPromise(_x7, _x8, _x9) {
477
- return _ref6.apply(this, arguments);
478
+ return _ref5.apply(this, arguments);
478
479
  };
479
480
  }();
480
481
 
481
482
  var handleDelete = /*#__PURE__*/function () {
482
- var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(index) {
483
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(index) {
483
484
  var arr, hasError, rst;
484
485
  return regeneratorRuntime.wrap(function _callee6$(_context6) {
485
486
  while (1) {
@@ -527,8 +528,8 @@ var UploadPhoto = function UploadPhoto(props) {
527
528
  return _context6.abrupt("return", typeof onChange === 'function' && onChange(rst));
528
529
 
529
530
  case 10:
530
- typeof onChange === 'function' && onChange(arr.map(function (_ref8) {
531
- var url = _ref8.url;
531
+ typeof onChange === 'function' && onChange(arr.map(function (_ref7) {
532
+ var url = _ref7.url;
532
533
  return url;
533
534
  }));
534
535
 
@@ -541,12 +542,12 @@ var UploadPhoto = function UploadPhoto(props) {
541
542
  }));
542
543
 
543
544
  return function handleDelete(_x10) {
544
- return _ref7.apply(this, arguments);
545
+ return _ref6.apply(this, arguments);
545
546
  };
546
547
  }();
547
548
 
548
549
  var handleReUpload = /*#__PURE__*/function () {
549
- var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(index) {
550
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(index) {
550
551
  var _files$index, originFile, reUpUid, rst, latestFiles, fileListWithError, newList, _rst;
551
552
 
552
553
  return regeneratorRuntime.wrap(function _callee7$(_context7) {
@@ -657,7 +658,7 @@ var UploadPhoto = function UploadPhoto(props) {
657
658
  }));
658
659
 
659
660
  return function handleReUpload(_x11) {
660
- return _ref9.apply(this, arguments);
661
+ return _ref8.apply(this, arguments);
661
662
  };
662
663
  }();
663
664
 
@@ -669,7 +670,7 @@ var UploadPhoto = function UploadPhoto(props) {
669
670
  Modal.noFooter({
670
671
  content: _jsx(Preview, {
671
672
  src: dataUrl,
672
- type: type
673
+ type: classifyType(type)
673
674
  }),
674
675
  title: name,
675
676
  className: 'igloo-upload-photo-preview-modal',
@@ -750,12 +751,12 @@ var UploadPhoto = function UploadPhoto(props) {
750
751
  children: _jsxs(_Row, {
751
752
  gutter: [isMobile ? 16 : 32, 16],
752
753
  wrap: true,
753
- children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (_ref10, index) {
754
+ children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (_ref9, index) {
754
755
  var _classnames, _classnames2;
755
756
 
756
- var src = _ref10.src,
757
- label = _ref10.label,
758
- type = _ref10.type;
757
+ var src = _ref9.src,
758
+ label = _ref9.label,
759
+ type = _ref9.type;
759
760
  return _jsxs(_Col, {
760
761
  span: sampleSpan,
761
762
  children: [_jsx("img", {
@@ -815,13 +816,13 @@ var UploadPhoto = function UploadPhoto(props) {
815
816
  children: buttonText || 'Upload'
816
817
  })
817
818
  })]
818
- }), files.map(function (_ref11, index) {
819
+ }), files.map(function (_ref10, index) {
819
820
  var _classnames5;
820
821
 
821
- var dataUrl = _ref11.dataUrl,
822
- status = _ref11.status,
823
- type = _ref11.type,
824
- uid = _ref11.uid;
822
+ var dataUrl = _ref10.dataUrl,
823
+ status = _ref10.status,
824
+ type = _ref10.type,
825
+ uid = _ref10.uid;
825
826
  return _jsx(_Badge, {
826
827
  count: getBadge(status, index, limit),
827
828
  children: _jsxs("div", {
@@ -889,10 +890,10 @@ function checkFileList(value) {
889
890
  return Promise.resolve();
890
891
  }
891
892
 
892
- UploadPhoto.formItemPropsHandler = function (_ref12) {
893
- var limit = _ref12.limit,
894
- previewFormater = _ref12.previewFormater,
895
- label = _ref12.label;
893
+ UploadPhoto.formItemPropsHandler = function (_ref11) {
894
+ var limit = _ref11.limit,
895
+ previewFormater = _ref11.previewFormater,
896
+ label = _ref11.label;
896
897
  return {
897
898
  previewFormater: previewFormater || function (value) {
898
899
  return _jsx(UploadPreview, {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import PDF from '@mikecousins/react-pdf';
2
+ import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
3
3
 
4
4
  var MediaItem = function MediaItem(_ref) {
5
5
  var type = _ref.type,
@@ -21,13 +21,12 @@ var MediaItem = function MediaItem(_ref) {
21
21
  case 'pdf':
22
22
  return _jsx("div", {
23
23
  className: className,
24
- children: _jsx(PDF, {
24
+ children: _jsx(Document, {
25
25
  file: src,
26
- scale: 0.1,
27
- style: {
28
- maxWidth: 96,
29
- maxHeight: 96
30
- }
26
+ children: _jsx(Page, {
27
+ pageNumber: 1,
28
+ height: 96
29
+ })
31
30
  })
32
31
  });
33
32