fix: 拖拽列宽同步固定列的高度
This commit is contained in:
parent
422c4821a7
commit
c29a6cf112
|
@ -436,7 +436,7 @@ class Table extends Component {
|
|||
getHeader(columns, fixed, leftFixedWidth, rightFixedWidth) {
|
||||
const { lastShowIndex } = this.state;
|
||||
const { filterDelay, onFilterChange, onFilterClear, filterable, showHeader, expandIconAsCell, clsPrefix, onDragStart, onDragEnter, onDragOver, onDrop,onDragEnd, draggable,
|
||||
onMouseDown, onMouseMove, onMouseUp, dragborder, onThMouseMove, dragborderKey, minColumnWidth, headerHeight,afterDragColWidth,headerScroll ,bordered,onDropBorder,onDraggingBorder} = this.props;
|
||||
onMouseDown, onMouseMove, onMouseUp, dragborder, onThMouseMove, dragborderKey, minColumnWidth, headerHeight,afterDragColWidth,headerScroll ,bordered,onDropBorder,onDraggingBorder, bodyDisplayInRow} = this.props;
|
||||
this.columnsChildrenList = []; //复杂表头拖拽,重新render表头前,将其置空
|
||||
const rows = this.getHeaderRows(columns);
|
||||
if (expandIconAsCell && fixed !== 'right') {
|
||||
|
@ -486,6 +486,7 @@ class Table extends Component {
|
|||
bordered = {bordered}
|
||||
leftFixedWidth = {leftFixedWidth}
|
||||
rightFixedWidth = {rightFixedWidth}
|
||||
bodyDisplayInRow = {bodyDisplayInRow}
|
||||
/>
|
||||
) : null;
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ class TableHeader extends Component {
|
|||
table.fixedRightBodyTable = contentTable.querySelector('.u-table-fixed-right .u-table-body-outer') ;
|
||||
table.innerTableBody= contentTable.querySelector('.u-table-scroll .u-table-body table');
|
||||
table.fixedLeftBodyRows = table.fixedLeftBodyTable && table.fixedLeftBodyTable.querySelectorAll('tr') || [];
|
||||
table.fixedRightBodyRows = table.fixedRightBodyTable && table.fixedRightBodyTable.querySelectorAll('tr') || [];
|
||||
this.table = table;
|
||||
|
||||
if(!this.props.dragborder)return;
|
||||
|
@ -324,7 +325,7 @@ class TableHeader extends Component {
|
|||
*/
|
||||
onTrMouseMove = (e) => {
|
||||
if(!this.props.dragborder && !this.props.draggable)return;
|
||||
const { clsPrefix ,dragborder,contentDomWidth,scrollbarWidth,contentTable,headerScroll,lastShowIndex,onDraggingBorder, leftFixedWidth, rightFixedWidth} = this.props;
|
||||
const { clsPrefix ,dragborder,contentDomWidth,scrollbarWidth,contentTable,headerScroll,lastShowIndex,onDraggingBorder, leftFixedWidth, rightFixedWidth, bodyDisplayInRow} = this.props;
|
||||
Event.stopPropagation(e);
|
||||
let event = Event.getEvent(e);
|
||||
if(this.props.dragborder && this.drag.option == "border"){
|
||||
|
@ -337,13 +338,18 @@ class TableHeader extends Component {
|
|||
currentCols.style.width = newWidth +'px';
|
||||
|
||||
// displayinrow 判断、 固定行高判断
|
||||
this.table.bodyRows.forEach((row,index)=>{
|
||||
const leftRow = this.table.fixedLeftBodyRows[index]
|
||||
if(leftRow) {
|
||||
const height = row.getBoundingClientRect().height;
|
||||
leftRow.style.height = height + "px";
|
||||
}
|
||||
})
|
||||
if(!bodyDisplayInRow) {
|
||||
this.table.bodyRows.forEach((row,index)=>{
|
||||
const leftRow = this.table.fixedLeftBodyRows[index];
|
||||
const rightRow = this.table.fixedRightBodyRows[index];
|
||||
if(leftRow || rightRow) {
|
||||
const height = row.getBoundingClientRect().height;
|
||||
leftRow && (leftRow.style.height = height + "px")
|
||||
rightRow && (rightRow.style.height = height + "px")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//hao 支持固定表头拖拽 修改表体的width
|
||||
if(this.fixedTable.cols){
|
||||
this.fixedTable.cols[this.drag.currIndex].style.width = newWidth + "px";
|
||||
|
|
Loading…
Reference in New Issue