@ngu/carousel
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/common"),require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngu/carousel",["exports","@angular/common","@angular/core","rxjs","rxjs/operators"],e):e(((t=t||self).ngu=t.ngu||{},t.ngu.carousel={}),t.ng.common,t.ng.core,t.rxjs,t.rxjs.operators)}(this,(function(t,e,i,n,s){"use strict";var r=function(t,e,i,n,s,r,o,h,u,d,p,m,f,g,v,y,_,b,x,C,S,w,I,T,D,P,E,O,N){void 0===t&&(t=new l),void 0===e&&(e=new a),void 0===n&&(n=new c),void 0===h&&(h="fixed"),void 0===u&&(u=""),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=0),void 0===f&&(f=0),void 0===g&&(g=0),void 0===v&&(v=0),void 0===y&&(y=0),void 0===_&&(_=0),void 0===b&&(b=0),void 0===x&&(x="cubic-bezier(0, 0, 0.2, 1)"),void 0===C&&(C=200),void 0===S&&(S=!1),void 0===w&&(w=0),void 0===I&&(I=0),void 0===T&&(T=!1),void 0===D&&(D=!0),void 0===P&&(P=!1),void 0===E&&(E=!1),void 0===O&&(O=!0),void 0===N&&(N=1),this.touch=t,this.vertical=e,this.interval=i,this.transform=n,this.button=s,this.visibleItems=r,this.deviceType=o,this.type=h,this.token=u,this.items=d,this.load=p,this.deviceWidth=m,this.carouselWidth=f,this.itemWidth=g,this.slideItems=v,this.itemWidthPer=y,this.itemLength=_,this.currentSlide=b,this.easing=x,this.speed=C,this.loop=S,this.dexVal=w,this.touchTransform=I,this.isEnd=T,this.isFirst=D,this.isLast=P,this.RTL=E,this.point=O,this.velocity=N},o=function(){},a=function(){},h=function(){},l=function(){},c=function(t,e,i,n,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),this.xs=t,this.sm=e,this.md=i,this.lg=n,this.all=s},u=function(){},d=function(t){this.$implicit=t},p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};Object.create;Object.create;var m=function(){};m.decorators=[{type:i.Directive,args:[{selector:"[NguCarouselItem]"}]}];var f=function(){};f.decorators=[{type:i.Directive,args:[{selector:"[NguCarouselNext]"}]}];var g=function(){};g.decorators=[{type:i.Directive,args:[{selector:"[NguCarouselPrev]"}]}];var v=function(){};v.decorators=[{type:i.Directive,args:[{selector:"[NguCarouselPoint]"}]}];var y=function(t){this.template=t};y.decorators=[{type:i.Directive,args:[{selector:"[nguCarouselDef]"}]}],y.ctorParameters=function(){return[{type:i.TemplateRef}]};var _=function(t){this.viewContainer=t};_.decorators=[{type:i.Directive,args:[{selector:"[nguCarouselOutlet]"}]}],_.ctorParameters=function(){return[{type:i.ViewContainerRef}]};var b=function(t){function r(e,s,r,o,a){var h=t.call(this)||this;return h._el=e,h._renderer=s,h._differs=r,h.platformId=o,h.cdr=a,h.withAnim=!0,h.isHovered=!1,h.carouselLoad=new i.EventEmitter,h.onMove=new i.EventEmitter,h._intervalController$=new n.Subject,h.pointNumbers=[],h}return function(t,e){function i(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(r,t),Object.defineProperty(r.prototype,"dataSource",{get:function(){return this._dataSource},set:function(t){t&&this._switchDataSource(t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"nextBtn",{set:function(t){var e=this;this.listener2&&this.listener2(),t&&(this.listener2=this._renderer.listen(t.nativeElement,"click",(function(){return e._carouselScrollOne(1)})))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"prevBtn",{set:function(t){var e=this;this.listener1&&this.listener1(),t&&(this.listener1=this._renderer.listen(t.nativeElement,"click",(function(){return e._carouselScrollOne(0)})))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"trackBy",{get:function(){return this._trackByFn},set:function(t){i.isDevMode()&&null!=t&&"function"!=typeof t&&console&&console.warn&&console.warn("trackBy must be a function, but received "+JSON.stringify(t)+"."),this._trackByFn=t},enumerable:!1,configurable:!0}),r.prototype.ngOnInit=function(){var t=this;this._dataDiffer=this._differs.find([]).create((function(e,i){return t.trackBy?t.trackBy(i.dataIndex,i.data):i}))},r.prototype.ngDoCheck=function(){this.arrayChanges=this._dataDiffer.diff(this.dataSource),this.arrayChanges&&this._defDirec&&this._observeRenderChanges()},r.prototype._switchDataSource=function(t){this._dataSource=t,this._defDirec&&this._observeRenderChanges()},r.prototype._observeRenderChanges=function(){var t,e=this;this._dataSource instanceof n.Observable?t=this._dataSource:Array.isArray(this._dataSource)&&(t=n.of(this._dataSource)),t&&(this._dataSubscription=t.pipe(s.takeUntil(this._intervalController$)).subscribe((function(t){e.renderNodeChanges(t),e.isLast=!1})))},r.prototype.renderNodeChanges=function(t,e){var i=this;void 0===e&&(e=this._nodeOutlet.viewContainer),this.arrayChanges&&(this.arrayChanges.forEachOperation((function(n,s,r){var o=i._getNodeDef(t[r],r);if(null==n.previousIndex){var a=new d(t[r]);a.index=r,e.createEmbeddedView(o.template,a,r)}else if(null==r)e.remove(s);else{var h=e.get(s);e.move(h,r)}})),this._updateItemIndexContext(),this.carousel&&this._storeCarouselData())},r.prototype._updateItemIndexContext=function(){for(var t=this._nodeOutlet.viewContainer,e=0,i=t.length;e<i;e++){var n=t.get(e).context;n.count=i,n.first=0===e,n.last=e===i-1,n.even=e%2==0,n.odd=!n.even,n.index=e}},r.prototype._getNodeDef=function(t,e){return 1===this._defDirec.length?this._defDirec.first:this._defDirec.find((function(i){return i.when&&i.when(e,t)}))||this._defaultNodeDef},r.prototype.ngAfterViewInit=function(){var t=this;this.carousel=this._el.nativeElement,this._inputValidation(),this.carouselCssNode=this._createStyleElem(),e.isPlatformBrowser(this.platformId)&&(this._carouselInterval(),this.vertical.enabled||this._touch(),this.listener3=this._renderer.listen("window","resize",(function(e){t._onResizing(e)})),this._onWindowScrolling())},r.prototype.ngAfterContentInit=function(){this._observeRenderChanges(),this.cdr.markForCheck()},r.prototype._inputValidation=function(){this.type=0!==this.inputs.grid.all?"fixed":"responsive",this.loop=this.inputs.loop||!1,this.inputs.easing=this.inputs.easing||"cubic-bezier(0, 0, 0.2, 1)",this.touch.active=this.inputs.touch||!1,this.RTL=!!this.inputs.RTL,this.interval=this.inputs.interval||null,this.velocity="number"==typeof this.inputs.velocity?this.inputs.velocity:this.velocity,this.inputs.vertical&&this.inputs.vertical.enabled&&(this.vertical.enabled=this.inputs.vertical.enabled,this.vertical.height=this.inputs.vertical.height),this.directionSym=this.RTL?"":"-",this.point=!this.inputs.point||void 0===this.inputs.point.visible||this.inputs.point.visible,this._carouselSize()},r.prototype.ngOnDestroy=function(){this.carouselInt&&this.carouselInt.unsubscribe(),this._intervalController$.unsubscribe(),this.carouselLoad.complete(),this.onMove.complete(),clearTimeout(this.onScrolling);for(var t=1;t<=4;t++){var e="listener"+t;this[e]&&this[e]()}},r.prototype._onResizing=function(t){var e=this;clearTimeout(this.onResize),this.onResize=setTimeout((function(){e.deviceWidth!==t.target.outerWidth&&(e._setStyle(e.nguItemsContainer.nativeElement,"transition",""),e._storeCarouselData())}),500)},r.prototype._touch=function(){var t=this;this.inputs.touch&&import("hammerjs").then((function(){var e=new Hammer(t.touchContainer.nativeElement);e.get("pan").set({direction:Hammer.DIRECTION_HORIZONTAL}),e.on("panstart",(function(e){t.carouselWidth=t.nguItemsContainer.nativeElement.offsetWidth,t.touchTransform=t.transform[t.deviceType],t.dexVal=0,t._setStyle(t.nguItemsContainer.nativeElement,"transition","")})),t.vertical.enabled?(e.on("panup",(function(e){t._touchHandling("panleft",e)})),e.on("pandown",(function(e){t._touchHandling("panright",e)}))):(e.on("panleft",(function(e){t._touchHandling("panleft",e)})),e.on("panright",(function(e){t._touchHandling("panright",e)}))),e.on("panend pancancel",(function(e){if(Math.abs(e.velocity)>=t.velocity){t.touch.velocity=e.velocity;var i=0;i=t.RTL?"panright"===t.touch.swipe?1:0:"panright"===t.touch.swipe?0:1,t._carouselScrollOne(i)}else t.dexVal=0,t._setStyle(t.nguItemsContainer.nativeElement,"transition","transform 324ms cubic-bezier(0, 0, 0.2, 1)"),t._setStyle(t.nguItemsContainer.nativeElement,"transform","")})),e.on("hammer.input",(function(t){t.srcEvent.stopPropagation()}))}))},r.prototype._touchHandling=function(t,e){if(0!==e.center.x){var i=(e=Math.abs(this.vertical.enabled?e.deltaY:e.deltaX))-this.dexVal;i="responsive"===this.type?Math.abs(e-this.dexVal)/(this.vertical.enabled?this.vertical.height:this.carouselWidth)*100:i,this.dexVal=e,this.touch.swipe=t,this._setTouchTransfrom(t,i),this._setTransformFromTouch()}},r.prototype._setTouchTransfrom=function(t,e){var i=this.RTL?"panright":"panleft";this.touchTransform=t===i?e+this.touchTransform:this.touchTransform-e},r.prototype._setTransformFromTouch=function(){this.touchTransform<0&&(this.touchTransform=0);var t="responsive"===this.type?"%":"px";this._setStyle(this.nguItemsContainer.nativeElement,"transform",this.vertical.enabled?"translate3d(0, "+this.directionSym+this.touchTransform+t+", 0)":"translate3d("+this.directionSym+this.touchTransform+t+", 0, 0)")},r.prototype._onWindowScrolling=function(){var t=this.carousel.offsetTop,e=window.scrollY,i=window.innerHeight,n=this.carousel.offsetHeight;t<=e+i-n/4&&t+n/2>=e?this._intervalController$.next(1):this._intervalController$.next(0)},r.prototype._storeCarouselData=function(){this.deviceWidth=e.isPlatformBrowser(this.platformId)?window.innerWidth:1200,this.carouselWidth=this.carouselMain1.nativeElement.offsetWidth,"responsive"===this.type?(this.deviceType=this.deviceWidth>=1200?"lg":this.deviceWidth>=992?"md":this.deviceWidth>=768?"sm":"xs",this.items=this.inputs.grid[this.deviceType],this.itemWidth=this.carouselWidth/this.items):(this.items=Math.trunc(this.carouselWidth/this.inputs.grid.all),this.itemWidth=this.inputs.grid.all,this.deviceType="all"),this.slideItems=+(this.inputs.slide<this.items?this.inputs.slide:this.items),this.load=this.inputs.load>=this.slideItems?this.inputs.load:this.slideItems,this.speed=this.inputs.speed&&this.inputs.speed>-1?this.inputs.speed:400,this._carouselPoint()},r.prototype.reset=function(t){t&&(this.withAnim=!1),this.carouselCssNode.innerHTML="",this.moveTo(0),this._carouselPoint()},r.prototype._carouselPoint=function(){var t=this.dataSource.length-(this.items-this.slideItems);this.pointIndex=Math.ceil(t/this.slideItems);var e=[];if(this.pointIndex>1||!this.inputs.point.hideOnSingleSlide)for(var i=0;i<this.pointIndex;i++)e.push(i);this.pointNumbers=e,this._carouselPointActiver(),this.pointIndex<=1?this._btnBoolean(1,1):0!==this.currentSlide||this.loop?this._btnBoolean(0,0):this._btnBoolean(1,0)},r.prototype._carouselPointActiver=function(){var t=Math.ceil(this.currentSlide/this.slideItems);this.activePoint=t,this.cdr.markForCheck()},r.prototype.moveTo=function(t,e){if(e&&(this.withAnim=!1),this.activePoint!==t&&t<this.pointIndex){var i=void 0,n=this.currentSlide<t?1:0;switch(t){case 0:this._btnBoolean(1,0),i=t*this.slideItems;break;case this.pointIndex-1:this._btnBoolean(0,1),i=this.dataSource.length-this.items;break;default:this._btnBoolean(0,0),i=t*this.slideItems}this._carouselScrollTwo(n,i,this.speed)}},r.prototype._carouselSize=function(){this.token=this._generateID();var t="";this.styleid="."+this.token+" > .ngucarousel > .ngu-touch-container > .ngucarousel-items","banner"===this.inputs.custom&&this._renderer.addClass(this.carousel,"banner"),"lazy"===this.inputs.animation&&(t+=this.styleid+" > .item {transition: transform .6s ease;}");var e="";if(this.vertical.enabled)e="@media (max-width:767px){"+(this.styleid+" > .item {height: "+this.vertical.height/+this.inputs.grid.xs+"px}")+"}\n @media (min-width:768px){"+(this.styleid+" > .item {height: "+this.vertical.height/+this.inputs.grid.sm+"px}")+"}\n @media (min-width:992px){"+(this.styleid+" > .item {height: "+this.vertical.height/+this.inputs.grid.md+"px}")+"}\n @media (min-width:1200px){"+(this.styleid+" > .item {height: "+this.vertical.height/+this.inputs.grid.lg+"px}")+"}";else if("responsive"===this.type){e="@media (max-width:767px){"+("mobile"===this.inputs.type?this.styleid+" .item {flex: 0 0 "+95/+this.inputs.grid.xs+"%; width: "+95/+this.inputs.grid.xs+"%;}":this.styleid+" .item {flex: 0 0 "+100/+this.inputs.grid.xs+"%; width: "+100/+this.inputs.grid.xs+"%;}")+"}\n @media (min-width:768px){"+(this.styleid+" > .item {flex: 0 0 "+100/+this.inputs.grid.sm+"%; width: "+100/+this.inputs.grid.sm+"%}")+"}\n @media (min-width:992px){"+(this.styleid+" > .item {flex: 0 0 "+100/+this.inputs.grid.md+"%; width: "+100/+this.inputs.grid.md+"%}")+"}\n @media (min-width:1200px){"+(this.styleid+" > .item {flex: 0 0 "+100/+this.inputs.grid.lg+"%; width: "+100/+this.inputs.grid.lg+"%}")+"}"}else e=this.styleid+" .item {flex: 0 0 "+this.inputs.grid.all+"px; width: "+this.inputs.grid.all+"px;}";this._renderer.addClass(this.carousel,this.token),this.vertical.enabled&&(this._renderer.addClass(this.nguItemsContainer.nativeElement,"nguvertical"),this._renderer.setStyle(this.carouselMain1.nativeElement,"height",this.vertical.height+"px")),this.RTL&&!this.vertical.enabled&&this._renderer.addClass(this.carousel,"ngurtl"),this._createStyleElem(t+" "+e),this._storeCarouselData()},r.prototype._carouselScrollOne=function(t){var e=this.speed,i=0,n=Math.ceil(this.dexVal/this.itemWidth);if(this._setStyle(this.nguItemsContainer.nativeElement,"transform",""),1!==this.pointIndex)if(0!==t||(this.loop||this.isFirst)&&!this.loop)1!==t||(this.loop||this.isLast)&&!this.loop||(this.dataSource.length<=this.currentSlide+this.items+this.slideItems&&!this.isLast?(i=this.dataSource.length-this.items,this._btnBoolean(0,1)):this.isLast?(i=0,e=400,this._btnBoolean(1,0)):(this._btnBoolean(0,0),n>this.slideItems?(i=this.currentSlide+this.slideItems+(n-this.slideItems),e=200):i=this.currentSlide+this.slideItems),this._carouselScrollTwo(t,i,e));else{var s=this.currentSlide-this.slideItems+this.slideItems;this._btnBoolean(0,1),0===this.currentSlide?(i=this.dataSource.length-this.items,e=400,this._btnBoolean(0,1)):this.slideItems>=s?(i=0,this._btnBoolean(1,0)):(this._btnBoolean(0,0),n>this.slideItems?(i=this.currentSlide-n,e=200):i=this.currentSlide-this.slideItems),this._carouselScrollTwo(t,i,e)}},r.prototype._carouselScrollTwo=function(t,e,i){if(0!==this.dexVal){var n=Math.abs(this.touch.velocity),s=Math.floor(this.dexVal/n/this.dexVal*(this.deviceWidth-this.dexVal));i=(s=s>i?i:s)<200?200:s,this.dexVal=0}this.withAnim?(this._setStyle(this.nguItemsContainer.nativeElement,"transition","transform "+i+"ms "+this.inputs.easing),this.inputs.animation&&this._carouselAnimator(t,e+1,e+this.items,i,Math.abs(this.currentSlide-e))):this._setStyle(this.nguItemsContainer.nativeElement,"transition",""),this.itemLength=this.dataSource.length,this._transformStyle(e),this.currentSlide=e,this.onMove.emit(this),this._carouselPointActiver(),this._carouselLoadTrigger(),this.withAnim=!0},r.prototype._btnBoolean=function(t,e){this.isFirst=!!t,this.isLast=!!e},r.prototype._transformString=function(t,e){var i="";return i+=this.styleid+" { transform: translate3d(",this.vertical.enabled?(this.transform[t]=this.vertical.height/this.inputs.grid[t]*e,i+="0, -"+this.transform[t]+"px, 0"):(this.transform[t]=100/this.inputs.grid[t]*e,i+=""+this.directionSym+this.transform[t]+"%, 0, 0"),i+="); }"},r.prototype._transformStyle=function(t){var e="";"responsive"===this.type?e="@media (max-width: 767px) {"+this._transformString("xs",t)+"}\n @media (min-width: 768px) {"+this._transformString("sm",t)+" }\n @media (min-width: 992px) {"+this._transformString("md",t)+" }\n @media (min-width: 1200px) {"+this._transformString("lg",t)+" }":(this.transform.all=this.inputs.grid.all*t,e=this.styleid+" { transform: translate3d("+this.directionSym+this.transform.all+"px, 0, 0);"),this.carouselCssNode.textContent=e},r.prototype._carouselLoadTrigger=function(){"number"==typeof this.inputs.load&&this.dataSource.length-this.load<=this.currentSlide+this.items&&this.carouselLoad.emit(this.currentSlide)},r.prototype._generateID=function(){for(var t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<6;i++)t+=e.charAt(Math.floor(Math.random()*e.length));return"ngucarousel"+t},r.prototype._carouselInterval=function(){var t=this,e=this.carouselMain1.nativeElement;if(this.interval&&this.loop){this.listener4=this._renderer.listen("window","scroll",(function(){clearTimeout(t.onScrolling),t.onScrolling=setTimeout((function(){t._onWindowScrolling()}),600)}));var i=n.fromEvent(e,"mouseleave").pipe(s.mapTo(1)),r=n.fromEvent(e,"mouseenter").pipe(s.mapTo(0)),o=n.fromEvent(e,"touchstart").pipe(s.mapTo(1)),a=n.fromEvent(e,"touchend").pipe(s.mapTo(0)),h=n.interval(this.inputs.interval.timing).pipe(s.mapTo(1));setTimeout((function(){t.carouselInt=n.merge(i,o,r,a,t._intervalController$).pipe(s.startWith(1),s.switchMap((function(e){return t.isHovered=!e,t.cdr.markForCheck(),e?h:n.EMPTY}))).subscribe((function(e){t._carouselScrollOne(1)}))}),this.interval.initialDelay)}},r.prototype._updateItemIndexContextAni=function(){for(var t=this._nodeOutlet.viewContainer,e=0,i=t.length;e<i;e++){var n=t.get(e).context;n.count=i,n.first=0===e,n.last=e===i-1,n.even=e%2==0,n.odd=!n.even,n.index=e}},r.prototype._carouselAnimator=function(t,e,i,n,s,r){var o=this;void 0===r&&(r=this._nodeOutlet.viewContainer);var a=s<5?s:5;a=1===a?3:a;var h=[];if(1===t)for(var l=e-1;l<i;l++){h.push(l),a*=2,r.get(l).context.animate={value:!0,params:{distance:a}}}else for(l=i-1;l>=e-1;l--){h.push(l),a*=2,r.get(l).context.animate={value:!0,params:{distance:-a}}}this.cdr.markForCheck(),setTimeout((function(){o._removeAnimations(h)}),.7*n)},r.prototype._removeAnimations=function(t){var e=this._nodeOutlet.viewContainer;t.forEach((function(t){e.get(t).context.animate={value:!1,params:{distance:0}}})),this.cdr.markForCheck()},r.prototype._setStyle=function(t,e,i){this._renderer.setStyle(t,e,i)},r.prototype._createStyleElem=function(t){var e=this._renderer.createElement("style");if(t){var i=this._renderer.createText(t);this._renderer.appendChild(e,i)}return this._renderer.appendChild(this.carousel,e),e},r}(r);b.decorators=[{type:i.Component,args:[{selector:"ngu-carousel",template:'<div #ngucarousel class="ngucarousel">\r\n <div #touchContainer class="ngu-touch-container">\r\n <div #nguItemsContainer class="ngucarousel-items">\r\n <ng-container nguCarouselOutlet></ng-container>\r\n </div>\r\n </div>\r\n <div class="nguclearFix"></div>\r\n <ng-content select="[NguCarouselPrev]"></ng-content>\r\n <ng-content select="[NguCarouselNext]"></ng-content>\r\n</div>\r\n<ng-content select="[NguCarouselPoint]"></ng-content>\r\n',changeDetection:i.ChangeDetectionStrategy.OnPush,styles:[":host{display:block;position:relative}:host.ngurtl{direction:rtl}.ngucarousel{height:100%;overflow:hidden;position:relative}.ngucarousel .ngucarousel-items{display:flex;height:100%;position:relative}.nguvertical{flex-direction:column}.banner .ngucarouselPointDefault .ngucarouselPoint{bottom:20px;position:absolute;width:100%}.banner .ngucarouselPointDefault .ngucarouselPoint li{background:hsla(0,0%,100%,.55)}.banner .ngucarouselPointDefault .ngucarouselPoint li.active{background:#fff}.banner .ngucarouselPointDefault .ngucarouselPoint li:hover{cursor:pointer}.ngucarouselPointDefault .ngucarouselPoint{box-sizing:border-box;list-style-type:none;margin:0;overflow:auto;padding:12px;text-align:center;white-space:nowrap}.ngucarouselPointDefault .ngucarouselPoint li{background:rgba(0,0,0,.55);border-radius:50%;display:inline-block;margin:0 4px;padding:4px;transition:.4s;transition-timing-function:cubic-bezier(.17,.67,.83,.67)}.ngucarouselPointDefault .ngucarouselPoint li.active{background:#6b6b6b;transform:scale(1.8)}.ngucarouselPointDefault .ngucarouselPoint li:hover{cursor:pointer}.nguclearFix{clear:both}"]}]}],b.ctorParameters=function(){return[{type:i.ElementRef},{type:i.Renderer2},{type:i.IterableDiffers},{type:Object,decorators:[{type:i.Inject,args:[i.PLATFORM_ID]}]},{type:i.ChangeDetectorRef}]},b.propDecorators={inputs:[{type:i.Input}],carouselLoad:[{type:i.Output}],onMove:[{type:i.Output}],dataSource:[{type:i.Input,args:["dataSource"]}],_defDirec:[{type:i.ContentChildren,args:[y]}],_nodeOutlet:[{type:i.ViewChild,args:[_,{static:!0}]}],nextBtn:[{type:i.ContentChild,args:[f,{read:i.ElementRef}]}],prevBtn:[{type:i.ContentChild,args:[g,{read:i.ElementRef}]}],carouselMain1:[{type:i.ViewChild,args:["ngucarousel",{read:i.ElementRef,static:!0}]}],nguItemsContainer:[{type:i.ViewChild,args:["nguItemsContainer",{read:i.ElementRef,static:!0}]}],touchContainer:[{type:i.ViewChild,args:["touchContainer",{read:i.ElementRef,static:!0}]}],trackBy:[{type:i.Input}]};var x=function(){this.classes=!0};x.decorators=[{type:i.Component,args:[{selector:"ngu-item",template:"<ng-content></ng-content>\r\n",styles:[""]}]}],x.propDecorators={classes:[{type:i.HostBinding,args:["class.item"]}]};var C=function(){this.classes=!0};C.decorators=[{type:i.Component,args:[{selector:"ngu-tile",template:'<div class="tile">\r\n <ng-content></ng-content>\r\n</div>\r\n',styles:[":host{box-sizing:border-box;padding:10px}.tile{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}"]}]}],C.propDecorators={classes:[{type:i.HostBinding,args:["class.item"]}]};var S=function(){};S.decorators=[{type:i.NgModule,args:[{imports:[e.CommonModule],exports:[b,x,C,v,m,f,g,y,_],declarations:[b,x,C,v,m,f,g,y,_]}]}],t.NguCarousel=b,t.NguCarouselConfig=u,t.NguCarouselDefDirective=y,t.NguCarouselItemDirective=m,t.NguCarouselModule=S,t.NguCarouselNextDirective=f,t.NguCarouselOutlet=_,t.NguCarouselPointDirective=v,t.NguCarouselPrevDirective=g,t.NguCarouselStore=r,t.NguItemComponent=x,t.NguTileComponent=C,t.ɵa=o,t.ɵb=h,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/common"),require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngu/carousel",["exports","@angular/common","@angular/core","rxjs","rxjs/operators"],e):e(((t=t||self).ngu=t.ngu||{},t.ngu.carousel={}),t.ng.common,t.ng.core,t.rxjs,t.rxjs.operators)}(this,(function(t,e,i,s,n){"use strict";var r=function(t,e,i,s,n,r,o,h,c,d,p,m,g,f,v,y,_,x,b,C,w,S,I,T,D,P,E,k,O){void 0===t&&(t=new l),void 0===e&&(e=new a),void 0===s&&(s=new u),void 0===h&&(h="fixed"),void 0===c&&(c=""),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=0),void 0===g&&(g=0),void 0===f&&(f=0),void 0===v&&(v=0),void 0===y&&(y=0),void 0===_&&(_=0),void 0===x&&(x=0),void 0===b&&(b="cubic-bezier(0, 0, 0.2, 1)"),void 0===C&&(C=200),void 0===w&&(w=!1),void 0===S&&(S=0),void 0===I&&(I=0),void 0===T&&(T=!1),void 0===D&&(D=!0),void 0===P&&(P=!1),void 0===E&&(E=!1),void 0===k&&(k=!0),void 0===O&&(O=1),this.touch=t,this.vertical=e,this.interval=i,this.transform=s,this.button=n,this.visibleItems=r,this.deviceType=o,this.type=h,this.token=c,this.items=d,this.load=p,this.deviceWidth=m,this.carouselWidth=g,this.itemWidth=f,this.slideItems=v,this.itemWidthPer=y,this.itemLength=_,this.currentSlide=x,this.easing=b,this.speed=C,this.loop=w,this.dexVal=S,this.touchTransform=I,this.isEnd=T,this.isFirst=D,this.isLast=P,this.RTL=E,this.point=k,this.velocity=O},o=function(){},a=function(){},h=function(){},l=function(){},u=function(t,e,i,s,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=0),this.xs=t,this.sm=e,this.md=i,this.lg=s,this.all=n,this.xl=0},c=function(t,e,i,s){void 0===t&&(t=768),void 0===e&&(e=992),void 0===i&&(i=1200),void 0===s&&(s=1200),this.sm=t,this.md=e,this.lg=i,this.xl=s},d=function(){},p=function(t){this.$implicit=t},m=function(t,e){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};Object.create;Object.create;var g=function(){};g.decorators=[{type:i.Directive,args:[{selector:"[NguCarouselItem]"}]}];var f=function(){};f.decorators=[{type:i.Directive,args:[{selector:"[NguCarouselNext]"}]}];var v=function(){};v.decorators=[{type:i.Directive,args:[{selector:"[NguCarouselPrev]"}]}];var y=function(){};y.decorators=[{type:i.Directive,args:[{selector:"[NguCarouselPoint]"}]}];var _=function(t){this.template=t};_.decorators=[{type:i.Directive,args:[{selector:"[nguCarouselDef]"}]}],_.ctorParameters=function(){return[{type:i.TemplateRef}]};var x=function(t){this.viewContainer=t};x.decorators=[{type:i.Directive,args:[{selector:"[nguCarouselOutlet]"}]}],x.ctorParameters=function(){return[{type:i.ViewContainerRef}]};var b=function(t){function r(e,n,r,o,a){var h=t.call(this)||this;return h._el=e,h._renderer=n,h._differs=r,h.platformId=o,h.cdr=a,h.withAnim=!0,h.isHovered=!1,h.carouselLoad=new i.EventEmitter,h.onMove=new i.EventEmitter,h._intervalController$=new s.Subject,h.pointNumbers=[],h}return function(t,e){function i(){this.constructor=t}m(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(r,t),Object.defineProperty(r.prototype,"dataSource",{get:function(){return this._dataSource},set:function(t){t&&this._switchDataSource(t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"nextBtn",{set:function(t){var e=this;this.listener2&&this.listener2(),t&&(this.listener2=this._renderer.listen(t.nativeElement,"click",(function(){return e._carouselScrollOne(1)})))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"prevBtn",{set:function(t){var e=this;this.listener1&&this.listener1(),t&&(this.listener1=this._renderer.listen(t.nativeElement,"click",(function(){return e._carouselScrollOne(0)})))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"trackBy",{get:function(){return this._trackByFn},set:function(t){i.isDevMode()&&null!=t&&"function"!=typeof t&&console&&console.warn&&console.warn("trackBy must be a function, but received "+JSON.stringify(t)+"."),this._trackByFn=t},enumerable:!1,configurable:!0}),r.prototype.ngOnInit=function(){var t=this;this._dataDiffer=this._differs.find([]).create((function(e,i){return t.trackBy?t.trackBy(i.dataIndex,i.data):i}))},r.prototype.ngDoCheck=function(){this.arrayChanges=this._dataDiffer.diff(this.dataSource),this.arrayChanges&&this._defDirec&&this._observeRenderChanges()},r.prototype._switchDataSource=function(t){this._dataSource=t,this._defDirec&&this._observeRenderChanges()},r.prototype._observeRenderChanges=function(){var t,e=this;this._dataSource instanceof s.Observable?t=this._dataSource:Array.isArray(this._dataSource)&&(t=s.of(this._dataSource)),t&&(this._dataSubscription=t.pipe(n.takeUntil(this._intervalController$)).subscribe((function(t){e.renderNodeChanges(t),e.isLast=!1})))},r.prototype.renderNodeChanges=function(t,e){var i=this;void 0===e&&(e=this._nodeOutlet.viewContainer),this.arrayChanges&&(this.arrayChanges.forEachOperation((function(s,n,r){var o=i._getNodeDef(t[r],r);if(null==s.previousIndex){var a=new p(t[r]);a.index=r,e.createEmbeddedView(o.template,a,r)}else if(null==r)e.remove(n);else{var h=e.get(n);e.move(h,r)}})),this._updateItemIndexContext(),this.carousel&&this._storeCarouselData())},r.prototype._updateItemIndexContext=function(){for(var t=this._nodeOutlet.viewContainer,e=0,i=t.length;e<i;e++){var s=t.get(e).context;s.count=i,s.first=0===e,s.last=e===i-1,s.even=e%2==0,s.odd=!s.even,s.index=e}},r.prototype._getNodeDef=function(t,e){return 1===this._defDirec.length?this._defDirec.first:this._defDirec.find((function(i){return i.when&&i.when(e,t)}))||this._defaultNodeDef},r.prototype.ngAfterViewInit=function(){var t=this;this.carousel=this._el.nativeElement,this._inputValidation(),this.carouselCssNode=this._createStyleElem(),e.isPlatformBrowser(this.platformId)&&(this._carouselInterval(),this.vertical.enabled||this._touch(),this.listener3=this._renderer.listen("window","resize",(function(e){t._onResizing(e)})),this._onWindowScrolling())},r.prototype.ngAfterContentInit=function(){this._observeRenderChanges(),this.cdr.markForCheck()},r.prototype._inputValidation=function(){this.inputs.gridBreakpoints=this.inputs.gridBreakpoints?this.inputs.gridBreakpoints:new c,void 0===this.inputs.grid.xl&&(this.inputs.grid.xl=this.inputs.grid.lg),this.type=0!==this.inputs.grid.all?"fixed":"responsive",this.loop=this.inputs.loop||!1,this.inputs.easing=this.inputs.easing||"cubic-bezier(0, 0, 0.2, 1)",this.touch.active=this.inputs.touch||!1,this.RTL=!!this.inputs.RTL,this.interval=this.inputs.interval||null,this.velocity="number"==typeof this.inputs.velocity?this.inputs.velocity:this.velocity,this.inputs.vertical&&this.inputs.vertical.enabled&&(this.vertical.enabled=this.inputs.vertical.enabled,this.vertical.height=this.inputs.vertical.height),this.directionSym=this.RTL?"":"-",this.point=!this.inputs.point||void 0===this.inputs.point.visible||this.inputs.point.visible,this._carouselSize()},r.prototype.ngOnDestroy=function(){this.carouselInt&&this.carouselInt.unsubscribe(),this._intervalController$.unsubscribe(),this.carouselLoad.complete(),this.onMove.complete(),clearTimeout(this.onScrolling);for(var t=1;t<=4;t++){var e="listener"+t;this[e]&&this[e]()}},r.prototype._onResizing=function(t){var e=this;clearTimeout(this.onResize),this.onResize=setTimeout((function(){e.deviceWidth!==t.target.outerWidth&&(e._setStyle(e.nguItemsContainer.nativeElement,"transition",""),e._storeCarouselData())}),500)},r.prototype._touch=function(){var t=this;this.inputs.touch&&import("hammerjs").then((function(){var e=new Hammer(t.touchContainer.nativeElement);e.get("pan").set({direction:Hammer.DIRECTION_HORIZONTAL}),e.on("panstart",(function(e){t.carouselWidth=t.nguItemsContainer.nativeElement.offsetWidth,t.touchTransform=t.transform[t.deviceType],t.dexVal=0,t._setStyle(t.nguItemsContainer.nativeElement,"transition","")})),t.vertical.enabled?(e.on("panup",(function(e){t._touchHandling("panleft",e)})),e.on("pandown",(function(e){t._touchHandling("panright",e)}))):(e.on("panleft",(function(e){t._touchHandling("panleft",e)})),e.on("panright",(function(e){t._touchHandling("panright",e)}))),e.on("panend pancancel",(function(e){if(Math.abs(e.velocity)>=t.velocity){t.touch.velocity=e.velocity;var i=0;i=t.RTL?"panright"===t.touch.swipe?1:0:"panright"===t.touch.swipe?0:1,t._carouselScrollOne(i)}else t.dexVal=0,t._setStyle(t.nguItemsContainer.nativeElement,"transition","transform 324ms cubic-bezier(0, 0, 0.2, 1)"),t._setStyle(t.nguItemsContainer.nativeElement,"transform","")})),e.on("hammer.input",(function(t){t.srcEvent.stopPropagation()}))}))},r.prototype._touchHandling=function(t,e){if(0!==e.center.x){var i=(e=Math.abs(this.vertical.enabled?e.deltaY:e.deltaX))-this.dexVal;i="responsive"===this.type?Math.abs(e-this.dexVal)/(this.vertical.enabled?this.vertical.height:this.carouselWidth)*100:i,this.dexVal=e,this.touch.swipe=t,this._setTouchTransfrom(t,i),this._setTransformFromTouch()}},r.prototype._setTouchTransfrom=function(t,e){var i=this.RTL?"panright":"panleft";this.touchTransform=t===i?e+this.touchTransform:this.touchTransform-e},r.prototype._setTransformFromTouch=function(){this.touchTransform<0&&(this.touchTransform=0);var t="responsive"===this.type?"%":"px";this._setStyle(this.nguItemsContainer.nativeElement,"transform",this.vertical.enabled?"translate3d(0, "+this.directionSym+this.touchTransform+t+", 0)":"translate3d("+this.directionSym+this.touchTransform+t+", 0, 0)")},r.prototype._onWindowScrolling=function(){var t=this.carousel.offsetTop,e=window.scrollY,i=window.innerHeight,s=this.carousel.offsetHeight;t<=e+i-s/4&&t+s/2>=e?this._intervalController$.next(1):this._intervalController$.next(0)},r.prototype._storeCarouselData=function(){var t=this.inputs.gridBreakpoints;this.deviceWidth=e.isPlatformBrowser(this.platformId)?window.innerWidth:t.xl,this.carouselWidth=this.carouselMain1.nativeElement.offsetWidth,"responsive"===this.type?(this.deviceType=this.deviceWidth>=t.xl?"xl":this.deviceWidth>=t.lg?"lg":this.deviceWidth>=t.md?"md":this.deviceWidth>=t.sm?"sm":"xs",this.items=this.inputs.grid[this.deviceType],this.itemWidth=this.carouselWidth/this.items):(this.items=Math.trunc(this.carouselWidth/this.inputs.grid.all),this.itemWidth=this.inputs.grid.all,this.deviceType="all"),this.slideItems=+(this.inputs.slide<this.items?this.inputs.slide:this.items),this.load=this.inputs.load>=this.slideItems?this.inputs.load:this.slideItems,this.speed=this.inputs.speed&&this.inputs.speed>-1?this.inputs.speed:400,this._carouselPoint()},r.prototype.reset=function(t){t&&(this.withAnim=!1),this.carouselCssNode.innerHTML="",this.moveTo(0),this._carouselPoint()},r.prototype._carouselPoint=function(){var t=this.dataSource.length-(this.items-this.slideItems);this.pointIndex=Math.ceil(t/this.slideItems);var e=[];if(this.pointIndex>1||!this.inputs.point.hideOnSingleSlide)for(var i=0;i<this.pointIndex;i++)e.push(i);this.pointNumbers=e,this._carouselPointActiver(),this.pointIndex<=1?this._btnBoolean(1,1):0!==this.currentSlide||this.loop?this._btnBoolean(0,0):this._btnBoolean(1,0)},r.prototype._carouselPointActiver=function(){var t=Math.ceil(this.currentSlide/this.slideItems);this.activePoint=t,this.cdr.markForCheck()},r.prototype.moveTo=function(t,e){if(e&&(this.withAnim=!1),this.activePoint!==t&&t<this.pointIndex){var i=void 0,s=this.currentSlide<t?1:0;switch(t){case 0:this._btnBoolean(1,0),i=t*this.slideItems;break;case this.pointIndex-1:this._btnBoolean(0,1),i=this.dataSource.length-this.items;break;default:this._btnBoolean(0,0),i=t*this.slideItems}this._carouselScrollTwo(s,i,this.speed)}},r.prototype._carouselSize=function(){this.token=this._generateID();var t="";this.styleid="."+this.token+" > .ngucarousel > .ngu-touch-container > .ngucarousel-items","banner"===this.inputs.custom&&this._renderer.addClass(this.carousel,"banner"),"lazy"===this.inputs.animation&&(t+=this.styleid+" > .item {transition: transform .6s ease;}");var e=this.inputs.gridBreakpoints,i="";if(this.vertical.enabled){var s=this.styleid+" > .item {height: "+this.vertical.height/+this.inputs.grid.xs+"px}",n=this.styleid+" > .item {height: "+this.vertical.height/+this.inputs.grid.sm+"px}",r=this.styleid+" > .item {height: "+this.vertical.height/+this.inputs.grid.md+"px}",o=this.styleid+" > .item {height: "+this.vertical.height/+this.inputs.grid.lg+"px}",a=this.styleid+" > .item {height: "+this.vertical.height/+this.inputs.grid.xl+"px}";i="@media (max-width:"+(e.sm-1)+"px){"+s+"}\n @media (max-width:"+e.sm+"px){"+n+"}\n @media (min-width:"+e.md+"px){"+r+"}\n @media (min-width:"+e.lg+"px){"+o+"}\n @media (min-width:"+e.xl+"px){"+a+"}"}else if("responsive"===this.type){s="mobile"===this.inputs.type?this.styleid+" .item {flex: 0 0 "+95/+this.inputs.grid.xs+"%; width: "+95/+this.inputs.grid.xs+"%;}":this.styleid+" .item {flex: 0 0 "+100/+this.inputs.grid.xs+"%; width: "+100/+this.inputs.grid.xs+"%;}",n=this.styleid+" > .item {flex: 0 0 "+100/+this.inputs.grid.sm+"%; width: "+100/+this.inputs.grid.sm+"%}",r=this.styleid+" > .item {flex: 0 0 "+100/+this.inputs.grid.md+"%; width: "+100/+this.inputs.grid.md+"%}",o=this.styleid+" > .item {flex: 0 0 "+100/+this.inputs.grid.lg+"%; width: "+100/+this.inputs.grid.lg+"%}",a=this.styleid+" > .item {flex: 0 0 "+100/+this.inputs.grid.xl+"%; width: "+100/+this.inputs.grid.xl+"%}";i="@media (max-width:"+(e.sm-1)+"px){"+s+"}\n @media (min-width:"+e.sm+"px){"+n+"}\n @media (min-width:"+e.md+"px){"+r+"}\n @media (min-width:"+e.lg+"px){"+o+"}\n @media (min-width:"+e.xl+"px){"+a+"}"}else i=this.styleid+" .item {flex: 0 0 "+this.inputs.grid.all+"px; width: "+this.inputs.grid.all+"px;}";this._renderer.addClass(this.carousel,this.token),this.vertical.enabled&&(this._renderer.addClass(this.nguItemsContainer.nativeElement,"nguvertical"),this._renderer.setStyle(this.carouselMain1.nativeElement,"height",this.vertical.height+"px")),this.RTL&&!this.vertical.enabled&&this._renderer.addClass(this.carousel,"ngurtl"),this._createStyleElem(t+" "+i),this._storeCarouselData()},r.prototype._carouselScrollOne=function(t){var e=this.speed,i=0,s=Math.ceil(this.dexVal/this.itemWidth);if(this._setStyle(this.nguItemsContainer.nativeElement,"transform",""),1!==this.pointIndex)if(0!==t||(this.loop||this.isFirst)&&!this.loop)1!==t||(this.loop||this.isLast)&&!this.loop||(this.dataSource.length<=this.currentSlide+this.items+this.slideItems&&!this.isLast?(i=this.dataSource.length-this.items,this._btnBoolean(0,1)):this.isLast?(i=0,e=400,this._btnBoolean(1,0)):(this._btnBoolean(0,0),s>this.slideItems?(i=this.currentSlide+this.slideItems+(s-this.slideItems),e=200):i=this.currentSlide+this.slideItems),this._carouselScrollTwo(t,i,e));else{var n=this.currentSlide-this.slideItems+this.slideItems;this._btnBoolean(0,1),0===this.currentSlide?(i=this.dataSource.length-this.items,e=400,this._btnBoolean(0,1)):this.slideItems>=n?(i=0,this._btnBoolean(1,0)):(this._btnBoolean(0,0),s>this.slideItems?(i=this.currentSlide-s,e=200):i=this.currentSlide-this.slideItems),this._carouselScrollTwo(t,i,e)}},r.prototype._carouselScrollTwo=function(t,e,i){if(0!==this.dexVal){var s=Math.abs(this.touch.velocity),n=Math.floor(this.dexVal/s/this.dexVal*(this.deviceWidth-this.dexVal));i=(n=n>i?i:n)<200?200:n,this.dexVal=0}this.withAnim?(this._setStyle(this.nguItemsContainer.nativeElement,"transition","transform "+i+"ms "+this.inputs.easing),this.inputs.animation&&this._carouselAnimator(t,e+1,e+this.items,i,Math.abs(this.currentSlide-e))):this._setStyle(this.nguItemsContainer.nativeElement,"transition",""),this.itemLength=this.dataSource.length,this._transformStyle(e),this.currentSlide=e,this.onMove.emit(this),this._carouselPointActiver(),this._carouselLoadTrigger(),this.withAnim=!0},r.prototype._btnBoolean=function(t,e){this.isFirst=!!t,this.isLast=!!e},r.prototype._transformString=function(t,e){var i="";return i+=this.styleid+" { transform: translate3d(",this.vertical.enabled?(this.transform[t]=this.vertical.height/this.inputs.grid[t]*e,i+="0, -"+this.transform[t]+"px, 0"):(this.transform[t]=100/this.inputs.grid[t]*e,i+=""+this.directionSym+this.transform[t]+"%, 0, 0"),i+="); }"},r.prototype._transformStyle=function(t){var e="";if("responsive"===this.type){var i=this.inputs.gridBreakpoints;e="@media (max-width: "+(i.sm-1)+"px) {"+this._transformString("xs",t)+"}\n @media (min-width: "+i.sm+"px) {"+this._transformString("sm",t)+" }\n @media (min-width: "+i.md+"px) {"+this._transformString("md",t)+" }\n @media (min-width: "+i.lg+"px) {"+this._transformString("lg",t)+" }\n @media (min-width: "+i.xl+"px) {"+this._transformString("xl",t)+" }"}else this.transform.all=this.inputs.grid.all*t,e=this.styleid+" { transform: translate3d("+this.directionSym+this.transform.all+"px, 0, 0);";this.carouselCssNode.textContent=e},r.prototype._carouselLoadTrigger=function(){"number"==typeof this.inputs.load&&this.dataSource.length-this.load<=this.currentSlide+this.items&&this.carouselLoad.emit(this.currentSlide)},r.prototype._generateID=function(){for(var t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<6;i++)t+=e.charAt(Math.floor(Math.random()*e.length));return"ngucarousel"+t},r.prototype._carouselInterval=function(){var t=this,e=this.carouselMain1.nativeElement;if(this.interval&&this.loop){this.listener4=this._renderer.listen("window","scroll",(function(){clearTimeout(t.onScrolling),t.onScrolling=setTimeout((function(){t._onWindowScrolling()}),600)}));var i=s.fromEvent(e,"mouseleave").pipe(n.mapTo(1)),r=s.fromEvent(e,"mouseenter").pipe(n.mapTo(0)),o=s.fromEvent(e,"touchstart").pipe(n.mapTo(1)),a=s.fromEvent(e,"touchend").pipe(n.mapTo(0)),h=s.interval(this.inputs.interval.timing).pipe(n.mapTo(1));setTimeout((function(){t.carouselInt=s.merge(i,o,r,a,t._intervalController$).pipe(n.startWith(1),n.switchMap((function(e){return t.isHovered=!e,t.cdr.markForCheck(),e?h:s.EMPTY}))).subscribe((function(e){t._carouselScrollOne(1)}))}),this.interval.initialDelay)}},r.prototype._updateItemIndexContextAni=function(){for(var t=this._nodeOutlet.viewContainer,e=0,i=t.length;e<i;e++){var s=t.get(e).context;s.count=i,s.first=0===e,s.last=e===i-1,s.even=e%2==0,s.odd=!s.even,s.index=e}},r.prototype._carouselAnimator=function(t,e,i,s,n,r){var o=this;void 0===r&&(r=this._nodeOutlet.viewContainer);var a=n<5?n:5;a=1===a?3:a;var h=[];if(1===t)for(var l=e-1;l<i;l++){h.push(l),a*=2,r.get(l).context.animate={value:!0,params:{distance:a}}}else for(l=i-1;l>=e-1;l--){h.push(l),a*=2,r.get(l).context.animate={value:!0,params:{distance:-a}}}this.cdr.markForCheck(),setTimeout((function(){o._removeAnimations(h)}),.7*s)},r.prototype._removeAnimations=function(t){var e=this._nodeOutlet.viewContainer;t.forEach((function(t){e.get(t).context.animate={value:!1,params:{distance:0}}})),this.cdr.markForCheck()},r.prototype._setStyle=function(t,e,i){this._renderer.setStyle(t,e,i)},r.prototype._createStyleElem=function(t){var e=this._renderer.createElement("style");if(t){var i=this._renderer.createText(t);this._renderer.appendChild(e,i)}return this._renderer.appendChild(this.carousel,e),e},r}(r);b.decorators=[{type:i.Component,args:[{selector:"ngu-carousel",template:'<div #ngucarousel class="ngucarousel">\r\n <div #touchContainer class="ngu-touch-container">\r\n <div #nguItemsContainer class="ngucarousel-items">\r\n <ng-container nguCarouselOutlet></ng-container>\r\n </div>\r\n </div>\r\n <div class="nguclearFix"></div>\r\n <ng-content select="[NguCarouselPrev]"></ng-content>\r\n <ng-content select="[NguCarouselNext]"></ng-content>\r\n</div>\r\n<ng-content select="[NguCarouselPoint]"></ng-content>\r\n',changeDetection:i.ChangeDetectionStrategy.OnPush,styles:[":host{display:block;position:relative}:host.ngurtl{direction:rtl}.ngucarousel{height:100%;overflow:hidden;position:relative}.ngucarousel .ngucarousel-items{display:flex;height:100%;position:relative}.nguvertical{flex-direction:column}.banner .ngucarouselPointDefault .ngucarouselPoint{bottom:20px;position:absolute;width:100%}.banner .ngucarouselPointDefault .ngucarouselPoint li{background:hsla(0,0%,100%,.55)}.banner .ngucarouselPointDefault .ngucarouselPoint li.active{background:#fff}.banner .ngucarouselPointDefault .ngucarouselPoint li:hover{cursor:pointer}.ngucarouselPointDefault .ngucarouselPoint{box-sizing:border-box;list-style-type:none;margin:0;overflow:auto;padding:12px;text-align:center;white-space:nowrap}.ngucarouselPointDefault .ngucarouselPoint li{background:rgba(0,0,0,.55);border-radius:50%;display:inline-block;margin:0 4px;padding:4px;transition:.4s;transition-timing-function:cubic-bezier(.17,.67,.83,.67)}.ngucarouselPointDefault .ngucarouselPoint li.active{background:#6b6b6b;transform:scale(1.8)}.ngucarouselPointDefault .ngucarouselPoint li:hover{cursor:pointer}.nguclearFix{clear:both}"]}]}],b.ctorParameters=function(){return[{type:i.ElementRef},{type:i.Renderer2},{type:i.IterableDiffers},{type:Object,decorators:[{type:i.Inject,args:[i.PLATFORM_ID]}]},{type:i.ChangeDetectorRef}]},b.propDecorators={inputs:[{type:i.Input}],carouselLoad:[{type:i.Output}],onMove:[{type:i.Output}],dataSource:[{type:i.Input,args:["dataSource"]}],_defDirec:[{type:i.ContentChildren,args:[_]}],_nodeOutlet:[{type:i.ViewChild,args:[x,{static:!0}]}],nextBtn:[{type:i.ContentChild,args:[f,{read:i.ElementRef}]}],prevBtn:[{type:i.ContentChild,args:[v,{read:i.ElementRef}]}],carouselMain1:[{type:i.ViewChild,args:["ngucarousel",{read:i.ElementRef,static:!0}]}],nguItemsContainer:[{type:i.ViewChild,args:["nguItemsContainer",{read:i.ElementRef,static:!0}]}],touchContainer:[{type:i.ViewChild,args:["touchContainer",{read:i.ElementRef,static:!0}]}],trackBy:[{type:i.Input}]};var C=function(){this.classes=!0};C.decorators=[{type:i.Component,args:[{selector:"ngu-item",template:"<ng-content></ng-content>\r\n",styles:[""]}]}],C.propDecorators={classes:[{type:i.HostBinding,args:["class.item"]}]};var w=function(){this.classes=!0};w.decorators=[{type:i.Component,args:[{selector:"ngu-tile",template:'<div class="tile">\r\n <ng-content></ng-content>\r\n</div>\r\n',styles:[":host{box-sizing:border-box;padding:10px}.tile{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}"]}]}],w.propDecorators={classes:[{type:i.HostBinding,args:["class.item"]}]};var S=function(){};S.decorators=[{type:i.NgModule,args:[{imports:[e.CommonModule],exports:[b,C,w,y,g,f,v,_,x],declarations:[b,C,w,y,g,f,v,_,x]}]}],t.NguCarousel=b,t.NguCarouselConfig=d,t.NguCarouselDefDirective=_,t.NguCarouselItemDirective=g,t.NguCarouselModule=S,t.NguCarouselNextDirective=f,t.NguCarouselOutlet=x,t.NguCarouselPointDirective=y,t.NguCarouselPrevDirective=v,t.NguCarouselStore=r,t.NguItemComponent=C,t.NguTileComponent=w,t.ɵa=o,t.ɵb=h,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ngu-carousel.umd.min.js.map |
@@ -49,4 +49,20 @@ export class NguCarouselStore { | ||
this.all = all; | ||
this.xl = 0; | ||
} | ||
} | ||
/** | ||
* Default values | ||
* {sm: 768, md: 992, lg: 1200, xl: 1200} | ||
* | ||
* Bootstrap values: | ||
* {sm: 576, md: 768, lg: 992, xl: 1200} | ||
*/ | ||
export class Breakpoints { | ||
constructor(sm = 768, md = 992, lg = 1200, xl = 1200) { | ||
this.sm = sm; | ||
this.md = md; | ||
this.lg = lg; | ||
this.xl = xl; | ||
} | ||
} | ||
export class NguCarouselConfig { | ||
@@ -59,2 +75,2 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd1LWNhcm91c2VsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd1LWNhcm91c2VsL3NyYy9saWIvbmd1LWNhcm91c2VsL25ndS1jYXJvdXNlbC50cyJdLCJuYW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ZTtcclxuICBhbmltYXRlU3R5bGVzPzogQW5pbWF0aW9uU3R5bGVzO1xyXG59XHJcblxyXG5leHBvcnQgaW50ZXJmYWNlIEFuaW1hdGlvblN0eWxlcyB7XHJcbiAgc3R5bGU/OiBzdHJpbmc7XHJcbiAgb3Blbj86IHN0cmluZztcclxuICBjbG9zZT86IHN0cmluZztcclxuICBzdGFnZ2VyPzogbnVtYmVyO1xyXG59XHJcblxyXG5leHBvcnQgaW50ZXJmYWNlIENhcm91c2VsSW50ZXJ2YWwge1xyXG4gIHRpbWluZzogbnVtYmVyO1xyXG4gIGluaXRpYWxEZWxheT86IG51bWJlcjtcclxufVxyXG5cclxuZXhwb3J0IGNsYXNzIE5ndUNhcm91c2VsT3V0bGV0Q29udGV4dDxUPiB7XHJcbiAgLyoqIERhdGEgZm9yIHRoZSBub2RlLiAqL1xyXG4gICRpbXBsaWNpdDogVDtcclxuXHJcbiAgLyoqIERlcHRoIG9mIHRoZSBub2RlLiAqL1xyXG4gIGxldmVsOiBudW1iZXI7XHJcblxyXG4gIC8qKiBJbmRleCBsb2NhdGlvbiBvZiB0aGUgbm9kZS4gKi9cclxuICBpbmRleD86IG51bWJlcjtcclxuXHJcbiAgLyoqIExlbmd0aCBvZiB0aGUgbnVtYmVyIG9mIHRvdGFsIGRhdGFOb2Rlcy4gKi9cclxuICBjb3VudD86IG51bWJlcjtcclxuXHJcbiAgY29uc3RydWN0b3IoZGF0YTogVCkge1xyXG4gICAgdGhpcy4kaW1wbGljaXQgPSBkYXRhO1xyXG4gIH1cclxufVxyXG4iXX0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd1LWNhcm91c2VsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd1LWNhcm91c2VsL3NyYy9saWIvbmd1LWNhcm91c2VsL25ndS1jYXJvdXNlbC50cyJdLCJuYW1lcyI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nQgaW50ZXJmYWNlIENhcm91c2VsSW50ZXJ2YWwge1xyXG4gIHRpbWluZzogbnVtYmVyO1xyXG4gIGluaXRpYWxEZWxheT86IG51bWJlcjtcclxufVxyXG5cclxuZXhwb3J0IGNsYXNzIE5ndUNhcm91c2VsT3V0bGV0Q29udGV4dDxUPiB7XHJcbiAgLyoqIERhdGEgZm9yIHRoZSBub2RlLiAqL1xyXG4gICRpbXBsaWNpdDogVDtcclxuXHJcbiAgLyoqIERlcHRoIG9mIHRoZSBub2RlLiAqL1xyXG4gIGxldmVsOiBudW1iZXI7XHJcblxyXG4gIC8qKiBJbmRleCBsb2NhdGlvbiBvZiB0aGUgbm9kZS4gKi9cclxuICBpbmRleD86IG51bWJlcjtcclxuXHJcbiAgLyoqIExlbmd0aCBvZiB0aGUgbnVtYmVyIG9mIHRvdGFsIGRhdGFOb2Rlcy4gKi9cclxuICBjb3VudD86IG51bWJlcjtcclxuXHJcbiAgY29uc3RydWN0b3IoZGF0YTogVCkge1xyXG4gICAgdGhpcy4kaW1wbGljaXQgPSBkYXRhO1xyXG4gIH1cclxufVxyXG4iXX0= |
@@ -54,4 +54,20 @@ import { isPlatformBrowser, CommonModule } from '@angular/common'; | ||
this.all = all; | ||
this.xl = 0; | ||
} | ||
} | ||
/** | ||
* Default values | ||
* {sm: 768, md: 992, lg: 1200, xl: 1200} | ||
* | ||
* Bootstrap values: | ||
* {sm: 576, md: 768, lg: 992, xl: 1200} | ||
*/ | ||
class Breakpoints { | ||
constructor(sm = 768, md = 992, lg = 1200, xl = 1200) { | ||
this.sm = sm; | ||
this.md = md; | ||
this.lg = lg; | ||
this.xl = xl; | ||
} | ||
} | ||
class NguCarouselConfig { | ||
@@ -288,2 +304,6 @@ } | ||
_inputValidation() { | ||
this.inputs.gridBreakpoints = this.inputs.gridBreakpoints ? this.inputs.gridBreakpoints : new Breakpoints(); | ||
if (this.inputs.grid.xl === undefined) { | ||
this.inputs.grid.xl = this.inputs.grid.lg; | ||
} | ||
this.type = this.inputs.grid.all !== 0 ? 'fixed' : 'responsive'; | ||
@@ -431,13 +451,16 @@ this.loop = this.inputs.loop || false; | ||
_storeCarouselData() { | ||
this.deviceWidth = isPlatformBrowser(this.platformId) ? window.innerWidth : 1200; | ||
const breakpoints = this.inputs.gridBreakpoints; | ||
this.deviceWidth = isPlatformBrowser(this.platformId) ? window.innerWidth : breakpoints.xl; | ||
this.carouselWidth = this.carouselMain1.nativeElement.offsetWidth; | ||
if (this.type === 'responsive') { | ||
this.deviceType = | ||
this.deviceWidth >= 1200 | ||
? 'lg' | ||
: this.deviceWidth >= 992 | ||
? 'md' | ||
: this.deviceWidth >= 768 | ||
? 'sm' | ||
: 'xs'; | ||
this.deviceWidth >= breakpoints.xl | ||
? 'xl' | ||
: this.deviceWidth >= breakpoints.lg | ||
? 'lg' | ||
: this.deviceWidth >= breakpoints.md | ||
? 'md' | ||
: this.deviceWidth >= breakpoints.sm | ||
? 'sm' | ||
: 'xs'; | ||
this.items = this.inputs.grid[this.deviceType]; | ||
@@ -527,2 +550,3 @@ this.itemWidth = this.carouselWidth / this.items; | ||
} | ||
const breakpoints = this.inputs.gridBreakpoints; | ||
let itemStyle = ''; | ||
@@ -538,6 +562,9 @@ if (this.vertical.enabled) { | ||
+this.inputs.grid.lg}px}`; | ||
itemStyle = `@media (max-width:767px){${itemWidthXS}} | ||
@media (min-width:768px){${itemWidthSM}} | ||
@media (min-width:992px){${itemWidthMD}} | ||
@media (min-width:1200px){${itemWidthLG}}`; | ||
const itemWidthXL = `${this.styleid} > .item {height: ${this.vertical.height / | ||
+this.inputs.grid.xl}px}`; | ||
itemStyle = `@media (max-width:${breakpoints.sm - 1}px){${itemWidthXS}} | ||
@media (max-width:${breakpoints.sm}px){${itemWidthSM}} | ||
@media (min-width:${breakpoints.md}px){${itemWidthMD}} | ||
@media (min-width:${breakpoints.lg}px){${itemWidthLG}} | ||
@media (min-width:${breakpoints.xl}px){${itemWidthXL}}`; | ||
} | ||
@@ -556,6 +583,9 @@ else if (this.type === 'responsive') { | ||
+this.inputs.grid.lg}%; width: ${100 / +this.inputs.grid.lg}%}`; | ||
itemStyle = `@media (max-width:767px){${itemWidthXS}} | ||
@media (min-width:768px){${itemWidthSM}} | ||
@media (min-width:992px){${itemWidthMD}} | ||
@media (min-width:1200px){${itemWidthLG}}`; | ||
const itemWidthXL = `${this.styleid} > .item {flex: 0 0 ${100 / | ||
+this.inputs.grid.xl}%; width: ${100 / +this.inputs.grid.xl}%}`; | ||
itemStyle = `@media (max-width:${breakpoints.sm - 1}px){${itemWidthXS}} | ||
@media (min-width:${breakpoints.sm}px){${itemWidthSM}} | ||
@media (min-width:${breakpoints.md}px){${itemWidthMD}} | ||
@media (min-width:${breakpoints.lg}px){${itemWidthLG}} | ||
@media (min-width:${breakpoints.xl}px){${itemWidthXL}}`; | ||
} | ||
@@ -683,6 +713,8 @@ else { | ||
if (this.type === 'responsive') { | ||
slideCss = `@media (max-width: 767px) {${this._transformString('xs', slide)}} | ||
@media (min-width: 768px) {${this._transformString('sm', slide)} } | ||
@media (min-width: 992px) {${this._transformString('md', slide)} } | ||
@media (min-width: 1200px) {${this._transformString('lg', slide)} }`; | ||
const breakpoints = this.inputs.gridBreakpoints; | ||
slideCss = `@media (max-width: ${breakpoints.sm - 1}px) {${this._transformString('xs', slide)}} | ||
@media (min-width: ${breakpoints.sm}px) {${this._transformString('sm', slide)} } | ||
@media (min-width: ${breakpoints.md}px) {${this._transformString('md', slide)} } | ||
@media (min-width: ${breakpoints.lg}px) {${this._transformString('lg', slide)} } | ||
@media (min-width: ${breakpoints.xl}px) {${this._transformString('xl', slide)} }`; | ||
} | ||
@@ -689,0 +721,0 @@ else { |
@@ -33,3 +33,3 @@ export declare class NguCarouselStore { | ||
} | ||
export declare type DeviceType = 'xs' | 'sm' | 'md' | 'lg' | 'all'; | ||
export declare type DeviceType = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'all'; | ||
export declare type ButtonVisible = 'disabled' | 'hide'; | ||
@@ -59,6 +59,22 @@ export declare class ItemsControl { | ||
all: number; | ||
xl?: number; | ||
constructor(xs?: number, sm?: number, md?: number, lg?: number, all?: number); | ||
} | ||
/** | ||
* Default values | ||
* {sm: 768, md: 992, lg: 1200, xl: 1200} | ||
* | ||
* Bootstrap values: | ||
* {sm: 576, md: 768, lg: 992, xl: 1200} | ||
*/ | ||
export declare class Breakpoints { | ||
sm: number; | ||
md: number; | ||
lg: number; | ||
xl: number; | ||
constructor(sm?: number, md?: number, lg?: number, xl?: number); | ||
} | ||
export declare class NguCarouselConfig { | ||
grid: Transfrom; | ||
gridBreakpoints?: Breakpoints; | ||
slide?: number; | ||
@@ -65,0 +81,0 @@ speed?: number; |
{ | ||
"name": "@ngu/carousel", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"peerDependencies": { | ||
@@ -14,3 +14,3 @@ "@angular/common": "^10.0.4", | ||
"type": "git", | ||
"url": "git+https://github.com/sheikalthaf/ngu-carousel.git" | ||
"url": "git+https://github.com/uiuniversal/ngu-carousel.git" | ||
}, | ||
@@ -17,0 +17,0 @@ "keywords": [ |
@@ -96,3 +96,3 @@ # ngu-carousel | ||
public carouselTile: NguCarouselConfig = { | ||
grid: { xs: 1, sm: 1, md: 3, lg: 3, all: 0 }, | ||
grid: { xs: 1, sm: 1, md: 3, lg: 3, xl:3, all: 0 }, | ||
slide: 3, | ||
@@ -160,3 +160,3 @@ speed: 250, | ||
} | ||
export type DeviceType = 'xs' | 'sm' | 'md' | 'lg' | 'all'; | ||
export type DeviceType = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'all'; | ||
@@ -181,2 +181,3 @@ export class ItemsControl { | ||
grid: Transfrom; | ||
gridBreakpoints?: Breakpoints; | ||
slide?: number; | ||
@@ -204,2 +205,3 @@ speed?: number; | ||
lg: number; | ||
xl: number; | ||
all: number; | ||
@@ -219,3 +221,4 @@ } | ||
| ------------------------- | ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `grid` | Object | Yes | **xs** - mobile, **sm** - tablet, **md** - desktop, **lg** - large desktops, **all** - fixed width (When you use **all** make others 0 and vise versa) | | ||
| `grid` | Object | Yes | **xs** - mobile, **sm** - tablet, **md** - desktop, **lg** - large desktops, **xl** - extra large desktops, **all** - fixed width (When you use **all** make others 0 and vise versa) | | ||
| `gridBreakpoints` | Object | optional | Determines the browser width in pixels that the grid displays the intended number of tiles.<br/><br/> default: `{sm: 768, md: 992, lg: 1200, xl: 1200}` | | ||
| `slide` | number | optional | It is used to slide the number items on click | | ||
@@ -320,3 +323,3 @@ | `speed` | milli seconds | optional | It is used for time taken to slide the number items | | ||
this.carouselBanner = { | ||
grid: { xs: 1, sm: 1, md: 1, lg: 1, all: 0 }, | ||
grid: { xs: 1, sm: 1, md: 1, lg: 1, xl:1, all: 0 }, | ||
slide: 1, | ||
@@ -433,3 +436,3 @@ speed: 400, | ||
this.carouselBanner = { | ||
grid: { xs: 1, sm: 1, md: 1, lg: 1, all: 0 }, | ||
grid: { xs: 1, sm: 1, md: 1, lg: 1, xl:1, all: 0 }, | ||
slide: 1, | ||
@@ -526,3 +529,3 @@ speed: 400, | ||
this.carouselTile = { | ||
grid: {xs: 2, sm: 3, md: 3, lg: 5, all: 0}, | ||
grid: {xs: 2, sm: 3, md: 3, lg: 5, xl:5, all: 0}, | ||
slide: 2, | ||
@@ -633,3 +636,3 @@ speed: 400, | ||
this.carouselTile = { | ||
grid: {xs: 2, sm: 3, md: 3, lg: 5, all: 0}, | ||
grid: {xs: 2, sm: 3, md: 3, lg: 5, xl:5, all: 0}, | ||
slide: 2, | ||
@@ -636,0 +639,0 @@ speed: 400, |
Sorry, the diff of this file is too big to display
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 too big to display
Sorry, the diff of this file is not supported yet
561050
3581
686