UNPKG

@rcsb/rcsb-saguaro-app

Version:
33 lines 1.92 kB
import { __awaiter } from "tslib"; import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; import React from "react"; import { GroupChartLayout } from "../RcsbGroupChart/GroupChartLayout"; import { ResidueChartTools as RCT } from "./ResidueChartTools/ResidueChartTools"; import * as classes from "../../../scss/bootstrap-group-display.module.scss"; import { FacetTools } from "../../../RcsbSeacrh/FacetTools"; export class RcsbResidueChartComponent extends React.Component { render() { var _a, _b; if ((_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.flat().filter((e) => { var _a, _b; return ((_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.chartMap) === null || _b === void 0 ? void 0 : _b.get(e)); })) { return (_jsx("div", { className: classes.bootstrapGroupComponentScope, children: _jsx(GroupChartLayout, { layout: this.state.layout, chartMap: this.state.chartMap }) })); } return _jsx(_Fragment, {}); } componentDidMount() { return __awaiter(this, void 0, void 0, function* () { yield this.updateState(); }); } updateState() { return __awaiter(this, void 0, void 0, function* () { const charts = (yield (yield RCT.getResidueDistribution(this.props))) .filter(chart => (!this.props.facetLayoutGrid || this.props.facetLayoutGrid.includes(chart.attribute))) .map(ch => { var _a; return FacetTools.addChartDisplayConfig(ch, (_a = this.props.chartDisplayConfig) !== null && _a !== void 0 ? _a : {}); }); this.setState({ layout: charts.map(c => c.attribute), chartMap: charts.reduce((prev, curr) => (prev.set(curr.attribute, [curr])), new Map()) }); }); } } //# sourceMappingURL=RcsbResidueChartComponent.js.map