@acorex/core 18.5.17 → 18.7.1
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/config/lib/configs.service.mjs +3 -3
- package/esm2022/date-time/lib/calendar.service.mjs +3 -3
- package/esm2022/date-time/lib/datetime.module.mjs +4 -4
- package/esm2022/date-time/lib/datetime.pipe.mjs +3 -3
- package/esm2022/date-time/lib/formatters/datetime-formatter.mjs +3 -3
- package/esm2022/date-time/lib/formatters/time-duration-formatter.mjs +3 -3
- package/esm2022/date-time/lib/formatters/timeleft-formatter.mjs +3 -3
- package/esm2022/events/lib/event.service.mjs +3 -3
- package/esm2022/file/lib/file-size-formatter.mjs +3 -3
- package/esm2022/file/lib/file.module.mjs +4 -4
- package/esm2022/file/lib/file.service.mjs +3 -3
- package/esm2022/format/lib/format.module.mjs +4 -4
- package/esm2022/format/lib/format.pipe.mjs +3 -3
- package/esm2022/format/lib/format.service.mjs +6 -6
- package/esm2022/format/lib/formatters/number-formatter.mjs +3 -3
- package/esm2022/image/lib/image.service.mjs +3 -3
- package/esm2022/network/lib/network.service.mjs +15 -14
- package/esm2022/network/lib/network.types.mjs +2 -1
- package/esm2022/network/lib/upload-task.mjs +54 -21
- package/esm2022/pipes/lib/safe/safe.pipe.mjs +3 -3
- package/esm2022/platform/lib/platform.service.mjs +3 -3
- package/esm2022/storage/cookie-storage.service.mjs +3 -3
- package/esm2022/storage/local-storage.service.mjs +3 -3
- package/esm2022/storage/session-storage.service.mjs +3 -3
- package/esm2022/translation/lib/translation.module.mjs +4 -4
- package/esm2022/translation/lib/translation.service.mjs +3 -3
- package/esm2022/translation/lib/translator.directive.mjs +3 -3
- package/esm2022/translation/lib/translator.pipe.mjs +3 -3
- package/esm2022/utils/lib/auto-unsubscribe.mjs +3 -3
- package/esm2022/validation/lib/rules/between-rule.mjs +3 -3
- package/esm2022/validation/lib/rules/callback-rule.mjs +3 -3
- package/esm2022/validation/lib/rules/equal-rule.mjs +3 -3
- package/esm2022/validation/lib/rules/greater-than.mjs +3 -3
- package/esm2022/validation/lib/rules/length-rule.mjs +3 -3
- package/esm2022/validation/lib/rules/less-than-rule.mjs +3 -3
- package/esm2022/validation/lib/rules/maxlength-rule.mjs +3 -3
- package/esm2022/validation/lib/rules/minlength-rule.mjs +3 -3
- package/esm2022/validation/lib/rules/regex-rule.mjs +3 -3
- package/esm2022/validation/lib/rules/required-rule.mjs +3 -3
- package/esm2022/validation/lib/validation.module.mjs +4 -4
- package/esm2022/validation/lib/validation.service.mjs +6 -6
- package/fesm2022/acorex-core-config.mjs +3 -3
- package/fesm2022/acorex-core-date-time.mjs +19 -19
- package/fesm2022/acorex-core-events.mjs +3 -3
- package/fesm2022/acorex-core-file.mjs +10 -10
- package/fesm2022/acorex-core-format.mjs +16 -16
- package/fesm2022/acorex-core-image.mjs +3 -3
- package/fesm2022/acorex-core-network.mjs +65 -30
- package/fesm2022/acorex-core-network.mjs.map +1 -1
- package/fesm2022/acorex-core-pipes.mjs +3 -3
- package/fesm2022/acorex-core-platform.mjs +3 -3
- package/fesm2022/acorex-core-storage.mjs +9 -9
- package/fesm2022/acorex-core-translation.mjs +13 -13
- package/fesm2022/acorex-core-utils.mjs +3 -3
- package/fesm2022/acorex-core-validation.mjs +40 -40
- package/i18n/en/common.json +181 -0
- package/i18n/fa/common.json +180 -0
- package/network/lib/network.types.d.ts +3 -1
- package/network/lib/upload-task.d.ts +7 -5
- package/package.json +9 -9
@@ -18,19 +18,19 @@ class AXFileSizeFormatter {
|
|
18
18
|
const i = Math.floor(Math.log(size) / Math.log(k));
|
19
19
|
return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
20
20
|
}
|
21
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
22
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
21
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFileSizeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
22
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFileSizeFormatter }); }
|
23
23
|
}
|
24
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFileSizeFormatter, decorators: [{
|
25
25
|
type: Injectable
|
26
26
|
}] });
|
27
27
|
|
28
28
|
class AXFileModule {
|
29
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
30
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0
|
31
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0
|
29
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFileModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
30
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXFileModule, imports: [i1.AXFormatModule] }); }
|
31
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFileModule, providers: [AXFileSizeFormatter], imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })] }); }
|
32
32
|
}
|
33
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
33
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFileModule, decorators: [{
|
34
34
|
type: NgModule,
|
35
35
|
args: [{
|
36
36
|
imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })],
|
@@ -102,10 +102,10 @@ class AXFileService {
|
|
102
102
|
getBase64Size(base64) {
|
103
103
|
return atob(base64.substring(base64.indexOf(',') + 1)).length;
|
104
104
|
}
|
105
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
106
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
105
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFileService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
106
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFileService, providedIn: 'root' }); }
|
107
107
|
}
|
108
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFileService, decorators: [{
|
109
109
|
type: Injectable,
|
110
110
|
args: [{
|
111
111
|
providedIn: 'root',
|
@@ -27,10 +27,10 @@ class AXFormatterRegistryService {
|
|
27
27
|
get formatters() {
|
28
28
|
return this.plugins;
|
29
29
|
}
|
30
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
31
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
30
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatterRegistryService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
31
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatterRegistryService, providedIn: 'root' }); }
|
32
32
|
}
|
33
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
33
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatterRegistryService, decorators: [{
|
34
34
|
type: Injectable,
|
35
35
|
args: [{
|
36
36
|
providedIn: 'root',
|
@@ -68,10 +68,10 @@ class AXFormatService {
|
|
68
68
|
return new AXFormatFluent(this, value);
|
69
69
|
}
|
70
70
|
}
|
71
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
72
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
71
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatService, deps: [{ token: AXFormatterRegistryService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
72
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatService, providedIn: 'root' }); }
|
73
73
|
}
|
74
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
74
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatService, decorators: [{
|
75
75
|
type: Injectable,
|
76
76
|
args: [{ providedIn: 'root' }]
|
77
77
|
}], ctorParameters: () => [{ type: AXFormatterRegistryService }] });
|
@@ -114,10 +114,10 @@ class AXFormatPipe {
|
|
114
114
|
return of(formattedValue);
|
115
115
|
}));
|
116
116
|
}
|
117
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
118
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0
|
117
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
118
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXFormatPipe, name: "format" }); }
|
119
119
|
}
|
120
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatPipe, decorators: [{
|
121
121
|
type: Pipe,
|
122
122
|
args: [{
|
123
123
|
name: 'format',
|
@@ -189,10 +189,10 @@ class AXNumberFormatter {
|
|
189
189
|
this.separatorsCache[locale] = { thousandSeparator, decimalSeparator };
|
190
190
|
return this.separatorsCache[locale];
|
191
191
|
}
|
192
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
193
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
192
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXNumberFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
193
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXNumberFormatter }); }
|
194
194
|
}
|
195
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
195
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXNumberFormatter, decorators: [{
|
196
196
|
type: Injectable
|
197
197
|
}] });
|
198
198
|
|
@@ -254,11 +254,11 @@ class AXFormatModule {
|
|
254
254
|
f();
|
255
255
|
});
|
256
256
|
}
|
257
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
258
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0
|
259
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0
|
257
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatModule, deps: [{ token: 'AXFormatModuleFactory' }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
258
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXFormatModule, declarations: [AXFormatPipe], exports: [AXFormatPipe] }); }
|
259
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatModule }); }
|
260
260
|
}
|
261
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXFormatModule, decorators: [{
|
262
262
|
type: NgModule,
|
263
263
|
args: [{
|
264
264
|
imports: [],
|
@@ -35,10 +35,10 @@ class AXImageService {
|
|
35
35
|
canvas.getContext('2d').drawImage(image, 0, 0, width, height);
|
36
36
|
return new Promise((resolve) => canvas.toBlob(resolve, options.type, options.quality));
|
37
37
|
}
|
38
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
39
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXImageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
39
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXImageService }); }
|
40
40
|
}
|
41
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXImageService, decorators: [{
|
42
42
|
type: Injectable
|
43
43
|
}] });
|
44
44
|
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { Subject, fromEvent, map as map$1, merge, startWith } from 'rxjs';
|
2
|
-
import { takeUntil, map } from 'rxjs/operators';
|
3
1
|
import { HttpEventType, HttpClient, HttpRequest } from '@angular/common/http';
|
2
|
+
import { Subject, BehaviorSubject, fromEvent, map as map$1, merge, startWith } from 'rxjs';
|
3
|
+
import { takeUntil, map } from 'rxjs/operators';
|
4
|
+
import { isBrowser } from '@acorex/core/platform';
|
4
5
|
import * as i0 from '@angular/core';
|
5
6
|
import { inject, signal, Injectable } from '@angular/core';
|
6
|
-
import { isBrowser } from '@acorex/core/platform';
|
7
7
|
|
8
8
|
var AXUploadStatus;
|
9
9
|
(function (AXUploadStatus) {
|
@@ -11,6 +11,7 @@ var AXUploadStatus;
|
|
11
11
|
AXUploadStatus["UploadComplete"] = "Upload complete";
|
12
12
|
AXUploadStatus["StartingUpload"] = "Starting upload";
|
13
13
|
AXUploadStatus["UploadFailed"] = "Upload failed";
|
14
|
+
AXUploadStatus["UploadCanceled"] = "Upload Canceled";
|
14
15
|
})(AXUploadStatus || (AXUploadStatus = {}));
|
15
16
|
var AXDownloadStatus;
|
16
17
|
(function (AXDownloadStatus) {
|
@@ -21,40 +22,60 @@ var AXDownloadStatus;
|
|
21
22
|
})(AXDownloadStatus || (AXDownloadStatus = {}));
|
22
23
|
|
23
24
|
class AXUploadTask {
|
24
|
-
constructor(
|
25
|
-
this.
|
25
|
+
constructor(http, request, totalFileSize) {
|
26
|
+
this.http = http;
|
27
|
+
this.request = request;
|
26
28
|
this.totalFileSize = totalFileSize;
|
27
29
|
this.cancelSignal = new Subject();
|
30
|
+
this.events = new BehaviorSubject({
|
31
|
+
progress: 0,
|
32
|
+
bytesTransferred: 0,
|
33
|
+
totalBytes: this.totalFileSize,
|
34
|
+
status: AXUploadStatus.StartingUpload,
|
35
|
+
});
|
28
36
|
}
|
29
|
-
|
30
|
-
return this.observable.pipe(takeUntil(this.cancelSignal), map(event => this.handleEvent(event)));
|
31
|
-
}
|
32
|
-
handleEvent(event) {
|
37
|
+
handleEvent(event, failedMessage) {
|
33
38
|
switch (event.type) {
|
39
|
+
case HttpEventType.Sent:
|
40
|
+
case HttpEventType.ResponseHeader:
|
41
|
+
return {
|
42
|
+
progress: 0,
|
43
|
+
bytesTransferred: 0,
|
44
|
+
totalBytes: this.totalFileSize,
|
45
|
+
status: AXUploadStatus.StartingUpload,
|
46
|
+
};
|
34
47
|
case HttpEventType.UploadProgress:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
48
|
+
case HttpEventType.DownloadProgress: {
|
49
|
+
const percentDone = Math.round((100 * event.loaded) / (this.totalFileSize || event.total));
|
50
|
+
return {
|
51
|
+
progress: percentDone,
|
52
|
+
bytesTransferred: event.loaded,
|
53
|
+
totalBytes: this.totalFileSize || event.total,
|
54
|
+
status: AXUploadStatus.Uploading,
|
55
|
+
};
|
56
|
+
}
|
44
57
|
case HttpEventType.Response:
|
45
58
|
return {
|
46
59
|
progress: 100,
|
47
60
|
bytesTransferred: this.totalFileSize,
|
48
61
|
totalBytes: this.totalFileSize,
|
49
62
|
status: AXUploadStatus.UploadComplete,
|
50
|
-
result: event.body
|
63
|
+
result: event.body,
|
64
|
+
};
|
65
|
+
case HttpEventType.User:
|
66
|
+
return {
|
67
|
+
progress: 0,
|
68
|
+
bytesTransferred: this.totalFileSize,
|
69
|
+
totalBytes: this.totalFileSize,
|
70
|
+
status: AXUploadStatus.UploadCanceled,
|
51
71
|
};
|
52
72
|
default:
|
53
73
|
return {
|
54
74
|
progress: 0,
|
55
75
|
bytesTransferred: 0,
|
56
|
-
totalBytes:
|
57
|
-
status: AXUploadStatus.
|
76
|
+
totalBytes: this.totalFileSize,
|
77
|
+
status: AXUploadStatus.UploadFailed,
|
78
|
+
message: failedMessage,
|
58
79
|
};
|
59
80
|
}
|
60
81
|
}
|
@@ -62,6 +83,19 @@ class AXUploadTask {
|
|
62
83
|
this.cancelSignal.next();
|
63
84
|
this.cancelSignal.complete();
|
64
85
|
}
|
86
|
+
start() {
|
87
|
+
this.http
|
88
|
+
.request(this.request)
|
89
|
+
.pipe(takeUntil(this.cancelSignal))
|
90
|
+
.subscribe({
|
91
|
+
error: (error) => {
|
92
|
+
this.events.next(this.handleEvent({ type: -1 }, error.statusText));
|
93
|
+
},
|
94
|
+
next: (event) => {
|
95
|
+
this.events.next(this.handleEvent(event));
|
96
|
+
},
|
97
|
+
});
|
98
|
+
}
|
65
99
|
}
|
66
100
|
|
67
101
|
class AXDownloadTask {
|
@@ -116,7 +150,9 @@ class AXNetworkService {
|
|
116
150
|
// Only subscribe to these events if on the browser platform
|
117
151
|
const onlineEvent = fromEvent(window, 'online').pipe(map$1(() => true));
|
118
152
|
const offlineEvent = fromEvent(window, 'offline').pipe(map$1(() => false));
|
119
|
-
merge(onlineEvent, offlineEvent)
|
153
|
+
merge(onlineEvent, offlineEvent)
|
154
|
+
.pipe(startWith(navigator.onLine))
|
155
|
+
.subscribe((c) => {
|
120
156
|
this._status.set(c);
|
121
157
|
});
|
122
158
|
}
|
@@ -134,7 +170,7 @@ class AXNetworkService {
|
|
134
170
|
});
|
135
171
|
request = new HttpRequest('POST', arg1, arg2, {
|
136
172
|
reportProgress: true,
|
137
|
-
responseType: 'json'
|
173
|
+
responseType: 'json',
|
138
174
|
});
|
139
175
|
}
|
140
176
|
else if (arg1 instanceof HttpRequest) {
|
@@ -148,14 +184,13 @@ class AXNetworkService {
|
|
148
184
|
}
|
149
185
|
request = arg1.clone({
|
150
186
|
reportProgress: true,
|
151
|
-
responseType: arg1.responseType || 'json'
|
187
|
+
responseType: arg1.responseType || 'json',
|
152
188
|
});
|
153
189
|
}
|
154
190
|
else {
|
155
|
-
throw new Error(
|
191
|
+
throw new Error('Invalid arguments for upload method.');
|
156
192
|
}
|
157
|
-
|
158
|
-
return new AXUploadTask(events, totalFilesSize);
|
193
|
+
return new AXUploadTask(this.http, request, totalFilesSize);
|
159
194
|
}
|
160
195
|
// Unified method handling both types of inputs
|
161
196
|
download(arg) {
|
@@ -176,10 +211,10 @@ class AXNetworkService {
|
|
176
211
|
const events = this.http.request(request);
|
177
212
|
return new AXDownloadTask(events);
|
178
213
|
}
|
179
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
180
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
214
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXNetworkService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
215
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXNetworkService, providedIn: 'root' }); }
|
181
216
|
}
|
182
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
217
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXNetworkService, decorators: [{
|
183
218
|
type: Injectable,
|
184
219
|
args: [{ providedIn: 'root' }]
|
185
220
|
}], ctorParameters: () => [] });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-network.mjs","sources":["../../../../libs/core/network/src/lib/network.types.ts","../../../../libs/core/network/src/lib/upload-task.ts","../../../../libs/core/network/src/lib/download-task.ts","../../../../libs/core/network/src/lib/network.service.ts","../../../../libs/core/network/src/acorex-core-network.ts"],"sourcesContent":["export enum AXUploadStatus {\n Uploading = \"Uploading...\",\n UploadComplete = \"Upload complete\",\n StartingUpload = \"Starting upload\",\n UploadFailed = \"Upload failed\"\n}\n\nexport type AXUploadResponse<T> = {\n progress: number;\n bytesTransferred: number;\n totalBytes: number;\n status: AXUploadStatus;\n result?: T;\n};\n\nexport enum AXDownloadStatus {\n Downloading = \"Downloading...\",\n DownloadComplete = \"Download complete\",\n StartingDownload = \"Starting download\",\n DownloadFailed = \"Download failed\"\n}\n\nexport type AXDownloadResponse = {\n progress: number;\n bytesReceived: number;\n totalBytes: number;\n status: AXDownloadStatus;\n data?: Blob; // or any appropriate type based on your specific use case\n};\n","import { Observable, Subject } from 'rxjs';\nimport { takeUntil, map } from 'rxjs/operators';\nimport { HttpEvent, HttpEventType } from '@angular/common/http';\nimport { AXUploadResponse, AXUploadStatus } from './network.types'; // Ensure correct import path\n\nexport class AXUploadTask<T> {\n private cancelSignal = new Subject<void>();\n\n constructor(private observable: Observable<HttpEvent<T>>, private totalFileSize: number) { }\n\n get events(): Observable<AXUploadResponse<T>> {\n return this.observable.pipe(\n takeUntil(this.cancelSignal),\n map(event => this.handleEvent(event))\n );\n }\n\n private handleEvent(event: HttpEvent<any>): AXUploadResponse<T> {\n switch (event.type) {\n case HttpEventType.UploadProgress:\n {\n const percentDone = Math.round(100 * event.loaded / (this.totalFileSize || event.total));\n return {\n progress: percentDone,\n bytesTransferred: event.loaded,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.Uploading\n };\n }\n\n case HttpEventType.Response:\n return {\n progress: 100,\n bytesTransferred: this.totalFileSize,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.UploadComplete,\n result: event.body\n };\n\n default:\n return {\n progress: 0,\n bytesTransferred: 0,\n totalBytes: 0,\n status: AXUploadStatus.StartingUpload\n };\n }\n }\n\n cancel() {\n this.cancelSignal.next();\n this.cancelSignal.complete();\n }\n}\n","import { Observable, Subject } from 'rxjs';\nimport { takeUntil, map } from 'rxjs/operators';\nimport { HttpEvent, HttpEventType } from '@angular/common/http';\nimport { AXDownloadResponse, AXDownloadStatus } from './network.types'; // Ensure correct import path\n\nexport class AXDownloadTask {\n private cancelSignal = new Subject<void>();\n\n constructor(private observable: Observable<HttpEvent<any>>) { }\n\n get events(): Observable<AXDownloadResponse> {\n return this.observable.pipe(\n takeUntil(this.cancelSignal),\n map(event => this.handleEvent(event)),\n );\n }\n\n private handleEvent(event: HttpEvent<any>): AXDownloadResponse {\n switch (event.type) {\n case HttpEventType.DownloadProgress:\n {\n const percentDone = Math.round(100 * event.loaded / (event.total ?? event.loaded));\n return {\n progress: percentDone,\n bytesReceived: event.loaded,\n totalBytes: event.total ?? 0,\n status: AXDownloadStatus.Downloading\n };\n }\n\n case HttpEventType.Response:\n return {\n progress: 100,\n bytesReceived: event.body.size,\n totalBytes: event.body.size,\n status: AXDownloadStatus.DownloadComplete,\n data: event.body\n };\n\n default:\n return {\n progress: 0,\n bytesReceived: 0,\n totalBytes: 0,\n status: AXDownloadStatus.StartingDownload\n };\n }\n }\n\n cancel() {\n this.cancelSignal.next();\n this.cancelSignal.complete();\n }\n}\n","import { HttpRequest, HttpClient } from '@angular/common/http';\nimport { inject, Injectable, signal } from '@angular/core';\nimport { AXDownloadTask } from './download-task';\nimport { AXUploadTask } from './upload-task';\nimport { fromEvent, map, merge, startWith } from 'rxjs';\nimport { isBrowser } from '@acorex/core/platform';\n\n\n\n@Injectable({ providedIn: 'root' })\nexport class AXNetworkService {\n\n private http = inject(HttpClient);\n\n private _status = signal<boolean>(true);\n\n public readonly status = this._status.asReadonly();\n\n constructor() {\n if (isBrowser()) {\n // Only subscribe to these events if on the browser platform\n const onlineEvent = fromEvent(window, 'online').pipe(map(() => true));\n const offlineEvent = fromEvent(window, 'offline').pipe(map(() => false));\n\n merge(onlineEvent, offlineEvent).pipe(\n startWith(navigator.onLine)\n ).subscribe(c => {\n this._status.set(c);\n });\n }\n }\n\n // Overload signatures\n upload<T>(url: string, formData: FormData): AXUploadTask<T>;\n upload<T>(request: HttpRequest<any>): AXUploadTask<T>;\n\n // Unified method handling both types of inputs\n upload<T>(arg1: string | HttpRequest<any>, arg2?: FormData): AXUploadTask<T> {\n let request: HttpRequest<any>;\n let totalFilesSize = 0;\n\n if (typeof arg1 === 'string' && arg2 instanceof FormData) {\n // Calculate total file size\n arg2.forEach((value) => {\n if (value instanceof File) {\n totalFilesSize += value.size;\n }\n });\n request = new HttpRequest('POST', arg1, arg2, {\n reportProgress: true,\n responseType: 'json'\n });\n } else if (arg1 instanceof HttpRequest) {\n if (arg1.body instanceof FormData) {\n // Calculate total file size\n arg1.body.forEach((value) => {\n if (value instanceof File) {\n totalFilesSize += value.size;\n }\n });\n }\n request = arg1.clone({\n reportProgress: true,\n responseType: arg1.responseType || 'json'\n });\n } else {\n throw new Error(\"Invalid arguments for upload method.\");\n }\n\n const events = this.http.request<T>(request);\n return new AXUploadTask<T>(events, totalFilesSize);\n }\n\n\n\n // Overload signatures\n download(url: string): AXDownloadTask;\n download(request: HttpRequest<Blob>): AXDownloadTask;\n\n // Unified method handling both types of inputs\n download(arg: string | HttpRequest<Blob>): AXDownloadTask {\n let request: HttpRequest<Blob>;\n\n if (typeof arg === 'string') {\n request = new HttpRequest('GET', arg, {\n reportProgress: true,\n responseType: 'blob',\n });\n } else {\n request = new HttpRequest(arg.method, arg.url, arg.body, {\n ...arg,\n reportProgress: true,\n responseType: 'blob',\n });\n }\n\n const events = this.http.request<Blob>(request);\n return new AXDownloadTask(events);\n }\n\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["map"],"mappings":";;;;;;;IAAY,eAKX;AALD,CAAA,UAAY,cAAc,EAAA;AACtB,IAAA,cAAA,CAAA,WAAA,CAAA,GAAA,cAA0B,CAAA;AAC1B,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC,CAAA;AAClC,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC,CAAA;AAClC,IAAA,cAAA,CAAA,cAAA,CAAA,GAAA,eAA8B,CAAA;AAClC,CAAC,EALW,cAAc,KAAd,cAAc,GAKzB,EAAA,CAAA,CAAA,CAAA;IAUW,iBAKX;AALD,CAA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AAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;;ACTlC;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-core-network.mjs","sources":["../../../../libs/core/network/src/lib/network.types.ts","../../../../libs/core/network/src/lib/upload-task.ts","../../../../libs/core/network/src/lib/download-task.ts","../../../../libs/core/network/src/lib/network.service.ts","../../../../libs/core/network/src/acorex-core-network.ts"],"sourcesContent":["export enum AXUploadStatus {\n Uploading = 'Uploading...',\n UploadComplete = 'Upload complete',\n StartingUpload = 'Starting upload',\n UploadFailed = 'Upload failed',\n UploadCanceled = 'Upload Canceled',\n}\n\nexport type AXUploadResponse<T> = {\n progress: number;\n bytesTransferred: number;\n totalBytes: number;\n status: AXUploadStatus;\n result?: T;\n message?: string;\n};\n\nexport enum AXDownloadStatus {\n Downloading = 'Downloading...',\n DownloadComplete = 'Download complete',\n StartingDownload = 'Starting download',\n DownloadFailed = 'Download failed',\n}\n\nexport type AXDownloadResponse = {\n progress: number;\n bytesReceived: number;\n totalBytes: number;\n status: AXDownloadStatus;\n data?: Blob; // or any appropriate type based on your specific use case\n};\n","import { HttpClient, HttpEvent, HttpEventType, HttpRequest } from '@angular/common/http';\nimport { BehaviorSubject, Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { AXUploadResponse, AXUploadStatus } from './network.types'; // Ensure correct import path\n\nexport class AXUploadTask<T> {\n private cancelSignal = new Subject<void>();\n public events = new BehaviorSubject<AXUploadResponse<T>>({\n progress: 0,\n bytesTransferred: 0,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.StartingUpload,\n });\n\n constructor(\n private http: HttpClient,\n private request: HttpRequest<T>,\n private totalFileSize: number,\n ) {}\n\n private handleEvent(event: HttpEvent<any>, failedMessage?: string): AXUploadResponse<T> {\n switch (event.type) {\n case HttpEventType.Sent:\n case HttpEventType.ResponseHeader:\n return {\n progress: 0,\n bytesTransferred: 0,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.StartingUpload,\n };\n\n case HttpEventType.UploadProgress:\n case HttpEventType.DownloadProgress: {\n const percentDone = Math.round((100 * event.loaded) / (this.totalFileSize || event.total));\n\n return {\n progress: percentDone,\n bytesTransferred: event.loaded,\n totalBytes: this.totalFileSize || event.total,\n status: AXUploadStatus.Uploading,\n };\n }\n\n case HttpEventType.Response:\n return {\n progress: 100,\n bytesTransferred: this.totalFileSize,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.UploadComplete,\n result: event.body,\n };\n\n case HttpEventType.User:\n return {\n progress: 0,\n bytesTransferred: this.totalFileSize,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.UploadCanceled,\n };\n default:\n return {\n progress: 0,\n bytesTransferred: 0,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.UploadFailed,\n message: failedMessage,\n };\n }\n }\n\n cancel() {\n this.cancelSignal.next();\n this.cancelSignal.complete();\n }\n\n start() {\n this.http\n .request(this.request)\n .pipe(takeUntil(this.cancelSignal))\n .subscribe({\n error: (error) => {\n this.events.next(this.handleEvent({ type: -1 } as any, error.statusText));\n },\n next: (event) => {\n this.events.next(this.handleEvent(event));\n },\n });\n }\n}\n","import { Observable, Subject } from 'rxjs';\nimport { takeUntil, map } from 'rxjs/operators';\nimport { HttpEvent, HttpEventType } from '@angular/common/http';\nimport { AXDownloadResponse, AXDownloadStatus } from './network.types'; // Ensure correct import path\n\nexport class AXDownloadTask {\n private cancelSignal = new Subject<void>();\n\n constructor(private observable: Observable<HttpEvent<any>>) { }\n\n get events(): Observable<AXDownloadResponse> {\n return this.observable.pipe(\n takeUntil(this.cancelSignal),\n map(event => this.handleEvent(event)),\n );\n }\n\n private handleEvent(event: HttpEvent<any>): AXDownloadResponse {\n switch (event.type) {\n case HttpEventType.DownloadProgress:\n {\n const percentDone = Math.round(100 * event.loaded / (event.total ?? event.loaded));\n return {\n progress: percentDone,\n bytesReceived: event.loaded,\n totalBytes: event.total ?? 0,\n status: AXDownloadStatus.Downloading\n };\n }\n\n case HttpEventType.Response:\n return {\n progress: 100,\n bytesReceived: event.body.size,\n totalBytes: event.body.size,\n status: AXDownloadStatus.DownloadComplete,\n data: event.body\n };\n\n default:\n return {\n progress: 0,\n bytesReceived: 0,\n totalBytes: 0,\n status: AXDownloadStatus.StartingDownload\n };\n }\n }\n\n cancel() {\n this.cancelSignal.next();\n this.cancelSignal.complete();\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { HttpClient, HttpRequest } from '@angular/common/http';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { fromEvent, map, merge, startWith } from 'rxjs';\nimport { AXDownloadTask } from './download-task';\nimport { AXUploadTask } from './upload-task';\n\n@Injectable({ providedIn: 'root' })\nexport class AXNetworkService {\n private http = inject(HttpClient);\n\n private _status = signal<boolean>(true);\n\n public readonly status = this._status.asReadonly();\n\n constructor() {\n if (isBrowser()) {\n // Only subscribe to these events if on the browser platform\n const onlineEvent = fromEvent(window, 'online').pipe(map(() => true));\n const offlineEvent = fromEvent(window, 'offline').pipe(map(() => false));\n\n merge(onlineEvent, offlineEvent)\n .pipe(startWith(navigator.onLine))\n .subscribe((c) => {\n this._status.set(c);\n });\n }\n }\n\n // Overload signatures\n upload<T>(url: string, formData: FormData): AXUploadTask<T>;\n upload<T>(request: HttpRequest<any>): AXUploadTask<T>;\n\n // Unified method handling both types of inputs\n upload<T>(arg1: string | HttpRequest<any>, arg2?: FormData): AXUploadTask<T> {\n let request: HttpRequest<any>;\n let totalFilesSize = 0;\n\n if (typeof arg1 === 'string' && arg2 instanceof FormData) {\n // Calculate total file size\n arg2.forEach((value) => {\n if (value instanceof File) {\n totalFilesSize += value.size;\n }\n });\n request = new HttpRequest('POST', arg1, arg2, {\n reportProgress: true,\n responseType: 'json',\n });\n } else if (arg1 instanceof HttpRequest) {\n if (arg1.body instanceof FormData) {\n // Calculate total file size\n arg1.body.forEach((value) => {\n if (value instanceof File) {\n totalFilesSize += value.size;\n }\n });\n }\n request = arg1.clone({\n reportProgress: true,\n responseType: arg1.responseType || 'json',\n });\n } else {\n throw new Error('Invalid arguments for upload method.');\n }\n\n return new AXUploadTask<T>(this.http, request, totalFilesSize);\n }\n\n // Overload signatures\n download(url: string): AXDownloadTask;\n download(request: HttpRequest<Blob>): AXDownloadTask;\n\n // Unified method handling both types of inputs\n download(arg: string | HttpRequest<Blob>): AXDownloadTask {\n let request: HttpRequest<Blob>;\n\n if (typeof arg === 'string') {\n request = new HttpRequest('GET', arg, {\n reportProgress: true,\n responseType: 'blob',\n });\n } else {\n request = new HttpRequest(arg.method, arg.url, arg.body, {\n ...arg,\n reportProgress: true,\n responseType: 'blob',\n });\n }\n\n const events = this.http.request<Blob>(request);\n return new AXDownloadTask(events);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["map"],"mappings":";;;;;;;IAAY,eAMX;AAND,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,WAAA,CAAA,GAAA,cAA0B,CAAA;AAC1B,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC,CAAA;AAClC,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC,CAAA;AAClC,IAAA,cAAA,CAAA,cAAA,CAAA,GAAA,eAA8B,CAAA;AAC9B,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC,CAAA;AACpC,CAAC,EANW,cAAc,KAAd,cAAc,GAMzB,EAAA,CAAA,CAAA,CAAA;IAWW,iBAKX;AALD,CAAA,UAAY,gBAAgB,EAAA;AAC1B,IAAA,gBAAA,CAAA,aAAA,CAAA,GAAA,gBAA8B,CAAA;AAC9B,IAAA,gBAAA,CAAA,kBAAA,CAAA,GAAA,mBAAsC,CAAA;AACtC,IAAA,gBAAA,CAAA,kBAAA,CAAA,GAAA,mBAAsC,CAAA;AACtC,IAAA,gBAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC,CAAA;AACpC,CAAC,EALW,gBAAgB,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OAAO,GAAG,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE;AACpC,gBAAA,cAAc,EAAE,IAAI;AACpB,gBAAA,YAAY,EAAE,MAAM;AACrB,aAAA,CAAC,CAAC;SACJ;aAAM;AACL,YAAA,OAAO,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;AACvD,gBAAA,GAAG,GAAG;AACN,gBAAA,cAAc,EAAE,IAAI;AACpB,gBAAA,YAAY,EAAE,MAAM;AACrB,aAAA,CAAC,CAAC;SACJ;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAO,OAAO,CAAC,CAAC;AAChD,QAAA,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;KACnC;8GApFU,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADH,MAAM,EAAA,CAAA,CAAA,EAAA;;2FACnB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;;ACPlC;;AAEG;;;;"}
|
@@ -24,10 +24,10 @@ class AXSafePipe {
|
|
24
24
|
throw new Error(`Invalid safe type specified: ${type}`);
|
25
25
|
}
|
26
26
|
}
|
27
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
28
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0
|
27
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXSafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
28
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXSafePipe, isStandalone: true, name: "safe" }); }
|
29
29
|
}
|
30
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXSafePipe, decorators: [{
|
31
31
|
type: Pipe,
|
32
32
|
args: [{
|
33
33
|
name: 'safe',
|
@@ -215,10 +215,10 @@ class AXPlatform {
|
|
215
215
|
this._setFullHeightRatio();
|
216
216
|
}
|
217
217
|
}
|
218
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
219
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
218
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
219
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPlatform, providedIn: 'root' }); }
|
220
220
|
}
|
221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPlatform, decorators: [{
|
222
222
|
type: Injectable,
|
223
223
|
args: [{
|
224
224
|
providedIn: 'root',
|
@@ -184,10 +184,10 @@ class AXCookieStorageService {
|
|
184
184
|
}
|
185
185
|
}
|
186
186
|
}
|
187
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
188
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
187
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCookieStorageService, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
188
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCookieStorageService }); }
|
189
189
|
}
|
190
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
190
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXCookieStorageService, decorators: [{
|
191
191
|
type: Injectable
|
192
192
|
}], ctorParameters: () => [{ type: Document, decorators: [{
|
193
193
|
type: Inject,
|
@@ -242,10 +242,10 @@ class AXLocalStorageService {
|
|
242
242
|
return null;
|
243
243
|
}
|
244
244
|
}
|
245
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
246
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
245
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXLocalStorageService, deps: [{ token: AX_LOCALSTORAGE_SECRET_KEY }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
246
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXLocalStorageService }); }
|
247
247
|
}
|
248
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXLocalStorageService, decorators: [{
|
249
249
|
type: Injectable
|
250
250
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
251
251
|
type: Inject,
|
@@ -277,10 +277,10 @@ class AXSessionStorageService {
|
|
277
277
|
return sessionStorage.removeItem(key);
|
278
278
|
}
|
279
279
|
}
|
280
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
281
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
280
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXSessionStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
281
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXSessionStorageService }); }
|
282
282
|
}
|
283
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXSessionStorageService, decorators: [{
|
284
284
|
type: Injectable
|
285
285
|
}] });
|
286
286
|
|
@@ -208,10 +208,10 @@ class AXTranslationService {
|
|
208
208
|
// Perform parameter replacement
|
209
209
|
return this.getTranslation((translation || key), lang, scope, options?.params);
|
210
210
|
}
|
211
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
212
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
211
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
212
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, providedIn: 'root' }); }
|
213
213
|
}
|
214
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
214
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, decorators: [{
|
215
215
|
type: Injectable,
|
216
216
|
args: [{ providedIn: 'root' }]
|
217
217
|
}], ctorParameters: () => [] });
|
@@ -238,10 +238,10 @@ class AXTranslatorDirective {
|
|
238
238
|
},
|
239
239
|
});
|
240
240
|
}
|
241
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
242
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0
|
241
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslatorDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: AXTranslationService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
242
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.0", type: AXTranslatorDirective, selector: "[translate]", ngImport: i0 }); }
|
243
243
|
}
|
244
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
244
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslatorDirective, decorators: [{
|
245
245
|
type: Directive,
|
246
246
|
args: [{
|
247
247
|
selector: '[translate]',
|
@@ -258,10 +258,10 @@ class AXTranslatorPipe {
|
|
258
258
|
}
|
259
259
|
return this.service.translate(key, options);
|
260
260
|
}
|
261
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
262
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0
|
261
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslatorPipe, deps: [{ token: AXTranslationService }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
262
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXTranslatorPipe, name: "translate" }); }
|
263
263
|
}
|
264
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
264
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslatorPipe, decorators: [{
|
265
265
|
type: Pipe,
|
266
266
|
args: [{ name: 'translate', pure: true }]
|
267
267
|
}], ctorParameters: () => [{ type: AXTranslationService }] });
|
@@ -272,9 +272,9 @@ function initializeApp(translatorService, config) {
|
|
272
272
|
};
|
273
273
|
}
|
274
274
|
class AXTranslationModule {
|
275
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
276
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0
|
277
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0
|
275
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
276
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe, AXTranslatorDirective], exports: [AXTranslatorPipe, AXTranslatorDirective] }); }
|
277
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationModule, providers: [
|
278
278
|
{
|
279
279
|
provide: APP_INITIALIZER,
|
280
280
|
useFactory: initializeApp,
|
@@ -283,7 +283,7 @@ class AXTranslationModule {
|
|
283
283
|
},
|
284
284
|
] }); }
|
285
285
|
}
|
286
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationModule, decorators: [{
|
287
287
|
type: NgModule,
|
288
288
|
args: [{
|
289
289
|
imports: [],
|
@@ -31,10 +31,10 @@ class AXUnsubscriber {
|
|
31
31
|
ngOnDestroy() {
|
32
32
|
this.unsubscribe();
|
33
33
|
}
|
34
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0
|
35
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0
|
34
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXUnsubscriber, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
35
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXUnsubscriber }); }
|
36
36
|
}
|
37
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0
|
37
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXUnsubscriber, decorators: [{
|
38
38
|
type: Injectable
|
39
39
|
}] });
|
40
40
|
|