iglooform 2.4.6 → 2.4.10
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.js +18 -25
- package/es/admin-upload/job-list.js +83 -113
- 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 +21 -26
- package/es/button/style/index.less +11 -25
- package/es/card-detail/card-group.js +16 -22
- package/es/card-detail/card-item.js +15 -20
- 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 +3 -4
- package/es/checkbox/index.js +23 -22
- package/es/claim-list/index.js +51 -68
- package/es/confirmation/index.js +5 -7
- package/es/date-picker/buddhist.js +1 -1
- 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 +3 -4
- package/es/filter/checkBox.js +33 -45
- package/es/filter/customize.js +3 -4
- package/es/filter/index.js +79 -107
- package/es/filter/radioBox.js +23 -31
- package/es/filter/rangePicker.js +43 -59
- package/es/form/addable-section/index.d.ts +14 -0
- package/es/form/addable-section/index.js +188 -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 +39 -36
- package/es/form/element/style/index.less +4 -0
- package/es/form/index.js +9 -12
- package/es/form/login/index.js +14 -19
- package/es/form/page/index.js +17 -23
- package/es/form/pages/index.js +22 -30
- package/es/form/section/index.js +11 -14
- package/es/form/step/index.js +30 -41
- package/es/form/steps/index.js +9 -9
- package/es/free-form/addable-section/index.d.ts +13 -0
- package/es/free-form/addable-section/index.js +263 -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 +21 -27
- package/es/free-form/element/style/index.less +4 -0
- package/es/free-form/index.js +9 -12
- package/es/free-form/page/index.js +28 -39
- package/es/free-form/pages/index.js +6 -8
- package/es/free-form/section/index.js +11 -14
- package/es/free-form/step/index.js +30 -41
- package/es/free-form/steps/index.d.ts +1 -0
- package/es/free-form/steps/index.js +8 -8
- 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 +12 -16
- 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 +50 -59
- 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 +6 -8
- 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 +6 -8
- package/es/mobile-insurer-detail/index.js +74 -91
- package/es/mobile-insurer-list/index.js +34 -38
- package/es/modal/index.js +20 -25
- package/es/platform/platform-card/index.js +9 -12
- package/es/platform/switch-platform/index.js +24 -32
- package/es/policy-list/index.js +9 -12
- 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/time-select.js +12 -16
- package/es/status-box/index.js +6 -8
- package/es/table/index.js +69 -93
- package/es/tabs/index.js +7 -1
- package/es/typography/index.js +6 -8
- package/es/upload/index.js +48 -66
- package/es/upload-photo/index.js +47 -63
- 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 +19 -26
- package/lib/admin-upload/float.js +25 -35
- package/lib/admin-upload/index.js +18 -25
- package/lib/admin-upload/job-list.js +83 -113
- 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 +22 -27
- package/lib/button/style/index.less +11 -25
- package/lib/card-detail/card-group.js +16 -22
- package/lib/card-detail/card-item.js +15 -20
- 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 +4 -5
- package/lib/checkbox/index.js +24 -23
- package/lib/claim-list/index.js +51 -68
- package/lib/confirmation/index.js +5 -7
- package/lib/date-picker/buddhist.js +1 -1
- 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 +3 -4
- package/lib/filter/checkBox.js +33 -45
- package/lib/filter/customize.js +3 -4
- package/lib/filter/index.js +79 -107
- package/lib/filter/radioBox.js +23 -31
- package/lib/filter/rangePicker.js +43 -59
- package/lib/form/addable-section/index.d.ts +14 -0
- package/lib/form/addable-section/index.js +209 -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 +40 -36
- package/lib/form/element/style/index.less +4 -0
- package/lib/form/index.js +9 -12
- package/lib/form/login/index.js +14 -19
- package/lib/form/page/index.js +17 -23
- package/lib/form/pages/index.js +22 -30
- package/lib/form/section/index.js +11 -14
- package/lib/form/step/index.js +30 -41
- package/lib/form/steps/index.js +9 -9
- package/lib/free-form/addable-section/index.d.ts +13 -0
- package/lib/free-form/addable-section/index.js +283 -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 +21 -27
- package/lib/free-form/element/style/index.less +4 -0
- package/lib/free-form/index.js +9 -12
- package/lib/free-form/page/index.js +28 -39
- package/lib/free-form/pages/index.js +6 -8
- package/lib/free-form/section/index.js +11 -14
- package/lib/free-form/step/index.js +30 -41
- package/lib/free-form/steps/index.d.ts +1 -0
- package/lib/free-form/steps/index.js +8 -8
- package/lib/home-menu/index.js +52 -71
- package/lib/index.d.ts +1 -0
- package/lib/index.js +140 -131
- 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 +12 -16
- 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 +50 -59
- 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 +7 -9
- 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 +6 -8
- package/lib/mobile-insurer-detail/index.js +74 -91
- package/lib/mobile-insurer-list/index.js +34 -38
- package/lib/modal/index.js +20 -25
- package/lib/platform/platform-card/index.js +9 -12
- package/lib/platform/switch-platform/index.js +24 -32
- package/lib/policy-list/index.js +9 -12
- 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/time-select.js +12 -16
- package/lib/status-box/index.js +6 -8
- package/lib/table/index.js +69 -93
- package/lib/tabs/index.js +8 -2
- package/lib/typography/index.js +6 -8
- package/lib/upload/index.js +48 -66
- package/lib/upload-photo/index.js +47 -63
- 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 +20 -27
- package/package.json +1 -1
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import "antd/es/row/style";
|
|
2
|
+
import _Row from "antd/es/row";
|
|
3
|
+
import "antd/es/col/style";
|
|
4
|
+
import _Col from "antd/es/col";
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
13
|
+
|
|
14
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
+
|
|
16
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
|
|
18
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
+
|
|
20
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
|
+
|
|
22
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
+
|
|
24
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
|
|
26
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
+
|
|
28
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
29
|
+
|
|
30
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
31
|
+
|
|
32
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
|
+
|
|
34
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
35
|
+
import { useReducer, useContext, useEffect, cloneElement, isValidElement } from 'react';
|
|
36
|
+
import FormContext from '../context';
|
|
37
|
+
import { calcNamePath, calcFormItemProps } from '../../utils/form-utils';
|
|
38
|
+
import Typography from '../../typography';
|
|
39
|
+
import Button from '../../button';
|
|
40
|
+
import { LocaleContext } from '../../locale';
|
|
41
|
+
import './style/index.less';
|
|
42
|
+
|
|
43
|
+
var AddableSection = function AddableSection(props) {
|
|
44
|
+
var _props$elements = props.elements,
|
|
45
|
+
elements = _props$elements === void 0 ? [] : _props$elements,
|
|
46
|
+
name = props.name,
|
|
47
|
+
label = props.label,
|
|
48
|
+
_props$labelProps = props.labelProps,
|
|
49
|
+
labelProps = _props$labelProps === void 0 ? {} : _props$labelProps,
|
|
50
|
+
_props$contentProps = props.contentProps,
|
|
51
|
+
contentProps = _props$contentProps === void 0 ? {} : _props$contentProps,
|
|
52
|
+
_props$max = props.max,
|
|
53
|
+
max = _props$max === void 0 ? Number.MAX_SAFE_INTEGER : _props$max,
|
|
54
|
+
parentName = props.parentName,
|
|
55
|
+
preview = props.preview,
|
|
56
|
+
disabledFromParent = props.disabledFromParent,
|
|
57
|
+
setShowStepButton = props.setShowStepButton,
|
|
58
|
+
children = props.children;
|
|
59
|
+
|
|
60
|
+
var _useReducer = useReducer(function (r) {
|
|
61
|
+
return r + 1;
|
|
62
|
+
}, 0),
|
|
63
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
64
|
+
_ = _useReducer2[0],
|
|
65
|
+
dispatch = _useReducer2[1];
|
|
66
|
+
|
|
67
|
+
var _useContext = useContext(LocaleContext),
|
|
68
|
+
formatMessage = _useContext.formatMessage;
|
|
69
|
+
|
|
70
|
+
var _useContext2 = useContext(FormContext),
|
|
71
|
+
form = _useContext2.form,
|
|
72
|
+
requiredMark = _useContext2.requiredMark,
|
|
73
|
+
registerDependencies = _useContext2.registerDependencies;
|
|
74
|
+
|
|
75
|
+
var namePath = calcNamePath(parentName, name);
|
|
76
|
+
|
|
77
|
+
var _useReducer3 = useReducer(function (state, action) {
|
|
78
|
+
if (action.type === 'add') {
|
|
79
|
+
return [].concat(_toConsumableArray(state), [action.key]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var found = false;
|
|
83
|
+
return state.filter(function (key, index) {
|
|
84
|
+
if (key === action.key) {
|
|
85
|
+
found = true;
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (found) {
|
|
90
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
91
|
+
name: calcNamePath(namePath, index - 1),
|
|
92
|
+
value: form.getFieldValue(calcNamePath(namePath, index))
|
|
93
|
+
}]);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return true;
|
|
97
|
+
});
|
|
98
|
+
}, [Date.now()]),
|
|
99
|
+
_useReducer4 = _slicedToArray(_useReducer3, 2),
|
|
100
|
+
groupKeys = _useReducer4[0],
|
|
101
|
+
dispath = _useReducer4[1];
|
|
102
|
+
|
|
103
|
+
useEffect(function () {
|
|
104
|
+
var dependencies = props.dependencies,
|
|
105
|
+
asserts = props.asserts,
|
|
106
|
+
copyValue = props.copyValue,
|
|
107
|
+
selectValue = props.selectValue,
|
|
108
|
+
shouldRender = props.shouldRender,
|
|
109
|
+
subscribedFields = props.subscribedFields,
|
|
110
|
+
disabled = props.disabled;
|
|
111
|
+
var dependentField = dependencies || [];
|
|
112
|
+
|
|
113
|
+
if (Array.isArray(subscribedFields)) {
|
|
114
|
+
dependentField.push.apply(dependentField, _toConsumableArray(subscribedFields));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (asserts && asserts.length) {
|
|
118
|
+
asserts.forEach(function (_ref) {
|
|
119
|
+
var field = _ref.field;
|
|
120
|
+
return dependentField.push(field);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (copyValue) {
|
|
125
|
+
dependentField.push(copyValue.assert.field);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (selectValue && selectValue.length) {
|
|
129
|
+
selectValue.forEach(function (_ref2) {
|
|
130
|
+
var assert = _ref2.assert;
|
|
131
|
+
return dependentField.push(assert.field);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (shouldRender && !Array.isArray(subscribedFields)) {
|
|
136
|
+
dependentField.push('SUBSCRIBE_ALL');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (Array.isArray(disabled)) {
|
|
140
|
+
disabled.forEach(function (_ref3) {
|
|
141
|
+
var field = _ref3.field;
|
|
142
|
+
return dependentField.push(field);
|
|
143
|
+
});
|
|
144
|
+
} else if (_typeof(disabled) === 'object') {
|
|
145
|
+
dependentField.push(disabled.field);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
registerDependencies(dependentField, dispatch);
|
|
149
|
+
}, []);
|
|
150
|
+
|
|
151
|
+
var _calcFormItemProps = calcFormItemProps(props, {
|
|
152
|
+
requiredMark: requiredMark
|
|
153
|
+
}, form, parentName),
|
|
154
|
+
formItemProps = _calcFormItemProps.formItemProps,
|
|
155
|
+
elementProps = _calcFormItemProps.elementProps,
|
|
156
|
+
display = _calcFormItemProps.display;
|
|
157
|
+
|
|
158
|
+
if (formItemProps.copiedValue.copied) {
|
|
159
|
+
var currentValue = form === null || form === void 0 ? void 0 : form.getFieldValue(namePath);
|
|
160
|
+
|
|
161
|
+
var value = _objectSpread(_objectSpread({}, currentValue), formItemProps.copiedValue.value);
|
|
162
|
+
|
|
163
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
164
|
+
name: namePath,
|
|
165
|
+
value: value,
|
|
166
|
+
errors: []
|
|
167
|
+
}]);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var transformChildren = function transformChildren(parentName) {
|
|
171
|
+
if (Array.isArray(children)) {
|
|
172
|
+
return children.map(function (c, index) {
|
|
173
|
+
var _c$type;
|
|
174
|
+
|
|
175
|
+
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)) {
|
|
176
|
+
return /*#__PURE__*/cloneElement(c, _objectSpread(_objectSpread({}, c.props), {}, {
|
|
177
|
+
parentName: parentName,
|
|
178
|
+
key: c.props.key || index,
|
|
179
|
+
setShowStepButton: setShowStepButton,
|
|
180
|
+
preview: preview,
|
|
181
|
+
disabledFromParent: elementProps.disabled || disabledFromParent
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return c;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return /*#__PURE__*/isValidElement(children) ? /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, {
|
|
190
|
+
parentName: parentName,
|
|
191
|
+
setShowStepButton: setShowStepButton,
|
|
192
|
+
preview: preview,
|
|
193
|
+
disabledFromParent: elementProps.disabled
|
|
194
|
+
})) : children;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
if (!display) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
var groups = groupKeys.map(function (key, index) {
|
|
202
|
+
var parentName = calcNamePath(namePath, index);
|
|
203
|
+
return _jsxs(_Col, {
|
|
204
|
+
span: 24,
|
|
205
|
+
className: 'igloo-addable-section',
|
|
206
|
+
children: [label && _jsxs(_Row, {
|
|
207
|
+
justify: "space-between",
|
|
208
|
+
className: 'igloo-addable-section-label',
|
|
209
|
+
children: [_jsxs(Typography, _objectSpread(_objectSpread({}, labelProps), {}, {
|
|
210
|
+
level: "h4",
|
|
211
|
+
wrapElement: "div",
|
|
212
|
+
children: [label, " ", index + 1]
|
|
213
|
+
}), void 0), groupKeys.length > 1 && !preview && _jsx(Button, {
|
|
214
|
+
type: "link",
|
|
215
|
+
className: "igloo-addable-section-label-remove",
|
|
216
|
+
onClick: function onClick() {
|
|
217
|
+
return dispath({
|
|
218
|
+
type: 'remove',
|
|
219
|
+
key: key
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
children: formatMessage({
|
|
223
|
+
id: 'Remove'
|
|
224
|
+
})
|
|
225
|
+
}, void 0)]
|
|
226
|
+
}, void 0), _jsx("div", _objectSpread(_objectSpread({
|
|
227
|
+
className: 'igloo-addable-section-content'
|
|
228
|
+
}, contentProps), {}, {
|
|
229
|
+
children: _jsx(_Row, {
|
|
230
|
+
gutter: [32, preview ? 16 : 24],
|
|
231
|
+
children: transformChildren(parentName)
|
|
232
|
+
}, void 0)
|
|
233
|
+
}), void 0)]
|
|
234
|
+
}, key);
|
|
235
|
+
});
|
|
236
|
+
return _jsxs("div", {
|
|
237
|
+
className: "igloo-addable-section-container",
|
|
238
|
+
style: {
|
|
239
|
+
width: '100%'
|
|
240
|
+
},
|
|
241
|
+
children: [groups, groupKeys.length < max && !preview && _jsx(_Col, {
|
|
242
|
+
span: 24,
|
|
243
|
+
style: {
|
|
244
|
+
marginTop: 16
|
|
245
|
+
},
|
|
246
|
+
children: _jsxs(Button, {
|
|
247
|
+
onClick: function onClick() {
|
|
248
|
+
return dispath({
|
|
249
|
+
type: 'add',
|
|
250
|
+
key: Date.now()
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
className: "igloo-addable-section-button",
|
|
254
|
+
children: [formatMessage({
|
|
255
|
+
id: 'Add'
|
|
256
|
+
}), " ", label]
|
|
257
|
+
}, void 0)
|
|
258
|
+
}, void 0)]
|
|
259
|
+
}, void 0);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export default AddableSection;
|
|
263
|
+
AddableSection.displayName = 'Igloo_Free_Form_AddableSection';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.igloo-addable-section-container {
|
|
2
|
+
.igloo-addable-section {
|
|
3
|
+
.igloo-addable-section-label {
|
|
4
|
+
.igloo-addable-section-label-remove {
|
|
5
|
+
height: auto;
|
|
6
|
+
border: none;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.igloo-addable-section-content {
|
|
11
|
+
margin-top: 16px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
& + .igloo-addable-section {
|
|
15
|
+
margin-top: 24px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.igloo-addable-section-button {
|
|
20
|
+
min-width: 221px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -218,75 +218,69 @@ var Element = function Element(props) {
|
|
|
218
218
|
if (!display) return null;
|
|
219
219
|
|
|
220
220
|
if (preview) {
|
|
221
|
-
return _jsx(_Col,
|
|
221
|
+
return _jsx(_Col, {
|
|
222
222
|
span: 24,
|
|
223
223
|
className: classNames('igloo-freeform-element-preview', {
|
|
224
224
|
'igloo-freeform-element-preview-hide': props.hideWhenPreview,
|
|
225
225
|
'igloo-freeform-element-preview-hide-divider': props.hidePreviewDivider
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
children: _jsx(_Form.Item, Object.assign({}, omit(formItemProps, ['copiedValue', 'selectedValue']), {
|
|
226
|
+
}),
|
|
227
|
+
children: _jsx(_Form.Item, _objectSpread(_objectSpread({}, omit(formItemProps, ['copiedValue', 'selectedValue'])), {}, {
|
|
229
228
|
labelCol: {
|
|
230
229
|
span: 24
|
|
231
230
|
},
|
|
232
231
|
wrapperCol: {
|
|
233
232
|
span: 24
|
|
234
233
|
},
|
|
235
|
-
label: null
|
|
236
|
-
|
|
237
|
-
children: _jsxs(_Row, Object.assign({
|
|
234
|
+
label: null,
|
|
235
|
+
children: _jsxs(_Row, {
|
|
238
236
|
className: "igloo-freeform-element-preview-item",
|
|
239
237
|
gutter: {
|
|
240
238
|
md: 32,
|
|
241
239
|
sm: 0,
|
|
242
240
|
xs: 0
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
children: [(rest.previewLabel || rest.label) && _jsx(_Col, Object.assign({
|
|
241
|
+
},
|
|
242
|
+
children: [(rest.previewLabel || rest.label) && _jsx(_Col, {
|
|
246
243
|
span: 12,
|
|
247
244
|
md: 12,
|
|
248
245
|
sm: 24,
|
|
249
246
|
xs: 24,
|
|
250
|
-
className: "igloo-freeform-element-preview-label"
|
|
251
|
-
}, {
|
|
247
|
+
className: "igloo-freeform-element-preview-label",
|
|
252
248
|
children: rest.previewLabel || rest.label
|
|
253
|
-
}
|
|
249
|
+
}, void 0), _jsxs(_Col, {
|
|
254
250
|
span: rest.previewLabel || rest.label ? 12 : 24,
|
|
255
251
|
md: rest.previewLabel || rest.label ? 12 : 24,
|
|
256
252
|
sm: 24,
|
|
257
253
|
xs: 24,
|
|
258
|
-
className: "igloo-freeform-element-preview-value"
|
|
259
|
-
}, {
|
|
254
|
+
className: "igloo-freeform-element-preview-value",
|
|
260
255
|
children: [error && !!error.length && _jsx(CloseCircleFilled, {
|
|
261
256
|
className: "igloo-freeform-element-preview-value-icon"
|
|
262
257
|
}, void 0), previewFormater ? previewFormater(value, form) : value || '-']
|
|
263
|
-
}
|
|
264
|
-
}
|
|
258
|
+
}, void 0)]
|
|
259
|
+
}, void 0)
|
|
265
260
|
}), void 0)
|
|
266
|
-
}
|
|
261
|
+
}, void 0);
|
|
267
262
|
}
|
|
268
263
|
|
|
269
|
-
return props.hideWhenEdit ? null : _jsx(_Col,
|
|
270
|
-
className: "igloo-freeform-item"
|
|
271
|
-
|
|
272
|
-
children: _jsx("div", Object.assign({
|
|
264
|
+
return props.hideWhenEdit ? null : _jsx(_Col, _objectSpread(_objectSpread({}, restColProps), {}, {
|
|
265
|
+
className: "igloo-freeform-item",
|
|
266
|
+
children: _jsx("div", {
|
|
273
267
|
ref: ref,
|
|
274
268
|
style: {
|
|
275
269
|
width: halfRow && md ? '50%' : '100%',
|
|
276
270
|
paddingRight: halfRow && md ? 16 : 0
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
children: _jsx(_Form.Item, Object.assign({
|
|
271
|
+
},
|
|
272
|
+
children: _jsx(_Form.Item, _objectSpread(_objectSpread({
|
|
280
273
|
labelCol: {
|
|
281
274
|
span: 24
|
|
282
275
|
},
|
|
283
276
|
wrapperCol: {
|
|
284
277
|
span: 24
|
|
285
278
|
}
|
|
286
|
-
}, omit(formItemProps, ['copiedValue', 'selectedValue']), {
|
|
279
|
+
}, omit(formItemProps, ['copiedValue', 'selectedValue'])), {}, {
|
|
280
|
+
className: "igloo-freeform-element-edit",
|
|
287
281
|
children: transformChildren()
|
|
288
282
|
}), void 0)
|
|
289
|
-
}
|
|
283
|
+
}, void 0)
|
|
290
284
|
}), void 0);
|
|
291
285
|
};
|
|
292
286
|
|
package/es/free-form/index.js
CHANGED
|
@@ -181,13 +181,12 @@ var FreeForm = function FreeForm(props) {
|
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
183
|
|
|
184
|
-
return _jsx("div",
|
|
184
|
+
return _jsx("div", {
|
|
185
185
|
className: classNames(className, {
|
|
186
186
|
'igloo-freeform-without-button': !showSubmitButton
|
|
187
187
|
}),
|
|
188
|
-
style: style
|
|
189
|
-
|
|
190
|
-
children: _jsx(FormContext.Provider, Object.assign({
|
|
188
|
+
style: style,
|
|
189
|
+
children: _jsx(FormContext.Provider, {
|
|
191
190
|
value: _objectSpread({
|
|
192
191
|
form: form,
|
|
193
192
|
onCancel: onCancel,
|
|
@@ -196,21 +195,19 @@ var FreeForm = function FreeForm(props) {
|
|
|
196
195
|
showSubmitButton: showSubmitButton,
|
|
197
196
|
getScrollContainer: getScrollContainer,
|
|
198
197
|
registerDependencies: registerDependencies
|
|
199
|
-
}, locales)
|
|
200
|
-
|
|
201
|
-
children: _jsx(_Form, Object.assign({
|
|
198
|
+
}, locales),
|
|
199
|
+
children: _jsx(_Form, {
|
|
202
200
|
form: form,
|
|
203
201
|
onFinish: handleSubmit,
|
|
204
202
|
onFieldsChange: handleValuesChange,
|
|
205
203
|
colon: false,
|
|
206
204
|
validateMessages: validateMessages || messages,
|
|
207
205
|
initialValues: initialValues,
|
|
208
|
-
scrollToFirstError: true
|
|
209
|
-
}, {
|
|
206
|
+
scrollToFirstError: true,
|
|
210
207
|
children: children
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
208
|
+
}, void 0)
|
|
209
|
+
}, void 0)
|
|
210
|
+
}, void 0);
|
|
214
211
|
};
|
|
215
212
|
|
|
216
213
|
export default FreeForm;
|
|
@@ -181,90 +181,79 @@ var Page = function Page(_ref) {
|
|
|
181
181
|
};
|
|
182
182
|
}();
|
|
183
183
|
|
|
184
|
-
return _jsxs("div",
|
|
184
|
+
return _jsxs("div", {
|
|
185
185
|
className: 'igloo-freeform-page-container',
|
|
186
186
|
style: {
|
|
187
187
|
display: current === index ? 'block' : 'none'
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
children: [_jsx(Typography, Object.assign({
|
|
188
|
+
},
|
|
189
|
+
children: [_jsx(Typography, {
|
|
191
190
|
level: "h3b",
|
|
192
191
|
wrapElement: "div",
|
|
193
192
|
style: {
|
|
194
193
|
marginBottom: 8
|
|
195
|
-
}
|
|
196
|
-
}, {
|
|
194
|
+
},
|
|
197
195
|
children: label
|
|
198
|
-
}
|
|
196
|
+
}, void 0), _jsx(Typography, {
|
|
199
197
|
level: "body1",
|
|
200
198
|
wrapElement: "div",
|
|
201
199
|
style: {
|
|
202
200
|
marginBottom: 24,
|
|
203
201
|
color: '#666666'
|
|
204
|
-
}
|
|
205
|
-
}, {
|
|
202
|
+
},
|
|
206
203
|
children: description
|
|
207
|
-
}
|
|
208
|
-
className: 'igloo-freeform-page-content'
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
gutter: [32, 24]
|
|
212
|
-
}, {
|
|
204
|
+
}, void 0), _jsx("div", {
|
|
205
|
+
className: 'igloo-freeform-page-content',
|
|
206
|
+
children: _jsx(_Row, {
|
|
207
|
+
gutter: [32, 24],
|
|
213
208
|
children: tranformChildren()
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
className: 'igloo-freeform-page-footer'
|
|
217
|
-
}, {
|
|
209
|
+
}, void 0)
|
|
210
|
+
}, void 0), showFooter && showSubmitButton && (current === undefined || index === undefined || total === undefined ? _jsxs("div", {
|
|
211
|
+
className: 'igloo-freeform-page-footer',
|
|
218
212
|
children: [buttonPlacement === 'right' && _jsx("div", {}, void 0), _jsx(_Form.Item, {
|
|
219
|
-
children: _jsx(Button,
|
|
213
|
+
children: _jsx(Button, {
|
|
220
214
|
type: "primary",
|
|
221
215
|
htmlType: "submit",
|
|
222
216
|
className: 'igloo-freeform-page-submit-button',
|
|
223
217
|
loading: submitting,
|
|
224
|
-
disabled: buttonDisabled
|
|
225
|
-
}, {
|
|
218
|
+
disabled: buttonDisabled,
|
|
226
219
|
children: submitText || formatMessage({
|
|
227
220
|
id: 'Submit'
|
|
228
221
|
})
|
|
229
|
-
}
|
|
222
|
+
}, void 0)
|
|
230
223
|
}, 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({
|
|
224
|
+
}, void 0) : _jsxs("div", {
|
|
225
|
+
className: 'igloo-freeform-page-footer',
|
|
226
|
+
children: [index === 0 && _jsx("div", {}, void 0), index > 0 && total > 1 && _jsx(Button, {
|
|
235
227
|
className: 'igloo-freeform-page-preview-button',
|
|
236
228
|
onClick: function onClick() {
|
|
237
229
|
return handlePreviousPage && handlePreviousPage(index);
|
|
238
230
|
},
|
|
239
|
-
disabled: previousDisabled
|
|
240
|
-
}, {
|
|
231
|
+
disabled: previousDisabled,
|
|
241
232
|
children: previewText || formatMessage({
|
|
242
233
|
id: 'Previous'
|
|
243
234
|
})
|
|
244
|
-
}
|
|
235
|
+
}, void 0), index < total - 1 && _jsx(Button, {
|
|
245
236
|
className: 'igloo-freeform-page-next-button',
|
|
246
237
|
onClick: handleNext,
|
|
247
238
|
disabled: buttonDisabled,
|
|
248
|
-
type: "primary"
|
|
249
|
-
}, {
|
|
239
|
+
type: "primary",
|
|
250
240
|
children: nextText || formatMessage({
|
|
251
241
|
id: 'Next'
|
|
252
242
|
})
|
|
253
|
-
}
|
|
254
|
-
children: _jsx(Button,
|
|
243
|
+
}, void 0), current === total - 1 && _jsx(_Form.Item, {
|
|
244
|
+
children: _jsx(Button, {
|
|
255
245
|
type: "primary",
|
|
256
246
|
htmlType: "submit",
|
|
257
247
|
className: 'igloo-freeform-page-submit-button',
|
|
258
248
|
loading: submitting,
|
|
259
|
-
disabled: buttonDisabled
|
|
260
|
-
}, {
|
|
249
|
+
disabled: buttonDisabled,
|
|
261
250
|
children: submitText || formatMessage({
|
|
262
251
|
id: 'Submit'
|
|
263
252
|
})
|
|
264
|
-
}
|
|
253
|
+
}, void 0)
|
|
265
254
|
}, void 0)]
|
|
266
|
-
}
|
|
267
|
-
}
|
|
255
|
+
}, void 0))]
|
|
256
|
+
}, void 0);
|
|
268
257
|
};
|
|
269
258
|
|
|
270
259
|
Page.displayName = 'Igloo_Free_Form_Page';
|
|
@@ -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;
|
|
@@ -168,28 +168,25 @@ var Section = function Section(props) {
|
|
|
168
168
|
})) : children;
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
return display ? _jsxs(_Col,
|
|
171
|
+
return display ? _jsxs(_Col, {
|
|
172
172
|
span: 24,
|
|
173
173
|
className: 'igloo-freeform-section',
|
|
174
|
-
style: style
|
|
175
|
-
|
|
176
|
-
children: [label && _jsx(Typography, Object.assign({
|
|
174
|
+
style: style,
|
|
175
|
+
children: [label && _jsx(Typography, _objectSpread(_objectSpread({
|
|
177
176
|
className: 'igloo-freeform-section-label'
|
|
178
|
-
}, labelProps, {
|
|
177
|
+
}, labelProps), {}, {
|
|
179
178
|
level: "h4",
|
|
180
|
-
wrapElement: "div"
|
|
181
|
-
}, {
|
|
179
|
+
wrapElement: "div",
|
|
182
180
|
children: label
|
|
183
|
-
}), void 0), _jsx("div",
|
|
181
|
+
}), void 0), _jsx("div", _objectSpread(_objectSpread({
|
|
184
182
|
className: 'igloo-freeform-section-content'
|
|
185
|
-
}, contentProps, {
|
|
186
|
-
children: _jsx(_Row,
|
|
187
|
-
gutter: [32, 24]
|
|
188
|
-
}, {
|
|
183
|
+
}, contentProps), {}, {
|
|
184
|
+
children: _jsx(_Row, {
|
|
185
|
+
gutter: [32, preview ? 16 : 24],
|
|
189
186
|
children: transformChildren()
|
|
190
|
-
}
|
|
187
|
+
}, void 0)
|
|
191
188
|
}), void 0)]
|
|
192
|
-
}
|
|
189
|
+
}, void 0) : null;
|
|
193
190
|
};
|
|
194
191
|
|
|
195
192
|
Section.displayName = 'Igloo_Free_Form_Section';
|