@grc/business
Version:
更新sider选项 : forceSubMenuRender
54 lines (53 loc) • 2.09 kB
JavaScript
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 React from "react";
import { Table } from "@grc/base/components/table";
import { IntlFormattedMessageEnhance } from "@grc/base/components/intl";
var DEFAULT_COLUMNS = [
// 行序
{
title: React.createElement(IntlFormattedMessageEnhance, { intlId: "gbc.component.importFile.position" }),
dataIndex: "position",
width: 60,
align: "center"
},
// 数据编号
{
title: React.createElement(IntlFormattedMessageEnhance, { intlId: "gbc.component.importFile.dataIndex" }),
dataIndex: "dataIndex",
width: 160,
align: "center"
},
// 错误类型
{
title: React.createElement(IntlFormattedMessageEnhance, { intlId: "gbc.component.importFile.reason" }),
dataIndex: "reason",
align: "center"
}
];
function getColumn(columns) {
if (!columns || !columns.length)
columns = DEFAULT_COLUMNS;
return columns.map(function (column) {
var width = column.width;
if (typeof width === "undefined")
return column;
var render = function (text, record) { return (React.createElement("span", { className: "text-overflow", style: { maxWidth: width } }, text)); };
return __assign(__assign({}, column), { render: render });
});
}
export function FailReasonDefaultComponent(props) {
var dataSource = props.dataSource, _a = props.columns, columns = _a === void 0 ? [] : _a;
if (!dataSource || !dataSource.length)
return null;
return (React.createElement(Table, { columns: getColumn(columns), scroll: { y: true }, dataSource: dataSource, pagination: false, rowKey: function (record) { return JSON.stringify(record); } }));
}