import TyComponent from '../common/component'

TyComponent({
  /**
   * 组件的属性列表
   */
  properties: {

    name: {
      type: String
    },
    checked: {
      type: Boolean,
      value: false
    },
    loading: {
      type: Boolean,
      value: false
    },
    disabled: {
      type: Boolean,
      value: false,
      observer(value) {
        const inactiveColor = this.data.inactiveColor
        if (value && inactiveColor) {
          if (inactiveColor.toUpperCase() === '#BFBFBF') {
            this.setData({
              inactiveColor: '#E4E4E4'
            })
          }
        }
      }
    },
    size: {
      type: String,
      value: '30px'
    },
    activeColor: {
      type: String,
      value: '#1890ff'
    },
    inactiveColor: {
      type: String,
      value: '#BFBFBF'
    },
    activeValue: {
      type: Boolean,
      value: true
    },
    inactiveValue: {
      type: Boolean,
      value: false
    },
    customClass: {
      type: String
    },
    nodeClass: {
      type: String
    }

  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleChange({detail}) {
      this.triggerEvent('change', detail)
    },
  }
})
