@zat-design/sisyphus-react 3.8.3-beta.1 → 3.8.3-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 +16 -0
- package/dist/less.esm.css +16 -0
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +21 -7
- package/es/ProEditTable/components/RenderField/index.js +8 -1
- package/es/ProEditTable/index.js +0 -1
- package/es/ProEditTable/propsType.d.ts +0 -1
- package/es/ProEditTable/utils/index.js +10 -3
- package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
- package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/es/ProForm/components/combination/FormList/index.js +14 -3
- package/es/ProForm/components/combination/ProCascader/index.js +20 -13
- package/es/ProForm/components/combination/ProModalSelect/index.js +17 -3
- package/es/ProForm/components/render/ChangedWrapper.js +14 -2
- package/es/ProForm/components/render/Render.js +3 -1
- package/es/ProForm/components/render/RenderFields.js +4 -2
- package/es/ProForm/propsType.d.ts +1 -0
- package/es/ProForm/style/index.less +7 -0
- package/es/ProForm/utils/diffOriginal.js +14 -2
- package/es/ProForm/utils/useShouldUpdate.js +1 -9
- package/es/ProTable/components/FormatColumn/index.d.ts +2 -1
- package/es/ProTable/components/FormatColumn/index.js +61 -21
- package/es/ProTable/components/RenderColumn/index.d.ts +1 -0
- package/es/ProTable/components/RenderColumn/index.js +7 -4
- package/es/ProTable/index.js +8 -7
- package/es/ProTable/propsType.d.ts +4 -0
- package/es/ProTable/style/index.less +14 -0
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +20 -6
- package/lib/ProEditTable/components/RenderField/index.js +8 -1
- package/lib/ProEditTable/index.js +0 -1
- package/lib/ProEditTable/propsType.d.ts +0 -1
- package/lib/ProEditTable/utils/index.js +10 -3
- package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
- package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/lib/ProForm/components/combination/FormList/index.js +14 -3
- package/lib/ProForm/components/combination/ProCascader/index.js +20 -13
- package/lib/ProForm/components/combination/ProModalSelect/index.js +17 -3
- package/lib/ProForm/components/render/ChangedWrapper.js +14 -2
- package/lib/ProForm/components/render/Render.js +3 -1
- package/lib/ProForm/components/render/RenderFields.js +4 -2
- package/lib/ProForm/propsType.d.ts +1 -0
- package/lib/ProForm/style/index.less +7 -0
- package/lib/ProForm/utils/diffOriginal.js +13 -1
- package/lib/ProForm/utils/useShouldUpdate.js +1 -9
- package/lib/ProTable/components/FormatColumn/index.d.ts +2 -1
- package/lib/ProTable/components/FormatColumn/index.js +61 -21
- package/lib/ProTable/components/RenderColumn/index.d.ts +1 -0
- package/lib/ProTable/components/RenderColumn/index.js +6 -3
- package/lib/ProTable/index.js +8 -7
- package/lib/ProTable/propsType.d.ts +4 -0
- package/lib/ProTable/style/index.less +14 -0
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -1914,6 +1914,16 @@
|
|
|
1914
1914
|
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
1915
1915
|
border-radius: var(--zaui-border-radius, 8px);
|
|
1916
1916
|
}
|
|
1917
|
+
.pro-table tbody.ant-table-tbody .ant-table-cell .varied-cell .pro-form-view-container {
|
|
1918
|
+
overflow: hidden;
|
|
1919
|
+
white-space: nowrap;
|
|
1920
|
+
text-overflow: ellipsis;
|
|
1921
|
+
}
|
|
1922
|
+
.pro-table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container {
|
|
1923
|
+
overflow: hidden;
|
|
1924
|
+
white-space: nowrap;
|
|
1925
|
+
text-overflow: ellipsis;
|
|
1926
|
+
}
|
|
1917
1927
|
.pro-table tbody.ant-table-tbody .varied-cell.empty-cell {
|
|
1918
1928
|
width: 24.5px;
|
|
1919
1929
|
}
|
|
@@ -3029,6 +3039,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3029
3039
|
border-radius: 4px;
|
|
3030
3040
|
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3031
3041
|
}
|
|
3042
|
+
.pro-form .pro-form-item-changed .ant-input {
|
|
3043
|
+
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3044
|
+
}
|
|
3032
3045
|
.pro-form .pro-form-item-changed .ant-select.ant-select-disabled .ant-select-selector {
|
|
3033
3046
|
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3034
3047
|
}
|
|
@@ -3086,6 +3099,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3086
3099
|
border-radius: 4px;
|
|
3087
3100
|
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
3088
3101
|
}
|
|
3102
|
+
.pro-form .pro-form-item-add .ant-input {
|
|
3103
|
+
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3104
|
+
}
|
|
3089
3105
|
.pro-form .pro-form-item-add .ant-select.ant-select-disabled .ant-select-selector {
|
|
3090
3106
|
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
3091
3107
|
}
|
package/dist/less.esm.css
CHANGED
|
@@ -1914,6 +1914,16 @@
|
|
|
1914
1914
|
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
1915
1915
|
border-radius: var(--zaui-border-radius, 8px);
|
|
1916
1916
|
}
|
|
1917
|
+
.pro-table tbody.ant-table-tbody .ant-table-cell .varied-cell .pro-form-view-container {
|
|
1918
|
+
overflow: hidden;
|
|
1919
|
+
white-space: nowrap;
|
|
1920
|
+
text-overflow: ellipsis;
|
|
1921
|
+
}
|
|
1922
|
+
.pro-table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container {
|
|
1923
|
+
overflow: hidden;
|
|
1924
|
+
white-space: nowrap;
|
|
1925
|
+
text-overflow: ellipsis;
|
|
1926
|
+
}
|
|
1917
1927
|
.pro-table tbody.ant-table-tbody .varied-cell.empty-cell {
|
|
1918
1928
|
width: 24.5px;
|
|
1919
1929
|
}
|
|
@@ -3029,6 +3039,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3029
3039
|
border-radius: 4px;
|
|
3030
3040
|
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3031
3041
|
}
|
|
3042
|
+
.pro-form .pro-form-item-changed .ant-input {
|
|
3043
|
+
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3044
|
+
}
|
|
3032
3045
|
.pro-form .pro-form-item-changed .ant-select.ant-select-disabled .ant-select-selector {
|
|
3033
3046
|
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3034
3047
|
}
|
|
@@ -3086,6 +3099,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3086
3099
|
border-radius: 4px;
|
|
3087
3100
|
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
3088
3101
|
}
|
|
3102
|
+
.pro-form .pro-form-item-add .ant-input {
|
|
3103
|
+
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3104
|
+
}
|
|
3089
3105
|
.pro-form .pro-form-item-add .ant-select.ant-select-disabled .ant-select-selector {
|
|
3090
3106
|
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
3091
3107
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import "antd/es/space/style";
|
|
3
2
|
import _Space from "antd/es/space";
|
|
4
3
|
import "antd/es/tooltip/style";
|
|
5
4
|
import _Tooltip from "antd/es/tooltip";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
8
|
-
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName"];
|
|
8
|
+
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName", "viewRender"];
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
import React, { useMemo } from 'react';
|
|
11
11
|
import classNames from 'classnames';
|
|
@@ -66,7 +66,6 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
|
66
66
|
}) : get(originalValues, originalName);
|
|
67
67
|
};
|
|
68
68
|
var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
69
|
-
var _getValueProps;
|
|
70
69
|
var name = props.name,
|
|
71
70
|
names = props.names,
|
|
72
71
|
namesStr = props.namesStr,
|
|
@@ -84,6 +83,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
84
83
|
getValueProps = props.getValueProps,
|
|
85
84
|
_props$valuePropName = props.valuePropName,
|
|
86
85
|
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
86
|
+
viewRender = props.viewRender,
|
|
87
87
|
rest = _objectWithoutProperties(props, _excluded);
|
|
88
88
|
var _ref2 = useProConfig('ProEditTable') || {},
|
|
89
89
|
isDiffAll = _ref2.isDiffAll;
|
|
@@ -113,6 +113,23 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
113
113
|
}, [props[valuePropName], originalValue]);
|
|
114
114
|
var isAdd = diffType === 'add';
|
|
115
115
|
var isChanged = diffType === 'changed';
|
|
116
|
+
var tipContent = useMemo(function () {
|
|
117
|
+
var _getValueProps;
|
|
118
|
+
if (!isWatch || noChange) return undefined;
|
|
119
|
+
var orgValue = getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : originalValue;
|
|
120
|
+
// 兼容viewRender函数和Element场景
|
|
121
|
+
var _children = children;
|
|
122
|
+
if (viewRender) {
|
|
123
|
+
if (! /*#__PURE__*/React.isValidElement(viewRender)) {
|
|
124
|
+
return viewRender(orgValue);
|
|
125
|
+
}
|
|
126
|
+
_children = viewRender;
|
|
127
|
+
}
|
|
128
|
+
return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, _defineProperty(_defineProperty({
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
isView: true
|
|
131
|
+
}, valuePropName, orgValue), "checked", type === 'Switch' ? originalValue : undefined))) : undefined;
|
|
132
|
+
}, [originalValue, children]);
|
|
116
133
|
if (!isWatch || noChange) {
|
|
117
134
|
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
|
|
118
135
|
}
|
|
@@ -127,10 +144,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
127
144
|
return target.parentElement;
|
|
128
145
|
},
|
|
129
146
|
title: _jsxs(_Space, {
|
|
130
|
-
children: ["\u521D\u59CB\u503C\uFF1A",
|
|
131
|
-
// @ts-ignore
|
|
132
|
-
isView: true
|
|
133
|
-
}, valuePropName, getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : props[valuePropName]), "checked", type === 'Switch' ? originalValue : undefined))) : undefined]
|
|
147
|
+
children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
|
|
134
148
|
}),
|
|
135
149
|
children: _jsx("div", {
|
|
136
150
|
className: diffClassName,
|
|
@@ -248,13 +248,19 @@ var RenderField = function RenderField(_ref) {
|
|
|
248
248
|
TargetComponent = _editRender;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
+
var viewRenderFun = function viewRenderFun(value) {
|
|
252
|
+
if (/*#__PURE__*/React.isValidElement(viewRender)) {
|
|
253
|
+
return viewRender;
|
|
254
|
+
}
|
|
255
|
+
return viewRender === null || viewRender === void 0 ? void 0 : viewRender(value, record, options);
|
|
256
|
+
};
|
|
251
257
|
// 查看模式
|
|
252
258
|
if (isView) {
|
|
253
259
|
// 存在viewRender覆盖默认值
|
|
254
260
|
if (typeof viewRender === 'function') {
|
|
255
261
|
var _column$dataIndex;
|
|
256
262
|
currentValue = (column === null || column === void 0 ? void 0 : (_column$dataIndex = column.dataIndex) === null || _column$dataIndex === void 0 ? void 0 : _column$dataIndex.includes('-')) ? value : currentValue;
|
|
257
|
-
var View =
|
|
263
|
+
var View = viewRenderFun(currentValue);
|
|
258
264
|
TargetComponent = _jsx(Container, {
|
|
259
265
|
viewEmpty: viewEmpty,
|
|
260
266
|
children: View
|
|
@@ -560,6 +566,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
560
566
|
valuePropName: _formItemProps.valuePropName,
|
|
561
567
|
normalize: _formItemProps.normalize,
|
|
562
568
|
getValueProps: _formItemProps.getValueProps,
|
|
569
|
+
viewRender: viewRender && viewRenderFun,
|
|
563
570
|
children: FieldComponent
|
|
564
571
|
});
|
|
565
572
|
}
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -89,7 +89,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
89
89
|
return (_ref2 = (_themeConfig$data$zau = themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data = themeConfig.data) === null || _themeConfig$data === void 0 ? void 0 : _themeConfig$data.zauiFormAlign) !== null && _themeConfig$data$zau !== void 0 ? _themeConfig$data$zau : configRequiredAlign) !== null && _ref2 !== void 0 ? _ref2 : 'left';
|
|
90
90
|
}, [themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data2 = themeConfig.data) === null || _themeConfig$data2 === void 0 ? void 0 : _themeConfig$data2.zauiFormAlign]);
|
|
91
91
|
var _useSetState = useSetState({
|
|
92
|
-
_columns: columns,
|
|
93
92
|
cellNamePath: [],
|
|
94
93
|
forceUpdate: {},
|
|
95
94
|
editingKeys: [],
|
|
@@ -109,7 +109,6 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro
|
|
|
109
109
|
}
|
|
110
110
|
export type ProEditTableColumnsProps<K = any> = ProColumnsProps & ColumnPropsMap<K, 'ProEditTable'>;
|
|
111
111
|
export interface State {
|
|
112
|
-
_columns: ProEditTableColumnsProps[];
|
|
113
112
|
cellNamePath: NamePath[];
|
|
114
113
|
forceUpdate: {};
|
|
115
114
|
editingKeys: string[];
|
|
@@ -335,14 +335,21 @@ export var transformColumns = function transformColumns() {
|
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
337
|
// 单行多行交互有较大差异
|
|
338
|
-
return
|
|
338
|
+
return _jsxs("div", {
|
|
339
339
|
className: cellClassName,
|
|
340
340
|
onClick: function onClick() {
|
|
341
341
|
isCanEdit && setState({
|
|
342
342
|
cellNamePath: cellName
|
|
343
343
|
});
|
|
344
344
|
},
|
|
345
|
-
children: _jsx(
|
|
345
|
+
children: [index === 0 && !item.width ? _jsx("div", {
|
|
346
|
+
style: {
|
|
347
|
+
visibility: 'hidden',
|
|
348
|
+
height: 0,
|
|
349
|
+
paddingLeft: (item === null || item === void 0 ? void 0 : item.required) ? 16 : 0
|
|
350
|
+
},
|
|
351
|
+
children: columnTitle
|
|
352
|
+
}) : null, _jsx(RenderField, {
|
|
346
353
|
text: _text,
|
|
347
354
|
record: record,
|
|
348
355
|
index: index,
|
|
@@ -351,7 +358,7 @@ export var transformColumns = function transformColumns() {
|
|
|
351
358
|
cellName: cellName,
|
|
352
359
|
isEditing: isEditing // 是否正在编辑
|
|
353
360
|
})
|
|
354
|
-
})
|
|
361
|
+
})]
|
|
355
362
|
});
|
|
356
363
|
};
|
|
357
364
|
item.render = _render;
|
|
@@ -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
|
|
@@ -50,7 +50,7 @@ var getViewLabel = function getViewLabel(_ref) {
|
|
|
50
50
|
return viewLabel;
|
|
51
51
|
};
|
|
52
52
|
var ProCascader = function ProCascader(props) {
|
|
53
|
-
var _props$otherProps, _value$slice,
|
|
53
|
+
var _props$otherProps, _value$slice, _ref5, _ref5$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
|
|
54
54
|
var _ref2 = useProConfig('ProAddressBar') || {},
|
|
55
55
|
configDetailMaxLength = _ref2.detailMaxLength,
|
|
56
56
|
configEnumCode = _ref2.enumCode,
|
|
@@ -90,16 +90,18 @@ var ProCascader = function ProCascader(props) {
|
|
|
90
90
|
var realLevel = Math.max(2, level);
|
|
91
91
|
var detail = value === null || value === void 0 ? void 0 : value[realLevel];
|
|
92
92
|
var enumData = useEnum(addressCode);
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
var _useProConfig = useProConfig('ProEnum'),
|
|
94
|
+
_useProConfig$dics = _useProConfig.dics,
|
|
95
|
+
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
|
96
|
+
var enumDataSource = useMemo(function () {
|
|
97
|
+
if (!(props === null || props === void 0 ? void 0 : props.mode)) {
|
|
98
|
+
return (dics === null || dics === void 0 ? void 0 : dics[addressCode]) || [];
|
|
99
|
+
}
|
|
100
|
+
return Array.isArray(enumData) ? enumData[0] : [];
|
|
101
|
+
}, [dics === null || dics === void 0 ? void 0 : dics[addressCode], enumData]);
|
|
97
102
|
var realDataSource = useMemo(function () {
|
|
98
103
|
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
|
99
104
|
var result = transformDataName(isAddressMode && realLevel === 2 ? _filterDataSource(innerDataSource, level, fieldNames) : innerDataSource, fieldNames);
|
|
100
|
-
if (transformResponse) {
|
|
101
|
-
return transformResponse(result);
|
|
102
|
-
}
|
|
103
105
|
return result;
|
|
104
106
|
}, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
|
105
107
|
var _useRequest = _objectSpread({}, useRequest),
|
|
@@ -115,7 +117,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
115
117
|
defaultLabel = _useState4[0],
|
|
116
118
|
setDefaultLabel = _useState4[1];
|
|
117
119
|
var getFirstLevelOptions = /*#__PURE__*/function () {
|
|
118
|
-
var
|
|
120
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
119
121
|
var _yield$service, data, newData, transFormData, serviceData;
|
|
120
122
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
121
123
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -143,9 +145,13 @@ var ProCascader = function ProCascader(props) {
|
|
|
143
145
|
}, _callee);
|
|
144
146
|
}));
|
|
145
147
|
return function getFirstLevelOptions() {
|
|
146
|
-
return
|
|
148
|
+
return _ref4.apply(this, arguments);
|
|
147
149
|
};
|
|
148
150
|
}();
|
|
151
|
+
// 提取出来默认每次都执行
|
|
152
|
+
if (transformResponse) {
|
|
153
|
+
realDataSource = transformResponse(realDataSource);
|
|
154
|
+
}
|
|
149
155
|
useEffect(function () {
|
|
150
156
|
if (service) {
|
|
151
157
|
// 传入useRequest时,初次加载级联第一级数据源
|
|
@@ -154,13 +160,14 @@ var ProCascader = function ProCascader(props) {
|
|
|
154
160
|
}, [service]);
|
|
155
161
|
useEffect(function () {
|
|
156
162
|
if (realIsView && value) {
|
|
163
|
+
var _realDataSource;
|
|
157
164
|
// 传入dataSource + 查看时初始化展示
|
|
158
165
|
if (service) {
|
|
159
166
|
setDefaultLabel(getViewLabel({
|
|
160
167
|
dataSource: serviceData,
|
|
161
168
|
value: isAddressMode && hasDetail ? value === null || value === void 0 ? void 0 : value.slice(0, realLevel) : value
|
|
162
169
|
}));
|
|
163
|
-
} else if ((realDataSource === null ||
|
|
170
|
+
} else if (((_realDataSource = realDataSource) === null || _realDataSource === void 0 ? void 0 : _realDataSource.length) > 0) {
|
|
164
171
|
setDefaultLabel(getViewLabel({
|
|
165
172
|
dataSource: realDataSource,
|
|
166
173
|
value: isAddressMode && hasDetail ? value === null || value === void 0 ? void 0 : value.slice(0, realLevel) : value
|
|
@@ -194,9 +201,9 @@ var ProCascader = function ProCascader(props) {
|
|
|
194
201
|
var addressValue = isAddressMode ? value && ((_value$slice = value.slice(0, realLevel)) === null || _value$slice === void 0 ? void 0 : _value$slice.some(function (item) {
|
|
195
202
|
return !!item;
|
|
196
203
|
})) ? value.slice(0, realLevel) : undefined : value;
|
|
197
|
-
var viewValue = isAddressMode ? ((
|
|
204
|
+
var viewValue = isAddressMode ? ((_ref5 = [].concat(_toConsumableArray(defaultLabel), [value === null || value === void 0 ? void 0 : value[realLevel]])) === null || _ref5 === void 0 ? void 0 : (_ref5$filter = _ref5.filter(function (item) {
|
|
198
205
|
return !!item;
|
|
199
|
-
})) === null ||
|
|
206
|
+
})) === null || _ref5$filter === void 0 ? void 0 : _ref5$filter.join(separator)) || '-' : (defaultLabel === null || defaultLabel === void 0 ? void 0 : (_defaultLabel$filter = defaultLabel.filter(function (item) {
|
|
200
207
|
return !!item;
|
|
201
208
|
})) === null || _defaultLabel$filter === void 0 ? void 0 : _defaultLabel$filter.join(separator)) || '-';
|
|
202
209
|
var _findSelectedOptions = function findSelectedOptions(options, value) {
|
|
@@ -195,11 +195,25 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
195
195
|
value: item[valueKey],
|
|
196
196
|
label: item[labelKey]
|
|
197
197
|
}));
|
|
198
|
-
})) === null || _data$map === void 0 ? void 0 : _data$map.join(',') :
|
|
198
|
+
})) === null || _data$map === void 0 ? void 0 : _data$map.join(',') : '';
|
|
199
199
|
};
|
|
200
200
|
var viewText = useMemo(function () {
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
var nextValue = labelInValue ? value : _value;
|
|
202
|
+
if (labelInValue) {
|
|
203
|
+
nextValue = value;
|
|
204
|
+
} else {
|
|
205
|
+
var _options$find;
|
|
206
|
+
var optionDTO = options === null || options === void 0 ? void 0 : (_options$find = options.find) === null || _options$find === void 0 ? void 0 : _options$find.call(options, function (item) {
|
|
207
|
+
return item[valueKey] === value;
|
|
208
|
+
});
|
|
209
|
+
if (optionDTO) {
|
|
210
|
+
nextValue = optionDTO;
|
|
211
|
+
} else {
|
|
212
|
+
nextValue = _value;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return formatValue(nextValue);
|
|
216
|
+
}, [value, _value, options]);
|
|
203
217
|
/**
|
|
204
218
|
* 获取表格的rowKey,支持函数、字符串
|
|
205
219
|
* @date 2023-02-16
|
|
@@ -5,7 +5,7 @@ import _Tooltip from "antd/es/tooltip";
|
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
8
|
-
var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps"];
|
|
8
|
+
var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps", "viewRender"];
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import { get } from 'lodash';
|
|
@@ -27,6 +27,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
27
27
|
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
28
28
|
normalize = props.normalize,
|
|
29
29
|
getValueProps = props.getValueProps,
|
|
30
|
+
viewRender = props.viewRender,
|
|
30
31
|
rest = _objectWithoutProperties(props, _excluded);
|
|
31
32
|
var _useProConfig = useProConfig('ProForm'),
|
|
32
33
|
isDiffAll = _useProConfig.isDiffAll;
|
|
@@ -52,9 +53,20 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
52
53
|
}, [isWatch, noChange, props[valuePropName], originalValue]);
|
|
53
54
|
var isAdd = diffType === 'add';
|
|
54
55
|
var isChanged = diffType === 'changed';
|
|
56
|
+
var viewRenderFun = useMemo(function () {
|
|
57
|
+
var record = form.getFieldsValue();
|
|
58
|
+
return function (orgValue) {
|
|
59
|
+
return viewRender(orgValue, record, {
|
|
60
|
+
form: form
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
}, [form]);
|
|
55
64
|
var tipContent = useMemo(function () {
|
|
56
65
|
if (!isWatch || noChange) return undefined;
|
|
57
|
-
var valueProps = getValueProps ? getValueProps(originalValue) :
|
|
66
|
+
var valueProps = getValueProps && !names ? getValueProps(originalValue) : {
|
|
67
|
+
value: originalValue
|
|
68
|
+
};
|
|
69
|
+
if (viewRender) return viewRenderFun(valueProps === null || valueProps === void 0 ? void 0 : valueProps.value);
|
|
58
70
|
return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, _defineProperty({
|
|
59
71
|
isView: true
|
|
60
72
|
}, valuePropName, valueProps === null || valueProps === void 0 ? void 0 : valueProps.value))) : undefined;
|
|
@@ -50,7 +50,8 @@ var Render = function Render(props) {
|
|
|
50
50
|
requiredOnView = props.requiredOnView,
|
|
51
51
|
confirm = props.confirm,
|
|
52
52
|
globalControl = props.globalControl,
|
|
53
|
-
diffConfig = props.diffConfig
|
|
53
|
+
diffConfig = props.diffConfig,
|
|
54
|
+
viewRender = props.viewRender;
|
|
54
55
|
var colProps = props.colProps;
|
|
55
56
|
// 剔除一些不是FormItem的属性, 防止控制台报warning
|
|
56
57
|
var labelWidth = formItemProps.labelWidth,
|
|
@@ -439,6 +440,7 @@ var Render = function Render(props) {
|
|
|
439
440
|
valuePropName: _otherFormItemProps.valuePropName,
|
|
440
441
|
normalize: _otherFormItemProps.normalize,
|
|
441
442
|
getValueProps: _otherFormItemProps.getValueProps,
|
|
443
|
+
viewRender: viewRender,
|
|
442
444
|
children: child
|
|
443
445
|
});
|
|
444
446
|
}
|
|
@@ -186,7 +186,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
186
186
|
namePath: column.namePath,
|
|
187
187
|
listName: column.listName,
|
|
188
188
|
globalControl: globalControl,
|
|
189
|
-
formDisabled: formDisabled
|
|
189
|
+
formDisabled: formDisabled,
|
|
190
|
+
diffConfig: diffConfig
|
|
190
191
|
};
|
|
191
192
|
return _jsx(FieldProvider, {
|
|
192
193
|
value: otherProps,
|
|
@@ -209,7 +210,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
209
210
|
diffConfig: diffConfig,
|
|
210
211
|
equalWith: equalWith,
|
|
211
212
|
requiredOnView: requiredOnView,
|
|
212
|
-
globalControl: globalControl
|
|
213
|
+
globalControl: globalControl,
|
|
214
|
+
viewRender: viewRender
|
|
213
215
|
})
|
|
214
216
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
|
215
217
|
});
|
|
@@ -329,6 +329,9 @@
|
|
|
329
329
|
border-radius: 4px;
|
|
330
330
|
background: @zaui-contract-bg !important;
|
|
331
331
|
|
|
332
|
+
.@{ant-prefix}-input {
|
|
333
|
+
background: @zaui-contract-bg !important;
|
|
334
|
+
}
|
|
332
335
|
.@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
|
|
333
336
|
background: @zaui-contract-bg !important;
|
|
334
337
|
}
|
|
@@ -403,6 +406,10 @@
|
|
|
403
406
|
border-radius: 4px;
|
|
404
407
|
background: @zaui-contract-bg-add !important;
|
|
405
408
|
|
|
409
|
+
.@{ant-prefix}-input {
|
|
410
|
+
background: @zaui-contract-bg !important;
|
|
411
|
+
}
|
|
412
|
+
|
|
406
413
|
.@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
|
|
407
414
|
background: @zaui-contract-bg-add !important;
|
|
408
415
|
}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import { isEqual, isFunction } from 'lodash';
|
|
1
|
+
import { isEqual, isFunction, isObject } from 'lodash';
|
|
2
2
|
import { isEmpty } from '../../utils';
|
|
3
|
+
// 过滤对象中undefined字段
|
|
4
|
+
// 防止{a: '1'} {a: '1', b: undefined}被认为不相等
|
|
5
|
+
var filterUndefined = function filterUndefined(data) {
|
|
6
|
+
if (!isObject(data) || Array.isArray(data) || data === null) return data;
|
|
7
|
+
var resData = {};
|
|
8
|
+
Object.keys(data).forEach(function (key) {
|
|
9
|
+
if (data[key] !== undefined) {
|
|
10
|
+
resData[key] = data[key];
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return resData;
|
|
14
|
+
};
|
|
3
15
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
4
16
|
export var diffOriginal = function diffOriginal(params) {
|
|
5
17
|
var originalValue = params.originalValue,
|
|
@@ -29,7 +41,7 @@ export var diffOriginal = function diffOriginal(params) {
|
|
|
29
41
|
return isSame ? 'same' : 'changed';
|
|
30
42
|
}
|
|
31
43
|
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
32
|
-
return isEqual(value, originalValue) ? 'same' : 'changed';
|
|
44
|
+
return isEqual(filterUndefined(value), filterUndefined(originalValue)) ? 'same' : 'changed';
|
|
33
45
|
}
|
|
34
46
|
return 'same';
|
|
35
47
|
};
|
|
@@ -163,9 +163,6 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
163
163
|
index: index,
|
|
164
164
|
namePath: namePath
|
|
165
165
|
}) : rules;
|
|
166
|
-
// const _component = isFunction(originComponent)
|
|
167
|
-
// ? originComponent(_currentValues, { form, index, namePath })
|
|
168
|
-
// : newComponent;
|
|
169
166
|
var _fieldProps = isFunction(fieldProps) ? fieldProps(_currentValues, {
|
|
170
167
|
form: form,
|
|
171
168
|
index: index,
|
|
@@ -196,17 +193,12 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
196
193
|
}
|
|
197
194
|
var equalRes = isEqualWith(rulesRef.current, _rules, customEqualForFun);
|
|
198
195
|
var proEqualRes = isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun);
|
|
199
|
-
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes
|
|
200
|
-
// 值变更,需要同步更新函数式的fieldProps
|
|
201
|
-
// (isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues)) ||
|
|
202
|
-
// !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
|
|
203
|
-
// equalDependencies(dependencies, prevValues, _currentValues)
|
|
196
|
+
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes || (_fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.transformResponse) // 防止fieldProps变更时,transformResponse根据fieldProps新值无法触发更新
|
|
204
197
|
) {
|
|
205
198
|
showRef.current = _show;
|
|
206
199
|
disabledRef.current = _disabled;
|
|
207
200
|
requiredRef.current = _required;
|
|
208
201
|
rulesRef.current = _rules;
|
|
209
|
-
// originComponentRef.current = _component;
|
|
210
202
|
fieldPropsRef.current = _fieldProps;
|
|
211
203
|
reRender({});
|
|
212
204
|
return false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProTableColumn } from '../../propsType';
|
|
3
|
-
export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, scroll, onUpdateMinWidth, }: {
|
|
3
|
+
export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, scroll, onUpdateMinWidth, isInNewRow, }: {
|
|
4
4
|
column: ProTableColumn;
|
|
5
5
|
originalObj: any;
|
|
6
6
|
dataSourceObj: any;
|
|
@@ -9,6 +9,7 @@ export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey
|
|
|
9
9
|
wrapToolTipProps?: any;
|
|
10
10
|
scroll?: any;
|
|
11
11
|
onUpdateMinWidth?: any;
|
|
12
|
+
isInNewRow?: any;
|
|
12
13
|
}) => void;
|
|
13
14
|
/**
|
|
14
15
|
* 查找最近的父级className
|