ux-datagrid-scrollHistory.min.js |
|
! ux-angularjs-datagrid v.1.4.11 (c) 2016, Obogo https://github.com/obogo/ux-angularjs-datagrid License: MIT. |
(function (exports, global) {
if (typeof define === "function" && define.amd) {
define(exports);
} else if (typeof module !== "undefined" && module.exports) {
module.exports = exports;
} else {
global.ux = exports;
}
!function(a,b){"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&module.exports?module.exports=a:b.ux=a,a.datagrid.events.AFTER_SCROLL_HISTORY_INIT_SCROLL="datagrid:afterScrollHistoryInitScroll",angular.module("ux").service("scrollHistoryModel",["$location","$rootScope",function(b,c){var d={};return a.datagrid.scrollHistory=function(){function e(){return b.url()}function f(a,b){d[a]=b,k.log("storeScroll %s = %s",a,b)}function g(a){return k.getScroll(a||k.getPath())}function h(a){return d[a]||0}function i(a){a=a||e(),k.log("clearPath %s",a),delete d[a]}function j(){k.log("clear all stored values"),d={}}var k=a.logWrapper("scrollHistoryModel",{},"orange",function(){a.util.apply(c.$emit,c,arguments)});return k.getPath=e,k.getCurrentScroll=g,k.getScroll=h,k.storeScroll=f,k.clearPath=i,k.clear=j,k}(),a.datagrid.scrollHistory}]),angular.module("ux").factory("scrollHistory",function(){return["inst","scrollHistoryModel",function(b,c){var d,e,f=a.logWrapper("scrollHistory",{},"blue",b),g=b.options.scrollHistory&&b.options.scrollHistory.path||"",h=!1,i=[];return b.options.scrollHistory&&b.options.scrollHistory.ignoreParams&&(g=c.getPath().split("?").shift()),f.getPath=g?function(){return g}:c.getPath,f.storeCurrentScroll=function(){f.storeScroll(f.getPath(),b.values.scroll)},f.storeScroll=c.storeScroll,f.getCurrentScroll=g?function(){return c.getCurrentScroll(g)}:c.getCurrentScroll,f.getScroll=c.getScroll,f.clearPath=c.clearPath,f.setScrollValue=function(){e=f.getCurrentScroll(),b.scrollModel.setScroll(e)},f.setScroll=function(a){c.storeScroll(f.getPath(),a)},f.isComplete=function(){return void 0===e&&f.setScrollValue(),0===e},f.scroll=function(){b.getContentHeight()-b.getViewportHeight()<e&&b.values.scroll&&(f.log(" scrollTo 0 because scroll %s is too tall for the content",e),b.scrollModel.setScroll(0),b.scrollModel.scrollTo(0,!0))},i.push(b.scope.$on(a.datagrid.events.ON_BEFORE_DATA_CHANGE,function(){f.log("found scrollHistory so scrollTo %s",f.getCurrentScroll()),d=!0,f.setScrollValue(),h=!0,i.shift()()})),i.push(b.scope.$on(a.datagrid.events.ON_RENDER_AFTER_DATA_CHANGE,function(){b.getContentHeight()?(f.log("onRenderAfterDataChange"),h=!1,f.scroll(),b.scrollModel.iScroll||b.dispatch(a.datagrid.events.AFTER_SCROLL_HISTORY_INIT_SCROLL),i.shift()()):f.log("onRenderAfterDataChange skipped because there is no contentHeight")})),b.unwatchers.push(b.scope.$on(a.datagrid.events.ON_AFTER_UPDATE_WATCHERS,function(){d&&!h&&(e=0,f.storeCurrentScroll())})),f.destroy=function(){for(;i.length;)i.pop()();b.scrollHistory=null,f=null,b=null,c=null},b.scrollHistory=f,b}]})}(this.ux=this.ux||{},function(){return this}());
|
¶ sourceMappingURL=ux-datagrid-scrollHistory.min.js.map |
}(this.ux = this.ux || {}, function() {return this;}()));
|