"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _create = _interopRequireDefault(require("../utils/create"));

var _relation = require("../mixins/relation");

var _info = _interopRequireDefault(require("../info"));

var _router = require("../utils/router");

var _default = (0, _create.default)({
  render: function render() {
    var _vm = this;

    var _h = _vm.$createElement;

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

    return _c('a', {
      class: _vm.b({
        select: this.select,
        disabled: this.disabled
      }),
      on: {
        "click": _vm.onClick
      }
    }, [_c('div', {
      class: _vm.b('text')
    }, [_vm._t("title", [_vm._v("\n      " + _vm._s(_vm.title) + "\n    ")]), _c('Info', {
      class: _vm.b('info'),
      attrs: {
        "dot": _vm.dot,
        "info": _vm.badge
      }
    })], 2)]);
  },
  components: {
    Info: _info.default
  },
  name: "sidebar-item",
  mixins: [(0, _relation.ChildrenMixin)("vmSidebar")],
  props: (0, _extends2.default)({}, _router.routeProps, {
    dot: Boolean,
    badge: [Number, String],
    title: String,
    disabled: Boolean
  }),
  computed: {
    select: function select() {
      return this.index === +this.parents.activeKey;
    }
  },
  methods: {
    onClick: function onClick() {
      if (this.disabled) {
        return;
      }

      this.$emit("click", this.index);
      this.parents.$emit("input", this.index);
      this.parents.setIndex(this.index);
      (0, _router.route)(this.$router, this);
    }
  }
});

exports.default = _default;