UNPKG

ng-zorro-antd-yj

Version:

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

165 lines 11.5 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import * as tslib_1 from "tslib"; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, TemplateRef, ViewEncapsulation } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; import { InputBoolean, InputNumber } from '../core/util/convert'; var NzSpinComponent = /** @class */ (function () { function NzSpinComponent(cdr) { this.cdr = cdr; this.nzSize = 'default'; this.nzDelay = 0; this.nzSimple = false; this.nzSpinning = true; this.loading = true; this.spinning$ = new BehaviorSubject(this.nzSpinning); this.loading$ = this.spinning$.pipe(debounceTime(this.nzDelay)); } /** * @return {?} */ NzSpinComponent.prototype.subscribeLoading = /** * @return {?} */ function () { var _this = this; this.unsubscribeLoading(); this.loading_ = this.loading$.subscribe((/** * @param {?} data * @return {?} */ function (data) { _this.loading = data; _this.cdr.markForCheck(); })); }; /** * @return {?} */ NzSpinComponent.prototype.unsubscribeLoading = /** * @return {?} */ function () { if (this.loading_) { this.loading_.unsubscribe(); this.loading_ = null; } }; /** * @return {?} */ NzSpinComponent.prototype.ngOnInit = /** * @return {?} */ function () { this.subscribeLoading(); }; /** * @param {?} changes * @return {?} */ NzSpinComponent.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { if (changes.nzSpinning) { if (changes.nzSpinning.isFirstChange()) { this.loading = this.nzSpinning; } this.spinning$.next(this.nzSpinning); } if (changes.nzDelay) { this.loading$ = this.spinning$.pipe(debounceTime(this.nzDelay)); this.subscribeLoading(); } }; /** * @return {?} */ NzSpinComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { this.unsubscribeLoading(); }; NzSpinComponent.decorators = [ { type: Component, args: [{ selector: 'nz-spin', preserveWhitespaces: false, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #defaultIndicatorTemplate>\n <span class=\"ant-spin-dot\" [class.ant-spin-dot-spin]=\"loading\">\n <i></i><i></i><i></i><i></i>\n </span>\n</ng-template>\n<div *ngIf=\"loading\">\n <div class=\"ant-spin\"\n [class.ant-spin-spinning]=\"loading\"\n [class.ant-spin-lg]=\"nzSize === 'large'\"\n [class.ant-spin-sm]=\"nzSize === 'small'\"\n [class.ant-spin-show-text]=\"nzTip\">\n <ng-template [ngTemplateOutlet]=\"nzIndicator || defaultIndicatorTemplate\"></ng-template>\n <div class=\"ant-spin-text\" *ngIf=\"nzTip\">{{ nzTip }}</div>\n </div>\n</div>\n<div *ngIf=\"!nzSimple\"\n class=\"ant-spin-container\"\n [class.ant-spin-blur]=\"loading\">\n <ng-content></ng-content>\n</div>\n", host: { '[class.ant-spin-nested-loading]': '!nzSimple' }, styles: ["\n nz-spin {\n display: block;\n }\n "] }] } ]; /** @nocollapse */ NzSpinComponent.ctorParameters = function () { return [ { type: ChangeDetectorRef } ]; }; NzSpinComponent.propDecorators = { nzIndicator: [{ type: Input }], nzSize: [{ type: Input }], nzTip: [{ type: Input }], nzDelay: [{ type: Input }], nzSimple: [{ type: Input }], nzSpinning: [{ type: Input }] }; tslib_1.__decorate([ InputNumber(), tslib_1.__metadata("design:type", Object) ], NzSpinComponent.prototype, "nzDelay", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzSpinComponent.prototype, "nzSimple", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzSpinComponent.prototype, "nzSpinning", void 0); return NzSpinComponent; }()); export { NzSpinComponent }; if (false) { /** @type {?} */ NzSpinComponent.prototype.nzIndicator; /** @type {?} */ NzSpinComponent.prototype.nzSize; /** @type {?} */ NzSpinComponent.prototype.nzTip; /** @type {?} */ NzSpinComponent.prototype.nzDelay; /** @type {?} */ NzSpinComponent.prototype.nzSimple; /** @type {?} */ NzSpinComponent.prototype.nzSpinning; /** @type {?} */ NzSpinComponent.prototype.loading; /** * @type {?} * @private */ NzSpinComponent.prototype.spinning$; /** * @type {?} * @private */ NzSpinComponent.prototype.loading$; /** * @type {?} * @private */ NzSpinComponent.prototype.loading_; /** * @type {?} * @private */ NzSpinComponent.prototype.cdr; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotc3Bpbi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZy16b3Jyby1hbnRkLXlqLyIsInNvdXJjZXMiOlsic3Bpbi9uei1zcGluLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFDTCx1QkFBdUIsRUFDdkIsaUJBQWlCLEVBQ2pCLFNBQVMsRUFDVCxLQUFLLEVBS0wsV0FBVyxFQUNYLGlCQUFpQixFQUNsQixNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUUsZUFBZSxFQUE0QixNQUFNLE1BQU0sQ0FBQztBQUNqRSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFHOUMsT0FBTyxFQUFFLFlBQVksRUFBRSxXQUFXLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUVqRTtJQTRDRSx5QkFBb0IsR0FBc0I7UUFBdEIsUUFBRyxHQUFILEdBQUcsQ0FBbUI7UUF6QmpDLFdBQU0sR0FBa0IsU0FBUyxDQUFDO1FBRW5CLFlBQU8sR0FBRyxDQUFDLENBQUM7UUFDWCxhQUFRLEdBQUcsS0FBSyxDQUFDO1FBQ2pCLGVBQVUsR0FBRyxJQUFJLENBQUM7UUFDM0MsWUFBTyxHQUFHLElBQUksQ0FBQztRQUNQLGNBQVMsR0FBRyxJQUFJLGVBQWUsQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUM7UUFDakQsYUFBUSxHQUF3QixJQUFJLENBQUMsU0FBUyxDQUFD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