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