import TyComponent from '../common/component'

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

    columns: {
      type: Array,
      value: []
    },
    showToolbar: {
      type: Boolean,
      value: false
    },
    toolbarPosition: {
      type: String,
      value: 'top'
    },
    title: {
      type: String
    },
    loading: {
      type: Boolean,
      value: false
    },
    valueKey: {
      type: String,
      value: 'text'
    },
    itemHeight: {
      type: Number,
      value: 44
    },
    confirmButtonText: {
      type: String,
      value: '确认'
    },
    cancelButtonText: {
      type: String,
      value: '取消'
    },
    visibleItemCount: {
      type: Number,
      value: 5
    },
    defaultIndex: {
      type: Number,
      value: 0
    },
    customClass: {
      type: String
    },
    activeClass: {
      type: String
    },
    toolbarClass: {
      type: String
    },
    columnClass: {
      type: String
    }

  },

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

  },

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