// 注入全局css
import overallStyle from './style/index.vue'
import {
  Icon
} from "@syman/ark-ui";
// 导入组件
import PosStoreAffairs from "../packages/components/storeAffairs" //店务业务组件
import posInput from "./components/input" //店务业务组件
import posFormLayout from "./components/posFormLayout" //店务业务组件
import buttonsBlock from "./components/buttonsBlock" //折叠button
import SingDatePicker from "./components/singDatePicker" //单选日期
import DateRangePicker from "./components/dateRangePicker" //单选日期
import PosTable from "./components/posTable" //单选日期
// 组件列表
const components = [
  SingDatePicker,
  overallStyle,
  PosStoreAffairs,
  posInput,
  posFormLayout,
  buttonsBlock,
  DateRangePicker,
  PosTable
]
// 定义 install 方法，接收 Vue 作为参数。如果使用 use 注册插件，那么所有的组件都会被注册
const install:any = function (Vue:any) {
  // 判断是否安装
  if (install.installed) return
  // 遍历注册全局组件
  Vue.component('Icon', Icon) //Icon需要全局注册
  components.map(component => Vue.component((component as any).extendOptions.name, component))
}

// 判断是否是直接引入文件
if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue)
}

export default {
  // 导出的对象必须具有 install，才能被 Vue.use() 方法安装
  install,
  // 以下是具体的组件列表
  overallStyle,
  PosStoreAffairs,
  posInput,
  posFormLayout,
  buttonsBlock,
  SingDatePicker,
  DateRangePicker,
  PosTable
}