UNPKG

@jbrowse/plugin-linear-genome-view

Version:

JBrowse 2 linear genome view

28 lines (27 loc) 1.72 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const mobx_react_1 = require("mobx-react"); const Block_1 = require("./Block"); const MaxHeightReachedIndicator_1 = __importDefault(require("./MaxHeightReachedIndicator")); const RenderedBlocks = (0, mobx_react_1.observer)(function ({ model, }) { const { blockDefinitions, blockState } = model; return blockDefinitions.map(block => { const key = `${model.id}-${block.key}`; if (block.type === 'ContentBlock') { const state = blockState.get(block.key); return ((0, jsx_runtime_1.jsxs)(Block_1.ContentBlock, { block: block, children: [(state === null || state === void 0 ? void 0 : state.ReactComponent) ? ((0, jsx_runtime_1.jsx)(state.ReactComponent, { model: state })) : null, (state === null || state === void 0 ? void 0 : state.maxHeightReached) ? ((0, jsx_runtime_1.jsx)(MaxHeightReachedIndicator_1.default, { top: state.layout.getTotalHeight() - 16 })) : null] }, key)); } else if (block.type === 'ElidedBlock') { return (0, jsx_runtime_1.jsx)(Block_1.ElidedBlock, { width: block.widthPx }, key); } else if (block.type === 'InterRegionPaddingBlock') { return ((0, jsx_runtime_1.jsx)(Block_1.InterRegionPaddingBlock, { width: block.widthPx, style: { background: 'none' }, boundary: block.variant === 'boundary' }, key)); } throw new Error(`invalid block type ${JSON.stringify(block)}`); }); }); exports.default = RenderedBlocks;