@zat-design/sisyphus-react 3.10.2 → 3.10.3
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 +41 -34
- package/dist/less.esm.css +41 -34
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +4 -4
- package/es/ProEditTable/components/RenderField/index.js +2 -1
- package/es/ProEditTable/propsType.d.ts +1 -1
- package/es/ProEditTable/utils/diffOriginal.d.ts +1 -1
- package/es/ProEditTable/utils/diffOriginal.js +3 -3
- package/es/ProForm/components/combination/ProModalSelect/index.js +2 -2
- package/es/ProForm/components/render/ChangedWrapper.d.ts +1 -1
- package/es/ProForm/components/render/ChangedWrapper.js +5 -6
- package/es/ProForm/components/render/Render.js +3 -2
- package/es/ProForm/components/render/RenderFields.js +2 -3
- package/es/ProForm/components/render/propsType.d.ts +1 -2
- package/es/ProForm/utils/_useChanged.d.ts +2 -2
- package/es/ProForm/utils/_useChanged.js +3 -3
- package/es/ProForm/utils/_useListChanged.d.ts +1 -1
- package/es/ProForm/utils/_useListChanged.js +3 -3
- package/es/ProForm/utils/diffOriginal.d.ts +1 -1
- package/es/ProForm/utils/diffOriginal.js +3 -3
- package/es/ProForm/utils/transformValue.js +9 -7
- package/es/ProStep/components/Anchor/index.js +12 -10
- package/es/ProStep/components/Listener/index.js +25 -0
- package/es/ProStep/components/Step/index.js +2 -2
- package/es/ProStep/style/index.less +28 -16
- package/es/ProTable/components/FormatColumn/index.js +0 -5
- package/es/ProTable/components/RenderColumn/index.js +55 -42
- package/es/ProTable/utils/index.d.ts +6 -0
- package/es/ProTable/utils/index.js +14 -0
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +1 -1
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +4 -4
- package/lib/ProEditTable/components/RenderField/index.js +2 -1
- package/lib/ProEditTable/propsType.d.ts +1 -1
- package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -1
- package/lib/ProEditTable/utils/diffOriginal.js +3 -3
- package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/lib/ProForm/components/render/ChangedWrapper.d.ts +1 -1
- package/lib/ProForm/components/render/ChangedWrapper.js +5 -6
- package/lib/ProForm/components/render/Render.js +3 -2
- package/lib/ProForm/components/render/RenderFields.js +2 -3
- package/lib/ProForm/components/render/propsType.d.ts +1 -2
- package/lib/ProForm/utils/_useChanged.d.ts +2 -2
- package/lib/ProForm/utils/_useChanged.js +3 -3
- package/lib/ProForm/utils/_useListChanged.d.ts +1 -1
- package/lib/ProForm/utils/_useListChanged.js +3 -3
- package/lib/ProForm/utils/diffOriginal.d.ts +1 -1
- package/lib/ProForm/utils/diffOriginal.js +3 -3
- package/lib/ProForm/utils/transformValue.js +9 -7
- package/lib/ProStep/components/Anchor/index.js +11 -10
- package/lib/ProStep/components/Listener/index.js +25 -0
- package/lib/ProStep/components/Step/index.js +2 -2
- package/lib/ProStep/style/index.less +28 -16
- package/lib/ProTable/components/FormatColumn/index.js +0 -5
- package/lib/ProTable/components/RenderColumn/index.js +56 -43
- package/lib/ProTable/utils/index.d.ts +6 -0
- package/lib/ProTable/utils/index.js +15 -1
- package/package.json +1 -1
@@ -8,18 +8,18 @@ export var useChanged = function useChanged(_ref) {
|
|
8
8
|
namesStr = _ref.namesStr,
|
9
9
|
originalValues = _ref.originalValues,
|
10
10
|
form = _ref.form,
|
11
|
-
|
11
|
+
onDiff = _ref.onDiff;
|
12
12
|
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
13
13
|
return get(originalValues, name);
|
14
14
|
}) : get(originalValues, name);
|
15
|
-
var notWatch = !
|
15
|
+
var notWatch = !onDiff && (!originalValues || originalValue === undefined);
|
16
16
|
if (notWatch) return [false];
|
17
17
|
var value = _Form.useWatch(namesStr || name, form);
|
18
18
|
var changed = diffOriginal({
|
19
19
|
originalValue: originalValue,
|
20
20
|
value: value,
|
21
21
|
form: form,
|
22
|
-
|
22
|
+
onDiff: onDiff
|
23
23
|
});
|
24
24
|
return [changed, originalValue];
|
25
25
|
};
|
@@ -10,7 +10,7 @@ interface Params {
|
|
10
10
|
originalValues: any;
|
11
11
|
form: FormInstance;
|
12
12
|
rowKeyPath?: InternalNamePath;
|
13
|
-
|
13
|
+
onDiff?: (originalValue: any, currentValue: any) => boolean;
|
14
14
|
}
|
15
15
|
export declare const useListChanged: (params: Params) => any[];
|
16
16
|
export {};
|
@@ -64,7 +64,7 @@ export var useListChanged = function useListChanged(params) {
|
|
64
64
|
originalNames = _params$originalNames === void 0 ? names : _params$originalNames,
|
65
65
|
originalValues = params.originalValues,
|
66
66
|
form = params.form,
|
67
|
-
|
67
|
+
onDiff = params.onDiff,
|
68
68
|
rowKeyPath = params.rowKeyPath;
|
69
69
|
var namePath = toNamePath(namesStr || name);
|
70
70
|
var originalNamePath = toNamePath(originalName);
|
@@ -78,7 +78,7 @@ export var useListChanged = function useListChanged(params) {
|
|
78
78
|
rowKeyPath: rowKeyPath,
|
79
79
|
form: form
|
80
80
|
}) : undefined;
|
81
|
-
var noChange = !
|
81
|
+
var noChange = !onDiff && (!originalValues || originalValue === undefined);
|
82
82
|
var _form = form;
|
83
83
|
if (notWatch || noChange) return [false];
|
84
84
|
var value = _Form.useWatch(namePath, _form);
|
@@ -86,7 +86,7 @@ export var useListChanged = function useListChanged(params) {
|
|
86
86
|
value: value,
|
87
87
|
originalValue: originalValue,
|
88
88
|
form: form,
|
89
|
-
|
89
|
+
onDiff: onDiff
|
90
90
|
// name: isString(namesStr) ? namesStr : originalName || name,
|
91
91
|
});
|
92
92
|
return [changed, originalValue];
|
@@ -3,7 +3,7 @@ export interface DiffOriginalParams {
|
|
3
3
|
originalValue: any;
|
4
4
|
value: any;
|
5
5
|
form: FormInstance;
|
6
|
-
|
6
|
+
onDiff?: (originalValue: any, currentValue: any) => DiffType | boolean | undefined;
|
7
7
|
}
|
8
8
|
export type DiffType = 'same' | 'add' | 'changed';
|
9
9
|
export declare const diffOriginal: (params: DiffOriginalParams) => DiffType;
|
@@ -30,10 +30,10 @@ var filterObject = function filterObject(data) {
|
|
30
30
|
export var diffOriginal = function diffOriginal(params) {
|
31
31
|
var originalValue = params.originalValue,
|
32
32
|
value = params.value,
|
33
|
-
|
33
|
+
onDiff = params.onDiff;
|
34
34
|
// 支持传入自定义比较事件
|
35
|
-
if (isFunction(
|
36
|
-
var diffRes =
|
35
|
+
if (isFunction(onDiff)) {
|
36
|
+
var diffRes = onDiff(originalValue, value);
|
37
37
|
// 如果返回undefined走内置比较逻辑
|
38
38
|
if (diffRes !== undefined) {
|
39
39
|
if (typeof diffRes === 'boolean') {
|
@@ -15,21 +15,21 @@ export var transformValue = function transformValue(names, form, fieldName, _nor
|
|
15
15
|
}
|
16
16
|
names.forEach(function (name, index) {
|
17
17
|
var _value2;
|
18
|
-
// @ts-ignore
|
19
18
|
set(form.getFieldsValue(true), name, (_value2 = _value) === null || _value2 === void 0 ? void 0 : _value2[index]);
|
20
19
|
});
|
21
20
|
return _value;
|
22
21
|
},
|
23
|
-
getValueProps: function getValueProps(value,
|
22
|
+
getValueProps: function getValueProps(value, isOrigin) {
|
24
23
|
var _curValue;
|
25
24
|
var _value = [];
|
26
|
-
if (
|
25
|
+
if (isOrigin) {
|
26
|
+
_value = value;
|
27
|
+
} else {
|
28
|
+
// 非比对names场景
|
27
29
|
names.forEach(function (name, index) {
|
28
30
|
var value = form.getFieldValue(name);
|
29
31
|
_value[index] = value;
|
30
32
|
});
|
31
|
-
} else {
|
32
|
-
_value = value;
|
33
33
|
}
|
34
34
|
// 支持外部传入转换函数
|
35
35
|
var res = (_getValueProps === null || _getValueProps === void 0 ? void 0 : _getValueProps(_value)) || {
|
@@ -43,8 +43,10 @@ export var transformValue = function transformValue(names, form, fieldName, _nor
|
|
43
43
|
})) {
|
44
44
|
curValue = undefined;
|
45
45
|
}
|
46
|
-
//
|
47
|
-
|
46
|
+
// 如果来源是比对且有names场景, 则不更新表单值
|
47
|
+
if (!isOrigin) {
|
48
|
+
set(form.getFieldsValue(true), fieldName, curValue);
|
49
|
+
}
|
48
50
|
// 如果表单里的值和组合得到的值不全等 更新表单里的值、
|
49
51
|
return _objectSpread(_objectSpread({}, res), {}, {
|
50
52
|
value: curValue
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import "antd/es/badge/style";
|
2
|
+
import _Badge from "antd/es/badge";
|
1
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
4
|
import cn from 'classnames';
|
3
5
|
import { handleScroll } from '../../utils';
|
@@ -44,7 +46,7 @@ export var MenuItem = function MenuItem(props) {
|
|
44
46
|
var renderMenuIcon = function renderMenuIcon() {
|
45
47
|
if (isCurrentStep) {
|
46
48
|
return _jsx("span", {
|
47
|
-
className: cn('dot-icon', {
|
49
|
+
className: cn('pro-step-dot-icon', {
|
48
50
|
errored: !!errorNum,
|
49
51
|
disabled: isDisabled
|
50
52
|
}),
|
@@ -65,14 +67,14 @@ export var MenuItem = function MenuItem(props) {
|
|
65
67
|
});
|
66
68
|
}
|
67
69
|
return _jsx("div", {
|
68
|
-
className: cn('dot', {
|
70
|
+
className: cn('pro-step-dot', {
|
69
71
|
errored: !!errorNum,
|
70
72
|
disabled: isDisabled
|
71
73
|
})
|
72
74
|
});
|
73
75
|
};
|
74
76
|
return _jsxs("div", {
|
75
|
-
className: cn('com-menu-item', {
|
77
|
+
className: cn('pro-step-com-menu-item', {
|
76
78
|
errored: !!errorNum,
|
77
79
|
disabled: isDisabled,
|
78
80
|
current: isCurrentStep && onOff
|
@@ -84,22 +86,22 @@ export var MenuItem = function MenuItem(props) {
|
|
84
86
|
});
|
85
87
|
},
|
86
88
|
children: [_jsxs("div", {
|
87
|
-
className: "menu-item",
|
89
|
+
className: "pro-step-menu-item",
|
88
90
|
children: [_jsx("div", {
|
89
|
-
className: "menu-icon",
|
91
|
+
className: "pro-step-menu-icon",
|
90
92
|
children: renderMenuIcon()
|
91
93
|
}), onOff && _jsx("div", {
|
92
|
-
className: cn('menu-name', {
|
94
|
+
className: cn('pro-step-menu-name', {
|
93
95
|
disabled: isDisabled
|
94
96
|
}),
|
95
97
|
children: name
|
96
98
|
})]
|
97
99
|
}), !isDisabled && onOff && _jsxs("div", {
|
98
|
-
className: "checked-status",
|
100
|
+
className: "pro-step-checked-status",
|
99
101
|
children: [isChecked && _jsx(SuccessSvg, {}), errorNum > 0 && _jsx("div", {
|
100
|
-
className: "
|
101
|
-
children: _jsx(
|
102
|
-
|
102
|
+
className: "pro-step-error-dot",
|
103
|
+
children: _jsx(_Badge, {
|
104
|
+
count: errorNum
|
103
105
|
})
|
104
106
|
})]
|
105
107
|
})]
|
@@ -6,6 +6,26 @@ var _excluded = ["children", "delayTime", "excludes"];
|
|
6
6
|
import { throttle } from 'lodash';
|
7
7
|
import React from 'react';
|
8
8
|
import { useStep } from '../../index';
|
9
|
+
var checkErrorList = function checkErrorList(arr) {
|
10
|
+
for (var i = 0; i < arr.length; i++) {
|
11
|
+
if (arr[i].className.includes('errored')) {
|
12
|
+
return {
|
13
|
+
errorDom: arr[i],
|
14
|
+
index: i
|
15
|
+
};
|
16
|
+
}
|
17
|
+
}
|
18
|
+
return null;
|
19
|
+
};
|
20
|
+
var findFirstErrorDom = function findFirstErrorDom() {
|
21
|
+
var errorList = document.querySelectorAll('.pro-step-com-menu-item') || [];
|
22
|
+
var hasErrorItem = document.querySelectorAll('.pro-step-com-menu-item .errored');
|
23
|
+
var hasFormError = document.querySelector('.ant-form-item-explain-error');
|
24
|
+
if ((hasErrorItem === null || hasErrorItem === void 0 ? void 0 : hasErrorItem.length) && !hasFormError) {
|
25
|
+
return checkErrorList(errorList);
|
26
|
+
}
|
27
|
+
return null;
|
28
|
+
};
|
9
29
|
export default (function (_ref) {
|
10
30
|
var children = _ref.children,
|
11
31
|
delayTime = _ref.delayTime,
|
@@ -28,6 +48,11 @@ export default (function (_ref) {
|
|
28
48
|
values = _context.sent;
|
29
49
|
setTimeout(function () {
|
30
50
|
var localData = localStorage.getItem('cache-pro-step');
|
51
|
+
var _ref3 = findFirstErrorDom() || {},
|
52
|
+
errorDom = _ref3.errorDom;
|
53
|
+
if (errorDom) {
|
54
|
+
errorDom.click();
|
55
|
+
}
|
31
56
|
if (localData !== 'false') {
|
32
57
|
var _children$props, _children$props$onCli;
|
33
58
|
children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : (_children$props$onCli = _children$props.onClick) === null || _children$props$onCli === void 0 ? void 0 : _children$props$onCli.call(_children$props, values);
|
@@ -59,10 +59,10 @@ export var Step = function Step(_ref) {
|
|
59
59
|
onMouseEnter: handleMouseEnter,
|
60
60
|
onMouseLeave: handleMouseLeave,
|
61
61
|
children: [_jsxs("div", {
|
62
|
-
className: "step-menu",
|
62
|
+
className: "pro-step-menu",
|
63
63
|
children: [_jsx(ProIcon, {
|
64
64
|
src: catalogSvg,
|
65
|
-
className: "menu-icon",
|
65
|
+
className: "pro-step-menu-icon",
|
66
66
|
actionMap: {}
|
67
67
|
}), onOff && _jsx("div", {
|
68
68
|
children: locale === null || locale === void 0 ? void 0 : (_locale$ProStep = locale.ProStep) === null || _locale$ProStep === void 0 ? void 0 : _locale$ProStep.catalogue
|
@@ -20,7 +20,7 @@
|
|
20
20
|
cursor: pointer;
|
21
21
|
transition: width 0.2s;
|
22
22
|
|
23
|
-
> .step-menu {
|
23
|
+
> .pro-step-menu {
|
24
24
|
display: flex;
|
25
25
|
align-items: center;
|
26
26
|
width: 100%;
|
@@ -33,7 +33,7 @@
|
|
33
33
|
justify-content: center;
|
34
34
|
width: 48px;
|
35
35
|
height: 24px;
|
36
|
-
> .menu-icon {
|
36
|
+
> .pro-step-menu-icon {
|
37
37
|
width: auto !important;
|
38
38
|
height: auto !important;
|
39
39
|
font-size: var(--zaui-font-size-lg-title, 24px);
|
@@ -49,7 +49,7 @@
|
|
49
49
|
> button {
|
50
50
|
width: auto !important;
|
51
51
|
height: auto !important;
|
52
|
-
> .menu-icon {
|
52
|
+
> .pro-step-menu-icon {
|
53
53
|
width: auto !important;
|
54
54
|
height: auto !important;
|
55
55
|
font-size: var(--zaui-font-size-lg-title, 24px);
|
@@ -79,7 +79,7 @@
|
|
79
79
|
}
|
80
80
|
}
|
81
81
|
|
82
|
-
.menu-content {
|
82
|
+
.pro-step-menu-content {
|
83
83
|
overflow: hidden;
|
84
84
|
|
85
85
|
&:hover {
|
@@ -87,7 +87,7 @@
|
|
87
87
|
}
|
88
88
|
}
|
89
89
|
|
90
|
-
.com-menu-item {
|
90
|
+
.pro-step-com-menu-item {
|
91
91
|
display: flex;
|
92
92
|
align-items: center;
|
93
93
|
justify-content: space-between;
|
@@ -107,11 +107,11 @@
|
|
107
107
|
}
|
108
108
|
}
|
109
109
|
|
110
|
-
> .menu-item {
|
110
|
+
> .pro-step-menu-item {
|
111
111
|
display: flex;
|
112
112
|
align-items: center;
|
113
113
|
|
114
|
-
> .menu-icon {
|
114
|
+
> .pro-step-menu-icon {
|
115
115
|
display: flex;
|
116
116
|
align-items: center;
|
117
117
|
justify-content: center;
|
@@ -122,14 +122,19 @@
|
|
122
122
|
fill: var(--zaui-brand, #006aff);
|
123
123
|
}
|
124
124
|
|
125
|
-
> .dot {
|
125
|
+
> .pro-step-dot {
|
126
126
|
width: 6px;
|
127
127
|
height: 6px;
|
128
128
|
background: var(--zaui-brand, #006aff);
|
129
129
|
border-radius: 3px;
|
130
130
|
|
131
|
+
|
132
|
+
|
131
133
|
&.errored {
|
134
|
+
width: 12px;
|
135
|
+
height: 12px;
|
132
136
|
background: #ff5050;
|
137
|
+
border-radius: 50%;
|
133
138
|
fill: #ff5050;
|
134
139
|
}
|
135
140
|
|
@@ -139,7 +144,7 @@
|
|
139
144
|
}
|
140
145
|
}
|
141
146
|
|
142
|
-
.dot-icon {
|
147
|
+
.pro-step-dot-icon {
|
143
148
|
display: flex;
|
144
149
|
align-items: center;
|
145
150
|
justify-content: center;
|
@@ -162,7 +167,7 @@
|
|
162
167
|
}
|
163
168
|
}
|
164
169
|
|
165
|
-
> .menu-name {
|
170
|
+
> .pro-step-menu-name {
|
166
171
|
color: #0a0a0a;
|
167
172
|
|
168
173
|
&.disabled {
|
@@ -171,21 +176,28 @@
|
|
171
176
|
}
|
172
177
|
}
|
173
178
|
|
174
|
-
> .checked-status {
|
179
|
+
> .pro-step-checked-status {
|
175
180
|
height: 18px;
|
176
181
|
|
177
182
|
> svg {
|
178
183
|
fill: var(--zaui-brand, #006aff);
|
179
184
|
}
|
180
185
|
|
181
|
-
.
|
186
|
+
.pro-step-error-dot {
|
182
187
|
display: flex;
|
183
188
|
align-items: center;
|
184
189
|
justify-content: center;
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
190
|
+
|
191
|
+
.@{ant-prefix}-badge{
|
192
|
+
.@{ant-prefix}-badge-count{
|
193
|
+
background: rgba(255, 80, 80, 0.15);
|
194
|
+
color: #ff5050;
|
195
|
+
.@{ant-prefix}-scroll-number-only-unit, .@{ant-prefix}-scroll-number{
|
196
|
+
font-weight: 600;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
}
|
189
201
|
|
190
202
|
> span {
|
191
203
|
color: #ff5050;
|
@@ -341,11 +341,6 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
341
341
|
if (!originalValue) {
|
342
342
|
originalRenderValue = '-';
|
343
343
|
}
|
344
|
-
if (originalObj && renderValue !== originalRenderValue) {
|
345
|
-
otherProps.isChanged = true;
|
346
|
-
} else {
|
347
|
-
otherProps.isChanged = false;
|
348
|
-
}
|
349
344
|
var node = _jsxs(_Space, {
|
350
345
|
size: 8,
|
351
346
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import "antd/es/space/style";
|
2
2
|
import _Space from "antd/es/space";
|
3
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
4
3
|
import "antd/es/tooltip/style";
|
5
4
|
import _Tooltip from "antd/es/tooltip";
|
5
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
6
6
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
7
7
|
import "antd/es/typography/style";
|
8
8
|
import _Typography from "antd/es/typography";
|
@@ -12,6 +12,7 @@ import { isBoolean } from 'lodash';
|
|
12
12
|
import classNames from 'classnames';
|
13
13
|
import { CheckOutlined } from '@ant-design/icons';
|
14
14
|
import { ReactSVG } from 'react-svg';
|
15
|
+
import { getPadding } from '../../utils';
|
15
16
|
import { isEmpty } from '../../../utils';
|
16
17
|
import copySvg from '../../../assets/copy.svg';
|
17
18
|
var Paragraph = _Typography.Paragraph,
|
@@ -41,6 +42,32 @@ var RenderColumn = function RenderColumn(props) {
|
|
41
42
|
'varied-cell': props === null || props === void 0 ? void 0 : props.isChanged,
|
42
43
|
'add-cell': props === null || props === void 0 ? void 0 : props.isAddCell
|
43
44
|
});
|
45
|
+
var checkEllipsis = function checkEllipsis(box) {
|
46
|
+
var range = document.createRange();
|
47
|
+
range.setStart(box, 0);
|
48
|
+
range.setEnd(box, box.childNodes.length);
|
49
|
+
var rangeWidth = range.getBoundingClientRect().width;
|
50
|
+
var _getPadding = getPadding(box),
|
51
|
+
pLeft = _getPadding.pLeft,
|
52
|
+
pRight = _getPadding.pRight,
|
53
|
+
pTop = _getPadding.pTop,
|
54
|
+
pBottom = _getPadding.pBottom;
|
55
|
+
var horizontalPadding = pLeft + pRight;
|
56
|
+
if (rangeWidth + horizontalPadding > box.clientWidth) {
|
57
|
+
return true;
|
58
|
+
}
|
59
|
+
return false;
|
60
|
+
};
|
61
|
+
var handleMouseOver = function handleMouseOver(e) {
|
62
|
+
setState({
|
63
|
+
tooltip: checkEllipsis(e.target)
|
64
|
+
});
|
65
|
+
};
|
66
|
+
var tooltipProps = _objectSpread({
|
67
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
68
|
+
return triggerNode.parentNode;
|
69
|
+
}
|
70
|
+
}, toolTipProps);
|
44
71
|
// 比对场景走的逻辑
|
45
72
|
if (!isInNewRowFlag && isBoolean(props === null || props === void 0 ? void 0 : props.isChanged)) {
|
46
73
|
var renderNode = value ? node : '-';
|
@@ -58,11 +85,36 @@ var RenderColumn = function RenderColumn(props) {
|
|
58
85
|
}) : _jsx("div", {
|
59
86
|
style: {
|
60
87
|
minWidth: minWidth,
|
61
|
-
width: width
|
88
|
+
width: width,
|
89
|
+
overflow: 'hidden',
|
90
|
+
textOverflow: 'ellipsis',
|
91
|
+
whiteSpace: 'nowrap'
|
62
92
|
},
|
63
93
|
children: ellipsis ? currentValue : renderNode
|
64
94
|
});
|
65
95
|
if ((props === null || props === void 0 ? void 0 : props.isChanged) === false) {
|
96
|
+
if (ellipsis) {
|
97
|
+
return _jsx(_Tooltip, _objectSpread(_objectSpread({
|
98
|
+
title: currentValue,
|
99
|
+
onOpenChange: function onOpenChange(open) {
|
100
|
+
setState({
|
101
|
+
tooltip: false
|
102
|
+
});
|
103
|
+
},
|
104
|
+
open: tooltip
|
105
|
+
}, tooltipProps), {}, {
|
106
|
+
children: _jsx(Text, {
|
107
|
+
style: {
|
108
|
+
width: width,
|
109
|
+
minWidth: minWidth
|
110
|
+
},
|
111
|
+
ellipsis: true,
|
112
|
+
onMouseOver: handleMouseOver,
|
113
|
+
onFocus: handleMouseOver,
|
114
|
+
children: renderNode
|
115
|
+
})
|
116
|
+
}));
|
117
|
+
}
|
66
118
|
return renderNode;
|
67
119
|
}
|
68
120
|
if (Array.isArray(originalValue)) {
|
@@ -86,7 +138,7 @@ var RenderColumn = function RenderColumn(props) {
|
|
86
138
|
title: _jsx(_Space, {
|
87
139
|
direction: "vertical",
|
88
140
|
className: "changed-tooltip",
|
89
|
-
children: (props === null || props === void 0 ? void 0 : props.isChanged) ? _jsxs(_Fragment, {
|
141
|
+
children: (props === null || props === void 0 ? void 0 : props.isChanged) && !(props === null || props === void 0 ? void 0 : props.isAddCell) ? _jsxs(_Fragment, {
|
90
142
|
children: [_jsxs(_Space, {
|
91
143
|
align: "start",
|
92
144
|
className: "original-value-container",
|
@@ -138,45 +190,6 @@ var RenderColumn = function RenderColumn(props) {
|
|
138
190
|
});
|
139
191
|
}
|
140
192
|
if (ellipsis) {
|
141
|
-
var getPadding = function getPadding(el) {
|
142
|
-
var style = window.getComputedStyle(el, null);
|
143
|
-
var paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
|
144
|
-
var paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
|
145
|
-
var paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
|
146
|
-
var paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
|
147
|
-
return {
|
148
|
-
pLeft: paddingLeft,
|
149
|
-
pRight: paddingRight,
|
150
|
-
pTop: paddingTop,
|
151
|
-
pBottom: paddingBottom
|
152
|
-
};
|
153
|
-
};
|
154
|
-
var checkEllipsis = function checkEllipsis(box) {
|
155
|
-
var range = document.createRange();
|
156
|
-
range.setStart(box, 0);
|
157
|
-
range.setEnd(box, box.childNodes.length);
|
158
|
-
var rangeWidth = range.getBoundingClientRect().width;
|
159
|
-
var _getPadding = getPadding(box),
|
160
|
-
pLeft = _getPadding.pLeft,
|
161
|
-
pRight = _getPadding.pRight,
|
162
|
-
pTop = _getPadding.pTop,
|
163
|
-
pBottom = _getPadding.pBottom;
|
164
|
-
var horizontalPadding = pLeft + pRight;
|
165
|
-
if (rangeWidth + horizontalPadding > box.clientWidth) {
|
166
|
-
return true;
|
167
|
-
}
|
168
|
-
return false;
|
169
|
-
};
|
170
|
-
var handleMouseOver = function handleMouseOver(e) {
|
171
|
-
setState({
|
172
|
-
tooltip: checkEllipsis(e.target)
|
173
|
-
});
|
174
|
-
};
|
175
|
-
var tooltipProps = _objectSpread({
|
176
|
-
getPopupContainer: function getPopupContainer(triggerNode) {
|
177
|
-
return triggerNode.parentNode;
|
178
|
-
}
|
179
|
-
}, toolTipProps);
|
180
193
|
if (!value) {
|
181
194
|
return _jsx("div", {
|
182
195
|
style: {
|
@@ -33,3 +33,9 @@ export declare const getRowKey: (rowKey: any, record: any) => any;
|
|
33
33
|
export declare const removeEmptyKeys: (obj: any) => {
|
34
34
|
[k: string]: unknown;
|
35
35
|
};
|
36
|
+
export declare const getPadding: (el: HTMLElement) => {
|
37
|
+
pLeft: number;
|
38
|
+
pRight: number;
|
39
|
+
pTop: number;
|
40
|
+
pBottom: number;
|
41
|
+
};
|
@@ -85,4 +85,18 @@ export var removeEmptyKeys = function removeEmptyKeys(obj) {
|
|
85
85
|
});
|
86
86
|
// 使用 Object.fromEntries() 将过滤后的键值对数组转换回对象
|
87
87
|
return Object.fromEntries(filteredEntries);
|
88
|
+
};
|
89
|
+
/* 获取边距 */
|
90
|
+
export var getPadding = function getPadding(el) {
|
91
|
+
var style = window.getComputedStyle(el, null);
|
92
|
+
var paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
|
93
|
+
var paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
|
94
|
+
var paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
|
95
|
+
var paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
|
96
|
+
return {
|
97
|
+
pLeft: paddingLeft,
|
98
|
+
pRight: paddingRight,
|
99
|
+
pTop: paddingTop,
|
100
|
+
pBottom: paddingBottom
|
101
|
+
};
|
88
102
|
};
|
@@ -10,7 +10,7 @@ interface Props {
|
|
10
10
|
namesStr?: NamePath;
|
11
11
|
originalValues?: any;
|
12
12
|
form: FormInstance;
|
13
|
-
|
13
|
+
onDiff?: DiffOriginalParams['onDiff'];
|
14
14
|
[name: string]: any;
|
15
15
|
}
|
16
16
|
declare const ListChangedWrapper: React.FC<Props>;
|
@@ -17,7 +17,7 @@ var _lodash = require("lodash");
|
|
17
17
|
var _diffOriginal = require("../../utils/diffOriginal");
|
18
18
|
var _ProConfigProvider = require("../../../ProConfigProvider");
|
19
19
|
var _utils = require("../../../utils");
|
20
|
-
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "
|
20
|
+
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "onDiff", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName", "viewRender", "diffConfig", "index"];
|
21
21
|
var toNamePath = function toNamePath(name) {
|
22
22
|
if (Array.isArray(name)) {
|
23
23
|
return name;
|
@@ -89,7 +89,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
89
89
|
originalNames = _props$originalNames === void 0 ? names : _props$originalNames,
|
90
90
|
originalValues = props.originalValues,
|
91
91
|
form = props.form,
|
92
|
-
|
92
|
+
onDiff = props.onDiff,
|
93
93
|
rowKeyPath = props.rowKeyPath,
|
94
94
|
children = props.children,
|
95
95
|
type = props.type,
|
@@ -120,7 +120,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
120
120
|
form: form
|
121
121
|
});
|
122
122
|
var originalValue = isWatch ? originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originalValue : undefined;
|
123
|
-
var noChange = !
|
123
|
+
var noChange = !onDiff && (!originalValues || isDiffAll ? false : (0, _utils.isEmpty)(originalValue));
|
124
124
|
var diffType = (0, _react.useMemo)(function () {
|
125
125
|
if (!isWatch || noChange) return 'same';
|
126
126
|
var _value = normalize ? normalize(props[valuePropName], undefined, undefined, true) // true 代表是值比对时的调用
|
@@ -135,7 +135,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
135
135
|
value: _value,
|
136
136
|
originalValue: _originalValue,
|
137
137
|
form: form,
|
138
|
-
|
138
|
+
onDiff: onDiff,
|
139
139
|
originRecord: originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originRecord,
|
140
140
|
record: originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.record,
|
141
141
|
index: index
|
@@ -575,9 +575,10 @@ var RenderField = function RenderField(_ref) {
|
|
575
575
|
originalNames: originalNames,
|
576
576
|
originalValues: originalValues,
|
577
577
|
form: form,
|
578
|
-
|
578
|
+
onDiff: onDiff,
|
579
579
|
type: type,
|
580
580
|
onChange: _onChange,
|
581
|
+
onBlur: _onblur,
|
581
582
|
valuePropName: _formItemProps.valuePropName,
|
582
583
|
normalize: _formItemProps.normalize,
|
583
584
|
getValueProps: _formItemProps.getValueProps,
|
@@ -110,7 +110,7 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro
|
|
110
110
|
rules?: ProRule[] | RulesFn<T>;
|
111
111
|
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps | void>;
|
112
112
|
dependencies?: NamePath[];
|
113
|
-
onDiff?: DiffOriginalParams['
|
113
|
+
onDiff?: DiffOriginalParams['onDiff'];
|
114
114
|
[key: string]: any;
|
115
115
|
}
|
116
116
|
export type ProEditTableColumnsProps<K = any> = ProColumnsProps & ColumnPropsMap<K, 'ProEditTable'>;
|
@@ -4,7 +4,7 @@ export interface DiffOriginalParams {
|
|
4
4
|
originalValue: any;
|
5
5
|
value: any;
|
6
6
|
form: FormInstance;
|
7
|
-
|
7
|
+
onDiff?: ({ originValue, originRecord, value, record, index, }: {
|
8
8
|
originValue: any;
|
9
9
|
originRecord: any;
|
10
10
|
value: any;
|
@@ -37,13 +37,13 @@ var filterObject = function filterObject(data) {
|
|
37
37
|
var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
38
38
|
var originalValue = params.originalValue,
|
39
39
|
value = params.value,
|
40
|
-
|
40
|
+
onDiff = params.onDiff,
|
41
41
|
originRecord = params.originRecord,
|
42
42
|
record = params.record,
|
43
43
|
index = params.index;
|
44
44
|
// 支持传入自定义比较事件
|
45
|
-
if ((0, _lodash.isFunction)(
|
46
|
-
var diffRes =
|
45
|
+
if ((0, _lodash.isFunction)(onDiff)) {
|
46
|
+
var diffRes = onDiff({
|
47
47
|
originValue: originalValue,
|
48
48
|
originRecord: originRecord,
|
49
49
|
value: value,
|
@@ -599,7 +599,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
599
599
|
});
|
600
600
|
}
|
601
601
|
});
|
602
|
-
(0,
|
602
|
+
(0, _react.useEffect)(function () {
|
603
603
|
if (onOff && !visible) {
|
604
604
|
var _useRequest$options6;
|
605
605
|
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.manual) !== true) {
|