fix: input-table未下发static、删除逻辑优化

This commit is contained in:
hezhihang 2024-06-18 17:39:55 +08:00
parent 9e724f467f
commit 0197c28f17

View File

@ -350,6 +350,7 @@ export default class FormTable extends React.Component<TableProps, TableState> {
// Form会向FormItem下发disabled属性disbaled 属性值也需要同步到
if (
prevProps.disabled !== props.disabled ||
prevProps.static !== props.static ||
props.$schema.disabled !== prevProps.$schema.disabled ||
props.$schema.static !== prevProps.$schema.static
) {
@ -1028,18 +1029,25 @@ export default class FormTable extends React.Component<TableProps, TableState> {
newValue = spliceTree(newValue, indexes, 1);
this.reUseRowId(newValue, originItems, indexes);
// change value
const prevented = await this.emitValue(newValue);
if (prevented) {
return;
}
this.setState(
{
items: newValue
},
async () => {
// change value
const prevented = await this.emitValue(newValue);
if (prevented) {
return;
}
this.dispatchEvent('deleteSuccess', {
value: newValue,
index: indexes[indexes.length - 1],
indexPath: indexes.join('.'),
item
});
this.dispatchEvent('deleteSuccess', {
value: newValue,
index: indexes[indexes.length - 1],
indexPath: indexes.join('.'),
item
});
}
);
}
rowPathPlusOffset(path: string, offset = 0) {