iglooform 2.5.0 → 2.5.3

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 (57) hide show
  1. package/es/checkbox/index.d.ts +7 -7
  2. package/es/checkbox/index.js +85 -5
  3. package/es/form/elements.js +3 -1
  4. package/es/index.d.ts +1 -0
  5. package/es/index.js +1 -0
  6. package/es/input/amount.js +14 -3
  7. package/es/input/input-number.js +14 -3
  8. package/es/locale/en-US/messages.json +4 -0
  9. package/es/locale/id-ID/messages.json +4 -0
  10. package/es/locale/th-TH/messages.json +4 -0
  11. package/es/locale/vi-VN/messages.json +4 -0
  12. package/es/locale/zh-CN/messages.json +4 -0
  13. package/es/locale/zh-TW/messages.json +5 -0
  14. package/es/radio/index.d.ts +6 -6
  15. package/es/radio/index.js +79 -22
  16. package/es/radio/radio-group-with-other.d.ts +1 -1
  17. package/es/radio/radio-group-with-other.js +41 -4
  18. package/es/radio/style/empty.svg +12 -0
  19. package/es/search-box/index.d.ts +31 -0
  20. package/es/search-box/index.js +266 -0
  21. package/es/search-box/style/index.d.ts +1 -0
  22. package/es/search-box/style/index.js +1 -0
  23. package/es/search-box/style/index.less +162 -0
  24. package/es/select/attached-select.d.ts +2 -12
  25. package/es/select/attached-select.js +27 -186
  26. package/es/upload-photo/index.js +33 -32
  27. package/es/utils/option-utils.d.ts +24 -0
  28. package/es/utils/option-utils.js +233 -0
  29. package/lib/checkbox/index.d.ts +7 -7
  30. package/lib/checkbox/index.js +87 -5
  31. package/lib/form/elements.js +4 -1
  32. package/lib/index.d.ts +1 -0
  33. package/lib/index.js +9 -0
  34. package/lib/input/amount.js +14 -3
  35. package/lib/input/input-number.js +14 -3
  36. package/lib/locale/en-US/messages.json +4 -0
  37. package/lib/locale/id-ID/messages.json +4 -0
  38. package/lib/locale/th-TH/messages.json +4 -0
  39. package/lib/locale/vi-VN/messages.json +4 -0
  40. package/lib/locale/zh-CN/messages.json +4 -0
  41. package/lib/locale/zh-TW/messages.json +5 -0
  42. package/lib/radio/index.d.ts +6 -6
  43. package/lib/radio/index.js +83 -22
  44. package/lib/radio/radio-group-with-other.d.ts +1 -1
  45. package/lib/radio/radio-group-with-other.js +41 -3
  46. package/lib/radio/style/empty.svg +12 -0
  47. package/lib/search-box/index.d.ts +31 -0
  48. package/lib/search-box/index.js +287 -0
  49. package/lib/search-box/style/index.d.ts +1 -0
  50. package/lib/search-box/style/index.js +3 -0
  51. package/lib/search-box/style/index.less +162 -0
  52. package/lib/select/attached-select.d.ts +2 -12
  53. package/lib/select/attached-select.js +26 -186
  54. package/lib/upload-photo/index.js +33 -32
  55. package/lib/utils/option-utils.d.ts +24 -0
  56. package/lib/utils/option-utils.js +250 -0
  57. package/package.json +10 -9
@@ -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> {
@@ -25,27 +25,18 @@ var _checkbox = _interopRequireDefault(require("../checkbox"));
25
25
 
26
26
  var _localeContext = _interopRequireDefault(require("../locale/locale-context"));
27
27
 
28
- var _formContext = _interopRequireDefault(require("../form-context"));
29
-
30
28
  var _button = _interopRequireDefault(require("../button"));
31
29
 
32
30
  var _input = _interopRequireDefault(require("../input"));
33
31
 
34
32
  require("./style");
35
33
 
36
- var _invariant = _interopRequireDefault(require("invariant"));
34
+ var _optionUtils = require("../utils/option-utils");
37
35
 
38
- var _excluded = ["value", "className", "placeholder", "onDropdownVisibleChange", "showSearch", "filterOption", "optionFilterProp", "multiple", "options"],
39
- _excluded2 = ["options", "optionGroups", "getOptions", "datasourceKey", "dependField", "children", "clearWhenOptionsUpdated"];
36
+ var _excluded = ["value", "className", "placeholder", "onDropdownVisibleChange", "showSearch", "filterOption", "optionFilterProp", "multiple", "options", "clearWhenOptionsUpdated"];
40
37
 
41
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42
39
 
43
- 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); }
44
-
45
- 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); } }
46
-
47
- 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); }); }; }
48
-
49
40
  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; }
50
41
 
51
42
  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; }
@@ -93,6 +84,8 @@ var IglooSelect = function IglooSelect(_ref) {
93
84
  multiple = _ref.multiple,
94
85
  _ref$options = _ref.options,
95
86
  options = _ref$options === void 0 ? [] : _ref$options,
87
+ _ref$clearWhenOptions = _ref.clearWhenOptionsUpdated,
88
+ clearWhenOptionsUpdated = _ref$clearWhenOptions === void 0 ? false : _ref$clearWhenOptions,
96
89
  rest = _objectWithoutProperties(_ref, _excluded);
97
90
 
98
91
  var _useContext = (0, _react.useContext)(_localeContext.default),
@@ -113,25 +106,33 @@ var IglooSelect = function IglooSelect(_ref) {
113
106
  displayOptions = _useState6[0],
114
107
  setDisplay = _useState6[1];
115
108
 
109
+ var originOptions = (0, _react.useRef)(options);
116
110
  (0, _react.useEffect)(function () {
117
111
  typeof rest.onChange === 'function' && valueProp !== selected && rest.onChange(selected, selectedOptions);
118
112
  }, [selected]);
119
113
  (0, _react.useEffect)(function () {
120
- setSelected(valueProp);
114
+ valueProp !== selected && setSelected(valueProp);
121
115
  }, [valueProp]);
122
- (0, _react.useEffect)(function () {
123
- setDisplay(options);
124
- }, [options]);
125
116
  (0, _react.useEffect)(function () {
126
117
  var setFieldValue = rest.setFieldValue;
127
- var foundValue = options.find(function (option) {
128
- return Array.isArray(valueProp) ? valueProp.includes(option.value) : option.value === valueProp;
129
- });
130
118
 
131
- if (!foundValue) {
132
- typeof setFieldValue === 'function' && setFieldValue();
119
+ if ((0, _optionUtils.compareOptions)(options, originOptions.current)) {
120
+ if (clearWhenOptionsUpdated) {
121
+ typeof setFieldValue === 'function' && setFieldValue();
122
+ } else {
123
+ var foundValue = options.find(function (option) {
124
+ return Array.isArray(valueProp) ? valueProp.includes(option.value) : option.value === valueProp;
125
+ });
126
+
127
+ if (!foundValue && valueProp !== undefined) {
128
+ typeof setFieldValue === 'function' && setFieldValue();
129
+ }
130
+ }
131
+
132
+ setDisplay(options);
133
+ originOptions.current = options;
133
134
  }
134
- }, [valueProp, options]);
135
+ }, [options]);
135
136
 
136
137
  var _useState7 = (0, _react.useState)(false),
137
138
  _useState8 = _slicedToArray(_useState7, 2),
@@ -327,175 +328,14 @@ var IglooSelect = function IglooSelect(_ref) {
327
328
  });
328
329
  };
329
330
 
330
- var AttachedSelect = function AttachedSelect(_ref11) {
331
- var options = _ref11.options,
332
- optionGroups = _ref11.optionGroups,
333
- getOptions = _ref11.getOptions,
334
- datasourceKey = _ref11.datasourceKey,
335
- dependField = _ref11.dependField,
336
- children = _ref11.children,
337
- _ref11$clearWhenOptio = _ref11.clearWhenOptionsUpdated,
338
- clearWhenOptionsUpdated = _ref11$clearWhenOptio === void 0 ? false : _ref11$clearWhenOptio,
339
- rest = _objectWithoutProperties(_ref11, _excluded2);
340
-
341
- var _useState9 = (0, _react.useState)(options || []),
342
- _useState10 = _slicedToArray(_useState9, 2),
343
- _options = _useState10[0],
344
- setOptions = _useState10[1];
345
-
346
- var _useContext2 = (0, _react.useContext)(_formContext.default),
347
- selectDatasourceApi = _useContext2.selectDatasourceApi;
348
-
349
- var getFormInstance = rest.getFormInstance;
350
- var form = typeof getFormInstance === 'function' && getFormInstance();
351
- var dependFieldValue = form && dependField && form.getFieldValue(dependField);
352
- var optionsFromGetOptions = typeof getOptions === 'function' && form && getOptions(form);
353
- (0, _invariant.default)(datasourceKey && selectDatasourceApi || !datasourceKey, 'Please provide selectDatasourceApi in Form props');
354
- (0, _react.useEffect)(function () {
355
- var calcOptions = /*#__PURE__*/function () {
356
- var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
357
- var _options2, query, api, rst, _yield$rst$json, data;
358
-
359
- return regeneratorRuntime.wrap(function _callee$(_context) {
360
- while (1) {
361
- switch (_context.prev = _context.next) {
362
- case 0:
363
- if (!Array.isArray(options)) {
364
- _context.next = 2;
365
- break;
366
- }
367
-
368
- return _context.abrupt("return", options);
369
-
370
- case 2:
371
- if (!(Array.isArray(children) || _typeof(children) === 'object')) {
372
- _context.next = 4;
373
- break;
374
- }
375
-
376
- return _context.abrupt("return", Array.isArray(children) ? children.map(function (child) {
377
- return {
378
- label: child.props.children,
379
- value: child.props.value
380
- };
381
- }) : [{
382
- label: children.props.children,
383
- value: children.props.value
384
- }]);
385
-
386
- case 4:
387
- if (!Array.isArray(optionsFromGetOptions)) {
388
- _context.next = 6;
389
- break;
390
- }
391
-
392
- return _context.abrupt("return", optionsFromGetOptions);
393
-
394
- case 6:
395
- if (!optionGroups) {
396
- _context.next = 11;
397
- break;
398
- }
399
-
400
- if (!dependFieldValue) {
401
- _context.next = 11;
402
- break;
403
- }
404
-
405
- _options2 = [];
406
- optionGroups.forEach(function (_ref13) {
407
- var parentKey = _ref13.parentKey,
408
- _ref13$options = _ref13.options,
409
- options = _ref13$options === void 0 ? [] : _ref13$options;
410
-
411
- if (Array.isArray(dependFieldValue) ? dependFieldValue.includes(parentKey) : parentKey === dependFieldValue) {
412
- _options2.push.apply(_options2, _toConsumableArray(options));
413
- }
414
- });
415
- return _context.abrupt("return", _options2);
416
-
417
- case 11:
418
- if (!(selectDatasourceApi && datasourceKey)) {
419
- _context.next = 28;
420
- break;
421
- }
422
-
423
- query = Array.isArray(dependFieldValue) ? dependFieldValue.map(function (v) {
424
- return "parent=".concat(v);
425
- }).join('&') : dependFieldValue ? "parent=".concat(dependFieldValue) : '';
426
- api = "".concat(selectDatasourceApi, "/").concat(datasourceKey);
427
- _context.prev = 14;
428
- _context.next = 17;
429
- return fetch(query ? "".concat(api, "?").concat(query) : api);
430
-
431
- case 17:
432
- rst = _context.sent;
433
- _context.next = 20;
434
- return rst.json();
435
-
436
- case 20:
437
- _yield$rst$json = _context.sent;
438
- data = _yield$rst$json.data;
439
- return _context.abrupt("return", data || []);
440
-
441
- case 25:
442
- _context.prev = 25;
443
- _context.t0 = _context["catch"](14);
444
- return _context.abrupt("return", []);
445
-
446
- case 28:
447
- return _context.abrupt("return", []);
448
-
449
- case 29:
450
- case "end":
451
- return _context.stop();
452
- }
453
- }
454
- }, _callee, null, [[14, 25]]);
455
- }));
456
-
457
- return function calcOptions() {
458
- return _ref12.apply(this, arguments);
459
- };
460
- }();
461
-
462
- var compareOptions = function compareOptions(newOptions) {
463
- var updateOptions = _options.length !== newOptions.length;
464
-
465
- if (!updateOptions) {
466
- for (var i = 0; i < _options.length; i++) {
467
- var newOption = _options[i];
468
- var originOption = newOptions[i];
469
-
470
- if (newOption.label !== originOption.label || newOption.value !== originOption.value) {
471
- updateOptions = true;
472
- break;
473
- }
474
- }
475
- }
476
-
477
- if (updateOptions) {
478
- setOptions(newOptions);
479
- var setFieldValue = rest.setFieldValue;
480
-
481
- if (clearWhenOptionsUpdated) {
482
- typeof setFieldValue === 'function' && setFieldValue();
483
- }
484
- }
485
- };
486
-
487
- calcOptions().then(compareOptions);
488
- }, [options, optionGroups, dependFieldValue, optionsFromGetOptions]);
489
- return (0, _jsxRuntime.jsx)(IglooSelect, _objectSpread({
490
- options: _options
491
- }, rest));
492
- };
331
+ var AttachedSelect = Object.assign((0, _optionUtils.optionsHOC)(IglooSelect), {
332
+ Option: Option,
333
+ OptGroup: OptGroup
334
+ });
493
335
 
494
336
  AttachedSelect.formItemPropsHandler = function (config) {
495
337
  return {};
496
338
  };
497
339
 
498
- AttachedSelect.Option = Option;
499
- AttachedSelect.OptGroup = OptGroup;
500
340
  var _default = AttachedSelect;
501
341
  exports.default = _default;
@@ -145,6 +145,7 @@ var UploadPhoto = function UploadPhoto(props) {
145
145
 
146
146
  var limitNumError = (0, _react.useRef)();
147
147
  var DomRef = (0, _react.useRef)();
148
+ var dataUrlRef = (0, _react.useRef)([]);
148
149
 
149
150
  var _useContext = (0, _react.useContext)(_formContext.default),
150
151
  uploadApi = _useContext.uploadApi;
@@ -277,12 +278,11 @@ var UploadPhoto = function UploadPhoto(props) {
277
278
  var uploadIndex = (0, _react.useRef)((value === null || value === void 0 ? void 0 : value.length) ? value.length : 0);
278
279
  (0, _react.useEffect)(function () {
279
280
  return function () {
280
- files.forEach(function (_ref4) {
281
- var dataUrl = _ref4.dataUrl;
281
+ dataUrlRef.current.forEach(function (dataUrl) {
282
282
  URL.revokeObjectURL(dataUrl);
283
283
  });
284
284
  };
285
- }, [files]);
285
+ }, []);
286
286
  (0, _react.useEffect)(function () {
287
287
  var removeLimitMsg = function removeLimitMsg(e) {
288
288
  if (DomRef.current && !DomRef.current.contains(e.target) && limitNumError.current) {
@@ -348,7 +348,7 @@ var UploadPhoto = function UploadPhoto(props) {
348
348
  };
349
349
 
350
350
  var uploadFile = /*#__PURE__*/function () {
351
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(file, currentIndex) {
351
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(file, currentIndex) {
352
352
  var uid, dataUrl, name, size, mimeType, type, errorMsg, _errorMsg;
353
353
 
354
354
  return regeneratorRuntime.wrap(function _callee4$(_context4) {
@@ -357,11 +357,12 @@ var UploadPhoto = function UploadPhoto(props) {
357
357
  case 0:
358
358
  uid = ++uploadIndex.current;
359
359
  dataUrl = URL.createObjectURL(file);
360
+ dataUrlRef.current.push(dataUrl);
360
361
  name = file.name, size = file.size, mimeType = file.type;
361
362
  type = (0, _tools.classifyType)(mimeType);
362
363
 
363
364
  if (!(type === 'unknown')) {
364
- _context4.next = 9;
365
+ _context4.next = 10;
365
366
  break;
366
367
  }
367
368
 
@@ -372,9 +373,9 @@ var UploadPhoto = function UploadPhoto(props) {
372
373
  setFieldError && setFieldError(errorMsg);
373
374
  return _context4.abrupt("return", Promise.reject(errorMsg));
374
375
 
375
- case 9:
376
+ case 10:
376
377
  if (!(limit && currentIndex > limit)) {
377
- _context4.next = 14;
378
+ _context4.next = 15;
378
379
  break;
379
380
  }
380
381
 
@@ -388,7 +389,7 @@ var UploadPhoto = function UploadPhoto(props) {
388
389
  setFieldError && setFieldError(_errorMsg);
389
390
  return _context4.abrupt("return", Promise.reject(_errorMsg));
390
391
 
391
- case 14:
392
+ case 15:
392
393
  limitNumError.current = undefined;
393
394
  setFiles(function (files) {
394
395
  return [].concat(_toConsumableArray(files), [{
@@ -462,7 +463,7 @@ var UploadPhoto = function UploadPhoto(props) {
462
463
  typeof onChange === 'function' && onChange(fileListWithError);
463
464
  }));
464
465
 
465
- case 17:
466
+ case 18:
466
467
  case "end":
467
468
  return _context4.stop();
468
469
  }
@@ -471,12 +472,12 @@ var UploadPhoto = function UploadPhoto(props) {
471
472
  }));
472
473
 
473
474
  return function uploadFile(_x5, _x6) {
474
- return _ref5.apply(this, arguments);
475
+ return _ref4.apply(this, arguments);
475
476
  };
476
477
  }();
477
478
 
478
479
  var handleUploadPromise = /*#__PURE__*/function () {
479
- var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(file, onSuccess, onFailed) {
480
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(file, onSuccess, onFailed) {
480
481
  var rst, errorMsg;
481
482
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
482
483
  while (1) {
@@ -507,12 +508,12 @@ var UploadPhoto = function UploadPhoto(props) {
507
508
  }));
508
509
 
509
510
  return function handleUploadPromise(_x7, _x8, _x9) {
510
- return _ref6.apply(this, arguments);
511
+ return _ref5.apply(this, arguments);
511
512
  };
512
513
  }();
513
514
 
514
515
  var handleDelete = /*#__PURE__*/function () {
515
- var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(index) {
516
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(index) {
516
517
  var arr, hasError, rst;
517
518
  return regeneratorRuntime.wrap(function _callee6$(_context6) {
518
519
  while (1) {
@@ -560,8 +561,8 @@ var UploadPhoto = function UploadPhoto(props) {
560
561
  return _context6.abrupt("return", typeof onChange === 'function' && onChange(rst));
561
562
 
562
563
  case 10:
563
- typeof onChange === 'function' && onChange(arr.map(function (_ref8) {
564
- var url = _ref8.url;
564
+ typeof onChange === 'function' && onChange(arr.map(function (_ref7) {
565
+ var url = _ref7.url;
565
566
  return url;
566
567
  }));
567
568
 
@@ -574,12 +575,12 @@ var UploadPhoto = function UploadPhoto(props) {
574
575
  }));
575
576
 
576
577
  return function handleDelete(_x10) {
577
- return _ref7.apply(this, arguments);
578
+ return _ref6.apply(this, arguments);
578
579
  };
579
580
  }();
580
581
 
581
582
  var handleReUpload = /*#__PURE__*/function () {
582
- var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(index) {
583
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(index) {
583
584
  var _files$index, originFile, reUpUid, rst, latestFiles, fileListWithError, newList, _rst;
584
585
 
585
586
  return regeneratorRuntime.wrap(function _callee7$(_context7) {
@@ -690,7 +691,7 @@ var UploadPhoto = function UploadPhoto(props) {
690
691
  }));
691
692
 
692
693
  return function handleReUpload(_x11) {
693
- return _ref9.apply(this, arguments);
694
+ return _ref8.apply(this, arguments);
694
695
  };
695
696
  }();
696
697
 
@@ -703,7 +704,7 @@ var UploadPhoto = function UploadPhoto(props) {
703
704
  _modal.default.noFooter({
704
705
  content: (0, _jsxRuntime.jsx)(_media.default, {
705
706
  src: dataUrl,
706
- type: type
707
+ type: (0, _tools.classifyType)(type)
707
708
  }),
708
709
  title: name,
709
710
  className: 'igloo-upload-photo-preview-modal',
@@ -784,12 +785,12 @@ var UploadPhoto = function UploadPhoto(props) {
784
785
  children: (0, _jsxRuntime.jsxs)(_row.default, {
785
786
  gutter: [isMobile ? 16 : 32, 16],
786
787
  wrap: true,
787
- children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (_ref10, index) {
788
+ children: [Boolean(samples === null || samples === void 0 ? void 0 : samples.length) && samples.map(function (_ref9, index) {
788
789
  var _classnames, _classnames2;
789
790
 
790
- var src = _ref10.src,
791
- label = _ref10.label,
792
- type = _ref10.type;
791
+ var src = _ref9.src,
792
+ label = _ref9.label,
793
+ type = _ref9.type;
793
794
  return (0, _jsxRuntime.jsxs)(_col.default, {
794
795
  span: sampleSpan,
795
796
  children: [(0, _jsxRuntime.jsx)("img", {
@@ -849,13 +850,13 @@ var UploadPhoto = function UploadPhoto(props) {
849
850
  children: buttonText || 'Upload'
850
851
  })
851
852
  })]
852
- }), files.map(function (_ref11, index) {
853
+ }), files.map(function (_ref10, index) {
853
854
  var _classnames5;
854
855
 
855
- var dataUrl = _ref11.dataUrl,
856
- status = _ref11.status,
857
- type = _ref11.type,
858
- uid = _ref11.uid;
856
+ var dataUrl = _ref10.dataUrl,
857
+ status = _ref10.status,
858
+ type = _ref10.type,
859
+ uid = _ref10.uid;
859
860
  return (0, _jsxRuntime.jsx)(_badge.default, {
860
861
  count: getBadge(status, index, limit),
861
862
  children: (0, _jsxRuntime.jsxs)("div", {
@@ -923,10 +924,10 @@ function checkFileList(value) {
923
924
  return Promise.resolve();
924
925
  }
925
926
 
926
- UploadPhoto.formItemPropsHandler = function (_ref12) {
927
- var limit = _ref12.limit,
928
- previewFormater = _ref12.previewFormater,
929
- label = _ref12.label;
927
+ UploadPhoto.formItemPropsHandler = function (_ref11) {
928
+ var limit = _ref11.limit,
929
+ previewFormater = _ref11.previewFormater,
930
+ label = _ref11.label;
930
931
  return {
931
932
  previewFormater: previewFormater || function (value) {
932
933
  return (0, _jsxRuntime.jsx)(_uploadPreview.default, {
@@ -0,0 +1,24 @@
1
+ import { FC, IglooComponentProps } from '../types';
2
+ import { FormInstance } from 'antd/es/form';
3
+ import { NamePath } from 'antd/es/form/interface';
4
+ import { SelectProps, SelectValue } from 'antd/es/select';
5
+ export declare const compareOptions: (newOptions: any[], oldOptions?: any[] | undefined) => boolean;
6
+ declare type Options = SelectProps<SelectValue>['options'];
7
+ export interface HOCProps extends IglooComponentProps {
8
+ options?: Options;
9
+ getOptions?: (form: FormInstance) => any[];
10
+ optionGroups?: {
11
+ parentKey: string;
12
+ options: Options;
13
+ }[];
14
+ datasourceKey?: string;
15
+ datasourceApi?: string;
16
+ dependField?: NamePath;
17
+ passCompareOptions?: boolean;
18
+ }
19
+ export interface ComponentProps extends IglooComponentProps {
20
+ options?: Options;
21
+ clearWhenOptionsUpdated?: boolean;
22
+ }
23
+ export declare function optionsHOC<T>(Component: FC<T>): FC<HOCProps & T>;
24
+ export {};