From c29a6cf1121b0a401a6e7ff0f61b4d738fed2176 Mon Sep 17 00:00:00 2001 From: izbz wh <731215820@qq.com> Date: Sat, 29 Aug 2020 15:22:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8B=96=E6=8B=BD=E5=88=97=E5=AE=BD?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=9B=BA=E5=AE=9A=E5=88=97=E7=9A=84=E9=AB=98?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .huskyrc1 => .huskyrc | 0 src/Table.js | 3 ++- src/TableHeader.js | 24 +++++++++++++++--------- 3 files changed, 17 insertions(+), 10 deletions(-) rename .huskyrc1 => .huskyrc (100%) diff --git a/.huskyrc1 b/.huskyrc similarity index 100% rename from .huskyrc1 rename to .huskyrc diff --git a/src/Table.js b/src/Table.js index 3cbbd4c..c464abe 100644 --- a/src/Table.js +++ b/src/Table.js @@ -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; } diff --git a/src/TableHeader.js b/src/TableHeader.js index 96c5595..e126404 100644 --- a/src/TableHeader.js +++ b/src/TableHeader.js @@ -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"){ @@ -336,14 +337,19 @@ class TableHeader extends Component { if(newWidth > this.minWidth){ 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"; - } - }) + // displayinrow 判断、 固定行高判断 + 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";