import{d as b,Z as a,id as S,ie as g,r as u}from"./index-9PRMimni.js";const p={scrollbarProps:Object,items:{type:Array,default:()=>[]},itemSize:{type:Number,required:!0},itemResizable:Boolean,itemsStyle:[String,Object],visibleItemsTag:{type:[String,Object],default:"div"},visibleItemsProps:Object,ignoreItemResize:Boolean,onScroll:Function,onWheel:Function,onResize:Function,defaultScrollKey:[Number,String],defaultScrollIndex:Number,keyField:{type:String,default:"key"},paddingTop:{type:[Number,String],default:0},paddingBottom:{type:[Number,String],default:0}},I=b({name:"VirtualList",props:p,setup(t){const o=u(null),i=u(null);function n(){const{value:e}=o;e&&e.sync()}function d(e){var l;n(),(l=t.onScroll)===null||l===void 0||l.call(t,e)}function c(e){var l;n(),(l=t.onResize)===null||l===void 0||l.call(t,e)}function v(e){var l;(l=t.onWheel)===null||l===void 0||l.call(t,e)}function f(e,l){var r,s;typeof e=="number"?(r=i.value)===null||r===void 0||r.scrollTo(e,l??0):(s=i.value)===null||s===void 0||s.scrollTo(e)}function m(){var e;return(e=i.value)===null||e===void 0?void 0:e.listElRef}function h(){var e;return(e=i.value)===null||e===void 0?void 0:e.itemsElRef}return{scrollTo:f,scrollbarInstRef:o,virtualListInstRef:i,getScrollContainer:m,getScrollContent:h,handleScroll:d,handleResize:c,handleWheel:v}},render(){return a(g,Object.assign({},this.scrollbarProps,{ref:"scrollbarInstRef",container:this.getScrollContainer,content:this.getScrollContent}),{default:()=>a(S,{ref:"virtualListInstRef",showScrollbar:!1,items:this.items,itemSize:this.itemSize,itemResizable:this.itemResizable,itemsStyle:this.itemsStyle,visibleItemsTag:this.visibleItemsTag,visibleItemsProps:this.visibleItemsProps,ignoreItemResize:this.ignoreItemResize,keyField:this.keyField,defaultScrollKey:this.defaultScrollKey,defaultScrollIndex:this.defaultScrollIndex,paddingTop:this.paddingTop,paddingBottom:this.paddingBottom,onScroll:this.handleScroll,onResize:this.handleResize,onWheel:this.handleWheel},{default:({item:t,index:o})=>{var i,n;return(n=(i=this.$slots).default)===null||n===void 0?void 0:n.call(i,{item:t,index:o})}})})}});export{I as _};
