@zat-design/sisyphus-react 3.8.3-beta.5 → 3.8.3-beta.6
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/es/ProEditTable/components/RenderField/ListChangedWrapper.js +1 -1
- package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
- package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/es/ProForm/components/combination/FormList/index.js +14 -3
- package/es/ProForm/components/render/RenderFields.js +2 -1
- package/es/ProForm/propsType.d.ts +1 -0
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +1 -1
- package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
- package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/lib/ProForm/components/combination/FormList/index.js +14 -3
- package/lib/ProForm/components/render/RenderFields.js +2 -1
- package/lib/ProForm/propsType.d.ts +1 -0
- package/package.json +1 -1
|
@@ -130,7 +130,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
130
130
|
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, _defineProperty(_defineProperty({
|
|
131
131
|
// @ts-ignore
|
|
132
132
|
isView: true
|
|
133
|
-
}, valuePropName, getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] :
|
|
133
|
+
}, valuePropName, getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : originalValue), "checked", type === 'Switch' ? originalValue : undefined))) : undefined]
|
|
134
134
|
}),
|
|
135
135
|
children: _jsx("div", {
|
|
136
136
|
className: diffClassName,
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { InternalNamePath } from 'antd/es/form/interface';
|
|
4
4
|
import type { levelType } from '../../../../../ProLayout/components/ProCollapse/PropTypes';
|
|
5
5
|
import type { FormListProps } from '../propsType';
|
|
6
|
+
import { DiffConfigProps } from '../../../../propsType';
|
|
6
7
|
interface Props extends Omit<FormListProps, 'toolbarProps'> {
|
|
7
8
|
index: number;
|
|
8
9
|
namePath: InternalNamePath;
|
|
@@ -14,6 +15,7 @@ interface Props extends Omit<FormListProps, 'toolbarProps'> {
|
|
|
14
15
|
};
|
|
15
16
|
level?: levelType;
|
|
16
17
|
towCollapse?: boolean;
|
|
18
|
+
diffConfig?: DiffConfigProps;
|
|
17
19
|
}
|
|
18
20
|
declare const BlockFields: React.FC<Props>;
|
|
19
21
|
export default BlockFields;
|
|
@@ -31,7 +31,8 @@ var BlockFields = function BlockFields(props) {
|
|
|
31
31
|
_props$level = props.level,
|
|
32
32
|
level = _props$level === void 0 ? '2' : _props$level,
|
|
33
33
|
towCollapse = props.towCollapse,
|
|
34
|
-
id = props.id
|
|
34
|
+
id = props.id,
|
|
35
|
+
diffConfig = props.diffConfig;
|
|
35
36
|
var _title = useMemo(function () {
|
|
36
37
|
if (isFunction(title)) {
|
|
37
38
|
var record = form.getFieldValue(namePath);
|
|
@@ -73,7 +74,8 @@ var BlockFields = function BlockFields(props) {
|
|
|
73
74
|
form: form,
|
|
74
75
|
colProps: colProps,
|
|
75
76
|
disabled: disabled,
|
|
76
|
-
isView: isView
|
|
77
|
+
isView: isView,
|
|
78
|
+
diffConfig: diffConfig
|
|
77
79
|
})
|
|
78
80
|
}, field.key)
|
|
79
81
|
})
|
|
@@ -2,6 +2,7 @@ import { ColProps, FormListFieldData } from 'antd';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { InternalNamePath } from 'antd/es/form/interface';
|
|
4
4
|
import { FormListProps } from '../propsType';
|
|
5
|
+
import { DiffConfigProps } from '../../../../propsType';
|
|
5
6
|
interface Props extends Omit<FormListProps, 'toolbarProps'> {
|
|
6
7
|
className?: string;
|
|
7
8
|
index: number;
|
|
@@ -12,6 +13,7 @@ interface Props extends Omit<FormListProps, 'toolbarProps'> {
|
|
|
12
13
|
field: Omit<FormListFieldData, 'key'> & {
|
|
13
14
|
key: string;
|
|
14
15
|
};
|
|
16
|
+
diffConfig?: DiffConfigProps;
|
|
15
17
|
}
|
|
16
18
|
declare const LineFields: React.FC<Props>;
|
|
17
19
|
export default LineFields;
|
|
@@ -29,7 +29,8 @@ var LineFields = function LineFields(props) {
|
|
|
29
29
|
isView = props.isView,
|
|
30
30
|
draggable = props.draggable,
|
|
31
31
|
className = props.className,
|
|
32
|
-
id = props.id
|
|
32
|
+
id = props.id,
|
|
33
|
+
diffConfig = props.diffConfig;
|
|
33
34
|
var isLess = mode === 'less';
|
|
34
35
|
var _useSortable = useSortable({
|
|
35
36
|
id: field.key,
|
|
@@ -70,7 +71,8 @@ var LineFields = function LineFields(props) {
|
|
|
70
71
|
form: form,
|
|
71
72
|
colProps: colProps,
|
|
72
73
|
disabled: disabled,
|
|
73
|
-
isView: isView
|
|
74
|
+
isView: isView,
|
|
75
|
+
diffConfig: diffConfig
|
|
74
76
|
})
|
|
75
77
|
}), actionProps !== false && _jsx(ActionButton, {
|
|
76
78
|
min: min,
|
|
@@ -5,6 +5,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { forwardRef, useCallback, useImperativeHandle } from 'react';
|
|
7
7
|
import { DndContext } from '@dnd-kit/core';
|
|
8
|
+
import { get } from 'lodash';
|
|
8
9
|
import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
9
10
|
import { toArray } from '../../../utils';
|
|
10
11
|
import { namesPathTransform } from './utils';
|
|
@@ -12,6 +13,7 @@ import ToolbarButton from './components/ToolbarButton';
|
|
|
12
13
|
import BlockFields from './components/BlockFields';
|
|
13
14
|
import LineFields from './components/LineFields';
|
|
14
15
|
import ProForm from '../../../../ProForm';
|
|
16
|
+
import { useProConfig } from '../../../../ProConfigProvider';
|
|
15
17
|
var FormList = function FormList(props, ref) {
|
|
16
18
|
var columns = props.columns,
|
|
17
19
|
min = props.min,
|
|
@@ -33,9 +35,16 @@ var FormList = function FormList(props, ref) {
|
|
|
33
35
|
var _ref = ProForm.useFieldProps() || {},
|
|
34
36
|
form = _ref.form,
|
|
35
37
|
name = _ref.name,
|
|
36
|
-
isView = _ref.isView
|
|
38
|
+
isView = _ref.isView,
|
|
39
|
+
diffConfig = _ref.diffConfig;
|
|
40
|
+
var _useProConfig = useProConfig('ProForm'),
|
|
41
|
+
isDiffAll = _useProConfig.isDiffAll;
|
|
37
42
|
var errors = meta.errors;
|
|
38
43
|
var _namePath = toArray(name);
|
|
44
|
+
var orgValues = get(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
|
|
45
|
+
var _diffConfig = _objectSpread(_objectSpread({}, diffConfig), {}, {
|
|
46
|
+
originalValues: isDiffAll ? orgValues || [] : orgValues
|
|
47
|
+
});
|
|
39
48
|
var processColumns = useCallback(function (fieldName, namePath) {
|
|
40
49
|
return columns.map(function (item) {
|
|
41
50
|
// names的name处理
|
|
@@ -98,7 +107,8 @@ var FormList = function FormList(props, ref) {
|
|
|
98
107
|
colProps: {
|
|
99
108
|
span: span
|
|
100
109
|
},
|
|
101
|
-
form: form
|
|
110
|
+
form: form,
|
|
111
|
+
diffConfig: _diffConfig
|
|
102
112
|
}), field.key) : _jsx(LineFields, _objectSpread(_objectSpread({
|
|
103
113
|
className: _fields.length === index + 1 ? 'pro-form-list-last' : ''
|
|
104
114
|
}, props), {}, {
|
|
@@ -112,7 +122,8 @@ var FormList = function FormList(props, ref) {
|
|
|
112
122
|
colProps: {
|
|
113
123
|
span: mode === 'less' ? 24 : span
|
|
114
124
|
},
|
|
115
|
-
form: form
|
|
125
|
+
form: form,
|
|
126
|
+
diffConfig: _diffConfig
|
|
116
127
|
}), field.key);
|
|
117
128
|
}), _jsx(_Form.ErrorList, {
|
|
118
129
|
errors: errors
|
|
@@ -186,7 +186,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
186
186
|
namePath: column.namePath,
|
|
187
187
|
listName: column.listName,
|
|
188
188
|
globalControl: globalControl,
|
|
189
|
-
formDisabled: formDisabled
|
|
189
|
+
formDisabled: formDisabled,
|
|
190
|
+
diffConfig: diffConfig
|
|
190
191
|
};
|
|
191
192
|
return _jsx(FieldProvider, {
|
|
192
193
|
value: otherProps,
|
|
@@ -137,7 +137,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
137
137
|
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)({
|
|
138
138
|
// @ts-ignore
|
|
139
139
|
isView: true
|
|
140
|
-
}, valuePropName, getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] :
|
|
140
|
+
}, valuePropName, getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : originalValue), "checked", type === 'Switch' ? originalValue : undefined))) : undefined]
|
|
141
141
|
}),
|
|
142
142
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
143
143
|
className: diffClassName,
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { InternalNamePath } from 'antd/es/form/interface';
|
|
4
4
|
import type { levelType } from '../../../../../ProLayout/components/ProCollapse/PropTypes';
|
|
5
5
|
import type { FormListProps } from '../propsType';
|
|
6
|
+
import { DiffConfigProps } from '../../../../propsType';
|
|
6
7
|
interface Props extends Omit<FormListProps, 'toolbarProps'> {
|
|
7
8
|
index: number;
|
|
8
9
|
namePath: InternalNamePath;
|
|
@@ -14,6 +15,7 @@ interface Props extends Omit<FormListProps, 'toolbarProps'> {
|
|
|
14
15
|
};
|
|
15
16
|
level?: levelType;
|
|
16
17
|
towCollapse?: boolean;
|
|
18
|
+
diffConfig?: DiffConfigProps;
|
|
17
19
|
}
|
|
18
20
|
declare const BlockFields: React.FC<Props>;
|
|
19
21
|
export default BlockFields;
|
|
@@ -36,7 +36,8 @@ var BlockFields = function BlockFields(props) {
|
|
|
36
36
|
_props$level = props.level,
|
|
37
37
|
level = _props$level === void 0 ? '2' : _props$level,
|
|
38
38
|
towCollapse = props.towCollapse,
|
|
39
|
-
id = props.id
|
|
39
|
+
id = props.id,
|
|
40
|
+
diffConfig = props.diffConfig;
|
|
40
41
|
var _title = (0, _react.useMemo)(function () {
|
|
41
42
|
if ((0, _lodash.isFunction)(title)) {
|
|
42
43
|
var record = form.getFieldValue(namePath);
|
|
@@ -78,7 +79,8 @@ var BlockFields = function BlockFields(props) {
|
|
|
78
79
|
form: form,
|
|
79
80
|
colProps: colProps,
|
|
80
81
|
disabled: disabled,
|
|
81
|
-
isView: isView
|
|
82
|
+
isView: isView,
|
|
83
|
+
diffConfig: diffConfig
|
|
82
84
|
})
|
|
83
85
|
}, field.key)
|
|
84
86
|
})
|
|
@@ -2,6 +2,7 @@ import { ColProps, FormListFieldData } from 'antd';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { InternalNamePath } from 'antd/es/form/interface';
|
|
4
4
|
import { FormListProps } from '../propsType';
|
|
5
|
+
import { DiffConfigProps } from '../../../../propsType';
|
|
5
6
|
interface Props extends Omit<FormListProps, 'toolbarProps'> {
|
|
6
7
|
className?: string;
|
|
7
8
|
index: number;
|
|
@@ -12,6 +13,7 @@ interface Props extends Omit<FormListProps, 'toolbarProps'> {
|
|
|
12
13
|
field: Omit<FormListFieldData, 'key'> & {
|
|
13
14
|
key: string;
|
|
14
15
|
};
|
|
16
|
+
diffConfig?: DiffConfigProps;
|
|
15
17
|
}
|
|
16
18
|
declare const LineFields: React.FC<Props>;
|
|
17
19
|
export default LineFields;
|
|
@@ -35,7 +35,8 @@ var LineFields = function LineFields(props) {
|
|
|
35
35
|
isView = props.isView,
|
|
36
36
|
draggable = props.draggable,
|
|
37
37
|
className = props.className,
|
|
38
|
-
id = props.id
|
|
38
|
+
id = props.id,
|
|
39
|
+
diffConfig = props.diffConfig;
|
|
39
40
|
var isLess = mode === 'less';
|
|
40
41
|
var _useSortable = (0, _sortable.useSortable)({
|
|
41
42
|
id: field.key,
|
|
@@ -76,7 +77,8 @@ var LineFields = function LineFields(props) {
|
|
|
76
77
|
form: form,
|
|
77
78
|
colProps: colProps,
|
|
78
79
|
disabled: disabled,
|
|
79
|
-
isView: isView
|
|
80
|
+
isView: isView,
|
|
81
|
+
diffConfig: diffConfig
|
|
80
82
|
})
|
|
81
83
|
}), actionProps !== false && (0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
82
84
|
min: min,
|
|
@@ -11,6 +11,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _antd = require("antd");
|
|
13
13
|
var _core = require("@dnd-kit/core");
|
|
14
|
+
var _lodash = require("lodash");
|
|
14
15
|
var _sortable = require("@dnd-kit/sortable");
|
|
15
16
|
var _utils = require("../../../utils");
|
|
16
17
|
var _utils2 = require("./utils");
|
|
@@ -18,6 +19,7 @@ var _ToolbarButton = _interopRequireDefault(require("./components/ToolbarButton"
|
|
|
18
19
|
var _BlockFields = _interopRequireDefault(require("./components/BlockFields"));
|
|
19
20
|
var _LineFields = _interopRequireDefault(require("./components/LineFields"));
|
|
20
21
|
var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
|
|
22
|
+
var _ProConfigProvider = require("../../../../ProConfigProvider");
|
|
21
23
|
var FormList = function FormList(props, ref) {
|
|
22
24
|
var columns = props.columns,
|
|
23
25
|
min = props.min,
|
|
@@ -39,9 +41,16 @@ var FormList = function FormList(props, ref) {
|
|
|
39
41
|
var _ref = _ProForm.default.useFieldProps() || {},
|
|
40
42
|
form = _ref.form,
|
|
41
43
|
name = _ref.name,
|
|
42
|
-
isView = _ref.isView
|
|
44
|
+
isView = _ref.isView,
|
|
45
|
+
diffConfig = _ref.diffConfig;
|
|
46
|
+
var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
|
|
47
|
+
isDiffAll = _useProConfig.isDiffAll;
|
|
43
48
|
var errors = meta.errors;
|
|
44
49
|
var _namePath = (0, _utils.toArray)(name);
|
|
50
|
+
var orgValues = (0, _lodash.get)(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
|
|
51
|
+
var _diffConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, diffConfig), {}, {
|
|
52
|
+
originalValues: isDiffAll ? orgValues || [] : orgValues
|
|
53
|
+
});
|
|
45
54
|
var processColumns = (0, _react.useCallback)(function (fieldName, namePath) {
|
|
46
55
|
return columns.map(function (item) {
|
|
47
56
|
// names的name处理
|
|
@@ -104,7 +113,8 @@ var FormList = function FormList(props, ref) {
|
|
|
104
113
|
colProps: {
|
|
105
114
|
span: span
|
|
106
115
|
},
|
|
107
|
-
form: form
|
|
116
|
+
form: form,
|
|
117
|
+
diffConfig: _diffConfig
|
|
108
118
|
}), field.key) : (0, _jsxRuntime.jsx)(_LineFields.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
109
119
|
className: _fields.length === index + 1 ? 'pro-form-list-last' : ''
|
|
110
120
|
}, props), {}, {
|
|
@@ -118,7 +128,8 @@ var FormList = function FormList(props, ref) {
|
|
|
118
128
|
colProps: {
|
|
119
129
|
span: mode === 'less' ? 24 : span
|
|
120
130
|
},
|
|
121
|
-
form: form
|
|
131
|
+
form: form,
|
|
132
|
+
diffConfig: _diffConfig
|
|
122
133
|
}), field.key);
|
|
123
134
|
}), (0, _jsxRuntime.jsx)(_antd.Form.ErrorList, {
|
|
124
135
|
errors: errors
|
|
@@ -194,7 +194,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
194
194
|
namePath: column.namePath,
|
|
195
195
|
listName: column.listName,
|
|
196
196
|
globalControl: globalControl,
|
|
197
|
-
formDisabled: formDisabled
|
|
197
|
+
formDisabled: formDisabled,
|
|
198
|
+
diffConfig: diffConfig
|
|
198
199
|
};
|
|
199
200
|
return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
|
|
200
201
|
value: otherProps,
|