@acorex/core 16.0.2 → 17.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/common/README.md +3 -0
- package/common/countries/countries.data.d.ts +2 -0
- package/common/countries/country.d.ts +13 -0
- package/common/index.d.ts +2 -0
- package/config/README.md +3 -0
- package/config/index.d.ts +2 -0
- package/config/lib/configs.d.ts +6 -0
- package/config/lib/configs.service.d.ts +12 -0
- package/date-time/README.md +3 -0
- package/date-time/index.d.ts +10 -0
- package/date-time/lib/calendar.service.d.ts +27 -0
- package/date-time/lib/dateTime.config.d.ts +12 -0
- package/date-time/lib/datetime.class.d.ts +138 -0
- package/date-time/lib/datetime.module.d.ts +8 -0
- package/date-time/lib/datetime.pipe.d.ts +12 -0
- package/date-time/lib/formatters/datetime-formatter.d.ts +19 -0
- package/date-time/lib/formatters/timeleft-formatter.d.ts +16 -0
- package/date-time/lib/georgian.calendar.d.ts +21 -0
- package/date-time/lib/holidays.loader.d.ts +21 -0
- package/date-time/lib/jalali.calendar.d.ts +40 -0
- package/esm2022/common/acorex-core-common.mjs +5 -0
- package/esm2022/common/countries/countries.data.mjs +2625 -0
- package/esm2022/common/countries/country.mjs +2 -0
- package/esm2022/common/index.mjs +3 -0
- package/esm2022/config/acorex-core-config.mjs +5 -0
- package/esm2022/config/index.mjs +3 -0
- package/esm2022/config/lib/configs.mjs +7 -0
- package/esm2022/config/lib/configs.service.mjs +27 -0
- package/esm2022/date-time/acorex-core-date-time.mjs +5 -0
- package/esm2022/date-time/index.mjs +11 -0
- package/esm2022/date-time/lib/calendar.service.mjs +100 -0
- package/esm2022/date-time/lib/dateTime.config.mjs +50 -0
- package/esm2022/date-time/lib/datetime.class.mjs +337 -0
- package/esm2022/date-time/lib/datetime.module.mjs +27 -0
- package/esm2022/date-time/lib/datetime.pipe.mjs +29 -0
- package/esm2022/date-time/lib/formatters/datetime-formatter.mjs +32 -0
- package/esm2022/date-time/lib/formatters/timeleft-formatter.mjs +91 -0
- package/esm2022/date-time/lib/georgian.calendar.mjs +203 -0
- package/esm2022/date-time/lib/holidays.loader.mjs +13 -0
- package/esm2022/date-time/lib/jalali.calendar.mjs +440 -0
- package/esm2022/events/acorex-core-events.mjs +5 -0
- package/esm2022/events/index.mjs +3 -0
- package/esm2022/events/lib/event.service.mjs +43 -0
- package/esm2022/events/lib/event.type.mjs +6 -0
- package/esm2022/file/acorex-core-file.mjs +5 -0
- package/esm2022/file/index.mjs +7 -0
- package/esm2022/file/lib/file-download-ref.class.mjs +12 -0
- package/esm2022/file/lib/file-download-result.class.mjs +45 -0
- package/esm2022/file/lib/file-size-formatter.mjs +24 -0
- package/esm2022/file/lib/file-upload-ref.class.mjs +12 -0
- package/esm2022/file/lib/file.module.mjs +20 -0
- package/esm2022/file/lib/file.service.mjs +103 -0
- package/esm2022/format/acorex-core-format.mjs +5 -0
- package/esm2022/format/index.mjs +8 -0
- package/esm2022/format/lib/format.config.mjs +3 -0
- package/esm2022/format/lib/format.module.mjs +64 -0
- package/esm2022/format/lib/format.pipe.mjs +37 -0
- package/esm2022/format/lib/format.service.mjs +95 -0
- package/esm2022/format/lib/format.types.mjs +2 -0
- package/esm2022/format/lib/formatters/number-formatter.mjs +74 -0
- package/esm2022/format/lib/formatters/string-formatter.mjs +15 -0
- package/esm2022/image/acorex-core-image.mjs +5 -0
- package/esm2022/image/index.mjs +2 -0
- package/esm2022/image/lib/image.service.mjs +43 -0
- package/esm2022/index.mjs +2 -44
- package/esm2022/memorize/acorex-core-memorize.mjs +5 -0
- package/esm2022/memorize/index.mjs +2 -0
- package/esm2022/memorize/lib/memorize.decorator.mjs +19 -0
- package/esm2022/pipes/acorex-core-pipes.mjs +5 -0
- package/esm2022/pipes/index.mjs +2 -0
- package/esm2022/pipes/lib/safe/safe.pipe.mjs +38 -0
- package/esm2022/platform/acorex-core-platform.mjs +5 -0
- package/esm2022/platform/index.mjs +2 -0
- package/esm2022/platform/lib/platform.service.mjs +225 -0
- package/esm2022/storage/acorex-core-storage.mjs +5 -0
- package/esm2022/storage/cookie-storage.service.mjs +202 -0
- package/esm2022/storage/index.mjs +5 -0
- package/esm2022/storage/local-storage.service.mjs +58 -0
- package/esm2022/storage/session-storage.service.mjs +22 -0
- package/esm2022/storage/storage.interface.mjs +2 -0
- package/esm2022/translation/acorex-core-translation.mjs +5 -0
- package/esm2022/translation/index.mjs +9 -0
- package/esm2022/translation/lib/translation-scope.resolver.mjs +11 -0
- package/esm2022/translation/lib/translation.config.mjs +20 -0
- package/esm2022/translation/lib/translation.loader.mjs +14 -0
- package/esm2022/translation/lib/translation.module.mjs +40 -0
- package/esm2022/translation/lib/translation.service.mjs +173 -0
- package/esm2022/translation/lib/translation.types.mjs +2 -0
- package/esm2022/translation/lib/translator.directive.mjs +28 -0
- package/esm2022/translation/lib/translator.pipe.mjs +23 -0
- package/esm2022/types/acorex-core-types.mjs +5 -0
- package/esm2022/types/index.mjs +2 -0
- package/esm2022/utils/acorex-core-utils.mjs +5 -0
- package/esm2022/utils/index.mjs +6 -0
- package/esm2022/utils/lib/auto-unsubscribe.mjs +36 -0
- package/esm2022/utils/lib/color-util.mjs +111 -0
- package/esm2022/utils/lib/drawing-util.mjs +35 -0
- package/esm2022/utils/lib/html-util.mjs +39 -0
- package/esm2022/utils/lib/string-util.mjs +19 -0
- package/esm2022/validation/acorex-core-validation.mjs +5 -0
- package/esm2022/validation/index.mjs +18 -0
- package/esm2022/validation/lib/rules/between-rule.mjs +31 -0
- package/esm2022/validation/lib/rules/callback-rule.mjs +29 -0
- package/esm2022/validation/lib/rules/equal-rule.mjs +26 -0
- package/esm2022/validation/lib/rules/greater-than.mjs +29 -0
- package/esm2022/validation/lib/rules/length-rule.mjs +26 -0
- package/esm2022/validation/lib/rules/less-than-rule.mjs +29 -0
- package/esm2022/validation/lib/rules/maxlength-rule.mjs +27 -0
- package/esm2022/validation/lib/rules/minlength-rule.mjs +26 -0
- package/esm2022/validation/lib/rules/regex-rule.mjs +49 -0
- package/esm2022/validation/lib/rules/required-rule.mjs +36 -0
- package/esm2022/validation/lib/validation.config.mjs +33 -0
- package/esm2022/validation/lib/validation.module.mjs +84 -0
- package/esm2022/validation/lib/validation.service.mjs +98 -0
- package/esm2022/validation/lib/validation.types.mjs +3 -0
- package/events/README.md +3 -0
- package/events/index.d.ts +2 -0
- package/{lib/services → events/lib}/event.service.d.ts +8 -0
- package/events/lib/event.type.d.ts +5 -0
- package/fesm2022/acorex-core-common.mjs +2631 -0
- package/fesm2022/acorex-core-common.mjs.map +1 -0
- package/fesm2022/acorex-core-config.mjs +39 -0
- package/fesm2022/acorex-core-config.mjs.map +1 -0
- package/fesm2022/acorex-core-date-time.mjs +1305 -0
- package/fesm2022/acorex-core-date-time.mjs.map +1 -0
- package/fesm2022/acorex-core-events.mjs +56 -0
- package/fesm2022/acorex-core-events.mjs.map +1 -0
- package/fesm2022/acorex-core-file.mjs +214 -0
- package/fesm2022/acorex-core-file.mjs.map +1 -0
- package/fesm2022/acorex-core-format.mjs +282 -0
- package/fesm2022/acorex-core-format.mjs.map +1 -0
- package/fesm2022/acorex-core-image.mjs +50 -0
- package/fesm2022/acorex-core-image.mjs.map +1 -0
- package/fesm2022/acorex-core-memorize.mjs +26 -0
- package/fesm2022/acorex-core-memorize.mjs.map +1 -0
- package/fesm2022/acorex-core-pipes.mjs +44 -0
- package/fesm2022/acorex-core-pipes.mjs.map +1 -0
- package/fesm2022/acorex-core-platform.mjs +232 -0
- package/fesm2022/acorex-core-platform.mjs.map +1 -0
- package/fesm2022/acorex-core-storage.mjs +285 -0
- package/fesm2022/acorex-core-storage.mjs.map +1 -0
- package/fesm2022/acorex-core-translation.mjs +293 -0
- package/fesm2022/acorex-core-translation.mjs.map +1 -0
- package/fesm2022/acorex-core-types.mjs +6 -0
- package/fesm2022/acorex-core-types.mjs.map +1 -0
- package/fesm2022/acorex-core-utils.mjs +247 -0
- package/fesm2022/acorex-core-utils.mjs.map +1 -0
- package/fesm2022/acorex-core-validation.mjs +488 -0
- package/fesm2022/acorex-core-validation.mjs.map +1 -0
- package/fesm2022/acorex-core.mjs +2 -2309
- package/fesm2022/acorex-core.mjs.map +1 -1
- package/file/README.md +3 -0
- package/file/index.d.ts +6 -0
- package/file/lib/file-download-ref.class.d.ts +6 -0
- package/file/lib/file-download-result.class.d.ts +8 -0
- package/file/lib/file-size-formatter.d.ts +16 -0
- package/file/lib/file-upload-ref.class.d.ts +5 -0
- package/file/lib/file.module.d.ts +7 -0
- package/file/lib/file.service.d.ts +18 -0
- package/format/README.md +3 -0
- package/format/index.d.ts +7 -0
- package/format/lib/format.config.d.ts +5 -0
- package/format/lib/format.module.d.ts +18 -0
- package/format/lib/format.pipe.d.ts +12 -0
- package/format/lib/format.service.d.ts +43 -0
- package/format/lib/format.types.d.ts +4 -0
- package/format/lib/formatters/number-formatter.d.ts +23 -0
- package/format/lib/formatters/string-formatter.d.ts +14 -0
- package/image/README.md +3 -0
- package/image/index.d.ts +1 -0
- package/image/lib/image.service.d.ts +11 -0
- package/index.d.ts +1 -43
- package/memorize/README.md +3 -0
- package/memorize/index.d.ts +1 -0
- package/memorize/lib/memorize.decorator.d.ts +1 -0
- package/package.json +98 -5
- package/pipes/README.md +3 -0
- package/pipes/index.d.ts +1 -0
- package/pipes/lib/safe/safe.pipe.d.ts +10 -0
- package/platform/README.md +3 -0
- package/platform/index.d.ts +1 -0
- package/{lib/platform → platform/lib}/platform.service.d.ts +14 -6
- package/storage/README.md +3 -0
- package/storage/cookie-storage.service.d.ts +104 -0
- package/storage/index.d.ts +4 -0
- package/storage/local-storage.service.d.ts +16 -0
- package/storage/session-storage.service.d.ts +10 -0
- package/storage/storage.interface.d.ts +14 -0
- package/translation/README.md +3 -0
- package/translation/index.d.ts +8 -0
- package/translation/lib/translation-scope.resolver.d.ts +2 -0
- package/translation/lib/translation.config.d.ts +14 -0
- package/translation/lib/translation.loader.d.ts +14 -0
- package/translation/lib/translation.module.d.ts +8 -0
- package/translation/lib/translation.service.d.ts +31 -0
- package/translation/lib/translation.types.d.ts +10 -0
- package/translation/lib/translator.directive.d.ts +12 -0
- package/translation/lib/translator.pipe.d.ts +12 -0
- package/types/README.md +3 -0
- package/types/index.d.ts +2 -0
- package/utils/README.md +3 -0
- package/utils/index.d.ts +5 -0
- package/utils/lib/auto-unsubscribe.d.ts +12 -0
- package/utils/lib/color-util.d.ts +24 -0
- package/utils/lib/drawing-util.d.ts +18 -0
- package/utils/lib/html-util.d.ts +5 -0
- package/utils/lib/string-util.d.ts +6 -0
- package/validation/README.md +3 -0
- package/validation/index.d.ts +14 -0
- package/validation/lib/rules/between-rule.d.ts +18 -0
- package/validation/lib/rules/callback-rule.d.ts +23 -0
- package/validation/lib/rules/equal-rule.d.ts +17 -0
- package/validation/lib/rules/greater-than.d.ts +17 -0
- package/validation/lib/rules/length-rule.d.ts +17 -0
- package/validation/lib/rules/less-than-rule.d.ts +17 -0
- package/validation/lib/rules/maxlength-rule.d.ts +16 -0
- package/validation/lib/rules/minlength-rule.d.ts +16 -0
- package/validation/lib/rules/regex-rule.d.ts +17 -0
- package/validation/lib/rules/required-rule.d.ts +16 -0
- package/validation/lib/validation.config.d.ts +15 -0
- package/validation/lib/validation.module.d.ts +17 -0
- package/validation/lib/validation.service.d.ts +35 -0
- package/validation/lib/validation.types.d.ts +21 -0
- package/esm2022/lib/classes/base-page.class.mjs +0 -26
- package/esm2022/lib/classes/color.class.mjs +0 -49
- package/esm2022/lib/classes/datetime.class.mjs +0 -323
- package/esm2022/lib/classes/menu.class.mjs +0 -35
- package/esm2022/lib/classes/navigator.class.mjs +0 -2
- package/esm2022/lib/classes/popup.class.mjs +0 -2
- package/esm2022/lib/classes/promise.class.mjs +0 -21
- package/esm2022/lib/classes/sectionlist.class.mjs +0 -2
- package/esm2022/lib/classes/select.class.mjs +0 -8
- package/esm2022/lib/core.module.mjs +0 -27
- package/esm2022/lib/error/error.class.mjs +0 -2
- package/esm2022/lib/error/error.module.mjs +0 -19
- package/esm2022/lib/error/error.service.mjs +0 -22
- package/esm2022/lib/events/keyboard.mjs +0 -2
- package/esm2022/lib/http/http-error.class.mjs +0 -2
- package/esm2022/lib/http/http-events.interceptor.mjs +0 -3
- package/esm2022/lib/http/http-request.class.mjs +0 -2
- package/esm2022/lib/http/http-result.class.mjs +0 -25
- package/esm2022/lib/http/http.module.mjs +0 -35
- package/esm2022/lib/http/http.service.mjs +0 -148
- package/esm2022/lib/locale/en.json +0 -255
- package/esm2022/lib/locale/fa.json +0 -245
- package/esm2022/lib/pipe/datetime.pipe.mjs +0 -25
- package/esm2022/lib/pipe/htmlToText.pipe.mjs +0 -25
- package/esm2022/lib/platform/index.mjs +0 -2
- package/esm2022/lib/platform/platform.service.mjs +0 -152
- package/esm2022/lib/services/config.mjs +0 -29
- package/esm2022/lib/services/event.service.mjs +0 -34
- package/esm2022/lib/services/navigator.service.mjs +0 -10
- package/esm2022/lib/services/storage.service.mjs +0 -16
- package/esm2022/lib/translator/translator.mjs +0 -26
- package/esm2022/lib/translator/translator.module.mjs +0 -25
- package/esm2022/lib/translator/translator.pipe.mjs +0 -24
- package/esm2022/lib/translator/translator.service.mjs +0 -21
- package/esm2022/lib/utils/array/array-util.mjs +0 -133
- package/esm2022/lib/utils/html/html-util.mjs +0 -200
- package/esm2022/lib/utils/html/html.module.mjs +0 -19
- package/esm2022/lib/utils/math/math-util.mjs +0 -6
- package/esm2022/lib/utils/object/object-util.mjs +0 -83
- package/esm2022/lib/utils/render/on-demand-preload-strategy.service.mjs +0 -21
- package/esm2022/lib/utils/render/render.service.mjs +0 -109
- package/esm2022/lib/utils/render/rendering.module.mjs +0 -35
- package/esm2022/lib/utils/scroll/scroll.directive.mjs +0 -56
- package/esm2022/lib/utils/scroll/scroll.module.mjs +0 -19
- package/esm2022/lib/utils/separator/separator.module.mjs +0 -19
- package/esm2022/lib/utils/separator/separator.pipe.mjs +0 -33
- package/lib/classes/base-page.class.d.ts +0 -13
- package/lib/classes/color.class.d.ts +0 -17
- package/lib/classes/datetime.class.d.ts +0 -63
- package/lib/classes/menu.class.d.ts +0 -34
- package/lib/classes/navigator.class.d.ts +0 -5
- package/lib/classes/popup.class.d.ts +0 -12
- package/lib/classes/promise.class.d.ts +0 -7
- package/lib/classes/sectionlist.class.d.ts +0 -8
- package/lib/classes/select.class.d.ts +0 -7
- package/lib/core.module.d.ts +0 -9
- package/lib/error/error.class.d.ts +0 -4
- package/lib/error/error.module.d.ts +0 -7
- package/lib/error/error.service.d.ts +0 -13
- package/lib/events/keyboard.d.ts +0 -2
- package/lib/http/http-error.class.d.ts +0 -7
- package/lib/http/http-events.interceptor.d.ts +0 -10
- package/lib/http/http-request.class.d.ts +0 -14
- package/lib/http/http-result.class.d.ts +0 -11
- package/lib/http/http.module.d.ts +0 -10
- package/lib/http/http.service.d.ts +0 -23
- package/lib/pipe/datetime.pipe.d.ts +0 -8
- package/lib/pipe/htmlToText.pipe.d.ts +0 -7
- package/lib/platform/index.d.ts +0 -1
- package/lib/services/config.d.ts +0 -9
- package/lib/services/navigator.service.d.ts +0 -8
- package/lib/services/storage.service.d.ts +0 -7
- package/lib/translator/translator.d.ts +0 -9
- package/lib/translator/translator.module.d.ts +0 -8
- package/lib/translator/translator.pipe.d.ts +0 -8
- package/lib/translator/translator.service.d.ts +0 -8
- package/lib/utils/array/array-util.d.ts +0 -6
- package/lib/utils/html/html-util.d.ts +0 -62
- package/lib/utils/html/html.module.d.ts +0 -8
- package/lib/utils/math/math-util.d.ts +0 -3
- package/lib/utils/object/object-util.d.ts +0 -7
- package/lib/utils/render/on-demand-preload-strategy.service.d.ts +0 -10
- package/lib/utils/render/render.service.d.ts +0 -18
- package/lib/utils/render/rendering.module.d.ts +0 -8
- package/lib/utils/scroll/scroll.directive.d.ts +0 -18
- package/lib/utils/scroll/scroll.module.d.ts +0 -8
- package/lib/utils/separator/separator.module.d.ts +0 -8
- package/lib/utils/separator/separator.pipe.d.ts +0 -8
@@ -0,0 +1,202 @@
|
|
1
|
+
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
2
|
+
import { Inject, Injectable, PLATFORM_ID } from '@angular/core';
|
3
|
+
import * as i0 from "@angular/core";
|
4
|
+
export class AXCookieStorageService {
|
5
|
+
constructor(document,
|
6
|
+
// Get the `PLATFORM_ID` so we can check if we're in a browser.
|
7
|
+
platformId) {
|
8
|
+
this.document = document;
|
9
|
+
this.platformId = platformId;
|
10
|
+
this.documentIsAccessible = isPlatformBrowser(this.platformId);
|
11
|
+
}
|
12
|
+
/**
|
13
|
+
* Get cookie Regular Expression
|
14
|
+
*
|
15
|
+
* @param name Cookie name
|
16
|
+
* @returns property RegExp
|
17
|
+
*
|
18
|
+
*/
|
19
|
+
static getCookieRegExp(name) {
|
20
|
+
const escapedName = name.replace(/([[\]{}()|=;+?,.*^$])/gi, '\\$1');
|
21
|
+
return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
|
25
|
+
*
|
26
|
+
* @param encodedURIComponent A value representing an encoded URI component.
|
27
|
+
*
|
28
|
+
* @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).
|
29
|
+
*
|
30
|
+
*/
|
31
|
+
static safeDecodeURIComponent(encodedURIComponent) {
|
32
|
+
try {
|
33
|
+
return decodeURIComponent(encodedURIComponent);
|
34
|
+
}
|
35
|
+
catch {
|
36
|
+
// probably it is not uri encoded. return as is
|
37
|
+
return encodedURIComponent;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* Return `true` if {@link Document} is accessible, otherwise return `false`
|
42
|
+
*
|
43
|
+
* @param name Cookie name
|
44
|
+
* @returns boolean - whether cookie with specified name exists
|
45
|
+
*
|
46
|
+
*/
|
47
|
+
check(name) {
|
48
|
+
if (!this.documentIsAccessible) {
|
49
|
+
return false;
|
50
|
+
}
|
51
|
+
name = encodeURIComponent(name);
|
52
|
+
const regExp = AXCookieStorageService.getCookieRegExp(name);
|
53
|
+
return regExp.test(this.document.cookie);
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* Get cookies by name
|
57
|
+
*
|
58
|
+
* @param name Cookie name
|
59
|
+
* @returns property value
|
60
|
+
*
|
61
|
+
*/
|
62
|
+
get(name) {
|
63
|
+
if (this.documentIsAccessible && this.check(name)) {
|
64
|
+
name = encodeURIComponent(name);
|
65
|
+
const regExp = AXCookieStorageService.getCookieRegExp(name);
|
66
|
+
const result = regExp.exec(this.document.cookie);
|
67
|
+
return result[1]
|
68
|
+
? AXCookieStorageService.safeDecodeURIComponent(result[1])
|
69
|
+
: '';
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
return '';
|
73
|
+
}
|
74
|
+
}
|
75
|
+
/**
|
76
|
+
* Get all cookies in JSON format
|
77
|
+
*
|
78
|
+
* @returns all the cookies in json
|
79
|
+
*
|
80
|
+
*/
|
81
|
+
getAll() {
|
82
|
+
if (!this.documentIsAccessible) {
|
83
|
+
return {};
|
84
|
+
}
|
85
|
+
const cookies = {};
|
86
|
+
const document = this.document;
|
87
|
+
if (document.cookie && document.cookie !== '') {
|
88
|
+
document.cookie.split(';').forEach((currentCookie) => {
|
89
|
+
const [cookieName, cookieValue] = currentCookie.split('=');
|
90
|
+
cookies[AXCookieStorageService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] = AXCookieStorageService.safeDecodeURIComponent(cookieValue);
|
91
|
+
});
|
92
|
+
}
|
93
|
+
return cookies;
|
94
|
+
}
|
95
|
+
set(name, value, expiresOrOptions, path, domain, secure, sameSite) {
|
96
|
+
if (!this.documentIsAccessible) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
if (typeof expiresOrOptions === 'number' ||
|
100
|
+
expiresOrOptions instanceof Date ||
|
101
|
+
path ||
|
102
|
+
domain ||
|
103
|
+
secure ||
|
104
|
+
sameSite) {
|
105
|
+
const optionsBody = {
|
106
|
+
expires: expiresOrOptions,
|
107
|
+
path,
|
108
|
+
domain,
|
109
|
+
secure,
|
110
|
+
sameSite: sameSite ? sameSite : 'Lax',
|
111
|
+
};
|
112
|
+
this.set(name, value, optionsBody);
|
113
|
+
return;
|
114
|
+
}
|
115
|
+
let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';
|
116
|
+
const options = expiresOrOptions ? expiresOrOptions : {};
|
117
|
+
if (options.expires) {
|
118
|
+
if (typeof options.expires === 'number') {
|
119
|
+
const dateExpires = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24);
|
120
|
+
cookieString += 'expires=' + dateExpires.toUTCString() + ';';
|
121
|
+
}
|
122
|
+
else {
|
123
|
+
cookieString += 'expires=' + options.expires.toUTCString() + ';';
|
124
|
+
}
|
125
|
+
}
|
126
|
+
if (options.path) {
|
127
|
+
cookieString += 'path=' + options.path + ';';
|
128
|
+
}
|
129
|
+
if (options.domain) {
|
130
|
+
cookieString += 'domain=' + options.domain + ';';
|
131
|
+
}
|
132
|
+
if (options.secure === false && options.sameSite === 'None') {
|
133
|
+
options.secure = true;
|
134
|
+
console.warn(`[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +
|
135
|
+
`More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`);
|
136
|
+
}
|
137
|
+
if (options.secure) {
|
138
|
+
cookieString += 'secure;';
|
139
|
+
}
|
140
|
+
if (!options.sameSite) {
|
141
|
+
options.sameSite = 'Lax';
|
142
|
+
}
|
143
|
+
cookieString += 'sameSite=' + options.sameSite + ';';
|
144
|
+
this.document.cookie = cookieString;
|
145
|
+
}
|
146
|
+
/**
|
147
|
+
* Delete cookie by name
|
148
|
+
*
|
149
|
+
* @param name Cookie name
|
150
|
+
* @param path Cookie path
|
151
|
+
* @param domain Cookie domain
|
152
|
+
* @param secure Cookie secure flag
|
153
|
+
* @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
|
154
|
+
*
|
155
|
+
*/
|
156
|
+
delete(name, path, domain, secure, sameSite = 'Lax') {
|
157
|
+
if (!this.documentIsAccessible) {
|
158
|
+
return;
|
159
|
+
}
|
160
|
+
const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');
|
161
|
+
this.set(name, '', {
|
162
|
+
expires: expiresDate,
|
163
|
+
path,
|
164
|
+
domain,
|
165
|
+
secure,
|
166
|
+
sameSite,
|
167
|
+
});
|
168
|
+
}
|
169
|
+
/**
|
170
|
+
* Delete all cookies
|
171
|
+
*
|
172
|
+
* @param path Cookie path
|
173
|
+
* @param domain Cookie domain
|
174
|
+
* @param secure Is the Cookie secure
|
175
|
+
* @param sameSite Is the cookie same site
|
176
|
+
*
|
177
|
+
*/
|
178
|
+
deleteAll(path, domain, secure, sameSite = 'Lax') {
|
179
|
+
if (!this.documentIsAccessible) {
|
180
|
+
return;
|
181
|
+
}
|
182
|
+
const cookies = this.getAll();
|
183
|
+
for (const cookieName in cookies) {
|
184
|
+
// eslint-disable-next-line no-prototype-builtins
|
185
|
+
if (cookies.hasOwnProperty(cookieName)) {
|
186
|
+
this.delete(cookieName, path, domain, secure, sameSite);
|
187
|
+
}
|
188
|
+
}
|
189
|
+
}
|
190
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXCookieStorageService, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
191
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXCookieStorageService }); }
|
192
|
+
}
|
193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXCookieStorageService, decorators: [{
|
194
|
+
type: Injectable
|
195
|
+
}], ctorParameters: () => [{ type: Document, decorators: [{
|
196
|
+
type: Inject,
|
197
|
+
args: [DOCUMENT]
|
198
|
+
}] }, { type: undefined, decorators: [{
|
199
|
+
type: Inject,
|
200
|
+
args: [PLATFORM_ID]
|
201
|
+
}]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RvcmFnZVNlcnZpY2UuZ2V0Q29va2llUmVnRXhwKG5hbWUpO1xuICAgICAgY29uc3QgcmVzdWx0OiBSZWdFeHBFeGVjQXJyYXkgPSByZWdFeHAuZXhlYyh0aGlzLmRvY3VtZW50LmNvb2tpZSk7XG5cbiAgICAgIHJldHVybiByZXN1bHRbMV1cbiAgICAgICAgPyBBWENvb2tpZVN0b3JhZ2VTZXJ2aWNlLnNhZmVEZWNvZGVVUklDb21wb25lbnQocmVzdWx0WzFdKVxuICAgICAgICA6ICcnO1xuICAgIH0gZWxzZSB7XG4gICAgICByZXR1cm4gJyc7XG4gICAgfVxuICB9XG5cbiAgLyoqXG4gICAqIEdldCBhbGwgY29va2llcyBpbiBKU09OIGZvcm1hdFxuICAgKlxuICAgKiBAcmV0dXJucyBhbGwgdGhlIGNvb2tpZXMgaW4ganNvblxuICAgKlxuICAgKi9cbiAgZ2V0QWxsKCk6IHsgW2tleTogc3RyaW5nXTogc3RyaW5nIH0ge1xuICAgIGlmICghdGhpcy5kb2N1bWVudElzQWNjZXNzaWJsZSkge1xuICAgICAgcmV0dXJuIHt9O1xuICAgIH1cblxuICAgIGNvbnN0IGNvb2tpZXM6IHsgW2tleTogc3RyaW5nXTogc3RyaW5nIH0gPSB7fTtcbiAgICBjb25zdCBkb2N1bWVudDogYW55ID0gdGhpcy5kb2N1bWVudDtcblxuICAgIGlmIChkb2N1bWVudC5jb29raWUgJiYgZG9jdW1lbnQuY29va2llICE9PSAnJykge1xuICAgICAgZG9jdW1lbnQuY29va2llLnNwbGl0KCc7JykuZm9yRWFjaCgoY3VycmVudENvb2tpZSkgPT4ge1xuICAgICAgICBjb25zdCBbY29va2llTmFtZSwgY29va2llVmFsdWVdID0gY3VycmVudENvb2tpZS5zcGxpdCgnPScpO1xuICAgICAgICBjb29raWVzW1xuICAgICAgICAgIEFYQ29va2llU3RvcmFnZVNlcnZpY2Uuc2FmZURlY29kZVVSSUNvbXBvbmVudChcbiAgICAgICAgICAgIGNvb2tpZ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nNldChuYW1lLCAnJywge1xuICAgICAgZXhwaXJlczogZXhwaXJlc0RhdGUsXG4gICAgICBwYXRoLFxuICAgICAgZG9tYWluLFxuICAgICAgc2VjdXJlLFxuICAgICAgc2FtZVNpdGUsXG4gICAgfSk7XG4gIH1cblxuICAvKipcbiAgICogRGVsZXRlIGFsbCBjb29raWVzXG4gICAqXG4gICAqIEBwYXJhbSBwYXRoICAgQ29va2llIHBhdGhcbiAgICogQHBhcmFtIGRvbWFpbiBDb29raWUgZG9tYWluXG4gICAqIEBwYXJhbSBzZWN1cmUgSXMgdGhlIENvb2tpZSBzZWN1cmVcbiAgICogQHBhcmFtIHNhbWVTaXRlIElzIHRoZSBjb29raWUgc2FtZSBzaXRlXG4gICAqXG4gICAqL1xuICBkZWxldGVBbGwoXG4gICAgcGF0aD86IEFYQ29va2llT3B0aW9uc1sncGF0aCddLFxuICAgIGRvbWFpbj86IEFYQ29va2llT3B0aW9uc1snZG9tYWluJ10sXG4gICAgc2VjdXJlPzogQVhDb29raWVPcHRpb25zWydzZWN1cmUnXSxcbiAgICBzYW1lU2l0ZTogQVhTYW1lU2l0ZSA9ICdMYXgnXG4gICk6IHZvaWQge1xuICAgIGlmICghdGhpcy5kb2N1bWVudElzQWNjZXNzaWJsZSkge1xuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIGNvbnN0IGNvb2tpZXMgPSB0aGlzLmdldEFsbCgpO1xuXG4gICAgZm9yIChjb25zdCBjb29raWVOYW1lIGluIGNvb2tpZXMpIHtcbiAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1wcm90b3R5cGUtYnVpbHRpbnNcbiAgICAgIGlmIChjb29raWVzLmhhc093blByb3BlcnR5KGNvb2tpZU5hbWUpKSB7XG4gICAgICAgIHRoaXMuZGVsZXRlKGNvb2tpZU5hbWUsIHBhdGgsIGRvbWFpbiwgc2VjdXJlLCBzYW1lU2l0ZSk7XG4gICAgICB9XG4gICAgfVxuICB9XG59XG4iXX0=
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export * from './cookie-storage.service';
|
2
|
+
export * from './local-storage.service';
|
3
|
+
export * from './session-storage.service';
|
4
|
+
export * from './storage.interface';
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2NvcmUvc3RvcmFnZS9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLHlCQUF5QixDQUFDO0FBQ3hDLGNBQWMsMkJBQTJCLENBQUM7QUFDMUMsY0FBYyxxQkFBcUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vY29va2llLXN0b3JhZ2Uuc2VydmljZSc7XG5leHBvcnQgKiBmcm9tICcuL2xvY2FsLXN0b3JhZ2Uuc2VydmljZSc7XG5leHBvcnQgKiBmcm9tICcuL3Nlc3Npb24tc3RvcmFnZS5zZXJ2aWNlJztcbmV4cG9ydCAqIGZyb20gJy4vc3RvcmFnZS5pbnRlcmZhY2UnO1xuIl19
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { isBrowser } from '@acorex/core/platform';
|
2
|
+
import { Inject, Injectable, InjectionToken } from '@angular/core';
|
3
|
+
import * as CryptoJS from 'crypto-js';
|
4
|
+
import * as i0 from "@angular/core";
|
5
|
+
export const AX_LOCALSTORAGE_SECRET_KEY = new InjectionToken('AX_LOCALSTORAGE_SECRET_KEY');
|
6
|
+
export class AXLocalStorageService {
|
7
|
+
constructor(secret_key) {
|
8
|
+
this.secret_key = secret_key;
|
9
|
+
}
|
10
|
+
get(key) {
|
11
|
+
if (isBrowser()) {
|
12
|
+
return JSON.parse(localStorage.getItem(key) || '');
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
return null;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
set(key, value) {
|
19
|
+
if (isBrowser()) {
|
20
|
+
return localStorage.setItem(key, JSON.stringify(value));
|
21
|
+
}
|
22
|
+
}
|
23
|
+
clear() {
|
24
|
+
if (isBrowser()) {
|
25
|
+
return localStorage.clear();
|
26
|
+
}
|
27
|
+
}
|
28
|
+
removeItem(key) {
|
29
|
+
if (isBrowser()) {
|
30
|
+
return localStorage.removeItem(key);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
setWithEncryption(key, value) {
|
34
|
+
if (isBrowser()) {
|
35
|
+
const encrypted = CryptoJS.AES.encrypt(JSON.stringify(value), this.secret_key).toString();
|
36
|
+
return localStorage.setItem(key, encrypted);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
getWithEncription(key) {
|
40
|
+
if (isBrowser()) {
|
41
|
+
const encrypted = localStorage.getItem(key) || '';
|
42
|
+
const decrypted = CryptoJS.AES.decrypt(encrypted, this.secret_key).toString(CryptoJS.enc.Utf8);
|
43
|
+
return encrypted ? JSON.parse(decrypted) : {};
|
44
|
+
}
|
45
|
+
else {
|
46
|
+
return null;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXLocalStorageService, deps: [{ token: AX_LOCALSTORAGE_SECRET_KEY }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
50
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXLocalStorageService }); }
|
51
|
+
}
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXLocalStorageService, decorators: [{
|
53
|
+
type: Injectable
|
54
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
55
|
+
type: Inject,
|
56
|
+
args: [AX_LOCALSTORAGE_SECRET_KEY]
|
57
|
+
}] }] });
|
58
|
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YWdlLmdldEl0ZW0oa2V5KSB8fCAnJztcbiAgICAgIGNvbnN0IGRlY3J5cHRlZCA9IENyeXB0b0pTLkFFUy5kZWNyeXB0KGVuY3J5cHRlZCwgdGhpcy5zZWNyZXRfa2V5KS50b1N0cmluZyhDcnlwdG9KUy5lbmMuVXRmOCk7XG4gICAgICByZXR1cm4gZW5jcnlwdGVkID8gSlNPTi5wYXJzZShkZWNyeXB0ZWQpIDoge307XG4gICAgfSBlbHNlIHtcbiAgICAgIHJldHVybiBudWxsO1xuICAgIH1cbiAgfVxufVxuIl19
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { Injectable } from '@angular/core';
|
2
|
+
import * as i0 from "@angular/core";
|
3
|
+
export class AXSessionStorageService {
|
4
|
+
get(key) {
|
5
|
+
return JSON.parse(sessionStorage.getItem(key) || '');
|
6
|
+
}
|
7
|
+
set(key, value) {
|
8
|
+
return sessionStorage.setItem(key, JSON.stringify(value));
|
9
|
+
}
|
10
|
+
clear() {
|
11
|
+
return sessionStorage.clear();
|
12
|
+
}
|
13
|
+
removeItem(key) {
|
14
|
+
return sessionStorage.removeItem(key);
|
15
|
+
}
|
16
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXSessionStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
17
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXSessionStorageService }); }
|
18
|
+
}
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXSessionStorageService, decorators: [{
|
20
|
+
type: Injectable
|
21
|
+
}] });
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vzc2lvbi1zdG9yYWdlLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8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BvcnQgaW50ZXJmYWNlIEFYQ29va2llT3B0aW9ucyB7XG4gIGV4cGlyZXM/OiBudW1iZXIgfCBEYXRlO1xuICBwYXRoPzogc3RyaW5nO1xuICBkb21haW4/OiBzdHJpbmc7XG4gIHNlY3VyZT86IGJvb2xlYW47XG4gIHNhbWVTaXRlPzogQVhTYW1lU2l0ZTtcbn1cbiJdfQ==
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* Generated bundle index. Do not edit.
|
3
|
+
*/
|
4
|
+
export * from './index';
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNvcmV4LWNvcmUtdHJhbnNsYXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2NvcmUvdHJhbnNsYXRpb24vc3JjL2Fjb3JleC1jb3JlLXRyYW5zbGF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export * from './lib/translation.config';
|
2
|
+
export * from './lib/translation.loader';
|
3
|
+
export * from './lib/translation.module';
|
4
|
+
export * from './lib/translation.types';
|
5
|
+
export * from './lib/translation-scope.resolver';
|
6
|
+
export * from './lib/translation.service';
|
7
|
+
export * from './lib/translator.directive';
|
8
|
+
export * from './lib/translator.pipe';
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2NvcmUvdHJhbnNsYXRpb24vc3JjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMseUJBQXlCLENBQUM7QUFDeEMsY0FBYyxrQ0FBa0MsQ0FBQztBQUNqRCxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsNEJBQTRCLENBQUM7QUFDM0MsY0FBYyx1QkFBdUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vbGliL3RyYW5zbGF0aW9uLmNvbmZpZyc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi90cmFuc2xhdGlvbi5sb2FkZXInO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvdHJhbnNsYXRpb24ubW9kdWxlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3RyYW5zbGF0aW9uLnR5cGVzJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3RyYW5zbGF0aW9uLXNjb3BlLnJlc29sdmVyJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3RyYW5zbGF0aW9uLnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvdHJhbnNsYXRvci5kaXJlY3RpdmUnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvdHJhbnNsYXRvci5waXBlJztcbiJdfQ==
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { inject } from '@angular/core';
|
2
|
+
import { AXTranslationService } from './translation.service';
|
3
|
+
import { AX_TRANSLATION_CONFIG } from './translation.config';
|
4
|
+
export const loadTranslationScope = (route, state) => {
|
5
|
+
const translatorService = inject(AXTranslationService);
|
6
|
+
const config = inject(AX_TRANSLATION_CONFIG);
|
7
|
+
const scopeValue = route.data[config.scopeResolverKey];
|
8
|
+
const scopes = Array.isArray(scopeValue) ? scopeValue : [scopeValue];
|
9
|
+
return translatorService.loadLanguagesAndScopes([translatorService.getActiveLang()], scopes);
|
10
|
+
};
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRpb24tc2NvcGUucmVzb2x2ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2NvcmUvdHJhbnNsYXRpb24vc3JjL2xpYi90cmFuc2xhdGlvbi1zY29wZS5yZXNvbHZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3ZDLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRTdELE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBRTdELE1BQU0sQ0FBQyxNQUFNLG9CQUFvQixHQUF1QixDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRTtJQUN2RSxNQUFNLGlCQUFpQixHQUFHLE1BQU0sQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDO0lBQ3ZELE1BQU0sTUFBTSxHQUFHLE1BQU0sQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDO0lBQzdDLE1BQU0sVUFBVSxHQUFHLEtBQUssQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLGdCQUFnQixDQUFDLENBQUM7SUFDdkQsTUFBTSxNQUFNLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3JFLE9BQU8saUJBQWlCLENBQUMsc0JBQXNCLENBQzdDLENBQUMsaUJBQWlCLENBQUMsYUFBYSxFQUFFLENBQUMsRUFDbkMsTUFBTSxDQUNQLENBQUM7QUFDSixDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBpbmplY3QgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IEFYVHJhbnNsYXRpb25TZXJ2aWNlIH0gZnJvbSAnLi90cmFuc2xhdGlvbi5zZXJ2aWNlJztcbmltcG9ydCB7IFJlc29sdmVGbiB9IGZyb20gJ0Bhbmd1bGFyL3JvdXRlcic7XG5pbXBvcnQgeyBBWF9UUkFOU0xBVElPTl9DT05GSUcgfSBmcm9tICcuL3RyYW5zbGF0aW9uLmNvbmZpZyc7XG5cbmV4cG9ydCBjb25zdCBsb2FkVHJhbnNsYXRpb25TY29wZTogUmVzb2x2ZUZuPHVua25vd24+ID0gKHJvdXRlLCBzdGF0ZSkgPT4ge1xuICBjb25zdCB0cmFuc2xhdG9yU2VydmljZSA9IGluamVjdChBWFRyYW5zbGF0aW9uU2VydmljZSk7XG4gIGNvbnN0IGNvbmZpZyA9IGluamVjdChBWF9UUkFOU0xBVElPTl9DT05GSUcpO1xuICBjb25zdCBzY29wZVZhbHVlID0gcm91dGUuZGF0YVtjb25maWcuc2NvcGVSZXNvbHZlcktleV07XG4gIGNvbnN0IHNjb3BlcyA9IEFycmF5LmlzQXJyYXkoc2NvcGVWYWx1ZSkgPyBzY29wZVZhbHVlIDogW3Njb3BlVmFsdWVdO1xuICByZXR1cm4gdHJhbnNsYXRvclNlcnZpY2UubG9hZExhbmd1YWdlc0FuZFNjb3BlcyhcbiAgICBbdHJhbnNsYXRvclNlcnZpY2UuZ2V0QWN0aXZlTGFuZygpXSxcbiAgICBzY29wZXNcbiAgKTtcbn07XG4iXX0=
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
2
|
+
export const AX_TRANSLATION_CONFIG = new InjectionToken('AX_TRANSLATION_CONFIG', {
|
3
|
+
providedIn: 'root',
|
4
|
+
factory: () => {
|
5
|
+
return AXTranslationDefaultConfig;
|
6
|
+
},
|
7
|
+
});
|
8
|
+
export const AXTranslationDefaultConfig = {
|
9
|
+
defaultLang: 'en',
|
10
|
+
defaultScope: 'common',
|
11
|
+
scopeResolverKey: 'scope',
|
12
|
+
};
|
13
|
+
export function translationConfig(config = {}) {
|
14
|
+
const result = {
|
15
|
+
...AXTranslationDefaultConfig,
|
16
|
+
...config,
|
17
|
+
};
|
18
|
+
return result;
|
19
|
+
}
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRpb24uY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL3RyYW5zbGF0aW9uL3NyYy9saWIvdHJhbnNsYXRpb24uY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFZL0MsTUFBTSxDQUFDLE1BQU0scUJBQXFCLEdBQUcsSUFBSSxjQUFjLENBQ3JELHVCQUF1QixFQUN2QjtJQUNFLFVBQVUsRUFBRSxNQUFNO0lBQ2xCLE9BQU8sRUFBRSxHQUFHLEVBQUU7UUFDWixPQUFPLDBCQUEwQixDQUFDO0lBQ3BDLENBQUM7Q0FDRixDQUNGLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSwwQkFBMEIsR0FBd0I7SUFDN0QsV0FBVyxFQUFFLElBQUk7SUFDakIsWUFBWSxFQUFFLFFBQVE7SUFDdEIsZ0JBQWdCLEVBQUUsT0FBTztDQUMxQixDQUFDO0FBSUYsTUFBTSxVQUFVLGlCQUFpQixDQUMvQixTQUFxQyxFQUFFO0lBRXZDLE1BQU0sTUFBTSxHQUFHO1FBQ2IsR0FBRywwQkFBMEI7UUFDN0IsR0FBRyxNQUFNO0tBQ1YsQ0FBQztJQUNGLE9B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B0eXBlIEFYUGFydGlhbFRyYW5zbGF0aW9uQ29uZmlnID0gUGFydGlhbDxBWFRyYW5zbGF0aW9uQ29uZmlnPjtcblxuZXhwb3J0IGZ1bmN0aW9uIHRyYW5zbGF0aW9uQ29uZmlnKFxuICBjb25maWc6IEFYUGFydGlhbFRyYW5zbGF0aW9uQ29uZmlnID0ge31cbik6IEFYVHJhbnNsYXRpb25Db25maWcge1xuICBjb25zdCByZXN1bHQgPSB7XG4gICAgLi4uQVhUcmFuc2xhdGlvbkRlZmF1bHRDb25maWcsXG4gICAgLi4uY29uZmlnLFxuICB9O1xuICByZXR1cm4gcmVzdWx0O1xufVxuIl19
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
2
|
+
import { of } from 'rxjs';
|
3
|
+
export class AXTranslationLoaderDefault {
|
4
|
+
getTranslation(options) {
|
5
|
+
return of({});
|
6
|
+
}
|
7
|
+
}
|
8
|
+
export const AX_TRANSLATION_LOADER = new InjectionToken('AX_TRANSLATION_LOADER', {
|
9
|
+
providedIn: 'root',
|
10
|
+
factory: () => {
|
11
|
+
return new AXTranslationLoaderDefault();
|
12
|
+
},
|
13
|
+
});
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRpb24ubG9hZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL3RyYW5zbGF0aW9uL3NyYy9saWIvdHJhbnNsYXRpb24ubG9hZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFNL0MsT0FBTyxFQUFjLEVBQUUsRUFBRSxNQUFNLE1BQU0sQ0FBQztBQWF0QyxNQUFNLE9BQU8sMEJBQTBCO0lBQ3JDLGNBQWMsQ0FDWixPQUFtQztRQ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pb25Mb2FkZXJPcHRpb25zXG4gICk6IE9ic2VydmFibGU8QVhUcmFuc2xhdGlvbj4ge1xuICAgIHJldHVybiBvZih7fSk7XG4gIH1cbn1cblxuZXhwb3J0IGNvbnN0IEFYX1RSQU5TTEFUSU9OX0xPQURFUiA9IG5ldyBJbmplY3Rpb25Ub2tlbjxBWFRyYW5zbGF0aW9uTG9hZGVyPihcbiAgJ0FYX1RSQU5TTEFUSU9OX0xPQURFUicsXG4gIHtcbiAgICBwcm92aWRlZEluOiAncm9vdCcsXG4gICAgZmFjdG9yeTogKCkgPT4ge1xuICAgICAgcmV0dXJuIG5ldyBBWFRyYW5zbGF0aW9uTG9hZGVyRGVmYXVsdCgpO1xuICAgIH0sXG4gIH1cbik7XG4iXX0=
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
2
|
+
import { AXTranslatorPipe } from './translator.pipe';
|
3
|
+
import { AXTranslatorDirective } from './translator.directive';
|
4
|
+
import { AXTranslationService } from './translation.service';
|
5
|
+
import { AX_TRANSLATION_CONFIG, } from './translation.config';
|
6
|
+
import * as i0 from "@angular/core";
|
7
|
+
function initializeApp(translatorService, config) {
|
8
|
+
return () => {
|
9
|
+
return translatorService.loadLanguagesAndScopes(config.preloadLangs ?? [config.defaultLang], config.preloadScopes ?? [config.defaultScope]);
|
10
|
+
};
|
11
|
+
}
|
12
|
+
export class AXTranslationModule {
|
13
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
14
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe, AXTranslatorDirective], exports: [AXTranslatorPipe, AXTranslatorDirective] }); }
|
15
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXTranslationModule, providers: [
|
16
|
+
{
|
17
|
+
provide: APP_INITIALIZER,
|
18
|
+
useFactory: initializeApp,
|
19
|
+
deps: [AXTranslationService, AX_TRANSLATION_CONFIG],
|
20
|
+
multi: true,
|
21
|
+
},
|
22
|
+
] }); }
|
23
|
+
}
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXTranslationModule, decorators: [{
|
25
|
+
type: NgModule,
|
26
|
+
args: [{
|
27
|
+
imports: [],
|
28
|
+
exports: [AXTranslatorPipe, AXTranslatorDirective],
|
29
|
+
declarations: [AXTranslatorPipe, AXTranslatorDirective],
|
30
|
+
providers: [
|
31
|
+
{
|
32
|
+
provide: APP_INITIALIZER,
|
33
|
+
useFactory: initializeApp,
|
34
|
+
deps: [AXTranslationService, AX_TRANSLATION_CONFIG],
|
35
|
+
multi: true,
|
36
|
+
},
|
37
|
+
],
|
38
|
+
}]
|
39
|
+
}] });
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRpb24ubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL3RyYW5zbGF0aW9uL3NyYy9saWIvdHJhbnNsYXRpb24ubW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxlQUFlLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzFELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3JELE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQy9ELE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRTdELE9BQU8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