@startinfinity/vue-virtual-scroller
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -905,3 +905,3 @@ import { ObserveVisibility } from 'vue-observe-visibility'; | ||
"px)", | ||
zIndex: _vm.pool.length - view.nr.index | ||
zIndex: _vm.items.length - view.nr.index | ||
} | ||
@@ -1593,3 +1593,3 @@ : null, | ||
// eslint-disable-next-line no-undef | ||
version: "1.2.1", | ||
version: "1.2.2", | ||
install: function install(Vue, options) { | ||
@@ -1596,0 +1596,0 @@ var finalOptions = Object.assign({}, { |
@@ -1,2 +0,2 @@ | ||
var VueVirtualScroller=function(e,t){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var i={itemsLimit:1e3};function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function o(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function s(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?o(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):o(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function a(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return l(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?l(e,t):void 0}}(e))){var t=0,i=function(){};return{s:i,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,r,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,r=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw r}}}}function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e){return function(e){if(Array.isArray(e)){for(var t=0,i=new Array(e.length);t<e.length;t++)i[t]=e[t];return i}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var h=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=t,this.observer=null,this.frozen=!1,this.createObserver(i,n)}var t,i,n;return t=e,(i=[{key:"createObserver",value:function(e,t){var i=this;if(this.observer&&this.destroyObserver(),!this.frozen){var n;if(this.options="function"==typeof(n=e)?{callback:n}:n,this.callback=function(e,t){i.options.callback(e,t),e&&i.options.once&&(i.frozen=!0,i.destroyObserver())},this.callback&&this.options.throttle){var r=(this.options.throttleOptions||{}).leading;this.callback=function(e,t){var i,n,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=function(s){for(var l=arguments.length,a=new Array(l>1?l-1:0),c=1;c<l;c++)a[c-1]=arguments[c];if(r=a,!i||s!==n){var d=o.leading;"function"==typeof d&&(d=d(s,n)),i&&s===n||!d||e.apply(void 0,[s].concat(u(r))),n=s,clearTimeout(i),i=setTimeout((function(){e.apply(void 0,[s].concat(u(r))),i=0}),t)}};return s._clear=function(){clearTimeout(i),i=null},s}(this.callback,this.options.throttle,{leading:function(e){return"both"===r||"visible"===r&&e||"hidden"===r&&!e}})}this.oldResult=void 0,this.observer=new IntersectionObserver((function(e){var t=e[0];if(e.length>1){var n=e.find((function(e){return e.isIntersecting}));n&&(t=n)}if(i.callback){var r=t.isIntersecting&&t.intersectionRatio>=i.threshold;if(r===i.oldResult)return;i.oldResult=r,i.callback(r,t)}}),this.options.intersection),t.context.$nextTick((function(){i.observer&&i.observer.observe(i.el)}))}}},{key:"destroyObserver",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callback&&this.callback._clear&&(this.callback._clear(),this.callback=null)}},{key:"threshold",get:function(){return this.options.intersection&&this.options.intersection.threshold||0}}])&&d(t.prototype,i),n&&d(t,n),e}();function f(e,t,i){var n=t.value;if(n)if("undefined"==typeof IntersectionObserver)console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");else{var r=new h(e,n,i);e._vue_visibilityState=r}}function v(e){var t=e._vue_visibilityState;t&&(t.destroyObserver(),delete e._vue_visibilityState)}var p={bind:f,update:function(e,t,i){var n=t.value;if(!function e(t,i){if(t===i)return!0;if("object"===c(t)){for(var n in t)if(!e(t[n],i[n]))return!1;return!0}return!1}(n,t.oldValue)){var r=e._vue_visibilityState;n?r?r.createObserver(n,i):f(e,{value:n},i):v(e)}},unbind:v};var m={version:"0.4.6",install:function(e){e.directive("observe-visibility",p)}},y=null;"undefined"!=typeof window?y=window.Vue:"undefined"!=typeof global&&(y=global.Vue),y&&y.use(m);var b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var g=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t,i;t=b,i=function(){var e=/(auto|scroll)/,t=function(e,i){return null===e.parentNode?i:t(e.parentNode,i.concat([e]))},i=function(e,t){return getComputedStyle(e,null).getPropertyValue(t)},n=function(t){return e.test(function(e){return i(e,"overflow")+i(e,"overflow-y")+i(e,"overflow-x")}(t))};return function(e){if(e instanceof HTMLElement||e instanceof SVGElement){for(var i=t(e.parentNode,[]),r=0;r<i.length;r+=1)if(n(i[r]))return i[r];return document.scrollingElement||document.documentElement}}},e.exports?e.exports=i():t.Scrollparent=i()})),S={items:{type:Array,required:!0},keyField:{type:String,default:"id"},direction:{type:String,default:"vertical",validator:function(e){return["vertical","horizontal"].includes(e)}}};function _(){return this.items.length&&"object"!==n(this.items[0])}var $=!1;if("undefined"!=typeof window){$=!1;try{var z=Object.defineProperty({},"passive",{get:function(){$=!0}});window.addEventListener("test",null,z)}catch(e){}}var w=0;function I(e,t,i,n,r,o,s,l,a,c){"boolean"!=typeof s&&(a=l,l=s,s=!1);const d="function"==typeof i?i.options:i;let u;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,r&&(d.functional=!0)),n&&(d._scopeId=n),o?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},d._ssrRegister=u):t&&(u=s?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),u)if(d.functional){const e=d.render;d.render=function(t,i){return u.call(i),e(t,i)}}else{const e=d.beforeCreate;d.beforeCreate=e?[].concat(e,u):[u]}return i}const x={name:"RecycleScroller",directives:{ObserveVisibility:p},props:s({},S,{itemSize:{type:Number,default:null},minItemSize:{type:[Number,String],default:null},sizeField:{type:String,default:"size"},typeField:{type:String,default:"type"},buffer:{type:Number,default:200},pageMode:{type:Boolean,default:!1},prerender:{type:Number,default:0},emitUpdate:{type:Boolean,default:!1}}),data:function(){return{pool:[],totalSize:0,ready:!1,hoverKey:null}},computed:{sizes:function(){if(null===this.itemSize){for(var e,t={"-1":{accumulator:0}},i=this.items,n=this.sizeField,r=this.minItemSize,o=1e4,s=0,l=0,a=i.length;l<a;l++)(e=i[l][n]||r)<o&&(o=e),s+=e,t[l]={accumulator:s,size:e};return this.$_computedMinItemSize=o,t}return[]},simpleArray:_},watch:{items:function(){this.updateVisibleItems(!0)},pageMode:function(){this.applyPageMode(),this.updateVisibleItems(!1)},sizes:{handler:function(){this.updateVisibleItems(!1)},deep:!0}},created:function(){this.$_startIndex=0,this.$_endIndex=0,this.$_views=new Map,this.$_unusedViews=new Map,this.$_scrollAnimationRequest=null,this.$_lastUpdateScrollPosition=0,this.prerender&&(this.$_prerender=!0,this.updateVisibleItems(!1))},mounted:function(){var e=this;this.applyPageMode();var t=this.startEndIndex(this.getScroll()).totalSize;this.$refs.wrapper.style["vertical"===this.direction?"minHeight":"minWidth"]=t+"px",this.$nextTick((function(){e.$_prerender=!1,e.updateVisibleItems(!0),e.ready=!0}))},beforeDestroy:function(){this.removeListeners()},methods:{addView:function(e,t,i,n,r){var o={item:i,position:0},s={id:w++,index:t,used:!0,key:n,type:r};return Object.defineProperty(o,"nr",{configurable:!1,value:s}),e.push(o),o},unuseView:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.$_unusedViews,n=e.nr.type;i.get(n)||i.set(n,[]);var r=i.get(n);r.push(e),t||(e.nr.used=!1,e.position=-9999,this.$_views.delete(e.nr.key))},handleResize:function(){this.$emit("resize"),this.ready&&this.updateVisibleItems(!1)},handleScroll:function(e){var t=this;cancelAnimationFrame(this.$_scrollAnimationRequest),this.$_scrollAnimationRequest=requestAnimationFrame((function(){t.$_scrollAnimationRequest=!1,t.updateVisibleItems(!1,!0).continuous||(clearTimeout(t.$_refreshTimout),t.$_refreshTimout=setTimeout(t.handleScroll,100))}))},handleVisibilityChange:function(e,t){var i=this;this.ready&&(e?(this.$emit("visible"),requestAnimationFrame((function(){i.updateVisibleItems(!1)}))):this.$emit("hidden"))},startEndIndex:function(e){var t=this.itemSize,i=this.items,n=i.length,r=this.sizes;if(!n)return{startIndex:0,endIndex:0,totalSize:0};if(this.$_prerender)return{startIndex:0,endIndex:this.prerender,totalSize:null};this.$_lastUpdateScrollPosition=e.originalStart;var o=this.buffer;if(e.start-=o,e.end+=o,null===t){var s,l=0,a=n-1,c=~~(n/2);do{s=c,r[c].accumulator<e.start?l=c:c<n-1&&r[c+1].accumulator>e.start&&(a=c),c=~~((l+a)/2)}while(c!==s);c<0&&(c=0);var d,u=c,h=r[n-1].accumulator;for(d=c;d<n&&r[d].accumulator<e.end;d++)-1===d?d=i.length-1:++d>n&&(d=n);return{startIndex:u,endIndex:d,totalSize:h}}return{startIndex:Math.max(0,~~(e.start/t)),endIndex:Math.min(n,Math.ceil(e.end/t)),totalSize:n*t}},updateVisibleItems:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.itemSize,o=this.$_computedMinItemSize,s=this.typeField,l=this.simpleArray?null:this.keyField,a=this.items,c=a.length,d=this.sizes,u=this.$_views,h=this.$_unusedViews,f=this.pool;if(c&&!this.$_prerender&&(t=this.getScroll(),n)){var v=Math.abs(t.originalStart-this.$_lastUpdateScrollPosition);if(null===r&&v<o||v<r)return{continuous:!0}}var p,m=this.startEndIndex(t),y=m.startIndex,b=m.endIndex,g=m.totalSize;b-y>i.itemsLimit&&this.itemsLimitError(),this.totalSize=g;var S=y<=this.$_endIndex&&b>=this.$_startIndex;if(this.$_continuous!==S){if(S){u.clear(),h.clear();for(var _=0,$=f.length;_<$;_++)p=f[_],this.unuseView(p)}this.$_continuous=S}else if(S)for(var z=0,w=f.length;z<w;z++)(p=f[z]).nr.used&&(e&&(p.nr.index=a.findIndex((function(e){return l?e[l]===p.item[l]:e===p.item}))),(-1===p.nr.index||p.nr.index<y||p.nr.index>=b)&&this.unuseView(p));for(var I,x,O,D,V=S?null:new Map,R=y;R<b;R++){I=a[R];var T=l?I[l]:I;if(null==T)throw new Error("Key is ".concat(T," on item (keyField is '").concat(l,"')"));p=u.get(T),r||d[R].size?(p?(p.nr.used=!0,p.item=I):(x=I[s],O=h.get(x),S?O&&O.length?((p=O.pop()).item=I,p.nr.used=!0,p.nr.index=R,p.nr.key=T,p.nr.type=x):p=this.addView(f,R,I,T,x):(D=V.get(x)||0,(!O||D>=O.length)&&(p=this.addView(f,R,I,T,x),this.unuseView(p,!0),O=h.get(x)),(p=O[D]).item=I,p.nr.used=!0,p.nr.index=R,p.nr.key=T,p.nr.type=x,V.set(x,D+1),D++),u.set(T,p)),p.position=null===r?d[R-1].accumulator:R*r):p&&this.unuseView(p)}return this.$_startIndex=y,this.$_endIndex=b,this.emitUpdate&&this.$emit("update",y,b),{continuous:S}},getListenerTarget:function(){var e=g(this.$el);return!window.document||e!==window.document.documentElement&&e!==window.document.body||(e=window),e},getScroll:function(){var e=this.$el,t="vertical"===this.direction;if(this.pageMode){var i=e.getBoundingClientRect(),n=t?i.height:i.width,r=-(t?i.top:i.left),o=r,s=t?window.innerHeight:window.innerWidth;return o<0&&(s+=o,o=0),o+s>n&&(s=n-o),{originalStart:r,start:o,end:o+s}}return t?{originalStart:e.scrollTop,start:e.scrollTop,end:e.scrollTop+e.clientHeight}:{originalStart:e.scrollLeft,start:e.scrollLeft,end:e.scrollLeft+e.clientWidth}},applyPageMode:function(){this.pageMode?this.addListeners():this.removeListeners()},addListeners:function(){this.listenerTarget=this.getListenerTarget(),this.listenerTarget.addEventListener("scroll",this.handleScroll,!!$&&{passive:!0}),this.listenerTarget.addEventListener("resize",this.handleResize)},removeListeners:function(){this.listenerTarget&&(this.listenerTarget.removeEventListener("scroll",this.handleScroll),this.listenerTarget.removeEventListener("resize",this.handleResize),this.listenerTarget=null)},scrollToItem:function(e){var t=this.scrollToPosition(e),i=t.viewport,n=t.scrollDirection,r=t.scrollDistance;i[n]=r},scrollToPosition:function(e){var t=this,i=function(e){return null===t.itemSize?e>0?t.sizes[e-1].accumulator:0:e*t.itemSize}(e),n="vertical"===this.direction?{scroll:"scrollTop",start:"top"}:{scroll:"scrollLeft",start:"left"};if(this.pageMode){var r=g(this.$el),o="HTML"===r.tagName?0:r[n.scroll],s=r.getBoundingClientRect(),l=this.$el.getBoundingClientRect()[n.start]-s[n.start];return{viewport:r,scrollDirection:n.scroll,scrollDistance:i+o+l}}return{viewport:this.$el,scrollDirection:n.scroll,scrollDistance:i}},itemsLimitError:function(){var e=this;throw setTimeout((function(){console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.","Scroller:",e.$el),console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.")})),new Error("Rendered items limit reached")}}};var O=function(){var e,t,i=this,n=i.$createElement,r=i._self._c||n;return r("div",{directives:[{name:"observe-visibility",rawName:"v-observe-visibility",value:i.handleVisibilityChange,expression:"handleVisibilityChange"}],staticClass:"vue-recycle-scroller",class:(e={ready:i.ready,"page-mode":i.pageMode},e["direction-"+i.direction]=!0,e),on:{"&scroll":function(e){return i.handleScroll(e)}}},[i.$slots.before?r("div",{staticClass:"vue-recycle-scroller__slot"},[i._t("before")],2):i._e(),i._v(" "),r("div",{ref:"wrapper",staticClass:"vue-recycle-scroller__item-wrapper",style:(t={},t["vertical"===i.direction?"minHeight":"minWidth"]=i.totalSize+"px",t)},i._l(i.pool,(function(e){return r("div",{key:e.nr.id,staticClass:"vue-recycle-scroller__item-view",style:i.ready?{transform:"translate"+("vertical"===i.direction?"Y":"X")+"("+e.position+"px)",zIndex:i.pool.length-e.nr.index}:null,on:{mouseenter:function(e){return e.target.classList.add("hover")},mouseleave:function(e){return e.target.classList.remove("hover")}}},[i._t("default",null,{item:e.item,index:e.nr.index,active:e.nr.used})],2)})),0),i._v(" "),i.$slots.after?r("div",{staticClass:"vue-recycle-scroller__slot"},[i._t("after")],2):i._e()])};O._withStripped=!0;const D=I({render:O,staticRenderFns:[]},void 0,x,void 0,!1,void 0,!1,void 0,void 0,void 0);const V={name:"DynamicScroller",components:{RecycleScroller:D},inheritAttrs:!1,provide:function(){return"undefined"!=typeof ResizeObserver&&(this.$_resizeObserver=new ResizeObserver((function(e){var t,i=a(e);try{for(i.s();!(t=i.n()).done;){var n=t.value;if(n.target){var r=new CustomEvent("resize",{detail:{contentRect:n.contentRect}});n.target.dispatchEvent(r)}}}catch(e){i.e(e)}finally{i.f()}}))),{vscrollData:this.vscrollData,vscrollParent:this,vscrollResizeObserver:this.$_resizeObserver}},props:s({},S,{minItemSize:{type:[Number,String],required:!0}}),data:function(){return{vscrollData:{active:!0,sizes:{},validSizes:{},keyField:this.keyField,simpleArray:!1}}},computed:{simpleArray:_,itemsWithSize:function(){for(var e=[],t=this.items,i=this.keyField,n=this.simpleArray,r=this.vscrollData.sizes,o=0;o<t.length;o++){var s=t[o],l=n?o:s[i],a=r[l];void 0!==a||this.$_undefinedMap[l]||(a=0),e.push({item:s,id:l,size:a})}return e},listeners:function(){var e={};for(var t in this.$listeners)"resize"!==t&&"visible"!==t&&(e[t]=this.$listeners[t]);return e}},watch:{items:function(){this.forceUpdate(!1)},simpleArray:{handler:function(e){this.vscrollData.simpleArray=e},immediate:!0},direction:function(e){this.forceUpdate(!0)}},created:function(){this.$_updates=[],this.$_undefinedSizes=0,this.$_undefinedMap={}},activated:function(){this.vscrollData.active=!0},deactivated:function(){this.vscrollData.active=!1},methods:{onScrollerResize:function(){this.$refs.scroller&&this.forceUpdate(),this.$emit("resize")},onScrollerVisible:function(){this.$emit("vscroll:update",{force:!1}),this.$emit("visible")},forceUpdate:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];(e||this.simpleArray)&&(this.vscrollData.validSizes={}),this.$emit("vscroll:update",{force:!0})},scrollToItem:function(e){var t=this.$refs.scroller;t&&t.scrollToItem(e)},getItemSize:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=this.simpleArray?null!=t?t:this.items.indexOf(e):e[this.keyField];return this.vscrollData.sizes[i]||0},scrollToBottom:function(){var e=this;if(!this.$_scrollingToBottom){this.$_scrollingToBottom=!0;var t=this.$el;this.$nextTick((function(){t.scrollTop=t.scrollHeight+5e3;requestAnimationFrame((function i(){t.scrollTop=t.scrollHeight+5e3,requestAnimationFrame((function(){t.scrollTop=t.scrollHeight+5e3,0===e.$_undefinedSizes?e.$_scrollingToBottom=!1:requestAnimationFrame(i)}))}))}))}}}};var R=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("RecycleScroller",e._g(e._b({ref:"scroller",attrs:{items:e.itemsWithSize,"min-item-size":e.minItemSize,direction:e.direction,"key-field":"id"},on:{resize:e.onScrollerResize,visible:e.onScrollerVisible},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.item,n=t.index,r=t.active;return[e._t("default",null,null,{item:i.item,index:n,active:r,itemWithSize:i})]}}],null,!0)},"RecycleScroller",e.$attrs,!1),e.listeners),[e._v(" "),i("template",{slot:"before"},[e._t("before")],2),e._v(" "),i("template",{slot:"after"},[e._t("after")],2)],2)};R._withStripped=!0;const T=I({render:R,staticRenderFns:[]},void 0,V,void 0,!1,void 0,!1,void 0,void 0,void 0);const P=I({},void 0,{name:"DynamicScrollerItem",inject:["vscrollData","vscrollParent","vscrollResizeObserver"],props:{item:{required:!0},watchData:{type:Boolean,default:!1},active:{type:Boolean,required:!0},index:{type:Number,default:void 0},sizeDependencies:{type:[Array,Object],default:null},emitResize:{type:Boolean,default:!1},tag:{type:String,default:"div"}},computed:{id:function(){return this.vscrollData.simpleArray?this.index:this.item[this.vscrollData.keyField]},size:function(){return this.vscrollData.validSizes[this.id]&&this.vscrollData.sizes[this.id]||0},finalActive:function(){return this.active&&this.vscrollData.active}},watch:{watchData:"updateWatchData",id:function(){this.size||this.onDataUpdate()},finalActive:function(e){this.size||(e?this.vscrollParent.$_undefinedMap[this.id]||(this.vscrollParent.$_undefinedSizes++,this.vscrollParent.$_undefinedMap[this.id]=!0):this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=!1)),this.vscrollResizeObserver?e?this.observeSize():this.unobserveSize():e&&this.$_pendingVScrollUpdate===this.id&&this.updateSize()}},created:function(){var e=this;if(!this.$isServer&&(this.$_forceNextVScrollUpdate=null,this.updateWatchData(),!this.vscrollResizeObserver)){var t=function(t){e.$watch((function(){return e.sizeDependencies[t]}),e.onDataUpdate)};for(var i in this.sizeDependencies)t(i);this.vscrollParent.$on("vscroll:update",this.onVscrollUpdate),this.vscrollParent.$on("vscroll:update-size",this.onVscrollUpdateSize)}},mounted:function(){this.vscrollData.active&&(this.updateSize(),this.observeSize())},beforeDestroy:function(){this.vscrollParent.$off("vscroll:update",this.onVscrollUpdate),this.vscrollParent.$off("vscroll:update-size",this.onVscrollUpdateSize),this.unobserveSize()},methods:{updateSize:function(){this.finalActive?this.$_pendingSizeUpdate!==this.id&&(this.$_pendingSizeUpdate=this.id,this.$_forceNextVScrollUpdate=null,this.$_pendingVScrollUpdate=null,this.computeSize(this.id)):this.$_forceNextVScrollUpdate=this.id},updateWatchData:function(){var e=this;this.watchData?this.$_watchData=this.$watch("data",(function(){e.onDataUpdate()}),{deep:!0}):this.$_watchData&&(this.$_watchData(),this.$_watchData=null)},onVscrollUpdate:function(e){var t=e.force;!this.finalActive&&t&&(this.$_pendingVScrollUpdate=this.id),this.$_forceNextVScrollUpdate!==this.id&&!t&&this.size||this.updateSize()},onDataUpdate:function(){this.updateSize()},computeSize:function(e){var t=this;this.$nextTick((function(){if(t.id===e){var i=t.$el.offsetWidth,n=t.$el.offsetHeight;t.applySize(i,n)}t.$_pendingSizeUpdate=null}))},applySize:function(e,t){var i=Math.round("vertical"===this.vscrollParent.direction?t:e);i&&this.size!==i&&(this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=void 0),this.$set(this.vscrollData.sizes,this.id,i),this.$set(this.vscrollData.validSizes,this.id,!0),this.emitResize&&this.$emit("resize",this.id))},observeSize:function(){this.vscrollResizeObserver&&(this.vscrollResizeObserver.observe(this.$el.parentNode),this.$el.parentNode.addEventListener("resize",this.onResize))},unobserveSize:function(){this.vscrollResizeObserver&&(this.vscrollResizeObserver.unobserve(this.$el.parentNode),this.$el.parentNode.removeEventListener("resize",this.onResize))},onResize:function(e){var t=e.detail.contentRect,i=t.width,n=t.height;this.applySize(i,n)}},render:function(e){return e(this.tag,this.$slots.default)}},void 0,void 0,void 0,!1,void 0,void 0,void 0);var A={version:"1.2.1",install:function(e,t){var n=Object.assign({},{installComponents:!0,componentsPrefix:""},t);for(var r in n)void 0!==n[r]&&(i[r]=n[r]);n.installComponents&&function(e,t){e.component("".concat(t,"recycle-scroller"),D),e.component("".concat(t,"RecycleScroller"),D),e.component("".concat(t,"dynamic-scroller"),T),e.component("".concat(t,"DynamicScroller"),T),e.component("".concat(t,"dynamic-scroller-item"),P),e.component("".concat(t,"DynamicScrollerItem"),P)}(e,n.componentsPrefix)}},k=null;return"undefined"!=typeof window?k=window.Vue:"undefined"!=typeof global&&(k=global.Vue),k&&k.use(A),e.DynamicScroller=T,e.DynamicScrollerItem=P,e.IdState=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.idProp,n=void 0===i?function(e){return e.item.id}:i,r={},o=new t({data:function(){return{store:r}}});return{data:function(){return{idState:null}},created:function(){var e=this;this.$_id=null,this.$_getId="function"==typeof n?function(){return n.call(e,e)}:function(){return e[n]},this.$watch(this.$_getId,{handler:function(e){var t=this;this.$nextTick((function(){t.$_id=e}))},immediate:!0}),this.$_updateIdState()},beforeUpdate:function(){this.$_updateIdState()},methods:{$_idStateInit:function(e){var t=this.$options.idState;if("function"==typeof t){var i=t.call(this,this);return o.$set(r,e,i),this.$_id=e,i}throw new Error("[mixin IdState] Missing `idState` function on component definition.")},$_updateIdState:function(){var e=this.$_getId();null==e&&console.warn("No id found for IdState with idProp: '".concat(n,"'.")),e!==this.$_id&&(r[e]||this.$_idStateInit(e),this.idState=r[e])}}}},e.RecycleScroller=D,e.default=A,e}({},Vue); | ||
var VueVirtualScroller=function(e,t){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var i={itemsLimit:1e3};function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function o(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function s(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?o(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):o(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function a(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return l(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?l(e,t):void 0}}(e))){var t=0,i=function(){};return{s:i,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,r,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,r=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw r}}}}function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e){return function(e){if(Array.isArray(e)){for(var t=0,i=new Array(e.length);t<e.length;t++)i[t]=e[t];return i}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var h=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=t,this.observer=null,this.frozen=!1,this.createObserver(i,n)}var t,i,n;return t=e,(i=[{key:"createObserver",value:function(e,t){var i=this;if(this.observer&&this.destroyObserver(),!this.frozen){var n;if(this.options="function"==typeof(n=e)?{callback:n}:n,this.callback=function(e,t){i.options.callback(e,t),e&&i.options.once&&(i.frozen=!0,i.destroyObserver())},this.callback&&this.options.throttle){var r=(this.options.throttleOptions||{}).leading;this.callback=function(e,t){var i,n,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=function(s){for(var l=arguments.length,a=new Array(l>1?l-1:0),c=1;c<l;c++)a[c-1]=arguments[c];if(r=a,!i||s!==n){var d=o.leading;"function"==typeof d&&(d=d(s,n)),i&&s===n||!d||e.apply(void 0,[s].concat(u(r))),n=s,clearTimeout(i),i=setTimeout((function(){e.apply(void 0,[s].concat(u(r))),i=0}),t)}};return s._clear=function(){clearTimeout(i),i=null},s}(this.callback,this.options.throttle,{leading:function(e){return"both"===r||"visible"===r&&e||"hidden"===r&&!e}})}this.oldResult=void 0,this.observer=new IntersectionObserver((function(e){var t=e[0];if(e.length>1){var n=e.find((function(e){return e.isIntersecting}));n&&(t=n)}if(i.callback){var r=t.isIntersecting&&t.intersectionRatio>=i.threshold;if(r===i.oldResult)return;i.oldResult=r,i.callback(r,t)}}),this.options.intersection),t.context.$nextTick((function(){i.observer&&i.observer.observe(i.el)}))}}},{key:"destroyObserver",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callback&&this.callback._clear&&(this.callback._clear(),this.callback=null)}},{key:"threshold",get:function(){return this.options.intersection&&this.options.intersection.threshold||0}}])&&d(t.prototype,i),n&&d(t,n),e}();function f(e,t,i){var n=t.value;if(n)if("undefined"==typeof IntersectionObserver)console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");else{var r=new h(e,n,i);e._vue_visibilityState=r}}function v(e){var t=e._vue_visibilityState;t&&(t.destroyObserver(),delete e._vue_visibilityState)}var p={bind:f,update:function(e,t,i){var n=t.value;if(!function e(t,i){if(t===i)return!0;if("object"===c(t)){for(var n in t)if(!e(t[n],i[n]))return!1;return!0}return!1}(n,t.oldValue)){var r=e._vue_visibilityState;n?r?r.createObserver(n,i):f(e,{value:n},i):v(e)}},unbind:v};var m={version:"0.4.6",install:function(e){e.directive("observe-visibility",p)}},y=null;"undefined"!=typeof window?y=window.Vue:"undefined"!=typeof global&&(y=global.Vue),y&&y.use(m);var b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var g=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t,i;t=b,i=function(){var e=/(auto|scroll)/,t=function(e,i){return null===e.parentNode?i:t(e.parentNode,i.concat([e]))},i=function(e,t){return getComputedStyle(e,null).getPropertyValue(t)},n=function(t){return e.test(function(e){return i(e,"overflow")+i(e,"overflow-y")+i(e,"overflow-x")}(t))};return function(e){if(e instanceof HTMLElement||e instanceof SVGElement){for(var i=t(e.parentNode,[]),r=0;r<i.length;r+=1)if(n(i[r]))return i[r];return document.scrollingElement||document.documentElement}}},e.exports?e.exports=i():t.Scrollparent=i()})),S={items:{type:Array,required:!0},keyField:{type:String,default:"id"},direction:{type:String,default:"vertical",validator:function(e){return["vertical","horizontal"].includes(e)}}};function _(){return this.items.length&&"object"!==n(this.items[0])}var $=!1;if("undefined"!=typeof window){$=!1;try{var z=Object.defineProperty({},"passive",{get:function(){$=!0}});window.addEventListener("test",null,z)}catch(e){}}var w=0;function I(e,t,i,n,r,o,s,l,a,c){"boolean"!=typeof s&&(a=l,l=s,s=!1);const d="function"==typeof i?i.options:i;let u;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,r&&(d.functional=!0)),n&&(d._scopeId=n),o?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},d._ssrRegister=u):t&&(u=s?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),u)if(d.functional){const e=d.render;d.render=function(t,i){return u.call(i),e(t,i)}}else{const e=d.beforeCreate;d.beforeCreate=e?[].concat(e,u):[u]}return i}const x={name:"RecycleScroller",directives:{ObserveVisibility:p},props:s({},S,{itemSize:{type:Number,default:null},minItemSize:{type:[Number,String],default:null},sizeField:{type:String,default:"size"},typeField:{type:String,default:"type"},buffer:{type:Number,default:200},pageMode:{type:Boolean,default:!1},prerender:{type:Number,default:0},emitUpdate:{type:Boolean,default:!1}}),data:function(){return{pool:[],totalSize:0,ready:!1,hoverKey:null}},computed:{sizes:function(){if(null===this.itemSize){for(var e,t={"-1":{accumulator:0}},i=this.items,n=this.sizeField,r=this.minItemSize,o=1e4,s=0,l=0,a=i.length;l<a;l++)(e=i[l][n]||r)<o&&(o=e),s+=e,t[l]={accumulator:s,size:e};return this.$_computedMinItemSize=o,t}return[]},simpleArray:_},watch:{items:function(){this.updateVisibleItems(!0)},pageMode:function(){this.applyPageMode(),this.updateVisibleItems(!1)},sizes:{handler:function(){this.updateVisibleItems(!1)},deep:!0}},created:function(){this.$_startIndex=0,this.$_endIndex=0,this.$_views=new Map,this.$_unusedViews=new Map,this.$_scrollAnimationRequest=null,this.$_lastUpdateScrollPosition=0,this.prerender&&(this.$_prerender=!0,this.updateVisibleItems(!1))},mounted:function(){var e=this;this.applyPageMode();var t=this.startEndIndex(this.getScroll()).totalSize;this.$refs.wrapper.style["vertical"===this.direction?"minHeight":"minWidth"]=t+"px",this.$nextTick((function(){e.$_prerender=!1,e.updateVisibleItems(!0),e.ready=!0}))},beforeDestroy:function(){this.removeListeners()},methods:{addView:function(e,t,i,n,r){var o={item:i,position:0},s={id:w++,index:t,used:!0,key:n,type:r};return Object.defineProperty(o,"nr",{configurable:!1,value:s}),e.push(o),o},unuseView:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.$_unusedViews,n=e.nr.type;i.get(n)||i.set(n,[]);var r=i.get(n);r.push(e),t||(e.nr.used=!1,e.position=-9999,this.$_views.delete(e.nr.key))},handleResize:function(){this.$emit("resize"),this.ready&&this.updateVisibleItems(!1)},handleScroll:function(e){var t=this;cancelAnimationFrame(this.$_scrollAnimationRequest),this.$_scrollAnimationRequest=requestAnimationFrame((function(){t.$_scrollAnimationRequest=!1,t.updateVisibleItems(!1,!0).continuous||(clearTimeout(t.$_refreshTimout),t.$_refreshTimout=setTimeout(t.handleScroll,100))}))},handleVisibilityChange:function(e,t){var i=this;this.ready&&(e?(this.$emit("visible"),requestAnimationFrame((function(){i.updateVisibleItems(!1)}))):this.$emit("hidden"))},startEndIndex:function(e){var t=this.itemSize,i=this.items,n=i.length,r=this.sizes;if(!n)return{startIndex:0,endIndex:0,totalSize:0};if(this.$_prerender)return{startIndex:0,endIndex:this.prerender,totalSize:null};this.$_lastUpdateScrollPosition=e.originalStart;var o=this.buffer;if(e.start-=o,e.end+=o,null===t){var s,l=0,a=n-1,c=~~(n/2);do{s=c,r[c].accumulator<e.start?l=c:c<n-1&&r[c+1].accumulator>e.start&&(a=c),c=~~((l+a)/2)}while(c!==s);c<0&&(c=0);var d,u=c,h=r[n-1].accumulator;for(d=c;d<n&&r[d].accumulator<e.end;d++)-1===d?d=i.length-1:++d>n&&(d=n);return{startIndex:u,endIndex:d,totalSize:h}}return{startIndex:Math.max(0,~~(e.start/t)),endIndex:Math.min(n,Math.ceil(e.end/t)),totalSize:n*t}},updateVisibleItems:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.itemSize,o=this.$_computedMinItemSize,s=this.typeField,l=this.simpleArray?null:this.keyField,a=this.items,c=a.length,d=this.sizes,u=this.$_views,h=this.$_unusedViews,f=this.pool;if(c&&!this.$_prerender&&(t=this.getScroll(),n)){var v=Math.abs(t.originalStart-this.$_lastUpdateScrollPosition);if(null===r&&v<o||v<r)return{continuous:!0}}var p,m=this.startEndIndex(t),y=m.startIndex,b=m.endIndex,g=m.totalSize;b-y>i.itemsLimit&&this.itemsLimitError(),this.totalSize=g;var S=y<=this.$_endIndex&&b>=this.$_startIndex;if(this.$_continuous!==S){if(S){u.clear(),h.clear();for(var _=0,$=f.length;_<$;_++)p=f[_],this.unuseView(p)}this.$_continuous=S}else if(S)for(var z=0,w=f.length;z<w;z++)(p=f[z]).nr.used&&(e&&(p.nr.index=a.findIndex((function(e){return l?e[l]===p.item[l]:e===p.item}))),(-1===p.nr.index||p.nr.index<y||p.nr.index>=b)&&this.unuseView(p));for(var I,x,O,D,V=S?null:new Map,R=y;R<b;R++){I=a[R];var T=l?I[l]:I;if(null==T)throw new Error("Key is ".concat(T," on item (keyField is '").concat(l,"')"));p=u.get(T),r||d[R].size?(p?(p.nr.used=!0,p.item=I):(x=I[s],O=h.get(x),S?O&&O.length?((p=O.pop()).item=I,p.nr.used=!0,p.nr.index=R,p.nr.key=T,p.nr.type=x):p=this.addView(f,R,I,T,x):(D=V.get(x)||0,(!O||D>=O.length)&&(p=this.addView(f,R,I,T,x),this.unuseView(p,!0),O=h.get(x)),(p=O[D]).item=I,p.nr.used=!0,p.nr.index=R,p.nr.key=T,p.nr.type=x,V.set(x,D+1),D++),u.set(T,p)),p.position=null===r?d[R-1].accumulator:R*r):p&&this.unuseView(p)}return this.$_startIndex=y,this.$_endIndex=b,this.emitUpdate&&this.$emit("update",y,b),{continuous:S}},getListenerTarget:function(){var e=g(this.$el);return!window.document||e!==window.document.documentElement&&e!==window.document.body||(e=window),e},getScroll:function(){var e=this.$el,t="vertical"===this.direction;if(this.pageMode){var i=e.getBoundingClientRect(),n=t?i.height:i.width,r=-(t?i.top:i.left),o=r,s=t?window.innerHeight:window.innerWidth;return o<0&&(s+=o,o=0),o+s>n&&(s=n-o),{originalStart:r,start:o,end:o+s}}return t?{originalStart:e.scrollTop,start:e.scrollTop,end:e.scrollTop+e.clientHeight}:{originalStart:e.scrollLeft,start:e.scrollLeft,end:e.scrollLeft+e.clientWidth}},applyPageMode:function(){this.pageMode?this.addListeners():this.removeListeners()},addListeners:function(){this.listenerTarget=this.getListenerTarget(),this.listenerTarget.addEventListener("scroll",this.handleScroll,!!$&&{passive:!0}),this.listenerTarget.addEventListener("resize",this.handleResize)},removeListeners:function(){this.listenerTarget&&(this.listenerTarget.removeEventListener("scroll",this.handleScroll),this.listenerTarget.removeEventListener("resize",this.handleResize),this.listenerTarget=null)},scrollToItem:function(e){var t=this.scrollToPosition(e),i=t.viewport,n=t.scrollDirection,r=t.scrollDistance;i[n]=r},scrollToPosition:function(e){var t=this,i=function(e){return null===t.itemSize?e>0?t.sizes[e-1].accumulator:0:e*t.itemSize}(e),n="vertical"===this.direction?{scroll:"scrollTop",start:"top"}:{scroll:"scrollLeft",start:"left"};if(this.pageMode){var r=g(this.$el),o="HTML"===r.tagName?0:r[n.scroll],s=r.getBoundingClientRect(),l=this.$el.getBoundingClientRect()[n.start]-s[n.start];return{viewport:r,scrollDirection:n.scroll,scrollDistance:i+o+l}}return{viewport:this.$el,scrollDirection:n.scroll,scrollDistance:i}},itemsLimitError:function(){var e=this;throw setTimeout((function(){console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.","Scroller:",e.$el),console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.")})),new Error("Rendered items limit reached")}}};var O=function(){var e,t,i=this,n=i.$createElement,r=i._self._c||n;return r("div",{directives:[{name:"observe-visibility",rawName:"v-observe-visibility",value:i.handleVisibilityChange,expression:"handleVisibilityChange"}],staticClass:"vue-recycle-scroller",class:(e={ready:i.ready,"page-mode":i.pageMode},e["direction-"+i.direction]=!0,e),on:{"&scroll":function(e){return i.handleScroll(e)}}},[i.$slots.before?r("div",{staticClass:"vue-recycle-scroller__slot"},[i._t("before")],2):i._e(),i._v(" "),r("div",{ref:"wrapper",staticClass:"vue-recycle-scroller__item-wrapper",style:(t={},t["vertical"===i.direction?"minHeight":"minWidth"]=i.totalSize+"px",t)},i._l(i.pool,(function(e){return r("div",{key:e.nr.id,staticClass:"vue-recycle-scroller__item-view",style:i.ready?{transform:"translate"+("vertical"===i.direction?"Y":"X")+"("+e.position+"px)",zIndex:i.items.length-e.nr.index}:null,on:{mouseenter:function(e){return e.target.classList.add("hover")},mouseleave:function(e){return e.target.classList.remove("hover")}}},[i._t("default",null,{item:e.item,index:e.nr.index,active:e.nr.used})],2)})),0),i._v(" "),i.$slots.after?r("div",{staticClass:"vue-recycle-scroller__slot"},[i._t("after")],2):i._e()])};O._withStripped=!0;const D=I({render:O,staticRenderFns:[]},void 0,x,void 0,!1,void 0,!1,void 0,void 0,void 0);const V={name:"DynamicScroller",components:{RecycleScroller:D},inheritAttrs:!1,provide:function(){return"undefined"!=typeof ResizeObserver&&(this.$_resizeObserver=new ResizeObserver((function(e){var t,i=a(e);try{for(i.s();!(t=i.n()).done;){var n=t.value;if(n.target){var r=new CustomEvent("resize",{detail:{contentRect:n.contentRect}});n.target.dispatchEvent(r)}}}catch(e){i.e(e)}finally{i.f()}}))),{vscrollData:this.vscrollData,vscrollParent:this,vscrollResizeObserver:this.$_resizeObserver}},props:s({},S,{minItemSize:{type:[Number,String],required:!0}}),data:function(){return{vscrollData:{active:!0,sizes:{},validSizes:{},keyField:this.keyField,simpleArray:!1}}},computed:{simpleArray:_,itemsWithSize:function(){for(var e=[],t=this.items,i=this.keyField,n=this.simpleArray,r=this.vscrollData.sizes,o=0;o<t.length;o++){var s=t[o],l=n?o:s[i],a=r[l];void 0!==a||this.$_undefinedMap[l]||(a=0),e.push({item:s,id:l,size:a})}return e},listeners:function(){var e={};for(var t in this.$listeners)"resize"!==t&&"visible"!==t&&(e[t]=this.$listeners[t]);return e}},watch:{items:function(){this.forceUpdate(!1)},simpleArray:{handler:function(e){this.vscrollData.simpleArray=e},immediate:!0},direction:function(e){this.forceUpdate(!0)}},created:function(){this.$_updates=[],this.$_undefinedSizes=0,this.$_undefinedMap={}},activated:function(){this.vscrollData.active=!0},deactivated:function(){this.vscrollData.active=!1},methods:{onScrollerResize:function(){this.$refs.scroller&&this.forceUpdate(),this.$emit("resize")},onScrollerVisible:function(){this.$emit("vscroll:update",{force:!1}),this.$emit("visible")},forceUpdate:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];(e||this.simpleArray)&&(this.vscrollData.validSizes={}),this.$emit("vscroll:update",{force:!0})},scrollToItem:function(e){var t=this.$refs.scroller;t&&t.scrollToItem(e)},getItemSize:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=this.simpleArray?null!=t?t:this.items.indexOf(e):e[this.keyField];return this.vscrollData.sizes[i]||0},scrollToBottom:function(){var e=this;if(!this.$_scrollingToBottom){this.$_scrollingToBottom=!0;var t=this.$el;this.$nextTick((function(){t.scrollTop=t.scrollHeight+5e3;requestAnimationFrame((function i(){t.scrollTop=t.scrollHeight+5e3,requestAnimationFrame((function(){t.scrollTop=t.scrollHeight+5e3,0===e.$_undefinedSizes?e.$_scrollingToBottom=!1:requestAnimationFrame(i)}))}))}))}}}};var R=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("RecycleScroller",e._g(e._b({ref:"scroller",attrs:{items:e.itemsWithSize,"min-item-size":e.minItemSize,direction:e.direction,"key-field":"id"},on:{resize:e.onScrollerResize,visible:e.onScrollerVisible},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.item,n=t.index,r=t.active;return[e._t("default",null,null,{item:i.item,index:n,active:r,itemWithSize:i})]}}],null,!0)},"RecycleScroller",e.$attrs,!1),e.listeners),[e._v(" "),i("template",{slot:"before"},[e._t("before")],2),e._v(" "),i("template",{slot:"after"},[e._t("after")],2)],2)};R._withStripped=!0;const T=I({render:R,staticRenderFns:[]},void 0,V,void 0,!1,void 0,!1,void 0,void 0,void 0);const P=I({},void 0,{name:"DynamicScrollerItem",inject:["vscrollData","vscrollParent","vscrollResizeObserver"],props:{item:{required:!0},watchData:{type:Boolean,default:!1},active:{type:Boolean,required:!0},index:{type:Number,default:void 0},sizeDependencies:{type:[Array,Object],default:null},emitResize:{type:Boolean,default:!1},tag:{type:String,default:"div"}},computed:{id:function(){return this.vscrollData.simpleArray?this.index:this.item[this.vscrollData.keyField]},size:function(){return this.vscrollData.validSizes[this.id]&&this.vscrollData.sizes[this.id]||0},finalActive:function(){return this.active&&this.vscrollData.active}},watch:{watchData:"updateWatchData",id:function(){this.size||this.onDataUpdate()},finalActive:function(e){this.size||(e?this.vscrollParent.$_undefinedMap[this.id]||(this.vscrollParent.$_undefinedSizes++,this.vscrollParent.$_undefinedMap[this.id]=!0):this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=!1)),this.vscrollResizeObserver?e?this.observeSize():this.unobserveSize():e&&this.$_pendingVScrollUpdate===this.id&&this.updateSize()}},created:function(){var e=this;if(!this.$isServer&&(this.$_forceNextVScrollUpdate=null,this.updateWatchData(),!this.vscrollResizeObserver)){var t=function(t){e.$watch((function(){return e.sizeDependencies[t]}),e.onDataUpdate)};for(var i in this.sizeDependencies)t(i);this.vscrollParent.$on("vscroll:update",this.onVscrollUpdate),this.vscrollParent.$on("vscroll:update-size",this.onVscrollUpdateSize)}},mounted:function(){this.vscrollData.active&&(this.updateSize(),this.observeSize())},beforeDestroy:function(){this.vscrollParent.$off("vscroll:update",this.onVscrollUpdate),this.vscrollParent.$off("vscroll:update-size",this.onVscrollUpdateSize),this.unobserveSize()},methods:{updateSize:function(){this.finalActive?this.$_pendingSizeUpdate!==this.id&&(this.$_pendingSizeUpdate=this.id,this.$_forceNextVScrollUpdate=null,this.$_pendingVScrollUpdate=null,this.computeSize(this.id)):this.$_forceNextVScrollUpdate=this.id},updateWatchData:function(){var e=this;this.watchData?this.$_watchData=this.$watch("data",(function(){e.onDataUpdate()}),{deep:!0}):this.$_watchData&&(this.$_watchData(),this.$_watchData=null)},onVscrollUpdate:function(e){var t=e.force;!this.finalActive&&t&&(this.$_pendingVScrollUpdate=this.id),this.$_forceNextVScrollUpdate!==this.id&&!t&&this.size||this.updateSize()},onDataUpdate:function(){this.updateSize()},computeSize:function(e){var t=this;this.$nextTick((function(){if(t.id===e){var i=t.$el.offsetWidth,n=t.$el.offsetHeight;t.applySize(i,n)}t.$_pendingSizeUpdate=null}))},applySize:function(e,t){var i=Math.round("vertical"===this.vscrollParent.direction?t:e);i&&this.size!==i&&(this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=void 0),this.$set(this.vscrollData.sizes,this.id,i),this.$set(this.vscrollData.validSizes,this.id,!0),this.emitResize&&this.$emit("resize",this.id))},observeSize:function(){this.vscrollResizeObserver&&(this.vscrollResizeObserver.observe(this.$el.parentNode),this.$el.parentNode.addEventListener("resize",this.onResize))},unobserveSize:function(){this.vscrollResizeObserver&&(this.vscrollResizeObserver.unobserve(this.$el.parentNode),this.$el.parentNode.removeEventListener("resize",this.onResize))},onResize:function(e){var t=e.detail.contentRect,i=t.width,n=t.height;this.applySize(i,n)}},render:function(e){return e(this.tag,this.$slots.default)}},void 0,void 0,void 0,!1,void 0,void 0,void 0);var A={version:"1.2.2",install:function(e,t){var n=Object.assign({},{installComponents:!0,componentsPrefix:""},t);for(var r in n)void 0!==n[r]&&(i[r]=n[r]);n.installComponents&&function(e,t){e.component("".concat(t,"recycle-scroller"),D),e.component("".concat(t,"RecycleScroller"),D),e.component("".concat(t,"dynamic-scroller"),T),e.component("".concat(t,"DynamicScroller"),T),e.component("".concat(t,"dynamic-scroller-item"),P),e.component("".concat(t,"DynamicScrollerItem"),P)}(e,n.componentsPrefix)}},k=null;return"undefined"!=typeof window?k=window.Vue:"undefined"!=typeof global&&(k=global.Vue),k&&k.use(A),e.DynamicScroller=T,e.DynamicScrollerItem=P,e.IdState=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.idProp,n=void 0===i?function(e){return e.item.id}:i,r={},o=new t({data:function(){return{store:r}}});return{data:function(){return{idState:null}},created:function(){var e=this;this.$_id=null,this.$_getId="function"==typeof n?function(){return n.call(e,e)}:function(){return e[n]},this.$watch(this.$_getId,{handler:function(e){var t=this;this.$nextTick((function(){t.$_id=e}))},immediate:!0}),this.$_updateIdState()},beforeUpdate:function(){this.$_updateIdState()},methods:{$_idStateInit:function(e){var t=this.$options.idState;if("function"==typeof t){var i=t.call(this,this);return o.$set(r,e,i),this.$_id=e,i}throw new Error("[mixin IdState] Missing `idState` function on component definition.")},$_updateIdState:function(){var e=this.$_getId();null==e&&console.warn("No id found for IdState with idProp: '".concat(n,"'.")),e!==this.$_id&&(r[e]||this.$_idStateInit(e),this.idState=r[e])}}}},e.RecycleScroller=D,e.default=A,e}({},Vue); | ||
//# sourceMappingURL=vue-virtual-scroller.min.js.map |
@@ -1263,3 +1263,3 @@ (function (global, factory) { | ||
"px)", | ||
zIndex: _vm.pool.length - view.nr.index | ||
zIndex: _vm.items.length - view.nr.index | ||
} | ||
@@ -1951,3 +1951,3 @@ : null, | ||
// eslint-disable-next-line no-undef | ||
version: "1.2.1", | ||
version: "1.2.2", | ||
install: function install(Vue, options) { | ||
@@ -1954,0 +1954,0 @@ var finalOptions = Object.assign({}, { |
{ | ||
"name": "@startinfinity/vue-virtual-scroller", | ||
"description": "Smooth scrolling for any amount of data", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Guillaume Chau", |
@@ -14,36 +14,2 @@ # vue-virtual-scroller | ||
## Sponsors | ||
### Gold | ||
<p align="center"> | ||
<a href="https://www.sumcumo.com/en/" target="_blank"> | ||
<img src="https://cdn.discordapp.com/attachments/258614093362102272/570728242399674380/logo-sumcumo.png" alt="sum.cumo logo" width="400px"> | ||
</a> | ||
</p> | ||
### Silver | ||
<p align="center"> | ||
<a href="https://vueschool.io/" target="_blank"> | ||
<img src="https://vueschool.io/img/logo/vueschool_logo_multicolor.svg" alt="VueSchool logo" width="200px"> | ||
</a> | ||
<a href="https://www.vuemastery.com/" target="_blank"> | ||
<img src="https://cdn.discordapp.com/attachments/258614093362102272/557267759130607630/Vue-Mastery-Big.png" alt="Vue Mastery logo" width="200px"> | ||
</a> | ||
</p> | ||
### Bronze | ||
<p align="center"> | ||
<a href="https://vuetifyjs.com" target="_blank"> | ||
<img src="https://cdn.discordapp.com/attachments/537832759985700914/537832771691872267/Horizontal_Logo_-_Dark.png" width="100"> | ||
</a> | ||
<a href="https://www.frontenddeveloperlove.com/" target="_blank" title="Frontend Developer Love"> | ||
<img src="https://cdn.discordapp.com/attachments/258614093362102272/557267744249085953/frontend_love-logo.png" width="56"> | ||
</a> | ||
</p> | ||
## Table of contents | ||
@@ -50,0 +16,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
347048
464