amis-saas-6024 [Improvement.] [弹窗/抽屉] 宽度,高度调整

Change-Id: I00a37e46b4671f644926fab9aacefafb4f7e955f
This commit is contained in:
zhangzhulei 2022-08-18 17:03:56 +08:00
parent 1dd53c50b9
commit 63153d5dff
3 changed files with 110 additions and 77 deletions

View File

@ -6,7 +6,8 @@ import {
RegionConfig, RegionConfig,
RendererInfo, RendererInfo,
getSchemaTpl, getSchemaTpl,
noop noop,
defaultValue
} from 'amis-editor-core'; } from 'amis-editor-core';
import {cloneDeep, assign} from 'lodash'; import {cloneDeep, assign} from 'lodash';
import {getEventControlConfig} from '../renderer/event-control/helper'; import {getEventControlConfig} from '../renderer/event-control/helper';
@ -99,31 +100,6 @@ export class DialogPlugin extends BasePlugin {
type: 'input-text', type: 'input-text',
name: 'title' name: 'title'
}, },
{
label: '尺寸',
type: 'button-group-select',
value: 'md',
name: 'size',
size: 'sm',
options: [
{
label: '小',
value: 'sm'
},
{
label: '中',
value: 'md'
},
{
label: '大',
value: 'lg'
},
{
label: '超大',
value: 'xl'
}
]
},
getSchemaTpl('switch', { getSchemaTpl('switch', {
label: '展示关闭按钮', label: '展示关闭按钮',
name: 'showCloseButton', name: 'showCloseButton',
@ -152,6 +128,36 @@ export class DialogPlugin extends BasePlugin {
{ {
title: '外观', title: '外观',
body: getSchemaTpl('collapseGroup', [ body: getSchemaTpl('collapseGroup', [
{
title: '基本',
body: [
{
label: '尺寸',
type: 'button-group-select',
name: 'size',
size: 'sm',
options: [
{
label: '小',
value: 'sm'
},
{
label: '中',
value: 'md'
},
{
label: '大',
value: 'lg'
},
{
label: '超大',
value: 'xl'
}
],
pipeIn: defaultValue('md')
}
]
},
{ {
title: 'CSS类名', title: 'CSS类名',
body: [ body: [

View File

@ -8,7 +8,6 @@ import {
getSchemaTpl, getSchemaTpl,
noop noop
} from 'amis-editor-core'; } from 'amis-editor-core';
import {assign, cloneDeep} from 'lodash';
import {getEventControlConfig} from '../renderer/event-control/helper'; import {getEventControlConfig} from '../renderer/event-control/helper';
import {InlineModal} from './Dialog'; import {InlineModal} from './Dialog';
import {tipedLabel} from '../component/BaseControl'; import {tipedLabel} from '../component/BaseControl';
@ -104,7 +103,6 @@ export class DrawerPlugin extends BasePlugin {
type: 'button-group-select', type: 'button-group-select',
name: 'position', name: 'position',
label: '位置', label: '位置',
value: 'right',
mode: 'horizontal', mode: 'horizontal',
options: [ options: [
{ {
@ -123,37 +121,8 @@ export class DrawerPlugin extends BasePlugin {
label: '下', label: '下',
value: 'bottom' value: 'bottom'
} }
] ],
}, pipeIn: defaultValue('right')
{
type: 'button-group-select',
name: 'size',
label: '尺寸',
value: 'md',
size: 'sm',
mode: 'horizontal',
options: [
{
label: '超小',
value: 'xs'
},
{
label: '小',
value: 'sm'
},
{
label: '中',
value: 'md'
},
{
label: '大',
value: 'lg'
},
{
label: '超大',
value: 'xl'
}
]
}, },
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'overlay', name: 'overlay',
@ -190,24 +159,51 @@ export class DrawerPlugin extends BasePlugin {
title: '基本', title: '基本',
body: [ body: [
{ {
type: 'input-text', type: 'button-group-select',
name: 'width', name: 'size',
label: tipedLabel( label: '尺寸',
'宽度', size: 'sm',
'位置为 "左" 或 "右" 时生效。 默认宽度为"尺寸"字段配置的宽度,值单位默认为 px也支持百分比等单位 100%' mode: 'horizontal',
), options: [
disabledOn: 'this.position === "top" || this.position === "bottom"', {
tooltip: '位置为 为 "左" 或 "右" 时生效' label: '超小',
value: 'xs'
},
{
label: '小',
value: 'sm'
},
{
label: '中',
value: 'md'
},
{
label: '大',
value: 'lg'
},
{
label: '超大',
value: 'xl'
}
],
pipeIn: defaultValue('md')
}, },
{ getSchemaTpl('style:widthHeight', {
type: 'input-text', widthSchema: {
name: 'height', label: tipedLabel(
label: tipedLabel( '宽度',
'高度', '位置为 "左" 或 "右" 时生效。 默认宽度为"尺寸"字段配置的宽度,值单位默认为 px也支持百分比等单位 100%'
'位置为 "上" 或 "下" 时生效。 默认宽度为"尺寸"字段配置的高度,值单位默认为 px也支持百分比等单位 100%' ),
), disabledOn: 'this.position === "top" || this.position === "bottom"'
disabledOn: 'this.position === "left" || this.position === "right"' },
} heightSchema: {
label: tipedLabel(
'高度',
'位置为 "上" 或 "下" 时生效。 默认宽度为"尺寸"字段配置的高度,值单位默认为 px也支持百分比等单位 100%'
),
disabledOn: 'this.position === "left" || this.position === "right"'
}
})
] ]
}, },
{ {

View File

@ -198,6 +198,37 @@ setSchemaTpl('style:common', (
); );
}); });
/**
*
* @param {object | undefined} options witdthSchema() heightSchema()
*/
setSchemaTpl('style:widthHeight', (option: any = {}) => {
const {widthSchema = {}, heightSchema = {}} = option;
return {
type: 'container',
body: [
{
type: 'input-number',
name: 'width',
label: '宽度',
unitOptions: [
'px', '%', 'rem', 'em', 'vw'
],
...widthSchema
},
{
type: 'input-number',
name: 'height',
label: '高度',
unitOptions: [
'px', '%', 'rem', 'em', 'vh'
],
...heightSchema
},
]
};
});
/** /**
* *
*/ */