@bos-alpha/data
Version:
数据管理
106 lines (105 loc) • 5.58 kB
JavaScript
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 styled from '@emotion/styled';
import { prefixCls, uuid } from '@bos-alpha/common';
import { ResizableTable } from '@bos-alpha/common/lib/components/table/resizable-table';
import relation from '../img-base64/relation';
export var RelationList = function (_a) {
var bosclass = _a.bosclass, dataSource = _a.dataSource;
var columnsLeft = [
{
title: '左对象',
dataIndex: 'left',
width: 210,
minWidth: 70
},
{
title: '关系类',
dataIndex: 'name',
width: 210,
minWidth: 70
},
{
title: '右对象',
dataIndex: 'right',
width: 210,
minWidth: 70
},
{
title: '关联关系',
dataIndex: 'ratio',
width: 210,
minWidth: 70,
render: function (ratio, record) { return (_jsxs("span", { children: [record.left, ":", record.right, "=", ratio] }, void 0)); }
}
];
var columnsRight = [
{
title: '左对象',
dataIndex: 'left',
width: 210,
minWidth: 70
},
{
title: '关系类',
dataIndex: 'name',
width: 210,
minWidth: 70
},
{
title: '右对象',
dataIndex: 'right',
width: 210,
minWidth: 70
},
{
title: '关联关系',
dataIndex: 'ratio',
width: 210,
minWidth: 70,
render: function (ratio, record) { return (_jsxs("span", { children: [record.left, ":", record.right, "=", ratio] }, void 0)); }
}
];
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: "" }, void 0), _jsxs("span", { children: [bosclass, "\u4F5C\u4E3A\u5DE6\u5BF9\u8C61\u7684\u5173\u7CFB"] }, void 0)] }, void 0), _jsx(ResizableTable, { rowKey: function () { return uuid(); }, columns: columnsLeft, dataSource: leftRelations, scroll: {
x: 1000,
y: 400
}, pagination: {
size: 'small',
showSizeChanger: true,
showQuickJumper: true,
showTotal: function (total, range) {
var page = Math.floor(range[0] / 10) + 1;
return "\u5171".concat(total, "\u6761\uFF0C\u5F53\u524D\u7B2C").concat(page, "\u9875");
}
} }, void 0)] }), void 0), _jsxs("div", __assign({ className: "table-item" }, { children: [_jsxs(Title, { children: [_jsx("img", { className: "icon", src: relation, alt: "" }, void 0), _jsxs("span", { children: [bosclass, "\u4F5C\u4E3A\u53F3\u5BF9\u8C61\u7684\u5173\u7CFB"] }, void 0)] }, void 0), _jsx(ResizableTable, { rowKey: function () { return uuid(); }, columns: columnsRight, dataSource: rightRelations, scroll: {
x: 1000,
y: 400
}, pagination: {
size: 'small',
showSizeChanger: true,
showQuickJumper: true,
showTotal: function (total, range) {
var page = Math.floor(range[0] / 10) + 1;
return "\u5171".concat(total, "\u6761\uFF0C\u5F53\u524D\u7B2C").concat(page, "\u9875");
}
} }, void 0)] }), void 0)] }, void 0));
};
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .", "-table {\n color: rgba(0, 0, 0, 0.65);\n }\n & > .table-item {\n margin-bottom: 10px;\n }\n"], ["\n .", "-table {\n color: rgba(0, 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;