amis-editor 4.0.2-beta.16 → 4.1.0-beta.19
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/Editor.d.ts +19 -0
- package/dist/component/Panel/RenderersPanel.d.ts +1 -2
- package/dist/component/RegionWrapper.d.ts +15 -8
- package/dist/component/RendererThumb.d.ts +5 -5
- package/dist/component/VRenderer.d.ts +5 -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 +3 -43
- 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 +14 -3
- package/dist/plugin/Card.d.ts +1 -0
- package/dist/plugin/Cards.d.ts +1 -0
- 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 +43 -0
- package/dist/plugin/Flex.d.ts +1 -0
- package/dist/plugin/Form/Control.d.ts +1 -0
- package/dist/plugin/Form/InputURL.d.ts +1 -0
- package/dist/plugin/Grid.d.ts +1 -0
- package/dist/plugin/HBox.d.ts +1 -0
- package/dist/plugin/Json.d.ts +1 -0
- package/dist/plugin/List.d.ts +1 -0
- 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/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/TableView.d.ts +1 -0
- package/dist/plugin/Tasks.d.ts +1 -0
- package/dist/plugin/TooltipWrapper.d.ts +2 -0
- package/dist/plugin/Video.d.ts +1 -0
- package/dist/plugin/WebComponent.d.ts +1 -0
- package/dist/plugin/Wrapper.d.ts +1 -0
- package/dist/plugin.d.ts +2 -2
- package/dist/store/editor.d.ts +20 -2
- package/dist/store/node.d.ts +6 -0
- package/dist/style.css +1 -1
- package/dist/util.d.ts +7 -2
- package/package.json +6 -3
- package/src/component/schemaTpl.tsx +2155 -0
- package/src/plugin/.DS_Store +0 -0
- package/src/plugin/Alert.tsx +87 -0
- package/src/plugin/AnchorNav.tsx +233 -0
- package/src/plugin/Audio.tsx +161 -0
- package/src/plugin/Avatar.tsx +77 -0
- package/src/plugin/Breadcrumb.tsx +107 -0
- package/src/plugin/Button.tsx +283 -0
- package/src/plugin/ButtonGroup.tsx +88 -0
- package/src/plugin/ButtonToolbar.tsx +89 -0
- package/src/plugin/CRUD.tsx +1832 -0
- package/src/plugin/Card.tsx +290 -0
- package/src/plugin/Cards.tsx +315 -0
- package/src/plugin/Carousel.tsx +386 -0
- package/src/plugin/Chart.tsx +218 -0
- package/src/plugin/CodeView.tsx +60 -0
- package/src/plugin/Collapse.tsx +143 -0
- package/src/plugin/CollapseGroup.tsx +167 -0
- package/src/plugin/Container.tsx +44 -0
- package/src/plugin/Custom.tsx +128 -0
- package/src/plugin/CustomRegion.tsx +150 -0
- package/src/plugin/Date.tsx +81 -0
- package/src/plugin/Datetime.tsx +75 -0
- package/src/plugin/Dialog.tsx +178 -0
- package/src/plugin/Divider.tsx +36 -0
- package/src/plugin/Drawer.tsx +217 -0
- package/src/plugin/DropDownButton.tsx +234 -0
- package/src/plugin/Each.tsx +152 -0
- package/src/plugin/ErrorRenderer.tsx +15 -0
- package/src/plugin/Flex.tsx +156 -0
- package/src/plugin/Form/ButtonGroupSelect.tsx +86 -0
- package/src/plugin/Form/ButtonToolbar.tsx +121 -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 +91 -0
- package/src/plugin/Form/Combo.tsx +582 -0
- package/src/plugin/Form/ConditionBuilder.tsx +324 -0
- package/src/plugin/Form/Control.tsx +139 -0
- package/src/plugin/Form/DiffEditor.tsx +117 -0
- package/src/plugin/Form/FieldSet.tsx +175 -0
- package/src/plugin/Form/Form.tsx +692 -0
- package/src/plugin/Form/Formula.tsx +91 -0
- package/src/plugin/Form/Group.tsx +300 -0
- package/src/plugin/Form/Hidden.tsx +56 -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 +228 -0
- package/src/plugin/Form/InputGroup.tsx +105 -0
- package/src/plugin/Form/InputImage.tsx +277 -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 +97 -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 +69 -0
- package/src/plugin/Form/InputRichText.tsx +197 -0
- package/src/plugin/Form/InputSubForm.tsx +198 -0
- package/src/plugin/Form/InputTable.tsx +434 -0
- package/src/plugin/Form/InputTag.tsx +81 -0
- package/src/plugin/Form/InputText.tsx +186 -0
- package/src/plugin/Form/InputTime.tsx +95 -0
- package/src/plugin/Form/InputTree.tsx +240 -0
- package/src/plugin/Form/InputURL.tsx +34 -0
- package/src/plugin/Form/InputYear.tsx +35 -0
- package/src/plugin/Form/Item.tsx +325 -0
- package/src/plugin/Form/ListSelect.tsx +84 -0
- package/src/plugin/Form/LocationPicker.tsx +75 -0
- package/src/plugin/Form/MatrixCheckboxes.tsx +147 -0
- package/src/plugin/Form/NestedSelect.tsx +222 -0
- package/src/plugin/Form/Picker.tsx +217 -0
- package/src/plugin/Form/Radios.tsx +130 -0
- package/src/plugin/Form/Select.tsx +216 -0
- package/src/plugin/Form/Static.tsx +335 -0
- package/src/plugin/Form/Switch.tsx +116 -0
- package/src/plugin/Form/TabsTransfer.tsx +270 -0
- package/src/plugin/Form/Textarea.tsx +94 -0
- package/src/plugin/Form/Transfer.tsx +379 -0
- package/src/plugin/Form/TreeSelect.tsx +263 -0
- package/src/plugin/Form/UUID.tsx +48 -0
- package/src/plugin/Grid.tsx +799 -0
- package/src/plugin/HBox.tsx +727 -0
- package/src/plugin/IFrame.tsx +72 -0
- package/src/plugin/Image.tsx +318 -0
- package/src/plugin/Images.tsx +238 -0
- package/src/plugin/Json.tsx +76 -0
- package/src/plugin/Link.tsx +95 -0
- package/src/plugin/List.tsx +278 -0
- package/src/plugin/ListItem.tsx +233 -0
- package/src/plugin/Log.tsx +52 -0
- package/src/plugin/Mapping.tsx +156 -0
- package/src/plugin/Markdown.tsx +47 -0
- package/src/plugin/Nav.tsx +186 -0
- package/src/plugin/Operation.tsx +97 -0
- package/src/plugin/Others/Action.tsx +428 -0
- package/src/plugin/Others/BasicToolbar.tsx +591 -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 +308 -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 +91 -0
- package/src/plugin/Progress.tsx +132 -0
- package/src/plugin/Property.tsx +139 -0
- package/src/plugin/QRCode.tsx +98 -0
- package/src/plugin/Reset.tsx +23 -0
- package/src/plugin/Service.tsx +167 -0
- package/src/plugin/Sparkline.tsx +40 -0
- package/src/plugin/Status.tsx +78 -0
- package/src/plugin/Steps.tsx +140 -0
- package/src/plugin/Submit.tsx +23 -0
- package/src/plugin/Table.tsx +440 -0
- package/src/plugin/TableView.tsx +711 -0
- package/src/plugin/Tabs.tsx +364 -0
- package/src/plugin/Tasks.tsx +276 -0
- package/src/plugin/Time.tsx +75 -0
- package/src/plugin/TooltipWrapper.tsx +193 -0
- package/src/plugin/Tpl.tsx +162 -0
- package/src/plugin/Video.tsx +160 -0
- package/src/plugin/WebComponent.tsx +56 -0
- package/src/plugin/Wizard.tsx +743 -0
- package/src/plugin/Wrapper.tsx +107 -0
- package/src/plugin.ts +1046 -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,193 @@
|
|
1
|
+
import {registerEditorPlugin} from '../manager';
|
2
|
+
import {BasePlugin, RegionConfig, BaseEventContext} from '../plugin';
|
3
|
+
import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
|
4
|
+
|
5
|
+
export class TooltipWrapperPlugin extends BasePlugin {
|
6
|
+
rendererName = 'tooltip-wrapper';
|
7
|
+
$schema = '/schemas/TooltipWrapperSchema.json';
|
8
|
+
|
9
|
+
isBaseComponent = true;
|
10
|
+
name = '文字提示容器';
|
11
|
+
description =
|
12
|
+
'类似容器,可以将多个渲染器放置在一起,当用户鼠标悬停或者点击容器时,显示文字提示浮层';
|
13
|
+
docLink = '/amis/zh-CN/components/tooltip';
|
14
|
+
tags = ['容器'];
|
15
|
+
icon = 'fa fa-comment-alt';
|
16
|
+
|
17
|
+
scaffold = {
|
18
|
+
type: 'tooltip-wrapper',
|
19
|
+
tooltip: '提示文字',
|
20
|
+
body: [
|
21
|
+
{
|
22
|
+
type: 'tpl',
|
23
|
+
tpl: '内容'
|
24
|
+
}
|
25
|
+
]
|
26
|
+
};
|
27
|
+
|
28
|
+
previewSchema = {
|
29
|
+
...this.scaffold,
|
30
|
+
className: 'p-1 mr-3 border-2 border-solid border-indigo-400'
|
31
|
+
};
|
32
|
+
|
33
|
+
regions: Array<RegionConfig> = [
|
34
|
+
{
|
35
|
+
key: 'body',
|
36
|
+
label: '内容区'
|
37
|
+
}
|
38
|
+
];
|
39
|
+
|
40
|
+
panelTitle = this.name;
|
41
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
42
|
+
return [
|
43
|
+
getSchemaTpl('tabs', [
|
44
|
+
{
|
45
|
+
title: '属性',
|
46
|
+
body: [
|
47
|
+
{
|
48
|
+
type: 'input-text',
|
49
|
+
name: 'title',
|
50
|
+
label: '提示标题'
|
51
|
+
},
|
52
|
+
{
|
53
|
+
type: 'textarea',
|
54
|
+
name: 'tooltip',
|
55
|
+
label: '提示内容'
|
56
|
+
},
|
57
|
+
{
|
58
|
+
name: 'wrapperComponent',
|
59
|
+
label: '容器标签',
|
60
|
+
type: 'input-text',
|
61
|
+
options: [
|
62
|
+
'article',
|
63
|
+
'aside',
|
64
|
+
'code',
|
65
|
+
'div',
|
66
|
+
'footer',
|
67
|
+
'header',
|
68
|
+
'p',
|
69
|
+
'section'
|
70
|
+
],
|
71
|
+
validations: {
|
72
|
+
isAlphanumeric: true,
|
73
|
+
matchRegexp: '/^(?!.*script).*$/' // 禁用一下script标签
|
74
|
+
},
|
75
|
+
validationErrors: {
|
76
|
+
isAlpha: 'HTML标签不合法,请重新输入',
|
77
|
+
matchRegexp: 'HTML标签不合法,请重新输入'
|
78
|
+
},
|
79
|
+
validateOnChange: false
|
80
|
+
},
|
81
|
+
{
|
82
|
+
name: 'trigger',
|
83
|
+
type: 'select',
|
84
|
+
label: '触发方式',
|
85
|
+
multiple: true,
|
86
|
+
value: ['hover'],
|
87
|
+
pipeIn: (value: any) =>
|
88
|
+
Array.isArray(value) ? value.join(',') : [],
|
89
|
+
pipeOut: (value: any) =>
|
90
|
+
value && value.length ? value.split(',') : undefined,
|
91
|
+
options: [
|
92
|
+
{
|
93
|
+
label: '鼠标悬停',
|
94
|
+
value: 'hover'
|
95
|
+
},
|
96
|
+
|
97
|
+
{
|
98
|
+
label: '点击',
|
99
|
+
value: 'click'
|
100
|
+
}
|
101
|
+
]
|
102
|
+
},
|
103
|
+
{
|
104
|
+
type: 'button-group-select',
|
105
|
+
name: 'placement',
|
106
|
+
label: '提示位置',
|
107
|
+
options: [
|
108
|
+
{
|
109
|
+
label: '上',
|
110
|
+
value: 'top',
|
111
|
+
icon: 'fa fa-arrow-up'
|
112
|
+
},
|
113
|
+
{
|
114
|
+
label: '下',
|
115
|
+
value: 'bottom',
|
116
|
+
icon: 'fa fa-arrow-down'
|
117
|
+
},
|
118
|
+
{
|
119
|
+
label: '左',
|
120
|
+
value: 'left',
|
121
|
+
icon: 'fa fa-arrow-left'
|
122
|
+
},
|
123
|
+
{
|
124
|
+
label: '右',
|
125
|
+
value: 'right',
|
126
|
+
icon: 'fa fa-arrow-right'
|
127
|
+
}
|
128
|
+
],
|
129
|
+
pipeIn: defaultValue('top')
|
130
|
+
},
|
131
|
+
{
|
132
|
+
type: 'button-group-select',
|
133
|
+
name: 'tooltipTheme',
|
134
|
+
label: '主题色',
|
135
|
+
options: [
|
136
|
+
{
|
137
|
+
label: '亮色',
|
138
|
+
value: 'light',
|
139
|
+
icon: 'fa fa-sun'
|
140
|
+
},
|
141
|
+
{
|
142
|
+
label: '暗色',
|
143
|
+
value: 'dark',
|
144
|
+
icon: 'fas fa-moon'
|
145
|
+
}
|
146
|
+
],
|
147
|
+
pipeIn: defaultValue('light')
|
148
|
+
},
|
149
|
+
{
|
150
|
+
name: 'inline',
|
151
|
+
label: '容器内联',
|
152
|
+
type: 'switch',
|
153
|
+
mode: 'row',
|
154
|
+
inputClassName: 'inline-flex justify-between flex-row-reverse'
|
155
|
+
},
|
156
|
+
{
|
157
|
+
name: 'rootClose',
|
158
|
+
visibleOn: '~this.trigger.indexOf("click")',
|
159
|
+
label: '点击容器外部关闭提示',
|
160
|
+
type: 'switch',
|
161
|
+
mode: 'row',
|
162
|
+
inputClassName: 'inline-flex justify-between flex-row-reverse'
|
163
|
+
},
|
164
|
+
{
|
165
|
+
label: '延迟关闭时间',
|
166
|
+
type: 'input-number',
|
167
|
+
min: 0,
|
168
|
+
step: 100,
|
169
|
+
name: 'delay',
|
170
|
+
suffix: 'ms',
|
171
|
+
pipeIn: defaultValue(0)
|
172
|
+
}
|
173
|
+
]
|
174
|
+
},
|
175
|
+
{
|
176
|
+
title: '外观',
|
177
|
+
body: [
|
178
|
+
getSchemaTpl('className', {
|
179
|
+
label: '内容区CSS类名'
|
180
|
+
}),
|
181
|
+
getSchemaTpl('className', {
|
182
|
+
label: '浮层CSS类名',
|
183
|
+
name: 'tooltipClassName'
|
184
|
+
}),
|
185
|
+
getSchemaTpl('style')
|
186
|
+
]
|
187
|
+
}
|
188
|
+
])
|
189
|
+
];
|
190
|
+
};
|
191
|
+
}
|
192
|
+
|
193
|
+
registerEditorPlugin(TooltipWrapperPlugin);
|
@@ -0,0 +1,162 @@
|
|
1
|
+
import {SchemaObject} from 'amis';
|
2
|
+
import {registerEditorPlugin} from '../manager';
|
3
|
+
import {
|
4
|
+
BaseEventContext,
|
5
|
+
BasePlugin,
|
6
|
+
RegionConfig,
|
7
|
+
RendererInfo
|
8
|
+
} from '../plugin';
|
9
|
+
import {defaultValue, getSchemaTpl, setSchemaTpl} from '../component/schemaTpl';
|
10
|
+
|
11
|
+
setSchemaTpl('tpl:content', {
|
12
|
+
label: '内容',
|
13
|
+
// type: 'textarea',
|
14
|
+
type: 'input-rich-text',
|
15
|
+
buttons: [
|
16
|
+
'paragraphFormat',
|
17
|
+
'quote',
|
18
|
+
'color',
|
19
|
+
'|',
|
20
|
+
'bold',
|
21
|
+
'italic',
|
22
|
+
'underline',
|
23
|
+
'strikeThrough',
|
24
|
+
'|',
|
25
|
+
'formatOL',
|
26
|
+
'formatUL',
|
27
|
+
'align',
|
28
|
+
'|',
|
29
|
+
'insertLink',
|
30
|
+
'insertImage',
|
31
|
+
'insertTable',
|
32
|
+
'|',
|
33
|
+
'undo',
|
34
|
+
'redo',
|
35
|
+
'fullscreen'
|
36
|
+
],
|
37
|
+
minRows: 5,
|
38
|
+
language: 'html',
|
39
|
+
// visibleOn: 'data.__mode !="input-rich-text"',
|
40
|
+
pipeIn: (value: any, data: any) => value || (data && data.html),
|
41
|
+
name: 'tpl',
|
42
|
+
description:
|
43
|
+
'支持使用 <code>\\${xxx}</code> 来获取变量,或者用 lodash.template 语法来写模板逻辑。<a target="_blank" href="/amis/zh-CN/docs/concepts/template">详情</a>'
|
44
|
+
});
|
45
|
+
|
46
|
+
setSchemaTpl('tpl:wrapperComponent', {
|
47
|
+
name: 'wrapperComponent',
|
48
|
+
type: 'select',
|
49
|
+
pipeIn: defaultValue('div'),
|
50
|
+
label: '格式',
|
51
|
+
options: [
|
52
|
+
{
|
53
|
+
label: '普通文字',
|
54
|
+
value: 'div'
|
55
|
+
},
|
56
|
+
{
|
57
|
+
label: '段落',
|
58
|
+
value: 'p'
|
59
|
+
},
|
60
|
+
{
|
61
|
+
label: '一级标题',
|
62
|
+
value: 'h1'
|
63
|
+
},
|
64
|
+
{
|
65
|
+
label: '二级标题',
|
66
|
+
value: 'h2'
|
67
|
+
},
|
68
|
+
{
|
69
|
+
label: '三级标题',
|
70
|
+
value: 'h3'
|
71
|
+
},
|
72
|
+
{
|
73
|
+
label: '四级标题',
|
74
|
+
value: 'h4'
|
75
|
+
},
|
76
|
+
{
|
77
|
+
label: '五级标题',
|
78
|
+
value: 'h5'
|
79
|
+
},
|
80
|
+
{
|
81
|
+
label: '六级标题',
|
82
|
+
value: 'h6'
|
83
|
+
}
|
84
|
+
]
|
85
|
+
});
|
86
|
+
|
87
|
+
setSchemaTpl('tpl:inline', {
|
88
|
+
label: '内联模式',
|
89
|
+
type: 'switch',
|
90
|
+
name: 'inline',
|
91
|
+
mode: 'inline',
|
92
|
+
className: 'w-full',
|
93
|
+
pipeIn: defaultValue(true),
|
94
|
+
labelRemark: {
|
95
|
+
trigger: 'click',
|
96
|
+
className: 'm-l-xs',
|
97
|
+
rootClose: true,
|
98
|
+
content:
|
99
|
+
'内联模式采用 <code>span</code> 标签、非内联将采用 <code>div</code> 标签作为容器。',
|
100
|
+
placement: 'left'
|
101
|
+
}
|
102
|
+
});
|
103
|
+
|
104
|
+
export class TplPlugin extends BasePlugin {
|
105
|
+
// 关联渲染器名字
|
106
|
+
rendererName = 'tpl';
|
107
|
+
$schema = '/schemas/TplSchema.json';
|
108
|
+
|
109
|
+
// 组件名称
|
110
|
+
name = '文字';
|
111
|
+
isBaseComponent = true;
|
112
|
+
icon = 'fa fa-file-o';
|
113
|
+
description = '用来展示文字或者段落,支持模板语法可用来关联动态数据。';
|
114
|
+
docLink = '/amis/zh-CN/components/tpl';
|
115
|
+
tags = ['展示'];
|
116
|
+
previewSchema = {
|
117
|
+
type: 'tpl',
|
118
|
+
tpl: '这是模板内容当前时间<%- new Date() %>'
|
119
|
+
};
|
120
|
+
scaffold: any = {
|
121
|
+
type: 'tpl',
|
122
|
+
tpl: '请编辑内容',
|
123
|
+
inline: false
|
124
|
+
};
|
125
|
+
|
126
|
+
panelTitle = '文字';
|
127
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
128
|
+
// 在表格/CRUD/模型列表的一列里边
|
129
|
+
const isInTable: boolean = /\/cell\/field\/tpl$/.test(context.path);
|
130
|
+
|
131
|
+
return [
|
132
|
+
getSchemaTpl('tabs', [
|
133
|
+
{
|
134
|
+
title: '常规',
|
135
|
+
body: [
|
136
|
+
getSchemaTpl('tpl:content'),
|
137
|
+
!isInTable ? getSchemaTpl('tpl:wrapperComponent') : null
|
138
|
+
]
|
139
|
+
},
|
140
|
+
{
|
141
|
+
title: '外观',
|
142
|
+
body: [
|
143
|
+
getSchemaTpl('tpl:inline'),
|
144
|
+
getSchemaTpl('className'),
|
145
|
+
getSchemaTpl('style')
|
146
|
+
]
|
147
|
+
},
|
148
|
+
{
|
149
|
+
title: '显隐',
|
150
|
+
body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
|
151
|
+
}
|
152
|
+
])
|
153
|
+
];
|
154
|
+
};
|
155
|
+
|
156
|
+
popOverBody = [
|
157
|
+
getSchemaTpl('tpl:content'),
|
158
|
+
getSchemaTpl('tpl:wrapperComponent')
|
159
|
+
];
|
160
|
+
}
|
161
|
+
|
162
|
+
registerEditorPlugin(TplPlugin);
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import {Button, SchemaObject} from 'amis';
|
2
|
+
import React from 'react';
|
3
|
+
import {registerEditorPlugin} from '../manager';
|
4
|
+
import {BasePlugin, RegionConfig, RendererInfo} from '../plugin';
|
5
|
+
import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
|
6
|
+
import {JSONPipeOut} from '../util';
|
7
|
+
import {mockValue} from '../mocker';
|
8
|
+
|
9
|
+
export class VideoPlugin extends BasePlugin {
|
10
|
+
// 关联渲染器名字
|
11
|
+
rendererName = 'video';
|
12
|
+
$schema = '/schemas/VideoSchema.json';
|
13
|
+
|
14
|
+
// 组件名称
|
15
|
+
name = '视频';
|
16
|
+
isBaseComponent = true;
|
17
|
+
description = '视频控件,可以用来播放各种视频文件,包括 flv 和 hls 格式。';
|
18
|
+
docLink = '/amis/zh-CN/components/video';
|
19
|
+
tags = ['功能'];
|
20
|
+
icon = 'fa fa-video-camera';
|
21
|
+
scaffold = {
|
22
|
+
type: 'video',
|
23
|
+
autoPlay: false,
|
24
|
+
src: 'https://media.w3.org/2010/05/sintel/trailer_hd.mp4',
|
25
|
+
poster: mockValue({type: 'image'})
|
26
|
+
};
|
27
|
+
previewSchema = {
|
28
|
+
...this.scaffold
|
29
|
+
};
|
30
|
+
|
31
|
+
panelTitle = '视频';
|
32
|
+
panelBody = [
|
33
|
+
getSchemaTpl('tabs', [
|
34
|
+
{
|
35
|
+
title: '常规',
|
36
|
+
body: [
|
37
|
+
{
|
38
|
+
name: 'src',
|
39
|
+
type: 'input-text',
|
40
|
+
label: '视频地址',
|
41
|
+
description:
|
42
|
+
'可以写静态值,也可以用变量取比如:<code>\\${videoSrc}</code>'
|
43
|
+
},
|
44
|
+
|
45
|
+
{
|
46
|
+
name: 'poster',
|
47
|
+
type: 'input-text',
|
48
|
+
label: '视频封面图片地址',
|
49
|
+
description:
|
50
|
+
'可以写静态值,也可以用变量取比如:<code>\\${videoPoster}</code>'
|
51
|
+
},
|
52
|
+
|
53
|
+
{
|
54
|
+
name: 'autoPlay',
|
55
|
+
type: 'switch',
|
56
|
+
mode: 'inline',
|
57
|
+
className: 'block',
|
58
|
+
label: '自动播放'
|
59
|
+
},
|
60
|
+
|
61
|
+
{
|
62
|
+
name: 'muted',
|
63
|
+
type: 'switch',
|
64
|
+
mode: 'inline',
|
65
|
+
className: 'block',
|
66
|
+
label: '静音'
|
67
|
+
},
|
68
|
+
|
69
|
+
{
|
70
|
+
name: 'isLive',
|
71
|
+
type: 'switch',
|
72
|
+
mode: 'inline',
|
73
|
+
className: 'block',
|
74
|
+
label: '直播流',
|
75
|
+
description: '如果是直播流,请勾选,否则有可能不能正常播放。'
|
76
|
+
}
|
77
|
+
]
|
78
|
+
},
|
79
|
+
{
|
80
|
+
title: '外观',
|
81
|
+
body: [
|
82
|
+
{
|
83
|
+
name: 'aspectRatio',
|
84
|
+
label: '视频比例',
|
85
|
+
type: 'button-group-select',
|
86
|
+
size: 'sm',
|
87
|
+
mode: 'inline',
|
88
|
+
className: 'block',
|
89
|
+
value: 'auto',
|
90
|
+
options: [
|
91
|
+
{
|
92
|
+
label: '自动',
|
93
|
+
value: 'auto'
|
94
|
+
},
|
95
|
+
|
96
|
+
{
|
97
|
+
label: '4:3',
|
98
|
+
value: '4:3'
|
99
|
+
},
|
100
|
+
|
101
|
+
{
|
102
|
+
label: '16:9',
|
103
|
+
value: '16:9'
|
104
|
+
}
|
105
|
+
]
|
106
|
+
},
|
107
|
+
|
108
|
+
{
|
109
|
+
name: 'splitPoster',
|
110
|
+
type: 'switch',
|
111
|
+
mode: 'inline',
|
112
|
+
className: 'block',
|
113
|
+
label: '分开显示封面'
|
114
|
+
},
|
115
|
+
getSchemaTpl('className')
|
116
|
+
]
|
117
|
+
},
|
118
|
+
{
|
119
|
+
title: '显隐',
|
120
|
+
body: [getSchemaTpl('visible')]
|
121
|
+
},
|
122
|
+
{
|
123
|
+
title: '其他',
|
124
|
+
body: [
|
125
|
+
getSchemaTpl('ref'),
|
126
|
+
{
|
127
|
+
type: 'input-text',
|
128
|
+
name: 'rates',
|
129
|
+
label: '视频速率',
|
130
|
+
multiple: true,
|
131
|
+
joinValues: false,
|
132
|
+
extractValue: true,
|
133
|
+
options: [0.5, 1, 1.25, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5].map(
|
134
|
+
item => ({
|
135
|
+
label: item,
|
136
|
+
value: item
|
137
|
+
})
|
138
|
+
)
|
139
|
+
},
|
140
|
+
|
141
|
+
{
|
142
|
+
name: 'frames',
|
143
|
+
type: 'input-text',
|
144
|
+
label: '视频帧信息',
|
145
|
+
description:
|
146
|
+
'比如填写:<code>\\${videoFrames}</code>会在当前作用域中查找 videoFrames 变量,如果是对象,将生成视频截图列表,点击后可跳转到对应的帧。'
|
147
|
+
}
|
148
|
+
]
|
149
|
+
}
|
150
|
+
])
|
151
|
+
];
|
152
|
+
|
153
|
+
filterProps(props: any) {
|
154
|
+
props.frames = JSONPipeOut(props.frames);
|
155
|
+
|
156
|
+
return props;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
registerEditorPlugin(VideoPlugin);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import {Button, SchemaObject, utils} from 'amis';
|
2
|
+
import React from 'react';
|
3
|
+
import {registerEditorPlugin} from '../manager';
|
4
|
+
import {BasePlugin, RegionConfig, RendererInfo} from '../plugin';
|
5
|
+
import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
|
6
|
+
import '@webcomponents/webcomponentsjs/custom-elements-es5-adapter';
|
7
|
+
|
8
|
+
// 需要一个示例,不然默认的没有高度都无法选中
|
9
|
+
class WebComponentDemo extends HTMLElement {
|
10
|
+
connectedCallback() {
|
11
|
+
const shadow = this.attachShadow({mode: 'open'});
|
12
|
+
shadow.textContent = 'web-component-demo';
|
13
|
+
}
|
14
|
+
}
|
15
|
+
try {
|
16
|
+
customElements.define('web-component-demo', WebComponentDemo);
|
17
|
+
} catch (error: any) {
|
18
|
+
console.log('[amis-editor]', error);
|
19
|
+
}
|
20
|
+
|
21
|
+
export class WebComponentPlugin extends BasePlugin {
|
22
|
+
// 关联渲染器名字
|
23
|
+
rendererName = 'web-component';
|
24
|
+
$schema = '/schemas/WebComponentSchema.json';
|
25
|
+
|
26
|
+
// 组件名称
|
27
|
+
name = 'Web Component';
|
28
|
+
isBaseComponent = true;
|
29
|
+
description = '用于渲染 Web Component 组件';
|
30
|
+
docLink = '/amis/zh-CN/components/web-component';
|
31
|
+
tags = ['容器'];
|
32
|
+
icon = 'fa fa-square-o';
|
33
|
+
scaffold = {
|
34
|
+
type: 'web-component',
|
35
|
+
tag: 'web-component-demo'
|
36
|
+
};
|
37
|
+
previewSchema = {
|
38
|
+
...this.scaffold
|
39
|
+
};
|
40
|
+
|
41
|
+
panelTitle = '包裹';
|
42
|
+
panelBody = [
|
43
|
+
{
|
44
|
+
type: 'input-text',
|
45
|
+
label: '标签',
|
46
|
+
name: 'tag'
|
47
|
+
},
|
48
|
+
{
|
49
|
+
type: 'input-kv',
|
50
|
+
label: '属性',
|
51
|
+
name: 'props'
|
52
|
+
}
|
53
|
+
];
|
54
|
+
}
|
55
|
+
|
56
|
+
registerEditorPlugin(WebComponentPlugin);
|