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.
- package/dist/6dbcbb49b6fd405190a9.png +0 -0
- package/dist/component/Control/APIControl.d.ts +1101 -447
- package/dist/component/Control/ActionAPIControl.d.ts +1158 -0
- package/dist/component/Control/BadgeControl.d.ts +133 -0
- package/dist/component/Control/BaseControl.d.ts +248 -0
- package/dist/component/Control/DataBindingControl.d.ts +14 -0
- package/dist/component/Control/DataPickerControl.d.ts +13 -0
- package/dist/component/Control/DateShortCutControl.d.ts +83 -0
- package/dist/component/Control/FormulaControl.d.ts +51 -0
- package/dist/component/Control/OptionControl.d.ts +23 -34
- package/dist/component/Control/StatusControl.d.ts +39 -0
- package/dist/component/Control/SwitchMoreControl.d.ts +224 -0
- package/dist/component/Control/ValidationControl.d.ts +50 -15
- package/dist/component/Control/ValidationItem.d.ts +46 -0
- package/dist/component/Control/style-control/Background.d.ts +17 -0
- package/dist/component/Control/style-control/Border.d.ts +18 -0
- package/dist/component/Control/style-control/BoxModel.d.ts +17 -0
- package/dist/component/Control/style-control/BoxShadow.d.ts +18 -0
- package/dist/component/Control/style-control/Display.d.ts +14 -0
- package/dist/component/Control/style-control/Font.d.ts +16 -0
- package/dist/component/Control/style-control/font-family.d.ts +11 -0
- package/dist/component/Control/style-control/transformation.d.ts +29 -0
- package/dist/component/Control/style-control/types.d.ts +8 -0
- package/dist/component/Editor.d.ts +16 -0
- package/dist/component/RegionWrapper.d.ts +10 -0
- package/dist/component/VRenderer.d.ts +10 -0
- package/dist/component/schemaTpl.d.ts +8 -0
- package/dist/component/validator.d.ts +62 -0
- package/dist/dnd/index.d.ts +1 -1
- package/dist/event-action/action-config-panel.d.ts +8 -0
- package/dist/event-action/actions.d.ts +3 -0
- package/dist/event-action/comp-action-select.d.ts +11 -0
- package/dist/event-action/config.d.ts +13 -0
- package/dist/event-action/index.d.ts +459 -0
- package/dist/event-action/schema.d.ts +32 -0
- package/dist/exports.min.js +1 -1
- package/dist/index.d.ts +23 -5
- package/dist/index.min.js +1 -1
- package/dist/manager.d.ts +46 -1
- package/dist/plugin/Alert.d.ts +4 -2
- package/dist/plugin/Button.d.ts +5 -1
- package/dist/plugin/ButtonGroup.d.ts +13 -34
- package/dist/plugin/ButtonToolbar.d.ts +4 -10
- package/dist/plugin/CRUD.d.ts +2 -0
- package/dist/plugin/Chart.d.ts +2 -0
- package/dist/plugin/Collapse.d.ts +1 -0
- package/dist/plugin/CollapseGroup.d.ts +28 -4
- package/dist/plugin/Container.d.ts +2 -1
- package/dist/plugin/Dialog.d.ts +12 -2
- package/dist/plugin/Drawer.d.ts +12 -2
- package/dist/plugin/DropDownButton.d.ts +11 -11
- package/dist/plugin/Form/ButtonGroupSelect.d.ts +7 -2
- package/dist/plugin/Form/ButtonToolbar.d.ts +8 -7
- package/dist/plugin/Form/ChainedSelect.d.ts +3 -0
- package/dist/plugin/Form/Checkbox.d.ts +7 -2
- package/dist/plugin/Form/Checkboxes.d.ts +8 -2
- package/dist/plugin/Form/CodeEditor.d.ts +7 -22
- package/dist/plugin/Form/Combo.d.ts +3 -0
- package/dist/plugin/Form/Control.d.ts +6 -2
- package/dist/plugin/Form/DiffEditor.d.ts +7 -1
- package/dist/plugin/Form/Form.d.ts +6 -0
- package/dist/plugin/Form/Formula.d.ts +1 -25
- package/dist/plugin/Form/InputDate.d.ts +8 -2
- package/dist/plugin/Form/InputDateRange.d.ts +8 -2
- package/dist/plugin/Form/InputDateTime.d.ts +4 -4
- package/dist/plugin/Form/InputDateTimeRange.d.ts +4 -4
- package/dist/plugin/Form/InputEmail.d.ts +1 -0
- package/dist/plugin/Form/InputExcel.d.ts +6 -41
- package/dist/plugin/Form/InputFile.d.ts +7 -3
- package/dist/plugin/Form/InputKV.d.ts +6 -0
- package/dist/plugin/Form/InputMonth.d.ts +1 -0
- package/dist/plugin/Form/InputMonthRange.d.ts +4 -4
- package/dist/plugin/Form/InputPassword.d.ts +1 -0
- package/dist/plugin/Form/InputQuarter.d.ts +1 -0
- package/dist/plugin/Form/InputQuarterRange.d.ts +4 -4
- package/dist/plugin/Form/InputRange.d.ts +3 -0
- package/dist/plugin/Form/InputRating.d.ts +9 -3
- package/dist/plugin/Form/InputText.d.ts +24 -2
- package/dist/plugin/Form/InputTime.d.ts +3 -3
- package/dist/plugin/Form/InputTimeRange.d.ts +20 -0
- package/dist/plugin/Form/InputTree.d.ts +6 -2
- package/dist/plugin/Form/InputURL.d.ts +1 -0
- package/dist/plugin/Form/InputYear.d.ts +1 -0
- package/dist/plugin/Form/InputYearRange.d.ts +20 -0
- package/dist/plugin/Form/ListSelect.d.ts +6 -2
- package/dist/plugin/Form/LocationPicker.d.ts +1 -31
- package/dist/plugin/Form/NestedSelect.d.ts +5 -2
- package/dist/plugin/Form/Radios.d.ts +7 -2
- package/dist/plugin/Form/Select.d.ts +7 -2
- package/dist/plugin/Form/Switch.d.ts +7 -2
- package/dist/plugin/Form/TabsTransfer.d.ts +5 -2
- package/dist/plugin/Form/Textarea.d.ts +7 -1
- package/dist/plugin/Form/Transfer.d.ts +5 -2
- package/dist/plugin/Form/TreeSelect.d.ts +6 -2
- package/dist/plugin/IFrame.d.ts +2 -2
- package/dist/plugin/Nav.d.ts +1 -116
- package/dist/plugin/Others/Action.d.ts +5 -1
- package/dist/plugin/Page.d.ts +5 -2
- package/dist/plugin/Progress.d.ts +5 -1
- package/dist/plugin/Table.d.ts +2 -0
- package/dist/plugin/Tabs.d.ts +33 -2
- package/dist/plugin/TooltipWrapper.d.ts +10 -0
- package/dist/plugin/Tpl.d.ts +2 -1
- package/dist/plugin/Wizard.d.ts +4 -1
- package/dist/plugin.d.ts +37 -1
- package/dist/store/editor.d.ts +65 -38
- package/dist/store/node.d.ts +16 -0
- package/dist/style.css +1 -1
- package/dist/util.d.ts +36 -3
- package/package.json +14 -8
- package/src/component/schemaTpl.tsx +1198 -474
- package/src/plugin/.DS_Store +0 -0
- package/src/plugin/Alert.tsx +69 -48
- package/src/plugin/AnchorNav.tsx +1 -0
- package/src/plugin/Audio.tsx +9 -15
- package/src/plugin/Avatar.tsx +2 -1
- package/src/plugin/Breadcrumb.tsx +2 -1
- package/src/plugin/Button.tsx +257 -188
- package/src/plugin/ButtonGroup.tsx +99 -38
- package/src/plugin/ButtonToolbar.tsx +7 -13
- package/src/plugin/CRUD.tsx +77 -135
- package/src/plugin/Card.tsx +1 -0
- package/src/plugin/Cards.tsx +8 -14
- package/src/plugin/Carousel.tsx +1 -1
- package/src/plugin/Chart.tsx +26 -14
- package/src/plugin/Collapse.tsx +78 -78
- package/src/plugin/CollapseGroup.tsx +165 -83
- package/src/plugin/Container.tsx +59 -6
- package/src/plugin/Custom.tsx +2 -8
- package/src/plugin/CustomRegion.tsx +4 -3
- package/src/plugin/Dialog.tsx +55 -24
- package/src/plugin/Drawer.tsx +65 -35
- package/src/plugin/DropDownButton.tsx +95 -79
- package/src/plugin/Flex.tsx +123 -65
- package/src/plugin/Form/ButtonGroupSelect.tsx +114 -26
- package/src/plugin/Form/ButtonToolbar.tsx +62 -55
- package/src/plugin/Form/ChainedSelect.tsx +45 -0
- package/src/plugin/Form/Checkbox.tsx +122 -33
- package/src/plugin/Form/Checkboxes.tsx +154 -87
- package/src/plugin/Form/CodeEditor.tsx +163 -34
- package/src/plugin/Form/Combo.tsx +104 -65
- package/src/plugin/Form/Control.tsx +16 -70
- package/src/plugin/Form/DiffEditor.tsx +158 -54
- package/src/plugin/Form/FieldSet.tsx +6 -11
- package/src/plugin/Form/Form.tsx +277 -70
- package/src/plugin/Form/Formula.tsx +8 -14
- package/src/plugin/Form/InputArray.tsx +7 -16
- package/src/plugin/Form/InputCity.tsx +1 -1
- package/src/plugin/Form/InputDate.tsx +344 -121
- package/src/plugin/Form/InputDateRange.tsx +303 -161
- package/src/plugin/Form/InputDateTime.tsx +6 -150
- package/src/plugin/Form/InputDateTimeRange.tsx +7 -187
- package/src/plugin/Form/InputEmail.tsx +1 -0
- package/src/plugin/Form/InputExcel.tsx +70 -27
- package/src/plugin/Form/InputFile.tsx +326 -152
- package/src/plugin/Form/InputImage.tsx +1 -1
- package/src/plugin/Form/InputKV.tsx +61 -0
- package/src/plugin/Form/InputMonth.tsx +3 -1
- package/src/plugin/Form/InputMonthRange.tsx +6 -160
- package/src/plugin/Form/InputNumber.tsx +1 -1
- package/src/plugin/Form/InputPassword.tsx +2 -0
- package/src/plugin/Form/InputQuarter.tsx +3 -1
- package/src/plugin/Form/InputQuarterRange.tsx +6 -160
- package/src/plugin/Form/InputRange.tsx +74 -4
- package/src/plugin/Form/InputRating.tsx +347 -35
- package/src/plugin/Form/InputRichText.tsx +2 -3
- package/src/plugin/Form/InputTable.tsx +33 -49
- package/src/plugin/Form/InputTag.tsx +1 -1
- package/src/plugin/Form/InputText.tsx +310 -132
- package/src/plugin/Form/InputTime.tsx +4 -53
- package/src/plugin/Form/InputTimeRange.tsx +41 -0
- package/src/plugin/Form/InputTree.tsx +196 -46
- package/src/plugin/Form/InputURL.tsx +2 -0
- package/src/plugin/Form/InputYear.tsx +2 -0
- package/src/plugin/Form/InputYearRange.tsx +41 -0
- package/src/plugin/Form/Item.tsx +17 -18
- package/src/plugin/Form/ListSelect.tsx +75 -20
- package/src/plugin/Form/LocationPicker.tsx +2 -7
- package/src/plugin/Form/MatrixCheckboxes.tsx +1 -1
- package/src/plugin/Form/NestedSelect.tsx +110 -43
- package/src/plugin/Form/Picker.tsx +2 -5
- package/src/plugin/Form/Radios.tsx +122 -52
- package/src/plugin/Form/Select.tsx +239 -168
- package/src/plugin/Form/Static.tsx +1 -1
- package/src/plugin/Form/Switch.tsx +170 -58
- package/src/plugin/Form/TabsTransfer.tsx +175 -79
- package/src/plugin/Form/Textarea.tsx +146 -36
- package/src/plugin/Form/Transfer.tsx +295 -233
- package/src/plugin/Form/TreeSelect.tsx +287 -146
- package/src/plugin/Grid.tsx +340 -312
- package/src/plugin/HBox.tsx +1 -0
- package/src/plugin/IFrame.tsx +21 -12
- package/src/plugin/Image.tsx +7 -12
- package/src/plugin/Images.tsx +7 -12
- package/src/plugin/Link.tsx +6 -12
- package/src/plugin/List.tsx +6 -10
- package/src/plugin/ListItem.tsx +1 -0
- package/src/plugin/Nav.tsx +7 -9
- package/src/plugin/Others/Action.tsx +16 -10
- package/src/plugin/Others/BasicToolbar.tsx +4 -1
- package/src/plugin/Others/TableCell.tsx +19 -39
- package/src/plugin/Page.tsx +315 -229
- package/src/plugin/Panel.tsx +6 -7
- package/src/plugin/Plain.tsx +3 -6
- package/src/plugin/Progress.tsx +234 -94
- package/src/plugin/Service.tsx +10 -6
- package/src/plugin/Table.tsx +49 -20
- package/src/plugin/TableView.tsx +212 -106
- package/src/plugin/Tabs.tsx +306 -146
- package/src/plugin/TooltipWrapper.tsx +231 -135
- package/src/plugin/Tpl.tsx +68 -52
- package/src/plugin/Video.tsx +9 -20
- package/src/plugin/Wizard.tsx +537 -336
- package/src/plugin/Wrapper.tsx +82 -61
- package/src/plugin.ts +66 -4
- package/static/empty.png +0 -0
package/src/plugin/Button.tsx
CHANGED
@@ -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
|
-
|
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
|
76
|
+
const isInDrawer = /(?:\/|^)drawer\/.+$/.test(context.path);
|
43
77
|
|
44
|
-
|
45
|
-
|
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
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
-
|
70
|
-
|
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
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
106
|
+
{
|
107
|
+
label: '提交',
|
108
|
+
value: 'submit'
|
109
|
+
},
|
110
|
+
|
111
|
+
{
|
112
|
+
label: '重置',
|
113
|
+
value: 'reset'
|
114
|
+
}
|
115
|
+
]
|
116
|
+
},
|
79
117
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
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
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
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
|
-
|
144
|
-
|
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
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
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
|
-
|
183
|
-
|
184
|
-
|
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
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
},
|
256
|
+
getSchemaTpl('switch', {
|
257
|
+
name: 'block',
|
258
|
+
label: '块状显示',
|
259
|
+
hidden: isInDropdown
|
260
|
+
}),
|
210
261
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
{
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
-
|
67
|
-
|
68
|
-
|
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
|
};
|