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.
- package/dist/6dbcbb49b6fd405190a9.png +0 -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/base/BackTop.d.ts +1 -1
- package/dist/component/control/APIControl.d.ts +1158 -0
- 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 → control}/OptionControl.d.ts +23 -34
- package/dist/component/{Control → control}/PopoverEdit.d.ts +0 -0
- package/dist/component/control/StatusControl.d.ts +44 -0
- package/dist/component/control/SwitchMoreControl.d.ts +224 -0
- package/dist/component/control/ValidationControl.d.ts +65 -0
- 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/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 +55 -28
- 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 +1209 -474
- 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 +78 -136
- 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/dist/component/Control/APIControl.d.ts +0 -504
- package/dist/component/Control/ValidationControl.d.ts +0 -30
- package/dist/component/remarkTpl.d.ts +0 -150
@@ -1,5 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defaultValue,
|
3
|
+
setSchemaTpl,
|
3
4
|
getSchemaTpl,
|
4
5
|
valuePipeOut
|
5
6
|
} from '../../component/schemaTpl';
|
@@ -8,9 +9,19 @@ import {
|
|
8
9
|
BasePlugin,
|
9
10
|
BasicSubRenderInfo,
|
10
11
|
RendererEventContext,
|
11
|
-
SubRendererInfo
|
12
|
+
SubRendererInfo,
|
13
|
+
BaseEventContext
|
12
14
|
} from '../../plugin';
|
15
|
+
import { ValidatorTag } from '../../component/validator';
|
16
|
+
import {tipedLabel} from '../../component/control/BaseControl';
|
17
|
+
import { getEventControlConfig } from '../../util';
|
18
|
+
import {RendererAction, RendererEvent} from '../../event-action';
|
13
19
|
|
20
|
+
setSchemaTpl('option', {
|
21
|
+
name: 'option',
|
22
|
+
type: 'input-text',
|
23
|
+
label: tipedLabel('说明', '选项说明')
|
24
|
+
});
|
14
25
|
export class CheckboxControlPlugin extends BasePlugin {
|
15
26
|
// 关联渲染器名字
|
16
27
|
rendererName = 'checkbox';
|
@@ -41,47 +52,125 @@ export class CheckboxControlPlugin extends BasePlugin {
|
|
41
52
|
}
|
42
53
|
]
|
43
54
|
};
|
44
|
-
|
55
|
+
notRenderFormZone = true;
|
45
56
|
panelTitle = '勾选框';
|
46
|
-
|
57
|
+
panelJustify = true;
|
58
|
+
// 事件定义
|
59
|
+
events: RendererEvent[] = [
|
47
60
|
{
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
61
|
+
eventName: 'change',
|
62
|
+
eventLabel: '值变化',
|
63
|
+
description: '选中状态变化时触发',
|
64
|
+
dataSchema: [
|
65
|
+
{
|
66
|
+
type: 'object',
|
67
|
+
properties: {
|
68
|
+
'event.data.value': {
|
69
|
+
type: 'string',
|
70
|
+
title: '选中状态'
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
]
|
75
|
+
}
|
76
|
+
];
|
77
|
+
// 动作定义
|
78
|
+
actions: RendererAction[] = [
|
58
79
|
{
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
mode: 'inline',
|
63
|
-
className: 'w-full',
|
64
|
-
visibleOn: 'typeof this.value !== "undefined"',
|
65
|
-
pipeOut: (value: any, origin: any, data: any) =>
|
66
|
-
value ? data.trueValue ?? true : data.falseValue ?? false
|
80
|
+
actionType: 'clear',
|
81
|
+
actionLabel: '清空',
|
82
|
+
description: '清除选中值'
|
67
83
|
},
|
68
|
-
|
69
84
|
{
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
pipeIn: defaultValue(true),
|
74
|
-
pipeOut: valuePipeOut
|
85
|
+
actionType: 'reset',
|
86
|
+
actionLabel: '重置',
|
87
|
+
description: '将值重置为resetValue,若没有配置resetValue,则清空'
|
75
88
|
},
|
76
|
-
|
77
89
|
{
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
pipeIn: defaultValue(false),
|
82
|
-
pipeOut: valuePipeOut
|
90
|
+
actionType: 'setValue',
|
91
|
+
actionLabel: '赋值',
|
92
|
+
description: '触发组件数据更新'
|
83
93
|
}
|
84
94
|
];
|
95
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
96
|
+
return getSchemaTpl('tabs', [
|
97
|
+
{
|
98
|
+
title: '属性',
|
99
|
+
body: getSchemaTpl('collapseGroup', [
|
100
|
+
{
|
101
|
+
title: '基本',
|
102
|
+
body: [
|
103
|
+
getSchemaTpl('formItemName', {
|
104
|
+
required: true
|
105
|
+
}),
|
106
|
+
getSchemaTpl('label'),
|
107
|
+
getSchemaTpl('option'),
|
108
|
+
getSchemaTpl('switch', {
|
109
|
+
name: 'value',
|
110
|
+
label: '默认勾选',
|
111
|
+
pipeIn: (value: any, data: any) => {
|
112
|
+
return value === (data?.data?.trueValue ?? true);
|
113
|
+
},
|
114
|
+
pipeOut: (value: any, origin: any, data: any) => {
|
115
|
+
const {trueValue = true, falseValue = false} = data;
|
116
|
+
return value ? trueValue : falseValue;
|
117
|
+
}
|
118
|
+
}),
|
119
|
+
{
|
120
|
+
type: 'ae-Switch-More',
|
121
|
+
hiddenOnDefault: false,
|
122
|
+
mode: 'normal',
|
123
|
+
label: '值格式',
|
124
|
+
formType: 'extend',
|
125
|
+
form: {
|
126
|
+
body: [
|
127
|
+
{
|
128
|
+
type: 'input-text',
|
129
|
+
label: '勾选值',
|
130
|
+
name: 'trueValue',
|
131
|
+
pipeIn: defaultValue(true),
|
132
|
+
pipeOut: valuePipeOut
|
133
|
+
},
|
134
|
+
{
|
135
|
+
type: 'input-text',
|
136
|
+
label: '未勾选值',
|
137
|
+
name: 'falseValue',
|
138
|
+
pipeIn: defaultValue(false),
|
139
|
+
pipeOut: valuePipeOut
|
140
|
+
}
|
141
|
+
]
|
142
|
+
}
|
143
|
+
},
|
144
|
+
getSchemaTpl('labelRemark'),
|
145
|
+
getSchemaTpl('remark'),
|
146
|
+
getSchemaTpl('description')
|
147
|
+
]
|
148
|
+
},
|
149
|
+
getSchemaTpl('status', {isFormItem: true}),
|
150
|
+
getSchemaTpl('validation', {tag: ValidatorTag.MultiSelect})
|
151
|
+
])
|
152
|
+
},
|
153
|
+
{
|
154
|
+
title: '外观',
|
155
|
+
body: [
|
156
|
+
getSchemaTpl('collapseGroup', [
|
157
|
+
getSchemaTpl('style:formItem', {renderer: context.info.renderer}),
|
158
|
+
getSchemaTpl('style:classNames')
|
159
|
+
])
|
160
|
+
]
|
161
|
+
},
|
162
|
+
{
|
163
|
+
title: '事件',
|
164
|
+
className: 'p-none',
|
165
|
+
body: [
|
166
|
+
getSchemaTpl('eventControl', {
|
167
|
+
name: 'onEvent',
|
168
|
+
...getEventControlConfig(this.manager, context)
|
169
|
+
})
|
170
|
+
]
|
171
|
+
}
|
172
|
+
]);
|
173
|
+
}
|
85
174
|
}
|
86
175
|
|
87
176
|
registerEditorPlugin(CheckboxControlPlugin);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defaultValue,
|
3
|
+
setSchemaTpl,
|
3
4
|
getSchemaTpl,
|
4
5
|
valuePipeOut
|
5
6
|
} from '../../component/schemaTpl';
|
@@ -8,9 +9,17 @@ import {
|
|
8
9
|
BasePlugin,
|
9
10
|
BasicSubRenderInfo,
|
10
11
|
RendererEventContext,
|
11
|
-
SubRendererInfo
|
12
|
+
SubRendererInfo,
|
13
|
+
BaseEventContext
|
12
14
|
} from '../../plugin';
|
13
15
|
|
16
|
+
import {formItemControl} from '../../component/control/BaseControl';
|
17
|
+
import { ValidatorTag } from '../../component/validator';
|
18
|
+
import {tipedLabel} from '../../component/control/BaseControl';
|
19
|
+
|
20
|
+
import { getEventControlConfig } from '../../util';
|
21
|
+
import {RendererAction, RendererEvent} from '../../event-action';
|
22
|
+
|
14
23
|
export class CheckboxesControlPlugin extends BasePlugin {
|
15
24
|
// 关联渲染器名字
|
16
25
|
rendererName = 'checkboxes';
|
@@ -30,6 +39,7 @@ export class CheckboxesControlPlugin extends BasePlugin {
|
|
30
39
|
type: 'checkboxes',
|
31
40
|
label: '复选框',
|
32
41
|
name: 'checkboxes',
|
42
|
+
multiple: true,
|
33
43
|
options: [
|
34
44
|
{
|
35
45
|
label: '选项A',
|
@@ -55,113 +65,170 @@ export class CheckboxesControlPlugin extends BasePlugin {
|
|
55
65
|
]
|
56
66
|
};
|
57
67
|
|
68
|
+
notRenderFormZone = true;
|
69
|
+
|
58
70
|
panelTitle = '复选框';
|
59
|
-
panelBody = [
|
60
|
-
getSchemaTpl('tabs', [
|
61
|
-
{
|
62
|
-
title: '常规',
|
63
|
-
body: [
|
64
|
-
getSchemaTpl('switchDefaultValue', {
|
65
|
-
visibleOn: '!this.defaultCheckAll'
|
66
|
-
}),
|
67
71
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
},
|
72
|
+
// 事件定义
|
73
|
+
events: RendererEvent[] = [
|
74
|
+
{
|
75
|
+
eventName: 'change',
|
76
|
+
eventLabel: '值变化',
|
77
|
+
description: '选中值变化时触发',
|
78
|
+
dataSchema: [
|
79
|
+
{
|
80
|
+
type: 'object',
|
81
|
+
properties: {
|
82
|
+
'event.data.value': {
|
83
|
+
type: 'string',
|
84
|
+
title: '选中值'
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
]
|
89
|
+
}
|
90
|
+
];
|
88
91
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
92
|
+
// 动作定义
|
93
|
+
actions: RendererAction[] = [
|
94
|
+
{
|
95
|
+
actionType: 'clear',
|
96
|
+
actionLabel: '清空',
|
97
|
+
description: '清除选中值'
|
98
|
+
},
|
99
|
+
{
|
100
|
+
actionType: 'reset',
|
101
|
+
actionLabel: '重置',
|
102
|
+
description: '将值重置为resetValue,若没有配置resetValue,则清空'
|
103
|
+
},
|
104
|
+
{
|
105
|
+
actionType: 'reload',
|
106
|
+
actionLabel: '重新加载',
|
107
|
+
description: '触发组件数据刷新并重新渲染'
|
108
|
+
},
|
109
|
+
{
|
110
|
+
actionType: 'setValue',
|
111
|
+
actionLabel: '赋值',
|
112
|
+
description: '触发组件数据更新'
|
113
|
+
}
|
114
|
+
];
|
115
|
+
panelJustify = true;
|
116
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
117
|
+
const renderer: any = context.info.renderer;
|
103
118
|
|
119
|
+
return getSchemaTpl('tabs', [
|
120
|
+
{
|
121
|
+
title: '属性',
|
122
|
+
body: getSchemaTpl('collapseGroup', [
|
123
|
+
{
|
124
|
+
title: '基本',
|
125
|
+
body: [
|
126
|
+
getSchemaTpl('formItemName', {
|
127
|
+
required: true
|
128
|
+
}),
|
129
|
+
getSchemaTpl('label'),
|
130
|
+
[
|
131
|
+
getSchemaTpl('switch', {
|
132
|
+
label: '可全选',
|
133
|
+
name: 'checkAll',
|
134
|
+
value: false,
|
135
|
+
visibleOn: 'data.multiple',
|
136
|
+
onChange: (value:any, origin:any, item:any, form:any) => {
|
137
|
+
if (!value) {
|
138
|
+
// 可全选关闭时,默认全选也需联动关闭
|
139
|
+
form.setValueByName('defaultCheckAll', false);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}),
|
143
|
+
{
|
144
|
+
type: 'container',
|
145
|
+
className: 'ae-ExtendMore mb-2',
|
146
|
+
visibleOn: 'data.checkAll',
|
147
|
+
body: [
|
148
|
+
getSchemaTpl('switch', {
|
149
|
+
label: '默认全选',
|
150
|
+
name: 'defaultCheckAll',
|
151
|
+
value: false
|
152
|
+
})
|
153
|
+
]
|
154
|
+
}
|
155
|
+
],
|
104
156
|
getSchemaTpl('joinValues', {
|
105
157
|
visibleOn: true
|
106
158
|
}),
|
107
159
|
getSchemaTpl('delimiter', {
|
108
|
-
|
160
|
+
visibleOn: 'data.joinValues === true'
|
109
161
|
}),
|
110
162
|
getSchemaTpl('extractValue'),
|
111
|
-
getSchemaTpl('
|
112
|
-
|
113
|
-
getSchemaTpl('
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
163
|
+
getSchemaTpl('labelRemark'),
|
164
|
+
getSchemaTpl('remark'),
|
165
|
+
getSchemaTpl('description'),
|
166
|
+
]
|
167
|
+
},
|
168
|
+
{
|
169
|
+
title: '选项',
|
170
|
+
body: [
|
171
|
+
getSchemaTpl('optionControl', {
|
172
|
+
multiple: true
|
118
173
|
}),
|
119
|
-
|
120
|
-
|
121
|
-
getSchemaTpl('api', {
|
122
|
-
label: '编辑选项接口',
|
123
|
-
name: 'editApi'
|
174
|
+
getSchemaTpl('value', {
|
175
|
+
visibleOn: '!!this.options'
|
124
176
|
}),
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
177
|
+
getSchemaTpl('creatable', {
|
178
|
+
formType: 'extend',
|
179
|
+
hiddenOnDefault: true,
|
180
|
+
form: {
|
181
|
+
body: [
|
182
|
+
getSchemaTpl('createBtnLabel'),
|
183
|
+
getSchemaTpl('addApi')
|
184
|
+
]
|
185
|
+
}
|
186
|
+
}),
|
187
|
+
getSchemaTpl('editable', {
|
188
|
+
formType: 'extend',
|
189
|
+
hiddenOnDefault: true,
|
190
|
+
form: {
|
191
|
+
body: [
|
192
|
+
getSchemaTpl('editApi')
|
193
|
+
]
|
194
|
+
}
|
195
|
+
}),
|
196
|
+
getSchemaTpl('removable', {
|
197
|
+
formType: 'extend',
|
198
|
+
hiddenOnDefault: true,
|
199
|
+
form: {
|
200
|
+
body: [
|
201
|
+
getSchemaTpl('deleteApi')
|
202
|
+
]
|
203
|
+
}
|
130
204
|
})
|
131
205
|
]
|
132
|
-
}
|
133
|
-
|
206
|
+
},
|
207
|
+
getSchemaTpl('status', {isFormItem: true}),
|
208
|
+
getSchemaTpl('validation', {tag: ValidatorTag.MultiSelect})
|
209
|
+
])
|
134
210
|
},
|
135
211
|
{
|
136
212
|
title: '外观',
|
137
213
|
body: [
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
name: '
|
150
|
-
|
151
|
-
'typeof data.inline === "undefined" || data.inline === true',
|
152
|
-
type: 'input-range',
|
153
|
-
min: 1,
|
154
|
-
max: 6,
|
155
|
-
pipeIn: defaultValue(1)
|
156
|
-
},
|
157
|
-
getSchemaTpl('className', {
|
158
|
-
label: '单个 Checkbox 的 CSS 类名',
|
159
|
-
name: 'itemClassName'
|
214
|
+
getSchemaTpl('collapseGroup', [
|
215
|
+
getSchemaTpl('style:formItem', {renderer}),
|
216
|
+
getSchemaTpl('style:classNames')
|
217
|
+
])
|
218
|
+
]
|
219
|
+
},
|
220
|
+
{
|
221
|
+
title: '事件',
|
222
|
+
className: 'p-none',
|
223
|
+
body: [
|
224
|
+
getSchemaTpl('eventControl', {
|
225
|
+
name: 'onEvent',
|
226
|
+
...getEventControlConfig(this.manager, context)
|
160
227
|
})
|
161
228
|
]
|
162
229
|
}
|
163
|
-
])
|
164
|
-
|
230
|
+
]);
|
231
|
+
};
|
165
232
|
}
|
166
233
|
|
167
234
|
registerEditorPlugin(CheckboxesControlPlugin);
|
@@ -1,8 +1,17 @@
|
|
1
1
|
import {availableLanguages} from 'amis/lib/renderers/Form/Editor';
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
defaultValue,
|
4
|
+
getSchemaTpl,
|
5
|
+
undefinedPipeOut
|
6
|
+
} from '../../component/schemaTpl';
|
3
7
|
import {registerEditorPlugin} from '../../manager';
|
4
8
|
import {BasePlugin} from '../../plugin';
|
5
9
|
|
10
|
+
import type {BaseEventContext} from '../../plugin';
|
11
|
+
import {ValidatorTag} from '../../component/validator';
|
12
|
+
import {getEventControlConfig} from '../../util';
|
13
|
+
import {RendererAction, RendererEvent} from '../../event-action';
|
14
|
+
|
6
15
|
export class CodeEditorControlPlugin extends BasePlugin {
|
7
16
|
// 关联渲染器名字
|
8
17
|
rendererName = 'editor';
|
@@ -35,47 +44,167 @@ export class CodeEditorControlPlugin extends BasePlugin {
|
|
35
44
|
]
|
36
45
|
};
|
37
46
|
|
38
|
-
|
39
|
-
panelBody = [
|
47
|
+
events: RendererEvent[] = [
|
40
48
|
{
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
49
|
+
eventName: 'focus',
|
50
|
+
eventLabel: '获取焦点',
|
51
|
+
description: '输入框获取焦点时触发',
|
52
|
+
dataSchema: [
|
53
|
+
{
|
54
|
+
type: 'object',
|
55
|
+
properties: {
|
56
|
+
'event.data.value': {
|
57
|
+
type: 'string',
|
58
|
+
title: '当前代码'
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
]
|
47
63
|
},
|
48
|
-
|
49
64
|
{
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
label: '控件大小',
|
55
|
-
options: [
|
56
|
-
{
|
57
|
-
label: '默认',
|
58
|
-
value: ''
|
59
|
-
},
|
60
|
-
{
|
61
|
-
label: '中',
|
62
|
-
value: 'md'
|
63
|
-
},
|
64
|
-
{
|
65
|
-
label: '大',
|
66
|
-
value: 'lg'
|
67
|
-
},
|
65
|
+
eventName: 'blur',
|
66
|
+
eventLabel: '失去焦点',
|
67
|
+
description: '输入框失去焦点时触发',
|
68
|
+
dataSchema: [
|
68
69
|
{
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
type: 'object',
|
71
|
+
properties: {
|
72
|
+
'event.data.value': {
|
73
|
+
type: 'string',
|
74
|
+
title: '当前代码'
|
75
|
+
}
|
76
|
+
}
|
75
77
|
}
|
76
78
|
]
|
77
79
|
}
|
78
80
|
];
|
81
|
+
|
82
|
+
actions: RendererAction[] = [
|
83
|
+
{
|
84
|
+
actionType: 'clear',
|
85
|
+
actionLabel: '清空',
|
86
|
+
description: '清除选中值'
|
87
|
+
},
|
88
|
+
{
|
89
|
+
actionType: 'reset',
|
90
|
+
actionLabel: '重置',
|
91
|
+
description: '将值重置为resetValue,若没有配置resetValue,则清空'
|
92
|
+
},
|
93
|
+
{
|
94
|
+
actionType: 'focus',
|
95
|
+
actionLabel: '获取焦点',
|
96
|
+
description: '输入框获取焦点'
|
97
|
+
},
|
98
|
+
{
|
99
|
+
actionType: 'setValue',
|
100
|
+
actionLabel: '赋值',
|
101
|
+
description: '触发组件数据更新'
|
102
|
+
}
|
103
|
+
];
|
104
|
+
|
105
|
+
notRenderFormZone = true;
|
106
|
+
|
107
|
+
panelTitle = 'Editor';
|
108
|
+
|
109
|
+
panelJustify = true;
|
110
|
+
|
111
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
112
|
+
return getSchemaTpl('tabs', [
|
113
|
+
{
|
114
|
+
title: '属性',
|
115
|
+
body: getSchemaTpl('collapseGroup', [
|
116
|
+
{
|
117
|
+
title: '基本',
|
118
|
+
body: [
|
119
|
+
getSchemaTpl('formItemName', {
|
120
|
+
required: true
|
121
|
+
}),
|
122
|
+
getSchemaTpl('label'),
|
123
|
+
{
|
124
|
+
label: '语言',
|
125
|
+
name: 'language',
|
126
|
+
type: 'select',
|
127
|
+
value: 'javascript',
|
128
|
+
searchable: true,
|
129
|
+
options: availableLanguages.concat()
|
130
|
+
},
|
131
|
+
{
|
132
|
+
type: 'textarea',
|
133
|
+
name: 'value',
|
134
|
+
label: '默认值'
|
135
|
+
},
|
136
|
+
getSchemaTpl('switch', {
|
137
|
+
label: '可全屏',
|
138
|
+
name: 'allowFullscreen',
|
139
|
+
pipeIn: defaultValue(true)
|
140
|
+
}),
|
141
|
+
getSchemaTpl('labelRemark'),
|
142
|
+
getSchemaTpl('remark'),
|
143
|
+
getSchemaTpl('description')
|
144
|
+
]
|
145
|
+
},
|
146
|
+
getSchemaTpl('status', {isFormItem: true}),
|
147
|
+
getSchemaTpl('validation', {
|
148
|
+
tag: ValidatorTag.Code
|
149
|
+
})
|
150
|
+
])
|
151
|
+
},
|
152
|
+
{
|
153
|
+
title: '外观',
|
154
|
+
body: getSchemaTpl('collapseGroup', [
|
155
|
+
getSchemaTpl('style:formItem', {
|
156
|
+
renderer: context.info.renderer,
|
157
|
+
schema: [
|
158
|
+
{
|
159
|
+
name: 'size',
|
160
|
+
type: 'select',
|
161
|
+
pipeIn: defaultValue(''),
|
162
|
+
pipeOut: undefinedPipeOut,
|
163
|
+
label: '控件尺寸',
|
164
|
+
options: [
|
165
|
+
{
|
166
|
+
label: '默认',
|
167
|
+
value: ''
|
168
|
+
},
|
169
|
+
|
170
|
+
{
|
171
|
+
label: '中',
|
172
|
+
value: 'md'
|
173
|
+
},
|
174
|
+
|
175
|
+
{
|
176
|
+
label: '大',
|
177
|
+
value: 'lg'
|
178
|
+
},
|
179
|
+
|
180
|
+
{
|
181
|
+
label: '特大',
|
182
|
+
value: 'xl'
|
183
|
+
},
|
184
|
+
|
185
|
+
{
|
186
|
+
label: '超大',
|
187
|
+
value: 'xxl'
|
188
|
+
}
|
189
|
+
]
|
190
|
+
}
|
191
|
+
]
|
192
|
+
}),
|
193
|
+
getSchemaTpl('style:classNames')
|
194
|
+
])
|
195
|
+
},
|
196
|
+
{
|
197
|
+
title: '事件',
|
198
|
+
className: 'p-none',
|
199
|
+
body: [
|
200
|
+
getSchemaTpl('eventControl', {
|
201
|
+
name: 'onEvent',
|
202
|
+
...getEventControlConfig(this.manager, context)
|
203
|
+
})
|
204
|
+
]
|
205
|
+
}
|
206
|
+
]);
|
207
|
+
};
|
79
208
|
}
|
80
209
|
|
81
210
|
registerEditorPlugin(CodeEditorControlPlugin);
|