import * as React from 'react';
import HelpBlock from '../../components/HelpBlock';
import SimpleButton from '../../components/SimpleButton';
import { PopupPanel } from '../Components/Popups/AdaptablePopup/PopupPanel';
import { DataImportWizard } from './DataImportWizard';
import { Box } from '../../components/Flex';
export const DataImportPopup = (props) => {
    const [isWizardOpen, setIsWizardOpen] = React.useState(false);
    React.useEffect(() => {
        if (props?.popupParams == undefined ||
            (props.popupParams?.action === 'New' && props.popupParams?.source !== 'ModuleMenu')) {
            setIsWizardOpen(true);
        }
    }, []);
    return (React.createElement(React.Fragment, null,
        React.createElement(PopupPanel, { headerText: 'Data Import', glyphicon: 'import', infoLink: props.moduleInfo.HelpPage },
            React.createElement(Box, null,
                React.createElement(HelpBlock, { className: "twa:mb-2 twa:text-3" }, "Click the 'Import Data' button to Insert or Update data into AdapTable"),
                React.createElement(SimpleButton, { icon: "import", variant: "raised", onClick: () => setIsWizardOpen(true) }, "Import Data"))),
        isWizardOpen && (React.createElement(DataImportWizard, { onClose: () => {
                setIsWizardOpen(false);
                if (props?.popupParams == undefined ||
                    ['Toolbar', 'ContextMenu', 'ColumnMenu', 'ModuleButton'].includes(props?.popupParams?.source)) {
                    props.onClosePopup();
                }
            } }))));
};
