iglooform 2.4.10 → 2.4.14
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/index.d.ts +2 -0
- package/es/admin-upload/index.js +25 -11
- package/es/admin-upload/job-list.js +2 -2
- package/es/alert-message/index.js +2 -2
- package/es/amount/index.js +2 -2
- package/es/back-top/index.js +2 -2
- package/es/button/index.js +2 -2
- package/es/button/style/index.less +22 -4
- package/es/card-detail/card-item.js +1 -1
- package/es/card-detail/card.js +2 -2
- package/es/card-detail/utils.js +3 -3
- package/es/checkbox/index.js +2 -2
- package/es/claim-list/index.js +2 -2
- package/es/confirmation/index.js +2 -2
- package/es/date-picker/buddhist.js +2 -2
- package/es/date-picker/index.js +2 -2
- package/es/declaration/index.js +2 -2
- package/es/detail-panel/index.js +2 -2
- package/es/example/index.js +9 -7
- package/es/filter/index.d.ts +1 -0
- package/es/filter/index.js +10 -6
- package/es/form/addable-section/index.d.ts +6 -1
- package/es/form/addable-section/index.js +55 -32
- package/es/form/divider/index.js +2 -2
- package/es/form/element/index.js +19 -11
- package/es/form/element/style/index.less +5 -0
- package/es/form/index.js +7 -5
- package/es/form/login/index.js +1 -1
- package/es/form/page/index.js +1 -1
- package/es/form/page/style/index.less +1 -1
- package/es/form/pages/index.js +2 -3
- package/es/form/pages/style/index.less +3 -1
- package/es/form/render/index.js +1 -1
- package/es/form/section/index.js +3 -3
- package/es/form/step/index.js +1 -1
- package/es/form/steps/index.js +2 -3
- 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 +6 -1
- package/es/free-form/addable-section/index.js +50 -27
- package/es/free-form/element/index.js +22 -14
- package/es/free-form/element/style/index.less +8 -2
- package/es/free-form/index.d.ts +5 -1
- package/es/free-form/index.js +8 -5
- package/es/free-form/page/index.js +8 -7
- package/es/free-form/page/style/index.less +3 -1
- package/es/free-form/pages/index.js +2 -2
- package/es/free-form/section/index.js +9 -8
- package/es/free-form/section/style/index.less +4 -0
- package/es/free-form/step/index.js +7 -6
- package/es/free-form/steps/index.js +2 -2
- package/es/global-message/index.js +1 -1
- package/es/input/amount.js +2 -2
- package/es/input/credit-card.js +2 -2
- package/es/input/email.js +2 -2
- package/es/input/expiry-date.js +2 -2
- package/es/input/input-number.js +2 -2
- package/es/input/input.js +2 -2
- package/es/input/otp.js +2 -2
- package/es/input/password.js +2 -2
- package/es/input/text-area.js +2 -2
- package/es/layout/header.js +3 -3
- package/es/layout/index.js +2 -2
- package/es/locale/locale-provider.js +8 -4
- package/es/locale/zh-TW/messages.json +76 -0
- package/es/locale/zh-TW.d.ts +2 -0
- package/es/locale/zh-TW.js +3 -0
- package/es/media/preview.js +2 -2
- package/es/mobile-insurer-detail/index.js +2 -2
- package/es/mobile-insurer-list/index.js +2 -2
- package/es/modal/index.d.ts +4 -3
- package/es/modal/index.js +6 -3
- package/es/modal/style/index.less +24 -5
- package/es/policy-list/index.js +2 -2
- package/es/policy-list/policy-card.js +2 -2
- package/es/radio/index.js +2 -2
- package/es/select/attached-select.js +2 -2
- package/es/select/select.js +2 -2
- package/es/select/style/index.less +1 -1
- package/es/status-box/index.js +2 -2
- package/es/table/index.js +3 -3
- package/es/tabs/index.js +2 -2
- package/es/tabs/style/index.less +1 -1
- package/es/types.d.ts +5 -2
- package/es/upload/index.d.ts +2 -1
- package/es/upload/index.js +121 -77
- package/es/upload-photo/index.d.ts +2 -1
- package/es/upload-photo/index.js +123 -79
- package/es/utils/form-utils.d.ts +1 -0
- package/es/utils/form-utils.js +33 -11
- package/lib/admin-upload/index.d.ts +2 -0
- package/lib/admin-upload/index.js +25 -11
- package/lib/admin-upload/job-list.js +2 -2
- package/lib/alert-message/index.js +2 -2
- package/lib/amount/index.js +2 -2
- package/lib/back-top/index.js +2 -2
- package/lib/button/index.js +2 -2
- package/lib/button/style/index.less +22 -4
- package/lib/card-detail/card-item.js +1 -1
- package/lib/card-detail/card.js +2 -2
- package/lib/card-detail/utils.js +3 -3
- package/lib/checkbox/index.js +2 -2
- package/lib/claim-list/index.js +2 -2
- package/lib/confirmation/index.js +2 -2
- package/lib/date-picker/buddhist.js +2 -2
- package/lib/date-picker/index.js +2 -2
- package/lib/declaration/index.js +2 -2
- package/lib/detail-panel/index.js +2 -2
- package/lib/example/index.js +10 -8
- package/lib/filter/index.d.ts +1 -0
- package/lib/filter/index.js +10 -6
- package/lib/form/addable-section/index.d.ts +6 -1
- package/lib/form/addable-section/index.js +55 -32
- package/lib/form/divider/index.js +2 -2
- package/lib/form/element/index.js +20 -12
- package/lib/form/element/style/index.less +5 -0
- package/lib/form/elements.js +1 -1
- package/lib/form/index.js +8 -6
- package/lib/form/login/index.js +2 -2
- package/lib/form/page/index.js +2 -2
- package/lib/form/page/style/index.less +1 -1
- package/lib/form/pages/index.js +3 -4
- package/lib/form/pages/style/index.less +3 -1
- package/lib/form/render/index.js +2 -2
- package/lib/form/section/index.js +4 -4
- package/lib/form/step/index.js +2 -2
- package/lib/form/steps/index.js +3 -4
- 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 +6 -1
- package/lib/free-form/addable-section/index.js +50 -27
- package/lib/free-form/element/index.js +23 -15
- package/lib/free-form/element/style/index.less +8 -2
- package/lib/free-form/index.d.ts +5 -1
- package/lib/free-form/index.js +9 -6
- package/lib/free-form/page/index.js +9 -8
- package/lib/free-form/page/style/index.less +3 -1
- package/lib/free-form/pages/index.js +2 -2
- package/lib/free-form/section/index.js +10 -9
- package/lib/free-form/section/style/index.less +4 -0
- package/lib/free-form/step/index.js +8 -7
- package/lib/free-form/steps/index.js +3 -3
- package/lib/global-message/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/input/amount.js +2 -2
- package/lib/input/credit-card.js +2 -2
- package/lib/input/email.js +2 -2
- package/lib/input/expiry-date.js +2 -2
- package/lib/input/input-number.js +2 -2
- package/lib/input/input.js +2 -2
- package/lib/input/otp.js +2 -2
- package/lib/input/password.js +2 -2
- package/lib/input/text-area.js +2 -2
- package/lib/layout/header.js +3 -3
- package/lib/layout/index.js +2 -2
- package/lib/locale/locale-provider.js +10 -4
- package/lib/locale/zh-TW/messages.json +76 -0
- package/lib/locale/zh-TW.d.ts +2 -0
- package/lib/locale/zh-TW.js +11 -0
- package/lib/media/preview.js +2 -2
- package/lib/mobile-insurer-detail/index.js +2 -2
- package/lib/mobile-insurer-list/index.js +2 -2
- package/lib/modal/index.d.ts +4 -3
- package/lib/modal/index.js +6 -3
- package/lib/modal/style/index.less +24 -5
- package/lib/policy-list/index.js +2 -2
- package/lib/policy-list/policy-card.js +2 -2
- package/lib/radio/index.js +2 -2
- package/lib/select/attached-select.js +2 -2
- package/lib/select/select.js +2 -2
- package/lib/select/style/index.less +1 -1
- package/lib/status-box/index.js +2 -2
- package/lib/table/index.js +3 -3
- package/lib/tabs/index.js +2 -2
- package/lib/tabs/style/index.less +1 -1
- package/lib/types.d.ts +5 -2
- package/lib/upload/index.d.ts +2 -1
- package/lib/upload/index.js +122 -77
- package/lib/upload-photo/index.d.ts +2 -1
- package/lib/upload-photo/index.js +124 -79
- package/lib/utils/form-utils.d.ts +1 -0
- package/lib/utils/form-utils.js +32 -11
- 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
|
@@ -3,36 +3,36 @@ import _Row from "antd/es/row";
|
|
|
3
3
|
import "antd/es/col/style";
|
|
4
4
|
import _Col from "antd/es/col";
|
|
5
5
|
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
6
|
+
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; }
|
|
7
7
|
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
8
|
+
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; }
|
|
9
9
|
|
|
10
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
11
|
|
|
12
|
-
function
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
13
|
|
|
14
|
-
function
|
|
14
|
+
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."); }
|
|
15
15
|
|
|
16
|
-
function
|
|
16
|
+
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; }
|
|
17
17
|
|
|
18
|
-
function
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
19
|
|
|
20
|
-
function
|
|
20
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
21
|
|
|
22
|
-
function
|
|
22
|
+
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."); }
|
|
23
23
|
|
|
24
24
|
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); }
|
|
25
25
|
|
|
26
|
-
function
|
|
26
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
27
27
|
|
|
28
|
-
function
|
|
28
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
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; }
|
|
31
31
|
|
|
32
32
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
33
|
-
import { useReducer, useContext } from 'react';
|
|
33
|
+
import { useReducer, useContext, useCallback } from 'react';
|
|
34
34
|
import Element from '../element';
|
|
35
|
-
import FormContext from '
|
|
35
|
+
import FormContext from '../../form-context';
|
|
36
36
|
import { calcNamePath, calcFormItemProps } from '../../utils/form-utils';
|
|
37
37
|
import Typography from '../../typography';
|
|
38
38
|
import Button from '../../button';
|
|
@@ -56,7 +56,13 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
56
56
|
_config$style = config.style,
|
|
57
57
|
style = _config$style === void 0 ? {} : _config$style,
|
|
58
58
|
_config$max = config.max,
|
|
59
|
-
max = _config$max === void 0 ? Number.MAX_SAFE_INTEGER : _config$max
|
|
59
|
+
max = _config$max === void 0 ? Number.MAX_SAFE_INTEGER : _config$max,
|
|
60
|
+
_config$initCount = config.initCount,
|
|
61
|
+
initCount = _config$initCount === void 0 ? 1 : _config$initCount,
|
|
62
|
+
_config$min = config.min,
|
|
63
|
+
min = _config$min === void 0 ? initCount : _config$min,
|
|
64
|
+
addButtonText = config.addButtonText,
|
|
65
|
+
addButtonIcon = config.addButtonIcon;
|
|
60
66
|
|
|
61
67
|
var _useContext = useContext(LocaleContext),
|
|
62
68
|
formatMessage = _useContext.formatMessage;
|
|
@@ -66,8 +72,7 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
66
72
|
requiredMark = _useContext2.requiredMark;
|
|
67
73
|
|
|
68
74
|
var namePath = calcNamePath(parentName, name);
|
|
69
|
-
|
|
70
|
-
var _useReducer = useReducer(function (state, action) {
|
|
75
|
+
var reducer = useCallback(function (state, action) {
|
|
71
76
|
if (action.type === 'add') {
|
|
72
77
|
return [].concat(_toConsumableArray(state), [action.key]);
|
|
73
78
|
}
|
|
@@ -76,19 +81,36 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
76
81
|
return state.filter(function (key, index) {
|
|
77
82
|
if (key === action.key) {
|
|
78
83
|
found = true;
|
|
79
|
-
return false;
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
if (found) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
if (index === state.length - 1) {
|
|
88
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
89
|
+
name: calcNamePath(namePath, index),
|
|
90
|
+
value: undefined
|
|
91
|
+
}]);
|
|
92
|
+
} else {
|
|
93
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
94
|
+
name: calcNamePath(namePath, index),
|
|
95
|
+
value: form.getFieldValue(calcNamePath(namePath, index + 1))
|
|
96
|
+
}]);
|
|
97
|
+
}
|
|
87
98
|
}
|
|
88
99
|
|
|
89
|
-
return
|
|
100
|
+
return key !== action.key;
|
|
90
101
|
});
|
|
91
|
-
}, [
|
|
102
|
+
}, []);
|
|
103
|
+
|
|
104
|
+
var _useReducer = useReducer(reducer, function () {
|
|
105
|
+
var init = [];
|
|
106
|
+
var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
|
|
107
|
+
|
|
108
|
+
for (var i = 0; i < Math.max(min, value.length, initCount); i++) {
|
|
109
|
+
init.push(Date.now() + Math.random());
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return init;
|
|
113
|
+
}()),
|
|
92
114
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
93
115
|
groupKeys = _useReducer2[0],
|
|
94
116
|
dispath = _useReducer2[1];
|
|
@@ -121,16 +143,16 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
121
143
|
return _jsxs(_Col, {
|
|
122
144
|
span: 24,
|
|
123
145
|
className: 'igloo-freeform-addable-section',
|
|
124
|
-
children: [label && _jsxs(_Row, {
|
|
146
|
+
children: [(groupKeys.length > min && !preview || label) && _jsxs(_Row, {
|
|
125
147
|
justify: "space-between",
|
|
126
|
-
className: 'igloo-
|
|
127
|
-
children: [_jsxs(Typography, _objectSpread(_objectSpread({}, labelProps), {}, {
|
|
148
|
+
className: 'igloo-addable-section-label',
|
|
149
|
+
children: [label ? _jsxs(Typography, _objectSpread(_objectSpread({}, labelProps), {}, {
|
|
128
150
|
level: "h4",
|
|
129
151
|
wrapElement: "div",
|
|
130
152
|
children: [label, " ", index + 1]
|
|
131
|
-
}), void 0), groupKeys.length >
|
|
153
|
+
}), void 0) : _jsx("div", {}, void 0), groupKeys.length > min && !preview && _jsx(Button, {
|
|
132
154
|
type: "link",
|
|
133
|
-
className: "igloo-
|
|
155
|
+
className: "igloo-addable-section-label-remove",
|
|
134
156
|
onClick: function onClick() {
|
|
135
157
|
return dispath({
|
|
136
158
|
type: 'remove',
|
|
@@ -169,17 +191,18 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
169
191
|
style: {
|
|
170
192
|
marginTop: 16
|
|
171
193
|
},
|
|
172
|
-
children:
|
|
194
|
+
children: _jsx(Button, {
|
|
173
195
|
onClick: function onClick() {
|
|
174
196
|
return dispath({
|
|
175
197
|
type: 'add',
|
|
176
198
|
key: Date.now()
|
|
177
199
|
});
|
|
178
200
|
},
|
|
179
|
-
className: "igloo-
|
|
180
|
-
|
|
201
|
+
className: "igloo-addable-section-button",
|
|
202
|
+
icon: addButtonIcon,
|
|
203
|
+
children: addButtonText || "".concat(formatMessage({
|
|
181
204
|
id: 'Add'
|
|
182
|
-
}), " "
|
|
205
|
+
}), " ").concat(label)
|
|
183
206
|
}, void 0)
|
|
184
207
|
}, void 0)]
|
|
185
208
|
}, void 0);
|
package/es/form/divider/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import "antd/es/divider/style";
|
|
|
2
2
|
import _Divider from "antd/es/divider";
|
|
3
3
|
var _excluded = ["className"];
|
|
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
|
|
package/es/form/element/index.js
CHANGED
|
@@ -13,13 +13,13 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
13
13
|
|
|
14
14
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
15
15
|
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
16
|
+
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; }
|
|
17
17
|
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
18
|
+
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; }
|
|
19
19
|
|
|
20
20
|
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; }
|
|
21
21
|
|
|
22
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
22
|
+
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); }
|
|
23
23
|
|
|
24
24
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
25
25
|
|
|
@@ -43,12 +43,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
43
43
|
|
|
44
44
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
45
45
|
import { useContext, useEffect, useRef, useReducer } from 'react';
|
|
46
|
-
import {
|
|
46
|
+
import { AlertFilled } from 'iglooicon';
|
|
47
47
|
import { calcFormItemProps } from '../../utils/form-utils';
|
|
48
48
|
import Section from '../section';
|
|
49
49
|
import AddableSection from '../addable-section';
|
|
50
50
|
import useComponent from '../elements';
|
|
51
|
-
import FormContext from '
|
|
51
|
+
import FormContext from '../../form-context';
|
|
52
52
|
import invariant from 'invariant';
|
|
53
53
|
import omit from 'omit.js';
|
|
54
54
|
import classNames from 'classnames';
|
|
@@ -88,7 +88,8 @@ var Element = function Element(_ref) {
|
|
|
88
88
|
getOptions = config.getOptions,
|
|
89
89
|
subscribedFields = config.subscribedFields,
|
|
90
90
|
disabled = config.disabled,
|
|
91
|
-
extraLabel = config.extraLabel
|
|
91
|
+
extraLabel = config.extraLabel,
|
|
92
|
+
requiredAsserts = config.requiredAsserts;
|
|
92
93
|
var dependentField = dependencies || [];
|
|
93
94
|
|
|
94
95
|
if (Array.isArray(subscribedFields)) {
|
|
@@ -102,13 +103,20 @@ var Element = function Element(_ref) {
|
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
|
|
106
|
+
if (requiredAsserts && requiredAsserts.length) {
|
|
107
|
+
requiredAsserts.forEach(function (_ref3) {
|
|
108
|
+
var field = _ref3.field;
|
|
109
|
+
return dependentField.push(field);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
105
113
|
if (copyValue) {
|
|
106
114
|
dependentField.push(copyValue.assert.field);
|
|
107
115
|
}
|
|
108
116
|
|
|
109
117
|
if (selectValue && selectValue.length) {
|
|
110
|
-
selectValue.forEach(function (
|
|
111
|
-
var assert =
|
|
118
|
+
selectValue.forEach(function (_ref4) {
|
|
119
|
+
var assert = _ref4.assert;
|
|
112
120
|
return dependentField.push(assert.field);
|
|
113
121
|
});
|
|
114
122
|
}
|
|
@@ -122,8 +130,8 @@ var Element = function Element(_ref) {
|
|
|
122
130
|
}
|
|
123
131
|
|
|
124
132
|
if (Array.isArray(disabled)) {
|
|
125
|
-
disabled.forEach(function (
|
|
126
|
-
var field =
|
|
133
|
+
disabled.forEach(function (_ref5) {
|
|
134
|
+
var field = _ref5.field;
|
|
127
135
|
return dependentField.push(field);
|
|
128
136
|
});
|
|
129
137
|
} else if (_typeof(disabled) === 'object') {
|
|
@@ -297,7 +305,7 @@ var Element = function Element(_ref) {
|
|
|
297
305
|
sm: 24,
|
|
298
306
|
xs: 24,
|
|
299
307
|
className: "igloo-element-preview-value",
|
|
300
|
-
children: [error && !!error.length && _jsx(
|
|
308
|
+
children: [error && !!error.length && _jsx(AlertFilled, {
|
|
301
309
|
className: "igloo-element-preview-value-icon"
|
|
302
310
|
}, void 0), previewFormater ? previewFormater(value, form) : value || '-']
|
|
303
311
|
}, void 0)]
|
package/es/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
|
|
|
@@ -34,7 +34,7 @@ import Pages from './pages';
|
|
|
34
34
|
import Page from './page';
|
|
35
35
|
import Steps from './steps';
|
|
36
36
|
import Login from './login';
|
|
37
|
-
import FormContext from '
|
|
37
|
+
import FormContext from '../form-context';
|
|
38
38
|
import messages from './messages';
|
|
39
39
|
import './style/index.less';
|
|
40
40
|
import classNames from 'classnames';
|
|
@@ -59,7 +59,8 @@ var IglooForm = function IglooForm(props, ref) {
|
|
|
59
59
|
return window;
|
|
60
60
|
} : _props$getScrollConta,
|
|
61
61
|
_props$onFirstModifie = props.onFirstModified,
|
|
62
|
-
onFirstModified = _props$onFirstModifie === void 0 ? function () {} : _props$onFirstModifie
|
|
62
|
+
onFirstModified = _props$onFirstModifie === void 0 ? function () {} : _props$onFirstModifie,
|
|
63
|
+
uploadApi = props.uploadApi;
|
|
63
64
|
|
|
64
65
|
var _Form$useForm = _Form.useForm(),
|
|
65
66
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
@@ -237,7 +238,8 @@ var IglooForm = function IglooForm(props, ref) {
|
|
|
237
238
|
requiredMark: requiredMark,
|
|
238
239
|
showSubmitButton: showSubmitButton,
|
|
239
240
|
getScrollContainer: getScrollContainer,
|
|
240
|
-
registerDependencies: registerDependencies
|
|
241
|
+
registerDependencies: registerDependencies,
|
|
242
|
+
uploadApi: uploadApi
|
|
241
243
|
}, locales),
|
|
242
244
|
children: _jsxs(_Form, {
|
|
243
245
|
form: form,
|
package/es/form/login/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
import { useContext } from 'react';
|
|
11
11
|
import Element from '../element';
|
|
12
12
|
import { calcNamePath } from '../../utils/form-utils';
|
|
13
|
-
import FormContext from '
|
|
13
|
+
import FormContext from '../../form-context';
|
|
14
14
|
import { LocaleContext } from '../../locale';
|
|
15
15
|
import './style/index.less';
|
|
16
16
|
|
package/es/form/page/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import { useContext, useEffect, useReducer } from 'react';
|
|
|
22
22
|
import Button from '../../button';
|
|
23
23
|
import Element from '../element';
|
|
24
24
|
import { calcNamePath } from '../../utils/form-utils';
|
|
25
|
-
import FormContext from '
|
|
25
|
+
import FormContext from '../../form-context';
|
|
26
26
|
import { LocaleContext } from '../../locale';
|
|
27
27
|
import './style/index.less';
|
|
28
28
|
|
package/es/form/pages/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { useState, useContext, useReducer, useEffect } from 'react';
|
|
|
24
24
|
import Button from '../../button';
|
|
25
25
|
import Page from '../page';
|
|
26
26
|
import { calcNamePath } from '../../utils/form-utils';
|
|
27
|
-
import FormContext from '
|
|
27
|
+
import FormContext from '../../form-context';
|
|
28
28
|
import { LocaleContext } from '../../locale';
|
|
29
29
|
import './style/index.less';
|
|
30
30
|
import invariant from 'invariant';
|
|
@@ -80,7 +80,6 @@ var Pages = function Pages(_ref) {
|
|
|
80
80
|
md = _useBreakpoint.md;
|
|
81
81
|
|
|
82
82
|
var renderElements = elements.filter(function (page) {
|
|
83
|
-
page.key = page.name || page.key || Math.random();
|
|
84
83
|
return typeof page.shouldRender !== 'function' || page.shouldRender(form);
|
|
85
84
|
});
|
|
86
85
|
|
|
@@ -194,7 +193,7 @@ var Pages = function Pages(_ref) {
|
|
|
194
193
|
parentName: calcNamePath(parentName, name),
|
|
195
194
|
showFooter: false
|
|
196
195
|
}, void 0)
|
|
197
|
-
}, child.key);
|
|
196
|
+
}, child.key || child.name);
|
|
198
197
|
}), _jsxs("div", {
|
|
199
198
|
className: 'igloo-pages-footer',
|
|
200
199
|
children: [current === 0 && _jsx("div", {}, void 0), current > 0 && _jsx(Button, {
|
|
@@ -56,21 +56,23 @@
|
|
|
56
56
|
padding: 0 16px 24px 16px;
|
|
57
57
|
display: flex;
|
|
58
58
|
flex-direction: column-reverse;
|
|
59
|
-
row-gap: 16px;
|
|
60
59
|
|
|
61
60
|
.igloo-pages-preview-button {
|
|
62
61
|
min-width: none;
|
|
63
62
|
width: 100%;
|
|
63
|
+
margin-top: 16px;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
.igloo-pages-next-button {
|
|
67
67
|
min-width: none;
|
|
68
68
|
width: 100%;
|
|
69
|
+
margin-top: 16px;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
.igloo-pages-cancel-button {
|
|
72
73
|
min-width: none;
|
|
73
74
|
width: 100%;
|
|
75
|
+
margin-top: 16px;
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
.igloo-pages-submit-button {
|
package/es/form/render/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useCallback } from 'react';
|
|
3
|
-
import FormContext from '
|
|
3
|
+
import FormContext from '../../form-context';
|
|
4
4
|
|
|
5
5
|
var RenderElement = function RenderElement(_ref) {
|
|
6
6
|
var _ref$render = _ref.render,
|
package/es/form/section/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import "antd/es/col/style";
|
|
|
4
4
|
import _Col from "antd/es/col";
|
|
5
5
|
var _excluded = ["elements", "name", "label", "labelProps", "contentProps", "style"];
|
|
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
|
|
|
@@ -17,7 +17,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
18
|
import { useContext } from 'react';
|
|
19
19
|
import Element from '../element';
|
|
20
|
-
import FormContext from '
|
|
20
|
+
import FormContext from '../../form-context';
|
|
21
21
|
import { calcNamePath, calcFormItemProps } from '../../utils/form-utils';
|
|
22
22
|
import Typography from '../../typography';
|
|
23
23
|
import './style/index.less';
|
package/es/form/step/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import { LocaleContext } from '../../locale';
|
|
|
25
25
|
import Button from '../../button';
|
|
26
26
|
import Element from '../element';
|
|
27
27
|
import { calcNamePath } from '../../utils/form-utils';
|
|
28
|
-
import FormContext from '
|
|
28
|
+
import FormContext from '../../form-context';
|
|
29
29
|
import './style/index.less';
|
|
30
30
|
var useBreakpoint = _Grid.useBreakpoint;
|
|
31
31
|
|
package/es/form/steps/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
18
18
|
import { useState, useContext, useEffect, useReducer } from 'react';
|
|
19
19
|
import Step from '../step';
|
|
20
20
|
import { calcNamePath } from '../../utils/form-utils';
|
|
21
|
-
import FormContext from '
|
|
21
|
+
import FormContext from '../../form-context';
|
|
22
22
|
import './style/index.less';
|
|
23
23
|
import invariant from 'invariant';
|
|
24
24
|
|
|
@@ -77,7 +77,6 @@ var Steps = function Steps(_ref) {
|
|
|
77
77
|
setCurrent(currentStep);
|
|
78
78
|
}, [currentStep]);
|
|
79
79
|
var renderElements = elements.filter(function (step) {
|
|
80
|
-
step.key = step.name || step.key;
|
|
81
80
|
return typeof step.shouldRender !== 'function' || step.shouldRender(form);
|
|
82
81
|
});
|
|
83
82
|
|
|
@@ -186,7 +185,7 @@ var Steps = function Steps(_ref) {
|
|
|
186
185
|
handleEdit: handleEdit,
|
|
187
186
|
showLastIndex: showLastIndex,
|
|
188
187
|
shouldScroll: shouldScroll
|
|
189
|
-
}, child.key);
|
|
188
|
+
}, child.key || child.name);
|
|
190
189
|
})
|
|
191
190
|
}, void 0)
|
|
192
191
|
}, void 0);
|
|
@@ -15,5 +15,6 @@ declare const _default: React.Context<{
|
|
|
15
15
|
showSubmitButton?: boolean | undefined;
|
|
16
16
|
getScrollContainer: () => HTMLElement | Window | null;
|
|
17
17
|
registerDependencies: (name: FormItemName | FormItemName[], updater: Function) => void;
|
|
18
|
+
uploadApi?: string | undefined;
|
|
18
19
|
}>;
|
|
19
20
|
export default _default;
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { FormItemProps } from 'antd/es/form';
|
|
3
3
|
import { FormItemConfig, FormItemName } from '../../types';
|
|
4
4
|
import './style/index.less';
|
|
@@ -8,6 +8,11 @@ export interface AddableSectionProps extends FormItemConfig {
|
|
|
8
8
|
preview?: boolean;
|
|
9
9
|
disabledFromParent?: boolean;
|
|
10
10
|
setShowStepButton?: (showButton: boolean) => void;
|
|
11
|
+
max?: number;
|
|
12
|
+
min?: number;
|
|
13
|
+
initCount?: number;
|
|
14
|
+
addButtonText?: string;
|
|
15
|
+
addButtonIcon?: ReactNode;
|
|
11
16
|
}
|
|
12
17
|
declare const AddableSection: FC<AddableSectionProps>;
|
|
13
18
|
export default AddableSection;
|