@zat-design/sisyphus-react 3.4.2-beta.26 → 3.4.2-beta.28
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.
|
@@ -17,7 +17,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
17
17
|
/* eslint-disable prefer-const */
|
|
18
18
|
import React, { useCallback, useEffect } from 'react';
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
-
import { cloneDeep, isEqual, debounce, omit, isFunction
|
|
20
|
+
import { cloneDeep, isEqual, debounce, omit, isFunction } from 'lodash';
|
|
21
21
|
import valueTypeMap from '../../../ProForm/utils/valueType';
|
|
22
22
|
import transformMap from '../../utils/transform';
|
|
23
23
|
import { getNamePath, difference } from '../../utils/tools';
|
|
@@ -85,7 +85,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
85
85
|
type = ((_type = type) === null || _type === void 0 ? void 0 : (_type$replace = _type.replace) === null || _type$replace === void 0 ? void 0 : _type$replace.call(_type, type[0], type[0].toUpperCase())) || 'Input';
|
|
86
86
|
// 单行正在编辑时,临时生成一套formItem用来存储中间值,点击取消时候重置回上一次状态
|
|
87
87
|
var namePath = getNamePath(name, virtualKey);
|
|
88
|
-
var rowData =
|
|
88
|
+
var rowData = form.getFieldValue([].concat(_toConsumableArray(namePath), [index])) || record || {};
|
|
89
89
|
var currentValue = dataIndex ? rowData === null || rowData === void 0 ? void 0 : rowData[dataIndex] : null;
|
|
90
90
|
// 第三个参数
|
|
91
91
|
var options = {
|
|
@@ -300,7 +300,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
300
300
|
}
|
|
301
301
|
_args = [].concat(args);
|
|
302
302
|
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
303
|
-
row = form.getFieldValue(rowPath, true);
|
|
303
|
+
row = type === 'Group' ? _args[1] : form.getFieldValue(rowPath, true);
|
|
304
304
|
orgRow = cloneDeep(row);
|
|
305
305
|
if (!onFieldChange) {
|
|
306
306
|
_context.next = 18;
|
|
@@ -483,8 +483,10 @@ var RenderField = function RenderField(_ref) {
|
|
|
483
483
|
isView: isView
|
|
484
484
|
}
|
|
485
485
|
});
|
|
486
|
-
if (type
|
|
487
|
-
componentProps =
|
|
486
|
+
if (type === 'Group') {
|
|
487
|
+
componentProps.onFieldChange = _onchange;
|
|
488
|
+
} else {
|
|
489
|
+
componentProps = omit(componentProps, ['onFieldChange', 'namePath', 'index']);
|
|
488
490
|
}
|
|
489
491
|
// 单元格编辑时,设置各个单元格disabled属性
|
|
490
492
|
if (isCell) {
|
|
@@ -70,8 +70,7 @@ var Group = function Group(props) {
|
|
|
70
70
|
var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
|
|
71
71
|
// 模拟change,初始化不执行onFieldChange
|
|
72
72
|
if (isFunction(onFieldChange) && form.isFieldsTouched(names) && transformNamesString(names).includes(touchName)) {
|
|
73
|
-
|
|
74
|
-
onFieldChange(value, record, {
|
|
73
|
+
onFieldChange(value, namePath ? form.getFieldValue(namePath, true) : form.getFieldsValue(), {
|
|
75
74
|
form: form,
|
|
76
75
|
namePath: namePath,
|
|
77
76
|
index: index
|
|
@@ -88,7 +88,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
88
88
|
type = ((_type = type) === null || _type === void 0 ? void 0 : (_type$replace = _type.replace) === null || _type$replace === void 0 ? void 0 : _type$replace.call(_type, type[0], type[0].toUpperCase())) || 'Input';
|
|
89
89
|
// 单行正在编辑时,临时生成一套formItem用来存储中间值,点击取消时候重置回上一次状态
|
|
90
90
|
var namePath = (0, _tools.getNamePath)(name, virtualKey);
|
|
91
|
-
var rowData =
|
|
91
|
+
var rowData = form.getFieldValue([].concat((0, _toConsumableArray2.default)(namePath), [index])) || record || {};
|
|
92
92
|
var currentValue = dataIndex ? rowData === null || rowData === void 0 ? void 0 : rowData[dataIndex] : null;
|
|
93
93
|
// 第三个参数
|
|
94
94
|
var options = {
|
|
@@ -303,7 +303,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
303
303
|
}
|
|
304
304
|
_args = [].concat(args);
|
|
305
305
|
rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
|
|
306
|
-
row = form.getFieldValue(rowPath, true);
|
|
306
|
+
row = type === 'Group' ? _args[1] : form.getFieldValue(rowPath, true);
|
|
307
307
|
orgRow = (0, _lodash.cloneDeep)(row);
|
|
308
308
|
if (!onFieldChange) {
|
|
309
309
|
_context.next = 18;
|
|
@@ -486,8 +486,10 @@ var RenderField = function RenderField(_ref) {
|
|
|
486
486
|
isView: isView
|
|
487
487
|
}
|
|
488
488
|
});
|
|
489
|
-
if (type
|
|
490
|
-
componentProps =
|
|
489
|
+
if (type === 'Group') {
|
|
490
|
+
componentProps.onFieldChange = _onchange;
|
|
491
|
+
} else {
|
|
492
|
+
componentProps = (0, _lodash.omit)(componentProps, ['onFieldChange', 'namePath', 'index']);
|
|
491
493
|
}
|
|
492
494
|
// 单元格编辑时,设置各个单元格disabled属性
|
|
493
495
|
if (isCell) {
|
|
@@ -74,8 +74,7 @@ var Group = function Group(props) {
|
|
|
74
74
|
var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
|
|
75
75
|
// 模拟change,初始化不执行onFieldChange
|
|
76
76
|
if ((0, _lodash.isFunction)(onFieldChange) && form.isFieldsTouched(names) && (0, _utils.transformNamesString)(names).includes(touchName)) {
|
|
77
|
-
|
|
78
|
-
onFieldChange(value, record, {
|
|
77
|
+
onFieldChange(value, namePath ? form.getFieldValue(namePath, true) : form.getFieldsValue(), {
|
|
79
78
|
form: form,
|
|
80
79
|
namePath: namePath,
|
|
81
80
|
index: index
|