ngx-tiny-slider
Version:
Angular component that gives you possibility to use tiny-slider library.
16 lines (14 loc) • 6.17 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("rxjs"),require("rxjs/operators"),require("tiny-slider/src/tiny-slider")):"function"==typeof define&&define.amd?define("ngx-tiny-slider",["exports","@angular/core","@angular/common","rxjs","rxjs/operators","tiny-slider/src/tiny-slider"],e):e((t=t||self)["ngx-tiny-slider"]={},t.ng.core,t.ng.common,t.rxjs,t.rxjs.operators,t.tinySlider)}(this,(function(t,e,n,i,o,r){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function s(t,e,n,i){var o,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s}function a(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var l=function(){function t(){}return t.prototype.initSlider=function(t,e){var n=Object.assign({container:e.nativeElement},t);return r.tns(n)},t.prototype.getDefaultConfig=function(){return{items:3,mode:"carousel",controlsPosition:"bottom",speed:400}},t.ɵprov=e["ɵɵdefineInjectable"]({factory:function(){return new t},token:t,providedIn:"root"}),t=s([e.Injectable({providedIn:"root"}),a("design:paramtypes",[])],t)}(),c=function(){function t(t){this.ngxTinySliderService=t,this.config={},this.aliveObservable=!0,this.domReady=new i.Subject,this.defaultConfig=this.ngxTinySliderService.getDefaultConfig()}return t.prototype.ngOnInit=function(){this.config&&this.extendConfig(),this.config.waitForDom?this.listenForDomReady():this.initSlider()},t.prototype.ngOnDestroy=function(){this.config.waitForDom&&(this.aliveObservable=!1),this.sliderInstance&&this.sliderInstance.destroy&&this.sliderInstance.destroy()},t.prototype.listenForDomReady=function(){var t=this;this.domReady.pipe(o.first(),o.takeWhile((function(){return t.aliveObservable}))).subscribe((function(){return t.initSlider()}))},t.prototype.extendConfig=function(){var t=this;Object.keys(this.config).forEach((function(e){return t.defaultConfig[e]=t.config[e]}))},t.prototype.initSlider=function(){this.sliderInstance=this.ngxTinySliderService.initSlider(this.defaultConfig,this.slideItemsContainerRef)},t.ctorParameters=function(){return[{type:l}]},s([e.Input(),a("design:type",Object)],t.prototype,"config",void 0),s([e.ViewChild("slideItems",{static:!0}),a("design:type",Object)],t.prototype,"slideItemsContainerRef",void 0),t=s([e.Component({selector:"ngx-tiny-slider",template:'<div class="slider-wrapper">\n <div class="slide-items" #slideItems>\n <ng-content select=".items"></ng-content>\n </div>\n</div>\n',encapsulation:e.ViewEncapsulation.None,styles:['.tns-outer{padding:0!important}.tns-outer [hidden]{display:none!important}.tns-outer [aria-controls],.tns-outer [data-action]{cursor:pointer}.tns-slider{transition:.1s}.tns-slider>.tns-item{box-sizing:border-box}.tns-horizontal.tns-subpixel{white-space:nowrap}.tns-horizontal.tns-subpixel>.tns-item{display:inline-block;vertical-align:top;white-space:normal}.tns-horizontal.tns-no-subpixel:after{content:"";display:table;clear:both}.tns-horizontal.tns-no-subpixel>.tns-item{float:left}.tns-horizontal.tns-carousel.tns-no-subpixel>.tns-item{margin-right:-100%}.tns-no-calc{position:relative;left:0}.tns-gallery{position:relative;left:0;min-height:1px}.tns-gallery>.tns-item{position:absolute;left:-100%;transition:transform .1s,opacity .1s}.tns-gallery>.tns-slide-active{position:relative;left:auto!important}.tns-gallery>.tns-moving{transition:.25s}.tns-autowidth{display:inline-block}.tns-lazy-img{transition:opacity .6s;opacity:.6}.tns-lazy-img.tns-complete{opacity:1}.tns-ah{transition:height .1s}.tns-ovh{overflow:hidden}.tns-visually-hidden{position:absolute;left:-10000em}.tns-transparent{opacity:0;visibility:hidden}.tns-fadeIn{opacity:1;z-index:0}.tns-fadeOut,.tns-normal{opacity:0;z-index:-1}.tns-vpfix{white-space:nowrap}.tns-vpfix>div,.tns-vpfix>li{display:inline-block}.tns-t-subp2{margin:0 auto;width:310px;position:relative;height:10px;overflow:hidden}.tns-t-ct{width:2333.3333333333%;width:calc(100% * 70 / 3);position:absolute;right:0}.tns-t-ct:after{content:"";display:table;clear:both}.tns-t-ct>div{width:1.4285714286%;width:calc(100% / 70);height:10px;float:left}.slider-wrapper-nav-center{position:relative;padding:0 28px}.slider-wrapper-nav-center .tns-controls{position:absolute;width:100%;left:0;top:50%}.slider-wrapper-nav-center .tns-controls [data-controls*=next]{right:0;position:absolute}.slider-wrapper-nav-center .tns-controls [data-controls*=prev]{left:0;position:absolute}.slider-wrapper-custom-nav-style .tns-controls button{width:25px;height:25px;color:grey;border-radius:12px;border:1px solid grey;padding:0;font-size:17px;outline:0}.slider-wrapper-custom-nav-style .tns-controls button:hover{background:#bfbfbf;color:#fff;border:1px solid #bfbfbf}']}),a("design:paramtypes",[l])],t)}(),d=function(){function t(){}return t=s([e.NgModule({imports:[n.CommonModule],declarations:[c],providers:[l],exports:[c]})],t)}();t.NgxTinySliderComponent=c,t.NgxTinySliderModule=d,t.NgxTinySliderService=l,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-tiny-slider.umd.min.js.map