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, key: item.title,
body: flatten(item.body) body: flatten(item.body)
})); }));
return { return {
type: 'collapse-group', type: 'collapse-group',
activeKey: collapseGroupBody activeKey: collapseGroupBody

View File

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