@acorex/core 7.0.41 → 7.1.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/config/index.d.ts +5 -5
- package/config/public-api.d.ts +1 -1
- package/config/src/configs.d.ts +9 -9
- package/dateTime/index.d.ts +5 -5
- package/dateTime/public-api.d.ts +5 -5
- package/dateTime/src/datetime.class.d.ts +100 -100
- package/dateTime/src/datetime.module.d.ts +8 -8
- package/dateTime/src/datetime.pipe.d.ts +8 -8
- package/dateTime/src/georgian.calendar.d.ts +20 -20
- package/dateTime/src/jalali.calendar.d.ts +35 -35
- package/{esm2020 → esm2022}/acorex-core.mjs +4 -4
- package/{esm2020 → esm2022}/config/acorex-core-config.mjs +4 -4
- package/{esm2020 → esm2022}/config/public-api.mjs +1 -1
- package/esm2022/config/src/configs.mjs +25 -0
- package/{esm2020 → esm2022}/dateTime/acorex-core-dateTime.mjs +4 -4
- package/{esm2020 → esm2022}/dateTime/public-api.mjs +5 -5
- package/esm2022/dateTime/src/datetime.class.mjs +295 -0
- package/esm2022/dateTime/src/datetime.module.mjs +40 -0
- package/esm2022/dateTime/src/datetime.pipe.mjs +27 -0
- package/esm2022/dateTime/src/georgian.calendar.mjs +187 -0
- package/esm2022/dateTime/src/jalali.calendar.mjs +357 -0
- package/{esm2020 → esm2022}/events/acorex-core-events.mjs +4 -4
- package/{esm2020 → esm2022}/events/public-api.mjs +1 -1
- package/esm2022/events/src/event.service.mjs +35 -0
- package/{esm2020 → esm2022}/file/acorex-core-file.mjs +4 -4
- package/{esm2020 → esm2022}/file/public-api.mjs +4 -4
- package/esm2022/file/src/file-download-ref.class.mjs +13 -0
- package/esm2022/file/src/file-download-result.class.mjs +47 -0
- package/esm2022/file/src/file-upload-ref.class.mjs +13 -0
- package/esm2022/file/src/file.service.mjs +103 -0
- package/{esm2020 → esm2022}/http/acorex-core-http.mjs +4 -4
- package/{esm2020 → esm2022}/http/public-api.mjs +5 -5
- package/{esm2020 → esm2022}/http/src/http-error.class.mjs +1 -1
- package/{esm2020 → esm2022}/http/src/http-events.interceptor.mjs +2 -2
- package/{esm2020 → esm2022}/http/src/http-request.class.mjs +1 -1
- package/esm2022/http/src/http-result.class.mjs +25 -0
- package/esm2022/http/src/http.module.mjs +30 -0
- package/esm2022/http/src/http.service.mjs +152 -0
- package/{esm2020 → esm2022}/image/acorex-core-image.mjs +4 -4
- package/{esm2020 → esm2022}/image/public-api.mjs +1 -1
- package/esm2022/image/src/image.service.mjs +44 -0
- package/{esm2020 → esm2022}/pipes/acorex-core-pipes.mjs +4 -4
- package/{esm2020 → esm2022}/pipes/public-api.mjs +2 -2
- package/esm2022/pipes/src/pipes.module.mjs +20 -0
- package/{esm2020 → esm2022}/pipes/src/safe.pipe.mjs +32 -30
- package/{esm2020 → esm2022}/platform/acorex-core-platform.mjs +4 -4
- package/{esm2020 → esm2022}/platform/public-api.mjs +1 -1
- package/esm2022/platform/src/platform.service.mjs +152 -0
- package/{esm2020 → esm2022}/public-api.mjs +4 -4
- package/{esm2020 → esm2022}/translation/acorex-core-translation.mjs +4 -4
- package/{esm2020 → esm2022}/translation/public-api.mjs +3 -3
- package/esm2022/translation/src/translation.module.mjs +19 -0
- package/esm2022/translation/src/translator.mjs +44 -0
- package/esm2022/translation/src/translator.pipe.mjs +16 -0
- package/{esm2020 → esm2022}/utils/acorex-core-utils.mjs +4 -4
- package/{esm2020 → esm2022}/utils/public-api.mjs +5 -5
- package/{esm2020 → esm2022}/utils/src/color-util.mjs +114 -114
- package/{esm2020 → esm2022}/utils/src/drawing-util.mjs +29 -29
- package/{esm2020 → esm2022}/utils/src/html-util.mjs +15 -15
- package/{esm2020 → esm2022}/utils/src/object-util.mjs +38 -38
- package/{esm2020 → esm2022}/utils/src/string-util.mjs +18 -18
- package/events/index.d.ts +5 -5
- package/events/public-api.d.ts +1 -1
- package/events/src/event.service.d.ts +9 -9
- package/{fesm2015 → fesm2022}/acorex-core-config.mjs +23 -24
- package/{fesm2015 → fesm2022}/acorex-core-config.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/acorex-core-dateTime.mjs +882 -880
- package/{fesm2020 → fesm2022}/acorex-core-dateTime.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/acorex-core-events.mjs +32 -35
- package/fesm2022/acorex-core-events.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/acorex-core-file.mjs +162 -159
- package/{fesm2020 → fesm2022}/acorex-core-file.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/acorex-core-http.mjs +190 -184
- package/{fesm2020 → fesm2022}/acorex-core-http.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/acorex-core-image.mjs +41 -42
- package/{fesm2020 → fesm2022}/acorex-core-image.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/acorex-core-pipes.mjs +41 -41
- package/fesm2022/acorex-core-pipes.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/acorex-core-platform.mjs +147 -154
- package/fesm2022/acorex-core-platform.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/acorex-core-translation.mjs +64 -65
- package/{fesm2020 → fesm2022}/acorex-core-translation.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/acorex-core-utils.mjs +209 -210
- package/{fesm2015 → fesm2022}/acorex-core.mjs +5 -6
- package/file/index.d.ts +5 -5
- package/file/public-api.d.ts +4 -4
- package/file/src/file-download-ref.class.d.ts +6 -6
- package/file/src/file-download-result.class.d.ts +8 -8
- package/file/src/file-upload-ref.class.d.ts +5 -5
- package/file/src/file.service.d.ts +18 -18
- package/http/index.d.ts +5 -5
- package/http/public-api.d.ts +5 -5
- package/http/src/http-error.class.d.ts +7 -7
- package/http/src/http-events.interceptor.d.ts +10 -10
- package/http/src/http-request.class.d.ts +14 -14
- package/http/src/http-result.class.d.ts +11 -11
- package/http/src/http.module.d.ts +8 -8
- package/http/src/http.service.d.ts +23 -23
- package/image/index.d.ts +5 -5
- package/image/public-api.d.ts +1 -1
- package/image/src/image.service.d.ts +12 -12
- package/index.d.ts +5 -5
- package/package.json +39 -65
- package/pipes/index.d.ts +5 -5
- package/pipes/public-api.d.ts +2 -2
- package/pipes/src/pipes.module.d.ts +8 -8
- package/pipes/src/safe.pipe.d.ts +10 -10
- package/platform/index.d.ts +5 -5
- package/platform/public-api.d.ts +1 -1
- package/platform/src/platform.service.d.ts +26 -26
- package/public-api.d.ts +1 -1
- package/translation/index.d.ts +5 -5
- package/translation/public-api.d.ts +3 -3
- package/translation/src/translation.module.d.ts +7 -7
- package/translation/src/translator.d.ts +11 -11
- package/translation/src/translator.pipe.d.ts +7 -7
- package/utils/index.d.ts +5 -5
- package/utils/public-api.d.ts +5 -5
- package/utils/src/color-util.d.ts +23 -23
- package/utils/src/drawing-util.d.ts +18 -18
- package/utils/src/html-util.d.ts +4 -4
- package/utils/src/object-util.d.ts +4 -4
- package/utils/src/string-util.d.ts +6 -6
- package/esm2020/config/src/configs.mjs +0 -24
- package/esm2020/dateTime/src/datetime.class.mjs +0 -288
- package/esm2020/dateTime/src/datetime.module.mjs +0 -39
- package/esm2020/dateTime/src/datetime.pipe.mjs +0 -26
- package/esm2020/dateTime/src/georgian.calendar.mjs +0 -189
- package/esm2020/dateTime/src/jalali.calendar.mjs +0 -359
- package/esm2020/events/src/event.service.mjs +0 -36
- package/esm2020/file/src/file-download-ref.class.mjs +0 -12
- package/esm2020/file/src/file-download-result.class.mjs +0 -46
- package/esm2020/file/src/file-upload-ref.class.mjs +0 -12
- package/esm2020/file/src/file.service.mjs +0 -101
- package/esm2020/http/src/http-result.class.mjs +0 -21
- package/esm2020/http/src/http.module.mjs +0 -29
- package/esm2020/http/src/http.service.mjs +0 -148
- package/esm2020/image/src/image.service.mjs +0 -43
- package/esm2020/pipes/src/pipes.module.mjs +0 -19
- package/esm2020/platform/src/platform.service.mjs +0 -157
- package/esm2020/translation/src/translation.module.mjs +0 -18
- package/esm2020/translation/src/translator.mjs +0 -43
- package/esm2020/translation/src/translator.pipe.mjs +0 -15
- package/fesm2015/acorex-core-dateTime.mjs.map +0 -1
- package/fesm2015/acorex-core-events.mjs +0 -44
- package/fesm2015/acorex-core-events.mjs.map +0 -1
- package/fesm2015/acorex-core-file.mjs +0 -176
- package/fesm2015/acorex-core-file.mjs.map +0 -1
- package/fesm2015/acorex-core-http.mjs +0 -203
- package/fesm2015/acorex-core-http.mjs.map +0 -1
- package/fesm2015/acorex-core-image.mjs +0 -54
- package/fesm2015/acorex-core-image.mjs.map +0 -1
- package/fesm2015/acorex-core-pipes.mjs.map +0 -1
- package/fesm2015/acorex-core-platform.mjs +0 -165
- package/fesm2015/acorex-core-platform.mjs.map +0 -1
- package/fesm2015/acorex-core-translation.mjs +0 -81
- package/fesm2015/acorex-core-translation.mjs.map +0 -1
- package/fesm2015/acorex-core-utils.mjs +0 -227
- package/fesm2020/acorex-core-config.mjs +0 -32
- package/fesm2020/acorex-core-config.mjs.map +0 -1
- package/fesm2020/acorex-core-dateTime.mjs +0 -899
- package/fesm2020/acorex-core-events.mjs.map +0 -1
- package/fesm2020/acorex-core-pipes.mjs +0 -54
- package/fesm2020/acorex-core-pipes.mjs.map +0 -1
- package/fesm2020/acorex-core-platform.mjs.map +0 -1
- package/fesm2020/acorex-core-utils.mjs.map +0 -1
- package/fesm2020/acorex-core.mjs +0 -12
- package/fesm2020/acorex-core.mjs.map +0 -1
- /package/{fesm2015 → fesm2022}/acorex-core-utils.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/acorex-core.mjs.map +0 -0
@@ -3,52 +3,52 @@ import { Pipe, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/platform-browser';
|
4
4
|
import { CommonModule } from '@angular/common';
|
5
5
|
|
6
|
-
class AXSafePipe {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
case '
|
16
|
-
case '
|
17
|
-
case '
|
18
|
-
case '
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
6
|
+
class AXSafePipe {
|
7
|
+
sanitizer;
|
8
|
+
constructor(sanitizer) {
|
9
|
+
this.sanitizer = sanitizer;
|
10
|
+
}
|
11
|
+
transform(value, type) {
|
12
|
+
if (value == null || value == undefined || value == '')
|
13
|
+
return '';
|
14
|
+
switch (type) {
|
15
|
+
case 'html': return this.sanitizer.bypassSecurityTrustHtml(value);
|
16
|
+
case 'style': return this.sanitizer.bypassSecurityTrustStyle(value);
|
17
|
+
case 'script': return this.sanitizer.bypassSecurityTrustScript(value);
|
18
|
+
case 'url': return this.sanitizer.bypassSecurityTrustUrl(value);
|
19
|
+
case 'resourceUrl': return this.sanitizer.bypassSecurityTrustResourceUrl(value);
|
20
|
+
default: throw new Error(`Invalid safe type specified: ${type}`);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXSafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
|
24
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.0.0", ngImport: i0, type: AXSafePipe, name: "safe" });
|
25
|
+
}
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXSafePipe, decorators: [{
|
27
|
+
type: Pipe,
|
28
|
+
args: [{
|
29
|
+
name: 'safe',
|
30
|
+
pure: true
|
31
|
+
}]
|
31
32
|
}], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; } });
|
32
33
|
|
33
|
-
class AXPipesModule {
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
39
|
-
type: NgModule,
|
40
|
-
args: [{
|
41
|
-
declarations: [AXSafePipe],
|
42
|
-
imports: [CommonModule],
|
43
|
-
exports: [AXSafePipe],
|
44
|
-
providers: [],
|
45
|
-
}]
|
34
|
+
class AXPipesModule {
|
35
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
36
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0", ngImport: i0, type: AXPipesModule, declarations: [AXSafePipe], imports: [CommonModule], exports: [AXSafePipe] });
|
37
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXPipesModule, imports: [CommonModule] });
|
38
|
+
}
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXPipesModule, decorators: [{
|
40
|
+
type: NgModule,
|
41
|
+
args: [{
|
42
|
+
declarations: [AXSafePipe],
|
43
|
+
imports: [CommonModule],
|
44
|
+
exports: [AXSafePipe],
|
45
|
+
providers: [],
|
46
|
+
}]
|
46
47
|
}] });
|
47
48
|
|
48
|
-
/**
|
49
|
-
* Generated bundle index. Do not edit.
|
49
|
+
/**
|
50
|
+
* Generated bundle index. Do not edit.
|
50
51
|
*/
|
51
52
|
|
52
53
|
export { AXPipesModule, AXSafePipe };
|
53
54
|
//# sourceMappingURL=acorex-core-pipes.mjs.map
|
54
|
-
//# sourceMappingURL=acorex-core-pipes.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"acorex-core-pipes.mjs","sources":["../../../../projects/acorex/core/pipes/src/safe.pipe.ts","../../../../projects/acorex/core/pipes/src/pipes.module.ts","../../../../projects/acorex/core/pipes/acorex-core-pipes.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\r\nimport { DomSanitizer, SafeHtml, SafeStyle, SafeScript, SafeUrl, SafeResourceUrl } from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n\tname: 'safe',\r\n\tpure: true\r\n})\r\nexport class AXSafePipe implements PipeTransform {\r\n\r\n\tconstructor(protected sanitizer: DomSanitizer) { }\r\n\r\n\tpublic transform(value: any, type: string): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl {\r\n\t\tif (value == null || value == undefined || value == '')\r\n\t\t\treturn '';\r\n\t\tswitch (type) {\r\n\t\t\tcase 'html': return this.sanitizer.bypassSecurityTrustHtml(value);\r\n\t\t\tcase 'style': return this.sanitizer.bypassSecurityTrustStyle(value);\r\n\t\t\tcase 'script': return this.sanitizer.bypassSecurityTrustScript(value);\r\n\t\t\tcase 'url': return this.sanitizer.bypassSecurityTrustUrl(value);\r\n\t\t\tcase 'resourceUrl': return this.sanitizer.bypassSecurityTrustResourceUrl(value);\r\n\t\t\tdefault: throw new Error(`Invalid safe type specified: ${type}`);\r\n\t\t}\r\n\t}\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { AXSafePipe } from './safe.pipe';\r\n\r\n@NgModule({\r\n declarations: [AXSafePipe],\r\n imports: [CommonModule],\r\n exports: [AXSafePipe],\r\n providers: [],\r\n})\r\nexport class AXPipesModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAGA,MAIa,UAAU,CAAA;AAEA,IAAA,SAAA,CAAA;AAAtB,IAAA,WAAA,CAAsB,SAAuB,EAAA;QAAvB,IAAS,CAAA,SAAA,GAAT,SAAS,CAAc;KAAK;IAE3C,SAAS,CAAC,KAAU,EAAE,IAAY,EAAA;QACxC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,EAAE;AACrD,YAAA,OAAO,EAAE,CAAC;AACX,QAAA,QAAQ,IAAI;AACX,YAAA,KAAK,MAAM,EAAE,OAAO,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;AAClE,YA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AA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,YAJd,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAIX,aAAa,EAAA,UAAA,EAAA,CAAA;kBANzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,UAAU,CAAC;oBAC1B,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,UAAU,CAAC;AACrB,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA,CAAA;;;ACTD;;AAEG;;;;"}
|
@@ -3,163 +3,156 @@ import { Injectable } from '@angular/core';
|
|
3
3
|
import { Subject, fromEvent } from 'rxjs';
|
4
4
|
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
5
5
|
|
6
|
-
const isChrome = (win) => testUserAgent(win, /Chrome/i);
|
7
|
-
const isFirefox = (win) => testUserAgent(win, /Firefox/i);
|
8
|
-
const isEdge = (win) => testUserAgent(win, /Edge/i);
|
9
|
-
const isSafari = (win) => testUserAgent(win, /Safari/i);
|
10
|
-
const isOpera = (win) => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);
|
11
|
-
const isMSIE = (win) => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);
|
12
|
-
const isMobileWeb = (win) => isMobile(win) && !isHybrid(win);
|
13
|
-
const isIpad = (win) => {
|
14
|
-
// iOS 12 and below
|
15
|
-
if (testUserAgent(win, /iPad/i)) {
|
16
|
-
return true;
|
17
|
-
}
|
18
|
-
// iOS 13+
|
19
|
-
if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
|
20
|
-
return true;
|
21
|
-
}
|
22
|
-
return false;
|
23
|
-
};
|
24
|
-
const isIphone = (win) => testUserAgent(win, /iPhone/i);
|
25
|
-
const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
|
26
|
-
const isAndroid = (win) => testUserAgent(win, /android|sink/i);
|
27
|
-
const isAndroidTablet = (win) => {
|
28
|
-
return isAndroid(win) && !testUserAgent(win, /mobile/i);
|
29
|
-
};
|
30
|
-
const isPhablet = (win) => {
|
31
|
-
const width = win.innerWidth;
|
32
|
-
const height = win.innerHeight;
|
33
|
-
const smallest = Math.min(width, height);
|
34
|
-
const largest = Math.max(width, height);
|
35
|
-
return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;
|
36
|
-
};
|
37
|
-
const isTablet = (win) => {
|
38
|
-
const width = win.innerWidth;
|
39
|
-
const height = win.innerHeight;
|
40
|
-
const smallest = Math.min(width, height);
|
41
|
-
const largest = Math.max(width, height);
|
42
|
-
return
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
const
|
47
|
-
const
|
48
|
-
const
|
49
|
-
const
|
50
|
-
const
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
const
|
56
|
-
const
|
57
|
-
|
58
|
-
const
|
59
|
-
const
|
60
|
-
const
|
61
|
-
const
|
62
|
-
const
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
document.
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: AXPlatform, providedIn: 'root' });
|
152
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: AXPlatform, decorators: [{
|
153
|
-
type: Injectable,
|
154
|
-
args: [{
|
155
|
-
providedIn: 'root',
|
156
|
-
}]
|
6
|
+
const isChrome = (win) => testUserAgent(win, /Chrome/i);
|
7
|
+
const isFirefox = (win) => testUserAgent(win, /Firefox/i);
|
8
|
+
const isEdge = (win) => testUserAgent(win, /Edge/i);
|
9
|
+
const isSafari = (win) => testUserAgent(win, /Safari/i);
|
10
|
+
const isOpera = (win) => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);
|
11
|
+
const isMSIE = (win) => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);
|
12
|
+
const isMobileWeb = (win) => isMobile(win) && !isHybrid(win);
|
13
|
+
const isIpad = (win) => {
|
14
|
+
// iOS 12 and below
|
15
|
+
if (testUserAgent(win, /iPad/i)) {
|
16
|
+
return true;
|
17
|
+
}
|
18
|
+
// iOS 13+
|
19
|
+
if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
return false;
|
23
|
+
};
|
24
|
+
const isIphone = (win) => testUserAgent(win, /iPhone/i);
|
25
|
+
const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
|
26
|
+
const isAndroid = (win) => testUserAgent(win, /android|sink/i);
|
27
|
+
const isAndroidTablet = (win) => {
|
28
|
+
return isAndroid(win) && !testUserAgent(win, /mobile/i);
|
29
|
+
};
|
30
|
+
const isPhablet = (win) => {
|
31
|
+
const width = win.innerWidth;
|
32
|
+
const height = win.innerHeight;
|
33
|
+
const smallest = Math.min(width, height);
|
34
|
+
const largest = Math.max(width, height);
|
35
|
+
return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;
|
36
|
+
};
|
37
|
+
const isTablet = (win) => {
|
38
|
+
const width = win.innerWidth;
|
39
|
+
const height = win.innerHeight;
|
40
|
+
const smallest = Math.min(width, height);
|
41
|
+
const largest = Math.max(width, height);
|
42
|
+
return isIpad(win) || isAndroidTablet(win) || (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400);
|
43
|
+
};
|
44
|
+
const isMobile = (win) => matchMedia(win, '(any-pointer:coarse)');
|
45
|
+
const isTouch = (win) => matchMedia(win, '(any-pointer:coarse)');
|
46
|
+
const isDesktop = (win) => !isMobile(win);
|
47
|
+
const isHybrid = (win) => isCordova(win) || isCapacitorNative(win);
|
48
|
+
const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
|
49
|
+
const isCapacitorNative = (win) => {
|
50
|
+
const capacitor = win['Capacitor'];
|
51
|
+
return !!(capacitor && capacitor.isNative);
|
52
|
+
};
|
53
|
+
const isElectron = (win) => testUserAgent(win, /electron/i);
|
54
|
+
const isPWA = (win) => !!(win.matchMedia('(display-mode: standalone)').matches || win.navigator.standalone);
|
55
|
+
const testUserAgent = (win, expr) => expr.test(win.navigator.userAgent);
|
56
|
+
const matchMedia = (win, query) => win?.matchMedia(query).matches || false;
|
57
|
+
const isSMScreen = (win) => matchMedia(win, '(max-width: 640px)');
|
58
|
+
const isMDScreen = (win) => matchMedia(win, '(max-width: 768px)');
|
59
|
+
const isLGScreen = (win) => matchMedia(win, '(max-width: 1024px)');
|
60
|
+
const isXLScreen = (win) => matchMedia(win, '(max-width: 1280px)');
|
61
|
+
const is2XLScreen = (win) => matchMedia(win, '(max-width: 1536px)');
|
62
|
+
const PLATFORMS_MAP = {
|
63
|
+
Android: isAndroid,
|
64
|
+
iOS: isIOS,
|
65
|
+
Desktop: isDesktop,
|
66
|
+
Mobile: isMobile,
|
67
|
+
Touch: isTouch,
|
68
|
+
Chrome: isChrome,
|
69
|
+
Firefox: isFirefox,
|
70
|
+
Safari: isSafari,
|
71
|
+
Edge: isEdge,
|
72
|
+
Opera: isOpera,
|
73
|
+
Hybrid: isHybrid,
|
74
|
+
PWA: isPWA,
|
75
|
+
Electron: isElectron,
|
76
|
+
SM: isSMScreen,
|
77
|
+
MD: isMDScreen,
|
78
|
+
LG: isLGScreen,
|
79
|
+
XL: isXLScreen,
|
80
|
+
'2XL': is2XLScreen,
|
81
|
+
};
|
82
|
+
class AXPlatformEvent {
|
83
|
+
nativeEvent;
|
84
|
+
source;
|
85
|
+
}
|
86
|
+
class AXPlatform {
|
87
|
+
resize = new Subject();
|
88
|
+
click = new Subject();
|
89
|
+
scroll = new Subject();
|
90
|
+
isRtl() {
|
91
|
+
return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';
|
92
|
+
}
|
93
|
+
isLandscape() {
|
94
|
+
return window.innerHeight < window.innerWidth;
|
95
|
+
}
|
96
|
+
isPortrate() {
|
97
|
+
return !this.isLandscape();
|
98
|
+
}
|
99
|
+
is(name) {
|
100
|
+
return PLATFORMS_MAP[name](window) || false;
|
101
|
+
}
|
102
|
+
switchDarkMode() {
|
103
|
+
const _html = document.getElementsByTagName('html')[0];
|
104
|
+
_html.classList.add('ax-dark');
|
105
|
+
}
|
106
|
+
switchLightMode() {
|
107
|
+
const _html = document.getElementsByTagName('html')[0];
|
108
|
+
_html.classList.remove('ax-dark');
|
109
|
+
}
|
110
|
+
_setFullHeightRatio() {
|
111
|
+
try {
|
112
|
+
document.querySelector(':root')?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
|
113
|
+
}
|
114
|
+
catch (error) { }
|
115
|
+
}
|
116
|
+
constructor() {
|
117
|
+
fromEvent(window, 'resize')
|
118
|
+
.pipe(debounceTime(100))
|
119
|
+
.pipe(distinctUntilChanged())
|
120
|
+
.subscribe(e => {
|
121
|
+
this.resize.next({
|
122
|
+
nativeEvent: e,
|
123
|
+
source: this,
|
124
|
+
});
|
125
|
+
//
|
126
|
+
this._setFullHeightRatio();
|
127
|
+
});
|
128
|
+
document.addEventListener('click', e => {
|
129
|
+
this.click.next({
|
130
|
+
nativeEvent: e,
|
131
|
+
source: this,
|
132
|
+
});
|
133
|
+
}, true);
|
134
|
+
document.addEventListener('scroll', e => {
|
135
|
+
this.scroll.next({
|
136
|
+
nativeEvent: e,
|
137
|
+
source: this,
|
138
|
+
});
|
139
|
+
}, true);
|
140
|
+
// init functions
|
141
|
+
this._setFullHeightRatio();
|
142
|
+
}
|
143
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
144
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXPlatform, providedIn: 'root' });
|
145
|
+
}
|
146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXPlatform, decorators: [{
|
147
|
+
type: Injectable,
|
148
|
+
args: [{
|
149
|
+
providedIn: 'root',
|
150
|
+
}]
|
157
151
|
}], ctorParameters: function () { return []; } });
|
158
152
|
|
159
|
-
/**
|
160
|
-
* Generated bundle index. Do not edit.
|
153
|
+
/**
|
154
|
+
* Generated bundle index. Do not edit.
|
161
155
|
*/
|
162
156
|
|
163
157
|
export { AXPlatform, AXPlatformEvent, testUserAgent };
|
164
158
|
//# sourceMappingURL=acorex-core-platform.mjs.map
|
165
|
-
//# sourceMappingURL=acorex-core-platform.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"acorex-core-platform.mjs","sources":["../../../../projects/acorex/core/platform/src/platform.service.ts","../../../../projects/acorex/core/platform/acorex-core-platform.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\nimport { fromEvent, Subject } from 'rxjs';\r\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\r\n\r\nexport type AXPlatforms = 'Android' | 'Desktop' | 'iOS' | 'Mobile';\r\nexport type AXBrowsers = 'Chrome' | 'Safari' | 'Edge' | 'Firefox' | 'Opera' | 'MSIE';\r\nexport type AXTechnologies = 'PWA' | 'Hybrid' | 'Electron';\r\n\r\nexport type AXScreenSizes = 'SM' | 'MD' | 'LG' | 'XL' | '2XL';\r\n\r\nconst isChrome = (win: Window): boolean => testUserAgent(win, /Chrome/i);\r\n\r\nconst isFirefox = (win: Window): boolean => testUserAgent(win, /Firefox/i);\r\n\r\nconst isEdge = (win: Window): boolean => testUserAgent(win, /Edge/i);\r\n\r\nconst isSafari = (win: Window): boolean => testUserAgent(win, /Safari/i);\r\n\r\nconst isOpera = (win: Window): boolean => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);\r\n\r\nconst isMSIE = (win: Window): boolean => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);\r\n\r\nconst isMobileWeb = (win: Window): boolean => isMobile(win) && !isHybrid(win);\r\n\r\nconst isIpad = (win: Window) => {\r\n // iOS 12 and below\r\n if (testUserAgent(win, /iPad/i)) {\r\n return true;\r\n }\r\n\r\n // iOS 13+\r\n if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {\r\n return true;\r\n }\r\n\r\n return false;\r\n};\r\n\r\nconst isIphone = (win: Window) => testUserAgent(win, /iPhone/i);\r\n\r\nconst isIOS = (win: Window) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);\r\n\r\nconst isAndroid = (win: Window) => testUserAgent(win, /android|sink/i);\r\n\r\nconst isAndroidTablet = (win: Window) => {\r\n return isAndroid(win) && !testUserAgent(win, /mobile/i);\r\n};\r\n\r\nconst isPhablet = (win: Window) => {\r\n const width = win.innerWidth;\r\n const height = win.innerHeight;\r\n const smallest = Math.min(width, height);\r\n const largest = Math.max(width, height);\r\n\r\n return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;\r\n};\r\n\r\nconst isTablet = (win: Window) => {\r\n const width = win.innerWidth;\r\n const height = win.innerHeight;\r\n const smallest = Math.min(width, height);\r\n const largest = Math.max(width, height);\r\n\r\n return isIpad(win) || isAndroidTablet(win) || (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400);\r\n};\r\n\r\nconst isMobile = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\r\nconst isTouch = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\r\n\r\nconst isDesktop = (win: Window) => !isMobile(win);\r\n\r\nconst isHybrid = (win: Window) => isCordova(win) || isCapacitorNative(win);\r\n\r\nconst isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);\r\n\r\nconst isCapacitorNative = (win: any): boolean => {\r\n const capacitor = win['Capacitor'];\r\n return !!(capacitor && capacitor.isNative);\r\n};\r\n\r\nconst isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);\r\n\r\nconst isPWA = (win: Window): boolean => !!(win.matchMedia('(display-mode: standalone)').matches || (win.navigator as any).standalone);\r\n\r\nexport const testUserAgent = (win: Window, expr: RegExp) => expr.test(win.navigator.userAgent);\r\n\r\nconst matchMedia = (win: Window, query: string): boolean => win?.matchMedia(query).matches || false;\r\n\r\nconst isSMScreen = (win: Window) => matchMedia(win, '(max-width: 640px)');\r\nconst isMDScreen = (win: Window) => matchMedia(win, '(max-width: 768px)');\r\nconst isLGScreen = (win: Window) => matchMedia(win, '(max-width: 1024px)');\r\nconst isXLScreen = (win: Window) => matchMedia(win, '(max-width: 1280px)');\r\nconst is2XLScreen = (win: Window) => matchMedia(win, '(max-width: 1536px)');\r\n\r\nconst PLATFORMS_MAP: any = {\r\n Android: isAndroid,\r\n iOS: isIOS,\r\n Desktop: isDesktop,\r\n Mobile: isMobile,\r\n Touch: isTouch,\r\n Chrome: isChrome,\r\n Firefox: isFirefox,\r\n Safari: isSafari,\r\n Edge: isEdge,\r\n Opera: isOpera,\r\n Hybrid: isHybrid,\r\n PWA: isPWA,\r\n Electron: isElectron,\r\n SM: isSMScreen,\r\n MD: isMDScreen,\r\n LG: isLGScreen,\r\n XL: isXLScreen,\r\n '2XL': is2XLScreen,\r\n};\r\n\r\nexport class AXPlatformEvent<T extends Event = Event> {\r\n nativeEvent!: T;\r\n source!: AXPlatform;\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class AXPlatform {\r\n resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\r\n click: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\r\n scroll: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\r\n\r\n isRtl(): boolean {\r\n return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';\r\n }\r\n\r\n isLandscape(): boolean {\r\n return window.innerHeight < window.innerWidth;\r\n }\r\n\r\n isPortrate(): boolean {\r\n return !this.isLandscape();\r\n }\r\n\r\n is(name: AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes): boolean {\r\n return PLATFORMS_MAP[name](window) || false;\r\n }\r\n\r\n switchDarkMode() {\r\n const _html = document.getElementsByTagName('html')[0];\r\n _html.classList.add('ax-dark');\r\n }\r\n\r\n switchLightMode() {\r\n const _html = document.getElementsByTagName('html')[0];\r\n _html.classList.remove('ax-dark');\r\n }\r\n\r\n private _setFullHeightRatio() {\r\n try {\r\n document.querySelector<HTMLElement>(':root')?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');\r\n } catch (error) {}\r\n }\r\n\r\n constructor() {\r\n fromEvent<UIEvent>(window, 'resize')\r\n .pipe(debounceTime(100))\r\n .pipe(distinctUntilChanged())\r\n .subscribe(e => {\r\n this.resize.next({\r\n nativeEvent: e,\r\n source: this,\r\n });\r\n //\r\n this._setFullHeightRatio();\r\n });\r\n\r\n document.addEventListener(\r\n 'click',\r\n e => {\r\n this.click.next({\r\n nativeEvent: e,\r\n source: this,\r\n });\r\n },\r\n true\r\n );\r\n\r\n document.addEventListener(\r\n 'scroll',\r\n e => {\r\n this.scroll.next({\r\n nativeEvent: e,\r\n source: this,\r\n });\r\n },\r\n true\r\n );\r\n // init functions\r\n this._setFullHeightRatio();\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAUA,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAEzE,MAAM,SAAS,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAE3E,MAAM,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAErE,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAEzE,MAAM,OAAO,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAErG,MAAM,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAEvG,MAAM,WAAW,GAAG,CAAC,GAAW,KAAc,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAE9E,MAAM,MAAM,GAAG,CAAC,GAAW,KAAI;;AAE7B,IAAA,IAAI,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE;AAC/B,QAA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AA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cAFT,MAAM,EAAA,CAAA,CAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;AC1HD;;AAEG;;;;"}
|
@@ -4,77 +4,76 @@ import * as _ from 'lodash';
|
|
4
4
|
import * as i0 from '@angular/core';
|
5
5
|
import { Pipe, NgModule } from '@angular/core';
|
6
6
|
|
7
|
-
// @dynamic
|
8
|
-
class AXTranslator {
|
9
|
-
static
|
10
|
-
|
11
|
-
}
|
12
|
-
static
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
7
|
+
// @dynamic
|
8
|
+
class AXTranslator {
|
9
|
+
static lang = 'en';
|
10
|
+
static dataChangeSubject = new Subject();
|
11
|
+
static _varsRegx = /((\$\{[a-zA-Z_0-9\.]+\})+)/gm;
|
12
|
+
static _varNameRegx = /[a-zA-Z_0-9\.]+/gm;
|
13
|
+
static get onChange() {
|
14
|
+
return AXTranslator.dataChangeSubject.asObservable();
|
15
|
+
}
|
16
|
+
static load(lang, value) {
|
17
|
+
if (typeof value === 'object') {
|
18
|
+
if (!AXTranslator[`__data__${lang}`]) {
|
19
|
+
AXTranslator[`__data__${lang}`] = {};
|
20
|
+
}
|
21
|
+
AXTranslator[`__data__${lang}`] = merge(AXTranslator[`__data__${lang}`], value);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
static use(lang) {
|
25
|
+
AXTranslator.lang = lang;
|
26
|
+
}
|
27
|
+
static get(key, arg1, arg2) {
|
28
|
+
const lang = arg1 && typeof arg1 == 'string' ? arg1 : AXTranslator.lang;
|
29
|
+
const params = arg1 && typeof arg1 == 'object' ? arg1 : arg2;
|
30
|
+
let result = _.get(AXTranslator[`__data__${lang}`], key, key);
|
31
|
+
const vars = typeof (result) == 'string' ? result?.match(this._varsRegx) : [];
|
32
|
+
if (vars?.length) {
|
33
|
+
vars.forEach((v) => {
|
34
|
+
const varKey = v.match(this._varNameRegx)?.length ? v.match(this._varNameRegx)[0] : null;
|
35
|
+
if (varKey) {
|
36
|
+
const p = _.get(params, varKey) || this.get(varKey, lang);
|
37
|
+
if (p) {
|
38
|
+
result = result.replace(v, p);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
});
|
42
|
+
}
|
43
|
+
return typeof (result) == 'string' ? result : JSON.stringify(result);
|
44
|
+
}
|
45
|
+
}
|
46
46
|
|
47
|
-
class AXTranslatorPipe {
|
48
|
-
transform(value, arg1, arg2) {
|
49
|
-
return AXTranslator.get(value, arg1, arg2);
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
55
|
-
type: Pipe,
|
56
|
-
args: [{ name: 'trans', pure: true }]
|
47
|
+
class AXTranslatorPipe {
|
48
|
+
transform(value, arg1, arg2) {
|
49
|
+
return AXTranslator.get(value, arg1, arg2);
|
50
|
+
}
|
51
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
52
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.0.0", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
|
53
|
+
}
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXTranslatorPipe, decorators: [{
|
55
|
+
type: Pipe,
|
56
|
+
args: [{ name: 'trans', pure: true }]
|
57
57
|
}] });
|
58
58
|
|
59
|
-
class AXTranslationModule {
|
60
|
-
}
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
65
|
-
type: NgModule,
|
66
|
-
args: [{
|
67
|
-
imports: [],
|
68
|
-
exports: [AXTranslatorPipe],
|
69
|
-
declarations: [AXTranslatorPipe],
|
70
|
-
providers: [],
|
71
|
-
}]
|
59
|
+
class AXTranslationModule {
|
60
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
61
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
|
62
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXTranslationModule });
|
63
|
+
}
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AXTranslationModule, decorators: [{
|
65
|
+
type: NgModule,
|
66
|
+
args: [{
|
67
|
+
imports: [],
|
68
|
+
exports: [AXTranslatorPipe],
|
69
|
+
declarations: [AXTranslatorPipe],
|
70
|
+
providers: [],
|
71
|
+
}]
|
72
72
|
}] });
|
73
73
|
|
74
|
-
/**
|
75
|
-
* Generated bundle index. Do not edit.
|
74
|
+
/**
|
75
|
+
* Generated bundle index. Do not edit.
|
76
76
|
*/
|
77
77
|
|
78
78
|
export { AXTranslationModule, AXTranslator, AXTranslatorPipe };
|
79
79
|
//# sourceMappingURL=acorex-core-translation.mjs.map
|
80
|
-
//# sourceMappingURL=acorex-core-translation.mjs.map
|