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

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,15 +1,12 @@
1
- import React from 'react';
2
- import {Button} from 'amis';
3
- import {defaultValue, getSchemaTpl} from '../../component/schemaTpl';
1
+ import {getSchemaTpl} from '../../component/schemaTpl';
4
2
  import {registerEditorPlugin} from '../../manager';
5
- import {
6
- BasePlugin,
7
- BasicSubRenderInfo,
8
- RendererEventContext,
9
- SubRendererInfo
10
- } from '../../plugin';
3
+ import {BasePlugin, BaseEventContext} from '../../plugin';
11
4
  import isArray from 'lodash/isArray';
12
5
 
6
+ import {ValidatorTag} from '../../component/validator';
7
+ import {getEventControlConfig} from '../../util';
8
+ import {RendererAction, RendererEvent} from '../../event-action';
9
+
13
10
  export class SelectControlPlugin extends BasePlugin {
14
11
  // 关联渲染器名字
15
12
  rendererName = 'select';
@@ -52,182 +49,256 @@ export class SelectControlPlugin extends BasePlugin {
52
49
  ]
53
50
  };
54
51
 
52
+ notRenderFormZone = true;
53
+
55
54
  panelTitle = '下拉框';
56
- panelBody = [
57
- getSchemaTpl('switchDefaultValue'),
58
55
 
56
+ // 事件定义
57
+ events: RendererEvent[] = [
59
58
  {
60
- type: 'select',
61
- name: 'value',
62
- label: '默认值',
63
- source: '${options}',
64
- visibleOn: '!data.multiple && typeof this.value !== "undefined"'
59
+ eventName: 'change',
60
+ eventLabel: '值变化',
61
+ description: '选中值变化时触发',
62
+ dataSchema: [
63
+ {
64
+ type: 'object',
65
+ properties: {
66
+ 'event.data.value': {
67
+ type: 'string',
68
+ title: '选中值'
69
+ }
70
+ }
71
+ }
72
+ ]
65
73
  },
66
-
67
74
  {
68
- type: 'select',
69
- name: 'value',
70
- label: '默认值',
71
- source: '${options}',
72
- multiple: true,
73
- visibleOn: ' data.multiple && typeof this.value !== "undefined"'
75
+ eventName: 'focus',
76
+ eventLabel: '获取焦点',
77
+ description: '输入框获取焦点时触发',
78
+ dataSchema: [
79
+ {
80
+ type: 'object',
81
+ properties: {
82
+ 'event.data.value': {
83
+ type: 'string',
84
+ title: '选中值'
85
+ }
86
+ }
87
+ }
88
+ ]
74
89
  },
75
-
76
- getSchemaTpl('clearable'),
77
90
  {
78
- label: '可检索',
79
- name: 'searchable',
80
- type: 'switch',
81
- mode: 'inline',
82
- className: 'w-full'
91
+ eventName: 'blur',
92
+ eventLabel: '失去焦点',
93
+ description: '输入框失去焦点时触发',
94
+ dataSchema: [
95
+ {
96
+ type: 'object',
97
+ properties: {
98
+ 'event.data.value': {
99
+ type: 'string',
100
+ title: '选中值'
101
+ }
102
+ }
103
+ }
104
+ ]
83
105
  },
84
-
85
106
  {
86
- label: '是否默认选择第一个',
87
- name: 'selectFirst',
88
- type: 'switch',
89
- mode: 'inline',
90
- className: 'w-full'
91
- },
92
-
93
- getSchemaTpl('fieldSet', {
94
- title: '选项',
95
- body: [
96
- getSchemaTpl('multiple'),
107
+ eventName: 'add',
108
+ eventLabel: '新增选项',
109
+ description: '新增选项',
110
+ dataSchema: [
97
111
  {
98
- label: '选中内容以单行模式显示',
99
- name: 'valuesNoWrap',
100
- type: 'switch',
101
- mode: 'inline',
102
- className: 'w-full',
103
- visibleOn: 'this.multiple'
104
- },
105
- {
106
- label: '可全选',
107
- name: 'checkAll',
108
- type: 'switch',
109
- mode: 'inline',
110
- value: false,
111
- className: 'w-full',
112
- onChange: (value: any, origin: any, item: any, form: any) => {
113
- // 开启 “可全选” 时,需关联开启多选模式
114
- value && form.setValueByName('multiple', true);
112
+ type: 'object',
113
+ properties: {
114
+ 'event.data.value': {
115
+ type: 'object',
116
+ title: '新增的选项'
117
+ },
118
+ 'event.data.options': {
119
+ type: 'array',
120
+ title: '选项集合'
121
+ }
115
122
  }
116
- },
117
- {
118
- label: '自定义菜单模板',
119
- name: 'menuTpl',
120
- type: 'input-text'
121
- },
122
- {
123
- label: '默认全选',
124
- name: 'defaultCheckAll',
125
- type: 'switch',
126
- value: false,
127
- visibleOn: 'this.checkAll',
128
- mode: 'inline',
129
- className: 'w-full'
130
- },
123
+ }
124
+ ]
125
+ },
126
+ {
127
+ eventName: 'edit',
128
+ eventLabel: '编辑选项',
129
+ description: '编辑选项',
130
+ dataSchema: [
131
131
  {
132
- type: 'input-text',
133
- name: 'checkAllLabel',
134
- label: '默认为 "全选" 的文字',
135
- visibleOn: 'this.checkAll',
136
- value: '全选'
137
- },
138
- getSchemaTpl('options'),
139
- getSchemaTpl('source'),
140
- getSchemaTpl('api', {
141
- name: 'autoComplete',
142
- label: '自动完成接口',
143
- description:
144
- '每次输入新内容后,将调用接口,根据接口返回更新选项。当前用户输入值在 <code>\\${term}</code> 中。'
145
- }),
146
- getSchemaTpl('joinValues'),
147
- getSchemaTpl('delimiter'),
148
- getSchemaTpl('extractValue'),
149
- getSchemaTpl('autoFill'),
150
-
151
- getSchemaTpl('creatable'),
152
- getSchemaTpl('createBtnLabel', {
153
- visibleOn: 'data.creatable'
154
- }),
155
- getSchemaTpl('api', {
156
- label: '新增选项接口',
157
- name: 'addApi',
158
- visibleOn: 'data.creatable'
159
- }),
132
+ type: 'object',
133
+ properties: {
134
+ 'event.data.value': {
135
+ type: 'object',
136
+ title: '编辑的选项'
137
+ },
138
+ 'event.data.options': {
139
+ type: 'array',
140
+ title: '选项集合'
141
+ }
142
+ }
143
+ }
144
+ ]
145
+ },
146
+ {
147
+ eventName: 'delete',
148
+ eventLabel: '删除选项',
149
+ description: '删除选项',
150
+ dataSchema: [
160
151
  {
161
- name: 'addControls',
162
- visibleOn: 'data.creatable',
163
- pipeIn: defaultValue([
164
- {
165
- type: 'input-text',
166
- name: 'label',
167
- label: false,
168
- placeholder: '请输入名称'
152
+ type: 'object',
153
+ properties: {
154
+ 'event.data.value': {
155
+ type: 'object',
156
+ title: '删除的选项'
157
+ },
158
+ 'event.data.options': {
159
+ type: 'array',
160
+ title: '选项集合'
169
161
  }
170
- ]),
171
- asFormItem: true,
172
- children: (params: any) => ( // params: {value, onChange, data}
173
- <Button
174
- size="sm"
175
- level="danger"
176
- className="m-b"
177
- onClick={() => {
178
- let defaultValue = {
179
- type: 'dialog',
162
+ }
163
+ }
164
+ ]
165
+ }
166
+ ];
167
+
168
+ // 动作定义
169
+ actions: RendererAction[] = [
170
+ {
171
+ actionType: 'clear',
172
+ actionLabel: '清空',
173
+ description: '清除选中值'
174
+ },
175
+ {
176
+ actionType: 'reset',
177
+ actionLabel: '重置',
178
+ description: '将值重置为resetValue,若没有配置resetValue,则清空'
179
+ },
180
+ {
181
+ actionType: 'reload',
182
+ actionLabel: '重新加载',
183
+ description: '触发组件数据刷新并重新渲染'
184
+ },
185
+ {
186
+ actionType: 'setValue',
187
+ actionLabel: '赋值',
188
+ description: '触发组件数据更新'
189
+ }
190
+ ];
191
+
192
+ panelJustify = true;
193
+ panelBodyCreator = (context: BaseEventContext) => {
194
+ return getSchemaTpl('tabs', [
195
+ {
196
+ title: '属性',
197
+ body: getSchemaTpl('collapseGroup', [
198
+ {
199
+ title: '基本',
200
+ body: [
201
+ getSchemaTpl('formItemName', {
202
+ required: true
203
+ }),
204
+ getSchemaTpl('label'),
205
+ getSchemaTpl('clearable'),
206
+ getSchemaTpl('searchable'),
207
+ getSchemaTpl('multiple', {
208
+ popMore: [
209
+ getSchemaTpl('switch', {
210
+ label: '单行显示选中值',
211
+ name: 'valuesNoWrap'
212
+ })
213
+ ]
214
+ }),
215
+ getSchemaTpl('checkAll'),
216
+ getSchemaTpl('labelRemark'),
217
+ getSchemaTpl('remark'),
218
+ getSchemaTpl('placeholder'),
219
+ getSchemaTpl('description')
220
+ ]
221
+ },
222
+ {
223
+ title: '选项',
224
+ body: [
225
+ getSchemaTpl('optionControl'),
226
+ getSchemaTpl('menuTpl'),
227
+ getSchemaTpl('value', {
228
+ visibleOn: 'this.options == null'
229
+ }),
230
+ getSchemaTpl('creatable', {
231
+ formType: 'extend',
232
+ hiddenOnDefault: true,
233
+ form: {
180
234
  body: [
181
- {
182
- type: 'input-text',
183
- name: 'label',
184
- label: false,
185
- placeholder: '请输入名称'
186
- }
235
+ getSchemaTpl('createBtnLabel'),
236
+ getSchemaTpl('addApi')
237
+ // {
238
+ // label: '按钮位置',
239
+ // name: 'valueType',
240
+ // type: 'button-group-select',
241
+ // size: 'sm',
242
+ // tiled: true,
243
+ // value: 'asUpload',
244
+ // mode: 'row',
245
+ // options: [
246
+ // {
247
+ // label: '顶部',
248
+ // value: ''
249
+ // },
250
+ // {
251
+ // label: '底部',
252
+ // value: ''
253
+ // },
254
+ // ],
255
+ // },
187
256
  ]
188
- };
189
- if (params.value && params.value.body && isArray(params.value.body)) {
190
- defaultValue.body = params.value.body;
191
- } else if (params.value && isArray(params.value)) {
192
- defaultValue.body = params.value;
193
257
  }
194
- this.manager.openSubEditor({
195
- title: '配置新建选项表单项',
196
- value: defaultValue,
197
- onChange: (curValue: any) => {
198
- if (curValue && curValue.body && isArray(curValue.body)) {
199
- /**
200
- * 备注: 需要确保 addControls 为数组类型 才会生效。
201
- * 详细使用说明:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/options#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B0%E5%A2%9E%E8%A1%A8%E5%8D%95%E9%A1%B9-addcontrols
202
- */
203
- return params.onChange(curValue.body, 'addControls');
204
- } else {
205
- return params.onChange([], 'addControls');
206
- }
207
- }
208
- });
209
- }}
210
- block
211
- >
212
- 配置新建选项表单项
213
- </Button>
214
- )
215
- },
216
-
217
- getSchemaTpl('editable'),
218
- getSchemaTpl('api', {
219
- label: '编辑选项接口',
220
- name: 'editApi'
221
- }),
222
-
223
- getSchemaTpl('removable'),
224
- getSchemaTpl('api', {
225
- label: '删除选项接口',
226
- name: 'deleteApi'
227
- })
228
- ]
229
- })
230
- ];
258
+ }),
259
+ getSchemaTpl('editable', {
260
+ type: 'ae-Switch-More',
261
+ formType: 'extend',
262
+ hiddenOnDefault: true,
263
+ form: {
264
+ body: [getSchemaTpl('editApi')]
265
+ }
266
+ }),
267
+ getSchemaTpl('removable', {
268
+ type: 'ae-Switch-More',
269
+ formType: 'extend',
270
+ hiddenOnDefault: true,
271
+ form: {
272
+ body: [getSchemaTpl('deleteApi')]
273
+ }
274
+ })
275
+ ]
276
+ },
277
+ getSchemaTpl('status', {isFormItem: true}),
278
+ getSchemaTpl('validation', {tag: ValidatorTag.MultiSelect})
279
+ ])
280
+ },
281
+ {
282
+ title: '外观',
283
+ body: [
284
+ getSchemaTpl('collapseGroup', [
285
+ getSchemaTpl('style:formItem', {renderer: context.info.renderer}),
286
+ getSchemaTpl('style:classNames')
287
+ ])
288
+ ]
289
+ },
290
+ {
291
+ title: '事件',
292
+ className: 'p-none',
293
+ body: [
294
+ getSchemaTpl('eventControl', {
295
+ name: 'onEvent',
296
+ ...getEventControlConfig(this.manager, context)
297
+ })
298
+ ]
299
+ }
300
+ ]);
301
+ };
231
302
  }
232
303
 
233
304
  registerEditorPlugin(SelectControlPlugin);
@@ -319,4 +319,4 @@ export class StaticControlPlugin extends BasePlugin {
319
319
  }*/
320
320
  }
321
321
 
322
- registerEditorPlugin(StaticControlPlugin);
322
+ registerEditorPlugin(StaticControlPlugin);