@pointcloud/pcloud-components 1.0.11 → 1.0.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.
|
@@ -12,8 +12,7 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
12
12
|
var DynamicFormItem = function DynamicFormItem(props) {
|
|
13
13
|
var _props$name = props.name,
|
|
14
14
|
name = _props$name === void 0 ? 'dynamicItems' : _props$name,
|
|
15
|
-
|
|
16
|
-
initialValue = _props$initialValue === void 0 ? [undefined] : _props$initialValue,
|
|
15
|
+
initialValue = props.initialValue,
|
|
17
16
|
rules = props.rules,
|
|
18
17
|
itemConfig = props.itemConfig,
|
|
19
18
|
_props$addButtonText = props.addButtonText,
|
|
@@ -26,7 +25,7 @@ var DynamicFormItem = function DynamicFormItem(props) {
|
|
|
26
25
|
_props$removeButtonPr = props.removeButtonProps,
|
|
27
26
|
removeButtonProps = _props$removeButtonPr === void 0 ? {} : _props$removeButtonPr,
|
|
28
27
|
_props$minItems = props.minItems,
|
|
29
|
-
minItems = _props$minItems === void 0 ?
|
|
28
|
+
minItems = _props$minItems === void 0 ? 1 : _props$minItems,
|
|
30
29
|
maxItems = props.maxItems,
|
|
31
30
|
_props$showAdd = props.showAdd,
|
|
32
31
|
showAdd = _props$showAdd === void 0 ? true : _props$showAdd,
|
|
@@ -34,6 +33,9 @@ var DynamicFormItem = function DynamicFormItem(props) {
|
|
|
34
33
|
showRemove = _props$showRemove === void 0 ? true : _props$showRemove,
|
|
35
34
|
_props$addPosition = props.addPosition,
|
|
36
35
|
addPosition = _props$addPosition === void 0 ? 'bottom' : _props$addPosition;
|
|
36
|
+
var _initialValue = initialValue !== null && initialValue !== void 0 ? initialValue : minItems === 0 ? [] : Array.from({
|
|
37
|
+
length: minItems
|
|
38
|
+
});
|
|
37
39
|
var renderItem = function renderItem(_ref, index, _ref2, totalFieldsCount) {
|
|
38
40
|
var key = _ref.key,
|
|
39
41
|
name = _ref.name;
|
|
@@ -86,7 +88,7 @@ var DynamicFormItem = function DynamicFormItem(props) {
|
|
|
86
88
|
};
|
|
87
89
|
return /*#__PURE__*/_jsx(Form.List, {
|
|
88
90
|
name: name,
|
|
89
|
-
initialValue:
|
|
91
|
+
initialValue: _initialValue,
|
|
90
92
|
rules: rules,
|
|
91
93
|
children: function children(fields, operation) {
|
|
92
94
|
return /*#__PURE__*/_jsxs(_Fragment, {
|