UNPKG

fastlion-amis

Version:

一种MIS页面生成工具

76 lines (75 loc) 5.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SubordinateTr = void 0; var tslib_1 = require("tslib"); var react_1 = tslib_1.__importStar(require("react")); var tpl_1 = require("../../../../../../../utils/tpl"); var index_1 = require("../../../../../../../index"); var SubordinateAreaContainer = function (_a) { var columns = _a.columns, source = _a.source; return react_1.default.createElement(react_1.default.Fragment, null, columns === null || columns === void 0 ? void 0 : columns.map(function (column) { var _a, _b; if ((column === null || column === void 0 ? void 0 : column.name) === "checkbox" || (column === null || column === void 0 ? void 0 : column.buttons)) return null; return (react_1.default.createElement("td", { className: "tbody-td--column" }, react_1.default.createElement("div", { style: { width: (column === null || column === void 0 ? void 0 : column.width) ? column === null || column === void 0 ? void 0 : column.width : 50, fontSize: '12px' }, className: 'tbody-td--column--cell' }, react_1.default.createElement("span", { className: "tbody-td--column--cell--container" }, ((_a = column === null || column === void 0 ? void 0 : column.group) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (_b = column === null || column === void 0 ? void 0 : column.group) === null || _b === void 0 ? void 0 : _b.map(function (group, groupIndex) { var hide = (group === null || group === void 0 ? void 0 : group.hiddenOn) ? (0, tpl_1.evalExpression)(group === null || group === void 0 ? void 0 : group.hiddenOn, (0, tslib_1.__assign)({}, source)) : false; if (hide) return null; var temp_element; if (group === null || group === void 0 ? void 0 : group.type) { temp_element = (0, index_1.render)({ type: group === null || group === void 0 ? void 0 : group.type, name: group === null || group === void 0 ? void 0 : group.name, body: group === null || group === void 0 ? void 0 : group.body }, { data: source }); } return (react_1.default.createElement("div", { key: groupIndex, className: "tbody-td--column--cell--item" }, (group === null || group === void 0 ? void 0 : group.hideLabel) ? null : react_1.default.createElement("span", { style: { color: '#999' } }, group === null || group === void 0 ? void 0 : group.label, "\uFF1A"), react_1.default.createElement("span", null, group.type ? temp_element : source[group === null || group === void 0 ? void 0 : group.name]))); }) : [''].map(function (_) { var temp_element; var hide = (column === null || column === void 0 ? void 0 : column.hiddenOn) ? (0, tpl_1.evalExpression)(column === null || column === void 0 ? void 0 : column.hiddenOn, (0, tslib_1.__assign)({}, source)) : false; if (hide) return null; if (column.type) { temp_element = (0, index_1.render)({ type: column.type, name: column.name, body: column === null || column === void 0 ? void 0 : column.body }, { data: source }); } return react_1.default.createElement("div", { className: "tbody-td--column--cell--item", key: _ }, react_1.default.createElement("span", null, column.type ? temp_element : source[column === null || column === void 0 ? void 0 : column.name])); }))))); })); }; var SubordinateTr = function (_a) { var colHide = _a.colHide, subordinateElevae = _a.subordinateElevae, fixColumns = _a.fixColumns, source = _a.source, trClick = _a.trClick, subId = _a.subId; // const subordinateList = useMemo(() => { // if (colHide) return Array.from({ length: subordinateQuantity ?? 0 }) // return Array.from({ length: subordinateQuantity ?? 0 }).slice(0, 4) // }, [colHide, subordinateQuantity]) var subordinateList = (0, react_1.useMemo)(function () { if (colHide) return source; return source.slice(0, 4); }, [colHide, source]); return subordinateList.map(function (item, trIndex) { return (react_1.default.createElement("tr", { className: "tbody-tr--column--common tbody-tr--column--white", key: trIndex, style: { height: subordinateElevae }, onMouseOut: function () { } }, react_1.default.createElement("td", { className: "tbody-td--column" }), react_1.default.createElement(SubordinateAreaContainer, { source: item, columns: fixColumns }), react_1.default.createElement("td", { className: "tbody-td--column thead-th--column tbody-td--opreation" }))); }); }; exports.SubordinateTr = SubordinateTr; //# sourceMappingURL=./renderers/Lion/Table/LionTable/assembly/table/intermediateArea/subordinateTr.js.map