| 12 | import {generateId} from '../util'; |
| 13 | |
| 14 | export class ButtonGroupPlugin extends BasePlugin { |
| 15 | static id = 'ButtonGroupPlugin'; |
| 16 | static scene = ['layout']; |
| 17 | // 关联渲染器名字 |
| 18 | rendererName = 'button-group'; |
| 19 | $schema = '/schemas/ButtonGroupSchema.json'; |
| 20 | |
| 21 | // 组件名称 |
| 22 | name = '按钮组'; |
| 23 | isBaseComponent = true; |
| 24 | description = '用来展示多个按钮,视觉上会作为一个整体呈现。'; |
| 25 | tags = ['功能']; |
| 26 | icon = 'fa fa-object-group'; |
| 27 | pluginIcon = 'btn-group-plugin'; |
| 28 | docLink = '/amis/zh-CN/components/button-group'; |
| 29 | scaffold = { |
| 30 | type: 'button-group', |
| 31 | buttons: [ |
| 32 | { |
| 33 | type: 'button', |
| 34 | label: '按钮1', |
| 35 | id: generateId(), |
| 36 | ...BUTTON_DEFAULT_ACTION |
| 37 | }, |
| 38 | |
| 39 | { |
| 40 | type: 'button', |
| 41 | label: '按钮2', |
| 42 | id: generateId(), |
| 43 | ...BUTTON_DEFAULT_ACTION |
| 44 | } |
| 45 | ] |
| 46 | }; |
| 47 | previewSchema = { |
| 48 | ...this.scaffold |
| 49 | }; |
| 50 | |
| 51 | panelTitle = '按钮组'; |
| 52 | |
| 53 | panelJustify = true; |
| 54 | panelBodyCreator = (context: BaseEventContext) => { |
| 55 | return getSchemaTpl('tabs', [ |
| 56 | { |
| 57 | title: '属性', |
| 58 | body: getSchemaTpl('collapseGroup', [ |
| 59 | { |
| 60 | title: '基本', |
| 61 | body: [ |
| 62 | getSchemaTpl('layout:originPosition', {value: 'left-top'}), |
| 63 | { |
| 64 | type: 'button-group-select', |
| 65 | name: 'vertical', |
| 66 | label: '布局方向', |
| 67 | options: [ |
| 68 | { |
| 69 | label: '水平', |
| 70 | value: false |
| 71 | }, |
nothing calls this directly
no test coverage detected