mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
feat: enhance ViewActionModel with customizable open options and improved event handling
This commit is contained in:
parent
71723be793
commit
88ba482a9d
@ -20,12 +20,43 @@ export class ViewActionModel extends ActionModel {
|
||||
}
|
||||
|
||||
ViewActionModel.registerFlow({
|
||||
key: 'event1',
|
||||
key: 'handleClick',
|
||||
title: '点击事件',
|
||||
on: {
|
||||
eventName: 'click',
|
||||
},
|
||||
steps: {
|
||||
step1: {
|
||||
open: {
|
||||
title: '打开方式',
|
||||
uiSchema: {
|
||||
mode: {
|
||||
type: 'string',
|
||||
title: '打开方式',
|
||||
enum: [
|
||||
{ label: 'Drawer', value: 'drawer' },
|
||||
{ label: 'Modal', value: 'modal' },
|
||||
],
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'Radio.Group',
|
||||
},
|
||||
size: {
|
||||
type: 'string',
|
||||
title: '弹窗尺寸',
|
||||
enum: [
|
||||
{ label: '小', value: 'small' },
|
||||
{ label: '中', value: 'medium' },
|
||||
{ label: '大', value: 'large' },
|
||||
],
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'Radio.Group',
|
||||
},
|
||||
},
|
||||
defaultParams(ctx) {
|
||||
return {
|
||||
mode: 'drawer',
|
||||
size: 'medium',
|
||||
};
|
||||
},
|
||||
handler(ctx, params) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let currentDrawer: any;
|
||||
@ -38,9 +69,15 @@ ViewActionModel.registerFlow({
|
||||
);
|
||||
}
|
||||
|
||||
currentDrawer = ctx.globals.drawer.open({
|
||||
const sizeToWidthMap: Record<string, number> = {
|
||||
small: 480,
|
||||
medium: 800,
|
||||
large: 1200,
|
||||
};
|
||||
|
||||
currentDrawer = ctx.globals[params.mode].open({
|
||||
title: '命令式 Drawer',
|
||||
width: 800,
|
||||
width: sizeToWidthMap[params.size],
|
||||
content: <DrawerContent />,
|
||||
});
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user