@jbrowse/core
Version:
JBrowse 2 core libraries used by plugins
25 lines (24 loc) • 1.12 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import Position from "./Position.js";
import SimpleField from "./SimpleField.js";
import { toLocale } from "../../util/index.js";
export default function CoreDetails(props) {
const { feature } = props;
const obj = feature;
const formattedFeat = { ...obj, ...obj.__jbrowsefmt };
const { start, end } = formattedFeat;
const displayedDetails = {
...formattedFeat,
length: toLocale(end - start),
};
const coreRenderedDetails = {
description: 'Description',
name: 'Name',
length: 'Length',
type: 'Type',
};
return (_jsxs(_Fragment, { children: [_jsx(SimpleField, { name: "Position", value: _jsx(Position, { ...props, feature: formattedFeat }) }), Object.entries(coreRenderedDetails)
.map(([key, name]) => [name, displayedDetails[key]])
.filter(([, value]) => value != null)
.map(([name, value]) => (_jsx(SimpleField, { name: name, value: Array.isArray(value) ? value.join(', ') : value }, name)))] }));
}