import "./editor-sidebar.css";
/* script */
//
//
//
//
//
//
//
//
//
//
//
import { componentMixin, createComponentName } from '../../utils/base';
import Tabs from '../tabs';
;
const __vue_script__ = {
  name: createComponentName('editor-sidebar'),
  components: {
    Tabs
  },
  mixins: [componentMixin],
  model: {
    name: 'value',
    event: 'change'
  },
  props: {
    // 默认展示的 panel
    defaultValue: {
      type: String
    },
    value: {
      type: String
    }
  },

  data() {
    let 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) {
      const v = value === this.currentValue ? '' : value;

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

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

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

  }
};
/* template */

var __vue_render__ = function () {
  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 */

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);