Merge pull request #8205 from wibetter/master

fix(amis-editor): theme:common补充hidePaddingAndMargin,支持隐藏内外边距配置项
This commit is contained in:
wutong 2023-09-22 13:59:15 +08:00 committed by GitHub
commit fdeb1cfa96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 17 deletions

View File

@ -371,7 +371,6 @@ setSchemaTpl(
key: item.title,
body: flatten(item.body)
}));
return {
type: 'collapse-group',
activeKey: collapseGroupBody

View File

@ -579,14 +579,17 @@ setSchemaTpl(
classname?: string;
title?: string;
hiddenOn?: string;
hidePaddingAndMargin?: boolean;
}) => {
const {
collapsed = false,
extra = [],
classname = 'baseControlClassName',
title = '基本样式',
hiddenOn
hiddenOn,
hidePaddingAndMargin
} = option;
const curHidePaddingAndMargin = hidePaddingAndMargin ?? false;
const styleStateFunc = (visibleOn: string, state: string) => {
return [
getSchemaTpl('theme:border', {
@ -597,10 +600,12 @@ setSchemaTpl(
visibleOn: visibleOn,
name: `themeCss.${classname}.radius:${state}`
}),
getSchemaTpl('theme:paddingAndMargin', {
visibleOn: visibleOn,
name: `themeCss.${classname}.padding-and-margin:${state}`
}),
!curHidePaddingAndMargin
? getSchemaTpl('theme:paddingAndMargin', {
visibleOn: visibleOn,
name: `themeCss.${classname}.padding-and-margin:${state}`
})
: null,
getSchemaTpl('theme:colorPicker', {
visibleOn: visibleOn,
name: `themeCss.${classname}.background:${state}`,
@ -614,15 +619,17 @@ setSchemaTpl(
visibleOn: visibleOn,
name: `themeCss.${classname}.boxShadow:${state}`
})
].concat(
extra.map(item => {
return {
...item,
visibleOn: visibleOn,
name: `${item.name}:${state}`
};
})
);
]
.filter(item => item)
.concat(
extra.map(item => {
return {
...item,
visibleOn: visibleOn,
name: `${item.name}:${state}`
};
})
);
};
const styles = [
{
@ -672,6 +679,7 @@ setSchemaTpl(
layoutExtra?: any[];
classname?: string;
baseTitle?: string;
hidePaddingAndMargin?: boolean;
}) => {
let {
exclude,
@ -680,7 +688,8 @@ setSchemaTpl(
baseExtra,
layoutExtra,
classname,
baseTitle
baseTitle,
hidePaddingAndMargin
} = option || {};
const curCollapsed = collapsed ?? false; // 默认都展开
@ -708,7 +717,8 @@ setSchemaTpl(
collapsed: curCollapsed,
extra: baseExtra,
classname,
title: baseTitle
title: baseTitle,
hidePaddingAndMargin
}),
...extra,
{