forked from alibaba/lowcode-materials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsnippets.design.ts
More file actions
35 lines (32 loc) · 1.13 KB
/
snippets.design.ts
File metadata and controls
35 lines (32 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import parseData from '../utils/parse-data';
const plainData =
'*Panel Header 1\n\tPeople always make mistakes, frustrated, nerve-racking, but cannot remain stagnant.\nPanel Header 2\n\tPeople always make mistakes, frustrated, nerve-racking, but cannot remain stagnant.\nPanel Header 3\n\tPeople always make mistakes, frustrated, nerve-racking, but cannot remain stagnant.\n';
const list = parseData(plainData).filter((node) => 'node' === node.type);
const defaultExpandedKeys = [];
const dataSource = list.map((item, index) => {
if (item.state === 'active') {
defaultExpandedKeys.push(`panel_${index}`);
}
return {
key: `panel_${index}`,
title: item.value,
content: item.children.map(({ type, value }) => (type === 'node' ? value : '')),
disabled: item.state === 'disabled',
};
});
export default [
{
title: '折叠面板',
screenshot:
'https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_dialog.png',
schema: {
componentName: 'Collapse',
props: {
accordion: false,
plainData,
dataSource,
defaultExpandedKeys,
},
},
},
];