Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

v2-lazy-list

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v2-lazy-list - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

2

dist/index.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("beautify-scrollbar")):"function"==typeof define&&define.amd?define(["beautify-scrollbar"],e):"object"==typeof exports?exports.V2LazyList=e(require("beautify-scrollbar")):t.V2LazyList=e(t.BeautifyScrollbar)}(window,function(t){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(e,n){e.exports=t},function(t,e,n){"use strict";function i(t,e){for(var n=[],i={},r=0;r<e.length;r++){var o=e[r],s=o[0],a={id:t+":"+r,css:o[1],media:o[2],sourceMap:o[3]};i[s]?i[s].parts.push(a):n.push(i[s]={id:s,parts:[a]})}return n}n.r(e),n.d(e,"default",function(){return f});var r="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!r)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var o={},s=r&&(document.head||document.getElementsByTagName("head")[0]),a=null,l=0,u=!1,d=function(){},h=null,c="data-vue-ssr-id",p="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function f(t,e,n,r){u=n,h=r||{};var s=i(t,e);return g(s),function(e){for(var n=[],r=0;r<s.length;r++){var a=s[r];(l=o[a.id]).refs--,n.push(l)}for(e?g(s=i(t,e)):s=[],r=0;r<n.length;r++){var l;if(0===(l=n[r]).refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete o[l.id]}}}}function g(t){for(var e=0;e<t.length;e++){var n=t[e],i=o[n.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](n.parts[r]);for(;r<n.parts.length;r++)i.parts.push(v(n.parts[r]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{var s=[];for(r=0;r<n.parts.length;r++)s.push(v(n.parts[r]));o[n.id]={id:n.id,refs:1,parts:s}}}}function b(){var t=document.createElement("style");return t.type="text/css",s.appendChild(t),t}function v(t){var e,n,i=document.querySelector("style["+c+'~="'+t.id+'"]');if(i){if(u)return d;i.parentNode.removeChild(i)}if(p){var r=l++;i=a||(a=b()),e=x.bind(null,i,r,!1),n=x.bind(null,i,r,!0)}else i=b(),e=function(t,e){var n=e.css,i=e.media,r=e.sourceMap;if(i&&t.setAttribute("media",i),h.ssrId&&t.setAttribute(c,e.id),r&&(n+="\n/*# sourceURL="+r.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,i),n=function(){i.parentNode.removeChild(i)};return e(t),function(i){if(i){if(i.css===t.css&&i.media===t.media&&i.sourceMap===t.sourceMap)return;e(t=i)}else n()}}var y,m=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function x(t,e,n,i){var r=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=m(e,r);else{var o=document.createTextNode(r),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(o,s[e]):t.appendChild(o)}}},function(t,e,n){"use strict";n.r(e),n(5);var i=n(0),r=n.n(i),o={name:"v2-lazy-list",props:{data:{type:Array,default:function(){return[]},required:!0},height:{type:[Number,String],default:100},itemHeight:{type:[Number,String],default:40},tag:{type:String,default:"ul"},itemTag:{type:String,default:"li"},threshold:{type:[Number,String],default:0}},data:function(){var t=Number.parseInt(this.height),e=Number.parseInt(this.itemHeight);return{renderList:[],scrollTop:0,viewportWith:0,viewportHeight:Number.isNaN(t)||t<100?100:t,ih:Number.isNaN(e)||e<20?20:e,contentWidth:NaN,contentHeight:NaN,contentMarginTop:0,scrollbar:null}},watch:{data:function(t){var e=this;this.initRenderList(),this.scrollbar&&this.$nextTick(function(){e.scrollbar.update({contentHeight:e.contentHeight})})},scrollTop:function(t){this.updateRenderList(),this.threshold>0&&this.contentHeight-this.viewportHeight-t<=this.threshold&&this.reachThreshold()}},provide:function(){return{list:this}},render:function(t){this.$h||(this.$h=t);var e=t(this.tag,{class:{"v2-lazy-list":!0},style:{marginTop:this.contentMarginTop+"px"}},this.renderList);return t("div",{class:{"v2-lazy-list-wrap":!0},style:{height:this.viewportHeight+"px"}},[e])},methods:{renderItem:function(){},initRenderList:function(){this.contentHeight=Math.ceil(this.data.length*this.ih),this.renderList=this.getRenderList()},updateRenderList:function(){this.renderList=this.getRenderList()},getRenderList:function(){for(var t=[],e=Math.floor(this.scrollTop/this.ih),n=Math.ceil((this.scrollTop+this.viewportHeight)/this.ih),i=e;i<n;i++)void 0!==this.data[i]&&t.push(this.$h(this.itemTag,{class:{"lazy-list-item":!0},style:{height:this.ih+"px",lineHeight:this.ih+"px"}},this.$scopedSlots.default?this.$scopedSlots.default(this.data[i]):[i]));return this.contentMarginTop=e*this.ih,t},updateScrollVal:function(){this.scrollTop=this.scrollbar.element.scrollTop},reachThreshold:function(){this.$emit("reach-threshold")}},mounted:function(){var t=this;this.viewportWith=this.$el.clientWidth,this.data.length&&this.initRenderList(),this.$nextTick(function(){t.scrollbar=new r.a(t.$el,{contentWidth:t.contentWidth,contentHeight:t.contentHeight}),t.$el.addEventListener("bs-update-scroll-value",t.updateScrollVal,!1)})},beforeDestroy:function(){this.scrollbar&&this.scrollbar.destroy(),this.$el.removeEventListener("bs-update-scroll-value",this.updateScrollVal,!1)}},s={install:function(t){if(t.version<2.2)throw new Error("Only adapted to Vue 2.2.0 or higher");t.component(o.name,o)}};e.default=s,"undefined"!=typeof window&&window.Vue&&window.Vue.use(s)},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n,i=t[1]||"",r=t[3];if(!r)return i;if(e&&"function"==typeof btoa){var o=(n=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"),s=r.sources.map(function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"});return[i].concat(s).concat([o]).join("\n")}return[i].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},r=0;r<this.length;r++){var o=this[r][0];"number"==typeof o&&(i[o]=!0)}for(r=0;r<t.length;r++){var s=t[r];"number"==typeof s[0]&&i[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},function(t,e,n){(t.exports=n(3)(!1)).push([t.i,".v2-lazy-list-wrap {\n position: relative;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n width: 100%;\n overflow: hidden;\n border: 1px solid #d1d5da;\n}\n.v2-lazy-list-wrap ul,\n.v2-lazy-list-wrap ol {\n list-style: none;\n}\n.v2-lazy-list {\n position: relative;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n border: none;\n display: block;\n}\n.lazy-list-item {\n position: relative;\n display: block;\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n border-bottom: 1px solid #d1d5da;\n}\n.lazy-list-item:last-child {\n border-bottom: none;\n}\n",""])},function(t,e,n){var i=n(4);"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals),(0,n(1).default)("6f27e697",i,!0,{})}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("beautify-scrollbar")):"function"==typeof define&&define.amd?define(["beautify-scrollbar"],e):"object"==typeof exports?exports.V2LazyList=e(require("beautify-scrollbar")):t.V2LazyList=e(t.BeautifyScrollbar)}(window,function(t){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},i.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(e,i){e.exports=t},function(t,e,i){"use strict";function n(t,e){for(var i=[],n={},r=0;r<e.length;r++){var o=e[r],s=o[0],a={id:t+":"+r,css:o[1],media:o[2],sourceMap:o[3]};n[s]?n[s].parts.push(a):i.push(n[s]={id:s,parts:[a]})}return i}i.r(e),i.d(e,"default",function(){return f});var r="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!r)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var o={},s=r&&(document.head||document.getElementsByTagName("head")[0]),a=null,l=0,h=!1,d=function(){},u=null,c="data-vue-ssr-id",p="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function f(t,e,i,r){h=i,u=r||{};var s=n(t,e);return g(s),function(e){for(var i=[],r=0;r<s.length;r++){var a=s[r];(l=o[a.id]).refs--,i.push(l)}for(e?g(s=n(t,e)):s=[],r=0;r<i.length;r++){var l;if(0===(l=i[r]).refs){for(var h=0;h<l.parts.length;h++)l.parts[h]();delete o[l.id]}}}}function g(t){for(var e=0;e<t.length;e++){var i=t[e],n=o[i.id];if(n){n.refs++;for(var r=0;r<n.parts.length;r++)n.parts[r](i.parts[r]);for(;r<i.parts.length;r++)n.parts.push(b(i.parts[r]));n.parts.length>i.parts.length&&(n.parts.length=i.parts.length)}else{var s=[];for(r=0;r<i.parts.length;r++)s.push(b(i.parts[r]));o[i.id]={id:i.id,refs:1,parts:s}}}}function v(){var t=document.createElement("style");return t.type="text/css",s.appendChild(t),t}function b(t){var e,i,n=document.querySelector("style["+c+'~="'+t.id+'"]');if(n){if(h)return d;n.parentNode.removeChild(n)}if(p){var r=l++;n=a||(a=v()),e=x.bind(null,n,r,!1),i=x.bind(null,n,r,!0)}else n=v(),e=function(t,e){var i=e.css,n=e.media,r=e.sourceMap;if(n&&t.setAttribute("media",n),u.ssrId&&t.setAttribute(c,e.id),r&&(i+="\n/*# sourceURL="+r.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),t.styleSheet)t.styleSheet.cssText=i;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(i))}}.bind(null,n),i=function(){n.parentNode.removeChild(n)};return e(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;e(t=n)}else i()}}var m,y=(m=[],function(t,e){return m[t]=e,m.filter(Boolean).join("\n")});function x(t,e,i,n){var r=i?"":n.css;if(t.styleSheet)t.styleSheet.cssText=y(e,r);else{var o=document.createTextNode(r),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(o,s[e]):t.appendChild(o)}}},function(t,e,i){"use strict";i.r(e),i(5);var n=i(0),r=i.n(n),o={name:"v2-lazy-list",props:{data:{type:Array,default:function(){return[]},required:!0},height:{type:[Number,String],default:100},itemHeight:{type:[Number,String],default:40},tag:{type:String,default:"ul"},itemTag:{type:String,default:"li"},threshold:{type:[Number,String],default:0},mode:{type:String,default:"demand",validator:function(t){return["demand","lazy"].indexOf(t)>-1}}},data:function(){var t=Number.parseInt(this.height),e=Number.parseInt(this.itemHeight);return{renderList:[],scrollTop:0,viewportWith:0,viewportHeight:Number.isNaN(t)||t<100?100:t,ih:Number.isNaN(e)||e<20?20:e,contentWidth:NaN,contentHeight:NaN,contentMarginTop:0,scrollbar:null}},watch:{data:function(t){var e=this;this.initRenderList(),this.scrollbar&&this.$nextTick(function(){e.scrollbar.update({contentHeight:e.contentHeight})})},scrollTop:function(t){this.updateRenderList(),this.threshold>0&&this.contentHeight-this.viewportHeight-t<=this.threshold&&this.reachThreshold()}},provide:function(){return{list:this}},render:function(t){this.$h||(this.$h=t);var e=t(this.tag,{class:{"v2-lazy-list":!0},style:{marginTop:this.contentMarginTop+"px"}},this.renderList);return t("div",{class:{"v2-lazy-list-wrap":!0},style:{height:this.viewportHeight+"px"}},[e])},methods:{initRenderList:function(){this.contentHeight=Math.ceil(this.data.length*this.ih),"demand"===this.mode?this.renderList=this.getDemandList():"lazy"===this.mode&&(this.renderList=this.getLazyList())},updateRenderList:function(){"demand"===this.mode?this.renderList=this.getDemandList():"lazy"===this.mode&&(this.renderList=this.getLazyList())},getDemandList:function(){for(var t=[],e=Math.floor(this.scrollTop/this.ih),i=Math.ceil((this.scrollTop+this.viewportHeight)/this.ih),n=e;n<i;n++)void 0!==this.data[n]&&t.push(this.$h(this.itemTag,{class:{"lazy-list-item":!0},style:{height:this.ih+"px",lineHeight:this.ih+"px"}},this.$scopedSlots.default?this.$scopedSlots.default(this.data[n]):[n]));return this.contentMarginTop=e*this.ih,t},getLazyList:function(){if(this.renderList.length===this.data.length)return this.renderList;for(var t=[].concat(this.renderList),e=t.length,i=Math.ceil((this.scrollTop+this.viewportHeight)/this.ih),n=e;n<i;n++)void 0!==this.data[n]&&t.push(this.$h(this.itemTag,{class:{"lazy-list-item":!0},style:{height:this.ih+"px",lineHeight:this.ih+"px"}},this.$scopedSlots.default?this.$scopedSlots.default(this.data[n]):[n]));return this.contentMarginTop=0,t},updateScrollVal:function(){this.scrollTop=this.scrollbar.element.scrollTop},reachThreshold:function(){this.$emit("reach-threshold")}},mounted:function(){var t=this;this.viewportWith=this.$el.clientWidth,this.data.length&&this.initRenderList(),this.$nextTick(function(){t.scrollbar=new r.a(t.$el,{contentWidth:t.contentWidth,contentHeight:t.contentHeight}),t.$el.addEventListener("bs-update-scroll-value",t.updateScrollVal,!1)})},beforeDestroy:function(){this.scrollbar&&this.scrollbar.destroy(),this.$el.removeEventListener("bs-update-scroll-value",this.updateScrollVal,!1)}},s={install:function(t){if(t.version<2.5)throw new Error("Only adapted to Vue 2.5.0 or higher");t.component(o.name,o)}};e.default=s,"undefined"!=typeof window&&window.Vue&&window.Vue.use(s)},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var i=function(t,e){var i,n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=(i=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),s=r.sources.map(function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"});return[n].concat(s).concat([o]).join("\n")}return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+i+"}":i}).join("")},e.i=function(t,i){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},r=0;r<this.length;r++){var o=this[r][0];"number"==typeof o&&(n[o]=!0)}for(r=0;r<t.length;r++){var s=t[r];"number"==typeof s[0]&&n[s[0]]||(i&&!s[2]?s[2]=i:i&&(s[2]="("+s[2]+") and ("+i+")"),e.push(s))}},e}},function(t,e,i){(t.exports=i(3)(!1)).push([t.i,".v2-lazy-list-wrap {\n position: relative;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n width: 100%;\n overflow: hidden;\n border: 1px solid #d1d5da;\n}\n.v2-lazy-list-wrap ul,\n.v2-lazy-list-wrap ol {\n list-style: none;\n}\n.v2-lazy-list {\n position: relative;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n border: none;\n display: block;\n}\n.lazy-list-item {\n position: relative;\n display: block;\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n border-bottom: 1px solid #d1d5da;\n}\n.lazy-list-item:last-child {\n border-bottom: none;\n}\n",""])},function(t,e,i){var n=i(4);"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals),(0,i(1).default)("6f27e697",n,!0,{})}])});
{
"name": "v2-lazy-list",
"version": "2.0.0",
"version": "2.1.0",
"description": "A simple lazy load list component based Vue 2.x",

@@ -5,0 +5,0 @@ "author": "dwqs",

@@ -5,2 +5,4 @@ ![webpack-4](https://img.shields.io/badge/webpack-4-brightgreen.svg) ![vue-version](https://img.shields.io/badge/vue-%3E%3D2.5.0-brightgreen.svg) ![license](https://img.shields.io/badge/license-MIT-brightgreen.svg) ![npm-version](https://img.shields.io/npm/v/v2-lazy-list.svg) [![build pass](https://api.travis-ci.org/dwqs/v2-lazy-list.svg?branch=master)](https://travis-ci.org/dwqs/v2-lazy-list?branch=master)

>v1.x is not maintained
## Installation

@@ -42,2 +44,3 @@

| item-tag | String | HTML tag name | 'li' | item element tag |
| mode | String | demand/lazy | 'demand' | render demand list or lazy list |

@@ -44,0 +47,0 @@ ## Events

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc