"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.Grid = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireWildcard(require("react"));
var _getToolbarCollectionFeaturesInitializers = require("../../state/getToolbarCollectionFeaturesInitializers");
var _ToolbarCollectionContentAutoSizer = require("../ToolbarCollectionContentAutoSizer");
var _GridPlaceholderStates = require("./GridPlaceholderStates");
var _CollectionCard = require("../CollectionCard");
var _ToolbarCollection = require("../ToolbarCollection");
var _mobxReactLite = require("mobx-react-lite");
var _useToolbarCollectionSyncProps = require("../ToolbarCollection/useToolbarCollectionSyncProps");
var _GridSingleGridContent = require("./GridSingleGridContent");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/Grid/Grid.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function _Grid(props) {
  const {
    state,
    dragAndDrop,
    renderError,
    errorState = renderError && ((err, {
      isOnline,
      retry
    }) => renderError == null ? void 0 : renderError({
      err,
      isOnline,
      retry
    })),
    emptyState,
    noResultsState,
    cardProps,
    dataHook,
    exportModal,
    sections
  } = props;
  const {
    toolbar
  } = state;
  (0, _useToolbarCollectionSyncProps.useToolbarCollectionSyncProps)({
    ...props,
    state: state.toolbar,
    isUsingDragAndDrop: !!dragAndDrop,
    isUsingBulkActionsToolbar: false,
    isUsingHorizontalScroll: false,
    isUsingFolders: false,
    isUsingTableVirtualization: false
  });
  (0, _react.useEffect)(() => state.init({
    featuresInitializers: (0, _getToolbarCollectionFeaturesInitializers.getToolbarCollectionFeaturesInitializers)(props)
  }), []);
  return /*#__PURE__*/_react.default.createElement(_CollectionCard.CollectionCard, (0, _extends2.default)({
    errorState: false,
    state: toolbar,
    dataHook: dataHook
  }, cardProps, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 119,
      columnNumber: 5
    }
  }), /*#__PURE__*/_react.default.createElement(_ToolbarCollection.ToolbarCollection, (0, _extends2.default)({}, props, {
    sticky: true,
    state: toolbar,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 125,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_GridPlaceholderStates.GridPlaceholderStates, {
    state: state.toolbar,
    errorState: errorState,
    emptyState: emptyState,
    noResultsState: noResultsState,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 126,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_ToolbarCollectionContentAutoSizer.ToolbarCollectionContentAutoSizer, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 132,
      columnNumber: 11
    }
  }, sections ? /*#__PURE__*/_react.default.createElement(sections.GridSections, (0, _extends2.default)({}, props, {
    renderSection: sections.renderSection,
    state: state,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 134,
      columnNumber: 15
    }
  })) : /*#__PURE__*/_react.default.createElement(_GridSingleGridContent.GridSingleGridContent, (0, _extends2.default)({}, props, {
    state: state,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 140,
      columnNumber: 15
    }
  }))))), exportModal ?? toolbar.featuredComponents.exportModal.value);
}
const Grid = exports.Grid = (0, _mobxReactLite.observer)(_Grid);
//# sourceMappingURL=Grid.js.map