@@ -77,17 +77,23 @@ const TablePageInner = withFetch(({
7777 />
7878 </ > ) ,
7979 current : get ( requestParams , [ pagination . paramsType , pagination . currentName ] , 1 ) ,
80- pageSize : pagination . pageSize ,
81- onChange : pagination . onChange ? pagination . onChange : ( page , size ) => {
82- if ( page !== get ( requestParams , [ pagination . paramsType , pagination . currentName ] , 1 ) ) {
83- ( pagination . requestType === "refresh" ? refresh : reload ) ( {
84- [ pagination . paramsType ] : {
85- [ pagination . currentName ] : page , [ pagination . pageSizeName ] : size ,
86- } ,
87- } ) ;
88- } else {
89- pagination . onShowSizeChange && pagination . onShowSizeChange ( page , size ) ;
90- }
80+ pageSize : get ( requestParams , [ pagination . paramsType , pagination . pageSizeName ] , 20 ) ,
81+ onChange : ( page , size ) => {
82+ ( ( ) => {
83+ if ( typeof pagination . onChange === 'function' ) {
84+ pagination . onChange ( page , size ) ;
85+ return ;
86+ }
87+ if ( page !== get ( requestParams , [ pagination . paramsType , pagination . currentName ] , 1 ) ) {
88+ ( pagination . requestType === "refresh" ? refresh : reload ) ( {
89+ [ pagination . paramsType ] : {
90+ [ pagination . currentName ] : page , [ pagination . pageSizeName ] : size ,
91+ } ,
92+ } ) ;
93+ } else {
94+ pagination . onShowSizeChange && pagination . onShowSizeChange ( page , size ) ;
95+ }
96+ } ) ( ) ;
9197 getScrollEl ( ) . scrollTop = 0 ;
9298 } ,
9399 size : pagination . size ,
@@ -98,7 +104,7 @@ const TablePageInner = withFetch(({
98104 } ;
99105
100106 return ( < IntlProvider importMessages = { importMessages } moduleName = "Table" >
101- < FeaturesColumnsConfig id = { featureId } columns = { columns } >
107+ < FeaturesColumnsConfig id = { featureId } columns = { typeof columns === 'function' ? columns ( data ) : columns } >
102108 { ( { columns} ) => ( < Table
103109 { ...Object . assign ( { } , props , tableProps ) }
104110 sticky = { sticky }
@@ -111,15 +117,7 @@ const TablePageInner = withFetch(({
111117 } }
112118 summary = { typeof summary === "function" ? ( ...args ) => {
113119 return summary ( Object . assign ( { } , {
114- data,
115- fetchProps,
116- requestParams,
117- refresh,
118- reload,
119- loadMore,
120- send,
121- dataFormat,
122- pagination,
120+ data, fetchProps, requestParams, refresh, reload, loadMore, send, dataFormat, pagination,
123121 } , ...args ) ) ;
124122 } : null }
125123 /> ) }
@@ -136,7 +134,6 @@ const TablePage = forwardRef(({pagination, ...props}, ref) => {
136134 requestType : "reload" ,
137135 currentName : "currentPage" ,
138136 pageSizeName : "perPage" ,
139- pageSize : 20 , //size: "small",
140137 } , pagination ) ;
141138 const pageSizeKey = `${ ( props . name || "common" ) . toUpperCase ( ) } _TABLE_PAGE_SIZE` ;
142139 const [ pageSize , setPageSize ] = useState ( localStorage . getItem ( pageSizeKey ) || pagination . pageSize ) ;
0 commit comments