iglooform 2.3.17 → 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.
- package/es/form/element/index.js +11 -7
- package/es/form/login/index.js +1 -1
- package/es/form/page/index.js +1 -1
- package/es/form/pages/index.js +1 -1
- package/es/form/section/index.d.ts +3 -0
- package/es/form/section/index.js +8 -3
- package/es/form/step/index.js +1 -1
- package/es/form/steps/index.js +1 -1
- package/es/free-form/element/index.js +7 -5
- package/es/free-form/page/index.js +1 -1
- package/es/select/attached-select.d.ts +1 -0
- package/es/select/attached-select.js +8 -1
- package/es/types.d.ts +1 -0
- package/es/{form/utils.d.ts → utils/form-utils.d.ts} +1 -0
- package/es/{form/utils.js → utils/form-utils.js} +11 -1
- package/lib/form/element/index.js +12 -8
- package/lib/form/login/index.js +2 -2
- package/lib/form/page/index.js +2 -2
- package/lib/form/pages/index.js +3 -3
- package/lib/form/section/index.d.ts +3 -0
- package/lib/form/section/index.js +10 -5
- package/lib/form/step/index.js +2 -2
- package/lib/form/steps/index.js +3 -3
- package/lib/free-form/element/index.js +8 -6
- package/lib/free-form/page/index.js +2 -2
- package/lib/select/attached-select.d.ts +1 -0
- package/lib/select/attached-select.js +8 -1
- package/lib/types.d.ts +1 -0
- package/lib/{form/utils.d.ts → utils/form-utils.d.ts} +1 -0
- package/lib/{form/utils.js → utils/form-utils.js} +11 -1
- package/package.json +1 -1
- package/es/free-form/utils.d.ts +0 -73
- package/es/free-form/utils.js +0 -370
- package/lib/free-form/utils.d.ts +0 -73
- package/lib/free-form/utils.js +0 -403
package/es/form/element/index.js
CHANGED
|
@@ -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 '
|
|
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
|
-
|
|
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,
|
package/es/form/login/index.js
CHANGED
|
@@ -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 '
|
|
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';
|
package/es/form/page/index.js
CHANGED
|
@@ -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 '
|
|
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';
|
package/es/form/pages/index.js
CHANGED
|
@@ -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 '
|
|
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;
|
package/es/form/section/index.js
CHANGED
|
@@ -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 '
|
|
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)
|
package/es/form/step/index.js
CHANGED
|
@@ -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 '
|
|
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;
|
package/es/form/steps/index.js
CHANGED
|
@@ -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 '
|
|
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';
|
|
@@ -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 '
|
|
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 '
|
|
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';
|
|
@@ -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
|
@@ -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
|
}, {
|
|
@@ -27,7 +27,7 @@ var _react = require("react");
|
|
|
27
27
|
|
|
28
28
|
var _icons = require("@ant-design/icons");
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _formUtils = require("../../utils/form-utils");
|
|
31
31
|
|
|
32
32
|
var _section = _interopRequireDefault(require("../section"));
|
|
33
33
|
|
|
@@ -80,7 +80,7 @@ var Element = function Element(_ref) {
|
|
|
80
80
|
setShowStepButton = _ref.setShowStepButton;
|
|
81
81
|
var type = config.type,
|
|
82
82
|
label = config.label,
|
|
83
|
-
|
|
83
|
+
previewLabel = config.previewLabel;
|
|
84
84
|
|
|
85
85
|
var _useContext = (0, _react.useContext)(_context.default),
|
|
86
86
|
form = _useContext.form,
|
|
@@ -100,7 +100,8 @@ var Element = function Element(_ref) {
|
|
|
100
100
|
copyValue = config.copyValue,
|
|
101
101
|
selectValue = config.selectValue,
|
|
102
102
|
shouldRender = config.shouldRender,
|
|
103
|
-
dependField = config.dependField
|
|
103
|
+
dependField = config.dependField,
|
|
104
|
+
getOptions = config.getOptions;
|
|
104
105
|
var dependentField = dependencies || [];
|
|
105
106
|
|
|
106
107
|
if (asserts && asserts.length) {
|
|
@@ -121,7 +122,7 @@ var Element = function Element(_ref) {
|
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
if (shouldRender) {
|
|
125
|
+
if (shouldRender || getOptions) {
|
|
125
126
|
dependentField.push('SUBSCRIBE_ALL');
|
|
126
127
|
}
|
|
127
128
|
|
|
@@ -144,11 +145,14 @@ var Element = function Element(_ref) {
|
|
|
144
145
|
if (type === 'Section') {
|
|
145
146
|
return (0, _jsxRuntime.jsx)(_section.default, {
|
|
146
147
|
parentName: parentName,
|
|
147
|
-
config: config
|
|
148
|
+
config: config,
|
|
149
|
+
preview: preview,
|
|
150
|
+
disabled: disabled,
|
|
151
|
+
setShowStepButton: setShowStepButton
|
|
148
152
|
}, void 0);
|
|
149
153
|
}
|
|
150
154
|
|
|
151
|
-
var _calcFormItemProps = (0,
|
|
155
|
+
var _calcFormItemProps = (0, _formUtils.calcFormItemProps)(config, _objectSpread(_objectSpread({}, extraConfig), {}, {
|
|
152
156
|
requiredMark: requiredMark
|
|
153
157
|
}), form, parentName),
|
|
154
158
|
colProps = _calcFormItemProps.colProps,
|
|
@@ -274,14 +278,14 @@ var Element = function Element(_ref) {
|
|
|
274
278
|
xs: 0
|
|
275
279
|
}
|
|
276
280
|
}, {
|
|
277
|
-
children: [label && (0, _jsxRuntime.jsx)(_col.default, Object.assign({
|
|
281
|
+
children: [(previewLabel || label) && (0, _jsxRuntime.jsx)(_col.default, Object.assign({
|
|
278
282
|
span: 12,
|
|
279
283
|
md: 12,
|
|
280
284
|
sm: 24,
|
|
281
285
|
xs: 24,
|
|
282
286
|
className: "igloo-element-preview-label"
|
|
283
287
|
}, {
|
|
284
|
-
children: label
|
|
288
|
+
children: previewLabel || label
|
|
285
289
|
}), void 0), (0, _jsxRuntime.jsxs)(_col.default, Object.assign({
|
|
286
290
|
span: label ? 12 : 24,
|
|
287
291
|
md: label ? 12 : 24,
|
package/lib/form/login/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var _react = require("react");
|
|
|
27
27
|
|
|
28
28
|
var _element = _interopRequireDefault(require("../element"));
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _formUtils = require("../../utils/form-utils");
|
|
31
31
|
|
|
32
32
|
var _context = _interopRequireDefault(require("../context"));
|
|
33
33
|
|
|
@@ -69,7 +69,7 @@ var Login = function Login(_ref) {
|
|
|
69
69
|
}, {
|
|
70
70
|
children: elements.map(function (child, index) {
|
|
71
71
|
return (0, _jsxRuntime.jsx)(_element.default, {
|
|
72
|
-
parentName: (0,
|
|
72
|
+
parentName: (0, _formUtils.calcNamePath)(parentName, name),
|
|
73
73
|
config: child
|
|
74
74
|
}, index);
|
|
75
75
|
})
|
package/lib/form/page/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var _button = _interopRequireDefault(require("../../button"));
|
|
|
25
25
|
|
|
26
26
|
var _element = _interopRequireDefault(require("../element"));
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _formUtils = require("../../utils/form-utils");
|
|
29
29
|
|
|
30
30
|
var _context = _interopRequireDefault(require("../context"));
|
|
31
31
|
|
|
@@ -97,7 +97,7 @@ var Page = function Page(_ref) {
|
|
|
97
97
|
children: elements.map(function (child, index) {
|
|
98
98
|
return (0, _jsxRuntime.jsx)(_element.default, {
|
|
99
99
|
config: child,
|
|
100
|
-
parentName: (0,
|
|
100
|
+
parentName: (0, _formUtils.calcNamePath)(parentName, name)
|
|
101
101
|
}, index);
|
|
102
102
|
})
|
|
103
103
|
}), void 0)
|
package/lib/form/pages/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var _button = _interopRequireDefault(require("../../button"));
|
|
|
21
21
|
|
|
22
22
|
var _page = _interopRequireDefault(require("../page"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _formUtils = require("../../utils/form-utils");
|
|
25
25
|
|
|
26
26
|
var _context2 = _interopRequireDefault(require("../context"));
|
|
27
27
|
|
|
@@ -116,7 +116,7 @@ var Pages = function Pages(_ref) {
|
|
|
116
116
|
case 0:
|
|
117
117
|
allFields = (form === null || form === void 0 ? void 0 : form.getFieldsError()) || [];
|
|
118
118
|
_renderElements$curre = renderElements[current], currentName = _renderElements$curre.name, handleNext = _renderElements$curre.handleNext;
|
|
119
|
-
namePath = (0,
|
|
119
|
+
namePath = (0, _formUtils.calcNamePath)(name, currentName);
|
|
120
120
|
fields = allFields === null || allFields === void 0 ? void 0 : (_allFields$filter = allFields.filter(function (_ref4) {
|
|
121
121
|
var name = _ref4.name;
|
|
122
122
|
return name.join().startsWith(namePath === null || namePath === void 0 ? void 0 : namePath.join());
|
|
@@ -215,7 +215,7 @@ var Pages = function Pages(_ref) {
|
|
|
215
215
|
}, {
|
|
216
216
|
children: (0, _jsxRuntime.jsx)(_page.default, {
|
|
217
217
|
config: child,
|
|
218
|
-
parentName: (0,
|
|
218
|
+
parentName: (0, _formUtils.calcNamePath)(parentName, name),
|
|
219
219
|
showFooter: false
|
|
220
220
|
}, void 0)
|
|
221
221
|
}), child.key);
|
|
@@ -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;
|
|
@@ -21,7 +21,7 @@ var _element = _interopRequireDefault(require("../element"));
|
|
|
21
21
|
|
|
22
22
|
var _context = _interopRequireDefault(require("../context"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _formUtils = require("../../utils/form-utils");
|
|
25
25
|
|
|
26
26
|
var _typography = _interopRequireDefault(require("../../typography"));
|
|
27
27
|
|
|
@@ -54,15 +54,18 @@ var Section = function Section(_ref) {
|
|
|
54
54
|
contentProps = _ref$config$contentPr === void 0 ? {} : _ref$config$contentPr,
|
|
55
55
|
_ref$config$style = _ref$config.style,
|
|
56
56
|
style = _ref$config$style === void 0 ? {} : _ref$config$style,
|
|
57
|
-
rest = _objectWithoutProperties(_ref$config, _excluded)
|
|
57
|
+
rest = _objectWithoutProperties(_ref$config, _excluded),
|
|
58
|
+
preview = _ref.preview,
|
|
59
|
+
disabled = _ref.disabled,
|
|
60
|
+
setShowStepButton = _ref.setShowStepButton;
|
|
58
61
|
|
|
59
62
|
var _useContext = (0, _react.useContext)(_context.default),
|
|
60
63
|
form = _useContext.form,
|
|
61
64
|
requiredMark = _useContext.requiredMark;
|
|
62
65
|
|
|
63
|
-
var namePath = (0,
|
|
66
|
+
var namePath = (0, _formUtils.calcNamePath)(parentName, name);
|
|
64
67
|
|
|
65
|
-
var _calcFormItemProps = (0,
|
|
68
|
+
var _calcFormItemProps = (0, _formUtils.calcFormItemProps)(rest, {
|
|
66
69
|
requiredMark: requiredMark
|
|
67
70
|
}, form, parentName),
|
|
68
71
|
formItemProps = _calcFormItemProps.formItemProps,
|
|
@@ -103,7 +106,9 @@ var Section = function Section(_ref) {
|
|
|
103
106
|
return (0, _jsxRuntime.jsx)(_element.default, {
|
|
104
107
|
parentName: namePath,
|
|
105
108
|
config: child,
|
|
106
|
-
disabled: elementProps.disabled
|
|
109
|
+
disabled: elementProps.disabled || disabled,
|
|
110
|
+
preview: preview,
|
|
111
|
+
setShowStepButton: setShowStepButton
|
|
107
112
|
}, index);
|
|
108
113
|
})
|
|
109
114
|
}), void 0)
|
package/lib/form/step/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var _button = _interopRequireDefault(require("../../button"));
|
|
|
31
31
|
|
|
32
32
|
var _element = _interopRequireDefault(require("../element"));
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _formUtils = require("../../utils/form-utils");
|
|
35
35
|
|
|
36
36
|
var _context = _interopRequireDefault(require("../context"));
|
|
37
37
|
|
|
@@ -160,7 +160,7 @@ var Step = function Step(_ref) {
|
|
|
160
160
|
children: elements.map(function (child, index) {
|
|
161
161
|
return (0, _jsxRuntime.jsx)(_element.default, {
|
|
162
162
|
config: child,
|
|
163
|
-
parentName: (0,
|
|
163
|
+
parentName: (0, _formUtils.calcNamePath)(parentName, name),
|
|
164
164
|
setShowStepButton: setShowButton,
|
|
165
165
|
preview: preview
|
|
166
166
|
}, index);
|
package/lib/form/steps/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var _react = require("react");
|
|
|
11
11
|
|
|
12
12
|
var _step = _interopRequireDefault(require("../step"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _formUtils = require("../../utils/form-utils");
|
|
15
15
|
|
|
16
16
|
var _context2 = _interopRequireDefault(require("../context"));
|
|
17
17
|
|
|
@@ -100,7 +100,7 @@ var Steps = function Steps(_ref) {
|
|
|
100
100
|
case 0:
|
|
101
101
|
allFields = (form === null || form === void 0 ? void 0 : form.getFieldsError()) || [];
|
|
102
102
|
_renderElements$curre = renderElements[current], currentName = _renderElements$curre.name, handleNext = _renderElements$curre.handleNext;
|
|
103
|
-
namePath = (0,
|
|
103
|
+
namePath = (0, _formUtils.calcNamePath)(name, currentName);
|
|
104
104
|
fields = allFields === null || allFields === void 0 ? void 0 : (_allFields$filter = allFields.filter(function (_ref4) {
|
|
105
105
|
var name = _ref4.name;
|
|
106
106
|
return name.join().startsWith(namePath === null || namePath === void 0 ? void 0 : namePath.join());
|
|
@@ -185,7 +185,7 @@ var Steps = function Steps(_ref) {
|
|
|
185
185
|
(0, _invariant.default)(child.type === 'Step', 'Child of steps should be Step');
|
|
186
186
|
return (0, _jsxRuntime.jsx)(_step.default, {
|
|
187
187
|
config: child,
|
|
188
|
-
parentName: (0,
|
|
188
|
+
parentName: (0, _formUtils.calcNamePath)(parentName, name),
|
|
189
189
|
index: index,
|
|
190
190
|
total: renderElements.length,
|
|
191
191
|
preview: current > index,
|
|
@@ -27,7 +27,7 @@ var _react = require("react");
|
|
|
27
27
|
|
|
28
28
|
var _icons = require("@ant-design/icons");
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _formUtils = require("../../utils/form-utils");
|
|
31
31
|
|
|
32
32
|
var _context = _interopRequireDefault(require("../context"));
|
|
33
33
|
|
|
@@ -68,6 +68,7 @@ var useBreakpoint = _grid.default.useBreakpoint;
|
|
|
68
68
|
var Element = function Element(props) {
|
|
69
69
|
var parentName = props.parentName,
|
|
70
70
|
label = props.label,
|
|
71
|
+
previewLabel = props.previewLabel,
|
|
71
72
|
preview = props.preview,
|
|
72
73
|
disabled = props.disabled,
|
|
73
74
|
children = props.children;
|
|
@@ -90,7 +91,8 @@ var Element = function Element(props) {
|
|
|
90
91
|
copyValue = props.copyValue,
|
|
91
92
|
selectValue = props.selectValue,
|
|
92
93
|
shouldRender = props.shouldRender,
|
|
93
|
-
dependField = props.dependField
|
|
94
|
+
dependField = props.dependField,
|
|
95
|
+
getOptions = props.getOptions;
|
|
94
96
|
var dependentField = dependencies || [];
|
|
95
97
|
|
|
96
98
|
if (asserts && asserts.length) {
|
|
@@ -111,7 +113,7 @@ var Element = function Element(props) {
|
|
|
111
113
|
});
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
if (shouldRender) {
|
|
116
|
+
if (shouldRender || getOptions) {
|
|
115
117
|
dependentField.push('SUBSCRIBE_ALL');
|
|
116
118
|
}
|
|
117
119
|
|
|
@@ -130,7 +132,7 @@ var Element = function Element(props) {
|
|
|
130
132
|
children === null || children === void 0 ? void 0 : (_children$type2 = children.type) === null || _children$type2 === void 0 ? void 0 : _children$type2.formItemPropsHandler(props) : {};
|
|
131
133
|
}, [children]);
|
|
132
134
|
|
|
133
|
-
var _calcFormItemProps = (0,
|
|
135
|
+
var _calcFormItemProps = (0, _formUtils.calcFormItemProps)((0, _omit.default)(props, ['children', 'parentName']), _objectSpread(_objectSpread({}, extraConfig), {}, {
|
|
134
136
|
requiredMark: requiredMark
|
|
135
137
|
}), form, parentName),
|
|
136
138
|
colProps = _calcFormItemProps.colProps,
|
|
@@ -240,14 +242,14 @@ var Element = function Element(props) {
|
|
|
240
242
|
xs: 0
|
|
241
243
|
}
|
|
242
244
|
}, {
|
|
243
|
-
children: [label && (0, _jsxRuntime.jsx)(_col.default, Object.assign({
|
|
245
|
+
children: [(previewLabel || label) && (0, _jsxRuntime.jsx)(_col.default, Object.assign({
|
|
244
246
|
span: 12,
|
|
245
247
|
md: 12,
|
|
246
248
|
sm: 24,
|
|
247
249
|
xs: 24,
|
|
248
250
|
className: "igloo-element-preview-label"
|
|
249
251
|
}, {
|
|
250
|
-
children: label
|
|
252
|
+
children: previewLabel || label
|
|
251
253
|
}), void 0), (0, _jsxRuntime.jsxs)(_col.default, Object.assign({
|
|
252
254
|
span: label ? 12 : 24,
|
|
253
255
|
md: label ? 12 : 24,
|
|
@@ -19,7 +19,7 @@ var _react = require("react");
|
|
|
19
19
|
|
|
20
20
|
var _button = _interopRequireDefault(require("../../button"));
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _formUtils = require("../../utils/form-utils");
|
|
23
23
|
|
|
24
24
|
var _context = _interopRequireDefault(require("../context"));
|
|
25
25
|
|
|
@@ -73,7 +73,7 @@ var Page = function Page(_ref) {
|
|
|
73
73
|
formatMessage = _useContext2.formatMessage;
|
|
74
74
|
|
|
75
75
|
var pName = (0, _react.useMemo)(function () {
|
|
76
|
-
return (0,
|
|
76
|
+
return (0, _formUtils.calcNamePath)(parentName, name);
|
|
77
77
|
}, [parentName, name]);
|
|
78
78
|
|
|
79
79
|
var _useReducer = (0, _react.useReducer)(function (r) {
|
|
@@ -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;
|