pdbe-molstar
Version:
Molstar implementation for PDBe
18 lines (17 loc) • 1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomControls = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const base_1 = require("molstar/lib/mol-plugin-ui/base");
const plugin_custom_state_1 = require("../plugin-custom-state");
/** Render all registered custom UI controls for the specified region */
class CustomControls extends base_1.PluginUIComponent {
componentDidMount() {
this.subscribe(this.plugin.state.behaviors.events.changed, () => this.forceUpdate());
}
render() {
const customControls = Array.from(plugin_custom_state_1.PluginCustomControls.get(this.plugin, this.props.region).entries());
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: customControls.map(([name, Control]) => (0, jsx_runtime_1.jsx)("div", { className: `pdbemolstar-custom-control-${this.props.region}`, children: (0, jsx_runtime_1.jsx)(Control, {}) }, name)) });
}
}
exports.CustomControls = CustomControls;