UNPKG

ng-zorro-antd-yj

Version:

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

170 lines 14.6 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, ElementRef, Input, QueryList, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { reverseChildNodes } from '../core/util/dom'; import { NzTimelineItemComponent } from './nz-timeline-item.component'; var NzTimelineComponent = /** @class */ (function () { function NzTimelineComponent(cdr) { this.cdr = cdr; this.nzReverse = false; this.isPendingBoolean = false; this.destroy$ = new Subject(); } /** * @param {?} changes * @return {?} */ NzTimelineComponent.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { /** @type {?} */ var modeChanges = changes.nzMode; /** @type {?} */ var reverseChanges = changes.nzReverse; /** @type {?} */ var pendingChanges = changes.nzPending; if (modeChanges && (modeChanges.previousValue !== modeChanges.currentValue || modeChanges.isFirstChange())) { this.updateChildren(); } if (reverseChanges && reverseChanges.previousValue !== reverseChanges.currentValue && !reverseChanges.isFirstChange()) { this.reverseChildTimelineDots(); } if (pendingChanges) { this.isPendingBoolean = pendingChanges.currentValue === true; } }; /** * @return {?} */ NzTimelineComponent.prototype.ngAfterContentInit = /** * @return {?} */ function () { var _this = this; this.updateChildren(); if (this.listOfTimeLine) { this.listOfTimeLine.changes.pipe(takeUntil(this.destroy$)).subscribe((/** * @return {?} */ function () { _this.updateChildren(); })); } }; /** * @return {?} */ NzTimelineComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { this.destroy$.next(); this.destroy$.complete(); }; /** * @private * @return {?} */ NzTimelineComponent.prototype.updateChildren = /** * @private * @return {?} */ function () { var _this = this; if (this.listOfTimeLine && this.listOfTimeLine.length) { /** @type {?} */ var length_1 = this.listOfTimeLine.length; this.listOfTimeLine.toArray().forEach((/** * @param {?} item * @param {?} index * @return {?} */ function (item, index) { item.isLast = !_this.nzReverse ? index === length_1 - 1 : index === 0; item.position = _this.nzMode === 'left' || !_this.nzMode ? undefined : _this.nzMode === 'right' ? 'right' : _this.nzMode === 'alternate' && index % 2 === 0 ? 'left' : 'right'; item.detectChanges(); })); this.cdr.markForCheck(); } }; /** * @private * @return {?} */ NzTimelineComponent.prototype.reverseChildTimelineDots = /** * @private * @return {?} */ function () { reverseChildNodes((/** @type {?} */ (this.timeline.nativeElement))); this.updateChildren(); }; NzTimelineComponent.decorators = [ { type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, selector: 'nz-timeline', template: "<ul\n class=\"ant-timeline\"\n [class.ant-timeline-right]=\"nzMode === 'right'\"\n [class.ant-timeline-alternate]=\"nzMode === 'alternate'\"\n [class.ant-timeline-pending]=\"!!nzPending\"\n [class.ant-timeline-reverse]=\"nzReverse\"\n #timeline>\n <!-- User inserted timeline dots. -->\n <ng-content></ng-content>\n <!-- Pending dot. -->\n <li *ngIf=\"nzPending\" class=\"ant-timeline-item ant-timeline-item-pending\">\n <div class=\"ant-timeline-item-tail\"></div>\n <div class=\"ant-timeline-item-head ant-timeline-item-head-custom ant-timeline-item-head-blue\">\n <ng-container *nzStringTemplateOutlet=\"nzPendingDot\">\n {{ nzPendingDot }}<i *ngIf=\"!nzPendingDot\" nz-icon type=\"loading\"></i>\n </ng-container>\n </div>\n <div class=\"ant-timeline-item-content\">\n <ng-container *nzStringTemplateOutlet=\"nzPending\">\n {{ isPendingBoolean ? '' : nzPending }}\n </ng-container>\n </div>\n </li>\n</ul>\n" }] } ]; /** @nocollapse */ NzTimelineComponent.ctorParameters = function () { return [ { type: ChangeDetectorRef } ]; }; NzTimelineComponent.propDecorators = { timeline: [{ type: ViewChild, args: ['timeline',] }], listOfTimeLine: [{ type: ContentChildren, args: [NzTimelineItemComponent,] }], _pendingContent: [{ type: ContentChild, args: ['pending',] }], nzMode: [{ type: Input }], nzPending: [{ type: Input }], nzPendingDot: [{ type: Input }], nzReverse: [{ type: Input }] }; return NzTimelineComponent; }()); export { NzTimelineComponent }; if (false) { /** @type {?} */ NzTimelineComponent.prototype.timeline; /** @type {?} */ NzTimelineComponent.prototype.listOfTimeLine; /** @type {?} */ NzTimelineComponent.prototype._pendingContent; /** @type {?} */ NzTimelineComponent.prototype.nzMode; /** @type {?} */ NzTimelineComponent.prototype.nzPending; /** @type {?} */ NzTimelineComponent.prototype.nzPendingDot; /** @type {?} */ NzTimelineComponent.prototype.nzReverse; /** @type {?} */ NzTimelineComponent.prototype.isPendingBoolean; /** * @type {?} * @private */ NzTimelineComponent.prototype.destroy$; /** * @type {?} * @private */ NzTimelineComponent.prototype.cdr; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotdGltZWxpbmUuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbInRpbWVsaW5lL256LXRpbWVsaW5lLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsT0FBTyxFQUVMLHVCQUF1QixFQUN2QixpQkFBaUIsRUFDakIsU0FBUyxFQUNULFlBQVksRUFDWixlQUFlLEVBQ2YsVUFBVSxFQUNWLEtBQUssRUFHTCxTQUFTLEVBRVQsV0FBVyxFQUNYLFNBQVMsRUFDVCxpQkFBaUIsRUFDbEIsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUMvQixPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFM0MsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDckQsT0FBTyxFQUFFLHVCQUF1QixFQUFFLE1BQU0sOEJBQ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