11import React from "react" ;
2- import { Table as AntdTable , TableProps as AntdTableProps , Flex , Space , Card } from "antd" ;
3- import { type ActionType , type ParamRequest , type Result } from "@flow-engine/flow-core" ;
2+ import { Card , Flex , Space , Table as AntdTable , TableProps as AntdTableProps } from "antd" ;
3+ import { ActionType , ParamRequest , Result } from "@flow-engine/flow-core" ;
44
55export interface TableProps < RecordType > extends AntdTableProps < RecordType > {
66 actionType ?: React . Ref < ActionType > ;
7+
78 request ?( params : ParamRequest ) : Promise < Result < any > > ;
8- toolBarRender ?( ) :React . ReactElement [ ]
9+
10+ toolBarRender ?( ) : React . ReactElement [ ]
911}
1012
1113export function Table < RecordType extends object = any > ( props : TableProps < RecordType > ) {
@@ -56,38 +58,38 @@ export function Table<RecordType extends object = any>(props: TableProps<RecordT
5658 < div style = { {
5759 width : '100%'
5860 } } >
59- < Card >
60- < Flex justify = { "end" } style = { {
61- paddingLeft : 20 ,
62- marginBottom :10
63- } } >
64- < Space >
65- { props . toolBarRender && props . toolBarRender ( ) }
66- </ Space >
67- </ Flex >
68- < AntdTable < RecordType >
69- dataSource = { dataSource }
70- pagination = {
71- {
72- pageSize : pageSize ,
73- current : current ,
74- total : total ,
75- showSizeChanger : true ,
76- showQuickJumper : true ,
77- defaultCurrent : defaultCurrent ,
78- defaultPageSize : defaultPageSize ,
79- onChange : ( pageSize , current ) => {
80- requestData ( {
81- current,
82- pageSize
83- } ) ;
84- } ,
85- ...props . pagination
86- }
87- }
88- { ...props }
89- />
90- </ Card >
61+ < Card >
62+ < Flex justify = { "end" } style = { {
63+ paddingLeft : 20 ,
64+ marginBottom : 10
65+ } } >
66+ < Space >
67+ { props . toolBarRender && props . toolBarRender ( ) }
68+ </ Space >
69+ </ Flex >
70+ < AntdTable < RecordType >
71+ dataSource = { dataSource }
72+ pagination = {
73+ {
74+ pageSize : pageSize ,
75+ current : current ,
76+ total : total ,
77+ showSizeChanger : true ,
78+ showQuickJumper : true ,
79+ defaultCurrent : defaultCurrent ,
80+ defaultPageSize : defaultPageSize ,
81+ onChange : ( pageSize , current ) => {
82+ requestData ( {
83+ current,
84+ pageSize
85+ } ) ;
86+ } ,
87+ ...props . pagination
88+ }
89+ }
90+ { ...props }
91+ />
92+ </ Card >
9193 </ div >
9294 ) ;
9395}
0 commit comments