import { __extends, __decorate, __metadata } from 'tslib';
import { Prop, Component } from 'vue-property-decorator';
import { classNamesFunction, toMatrix } from '@uifabric-vue/utilities';
import BaseComponent from '../../components/BaseComponent.js';

var getClassNames = classNamesFunction();
var GridBase = function(_super) {
  __extends(GridBase2, _super);
  function GridBase2() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  Object.defineProperty(GridBase2.prototype, "rowsOfItems", {
    get: function() {
      var _a = this, items = _a.items, columnCount = _a.columnCount;
      return toMatrix(items, columnCount);
    },
    enumerable: false,
    configurable: true
  });
  Object.defineProperty(GridBase2.prototype, "classNames", {
    get: function() {
      var _a = this, theme = _a.theme, styles = _a.styles;
      return getClassNames(styles, { theme: theme });
    },
    enumerable: false,
    configurable: true
  });
  GridBase2.prototype.render = function(h) {
    var _this = this;
    var _a = this, classNames = _a.classNames, rowsOfItems = _a.rowsOfItems;
    return h("table", {
      class: classNames.root
    }, [
      h("tbody", rowsOfItems.map(function(rows, rowIndex) {
        return h("tr", {
          key: "".concat(_this.uid, "-").concat(rowIndex, "-row"),
          attrs: { role: "row" }
        }, rows.map(function(cell, cellIndex) {
          return h("td", {
            key: "".concat(_this.uid, "-").concat(rowIndex, "-").concat(cellIndex, "-cell"),
            class: classNames.tableCell
          }, _this.$scopedSlots.default ? _this.$scopedSlots.default({ cell: cell, index: cellIndex }) : null);
        }));
      }))
    ]);
  };
  __decorate([
    Prop(),
    __metadata("design:type", Array)
  ], GridBase2.prototype, "items", void 0);
  __decorate([
    Prop(),
    __metadata("design:type", Number)
  ], GridBase2.prototype, "columnCount", void 0);
  GridBase2 = __decorate([
    Component({
      components: {},
      inheritAttrs: false
    })
  ], GridBase2);
  return GridBase2;
}(BaseComponent);

export { GridBase };
