import { ElInput } from 'element-plus'
import type { Component } from 'vue'

const compMap = new Map<string, Component>()

export function getComp(name: string) {
  const comp = compMap.get(name)
  if (comp) {
    return comp
  }
  throw Error(`editTableColumn：没有注册${name}组件`)
}

export function registerComp(name: string, comp: Component) {
  if (compMap.has(name)) {
    throw Error(`editTableColumn：${name}已注册`)
  }
  compMap.set(name, comp)
}

;(() => {
  registerComp('input', ElInput)
})()
