import {
  t,
  $t
} from '../../../locale/index.js'
// 扫描下面目录中所有的index.js 然后穷举后返回
const chartFiles = require.context('./', true, /index\.js$/)
let list = []
const white_component = ['./input/index.js', './textarea/index.js', './radio/index.js', './checkbox/index.js', './select/index.js']

chartFiles.keys().filter((key) => key !== './index.js' && white_component.includes(key)).forEach((key) => {
  const config = chartFiles(key).default
  if (config.type) {
    list = list.concat(config)
  }
})

// 按照seq排序
list = list.sort(function(a, b) {
  return a.seq - b.seq
})

export default {
  type: 'basic',
  name: $t('ngform.item.basic'), // '基础组件',
  icon: 'icon-tradingdata',
  list: list
}
