@zat-design/sisyphus-react 3.8.3-beta.1 → 3.8.3-beta.12
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 +14 -7
- package/es/ProEditTable/propsType.d.ts +0 -6
- package/es/ProEditTable/utils/index.js +10 -3
- package/es/ProForm/components/base/InputNumber/index.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/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 +14 -7
- package/lib/ProEditTable/propsType.d.ts +0 -6
- package/lib/ProEditTable/utils/index.js +10 -3
- package/lib/ProForm/components/base/InputNumber/index.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/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/coverage/lcov-report/src/.umi/core/devScripts.ts.html +0 -241
- package/coverage/lcov-report/src/.umi/core/history.ts.html +0 -148
- package/coverage/lcov-report/src/.umi/core/index.html +0 -206
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +0 -109
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +0 -160
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +0 -97
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +0 -26050
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +0 -112
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +0 -116
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +0 -6340
- package/coverage/lcov-report/src/.umi/dumi/index.html +0 -116
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +0 -109
- package/coverage/lcov-report/src/.umi/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +0 -172
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +0 -94
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +0 -196
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +0 -106
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +0 -146
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +0 -88
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +0 -124
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +0 -1246
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +0 -161
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +0 -268
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +0 -778
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +0 -115
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +0 -202
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +0 -97
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +0 -142
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +0 -334
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +0 -146
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +0 -146
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +0 -121
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +0 -298
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +0 -919
- package/coverage/lcov-report/src/.umi/umi.ts.html +0 -268
|
@@ -339,14 +339,21 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
// 单行多行交互有较大差异
|
|
342
|
-
return (0, _jsxRuntime.
|
|
342
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
343
343
|
className: cellClassName,
|
|
344
344
|
onClick: function onClick() {
|
|
345
345
|
isCanEdit && setState({
|
|
346
346
|
cellNamePath: cellName
|
|
347
347
|
});
|
|
348
348
|
},
|
|
349
|
-
children: (0, _jsxRuntime.jsx)(
|
|
349
|
+
children: [index === 0 && !item.width ? (0, _jsxRuntime.jsx)("div", {
|
|
350
|
+
style: {
|
|
351
|
+
visibility: 'hidden',
|
|
352
|
+
height: 0,
|
|
353
|
+
paddingLeft: (item === null || item === void 0 ? void 0 : item.required) ? 16 : 0
|
|
354
|
+
},
|
|
355
|
+
children: columnTitle
|
|
356
|
+
}) : null, (0, _jsxRuntime.jsx)(_components.RenderField, {
|
|
350
357
|
text: _text,
|
|
351
358
|
record: record,
|
|
352
359
|
index: index,
|
|
@@ -355,7 +362,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
355
362
|
cellName: cellName,
|
|
356
363
|
isEditing: isEditing // 是否正在编辑
|
|
357
364
|
})
|
|
358
|
-
})
|
|
365
|
+
})]
|
|
359
366
|
});
|
|
360
367
|
};
|
|
361
368
|
item.render = _render;
|
|
@@ -290,7 +290,7 @@ var InputNumber = function InputNumber(props) {
|
|
|
290
290
|
autoComplete: "off",
|
|
291
291
|
placeholder: placeholder || "".concat(_locale.default.ProForm.inputPlaceholder).concat(label !== null && label !== void 0 ? label : ''),
|
|
292
292
|
className: _className
|
|
293
|
-
},
|
|
293
|
+
}, initialConfig), valueProps), rest), {}, {
|
|
294
294
|
onBlur: handleBlur,
|
|
295
295
|
onFocus: handleFocus,
|
|
296
296
|
min: _min,
|
|
@@ -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
|
|
@@ -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 = (0, _ProConfigProvider.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 = (0, _useEnum.default)(addressCode);
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProEnum'),
|
|
94
|
+
_useProConfig$dics = _useProConfig.dics,
|
|
95
|
+
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
|
96
|
+
var enumDataSource = (0, _react.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 = (0, _react.useMemo)(function () {
|
|
98
103
|
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
|
99
104
|
var result = (0, _index.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 = (0, _objectSpread3.default)({}, 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 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
119
121
|
var _yield$service, data, newData, transFormData, serviceData;
|
|
120
122
|
return (0, _regeneratorRuntime2.default)().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
|
(0, _react.useEffect)(function () {
|
|
150
156
|
if (service) {
|
|
151
157
|
// 传入useRequest时,初次加载级联第一级数据源
|
|
@@ -154,13 +160,14 @@ var ProCascader = function ProCascader(props) {
|
|
|
154
160
|
}, [service]);
|
|
155
161
|
(0, _react.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((0, _toConsumableArray2.default)(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) {
|
|
@@ -190,11 +190,25 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
190
190
|
value: item[valueKey],
|
|
191
191
|
label: item[labelKey]
|
|
192
192
|
}));
|
|
193
|
-
})) === null || _data$map === void 0 ? void 0 : _data$map.join(',') :
|
|
193
|
+
})) === null || _data$map === void 0 ? void 0 : _data$map.join(',') : '';
|
|
194
194
|
};
|
|
195
195
|
var viewText = (0, _react.useMemo)(function () {
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
var nextValue = labelInValue ? value : _value;
|
|
197
|
+
if (labelInValue) {
|
|
198
|
+
nextValue = value;
|
|
199
|
+
} else {
|
|
200
|
+
var _options$find;
|
|
201
|
+
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) {
|
|
202
|
+
return item[valueKey] === value;
|
|
203
|
+
});
|
|
204
|
+
if (optionDTO) {
|
|
205
|
+
nextValue = optionDTO;
|
|
206
|
+
} else {
|
|
207
|
+
nextValue = _value;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return formatValue(nextValue);
|
|
211
|
+
}, [value, _value, options]);
|
|
198
212
|
/**
|
|
199
213
|
* 获取表格的rowKey,支持函数、字符串
|
|
200
214
|
* @date 2023-02-16
|
|
@@ -17,7 +17,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
17
17
|
var _diffOriginal = require("../../utils/diffOriginal");
|
|
18
18
|
var _ProConfigProvider = require("../../../ProConfigProvider");
|
|
19
19
|
var _utils = require("../../../utils");
|
|
20
|
-
var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps"];
|
|
20
|
+
var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps", "viewRender"];
|
|
21
21
|
var ChangedWrapper = function ChangedWrapper(props) {
|
|
22
22
|
var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
|
|
23
23
|
var name = props.name,
|
|
@@ -32,6 +32,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
32
32
|
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
33
33
|
normalize = props.normalize,
|
|
34
34
|
getValueProps = props.getValueProps,
|
|
35
|
+
viewRender = props.viewRender,
|
|
35
36
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
36
37
|
var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
|
|
37
38
|
isDiffAll = _useProConfig.isDiffAll;
|
|
@@ -57,9 +58,20 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
57
58
|
}, [isWatch, noChange, props[valuePropName], originalValue]);
|
|
58
59
|
var isAdd = diffType === 'add';
|
|
59
60
|
var isChanged = diffType === 'changed';
|
|
61
|
+
var viewRenderFun = (0, _react.useMemo)(function () {
|
|
62
|
+
var record = form.getFieldsValue();
|
|
63
|
+
return function (orgValue) {
|
|
64
|
+
return viewRender(orgValue, record, {
|
|
65
|
+
form: form
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
}, [form]);
|
|
60
69
|
var tipContent = (0, _react.useMemo)(function () {
|
|
61
70
|
if (!isWatch || noChange) return undefined;
|
|
62
|
-
var valueProps = getValueProps ? getValueProps(originalValue) :
|
|
71
|
+
var valueProps = getValueProps && !names ? getValueProps(originalValue) : {
|
|
72
|
+
value: originalValue
|
|
73
|
+
};
|
|
74
|
+
if (viewRender) return viewRenderFun(valueProps === null || valueProps === void 0 ? void 0 : valueProps.value);
|
|
63
75
|
return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), {}, (0, _defineProperty2.default)({
|
|
64
76
|
isView: true
|
|
65
77
|
}, 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
|
}
|
|
@@ -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,
|
|
@@ -217,7 +218,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
217
218
|
diffConfig: diffConfig,
|
|
218
219
|
equalWith: equalWith,
|
|
219
220
|
requiredOnView: requiredOnView,
|
|
220
|
-
globalControl: globalControl
|
|
221
|
+
globalControl: globalControl,
|
|
222
|
+
viewRender: viewRender
|
|
221
223
|
})
|
|
222
224
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
|
223
225
|
});
|
|
@@ -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
|
}
|
|
@@ -6,6 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.diffOriginal = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
8
|
var _utils = require("../../utils");
|
|
9
|
+
// 过滤对象中undefined字段
|
|
10
|
+
// 防止{a: '1'} {a: '1', b: undefined}被认为不相等
|
|
11
|
+
var filterUndefined = function filterUndefined(data) {
|
|
12
|
+
if (!(0, _lodash.isObject)(data) || Array.isArray(data) || data === null) return data;
|
|
13
|
+
var resData = {};
|
|
14
|
+
Object.keys(data).forEach(function (key) {
|
|
15
|
+
if (data[key] !== undefined) {
|
|
16
|
+
resData[key] = data[key];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return resData;
|
|
20
|
+
};
|
|
9
21
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
10
22
|
var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
11
23
|
var originalValue = params.originalValue,
|
|
@@ -35,7 +47,7 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
|
35
47
|
return isSame ? 'same' : 'changed';
|
|
36
48
|
}
|
|
37
49
|
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
38
|
-
return (0, _lodash.isEqual)(value, originalValue) ? 'same' : 'changed';
|
|
50
|
+
return (0, _lodash.isEqual)(filterUndefined(value), filterUndefined(originalValue)) ? 'same' : 'changed';
|
|
39
51
|
}
|
|
40
52
|
return 'same';
|
|
41
53
|
};
|
|
@@ -170,9 +170,6 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
170
170
|
index: index,
|
|
171
171
|
namePath: namePath
|
|
172
172
|
}) : rules;
|
|
173
|
-
// const _component = isFunction(originComponent)
|
|
174
|
-
// ? originComponent(_currentValues, { form, index, namePath })
|
|
175
|
-
// : newComponent;
|
|
176
173
|
var _fieldProps = (0, _lodash.isFunction)(fieldProps) ? fieldProps(_currentValues, {
|
|
177
174
|
form: form,
|
|
178
175
|
index: index,
|
|
@@ -203,17 +200,12 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
203
200
|
}
|
|
204
201
|
var equalRes = (0, _lodash.isEqualWith)(rulesRef.current, _rules, _index.customEqualForFun);
|
|
205
202
|
var proEqualRes = (0, _lodash.isEqualWith)(fieldPropsRef.current, _fieldProps, _index.customEqualForFun);
|
|
206
|
-
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes
|
|
207
|
-
// 值变更,需要同步更新函数式的fieldProps
|
|
208
|
-
// (isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues)) ||
|
|
209
|
-
// !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
|
|
210
|
-
// equalDependencies(dependencies, prevValues, _currentValues)
|
|
203
|
+
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes || (_fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.transformResponse) // 防止fieldProps变更时,transformResponse根据fieldProps新值无法触发更新
|
|
211
204
|
) {
|
|
212
205
|
showRef.current = _show;
|
|
213
206
|
disabledRef.current = _disabled;
|
|
214
207
|
requiredRef.current = _required;
|
|
215
208
|
rulesRef.current = _rules;
|
|
216
|
-
// originComponentRef.current = _component;
|
|
217
209
|
fieldPropsRef.current = _fieldProps;
|
|
218
210
|
reRender({});
|
|
219
211
|
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
|