in packages/build-plugin-lowcode/src/utils/index.js [74:127]
function generateComponentList(components) {
const componentList = [
{
title: '常用',
icon: '',
children: [],
},
{
title: '容器',
icon: '',
children: [],
},
{
title: '导航',
icon: '',
children: [],
},
{
title: '内容',
icon: '',
children: [],
},
{
title: 'Feedback 反馈',
icon: '',
children: [],
},
];
components.forEach((comp) => {
const category = comp.category || '其他';
let target = componentList.find((item) => item.title === category);
if (!target) {
target = {
title: category,
icon: '',
children: [],
};
componentList.push(target);
}
if (comp.snippets) {
target.children.push({
componentName: comp.componentName,
title: comp.title || comp.componentName,
icon: '',
package: comp.npm.pkg,
snippets: comp.snippets || [],
});
}
});
return componentList;
}