@progress/kendo-angular-scrollview
Advanced tools
| !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@angular/core"),require("tslib"),require("@angular/common"),require("rxjs"),require("rxjs/operators"),require("@angular/animations"),require("@progress/kendo-angular-l10n")):"function"==typeof define&&define.amd?define(["@angular/core","tslib","@angular/common","rxjs","rxjs/operators","@angular/animations","@progress/kendo-angular-l10n"],t):"object"==typeof exports?exports.KendoAngularScrollview=t(require("@angular/core"),require("tslib"),require("@angular/common"),require("rxjs"),require("rxjs/operators"),require("@angular/animations"),require("@progress/kendo-angular-l10n")):e.KendoAngularScrollview=t(e["@angular/core"],e.tslib,e["@angular/common"],e.rxjs,e["rxjs/operators"],e["@angular/animations"],e["@progress/kendo-angular-l10n"])}(window,(function(e,t,n,i,r,o,s){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),r=n(0),o=n(9),s=n(10),a=n(6),u=n(11),l=n(12),c=function(){function e(e,t,n,i){var o=this;this.element=e,this.application=t,this.localization=n,this.ngZone=i,this.data=[],this.endless=!1,this.animate=!0,this.pageable=!1,this.arrows=!1,this.itemChanged=new r.EventEmitter,this.touchAction="pan-y pinch-zoom",this.animationState=null,this.transitionStyle={},this.view=new u.DataCollection((function(){return new u.DataResultIterator(o.data,o.activeIndex,o.endless,o.pageIndex,o.isRTL)})),this.isDataSourceEmpty=!1,this._activeIndex=0,this.index=0,this.pageIndex=null,this.transforms=["translateX(-100%)","translateX(0%)","translateX(100%)"]}return Object.defineProperty(e.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(e){this.index=this._activeIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"widgetClass",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollViewClass",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hostWidth",{get:function(){return this.width},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hostHeight",{get:function(){return this.height},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabIndex",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ariaLive",{get:function(){return"assertive"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.direction},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"direction",{get:function(){return this.localization.rtl?"rtl":"ltr"},enumerable:!0,configurable:!0}),e.prototype.keyDown=function(e){e.keyCode===a.Keys.ArrowLeft&&(this.isRTL?this.next():this.prev()),e.keyCode===a.Keys.ArrowRight&&(this.isRTL?this.prev():this.next())},e.prototype.ngOnChanges=function(e){this.activeIndex=Math.max(Math.min(this.activeIndex,this.view.total-1),0)},e.prototype.prev=function(){this.navigate(s.Dir.Prev)},e.prototype.next=function(){this.navigate(s.Dir.Next)},e.prototype.transitionEndHandler=function(e){this.animationState=null,"left"!==e.toState&&"right"!==e.toState||(null!==this.pageIndex&&(this.activeIndex=this.pageIndex,this.pageIndex=null),this.activeIndex=this.index,this.itemChanged.emit({index:this.activeIndex,item:this.view.item(1)}),this.application.tick())},e.prototype.handlePress=function(e){this.initialTouchCoordinate=e.pageX},e.prototype.handleDrag=function(e){var t=this,n=e.pageX-this.initialTouchCoordinate;this.animationState||this.isDragForbidden(n)||!this.draggedInsideBounds(n)||this.ngZone.run((function(){t.transitionStyle={transform:"translateX("+n+"px)"}}))},e.prototype.handleRelease=function(e){var t=this,n=e.pageX-this.initialTouchCoordinate;this.isDragForbidden(n)||this.ngZone.run((function(){t.draggedEnoughToNavigate(n)?(t.isRTL?t.changeIndex(n<0?s.Dir.Prev:s.Dir.Next):t.changeIndex(n>0?s.Dir.Prev:s.Dir.Next),t.animate||(t.transitionStyle=null,t.itemChanged.emit({index:t.activeIndex,item:t.view.item(1)}))):Math.abs(n)>0&&(t.animate?t.animationState="center":t.transitionStyle=null)}))},e.prototype.pageChange=function(e){this.animationState||this.activeIndex===e||(this.animate?(this.pageIndex=e,this.isRTL?this.animationState=this.pageIndex>this.index?"right":"left":this.animationState=this.pageIndex>this.index?"left":"right"):this.activeIndex=e)},e.prototype.inlineStyles=function(e){return{height:this.height,transform:this.transforms[e],width:this.width}},e.prototype.displayLeftArrow=function(){var e;return e=this.isRTL?this.activeIndex+1<this.view.total:this.activeIndex>0,(this.endless||e)&&this.view.total>0},e.prototype.leftArrowClick=function(){this.isRTL?this.next():this.prev()},e.prototype.displayRightArrow=function(){var e;return e=this.isRTL?this.activeIndex>0:this.activeIndex+1<this.view.total,(this.endless||e)&&this.view.total>0},e.prototype.rightArrowClick=function(){this.isRTL?this.prev():this.next()},e.prototype.draggedInsideBounds=function(e){return Math.abs(e)<=this.element.nativeElement.offsetWidth},e.prototype.draggedEnoughToNavigate=function(e){return Math.abs(e)>this.element.nativeElement.offsetWidth/2},e.prototype.isDragForbidden=function(e){var t,n;return t=this.isRTL?e<0&&0!==e:e>0&&0!==e,n=0===this.activeIndex&&t||this.activeIndex===this.view.total-1&&!t,!this.endless&&n},e.prototype.navigate=function(e){this.isDataSourceEmpty||this.animationState||(this.changeIndex(e),this.animate||this.itemChanged.emit({index:this.activeIndex,item:this.view.item(1)}))},e.prototype.changeIndex=function(e){e===s.Dir.Next&&this.view.canMoveNext()?(this.index=(this.index+1)%this.view.total,this.animate?this.animationState=this.isRTL?"right":"left":this.activeIndex=this.index):e===s.Dir.Prev&&this.view.canMovePrev()&&(this.index=0===this.index?this.view.total-1:this.index-1,this.animate?this.animationState=this.isRTL?"left":"right":this.activeIndex=this.index)},Object.defineProperty(e.prototype,"isRTL",{get:function(){return"rtl"===this.direction},enumerable:!0,configurable:!0}),i.__decorate([r.Input(),i.__metadata("design:type",Array)],e.prototype,"data",void 0),i.__decorate([r.Input(),i.__metadata("design:type",Number),i.__metadata("design:paramtypes",[Number])],e.prototype,"activeIndex",null),i.__decorate([r.Input(),i.__metadata("design:type",String)],e.prototype,"width",void 0),i.__decorate([r.Input(),i.__metadata("design:type",String)],e.prototype,"height",void 0),i.__decorate([r.Input(),i.__metadata("design:type",Boolean)],e.prototype,"endless",void 0),i.__decorate([r.Input(),i.__metadata("design:type",Boolean)],e.prototype,"animate",void 0),i.__decorate([r.Input(),i.__metadata("design:type",Boolean)],e.prototype,"pageable",void 0),i.__decorate([r.Input(),i.__metadata("design:type",Boolean)],e.prototype,"arrows",void 0),i.__decorate([r.Output(),i.__metadata("design:type",r.EventEmitter)],e.prototype,"itemChanged",void 0),i.__decorate([r.ContentChild(r.TemplateRef),i.__metadata("design:type",r.TemplateRef)],e.prototype,"itemTemplateRef",void 0),i.__decorate([r.HostBinding("class.k-widget"),i.__metadata("design:type",Boolean),i.__metadata("design:paramtypes",[])],e.prototype,"widgetClass",null),i.__decorate([r.HostBinding("class.k-scrollview-wrap"),i.__metadata("design:type",Boolean),i.__metadata("design:paramtypes",[])],e.prototype,"scrollViewClass",null),i.__decorate([r.HostBinding("style.width"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],e.prototype,"hostWidth",null),i.__decorate([r.HostBinding("style.height"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],e.prototype,"hostHeight",null),i.__decorate([r.HostBinding("attr.tabindex"),i.__metadata("design:type",Number),i.__metadata("design:paramtypes",[])],e.prototype,"tabIndex",null),i.__decorate([r.HostBinding("attr.aria-live"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],e.prototype,"ariaLive",null),i.__decorate([r.HostBinding("attr.dir"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],e.prototype,"dir",null),i.__decorate([r.HostBinding("style.touch-action"),i.__metadata("design:type",String)],e.prototype,"touchAction",void 0),i.__decorate([r.HostListener("keydown",["$event"]),i.__metadata("design:type",Function),i.__metadata("design:paramtypes",[Object]),i.__metadata("design:returntype",void 0)],e.prototype,"keyDown",null),e=i.__decorate([r.Component({animations:[o.trigger("animateTo",[o.state("center, left, right",o.style({transform:"translateX(0)"})),o.transition("* => right",[o.animate("300ms ease-out",o.style({transform:"translateX(100%)"}))]),o.transition("* => left",[o.animate("300ms ease-out",o.style({transform:"translateX(-100%)"}))]),o.transition("* => center",[o.animate("300ms ease-out")])])],exportAs:"kendoScrollView",providers:[l.LocalizationService,{provide:l.L10N_PREFIX,useValue:"kendo.scrollview"}],selector:"kendo-scrollview",template:'\n <ul class=\'k-scrollview\'\n [ngStyle]="transitionStyle"\n [@animateTo]="animationState" (@animateTo.done)= "transitionEndHandler($event)"\n kendoDraggable\n (kendoDrag) = "handleDrag($event)" (kendoPress) = "handlePress($event)" (kendoRelease) = "handleRelease($event)">\n <li *ngFor="let item of view;let i=index"\n [ngStyle]="inlineStyles(i)"\n [attr.aria-hidden]="i !== 1">\n <ng-template\n [ngTemplateOutlet]="itemTemplateRef"\n [ngTemplateOutletContext]="{ item: item }">\n </ng-template>\n </li>\n </ul>\n <div class=\'k-scrollview-elements\'\n [ngStyle]="{\'height\': height}"\n *ngIf="!isDataSourceEmpty && (pageable||arrows)">\n <a class="k-scrollview-prev"\n aria-label="previous"\n *ngIf="arrows && displayLeftArrow()"\n (click)="leftArrowClick()">\n <span class="k-icon k-i-arrowhead-w"></span>\n </a>\n <a class="k-scrollview-next"\n aria-label="next"\n *ngIf="arrows && displayRightArrow()"\n (click)="rightArrowClick()">\n <span class="k-icon k-i-arrowhead-e"></span>\n </a>\n <kendo-scrollview-pager *ngIf="pageable"\n (pagerIndexChange)="pageChange($event)"\n [data]="data"\n [activeIndex]="activeIndex">\n </kendo-scrollview-pager>\n </div>\n '}),i.__metadata("design:paramtypes",[r.ElementRef,r.ApplicationRef,l.LocalizationService,r.NgZone])],e)}();t.ScrollViewComponent=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),r=n(0),o=n(0),s=function(){function e(){this.pagerIndexChange=new o.EventEmitter}return e.prototype.itemClass=function(e){return{"k-primary":e===this.activeIndex}},e.prototype.indexChange=function(e){this.pagerIndexChange.emit(e)},i.__decorate([r.Input(),i.__metadata("design:type",Number)],e.prototype,"activeIndex",void 0),i.__decorate([r.Input(),i.__metadata("design:type",Array)],e.prototype,"data",void 0),i.__decorate([r.Output(),i.__metadata("design:type",o.EventEmitter)],e.prototype,"pagerIndexChange",void 0),e=i.__decorate([r.Component({selector:"kendo-scrollview-pager",template:'\n <ul class="k-scrollview-pageable">\n <li class="k-button" *ngFor="let item of data; let i = index"\n [ngClass]="itemClass(i)"\n (click)="indexChange(i)">\n </li>\n </ul>\n '})],e)}();t.ScrollViewPagerComponent=s},function(e,t,n){"use strict";n.r(t);var i=n(0),r=function(e,t){return function(n){return t(e(n))}},o=function(e,t,n){return e.addEventListener&&e.addEventListener(t,n)},s=function(e,t,n){return e&&e.removeEventListener&&e.removeEventListener(t,n)},a=function(){},u=function(e){return e.preventDefault()},l=/touch/;function c(e){return e.type.match(l)?{pageX:e.changedTouches[0].pageX,pageY:e.changedTouches[0].pageY,clientX:e.changedTouches[0].clientX,clientY:e.changedTouches[0].clientY,type:e.type,originalEvent:e,isTouch:!0}:{pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY,offsetX:e.offsetX,offsetY:e.offsetY,type:e.type,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,originalEvent:e}}var d=function(e){var t=this,n=e.press;void 0===n&&(n=a);var i=e.drag;void 0===i&&(i=a);var l=e.release;void 0===l&&(l=a);var d=e.mouseOnly;void 0===d&&(d=!1),this._pressHandler=r(c,n),this._dragHandler=r(c,i),this._releaseHandler=r(c,l),this._ignoreMouse=!1,this._mouseOnly=d,this._touchstart=function(e){1===e.touches.length&&t._pressHandler(e)},this._touchmove=function(e){1===e.touches.length&&t._dragHandler(e)},this._touchend=function(e){0===e.touches.length&&1===e.changedTouches.length&&(t._releaseHandler(e),t._ignoreMouse=!0,setTimeout(t._restoreMouse,2e3))},this._restoreMouse=function(){t._ignoreMouse=!1},this._mousedown=function(e){var n=e.which;n&&n>1||t._ignoreMouse||(o(document,"mousemove",t._mousemove),o(document,"mouseup",t._mouseup),t._pressHandler(e))},this._mousemove=function(e){t._dragHandler(e)},this._mouseup=function(e){s(document,"mousemove",t._mousemove),s(document,"mouseup",t._mouseup),t._releaseHandler(e)},this._pointerdown=function(e){e.isPrimary&&0===e.button&&(o(document,"pointermove",t._pointermove),o(document,"pointerup",t._pointerup),o(document,"pointercancel",t._pointerup),o(document,"contextmenu",u),t._pressHandler(e))},this._pointermove=function(e){e.isPrimary&&t._dragHandler(e)},this._pointerup=function(e){e.isPrimary&&(s(document,"pointermove",t._pointermove),s(document,"pointerup",t._pointerup),s(document,"pointercancel",t._pointerup),s(document,"contextmenu",u),t._releaseHandler(e))}};d.supportPointerEvent=function(){return"undefined"!=typeof window&&window.PointerEvent},d.prototype.bindTo=function(e){e!==this._element&&(this._element&&this._unbindFromCurrent(),this._element=e,this._bindToCurrent())},d.prototype._bindToCurrent=function(){var e=this._element;this._usePointers()?o(e,"pointerdown",this._pointerdown):(o(e,"mousedown",this._mousedown),this._mouseOnly||(o(e,"touchstart",this._touchstart),o(e,"touchmove",this._touchmove),o(e,"touchend",this._touchend)))},d.prototype._unbindFromCurrent=function(){var e=this._element;if(this._usePointers())return s(e,"pointerdown",this._pointerdown),s(document,"pointermove",this._pointermove),s(document,"pointerup",this._pointerup),s(document,"contextmenu",u),void s(document,"pointercancel",this._pointerup);s(e,"mousedown",this._mousedown),this._mouseOnly||(s(e,"touchstart",this._touchstart),s(e,"touchmove",this._touchmove),s(e,"touchend",this._touchend))},d.prototype._usePointers=function(){return!this._mouseOnly&&d.supportPointerEvent()},d.prototype.destroy=function(){this._unbindFromCurrent(),this._element=null},d.default=d;var p=d,h=n(2),g=n(3),f=n(7);n.d(t,"DraggableDirective",(function(){return w})),n.d(t,"DraggableModule",(function(){return S})),n.d(t,"EventsOutsideAngularDirective",(function(){return D})),n.d(t,"EventsModule",(function(){return I})),n.d(t,"ResizeSensorComponent",(function(){return K})),n.d(t,"ResizeBatchService",(function(){return C})),n.d(t,"ResizeSensorModule",(function(){return k})),n.d(t,"KendoInput",(function(){return M})),n.d(t,"isDocumentAvailable",(function(){return y})),n.d(t,"isChanged",(function(){return v})),n.d(t,"anyChanged",(function(){return _})),n.d(t,"hasObservers",(function(){return b})),n.d(t,"guid",(function(){return x})),n.d(t,"Keys",(function(){return m}));var m,y=function(){return"undefined"!=typeof document},v=function(e,t,n){return void 0===n&&(n=!0),!(void 0===t[e]||t[e].isFirstChange()&&n||t[e].previousValue===t[e].currentValue)},_=function(e,t,n){return void 0===n&&(n=!0),e.some((function(e){return v(e,t,n)}))},b=function(e){return e&&e.observers.length>0},x=function(){for(var e="",t=0;t<32;t++){var n=16*Math.random()|0;8!==t&&12!==t&&16!==t&&20!==t||(e+="-"),e+=(12===t?4:16===t?3&n|8:n).toString(16)}return e},w=function(){function e(e,t){this.element=e,this.ngZone=t,this.enableDrag=!0,this.kendoPress=new i.EventEmitter,this.kendoDrag=new i.EventEmitter,this.kendoRelease=new i.EventEmitter}return e.prototype.ngOnInit=function(){this.toggleDraggable()},e.prototype.ngOnChanges=function(e){v("enableDrag",e)&&this.toggleDraggable()},e.prototype.ngOnDestroy=function(){this.destroyDraggable()},e.prototype.toggleDraggable=function(){var e=this;y()&&(this.destroyDraggable(),this.enableDrag&&(this.draggable=new p({drag:function(t){return e.kendoDrag.next(t)},press:function(t){return e.kendoPress.next(t)},release:function(t){return e.kendoRelease.next(t)}}),this.ngZone.runOutsideAngular((function(){return e.draggable.bindTo(e.element.nativeElement)}))))},e.prototype.destroyDraggable=function(){this.draggable&&(this.draggable.destroy(),this.draggable=null)},e.decorators=[{type:i.Directive,args:[{selector:"[kendoDraggable]"}]}],e.ctorParameters=function(){return[{type:i.ElementRef},{type:i.NgZone}]},e.propDecorators={enableDrag:[{type:i.Input}],kendoPress:[{type:i.Output}],kendoDrag:[{type:i.Output}],kendoRelease:[{type:i.Output}]},e}(),S=function(){function e(){}return e.decorators=[{type:i.NgModule,args:[{declarations:[w],exports:[w],imports:[h.CommonModule]}]}],e}(),D=function(){function e(e,t,n){this.element=e,this.ngZone=t,this.renderer=n,this.events={}}return e.prototype.ngOnInit=function(){var e=this;if(this.element&&this.element.nativeElement){var t=this.events;this.subscriptions=[],this.ngZone.runOutsideAngular((function(){for(var n in t)t.hasOwnProperty(n)&&e.subscriptions.push(e.renderer.listen(e.element.nativeElement,n,e.scope?t[n].bind(e.scope):t[n]))}))}},e.prototype.ngOnDestroy=function(){if(this.subscriptions){for(var e=0;e<this.subscriptions.length;e++)this.subscriptions[e]();this.subscriptions=null}},e.decorators=[{type:i.Directive,args:[{selector:"[kendoEventsOutsideAngular]"}]}],e.ctorParameters=function(){return[{type:i.ElementRef},{type:i.NgZone},{type:i.Renderer2}]},e.propDecorators={events:[{type:i.Input,args:["kendoEventsOutsideAngular"]}],scope:[{type:i.Input}]},e}(),I=function(){function e(){}return e.decorators=[{type:i.NgModule,args:[{declarations:[D],exports:[D]}]}],e}(),C=function(){function e(e){this.ngZone=e,this.scheduled=[],this.resolvedPromise=Promise.resolve(null),this.flush=this.flush.bind(this)}return e.prototype.schedule=function(e,t){var n=this;this.scheduled.push({instance:e,method:t}),this.subscription||this.ngZone.runOutsideAngular((function(){n.subscription=Object(g.from)(n.resolvedPromise).subscribe(n.flush)}))},e.prototype.isScheduled=function(e){return Boolean(this.scheduled.find((function(t){return t.instance===e})))},e.prototype.cancel=function(e){for(var t=this.scheduled,n=t.length,i=0;i<n;i++)if(t[i].instance===e)return t.splice(i,1),void(t.length||this.unsubscribe())},e.prototype.ngOnDestroy=function(){this.unsubscribe()},e.prototype.unsubscribe=function(){this.subscription&&(this.subscription.unsubscribe(),this.subscription=null)},e.prototype.flush=function(){this.scheduled.forEach((function(e){e.method.call(e.instance)})),this.scheduled=[],this.unsubscribe()},e.decorators=[{type:i.Injectable}],e.ctorParameters=function(){return[{type:i.NgZone}]},e}(),E=10,P="position: absolute; display: block; left: 0; top: 0; right: 0; bottom: 0; z-index: -1;overflow: hidden; visibility: hidden;",K=function(){function e(e,t,n,r){this.resizeBatchService=e,this.element=t,this.zone=n,this.renderer=r,this.rateLimit=E,this.resize=new i.EventEmitter,this.dir="ltr",this.source=new g.Subject,this.state=0,this.acceptedSize=!1}return e.prototype.ngAfterViewInit=function(){var e=this;this.zone.runOutsideAngular((function(){var t=e.scroll.bind(e),n=e.renderer.listen(e.expand.nativeElement,"scroll",t),i=e.renderer.listen(e.shrink.nativeElement,"scroll",t);e.detachScrollHandlers=function(){n(),i()}}))},e.prototype.ngAfterViewChecked=function(){"undefined"!=typeof document&&(2!==this.state?0===this.state&&(this.state=1,this.resizeBatchService.schedule(this,this.init)):this.resizeBatchService.isScheduled(this)||this.resizeBatchService.schedule(this,this.scroll))},e.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe(),this.detachScrollHandlers&&this.detachScrollHandlers(),this.resizeBatchService.cancel(this)},e.prototype.acceptSize=function(e){void 0===e&&(e=this.measure()),this.lastWidth=e.width,this.lastHeight=e.height,this.acceptedSize=!0},e.prototype.scroll=function(e){var t=this;if(this.parentElement){var n=this.measure(),i=n.width,r=n.height;i===this.lastWidth&&r===this.lastHeight||(this.lastWidth=i,this.lastHeight=r,this.acceptedSize=!1,this.zone.runOutsideAngular((function(){t.source.next()})),this.reset())}},e.prototype.init=function(){var e,t,n=this,i=1e3/(this.rateLimit||E);this.subscription=this.source.asObservable().pipe(Object(f.auditTime)(i)).subscribe((function(){n.acceptedSize||n.resize.emit()})),this.parentElement=this.element.nativeElement.parentElement,"static"===(e=this.parentElement,t="position",getComputedStyle(e,null).getPropertyValue(t))&&(this.parentElement.style.position="relative"),this.reset(),this.lastWidth=this.parentElement.offsetWidth,this.lastHeight=this.parentElement.offsetHeight,this.state=2},e.prototype.reset=function(){var e=this.expandChild.nativeElement;e.style.width=1e5+"px",e.style.height=1e5+"px";var t=this.expand.nativeElement;t.scrollLeft=1e5,t.scrollTop=1e5;var n=this.shrink.nativeElement;n.scrollLeft=1e5,n.scrollTop=1e5},e.prototype.measure=function(){var e=0,t=0;return this.parentElement&&(t=this.parentElement.offsetHeight,e=this.parentElement.offsetWidth),{height:t,width:e}},e.decorators=[{type:i.Component,args:[{selector:"kendo-resize-sensor",styles:[":host { "+P+" }"],template:'<div #expand style="'+P+'"> <div #expandChild style="position: absolute; left: 0; top: 0; transition: 0s;"></div></div><div #shrink style="'+P+'"> <div style="position: absolute; left: 0; top: 0; transition: 0s;width: 200%; height: 200%;"></div></div>'}]}],e.ctorParameters=function(){return[{type:C},{type:i.ElementRef},{type:i.NgZone},{type:i.Renderer2}]},e.propDecorators={rateLimit:[{type:i.Input}],resize:[{type:i.Output}],dir:[{type:i.HostBinding,args:["attr.dir"]}],expand:[{type:i.ViewChild,args:["expand"]}],expandChild:[{type:i.ViewChild,args:["expandChild"]}],shrink:[{type:i.ViewChild,args:["shrink"]}]},e}(),O=[K],k=function(){function e(){}return e.decorators=[{type:i.NgModule,args:[{declarations:[O],exports:[O],providers:[C]}]}],e}(),M=function(){};!function(e){e[e.Alt=18]="Alt",e[e.ArrowDown=40]="ArrowDown",e[e.ArrowLeft=37]="ArrowLeft",e[e.ArrowRight=39]="ArrowRight",e[e.ArrowUp=38]="ArrowUp",e[e.Backspace=8]="Backspace",e[e.Control=17]="Control",e[e.Delete=46]="Delete",e[e.Digit0=48]="Digit0",e[e.Digit1=49]="Digit1",e[e.Digit2=50]="Digit2",e[e.Digit3=51]="Digit3",e[e.Digit4=52]="Digit4",e[e.Digit5=53]="Digit5",e[e.Digit6=54]="Digit6",e[e.Digit7=55]="Digit7",e[e.Digit8=56]="Digit8",e[e.Digit9=57]="Digit9",e[e.End=35]="End",e[e.Enter=13]="Enter",e[e.Escape=27]="Escape",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F10=121]="F10",e[e.Home=36]="Home",e[e.Insert=45]="Insert",e[e.KeyA=65]="KeyA",e[e.KeyB=66]="KeyB",e[e.KeyC=67]="KeyC",e[e.KeyD=68]="KeyD",e[e.KeyE=69]="KeyE",e[e.KeyF=70]="KeyF",e[e.KeyG=71]="KeyG",e[e.KeyH=72]="KeyH",e[e.KeyI=73]="KeyI",e[e.KeyJ=74]="KeyJ",e[e.KeyK=75]="KeyK",e[e.KeyL=76]="KeyL",e[e.KeyM=77]="KeyM",e[e.KeyN=78]="KeyN",e[e.KeyO=79]="KeyO",e[e.KeyP=80]="KeyP",e[e.KeyQ=81]="KeyQ",e[e.KeyR=82]="KeyR",e[e.KeyS=83]="KeyS",e[e.KeyT=84]="KeyT",e[e.KeyU=85]="KeyU",e[e.KeyV=86]="KeyV",e[e.KeyW=87]="KeyW",e[e.KeyX=88]="KeyX",e[e.KeyY=89]="KeyY",e[e.KeyZ=90]="KeyZ",e[e.NumpadDecimal=110]="NumpadDecimal",e[e.PageDown=34]="PageDown",e[e.PageUp=33]="PageUp",e[e.Shift=16]="Shift",e[e.Space=32]="Space",e[e.Tab=9]="Tab"}(m||(m={}))},function(e,t){e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(4);t.ScrollViewComponent=i.ScrollViewComponent;var r=n(13);t.ScrollViewModule=r.ScrollViewModule;var o=n(5);t.ScrollViewPagerComponent=o.ScrollViewPagerComponent},function(e,t){e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Next=1]="Next",e[e.Prev=-1]="Prev"}(t.Dir||(t.Dir={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){if("function"==typeof Symbol&&Symbol.iterator)return Symbol.iterator;for(var e=Object.getOwnPropertyNames(Map.prototype),t=Map.prototype,n=0;n<e.length;++n){var i=e[n];if("entries"!==i&&"size"!==i&&t[i]===t.entries)return i}}();var r={},o=function(){function e(e,t,n,i,r){this.rtl=!1,this.source=e||[],this.index=t||0,this.endless=n,this.pageIndex=i,this.rtl=r}return Object.defineProperty(e.prototype,"data",{get:function(){var e,t=this.total;this.endless?e=[this.source[(this.index-1+t)%t],this.source[this.index%t],this.source[(this.index+1+t)%t]]:e=[r].concat(this.source,[r]).slice(this.index,this.index+3);null!==this.pageIndex&&(e[this.pageIndex>this.index?2:0]=this.source[this.pageIndex]);return this.rtl?e.reverse():e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"total",{get:function(){return this.source.length},enumerable:!0,configurable:!0}),e.prototype.canMoveNext=function(){return this.endless||this.index<this.total-1},e.prototype.canMovePrev=function(){return this.endless||this.index>0},e.prototype[i]=function(){return this.data[i]()},e}();t.DataResultIterator=o;var s=function(){function e(e){this.accessor=e}return Object.defineProperty(e.prototype,"length",{get:function(){return this.accessor().data.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"total",{get:function(){return this.accessor().total},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return this.accessor().data[e]},e.prototype.canMoveNext=function(){return this.accessor().canMoveNext()},e.prototype.canMovePrev=function(){return this.accessor().canMovePrev()},e.prototype[Symbol.iterator]=function(){return this.accessor()[Symbol.iterator]()},e}();t.DataCollection=s},function(e,t){e.exports=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),r=n(0),o=n(2),s=n(4),a=n(5),u=n(6),l=[s.ScrollViewComponent,a.ScrollViewPagerComponent],c=[s.ScrollViewComponent],d=function(){function e(){}return e=i.__decorate([r.NgModule({declarations:[l],exports:[c],imports:[o.CommonModule,u.DraggableModule]})],e)}();t.ScrollViewModule=d}])})); |
| !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@angular/core"),require("tslib"),require("@progress/kendo-angular-common"),require("@angular/animations"),require("@progress/kendo-angular-l10n"),require("@angular/common")):"function"==typeof define&&define.amd?define(["@angular/core","tslib","@progress/kendo-angular-common","@angular/animations","@progress/kendo-angular-l10n","@angular/common"],t):"object"==typeof exports?exports.KendoAngularScrollview=t(require("@angular/core"),require("tslib"),require("@progress/kendo-angular-common"),require("@angular/animations"),require("@progress/kendo-angular-l10n"),require("@angular/common")):e.KendoAngularScrollview=t(e["@angular/core"],e.tslib,e["@progress/kendo-angular-common"],e["@angular/animations"],e["@progress/kendo-angular-l10n"],e["@angular/common"])}(window,(function(e,t,n,i,a,r){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(0),r=n(6),o=n(7),s=n(3),l=n(8),d=n(9),p=function(){function e(e,t,n,i){var r=this;this.element=e,this.application=t,this.localization=n,this.ngZone=i,this.data=[],this.endless=!1,this.animate=!0,this.pageable=!1,this.arrows=!1,this.itemChanged=new a.EventEmitter,this.touchAction="pan-y pinch-zoom",this.animationState=null,this.transitionStyle={},this.view=new l.DataCollection((function(){return new l.DataResultIterator(r.data,r.activeIndex,r.endless,r.pageIndex,r.isRTL)})),this.isDataSourceEmpty=!1,this._activeIndex=0,this.index=0,this.pageIndex=null,this.transforms=["translateX(-100%)","translateX(0%)","translateX(100%)"]}return Object.defineProperty(e.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(e){this.index=this._activeIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"widgetClass",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollViewClass",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hostWidth",{get:function(){return this.width},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hostHeight",{get:function(){return this.height},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabIndex",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ariaLive",{get:function(){return"assertive"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.direction},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"direction",{get:function(){return this.localization.rtl?"rtl":"ltr"},enumerable:!0,configurable:!0}),e.prototype.keyDown=function(e){e.keyCode===s.Keys.ArrowLeft&&(this.isRTL?this.next():this.prev()),e.keyCode===s.Keys.ArrowRight&&(this.isRTL?this.prev():this.next())},e.prototype.ngOnChanges=function(e){this.activeIndex=Math.max(Math.min(this.activeIndex,this.view.total-1),0)},e.prototype.prev=function(){this.navigate(o.Dir.Prev)},e.prototype.next=function(){this.navigate(o.Dir.Next)},e.prototype.transitionEndHandler=function(e){this.animationState=null,"left"!==e.toState&&"right"!==e.toState||(null!==this.pageIndex&&(this.activeIndex=this.pageIndex,this.pageIndex=null),this.activeIndex=this.index,this.itemChanged.emit({index:this.activeIndex,item:this.view.item(1)}),this.application.tick())},e.prototype.handlePress=function(e){this.initialTouchCoordinate=e.pageX},e.prototype.handleDrag=function(e){var t=this,n=e.pageX-this.initialTouchCoordinate;this.animationState||this.isDragForbidden(n)||!this.draggedInsideBounds(n)||this.ngZone.run((function(){t.transitionStyle={transform:"translateX("+n+"px)"}}))},e.prototype.handleRelease=function(e){var t=this,n=e.pageX-this.initialTouchCoordinate;this.isDragForbidden(n)||this.ngZone.run((function(){t.draggedEnoughToNavigate(n)?(t.isRTL?t.changeIndex(n<0?o.Dir.Prev:o.Dir.Next):t.changeIndex(n>0?o.Dir.Prev:o.Dir.Next),t.animate||(t.transitionStyle=null,t.itemChanged.emit({index:t.activeIndex,item:t.view.item(1)}))):Math.abs(n)>0&&(t.animate?t.animationState="center":t.transitionStyle=null)}))},e.prototype.pageChange=function(e){this.animationState||this.activeIndex===e||(this.animate?(this.pageIndex=e,this.isRTL?this.animationState=this.pageIndex>this.index?"right":"left":this.animationState=this.pageIndex>this.index?"left":"right"):this.activeIndex=e)},e.prototype.inlineStyles=function(e){return{height:this.height,transform:this.transforms[e],width:this.width}},e.prototype.displayLeftArrow=function(){var e;return e=this.isRTL?this.activeIndex+1<this.view.total:this.activeIndex>0,(this.endless||e)&&this.view.total>0},e.prototype.leftArrowClick=function(){this.isRTL?this.next():this.prev()},e.prototype.displayRightArrow=function(){var e;return e=this.isRTL?this.activeIndex>0:this.activeIndex+1<this.view.total,(this.endless||e)&&this.view.total>0},e.prototype.rightArrowClick=function(){this.isRTL?this.prev():this.next()},e.prototype.draggedInsideBounds=function(e){return Math.abs(e)<=this.element.nativeElement.offsetWidth},e.prototype.draggedEnoughToNavigate=function(e){return Math.abs(e)>this.element.nativeElement.offsetWidth/2},e.prototype.isDragForbidden=function(e){var t,n;return t=this.isRTL?e<0&&0!==e:e>0&&0!==e,n=0===this.activeIndex&&t||this.activeIndex===this.view.total-1&&!t,!this.endless&&n},e.prototype.navigate=function(e){this.isDataSourceEmpty||this.animationState||(this.changeIndex(e),this.animate||this.itemChanged.emit({index:this.activeIndex,item:this.view.item(1)}))},e.prototype.changeIndex=function(e){e===o.Dir.Next&&this.view.canMoveNext()?(this.index=(this.index+1)%this.view.total,this.animate?this.animationState=this.isRTL?"right":"left":this.activeIndex=this.index):e===o.Dir.Prev&&this.view.canMovePrev()&&(this.index=0===this.index?this.view.total-1:this.index-1,this.animate?this.animationState=this.isRTL?"left":"right":this.activeIndex=this.index)},Object.defineProperty(e.prototype,"isRTL",{get:function(){return"rtl"===this.direction},enumerable:!0,configurable:!0}),i.__decorate([a.Input(),i.__metadata("design:type",Array)],e.prototype,"data",void 0),i.__decorate([a.Input(),i.__metadata("design:type",Number),i.__metadata("design:paramtypes",[Number])],e.prototype,"activeIndex",null),i.__decorate([a.Input(),i.__metadata("design:type",String)],e.prototype,"width",void 0),i.__decorate([a.Input(),i.__metadata("design:type",String)],e.prototype,"height",void 0),i.__decorate([a.Input(),i.__metadata("design:type",Boolean)],e.prototype,"endless",void 0),i.__decorate([a.Input(),i.__metadata("design:type",Boolean)],e.prototype,"animate",void 0),i.__decorate([a.Input(),i.__metadata("design:type",Boolean)],e.prototype,"pageable",void 0),i.__decorate([a.Input(),i.__metadata("design:type",Boolean)],e.prototype,"arrows",void 0),i.__decorate([a.Output(),i.__metadata("design:type",a.EventEmitter)],e.prototype,"itemChanged",void 0),i.__decorate([a.ContentChild(a.TemplateRef),i.__metadata("design:type",a.TemplateRef)],e.prototype,"itemTemplateRef",void 0),i.__decorate([a.HostBinding("class.k-widget"),i.__metadata("design:type",Boolean),i.__metadata("design:paramtypes",[])],e.prototype,"widgetClass",null),i.__decorate([a.HostBinding("class.k-scrollview-wrap"),i.__metadata("design:type",Boolean),i.__metadata("design:paramtypes",[])],e.prototype,"scrollViewClass",null),i.__decorate([a.HostBinding("style.width"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],e.prototype,"hostWidth",null),i.__decorate([a.HostBinding("style.height"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],e.prototype,"hostHeight",null),i.__decorate([a.HostBinding("attr.tabindex"),i.__metadata("design:type",Number),i.__metadata("design:paramtypes",[])],e.prototype,"tabIndex",null),i.__decorate([a.HostBinding("attr.aria-live"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],e.prototype,"ariaLive",null),i.__decorate([a.HostBinding("attr.dir"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],e.prototype,"dir",null),i.__decorate([a.HostBinding("style.touch-action"),i.__metadata("design:type",String)],e.prototype,"touchAction",void 0),i.__decorate([a.HostListener("keydown",["$event"]),i.__metadata("design:type",Function),i.__metadata("design:paramtypes",[Object]),i.__metadata("design:returntype",void 0)],e.prototype,"keyDown",null),e=i.__decorate([a.Component({animations:[r.trigger("animateTo",[r.state("center, left, right",r.style({transform:"translateX(0)"})),r.transition("* => right",[r.animate("300ms ease-out",r.style({transform:"translateX(100%)"}))]),r.transition("* => left",[r.animate("300ms ease-out",r.style({transform:"translateX(-100%)"}))]),r.transition("* => center",[r.animate("300ms ease-out")])])],exportAs:"kendoScrollView",providers:[d.LocalizationService,{provide:d.L10N_PREFIX,useValue:"kendo.scrollview"}],selector:"kendo-scrollview",template:'\n <ul class=\'k-scrollview\'\n [ngStyle]="transitionStyle"\n [@animateTo]="animationState" (@animateTo.done)= "transitionEndHandler($event)"\n kendoDraggable\n (kendoDrag) = "handleDrag($event)" (kendoPress) = "handlePress($event)" (kendoRelease) = "handleRelease($event)">\n <li *ngFor="let item of view;let i=index"\n [ngStyle]="inlineStyles(i)"\n [attr.aria-hidden]="i !== 1">\n <ng-template\n [ngTemplateOutlet]="itemTemplateRef"\n [ngTemplateOutletContext]="{ item: item }">\n </ng-template>\n </li>\n </ul>\n <div class=\'k-scrollview-elements\'\n [ngStyle]="{\'height\': height}"\n *ngIf="!isDataSourceEmpty && (pageable||arrows)">\n <a class="k-scrollview-prev"\n aria-label="previous"\n *ngIf="arrows && displayLeftArrow()"\n (click)="leftArrowClick()">\n <span class="k-icon k-i-arrowhead-w"></span>\n </a>\n <a class="k-scrollview-next"\n aria-label="next"\n *ngIf="arrows && displayRightArrow()"\n (click)="rightArrowClick()">\n <span class="k-icon k-i-arrowhead-e"></span>\n </a>\n <kendo-scrollview-pager *ngIf="pageable"\n (pagerIndexChange)="pageChange($event)"\n [data]="data"\n [activeIndex]="activeIndex">\n </kendo-scrollview-pager>\n </div>\n '}),i.__metadata("design:paramtypes",[a.ElementRef,a.ApplicationRef,d.LocalizationService,a.NgZone])],e)}();t.ScrollViewComponent=p},function(e,t){e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(0),r=n(0),o=function(){function e(){this.pagerIndexChange=new r.EventEmitter}return e.prototype.itemClass=function(e){return{"k-primary":e===this.activeIndex}},e.prototype.indexChange=function(e){this.pagerIndexChange.emit(e)},i.__decorate([a.Input(),i.__metadata("design:type",Number)],e.prototype,"activeIndex",void 0),i.__decorate([a.Input(),i.__metadata("design:type",Array)],e.prototype,"data",void 0),i.__decorate([a.Output(),i.__metadata("design:type",r.EventEmitter)],e.prototype,"pagerIndexChange",void 0),e=i.__decorate([a.Component({selector:"kendo-scrollview-pager",template:'\n <ul class="k-scrollview-pageable">\n <li class="k-button" *ngFor="let item of data; let i = index"\n [ngClass]="itemClass(i)"\n (click)="indexChange(i)">\n </li>\n </ul>\n '})],e)}();t.ScrollViewPagerComponent=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2);t.ScrollViewComponent=i.ScrollViewComponent;var a=n(10);t.ScrollViewModule=a.ScrollViewModule;var r=n(4);t.ScrollViewPagerComponent=r.ScrollViewPagerComponent},function(e,t){e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Next=1]="Next",e[e.Prev=-1]="Prev"}(t.Dir||(t.Dir={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){if("function"==typeof Symbol&&Symbol.iterator)return Symbol.iterator;for(var e=Object.getOwnPropertyNames(Map.prototype),t=Map.prototype,n=0;n<e.length;++n){var i=e[n];if("entries"!==i&&"size"!==i&&t[i]===t.entries)return i}}();var a={},r=function(){function e(e,t,n,i,a){this.rtl=!1,this.source=e||[],this.index=t||0,this.endless=n,this.pageIndex=i,this.rtl=a}return Object.defineProperty(e.prototype,"data",{get:function(){var e,t=this.total;this.endless?e=[this.source[(this.index-1+t)%t],this.source[this.index%t],this.source[(this.index+1+t)%t]]:e=[a].concat(this.source,[a]).slice(this.index,this.index+3);null!==this.pageIndex&&(e[this.pageIndex>this.index?2:0]=this.source[this.pageIndex]);return this.rtl?e.reverse():e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"total",{get:function(){return this.source.length},enumerable:!0,configurable:!0}),e.prototype.canMoveNext=function(){return this.endless||this.index<this.total-1},e.prototype.canMovePrev=function(){return this.endless||this.index>0},e.prototype[i]=function(){return this.data[i]()},e}();t.DataResultIterator=r;var o=function(){function e(e){this.accessor=e}return Object.defineProperty(e.prototype,"length",{get:function(){return this.accessor().data.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"total",{get:function(){return this.accessor().total},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return this.accessor().data[e]},e.prototype.canMoveNext=function(){return this.accessor().canMoveNext()},e.prototype.canMovePrev=function(){return this.accessor().canMovePrev()},e.prototype[Symbol.iterator]=function(){return this.accessor()[Symbol.iterator]()},e}();t.DataCollection=o},function(e,t){e.exports=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(0),r=n(11),o=n(2),s=n(4),l=n(3),d=[o.ScrollViewComponent,s.ScrollViewPagerComponent],p=[o.ScrollViewComponent],c=function(){function e(){}return e=i.__decorate([a.NgModule({declarations:[d],exports:[p],imports:[r.CommonModule,l.DraggableModule]})],e)}();t.ScrollViewModule=c},function(e,t){e.exports=r}])})); |
| /** | ||
| * Arguments for the `itemChanged` event. | ||
| * The `itemChanged` event fires when the current item is changed. | ||
| */ | ||
| export interface ItemChangedEvent { | ||
| /** | ||
| * The changed item. | ||
| */ | ||
| item: any; | ||
| /** | ||
| * The index of the changed item. | ||
| */ | ||
| index: number; | ||
| } |
| /** | ||
| * @hidden | ||
| */ | ||
| export declare class DataResultIterator { | ||
| private source; | ||
| private index; | ||
| private endless; | ||
| private pageIndex; | ||
| private rtl; | ||
| constructor(source: any[], index: number, endless: boolean, pageIndex: number, rtl: boolean); | ||
| readonly data: any[]; | ||
| readonly total: number; | ||
| canMoveNext(): boolean; | ||
| canMovePrev(): boolean; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| export declare class DataCollection { | ||
| private accessor; | ||
| constructor(accessor: () => DataResultIterator); | ||
| readonly length: number; | ||
| readonly total: number; | ||
| item(index: number): any; | ||
| canMoveNext(): boolean; | ||
| canMovePrev(): boolean; | ||
| [Symbol.iterator](): any; | ||
| } |
| /* tslint:disable:use-life-cycle-interface */ | ||
| /** @hidden */ | ||
| const iterator = getIterator(); | ||
| // TODO: Move to kendo-common | ||
| function getIterator() { | ||
| if (typeof Symbol === 'function' && Symbol.iterator) { | ||
| return Symbol.iterator; | ||
| } | ||
| const keys = Object.getOwnPropertyNames(Map.prototype); | ||
| const proto = Map.prototype; | ||
| for (let i = 0; i < keys.length; ++i) { | ||
| const key = keys[i]; | ||
| if (key !== 'entries' && key !== 'size' && proto[key] === proto.entries) { | ||
| return key; | ||
| } | ||
| } | ||
| } | ||
| const EMPTY_OBJ = {}; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| export class DataResultIterator { | ||
| constructor(source, index, endless, pageIndex, rtl) { | ||
| this.rtl = false; | ||
| this.source = source ? source : []; | ||
| this.index = index ? index : 0; | ||
| this.endless = endless; | ||
| this.pageIndex = pageIndex; | ||
| this.rtl = rtl; | ||
| } | ||
| get data() { | ||
| let itemCount = this.total; | ||
| let result; | ||
| if (this.endless) { | ||
| result = [ | ||
| this.source[(this.index - 1 + itemCount) % itemCount], | ||
| this.source[this.index % itemCount], | ||
| this.source[(this.index + 1 + itemCount) % itemCount] | ||
| ]; | ||
| } | ||
| else { | ||
| const data = [EMPTY_OBJ, ...this.source, EMPTY_OBJ]; | ||
| result = data.slice(this.index, this.index + 3); | ||
| } | ||
| if (this.pageIndex !== null) { | ||
| let isForward = this.pageIndex > this.index; | ||
| result[isForward ? 2 : 0] = this.source[this.pageIndex]; | ||
| } | ||
| return this.rtl ? result.reverse() : result; | ||
| } | ||
| get total() { | ||
| return this.source.length; | ||
| } | ||
| canMoveNext() { | ||
| return (this.endless || (this.index < this.total - 1)); | ||
| } | ||
| canMovePrev() { | ||
| return (this.endless || this.index > 0); | ||
| } | ||
| [iterator]() { | ||
| return this.data[iterator](); | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| export class DataCollection { | ||
| constructor(accessor) { | ||
| this.accessor = accessor; | ||
| } | ||
| get length() { return this.accessor().data.length; } | ||
| get total() { return this.accessor().total; } | ||
| item(index) { | ||
| return this.accessor().data[index]; | ||
| } | ||
| canMoveNext() { | ||
| return this.accessor().canMoveNext(); | ||
| } | ||
| canMovePrev() { | ||
| return this.accessor().canMovePrev(); | ||
| } | ||
| [Symbol.iterator]() { | ||
| return this.accessor()[Symbol.iterator](); | ||
| } | ||
| } |
| /** | ||
| * @hidden | ||
| */ | ||
| export declare type Direction = 'rtl' | 'ltr'; |
| /** | ||
| * @hidden | ||
| */ | ||
| export declare enum Dir { | ||
| Next = 1, | ||
| Prev = -1 | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| export declare type AnimationState = "left" | "right" | "center"; |
| /** | ||
| * @hidden | ||
| */ | ||
| export var Dir; | ||
| (function (Dir) { | ||
| Dir[Dir["Next"] = 1] = "Next"; | ||
| Dir[Dir["Prev"] = -1] = "Prev"; | ||
| })(Dir || (Dir = {})); |
| /** | ||
| * Generated bundle index. Do not edit. | ||
| */ | ||
| export * from './main'; |
| /** | ||
| * Generated bundle index. Do not edit. | ||
| */ | ||
| export * from './main'; |
| {"__symbolic":"module","version":4,"metadata":{"ScrollViewComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":84,"character":1},"arguments":[{"animations":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"trigger","line":86,"character":4},"arguments":["animateTo",[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"state","line":87,"character":6},"arguments":["center, left, right",{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"style","line":87,"character":35},"arguments":[{"transform":"translateX(0)"}]}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"transition","line":88,"character":6},"arguments":["* => right",[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"animate","line":89,"character":8},"arguments":["300ms ease-out",{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"style","line":89,"character":34},"arguments":[{"transform":"translateX(100%)"}]}]}]]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"transition","line":91,"character":6},"arguments":["* => left",[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"animate","line":92,"character":8},"arguments":["300ms ease-out",{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"style","line":92,"character":34},"arguments":[{"transform":"translateX(-100%)"}]}]}]]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"transition","line":94,"character":6},"arguments":["* => center",[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/animations","name":"animate","line":95,"character":8},"arguments":["300ms ease-out"]}]]}]]}],"exportAs":"kendoScrollView","providers":[{"__symbolic":"reference","module":"@progress/kendo-angular-l10n","name":"LocalizationService","line":101,"character":4},{"provide":{"__symbolic":"reference","module":"@progress/kendo-angular-l10n","name":"L10N_PREFIX","line":103,"character":15},"useValue":"kendo.scrollview"}],"selector":"kendo-scrollview","template":"\n <ul class='k-scrollview'\n [ngStyle]=\"transitionStyle\"\n [@animateTo]=\"animationState\" (@animateTo.done)= \"transitionEndHandler($event)\"\n kendoDraggable\n (kendoDrag) = \"handleDrag($event)\" (kendoPress) = \"handlePress($event)\" (kendoRelease) = \"handleRelease($event)\">\n <li *ngFor=\"let item of view;let i=index\"\n [ngStyle]=\"inlineStyles(i)\"\n [attr.aria-hidden]=\"i !== 1\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplateRef\"\n [ngTemplateOutletContext]=\"{ item: item }\">\n </ng-template>\n </li>\n </ul>\n <div class='k-scrollview-elements'\n [ngStyle]=\"{'height': height}\"\n *ngIf=\"!isDataSourceEmpty && (pageable||arrows)\">\n <a class=\"k-scrollview-prev\"\n aria-label=\"previous\"\n *ngIf=\"arrows && displayLeftArrow()\"\n (click)=\"leftArrowClick()\">\n <span class=\"k-icon k-i-arrowhead-w\"></span>\n </a>\n <a class=\"k-scrollview-next\"\n aria-label=\"next\"\n *ngIf=\"arrows && displayRightArrow()\"\n (click)=\"rightArrowClick()\">\n <span class=\"k-icon k-i-arrowhead-e\"></span>\n </a>\n <kendo-scrollview-pager *ngIf=\"pageable\"\n (pagerIndexChange)=\"pageChange($event)\"\n [data]=\"data\"\n [activeIndex]=\"activeIndex\">\n </kendo-scrollview-pager>\n </div>\n "}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":151,"character":3}}]}],"activeIndex":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":155,"character":3}}]}],"width":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":165,"character":3}}]}],"height":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":170,"character":3}}]}],"endless":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":176,"character":3}}]}],"animate":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":181,"character":3}}]}],"pageable":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":186,"character":3}}]}],"arrows":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":191,"character":3}}]}],"itemChanged":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":195,"character":3}}]}],"itemTemplateRef":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":196,"character":3},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"TemplateRef","line":196,"character":16}]}]}],"widgetClass":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":197,"character":3},"arguments":["class.k-widget"]}]}],"scrollViewClass":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":200,"character":3},"arguments":["class.k-scrollview-wrap"]}]}],"hostWidth":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":203,"character":3},"arguments":["style.width"]}]}],"hostHeight":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":204,"character":3},"arguments":["style.height"]}]}],"tabIndex":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":205,"character":3},"arguments":["attr.tabindex"]}]}],"ariaLive":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":206,"character":3},"arguments":["attr.aria-live"]}]}],"dir":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":207,"character":3},"arguments":["attr.dir"]}]}],"touchAction":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":211,"character":3},"arguments":["style.touch-action"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":231,"character":23},{"__symbolic":"reference","module":"@angular/core","name":"ApplicationRef","line":232,"character":27},{"__symbolic":"reference","module":"@progress/kendo-angular-l10n","name":"LocalizationService","line":233,"character":26},{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":234,"character":20}]}],"keyDown":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":240,"character":3},"arguments":["keydown",["$event"]]}]}],"ngOnChanges":[{"__symbolic":"method"}],"prev":[{"__symbolic":"method"}],"next":[{"__symbolic":"method"}],"transitionEndHandler":[{"__symbolic":"method"}],"handlePress":[{"__symbolic":"method"}],"handleDrag":[{"__symbolic":"method"}],"handleRelease":[{"__symbolic":"method"}],"pageChange":[{"__symbolic":"method"}],"inlineStyles":[{"__symbolic":"method"}],"displayLeftArrow":[{"__symbolic":"method"}],"leftArrowClick":[{"__symbolic":"method"}],"displayRightArrow":[{"__symbolic":"method"}],"rightArrowClick":[{"__symbolic":"method"}],"draggedInsideBounds":[{"__symbolic":"method"}],"draggedEnoughToNavigate":[{"__symbolic":"method"}],"isDragForbidden":[{"__symbolic":"method"}],"navigate":[{"__symbolic":"method"}],"changeIndex":[{"__symbolic":"method"}]}},"ScrollViewModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":46,"character":1},"arguments":[{"declarations":[[{"__symbolic":"reference","name":"ScrollViewComponent"},{"__symbolic":"reference","name":"ScrollViewPagerComponent"}]],"exports":[[{"__symbolic":"reference","name":"ScrollViewComponent"}]],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":49,"character":14},{"__symbolic":"reference","module":"@progress/kendo-angular-common","name":"DraggableModule","line":49,"character":28}]}]}],"members":{}},"ScrollViewPagerComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":6,"character":1},"arguments":[{"selector":"kendo-scrollview-pager","template":"\n <ul class=\"k-scrollview-pageable\">\n <li class=\"k-button\" *ngFor=\"let item of data; let i = index\"\n [ngClass]=\"itemClass(i)\"\n (click)=\"indexChange(i)\">\n </li>\n </ul>\n "}]}],"members":{"activeIndex":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":19,"character":5}}]}],"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":20,"character":5}}]}],"pagerIndexChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":22,"character":5}}]}],"itemClass":[{"__symbolic":"method"}],"indexChange":[{"__symbolic":"method"}]}}},"origins":{"ScrollViewComponent":"./scrollview.component","ScrollViewModule":"./scrollview.module","ScrollViewPagerComponent":"./scrollview-pager.component"},"importAs":"@progress/kendo-angular-scrollview"} |
| export { ScrollViewComponent } from './scrollview.component'; | ||
| export { ScrollViewModule } from './scrollview.module'; | ||
| export { ScrollViewPagerComponent } from './scrollview-pager.component'; |
| export { ScrollViewComponent } from './scrollview.component'; | ||
| export { ScrollViewModule } from './scrollview.module'; | ||
| export { ScrollViewPagerComponent } from './scrollview-pager.component'; |
| import { EventEmitter } from '@angular/core'; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| export declare class ScrollViewPagerComponent { | ||
| activeIndex: number; | ||
| data: any[]; | ||
| pagerIndexChange: EventEmitter<number>; | ||
| itemClass(idx: number): any; | ||
| indexChange(selectedIndex: number): void; | ||
| } |
| import { Component, Input, Output } from '@angular/core'; | ||
| import { EventEmitter } from '@angular/core'; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| export class ScrollViewPagerComponent { | ||
| constructor() { | ||
| this.pagerIndexChange = new EventEmitter(); | ||
| } | ||
| itemClass(idx) { | ||
| return { | ||
| 'k-primary': idx === this.activeIndex | ||
| }; | ||
| } | ||
| indexChange(selectedIndex) { | ||
| this.pagerIndexChange.emit(selectedIndex); | ||
| } | ||
| } | ||
| ScrollViewPagerComponent.decorators = [ | ||
| { type: Component, args: [{ | ||
| selector: 'kendo-scrollview-pager', | ||
| template: ` | ||
| <ul class="k-scrollview-pageable"> | ||
| <li class="k-button" *ngFor="let item of data; let i = index" | ||
| [ngClass]="itemClass(i)" | ||
| (click)="indexChange(i)"> | ||
| </li> | ||
| </ul> | ||
| ` | ||
| },] }, | ||
| ]; | ||
| ScrollViewPagerComponent.propDecorators = { | ||
| activeIndex: [{ type: Input }], | ||
| data: [{ type: Input }], | ||
| pagerIndexChange: [{ type: Output }] | ||
| }; |
| import { ApplicationRef, ElementRef, EventEmitter, OnChanges, TemplateRef, NgZone } from '@angular/core'; | ||
| import { AnimationEvent } from '@angular/animations'; | ||
| import { AnimationState } from './enums'; | ||
| import { ItemChangedEvent } from './change-event-args'; | ||
| import { DataCollection } from './data.collection'; | ||
| import { Direction } from './direction'; | ||
| import { LocalizationService } from '@progress/kendo-angular-l10n'; | ||
| /** | ||
| * Represents the [Kendo UI ScrollView component for Angular]({% slug overview_scrollview %}). | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * | ||
| * _@Component({ | ||
| * selector: 'my-app', | ||
| * template: ` | ||
| * <kendo-scrollview | ||
| * [data]="items" | ||
| * [width]="width" | ||
| * [height]="height" | ||
| * [endless]="endless" | ||
| * [pageable]="pageable"> | ||
| * <ng-template let-item="item"> | ||
| * <h2 class="demo-title">{{item.title}}</h2> | ||
| * <img src='{{item.url}}' alt='{{item.title}}' [ngStyle]="{minWidth: width}" draggable="false" /> | ||
| * </ng-template> | ||
| * </kendo-scrollview> | ||
| * `, | ||
| * styles: [` | ||
| * .k-scrollview-wrap { | ||
| * margin: 0 auto; | ||
| * } | ||
| * .demo-title { | ||
| * position: absolute; | ||
| * top: 0; | ||
| * left: 0; | ||
| * right: 0; | ||
| * margin: 0; | ||
| * padding: 15px; | ||
| * color: #fff; | ||
| * background-color: rgba(0,0,0,.4); | ||
| * text-align: center; | ||
| * font-size: 24px; | ||
| * } | ||
| * `] | ||
| * }) | ||
| * | ||
| * class AppComponent { | ||
| * public width: string = "600px"; | ||
| * public height: string = "400px"; | ||
| * public endless: boolean = false; | ||
| * public pageable: boolean = false; | ||
| * public items: any[] = [ | ||
| * { title: 'Flower', url: 'https://bit.ly/2cJjYuB' }, | ||
| * { title: 'Mountain', url: 'https://bit.ly/2cTBNaL' }, | ||
| * { title: 'Sky', url: 'https://bit.ly/2cJl3Cx' } | ||
| * ]; | ||
| * } | ||
| * ``` | ||
| */ | ||
| export declare class ScrollViewComponent implements OnChanges { | ||
| protected element: ElementRef; | ||
| protected application: ApplicationRef; | ||
| private localization; | ||
| private ngZone; | ||
| /** | ||
| * Provides the data source for the ScrollView ([see example]({% slug datasources_scrollview %})). | ||
| */ | ||
| data: Array<any>; | ||
| /** | ||
| * Represents the current item index ([see example]({% slug activeitems_scrollview %})). | ||
| */ | ||
| activeIndex: number; | ||
| /** | ||
| * Sets the width of the ScrollView ([see example]({% slug dimensions_scrollview %})). | ||
| * By default, the width is not set and you have to explicitly define the `width` value. | ||
| */ | ||
| width: string; | ||
| /** | ||
| * Sets the height of the ScrollView ([see example]({% slug dimensions_scrollview %})). | ||
| * By default, the height is not set and you have to explicitly define the `height` value. | ||
| */ | ||
| height: string; | ||
| /** | ||
| * Enables or disables the endless scrolling mode in which the data source items are endlessly looped | ||
| * ([see example]({% slug endlessscrolling_scrollview %})). By default, `endless` is set to `false` | ||
| * and the endless scrolling mode is disabled. | ||
| */ | ||
| endless: boolean; | ||
| /** | ||
| * Enables or disables the built-in animations ([see example]({% slug animations_scrollview %})). | ||
| * By default, `animate` is set to `true` and animations are enabled. | ||
| */ | ||
| animate: boolean; | ||
| /** | ||
| * Enables or disables the built-in pager ([see example]({% slug paging_scrollview %})). | ||
| * By default, `pageable` is set to `false` and paging is disabled. | ||
| */ | ||
| pageable: boolean; | ||
| /** | ||
| * Enables or disables the built-in navigation arrows ([see example]({% slug arrows_scrollview %})). | ||
| * By default, `arrows` is set to `false` and arrows are disabled. | ||
| */ | ||
| arrows: boolean; | ||
| /** | ||
| * Fires after the current item is changed. | ||
| */ | ||
| itemChanged: EventEmitter<ItemChangedEvent>; | ||
| itemTemplateRef: TemplateRef<any>; | ||
| readonly widgetClass: boolean; | ||
| readonly scrollViewClass: boolean; | ||
| readonly hostWidth: string; | ||
| readonly hostHeight: string; | ||
| readonly tabIndex: number; | ||
| readonly ariaLive: string; | ||
| readonly dir: Direction; | ||
| touchAction: string; | ||
| animationState: AnimationState; | ||
| transitionStyle: { | ||
| [key: string]: string; | ||
| }; | ||
| view: DataCollection; | ||
| isDataSourceEmpty: boolean; | ||
| private _activeIndex; | ||
| private index; | ||
| private initialTouchCoordinate; | ||
| private pageIndex; | ||
| private transforms; | ||
| private readonly direction; | ||
| constructor(element: ElementRef, application: ApplicationRef, localization: LocalizationService, ngZone: NgZone); | ||
| /** | ||
| * @hidden | ||
| */ | ||
| keyDown(e: any): void; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| ngOnChanges(_: any): void; | ||
| /** | ||
| * Navigates the ScrollView to the previous item. | ||
| */ | ||
| prev(): void; | ||
| /** | ||
| * Navigates the ScrollView to the next item. | ||
| */ | ||
| next(): void; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| transitionEndHandler(e: AnimationEvent): void; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| handlePress(e: any): void; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| handleDrag(e: any): void; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| handleRelease(e: any): void; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| pageChange(idx: number): void; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| inlineStyles(idx: number): { | ||
| [key: string]: string; | ||
| }; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| displayLeftArrow(): boolean; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| leftArrowClick(): void; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| displayRightArrow(): boolean; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| rightArrowClick(): void; | ||
| protected draggedInsideBounds(deltaX: number): boolean; | ||
| protected draggedEnoughToNavigate(deltaX: number): boolean; | ||
| protected isDragForbidden(deltaX: number): boolean; | ||
| private navigate; | ||
| private changeIndex; | ||
| private readonly isRTL; | ||
| } |
| import { ApplicationRef, Component, ContentChild, ElementRef, EventEmitter, HostBinding, HostListener, Input, Output, TemplateRef, NgZone } from '@angular/core'; | ||
| import { animate, state, style, transition, trigger } from '@angular/animations'; | ||
| import { Dir } from './enums'; | ||
| import { Keys } from '@progress/kendo-angular-common'; | ||
| import { DataCollection, DataResultIterator } from './data.collection'; | ||
| import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n'; | ||
| /** | ||
| * Represents the [Kendo UI ScrollView component for Angular]({% slug overview_scrollview %}). | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * | ||
| * _@Component({ | ||
| * selector: 'my-app', | ||
| * template: ` | ||
| * <kendo-scrollview | ||
| * [data]="items" | ||
| * [width]="width" | ||
| * [height]="height" | ||
| * [endless]="endless" | ||
| * [pageable]="pageable"> | ||
| * <ng-template let-item="item"> | ||
| * <h2 class="demo-title">{{item.title}}</h2> | ||
| * <img src='{{item.url}}' alt='{{item.title}}' [ngStyle]="{minWidth: width}" draggable="false" /> | ||
| * </ng-template> | ||
| * </kendo-scrollview> | ||
| * `, | ||
| * styles: [` | ||
| * .k-scrollview-wrap { | ||
| * margin: 0 auto; | ||
| * } | ||
| * .demo-title { | ||
| * position: absolute; | ||
| * top: 0; | ||
| * left: 0; | ||
| * right: 0; | ||
| * margin: 0; | ||
| * padding: 15px; | ||
| * color: #fff; | ||
| * background-color: rgba(0,0,0,.4); | ||
| * text-align: center; | ||
| * font-size: 24px; | ||
| * } | ||
| * `] | ||
| * }) | ||
| * | ||
| * class AppComponent { | ||
| * public width: string = "600px"; | ||
| * public height: string = "400px"; | ||
| * public endless: boolean = false; | ||
| * public pageable: boolean = false; | ||
| * public items: any[] = [ | ||
| * { title: 'Flower', url: 'https://bit.ly/2cJjYuB' }, | ||
| * { title: 'Mountain', url: 'https://bit.ly/2cTBNaL' }, | ||
| * { title: 'Sky', url: 'https://bit.ly/2cJl3Cx' } | ||
| * ]; | ||
| * } | ||
| * ``` | ||
| */ | ||
| export class ScrollViewComponent { | ||
| constructor(element, application, localization, ngZone) { | ||
| this.element = element; | ||
| this.application = application; | ||
| this.localization = localization; | ||
| this.ngZone = ngZone; | ||
| /** | ||
| * Provides the data source for the ScrollView ([see example]({% slug datasources_scrollview %})). | ||
| */ | ||
| this.data = []; | ||
| /** | ||
| * Enables or disables the endless scrolling mode in which the data source items are endlessly looped | ||
| * ([see example]({% slug endlessscrolling_scrollview %})). By default, `endless` is set to `false` | ||
| * and the endless scrolling mode is disabled. | ||
| */ | ||
| this.endless = false; | ||
| /** | ||
| * Enables or disables the built-in animations ([see example]({% slug animations_scrollview %})). | ||
| * By default, `animate` is set to `true` and animations are enabled. | ||
| */ | ||
| this.animate = true; | ||
| /** | ||
| * Enables or disables the built-in pager ([see example]({% slug paging_scrollview %})). | ||
| * By default, `pageable` is set to `false` and paging is disabled. | ||
| */ | ||
| this.pageable = false; | ||
| /** | ||
| * Enables or disables the built-in navigation arrows ([see example]({% slug arrows_scrollview %})). | ||
| * By default, `arrows` is set to `false` and arrows are disabled. | ||
| */ | ||
| this.arrows = false; | ||
| /** | ||
| * Fires after the current item is changed. | ||
| */ | ||
| this.itemChanged = new EventEmitter(); | ||
| this.touchAction = 'pan-y pinch-zoom'; | ||
| this.animationState = null; | ||
| this.transitionStyle = {}; | ||
| this.view = new DataCollection(() => new DataResultIterator(this.data, this.activeIndex, this.endless, this.pageIndex, this.isRTL)); | ||
| this.isDataSourceEmpty = false; | ||
| this._activeIndex = 0; | ||
| this.index = 0; | ||
| this.pageIndex = null; | ||
| this.transforms = ["translateX(-100%)", "translateX(0%)", "translateX(100%)"]; | ||
| } | ||
| /** | ||
| * Represents the current item index ([see example]({% slug activeitems_scrollview %})). | ||
| */ | ||
| set activeIndex(value) { | ||
| this.index = this._activeIndex = value; | ||
| } | ||
| get activeIndex() { | ||
| return this._activeIndex; | ||
| } | ||
| get widgetClass() { | ||
| return true; | ||
| } | ||
| get scrollViewClass() { | ||
| return true; | ||
| } | ||
| get hostWidth() { return this.width; } | ||
| get hostHeight() { return this.height; } | ||
| get tabIndex() { return 1; } | ||
| get ariaLive() { return "assertive"; } | ||
| get dir() { | ||
| return this.direction; | ||
| } | ||
| get direction() { | ||
| return this.localization.rtl ? 'rtl' : 'ltr'; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| keyDown(e) { | ||
| if (e.keyCode === Keys.ArrowLeft) { | ||
| if (this.isRTL) { | ||
| this.next(); | ||
| } | ||
| else { | ||
| this.prev(); | ||
| } | ||
| } | ||
| if (e.keyCode === Keys.ArrowRight) { | ||
| if (this.isRTL) { | ||
| this.prev(); | ||
| } | ||
| else { | ||
| this.next(); | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| ngOnChanges(_) { | ||
| this.activeIndex = Math.max(Math.min(this.activeIndex, this.view.total - 1), 0); | ||
| } | ||
| /** | ||
| * Navigates the ScrollView to the previous item. | ||
| */ | ||
| prev() { | ||
| this.navigate(Dir.Prev); | ||
| } | ||
| /** | ||
| * Navigates the ScrollView to the next item. | ||
| */ | ||
| next() { | ||
| this.navigate(Dir.Next); | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| transitionEndHandler(e) { | ||
| this.animationState = null; | ||
| if (e.toState === "left" || e.toState === "right") { | ||
| if (this.pageIndex !== null) { | ||
| this.activeIndex = this.pageIndex; | ||
| this.pageIndex = null; | ||
| } | ||
| this.activeIndex = this.index; | ||
| this.itemChanged.emit({ index: this.activeIndex, item: this.view.item(1) }); | ||
| this.application.tick(); | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| handlePress(e) { | ||
| this.initialTouchCoordinate = e.pageX; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| handleDrag(e) { | ||
| const deltaX = e.pageX - this.initialTouchCoordinate; | ||
| if (!this.animationState && !this.isDragForbidden(deltaX) && this.draggedInsideBounds(deltaX)) { | ||
| // TO DO: refactor to apply style without triggering the change detection | ||
| this.ngZone.run(() => { | ||
| this.transitionStyle = { transform: `translateX(${deltaX}px)` }; | ||
| }); | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| handleRelease(e) { | ||
| const deltaX = e.pageX - this.initialTouchCoordinate; | ||
| if (this.isDragForbidden(deltaX)) { | ||
| return; | ||
| } | ||
| this.ngZone.run(() => { | ||
| if (this.draggedEnoughToNavigate(deltaX)) { | ||
| if (this.isRTL) { | ||
| this.changeIndex(deltaX < 0 ? Dir.Prev : Dir.Next); | ||
| } | ||
| else { | ||
| this.changeIndex(deltaX > 0 ? Dir.Prev : Dir.Next); | ||
| } | ||
| if (!this.animate) { | ||
| this.transitionStyle = null; | ||
| this.itemChanged.emit({ index: this.activeIndex, item: this.view.item(1) }); | ||
| } | ||
| } | ||
| else if (Math.abs(deltaX) > 0) { | ||
| if (this.animate) { | ||
| this.animationState = "center"; | ||
| } | ||
| else { | ||
| this.transitionStyle = null; | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| pageChange(idx) { | ||
| if (!this.animationState && this.activeIndex !== idx) { | ||
| if (this.animate) { | ||
| this.pageIndex = idx; | ||
| if (this.isRTL) { | ||
| this.animationState = (this.pageIndex > this.index ? "right" : "left"); | ||
| } | ||
| else { | ||
| this.animationState = (this.pageIndex > this.index ? "left" : "right"); | ||
| } | ||
| } | ||
| else { | ||
| this.activeIndex = idx; | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| inlineStyles(idx) { | ||
| return { | ||
| "height": this.height, | ||
| "transform": this.transforms[idx], | ||
| "width": this.width | ||
| }; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| displayLeftArrow() { | ||
| let isNotBorderItem; | ||
| if (this.isRTL) { | ||
| isNotBorderItem = this.activeIndex + 1 < this.view.total; | ||
| } | ||
| else { | ||
| isNotBorderItem = this.activeIndex > 0; | ||
| } | ||
| return (this.endless || isNotBorderItem) && this.view.total > 0; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| leftArrowClick() { | ||
| if (this.isRTL) { | ||
| this.next(); | ||
| } | ||
| else { | ||
| this.prev(); | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| displayRightArrow() { | ||
| let isNotBorderItem; | ||
| if (this.isRTL) { | ||
| isNotBorderItem = this.activeIndex > 0; | ||
| } | ||
| else { | ||
| isNotBorderItem = this.activeIndex + 1 < this.view.total; | ||
| } | ||
| return (this.endless || isNotBorderItem) && this.view.total > 0; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| rightArrowClick() { | ||
| if (this.isRTL) { | ||
| this.prev(); | ||
| } | ||
| else { | ||
| this.next(); | ||
| } | ||
| } | ||
| draggedInsideBounds(deltaX) { | ||
| return Math.abs(deltaX) <= this.element.nativeElement.offsetWidth; | ||
| } | ||
| draggedEnoughToNavigate(deltaX) { | ||
| return Math.abs(deltaX) > (this.element.nativeElement.offsetWidth / 2); | ||
| } | ||
| isDragForbidden(deltaX) { | ||
| let pastEnd; | ||
| let isEndReached; | ||
| if (this.isRTL) { | ||
| pastEnd = deltaX < 0 && deltaX !== 0; | ||
| } | ||
| else { | ||
| pastEnd = deltaX > 0 && deltaX !== 0; | ||
| } | ||
| isEndReached = ((this.activeIndex === 0 && pastEnd) || (this.activeIndex === this.view.total - 1 && !pastEnd)); | ||
| return !this.endless && isEndReached; | ||
| } | ||
| navigate(direction) { | ||
| if (this.isDataSourceEmpty || this.animationState) { | ||
| return; | ||
| } | ||
| this.changeIndex(direction); | ||
| if (!this.animate) { | ||
| this.itemChanged.emit({ index: this.activeIndex, item: this.view.item(1) }); | ||
| } | ||
| } | ||
| changeIndex(direction) { | ||
| if (direction === Dir.Next && this.view.canMoveNext()) { | ||
| this.index = (this.index + 1) % this.view.total; | ||
| if (this.animate) { | ||
| this.animationState = this.isRTL ? "right" : "left"; | ||
| } | ||
| else { | ||
| this.activeIndex = this.index; | ||
| } | ||
| } | ||
| else if (direction === Dir.Prev && this.view.canMovePrev()) { | ||
| this.index = this.index === 0 ? this.view.total - 1 : this.index - 1; | ||
| if (this.animate) { | ||
| this.animationState = this.isRTL ? "left" : "right"; | ||
| } | ||
| else { | ||
| this.activeIndex = this.index; | ||
| } | ||
| } | ||
| } | ||
| get isRTL() { | ||
| return this.direction === "rtl"; | ||
| } | ||
| } | ||
| ScrollViewComponent.decorators = [ | ||
| { type: Component, args: [{ | ||
| animations: [ | ||
| trigger('animateTo', [ | ||
| state('center, left, right', style({ transform: 'translateX(0)' })), | ||
| transition('* => right', [ | ||
| animate('300ms ease-out', style({ transform: 'translateX(100%)' })) | ||
| ]), | ||
| transition('* => left', [ | ||
| animate('300ms ease-out', style({ transform: 'translateX(-100%)' })) | ||
| ]), | ||
| transition('* => center', [ | ||
| animate('300ms ease-out') | ||
| ]) | ||
| ]) | ||
| ], | ||
| exportAs: 'kendoScrollView', | ||
| providers: [ | ||
| LocalizationService, | ||
| { | ||
| provide: L10N_PREFIX, | ||
| useValue: 'kendo.scrollview' | ||
| } | ||
| ], | ||
| selector: 'kendo-scrollview', | ||
| template: ` | ||
| <ul class='k-scrollview' | ||
| [ngStyle]="transitionStyle" | ||
| [@animateTo]="animationState" (@animateTo.done)= "transitionEndHandler($event)" | ||
| kendoDraggable | ||
| (kendoDrag) = "handleDrag($event)" (kendoPress) = "handlePress($event)" (kendoRelease) = "handleRelease($event)"> | ||
| <li *ngFor="let item of view;let i=index" | ||
| [ngStyle]="inlineStyles(i)" | ||
| [attr.aria-hidden]="i !== 1"> | ||
| <ng-template | ||
| [ngTemplateOutlet]="itemTemplateRef" | ||
| [ngTemplateOutletContext]="{ item: item }"> | ||
| </ng-template> | ||
| </li> | ||
| </ul> | ||
| <div class='k-scrollview-elements' | ||
| [ngStyle]="{'height': height}" | ||
| *ngIf="!isDataSourceEmpty && (pageable||arrows)"> | ||
| <a class="k-scrollview-prev" | ||
| aria-label="previous" | ||
| *ngIf="arrows && displayLeftArrow()" | ||
| (click)="leftArrowClick()"> | ||
| <span class="k-icon k-i-arrowhead-w"></span> | ||
| </a> | ||
| <a class="k-scrollview-next" | ||
| aria-label="next" | ||
| *ngIf="arrows && displayRightArrow()" | ||
| (click)="rightArrowClick()"> | ||
| <span class="k-icon k-i-arrowhead-e"></span> | ||
| </a> | ||
| <kendo-scrollview-pager *ngIf="pageable" | ||
| (pagerIndexChange)="pageChange($event)" | ||
| [data]="data" | ||
| [activeIndex]="activeIndex"> | ||
| </kendo-scrollview-pager> | ||
| </div> | ||
| ` | ||
| },] }, | ||
| ]; | ||
| /** @nocollapse */ | ||
| ScrollViewComponent.ctorParameters = () => [ | ||
| { type: ElementRef }, | ||
| { type: ApplicationRef }, | ||
| { type: LocalizationService }, | ||
| { type: NgZone } | ||
| ]; | ||
| ScrollViewComponent.propDecorators = { | ||
| data: [{ type: Input }], | ||
| activeIndex: [{ type: Input }], | ||
| width: [{ type: Input }], | ||
| height: [{ type: Input }], | ||
| endless: [{ type: Input }], | ||
| animate: [{ type: Input }], | ||
| pageable: [{ type: Input }], | ||
| arrows: [{ type: Input }], | ||
| itemChanged: [{ type: Output }], | ||
| itemTemplateRef: [{ type: ContentChild, args: [TemplateRef,] }], | ||
| widgetClass: [{ type: HostBinding, args: ['class.k-widget',] }], | ||
| scrollViewClass: [{ type: HostBinding, args: ['class.k-scrollview-wrap',] }], | ||
| hostWidth: [{ type: HostBinding, args: ['style.width',] }], | ||
| hostHeight: [{ type: HostBinding, args: ['style.height',] }], | ||
| tabIndex: [{ type: HostBinding, args: ['attr.tabindex',] }], | ||
| ariaLive: [{ type: HostBinding, args: ['attr.aria-live',] }], | ||
| dir: [{ type: HostBinding, args: ['attr.dir',] }], | ||
| touchAction: [{ type: HostBinding, args: ['style.touch-action',] }], | ||
| keyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }] | ||
| }; |
| /** | ||
| * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }}) | ||
| * definition for the ScrollView component. | ||
| * | ||
| * @example | ||
| * | ||
| * ```ts-no-run | ||
| * // Import the ScrollView module | ||
| * import { ScrollViewModule } from '@progress/kendo-angular-scrollview'; | ||
| * | ||
| * // The browser platform with a compiler | ||
| * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
| * | ||
| * import { NgModule } from '@angular/core'; | ||
| * | ||
| * // Import the app component | ||
| * import { AppComponent } from './app.component'; | ||
| * | ||
| * // Define the app module | ||
| * _@NgModule({ | ||
| * declarations: [AppComponent], // declare app component | ||
| * imports: [BrowserModule, ScrollViewModule], // import ScrollView module | ||
| * bootstrap: [AppComponent] | ||
| * }) | ||
| * export class AppModule {} | ||
| * | ||
| * // Compile and launch the module | ||
| * platformBrowserDynamic().bootstrapModule(AppModule); | ||
| * | ||
| * ``` | ||
| */ | ||
| export declare class ScrollViewModule { | ||
| } |
| import { NgModule } from '@angular/core'; | ||
| import { CommonModule } from '@angular/common'; | ||
| import { ScrollViewComponent } from './scrollview.component'; | ||
| import { ScrollViewPagerComponent } from "./scrollview-pager.component"; | ||
| import { DraggableModule } from '@progress/kendo-angular-common'; | ||
| const DECLARATIONS = [ | ||
| ScrollViewComponent, | ||
| ScrollViewPagerComponent | ||
| ]; | ||
| const EXPORTS = [ | ||
| ScrollViewComponent | ||
| ]; | ||
| /** | ||
| * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }}) | ||
| * definition for the ScrollView component. | ||
| * | ||
| * @example | ||
| * | ||
| * ```ts-no-run | ||
| * // Import the ScrollView module | ||
| * import { ScrollViewModule } from '@progress/kendo-angular-scrollview'; | ||
| * | ||
| * // The browser platform with a compiler | ||
| * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
| * | ||
| * import { NgModule } from '@angular/core'; | ||
| * | ||
| * // Import the app component | ||
| * import { AppComponent } from './app.component'; | ||
| * | ||
| * // Define the app module | ||
| * _@NgModule({ | ||
| * declarations: [AppComponent], // declare app component | ||
| * imports: [BrowserModule, ScrollViewModule], // import ScrollView module | ||
| * bootstrap: [AppComponent] | ||
| * }) | ||
| * export class AppModule {} | ||
| * | ||
| * // Compile and launch the module | ||
| * platformBrowserDynamic().bootstrapModule(AppModule); | ||
| * | ||
| * ``` | ||
| */ | ||
| export class ScrollViewModule { | ||
| } | ||
| ScrollViewModule.decorators = [ | ||
| { type: NgModule, args: [{ | ||
| declarations: [DECLARATIONS], | ||
| exports: [EXPORTS], | ||
| imports: [CommonModule, DraggableModule] | ||
| },] }, | ||
| ]; |
| import { ApplicationRef, Component, ContentChild, ElementRef, EventEmitter, HostBinding, HostListener, Input, NgModule, NgZone, Output, TemplateRef } from '@angular/core'; | ||
| import { animate, state, style, transition, trigger } from '@angular/animations'; | ||
| import { DraggableModule, Keys } from '@progress/kendo-angular-common'; | ||
| import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n'; | ||
| import { CommonModule } from '@angular/common'; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| var Dir; | ||
| (function (Dir) { | ||
| Dir[Dir["Next"] = 1] = "Next"; | ||
| Dir[Dir["Prev"] = -1] = "Prev"; | ||
| })(Dir || (Dir = {})); | ||
| /* tslint:disable:use-life-cycle-interface */ | ||
| /** @hidden */ | ||
| const iterator = getIterator(); | ||
| // TODO: Move to kendo-common | ||
| function getIterator() { | ||
| if (typeof Symbol === 'function' && Symbol.iterator) { | ||
| return Symbol.iterator; | ||
| } | ||
| const keys = Object.getOwnPropertyNames(Map.prototype); | ||
| const proto = Map.prototype; | ||
| for (let i = 0; i < keys.length; ++i) { | ||
| const key = keys[i]; | ||
| if (key !== 'entries' && key !== 'size' && proto[key] === proto.entries) { | ||
| return key; | ||
| } | ||
| } | ||
| } | ||
| const EMPTY_OBJ = {}; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| class DataResultIterator { | ||
| constructor(source, index, endless, pageIndex, rtl) { | ||
| this.rtl = false; | ||
| this.source = source ? source : []; | ||
| this.index = index ? index : 0; | ||
| this.endless = endless; | ||
| this.pageIndex = pageIndex; | ||
| this.rtl = rtl; | ||
| } | ||
| get data() { | ||
| let itemCount = this.total; | ||
| let result; | ||
| if (this.endless) { | ||
| result = [ | ||
| this.source[(this.index - 1 + itemCount) % itemCount], | ||
| this.source[this.index % itemCount], | ||
| this.source[(this.index + 1 + itemCount) % itemCount] | ||
| ]; | ||
| } | ||
| else { | ||
| const data = [EMPTY_OBJ, ...this.source, EMPTY_OBJ]; | ||
| result = data.slice(this.index, this.index + 3); | ||
| } | ||
| if (this.pageIndex !== null) { | ||
| let isForward = this.pageIndex > this.index; | ||
| result[isForward ? 2 : 0] = this.source[this.pageIndex]; | ||
| } | ||
| return this.rtl ? result.reverse() : result; | ||
| } | ||
| get total() { | ||
| return this.source.length; | ||
| } | ||
| canMoveNext() { | ||
| return (this.endless || (this.index < this.total - 1)); | ||
| } | ||
| canMovePrev() { | ||
| return (this.endless || this.index > 0); | ||
| } | ||
| [iterator]() { | ||
| return this.data[iterator](); | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| class DataCollection { | ||
| constructor(accessor) { | ||
| this.accessor = accessor; | ||
| } | ||
| get length() { return this.accessor().data.length; } | ||
| get total() { return this.accessor().total; } | ||
| item(index) { | ||
| return this.accessor().data[index]; | ||
| } | ||
| canMoveNext() { | ||
| return this.accessor().canMoveNext(); | ||
| } | ||
| canMovePrev() { | ||
| return this.accessor().canMovePrev(); | ||
| } | ||
| [Symbol.iterator]() { | ||
| return this.accessor()[Symbol.iterator](); | ||
| } | ||
| } | ||
| /** | ||
| * Represents the [Kendo UI ScrollView component for Angular]({% slug overview_scrollview %}). | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * | ||
| * _@Component({ | ||
| * selector: 'my-app', | ||
| * template: ` | ||
| * <kendo-scrollview | ||
| * [data]="items" | ||
| * [width]="width" | ||
| * [height]="height" | ||
| * [endless]="endless" | ||
| * [pageable]="pageable"> | ||
| * <ng-template let-item="item"> | ||
| * <h2 class="demo-title">{{item.title}}</h2> | ||
| * <img src='{{item.url}}' alt='{{item.title}}' [ngStyle]="{minWidth: width}" draggable="false" /> | ||
| * </ng-template> | ||
| * </kendo-scrollview> | ||
| * `, | ||
| * styles: [` | ||
| * .k-scrollview-wrap { | ||
| * margin: 0 auto; | ||
| * } | ||
| * .demo-title { | ||
| * position: absolute; | ||
| * top: 0; | ||
| * left: 0; | ||
| * right: 0; | ||
| * margin: 0; | ||
| * padding: 15px; | ||
| * color: #fff; | ||
| * background-color: rgba(0,0,0,.4); | ||
| * text-align: center; | ||
| * font-size: 24px; | ||
| * } | ||
| * `] | ||
| * }) | ||
| * | ||
| * class AppComponent { | ||
| * public width: string = "600px"; | ||
| * public height: string = "400px"; | ||
| * public endless: boolean = false; | ||
| * public pageable: boolean = false; | ||
| * public items: any[] = [ | ||
| * { title: 'Flower', url: 'https://bit.ly/2cJjYuB' }, | ||
| * { title: 'Mountain', url: 'https://bit.ly/2cTBNaL' }, | ||
| * { title: 'Sky', url: 'https://bit.ly/2cJl3Cx' } | ||
| * ]; | ||
| * } | ||
| * ``` | ||
| */ | ||
| class ScrollViewComponent { | ||
| constructor(element, application, localization, ngZone) { | ||
| this.element = element; | ||
| this.application = application; | ||
| this.localization = localization; | ||
| this.ngZone = ngZone; | ||
| /** | ||
| * Provides the data source for the ScrollView ([see example]({% slug datasources_scrollview %})). | ||
| */ | ||
| this.data = []; | ||
| /** | ||
| * Enables or disables the endless scrolling mode in which the data source items are endlessly looped | ||
| * ([see example]({% slug endlessscrolling_scrollview %})). By default, `endless` is set to `false` | ||
| * and the endless scrolling mode is disabled. | ||
| */ | ||
| this.endless = false; | ||
| /** | ||
| * Enables or disables the built-in animations ([see example]({% slug animations_scrollview %})). | ||
| * By default, `animate` is set to `true` and animations are enabled. | ||
| */ | ||
| this.animate = true; | ||
| /** | ||
| * Enables or disables the built-in pager ([see example]({% slug paging_scrollview %})). | ||
| * By default, `pageable` is set to `false` and paging is disabled. | ||
| */ | ||
| this.pageable = false; | ||
| /** | ||
| * Enables or disables the built-in navigation arrows ([see example]({% slug arrows_scrollview %})). | ||
| * By default, `arrows` is set to `false` and arrows are disabled. | ||
| */ | ||
| this.arrows = false; | ||
| /** | ||
| * Fires after the current item is changed. | ||
| */ | ||
| this.itemChanged = new EventEmitter(); | ||
| this.touchAction = 'pan-y pinch-zoom'; | ||
| this.animationState = null; | ||
| this.transitionStyle = {}; | ||
| this.view = new DataCollection(() => new DataResultIterator(this.data, this.activeIndex, this.endless, this.pageIndex, this.isRTL)); | ||
| this.isDataSourceEmpty = false; | ||
| this._activeIndex = 0; | ||
| this.index = 0; | ||
| this.pageIndex = null; | ||
| this.transforms = ["translateX(-100%)", "translateX(0%)", "translateX(100%)"]; | ||
| } | ||
| /** | ||
| * Represents the current item index ([see example]({% slug activeitems_scrollview %})). | ||
| */ | ||
| set activeIndex(value) { | ||
| this.index = this._activeIndex = value; | ||
| } | ||
| get activeIndex() { | ||
| return this._activeIndex; | ||
| } | ||
| get widgetClass() { | ||
| return true; | ||
| } | ||
| get scrollViewClass() { | ||
| return true; | ||
| } | ||
| get hostWidth() { return this.width; } | ||
| get hostHeight() { return this.height; } | ||
| get tabIndex() { return 1; } | ||
| get ariaLive() { return "assertive"; } | ||
| get dir() { | ||
| return this.direction; | ||
| } | ||
| get direction() { | ||
| return this.localization.rtl ? 'rtl' : 'ltr'; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| keyDown(e) { | ||
| if (e.keyCode === Keys.ArrowLeft) { | ||
| if (this.isRTL) { | ||
| this.next(); | ||
| } | ||
| else { | ||
| this.prev(); | ||
| } | ||
| } | ||
| if (e.keyCode === Keys.ArrowRight) { | ||
| if (this.isRTL) { | ||
| this.prev(); | ||
| } | ||
| else { | ||
| this.next(); | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| ngOnChanges(_) { | ||
| this.activeIndex = Math.max(Math.min(this.activeIndex, this.view.total - 1), 0); | ||
| } | ||
| /** | ||
| * Navigates the ScrollView to the previous item. | ||
| */ | ||
| prev() { | ||
| this.navigate(Dir.Prev); | ||
| } | ||
| /** | ||
| * Navigates the ScrollView to the next item. | ||
| */ | ||
| next() { | ||
| this.navigate(Dir.Next); | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| transitionEndHandler(e) { | ||
| this.animationState = null; | ||
| if (e.toState === "left" || e.toState === "right") { | ||
| if (this.pageIndex !== null) { | ||
| this.activeIndex = this.pageIndex; | ||
| this.pageIndex = null; | ||
| } | ||
| this.activeIndex = this.index; | ||
| this.itemChanged.emit({ index: this.activeIndex, item: this.view.item(1) }); | ||
| this.application.tick(); | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| handlePress(e) { | ||
| this.initialTouchCoordinate = e.pageX; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| handleDrag(e) { | ||
| const deltaX = e.pageX - this.initialTouchCoordinate; | ||
| if (!this.animationState && !this.isDragForbidden(deltaX) && this.draggedInsideBounds(deltaX)) { | ||
| // TO DO: refactor to apply style without triggering the change detection | ||
| this.ngZone.run(() => { | ||
| this.transitionStyle = { transform: `translateX(${deltaX}px)` }; | ||
| }); | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| handleRelease(e) { | ||
| const deltaX = e.pageX - this.initialTouchCoordinate; | ||
| if (this.isDragForbidden(deltaX)) { | ||
| return; | ||
| } | ||
| this.ngZone.run(() => { | ||
| if (this.draggedEnoughToNavigate(deltaX)) { | ||
| if (this.isRTL) { | ||
| this.changeIndex(deltaX < 0 ? Dir.Prev : Dir.Next); | ||
| } | ||
| else { | ||
| this.changeIndex(deltaX > 0 ? Dir.Prev : Dir.Next); | ||
| } | ||
| if (!this.animate) { | ||
| this.transitionStyle = null; | ||
| this.itemChanged.emit({ index: this.activeIndex, item: this.view.item(1) }); | ||
| } | ||
| } | ||
| else if (Math.abs(deltaX) > 0) { | ||
| if (this.animate) { | ||
| this.animationState = "center"; | ||
| } | ||
| else { | ||
| this.transitionStyle = null; | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| pageChange(idx) { | ||
| if (!this.animationState && this.activeIndex !== idx) { | ||
| if (this.animate) { | ||
| this.pageIndex = idx; | ||
| if (this.isRTL) { | ||
| this.animationState = (this.pageIndex > this.index ? "right" : "left"); | ||
| } | ||
| else { | ||
| this.animationState = (this.pageIndex > this.index ? "left" : "right"); | ||
| } | ||
| } | ||
| else { | ||
| this.activeIndex = idx; | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| inlineStyles(idx) { | ||
| return { | ||
| "height": this.height, | ||
| "transform": this.transforms[idx], | ||
| "width": this.width | ||
| }; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| displayLeftArrow() { | ||
| let isNotBorderItem; | ||
| if (this.isRTL) { | ||
| isNotBorderItem = this.activeIndex + 1 < this.view.total; | ||
| } | ||
| else { | ||
| isNotBorderItem = this.activeIndex > 0; | ||
| } | ||
| return (this.endless || isNotBorderItem) && this.view.total > 0; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| leftArrowClick() { | ||
| if (this.isRTL) { | ||
| this.next(); | ||
| } | ||
| else { | ||
| this.prev(); | ||
| } | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| displayRightArrow() { | ||
| let isNotBorderItem; | ||
| if (this.isRTL) { | ||
| isNotBorderItem = this.activeIndex > 0; | ||
| } | ||
| else { | ||
| isNotBorderItem = this.activeIndex + 1 < this.view.total; | ||
| } | ||
| return (this.endless || isNotBorderItem) && this.view.total > 0; | ||
| } | ||
| /** | ||
| * @hidden | ||
| */ | ||
| rightArrowClick() { | ||
| if (this.isRTL) { | ||
| this.prev(); | ||
| } | ||
| else { | ||
| this.next(); | ||
| } | ||
| } | ||
| draggedInsideBounds(deltaX) { | ||
| return Math.abs(deltaX) <= this.element.nativeElement.offsetWidth; | ||
| } | ||
| draggedEnoughToNavigate(deltaX) { | ||
| return Math.abs(deltaX) > (this.element.nativeElement.offsetWidth / 2); | ||
| } | ||
| isDragForbidden(deltaX) { | ||
| let pastEnd; | ||
| let isEndReached; | ||
| if (this.isRTL) { | ||
| pastEnd = deltaX < 0 && deltaX !== 0; | ||
| } | ||
| else { | ||
| pastEnd = deltaX > 0 && deltaX !== 0; | ||
| } | ||
| isEndReached = ((this.activeIndex === 0 && pastEnd) || (this.activeIndex === this.view.total - 1 && !pastEnd)); | ||
| return !this.endless && isEndReached; | ||
| } | ||
| navigate(direction) { | ||
| if (this.isDataSourceEmpty || this.animationState) { | ||
| return; | ||
| } | ||
| this.changeIndex(direction); | ||
| if (!this.animate) { | ||
| this.itemChanged.emit({ index: this.activeIndex, item: this.view.item(1) }); | ||
| } | ||
| } | ||
| changeIndex(direction) { | ||
| if (direction === Dir.Next && this.view.canMoveNext()) { | ||
| this.index = (this.index + 1) % this.view.total; | ||
| if (this.animate) { | ||
| this.animationState = this.isRTL ? "right" : "left"; | ||
| } | ||
| else { | ||
| this.activeIndex = this.index; | ||
| } | ||
| } | ||
| else if (direction === Dir.Prev && this.view.canMovePrev()) { | ||
| this.index = this.index === 0 ? this.view.total - 1 : this.index - 1; | ||
| if (this.animate) { | ||
| this.animationState = this.isRTL ? "left" : "right"; | ||
| } | ||
| else { | ||
| this.activeIndex = this.index; | ||
| } | ||
| } | ||
| } | ||
| get isRTL() { | ||
| return this.direction === "rtl"; | ||
| } | ||
| } | ||
| ScrollViewComponent.decorators = [ | ||
| { type: Component, args: [{ | ||
| animations: [ | ||
| trigger('animateTo', [ | ||
| state('center, left, right', style({ transform: 'translateX(0)' })), | ||
| transition('* => right', [ | ||
| animate('300ms ease-out', style({ transform: 'translateX(100%)' })) | ||
| ]), | ||
| transition('* => left', [ | ||
| animate('300ms ease-out', style({ transform: 'translateX(-100%)' })) | ||
| ]), | ||
| transition('* => center', [ | ||
| animate('300ms ease-out') | ||
| ]) | ||
| ]) | ||
| ], | ||
| exportAs: 'kendoScrollView', | ||
| providers: [ | ||
| LocalizationService, | ||
| { | ||
| provide: L10N_PREFIX, | ||
| useValue: 'kendo.scrollview' | ||
| } | ||
| ], | ||
| selector: 'kendo-scrollview', | ||
| template: ` | ||
| <ul class='k-scrollview' | ||
| [ngStyle]="transitionStyle" | ||
| [@animateTo]="animationState" (@animateTo.done)= "transitionEndHandler($event)" | ||
| kendoDraggable | ||
| (kendoDrag) = "handleDrag($event)" (kendoPress) = "handlePress($event)" (kendoRelease) = "handleRelease($event)"> | ||
| <li *ngFor="let item of view;let i=index" | ||
| [ngStyle]="inlineStyles(i)" | ||
| [attr.aria-hidden]="i !== 1"> | ||
| <ng-template | ||
| [ngTemplateOutlet]="itemTemplateRef" | ||
| [ngTemplateOutletContext]="{ item: item }"> | ||
| </ng-template> | ||
| </li> | ||
| </ul> | ||
| <div class='k-scrollview-elements' | ||
| [ngStyle]="{'height': height}" | ||
| *ngIf="!isDataSourceEmpty && (pageable||arrows)"> | ||
| <a class="k-scrollview-prev" | ||
| aria-label="previous" | ||
| *ngIf="arrows && displayLeftArrow()" | ||
| (click)="leftArrowClick()"> | ||
| <span class="k-icon k-i-arrowhead-w"></span> | ||
| </a> | ||
| <a class="k-scrollview-next" | ||
| aria-label="next" | ||
| *ngIf="arrows && displayRightArrow()" | ||
| (click)="rightArrowClick()"> | ||
| <span class="k-icon k-i-arrowhead-e"></span> | ||
| </a> | ||
| <kendo-scrollview-pager *ngIf="pageable" | ||
| (pagerIndexChange)="pageChange($event)" | ||
| [data]="data" | ||
| [activeIndex]="activeIndex"> | ||
| </kendo-scrollview-pager> | ||
| </div> | ||
| ` | ||
| },] }, | ||
| ]; | ||
| /** @nocollapse */ | ||
| ScrollViewComponent.ctorParameters = () => [ | ||
| { type: ElementRef }, | ||
| { type: ApplicationRef }, | ||
| { type: LocalizationService }, | ||
| { type: NgZone } | ||
| ]; | ||
| ScrollViewComponent.propDecorators = { | ||
| data: [{ type: Input }], | ||
| activeIndex: [{ type: Input }], | ||
| width: [{ type: Input }], | ||
| height: [{ type: Input }], | ||
| endless: [{ type: Input }], | ||
| animate: [{ type: Input }], | ||
| pageable: [{ type: Input }], | ||
| arrows: [{ type: Input }], | ||
| itemChanged: [{ type: Output }], | ||
| itemTemplateRef: [{ type: ContentChild, args: [TemplateRef,] }], | ||
| widgetClass: [{ type: HostBinding, args: ['class.k-widget',] }], | ||
| scrollViewClass: [{ type: HostBinding, args: ['class.k-scrollview-wrap',] }], | ||
| hostWidth: [{ type: HostBinding, args: ['style.width',] }], | ||
| hostHeight: [{ type: HostBinding, args: ['style.height',] }], | ||
| tabIndex: [{ type: HostBinding, args: ['attr.tabindex',] }], | ||
| ariaLive: [{ type: HostBinding, args: ['attr.aria-live',] }], | ||
| dir: [{ type: HostBinding, args: ['attr.dir',] }], | ||
| touchAction: [{ type: HostBinding, args: ['style.touch-action',] }], | ||
| keyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }] | ||
| }; | ||
| /** | ||
| * @hidden | ||
| */ | ||
| class ScrollViewPagerComponent { | ||
| constructor() { | ||
| this.pagerIndexChange = new EventEmitter(); | ||
| } | ||
| itemClass(idx) { | ||
| return { | ||
| 'k-primary': idx === this.activeIndex | ||
| }; | ||
| } | ||
| indexChange(selectedIndex) { | ||
| this.pagerIndexChange.emit(selectedIndex); | ||
| } | ||
| } | ||
| ScrollViewPagerComponent.decorators = [ | ||
| { type: Component, args: [{ | ||
| selector: 'kendo-scrollview-pager', | ||
| template: ` | ||
| <ul class="k-scrollview-pageable"> | ||
| <li class="k-button" *ngFor="let item of data; let i = index" | ||
| [ngClass]="itemClass(i)" | ||
| (click)="indexChange(i)"> | ||
| </li> | ||
| </ul> | ||
| ` | ||
| },] }, | ||
| ]; | ||
| ScrollViewPagerComponent.propDecorators = { | ||
| activeIndex: [{ type: Input }], | ||
| data: [{ type: Input }], | ||
| pagerIndexChange: [{ type: Output }] | ||
| }; | ||
| const DECLARATIONS = [ | ||
| ScrollViewComponent, | ||
| ScrollViewPagerComponent | ||
| ]; | ||
| const EXPORTS = [ | ||
| ScrollViewComponent | ||
| ]; | ||
| /** | ||
| * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }}) | ||
| * definition for the ScrollView component. | ||
| * | ||
| * @example | ||
| * | ||
| * ```ts-no-run | ||
| * // Import the ScrollView module | ||
| * import { ScrollViewModule } from '@progress/kendo-angular-scrollview'; | ||
| * | ||
| * // The browser platform with a compiler | ||
| * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
| * | ||
| * import { NgModule } from '@angular/core'; | ||
| * | ||
| * // Import the app component | ||
| * import { AppComponent } from './app.component'; | ||
| * | ||
| * // Define the app module | ||
| * _@NgModule({ | ||
| * declarations: [AppComponent], // declare app component | ||
| * imports: [BrowserModule, ScrollViewModule], // import ScrollView module | ||
| * bootstrap: [AppComponent] | ||
| * }) | ||
| * export class AppModule {} | ||
| * | ||
| * // Compile and launch the module | ||
| * platformBrowserDynamic().bootstrapModule(AppModule); | ||
| * | ||
| * ``` | ||
| */ | ||
| class ScrollViewModule { | ||
| } | ||
| ScrollViewModule.decorators = [ | ||
| { type: NgModule, args: [{ | ||
| declarations: [DECLARATIONS], | ||
| exports: [EXPORTS], | ||
| imports: [CommonModule, DraggableModule] | ||
| },] }, | ||
| ]; | ||
| /** | ||
| * Generated bundle index. Do not edit. | ||
| */ | ||
| export { ScrollViewComponent, ScrollViewModule, ScrollViewPagerComponent }; |
| System.register("@progress/kendo-angular-scrollview",["tslib","@angular/core","@progress/kendo-angular-common","@angular/common","@angular/animations","@progress/kendo-angular-l10n"],function(r){var o,s,l,d,p,c;function e(t){return t.__useDefault?t.default:t}return{setters:[function(t){o=e(t)},function(t){s=e(t)},function(t){l=e(t)},function(t){d=e(t)},function(t){p=e(t)},function(t){c=e(t)}],execute:function(){function i(t){if(a[t])return a[t].exports;var e=a[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}var n,a;a={},i.m=n=[function(t,e){t.exports=s},function(t,e){t.exports=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),a=n(0),o=n(0),r=(s.prototype.itemClass=function(t){return{"k-primary":t===this.activeIndex}},s.prototype.indexChange=function(t){this.pagerIndexChange.emit(t)},i.__decorate([a.Input(),i.__metadata("design:type",Number)],s.prototype,"activeIndex",void 0),i.__decorate([a.Input(),i.__metadata("design:type",Array)],s.prototype,"data",void 0),i.__decorate([a.Output(),i.__metadata("design:type",o.EventEmitter)],s.prototype,"pagerIndexChange",void 0),i.__decorate([a.Component({selector:"kendo-scrollview-pager",template:'\n <ul class="k-scrollview-pageable">\n <li class="k-button" *ngFor="let item of data; let i = index"\n [ngClass]="itemClass(i)"\n (click)="indexChange(i)">\n </li>\n </ul>\n '})],s));function s(){this.pagerIndexChange=new o.EventEmitter}e.ScrollViewPagerComponent=r},function(t,e){t.exports=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=n(0),a=n(10),r=n(9),s=n(3),l=n(8),d=n(7),p=(Object.defineProperty(c.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(t){this.index=this._activeIndex=t},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"widgetClass",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"scrollViewClass",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"hostWidth",{get:function(){return this.width},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"hostHeight",{get:function(){return this.height},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"tabIndex",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"ariaLive",{get:function(){return"assertive"},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"dir",{get:function(){return this.direction},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"direction",{get:function(){return this.localization.rtl?"rtl":"ltr"},enumerable:!0,configurable:!0}),c.prototype.keyDown=function(t){t.keyCode===s.Keys.ArrowLeft&&(this.isRTL?this.next():this.prev()),t.keyCode===s.Keys.ArrowRight&&(this.isRTL?this.prev():this.next())},c.prototype.ngOnChanges=function(t){this.activeIndex=Math.max(Math.min(this.activeIndex,this.view.total-1),0)},c.prototype.prev=function(){this.navigate(r.Dir.Prev)},c.prototype.next=function(){this.navigate(r.Dir.Next)},c.prototype.transitionEndHandler=function(t){this.animationState=null,"left"!==t.toState&&"right"!==t.toState||(null!==this.pageIndex&&(this.activeIndex=this.pageIndex,this.pageIndex=null),this.activeIndex=this.index,this.itemChanged.emit({index:this.activeIndex,item:this.view.item(1)}),this.application.tick())},c.prototype.handlePress=function(t){this.initialTouchCoordinate=t.pageX},c.prototype.handleDrag=function(t){var e=this,n=t.pageX-this.initialTouchCoordinate;this.animationState||this.isDragForbidden(n)||!this.draggedInsideBounds(n)||this.ngZone.run(function(){e.transitionStyle={transform:"translateX("+n+"px)"}})},c.prototype.handleRelease=function(t){var e=this,n=t.pageX-this.initialTouchCoordinate;this.isDragForbidden(n)||this.ngZone.run(function(){e.draggedEnoughToNavigate(n)?(e.isRTL?e.changeIndex(n<0?r.Dir.Prev:r.Dir.Next):e.changeIndex(0<n?r.Dir.Prev:r.Dir.Next),e.animate||(e.transitionStyle=null,e.itemChanged.emit({index:e.activeIndex,item:e.view.item(1)}))):0<Math.abs(n)&&(e.animate?e.animationState="center":e.transitionStyle=null)})},c.prototype.pageChange=function(t){this.animationState||this.activeIndex===t||(this.animate?(this.pageIndex=t,this.isRTL?this.animationState=this.pageIndex>this.index?"right":"left":this.animationState=this.pageIndex>this.index?"left":"right"):this.activeIndex=t)},c.prototype.inlineStyles=function(t){return{height:this.height,transform:this.transforms[t],width:this.width}},c.prototype.displayLeftArrow=function(){var t;return t=this.isRTL?this.activeIndex+1<this.view.total:0<this.activeIndex,(this.endless||t)&&0<this.view.total},c.prototype.leftArrowClick=function(){this.isRTL?this.next():this.prev()},c.prototype.displayRightArrow=function(){var t;return t=this.isRTL?0<this.activeIndex:this.activeIndex+1<this.view.total,(this.endless||t)&&0<this.view.total},c.prototype.rightArrowClick=function(){this.isRTL?this.prev():this.next()},c.prototype.draggedInsideBounds=function(t){return Math.abs(t)<=this.element.nativeElement.offsetWidth},c.prototype.draggedEnoughToNavigate=function(t){return Math.abs(t)>this.element.nativeElement.offsetWidth/2},c.prototype.isDragForbidden=function(t){var e,n;return e=this.isRTL?t<0&&0!==t:0<t&&0!==t,n=0===this.activeIndex&&e||this.activeIndex===this.view.total-1&&!e,!this.endless&&n},c.prototype.navigate=function(t){this.isDataSourceEmpty||this.animationState||(this.changeIndex(t),this.animate||this.itemChanged.emit({index:this.activeIndex,item:this.view.item(1)}))},c.prototype.changeIndex=function(t){t===r.Dir.Next&&this.view.canMoveNext()?(this.index=(this.index+1)%this.view.total,this.animate?this.animationState=this.isRTL?"right":"left":this.activeIndex=this.index):t===r.Dir.Prev&&this.view.canMovePrev()&&(this.index=0===this.index?this.view.total-1:this.index-1,this.animate?this.animationState=this.isRTL?"left":"right":this.activeIndex=this.index)},Object.defineProperty(c.prototype,"isRTL",{get:function(){return"rtl"===this.direction},enumerable:!0,configurable:!0}),i.__decorate([o.Input(),i.__metadata("design:type",Array)],c.prototype,"data",void 0),i.__decorate([o.Input(),i.__metadata("design:type",Number),i.__metadata("design:paramtypes",[Number])],c.prototype,"activeIndex",null),i.__decorate([o.Input(),i.__metadata("design:type",String)],c.prototype,"width",void 0),i.__decorate([o.Input(),i.__metadata("design:type",String)],c.prototype,"height",void 0),i.__decorate([o.Input(),i.__metadata("design:type",Boolean)],c.prototype,"endless",void 0),i.__decorate([o.Input(),i.__metadata("design:type",Boolean)],c.prototype,"animate",void 0),i.__decorate([o.Input(),i.__metadata("design:type",Boolean)],c.prototype,"pageable",void 0),i.__decorate([o.Input(),i.__metadata("design:type",Boolean)],c.prototype,"arrows",void 0),i.__decorate([o.Output(),i.__metadata("design:type",o.EventEmitter)],c.prototype,"itemChanged",void 0),i.__decorate([o.ContentChild(o.TemplateRef),i.__metadata("design:type",o.TemplateRef)],c.prototype,"itemTemplateRef",void 0),i.__decorate([o.HostBinding("class.k-widget"),i.__metadata("design:type",Boolean),i.__metadata("design:paramtypes",[])],c.prototype,"widgetClass",null),i.__decorate([o.HostBinding("class.k-scrollview-wrap"),i.__metadata("design:type",Boolean),i.__metadata("design:paramtypes",[])],c.prototype,"scrollViewClass",null),i.__decorate([o.HostBinding("style.width"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],c.prototype,"hostWidth",null),i.__decorate([o.HostBinding("style.height"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],c.prototype,"hostHeight",null),i.__decorate([o.HostBinding("attr.tabindex"),i.__metadata("design:type",Number),i.__metadata("design:paramtypes",[])],c.prototype,"tabIndex",null),i.__decorate([o.HostBinding("attr.aria-live"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],c.prototype,"ariaLive",null),i.__decorate([o.HostBinding("attr.dir"),i.__metadata("design:type",String),i.__metadata("design:paramtypes",[])],c.prototype,"dir",null),i.__decorate([o.HostBinding("style.touch-action"),i.__metadata("design:type",String)],c.prototype,"touchAction",void 0),i.__decorate([o.HostListener("keydown",["$event"]),i.__metadata("design:type",Function),i.__metadata("design:paramtypes",[Object]),i.__metadata("design:returntype",void 0)],c.prototype,"keyDown",null),i.__decorate([o.Component({animations:[a.trigger("animateTo",[a.state("center, left, right",a.style({transform:"translateX(0)"})),a.transition("* => right",[a.animate("300ms ease-out",a.style({transform:"translateX(100%)"}))]),a.transition("* => left",[a.animate("300ms ease-out",a.style({transform:"translateX(-100%)"}))]),a.transition("* => center",[a.animate("300ms ease-out")])])],exportAs:"kendoScrollView",providers:[d.LocalizationService,{provide:d.L10N_PREFIX,useValue:"kendo.scrollview"}],selector:"kendo-scrollview",template:'\n <ul class=\'k-scrollview\'\n [ngStyle]="transitionStyle"\n [@animateTo]="animationState" (@animateTo.done)= "transitionEndHandler($event)"\n kendoDraggable\n (kendoDrag) = "handleDrag($event)" (kendoPress) = "handlePress($event)" (kendoRelease) = "handleRelease($event)">\n <li *ngFor="let item of view;let i=index"\n [ngStyle]="inlineStyles(i)"\n [attr.aria-hidden]="i !== 1">\n <ng-template\n [ngTemplateOutlet]="itemTemplateRef"\n [ngTemplateOutletContext]="{ item: item }">\n </ng-template>\n </li>\n </ul>\n <div class=\'k-scrollview-elements\'\n [ngStyle]="{\'height\': height}"\n *ngIf="!isDataSourceEmpty && (pageable||arrows)">\n <a class="k-scrollview-prev"\n aria-label="previous"\n *ngIf="arrows && displayLeftArrow()"\n (click)="leftArrowClick()">\n <span class="k-icon k-i-arrowhead-w"></span>\n </a>\n <a class="k-scrollview-next"\n aria-label="next"\n *ngIf="arrows && displayRightArrow()"\n (click)="rightArrowClick()">\n <span class="k-icon k-i-arrowhead-e"></span>\n </a>\n <kendo-scrollview-pager *ngIf="pageable"\n (pagerIndexChange)="pageChange($event)"\n [data]="data"\n [activeIndex]="activeIndex">\n </kendo-scrollview-pager>\n </div>\n '}),i.__metadata("design:paramtypes",[o.ElementRef,o.ApplicationRef,d.LocalizationService,o.NgZone])],c));function c(t,e,n,i){var a=this;this.element=t,this.application=e,this.localization=n,this.ngZone=i,this.data=[],this.endless=!1,this.animate=!0,this.pageable=!1,this.arrows=!1,this.itemChanged=new o.EventEmitter,this.touchAction="pan-y pinch-zoom",this.animationState=null,this.transitionStyle={},this.view=new l.DataCollection(function(){return new l.DataResultIterator(a.data,a.activeIndex,a.endless,a.pageIndex,a.isRTL)}),this.isDataSourceEmpty=!1,this._activeIndex=0,this.index=0,this.pageIndex=null,this.transforms=["translateX(-100%)","translateX(0%)","translateX(100%)"]}e.ScrollViewComponent=p},function(t,e){t.exports=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),a=n(0),o=n(5),r=n(4),s=n(2),l=n(3),d=[r.ScrollViewComponent,s.ScrollViewPagerComponent],p=[r.ScrollViewComponent],c=i.__decorate([a.NgModule({declarations:[d],exports:[p],imports:[o.CommonModule,l.DraggableModule]})],u);function u(){}e.ScrollViewModule=c},function(t,e){t.exports=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){if("function"==typeof Symbol&&Symbol.iterator)return Symbol.iterator;for(var t=Object.getOwnPropertyNames(Map.prototype),e=Map.prototype,n=0;n<t.length;++n){var i=t[n];if("entries"!==i&&"size"!==i&&e[i]===e.entries)return i}}(),a={},o=(Object.defineProperty(r.prototype,"data",{get:function(){var t,e=this.total;return t=this.endless?[this.source[(this.index-1+e)%e],this.source[this.index%e],this.source[(this.index+1+e)%e]]:[a].concat(this.source,[a]).slice(this.index,this.index+3),null!==this.pageIndex&&(t[this.pageIndex>this.index?2:0]=this.source[this.pageIndex]),this.rtl?t.reverse():t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"total",{get:function(){return this.source.length},enumerable:!0,configurable:!0}),r.prototype.canMoveNext=function(){return this.endless||this.index<this.total-1},r.prototype.canMovePrev=function(){return this.endless||0<this.index},r.prototype[i]=function(){return this.data[i]()},r);function r(t,e,n,i,a){this.rtl=!1,this.source=t||[],this.index=e||0,this.endless=n,this.pageIndex=i,this.rtl=a}e.DataResultIterator=o;var s=(Object.defineProperty(l.prototype,"length",{get:function(){return this.accessor().data.length},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"total",{get:function(){return this.accessor().total},enumerable:!0,configurable:!0}),l.prototype.item=function(t){return this.accessor().data[t]},l.prototype.canMoveNext=function(){return this.accessor().canMoveNext()},l.prototype.canMovePrev=function(){return this.accessor().canMovePrev()},l.prototype[Symbol.iterator]=function(){return this.accessor()[Symbol.iterator]()},l);function l(t){this.accessor=t}e.DataCollection=s},function(t,e,n){"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),(i=e.Dir||(e.Dir={}))[i.Next=1]="Next",i[i.Prev=-1]="Prev"},function(t,e){t.exports=p},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(4);e.ScrollViewComponent=i.ScrollViewComponent;var a=n(6);e.ScrollViewModule=a.ScrollViewModule;var o=n(2);e.ScrollViewPagerComponent=o.ScrollViewPagerComponent,function(t){for(var e in t)r(e,t[e])}(e)}],i.c=a,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},i.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=11)}}}); |
| { | ||
| "$schema": "./node_modules/@angular-devkit/schematics/collection-schema.json", | ||
| "schematics": { | ||
| "ng-add": { | ||
| "description": "Adds Kendo Angular Package to the application.", | ||
| "factory": "./ngAdd", | ||
| "schema": "./ngAdd/schema.json", | ||
| "hidden": true, | ||
| "private": true | ||
| } | ||
| } | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const schematics_1 = require("@angular-devkit/schematics"); | ||
| function default_1(options) { | ||
| const finalOptions = Object.assign({}, options, { mainNgModule: 'ScrollViewModule', package: 'scrollview' //package name, e.g grid | ||
| }); | ||
| return schematics_1.externalSchematic('@progress/kendo-schematics', 'ng-add', finalOptions); | ||
| } | ||
| exports.default = default_1; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../tooling/schematics/ngAdd/index.ts"],"names":[],"mappings":";;AAAA,2DAKqC;AAErC,mBAAyB,OAAY;IACjC,MAAM,YAAY,qBACX,OAAO,IACV,YAAY,EAAE,kBAAkB,EAChC,OAAO,EAAE,YAAY,CAAC,wBAAwB;OACjD,CAAC;IAEF,OAAO,8BAAiB,CAAC,4BAA4B,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AACnF,CAAC;AARD,4BAQC"} |
| { | ||
| "$schema": "http://json-schema.org/schema", | ||
| "id": "SchematicsKendoAngularScrollView", | ||
| "title": "Kendo Angular ScrollView Options Schema", | ||
| "type": "object", | ||
| "properties": { | ||
| "theme": { | ||
| "enum": [ | ||
| "default", | ||
| "bootstrap", | ||
| "material" | ||
| ], | ||
| "default": "default", | ||
| "description": "The theme to apply" | ||
| }, | ||
| "export": { | ||
| "type": "boolean", | ||
| "default": false, | ||
| "description": "Specifies if declaring module exports the component." | ||
| }, | ||
| "skipInstall": { | ||
| "description": "Skip installing Kendo dependency packages.", | ||
| "type": "boolean", | ||
| "default": false | ||
| } | ||
| }, | ||
| "required": [] | ||
| } |
+1
-1
@@ -6,3 +6,3 @@ { | ||
| "license": "SEE LICENSE in LICENSE.md", | ||
| "version": "3.0.1-dev.201909301308", | ||
| "version": "3.0.1-dev.201910011329", | ||
| "main": "dist/npm/index.js", | ||
@@ -9,0 +9,0 @@ "module": "dist/fesm5/index.js", |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
199223
145.07%50
117.39%3649
79.93%5
150%9
125%