iglooform 2.4.7 → 2.4.11
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/admin-upload/float.js +25 -35
- package/es/admin-upload/index.d.ts +2 -0
- package/es/admin-upload/index.js +43 -36
- package/es/admin-upload/job-list.js +85 -115
- package/es/admin-upload/modal.js +19 -26
- package/es/alert-message/index.js +11 -9
- package/es/amount/index.js +10 -5
- package/es/back-top/index.js +14 -10
- package/es/button/index.js +23 -28
- package/es/button/style/index.less +23 -19
- package/es/card-detail/card-group.js +16 -22
- package/es/card-detail/card-item.js +16 -21
- package/es/card-detail/card-page.js +11 -15
- package/es/card-detail/card.js +24 -24
- package/es/card-detail/style/index.less +13 -0
- package/es/card-detail/utils.js +6 -7
- package/es/checkbox/index.js +23 -22
- package/es/claim-list/index.js +53 -70
- package/es/confirmation/index.js +7 -9
- package/es/date-picker/buddhist.js +3 -3
- package/es/date-picker/index.js +10 -4
- package/es/declaration/index.js +16 -13
- package/es/detail-panel/index.js +67 -83
- package/es/documents/index.js +6 -8
- package/es/example/index.js +9 -11
- package/es/filter/checkBox.js +33 -45
- package/es/filter/customize.js +3 -4
- package/es/filter/index.d.ts +1 -0
- package/es/filter/index.js +88 -112
- package/es/filter/radioBox.js +23 -31
- package/es/filter/rangePicker.js +43 -59
- package/es/form/addable-section/index.d.ts +19 -0
- package/es/form/addable-section/index.js +211 -0
- package/es/form/addable-section/style/index.d.ts +1 -0
- package/es/form/addable-section/style/index.js +1 -0
- package/es/form/addable-section/style/index.less +22 -0
- package/es/form/divider/index.js +7 -1
- package/es/form/element/index.js +58 -47
- package/es/form/element/style/index.less +9 -0
- package/es/form/index.js +16 -17
- package/es/form/login/index.js +15 -20
- package/es/form/page/index.js +18 -24
- package/es/form/page/style/index.less +1 -1
- package/es/form/pages/index.js +23 -32
- package/es/form/pages/style/index.less +3 -1
- package/es/form/render/index.js +1 -1
- package/es/form/section/index.js +14 -17
- package/es/form/step/index.js +31 -42
- package/es/form/steps/index.js +8 -11
- package/es/{form/context.d.ts → form-context.d.ts} +1 -0
- package/es/{form/context.js → form-context.js} +0 -0
- package/es/free-form/addable-section/index.d.ts +18 -0
- package/es/free-form/addable-section/index.js +286 -0
- package/es/free-form/addable-section/style/index.d.ts +1 -0
- package/es/free-form/addable-section/style/index.js +1 -0
- package/es/free-form/addable-section/style/index.less +22 -0
- package/es/free-form/element/index.js +43 -41
- package/es/free-form/element/style/index.less +12 -2
- package/es/free-form/index.d.ts +5 -1
- package/es/free-form/index.js +17 -17
- package/es/free-form/page/index.js +36 -46
- package/es/free-form/page/style/index.less +3 -1
- package/es/free-form/pages/index.js +8 -10
- package/es/free-form/section/index.js +20 -22
- package/es/free-form/section/style/index.less +4 -0
- package/es/free-form/step/index.js +37 -47
- package/es/free-form/steps/index.js +8 -10
- package/es/global-message/index.js +1 -1
- package/es/home-menu/index.js +52 -71
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/input/amount.js +10 -5
- package/es/input/credit-card.js +7 -1
- package/es/input/email.js +8 -1
- package/es/input/expiry-date.js +14 -18
- package/es/input/input-date.js +12 -16
- package/es/input/input-number.js +9 -2
- package/es/input/input.js +9 -2
- package/es/input/otp.js +17 -15
- package/es/input/password.js +12 -6
- package/es/input/phone-number.js +6 -8
- package/es/input/style/index.less +9 -1
- package/es/input/text-area.js +14 -10
- package/es/layout/defaultFooter.js +60 -82
- package/es/layout/defaultHeader.js +11 -15
- package/es/layout/footer.js +108 -148
- package/es/layout/header.js +51 -60
- package/es/layout/index.js +16 -12
- package/es/locale/en-US/messages.json +2 -0
- package/es/locale/id-ID/messages.json +2 -0
- package/es/locale/locale-provider.js +8 -10
- package/es/locale/th-TH/messages.json +2 -0
- package/es/locale/vi-VN/messages.json +2 -0
- package/es/locale/zh-CN/messages.json +2 -0
- package/es/login-page/index.js +30 -42
- package/es/media/index.js +20 -27
- package/es/media/media.js +9 -12
- package/es/media/preview.js +8 -10
- package/es/mobile-insurer-detail/index.js +74 -91
- package/es/mobile-insurer-list/index.js +34 -38
- package/es/modal/index.d.ts +4 -3
- package/es/modal/index.js +25 -27
- package/es/modal/style/index.less +24 -5
- package/es/platform/platform-card/index.js +9 -12
- package/es/platform/switch-platform/index.js +24 -32
- package/es/policy-list/index.js +11 -14
- package/es/policy-list/policy-card.js +119 -153
- package/es/radio/index.js +33 -35
- package/es/select/attached-select.js +31 -34
- package/es/select/select.js +12 -8
- package/es/select/style/index.less +1 -1
- package/es/select/time-select.js +12 -16
- package/es/status-box/index.js +8 -10
- package/es/table/index.js +72 -96
- package/es/tabs/index.js +7 -1
- package/es/types.d.ts +4 -2
- package/es/typography/index.js +6 -8
- package/es/upload/index.d.ts +2 -1
- package/es/upload/index.js +169 -143
- package/es/upload-photo/index.d.ts +2 -1
- package/es/upload-photo/index.js +170 -142
- package/es/upload-photo/media.js +3 -4
- package/es/upload-preview/index.js +9 -12
- package/es/upload-preview/media.js +12 -16
- package/es/upload-preview/style/index.less +2 -2
- package/es/utils/form-utils.js +49 -36
- package/lib/admin-upload/float.js +25 -35
- package/lib/admin-upload/index.d.ts +2 -0
- package/lib/admin-upload/index.js +43 -36
- package/lib/admin-upload/job-list.js +85 -115
- package/lib/admin-upload/modal.js +19 -26
- package/lib/alert-message/index.js +11 -9
- package/lib/amount/index.js +10 -5
- package/lib/back-top/index.js +14 -10
- package/lib/button/index.js +24 -29
- package/lib/button/style/index.less +23 -19
- package/lib/card-detail/card-group.js +16 -22
- package/lib/card-detail/card-item.js +16 -21
- package/lib/card-detail/card-page.js +11 -15
- package/lib/card-detail/card.js +24 -24
- package/lib/card-detail/index.js +6 -6
- package/lib/card-detail/style/index.less +13 -0
- package/lib/card-detail/utils.js +7 -8
- package/lib/checkbox/index.js +24 -23
- package/lib/claim-list/index.js +53 -70
- package/lib/confirmation/index.js +7 -9
- package/lib/date-picker/buddhist.js +3 -3
- package/lib/date-picker/index.js +11 -5
- package/lib/declaration/index.js +16 -13
- package/lib/detail-panel/index.js +67 -83
- package/lib/documents/index.js +6 -8
- package/lib/example/index.js +10 -12
- package/lib/filter/checkBox.js +33 -45
- package/lib/filter/customize.js +3 -4
- package/lib/filter/index.d.ts +1 -0
- package/lib/filter/index.js +88 -112
- package/lib/filter/radioBox.js +23 -31
- package/lib/filter/rangePicker.js +43 -59
- package/lib/form/addable-section/index.d.ts +19 -0
- package/lib/form/addable-section/index.js +232 -0
- package/lib/form/addable-section/style/index.d.ts +1 -0
- package/lib/form/addable-section/style/index.js +3 -0
- package/lib/form/addable-section/style/index.less +22 -0
- package/lib/form/divider/index.js +7 -1
- package/lib/form/element/index.js +60 -48
- package/lib/form/element/style/index.less +9 -0
- package/lib/form/elements.js +1 -1
- package/lib/form/index.js +16 -17
- package/lib/form/login/index.js +16 -21
- package/lib/form/page/index.js +19 -25
- package/lib/form/page/style/index.less +1 -1
- package/lib/form/pages/index.js +24 -33
- package/lib/form/pages/style/index.less +3 -1
- package/lib/form/render/index.js +2 -2
- package/lib/form/section/index.js +15 -18
- package/lib/form/step/index.js +32 -43
- package/lib/form/steps/index.js +9 -12
- package/lib/{form/context.d.ts → form-context.d.ts} +1 -0
- package/lib/{form/context.js → form-context.js} +0 -0
- package/lib/free-form/addable-section/index.d.ts +18 -0
- package/lib/free-form/addable-section/index.js +306 -0
- package/lib/free-form/addable-section/style/index.d.ts +1 -0
- package/lib/free-form/addable-section/style/index.js +3 -0
- package/lib/free-form/addable-section/style/index.less +22 -0
- package/lib/free-form/element/index.js +44 -42
- package/lib/free-form/element/style/index.less +12 -2
- package/lib/free-form/index.d.ts +5 -1
- package/lib/free-form/index.js +17 -17
- package/lib/free-form/page/index.js +37 -47
- package/lib/free-form/page/style/index.less +3 -1
- package/lib/free-form/pages/index.js +8 -10
- package/lib/free-form/section/index.js +21 -23
- package/lib/free-form/section/style/index.less +4 -0
- package/lib/free-form/step/index.js +38 -48
- package/lib/free-form/steps/index.js +9 -11
- package/lib/global-message/index.js +1 -1
- package/lib/home-menu/index.js +52 -71
- package/lib/index.d.ts +1 -0
- package/lib/index.js +141 -132
- package/lib/input/amount.js +10 -5
- package/lib/input/credit-card.js +7 -1
- package/lib/input/email.js +7 -1
- package/lib/input/expiry-date.js +14 -18
- package/lib/input/index.js +18 -18
- package/lib/input/input-date.js +12 -16
- package/lib/input/input-number.js +8 -2
- package/lib/input/input.js +8 -2
- package/lib/input/otp.js +17 -15
- package/lib/input/password.js +11 -6
- package/lib/input/phone-number.js +6 -8
- package/lib/input/style/index.less +9 -1
- package/lib/input/text-area.js +14 -10
- package/lib/layout/defaultFooter.js +60 -82
- package/lib/layout/defaultHeader.js +11 -15
- package/lib/layout/footer.js +108 -148
- package/lib/layout/header.js +51 -60
- package/lib/layout/index.js +15 -12
- package/lib/locale/en-US/messages.json +2 -0
- package/lib/locale/format-message.js +1 -1
- package/lib/locale/id-ID/messages.json +2 -0
- package/lib/locale/index.js +4 -4
- package/lib/locale/locale-provider.js +9 -11
- package/lib/locale/th-TH/messages.json +2 -0
- package/lib/locale/vi-VN/messages.json +2 -0
- package/lib/locale/zh-CN/messages.json +2 -0
- package/lib/login-page/index.js +30 -42
- package/lib/media/index.js +20 -27
- package/lib/media/media.js +9 -12
- package/lib/media/preview.js +8 -10
- package/lib/mobile-insurer-detail/index.js +74 -91
- package/lib/mobile-insurer-list/index.js +34 -38
- package/lib/modal/index.d.ts +4 -3
- package/lib/modal/index.js +25 -27
- package/lib/modal/style/index.less +24 -5
- package/lib/platform/platform-card/index.js +9 -12
- package/lib/platform/switch-platform/index.js +24 -32
- package/lib/policy-list/index.js +11 -14
- package/lib/policy-list/policy-card.js +119 -153
- package/lib/radio/index.js +33 -35
- package/lib/select/attached-select.js +32 -35
- package/lib/select/select.js +13 -9
- package/lib/select/style/index.less +1 -1
- package/lib/select/time-select.js +12 -16
- package/lib/status-box/index.js +8 -10
- package/lib/table/index.js +72 -96
- package/lib/tabs/index.js +8 -2
- package/lib/types.d.ts +4 -2
- package/lib/typography/index.js +6 -8
- package/lib/upload/index.d.ts +2 -1
- package/lib/upload/index.js +170 -143
- package/lib/upload-photo/index.d.ts +2 -1
- package/lib/upload-photo/index.js +171 -142
- package/lib/upload-photo/media.js +3 -4
- package/lib/upload-preview/index.js +9 -12
- package/lib/upload-preview/media.js +12 -16
- package/lib/upload-preview/style/index.less +2 -2
- package/lib/utils/form-utils.js +49 -37
- package/package.json +1 -1
- package/es/free-form/context.d.ts +0 -19
- package/es/free-form/context.js +0 -7
- package/lib/free-form/context.d.ts +0 -19
- package/lib/free-form/context.js +0 -19
|
@@ -6,16 +6,16 @@ import "antd/es/col/style";
|
|
|
6
6
|
import _Col from "antd/es/col";
|
|
7
7
|
import "antd/es/grid/style";
|
|
8
8
|
import _Grid from "antd/es/grid";
|
|
9
|
-
var _excluded = ["parentName", "preview", "
|
|
9
|
+
var _excluded = ["parentName", "preview", "disabledFromParent", "children"],
|
|
10
10
|
_excluded2 = ["halfRow"];
|
|
11
11
|
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
12
|
+
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
13
|
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
14
|
+
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; }
|
|
15
15
|
|
|
16
16
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
17
|
|
|
18
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
18
|
+
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); }
|
|
19
19
|
|
|
20
20
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
21
|
|
|
@@ -43,9 +43,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
43
43
|
|
|
44
44
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
45
45
|
import { useContext, useEffect, useRef, useReducer, isValidElement, cloneElement, useMemo } from 'react';
|
|
46
|
-
import {
|
|
46
|
+
import { AlertFilled } from 'iglooicon';
|
|
47
47
|
import { calcFormItemProps } from '../../utils/form-utils';
|
|
48
|
-
import FormContext from '
|
|
48
|
+
import FormContext from '../../form-context';
|
|
49
49
|
import omit from 'omit.js';
|
|
50
50
|
import classNames from 'classnames';
|
|
51
51
|
import './style/index.less';
|
|
@@ -55,7 +55,6 @@ var useBreakpoint = _Grid.useBreakpoint;
|
|
|
55
55
|
var Element = function Element(props) {
|
|
56
56
|
var parentName = props.parentName,
|
|
57
57
|
preview = props.preview,
|
|
58
|
-
disabled = props.disabled,
|
|
59
58
|
disabledFromParent = props.disabledFromParent,
|
|
60
59
|
children = props.children,
|
|
61
60
|
rest = _objectWithoutProperties(props, _excluded);
|
|
@@ -83,7 +82,9 @@ var Element = function Element(props) {
|
|
|
83
82
|
dependField = props.dependField,
|
|
84
83
|
getOptions = props.getOptions,
|
|
85
84
|
subscribedFields = props.subscribedFields,
|
|
86
|
-
extraLabel = props.extraLabel
|
|
85
|
+
extraLabel = props.extraLabel,
|
|
86
|
+
disabled = props.disabled,
|
|
87
|
+
requiredAsserts = props.requiredAsserts;
|
|
87
88
|
var dependentField = dependencies || [];
|
|
88
89
|
|
|
89
90
|
if (Array.isArray(subscribedFields)) {
|
|
@@ -97,13 +98,20 @@ var Element = function Element(props) {
|
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
if (requiredAsserts && requiredAsserts.length) {
|
|
102
|
+
requiredAsserts.forEach(function (_ref2) {
|
|
103
|
+
var field = _ref2.field;
|
|
104
|
+
return dependentField.push(field);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
100
108
|
if (copyValue) {
|
|
101
109
|
dependentField.push(copyValue.assert.field);
|
|
102
110
|
}
|
|
103
111
|
|
|
104
112
|
if (selectValue && selectValue.length) {
|
|
105
|
-
selectValue.forEach(function (
|
|
106
|
-
var assert =
|
|
113
|
+
selectValue.forEach(function (_ref3) {
|
|
114
|
+
var assert = _ref3.assert;
|
|
107
115
|
return dependentField.push(assert.field);
|
|
108
116
|
});
|
|
109
117
|
}
|
|
@@ -117,8 +125,8 @@ var Element = function Element(props) {
|
|
|
117
125
|
}
|
|
118
126
|
|
|
119
127
|
if (Array.isArray(disabled)) {
|
|
120
|
-
disabled.forEach(function (
|
|
121
|
-
var field =
|
|
128
|
+
disabled.forEach(function (_ref4) {
|
|
129
|
+
var field = _ref4.field;
|
|
122
130
|
return dependentField.push(field);
|
|
123
131
|
});
|
|
124
132
|
} else if (_typeof(disabled) === 'object') {
|
|
@@ -206,7 +214,7 @@ var Element = function Element(props) {
|
|
|
206
214
|
var transformChildren = function transformChildren() {
|
|
207
215
|
if (! /*#__PURE__*/isValidElement(children)) return children;
|
|
208
216
|
return /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), elementProps), {}, {
|
|
209
|
-
disabled: elementProps.disabled || disabledFromParent,
|
|
217
|
+
disabled: children.props.disabled || elementProps.disabled || disabledFromParent,
|
|
210
218
|
containerRef: ref,
|
|
211
219
|
setFieldError: setFieldError,
|
|
212
220
|
setFieldValue: setFieldValue,
|
|
@@ -218,75 +226,69 @@ var Element = function Element(props) {
|
|
|
218
226
|
if (!display) return null;
|
|
219
227
|
|
|
220
228
|
if (preview) {
|
|
221
|
-
return _jsx(_Col,
|
|
229
|
+
return _jsx(_Col, {
|
|
222
230
|
span: 24,
|
|
223
231
|
className: classNames('igloo-freeform-element-preview', {
|
|
224
232
|
'igloo-freeform-element-preview-hide': props.hideWhenPreview,
|
|
225
233
|
'igloo-freeform-element-preview-hide-divider': props.hidePreviewDivider
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
children: _jsx(_Form.Item, Object.assign({}, omit(formItemProps, ['copiedValue', 'selectedValue']), {
|
|
234
|
+
}),
|
|
235
|
+
children: _jsx(_Form.Item, _objectSpread(_objectSpread({}, omit(formItemProps, ['copiedValue', 'selectedValue'])), {}, {
|
|
229
236
|
labelCol: {
|
|
230
237
|
span: 24
|
|
231
238
|
},
|
|
232
239
|
wrapperCol: {
|
|
233
240
|
span: 24
|
|
234
241
|
},
|
|
235
|
-
label: null
|
|
236
|
-
|
|
237
|
-
children: _jsxs(_Row, Object.assign({
|
|
242
|
+
label: null,
|
|
243
|
+
children: _jsxs(_Row, {
|
|
238
244
|
className: "igloo-freeform-element-preview-item",
|
|
239
245
|
gutter: {
|
|
240
246
|
md: 32,
|
|
241
247
|
sm: 0,
|
|
242
248
|
xs: 0
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
children: [(rest.previewLabel || rest.label) && _jsx(_Col, Object.assign({
|
|
249
|
+
},
|
|
250
|
+
children: [(rest.previewLabel || rest.label) && _jsx(_Col, {
|
|
246
251
|
span: 12,
|
|
247
252
|
md: 12,
|
|
248
253
|
sm: 24,
|
|
249
254
|
xs: 24,
|
|
250
|
-
className: "igloo-freeform-element-preview-label"
|
|
251
|
-
}, {
|
|
255
|
+
className: "igloo-freeform-element-preview-label",
|
|
252
256
|
children: rest.previewLabel || rest.label
|
|
253
|
-
}
|
|
257
|
+
}, void 0), _jsxs(_Col, {
|
|
254
258
|
span: rest.previewLabel || rest.label ? 12 : 24,
|
|
255
259
|
md: rest.previewLabel || rest.label ? 12 : 24,
|
|
256
260
|
sm: 24,
|
|
257
261
|
xs: 24,
|
|
258
|
-
className: "igloo-freeform-element-preview-value"
|
|
259
|
-
|
|
260
|
-
children: [error && !!error.length && _jsx(CloseCircleFilled, {
|
|
262
|
+
className: "igloo-freeform-element-preview-value",
|
|
263
|
+
children: [error && !!error.length && _jsx(AlertFilled, {
|
|
261
264
|
className: "igloo-freeform-element-preview-value-icon"
|
|
262
265
|
}, void 0), previewFormater ? previewFormater(value, form) : value || '-']
|
|
263
|
-
}
|
|
264
|
-
}
|
|
266
|
+
}, void 0)]
|
|
267
|
+
}, void 0)
|
|
265
268
|
}), void 0)
|
|
266
|
-
}
|
|
269
|
+
}, void 0);
|
|
267
270
|
}
|
|
268
271
|
|
|
269
|
-
return props.hideWhenEdit ? null : _jsx(_Col,
|
|
270
|
-
className: "igloo-freeform-item"
|
|
271
|
-
|
|
272
|
-
children: _jsx("div", Object.assign({
|
|
272
|
+
return props.hideWhenEdit ? null : _jsx(_Col, _objectSpread(_objectSpread({}, restColProps), {}, {
|
|
273
|
+
className: "igloo-freeform-item",
|
|
274
|
+
children: _jsx("div", {
|
|
273
275
|
ref: ref,
|
|
274
276
|
style: {
|
|
275
277
|
width: halfRow && md ? '50%' : '100%',
|
|
276
278
|
paddingRight: halfRow && md ? 16 : 0
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
children: _jsx(_Form.Item, Object.assign({
|
|
279
|
+
},
|
|
280
|
+
children: _jsx(_Form.Item, _objectSpread(_objectSpread({
|
|
280
281
|
labelCol: {
|
|
281
282
|
span: 24
|
|
282
283
|
},
|
|
283
284
|
wrapperCol: {
|
|
284
285
|
span: 24
|
|
285
286
|
}
|
|
286
|
-
}, omit(formItemProps, ['copiedValue', 'selectedValue']), {
|
|
287
|
+
}, omit(formItemProps, ['copiedValue', 'selectedValue'])), {}, {
|
|
288
|
+
className: "igloo-freeform-element-edit",
|
|
287
289
|
children: transformChildren()
|
|
288
290
|
}), void 0)
|
|
289
|
-
}
|
|
291
|
+
}, void 0)
|
|
290
292
|
}), void 0);
|
|
291
293
|
};
|
|
292
294
|
|
|
@@ -20,12 +20,17 @@
|
|
|
20
20
|
white-space: pre-wrap;
|
|
21
21
|
word-break: break-word;
|
|
22
22
|
line-height: 24px;
|
|
23
|
+
|
|
24
|
+
.igloo-freeform-element-preview-value-icon {
|
|
25
|
+
color: @error-color;
|
|
26
|
+
margin-right: 8px;
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
.ant-form-item-explain-error {
|
|
27
32
|
margin-top: 0;
|
|
28
|
-
margin-left: 50
|
|
33
|
+
margin-left: calc(~'50%' + 16px);
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
.ant-form-item-extra,
|
|
@@ -33,7 +38,8 @@
|
|
|
33
38
|
display: none;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
.ant-form-item-explain-error
|
|
41
|
+
.ant-form-item-explain-error,
|
|
42
|
+
.ant-form-item-explain-connected {
|
|
37
43
|
display: block;
|
|
38
44
|
}
|
|
39
45
|
}
|
|
@@ -71,6 +77,10 @@
|
|
|
71
77
|
}
|
|
72
78
|
}
|
|
73
79
|
|
|
80
|
+
.igloo-freeform-element-edit {
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
}
|
|
83
|
+
|
|
74
84
|
.ant-form-item-control-input {
|
|
75
85
|
min-height: unset;
|
|
76
86
|
}
|
package/es/free-form/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { Form } from 'antd';
|
|
2
3
|
import { FormBasicConfig } from '../types';
|
|
3
4
|
import './style/index.less';
|
|
4
5
|
interface FreeFormProps extends Omit<FormBasicConfig, 'config'> {
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
+
interface FreeFormType extends FC<FreeFormProps> {
|
|
8
|
+
useForm: typeof Form.useForm;
|
|
9
|
+
}
|
|
10
|
+
declare const FreeForm: FreeFormType;
|
|
7
11
|
export default FreeForm;
|
package/es/free-form/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import "antd/es/form/style";
|
|
|
2
2
|
import _Form from "antd/es/form";
|
|
3
3
|
var _excluded = ["validateMessages"];
|
|
4
4
|
|
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
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; }
|
|
6
6
|
|
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
7
|
+
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; }
|
|
8
8
|
|
|
9
9
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
10
|
|
|
@@ -30,7 +30,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
30
30
|
|
|
31
31
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
32
32
|
import { useState } from 'react';
|
|
33
|
-
import FormContext from '
|
|
33
|
+
import FormContext from '../form-context';
|
|
34
34
|
import messages from './messages';
|
|
35
35
|
import './style/index.less';
|
|
36
36
|
import classNames from 'classnames';
|
|
@@ -54,7 +54,8 @@ var FreeForm = function FreeForm(props) {
|
|
|
54
54
|
return window;
|
|
55
55
|
} : _props$getScrollConta,
|
|
56
56
|
_props$onFirstModifie = props.onFirstModified,
|
|
57
|
-
onFirstModified = _props$onFirstModifie === void 0 ? function () {} : _props$onFirstModifie
|
|
57
|
+
onFirstModified = _props$onFirstModifie === void 0 ? function () {} : _props$onFirstModifie,
|
|
58
|
+
uploadApi = props.uploadApi;
|
|
58
59
|
|
|
59
60
|
var _Form$useForm = _Form.useForm(),
|
|
60
61
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
@@ -181,13 +182,12 @@ var FreeForm = function FreeForm(props) {
|
|
|
181
182
|
}
|
|
182
183
|
};
|
|
183
184
|
|
|
184
|
-
return _jsx("div",
|
|
185
|
+
return _jsx("div", {
|
|
185
186
|
className: classNames(className, {
|
|
186
187
|
'igloo-freeform-without-button': !showSubmitButton
|
|
187
188
|
}),
|
|
188
|
-
style: style
|
|
189
|
-
|
|
190
|
-
children: _jsx(FormContext.Provider, Object.assign({
|
|
189
|
+
style: style,
|
|
190
|
+
children: _jsx(FormContext.Provider, {
|
|
191
191
|
value: _objectSpread({
|
|
192
192
|
form: form,
|
|
193
193
|
onCancel: onCancel,
|
|
@@ -195,22 +195,22 @@ var FreeForm = function FreeForm(props) {
|
|
|
195
195
|
requiredMark: requiredMark,
|
|
196
196
|
showSubmitButton: showSubmitButton,
|
|
197
197
|
getScrollContainer: getScrollContainer,
|
|
198
|
-
registerDependencies: registerDependencies
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
children: _jsx(_Form,
|
|
198
|
+
registerDependencies: registerDependencies,
|
|
199
|
+
uploadApi: uploadApi
|
|
200
|
+
}, locales),
|
|
201
|
+
children: _jsx(_Form, {
|
|
202
202
|
form: form,
|
|
203
203
|
onFinish: handleSubmit,
|
|
204
204
|
onFieldsChange: handleValuesChange,
|
|
205
205
|
colon: false,
|
|
206
206
|
validateMessages: validateMessages || messages,
|
|
207
207
|
initialValues: initialValues,
|
|
208
|
-
scrollToFirstError: true
|
|
209
|
-
}, {
|
|
208
|
+
scrollToFirstError: true,
|
|
210
209
|
children: children
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
210
|
+
}, void 0)
|
|
211
|
+
}, void 0)
|
|
212
|
+
}, void 0);
|
|
214
213
|
};
|
|
215
214
|
|
|
215
|
+
FreeForm.useForm = _Form.useForm;
|
|
216
216
|
export default FreeForm;
|
|
@@ -7,9 +7,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
7
7
|
|
|
8
8
|
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); }); }; }
|
|
9
9
|
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
10
|
+
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; }
|
|
11
11
|
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
12
|
+
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; }
|
|
13
13
|
|
|
14
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
29
29
|
import { useContext, useEffect, cloneElement, isValidElement, useMemo, useReducer } from 'react';
|
|
30
30
|
import Button from '../../button';
|
|
31
31
|
import { calcNamePath } from '../../utils/form-utils';
|
|
32
|
-
import FormContext from '
|
|
32
|
+
import FormContext from '../../form-context';
|
|
33
33
|
import { LocaleContext } from '../../locale';
|
|
34
34
|
import Typography from '../../typography';
|
|
35
35
|
import './style/index.less';
|
|
@@ -93,10 +93,11 @@ var Page = function Page(_ref) {
|
|
|
93
93
|
return children.map(function (c, index) {
|
|
94
94
|
var _c$type;
|
|
95
95
|
|
|
96
|
-
if (['Igloo_Free_Form_Item', 'Igloo_Free_Form_Section'].includes(c === null || c === void 0 ? void 0 : (_c$type = c.type) === null || _c$type === void 0 ? void 0 : _c$type.displayName)) {
|
|
97
|
-
return /*#__PURE__*/cloneElement(c, _objectSpread(_objectSpread({
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
if (['Igloo_Free_Form_Item', 'Igloo_Free_Form_Section', 'Igloo_Free_Form_AddabledSection'].includes(c === null || c === void 0 ? void 0 : (_c$type = c.type) === null || _c$type === void 0 ? void 0 : _c$type.displayName)) {
|
|
97
|
+
return /*#__PURE__*/cloneElement(c, _objectSpread(_objectSpread({
|
|
98
|
+
key: index
|
|
99
|
+
}, c.props), {}, {
|
|
100
|
+
parentName: pName
|
|
100
101
|
}));
|
|
101
102
|
}
|
|
102
103
|
|
|
@@ -181,90 +182,79 @@ var Page = function Page(_ref) {
|
|
|
181
182
|
};
|
|
182
183
|
}();
|
|
183
184
|
|
|
184
|
-
return _jsxs("div",
|
|
185
|
+
return _jsxs("div", {
|
|
185
186
|
className: 'igloo-freeform-page-container',
|
|
186
187
|
style: {
|
|
187
188
|
display: current === index ? 'block' : 'none'
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
children: [_jsx(Typography, Object.assign({
|
|
189
|
+
},
|
|
190
|
+
children: [_jsx(Typography, {
|
|
191
191
|
level: "h3b",
|
|
192
192
|
wrapElement: "div",
|
|
193
193
|
style: {
|
|
194
194
|
marginBottom: 8
|
|
195
|
-
}
|
|
196
|
-
}, {
|
|
195
|
+
},
|
|
197
196
|
children: label
|
|
198
|
-
}
|
|
197
|
+
}, void 0), _jsx(Typography, {
|
|
199
198
|
level: "body1",
|
|
200
199
|
wrapElement: "div",
|
|
201
200
|
style: {
|
|
202
201
|
marginBottom: 24,
|
|
203
202
|
color: '#666666'
|
|
204
|
-
}
|
|
205
|
-
}, {
|
|
203
|
+
},
|
|
206
204
|
children: description
|
|
207
|
-
}
|
|
208
|
-
className: 'igloo-freeform-page-content'
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
gutter: [32, 24]
|
|
212
|
-
}, {
|
|
205
|
+
}, void 0), _jsx("div", {
|
|
206
|
+
className: 'igloo-freeform-page-content',
|
|
207
|
+
children: _jsx(_Row, {
|
|
208
|
+
gutter: [32, 24],
|
|
213
209
|
children: tranformChildren()
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
className: 'igloo-freeform-page-footer'
|
|
217
|
-
}, {
|
|
210
|
+
}, void 0)
|
|
211
|
+
}, void 0), showFooter && showSubmitButton && (current === undefined || index === undefined || total === undefined ? _jsxs("div", {
|
|
212
|
+
className: 'igloo-freeform-page-footer',
|
|
218
213
|
children: [buttonPlacement === 'right' && _jsx("div", {}, void 0), _jsx(_Form.Item, {
|
|
219
|
-
children: _jsx(Button,
|
|
214
|
+
children: _jsx(Button, {
|
|
220
215
|
type: "primary",
|
|
221
216
|
htmlType: "submit",
|
|
222
217
|
className: 'igloo-freeform-page-submit-button',
|
|
223
218
|
loading: submitting,
|
|
224
|
-
disabled: buttonDisabled
|
|
225
|
-
}, {
|
|
219
|
+
disabled: buttonDisabled,
|
|
226
220
|
children: submitText || formatMessage({
|
|
227
221
|
id: 'Submit'
|
|
228
222
|
})
|
|
229
|
-
}
|
|
223
|
+
}, void 0)
|
|
230
224
|
}, void 0), buttonPlacement === 'left' && _jsx("div", {}, void 0)]
|
|
231
|
-
}
|
|
232
|
-
className: 'igloo-freeform-page-footer'
|
|
233
|
-
|
|
234
|
-
children: [index === 0 && _jsx("div", {}, void 0), index > 0 && total > 1 && _jsx(Button, Object.assign({
|
|
225
|
+
}, void 0) : _jsxs("div", {
|
|
226
|
+
className: 'igloo-freeform-page-footer',
|
|
227
|
+
children: [index === 0 && _jsx("div", {}, void 0), index > 0 && total > 1 && _jsx(Button, {
|
|
235
228
|
className: 'igloo-freeform-page-preview-button',
|
|
236
229
|
onClick: function onClick() {
|
|
237
230
|
return handlePreviousPage && handlePreviousPage(index);
|
|
238
231
|
},
|
|
239
|
-
disabled: previousDisabled
|
|
240
|
-
}, {
|
|
232
|
+
disabled: previousDisabled,
|
|
241
233
|
children: previewText || formatMessage({
|
|
242
234
|
id: 'Previous'
|
|
243
235
|
})
|
|
244
|
-
}
|
|
236
|
+
}, void 0), index < total - 1 && _jsx(Button, {
|
|
245
237
|
className: 'igloo-freeform-page-next-button',
|
|
246
238
|
onClick: handleNext,
|
|
247
239
|
disabled: buttonDisabled,
|
|
248
|
-
type: "primary"
|
|
249
|
-
}, {
|
|
240
|
+
type: "primary",
|
|
250
241
|
children: nextText || formatMessage({
|
|
251
242
|
id: 'Next'
|
|
252
243
|
})
|
|
253
|
-
}
|
|
254
|
-
children: _jsx(Button,
|
|
244
|
+
}, void 0), current === total - 1 && _jsx(_Form.Item, {
|
|
245
|
+
children: _jsx(Button, {
|
|
255
246
|
type: "primary",
|
|
256
247
|
htmlType: "submit",
|
|
257
248
|
className: 'igloo-freeform-page-submit-button',
|
|
258
249
|
loading: submitting,
|
|
259
|
-
disabled: buttonDisabled
|
|
260
|
-
}, {
|
|
250
|
+
disabled: buttonDisabled,
|
|
261
251
|
children: submitText || formatMessage({
|
|
262
252
|
id: 'Submit'
|
|
263
253
|
})
|
|
264
|
-
}
|
|
254
|
+
}, void 0)
|
|
265
255
|
}, void 0)]
|
|
266
|
-
}
|
|
267
|
-
}
|
|
256
|
+
}, void 0))]
|
|
257
|
+
}, void 0);
|
|
268
258
|
};
|
|
269
259
|
|
|
270
260
|
Page.displayName = 'Igloo_Free_Form_Page';
|
|
@@ -47,21 +47,23 @@
|
|
|
47
47
|
.igloo-freeform-page-footer {
|
|
48
48
|
display: flex;
|
|
49
49
|
flex-direction: column-reverse;
|
|
50
|
-
row-gap: 16px;
|
|
51
50
|
|
|
52
51
|
.igloo-freeform-page-preview-button {
|
|
53
52
|
min-width: none;
|
|
54
53
|
width: 100%;
|
|
54
|
+
margin-top: 16px;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.igloo-freeform-page-next-button {
|
|
58
58
|
min-width: none;
|
|
59
59
|
width: 100%;
|
|
60
|
+
margin-top: 16px;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
.igloo-freeform-page-cancel-button {
|
|
63
64
|
min-width: none;
|
|
64
65
|
width: 100%;
|
|
66
|
+
margin-top: 16px;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
.igloo-freeform-page-submit-button {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
1
|
+
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; }
|
|
2
2
|
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
3
|
+
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; }
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
@@ -80,15 +80,13 @@ var Pages = function Pages(_ref) {
|
|
|
80
80
|
})) : children;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
return _jsx("div",
|
|
84
|
-
className: 'igloo-freeform-pages-container'
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
className: 'igloo-freeform-pages-content'
|
|
88
|
-
}, {
|
|
83
|
+
return _jsx("div", {
|
|
84
|
+
className: 'igloo-freeform-pages-container',
|
|
85
|
+
children: _jsx("div", {
|
|
86
|
+
className: 'igloo-freeform-pages-content',
|
|
89
87
|
children: transformChildren()
|
|
90
|
-
}
|
|
91
|
-
}
|
|
88
|
+
}, void 0)
|
|
89
|
+
}, void 0);
|
|
92
90
|
};
|
|
93
91
|
|
|
94
92
|
export default Pages;
|
|
@@ -4,13 +4,13 @@ import "antd/es/col/style";
|
|
|
4
4
|
import _Col from "antd/es/col";
|
|
5
5
|
var _excluded = ["parentName", "name", "label", "labelProps", "contentProps", "style", "preview", "disabledFromParent", "setShowStepButton", "children"];
|
|
6
6
|
|
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
7
|
+
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; }
|
|
8
8
|
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
9
|
+
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; }
|
|
10
10
|
|
|
11
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
12
|
|
|
13
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
13
|
+
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); }
|
|
14
14
|
|
|
15
15
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
16
|
|
|
@@ -38,7 +38,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
38
38
|
|
|
39
39
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
40
40
|
import { useContext, useMemo, useReducer, useEffect, cloneElement, isValidElement } from 'react';
|
|
41
|
-
import FormContext from '
|
|
41
|
+
import FormContext from '../../form-context';
|
|
42
42
|
import { calcNamePath, calcFormItemProps } from '../../utils/form-utils';
|
|
43
43
|
import Typography from '../../typography';
|
|
44
44
|
import './style/index.less';
|
|
@@ -143,13 +143,14 @@ var Section = function Section(props) {
|
|
|
143
143
|
|
|
144
144
|
var transformChildren = function transformChildren() {
|
|
145
145
|
if (Array.isArray(children)) {
|
|
146
|
-
return children.map(function (c, index) {
|
|
146
|
+
return children.flat().map(function (c, index) {
|
|
147
147
|
var _c$type;
|
|
148
148
|
|
|
149
|
-
if (['Igloo_Free_Form_Item', 'Igloo_Free_Form_Section'].includes(c === null || c === void 0 ? void 0 : (_c$type = c.type) === null || _c$type === void 0 ? void 0 : _c$type.displayName)) {
|
|
150
|
-
return /*#__PURE__*/cloneElement(c, _objectSpread(_objectSpread({
|
|
149
|
+
if (['Igloo_Free_Form_Item', 'Igloo_Free_Form_Section', 'Igloo_Free_Form_AddableSection'].includes(c === null || c === void 0 ? void 0 : (_c$type = c.type) === null || _c$type === void 0 ? void 0 : _c$type.displayName)) {
|
|
150
|
+
return /*#__PURE__*/cloneElement(c, _objectSpread(_objectSpread({
|
|
151
|
+
key: index
|
|
152
|
+
}, c.props), {}, {
|
|
151
153
|
parentName: namePath,
|
|
152
|
-
key: c.props.key || index,
|
|
153
154
|
setShowStepButton: setShowStepButton,
|
|
154
155
|
preview: preview,
|
|
155
156
|
disabledFromParent: elementProps.disabled || disabledFromParent
|
|
@@ -168,28 +169,25 @@ var Section = function Section(props) {
|
|
|
168
169
|
})) : children;
|
|
169
170
|
};
|
|
170
171
|
|
|
171
|
-
return display ? _jsxs(_Col,
|
|
172
|
+
return display ? _jsxs(_Col, {
|
|
172
173
|
span: 24,
|
|
173
174
|
className: 'igloo-freeform-section',
|
|
174
|
-
style: style
|
|
175
|
-
|
|
176
|
-
children: [label && _jsx(Typography, Object.assign({
|
|
175
|
+
style: style,
|
|
176
|
+
children: [label && _jsx(Typography, _objectSpread(_objectSpread({
|
|
177
177
|
className: 'igloo-freeform-section-label'
|
|
178
|
-
}, labelProps, {
|
|
178
|
+
}, labelProps), {}, {
|
|
179
179
|
level: "h4",
|
|
180
|
-
wrapElement: "div"
|
|
181
|
-
}, {
|
|
180
|
+
wrapElement: "div",
|
|
182
181
|
children: label
|
|
183
|
-
}), void 0), _jsx("div",
|
|
182
|
+
}), void 0), _jsx("div", _objectSpread(_objectSpread({
|
|
184
183
|
className: 'igloo-freeform-section-content'
|
|
185
|
-
}, contentProps, {
|
|
186
|
-
children: _jsx(_Row,
|
|
187
|
-
gutter: [32, 24]
|
|
188
|
-
}, {
|
|
184
|
+
}, contentProps), {}, {
|
|
185
|
+
children: _jsx(_Row, {
|
|
186
|
+
gutter: [32, preview ? 16 : 24],
|
|
189
187
|
children: transformChildren()
|
|
190
|
-
}
|
|
188
|
+
}, void 0)
|
|
191
189
|
}), void 0)]
|
|
192
|
-
}
|
|
190
|
+
}, void 0) : null;
|
|
193
191
|
};
|
|
194
192
|
|
|
195
193
|
Section.displayName = 'Igloo_Free_Form_Section';
|