@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
46 lines (45 loc) • 4.68 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import { connect } from 'react-redux';
import { ProgressIndicator } from '../components/ProgressIndicator/ProgressIndicator';
import { ToastContainer } from '../components/Toastify';
import * as PopupRedux from '../Redux/ActionsReducers/PopupRedux';
import { AdaptablePopup } from './Components/Popups/AdaptablePopup';
import { AdaptablePopupConfirmation } from './Components/Popups/AdaptablePopupConfirmation';
import { AdaptablePopupPrompt } from './Components/Popups/AdaptablePopupPrompt';
import { FormPopups } from './Components/Popups/FormPopups/FormPopups';
import { GridCellPopup } from './Components/Popups/GridCellPopup';
import { WindowPopups } from './Components/Popups/WindowPopups/WindowPopups';
import { Dashboard } from './Dashboard/Dashboard';
import { LicenseWatermark } from './License';
import { QuickSearchDrawer } from './QuickSearch/FloatingQuickSearch/FloatingQuickSearch';
import { renderWithAdaptableContext } from './renderWithAdaptableContext';
class AdaptableView extends React.Component {
render() {
const watermark = this.props.AdaptableApi?.internalApi?.getInternalState()?.License?.watermark;
const adaptableOptions = this.props.AdaptableApi.optionsApi.getAdaptableOptions();
return (_jsxs("div", { children: [_jsx(GridCellPopup, {}), _jsx(QuickSearchDrawer, {}), this.props.AdaptableApi.internalApi
.getModuleService()
.isAdapTableModulePresent('Dashboard') && _jsx(Dashboard, { api: this.props.AdaptableApi }), this.props.PopupState.PromptPopup.ShowPromptPopup && (_jsx(AdaptablePopupPrompt, { message: this.props.PopupState.PromptPopup.Message, header: this.props.PopupState.PromptPopup.Header, onClose: this.props.onClosePromptPopup, onConfirm: this.props.onConfirmPromptPopup, onConfirmActionCreator: this.props.PopupState.PromptPopup.ConfirmActionCreator, defaultValue: this.props.PopupState.PromptPopup.DefaultValue })), Boolean(this.props.PopupState.ConfirmationPopup.ShowConfirmationPopup) && (_jsx(AdaptablePopupConfirmation, { header: this.props.PopupState.ConfirmationPopup.Header, messsage: this.props.PopupState.ConfirmationPopup.Msg, showPopup: this.props.PopupState.ConfirmationPopup.ShowConfirmationPopup, cancelButtonText: this.props.PopupState.ConfirmationPopup.CancelButtonText, confirmButtonText: this.props.PopupState.ConfirmationPopup.ConfirmButtonText, onCancel: this.props.onCancelConfirmationPopup, onConfirm: this.props.onConfirmConfirmationPopup, showInputBox: this.props.PopupState.ConfirmationPopup.ShowInputBox, messageType: this.props.PopupState.ConfirmationPopup.MessageType, api: this.props.AdaptableApi })), Boolean(this.props.PopupState.ScreenPopup.ShowScreenPopup) && (_jsx(AdaptablePopup, { componentName: this.props.PopupState.ScreenPopup.ComponentName, componentModule: this.props.PopupState.ScreenPopup.ComponentModule, onHide: this.props.onCloseScreenPopup, api: this.props.AdaptableApi, onClearParams: () => this.props.onClearPopupParams(), moduleParams: this.props.PopupState.ScreenPopup.Params, moduleProps: this.props.PopupState.ScreenPopup.PopupProps })), _jsx(ToastContainer, { containerId: `Toastify-${adaptableOptions.adaptableId}`, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }), watermark?.show && _jsx(LicenseWatermark, { children: watermark?.text }), _jsx(WindowPopups, {}), _jsx(FormPopups, {}), _jsx(ProgressIndicator, {})] }));
}
}
function mapStateToProps(state, ownProps) {
return {
PopupState: state.Popup,
InternalState: state.Internal,
AdaptableApi: ownProps.Adaptable.api,
};
}
function mapDispatchToProps(dispatch) {
return {
onCloseScreenPopup: () => dispatch(PopupRedux.PopupHideScreen()),
onClosePromptPopup: () => dispatch(PopupRedux.PopupHidePrompt()),
onConfirmPromptPopup: (inputText) => dispatch(PopupRedux.PopupConfirmPrompt(inputText)),
onConfirmConfirmationPopup: (comment) => dispatch(PopupRedux.PopupConfirmConfirmation(comment)),
onCancelConfirmationPopup: () => dispatch(PopupRedux.PopupCancelConfirmation()),
showPopup: (componentModule, componentName, params) => dispatch(PopupRedux.PopupShowScreen(componentModule, componentName, params)),
onClearPopupParams: () => dispatch(PopupRedux.PopupClearParam()),
};
}
let AdaptableWrapper = connect(mapStateToProps, mapDispatchToProps)(AdaptableView);
export const AdaptableApp = ({ Adaptable, }) => renderWithAdaptableContext(_jsx(AdaptableWrapper, { Adaptable: Adaptable }), Adaptable);