@adaptabletools/adaptable
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
31 lines (30 loc) • 1.62 kB
JavaScript
import * as React from 'react';
import { UIHelper } from '../../../UIHelper';
import { AdaptableViewFactory } from '../../../AdaptableViewFactory';
import { AdaptablePopupModuleView } from './AdaptablePopupModuleView';
export const AdaptablePopupBody = (props) => {
const modalContainer = UIHelper.getModalContainer(props.api.optionsApi.getAdaptableOptions(), document);
const moduleName = props.module.moduleInfo.ModuleName;
const accessLevel = props.api.entitlementApi.getEntitlementAccessLevelForModule(moduleName);
const moduleInfo = props.api.internalApi.getModuleService().getModuleInfoByModule(moduleName);
const moduleProps = {
popupParams: props.moduleParams,
onClearPopupParams: () => (props.onClearParams ? props.onClearParams() : null),
onClosePopup: () => {
if (props.onHide) {
props.onHide();
}
},
// show share button if TeamSharing is active & user has edit rights
teamSharingActivated: props.api.teamSharingApi.isTeamSharingAvailable() &&
props.api.teamSharingApi.hasTeamSharingFullRights(),
modalContainer: modalContainer,
accessLevel: accessLevel,
api: props.api,
moduleInfo,
};
const BodyComponent = AdaptableViewFactory?.[props?.componentName ?? moduleInfo.Popup] || AdaptablePopupModuleView;
// key is to make sure state is reset between views
// most of the views use the `AdaptablePopupModuleView` component
return React.createElement(BodyComponent, { key: props?.componentName, module: props.module, ...moduleProps });
};