feat(style:common增加include):amis-saas-4880 [Feature] 「容器类优化」ifream组件优化

Change-Id: Id5b22d43f0e96a836c3ca7049b2df414ccbd09d7
This commit is contained in:
yangdianhua 2022-06-21 12:55:09 +08:00
parent c237cf9ca6
commit 45d136936e

View File

@ -52,7 +52,15 @@ setSchemaTpl('style:others', (schemas: any[] = []) => ({
body: [...schemas] body: [...schemas]
})); }));
setSchemaTpl('style:common', (exclude: string[] | string) => { /**
* CSS Style控件
* @param {string | Array<string>} exclude key
* @param {string | Array<string>} include keyexclude
*/
setSchemaTpl('style:common', (
exclude: string[] | string,
include: string[] | string,
) => {
// key统一转换成Kebab caseeg: boxShadow => bos-shadow // key统一转换成Kebab caseeg: boxShadow => bos-shadow
exclude = (exclude exclude = (exclude
? Array.isArray(exclude) ? Array.isArray(exclude)
@ -61,6 +69,13 @@ setSchemaTpl('style:common', (exclude: string[] | string) => {
: [] : []
).map((key: string) => kebabCase(key)); ).map((key: string) => kebabCase(key));
include = (include
? Array.isArray(include)
? include
: [include]
: []
).map((key: string) => kebabCase(key));
return [ return [
{ {
header: '布局', header: '布局',
@ -176,7 +191,11 @@ setSchemaTpl('style:common', (exclude: string[] | string) => {
} }
] ]
} }
].filter(item => !~exclude.indexOf(item.key)); ].filter(item =>
include.length
? ~include.indexOf(item.key)
: !~exclude.indexOf(item.key)
);
}); });
/** /**