mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
feat: 开放static组件, 增加static事件配置
This commit is contained in:
parent
8e80dd0dc4
commit
635921c43b
@ -4,7 +4,8 @@ import {
|
||||
defaultValue,
|
||||
getSchemaTpl,
|
||||
setSchemaTpl,
|
||||
tipedLabel
|
||||
tipedLabel,
|
||||
RendererPluginEvent
|
||||
} from 'amis-editor-core';
|
||||
import {registerEditorPlugin} from 'amis-editor-core';
|
||||
import {BaseEventContext, BasePlugin} from 'amis-editor-core';
|
||||
@ -263,7 +264,6 @@ export class StaticControlPlugin extends BasePlugin {
|
||||
// 组件名称
|
||||
name = '静态展示框';
|
||||
isBaseComponent = true;
|
||||
disabledRendererPlugin = true;
|
||||
icon = 'fa fa-info';
|
||||
pluginIcon = 'static-plugin';
|
||||
description = '纯用来展示数据,可用来展示 json、date、image、progress 等数据';
|
||||
@ -299,13 +299,6 @@ export class StaticControlPlugin extends BasePlugin {
|
||||
{
|
||||
title: '基本',
|
||||
body: [
|
||||
{
|
||||
type: 'alert',
|
||||
inline: false,
|
||||
level: 'warning',
|
||||
className: 'text-sm',
|
||||
body: '<p>当前组件已停止维护,建议您使用<a href="/amis/zh-CN/components/form/formitem#%E9%85%8D%E7%BD%AE%E9%9D%99%E6%80%81%E5%B1%95%E7%A4%BA" target="_blank">静态展示</a>新特性实现表单项的静态展示。</p>'
|
||||
},
|
||||
getSchemaTpl('formItemName', {
|
||||
required: false
|
||||
}),
|
||||
@ -390,6 +383,76 @@ export class StaticControlPlugin extends BasePlugin {
|
||||
return props;
|
||||
}
|
||||
|
||||
// 事件定义
|
||||
events: RendererPluginEvent[] = [
|
||||
{
|
||||
eventName: 'click',
|
||||
eventLabel: '点击',
|
||||
description: '点击时触发',
|
||||
dataSchema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
context: {
|
||||
type: 'object',
|
||||
title: '上下文',
|
||||
properties: {
|
||||
nativeEvent: {
|
||||
type: 'object',
|
||||
title: '鼠标事件对象'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
eventName: 'mouseenter',
|
||||
eventLabel: '鼠标移入',
|
||||
description: '鼠标移入时触发',
|
||||
dataSchema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
context: {
|
||||
type: 'object',
|
||||
title: '上下文',
|
||||
properties: {
|
||||
nativeEvent: {
|
||||
type: 'object',
|
||||
title: '鼠标事件对象'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
eventName: 'mouseleave',
|
||||
eventLabel: '鼠标移出',
|
||||
description: '鼠标移出时触发',
|
||||
dataSchema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
context: {
|
||||
type: 'object',
|
||||
title: '上下文',
|
||||
properties: {
|
||||
nativeEvent: {
|
||||
type: 'object',
|
||||
title: '鼠标事件对象'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
/*exchangeRenderer(id: string) {
|
||||
this.manager.showReplacePanel(id, '展示');
|
||||
}*/
|
||||
|
@ -63,6 +63,7 @@ export * from './Form/UUID'; // UUID
|
||||
export * from './Form/LocationPicker'; // 地理位置
|
||||
export * from './Form/InputSubForm'; // 子表单项
|
||||
export * from './Form/Hidden'; // 隐藏域
|
||||
export * from './Form/Static'; // 静态展示框
|
||||
|
||||
// 功能
|
||||
export * from './Button'; // 按钮
|
||||
@ -135,7 +136,6 @@ export * from './Form/InputMonthRange';
|
||||
export * from './Form/InputPassword';
|
||||
export * from './Form/InputQuarter';
|
||||
export * from './Form/InputQuarterRange';
|
||||
export * from './Form/Static';
|
||||
export * from './Form/InputTime';
|
||||
export * from './Form/InputTimeRange';
|
||||
export * from './Form/TreeSelect';
|
||||
|
Loading…
Reference in New Issue
Block a user