import TyComponent from '../common/component'

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

    show: {
      type: Boolean,
      value: false
    },
    zIndex: {
      type: Number,
      value: 100
    },
    overlay: {
      type: Boolean,
      value: true
    },
    position: {
      type: String,
      value: 'center'
    },
    duration: {
      type: [Number, Object],
      value: 300
    },
    round: {
      type: Boolean,
      value: false
    },
    customStyle: {
      type: String
    },
    overlayStyle: {
      type: String
    },
    closeOnClickOverlay: {
      type: Boolean,
      value: true
    },
    closeIconPosition: {
      type: String,
      value: 'top-right'
    },
    closeable: {
      type: Boolean,
      value: false
    },
    closeIcon: {
      type: String,
      value: 'cross'
    },
    safeAreaInsetBottom: {
      type: Boolean,
      value: true
    },
    safeAreaInsetTop: {
      type: Boolean,
      value: false
    },
    customClass: {
      type: String
    }

  },

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

  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleClose({detail}) {
      this.triggerEvent('close', detail)
    },
    handleClickOverlay({detail}) {
      this.triggerEvent('click-overlay', detail)
    },
    handleBeforeEnter({detail}) {
      this.triggerEvent('before-enter', detail)
    },
    handleEnter({detail}) {
      this.triggerEvent('enter', detail)
    },
    handleAfterEnter({detail}) {
      this.triggerEvent('after-enter', detail)
    },
    handleBeforeLeave({detail}) {
      this.triggerEvent('before-leave', detail)
    },
    handleLeave({detail}) {
      this.triggerEvent('leave', detail)
    },
    handleAfterLeave({detail}) {
      this.triggerEvent('after-leave', detail)
    },
  }
})
