amis-saas-9107 [Improvement.] 测试:【组件优化第六批】图片展示image组件下的图片标题建议放在缩略图上方(可优化)

Change-Id: I929eac8cef4382b5c58c783b8ff8aff2dfd885b5
This commit is contained in:
jinye 2023-01-04 10:13:08 +08:00
parent 892e18859c
commit 3063dd759b
2 changed files with 54 additions and 56 deletions

View File

@ -6,7 +6,7 @@ import {
PluginEvent, PluginEvent,
ResizeMoveEventContext ResizeMoveEventContext
} from 'amis-editor-core'; } from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {defaultValue, getSchemaTpl, tipedLabel} from 'amis-editor-core';
import {mockValue} from 'amis-editor-core'; import {mockValue} from 'amis-editor-core';
export class ImagePlugin extends BasePlugin { export class ImagePlugin extends BasePlugin {
@ -87,31 +87,12 @@ export class ImagePlugin extends BasePlugin {
label: '缩略图地址', label: '缩略图地址',
description: '如果已绑定字段名,可以不用设置,支持用变量。' description: '如果已绑定字段名,可以不用设置,支持用变量。'
}), }),
{
type: 'input-text',
label: '打开外部链接',
name: 'href'
},
getSchemaTpl('imageUrl', {
name: 'defaultImage',
label: '无数据时显示的图片'
})
]
},
getSchemaTpl('status')
])
},
{
title: '外观',
body: getSchemaTpl('collapseGroup', [
{
title: '基本',
body: [
{ {
type: 'ae-switch-more', type: 'ae-switch-more',
mode: 'normal', mode: 'normal',
name: 'enlargeAble', name: 'enlargeAble',
label: '图片放大功能', label: tipedLabel(
'图片放大功能', '放大功能和打开外部链接功能是冲突的,若要点击时打开外部链接请先关闭此功能'),
value: false, value: false,
hiddenOnDefault: false, hiddenOnDefault: false,
formType: 'extend', formType: 'extend',
@ -126,16 +107,44 @@ export class ImagePlugin extends BasePlugin {
] ]
} }
}, },
{
getSchemaTpl('switch', { type: 'input-text',
name: 'showDimensions', label: '打开外部链接',
label: '显示图片尺寸' name: 'href',
}), hiddenOn: "this.enlargeAble",
clearValueOnHidden: true
},
getSchemaTpl('imageUrl', {
name: 'defaultImage',
label: tipedLabel('占位图', '无数据时显示的图片')
})
]
},
getSchemaTpl('status')
])
},
{
title: '外观',
body: getSchemaTpl('collapseGroup', [
{
title: '基本',
body: [
// amis 已废弃
// getSchemaTpl('switch', {
// name: 'showDimensions',
// label: '显示图片尺寸'
// }),
{ {
name: 'thumbMode', name: 'thumbMode',
type: 'select', type: 'select',
label: '缩略图展示模式', label: '缩略图展示模式',
mode: 'horizontal',
labelAlign: 'left',
horizontal: {
left: 5,
right: 7
},
pipeIn: defaultValue('contain'), pipeIn: defaultValue('contain'),
options: [ options: [
{ {

View File

@ -1,6 +1,6 @@
import {registerEditorPlugin} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core';
import {BaseEventContext, BasePlugin} from 'amis-editor-core'; import {BaseEventContext, BasePlugin} from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {defaultValue, getSchemaTpl, tipedLabel} from 'amis-editor-core';
import {mockValue} from 'amis-editor-core'; import {mockValue} from 'amis-editor-core';
export class ImagesPlugin extends BasePlugin { export class ImagesPlugin extends BasePlugin {
@ -120,11 +120,15 @@ export class ImagesPlugin extends BasePlugin {
name: 'caption' name: 'caption'
} }
] ]
} },
getSchemaTpl('switch', {
name: 'enlargeAble',
label: '图片放大功能'
})
]).concat([ ]).concat([
getSchemaTpl('imageUrl', { getSchemaTpl('imageUrl', {
name: 'defaultImage', name: 'defaultImage',
label: '无数据时显示的图片' label: tipedLabel('占位图', '无数据时显示的图片')
}) })
]) ])
}, },
@ -137,37 +141,22 @@ export class ImagesPlugin extends BasePlugin {
{ {
title: '基本', title: '基本',
body: [ body: [
{ // 已废弃
type: 'ae-switch-more', // getSchemaTpl('switch', {
mode: 'normal', // name: 'showDimensions',
name: 'enlargeAble', // label: '显示图片尺寸'
label: '图片放大功能', // }),
value: false,
hiddenOnDefault: false,
formType: 'extend',
pipeIn: (value: any) => !!value,
form: {
body: [
{
name: 'originalSrc',
visibleOn: 'this.enlargeAble',
type: 'input-text',
label: '原图地址',
description: '如果不配置将默认使用缩略图地址。'
}
]
}
},
getSchemaTpl('switch', {
name: 'showDimensions',
label: '显示图片尺寸'
}),
{ {
name: 'thumbMode', name: 'thumbMode',
type: 'select', type: 'select',
label: '缩略图展示模式', label: '缩略图展示模式',
mode: 'horizontal',
labelAlign: 'left',
horizontal: {
left: 5,
right: 7
},
pipeIn: defaultValue('contain'), pipeIn: defaultValue('contain'),
options: [ options: [
{ {