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
@@ -6,8 +6,15 @@ import {
6
6
  PluginInterface,
7
7
  RendererInfoResolveEventContext
8
8
  } from '../plugin';
9
- import {getSchemaTpl} from '../component/schemaTpl';
9
+ import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
10
+ import {
11
+ BUTTON_DEFAULT_ACTION,
12
+ tipedLabel
13
+ } from '../component/control/BaseControl';
14
+ import {getEventControlConfig} from '../util';
10
15
  import {SchemaObject} from 'amis/lib/Schema';
16
+ import {RendererAction, RendererEvent} from '../event-action';
17
+ import {getOldActionSchema} from '../event-action/schema';
11
18
 
12
19
  export class ButtonPlugin extends BasePlugin {
13
20
  // 关联渲染器名字
@@ -25,11 +32,7 @@ export class ButtonPlugin extends BasePlugin {
25
32
  scaffold: SchemaObject = {
26
33
  type: 'button',
27
34
  label: '按钮',
28
- actionType: 'dialog',
29
- dialog: {
30
- title: '系统提示',
31
- body: '对你点击了'
32
- }
35
+ ...BUTTON_DEFAULT_ACTION
33
36
  };
34
37
  previewSchema: any = {
35
38
  type: 'button',
@@ -37,204 +40,270 @@ export class ButtonPlugin extends BasePlugin {
37
40
  };
38
41
 
39
42
  panelTitle = '按钮';
43
+
44
+ // 事件定义
45
+ events: RendererEvent[] = [
46
+ {
47
+ eventName: 'click',
48
+ eventLabel: '点击',
49
+ description: '点击时触发',
50
+ defaultShow: true
51
+ },
52
+ {
53
+ eventName: 'mouseenter',
54
+ eventLabel: '鼠标移入',
55
+ description: '鼠标移入时触发'
56
+ },
57
+ {
58
+ eventName: 'mouseleave',
59
+ eventLabel: '鼠标移出',
60
+ description: '鼠标移出时触发'
61
+ }
62
+ // {
63
+ // eventName: 'doubleClick',
64
+ // eventLabel: '双击',
65
+ // description: '鼠标双击事件'
66
+ // }
67
+ ];
68
+
69
+ // 动作定义
70
+ actions: RendererAction[] = [];
71
+
72
+ panelJustify = true;
73
+
40
74
  panelBodyCreator = (context: BaseEventContext) => {
41
75
  const isInDialog = /(?:\/|^)dialog\/.+$/.test(context.path);
42
- const isInDropdown = /(?:\/|^)dropdown-button\/.+$/.test(context.path);
76
+ const isInDrawer = /(?:\/|^)drawer\/.+$/.test(context.path);
43
77
 
44
- return [
45
- getSchemaTpl('tabs', [
46
- {
47
- title: '常规',
48
- body: [
49
- {
50
- label: '名称',
51
- type: 'input-text',
52
- name: 'label'
53
- },
78
+ // TODO: 旧方法无法判断,context 中没有 dropdown-button 的信息,临时实现
79
+ // const isInDropdown = /(?:\/|^)dropdown-button\/.+$/.test(context.path);
80
+ const isInDropdown = /^button-group\/.+$/.test(context.path);
54
81
 
55
- {
56
- label: '类型',
57
- type: 'button-group-select',
58
- name: 'type',
59
- size: 'sm',
60
- // mode: 'inline',
61
- // className: 'w-full',
62
- options: [
63
- {
64
- label: '按钮',
65
- value: 'button'
66
- },
82
+ return getSchemaTpl('tabs', [
83
+ {
84
+ title: '属性',
85
+ body: getSchemaTpl('collapseGroup', [
86
+ {
87
+ title: '基本',
88
+ body: [
89
+ {
90
+ label: '名称',
91
+ type: 'input-text',
92
+ name: 'label'
93
+ },
67
94
 
68
- {
69
- label: '提交',
70
- value: 'submit'
71
- },
95
+ {
96
+ label: '类型',
97
+ type: 'button-group-select',
98
+ name: 'type',
99
+ size: 'sm',
100
+ options: [
101
+ {
102
+ label: '按钮',
103
+ value: 'button'
104
+ },
72
105
 
73
- {
74
- label: '重置',
75
- value: 'reset'
76
- }
77
- ]
78
- },
106
+ {
107
+ label: '提交',
108
+ value: 'submit'
109
+ },
110
+
111
+ {
112
+ label: '重置',
113
+ value: 'reset'
114
+ }
115
+ ]
116
+ },
79
117
 
80
- {
81
- type: 'input-text',
82
- name: 'tooltip',
83
- hidden: isInDropdown,
84
- label: '提示文案',
85
- description: '鼠标停留时弹出该内容'
86
- },
118
+ getSchemaTpl('switch', {
119
+ name: 'close',
120
+ label: '是否关闭',
121
+ clearValueOnHidden: true,
122
+ labelRemark: `指定此次操作完后关闭当前 ${
123
+ isInDialog ? 'dialog' : 'drawer'
124
+ }`,
125
+ hidden: !isInDialog && !isInDrawer,
126
+ pipeIn: defaultValue(false)
127
+ }),
87
128
 
88
- {
89
- type: 'button-group-select',
90
- name: 'tooltipPlacement',
91
- visibleOn: 'data.tooltip || data.disabledTip',
92
- label: '提示信息位置',
93
- size: 'sm',
94
- mode: 'inline',
95
- className: 'w-full',
96
- value: 'bottom',
97
- options: [
98
- {
99
- label: '',
100
- value: 'top'
101
- },
102
- {
103
- label: '右',
104
- value: 'right'
105
- },
106
- {
107
- label: '下',
108
- value: 'bottom'
109
- },
110
- {
111
- label: '左',
112
- value: 'left'
129
+ {
130
+ type: 'ae-switch-more',
131
+ mode: 'normal',
132
+ formType: 'extend',
133
+ label: tipedLabel(
134
+ '二次确认',
135
+ '点击后先询问用户,由手动确认后再执行动作,避免误触。可用<code>\\${xxx}</code>取值。'
136
+ ),
137
+ form: {
138
+ body: [
139
+ {
140
+ name: 'confirmText',
141
+ type: 'input-text',
142
+ label: '确认内容'
143
+ }
144
+ ]
113
145
  }
114
- ]
115
- },
146
+ },
116
147
 
117
- getSchemaTpl('icon'),
118
- {
119
- type: 'button-group-select',
120
- label: '图标位置',
121
- clearable: true,
122
- visibleOn: 'this.icon',
123
- name: 'iconClassName',
124
- size: 'sm',
125
- pipeIn: (value: any) =>
126
- typeof value === 'string' &&
127
- /\bpull\-(left|right)\b/.test(value)
128
- ? RegExp.$1
129
- : '',
130
- pipeOut: (value: any, originValue: string) => {
131
- return ((originValue as string) || '')
132
- .replace(/\bpull\-(left|right)\b/, '')
133
- .trim() + value
134
- ? `pull-${value}`
135
- : '';
148
+ {
149
+ type: 'ae-switch-more',
150
+ formType: 'extend',
151
+ mode: 'normal',
152
+ label: '气泡提示',
153
+ hidden: isInDropdown,
154
+ form: {
155
+ body: [
156
+ {
157
+ type: 'input-text',
158
+ name: 'tooltip',
159
+ label: tipedLabel(
160
+ '正常提示',
161
+ '正常状态下的提示内容,不填则不弹出提示。可用<code>\\${xxx}</code>取值。'
162
+ )
163
+ },
164
+ {
165
+ type: 'input-text',
166
+ name: 'disabledTip',
167
+ label: tipedLabel(
168
+ '禁用提示',
169
+ '禁用状态下的提示内容,不填则弹出正常提示。可用<code>\\${xxx}</code>取值。'
170
+ ),
171
+ clearValueOnHidden: true,
172
+ visibleOn: 'data.tooltipTrigger !== "focus"'
173
+ },
174
+ {
175
+ type: 'button-group-select',
176
+ name: 'tooltipTrigger',
177
+ label: '触发方式',
178
+ // visibleOn: 'data.tooltip || data.disabledTip',
179
+ size: 'sm',
180
+ options: [
181
+ {
182
+ label: '鼠标悬浮',
183
+ value: 'hover'
184
+ },
185
+ {
186
+ label: '聚焦',
187
+ value: 'focus'
188
+ }
189
+ ],
190
+ pipeIn: defaultValue('hover')
191
+ },
192
+ {
193
+ type: 'button-group-select',
194
+ name: 'tooltipPlacement',
195
+ // visibleOn: 'data.tooltip || data.disabledTip',
196
+ label: '提示位置',
197
+ size: 'sm',
198
+ options: [
199
+ {
200
+ label: '上',
201
+ value: 'top'
202
+ },
203
+ {
204
+ label: '右',
205
+ value: 'right'
206
+ },
207
+ {
208
+ label: '下',
209
+ value: 'bottom'
210
+ },
211
+ {
212
+ label: '左',
213
+ value: 'left'
214
+ }
215
+ ],
216
+ pipeIn: defaultValue('bottom')
217
+ }
218
+ ]
219
+ }
136
220
  },
137
- options: [
138
- {label: '居左', value: 'left'},
139
- {label: '居右', value: 'right'}
140
- ]
141
- },
142
221
 
143
- getSchemaTpl('size', {
144
- label: '尺寸'
145
- }),
146
- {
147
- label: '样式',
148
- type: 'select',
149
- name: 'level',
150
- hidden: isInDropdown,
151
- clearable: false,
152
- btnActiveLevel: '',
153
- options: [
154
- {
155
- label: '默认',
156
- value: 'default',
157
- level: 'default'
158
- },
159
- {
160
- label: '链接',
161
- value: 'link',
162
- level: 'link'
163
- },
164
- {
165
- label: '主色',
166
- value: 'primary',
167
- level: 'primary'
168
- },
222
+ getSchemaTpl('icon', {
223
+ label: '左侧图标'
224
+ }),
169
225
 
170
- {
171
- label: '淡色',
172
- value: 'light',
173
- level: 'light'
174
- },
175
- {
176
- label: '深色',
177
- value: 'dark',
178
- level: 'dark'
179
- },
226
+ getSchemaTpl('icon', {
227
+ name: 'rightIcon',
228
+ label: '右侧图标'
229
+ })
230
+ ]
231
+ },
232
+ getSchemaTpl('status', {
233
+ disabled: true
234
+ })
235
+ ])
236
+ },
237
+ {
238
+ title: '外观',
239
+ body: getSchemaTpl('collapseGroup', [
240
+ {
241
+ title: '基本',
242
+ body: [
243
+ getSchemaTpl('buttonLevel', {
244
+ label: '样式',
245
+ name: 'level',
246
+ hidden: isInDropdown
247
+ }),
180
248
 
181
- {
182
- label: '提示',
183
- value: 'info',
184
- level: 'info'
185
- },
186
- {
187
- label: '成功',
188
- value: 'success',
189
- level: 'success'
190
- },
191
- {
192
- label: '警告',
193
- value: 'warning',
194
- level: 'warning'
195
- },
196
- {
197
- label: '严重',
198
- value: 'danger',
199
- level: 'danger'
200
- }
201
- ]
202
- },
249
+ getSchemaTpl('buttonLevel', {
250
+ label: '高亮样式',
251
+ name: 'activeLevel',
252
+ hidden: isInDropdown,
253
+ visibleOn: 'data.active'
254
+ }),
203
255
 
204
- {
205
- name: 'block',
206
- type: 'switch',
207
- label: '块状显示',
208
- mode: 'inline'
209
- },
256
+ getSchemaTpl('switch', {
257
+ name: 'block',
258
+ label: '块状显示',
259
+ hidden: isInDropdown
260
+ }),
210
261
 
211
- getSchemaTpl('className', {
212
- label: '按钮 CSS 类名'
213
- }),
214
- getSchemaTpl('className', {
215
- name: 'iconClassName',
216
- label: '图标 CSS 类名',
217
- visibleOn: 'this.icon'
218
- })
219
- ]
220
- },
221
- {
222
- title: '显隐',
223
- body: [
224
- getSchemaTpl('disabled', [
225
- {
226
- type: 'input-text',
227
- name: 'disabledTip',
228
- label: '禁用提示信息',
229
- hidden: isInDropdown,
230
- description: '按钮被禁用时,鼠标停留弹出该段文字'
231
- }
232
- ]),
233
- getSchemaTpl('visible')
234
- ]
235
- }
236
- ])
237
- ];
262
+ getSchemaTpl('size', {
263
+ label: '尺寸',
264
+ hidden: isInDropdown
265
+ })
266
+ ]
267
+ },
268
+ getSchemaTpl('style:classNames', {
269
+ isFormItem: false,
270
+ schema: [
271
+ getSchemaTpl('className', {
272
+ name: 'iconClassName',
273
+ label: '左侧图标',
274
+ visibleOn: 'this.icon'
275
+ }),
276
+ getSchemaTpl('className', {
277
+ name: 'rightIconClassName',
278
+ label: '右侧图标',
279
+ visibleOn: 'this.rightIcon'
280
+ })
281
+ ]
282
+ })
283
+ ])
284
+ },
285
+ {
286
+ title: '事件',
287
+ className: 'p-none',
288
+ body:
289
+ this.manager?.config.actionOptions?.showOldEntry !== false &&
290
+ (!!context.schema.actionType ||
291
+ ['submit', 'reset'].includes(context.schema.type))
292
+ ? [
293
+ getSchemaTpl('eventControl', {
294
+ name: 'onEvent',
295
+ ...getEventControlConfig(this.manager, context)
296
+ }),
297
+ getOldActionSchema(this.manager, context)
298
+ ]
299
+ : [
300
+ getSchemaTpl('eventControl', {
301
+ name: 'onEvent',
302
+ ...getEventControlConfig(this.manager, context)
303
+ })
304
+ ]
305
+ }
306
+ ]);
238
307
  };
239
308
 
240
309
  /**
@@ -1,5 +1,10 @@
1
1
  import {registerEditorPlugin} from '../manager';
2
- import {BasePlugin, RegionConfig} from '../plugin';
2
+ import {BasePlugin, RegionConfig, BaseEventContext} from '../plugin';
3
+ import {getSchemaTpl} from '../component/schemaTpl';
4
+ import {
5
+ BUTTON_DEFAULT_ACTION,
6
+ formItemControl
7
+ } from '../component/control/BaseControl';
3
8
 
4
9
  export class ButtonGroupPlugin extends BasePlugin {
5
10
  // 关联渲染器名字
@@ -19,21 +24,13 @@ export class ButtonGroupPlugin extends BasePlugin {
19
24
  {
20
25
  type: 'button',
21
26
  label: '按钮1',
22
- actionType: 'dialog',
23
- dialog: {
24
- title: '系统提示',
25
- body: '对你点击了'
26
- }
27
+ ...BUTTON_DEFAULT_ACTION
27
28
  },
28
29
 
29
30
  {
30
31
  type: 'button',
31
32
  label: '按钮2',
32
- actionType: 'dialog',
33
- dialog: {
34
- title: '系统提示',
35
- body: '对你点击了'
36
- }
33
+ ...BUTTON_DEFAULT_ACTION
37
34
  }
38
35
  ]
39
36
  };
@@ -42,34 +39,98 @@ export class ButtonGroupPlugin extends BasePlugin {
42
39
  };
43
40
 
44
41
  panelTitle = '按钮组';
45
- panelBody = [
46
- {
47
- name: 'buttons',
48
- type: 'combo',
49
- label: '按钮管理',
50
- multiple: true,
51
- addable: true,
52
- minLength: 1,
53
- draggable: true,
54
- draggableTip: '',
55
- editable: false,
56
- visibleOn: 'this.buttons && this.buttons.length',
57
- items: [
58
- {
59
- type: 'tpl',
60
- inline: false,
61
- className: 'p-t-xs',
62
- tpl:
63
- '<span class="label label-default"><% if (data.type === "button-group") { %> 按钮组 <% } else { %><%= data.label %><% if (data.icon) { %><i class="<%= data.icon %>"/><% }%><% } %></span>'
42
+
43
+ panelJustify = true;
44
+ panelBodyCreator = (context: BaseEventContext) => {
45
+ return formItemControl(
46
+ {
47
+ common: {
48
+ replace: true,
49
+ body: [
50
+ {
51
+ type: 'button-group-select',
52
+ name: 'vertical',
53
+ label: '布局方向',
54
+ value: false,
55
+ options: [
56
+ {
57
+ label: '水平',
58
+ value: false
59
+ },
60
+ {
61
+ label: '垂直',
62
+ value: true
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ type: 'switch',
68
+ name: 'tiled',
69
+ label: '平铺模式',
70
+ inputClassName: 'is-inline',
71
+ value: false
72
+ }
73
+ ]
74
+ },
75
+ option: {
76
+ title: '按钮管理',
77
+ replace: true,
78
+ body: [
79
+ {
80
+ name: 'buttons',
81
+ mode: 'normal',
82
+ type: 'combo',
83
+ label: '',
84
+ multiple: true,
85
+ addable: true,
86
+ minLength: 1,
87
+ draggable: true,
88
+ draggableTip: '',
89
+ editable: false,
90
+ visibleOn: 'this.buttons && this.buttons.length',
91
+ items: [
92
+ {
93
+ type: 'tpl',
94
+ inline: false,
95
+ tpl:
96
+ '<span class="label label-default"><% if (data.type === "button-group") { %> 按钮组 <% } else { %><%= data.label %><% if (data.icon) { %><i class="<%= data.icon %>"/><% }%><% } %></span>'
97
+ }
98
+ ],
99
+ addButtonText: '新增按钮',
100
+ scaffold: {
101
+ type: 'button',
102
+ label: '按钮'
103
+ }
104
+ }
105
+ ]
106
+ },
107
+ status: {
108
+ replace: true,
109
+ body: [getSchemaTpl('hidden')]
110
+ },
111
+ style: {
112
+ replace: true,
113
+ body: [
114
+ getSchemaTpl('size'),
115
+
116
+ getSchemaTpl('className'),
117
+
118
+ getSchemaTpl('className', {
119
+ label: '按钮 CSS 类名',
120
+ name: 'btnClassName'
121
+ })
122
+ ]
123
+ },
124
+ validation: {
125
+ hidden: true
126
+ },
127
+ event: {
128
+ hidden: true
64
129
  }
65
- ],
66
- addButtonText: '新增按钮',
67
- scaffold: {
68
- type: 'button',
69
- label: '按钮'
70
- }
71
- }
72
- ];
130
+ },
131
+ context
132
+ );
133
+ };
73
134
 
74
135
  regions: Array<RegionConfig> = [
75
136
  {
@@ -5,33 +5,27 @@ export class ButtonToolbarPlugin extends BasePlugin {
5
5
  // 关联渲染器名字
6
6
  rendererName = 'button-toolbar';
7
7
  $schema = '/schemas/ButtonToolbarSchema.json';
8
-
9
8
  // 组件名称
10
9
  name = '按钮工具栏';
11
10
  isBaseComponent = true;
12
11
  description = '可以用来放置多个按钮或者按钮组,按钮之间会存在一定的间隔';
13
12
  tags = ['按钮'];
14
13
  icon = 'fa fa-ellipsis-h';
14
+ /**
15
+ * 组件选择面板中隐藏,和ButtonGroup合并
16
+ */
17
+ disabledRendererPlugin = true;
18
+
15
19
  scaffold = {
16
20
  type: 'button-toolbar',
17
21
  buttons: [
18
22
  {
19
23
  type: 'button',
20
- label: '按钮1',
21
- actionType: 'dialog',
22
- dialog: {
23
- title: '系统提示',
24
- body: '对你点击了'
25
- }
24
+ label: '按钮1'
26
25
  },
27
26
  {
28
27
  type: 'button',
29
- label: '按钮2',
30
- actionType: 'dialog',
31
- dialog: {
32
- title: '系统提示',
33
- body: '对你点击了'
34
- }
28
+ label: '按钮2'
35
29
  }
36
30
  ]
37
31
  };