@zat-design/sisyphus-react 3.8.3 → 3.9.0
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 +38 -3
- package/dist/less.esm.css +37 -2
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +83 -20
- package/es/ProEditTable/components/RenderField/index.js +6 -2
- package/es/ProEditTable/index.js +18 -9
- package/es/ProEditTable/propsType.d.ts +3 -6
- package/es/ProEditTable/style/index.less +0 -1
- package/es/ProEditTable/utils/index.js +10 -3
- package/es/ProForm/components/base/InputNumber/index.js +1 -1
- package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
- package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/es/ProForm/components/combination/FormList/index.js +14 -3
- package/es/ProForm/components/combination/Group/index.js +3 -4
- package/es/ProForm/components/combination/ProCascader/index.js +21 -14
- package/es/ProForm/components/combination/ProModalSelect/index.js +17 -3
- package/es/ProForm/components/render/ChangedWrapper.js +29 -10
- package/es/ProForm/components/render/Render.js +3 -1
- package/es/ProForm/components/render/RenderFields.js +4 -2
- package/es/ProForm/propsType.d.ts +3 -0
- package/es/ProForm/style/index.less +35 -9
- package/es/ProForm/utils/diffOriginal.js +14 -2
- package/es/ProForm/utils/useShouldUpdate.js +1 -9
- package/es/ProTable/components/FormatColumn/index.d.ts +2 -1
- package/es/ProTable/components/FormatColumn/index.js +107 -29
- package/es/ProTable/components/RenderColumn/index.d.ts +1 -0
- package/es/ProTable/components/RenderColumn/index.js +23 -6
- package/es/ProTable/index.js +8 -7
- package/es/ProTable/propsType.d.ts +4 -0
- package/es/ProTable/style/index.less +14 -0
- package/es/style/theme/antd.less +1 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +26 -0
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +82 -21
- package/lib/ProEditTable/components/RenderField/index.js +6 -2
- package/lib/ProEditTable/index.js +18 -9
- package/lib/ProEditTable/propsType.d.ts +3 -6
- package/lib/ProEditTable/style/index.less +0 -1
- package/lib/ProEditTable/utils/index.js +10 -3
- package/lib/ProForm/components/base/InputNumber/index.js +1 -1
- package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
- package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/lib/ProForm/components/combination/FormList/index.js +14 -3
- package/lib/ProForm/components/combination/Group/index.js +3 -4
- package/lib/ProForm/components/combination/ProCascader/index.js +21 -14
- package/lib/ProForm/components/combination/ProModalSelect/index.js +17 -3
- package/lib/ProForm/components/render/ChangedWrapper.js +29 -10
- package/lib/ProForm/components/render/Render.js +3 -1
- package/lib/ProForm/components/render/RenderFields.js +4 -2
- package/lib/ProForm/propsType.d.ts +3 -0
- package/lib/ProForm/style/index.less +35 -9
- package/lib/ProForm/utils/diffOriginal.js +13 -1
- package/lib/ProForm/utils/useShouldUpdate.js +1 -9
- package/lib/ProTable/components/FormatColumn/index.d.ts +2 -1
- package/lib/ProTable/components/FormatColumn/index.js +107 -29
- package/lib/ProTable/components/RenderColumn/index.d.ts +1 -0
- package/lib/ProTable/components/RenderColumn/index.js +20 -5
- package/lib/ProTable/index.js +8 -7
- package/lib/ProTable/propsType.d.ts +4 -0
- package/lib/ProTable/style/index.less +14 -0
- package/lib/style/theme/antd.less +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +28 -1
- package/package.json +1 -1
@@ -5,6 +5,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
6
6
|
import { forwardRef, useCallback, useImperativeHandle } from 'react';
|
7
7
|
import { DndContext } from '@dnd-kit/core';
|
8
|
+
import { get } from 'lodash';
|
8
9
|
import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
9
10
|
import { toArray } from '../../../utils';
|
10
11
|
import { namesPathTransform } from './utils';
|
@@ -12,6 +13,7 @@ import ToolbarButton from './components/ToolbarButton';
|
|
12
13
|
import BlockFields from './components/BlockFields';
|
13
14
|
import LineFields from './components/LineFields';
|
14
15
|
import ProForm from '../../../../ProForm';
|
16
|
+
import { useProConfig } from '../../../../ProConfigProvider';
|
15
17
|
var FormList = function FormList(props, ref) {
|
16
18
|
var columns = props.columns,
|
17
19
|
min = props.min,
|
@@ -33,9 +35,16 @@ var FormList = function FormList(props, ref) {
|
|
33
35
|
var _ref = ProForm.useFieldProps() || {},
|
34
36
|
form = _ref.form,
|
35
37
|
name = _ref.name,
|
36
|
-
isView = _ref.isView
|
38
|
+
isView = _ref.isView,
|
39
|
+
diffConfig = _ref.diffConfig;
|
40
|
+
var _useProConfig = useProConfig('ProForm'),
|
41
|
+
isDiffAll = _useProConfig.isDiffAll;
|
37
42
|
var errors = meta.errors;
|
38
43
|
var _namePath = toArray(name);
|
44
|
+
var orgValues = get(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
|
45
|
+
var _diffConfig = _objectSpread(_objectSpread({}, diffConfig), {}, {
|
46
|
+
originalValues: isDiffAll ? orgValues || [] : orgValues
|
47
|
+
});
|
39
48
|
var processColumns = useCallback(function (fieldName, namePath) {
|
40
49
|
return columns.map(function (item) {
|
41
50
|
// names的name处理
|
@@ -98,7 +107,8 @@ var FormList = function FormList(props, ref) {
|
|
98
107
|
colProps: {
|
99
108
|
span: span
|
100
109
|
},
|
101
|
-
form: form
|
110
|
+
form: form,
|
111
|
+
diffConfig: _diffConfig
|
102
112
|
}), field.key) : _jsx(LineFields, _objectSpread(_objectSpread({
|
103
113
|
className: _fields.length === index + 1 ? 'pro-form-list-last' : ''
|
104
114
|
}, props), {}, {
|
@@ -112,7 +122,8 @@ var FormList = function FormList(props, ref) {
|
|
112
122
|
colProps: {
|
113
123
|
span: mode === 'less' ? 24 : span
|
114
124
|
},
|
115
|
-
form: form
|
125
|
+
form: form,
|
126
|
+
diffConfig: _diffConfig
|
116
127
|
}), field.key);
|
117
128
|
}), _jsx(_Form.ErrorList, {
|
118
129
|
errors: errors
|
@@ -26,15 +26,14 @@ var Group = function Group(props) {
|
|
26
26
|
value = props.value,
|
27
27
|
onChange = props.onChange,
|
28
28
|
otherProps = props.otherProps,
|
29
|
-
|
30
|
-
id = props.id,
|
31
|
-
isView = props.isView;
|
29
|
+
id = props.id;
|
32
30
|
var contextProps = ProForm.useFieldProps() || {};
|
33
31
|
var names = contextProps.names,
|
34
32
|
name = contextProps.name,
|
35
33
|
form = contextProps.form,
|
36
34
|
namePath = contextProps.namePath,
|
37
|
-
index = contextProps.index
|
35
|
+
index = contextProps.index,
|
36
|
+
isView = contextProps.isView;
|
38
37
|
var _option = React.useRef([]);
|
39
38
|
// 组合onChange
|
40
39
|
var handleChange = function handleChange(value, option, index) {
|
@@ -50,7 +50,7 @@ var getViewLabel = function getViewLabel(_ref) {
|
|
50
50
|
return viewLabel;
|
51
51
|
};
|
52
52
|
var ProCascader = function ProCascader(props) {
|
53
|
-
var _props$otherProps, _value$slice,
|
53
|
+
var _props$otherProps, _value$slice, _ref5, _ref5$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
|
54
54
|
var _ref2 = useProConfig('ProAddressBar') || {},
|
55
55
|
configDetailMaxLength = _ref2.detailMaxLength,
|
56
56
|
configEnumCode = _ref2.enumCode,
|
@@ -79,7 +79,7 @@ var ProCascader = function ProCascader(props) {
|
|
79
79
|
code = _props$code === void 0 ? configCode : _props$code,
|
80
80
|
tooltip = props.tooltip,
|
81
81
|
_props$separator = props.separator,
|
82
|
-
separator = _props$separator === void 0 ? '' : _props$separator,
|
82
|
+
separator = _props$separator === void 0 ? '/' : _props$separator,
|
83
83
|
detailPlaceholder = props.detailPlaceholder,
|
84
84
|
otherProps = _objectWithoutProperties(props, _excluded);
|
85
85
|
var _ref3 = ProForm.useFieldProps() || {},
|
@@ -90,16 +90,18 @@ var ProCascader = function ProCascader(props) {
|
|
90
90
|
var realLevel = Math.max(2, level);
|
91
91
|
var detail = value === null || value === void 0 ? void 0 : value[realLevel];
|
92
92
|
var enumData = useEnum(addressCode);
|
93
|
-
var
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
var _useProConfig = useProConfig('ProEnum'),
|
94
|
+
_useProConfig$dics = _useProConfig.dics,
|
95
|
+
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
96
|
+
var enumDataSource = useMemo(function () {
|
97
|
+
if (!(props === null || props === void 0 ? void 0 : props.mode)) {
|
98
|
+
return (dics === null || dics === void 0 ? void 0 : dics[addressCode]) || [];
|
99
|
+
}
|
100
|
+
return Array.isArray(enumData) ? enumData[0] : [];
|
101
|
+
}, [dics === null || dics === void 0 ? void 0 : dics[addressCode], enumData]);
|
97
102
|
var realDataSource = useMemo(function () {
|
98
103
|
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
99
104
|
var result = transformDataName(isAddressMode && realLevel === 2 ? _filterDataSource(innerDataSource, level, fieldNames) : innerDataSource, fieldNames);
|
100
|
-
if (transformResponse) {
|
101
|
-
return transformResponse(result);
|
102
|
-
}
|
103
105
|
return result;
|
104
106
|
}, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
105
107
|
var _useRequest = _objectSpread({}, useRequest),
|
@@ -115,7 +117,7 @@ var ProCascader = function ProCascader(props) {
|
|
115
117
|
defaultLabel = _useState4[0],
|
116
118
|
setDefaultLabel = _useState4[1];
|
117
119
|
var getFirstLevelOptions = /*#__PURE__*/function () {
|
118
|
-
var
|
120
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
119
121
|
var _yield$service, data, newData, transFormData, serviceData;
|
120
122
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
121
123
|
while (1) switch (_context.prev = _context.next) {
|
@@ -143,9 +145,13 @@ var ProCascader = function ProCascader(props) {
|
|
143
145
|
}, _callee);
|
144
146
|
}));
|
145
147
|
return function getFirstLevelOptions() {
|
146
|
-
return
|
148
|
+
return _ref4.apply(this, arguments);
|
147
149
|
};
|
148
150
|
}();
|
151
|
+
// 提取出来默认每次都执行
|
152
|
+
if (transformResponse) {
|
153
|
+
realDataSource = transformResponse(realDataSource);
|
154
|
+
}
|
149
155
|
useEffect(function () {
|
150
156
|
if (service) {
|
151
157
|
// 传入useRequest时,初次加载级联第一级数据源
|
@@ -154,13 +160,14 @@ var ProCascader = function ProCascader(props) {
|
|
154
160
|
}, [service]);
|
155
161
|
useEffect(function () {
|
156
162
|
if (realIsView && value) {
|
163
|
+
var _realDataSource;
|
157
164
|
// 传入dataSource + 查看时初始化展示
|
158
165
|
if (service) {
|
159
166
|
setDefaultLabel(getViewLabel({
|
160
167
|
dataSource: serviceData,
|
161
168
|
value: isAddressMode && hasDetail ? value === null || value === void 0 ? void 0 : value.slice(0, realLevel) : value
|
162
169
|
}));
|
163
|
-
} else if ((realDataSource === null ||
|
170
|
+
} else if (((_realDataSource = realDataSource) === null || _realDataSource === void 0 ? void 0 : _realDataSource.length) > 0) {
|
164
171
|
setDefaultLabel(getViewLabel({
|
165
172
|
dataSource: realDataSource,
|
166
173
|
value: isAddressMode && hasDetail ? value === null || value === void 0 ? void 0 : value.slice(0, realLevel) : value
|
@@ -194,9 +201,9 @@ var ProCascader = function ProCascader(props) {
|
|
194
201
|
var addressValue = isAddressMode ? value && ((_value$slice = value.slice(0, realLevel)) === null || _value$slice === void 0 ? void 0 : _value$slice.some(function (item) {
|
195
202
|
return !!item;
|
196
203
|
})) ? value.slice(0, realLevel) : undefined : value;
|
197
|
-
var viewValue = isAddressMode ? ((
|
204
|
+
var viewValue = isAddressMode ? ((_ref5 = [].concat(_toConsumableArray(defaultLabel), [value === null || value === void 0 ? void 0 : value[realLevel]])) === null || _ref5 === void 0 ? void 0 : (_ref5$filter = _ref5.filter(function (item) {
|
198
205
|
return !!item;
|
199
|
-
})) === null ||
|
206
|
+
})) === null || _ref5$filter === void 0 ? void 0 : _ref5$filter.join(separator)) || '-' : (defaultLabel === null || defaultLabel === void 0 ? void 0 : (_defaultLabel$filter = defaultLabel.filter(function (item) {
|
200
207
|
return !!item;
|
201
208
|
})) === null || _defaultLabel$filter === void 0 ? void 0 : _defaultLabel$filter.join(separator)) || '-';
|
202
209
|
var _findSelectedOptions = function findSelectedOptions(options, value) {
|
@@ -195,11 +195,25 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
195
195
|
value: item[valueKey],
|
196
196
|
label: item[labelKey]
|
197
197
|
}));
|
198
|
-
})) === null || _data$map === void 0 ? void 0 : _data$map.join(',') :
|
198
|
+
})) === null || _data$map === void 0 ? void 0 : _data$map.join(',') : '';
|
199
199
|
};
|
200
200
|
var viewText = useMemo(function () {
|
201
|
-
|
202
|
-
|
201
|
+
var nextValue = labelInValue ? value : _value;
|
202
|
+
if (labelInValue) {
|
203
|
+
nextValue = value;
|
204
|
+
} else {
|
205
|
+
var _options$find;
|
206
|
+
var optionDTO = options === null || options === void 0 ? void 0 : (_options$find = options.find) === null || _options$find === void 0 ? void 0 : _options$find.call(options, function (item) {
|
207
|
+
return item[valueKey] === value;
|
208
|
+
});
|
209
|
+
if (optionDTO) {
|
210
|
+
nextValue = optionDTO;
|
211
|
+
} else {
|
212
|
+
nextValue = _value;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
return formatValue(nextValue);
|
216
|
+
}, [value, _value, options]);
|
203
217
|
/**
|
204
218
|
* 获取表格的rowKey,支持函数、字符串
|
205
219
|
* @date 2023-02-16
|
@@ -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", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps"];
|
8
|
+
var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps", "viewRender"];
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
10
10
|
import classNames from 'classnames';
|
11
11
|
import { get } from 'lodash';
|
@@ -27,12 +27,16 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
27
27
|
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
28
28
|
normalize = props.normalize,
|
29
29
|
getValueProps = props.getValueProps,
|
30
|
+
viewRender = props.viewRender,
|
30
31
|
rest = _objectWithoutProperties(props, _excluded);
|
32
|
+
// const contentRef = useRef(null);
|
31
33
|
var _useProConfig = useProConfig('ProForm'),
|
32
34
|
isDiffAll = _useProConfig.isDiffAll;
|
33
35
|
var originalValues = diffConfig.originalValues,
|
34
36
|
changeTipColor = diffConfig.changeTipColor,
|
35
|
-
addTipColor = diffConfig.addTipColor
|
37
|
+
addTipColor = diffConfig.addTipColor,
|
38
|
+
_diffConfig$scrollFol = diffConfig.scrollFollowParent,
|
39
|
+
scrollFollowParent = _diffConfig$scrollFol === void 0 ? true : _diffConfig$scrollFol;
|
36
40
|
var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
|
37
41
|
var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
|
38
42
|
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
@@ -52,9 +56,19 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
52
56
|
}, [isWatch, noChange, props[valuePropName], originalValue]);
|
53
57
|
var isAdd = diffType === 'add';
|
54
58
|
var isChanged = diffType === 'changed';
|
59
|
+
var viewRenderFun = useMemo(function () {
|
60
|
+
return function (orgValue) {
|
61
|
+
return viewRender(orgValue, originalValues, {
|
62
|
+
form: form
|
63
|
+
});
|
64
|
+
};
|
65
|
+
}, [form]);
|
55
66
|
var tipContent = useMemo(function () {
|
56
67
|
if (!isWatch || noChange) return undefined;
|
57
|
-
var valueProps = getValueProps ? getValueProps(originalValue) :
|
68
|
+
var valueProps = getValueProps && !names ? getValueProps(originalValue) : {
|
69
|
+
value: originalValue
|
70
|
+
};
|
71
|
+
if (viewRender) return viewRenderFun(valueProps === null || valueProps === void 0 ? void 0 : valueProps.value);
|
58
72
|
return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, _defineProperty({
|
59
73
|
isView: true
|
60
74
|
}, valuePropName, valueProps === null || valueProps === void 0 ? void 0 : valueProps.value))) : undefined;
|
@@ -66,27 +80,30 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
66
80
|
originalValues: isNestedField ? originalValues : undefined
|
67
81
|
}, children.props), rest));
|
68
82
|
}
|
83
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
84
|
+
// const isFocus = useFocus(contentRef.current);
|
69
85
|
var tipOpenCalc = function tipOpenCalc() {
|
70
86
|
if (!toolTip) return false;
|
71
|
-
// 传入undefined 鼠标移入显示移出隐藏
|
87
|
+
// 传入undefined 鼠标移入显示移出隐藏 获得焦点时不显示气泡
|
72
88
|
return isChanged ? undefined : false;
|
73
89
|
};
|
74
90
|
var style = {
|
75
91
|
'--zaui-contract-bg': changeTipColor,
|
76
92
|
'--zaui-contract-bg-add': addTipColor
|
77
93
|
};
|
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);
|
78
96
|
var diffClassName = classNames({
|
79
97
|
'pro-form-item-changed': isChanged,
|
80
98
|
'pro-form-item-add': isAdd
|
81
99
|
});
|
82
|
-
|
83
|
-
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);
|
100
|
+
var open = tipOpenCalc();
|
84
101
|
return _jsx(_Tooltip, {
|
85
|
-
open:
|
86
|
-
|
87
|
-
|
88
|
-
return target.parentElement;
|
102
|
+
open: open,
|
103
|
+
getPopupContainer: function getPopupContainer(trigger) {
|
104
|
+
return scrollFollowParent ? trigger.parentElement : document.body;
|
89
105
|
},
|
106
|
+
overlayClassName: "original-value-tootip",
|
90
107
|
title: _jsxs(_Space, {
|
91
108
|
direction: "vertical",
|
92
109
|
className: "changed-tooltip",
|
@@ -97,6 +114,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
97
114
|
}), _showEllipse && _jsxs(_Space, {
|
98
115
|
className: "current-value-container",
|
99
116
|
children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
|
117
|
+
scrollFollowParent: scrollFollowParent,
|
100
118
|
isView: true
|
101
119
|
})) : undefined]
|
102
120
|
})]
|
@@ -106,6 +124,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
106
124
|
className: diffClassName,
|
107
125
|
style: style,
|
108
126
|
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
|
127
|
+
scrollFollowParent: scrollFollowParent,
|
109
128
|
otherProps: _objectSpread(_objectSpread({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
|
110
129
|
isDiffChange: isChanged
|
111
130
|
})
|
@@ -50,7 +50,8 @@ var Render = function Render(props) {
|
|
50
50
|
requiredOnView = props.requiredOnView,
|
51
51
|
confirm = props.confirm,
|
52
52
|
globalControl = props.globalControl,
|
53
|
-
diffConfig = props.diffConfig
|
53
|
+
diffConfig = props.diffConfig,
|
54
|
+
viewRender = props.viewRender;
|
54
55
|
var colProps = props.colProps;
|
55
56
|
// 剔除一些不是FormItem的属性, 防止控制台报warning
|
56
57
|
var labelWidth = formItemProps.labelWidth,
|
@@ -439,6 +440,7 @@ var Render = function Render(props) {
|
|
439
440
|
valuePropName: _otherFormItemProps.valuePropName,
|
440
441
|
normalize: _otherFormItemProps.normalize,
|
441
442
|
getValueProps: _otherFormItemProps.getValueProps,
|
443
|
+
viewRender: viewRender,
|
442
444
|
children: child
|
443
445
|
});
|
444
446
|
}
|
@@ -186,7 +186,8 @@ var RenderFields = function RenderFields(props) {
|
|
186
186
|
namePath: column.namePath,
|
187
187
|
listName: column.listName,
|
188
188
|
globalControl: globalControl,
|
189
|
-
formDisabled: formDisabled
|
189
|
+
formDisabled: formDisabled,
|
190
|
+
diffConfig: diffConfig
|
190
191
|
};
|
191
192
|
return _jsx(FieldProvider, {
|
192
193
|
value: otherProps,
|
@@ -209,7 +210,8 @@ var RenderFields = function RenderFields(props) {
|
|
209
210
|
diffConfig: diffConfig,
|
210
211
|
equalWith: equalWith,
|
211
212
|
requiredOnView: requiredOnView,
|
212
|
-
globalControl: globalControl
|
213
|
+
globalControl: globalControl,
|
214
|
+
viewRender: viewRender
|
213
215
|
})
|
214
216
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
215
217
|
});
|
@@ -45,6 +45,7 @@ export interface ProFormOtherProps {
|
|
45
45
|
globalControl?: boolean;
|
46
46
|
formDisabled?: boolean;
|
47
47
|
isDiffChange?: boolean;
|
48
|
+
diffConfig?: DiffConfigProps;
|
48
49
|
}
|
49
50
|
export interface DiffConfigProps<Values = any> {
|
50
51
|
/** 比对原始数据源 */
|
@@ -55,6 +56,8 @@ export interface DiffConfigProps<Values = any> {
|
|
55
56
|
changeTipColor?: string;
|
56
57
|
/** 新增提示颜色 */
|
57
58
|
addTipColor?: string;
|
59
|
+
/** 是否跟随父组件滚动 */
|
60
|
+
scrollFollowParent?: string;
|
58
61
|
}
|
59
62
|
export interface ProFormProps<Values = any> extends FormProps<Values> {
|
60
63
|
disabled?: boolean;
|
@@ -53,6 +53,11 @@
|
|
53
53
|
}
|
54
54
|
|
55
55
|
&.pro-form-view {
|
56
|
+
.pro-group{
|
57
|
+
.@{ant-prefix}-space-item, .pro-form-view-container{
|
58
|
+
width: max-content;
|
59
|
+
}
|
60
|
+
}
|
56
61
|
.@{ant-prefix}-form-item-label {
|
57
62
|
label {
|
58
63
|
color: var(--zaui-aide-text, #939599);
|
@@ -329,6 +334,9 @@
|
|
329
334
|
border-radius: 4px;
|
330
335
|
background: @zaui-contract-bg !important;
|
331
336
|
|
337
|
+
.@{ant-prefix}-input {
|
338
|
+
background: @zaui-contract-bg !important;
|
339
|
+
}
|
332
340
|
.@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
|
333
341
|
background: @zaui-contract-bg !important;
|
334
342
|
}
|
@@ -403,6 +411,10 @@
|
|
403
411
|
border-radius: 4px;
|
404
412
|
background: @zaui-contract-bg-add !important;
|
405
413
|
|
414
|
+
.@{ant-prefix}-input {
|
415
|
+
background: @zaui-contract-bg !important;
|
416
|
+
}
|
417
|
+
|
406
418
|
.@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
|
407
419
|
background: @zaui-contract-bg-add !important;
|
408
420
|
}
|
@@ -473,15 +485,29 @@
|
|
473
485
|
}
|
474
486
|
}
|
475
487
|
|
476
|
-
.
|
477
|
-
|
478
|
-
|
479
|
-
|
488
|
+
.original-value-tootip{
|
489
|
+
max-width: 100%;
|
490
|
+
width: max-content;
|
491
|
+
z-index: 99;
|
492
|
+
.changed-tooltip {
|
493
|
+
.original-value-container {
|
494
|
+
.ant-space-item:nth-child(1) {
|
495
|
+
white-space: nowrap;
|
496
|
+
}
|
497
|
+
.pro-group{
|
498
|
+
.ant-space-compact{
|
499
|
+
display: block;
|
500
|
+
}
|
501
|
+
.pro-form-view-container{
|
502
|
+
word-break: keep-all;
|
503
|
+
}
|
504
|
+
}
|
480
505
|
}
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
506
|
+
.current-value-container {
|
507
|
+
.ant-space-item:nth-child(1) {
|
508
|
+
white-space: nowrap;
|
509
|
+
}
|
485
510
|
}
|
486
511
|
}
|
487
|
-
}
|
512
|
+
}
|
513
|
+
|
@@ -1,5 +1,17 @@
|
|
1
|
-
import { isEqual, isFunction } from 'lodash';
|
1
|
+
import { isEqual, isFunction, isObject } from 'lodash';
|
2
2
|
import { isEmpty } from '../../utils';
|
3
|
+
// 过滤对象中undefined字段
|
4
|
+
// 防止{a: '1'} {a: '1', b: undefined}被认为不相等
|
5
|
+
var filterUndefined = function filterUndefined(data) {
|
6
|
+
if (!isObject(data) || Array.isArray(data) || data === null) return data;
|
7
|
+
var resData = {};
|
8
|
+
Object.keys(data).forEach(function (key) {
|
9
|
+
if (data[key] !== undefined) {
|
10
|
+
resData[key] = data[key];
|
11
|
+
}
|
12
|
+
});
|
13
|
+
return resData;
|
14
|
+
};
|
3
15
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
4
16
|
export var diffOriginal = function diffOriginal(params) {
|
5
17
|
var originalValue = params.originalValue,
|
@@ -29,7 +41,7 @@ export var diffOriginal = function diffOriginal(params) {
|
|
29
41
|
return isSame ? 'same' : 'changed';
|
30
42
|
}
|
31
43
|
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
32
|
-
return isEqual(value, originalValue) ? 'same' : 'changed';
|
44
|
+
return isEqual(filterUndefined(value), filterUndefined(originalValue)) ? 'same' : 'changed';
|
33
45
|
}
|
34
46
|
return 'same';
|
35
47
|
};
|
@@ -163,9 +163,6 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
163
163
|
index: index,
|
164
164
|
namePath: namePath
|
165
165
|
}) : rules;
|
166
|
-
// const _component = isFunction(originComponent)
|
167
|
-
// ? originComponent(_currentValues, { form, index, namePath })
|
168
|
-
// : newComponent;
|
169
166
|
var _fieldProps = isFunction(fieldProps) ? fieldProps(_currentValues, {
|
170
167
|
form: form,
|
171
168
|
index: index,
|
@@ -196,17 +193,12 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
196
193
|
}
|
197
194
|
var equalRes = isEqualWith(rulesRef.current, _rules, customEqualForFun);
|
198
195
|
var proEqualRes = isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun);
|
199
|
-
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes
|
200
|
-
// 值变更,需要同步更新函数式的fieldProps
|
201
|
-
// (isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues)) ||
|
202
|
-
// !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
|
203
|
-
// equalDependencies(dependencies, prevValues, _currentValues)
|
196
|
+
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes || (_fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.transformResponse) // 防止fieldProps变更时,transformResponse根据fieldProps新值无法触发更新
|
204
197
|
) {
|
205
198
|
showRef.current = _show;
|
206
199
|
disabledRef.current = _disabled;
|
207
200
|
requiredRef.current = _required;
|
208
201
|
rulesRef.current = _rules;
|
209
|
-
// originComponentRef.current = _component;
|
210
202
|
fieldPropsRef.current = _fieldProps;
|
211
203
|
reRender({});
|
212
204
|
return false;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ProTableColumn } from '../../propsType';
|
3
|
-
export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, scroll, onUpdateMinWidth, }: {
|
3
|
+
export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, scroll, onUpdateMinWidth, isInNewRow, }: {
|
4
4
|
column: ProTableColumn;
|
5
5
|
originalObj: any;
|
6
6
|
dataSourceObj: any;
|
@@ -9,6 +9,7 @@ export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey
|
|
9
9
|
wrapToolTipProps?: any;
|
10
10
|
scroll?: any;
|
11
11
|
onUpdateMinWidth?: any;
|
12
|
+
isInNewRow?: any;
|
12
13
|
}) => void;
|
13
14
|
/**
|
14
15
|
* 查找最近的父级className
|