| 17 | import {InlineEditableElement} from 'amis-editor-core'; |
| 18 | |
| 19 | export class ButtonPlugin extends BasePlugin { |
| 20 | static id = 'ButtonPlugin'; |
| 21 | static scene = ['layout']; |
| 22 | // 关联渲染器名字 |
| 23 | rendererName = 'button'; |
| 24 | $schema = '/schemas/ActionSchema.json'; |
| 25 | |
| 26 | order = -400; |
| 27 | |
| 28 | // 组件名称 |
| 29 | name = '按钮'; |
| 30 | isBaseComponent = true; |
| 31 | description = |
| 32 | '用来展示一个按钮,你可以配置不同的展示样式,配置不同的点击行为。'; |
| 33 | docLink = '/amis/zh-CN/components/button'; |
| 34 | tags = ['功能']; |
| 35 | icon = 'fa fa-square'; |
| 36 | pluginIcon = 'button-plugin'; |
| 37 | scaffold: SchemaObject = { |
| 38 | type: 'button', |
| 39 | label: '按钮', |
| 40 | ...BUTTON_DEFAULT_ACTION |
| 41 | }; |
| 42 | previewSchema: any = { |
| 43 | type: 'button', |
| 44 | label: '按钮' |
| 45 | }; |
| 46 | |
| 47 | panelTitle = '按钮'; |
| 48 | |
| 49 | // 事件定义 |
| 50 | events: RendererPluginEvent[] = [ |
| 51 | { |
| 52 | eventName: 'click', |
| 53 | eventLabel: '点击', |
| 54 | description: '点击时触发', |
| 55 | defaultShow: true, |
| 56 | dataSchema: [ |
| 57 | { |
| 58 | type: 'object', |
| 59 | properties: { |
| 60 | context: { |
| 61 | type: 'object', |
| 62 | title: '上下文', |
| 63 | properties: { |
| 64 | nativeEvent: { |
| 65 | type: 'object', |
| 66 | title: '鼠标事件对象' |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | ] |
| 73 | }, |
| 74 | { |
| 75 | eventName: 'mouseenter', |
| 76 | eventLabel: '鼠标移入', |
nothing calls this directly
no test coverage detected