"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireWildcard(require("react"));

var _mobxReactLite = require("mobx-react-lite");

var _TableContext = _interopRequireDefault(require("./TableContext"));

var VirtualVerticalContainer = function VirtualVerticalContainer(props) {
  var children = props.children,
      renderBefore = props.renderBefore;

  var _useContext = (0, _react.useContext)(_TableContext["default"]),
      tableStore = _useContext.tableStore;

  var virtualStartIndex = tableStore.virtualStartIndex;
  var virtualEndIndex = tableStore.virtualEndIndex;
  var rows = [];

  if (renderBefore) {
    var before = renderBefore(virtualStartIndex);

    if (before) {
      rows.push(before);
    }
  }

  while (virtualStartIndex < virtualEndIndex) {
    rows.push(children(virtualStartIndex));
    virtualStartIndex++;
  }

  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, rows);
};

VirtualVerticalContainer.displayName = 'VirtualVerticalContainer';

var _default = (0, _mobxReactLite.observer)(VirtualVerticalContainer);

exports["default"] = _default;
//# sourceMappingURL=VirtualVerticalContainer.js.map
