zek 17.3.2 → 17.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/modules/loading/index.mjs +2 -2
- package/esm2022/lib/modules/loading/loading-interceptor.mjs +41 -61
- package/esm2022/lib/modules/loading/loading.mjs +33 -0
- package/esm2022/lib/modules/loading/loading.module.mjs +8 -8
- package/fesm2022/zek.mjs +52 -74
- package/fesm2022/zek.mjs.map +1 -1
- package/lib/modules/loading/index.d.ts +1 -1
- package/lib/modules/loading/loading-interceptor.d.ts +20 -16
- package/lib/modules/loading/{loading.component.d.ts → loading.d.ts} +3 -3
- package/lib/modules/loading/loading.module.d.ts +1 -1
- package/package.json +1 -1
- package/esm2022/lib/modules/loading/loading.component.mjs +0 -35
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './loading.module';
|
|
2
|
-
export * from './loading
|
|
2
|
+
export * from './loading';
|
|
3
3
|
// export * from './loading-interceptor';
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy96ZWsvc3JjL2xpYi9tb2R1bGVzL2xvYWRpbmcvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxrQkFBa0IsQ0FBQztBQUNqQyxjQUFjLFdBQVcsQ0FBQztBQUMxQix5Q0FBeUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xvYWRpbmcubW9kdWxlJztcclxuZXhwb3J0ICogZnJvbSAnLi9sb2FkaW5nJztcclxuLy8gZXhwb3J0ICogZnJvbSAnLi9sb2FkaW5nLWludGVyY2VwdG9yJzsiXX0=
|
|
@@ -1,79 +1,59 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
2
|
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
3
|
-
import {
|
|
3
|
+
import { BehaviorSubject } from 'rxjs';
|
|
4
4
|
import { finalize } from 'rxjs/operators';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
|
-
export class
|
|
6
|
+
export class ZekLoadingService {
|
|
7
7
|
constructor() {
|
|
8
|
-
this.
|
|
9
|
-
this.pendingRequestsStatus = new ReplaySubject(1);
|
|
10
|
-
this.filteredUrlPatterns = [];
|
|
11
|
-
this.filteredMethods = [];
|
|
12
|
-
this.filteredHeaders = [];
|
|
13
|
-
this.forceByPass = false;
|
|
8
|
+
this._pendingRequests = 0;
|
|
14
9
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
10
|
+
start() {
|
|
11
|
+
this._pendingRequests++;
|
|
12
|
+
this._loadingSubject$?.next(true);
|
|
19
13
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
end() {
|
|
15
|
+
this._pendingRequests--;
|
|
16
|
+
if (this._pendingRequests < 0)
|
|
17
|
+
this._pendingRequests = 0;
|
|
18
|
+
if (0 === this._pendingRequests) {
|
|
19
|
+
this._loadingSubject$?.next(false);
|
|
20
|
+
}
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
get onLoading() {
|
|
23
|
+
if (!this._loadingSubject$) {
|
|
24
|
+
this._loadingSubject$ = new BehaviorSubject(false);
|
|
25
|
+
this._onLoadingObservable = this._loadingSubject$.asObservable();
|
|
26
|
+
}
|
|
27
|
+
if (!this._onLoadingObservable)
|
|
28
|
+
throw new Error("_onExecuteObservable is undefined");
|
|
29
|
+
return this._onLoadingObservable;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
32
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingService, providedIn: 'root' }); }
|
|
33
|
+
}
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingService, decorators: [{
|
|
35
|
+
type: Injectable,
|
|
36
|
+
args: [{ providedIn: 'root' }]
|
|
37
|
+
}] });
|
|
38
|
+
export class ZekLoadingInterceptor {
|
|
39
|
+
constructor(_loading) {
|
|
40
|
+
this._loading = _loading;
|
|
35
41
|
}
|
|
36
42
|
intercept(request, next) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
40
|
-
if (1 === this.pendingRequests) {
|
|
41
|
-
this.pendingRequestsStatus.next(true);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return next.handle(request).pipe(
|
|
45
|
-
// map(event => {
|
|
46
|
-
// return event;
|
|
47
|
-
// }),
|
|
48
|
-
// catchError(error => {
|
|
49
|
-
// return throwError(error);
|
|
50
|
-
// }),
|
|
51
|
-
finalize(() => {
|
|
52
|
-
if (!shouldBypass) {
|
|
53
|
-
this.pendingRequests--;
|
|
54
|
-
if (0 === this.pendingRequests) {
|
|
55
|
-
this.pendingRequestsStatus.next(false);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
43
|
+
this._loading.start();
|
|
44
|
+
return next.handle(request).pipe(finalize(() => {
|
|
45
|
+
this._loading.end();
|
|
58
46
|
}));
|
|
59
47
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: LoadingInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
64
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: LoadingInterceptor }); }
|
|
48
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingInterceptor, deps: [{ token: ZekLoadingService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
49
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingInterceptor }); }
|
|
65
50
|
}
|
|
66
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type:
|
|
51
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingInterceptor, decorators: [{
|
|
67
52
|
type: Injectable
|
|
68
|
-
}] });
|
|
69
|
-
|
|
70
|
-
// provide: HTTP_INTERCEPTORS,
|
|
71
|
-
// useClass: LoadingInterceptor,
|
|
72
|
-
// multi: true,
|
|
73
|
-
// };
|
|
74
|
-
export const LoadingInterceptorProvider = [{
|
|
53
|
+
}], ctorParameters: () => [{ type: ZekLoadingService }] });
|
|
54
|
+
export const ZekLoadingInterceptorProvider = [{
|
|
75
55
|
provide: HTTP_INTERCEPTORS,
|
|
76
|
-
|
|
56
|
+
useClass: ZekLoadingInterceptor,
|
|
77
57
|
multi: true
|
|
78
58
|
}];
|
|
79
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
59
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZGluZy1pbnRlcmNlcHRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3play9zcmMvbGliL21vZHVsZXMvbG9hZGluZy9sb2FkaW5nLWludGVyY2VwdG9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lbmQoKTtcclxuICAgICAgICAgICAgfSlcclxuICAgICAgICApO1xyXG4gICAgfVxyXG59XHJcblxyXG5leHBvcnQgY29uc3QgWmVrTG9hZGluZ0ludGVyY2VwdG9yUHJvdmlkZXIgPSBbe1xyXG4gICAgcHJvdmlkZTogSFRUUF9JTlRFUkNFUFRPUlMsXHJcbiAgICB1c2VDbGFzczogWmVrTG9hZGluZ0ludGVyY2VwdG9yLFxyXG4gICAgbXVsdGk6IHRydWVcclxufV07Il19
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import * as i1 from "./loading-interceptor";
|
|
4
|
+
import * as i2 from "@angular/common";
|
|
5
|
+
export class ZekLoading {
|
|
6
|
+
constructor(_loading) {
|
|
7
|
+
this._loading = _loading;
|
|
8
|
+
this.show = false;
|
|
9
|
+
}
|
|
10
|
+
ngOnInit() {
|
|
11
|
+
this.subscription = this._loading.onLoading.subscribe(x => {
|
|
12
|
+
this.show = x;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
ngOnDestroy() {
|
|
16
|
+
this.subscription?.unsubscribe();
|
|
17
|
+
}
|
|
18
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoading, deps: [{ token: i1.ZekLoadingService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
19
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: ZekLoading, selector: "zek-loading", ngImport: i0, template: `
|
|
20
|
+
<div *ngIf="show" id="loading" class="progress">
|
|
21
|
+
<div class="progress-bar progress-bar-striped progress-bar-animated bg-danger" role="progressbar" style="width:100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
|
|
22
|
+
</div>
|
|
23
|
+
`, isInline: true, styles: ["#loading{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:fixed;inset:0;z-index:10000;background-color:#00000080;outline:0;height:3px}#loading>.progress-bar{-webkit-transition:none!important;transition:none!important}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
24
|
+
}
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoading, decorators: [{
|
|
26
|
+
type: Component,
|
|
27
|
+
args: [{ selector: 'zek-loading', template: `
|
|
28
|
+
<div *ngIf="show" id="loading" class="progress">
|
|
29
|
+
<div class="progress-bar progress-bar-striped progress-bar-animated bg-danger" role="progressbar" style="width:100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
|
|
30
|
+
</div>
|
|
31
|
+
`, styles: ["#loading{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:fixed;inset:0;z-index:10000;background-color:#00000080;outline:0;height:3px}#loading>.progress-bar{-webkit-transition:none!important;transition:none!important}\n"] }]
|
|
32
|
+
}], ctorParameters: () => [{ type: i1.ZekLoadingService }] });
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZGluZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3play9zcmMvbGliL21vZHVsZXMvbG9hZGluZy9sb2FkaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQXFCLE1BQU0sZUFBZSxDQUFDOzs7O0FBYTdELE1BQU0sT0FBTyxVQUFVO0lBR25CLFlBQTZCLFFBQTJCO1FBQTNCLGFBQVEsR0FBUixRQUFRLENBQW1CO1FBRnhELFNBQUksR0FBWSxLQUFLLENBQUM7SUFHdEIsQ0FBQztJQ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cIiBhcmlhLXZhbHVlbWluPVwiMFwiIGFyaWEtdmFsdWVtYXg9XCIxMDBcIj48L2Rpdj5cclxuPC9kaXY+XHJcbmBcclxufSlcclxuZXhwb3J0IGNsYXNzIFpla0xvYWRpbmcgaW1wbGVtZW50cyBPbkluaXQsIE9uRGVzdHJveSB7XHJcbiAgICBzaG93OiBib29sZWFuID0gZmFsc2U7XHJcbiAgICBwcml2YXRlIHN1YnNjcmlwdGlvbj86IFN1YnNjcmlwdGlvbjtcclxuICAgIGNvbnN0cnVjdG9yKHByaXZhdGUgcmVhZG9ubHkgX2xvYWRpbmc6IFpla0xvYWRpbmdTZXJ2aWNlKSB7XHJcbiAgICB9XHJcblxyXG4gICAgbmdPbkluaXQoKSB7XHJcbiAgICAgICAgdGhpcy5zdWJzY3JpcHRpb24gPSB0aGlzLl9sb2FkaW5nLm9uTG9hZGluZy5zdWJzY3JpYmUoeCA9PiB7XHJcbiAgICAgICAgICAgIHRoaXMuc2hvdyA9IHhcclxuICAgICAgICB9KTtcclxuICAgIH1cclxuXHJcbiAgICBuZ09uRGVzdHJveSgpIHtcclxuICAgICAgICB0aGlzLnN1YnNjcmlwdGlvbj8udW5zdWJzY3JpYmUoKTtcclxuICAgIH1cclxufSJdfQ==
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import {
|
|
4
|
-
import { ZekLoading } from './loading
|
|
3
|
+
import { ZekLoadingInterceptor, ZekLoadingInterceptorProvider } from './loading-interceptor';
|
|
4
|
+
import { ZekLoading } from './loading';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export class ZekLoadingModule {
|
|
7
7
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
8
8
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingModule, declarations: [ZekLoading], imports: [CommonModule], exports: [ZekLoading] }); }
|
|
9
9
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingModule, providers: [
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
ZekLoadingInterceptor,
|
|
11
|
+
ZekLoadingInterceptorProvider,
|
|
12
12
|
], imports: [CommonModule] }); }
|
|
13
13
|
}
|
|
14
14
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingModule, decorators: [{
|
|
@@ -21,12 +21,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
|
|
|
21
21
|
ZekLoading
|
|
22
22
|
],
|
|
23
23
|
providers: [
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
ZekLoadingInterceptor,
|
|
25
|
+
ZekLoadingInterceptorProvider,
|
|
26
26
|
],
|
|
27
27
|
exports: [
|
|
28
|
-
ZekLoading
|
|
28
|
+
ZekLoading,
|
|
29
29
|
]
|
|
30
30
|
}]
|
|
31
31
|
}] });
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZGluZy5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy96ZWsvc3JjL2xpYi9tb2R1bGVzL2xvYWRpbmcvbG9hZGluZy5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QU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rTG9hZGluZ1xyXG4gICAgXSxcclxuICAgIHByb3ZpZGVyczogW1xyXG4gICAgICAgIFpla0xvYWRpbmdJbnRlcmNlcHRvcixcclxuICAgICAgICBaZWtMb2FkaW5nSW50ZXJjZXB0b3JQcm92aWRlcixcclxuICAgIF0sXHJcbiAgICBleHBvcnRzOiBbXHJcbiAgICAgICAgWmVrTG9hZGluZyxcclxuICAgIF1cclxufSlcclxuZXhwb3J0IGNsYXNzIFpla0xvYWRpbmdNb2R1bGUge1xyXG59XHJcbiJdfQ==
|
package/fesm2022/zek.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, InjectionToken, Inject, Directive, inject, Input, EventEmitter, Output, ViewChild, Pipe, Component, forwardRef, NgModule, HostListener, ViewEncapsulation, ChangeDetectionStrategy, Optional } from '@angular/core';
|
|
3
|
-
import { BehaviorSubject, Subject, catchError, of, firstValueFrom,
|
|
3
|
+
import { BehaviorSubject, Subject, catchError, of, firstValueFrom, timer } from 'rxjs';
|
|
4
4
|
import * as i1 from '@angular/router';
|
|
5
5
|
import { NavigationStart, RouterModule } from '@angular/router';
|
|
6
6
|
import * as i1$1 from '@ngx-translate/core';
|
|
@@ -4723,96 +4723,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
|
|
|
4723
4723
|
type: Output
|
|
4724
4724
|
}] } });
|
|
4725
4725
|
|
|
4726
|
-
class
|
|
4726
|
+
class ZekLoadingService {
|
|
4727
4727
|
constructor() {
|
|
4728
|
-
this.
|
|
4729
|
-
this.pendingRequestsStatus = new ReplaySubject(1);
|
|
4730
|
-
this.filteredUrlPatterns = [];
|
|
4731
|
-
this.filteredMethods = [];
|
|
4732
|
-
this.filteredHeaders = [];
|
|
4733
|
-
this.forceByPass = false;
|
|
4734
|
-
}
|
|
4735
|
-
shouldBypassUrl(url) {
|
|
4736
|
-
return this.filteredUrlPatterns.some(e => {
|
|
4737
|
-
return e.test(url);
|
|
4738
|
-
});
|
|
4728
|
+
this._pendingRequests = 0;
|
|
4739
4729
|
}
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
});
|
|
4730
|
+
start() {
|
|
4731
|
+
this._pendingRequests++;
|
|
4732
|
+
this._loadingSubject$?.next(true);
|
|
4744
4733
|
}
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4734
|
+
end() {
|
|
4735
|
+
this._pendingRequests--;
|
|
4736
|
+
if (this._pendingRequests < 0)
|
|
4737
|
+
this._pendingRequests = 0;
|
|
4738
|
+
if (0 === this._pendingRequests) {
|
|
4739
|
+
this._loadingSubject$?.next(false);
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
get onLoading() {
|
|
4743
|
+
if (!this._loadingSubject$) {
|
|
4744
|
+
this._loadingSubject$ = new BehaviorSubject(false);
|
|
4745
|
+
this._onLoadingObservable = this._loadingSubject$.asObservable();
|
|
4746
|
+
}
|
|
4747
|
+
if (!this._onLoadingObservable)
|
|
4748
|
+
throw new Error("_onExecuteObservable is undefined");
|
|
4749
|
+
return this._onLoadingObservable;
|
|
4749
4750
|
}
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4751
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4752
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingService, providedIn: 'root' }); }
|
|
4753
|
+
}
|
|
4754
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingService, decorators: [{
|
|
4755
|
+
type: Injectable,
|
|
4756
|
+
args: [{ providedIn: 'root' }]
|
|
4757
|
+
}] });
|
|
4758
|
+
class ZekLoadingInterceptor {
|
|
4759
|
+
constructor(_loading) {
|
|
4760
|
+
this._loading = _loading;
|
|
4755
4761
|
}
|
|
4756
4762
|
intercept(request, next) {
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
this.
|
|
4760
|
-
if (1 === this.pendingRequests) {
|
|
4761
|
-
this.pendingRequestsStatus.next(true);
|
|
4762
|
-
}
|
|
4763
|
-
}
|
|
4764
|
-
return next.handle(request).pipe(
|
|
4765
|
-
// map(event => {
|
|
4766
|
-
// return event;
|
|
4767
|
-
// }),
|
|
4768
|
-
// catchError(error => {
|
|
4769
|
-
// return throwError(error);
|
|
4770
|
-
// }),
|
|
4771
|
-
finalize(() => {
|
|
4772
|
-
if (!shouldBypass) {
|
|
4773
|
-
this.pendingRequests--;
|
|
4774
|
-
if (0 === this.pendingRequests) {
|
|
4775
|
-
this.pendingRequestsStatus.next(false);
|
|
4776
|
-
}
|
|
4777
|
-
}
|
|
4763
|
+
this._loading.start();
|
|
4764
|
+
return next.handle(request).pipe(finalize(() => {
|
|
4765
|
+
this._loading.end();
|
|
4778
4766
|
}));
|
|
4779
4767
|
}
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
}
|
|
4783
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: LoadingInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4784
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: LoadingInterceptor }); }
|
|
4768
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingInterceptor, deps: [{ token: ZekLoadingService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4769
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingInterceptor }); }
|
|
4785
4770
|
}
|
|
4786
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type:
|
|
4771
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingInterceptor, decorators: [{
|
|
4787
4772
|
type: Injectable
|
|
4788
|
-
}] });
|
|
4789
|
-
|
|
4790
|
-
// provide: HTTP_INTERCEPTORS,
|
|
4791
|
-
// useClass: LoadingInterceptor,
|
|
4792
|
-
// multi: true,
|
|
4793
|
-
// };
|
|
4794
|
-
const LoadingInterceptorProvider = [{
|
|
4773
|
+
}], ctorParameters: () => [{ type: ZekLoadingService }] });
|
|
4774
|
+
const ZekLoadingInterceptorProvider = [{
|
|
4795
4775
|
provide: HTTP_INTERCEPTORS,
|
|
4796
|
-
|
|
4776
|
+
useClass: ZekLoadingInterceptor,
|
|
4797
4777
|
multi: true
|
|
4798
4778
|
}];
|
|
4799
4779
|
|
|
4800
4780
|
class ZekLoading {
|
|
4801
|
-
constructor(
|
|
4802
|
-
this.
|
|
4781
|
+
constructor(_loading) {
|
|
4782
|
+
this._loading = _loading;
|
|
4803
4783
|
this.show = false;
|
|
4804
4784
|
}
|
|
4805
4785
|
ngOnInit() {
|
|
4806
|
-
this.subscription = this.
|
|
4786
|
+
this.subscription = this._loading.onLoading.subscribe(x => {
|
|
4807
4787
|
this.show = x;
|
|
4808
4788
|
});
|
|
4809
4789
|
}
|
|
4810
4790
|
ngOnDestroy() {
|
|
4811
|
-
|
|
4812
|
-
this.subscription.unsubscribe();
|
|
4813
|
-
}
|
|
4791
|
+
this.subscription?.unsubscribe();
|
|
4814
4792
|
}
|
|
4815
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoading, deps: [{ token:
|
|
4793
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoading, deps: [{ token: ZekLoadingService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4816
4794
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: ZekLoading, selector: "zek-loading", ngImport: i0, template: `
|
|
4817
4795
|
<div *ngIf="show" id="loading" class="progress">
|
|
4818
4796
|
<div class="progress-bar progress-bar-striped progress-bar-animated bg-danger" role="progressbar" style="width:100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
|
|
@@ -4826,14 +4804,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
|
|
|
4826
4804
|
<div class="progress-bar progress-bar-striped progress-bar-animated bg-danger" role="progressbar" style="width:100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
|
|
4827
4805
|
</div>
|
|
4828
4806
|
`, styles: ["#loading{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:fixed;inset:0;z-index:10000;background-color:#00000080;outline:0;height:3px}#loading>.progress-bar{-webkit-transition:none!important;transition:none!important}\n"] }]
|
|
4829
|
-
}], ctorParameters: () => [{ type:
|
|
4807
|
+
}], ctorParameters: () => [{ type: ZekLoadingService }] });
|
|
4830
4808
|
|
|
4831
4809
|
class ZekLoadingModule {
|
|
4832
4810
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
4833
4811
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingModule, declarations: [ZekLoading], imports: [CommonModule], exports: [ZekLoading] }); }
|
|
4834
4812
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingModule, providers: [
|
|
4835
|
-
|
|
4836
|
-
|
|
4813
|
+
ZekLoadingInterceptor,
|
|
4814
|
+
ZekLoadingInterceptorProvider,
|
|
4837
4815
|
], imports: [CommonModule] }); }
|
|
4838
4816
|
}
|
|
4839
4817
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ZekLoadingModule, decorators: [{
|
|
@@ -4846,11 +4824,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
|
|
|
4846
4824
|
ZekLoading
|
|
4847
4825
|
],
|
|
4848
4826
|
providers: [
|
|
4849
|
-
|
|
4850
|
-
|
|
4827
|
+
ZekLoadingInterceptor,
|
|
4828
|
+
ZekLoadingInterceptorProvider,
|
|
4851
4829
|
],
|
|
4852
4830
|
exports: [
|
|
4853
|
-
ZekLoading
|
|
4831
|
+
ZekLoading,
|
|
4854
4832
|
]
|
|
4855
4833
|
}]
|
|
4856
4834
|
}] });
|