@zat-design/sisyphus-react 3.6.10 → 3.6.11
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 +52 -54
- package/dist/less.esm.css +52 -54
- package/es/ProEditTable/components/RenderField/ListChanged.d.ts +16 -0
- package/es/ProEditTable/components/RenderField/ListChanged.js +124 -0
- package/es/ProEditTable/components/RenderField/index.js +27 -46
- package/es/ProEditTable/style/index.less +2 -1
- package/es/ProEditTable/utils/index.d.ts +1 -1
- package/es/ProEditTable/utils/index.js +19 -13
- package/es/ProEditTable/utils/tools.d.ts +6 -0
- package/es/ProEditTable/utils/tools.js +15 -2
- package/es/ProForm/components/combination/ProCascader/index.js +8 -14
- package/es/ProForm/components/render/Changed.d.ts +14 -0
- package/es/ProForm/components/render/Changed.js +64 -0
- package/es/ProForm/components/render/Render.js +17 -37
- package/es/ProForm/style/index.less +52 -52
- package/es/ProForm/utils/diffOriginal.d.ts +0 -1
- package/es/ProForm/utils/diffOriginal.js +4 -27
- package/es/ProForm/utils/useChanged.js +1 -2
- package/es/ProForm/utils/useListChanged.js +3 -3
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +3 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +108 -41
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +14 -1
- package/es/ProTable/index.js +6 -2
- package/es/ProTable/propsType.d.ts +22 -0
- package/es/ProTable/style/index.less +27 -32
- package/es/ProThemeTools/component/{PrdTools → ProTools}/index.d.ts +2 -2
- package/es/ProThemeTools/component/{PrdTools → ProTools}/index.js +2 -2
- package/es/ProThemeTools/component/index.d.ts +1 -2
- package/es/ProThemeTools/component/index.js +1 -2
- package/es/ProThemeTools/index.js +2 -2
- package/es/ProThemeTools/style/index.less +1 -1
- package/es/ProTreeModal/components/List.js +30 -4
- package/lib/ProEditTable/components/RenderField/ListChanged.d.ts +16 -0
- package/lib/ProEditTable/components/RenderField/ListChanged.js +129 -0
- package/lib/ProEditTable/components/RenderField/index.js +26 -41
- package/lib/ProEditTable/style/index.less +2 -1
- package/lib/ProEditTable/utils/index.d.ts +1 -1
- package/lib/ProEditTable/utils/index.js +17 -11
- package/lib/ProEditTable/utils/tools.d.ts +6 -0
- package/lib/ProEditTable/utils/tools.js +15 -1
- package/lib/ProForm/components/combination/ProCascader/index.js +6 -12
- package/lib/ProForm/components/render/Changed.d.ts +14 -0
- package/lib/ProForm/components/render/Changed.js +69 -0
- package/lib/ProForm/components/render/Render.js +17 -35
- package/lib/ProForm/style/index.less +52 -52
- package/lib/ProForm/utils/diffOriginal.d.ts +0 -1
- package/lib/ProForm/utils/diffOriginal.js +3 -27
- package/lib/ProForm/utils/useChanged.js +1 -2
- package/lib/ProForm/utils/useListChanged.js +2 -2
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +3 -1
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +108 -41
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +13 -1
- package/lib/ProTable/index.js +6 -2
- package/lib/ProTable/propsType.d.ts +22 -0
- package/lib/ProTable/style/index.less +27 -32
- package/lib/ProThemeTools/component/{PrdTools → ProTools}/index.d.ts +2 -2
- package/lib/ProThemeTools/component/{PrdTools → ProTools}/index.js +2 -2
- package/lib/ProThemeTools/component/index.d.ts +1 -2
- package/lib/ProThemeTools/component/index.js +3 -3
- package/lib/ProThemeTools/index.js +1 -1
- package/lib/ProThemeTools/style/index.less +1 -1
- package/lib/ProTreeModal/components/List.js +30 -4
- package/package.json +1 -1
- /package/es/ProThemeTools/component/{PrdTools → ProTools}/style/index.less +0 -0
- /package/lib/ProThemeTools/component/{PrdTools → ProTools}/style/index.less +0 -0
|
@@ -13,28 +13,33 @@ var _excluded = ["type", "label", "show", "needConfirm", "onHandle", "onClick"],
|
|
|
13
13
|
_excluded2 = ["title", "icon"];
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
import React from 'react';
|
|
16
|
-
import { cloneDeep, isArray, isBoolean, isEqual } from 'lodash';
|
|
16
|
+
import { cloneDeep, cloneDeepWith, isArray, isBoolean, isEqual } from 'lodash';
|
|
17
17
|
import classnames from 'classnames';
|
|
18
18
|
import { ReactSVG } from 'react-svg';
|
|
19
19
|
import { tools } from '@zat-design/utils';
|
|
20
20
|
import { actions, defaultBtnNameMap, defaultSingleActionKeys, defaultMultipleActionKeys, defaultEditingActionKeys } from './config';
|
|
21
|
-
import { customValidate, getNamePath, splitNames, handleScrollToError } from './tools';
|
|
21
|
+
import { customValidate, getNamePath, splitNames, handleScrollToError, cloneDeepFilterNode } from './tools';
|
|
22
22
|
import ProTooltip from '../../ProTooltip';
|
|
23
23
|
import { RenderField, ActionButton } from '../components';
|
|
24
24
|
import tipSvg from '../../assets/tip.svg';
|
|
25
25
|
import locale from '../../locale';
|
|
26
26
|
// 渲染操作栏
|
|
27
27
|
var getActionColumn = function getActionColumn(config) {
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
var _cloneDeepWith = cloneDeepWith(config, function (value) {
|
|
29
|
+
if ( /*#__PURE__*/React.isValidElement(value)) {
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
disabled = _cloneDeepWith.disabled,
|
|
34
|
+
name = _cloneDeepWith.name,
|
|
35
|
+
form = _cloneDeepWith.form,
|
|
36
|
+
virtualKey = _cloneDeepWith.virtualKey,
|
|
37
|
+
validateKeys = _cloneDeepWith.validateKeys,
|
|
38
|
+
actionWidth = _cloneDeepWith.actionWidth,
|
|
39
|
+
actionProps = _cloneDeepWith.actionProps,
|
|
40
|
+
page = _cloneDeepWith.page,
|
|
41
|
+
rowDisabled = _cloneDeepWith.rowDisabled,
|
|
42
|
+
actionDirection = _cloneDeepWith.actionDirection;
|
|
38
43
|
var pageNum = tools.calc(page.pageNum, '-', 1);
|
|
39
44
|
var firstIndex = tools.calc(pageNum, '*', page.pageSize);
|
|
40
45
|
// actionProps配置为false 默认不插入
|
|
@@ -195,7 +200,8 @@ export var transformColumns = function transformColumns() {
|
|
|
195
200
|
setState = config.setState,
|
|
196
201
|
page = config.page;
|
|
197
202
|
var isCell = mode === 'cell';
|
|
198
|
-
var _columns =
|
|
203
|
+
var _columns = cloneDeepFilterNode(columns);
|
|
204
|
+
// 你的函数代码
|
|
199
205
|
var _cacheMap = _objectSpread({}, cacheMap.current);
|
|
200
206
|
var pageNum = tools.calc(page.pageNum, '-', 1);
|
|
201
207
|
var firstIndex = tools.calc(pageNum, '*', page.pageSize);
|
|
@@ -29,3 +29,9 @@ export declare const getDisabled: ({ globalControl, formDisabled, column, tabled
|
|
|
29
29
|
/** 表格自动滚动到报错位置
|
|
30
30
|
*/
|
|
31
31
|
export declare const handleScrollToError: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* 深copy一个对象,并过滤掉其中的React节点
|
|
34
|
+
* @param value 需要深拷贝的对象
|
|
35
|
+
* @returns 深拷贝后的对象,其中的React节点会被保留
|
|
36
|
+
*/
|
|
37
|
+
export declare function cloneDeepFilterNode(value: any): any;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { cloneDeep, cloneDeepWith, isString, isObject, isEqual, transform, isFunction, isBoolean } from 'lodash';
|
|
3
4
|
export var getRandom = function getRandom() {
|
|
4
5
|
return Math.random().toString(36).slice(-6);
|
|
5
6
|
};
|
|
@@ -182,4 +183,16 @@ export var handleScrollToError = function handleScrollToError() {
|
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
}, 0);
|
|
185
|
-
};
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* 深copy一个对象,并过滤掉其中的React节点
|
|
189
|
+
* @param value 需要深拷贝的对象
|
|
190
|
+
* @returns 深拷贝后的对象,其中的React节点会被保留
|
|
191
|
+
*/
|
|
192
|
+
export function cloneDeepFilterNode(value) {
|
|
193
|
+
return cloneDeepWith(value, function (val) {
|
|
194
|
+
if ( /*#__PURE__*/React.isValidElement(val)) {
|
|
195
|
+
return val;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "antd/es/input/style";
|
|
2
2
|
import _Input from "antd/es/input";
|
|
3
|
-
import "antd/es/cascader/style";
|
|
4
|
-
import _Cascader from "antd/es/cascader";
|
|
5
3
|
import "antd/es/tooltip/style";
|
|
6
4
|
import _Tooltip from "antd/es/tooltip";
|
|
5
|
+
import "antd/es/cascader/style";
|
|
6
|
+
import _Cascader from "antd/es/cascader";
|
|
7
7
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
8
8
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
9
9
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
@@ -22,6 +22,7 @@ import { useProConfig } from '../../../../ProConfigProvider';
|
|
|
22
22
|
import useEnum from '../../../../ProEnum/hooks/useEnum';
|
|
23
23
|
import locale from '../../../../locale';
|
|
24
24
|
import ProForm from '../../..';
|
|
25
|
+
import Container from '../../Container';
|
|
25
26
|
var Text = _Typography.Text;
|
|
26
27
|
var defaultFieldNames = {
|
|
27
28
|
label: 'name',
|
|
@@ -82,7 +83,8 @@ var ProCascader = function ProCascader(props) {
|
|
|
82
83
|
detailPlaceholder = props.detailPlaceholder,
|
|
83
84
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
84
85
|
var _ref3 = ProForm.useFieldProps() || {},
|
|
85
|
-
isViewCon = _ref3.isView
|
|
86
|
+
isViewCon = _ref3.isView,
|
|
87
|
+
viewEmpty = _ref3.viewEmpty;
|
|
86
88
|
var addressCode = code || enumCode;
|
|
87
89
|
var realIsView = typeof isView === 'boolean' ? isView : isViewCon;
|
|
88
90
|
var realLevel = Math.max(2, level);
|
|
@@ -238,17 +240,9 @@ var ProCascader = function ProCascader(props) {
|
|
|
238
240
|
}
|
|
239
241
|
}
|
|
240
242
|
};
|
|
241
|
-
return realIsView ?
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
children: _jsx(Text, {
|
|
245
|
-
ellipsis: {
|
|
246
|
-
tooltip: false
|
|
247
|
-
},
|
|
248
|
-
children: viewValue
|
|
249
|
-
})
|
|
250
|
-
}) : _jsx("span", {
|
|
251
|
-
className: className,
|
|
243
|
+
return realIsView ? _jsx(Container, {
|
|
244
|
+
tooltip: !!tooltip,
|
|
245
|
+
viewEmpty: viewEmpty,
|
|
252
246
|
children: viewValue
|
|
253
247
|
}) : _jsxs("div", {
|
|
254
248
|
className: "pro-address ".concat(className),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
|
+
import { NamePath } from 'antd/lib/form/interface';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
interface Props {
|
|
5
|
+
name?: NamePath;
|
|
6
|
+
names?: NamePath[];
|
|
7
|
+
namesStr?: string;
|
|
8
|
+
originalValues?: any;
|
|
9
|
+
form: FormInstance;
|
|
10
|
+
equalWith?: (preValue: any, curValue: any) => boolean | undefined;
|
|
11
|
+
[name: string]: any;
|
|
12
|
+
}
|
|
13
|
+
declare const Changed: React.FC<Props>;
|
|
14
|
+
export default Changed;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import "antd/es/space/style";
|
|
2
|
+
import _Space from "antd/es/space";
|
|
3
|
+
import "antd/es/tooltip/style";
|
|
4
|
+
import _Tooltip from "antd/es/tooltip";
|
|
5
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
+
var _excluded = ["name", "names", "namesStr", "originalValues", "form", "equalWith", "children", "type", "originalDiffTip"];
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { get } from 'lodash';
|
|
10
|
+
import React, { useMemo } from 'react';
|
|
11
|
+
import { diffOriginal } from '../../utils/diffOriginal';
|
|
12
|
+
var Changed = function Changed(props) {
|
|
13
|
+
var name = props.name,
|
|
14
|
+
names = props.names,
|
|
15
|
+
namesStr = props.namesStr,
|
|
16
|
+
originalValues = props.originalValues,
|
|
17
|
+
form = props.form,
|
|
18
|
+
equalWith = props.equalWith,
|
|
19
|
+
children = props.children,
|
|
20
|
+
type = props.type,
|
|
21
|
+
originalDiffTip = props.originalDiffTip,
|
|
22
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
23
|
+
// 不渲染tooltip
|
|
24
|
+
var notWatch = !originalDiffTip || ['FormList', 'ProEditTable'].includes(type);
|
|
25
|
+
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
|
26
|
+
return get(originalValues, name);
|
|
27
|
+
}) : get(originalValues, name);
|
|
28
|
+
var noChange = !equalWith && (!originalValues || originalValue === undefined);
|
|
29
|
+
var changed = useMemo(function () {
|
|
30
|
+
if (notWatch || noChange) return false;
|
|
31
|
+
return diffOriginal({
|
|
32
|
+
originalValue: originalValue,
|
|
33
|
+
value: props.value,
|
|
34
|
+
form: form,
|
|
35
|
+
equalWith: equalWith
|
|
36
|
+
// name: namesStr || name,
|
|
37
|
+
});
|
|
38
|
+
}, [notWatch, noChange, props.value, originalValue]);
|
|
39
|
+
var tipContent = useMemo(function () {
|
|
40
|
+
if (notWatch || noChange) return undefined;
|
|
41
|
+
return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, {
|
|
42
|
+
isView: true,
|
|
43
|
+
value: originalValue,
|
|
44
|
+
checked: type === 'Switch' ? originalValue : undefined
|
|
45
|
+
})) : undefined;
|
|
46
|
+
}, [originalValue, children]);
|
|
47
|
+
if (notWatch || noChange) {
|
|
48
|
+
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
|
|
49
|
+
}
|
|
50
|
+
return _jsx(_Tooltip, {
|
|
51
|
+
open: changed ? undefined : false,
|
|
52
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
53
|
+
return target.parentElement;
|
|
54
|
+
},
|
|
55
|
+
title: _jsxs(_Space, {
|
|
56
|
+
children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
|
|
57
|
+
}),
|
|
58
|
+
children: _jsx("div", {
|
|
59
|
+
className: changed ? 'pro-form-item-changed' : '',
|
|
60
|
+
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
export default Changed;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import "antd/es/col/style";
|
|
2
2
|
import _Col from "antd/es/col";
|
|
3
|
-
import "antd/es/tooltip/style";
|
|
4
|
-
import _Tooltip from "antd/es/tooltip";
|
|
5
3
|
import "antd/es/space/style";
|
|
6
4
|
import _Space from "antd/es/space";
|
|
7
5
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
@@ -13,7 +11,6 @@ import "antd/es/form/style";
|
|
|
13
11
|
import _Form from "antd/es/form";
|
|
14
12
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
15
13
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
16
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
17
14
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
18
15
|
var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className", "rules", "required", "labelRequired", "tooltip"];
|
|
19
16
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -28,10 +25,10 @@ import { isTrim, isUpperCase, findOptionByValue, parseNamePath } from '../../uti
|
|
|
28
25
|
import { useProConfig } from '../../../ProConfigProvider';
|
|
29
26
|
import transformNames from '../../utils/transformNames';
|
|
30
27
|
import valueTypeMap from '../../utils/valueType';
|
|
31
|
-
import { useChanged } from '../../utils/useChanged';
|
|
32
28
|
import tipSvg from '../../../assets/tip.svg';
|
|
33
29
|
import useRules from '../../utils/useRules';
|
|
34
30
|
import ConfirmWrapper from './ConfirmWrapper';
|
|
31
|
+
import Changed from './Changed';
|
|
35
32
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
36
33
|
var Render = function Render(props) {
|
|
37
34
|
var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
|
|
@@ -101,18 +98,6 @@ var Render = function Render(props) {
|
|
|
101
98
|
return Array.isArray(name) ? name.join('_') : name;
|
|
102
99
|
}).join('-');
|
|
103
100
|
}, [otherProps === null || otherProps === void 0 ? void 0 : otherProps.names]);
|
|
104
|
-
// 判断当前字段是否变更
|
|
105
|
-
var _useChanged = useChanged({
|
|
106
|
-
name: formItemProps.name,
|
|
107
|
-
names: otherProps.names,
|
|
108
|
-
namesStr: namesStr,
|
|
109
|
-
originalValues: originalValues,
|
|
110
|
-
form: form,
|
|
111
|
-
equalWith: equalWith
|
|
112
|
-
}),
|
|
113
|
-
_useChanged2 = _slicedToArray(_useChanged, 2),
|
|
114
|
-
changed = _useChanged2[0],
|
|
115
|
-
originalValue = _useChanged2[1];
|
|
116
101
|
var internalRule = useRules({
|
|
117
102
|
names: otherProps.names,
|
|
118
103
|
label: otherFormItemProps.label,
|
|
@@ -184,7 +169,7 @@ var Render = function Render(props) {
|
|
|
184
169
|
var lastComponentProps = _objectSpread(_objectSpread(_objectSpread({}, componentProps), _fieldProps), {}, {
|
|
185
170
|
disabled: lastDisabled
|
|
186
171
|
});
|
|
187
|
-
var _className = classNames(_defineProperty(_defineProperty(
|
|
172
|
+
var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-width-auto', ['Switch'].includes(type)));
|
|
188
173
|
if (formItemProps.hidden === true || _show === false) {
|
|
189
174
|
// 为了监听shouldUpdate 必须存在一个FormItem, 空Input解决 【[antd: Form.Item] `name` is only used for validate React element】
|
|
190
175
|
return _jsx(_Form.Item, {
|
|
@@ -442,6 +427,20 @@ var Render = function Render(props) {
|
|
|
442
427
|
span: 24 // 默认占一行
|
|
443
428
|
});
|
|
444
429
|
}
|
|
430
|
+
if (originalValues) {
|
|
431
|
+
child = _jsx(Changed, {
|
|
432
|
+
name: formItemProps.name,
|
|
433
|
+
names: otherProps.names,
|
|
434
|
+
namesStr: namesStr,
|
|
435
|
+
originalValues: originalValues,
|
|
436
|
+
form: form,
|
|
437
|
+
equalWith: equalWith,
|
|
438
|
+
originalDiffTip: originalDiffTip,
|
|
439
|
+
type: type,
|
|
440
|
+
onChange: handleChange,
|
|
441
|
+
children: child
|
|
442
|
+
});
|
|
443
|
+
}
|
|
445
444
|
var orgFormItem = _jsx(_Form.Item, _objectSpread(_objectSpread({}, omit(_otherFormItemProps, filterFormItemKey)), {}, {
|
|
446
445
|
// @ts-ignore
|
|
447
446
|
_internalItemRender: internalItemRender,
|
|
@@ -468,26 +467,7 @@ var Render = function Render(props) {
|
|
|
468
467
|
})
|
|
469
468
|
});
|
|
470
469
|
}
|
|
471
|
-
|
|
472
|
-
if (!originalDiffTip || ['FormList', 'ProEditTable'].includes(type)) {
|
|
473
|
-
return formItem;
|
|
474
|
-
}
|
|
475
|
-
var title = _jsxs(_Space, {
|
|
476
|
-
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child), {}, {
|
|
477
|
-
isView: true,
|
|
478
|
-
value: originalValue,
|
|
479
|
-
checked: type === 'Switch' ? originalValue : undefined
|
|
480
|
-
}))]
|
|
481
|
-
});
|
|
482
|
-
return _jsx(_Tooltip, {
|
|
483
|
-
title: title,
|
|
484
|
-
open: changed ? undefined : false,
|
|
485
|
-
// open={true}
|
|
486
|
-
getPopupContainer: function getPopupContainer(target) {
|
|
487
|
-
return target.parentElement;
|
|
488
|
-
},
|
|
489
|
-
children: formItem
|
|
490
|
-
});
|
|
470
|
+
return formItem;
|
|
491
471
|
};
|
|
492
472
|
var FormItem = _jsxs(_Fragment, {
|
|
493
473
|
children: [renderItem(), (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$names2 = otherProps.names) === null || _otherProps$names2 === void 0 ? void 0 : _otherProps$names2.length) ? otherProps.names.map(function (name) {
|
|
@@ -116,58 +116,6 @@
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
// 比较原始值场景下 不同时的样式
|
|
120
|
-
&.pro-form-item-changed {
|
|
121
|
-
span.@{ant-prefix}-input-affix-wrapper,
|
|
122
|
-
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
|
123
|
-
.@{ant-prefix}-picker,
|
|
124
|
-
.@{ant-prefix}-input-number {
|
|
125
|
-
background: @zaui-contract-bg !important;
|
|
126
|
-
|
|
127
|
-
input {
|
|
128
|
-
background: transparent;
|
|
129
|
-
}
|
|
130
|
-
.@{ant-prefix}-select-selection-placeholder {
|
|
131
|
-
z-index: 9;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
|
|
136
|
-
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
|
|
137
|
-
background: @zaui-contract-bg;
|
|
138
|
-
border-radius: 4px;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// 地址组件
|
|
142
|
-
.@{ant-prefix}-form-item-control-input-content {
|
|
143
|
-
// 查看模式
|
|
144
|
-
& > span {
|
|
145
|
-
border-radius: 4px;
|
|
146
|
-
padding: 5px 8px;
|
|
147
|
-
background: @zaui-contract-bg;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
& > .pro-address {
|
|
151
|
-
.@{ant-prefix}-select-selector,
|
|
152
|
-
.@{ant-prefix}-input-affix-wrapper,
|
|
153
|
-
.@{ant-prefix}-input-disabled {
|
|
154
|
-
background: @zaui-contract-bg;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
& > .@{ant-prefix}-input-group {
|
|
158
|
-
.forever-checkbox {
|
|
159
|
-
background: @zaui-contract-bg;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.pro-form-view-container {
|
|
165
|
-
padding: 4px 8px;
|
|
166
|
-
background: @zaui-contract-bg;
|
|
167
|
-
border-radius: 4px;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
119
|
.@{ant-prefix}-row {
|
|
172
120
|
width: 100%;
|
|
173
121
|
}
|
|
@@ -373,4 +321,56 @@
|
|
|
373
321
|
}
|
|
374
322
|
}
|
|
375
323
|
}
|
|
324
|
+
|
|
325
|
+
// 比较原始值场景下 不同时的样式
|
|
326
|
+
.pro-form-item-changed {
|
|
327
|
+
span.@{ant-prefix}-input-affix-wrapper,
|
|
328
|
+
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
|
329
|
+
.@{ant-prefix}-picker,
|
|
330
|
+
.@{ant-prefix}-input-number {
|
|
331
|
+
background: @zaui-contract-bg !important;
|
|
332
|
+
|
|
333
|
+
input {
|
|
334
|
+
background: transparent !important;
|
|
335
|
+
}
|
|
336
|
+
.@{ant-prefix}-select-selection-placeholder {
|
|
337
|
+
z-index: 9;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
|
|
342
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
|
|
343
|
+
background: @zaui-contract-bg;
|
|
344
|
+
border-radius: 4px;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// 地址组件
|
|
348
|
+
.@{ant-prefix}-form-item-control-input-content {
|
|
349
|
+
// 查看模式
|
|
350
|
+
& > span {
|
|
351
|
+
border-radius: 4px;
|
|
352
|
+
padding: 5px 8px;
|
|
353
|
+
background: @zaui-contract-bg;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
& > .pro-address {
|
|
357
|
+
.@{ant-prefix}-select-selector,
|
|
358
|
+
.@{ant-prefix}-input-affix-wrapper,
|
|
359
|
+
.@{ant-prefix}-input-disabled {
|
|
360
|
+
background: @zaui-contract-bg;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
& > .@{ant-prefix}-input-group {
|
|
364
|
+
.forever-checkbox {
|
|
365
|
+
background: @zaui-contract-bg;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.pro-form-view-container {
|
|
371
|
+
padding: 4px 8px;
|
|
372
|
+
background: @zaui-contract-bg;
|
|
373
|
+
border-radius: 4px;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
376
|
}
|
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isEqual, isFunction, isString } from 'lodash';
|
|
1
|
+
import { isEqual, isFunction } from 'lodash';
|
|
3
2
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
4
|
-
/** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
|
|
5
|
-
var extractValues = function extractValues(form, pathString) {
|
|
6
|
-
var _pathString;
|
|
7
|
-
var result = [];
|
|
8
|
-
var PrefixesName = isString(pathString) ? [] : pathString.slice(0, -1);
|
|
9
|
-
if (isString(pathString)) {
|
|
10
|
-
pathString.split('-').forEach(function (item) {
|
|
11
|
-
result.push(form.getFieldValue([].concat(_toConsumableArray(PrefixesName), [item])));
|
|
12
|
-
});
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
15
|
-
(_pathString = pathString[pathString.length - 1]) === null || _pathString === void 0 ? void 0 : _pathString.split('-').forEach(function (item) {
|
|
16
|
-
result.push(form.getFieldValue([].concat(_toConsumableArray(PrefixesName), [item])));
|
|
17
|
-
});
|
|
18
|
-
return result;
|
|
19
|
-
};
|
|
20
3
|
export var diffOriginal = function diffOriginal(params) {
|
|
21
|
-
var _name$join;
|
|
22
4
|
var originalValue = params.originalValue,
|
|
23
|
-
|
|
24
|
-
equalWith = params.equalWith
|
|
25
|
-
form = params.form,
|
|
26
|
-
name = params.name;
|
|
27
|
-
var isNames = Array.isArray(name) && ((_name$join = name.join(',')) === null || _name$join === void 0 ? void 0 : _name$join.includes('-')) || (name === null || name === void 0 ? void 0 : name.includes('-'));
|
|
28
|
-
var value = !isNames ? _value : extractValues(form, name);
|
|
5
|
+
value = params.value,
|
|
6
|
+
equalWith = params.equalWith;
|
|
29
7
|
// 支持传入自定义比较事件
|
|
30
8
|
if (isFunction(equalWith)) {
|
|
31
9
|
return !equalWith(originalValue, value);
|
|
@@ -40,8 +18,7 @@ export var diffOriginal = function diffOriginal(params) {
|
|
|
40
18
|
});
|
|
41
19
|
}
|
|
42
20
|
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
43
|
-
|
|
44
|
-
return res;
|
|
21
|
+
return !isEqual(value, originalValue);
|
|
45
22
|
}
|
|
46
23
|
return false;
|
|
47
24
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "antd/es/form/style";
|
|
2
2
|
import _Form from "antd/es/form";
|
|
3
|
-
import { get
|
|
3
|
+
import { get } from 'lodash';
|
|
4
4
|
import { diffOriginal } from './diffOriginal';
|
|
5
5
|
var toNamePath = function toNamePath(name) {
|
|
6
6
|
if (Array.isArray(name)) {
|
|
@@ -86,8 +86,8 @@ export var useListChanged = function useListChanged(params) {
|
|
|
86
86
|
value: value,
|
|
87
87
|
originalValue: originalValue,
|
|
88
88
|
form: form,
|
|
89
|
-
equalWith: equalWith
|
|
90
|
-
name: isString(namesStr) ? namesStr : originalName || name
|
|
89
|
+
equalWith: equalWith
|
|
90
|
+
// name: isString(namesStr) ? namesStr : originalName || name,
|
|
91
91
|
});
|
|
92
92
|
return [changed, originalValue];
|
|
93
93
|
};
|
package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts
CHANGED
|
@@ -5,12 +5,14 @@ interface RowProps extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const Row: FC<RowProps>;
|
|
8
|
-
declare const DndWrapper: ({ draggable, value, onChange, disabled, children, rowKey }: {
|
|
8
|
+
declare const DndWrapper: ({ draggable, value, onChange, disabled, children, rowKey, onDragStartGuard, onDragEndGuard, }: {
|
|
9
9
|
draggable: any;
|
|
10
10
|
value: any;
|
|
11
11
|
onChange: any;
|
|
12
12
|
disabled: any;
|
|
13
13
|
children: any;
|
|
14
14
|
rowKey: any;
|
|
15
|
+
onDragStartGuard: any;
|
|
16
|
+
onDragEndGuard: any;
|
|
15
17
|
}) => any;
|
|
16
18
|
export default DndWrapper;
|