"use strict";

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

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

require("./EditorSidebar.css");

var _component = require("../_utils/component");

var _Tabs = _interopRequireDefault(require("../Tabs"));

var _vueNormalizeComponent = _interopRequireDefault(require("../_utils/vue-normalize-component.js"));

/* script */
//
//
//
//
//
//
//
//
//
//
//
;
var __vue_script__ = {
  name: (0, _component.createComponentName)('editor-sidebar'),
  components: {
    Tabs: _Tabs.default
  },
  mixins: [_component.componentMixin],
  model: {
    name: 'value',
    event: 'change'
  },
  props: {
    // 默认展示的 panel
    defaultValue: {
      type: String
    },
    value: {
      type: String
    }
  },

  data() {
    var value = '';

    if (this.$hasProp('value')) {
      value = this.value;
    } else if (this.$hasProp('defaultValue')) {
      value = this.defaultValue;
    }

    return {
      currentValue: value
    };
  },

  watch: {
    value(v) {
      this.currentValue = v;
    }

  },
  methods: {
    onChange(value) {
      var v = value === this.currentValue ? '' : value;

      if (!this.$hasProp('value')) {
        this.currentValue = v;
      }

      this.$emit('change', v);
    },

    closePanel() {
      this.onChange('');
    }

  }
};
/* template */

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

  var _h = _vm.$createElement;

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

  return _c("div", {
    class: _vm.bem({
      active: !!_vm.currentValue
    })
  }, [_c("tabs", {
    attrs: {
      "tab-position": "left",
      value: _vm.currentValue
    },
    on: {
      change: _vm.onChange
    }
  }, [_vm._t("default"), _vm._v(" "), _c("template", {
    slot: "extra"
  }, [_vm._t("extra")], 2)], 2)], 1);
};

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

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = undefined;
/* module identifier */

var __vue_module_identifier__ = undefined;
/* functional template */

var __vue_is_functional_template__ = false;
/* component normalizer */

/* style inject */

/* style inject SSR */
var _default = (0, _vueNormalizeComponent.default)({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined);

exports.default = _default;