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
@@ -1,6 +1,10 @@
1
+ import React from 'react';
2
+ import {RendererAction, RendererEvent} from '../../event-action';
1
3
  import {defaultValue, getSchemaTpl} from '../../component/schemaTpl';
4
+ import {getComboWrapper} from '../../event-action/schema';
2
5
  import {registerEditorPlugin} from '../../manager';
3
- import {BasePlugin} from '../../plugin';
6
+ import {BaseEventContext, BasePlugin} from '../../plugin';
7
+ import {getEventControlConfig} from '../../util';
4
8
 
5
9
  export class TreeControlPlugin extends BasePlugin {
6
10
  // 关联渲染器名字
@@ -50,7 +54,158 @@ export class TreeControlPlugin extends BasePlugin {
50
54
  }
51
55
  };
52
56
 
57
+ notRenderFormZone = true;
58
+
53
59
  panelTitle = '树选择';
60
+
61
+ // 事件定义
62
+ events: RendererEvent[] = [
63
+ {
64
+ eventName: 'change',
65
+ eventLabel: '值变化',
66
+ description: '选中值变化时触发',
67
+ dataSchema: [
68
+ {
69
+ type: 'object',
70
+ properties: {
71
+ 'event.data.value': {
72
+ type: 'string',
73
+ title: '选中节点的值'
74
+ }
75
+ }
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ eventName: 'add',
81
+ eventLabel: '新增选项',
82
+ description: '新增节点提交时触发',
83
+ dataSchema: [
84
+ {
85
+ type: 'object',
86
+ properties: {
87
+ 'event.data.value': {
88
+ type: 'object',
89
+ title: '新增的节点信息'
90
+ },
91
+ 'event.data.options': {
92
+ type: 'array',
93
+ title: '选项集合'
94
+ }
95
+ }
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ eventName: 'edit',
101
+ eventLabel: '编辑选项',
102
+ description: '编辑选项',
103
+ dataSchema: [
104
+ {
105
+ type: 'object',
106
+ properties: {
107
+ 'event.data.value': {
108
+ type: 'object',
109
+ title: '编辑的节点信息'
110
+ },
111
+ 'event.data.options': {
112
+ type: 'array',
113
+ title: '选项集合'
114
+ }
115
+ }
116
+ }
117
+ ]
118
+ },
119
+ {
120
+ eventName: 'delete',
121
+ eventLabel: '删除选项',
122
+ description: '删除选项',
123
+ dataSchema: [
124
+ {
125
+ type: 'object',
126
+ properties: {
127
+ 'event.data.value': {
128
+ type: 'object',
129
+ title: '删除的节点信息'
130
+ },
131
+ 'event.data.options': {
132
+ type: 'array',
133
+ title: '选项集合'
134
+ }
135
+ }
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ eventName: 'loadFinished',
141
+ eventLabel: '懒加载完成',
142
+ description: '懒加载接口远程请求成功时触发',
143
+ dataSchema: [
144
+ {
145
+ type: 'object',
146
+ properties: {
147
+ 'event.data.value': {
148
+ type: 'object',
149
+ title: 'deferApi 懒加载远程请求成功后返回的数据'
150
+ }
151
+ }
152
+ }
153
+ ]
154
+ }
155
+ ];
156
+
157
+ // 动作定义
158
+ actions: RendererAction[] = [
159
+ {
160
+ actionType: 'expand',
161
+ actionLabel: '展开',
162
+ description: '展开指定层级',
163
+ config: ['openLevel'],
164
+ desc: (info: any) => {
165
+ return (
166
+ <div>
167
+ <span className="variable-right">{info?.__rendererLabel}</span>
168
+ 展开到第
169
+ <span className="variable-left variable-right">
170
+ {info?.args?.openLevel}
171
+ </span>
172
+
173
+ </div>
174
+ );
175
+ },
176
+ schema: getComboWrapper({
177
+ type: 'input-formula',
178
+ variables: '${variables}',
179
+ evalMode: false,
180
+ variableMode: 'tabs',
181
+ label: '展开层级',
182
+ size: 'lg',
183
+ name: 'openLevel',
184
+ mode: 'horizontal'
185
+ })
186
+ },
187
+ {
188
+ actionType: 'collapse',
189
+ actionLabel: '收起',
190
+ description: '收起树节点'
191
+ },
192
+ {
193
+ actionType: 'clear',
194
+ actionLabel: '清空',
195
+ description: '清除数据'
196
+ },
197
+ {
198
+ actionType: 'reset',
199
+ actionLabel: '重置',
200
+ description: '重置数据'
201
+ },
202
+ {
203
+ actionType: 'setValue',
204
+ actionLabel: '赋值',
205
+ description: '触发组件数据更新'
206
+ }
207
+ ];
208
+
54
209
  panelDefinitions = {
55
210
  options: {
56
211
  label: '选项 Options',
@@ -92,7 +247,7 @@ export class TreeControlPlugin extends BasePlugin {
92
247
  ]
93
248
  }
94
249
  };
95
- panelBody = [
250
+ panelBodyCreator = (context: BaseEventContext) =>
96
251
  getSchemaTpl('tabs', [
97
252
  {
98
253
  title: '常规',
@@ -141,49 +296,41 @@ export class TreeControlPlugin extends BasePlugin {
141
296
  2
142
297
  )
143
298
  }),
144
- {
299
+
300
+ getSchemaTpl('switch', {
145
301
  label: '隐藏顶级',
146
- name: 'hideRoot',
147
- type: 'switch',
148
- mode: 'inline',
149
- className: 'w-full'
150
- },
151
- {
302
+ name: 'hideRoot'
303
+ }),
304
+
305
+ getSchemaTpl('switch', {
152
306
  name: 'showIcon',
153
307
  label: '是否显示图标',
154
- type: 'switch',
155
- mode: 'inline',
156
- className: 'w-full',
157
308
  pipeIn: defaultValue(true)
158
- },
309
+ }),
310
+
159
311
  getSchemaTpl('multiple'),
160
- {
312
+
313
+ getSchemaTpl('switch', {
161
314
  name: 'cascade',
315
+ label: '不自动选中子节点',
162
316
  visibleOn: 'data.multiple',
163
- label: '不自动选中子节点?',
164
- type: 'switch',
165
- description: '选中父级时,孩子节点是否自动选中',
166
- mode: 'inline',
167
- className: 'w-full'
168
- },
169
- {
317
+ description: '选中父级时,孩子节点是否自动选中'
318
+ }),
319
+
320
+ getSchemaTpl('switch', {
170
321
  name: 'withChildren',
171
- visibleOn: 'data.cascade !== true && data.multiple',
172
322
  label: '数值是否携带子节点',
173
- type: 'switch',
174
- disabledOn: 'data.onlyChildren',
175
- mode: 'inline',
176
- className: 'w-full'
177
- },
178
- {
179
- name: 'onlyChildren',
180
323
  visibleOn: 'data.cascade !== true && data.multiple',
324
+ disabledOn: 'data.onlyChildren'
325
+ }),
326
+
327
+ getSchemaTpl('switch', {
328
+ name: 'onlyChildren',
181
329
  label: '数值是否只包含子节点',
182
- disabledOn: 'data.withChildren',
183
- type: 'switch',
184
- mode: 'inline',
185
- className: 'w-full'
186
- },
330
+ visibleOn: 'data.cascade !== true && data.multiple',
331
+ disabledOn: 'data.withChildren'
332
+ }),
333
+
187
334
  getSchemaTpl('joinValues'),
188
335
  getSchemaTpl('delimiter'),
189
336
  getSchemaTpl('extractValue'),
@@ -203,27 +350,30 @@ export class TreeControlPlugin extends BasePlugin {
203
350
  visibleOn: 'data.hideRoot !== true'
204
351
  },
205
352
 
206
- {
353
+ getSchemaTpl('switch', {
207
354
  name: 'showIcon',
208
355
  label: '是否显示图标',
209
- type: 'switch',
210
- mode: 'inline',
211
- className: 'w-full',
212
356
  pipeIn: defaultValue(true)
213
- },
357
+ }),
214
358
 
215
- {
359
+ getSchemaTpl('switch', {
216
360
  label: '是否显示单选按钮',
217
361
  name: 'showRadio',
218
- type: 'switch',
219
- mode: 'inline',
220
- className: 'w-full',
221
362
  visibleOn: '!data.multiple'
222
- }
363
+ })
364
+ ]
365
+ },
366
+ {
367
+ title: '事件',
368
+ className: 'p-none',
369
+ body: [
370
+ getSchemaTpl('eventControl', {
371
+ name: 'onEvent',
372
+ ...getEventControlConfig(this.manager, context)
373
+ })
223
374
  ]
224
375
  }
225
- ])
226
- ];
376
+ ]);
227
377
  }
228
378
 
229
379
  registerEditorPlugin(TreeControlPlugin);
@@ -18,6 +18,8 @@ export class URLControlPlugin extends TextControlPlugin {
18
18
  name: 'url'
19
19
  };
20
20
 
21
+ disabledRendererPlugin = true;
22
+
21
23
  previewSchema = {
22
24
  type: 'form',
23
25
  className: 'text-left',
@@ -19,6 +19,8 @@ export class YearControlPlugin extends DateControlPlugin {
19
19
  type: 'input-year',
20
20
  name: 'year'
21
21
  };
22
+
23
+ disabledRendererPlugin = true;
22
24
  previewSchema: any = {
23
25
  type: 'form',
24
26
  wrapWithPanel: false,
@@ -0,0 +1,41 @@
1
+ import {registerEditorPlugin} from '../../manager';
2
+
3
+ import {DateRangeControlPlugin} from './InputDateRange';
4
+
5
+ export class YearRangeControlPlugin extends DateRangeControlPlugin {
6
+ // 关联渲染器名字
7
+ rendererName = 'input-year-range';
8
+ $schema = '/schemas/DateRangeControlSchema.json';
9
+
10
+ order = -440;
11
+
12
+ // 组件名称
13
+ icon = 'fa fa-calendar';
14
+ name = '日期范围';
15
+ isBaseComponent = true;
16
+ description =
17
+ '年份范围选择,可通过<code>minDate</code>、<code>maxDate</code>设定最小、最大日期';
18
+ docLink = '/amis/zh-CN/components/form/year-range';
19
+ tags = ['表单项'];
20
+ scaffold = {
21
+ type: 'input-year-range',
22
+ label: '日期范围',
23
+ name: 'year-range'
24
+ };
25
+ previewSchema: any = {
26
+ type: 'form',
27
+ className: 'text-left',
28
+ mode: 'horizontal',
29
+ wrapWithPanel: false,
30
+ body: [
31
+ {
32
+ ...this.scaffold
33
+ }
34
+ ]
35
+ };
36
+
37
+ disabledRendererPlugin = true;
38
+ notRenderFormZone = true;
39
+ }
40
+
41
+ registerEditorPlugin(YearRangeControlPlugin);
@@ -24,25 +24,30 @@ export class ItemPlugin extends BasePlugin {
24
24
  panels: Array<BasicPanelItem>
25
25
  ) {
26
26
  const renderer = context.info.renderer;
27
+ const store = this.manager.store;
27
28
 
28
29
  if (context.selections.length) {
29
30
  return;
30
31
  }
31
-
32
+ const plugin = context.info.plugin;
32
33
  // 如果是表单项
33
- if (!context.info.hostId && renderer?.isFormItem) {
34
+ if (
35
+ !context.info.hostId &&
36
+ renderer?.isFormItem &&
37
+ !plugin?.notRenderFormZone
38
+ ) {
34
39
  panels.push({
35
40
  key: 'form-item',
36
41
  icon: 'fa fa-desktop',
37
42
  title: this.panelTitle,
38
43
  render: this.manager.makeSchemaFormRender({
39
- body: this.panelBodyCreator(context)
44
+ body: this.panelBodyCreator(context),
45
+ panelById: store.activeId
40
46
  }),
41
47
  order: -200
42
48
  });
43
49
  }
44
50
  }
45
-
46
51
  panelBodyCreator = (context: BaseEventContext) => {
47
52
  const ignoreName = ~['button', 'submit', 'reset'].indexOf(
48
53
  context.schema.type
@@ -87,21 +92,17 @@ export class ItemPlugin extends BasePlugin {
87
92
  }),
88
93
  renderer.renderLabel !== false ? getSchemaTpl('label') : null,
89
94
  hasReadOnly
90
- ? {
91
- type: 'switch',
95
+ ? getSchemaTpl('switch', {
92
96
  name: 'readOnly',
93
- label: '只读模式',
94
- mode: 'inline',
95
- className: 'w-full'
96
- }
97
+ label: '只读模式'
98
+ })
97
99
  : null,
98
- {
99
- type: 'switch',
100
+ getSchemaTpl('switch', {
100
101
  name: 'disabled',
101
102
  label: '禁用',
102
103
  mode: 'inline',
103
104
  className: 'w-full'
104
- },
105
+ }),
105
106
  ignoreValidator ? null : getSchemaTpl('required'),
106
107
  getSchemaTpl('description'),
107
108
  getSchemaTpl('placeholder'),
@@ -150,14 +151,12 @@ export class ItemPlugin extends BasePlugin {
150
151
  // TODO: 有些表单项没有 disabled
151
152
  getSchemaTpl('disabled'),
152
153
  getSchemaTpl('visible'),
153
- {
154
- type: 'switch',
154
+
155
+ getSchemaTpl('switch', {
155
156
  name: 'clearValueOnHidden',
156
157
  label: '隐藏时删除表单项值',
157
- mode: 'inline',
158
- className: 'w-full',
159
158
  disabledOn: 'typeof this.visible === "boolean"'
160
- }
159
+ })
161
160
  ]
162
161
  },
163
162
  ignoreValidator
@@ -1,6 +1,9 @@
1
1
  import {getSchemaTpl} from '../../component/schemaTpl';
2
2
  import {registerEditorPlugin} from '../../manager';
3
- import {BasePlugin} from '../../plugin';
3
+ import {BasePlugin, BaseEventContext} from '../../plugin';
4
+
5
+ import {formItemControl} from '../../component/control/BaseControl';
6
+ import {RendererAction, RendererEvent} from '../../event-action';
4
7
 
5
8
  export class ListControlPlugin extends BasePlugin {
6
9
  // 关联渲染器名字
@@ -45,29 +48,81 @@ export class ListControlPlugin extends BasePlugin {
45
48
  ]
46
49
  };
47
50
 
51
+ notRenderFormZone = true;
52
+
48
53
  panelTitle = '列表选择';
49
- panelBody = [
50
- getSchemaTpl('switchDefaultValue'),
54
+
55
+ // 事件定义
56
+ events: RendererEvent[] = [
51
57
  {
52
- type: 'list-select',
53
- name: 'value',
54
- label: '默认值',
55
- description: '请填入选项 Options 中 value 值',
56
- source: '${options}',
57
- visibleOn: 'typeof this.value !== "undefined"'
58
- },
59
- getSchemaTpl('fieldSet', {
60
- title: '选项',
61
- body: [
62
- getSchemaTpl('multiple'),
63
- getSchemaTpl('joinValues'),
64
- getSchemaTpl('delimiter'),
65
- getSchemaTpl('extractValue'),
66
- getSchemaTpl('options'),
67
- getSchemaTpl('source')
58
+ eventName: 'change',
59
+ eventLabel: '值变化',
60
+ description: '选中值变化时触发',
61
+ dataSchema: [
62
+ {
63
+ type: 'object',
64
+ properties: {
65
+ 'event.data.value': {
66
+ type: 'string',
67
+ title: '选中值'
68
+ }
69
+ }
70
+ }
68
71
  ]
69
- })
72
+ }
70
73
  ];
74
+
75
+ // 动作定义
76
+ actions: RendererAction[] = [
77
+ {
78
+ actionType: 'clear',
79
+ actionLabel: '清空',
80
+ description: '清除选中值'
81
+ },
82
+ {
83
+ actionType: 'reset',
84
+ actionLabel: '重置',
85
+ description: '将值重置为resetValue,若没有配置resetValue,则清空'
86
+ },
87
+ {
88
+ actionType: 'reload',
89
+ actionLabel: '重新加载',
90
+ description: '触发组件数据刷新并重新渲染'
91
+ },
92
+ {
93
+ actionType: 'setValue',
94
+ actionLabel: '赋值',
95
+ description: '触发组件数据更新'
96
+ }
97
+ ];
98
+
99
+ panelBodyCreator = (context: BaseEventContext) => {
100
+ return formItemControl(
101
+ {
102
+ common: {
103
+ replace: true,
104
+ body: [
105
+ getSchemaTpl('formItemName', {
106
+ required: true
107
+ }),
108
+ getSchemaTpl('label'),
109
+ getSchemaTpl('multiple'),
110
+ getSchemaTpl('extractValue')
111
+ ]
112
+ },
113
+ option: {
114
+ body: [
115
+ getSchemaTpl('optionControl', {
116
+ description: '设置选项后,输入时会下拉这些选项供用户参考。'
117
+ }),
118
+ getSchemaTpl('value')
119
+ ]
120
+ },
121
+ status: {}
122
+ },
123
+ context
124
+ );
125
+ };
71
126
  }
72
127
 
73
128
  registerEditorPlugin(ListControlPlugin);
@@ -1,3 +1,4 @@
1
+ import {getSchemaTpl} from '../../component/schemaTpl';
1
2
  import {registerEditorPlugin} from '../../manager';
2
3
  import {BasePlugin} from '../../plugin';
3
4
 
@@ -32,13 +33,7 @@ export class LocationControlPlugin extends BasePlugin {
32
33
 
33
34
  panelTitle = '地理位置选择';
34
35
  panelBody = [
35
- {
36
- name: 'clearable',
37
- label: '是否可清除',
38
- type: 'switch',
39
- mode: 'inline',
40
- className: 'block'
41
- },
36
+ getSchemaTpl('clearable'),
42
37
  {
43
38
  type: 'input-text',
44
39
  name: 'ak',
@@ -133,4 +133,4 @@ export class MatrixControlPlugin extends BasePlugin {
133
133
  ];
134
134
  }
135
135
 
136
- registerEditorPlugin(MatrixControlPlugin);
136
+ registerEditorPlugin(MatrixControlPlugin);