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.
Files changed (195) hide show
  1. package/dist/component/Breadcrumb.d.ts +23 -2
  2. package/dist/component/Editor.d.ts +19 -0
  3. package/dist/component/Panel/RenderersPanel.d.ts +1 -2
  4. package/dist/component/RegionWrapper.d.ts +15 -8
  5. package/dist/component/RendererThumb.d.ts +5 -5
  6. package/dist/component/VRenderer.d.ts +5 -1
  7. package/dist/component/base/SearchCustomRendererPanel.d.ts +15 -0
  8. package/dist/component/base/SearchPanel.d.ts +83 -0
  9. package/dist/component/base/SearchRendererPanel.d.ts +3 -43
  10. package/dist/exports.min.js +1 -1
  11. package/dist/index.d.ts +4 -1
  12. package/dist/index.min.js +1 -1
  13. package/dist/manager.d.ts +14 -3
  14. package/dist/plugin/Card.d.ts +1 -0
  15. package/dist/plugin/Cards.d.ts +1 -0
  16. package/dist/plugin/Carousel.d.ts +1 -0
  17. package/dist/plugin/Chart.d.ts +1 -0
  18. package/dist/plugin/Collapse.d.ts +1 -0
  19. package/dist/plugin/Custom.d.ts +3 -0
  20. package/dist/plugin/CustomRegion.d.ts +43 -0
  21. package/dist/plugin/Flex.d.ts +1 -0
  22. package/dist/plugin/Form/Control.d.ts +1 -0
  23. package/dist/plugin/Form/InputURL.d.ts +1 -0
  24. package/dist/plugin/Grid.d.ts +1 -0
  25. package/dist/plugin/HBox.d.ts +1 -0
  26. package/dist/plugin/Json.d.ts +1 -0
  27. package/dist/plugin/List.d.ts +1 -0
  28. package/dist/plugin/Mapping.d.ts +1 -0
  29. package/dist/plugin/Markdown.d.ts +1 -0
  30. package/dist/plugin/Nav.d.ts +1 -0
  31. package/dist/plugin/Panel/Outline.d.ts +8 -0
  32. package/dist/plugin/Progress.d.ts +1 -0
  33. package/dist/plugin/QRCode.d.ts +1 -0
  34. package/dist/plugin/Reset.d.ts +0 -1
  35. package/dist/plugin/Service.d.ts +1 -0
  36. package/dist/plugin/Sparkline.d.ts +1 -0
  37. package/dist/plugin/Status.d.ts +1 -0
  38. package/dist/plugin/Steps.d.ts +1 -0
  39. package/dist/plugin/Submit.d.ts +0 -1
  40. package/dist/plugin/TableView.d.ts +1 -0
  41. package/dist/plugin/Tasks.d.ts +1 -0
  42. package/dist/plugin/TooltipWrapper.d.ts +2 -0
  43. package/dist/plugin/Video.d.ts +1 -0
  44. package/dist/plugin/WebComponent.d.ts +1 -0
  45. package/dist/plugin/Wrapper.d.ts +1 -0
  46. package/dist/plugin.d.ts +2 -2
  47. package/dist/store/editor.d.ts +20 -2
  48. package/dist/store/node.d.ts +6 -0
  49. package/dist/style.css +1 -1
  50. package/dist/util.d.ts +7 -2
  51. package/package.json +6 -3
  52. package/src/component/schemaTpl.tsx +2155 -0
  53. package/src/plugin/.DS_Store +0 -0
  54. package/src/plugin/Alert.tsx +87 -0
  55. package/src/plugin/AnchorNav.tsx +233 -0
  56. package/src/plugin/Audio.tsx +161 -0
  57. package/src/plugin/Avatar.tsx +77 -0
  58. package/src/plugin/Breadcrumb.tsx +107 -0
  59. package/src/plugin/Button.tsx +283 -0
  60. package/src/plugin/ButtonGroup.tsx +88 -0
  61. package/src/plugin/ButtonToolbar.tsx +89 -0
  62. package/src/plugin/CRUD.tsx +1832 -0
  63. package/src/plugin/Card.tsx +290 -0
  64. package/src/plugin/Cards.tsx +315 -0
  65. package/src/plugin/Carousel.tsx +386 -0
  66. package/src/plugin/Chart.tsx +218 -0
  67. package/src/plugin/CodeView.tsx +60 -0
  68. package/src/plugin/Collapse.tsx +143 -0
  69. package/src/plugin/CollapseGroup.tsx +167 -0
  70. package/src/plugin/Container.tsx +44 -0
  71. package/src/plugin/Custom.tsx +128 -0
  72. package/src/plugin/CustomRegion.tsx +150 -0
  73. package/src/plugin/Date.tsx +81 -0
  74. package/src/plugin/Datetime.tsx +75 -0
  75. package/src/plugin/Dialog.tsx +178 -0
  76. package/src/plugin/Divider.tsx +36 -0
  77. package/src/plugin/Drawer.tsx +217 -0
  78. package/src/plugin/DropDownButton.tsx +234 -0
  79. package/src/plugin/Each.tsx +152 -0
  80. package/src/plugin/ErrorRenderer.tsx +15 -0
  81. package/src/plugin/Flex.tsx +156 -0
  82. package/src/plugin/Form/ButtonGroupSelect.tsx +86 -0
  83. package/src/plugin/Form/ButtonToolbar.tsx +121 -0
  84. package/src/plugin/Form/ChainedSelect.tsx +70 -0
  85. package/src/plugin/Form/Checkbox.tsx +87 -0
  86. package/src/plugin/Form/Checkboxes.tsx +167 -0
  87. package/src/plugin/Form/CodeEditor.tsx +91 -0
  88. package/src/plugin/Form/Combo.tsx +582 -0
  89. package/src/plugin/Form/ConditionBuilder.tsx +324 -0
  90. package/src/plugin/Form/Control.tsx +139 -0
  91. package/src/plugin/Form/DiffEditor.tsx +117 -0
  92. package/src/plugin/Form/FieldSet.tsx +175 -0
  93. package/src/plugin/Form/Form.tsx +692 -0
  94. package/src/plugin/Form/Formula.tsx +91 -0
  95. package/src/plugin/Form/Group.tsx +300 -0
  96. package/src/plugin/Form/Hidden.tsx +56 -0
  97. package/src/plugin/Form/InputArray.tsx +228 -0
  98. package/src/plugin/Form/InputCity.tsx +93 -0
  99. package/src/plugin/Form/InputColor.tsx +123 -0
  100. package/src/plugin/Form/InputDate.tsx +175 -0
  101. package/src/plugin/Form/InputDateRange.tsx +225 -0
  102. package/src/plugin/Form/InputDateTime.tsx +183 -0
  103. package/src/plugin/Form/InputDateTimeRange.tsx +221 -0
  104. package/src/plugin/Form/InputEmail.tsx +33 -0
  105. package/src/plugin/Form/InputExcel.tsx +85 -0
  106. package/src/plugin/Form/InputFile.tsx +228 -0
  107. package/src/plugin/Form/InputGroup.tsx +105 -0
  108. package/src/plugin/Form/InputImage.tsx +277 -0
  109. package/src/plugin/Form/InputKV.tsx +72 -0
  110. package/src/plugin/Form/InputMonth.tsx +35 -0
  111. package/src/plugin/Form/InputMonthRange.tsx +195 -0
  112. package/src/plugin/Form/InputNumber.tsx +97 -0
  113. package/src/plugin/Form/InputPassword.tsx +33 -0
  114. package/src/plugin/Form/InputQuarter.tsx +35 -0
  115. package/src/plugin/Form/InputQuarterRange.tsx +195 -0
  116. package/src/plugin/Form/InputRange.tsx +121 -0
  117. package/src/plugin/Form/InputRating.tsx +78 -0
  118. package/src/plugin/Form/InputRepeat.tsx +69 -0
  119. package/src/plugin/Form/InputRichText.tsx +197 -0
  120. package/src/plugin/Form/InputSubForm.tsx +198 -0
  121. package/src/plugin/Form/InputTable.tsx +434 -0
  122. package/src/plugin/Form/InputTag.tsx +81 -0
  123. package/src/plugin/Form/InputText.tsx +186 -0
  124. package/src/plugin/Form/InputTime.tsx +95 -0
  125. package/src/plugin/Form/InputTree.tsx +240 -0
  126. package/src/plugin/Form/InputURL.tsx +34 -0
  127. package/src/plugin/Form/InputYear.tsx +35 -0
  128. package/src/plugin/Form/Item.tsx +325 -0
  129. package/src/plugin/Form/ListSelect.tsx +84 -0
  130. package/src/plugin/Form/LocationPicker.tsx +75 -0
  131. package/src/plugin/Form/MatrixCheckboxes.tsx +147 -0
  132. package/src/plugin/Form/NestedSelect.tsx +222 -0
  133. package/src/plugin/Form/Picker.tsx +217 -0
  134. package/src/plugin/Form/Radios.tsx +130 -0
  135. package/src/plugin/Form/Select.tsx +216 -0
  136. package/src/plugin/Form/Static.tsx +335 -0
  137. package/src/plugin/Form/Switch.tsx +116 -0
  138. package/src/plugin/Form/TabsTransfer.tsx +270 -0
  139. package/src/plugin/Form/Textarea.tsx +94 -0
  140. package/src/plugin/Form/Transfer.tsx +379 -0
  141. package/src/plugin/Form/TreeSelect.tsx +263 -0
  142. package/src/plugin/Form/UUID.tsx +48 -0
  143. package/src/plugin/Grid.tsx +799 -0
  144. package/src/plugin/HBox.tsx +727 -0
  145. package/src/plugin/IFrame.tsx +72 -0
  146. package/src/plugin/Image.tsx +318 -0
  147. package/src/plugin/Images.tsx +238 -0
  148. package/src/plugin/Json.tsx +76 -0
  149. package/src/plugin/Link.tsx +95 -0
  150. package/src/plugin/List.tsx +278 -0
  151. package/src/plugin/ListItem.tsx +233 -0
  152. package/src/plugin/Log.tsx +52 -0
  153. package/src/plugin/Mapping.tsx +156 -0
  154. package/src/plugin/Markdown.tsx +47 -0
  155. package/src/plugin/Nav.tsx +186 -0
  156. package/src/plugin/Operation.tsx +97 -0
  157. package/src/plugin/Others/Action.tsx +428 -0
  158. package/src/plugin/Others/BasicToolbar.tsx +591 -0
  159. package/src/plugin/Others/DataDebug.tsx +134 -0
  160. package/src/plugin/Others/TableCell.tsx +480 -0
  161. package/src/plugin/Others/Unknown.tsx +37 -0
  162. package/src/plugin/Page.tsx +308 -0
  163. package/src/plugin/Panel/AvailableRenderers.tsx +41 -0
  164. package/src/plugin/Panel/Code.tsx +44 -0
  165. package/src/plugin/Panel/Name.tsx +26 -0
  166. package/src/plugin/Panel/Outline.tsx +40 -0
  167. package/src/plugin/Panel.tsx +243 -0
  168. package/src/plugin/Plain.tsx +91 -0
  169. package/src/plugin/Progress.tsx +132 -0
  170. package/src/plugin/Property.tsx +139 -0
  171. package/src/plugin/QRCode.tsx +98 -0
  172. package/src/plugin/Reset.tsx +23 -0
  173. package/src/plugin/Service.tsx +167 -0
  174. package/src/plugin/Sparkline.tsx +40 -0
  175. package/src/plugin/Status.tsx +78 -0
  176. package/src/plugin/Steps.tsx +140 -0
  177. package/src/plugin/Submit.tsx +23 -0
  178. package/src/plugin/Table.tsx +440 -0
  179. package/src/plugin/TableView.tsx +711 -0
  180. package/src/plugin/Tabs.tsx +364 -0
  181. package/src/plugin/Tasks.tsx +276 -0
  182. package/src/plugin/Time.tsx +75 -0
  183. package/src/plugin/TooltipWrapper.tsx +193 -0
  184. package/src/plugin/Tpl.tsx +162 -0
  185. package/src/plugin/Video.tsx +160 -0
  186. package/src/plugin/WebComponent.tsx +56 -0
  187. package/src/plugin/Wizard.tsx +743 -0
  188. package/src/plugin/Wrapper.tsx +107 -0
  189. package/src/plugin.ts +1046 -0
  190. package/dist/150a58f3318ca7541ed9.png +0 -0
  191. package/dist/471adb97c322b226e589.png +0 -0
  192. package/dist/4de5f42360bc5946c3c2.png +0 -0
  193. package/dist/4e9968bba3855f088fed.png +0 -0
  194. package/dist/7f09c38ebc687fea847a.png +0 -0
  195. package/dist/c94073576487510314ea.png +0 -0
Binary file
@@ -0,0 +1,87 @@
1
+ import {SchemaObject} from 'amis';
2
+ import React from 'react';
3
+ import {registerEditorPlugin} from '../manager';
4
+ import {BasePlugin} from '../plugin';
5
+ import {getSchemaTpl} from '../component/schemaTpl';
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/lib/components/AnchorNav';
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,161 @@
1
+ import {Button, SchemaObject} from 'amis';
2
+ import React from 'react';
3
+ import {registerEditorPlugin} from '../manager';
4
+ import {
5
+ BaseEventContext,
6
+ BasePlugin,
7
+ RegionConfig,
8
+ RendererInfo
9
+ } from '../plugin';
10
+ import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
11
+
12
+ export class AudioPlugin extends BasePlugin {
13
+ // 关联渲染器名字
14
+ rendererName = 'audio';
15
+ $schema = '/schemas/AudioSchema.json';
16
+
17
+ // 组件名称
18
+ name = '音频';
19
+ isBaseComponent = true;
20
+ description = '音频控件,可以用来播放各种音频文件。';
21
+ tags = ['功能'];
22
+ icon = 'fa fa-music';
23
+ scaffold = {
24
+ type: 'audio',
25
+ autoPlay: false,
26
+ src: ''
27
+ };
28
+ previewSchema = {
29
+ ...this.scaffold
30
+ };
31
+
32
+ panelTitle = '音频';
33
+ panelBodyCreator = (context: BaseEventContext) => {
34
+ const isUnderField = /\/field\/\w+$/.test(context.path as string);
35
+ return [
36
+ getSchemaTpl('tabs', [
37
+ {
38
+ title: '常规',
39
+ body: [
40
+ isUnderField
41
+ ? {
42
+ type: 'tpl',
43
+ inline: false,
44
+ className: 'text-info text-sm',
45
+ tpl: '<p>当前为字段内容节点配置,选择上层还有更多的配置。</p>'
46
+ }
47
+ : null,
48
+ {
49
+ name: 'src',
50
+ type: 'input-text',
51
+ label: '音频地址',
52
+ description: '支持获取变量如:<code>\\${audioSrc}</code>'
53
+ },
54
+ {
55
+ type: 'select',
56
+ name: 'rates',
57
+ label: '音频倍速',
58
+ description: '加速范围在0.1到16之间',
59
+ multiple: true,
60
+ pipeIn: (value: any) =>
61
+ Array.isArray(value) ? value.join(',') : [],
62
+ pipeOut: (value: any) => {
63
+ if (value && value.length) {
64
+ let rates = value.split(',');
65
+ rates = rates
66
+ .filter(
67
+ (x: string | number) =>
68
+ Number(x) && Number(x) > 0 && Number(x) <= 16
69
+ )
70
+ .map((x: string | number) => Number(Number(x).toFixed(1)));
71
+ return Array.from(new Set(rates));
72
+ } else {
73
+ return [];
74
+ }
75
+ },
76
+ options: ['0.5', '1', '1.5', '2', '2.5', '3', '3.5', '4']
77
+ },
78
+ {
79
+ name: 'controls',
80
+ type: 'select',
81
+ label: '内部控件',
82
+ multiple: true,
83
+ extractValue: true,
84
+ joinValues: false,
85
+ options: [
86
+ {
87
+ label: '倍速',
88
+ value: 'rates'
89
+ },
90
+ {
91
+ label: '播放',
92
+ value: 'play'
93
+ },
94
+ {
95
+ label: '时间',
96
+ value: 'time'
97
+ },
98
+ {
99
+ label: '进度',
100
+ value: 'process'
101
+ },
102
+ {
103
+ label: '音量',
104
+ value: 'volume'
105
+ }
106
+ ],
107
+ pipeIn: defaultValue([
108
+ 'rates',
109
+ 'play',
110
+ 'time',
111
+ 'process',
112
+ 'volume'
113
+ ]),
114
+ labelRemark: {
115
+ trigger: 'click',
116
+ className: 'm-l-xs',
117
+ rootClose: true,
118
+ content: '选择倍速后,还需要在常规选择栏中配置倍速',
119
+ placement: 'left'
120
+ }
121
+ },
122
+ {
123
+ name: 'autoPlay',
124
+ type: 'switch',
125
+ mode: 'inline',
126
+ className: 'w-full',
127
+ label: '自动播放'
128
+ },
129
+ {
130
+ name: 'loop',
131
+ type: 'switch',
132
+ mode: 'inline',
133
+ className: 'w-full',
134
+ label: '循环播放'
135
+ }
136
+ ]
137
+ },
138
+ {
139
+ title: '外观',
140
+ body: [
141
+ getSchemaTpl('className'),
142
+ {
143
+ name: 'inline',
144
+ type: 'switch',
145
+ mode: 'inline',
146
+ className: 'w-full',
147
+ label: '内联模式',
148
+ pipeIn: defaultValue(true)
149
+ }
150
+ ]
151
+ },
152
+ {
153
+ title: '显隐',
154
+ body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
155
+ }
156
+ ])
157
+ ];
158
+ };
159
+ }
160
+
161
+ 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);