"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.TableFolders = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireWildcard(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _getToolbarCollectionFeaturesInitializers = require("../../state/getToolbarCollectionFeaturesInitializers");
var _TableFoldersLayout = require("./TableFoldersLayout");
var _providers = require("../../providers");
var _TableFoldersContent = require("./TableFoldersContent");
var _useTableFoldersSyncProps = require("./useTableFoldersSyncProps");
var _BulkAction = require("../BulkAction");
var _mobx = require("mobx");
var _minimalRequiredWdsRuntimeCheck = require("../../minimalRequiredWdsRuntimeCheck");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/TableFolders/TableFolders.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 _TableFolders(props) {
  const {
    state,
    multiLevelSorting,
    rowHeight,
    estimatedRowHeight,
    exportModal,
    importModal,
    bulkActionModal
  } = props;
  if (process.env.NODE_ENV !== 'production') {
    // need this version because of style fixes on the WSR side
    (0, _minimalRequiredWdsRuntimeCheck.minimalRequiredWdsRuntimeCheck)({
      required: '^1.64.1',
      requiredBy: 'WixPatterns/TableFolders'
    });
  }
  (0, _react.useEffect)(() => {
    (0, _mobx.runInAction)(() => {
      state.virtual.rowHeight = rowHeight;
    });
  }, [rowHeight]);
  (0, _react.useEffect)(() => {
    if (estimatedRowHeight == null) {
      return;
    }
    (0, _mobx.runInAction)(() => {
      state.virtual.estimatedRowHeight = estimatedRowHeight;
    });
  }, [estimatedRowHeight]);
  (0, _useTableFoldersSyncProps.useTableFoldersSyncProps)(props);
  (0, _react.useEffect)(() => state.init({
    featuresInitializers: (0, _getToolbarCollectionFeaturesInitializers.getToolbarCollectionFeaturesInitializers)(props),
    hasMultiLevelSorting: multiLevelSorting !== undefined
  }), []);
  return /*#__PURE__*/_react.default.createElement(_TableFoldersLayout.TableFoldersLayout, (0, _extends2.default)({}, props, {
    state: state,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 75,
      columnNumber: 5
    }
  }), /*#__PURE__*/_react.default.createElement(_providers.TableProvider, {
    value: state.table,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 76,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_TableFoldersContent.TableFoldersContent, (0, _extends2.default)({}, props, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 77,
      columnNumber: 9
    }
  }))), exportModal ?? state.toolbar.featuredComponents.exportModal.value, importModal ?? state.toolbar.featuredComponents.importModal.value, bulkActionModal && /*#__PURE__*/_react.default.createElement(_BulkAction.MultiCollectionBulkActionModal, {
    state: state.toolbar,
    bulkActionModal: bulkActionModal,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 82,
      columnNumber: 9
    }
  }));
}
const TableFolders = exports.TableFolders = (0, _mobxReactLite.observer)(_TableFolders);
//# sourceMappingURL=TableFolders.js.map