mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-16 01:40:53 +08:00
feat:picker支持事件动作可视化
Change-Id: I2fa989a8c2dfc3703e636fa77f6b951b5e86a660
This commit is contained in:
parent
5cc2651a30
commit
e5b340053e
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import {Button} from 'amis';
|
||||
import omit from 'lodash/omit';
|
||||
import {getSchemaTpl} from 'amis-editor-core';
|
||||
import {getSchemaTpl, RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
|
||||
import {registerEditorPlugin} from 'amis-editor-core';
|
||||
import {
|
||||
BaseEventContext,
|
||||
@ -11,6 +11,7 @@ import {
|
||||
ContextMenuItem
|
||||
} from 'amis-editor-core';
|
||||
import {diff} from 'amis-editor-core';
|
||||
import {getEventControlConfig} from '../../renderer/event-control/helper';
|
||||
|
||||
export class PickerControlPlugin extends BasePlugin {
|
||||
// 关联渲染器名字
|
||||
@ -53,9 +54,36 @@ export class PickerControlPlugin extends BasePlugin {
|
||||
]
|
||||
};
|
||||
|
||||
// 事件定义
|
||||
events: RendererPluginEvent[] = [
|
||||
{
|
||||
eventName: 'change',
|
||||
eventLabel: '值变化',
|
||||
description: '选中状态变化时触发',
|
||||
dataSchema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
'event.data.value': {
|
||||
type: 'string',
|
||||
title: '选中值'
|
||||
},
|
||||
'event.data.option': {
|
||||
type: 'string',
|
||||
title: '选中的行数据'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
panelTitle = '列表选取';
|
||||
panelBodyCreator = (context: BaseEventContext) => {
|
||||
return [
|
||||
return getSchemaTpl('tabs', [
|
||||
{
|
||||
title: '属性',
|
||||
body: [
|
||||
getSchemaTpl('switch', {
|
||||
name: 'embed',
|
||||
label: '开启内嵌模式'
|
||||
@ -128,7 +156,19 @@ export class PickerControlPlugin extends BasePlugin {
|
||||
getSchemaTpl('autoFill')
|
||||
]
|
||||
})
|
||||
];
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '事件',
|
||||
className: 'p-none',
|
||||
body: [
|
||||
getSchemaTpl('eventControl', {
|
||||
name: 'onEvent',
|
||||
...getEventControlConfig(this.manager, context)
|
||||
})
|
||||
]
|
||||
}
|
||||
]);
|
||||
};
|
||||
|
||||
buildEditorToolbar(
|
||||
|
Loading…
Reference in New Issue
Block a user