mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-01 19:47:56 +08:00
fix:inputTable删除行动作没有触发change事件
This commit is contained in:
parent
be364f917c
commit
68b4314cda
@ -496,8 +496,9 @@ export default class FormTable extends React.Component<TableProps, TableState> {
|
||||
return msg;
|
||||
}
|
||||
|
||||
async emitValue() {
|
||||
const items = this.state.items.filter(item => !item.__isPlaceholder);
|
||||
async emitValue(value?: any[]) {
|
||||
const items =
|
||||
value ?? this.state.items.filter(item => !item.__isPlaceholder);
|
||||
const {onChange} = this.props;
|
||||
const isPrevented = await this.dispatchEvent('change');
|
||||
isPrevented || onChange?.(items);
|
||||
@ -1019,7 +1020,13 @@ export default class FormTable extends React.Component<TableProps, TableState> {
|
||||
const originItems = newValue;
|
||||
newValue = spliceTree(newValue, indexes, 1);
|
||||
this.reUseRowId(newValue, originItems, indexes);
|
||||
onChange(newValue);
|
||||
|
||||
// change value
|
||||
const prevented = await this.emitValue(newValue);
|
||||
if (prevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.dispatchEvent('deleteSuccess', {
|
||||
value: newValue,
|
||||
index: indexes[indexes.length - 1],
|
||||
|
Loading…
Reference in New Issue
Block a user