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,6 +1,7 @@
1
1
  import {registerEditorPlugin} from '../manager';
2
2
  import {BaseEventContext, BasePlugin} from '../plugin';
3
3
  import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
4
+ import {tipedLabel} from '../component/control/BaseControl';
4
5
 
5
6
  export class ProgressPlugin extends BasePlugin {
6
7
  // 关联渲染器名字
@@ -9,6 +10,7 @@ export class ProgressPlugin extends BasePlugin {
9
10
 
10
11
  // 组件名称
11
12
  name = '进度展示';
13
+ searchKeywords = '进度条、progress';
12
14
  isBaseComponent = true;
13
15
  description = '用来展示进度。可配置各个进度段用不同的颜色展示。';
14
16
  docLink = '/amis/zh-CN/components/progress';
@@ -16,109 +18,247 @@ export class ProgressPlugin extends BasePlugin {
16
18
  icon = 'fa fa-angle-double-right';
17
19
  scaffold = {
18
20
  type: 'progress',
19
- value: 66.66
21
+ value: 66,
22
+ strokeWidth: 6
20
23
  };
21
24
  previewSchema = {
22
25
  ...this.scaffold
23
26
  };
24
27
 
25
28
  panelTitle = '进度';
29
+
30
+ panelJustify = true;
31
+
26
32
  panelBodyCreator = (context: BaseEventContext) => {
27
- const isUnderField = /\/field\/\w+$/.test(context.path as string);
28
- return [
29
- getSchemaTpl('tabs', [
30
- {
31
- title: '常规',
32
- body: [
33
- isUnderField
34
- ? {
35
- type: 'tpl',
36
- inline: false,
37
- className: 'text-info text-sm',
38
- tpl: '<p>当前为字段内容节点配置,选择上层还有更多的配置。</p>'
33
+ const isFormItem = !!context?.info.renderer.isFormItem;
34
+ return getSchemaTpl('tabs', [
35
+ {
36
+ title: '属性',
37
+ body: getSchemaTpl('collapseGroup', [
38
+ {
39
+ title: '基本',
40
+ body: [
41
+ {
42
+ label: '类型',
43
+ name: 'mode',
44
+ type: 'select',
45
+ option: '继承',
46
+ value: 'line',
47
+ tiled: true,
48
+ options: [
49
+ {
50
+ label: '线形',
51
+ value: 'line'
52
+ },
53
+
54
+ {
55
+ label: '圆形',
56
+ value: 'circle'
57
+ },
58
+
59
+ {
60
+ label: '仪表盘',
61
+ value: 'dashboard'
62
+ }
63
+ ],
64
+ onChange: (
65
+ value: any,
66
+ oldValue: boolean,
67
+ model: any,
68
+ form: any
69
+ ) => {
70
+ if (value === 'circle') {
71
+ form.setValueByName('gapDegree', 0);
72
+ form.setValueByName('gapPosition', '');
73
+ } else if (value === 'dashboard') {
74
+ form.setValueByName('gapDegree', 75);
75
+ form.setValueByName('gapPosition', 'bottom');
76
+ }
77
+ }
78
+ },
79
+ {
80
+ type: 'input-number',
81
+ name: 'value',
82
+ label: '默认值',
83
+ min: 0,
84
+ max: 100
85
+ },
86
+ getSchemaTpl('menuTpl', {
87
+ name: 'valueTpl'
88
+ }),
89
+
90
+ getSchemaTpl('switch', {
91
+ name: 'showLabel',
92
+ label: '进度值',
93
+ pipeIn: defaultValue(true)
94
+ }),
95
+
96
+ getSchemaTpl('placeholder', {
97
+ value: '-',
98
+ placeholder: '无数据空位提示',
99
+ label: tipedLabel('占位提示', '数据字段未定义时的值,不包括0')
100
+ })
101
+ ]
102
+ },
103
+ getSchemaTpl('status', {isFormItem})
104
+ ])
105
+ },
106
+ {
107
+ title: '外观',
108
+ body: getSchemaTpl('collapseGroup', [
109
+ {
110
+ title: '基本',
111
+ body: [
112
+ {
113
+ type: 'select',
114
+ name: 'progressClassName',
115
+ label: '尺寸',
116
+ value: '',
117
+ options: [
118
+ {
119
+ label: '极小',
120
+ value: 'w-xs'
121
+ },
122
+
123
+ {
124
+ label: '小',
125
+ value: 'w-sm'
126
+ },
127
+
128
+ {
129
+ label: '中',
130
+ value: 'w-md'
131
+ },
132
+
133
+ {
134
+ label: '大',
135
+ value: 'w-lg'
136
+ },
137
+
138
+ {
139
+ label: '默认',
140
+ value: ''
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ type: 'input-number',
146
+ name: 'strokeWidth',
147
+ label: '线条宽度',
148
+ value: 6,
149
+ min: 0,
150
+ max: 100
151
+ },
152
+ {
153
+ type: 'input-number',
154
+ name: 'gapDegree',
155
+ visibleOn: 'data.mode === "dashboard"',
156
+ label: '缺口角度',
157
+ value: 75,
158
+ min: 0,
159
+ max: 295
160
+ },
161
+ {
162
+ label: '缺口位置',
163
+ name: 'gapPosition',
164
+ type: 'button-group-select',
165
+ visibleOn: 'data.mode === "dashboard"',
166
+ value: defaultValue('bottom'),
167
+ tiled: true,
168
+ options: [
169
+ {
170
+ label: '上',
171
+ value: 'top'
172
+ },
173
+
174
+ {
175
+ label: '下',
176
+ value: 'bottom'
177
+ },
178
+
179
+ {
180
+ label: '左',
181
+ value: 'left'
182
+ },
183
+ {
184
+ label: '右',
185
+ value: 'right'
186
+ }
187
+ ]
188
+ },
189
+ getSchemaTpl('switch', {
190
+ name: 'animate',
191
+ label: '显示动画',
192
+ visibleOn: 'data.mode === "line"'
193
+ }),
194
+ {
195
+ type: 'button-group-select',
196
+ name: 'style',
197
+ label: '样式',
198
+ visibleOn: 'data.mode === "line"',
199
+ options: [
200
+ {
201
+ label: '纯色',
202
+ value: 'purity'
203
+ },
204
+ {
205
+ label: '条纹',
206
+ value: 'stripe'
207
+ }
208
+ ],
209
+ pipeIn: (value: any, form: any) => {
210
+ return form.data?.stripe ? 'stripe' : 'purity';
211
+ },
212
+ onChange(value: any, oldValue: boolean, model: any, form: any) {
213
+ form.setValueByName('stripe', value === 'stripe');
39
214
  }
40
- : null,
41
-
42
- {
43
- name: 'showLabel',
44
- type: 'switch',
45
- mode: 'inline',
46
- pipeIn: defaultValue(true),
47
- label: '是否显示文字'
48
- },
49
-
50
- {
51
- name: 'stripe',
52
- type: 'switch',
53
- mode: 'inline',
54
- label: '是否显示条纹'
55
- },
56
-
57
- {
58
- name: 'animate',
59
- type: 'switch',
60
- mode: 'inline',
61
- label: '是否显示动画'
62
- },
63
-
64
- {
65
- name: 'map',
66
- label: '等级配置',
67
- type: 'input-array',
68
- items: {
69
- type: 'input-text'
70
215
  },
71
- descrition: '配置不通的值段,用不通的样式提示用户',
72
- pipeIn: defaultValue([
73
- 'bg-danger',
74
- 'bg-warning',
75
- 'bg-info',
76
- 'bg-success',
77
- 'bg-success'
78
- ])
79
- },
80
-
81
- getSchemaTpl('switchDefaultValue'),
82
-
83
- {
84
- type: 'input-text',
85
- name: 'value',
86
- label: '默认值',
87
- validations: 'isNumeric',
88
- visibleOn: 'typeof this.value !== "undefined"'
89
- },
90
-
91
- {
92
- name: 'placeholder',
93
- type: 'input-text',
94
- pipeIn: defaultValue('-'),
95
- label: '占位符'
96
- }
97
- ]
98
- },
99
- {
100
- title: '外观',
101
- body: [
102
- getSchemaTpl('className'),
103
- getSchemaTpl('className', {
104
- name: 'progressClassName',
105
- label: '进度外层 CSS 类名',
106
- pipeIn: defaultValue(
107
- 'progress-xs progress-striped active m-t-xs m-b-none'
108
- )
109
- }),
110
- getSchemaTpl('className', {
111
- name: 'progressBarClassName',
112
- label: '进度条 CSS 类名'
113
- })
114
- ]
115
- },
116
- {
117
- title: '显隐',
118
- body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
119
- }
120
- ])
121
- ];
216
+ {
217
+ name: 'map',
218
+ type: 'combo',
219
+ mode: 'normal',
220
+ multiple: true,
221
+ label: tipedLabel(
222
+ '颜色',
223
+ '分配不同的值段,用不同的颜色提示用户'
224
+ ),
225
+ items: [
226
+ {
227
+ type: 'input-number',
228
+ name: 'value',
229
+ placeholder: 'value',
230
+ required: true,
231
+ columnClassName: 'w-xs',
232
+ unique: true,
233
+ min: 0,
234
+ step: 10,
235
+ precision: 0
236
+ },
237
+ {
238
+ placeholder: 'color',
239
+ type: 'input-color',
240
+ name: 'color',
241
+ required: true
242
+ }
243
+ ],
244
+ value: [
245
+ {color: '#dc3545', value: 20},
246
+ {color: '#fad733', value: 60},
247
+ {color: '#28a745', value: 100}
248
+ ],
249
+ pipeIn: (value: any) => {
250
+ return Array.isArray(value) ? value : [];
251
+ }
252
+ }
253
+ ]
254
+ },
255
+ getSchemaTpl('style:classNames', {
256
+ schema: [],
257
+ isFormItem
258
+ })
259
+ ])
260
+ }
261
+ ]);
122
262
  };
123
263
  }
124
264
 
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import {registerEditorPlugin} from '../manager';
4
4
  import {BaseEventContext, BasePlugin, RegionConfig} from '../plugin';
5
5
  import {getSchemaTpl} from '../component/schemaTpl';
6
+ import {getEventControlConfig} from '../util';
6
7
 
7
8
  export class ServicePlugin extends BasePlugin {
8
9
  // 关联渲染器名字
@@ -82,15 +83,14 @@ export class ServicePlugin extends BasePlugin {
82
83
  step: 500,
83
84
  description: '设置后将自动定时刷新,单位 ms'
84
85
  },
85
- {
86
+
87
+ getSchemaTpl('switch', {
86
88
  name: 'silentPolling',
87
89
  label: '静默加载',
88
- mode: 'inline',
89
- className: 'block',
90
- type: 'switch',
91
90
  visibleOn: '!!data.interval',
92
91
  description: '设置自动定时刷新是否显示加载动画'
93
- },
92
+ }),
93
+
94
94
  {
95
95
  name: 'stopAutoRefreshWhen',
96
96
  label: '停止定时刷新检测',
@@ -152,7 +152,11 @@ export class ServicePlugin extends BasePlugin {
152
152
  body: [
153
153
  getSchemaTpl('ref'),
154
154
  getSchemaTpl('name'),
155
- getSchemaTpl('visible')
155
+ getSchemaTpl('visible'),
156
+ getSchemaTpl('eventControl', {
157
+ name: 'onEvent',
158
+ ...getEventControlConfig(this.manager, context)
159
+ })
156
160
  ]
157
161
  }
158
162
  ]);
@@ -15,6 +15,7 @@ import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
15
15
  import {repeatArray} from '../util';
16
16
  import {setVariable} from 'amis-core';
17
17
  import {mockValue} from '../mocker';
18
+ import {EditorNodeType} from '../store/node';
18
19
  import {SchemaObject} from 'amis/lib/Schema';
19
20
 
20
21
  export class TablePlugin extends BasePlugin {
@@ -242,43 +243,31 @@ export class TablePlugin extends BasePlugin {
242
243
  description: '自动即列数量大于5个时自动开启'
243
244
  },
244
245
 
245
- {
246
+ getSchemaTpl('switch', {
246
247
  name: 'affixHeader',
247
- type: 'switch',
248
248
  label: '是否固顶表头',
249
- mode: 'inline',
250
- className: 'w-full',
251
249
  pipeIn: defaultValue(true)
252
- },
250
+ }),
253
251
 
254
- {
252
+ getSchemaTpl('switch', {
255
253
  name: 'showHeader',
256
- type: 'switch',
257
- mode: 'inline',
258
- className: 'w-full',
259
254
  label: '是否显示头部',
260
255
  pipeIn: defaultValue(true)
261
- },
256
+ }),
262
257
 
263
- {
258
+ getSchemaTpl('switch', {
264
259
  name: 'showFooter',
265
- type: 'switch',
266
- mode: 'inline',
267
- className: 'w-full',
268
260
  label: '是否显示底部',
269
261
  pipeIn: defaultValue(true)
270
- },
262
+ }),
271
263
 
272
- {
264
+ getSchemaTpl('switch', {
273
265
  name: 'footable',
274
- type: 'switch',
275
- mode: 'inline',
276
- className: 'w-full',
277
266
  label: '是否开启单条底部展示',
278
267
  description:
279
268
  '如果列太多显示会很臃肿,可以考虑把部分列放在当前行的底部展示',
280
269
  pipeIn: (value: any) => !!value
281
- },
270
+ }),
282
271
 
283
272
  {
284
273
  name: 'footable.expand',
@@ -423,6 +412,46 @@ export class TablePlugin extends BasePlugin {
423
412
  };
424
413
  }
425
414
  }
415
+
416
+ async buildDataSchemas(node: EditorNodeType, region?: EditorNodeType) {
417
+ const itemsSchema: any = {
418
+ $id: 'tableRow',
419
+ type: 'object',
420
+ properties: {}
421
+ };
422
+ const columns: EditorNodeType = node.children.find(
423
+ item => item.isRegion && item.region === 'columns'
424
+ );
425
+
426
+ for (let current of columns.children) {
427
+ const schema = current.schema;
428
+ if (schema.name) {
429
+ itemsSchema.properties[schema.name] = current.info?.plugin
430
+ ?.buildDataSchemas
431
+ ? await current.info.plugin.buildDataSchemas(current, region)
432
+ : {
433
+ type: 'string',
434
+ title: schema.label || schema.name,
435
+ description: schema.description
436
+ };
437
+ }
438
+ }
439
+
440
+ if (region?.region === 'columns') {
441
+ return itemsSchema;
442
+ }
443
+
444
+ return {
445
+ $id: 'table',
446
+ type: 'object',
447
+ properties: {
448
+ items: {
449
+ type: 'array',
450
+ items: itemsSchema
451
+ }
452
+ }
453
+ };
454
+ }
426
455
  }
427
456
 
428
457
  registerEditorPlugin(TablePlugin);