| 6 | import {generateId} from '../util'; |
| 7 | |
| 8 | export class AlertPlugin extends BasePlugin { |
| 9 | static id = 'AlertPlugin'; |
| 10 | static scene = ['layout']; |
| 11 | |
| 12 | // 关联渲染器名字 |
| 13 | rendererName = 'alert'; |
| 14 | $schema = '/schemas/AlertSchema.json'; |
| 15 | |
| 16 | // 组件名称 |
| 17 | name = '提示'; |
| 18 | isBaseComponent = true; |
| 19 | description = |
| 20 | '用来做文字特殊提示,分为四类:提示类、成功类、警告类和危险类。可结合 <code>visibleOn</code> 用来做错误信息提示。'; |
| 21 | docLink = '/amis/zh-CN/components/alert'; |
| 22 | icon = 'fa fa-exclamation-circle'; |
| 23 | pluginIcon = 'tooltip-plugin'; |
| 24 | tags = ['功能']; |
| 25 | |
| 26 | scaffold: SchemaObject = { |
| 27 | type: 'alert', |
| 28 | body: { |
| 29 | type: 'tpl', |
| 30 | tpl: '提示内容', |
| 31 | wrapperComponent: '', |
| 32 | inline: false, |
| 33 | id: generateId() |
| 34 | }, |
| 35 | level: 'info' |
| 36 | }; |
| 37 | previewSchema: any = { |
| 38 | ...this.scaffold, |
| 39 | className: 'text-left', |
| 40 | showCloseButton: true |
| 41 | }; |
| 42 | |
| 43 | // 普通容器类渲染器配置 |
| 44 | regions = [{key: 'body', label: '内容区', placeholder: '提示内容'}]; |
| 45 | |
| 46 | notRenderFormZone = true; |
| 47 | panelTitle = '提示'; |
| 48 | panelJustify = true; |
| 49 | panelBodyCreator = (context: BaseEventContext) => { |
| 50 | return getSchemaTpl('tabs', [ |
| 51 | { |
| 52 | title: '属性', |
| 53 | body: getSchemaTpl('collapseGroup', [ |
| 54 | { |
| 55 | title: '基本', |
| 56 | body: [ |
| 57 | getSchemaTpl('layout:originPosition', {value: 'left-top'}), |
| 58 | { |
| 59 | label: '类型', |
| 60 | name: 'level', |
| 61 | type: 'select', |
| 62 | options: [ |
| 63 | { |
| 64 | label: '提示', |
| 65 | value: 'info' |
nothing calls this directly
no test coverage detected