Skip to content

Commit

Permalink
fix: editor: 修复增删改查快速编辑在卡片和列表模式没有生成对应schema的问题 (baidu#9559)
Browse files Browse the repository at this point in the history
Co-authored-by: jinye <jinye@baidu.com>
  • Loading branch information
CheshireJCat and jinye committed Jan 31, 2024
1 parent 262a84f commit 726c7e8
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion packages/amis-editor/src/plugin/CRUD.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,17 @@ export class CRUDPlugin extends BasePlugin {
}
return {
...value,
...(value.mode !== 'table'
? {
columns:
value.columns ||
this.transformByMode({
from: value.mode,
to: 'table',
schema: value
})
}
: {}),
__filterColumnCount: value?.filter?.columnCount || 3,
__features: __features,
__LastFeatures: [...__features]
Expand Down Expand Up @@ -858,7 +869,30 @@ export class CRUDPlugin extends BasePlugin {
.concat(operButtons);
}

return valueSchema;
const {card, columns, listItem, ...rest} = valueSchema;

return {
...rest,
...(valueSchema.mode === 'table' ? {columns} : {}),
...(valueSchema.mode === 'cards'
? {
card: this.transformByMode({
from: 'table',
to: 'cards',
schema: valueSchema
})
}
: {}),
...(valueSchema.mode === 'list'
? {
listItem: this.transformByMode({
from: 'table',
to: 'list',
schema: valueSchema
})
}
: {})
};
},
canRebuild: true
};
Expand Down

0 comments on commit 726c7e8

Please sign in to comment.