UNPKG

bitfront-library

Version:

Angular CLI project with components and classes used by other Angular projects of the BIT foundation.

53 lines 2.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BitLoadingComponent = void 0; var core_1 = require("@angular/core"); var general_utils_service_1 = require("../service/general-utils.service"); var i0 = require("@angular/core"); var i1 = require("../service/general-utils.service"); var i2 = require("@angular/common"); function BitLoadingComponent_img_0_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelement(0, "img", 1); } if (rf & 2) { var ctx_r0 = i0.ɵɵnextContext(); i0.ɵɵproperty("src", ctx_r0.imageSource, i0.ɵɵsanitizeUrl); } } var BitLoadingComponent = /** @class */ (function () { function BitLoadingComponent(generalUtils) { var _this = this; this.inProgressCount = 0; this.subscription = generalUtils.observableLoading.subscribe(function (status) { if (status === "start") _this.inProgressCount++; if (status === "stop") { if (_this.inProgressCount > 0) _this.inProgressCount--; } _this.loading = _this.inProgressCount > 0; }); } BitLoadingComponent.prototype.ngOnDestroy = function () { this.loading = false; if (this.subscription != null) this.subscription.unsubscribe(); }; BitLoadingComponent.ɵfac = function BitLoadingComponent_Factory(t) { return new (t || BitLoadingComponent)(i0.ɵɵdirectiveInject(i1.GeneralUtils)); }; BitLoadingComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BitLoadingComponent, selectors: [["bit-loading"]], inputs: { imageSource: ["source", "imageSource"] }, decls: 1, vars: 1, consts: [["class", "icono-loading", 3, "src", 4, "ngIf"], [1, "icono-loading", 3, "src"]], template: function BitLoadingComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵtemplate(0, BitLoadingComponent_img_0_Template, 1, 1, "img", 0); } if (rf & 2) { i0.ɵɵproperty("ngIf", ctx.loading); } }, directives: [i2.NgIf], encapsulation: 2 }); return BitLoadingComponent; }()); exports.BitLoadingComponent = BitLoadingComponent; (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BitLoadingComponent, [{ type: core_1.Component, args: [{ selector: "bit-loading", template: " <img *ngIf=\"loading\" class=\"icono-loading\" [src]=\"imageSource\" /> " }] }], function () { return [{ type: i1.GeneralUtils }]; }, { imageSource: [{ type: core_1.Input, args: ["source"] }] }); })(); //# sourceMappingURL=bit-loading.component.js.map