amis-editor 4.1.0-beta.1 → 4.1.0-beta.19
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 +14 -7
- package/dist/component/RendererThumb.d.ts +5 -5
- 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/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/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/.DS_Store +0 -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,428 @@
|
|
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
|
+
BasicPanelItem,
|
9
|
+
BasicToolbarItem,
|
10
|
+
BuildPanelEventContext,
|
11
|
+
PluginInterface
|
12
|
+
} from '../../plugin';
|
13
|
+
import {defaultValue, getSchemaTpl} from '../../component/schemaTpl';
|
14
|
+
import {diff} from '../../util';
|
15
|
+
|
16
|
+
export class ActionPlugin extends BasePlugin {
|
17
|
+
panelTitle = '按钮';
|
18
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
19
|
+
const isInDialog = /(?:\/|^)dialog\/.+$/.test(context.path);
|
20
|
+
const isInDropdown = /(?:\/|^)dropdown-button\/.+$/.test(context.path);
|
21
|
+
|
22
|
+
return [
|
23
|
+
{
|
24
|
+
label: '按钮行为',
|
25
|
+
type: 'select',
|
26
|
+
name: 'actionType',
|
27
|
+
pipeIn: defaultValue(''),
|
28
|
+
options: [
|
29
|
+
{
|
30
|
+
label: '默认',
|
31
|
+
value: ''
|
32
|
+
},
|
33
|
+
{
|
34
|
+
label: '弹框',
|
35
|
+
value: 'dialog'
|
36
|
+
},
|
37
|
+
|
38
|
+
{
|
39
|
+
label: '抽出式弹框(Drawer)',
|
40
|
+
value: 'drawer'
|
41
|
+
},
|
42
|
+
|
43
|
+
{
|
44
|
+
label: '发送请求',
|
45
|
+
value: 'ajax'
|
46
|
+
},
|
47
|
+
|
48
|
+
{
|
49
|
+
label: '下载文件',
|
50
|
+
value: 'download'
|
51
|
+
},
|
52
|
+
|
53
|
+
{
|
54
|
+
label: '页面跳转(单页模式)',
|
55
|
+
value: 'link'
|
56
|
+
},
|
57
|
+
|
58
|
+
{
|
59
|
+
label: '页面跳转',
|
60
|
+
value: 'url'
|
61
|
+
},
|
62
|
+
|
63
|
+
{
|
64
|
+
label: '刷新目标',
|
65
|
+
value: 'reload'
|
66
|
+
},
|
67
|
+
|
68
|
+
{
|
69
|
+
label: '复制内容',
|
70
|
+
value: 'copy'
|
71
|
+
},
|
72
|
+
|
73
|
+
{
|
74
|
+
label: '提交',
|
75
|
+
value: 'submit'
|
76
|
+
},
|
77
|
+
|
78
|
+
{
|
79
|
+
label: '重置',
|
80
|
+
value: 'reset'
|
81
|
+
},
|
82
|
+
|
83
|
+
{
|
84
|
+
label: '重置表单并提交',
|
85
|
+
value: 'reset-and-submit'
|
86
|
+
},
|
87
|
+
|
88
|
+
{
|
89
|
+
label: '清空表单并提交',
|
90
|
+
value: 'clear-and-submit'
|
91
|
+
},
|
92
|
+
|
93
|
+
{
|
94
|
+
label: '确认',
|
95
|
+
value: 'confirm'
|
96
|
+
},
|
97
|
+
|
98
|
+
{
|
99
|
+
label: '取消',
|
100
|
+
value: 'cancel'
|
101
|
+
},
|
102
|
+
|
103
|
+
{
|
104
|
+
label: '跳转下一条',
|
105
|
+
value: 'next'
|
106
|
+
},
|
107
|
+
|
108
|
+
{
|
109
|
+
label: '跳转上一条',
|
110
|
+
value: 'prev'
|
111
|
+
}
|
112
|
+
]
|
113
|
+
},
|
114
|
+
|
115
|
+
{
|
116
|
+
type: 'input-text',
|
117
|
+
name: 'content',
|
118
|
+
visibleOn: 'data.actionType == "copy"',
|
119
|
+
label: '复制内容模板'
|
120
|
+
},
|
121
|
+
|
122
|
+
{
|
123
|
+
type: 'select',
|
124
|
+
name: 'copyFormat',
|
125
|
+
options: [
|
126
|
+
{
|
127
|
+
label: '纯文本',
|
128
|
+
value: 'text/plain'
|
129
|
+
},
|
130
|
+
{
|
131
|
+
label: '富文本',
|
132
|
+
value: 'text/html'
|
133
|
+
}
|
134
|
+
],
|
135
|
+
visibleOn: 'data.actionType == "copy"',
|
136
|
+
label: '复制格式'
|
137
|
+
},
|
138
|
+
|
139
|
+
{
|
140
|
+
type: 'input-text',
|
141
|
+
name: 'target',
|
142
|
+
visibleOn: 'data.actionType == "reload"',
|
143
|
+
label: '指定刷新目标',
|
144
|
+
required: true
|
145
|
+
},
|
146
|
+
|
147
|
+
{
|
148
|
+
name: 'dialog',
|
149
|
+
pipeIn: defaultValue({
|
150
|
+
title: '弹框标题',
|
151
|
+
body: '<p>对,你刚刚点击了</p>'
|
152
|
+
}),
|
153
|
+
asFormItem: true,
|
154
|
+
children: ({value, onChange, data}: any) =>
|
155
|
+
data.actionType === 'dialog' ? (
|
156
|
+
<Button
|
157
|
+
size="sm"
|
158
|
+
level="danger"
|
159
|
+
className="m-b"
|
160
|
+
onClick={() =>
|
161
|
+
this.manager.openSubEditor({
|
162
|
+
title: '配置弹框内容',
|
163
|
+
value: {type: 'dialog', ...value},
|
164
|
+
onChange: value => onChange(value)
|
165
|
+
})
|
166
|
+
}
|
167
|
+
block
|
168
|
+
>
|
169
|
+
配置弹框内容
|
170
|
+
</Button>
|
171
|
+
) : null
|
172
|
+
},
|
173
|
+
|
174
|
+
{
|
175
|
+
visibleOn: 'data.actionType == "drawer"',
|
176
|
+
name: 'drawer',
|
177
|
+
pipeIn: defaultValue({
|
178
|
+
title: '弹框标题',
|
179
|
+
body: '<p>对,你刚刚点击了</p>'
|
180
|
+
}),
|
181
|
+
asFormItem: true,
|
182
|
+
children: ({value, onChange, data}: any) =>
|
183
|
+
data.actionType == 'drawer' ? (
|
184
|
+
<Button
|
185
|
+
size="sm"
|
186
|
+
level="danger"
|
187
|
+
className="m-b"
|
188
|
+
onClick={() =>
|
189
|
+
this.manager.openSubEditor({
|
190
|
+
title: '配置抽出式弹框内容',
|
191
|
+
value: {type: 'drawer', ...value},
|
192
|
+
onChange: value => onChange(value)
|
193
|
+
})
|
194
|
+
}
|
195
|
+
block
|
196
|
+
>
|
197
|
+
配置抽出式弹框内容
|
198
|
+
</Button>
|
199
|
+
) : null
|
200
|
+
},
|
201
|
+
|
202
|
+
getSchemaTpl('api', {
|
203
|
+
label: '目标API',
|
204
|
+
visibleOn: 'data.actionType == "ajax" || data.actionType == "download"'
|
205
|
+
}),
|
206
|
+
|
207
|
+
{
|
208
|
+
name: 'feedback',
|
209
|
+
pipeIn: defaultValue({
|
210
|
+
title: '弹框标题',
|
211
|
+
body: '<p>内容</p>'
|
212
|
+
}),
|
213
|
+
asFormItem: true,
|
214
|
+
children: ({onChange, value, data}: any) =>
|
215
|
+
data.actionType == 'ajax' ? (
|
216
|
+
<div className="m-b">
|
217
|
+
<Button
|
218
|
+
size="sm"
|
219
|
+
level={value ? 'danger' : 'info'}
|
220
|
+
onClick={() =>
|
221
|
+
this.manager.openSubEditor({
|
222
|
+
title: '配置反馈弹框详情',
|
223
|
+
value: {type: 'dialog', ...value},
|
224
|
+
onChange: value => onChange(value)
|
225
|
+
})
|
226
|
+
}
|
227
|
+
>
|
228
|
+
配置反馈弹框内容
|
229
|
+
</Button>
|
230
|
+
|
231
|
+
{value ? (
|
232
|
+
<Button
|
233
|
+
size="sm"
|
234
|
+
level="link"
|
235
|
+
className="m-l"
|
236
|
+
onClick={() => onChange('')}
|
237
|
+
>
|
238
|
+
清空设置
|
239
|
+
</Button>
|
240
|
+
) : null}
|
241
|
+
</div>
|
242
|
+
) : null
|
243
|
+
},
|
244
|
+
|
245
|
+
{
|
246
|
+
name: 'feedback.visibleOn',
|
247
|
+
label: '是否弹出表达式',
|
248
|
+
type: 'input-text',
|
249
|
+
visibleOn: 'this.feedback',
|
250
|
+
autoComplete: false,
|
251
|
+
description: '请使用 JS 表达式如:`this.xxx == 1`'
|
252
|
+
},
|
253
|
+
|
254
|
+
{
|
255
|
+
name: 'feedback.skipRestOnCancel',
|
256
|
+
label: '弹框取消是否中断后续操作',
|
257
|
+
type: 'switch',
|
258
|
+
mode: 'inline',
|
259
|
+
className: 'block',
|
260
|
+
visibleOn: 'this.feedback'
|
261
|
+
},
|
262
|
+
|
263
|
+
{
|
264
|
+
name: 'feedback.skipRestOnConfirm',
|
265
|
+
label: '弹框确认是否中断后续操作',
|
266
|
+
type: 'switch',
|
267
|
+
mode: 'inline',
|
268
|
+
className: 'block',
|
269
|
+
visibleOn: 'this.feedback'
|
270
|
+
},
|
271
|
+
|
272
|
+
{
|
273
|
+
type: 'input-text',
|
274
|
+
label: '目标地址',
|
275
|
+
name: 'link',
|
276
|
+
visibleOn: 'data.actionType == "link"'
|
277
|
+
},
|
278
|
+
|
279
|
+
{
|
280
|
+
type: 'input-text',
|
281
|
+
label: '目标地址',
|
282
|
+
name: 'url',
|
283
|
+
visibleOn: 'data.actionType == "url"',
|
284
|
+
placeholder: 'http://'
|
285
|
+
},
|
286
|
+
|
287
|
+
{
|
288
|
+
type: 'switch',
|
289
|
+
name: 'blank',
|
290
|
+
visibleOn: 'data.actionType == "url"',
|
291
|
+
mode: 'inline',
|
292
|
+
className: 'w-full',
|
293
|
+
label: '是否用新窗口打开',
|
294
|
+
pipeIn: defaultValue(true)
|
295
|
+
},
|
296
|
+
|
297
|
+
isInDialog
|
298
|
+
? {
|
299
|
+
visibleOn: 'data.actionType == "submit" || data.type == "submit"',
|
300
|
+
name: 'close',
|
301
|
+
type: 'switch',
|
302
|
+
mode: 'inline',
|
303
|
+
className: 'w-full',
|
304
|
+
pipeIn: defaultValue(true),
|
305
|
+
label: '是否关闭当前弹框'
|
306
|
+
}
|
307
|
+
: null,
|
308
|
+
|
309
|
+
{
|
310
|
+
name: 'confirmText',
|
311
|
+
type: 'textarea',
|
312
|
+
label: '确认文案',
|
313
|
+
description: '点击后会弹出此内容,等用户确认后才进行相应的操作。'
|
314
|
+
},
|
315
|
+
|
316
|
+
{
|
317
|
+
type: 'input-text',
|
318
|
+
name: 'reload',
|
319
|
+
label: '刷新目标组件',
|
320
|
+
visibleOn: 'data.actionType != "link" && data.actionType != "url"',
|
321
|
+
description:
|
322
|
+
'当前动作完成后,指定目标组件刷新。支持传递数据如:<code>xxx?a=\\${a}&b=\\${b}</code>,多个目标请用英文逗号隔开。'
|
323
|
+
},
|
324
|
+
|
325
|
+
{
|
326
|
+
type: 'input-text',
|
327
|
+
name: 'target',
|
328
|
+
visibleOn: 'data.actionType != "reload"',
|
329
|
+
label: '指定响应组件',
|
330
|
+
description:
|
331
|
+
'指定动作执行者,默认为当前组件所在的功能性性组件,如果指定则转交给目标组件来处理。'
|
332
|
+
},
|
333
|
+
|
334
|
+
{
|
335
|
+
type: 'js-editor',
|
336
|
+
allowFullscreen: true,
|
337
|
+
name: 'onClick',
|
338
|
+
label: '自定义点击事件',
|
339
|
+
description: '将会传递 event 和 props 两个参数'
|
340
|
+
},
|
341
|
+
|
342
|
+
{
|
343
|
+
type: 'input-text',
|
344
|
+
name: 'hotKey',
|
345
|
+
label: '键盘快捷键'
|
346
|
+
}
|
347
|
+
];
|
348
|
+
};
|
349
|
+
|
350
|
+
buildEditorPanel(
|
351
|
+
context: BuildPanelEventContext,
|
352
|
+
panels: Array<BasicPanelItem>
|
353
|
+
) {
|
354
|
+
// 多选时不处理
|
355
|
+
if (context.selections.length) {
|
356
|
+
return;
|
357
|
+
}
|
358
|
+
|
359
|
+
if (
|
360
|
+
~['action', 'button', 'submit', 'reset', 'sparkline'].indexOf(
|
361
|
+
context.info!.renderer.name!
|
362
|
+
)
|
363
|
+
) {
|
364
|
+
let body: any = this.panelBodyCreator(context);
|
365
|
+
|
366
|
+
// sparkline 的 action 配置是放 clickAction 参数下的,所以需要加一层
|
367
|
+
if (context.info.renderer.name === 'sparkline') {
|
368
|
+
body = {
|
369
|
+
name: 'clickAction',
|
370
|
+
type: 'combo',
|
371
|
+
label: '',
|
372
|
+
noBorder: true,
|
373
|
+
multiLine: true,
|
374
|
+
items: body
|
375
|
+
};
|
376
|
+
}
|
377
|
+
|
378
|
+
panels.push({
|
379
|
+
key: 'action',
|
380
|
+
icon: 'fa fa-gavel',
|
381
|
+
title: '动作',
|
382
|
+
render: this.manager.makeSchemaFormRender({
|
383
|
+
body: body
|
384
|
+
}),
|
385
|
+
order: 100
|
386
|
+
});
|
387
|
+
} else {
|
388
|
+
super.buildEditorPanel(context, panels);
|
389
|
+
}
|
390
|
+
}
|
391
|
+
|
392
|
+
buildEditorToolbar(
|
393
|
+
{id, schema, info}: BaseEventContext,
|
394
|
+
toolbars: Array<BasicToolbarItem>
|
395
|
+
) {
|
396
|
+
if (
|
397
|
+
~['action', 'button', 'submit', 'reset'].indexOf(info!.renderer.name!) &&
|
398
|
+
schema.actionType === 'dialog'
|
399
|
+
) {
|
400
|
+
toolbars.push({
|
401
|
+
iconSvg: 'dialog',
|
402
|
+
tooltip: `配置弹框内容`,
|
403
|
+
placement: 'bottom',
|
404
|
+
onClick: () => this.editDetail(id)
|
405
|
+
});
|
406
|
+
}
|
407
|
+
}
|
408
|
+
|
409
|
+
editDetail(id: string) {
|
410
|
+
const manager = this.manager;
|
411
|
+
const store = manager.store;
|
412
|
+
const node = store.getNodeById(id);
|
413
|
+
const value = store.getValueOf(id);
|
414
|
+
|
415
|
+
node &&
|
416
|
+
value &&
|
417
|
+
this.manager.openSubEditor({
|
418
|
+
title: '配置弹框内容',
|
419
|
+
value: {type: 'dialog', ...value.dialog},
|
420
|
+
onChange: newValue => {
|
421
|
+
newValue = {...value, dialog: newValue};
|
422
|
+
manager.panelChangeValue(newValue, diff(value, newValue));
|
423
|
+
}
|
424
|
+
});
|
425
|
+
}
|
426
|
+
}
|
427
|
+
|
428
|
+
registerEditorPlugin(ActionPlugin);
|