@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
35 lines (34 loc) • 2.85 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import { connect } from 'react-redux';
import * as DashboardRedux from '../../Redux/ActionsReducers/DashboardRedux';
import { PopupPanel } from '../Components/Popups/AdaptablePopup/PopupPanel';
import { ACCESS_LEVEL_FULL, ACCESS_LEVEL_READ_ONLY, } from '../../Utilities/Constants/GeneralConstants';
import { DashboardPopupSections } from './DashboardPopupSections';
class DashboardPopupComponent extends React.Component {
render() {
const dashboardAccessLevel = this.props.api.entitlementApi.getEntitlementAccessLevelForModule('Dashboard');
const areDashboardSettingsVisible = dashboardAccessLevel == ACCESS_LEVEL_FULL || dashboardAccessLevel == ACCESS_LEVEL_READ_ONLY;
const isDashboardDisabled = dashboardAccessLevel === ACCESS_LEVEL_READ_ONLY;
return (_jsx(PopupPanel, { headerText: this.props.moduleInfo.FriendlyName, glyphicon: this.props.moduleInfo.Glyph, infoLink: this.props.moduleInfo.HelpPage, infoLinkDisabled: !this.props.api.internalApi.isDocumentationLinksDisplayed(), bodyClassName: "twa:gap-3 twa:flex twa:flex-col", children: _jsx(DashboardPopupSections, { DashboardState: this.props.DashboardState, InternalState: this.props.InternalState, IsCollapsed: this.props.IsCollapsed, IsHidden: this.props.IsHidden, IsFloating: this.props.IsFloating, isDashboardDisabled: isDashboardDisabled, areDashboardSettingsVisible: areDashboardSettingsVisible, canFloat: this.props.api.optionsApi.getDashboardOptions().canFloat ?? false, onDashboardSetModuleButtons: this.props.onDashboardSetModuleButtons, onDashboardSetTabs: this.props.onDashboardSetTabs, onSetDashboardCollapsed: this.props.onSetDashboardCollapsed, onSetDashboardHidden: this.props.onSetDashboardHidden, onSetDashboardFloating: this.props.onSetDashboardFloating }) }));
}
}
function mapStateToProps(state, ownProps) {
return {
DashboardState: state.Dashboard,
InternalState: state.Internal,
IsCollapsed: state.Dashboard.IsCollapsed,
IsHidden: state.Dashboard.IsHidden,
IsFloating: state.Dashboard.IsFloating,
};
}
function mapDispatchToProps(dispatch) {
return {
onDashboardSetModuleButtons: (moduleButtons) => dispatch(DashboardRedux.DashboardSetModuleButtons(moduleButtons)),
onDashboardSetTabs: (Tabs) => dispatch(DashboardRedux.DashboardSetTabs(Tabs)),
onSetDashboardCollapsed: (isCollapsed) => dispatch(DashboardRedux.DashboardSetIsCollapsed(isCollapsed)),
onSetDashboardHidden: (isHidden) => dispatch(DashboardRedux.DashboardSetIsHidden(isHidden)),
onSetDashboardFloating: (isFloating) => dispatch(DashboardRedux.DashboardSetIsFloating(isFloating)),
};
}
export let DashboardPopup = connect(mapStateToProps, mapDispatchToProps)(DashboardPopupComponent);