iglooform 3.7.5 → 3.7.6
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/.dumi/tmp/core/defineApp.ts +1 -1
- package/.dumi/tmp/core/helmet.ts +1 -1
- package/.dumi/tmp/core/history.ts +1 -1
- package/.dumi/tmp/core/historyIntelli.ts +1 -1
- package/.dumi/tmp/core/plugin.ts +2 -2
- package/.dumi/tmp/core/polyfill.ts +197 -197
- package/.dumi/tmp/core/route.tsx +33 -33
- package/.dumi/tmp/dumi/exports.ts +1 -1
- package/.dumi/tmp/dumi/locales/runtime.tsx +2 -2
- package/.dumi/tmp/dumi/meta/index.ts +33 -33
- package/.dumi/tmp/dumi/meta/runtime.ts +1 -1
- package/.dumi/tmp/dumi/theme/ContextWrapper.tsx +2 -2
- package/.dumi/tmp/dumi/theme/builtins/API.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Badge.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Container.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Previewer.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/SourceCode.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Table.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Tree.ts +1 -1
- package/.dumi/tmp/dumi/theme/layouts/DocLayout.ts +1 -1
- package/.dumi/tmp/dumi/theme/loading.tsx +1 -1
- package/.dumi/tmp/dumi/theme/slots/ColorSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Content.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/ContentFooter.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/ContentTabs.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Features.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Footer.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Header.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/HeaderExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Hero.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/HeroTitle.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/LangSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Logo.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Navbar.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/NavbarExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/NotFound.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/PreviewerActions.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/PreviewerActionsExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/RtlSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/SearchBar.ts +2 -2
- package/.dumi/tmp/dumi/theme/slots/SearchResult.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Sidebar.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/SocialIcon.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Toc.ts +1 -1
- package/.dumi/tmp/exports.ts +5 -5
- package/.dumi/tmp/testBrowser.tsx +3 -3
- package/.dumi/tmp/umi.ts +4 -4
- package/.idea/codeStyles/Project.xml +80 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/iglooformv3.iml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/es/form/addable-section/index.js +30 -3
- package/es/free-form/addable-section/index.js +29 -2
- package/lib/form/addable-section/index.js +28 -1
- package/lib/free-form/addable-section/index.js +28 -1
- package/package.json +1 -1
- package/es/checkbox/index.d.ts +0 -24
- package/es/form/index.d.ts +0 -4
- package/es/free-form/index.d.ts +0 -11
- package/es/utils/option-utils.d.ts +0 -29
- package/lib/checkbox/index.d.ts +0 -24
- package/lib/form/index.d.ts +0 -4
- package/lib/free-form/index.d.ts +0 -11
- package/lib/utils/option-utils.d.ts +0 -29
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
+
<code_scheme name="Project" version="173">
|
|
3
|
+
<HTMLCodeStyleSettings>
|
|
4
|
+
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
5
|
+
</HTMLCodeStyleSettings>
|
|
6
|
+
<JSCodeStyleSettings version="0">
|
|
7
|
+
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
8
|
+
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
9
|
+
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
10
|
+
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
11
|
+
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
12
|
+
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
13
|
+
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
14
|
+
</JSCodeStyleSettings>
|
|
15
|
+
<JetCodeStyleSettings>
|
|
16
|
+
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
|
17
|
+
</JetCodeStyleSettings>
|
|
18
|
+
<TypeScriptCodeStyleSettings version="0">
|
|
19
|
+
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
20
|
+
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
21
|
+
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
22
|
+
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
23
|
+
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
24
|
+
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
25
|
+
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
26
|
+
</TypeScriptCodeStyleSettings>
|
|
27
|
+
<VueCodeStyleSettings>
|
|
28
|
+
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
|
29
|
+
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
|
30
|
+
</VueCodeStyleSettings>
|
|
31
|
+
<codeStyleSettings language="HTML">
|
|
32
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
33
|
+
<indentOptions>
|
|
34
|
+
<option name="INDENT_SIZE" value="2" />
|
|
35
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
36
|
+
<option name="TAB_SIZE" value="2" />
|
|
37
|
+
</indentOptions>
|
|
38
|
+
</codeStyleSettings>
|
|
39
|
+
<codeStyleSettings language="JAVA">
|
|
40
|
+
<indentOptions>
|
|
41
|
+
<option name="INDENT_SIZE" value="2" />
|
|
42
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
43
|
+
<option name="TAB_SIZE" value="2" />
|
|
44
|
+
</indentOptions>
|
|
45
|
+
</codeStyleSettings>
|
|
46
|
+
<codeStyleSettings language="JavaScript">
|
|
47
|
+
<option name="SPACE_BEFORE_METHOD_PARENTHESES" value="true" />
|
|
48
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
49
|
+
<indentOptions>
|
|
50
|
+
<option name="INDENT_SIZE" value="2" />
|
|
51
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
52
|
+
<option name="TAB_SIZE" value="2" />
|
|
53
|
+
</indentOptions>
|
|
54
|
+
</codeStyleSettings>
|
|
55
|
+
<codeStyleSettings language="TypeScript">
|
|
56
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
57
|
+
<indentOptions>
|
|
58
|
+
<option name="INDENT_SIZE" value="2" />
|
|
59
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
60
|
+
<option name="TAB_SIZE" value="2" />
|
|
61
|
+
</indentOptions>
|
|
62
|
+
</codeStyleSettings>
|
|
63
|
+
<codeStyleSettings language="Vue">
|
|
64
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
65
|
+
<indentOptions>
|
|
66
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
67
|
+
</indentOptions>
|
|
68
|
+
</codeStyleSettings>
|
|
69
|
+
<codeStyleSettings language="XML">
|
|
70
|
+
<indentOptions>
|
|
71
|
+
<option name="INDENT_SIZE" value="2" />
|
|
72
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
73
|
+
<option name="TAB_SIZE" value="2" />
|
|
74
|
+
</indentOptions>
|
|
75
|
+
</codeStyleSettings>
|
|
76
|
+
<codeStyleSettings language="kotlin">
|
|
77
|
+
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
|
78
|
+
</codeStyleSettings>
|
|
79
|
+
</code_scheme>
|
|
80
|
+
</component>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/iglooformv3.iml" filepath="$PROJECT_DIR$/.idea/iglooformv3.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
|
@@ -14,8 +14,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
14
14
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
15
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
16
|
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; }
|
|
17
|
-
import React, { useReducer, useContext, useCallback } from 'react';
|
|
18
|
-
import { Col, Divider, Row, Grid } from 'antd';
|
|
17
|
+
import React, { useReducer, useContext, useCallback, useEffect } from 'react';
|
|
18
|
+
import { Col, Divider, Row, Grid, Form } from 'antd';
|
|
19
19
|
import Element from "../element";
|
|
20
20
|
import FormContext from "../../form-context";
|
|
21
21
|
import { calcNamePath, calcFormItemProps, calcAddableSectionAssertField } from "../../utils/form-utils";
|
|
@@ -66,6 +66,21 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
66
66
|
if (action.type === 'add') {
|
|
67
67
|
return [].concat(_toConsumableArray(state), [action.key]);
|
|
68
68
|
}
|
|
69
|
+
if (action.type === 'sync' && action.count !== undefined) {
|
|
70
|
+
var targetCount = Math.min(max, Math.max(min, action.count, initCount));
|
|
71
|
+
if (targetCount === state.length) {
|
|
72
|
+
return state;
|
|
73
|
+
}
|
|
74
|
+
if (targetCount > state.length) {
|
|
75
|
+
var newKeys = [];
|
|
76
|
+
for (var i = state.length; i < targetCount; i++) {
|
|
77
|
+
newKeys.push(Date.now() + Math.random());
|
|
78
|
+
}
|
|
79
|
+
return [].concat(_toConsumableArray(state), newKeys);
|
|
80
|
+
}
|
|
81
|
+
// targetCount < state.length
|
|
82
|
+
return state.slice(0, targetCount);
|
|
83
|
+
}
|
|
69
84
|
var found = false;
|
|
70
85
|
return state.filter(function (key, index) {
|
|
71
86
|
if (key === action.key) {
|
|
@@ -86,7 +101,7 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
86
101
|
}
|
|
87
102
|
return key !== action.key;
|
|
88
103
|
});
|
|
89
|
-
}, []);
|
|
104
|
+
}, [min, max, initCount]);
|
|
90
105
|
var _useReducer = useReducer(reducer, function () {
|
|
91
106
|
var init = [];
|
|
92
107
|
var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
|
|
@@ -98,6 +113,18 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
98
113
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
99
114
|
groupKeys = _useReducer2[0],
|
|
100
115
|
dispath = _useReducer2[1];
|
|
116
|
+
|
|
117
|
+
// 监听外部通过 form.setFieldsValue 设置的值变化
|
|
118
|
+
Form.useWatch(namePath, form);
|
|
119
|
+
var fieldValue = form === null || form === void 0 ? void 0 : form.getFieldValue(namePath);
|
|
120
|
+
useEffect(function () {
|
|
121
|
+
if (Array.isArray(fieldValue)) {
|
|
122
|
+
dispath({
|
|
123
|
+
type: 'sync',
|
|
124
|
+
count: fieldValue.length
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}, [fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.length]);
|
|
101
128
|
var _calcFormItemProps = calcFormItemProps(config, {
|
|
102
129
|
requiredMark: requiredMark
|
|
103
130
|
}, form, parentName, validationCodeExtraParams),
|
|
@@ -15,7 +15,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
15
15
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
17
|
import React, { useReducer, useContext, useEffect, useCallback, cloneElement, isValidElement } from 'react';
|
|
18
|
-
import { Col, Row } from 'antd';
|
|
18
|
+
import { Col, Row, Form } from 'antd';
|
|
19
19
|
import FormContext from "../../form-context";
|
|
20
20
|
import { calcNamePath, calcFormItemProps, calcAddableSectionAssertField } from "../../utils/form-utils";
|
|
21
21
|
import Typography from "../../typography";
|
|
@@ -68,6 +68,21 @@ var AddableSection = function AddableSection(props) {
|
|
|
68
68
|
if (action.type === 'add') {
|
|
69
69
|
return [].concat(_toConsumableArray(state), [action.key]);
|
|
70
70
|
}
|
|
71
|
+
if (action.type === 'sync' && action.count !== undefined) {
|
|
72
|
+
var targetCount = Math.min(max, Math.max(min, action.count, initCount));
|
|
73
|
+
if (targetCount === state.length) {
|
|
74
|
+
return state;
|
|
75
|
+
}
|
|
76
|
+
if (targetCount > state.length) {
|
|
77
|
+
var newKeys = [];
|
|
78
|
+
for (var i = state.length; i < targetCount; i++) {
|
|
79
|
+
newKeys.push(Date.now() + Math.random());
|
|
80
|
+
}
|
|
81
|
+
return [].concat(_toConsumableArray(state), newKeys);
|
|
82
|
+
}
|
|
83
|
+
// targetCount < state.length
|
|
84
|
+
return state.slice(0, targetCount);
|
|
85
|
+
}
|
|
71
86
|
var found = false;
|
|
72
87
|
return state.filter(function (key, index) {
|
|
73
88
|
if (key === action.key) {
|
|
@@ -88,7 +103,7 @@ var AddableSection = function AddableSection(props) {
|
|
|
88
103
|
}
|
|
89
104
|
return key !== action.key;
|
|
90
105
|
});
|
|
91
|
-
}, []);
|
|
106
|
+
}, [min, max, initCount]);
|
|
92
107
|
var _useReducer3 = useReducer(reducer, function () {
|
|
93
108
|
var init = [];
|
|
94
109
|
var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
|
|
@@ -100,6 +115,18 @@ var AddableSection = function AddableSection(props) {
|
|
|
100
115
|
_useReducer4 = _slicedToArray(_useReducer3, 2),
|
|
101
116
|
groupKeys = _useReducer4[0],
|
|
102
117
|
dispath = _useReducer4[1];
|
|
118
|
+
|
|
119
|
+
// 监听外部通过 form.setFieldsValue 设置的值变化
|
|
120
|
+
Form.useWatch(namePath, form);
|
|
121
|
+
var fieldValue = form === null || form === void 0 ? void 0 : form.getFieldValue(namePath);
|
|
122
|
+
useEffect(function () {
|
|
123
|
+
if (Array.isArray(fieldValue)) {
|
|
124
|
+
dispath({
|
|
125
|
+
type: 'sync',
|
|
126
|
+
count: fieldValue.length
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}, [fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.length]);
|
|
103
130
|
useEffect(function () {
|
|
104
131
|
var dependencies = props.dependencies,
|
|
105
132
|
asserts = props.asserts,
|
|
@@ -74,6 +74,21 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
74
74
|
if (action.type === 'add') {
|
|
75
75
|
return [].concat(_toConsumableArray(state), [action.key]);
|
|
76
76
|
}
|
|
77
|
+
if (action.type === 'sync' && action.count !== undefined) {
|
|
78
|
+
var targetCount = Math.min(max, Math.max(min, action.count, initCount));
|
|
79
|
+
if (targetCount === state.length) {
|
|
80
|
+
return state;
|
|
81
|
+
}
|
|
82
|
+
if (targetCount > state.length) {
|
|
83
|
+
var newKeys = [];
|
|
84
|
+
for (var i = state.length; i < targetCount; i++) {
|
|
85
|
+
newKeys.push(Date.now() + Math.random());
|
|
86
|
+
}
|
|
87
|
+
return [].concat(_toConsumableArray(state), newKeys);
|
|
88
|
+
}
|
|
89
|
+
// targetCount < state.length
|
|
90
|
+
return state.slice(0, targetCount);
|
|
91
|
+
}
|
|
77
92
|
var found = false;
|
|
78
93
|
return state.filter(function (key, index) {
|
|
79
94
|
if (key === action.key) {
|
|
@@ -94,7 +109,7 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
94
109
|
}
|
|
95
110
|
return key !== action.key;
|
|
96
111
|
});
|
|
97
|
-
}, []);
|
|
112
|
+
}, [min, max, initCount]);
|
|
98
113
|
var _useReducer = (0, _react.useReducer)(reducer, function () {
|
|
99
114
|
var init = [];
|
|
100
115
|
var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
|
|
@@ -106,6 +121,18 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
106
121
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
107
122
|
groupKeys = _useReducer2[0],
|
|
108
123
|
dispath = _useReducer2[1];
|
|
124
|
+
|
|
125
|
+
// 监听外部通过 form.setFieldsValue 设置的值变化
|
|
126
|
+
_antd.Form.useWatch(namePath, form);
|
|
127
|
+
var fieldValue = form === null || form === void 0 ? void 0 : form.getFieldValue(namePath);
|
|
128
|
+
(0, _react.useEffect)(function () {
|
|
129
|
+
if (Array.isArray(fieldValue)) {
|
|
130
|
+
dispath({
|
|
131
|
+
type: 'sync',
|
|
132
|
+
count: fieldValue.length
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}, [fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.length]);
|
|
109
136
|
var _calcFormItemProps = (0, _formUtils.calcFormItemProps)(config, {
|
|
110
137
|
requiredMark: requiredMark
|
|
111
138
|
}, form, parentName, validationCodeExtraParams),
|
|
@@ -75,6 +75,21 @@ var AddableSection = function AddableSection(props) {
|
|
|
75
75
|
if (action.type === 'add') {
|
|
76
76
|
return [].concat(_toConsumableArray(state), [action.key]);
|
|
77
77
|
}
|
|
78
|
+
if (action.type === 'sync' && action.count !== undefined) {
|
|
79
|
+
var targetCount = Math.min(max, Math.max(min, action.count, initCount));
|
|
80
|
+
if (targetCount === state.length) {
|
|
81
|
+
return state;
|
|
82
|
+
}
|
|
83
|
+
if (targetCount > state.length) {
|
|
84
|
+
var newKeys = [];
|
|
85
|
+
for (var i = state.length; i < targetCount; i++) {
|
|
86
|
+
newKeys.push(Date.now() + Math.random());
|
|
87
|
+
}
|
|
88
|
+
return [].concat(_toConsumableArray(state), newKeys);
|
|
89
|
+
}
|
|
90
|
+
// targetCount < state.length
|
|
91
|
+
return state.slice(0, targetCount);
|
|
92
|
+
}
|
|
78
93
|
var found = false;
|
|
79
94
|
return state.filter(function (key, index) {
|
|
80
95
|
if (key === action.key) {
|
|
@@ -95,7 +110,7 @@ var AddableSection = function AddableSection(props) {
|
|
|
95
110
|
}
|
|
96
111
|
return key !== action.key;
|
|
97
112
|
});
|
|
98
|
-
}, []);
|
|
113
|
+
}, [min, max, initCount]);
|
|
99
114
|
var _useReducer3 = (0, _react.useReducer)(reducer, function () {
|
|
100
115
|
var init = [];
|
|
101
116
|
var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
|
|
@@ -107,6 +122,18 @@ var AddableSection = function AddableSection(props) {
|
|
|
107
122
|
_useReducer4 = _slicedToArray(_useReducer3, 2),
|
|
108
123
|
groupKeys = _useReducer4[0],
|
|
109
124
|
dispath = _useReducer4[1];
|
|
125
|
+
|
|
126
|
+
// 监听外部通过 form.setFieldsValue 设置的值变化
|
|
127
|
+
_antd.Form.useWatch(namePath, form);
|
|
128
|
+
var fieldValue = form === null || form === void 0 ? void 0 : form.getFieldValue(namePath);
|
|
129
|
+
(0, _react.useEffect)(function () {
|
|
130
|
+
if (Array.isArray(fieldValue)) {
|
|
131
|
+
dispath({
|
|
132
|
+
type: 'sync',
|
|
133
|
+
count: fieldValue.length
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}, [fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.length]);
|
|
110
137
|
(0, _react.useEffect)(function () {
|
|
111
138
|
var dependencies = props.dependencies,
|
|
112
139
|
asserts = props.asserts,
|
package/package.json
CHANGED
package/es/checkbox/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { CheckboxProps, CheckboxGroupProps } from 'antd/es/checkbox';
|
|
3
|
-
import { FC, IglooComponentProps } from '../types';
|
|
4
|
-
import { ComponentProps } from '../utils/option-utils';
|
|
5
|
-
import { DefaultOptionType } from 'rc-select/lib/Select';
|
|
6
|
-
import './style';
|
|
7
|
-
interface Props extends IglooComponentProps, CheckboxProps {
|
|
8
|
-
}
|
|
9
|
-
export interface Option extends DefaultOptionType {
|
|
10
|
-
extraInfo?: {
|
|
11
|
-
content: any;
|
|
12
|
-
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface IProps extends IglooComponentProps, Omit<CheckboxGroupProps, 'options'>, ComponentProps {
|
|
16
|
-
className?: string;
|
|
17
|
-
radioType?: string;
|
|
18
|
-
options: Option[];
|
|
19
|
-
preview?: boolean;
|
|
20
|
-
mutuallyExclusions?: Record<string, string[]>;
|
|
21
|
-
}
|
|
22
|
-
declare const IglooCheckbox: FC<Props>;
|
|
23
|
-
export default IglooCheckbox;
|
|
24
|
-
export declare const CheckboxGroup: FC<import("react").PropsWithChildren<import("../utils/option-utils").HOCProps & IProps>>;
|
package/es/form/index.d.ts
DELETED
package/es/free-form/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import { Form } from 'antd';
|
|
3
|
-
import { FormBasicConfig } from '../types';
|
|
4
|
-
import './style';
|
|
5
|
-
interface FreeFormProps extends Omit<FormBasicConfig, 'config'> {
|
|
6
|
-
}
|
|
7
|
-
interface FreeFormType extends FC<PropsWithChildren<FreeFormProps>> {
|
|
8
|
-
useForm: typeof Form.useForm;
|
|
9
|
-
}
|
|
10
|
-
declare const FreeForm: FreeFormType;
|
|
11
|
-
export default FreeForm;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { FC, IglooComponentProps } from '../types';
|
|
3
|
-
import { FormInstance } from 'antd/es/form';
|
|
4
|
-
import { NamePath } from 'antd/es/form/interface';
|
|
5
|
-
import { SelectProps, SelectValue } from 'antd/es/select';
|
|
6
|
-
export declare const compareOptions: (newOptions: any[], oldOptions?: any[]) => boolean;
|
|
7
|
-
export declare const compareSelected: (newValue: any | any[], oldValue: any | any[]) => boolean;
|
|
8
|
-
type Options = SelectProps<SelectValue>['options'];
|
|
9
|
-
export interface HOCProps extends IglooComponentProps {
|
|
10
|
-
options?: Options;
|
|
11
|
-
onSearch?: any;
|
|
12
|
-
getOptions?: (form: FormInstance) => any[];
|
|
13
|
-
optionGroups?: {
|
|
14
|
-
parentKey: string;
|
|
15
|
-
options: Options;
|
|
16
|
-
}[];
|
|
17
|
-
datasourceFilters?: string[];
|
|
18
|
-
datasourceKey?: string;
|
|
19
|
-
datasourceApi?: string;
|
|
20
|
-
dependField?: NamePath;
|
|
21
|
-
passCompareOptions?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export interface ComponentProps extends IglooComponentProps {
|
|
24
|
-
options?: Options;
|
|
25
|
-
clearWhenOptionsUpdated?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare function optionsHOC<T>(Component: FC<T>): FC<PropsWithChildren<HOCProps & T>>;
|
|
28
|
-
export declare function previewSelectedOptions(options: Options, value: any): any;
|
|
29
|
-
export {};
|
package/lib/checkbox/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { CheckboxProps, CheckboxGroupProps } from 'antd/es/checkbox';
|
|
3
|
-
import { FC, IglooComponentProps } from '../types';
|
|
4
|
-
import { ComponentProps } from '../utils/option-utils';
|
|
5
|
-
import { DefaultOptionType } from 'rc-select/lib/Select';
|
|
6
|
-
import './style';
|
|
7
|
-
interface Props extends IglooComponentProps, CheckboxProps {
|
|
8
|
-
}
|
|
9
|
-
export interface Option extends DefaultOptionType {
|
|
10
|
-
extraInfo?: {
|
|
11
|
-
content: any;
|
|
12
|
-
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface IProps extends IglooComponentProps, Omit<CheckboxGroupProps, 'options'>, ComponentProps {
|
|
16
|
-
className?: string;
|
|
17
|
-
radioType?: string;
|
|
18
|
-
options: Option[];
|
|
19
|
-
preview?: boolean;
|
|
20
|
-
mutuallyExclusions?: Record<string, string[]>;
|
|
21
|
-
}
|
|
22
|
-
declare const IglooCheckbox: FC<Props>;
|
|
23
|
-
export default IglooCheckbox;
|
|
24
|
-
export declare const CheckboxGroup: FC<import("react").PropsWithChildren<import("../utils/option-utils").HOCProps & IProps>>;
|
package/lib/form/index.d.ts
DELETED
package/lib/free-form/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import { Form } from 'antd';
|
|
3
|
-
import { FormBasicConfig } from '../types';
|
|
4
|
-
import './style';
|
|
5
|
-
interface FreeFormProps extends Omit<FormBasicConfig, 'config'> {
|
|
6
|
-
}
|
|
7
|
-
interface FreeFormType extends FC<PropsWithChildren<FreeFormProps>> {
|
|
8
|
-
useForm: typeof Form.useForm;
|
|
9
|
-
}
|
|
10
|
-
declare const FreeForm: FreeFormType;
|
|
11
|
-
export default FreeForm;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { FC, IglooComponentProps } from '../types';
|
|
3
|
-
import { FormInstance } from 'antd/es/form';
|
|
4
|
-
import { NamePath } from 'antd/es/form/interface';
|
|
5
|
-
import { SelectProps, SelectValue } from 'antd/es/select';
|
|
6
|
-
export declare const compareOptions: (newOptions: any[], oldOptions?: any[]) => boolean;
|
|
7
|
-
export declare const compareSelected: (newValue: any | any[], oldValue: any | any[]) => boolean;
|
|
8
|
-
type Options = SelectProps<SelectValue>['options'];
|
|
9
|
-
export interface HOCProps extends IglooComponentProps {
|
|
10
|
-
options?: Options;
|
|
11
|
-
onSearch?: any;
|
|
12
|
-
getOptions?: (form: FormInstance) => any[];
|
|
13
|
-
optionGroups?: {
|
|
14
|
-
parentKey: string;
|
|
15
|
-
options: Options;
|
|
16
|
-
}[];
|
|
17
|
-
datasourceFilters?: string[];
|
|
18
|
-
datasourceKey?: string;
|
|
19
|
-
datasourceApi?: string;
|
|
20
|
-
dependField?: NamePath;
|
|
21
|
-
passCompareOptions?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export interface ComponentProps extends IglooComponentProps {
|
|
24
|
-
options?: Options;
|
|
25
|
-
clearWhenOptionsUpdated?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare function optionsHOC<T>(Component: FC<T>): FC<PropsWithChildren<HOCProps & T>>;
|
|
28
|
-
export declare function previewSelectedOptions(options: Options, value: any): any;
|
|
29
|
-
export {};
|