@zat-design/sisyphus-react 3.7.3-beta.2 → 3.7.3-beta.21
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 +92 -2
- package/dist/less.esm.css +89 -2
- 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 +3 -3
- package/es/ProEditTable/components/RenderToolbar/index.d.ts +1 -1
- package/es/ProEditTable/components/Summary/index.d.ts +1 -1
- package/es/ProEditTable/utils/config.d.ts +1 -1
- package/es/ProEditTable/utils/tools.js +3 -3
- package/es/ProEnum/components/Group.d.ts +1 -1
- package/es/ProEnum/components/Group.js +10 -2
- 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 +14 -4
- package/es/ProEnum/utils/eventCenter.js +2 -1
- package/es/ProEnum/utils/getEnumLabel.d.ts +1 -1
- 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/ProCascader/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProCascader/index.js +7 -7
- package/es/ProForm/components/combination/ProModalSelect/index.js +50 -45
- 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 +17 -0
- package/es/ProForm/components/render/ChangedWrapper.js +108 -0
- 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 +13 -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/transformValue.js +17 -11
- 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 +3 -4
- package/es/ProSelect/utils/index.js +5 -4
- 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.d.ts +7 -1
- package/es/ProTable/components/FormatColumn/index.js +17 -11
- 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/ProTable/index.js +30 -13
- package/es/ProTable/propsType.d.ts +14 -1
- package/es/ProTable/style/index.less +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/AdaptiveTooltip.d.ts +4 -0
- package/es/ProTree/components/AdaptiveTooltip.js +55 -0
- package/es/ProTree/components/CloseIcon.d.ts +2 -1
- package/es/ProTree/components/List.d.ts +1 -1
- package/es/ProTree/components/List.js +15 -3
- 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 +43 -23
- package/es/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
- package/es/ProTree/components/ProTreeSelect/style/index.less +2 -2
- package/es/ProTree/components/SearchTitle.d.ts +3 -1
- package/es/ProTree/components/SearchTitle.js +17 -8
- 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/style/index.less +14 -0
- 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 +21 -23
- package/es/ProTreeModal/components/Trigger.d.ts +1 -1
- package/es/ProTreeModal/index.d.ts +1 -1
- package/es/ProTreeModal/index.js +62 -7
- package/es/ProTreeModal/utils.d.ts +1 -0
- package/es/ProTreeModal/utils.js +30 -12
- package/es/ProUpload/components/DraggableUploadListItem.d.ts +1 -1
- package/es/style/theme/antd.less +5 -0
- package/es/style/theme/index.less +2 -1
- 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 +3 -3
- package/lib/ProEditTable/components/RenderToolbar/index.d.ts +1 -1
- package/lib/ProEditTable/components/Summary/index.d.ts +1 -1
- package/lib/ProEditTable/utils/config.d.ts +1 -1
- package/lib/ProEditTable/utils/tools.js +3 -3
- package/lib/ProEnum/components/Group.d.ts +1 -1
- package/lib/ProEnum/components/Group.js +10 -2
- 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 +14 -4
- package/lib/ProEnum/utils/eventCenter.js +2 -1
- package/lib/ProEnum/utils/getEnumLabel.d.ts +1 -1
- 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/ProCascader/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProCascader/index.js +7 -7
- package/lib/ProForm/components/combination/ProModalSelect/index.js +49 -44
- 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 +17 -0
- package/lib/ProForm/components/render/ChangedWrapper.js +113 -0
- 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 +13 -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/transformValue.js +17 -11
- 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 +3 -4
- package/lib/ProSelect/utils/index.js +5 -4
- 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.d.ts +7 -1
- package/lib/ProTable/components/FormatColumn/index.js +17 -11
- 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/ProTable/index.js +30 -13
- package/lib/ProTable/propsType.d.ts +14 -1
- package/lib/ProTable/style/index.less +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/AdaptiveTooltip.d.ts +4 -0
- package/lib/ProTree/components/AdaptiveTooltip.js +61 -0
- package/lib/ProTree/components/CloseIcon.d.ts +2 -1
- package/lib/ProTree/components/List.d.ts +1 -1
- package/lib/ProTree/components/List.js +15 -3
- 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 +43 -23
- package/lib/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
- package/lib/ProTree/components/ProTreeSelect/style/index.less +2 -2
- package/lib/ProTree/components/SearchTitle.d.ts +3 -1
- package/lib/ProTree/components/SearchTitle.js +19 -7
- 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/style/index.less +14 -0
- 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 +21 -23
- package/lib/ProTreeModal/components/Trigger.d.ts +1 -1
- package/lib/ProTreeModal/index.d.ts +1 -1
- package/lib/ProTreeModal/index.js +61 -6
- package/lib/ProTreeModal/utils.d.ts +1 -0
- package/lib/ProTreeModal/utils.js +31 -11
- package/lib/ProUpload/components/DraggableUploadListItem.d.ts +1 -1
- package/lib/style/theme/antd.less +5 -0
- package/lib/style/theme/index.less +2 -1
- 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 +1 -1
- package/.vscode/extensions.json +0 -5
- package/es/ProForm/components/render/Changed.d.ts +0 -14
- package/es/ProForm/components/render/Changed.js +0 -64
- package/lib/ProForm/components/render/Changed.d.ts +0 -14
- package/lib/ProForm/components/render/Changed.js +0 -69
- /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
package/es/ProEnum/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
11
11
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
12
12
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
14
|
-
var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps"],
|
|
14
|
+
var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps", "isView"],
|
|
15
15
|
_excluded2 = ["fieldNames", "clear", "cacheKey", "showCodeName"];
|
|
16
16
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
17
|
import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
|
|
@@ -39,10 +39,11 @@ var ProEnum = function ProEnum(props) {
|
|
|
39
39
|
onChange = props.onChange,
|
|
40
40
|
transformResponse = props.transformResponse,
|
|
41
41
|
otherProps = props.otherProps,
|
|
42
|
+
isView = props.isView,
|
|
42
43
|
enumProps = _objectWithoutProperties(props, _excluded);
|
|
43
44
|
var _ref = otherProps || {},
|
|
44
|
-
isView = _ref.isView,
|
|
45
45
|
viewEmpty = _ref.viewEmpty;
|
|
46
|
+
var _isView = isView || (otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView);
|
|
46
47
|
var _ref2 = useProConfig('ProEnum') || {},
|
|
47
48
|
fieldNames = _ref2.fieldNames,
|
|
48
49
|
_ref2$clear = _ref2.clear,
|
|
@@ -226,7 +227,7 @@ var ProEnum = function ProEnum(props) {
|
|
|
226
227
|
if (!code && !dataSource && !useRequest) {
|
|
227
228
|
var _locale$ProEnum4;
|
|
228
229
|
_message.error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum4 = locale.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.errorNoEnumType);
|
|
229
|
-
return;
|
|
230
|
+
// return;
|
|
230
231
|
}
|
|
231
232
|
var transToLabel = function transToLabel(value) {
|
|
232
233
|
var list = dataList && dataList.length ? dataList : enumLists;
|
|
@@ -271,7 +272,7 @@ var ProEnum = function ProEnum(props) {
|
|
|
271
272
|
};
|
|
272
273
|
return isFunction(props.optionRender) && record.length ? _optionRender() : labelList === null || labelList === void 0 ? void 0 : labelList.join(',');
|
|
273
274
|
};
|
|
274
|
-
if (
|
|
275
|
+
if (_isView) {
|
|
275
276
|
if (Array.isArray(value)) {
|
|
276
277
|
return _jsx(Container, {
|
|
277
278
|
tooltip: true,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
@root-entry-name: 'default';
|
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
3
|
|
|
4
|
+
@zaui-disabled-bg: var(--zaui-disabled-bg);
|
|
5
|
+
|
|
4
6
|
.pro-enum {
|
|
5
7
|
&-tag-root {
|
|
6
8
|
display: flex;
|
|
@@ -19,7 +21,7 @@
|
|
|
19
21
|
justify-content: center;
|
|
20
22
|
margin-right: var(--zaui-space-size-sm);
|
|
21
23
|
padding: var(--zaui-space-size-xs) 10px;
|
|
22
|
-
background-color:
|
|
24
|
+
background-color: var(--zaui-disabled-bg);
|
|
23
25
|
border-radius: var(--zaui-space-size-xs);
|
|
24
26
|
cursor: pointer;
|
|
25
27
|
}
|
|
@@ -29,7 +31,7 @@
|
|
|
29
31
|
background-color: var(--zaui-brand);
|
|
30
32
|
}
|
|
31
33
|
&-tag-item-disabled {
|
|
32
|
-
background-color:
|
|
34
|
+
background-color: var(--zaui-disabled-bg);
|
|
33
35
|
pointer-events: none;
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -90,12 +92,20 @@
|
|
|
90
92
|
|
|
91
93
|
.pro-enum-group-item-disabled {
|
|
92
94
|
color: rgba(0, 0, 0, 0.25);
|
|
93
|
-
background:
|
|
95
|
+
background: var(--zaui-disabled-bg);
|
|
94
96
|
cursor: not-allowed;
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
&-group-root-disabled {
|
|
99
|
-
|
|
101
|
+
color: var(--zaui-aide-text);
|
|
102
|
+
|
|
103
|
+
.pro-enum-group-item {
|
|
104
|
+
background: var(--zaui-disabled-bg);
|
|
105
|
+
&.pro-enum-group-item-selected {
|
|
106
|
+
background: var(--zaui-brand-disabled);
|
|
107
|
+
border-color: var(--zaui-brand-disabled);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
100
110
|
}
|
|
101
111
|
}
|
|
@@ -7,7 +7,7 @@ var SimpleEventCenter = /*#__PURE__*/function () {
|
|
|
7
7
|
this.events = void 0;
|
|
8
8
|
this.events = new Map();
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
_createClass(SimpleEventCenter, [{
|
|
11
11
|
key: "subscribe",
|
|
12
12
|
value: function subscribe(eventName, callback) {
|
|
13
13
|
if (!this.events.has(eventName)) {
|
|
@@ -34,5 +34,6 @@ var SimpleEventCenter = /*#__PURE__*/function () {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}]);
|
|
37
|
+
return SimpleEventCenter;
|
|
37
38
|
}(); // 将 eventCenter 实例添加到 window 对象上
|
|
38
39
|
window.eventCenter = new SimpleEventCenter();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) =>
|
|
1
|
+
declare const getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => JSX.Element;
|
|
2
2
|
export default getEnumLabel;
|
|
@@ -9,11 +9,12 @@ import ProCollapse from '../../../../ProLayout/components/ProCollapse';
|
|
|
9
9
|
import ProForm from '../../../../ProForm';
|
|
10
10
|
var Container = function Container(props) {
|
|
11
11
|
var children = props.children,
|
|
12
|
-
otherProps = props.otherProps,
|
|
13
12
|
className = props.className,
|
|
14
13
|
container = props.container,
|
|
15
14
|
show = props.show,
|
|
16
|
-
clearNotShow = props.clearNotShow
|
|
15
|
+
clearNotShow = props.clearNotShow,
|
|
16
|
+
diffConfig = props.diffConfig,
|
|
17
|
+
otherProps = props.otherProps;
|
|
17
18
|
var _ref = ProForm.useFieldProps() || {},
|
|
18
19
|
type = _ref.type,
|
|
19
20
|
form = _ref.form,
|
|
@@ -38,7 +39,8 @@ var Container = function Container(props) {
|
|
|
38
39
|
var childRender = function childRender() {
|
|
39
40
|
var child = _jsx(RenderFields, _objectSpread({
|
|
40
41
|
columns: _children,
|
|
41
|
-
form: form
|
|
42
|
+
form: form,
|
|
43
|
+
diffConfig: diffConfig
|
|
42
44
|
}, otherProps));
|
|
43
45
|
if (type === 'ProCollapse') {
|
|
44
46
|
return _jsx(ProCollapse, _objectSpread(_objectSpread({}, omit(props, ['otherProps', 'children', 'onBlur', 'onChange', 'placeholder', 'className'])), {}, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RowProps } from 'antd';
|
|
3
|
-
import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
|
|
3
|
+
import { ProColumnProps, ProFormOtherProps, DiffConfigProps } from '../../../propsType';
|
|
4
4
|
export interface ContainerProps {
|
|
5
5
|
children?: ProColumnProps[];
|
|
6
6
|
otherProps?: ProFormOtherProps;
|
|
@@ -8,5 +8,6 @@ export interface ContainerProps {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
container?: string | React.ReactNode;
|
|
10
10
|
show?: boolean | (() => boolean);
|
|
11
|
+
diffConfig?: DiffConfigProps;
|
|
11
12
|
clearNotShow?: boolean;
|
|
12
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ProCascaderProps } from './propsType';
|
|
3
|
-
declare const _default: import("react").MemoExoticComponent<(props: ProCascaderProps) =>
|
|
3
|
+
declare const _default: import("react").MemoExoticComponent<(props: ProCascaderProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|
|
@@ -29,9 +29,9 @@ var defaultFieldNames = {
|
|
|
29
29
|
value: 'code',
|
|
30
30
|
children: 'children'
|
|
31
31
|
};
|
|
32
|
-
var
|
|
32
|
+
var filterDataSource = function filterDataSource(dataSource, level, fieldNames) {
|
|
33
33
|
return dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
|
|
34
|
-
return _objectSpread(_objectSpread({}, item), {}, _defineProperty({}, (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children', level === 1 ? [] :
|
|
34
|
+
return _objectSpread(_objectSpread({}, item), {}, _defineProperty({}, (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children', level === 1 ? [] : filterDataSource(item === null || item === void 0 ? void 0 : item[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'], level - 1, fieldNames)));
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
var getViewLabel = function getViewLabel(_ref) {
|
|
@@ -96,7 +96,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
96
96
|
enumDataSource = _ref5$ === void 0 ? [] : _ref5$;
|
|
97
97
|
var realDataSource = useMemo(function () {
|
|
98
98
|
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
|
99
|
-
var result = isAddressMode && realLevel === 2 ?
|
|
99
|
+
var result = isAddressMode && realLevel === 2 ? filterDataSource(innerDataSource, level, fieldNames) : innerDataSource;
|
|
100
100
|
return transformDataName(result, fieldNames);
|
|
101
101
|
}, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
|
102
102
|
var _useRequest = _objectSpread({}, useRequest),
|
|
@@ -131,7 +131,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
131
131
|
value: fieldNames.value,
|
|
132
132
|
children: (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'
|
|
133
133
|
});
|
|
134
|
-
serviceData = isAddressMode && realLevel === 2 ?
|
|
134
|
+
serviceData = isAddressMode && realLevel === 2 ? filterDataSource(transFormData, level, fieldNames) : transFormData;
|
|
135
135
|
setServiceData(serviceData);
|
|
136
136
|
case 9:
|
|
137
137
|
case "end":
|
|
@@ -196,7 +196,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
196
196
|
})) === null || _ref7$filter === void 0 ? void 0 : _ref7$filter.join(separator)) || '-' : (defaultLabel === null || defaultLabel === void 0 ? void 0 : (_defaultLabel$filter = defaultLabel.filter(function (item) {
|
|
197
197
|
return !!item;
|
|
198
198
|
})) === null || _defaultLabel$filter === void 0 ? void 0 : _defaultLabel$filter.join(separator)) || '-';
|
|
199
|
-
var
|
|
199
|
+
var findSelectedOptions = function findSelectedOptions(options, value) {
|
|
200
200
|
var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
201
201
|
var _value = value !== null && value !== void 0 ? value : [];
|
|
202
202
|
// 基准情况:如果 value 数组为空,且 path 不为空,说明找到了完整的路径
|
|
@@ -215,7 +215,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
215
215
|
if (foundOption) {
|
|
216
216
|
// 如果找到了匹配的选项,并且还有更多的 value 需要匹配,递归地在子选项中查找
|
|
217
217
|
if (_value.length > 1 && foundOption.children) {
|
|
218
|
-
return
|
|
218
|
+
return findSelectedOptions(foundOption.children, _value.slice(1), [].concat(_toConsumableArray(path), [foundOption]));
|
|
219
219
|
}
|
|
220
220
|
// 如果没有更多的 value 需要匹配,返回当前选项(以及之前的路径)
|
|
221
221
|
return [].concat(_toConsumableArray(path), [foundOption]);
|
|
@@ -224,7 +224,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
224
224
|
return null;
|
|
225
225
|
};
|
|
226
226
|
var _selectedOptions = useMemo(function () {
|
|
227
|
-
return
|
|
227
|
+
return findSelectedOptions(service ? serviceData : realDataSource, addressValue);
|
|
228
228
|
}, [service, serviceData, realDataSource, addressValue]);
|
|
229
229
|
var handleAddressChange = function handleAddressChange(e) {
|
|
230
230
|
var cascaderValue = value === null || value === void 0 ? void 0 : value.slice(0, realLevel);
|
|
@@ -27,7 +27,7 @@ import { SearchOutlined } from '@ant-design/icons';
|
|
|
27
27
|
import { useDeepCompareEffect, useMount, useSetState } from 'ahooks';
|
|
28
28
|
import { debounce, isArray, isEqual, isFunction, omit } from 'lodash';
|
|
29
29
|
import { ReactSVG } from 'react-svg';
|
|
30
|
-
import React, { forwardRef,
|
|
30
|
+
import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
31
31
|
import { ProForm, ProDrawerForm, ProTable, useProConfig, ProSelect } from '../../../../index';
|
|
32
32
|
import Container from '../../Container';
|
|
33
33
|
import viewSvg from '../../../../assets/view.svg';
|
|
@@ -137,10 +137,10 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
137
137
|
}, _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
|
|
138
138
|
manual: true,
|
|
139
139
|
onSuccess: function onSuccess(res) {
|
|
140
|
-
var _res$data;
|
|
140
|
+
var _res$data, _ref5;
|
|
141
141
|
var list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list : res === null || res === void 0 ? void 0 : res.data;
|
|
142
142
|
setState({
|
|
143
|
-
options: transformResponse ? transformResponse(res === null || res === void 0 ? void 0 : res.data) : list
|
|
143
|
+
options: (_ref5 = transformResponse ? transformResponse(res === null || res === void 0 ? void 0 : res.data) : list) !== null && _ref5 !== void 0 ? _ref5 : []
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
})),
|
|
@@ -166,9 +166,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
166
166
|
};
|
|
167
167
|
var handleFormat = onFormat || defaultOptionRender;
|
|
168
168
|
if (showCodeName) {
|
|
169
|
-
handleFormat = function handleFormat(
|
|
170
|
-
var value =
|
|
171
|
-
label =
|
|
169
|
+
handleFormat = function handleFormat(_ref6) {
|
|
170
|
+
var value = _ref6.value,
|
|
171
|
+
label = _ref6.label;
|
|
172
172
|
return "".concat(value, "-").concat(label);
|
|
173
173
|
};
|
|
174
174
|
}
|
|
@@ -237,7 +237,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
237
237
|
onChange(val, option);
|
|
238
238
|
};
|
|
239
239
|
var handleClick = /*#__PURE__*/function () {
|
|
240
|
-
var
|
|
240
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
241
241
|
var _yield$beforeOpen, res;
|
|
242
242
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
243
243
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -280,7 +280,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
280
280
|
}, _callee);
|
|
281
281
|
}));
|
|
282
282
|
return function handleClick() {
|
|
283
|
-
return
|
|
283
|
+
return _ref7.apply(this, arguments);
|
|
284
284
|
};
|
|
285
285
|
}();
|
|
286
286
|
var handleClose = function handleClose() {
|
|
@@ -299,7 +299,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
299
299
|
}
|
|
300
300
|
};
|
|
301
301
|
var handleFinish = /*#__PURE__*/function () {
|
|
302
|
-
var
|
|
302
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
303
303
|
var _nextSelectedRows, _nextSelectedRows2, nextSelectedRows, record, flag, res;
|
|
304
304
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
305
305
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -360,11 +360,11 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
360
360
|
}, _callee2, null, [[0, 18]]);
|
|
361
361
|
}));
|
|
362
362
|
return function handleFinish() {
|
|
363
|
-
return
|
|
363
|
+
return _ref8.apply(this, arguments);
|
|
364
364
|
};
|
|
365
365
|
}();
|
|
366
366
|
var handleSearch = /*#__PURE__*/function () {
|
|
367
|
-
var
|
|
367
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
368
368
|
var values;
|
|
369
369
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
370
370
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -383,7 +383,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
383
383
|
}, _callee3);
|
|
384
384
|
}));
|
|
385
385
|
return function handleSearch() {
|
|
386
|
-
return
|
|
386
|
+
return _ref9.apply(this, arguments);
|
|
387
387
|
};
|
|
388
388
|
}();
|
|
389
389
|
var _rowSelection = _objectSpread({
|
|
@@ -437,7 +437,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
437
437
|
};
|
|
438
438
|
// 初始化回显,当传入initParams时,前端用来回险
|
|
439
439
|
var getInitValues = /*#__PURE__*/function () {
|
|
440
|
-
var
|
|
440
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
441
441
|
var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
|
|
442
442
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
443
443
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -495,12 +495,12 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
495
495
|
}, _callee4);
|
|
496
496
|
}));
|
|
497
497
|
return function getInitValues() {
|
|
498
|
-
return
|
|
498
|
+
return _ref10.apply(this, arguments);
|
|
499
499
|
};
|
|
500
500
|
}();
|
|
501
501
|
// 初始化回显,当传入initParams时,前端用来回险
|
|
502
502
|
var getDefaultOneValues = /*#__PURE__*/function () {
|
|
503
|
-
var
|
|
503
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
504
504
|
var _useRequest$options4, _useRequest$options5;
|
|
505
505
|
var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
|
|
506
506
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
@@ -548,7 +548,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
548
548
|
}, _callee5);
|
|
549
549
|
}));
|
|
550
550
|
return function getDefaultOneValues() {
|
|
551
|
-
return
|
|
551
|
+
return _ref11.apply(this, arguments);
|
|
552
552
|
};
|
|
553
553
|
}();
|
|
554
554
|
useImperativeHandle(ref, function () {
|
|
@@ -579,7 +579,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
579
579
|
});
|
|
580
580
|
}
|
|
581
581
|
});
|
|
582
|
-
|
|
582
|
+
useDeepCompareEffect(function () {
|
|
583
583
|
if (onOff && !visible) {
|
|
584
584
|
var _useRequest$options6;
|
|
585
585
|
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.manual) !== true) {
|
|
@@ -615,34 +615,39 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
615
615
|
setState(nextState);
|
|
616
616
|
}
|
|
617
617
|
}, [onOff, visible, value]);
|
|
618
|
-
|
|
619
|
-
if (value && !visible && isInit) {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
pageSize: 50,
|
|
632
|
-
queryBean: _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.defaultParams), initParams)
|
|
633
|
-
} : _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
|
|
634
|
-
var nextParams = transformParams ? transformParams(params) : params;
|
|
635
|
-
run(nextParams);
|
|
636
|
-
setState({
|
|
637
|
-
isInit: false
|
|
638
|
-
});
|
|
639
|
-
}, 300);
|
|
640
|
-
} else {
|
|
641
|
-
getInitValues();
|
|
618
|
+
useDeepCompareEffect(function () {
|
|
619
|
+
if (value && !visible && isInit && !readOnly) {
|
|
620
|
+
getInitValues();
|
|
621
|
+
}
|
|
622
|
+
}, [value, visible, isInit]);
|
|
623
|
+
useDeepCompareEffect(function () {
|
|
624
|
+
if (value && !visible && readOnly) {
|
|
625
|
+
var _options$some;
|
|
626
|
+
var isHasValue = options === null || options === void 0 ? void 0 : (_options$some = options.some) === null || _options$some === void 0 ? void 0 : _options$some.call(options, function (item) {
|
|
627
|
+
return item[valueKey] === value;
|
|
628
|
+
});
|
|
629
|
+
if (isHasValue) {
|
|
630
|
+
return;
|
|
642
631
|
}
|
|
632
|
+
// 加定时器 修复依赖数据同步更新未取到问题
|
|
633
|
+
setTimeout(function () {
|
|
634
|
+
var _useRequest$options7, _useRequest$options8;
|
|
635
|
+
var initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams;
|
|
636
|
+
if (typeof (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) === 'function') {
|
|
637
|
+
var _contentForm$getField2;
|
|
638
|
+
initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField2 = contentForm.getFieldsValue) === null || _contentForm$getField2 === void 0 ? void 0 : _contentForm$getField2.call(contentForm));
|
|
639
|
+
}
|
|
640
|
+
var params = withPagination ? {
|
|
641
|
+
pageNum: 1,
|
|
642
|
+
pageSize: 50,
|
|
643
|
+
queryBean: _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.defaultParams), initParams)
|
|
644
|
+
} : _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
|
|
645
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
|
646
|
+
run(nextParams);
|
|
647
|
+
}, 300);
|
|
643
648
|
}
|
|
644
|
-
}, [value,
|
|
645
|
-
|
|
649
|
+
}, [value, options, visible, useRequest]);
|
|
650
|
+
useDeepCompareEffect(function () {
|
|
646
651
|
if (!value) {
|
|
647
652
|
if (defaultOne) {
|
|
648
653
|
getDefaultOneValues();
|
|
@@ -742,7 +747,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
742
747
|
children: customRender
|
|
743
748
|
});
|
|
744
749
|
}
|
|
745
|
-
|
|
750
|
+
useDeepCompareEffect(function () {
|
|
746
751
|
if (isTooltip && value) {
|
|
747
752
|
var dom = document.getElementById(uuid);
|
|
748
753
|
dom.addEventListener('mouseover', function (e) {
|
|
@@ -779,7 +784,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
779
784
|
}, [value, isTooltip]);
|
|
780
785
|
useDeepCompareEffect(function () {
|
|
781
786
|
setState({
|
|
782
|
-
options: tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource
|
|
787
|
+
options: (tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource) || []
|
|
783
788
|
});
|
|
784
789
|
}, [tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource]);
|
|
785
790
|
// 当搜索条件只有一个时,且为输入框,默认设置suffix
|
|
@@ -91,7 +91,9 @@ var ProNumberRange = function ProNumberRange(props) {
|
|
|
91
91
|
});
|
|
92
92
|
// 查看模式
|
|
93
93
|
if (isView || props.isView) {
|
|
94
|
-
if (isEmpty(value)) {
|
|
94
|
+
if (isEmpty(value) || (value === null || value === void 0 ? void 0 : value.every(function (item) {
|
|
95
|
+
return typeof item !== 'number';
|
|
96
|
+
}))) {
|
|
95
97
|
return viewEmpty;
|
|
96
98
|
}
|
|
97
99
|
switch (valueType) {
|
|
@@ -12,5 +12,5 @@ export interface InputRangeProps {
|
|
|
12
12
|
isPositiveInteger?: boolean;
|
|
13
13
|
precision?: number;
|
|
14
14
|
}
|
|
15
|
-
declare const InputRange: ({ value, onChange, min, max, group, disabled, precision, isPositiveInteger, }: InputRangeProps) =>
|
|
15
|
+
declare const InputRange: ({ value, onChange, min, max, group, disabled, precision, isPositiveInteger, }: InputRangeProps) => JSX.Element;
|
|
16
16
|
export default InputRange;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ProAddressPropsType } from './propsTypes';
|
|
2
3
|
export declare const transferAddressInfoToRegion: () => {
|
|
3
4
|
normalize: (value: any) => {
|
|
@@ -23,5 +24,5 @@ export declare const transferAddressInfoToRegion: () => {
|
|
|
23
24
|
};
|
|
24
25
|
};
|
|
25
26
|
};
|
|
26
|
-
export declare function ProAddress({ ...props }: ProAddressPropsType):
|
|
27
|
+
export declare function ProAddress({ ...props }: ProAddressPropsType): JSX.Element;
|
|
27
28
|
export default ProAddress;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ProRangeBoxPropsType } from './propsType';
|
|
2
|
-
export default function ProRangeBox({ configOption }: ProRangeBoxPropsType):
|
|
3
|
+
export default function ProRangeBox({ configOption }: ProRangeBoxPropsType): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
valuePropName?: string;
|
|
14
|
+
[name: string]: any;
|
|
15
|
+
}
|
|
16
|
+
declare const ChangedWrapper: React.FC<Props>;
|
|
17
|
+
export default ChangedWrapper;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import "antd/es/space/style";
|
|
2
|
+
import _Space from "antd/es/space";
|
|
3
|
+
import "antd/es/tooltip/style";
|
|
4
|
+
import _Tooltip from "antd/es/tooltip";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
8
|
+
var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName"];
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
import classNames from 'classnames';
|
|
11
|
+
import { get } from 'lodash';
|
|
12
|
+
import React, { useMemo } from 'react';
|
|
13
|
+
import { diffOriginal } from '../../utils/diffOriginal';
|
|
14
|
+
import { useProConfig } from '../../../ProConfigProvider';
|
|
15
|
+
import { isEmpty } from '../../../utils';
|
|
16
|
+
var ChangedWrapper = function ChangedWrapper(props) {
|
|
17
|
+
var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
|
|
18
|
+
var name = props.name,
|
|
19
|
+
names = props.names,
|
|
20
|
+
namesStr = props.namesStr,
|
|
21
|
+
form = props.form,
|
|
22
|
+
equalWith = props.equalWith,
|
|
23
|
+
children = props.children,
|
|
24
|
+
type = props.type,
|
|
25
|
+
diffConfig = props.diffConfig,
|
|
26
|
+
_props$valuePropName = props.valuePropName,
|
|
27
|
+
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
28
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
29
|
+
var _useProConfig = useProConfig('ProForm'),
|
|
30
|
+
isDiffAll = _useProConfig.isDiffAll;
|
|
31
|
+
var originalValues = diffConfig.originalValues,
|
|
32
|
+
changeTipColor = diffConfig.changeTipColor,
|
|
33
|
+
addTipColor = diffConfig.addTipColor;
|
|
34
|
+
var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
|
|
35
|
+
var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
|
|
36
|
+
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
|
37
|
+
return get(originalValues, name);
|
|
38
|
+
}) : get(originalValues, name);
|
|
39
|
+
var noChange = !equalWith && (!originalValues || isDiffAll ? false : isEmpty(originalValue));
|
|
40
|
+
var diffType = useMemo(function () {
|
|
41
|
+
if (!isWatch || noChange) return 'same';
|
|
42
|
+
return diffOriginal({
|
|
43
|
+
originalValue: originalValue,
|
|
44
|
+
value: props[valuePropName],
|
|
45
|
+
form: form,
|
|
46
|
+
equalWith: equalWith
|
|
47
|
+
// name: namesStr || name,
|
|
48
|
+
});
|
|
49
|
+
}, [isWatch, noChange, props[valuePropName], originalValue]);
|
|
50
|
+
var isAdd = diffType === 'add';
|
|
51
|
+
var isChanged = diffType === 'changed';
|
|
52
|
+
var tipContent = useMemo(function () {
|
|
53
|
+
if (!isWatch || noChange) return undefined;
|
|
54
|
+
return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, _defineProperty({
|
|
55
|
+
isView: true
|
|
56
|
+
}, valuePropName, originalValue))) : undefined;
|
|
57
|
+
}, [originalValue, children]);
|
|
58
|
+
if (!isWatch || noChange) {
|
|
59
|
+
// 嵌套子组件
|
|
60
|
+
var isNestedField = ['ProEditTable'].includes(type);
|
|
61
|
+
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({
|
|
62
|
+
originalValues: isNestedField ? originalValues : undefined
|
|
63
|
+
}, children.props), rest));
|
|
64
|
+
}
|
|
65
|
+
var tipOpenCalc = function tipOpenCalc() {
|
|
66
|
+
if (!toolTip) return false;
|
|
67
|
+
// 传入undefined 鼠标移入显示移出隐藏
|
|
68
|
+
return isChanged ? undefined : false;
|
|
69
|
+
};
|
|
70
|
+
var style = {
|
|
71
|
+
'--zaui-contract-bg': changeTipColor,
|
|
72
|
+
'--zaui-contract-bg-add': addTipColor
|
|
73
|
+
};
|
|
74
|
+
var diffClassName = classNames({
|
|
75
|
+
'pro-form-item-changed': isChanged,
|
|
76
|
+
'pro-form-item-add': isAdd
|
|
77
|
+
});
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
var _showEllipse = ((_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.showEllipse) || ((_children$props2 = children.props) === null || _children$props2 === void 0 ? void 0 : _children$props2.tooltip);
|
|
80
|
+
return _jsx(_Tooltip, {
|
|
81
|
+
open: tipOpenCalc(),
|
|
82
|
+
mouseEnterDelay: 1,
|
|
83
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
84
|
+
return target.parentElement;
|
|
85
|
+
},
|
|
86
|
+
title: _jsxs(_Space, {
|
|
87
|
+
direction: "vertical",
|
|
88
|
+
children: [_jsxs(_Space, {
|
|
89
|
+
children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
|
|
90
|
+
}), _showEllipse && _jsxs(_Space, {
|
|
91
|
+
children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
|
|
92
|
+
isView: true
|
|
93
|
+
})) : undefined]
|
|
94
|
+
})]
|
|
95
|
+
}),
|
|
96
|
+
placement: "topLeft",
|
|
97
|
+
children: _jsx("div", {
|
|
98
|
+
className: diffClassName,
|
|
99
|
+
style: style,
|
|
100
|
+
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
|
|
101
|
+
otherProps: _objectSpread(_objectSpread({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
|
|
102
|
+
isDiffChange: isChanged
|
|
103
|
+
})
|
|
104
|
+
})) : undefined
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
export default ChangedWrapper;
|
|
@@ -28,7 +28,7 @@ import valueTypeMap from '../../utils/valueType';
|
|
|
28
28
|
import tipSvg from '../../../assets/tip.svg';
|
|
29
29
|
import useRules from '../../utils/useRules';
|
|
30
30
|
import ConfirmWrapper from './ConfirmWrapper';
|
|
31
|
-
import
|
|
31
|
+
import ChangedWrapper from './ChangedWrapper';
|
|
32
32
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
33
33
|
var Render = function Render(props) {
|
|
34
34
|
var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
|
|
@@ -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 = _jsx(
|
|
429
|
+
if (diffConfig) {
|
|
430
|
+
child = _jsx(ChangedWrapper, {
|
|
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
|
}
|