uiw 4.10.6 → 4.10.7
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/dist/uiw.js +22 -14
- package/dist/uiw.min.js +1 -1
- package/package.json +55 -55
package/dist/uiw.js
CHANGED
|
@@ -6812,7 +6812,8 @@ var isPromise = function isPromise(promise) {
|
|
|
6812
6812
|
return promise && typeof promise.then === 'function';
|
|
6813
6813
|
};
|
|
6814
6814
|
|
|
6815
|
-
function Form(_ref, ref
|
|
6815
|
+
function Form(_ref, ref //| React.RefObject<FormRefType>,
|
|
6816
|
+
) {
|
|
6816
6817
|
var _ref$prefixCls = _ref.prefixCls,
|
|
6817
6818
|
prefixCls = _ref$prefixCls === void 0 ? 'w-form' : _ref$prefixCls,
|
|
6818
6819
|
className = _ref.className,
|
|
@@ -6825,19 +6826,26 @@ function Form(_ref, ref) {
|
|
|
6825
6826
|
afterSubmit = _ref.afterSubmit,
|
|
6826
6827
|
others = _objectWithoutPropertiesLoose(_ref, Form_excluded);
|
|
6827
6828
|
|
|
6828
|
-
var initData =
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6829
|
+
var initData = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
|
|
6830
|
+
return newFormState(fields, function (_ref2) {
|
|
6831
|
+
var initialValue = _ref2.initialValue;
|
|
6832
|
+
initialValue = newInitialValue(initialValue);
|
|
6833
|
+
return {
|
|
6834
|
+
initialValue: initialValue,
|
|
6835
|
+
currentValue: initialValue
|
|
6836
|
+
};
|
|
6837
|
+
});
|
|
6838
|
+
}, []);
|
|
6836
6839
|
|
|
6837
|
-
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(initData),
|
|
6840
|
+
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(JSON.parse(JSON.stringify(initData))),
|
|
6838
6841
|
_useState2 = _slicedToArray(_useState, 2),
|
|
6839
6842
|
data = _useState2[0],
|
|
6840
|
-
|
|
6843
|
+
setDatas = _useState2[1];
|
|
6844
|
+
|
|
6845
|
+
var setData = function setData(values) {
|
|
6846
|
+
// 解决value为数组时不进行深拷贝,initvalue无法重置问题
|
|
6847
|
+
setDatas(JSON.parse(JSON.stringify(values)));
|
|
6848
|
+
};
|
|
6841
6849
|
|
|
6842
6850
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, function () {
|
|
6843
6851
|
return {
|
|
@@ -7012,10 +7020,10 @@ function Form(_ref, ref) {
|
|
|
7012
7020
|
props.id = element.props.id;
|
|
7013
7021
|
props.value = hasCurrentValue ? data.current && data.current[name] : props.value; // : element.props.value;
|
|
7014
7022
|
|
|
7015
|
-
var type = element.props.type;
|
|
7023
|
+
var type = element.props.type; // console.log('type', element)
|
|
7016
7024
|
|
|
7017
|
-
if (type === 'checkbox' || type === 'switch') {
|
|
7018
|
-
props.checked = !!props.
|
|
7025
|
+
if (type === 'checkbox' || type === 'switch' || typeof props.value === 'boolean') {
|
|
7026
|
+
props.checked = !!props.value;
|
|
7019
7027
|
delete props.value;
|
|
7020
7028
|
}
|
|
7021
7029
|
|