feat(支持自定义列对齐方式):

This commit is contained in:
wanghaoo 2019-01-17 18:42:57 +08:00
parent c155912250
commit 4c4f0ca9cc
5 changed files with 15 additions and 10 deletions

View File

@ -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;

View File

@ -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',
{

View File

@ -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);

View File

@ -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() {

View File

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "1.6.30",
"version": "1.6.31",
"description": "Table ui component for react",
"keywords": [
"react",