// 支持的组件类型映射
export const components = {
  XTab: () => import('@vue2-client/base-client/components/layout/XPageView/XTab'),
  XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable'),
  XAddNativeForm: () => import('@vue2-client/base-client/components/common/XAddNativeForm'),
  XReportGrid: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
  XErrorView: () => import('@vue2-client/base-client/components/layout/XPageView/XErrorView'),
  // 全局组件不需要导入，直接返回null，让Vue使用全局注册的组件
}

// 组件类型解析函数
export const resolveComponentType = (type) => {
  if (!type) return components.XErrorView

  // 如果是Ant Design Vue组件（以'a-'开头），直接返回原名称
  if (type.startsWith('a-')) {
    return type
  }

  // 否则从已注册的组件集合中查找
  return components[type] || components.XErrorView
}
