File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1
1
import React , { useState } from 'react' ;
2
- import Table from 'rc-table' ;
2
+ import Table , { INTERNAL_HOOKS } from 'rc-table' ;
3
3
import type { ColumnType } from 'rc-table' ;
4
4
import '../../assets/index.less' ;
5
5
@@ -63,6 +63,15 @@ const Demo = () => {
63
63
return result ;
64
64
} ) ;
65
65
} }
66
+ internalHooks = { INTERNAL_HOOKS }
67
+ getContainerWidth = { ( ele , width ) => {
68
+ // Minus border
69
+ const borderWidth = getComputedStyle (
70
+ ele . querySelector ( '.rc-table-body' ) ,
71
+ ) . borderInlineStartWidth ;
72
+ const mergedWidth = width - parseInt ( borderWidth , 10 ) ;
73
+ return mergedWidth ;
74
+ } }
66
75
/>
67
76
< br />
68
77
大多数情况
@@ -80,6 +89,15 @@ const Demo = () => {
80
89
return result ;
81
90
} ) ;
82
91
} }
92
+ internalHooks = { INTERNAL_HOOKS }
93
+ getContainerWidth = { ( ele , width ) => {
94
+ // Minus border
95
+ const borderWidth = getComputedStyle (
96
+ ele . querySelector ( '.rc-table-body' ) ,
97
+ ) . borderInlineStartWidth ;
98
+ const mergedWidth = width - parseInt ( borderWidth , 10 ) ;
99
+ return mergedWidth ;
100
+ } }
83
101
/>
84
102
{ /* <Table resizable style={{ width: 800 }} columns={columns} data={data} /> */ }
85
103
</ div >
Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ export default function useCelResize(
63
63
// If there is no column on the right, it will be allocated to the column on the left.
64
64
let addWidthColumnKey : React . Key ;
65
65
const isDecreasingWidth = oldWidth - newWidth > 0 ;
66
- console . log ( 'smallThanWidth' , smallThanWidth ) ;
67
66
if ( smallThanWidth > 0 && isDecreasingWidth ) {
68
67
const index = colsKeys . findIndex ( key => key === columnKey ) ;
69
68
addWidthColumnKey = colsKeys [ index + 1 ] ?? colsKeys [ index - 1 ] ;
You can’t perform that action at this time.
0 commit comments