支持自定义列的对齐方式

This commit is contained in:
wanghaoo 2019-01-17 18:36:22 +08:00
parent 84c974cbaa
commit 4403e3c6a8
6 changed files with 31 additions and 11 deletions

24
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -88,6 +88,7 @@ import 'bee-table/build/Table.css';
| filterDropdownType | 下拉条件类型,分为 string 和 number 条件类型 | string | string
| filterDropdownIncludeKeys | 能够设置指定的下拉条件项通过设置keys 其中string条件可设置:LIKE,ULIKE,EQ,UEQ,START,END.number条件可设置:GT,GTEQ,LT,LTEQ,EQ,UEQ | array | [] 不设置此属性为显示所有
| filterInputNumberOptions | 数值框接收的props具体属性参考bee-input-number | object | null
| textAlign | 内容对齐方式,默认是左对齐('left、right、center' | string |
## 快捷键API

View File

@ -394,7 +394,8 @@ class Table extends 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

@ -68,6 +68,9 @@ class TableCell extends Component{
if(column.fixed && !fixed){
className = className+` ${clsPrefix}-fixed-columns-in-body`;
}
if(column.textAlign){
className = className+` text-${column.textAlign}`;
}
return (
<td
colSpan={colSpan}

View File

@ -554,6 +554,10 @@ class TableHeader extends Component {
if (lastShowIndex == columIndex) {
canDotDrag = "th-can-not-drag";
}
let thClassName = `${da.className}`?`${da.className}`:'';
if(da.textAlign){
thClassName += ` text-${da.textAlign}`;
}
const keyTemp = {};
//避免key为undefined
// if(da.dataindex && da.key ===undefined ){
@ -573,7 +577,7 @@ class TableHeader extends Component {
}
let thDefaultObj = {};
let thClassName = `${da.className}`?`${da.className}`:'';
if(draggable){
thClassName += `${clsPrefix}-thead th-drag ${thHover} `;
}
@ -581,6 +585,7 @@ class TableHeader extends Component {
thClassName += `${clsPrefix}-thead-th ${canDotDrag}`;
}
thClassName += ` ${fixedStyle}`;
if(!da.fixed){
return (<th {...da} {...keyTemp} className={thClassName} data-th-fixed={da.fixed}
@ -596,7 +601,7 @@ class TableHeader extends Component {
}else{
thDefaultObj = {
...da,
className:`${da.className} ${fixedStyle}`,
className:`${thClassName} ${fixedStyle}`,
};
da.onClick ?thDefaultObj.onClick = (e)=>{da.onClick(da, e)}:"";
return (<th {...thDefaultObj} {...keyTemp} data-th-fixed={da.fixed} />)