import {defineAsyncComponent} from 'vue';
let chartsConfig = [{
  group: '图表',
  icon: 'el-icon-data-line',
  charts: [{
      name: 'new-bar',
      title: '基础柱状图',
      img: 'images/charts/new-bar.png'
    },
    {
      name: 'new-bar-race',
      title: '动态柱状图',
      img: 'images/charts/new-bar-race.png'
    },
    {
      name: 'new-bar-single',
      title: '簇状柱状图',
      img: 'images/charts/new-bar-single.png'
    },
    {
      name: 'new-line',
      title: '基础折线图',
      img: 'images/charts/new-line.png'
    },
    {
      name: 'new-line-single',
      title: '堆叠折线图',
      img: 'images/charts/new-line-single.png'
    },
    {
      name: 'new-mixture',
      title: '折柱混合图',
      img: 'images/charts/new-mixture.png'
    },
    {
      name: 'new-pie',
      title: '饼图',
      img: 'images/charts/pie.png'
    },
    {
      name: 'new-radar',
      title: '雷达图',
      img: 'images/charts/new-radar.png'
    }, {
      name: 'new-funnel',
      title: '漏斗图',
      img: 'images/charts/funnel.jpg'
    },
  ]
}, {
  group: '地图',
  icon: 'el-icon-location-outline',
  charts: [{
    name: 'new-map',
    title: '地图',
    img: 'images/map.png'
  }, {
    name: 'new-map-line',
    title: '飞线地图',
    img: 'images/charts/mapline.png'
  }, ]
}, {
  group: '表格',
  icon: 'el-icon-date',
  charts: [{
    name: 'new-table',
    title: '动态交叉表',
    img: 'images/crosstable.png'
  }, {
    name: 'new-scroll-table',
    title: '动态轮播表',
    img: 'images/lunbo.jpg'
  }, ]
}, {
  group: '指标',
  icon: 'el-icon-stopwatch',
  charts: [{
    name: 'new-edit',
    title: '动态文本',
    img: 'images/text.png'
  }, {
    name: 'new-flip',
    title: '翻牌器',
    img: 'images/flipClock.png'
  }, {
    name: 'new-gauge',
    title: '仪表盘',
    img: 'images/gauge.png'
  }, {
    name: 'new-water',
    title: '水位图',
    img: 'images/charts/new-water.png'
  }]
}, {
  group: '装饰',
  icon: 'el-icon-magic-stick',
  charts: [{
    name: 'new-text',
    title: '文本框',
    img: 'images/text.png'
  }, {
    name: 'new-tab',
    title: '菜单',
    img: 'images/menu.png'
  }, {
    name: 'new-datetime',
    title: '实时时间',
    img: 'images/datetime.png'
  }]
}, {
  group: '筛选',
  icon: 'el-icon-setting',
  charts: [{
      name: 'new-filter',
      title: '全局筛选',
      img: 'images/charts/new-filter.png'
    },
    //  {
    //   name: 'new-special-time',
    //   title: '联通时间筛选',
    //   img: 'images/charts/liantong.jpg')
    // }
  ]
}]
const modulesFiles = import.meta.globEager("./**/*.*") // vite
let exportSet = []
chartsConfig.forEach(item => {
  let charts = []
  item.charts.forEach(chart => {
    let name = chart.name
    window.$app.component(name, modulesFiles[`./${name}/index.vue`].default)
    window.$app.component(name + '-option', modulesFiles[`./${name}/option.vue`].default)
    charts.push({
      ...chart,
      ...modulesFiles[`./${name}/setting.js`].default
    })
  })
  exportSet.push({
    group: item.group,
    icon: item.icon,
    charts
  })
})
export default exportSet
