@@ -2,7 +2,7 @@ import { isUndefined } from 'lodash';
22import React , { useCallback , useEffect , useMemo } from 'react' ;
33import { useImmer } from 'use-immer' ;
44
5- import { useDComponentConfig , useElement , useId , useThrottle , useAsync } from '../../hooks' ;
5+ import { useDComponentConfig , useElement , useId , useThrottle , useAsync , useDPrefixConfig } from '../../hooks' ;
66
77export interface DVirtualScrollProps < T > {
88 dTag ?: string ;
@@ -33,6 +33,7 @@ export function DVirtualScroll<T>(props: DVirtualScrollProps<T>) {
3333 ...restProps
3434 } = useDComponentConfig ( 'virtual-scroll' , props ) ;
3535
36+ const dPrefix = useDPrefixConfig ( ) ;
3637 const { throttleByAnimationFrame } = useThrottle ( ) ;
3738 const asyncCapture = useAsync ( ) ;
3839
@@ -55,8 +56,8 @@ export function DVirtualScroll<T>(props: DVirtualScrollProps<T>) {
5556 //#endregion
5657
5758 //#region Element
58- const el = useElement ( `[data-d- virtual-scroll-${ id } ]` ) ;
59- const referenceEl = useElement ( `[data-d- virtual-scroll-reference-${ id } ]` ) ;
59+ const el = useElement ( `[data-${ dPrefix } virtual-scroll-${ id } ]` ) ;
60+ const referenceEl = useElement ( `[data-${ dPrefix } virtual-scroll-reference-${ id } ]` ) ;
6061 //#endregion
6162
6263 //#region Getters.
@@ -161,10 +162,10 @@ export function DVirtualScroll<T>(props: DVirtualScrollProps<T>) {
161162 } , 20 ) ;
162163 return React . cloneElement ( _reference , {
163164 ..._reference . props ,
164- [ `data-d- virtual-scroll-reference-${ id } ` ] : 'true' ,
165+ [ `data-${ dPrefix } virtual-scroll-reference-${ id } ` ] : 'true' ,
165166 } ) ;
166167 }
167- } , [ asyncCapture , dCustomSize , dList , dRenderItem , id , referenceEl , throttleByAnimationFrame , updateList ] ) ;
168+ } , [ asyncCapture , dCustomSize , dList , dPrefix , dRenderItem , id , referenceEl , throttleByAnimationFrame , updateList ] ) ;
168169
169170 const handleScroll = useCallback (
170171 ( e ) => {
@@ -202,21 +203,21 @@ export function DVirtualScroll<T>(props: DVirtualScrollProps<T>) {
202203 overflowX : isUndefined ( dWidth ) ? undefined : 'auto' ,
203204 overflowY : isUndefined ( dHeight ) ? undefined : 'auto' ,
204205 } ,
205- [ `data-d- virtual-scroll-${ id } ` ] : 'true' ,
206+ [ `data-${ dPrefix } virtual-scroll-${ id } ` ] : 'true' ,
206207 onScroll : handleScroll ,
207208 } ,
208209 [
209210 reference ,
210211 < div
211- key = { `d- virtual-scroll-pre-fill-${ id } ` }
212+ key = { `${ dPrefix } virtual-scroll-pre-fill-${ id } ` }
212213 style = { {
213214 ...fillSize [ 0 ] ,
214215 display : isUndefined ( dWidth ) ? undefined : 'inline-block' ,
215216 } }
216217 > </ div > ,
217218 ...list ,
218219 < div
219- key = { `d- virtual-scroll-sub-fill-${ id } ` }
220+ key = { `${ dPrefix } virtual-scroll-sub-fill-${ id } ` }
220221 style = { {
221222 ...fillSize [ 1 ] ,
222223 display : isUndefined ( dWidth ) ? undefined : 'inline-block' ,
0 commit comments