@@ -35,15 +35,17 @@ import defaultLocale from '../locale/en_US';
35
35
import type { SizeType } from '../config-provider' ;
36
36
import devWarning from '../vc-util/devWarning' ;
37
37
import type { PropType } from 'vue' ;
38
- import { computed , defineComponent , ref , toRef , watchEffect } from 'vue' ;
38
+ import { reactive } from 'vue' ;
39
+ import { computed , defineComponent , toRef , watchEffect } from 'vue' ;
39
40
import type { DefaultRecordType } from '../vc-table/interface' ;
40
41
import useBreakpoint from '../_util/hooks/useBreakpoint' ;
41
42
import useConfigInject from '../_util/hooks/useConfigInject' ;
42
43
import { useLocaleReceiver } from '../locale-provider/LocaleReceiver' ;
43
44
import classNames from '../_util/classNames' ;
44
45
import omit from '../_util/omit' ;
45
46
import { initDefaultProps } from '../_util/props-util' ;
46
- import { ContextSlots , useProvideSlots } from './context' ;
47
+ import { useProvideSlots } from './context' ;
48
+ import type { ContextSlots } from './context' ;
47
49
import useColumns from './hooks/useColumns' ;
48
50
import { convertChildrenToColumns } from './util' ;
49
51
@@ -77,6 +79,7 @@ export interface TableProps<RecordType = DefaultRecordType>
77
79
| 'scroll'
78
80
| 'emptyText'
79
81
| 'canExpandable'
82
+ | 'onUpdateInternalRefs'
80
83
> {
81
84
dropdownPrefixCls ?: string ;
82
85
dataSource ?: RcTableProps < RecordType > [ 'data' ] ;
@@ -217,11 +220,11 @@ const InteralTable = defineComponent<
217
220
}
218
221
> ( {
219
222
name : 'InteralTable' ,
223
+ inheritAttrs : false ,
220
224
props : initDefaultProps ( tableProps ( ) , {
221
225
rowKey : 'key' ,
222
226
} ) as any ,
223
- inheritAttrs : false ,
224
- emits : [ ] ,
227
+ // emits: ['expandedRowsChange', 'change', 'expand'],
225
228
slots : [
226
229
'emptyText' ,
227
230
'expandIcon' ,
@@ -282,8 +285,12 @@ const InteralTable = defineComponent<
282
285
return null ;
283
286
} ) ;
284
287
285
- const internalRefs = {
286
- body : ref < HTMLDivElement > ( ) ,
288
+ const internalRefs = reactive ( {
289
+ body : null ,
290
+ } ) ;
291
+
292
+ const updateInternalRefs = refs => {
293
+ Object . assign ( internalRefs , refs ) ;
287
294
} ;
288
295
289
296
// ============================ RowKey ============================
@@ -325,9 +332,9 @@ const InteralTable = defineComponent<
325
332
}
326
333
}
327
334
328
- if ( scroll && scroll . scrollToFirstRowOnChange !== false && internalRefs . body . value ) {
335
+ if ( scroll && scroll . scrollToFirstRowOnChange !== false && internalRefs . body ) {
329
336
scrollTo ( 0 , {
330
- getContainer : ( ) => internalRefs . body . value ! ,
337
+ getContainer : ( ) => internalRefs . body ,
331
338
} ) ;
332
339
}
333
340
@@ -606,7 +613,8 @@ const InteralTable = defineComponent<
606
613
rowClassName = { internalRowClassName }
607
614
// Internal
608
615
internalHooks = { INTERNAL_HOOKS }
609
- internalRefs = { internalRefs as any }
616
+ internalRefs = { internalRefs }
617
+ onUpdateInternalRefs = { updateInternalRefs }
610
618
transformColumns = { transformColumns }
611
619
v-slots = { {
612
620
...slots ,
0 commit comments