自定义类型时,不换行展示问题
This commit is contained in:
parent
cdc19d51c0
commit
cb3390688b
|
@ -128,7 +128,7 @@ import 'bee-table/build/Table.css';
|
||||||
| filterDropdownIncludeKeys | 能够设置指定的下拉条件项,通过设置keys 其中string条件可设置:LIKE,ULIKE,EQ,UEQ,START,END.number条件可设置:GT,GTEQ,LT,LTEQ,EQ,UEQ | array | [] 不设置此属性为显示所有
|
| filterDropdownIncludeKeys | 能够设置指定的下拉条件项,通过设置keys 其中string条件可设置:LIKE,ULIKE,EQ,UEQ,START,END.number条件可设置:GT,GTEQ,LT,LTEQ,EQ,UEQ | array | [] 不设置此属性为显示所有
|
||||||
| filterInputNumberOptions | 数值框接收的props,具体属性参考bee-input-number | object | null
|
| filterInputNumberOptions | 数值框接收的props,具体属性参考bee-input-number | object | null
|
||||||
| textAlign | 列对齐方式,默认是左对齐('left、right、center') | string |
|
| textAlign | 列对齐方式,默认是左对齐('left、right、center') | string |
|
||||||
| $\color{red}{*}$sortEnable | 开启默认排序,根据fieldType属性确定排序规则,默认按字符串排序;优先级低于sorter属性 | bool | false |
|
| $\color{red}{*}$sortEnable | 开启默认排序,根据fieldType属性确定排序规则,默认按字符串排序;优先级低于sorter属性;需配合高阶函数`multiSelect`使用 | bool | false |
|
||||||
| $\color{red}{*}$fieldType | 列类型,可选`string`,`number`,`currency`,`bool`,`link` | string | 'string' |
|
| $\color{red}{*}$fieldType | 列类型,可选`string`,`number`,`currency`,`bool`,`link` | string | 'string' |
|
||||||
| $\color{red}{*}$fontColor | 列文本颜色 | string | - |
|
| $\color{red}{*}$fontColor | 列文本颜色 | string | - |
|
||||||
| $\color{red}{*}$bgColor | 列背景颜色 | string | - |
|
| $\color{red}{*}$bgColor | 列背景颜色 | string | - |
|
||||||
|
|
|
@ -686,15 +686,15 @@ class Table extends Component {
|
||||||
if ( props.showRowNum ){
|
if ( props.showRowNum ){
|
||||||
switch(props.showRowNum.type){
|
switch(props.showRowNum.type){
|
||||||
case 'number':{
|
case 'number':{
|
||||||
data[i][props.showRowNum.key || '_index'] = i + (props.showRowNum.base || 0);
|
data[i][props.showRowNum.key || '_index'] = (props.showRowNum.base || 0) + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'ascii': {
|
case 'ascii': {
|
||||||
data[i][props.showRowNum.key || '_index'] = String.fromCharCode(i + (props.showRowNum.base || 0).charCodeAt());
|
data[i][props.showRowNum.key || '_index'] = String.fromCharCode(i + (props.showRowNum.base || '0').charCodeAt());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
data[i][props.showRowNum.key || '_index'] = i + (props.showRowNum.base || 0);
|
data[i][props.showRowNum.key || '_index'] = (props.showRowNum.base || 0) + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1044,6 +1044,12 @@ $icon-color:#505F79;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
.u-table-fieldtype{
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: middle;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.u-table-drag-hidden-cont{
|
.u-table-drag-hidden-cont{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -45,7 +45,7 @@ class TableCell extends Component{
|
||||||
let link = () => {
|
let link = () => {
|
||||||
window.open(linkUrl,linkType || '_blank');
|
window.open(linkUrl,linkType || '_blank');
|
||||||
}
|
}
|
||||||
let cls = 'u-table-link ';
|
let cls = 'u-table-link u-table-fieldtype ';
|
||||||
if(className){
|
if(className){
|
||||||
cls += `${className} `;
|
cls += `${className} `;
|
||||||
}
|
}
|
||||||
|
@ -88,16 +88,20 @@ class TableCell extends Component{
|
||||||
|
|
||||||
// 渲染整数/货币类型
|
// 渲染整数/货币类型
|
||||||
renderNumber = (data, config={}, width=200) => {
|
renderNumber = (data, config={}, width=200) => {
|
||||||
console.log(config);
|
const { precision, thousand, makeUp, preSymbol, nextSymbol } = config;
|
||||||
let number = formatMoney(data, config.precision, config.thousand);
|
let number = formatMoney(data, precision, thousand);
|
||||||
if(config.makeUp === false && number !== '0') {
|
if(makeUp === false && number !== '0') {
|
||||||
number = number.replace(/0*$/,'').replace(/\.$/,'');
|
number = number.replace(/0*$/,'').replace(/\.$/,'');
|
||||||
}
|
}
|
||||||
let numberWidth = parseInt(width) - 16; // 减去默认的左右padding共计16px
|
let numberWidth = parseInt(width) - 16; // 减去默认的左右padding共计16px
|
||||||
let res = <span className='u-table-currency-number' >{number}</span>;
|
let res = <span className='u-table-currency-number' >{number}</span>;
|
||||||
let pre = config.preSymbol ? <span className='u-table-currency-pre'>{config.preSymbol}</span> : null;
|
let pre = preSymbol ? <span className='u-table-currency-pre'>{preSymbol}</span> : null;
|
||||||
let next = config.nextSymbol ? <span className='u-table-currency-next'>{config.nextSymbol}</span> : null;
|
let next = nextSymbol ? <span className='u-table-currency-next'>{nextSymbol}</span> : null;
|
||||||
return <span className='u-table-currency' style={{width:numberWidth}}>
|
let title = '';
|
||||||
|
title += typeof preSymbol === 'string' ? preSymbol : '';
|
||||||
|
title += number;
|
||||||
|
title += typeof nextSymbol === 'string' ? nextSymbol : '';
|
||||||
|
return <span className='u-table-currency u-table-fieldtype' style={{width:numberWidth}} title={title}>
|
||||||
{pre}
|
{pre}
|
||||||
{res}
|
{res}
|
||||||
{next}
|
{next}
|
||||||
|
@ -151,7 +155,7 @@ class TableCell extends Component{
|
||||||
}
|
}
|
||||||
case 'number':{
|
case 'number':{
|
||||||
let config = {
|
let config = {
|
||||||
precision: 2, // 精度值,需要大于0
|
precision: 0, // 精度值,需要大于0
|
||||||
thousand: true, // 是否显示千分符号
|
thousand: true, // 是否显示千分符号
|
||||||
makeUp: false, // 末位是否补零
|
makeUp: false, // 末位是否补零
|
||||||
preSymbol: '', // 前置符号
|
preSymbol: '', // 前置符号
|
||||||
|
|
Loading…
Reference in New Issue