import "./index.css";
/* script */
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
import { createComponentName, componentMixin } from '../../utils/base';
import Popover from '../popover';
const __vue_script__ = {
  name: createComponentName('tooltip'),
  components: {
    Popover
  },
  mixins: [componentMixin],
  props: {
    /**
     * 距离目标的偏移量 详情见 [popper.js](https://popper.js.org/popper-documentation.html#modifiers..offset)
     */
    offset: {
      type: String,
      default: '0'
    },
    // 默认是否显隐
    defaultVisible: {
      type: Boolean,
      default: false
    },
    // 延迟多久展示
    delayOver: {
      type: Number,
      default: 50
    },
    // 提示内容, 复杂结构考虑使用 slot
    content: {
      type: String
    },
    // 用于手动控制浮层显隐, 可用通过 visible.sync 和 trigger 一起生效
    visible: {
      type: Boolean,
      // -
      default: undefined
    },
    // 激活 tooltip 方式, 如果设置为 null 表示完全由 visible 控制
    trigger: {
      // 'hover', 'click', null
      type: String,
      default: 'hover',
      validator: value => ['click', 'hover'].indexOf(value) > -1
    },

    /**
     * 提示方向
     */
    placement: {
      // 'top-start' 'top' 'top-end' 'left-start' 'left' 'left-end' 'bottom-start' 'bottom' 'bottom-end'
      type: String,
      default: 'bottom'
    },
    // 主题色
    theme: {
      // 'dark' / ‘light’
      type: String,
      default: 'dark'
    },
    // 浮层自定义clas
    popoverClass: {
      type: String
    },
    // 提示元素参考的边界元素，详情见 [popper.js](https://popper.js.org/popper-documentation.html#modifiers..preventOverflow.boundariesElement)，默认是父级第一个可滚动元素
    boundariesElement: {
      type: [String, Object],
      default: 'scrollParent'
    }
  },
  computed: {
    modifiers() {
      return {
        offset: {
          offset: this.offset
        },
        preventOverflow: {
          boundariesElement: this.boundariesElement
        }
      };
    }

  },
  methods: {
    onClick(e) {
      /**
       * 浮层点击事件
       */
      this.$emit('click', e);
    }

  }
};
/* template */

var __vue_render__ = function () {
  var _vm = this;

  var _h = _vm.$createElement;

  var _c = _vm._self._c || _h;

  return _c("Popover", _vm._g(_vm._b({
    class: _vm.bem("container"),
    attrs: {
      "popover-class": [_vm.bem([_vm.theme]), _vm.popoverClass],
      placement: _vm.placement,
      delayOver: _vm.delayOver,
      defaultVisible: _vm.defaultVisible,
      visible: _vm.visible,
      trigger: _vm.trigger,
      transitionName: "gd-fade",
      modifiers: _vm.modifiers
    },
    on: {
      "update:visible": function (v) {
        return _vm.$emit("update:visible", v);
      }
    }
  }, "Popover", _vm.$attrs, false), _vm.$listeners), [_vm._t("default"), _vm._v(" "), _c("template", {
    slot: "popup"
  }, [_c("div", {
    class: _vm.bem("content"),
    on: {
      click: _vm.onClick
    }
  }, [_vm._t("content", [_vm._v(_vm._s(_vm.content))])], 2), _vm._v(" "), _c("div", {
    class: _vm.bem("arrow")
  })])], 2);
};

var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;
/* style */

const __vue_inject_styles__ = undefined;
/* scoped */

const __vue_scope_id__ = undefined;
/* module identifier */

const __vue_module_identifier__ = undefined;
/* functional template */

const __vue_is_functional_template__ = false;
/* component normalizer */

import __vue_normalize__ from '../../utils/vue-normalize-component.js';
/* style inject */

/* style inject SSR */

export default __vue_normalize__({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined);