@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
65 lines (64 loc) • 5.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AdaptableApp = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_redux_1 = require("react-redux");
const ProgressIndicator_1 = require("../components/ProgressIndicator/ProgressIndicator");
const Toastify_1 = require("../components/Toastify");
const PopupRedux = tslib_1.__importStar(require("../Redux/ActionsReducers/PopupRedux"));
const AdaptablePopup_1 = require("./Components/Popups/AdaptablePopup");
const AdaptablePopupConfirmation_1 = require("./Components/Popups/AdaptablePopupConfirmation");
const AdaptablePopupPrompt_1 = require("./Components/Popups/AdaptablePopupPrompt");
const FormPopups_1 = require("./Components/Popups/FormPopups/FormPopups");
const GridCellPopup_1 = require("./Components/Popups/GridCellPopup");
const WindowPopups_1 = require("./Components/Popups/WindowPopups/WindowPopups");
const Dashboard_1 = require("./Dashboard/Dashboard");
const License_1 = require("./License");
const FloatingQuickSearch_1 = require("./QuickSearch/FloatingQuickSearch/FloatingQuickSearch");
const renderWithAdaptableContext_1 = require("./renderWithAdaptableContext");
class AdaptableView extends React.Component {
render() {
const watermark = this.props.AdaptableApi?.internalApi?.getInternalState()?.License?.watermark;
const adaptableOptions = this.props.AdaptableApi.optionsApi.getAdaptableOptions();
return (React.createElement("div", null,
React.createElement(GridCellPopup_1.GridCellPopup, null),
React.createElement(FloatingQuickSearch_1.QuickSearchDrawer, null),
this.props.AdaptableApi.internalApi
.getModuleService()
.isAdapTableModulePresent('Dashboard') && React.createElement(Dashboard_1.Dashboard, { api: this.props.AdaptableApi }),
this.props.PopupState.PromptPopup.ShowPromptPopup && (React.createElement(AdaptablePopupPrompt_1.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) && (React.createElement(AdaptablePopupConfirmation_1.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) && (React.createElement(AdaptablePopup_1.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 })),
React.createElement(Toastify_1.ToastContainer
// Ensure to set containerId to avoid memory leaks when Adaptable instance is destroyed and re-created many times
, {
// Ensure to set containerId to avoid memory leaks when Adaptable instance is destroyed and re-created many times
containerId: `Toastify-${adaptableOptions.adaptableId}`, limit: adaptableOptions.notificationsOptions.maxNotifications, closeButton: false, icon: false, theme: "colored" }),
watermark?.show && React.createElement(License_1.LicenseWatermark, null, watermark?.text),
React.createElement(WindowPopups_1.WindowPopups, null),
React.createElement(FormPopups_1.FormPopups, null),
React.createElement(ProgressIndicator_1.ProgressIndicator, null)));
}
}
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 = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(AdaptableView);
const AdaptableApp = ({ Adaptable, }) => (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(React.createElement(AdaptableWrapper, { Adaptable: Adaptable }), Adaptable);
exports.AdaptableApp = AdaptableApp;