1
- import type { CSSProperties , HTMLAttributes , PropType } from 'vue' ;
1
+ import type { CSSProperties , ExtractPropTypes , HTMLAttributes , PropType } from 'vue' ;
2
2
import { computed , defineComponent , ref , watch } from 'vue' ;
3
3
import ResizeObserver from '../vc-resize-observer' ;
4
4
import classNames from '../_util/classNames' ;
@@ -16,36 +16,8 @@ function defaultRenderRest<ItemType>(omittedItems: ItemType[]) {
16
16
return `+ ${ omittedItems . length } ...` ;
17
17
}
18
18
19
- export interface OverflowProps < ItemType > extends HTMLAttributes {
20
- prefixCls ?: string ;
21
- data ?: ItemType [ ] ;
22
- itemKey ?: Key ;
23
- /** Used for `responsive`. It will limit render node to avoid perf issue */
24
- itemWidth ?: number ;
25
- renderItem ?: ( item : ItemType ) => VueNode ;
26
- /** @private Do not use in your production. Render raw node that need wrap Item by developer self */
27
- renderRawItem ?: ( item : ItemType , index : number ) => VueNode ;
28
- maxCount ?: number | typeof RESPONSIVE | typeof INVALIDATE ;
29
- renderRest ?: VueNode | ( ( omittedItems : ItemType [ ] ) => VueNode ) ;
30
- /** @private Do not use in your production. Render raw node that need wrap Item by developer self */
31
- renderRawRest ?: ( omittedItems : ItemType [ ] ) => VueNode ;
32
- suffix ?: VueNode ;
33
- component ?: any ;
34
- itemComponent ?: any ;
35
-
36
- /** @private This API may be refactor since not well design */
37
- onVisibleChange ?: ( visibleCount : number ) => void ;
38
-
39
- /** When set to `full`, ssr will render full items by default and remove at client side */
40
- ssr ?: 'full' ;
41
-
42
- onMousedown ?: MouseEventHandler ;
43
- }
44
-
45
- const Overflow = defineComponent ( {
46
- name : 'Overflow' ,
47
- inheritAttrs : false ,
48
- props : {
19
+ const overflowProps = ( ) => {
20
+ return {
49
21
id : String ,
50
22
prefixCls : String ,
51
23
data : Array ,
@@ -67,7 +39,14 @@ const Overflow = defineComponent({
67
39
/** When set to `full`, ssr will render full items by default and remove at client side */
68
40
ssr : String as PropType < 'full' > ,
69
41
onMousedown : Function as PropType < MouseEventHandler > ,
70
- } ,
42
+ } ;
43
+ } ;
44
+ type InterOverflowProps = Partial < ExtractPropTypes < ReturnType < typeof overflowProps > > > ;
45
+ export type OverflowProps = HTMLAttributes & InterOverflowProps ;
46
+ const Overflow = defineComponent < OverflowProps > ( {
47
+ name : 'Overflow' ,
48
+ inheritAttrs : false ,
49
+ props : overflowProps ( ) as any ,
71
50
emits : [ 'visibleChange' ] ,
72
51
setup ( props , { attrs, emit } ) {
73
52
const fullySSR = computed ( ( ) => props . ssr === 'full' ) ;
0 commit comments