UNPKG

ng-zorro-antd-yj

Version:

An enterprise-class UI components based on Ant Design and Angular

518 lines 42 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import * as tslib_1 from "tslib"; import { LEFT_ARROW, RIGHT_ARROW } from '@angular/cdk/keycodes'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, ElementRef, EventEmitter, Input, NgZone, Output, QueryList, Renderer2, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core'; import { fromEvent, Subscription } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; import { InputBoolean, InputNumber } from '../core/util/convert'; import { NzCarouselContentDirective } from './nz-carousel-content.directive'; var NzCarouselComponent = /** @class */ (function () { function NzCarouselComponent(elementRef, renderer, cdr, ngZone) { this.elementRef = elementRef; this.renderer = renderer; this.cdr = cdr; this.ngZone = ngZone; this.nzTransitionSpeed = 500; // Not exposed. this.nzEffect = 'scrollx'; this.nzEnableSwipe = true; this.nzDots = true; this.nzVertical = false; this.nzAutoPlay = false; this.nzAutoPlaySpeed = 3000; // Should be nzAutoPlayDuration, but changing this is breaking. // Should be nzAutoPlayDuration, but changing this is breaking. this.nzAfterChange = new EventEmitter(); this.nzBeforeChange = new EventEmitter(); this.activeIndex = 0; this.transform = 'translate3d(0px, 0px, 0px)'; this.el = this.elementRef.nativeElement; this.subs_ = new Subscription(); renderer.addClass(elementRef.nativeElement, 'ant-carousel'); } Object.defineProperty(NzCarouselComponent.prototype, "nextIndex", { get: /** * @return {?} */ function () { return this.activeIndex < this.slideContents.length - 1 ? this.activeIndex + 1 : 0; }, enumerable: true, configurable: true }); Object.defineProperty(NzCarouselComponent.prototype, "prevIndex", { get: /** * @return {?} */ function () { return this.activeIndex > 0 ? this.activeIndex - 1 : this.slideContents.length - 1; }, enumerable: true, configurable: true }); /** * @return {?} */ NzCarouselComponent.prototype.ngAfterContentInit = /** * @return {?} */ function () { if (this.slideContents && this.slideContents.length) { this.slideContents.first.isActive = true; } }; /** * @return {?} */ NzCarouselComponent.prototype.ngAfterViewInit = /** * @return {?} */ function () { var _this = this; // Re-render when content changes. this.subs_.add(this.slideContents.changes.subscribe((/** * @return {?} */ function () { _this.renderContent(); }))); this.ngZone.runOutsideAngular((/** * @return {?} */ function () { _this.subs_.add(fromEvent(window, 'resize') .pipe(debounceTime(50)) .subscribe((/** * @return {?} */ function () { _this.renderContent(); _this.setTransition(); }))); })); // When used in modals (drawers maybe too), it should render itself asynchronously. // Refer to https://github.com/NG-ZORRO/ng-zorro-antd/issues/2387 Promise.resolve().then((/** * @return {?} */ function () { _this.renderContent(); })); }; /** * @param {?} changes * @return {?} */ NzCarouselComponent.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { if (changes.nzAutoPlay || changes.nzAutoPlaySpeed) { this.setUpNextScroll(); } if (changes.nzEffect) { this.updateMode(); } }; /** * @return {?} */ NzCarouselComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { this.subs_.unsubscribe(); this.clearTimeout(); }; /** * @param {?} index * @return {?} */ NzCarouselComponent.prototype.setContentActive = /** * @param {?} index * @return {?} */ function (index) { var _this = this; if (this.slideContents && this.slideContents.length) { this.nzBeforeChange.emit({ from: this.slideContents.toArray().findIndex((/** * @param {?} slide * @return {?} */ function (slide) { return slide.isActive; })), to: index }); this.activeIndex = index; this.setTransition(); this.slideContents.forEach((/** * @param {?} slide * @param {?} i * @return {?} */ function (slide, i) { return (slide.isActive = index === i); })); this.setUpNextScroll(); this.cdr.markForCheck(); // Should trigger the following when animation is done. The transition takes 0.5 seconds according to the CSS. setTimeout((/** * @return {?} */ function () { return _this.nzAfterChange.emit(index); }), this.nzTransitionSpeed); } }; /** * @private * @return {?} */ NzCarouselComponent.prototype.setTransition = /** * @private * @return {?} */ function () { this.transform = this.nzEffect === 'fade' ? 'translate3d(0px, 0px, 0px)' : this.nzVertical ? // `Scrollx` mode. "translate3d(0px, " + -this.activeIndex * this.el.offsetHeight + "px, 0px)" : "translate3d(" + -this.activeIndex * this.el.offsetWidth + "px, 0px, 0px)"; if (this.slickTrack) { this.renderer.setStyle(this.slickTrack.nativeElement, 'transform', this.transform); } }; /** * @return {?} */ NzCarouselComponent.prototype.next = /** * @return {?} */ function () { this.setContentActive(this.nextIndex); }; /** * @return {?} */ NzCarouselComponent.prototype.pre = /** * @return {?} */ function () { this.setContentActive(this.prevIndex); }; /** * @param {?} index * @return {?} */ NzCarouselComponent.prototype.goTo = /** * @param {?} index * @return {?} */ function (index) { if (index >= 0 && index <= this.slideContents.length - 1) { this.setContentActive(index); } }; /** * @param {?} e * @return {?} */ NzCarouselComponent.prototype.onKeyDown = /** * @param {?} e * @return {?} */ function (e) { if (e.keyCode === LEFT_ARROW) { // Left this.pre(); e.preventDefault(); } else if (e.keyCode === RIGHT_ARROW) { // Right this.next(); e.preventDefault(); } }; /** * @param {?=} action * @return {?} */ NzCarouselComponent.prototype.swipe = /** * @param {?=} action * @return {?} */ function (action) { if (action === void 0) { action = 'swipeleft'; } if (!this.nzEnableSwipe) { return; } if (action === 'swipeleft') { this.next(); } if (action === 'swiperight') { this.pre(); } }; /* tslint:disable-next-line:no-any */ /* tslint:disable-next-line:no-any */ /** * @param {?} e * @return {?} */ NzCarouselComponent.prototype.swipeInProgress = /* tslint:disable-next-line:no-any */ /** * @param {?} e * @return {?} */ function (e) { if (this.nzEffect === 'scrollx') { /** @type {?} */ var final = e.isFinal; /** @type {?} */ var scrollWidth = final ? 0 : e.deltaX * 1.2; /** @type {?} */ var totalWidth = this.el.offsetWidth; if (this.nzVertical) { /** @type {?} */ var totalHeight = this.el.offsetHeight; /** @type {?} */ var scrollPercent = scrollWidth / totalWidth; /** @type {?} */ var scrollHeight = scrollPercent * totalHeight; this.transform = "translate3d(0px, " + (-this.activeIndex * totalHeight + scrollHeight) + "px, 0px)"; } else { this.transform = "translate3d(" + (-this.activeIndex * totalWidth + scrollWidth) + "px, 0px, 0px)"; } if (this.slickTrack) { this.renderer.setStyle(this.slickTrack.nativeElement, 'transform', this.transform); } } if (e.isFinal) { this.setUpNextScroll(); } else { this.clearTimeout(); } }; /** * @return {?} */ NzCarouselComponent.prototype.clearTimeout = /** * @return {?} */ function () { if (this.transitionAction) { clearTimeout(this.transitionAction); this.transitionAction = null; } }; /** * Make a carousel scroll to `this.nextIndex` after `this.nzAutoPlaySpeed` milliseconds. */ /** * Make a carousel scroll to `this.nextIndex` after `this.nzAutoPlaySpeed` milliseconds. * @private * @return {?} */ NzCarouselComponent.prototype.setUpNextScroll = /** * Make a carousel scroll to `this.nextIndex` after `this.nzAutoPlaySpeed` milliseconds. * @private * @return {?} */ function () { var _this = this; this.clearTimeout(); if (this.nzAutoPlay && this.nzAutoPlaySpeed > 0) { this.transitionAction = setTimeout((/** * @return {?} */ function () { _this.setContentActive(_this.nextIndex); }), this.nzAutoPlaySpeed); } }; /** * @private * @return {?} */ NzCarouselComponent.prototype.updateMode = /** * @private * @return {?} */ function () { if (this.slideContents && this.slideContents.length) { this.renderContent(); this.setContentActive(0); } }; /** * @private * @return {?} */ NzCarouselComponent.prototype.renderContent = /** * @private * @return {?} */ function () { var _this = this; /** @type {?} */ var slickTrackElement = this.slickTrack.nativeElement; /** @type {?} */ var slickListElement = this.slickList.nativeElement; if (this.slideContents && this.slideContents.length) { this.slideContents.forEach((/** * @param {?} content * @param {?} i * @return {?} */ function (content, i) { content.width = _this.el.offsetWidth; if (_this.nzEffect === 'fade') { content.fadeMode = true; if (_this.nzVertical) { content.top = -i * _this.el.offsetHeight; } else { content.left = -i * content.width; } } else { content.fadeMode = false; content.left = null; content.top = null; } })); if (this.nzVertical) { this.renderer.removeStyle(slickTrackElement, 'width'); this.renderer.removeStyle(slickListElement, 'width'); this.renderer.setStyle(slickListElement, 'height', this.slideContents.first.el.offsetHeight + "px"); this.renderer.setStyle(slickTrackElement, 'height', this.slideContents.length * this.el.offsetHeight + "px"); } else { this.renderer.removeStyle(slickTrackElement, 'height'); this.renderer.removeStyle(slickListElement, 'height'); this.renderer.removeStyle(slickTrackElement, 'width'); // This is necessary to prevent carousel items to overflow. this.renderer.setStyle(slickTrackElement, 'width', this.slideContents.length * this.el.offsetWidth + "px"); } this.setUpNextScroll(); this.cdr.markForCheck(); } }; NzCarouselComponent.decorators = [ { type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: 'nz-carousel', preserveWhitespaces: false, template: "<div class=\"slick-initialized slick-slider\" [class.slick-vertical]=\"nzVertical\">\n <div\n class=\"slick-list\"\n #slickList\n tabindex=\"-1\"\n (keydown)=\"onKeyDown($event)\"\n (swipeleft)=\"swipe('swipeleft')\"\n (swiperight)=\"swipe('swiperight')\"\n (pan)=\"swipeInProgress($event);\">\n <div class=\"slick-track\" #slickTrack>\n <ng-content></ng-content>\n </div>\n </div>\n <ul class=\"slick-dots\" *ngIf=\"nzDots\">\n <li *ngFor=\"let content of slideContents; let i = index\" [class.slick-active]=\"content.isActive\" (click)=\"goTo(i)\">\n <ng-template [ngTemplateOutlet]=\"nzDotRender || renderDotTemplate\" [ngTemplateOutletContext]=\"{ $implicit: i }\"></ng-template>\n </li>\n </ul>\n</div>\n\n<ng-template #renderDotTemplate let-index>\n <button>{{index + 1}}</button>\n</ng-template>\n", host: { '[class.ant-carousel-vertical]': 'nzVertical' }, styles: ["\n nz-carousel {\n display: block;\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n }\n\n .slick-dots {\n display: block;\n }\n\n .slick-track {\n opacity: 1;\n transition: all 0.5s ease;\n }\n\n .slick-slide {\n transition: opacity 500ms ease;\n }\n "] }] } ]; /** @nocollapse */ NzCarouselComponent.ctorParameters = function () { return [ { type: ElementRef }, { type: Renderer2 }, { type: ChangeDetectorRef }, { type: NgZone } ]; }; NzCarouselComponent.propDecorators = { slideContents: [{ type: ContentChildren, args: [NzCarouselContentDirective,] }], slickList: [{ type: ViewChild, args: ['slickList',] }], slickTrack: [{ type: ViewChild, args: ['slickTrack',] }], nzTransitionSpeed: [{ type: Input }], nzDotRender: [{ type: Input }], nzEffect: [{ type: Input }], nzEnableSwipe: [{ type: Input }], nzDots: [{ type: Input }], nzVertical: [{ type: Input }], nzAutoPlay: [{ type: Input }], nzAutoPlaySpeed: [{ type: Input }], nzAfterChange: [{ type: Output }], nzBeforeChange: [{ type: Output }] }; tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzCarouselComponent.prototype, "nzEnableSwipe", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Boolean) ], NzCarouselComponent.prototype, "nzDots", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Boolean) ], NzCarouselComponent.prototype, "nzVertical", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzCarouselComponent.prototype, "nzAutoPlay", void 0); tslib_1.__decorate([ InputNumber(), tslib_1.__metadata("design:type", Object) ], NzCarouselComponent.prototype, "nzAutoPlaySpeed", void 0); return NzCarouselComponent; }()); export { NzCarouselComponent }; if (false) { /** @type {?} */ NzCarouselComponent.prototype.slideContents; /** @type {?} */ NzCarouselComponent.prototype.slickList; /** @type {?} */ NzCarouselComponent.prototype.slickTrack; /** @type {?} */ NzCarouselComponent.prototype.nzTransitionSpeed; /** @type {?} */ NzCarouselComponent.prototype.nzDotRender; /** @type {?} */ NzCarouselComponent.prototype.nzEffect; /** @type {?} */ NzCarouselComponent.prototype.nzEnableSwipe; /** @type {?} */ NzCarouselComponent.prototype.nzDots; /** @type {?} */ NzCarouselComponent.prototype.nzVertical; /** @type {?} */ NzCarouselComponent.prototype.nzAutoPlay; /** @type {?} */ NzCarouselComponent.prototype.nzAutoPlaySpeed; /** @type {?} */ NzCarouselComponent.prototype.nzAfterChange; /** @type {?} */ NzCarouselComponent.prototype.nzBeforeChange; /** @type {?} */ NzCarouselComponent.prototype.activeIndex; /** @type {?} */ NzCarouselComponent.prototype.transform; /** @type {?} */ NzCarouselComponent.prototype.transitionAction; /** * @type {?} * @private */ NzCarouselComponent.prototype.el; /** * @type {?} * @private */ NzCarouselComponent.prototype.subs_; /** @type {?} */ NzCarouselComponent.prototype.elementRef; /** * @type {?} * @private */ NzCarouselComponent.prototype.renderer; /** * @type {?} * @private */ NzCarouselComponent.prototype.cdr; /** * @type {?} * @private */ NzCarouselComponent.prototype.ngZone; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotY2Fyb3VzZWwuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImNhcm91c2VsL256LWNhcm91c2VsLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsV0FBVyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDaEUsT0FBTyxFQUdMLHVCQUF1QixFQUN2QixpQkFBaUIsRUFDakIsU0FBUyxFQUNULGVBQWUsRUFDZixVQUFVLEVBQ1YsWUFBWSxFQUNaLEtBQUssRUFDTCxNQUFNLEVBR04sTUFBTSxFQUNOLFNBQVMsRUFDVCxTQUFTLEVBRVQsV0FBVyxFQUNYLFNBQVMsRUFDVCxpQkFBaUIsRUFDbEIsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFFLFNBQVMsRUFBRSxZQUFZLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFDL0MsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQzlDLE9BQU8sRUFBRSxZQUFZLEVBQUUsV0FBVyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDakUsT0FBTyxFQUFFLDBCQUEwQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFNN0U7SUFrRUUsNkJBQ1MsVUFBc0IsRUFDckIsUUFBbUIsRUFDbkIsR0FBc0IsR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