fix: InputTable组件needConfirm为true时无法新增行问题 (#5108)

This commit is contained in:
RUNZE LU 2022-08-10 20:17:06 +08:00 committed by GitHub
parent 7f4689b993
commit 0fd3b14106
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1092,10 +1092,12 @@ export default class FormTable extends React.Component<TableProps, TableState> {
*/
@autobind
handlePristineChange(data: Record<string, any>, rowIndex: string) {
const {needConfirm} = this.props;
const index = Number(rowIndex);
this.setState(
prevState => {
const items = cloneDeep(prevState.items);
const index = Number(rowIndex);
if (
Number.isInteger(index) &&
@ -1109,7 +1111,11 @@ export default class FormTable extends React.Component<TableProps, TableState> {
return null;
},
() => {
this.emitValue();
if (needConfirm === false) {
this.emitValue();
} else {
Number.isInteger(index) && this.startEdit(index, true);
}
}
);
}