amis-editor 4.1.0-beta.4 → 4.2.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/component/Breadcrumb.d.ts +23 -2
- package/dist/component/ClassNameControl.d.ts +1 -1
- package/dist/component/Control/APIControl.d.ts +2 -2
- package/dist/component/Control/OptionControl.d.ts +3 -3
- package/dist/component/Control/PopoverEdit.d.ts +4 -4
- package/dist/component/Control/ValidationControl.d.ts +1 -1
- package/dist/component/Editor.d.ts +20 -1
- package/dist/component/IFramePreview.d.ts +2 -1
- package/dist/component/NodeWrapper.d.ts +1 -1
- package/dist/component/Panel/RenderersPanel.d.ts +1 -2
- package/dist/component/Preview.d.ts +3 -1
- package/dist/component/RegionWrapper.d.ts +4 -0
- package/dist/component/VRenderer.d.ts +4 -0
- package/dist/component/base/InputComponentName.d.ts +1 -1
- package/dist/component/base/SearchCustomRendererPanel.d.ts +15 -0
- package/dist/component/base/SearchPanel.d.ts +83 -0
- package/dist/component/base/SearchRendererPanel.d.ts +2 -42
- package/dist/env.d.ts +1 -1
- package/dist/exports.min.js +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.min.js +1 -1
- package/dist/manager.d.ts +16 -4
- package/dist/plugin/Alert.d.ts +1 -1
- package/dist/plugin/Button.d.ts +1 -1
- package/dist/plugin/Card.d.ts +1 -0
- package/dist/plugin/Cards.d.ts +2 -1
- package/dist/plugin/Carousel.d.ts +1 -0
- package/dist/plugin/Chart.d.ts +1 -0
- package/dist/plugin/Collapse.d.ts +1 -0
- package/dist/plugin/Custom.d.ts +3 -0
- package/dist/plugin/CustomRegion.d.ts +40 -0
- package/dist/plugin/Dialog.d.ts +1 -1
- package/dist/plugin/Drawer.d.ts +1 -1
- package/dist/plugin/DropDownButton.d.ts +1 -1
- package/dist/plugin/Each.d.ts +1 -1
- package/dist/plugin/Flex.d.ts +1 -0
- package/dist/plugin/Form/Control.d.ts +1 -0
- package/dist/plugin/Form/Form.d.ts +19 -3
- package/dist/plugin/Form/Formula.d.ts +3 -3
- package/dist/plugin/Form/InputURL.d.ts +1 -0
- package/dist/plugin/Form/Switch.d.ts +2 -0
- package/dist/plugin/Grid.d.ts +1 -0
- package/dist/plugin/HBox.d.ts +1 -0
- package/dist/plugin/IFrame.d.ts +3 -3
- package/dist/plugin/Json.d.ts +1 -0
- package/dist/plugin/List.d.ts +2 -1
- package/dist/plugin/Mapping.d.ts +1 -0
- package/dist/plugin/Markdown.d.ts +1 -0
- package/dist/plugin/Nav.d.ts +1 -0
- package/dist/plugin/Page.d.ts +1 -1
- package/dist/plugin/Panel/Outline.d.ts +8 -0
- package/dist/plugin/Progress.d.ts +1 -0
- package/dist/plugin/QRCode.d.ts +1 -0
- package/dist/plugin/Reset.d.ts +0 -1
- package/dist/plugin/Service.d.ts +1 -0
- package/dist/plugin/Sparkline.d.ts +1 -0
- package/dist/plugin/Status.d.ts +1 -0
- package/dist/plugin/Steps.d.ts +1 -0
- package/dist/plugin/Submit.d.ts +0 -1
- package/dist/plugin/Table.d.ts +1 -1
- package/dist/plugin/TableView.d.ts +1 -0
- package/dist/plugin/Tasks.d.ts +1 -0
- package/dist/plugin/TooltipWrapper.d.ts +1 -0
- package/dist/plugin/Video.d.ts +1 -0
- package/dist/plugin/WebComponent.d.ts +1 -0
- package/dist/plugin/Wizard.d.ts +11 -2
- package/dist/plugin/Wrapper.d.ts +1 -0
- package/dist/plugin.d.ts +8 -7
- package/dist/store/editor.d.ts +47 -11
- package/dist/store/node.d.ts +6 -0
- package/dist/style.css +1 -1
- package/dist/util.d.ts +1 -1
- package/package.json +10 -3
- package/src/component/schemaTpl.tsx +2157 -0
- package/src/plugin/Alert.tsx +87 -0
- package/src/plugin/AnchorNav.tsx +233 -0
- package/src/plugin/Audio.tsx +154 -0
- package/src/plugin/Avatar.tsx +77 -0
- package/src/plugin/Breadcrumb.tsx +107 -0
- package/src/plugin/Button.tsx +281 -0
- package/src/plugin/ButtonGroup.tsx +85 -0
- package/src/plugin/ButtonToolbar.tsx +87 -0
- package/src/plugin/CRUD.tsx +1835 -0
- package/src/plugin/Card.tsx +290 -0
- package/src/plugin/Cards.tsx +318 -0
- package/src/plugin/Carousel.tsx +377 -0
- package/src/plugin/Chart.tsx +218 -0
- package/src/plugin/CodeView.tsx +60 -0
- package/src/plugin/Collapse.tsx +136 -0
- package/src/plugin/CollapseGroup.tsx +167 -0
- package/src/plugin/Container.tsx +40 -0
- package/src/plugin/Custom.tsx +128 -0
- package/src/plugin/CustomRegion.tsx +156 -0
- package/src/plugin/Date.tsx +74 -0
- package/src/plugin/Datetime.tsx +68 -0
- package/src/plugin/Dialog.tsx +176 -0
- package/src/plugin/Divider.tsx +36 -0
- package/src/plugin/Drawer.tsx +214 -0
- package/src/plugin/DropDownButton.tsx +235 -0
- package/src/plugin/Each.tsx +150 -0
- package/src/plugin/ErrorRenderer.tsx +15 -0
- package/src/plugin/Flex.tsx +151 -0
- package/src/plugin/Form/ButtonGroupSelect.tsx +75 -0
- package/src/plugin/Form/ButtonToolbar.tsx +110 -0
- package/src/plugin/Form/ChainedSelect.tsx +70 -0
- package/src/plugin/Form/Checkbox.tsx +87 -0
- package/src/plugin/Form/Checkboxes.tsx +167 -0
- package/src/plugin/Form/CodeEditor.tsx +81 -0
- package/src/plugin/Form/Combo.tsx +582 -0
- package/src/plugin/Form/ConditionBuilder.tsx +315 -0
- package/src/plugin/Form/Control.tsx +139 -0
- package/src/plugin/Form/DiffEditor.tsx +111 -0
- package/src/plugin/Form/FieldSet.tsx +163 -0
- package/src/plugin/Form/Form.tsx +687 -0
- package/src/plugin/Form/Formula.tsx +79 -0
- package/src/plugin/Form/Group.tsx +295 -0
- package/src/plugin/Form/Hidden.tsx +44 -0
- package/src/plugin/Form/InputArray.tsx +228 -0
- package/src/plugin/Form/InputCity.tsx +93 -0
- package/src/plugin/Form/InputColor.tsx +123 -0
- package/src/plugin/Form/InputDate.tsx +175 -0
- package/src/plugin/Form/InputDateRange.tsx +225 -0
- package/src/plugin/Form/InputDateTime.tsx +183 -0
- package/src/plugin/Form/InputDateTimeRange.tsx +221 -0
- package/src/plugin/Form/InputEmail.tsx +33 -0
- package/src/plugin/Form/InputExcel.tsx +85 -0
- package/src/plugin/Form/InputFile.tsx +221 -0
- package/src/plugin/Form/InputGroup.tsx +96 -0
- package/src/plugin/Form/InputImage.tsx +266 -0
- package/src/plugin/Form/InputKV.tsx +72 -0
- package/src/plugin/Form/InputMonth.tsx +35 -0
- package/src/plugin/Form/InputMonthRange.tsx +195 -0
- package/src/plugin/Form/InputNumber.tsx +89 -0
- package/src/plugin/Form/InputPassword.tsx +33 -0
- package/src/plugin/Form/InputQuarter.tsx +35 -0
- package/src/plugin/Form/InputQuarterRange.tsx +195 -0
- package/src/plugin/Form/InputRange.tsx +121 -0
- package/src/plugin/Form/InputRating.tsx +78 -0
- package/src/plugin/Form/InputRepeat.tsx +57 -0
- package/src/plugin/Form/InputRichText.tsx +186 -0
- package/src/plugin/Form/InputSubForm.tsx +189 -0
- package/src/plugin/Form/InputTable.tsx +434 -0
- package/src/plugin/Form/InputTag.tsx +70 -0
- package/src/plugin/Form/InputText.tsx +186 -0
- package/src/plugin/Form/InputTime.tsx +85 -0
- package/src/plugin/Form/InputTree.tsx +229 -0
- package/src/plugin/Form/InputURL.tsx +34 -0
- package/src/plugin/Form/InputYear.tsx +35 -0
- package/src/plugin/Form/Item.tsx +327 -0
- package/src/plugin/Form/ListSelect.tsx +73 -0
- package/src/plugin/Form/LocationPicker.tsx +62 -0
- package/src/plugin/Form/MatrixCheckboxes.tsx +136 -0
- package/src/plugin/Form/NestedSelect.tsx +211 -0
- package/src/plugin/Form/Picker.tsx +209 -0
- package/src/plugin/Form/Radios.tsx +119 -0
- package/src/plugin/Form/Select.tsx +233 -0
- package/src/plugin/Form/Static.tsx +322 -0
- package/src/plugin/Form/Switch.tsx +107 -0
- package/src/plugin/Form/TabsTransfer.tsx +259 -0
- package/src/plugin/Form/Textarea.tsx +83 -0
- package/src/plugin/Form/Transfer.tsx +368 -0
- package/src/plugin/Form/TreeSelect.tsx +263 -0
- package/src/plugin/Form/UUID.tsx +48 -0
- package/src/plugin/Grid.tsx +798 -0
- package/src/plugin/HBox.tsx +727 -0
- package/src/plugin/IFrame.tsx +70 -0
- package/src/plugin/Image.tsx +314 -0
- package/src/plugin/Images.tsx +231 -0
- package/src/plugin/Json.tsx +69 -0
- package/src/plugin/Link.tsx +93 -0
- package/src/plugin/List.tsx +278 -0
- package/src/plugin/ListItem.tsx +229 -0
- package/src/plugin/Log.tsx +52 -0
- package/src/plugin/Mapping.tsx +149 -0
- package/src/plugin/Markdown.tsx +47 -0
- package/src/plugin/Nav.tsx +184 -0
- package/src/plugin/Operation.tsx +95 -0
- package/src/plugin/Others/Action.tsx +426 -0
- package/src/plugin/Others/BasicToolbar.tsx +585 -0
- package/src/plugin/Others/DataDebug.tsx +134 -0
- package/src/plugin/Others/TableCell.tsx +480 -0
- package/src/plugin/Others/Unknown.tsx +37 -0
- package/src/plugin/Page.tsx +306 -0
- package/src/plugin/Panel/AvailableRenderers.tsx +41 -0
- package/src/plugin/Panel/Code.tsx +44 -0
- package/src/plugin/Panel/Name.tsx +26 -0
- package/src/plugin/Panel/Outline.tsx +40 -0
- package/src/plugin/Panel.tsx +243 -0
- package/src/plugin/Plain.tsx +84 -0
- package/src/plugin/Progress.tsx +125 -0
- package/src/plugin/Property.tsx +139 -0
- package/src/plugin/QRCode.tsx +96 -0
- package/src/plugin/Reset.tsx +23 -0
- package/src/plugin/Service.tsx +162 -0
- package/src/plugin/Sparkline.tsx +40 -0
- package/src/plugin/Status.tsx +76 -0
- package/src/plugin/Steps.tsx +128 -0
- package/src/plugin/Submit.tsx +23 -0
- package/src/plugin/Table.tsx +428 -0
- package/src/plugin/TableView.tsx +709 -0
- package/src/plugin/Tabs.tsx +362 -0
- package/src/plugin/Tasks.tsx +274 -0
- package/src/plugin/Time.tsx +68 -0
- package/src/plugin/TooltipWrapper.tsx +193 -0
- package/src/plugin/Tpl.tsx +158 -0
- package/src/plugin/Video.tsx +158 -0
- package/src/plugin/WebComponent.tsx +53 -0
- package/src/plugin/Wizard.tsx +740 -0
- package/src/plugin/Wrapper.tsx +107 -0
- package/src/plugin.ts +1050 -0
- package/dist/150a58f3318ca7541ed9.png +0 -0
- package/dist/471adb97c322b226e589.png +0 -0
- package/dist/4de5f42360bc5946c3c2.png +0 -0
- package/dist/4e9968bba3855f088fed.png +0 -0
- package/dist/7f09c38ebc687fea847a.png +0 -0
- package/dist/c94073576487510314ea.png +0 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import {registerEditorPlugin} from '../manager';
|
3
|
+
import {BasePlugin} from '../plugin';
|
4
|
+
import {getSchemaTpl} from '../component/schemaTpl';
|
5
|
+
import {SchemaObject} from 'amis/lib/Schema';
|
6
|
+
|
7
|
+
export class AlertPlugin extends BasePlugin {
|
8
|
+
// 关联渲染器名字
|
9
|
+
rendererName = 'alert';
|
10
|
+
$schema = '/schemas/AlertSchema.json';
|
11
|
+
|
12
|
+
// 组件名称
|
13
|
+
name = '提示';
|
14
|
+
isBaseComponent = true;
|
15
|
+
description =
|
16
|
+
'用来做文字特殊提示,分为四类:提示类、成功类、警告类和危险类。可结合 <code>visibleOn</code> 用来做错误信息提示。';
|
17
|
+
docLink = '/amis/zh-CN/components/alert';
|
18
|
+
icon = 'fa fa-exclamation-circle';
|
19
|
+
scaffold: SchemaObject = {
|
20
|
+
type: 'alert',
|
21
|
+
body: {
|
22
|
+
type: 'tpl',
|
23
|
+
tpl: '提示内容',
|
24
|
+
inline: false
|
25
|
+
},
|
26
|
+
level: 'info'
|
27
|
+
};
|
28
|
+
previewSchema: any = {
|
29
|
+
...this.scaffold,
|
30
|
+
className: 'text-left',
|
31
|
+
showCloseButton: true
|
32
|
+
};
|
33
|
+
|
34
|
+
// 普通容器类渲染器配置
|
35
|
+
regions = [{key: 'body', label: '内容区', placeholder: '提示内容'}];
|
36
|
+
|
37
|
+
panelTitle = '提示';
|
38
|
+
panelBody = getSchemaTpl('tabs', [
|
39
|
+
{
|
40
|
+
title: '常规',
|
41
|
+
body: [
|
42
|
+
{
|
43
|
+
type: 'switch',
|
44
|
+
name: 'showCloseButton',
|
45
|
+
mode: 'inline',
|
46
|
+
className: 'w-full',
|
47
|
+
label: '显示关闭按钮'
|
48
|
+
}
|
49
|
+
]
|
50
|
+
},
|
51
|
+
{
|
52
|
+
title: '外观',
|
53
|
+
body: [
|
54
|
+
{
|
55
|
+
label: '样式',
|
56
|
+
name: 'level',
|
57
|
+
type: 'select',
|
58
|
+
options: [
|
59
|
+
{
|
60
|
+
label: '提示',
|
61
|
+
value: 'info'
|
62
|
+
},
|
63
|
+
{
|
64
|
+
label: '成功',
|
65
|
+
value: 'success'
|
66
|
+
},
|
67
|
+
{
|
68
|
+
label: '警告',
|
69
|
+
value: 'warning'
|
70
|
+
},
|
71
|
+
{
|
72
|
+
label: '严重',
|
73
|
+
value: 'danger'
|
74
|
+
}
|
75
|
+
]
|
76
|
+
},
|
77
|
+
getSchemaTpl('className')
|
78
|
+
]
|
79
|
+
},
|
80
|
+
{
|
81
|
+
title: '显隐',
|
82
|
+
body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
|
83
|
+
}
|
84
|
+
]);
|
85
|
+
}
|
86
|
+
|
87
|
+
registerEditorPlugin(AlertPlugin);
|
@@ -0,0 +1,233 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import {registerEditorPlugin} from '../manager';
|
3
|
+
import {getSchemaTpl} from '../component/schemaTpl';
|
4
|
+
import {BasePlugin, RendererInfo, VRendererConfig} from '../plugin';
|
5
|
+
import {VRenderer} from '../component/VRenderer';
|
6
|
+
import {mapReactElement} from '../component/factory';
|
7
|
+
import findIndex from 'lodash/findIndex';
|
8
|
+
import {RegionWrapper as Region} from '../component/RegionWrapper';
|
9
|
+
import {AnchorNavSection} from 'amis-ui';
|
10
|
+
|
11
|
+
export class AnchorNavPlugin extends BasePlugin {
|
12
|
+
// 关联渲染器名字
|
13
|
+
rendererName = 'anchor-nav';
|
14
|
+
$schema = '/schemas/AnchorNavSchema.json';
|
15
|
+
|
16
|
+
// 组件名称
|
17
|
+
name = '锚点导航';
|
18
|
+
isBaseComponent = true;
|
19
|
+
description =
|
20
|
+
'锚点导航,在多行内容展示时,可以将内容用锚点导航分组的形式展示,点击导航菜单可以定位到对应内容区域。';
|
21
|
+
docLink = '/amis/zh-CN/components/anchor-nav';
|
22
|
+
tags = ['容器'];
|
23
|
+
icon = 'fa fa-link';
|
24
|
+
scaffold = {
|
25
|
+
type: 'anchor-nav',
|
26
|
+
links: [
|
27
|
+
{
|
28
|
+
title: '用户信息',
|
29
|
+
body: '用户信息'
|
30
|
+
},
|
31
|
+
{
|
32
|
+
title: '系统配置信息',
|
33
|
+
body: [
|
34
|
+
{
|
35
|
+
type: 'form',
|
36
|
+
body: [
|
37
|
+
{
|
38
|
+
type: 'fieldSet',
|
39
|
+
title: '系统配置信息',
|
40
|
+
body: [
|
41
|
+
{
|
42
|
+
type: 'input-email',
|
43
|
+
name: 'email',
|
44
|
+
placeholder: '请输入邮箱地址',
|
45
|
+
label: '邮箱'
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}
|
49
|
+
]
|
50
|
+
}
|
51
|
+
]
|
52
|
+
},
|
53
|
+
{
|
54
|
+
title: '权限管理',
|
55
|
+
body: [
|
56
|
+
{
|
57
|
+
type: 'form',
|
58
|
+
body: [
|
59
|
+
{
|
60
|
+
type: 'fieldSet',
|
61
|
+
title: '权限管理',
|
62
|
+
body: [
|
63
|
+
{
|
64
|
+
type: 'input-email',
|
65
|
+
name: 'email',
|
66
|
+
placeholder: '请输入邮箱地址',
|
67
|
+
label: '邮箱'
|
68
|
+
}
|
69
|
+
]
|
70
|
+
}
|
71
|
+
]
|
72
|
+
}
|
73
|
+
]
|
74
|
+
},
|
75
|
+
{
|
76
|
+
title: '角色管理',
|
77
|
+
body: '角色管理'
|
78
|
+
},
|
79
|
+
{
|
80
|
+
title: '网络配置信息',
|
81
|
+
body: '网络配置信息'
|
82
|
+
}
|
83
|
+
]
|
84
|
+
};
|
85
|
+
previewSchema = {
|
86
|
+
...this.scaffold
|
87
|
+
};
|
88
|
+
|
89
|
+
panelTitle = '锚点导航';
|
90
|
+
panelBody = [
|
91
|
+
getSchemaTpl('tabs', [
|
92
|
+
{
|
93
|
+
title: '常规',
|
94
|
+
body: [
|
95
|
+
{
|
96
|
+
name: 'links',
|
97
|
+
type: 'combo',
|
98
|
+
label: '锚点管理',
|
99
|
+
multiple: true,
|
100
|
+
draggable: true,
|
101
|
+
minLength: 1,
|
102
|
+
items: [{type: 'input-text', name: 'title', required: true}],
|
103
|
+
scaffold: {
|
104
|
+
title: '锚点内容',
|
105
|
+
body: {
|
106
|
+
type: 'tpl',
|
107
|
+
tpl: '内容',
|
108
|
+
inline: false
|
109
|
+
}
|
110
|
+
},
|
111
|
+
addButtonText: '新增锚点',
|
112
|
+
draggableTip: ''
|
113
|
+
}
|
114
|
+
]
|
115
|
+
},
|
116
|
+
{
|
117
|
+
title: '外观',
|
118
|
+
body: [
|
119
|
+
getSchemaTpl('className'),
|
120
|
+
getSchemaTpl('className', {
|
121
|
+
name: 'linkClassName',
|
122
|
+
label: '导航 CSS 类名'
|
123
|
+
}),
|
124
|
+
getSchemaTpl('className', {
|
125
|
+
name: 'sectionClassName',
|
126
|
+
label: '区域内容 CSS 类名'
|
127
|
+
})
|
128
|
+
]
|
129
|
+
}
|
130
|
+
])
|
131
|
+
];
|
132
|
+
|
133
|
+
patchContainers = ['anchor-nav.body'];
|
134
|
+
|
135
|
+
vRendererConfig: VRendererConfig = {
|
136
|
+
regions: {
|
137
|
+
body: {
|
138
|
+
key: 'body',
|
139
|
+
label: '内容区'
|
140
|
+
}
|
141
|
+
},
|
142
|
+
panelTitle: '内容区域',
|
143
|
+
panelBody: [
|
144
|
+
getSchemaTpl('fieldSet', {
|
145
|
+
title: '常规',
|
146
|
+
body: [
|
147
|
+
{
|
148
|
+
name: 'title',
|
149
|
+
label: '标题',
|
150
|
+
type: 'input-text',
|
151
|
+
required: true
|
152
|
+
}
|
153
|
+
]
|
154
|
+
}),
|
155
|
+
getSchemaTpl('fieldSet', {
|
156
|
+
title: '外观',
|
157
|
+
body: [getSchemaTpl('className')]
|
158
|
+
})
|
159
|
+
]
|
160
|
+
};
|
161
|
+
|
162
|
+
wrapperProps = {
|
163
|
+
unmountOnExit: true,
|
164
|
+
mountOnEnter: true
|
165
|
+
};
|
166
|
+
|
167
|
+
sectionWrapperResolve = (dom: HTMLElement) => dom.parentElement!;
|
168
|
+
overrides = {
|
169
|
+
render(this: any) {
|
170
|
+
const dom = this.super();
|
171
|
+
|
172
|
+
if (!this.renderSection && this.props.$$editor && dom) {
|
173
|
+
const links = this.props.links;
|
174
|
+
return mapReactElement(dom, item => {
|
175
|
+
if (item.type === AnchorNavSection && item.props.$$id) {
|
176
|
+
const id = item.props.$$id;
|
177
|
+
const index = findIndex(links, (link: any) => link.$$id === id);
|
178
|
+
const info: RendererInfo = this.props.$$editor;
|
179
|
+
const plugin: AnchorNavPlugin = info.plugin as any;
|
180
|
+
|
181
|
+
if (~index) {
|
182
|
+
const region = plugin.vRendererConfig?.regions?.body;
|
183
|
+
|
184
|
+
if (!region) {
|
185
|
+
return item;
|
186
|
+
}
|
187
|
+
|
188
|
+
return React.cloneElement(item, {
|
189
|
+
children: (
|
190
|
+
<VRenderer
|
191
|
+
key={id}
|
192
|
+
plugin={info.plugin}
|
193
|
+
renderer={info.renderer}
|
194
|
+
$schema="/schemas/SectionSchema.json"
|
195
|
+
hostId={info.id}
|
196
|
+
memberIndex={index}
|
197
|
+
name={`${item.props.title || `锚点内容${index + 1}`}`}
|
198
|
+
id={id}
|
199
|
+
draggable={false}
|
200
|
+
wrapperResolve={plugin.sectionWrapperResolve}
|
201
|
+
schemaPath={`${info.schemaPath}/anchor-nav/${index}`}
|
202
|
+
path={`${this.props.$path}/${index}`} // 好像没啥用
|
203
|
+
data={this.props.data} // 好像没啥用
|
204
|
+
>
|
205
|
+
<Region
|
206
|
+
key={region.key}
|
207
|
+
preferTag={region.preferTag}
|
208
|
+
name={region.key}
|
209
|
+
label={region.label}
|
210
|
+
regionConfig={region}
|
211
|
+
placeholder={region.placeholder}
|
212
|
+
editorStore={plugin.manager.store}
|
213
|
+
manager={plugin.manager}
|
214
|
+
children={item.props.children}
|
215
|
+
wrapperResolve={region.wrapperResolve}
|
216
|
+
rendererName={info.renderer.name}
|
217
|
+
/>
|
218
|
+
</VRenderer>
|
219
|
+
)
|
220
|
+
});
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
return item;
|
225
|
+
});
|
226
|
+
}
|
227
|
+
|
228
|
+
return dom;
|
229
|
+
}
|
230
|
+
};
|
231
|
+
}
|
232
|
+
|
233
|
+
registerEditorPlugin(AnchorNavPlugin);
|
@@ -0,0 +1,154 @@
|
|
1
|
+
import {registerEditorPlugin} from '../manager';
|
2
|
+
import {BaseEventContext, BasePlugin} from '../plugin';
|
3
|
+
import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
|
4
|
+
|
5
|
+
export class AudioPlugin extends BasePlugin {
|
6
|
+
// 关联渲染器名字
|
7
|
+
rendererName = 'audio';
|
8
|
+
$schema = '/schemas/AudioSchema.json';
|
9
|
+
|
10
|
+
// 组件名称
|
11
|
+
name = '音频';
|
12
|
+
isBaseComponent = true;
|
13
|
+
description = '音频控件,可以用来播放各种音频文件。';
|
14
|
+
tags = ['功能'];
|
15
|
+
icon = 'fa fa-music';
|
16
|
+
scaffold = {
|
17
|
+
type: 'audio',
|
18
|
+
autoPlay: false,
|
19
|
+
src: ''
|
20
|
+
};
|
21
|
+
previewSchema = {
|
22
|
+
...this.scaffold
|
23
|
+
};
|
24
|
+
|
25
|
+
panelTitle = '音频';
|
26
|
+
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>'
|
39
|
+
}
|
40
|
+
: null,
|
41
|
+
{
|
42
|
+
name: 'src',
|
43
|
+
type: 'input-text',
|
44
|
+
label: '音频地址',
|
45
|
+
description: '支持获取变量如:<code>\\${audioSrc}</code>'
|
46
|
+
},
|
47
|
+
{
|
48
|
+
type: 'select',
|
49
|
+
name: 'rates',
|
50
|
+
label: '音频倍速',
|
51
|
+
description: '加速范围在0.1到16之间',
|
52
|
+
multiple: true,
|
53
|
+
pipeIn: (value: any) =>
|
54
|
+
Array.isArray(value) ? value.join(',') : [],
|
55
|
+
pipeOut: (value: any) => {
|
56
|
+
if (value && value.length) {
|
57
|
+
let rates = value.split(',');
|
58
|
+
rates = rates
|
59
|
+
.filter(
|
60
|
+
(x: string | number) =>
|
61
|
+
Number(x) && Number(x) > 0 && Number(x) <= 16
|
62
|
+
)
|
63
|
+
.map((x: string | number) => Number(Number(x).toFixed(1)));
|
64
|
+
return Array.from(new Set(rates));
|
65
|
+
} else {
|
66
|
+
return [];
|
67
|
+
}
|
68
|
+
},
|
69
|
+
options: ['0.5', '1', '1.5', '2', '2.5', '3', '3.5', '4']
|
70
|
+
},
|
71
|
+
{
|
72
|
+
name: 'controls',
|
73
|
+
type: 'select',
|
74
|
+
label: '内部控件',
|
75
|
+
multiple: true,
|
76
|
+
extractValue: true,
|
77
|
+
joinValues: false,
|
78
|
+
options: [
|
79
|
+
{
|
80
|
+
label: '倍速',
|
81
|
+
value: 'rates'
|
82
|
+
},
|
83
|
+
{
|
84
|
+
label: '播放',
|
85
|
+
value: 'play'
|
86
|
+
},
|
87
|
+
{
|
88
|
+
label: '时间',
|
89
|
+
value: 'time'
|
90
|
+
},
|
91
|
+
{
|
92
|
+
label: '进度',
|
93
|
+
value: 'process'
|
94
|
+
},
|
95
|
+
{
|
96
|
+
label: '音量',
|
97
|
+
value: 'volume'
|
98
|
+
}
|
99
|
+
],
|
100
|
+
pipeIn: defaultValue([
|
101
|
+
'rates',
|
102
|
+
'play',
|
103
|
+
'time',
|
104
|
+
'process',
|
105
|
+
'volume'
|
106
|
+
]),
|
107
|
+
labelRemark: {
|
108
|
+
trigger: 'click',
|
109
|
+
className: 'm-l-xs',
|
110
|
+
rootClose: true,
|
111
|
+
content: '选择倍速后,还需要在常规选择栏中配置倍速',
|
112
|
+
placement: 'left'
|
113
|
+
}
|
114
|
+
},
|
115
|
+
{
|
116
|
+
name: 'autoPlay',
|
117
|
+
type: 'switch',
|
118
|
+
mode: 'inline',
|
119
|
+
className: 'w-full',
|
120
|
+
label: '自动播放'
|
121
|
+
},
|
122
|
+
{
|
123
|
+
name: 'loop',
|
124
|
+
type: 'switch',
|
125
|
+
mode: 'inline',
|
126
|
+
className: 'w-full',
|
127
|
+
label: '循环播放'
|
128
|
+
}
|
129
|
+
]
|
130
|
+
},
|
131
|
+
{
|
132
|
+
title: '外观',
|
133
|
+
body: [
|
134
|
+
getSchemaTpl('className'),
|
135
|
+
{
|
136
|
+
name: 'inline',
|
137
|
+
type: 'switch',
|
138
|
+
mode: 'inline',
|
139
|
+
className: 'w-full',
|
140
|
+
label: '内联模式',
|
141
|
+
pipeIn: defaultValue(true)
|
142
|
+
}
|
143
|
+
]
|
144
|
+
},
|
145
|
+
{
|
146
|
+
title: '显隐',
|
147
|
+
body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
|
148
|
+
}
|
149
|
+
])
|
150
|
+
];
|
151
|
+
};
|
152
|
+
}
|
153
|
+
|
154
|
+
registerEditorPlugin(AudioPlugin);
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/**
|
2
|
+
* @file 头像
|
3
|
+
*/
|
4
|
+
import {registerEditorPlugin} from '../manager';
|
5
|
+
import {BaseEventContext, BasePlugin} from '../plugin';
|
6
|
+
import {getSchemaTpl} from '../component/schemaTpl';
|
7
|
+
|
8
|
+
export class AvatarPlugin extends BasePlugin {
|
9
|
+
// 关联渲染器名字
|
10
|
+
rendererName = 'avatar';
|
11
|
+
$schema = '/schemas/AvatarSchema.json';
|
12
|
+
|
13
|
+
// 组件名称
|
14
|
+
name = '头像';
|
15
|
+
isBaseComponent = true;
|
16
|
+
icon = 'fa fa-user';
|
17
|
+
description = '用户头像';
|
18
|
+
docLink = '/amis/zh-CN/components/avatar';
|
19
|
+
tags = ['其他'];
|
20
|
+
scaffold = {
|
21
|
+
type: 'avatar',
|
22
|
+
icon: 'fa fa-user'
|
23
|
+
};
|
24
|
+
previewSchema: any = {
|
25
|
+
...this.scaffold
|
26
|
+
};
|
27
|
+
|
28
|
+
panelTitle = '面包屑';
|
29
|
+
panelBody = [
|
30
|
+
getSchemaTpl('tabs', [
|
31
|
+
{
|
32
|
+
title: '常规',
|
33
|
+
body: [
|
34
|
+
{
|
35
|
+
type: 'input-text',
|
36
|
+
label: '文字',
|
37
|
+
name: 'text'
|
38
|
+
},
|
39
|
+
{
|
40
|
+
type: 'select',
|
41
|
+
label: '图片拉伸方式',
|
42
|
+
options: ['cover', 'fill', 'contain', 'none', 'scale-down']
|
43
|
+
},
|
44
|
+
{
|
45
|
+
type: 'radios',
|
46
|
+
name: 'shape',
|
47
|
+
inline: true,
|
48
|
+
value: 'circle',
|
49
|
+
label: '形状',
|
50
|
+
options: ['circle', 'square']
|
51
|
+
},
|
52
|
+
{
|
53
|
+
name: 'icon',
|
54
|
+
label: '图标',
|
55
|
+
type: 'icon-picker'
|
56
|
+
},
|
57
|
+
{
|
58
|
+
name: 'size',
|
59
|
+
label: '大小',
|
60
|
+
value: 40,
|
61
|
+
type: 'input-number'
|
62
|
+
}
|
63
|
+
]
|
64
|
+
},
|
65
|
+
{
|
66
|
+
title: '外观',
|
67
|
+
body: [getSchemaTpl('className'), getSchemaTpl('style')]
|
68
|
+
},
|
69
|
+
{
|
70
|
+
title: '显隐',
|
71
|
+
body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
|
72
|
+
}
|
73
|
+
])
|
74
|
+
];
|
75
|
+
}
|
76
|
+
|
77
|
+
registerEditorPlugin(AvatarPlugin);
|
@@ -0,0 +1,107 @@
|
|
1
|
+
/**
|
2
|
+
* @file 面包屑
|
3
|
+
*/
|
4
|
+
import {registerEditorPlugin} from '../manager';
|
5
|
+
import {BaseEventContext, BasePlugin} from '../plugin';
|
6
|
+
import {getSchemaTpl} from '../component/schemaTpl';
|
7
|
+
|
8
|
+
export class BreadcrumbPlugin extends BasePlugin {
|
9
|
+
// 关联渲染器名字
|
10
|
+
rendererName = 'breadcrumb';
|
11
|
+
$schema = '/schemas/BreadcrumbSchema.json';
|
12
|
+
disabledRendererPlugin = true;
|
13
|
+
|
14
|
+
// 组件名称
|
15
|
+
name = '面包屑';
|
16
|
+
isBaseComponent = true;
|
17
|
+
icon = 'fa fa-list';
|
18
|
+
description = '面包屑导航';
|
19
|
+
docLink = '/amis/zh-CN/components/breadcrumb';
|
20
|
+
tags = ['其他'];
|
21
|
+
scaffold = {
|
22
|
+
type: 'breadcrumb',
|
23
|
+
items: [
|
24
|
+
{
|
25
|
+
label: '首页',
|
26
|
+
href: '/',
|
27
|
+
icon: 'fa fa-home'
|
28
|
+
},
|
29
|
+
{
|
30
|
+
label: '上级页面'
|
31
|
+
},
|
32
|
+
{
|
33
|
+
label: '<b>当前页面</b>'
|
34
|
+
}
|
35
|
+
]
|
36
|
+
};
|
37
|
+
previewSchema: any = {
|
38
|
+
...this.scaffold
|
39
|
+
};
|
40
|
+
|
41
|
+
panelTitle = '面包屑';
|
42
|
+
panelBody = [
|
43
|
+
getSchemaTpl('tabs', [
|
44
|
+
{
|
45
|
+
title: '常规',
|
46
|
+
body: [
|
47
|
+
{
|
48
|
+
label: '分隔符',
|
49
|
+
type: 'input-text',
|
50
|
+
name: 'separator'
|
51
|
+
},
|
52
|
+
getSchemaTpl('api', {
|
53
|
+
label: '动态数据',
|
54
|
+
name: 'source'
|
55
|
+
}),
|
56
|
+
{
|
57
|
+
label: '面包屑',
|
58
|
+
name: 'items',
|
59
|
+
type: 'combo',
|
60
|
+
multiple: true,
|
61
|
+
multiLine: true,
|
62
|
+
draggable: true,
|
63
|
+
addButtonText: '新增',
|
64
|
+
items: [
|
65
|
+
{
|
66
|
+
type: 'input-text',
|
67
|
+
placeholder: '文本',
|
68
|
+
name: 'label'
|
69
|
+
},
|
70
|
+
{
|
71
|
+
type: 'input-text',
|
72
|
+
name: 'href',
|
73
|
+
placeholder: '链接'
|
74
|
+
},
|
75
|
+
{
|
76
|
+
name: 'icon',
|
77
|
+
label: '图标',
|
78
|
+
type: 'icon-picker'
|
79
|
+
}
|
80
|
+
]
|
81
|
+
}
|
82
|
+
]
|
83
|
+
},
|
84
|
+
{
|
85
|
+
title: '外观',
|
86
|
+
body: [
|
87
|
+
getSchemaTpl('className'),
|
88
|
+
getSchemaTpl('className', {
|
89
|
+
name: 'itemClassName',
|
90
|
+
label: '面包屑的 CSS 类名'
|
91
|
+
}),
|
92
|
+
,
|
93
|
+
getSchemaTpl('className', {
|
94
|
+
name: 'separatorClassName',
|
95
|
+
label: '分隔符的 CSS 类名'
|
96
|
+
})
|
97
|
+
]
|
98
|
+
},
|
99
|
+
{
|
100
|
+
title: '显隐',
|
101
|
+
body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
|
102
|
+
}
|
103
|
+
])
|
104
|
+
];
|
105
|
+
}
|
106
|
+
|
107
|
+
registerEditorPlugin(BreadcrumbPlugin);
|