@zat-design/sisyphus-react 3.7.3-beta.1 → 3.7.3-beta.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 +79 -0
- package/dist/less.esm.css +76 -0
- package/es/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts} +4 -3
- package/es/ProEditTable/components/RenderField/{ListChanged.js → ListChangedWrapper.js} +22 -10
- package/es/ProEditTable/components/RenderField/index.js +2 -2
- package/es/ProEnum/index.js +5 -4
- package/es/ProEnum/style/index.less +12 -4
- package/es/ProEnum/utils/index.d.ts +1 -1
- package/es/ProEnum/utils/index.js +4 -0
- package/es/ProForm/components/combination/Container/index.js +5 -3
- package/es/ProForm/components/combination/Container/propsType.d.ts +2 -1
- package/es/ProForm/components/combination/ProNumberRange/index.js +3 -1
- package/es/ProForm/components/render/ChangedWrapper.d.ts +16 -0
- package/es/ProForm/components/render/{Changed.js → ChangedWrapper.js} +43 -15
- package/es/ProForm/components/render/Render.js +7 -8
- package/es/ProForm/components/render/RenderFields.d.ts +2 -3
- package/es/ProForm/components/render/RenderFields.js +3 -4
- package/es/ProForm/components/render/propsType.d.ts +4 -3
- package/es/ProForm/index.js +3 -6
- package/es/ProForm/propsType.d.ts +12 -2
- package/es/ProForm/style/index.less +102 -4
- package/es/ProForm/utils/diffOriginal.d.ts +4 -4
- package/es/ProForm/utils/diffOriginal.js +18 -7
- package/es/ProStep/components/Listener/index.d.ts +1 -1
- package/es/ProStep/components/Listener/index.js +5 -2
- package/es/ProStep/index.d.ts +1 -1
- package/es/ProStep/index.js +24 -17
- package/es/ProTree/components/ProTreeSelect/style/index.less +2 -2
- package/es/style/theme/antd.less +5 -0
- package/es/style/theme/index.less +1 -0
- package/es/style/theme/tokens.less +1 -0
- package/es/utils/index.d.ts +2 -0
- package/es/utils/index.js +13 -0
- package/lib/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts} +4 -3
- package/lib/ProEditTable/components/RenderField/{ListChanged.js → ListChangedWrapper.js} +25 -11
- package/lib/ProEditTable/components/RenderField/index.js +2 -2
- package/lib/ProEnum/index.js +5 -4
- package/lib/ProEnum/style/index.less +12 -4
- package/lib/ProEnum/utils/index.d.ts +1 -1
- package/lib/ProEnum/utils/index.js +4 -0
- package/lib/ProForm/components/combination/Container/index.js +5 -3
- package/lib/ProForm/components/combination/Container/propsType.d.ts +2 -1
- package/lib/ProForm/components/combination/ProNumberRange/index.js +3 -1
- package/lib/ProForm/components/render/ChangedWrapper.d.ts +16 -0
- package/lib/ProForm/components/render/{Changed.js → ChangedWrapper.js} +43 -15
- package/lib/ProForm/components/render/Render.js +7 -8
- package/lib/ProForm/components/render/RenderFields.d.ts +2 -3
- package/lib/ProForm/components/render/RenderFields.js +3 -4
- package/lib/ProForm/components/render/propsType.d.ts +4 -3
- package/lib/ProForm/index.js +3 -6
- package/lib/ProForm/propsType.d.ts +12 -2
- package/lib/ProForm/style/index.less +102 -4
- package/lib/ProForm/utils/diffOriginal.d.ts +4 -4
- package/lib/ProForm/utils/diffOriginal.js +18 -7
- package/lib/ProStep/components/Listener/index.d.ts +1 -1
- package/lib/ProStep/components/Listener/index.js +5 -2
- package/lib/ProStep/index.d.ts +1 -1
- package/lib/ProStep/index.js +24 -17
- package/lib/ProTree/components/ProTreeSelect/style/index.less +2 -2
- package/lib/style/theme/antd.less +5 -0
- package/lib/style/theme/index.less +1 -0
- package/lib/style/theme/tokens.less +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +19 -0
- package/package.json +2 -1
- package/es/ProForm/components/render/Changed.d.ts +0 -14
- package/lib/ProForm/components/render/Changed.d.ts +0 -14
- /package/es/ProForm/utils/{useChanged.d.ts → _useChanged.d.ts} +0 -0
- /package/es/ProForm/utils/{useChanged.js → _useChanged.js} +0 -0
- /package/es/ProForm/utils/{useListChanged.d.ts → _useListChanged.d.ts} +0 -0
- /package/es/ProForm/utils/{useListChanged.js → _useListChanged.js} +0 -0
- /package/lib/ProForm/utils/{useChanged.d.ts → _useChanged.d.ts} +0 -0
- /package/lib/ProForm/utils/{useChanged.js → _useChanged.js} +0 -0
- /package/lib/ProForm/utils/{useListChanged.d.ts → _useListChanged.d.ts} +0 -0
- /package/lib/ProForm/utils/{useListChanged.js → _useListChanged.js} +0 -0
|
@@ -28,7 +28,7 @@ import valueTypeMap from '../../utils/valueType';
|
|
|
28
28
|
import tipSvg from '../../../assets/tip.svg';
|
|
29
29
|
import useRules from '../../utils/useRules';
|
|
30
30
|
import ConfirmWrapper from './ConfirmWrapper';
|
|
31
|
-
import
|
|
31
|
+
import ChangedWrapper from './ChangedWrapper';
|
|
32
32
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
33
33
|
var Render = function Render(props) {
|
|
34
34
|
var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
|
|
@@ -46,12 +46,11 @@ var Render = function Render(props) {
|
|
|
46
46
|
formDisabled = props.formDisabled,
|
|
47
47
|
type = props.type,
|
|
48
48
|
isSelect = props.isSelect,
|
|
49
|
-
originalValues = props.originalValues,
|
|
50
49
|
equalWith = props.equalWith,
|
|
51
50
|
requiredOnView = props.requiredOnView,
|
|
52
|
-
originalDiffTip = props.originalDiffTip,
|
|
53
51
|
confirm = props.confirm,
|
|
54
|
-
globalControl = props.globalControl
|
|
52
|
+
globalControl = props.globalControl,
|
|
53
|
+
diffConfig = props.diffConfig;
|
|
55
54
|
var colProps = props.colProps;
|
|
56
55
|
// 剔除一些不是FormItem的属性, 防止控制台报warning
|
|
57
56
|
var labelWidth = formItemProps.labelWidth,
|
|
@@ -427,17 +426,17 @@ var Render = function Render(props) {
|
|
|
427
426
|
span: 24 // 默认占一行
|
|
428
427
|
});
|
|
429
428
|
}
|
|
430
|
-
if (
|
|
431
|
-
child = _jsx(
|
|
429
|
+
if (diffConfig) {
|
|
430
|
+
child = _jsx(ChangedWrapper, {
|
|
432
431
|
name: formItemProps.name,
|
|
433
432
|
names: otherProps.names,
|
|
434
433
|
namesStr: namesStr,
|
|
435
|
-
|
|
434
|
+
diffConfig: diffConfig,
|
|
436
435
|
form: form,
|
|
437
436
|
equalWith: equalWith,
|
|
438
|
-
originalDiffTip: originalDiffTip,
|
|
439
437
|
type: type,
|
|
440
438
|
onChange: handleChange,
|
|
439
|
+
valuePropName: _otherFormItemProps.valuePropName,
|
|
441
440
|
children: child
|
|
442
441
|
});
|
|
443
442
|
}
|
|
@@ -2,7 +2,7 @@ import { ColProps } from 'antd';
|
|
|
2
2
|
import { FormInstance } from 'antd/es/form/Form';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ProColumnProps } from './propsType';
|
|
5
|
-
import {
|
|
5
|
+
import { DiffConfigProps } from '../../propsType';
|
|
6
6
|
interface Props<T = any> {
|
|
7
7
|
isView?: boolean;
|
|
8
8
|
columns: ProColumnProps[];
|
|
@@ -13,11 +13,10 @@ interface Props<T = any> {
|
|
|
13
13
|
viewEmpty?: React.ReactNode;
|
|
14
14
|
openState?: boolean;
|
|
15
15
|
labelWidth?: string | number;
|
|
16
|
-
|
|
16
|
+
diffConfig?: DiffConfigProps;
|
|
17
17
|
clearNotShow?: boolean;
|
|
18
18
|
requiredOnView?: boolean;
|
|
19
19
|
required?: boolean | boolean[] | (() => boolean | boolean[]);
|
|
20
|
-
originalDiffTip?: boolean;
|
|
21
20
|
globalControl?: boolean;
|
|
22
21
|
}
|
|
23
22
|
declare const RenderFields: React.FC<Props>;
|
|
@@ -22,11 +22,10 @@ var RenderFields = function RenderFields(props) {
|
|
|
22
22
|
viewEmpty = _props$viewEmpty === void 0 ? '-' : _props$viewEmpty,
|
|
23
23
|
openState = props.openState,
|
|
24
24
|
labelWidth = props.labelWidth,
|
|
25
|
-
originalValues = props.originalValues,
|
|
26
25
|
outerClearNotShow = props.clearNotShow,
|
|
27
26
|
requiredOnView = props.requiredOnView,
|
|
28
27
|
required = props.required,
|
|
29
|
-
|
|
28
|
+
diffConfig = props.diffConfig,
|
|
30
29
|
globalControl = props.globalControl;
|
|
31
30
|
// 是否包含隐藏字段
|
|
32
31
|
var hiddenData = columns.filter(function (item) {
|
|
@@ -154,6 +153,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
154
153
|
if (['ProCollapse', 'Container'].includes(_type)) {
|
|
155
154
|
componentProps.show = show;
|
|
156
155
|
componentProps.clearNotShow = clearNotShow;
|
|
156
|
+
componentProps.diffConfig = diffConfig;
|
|
157
157
|
}
|
|
158
158
|
// switch与SwitchCheckbox单独添加valuePropName
|
|
159
159
|
if (['Switch', 'SwitchCheckbox'].includes(_type)) {
|
|
@@ -206,10 +206,9 @@ var RenderFields = function RenderFields(props) {
|
|
|
206
206
|
otherProps: otherProps,
|
|
207
207
|
fieldProps: isFunction(fieldProps) ? fieldProps : null,
|
|
208
208
|
isSelect: _isSelect,
|
|
209
|
-
|
|
209
|
+
diffConfig: diffConfig,
|
|
210
210
|
equalWith: equalWith,
|
|
211
211
|
requiredOnView: requiredOnView,
|
|
212
|
-
originalDiffTip: originalDiffTip,
|
|
213
212
|
globalControl: globalControl
|
|
214
213
|
})
|
|
215
214
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
|
@@ -30,7 +30,8 @@ import { ProUploadProps } from '../../../ProUpload/propsType';
|
|
|
30
30
|
import { ProTreeProps } from '../../../ProTree/propsType';
|
|
31
31
|
import { GroupProps as GroupCopyProps } from '../combination/Group/propsType';
|
|
32
32
|
import { ProCollapseProps } from '../../../ProLayout/components/ProCollapse/PropTypes';
|
|
33
|
-
import { DistributiveOmit } from '../../propsType';
|
|
33
|
+
import { DistributiveOmit, DiffConfigProps } from '../../propsType';
|
|
34
|
+
import { DiffOriginalParams } from '../../utils/diffOriginal';
|
|
34
35
|
export type ComponentMap = keyof typeof componentMap;
|
|
35
36
|
type ValidateKey = keyof typeof validate;
|
|
36
37
|
type RegExpKey = keyof typeof regExp;
|
|
@@ -201,7 +202,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
201
202
|
upperCase?: boolean;
|
|
202
203
|
hiddenNames?: string[] | any[];
|
|
203
204
|
rules?: ProRule[] | ReactiveFunction<Values, ProRule[]>;
|
|
204
|
-
equalWith?:
|
|
205
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
205
206
|
required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
|
|
206
207
|
labelRequired?: boolean;
|
|
207
208
|
toISOString?: boolean;
|
|
@@ -267,7 +268,7 @@ export interface RenderProps<Values = any> {
|
|
|
267
268
|
form: FormInstance<Values>;
|
|
268
269
|
fieldProps?: ReactiveFunction<Values, React.ReactNode>;
|
|
269
270
|
isSelect: boolean;
|
|
270
|
-
|
|
271
|
+
diffConfig: DiffConfigProps;
|
|
271
272
|
requiredOnView?: boolean;
|
|
272
273
|
confirm?: ProFormColumnProps['confirm'];
|
|
273
274
|
globalControl?: boolean;
|
package/es/ProForm/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import _Space from "antd/es/space";
|
|
|
11
11
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
12
12
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
14
|
-
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", "
|
|
14
|
+
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", "diffConfig", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "formKey", "globalControl", "scrollToError", "optimize"];
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
|
17
17
|
import classnames from 'classnames';
|
|
@@ -53,7 +53,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
53
53
|
labelWidth = props.labelWidth,
|
|
54
54
|
onValuesChange = props.onValuesChange,
|
|
55
55
|
onFinish = props.onFinish,
|
|
56
|
-
|
|
56
|
+
diffConfig = props.diffConfig,
|
|
57
57
|
submitOnEnter = props.submitOnEnter,
|
|
58
58
|
_props$clearNotShow = props.clearNotShow,
|
|
59
59
|
clearNotShow = _props$clearNotShow === void 0 ? true : _props$clearNotShow,
|
|
@@ -62,8 +62,6 @@ var ProForm = function ProForm(props, ref) {
|
|
|
62
62
|
requiredOnView = _props$requiredOnView === void 0 ? true : _props$requiredOnView,
|
|
63
63
|
formId = props.formId,
|
|
64
64
|
required = props.required,
|
|
65
|
-
_props$originalDiffTi = props.originalDiffTip,
|
|
66
|
-
originalDiffTip = _props$originalDiffTi === void 0 ? true : _props$originalDiffTi,
|
|
67
65
|
formKey = props.formKey,
|
|
68
66
|
globalControl = props.globalControl,
|
|
69
67
|
_props$scrollToError = props.scrollToError,
|
|
@@ -261,11 +259,10 @@ var ProForm = function ProForm(props, ref) {
|
|
|
261
259
|
colProps: colProps,
|
|
262
260
|
viewEmpty: viewEmpty,
|
|
263
261
|
labelWidth: labelWidth,
|
|
264
|
-
|
|
262
|
+
diffConfig: diffConfig,
|
|
265
263
|
clearNotShow: clearNotShow,
|
|
266
264
|
requiredOnView: requiredOnView,
|
|
267
265
|
required: required,
|
|
268
|
-
originalDiffTip: originalDiffTip,
|
|
269
266
|
globalControl: globalControl
|
|
270
267
|
}), footerRender()]
|
|
271
268
|
})), children]
|
|
@@ -45,6 +45,16 @@ export interface ProFormOtherProps {
|
|
|
45
45
|
globalControl?: boolean;
|
|
46
46
|
formDisabled?: boolean;
|
|
47
47
|
}
|
|
48
|
+
export interface DiffConfigProps<Values = any> {
|
|
49
|
+
/** 比对原始数据源 */
|
|
50
|
+
originalValues: Values;
|
|
51
|
+
/** 是否显示对比值气泡 */
|
|
52
|
+
toolTip?: boolean;
|
|
53
|
+
/** 变更提示颜色 */
|
|
54
|
+
changeTipColor?: string;
|
|
55
|
+
/** 新增提示颜色 */
|
|
56
|
+
addTipColor?: string;
|
|
57
|
+
}
|
|
48
58
|
export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
49
59
|
disabled?: boolean;
|
|
50
60
|
/** 全局控制优先 */
|
|
@@ -67,14 +77,14 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
|
67
77
|
viewEmpty?: React.ReactNode | string;
|
|
68
78
|
confirmLoading?: boolean;
|
|
69
79
|
labelWidth?: string | number;
|
|
70
|
-
originalValues?: Values;
|
|
71
80
|
/** 是否回车提交 */
|
|
72
81
|
submitOnEnter?: boolean;
|
|
73
82
|
clearNotShow?: boolean;
|
|
74
83
|
requiredOnView?: boolean;
|
|
75
84
|
formId?: string;
|
|
76
85
|
required?: boolean | boolean[];
|
|
77
|
-
|
|
86
|
+
/** 表单比对配置 */
|
|
87
|
+
diffConfig?: DiffConfigProps;
|
|
78
88
|
scrollToError?: boolean;
|
|
79
89
|
/** 性能模式,谨慎使用,默认不开启
|
|
80
90
|
* 1. 开启不过滤names的中间态值
|
|
@@ -99,10 +99,12 @@
|
|
|
99
99
|
|
|
100
100
|
&.pro-form-item-width-auto {
|
|
101
101
|
.@{ant-prefix}-form-item-control-input {
|
|
102
|
+
width: 100%;
|
|
102
103
|
flex-grow: inherit;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
.@{ant-prefix}-form-item-control-input-content {
|
|
107
|
+
width: 100%;
|
|
106
108
|
flex: initial;
|
|
107
109
|
}
|
|
108
110
|
}
|
|
@@ -314,16 +316,23 @@
|
|
|
314
316
|
vertical-align: middle;
|
|
315
317
|
}
|
|
316
318
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
319
|
+
|
|
320
|
+
.pro-form-list-mode-block {
|
|
321
|
+
.pro-collapse-content {
|
|
322
|
+
.@{ant-prefix}-row {
|
|
320
323
|
width: auto;
|
|
321
324
|
}
|
|
322
325
|
}
|
|
323
326
|
}
|
|
324
327
|
|
|
325
|
-
// 比较原始值场景下 不同时的样式
|
|
326
328
|
.pro-form-item-changed {
|
|
329
|
+
border-radius: 4px;
|
|
330
|
+
background: @zaui-contract-bg !important;
|
|
331
|
+
|
|
332
|
+
.@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
|
|
333
|
+
background: @zaui-contract-bg !important;
|
|
334
|
+
}
|
|
335
|
+
|
|
327
336
|
span.@{ant-prefix}-input-affix-wrapper,
|
|
328
337
|
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
|
329
338
|
.@{ant-prefix}-picker,
|
|
@@ -367,10 +376,99 @@
|
|
|
367
376
|
}
|
|
368
377
|
}
|
|
369
378
|
|
|
379
|
+
// checkbox
|
|
380
|
+
.@{ant-prefix}-checkbox-group {
|
|
381
|
+
padding: 5px 0
|
|
382
|
+
}
|
|
383
|
+
// switch
|
|
384
|
+
&:has(.@{ant-prefix}-switch) {
|
|
385
|
+
padding: 5px 0;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// textArea
|
|
389
|
+
.@{ant-prefix}-input-textarea > textarea {
|
|
390
|
+
background: @zaui-contract-bg;
|
|
391
|
+
}
|
|
392
|
+
|
|
370
393
|
.pro-form-view-container {
|
|
371
394
|
padding: 4px 8px;
|
|
372
395
|
background: @zaui-contract-bg;
|
|
373
396
|
border-radius: 4px;
|
|
374
397
|
}
|
|
375
398
|
}
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
// 比较原始值场景下 不同时的样式
|
|
402
|
+
.pro-form-item-add {
|
|
403
|
+
border-radius: 4px;
|
|
404
|
+
background: @zaui-contract-bg-add !important;
|
|
405
|
+
|
|
406
|
+
.@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
|
|
407
|
+
background: @zaui-contract-bg-add !important;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
span.@{ant-prefix}-input-affix-wrapper,
|
|
411
|
+
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
|
412
|
+
.@{ant-prefix}-picker,
|
|
413
|
+
.@{ant-prefix}-input-number {
|
|
414
|
+
background: @zaui-contract-bg-add !important;
|
|
415
|
+
|
|
416
|
+
input {
|
|
417
|
+
background: transparent !important;
|
|
418
|
+
}
|
|
419
|
+
.@{ant-prefix}-select-selection-placeholder {
|
|
420
|
+
z-index: 9;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
|
|
425
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
|
|
426
|
+
background: @zaui-contract-bg-add;
|
|
427
|
+
border-radius: 4px;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// 地址组件
|
|
431
|
+
.@{ant-prefix}-form-item-control-input-content {
|
|
432
|
+
// 查看模式
|
|
433
|
+
& > span {
|
|
434
|
+
border-radius: 4px;
|
|
435
|
+
padding: 5px 8px;
|
|
436
|
+
background: @zaui-contract-bg-add;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
& > .pro-address {
|
|
440
|
+
.@{ant-prefix}-select-selector,
|
|
441
|
+
.@{ant-prefix}-input-affix-wrapper,
|
|
442
|
+
.@{ant-prefix}-input-disabled {
|
|
443
|
+
background: @zaui-contract-bg-add;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
& > .@{ant-prefix}-input-group {
|
|
447
|
+
.forever-checkbox {
|
|
448
|
+
background: @zaui-contract-bg-add;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// checkbox
|
|
454
|
+
.@{ant-prefix}-checkbox-group {
|
|
455
|
+
padding: 5px 0
|
|
456
|
+
}
|
|
457
|
+
// switch
|
|
458
|
+
&:has(.@{ant-prefix}-switch) {
|
|
459
|
+
padding: 5px 0;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// textArea
|
|
463
|
+
.@{ant-prefix}-input-textarea > textarea {
|
|
464
|
+
background: @zaui-contract-bg-add;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
.pro-form-view-container {
|
|
469
|
+
padding: 4px 8px;
|
|
470
|
+
background: @zaui-contract-bg-add;
|
|
471
|
+
border-radius: 4px;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
376
474
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
|
-
interface
|
|
2
|
+
export interface DiffOriginalParams {
|
|
3
3
|
originalValue: any;
|
|
4
4
|
value: any;
|
|
5
5
|
form: FormInstance;
|
|
6
|
-
equalWith?: (originalValue: any, currentValue: any) => boolean;
|
|
6
|
+
equalWith?: (originalValue: any, currentValue: any) => DiffType | boolean | undefined;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type DiffType = 'same' | 'add' | 'changed';
|
|
9
|
+
export declare const diffOriginal: (params: DiffOriginalParams) => DiffType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isEqual, isFunction } from 'lodash';
|
|
2
|
+
import { isEmpty } from '../../utils';
|
|
2
3
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
3
4
|
export var diffOriginal = function diffOriginal(params) {
|
|
4
5
|
var originalValue = params.originalValue,
|
|
@@ -6,19 +7,29 @@ export var diffOriginal = function diffOriginal(params) {
|
|
|
6
7
|
equalWith = params.equalWith;
|
|
7
8
|
// 支持传入自定义比较事件
|
|
8
9
|
if (isFunction(equalWith)) {
|
|
9
|
-
|
|
10
|
+
var diffRes = equalWith(originalValue, value);
|
|
11
|
+
if (diffRes === undefined) return 'same';
|
|
12
|
+
if (typeof diffRes === 'boolean') {
|
|
13
|
+
return diffRes ? 'same' : 'changed';
|
|
14
|
+
}
|
|
15
|
+
return diffRes;
|
|
16
|
+
}
|
|
17
|
+
// 如果原始值为空 且当前有值的话 认为变更类型是新增
|
|
18
|
+
if (isEmpty(originalValue) && !isEmpty(value)) {
|
|
19
|
+
return 'add';
|
|
10
20
|
}
|
|
11
21
|
if (Array.isArray(originalValue)) {
|
|
12
|
-
|
|
22
|
+
var isSame = originalValue.every(function (valueItem, index) {
|
|
13
23
|
// 如果两个值有一个不是空值, 则进行深比较
|
|
14
|
-
if (!
|
|
15
|
-
return
|
|
24
|
+
if (!isEmpty(value === null || value === void 0 ? void 0 : value[index]) || !isEmpty(valueItem)) {
|
|
25
|
+
return isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
|
16
26
|
}
|
|
17
|
-
return
|
|
27
|
+
return true;
|
|
18
28
|
});
|
|
29
|
+
return isSame ? 'same' : 'changed';
|
|
19
30
|
}
|
|
20
31
|
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
21
|
-
return
|
|
32
|
+
return isEqual(value, originalValue) ? 'same' : 'changed';
|
|
22
33
|
}
|
|
23
|
-
return
|
|
34
|
+
return 'same';
|
|
24
35
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const _default: ({ children, delayTime, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
2
|
+
declare const _default: ({ children, delayTime, excludes, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
3
3
|
export default _default;
|
|
@@ -2,13 +2,14 @@ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["children", "delayTime"];
|
|
5
|
+
var _excluded = ["children", "delayTime", "excludes"];
|
|
6
6
|
import { throttle } from 'lodash';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { useStep } from '../../index';
|
|
9
9
|
export default (function (_ref) {
|
|
10
10
|
var children = _ref.children,
|
|
11
11
|
delayTime = _ref.delayTime,
|
|
12
|
+
excludes = _ref.excludes,
|
|
12
13
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
14
|
var _useStep = useStep(),
|
|
14
15
|
notify = _useStep.notify;
|
|
@@ -20,7 +21,9 @@ export default (function (_ref) {
|
|
|
20
21
|
case 0:
|
|
21
22
|
localStorage.setItem('cache-pro-step', '');
|
|
22
23
|
_context.next = 3;
|
|
23
|
-
return notify === null || notify === void 0 ? void 0 : notify(
|
|
24
|
+
return notify === null || notify === void 0 ? void 0 : notify({
|
|
25
|
+
excludes: excludes
|
|
26
|
+
});
|
|
24
27
|
case 3:
|
|
25
28
|
values = _context.sent;
|
|
26
29
|
setTimeout(function () {
|
package/es/ProStep/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ declare const ProStep: {
|
|
|
7
7
|
({ children, ...resetProps }: ProStepPropsType): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
useStep: () => any;
|
|
9
9
|
Item: ({ id, title, collapse: collapseItem, children, ...restProps }: import("./propsType").ProStepItem) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
Listener: ({ children, delayTime, ...props }: any) => import("react").DetailedReactHTMLElement<any, HTMLElement>;
|
|
10
|
+
Listener: ({ children, delayTime, excludes, ...props }: any) => import("react").DetailedReactHTMLElement<any, HTMLElement>;
|
|
11
11
|
};
|
|
12
12
|
export default ProStep;
|
package/es/ProStep/index.js
CHANGED
|
@@ -128,47 +128,54 @@ var ProStep = function ProStep(_ref) {
|
|
|
128
128
|
registerMap.current[id] = record;
|
|
129
129
|
};
|
|
130
130
|
var notify = /*#__PURE__*/function () {
|
|
131
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
132
|
-
var events, res, nextErrorCollection;
|
|
131
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
132
|
+
var _ref7, excludes, triggerIds, events, res, nextErrorCollection;
|
|
133
133
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
134
134
|
while (1) switch (_context2.prev = _context2.next) {
|
|
135
135
|
case 0:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
_ref7 = params || {}, excludes = _ref7.excludes;
|
|
137
|
+
triggerIds = Object.keys(registerMap.current); // 排除指定模块不触发校验
|
|
138
|
+
if (excludes === null || excludes === void 0 ? void 0 : excludes.length) {
|
|
139
|
+
triggerIds = triggerIds.filter(function (id) {
|
|
140
|
+
return !excludes.includes(id);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
events = triggerIds.map(function (id) {
|
|
144
|
+
var _registerMap$current$, _registerMap$current$2;
|
|
145
|
+
return (_registerMap$current$ = registerMap.current[id]) === null || _registerMap$current$ === void 0 ? void 0 : (_registerMap$current$2 = _registerMap$current$.subEvent) === null || _registerMap$current$2 === void 0 ? void 0 : _registerMap$current$2.call(_registerMap$current$);
|
|
139
146
|
});
|
|
140
|
-
_context2.next =
|
|
147
|
+
_context2.next = 6;
|
|
141
148
|
return Promise.all(events);
|
|
142
|
-
case
|
|
149
|
+
case 6:
|
|
143
150
|
res = _context2.sent;
|
|
144
151
|
nextErrorCollection = {};
|
|
145
|
-
|
|
146
|
-
var
|
|
147
|
-
errorFields =
|
|
152
|
+
triggerIds.forEach(function (id, index) {
|
|
153
|
+
var _ref8 = (res === null || res === void 0 ? void 0 : res[index]) || {},
|
|
154
|
+
errorFields = _ref8.errorFields;
|
|
148
155
|
nextErrorCollection[id] = (errorFields === null || errorFields === void 0 ? void 0 : errorFields.length) || 0;
|
|
149
156
|
});
|
|
150
157
|
setErrorCollection(nextErrorCollection);
|
|
151
158
|
return _context2.abrupt("return", res);
|
|
152
|
-
case
|
|
159
|
+
case 11:
|
|
153
160
|
case "end":
|
|
154
161
|
return _context2.stop();
|
|
155
162
|
}
|
|
156
163
|
}, _callee2);
|
|
157
164
|
}));
|
|
158
|
-
return function notify() {
|
|
165
|
+
return function notify(_x) {
|
|
159
166
|
return _ref6.apply(this, arguments);
|
|
160
167
|
};
|
|
161
168
|
}();
|
|
162
169
|
var triggerTo = /*#__PURE__*/function () {
|
|
163
|
-
var
|
|
170
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(keys) {
|
|
164
171
|
var events, result, nextErrorCollection;
|
|
165
172
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
166
173
|
while (1) switch (_context3.prev = _context3.next) {
|
|
167
174
|
case 0:
|
|
168
175
|
events = [];
|
|
169
176
|
keys === null || keys === void 0 ? void 0 : keys.forEach(function (key) {
|
|
170
|
-
var _registerMap$current, _registerMap$current
|
|
171
|
-
events.push(registerMap === null || registerMap === void 0 ? void 0 : (_registerMap$current = registerMap.current) === null || _registerMap$current === void 0 ? void 0 : (_registerMap$current$ = _registerMap$current[key]) === null || _registerMap$current$ === void 0 ? void 0 : (_registerMap$current$
|
|
177
|
+
var _registerMap$current, _registerMap$current$3, _registerMap$current$4;
|
|
178
|
+
events.push(registerMap === null || registerMap === void 0 ? void 0 : (_registerMap$current = registerMap.current) === null || _registerMap$current === void 0 ? void 0 : (_registerMap$current$3 = _registerMap$current[key]) === null || _registerMap$current$3 === void 0 ? void 0 : (_registerMap$current$4 = _registerMap$current$3.subEvent) === null || _registerMap$current$4 === void 0 ? void 0 : _registerMap$current$4.call(_registerMap$current$3));
|
|
172
179
|
});
|
|
173
180
|
_context3.next = 4;
|
|
174
181
|
return Promise.all(events);
|
|
@@ -190,8 +197,8 @@ var ProStep = function ProStep(_ref) {
|
|
|
190
197
|
}
|
|
191
198
|
}, _callee3);
|
|
192
199
|
}));
|
|
193
|
-
return function triggerTo(
|
|
194
|
-
return
|
|
200
|
+
return function triggerTo(_x2) {
|
|
201
|
+
return _ref9.apply(this, arguments);
|
|
195
202
|
};
|
|
196
203
|
}();
|
|
197
204
|
useDeepCompareEffect(function () {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
.@{ant-prefix}-select-tree-treenode:hover{
|
|
73
|
-
background-color:
|
|
73
|
+
background-color: var(--zaui-disabled-bg);
|
|
74
74
|
}
|
|
75
75
|
.check-option-text{
|
|
76
76
|
.check-mark-icon{
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
padding-left: 7px;
|
|
91
91
|
}
|
|
92
92
|
.@{ant-prefix}-select-tree-treenode:hover{
|
|
93
|
-
background-color:
|
|
93
|
+
background-color: var(--zaui-disabled-bg);;
|
|
94
94
|
}
|
|
95
95
|
.@{ant-prefix}-select-tree-node-content-wrapper{
|
|
96
96
|
padding-right: var(--zaui-space-size-md);
|
package/es/style/theme/antd.less
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
--zaui-table-selected-hover-bg : var(--zaui-table-hover-bg); // 默认同悬停
|
|
56
56
|
--zaui-table-nested-bg : #fafcfe;
|
|
57
57
|
--zaui-contract-bg : #fffaa1; // 对比背景色
|
|
58
|
+
--zaui-contract-bg-add : #d2fff4; // 新增对比背景色
|
|
58
59
|
--zaui-form-label-width : 130px; // 8个全角字符宽度
|
|
59
60
|
--zaui-border-radius : 8px;
|
|
60
61
|
--zaui-border-radius-card : 4px;
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
@zaui-table-selected-hover-bg: var(--zaui-table-hover-bg #fafafa);
|
|
54
54
|
@zaui-table-nested-bg: var(--zaui-table-nested-bg #FAFCFE);
|
|
55
55
|
@zaui-contract-bg: var(--zaui-contract-bg; #fffaa1); // 对比背景色
|
|
56
|
+
@zaui-contract-bg-add: var(--zaui-contract-bg-add; #d2fff4); // 新增对比背景色
|
|
56
57
|
@zaui-form-required-after: var(--zaui-form-required-after; inline);
|
|
57
58
|
@zaui-form-required-before: var(--zaui-form-required-before; none);
|
|
58
59
|
@zaui-form-label-width: var(--zaui-form-label-width; 130px);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var EMPTY_VALUE = [undefined, null, ''];
|
|
2
|
+
/** 判断一个值是否是空值 */
|
|
3
|
+
export var isEmpty = function isEmpty(value) {
|
|
4
|
+
if (EMPTY_VALUE.includes(value)) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
if (Array.isArray(value)) {
|
|
8
|
+
return !(value === null || value === void 0 ? void 0 : value.length) || value.every(function (item) {
|
|
9
|
+
return EMPTY_VALUE.includes(item);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
package/lib/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormInstance } from 'antd';
|
|
3
3
|
import { NamePath } from 'antd/lib/form/interface';
|
|
4
|
+
import { DiffOriginalParams } from '../../../ProForm/utils/diffOriginal';
|
|
4
5
|
interface Props {
|
|
5
6
|
name?: NamePath;
|
|
6
7
|
names?: NamePath[];
|
|
@@ -9,8 +10,8 @@ interface Props {
|
|
|
9
10
|
namesStr?: NamePath;
|
|
10
11
|
originalValues?: any;
|
|
11
12
|
form: FormInstance;
|
|
12
|
-
equalWith?:
|
|
13
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
13
14
|
[name: string]: any;
|
|
14
15
|
}
|
|
15
|
-
declare const
|
|
16
|
-
export default
|
|
16
|
+
declare const ListChangedWrapper: React.FC<Props>;
|
|
17
|
+
export default ListChangedWrapper;
|