amis-editor 4.2.0-beta.2 → 5.1.9-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/6dbcbb49b6fd405190a9.png +0 -0
  2. package/dist/component/Editor.d.ts +16 -0
  3. package/dist/component/RegionWrapper.d.ts +10 -0
  4. package/dist/component/VRenderer.d.ts +10 -0
  5. package/dist/component/base/BackTop.d.ts +1 -1
  6. package/dist/component/control/APIControl.d.ts +1158 -0
  7. package/dist/component/control/ActionAPIControl.d.ts +1158 -0
  8. package/dist/component/control/BadgeControl.d.ts +133 -0
  9. package/dist/component/control/BaseControl.d.ts +248 -0
  10. package/dist/component/control/DataBindingControl.d.ts +14 -0
  11. package/dist/component/control/DataPickerControl.d.ts +13 -0
  12. package/dist/component/control/DateShortCutControl.d.ts +83 -0
  13. package/dist/component/control/FormulaControl.d.ts +51 -0
  14. package/dist/component/{Control → control}/OptionControl.d.ts +23 -34
  15. package/dist/component/{Control → control}/PopoverEdit.d.ts +0 -0
  16. package/dist/component/control/StatusControl.d.ts +44 -0
  17. package/dist/component/control/SwitchMoreControl.d.ts +224 -0
  18. package/dist/component/control/ValidationControl.d.ts +65 -0
  19. package/dist/component/control/ValidationItem.d.ts +46 -0
  20. package/dist/component/control/style-control/Background.d.ts +17 -0
  21. package/dist/component/control/style-control/Border.d.ts +18 -0
  22. package/dist/component/control/style-control/BoxModel.d.ts +17 -0
  23. package/dist/component/control/style-control/BoxShadow.d.ts +18 -0
  24. package/dist/component/control/style-control/Display.d.ts +14 -0
  25. package/dist/component/control/style-control/Font.d.ts +16 -0
  26. package/dist/component/control/style-control/font-family.d.ts +11 -0
  27. package/dist/component/control/style-control/transformation.d.ts +29 -0
  28. package/dist/component/control/style-control/types.d.ts +8 -0
  29. package/dist/component/schemaTpl.d.ts +8 -0
  30. package/dist/component/validator.d.ts +62 -0
  31. package/dist/dnd/index.d.ts +1 -1
  32. package/dist/event-action/action-config-panel.d.ts +8 -0
  33. package/dist/event-action/actions.d.ts +3 -0
  34. package/dist/event-action/comp-action-select.d.ts +11 -0
  35. package/dist/event-action/config.d.ts +13 -0
  36. package/dist/event-action/index.d.ts +459 -0
  37. package/dist/event-action/schema.d.ts +32 -0
  38. package/dist/exports.min.js +1 -1
  39. package/dist/index.d.ts +23 -5
  40. package/dist/index.min.js +1 -1
  41. package/dist/manager.d.ts +46 -1
  42. package/dist/plugin/Alert.d.ts +4 -2
  43. package/dist/plugin/Button.d.ts +5 -1
  44. package/dist/plugin/ButtonGroup.d.ts +13 -34
  45. package/dist/plugin/ButtonToolbar.d.ts +4 -10
  46. package/dist/plugin/CRUD.d.ts +2 -0
  47. package/dist/plugin/Chart.d.ts +2 -0
  48. package/dist/plugin/Collapse.d.ts +1 -0
  49. package/dist/plugin/CollapseGroup.d.ts +28 -4
  50. package/dist/plugin/Container.d.ts +2 -1
  51. package/dist/plugin/Dialog.d.ts +12 -2
  52. package/dist/plugin/Drawer.d.ts +12 -2
  53. package/dist/plugin/DropDownButton.d.ts +11 -11
  54. package/dist/plugin/Form/ButtonGroupSelect.d.ts +7 -2
  55. package/dist/plugin/Form/ButtonToolbar.d.ts +8 -7
  56. package/dist/plugin/Form/ChainedSelect.d.ts +3 -0
  57. package/dist/plugin/Form/Checkbox.d.ts +7 -2
  58. package/dist/plugin/Form/Checkboxes.d.ts +8 -2
  59. package/dist/plugin/Form/CodeEditor.d.ts +7 -22
  60. package/dist/plugin/Form/Combo.d.ts +3 -0
  61. package/dist/plugin/Form/Control.d.ts +6 -2
  62. package/dist/plugin/Form/DiffEditor.d.ts +7 -1
  63. package/dist/plugin/Form/Form.d.ts +6 -0
  64. package/dist/plugin/Form/Formula.d.ts +1 -25
  65. package/dist/plugin/Form/InputDate.d.ts +8 -2
  66. package/dist/plugin/Form/InputDateRange.d.ts +8 -2
  67. package/dist/plugin/Form/InputDateTime.d.ts +4 -4
  68. package/dist/plugin/Form/InputDateTimeRange.d.ts +4 -4
  69. package/dist/plugin/Form/InputEmail.d.ts +1 -0
  70. package/dist/plugin/Form/InputExcel.d.ts +6 -41
  71. package/dist/plugin/Form/InputFile.d.ts +7 -3
  72. package/dist/plugin/Form/InputKV.d.ts +6 -0
  73. package/dist/plugin/Form/InputMonth.d.ts +1 -0
  74. package/dist/plugin/Form/InputMonthRange.d.ts +4 -4
  75. package/dist/plugin/Form/InputPassword.d.ts +1 -0
  76. package/dist/plugin/Form/InputQuarter.d.ts +1 -0
  77. package/dist/plugin/Form/InputQuarterRange.d.ts +4 -4
  78. package/dist/plugin/Form/InputRange.d.ts +3 -0
  79. package/dist/plugin/Form/InputRating.d.ts +9 -3
  80. package/dist/plugin/Form/InputText.d.ts +24 -2
  81. package/dist/plugin/Form/InputTime.d.ts +3 -3
  82. package/dist/plugin/Form/InputTimeRange.d.ts +20 -0
  83. package/dist/plugin/Form/InputTree.d.ts +6 -2
  84. package/dist/plugin/Form/InputURL.d.ts +1 -0
  85. package/dist/plugin/Form/InputYear.d.ts +1 -0
  86. package/dist/plugin/Form/InputYearRange.d.ts +20 -0
  87. package/dist/plugin/Form/ListSelect.d.ts +6 -2
  88. package/dist/plugin/Form/LocationPicker.d.ts +1 -31
  89. package/dist/plugin/Form/NestedSelect.d.ts +5 -2
  90. package/dist/plugin/Form/Radios.d.ts +7 -2
  91. package/dist/plugin/Form/Select.d.ts +7 -2
  92. package/dist/plugin/Form/Switch.d.ts +7 -2
  93. package/dist/plugin/Form/TabsTransfer.d.ts +5 -2
  94. package/dist/plugin/Form/Textarea.d.ts +7 -1
  95. package/dist/plugin/Form/Transfer.d.ts +5 -2
  96. package/dist/plugin/Form/TreeSelect.d.ts +6 -2
  97. package/dist/plugin/IFrame.d.ts +2 -2
  98. package/dist/plugin/Nav.d.ts +1 -116
  99. package/dist/plugin/Others/Action.d.ts +5 -1
  100. package/dist/plugin/Page.d.ts +5 -2
  101. package/dist/plugin/Progress.d.ts +5 -1
  102. package/dist/plugin/Table.d.ts +2 -0
  103. package/dist/plugin/Tabs.d.ts +33 -2
  104. package/dist/plugin/TooltipWrapper.d.ts +10 -0
  105. package/dist/plugin/Tpl.d.ts +2 -1
  106. package/dist/plugin/Wizard.d.ts +4 -1
  107. package/dist/plugin.d.ts +37 -1
  108. package/dist/store/editor.d.ts +55 -28
  109. package/dist/store/node.d.ts +16 -0
  110. package/dist/style.css +1 -1
  111. package/dist/util.d.ts +36 -3
  112. package/package.json +14 -8
  113. package/src/component/schemaTpl.tsx +1209 -474
  114. package/src/plugin/Alert.tsx +69 -48
  115. package/src/plugin/AnchorNav.tsx +1 -0
  116. package/src/plugin/Audio.tsx +9 -15
  117. package/src/plugin/Avatar.tsx +2 -1
  118. package/src/plugin/Breadcrumb.tsx +2 -1
  119. package/src/plugin/Button.tsx +257 -188
  120. package/src/plugin/ButtonGroup.tsx +99 -38
  121. package/src/plugin/ButtonToolbar.tsx +7 -13
  122. package/src/plugin/CRUD.tsx +78 -136
  123. package/src/plugin/Card.tsx +1 -0
  124. package/src/plugin/Cards.tsx +8 -14
  125. package/src/plugin/Carousel.tsx +1 -1
  126. package/src/plugin/Chart.tsx +26 -14
  127. package/src/plugin/Collapse.tsx +78 -78
  128. package/src/plugin/CollapseGroup.tsx +165 -83
  129. package/src/plugin/Container.tsx +59 -6
  130. package/src/plugin/Custom.tsx +2 -8
  131. package/src/plugin/CustomRegion.tsx +4 -3
  132. package/src/plugin/Dialog.tsx +55 -24
  133. package/src/plugin/Drawer.tsx +65 -35
  134. package/src/plugin/DropDownButton.tsx +95 -79
  135. package/src/plugin/Flex.tsx +123 -65
  136. package/src/plugin/Form/ButtonGroupSelect.tsx +114 -26
  137. package/src/plugin/Form/ButtonToolbar.tsx +62 -55
  138. package/src/plugin/Form/ChainedSelect.tsx +45 -0
  139. package/src/plugin/Form/Checkbox.tsx +122 -33
  140. package/src/plugin/Form/Checkboxes.tsx +154 -87
  141. package/src/plugin/Form/CodeEditor.tsx +163 -34
  142. package/src/plugin/Form/Combo.tsx +104 -65
  143. package/src/plugin/Form/Control.tsx +16 -70
  144. package/src/plugin/Form/DiffEditor.tsx +158 -54
  145. package/src/plugin/Form/FieldSet.tsx +6 -11
  146. package/src/plugin/Form/Form.tsx +277 -70
  147. package/src/plugin/Form/Formula.tsx +8 -14
  148. package/src/plugin/Form/InputArray.tsx +7 -16
  149. package/src/plugin/Form/InputCity.tsx +1 -1
  150. package/src/plugin/Form/InputDate.tsx +344 -121
  151. package/src/plugin/Form/InputDateRange.tsx +303 -161
  152. package/src/plugin/Form/InputDateTime.tsx +6 -150
  153. package/src/plugin/Form/InputDateTimeRange.tsx +7 -187
  154. package/src/plugin/Form/InputEmail.tsx +1 -0
  155. package/src/plugin/Form/InputExcel.tsx +70 -27
  156. package/src/plugin/Form/InputFile.tsx +326 -152
  157. package/src/plugin/Form/InputImage.tsx +1 -1
  158. package/src/plugin/Form/InputKV.tsx +61 -0
  159. package/src/plugin/Form/InputMonth.tsx +3 -1
  160. package/src/plugin/Form/InputMonthRange.tsx +6 -160
  161. package/src/plugin/Form/InputNumber.tsx +1 -1
  162. package/src/plugin/Form/InputPassword.tsx +2 -0
  163. package/src/plugin/Form/InputQuarter.tsx +3 -1
  164. package/src/plugin/Form/InputQuarterRange.tsx +6 -160
  165. package/src/plugin/Form/InputRange.tsx +74 -4
  166. package/src/plugin/Form/InputRating.tsx +347 -35
  167. package/src/plugin/Form/InputRichText.tsx +2 -3
  168. package/src/plugin/Form/InputTable.tsx +33 -49
  169. package/src/plugin/Form/InputTag.tsx +1 -1
  170. package/src/plugin/Form/InputText.tsx +310 -132
  171. package/src/plugin/Form/InputTime.tsx +4 -53
  172. package/src/plugin/Form/InputTimeRange.tsx +41 -0
  173. package/src/plugin/Form/InputTree.tsx +196 -46
  174. package/src/plugin/Form/InputURL.tsx +2 -0
  175. package/src/plugin/Form/InputYear.tsx +2 -0
  176. package/src/plugin/Form/InputYearRange.tsx +41 -0
  177. package/src/plugin/Form/Item.tsx +17 -18
  178. package/src/plugin/Form/ListSelect.tsx +75 -20
  179. package/src/plugin/Form/LocationPicker.tsx +2 -7
  180. package/src/plugin/Form/MatrixCheckboxes.tsx +1 -1
  181. package/src/plugin/Form/NestedSelect.tsx +110 -43
  182. package/src/plugin/Form/Picker.tsx +2 -5
  183. package/src/plugin/Form/Radios.tsx +122 -52
  184. package/src/plugin/Form/Select.tsx +239 -168
  185. package/src/plugin/Form/Static.tsx +1 -1
  186. package/src/plugin/Form/Switch.tsx +170 -58
  187. package/src/plugin/Form/TabsTransfer.tsx +175 -79
  188. package/src/plugin/Form/Textarea.tsx +146 -36
  189. package/src/plugin/Form/Transfer.tsx +295 -233
  190. package/src/plugin/Form/TreeSelect.tsx +287 -146
  191. package/src/plugin/Grid.tsx +340 -312
  192. package/src/plugin/HBox.tsx +1 -0
  193. package/src/plugin/IFrame.tsx +21 -12
  194. package/src/plugin/Image.tsx +7 -12
  195. package/src/plugin/Images.tsx +7 -12
  196. package/src/plugin/Link.tsx +6 -12
  197. package/src/plugin/List.tsx +6 -10
  198. package/src/plugin/ListItem.tsx +1 -0
  199. package/src/plugin/Nav.tsx +7 -9
  200. package/src/plugin/Others/Action.tsx +16 -10
  201. package/src/plugin/Others/BasicToolbar.tsx +4 -1
  202. package/src/plugin/Others/TableCell.tsx +19 -39
  203. package/src/plugin/Page.tsx +315 -229
  204. package/src/plugin/Panel.tsx +6 -7
  205. package/src/plugin/Plain.tsx +3 -6
  206. package/src/plugin/Progress.tsx +234 -94
  207. package/src/plugin/Service.tsx +10 -6
  208. package/src/plugin/Table.tsx +49 -20
  209. package/src/plugin/TableView.tsx +212 -106
  210. package/src/plugin/Tabs.tsx +306 -146
  211. package/src/plugin/TooltipWrapper.tsx +231 -135
  212. package/src/plugin/Tpl.tsx +68 -52
  213. package/src/plugin/Video.tsx +9 -20
  214. package/src/plugin/Wizard.tsx +537 -336
  215. package/src/plugin/Wrapper.tsx +82 -61
  216. package/src/plugin.ts +66 -4
  217. package/static/empty.png +0 -0
  218. package/dist/component/Control/APIControl.d.ts +0 -504
  219. package/dist/component/Control/ValidationControl.d.ts +0 -30
  220. package/dist/component/remarkTpl.d.ts +0 -150
@@ -11,6 +11,10 @@ import React from 'react';
11
11
  import {VRenderer} from '../component/VRenderer';
12
12
  import {mapReactElement} from '../component/factory';
13
13
  import {RegionWrapper as Region} from '../component/RegionWrapper';
14
+ import {getComboWrapper} from '../event-action/schema';
15
+
16
+ import {getEventControlConfig} from '../util';
17
+ import {RendererAction, RendererEvent} from '../event-action';
14
18
 
15
19
  export class WizardPlugin extends BasePlugin {
16
20
  // 关联渲染器名字
@@ -74,357 +78,555 @@ export class WizardPlugin extends BasePlugin {
74
78
  ]
75
79
  };
76
80
 
81
+ // 事件定义
82
+ events: RendererEvent[] = [
83
+ {
84
+ eventName: 'inited',
85
+ eventLabel: '初始化完成',
86
+ description: '远程初始化接口请求成功时触发',
87
+ dataSchema: [
88
+ {
89
+ type: 'object',
90
+ properties: {
91
+ 'event.data': {
92
+ type: 'object',
93
+ title: 'initApi 远程请求返回的初始化数据'
94
+ }
95
+ }
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ eventName: 'finished',
101
+ eventLabel: '点击完成',
102
+ description: '最终提交时触发',
103
+ dataSchema: [
104
+ {
105
+ type: 'object',
106
+ properties: {
107
+ 'event.data': {
108
+ type: 'object',
109
+ title: '提交的表单数据'
110
+ }
111
+ }
112
+ }
113
+ ]
114
+ },
115
+ {
116
+ eventName: 'stepChange',
117
+ eventLabel: '步骤切换',
118
+ description: '切换步骤时触发',
119
+ dataSchema: [
120
+ {
121
+ type: 'object',
122
+ properties: {
123
+ 'event.data.step': {
124
+ type: 'string',
125
+ title: '步骤索引'
126
+ }
127
+ }
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ eventName: 'change',
133
+ eventLabel: '数值变化',
134
+ description: '表单值变化时触发',
135
+ dataSchema: [
136
+ {
137
+ type: 'object',
138
+ properties: {
139
+ 'event.data': {
140
+ type: 'object',
141
+ title: '当前表单数据'
142
+ }
143
+ }
144
+ }
145
+ ]
146
+ },
147
+ {
148
+ eventName: 'submitSucc',
149
+ eventLabel: '提交成功',
150
+ description: '最终提交成功时触发',
151
+ dataSchema: [
152
+ {
153
+ type: 'object',
154
+ properties: {
155
+ 'event.data': {
156
+ type: 'object',
157
+ title: '提交成功后返回的数据'
158
+ }
159
+ }
160
+ }
161
+ ]
162
+ },
163
+ {
164
+ eventName: 'submitFail',
165
+ eventLabel: '提交失败',
166
+ description: '最终提交失败时触发',
167
+ dataSchema: [
168
+ {
169
+ type: 'object',
170
+ properties: {
171
+ 'event.data.error': {
172
+ type: 'object',
173
+ title: '提交失败后返回的错误信息'
174
+ }
175
+ }
176
+ }
177
+ ]
178
+ },
179
+ {
180
+ eventName: 'stepSubmitSucc',
181
+ eventLabel: '步骤提交成功',
182
+ description: '单个步骤提交成功'
183
+ },
184
+ {
185
+ eventName: 'stepSubmitFail',
186
+ eventLabel: '步骤提交失败',
187
+ description: '单个步骤提交失败',
188
+ dataSchema: [
189
+ {
190
+ type: 'object',
191
+ properties: {
192
+ 'event.data.error': {
193
+ type: 'object',
194
+ title: '单个步骤提交失败后返回的错误信息'
195
+ }
196
+ }
197
+ }
198
+ ]
199
+ }
200
+ ];
201
+
202
+ // 动作定义
203
+ actions: RendererAction[] = [
204
+ {
205
+ actionType: 'submit',
206
+ actionLabel: '全部提交',
207
+ description: '提交全部数据'
208
+ },
209
+ {
210
+ actionType: 'stepSubmit',
211
+ actionLabel: '分步提交',
212
+ description: '提交当前步骤数据',
213
+ desc: (info: any) => {
214
+ return (
215
+ <div>
216
+ <span className="variable-right">{info?.__rendererLabel}</span>
217
+ 提交当前步骤数据
218
+ </div>
219
+ );
220
+ }
221
+ },
222
+ {
223
+ actionType: 'prev',
224
+ actionLabel: '上一步',
225
+ description: '返回上一步'
226
+ },
227
+ {
228
+ actionType: 'next',
229
+ actionLabel: '下一步',
230
+ description: '提交当前步骤数据'
231
+ },
232
+ {
233
+ actionType: 'goto-step',
234
+ actionLabel: '定位步骤',
235
+ description: '切换到指定步骤',
236
+ config: ['step'],
237
+ desc: (info: any) => {
238
+ return (
239
+ <div>
240
+ <span className="variable-right">{info?.__rendererLabel}</span>
241
+ 切换到第
242
+ <span className="variable-left variable-right">
243
+ {info?.args?.step}
244
+ </span>
245
+
246
+ </div>
247
+ );
248
+ },
249
+ schema: getComboWrapper([
250
+ {
251
+ type: 'input-formula',
252
+ variables: '${variables}',
253
+ evalMode: false,
254
+ required: true,
255
+ variableMode: 'tabs',
256
+ label: '目标步骤',
257
+ size: 'lg',
258
+ name: 'step',
259
+ mode: 'horizontal'
260
+ }
261
+ ])
262
+ },
263
+ {
264
+ actionType: 'reload',
265
+ actionLabel: '重新加载',
266
+ description: '触发组件数据刷新并重新渲染'
267
+ },
268
+ {
269
+ actionType: 'setValue',
270
+ actionLabel: '更新数据',
271
+ description: '触发组件数据更新'
272
+ }
273
+ ];
274
+
77
275
  panelTitle = '向导';
78
- panelBody = [
79
- getSchemaTpl('tabs', [
80
- {
81
- title: '常规',
82
- body: [
83
- {
84
- name: 'steps',
85
- label: '步骤设置',
86
- type: 'combo',
87
- multiple: true,
88
- multiLine: true,
89
- addButtonText: '新增一步',
90
- scaffold: {
91
- title: '标题',
276
+ panelBodyCreator = (context: BaseEventContext) => {
277
+ return [
278
+ getSchemaTpl('tabs', [
279
+ {
280
+ title: '常规',
281
+ body: [
282
+ {
283
+ name: 'steps',
284
+ label: '步骤设置',
285
+ type: 'combo',
286
+ multiple: true,
287
+ multiLine: true,
288
+ addButtonText: '新增一步',
289
+ scaffold: {
290
+ title: '标题',
291
+ items: [
292
+ {
293
+ type: 'input-text',
294
+ name: 'var1',
295
+ label: '文本'
296
+ }
297
+ ]
298
+ },
92
299
  items: [
93
300
  {
301
+ name: 'title',
94
302
  type: 'input-text',
95
- name: 'var1',
96
- label: '文本'
303
+ label: '标题',
304
+ pipeIn: (value: any, data: any) => value || data.label
305
+ },
306
+
307
+ {
308
+ type: 'fieldSet',
309
+ title: '其他设置',
310
+ collapsed: true,
311
+ collapsable: true,
312
+ className: 'fieldset m-b-none',
313
+ body: [
314
+ {
315
+ name: 'mode',
316
+ label: '展示模式',
317
+ type: 'button-group-select',
318
+ size: 'xs',
319
+ mode: 'inline',
320
+ className: 'w-full',
321
+ value: 'normal',
322
+ options: [
323
+ {
324
+ label: '默认',
325
+ value: 'normal'
326
+ },
327
+ {
328
+ label: '左右摆放',
329
+ value: 'horizontal'
330
+ },
331
+ {
332
+ label: '内联',
333
+ value: 'inline'
334
+ }
335
+ ]
336
+ },
337
+
338
+ getSchemaTpl('horizontal', {
339
+ visibleOn: 'data.mode == "horizontal"'
340
+ }),
341
+
342
+ getSchemaTpl('api', {
343
+ label: '保存接口',
344
+ description:
345
+ '如果接口返回了 <code>step</code> 变量,且数值是数字类型,比如 <code>3</code>,提交完后回跳到第 3 步'
346
+ }),
347
+
348
+ getSchemaTpl('switch', {
349
+ label: '采用异步方式?',
350
+ name: 'asyncApi',
351
+ visibleOn: 'data.api',
352
+ labelRemark: {
353
+ trigger: 'click',
354
+ rootClose: true,
355
+ title: '什么是异步方式?',
356
+ content:
357
+ '异步方式主要用来解决请求超时问题,启用异步方式后,程序会在请求完后,定时轮询请求额外的接口用来咨询操作是否完成。所以接口可以快速的返回,而不需要等待流程真正完成。',
358
+ placement: 'left'
359
+ },
360
+ pipeIn: (value: any) => value != null,
361
+ pipeOut: (value: any) => (value ? '' : undefined)
362
+ }),
363
+
364
+ getSchemaTpl('api', {
365
+ name: 'asyncApi',
366
+ label: '异步检测接口',
367
+ visibleOn: 'data.asyncApi != null',
368
+ description:
369
+ '设置此属性后,表单提交发送保存接口后,还会继续轮训请求该接口,直到返回 finished 属性为 true 才 结束'
370
+ }),
371
+
372
+ {
373
+ type: 'divider'
374
+ },
375
+
376
+ getSchemaTpl('api', {
377
+ name: 'initApi',
378
+ label: '初始化接口',
379
+ description: '用来初始化表单数据'
380
+ }),
381
+
382
+ getSchemaTpl('switch', {
383
+ label: '采用异步方式?',
384
+ name: 'initAsyncApi',
385
+ visibleOn: 'data.initApi',
386
+ labelRemark: {
387
+ trigger: 'click',
388
+ rootClose: true,
389
+ title: '什么是异步方式?',
390
+ content:
391
+ '异步方式主要用来解决请求超时问题,启用异步方式后,程序会在请求完后,定时轮询请求额外的接口用来咨询操作是否完成。所以接口可以快速的返回,而不需要等待流程真正完成。',
392
+ placement: 'left'
393
+ },
394
+ pipeIn: (value: any) => value != null,
395
+ pipeOut: (value: any) => (value ? '' : undefined)
396
+ }),
397
+
398
+ getSchemaTpl('api', {
399
+ name: 'initAsyncApi',
400
+ label: '异步检测接口',
401
+ visibleOn: 'data.initAsyncApi != null',
402
+ description:
403
+ '设置此属性后,表单请求 initApi 后,还会继续轮训请求该接口,直到返回 finished 属性为 true 才 结束'
404
+ }),
405
+
406
+ getSchemaTpl('initFetch'),
407
+
408
+ {
409
+ label: '是否可被点开',
410
+ type: 'input-text',
411
+ name: 'jumpableOn',
412
+ description:
413
+ '用表达式来决定,当前步骤是否可被点开。额外可用变量:currentStep 表示当前步骤。'
414
+ }
415
+ ]
97
416
  }
98
417
  ]
99
418
  },
100
- items: [
101
- {
102
- name: 'title',
103
- type: 'input-text',
104
- label: '标题',
105
- pipeIn: (value: any, data: any) => value || data.label
106
- },
419
+ {
420
+ type: 'input-text',
421
+ name: 'startStep',
422
+ label: '起始默认值',
423
+ description:
424
+ '从第几步开始。可支持模版,但是只有在组件创建时渲染模版并设置当前步数,在之后组件被刷新时,当前step不会根据startStep改变'
425
+ }
426
+ ]
427
+ },
107
428
 
108
- {
109
- type: 'fieldSet',
110
- title: '其他设置',
111
- collapsed: true,
112
- collapsable: true,
113
- className: 'fieldset m-b-none',
114
- body: [
115
- {
116
- name: 'mode',
117
- label: '展示模式',
118
- type: 'button-group-select',
119
- size: 'xs',
120
- mode: 'inline',
121
- className: 'w-full',
122
- value: 'normal',
123
- options: [
124
- {
125
- label: '默认',
126
- value: 'normal'
127
- },
128
- {
129
- label: '左右摆放',
130
- value: 'horizontal'
131
- },
132
- {
133
- label: '内联',
134
- value: 'inline'
135
- }
136
- ]
137
- },
138
-
139
- getSchemaTpl('horizontal', {
140
- visibleOn: 'data.mode == "horizontal"'
141
- }),
142
-
143
- getSchemaTpl('api', {
144
- label: '保存接口',
145
- description:
146
- '如果接口返回了 <code>step</code> 变量,且数值是数字类型,比如 <code>3</code>,提交完后回跳到第 3 步'
147
- }),
429
+ {
430
+ title: '接口',
431
+ body: [
432
+ getSchemaTpl('api', {
433
+ name: 'initApi',
434
+ label: '初始化接口',
435
+ description:
436
+ '用来初始化向导数据,当接口中返回 <code>step</code> 字段时,可以控制默认跳转到第几步,注意数值一定得是数字类型。当返回 <code>submiting</code> 并且当前步骤中存在异步保存接口时,可以让 wizard 初始进入异步提交状态。'
437
+ }),
148
438
 
149
- {
150
- label: '采用异步方式?',
151
- remark: {
152
- trigger: 'click',
153
- rootClose: true,
154
- title: '什么是异步方式?',
155
- content:
156
- '异步方式主要用来解决请求超时问题,启用异步方式后,程序会在请求完后,定时轮询请求额外的接口用来咨询操作是否完成。所以接口可以快速的返回,而不需要等待流程真正完成。',
157
- placement: 'left'
158
- },
159
- type: 'switch',
160
- name: 'asyncApi',
161
- visibleOn: 'data.api',
162
- pipeIn: (value: any) => value != null,
163
- pipeOut: (value: any) => (value ? '' : undefined),
164
- mode: 'inline',
165
- className: 'block'
166
- },
167
-
168
- getSchemaTpl('api', {
169
- name: 'asyncApi',
170
- label: '异步检测接口',
171
- visibleOn: 'data.asyncApi != null',
172
- description:
173
- '设置此属性后,表单提交发送保存接口后,还会继续轮训请求该接口,直到返回 finished 属性为 true 才 结束'
174
- }),
439
+ getSchemaTpl('switch', {
440
+ label: '采用异步方式?',
441
+ name: 'initAsyncApi',
442
+ visibleOn: 'data.initApi',
443
+ labelRemark: {
444
+ trigger: 'click',
445
+ rootClose: true,
446
+ title: '什么是异步方式?',
447
+ content:
448
+ '异步方式主要用来解决请求超时问题,启用异步方式后,程序会在请求完后,定时轮询请求额外的接口用来咨询操作是否完成。所以接口可以快速的返回,而不需要等待流程真正完成。',
449
+ placement: 'left'
450
+ },
175
451
 
176
- {
177
- type: 'divider'
178
- },
452
+ pipeIn: (value: any) => value != null,
453
+ pipeOut: (value: any) => (value ? '' : undefined)
454
+ }),
179
455
 
180
- getSchemaTpl('api', {
181
- name: 'initApi',
182
- label: '初始化接口',
183
- description: '用来初始化表单数据'
184
- }),
456
+ getSchemaTpl('api', {
457
+ name: 'initAsyncApi',
458
+ label: '异步检测接口',
459
+ visibleOn: 'data.initAsyncApi != null',
460
+ description:
461
+ '设置此属性后,表单请求 initApi 后,还会继续轮训请求该接口,直到返回 finished 属性为 true 才 结束'
462
+ }),
185
463
 
186
- {
187
- label: '采用异步方式?',
188
- remark: {
189
- trigger: 'click',
190
- rootClose: true,
191
- title: '什么是异步方式?',
192
- content:
193
- '异步方式主要用来解决请求超时问题,启用异步方式后,程序会在请求完后,定时轮询请求额外的接口用来咨询操作是否完成。所以接口可以快速的返回,而不需要等待流程真正完成。',
194
- placement: 'left'
195
- },
196
- type: 'switch',
197
- name: 'initAsyncApi',
198
- visibleOn: 'data.initApi',
199
- pipeIn: (value: any) => value != null,
200
- pipeOut: (value: any) => (value ? '' : undefined),
201
- mode: 'inline',
202
- className: 'block'
203
- },
204
-
205
- getSchemaTpl('api', {
206
- name: 'initAsyncApi',
207
- label: '异步检测接口',
208
- visibleOn: 'data.initAsyncApi != null',
209
- description:
210
- '设置此属性后,表单请求 initApi 后,还会继续轮训请求该接口,直到返回 finished 属性为 true 才 结束'
211
- }),
212
-
213
- getSchemaTpl('initFetch'),
464
+ {
465
+ name: 'initFetch',
466
+ type: 'radios',
467
+ label: '是否初始拉取',
468
+ inline: true,
469
+ onChange: () => {},
470
+ options: [
471
+ {
472
+ label: '',
473
+ value: true
474
+ },
214
475
 
215
- {
216
- label: '是否可被点开',
217
- type: 'input-text',
218
- name: 'jumpableOn',
219
- description:
220
- '用表达式来决定,当前步骤是否可被点开。额外可用变量:currentStep 表示当前步骤。'
221
- }
222
- ]
223
- }
224
- ]
225
- },
226
- {
227
- type: 'input-text',
228
- name: 'startStep',
229
- label: '起始默认值',
230
- description:
231
- '从第几步开始。可支持模版,但是只有在组件创建时渲染模版并设置当前步数,在之后组件被刷新时,当前step不会根据startStep改变'
232
- }
233
- ]
234
- },
476
+ {
477
+ label: '',
478
+ value: false
479
+ },
235
480
 
236
- {
237
- title: '接口',
238
- body: [
239
- getSchemaTpl('api', {
240
- name: 'initApi',
241
- label: '初始化接口',
242
- description:
243
- '用来初始化向导数据,当接口中返回 <code>step</code> 字段时,可以控制默认跳转到第几步,注意数值一定得是数字类型。当返回 <code>submiting</code> 并且当前步骤中存在异步保存接口时,可以让 wizard 初始进入异步提交状态。'
244
- }),
481
+ {
482
+ label: '表达式',
483
+ value: ''
484
+ }
485
+ ]
486
+ },
245
487
 
246
- {
247
- label: '采用异步方式?',
248
- remark: {
249
- trigger: 'click',
250
- rootClose: true,
251
- title: '什么是异步方式?',
252
- content:
253
- '异步方式主要用来解决请求超时问题,启用异步方式后,程序会在请求完后,定时轮询请求额外的接口用来咨询操作是否完成。所以接口可以快速的返回,而不需要等待流程真正完成。',
254
- placement: 'left'
488
+ {
489
+ name: 'initFetch',
490
+ autoComplete: false,
491
+ visibleOn: 'typeof this.initFetch !== "boolean"',
492
+ type: 'input-text',
493
+ placeholder: '',
494
+ className: 'm-t-n-sm'
255
495
  },
256
- type: 'switch',
257
- name: 'initAsyncApi',
258
- visibleOn: 'data.initApi',
259
- pipeIn: (value: any) => value != null,
260
- pipeOut: (value: any) => (value ? '' : undefined),
261
- mode: 'inline'
262
- },
263
-
264
- getSchemaTpl('api', {
265
- name: 'initAsyncApi',
266
- label: '异步检测接口',
267
- visibleOn: 'data.initAsyncApi != null',
268
- description:
269
- '设置此属性后,表单请求 initApi 后,还会继续轮训请求该接口,直到返回 finished 属性为 true 才 结束'
270
- }),
271
496
 
272
- {
273
- name: 'initFetch',
274
- type: 'radios',
275
- label: '是否初始拉取',
276
- inline: true,
277
- onChange: () => {},
278
- options: [
279
- {
280
- label: '是',
281
- value: true
282
- },
497
+ {
498
+ type: 'divider'
499
+ },
283
500
 
284
- {
285
- label: '',
286
- value: false
287
- },
501
+ getSchemaTpl('api', {
502
+ label: '保存接口',
503
+ description:
504
+ '用来保存表单数据, 最后一步点击完成触发,<code>如果最后一步中已经设置保存接口,则此处设置无效。</code>'
505
+ }),
288
506
 
289
- {
290
- label: '表达式',
291
- value: ''
292
- }
293
- ]
294
- },
507
+ getSchemaTpl('switch', {
508
+ label: '采用异步方式?',
509
+ name: 'asyncApi',
510
+ visibleOn: 'data.api',
511
+ labelRemark: {
512
+ trigger: 'click',
513
+ rootClose: true,
514
+ title: '什么是异步方式?',
515
+ content:
516
+ '异步方式主要用来解决请求超时问题,启用异步方式后,程序会在请求完后,定时轮询请求额外的接口用来咨询操作是否完成。所以接口可以快速的返回,而不需要等待流程真正完成。',
517
+ placement: 'left'
518
+ },
519
+ pipeIn: (value: any) => value != null,
520
+ pipeOut: (value: any) => (value ? '' : undefined)
521
+ }),
295
522
 
296
- {
297
- name: 'initFetch',
298
- autoComplete: false,
299
- visibleOn: 'typeof this.initFetch !== "boolean"',
300
- type: 'input-text',
301
- placeholder: '',
302
- className: 'm-t-n-sm'
303
- },
523
+ getSchemaTpl('api', {
524
+ name: 'asyncApi',
525
+ label: '异步检测接口',
526
+ visibleOn: 'data.asyncApi != null',
527
+ description:
528
+ '设置此属性后,表单提交发送保存接口后,还会继续轮训请求该接口,直到返回 finished 属性为 true 才 结束'
529
+ })
530
+ ]
531
+ },
304
532
 
305
- {
306
- type: 'divider'
307
- },
533
+ {
534
+ title: '外观',
535
+ body: [
536
+ {
537
+ name: 'mode',
538
+ label: '展示模式',
539
+ type: 'button-group-select',
540
+ size: 'sm',
541
+ mode: 'inline',
542
+ className: 'w-full',
543
+ value: 'horizontal',
544
+ options: [
545
+ {
546
+ label: '水平',
547
+ value: 'horizontal'
548
+ },
308
549
 
309
- getSchemaTpl('api', {
310
- label: '保存接口',
311
- description:
312
- '用来保存表单数据, 最后一步点击完成触发,<code>如果最后一步中已经设置保存接口,则此处设置无效。</code>'
313
- }),
550
+ {
551
+ label: '垂直',
552
+ value: 'vertical'
553
+ }
554
+ ]
555
+ },
314
556
 
315
- {
316
- label: '采用异步方式?',
317
- remark: {
318
- trigger: 'click',
319
- rootClose: true,
320
- title: '什么是异步方式?',
321
- content:
322
- '异步方式主要用来解决请求超时问题,启用异步方式后,程序会在请求完后,定时轮询请求额外的接口用来咨询操作是否完成。所以接口可以快速的返回,而不需要等待流程真正完成。',
323
- placement: 'left'
557
+ {
558
+ name: 'actionPrevLabel',
559
+ label: '上一步按钮名称',
560
+ type: 'input-text',
561
+ pipeIn: defaultValue('上一步')
324
562
  },
325
- type: 'switch',
326
- name: 'asyncApi',
327
- visibleOn: 'data.api',
328
- pipeIn: (value: any) => value != null,
329
- pipeOut: (value: any) => (value ? '' : undefined),
330
- mode: 'inline'
331
- },
332
-
333
- getSchemaTpl('api', {
334
- name: 'asyncApi',
335
- label: '异步检测接口',
336
- visibleOn: 'data.asyncApi != null',
337
- description:
338
- '设置此属性后,表单提交发送保存接口后,还会继续轮训请求该接口,直到返回 finished 属性为 true 才 结束'
339
- })
340
- ]
341
- },
342
563
 
343
- {
344
- title: '外观',
345
- body: [
346
- {
347
- name: 'mode',
348
- label: '展示模式',
349
- type: 'button-group-select',
350
- size: 'sm',
351
- mode: 'inline',
352
- className: 'w-full',
353
- value: 'horizontal',
354
- options: [
355
- {
356
- label: '水平',
357
- value: 'horizontal'
358
- },
564
+ {
565
+ name: 'actionNextLabel',
566
+ label: '下一步按钮名称',
567
+ type: 'input-text',
568
+ pipeIn: defaultValue('下一步')
569
+ },
359
570
 
360
- {
361
- label: '垂直',
362
- value: 'vertical'
363
- }
364
- ]
365
- },
571
+ {
572
+ name: 'actionNextSaveLabel',
573
+ label: '保存并下一步按钮名称',
574
+ type: 'input-text',
575
+ pipeIn: defaultValue('保存并下一步')
576
+ },
366
577
 
367
- {
368
- name: 'actionPrevLabel',
369
- label: '上一步按钮名称',
370
- type: 'input-text',
371
- pipeIn: defaultValue('上一步')
372
- },
578
+ {
579
+ name: 'actionFinishLabel',
580
+ label: '完成按钮名称',
581
+ type: 'input-text',
582
+ pipeIn: defaultValue('完成')
583
+ },
373
584
 
374
- {
375
- name: 'actionNextLabel',
376
- label: '下一步按钮名称',
377
- type: 'input-text',
378
- pipeIn: defaultValue('下一步')
379
- },
585
+ // {
586
+ // type: 'alert',
587
+ // level: 'info',
588
+ // body: `温馨提示:操作按钮每个步骤可以单独配置,请在右侧切换到需要单独配置的步骤后,点击下方的【自定义按钮】定制。`
589
+ // },
380
590
 
381
- {
382
- name: 'actionNextSaveLabel',
383
- label: '保存并下一步按钮名称',
384
- type: 'input-text',
385
- pipeIn: defaultValue('保存并下一步')
386
- },
591
+ getSchemaTpl('className'),
592
+ getSchemaTpl('className', {
593
+ name: 'actionClassName',
594
+ label: '按钮 CSS 类名'
595
+ })
596
+ ]
597
+ },
387
598
 
388
- {
389
- name: 'actionFinishLabel',
390
- label: '完成按钮名称',
391
- type: 'input-text',
392
- pipeIn: defaultValue('完成')
393
- },
394
-
395
- // {
396
- // type: 'alert',
397
- // level: 'info',
398
- // body: `温馨提示:操作按钮每个步骤可以单独配置,请在右侧切换到需要单独配置的步骤后,点击下方的【自定义按钮】定制。`
399
- // },
400
-
401
- getSchemaTpl('className'),
402
- getSchemaTpl('className', {
403
- name: 'actionClassName',
404
- label: '按钮 CSS 类名'
405
- })
406
- ]
407
- },
599
+ {
600
+ title: '其他',
601
+ body: [
602
+ getSchemaTpl('ref'),
603
+ getSchemaTpl('name'),
604
+ getSchemaTpl('reload'),
408
605
 
409
- {
410
- title: '其他',
411
- body: [
412
- getSchemaTpl('ref'),
413
- getSchemaTpl('name'),
414
- getSchemaTpl('reload'),
606
+ {
607
+ label: '跳转',
608
+ name: 'redirect',
609
+ type: 'input-text',
610
+ description: '当设置此值后,表单提交完后跳转到目标地址。'
611
+ },
415
612
 
416
- {
417
- label: '跳转',
418
- name: 'redirect',
419
- type: 'input-text',
420
- description: '当设置此值后,表单提交完后跳转到目标地址。'
421
- },
613
+ getSchemaTpl('visible')
614
+ ]
615
+ },
422
616
 
423
- getSchemaTpl('visible')
424
- ]
425
- }
426
- ])
427
- ];
617
+ {
618
+ title: '事件',
619
+ className: 'p-none',
620
+ body: [
621
+ getSchemaTpl('eventControl', {
622
+ name: 'onEvent',
623
+ ...getEventControlConfig(this.manager, context)
624
+ })
625
+ ]
626
+ }
627
+ ])
628
+ ];
629
+ };
428
630
 
429
631
  /**
430
632
  * 补充切换的 toolbar
@@ -510,9 +712,12 @@ export class WizardPlugin extends BasePlugin {
510
712
  description:
511
713
  '如果接口返回了 <code>step</code> 变量,且数值是数字类型,比如 <code>3</code>,提交完后回跳到第 3 步'
512
714
  }),
513
- {
715
+
716
+ getSchemaTpl('switch', {
514
717
  label: '采用异步方式?',
515
- remark: {
718
+ name: 'asyncApi',
719
+ visibleOn: 'data.api',
720
+ labelRemark: {
516
721
  trigger: 'click',
517
722
  rootClose: true,
518
723
  title: '什么是异步方式?',
@@ -520,14 +725,10 @@ export class WizardPlugin extends BasePlugin {
520
725
  '异步方式主要用来解决请求超时问题,启用异步方式后,程序会在请求完后,定时轮询请求额外的接口用来咨询操作是否完成。所以接口可以快速的返回,而不需要等待流程真正完成。',
521
726
  placement: 'left'
522
727
  },
523
- type: 'switch',
524
- name: 'asyncApi',
525
- visibleOn: 'data.api',
526
728
  pipeIn: (value: any) => value != null,
527
- pipeOut: (value: any) => (value ? '' : undefined),
528
- mode: 'inline',
529
- className: 'block'
530
- },
729
+ pipeOut: (value: any) => (value ? '' : undefined)
730
+ }),
731
+
531
732
  getSchemaTpl('api', {
532
733
  name: 'asyncApi',
533
734
  label: '异步检测接口',
@@ -543,9 +744,12 @@ export class WizardPlugin extends BasePlugin {
543
744
  label: '初始化接口',
544
745
  description: '用来初始化表单数据'
545
746
  }),
546
- {
747
+
748
+ getSchemaTpl('switch', {
547
749
  label: '采用异步方式?',
548
- remark: {
750
+ name: 'initAsyncApi',
751
+ visibleOn: 'data.initApi',
752
+ labelRemark: {
549
753
  trigger: 'click',
550
754
  rootClose: true,
551
755
  title: '什么是异步方式?',
@@ -553,14 +757,10 @@ export class WizardPlugin extends BasePlugin {
553
757
  '异步方式主要用来解决请求超时问题,启用异步方式后,程序会在请求完后,定时轮询请求额外的接口用来咨询操作是否完成。所以接口可以快速的返回,而不需要等待流程真正完成。',
554
758
  placement: 'left'
555
759
  },
556
- type: 'switch',
557
- name: 'initAsyncApi',
558
- visibleOn: 'data.initApi',
559
760
  pipeIn: (value: any) => value != null,
560
- pipeOut: (value: any) => (value ? '' : undefined),
561
- mode: 'inline',
562
- className: 'block'
563
- },
761
+ pipeOut: (value: any) => (value ? '' : undefined)
762
+ }),
763
+
564
764
  getSchemaTpl('api', {
565
765
  name: 'initAsyncApi',
566
766
  label: '异步检测接口',
@@ -647,6 +847,7 @@ export class WizardPlugin extends BasePlugin {
647
847
  return (
648
848
  <VRenderer
649
849
  key={id}
850
+ type={info.type}
650
851
  plugin={info.plugin}
651
852
  renderer={info.renderer}
652
853
  $schema="/schemas/WizardStepSchema.json"