ngx-page-scroll
Advanced tools
Comparing version 6.0.1 to 6.0.2
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('ngx-page-scroll-core'), require('@angular/router'), require('@angular/common')) : | ||
typeof define === 'function' && define.amd ? define('ngx-page-scroll', ['exports', '@angular/core', 'ngx-page-scroll-core', '@angular/router', '@angular/common'], factory) : | ||
(global = global || self, factory(global['ngx-page-scroll'] = {}, global.ng.core, global.ngxPageScrollCore, global.ng.router, global.ng.common)); | ||
}(this, function (exports, core, ngxPageScrollCore, router, common) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/router'), require('@angular/common'), require('ngx-page-scroll-core')) : | ||
typeof define === 'function' && define.amd ? define('ngx-page-scroll', ['exports', '@angular/core', '@angular/router', '@angular/common', 'ngx-page-scroll-core'], factory) : | ||
(factory((global['ngx-page-scroll'] = {}),global.ng.core,global.ng.router,global.ng.common,global.ngxPageScrollCore)); | ||
}(this, (function (exports,core,router,common,ngxPageScrollCore) { 'use strict'; | ||
@@ -12,8 +12,8 @@ /** | ||
var NgxPageScrollDirective = /** @class */ (function () { | ||
function NgxPageScrollDirective(pageScrollService, router, document) { | ||
function NgxPageScrollDirective(pageScrollService, router$$1, document) { | ||
this.pageScrollService = pageScrollService; | ||
this.router = router; | ||
this.router = router$$1; | ||
this.pageScrollAdjustHash = false; | ||
this.pageScrollFinish = new core.EventEmitter(); | ||
this.document = (/** @type {?} */ (document)); | ||
this.document = ( /** @type {?} */(document)); | ||
} | ||
@@ -28,6 +28,6 @@ /** | ||
*/ | ||
function (changes) { | ||
// Some inputs changed, reset the pageScrollInstance | ||
this.pageScrollInstance = undefined; | ||
}; | ||
function (changes) { | ||
// Some inputs changed, reset the pageScrollInstance | ||
this.pageScrollInstance = undefined; | ||
}; | ||
/** | ||
@@ -39,7 +39,7 @@ * @return {?} | ||
*/ | ||
function () { | ||
if (this.pageScrollInstance) { | ||
this.pageScrollService.stop(this.pageScrollInstance); | ||
} | ||
}; | ||
function () { | ||
if (this.pageScrollInstance) { | ||
this.pageScrollService.stop(this.pageScrollInstance); | ||
} | ||
}; | ||
/** | ||
@@ -53,37 +53,37 @@ * @private | ||
*/ | ||
function () { | ||
if (this.pageScrollInstance === undefined || this.pageScrollInstance === null) { | ||
/** @type {?} */ | ||
var options = { | ||
document: this.document, | ||
scrollTarget: this.pageScrollTarget || this.href, | ||
}; | ||
if (this.pageScroll) { | ||
options.namespace = this.pageScroll; | ||
function () { | ||
if (this.pageScrollInstance === undefined || this.pageScrollInstance === null) { | ||
/** @type {?} */ | ||
var options = { | ||
document: this.document, | ||
scrollTarget: this.pageScrollTarget || this.href, | ||
}; | ||
if (this.pageScroll) { | ||
options.namespace = this.pageScroll; | ||
} | ||
if (this.pageScrollHorizontal !== undefined && this.pageScrollHorizontal !== null) { | ||
options.verticalScrolling = !this.pageScrollHorizontal; | ||
} | ||
if (this.pageScrollOffset !== undefined && this.pageScrollOffset !== null) { | ||
options.scrollOffset = this.pageScrollOffset; | ||
} | ||
if (this.pageScrollInterruptible !== undefined && this.pageScrollInterruptible !== null) { | ||
options.interruptible = this.pageScrollInterruptible; | ||
} | ||
if (this.pageScrollEasing) { | ||
options.easingLogic = this.pageScrollEasing; | ||
} | ||
if (this.pageScrollDuration !== undefined && this.pageScrollDuration !== null) { | ||
options.duration = this.pageScrollDuration; | ||
} | ||
if (this.pageScrollSpeed !== undefined && this.pageScrollSpeed !== null) { | ||
options.speed = this.pageScrollSpeed; | ||
} | ||
if (this.pageScrollFinish) { | ||
options.scrollFinishListener = this.pageScrollFinish; | ||
} | ||
this.pageScrollInstance = this.pageScrollService.create(options); | ||
} | ||
if (this.pageScrollHorizontal !== undefined && this.pageScrollHorizontal !== null) { | ||
options.verticalScrolling = !this.pageScrollHorizontal; | ||
} | ||
if (this.pageScrollOffset !== undefined && this.pageScrollOffset !== null) { | ||
options.scrollOffset = this.pageScrollOffset; | ||
} | ||
if (this.pageScrollInterruptible !== undefined && this.pageScrollInterruptible !== null) { | ||
options.interruptible = this.pageScrollInterruptible; | ||
} | ||
if (this.pageScrollEasing) { | ||
options.easingLogic = this.pageScrollEasing; | ||
} | ||
if (this.pageScrollDuration !== undefined && this.pageScrollDuration !== null) { | ||
options.duration = this.pageScrollDuration; | ||
} | ||
if (this.pageScrollSpeed !== undefined && this.pageScrollSpeed !== null) { | ||
options.speed = this.pageScrollSpeed; | ||
} | ||
if (this.pageScrollFinish) { | ||
options.scrollFinishListener = this.pageScrollFinish; | ||
} | ||
this.pageScrollInstance = this.pageScrollService.create(options); | ||
} | ||
return this.pageScrollInstance; | ||
}; | ||
return this.pageScrollInstance; | ||
}; | ||
/** | ||
@@ -97,12 +97,12 @@ * @private | ||
*/ | ||
function () { | ||
if (this.pageScrollAdjustHash && typeof this.pageScrollInstance.pageScrollOptions.scrollTarget === 'string' | ||
&& ((/** @type {?} */ (this.pageScrollInstance.pageScrollOptions.scrollTarget))).substr(0, 1) === '#') { | ||
// "Navigate" to the current route again and this time set the fragment/hash | ||
this.router.navigate([], { | ||
fragment: ((/** @type {?} */ (this.pageScrollInstance.pageScrollOptions.scrollTarget))).substr(1), | ||
preserveQueryParams: true, | ||
}); | ||
} | ||
}; | ||
function () { | ||
if (this.pageScrollAdjustHash && typeof this.pageScrollInstance.pageScrollOptions.scrollTarget === 'string' | ||
&& (( /** @type {?} */(this.pageScrollInstance.pageScrollOptions.scrollTarget))).substr(0, 1) === '#') { | ||
// "Navigate" to the current route again and this time set the fragment/hash | ||
this.router.navigate([], { | ||
fragment: (( /** @type {?} */(this.pageScrollInstance.pageScrollOptions.scrollTarget))).substr(1), | ||
preserveQueryParams: true, | ||
}); | ||
} | ||
}; | ||
/** | ||
@@ -116,8 +116,8 @@ * @private | ||
*/ | ||
function () { | ||
/** @type {?} */ | ||
var pageScrollInstance = this.generatePageScrollInstance(); | ||
this.pushRouterState(); | ||
this.pageScrollService.start(pageScrollInstance); | ||
}; | ||
function () { | ||
/** @type {?} */ | ||
var pageScrollInstance = this.generatePageScrollInstance(); | ||
this.pushRouterState(); | ||
this.pageScrollService.start(pageScrollInstance); | ||
}; | ||
/** | ||
@@ -131,43 +131,41 @@ * @param {?} clickEvent | ||
*/ | ||
function (clickEvent) { | ||
var _this = this; | ||
if (this.routerLink && this.router !== null && this.router !== undefined) { | ||
/** @type {?} */ | ||
var urlTree = void 0; | ||
if (typeof this.routerLink === 'string') { | ||
urlTree = this.router.parseUrl(this.routerLink); | ||
} | ||
else { | ||
urlTree = this.router.createUrlTree(this.routerLink); | ||
} | ||
if (!this.router.isActive(urlTree, true)) { | ||
// We need to navigate their first. | ||
// Navigation is handled by the routerLink directive | ||
// so we only need to listen for route change | ||
function (clickEvent) { | ||
var _this = this; | ||
if (this.routerLink && this.router !== null && this.router !== undefined) { | ||
/** @type {?} */ | ||
var subscription_1 = (/** @type {?} */ (this.router.events.subscribe((/** | ||
* @param {?} routerEvent | ||
* @return {?} | ||
*/ | ||
function (routerEvent) { | ||
if (routerEvent instanceof router.NavigationEnd) { | ||
subscription_1.unsubscribe(); | ||
// use a timeout to start scrolling as soon as the stack is cleared | ||
setTimeout((/** | ||
* @return {?} | ||
*/ | ||
function () { | ||
_this.scroll(); | ||
}), 0); | ||
} | ||
else if (routerEvent instanceof router.NavigationError || routerEvent instanceof router.NavigationCancel) { | ||
subscription_1.unsubscribe(); | ||
} | ||
})))); | ||
return false; // to preventDefault() | ||
var urlTree = void 0; | ||
if (typeof this.routerLink === 'string') { | ||
urlTree = this.router.parseUrl(this.routerLink); | ||
} | ||
else { | ||
urlTree = this.router.createUrlTree(this.routerLink); | ||
} | ||
if (!this.router.isActive(urlTree, true)) { | ||
// We need to navigate their first. | ||
// Navigation is handled by the routerLink directive | ||
// so we only need to listen for route change | ||
/** @type {?} */ | ||
var subscription_1 = ( /** @type {?} */(this.router.events.subscribe(( /** | ||
* @param {?} routerEvent | ||
* @return {?} | ||
*/function (routerEvent) { | ||
if (routerEvent instanceof router.NavigationEnd) { | ||
subscription_1.unsubscribe(); | ||
// use a timeout to start scrolling as soon as the stack is cleared | ||
setTimeout(( /** | ||
* @return {?} | ||
*/function () { | ||
_this.scroll(); | ||
}), 0); | ||
} | ||
else if (routerEvent instanceof router.NavigationError || routerEvent instanceof router.NavigationCancel) { | ||
subscription_1.unsubscribe(); | ||
} | ||
})))); | ||
return false; // to preventDefault() | ||
} | ||
} | ||
} | ||
this.scroll(); | ||
return false; // to preventDefault() | ||
}; | ||
this.scroll(); | ||
return false; // to preventDefault() | ||
}; | ||
NgxPageScrollDirective.decorators = [ | ||
@@ -182,7 +180,9 @@ { type: core.Directive, args: [{ | ||
/** @nocollapse */ | ||
NgxPageScrollDirective.ctorParameters = function () { return [ | ||
{ type: ngxPageScrollCore.PageScrollService }, | ||
{ type: router.Router, decorators: [{ type: core.Optional }] }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] } | ||
]; }; | ||
NgxPageScrollDirective.ctorParameters = function () { | ||
return [ | ||
{ type: ngxPageScrollCore.PageScrollService }, | ||
{ type: router.Router, decorators: [{ type: core.Optional }] }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] } | ||
]; | ||
}; | ||
NgxPageScrollDirective.propDecorators = { | ||
@@ -228,8 +228,19 @@ routerLink: [{ type: core.Input }], | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
exports.NgxPageScrollModule = NgxPageScrollModule; | ||
exports.NgxPageScrollDirective = NgxPageScrollDirective; | ||
exports.NgxPageScrollModule = NgxPageScrollModule; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); | ||
//# sourceMappingURL=ngx-page-scroll.umd.js.map | ||
}))); | ||
//# sourceMappingURL=ngx-page-scroll.umd.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("ngx-page-scroll-core"),require("@angular/router"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-page-scroll",["exports","@angular/core","ngx-page-scroll-core","@angular/router","@angular/common"],t):t((e=e||self)["ngx-page-scroll"]={},e.ng.core,e.ngxPageScrollCore,e.ng.router,e.ng.common)}(this,function(e,t,r,o,l){"use strict";var n=function(){function e(e,r,o){this.pageScrollService=e,this.router=r,this.pageScrollAdjustHash=!1,this.pageScrollFinish=new t.EventEmitter,this.document=o}return e.prototype.ngOnChanges=function(e){this.pageScrollInstance=undefined},e.prototype.ngOnDestroy=function(){this.pageScrollInstance&&this.pageScrollService.stop(this.pageScrollInstance)},e.prototype.generatePageScrollInstance=function(){if(this.pageScrollInstance===undefined||null===this.pageScrollInstance){var e={document:this.document,scrollTarget:this.pageScrollTarget||this.href};this.pageScroll&&(e.namespace=this.pageScroll),this.pageScrollHorizontal!==undefined&&null!==this.pageScrollHorizontal&&(e.verticalScrolling=!this.pageScrollHorizontal),this.pageScrollOffset!==undefined&&null!==this.pageScrollOffset&&(e.scrollOffset=this.pageScrollOffset),this.pageScrollInterruptible!==undefined&&null!==this.pageScrollInterruptible&&(e.interruptible=this.pageScrollInterruptible),this.pageScrollEasing&&(e.easingLogic=this.pageScrollEasing),this.pageScrollDuration!==undefined&&null!==this.pageScrollDuration&&(e.duration=this.pageScrollDuration),this.pageScrollSpeed!==undefined&&null!==this.pageScrollSpeed&&(e.speed=this.pageScrollSpeed),this.pageScrollFinish&&(e.scrollFinishListener=this.pageScrollFinish),this.pageScrollInstance=this.pageScrollService.create(e)}return this.pageScrollInstance},e.prototype.pushRouterState=function(){this.pageScrollAdjustHash&&"string"==typeof this.pageScrollInstance.pageScrollOptions.scrollTarget&&"#"===this.pageScrollInstance.pageScrollOptions.scrollTarget.substr(0,1)&&this.router.navigate([],{fragment:this.pageScrollInstance.pageScrollOptions.scrollTarget.substr(1),preserveQueryParams:!0})},e.prototype.scroll=function(){var e=this.generatePageScrollInstance();this.pushRouterState(),this.pageScrollService.start(e)},e.prototype.handleClick=function(e){var t=this;if(this.routerLink&&null!==this.router&&this.router!==undefined){var r=void 0;if(r="string"==typeof this.routerLink?this.router.parseUrl(this.routerLink):this.router.createUrlTree(this.routerLink),!this.router.isActive(r,!0)){var l=this.router.events.subscribe(function(e){e instanceof o.NavigationEnd?(l.unsubscribe(),setTimeout(function(){t.scroll()},0)):(e instanceof o.NavigationError||e instanceof o.NavigationCancel)&&l.unsubscribe()});return!1}}return this.scroll(),!1},e.decorators=[{type:t.Directive,args:[{selector:"[pageScroll]",host:{"(click)":"handleClick($event)"}}]}],e.ctorParameters=function(){return[{type:r.PageScrollService},{type:o.Router,decorators:[{type:t.Optional}]},{type:undefined,decorators:[{type:t.Inject,args:[l.DOCUMENT]}]}]},e.propDecorators={routerLink:[{type:t.Input}],href:[{type:t.Input}],pageScrollTarget:[{type:t.Input}],pageScrollHorizontal:[{type:t.Input}],pageScrollOffset:[{type:t.Input}],pageScrollDuration:[{type:t.Input}],pageScrollSpeed:[{type:t.Input}],pageScrollEasing:[{type:t.Input}],pageScrollInterruptible:[{type:t.Input}],pageScrollAdjustHash:[{type:t.Input}],pageScroll:[{type:t.Input}],pageScrollFinish:[{type:t.Output}]},e}(),i=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{declarations:[n],imports:[r.NgxPageScrollCoreModule],exports:[n]}]}],e}();e.NgxPageScrollDirective=n,e.NgxPageScrollModule=i,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/router"),require("@angular/common"),require("ngx-page-scroll-core")):"function"==typeof define&&define.amd?define("ngx-page-scroll",["exports","@angular/core","@angular/router","@angular/common","ngx-page-scroll-core"],t):t(e["ngx-page-scroll"]={},e.ng.core,e.ng.router,e.ng.common,e.ngxPageScrollCore)}(this,function(e,o,l,t,r){"use strict";var n=function(){function e(e,t,r){this.pageScrollService=e,this.router=t,this.pageScrollAdjustHash=!1,this.pageScrollFinish=new o.EventEmitter,this.document=r}return e.prototype.ngOnChanges=function(e){this.pageScrollInstance=undefined},e.prototype.ngOnDestroy=function(){this.pageScrollInstance&&this.pageScrollService.stop(this.pageScrollInstance)},e.prototype.generatePageScrollInstance=function(){if(this.pageScrollInstance===undefined||null===this.pageScrollInstance){var e={document:this.document,scrollTarget:this.pageScrollTarget||this.href};this.pageScroll&&(e.namespace=this.pageScroll),this.pageScrollHorizontal!==undefined&&null!==this.pageScrollHorizontal&&(e.verticalScrolling=!this.pageScrollHorizontal),this.pageScrollOffset!==undefined&&null!==this.pageScrollOffset&&(e.scrollOffset=this.pageScrollOffset),this.pageScrollInterruptible!==undefined&&null!==this.pageScrollInterruptible&&(e.interruptible=this.pageScrollInterruptible),this.pageScrollEasing&&(e.easingLogic=this.pageScrollEasing),this.pageScrollDuration!==undefined&&null!==this.pageScrollDuration&&(e.duration=this.pageScrollDuration),this.pageScrollSpeed!==undefined&&null!==this.pageScrollSpeed&&(e.speed=this.pageScrollSpeed),this.pageScrollFinish&&(e.scrollFinishListener=this.pageScrollFinish),this.pageScrollInstance=this.pageScrollService.create(e)}return this.pageScrollInstance},e.prototype.pushRouterState=function(){this.pageScrollAdjustHash&&"string"==typeof this.pageScrollInstance.pageScrollOptions.scrollTarget&&"#"===this.pageScrollInstance.pageScrollOptions.scrollTarget.substr(0,1)&&this.router.navigate([],{fragment:this.pageScrollInstance.pageScrollOptions.scrollTarget.substr(1),preserveQueryParams:!0})},e.prototype.scroll=function(){var e=this.generatePageScrollInstance();this.pushRouterState(),this.pageScrollService.start(e)},e.prototype.handleClick=function(e){var t=this;if(this.routerLink&&null!==this.router&&this.router!==undefined){var r=void 0;if(r="string"==typeof this.routerLink?this.router.parseUrl(this.routerLink):this.router.createUrlTree(this.routerLink),!this.router.isActive(r,!0)){var o=this.router.events.subscribe(function(e){e instanceof l.NavigationEnd?(o.unsubscribe(),setTimeout(function(){t.scroll()},0)):(e instanceof l.NavigationError||e instanceof l.NavigationCancel)&&o.unsubscribe()});return!1}}return this.scroll(),!1},e.decorators=[{type:o.Directive,args:[{selector:"[pageScroll]",host:{"(click)":"handleClick($event)"}}]}],e.ctorParameters=function(){return[{type:r.PageScrollService},{type:l.Router,decorators:[{type:o.Optional}]},{type:undefined,decorators:[{type:o.Inject,args:[t.DOCUMENT]}]}]},e.propDecorators={routerLink:[{type:o.Input}],href:[{type:o.Input}],pageScrollTarget:[{type:o.Input}],pageScrollHorizontal:[{type:o.Input}],pageScrollOffset:[{type:o.Input}],pageScrollDuration:[{type:o.Input}],pageScrollSpeed:[{type:o.Input}],pageScrollEasing:[{type:o.Input}],pageScrollInterruptible:[{type:o.Input}],pageScrollAdjustHash:[{type:o.Input}],pageScroll:[{type:o.Input}],pageScrollFinish:[{type:o.Output}]},e}(),i=function(){function e(){}return e.decorators=[{type:o.NgModule,args:[{declarations:[n],imports:[r.NgxPageScrollCoreModule],exports:[n]}]}],e}();e.NgxPageScrollModule=i,e.NgxPageScrollDirective=n,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-page-scroll.umd.min.js.map |
@@ -1,5 +0,5 @@ | ||
import { EventEmitter, Directive, Optional, Inject, Input, Output, NgModule } from '@angular/core'; | ||
import { Directive, EventEmitter, Inject, Input, Optional, Output, NgModule } from '@angular/core'; | ||
import { NavigationCancel, NavigationEnd, NavigationError, Router } from '@angular/router'; | ||
import { DOCUMENT } from '@angular/common'; | ||
import { PageScrollService, NgxPageScrollCoreModule } from 'ngx-page-scroll-core'; | ||
import { NavigationEnd, NavigationError, NavigationCancel, Router } from '@angular/router'; | ||
import { DOCUMENT } from '@angular/common'; | ||
@@ -206,3 +206,4 @@ /** | ||
export { NgxPageScrollDirective, NgxPageScrollModule }; | ||
//# sourceMappingURL=ngx-page-scroll.js.map | ||
export { NgxPageScrollModule, NgxPageScrollDirective }; | ||
//# sourceMappingURL=ngx-page-scroll.js.map |
@@ -1,5 +0,5 @@ | ||
import { Directive, Optional, Inject, Input, Output, EventEmitter, NgModule } from '@angular/core'; | ||
import { Directive, EventEmitter, Inject, Input, Optional, Output, NgModule } from '@angular/core'; | ||
import { NavigationCancel, NavigationEnd, NavigationError, Router } from '@angular/router'; | ||
import { DOCUMENT } from '@angular/common'; | ||
import { PageScrollService, NgxPageScrollCoreModule } from 'ngx-page-scroll-core'; | ||
import { NavigationEnd, NavigationError, NavigationCancel, Router } from '@angular/router'; | ||
import { DOCUMENT } from '@angular/common'; | ||
@@ -229,3 +229,4 @@ /** | ||
export { NgxPageScrollDirective, NgxPageScrollModule }; | ||
//# sourceMappingURL=ngx-page-scroll.js.map | ||
export { NgxPageScrollModule, NgxPageScrollDirective }; | ||
//# sourceMappingURL=ngx-page-scroll.js.map |
{ | ||
"name": "ngx-page-scroll", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "Convenience directive for animated scrolling functionality for angular written in pure typescript", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"ngx-page-scroll-core": "6.0.1", | ||
"ngx-page-scroll-core": "6.0.2", | ||
"@angular/common": "^7.1.0 || ^8.0.0", | ||
@@ -30,0 +30,0 @@ "@angular/core": "^7.1.0 || ^8.0.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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
134476
1247
0