@zat-design/sisyphus-react 3.7.3-beta.2 → 3.7.3-beta.20
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/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.js +3 -3
- package/es/ProEnum/components/Group.js +10 -2
- package/es/ProEnum/index.js +5 -4
- package/es/ProEnum/style/index.less +14 -4
- 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/ProModalSelect/index.js +50 -45
- package/es/ProForm/components/combination/ProNumberRange/index.js +3 -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/transformValue.js +17 -11
- package/es/ProSelect/index.js +3 -3
- package/es/ProSelect/utils/index.js +5 -4
- package/es/ProStep/components/Listener/index.d.ts +1 -1
- package/es/ProStep/components/Listener/index.js +5 -2
- package/es/ProStep/index.d.ts +1 -1
- package/es/ProStep/index.js +24 -17
- package/es/ProTable/components/FormatColumn/index.d.ts +7 -1
- package/es/ProTable/components/FormatColumn/index.js +14 -8
- 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/ProTree/components/AdaptiveTooltip.d.ts +4 -0
- package/es/ProTree/components/AdaptiveTooltip.js +55 -0
- package/es/ProTree/components/List.js +15 -3
- package/es/ProTree/components/ProTreeSelect/index.js +25 -5
- 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 +2 -0
- package/es/ProTree/components/SearchTitle.js +17 -8
- package/es/ProTree/style/index.less +14 -0
- package/es/ProTreeModal/components/Tree.js +15 -17
- package/es/ProTreeModal/index.js +62 -7
- package/es/ProTreeModal/utils.d.ts +1 -0
- package/es/ProTreeModal/utils.js +21 -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/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.js +3 -3
- package/lib/ProEnum/components/Group.js +10 -2
- package/lib/ProEnum/index.js +5 -4
- package/lib/ProEnum/style/index.less +14 -4
- 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/ProModalSelect/index.js +49 -44
- package/lib/ProForm/components/combination/ProNumberRange/index.js +3 -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/transformValue.js +17 -11
- package/lib/ProSelect/index.js +3 -3
- package/lib/ProSelect/utils/index.js +5 -4
- package/lib/ProStep/components/Listener/index.d.ts +1 -1
- package/lib/ProStep/components/Listener/index.js +5 -2
- package/lib/ProStep/index.d.ts +1 -1
- package/lib/ProStep/index.js +24 -17
- package/lib/ProTable/components/FormatColumn/index.d.ts +7 -1
- package/lib/ProTable/components/FormatColumn/index.js +14 -8
- 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/ProTree/components/AdaptiveTooltip.d.ts +4 -0
- package/lib/ProTree/components/AdaptiveTooltip.js +61 -0
- package/lib/ProTree/components/List.js +15 -3
- package/lib/ProTree/components/ProTreeSelect/index.js +25 -5
- 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 +2 -0
- package/lib/ProTree/components/SearchTitle.js +19 -7
- package/lib/ProTree/style/index.less +14 -0
- package/lib/ProTreeModal/components/Tree.js +15 -17
- package/lib/ProTreeModal/index.js +61 -6
- package/lib/ProTreeModal/utils.d.ts +1 -0
- package/lib/ProTreeModal/utils.js +20 -0
- 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
|
@@ -59,6 +59,16 @@ export interface DragStartGuardProps {
|
|
|
59
59
|
activeObject: any;
|
|
60
60
|
currentDataSource: any[];
|
|
61
61
|
}
|
|
62
|
+
export interface TableDiffConfigProps {
|
|
63
|
+
/** 比对原始数据源 */
|
|
64
|
+
originalDataSource: any[];
|
|
65
|
+
/** 是否显示对比值气泡 */
|
|
66
|
+
toolTip?: boolean;
|
|
67
|
+
/** 变更提示颜色 */
|
|
68
|
+
changeTipColor?: string;
|
|
69
|
+
/** 新增提示颜色 */
|
|
70
|
+
addTipColor?: string;
|
|
71
|
+
}
|
|
62
72
|
export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary' | 'columns'> {
|
|
63
73
|
tableId?: string;
|
|
64
74
|
rowKey?: string | GetRowKey<any>;
|
|
@@ -84,7 +94,10 @@ export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary'
|
|
|
84
94
|
*/
|
|
85
95
|
stripe?: boolean;
|
|
86
96
|
columns: ProTableColumn[];
|
|
87
|
-
|
|
97
|
+
/**
|
|
98
|
+
* 比对配置
|
|
99
|
+
*/
|
|
100
|
+
diffConfig?: TableDiffConfigProps;
|
|
88
101
|
/**
|
|
89
102
|
* 拖拽额外配置
|
|
90
103
|
*/
|
|
@@ -270,7 +270,7 @@
|
|
|
270
270
|
.@{ant-prefix}-table-cell .varied-cell {
|
|
271
271
|
margin-left: -8px;
|
|
272
272
|
padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
|
|
273
|
-
background: var(--zaui-contract-bg
|
|
273
|
+
background: var(--zaui-contract-bg; #fffaa1) !important;
|
|
274
274
|
border-radius: var(--zaui-border-radius, 8px);
|
|
275
275
|
}
|
|
276
276
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import "antd/es/tooltip/style";
|
|
2
|
+
import _Tooltip from "antd/es/tooltip";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
/*
|
|
6
|
+
* @Author: za-xuwenli xuwenli@zhongan.io
|
|
7
|
+
* @Date: 2024-09-20 10:26:04
|
|
8
|
+
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
|
9
|
+
* @LastEditTime: 2024-09-26 14:12:44
|
|
10
|
+
* @FilePath: /za-material-warehouse/src/ProTree/components/AdaptiveTooltip.tsx
|
|
11
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { useEffect, useState } from 'react';
|
|
15
|
+
var AdaptiveTooltip = function AdaptiveTooltip(_ref) {
|
|
16
|
+
var children = _ref.children;
|
|
17
|
+
var _useState = useState('right'),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
placement = _useState2[0],
|
|
20
|
+
setPlacement = _useState2[1];
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
var handleResize = function handleResize() {
|
|
23
|
+
var tooltipElement = document.getElementById('adaptive-tooltip');
|
|
24
|
+
if (tooltipElement) {
|
|
25
|
+
var boundingRect = tooltipElement.getBoundingClientRect();
|
|
26
|
+
var windowWidth = window.innerWidth;
|
|
27
|
+
if (windowWidth - boundingRect.right < 150) {
|
|
28
|
+
setPlacement('left');
|
|
29
|
+
} else {
|
|
30
|
+
setPlacement('right');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
window.addEventListener('resize', handleResize);
|
|
35
|
+
handleResize();
|
|
36
|
+
return function () {
|
|
37
|
+
window.removeEventListener('resize', handleResize);
|
|
38
|
+
};
|
|
39
|
+
}, [children]);
|
|
40
|
+
return _jsx(_Tooltip, {
|
|
41
|
+
placement: placement,
|
|
42
|
+
title: _jsx("div", {
|
|
43
|
+
onMouseDown: function onMouseDown(e) {
|
|
44
|
+
return e.stopPropagation();
|
|
45
|
+
},
|
|
46
|
+
children: children
|
|
47
|
+
}),
|
|
48
|
+
id: "adaptive-tooltip",
|
|
49
|
+
children: _jsxs("span", {
|
|
50
|
+
className: "pro-tree-wrap-ellipse",
|
|
51
|
+
children: [" ", children]
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export default AdaptiveTooltip;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
1
2
|
import "antd/es/checkbox/style";
|
|
2
3
|
import _Checkbox from "antd/es/checkbox";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["checkedValues", "disabled", "treeData", "searchStr", "showCodeName", "mode", "fieldNames", "handleOnChange", "handleFilterClose", "optionRender"];
|
|
3
6
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
/*
|
|
8
|
+
* @Author: za-xuwenli xuwenli@zhongan.io
|
|
9
|
+
* @Date: 2024-07-03 11:02:19
|
|
10
|
+
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
|
11
|
+
* @LastEditTime: 2024-09-26 14:30:26
|
|
12
|
+
* @FilePath: /za-material-warehouse/src/ProTree/components/List.tsx
|
|
13
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
14
|
+
*/
|
|
4
15
|
import { memo } from 'react';
|
|
5
16
|
import SearchTitle from './SearchTitle';
|
|
6
17
|
import CloseIcon from './CloseIcon';
|
|
@@ -15,7 +26,8 @@ function List(props) {
|
|
|
15
26
|
fieldNames = props.fieldNames,
|
|
16
27
|
handleOnChange = props.handleOnChange,
|
|
17
28
|
handleFilterClose = props.handleFilterClose,
|
|
18
|
-
optionRender = props.optionRender
|
|
29
|
+
optionRender = props.optionRender,
|
|
30
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
19
31
|
var fieldNameLabel = fieldNames.label;
|
|
20
32
|
var fieldNameValue = fieldNames.value;
|
|
21
33
|
if (mode === 'render') {
|
|
@@ -37,10 +49,10 @@ function List(props) {
|
|
|
37
49
|
value: item[fieldNameValue],
|
|
38
50
|
disabled: item.disabled,
|
|
39
51
|
children: _jsx("span", {
|
|
40
|
-
children: optionRender ? optionRender(item, searchStr) : _jsx(SearchTitle, {
|
|
52
|
+
children: optionRender ? optionRender(item, searchStr) : _jsx(SearchTitle, _objectSpread({
|
|
41
53
|
label: title,
|
|
42
54
|
searchStr: searchStr
|
|
43
|
-
})
|
|
55
|
+
}, other))
|
|
44
56
|
})
|
|
45
57
|
})
|
|
46
58
|
}, item[fieldNameValue]);
|
|
@@ -21,6 +21,7 @@ import { useImperativeHandle, forwardRef } from 'react';
|
|
|
21
21
|
import { cloneDeep } from 'lodash';
|
|
22
22
|
import { useProConfig } from '../../../ProConfigProvider';
|
|
23
23
|
import Container from '../../../ProForm/components/Container';
|
|
24
|
+
import AdaptiveTooltip from '../AdaptiveTooltip';
|
|
24
25
|
var SHOW_PARENT = _TreeSelect.SHOW_PARENT;
|
|
25
26
|
export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
26
27
|
// 全局属性配置在ConfigProvider
|
|
@@ -74,9 +75,14 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
74
75
|
selectProps = _objectWithoutProperties(props, _excluded);
|
|
75
76
|
var _props$value = props.value,
|
|
76
77
|
value = _props$value === void 0 ? undefined : _props$value;
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
var _props$showEllipse = props.showEllipse,
|
|
79
|
+
showEllipse = _props$showEllipse === void 0 ? true : _props$showEllipse;
|
|
80
|
+
var _ref2 = otherProps !== null && otherProps !== void 0 ? otherProps : {},
|
|
81
|
+
isDiffChange = _ref2.isDiffChange;
|
|
82
|
+
var _showEllipse = showEllipse && !isDiffChange;
|
|
83
|
+
var _ref3 = otherProps || {},
|
|
84
|
+
isView = _ref3.isView,
|
|
85
|
+
viewEmpty = _ref3.viewEmpty;
|
|
80
86
|
if (fieldNames && Object.keys(fieldNames).length) {
|
|
81
87
|
code = fieldNames.value || 'value';
|
|
82
88
|
label = fieldNames.label || 'label';
|
|
@@ -209,8 +215,8 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
209
215
|
return undefined;
|
|
210
216
|
}
|
|
211
217
|
// 如果配置手动加载,不执行请求
|
|
212
|
-
var
|
|
213
|
-
defaultParams =
|
|
218
|
+
var _ref4 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
|
219
|
+
defaultParams = _ref4.defaultParams;
|
|
214
220
|
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
|
215
221
|
fetchFunction.run(defaultParams);
|
|
216
222
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, defaultDisableValue]);
|
|
@@ -312,6 +318,20 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
312
318
|
children: _jsx(Icon, {})
|
|
313
319
|
}) : null]
|
|
314
320
|
});
|
|
321
|
+
if (_showEllipse) {
|
|
322
|
+
title = _jsx(AdaptiveTooltip, {
|
|
323
|
+
children: treeCheckable ? titleHtml : _jsxs("span", {
|
|
324
|
+
className: "check-option-text",
|
|
325
|
+
children: [_jsx("span", {
|
|
326
|
+
className: "check-option-text-content",
|
|
327
|
+
children: titleHtml
|
|
328
|
+
}), !disabled ? _jsx("span", {
|
|
329
|
+
className: "check-mark-icon",
|
|
330
|
+
children: _jsx(Icon, {})
|
|
331
|
+
}) : null]
|
|
332
|
+
})
|
|
333
|
+
});
|
|
334
|
+
}
|
|
315
335
|
if (!children) {
|
|
316
336
|
return _jsx(_TreeSelect.TreeNode, {
|
|
317
337
|
value: value,
|
|
@@ -73,6 +73,8 @@ export interface PropTreeSelectProps extends Omit<TreeSelectProps, 'onSearch'> {
|
|
|
73
73
|
expandedKeys?: any[];
|
|
74
74
|
checkStrictly?: boolean;
|
|
75
75
|
checkable?: boolean;
|
|
76
|
+
showEllipse?: boolean;
|
|
77
|
+
isDiffChange?: boolean;
|
|
76
78
|
}
|
|
77
79
|
export interface ProSelectAction {
|
|
78
80
|
/** 获取发生请求的 useRequest 的 ref */
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
.@{ant-prefix}-select-tree-treenode:hover{
|
|
73
|
-
background-color:
|
|
73
|
+
background-color: var(--zaui-disabled-bg);
|
|
74
74
|
}
|
|
75
75
|
.check-option-text{
|
|
76
76
|
.check-mark-icon{
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
padding-left: 7px;
|
|
91
91
|
}
|
|
92
92
|
.@{ant-prefix}-select-tree-treenode:hover{
|
|
93
|
-
background-color:
|
|
93
|
+
background-color: var(--zaui-disabled-bg);;
|
|
94
94
|
}
|
|
95
95
|
.@{ant-prefix}-select-tree-node-content-wrapper{
|
|
96
96
|
padding-right: var(--zaui-space-size-md);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ProFormOtherProps } from '../../ProForm/propsType';
|
|
2
3
|
declare function SearchTitle(props: {
|
|
3
4
|
searchStr?: string;
|
|
4
5
|
label?: string;
|
|
5
6
|
showEllipse?: boolean;
|
|
6
7
|
ellipseWidth?: string;
|
|
8
|
+
otherProps?: ProFormOtherProps;
|
|
7
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
declare const _default: import("react").MemoExoticComponent<typeof SearchTitle>;
|
|
9
11
|
export default _default;
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import "antd/es/tooltip/style";
|
|
2
|
-
import _Tooltip from "antd/es/tooltip";
|
|
3
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* @Author: za-xuwenli xuwenli@zhongan.io
|
|
4
|
+
* @Date: 2024-09-26 14:37:00
|
|
5
|
+
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
|
6
|
+
* @LastEditTime: 2024-09-26 17:50:59
|
|
7
|
+
* @FilePath: /za-material-warehouse/src/ProTree/components/SearchTitle.tsx
|
|
8
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
9
|
+
*/
|
|
4
10
|
import { memo } from 'react';
|
|
11
|
+
import AdaptiveTooltip from './AdaptiveTooltip';
|
|
5
12
|
function SearchTitle(props) {
|
|
6
13
|
var label = props.label,
|
|
7
14
|
_props$searchStr = props.searchStr,
|
|
8
15
|
searchStr = _props$searchStr === void 0 ? '' : _props$searchStr,
|
|
9
16
|
showEllipse = props.showEllipse,
|
|
10
|
-
ellipseWidth = props.ellipseWidth
|
|
17
|
+
ellipseWidth = props.ellipseWidth,
|
|
18
|
+
otherProps = props.otherProps;
|
|
19
|
+
var _ref = otherProps !== null && otherProps !== void 0 ? otherProps : {},
|
|
20
|
+
_ref$isDiffChange = _ref.isDiffChange,
|
|
21
|
+
isDiffChange = _ref$isDiffChange === void 0 ? false : _ref$isDiffChange;
|
|
11
22
|
var strTitle = label;
|
|
12
23
|
var index = strTitle === null || strTitle === void 0 ? void 0 : strTitle.indexOf(searchStr);
|
|
13
24
|
var beforeStr = strTitle === null || strTitle === void 0 ? void 0 : strTitle.substring(0, index);
|
|
@@ -40,11 +51,9 @@ function SearchTitle(props) {
|
|
|
40
51
|
style: style,
|
|
41
52
|
children: strTitle
|
|
42
53
|
});
|
|
43
|
-
if (classEllipse) {
|
|
44
|
-
return _jsx(
|
|
45
|
-
|
|
46
|
-
placement: "rightTop",
|
|
47
|
-
children: title
|
|
54
|
+
if (classEllipse && !isDiffChange) {
|
|
55
|
+
return _jsx(AdaptiveTooltip, {
|
|
56
|
+
children: titleTips
|
|
48
57
|
});
|
|
49
58
|
}
|
|
50
59
|
return title;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
@root-entry-name: 'default';
|
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
3
|
|
|
4
|
+
.pro-tree-wrap-ellipse {
|
|
5
|
+
display: block;
|
|
6
|
+
width: 100%;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
white-space: nowrap;
|
|
9
|
+
text-overflow: ellipsis;
|
|
10
|
+
word-break: keep-all;
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
.pro-tree {
|
|
5
14
|
height: 100%; // tree auto css
|
|
6
15
|
.@{ant-prefix}-tree-iconEle{
|
|
@@ -368,3 +377,8 @@
|
|
|
368
377
|
}
|
|
369
378
|
|
|
370
379
|
|
|
380
|
+
.@{ant-prefix}-select-tree-node-content-wrapper {
|
|
381
|
+
&:has(.pro-tree-wrap-ellipse){
|
|
382
|
+
overflow: hidden;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
@@ -177,23 +177,21 @@ function List(props, ref) {
|
|
|
177
177
|
setAutoExpandParent(false);
|
|
178
178
|
};
|
|
179
179
|
if (mode === 'render') {
|
|
180
|
-
return _jsx(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
height: 432
|
|
196
|
-
})
|
|
180
|
+
return _jsx(_Tree, {
|
|
181
|
+
disabled: disabled,
|
|
182
|
+
style: {
|
|
183
|
+
width: '100%'
|
|
184
|
+
},
|
|
185
|
+
checkable: true,
|
|
186
|
+
treeData: _treeData,
|
|
187
|
+
onExpand: onExpand,
|
|
188
|
+
expandedKeys: expandedKeys,
|
|
189
|
+
autoExpandParent: autoExpandParent,
|
|
190
|
+
selectable: false,
|
|
191
|
+
onCheck: onCheck,
|
|
192
|
+
checkedKeys: checkedValues,
|
|
193
|
+
checkStrictly: searchStr ? true : checkStrictly,
|
|
194
|
+
height: 432
|
|
197
195
|
});
|
|
198
196
|
}
|
|
199
197
|
return _jsx(_Fragment, {
|
package/es/ProTreeModal/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
15
15
|
* @Author: za-xuwenli xuwenli@zhongan.io
|
|
16
16
|
* @Date: 2024-06-04 10:01:18
|
|
17
17
|
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
|
18
|
-
* @LastEditTime: 2024-
|
|
18
|
+
* @LastEditTime: 2024-09-27 11:49:28
|
|
19
19
|
* @FilePath: /za-material-warehouse/src/ProTreeModal/index.tsx
|
|
20
20
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
21
21
|
*/
|
|
@@ -26,7 +26,8 @@ import { ReactSVG } from 'react-svg';
|
|
|
26
26
|
import classNames from 'classnames';
|
|
27
27
|
import { ProDrawerForm, useProConfig } from '../index';
|
|
28
28
|
import { Trigger, ListView, TreeView, Cascader } from './components';
|
|
29
|
-
import { getFlatTreeData, filterCheckedNodes, getChildrenKeys, findTreeNodeByKey, getAllKeys, transformMessage } from './utils';
|
|
29
|
+
import { getFlatTreeData, filterCheckedNodes, getChildrenKeys, findTreeNodeByKey, getAllKeys, transformMessage, addLevelAndParentId } from './utils';
|
|
30
|
+
import { transformTreeToArray, treeNodeFind } from '../ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index';
|
|
30
31
|
import searchSVG from '../assets/input-search.svg';
|
|
31
32
|
import locale, { formatMessage } from '../locale';
|
|
32
33
|
import './style/index.less';
|
|
@@ -98,7 +99,8 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
98
99
|
flatTreeData: [],
|
|
99
100
|
searchStr: '',
|
|
100
101
|
checkAll: false,
|
|
101
|
-
allKeys: []
|
|
102
|
+
allKeys: [],
|
|
103
|
+
transformedTree: []
|
|
102
104
|
}),
|
|
103
105
|
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
104
106
|
state = _useSetState2[0],
|
|
@@ -220,6 +222,12 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
220
222
|
});
|
|
221
223
|
}
|
|
222
224
|
}, [value, state.allKeys, state.open]);
|
|
225
|
+
useDeepCompareEffect(function () {
|
|
226
|
+
var transformedTree = addLevelAndParentId(state.treeData, fieldNames);
|
|
227
|
+
setState({
|
|
228
|
+
transformedTree: transformedTree
|
|
229
|
+
});
|
|
230
|
+
}, [state.treeData]);
|
|
223
231
|
var handleClick = function handleClick() {
|
|
224
232
|
setState({
|
|
225
233
|
open: true
|
|
@@ -360,8 +368,55 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
360
368
|
var onCheck = function onCheck(checkedKeys, info) {
|
|
361
369
|
var checkedValues = _toConsumableArray(state.checkedValues);
|
|
362
370
|
var originalTreeData = state.originalTreeData;
|
|
371
|
+
// 如果有检索则自管理
|
|
372
|
+
if (state.searchStr) {
|
|
373
|
+
var _transformTreeToArray;
|
|
374
|
+
var node = info.node;
|
|
375
|
+
// 从完整树中找到当前节点
|
|
376
|
+
var activeNode = treeNodeFind(state.transformedTree, function (t) {
|
|
377
|
+
return t[fieldNameValue] === node[fieldNameValue];
|
|
378
|
+
}, {
|
|
379
|
+
childrenKey: fieldNames.children
|
|
380
|
+
});
|
|
381
|
+
var allChildren = (_transformTreeToArray = transformTreeToArray([activeNode], {
|
|
382
|
+
childrenKey: fieldNames.children
|
|
383
|
+
})) === null || _transformTreeToArray === void 0 ? void 0 : _transformTreeToArray.map(function (item) {
|
|
384
|
+
return item[fieldNameValue];
|
|
385
|
+
});
|
|
386
|
+
// 子项合并勾选
|
|
387
|
+
checkedValues = checkedValues.concat(allChildren);
|
|
388
|
+
// 从完整树中拿到父节点 只要存在父节点,那么就判断当前children是否全被勾选 若全被勾选就合并当前key到勾选队列
|
|
389
|
+
var _recourse2 = function _recourse(findNode) {
|
|
390
|
+
if (findNode.parentId) {
|
|
391
|
+
var _transformTreeToArray2;
|
|
392
|
+
var parentNode = treeNodeFind(state.transformedTree, function (t) {
|
|
393
|
+
return t[fieldNameValue] === findNode.parentId;
|
|
394
|
+
}, {
|
|
395
|
+
childrenKey: fieldNames.children
|
|
396
|
+
});
|
|
397
|
+
var parentChildrenKeys = (_transformTreeToArray2 = transformTreeToArray([parentNode], {
|
|
398
|
+
childrenKey: fieldNames.children
|
|
399
|
+
})) === null || _transformTreeToArray2 === void 0 ? void 0 : _transformTreeToArray2.map(function (item) {
|
|
400
|
+
return item[fieldNameValue];
|
|
401
|
+
});
|
|
402
|
+
var parentChildrenAllChecked = parentChildrenKeys.every(function (key) {
|
|
403
|
+
return checkedValues.includes(key);
|
|
404
|
+
});
|
|
405
|
+
if (parentChildrenAllChecked) {
|
|
406
|
+
// 把当前父节点追加进来
|
|
407
|
+
checkedValues = checkedValues.concat([parentNode[fieldNameValue]]);
|
|
408
|
+
// 继续向上查找
|
|
409
|
+
if (parentNode.parentId) {
|
|
410
|
+
_recourse2(parentNode);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
_recourse2(activeNode);
|
|
416
|
+
}
|
|
417
|
+
var _checkStrictly = state.searchStr ? true : checkStrictly;
|
|
363
418
|
// 此时应该取消掉自身并包含它所有的子集
|
|
364
|
-
if (!info.checked && !
|
|
419
|
+
if (!info.checked && !_checkStrictly) {
|
|
365
420
|
// 1. 取消自身
|
|
366
421
|
// 2. 把所有的子节点也要取消
|
|
367
422
|
var childrenkeys = [];
|
|
@@ -378,8 +433,8 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
378
433
|
return !parentKeys.includes(key);
|
|
379
434
|
});
|
|
380
435
|
} else {
|
|
381
|
-
//
|
|
382
|
-
if (
|
|
436
|
+
// _checkStrictly 模式下取 checkedKeys.checked 或者自身的 key
|
|
437
|
+
if (_checkStrictly) {
|
|
383
438
|
if (!info.checked) {
|
|
384
439
|
checkedValues = checkedValues.filter(function (key) {
|
|
385
440
|
return key !== info.node.key;
|
|
@@ -618,7 +673,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
618
673
|
});
|
|
619
674
|
case TREE:
|
|
620
675
|
return _jsx(TreeView, {
|
|
621
|
-
treeData: state.
|
|
676
|
+
treeData: state.transformedTree,
|
|
622
677
|
originalTreeData: state.originalTreeData,
|
|
623
678
|
flatTreeData: state.flatTreeData,
|
|
624
679
|
checkedValues: state.checkedValues,
|
|
@@ -36,3 +36,4 @@ export declare function filterCheckedNodes(data: any, checkedKeys: any, searchSt
|
|
|
36
36
|
*/
|
|
37
37
|
export declare function getChildrenKeys(node: TreeDataProps, childrenKeys: string[], fieldNames: FieldNamesType, type: 'treeClose' | 'treeCheck'): void;
|
|
38
38
|
export declare const transformMessage: (obj: any, message: string) => string;
|
|
39
|
+
export declare const addLevelAndParentId: (tree: any[], fieldNames: any, currentLevel?: number, currentParentId?: any) => any[];
|
package/es/ProTreeModal/utils.js
CHANGED
|
@@ -197,4 +197,24 @@ export var transformMessage = function transformMessage(obj, message) {
|
|
|
197
197
|
_message = message.replaceAll("{".concat(key, "}"), obj[key]);
|
|
198
198
|
});
|
|
199
199
|
return _message;
|
|
200
|
-
};
|
|
200
|
+
};
|
|
201
|
+
var _addLevelAndParentId = function addLevelAndParentId() {
|
|
202
|
+
var tree = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
203
|
+
var fieldNames = arguments.length > 1 ? arguments[1] : undefined;
|
|
204
|
+
var currentLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
205
|
+
var currentParentId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
206
|
+
var _fieldNames$children = fieldNames.children,
|
|
207
|
+
children = _fieldNames$children === void 0 ? 'children' : _fieldNames$children,
|
|
208
|
+
_fieldNames$value = fieldNames.value,
|
|
209
|
+
value = _fieldNames$value === void 0 ? 'value' : _fieldNames$value;
|
|
210
|
+
return tree.map(function (node) {
|
|
211
|
+
var newNode = _objectSpread({}, node);
|
|
212
|
+
newNode.level = currentLevel;
|
|
213
|
+
newNode.parentId = currentParentId;
|
|
214
|
+
if (node[children]) {
|
|
215
|
+
newNode[children] = _addLevelAndParentId(node[children], fieldNames, currentLevel + 1, newNode[value]);
|
|
216
|
+
}
|
|
217
|
+
return newNode;
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
export { _addLevelAndParentId as addLevelAndParentId };
|
package/es/style/theme/antd.less
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
--zaui-brand : #006aff;
|
|
9
9
|
--zaui-brand-hover : #3387ff;
|
|
10
10
|
--zaui-brand-active : #005ad9;
|
|
11
|
-
--zaui-brand-disabled :
|
|
11
|
+
--zaui-brand-disabled : color-mix(in srgb, var(--zaui-brand) 70%, white);
|
|
12
12
|
--zaui-text : #343434;
|
|
13
13
|
--zaui-text-weak : #616161;
|
|
14
14
|
--zaui-aide-text : #909090;
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
--zaui-table-selected-hover-bg : var(--zaui-table-hover-bg); // 默认同悬停
|
|
56
56
|
--zaui-table-nested-bg : #fafcfe;
|
|
57
57
|
--zaui-contract-bg : #fffaa1; // 对比背景色
|
|
58
|
+
--zaui-contract-bg-add : #d2fff4; // 新增对比背景色
|
|
58
59
|
--zaui-form-label-width : 130px; // 8个全角字符宽度
|
|
59
60
|
--zaui-border-radius : 8px;
|
|
60
61
|
--zaui-border-radius-card : 4px;
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
@zaui-table-selected-hover-bg: var(--zaui-table-hover-bg #fafafa);
|
|
54
54
|
@zaui-table-nested-bg: var(--zaui-table-nested-bg #FAFCFE);
|
|
55
55
|
@zaui-contract-bg: var(--zaui-contract-bg; #fffaa1); // 对比背景色
|
|
56
|
+
@zaui-contract-bg-add: var(--zaui-contract-bg-add; #d2fff4); // 新增对比背景色
|
|
56
57
|
@zaui-form-required-after: var(--zaui-form-required-after; inline);
|
|
57
58
|
@zaui-form-required-before: var(--zaui-form-required-before; none);
|
|
58
59
|
@zaui-form-label-width: var(--zaui-form-label-width; 130px);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var EMPTY_VALUE = [undefined, null, ''];
|
|
2
|
+
/** 判断一个值是否是空值 */
|
|
3
|
+
export var isEmpty = function isEmpty(value) {
|
|
4
|
+
if (EMPTY_VALUE.includes(value)) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
if (Array.isArray(value)) {
|
|
8
|
+
return !(value === null || value === void 0 ? void 0 : value.length) || value.every(function (item) {
|
|
9
|
+
return EMPTY_VALUE.includes(item);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
package/lib/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormInstance } from 'antd';
|
|
3
3
|
import { NamePath } from 'antd/lib/form/interface';
|
|
4
|
+
import { DiffOriginalParams } from '../../../ProForm/utils/diffOriginal';
|
|
4
5
|
interface Props {
|
|
5
6
|
name?: NamePath;
|
|
6
7
|
names?: NamePath[];
|
|
@@ -9,8 +10,8 @@ interface Props {
|
|
|
9
10
|
namesStr?: NamePath;
|
|
10
11
|
originalValues?: any;
|
|
11
12
|
form: FormInstance;
|
|
12
|
-
equalWith?:
|
|
13
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
13
14
|
[name: string]: any;
|
|
14
15
|
}
|
|
15
|
-
declare const
|
|
16
|
-
export default
|
|
16
|
+
declare const ListChangedWrapper: React.FC<Props>;
|
|
17
|
+
export default ListChangedWrapper;
|