@zat-design/sisyphus-react 3.7.2 → 3.7.3-beta.10
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/index.esm.css +79 -0
- package/dist/less.esm.css +76 -0
- package/es/ProAction/index.js +4 -4
- package/es/ProDownload/index.d.ts +1 -1
- package/es/ProEditTable/components/ActionButton/index.d.ts +1 -1
- package/es/ProEditTable/components/RcTable/BaseTable.d.ts +1 -1
- package/es/ProEditTable/components/RcTable/DraggableTable.d.ts +1 -1
- package/es/ProEditTable/components/RcTable/VirtualTable.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts} +4 -3
- package/es/ProEditTable/components/RenderField/{ListChanged.js → ListChangedWrapper.js} +22 -10
- package/es/ProEditTable/components/RenderField/index.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/index.js +29 -24
- package/es/ProEditTable/components/RenderToolbar/index.d.ts +1 -1
- package/es/ProEditTable/components/Summary/index.d.ts +1 -1
- package/es/ProEditTable/propsType.d.ts +1 -1
- package/es/ProEditTable/utils/config.d.ts +1 -1
- package/es/ProEditTable/utils/getDefaultProps.js +2 -1
- package/es/ProEditTable/utils/tools.js +3 -3
- package/es/ProEnum/components/Group.d.ts +1 -1
- package/es/ProEnum/components/Tag.d.ts +1 -1
- package/es/ProEnum/index.d.ts +2 -2
- package/es/ProEnum/index.js +5 -4
- package/es/ProEnum/style/index.less +8 -4
- package/es/ProEnum/utils/eventCenter.js +2 -1
- package/es/ProEnum/utils/getEnumLabel.d.ts +1 -1
- package/es/ProEnum/utils/index.d.ts +1 -1
- package/es/ProEnum/utils/index.js +4 -0
- package/es/ProForm/components/base/Input/index.d.ts +1 -1
- package/es/ProForm/components/combination/Container/index.js +5 -3
- package/es/ProForm/components/combination/Container/propsType.d.ts +2 -1
- package/es/ProForm/components/combination/FormList/utils.js +5 -4
- package/es/ProForm/components/combination/Group/component/ComRender.js +3 -1
- package/es/ProForm/components/combination/Group/utils.js +22 -5
- package/es/ProForm/components/combination/ProCascader/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProCascader/index.js +7 -7
- package/es/ProForm/components/combination/ProNumberRange/index.js +3 -1
- package/es/ProForm/components/old/InputRange/index.d.ts +1 -1
- package/es/ProForm/components/old/InputWithSuffix/index.d.ts +1 -1
- package/es/ProForm/components/old/ProAddress/index.d.ts +2 -1
- package/es/ProForm/components/old/ProRangeBox/index.d.ts +2 -1
- package/es/ProForm/components/render/ChangedWrapper.d.ts +16 -0
- package/es/ProForm/components/render/{Changed.js → ChangedWrapper.js} +43 -15
- package/es/ProForm/components/render/Render.js +7 -8
- package/es/ProForm/components/render/RenderFields.d.ts +2 -3
- package/es/ProForm/components/render/RenderFields.js +3 -4
- package/es/ProForm/components/render/propsType.d.ts +4 -3
- package/es/ProForm/index.js +3 -6
- package/es/ProForm/propsType.d.ts +12 -2
- package/es/ProForm/style/index.less +102 -4
- package/es/ProForm/utils/diffOriginal.d.ts +4 -4
- package/es/ProForm/utils/diffOriginal.js +18 -7
- package/es/ProForm/utils/index.js +10 -14
- package/es/ProForm/utils/rulesCreator.d.ts +1 -1
- package/es/ProForm/utils/rulesCreator.js +25 -22
- package/es/ProForm/utils/valueType.js +2 -2
- package/es/ProIcon/utils/index.js +3 -4
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +1 -1
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +3 -3
- package/es/ProLayout/components/ProCollapse/index.d.ts +1 -1
- package/es/ProLayout/components/ProFooter/index.d.ts +1 -1
- package/es/ProLayout/components/ProHeader/components/Copy/index.d.ts +1 -1
- package/es/ProLayout/components/ProHeader/index.d.ts +1 -1
- package/es/ProLayout/index.d.ts +4 -4
- package/es/ProLayout/utils/index.js +9 -9
- package/es/ProSelect/components/AdaptiveTooltip.d.ts +1 -1
- package/es/ProSelect/index.d.ts +1 -1
- package/es/ProSelect/index.js +11 -8
- package/es/ProSelect/propsType.d.ts +4 -0
- package/es/ProSelect/utils/index.d.ts +1 -7
- package/es/ProSelect/utils/index.js +13 -5
- package/es/ProStep/components/Anchor/index.d.ts +1 -1
- package/es/ProStep/components/Item/index.d.ts +1 -1
- package/es/ProStep/components/Listener/index.d.ts +1 -1
- package/es/ProStep/components/Listener/index.js +5 -2
- package/es/ProStep/components/Step/index.d.ts +1 -1
- package/es/ProStep/index.d.ts +3 -3
- package/es/ProStep/index.js +24 -17
- package/es/ProTable/components/FormatColumn/index.js +3 -3
- package/es/ProTable/components/RcTable/components/BaseTable/index.d.ts +1 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +8 -9
- package/es/ProTable/components/RcTable/components/DraggableTable/index.d.ts +1 -1
- package/es/ProTable/components/RenderFooter/index.d.ts +1 -1
- package/es/ProTable/components/RenderTableHeader/index.d.ts +1 -1
- package/es/ProTable/components/TableResizable/index.d.ts +1 -1
- package/es/ProTable/index.d.ts +1 -1
- package/es/ProTabs/components/Card/index.d.ts +1 -1
- package/es/ProThemeTools/component/ProTools/index.d.ts +1 -1
- package/es/ProThemeTools/index.d.ts +1 -1
- package/es/ProTooltip/index.d.ts +1 -1
- package/es/ProTree/components/CloseIcon.d.ts +2 -1
- package/es/ProTree/components/List.d.ts +1 -1
- package/es/ProTree/components/ProTree.d.ts +1 -1
- package/es/ProTree/components/ProTreeSelect/index.d.ts +1 -1
- package/es/ProTree/components/ProTreeSelect/index.js +18 -18
- package/es/ProTree/components/ProTreeSelect/style/index.less +2 -2
- package/es/ProTree/components/SearchTitle.d.ts +1 -1
- package/es/ProTree/components/Tree.d.ts +1 -1
- package/es/ProTree/components/Tree.js +3 -3
- package/es/ProTree/index.d.ts +1 -1
- package/es/ProTree/utils.js +11 -12
- package/es/ProTreeModal/components/Cascader.d.ts +1 -1
- package/es/ProTreeModal/components/CloseIcon.d.ts +2 -1
- package/es/ProTreeModal/components/SearchTitle.d.ts +1 -1
- package/es/ProTreeModal/components/Tree.js +6 -6
- package/es/ProTreeModal/components/Trigger.d.ts +1 -1
- package/es/ProTreeModal/index.d.ts +1 -1
- package/es/ProTreeModal/utils.js +11 -12
- package/es/ProUpload/components/DraggableUploadListItem.d.ts +1 -1
- package/es/ProUpload/index.js +1 -1
- package/es/ProUpload/propsType.d.ts +5 -0
- package/es/style/theme/antd.less +5 -0
- package/es/style/theme/index.less +1 -0
- package/es/style/theme/tokens.less +1 -0
- package/es/utils/index.d.ts +2 -0
- package/es/utils/index.js +13 -0
- package/lib/ProAction/index.js +4 -4
- package/lib/ProDownload/index.d.ts +1 -1
- package/lib/ProEditTable/components/ActionButton/index.d.ts +1 -1
- package/lib/ProEditTable/components/RcTable/BaseTable.d.ts +1 -1
- package/lib/ProEditTable/components/RcTable/DraggableTable.d.ts +1 -1
- package/lib/ProEditTable/components/RcTable/VirtualTable.d.ts +1 -1
- package/lib/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts} +4 -3
- package/lib/ProEditTable/components/RenderField/{ListChanged.js → ListChangedWrapper.js} +25 -11
- package/lib/ProEditTable/components/RenderField/index.d.ts +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +30 -25
- package/lib/ProEditTable/components/RenderToolbar/index.d.ts +1 -1
- package/lib/ProEditTable/components/Summary/index.d.ts +1 -1
- package/lib/ProEditTable/propsType.d.ts +1 -1
- package/lib/ProEditTable/utils/config.d.ts +1 -1
- package/lib/ProEditTable/utils/getDefaultProps.js +3 -1
- package/lib/ProEditTable/utils/tools.js +3 -3
- package/lib/ProEnum/components/Group.d.ts +1 -1
- package/lib/ProEnum/components/Tag.d.ts +1 -1
- package/lib/ProEnum/index.d.ts +2 -2
- package/lib/ProEnum/index.js +5 -4
- package/lib/ProEnum/style/index.less +8 -4
- package/lib/ProEnum/utils/eventCenter.js +2 -1
- package/lib/ProEnum/utils/getEnumLabel.d.ts +1 -1
- package/lib/ProEnum/utils/index.d.ts +1 -1
- package/lib/ProEnum/utils/index.js +4 -0
- package/lib/ProForm/components/base/Input/index.d.ts +1 -1
- package/lib/ProForm/components/combination/Container/index.js +5 -3
- package/lib/ProForm/components/combination/Container/propsType.d.ts +2 -1
- package/lib/ProForm/components/combination/FormList/utils.js +4 -3
- package/lib/ProForm/components/combination/Group/component/ComRender.js +3 -1
- package/lib/ProForm/components/combination/Group/utils.js +22 -5
- package/lib/ProForm/components/combination/ProCascader/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProCascader/index.js +7 -7
- package/lib/ProForm/components/combination/ProNumberRange/index.js +3 -1
- package/lib/ProForm/components/old/InputRange/index.d.ts +1 -1
- package/lib/ProForm/components/old/InputWithSuffix/index.d.ts +1 -1
- package/lib/ProForm/components/old/ProAddress/index.d.ts +2 -1
- package/lib/ProForm/components/old/ProRangeBox/index.d.ts +2 -1
- package/lib/ProForm/components/render/ChangedWrapper.d.ts +16 -0
- package/lib/ProForm/components/render/{Changed.js → ChangedWrapper.js} +43 -15
- package/lib/ProForm/components/render/Render.js +7 -8
- package/lib/ProForm/components/render/RenderFields.d.ts +2 -3
- package/lib/ProForm/components/render/RenderFields.js +3 -4
- package/lib/ProForm/components/render/propsType.d.ts +4 -3
- package/lib/ProForm/index.js +3 -6
- package/lib/ProForm/propsType.d.ts +12 -2
- package/lib/ProForm/style/index.less +102 -4
- package/lib/ProForm/utils/diffOriginal.d.ts +4 -4
- package/lib/ProForm/utils/diffOriginal.js +18 -7
- package/lib/ProForm/utils/index.js +10 -10
- package/lib/ProForm/utils/rulesCreator.d.ts +1 -1
- package/lib/ProForm/utils/rulesCreator.js +25 -22
- package/lib/ProForm/utils/valueType.js +2 -2
- package/lib/ProIcon/utils/index.js +3 -3
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +1 -1
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +3 -3
- package/lib/ProLayout/components/ProCollapse/index.d.ts +1 -1
- package/lib/ProLayout/components/ProFooter/index.d.ts +1 -1
- package/lib/ProLayout/components/ProHeader/components/Copy/index.d.ts +1 -1
- package/lib/ProLayout/components/ProHeader/index.d.ts +1 -1
- package/lib/ProLayout/index.d.ts +4 -4
- package/lib/ProLayout/utils/index.js +9 -9
- package/lib/ProSelect/components/AdaptiveTooltip.d.ts +1 -1
- package/lib/ProSelect/index.d.ts +1 -1
- package/lib/ProSelect/index.js +11 -8
- package/lib/ProSelect/propsType.d.ts +4 -0
- package/lib/ProSelect/utils/index.d.ts +1 -7
- package/lib/ProSelect/utils/index.js +13 -5
- package/lib/ProStep/components/Anchor/index.d.ts +1 -1
- package/lib/ProStep/components/Item/index.d.ts +1 -1
- package/lib/ProStep/components/Listener/index.d.ts +1 -1
- package/lib/ProStep/components/Listener/index.js +5 -2
- package/lib/ProStep/components/Step/index.d.ts +1 -1
- package/lib/ProStep/index.d.ts +3 -3
- package/lib/ProStep/index.js +24 -17
- package/lib/ProTable/components/FormatColumn/index.js +3 -3
- package/lib/ProTable/components/RcTable/components/BaseTable/index.d.ts +1 -1
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +8 -8
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.d.ts +1 -1
- package/lib/ProTable/components/RenderFooter/index.d.ts +1 -1
- package/lib/ProTable/components/RenderTableHeader/index.d.ts +1 -1
- package/lib/ProTable/components/TableResizable/index.d.ts +1 -1
- package/lib/ProTable/index.d.ts +1 -1
- package/lib/ProTabs/components/Card/index.d.ts +1 -1
- package/lib/ProThemeTools/component/ProTools/index.d.ts +1 -1
- package/lib/ProThemeTools/index.d.ts +1 -1
- package/lib/ProTooltip/index.d.ts +1 -1
- package/lib/ProTree/components/CloseIcon.d.ts +2 -1
- package/lib/ProTree/components/List.d.ts +1 -1
- package/lib/ProTree/components/ProTree.d.ts +1 -1
- package/lib/ProTree/components/ProTreeSelect/index.d.ts +1 -1
- package/lib/ProTree/components/ProTreeSelect/index.js +18 -18
- package/lib/ProTree/components/ProTreeSelect/style/index.less +2 -2
- package/lib/ProTree/components/SearchTitle.d.ts +1 -1
- package/lib/ProTree/components/Tree.d.ts +1 -1
- package/lib/ProTree/components/Tree.js +3 -3
- package/lib/ProTree/index.d.ts +1 -1
- package/lib/ProTree/utils.js +11 -11
- package/lib/ProTreeModal/components/Cascader.d.ts +1 -1
- package/lib/ProTreeModal/components/CloseIcon.d.ts +2 -1
- package/lib/ProTreeModal/components/SearchTitle.d.ts +1 -1
- package/lib/ProTreeModal/components/Tree.js +6 -6
- package/lib/ProTreeModal/components/Trigger.d.ts +1 -1
- package/lib/ProTreeModal/index.d.ts +1 -1
- package/lib/ProTreeModal/utils.js +11 -11
- package/lib/ProUpload/components/DraggableUploadListItem.d.ts +1 -1
- package/lib/ProUpload/index.js +1 -1
- package/lib/ProUpload/propsType.d.ts +5 -0
- package/lib/style/theme/antd.less +5 -0
- package/lib/style/theme/index.less +1 -0
- package/lib/style/theme/tokens.less +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +19 -0
- package/package.json +2 -1
- package/es/ProForm/components/render/Changed.d.ts +0 -14
- package/lib/ProForm/components/render/Changed.d.ts +0 -14
- /package/es/ProForm/utils/{useChanged.d.ts → _useChanged.d.ts} +0 -0
- /package/es/ProForm/utils/{useChanged.js → _useChanged.js} +0 -0
- /package/es/ProForm/utils/{useListChanged.d.ts → _useListChanged.d.ts} +0 -0
- /package/es/ProForm/utils/{useListChanged.js → _useListChanged.js} +0 -0
- /package/lib/ProForm/utils/{useChanged.d.ts → _useChanged.d.ts} +0 -0
- /package/lib/ProForm/utils/{useChanged.js → _useChanged.js} +0 -0
- /package/lib/ProForm/utils/{useListChanged.d.ts → _useListChanged.d.ts} +0 -0
- /package/lib/ProForm/utils/{useListChanged.js → _useListChanged.js} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
|
+
import { NamePath } from 'antd/lib/form/interface';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { DiffOriginalParams } from '../../utils/diffOriginal';
|
|
5
|
+
import { DiffConfigProps } from '../../propsType';
|
|
6
|
+
interface Props {
|
|
7
|
+
name?: NamePath;
|
|
8
|
+
names?: NamePath[];
|
|
9
|
+
namesStr?: string;
|
|
10
|
+
diffConfig?: DiffConfigProps;
|
|
11
|
+
form: FormInstance;
|
|
12
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
13
|
+
[name: string]: any;
|
|
14
|
+
}
|
|
15
|
+
declare const ChangedWrapper: React.FC<Props>;
|
|
16
|
+
export default ChangedWrapper;
|
|
@@ -10,60 +10,88 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
var _antd = require("antd");
|
|
13
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
14
|
var _lodash = require("lodash");
|
|
14
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
16
|
var _diffOriginal = require("../../utils/diffOriginal");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
17
|
+
var _ProConfigProvider = require("../../../ProConfigProvider");
|
|
18
|
+
var _utils = require("../../../utils");
|
|
19
|
+
var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName"];
|
|
20
|
+
var ChangedWrapper = function ChangedWrapper(props) {
|
|
21
|
+
var _diffConfig$toolTip;
|
|
18
22
|
var name = props.name,
|
|
19
23
|
names = props.names,
|
|
20
24
|
namesStr = props.namesStr,
|
|
21
|
-
originalValues = props.originalValues,
|
|
22
25
|
form = props.form,
|
|
23
26
|
equalWith = props.equalWith,
|
|
24
27
|
children = props.children,
|
|
25
28
|
type = props.type,
|
|
26
|
-
|
|
29
|
+
diffConfig = props.diffConfig,
|
|
30
|
+
_props$valuePropName = props.valuePropName,
|
|
31
|
+
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
27
32
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
33
|
+
var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
|
|
34
|
+
isDiffAll = _useProConfig.isDiffAll;
|
|
35
|
+
var originalValues = diffConfig.originalValues,
|
|
36
|
+
changeTipColor = diffConfig.changeTipColor,
|
|
37
|
+
addTipColor = diffConfig.addTipColor;
|
|
38
|
+
var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
|
|
28
39
|
// 不渲染tooltip
|
|
29
|
-
var
|
|
40
|
+
var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
|
|
30
41
|
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
|
31
42
|
return (0, _lodash.get)(originalValues, name);
|
|
32
43
|
}) : (0, _lodash.get)(originalValues, name);
|
|
33
|
-
var noChange = !equalWith && (!originalValues ||
|
|
34
|
-
var
|
|
35
|
-
if (
|
|
44
|
+
var noChange = !equalWith && (!originalValues || isDiffAll ? false : (0, _utils.isEmpty)(originalValue));
|
|
45
|
+
var diffType = (0, _react.useMemo)(function () {
|
|
46
|
+
if (!isWatch || noChange) return 'same';
|
|
36
47
|
return (0, _diffOriginal.diffOriginal)({
|
|
37
48
|
originalValue: originalValue,
|
|
38
|
-
value: props
|
|
49
|
+
value: props[valuePropName],
|
|
39
50
|
form: form,
|
|
40
51
|
equalWith: equalWith
|
|
41
52
|
// name: namesStr || name,
|
|
42
53
|
});
|
|
43
|
-
}, [
|
|
54
|
+
}, [isWatch, noChange, props[valuePropName], originalValue]);
|
|
55
|
+
var isAdd = diffType === 'add';
|
|
56
|
+
var isChanged = diffType === 'changed';
|
|
44
57
|
var tipContent = (0, _react.useMemo)(function () {
|
|
45
|
-
if (
|
|
58
|
+
if (!isWatch || noChange) return undefined;
|
|
46
59
|
return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), {}, {
|
|
47
60
|
isView: true,
|
|
48
61
|
value: originalValue,
|
|
49
62
|
checked: type === 'Switch' ? originalValue : undefined
|
|
50
63
|
})) : undefined;
|
|
51
64
|
}, [originalValue, children]);
|
|
52
|
-
if (
|
|
65
|
+
if (!isWatch || noChange) {
|
|
53
66
|
return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest));
|
|
54
67
|
}
|
|
68
|
+
var tipOpenCalc = function tipOpenCalc() {
|
|
69
|
+
if (!toolTip) return false;
|
|
70
|
+
// 传入undefined 鼠标移入显示移出隐藏
|
|
71
|
+
return isChanged ? undefined : false;
|
|
72
|
+
};
|
|
73
|
+
var style = {
|
|
74
|
+
'--zaui-contract-bg': changeTipColor,
|
|
75
|
+
'--zaui-contract-bg-add': addTipColor
|
|
76
|
+
};
|
|
77
|
+
var diffClassName = (0, _classnames.default)({
|
|
78
|
+
'pro-form-item-changed': isChanged,
|
|
79
|
+
'pro-form-item-add': isAdd
|
|
80
|
+
});
|
|
55
81
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
56
|
-
open:
|
|
82
|
+
open: tipOpenCalc(),
|
|
57
83
|
getPopupContainer: function getPopupContainer(target) {
|
|
58
84
|
return target.parentElement;
|
|
59
85
|
},
|
|
60
86
|
title: (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
61
87
|
children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
|
|
62
88
|
}),
|
|
89
|
+
placement: "topLeft",
|
|
63
90
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
64
|
-
className:
|
|
91
|
+
className: diffClassName,
|
|
92
|
+
style: style,
|
|
65
93
|
children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest)) : undefined
|
|
66
94
|
})
|
|
67
95
|
});
|
|
68
96
|
};
|
|
69
|
-
var _default = exports.default =
|
|
97
|
+
var _default = exports.default = ChangedWrapper;
|
|
@@ -26,7 +26,7 @@ var _valueType = _interopRequireDefault(require("../../utils/valueType"));
|
|
|
26
26
|
var _tip = _interopRequireDefault(require("../../../assets/tip.svg"));
|
|
27
27
|
var _useRules = _interopRequireDefault(require("../../utils/useRules"));
|
|
28
28
|
var _ConfirmWrapper = _interopRequireDefault(require("./ConfirmWrapper"));
|
|
29
|
-
var
|
|
29
|
+
var _ChangedWrapper = _interopRequireDefault(require("./ChangedWrapper"));
|
|
30
30
|
var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className", "rules", "required", "labelRequired", "tooltip"];
|
|
31
31
|
/* eslint-disable prefer-destructuring */
|
|
32
32
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
@@ -46,12 +46,11 @@ var Render = function Render(props) {
|
|
|
46
46
|
formDisabled = props.formDisabled,
|
|
47
47
|
type = props.type,
|
|
48
48
|
isSelect = props.isSelect,
|
|
49
|
-
originalValues = props.originalValues,
|
|
50
49
|
equalWith = props.equalWith,
|
|
51
50
|
requiredOnView = props.requiredOnView,
|
|
52
|
-
originalDiffTip = props.originalDiffTip,
|
|
53
51
|
confirm = props.confirm,
|
|
54
|
-
globalControl = props.globalControl
|
|
52
|
+
globalControl = props.globalControl,
|
|
53
|
+
diffConfig = props.diffConfig;
|
|
55
54
|
var colProps = props.colProps;
|
|
56
55
|
// 剔除一些不是FormItem的属性, 防止控制台报warning
|
|
57
56
|
var labelWidth = formItemProps.labelWidth,
|
|
@@ -427,17 +426,17 @@ var Render = function Render(props) {
|
|
|
427
426
|
span: 24 // 默认占一行
|
|
428
427
|
});
|
|
429
428
|
}
|
|
430
|
-
if (
|
|
431
|
-
child = (0, _jsxRuntime.jsx)(
|
|
429
|
+
if (diffConfig) {
|
|
430
|
+
child = (0, _jsxRuntime.jsx)(_ChangedWrapper.default, {
|
|
432
431
|
name: formItemProps.name,
|
|
433
432
|
names: otherProps.names,
|
|
434
433
|
namesStr: namesStr,
|
|
435
|
-
|
|
434
|
+
diffConfig: diffConfig,
|
|
436
435
|
form: form,
|
|
437
436
|
equalWith: equalWith,
|
|
438
|
-
originalDiffTip: originalDiffTip,
|
|
439
437
|
type: type,
|
|
440
438
|
onChange: handleChange,
|
|
439
|
+
valuePropName: _otherFormItemProps.valuePropName,
|
|
441
440
|
children: child
|
|
442
441
|
});
|
|
443
442
|
}
|
|
@@ -2,7 +2,7 @@ import { ColProps } from 'antd';
|
|
|
2
2
|
import { FormInstance } from 'antd/es/form/Form';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ProColumnProps } from './propsType';
|
|
5
|
-
import {
|
|
5
|
+
import { DiffConfigProps } from '../../propsType';
|
|
6
6
|
interface Props<T = any> {
|
|
7
7
|
isView?: boolean;
|
|
8
8
|
columns: ProColumnProps[];
|
|
@@ -13,11 +13,10 @@ interface Props<T = any> {
|
|
|
13
13
|
viewEmpty?: React.ReactNode;
|
|
14
14
|
openState?: boolean;
|
|
15
15
|
labelWidth?: string | number;
|
|
16
|
-
|
|
16
|
+
diffConfig?: DiffConfigProps;
|
|
17
17
|
clearNotShow?: boolean;
|
|
18
18
|
requiredOnView?: boolean;
|
|
19
19
|
required?: boolean | boolean[] | (() => boolean | boolean[]);
|
|
20
|
-
originalDiffTip?: boolean;
|
|
21
20
|
globalControl?: boolean;
|
|
22
21
|
}
|
|
23
22
|
declare const RenderFields: React.FC<Props>;
|
|
@@ -30,11 +30,10 @@ var RenderFields = function RenderFields(props) {
|
|
|
30
30
|
viewEmpty = _props$viewEmpty === void 0 ? '-' : _props$viewEmpty,
|
|
31
31
|
openState = props.openState,
|
|
32
32
|
labelWidth = props.labelWidth,
|
|
33
|
-
originalValues = props.originalValues,
|
|
34
33
|
outerClearNotShow = props.clearNotShow,
|
|
35
34
|
requiredOnView = props.requiredOnView,
|
|
36
35
|
required = props.required,
|
|
37
|
-
|
|
36
|
+
diffConfig = props.diffConfig,
|
|
38
37
|
globalControl = props.globalControl;
|
|
39
38
|
// 是否包含隐藏字段
|
|
40
39
|
var hiddenData = columns.filter(function (item) {
|
|
@@ -162,6 +161,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
162
161
|
if (['ProCollapse', 'Container'].includes(_type)) {
|
|
163
162
|
componentProps.show = show;
|
|
164
163
|
componentProps.clearNotShow = clearNotShow;
|
|
164
|
+
componentProps.diffConfig = diffConfig;
|
|
165
165
|
}
|
|
166
166
|
// switch与SwitchCheckbox单独添加valuePropName
|
|
167
167
|
if (['Switch', 'SwitchCheckbox'].includes(_type)) {
|
|
@@ -214,10 +214,9 @@ var RenderFields = function RenderFields(props) {
|
|
|
214
214
|
otherProps: otherProps,
|
|
215
215
|
fieldProps: (0, _lodash.isFunction)(fieldProps) ? fieldProps : null,
|
|
216
216
|
isSelect: _isSelect,
|
|
217
|
-
|
|
217
|
+
diffConfig: diffConfig,
|
|
218
218
|
equalWith: equalWith,
|
|
219
219
|
requiredOnView: requiredOnView,
|
|
220
|
-
originalDiffTip: originalDiffTip,
|
|
221
220
|
globalControl: globalControl
|
|
222
221
|
})
|
|
223
222
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
|
@@ -30,7 +30,8 @@ import { ProUploadProps } from '../../../ProUpload/propsType';
|
|
|
30
30
|
import { ProTreeProps } from '../../../ProTree/propsType';
|
|
31
31
|
import { GroupProps as GroupCopyProps } from '../combination/Group/propsType';
|
|
32
32
|
import { ProCollapseProps } from '../../../ProLayout/components/ProCollapse/PropTypes';
|
|
33
|
-
import { DistributiveOmit } from '../../propsType';
|
|
33
|
+
import { DistributiveOmit, DiffConfigProps } from '../../propsType';
|
|
34
|
+
import { DiffOriginalParams } from '../../utils/diffOriginal';
|
|
34
35
|
export type ComponentMap = keyof typeof componentMap;
|
|
35
36
|
type ValidateKey = keyof typeof validate;
|
|
36
37
|
type RegExpKey = keyof typeof regExp;
|
|
@@ -201,7 +202,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
201
202
|
upperCase?: boolean;
|
|
202
203
|
hiddenNames?: string[] | any[];
|
|
203
204
|
rules?: ProRule[] | ReactiveFunction<Values, ProRule[]>;
|
|
204
|
-
equalWith?:
|
|
205
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
205
206
|
required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
|
|
206
207
|
labelRequired?: boolean;
|
|
207
208
|
toISOString?: boolean;
|
|
@@ -267,7 +268,7 @@ export interface RenderProps<Values = any> {
|
|
|
267
268
|
form: FormInstance<Values>;
|
|
268
269
|
fieldProps?: ReactiveFunction<Values, React.ReactNode>;
|
|
269
270
|
isSelect: boolean;
|
|
270
|
-
|
|
271
|
+
diffConfig: DiffConfigProps;
|
|
271
272
|
requiredOnView?: boolean;
|
|
272
273
|
confirm?: ProFormColumnProps['confirm'];
|
|
273
274
|
globalControl?: boolean;
|
package/lib/ProForm/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var _useForm3 = require("./utils/useForm");
|
|
|
25
25
|
var _useFieldProps = require("./utils/useFieldProps");
|
|
26
26
|
var _locale = _interopRequireDefault(require("../locale"));
|
|
27
27
|
var _useWatch = _interopRequireDefault(require("./utils/useWatch"));
|
|
28
|
-
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", "
|
|
28
|
+
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"];
|
|
29
29
|
var ProForm = function ProForm(props, ref) {
|
|
30
30
|
var _forms$formKey, _localStorage, _ref;
|
|
31
31
|
var _props$mode = props.mode,
|
|
@@ -54,7 +54,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
54
54
|
labelWidth = props.labelWidth,
|
|
55
55
|
onValuesChange = props.onValuesChange,
|
|
56
56
|
onFinish = props.onFinish,
|
|
57
|
-
|
|
57
|
+
diffConfig = props.diffConfig,
|
|
58
58
|
submitOnEnter = props.submitOnEnter,
|
|
59
59
|
_props$clearNotShow = props.clearNotShow,
|
|
60
60
|
clearNotShow = _props$clearNotShow === void 0 ? true : _props$clearNotShow,
|
|
@@ -63,8 +63,6 @@ var ProForm = function ProForm(props, ref) {
|
|
|
63
63
|
requiredOnView = _props$requiredOnView === void 0 ? true : _props$requiredOnView,
|
|
64
64
|
formId = props.formId,
|
|
65
65
|
required = props.required,
|
|
66
|
-
_props$originalDiffTi = props.originalDiffTip,
|
|
67
|
-
originalDiffTip = _props$originalDiffTi === void 0 ? true : _props$originalDiffTi,
|
|
68
66
|
formKey = props.formKey,
|
|
69
67
|
globalControl = props.globalControl,
|
|
70
68
|
_props$scrollToError = props.scrollToError,
|
|
@@ -262,11 +260,10 @@ var ProForm = function ProForm(props, ref) {
|
|
|
262
260
|
colProps: colProps,
|
|
263
261
|
viewEmpty: viewEmpty,
|
|
264
262
|
labelWidth: labelWidth,
|
|
265
|
-
|
|
263
|
+
diffConfig: diffConfig,
|
|
266
264
|
clearNotShow: clearNotShow,
|
|
267
265
|
requiredOnView: requiredOnView,
|
|
268
266
|
required: required,
|
|
269
|
-
originalDiffTip: originalDiffTip,
|
|
270
267
|
globalControl: globalControl
|
|
271
268
|
}), footerRender()]
|
|
272
269
|
})), children]
|
|
@@ -45,6 +45,16 @@ export interface ProFormOtherProps {
|
|
|
45
45
|
globalControl?: boolean;
|
|
46
46
|
formDisabled?: boolean;
|
|
47
47
|
}
|
|
48
|
+
export interface DiffConfigProps<Values = any> {
|
|
49
|
+
/** 比对原始数据源 */
|
|
50
|
+
originalValues: Values;
|
|
51
|
+
/** 是否显示对比值气泡 */
|
|
52
|
+
toolTip?: boolean;
|
|
53
|
+
/** 变更提示颜色 */
|
|
54
|
+
changeTipColor?: string;
|
|
55
|
+
/** 新增提示颜色 */
|
|
56
|
+
addTipColor?: string;
|
|
57
|
+
}
|
|
48
58
|
export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
49
59
|
disabled?: boolean;
|
|
50
60
|
/** 全局控制优先 */
|
|
@@ -67,14 +77,14 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
|
67
77
|
viewEmpty?: React.ReactNode | string;
|
|
68
78
|
confirmLoading?: boolean;
|
|
69
79
|
labelWidth?: string | number;
|
|
70
|
-
originalValues?: Values;
|
|
71
80
|
/** 是否回车提交 */
|
|
72
81
|
submitOnEnter?: boolean;
|
|
73
82
|
clearNotShow?: boolean;
|
|
74
83
|
requiredOnView?: boolean;
|
|
75
84
|
formId?: string;
|
|
76
85
|
required?: boolean | boolean[];
|
|
77
|
-
|
|
86
|
+
/** 表单比对配置 */
|
|
87
|
+
diffConfig?: DiffConfigProps;
|
|
78
88
|
scrollToError?: boolean;
|
|
79
89
|
/** 性能模式,谨慎使用,默认不开启
|
|
80
90
|
* 1. 开启不过滤names的中间态值
|
|
@@ -99,10 +99,12 @@
|
|
|
99
99
|
|
|
100
100
|
&.pro-form-item-width-auto {
|
|
101
101
|
.@{ant-prefix}-form-item-control-input {
|
|
102
|
+
width: 100%;
|
|
102
103
|
flex-grow: inherit;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
.@{ant-prefix}-form-item-control-input-content {
|
|
107
|
+
width: 100%;
|
|
106
108
|
flex: initial;
|
|
107
109
|
}
|
|
108
110
|
}
|
|
@@ -314,16 +316,23 @@
|
|
|
314
316
|
vertical-align: middle;
|
|
315
317
|
}
|
|
316
318
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
319
|
+
|
|
320
|
+
.pro-form-list-mode-block {
|
|
321
|
+
.pro-collapse-content {
|
|
322
|
+
.@{ant-prefix}-row {
|
|
320
323
|
width: auto;
|
|
321
324
|
}
|
|
322
325
|
}
|
|
323
326
|
}
|
|
324
327
|
|
|
325
|
-
// 比较原始值场景下 不同时的样式
|
|
326
328
|
.pro-form-item-changed {
|
|
329
|
+
border-radius: 4px;
|
|
330
|
+
background: @zaui-contract-bg !important;
|
|
331
|
+
|
|
332
|
+
.@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
|
|
333
|
+
background: @zaui-contract-bg !important;
|
|
334
|
+
}
|
|
335
|
+
|
|
327
336
|
span.@{ant-prefix}-input-affix-wrapper,
|
|
328
337
|
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
|
329
338
|
.@{ant-prefix}-picker,
|
|
@@ -367,10 +376,99 @@
|
|
|
367
376
|
}
|
|
368
377
|
}
|
|
369
378
|
|
|
379
|
+
// checkbox
|
|
380
|
+
.@{ant-prefix}-checkbox-group {
|
|
381
|
+
padding: 5px 0
|
|
382
|
+
}
|
|
383
|
+
// switch
|
|
384
|
+
&:has(.@{ant-prefix}-switch) {
|
|
385
|
+
padding: 5px 0;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// textArea
|
|
389
|
+
.@{ant-prefix}-input-textarea > textarea {
|
|
390
|
+
background: @zaui-contract-bg;
|
|
391
|
+
}
|
|
392
|
+
|
|
370
393
|
.pro-form-view-container {
|
|
371
394
|
padding: 4px 8px;
|
|
372
395
|
background: @zaui-contract-bg;
|
|
373
396
|
border-radius: 4px;
|
|
374
397
|
}
|
|
375
398
|
}
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
// 比较原始值场景下 不同时的样式
|
|
402
|
+
.pro-form-item-add {
|
|
403
|
+
border-radius: 4px;
|
|
404
|
+
background: @zaui-contract-bg-add !important;
|
|
405
|
+
|
|
406
|
+
.@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
|
|
407
|
+
background: @zaui-contract-bg-add !important;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
span.@{ant-prefix}-input-affix-wrapper,
|
|
411
|
+
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
|
412
|
+
.@{ant-prefix}-picker,
|
|
413
|
+
.@{ant-prefix}-input-number {
|
|
414
|
+
background: @zaui-contract-bg-add !important;
|
|
415
|
+
|
|
416
|
+
input {
|
|
417
|
+
background: transparent !important;
|
|
418
|
+
}
|
|
419
|
+
.@{ant-prefix}-select-selection-placeholder {
|
|
420
|
+
z-index: 9;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
|
|
425
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
|
|
426
|
+
background: @zaui-contract-bg-add;
|
|
427
|
+
border-radius: 4px;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// 地址组件
|
|
431
|
+
.@{ant-prefix}-form-item-control-input-content {
|
|
432
|
+
// 查看模式
|
|
433
|
+
& > span {
|
|
434
|
+
border-radius: 4px;
|
|
435
|
+
padding: 5px 8px;
|
|
436
|
+
background: @zaui-contract-bg-add;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
& > .pro-address {
|
|
440
|
+
.@{ant-prefix}-select-selector,
|
|
441
|
+
.@{ant-prefix}-input-affix-wrapper,
|
|
442
|
+
.@{ant-prefix}-input-disabled {
|
|
443
|
+
background: @zaui-contract-bg-add;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
& > .@{ant-prefix}-input-group {
|
|
447
|
+
.forever-checkbox {
|
|
448
|
+
background: @zaui-contract-bg-add;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// checkbox
|
|
454
|
+
.@{ant-prefix}-checkbox-group {
|
|
455
|
+
padding: 5px 0
|
|
456
|
+
}
|
|
457
|
+
// switch
|
|
458
|
+
&:has(.@{ant-prefix}-switch) {
|
|
459
|
+
padding: 5px 0;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// textArea
|
|
463
|
+
.@{ant-prefix}-input-textarea > textarea {
|
|
464
|
+
background: @zaui-contract-bg-add;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
.pro-form-view-container {
|
|
469
|
+
padding: 4px 8px;
|
|
470
|
+
background: @zaui-contract-bg-add;
|
|
471
|
+
border-radius: 4px;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
376
474
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
|
-
interface
|
|
2
|
+
export interface DiffOriginalParams {
|
|
3
3
|
originalValue: any;
|
|
4
4
|
value: any;
|
|
5
5
|
form: FormInstance;
|
|
6
|
-
equalWith?: (originalValue: any, currentValue: any) => boolean;
|
|
6
|
+
equalWith?: (originalValue: any, currentValue: any) => DiffType | boolean | undefined;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type DiffType = 'same' | 'add' | 'changed';
|
|
9
|
+
export declare const diffOriginal: (params: DiffOriginalParams) => DiffType;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.diffOriginal = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
+
var _utils = require("../../utils");
|
|
8
9
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
9
10
|
var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
10
11
|
var originalValue = params.originalValue,
|
|
@@ -12,19 +13,29 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
|
12
13
|
equalWith = params.equalWith;
|
|
13
14
|
// 支持传入自定义比较事件
|
|
14
15
|
if ((0, _lodash.isFunction)(equalWith)) {
|
|
15
|
-
|
|
16
|
+
var diffRes = equalWith(originalValue, value);
|
|
17
|
+
if (diffRes === undefined) return 'same';
|
|
18
|
+
if (typeof diffRes === 'boolean') {
|
|
19
|
+
return diffRes ? 'same' : 'changed';
|
|
20
|
+
}
|
|
21
|
+
return diffRes;
|
|
22
|
+
}
|
|
23
|
+
// 如果原始值为空 且当前有值的话 认为变更类型是新增
|
|
24
|
+
if ((0, _utils.isEmpty)(originalValue) && !(0, _utils.isEmpty)(value)) {
|
|
25
|
+
return 'add';
|
|
16
26
|
}
|
|
17
27
|
if (Array.isArray(originalValue)) {
|
|
18
|
-
|
|
28
|
+
var isSame = originalValue.every(function (valueItem, index) {
|
|
19
29
|
// 如果两个值有一个不是空值, 则进行深比较
|
|
20
|
-
if (!
|
|
21
|
-
return
|
|
30
|
+
if (!(0, _utils.isEmpty)(value === null || value === void 0 ? void 0 : value[index]) || !(0, _utils.isEmpty)(valueItem)) {
|
|
31
|
+
return (0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
|
22
32
|
}
|
|
23
|
-
return
|
|
33
|
+
return true;
|
|
24
34
|
});
|
|
35
|
+
return isSame ? 'same' : 'changed';
|
|
25
36
|
}
|
|
26
37
|
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
27
|
-
return
|
|
38
|
+
return (0, _lodash.isEqual)(value, originalValue) ? 'same' : 'changed';
|
|
28
39
|
}
|
|
29
|
-
return
|
|
40
|
+
return 'same';
|
|
30
41
|
};
|
|
@@ -136,7 +136,7 @@ var splitNameStr = exports.splitNameStr = function splitNameStr(name) {
|
|
|
136
136
|
});
|
|
137
137
|
};
|
|
138
138
|
// 过滤掉字段名中包含 '-' 的字段
|
|
139
|
-
var
|
|
139
|
+
var filterInternalFields = exports.filterInternalFields = function filterInternalFields(values, optimize) {
|
|
140
140
|
if (optimize) {
|
|
141
141
|
return values;
|
|
142
142
|
}
|
|
@@ -150,20 +150,20 @@ var _filterInternalFields = exports.filterInternalFields = function filterIntern
|
|
|
150
150
|
}
|
|
151
151
|
if (Array.isArray(nextValues)) {
|
|
152
152
|
return nextValues.map(function (item) {
|
|
153
|
-
return
|
|
153
|
+
return filterInternalFields(item);
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
if ((0, _lodash.isObject)(nextValues)) {
|
|
157
157
|
var result = {};
|
|
158
158
|
Object.keys(nextValues).forEach(function (key) {
|
|
159
159
|
if (key.includes('-')) return;
|
|
160
|
-
result[key] =
|
|
160
|
+
result[key] = filterInternalFields(nextValues[key]);
|
|
161
161
|
});
|
|
162
162
|
return result;
|
|
163
163
|
}
|
|
164
164
|
return nextValues;
|
|
165
165
|
};
|
|
166
|
-
var
|
|
166
|
+
var getAllNamePath = exports.getAllNamePath = function getAllNamePath(object) {
|
|
167
167
|
var currentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
168
168
|
var keys = Object.keys(object);
|
|
169
169
|
var resultKeys = [];
|
|
@@ -177,7 +177,7 @@ var _getAllNamePath = exports.getAllNamePath = function getAllNamePath(object) {
|
|
|
177
177
|
}
|
|
178
178
|
// 深度获取对象key
|
|
179
179
|
if ((0, _lodash.isObject)(value)) {
|
|
180
|
-
resultKeys.concat(
|
|
180
|
+
resultKeys.concat(getAllNamePath(value, [].concat((0, _toConsumableArray2.default)(currentPath), [key])));
|
|
181
181
|
}
|
|
182
182
|
resultKeys.push([].concat((0, _toConsumableArray2.default)(currentPath), [key]));
|
|
183
183
|
});
|
|
@@ -320,7 +320,7 @@ var customEqualForFun = exports.customEqualForFun = function customEqualForFun(v
|
|
|
320
320
|
/**
|
|
321
321
|
* 查询数据中是否包含rowKey
|
|
322
322
|
*/
|
|
323
|
-
var
|
|
323
|
+
var hasRowKey = exports.hasRowKey = function hasRowKey(obj) {
|
|
324
324
|
if ((0, _typeof2.default)(obj) !== 'object' || obj === null) {
|
|
325
325
|
return false;
|
|
326
326
|
}
|
|
@@ -330,7 +330,7 @@ var _hasRowKey = exports.hasRowKey = function hasRowKey(obj) {
|
|
|
330
330
|
return true;
|
|
331
331
|
}
|
|
332
332
|
return keys.some(function (key) {
|
|
333
|
-
return
|
|
333
|
+
return hasRowKey(obj[key]);
|
|
334
334
|
});
|
|
335
335
|
};
|
|
336
336
|
/**
|
|
@@ -346,7 +346,7 @@ var view = exports.view = function view(obj) {
|
|
|
346
346
|
return true;
|
|
347
347
|
}
|
|
348
348
|
return keys.some(function (key) {
|
|
349
|
-
return
|
|
349
|
+
return hasRowKey(obj[key]);
|
|
350
350
|
});
|
|
351
351
|
};
|
|
352
352
|
/**
|
|
@@ -382,7 +382,7 @@ var deleteForPath = exports.deleteForPath = function deleteForPath(values, nameP
|
|
|
382
382
|
* @param value 选中值
|
|
383
383
|
* @returns {}
|
|
384
384
|
*/
|
|
385
|
-
var
|
|
385
|
+
var findOptionByValue = exports.findOptionByValue = function findOptionByValue(treeData, value, fieldNames) {
|
|
386
386
|
if ((0, _lodash.isObject)(value)) {
|
|
387
387
|
return value;
|
|
388
388
|
}
|
|
@@ -392,7 +392,7 @@ var _findOptionByValue = exports.findOptionByValue = function findOptionByValue(
|
|
|
392
392
|
return (0, _lodash.omit)(node, ['children', fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]);
|
|
393
393
|
}
|
|
394
394
|
if (node.children) {
|
|
395
|
-
var foundNode =
|
|
395
|
+
var foundNode = findOptionByValue(node[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'], value, fieldNames);
|
|
396
396
|
if (foundNode) {
|
|
397
397
|
return (0, _lodash.omit)(foundNode, ['children', fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]);
|
|
398
398
|
}
|