in packages/build-plugin-lowcode/src/templates/meta.js [10:79]
function generateComponentList(components) {
const componentList = [
{
title: '常用',
icon: '',
children: [],
},
{
title: '容器',
icon: '',
children: [],
},
{
title: '导航',
icon: '',
children: [],
},
{
title: '内容',
icon: '',
children: [],
},
{
title: 'Feedback 反馈',
icon: '',
children: [],
},
];
const groupMap = {
原子组件: true,
};
const compGroup = {};
components.forEach((comp) => {
const category = comp.category || '其他';
if (comp.group && !compGroup[comp.componentName]) {
compGroup[comp.componentName] = comp.group;
}
if (comp.group && !groupMap[comp.group]) {
groupMap[comp.group] = true;
}
let target = componentList.find((item) => item.title === category);
if (!target) {
target = {
title: category,
icon: '',
children: [],
};
componentList.push(target);
}
if (comp.snippets && comp.snippets.length) {
target.children.push({
componentName: comp.componentName,
title: comp.title || comp.componentName,
sort: {
category: target.title,
group: compGroup[comp.componentName] || '原子组件',
priority: componentCategorySort[target.title] || 0,
},
icon: '',
package: comp.npm.pkg,
snippets: comp.snippets || [],
});
}
});
return componentList;
}