import{c as Q}from"./@babel.f9bcab46.js";import{r as Z}from"./vue.fd9b772e.js";var k={exports:{}};/*! * vue-virtual-scroll-list v2.3.5-13 * open source under the MIT license * https://github.com/tangbc/vue-virtual-scroll-list#readme */(function($,tt){(function(h,m){$.exports=m(Z)})(Q,function(h){h=h&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h;function m(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?m=function(e){return typeof e}:m=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(r)}function w(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function C(r,e){for(var t=0;tr.length)&&(e=r.length);for(var t=0,i=new Array(e);t0&&arguments[0]!==void 0?arguments[0]:null,i=this.range.start;this.isFront()?i=i-B:this.isBehind()&&(i=i+B),i=Math.max(i,0),t&&m(t)==="object"&&typeof t.estimateSize=="number"?this.temporaryEstimatedSize=t.estimateSize:this.temporaryEstimatedSize=0,this.updateRange(this.range.start,this.getEndByStart(i))}},{key:"handleSlotSizeChange",value:function(){this.handleDataSourcesChange()}},{key:"handleScroll",value:function(t){this.direction=tthis.range.start)){var i=Math.max(t-this.param.buffer,0);this.checkRange(i,this.getEndByStart(i))}}},{key:"handleBehind",value:function(){var t=this.getScrollOvers();tt&&(o=s-1)}return i>0?--i:0}},{key:"getIndexOffset",value:function(t){if(!t)return 0;for(var i=0,s=0,n=0;n0?this.temporaryEstimatedSize:this.param.estimateSize}}]),r}(),K={dataKey:{type:[String,Function],required:!0},dataSources:{type:Array,required:!0},dataComponent:{type:[Object,Function],required:!0},keeps:{type:Number,default:30},extraProps:{type:Object},estimateSize:{type:Number,default:50},direction:{type:String,default:"vertical"},start:{type:Number,default:0},offset:{type:Number,default:0},topThreshold:{type:Number,default:0},bottomThreshold:{type:Number,default:0},pageMode:{type:Boolean,default:!1},rootTag:{type:String,default:"div"},wrapTag:{type:String,default:"div"},wrapClass:{type:String,default:""},wrapStyle:{type:Object},itemTag:{type:String,default:"div"},itemClass:{type:String,default:""},itemClassAdd:{type:Function},itemStyle:{type:Object},headerTag:{type:String,default:"div"},headerClass:{type:String,default:""},headerStyle:{type:Object},footerTag:{type:String,default:"div"},footerClass:{type:String,default:""},footerStyle:{type:Object},itemScopedSlots:{type:Object},disabled:{type:Boolean,default:!1},activePrefix:{type:String,default:""}},V={index:{type:Number},event:{type:String},tag:{type:String},horizontal:{type:Boolean},source:{type:Object},component:{type:[Object,Function]},slotComponent:{type:Function},uniqueKey:{type:[String,Number]},extraProps:{type:Object},scopedSlots:{type:Object}},Y={event:{type:String},uniqueKey:{type:String},tag:{type:String},horizontal:{type:Boolean}},R={created:function(){this.shapeKey=this.horizontal?"offsetWidth":"offsetHeight"},mounted:function(){var e=this;typeof ResizeObserver!="undefined"&&(this.resizeObserver=new ResizeObserver(function(){e.dispatchSizeChange()}),this.resizeObserver.observe(this.$el))},updated:function(){this.dispatchSizeChange()},beforeDestroy:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},methods:{getCurrentSize:function(){return this.$el?this.$el[this.shapeKey]:0},dispatchSizeChange:function(){this.$parent.$emit(this.event,this.uniqueKey,this.getCurrentSize(),this.hasInitial)}}},U=h.component("virtual-list-item",{mixins:[R],props:V,render:function(e){var t=this.tag,i=this.component,s=this.extraProps,n=s===void 0?{}:s,o=this.index,a=this.source,l=this.scopedSlots,p=l===void 0?{}:l,g=this.uniqueKey,u=this.slotComponent,f=_({},n,{source:a,index:o});return e(t,{key:g,attrs:{role:"listitem"}},[u?u({item:a,index:o,scope:f}):e(i,{props:f,scopedSlots:p})])}}),F=h.component("virtual-list-slot",{mixins:[R],props:Y,render:function(e){var t=this.tag,i=this.uniqueKey;return e(t,{key:i,attrs:{role:i}},this.$slots.default)}}),z={ITEM:"item_resize",SLOT:"slot_resize"},b={HEADER:"thead",FOOTER:"tfoot"},X=h.component("virtual-list",{props:K,data:function(){return{range:null,toBottomTime:null}},watch:{"dataSources.length":function(e){this.virtual.updateParam("uniqueIds",this.getUniqueIdFromDataSources()),this.virtual.handleDataSourcesChange(e>0?this.dataSources[e-1]:null)},estimateSize:function(e){this.virtual.updateParam("estimateSize",e)},keeps:function(e){this.virtual.updateParam("keeps",e),this.virtual.handleSlotSizeChange()},start:function(e){this.scrollToIndex(e)},offset:function(e){this.scrollToOffset(e)}},created:function(){this.isHorizontal=this.direction==="horizontal",this.directionKey=this.isHorizontal?"scrollLeft":"scrollTop",this.installVirtual(),this.$on(z.ITEM,this.onItemResized),(this.$slots.header||this.$slots.footer)&&this.$on(z.SLOT,this.onSlotResized)},activated:function(){this.scrollToOffset(this.virtual.offset),this.pageMode&&document.addEventListener("scroll",this.onScroll,{passive:!1})},deactivated:function(){this.pageMode&&document.removeEventListener("scroll",this.onScroll)},mounted:function(){this.start?this.scrollToIndex(this.start):this.offset&&this.scrollToOffset(this.offset),this.pageMode&&(this.updatePageModeFront(),document.addEventListener("scroll",this.onScroll,{passive:!1}))},beforeDestroy:function(){this.virtual.destroy(),this.pageMode&&document.removeEventListener("scroll",this.onScroll)},methods:{getSize:function(e){return this.virtual.sizes.get(e)},getSizes:function(){return this.virtual.sizes.size},getOffset:function(){if(this.pageMode)return document.documentElement[this.directionKey]||document.body[this.directionKey];var e=this.$refs.root;return e?Math.ceil(e[this.directionKey]):0},getClientSize:function(){var e=this.isHorizontal?"clientWidth":"clientHeight";if(this.pageMode)return document.documentElement[e]||document.body[e];var t=this.$refs.root;return t?Math.ceil(t[e]):0},getScrollSize:function(){var e=this.isHorizontal?"scrollWidth":"scrollHeight";if(this.pageMode)return document.documentElement[e]||document.body[e];var t=this.$refs.root;return t?Math.ceil(t[e]):0},scrollToBehavior:function(e,t,i){if(i){var s={behavior:"smooth"};this.isHorizontal?s.left=t:s.top=t,e.scrollTo(s)}else e[this.directionKey]=t},scrollToOffset:function(e){var t=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(this.$emit("activity",!0),this.pageMode)this.scrollToBehavior(document.body,e,i),this.scrollToBehavior(document.documentElement,e,i);else{var s=this.$refs.root;s&&this.scrollToBehavior(s,e,i)}requestAnimationFrame(function(){t.activeEvent(t.$refs.root),t.$emit("activity",!1)})},scrollToIndex:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e>=this.dataSources.length-1)this.scrollToBottom();else{var i=this.virtual.getOffset(e);t!==0&&(i=Math.max(0,i+t)),this.scrollToOffset(i)}},scrollToBottom:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.$refs.shepherd;if(i){var s=i[this.isHorizontal?"offsetLeft":"offsetTop"];if(this.scrollToOffset(s,t),t)return;this.toBottomTime&&(clearTimeout(this.toBottomTime),this.toBottomTime=null),this.toBottomTime=setTimeout(function(){e.getOffset()+e.getClientSize()+1s+1||!s||(this.virtual.handleScroll(t),this.activeEvent(e.target),this.emitEvent(t,i,s,e))}},activeEvent:function(e){var t=this;if(!(!this.activePrefix||!e)){var i=e.getBoundingClientRect(),s=e.querySelectorAll('div[role="listitem"]');s.forEach(function(n,o){var a=n.getBoundingClientRect();if(a.topi.top&&a.lefti.left?n.classList.remove(t.activePrefix+"-leave"):n.classList.add(t.activePrefix+"-leave"),t.isHorizontal){var l=Math.min(100,a.width/2),p=a.left+l,g=a.right-l;gi.right?n.classList.remove(t.activePrefix+"-enter"):n.classList.add(t.activePrefix+"-enter")}else{var u=Math.min(100,a.height/2),f=a.top+u,y=a.bottom-u;yi.bottom?n.classList.remove(t.activePrefix+"-enter"):n.classList.add(t.activePrefix+"-enter")}})}},emitEvent:function(e,t,i,s){this.$emit("scroll",s,this.virtual.getRange()),this.virtual.isFront()&&!!this.dataSources.length&&e-this.topThreshold<=0?this.$emit("totop"):this.virtual.isBehind()&&e+t+this.bottomThreshold>=i&&this.$emit("tobottom")},getRenderSlots:function(e){for(var t=[],i=this.range,s=i.start,n=i.end,o=this.dataSources,a=this.dataKey,l=this.itemClass,p=this.itemTag,g=this.itemStyle,u=this.isHorizontal,f=this.extraProps,y=this.dataComponent,E=this.itemScopedSlots,I=this.$scopedSlots&&this.$scopedSlots.item,c=s;c<=n;c++){var S=o[c];if(S){var T=typeof a=="function"?a(S):S[a];typeof T=="string"||typeof T=="number"?t.push(e(U,{props:{index:c,tag:p,event:z.ITEM,horizontal:u,uniqueKey:T,source:S,extraProps:f,component:y,slotComponent:I,scopedSlots:E},style:g,class:[l,this.itemClassAdd?this.itemClassAdd(c):null]})):console.warn("Cannot get the data-key '".concat(a,"' from data-sources."))}else console.warn("Cannot get the index '".concat(c,"' from data-sources."))}return t}},render:function(e){var t=this.$slots,i=t.header,s=t.footer,n=this.range,o=n.padFront,a=n.padBehind,l=this.isHorizontal,p=this.pageMode,g=this.rootTag,u=this.wrapTag,f=this.wrapClass,y=this.wrapStyle,E=this.headerTag,I=this.headerClass,c=this.headerStyle,S=this.footerTag,T=this.footerClass,W=this.footerStyle,G=this.disabled,P={padding:l?"0px ".concat(a,"px 0px ").concat(o,"px"):"".concat(o,"px 0px ").concat(a,"px")},J=y?Object.assign({},y,P):P;return e(g,{ref:"root",style:G?{overflow:"hidden"}:null,on:{"&scroll":!p&&this.onScroll}},[i?e(F,{class:I,style:c,props:{tag:E,event:z.SLOT,uniqueKey:b.HEADER}},i):null,e(u,{class:f,attrs:{role:"group"},style:J},this.getRenderSlots(e)),s?e(F,{class:T,style:W,props:{tag:S,event:z.SLOT,uniqueKey:b.FOOTER}},s):null,e("div",{ref:"shepherd",style:{width:l?"0px":"100%",height:l?"100%":"0px"}})])}});return X})})(k);var rt=k.exports;export{rt as V};