diff --git a/demo/demolist/Demo23.js b/demo/demolist/Demo23.js index 49b6e8b..2086efb 100644 --- a/demo/demolist/Demo23.js +++ b/demo/demolist/Demo23.js @@ -60,6 +60,10 @@ class Demo23 extends Component { return { + console.log("调整列宽后触发事件"); + }} />; } } diff --git a/docs/mixin.md b/docs/mixin.md index 7270baf..f355da2 100644 --- a/docs/mixin.md +++ b/docs/mixin.md @@ -101,7 +101,9 @@ const SumTable = sum(Table); | ------ | ---------- | -------- | ---- | | dragborder | 拖拽调整列宽度 | boolean | false | | draggable | 拖拽交换列 | boolean | false | -| onDrop | 拖拽释放回调函数 | function | () => {} | +| onDrop | 拖拽释放回调函数(交换列) | function | () => {} | +| onDropBorder | 拖拽释放回调函数(调整列宽) | function | (e) => {} | + #### 使用 diff --git a/src/Table.js b/src/Table.js index ab5ddf9..e70ff73 100644 --- a/src/Table.js +++ b/src/Table.js @@ -318,7 +318,7 @@ class Table extends Component { getHeader(columns, fixed) { const { filterDelay, onFilterChange, onFilterClear, filterable, showHeader, expandIconAsCell, clsPrefix, onDragStart, onDragEnter, onDragOver, onDrop, draggable, - onMouseDown, onMouseMove, onMouseUp, dragborder, onThMouseMove, dragborderKey, minColumnWidth, headerHeight,afterDragColWidth,headerScroll ,bordered} = this.props; + onMouseDown, onMouseMove, onMouseUp, dragborder, onThMouseMove, dragborderKey, minColumnWidth, headerHeight,afterDragColWidth,headerScroll ,bordered,onDropBorder} = this.props; const rows = this.getHeaderRows(columns); if (expandIconAsCell && fixed !== 'right') { rows[0].unshift({ @@ -331,7 +331,7 @@ class Table extends Component { const trStyle = headerHeight&&!fixed ? { height: headerHeight } : (fixed ? this.getHeaderRowStyle(columns, rows) : null); let drop = draggable ? { onDragStart, onDragOver, onDrop, onDragEnter, draggable } : {}; - let dragBorder = dragborder ? { onMouseDown, onMouseMove, onMouseUp, dragborder, onThMouseMove, dragborderKey } : {}; + let dragBorder = dragborder ? { onMouseDown, onMouseMove, onMouseUp, dragborder, onThMouseMove, dragborderKey,onDropBorder } : {}; let contentWidthDiff = 0; //非固定表格,宽度不够时自动扩充 if (!fixed) { diff --git a/src/TableHeader.js b/src/TableHeader.js index 0bf48a4..18f0185 100644 --- a/src/TableHeader.js +++ b/src/TableHeader.js @@ -235,6 +235,7 @@ class TableHeader extends Component { */ onLineMouseUp = (event) => { this.clearDragBorder(event); + this.props.onDropBorder(event) }; /**