/*! bxs-vue-ui v3.3.0 */
import '../utils/entry-virtual.js';
import { C as create, _ as __vue_normalize__ } from '../utils/normalize-component.js';
import '../utils/object-create.js';
import '../utils/html.js';
import '../utils/es.number.constructor.js';
import '../utils/array-iteration.js';
import '../utils/sloppy-array-method.js';
import { _ as _indexOfInstanceProperty } from '../utils/index-of.js';
import '../utils/string-trim.js';
import { _ as _someInstanceProperty } from '../utils/some.js';
import { _ as _trimInstanceProperty } from '../utils/trim.js';

var script = create({
  name: 'cell-group',
  props: {
    // 分组标题
    title: {
      type: String,
      default: ''
    },
    // 分组右上角文案, eg: '更多'
    linkText: {
      type: String,
      default: ''
    },
    // 是否展示右侧箭头并开启点击反馈
    isLink: {
      type: Boolean,
      default: false
    },
    // 点击后跳转的url (有值则 click 事件不会被触发)
    linkUrl: {
      type: String,
      default: ''
    },
    // isLink=true 且 linkUrl 有值时生效, true 代表替换浏览器历史
    replace: {
      type: Boolean,
      default: false
    },
    // 展示《查看更多》的列表阀值(正整数)
    //    0 代表永不展示《查看更多》
    //    2 代表超过两个时展示《查看更多》
    moreThreshold: {
      type: Number,
      default: 0,
      validator: function validator(val) {
        var _context;

        return val >= 0 && _indexOfInstanceProperty(_context = String(val)).call(_context, '.') === -1;
      }
    },
    // 底部《查看更多》的文案
    moreText: {
      type: String,
      default: '查看更多'
    }
  },
  data: function data() {
    return {
      showAllCell: false
    };
  },
  created: function created() {
    this.validDefaultSlots();
  },
  methods: {
    validDefaultSlots: function validDefaultSlots() {
      var _context2;

      if (_someInstanceProperty(_context2 = this.$slots.default).call(_context2, function (slot) {
        var _context3;

        return slot.componentOptions && slot.componentOptions.tag !== 'bxs-cell' || !slot.componentOptions && slot.tag || slot.tag === undefined && _trimInstanceProperty(_context3 = slot.text).call(_context3) !== '';
      })) {
        throw new Error('bxs-cell-group 组件的默认 slot 中支持 bxs-cell 组件');
      }
    },
    clickHandler: function clickHandler() {
      if (this.linkUrl) {
        if (this.replace) {
          window.location.replace(this.linkUrl);
        } else {
          window.location.href = this.linkUrl;
        }
      } else {
        this.$emit('click');
      }
    }
  }
});

/* script */
var __vue_script__ = script;
/* template */

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

  var _h = _vm.$createElement;

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

  return _c('div', {
    staticClass: "bx-cell-group"
  }, [_vm.title ? _c('div', {
    staticClass: "bx-cell-group-title-line bx-hairline--bottom"
  }, [_c('span', {
    staticClass: "bx-cell-group-title"
  }, [_vm._v("\n      " + _vm._s(_vm.title) + "\n    ")]), _vm.isLink || _vm.linkText || _vm.$slots.right ? _c('span', {
    staticClass: "bx-cell-group-link",
    on: {
      "click": _vm.clickHandler
    }
  }, [_vm._t("right", [_c('span', {
    staticClass: "bx-cell-group-link-btn"
  }), _vm.linkText ? _c('span', {
    staticClass: "bx-cell-group-link-text"
  }, [_vm._v("\n          " + _vm._s(_vm.linkText) + "\n        ")]) : _vm._e(), _vm.isLink ? _c('bxs-icon', {
    staticClass: "bx-cell-group-link-icon",
    attrs: {
      "name": "arrow-right"
    }
  }) : _vm._e()])], 2) : _vm._e()]) : _vm._e(), _c('div', {
    staticClass: "bx-cell-group-cells"
  }, [_vm._t("default")], 2), _vm.moreThreshold > 0 && !_vm.showAllCell ? _c('div', {
    staticClass: "bx-cell-group-more-line bx-hairline--top",
    on: {
      "click": function click($event) {
        _vm.showAllCell = true;
      }
    }
  }, [_c('span', {
    staticClass: "bx-cell-group-more-text"
  }, [_vm._v("\n      " + _vm._s(_vm.moreText) + "\n    ")]), _c('bxs-icon', {
    staticClass: "bx-cell-group-more-icon",
    attrs: {
      "name": "arrow-down"
    }
  })], 1) : _vm._e()]);
};

var __vue_staticRenderFns__ = [];
/* 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;
/* style inject */

/* style inject SSR */

var index = __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);

export default index;
