@acorex/core 7.22.0 → 7.23.0
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/{dateTime → date-time}/README.md +2 -2
- package/{dateTime → date-time}/lib/datetime.class.d.ts +1 -0
- package/{dateTime → date-time}/lib/formatters/datetime-formatter.d.ts +1 -1
- package/{dateTime → date-time}/lib/formatters/timeleft-formatter.d.ts +1 -1
- package/esm2022/acorex-core.mjs +1 -1
- package/esm2022/config/lib/configs.mjs +1 -1
- package/esm2022/config/lib/configs.service.mjs +3 -3
- 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/lib/event.service.mjs +4 -4
- package/esm2022/events/lib/event.type.mjs +1 -1
- package/esm2022/file/lib/file-download-ref.class.mjs +1 -1
- package/esm2022/file/lib/file-size-formatter.mjs +4 -4
- package/esm2022/file/lib/file-upload-ref.class.mjs +1 -1
- package/esm2022/file/lib/file.module.mjs +6 -6
- package/esm2022/file/lib/file.service.mjs +5 -5
- package/esm2022/format/lib/format.config.mjs +1 -1
- package/esm2022/format/lib/format.module.mjs +13 -16
- package/esm2022/format/lib/format.pipe.mjs +10 -6
- package/esm2022/format/lib/format.service.mjs +19 -16
- package/esm2022/format/lib/format.types.mjs +1 -1
- package/esm2022/format/lib/formatters/number-formatter.mjs +6 -7
- package/esm2022/format/lib/formatters/string-formatter.mjs +1 -1
- package/esm2022/image/lib/image.service.mjs +4 -4
- package/esm2022/index.mjs +2 -2
- package/esm2022/lib/core.component.mjs +12 -0
- package/esm2022/memorize/lib/memorize.decorator.mjs +1 -1
- package/esm2022/pipes/lib/safe/safe.pipe.mjs +4 -4
- package/esm2022/platform/lib/platform.service.mjs +47 -42
- package/esm2022/storage/cookie-storage.service.mjs +15 -8
- package/esm2022/storage/local-storage.service.mjs +46 -10
- package/esm2022/storage/session-storage.service.mjs +3 -3
- package/esm2022/translation/lib/translation-scope.resolver.mjs +4 -4
- package/esm2022/translation/lib/translation.config.mjs +2 -2
- package/esm2022/translation/lib/translation.loader.mjs +3 -3
- package/esm2022/translation/lib/translation.module.mjs +10 -10
- package/esm2022/translation/lib/translation.service.mjs +19 -11
- package/esm2022/translation/lib/translation.types.mjs +1 -1
- package/esm2022/translation/lib/translator.directive.mjs +5 -5
- package/esm2022/translation/lib/translator.pipe.mjs +4 -4
- package/esm2022/utils/lib/auto-unsubscribe.mjs +4 -4
- package/esm2022/utils/lib/color-util.mjs +4 -2
- package/esm2022/utils/lib/drawing-util.mjs +6 -3
- package/esm2022/utils/lib/html-util.mjs +17 -3
- package/esm2022/utils/lib/string-util.mjs +1 -1
- package/esm2022/validation/lib/rules/between-rule.mjs +7 -7
- package/esm2022/validation/lib/rules/callback-rule.mjs +10 -7
- package/esm2022/validation/lib/rules/equal-rule.mjs +7 -7
- package/esm2022/validation/lib/rules/greater-than.mjs +12 -8
- package/esm2022/validation/lib/rules/length-rule.mjs +10 -7
- package/esm2022/validation/lib/rules/less-than-rule.mjs +12 -8
- package/esm2022/validation/lib/rules/maxlength-rule.mjs +12 -9
- package/esm2022/validation/lib/rules/minlength-rule.mjs +12 -9
- package/esm2022/validation/lib/rules/regex-rule.mjs +15 -12
- package/esm2022/validation/lib/rules/required-rule.mjs +14 -14
- package/esm2022/validation/lib/validation.config.mjs +3 -3
- package/esm2022/validation/lib/validation.module.mjs +15 -19
- package/esm2022/validation/lib/validation.service.mjs +19 -16
- package/esm2022/validation/lib/validation.types.mjs +1 -1
- package/fesm2022/acorex-core-config.mjs +3 -3
- package/fesm2022/acorex-core-config.mjs.map +1 -1
- package/fesm2022/{acorex-core-dateTime.mjs → acorex-core-date-time.mjs} +96 -45
- package/fesm2022/acorex-core-date-time.mjs.map +1 -0
- package/fesm2022/acorex-core-events.mjs +3 -3
- package/fesm2022/acorex-core-events.mjs.map +1 -1
- package/fesm2022/acorex-core-file.mjs +12 -12
- package/fesm2022/acorex-core-file.mjs.map +1 -1
- package/fesm2022/acorex-core-format.mjs +43 -40
- package/fesm2022/acorex-core-format.mjs.map +1 -1
- package/fesm2022/acorex-core-image.mjs +3 -3
- package/fesm2022/acorex-core-image.mjs.map +1 -1
- package/fesm2022/acorex-core-memorize.mjs.map +1 -1
- package/fesm2022/acorex-core-pipes.mjs +3 -3
- package/fesm2022/acorex-core-pipes.mjs.map +1 -1
- package/fesm2022/acorex-core-platform.mjs +46 -41
- package/fesm2022/acorex-core-platform.mjs.map +1 -1
- package/fesm2022/acorex-core-storage.mjs +63 -20
- package/fesm2022/acorex-core-storage.mjs.map +1 -1
- package/fesm2022/acorex-core-translation.mjs +31 -23
- package/fesm2022/acorex-core-translation.mjs.map +1 -1
- package/fesm2022/acorex-core-utils.mjs +27 -8
- package/fesm2022/acorex-core-utils.mjs.map +1 -1
- package/fesm2022/acorex-core-validation.mjs +110 -88
- package/fesm2022/acorex-core-validation.mjs.map +1 -1
- package/fesm2022/acorex-core.mjs +14 -1
- package/fesm2022/acorex-core.mjs.map +1 -1
- package/file/lib/file-size-formatter.d.ts +1 -1
- package/format/lib/format.config.d.ts +1 -1
- package/format/lib/format.service.d.ts +5 -5
- package/format/lib/formatters/number-formatter.d.ts +1 -1
- package/format/lib/formatters/string-formatter.d.ts +1 -1
- package/index.d.ts +1 -2
- package/lib/core.component.d.ts +5 -0
- package/package.json +15 -15
- package/storage/local-storage.service.d.ts +6 -0
- package/translation/lib/translation-scope.resolver.d.ts +1 -1
- package/translation/lib/translation.config.d.ts +2 -2
- package/translation/lib/translation.loader.d.ts +3 -3
- package/validation/lib/rules/between-rule.d.ts +2 -2
- package/validation/lib/rules/callback-rule.d.ts +2 -2
- package/validation/lib/rules/equal-rule.d.ts +2 -2
- package/validation/lib/rules/greater-than.d.ts +2 -2
- package/validation/lib/rules/length-rule.d.ts +2 -2
- package/validation/lib/rules/less-than-rule.d.ts +2 -2
- package/validation/lib/rules/maxlength-rule.d.ts +2 -2
- package/validation/lib/rules/minlength-rule.d.ts +2 -2
- package/validation/lib/rules/regex-rule.d.ts +2 -2
- package/validation/lib/rules/required-rule.d.ts +2 -2
- package/validation/lib/validation.service.d.ts +4 -4
- package/esm2022/dateTime/acorex-core-dateTime.mjs +0 -5
- package/esm2022/dateTime/index.mjs +0 -11
- package/esm2022/dateTime/lib/calendar.service.mjs +0 -91
- package/esm2022/dateTime/lib/dateTime.config.mjs +0 -50
- package/esm2022/dateTime/lib/datetime.class.mjs +0 -325
- package/esm2022/dateTime/lib/datetime.module.mjs +0 -21
- package/esm2022/dateTime/lib/datetime.pipe.mjs +0 -29
- package/esm2022/dateTime/lib/formatters/datetime-formatter.mjs +0 -30
- package/esm2022/dateTime/lib/formatters/timeleft-formatter.mjs +0 -91
- package/esm2022/dateTime/lib/georgian.calendar.mjs +0 -198
- package/esm2022/dateTime/lib/holidays.loader.mjs +0 -13
- package/esm2022/dateTime/lib/jalali.calendar.mjs +0 -423
- package/fesm2022/acorex-core-dateTime.mjs.map +0 -1
- /package/{dateTime → date-time}/index.d.ts +0 -0
- /package/{dateTime → date-time}/lib/calendar.service.d.ts +0 -0
- /package/{dateTime → date-time}/lib/dateTime.config.d.ts +0 -0
- /package/{dateTime → date-time}/lib/datetime.module.d.ts +0 -0
- /package/{dateTime → date-time}/lib/datetime.pipe.d.ts +0 -0
- /package/{dateTime → date-time}/lib/georgian.calendar.d.ts +0 -0
- /package/{dateTime → date-time}/lib/holidays.loader.d.ts +0 -0
- /package/{dateTime → date-time}/lib/jalali.calendar.d.ts +0 -0
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Injectable, Injector, inject } from
|
2
|
-
import { AX_VALIDATION_CONFIG } from
|
3
|
-
import { AXTranslationService } from
|
4
|
-
import { merge } from
|
1
|
+
import { Injectable, Injector, inject } from '@angular/core';
|
2
|
+
import { AX_VALIDATION_CONFIG, } from './validation.config';
|
3
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
4
|
+
import { merge } from 'lodash-es';
|
5
5
|
import * as i0 from "@angular/core";
|
6
6
|
import * as i1 from "@acorex/core/translation";
|
7
7
|
export class AXValidationRegistryService {
|
@@ -14,10 +14,13 @@ export class AXValidationRegistryService {
|
|
14
14
|
this.injector = injector;
|
15
15
|
}
|
16
16
|
register(...plugins) {
|
17
|
-
plugins.forEach(t => {
|
18
|
-
const childInjector = Injector.create({
|
17
|
+
plugins.forEach((t) => {
|
18
|
+
const childInjector = Injector.create({
|
19
|
+
providers: [{ provide: t, useClass: t, deps: [] }],
|
20
|
+
parent: this.injector,
|
21
|
+
});
|
19
22
|
const v = childInjector.get(t);
|
20
|
-
if (v && !this.plugins.some(p => p.name == v.name)) {
|
23
|
+
if (v && !this.plugins.some((p) => p.name == v.name)) {
|
21
24
|
this.plugins.push(v);
|
22
25
|
}
|
23
26
|
});
|
@@ -25,13 +28,13 @@ export class AXValidationRegistryService {
|
|
25
28
|
get(ruleName) {
|
26
29
|
return this.plugins.find((c) => c.name == ruleName);
|
27
30
|
}
|
28
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.
|
29
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.
|
31
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXValidationRegistryService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
32
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXValidationRegistryService, providedIn: 'root' }); }
|
30
33
|
}
|
31
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXValidationRegistryService, decorators: [{
|
32
35
|
type: Injectable,
|
33
36
|
args: [{
|
34
|
-
providedIn: 'root'
|
37
|
+
providedIn: 'root',
|
35
38
|
}]
|
36
39
|
}], ctorParameters: () => [{ type: i0.Injector }] });
|
37
40
|
export class AXValidationService {
|
@@ -47,7 +50,7 @@ export class AXValidationService {
|
|
47
50
|
rule: ruleName,
|
48
51
|
result: false,
|
49
52
|
message: await this.translationService.translateAsync('validation.messages.invalid-rull-name', { params: { name: ruleName } }),
|
50
|
-
value
|
53
|
+
value,
|
51
54
|
};
|
52
55
|
}
|
53
56
|
if (options?.message) {
|
@@ -63,10 +66,10 @@ export class AXValidationService {
|
|
63
66
|
ruleFor(value) {
|
64
67
|
return new AXValidationRuleChain(this, value);
|
65
68
|
}
|
66
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.
|
67
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.
|
69
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXValidationService, deps: [{ token: AXValidationRegistryService }, { token: i1.AXTranslationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
70
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXValidationService, providedIn: 'root' }); }
|
68
71
|
}
|
69
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXValidationService, decorators: [{
|
70
73
|
type: Injectable,
|
71
74
|
args: [{ providedIn: 'root' }]
|
72
75
|
}], ctorParameters: () => [{ type: AXValidationRegistryService }, { type: i1.AXTranslationService }] });
|
@@ -92,4 +95,4 @@ class AXValidationRuleChain {
|
|
92
95
|
return this.validationSummary;
|
93
96
|
}
|
94
97
|
}
|
95
|
-
//# sourceMappingURL=data:application/json;base64,
|
98
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGlvbi5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL3ZhbGlkYXRpb24vc3JjL2xpYi92YWxpZGF0aW9uLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBUTdELE9BQU8sRUFFTCxvQkFBb0IsR0FDckIsTUFBTSxxQkFBcUIsQ0FBQztBQUM3QixPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0sV0FBVyxDQUFDOzs7QUFLbEMsTUFBTSxPQUFPLDJCQUEyQjtJQUt0QyxJQUFXLFdBQVc7UUFDcEIsT0FBTyxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQztJQUM1QixDQUFDO0lBSUQsWUFBWSxRQUFrQjtRQVZ0QixZQUFPLEdBQXVCLEVBQUUsQ0FBQztRQUVqQyxZQUFPLEdBQUcsTUFBTSxDQUFDLG9CQUFvQixDQUFDLENBQUM7UUFTN0MsSUFBSSxDQUFDLFFBQVEsR0FBRyxRQUFR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ZGF0aW9uUnVsZU9wdGlvbnNNYXA+KFxuICAgIG5hbWU6IEssXG4gICAgb3B0aW9ucz86IEFYVmFsaWRhdGlvblJ1bGVPcHRpb25zTWFwW0tdXG4gICk6IEFYVmFsaWRhdGlvblJ1bGVDaGFpbiB7XG4gICAgdGhpcy5ydWxlcy5wdXNoKHsgbmFtZSwgb3B0aW9ucyB9KTtcbiAgICByZXR1cm4gdGhpcztcbiAgfVxuXG4gIGFzeW5jIHZhbGlkYXRlKCk6IFByb21pc2U8QVhWYWxpZGF0aW9uU3VtbWFyeT4ge1xuICAgIGZvciAoY29uc3QgcnVsZSBvZiB0aGlzLnJ1bGVzKSB7XG4gICAgICBjb25zdCByZXN1bHQgPSBhd2FpdCB0aGlzLnZhbGlkYXRpb25TZXJ2aWNlLnZhbGlkYXRlKFxuICAgICAgICBydWxlLm5hbWUsXG4gICAgICAgIHRoaXMuaW5pdGlhbFZhbHVlLFxuICAgICAgICBydWxlLm9wdGlvbnNcbiAgICAgICk7XG4gICAgICB0aGlzLnZhbGlkYXRpb25TdW1tYXJ5LnJ1bGVzLnB1c2gocmVzdWx0KTtcbiAgICAgIGlmICghcmVzdWx0LnJlc3VsdCkge1xuICAgICAgICB0aGlzLnZhbGlkYXRpb25TdW1tYXJ5LnJlc3VsdCA9IGZhbHNlO1xuICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gdGhpcy52YWxpZGF0aW9uU3VtbWFyeTtcbiAgfVxufVxuIl19
|
@@ -1,3 +1,3 @@
|
|
1
1
|
export class AXValidationRule {
|
2
2
|
}
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGlvbi50eXBlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS92YWxpZGF0aW9uL3NyYy9saWIvdmFsaWRhdGlvbi50eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFTQSxNQUFNLE9BQWdCLGdCQUFnQjtDQU1yQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBpbnRlcmZhY2UgQVhWYWxpZGF0aW9uUnVsZU9wdGlvbnMge1xuICBtZXNzYWdlPzogc3RyaW5nO1xuICBba2V5OiBzdHJpbmddOiB1bmtub3duO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIEFYVmFsaWRhdGlvblJ1bGVPcHRpb25zTWFwIHtcbiAgLy8gaW5pdGlhbGx5IGVtcHR5LCBidXQgd2lsbCBiZSBleHRlbmRlZCBieSBvdGhlciBtb2R1bGVzXG59XG5cbmV4cG9ydCBhYnN0cmFjdCBjbGFzcyBBWFZhbGlkYXRpb25SdWxlIHtcbiAgYWJzdHJhY3QgZ2V0IG5hbWUoKTogc3RyaW5nO1xuICBhYnN0cmFjdCB2YWxpZGF0ZShcbiAgICB2YWx1ZTogdW5rbm93bixcbiAgICBvcHRpb25zPzogQVhWYWxpZGF0aW9uUnVsZU9wdGlvbnNcbiAgKTogUHJvbWlzZTxBWFZhbGlkYXRpb25SdWxlUmVzdWx0Pjtcbn1cblxuZXhwb3J0IGludGVyZmFjZSBBWFZhbGlkYXRpb25SdWxlUmVzdWx0IHtcbiAgcnVsZTogc3RyaW5nO1xuICB2YWx1ZT86IHVua25vd247XG4gIG1lc3NhZ2U/OiBzdHJpbmcgfCBudWxsO1xuICByZXN1bHQ6IGJvb2xlYW47XG4gIFtrZXk6IHN0cmluZ106IHVua25vd247XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgQVhWYWxpZGF0aW9uU3VtbWFyeSB7XG4gIHJlc3VsdDogYm9vbGVhbjtcbiAgcnVsZXM6IEFYVmFsaWRhdGlvblJ1bGVSZXN1bHRbXTtcbn1cbiJdfQ==
|
@@ -23,10 +23,10 @@ class AXConfigService {
|
|
23
23
|
const v2 = this.injector.get(providerToken);
|
24
24
|
return get(v2, parts[parts.length - 1], defaultValue);
|
25
25
|
}
|
26
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.
|
27
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.
|
26
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXConfigService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
27
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXConfigService, providedIn: 'root' }); }
|
28
28
|
}
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXConfigService, decorators: [{
|
30
30
|
type: Injectable,
|
31
31
|
args: [{ providedIn: 'root' }]
|
32
32
|
}], ctorParameters: () => [{ type: i0.Injector }] });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-config.mjs","sources":["../../../../libs/core/config/src/lib/configs.ts","../../../../libs/core/config/src/lib/configs.service.ts","../../../../libs/core/config/src/acorex-core-config.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport type AXGlobalConfig = {\n [key: string]: unknown;\n};\n\nexport const AXGlobalDefaultConfig: AXGlobalConfig = {};\n\nexport const AX_GLOBAL_CONFIG = new InjectionToken<AXGlobalConfig>('AX_GLOBAL_CONFIG'
|
1
|
+
{"version":3,"file":"acorex-core-config.mjs","sources":["../../../../libs/core/config/src/lib/configs.ts","../../../../libs/core/config/src/lib/configs.service.ts","../../../../libs/core/config/src/acorex-core-config.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport type AXGlobalConfig = {\n [key: string]: unknown;\n};\n\nexport const AXGlobalDefaultConfig: AXGlobalConfig = {};\n\nexport const AX_GLOBAL_CONFIG = new InjectionToken<AXGlobalConfig>(\n 'AX_GLOBAL_CONFIG',\n {\n providedIn: 'root',\n factory: () => AXGlobalDefaultConfig,\n }\n);\n","import { Injectable, InjectionToken, Injector } from '@angular/core';\nimport { get } from 'lodash-es';\nimport { AX_GLOBAL_CONFIG } from './configs';\n\n@Injectable({ providedIn: 'root' })\nexport class AXConfigService {\n /**\n * @ignore\n */\n constructor(private injector: Injector) {}\n\n public get<T = string>(key: string, defaultValue?: T) {\n const v1 = this.injector.get(AX_GLOBAL_CONFIG);\n const parts = key.split('.');\n const tokenName = parts.slice(0, parts.length - 1).join('.');\n const providerToken = get(v1, tokenName);\n const v2 = this.injector.get(providerToken as InjectionToken<unknown>);\n return get(v2, parts[parts.length - 1], defaultValue);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAMO,MAAM,qBAAqB,GAAmB,GAAG;MAE3C,gBAAgB,GAAG,IAAI,cAAc,CAChD,kBAAkB,EAClB;AACE,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,qBAAqB;AACrC,CAAA;;MCRU,eAAe,CAAA;AAC1B;;AAEG;AACH,IAAA,WAAA,CAAoB,QAAkB,EAAA;QAAlB,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;KAAI;IAEnC,GAAG,CAAa,GAAW,EAAE,YAAgB,EAAA;QAClD,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC7B,QAAA,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7D,MAAM,aAAa,GAAG,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;QACzC,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAwC,CAAC,CAAC;AACvE,QAAA,OAAO,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;KACvD;8GAbU,eAAe,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,QAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAAf,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,eAAe,cADF,MAAM,EAAA,CAAA,CAAA,EAAA;;2FACnB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;;ACJlC;;AAEG;;;;"}
|
@@ -3,6 +3,7 @@ import { InjectionToken, inject, Injectable, Pipe, NgModule } from '@angular/cor
|
|
3
3
|
import { BehaviorSubject, Subject } from 'rxjs';
|
4
4
|
import { AX_GLOBAL_CONFIG } from '@acorex/core/config';
|
5
5
|
import { defaults, orderBy, set, isNil } from 'lodash-es';
|
6
|
+
import { isBrowser } from '@acorex/core/platform';
|
6
7
|
import { translateSync } from '@acorex/core/translation';
|
7
8
|
import { AXEventTypes, AXEventService } from '@acorex/core/events';
|
8
9
|
import * as i1 from '@acorex/core/format';
|
@@ -77,6 +78,7 @@ class AXDateTime {
|
|
77
78
|
//
|
78
79
|
datetime: (options) => this.format('date time', { locale: options.locale }),
|
79
80
|
};
|
81
|
+
this._language = () => (isBrowser() ? navigator.language : 'en-GB');
|
80
82
|
this._calendar = calendar;
|
81
83
|
this._date = value;
|
82
84
|
}
|
@@ -131,9 +133,9 @@ class AXDateTime {
|
|
131
133
|
endOf(unit = 'day') {
|
132
134
|
return this._calendar.endOf(this.date, unit);
|
133
135
|
}
|
134
|
-
format(format = this.getDateTimeFormatByLocale(
|
136
|
+
format(format = this.getDateTimeFormatByLocale(this._language(), 'shortDate'), options) {
|
135
137
|
const effectiveOptions = defaults({}, options, {
|
136
|
-
locale:
|
138
|
+
locale: this._language(),
|
137
139
|
});
|
138
140
|
const re = new RegExp(orderBy(Object.keys(this._formatKeys), (c) => c.length, ['desc']).join('|'), 'gi');
|
139
141
|
return format.replace(re, (matched) => {
|
@@ -149,13 +151,23 @@ class AXDateTime {
|
|
149
151
|
options = { year: 'numeric', month: '2-digit', day: '2-digit' };
|
150
152
|
break;
|
151
153
|
case 'longDate': // Weekday, Month name, Day, Year
|
152
|
-
options = {
|
154
|
+
options = {
|
155
|
+
weekday: 'long',
|
156
|
+
year: 'numeric',
|
157
|
+
month: 'long',
|
158
|
+
day: 'numeric',
|
159
|
+
};
|
153
160
|
break;
|
154
161
|
case 'shortTime': // Hour, Minute
|
155
162
|
options = { hour: '2-digit', minute: '2-digit', hour12: false };
|
156
163
|
break;
|
157
164
|
case 'longTime': // Hour, Minute, Second
|
158
|
-
options = {
|
165
|
+
options = {
|
166
|
+
hour: '2-digit',
|
167
|
+
minute: '2-digit',
|
168
|
+
second: '2-digit',
|
169
|
+
hour12: false,
|
170
|
+
};
|
159
171
|
break;
|
160
172
|
}
|
161
173
|
const formatter = new Intl.DateTimeFormat(locale, options);
|
@@ -364,7 +376,10 @@ class GeorgianCalendar extends AXCalendar {
|
|
364
376
|
}
|
365
377
|
weekOfYear(date) {
|
366
378
|
const firstDay = new AXDateTime(date, this).startOf('year');
|
367
|
-
return Math.ceil(((date.getTime() - firstDay.date.getTime()) / 86400000 +
|
379
|
+
return Math.ceil(((date.getTime() - firstDay.date.getTime()) / 86400000 +
|
380
|
+
firstDay.date.getDay() +
|
381
|
+
1) /
|
382
|
+
7);
|
368
383
|
}
|
369
384
|
year(date) {
|
370
385
|
return date.getFullYear();
|
@@ -418,7 +433,9 @@ class GeorgianCalendar extends AXCalendar {
|
|
418
433
|
newDate.setFullYear(newDate.getFullYear() + amount);
|
419
434
|
// Handling for leap years: if the original date is February 29th, and the new year is not a leap year,
|
420
435
|
// set the date to February 28th.
|
421
|
-
if (date.getMonth() === 1 &&
|
436
|
+
if (date.getMonth() === 1 &&
|
437
|
+
date.getDate() === 29 &&
|
438
|
+
newDate.getMonth() !== 1) {
|
422
439
|
newDate.setMonth(1);
|
423
440
|
newDate.setDate(28);
|
424
441
|
}
|
@@ -538,8 +555,8 @@ class JalaliCalendar extends AXCalendar {
|
|
538
555
|
Jalaali years starting the 33-year rule.
|
539
556
|
*/
|
540
557
|
this.breaks = [
|
541
|
-
-61, 9, 38, 199, 426, 686, 756, 818, 1111, 1181, 1210, 1635, 2060, 2097,
|
542
|
-
3178,
|
558
|
+
-61, 9, 38, 199, 426, 686, 756, 818, 1111, 1181, 1210, 1635, 2060, 2097,
|
559
|
+
2192, 2262, 2324, 2394, 2456, 3178,
|
543
560
|
];
|
544
561
|
}
|
545
562
|
create(value) {
|
@@ -554,7 +571,7 @@ class JalaliCalendar extends AXCalendar {
|
|
554
571
|
}
|
555
572
|
dayOfYear(date) {
|
556
573
|
const j = this.toJalaali(date);
|
557
|
-
return (j.month <= 6 ? (j.month - 1) * 31 : 6 * 31 + (j.month - 7) * 30) + j.day;
|
574
|
+
return ((j.month <= 6 ? (j.month - 1) * 31 : 6 * 31 + (j.month - 7) * 30) + j.day);
|
558
575
|
}
|
559
576
|
dayOfWeek(date) {
|
560
577
|
return date.getDay() == 6 ? 1 : date.getDay() + 2;
|
@@ -562,7 +579,10 @@ class JalaliCalendar extends AXCalendar {
|
|
562
579
|
weekOfYear(date) {
|
563
580
|
//TODO : apply jalali
|
564
581
|
const firstDay = new AXDateTime(date, this).startOf('year');
|
565
|
-
return Math.ceil(((date.getTime() - firstDay.date.getTime()) / 86400000 +
|
582
|
+
return Math.ceil(((date.getTime() - firstDay.date.getTime()) / 86400000 +
|
583
|
+
firstDay.date.getDay() +
|
584
|
+
1) /
|
585
|
+
7);
|
566
586
|
}
|
567
587
|
year(date) {
|
568
588
|
return this.toJalaali(date).year;
|
@@ -693,7 +713,9 @@ class JalaliCalendar extends AXCalendar {
|
|
693
713
|
clone.setHours(0, 0, 0, 0);
|
694
714
|
return new AXDateTime(clone, this);
|
695
715
|
case 'week':
|
696
|
-
return new AXDateTime(clone, this)
|
716
|
+
return new AXDateTime(clone, this)
|
717
|
+
.add('day', -this.dayOfWeek(clone) + 1)
|
718
|
+
.startOf('day');
|
697
719
|
case 'month': {
|
698
720
|
const jy = this.year(date);
|
699
721
|
const jm = this.monthOfYear(date);
|
@@ -778,7 +800,12 @@ class JalaliCalendar extends AXCalendar {
|
|
778
800
|
Checks whether a Jalaali date is valid or not.
|
779
801
|
*/
|
780
802
|
isValidJalaaliDate(jy, jm, jd) {
|
781
|
-
return jy >= -61 &&
|
803
|
+
return (jy >= -61 &&
|
804
|
+
jy <= 3177 &&
|
805
|
+
jm >= 1 &&
|
806
|
+
jm <= 12 &&
|
807
|
+
jd >= 1 &&
|
808
|
+
jd <= this.jalaaliMonthLength(jy, jm));
|
782
809
|
}
|
783
810
|
/*
|
784
811
|
Is this a leap year or not?
|
@@ -866,7 +893,11 @@ class JalaliCalendar extends AXCalendar {
|
|
866
893
|
}
|
867
894
|
j2d(jy, jm, jd) {
|
868
895
|
let r = this.jalCal(jy, true);
|
869
|
-
return this.g2d(r.gy, 3, r.march) +
|
896
|
+
return (this.g2d(r.gy, 3, r.march) +
|
897
|
+
(jm - 1) * 31 -
|
898
|
+
this.div(jm, 7) * (jm - 7) +
|
899
|
+
jd -
|
900
|
+
1);
|
870
901
|
}
|
871
902
|
d2j(jdn) {
|
872
903
|
let gy = this.d2g(jdn).gy, // Calculate Gregorian year (gy).
|
@@ -909,7 +940,10 @@ class JalaliCalendar extends AXCalendar {
|
|
909
940
|
this.div(153 * this.mod(gm + 9, 12) + 2, 5) +
|
910
941
|
gd -
|
911
942
|
34840408;
|
912
|
-
d =
|
943
|
+
d =
|
944
|
+
d -
|
945
|
+
this.div(this.div(gy + 100100 + this.div(gm - 8, 6), 100) * 3, 4) +
|
946
|
+
752;
|
913
947
|
return d;
|
914
948
|
}
|
915
949
|
d2g(jdn) {
|
@@ -1021,7 +1055,10 @@ class AXCalendarService {
|
|
1021
1055
|
if (name != this.calendar.name()) {
|
1022
1056
|
const calendar = this.resolveCalendar(name);
|
1023
1057
|
this.activeCalendar.next(calendar);
|
1024
|
-
this.eventService.emitEvent({
|
1058
|
+
this.eventService.emitEvent({
|
1059
|
+
type: AXEventTypes.AXCalendarChanged,
|
1060
|
+
payload: this.getActiveCalendar(),
|
1061
|
+
});
|
1025
1062
|
}
|
1026
1063
|
}
|
1027
1064
|
get holidays() {
|
@@ -1044,7 +1081,9 @@ class AXCalendarService {
|
|
1044
1081
|
});
|
1045
1082
|
}
|
1046
1083
|
create(value, calendarName) {
|
1047
|
-
const calendar = calendarName
|
1084
|
+
const calendar = calendarName
|
1085
|
+
? this.resolveCalendar(calendarName)
|
1086
|
+
: this.calendar;
|
1048
1087
|
if (value instanceof Date) {
|
1049
1088
|
return new AXDateTime(value, calendar);
|
1050
1089
|
}
|
@@ -1054,7 +1093,9 @@ class AXCalendarService {
|
|
1054
1093
|
return this.now();
|
1055
1094
|
}
|
1056
1095
|
now(calendarName) {
|
1057
|
-
const calendar = calendarName
|
1096
|
+
const calendar = calendarName
|
1097
|
+
? this.resolveCalendar(calendarName)
|
1098
|
+
: this.calendar;
|
1058
1099
|
return new AXDateTime(new Date(), calendar);
|
1059
1100
|
}
|
1060
1101
|
resolveCalendar(name) {
|
@@ -1073,7 +1114,9 @@ class AXCalendarService {
|
|
1073
1114
|
return d instanceof Date && !isNaN(d.getTime()); // valid date
|
1074
1115
|
};
|
1075
1116
|
//
|
1076
|
-
const calendar = calendarName
|
1117
|
+
const calendar = calendarName
|
1118
|
+
? this.resolveCalendar(calendarName)
|
1119
|
+
: this.calendar;
|
1077
1120
|
if (typeof value === 'string') {
|
1078
1121
|
if (isISOString(value))
|
1079
1122
|
return new AXDateTime(new Date(value), calendar);
|
@@ -1083,10 +1126,10 @@ class AXCalendarService {
|
|
1083
1126
|
const date = value instanceof AXDateTime ? value.date : value;
|
1084
1127
|
return new AXDateTime(date, calendar);
|
1085
1128
|
}
|
1086
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.
|
1087
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.
|
1129
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXCalendarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1130
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXCalendarService, providedIn: 'root' }); }
|
1088
1131
|
}
|
1089
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.
|
1132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXCalendarService, decorators: [{
|
1090
1133
|
type: Injectable,
|
1091
1134
|
args: [{ providedIn: 'root' }]
|
1092
1135
|
}], ctorParameters: () => [] });
|
@@ -1099,22 +1142,24 @@ class AXDateTimeFormatter {
|
|
1099
1142
|
return 'datetime';
|
1100
1143
|
}
|
1101
1144
|
format(value, options) {
|
1102
|
-
const effectiveOptions = typeof options == 'object'
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1145
|
+
const effectiveOptions = typeof options == 'object'
|
1146
|
+
? {
|
1147
|
+
format: options.format ?? 'date',
|
1148
|
+
locale: options.locale,
|
1149
|
+
calendar: options.calendar ?? this.calendarService.calendar.name(),
|
1150
|
+
}
|
1151
|
+
: {
|
1152
|
+
format: options,
|
1153
|
+
calendar: this.calendarService.calendar.name(),
|
1154
|
+
};
|
1110
1155
|
return this.calendarService
|
1111
1156
|
.create(value, effectiveOptions.calendar)
|
1112
1157
|
.format(effectiveOptions.format, { locale: effectiveOptions.locale });
|
1113
1158
|
}
|
1114
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.
|
1115
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.
|
1159
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXDateTimeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1160
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXDateTimeFormatter }); }
|
1116
1161
|
}
|
1117
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.
|
1162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXDateTimeFormatter, decorators: [{
|
1118
1163
|
type: Injectable
|
1119
1164
|
}] });
|
1120
1165
|
|
@@ -1125,7 +1170,7 @@ class AXTimeLeftFormatter {
|
|
1125
1170
|
format(value, options) {
|
1126
1171
|
const milliseconds = Number(value);
|
1127
1172
|
if (milliseconds === null || isNaN(milliseconds)) {
|
1128
|
-
return
|
1173
|
+
return 'Calculating...';
|
1129
1174
|
}
|
1130
1175
|
const durationInSeconds = Math.round(milliseconds / 1000);
|
1131
1176
|
let format = options?.format;
|
@@ -1199,10 +1244,10 @@ class AXTimeLeftFormatter {
|
|
1199
1244
|
return 'Invalid format';
|
1200
1245
|
}
|
1201
1246
|
}
|
1202
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.
|
1203
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.
|
1247
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXTimeLeftFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1248
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXTimeLeftFormatter }); }
|
1204
1249
|
}
|
1205
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.
|
1250
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXTimeLeftFormatter, decorators: [{
|
1206
1251
|
type: Injectable
|
1207
1252
|
}] });
|
1208
1253
|
|
@@ -1224,23 +1269,29 @@ class AXDateTimePipe {
|
|
1224
1269
|
const val = this._calendarService.convert(value, calendar.name());
|
1225
1270
|
return val.format(format);
|
1226
1271
|
}
|
1227
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.
|
1228
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.2.
|
1272
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
1273
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.2.4", ngImport: i0, type: AXDateTimePipe, name: "axDate" }); }
|
1229
1274
|
}
|
1230
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.
|
1275
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXDateTimePipe, decorators: [{
|
1231
1276
|
type: Pipe,
|
1232
1277
|
args: [{ name: 'axDate' }]
|
1233
1278
|
}] });
|
1234
1279
|
|
1235
1280
|
class AXDateTimeModule {
|
1236
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.
|
1237
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.
|
1238
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.
|
1281
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1282
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.4", ngImport: i0, type: AXDateTimeModule, declarations: [AXDateTimePipe], imports: [i1.AXFormatModule], exports: [AXDateTimePipe] }); }
|
1283
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXDateTimeModule, imports: [AXFormatModule.forChild({
|
1284
|
+
formatters: [AXDateTimeFormatter, AXTimeLeftFormatter],
|
1285
|
+
})] }); }
|
1239
1286
|
}
|
1240
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.
|
1287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: AXDateTimeModule, decorators: [{
|
1241
1288
|
type: NgModule,
|
1242
1289
|
args: [{
|
1243
|
-
imports: [
|
1290
|
+
imports: [
|
1291
|
+
AXFormatModule.forChild({
|
1292
|
+
formatters: [AXDateTimeFormatter, AXTimeLeftFormatter],
|
1293
|
+
}),
|
1294
|
+
],
|
1244
1295
|
exports: [AXDateTimePipe],
|
1245
1296
|
declarations: [AXDateTimePipe],
|
1246
1297
|
}]
|
@@ -1251,4 +1302,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImpor
|
|
1251
1302
|
*/
|
1252
1303
|
|
1253
1304
|
export { AXCalendar, AXCalendarMonth, AXCalendarService, AXDateTime, AXDateTimeDefaultConfig, AXDateTimeFormatter, AXDateTimeModule, AXDateTimePipe, AXDateTimeRange, AXHolidaysLoaderDefault, AXTimeLeftFormatter, AX_DATETIME_CONFIG, AX_DATETIME_HOLIDAYS_LOADER, GeorgianCalendar, JalaliCalendar, dateTimeConfig };
|
1254
|
-
//# sourceMappingURL=acorex-core-
|
1305
|
+
//# sourceMappingURL=acorex-core-date-time.mjs.map
|