@jbrowse/core
Version:
JBrowse 2 core libraries used by plugins
43 lines (42 loc) • 2.55 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Divider, Typography } from '@mui/material';
import Attributes from "./Attributes.js";
import BaseCard from "./BaseCard.js";
import CoreDetails from "./CoreDetails.js";
import { generateTitle } from "./util.js";
import { ErrorBoundary } from "../../ui/ErrorBoundary.js";
import { ErrorMessage } from "../../ui/index.js";
import { getEnv, getSession } from "../../util/index.js";
import SequenceFeatureDetails from "../SequenceFeatureDetails/index.js";
const coreDetails = [
'name',
'start',
'end',
'strand',
'refName',
'description',
'type',
];
export default function FeatureDetails(props) {
const { omit = [], model, feature, depth = 0 } = props;
const { maxDepth } = model;
const { mate, name = '', id = '', type = '', subfeatures, uniqueId } = feature;
const pm = getEnv(model).pluginManager;
const session = getSession(model);
const ExtraPanel = pm.evaluateExtensionPoint('Core-extraFeaturePanel', null, {
session,
feature,
model,
});
const m = mate;
return (_jsxs(BaseCard, { title: generateTitle(name, id, type), children: [_jsx(Typography, { children: "Core details" }), _jsx(CoreDetails, { ...props }), m ? (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx(Typography, { children: "Mate details" }), _jsx(CoreDetails, { ...props, feature: {
...m,
start: m.start,
end: m.end,
refName: m.refName,
uniqueId: `${uniqueId}-mate`,
} })] })) : null, _jsx(Divider, {}), _jsx(Typography, { children: "Attributes" }), _jsx(Attributes, { attributes: feature, ...props, omit: omit, omitSingleLevel: coreDetails }), _jsx(ErrorBoundary, { FallbackComponent: e => _jsx(ErrorMessage, { error: e.error }), children: _jsx(SequenceFeatureDetails, { ...props }) }), ExtraPanel ? (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx(BaseCard, { title: ExtraPanel.name, children: _jsx(ExtraPanel.Component, { ...props }) })] })) : null, depth < maxDepth && subfeatures?.length ? (_jsx(BaseCard, { title: "Subfeatures", defaultExpanded: depth < 1, children: subfeatures.map((sub, idx) => (_jsx(FeatureDetails, { feature: {
...sub,
uniqueId: `${uniqueId}_${idx}`,
}, model: model, depth: depth + 1 }, JSON.stringify(sub)))) })) : null] }));
}