@zat-design/sisyphus-react 3.8.3-beta.10 → 3.8.3-beta.13
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/.vscode/extensions.json +5 -0
- package/dist/index.esm.css +12 -2
- package/dist/less.esm.css +12 -2
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +32 -4
- package/es/ProEditTable/index.js +14 -6
- package/es/ProEditTable/propsType.d.ts +0 -5
- package/es/ProForm/components/base/InputNumber/index.js +1 -1
- package/es/ProForm/components/render/ChangedWrapper.js +4 -3
- package/es/ProForm/style/index.less +20 -9
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +32 -4
- package/lib/ProEditTable/index.js +14 -6
- package/lib/ProEditTable/propsType.d.ts +0 -5
- package/lib/ProForm/components/base/InputNumber/index.js +1 -1
- package/lib/ProForm/components/render/ChangedWrapper.js +4 -3
- package/lib/ProForm/style/index.less +20 -9
- package/package.json +1 -1
- package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +0 -241
- package/coverage/lcov-report/src/.umi/core/history.ts.html +0 -148
- package/coverage/lcov-report/src/.umi/core/index.html +0 -206
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +0 -109
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +0 -160
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +0 -97
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +0 -26050
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +0 -112
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +0 -116
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +0 -6340
- package/coverage/lcov-report/src/.umi/dumi/index.html +0 -116
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +0 -109
- package/coverage/lcov-report/src/.umi/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +0 -172
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +0 -94
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +0 -196
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +0 -106
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +0 -146
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +0 -88
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +0 -124
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +0 -1246
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +0 -161
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +0 -268
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +0 -778
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +0 -115
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +0 -202
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +0 -97
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +0 -142
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +0 -334
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +0 -146
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +0 -146
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +0 -121
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +0 -298
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +0 -919
- package/coverage/lcov-report/src/.umi/umi.ts.html +0 -268
package/dist/index.esm.css
CHANGED
|
@@ -3155,10 +3155,20 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3155
3155
|
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3156
3156
|
border-radius: 4px;
|
|
3157
3157
|
}
|
|
3158
|
-
.
|
|
3158
|
+
.original-value-tootip {
|
|
3159
|
+
max-width: 100%;
|
|
3160
|
+
width: -webkit-max-content;
|
|
3161
|
+
width: -moz-max-content;
|
|
3162
|
+
width: max-content;
|
|
3163
|
+
z-index: 1;
|
|
3164
|
+
}
|
|
3165
|
+
.original-value-tootip .changed-tooltip .original-value-container .ant-space-item:nth-child(1) {
|
|
3159
3166
|
white-space: nowrap;
|
|
3160
3167
|
}
|
|
3161
|
-
.changed-tooltip .
|
|
3168
|
+
.original-value-tootip .changed-tooltip .original-value-container .pro-group .ant-space-compact {
|
|
3169
|
+
display: block;
|
|
3170
|
+
}
|
|
3171
|
+
.original-value-tootip .changed-tooltip .current-value-container .ant-space-item:nth-child(1) {
|
|
3162
3172
|
white-space: nowrap;
|
|
3163
3173
|
}
|
|
3164
3174
|
.pro-upload .pro-upload-dragger .pro-upload-handle-box {
|
package/dist/less.esm.css
CHANGED
|
@@ -3155,10 +3155,20 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3155
3155
|
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3156
3156
|
border-radius: 4px;
|
|
3157
3157
|
}
|
|
3158
|
-
.
|
|
3158
|
+
.original-value-tootip {
|
|
3159
|
+
max-width: 100%;
|
|
3160
|
+
width: -webkit-max-content;
|
|
3161
|
+
width: -moz-max-content;
|
|
3162
|
+
width: max-content;
|
|
3163
|
+
z-index: 1;
|
|
3164
|
+
}
|
|
3165
|
+
.original-value-tootip .changed-tooltip .original-value-container .ant-space-item:nth-child(1) {
|
|
3159
3166
|
white-space: nowrap;
|
|
3160
3167
|
}
|
|
3161
|
-
.changed-tooltip .
|
|
3168
|
+
.original-value-tootip .changed-tooltip .original-value-container .pro-group .ant-space-compact {
|
|
3169
|
+
display: block;
|
|
3170
|
+
}
|
|
3171
|
+
.original-value-tootip .changed-tooltip .current-value-container .ant-space-item:nth-child(1) {
|
|
3162
3172
|
white-space: nowrap;
|
|
3163
3173
|
}
|
|
3164
3174
|
.pro-upload .pro-upload-dragger .pro-upload-handle-box {
|
|
@@ -5,7 +5,7 @@ import _Tooltip from "antd/es/tooltip";
|
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
8
|
-
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName", "viewRender"];
|
|
8
|
+
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName", "viewRender", "diffConfig"];
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
import React, { useMemo } from 'react';
|
|
11
11
|
import classNames from 'classnames';
|
|
@@ -66,6 +66,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
|
66
66
|
}) : get(originalValues, originalName);
|
|
67
67
|
};
|
|
68
68
|
var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
69
|
+
var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
|
|
69
70
|
var name = props.name,
|
|
70
71
|
names = props.names,
|
|
71
72
|
namesStr = props.namesStr,
|
|
@@ -84,12 +85,14 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
84
85
|
_props$valuePropName = props.valuePropName,
|
|
85
86
|
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
86
87
|
viewRender = props.viewRender,
|
|
88
|
+
diffConfig = props.diffConfig,
|
|
87
89
|
rest = _objectWithoutProperties(props, _excluded);
|
|
88
90
|
var _ref2 = useProConfig('ProEditTable') || {},
|
|
89
91
|
isDiffAll = _ref2.isDiffAll;
|
|
90
92
|
var namePath = toNamePath(namesStr || name);
|
|
91
93
|
var originalNamePath = toNamePath(originalName);
|
|
92
94
|
var originalNamePaths = originalNames && toNamePaths(originalNames);
|
|
95
|
+
var toolTip = (_diffConfig$toolTip = diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
|
|
93
96
|
var isWatch = Boolean(originalValues);
|
|
94
97
|
var originalValue = isWatch ? getOriginalValue({
|
|
95
98
|
namePath: namePath,
|
|
@@ -133,22 +136,47 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
133
136
|
if (!isWatch || noChange) {
|
|
134
137
|
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
|
|
135
138
|
}
|
|
139
|
+
var tipOpenCalc = function tipOpenCalc() {
|
|
140
|
+
if (!toolTip) return false;
|
|
141
|
+
// 传入undefined 鼠标移入显示移出隐藏
|
|
142
|
+
return isChanged ? undefined : false;
|
|
143
|
+
};
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
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);
|
|
136
146
|
var diffClassName = classNames({
|
|
137
147
|
'pro-form-item-changed': isChanged,
|
|
138
148
|
'pro-form-item-add': isAdd
|
|
139
149
|
});
|
|
140
150
|
return _jsx(_Tooltip, {
|
|
141
151
|
// 传入undefined 鼠标移入显示移出隐藏
|
|
142
|
-
open:
|
|
152
|
+
open: tipOpenCalc(),
|
|
143
153
|
getPopupContainer: function getPopupContainer(target) {
|
|
144
154
|
return target.parentElement;
|
|
145
155
|
},
|
|
156
|
+
overlayStyle: {
|
|
157
|
+
zIndex: 99
|
|
158
|
+
},
|
|
146
159
|
title: _jsxs(_Space, {
|
|
147
|
-
|
|
160
|
+
direction: "vertical",
|
|
161
|
+
className: "changed-tooltip",
|
|
162
|
+
children: [_jsxs(_Space, {
|
|
163
|
+
align: "start",
|
|
164
|
+
className: "original-value-container",
|
|
165
|
+
children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
|
|
166
|
+
}), _showEllipse && _jsxs(_Space, {
|
|
167
|
+
className: "current-value-container",
|
|
168
|
+
children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
|
|
169
|
+
isView: true
|
|
170
|
+
})) : undefined]
|
|
171
|
+
})]
|
|
148
172
|
}),
|
|
149
173
|
children: _jsx("div", {
|
|
150
174
|
className: diffClassName,
|
|
151
|
-
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)
|
|
175
|
+
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
|
|
176
|
+
otherProps: _objectSpread(_objectSpread({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
|
|
177
|
+
isDiffChange: isChanged
|
|
178
|
+
})
|
|
179
|
+
})) : undefined
|
|
152
180
|
})
|
|
153
181
|
});
|
|
154
182
|
};
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
9
9
|
import "antd/es/form/style";
|
|
10
10
|
import _Form from "antd/es/form";
|
|
11
11
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
12
|
-
var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "virtual", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "
|
|
12
|
+
var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "virtual", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
|
|
13
13
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
15
15
|
import { get, isArray, isBoolean } from 'lodash';
|
|
@@ -51,7 +51,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
51
51
|
headerRender = _ref.headerRender,
|
|
52
52
|
pagination = _ref.pagination,
|
|
53
53
|
originalValues = _ref.originalValues,
|
|
54
|
-
originalDiffTip = _ref.originalDiffTip,
|
|
55
54
|
rowKey = _ref.rowKey,
|
|
56
55
|
rowDisabled = _ref.rowDisabled,
|
|
57
56
|
rowDraggable = _ref.rowDraggable,
|
|
@@ -166,7 +165,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
166
165
|
tableLength: value === null || value === void 0 ? void 0 : value.length,
|
|
167
166
|
page: page,
|
|
168
167
|
originalValues: originalValues,
|
|
169
|
-
originalDiffTip: originalDiffTip,
|
|
170
168
|
prefixCls: prefixCls,
|
|
171
169
|
rowDisabled: rowDisabled,
|
|
172
170
|
actionDirection: actionDirection
|
|
@@ -274,8 +272,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
274
272
|
var _columns = useMemo(function () {
|
|
275
273
|
return transformColumns(columns, config);
|
|
276
274
|
}, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
|
|
277
|
-
|
|
278
|
-
var _value$every, _originalArr$every;
|
|
275
|
+
var initDataSource = function initDataSource() {
|
|
276
|
+
var _value$every, _originalArr$every, _value$some, _originalArr$some;
|
|
279
277
|
var isAllHasKey = value === null || value === void 0 ? void 0 : (_value$every = value.every) === null || _value$every === void 0 ? void 0 : _value$every.call(value, function (item) {
|
|
280
278
|
return item.rowKey;
|
|
281
279
|
});
|
|
@@ -284,8 +282,15 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
284
282
|
var isOriginalAllHasKey = originalArr ? originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$every = originalArr.every) === null || _originalArr$every === void 0 ? void 0 : _originalArr$every.call(originalArr, function (item) {
|
|
285
283
|
return item.rowKey;
|
|
286
284
|
}) : true;
|
|
285
|
+
// 检测当前rowkey是否与制定key的值是否一致,不一致,则执行覆盖
|
|
286
|
+
var isNeedCover = value === null || value === void 0 ? void 0 : (_value$some = value.some) === null || _value$some === void 0 ? void 0 : _value$some.call(value, function (item) {
|
|
287
|
+
return item.rowKey !== getRowKey(item);
|
|
288
|
+
});
|
|
289
|
+
var isNeedCoverOriginal = originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$some = originalArr.some) === null || _originalArr$some === void 0 ? void 0 : _originalArr$some.call(originalArr, function (item) {
|
|
290
|
+
return item.rowKey !== getRowKey(item);
|
|
291
|
+
});
|
|
287
292
|
// 初始化默认生成row-key
|
|
288
|
-
if ((value === null || value === void 0 ? void 0 : value.length) && !isAllHasKey || (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) && !isOriginalAllHasKey) {
|
|
293
|
+
if ((value === null || value === void 0 ? void 0 : value.length) && (!isAllHasKey || isNeedCover) || (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) && (!isOriginalAllHasKey || isNeedCoverOriginal)) {
|
|
289
294
|
var _originalArr$forEach;
|
|
290
295
|
var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
|
|
291
296
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -300,6 +305,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
300
305
|
form.setFieldValue(virtualRowName, nextValues);
|
|
301
306
|
}
|
|
302
307
|
}
|
|
308
|
+
};
|
|
309
|
+
useEffect(function () {
|
|
310
|
+
initDataSource();
|
|
303
311
|
}, [value, originalValues]);
|
|
304
312
|
useImperativeHandle((resetProps === null || resetProps === void 0 ? void 0 : resetProps.ref) || ref, function () {
|
|
305
313
|
return {
|
|
@@ -138,11 +138,6 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
|
|
|
138
138
|
* @description 原始数据源,是否tooltip显示
|
|
139
139
|
* @default -
|
|
140
140
|
*/
|
|
141
|
-
originalDiffTip?: boolean;
|
|
142
|
-
/**
|
|
143
|
-
* @description 可编辑表格的类型,单行、多行、单元格编辑
|
|
144
|
-
* @default false
|
|
145
|
-
*/
|
|
146
141
|
mode?: 'single' | 'multiple' | 'cell';
|
|
147
142
|
/**
|
|
148
143
|
* @description 可编辑表格的类型,单行编辑或者多行编辑
|
|
@@ -286,7 +286,7 @@ var InputNumber = function InputNumber(props) {
|
|
|
286
286
|
autoComplete: "off",
|
|
287
287
|
placeholder: placeholder || "".concat(locale.ProForm.inputPlaceholder).concat(label !== null && label !== void 0 ? label : ''),
|
|
288
288
|
className: _className
|
|
289
|
-
},
|
|
289
|
+
}, initialConfig), valueProps), rest), {}, {
|
|
290
290
|
onBlur: handleBlur,
|
|
291
291
|
onFocus: handleFocus,
|
|
292
292
|
min: _min,
|
|
@@ -87,18 +87,19 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
87
87
|
'--zaui-contract-bg': changeTipColor,
|
|
88
88
|
'--zaui-contract-bg-add': addTipColor
|
|
89
89
|
};
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
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);
|
|
90
92
|
var diffClassName = classNames({
|
|
91
93
|
'pro-form-item-changed': isChanged,
|
|
92
94
|
'pro-form-item-add': isAdd
|
|
93
95
|
});
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
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);
|
|
96
96
|
return _jsx(_Tooltip, {
|
|
97
97
|
open: tipOpenCalc(),
|
|
98
|
-
//
|
|
98
|
+
// open
|
|
99
99
|
getPopupContainer: function getPopupContainer(target) {
|
|
100
100
|
return target.parentElement;
|
|
101
101
|
},
|
|
102
|
+
overlayClassName: "original-value-tootip",
|
|
102
103
|
title: _jsxs(_Space, {
|
|
103
104
|
direction: "vertical",
|
|
104
105
|
className: "changed-tooltip",
|
|
@@ -480,15 +480,26 @@
|
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
-
.
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
483
|
+
.original-value-tootip{
|
|
484
|
+
max-width: 100%;
|
|
485
|
+
width: max-content;
|
|
486
|
+
z-index: 1;
|
|
487
|
+
.changed-tooltip {
|
|
488
|
+
.original-value-container {
|
|
489
|
+
.ant-space-item:nth-child(1) {
|
|
490
|
+
white-space: nowrap;
|
|
491
|
+
}
|
|
492
|
+
.pro-group{
|
|
493
|
+
.ant-space-compact{
|
|
494
|
+
display: block;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
487
497
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
498
|
+
.current-value-container {
|
|
499
|
+
.ant-space-item:nth-child(1) {
|
|
500
|
+
white-space: nowrap;
|
|
501
|
+
}
|
|
492
502
|
}
|
|
493
503
|
}
|
|
494
|
-
}
|
|
504
|
+
}
|
|
505
|
+
|
|
@@ -17,7 +17,7 @@ var _lodash = require("lodash");
|
|
|
17
17
|
var _diffOriginal = require("../../../ProForm/utils/diffOriginal");
|
|
18
18
|
var _ProConfigProvider = require("../../../ProConfigProvider");
|
|
19
19
|
var _utils = require("../../../utils");
|
|
20
|
-
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName", "viewRender"];
|
|
20
|
+
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName", "viewRender", "diffConfig"];
|
|
21
21
|
var toNamePath = function toNamePath(name) {
|
|
22
22
|
if (Array.isArray(name)) {
|
|
23
23
|
return name;
|
|
@@ -71,6 +71,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
|
71
71
|
}) : (0, _lodash.get)(originalValues, originalName);
|
|
72
72
|
};
|
|
73
73
|
var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
74
|
+
var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
|
|
74
75
|
var name = props.name,
|
|
75
76
|
names = props.names,
|
|
76
77
|
namesStr = props.namesStr,
|
|
@@ -89,12 +90,14 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
89
90
|
_props$valuePropName = props.valuePropName,
|
|
90
91
|
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
91
92
|
viewRender = props.viewRender,
|
|
93
|
+
diffConfig = props.diffConfig,
|
|
92
94
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
93
95
|
var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEditTable') || {},
|
|
94
96
|
isDiffAll = _ref2.isDiffAll;
|
|
95
97
|
var namePath = toNamePath(namesStr || name);
|
|
96
98
|
var originalNamePath = toNamePath(originalName);
|
|
97
99
|
var originalNamePaths = originalNames && toNamePaths(originalNames);
|
|
100
|
+
var toolTip = (_diffConfig$toolTip = diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
|
|
98
101
|
var isWatch = Boolean(originalValues);
|
|
99
102
|
var originalValue = isWatch ? getOriginalValue({
|
|
100
103
|
namePath: namePath,
|
|
@@ -138,6 +141,13 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
138
141
|
if (!isWatch || noChange) {
|
|
139
142
|
return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest));
|
|
140
143
|
}
|
|
144
|
+
var tipOpenCalc = function tipOpenCalc() {
|
|
145
|
+
if (!toolTip) return false;
|
|
146
|
+
// 传入undefined 鼠标移入显示移出隐藏
|
|
147
|
+
return isChanged ? undefined : false;
|
|
148
|
+
};
|
|
149
|
+
// @ts-ignore
|
|
150
|
+
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);
|
|
141
151
|
var diffClassName = (0, _classnames.default)({
|
|
142
152
|
'pro-form-item-changed': isChanged,
|
|
143
153
|
'pro-form-item-add': isAdd
|
|
@@ -146,16 +156,34 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
146
156
|
// 传入undefined 鼠标移入显示移出隐藏
|
|
147
157
|
, {
|
|
148
158
|
// 传入undefined 鼠标移入显示移出隐藏
|
|
149
|
-
open:
|
|
159
|
+
open: tipOpenCalc(),
|
|
150
160
|
getPopupContainer: function getPopupContainer(target) {
|
|
151
161
|
return target.parentElement;
|
|
152
162
|
},
|
|
163
|
+
overlayStyle: {
|
|
164
|
+
zIndex: 99
|
|
165
|
+
},
|
|
153
166
|
title: (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
154
|
-
|
|
167
|
+
direction: "vertical",
|
|
168
|
+
className: "changed-tooltip",
|
|
169
|
+
children: [(0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
170
|
+
align: "start",
|
|
171
|
+
className: "original-value-container",
|
|
172
|
+
children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
|
|
173
|
+
}), _showEllipse && (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
174
|
+
className: "current-value-container",
|
|
175
|
+
children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest), {}, {
|
|
176
|
+
isView: true
|
|
177
|
+
})) : undefined]
|
|
178
|
+
})]
|
|
155
179
|
}),
|
|
156
180
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
157
181
|
className: diffClassName,
|
|
158
|
-
children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest)
|
|
182
|
+
children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest), {}, {
|
|
183
|
+
otherProps: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
|
|
184
|
+
isDiffChange: isChanged
|
|
185
|
+
})
|
|
186
|
+
})) : undefined
|
|
159
187
|
})
|
|
160
188
|
});
|
|
161
189
|
};
|
|
@@ -24,7 +24,7 @@ var _ProForm = _interopRequireDefault(require("../ProForm"));
|
|
|
24
24
|
var _empty = _interopRequireDefault(require("../assets/empty.png"));
|
|
25
25
|
var _locale = _interopRequireWildcard(require("../locale"));
|
|
26
26
|
var _RcTable = require("./components/RcTable");
|
|
27
|
-
var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "virtual", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "
|
|
27
|
+
var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "virtual", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
|
|
28
28
|
var ProEditTable = function ProEditTable(_ref, ref) {
|
|
29
29
|
var _resetProps$id, _resetProps$id$split, _themeConfig$data2;
|
|
30
30
|
var value = _ref.value,
|
|
@@ -54,7 +54,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
54
54
|
headerRender = _ref.headerRender,
|
|
55
55
|
pagination = _ref.pagination,
|
|
56
56
|
originalValues = _ref.originalValues,
|
|
57
|
-
originalDiffTip = _ref.originalDiffTip,
|
|
58
57
|
rowKey = _ref.rowKey,
|
|
59
58
|
rowDisabled = _ref.rowDisabled,
|
|
60
59
|
rowDraggable = _ref.rowDraggable,
|
|
@@ -169,7 +168,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
169
168
|
tableLength: value === null || value === void 0 ? void 0 : value.length,
|
|
170
169
|
page: page,
|
|
171
170
|
originalValues: originalValues,
|
|
172
|
-
originalDiffTip: originalDiffTip,
|
|
173
171
|
prefixCls: prefixCls,
|
|
174
172
|
rowDisabled: rowDisabled,
|
|
175
173
|
actionDirection: actionDirection
|
|
@@ -277,8 +275,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
277
275
|
var _columns = (0, _react.useMemo)(function () {
|
|
278
276
|
return (0, _utils.transformColumns)(columns, config);
|
|
279
277
|
}, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
|
|
280
|
-
|
|
281
|
-
var _value$every, _originalArr$every;
|
|
278
|
+
var initDataSource = function initDataSource() {
|
|
279
|
+
var _value$every, _originalArr$every, _value$some, _originalArr$some;
|
|
282
280
|
var isAllHasKey = value === null || value === void 0 ? void 0 : (_value$every = value.every) === null || _value$every === void 0 ? void 0 : _value$every.call(value, function (item) {
|
|
283
281
|
return item.rowKey;
|
|
284
282
|
});
|
|
@@ -287,8 +285,15 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
287
285
|
var isOriginalAllHasKey = originalArr ? originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$every = originalArr.every) === null || _originalArr$every === void 0 ? void 0 : _originalArr$every.call(originalArr, function (item) {
|
|
288
286
|
return item.rowKey;
|
|
289
287
|
}) : true;
|
|
288
|
+
// 检测当前rowkey是否与制定key的值是否一致,不一致,则执行覆盖
|
|
289
|
+
var isNeedCover = value === null || value === void 0 ? void 0 : (_value$some = value.some) === null || _value$some === void 0 ? void 0 : _value$some.call(value, function (item) {
|
|
290
|
+
return item.rowKey !== getRowKey(item);
|
|
291
|
+
});
|
|
292
|
+
var isNeedCoverOriginal = originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$some = originalArr.some) === null || _originalArr$some === void 0 ? void 0 : _originalArr$some.call(originalArr, function (item) {
|
|
293
|
+
return item.rowKey !== getRowKey(item);
|
|
294
|
+
});
|
|
290
295
|
// 初始化默认生成row-key
|
|
291
|
-
if ((value === null || value === void 0 ? void 0 : value.length) && !isAllHasKey || (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) && !isOriginalAllHasKey) {
|
|
296
|
+
if ((value === null || value === void 0 ? void 0 : value.length) && (!isAllHasKey || isNeedCover) || (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) && (!isOriginalAllHasKey || isNeedCoverOriginal)) {
|
|
292
297
|
var _originalArr$forEach;
|
|
293
298
|
var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
|
|
294
299
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
@@ -303,6 +308,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
303
308
|
form.setFieldValue(virtualRowName, nextValues);
|
|
304
309
|
}
|
|
305
310
|
}
|
|
311
|
+
};
|
|
312
|
+
(0, _react.useEffect)(function () {
|
|
313
|
+
initDataSource();
|
|
306
314
|
}, [value, originalValues]);
|
|
307
315
|
(0, _react.useImperativeHandle)((resetProps === null || resetProps === void 0 ? void 0 : resetProps.ref) || ref, function () {
|
|
308
316
|
return {
|
|
@@ -138,11 +138,6 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
|
|
|
138
138
|
* @description 原始数据源,是否tooltip显示
|
|
139
139
|
* @default -
|
|
140
140
|
*/
|
|
141
|
-
originalDiffTip?: boolean;
|
|
142
|
-
/**
|
|
143
|
-
* @description 可编辑表格的类型,单行、多行、单元格编辑
|
|
144
|
-
* @default false
|
|
145
|
-
*/
|
|
146
141
|
mode?: 'single' | 'multiple' | 'cell';
|
|
147
142
|
/**
|
|
148
143
|
* @description 可编辑表格的类型,单行编辑或者多行编辑
|
|
@@ -290,7 +290,7 @@ var InputNumber = function InputNumber(props) {
|
|
|
290
290
|
autoComplete: "off",
|
|
291
291
|
placeholder: placeholder || "".concat(_locale.default.ProForm.inputPlaceholder).concat(label !== null && label !== void 0 ? label : ''),
|
|
292
292
|
className: _className
|
|
293
|
-
},
|
|
293
|
+
}, initialConfig), valueProps), rest), {}, {
|
|
294
294
|
onBlur: handleBlur,
|
|
295
295
|
onFocus: handleFocus,
|
|
296
296
|
min: _min,
|
|
@@ -92,18 +92,19 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
92
92
|
'--zaui-contract-bg': changeTipColor,
|
|
93
93
|
'--zaui-contract-bg-add': addTipColor
|
|
94
94
|
};
|
|
95
|
+
// @ts-ignore
|
|
96
|
+
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);
|
|
95
97
|
var diffClassName = (0, _classnames.default)({
|
|
96
98
|
'pro-form-item-changed': isChanged,
|
|
97
99
|
'pro-form-item-add': isAdd
|
|
98
100
|
});
|
|
99
|
-
// @ts-ignore
|
|
100
|
-
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);
|
|
101
101
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
102
102
|
open: tipOpenCalc(),
|
|
103
|
-
//
|
|
103
|
+
// open
|
|
104
104
|
getPopupContainer: function getPopupContainer(target) {
|
|
105
105
|
return target.parentElement;
|
|
106
106
|
},
|
|
107
|
+
overlayClassName: "original-value-tootip",
|
|
107
108
|
title: (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
108
109
|
direction: "vertical",
|
|
109
110
|
className: "changed-tooltip",
|
|
@@ -480,15 +480,26 @@
|
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
-
.
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
483
|
+
.original-value-tootip{
|
|
484
|
+
max-width: 100%;
|
|
485
|
+
width: max-content;
|
|
486
|
+
z-index: 1;
|
|
487
|
+
.changed-tooltip {
|
|
488
|
+
.original-value-container {
|
|
489
|
+
.ant-space-item:nth-child(1) {
|
|
490
|
+
white-space: nowrap;
|
|
491
|
+
}
|
|
492
|
+
.pro-group{
|
|
493
|
+
.ant-space-compact{
|
|
494
|
+
display: block;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
487
497
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
498
|
+
.current-value-container {
|
|
499
|
+
.ant-space-item:nth-child(1) {
|
|
500
|
+
white-space: nowrap;
|
|
501
|
+
}
|
|
492
502
|
}
|
|
493
503
|
}
|
|
494
|
-
}
|
|
504
|
+
}
|
|
505
|
+
|