@zat-design/sisyphus-react 3.13.7 → 3.13.9
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/ProAction/components/CheckModalContent/index.css +22 -0
- package/es/ProAction/components/CheckModalContent/index.d.ts +8 -0
- package/es/ProAction/components/CheckModalContent/index.js +38 -0
- package/es/ProAction/components/CheckModalContent/index.less +28 -0
- package/es/ProAction/index.js +39 -41
- package/es/ProAction/index.less +5 -6
- package/es/ProAction/propsType.d.ts +8 -6
- package/es/ProDownload/index.js +4 -3
- package/es/ProDownload/utils.js +5 -4
- package/es/ProDrawerForm/components/ProDrawer/index.js +2 -2
- package/es/ProDrawerForm/components/ProModal/index.js +2 -2
- package/es/ProEditLabel/components/RenderProForm.js +3 -3
- package/es/ProEditLabel/index.js +2 -2
- package/es/ProEditTable/components/ActionButton/index.js +9 -8
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +6 -6
- package/es/ProEditTable/components/RenderField/index.js +20 -16
- package/es/ProEditTable/index.js +10 -7
- package/es/ProEditTable/utils/config.js +3 -3
- package/es/ProEditTable/utils/diffOriginal.js +6 -4
- package/es/ProEditTable/utils/getDefaultProps.js +8 -7
- package/es/ProEditTable/utils/index.js +21 -18
- package/es/ProEditTable/utils/tools.js +32 -24
- package/es/ProEditTable/utils/useEditTableError.js +2 -2
- package/es/ProEnum/index.js +16 -11
- package/es/ProEnum/utils/eventCenter.js +2 -2
- package/es/ProEnum/utils/getEnumLabel.js +5 -4
- package/es/ProEnum/utils/index.js +3 -2
- package/es/ProForm/components/base/DatePicker/index.js +11 -8
- package/es/ProForm/components/base/Input/index.js +3 -3
- package/es/ProForm/components/base/InputNumber/index.js +6 -4
- package/es/ProForm/components/base/RangePicker/index.js +12 -8
- package/es/ProForm/components/base/Select/index.js +2 -2
- package/es/ProForm/components/base/Switch/index.js +3 -2
- package/es/ProForm/components/base/SwitchCheckbox/index.js +3 -2
- package/es/ProForm/components/base/TextArea/index.js +2 -2
- package/es/ProForm/components/combination/Container/index.js +2 -2
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +7 -6
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +2 -2
- package/es/ProForm/components/combination/FormList/components/BlockTitle.js +2 -2
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +5 -4
- package/es/ProForm/components/combination/FormList/index.js +2 -2
- package/es/ProForm/components/combination/FormList/utils.js +2 -2
- package/es/ProForm/components/combination/Group/hooks/index.js +4 -3
- package/es/ProForm/components/combination/Group/index.js +2 -2
- package/es/ProForm/components/combination/Group/utils.js +6 -6
- package/es/ProForm/components/combination/ProCascader/index.js +6 -4
- package/es/ProForm/components/combination/ProCascader/utils/index.js +2 -2
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +3 -3
- package/es/ProForm/components/combination/ProModalSelect/index.js +13 -10
- package/es/ProForm/components/combination/ProNumberRange/index.js +2 -2
- package/es/ProForm/components/combination/ProRangeLimit/index.js +8 -5
- package/es/ProForm/components/combination/ProTimeLimit/index.js +10 -7
- package/es/ProForm/components/old/EnumSelect/hooks/useRequestList.js +3 -3
- package/es/ProForm/components/old/EnumSelect/index.js +3 -3
- package/es/ProForm/components/render/ChangedWrapper.js +3 -3
- package/es/ProForm/components/render/ConfirmWrapper.js +4 -3
- package/es/ProForm/components/render/Render.js +17 -13
- package/es/ProForm/components/render/RenderFields.js +9 -6
- package/es/ProForm/index.js +6 -4
- package/es/ProForm/utils/_useChanged.js +3 -3
- package/es/ProForm/utils/_useListChanged.js +6 -6
- package/es/ProForm/utils/diffOriginal.js +6 -4
- package/es/ProForm/utils/getDefaultProps.js +7 -6
- package/es/ProForm/utils/index.js +20 -15
- package/es/ProForm/utils/rulesCreator.js +4 -3
- package/es/ProForm/utils/transformNames.js +2 -2
- package/es/ProForm/utils/transformValue.js +3 -3
- package/es/ProForm/utils/useDeepCompareMemo.js +2 -2
- package/es/ProForm/utils/useRules.js +4 -3
- package/es/ProForm/utils/useShouldUpdate.js +23 -21
- package/es/ProForm/utils/useWatch.js +2 -2
- package/es/ProForm/utils/valueType.js +2 -2
- package/es/ProIcon/index.js +2 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +2 -2
- package/es/ProLayout/components/ProCollapse/index.js +2 -2
- package/es/ProLayout/components/ProHeader/index.js +12 -9
- package/es/ProLayout/utils/index.js +3 -2
- package/es/ProSelect/index.js +11 -7
- package/es/ProSelect/utils/index.js +5 -3
- package/es/ProStep/components/Item/index.js +2 -2
- package/es/ProStep/components/Listener/index.js +2 -2
- package/es/ProStep/components/Step/index.js +2 -2
- package/es/ProStep/index.js +2 -2
- package/es/ProStep/utils/index.js +4 -3
- package/es/ProStepTab/index.js +3 -3
- package/es/ProTable/components/FormatColumn/index.js +16 -12
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +3 -3
- package/es/ProTable/components/RenderColumn/index.js +2 -2
- package/es/ProTable/components/RenderSummary/index.js +3 -3
- package/es/ProTable/hooks/useAntdTable.js +15 -10
- package/es/ProTable/index.js +12 -7
- package/es/ProTable/utils/index.js +5 -4
- package/es/ProTabs/index.js +2 -2
- package/es/ProThemeTools/index.js +2 -2
- package/es/ProTree/components/ProTree.js +5 -4
- package/es/ProTree/components/ProTreeSelect/index.js +6 -5
- package/es/ProTreeModal/index.js +5 -4
- package/es/ProUpload/components/ImageRender.js +2 -2
- package/es/ProUpload/index.js +5 -4
- package/es/old/ProEditableTable/index.js +7 -7
- package/es/old/ProEditableTable/utils.js +2 -2
- package/lib/ProAction/components/CheckModalContent/index.css +22 -0
- package/lib/ProAction/components/CheckModalContent/index.d.ts +8 -0
- package/lib/ProAction/components/CheckModalContent/index.js +45 -0
- package/lib/ProAction/components/CheckModalContent/index.less +28 -0
- package/lib/ProAction/index.js +45 -44
- package/lib/ProAction/index.less +5 -6
- package/lib/ProAction/propsType.d.ts +8 -6
- package/lib/ProConfigProvider/index.js +3 -2
- package/lib/ProDownload/index.js +7 -6
- package/lib/ProDownload/utils.js +9 -7
- package/lib/ProDrawerForm/components/ProDrawer/index.js +12 -7
- package/lib/ProDrawerForm/components/ProModal/index.js +12 -7
- package/lib/ProEditLabel/components/RenderProForm.js +6 -5
- package/lib/ProEditLabel/index.js +15 -8
- package/lib/ProEditTable/components/ActionButton/index.js +15 -11
- package/lib/ProEditTable/components/RcTable/BaseTable.js +6 -3
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +3 -2
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +14 -11
- package/lib/ProEditTable/components/RenderField/index.js +25 -20
- package/lib/ProEditTable/components/RenderToolbar/index.js +3 -2
- package/lib/ProEditTable/components/Summary/index.js +8 -5
- package/lib/ProEditTable/components/Validator/index.js +7 -3
- package/lib/ProEditTable/index.js +20 -12
- package/lib/ProEditTable/utils/config.js +8 -7
- package/lib/ProEditTable/utils/diffOriginal.js +7 -4
- package/lib/ProEditTable/utils/getDefaultProps.js +8 -7
- package/lib/ProEditTable/utils/index.js +27 -21
- package/lib/ProEditTable/utils/tools.js +32 -24
- package/lib/ProEditTable/utils/useEditTableError.js +2 -2
- package/lib/ProEnum/index.js +31 -19
- package/lib/ProEnum/utils/eventCenter.js +2 -2
- package/lib/ProEnum/utils/getEnumLabel.js +5 -4
- package/lib/ProEnum/utils/index.js +3 -2
- package/lib/ProForm/components/Container.js +3 -2
- package/lib/ProForm/components/FormFooter/index.js +7 -4
- package/lib/ProForm/components/base/Checkbox/index.js +4 -3
- package/lib/ProForm/components/base/DatePicker/index.js +14 -10
- package/lib/ProForm/components/base/Input/index.js +6 -5
- package/lib/ProForm/components/base/InputNumber/index.js +12 -7
- package/lib/ProForm/components/base/Radio/index.js +4 -3
- package/lib/ProForm/components/base/RangePicker/index.js +15 -10
- package/lib/ProForm/components/base/Select/index.js +5 -4
- package/lib/ProForm/components/base/Switch/index.js +6 -4
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +6 -4
- package/lib/ProForm/components/base/TextArea/index.js +5 -4
- package/lib/ProForm/components/base/TimePicker/index.js +3 -2
- package/lib/ProForm/components/combination/Container/index.js +2 -2
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +16 -10
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +8 -5
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +2 -2
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +3 -2
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +10 -6
- package/lib/ProForm/components/combination/FormList/index.js +5 -4
- package/lib/ProForm/components/combination/FormList/utils.js +2 -2
- package/lib/ProForm/components/combination/Group/hooks/index.js +4 -3
- package/lib/ProForm/components/combination/Group/index.js +6 -5
- package/lib/ProForm/components/combination/Group/utils.js +10 -9
- package/lib/ProForm/components/combination/ProCascader/index.js +14 -7
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +2 -2
- package/lib/ProForm/components/combination/ProCombination/index.js +9 -4
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +3 -3
- package/lib/ProForm/components/combination/ProModalSelect/index.js +35 -19
- package/lib/ProForm/components/combination/ProNumberRange/index.js +17 -10
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +17 -9
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +19 -11
- package/lib/ProForm/components/old/EnumSelect/hooks/useRequestList.js +3 -3
- package/lib/ProForm/components/old/EnumSelect/index.js +15 -8
- package/lib/ProForm/components/old/InputRange/index.js +8 -5
- package/lib/ProForm/components/old/InputWithSuffix/index.js +4 -3
- package/lib/ProForm/components/old/ProAddress/index.js +18 -11
- package/lib/ProForm/components/old/ProCertNo/index.js +12 -7
- package/lib/ProForm/components/old/ProCertValidity/index.js +11 -6
- package/lib/ProForm/components/old/ProRangeBox/index.js +21 -12
- package/lib/ProForm/components/render/ChangedWrapper.js +11 -8
- package/lib/ProForm/components/render/ConfirmWrapper.js +8 -6
- package/lib/ProForm/components/render/Render.js +34 -23
- package/lib/ProForm/components/render/RenderFields.js +9 -6
- package/lib/ProForm/index.js +21 -12
- package/lib/ProForm/utils/_useChanged.js +7 -5
- package/lib/ProForm/utils/_useListChanged.js +10 -8
- package/lib/ProForm/utils/diffOriginal.js +7 -4
- package/lib/ProForm/utils/getDefaultProps.js +8 -6
- package/lib/ProForm/utils/index.js +20 -15
- package/lib/ProForm/utils/rulesCreator.js +4 -3
- package/lib/ProForm/utils/transformNames.js +3 -2
- package/lib/ProForm/utils/transformValue.js +3 -3
- package/lib/ProForm/utils/useDeepCompareMemo.js +3 -2
- package/lib/ProForm/utils/useForm.js +3 -2
- package/lib/ProForm/utils/useRules.js +4 -3
- package/lib/ProForm/utils/useShouldUpdate.js +23 -21
- package/lib/ProForm/utils/useWatch.js +2 -2
- package/lib/ProForm/utils/valueType.js +2 -2
- package/lib/ProIcon/index.js +13 -8
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +6 -3
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +5 -4
- package/lib/ProLayout/components/ProCollapse/index.js +13 -8
- package/lib/ProLayout/components/ProFooter/index.js +3 -2
- package/lib/ProLayout/components/ProHeader/components/Copy/index.js +3 -2
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +3 -2
- package/lib/ProLayout/components/ProHeader/index.js +37 -25
- package/lib/ProLayout/index.js +3 -2
- package/lib/ProLayout/utils/index.js +2 -2
- package/lib/ProSelect/components/AdaptiveTooltip.js +3 -2
- package/lib/ProSelect/index.js +25 -14
- package/lib/ProSelect/utils/index.js +4 -4
- package/lib/ProStep/components/Anchor/index.js +3 -2
- package/lib/ProStep/components/Item/index.js +2 -2
- package/lib/ProStep/components/Listener/index.js +2 -2
- package/lib/ProStep/components/Step/index.js +2 -2
- package/lib/ProStep/index.js +2 -2
- package/lib/ProStep/utils/index.js +4 -3
- package/lib/ProStepTab/index.js +3 -3
- package/lib/ProTable/components/FormatColumn/index.js +26 -21
- package/lib/ProTable/components/RcTable/components/BaseTable/index.js +3 -2
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +3 -3
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +3 -2
- package/lib/ProTable/components/RenderColumn/index.js +17 -12
- package/lib/ProTable/components/RenderSummary/index.js +8 -7
- package/lib/ProTable/components/RenderTableHeader/index.js +5 -3
- package/lib/ProTable/components/RenderTabs/index.js +6 -3
- package/lib/ProTable/components/TooltipTitle/index.js +3 -2
- package/lib/ProTable/hooks/useAntdTable.js +21 -13
- package/lib/ProTable/index.js +12 -7
- package/lib/ProTable/utils/index.js +5 -4
- package/lib/ProTabs/components/Card/index.js +11 -5
- package/lib/ProTabs/index.js +5 -4
- package/lib/ProThemeTools/component/ProTools/index.js +19 -12
- package/lib/ProThemeTools/index.js +12 -9
- package/lib/ProThemeTools/utils/index.js +3 -2
- package/lib/ProTooltip/index.js +5 -4
- package/lib/ProTree/components/AdaptiveTooltip.js +4 -2
- package/lib/ProTree/components/List.js +4 -3
- package/lib/ProTree/components/ProTree.js +17 -9
- package/lib/ProTree/components/ProTreeSelect/index.js +22 -14
- package/lib/ProTree/components/Tree.js +6 -3
- package/lib/ProTreeModal/components/Cascader.js +4 -3
- package/lib/ProTreeModal/components/List.js +14 -9
- package/lib/ProTreeModal/components/SortableItem.js +3 -2
- package/lib/ProTreeModal/components/Tree.js +4 -3
- package/lib/ProTreeModal/components/Trigger.js +11 -6
- package/lib/ProTreeModal/index.js +21 -13
- package/lib/ProUpload/components/ButtonRender.js +6 -3
- package/lib/ProUpload/components/DragRender.js +3 -2
- package/lib/ProUpload/components/FileItem.js +15 -10
- package/lib/ProUpload/components/ImageRender.js +19 -10
- package/lib/ProUpload/index.js +9 -7
- package/lib/ProViewer/index.js +9 -4
- package/lib/old/ProCertValidity/index.js +11 -6
- package/lib/old/ProEditableTable/index.js +36 -23
- package/lib/old/ProEditableTable/utils.js +35 -18
- package/package.json +2 -1
@@ -1,9 +1,12 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
+
import _isString from "lodash/isString";
|
4
|
+
import _union from "lodash/union";
|
5
|
+
import _isFunction from "lodash/isFunction";
|
6
|
+
import _isBoolean from "lodash/isBoolean";
|
3
7
|
var _excluded = ["show", "type", "viewRender", "viewType", "valueType", "formItemProps", "colProps", "formItemChildProps", "fieldProps", "onDiff", "clearNotShow", "required", "confirm", "desensitization", "span"];
|
4
8
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
5
9
|
import React from 'react';
|
6
|
-
import { isBoolean, isFunction, union, isString } from 'lodash';
|
7
10
|
import Render from './Render';
|
8
11
|
import { getDefaultProps } from '../../utils/getDefaultProps';
|
9
12
|
import * as componentMap from '../index';
|
@@ -104,7 +107,7 @@ var RenderFields = function RenderFields(props) {
|
|
104
107
|
// FormList场景
|
105
108
|
if (Array.isArray(column === null || column === void 0 ? void 0 : column.namePath) && (column === null || column === void 0 ? void 0 : (_column$namePath = column.namePath) === null || _column$namePath === void 0 ? void 0 : _column$namePath.length)) {
|
106
109
|
// @ts-ignore
|
107
|
-
value = form.getFieldValue(
|
110
|
+
value = form.getFieldValue(_union(column.namePath, (column === null || column === void 0 ? void 0 : column.name) || []));
|
108
111
|
record = form.getFieldValue(column.namePath);
|
109
112
|
index = column === null || column === void 0 ? void 0 : column.index;
|
110
113
|
}
|
@@ -142,13 +145,13 @@ var RenderFields = function RenderFields(props) {
|
|
142
145
|
type: _type
|
143
146
|
});
|
144
147
|
var placeholderHandle = function placeholderHandle() {
|
145
|
-
var _label =
|
146
|
-
var _formLabel =
|
148
|
+
var _label = _isString(label) ? label : '';
|
149
|
+
var _formLabel = _isString(formLabel) ? formLabel : '';
|
147
150
|
return placeholder || "".concat(_isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(_label || _formLabel || '');
|
148
151
|
};
|
149
152
|
// 表单组件Props 兼容2.0版本
|
150
153
|
var _fieldProps = _objectSpread(_objectSpread({}, formItemChildProps), fieldProps);
|
151
|
-
if (
|
154
|
+
if (_isBoolean(formDisabled)) {
|
152
155
|
_fieldProps.disabled = formDisabled;
|
153
156
|
}
|
154
157
|
var componentProps = _objectSpread(_objectSpread({
|
@@ -215,7 +218,7 @@ var RenderFields = function RenderFields(props) {
|
|
215
218
|
colProps: _colProps,
|
216
219
|
componentProps: componentProps,
|
217
220
|
otherProps: otherProps,
|
218
|
-
fieldProps:
|
221
|
+
fieldProps: _isFunction(fieldProps) ? fieldProps : null,
|
219
222
|
isSelect: _isSelect,
|
220
223
|
diffConfig: diffConfig,
|
221
224
|
onDiff: onDiff,
|
package/es/ProForm/index.js
CHANGED
@@ -11,12 +11,14 @@ import "antd/es/space/style";
|
|
11
11
|
import _Space from "antd/es/space";
|
12
12
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
14
|
+
import _omit from "lodash/omit";
|
15
|
+
import _merge from "lodash/merge";
|
16
|
+
import _isObject from "lodash/isObject";
|
14
17
|
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "diffConfig", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "formKey", "globalControl", "scrollToError", "optimize", "desensitizationKey", "stopOnFirstError"];
|
15
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
16
19
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
17
20
|
import classnames from 'classnames';
|
18
21
|
import React, { forwardRef, useImperativeHandle, useMemo, useEffect } from 'react';
|
19
|
-
import { isObject, merge, omit } from 'lodash';
|
20
22
|
import { FormFooter, InputRange, ProAddress, ProCascader, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
|
21
23
|
import RenderFields from './components/render/RenderFields';
|
22
24
|
import { useProConfig } from '../ProConfigProvider';
|
@@ -178,7 +180,7 @@ var ProForm = function ProForm(props, ref) {
|
|
178
180
|
}
|
179
181
|
return {};
|
180
182
|
});
|
181
|
-
onValuesChange(filterInternalFields(
|
183
|
+
onValuesChange(filterInternalFields(_merge.apply(void 0, [changedValue].concat(_toConsumableArray(values))), optimize), form.getFieldsValue());
|
182
184
|
}
|
183
185
|
};
|
184
186
|
// 包装一层兼容 names 改变
|
@@ -200,7 +202,7 @@ var ProForm = function ProForm(props, ref) {
|
|
200
202
|
} else if (/*#__PURE__*/React.isValidElement(footer)) {
|
201
203
|
// 传入组件渲染组件
|
202
204
|
footerEle = footer;
|
203
|
-
} else if (footer === undefined || footer ||
|
205
|
+
} else if (footer === undefined || footer || _isObject(footer)) {
|
204
206
|
// 不传或者传入对象 渲染默认
|
205
207
|
footerEle = defaultFooter(footer);
|
206
208
|
}
|
@@ -234,7 +236,7 @@ var ProForm = function ProForm(props, ref) {
|
|
234
236
|
},
|
235
237
|
className: cls,
|
236
238
|
form: form
|
237
|
-
}, formProps),
|
239
|
+
}, formProps), _omit(config, ['isDiffAll'])), otherProps), {}, {
|
238
240
|
labelAlign: (_ref3 = labelAlign !== null && labelAlign !== void 0 ? labelAlign : config.labelAlign) !== null && _ref3 !== void 0 ? _ref3 : 'left',
|
239
241
|
onValuesChange: handleValuesChange,
|
240
242
|
onFinish: handleFinish,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import "antd/es/form/style";
|
2
2
|
import _Form from "antd/es/form";
|
3
|
-
import
|
3
|
+
import _get from "lodash/get";
|
4
4
|
import { diffOriginal } from './diffOriginal';
|
5
5
|
export var useChanged = function useChanged(_ref) {
|
6
6
|
var name = _ref.name,
|
@@ -10,8 +10,8 @@ export var useChanged = function useChanged(_ref) {
|
|
10
10
|
form = _ref.form,
|
11
11
|
onDiff = _ref.onDiff;
|
12
12
|
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
13
|
-
return
|
14
|
-
}) :
|
13
|
+
return _get(originalValues, name);
|
14
|
+
}) : _get(originalValues, name);
|
15
15
|
var notWatch = !onDiff && (!originalValues || originalValue === undefined);
|
16
16
|
if (notWatch) return [false];
|
17
17
|
var value = _Form.useWatch(namesStr || name, form);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import "antd/es/form/style";
|
2
2
|
import _Form from "antd/es/form";
|
3
|
-
import
|
3
|
+
import _get from "lodash/get";
|
4
4
|
import { diffOriginal } from './diffOriginal';
|
5
5
|
var toNamePath = function toNamePath(name) {
|
6
6
|
if (Array.isArray(name)) {
|
@@ -30,14 +30,14 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
30
30
|
if (!rowValue) return undefined;
|
31
31
|
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
32
32
|
if (!keyValue) return undefined;
|
33
|
-
var originalValueList =
|
33
|
+
var originalValueList = _get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
34
34
|
var originalValueRow = originalValueList.find(function (item) {
|
35
35
|
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
36
36
|
});
|
37
37
|
var originalValue;
|
38
38
|
if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
|
39
39
|
var originalNamesValue = originalNames.map(function (originalName) {
|
40
|
-
return
|
40
|
+
return _get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
41
41
|
});
|
42
42
|
// 有可能出现数组中全是undefined的情况 视为没有值
|
43
43
|
var fillUndefined = originalNamesValue.every(function (valItem) {
|
@@ -45,14 +45,14 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
45
45
|
});
|
46
46
|
originalValue = fillUndefined ? undefined : originalNamesValue;
|
47
47
|
} else {
|
48
|
-
originalValue =
|
48
|
+
originalValue = _get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
49
49
|
}
|
50
50
|
return originalValue;
|
51
51
|
}
|
52
52
|
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
53
53
|
return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
54
|
-
return
|
55
|
-
}) :
|
54
|
+
return _get(originalValues, originalName);
|
55
|
+
}) : _get(originalValues, originalName);
|
56
56
|
};
|
57
57
|
export var useListChanged = function useListChanged(params) {
|
58
58
|
var name = params.name,
|
@@ -1,9 +1,11 @@
|
|
1
|
-
import
|
1
|
+
import _isObject from "lodash/isObject";
|
2
|
+
import _isFunction from "lodash/isFunction";
|
3
|
+
import _isEqual from "lodash/isEqual";
|
2
4
|
import { isEmpty } from '../../utils';
|
3
5
|
// 过滤对象中undefined字段
|
4
6
|
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
5
7
|
var filterObject = function filterObject(data) {
|
6
|
-
if (!
|
8
|
+
if (!_isObject(data) || data === null) return data;
|
7
9
|
// ['1', undefined] ['1', ''] 视为相等
|
8
10
|
if (Array.isArray(data)) {
|
9
11
|
// 数组中全是empty值的话 视为null
|
@@ -32,7 +34,7 @@ export var diffOriginal = function diffOriginal(params) {
|
|
32
34
|
value = params.value,
|
33
35
|
onDiff = params.onDiff;
|
34
36
|
// 支持传入自定义比较事件
|
35
|
-
if (
|
37
|
+
if (_isFunction(onDiff)) {
|
36
38
|
var diffRes = onDiff(originalValue, value);
|
37
39
|
// 如果返回undefined走内置比较逻辑
|
38
40
|
if (diffRes !== undefined) {
|
@@ -50,5 +52,5 @@ export var diffOriginal = function diffOriginal(params) {
|
|
50
52
|
if (isEmptyOrg && isEmptyVal) return 'same';
|
51
53
|
// 如果原始值为空 且当前有值的话 视为新增
|
52
54
|
if (isEmptyOrg && !isEmptyVal) return 'add';
|
53
|
-
return
|
55
|
+
return _isEqual(_value, _originalValue) ? 'same' : 'changed';
|
54
56
|
};
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import _isEqual from "lodash/isEqual";
|
2
|
+
import _get from "lodash/get";
|
2
3
|
var defaultPropsMap = {
|
3
4
|
ProSelect: function ProSelect(props) {
|
4
5
|
var fieldProps = props.fieldProps,
|
@@ -12,13 +13,13 @@ var defaultPropsMap = {
|
|
12
13
|
var _listName = namePath.slice(0, -1);
|
13
14
|
var _namePath = name.slice(1);
|
14
15
|
defaultProps.shouldUpdate = function (preValues, curValues) {
|
15
|
-
var preListValue =
|
16
|
-
return
|
16
|
+
var preListValue = _get(preValues, _listName).map(function (item) {
|
17
|
+
return _get(item, _namePath);
|
17
18
|
});
|
18
|
-
var curListValue =
|
19
|
-
return
|
19
|
+
var curListValue = _get(curValues, _listName).map(function (item) {
|
20
|
+
return _get(item, _namePath);
|
20
21
|
});
|
21
|
-
return !
|
22
|
+
return !_isEqual(preListValue, curListValue);
|
22
23
|
};
|
23
24
|
}
|
24
25
|
return defaultProps;
|
@@ -2,9 +2,14 @@ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIt
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
|
+
import _isNaN from "lodash/isNaN";
|
6
|
+
import _omit from "lodash/omit";
|
7
|
+
import _set from "lodash/set";
|
8
|
+
import _get from "lodash/get";
|
9
|
+
import _isFunction from "lodash/isFunction";
|
10
|
+
import _isObject from "lodash/isObject";
|
5
11
|
import React, { useState } from 'react';
|
6
12
|
import moment from 'moment';
|
7
|
-
import _, { isObject, isFunction, get, set, omit, isNaN } from 'lodash';
|
8
13
|
export var getLayout = function getLayout(params) {
|
9
14
|
var _params$span = params.span,
|
10
15
|
span = _params$span === void 0 ? 8 : _params$span,
|
@@ -110,7 +115,7 @@ export var weedOutProps = function weedOutProps(data, keys) {
|
|
110
115
|
// 对比字段变化
|
111
116
|
export var diffField = function diffField(prevValues, curValues, names) {
|
112
117
|
return names.some(function (name) {
|
113
|
-
return
|
118
|
+
return _get(prevValues, name) !== _get(curValues, name);
|
114
119
|
});
|
115
120
|
};
|
116
121
|
// 表单name展开
|
@@ -137,7 +142,7 @@ var _filterInternalFields = function filterInternalFields(values, optimize) {
|
|
137
142
|
return _filterInternalFields(item);
|
138
143
|
});
|
139
144
|
}
|
140
|
-
if (
|
145
|
+
if (_isObject(nextValues)) {
|
141
146
|
var result = {};
|
142
147
|
Object.keys(nextValues).forEach(function (key) {
|
143
148
|
if (key.includes('-')) return;
|
@@ -161,7 +166,7 @@ var _getAllNamePath = function getAllNamePath(object) {
|
|
161
166
|
}));
|
162
167
|
}
|
163
168
|
// 深度获取对象key
|
164
|
-
if (
|
169
|
+
if (_isObject(value)) {
|
165
170
|
resultKeys.concat(_getAllNamePath(value, [].concat(_toConsumableArray(currentPath), [key])));
|
166
171
|
}
|
167
172
|
resultKeys.push([].concat(_toConsumableArray(currentPath), [key]));
|
@@ -268,9 +273,9 @@ export function initialValuesToNames() {
|
|
268
273
|
}).join('-');
|
269
274
|
var formInitialValue = item.names.map(function (name, index) {
|
270
275
|
if (item.initialValue) {
|
271
|
-
|
276
|
+
_set(values, name, item.initialValue[index]);
|
272
277
|
}
|
273
|
-
return
|
278
|
+
return _get(values, name);
|
274
279
|
});
|
275
280
|
// 过滤掉不存在的初始值 防止names字段值为空数组
|
276
281
|
var namesInitialValue = formInitialValue.filter(function (item) {
|
@@ -281,7 +286,7 @@ export function initialValuesToNames() {
|
|
281
286
|
}
|
282
287
|
}
|
283
288
|
// 给FormList默认增加一行
|
284
|
-
if (item.type === 'FormList' && !item.initialValue && !
|
289
|
+
if (item.type === 'FormList' && !item.initialValue && !_get(values, item.name)) {
|
285
290
|
item.initialValue = [{}];
|
286
291
|
}
|
287
292
|
});
|
@@ -299,7 +304,7 @@ export function getArrayBeforeNumber(arr) {
|
|
299
304
|
}
|
300
305
|
// 自定义深比对 如果两边都是函数类型则认为相等
|
301
306
|
export var customEqualForFun = function customEqualForFun(value, other) {
|
302
|
-
if (
|
307
|
+
if (_isFunction(value) && _isFunction(other) || /*#__PURE__*/React.isValidElement(value) && /*#__PURE__*/React.isValidElement(other)) {
|
303
308
|
return true;
|
304
309
|
}
|
305
310
|
};
|
@@ -370,18 +375,18 @@ export var deleteForPath = function deleteForPath(values, namePath) {
|
|
370
375
|
* @returns {}
|
371
376
|
*/
|
372
377
|
var _findOptionByValue = function findOptionByValue(treeData, value, fieldNames) {
|
373
|
-
if (
|
378
|
+
if (_isObject(value)) {
|
374
379
|
return value;
|
375
380
|
}
|
376
381
|
for (var i = 0; i < (treeData === null || treeData === void 0 ? void 0 : treeData.length); i++) {
|
377
382
|
var node = treeData[i];
|
378
383
|
if (node[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value'] === value) {
|
379
|
-
return
|
384
|
+
return _omit(node, ['children', fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]);
|
380
385
|
}
|
381
386
|
if (node.children) {
|
382
387
|
var foundNode = _findOptionByValue(node[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'], value, fieldNames);
|
383
388
|
if (foundNode) {
|
384
|
-
return
|
389
|
+
return _omit(foundNode, ['children', fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]);
|
385
390
|
}
|
386
391
|
}
|
387
392
|
}
|
@@ -393,8 +398,8 @@ export { _findOptionByValue as findOptionByValue };
|
|
393
398
|
export var equalDependencies = function equalDependencies(dependencies, prevValues, currentValues) {
|
394
399
|
if (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) {
|
395
400
|
return dependencies.some(function (namePath) {
|
396
|
-
var prevValue =
|
397
|
-
var currentValue =
|
401
|
+
var prevValue = _get(prevValues, namePath);
|
402
|
+
var currentValue = _get(currentValues, namePath);
|
398
403
|
return prevValue !== currentValue;
|
399
404
|
});
|
400
405
|
}
|
@@ -404,12 +409,12 @@ export var equalDependencies = function equalDependencies(dependencies, prevValu
|
|
404
409
|
export var parseNamePath = function parseNamePath(input) {
|
405
410
|
var parts = input.split('_');
|
406
411
|
if (parts.every(function (item) {
|
407
|
-
return
|
412
|
+
return _isNaN(Number(item));
|
408
413
|
})) {
|
409
414
|
return [input];
|
410
415
|
}
|
411
416
|
var result = parts.map(function (item) {
|
412
|
-
return
|
417
|
+
return _isNaN(Number(item)) ? item : Number(item);
|
413
418
|
});
|
414
419
|
return [result];
|
415
420
|
};
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _isNumber from "lodash/isNumber";
|
3
|
+
import _isString from "lodash/isString";
|
2
4
|
import { validate, regExp } from '@zat-design/utils';
|
3
|
-
import { isString, isNumber } from 'lodash';
|
4
5
|
import { isNullValue } from './index';
|
5
6
|
import locale, { formatMessage } from '../../locale';
|
6
7
|
var getNonEmptyValuesByIndex = function getNonEmptyValuesByIndex(required, valueArray) {
|
7
8
|
var result = [];
|
8
9
|
required.forEach(function (item, index) {
|
9
|
-
if (item && !(valueArray === null || valueArray === void 0 ? void 0 : valueArray[index]) && !
|
10
|
+
if (item && !(valueArray === null || valueArray === void 0 ? void 0 : valueArray[index]) && !_isNumber(valueArray === null || valueArray === void 0 ? void 0 : valueArray[index])) {
|
10
11
|
result.push(index + 1);
|
11
12
|
}
|
12
13
|
});
|
@@ -20,7 +21,7 @@ export var rulesCreator = function rulesCreator(_ref) {
|
|
20
21
|
isSelect = _ref.isSelect,
|
21
22
|
names = _ref.names,
|
22
23
|
required = _ref.required;
|
23
|
-
var message = "".concat(isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(locale.ProForm.ruleText).concat(
|
24
|
+
var message = "".concat(isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(locale.ProForm.ruleText).concat(_isString(label) ? label : '');
|
24
25
|
var result = [];
|
25
26
|
if (Array.isArray(rules)) {
|
26
27
|
result = rules.map(function (ruleItem) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import _union from "lodash/union";
|
2
2
|
import { transformValue } from './transformValue';
|
3
3
|
var transformNames = function transformNames(formItem, form, names, fieldName, type) {
|
4
4
|
var _ref = formItem || {},
|
@@ -9,7 +9,7 @@ var transformNames = function transformNames(formItem, form, names, fieldName, t
|
|
9
9
|
return {};
|
10
10
|
}
|
11
11
|
// 当在formList场景下,给transformValue函数的setFiledProps的name, 需要全namePath
|
12
|
-
var _fieldName = Array.isArray(formItem === null || formItem === void 0 ? void 0 : formItem.name) ?
|
12
|
+
var _fieldName = Array.isArray(formItem === null || formItem === void 0 ? void 0 : formItem.name) ? _union(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, formItem === null || formItem === void 0 ? void 0 : formItem.name) : fieldName;
|
13
13
|
var _transformValue = transformValue(names, form, _fieldName, normalize, getValueProps),
|
14
14
|
_normalize = _transformValue.normalize,
|
15
15
|
_getValueProps = _transformValue.getValueProps,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import
|
2
|
+
import _set from "lodash/set";
|
3
3
|
import { diffField } from '../utils';
|
4
4
|
import { isEmpty } from '../../utils';
|
5
5
|
export var transformValue = function transformValue(names, form, fieldName, _normalize, _getValueProps) {
|
@@ -15,7 +15,7 @@ export var transformValue = function transformValue(names, form, fieldName, _nor
|
|
15
15
|
}
|
16
16
|
names.forEach(function (name, index) {
|
17
17
|
var _value2;
|
18
|
-
|
18
|
+
_set(form.getFieldsValue(true), name, (_value2 = _value) === null || _value2 === void 0 ? void 0 : _value2[index]);
|
19
19
|
});
|
20
20
|
return _value;
|
21
21
|
},
|
@@ -45,7 +45,7 @@ export var transformValue = function transformValue(names, form, fieldName, _nor
|
|
45
45
|
}
|
46
46
|
// 如果来源是比对且有names场景, 则不更新表单值
|
47
47
|
if (!isOrigin) {
|
48
|
-
|
48
|
+
_set(form.getFieldsValue(true), fieldName, curValue);
|
49
49
|
}
|
50
50
|
// 如果表单里的值和组合得到的值不全等 更新表单里的值、
|
51
51
|
return _objectSpread(_objectSpread({}, res), {}, {
|
@@ -1,11 +1,11 @@
|
|
1
|
+
import _isEqualWith from "lodash/isEqualWith";
|
1
2
|
import { useRef } from 'react';
|
2
|
-
import { isEqualWith } from 'lodash';
|
3
3
|
import { customEqualForFun } from '.';
|
4
4
|
/** 深度比较依赖变化memo */
|
5
5
|
export var useDeepCompareMemo = function useDeepCompareMemo(fun, changedCb, depList) {
|
6
6
|
var lastDependency = useRef(); // 上一次的依赖
|
7
7
|
var lastRes = useRef(); // 上一次的结果
|
8
|
-
if (!
|
8
|
+
if (!_isEqualWith(depList, lastDependency.current, customEqualForFun)) {
|
9
9
|
var res = fun();
|
10
10
|
changedCb === null || changedCb === void 0 ? void 0 : changedCb(lastRes.current, res);
|
11
11
|
lastRes.current = res;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
+
import _isString from "lodash/isString";
|
3
|
+
import _isBoolean from "lodash/isBoolean";
|
2
4
|
import { useEffect, useMemo } from 'react';
|
3
|
-
import { isBoolean, isString } from 'lodash';
|
4
5
|
import { rulesCreator } from './rulesCreator';
|
5
6
|
import { isNotFullArray, isNullArray } from './index';
|
6
7
|
import locale from '../../locale';
|
@@ -12,7 +13,7 @@ var useRules = function useRules(props) {
|
|
12
13
|
names = props.names,
|
13
14
|
labelRequired = props.labelRequired,
|
14
15
|
type = props.type;
|
15
|
-
var _label =
|
16
|
+
var _label = _isString(label) ? label : '';
|
16
17
|
var requiredRule = Array.isArray(rules) && (rules === null || rules === void 0 ? void 0 : rules.find(function (rule) {
|
17
18
|
return rule.required === true;
|
18
19
|
}));
|
@@ -63,7 +64,7 @@ var useRules = function useRules(props) {
|
|
63
64
|
});
|
64
65
|
useEffect(function () {
|
65
66
|
// 添加完整性校验
|
66
|
-
if (names && !
|
67
|
+
if (names && !_isBoolean(labelRequired)) {
|
67
68
|
var customRequired = {
|
68
69
|
validator: function validator(rules, value) {
|
69
70
|
// 完整性校验, 空数组不校验, 数组有值且值不完整则校验不通过
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
import _get from "lodash/get";
|
3
|
+
import _isEqualWith from "lodash/isEqualWith";
|
4
|
+
import _isFunction from "lodash/isFunction";
|
2
5
|
import { useRef, useState } from 'react';
|
3
|
-
import { isFunction, isEqualWith, get } from 'lodash';
|
4
6
|
import { customEqualForFun } from './index';
|
5
7
|
/** FormList中被删除的行也会再触发一次响应式函数 排除这种场景 */
|
6
8
|
var isDeleteLine = function isDeleteLine(form, namePath) {
|
@@ -46,7 +48,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
46
48
|
reRender = _useState2[1];
|
47
49
|
var values = {};
|
48
50
|
// 不是动态函数直接返回
|
49
|
-
if (!(dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) && !
|
51
|
+
if (!(dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) && !_isFunction(show) && !_isFunction(disabled) && !_isFunction(required) && !_isFunction(rules) && !_isFunction(fieldProps) && !_isFunction(originComponent) && !_isFunction(desensitization)) {
|
50
52
|
return {
|
51
53
|
shouldUpdate: _shouldUpdate,
|
52
54
|
show: show,
|
@@ -64,7 +66,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
64
66
|
} else {
|
65
67
|
values = form.getFieldsValue(true);
|
66
68
|
}
|
67
|
-
if (
|
69
|
+
if (_isFunction(show)) {
|
68
70
|
showRef.current = Boolean(show(values, {
|
69
71
|
form: form,
|
70
72
|
index: index,
|
@@ -73,7 +75,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
73
75
|
} else {
|
74
76
|
showRef.current = show;
|
75
77
|
}
|
76
|
-
if (
|
78
|
+
if (_isFunction(desensitization)) {
|
77
79
|
desensitizationRef.current = desensitization(values, {
|
78
80
|
form: form,
|
79
81
|
index: index,
|
@@ -82,7 +84,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
82
84
|
} else {
|
83
85
|
desensitizationRef.current = desensitization;
|
84
86
|
}
|
85
|
-
if (
|
87
|
+
if (_isFunction(disabled)) {
|
86
88
|
// RangePicker返回数组时,特殊处理
|
87
89
|
if (['Group', 'RangePicker', 'ProCascader'].includes(type) && Array.isArray(disabled(values, {
|
88
90
|
form: form,
|
@@ -104,7 +106,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
104
106
|
} else {
|
105
107
|
disabledRef.current = disabled;
|
106
108
|
}
|
107
|
-
if (
|
109
|
+
if (_isFunction(required)) {
|
108
110
|
requiredRef.current = required(values, {
|
109
111
|
form: form,
|
110
112
|
index: index,
|
@@ -113,7 +115,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
113
115
|
} else {
|
114
116
|
requiredRef.current = required;
|
115
117
|
}
|
116
|
-
if (
|
118
|
+
if (_isFunction(rules)) {
|
117
119
|
rulesRef.current = rules(values, {
|
118
120
|
form: form,
|
119
121
|
index: index,
|
@@ -122,7 +124,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
122
124
|
} else {
|
123
125
|
rulesRef.current = rules;
|
124
126
|
}
|
125
|
-
if (
|
127
|
+
if (_isFunction(originComponent)) {
|
126
128
|
originComponentRef.current = originComponent(values, {
|
127
129
|
form: form,
|
128
130
|
index: index,
|
@@ -131,7 +133,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
131
133
|
} else {
|
132
134
|
originComponentRef.current = newComponent;
|
133
135
|
}
|
134
|
-
if (
|
136
|
+
if (_isFunction(fieldProps)) {
|
135
137
|
fieldPropsRef.current = fieldProps(values, {
|
136
138
|
form: form,
|
137
139
|
index: index,
|
@@ -142,7 +144,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
142
144
|
}
|
143
145
|
if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
|
144
146
|
dependNamesRef.current = dependNames.map(function (name) {
|
145
|
-
return
|
147
|
+
return _get(values, name);
|
146
148
|
});
|
147
149
|
}
|
148
150
|
return {
|
@@ -150,9 +152,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
150
152
|
// @ts-ignore formList场景取当前行数据,不取shouldUpdate变更后值
|
151
153
|
if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
|
152
154
|
var curDependNamesValue = dependNames.map(function (name) {
|
153
|
-
return
|
155
|
+
return _get(currentValues, name);
|
154
156
|
});
|
155
|
-
var dependNamesChanged = !
|
157
|
+
var dependNamesChanged = !_isEqualWith(dependNamesRef.current, curDependNamesValue, customEqualForFun);
|
156
158
|
dependNamesRef.current = curDependNamesValue;
|
157
159
|
if (!dependNamesChanged) return false;
|
158
160
|
}
|
@@ -163,32 +165,32 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
163
165
|
} else {
|
164
166
|
_currentValues = form.getFieldsValue(true);
|
165
167
|
}
|
166
|
-
var _show =
|
168
|
+
var _show = _isFunction(show) ? Boolean(show(_currentValues, {
|
167
169
|
form: form,
|
168
170
|
index: index,
|
169
171
|
namePath: namePath
|
170
172
|
})) : show;
|
171
|
-
var _disabled =
|
173
|
+
var _disabled = _isFunction(disabled) ? Boolean(disabled(_currentValues, {
|
172
174
|
form: form,
|
173
175
|
index: index,
|
174
176
|
namePath: namePath
|
175
177
|
})) : disabled;
|
176
|
-
var _required =
|
178
|
+
var _required = _isFunction(required) ? required(_currentValues, {
|
177
179
|
form: form,
|
178
180
|
index: index,
|
179
181
|
namePath: namePath
|
180
182
|
}) : required;
|
181
|
-
var _rules =
|
183
|
+
var _rules = _isFunction(rules) ? rules(_currentValues, {
|
182
184
|
form: form,
|
183
185
|
index: index,
|
184
186
|
namePath: namePath
|
185
187
|
}) : rules;
|
186
|
-
var _fieldProps =
|
188
|
+
var _fieldProps = _isFunction(fieldProps) ? fieldProps(_currentValues, {
|
187
189
|
form: form,
|
188
190
|
index: index,
|
189
191
|
namePath: namePath
|
190
192
|
}) : fieldProps;
|
191
|
-
var _desensitization =
|
193
|
+
var _desensitization = _isFunction(desensitization) ? desensitization(_currentValues, {
|
192
194
|
form: form,
|
193
195
|
index: index,
|
194
196
|
namePath: namePath
|
@@ -216,9 +218,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
216
218
|
clearTimeout(timerRef.current);
|
217
219
|
}
|
218
220
|
}
|
219
|
-
var equalRes =
|
220
|
-
var proEqualRes =
|
221
|
-
var desensitizationRes =
|
221
|
+
var equalRes = _isEqualWith(rulesRef.current, _rules, customEqualForFun);
|
222
|
+
var proEqualRes = _isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun);
|
223
|
+
var desensitizationRes = _isEqualWith(desensitizationRef.current, _desensitization);
|
222
224
|
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes || !desensitizationRes || (_fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.transformResponse) // 防止fieldProps变更时,transformResponse根据fieldProps新值无法触发更新
|
223
225
|
) {
|
224
226
|
showRef.current = _show;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
-
import
|
3
|
+
import _debounce from "lodash/debounce";
|
4
4
|
import warning from 'rc-util/lib/warning';
|
5
5
|
import { useState, useEffect, useRef, useMemo } from 'react';
|
6
6
|
import isEqual from 'lodash/isEqual';
|
@@ -100,7 +100,7 @@ function useWatch(dependencies, form, wait) {
|
|
100
100
|
// 保存防抖函数引用,避免重复创建
|
101
101
|
var debouncedFn = useMemo(function () {
|
102
102
|
if (wait) {
|
103
|
-
return
|
103
|
+
return _debounce(function (value) {
|
104
104
|
// 只在值真正变化时才更新状态
|
105
105
|
if (!isEqual(prevStateRef.current, value)) {
|
106
106
|
prevStateRef.current = _objectSpread({}, value);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
+
import _isEqual from "lodash/isEqual";
|
3
4
|
import Big from 'big.js';
|
4
|
-
import { isEqual } from 'lodash';
|
5
5
|
import { transforms } from '@zat-design/utils';
|
6
6
|
var transformDate = transforms.transformDate,
|
7
7
|
transformSwitch = transforms.transformSwitch;
|
@@ -33,7 +33,7 @@ var transformRatio = function transformRatio(_ref) {
|
|
33
33
|
value: []
|
34
34
|
};
|
35
35
|
}
|
36
|
-
if (
|
36
|
+
if (_isEqual(ref, value)) {
|
37
37
|
return {
|
38
38
|
value: [(value[0] || value[0] === 0) && Number.isFinite(value[0] - 0) ? Big(value[0] - 0).times(Math.pow(10, precision)).toNumber() : null, (value[1] || value[1] === 0) && Number.isFinite(value[1] - 0) ? Big(value[1] - 0).times(Math.pow(10, precision)).toNumber() : null]
|
39
39
|
};
|