amis-editor 4.1.0-beta.4 → 4.2.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. package/dist/component/Breadcrumb.d.ts +23 -2
  2. package/dist/component/ClassNameControl.d.ts +1 -1
  3. package/dist/component/Control/APIControl.d.ts +2 -2
  4. package/dist/component/Control/OptionControl.d.ts +3 -3
  5. package/dist/component/Control/PopoverEdit.d.ts +4 -4
  6. package/dist/component/Control/ValidationControl.d.ts +1 -1
  7. package/dist/component/Editor.d.ts +20 -1
  8. package/dist/component/IFramePreview.d.ts +2 -1
  9. package/dist/component/NodeWrapper.d.ts +1 -1
  10. package/dist/component/Panel/RenderersPanel.d.ts +1 -2
  11. package/dist/component/Preview.d.ts +3 -1
  12. package/dist/component/RegionWrapper.d.ts +4 -0
  13. package/dist/component/ScaffoldModal.d.ts +1 -1
  14. package/dist/component/VRenderer.d.ts +4 -0
  15. package/dist/component/base/InputComponentName.d.ts +1 -1
  16. package/dist/component/base/SearchCustomRendererPanel.d.ts +15 -0
  17. package/dist/component/base/SearchPanel.d.ts +83 -0
  18. package/dist/component/base/SearchRendererPanel.d.ts +2 -42
  19. package/dist/component/base/ShortcutKey.d.ts +23 -0
  20. package/dist/env.d.ts +1 -1
  21. package/dist/exports.min.js +1 -1
  22. package/dist/index.d.ts +5 -1
  23. package/dist/index.min.js +1 -1
  24. package/dist/manager.d.ts +16 -4
  25. package/dist/plugin/Alert.d.ts +1 -1
  26. package/dist/plugin/Button.d.ts +1 -1
  27. package/dist/plugin/Card.d.ts +1 -0
  28. package/dist/plugin/Cards.d.ts +2 -1
  29. package/dist/plugin/Carousel.d.ts +1 -0
  30. package/dist/plugin/Chart.d.ts +1 -0
  31. package/dist/plugin/Collapse.d.ts +1 -0
  32. package/dist/plugin/Custom.d.ts +3 -0
  33. package/dist/plugin/CustomRegion.d.ts +40 -0
  34. package/dist/plugin/Dialog.d.ts +1 -1
  35. package/dist/plugin/Drawer.d.ts +1 -1
  36. package/dist/plugin/DropDownButton.d.ts +1 -1
  37. package/dist/plugin/Each.d.ts +1 -1
  38. package/dist/plugin/Flex.d.ts +1 -0
  39. package/dist/plugin/Form/Control.d.ts +1 -0
  40. package/dist/plugin/Form/Form.d.ts +19 -3
  41. package/dist/plugin/Form/Formula.d.ts +3 -3
  42. package/dist/plugin/Form/InputURL.d.ts +1 -0
  43. package/dist/plugin/Form/Switch.d.ts +2 -0
  44. package/dist/plugin/Grid.d.ts +1 -0
  45. package/dist/plugin/HBox.d.ts +1 -0
  46. package/dist/plugin/IFrame.d.ts +3 -3
  47. package/dist/plugin/Json.d.ts +1 -0
  48. package/dist/plugin/List.d.ts +2 -1
  49. package/dist/plugin/Mapping.d.ts +1 -0
  50. package/dist/plugin/Markdown.d.ts +1 -0
  51. package/dist/plugin/Nav.d.ts +1 -0
  52. package/dist/plugin/Page.d.ts +1 -1
  53. package/dist/plugin/Panel/Outline.d.ts +8 -0
  54. package/dist/plugin/Progress.d.ts +1 -0
  55. package/dist/plugin/QRCode.d.ts +1 -0
  56. package/dist/plugin/Reset.d.ts +0 -1
  57. package/dist/plugin/Service.d.ts +1 -0
  58. package/dist/plugin/Sparkline.d.ts +1 -0
  59. package/dist/plugin/Status.d.ts +1 -0
  60. package/dist/plugin/Steps.d.ts +1 -0
  61. package/dist/plugin/Submit.d.ts +0 -1
  62. package/dist/plugin/Table.d.ts +1 -1
  63. package/dist/plugin/TableView.d.ts +1 -0
  64. package/dist/plugin/Tasks.d.ts +1 -0
  65. package/dist/plugin/TooltipWrapper.d.ts +1 -0
  66. package/dist/plugin/Video.d.ts +1 -0
  67. package/dist/plugin/WebComponent.d.ts +1 -0
  68. package/dist/plugin/Wizard.d.ts +11 -2
  69. package/dist/plugin/Wrapper.d.ts +1 -0
  70. package/dist/plugin.d.ts +8 -7
  71. package/dist/store/editor.d.ts +58 -22
  72. package/dist/store/node.d.ts +6 -0
  73. package/dist/style.css +1 -1
  74. package/dist/util.d.ts +1 -1
  75. package/package.json +9 -3
  76. package/src/component/schemaTpl.tsx +2157 -0
  77. package/src/plugin/Alert.tsx +87 -0
  78. package/src/plugin/AnchorNav.tsx +233 -0
  79. package/src/plugin/Audio.tsx +154 -0
  80. package/src/plugin/Avatar.tsx +77 -0
  81. package/src/plugin/Breadcrumb.tsx +107 -0
  82. package/src/plugin/Button.tsx +281 -0
  83. package/src/plugin/ButtonGroup.tsx +85 -0
  84. package/src/plugin/ButtonToolbar.tsx +87 -0
  85. package/src/plugin/CRUD.tsx +1835 -0
  86. package/src/plugin/Card.tsx +290 -0
  87. package/src/plugin/Cards.tsx +318 -0
  88. package/src/plugin/Carousel.tsx +377 -0
  89. package/src/plugin/Chart.tsx +218 -0
  90. package/src/plugin/CodeView.tsx +60 -0
  91. package/src/plugin/Collapse.tsx +136 -0
  92. package/src/plugin/CollapseGroup.tsx +167 -0
  93. package/src/plugin/Container.tsx +40 -0
  94. package/src/plugin/Custom.tsx +128 -0
  95. package/src/plugin/CustomRegion.tsx +156 -0
  96. package/src/plugin/Date.tsx +74 -0
  97. package/src/plugin/Datetime.tsx +68 -0
  98. package/src/plugin/Dialog.tsx +176 -0
  99. package/src/plugin/Divider.tsx +36 -0
  100. package/src/plugin/Drawer.tsx +214 -0
  101. package/src/plugin/DropDownButton.tsx +235 -0
  102. package/src/plugin/Each.tsx +150 -0
  103. package/src/plugin/ErrorRenderer.tsx +15 -0
  104. package/src/plugin/Flex.tsx +151 -0
  105. package/src/plugin/Form/ButtonGroupSelect.tsx +75 -0
  106. package/src/plugin/Form/ButtonToolbar.tsx +110 -0
  107. package/src/plugin/Form/ChainedSelect.tsx +70 -0
  108. package/src/plugin/Form/Checkbox.tsx +87 -0
  109. package/src/plugin/Form/Checkboxes.tsx +167 -0
  110. package/src/plugin/Form/CodeEditor.tsx +81 -0
  111. package/src/plugin/Form/Combo.tsx +582 -0
  112. package/src/plugin/Form/ConditionBuilder.tsx +315 -0
  113. package/src/plugin/Form/Control.tsx +139 -0
  114. package/src/plugin/Form/DiffEditor.tsx +111 -0
  115. package/src/plugin/Form/FieldSet.tsx +163 -0
  116. package/src/plugin/Form/Form.tsx +687 -0
  117. package/src/plugin/Form/Formula.tsx +79 -0
  118. package/src/plugin/Form/Group.tsx +295 -0
  119. package/src/plugin/Form/Hidden.tsx +44 -0
  120. package/src/plugin/Form/InputArray.tsx +228 -0
  121. package/src/plugin/Form/InputCity.tsx +93 -0
  122. package/src/plugin/Form/InputColor.tsx +123 -0
  123. package/src/plugin/Form/InputDate.tsx +175 -0
  124. package/src/plugin/Form/InputDateRange.tsx +225 -0
  125. package/src/plugin/Form/InputDateTime.tsx +183 -0
  126. package/src/plugin/Form/InputDateTimeRange.tsx +221 -0
  127. package/src/plugin/Form/InputEmail.tsx +33 -0
  128. package/src/plugin/Form/InputExcel.tsx +85 -0
  129. package/src/plugin/Form/InputFile.tsx +221 -0
  130. package/src/plugin/Form/InputGroup.tsx +96 -0
  131. package/src/plugin/Form/InputImage.tsx +266 -0
  132. package/src/plugin/Form/InputKV.tsx +72 -0
  133. package/src/plugin/Form/InputMonth.tsx +35 -0
  134. package/src/plugin/Form/InputMonthRange.tsx +195 -0
  135. package/src/plugin/Form/InputNumber.tsx +89 -0
  136. package/src/plugin/Form/InputPassword.tsx +33 -0
  137. package/src/plugin/Form/InputQuarter.tsx +35 -0
  138. package/src/plugin/Form/InputQuarterRange.tsx +195 -0
  139. package/src/plugin/Form/InputRange.tsx +121 -0
  140. package/src/plugin/Form/InputRating.tsx +78 -0
  141. package/src/plugin/Form/InputRepeat.tsx +57 -0
  142. package/src/plugin/Form/InputRichText.tsx +186 -0
  143. package/src/plugin/Form/InputSubForm.tsx +189 -0
  144. package/src/plugin/Form/InputTable.tsx +434 -0
  145. package/src/plugin/Form/InputTag.tsx +70 -0
  146. package/src/plugin/Form/InputText.tsx +186 -0
  147. package/src/plugin/Form/InputTime.tsx +85 -0
  148. package/src/plugin/Form/InputTree.tsx +229 -0
  149. package/src/plugin/Form/InputURL.tsx +34 -0
  150. package/src/plugin/Form/InputYear.tsx +35 -0
  151. package/src/plugin/Form/Item.tsx +327 -0
  152. package/src/plugin/Form/ListSelect.tsx +73 -0
  153. package/src/plugin/Form/LocationPicker.tsx +62 -0
  154. package/src/plugin/Form/MatrixCheckboxes.tsx +136 -0
  155. package/src/plugin/Form/NestedSelect.tsx +211 -0
  156. package/src/plugin/Form/Picker.tsx +209 -0
  157. package/src/plugin/Form/Radios.tsx +119 -0
  158. package/src/plugin/Form/Select.tsx +233 -0
  159. package/src/plugin/Form/Static.tsx +322 -0
  160. package/src/plugin/Form/Switch.tsx +107 -0
  161. package/src/plugin/Form/TabsTransfer.tsx +259 -0
  162. package/src/plugin/Form/Textarea.tsx +83 -0
  163. package/src/plugin/Form/Transfer.tsx +368 -0
  164. package/src/plugin/Form/TreeSelect.tsx +263 -0
  165. package/src/plugin/Form/UUID.tsx +48 -0
  166. package/src/plugin/Grid.tsx +798 -0
  167. package/src/plugin/HBox.tsx +727 -0
  168. package/src/plugin/IFrame.tsx +70 -0
  169. package/src/plugin/Image.tsx +314 -0
  170. package/src/plugin/Images.tsx +231 -0
  171. package/src/plugin/Json.tsx +69 -0
  172. package/src/plugin/Link.tsx +93 -0
  173. package/src/plugin/List.tsx +278 -0
  174. package/src/plugin/ListItem.tsx +229 -0
  175. package/src/plugin/Log.tsx +52 -0
  176. package/src/plugin/Mapping.tsx +149 -0
  177. package/src/plugin/Markdown.tsx +47 -0
  178. package/src/plugin/Nav.tsx +184 -0
  179. package/src/plugin/Operation.tsx +95 -0
  180. package/src/plugin/Others/Action.tsx +426 -0
  181. package/src/plugin/Others/BasicToolbar.tsx +585 -0
  182. package/src/plugin/Others/DataDebug.tsx +134 -0
  183. package/src/plugin/Others/TableCell.tsx +480 -0
  184. package/src/plugin/Others/Unknown.tsx +37 -0
  185. package/src/plugin/Page.tsx +306 -0
  186. package/src/plugin/Panel/AvailableRenderers.tsx +41 -0
  187. package/src/plugin/Panel/Code.tsx +44 -0
  188. package/src/plugin/Panel/Name.tsx +26 -0
  189. package/src/plugin/Panel/Outline.tsx +40 -0
  190. package/src/plugin/Panel.tsx +243 -0
  191. package/src/plugin/Plain.tsx +84 -0
  192. package/src/plugin/Progress.tsx +125 -0
  193. package/src/plugin/Property.tsx +139 -0
  194. package/src/plugin/QRCode.tsx +96 -0
  195. package/src/plugin/Reset.tsx +23 -0
  196. package/src/plugin/Service.tsx +162 -0
  197. package/src/plugin/Sparkline.tsx +40 -0
  198. package/src/plugin/Status.tsx +76 -0
  199. package/src/plugin/Steps.tsx +128 -0
  200. package/src/plugin/Submit.tsx +23 -0
  201. package/src/plugin/Table.tsx +428 -0
  202. package/src/plugin/TableView.tsx +709 -0
  203. package/src/plugin/Tabs.tsx +362 -0
  204. package/src/plugin/Tasks.tsx +274 -0
  205. package/src/plugin/Time.tsx +68 -0
  206. package/src/plugin/TooltipWrapper.tsx +193 -0
  207. package/src/plugin/Tpl.tsx +158 -0
  208. package/src/plugin/Video.tsx +158 -0
  209. package/src/plugin/WebComponent.tsx +53 -0
  210. package/src/plugin/Wizard.tsx +740 -0
  211. package/src/plugin/Wrapper.tsx +107 -0
  212. package/src/plugin.ts +1050 -0
  213. package/dist/150a58f3318ca7541ed9.png +0 -0
  214. package/dist/471adb97c322b226e589.png +0 -0
  215. package/dist/4de5f42360bc5946c3c2.png +0 -0
  216. package/dist/4e9968bba3855f088fed.png +0 -0
  217. package/dist/7f09c38ebc687fea847a.png +0 -0
  218. package/dist/c94073576487510314ea.png +0 -0
@@ -0,0 +1,281 @@
1
+ import {registerEditorPlugin} from '../manager';
2
+ import {
3
+ BaseEventContext,
4
+ BasePlugin,
5
+ BasicRendererInfo,
6
+ PluginInterface,
7
+ RendererInfoResolveEventContext
8
+ } from '../plugin';
9
+ import {getSchemaTpl} from '../component/schemaTpl';
10
+ import {SchemaObject} from 'amis/lib/Schema';
11
+
12
+ export class ButtonPlugin extends BasePlugin {
13
+ // 关联渲染器名字
14
+ rendererName = 'button';
15
+ $schema = '/schemas/ActionSchema.json';
16
+
17
+ // 组件名称
18
+ name = '按钮';
19
+ isBaseComponent = true;
20
+ description =
21
+ '用来展示一个按钮,你可以配置不同的展示样式,配置不同的点击行为。';
22
+ docLink = '/amis/zh-CN/components/button';
23
+ tags = ['按钮'];
24
+ icon = 'fa fa-square';
25
+ scaffold: SchemaObject = {
26
+ type: 'button',
27
+ label: '按钮',
28
+ actionType: 'dialog',
29
+ dialog: {
30
+ title: '系统提示',
31
+ body: '对你点击了'
32
+ }
33
+ };
34
+ previewSchema: any = {
35
+ type: 'button',
36
+ label: '按钮'
37
+ };
38
+
39
+ panelTitle = '按钮';
40
+ panelBodyCreator = (context: BaseEventContext) => {
41
+ const isInDialog = /(?:\/|^)dialog\/.+$/.test(context.path);
42
+ const isInDropdown = /(?:\/|^)dropdown-button\/.+$/.test(context.path);
43
+
44
+ return [
45
+ getSchemaTpl('tabs', [
46
+ {
47
+ title: '常规',
48
+ body: [
49
+ {
50
+ label: '名称',
51
+ type: 'input-text',
52
+ name: 'label'
53
+ },
54
+
55
+ {
56
+ label: '类型',
57
+ type: 'button-group-select',
58
+ name: 'type',
59
+ size: 'sm',
60
+ // mode: 'inline',
61
+ // className: 'w-full',
62
+ options: [
63
+ {
64
+ label: '按钮',
65
+ value: 'button'
66
+ },
67
+
68
+ {
69
+ label: '提交',
70
+ value: 'submit'
71
+ },
72
+
73
+ {
74
+ label: '重置',
75
+ value: 'reset'
76
+ }
77
+ ]
78
+ },
79
+
80
+ {
81
+ type: 'input-text',
82
+ name: 'tooltip',
83
+ hidden: isInDropdown,
84
+ label: '提示文案',
85
+ description: '鼠标停留时弹出该内容'
86
+ },
87
+
88
+ {
89
+ type: 'button-group-select',
90
+ name: 'tooltipPlacement',
91
+ visibleOn: 'data.tooltip || data.disabledTip',
92
+ label: '提示信息位置',
93
+ size: 'sm',
94
+ mode: 'inline',
95
+ className: 'w-full',
96
+ value: 'bottom',
97
+ options: [
98
+ {
99
+ label: '上',
100
+ value: 'top'
101
+ },
102
+ {
103
+ label: '右',
104
+ value: 'right'
105
+ },
106
+ {
107
+ label: '下',
108
+ value: 'bottom'
109
+ },
110
+ {
111
+ label: '左',
112
+ value: 'left'
113
+ }
114
+ ]
115
+ },
116
+
117
+ getSchemaTpl('icon'),
118
+ {
119
+ type: 'button-group-select',
120
+ label: '图标位置',
121
+ clearable: true,
122
+ visibleOn: 'this.icon',
123
+ name: 'iconClassName',
124
+ size: 'sm',
125
+ pipeIn: (value: any) =>
126
+ typeof value === 'string' &&
127
+ /\bpull\-(left|right)\b/.test(value)
128
+ ? RegExp.$1
129
+ : '',
130
+ pipeOut: (value: any, originValue: string) => {
131
+ return ((originValue as string) || '')
132
+ .replace(/\bpull\-(left|right)\b/, '')
133
+ .trim() + value
134
+ ? `pull-${value}`
135
+ : '';
136
+ },
137
+ options: [
138
+ {label: '居左', value: 'left'},
139
+ {label: '居右', value: 'right'}
140
+ ]
141
+ },
142
+
143
+ getSchemaTpl('size', {
144
+ label: '尺寸'
145
+ }),
146
+ {
147
+ label: '样式',
148
+ type: 'select',
149
+ name: 'level',
150
+ hidden: isInDropdown,
151
+ clearable: false,
152
+ btnActiveLevel: '',
153
+ options: [
154
+ {
155
+ label: '默认',
156
+ value: 'default',
157
+ level: 'default'
158
+ },
159
+ {
160
+ label: '链接',
161
+ value: 'link',
162
+ level: 'link'
163
+ },
164
+ {
165
+ label: '主色',
166
+ value: 'primary',
167
+ level: 'primary'
168
+ },
169
+
170
+ {
171
+ label: '淡色',
172
+ value: 'light',
173
+ level: 'light'
174
+ },
175
+ {
176
+ label: '深色',
177
+ value: 'dark',
178
+ level: 'dark'
179
+ },
180
+
181
+ {
182
+ label: '提示',
183
+ value: 'info',
184
+ level: 'info'
185
+ },
186
+ {
187
+ label: '成功',
188
+ value: 'success',
189
+ level: 'success'
190
+ },
191
+ {
192
+ label: '警告',
193
+ value: 'warning',
194
+ level: 'warning'
195
+ },
196
+ {
197
+ label: '严重',
198
+ value: 'danger',
199
+ level: 'danger'
200
+ }
201
+ ]
202
+ },
203
+
204
+ {
205
+ name: 'block',
206
+ type: 'switch',
207
+ label: '块状显示',
208
+ mode: 'inline'
209
+ },
210
+
211
+ getSchemaTpl('className', {
212
+ label: '按钮 CSS 类名'
213
+ }),
214
+ getSchemaTpl('className', {
215
+ name: 'iconClassName',
216
+ label: '图标 CSS 类名',
217
+ visibleOn: 'this.icon'
218
+ })
219
+ ]
220
+ },
221
+ {
222
+ title: '显隐',
223
+ body: [
224
+ getSchemaTpl('disabled', [
225
+ {
226
+ type: 'input-text',
227
+ name: 'disabledTip',
228
+ label: '禁用提示信息',
229
+ hidden: isInDropdown,
230
+ description: '按钮被禁用时,鼠标停留弹出该段文字'
231
+ }
232
+ ]),
233
+ getSchemaTpl('visible')
234
+ ]
235
+ }
236
+ ])
237
+ ];
238
+ };
239
+
240
+ /**
241
+ * 如果禁用了没办法编辑
242
+ */
243
+ filterProps(props: any) {
244
+ props.disabled = false;
245
+ return props;
246
+ }
247
+
248
+ /**
249
+ * 如果配置里面有 rendererName 自动返回渲染器信息。
250
+ * @param renderer
251
+ */
252
+ getRendererInfo({
253
+ renderer,
254
+ schema
255
+ }: RendererInfoResolveEventContext): BasicRendererInfo | void {
256
+ const plugin: PluginInterface = this;
257
+
258
+ if (
259
+ schema.$$id &&
260
+ plugin.name &&
261
+ plugin.rendererName &&
262
+ plugin.rendererName === renderer.name
263
+ ) {
264
+ // 复制部分信息出去
265
+ return {
266
+ name: schema.label ? schema.label : plugin.name,
267
+ regions: plugin.regions,
268
+ patchContainers: plugin.patchContainers,
269
+ // wrapper: plugin.wrapper,
270
+ vRendererConfig: plugin.vRendererConfig,
271
+ wrapperProps: plugin.wrapperProps,
272
+ wrapperResolve: plugin.wrapperResolve,
273
+ filterProps: plugin.filterProps,
274
+ $schema: plugin.$schema,
275
+ renderRenderer: plugin.renderRenderer
276
+ };
277
+ }
278
+ }
279
+ }
280
+
281
+ registerEditorPlugin(ButtonPlugin);
@@ -0,0 +1,85 @@
1
+ import {registerEditorPlugin} from '../manager';
2
+ import {BasePlugin, RegionConfig} from '../plugin';
3
+
4
+ export class ButtonGroupPlugin extends BasePlugin {
5
+ // 关联渲染器名字
6
+ rendererName = 'button-group';
7
+ $schema = '/schemas/ButtonGroupSchema.json';
8
+
9
+ // 组件名称
10
+ name = '按钮组';
11
+ isBaseComponent = true;
12
+ description = '用来展示多个按钮,视觉上会作为一个整体呈现。';
13
+ tags = ['按钮'];
14
+ icon = 'fa fa-object-group';
15
+ docLink = '/amis/zh-CN/components/button-group';
16
+ scaffold = {
17
+ type: 'button-group',
18
+ buttons: [
19
+ {
20
+ type: 'button',
21
+ label: '按钮1',
22
+ actionType: 'dialog',
23
+ dialog: {
24
+ title: '系统提示',
25
+ body: '对你点击了'
26
+ }
27
+ },
28
+
29
+ {
30
+ type: 'button',
31
+ label: '按钮2',
32
+ actionType: 'dialog',
33
+ dialog: {
34
+ title: '系统提示',
35
+ body: '对你点击了'
36
+ }
37
+ }
38
+ ]
39
+ };
40
+ previewSchema = {
41
+ ...this.scaffold
42
+ };
43
+
44
+ panelTitle = '按钮组';
45
+ panelBody = [
46
+ {
47
+ name: 'buttons',
48
+ type: 'combo',
49
+ label: '按钮管理',
50
+ multiple: true,
51
+ addable: true,
52
+ minLength: 1,
53
+ draggable: true,
54
+ draggableTip: '',
55
+ editable: false,
56
+ visibleOn: 'this.buttons && this.buttons.length',
57
+ items: [
58
+ {
59
+ type: 'tpl',
60
+ inline: false,
61
+ className: 'p-t-xs',
62
+ tpl:
63
+ '<span class="label label-default"><% if (data.type === "button-group") { %> 按钮组 <% } else { %><%= data.label %><% if (data.icon) { %><i class="<%= data.icon %>"/><% }%><% } %></span>'
64
+ }
65
+ ],
66
+ addButtonText: '新增按钮',
67
+ scaffold: {
68
+ type: 'button',
69
+ label: '按钮'
70
+ }
71
+ }
72
+ ];
73
+
74
+ regions: Array<RegionConfig> = [
75
+ {
76
+ key: 'buttons',
77
+ label: '子按钮',
78
+ renderMethod: 'render',
79
+ preferTag: '按钮',
80
+ insertPosition: 'inner'
81
+ }
82
+ ];
83
+ }
84
+
85
+ registerEditorPlugin(ButtonGroupPlugin);
@@ -0,0 +1,87 @@
1
+ import {BasePlugin} from '../plugin';
2
+ import {getSchemaTpl} from '../component/schemaTpl';
3
+
4
+ export class ButtonToolbarPlugin extends BasePlugin {
5
+ // 关联渲染器名字
6
+ rendererName = 'button-toolbar';
7
+ $schema = '/schemas/ButtonToolbarSchema.json';
8
+
9
+ // 组件名称
10
+ name = '按钮工具栏';
11
+ isBaseComponent = true;
12
+ description = '可以用来放置多个按钮或者按钮组,按钮之间会存在一定的间隔';
13
+ tags = ['按钮'];
14
+ icon = 'fa fa-ellipsis-h';
15
+ scaffold = {
16
+ type: 'button-toolbar',
17
+ buttons: [
18
+ {
19
+ type: 'button',
20
+ label: '按钮1',
21
+ actionType: 'dialog',
22
+ dialog: {
23
+ title: '系统提示',
24
+ body: '对你点击了'
25
+ }
26
+ },
27
+ {
28
+ type: 'button',
29
+ label: '按钮2',
30
+ actionType: 'dialog',
31
+ dialog: {
32
+ title: '系统提示',
33
+ body: '对你点击了'
34
+ }
35
+ }
36
+ ]
37
+ };
38
+ previewSchema = {
39
+ ...this.scaffold
40
+ };
41
+
42
+ panelTitle = '按钮工具栏';
43
+ panelBody = [
44
+ getSchemaTpl('tabs', [
45
+ {
46
+ title: '常规',
47
+ body: [
48
+ {
49
+ name: 'buttons',
50
+ type: 'combo',
51
+ label: '按钮管理',
52
+ multiple: true,
53
+ addable: true,
54
+ draggable: true,
55
+ draggableTip: '可排序、可移除、如要编辑请在预览区选中编辑',
56
+ editable: false,
57
+ visibleOn: 'this.buttons && this.buttons.length',
58
+ items: [
59
+ {
60
+ type: 'tpl',
61
+ inline: false,
62
+ className: 'p-t-xs',
63
+ tpl:
64
+ '<span class="label label-default"><% if (data.type === "button-group") { %> 按钮组 <% } else { %><%= data.label %><% if (data.icon) { %><i class="<%= data.icon %>"/><% }%><% } %></span>'
65
+ }
66
+ ],
67
+ addButtonText: '新增按钮',
68
+ scaffold: {
69
+ type: 'button',
70
+ label: '按钮'
71
+ }
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ title: '外观',
77
+ body: [getSchemaTpl('className')]
78
+ },
79
+ {
80
+ title: '显隐',
81
+ body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
82
+ }
83
+ ])
84
+ ];
85
+ }
86
+ // 和plugin/Form/ButtonToolbar.tsx的重复了
87
+ // registerEditorPlugin(ButtonToolbarPlugin);