2020-04-19 11:50:32 +08:00
|
|
|
import { uniqueId } from 'lodash'
|
|
|
|
|
|
2018-07-17 22:03:45 +08:00
|
|
|
// 插件
|
|
|
|
|
import demoPlugins from './modules/demo-plugins'
|
|
|
|
|
// 组件
|
|
|
|
|
import demoComponents from './modules/demo-components'
|
|
|
|
|
// 组件
|
|
|
|
|
import demoCharts from './modules/demo-charts'
|
2020-08-31 22:29:25 +08:00
|
|
|
// 功能
|
2018-07-17 22:03:45 +08:00
|
|
|
import demoPlayground from './modules/demo-playground'
|
2018-08-05 22:21:17 +08:00
|
|
|
// 示例
|
|
|
|
|
import demoBusiness from './modules/demo-business'
|
2018-08-29 20:02:34 +08:00
|
|
|
// CRUD
|
2018-08-22 19:41:00 +08:00
|
|
|
import demoD2Crud from './modules/demo-d2-crud'
|
2020-08-31 21:22:59 +08:00
|
|
|
// CRUD PLUS
|
|
|
|
|
import demoD2CrudPlus from './modules/demo-d2-crud-plus'
|
2018-07-17 22:03:45 +08:00
|
|
|
|
2020-04-19 11:50:32 +08:00
|
|
|
/**
|
|
|
|
|
* @description 给菜单数据补充上 path 字段
|
|
|
|
|
* @description https://github.com/d2-projects/d2-admin/issues/209
|
|
|
|
|
* @param {Array} menu 原始的菜单数据
|
|
|
|
|
*/
|
|
|
|
|
function supplementPath (menu) {
|
|
|
|
|
return menu.map(e => ({
|
|
|
|
|
...e,
|
|
|
|
|
path: e.path || uniqueId('d2-menu-empty-'),
|
|
|
|
|
...e.children ? {
|
|
|
|
|
children: supplementPath(e.children)
|
|
|
|
|
} : {}
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-17 22:03:45 +08:00
|
|
|
// 菜单 侧边栏
|
2020-04-19 11:50:32 +08:00
|
|
|
export const menuAside = supplementPath([
|
2018-07-17 22:03:45 +08:00
|
|
|
demoComponents,
|
2018-07-25 09:47:43 +08:00
|
|
|
demoPlugins,
|
2018-07-17 22:03:45 +08:00
|
|
|
demoCharts,
|
2018-08-05 22:21:17 +08:00
|
|
|
demoPlayground,
|
2018-08-22 19:41:00 +08:00
|
|
|
demoBusiness,
|
2018-08-29 20:02:34 +08:00
|
|
|
demoD2Crud,
|
2020-08-31 22:13:41 +08:00
|
|
|
demoD2CrudPlus
|
2020-04-19 11:50:32 +08:00
|
|
|
])
|
2018-07-17 22:03:45 +08:00
|
|
|
|
|
|
|
|
// 菜单 顶栏
|
2020-04-19 11:50:32 +08:00
|
|
|
export const menuHeader = supplementPath([
|
2018-07-17 22:03:45 +08:00
|
|
|
{
|
|
|
|
|
path: '/index',
|
|
|
|
|
title: '首页',
|
|
|
|
|
icon: 'home'
|
|
|
|
|
},
|
2020-08-31 22:29:25 +08:00
|
|
|
demoComponents,
|
|
|
|
|
demoCharts,
|
|
|
|
|
demoPlugins,
|
2018-07-17 22:03:45 +08:00
|
|
|
{
|
2020-08-31 22:29:25 +08:00
|
|
|
title: '社区插件',
|
2018-07-17 22:03:45 +08:00
|
|
|
icon: 'puzzle-piece',
|
|
|
|
|
children: [
|
2018-08-22 19:41:00 +08:00
|
|
|
demoD2Crud,
|
2020-08-31 22:29:25 +08:00
|
|
|
demoD2CrudPlus
|
2018-07-17 22:03:45 +08:00
|
|
|
]
|
2018-08-05 22:21:17 +08:00
|
|
|
},
|
2018-08-18 00:24:29 +08:00
|
|
|
demoPlayground,
|
2019-08-17 17:58:40 +08:00
|
|
|
demoBusiness
|
2020-04-19 11:50:32 +08:00
|
|
|
])
|