"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _comp = require("../../ui/src/comp");
var _dom = require("../../ui/src/dom");
var _ui = require("../../ui");
var _loading = _interopRequireDefault(require("../../loading"));
var _xeUtils = _interopRequireDefault(require("xe-utils"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _default2 = exports.default = /* define-vxe-component start */(0, _comp.defineVxeComponent)({
  name: 'VxeLayoutAside',
  mixins: [_ui.globalMixins.sizeMixin],
  props: {
    width: [String, Number],
    collapsed: Boolean,
    collapseWidth: [String, Number],
    loading: Boolean,
    padding: Boolean,
    collapseConfig: Object,
    size: {
      type: String,
      default: function _default() {
        return (0, _ui.getConfig)().layoutAside.size || (0, _ui.getConfig)().size;
      }
    }
  },
  provide: function provide() {
    var $xeLayoutAside = this;
    return {
      $xeLayoutAside: $xeLayoutAside
    };
  },
  data: function data() {
    var xID = _xeUtils.default.uniqueId();
    var reactData = {};
    return {
      xID: xID,
      reactData: reactData
    };
  },
  computed: Object.assign(Object.assign({}, {}), {
    computeCollapseOpts: function computeCollapseOpts() {
      var $xeLayoutAside = this;
      var props = $xeLayoutAside;
      return Object.assign({}, (0, _ui.getConfig)().layoutAside.collapseConfig, props.collapseConfig);
    },
    computeVarStyle: function computeVarStyle() {
      var $xeLayoutAside = this;
      var props = $xeLayoutAside;
      var width = props.width,
        collapseWidth = props.collapseWidth;
      var stys = {};
      if (collapseWidth) {
        stys['--vxe-ui-layout-aside-collapse-width'] = (0, _dom.toCssUnit)(collapseWidth);
      }
      if (width) {
        stys['--vxe-ui-layout-aside-default-width'] = (0, _dom.toCssUnit)(width);
      }
      return stys;
    }
  }),
  methods: {
    //
    // Method
    //
    dispatchEvent: function dispatchEvent(type, params, evnt) {
      var $xeLayoutAside = this;
      $xeLayoutAside.$emit(type, (0, _ui.createEvent)(evnt, {
        $layoutAside: $xeLayoutAside
      }, params));
    },
    //
    // Render
    //
    renderVN: function renderVN(h) {
      var $xeLayoutAside = this;
      var props = $xeLayoutAside;
      var slots = $xeLayoutAside.$scopedSlots;
      var collapsed = props.collapsed,
        loading = props.loading,
        padding = props.padding;
      var varStyle = $xeLayoutAside.computeVarStyle;
      var vSize = $xeLayoutAside.computeSize;
      var collapseOpts = $xeLayoutAside.computeCollapseOpts;
      var defaultSlot = slots.default;
      return h('aside', {
        class: ['vxe-layout-aside', _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "size--".concat(vSize), vSize), 'is--animat', collapseOpts.animation !== false), 'is--padding', padding), 'is--collapse', collapsed), 'is--loading', loading)],
        style: varStyle
      }, [h('div', {
        class: 'vxe-layout-aside--inner'
      }, defaultSlot ? defaultSlot({}) : []),
      /**
       * 加载中
       */
      h(_loading.default, {
        class: 'vxe-list-view--loading',
        props: {
          value: loading
        }
      })]);
    }
  },
  render: function render(h) {
    return this.renderVN(h);
  }
});
/* define-vxe-component end */