@@ -62,6 +62,46 @@ import {
62
62
} from "./mixin.pro" ;
63
63
import { IChangeData , ProArrayTableProps } from "./types" ;
64
64
65
+ export const DefaultHeaderRender = ( props : {
66
+ title ?: React . ReactNode ;
67
+ selection ?: React . ReactNode ;
68
+ toolbars ?: React . ReactNode ;
69
+ addition ?: React . ReactNode ;
70
+ settings ?: React . ReactNode ;
71
+ extra ?: React . ReactNode ;
72
+ } ) => {
73
+ return (
74
+ < Flex marginBottom = { "8px" } marginTop = { "8px" } >
75
+ { props . title || props . selection ? (
76
+ < Flex start >
77
+ { props . title }
78
+ { props . selection }
79
+ </ Flex >
80
+ ) : null }
81
+ { props . toolbars ? < Flex center > { props . toolbars } </ Flex > : null }
82
+ { props . addition || props . extra || props . settings ? (
83
+ < Flex end >
84
+ { props . addition }
85
+ { props . extra }
86
+ { props . settings }
87
+ </ Flex >
88
+ ) : null }
89
+ </ Flex >
90
+ ) ;
91
+ } ;
92
+
93
+ export const DefaultFooterRender = ( props : {
94
+ footer ?: React . ReactNode ;
95
+ pagination ?: React . ReactNode ;
96
+ } ) => {
97
+ return (
98
+ < Flex between marginTop = { `${ 8 } px` } >
99
+ { props . footer }
100
+ { props . pagination }
101
+ </ Flex >
102
+ ) ;
103
+ } ;
104
+
65
105
const ArrayTableProInside : ReactFC < ProArrayTableProps > = observer (
66
106
( { onAdd, onRemove, onCopy, onMoveDown, onMoveUp, onSortEnd, ...props } ) => {
67
107
const wrapperRef = useRef < HTMLDivElement > ( null ) ;
@@ -177,63 +217,58 @@ const ArrayTableProInside: ReactFC<ProArrayTableProps> = observer(
177
217
</ div >
178
218
) : null ;
179
219
180
- const showHeader =
181
- props . title ||
182
- props . rowSelection ||
183
- toolbar ||
184
- addition ||
185
- props . settings !== false ;
220
+ // const showHeader =
221
+ // props.title ||
222
+ // props.rowSelection ||
223
+ // toolbar ||
224
+ // addition ||
225
+ // props.settings !== false;
186
226
187
- const _header = ! showHeader ? null : (
188
- < Flex { ...props . headerFlex } marginBottom = { "8px" } marginTop = { "8px" } >
189
- { props . title ? (
227
+ const HeaderRender = props . headerRender || DefaultHeaderRender ;
228
+ const _header = (
229
+ < HeaderRender
230
+ title = {
231
+ props . title ? (
190
232
typeof props . title === "function" ? (
191
233
props . title ( dataSource )
192
234
) : (
193
235
< Typography . Title level = { 5 } style = { { flex : 1 } } >
194
236
{ props . title }
195
237
</ Typography . Title >
196
238
)
197
- ) : null }
198
- { rowSelection ?. showPro === "top" ? (
239
+ ) : null
240
+ }
241
+ selection = {
242
+ rowSelection ?. showPro ? (
199
243
< RowSelectionPro ds = { dataSlice } rowKey = { rowKey } > </ RowSelectionPro >
200
- ) : null }
201
- { toolbar }
202
- { addition }
203
- { ! props . extra && props . settings === false ? null : (
204
- < Space size = "small" >
205
- { props . extra }
206
- { props . settings !== false ? (
207
- < ProSettings columns = { proColumns } > </ ProSettings >
208
- ) : null }
209
- </ Space >
210
- ) }
211
- </ Flex >
244
+ ) : null
245
+ }
246
+ toolbars = { toolbar }
247
+ addition = { addition }
248
+ extra = { props . extra }
249
+ settings = {
250
+ props . settings !== false ? (
251
+ < ProSettings columns = { proColumns } > </ ProSettings >
252
+ ) : null
253
+ }
254
+ > </ HeaderRender >
212
255
) ;
213
256
214
- const showFooter = props . footer || footer || pagination ;
215
- const _footer = ! showFooter ? null : (
216
- < Flex between marginTop = { `${ 6 } px` } >
217
- < Flex
218
- start
219
- hidden = { ! props . footer && rowSelection ?. showPro !== "bottom" }
220
- >
221
- { props . footer ? (
257
+ const FooterRender = props . footerRender || DefaultFooterRender ;
258
+
259
+ const _footer = (
260
+ < FooterRender
261
+ footer = {
262
+ props . footer ? (
222
263
typeof props . footer === "function" ? (
223
264
props . footer ( dataSource )
224
265
) : (
225
266
< Typography . Title level = { 5 } > { props . footer } </ Typography . Title >
226
267
)
227
- ) : null }
228
- { rowSelection ?. showPro === "bottom" ? (
229
- < RowSelectionPro ds = { dataSlice } rowKey = { rowKey } > </ RowSelectionPro >
230
- ) : null }
231
- </ Flex >
232
- < Flex end >
233
- { footer }
234
- { pagination }
235
- </ Flex >
236
- </ Flex >
268
+ ) : null
269
+ }
270
+ pagination = { pagination }
271
+ > </ FooterRender >
237
272
) ;
238
273
239
274
const header = useResizeHeader ( {
@@ -349,8 +384,7 @@ const ArrayTableProInside: ReactFC<ProArrayTableProps> = observer(
349
384
} ,
350
385
) ;
351
386
352
- const useTableExpandable = ( ) => {
353
- } ;
387
+ const useTableExpandable = ( ) => { } ;
354
388
355
389
const useTableRowSelection = ( ) => {
356
390
return useContext ( TableRowSelectionContext ) ;
0 commit comments