diff --git a/build/TableCell.js b/build/TableCell.js index 5d7a501..7becb5c 100644 --- a/build/TableCell.js +++ b/build/TableCell.js @@ -436,7 +436,7 @@ var TableCell = function (_Component) { className: className, onClick: this.handleClick, title: title, - style: { color: fontColor, backgroundColor: bgColor } + style: _extends({ color: fontColor, backgroundColor: bgColor }, column.style) }, indentText, expandIcon, diff --git a/build/TableRow.js b/build/TableRow.js index aa8ae69..2f1245d 100644 --- a/build/TableRow.js +++ b/build/TableRow.js @@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + var _react = require('react'); var _react2 = _interopRequireDefault(_react); @@ -627,7 +629,7 @@ var TableRow = function (_Component) { lazyEndIndex: lazyEndIndex })); } - var style = { height: height }; + var style = _extends({ height: height }, record ? record.style : undefined); if (!visible) { style.display = 'none'; } diff --git a/demo/demolist/Demo0406.js b/demo/demolist/Demo0406.js new file mode 100644 index 0000000..232f928 --- /dev/null +++ b/demo/demolist/Demo0406.js @@ -0,0 +1,37 @@ +/** + * + * @title 自定义整行和整列样式表格 + * @parent 列渲染 Custom Render + * @description 某行或某列的样式,严格按照react的样式书写规则,即对象内每一个属性的键为小写驼峰式,值为字符串。此demo展示自定义整行或整列的背景色和字体内容颜色。 + * demo0406 + */ + +import React, { Component } from "react"; +import Table from "../../src"; + +const columns = [ + { title: "员工编号", dataIndex: "a", key: "a", width: 150 }, + { title: "员工姓名", dataIndex: "b", key: "b", width:100}, + { title: "性别", dataIndex: "c", key: "c", width: 100,style: {backgroundColor:'#e3f2fd',color:'#505F79'}}, + { title: "部门", dataIndex: "d", key: "d", width: 100 }, + { title: "职级", dataIndex: "e", key: "e", width: 100 } +]; + +const data = [ + { a: "ASVAL_20190328", b: "小张", c: "男", d: "财务二科", e: "M1", key: "1" ,style:{backgroundColor:'#ffebee',color:'#000'}}, + { a: "ASVAL_20190320", b: "小明", c: "男", d: "财务一科", e: "T1", key: "2" }, + { a: "ASVAL_20190312", b: "小红", c: "女", d: "财务一科", e: "T2", key: "3" } +]; + +class Demo0406 extends Component { + render() { + return ( +
{ title }
\n{ desc }
\n 查看源码 \n\n { code }
\n
\n {!!scss_code ?\n { scss_code }
\n
: null }\n