MCPcopy
hub / github.com/baidu/amis / ImagesPlugin

Class ImagesPlugin

packages/amis-editor/src/plugin/Images.tsx:6–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import {mockValue} from 'amis-editor-core';
5
6export class ImagesPlugin extends BasePlugin {
7 static id = 'ImagesPlugin';
8 static scene = ['layout'];
9 // 关联渲染器名字
10 rendererName = 'images';
11 $schema = '/schemas/ImagesSchema.json';
12
13 // 组件名称
14 name = '图片集';
15 isBaseComponent = true;
16 description = '展示多张图片';
17 docLink = '/amis/zh-CN/components/images';
18 tags = ['展示'];
19 icon = 'fa fa-clone';
20 pluginIcon = 'images-plugin';
21 scaffold = {
22 type: 'images',
23 imageGallaryClassName: 'app-popover :AMISCSSWrapper',
24 displayMode: 'thumb' // 默认缩略图模式
25 };
26 previewSchema = {
27 ...this.scaffold,
28 listClassName: 'nowrap',
29 thumbMode: 'cover',
30 value: [
31 {
32 title: '图片1',
33 image: mockValue({type: 'image'}),
34 src: mockValue({type: 'image'})
35 },
36 {
37 title: '图片2',
38 image: mockValue({type: 'image'}),
39 src: mockValue({type: 'image'})
40 }
41 ]
42 };
43
44 panelTitle = '图片集';
45 panelJustify = true;
46 panelBodyCreator = (context: BaseEventContext) => {
47 const isUnderField = /\/field\/\w+$/.test(context.path as string);
48 const i18nEnabled = getI18nEnabled();
49 return getSchemaTpl('tabs', [
50 {
51 title: '属性',
52 body: getSchemaTpl('collapseGroup', [
53 {
54 title: '基本',
55 body: (isUnderField
56 ? []
57 : [
58 {
59 type: 'formula',
60 name: '__mode',
61 autoSet: false,
62 formula:
63 '!this.name && !this.source && Array.isArray(this.options) ? 2 : 1'

Callers

nothing calls this directly

Calls 5

mockValueFunction · 0.90
getI18nEnabledFunction · 0.90
getSchemaTplFunction · 0.90
tipedLabelFunction · 0.90
defaultValueFunction · 0.90

Tested by

no test coverage detected