From 8e5b980cef5b2b07d312e7ff319a1a3f6b3f7ef9 Mon Sep 17 00:00:00 2001 From: Liooo Date: Wed, 28 Mar 2018 14:04:27 +0900 Subject: [PATCH] 2.1.0 added showConsoleDebug option --- README.md | 2 +- bower.json | 2 +- dist/angular-vs-repeat.js | 10 +++++++--- dist/angular-vs-repeat.min.js | 2 +- package-lock.json | 2 +- package.json | 2 +- src/angular-vs-repeat.js | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 74abd12..5519541 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -angular-vs-repeat v2.0.8 +angular-vs-repeat v2.1.0 ================= Looking for a version for Angular 2? diff --git a/bower.json b/bower.json index feb98a1..94cd66a 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-vs-repeat", - "version": "2.0.8", + "version": "2.1.0", "description": "Virtual Scroll for AngularJS ngRepeat directive", "homepage": "http://kamilkp.github.io/angular-vs-repeat", "main": "dist/angular-vs-repeat.min.js", diff --git a/dist/angular-vs-repeat.js b/dist/angular-vs-repeat.js index f952f35..04e0101 100644 --- a/dist/angular-vs-repeat.js +++ b/dist/angular-vs-repeat.js @@ -10,7 +10,7 @@ function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else i /** * Copyright Kamil Pękala http://github.com/kamilkp - * Angular Virtual Scroll Repeat v2.0.3 2018/03/16 + * Angular Virtual Scroll Repeat v2.1.0 2018/03/28 */ /* global console, setTimeout, module */ @@ -74,6 +74,7 @@ function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else i * `scrolled-to-end-offset` - set this number to trigger the scrolledToEnd callback n items before the last gets rendered * `scrolled-to-beginning` - callback will be called when the first item of the list is rendered * `scrolled-to-beginning-offset` - set this number to trigger the scrolledToBeginning callback n items before the first gets rendered + * `show-console-debug` - if false, suppresses debug messages in console (defaults to true) * EVENTS: * - `vsRepeatTrigger` - an event the directive listens for to manually trigger reinitialization * - `vsRepeatReinitialized` - an event the directive emits upon reinitialization done @@ -176,7 +177,8 @@ function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else i horizontal: false, autoresize: false, hunked: false, - hunkSize: 0 + hunkSize: 0, + showConsoleDebug: true }; var vsRepeatModule = angular.module('vs-repeat', []).directive('vsRepeat', ['$compile', '$parse', function ($compile, $parse) { return { @@ -556,7 +558,9 @@ function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else i __startIndex = 0; __endIndex = 1; } else { - _warnMismatch(); + if (options.showConsoleDebug) { + _warnMismatch(); + } var relativeScroll = $scrollPosition - options.offsetBefore - scrollOffset; diff --git a/dist/angular-vs-repeat.min.js b/dist/angular-vs-repeat.min.js index b003a97..b1e619b 100644 --- a/dist/angular-vs-repeat.min.js +++ b/dist/angular-vs-repeat.min.js @@ -1 +1 @@ -function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t"),b=U.element("<"+o+' class="vs-repeat-after-content">"),I=null===R.size,w=R.scrollParent?"window"===R.scrollParent?U.element(Y):X.call(z,R.scrollParent):z,S=R.horizontal?"clientWidth":"clientHeight",a=R.horizontal?"offsetWidth":"offsetHeight",T=R.horizontal?"scrollWidth":"scrollHeight",A=R.horizontal?"scrollLeft":"scrollTop";if((g.vsRepeat.totalSize=0)===w.length)throw"Specified scroll parent selector did not match any element";if(g.vsRepeat.$scrollParent=w,g.vsRepeat.sizesCumulative=[],R.debug){var s="window"===R.scrollParent?U.element(document.body):w,i=U.element('
');i.css("position","window"===R.scrollParent?"fixed":"absolute"),s.append(i),g.$on("$destroy",function(){i.remove()})}var C,O,M,_,l,d=K(w[0],S)||50;function c(){!$||$.length<1?(g[q]=[],x=0,g.vsRepeat.sizesCumulative=[0]):(x=$.length,R.size?u():p()),h()}function u(){var n=0t?P(e,t,n,a,o+1):P(e,t,a,r,o+1)}return[t>e[r]?r:n,t=R.hunkSize||0===g.vsRepeat.startIndex&&0!==C?u=!0:(Math.abs(g.vsRepeat.endIndex-O)>=R.hunkSize||g.vsRepeat.endIndex===x&&O!==x)&&(u=!0):u=g.vsRepeat.startIndex!==C||g.vsRepeat.endIndex!==O),u){var p;g[q]=$.slice(g.vsRepeat.startIndex,g.vsRepeat.endIndex),g.$emit("vsRepeatInnerCollectionUpdated",g.vsRepeat.startIndex,g.vsRepeat.endIndex,C,O),R.scrolledToEnd&&(p=$.length-R.scrolledToEndOffset,(g.vsRepeat.endIndex>=p&&Og.vsRepeat.startIndex&&g.$eval(R.scrolledToBeginning)),C=g.vsRepeat.startIndex,O=g.vsRepeat.endIndex;var v=g.vsRepeat.sizesCumulative[g.vsRepeat.startIndex]+R.offsetBefore,f=g.vsRepeat.sizesCumulative[g.vsRepeat.startIndex+g[q].length]+R.offsetBefore,h=g.vsRepeat.totalSize;y.css(B(),v+"px"),b.css(B(),h-f+"px")}return u}R.horizontal?(y.css("height","100%"),b.css("height","100%")):(y.css("width","100%"),b.css("width","100%")),e.vsRepeatOptions&&g.$watchCollection(e.vsRepeatOptions,function(e){var t=_extends({},R,e);JSON.stringify(t)!==JSON.stringify(R)&&(Object.assign(R,e),n(R),h())}),g.$watchCollection(N,function(){var e=0\n\t \t.vs-repeat-debug-element {\n top: 50%;\n left: 0;\n right: 0;\n height: 1px;\n background: red;\n z-index: 99999999;\n box-shadow: 0 0 20px red;\n }\n\n .vs-repeat-debug-element + .vs-repeat-debug-element {\n display: none;\n }\n '),"undefined"!=typeof module&&module.exports&&(module.exports=e.name)}(window,window.angular); \ No newline at end of file +function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t"),b=U.element("<"+o+' class="vs-repeat-after-content">"),I=null===R.size,w=R.scrollParent?"window"===R.scrollParent?U.element(Y):X.call(z,R.scrollParent):z,S=R.horizontal?"clientWidth":"clientHeight",a=R.horizontal?"offsetWidth":"offsetHeight",T=R.horizontal?"scrollWidth":"scrollHeight",C=R.horizontal?"scrollLeft":"scrollTop";if((g.vsRepeat.totalSize=0)===w.length)throw"Specified scroll parent selector did not match any element";if(g.vsRepeat.$scrollParent=w,g.vsRepeat.sizesCumulative=[],R.debug){var s="window"===R.scrollParent?U.element(document.body):w,i=U.element('
');i.css("position","window"===R.scrollParent?"fixed":"absolute"),s.append(i),g.$on("$destroy",function(){i.remove()})}var A,O,M,_,l,d=K(w[0],S)||50;function c(){!$||$.length<1?(g[q]=[],x=0,g.vsRepeat.sizesCumulative=[0]):(x=$.length,R.size?u():p()),h()}function u(){var n=0t?P(e,t,n,a,o+1):P(e,t,a,r,o+1)}return[t>e[r]?r:n,t=R.hunkSize||0===g.vsRepeat.startIndex&&0!==A?u=!0:(Math.abs(g.vsRepeat.endIndex-O)>=R.hunkSize||g.vsRepeat.endIndex===x&&O!==x)&&(u=!0):u=g.vsRepeat.startIndex!==A||g.vsRepeat.endIndex!==O),u){var p;g[q]=$.slice(g.vsRepeat.startIndex,g.vsRepeat.endIndex),g.$emit("vsRepeatInnerCollectionUpdated",g.vsRepeat.startIndex,g.vsRepeat.endIndex,A,O),R.scrolledToEnd&&(p=$.length-R.scrolledToEndOffset,(g.vsRepeat.endIndex>=p&&Og.vsRepeat.startIndex&&g.$eval(R.scrolledToBeginning)),A=g.vsRepeat.startIndex,O=g.vsRepeat.endIndex;var v=g.vsRepeat.sizesCumulative[g.vsRepeat.startIndex]+R.offsetBefore,f=g.vsRepeat.sizesCumulative[g.vsRepeat.startIndex+g[q].length]+R.offsetBefore,h=g.vsRepeat.totalSize;y.css(B(),v+"px"),b.css(B(),h-f+"px")}return u}R.horizontal?(y.css("height","100%"),b.css("height","100%")):(y.css("width","100%"),b.css("width","100%")),e.vsRepeatOptions&&g.$watchCollection(e.vsRepeatOptions,function(e){var t=_extends({},R,e);JSON.stringify(t)!==JSON.stringify(R)&&(Object.assign(R,e),n(R),h())}),g.$watchCollection(j,function(){var e=0\n\t \t.vs-repeat-debug-element {\n top: 50%;\n left: 0;\n right: 0;\n height: 1px;\n background: red;\n z-index: 99999999;\n box-shadow: 0 0 20px red;\n }\n\n .vs-repeat-debug-element + .vs-repeat-debug-element {\n display: none;\n }\n '),"undefined"!=typeof module&&module.exports&&(module.exports=e.name)}(window,window.angular); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 44a2b9e..c4c5afc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "angular-vs-repeat", - "version": "2.0.8", + "version": "2.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 73775d3..452472f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-vs-repeat", - "version": "2.0.8", + "version": "2.1.0", "description": "Virtual Scroll for AngularJS ngRepeat directive", "homepage": "http://kamilkp.github.io/angular-vs-repeat", "license": "MIT", diff --git a/src/angular-vs-repeat.js b/src/angular-vs-repeat.js index 9902d86..0b4718c 100644 --- a/src/angular-vs-repeat.js +++ b/src/angular-vs-repeat.js @@ -1,6 +1,6 @@ /** * Copyright Kamil Pękala http://github.com/kamilkp - * Angular Virtual Scroll Repeat v2.0.8 2018/03/22 + * Angular Virtual Scroll Repeat v2.1.0 2018/03/28 */ /* global console, setTimeout, module */