From 4c4f0ca9cccba833079c44cb1a4c2c24294175a4 Mon Sep 17 00:00:00 2001 From: wanghaoo Date: Thu, 17 Jan 2019 18:42:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=88=97=E5=AF=B9=E9=BD=90=E6=96=B9=E5=BC=8F):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/Table.js | 3 ++- build/TableCell.js | 3 +++ build/TableHeader.js | 10 ++++++++-- build/TableRow.js | 7 +------ package.json | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/build/Table.js b/build/Table.js index 2f42e68..31c7bba 100644 --- a/build/Table.js +++ b/build/Table.js @@ -511,7 +511,8 @@ var Table = function (_Component) { drgHover: column.drgHover, fixed: column.fixed, width: width, - dataindex: column.dataIndex + dataindex: column.dataIndex, + textAlign: column.textAlign }; if (column.onHeadCellClick) { cell.onClick = column.onHeadCellClick; diff --git a/build/TableCell.js b/build/TableCell.js index 0e946f0..88628fe 100644 --- a/build/TableCell.js +++ b/build/TableCell.js @@ -111,6 +111,9 @@ var TableCell = function (_Component) { if (column.fixed && !fixed) { className = className + (' ' + clsPrefix + '-fixed-columns-in-body'); } + if (column.textAlign) { + className = className + (' text-' + column.textAlign); + } return _react2["default"].createElement( 'td', { diff --git a/build/TableHeader.js b/build/TableHeader.js index 6835a00..f42301c 100644 --- a/build/TableHeader.js +++ b/build/TableHeader.js @@ -636,6 +636,11 @@ var TableHeader = function (_Component) { if (lastShowIndex == columIndex) { canDotDrag = "th-can-not-drag"; } + var thClassName = "" + da.className ? "" + da.className : ''; + if (da.textAlign) { + thClassName += " text-" + da.textAlign; + } + delete da.textAlign; var keyTemp = {}; //避免key为undefined // if(da.dataindex && da.key ===undefined ){ @@ -651,7 +656,7 @@ var TableHeader = function (_Component) { } var thDefaultObj = {}; - var thClassName = "" + da.className ? "" + da.className : ''; + if (draggable) { thClassName += clsPrefix + "-thead th-drag " + thHover + " "; } @@ -659,6 +664,7 @@ var TableHeader = function (_Component) { thClassName += clsPrefix + "-thead-th " + canDotDrag; } thClassName += " " + fixedStyle; + if (!da.fixed) { return _react2["default"].createElement( @@ -678,7 +684,7 @@ var TableHeader = function (_Component) { ); } else { thDefaultObj = _extends({}, da, { - className: da.className + " " + fixedStyle + className: thClassName + " " + fixedStyle }); da.onClick ? thDefaultObj.onClick = function (e) { da.onClick(da, e); diff --git a/build/TableRow.js b/build/TableRow.js index 0fb80fc..bdca375 100644 --- a/build/TableRow.js +++ b/build/TableRow.js @@ -128,13 +128,8 @@ var TableRow = function (_Component) { TableRow.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { if (this.props.treeType) { this.setRowParentIndex(); - this.setRowHeight(); - // if(this.props.fixedIndex!== prevProps.fixedIndex){ - // this.setRowHeight() - // } - } else if (this.props.index !== prevProps.index) { - this.setRowHeight(); } + this.setRowHeight(); }; TableRow.prototype.componentWillUnmount = function componentWillUnmount() { diff --git a/package.json b/package.json index 6087de8..a3f2e1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bee-table", - "version": "1.6.30", + "version": "1.6.31", "description": "Table ui component for react", "keywords": [ "react",