ze-react-component-library
Version:
ZeroETP React Component Library
49 lines (41 loc) • 1.81 kB
JavaScript
import React from 'react';
import { BarsOutlined } from '@ant-design/icons';
import { EntityType } from '../const';
import './Entity.less';
var Entity = function Entity(props) {
var _a;
var entity = props === null || props === void 0 ? void 0 : props.data;
var getCls = function getCls() {
if ((entity === null || entity === void 0 ? void 0 : entity.entityType) === EntityType.FACT) {
return 'fact';
}
if ((entity === null || entity === void 0 ? void 0 : entity.entityType) === EntityType.DIM) {
return 'dim';
}
if ((entity === null || entity === void 0 ? void 0 : entity.entityType) === EntityType.OTHER) {
return 'other';
}
return '';
};
return /*#__PURE__*/React.createElement("div", {
className: "entity-container " + getCls()
}, /*#__PURE__*/React.createElement("div", {
className: "content " + getCls()
}, /*#__PURE__*/React.createElement("div", {
className: "head"
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BarsOutlined, {
className: "type"
}), /*#__PURE__*/React.createElement("span", null, entity === null || entity === void 0 ? void 0 : entity.entityName))), /*#__PURE__*/React.createElement("div", {
className: "body"
}, (_a = entity === null || entity === void 0 ? void 0 : entity.properties) === null || _a === void 0 ? void 0 : _a.map(function (property) {
return /*#__PURE__*/React.createElement("div", {
className: "body-item",
key: property.propertyId
}, /*#__PURE__*/React.createElement("div", {
className: "name"
}, property === null || property === void 0 ? void 0 : property.propertyName), /*#__PURE__*/React.createElement("div", {
className: "type"
}, property.propertyType));
}))));
};
export default Entity;