UNPKG

@bos-model-alpha/data

Version:

数据管理

49 lines (48 loc) 3.35 kB
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime"; import { Table } from 'antd'; import styled from '@emotion/styled'; import { prefixCls } from '@bos-alpha/common'; import relation from '../img-base64/relation'; export var RelationList = function (_a) { var bosclass = _a.bosclass, dataSource = _a.dataSource; var columns = [ { title: '左对象', dataIndex: 'left' }, { title: '关系类', dataIndex: 'name' }, { title: '右对象', dataIndex: 'right' }, { title: '关联关系', dataIndex: 'ratio', render: function (ratio, record) { return _jsxs("span", { children: [record.left, ":", record.right, "=", ratio] }); } } ]; var leftRelations = dataSource.filter(function (item) { return item.left === bosclass; }); var rightRelations = dataSource.filter(function (item) { return item.right === bosclass; }); return (_jsxs(Container, { children: [_jsxs("div", __assign({ className: "table-item" }, { children: [_jsxs(Title, { children: [_jsx("img", { className: "icon", src: relation, alt: "" }), _jsxs("span", { children: [bosclass, "\u4F5C\u4E3A\u5DE6\u5BF9\u8C61\u7684\u5173\u7CFB"] })] }), _jsx(Table, { rowKey: function () { return Math.random(); }, columns: columns, dataSource: leftRelations, pagination: false })] })), _jsxs("div", __assign({ className: "table-item" }, { children: [_jsxs(Title, { children: [_jsx("img", { className: "icon", src: relation, alt: "" }), _jsxs("span", { children: [bosclass, "\u4F5C\u4E3A\u53F3\u5BF9\u8C61\u7684\u5173\u7CFB"] })] }), _jsx(Table, { rowKey: function () { return Math.random(); }, columns: columns, dataSource: rightRelations, pagination: false })] }))] })); }; var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .", "-table {\n color: rgba(0,0,0,.65);\n }\n & > .table-item {\n margin-bottom: 10px;\n }\n"], ["\n .", "-table {\n color: rgba(0,0,0,.65);\n }\n & > .table-item {\n margin-bottom: 10px;\n }\n"])), prefixCls); var Title = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n font-weight: 600;\n color: #444;\n padding: 16px 0;\n & > .icon {\n width: 20px;\n height: 20px;\n margin-right: 10px;\n }\n"], ["\n display: flex;\n align-items: center;\n font-weight: 600;\n color: #444;\n padding: 16px 0;\n & > .icon {\n width: 20px;\n height: 20px;\n margin-right: 10px;\n }\n"]))); var templateObject_1, templateObject_2;