mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:08:55 +08:00
feat(style:common增加include):amis-saas-4880 [Feature] 「容器类优化」ifream组件优化
Change-Id: Id5b22d43f0e96a836c3ca7049b2df414ccbd09d7
This commit is contained in:
parent
c237cf9ca6
commit
45d136936e
@ -52,7 +52,15 @@ setSchemaTpl('style:others', (schemas: any[] = []) => ({
|
||||
body: [...schemas]
|
||||
}));
|
||||
|
||||
setSchemaTpl('style:common', (exclude: string[] | string) => {
|
||||
/**
|
||||
* 通用CSS Style控件
|
||||
* @param {string | Array<string>} exclude 需要隐藏的配置key
|
||||
* @param {string | Array<string>} include 包含的配置key,存在时,优先级高于exclude
|
||||
*/
|
||||
setSchemaTpl('style:common', (
|
||||
exclude: string[] | string,
|
||||
include: string[] | string,
|
||||
) => {
|
||||
// key统一转换成Kebab case,eg: boxShadow => bos-shadow
|
||||
exclude = (exclude
|
||||
? Array.isArray(exclude)
|
||||
@ -61,6 +69,13 @@ setSchemaTpl('style:common', (exclude: string[] | string) => {
|
||||
: []
|
||||
).map((key: string) => kebabCase(key));
|
||||
|
||||
include = (include
|
||||
? Array.isArray(include)
|
||||
? include
|
||||
: [include]
|
||||
: []
|
||||
).map((key: string) => kebabCase(key));
|
||||
|
||||
return [
|
||||
{
|
||||
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)
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user