iglooform 2.3.14 → 2.3.18

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 (51) hide show
  1. package/es/admin-upload/modal.js +1 -1
  2. package/es/admin-upload/style/index.less +1 -0
  3. package/es/form/element/index.js +11 -7
  4. package/es/form/login/index.js +1 -1
  5. package/es/form/page/index.js +1 -1
  6. package/es/form/pages/index.js +1 -1
  7. package/es/form/section/index.d.ts +3 -0
  8. package/es/form/section/index.js +8 -3
  9. package/es/form/step/index.js +1 -1
  10. package/es/form/steps/index.js +2 -2
  11. package/es/free-form/element/index.js +7 -5
  12. package/es/free-form/page/index.js +1 -1
  13. package/es/input/phone-number.js +6 -1
  14. package/es/layout/defaultFooter.d.ts +4 -0
  15. package/es/layout/defaultFooter.js +137 -0
  16. package/es/layout/defaultHeader.d.ts +4 -0
  17. package/es/layout/defaultHeader.js +40 -0
  18. package/es/layout/index.js +4 -19
  19. package/es/select/attached-select.d.ts +1 -0
  20. package/es/select/attached-select.js +8 -1
  21. package/es/types.d.ts +1 -0
  22. package/es/{form/utils.d.ts → utils/form-utils.d.ts} +1 -0
  23. package/es/{form/utils.js → utils/form-utils.js} +11 -1
  24. package/lib/admin-upload/modal.js +1 -1
  25. package/lib/admin-upload/style/index.less +1 -0
  26. package/lib/form/element/index.js +12 -8
  27. package/lib/form/login/index.js +2 -2
  28. package/lib/form/page/index.js +2 -2
  29. package/lib/form/pages/index.js +3 -3
  30. package/lib/form/section/index.d.ts +3 -0
  31. package/lib/form/section/index.js +10 -5
  32. package/lib/form/step/index.js +2 -2
  33. package/lib/form/steps/index.js +4 -4
  34. package/lib/free-form/element/index.js +8 -6
  35. package/lib/free-form/page/index.js +2 -2
  36. package/lib/input/phone-number.js +6 -1
  37. package/lib/layout/defaultFooter.d.ts +4 -0
  38. package/lib/layout/defaultFooter.js +154 -0
  39. package/lib/layout/defaultHeader.d.ts +4 -0
  40. package/lib/layout/defaultHeader.js +54 -0
  41. package/lib/layout/index.js +6 -19
  42. package/lib/select/attached-select.d.ts +1 -0
  43. package/lib/select/attached-select.js +8 -1
  44. package/lib/types.d.ts +1 -0
  45. package/lib/{form/utils.d.ts → utils/form-utils.d.ts} +1 -0
  46. package/lib/{form/utils.js → utils/form-utils.js} +11 -1
  47. package/package.json +1 -1
  48. package/es/free-form/utils.d.ts +0 -73
  49. package/es/free-form/utils.js +0 -370
  50. package/lib/free-form/utils.d.ts +0 -73
  51. package/lib/free-form/utils.js +0 -403
@@ -71,7 +71,7 @@ var Import = function Import(_ref) {
71
71
  customRequest: function customRequest() {},
72
72
  action: function action(file) {
73
73
  var dataSourceId = currentSource;
74
- setSource(undefined);
74
+ Array.isArray(dataSource) && setSource(undefined);
75
75
  return onUpload(file, dataSourceId);
76
76
  }
77
77
  }, {
@@ -139,6 +139,7 @@
139
139
  .igloo-admin-upload-dragger-switch {
140
140
  min-width: 224px;
141
141
  margin-top: 16px;
142
+ text-align: left;
142
143
  }
143
144
 
144
145
  .igloo-admin-upload-dargger-title {
@@ -34,7 +34,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34
34
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
35
35
  import { useContext, useEffect, useRef, useReducer } from 'react';
36
36
  import { CloseCircleFilled } from '@ant-design/icons';
37
- import { calcFormItemProps } from '../utils';
37
+ import { calcFormItemProps } from '../../utils/form-utils';
38
38
  import Section from '../section';
39
39
  import useComponent from '../elements';
40
40
  import FormContext from '../context';
@@ -52,7 +52,7 @@ var Element = function Element(_ref) {
52
52
  setShowStepButton = _ref.setShowStepButton;
53
53
  var type = config.type,
54
54
  label = config.label,
55
- render = config.render;
55
+ previewLabel = config.previewLabel;
56
56
 
57
57
  var _useContext = useContext(FormContext),
58
58
  form = _useContext.form,
@@ -72,7 +72,8 @@ var Element = function Element(_ref) {
72
72
  copyValue = config.copyValue,
73
73
  selectValue = config.selectValue,
74
74
  shouldRender = config.shouldRender,
75
- dependField = config.dependField;
75
+ dependField = config.dependField,
76
+ getOptions = config.getOptions;
76
77
  var dependentField = dependencies || [];
77
78
 
78
79
  if (asserts && asserts.length) {
@@ -93,7 +94,7 @@ var Element = function Element(_ref) {
93
94
  });
94
95
  }
95
96
 
96
- if (shouldRender) {
97
+ if (shouldRender || getOptions) {
97
98
  dependentField.push('SUBSCRIBE_ALL');
98
99
  }
99
100
 
@@ -116,7 +117,10 @@ var Element = function Element(_ref) {
116
117
  if (type === 'Section') {
117
118
  return _jsx(Section, {
118
119
  parentName: parentName,
119
- config: config
120
+ config: config,
121
+ preview: preview,
122
+ disabled: disabled,
123
+ setShowStepButton: setShowStepButton
120
124
  }, void 0);
121
125
  }
122
126
 
@@ -246,14 +250,14 @@ var Element = function Element(_ref) {
246
250
  xs: 0
247
251
  }
248
252
  }, {
249
- children: [label && _jsx(_Col, Object.assign({
253
+ children: [(previewLabel || label) && _jsx(_Col, Object.assign({
250
254
  span: 12,
251
255
  md: 12,
252
256
  sm: 24,
253
257
  xs: 24,
254
258
  className: "igloo-element-preview-label"
255
259
  }, {
256
- children: label
260
+ children: previewLabel || label
257
261
  }), void 0), _jsxs(_Col, Object.assign({
258
262
  span: label ? 12 : 24,
259
263
  md: label ? 12 : 24,
@@ -9,7 +9,7 @@ import _Col from "antd/es/col";
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  import { useContext } from 'react';
11
11
  import Element from '../element';
12
- import { calcNamePath } from '../utils';
12
+ import { calcNamePath } from '../../utils/form-utils';
13
13
  import FormContext from '../context';
14
14
  import { LocaleContext } from '../../locale';
15
15
  import './style/index.less';
@@ -21,7 +21,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
21
  import { useContext, useEffect, useReducer } from 'react';
22
22
  import Button from '../../button';
23
23
  import Element from '../element';
24
- import { calcNamePath } from '../utils';
24
+ import { calcNamePath } from '../../utils/form-utils';
25
25
  import FormContext from '../context';
26
26
  import { LocaleContext } from '../../locale';
27
27
  import './style/index.less';
@@ -23,7 +23,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
23
  import { useState, useContext, useReducer, useEffect } from 'react';
24
24
  import Button from '../../button';
25
25
  import Page from '../page';
26
- import { calcNamePath } from '../utils';
26
+ import { calcNamePath } from '../../utils/form-utils';
27
27
  import FormContext from '../context';
28
28
  import { LocaleContext } from '../../locale';
29
29
  import './style/index.less';
@@ -6,6 +6,9 @@ export interface SectionProps {
6
6
  parentName?: FormItemName;
7
7
  formItemProps?: FormItemProps;
8
8
  config: FormItemConfig;
9
+ preview?: boolean;
10
+ disabled?: boolean;
11
+ setShowStepButton?: (showButton: boolean) => void;
9
12
  }
10
13
  declare const Section: FC<SectionProps>;
11
14
  export default Section;
@@ -18,7 +18,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
18
  import { useContext } from 'react';
19
19
  import Element from '../element';
20
20
  import FormContext from '../context';
21
- import { calcNamePath, calcFormItemProps } from '../utils';
21
+ import { calcNamePath, calcFormItemProps } from '../../utils/form-utils';
22
22
  import Typography from '../../typography';
23
23
  import './style/index.less';
24
24
 
@@ -35,7 +35,10 @@ var Section = function Section(_ref) {
35
35
  contentProps = _ref$config$contentPr === void 0 ? {} : _ref$config$contentPr,
36
36
  _ref$config$style = _ref$config.style,
37
37
  style = _ref$config$style === void 0 ? {} : _ref$config$style,
38
- rest = _objectWithoutProperties(_ref$config, _excluded);
38
+ rest = _objectWithoutProperties(_ref$config, _excluded),
39
+ preview = _ref.preview,
40
+ disabled = _ref.disabled,
41
+ setShowStepButton = _ref.setShowStepButton;
39
42
 
40
43
  var _useContext = useContext(FormContext),
41
44
  form = _useContext.form,
@@ -84,7 +87,9 @@ var Section = function Section(_ref) {
84
87
  return _jsx(Element, {
85
88
  parentName: namePath,
86
89
  config: child,
87
- disabled: elementProps.disabled
90
+ disabled: elementProps.disabled || disabled,
91
+ preview: preview,
92
+ setShowStepButton: setShowStepButton
88
93
  }, index);
89
94
  })
90
95
  }), void 0)
@@ -24,7 +24,7 @@ import { useContext, useState, useRef, useEffect } from 'react';
24
24
  import { LocaleContext } from '../../locale';
25
25
  import Button from '../../button';
26
26
  import Element from '../element';
27
- import { calcNamePath } from '../utils';
27
+ import { calcNamePath } from '../../utils/form-utils';
28
28
  import FormContext from '../context';
29
29
  import './style/index.less';
30
30
  var useBreakpoint = _Grid.useBreakpoint;
@@ -17,7 +17,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  import { jsx as _jsx } from "react/jsx-runtime";
18
18
  import { useState, useContext, useEffect, useReducer } from 'react';
19
19
  import Step from '../step';
20
- import { calcNamePath } from '../utils';
20
+ import { calcNamePath } from '../../utils/form-utils';
21
21
  import FormContext from '../context';
22
22
  import './style/index.less';
23
23
  import invariant from 'invariant';
@@ -69,7 +69,7 @@ var Steps = function Steps(_ref) {
69
69
  }
70
70
  }, []);
71
71
  var renderElements = elements.filter(function (step) {
72
- step.key = step.name || step.key || Math.random();
72
+ step.key = step.name || step.key;
73
73
  return typeof step.shouldRender !== 'function' || step.shouldRender(form);
74
74
  });
75
75
 
@@ -33,7 +33,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
33
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
34
34
  import { useContext, useEffect, useRef, useReducer, isValidElement, cloneElement, useMemo } from 'react';
35
35
  import { CloseCircleFilled } from '@ant-design/icons';
36
- import { calcFormItemProps } from '../utils';
36
+ import { calcFormItemProps } from '../../utils/form-utils';
37
37
  import FormContext from '../context';
38
38
  import omit from 'omit.js';
39
39
  import classNames from 'classnames';
@@ -43,6 +43,7 @@ var useBreakpoint = _Grid.useBreakpoint;
43
43
  var Element = function Element(props) {
44
44
  var parentName = props.parentName,
45
45
  label = props.label,
46
+ previewLabel = props.previewLabel,
46
47
  preview = props.preview,
47
48
  disabled = props.disabled,
48
49
  children = props.children;
@@ -65,7 +66,8 @@ var Element = function Element(props) {
65
66
  copyValue = props.copyValue,
66
67
  selectValue = props.selectValue,
67
68
  shouldRender = props.shouldRender,
68
- dependField = props.dependField;
69
+ dependField = props.dependField,
70
+ getOptions = props.getOptions;
69
71
  var dependentField = dependencies || [];
70
72
 
71
73
  if (asserts && asserts.length) {
@@ -86,7 +88,7 @@ var Element = function Element(props) {
86
88
  });
87
89
  }
88
90
 
89
- if (shouldRender) {
91
+ if (shouldRender || getOptions) {
90
92
  dependentField.push('SUBSCRIBE_ALL');
91
93
  }
92
94
 
@@ -215,14 +217,14 @@ var Element = function Element(props) {
215
217
  xs: 0
216
218
  }
217
219
  }, {
218
- children: [label && _jsx(_Col, Object.assign({
220
+ children: [(previewLabel || label) && _jsx(_Col, Object.assign({
219
221
  span: 12,
220
222
  md: 12,
221
223
  sm: 24,
222
224
  xs: 24,
223
225
  className: "igloo-element-preview-label"
224
226
  }, {
225
- children: label
227
+ children: previewLabel || label
226
228
  }), void 0), _jsxs(_Col, Object.assign({
227
229
  span: label ? 12 : 24,
228
230
  md: label ? 12 : 24,
@@ -24,7 +24,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
25
  import { useContext, useEffect, cloneElement, isValidElement, useMemo, useReducer } from 'react';
26
26
  import Button from '../../button';
27
- import { calcNamePath } from '../utils';
27
+ import { calcNamePath } from '../../utils/form-utils';
28
28
  import FormContext from '../context';
29
29
  import { LocaleContext } from '../../locale';
30
30
  import Typography from '../../typography';
@@ -110,7 +110,12 @@ PhoneNumber.formItemPropsHandler = function (_ref2) {
110
110
  id: 'Numbers only, please omit " " or "-".'
111
111
  }));
112
112
  }
113
- }]
113
+ }],
114
+ previewFormater: function previewFormater(_ref3) {
115
+ var areaCode = _ref3.areaCode,
116
+ phoneNumber = _ref3.phoneNumber;
117
+ return "".concat(areaCode).concat(phoneNumber);
118
+ }
114
119
  };
115
120
  };
116
121
 
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import './style';
3
+ declare const DefaultFooter: FC<any>;
4
+ export default DefaultFooter;
@@ -0,0 +1,137 @@
1
+ import "antd/es/space/style";
2
+ import _Space from "antd/es/space";
3
+ import "antd/es/grid/style";
4
+ import _Grid from "antd/es/grid";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ import Typography from '../typography';
7
+ import Button from '../button';
8
+ import './style';
9
+
10
+ var DefaultFooter = function DefaultFooter() {
11
+ var useBreakpoint = _Grid.useBreakpoint;
12
+
13
+ var _useBreakpoint = useBreakpoint(),
14
+ md = _useBreakpoint.md;
15
+
16
+ return md ? _jsx("div", Object.assign({
17
+ className: "igloo-layout-footer"
18
+ }, {
19
+ children: _jsxs("div", Object.assign({
20
+ className: "footer-content"
21
+ }, {
22
+ children: [_jsx(_Space, Object.assign({
23
+ size: 32,
24
+ align: "start",
25
+ className: "footer-top"
26
+ }, {
27
+ children: _jsx("div", Object.assign({
28
+ className: "top-left"
29
+ }, {
30
+ children: _jsx("div", {
31
+ className: "igloo-logo"
32
+ }, void 0)
33
+ }), void 0)
34
+ }), void 0), _jsx("div", {
35
+ className: "footer-divider"
36
+ }, void 0), _jsxs("div", Object.assign({
37
+ className: "footer-bottom"
38
+ }, {
39
+ children: [_jsx(Typography, Object.assign({
40
+ level: "body3"
41
+ }, {
42
+ children: "\xA9 ".concat(new Date().getFullYear(), " Powered by Axinan Pte Ltd. All Rights Reserved.")
43
+ }), void 0), _jsxs(Typography, Object.assign({
44
+ level: "body3"
45
+ }, {
46
+ children: [_jsx(Button, Object.assign({
47
+ type: "text",
48
+ onClick: function onClick() {
49
+ return window.open('https://contents.iglooinsure.com/privacypolicy');
50
+ }
51
+ }, {
52
+ children: _jsx(Typography, Object.assign({
53
+ level: "body3"
54
+ }, {
55
+ children: "Privacy Policy"
56
+ }), void 0)
57
+ }), void 0), ' ', _jsx("span", Object.assign({
58
+ style: {
59
+ margin: '0px 16px'
60
+ }
61
+ }, {
62
+ children: "|"
63
+ }), void 0), _jsx(Button, Object.assign({
64
+ type: "text",
65
+ onClick: function onClick() {
66
+ return window.open('https://contents.iglooinsure.com/termsofservice');
67
+ }
68
+ }, {
69
+ children: _jsx(Typography, Object.assign({
70
+ level: "body3"
71
+ }, {
72
+ children: "Terms of Service"
73
+ }), void 0)
74
+ }), void 0)]
75
+ }), void 0)]
76
+ }), void 0)]
77
+ }), void 0)
78
+ }), void 0) : _jsx("div", Object.assign({
79
+ className: "igloo-layout-footer"
80
+ }, {
81
+ children: _jsxs("div", Object.assign({
82
+ className: "footer-content"
83
+ }, {
84
+ children: [_jsx("div", {
85
+ className: "igloo-logo"
86
+ }, void 0), _jsxs("div", Object.assign({
87
+ className: "footer-bottom"
88
+ }, {
89
+ children: [_jsx("div", {
90
+ children: _jsxs(Typography, Object.assign({
91
+ level: "body3"
92
+ }, {
93
+ children: ["\xA9 ".concat(new Date().getFullYear(), " Powered by Axinan Pte Ltd."), _jsx("div", {
94
+ children: "All Rights Reserved."
95
+ }, void 0)]
96
+ }), void 0)
97
+ }, void 0), _jsx("div", {
98
+ children: _jsxs(Typography, Object.assign({
99
+ level: "body3"
100
+ }, {
101
+ children: [_jsx(Button, Object.assign({
102
+ type: "text",
103
+ onClick: function onClick() {
104
+ return window.open('https://contents.iglooinsure.com/privacypolicy');
105
+ }
106
+ }, {
107
+ children: _jsx(Typography, Object.assign({
108
+ level: "body3"
109
+ }, {
110
+ children: "Privacy Policy"
111
+ }), void 0)
112
+ }), void 0), ' ', _jsx("span", Object.assign({
113
+ style: {
114
+ margin: '0px 16px'
115
+ }
116
+ }, {
117
+ children: "|"
118
+ }), void 0), ' ', _jsx(Button, Object.assign({
119
+ type: "text",
120
+ onClick: function onClick() {
121
+ return window.open('https://contents.iglooinsure.com/termsofservice');
122
+ }
123
+ }, {
124
+ children: _jsx(Typography, Object.assign({
125
+ level: "body3"
126
+ }, {
127
+ children: "Terms of Service"
128
+ }), void 0)
129
+ }), void 0)]
130
+ }), void 0)
131
+ }, void 0)]
132
+ }), void 0)]
133
+ }), void 0)
134
+ }), void 0);
135
+ };
136
+
137
+ export default DefaultFooter;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import './style';
3
+ declare const DefaultHeader: FC<any>;
4
+ export default DefaultHeader;
@@ -0,0 +1,40 @@
1
+ import "antd/es/grid/style";
2
+ import _Grid from "antd/es/grid";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import classnames from 'classnames';
5
+ import './style';
6
+
7
+ var DefaultHeader = function DefaultHeader() {
8
+ var useBreakpoint = _Grid.useBreakpoint;
9
+
10
+ var _useBreakpoint = useBreakpoint(),
11
+ md = _useBreakpoint.md;
12
+
13
+ return md ? _jsx("div", Object.assign({
14
+ className: classnames({
15
+ 'igloo-layout-header': true
16
+ })
17
+ }, {
18
+ children: _jsx("div", Object.assign({
19
+ className: "header-content"
20
+ }, {
21
+ children: _jsx("div", Object.assign({
22
+ className: "header-left"
23
+ }, {
24
+ children: _jsx("div", {
25
+ className: "igloo-logo"
26
+ }, void 0)
27
+ }), void 0)
28
+ }), void 0)
29
+ }), void 0) : _jsx("div", Object.assign({
30
+ className: classnames({
31
+ 'igloo-layout-header': true
32
+ })
33
+ }, {
34
+ children: _jsx("div", {
35
+ className: "igloo-logo"
36
+ }, void 0)
37
+ }), void 0);
38
+ };
39
+
40
+ export default DefaultHeader;
@@ -4,6 +4,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import classnames from 'classnames';
5
5
  import LayoutHeader from './header';
6
6
  import LayoutFooter from './footer';
7
+ import DefaultHeader from './defaultHeader';
8
+ import DefaultFooter from './defaultFooter';
7
9
  import './style';
8
10
 
9
11
  var Layout = function Layout(props) {
@@ -83,28 +85,11 @@ var Layout = function Layout(props) {
83
85
  contentDom = children;
84
86
  }
85
87
 
86
- if (!md) {
87
- return _jsxs("div", Object.assign({
88
- style: style,
89
- className: classnames(layoutContainerClass, className)
90
- }, {
91
- children: [headerConfig && _jsx(LayoutHeader, Object.assign({}, headerConfig), void 0), headerDom, _jsx("div", Object.assign({
92
- className: "igloo-layout-center"
93
- }, {
94
- children: _jsx("div", Object.assign({
95
- className: "igloo-layout-content"
96
- }, {
97
- children: contentDom
98
- }), void 0)
99
- }), void 0), footerConfig && _jsx(LayoutFooter, Object.assign({}, footerConfig), void 0), footerDom]
100
- }), void 0);
101
- }
102
-
103
88
  return _jsxs("div", Object.assign({
104
89
  style: style,
105
90
  className: classnames(layoutContainerClass, className)
106
91
  }, {
107
- children: [headerConfig && _jsx(LayoutHeader, Object.assign({}, headerConfig), void 0), headerDom, _jsx("div", Object.assign({
92
+ children: [!headerDom && !headerConfig && _jsx(DefaultHeader, {}, void 0), headerConfig && _jsx(LayoutHeader, Object.assign({}, headerConfig), void 0), headerDom, _jsx("div", Object.assign({
108
93
  className: "igloo-layout-center"
109
94
  }, {
110
95
  children: _jsx("div", Object.assign({
@@ -112,7 +97,7 @@ var Layout = function Layout(props) {
112
97
  }, {
113
98
  children: contentDom
114
99
  }), void 0)
115
- }), void 0), footerConfig && _jsx(LayoutFooter, Object.assign({}, footerConfig), void 0), footerDom]
100
+ }), void 0), !footerDom && !footerConfig && _jsx(DefaultFooter, {}, void 0), footerConfig && _jsx(LayoutFooter, Object.assign({}, footerConfig), void 0), footerDom]
116
101
  }), void 0);
117
102
  };
118
103
 
@@ -6,6 +6,7 @@ export declare const Option: import("rc-select/lib/Option").OptionFC, OptGroup:
6
6
  declare type Props = SelectProps<SelectValue> & IglooComponentProps & {
7
7
  getOptions?: (form: FormInstance) => any[];
8
8
  multiple?: boolean;
9
+ clearWhenOptionsUpdated?: boolean;
9
10
  };
10
11
  declare type OptionType = typeof Option;
11
12
  declare type OptGroupType = typeof OptGroup;
@@ -1,6 +1,6 @@
1
1
  import "antd/es/select/style";
2
2
  import _Select from "antd/es/select";
3
- var _excluded = ["options", "getOptions", "value", "className", "placeholder", "onDropdownVisibleChange", "children", "showSearch", "filterOption", "optionFilterProp", "multiple"];
3
+ var _excluded = ["options", "getOptions", "value", "className", "placeholder", "onDropdownVisibleChange", "children", "showSearch", "filterOption", "optionFilterProp", "multiple", "clearWhenOptionsUpdated"];
4
4
 
5
5
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
6
 
@@ -54,6 +54,8 @@ var IglooSelect = function IglooSelect(_ref) {
54
54
  filterOption = _ref.filterOption,
55
55
  optionFilterProp = _ref.optionFilterProp,
56
56
  multiple = _ref.multiple,
57
+ _ref$clearWhenOptions = _ref.clearWhenOptionsUpdated,
58
+ clearWhenOptionsUpdated = _ref$clearWhenOptions === void 0 ? false : _ref$clearWhenOptions,
57
59
  rest = _objectWithoutProperties(_ref, _excluded);
58
60
 
59
61
  var _useContext = useContext(LocaleContext),
@@ -127,6 +129,11 @@ var IglooSelect = function IglooSelect(_ref) {
127
129
  if (updateOptions) {
128
130
  setOriginOptions(options);
129
131
  setDisplay(options);
132
+ var setFieldValue = rest.setFieldValue;
133
+
134
+ if (clearWhenOptionsUpdated) {
135
+ typeof setFieldValue === 'function' && setFieldValue();
136
+ }
130
137
  }
131
138
  }, [options]);
132
139
  useEffect(function () {
package/es/types.d.ts CHANGED
@@ -92,6 +92,7 @@ export interface FormItemConfig extends FormItemExtraConfig {
92
92
  type?: string;
93
93
  name?: NamePath;
94
94
  label?: string | React.ReactNode;
95
+ previewLabel?: string | React.ReactNode;
95
96
  labelProps?: any;
96
97
  contentProps?: any;
97
98
  }
@@ -35,6 +35,7 @@ export declare const calcFormItemProps: (config: FormItemConfig, extraProps: For
35
35
  };
36
36
  normalize: ((value: any, prevValue: any, allValues: import("rc-field-form/lib/interface").Store) => any) | undefined;
37
37
  rules: import("rc-field-form/lib/interface").Rule[];
38
+ validateTrigger: string[];
38
39
  label: JSX.Element | null;
39
40
  getValueFromEvent: ((...args: import("rc-field-form/lib/interface").EventArgs) => any) | undefined;
40
41
  getValueProps: ((value: any) => object) | undefined;
@@ -1,4 +1,4 @@
1
- var _excluded = ["type", "name", "required", "showOptional", "rules", "initialValue", "normalize", "mergeRules", "getValueFromEvent", "getValueProps", "extra", "help", "label", "extraLabel", "copyValue", "selectValue", "span", "halfRow", "fullRow", "valuePropName", "dependencies", "asserts", "messageVariables", "requiredMessage", "previewFormater", "disabled", "ignore", "shouldRender", "valueFormater"],
1
+ var _excluded = ["type", "name", "required", "showOptional", "rules", "initialValue", "normalize", "mergeRules", "getValueFromEvent", "getValueProps", "extra", "help", "label", "previewLabel", "extraLabel", "copyValue", "selectValue", "span", "halfRow", "fullRow", "valuePropName", "dependencies", "asserts", "messageVariables", "requiredMessage", "previewFormater", "disabled", "ignore", "shouldRender", "valueFormater"],
2
2
  _excluded2 = ["initialValue", "normalize", "rules", "extra", "help", "getValueFromEvent", "span", "valuePropName", "fullRow", "halfRow", "messageVariables", "requiredMessage", "previewFormater", "valueFormater", "required", "requiredMark", "className"];
3
3
 
4
4
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -111,6 +111,7 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
111
111
  extra = config.extra,
112
112
  help = config.help,
113
113
  label = config.label,
114
+ previewLabel = config.previewLabel,
114
115
  extraLabel = config.extraLabel,
115
116
  copyValue = config.copyValue,
116
117
  selectValue = config.selectValue,
@@ -169,6 +170,14 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
169
170
  rules.push.apply(rules, _toConsumableArray(extraRules));
170
171
  }
171
172
 
173
+ var validateTriggers = ['onChange'];
174
+ rules.forEach(function (_ref) {
175
+ var validateTrigger = _ref.validateTrigger;
176
+
177
+ if (validateTrigger) {
178
+ Array.isArray(validateTrigger) ? validateTriggers.push.apply(validateTriggers, _toConsumableArray(validateTrigger)) : validateTriggers.push(validateTrigger);
179
+ }
180
+ });
172
181
  var isRequired = required || rules.find(function (rule) {
173
182
  return rule.required;
174
183
  });
@@ -196,6 +205,7 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
196
205
  selectedValue: selectedValue,
197
206
  normalize: normalize || extraNormalize,
198
207
  rules: rules,
208
+ validateTrigger: _toConsumableArray(new Set(validateTriggers)),
199
209
  label: label ? _jsxs("div", Object.assign({
200
210
  className: "igloo-form-label"
201
211
  }, {
@@ -88,7 +88,7 @@ var Import = function Import(_ref) {
88
88
  customRequest: function customRequest() {},
89
89
  action: function action(file) {
90
90
  var dataSourceId = currentSource;
91
- setSource(undefined);
91
+ Array.isArray(dataSource) && setSource(undefined);
92
92
  return onUpload(file, dataSourceId);
93
93
  }
94
94
  }, {
@@ -139,6 +139,7 @@
139
139
  .igloo-admin-upload-dragger-switch {
140
140
  min-width: 224px;
141
141
  margin-top: 16px;
142
+ text-align: left;
142
143
  }
143
144
 
144
145
  .igloo-admin-upload-dargger-title {