iglooform 2.4.11 → 2.4.12
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.
|
@@ -9,28 +9,28 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
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
35
|
import FormContext from '../../form-context';
|
|
36
36
|
import { calcNamePath, calcFormItemProps } from '../../utils/form-utils';
|
|
@@ -72,36 +72,36 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
72
72
|
requiredMark = _useContext2.requiredMark;
|
|
73
73
|
|
|
74
74
|
var namePath = calcNamePath(parentName, name);
|
|
75
|
-
|
|
76
|
-
var _useReducer = useReducer(function (state, action) {
|
|
75
|
+
var reducer = useCallback(function (state, action) {
|
|
77
76
|
if (action.type === 'add') {
|
|
78
77
|
return [].concat(_toConsumableArray(state), [action.key]);
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
var found = false;
|
|
82
81
|
return state.filter(function (key, index) {
|
|
83
|
-
if (index === state.length - 1) {
|
|
84
|
-
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
85
|
-
name: calcNamePath(namePath, index),
|
|
86
|
-
value: undefined
|
|
87
|
-
}]);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
82
|
if (key === action.key) {
|
|
91
83
|
found = true;
|
|
92
|
-
return false;
|
|
93
84
|
}
|
|
94
85
|
|
|
95
86
|
if (found) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
+
}
|
|
100
98
|
}
|
|
101
99
|
|
|
102
|
-
return
|
|
100
|
+
return key !== action.key;
|
|
103
101
|
});
|
|
104
|
-
},
|
|
102
|
+
}, []);
|
|
103
|
+
|
|
104
|
+
var _useReducer = useReducer(reducer, function () {
|
|
105
105
|
var init = [];
|
|
106
106
|
var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
|
|
107
107
|
|
|
@@ -32,7 +32,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
32
32
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
33
|
|
|
34
34
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
35
|
-
import { useReducer, useContext, useEffect, cloneElement, isValidElement } from 'react';
|
|
35
|
+
import { useReducer, useContext, useEffect, useCallback, cloneElement, isValidElement } from 'react';
|
|
36
36
|
import FormContext from '../../form-context';
|
|
37
37
|
import { calcNamePath, calcFormItemProps } from '../../utils/form-utils';
|
|
38
38
|
import Typography from '../../typography';
|
|
@@ -78,36 +78,36 @@ var AddableSection = function AddableSection(props) {
|
|
|
78
78
|
registerDependencies = _useContext2.registerDependencies;
|
|
79
79
|
|
|
80
80
|
var namePath = calcNamePath(parentName, name);
|
|
81
|
-
|
|
82
|
-
var _useReducer3 = useReducer(function (state, action) {
|
|
81
|
+
var reducer = useCallback(function (state, action) {
|
|
83
82
|
if (action.type === 'add') {
|
|
84
83
|
return [].concat(_toConsumableArray(state), [action.key]);
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
var found = false;
|
|
88
87
|
return state.filter(function (key, index) {
|
|
89
|
-
if (index === state.length - 1) {
|
|
90
|
-
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
91
|
-
name: calcNamePath(namePath, index),
|
|
92
|
-
value: undefined
|
|
93
|
-
}]);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
88
|
if (key === action.key) {
|
|
97
89
|
found = true;
|
|
98
|
-
return false;
|
|
99
90
|
}
|
|
100
91
|
|
|
101
92
|
if (found) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
93
|
+
if (index === state.length - 1) {
|
|
94
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
95
|
+
name: calcNamePath(namePath, index),
|
|
96
|
+
value: undefined
|
|
97
|
+
}]);
|
|
98
|
+
} else {
|
|
99
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
100
|
+
name: calcNamePath(namePath, index),
|
|
101
|
+
value: form.getFieldValue(calcNamePath(namePath, index + 1))
|
|
102
|
+
}]);
|
|
103
|
+
}
|
|
106
104
|
}
|
|
107
105
|
|
|
108
|
-
return
|
|
106
|
+
return key !== action.key;
|
|
109
107
|
});
|
|
110
|
-
},
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
var _useReducer3 = useReducer(reducer, function () {
|
|
111
111
|
var init = [];
|
|
112
112
|
var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
|
|
113
113
|
|
|
@@ -39,25 +39,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
39
39
|
|
|
40
40
|
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; }
|
|
41
41
|
|
|
42
|
-
function
|
|
42
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
43
43
|
|
|
44
|
-
function
|
|
44
|
+
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."); }
|
|
45
45
|
|
|
46
|
-
function
|
|
46
|
+
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; }
|
|
47
47
|
|
|
48
|
-
function
|
|
48
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
49
|
|
|
50
|
-
function
|
|
50
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
51
51
|
|
|
52
|
-
function
|
|
52
|
+
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."); }
|
|
53
53
|
|
|
54
54
|
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); }
|
|
55
55
|
|
|
56
|
-
function
|
|
56
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
57
57
|
|
|
58
|
-
function
|
|
58
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
59
59
|
|
|
60
|
-
function
|
|
60
|
+
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; }
|
|
61
61
|
|
|
62
62
|
var AddableSection = function AddableSection(_ref) {
|
|
63
63
|
var parentName = _ref.parentName,
|
|
@@ -92,36 +92,36 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
92
92
|
requiredMark = _useContext2.requiredMark;
|
|
93
93
|
|
|
94
94
|
var namePath = (0, _formUtils.calcNamePath)(parentName, name);
|
|
95
|
-
|
|
96
|
-
var _useReducer = (0, _react.useReducer)(function (state, action) {
|
|
95
|
+
var reducer = (0, _react.useCallback)(function (state, action) {
|
|
97
96
|
if (action.type === 'add') {
|
|
98
97
|
return [].concat(_toConsumableArray(state), [action.key]);
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
var found = false;
|
|
102
101
|
return state.filter(function (key, index) {
|
|
103
|
-
if (index === state.length - 1) {
|
|
104
|
-
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
105
|
-
name: (0, _formUtils.calcNamePath)(namePath, index),
|
|
106
|
-
value: undefined
|
|
107
|
-
}]);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
102
|
if (key === action.key) {
|
|
111
103
|
found = true;
|
|
112
|
-
return false;
|
|
113
104
|
}
|
|
114
105
|
|
|
115
106
|
if (found) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
107
|
+
if (index === state.length - 1) {
|
|
108
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
109
|
+
name: (0, _formUtils.calcNamePath)(namePath, index),
|
|
110
|
+
value: undefined
|
|
111
|
+
}]);
|
|
112
|
+
} else {
|
|
113
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
114
|
+
name: (0, _formUtils.calcNamePath)(namePath, index),
|
|
115
|
+
value: form.getFieldValue((0, _formUtils.calcNamePath)(namePath, index + 1))
|
|
116
|
+
}]);
|
|
117
|
+
}
|
|
120
118
|
}
|
|
121
119
|
|
|
122
|
-
return
|
|
120
|
+
return key !== action.key;
|
|
123
121
|
});
|
|
124
|
-
},
|
|
122
|
+
}, []);
|
|
123
|
+
|
|
124
|
+
var _useReducer = (0, _react.useReducer)(reducer, function () {
|
|
125
125
|
var init = [];
|
|
126
126
|
var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
|
|
127
127
|
|
|
@@ -97,36 +97,36 @@ var AddableSection = function AddableSection(props) {
|
|
|
97
97
|
registerDependencies = _useContext2.registerDependencies;
|
|
98
98
|
|
|
99
99
|
var namePath = (0, _formUtils.calcNamePath)(parentName, name);
|
|
100
|
-
|
|
101
|
-
var _useReducer3 = (0, _react.useReducer)(function (state, action) {
|
|
100
|
+
var reducer = (0, _react.useCallback)(function (state, action) {
|
|
102
101
|
if (action.type === 'add') {
|
|
103
102
|
return [].concat(_toConsumableArray(state), [action.key]);
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
var found = false;
|
|
107
106
|
return state.filter(function (key, index) {
|
|
108
|
-
if (index === state.length - 1) {
|
|
109
|
-
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
110
|
-
name: (0, _formUtils.calcNamePath)(namePath, index),
|
|
111
|
-
value: undefined
|
|
112
|
-
}]);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
107
|
if (key === action.key) {
|
|
116
108
|
found = true;
|
|
117
|
-
return false;
|
|
118
109
|
}
|
|
119
110
|
|
|
120
111
|
if (found) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
if (index === state.length - 1) {
|
|
113
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
114
|
+
name: (0, _formUtils.calcNamePath)(namePath, index),
|
|
115
|
+
value: undefined
|
|
116
|
+
}]);
|
|
117
|
+
} else {
|
|
118
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
119
|
+
name: (0, _formUtils.calcNamePath)(namePath, index),
|
|
120
|
+
value: form.getFieldValue((0, _formUtils.calcNamePath)(namePath, index + 1))
|
|
121
|
+
}]);
|
|
122
|
+
}
|
|
125
123
|
}
|
|
126
124
|
|
|
127
|
-
return
|
|
125
|
+
return key !== action.key;
|
|
128
126
|
});
|
|
129
|
-
},
|
|
127
|
+
}, []);
|
|
128
|
+
|
|
129
|
+
var _useReducer3 = (0, _react.useReducer)(reducer, function () {
|
|
130
130
|
var init = [];
|
|
131
131
|
var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
|
|
132
132
|
|