amis-editor 4.1.0-beta.4 → 4.2.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. package/dist/component/Breadcrumb.d.ts +23 -2
  2. package/dist/component/ClassNameControl.d.ts +1 -1
  3. package/dist/component/Control/APIControl.d.ts +2 -2
  4. package/dist/component/Control/OptionControl.d.ts +3 -3
  5. package/dist/component/Control/PopoverEdit.d.ts +4 -4
  6. package/dist/component/Control/ValidationControl.d.ts +1 -1
  7. package/dist/component/Editor.d.ts +20 -1
  8. package/dist/component/IFramePreview.d.ts +2 -1
  9. package/dist/component/NodeWrapper.d.ts +1 -1
  10. package/dist/component/Panel/RenderersPanel.d.ts +1 -2
  11. package/dist/component/Preview.d.ts +3 -1
  12. package/dist/component/RegionWrapper.d.ts +4 -0
  13. package/dist/component/ScaffoldModal.d.ts +1 -1
  14. package/dist/component/VRenderer.d.ts +4 -0
  15. package/dist/component/base/InputComponentName.d.ts +1 -1
  16. package/dist/component/base/SearchCustomRendererPanel.d.ts +15 -0
  17. package/dist/component/base/SearchPanel.d.ts +83 -0
  18. package/dist/component/base/SearchRendererPanel.d.ts +2 -42
  19. package/dist/component/base/ShortcutKey.d.ts +23 -0
  20. package/dist/env.d.ts +1 -1
  21. package/dist/exports.min.js +1 -1
  22. package/dist/index.d.ts +5 -1
  23. package/dist/index.min.js +1 -1
  24. package/dist/manager.d.ts +16 -4
  25. package/dist/plugin/Alert.d.ts +1 -1
  26. package/dist/plugin/Button.d.ts +1 -1
  27. package/dist/plugin/Card.d.ts +1 -0
  28. package/dist/plugin/Cards.d.ts +2 -1
  29. package/dist/plugin/Carousel.d.ts +1 -0
  30. package/dist/plugin/Chart.d.ts +1 -0
  31. package/dist/plugin/Collapse.d.ts +1 -0
  32. package/dist/plugin/Custom.d.ts +3 -0
  33. package/dist/plugin/CustomRegion.d.ts +40 -0
  34. package/dist/plugin/Dialog.d.ts +1 -1
  35. package/dist/plugin/Drawer.d.ts +1 -1
  36. package/dist/plugin/DropDownButton.d.ts +1 -1
  37. package/dist/plugin/Each.d.ts +1 -1
  38. package/dist/plugin/Flex.d.ts +1 -0
  39. package/dist/plugin/Form/Control.d.ts +1 -0
  40. package/dist/plugin/Form/Form.d.ts +19 -3
  41. package/dist/plugin/Form/Formula.d.ts +3 -3
  42. package/dist/plugin/Form/InputURL.d.ts +1 -0
  43. package/dist/plugin/Form/Switch.d.ts +2 -0
  44. package/dist/plugin/Grid.d.ts +1 -0
  45. package/dist/plugin/HBox.d.ts +1 -0
  46. package/dist/plugin/IFrame.d.ts +3 -3
  47. package/dist/plugin/Json.d.ts +1 -0
  48. package/dist/plugin/List.d.ts +2 -1
  49. package/dist/plugin/Mapping.d.ts +1 -0
  50. package/dist/plugin/Markdown.d.ts +1 -0
  51. package/dist/plugin/Nav.d.ts +1 -0
  52. package/dist/plugin/Page.d.ts +1 -1
  53. package/dist/plugin/Panel/Outline.d.ts +8 -0
  54. package/dist/plugin/Progress.d.ts +1 -0
  55. package/dist/plugin/QRCode.d.ts +1 -0
  56. package/dist/plugin/Reset.d.ts +0 -1
  57. package/dist/plugin/Service.d.ts +1 -0
  58. package/dist/plugin/Sparkline.d.ts +1 -0
  59. package/dist/plugin/Status.d.ts +1 -0
  60. package/dist/plugin/Steps.d.ts +1 -0
  61. package/dist/plugin/Submit.d.ts +0 -1
  62. package/dist/plugin/Table.d.ts +1 -1
  63. package/dist/plugin/TableView.d.ts +1 -0
  64. package/dist/plugin/Tasks.d.ts +1 -0
  65. package/dist/plugin/TooltipWrapper.d.ts +1 -0
  66. package/dist/plugin/Video.d.ts +1 -0
  67. package/dist/plugin/WebComponent.d.ts +1 -0
  68. package/dist/plugin/Wizard.d.ts +11 -2
  69. package/dist/plugin/Wrapper.d.ts +1 -0
  70. package/dist/plugin.d.ts +8 -7
  71. package/dist/store/editor.d.ts +58 -22
  72. package/dist/store/node.d.ts +6 -0
  73. package/dist/style.css +1 -1
  74. package/dist/util.d.ts +1 -1
  75. package/package.json +9 -3
  76. package/src/component/schemaTpl.tsx +2157 -0
  77. package/src/plugin/Alert.tsx +87 -0
  78. package/src/plugin/AnchorNav.tsx +233 -0
  79. package/src/plugin/Audio.tsx +154 -0
  80. package/src/plugin/Avatar.tsx +77 -0
  81. package/src/plugin/Breadcrumb.tsx +107 -0
  82. package/src/plugin/Button.tsx +281 -0
  83. package/src/plugin/ButtonGroup.tsx +85 -0
  84. package/src/plugin/ButtonToolbar.tsx +87 -0
  85. package/src/plugin/CRUD.tsx +1835 -0
  86. package/src/plugin/Card.tsx +290 -0
  87. package/src/plugin/Cards.tsx +318 -0
  88. package/src/plugin/Carousel.tsx +377 -0
  89. package/src/plugin/Chart.tsx +218 -0
  90. package/src/plugin/CodeView.tsx +60 -0
  91. package/src/plugin/Collapse.tsx +136 -0
  92. package/src/plugin/CollapseGroup.tsx +167 -0
  93. package/src/plugin/Container.tsx +40 -0
  94. package/src/plugin/Custom.tsx +128 -0
  95. package/src/plugin/CustomRegion.tsx +156 -0
  96. package/src/plugin/Date.tsx +74 -0
  97. package/src/plugin/Datetime.tsx +68 -0
  98. package/src/plugin/Dialog.tsx +176 -0
  99. package/src/plugin/Divider.tsx +36 -0
  100. package/src/plugin/Drawer.tsx +214 -0
  101. package/src/plugin/DropDownButton.tsx +235 -0
  102. package/src/plugin/Each.tsx +150 -0
  103. package/src/plugin/ErrorRenderer.tsx +15 -0
  104. package/src/plugin/Flex.tsx +151 -0
  105. package/src/plugin/Form/ButtonGroupSelect.tsx +75 -0
  106. package/src/plugin/Form/ButtonToolbar.tsx +110 -0
  107. package/src/plugin/Form/ChainedSelect.tsx +70 -0
  108. package/src/plugin/Form/Checkbox.tsx +87 -0
  109. package/src/plugin/Form/Checkboxes.tsx +167 -0
  110. package/src/plugin/Form/CodeEditor.tsx +81 -0
  111. package/src/plugin/Form/Combo.tsx +582 -0
  112. package/src/plugin/Form/ConditionBuilder.tsx +315 -0
  113. package/src/plugin/Form/Control.tsx +139 -0
  114. package/src/plugin/Form/DiffEditor.tsx +111 -0
  115. package/src/plugin/Form/FieldSet.tsx +163 -0
  116. package/src/plugin/Form/Form.tsx +687 -0
  117. package/src/plugin/Form/Formula.tsx +79 -0
  118. package/src/plugin/Form/Group.tsx +295 -0
  119. package/src/plugin/Form/Hidden.tsx +44 -0
  120. package/src/plugin/Form/InputArray.tsx +228 -0
  121. package/src/plugin/Form/InputCity.tsx +93 -0
  122. package/src/plugin/Form/InputColor.tsx +123 -0
  123. package/src/plugin/Form/InputDate.tsx +175 -0
  124. package/src/plugin/Form/InputDateRange.tsx +225 -0
  125. package/src/plugin/Form/InputDateTime.tsx +183 -0
  126. package/src/plugin/Form/InputDateTimeRange.tsx +221 -0
  127. package/src/plugin/Form/InputEmail.tsx +33 -0
  128. package/src/plugin/Form/InputExcel.tsx +85 -0
  129. package/src/plugin/Form/InputFile.tsx +221 -0
  130. package/src/plugin/Form/InputGroup.tsx +96 -0
  131. package/src/plugin/Form/InputImage.tsx +266 -0
  132. package/src/plugin/Form/InputKV.tsx +72 -0
  133. package/src/plugin/Form/InputMonth.tsx +35 -0
  134. package/src/plugin/Form/InputMonthRange.tsx +195 -0
  135. package/src/plugin/Form/InputNumber.tsx +89 -0
  136. package/src/plugin/Form/InputPassword.tsx +33 -0
  137. package/src/plugin/Form/InputQuarter.tsx +35 -0
  138. package/src/plugin/Form/InputQuarterRange.tsx +195 -0
  139. package/src/plugin/Form/InputRange.tsx +121 -0
  140. package/src/plugin/Form/InputRating.tsx +78 -0
  141. package/src/plugin/Form/InputRepeat.tsx +57 -0
  142. package/src/plugin/Form/InputRichText.tsx +186 -0
  143. package/src/plugin/Form/InputSubForm.tsx +189 -0
  144. package/src/plugin/Form/InputTable.tsx +434 -0
  145. package/src/plugin/Form/InputTag.tsx +70 -0
  146. package/src/plugin/Form/InputText.tsx +186 -0
  147. package/src/plugin/Form/InputTime.tsx +85 -0
  148. package/src/plugin/Form/InputTree.tsx +229 -0
  149. package/src/plugin/Form/InputURL.tsx +34 -0
  150. package/src/plugin/Form/InputYear.tsx +35 -0
  151. package/src/plugin/Form/Item.tsx +327 -0
  152. package/src/plugin/Form/ListSelect.tsx +73 -0
  153. package/src/plugin/Form/LocationPicker.tsx +62 -0
  154. package/src/plugin/Form/MatrixCheckboxes.tsx +136 -0
  155. package/src/plugin/Form/NestedSelect.tsx +211 -0
  156. package/src/plugin/Form/Picker.tsx +209 -0
  157. package/src/plugin/Form/Radios.tsx +119 -0
  158. package/src/plugin/Form/Select.tsx +233 -0
  159. package/src/plugin/Form/Static.tsx +322 -0
  160. package/src/plugin/Form/Switch.tsx +107 -0
  161. package/src/plugin/Form/TabsTransfer.tsx +259 -0
  162. package/src/plugin/Form/Textarea.tsx +83 -0
  163. package/src/plugin/Form/Transfer.tsx +368 -0
  164. package/src/plugin/Form/TreeSelect.tsx +263 -0
  165. package/src/plugin/Form/UUID.tsx +48 -0
  166. package/src/plugin/Grid.tsx +798 -0
  167. package/src/plugin/HBox.tsx +727 -0
  168. package/src/plugin/IFrame.tsx +70 -0
  169. package/src/plugin/Image.tsx +314 -0
  170. package/src/plugin/Images.tsx +231 -0
  171. package/src/plugin/Json.tsx +69 -0
  172. package/src/plugin/Link.tsx +93 -0
  173. package/src/plugin/List.tsx +278 -0
  174. package/src/plugin/ListItem.tsx +229 -0
  175. package/src/plugin/Log.tsx +52 -0
  176. package/src/plugin/Mapping.tsx +149 -0
  177. package/src/plugin/Markdown.tsx +47 -0
  178. package/src/plugin/Nav.tsx +184 -0
  179. package/src/plugin/Operation.tsx +95 -0
  180. package/src/plugin/Others/Action.tsx +426 -0
  181. package/src/plugin/Others/BasicToolbar.tsx +585 -0
  182. package/src/plugin/Others/DataDebug.tsx +134 -0
  183. package/src/plugin/Others/TableCell.tsx +480 -0
  184. package/src/plugin/Others/Unknown.tsx +37 -0
  185. package/src/plugin/Page.tsx +306 -0
  186. package/src/plugin/Panel/AvailableRenderers.tsx +41 -0
  187. package/src/plugin/Panel/Code.tsx +44 -0
  188. package/src/plugin/Panel/Name.tsx +26 -0
  189. package/src/plugin/Panel/Outline.tsx +40 -0
  190. package/src/plugin/Panel.tsx +243 -0
  191. package/src/plugin/Plain.tsx +84 -0
  192. package/src/plugin/Progress.tsx +125 -0
  193. package/src/plugin/Property.tsx +139 -0
  194. package/src/plugin/QRCode.tsx +96 -0
  195. package/src/plugin/Reset.tsx +23 -0
  196. package/src/plugin/Service.tsx +162 -0
  197. package/src/plugin/Sparkline.tsx +40 -0
  198. package/src/plugin/Status.tsx +76 -0
  199. package/src/plugin/Steps.tsx +128 -0
  200. package/src/plugin/Submit.tsx +23 -0
  201. package/src/plugin/Table.tsx +428 -0
  202. package/src/plugin/TableView.tsx +709 -0
  203. package/src/plugin/Tabs.tsx +362 -0
  204. package/src/plugin/Tasks.tsx +274 -0
  205. package/src/plugin/Time.tsx +68 -0
  206. package/src/plugin/TooltipWrapper.tsx +193 -0
  207. package/src/plugin/Tpl.tsx +158 -0
  208. package/src/plugin/Video.tsx +158 -0
  209. package/src/plugin/WebComponent.tsx +53 -0
  210. package/src/plugin/Wizard.tsx +740 -0
  211. package/src/plugin/Wrapper.tsx +107 -0
  212. package/src/plugin.ts +1050 -0
  213. package/dist/150a58f3318ca7541ed9.png +0 -0
  214. package/dist/471adb97c322b226e589.png +0 -0
  215. package/dist/4de5f42360bc5946c3c2.png +0 -0
  216. package/dist/4e9968bba3855f088fed.png +0 -0
  217. package/dist/7f09c38ebc687fea847a.png +0 -0
  218. 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);