import React, { useEffect } from 'react';
import { observer } from 'mobx-react-lite';
import { getToolbarCollectionFeaturesInitializers } from '../../state/getToolbarCollectionFeaturesInitializers';
import { TableFoldersLayout } from './TableFoldersLayout';
import { TableProvider } from '../../providers';
import { TableFoldersContent, } from './TableFoldersContent';
import { useTableFoldersSyncProps } from './useTableFoldersSyncProps';
import { MultiCollectionBulkActionModal } from '../BulkAction';
import { runInAction } from 'mobx';
import { minimalRequiredWdsRuntimeCheck } from '../../minimalRequiredWdsRuntimeCheck';
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
        minimalRequiredWdsRuntimeCheck({
            required: '^1.64.1',
            requiredBy: 'WixPatterns/TableFolders',
        });
    }
    useEffect(() => {
        runInAction(() => {
            state.virtual.rowHeight = rowHeight;
        });
    }, [rowHeight]);
    useEffect(() => {
        if (estimatedRowHeight == null) {
            return;
        }
        runInAction(() => {
            state.virtual.estimatedRowHeight = estimatedRowHeight;
        });
    }, [estimatedRowHeight]);
    useTableFoldersSyncProps(props);
    useEffect(() => state.init({
        featuresInitializers: getToolbarCollectionFeaturesInitializers(props),
        hasMultiLevelSorting: multiLevelSorting !== undefined,
    }), []);
    return (React.createElement(TableFoldersLayout, { ...props, state: state },
        React.createElement(TableProvider, { value: state.table },
            React.createElement(TableFoldersContent, { ...props })),
        exportModal ?? state.toolbar.featuredComponents.exportModal.value,
        importModal ?? state.toolbar.featuredComponents.importModal.value,
        bulkActionModal && (React.createElement(MultiCollectionBulkActionModal, { state: state.toolbar, bulkActionModal: bulkActionModal }))));
}
export const TableFolders = observer(_TableFolders);
//# sourceMappingURL=TableFolders.js.map