import{c as Z}from"./@babel.f9bcab46.js";import{r as tt}from"./vue.fd9b772e.js";import{l as et}from"./lodash.18c5398d.js";var $={exports:{}};/*! * vue-virtual-scroll-list v2.3.5-14 * open source under the MIT license * https://github.com/tangbc/vue-virtual-scroll-list#readme */(function(q,it){(function(h,z){q.exports=z(tt,et.exports)})(Z,function(h,z){h=h&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h;function b(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?b=function(e){return typeof e}:b=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(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-F:this.isBehind()&&(i=i+F),i=Math.max(i,0),t&&b(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&&(n=s-1)}return i>0?--i:0}},{key:"getIndexOffset",value:function(t){if(!t)return 0;for(var i=0,s=0,a=0;a0?this.temporaryEstimatedSize:this.param.estimateSize}}]),r}(),U={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}},P={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)}}},X=h.component("virtual-list-item",{mixins:[P],props:V,render:function(e){var t=this.tag,i=this.component,s=this.extraProps,a=s===void 0?{}:s,n=this.index,o=this.source,l=this.scopedSlots,g=l===void 0?{}:l,u=this.uniqueKey,f=this.slotComponent,c=M({},a,{source:o,index:n});return e(t,{key:u,attrs:{role:"listitem",unique:u}},[f?f({item:o,index:n,scope:c}):e(i,{props:c,scopedSlots:g})])}}),R=h.component("virtual-list-slot",{mixins:[P],props:Y,render:function(e){var t=this.tag,i=this.uniqueKey;return e(t,{key:i,attrs:{role:i}},this.$slots.default)}}),y={ITEM:"item_resize",SLOT:"slot_resize"},T={HEADER:"thead",FOOTER:"tfoot"},W=h.component("virtual-list",{props:U,data:function(){return{range:null,toBottomTimer:null,visibleUniques: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)},visibleUniques:function(e){this.$emit("visible",JSON.parse(e))}},created:function(){this.isHorizontal=this.direction==="horizontal",this.directionKey=this.isHorizontal?"scrollLeft":"scrollTop",this.installVirtual(),this.$on(y.ITEM,this.onItemResized),(this.$slots.header||this.$slots.footer)&&this.$on(y.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.leaveAndEnter(),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.toBottomTimer&&(clearTimeout(this.toBottomTimer),this.toBottomTimer=null),this.toBottomTimer=setTimeout(function(){e.getOffset()+e.getClientSize()+1s+1||!s||(this.virtual.handleScroll(t),this.leaveAndEnter(),this.emitEvent(t,i,s,e))}},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")},leaveAndEnter:z.throttle(function(){var r=this;if(!!this.activePrefix){var e=[],t=this.$refs.root.getBoundingClientRect(),i=this.$refs.root.querySelectorAll('div[role="listitem"]');i.forEach(function(s){var a=Number(s.getAttribute("unique")),n=s.getBoundingClientRect();if(n.topt.top&&n.leftt.left?(s.classList.remove("".concat(r.activePrefix,"-leave")),e.push(a)):s.classList.add("".concat(r.activePrefix,"-leave")),r.isHorizontal){var o=Math.min(100,n.width/2),l=n.left+o,g=n.right-o;gt.right?s.classList.remove("".concat(r.activePrefix,"-enter")):s.classList.add("".concat(r.activePrefix,"-enter"))}else{var u=Math.min(100,n.height/2),f=n.top+u,c=n.bottom-u;ct.bottom?s.classList.remove("".concat(r.activePrefix,"-enter")):s.classList.add("".concat(r.activePrefix,"-enter"))}}),this.visibleUniques=JSON.stringify(e)}},16),visibleFind:z.debounce(function(){if(!!this.activePrefix){var r=this.$refs.root.querySelectorAll('div[role="listitem"]:not(.'.concat(this.activePrefix,"-leave)"));this.visibleUniques=JSON.stringify(Array.from(r).map(function(e){return Number(e.getAttribute("unique"))}))}},50),getRenderSlots:function(e){for(var t=[],i=this.range,s=i.start,a=i.end,n=this.dataSources,o=this.dataKey,l=this.itemClass,g=this.itemTag,u=this.itemStyle,f=this.isHorizontal,c=this.extraProps,O=this.dataComponent,I=this.itemScopedSlots,x=this.$scopedSlots&&this.$scopedSlots.item,d=s;d<=a;d++){var v=n[d];if(v){var S=typeof o=="function"?o(v):v[o];typeof S=="string"||typeof S=="number"?t.push(e(X,{props:{index:d,tag:g,event:y.ITEM,horizontal:f,uniqueKey:S,source:v,extraProps:c,component:O,slotComponent:x,scopedSlots:I},style:u,class:[l,this.itemClassAdd?this.itemClassAdd(d):null]})):console.warn("Cannot get the data-key '".concat(o,"' from data-sources."))}else console.warn("Cannot get the index '".concat(d,"' from data-sources."))}return t}},render:function(e){var t=this.$slots,i=t.header,s=t.footer,a=this.range,n=a.padFront,o=a.padBehind,l=this.isHorizontal,g=this.pageMode,u=this.rootTag,f=this.wrapTag,c=this.wrapClass,O=this.wrapStyle,I=this.headerTag,x=this.headerClass,d=this.headerStyle,v=this.footerTag,S=this.footerClass,J=this.footerStyle,G=this.disabled,k={padding:l?"0px ".concat(o,"px 0px ").concat(n,"px"):"".concat(n,"px 0px ").concat(o,"px")},Q=O?Object.assign({},O,k):k;return e(u,{ref:"root",style:G?{overflow:"hidden"}:null,on:{"&scroll":!g&&this.onScroll}},[i?e(R,{class:x,style:d,props:{tag:I,event:y.SLOT,uniqueKey:T.HEADER}},i):null,e(f,{class:c,attrs:{role:"group"},style:Q},this.getRenderSlots(e)),s?e(R,{class:S,style:J,props:{tag:v,event:y.SLOT,uniqueKey:T.FOOTER}},s):null,e("div",{ref:"shepherd",style:{width:l?"0px":"100%",height:l?"100%":"0px"}})])}});return W})})($);var at=$.exports;export{at as V};