树表、行拖拽组合场景,图标重叠问题
This commit is contained in:
parent
b6c43b0414
commit
8991080cde
|
@ -341,12 +341,32 @@ var _initialiseProps = function _initialiseProps() {
|
|||
if (!showRowNum) {
|
||||
return columns;
|
||||
}
|
||||
var key = showRowNum.key,
|
||||
fixed = showRowNum.fixed,
|
||||
width = showRowNum.width,
|
||||
name = showRowNum.name,
|
||||
type = showRowNum.type,
|
||||
base = showRowNum.base;
|
||||
|
||||
var order = {
|
||||
dataIndex: showRowNum.key || '_index',
|
||||
dataIndex: key || '_index',
|
||||
key: '_index',
|
||||
fixed: showRowNum.fixed || 'left',
|
||||
width: showRowNum.width || 50,
|
||||
title: showRowNum.name || '序号'
|
||||
fixed: fixed || 'left',
|
||||
width: width || 50,
|
||||
title: name || '序号',
|
||||
render: function render(text, record, index) {
|
||||
switch (type) {
|
||||
case 'ascii':
|
||||
{
|
||||
return String.fromCharCode((base || 'a').charCodeAt() + index);
|
||||
}
|
||||
case 'number':
|
||||
default:
|
||||
{
|
||||
return (base || 0) + index;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (columns.length > 0 && columns[0].dataIndex !== 'checkbox' && columns[0].dataIndex !== 'radio') {
|
||||
// 多选表格/单选表格时放在第二列,其他情况放到第一列
|
||||
|
|
|
@ -246,6 +246,9 @@
|
|||
.u-table td.drag-handle-column .uf {
|
||||
font-size: 12px;
|
||||
line-height: 12px; }
|
||||
.u-table th.drag-handle-column.u-table-row-has-expandIcon .uf,
|
||||
.u-table td.drag-handle-column.u-table-row-has-expandIcon .uf {
|
||||
padding: 0; }
|
||||
.u-table th.text-center,
|
||||
.u-table td.text-center {
|
||||
text-align: center; }
|
||||
|
|
|
@ -118,7 +118,7 @@ var propTypes = {
|
|||
onBodyScroll: _propTypes2["default"].func,
|
||||
bodyDisplayInRow: _propTypes2["default"].bool, // 表格内容超出列宽度时进行换行 or 以...形式展现
|
||||
headerDisplayInRow: _propTypes2["default"].bool, // 表头内容超出列宽度时进行换行 or 以...形式展现
|
||||
showRowNum: _propTypes2["default"].object // 表格是否自动生成序号,格式为{base:number || 0,defaultKey:string || '_index',defaultName:string || '序号'}
|
||||
showRowNum: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].object]) // 表格是否自动生成序号,格式为{base:number || 0,defaultKey:string || '_index',defaultName:string || '序号'}
|
||||
};
|
||||
|
||||
var defaultProps = {
|
||||
|
@ -848,25 +848,23 @@ var Table = function (_Component) {
|
|||
var lazyEndIndex = props.lazyLoad && props.lazyLoad.endIndex ? props.lazyLoad.endIndex : -1;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var isHiddenExpandIcon = void 0;
|
||||
if (props.showRowNum) {
|
||||
switch (props.showRowNum.type) {
|
||||
case 'number':
|
||||
{
|
||||
data[i][props.showRowNum.key || '_index'] = (props.showRowNum.base || 0) + i;
|
||||
break;
|
||||
}
|
||||
case 'ascii':
|
||||
{
|
||||
data[i][props.showRowNum.key || '_index'] = String.fromCharCode(i + (props.showRowNum.base || '0').charCodeAt());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
data[i][props.showRowNum.key || '_index'] = (props.showRowNum.base || 0) + i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if ( props.showRowNum ){
|
||||
// switch(props.showRowNum.type){
|
||||
// case 'number':{
|
||||
// data[i][props.showRowNum.key || '_index'] = (props.showRowNum.base || 0) + i;
|
||||
// break;
|
||||
// }
|
||||
// case 'ascii': {
|
||||
// data[i][props.showRowNum.key || '_index'] = String.fromCharCode(i + (props.showRowNum.base || '0').charCodeAt());
|
||||
// break;
|
||||
// }
|
||||
// default: {
|
||||
// data[i][props.showRowNum.key || '_index'] = (props.showRowNum.base || 0) + i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
var record = data[i];
|
||||
var key = this.getRowKey(record, i);
|
||||
var childrenColumn = record[childrenColumnName];
|
||||
|
|
|
@ -130,6 +130,9 @@ function sort(Table, Icon) {
|
|||
// 数值比较函数
|
||||
|
||||
|
||||
// 中文比较函数,按拼音排序
|
||||
|
||||
|
||||
SortTable.prototype._flatToColumn = function _flatToColumn(flatColumns) {
|
||||
var colLen = flatColumns.length;
|
||||
var parentIndex = void 0,
|
||||
|
@ -345,7 +348,23 @@ function sort(Table, Icon) {
|
|||
if (column.sorter || column.sortEnable) {
|
||||
//大于0说明不是升序就是降序,判断orderNum有没有值,没有值赋值
|
||||
if (column.sortEnable && !column.sorter) {
|
||||
column.sorter = column.fieldType === 'number' ? _this3.numberSortFn(column.dataIndex) : _this3.defaultSortFn(column.dataIndex);
|
||||
switch (column.fieldType) {
|
||||
case 'number':
|
||||
{
|
||||
column.sorter = _this3.numberSortFn(column.dataIndex);
|
||||
break;
|
||||
}
|
||||
case 'stringChinese':
|
||||
{
|
||||
column.sorter = _this3.chineseSortFn(column.dataIndex);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
column.sorter = _this3.defaultSortFn(column.dataIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iconTypeIndex > 0 && !column.orderNum && mode == "multiple") {
|
||||
column.orderNum = _this3.getOrderNum();
|
||||
|
@ -393,6 +412,12 @@ function sort(Table, Icon) {
|
|||
return numberA >= numberB ? 1 : -1;
|
||||
};
|
||||
};
|
||||
|
||||
this.chineseSortFn = function (key) {
|
||||
return function (a, b) {
|
||||
return a[key].localeCompare(b[key], 'zh-Hans-CN', { sensitivity: 'accent' });
|
||||
};
|
||||
};
|
||||
}, _temp;
|
||||
}
|
||||
module.exports = exports['default'];
|
File diff suppressed because one or more lines are too long
|
@ -233,6 +233,9 @@
|
|||
.u-table td.drag-handle-column .uf {
|
||||
font-size: 12px;
|
||||
line-height: 12px; }
|
||||
.u-table th.drag-handle-column.u-table-row-has-expandIcon .uf,
|
||||
.u-table td.drag-handle-column.u-table-row-has-expandIcon .uf {
|
||||
padding: 0; }
|
||||
.u-table th.text-center,
|
||||
.u-table td.text-center {
|
||||
text-align: center; }
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -62,7 +62,7 @@ const propTypes = {
|
|||
onBodyScroll: PropTypes.func,
|
||||
bodyDisplayInRow: PropTypes.bool, // 表格内容超出列宽度时进行换行 or 以...形式展现
|
||||
headerDisplayInRow: PropTypes.bool, // 表头内容超出列宽度时进行换行 or 以...形式展现
|
||||
showRowNum: PropTypes.object, // 表格是否自动生成序号,格式为{base:number || 0,defaultKey:string || '_index',defaultName:string || '序号'}
|
||||
showRowNum: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]), // 表格是否自动生成序号,格式为{base:number || 0,defaultKey:string || '_index',defaultName:string || '序号'}
|
||||
};
|
||||
|
||||
const defaultProps = {
|
||||
|
|
|
@ -142,6 +142,9 @@ $icon-color:#505F79;
|
|||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
}
|
||||
&.u-table-row-has-expandIcon .uf {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
&.text-center{
|
||||
text-align: center;
|
||||
|
|
Loading…
Reference in New Issue