

import type { App, Plugin } from 'vue';

import { isFunction } from 'lodash-es';
import * as commonComponents from '/nerv-lib/component'; // 基础组件
import * as serviceComponents from './component'; // 业务基础组件
import * as serviceView from './view'; //业务组件

const components: Recordable<Plugin> = {
  ...commonComponents,
  ...serviceComponents,
  ...serviceView,
};

export function registerGlobalComponent(app: App) {
  // const list = [
  //   // 'NsApplication',
  //   'NsViewAddForm',
  //   // 'NsViewConfig',
  //   // 'NsContent',
  //   'NsViewDetail',
  //   'NsViewForm',
  //   'NsViewListTable',
  //   'NsViewMenuManage',
  //   'NsViewRoleType',
  //   'NsViewRoleTypeAddOrEdit',
  //   'NsViewSetRolePerson',
  //   'NsViewUserAdd',
  //   'NsViewUserDetail',
  //   'NsViewUserEdit',
  //   'NsViewUserList',
  // ];
  Object.keys(components).forEach((key) => {
    const component = components[key];
    if (component.install || isFunction(component)) {
      //if (!list.includes(component.name)) {
      app.use(component);
      // }
    }
  });
}
