feat(支持自定义列对齐方式):
This commit is contained in:
parent
c155912250
commit
4c4f0ca9cc
|
@ -511,7 +511,8 @@ var Table = function (_Component) {
|
||||||
drgHover: column.drgHover,
|
drgHover: column.drgHover,
|
||||||
fixed: column.fixed,
|
fixed: column.fixed,
|
||||||
width: width,
|
width: width,
|
||||||
dataindex: column.dataIndex
|
dataindex: column.dataIndex,
|
||||||
|
textAlign: column.textAlign
|
||||||
};
|
};
|
||||||
if (column.onHeadCellClick) {
|
if (column.onHeadCellClick) {
|
||||||
cell.onClick = column.onHeadCellClick;
|
cell.onClick = column.onHeadCellClick;
|
||||||
|
|
|
@ -111,6 +111,9 @@ var TableCell = function (_Component) {
|
||||||
if (column.fixed && !fixed) {
|
if (column.fixed && !fixed) {
|
||||||
className = className + (' ' + clsPrefix + '-fixed-columns-in-body');
|
className = className + (' ' + clsPrefix + '-fixed-columns-in-body');
|
||||||
}
|
}
|
||||||
|
if (column.textAlign) {
|
||||||
|
className = className + (' text-' + column.textAlign);
|
||||||
|
}
|
||||||
return _react2["default"].createElement(
|
return _react2["default"].createElement(
|
||||||
'td',
|
'td',
|
||||||
{
|
{
|
||||||
|
|
|
@ -636,6 +636,11 @@ var TableHeader = function (_Component) {
|
||||||
if (lastShowIndex == columIndex) {
|
if (lastShowIndex == columIndex) {
|
||||||
canDotDrag = "th-can-not-drag";
|
canDotDrag = "th-can-not-drag";
|
||||||
}
|
}
|
||||||
|
var thClassName = "" + da.className ? "" + da.className : '';
|
||||||
|
if (da.textAlign) {
|
||||||
|
thClassName += " text-" + da.textAlign;
|
||||||
|
}
|
||||||
|
delete da.textAlign;
|
||||||
var keyTemp = {};
|
var keyTemp = {};
|
||||||
//避免key为undefined
|
//避免key为undefined
|
||||||
// if(da.dataindex && da.key ===undefined ){
|
// if(da.dataindex && da.key ===undefined ){
|
||||||
|
@ -651,7 +656,7 @@ var TableHeader = function (_Component) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var thDefaultObj = {};
|
var thDefaultObj = {};
|
||||||
var thClassName = "" + da.className ? "" + da.className : '';
|
|
||||||
if (draggable) {
|
if (draggable) {
|
||||||
thClassName += clsPrefix + "-thead th-drag " + thHover + " ";
|
thClassName += clsPrefix + "-thead th-drag " + thHover + " ";
|
||||||
}
|
}
|
||||||
|
@ -659,6 +664,7 @@ var TableHeader = function (_Component) {
|
||||||
thClassName += clsPrefix + "-thead-th " + canDotDrag;
|
thClassName += clsPrefix + "-thead-th " + canDotDrag;
|
||||||
}
|
}
|
||||||
thClassName += " " + fixedStyle;
|
thClassName += " " + fixedStyle;
|
||||||
|
|
||||||
if (!da.fixed) {
|
if (!da.fixed) {
|
||||||
|
|
||||||
return _react2["default"].createElement(
|
return _react2["default"].createElement(
|
||||||
|
@ -678,7 +684,7 @@ var TableHeader = function (_Component) {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
thDefaultObj = _extends({}, da, {
|
thDefaultObj = _extends({}, da, {
|
||||||
className: da.className + " " + fixedStyle
|
className: thClassName + " " + fixedStyle
|
||||||
});
|
});
|
||||||
da.onClick ? thDefaultObj.onClick = function (e) {
|
da.onClick ? thDefaultObj.onClick = function (e) {
|
||||||
da.onClick(da, e);
|
da.onClick(da, e);
|
||||||
|
|
|
@ -128,13 +128,8 @@ var TableRow = function (_Component) {
|
||||||
TableRow.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
TableRow.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
||||||
if (this.props.treeType) {
|
if (this.props.treeType) {
|
||||||
this.setRowParentIndex();
|
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() {
|
TableRow.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bee-table",
|
"name": "bee-table",
|
||||||
"version": "1.6.30",
|
"version": "1.6.31",
|
||||||
"description": "Table ui component for react",
|
"description": "Table ui component for react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
|
|
Loading…
Reference in New Issue