@rcsb/rcsb-saguaro-app
Version:
RCSB 1D Saguaro Web App
37 lines • 2.1 kB
JavaScript
import { __awaiter } from "tslib";
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import React from "react";
import * as classes from "../../../scss/bootstrap-group-display.module.scss";
import { GroupChartLayout } from "./GroupChartLayout";
import { FacetTools } from "../../../RcsbSeacrh/FacetTools";
import { rcsbRequestCtxManager } from "../../../RcsbRequest/RcsbRequestContextManager";
import { SearchQueryTools as SQT } from "../../../RcsbSeacrh/SearchQueryTools";
export class RcsbStatsChartComponent extends React.Component {
componentDidMount() {
return __awaiter(this, void 0, void 0, function* () {
yield this.updateState();
});
}
render() {
var _a;
if ((_a = this.state) === null || _a === void 0 ? void 0 : _a.facets)
return (_jsx("div", { className: classes.bootstrapGroupComponentScope, children: _jsx(GroupChartLayout, { layout: this.props.facetStore.facetLayoutGrid, chartMap: FacetTools.getResultDrilldowns(this.props.facetStore.getFacetService("all"), this.state.facets).reduce((prev, current) => {
return prev.set(current.attribute, [current]);
}, new Map()) }) }));
return _jsx(_Fragment, {});
}
updateState() {
return __awaiter(this, void 0, void 0, function* () {
let facets = [];
for (const service of this.props.facetStore.getServices()) {
if (this.props.searchQuery.query) {
const groupProperties = yield rcsbRequestCtxManager.getSearchQueryFacets(this.props.searchQuery.query, this.props.facetStore.getFacetService(service).map(f => f.facet), this.props.facetStore.returnType, SQT.searchContentType(this.props.searchQuery));
if (groupProperties === null || groupProperties === void 0 ? void 0 : groupProperties.facets)
facets = facets.concat(groupProperties.facets);
}
}
this.setState({ facets });
});
}
}
//# sourceMappingURL=RcsbStatsChartComponent.js.map