import * as React from 'react'; import { ReactElement } from 'react'; import { TemplateProps } from '../props'; import { getPropertyValues } from './utils'; const CLASS_NAME = 'ontodia-default-template'; export class DefaultElementTemplate extends React.Component { render() { const props = this.props; const image = props.imgUrl ? (
) : undefined; const expander = props.isExpanded ? (
IRI:
{props.iri}

{this.renderPropertyTable()}
) : null; return (
{props.types}
{image}
{props.label} {expander}
); } renderPropertyTable() { const {propsAsList} = this.props; if (propsAsList && propsAsList.length > 0) { return
{propsAsList.map(prop => { const propertyValues = getPropertyValues(prop.property); const values = propertyValues.map((text, index) => (
{text}
)); return (
{prop.name}
{values}
); })}
; } else { return
no properties
; } } }