| 20 | import {generateId} from '../util'; |
| 21 | |
| 22 | export class CollapsePlugin extends BasePlugin { |
| 23 | static id = 'CollapsePlugin'; |
| 24 | // 关联渲染器名字 |
| 25 | rendererName = 'collapse'; |
| 26 | useLazyRender = true; // 使用懒渲染 |
| 27 | $schema = '/schemas/CollapseSchema.json'; |
| 28 | |
| 29 | // 组件名称 |
| 30 | name = '折叠器'; |
| 31 | isBaseComponent = true; |
| 32 | description = '折叠器,可以将内容区展开或隐藏,保持页面的整洁'; |
| 33 | docLink = '/amis/zh-CN/components/collapse'; |
| 34 | tags = ['展示']; |
| 35 | icon = 'fa fa-window-minimize'; |
| 36 | pluginIcon = 'collapse-plugin'; |
| 37 | scaffold = { |
| 38 | type: 'collapse', |
| 39 | header: '标题', |
| 40 | body: [ |
| 41 | { |
| 42 | type: 'tpl', |
| 43 | tpl: '内容', |
| 44 | wrapperComponent: '', |
| 45 | inline: false, |
| 46 | id: generateId() |
| 47 | } |
| 48 | ] |
| 49 | }; |
| 50 | previewSchema = { |
| 51 | ...this.scaffold |
| 52 | }; |
| 53 | panelTitle = '折叠器'; |
| 54 | |
| 55 | panelJustify = true; |
| 56 | |
| 57 | events: RendererPluginEvent[] = [ |
| 58 | { |
| 59 | eventName: 'change', |
| 60 | eventLabel: '折叠状态改变', |
| 61 | description: '折叠器折叠状态改变时触发', |
| 62 | dataSchema: [ |
| 63 | { |
| 64 | type: 'object', |
| 65 | properties: { |
| 66 | data: { |
| 67 | type: 'object', |
| 68 | title: '数据', |
| 69 | properties: { |
| 70 | collapsed: { |
| 71 | type: 'boolean', |
| 72 | title: '折叠器状态' |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | ] |
| 79 | }, |
nothing calls this directly
no test coverage detected