/**
 *@author       冯朝晖
 *@date         2020-02-05 17:30
 *@Copyright    天源迪科信息技术股份有限公司
 *@Description
 */
import {dealIcon} from './utils'
import {basic} from './behaviors/basic'

export default function component(ctOptions) {
  const options = {
    multipleSlots: true,
  }
  if (ctOptions.source) {
    ctOptions.options = {
      ...options,
      addGlobalClass: true,
      ...ctOptions.options
    }
  } else {
    ctOptions.options = {
      ...options,
      styleIsolation: 'shared',
      ...ctOptions.options
    }
  }

  dealIcon(ctOptions)

  // add default behaviors
  ctOptions.behaviors = ctOptions.behaviors || []
  ctOptions.behaviors.push(basic)

  return Component(ctOptions)
}
