@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
37 lines (36 loc) • 2.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CellSummaryPopup = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_redux_1 = require("react-redux");
const InternalRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/InternalRedux"));
const CellSummaryDetails_1 = require("./CellSummaryDetails");
const PanelWithButton_1 = require("../Components/Panels/PanelWithButton");
class CellSummaryPopupComponent extends React.Component {
componentDidMount() {
if (this.props.popupParams?.source === 'ColumnMenu' && this.props.popupParams?.column) {
// if the summary was requested from the column menu, we need to select the entire column
// afterwards, we will go on with the cell summary logic, as that will evaluate the current(column) cell selection
this.props.api.columnApi.selectColumn(this.props.popupParams?.column.columnId);
// we also need to update the internal state of the selected cells
this.props.api.internalApi.getAdaptableInstance().refreshSelectedCellsState();
}
this.props.onCreateCellSummary();
}
render() {
return (React.createElement(PanelWithButton_1.PanelWithButton, { headerText: this.props.moduleInfo.FriendlyName, glyphicon: this.props.moduleInfo.Glyph, infoLink: this.props.moduleInfo.HelpPage, infoLinkDisabled: !this.props.api.internalApi.isDocumentationLinksDisplayed() },
React.createElement(CellSummaryDetails_1.CellSummaryDetails, { CellSummary: this.props.CellSummary })));
}
}
function mapStateToProps(state, ownProps) {
return {
CellSummary: state.Internal.CellSummary.CellSummaryInfo,
};
}
function mapDispatchToProps(dispatch) {
return {
onCreateCellSummary: () => dispatch(InternalRedux.CreateCellSummaryInfo()),
};
}
exports.CellSummaryPopup = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(CellSummaryPopupComponent);