ngx-an-loader
Version:
awesome ngx loader
52 lines (47 loc) • 3.3 kB
JavaScript
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { signal, Injectable, effect, Input, Component } from '@angular/core';
class NgxAnLoaderService {
isVisible = signal(false, ...(ngDevMode ? [{ debugName: "isVisible" }] : []));
show() {
this.isVisible.set(true);
}
hide() {
this.isVisible.set(false);
}
toggle() {
this.isVisible.set(!this.isVisible());
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: NgxAnLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: NgxAnLoaderService, providedIn: "root" });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: NgxAnLoaderService, decorators: [{
type: Injectable,
args: [{
providedIn: "root",
}]
}] });
class NgxAnLoader {
ngxAnLoaderService;
zIndex = 10_000;
isVisible = false;
constructor(ngxAnLoaderService) {
this.ngxAnLoaderService = ngxAnLoaderService;
effect(() => {
this.isVisible = this.ngxAnLoaderService.isVisible();
});
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: NgxAnLoader, deps: [{ token: NgxAnLoaderService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.2", type: NgxAnLoader, isStandalone: true, selector: "ngx-an-loader", inputs: { zIndex: "zIndex" }, ngImport: i0, template: "@if (isVisible) {\n<div class=\"ngx-an-loader-overlay\" [style.z-index]=\"zIndex\">\n <div class=\"ngx-an-loader\"></div>\n</div>\n}\n", styles: [".ngx-an-loader-overlay{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#0006;display:flex;justify-content:center;align-items:center}.ngx-an-loader{width:50px;height:50px;border:6px solid #ccc;border-top-color:#3f51b5;border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: NgxAnLoader, decorators: [{
type: Component,
args: [{ selector: "ngx-an-loader", imports: [CommonModule], standalone: true, template: "@if (isVisible) {\n<div class=\"ngx-an-loader-overlay\" [style.z-index]=\"zIndex\">\n <div class=\"ngx-an-loader\"></div>\n</div>\n}\n", styles: [".ngx-an-loader-overlay{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#0006;display:flex;justify-content:center;align-items:center}.ngx-an-loader{width:50px;height:50px;border:6px solid #ccc;border-top-color:#3f51b5;border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}\n"] }]
}], ctorParameters: () => [{ type: NgxAnLoaderService }], propDecorators: { zIndex: [{
type: Input
}] } });
/**
* Generated bundle index. Do not edit.
*/
export { NgxAnLoader, NgxAnLoaderService };
//# sourceMappingURL=ngx-an-loader.mjs.map