From 3063dd759b4fc1a476cb0ee70868f4cf43843973 Mon Sep 17 00:00:00 2001 From: jinye Date: Wed, 4 Jan 2023 10:13:08 +0800 Subject: [PATCH] =?UTF-8?q?amis-saas-9107=20[Improvement.]=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=EF=BC=9A=E3=80=90=E7=BB=84=E4=BB=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=AC=AC=E5=85=AD=E6=89=B9=E3=80=91=E5=9B=BE=E7=89=87=E5=B1=95?= =?UTF-8?q?=E7=A4=BAimage=E7=BB=84=E4=BB=B6=E4=B8=8B=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=A0=87=E9=A2=98=E5=BB=BA=E8=AE=AE=E6=94=BE=E5=9C=A8?= =?UTF-8?q?=E7=BC=A9=E7=95=A5=E5=9B=BE=E4=B8=8A=E6=96=B9=EF=BC=88=E5=8F=AF?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I929eac8cef4382b5c58c783b8ff8aff2dfd885b5 --- packages/amis-editor/src/plugin/Image.tsx | 63 ++++++++++++---------- packages/amis-editor/src/plugin/Images.tsx | 47 +++++++--------- 2 files changed, 54 insertions(+), 56 deletions(-) diff --git a/packages/amis-editor/src/plugin/Image.tsx b/packages/amis-editor/src/plugin/Image.tsx index 319980d8f..4f39e13c1 100644 --- a/packages/amis-editor/src/plugin/Image.tsx +++ b/packages/amis-editor/src/plugin/Image.tsx @@ -6,7 +6,7 @@ import { PluginEvent, ResizeMoveEventContext } 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'; export class ImagePlugin extends BasePlugin { @@ -87,31 +87,12 @@ export class ImagePlugin extends BasePlugin { label: '缩略图地址', description: '如果已绑定字段名,可以不用设置,支持用变量。' }), - { - type: 'input-text', - label: '打开外部链接', - name: 'href' - }, - getSchemaTpl('imageUrl', { - name: 'defaultImage', - label: '无数据时显示的图片' - }) - ] - }, - getSchemaTpl('status') - ]) - }, - { - title: '外观', - body: getSchemaTpl('collapseGroup', [ - { - title: '基本', - body: [ { type: 'ae-switch-more', mode: 'normal', name: 'enlargeAble', - label: '图片放大功能', + label: tipedLabel( + '图片放大功能', '放大功能和打开外部链接功能是冲突的,若要点击时打开外部链接请先关闭此功能'), value: false, hiddenOnDefault: false, formType: 'extend', @@ -126,16 +107,44 @@ export class ImagePlugin extends BasePlugin { ] } }, - - getSchemaTpl('switch', { - name: 'showDimensions', - label: '显示图片尺寸' - }), + { + type: 'input-text', + 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', type: 'select', label: '缩略图展示模式', + mode: 'horizontal', + labelAlign: 'left', + horizontal: { + left: 5, + right: 7 + }, pipeIn: defaultValue('contain'), options: [ { diff --git a/packages/amis-editor/src/plugin/Images.tsx b/packages/amis-editor/src/plugin/Images.tsx index e28716516..dc0c1f1c3 100644 --- a/packages/amis-editor/src/plugin/Images.tsx +++ b/packages/amis-editor/src/plugin/Images.tsx @@ -1,6 +1,6 @@ import {registerEditorPlugin} 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'; export class ImagesPlugin extends BasePlugin { @@ -120,11 +120,15 @@ export class ImagesPlugin extends BasePlugin { name: 'caption' } ] - } + }, + getSchemaTpl('switch', { + name: 'enlargeAble', + label: '图片放大功能' + }) ]).concat([ getSchemaTpl('imageUrl', { name: 'defaultImage', - label: '无数据时显示的图片' + label: tipedLabel('占位图', '无数据时显示的图片') }) ]) }, @@ -137,37 +141,22 @@ export class ImagesPlugin extends BasePlugin { { title: '基本', body: [ - { - type: 'ae-switch-more', - mode: 'normal', - name: 'enlargeAble', - 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: '显示图片尺寸' - }), + // 已废弃 + // getSchemaTpl('switch', { + // name: 'showDimensions', + // label: '显示图片尺寸' + // }), { name: 'thumbMode', type: 'select', label: '缩略图展示模式', + mode: 'horizontal', + labelAlign: 'left', + horizontal: { + left: 5, + right: 7 + }, pipeIn: defaultValue('contain'), options: [ {