amis-editor 4.2.0-beta.2 → 5.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. package/dist/6dbcbb49b6fd405190a9.png +0 -0
  2. package/dist/component/Control/APIControl.d.ts +1101 -447
  3. package/dist/component/Control/ActionAPIControl.d.ts +1158 -0
  4. package/dist/component/Control/BadgeControl.d.ts +133 -0
  5. package/dist/component/Control/BaseControl.d.ts +248 -0
  6. package/dist/component/Control/DataBindingControl.d.ts +14 -0
  7. package/dist/component/Control/DataPickerControl.d.ts +13 -0
  8. package/dist/component/Control/DateShortCutControl.d.ts +83 -0
  9. package/dist/component/Control/FormulaControl.d.ts +51 -0
  10. package/dist/component/Control/OptionControl.d.ts +23 -34
  11. package/dist/component/Control/StatusControl.d.ts +39 -0
  12. package/dist/component/Control/SwitchMoreControl.d.ts +224 -0
  13. package/dist/component/Control/ValidationControl.d.ts +50 -15
  14. package/dist/component/Control/ValidationItem.d.ts +46 -0
  15. package/dist/component/Control/style-control/Background.d.ts +17 -0
  16. package/dist/component/Control/style-control/Border.d.ts +18 -0
  17. package/dist/component/Control/style-control/BoxModel.d.ts +17 -0
  18. package/dist/component/Control/style-control/BoxShadow.d.ts +18 -0
  19. package/dist/component/Control/style-control/Display.d.ts +14 -0
  20. package/dist/component/Control/style-control/Font.d.ts +16 -0
  21. package/dist/component/Control/style-control/font-family.d.ts +11 -0
  22. package/dist/component/Control/style-control/transformation.d.ts +29 -0
  23. package/dist/component/Control/style-control/types.d.ts +8 -0
  24. package/dist/component/Editor.d.ts +16 -0
  25. package/dist/component/RegionWrapper.d.ts +10 -0
  26. package/dist/component/VRenderer.d.ts +10 -0
  27. package/dist/component/schemaTpl.d.ts +8 -0
  28. package/dist/component/validator.d.ts +62 -0
  29. package/dist/dnd/index.d.ts +1 -1
  30. package/dist/event-action/action-config-panel.d.ts +8 -0
  31. package/dist/event-action/actions.d.ts +3 -0
  32. package/dist/event-action/comp-action-select.d.ts +11 -0
  33. package/dist/event-action/config.d.ts +13 -0
  34. package/dist/event-action/index.d.ts +459 -0
  35. package/dist/event-action/schema.d.ts +32 -0
  36. package/dist/exports.min.js +1 -1
  37. package/dist/index.d.ts +23 -5
  38. package/dist/index.min.js +1 -1
  39. package/dist/manager.d.ts +46 -1
  40. package/dist/plugin/Alert.d.ts +4 -2
  41. package/dist/plugin/Button.d.ts +5 -1
  42. package/dist/plugin/ButtonGroup.d.ts +13 -34
  43. package/dist/plugin/ButtonToolbar.d.ts +4 -10
  44. package/dist/plugin/CRUD.d.ts +2 -0
  45. package/dist/plugin/Chart.d.ts +2 -0
  46. package/dist/plugin/Collapse.d.ts +1 -0
  47. package/dist/plugin/CollapseGroup.d.ts +28 -4
  48. package/dist/plugin/Container.d.ts +2 -1
  49. package/dist/plugin/Dialog.d.ts +12 -2
  50. package/dist/plugin/Drawer.d.ts +12 -2
  51. package/dist/plugin/DropDownButton.d.ts +11 -11
  52. package/dist/plugin/Form/ButtonGroupSelect.d.ts +7 -2
  53. package/dist/plugin/Form/ButtonToolbar.d.ts +8 -7
  54. package/dist/plugin/Form/ChainedSelect.d.ts +3 -0
  55. package/dist/plugin/Form/Checkbox.d.ts +7 -2
  56. package/dist/plugin/Form/Checkboxes.d.ts +8 -2
  57. package/dist/plugin/Form/CodeEditor.d.ts +7 -22
  58. package/dist/plugin/Form/Combo.d.ts +3 -0
  59. package/dist/plugin/Form/Control.d.ts +6 -2
  60. package/dist/plugin/Form/DiffEditor.d.ts +7 -1
  61. package/dist/plugin/Form/Form.d.ts +6 -0
  62. package/dist/plugin/Form/Formula.d.ts +1 -25
  63. package/dist/plugin/Form/InputDate.d.ts +8 -2
  64. package/dist/plugin/Form/InputDateRange.d.ts +8 -2
  65. package/dist/plugin/Form/InputDateTime.d.ts +4 -4
  66. package/dist/plugin/Form/InputDateTimeRange.d.ts +4 -4
  67. package/dist/plugin/Form/InputEmail.d.ts +1 -0
  68. package/dist/plugin/Form/InputExcel.d.ts +6 -41
  69. package/dist/plugin/Form/InputFile.d.ts +7 -3
  70. package/dist/plugin/Form/InputKV.d.ts +6 -0
  71. package/dist/plugin/Form/InputMonth.d.ts +1 -0
  72. package/dist/plugin/Form/InputMonthRange.d.ts +4 -4
  73. package/dist/plugin/Form/InputPassword.d.ts +1 -0
  74. package/dist/plugin/Form/InputQuarter.d.ts +1 -0
  75. package/dist/plugin/Form/InputQuarterRange.d.ts +4 -4
  76. package/dist/plugin/Form/InputRange.d.ts +3 -0
  77. package/dist/plugin/Form/InputRating.d.ts +9 -3
  78. package/dist/plugin/Form/InputText.d.ts +24 -2
  79. package/dist/plugin/Form/InputTime.d.ts +3 -3
  80. package/dist/plugin/Form/InputTimeRange.d.ts +20 -0
  81. package/dist/plugin/Form/InputTree.d.ts +6 -2
  82. package/dist/plugin/Form/InputURL.d.ts +1 -0
  83. package/dist/plugin/Form/InputYear.d.ts +1 -0
  84. package/dist/plugin/Form/InputYearRange.d.ts +20 -0
  85. package/dist/plugin/Form/ListSelect.d.ts +6 -2
  86. package/dist/plugin/Form/LocationPicker.d.ts +1 -31
  87. package/dist/plugin/Form/NestedSelect.d.ts +5 -2
  88. package/dist/plugin/Form/Radios.d.ts +7 -2
  89. package/dist/plugin/Form/Select.d.ts +7 -2
  90. package/dist/plugin/Form/Switch.d.ts +7 -2
  91. package/dist/plugin/Form/TabsTransfer.d.ts +5 -2
  92. package/dist/plugin/Form/Textarea.d.ts +7 -1
  93. package/dist/plugin/Form/Transfer.d.ts +5 -2
  94. package/dist/plugin/Form/TreeSelect.d.ts +6 -2
  95. package/dist/plugin/IFrame.d.ts +2 -2
  96. package/dist/plugin/Nav.d.ts +1 -116
  97. package/dist/plugin/Others/Action.d.ts +5 -1
  98. package/dist/plugin/Page.d.ts +5 -2
  99. package/dist/plugin/Progress.d.ts +5 -1
  100. package/dist/plugin/Table.d.ts +2 -0
  101. package/dist/plugin/Tabs.d.ts +33 -2
  102. package/dist/plugin/TooltipWrapper.d.ts +10 -0
  103. package/dist/plugin/Tpl.d.ts +2 -1
  104. package/dist/plugin/Wizard.d.ts +4 -1
  105. package/dist/plugin.d.ts +37 -1
  106. package/dist/store/editor.d.ts +65 -38
  107. package/dist/store/node.d.ts +16 -0
  108. package/dist/style.css +1 -1
  109. package/dist/util.d.ts +36 -3
  110. package/package.json +14 -8
  111. package/src/component/schemaTpl.tsx +1198 -474
  112. package/src/plugin/.DS_Store +0 -0
  113. package/src/plugin/Alert.tsx +69 -48
  114. package/src/plugin/AnchorNav.tsx +1 -0
  115. package/src/plugin/Audio.tsx +9 -15
  116. package/src/plugin/Avatar.tsx +2 -1
  117. package/src/plugin/Breadcrumb.tsx +2 -1
  118. package/src/plugin/Button.tsx +257 -188
  119. package/src/plugin/ButtonGroup.tsx +99 -38
  120. package/src/plugin/ButtonToolbar.tsx +7 -13
  121. package/src/plugin/CRUD.tsx +77 -135
  122. package/src/plugin/Card.tsx +1 -0
  123. package/src/plugin/Cards.tsx +8 -14
  124. package/src/plugin/Carousel.tsx +1 -1
  125. package/src/plugin/Chart.tsx +26 -14
  126. package/src/plugin/Collapse.tsx +78 -78
  127. package/src/plugin/CollapseGroup.tsx +165 -83
  128. package/src/plugin/Container.tsx +59 -6
  129. package/src/plugin/Custom.tsx +2 -8
  130. package/src/plugin/CustomRegion.tsx +4 -3
  131. package/src/plugin/Dialog.tsx +55 -24
  132. package/src/plugin/Drawer.tsx +65 -35
  133. package/src/plugin/DropDownButton.tsx +95 -79
  134. package/src/plugin/Flex.tsx +123 -65
  135. package/src/plugin/Form/ButtonGroupSelect.tsx +114 -26
  136. package/src/plugin/Form/ButtonToolbar.tsx +62 -55
  137. package/src/plugin/Form/ChainedSelect.tsx +45 -0
  138. package/src/plugin/Form/Checkbox.tsx +122 -33
  139. package/src/plugin/Form/Checkboxes.tsx +154 -87
  140. package/src/plugin/Form/CodeEditor.tsx +163 -34
  141. package/src/plugin/Form/Combo.tsx +104 -65
  142. package/src/plugin/Form/Control.tsx +16 -70
  143. package/src/plugin/Form/DiffEditor.tsx +158 -54
  144. package/src/plugin/Form/FieldSet.tsx +6 -11
  145. package/src/plugin/Form/Form.tsx +277 -70
  146. package/src/plugin/Form/Formula.tsx +8 -14
  147. package/src/plugin/Form/InputArray.tsx +7 -16
  148. package/src/plugin/Form/InputCity.tsx +1 -1
  149. package/src/plugin/Form/InputDate.tsx +344 -121
  150. package/src/plugin/Form/InputDateRange.tsx +303 -161
  151. package/src/plugin/Form/InputDateTime.tsx +6 -150
  152. package/src/plugin/Form/InputDateTimeRange.tsx +7 -187
  153. package/src/plugin/Form/InputEmail.tsx +1 -0
  154. package/src/plugin/Form/InputExcel.tsx +70 -27
  155. package/src/plugin/Form/InputFile.tsx +326 -152
  156. package/src/plugin/Form/InputImage.tsx +1 -1
  157. package/src/plugin/Form/InputKV.tsx +61 -0
  158. package/src/plugin/Form/InputMonth.tsx +3 -1
  159. package/src/plugin/Form/InputMonthRange.tsx +6 -160
  160. package/src/plugin/Form/InputNumber.tsx +1 -1
  161. package/src/plugin/Form/InputPassword.tsx +2 -0
  162. package/src/plugin/Form/InputQuarter.tsx +3 -1
  163. package/src/plugin/Form/InputQuarterRange.tsx +6 -160
  164. package/src/plugin/Form/InputRange.tsx +74 -4
  165. package/src/plugin/Form/InputRating.tsx +347 -35
  166. package/src/plugin/Form/InputRichText.tsx +2 -3
  167. package/src/plugin/Form/InputTable.tsx +33 -49
  168. package/src/plugin/Form/InputTag.tsx +1 -1
  169. package/src/plugin/Form/InputText.tsx +310 -132
  170. package/src/plugin/Form/InputTime.tsx +4 -53
  171. package/src/plugin/Form/InputTimeRange.tsx +41 -0
  172. package/src/plugin/Form/InputTree.tsx +196 -46
  173. package/src/plugin/Form/InputURL.tsx +2 -0
  174. package/src/plugin/Form/InputYear.tsx +2 -0
  175. package/src/plugin/Form/InputYearRange.tsx +41 -0
  176. package/src/plugin/Form/Item.tsx +17 -18
  177. package/src/plugin/Form/ListSelect.tsx +75 -20
  178. package/src/plugin/Form/LocationPicker.tsx +2 -7
  179. package/src/plugin/Form/MatrixCheckboxes.tsx +1 -1
  180. package/src/plugin/Form/NestedSelect.tsx +110 -43
  181. package/src/plugin/Form/Picker.tsx +2 -5
  182. package/src/plugin/Form/Radios.tsx +122 -52
  183. package/src/plugin/Form/Select.tsx +239 -168
  184. package/src/plugin/Form/Static.tsx +1 -1
  185. package/src/plugin/Form/Switch.tsx +170 -58
  186. package/src/plugin/Form/TabsTransfer.tsx +175 -79
  187. package/src/plugin/Form/Textarea.tsx +146 -36
  188. package/src/plugin/Form/Transfer.tsx +295 -233
  189. package/src/plugin/Form/TreeSelect.tsx +287 -146
  190. package/src/plugin/Grid.tsx +340 -312
  191. package/src/plugin/HBox.tsx +1 -0
  192. package/src/plugin/IFrame.tsx +21 -12
  193. package/src/plugin/Image.tsx +7 -12
  194. package/src/plugin/Images.tsx +7 -12
  195. package/src/plugin/Link.tsx +6 -12
  196. package/src/plugin/List.tsx +6 -10
  197. package/src/plugin/ListItem.tsx +1 -0
  198. package/src/plugin/Nav.tsx +7 -9
  199. package/src/plugin/Others/Action.tsx +16 -10
  200. package/src/plugin/Others/BasicToolbar.tsx +4 -1
  201. package/src/plugin/Others/TableCell.tsx +19 -39
  202. package/src/plugin/Page.tsx +315 -229
  203. package/src/plugin/Panel.tsx +6 -7
  204. package/src/plugin/Plain.tsx +3 -6
  205. package/src/plugin/Progress.tsx +234 -94
  206. package/src/plugin/Service.tsx +10 -6
  207. package/src/plugin/Table.tsx +49 -20
  208. package/src/plugin/TableView.tsx +212 -106
  209. package/src/plugin/Tabs.tsx +306 -146
  210. package/src/plugin/TooltipWrapper.tsx +231 -135
  211. package/src/plugin/Tpl.tsx +68 -52
  212. package/src/plugin/Video.tsx +9 -20
  213. package/src/plugin/Wizard.tsx +537 -336
  214. package/src/plugin/Wrapper.tsx +82 -61
  215. package/src/plugin.ts +66 -4
  216. package/static/empty.png +0 -0
@@ -4,7 +4,11 @@ import {
4
4
  valuePipeOut
5
5
  } from '../../component/schemaTpl';
6
6
  import {registerEditorPlugin} from '../../manager';
7
- import {BasePlugin} from '../../plugin';
7
+ import {BasePlugin, BaseEventContext} from '../../plugin';
8
+ import {formItemControl, tipedLabel} from '../../component/control/BaseControl';
9
+ import {ValidatorTag} from '../../component/validator';
10
+ import {getEventControlConfig} from '../../util';
11
+ import {RendererAction, RendererEvent} from '../../event-action';
8
12
 
9
13
  export class FileControlPlugin extends BasePlugin {
10
14
  // 关联渲染器名字
@@ -35,187 +39,357 @@ export class FileControlPlugin extends BasePlugin {
35
39
  ]
36
40
  };
37
41
 
38
- panelTitle = '文件域';
39
- panelBody = [
40
- getSchemaTpl('tabs', [
41
- {
42
- title: '常规',
43
- body: [
44
- {
45
- type: 'input-text',
46
- name: 'btnLabel',
47
- label: '上传按钮名称',
48
- value: '请选择文件'
49
- },
42
+ notRenderFormZone = true;
50
43
 
51
- getSchemaTpl('api', {
52
- label: '文件接收器',
53
- name: 'receiver',
54
- description:
55
- '默认不填写将上传到 bos,可以在系统配置中设置为自己的 bos 地址。',
56
- value: '/api/upload/file',
57
- __isUpload: true
58
- }),
44
+ // 事件定义
45
+ events: RendererEvent[] = [
46
+ {
47
+ eventName: 'change',
48
+ eventLabel: '值变化',
49
+ description: '上传文件值变化时触发(上传失败同样会触发)',
50
+ dataSchema: [
51
+ {
52
+ type: 'object',
53
+ properties: {
54
+ 'event.data.value': {
55
+ type: 'object',
56
+ title: '上传的文件'
57
+ }
58
+ }
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ eventName: 'remove',
64
+ eventLabel: '移除文件',
65
+ description: '移除文件时触发',
66
+ dataSchema: [
67
+ {
68
+ type: 'object',
69
+ properties: {
70
+ 'event.data.value': {
71
+ type: 'object',
72
+ title: '被移除的文件'
73
+ }
74
+ }
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ eventName: 'success',
80
+ eventLabel: '上传成功',
81
+ description: '上传文件成功时触发',
82
+ dataSchema: [
83
+ {
84
+ type: 'object',
85
+ properties: {
86
+ 'event.data.value': {
87
+ type: 'object',
88
+ title: '远程上传请求成功后返回的结果数据'
89
+ }
90
+ }
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ eventName: 'fail',
96
+ eventLabel: '上传失败',
97
+ description: '上传文件失败时触发',
98
+ dataSchema: [
99
+ {
100
+ type: 'object',
101
+ properties: {
102
+ 'event.data.file': {
103
+ type: 'object',
104
+ title: '上传的文件'
105
+ },
106
+ 'event.data.error': {
107
+ type: 'object',
108
+ title: '远程上传请求失败后返回的错误信息'
109
+ }
110
+ }
111
+ }
112
+ ]
113
+ }
114
+ ];
59
115
 
60
- getSchemaTpl('autoFill'),
116
+ // 动作定义
117
+ actions: RendererAction[] = [
118
+ {
119
+ actionType: 'clear',
120
+ actionLabel: '清空数据',
121
+ description: '清除选择的文件'
122
+ }
123
+ ];
61
124
 
125
+ panelJustify = true;
126
+ panelBodyCreator = (context: BaseEventContext) => {
127
+ return getSchemaTpl('tabs', [
128
+ {
129
+ title: '属性',
130
+ body: getSchemaTpl('collapseGroup', [
62
131
  {
63
- type: 'fieldSet',
64
- title: '分块上传相关',
65
- collapsed: true,
66
- collapsable: true,
67
- className: 'fieldset',
132
+ title: '基本',
68
133
  body: [
134
+ getSchemaTpl('formItemName', {
135
+ required: true
136
+ }),
137
+ getSchemaTpl('label'),
69
138
  {
70
- type: 'button-group-select',
71
- name: 'useChunk',
72
- label: '启用分块',
73
- size: 'xs',
74
- pipeOut: valuePipeOut,
75
- value: 'auto',
139
+ type: 'input-text',
140
+ name: 'btnLabel',
141
+ label: '按钮名称',
142
+ value: '文件上传'
143
+ },
144
+ getSchemaTpl('multiple', {
145
+ replace: true,
146
+ body: [
147
+ {
148
+ name: 'maxLength',
149
+ label: '最大数量',
150
+ type: 'input-number'
151
+ }
152
+ ]
153
+ }),
154
+ {
155
+ type: 'input-group',
156
+ name: 'maxSize',
157
+ label: '最大体积',
158
+ body: [
159
+ {
160
+ type: 'input-number',
161
+ name: 'maxSize'
162
+ },
163
+ {
164
+ type: 'tpl',
165
+ addOnclassName: 'border-0 bg-none',
166
+ tpl: 'B'
167
+ }
168
+ ]
169
+ },
170
+ {
171
+ label: '提交方式',
172
+ name: 'submitType',
173
+ type: 'select',
174
+ tiled: true,
175
+ value: 'asUpload',
76
176
  options: [
77
177
  {
78
- label: '自动',
79
- value: 'auto'
178
+ label: '随表单提交',
179
+ value: 'asForm'
80
180
  },
181
+
81
182
  {
82
- label: '启用',
83
- value: true
183
+ label: '独立上传',
184
+ value: 'asUpload'
185
+ }
186
+ ],
187
+ pipeIn: (value: any, form: any) => value || 'asUpload',
188
+ pipeOut: (value: any, form: any) => value || 'asUpload',
189
+ onChange: (
190
+ value: any,
191
+ oldValue: boolean,
192
+ model: any,
193
+ form: any
194
+ ) => {
195
+ if (value === 'asUpload') {
196
+ form.setValueByName('asBase64', false);
197
+ form.setValueByName('asBlob', false);
198
+ } else if (value === 'asForm') {
199
+ // 作为表单数据,自动上传开启
200
+ form.setValueByName('autoUpload', true);
201
+ const formType =
202
+ form.getValueByName('formType') || 'asBlob';
203
+ form.setValueByName(formType, true);
204
+ }
205
+ }
206
+ },
207
+ getSchemaTpl('uploadType', {
208
+ visibleOn: 'data.submitType === "asUpload" || !data.submitType',
209
+ pipeIn: (value: any, form: any) => value || 'fileReceptor',
210
+ pipeOut: (value: any, form: any) => value || 'fileReceptor'
211
+ }),
212
+
213
+ {
214
+ name: 'formType',
215
+ type: 'select',
216
+ tiled: true,
217
+ visibleOn: 'data.submitType === "asForm"',
218
+ value: 'asBlob',
219
+ label: tipedLabel(
220
+ '数据格式',
221
+ '${formType ? asBase64 ? "小文件时可以使用,默认给 Form 提交的是文件下载地址,设置后给 Form 提交文件内容的 base64 格式字符串。" : "File 控件不接管文件上传,直接由表单的保存接口完成。和 Base64 选项二选一。" : ""}'
222
+ ),
223
+ options: [
224
+ {
225
+ label: 'Base64',
226
+ value: 'asBase64'
84
227
  },
228
+
85
229
  {
86
- label: '关闭',
87
- value: false
230
+ label: '二进制',
231
+ value: 'asBlob'
88
232
  }
89
- ]
233
+ ],
234
+ onChange: (
235
+ value: any,
236
+ oldValue: boolean,
237
+ model: any,
238
+ form: any
239
+ ) => {
240
+ form.setValueByName('asBase64', 'asBase64' === value);
241
+ form.setValueByName('asBlob', 'asBlob' === value);
242
+ }
90
243
  },
244
+
245
+ getSchemaTpl('bos', {
246
+ visibleOn:
247
+ '(data.submitType === "asUpload" || !data.submitType) && data.uploadType === "bos"'
248
+ }),
249
+
250
+ getSchemaTpl('proxy', {
251
+ value: false,
252
+ visibleOn: 'data.submitType === "asUpload" || !data.submitType'
253
+ }),
254
+
255
+ getSchemaTpl('switch', {
256
+ name: 'autoUpload',
257
+ label: '自动上传',
258
+ value: true,
259
+ visibleOn: 'data.submitType === "asUpload"'
260
+ }),
261
+
262
+ getSchemaTpl('switch', {
263
+ name: 'useChunk',
264
+ label: '开启分块',
265
+ value: false,
266
+ pipeIn: (value: any, form: any) => !!value, // 兼容auto
267
+ visibleOn: 'data.submitType == "asUpload"'
268
+ }),
269
+
91
270
  {
92
- name: 'chunkSize',
93
- type: 'input-number',
94
- label: '分块大小',
95
- visibleOn: 'data.useChunk != false',
96
- value: 5 * 1024 * 1024
271
+ type: 'container',
272
+ className: 'ae-ExtendMore mb-3',
273
+ visibleOn:
274
+ 'data.submitType === "asUpload" && data.useChunk != false',
275
+ body: [
276
+ {
277
+ type: 'input-group',
278
+ name: 'chunkSize',
279
+ label: '分块大小',
280
+ body: [
281
+ {
282
+ type: 'input-number',
283
+ name: 'chunkSize'
284
+ },
285
+ {
286
+ type: 'tpl',
287
+ addOnclassName: 'border-0 bg-none',
288
+ tpl: 'B'
289
+ }
290
+ ]
291
+ },
292
+ {
293
+ type: 'Container',
294
+ visibleOn:
295
+ 'data.submitType === "asUpload" && data.uploadType == "fileReceptor" && data.useChunk != false',
296
+ body: [
297
+ getSchemaTpl('apiControl', {
298
+ name: 'startChunkApi',
299
+ label: tipedLabel(
300
+ '分块准备接口',
301
+ '用来做分块前的准备工作,一个文件只会调用一次。如果出错了,后续的分块上传就会中断。'
302
+ ),
303
+ value: '/api/upload/startChunk'
304
+ }),
305
+ getSchemaTpl('apiControl', {
306
+ name: 'chunkApi',
307
+ label: tipedLabel(
308
+ '分块上传接口',
309
+ '用来接收每个分块上传,大文件会根据 chunkSize 分割成多块,然后每块上传都会调用这个接口。'
310
+ ),
311
+ value: '/api/upload/chunk'
312
+ }),
313
+ getSchemaTpl('apiControl', {
314
+ name: 'finishChunkApi',
315
+ label: tipedLabel(
316
+ '上传完成接口',
317
+ '等所有分块上传完后,将上传文件收集到的 `eTag` 信息合并一起,再次请求后端完成文件上传。'
318
+ ),
319
+ value: '/api/upload/finishChunk'
320
+ })
321
+ ]
322
+ }
323
+ ]
97
324
  },
98
- getSchemaTpl('api', {
99
- name: 'startChunkApi',
100
- label: 'startChunkApi',
101
- value: '/api/upload/startChunk'
325
+
326
+ getSchemaTpl('apiControl', {
327
+ name: 'receiver',
328
+ label: tipedLabel(
329
+ '文件接收器',
330
+ '默认不填写将上传到 bos,可以在系统配置中设置为自己的 bos 地址。'
331
+ ),
332
+ value: '/api/upload/file',
333
+ __isUpload: true,
334
+ visibleOn:
335
+ 'data.submitType === "asUpload" && data.uploadType === "fileReceptor" && !data.useChunk'
102
336
  }),
103
- getSchemaTpl('api', {
104
- name: 'chunkApi',
105
- label: 'chunkApi',
106
- value: '/api/upload/chunk'
337
+ getSchemaTpl('fileUrl', {
338
+ name: 'templateUrl',
339
+ label: tipedLabel(
340
+ '模板链接',
341
+ '适用于excel上传等有上传格式要求的场景,为用户提供一个模板下载入口'
342
+ )
107
343
  }),
108
- getSchemaTpl('api', {
109
- name: 'finishChunkApi',
110
- label: 'finishChunkApi',
111
- value: '/api/upload/finishChunk'
112
- })
344
+ getSchemaTpl('switch', {
345
+ name: 'drag',
346
+ label: '拖拽上传',
347
+ value: false
348
+ }),
349
+ getSchemaTpl('remark'),
350
+ getSchemaTpl('labelRemark'),
351
+ getSchemaTpl('description')
352
+ // getSchemaTpl('autoFill')
113
353
  ]
114
354
  },
115
- {
116
- type: 'input-text',
117
- name: 'accept',
118
- label: '文件类型',
119
- value: '',
120
- description:
121
- '请填写文件的 <code>mime-types</code>,参考 <code>input[type=file]</code> 的 <code>accept</code> 说明'
122
- },
123
- getSchemaTpl('switchDefaultValue'),
124
- {
125
- type: 'input-text',
126
- name: 'value',
127
- label: '默认值',
128
- visibleOn: 'typeof this.value !== "undefined"'
129
- },
130
- getSchemaTpl('multiple', {
131
- pipeIn: defaultValue(false)
132
- }),
133
- getSchemaTpl('joinValues'),
134
- getSchemaTpl('delimiter'),
135
- getSchemaTpl('extractValue')
136
- ]
355
+ getSchemaTpl('status', {isFormItem: true}),
356
+ getSchemaTpl('validation', {tag: ValidatorTag.File})
357
+ ])
137
358
  },
138
359
  {
139
360
  title: '外观',
140
- body: [
141
- getSchemaTpl('className', {
142
- name: 'btnClassName',
143
- label: '按钮 CSS 类名',
144
- pipeIn: defaultValue('btn-sm btn-info')
145
- }),
146
- getSchemaTpl('className', {
147
- name: 'btnUploadClassName',
148
- label: '上传按钮 CSS 类名',
149
- pipeIn: defaultValue('btn-sm btn-success')
361
+ body: getSchemaTpl('collapseGroup', [
362
+ getSchemaTpl('style:formItem', {renderer: context.info.renderer}),
363
+ getSchemaTpl('style:classNames', {
364
+ schema: [
365
+ getSchemaTpl('className', {
366
+ name: 'descriptionClassName',
367
+ label: '描述'
368
+ }),
369
+ getSchemaTpl('className', {
370
+ name: 'btnClassName',
371
+ label: '选择按钮'
372
+ }),
373
+ getSchemaTpl('className', {
374
+ name: 'btnUploadClassName',
375
+ label: '上传按钮'
376
+ })
377
+ ]
150
378
  })
151
- ]
379
+ ])
152
380
  },
153
381
  {
154
- title: '其他',
382
+ title: '事件',
383
+ className: 'p-none',
155
384
  body: [
156
- {
157
- name: 'maxSize',
158
- type: 'input-number',
159
- label: '文件最大体积',
160
- description: '超出大小不允许上传,单位字节'
161
- },
162
- {
163
- name: 'maxLength',
164
- type: 'input-number',
165
- label: '文件最大数量',
166
- description: '超出数量不允许上传',
167
- visibleOn: 'data.multiple != false'
168
- },
169
- {
170
- name: 'fileField',
171
- type: 'input-text',
172
- label: '文件域名称',
173
- value: 'file'
174
- },
175
- {
176
- name: 'asBase64',
177
- type: 'switch',
178
- mode: 'inline',
179
- className: 'block',
180
- label: '作为 Base64 提交',
181
- hiddenOn: 'data.asBlob',
182
- description:
183
- '小文件时可以使用,默认给 Form 提交的是文件下载地址,设置后给 Form 提交文件内容的 base64 格式字符串。'
184
- },
185
- {
186
- name: 'asBlob',
187
- type: 'switch',
188
- mode: 'inline',
189
- className: 'block',
190
- label: '作为二进制提交',
191
- hiddenOn: 'data.asBase64',
192
- description:
193
- 'File 控件不接管文件上传,直接由表单的保存接口完成。和 Base64 选项二选一。'
194
- },
195
- {
196
- name: 'autoUpload',
197
- type: 'switch',
198
- mode: 'inline',
199
- className: 'block',
200
- label: '是否自动上传',
201
- value: true
202
- },
203
- {
204
- name: 'hideUploadButton',
205
- type: 'switch',
206
- mode: 'inline',
207
- className: 'block',
208
- label: '是否隐藏上传按钮',
209
- value: false
210
- },
211
- getSchemaTpl('fileUrl', {
212
- name: 'templateUrl',
213
- label: '模板地址'
385
+ getSchemaTpl('eventControl', {
386
+ name: 'onEvent',
387
+ ...getEventControlConfig(this.manager, context)
214
388
  })
215
389
  ]
216
390
  }
217
- ])
218
- ];
391
+ ]);
392
+ };
219
393
  }
220
394
 
221
395
  registerEditorPlugin(FileControlPlugin);
@@ -263,4 +263,4 @@ export class ImageControlPlugin extends BasePlugin {
263
263
  ];
264
264
  }
265
265
 
266
- registerEditorPlugin(ImageControlPlugin);
266
+ registerEditorPlugin(ImageControlPlugin);
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @file input-kv 组件的素项目部
3
3
  */
4
+ import {RendererAction, RendererEvent} from '../../event-action';
4
5
  import {
5
6
  defaultValue,
6
7
  getSchemaTpl,
@@ -42,6 +43,66 @@ export class KVControlPlugin extends BasePlugin {
42
43
  }
43
44
  ]
44
45
  };
46
+
47
+ // 事件定义
48
+ events: RendererEvent[] = [
49
+ {
50
+ eventName: 'add',
51
+ eventLabel: '添加',
52
+ description: '添加组合项时触发',
53
+ dataSchema: [
54
+ {
55
+ type: 'object',
56
+ properties: {
57
+ 'event.data.value': {
58
+ type: 'object',
59
+ title: '当前组合项的值'
60
+ }
61
+ }
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ eventName: 'delete',
67
+ eventLabel: '删除',
68
+ description: '删除组合项时触发',
69
+ dataSchema: [
70
+ {
71
+ type: 'object',
72
+ properties: {
73
+ 'event.data.key': {
74
+ type: 'string',
75
+ title: '删除项的索引'
76
+ },
77
+ 'event.data.value': {
78
+ type: 'string',
79
+ title: '当前组合项的值'
80
+ }
81
+ }
82
+ }
83
+ ]
84
+ }
85
+ ];
86
+
87
+ // 动作定义
88
+ actions: RendererAction[] = [
89
+ {
90
+ actionType: 'clear',
91
+ actionLabel: '清空',
92
+ description: '清除选中值'
93
+ },
94
+ {
95
+ actionType: 'reset',
96
+ actionLabel: '重置',
97
+ description: '将值重置为resetValue,若没有配置resetValue,则清空'
98
+ },
99
+ {
100
+ actionType: 'setValue',
101
+ actionLabel: '赋值',
102
+ description: '触发组件数据更新'
103
+ }
104
+ ];
105
+
45
106
  panelTitle = 'KV 键值对';
46
107
  panelBody = [
47
108
  {
@@ -8,7 +8,7 @@ export class MonthControlPlugin extends DateControlPlugin {
8
8
  $schema = '/schemas/MonthControlSchema.json';
9
9
 
10
10
  // 组件名称
11
- name = 'Month';
11
+ name = '日期';
12
12
  isBaseComponent = true;
13
13
  icon = 'fa fa-calendar';
14
14
  description = `月份选择`;
@@ -19,6 +19,8 @@ export class MonthControlPlugin extends DateControlPlugin {
19
19
  type: 'input-month',
20
20
  name: 'month'
21
21
  };
22
+
23
+ disabledRendererPlugin = true;
22
24
  previewSchema: any = {
23
25
  type: 'form',
24
26
  wrapWithPanel: false,