@zat-design/sisyphus-react 3.4.2-beta.1 → 3.4.2-beta.10
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 +239 -122
- package/es/ProEditLabel/style/index.less +1 -1
- package/es/ProEditTable/components/RenderField/index.js +13 -15
- package/es/ProEditTable/index.js +3 -3
- package/es/ProEditTable/propsType.d.ts +1 -1
- package/es/ProEditTable/style/index.less +1 -1
- package/es/ProEditTable/utils/index.js +36 -22
- package/es/ProEditTable/utils/tools.js +3 -1
- package/es/ProEnum/style/index.less +2 -2
- package/es/ProForm/components/base/DatePicker/index.js +2 -2
- package/es/ProForm/components/combination/Group/index.js +6 -9
- package/es/ProForm/components/combination/Group/style/index.less +4 -4
- package/es/ProForm/components/combination/Group/utils.d.ts +2 -0
- package/es/ProForm/components/combination/Group/utils.js +10 -0
- package/es/ProForm/components/combination/ProTimeLimit/index.js +8 -2
- package/es/ProForm/components/render/Render.js +2 -2
- package/es/ProForm/components/render/RenderFields.d.ts +1 -1
- package/es/ProForm/components/render/RenderFields.js +2 -2
- package/es/ProForm/index.js +4 -4
- package/es/ProForm/propsType.d.ts +1 -1
- package/es/ProForm/utils/{contrastOriginal.d.ts → diffOriginal.d.ts} +2 -1
- package/es/ProForm/utils/diffOriginal.js +61 -0
- package/es/ProForm/utils/index.d.ts +1 -1
- package/es/ProForm/utils/index.js +1 -1
- package/es/ProForm/utils/transformValue.js +2 -2
- package/es/ProForm/utils/useChanged.js +4 -3
- package/es/ProForm/utils/useListChanged.d.ts +1 -1
- package/es/ProForm/utils/useListChanged.js +4 -3
- package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +58 -55
- package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
- package/es/ProLayout/components/Layout/Menu/style/index.less +52 -56
- package/es/ProLayout/components/ProCollapse/style/index.less +17 -9
- package/es/ProLayout/components/ProFooter/index.js +1 -1
- package/es/ProLayout/components/ProFooter/style/index.less +1 -1
- package/es/ProLayout/components/ProHeader/style/index.less +4 -3
- package/es/ProLayout/style/index.less +173 -87
- package/es/ProTable/components/RenderColumn/index.d.ts +1 -1
- package/es/ProTable/components/RenderColumn/index.js +3 -3
- package/es/ProTable/propsType.d.ts +1 -1
- package/es/ProTable/style/index.less +2 -2
- package/es/ProTable/utils.js +9 -9
- package/es/ProTabs/style/index.less +3 -1
- package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +2 -2
- package/es/ProThemeTools/component/PrdTools/style/index.less +1 -1
- package/es/ProThemeTools/index.js +21 -28
- package/es/ProThemeTools/propsType.d.ts +1 -1
- package/es/ProThemeTools/style/index.less +25 -8
- package/es/ProTreeModal/style/index.less +2 -2
- package/es/ProUpload/style/fileItem.less +2 -2
- package/es/ProUpload/style/index.less +2 -2
- package/es/assets/setting.svg +14 -0
- package/es/style/components.less +0 -1
- package/es/style/theme/antd.less +0 -1
- package/es/style/theme/index.less +2 -2
- package/es/style/theme/tokens.less +2 -2
- package/es/tokens.js +2 -2
- package/lib/ProEditLabel/style/index.less +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +12 -14
- package/lib/ProEditTable/index.js +3 -3
- package/lib/ProEditTable/propsType.d.ts +1 -1
- package/lib/ProEditTable/style/index.less +1 -1
- package/lib/ProEditTable/utils/index.js +36 -22
- package/lib/ProEditTable/utils/tools.js +3 -1
- package/lib/ProEnum/style/index.less +2 -2
- package/lib/ProForm/components/base/DatePicker/index.js +1 -1
- package/lib/ProForm/components/combination/Group/index.js +4 -7
- package/lib/ProForm/components/combination/Group/style/index.less +4 -4
- package/lib/ProForm/components/combination/Group/utils.d.ts +2 -0
- package/lib/ProForm/components/combination/Group/utils.js +11 -1
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +7 -1
- package/lib/ProForm/components/render/Render.js +2 -2
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -1
- package/lib/ProForm/components/render/RenderFields.js +2 -2
- package/lib/ProForm/index.js +4 -4
- package/lib/ProForm/propsType.d.ts +1 -1
- package/lib/ProForm/utils/{contrastOriginal.d.ts → diffOriginal.d.ts} +2 -1
- package/lib/ProForm/utils/diffOriginal.js +68 -0
- package/lib/ProForm/utils/index.d.ts +1 -1
- package/lib/ProForm/utils/index.js +2 -2
- package/lib/ProForm/utils/transformValue.js +1 -1
- package/lib/ProForm/utils/useChanged.js +4 -3
- package/lib/ProForm/utils/useListChanged.d.ts +1 -1
- package/lib/ProForm/utils/useListChanged.js +4 -3
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +58 -55
- package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
- package/lib/ProLayout/components/Layout/Menu/style/index.less +52 -56
- package/lib/ProLayout/components/ProCollapse/style/index.less +17 -9
- package/lib/ProLayout/components/ProFooter/index.js +1 -1
- package/lib/ProLayout/components/ProFooter/style/index.less +1 -1
- package/lib/ProLayout/components/ProHeader/style/index.less +4 -3
- package/lib/ProLayout/style/index.less +173 -87
- package/lib/ProTable/components/RenderColumn/index.d.ts +1 -1
- package/lib/ProTable/components/RenderColumn/index.js +3 -3
- package/lib/ProTable/propsType.d.ts +1 -1
- package/lib/ProTable/style/index.less +2 -2
- package/lib/ProTable/utils.js +9 -9
- package/lib/ProTabs/style/index.less +3 -1
- package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +2 -2
- package/lib/ProThemeTools/component/PrdTools/style/index.less +1 -1
- package/lib/ProThemeTools/index.js +19 -27
- package/lib/ProThemeTools/propsType.d.ts +1 -1
- package/lib/ProThemeTools/style/index.less +25 -8
- package/lib/ProTreeModal/style/index.less +2 -2
- package/lib/ProUpload/style/fileItem.less +2 -2
- package/lib/ProUpload/style/index.less +2 -2
- package/lib/assets/setting.svg +14 -0
- package/lib/style/components.less +0 -1
- package/lib/style/theme/antd.less +0 -1
- package/lib/style/theme/index.less +2 -2
- package/lib/style/theme/tokens.less +2 -2
- package/lib/tokens.js +2 -2
- package/package.json +1 -1
- package/es/ProForm/utils/contrastOriginal.js +0 -24
- package/lib/ProForm/utils/contrastOriginal.js +0 -30
|
@@ -17,7 +17,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
17
17
|
/* eslint-disable prefer-const */
|
|
18
18
|
import React, { useCallback, useEffect } from 'react';
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
-
import { cloneDeep, isEqual, debounce, omit, isFunction,
|
|
20
|
+
import { cloneDeep, isEqual, debounce, omit, isFunction, get } from 'lodash';
|
|
21
21
|
import valueTypeMap from '../../../ProForm/utils/valueType';
|
|
22
22
|
import transformMap from '../../utils/transform';
|
|
23
23
|
import { getNamePath, difference } from '../../utils/tools';
|
|
@@ -28,9 +28,8 @@ import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
|
|
|
28
28
|
import { useListChanged } from '../../../ProForm/utils/useListChanged';
|
|
29
29
|
import useRules from '../../../ProForm/utils/useRules';
|
|
30
30
|
import { isSelect } from '../../../ProForm/utils';
|
|
31
|
-
import locale from '../../../locale';
|
|
32
31
|
var RenderField = function RenderField(_ref) {
|
|
33
|
-
var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names,
|
|
32
|
+
var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4;
|
|
34
33
|
var value = _ref.text,
|
|
35
34
|
record = _ref.record,
|
|
36
35
|
index = _ref.index,
|
|
@@ -73,7 +72,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
73
72
|
virtualKey = config.virtualKey,
|
|
74
73
|
viewEmpty = config.viewEmpty,
|
|
75
74
|
originalValues = config.originalValues,
|
|
76
|
-
|
|
75
|
+
originalDiffTip = config.originalDiffTip;
|
|
77
76
|
var _fieldProps = fieldProps || formItemProps || {};
|
|
78
77
|
var _rules = rules || [];
|
|
79
78
|
var _required = required;
|
|
@@ -86,7 +85,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
86
85
|
type = ((_type = type) === null || _type === void 0 ? void 0 : (_type$replace = _type.replace) === null || _type$replace === void 0 ? void 0 : _type$replace.call(_type, type[0], type[0].toUpperCase())) || 'Input';
|
|
87
86
|
// 单行正在编辑时,临时生成一套formItem用来存储中间值,点击取消时候重置回上一次状态
|
|
88
87
|
var namePath = getNamePath(name, virtualKey);
|
|
89
|
-
var rowData = form.
|
|
88
|
+
var rowData = get(form.getFieldsValue(), [].concat(_toConsumableArray(namePath), [index])) || record || {};
|
|
90
89
|
var currentValue = dataIndex ? rowData === null || rowData === void 0 ? void 0 : rowData[dataIndex] : null;
|
|
91
90
|
// 第三个参数
|
|
92
91
|
var options = {
|
|
@@ -141,7 +140,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
141
140
|
var formItemChildProps = _objectSpread({}, _fieldProps);
|
|
142
141
|
// 允许formItem的属性放在column最外层
|
|
143
142
|
var _formItemProps = _objectSpread(_objectSpread({}, resetProps), internalRule);
|
|
144
|
-
if (['Switch', '
|
|
143
|
+
if (['Switch', 'SwitchCheckbox'].includes(type)) {
|
|
145
144
|
_formItemProps.valuePropName = 'checked';
|
|
146
145
|
valueType = 'switch';
|
|
147
146
|
}
|
|
@@ -241,8 +240,6 @@ var RenderField = function RenderField(_ref) {
|
|
|
241
240
|
TargetComponent = viewRender;
|
|
242
241
|
}
|
|
243
242
|
}
|
|
244
|
-
var defaultPlaceholder = ['Select', 'EnumSelect', 'DatePicker', 'RangePicker', 'Cascader', 'ProSelect', 'ProEnum', 'ProTimeLimit'].includes(type) ? "".concat(locale.ProEditTable.select).concat(isString(label) ? label || title : '') : "".concat(locale.ProEditTable.enter).concat(isString(label) ? label || title : '');
|
|
245
|
-
var _placeholder = (_formItemChildProps$p = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.placeholder) !== null && _formItemChildProps$p !== void 0 ? _formItemChildProps$p : defaultPlaceholder;
|
|
246
243
|
var onChange = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.onChange;
|
|
247
244
|
var onFieldChange = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.onFieldChange;
|
|
248
245
|
var onBlur = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.onBlur;
|
|
@@ -303,7 +300,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
303
300
|
}
|
|
304
301
|
_args = [].concat(args);
|
|
305
302
|
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
306
|
-
row = form.getFieldValue(rowPath);
|
|
303
|
+
row = form.getFieldValue(rowPath, true);
|
|
307
304
|
orgRow = cloneDeep(row);
|
|
308
305
|
if (!onFieldChange) {
|
|
309
306
|
_context.next = 18;
|
|
@@ -355,7 +352,9 @@ var RenderField = function RenderField(_ref) {
|
|
|
355
352
|
return [].concat(_toConsumableArray(rowPath), [key]);
|
|
356
353
|
});
|
|
357
354
|
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
|
358
|
-
|
|
355
|
+
setTimeout(function () {
|
|
356
|
+
form.validateFields(validateFieldKeys);
|
|
357
|
+
}, 100);
|
|
359
358
|
}
|
|
360
359
|
}
|
|
361
360
|
setState({
|
|
@@ -468,8 +467,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
468
467
|
originalValue = _useListChanged2[1];
|
|
469
468
|
var componentProps = _objectSpread(_objectSpread(_objectSpread({
|
|
470
469
|
form: form,
|
|
471
|
-
name: cellName
|
|
472
|
-
placeholder: _placeholder
|
|
470
|
+
name: cellName
|
|
473
471
|
}, _fieldProps), (_TargetComponent4 = TargetComponent) === null || _TargetComponent4 === void 0 ? void 0 : _TargetComponent4.props), {}, {
|
|
474
472
|
disabled: _disabled,
|
|
475
473
|
onChange: _onchange,
|
|
@@ -487,7 +485,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
487
485
|
if (isCell) {
|
|
488
486
|
record["".concat(dataIndex, "-Disabled")] = _disabled;
|
|
489
487
|
}
|
|
490
|
-
if (['Switch', '
|
|
488
|
+
if (['Switch', 'SwitchCheckbox'].includes(type)) {
|
|
491
489
|
_formItemProps.valuePropName = 'checked';
|
|
492
490
|
}
|
|
493
491
|
useEffect(function () {
|
|
@@ -507,7 +505,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
507
505
|
delete _formItemProps.rules;
|
|
508
506
|
}
|
|
509
507
|
var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
|
|
510
|
-
var originalTitle =
|
|
508
|
+
var originalTitle = originalDiffTip ? _jsxs(_Space, {
|
|
511
509
|
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, omit(componentProps, ['onFieldChange'])), {}, {
|
|
512
510
|
isView: true,
|
|
513
511
|
value: originalValue,
|
|
@@ -529,7 +527,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
529
527
|
});
|
|
530
528
|
return _jsx(FieldProvider, {
|
|
531
529
|
value: componentProps === null || componentProps === void 0 ? void 0 : componentProps.otherProps,
|
|
532
|
-
children: !
|
|
530
|
+
children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
|
|
533
531
|
title: originalTitle,
|
|
534
532
|
open: changed ? undefined : false,
|
|
535
533
|
children: FormItem
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import _ConfigProvider from "antd/es/config-provider";
|
|
|
10
10
|
import "antd/es/form/style";
|
|
11
11
|
import _Form from "antd/es/form";
|
|
12
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
|
-
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "
|
|
13
|
+
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey"];
|
|
14
14
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
16
16
|
import { get, isArray } from 'lodash';
|
|
@@ -49,7 +49,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
49
49
|
headerRender = _ref.headerRender,
|
|
50
50
|
pagination = _ref.pagination,
|
|
51
51
|
originalValues = _ref.originalValues,
|
|
52
|
-
|
|
52
|
+
originalDiffTip = _ref.originalDiffTip,
|
|
53
53
|
rowKey = _ref.rowKey,
|
|
54
54
|
resetProps = _objectWithoutProperties(_ref, _excluded);
|
|
55
55
|
// 上下文form
|
|
@@ -151,7 +151,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
151
151
|
tableLength: value === null || value === void 0 ? void 0 : value.length,
|
|
152
152
|
page: page,
|
|
153
153
|
originalValues: originalValues,
|
|
154
|
-
|
|
154
|
+
originalDiffTip: originalDiffTip,
|
|
155
155
|
prefixCls: prefixCls
|
|
156
156
|
};
|
|
157
157
|
// 编辑行设置下样式
|
|
@@ -130,7 +130,7 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
|
|
|
130
130
|
* @description 原始数据源,是否tooltip显示
|
|
131
131
|
* @default -
|
|
132
132
|
*/
|
|
133
|
-
|
|
133
|
+
originalDiffTip?: boolean;
|
|
134
134
|
/**
|
|
135
135
|
* @description 可编辑表格的类型,单行、多行、单元格编辑
|
|
136
136
|
* @default false
|
|
@@ -85,40 +85,54 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
85
85
|
index = tools.calc(firstIndex, '+', index);
|
|
86
86
|
rowName = [].concat(_toConsumableArray(virtualRowName), [index]);
|
|
87
87
|
if (!(type === 'save')) {
|
|
88
|
-
_context.next =
|
|
88
|
+
_context.next = 12;
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
|
-
_context.
|
|
91
|
+
_context.prev = 3;
|
|
92
|
+
_context.next = 6;
|
|
92
93
|
return customValidate(validateKeys, form, rowName);
|
|
93
|
-
case
|
|
94
|
+
case 6:
|
|
95
|
+
_context.next = 12;
|
|
96
|
+
break;
|
|
97
|
+
case 8:
|
|
98
|
+
_context.prev = 8;
|
|
99
|
+
_context.t0 = _context["catch"](3);
|
|
100
|
+
setTimeout(function () {
|
|
101
|
+
var errorDom = document.querySelector('.ant-form-item-has-error');
|
|
102
|
+
if (errorDom) {
|
|
103
|
+
errorDom.scrollIntoViewIfNeeded(true);
|
|
104
|
+
}
|
|
105
|
+
}, 0);
|
|
106
|
+
return _context.abrupt("return", Promise.reject(_context.t0));
|
|
107
|
+
case 12:
|
|
94
108
|
// 编辑状态使用自定义form值,非编辑状态直接使用行数据
|
|
95
109
|
_record = (_form$getFieldValue = form.getFieldValue(rowName)) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : record; // 新增事件可以设置初始默认值,当做函数的出参导出
|
|
96
110
|
onEvent = onClick || onHandle;
|
|
97
|
-
_context.next =
|
|
111
|
+
_context.next = 16;
|
|
98
112
|
return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, index, {
|
|
99
113
|
form: form,
|
|
100
114
|
namePath: virtualRowName
|
|
101
115
|
});
|
|
102
|
-
case
|
|
103
|
-
_context.
|
|
104
|
-
_context.
|
|
105
|
-
if (!_context.
|
|
106
|
-
_context.next =
|
|
116
|
+
case 16:
|
|
117
|
+
_context.t2 = _yield$onEvent = _context.sent;
|
|
118
|
+
_context.t1 = _context.t2 !== null;
|
|
119
|
+
if (!_context.t1) {
|
|
120
|
+
_context.next = 20;
|
|
107
121
|
break;
|
|
108
122
|
}
|
|
109
|
-
_context.
|
|
110
|
-
case
|
|
111
|
-
if (!_context.
|
|
112
|
-
_context.next =
|
|
123
|
+
_context.t1 = _yield$onEvent !== void 0;
|
|
124
|
+
case 20:
|
|
125
|
+
if (!_context.t1) {
|
|
126
|
+
_context.next = 24;
|
|
113
127
|
break;
|
|
114
128
|
}
|
|
115
|
-
_context.
|
|
116
|
-
_context.next =
|
|
129
|
+
_context.t3 = _yield$onEvent;
|
|
130
|
+
_context.next = 25;
|
|
117
131
|
break;
|
|
118
|
-
case
|
|
119
|
-
_context.
|
|
120
|
-
case
|
|
121
|
-
result = _context.
|
|
132
|
+
case 24:
|
|
133
|
+
_context.t3 = true;
|
|
134
|
+
case 25:
|
|
135
|
+
result = _context.t3;
|
|
122
136
|
if (result && type !== 'custom') {
|
|
123
137
|
actions[type](_objectSpread(_objectSpread({}, config), {}, {
|
|
124
138
|
rowName: [].concat(_toConsumableArray(name), [index]),
|
|
@@ -128,11 +142,11 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
128
142
|
validateKeys: validateKeys
|
|
129
143
|
}));
|
|
130
144
|
}
|
|
131
|
-
case
|
|
145
|
+
case 27:
|
|
132
146
|
case "end":
|
|
133
147
|
return _context.stop();
|
|
134
148
|
}
|
|
135
|
-
}, _callee);
|
|
149
|
+
}, _callee, null, [[3, 8]]);
|
|
136
150
|
}));
|
|
137
151
|
return function (_x, _x2) {
|
|
138
152
|
return _ref.apply(this, arguments);
|
|
@@ -280,7 +294,7 @@ export var transformColumns = function transformColumns() {
|
|
|
280
294
|
(_item$fieldProps3 = item.fieldProps) === null || _item$fieldProps3 === void 0 ? true : delete _item$fieldProps3.useRequest;
|
|
281
295
|
}
|
|
282
296
|
var _render = function _render(text, record, index) {
|
|
283
|
-
var isEditing = !virtualKey || editingKeys.includes(record.rowKey);
|
|
297
|
+
var isEditing = !virtualKey || editingKeys.includes(record.rowKey) || record.addFlag;
|
|
284
298
|
var namePath = isArray(name) ? name : [name];
|
|
285
299
|
if (virtualKey && editingKeys.includes(record.rowKey)) {
|
|
286
300
|
namePath = getNamePath(name, virtualKey);
|
|
@@ -6,7 +6,9 @@ export var getRandom = function getRandom() {
|
|
|
6
6
|
export var difference = function difference(object, base) {
|
|
7
7
|
var changes = function changes(object, base) {
|
|
8
8
|
return transform(object, function (result, value, key) {
|
|
9
|
-
if (
|
|
9
|
+
if (key.indexOf('-') > -1) {
|
|
10
|
+
result[key] = true;
|
|
11
|
+
} else if (!isEqual(value, base[key])) {
|
|
10
12
|
result[key] = isObject(value) && isObject(base[key]) ? changes(value, base[key]) : value;
|
|
11
13
|
}
|
|
12
14
|
});
|
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
display: flex;
|
|
39
39
|
align-items: center;
|
|
40
40
|
justify-content: center;
|
|
41
|
-
|
|
42
|
-
padding: var(--zaui-space-size-sm) var(--zaui-space-border);
|
|
41
|
+
padding: 6px var(--zaui-space-border);
|
|
43
42
|
line-height: 18px;
|
|
44
43
|
background-color: #f1f3f6ff;
|
|
45
44
|
border: 1px solid transparent;
|
|
@@ -73,6 +72,7 @@
|
|
|
73
72
|
.pro-enum-group-item-selected {
|
|
74
73
|
color: var(--zaui-brand);
|
|
75
74
|
border: 1px solid var(--zaui-brand);
|
|
75
|
+
background: #fff;
|
|
76
76
|
&::after {
|
|
77
77
|
background: transparent;
|
|
78
78
|
}
|
|
@@ -5,7 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
6
|
var _excluded = ["className", "format"];
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { isFunction, isString } from 'lodash';
|
|
8
|
+
import { isFunction, isString, isObject } from 'lodash';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
@@ -30,7 +30,7 @@ var DatePicker = function DatePicker(props) {
|
|
|
30
30
|
var viewChildren = null;
|
|
31
31
|
if (!value) {
|
|
32
32
|
viewChildren = null;
|
|
33
|
-
} else if (typeof format === 'string' &&
|
|
33
|
+
} else if (typeof format === 'string' && isObject(value)) {
|
|
34
34
|
viewChildren = value.format(format);
|
|
35
35
|
} else if (isFunction(format)) {
|
|
36
36
|
viewChildren = format(value);
|
|
@@ -4,14 +4,13 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
4
4
|
import "antd/es/button/style";
|
|
5
5
|
import _Button from "antd/es/button";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
8
|
import { useMemo } from 'react';
|
|
10
9
|
import { omit, isFunction } from 'lodash';
|
|
11
|
-
import { useDeepCompareEffect
|
|
10
|
+
import { useDeepCompareEffect } from 'ahooks';
|
|
12
11
|
import classnames from 'classnames';
|
|
13
12
|
import RenderFields from '../../render/RenderFields';
|
|
14
|
-
import { insertSeparator } from './utils';
|
|
13
|
+
import { insertSeparator, transformNamesString } from './utils';
|
|
15
14
|
import ProForm from '../../../../ProForm';
|
|
16
15
|
var Group = function Group(props) {
|
|
17
16
|
var columns = props.children,
|
|
@@ -24,10 +23,6 @@ var Group = function Group(props) {
|
|
|
24
23
|
id = props.id,
|
|
25
24
|
value = props.value,
|
|
26
25
|
onFieldChange = props.onFieldChange;
|
|
27
|
-
var _useCounter = useCounter(0),
|
|
28
|
-
_useCounter2 = _slicedToArray(_useCounter, 2),
|
|
29
|
-
num = _useCounter2[0],
|
|
30
|
-
inc = _useCounter2[1].inc;
|
|
31
26
|
var _ref = ProForm.useFieldProps() || {},
|
|
32
27
|
names = _ref.names,
|
|
33
28
|
name = _ref.name,
|
|
@@ -65,13 +60,15 @@ var Group = function Group(props) {
|
|
|
65
60
|
})
|
|
66
61
|
}, "".concat(className), className));
|
|
67
62
|
useDeepCompareEffect(function () {
|
|
63
|
+
var _document, _document$activeEleme;
|
|
64
|
+
// 焦点激活的表单
|
|
65
|
+
var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
|
|
68
66
|
// 模拟change,初始化不执行onFieldChange
|
|
69
|
-
if (isFunction(onFieldChange) &&
|
|
67
|
+
if (isFunction(onFieldChange) && form.isFieldsTouched(names) && transformNamesString(names).includes(touchName)) {
|
|
70
68
|
onFieldChange(value, form.getFieldsValue(), {
|
|
71
69
|
form: form
|
|
72
70
|
});
|
|
73
71
|
}
|
|
74
|
-
inc();
|
|
75
72
|
}, [value]);
|
|
76
73
|
return _jsx("div", {
|
|
77
74
|
className: _className,
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.start-radius() {
|
|
12
|
-
border-start-start-radius:
|
|
13
|
-
border-end-start-radius:
|
|
12
|
+
border-start-start-radius: 4px;
|
|
13
|
+
border-end-start-radius: 4px;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.end-radius() {
|
|
17
|
-
border-start-end-radius:
|
|
18
|
-
border-end-end-radius:
|
|
17
|
+
border-start-end-radius: 4px;
|
|
18
|
+
border-end-end-radius: 4px;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.pro-group {
|
|
@@ -6,3 +6,5 @@ import { SpaceType } from './propsType';
|
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
8
|
export declare const insertSeparator: (columns: any, space?: SpaceType, separatorNode?: ReactNode, otherProps?: any) => any;
|
|
9
|
+
/** 转换names */
|
|
10
|
+
export declare const transformNamesString: (arr: (string | string[])[]) => (string | string[])[];
|
|
@@ -33,4 +33,14 @@ export var insertSeparator = function insertSeparator(columns, space, separatorN
|
|
|
33
33
|
}
|
|
34
34
|
return result;
|
|
35
35
|
}, []);
|
|
36
|
+
};
|
|
37
|
+
/** 转换names */
|
|
38
|
+
export var transformNamesString = function transformNamesString(arr) {
|
|
39
|
+
var result = arr.map(function (subArr) {
|
|
40
|
+
if (Array.isArray(subArr)) {
|
|
41
|
+
return subArr.join('_');
|
|
42
|
+
}
|
|
43
|
+
return subArr;
|
|
44
|
+
});
|
|
45
|
+
return result;
|
|
36
46
|
};
|
|
@@ -11,7 +11,7 @@ var _excluded = ["format", "disabled", "foreverTime", "foreverText", "valueType"
|
|
|
11
11
|
_excluded2 = ["mode"];
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import { omit } from 'lodash';
|
|
14
|
+
import { omit, isObject } from 'lodash';
|
|
15
15
|
import moment from 'moment';
|
|
16
16
|
import { useMemo } from 'react';
|
|
17
17
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
@@ -53,7 +53,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
53
53
|
onChange = _useControlled2[1];
|
|
54
54
|
var initialConfig = useProConfig('ProTimeLimit');
|
|
55
55
|
var isForever = useMemo(function () {
|
|
56
|
-
if (
|
|
56
|
+
if (isObject(value)) {
|
|
57
57
|
return foreverMoment.format(format) === value.format(format);
|
|
58
58
|
}
|
|
59
59
|
return false;
|
|
@@ -73,6 +73,12 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
73
73
|
children: foreverText
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
if (isObject(value)) {
|
|
77
|
+
return _jsx(Container, {
|
|
78
|
+
viewEmpty: viewEmpty,
|
|
79
|
+
children: value.format(format)
|
|
80
|
+
});
|
|
81
|
+
}
|
|
76
82
|
return _jsx(Container, {
|
|
77
83
|
viewEmpty: viewEmpty,
|
|
78
84
|
children: props.value
|
|
@@ -52,7 +52,7 @@ var Render = function Render(props) {
|
|
|
52
52
|
originalValues = props.originalValues,
|
|
53
53
|
equalWith = props.equalWith,
|
|
54
54
|
requiredOnView = props.requiredOnView,
|
|
55
|
-
|
|
55
|
+
originalDiffTip = props.originalDiffTip,
|
|
56
56
|
confirm = props.confirm,
|
|
57
57
|
globalControl = props.globalControl;
|
|
58
58
|
var colProps = props.colProps;
|
|
@@ -434,7 +434,7 @@ var Render = function Render(props) {
|
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
436
|
// 不渲染tooltip
|
|
437
|
-
if (!
|
|
437
|
+
if (!originalDiffTip || ['FormList', 'ProEditTable'].includes(type)) {
|
|
438
438
|
return formItem;
|
|
439
439
|
}
|
|
440
440
|
var title = _jsxs(_Space, {
|
|
@@ -17,7 +17,7 @@ interface Props<T = any> {
|
|
|
17
17
|
clearNotShow?: boolean;
|
|
18
18
|
requiredOnView?: boolean;
|
|
19
19
|
required?: boolean | (() => boolean);
|
|
20
|
-
|
|
20
|
+
originalDiffTip?: boolean;
|
|
21
21
|
globalControl?: boolean;
|
|
22
22
|
}
|
|
23
23
|
declare const RenderFields: React.FC<Props>;
|
|
@@ -25,7 +25,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
25
25
|
outerClearNotShow = props.clearNotShow,
|
|
26
26
|
requiredOnView = props.requiredOnView,
|
|
27
27
|
required = props.required,
|
|
28
|
-
|
|
28
|
+
originalDiffTip = props.originalDiffTip,
|
|
29
29
|
globalControl = props.globalControl;
|
|
30
30
|
// 是否包含隐藏字段
|
|
31
31
|
var hiddenData = columns.filter(function (item) {
|
|
@@ -205,7 +205,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
205
205
|
originalValues: originalValues,
|
|
206
206
|
equalWith: equalWith,
|
|
207
207
|
requiredOnView: requiredOnView,
|
|
208
|
-
|
|
208
|
+
originalDiffTip: originalDiffTip,
|
|
209
209
|
globalControl: globalControl
|
|
210
210
|
})
|
|
211
211
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
package/es/ProForm/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import _Space from "antd/es/space";
|
|
|
12
12
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
13
13
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
14
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
15
|
-
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "
|
|
15
|
+
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl"];
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
|
18
18
|
import classnames from 'classnames';
|
|
@@ -63,8 +63,8 @@ var ProForm = function ProForm(props, ref) {
|
|
|
63
63
|
requiredOnView = _props$requiredOnView === void 0 ? true : _props$requiredOnView,
|
|
64
64
|
formId = props.formId,
|
|
65
65
|
required = props.required,
|
|
66
|
-
_props$
|
|
67
|
-
|
|
66
|
+
_props$originalDiffTi = props.originalDiffTip,
|
|
67
|
+
originalDiffTip = _props$originalDiffTi === void 0 ? true : _props$originalDiffTi,
|
|
68
68
|
formKey = props.formKey,
|
|
69
69
|
globalControl = props.globalControl,
|
|
70
70
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
@@ -254,7 +254,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
254
254
|
clearNotShow: clearNotShow,
|
|
255
255
|
requiredOnView: requiredOnView,
|
|
256
256
|
required: required,
|
|
257
|
-
|
|
257
|
+
originalDiffTip: originalDiffTip,
|
|
258
258
|
globalControl: globalControl
|
|
259
259
|
}), children, footerRender()]
|
|
260
260
|
}))
|
|
@@ -69,7 +69,7 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
|
69
69
|
requiredOnView?: boolean;
|
|
70
70
|
formId?: string;
|
|
71
71
|
required?: boolean;
|
|
72
|
-
|
|
72
|
+
originalDiffTip?: boolean;
|
|
73
73
|
}
|
|
74
74
|
export interface Transform<T = any> {
|
|
75
75
|
normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
|
|
@@ -3,7 +3,8 @@ interface Params {
|
|
|
3
3
|
originalValue: any;
|
|
4
4
|
value: any;
|
|
5
5
|
form: FormInstance;
|
|
6
|
+
name?: string | any[];
|
|
6
7
|
equalWith?: (originalValue: any, currentValue: any) => boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare const
|
|
9
|
+
export declare const diffOriginal: (params: Params) => boolean;
|
|
9
10
|
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
+
import { isEqual, isFunction } from 'lodash';
|
|
3
|
+
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
4
|
+
var extractValue = function extractValue(obj, path) {
|
|
5
|
+
var value = obj || {};
|
|
6
|
+
if (!Object.keys(obj)) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
var _iterator = _createForOfIteratorHelper(path),
|
|
10
|
+
_step;
|
|
11
|
+
try {
|
|
12
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
13
|
+
var key = _step.value;
|
|
14
|
+
if (value && value.hasOwnProperty(key)) {
|
|
15
|
+
value = value[key];
|
|
16
|
+
} else {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
} catch (err) {
|
|
21
|
+
_iterator.e(err);
|
|
22
|
+
} finally {
|
|
23
|
+
_iterator.f();
|
|
24
|
+
}
|
|
25
|
+
return Object.values(value);
|
|
26
|
+
};
|
|
27
|
+
/** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
|
|
28
|
+
var extractValues = function extractValues(data, pathString) {
|
|
29
|
+
if (pathString.includes('_')) {
|
|
30
|
+
var namePrefixes = pathString.split('-')[0].split('_').slice(0, -1);
|
|
31
|
+
return extractValue(data, namePrefixes);
|
|
32
|
+
}
|
|
33
|
+
return pathString.split('-').map(function (item) {
|
|
34
|
+
return data[item];
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export var diffOriginal = function diffOriginal(params) {
|
|
38
|
+
var originalValue = params.originalValue,
|
|
39
|
+
_value = params.value,
|
|
40
|
+
equalWith = params.equalWith,
|
|
41
|
+
form = params.form,
|
|
42
|
+
name = params.name;
|
|
43
|
+
var value = !(name === null || name === void 0 ? void 0 : name.includes('-')) ? _value : extractValues(form.getFieldsValue(), name);
|
|
44
|
+
// 支持传入自定义比较事件
|
|
45
|
+
if (isFunction(equalWith)) {
|
|
46
|
+
return !equalWith(originalValue, value);
|
|
47
|
+
}
|
|
48
|
+
if (Array.isArray(originalValue)) {
|
|
49
|
+
return originalValue.some(function (valueItem, index) {
|
|
50
|
+
// 如果两个值有一个不是空值, 则进行深比较
|
|
51
|
+
if (!nullValue.includes(value === null || value === void 0 ? void 0 : value[index]) || !nullValue.includes(valueItem)) {
|
|
52
|
+
return !isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
58
|
+
return !isEqual(value, originalValue);
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
};
|
|
@@ -26,7 +26,7 @@ export declare const isTrim: (type: string, trim: boolean, configData: any) => a
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const isUpperCase: (type: string, upperCase: boolean) => any;
|
|
28
28
|
export declare const weedOutProps: (data: Record<string, any>, keys: string[]) => {}[];
|
|
29
|
-
export declare const
|
|
29
|
+
export declare const diffField: (prevValues: any, curValues: any, names: NamePath[]) => boolean;
|
|
30
30
|
export declare const splitNameStr: (name: string) => NamePath[];
|
|
31
31
|
export declare const filterInternalFields: (values: any) => any;
|
|
32
32
|
export declare const getAllNamePath: (object: Record<string, any>, currentPath?: InternalNamePath) => InternalNamePath[];
|
|
@@ -108,7 +108,7 @@ export var weedOutProps = function weedOutProps(data, keys) {
|
|
|
108
108
|
return [obj, weedOut];
|
|
109
109
|
};
|
|
110
110
|
// 对比字段变化
|
|
111
|
-
export var
|
|
111
|
+
export var diffField = function diffField(prevValues, curValues, names) {
|
|
112
112
|
return names.some(function (name) {
|
|
113
113
|
return _.get(prevValues, name) !== _.get(curValues, name);
|
|
114
114
|
});
|
|
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["value"];
|
|
4
4
|
import { set } from 'lodash';
|
|
5
|
-
import {
|
|
5
|
+
import { diffField } from '../utils';
|
|
6
6
|
export var transformValue = function transformValue(names, form, fieldName, _normalize, _getValueProps) {
|
|
7
7
|
return {
|
|
8
8
|
normalize: function normalize(value) {
|
|
@@ -41,7 +41,7 @@ export var transformValue = function transformValue(names, form, fieldName, _nor
|
|
|
41
41
|
}, cusRest);
|
|
42
42
|
},
|
|
43
43
|
shouldUpdate: function shouldUpdate(prevValues, curValues) {
|
|
44
|
-
return
|
|
44
|
+
return diffField(prevValues, curValues, names);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
};
|