import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

import Vue from 'vue';
export default Vue.extend().extend({
  name: 'w-flex-item',
  inject: {
    flexComponent: {
      default: null
    }
  },
  props: {
    flex: {
      type: [Number, String],
      default: 1
    },
    offset: {
      type: String,
      default: ''
    }
  },
  computed: {
    gutter: function gutter() {
      return Number(this.flexComponent.gutter) || 0;
    },
    style: function style() {
      var padding = "".concat(Number(this.gutter) / 2, "px");
      var ret = this.gutter ? {
        paddingLeft: padding,
        paddingRight: padding
      } : {};
      return _objectSpread({}, ret, {}, {
        flex: Number(this.flex),
        marginLeft: this.offset
      });
    }
  },
  render: function render(h) {
    return h('div', {
      class: 'weui-flex__item',
      style: this.style
    }, [this.$slots.default]);
  }
});
//# sourceMappingURL=WFlexItem.js.map