amis-saas-10220 tpl外观

Change-Id: Idafaa5c9894a5559ed7fcbdc2038efaf34fb72d4
This commit is contained in:
qkiroc 2023-03-16 20:31:50 +08:00
parent aeeef05c12
commit c77aa20e1e
3 changed files with 32 additions and 35 deletions

View File

@ -312,9 +312,7 @@ export class FlexPluginBase extends BasePlugin {
{ {
title: '外观', title: '外观',
className: 'p-none', className: 'p-none',
body: getSchemaTpl('collapseGroup', [ body: getSchemaTpl('collapseGroup', [...getSchemaTpl('theme:common')])
...getSchemaTpl('theme:common', [])
])
} }
]) ])
]; ];

View File

@ -216,10 +216,7 @@ export class TplPlugin extends BasePlugin {
{ {
title: '外观', title: '外观',
body: getSchemaTpl('collapseGroup', [ body: getSchemaTpl('collapseGroup', [
...getSchemaTpl('style:common', ['layout']), ...getSchemaTpl('theme:common', ['layout'], ['font'])
getSchemaTpl('style:classNames', {
isFormItem: false
})
]) ])
}, },
{ {

View File

@ -567,30 +567,19 @@ setSchemaTpl('theme:shadow', (option: any = {}) => {
setSchemaTpl( setSchemaTpl(
'theme:common', 'theme:common',
(exclude: string[] | string, include: string[] | string) => { (exclude: string[] | string, include: string[]) => {
// key统一转换成Kebab caseeg: boxShadow => bos-shadow // key统一转换成Kebab caseeg: boxShadow => bos-shadow
exclude = ( exclude = (
exclude ? (Array.isArray(exclude) ? exclude : [exclude]) : [] exclude ? (Array.isArray(exclude) ? exclude : [exclude]) : []
).map((key: string) => kebabCase(key)); ).map((key: string) => kebabCase(key));
include = ( const moreStyle =
include ? (Array.isArray(include) ? include : [include]) : [] include?.map(key =>
).map((key: string) => kebabCase(key)); getSchemaTpl(`theme:${key}`, {
return [
{
header: '布局',
key: 'layout',
body: [
{
type: 'style-display',
label: false,
name: 'style' name: 'style'
} })
].filter(comp => !~exclude.indexOf(comp.type.replace(/^style-/i, ''))) ) || [];
}, const styles = moreStyle.concat([
{
title: '自定义样式',
body: [
getSchemaTpl('theme:border', { getSchemaTpl('theme:border', {
name: 'style' name: 'style'
}), }),
@ -610,7 +599,22 @@ setSchemaTpl(
getSchemaTpl('theme:shadow', { getSchemaTpl('theme:shadow', {
name: 'style.boxShadow' name: 'style.boxShadow'
}) })
] ]);
return [
{
header: '布局',
key: 'layout',
body: [
{
type: 'style-display',
label: false,
name: 'style'
}
].filter(comp => !~exclude.indexOf(comp.type.replace(/^style-/i, '')))
},
{
title: '自定义样式',
body: styles
}, },
{ {
title: '样式源码', title: '样式源码',
@ -622,8 +626,6 @@ setSchemaTpl(
} }
] ]
} }
].filter(item => ].filter(item => !~exclude.indexOf(item.key || ''));
include.length ? ~include.indexOf(item.key) : !~exclude.indexOf(item.key)
);
} }
); );