@acorex/core 20.1.13 → 20.1.15
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/date-time/index.d.ts +24 -2
- package/fesm2022/acorex-core-components.mjs +3 -3
- package/fesm2022/acorex-core-components.mjs.map +1 -1
- package/fesm2022/acorex-core-config.mjs +3 -3
- package/fesm2022/acorex-core-config.mjs.map +1 -1
- package/fesm2022/acorex-core-date-time.mjs +158 -94
- package/fesm2022/acorex-core-date-time.mjs.map +1 -1
- package/fesm2022/acorex-core-events.mjs +3 -3
- package/fesm2022/acorex-core-events.mjs.map +1 -1
- package/fesm2022/acorex-core-file.mjs +10 -10
- package/fesm2022/acorex-core-file.mjs.map +1 -1
- package/fesm2022/acorex-core-format.mjs +19 -19
- package/fesm2022/acorex-core-format.mjs.map +1 -1
- package/fesm2022/acorex-core-icon.mjs +3 -3
- package/fesm2022/acorex-core-icon.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-locale.mjs +11 -11
- package/fesm2022/acorex-core-locale.mjs.map +1 -1
- package/fesm2022/acorex-core-network.mjs +4 -4
- package/fesm2022/acorex-core-network.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 +4 -4
- package/fesm2022/acorex-core-platform.mjs.map +1 -1
- package/fesm2022/acorex-core-storage.mjs +9 -9
- package/fesm2022/acorex-core-storage.mjs.map +1 -1
- package/fesm2022/acorex-core-translation.mjs +16 -16
- package/fesm2022/acorex-core-translation.mjs.map +1 -1
- package/fesm2022/acorex-core-utils.mjs +3 -3
- package/fesm2022/acorex-core-utils.mjs.map +1 -1
- package/fesm2022/acorex-core-validation.mjs +40 -40
- package/fesm2022/acorex-core-validation.mjs.map +1 -1
- package/package.json +1 -1
package/date-time/index.d.ts
CHANGED
@@ -105,6 +105,27 @@ declare class AXDateTime {
|
|
105
105
|
private pad;
|
106
106
|
equal(value: Date | AXDateTime, unit?: TimeUnit): boolean;
|
107
107
|
compare(value: Date | AXDateTime, unit?: TimeUnit): number;
|
108
|
+
/**
|
109
|
+
* Checks if the current date is after the provided date.
|
110
|
+
* @param value The date to compare against.
|
111
|
+
* @param unit The unit of measurement for comparison (e.g., 'day', 'hour'). Defaults to 'ms' for precise comparison.
|
112
|
+
* @returns `true` if the current date is after the provided date, otherwise `false`.
|
113
|
+
*/
|
114
|
+
isAfter(value: AXDateTime | Date, unit?: TimeUnit): boolean;
|
115
|
+
/**
|
116
|
+
* Checks if the current date is before the provided date.
|
117
|
+
* @param value The date to compare against.
|
118
|
+
* @param unit The unit of measurement for comparison (e.g., 'day', 'hour'). Defaults to 'ms' for precise comparison.
|
119
|
+
* @returns `true` if the current date is before the provided date, otherwise `false`.
|
120
|
+
*/
|
121
|
+
isBefore(value: AXDateTime | Date, unit?: TimeUnit): boolean;
|
122
|
+
/**
|
123
|
+
* Checks if the current date is the same as the provided date, up to a specified unit.
|
124
|
+
* @param value The date to compare against.
|
125
|
+
* @param unit The unit of measurement for comparison (e.g., 'day', 'hour'). Defaults to 'ms' for precise comparison.
|
126
|
+
* @returns `true` if the dates are the same for the given unit, otherwise `false`.
|
127
|
+
*/
|
128
|
+
isSame(value: AXDateTime | Date, unit?: TimeUnit): boolean;
|
108
129
|
}
|
109
130
|
declare class AXCalendarMonth {
|
110
131
|
private _range;
|
@@ -142,7 +163,7 @@ declare class AXDateTimeRange {
|
|
142
163
|
get endTime(): AXDateTime;
|
143
164
|
constructor(startTime: AXDateTime, endTime: AXDateTime);
|
144
165
|
duration(): AXTimeSpan;
|
145
|
-
|
166
|
+
enumerate(unit?: TimeUnit, amount?: number): AXDateTime[];
|
146
167
|
}
|
147
168
|
|
148
169
|
interface AXDateTimeFormatterOptions extends AXFormatOptions {
|
@@ -270,8 +291,9 @@ declare module '@acorex/core/format' {
|
|
270
291
|
}
|
271
292
|
}
|
272
293
|
declare class AXTimeLeftFormatter implements AXFormatter {
|
294
|
+
private translateService;
|
273
295
|
get name(): string;
|
274
|
-
format(value: number | string, options?: AXTimeLeftFormatterOptions): string;
|
296
|
+
format(value: number | string | Date, options?: AXTimeLeftFormatterOptions): string;
|
275
297
|
static ɵfac: i0.ɵɵFactoryDeclaration<AXTimeLeftFormatter, never>;
|
276
298
|
static ɵprov: i0.ɵɵInjectableDeclaration<AXTimeLeftFormatter>;
|
277
299
|
}
|
@@ -20,10 +20,10 @@ class AXComponentService {
|
|
20
20
|
async createFromTemplate(content) {
|
21
21
|
return this.getRootViewContainerRef().createEmbeddedView(content);
|
22
22
|
}
|
23
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
24
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
23
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXComponentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
24
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXComponentService, providedIn: 'root' }); }
|
25
25
|
}
|
26
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXComponentService, decorators: [{
|
27
27
|
type: Injectable,
|
28
28
|
args: [{
|
29
29
|
providedIn: 'root',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-components.mjs","sources":["../tmp-esm2022/components/lib/component.service.js","../tmp-esm2022/components/acorex-core-components.js"],"sourcesContent":["import { ApplicationRef, inject, Injectable, ViewContainerRef, } from '@angular/core';\nimport * as i0 from \"@angular/core\";\nexport class AXComponentService {\n constructor() {\n this.appRef = inject(ApplicationRef);\n }\n getRootViewContainerRef() {\n // Get all components in the application\n const components = this.appRef.components;\n if (components.length > 0) {\n const rootComponentRef = components[0];\n return rootComponentRef.injector.get(ViewContainerRef, null);\n }\n return null;\n }\n async createFromComponent(content) {\n return this.getRootViewContainerRef().createComponent(content);\n }\n async createFromTemplate(content) {\n return this.getRootViewContainerRef().createEmbeddedView(content);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.
|
1
|
+
{"version":3,"file":"acorex-core-components.mjs","sources":["../tmp-esm2022/components/lib/component.service.js","../tmp-esm2022/components/acorex-core-components.js"],"sourcesContent":["import { ApplicationRef, inject, Injectable, ViewContainerRef, } from '@angular/core';\nimport * as i0 from \"@angular/core\";\nexport class AXComponentService {\n constructor() {\n this.appRef = inject(ApplicationRef);\n }\n getRootViewContainerRef() {\n // Get all components in the application\n const components = this.appRef.components;\n if (components.length > 0) {\n const rootComponentRef = components[0];\n return rootComponentRef.injector.get(ViewContainerRef, null);\n }\n return null;\n }\n async createFromComponent(content) {\n return this.getRootViewContainerRef().createComponent(content);\n }\n async createFromTemplate(content) {\n return this.getRootViewContainerRef().createEmbeddedView(content);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.1.2\", ngImport: i0, type: AXComponentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"20.1.2\", ngImport: i0, type: AXComponentService, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"20.1.2\", ngImport: i0, type: AXComponentService, decorators: [{\n type: Injectable,\n args: [{\n providedIn: 'root',\n }]\n }] });\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9uZW50LnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6W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VHlwZTxUPik6IFByb21pc2U8Q29tcG9uZW50UmVmPFQ+PiB7XG4gICAgcmV0dXJuIHRoaXMuZ2V0Um9vdFZpZXdDb250YWluZXJSZWYoKS5jcmVhdGVDb21wb25lbnQ8VD4oY29udGVudCk7XG4gIH1cblxuICBhc3luYyBjcmVhdGVGcm9tVGVtcGxhdGU8VD4oY29udGVudDogVGVtcGxhdGVSZWY8VD4pOiBQcm9taXNlPEVtYmVkZGVkVmlld1JlZjxUPj4ge1xuICAgIHJldHVybiB0aGlzLmdldFJvb3RWaWV3Q29udGFpbmVyUmVmKCkuY3JlYXRlRW1iZWRkZWRWaWV3KGNvbnRlbnQpO1xuICB9XG59XG4iXX0=","/**\n * Generated bundle index. Do not edit.\n */\nexport * from './index';\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNvcmV4LWNvcmUtY29tcG9uZW50cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvcmUvY29tcG9uZW50cy9zcmMvYWNvcmV4LWNvcmUtY29tcG9uZW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ=="],"names":[],"mappings":";;;AAEO,MAAM,kBAAkB,CAAC;AAChC,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC;AAC5C;AACA,IAAI,uBAAuB,GAAG;AAC9B;AACA,QAAQ,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU;AACjD,QAAQ,IAAI,UAAU,CAAC,MAAM,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b;AACA;AACA;;;;"}
|
@@ -20,10 +20,10 @@ class AXConfigService {
|
|
20
20
|
const v2 = this.injector.get(providerToken);
|
21
21
|
return get(v2, parts[parts.length - 1], defaultValue);
|
22
22
|
}
|
23
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
24
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
23
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
24
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXConfigService, providedIn: 'root' }); }
|
25
25
|
}
|
26
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXConfigService, decorators: [{
|
27
27
|
type: Injectable,
|
28
28
|
args: [{ providedIn: 'root' }]
|
29
29
|
}] });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-config.mjs","sources":["../tmp-esm2022/config/lib/configs.js","../tmp-esm2022/config/lib/configs.service.js","../tmp-esm2022/config/acorex-core-config.js"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nexport const AXGlobalDefaultConfig = {};\nexport const AX_GLOBAL_CONFIG = new InjectionToken('AX_GLOBAL_CONFIG', {\n providedIn: 'root',\n factory: () => AXGlobalDefaultConfig,\n});\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlncy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvcmUvY29uZmlnL3NyYy9saWIvY29uZmlncy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBTS9DLE1BQU0sQ0FBQyxNQUFNLHFCQUFxQixHQUFtQixFQUFFLENBQUM7QUFFeEQsTUFBTSxDQUFDLE1BQU0sZ0JBQWdCLEdBQUcsSUFBSSxjQUFjLENBQWlCLGtCQUFrQixFQUFFO0lBQ3JGLFVBQVUsRUFBRSxNQUFNO0lBQ2xCLE9BQU8sRUFBRSxHQUFHLEVBQUUsQ0FBQyxxQkFBcUI7Q0FDckMsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5qZWN0aW9uVG9rZW4gfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuZXhwb3J0IHR5cGUgQVhHbG9iYWxDb25maWcgPSB7XG4gIFtrZXk6IHN0cmluZ106IHVua25vd247XG59O1xuXG5leHBvcnQgY29uc3QgQVhHbG9iYWxEZWZhdWx0Q29uZmlnOiBBWEdsb2JhbENvbmZpZyA9IHt9O1xuXG5leHBvcnQgY29uc3QgQVhfR0xPQkFMX0NPTkZJRyA9IG5ldyBJbmplY3Rpb25Ub2tlbjxBWEdsb2JhbENvbmZpZz4oJ0FYX0dMT0JBTF9DT05GSUcnLCB7XG4gIHByb3ZpZGVkSW46ICdyb290JyxcbiAgZmFjdG9yeTogKCkgPT4gQVhHbG9iYWxEZWZhdWx0Q29uZmlnLFxufSk7XG4iXX0=","import { Injectable, Injector, inject } from '@angular/core';\nimport { get } from 'lodash-es';\nimport { AX_GLOBAL_CONFIG } from './configs';\nimport * as i0 from \"@angular/core\";\nexport class AXConfigService {\n constructor() {\n this.injector = inject(Injector);\n }\n get(key, defaultValue) {\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);\n return get(v2, parts[parts.length - 1], defaultValue);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.
|
1
|
+
{"version":3,"file":"acorex-core-config.mjs","sources":["../tmp-esm2022/config/lib/configs.js","../tmp-esm2022/config/lib/configs.service.js","../tmp-esm2022/config/acorex-core-config.js"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nexport const AXGlobalDefaultConfig = {};\nexport const AX_GLOBAL_CONFIG = new InjectionToken('AX_GLOBAL_CONFIG', {\n providedIn: 'root',\n factory: () => AXGlobalDefaultConfig,\n});\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlncy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvcmUvY29uZmlnL3NyYy9saWIvY29uZmlncy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBTS9DLE1BQU0sQ0FBQyxNQUFNLHFCQUFxQixHQUFtQixFQUFFLENBQUM7QUFFeEQsTUFBTSxDQUFDLE1BQU0sZ0JBQWdCLEdBQUcsSUFBSSxjQUFjLENBQWlCLGtCQUFrQixFQUFFO0lBQ3JGLFVBQVUsRUFBRSxNQUFNO0lBQ2xCLE9BQU8sRUFBRSxHQUFHLEVBQUUsQ0FBQyxxQkFBcUI7Q0FDckMsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5qZWN0aW9uVG9rZW4gfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuZXhwb3J0IHR5cGUgQVhHbG9iYWxDb25maWcgPSB7XG4gIFtrZXk6IHN0cmluZ106IHVua25vd247XG59O1xuXG5leHBvcnQgY29uc3QgQVhHbG9iYWxEZWZhdWx0Q29uZmlnOiBBWEdsb2JhbENvbmZpZyA9IHt9O1xuXG5leHBvcnQgY29uc3QgQVhfR0xPQkFMX0NPTkZJRyA9IG5ldyBJbmplY3Rpb25Ub2tlbjxBWEdsb2JhbENvbmZpZz4oJ0FYX0dMT0JBTF9DT05GSUcnLCB7XG4gIHByb3ZpZGVkSW46ICdyb290JyxcbiAgZmFjdG9yeTogKCkgPT4gQVhHbG9iYWxEZWZhdWx0Q29uZmlnLFxufSk7XG4iXX0=","import { Injectable, Injector, inject } from '@angular/core';\nimport { get } from 'lodash-es';\nimport { AX_GLOBAL_CONFIG } from './configs';\nimport * as i0 from \"@angular/core\";\nexport class AXConfigService {\n constructor() {\n this.injector = inject(Injector);\n }\n get(key, defaultValue) {\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);\n return get(v2, parts[parts.length - 1], defaultValue);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.1.2\", ngImport: i0, type: AXConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"20.1.2\", ngImport: i0, type: AXConfigService, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"20.1.2\", ngImport: i0, type: AXConfigService, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }] });\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlncy5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29yZS9jb25maWcvc3JjL2xpYi9jb25maWdzLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLF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sTUFBTSxFQUFFIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5qZWN0YWJsZSwgSW5qZWN0aW9uVG9rZW4sIEluamVjdG9yLCBpbmplY3QgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IGdldCB9IGZyb20gJ2xvZGFzaC1lcyc7XG5pbXBvcnQgeyBBWF9HTE9CQUxfQ09ORklHIH0gZnJvbSAnLi9jb25maWdzJztcblxuQEluamVjdGFibGUoeyBwcm92aWRlZEluOiAncm9vdCcgfSlcbmV4cG9ydCBjbGFzcyBBWENvbmZpZ1NlcnZpY2Uge1xuICBwcml2YXRlIGluamVjdG9yID0gaW5qZWN0KEluamVjdG9yKTtcblxuICBwdWJsaWMgZ2V0PFQgPSBzdHJpbmc+KGtleTogc3RyaW5nLCBkZWZhdWx0VmFsdWU/OiBUKSB7XG4gICAgY29uc3QgdjEgPSB0aGlzLmluamVjdG9yLmdldChBWF9HTE9CQUxfQ09ORklHKTtcbiAgICBjb25zdCBwYXJ0cyA9IGtleS5zcGxpdCgnLicpO1xuICAgIGNvbnN0IHRva2VuTmFtZSA9IHBhcnRzLnNsaWNlKDAsIHBhcnRzLmxlbmd0aCAtIDEpLmpvaW4oJy4nKTtcbiAgICBjb25zdCBwcm92aWRlclRva2VuID0gZ2V0KHYxLCB0b2tlbk5hbWUpO1xuICAgIGNvbnN0IHYyID0gdGhpcy5pbmplY3Rvci5nZXQocHJvdmlkZXJUb2tlbiBhcyBJbmplY3Rpb25Ub2tlbjx1bmtub3duPik7XG4gICAgcmV0dXJuIGdldCh2MiwgcGFydHNbcGFydHMubGVuZ3RoIC0gMV0sIGRlZmF1bHRWYWx1ZSk7XG4gIH1cbn1cbiJdfQ==","/**\n * Generated bundle index. Do not edit.\n */\nexport * from './index';\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNvcmV4LWNvcmUtY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiI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EAAE,YAAY,CAAC;AAC7D;AACA,IAAI,SAAS,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;AAClL,IAAI,SAAS,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,qBAAqB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;AACzJ;AACA,EAAE,CAAC,wBAAwB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC;AACzH,YAAY,IAAI,EAAE,UAAU;AAC5B,YAAY,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE;AACzC,SAAS,CAAC,EAAE,CAAC;;ACtBb;AACA;AACA;;;;"}
|
@@ -6,7 +6,7 @@ import * as i0 from '@angular/core';
|
|
6
6
|
import { InjectionToken, inject, Injectable, Pipe, NgModule } from '@angular/core';
|
7
7
|
import { BehaviorSubject, Subject } from 'rxjs';
|
8
8
|
import { AX_GLOBAL_CONFIG } from '@acorex/core/config';
|
9
|
-
import { defaults, orderBy, set, isNil } from 'lodash-es';
|
9
|
+
import { defaults, orderBy, set, isNil, isDate } from 'lodash-es';
|
10
10
|
import { isBrowser } from '@acorex/core/platform';
|
11
11
|
import { translateSync, AXTranslationService } from '@acorex/core/translation';
|
12
12
|
|
@@ -215,7 +215,7 @@ class AXDateTime {
|
|
215
215
|
const parts = formatter.formatToParts(new Date());
|
216
216
|
// Map parts to their respective format
|
217
217
|
const formatMap = {
|
218
|
-
day: '
|
218
|
+
day: 'DD',
|
219
219
|
month: style == 'longDate' ? 'MMMM' : 'MM',
|
220
220
|
year: 'yyyy',
|
221
221
|
hour: 'HH',
|
@@ -280,10 +280,41 @@ class AXDateTime {
|
|
280
280
|
case 'second':
|
281
281
|
p = this.compare(val, 'minute');
|
282
282
|
return p == 0 ? func(this.second, val.second) : p;
|
283
|
+
case 'ms':
|
283
284
|
default:
|
284
285
|
return func(this.date.getTime(), val.date.getTime());
|
285
286
|
}
|
286
287
|
}
|
288
|
+
/**
|
289
|
+
* Checks if the current date is after the provided date.
|
290
|
+
* @param value The date to compare against.
|
291
|
+
* @param unit The unit of measurement for comparison (e.g., 'day', 'hour'). Defaults to 'ms' for precise comparison.
|
292
|
+
* @returns `true` if the current date is after the provided date, otherwise `false`.
|
293
|
+
*/
|
294
|
+
isAfter(value, unit = 'ms') {
|
295
|
+
// A date is "after" if the comparison result is 1.
|
296
|
+
return this.compare(value, unit) === 1;
|
297
|
+
}
|
298
|
+
/**
|
299
|
+
* Checks if the current date is before the provided date.
|
300
|
+
* @param value The date to compare against.
|
301
|
+
* @param unit The unit of measurement for comparison (e.g., 'day', 'hour'). Defaults to 'ms' for precise comparison.
|
302
|
+
* @returns `true` if the current date is before the provided date, otherwise `false`.
|
303
|
+
*/
|
304
|
+
isBefore(value, unit = 'ms') {
|
305
|
+
// A date is "before" if the comparison result is -1.
|
306
|
+
return this.compare(value, unit) === -1;
|
307
|
+
}
|
308
|
+
/**
|
309
|
+
* Checks if the current date is the same as the provided date, up to a specified unit.
|
310
|
+
* @param value The date to compare against.
|
311
|
+
* @param unit The unit of measurement for comparison (e.g., 'day', 'hour'). Defaults to 'ms' for precise comparison.
|
312
|
+
* @returns `true` if the dates are the same for the given unit, otherwise `false`.
|
313
|
+
*/
|
314
|
+
isSame(value, unit = 'ms') {
|
315
|
+
// Dates are "the same" if the comparison result is 0.
|
316
|
+
return this.compare(value, unit) === 0;
|
317
|
+
}
|
287
318
|
}
|
288
319
|
class AXCalendarMonth {
|
289
320
|
get range() {
|
@@ -380,13 +411,11 @@ class AXDateTimeRange {
|
|
380
411
|
result.years = 0;
|
381
412
|
return result;
|
382
413
|
}
|
383
|
-
|
414
|
+
enumerate(unit = 'day', amount = 1) {
|
384
415
|
const result = [];
|
385
416
|
let item = this._startTime.clone();
|
386
|
-
while (item.compare(this._endTime, unit)
|
387
|
-
|
388
|
-
result.push(item);
|
389
|
-
}
|
417
|
+
while (item.compare(this._endTime, unit) <= 0) {
|
418
|
+
result.push(item);
|
390
419
|
item = item.add(unit, amount);
|
391
420
|
}
|
392
421
|
return result;
|
@@ -411,7 +440,7 @@ class AXGregorianCalendar extends AXCalendar {
|
|
411
440
|
}
|
412
441
|
dayOfYear(date) {
|
413
442
|
let result = 0;
|
414
|
-
|
443
|
+
const m = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
415
444
|
if (this.isLeap(date)) {
|
416
445
|
m[1] = 29;
|
417
446
|
}
|
@@ -537,10 +566,10 @@ class AXGregorianCalendar extends AXCalendar {
|
|
537
566
|
clone.setHours(0, 0, 0, 0);
|
538
567
|
return new AXDateTime(clone, this);
|
539
568
|
case 'week': {
|
540
|
-
const
|
541
|
-
const
|
542
|
-
const
|
543
|
-
clone.setDate(
|
569
|
+
const currentDayOfWeek_0based = this.dayOfWeek(clone) - 1;
|
570
|
+
const firstDayOfWeek_0based = this.weekdays[0];
|
571
|
+
const daysToSubtract = (currentDayOfWeek_0based - firstDayOfWeek_0based + 7) % 7;
|
572
|
+
clone.setDate(clone.getDate() - daysToSubtract);
|
544
573
|
clone.setHours(0, 0, 0, 0);
|
545
574
|
return new AXDateTime(clone, this);
|
546
575
|
}
|
@@ -582,7 +611,7 @@ class AXGregorianCalendar extends AXCalendar {
|
|
582
611
|
}
|
583
612
|
}
|
584
613
|
isLeap(date) {
|
585
|
-
|
614
|
+
const leapYear = new Date(date.getFullYear(), 1, 29);
|
586
615
|
return leapYear.getDate() == 29;
|
587
616
|
}
|
588
617
|
parse(value) {
|
@@ -659,7 +688,7 @@ class AXSolarHijriCalendar extends AXCalendar {
|
|
659
688
|
// value = v.valueOf();
|
660
689
|
// break;
|
661
690
|
let jd = this.dayOfMonth(date);
|
662
|
-
|
691
|
+
const jm = this.monthOfYear(date);
|
663
692
|
let jy = this.year(date);
|
664
693
|
let newMonth = jm + amount;
|
665
694
|
let yearsToAdd = Math.floor(newMonth / 12);
|
@@ -687,9 +716,9 @@ class AXSolarHijriCalendar extends AXCalendar {
|
|
687
716
|
break;
|
688
717
|
case 'year': {
|
689
718
|
const v = new Date(value);
|
690
|
-
|
691
|
-
|
692
|
-
|
719
|
+
const jd = this.dayOfMonth(date);
|
720
|
+
const jm = this.monthOfYear(date);
|
721
|
+
const jy = this.year(date);
|
693
722
|
const vv = this.toGregorian(jy + amount, jm, jd);
|
694
723
|
v.setFullYear(vv.getFullYear());
|
695
724
|
v.setMonth(vv.getMonth());
|
@@ -867,7 +896,13 @@ class AXSolarHijriCalendar extends AXCalendar {
|
|
867
896
|
@returns number of years since the last leap year (0 to 4)
|
868
897
|
*/
|
869
898
|
jalCalLeap(jy) {
|
870
|
-
|
899
|
+
const bl = this.breaks.length;
|
900
|
+
let jp = this.breaks[0];
|
901
|
+
let jm;
|
902
|
+
let jump;
|
903
|
+
let leap;
|
904
|
+
let n;
|
905
|
+
let i;
|
871
906
|
if (jy < jp || jy >= this.breaks[bl - 1])
|
872
907
|
throw new Error('Invalid SolarHijri year ' + jy);
|
873
908
|
for (i = 1; i < bl; i += 1) {
|
@@ -887,7 +922,15 @@ class AXSolarHijriCalendar extends AXCalendar {
|
|
887
922
|
return leap;
|
888
923
|
}
|
889
924
|
jalCal(jy, withoutLeap) {
|
890
|
-
|
925
|
+
const bl = this.breaks.length;
|
926
|
+
const gy = jy + 621;
|
927
|
+
let leapJ = -14;
|
928
|
+
let jp = this.breaks[0];
|
929
|
+
let jm;
|
930
|
+
let jump;
|
931
|
+
let leap;
|
932
|
+
let n;
|
933
|
+
let i;
|
891
934
|
if (jy < jp || jy >= this.breaks[bl - 1])
|
892
935
|
throw new Error('Invalid SolarHijri year ' + jy);
|
893
936
|
// Find the limiting years for the SolarHijri year jy.
|
@@ -906,9 +949,9 @@ class AXSolarHijriCalendar extends AXCalendar {
|
|
906
949
|
if (this.mod(jump, 33) === 4 && jump - n === 4)
|
907
950
|
leapJ += 1;
|
908
951
|
// And the same in the Gregorian calendar (until the year gy).
|
909
|
-
leapG = this.div(gy, 4) - this.div((this.div(gy, 100) + 1) * 3, 4) - 150;
|
952
|
+
const leapG = this.div(gy, 4) - this.div((this.div(gy, 100) + 1) * 3, 4) - 150;
|
910
953
|
// Determine the Gregorian date of Farvardin the 1st.
|
911
|
-
march = 20 + leapJ - leapG;
|
954
|
+
const march = 20 + leapJ - leapG;
|
912
955
|
// return with gy and march when we don't need leap
|
913
956
|
if (withoutLeap)
|
914
957
|
return { gy: gy, march: march };
|
@@ -926,12 +969,17 @@ class AXSolarHijriCalendar extends AXCalendar {
|
|
926
969
|
};
|
927
970
|
}
|
928
971
|
j2d(jy, jm, jd) {
|
929
|
-
|
972
|
+
const r = this.jalCal(jy, true);
|
930
973
|
return this.g2d(r.gy, 3, r.march) + (jm - 1) * 31 - this.div(jm, 7) * (jm - 7) + jd - 1;
|
931
974
|
}
|
932
975
|
d2j(jdn) {
|
933
|
-
|
934
|
-
jy = gy - 621
|
976
|
+
const gy = this.d2g(jdn).gy; // Calculate Gregorian year (gy).
|
977
|
+
let jy = gy - 621;
|
978
|
+
const r = this.jalCal(jy, false);
|
979
|
+
const jdn1f = this.g2d(gy, 3, r.march);
|
980
|
+
let jd;
|
981
|
+
let jm;
|
982
|
+
let k;
|
935
983
|
// Find number of days that passed since 1 Farvardin.
|
936
984
|
k = jdn - jdn1f;
|
937
985
|
if (k >= 0) {
|
@@ -974,13 +1022,12 @@ class AXSolarHijriCalendar extends AXCalendar {
|
|
974
1022
|
return d;
|
975
1023
|
}
|
976
1024
|
d2g(jdn) {
|
977
|
-
let j
|
978
|
-
j = 4 * jdn + 139361631;
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
gy = this.div(j, 1461) - 100100 + this.div(8 - gm, 6);
|
1025
|
+
let j = 4 * jdn + 139361631;
|
1026
|
+
j = 4 * jdn + 139361631 + this.div(this.div(4 * jdn + 183187720, 146097) * 3, 4) * 4 - 3908;
|
1027
|
+
const i = this.div(this.mod(j, 1461), 4) * 5 + 308;
|
1028
|
+
const gd = this.div(this.mod(i, 153), 5) + 1;
|
1029
|
+
const gm = this.mod(this.div(i, 153), 12) + 1;
|
1030
|
+
const gy = this.div(j, 1461) - 100100 + this.div(8 - gm, 6);
|
984
1031
|
return {
|
985
1032
|
gy: gy,
|
986
1033
|
gm: gm,
|
@@ -988,16 +1035,16 @@ class AXSolarHijriCalendar extends AXCalendar {
|
|
988
1035
|
};
|
989
1036
|
}
|
990
1037
|
SolarHijriWeek(jy, jm, jd) {
|
991
|
-
|
992
|
-
|
993
|
-
|
1038
|
+
const dayOfWeek = this.SolarHijriToDateObject(jy, jm, jd, 0, 0, 0, 0).getDay();
|
1039
|
+
const startDayDifference = dayOfWeek == 6 ? 0 : -(dayOfWeek + 1);
|
1040
|
+
const endDayDifference = 6 + startDayDifference;
|
994
1041
|
return {
|
995
1042
|
saturday: this.d2j(this.j2d(jy, jm, jd + startDayDifference)),
|
996
1043
|
friday: this.d2j(this.j2d(jy, jm, jd + endDayDifference)),
|
997
1044
|
};
|
998
1045
|
}
|
999
1046
|
SolarHijriToDateObject(jy, jm, jd, h = 0, m = 0, s = 0, ms = 0) {
|
1000
|
-
|
1047
|
+
const gregorianCalenderDate = this.toGregorian(jy, jm, jd);
|
1001
1048
|
return new Date(gregorianCalenderDate.getFullYear(), gregorianCalenderDate.getMonth() - 1, gregorianCalenderDate.getDate(), h || 0, m || 0, s || 0, ms || 0);
|
1002
1049
|
}
|
1003
1050
|
/*
|
@@ -1192,10 +1239,10 @@ class AXCalendarService {
|
|
1192
1239
|
calendar: calendar.name(),
|
1193
1240
|
});
|
1194
1241
|
}
|
1195
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
1196
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
1242
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXCalendarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1243
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXCalendarService, providedIn: 'root' }); }
|
1197
1244
|
}
|
1198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
1245
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXCalendarService, decorators: [{
|
1199
1246
|
type: Injectable,
|
1200
1247
|
args: [{ providedIn: 'root' }]
|
1201
1248
|
}], ctorParameters: () => [] });
|
@@ -1219,10 +1266,10 @@ class AXDateTimePipe {
|
|
1219
1266
|
const val = this._calendarService.convert(value, calendar.name());
|
1220
1267
|
return this.formatService.format(val, 'datetime', format);
|
1221
1268
|
}
|
1222
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
1223
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.
|
1269
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
1270
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.1.2", ngImport: i0, type: AXDateTimePipe, isStandalone: true, name: "axDate" }); }
|
1224
1271
|
}
|
1225
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
1272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateTimePipe, decorators: [{
|
1226
1273
|
type: Pipe,
|
1227
1274
|
args: [{ name: 'axDate' }]
|
1228
1275
|
}] });
|
@@ -1267,10 +1314,10 @@ class AXDateFormatter {
|
|
1267
1314
|
.convert(value, effectiveOptions.calendar)
|
1268
1315
|
.format(format, { locale: effectiveOptions.locale });
|
1269
1316
|
}
|
1270
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
1271
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
1317
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1318
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateFormatter }); }
|
1272
1319
|
}
|
1273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
1320
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateFormatter, decorators: [{
|
1274
1321
|
type: Injectable
|
1275
1322
|
}] });
|
1276
1323
|
|
@@ -1324,10 +1371,10 @@ class AXDateTimeFormatter {
|
|
1324
1371
|
.convert(value, effectiveOptions.calendar)
|
1325
1372
|
.format(format, { locale: effectiveOptions.locale });
|
1326
1373
|
}
|
1327
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
1328
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
1374
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateTimeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1375
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateTimeFormatter }); }
|
1329
1376
|
}
|
1330
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
1377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateTimeFormatter, decorators: [{
|
1331
1378
|
type: Injectable
|
1332
1379
|
}] });
|
1333
1380
|
|
@@ -1434,10 +1481,10 @@ class AXTimeDurationFormatter {
|
|
1434
1481
|
return result.join(' : ');
|
1435
1482
|
}
|
1436
1483
|
}
|
1437
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
1438
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
1484
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXTimeDurationFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1485
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXTimeDurationFormatter }); }
|
1439
1486
|
}
|
1440
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
1487
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXTimeDurationFormatter, decorators: [{
|
1441
1488
|
type: Injectable
|
1442
1489
|
}] });
|
1443
1490
|
|
@@ -1481,20 +1528,32 @@ class AXTimeFormatter {
|
|
1481
1528
|
.convert(value, effectiveOptions.calendar)
|
1482
1529
|
.format(format, { locale: effectiveOptions.locale });
|
1483
1530
|
}
|
1484
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
1485
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
1531
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXTimeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1532
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXTimeFormatter }); }
|
1486
1533
|
}
|
1487
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
1534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXTimeFormatter, decorators: [{
|
1488
1535
|
type: Injectable
|
1489
1536
|
}] });
|
1490
1537
|
|
1491
1538
|
class AXTimeLeftFormatter {
|
1539
|
+
constructor() {
|
1540
|
+
this.translateService = inject(AXTranslationService);
|
1541
|
+
}
|
1492
1542
|
get name() {
|
1493
1543
|
return 'timeleft';
|
1494
1544
|
}
|
1495
1545
|
format(value, options) {
|
1496
|
-
|
1497
|
-
|
1546
|
+
if (isNil(value)) {
|
1547
|
+
return '';
|
1548
|
+
}
|
1549
|
+
let valueNumber;
|
1550
|
+
if (isDate(value)) {
|
1551
|
+
valueNumber = value.getTime() - new Date().getTime();
|
1552
|
+
}
|
1553
|
+
else {
|
1554
|
+
valueNumber = Number(value);
|
1555
|
+
}
|
1556
|
+
const sign = this.translateService.translateSync(`@acorex:time.${valueNumber >= 0 ? 'left' : 'ago'}`);
|
1498
1557
|
const milliseconds = Math.abs(valueNumber);
|
1499
1558
|
const durationInSeconds = Math.round(milliseconds / 1000);
|
1500
1559
|
let format = options?.format;
|
@@ -1502,87 +1561,92 @@ class AXTimeLeftFormatter {
|
|
1502
1561
|
if (isNil(format)) {
|
1503
1562
|
if (durationInSeconds < 45)
|
1504
1563
|
format = 's';
|
1505
|
-
else if (durationInSeconds <
|
1564
|
+
else if (durationInSeconds < 2700)
|
1506
1565
|
format = 'm';
|
1507
|
-
else if (durationInSeconds <
|
1566
|
+
else if (durationInSeconds < 79200)
|
1508
1567
|
format = 'h';
|
1509
|
-
else if (durationInSeconds <
|
1568
|
+
else if (durationInSeconds < 2246400)
|
1510
1569
|
format = 'd';
|
1511
|
-
else if (durationInSeconds <
|
1570
|
+
else if (durationInSeconds < 27648000)
|
1512
1571
|
format = 'M';
|
1513
1572
|
else
|
1514
1573
|
format = 'y';
|
1515
1574
|
}
|
1516
1575
|
// Helper function for zero-padding
|
1517
1576
|
const pad = (num) => num.toString().padStart(2, '0');
|
1577
|
+
const translate = (key, useSign = true) => {
|
1578
|
+
const translated = this.translateService.translateSync(`@acorex:time.${key}`);
|
1579
|
+
return useSign ? `${translated} ${sign}` : translated;
|
1580
|
+
};
|
1518
1581
|
switch (format) {
|
1519
1582
|
case 's':
|
1520
|
-
return `${durationInSeconds}
|
1583
|
+
return `${durationInSeconds} ${translate('seconds')}`;
|
1521
1584
|
case 'ss':
|
1522
|
-
return `${pad(durationInSeconds)}
|
1585
|
+
return `${pad(durationInSeconds)} ${translate('seconds')}`;
|
1523
1586
|
case 'm':
|
1524
|
-
return `${Math.round(durationInSeconds / 60)}
|
1587
|
+
return `${Math.round(durationInSeconds / 60)} ${translate(durationInSeconds >= 120 ? 'minutes' : 'minute')}`;
|
1525
1588
|
case 'mm':
|
1526
|
-
return `${pad(Math.round(durationInSeconds / 60))}
|
1589
|
+
return `${pad(Math.round(durationInSeconds / 60))} ${translate('minutes')}`;
|
1527
1590
|
case 'h':
|
1528
1591
|
case 'H':
|
1529
|
-
if (durationInSeconds <
|
1530
|
-
return
|
1531
|
-
return `${Math.round(durationInSeconds / 3600)}
|
1592
|
+
if (durationInSeconds < 5340)
|
1593
|
+
return translate('an-hour');
|
1594
|
+
return `${Math.round(durationInSeconds / 3600)} ${translate(durationInSeconds >= 10800 ? 'hours' : 'hour')}`;
|
1532
1595
|
case 'hh':
|
1533
1596
|
case 'HH':
|
1534
|
-
if (durationInSeconds <
|
1535
|
-
return `01
|
1536
|
-
return `${pad(Math.round(durationInSeconds / 3600))}
|
1597
|
+
if (durationInSeconds < 5340)
|
1598
|
+
return `01 ${translate('hour')}`;
|
1599
|
+
return `${pad(Math.round(durationInSeconds / 3600))} ${translate('hours')}`;
|
1537
1600
|
case 'd':
|
1538
1601
|
case 'D':
|
1539
|
-
if (durationInSeconds <
|
1540
|
-
return
|
1541
|
-
return `${Math.round(durationInSeconds / (3600 * 24))}
|
1602
|
+
if (durationInSeconds < 126000)
|
1603
|
+
return translate('a-day');
|
1604
|
+
return `${Math.round(durationInSeconds / (3600 * 24))} ${translate(durationInSeconds >= 252000 ? 'days' : 'day')}`;
|
1542
1605
|
case 'dd':
|
1543
1606
|
case 'DD':
|
1544
|
-
if (durationInSeconds <
|
1545
|
-
return `01
|
1546
|
-
return `${pad(Math.round(durationInSeconds / (3600 * 24)))}
|
1607
|
+
if (durationInSeconds < 126000)
|
1608
|
+
return `01 ${translate('day')}`;
|
1609
|
+
return `${pad(Math.round(durationInSeconds / (3600 * 24)))} ${translate('days')}`;
|
1547
1610
|
case 'M':
|
1548
|
-
if (durationInSeconds <
|
1549
|
-
return
|
1550
|
-
return `${Math.round(durationInSeconds / (3600 * 24 * 30))}
|
1611
|
+
if (durationInSeconds < 3888000)
|
1612
|
+
return translate('a-month');
|
1613
|
+
return `${Math.round(durationInSeconds / (3600 * 24 * 30))} ${translate(durationInSeconds >= 7776000 ? 'months' : 'month')}`;
|
1551
1614
|
case 'MM':
|
1552
|
-
if (durationInSeconds <
|
1553
|
-
return `01
|
1554
|
-
return `${pad(Math.round(durationInSeconds / (3600 * 24 * 30)))}
|
1615
|
+
if (durationInSeconds < 3888000)
|
1616
|
+
return `01 ${translate('month')}`;
|
1617
|
+
return `${pad(Math.round(durationInSeconds / (3600 * 24 * 30)))} ${translate('months')}`;
|
1555
1618
|
case 'y':
|
1556
1619
|
case 'Y':
|
1557
|
-
if (durationInSeconds <
|
1558
|
-
return
|
1559
|
-
return `${Math.round(durationInSeconds / (3600 * 24 * 365))}
|
1620
|
+
if (durationInSeconds < 47260800)
|
1621
|
+
return translate('a-year');
|
1622
|
+
return `${Math.round(durationInSeconds / (3600 * 24 * 365))} ${translate(durationInSeconds >= 63072000 ? 'years' : 'year')}`;
|
1560
1623
|
case 'yy':
|
1561
1624
|
case 'YY':
|
1562
1625
|
case 'yyyy':
|
1563
1626
|
case 'YYYY':
|
1564
|
-
if (durationInSeconds <
|
1565
|
-
return `01
|
1566
|
-
return `${pad(Math.round(durationInSeconds / (3600 * 24 * 365)))}
|
1627
|
+
if (durationInSeconds < 47260800)
|
1628
|
+
return `01 ${translate('year')}`;
|
1629
|
+
return `${pad(Math.round(durationInSeconds / (3600 * 24 * 365)))} ${translate('years')}`;
|
1567
1630
|
default:
|
1631
|
+
console.error('Invalid format for timeleft formatter pipe');
|
1568
1632
|
return 'Invalid format';
|
1569
1633
|
}
|
1570
1634
|
}
|
1571
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
1572
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
1635
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXTimeLeftFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1636
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXTimeLeftFormatter }); }
|
1573
1637
|
}
|
1574
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
1638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXTimeLeftFormatter, decorators: [{
|
1575
1639
|
type: Injectable
|
1576
1640
|
}] });
|
1577
1641
|
|
1578
1642
|
class AXDateTimeModule {
|
1579
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
1580
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.
|
1581
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.
|
1643
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1644
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.2", ngImport: i0, type: AXDateTimeModule, imports: [i1.AXFormatModule, AXDateTimePipe], exports: [AXDateTimePipe] }); }
|
1645
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateTimeModule, imports: [AXFormatModule.forChild({
|
1582
1646
|
formatters: [AXDateTimeFormatter, AXDateFormatter, AXTimeFormatter, AXTimeLeftFormatter, AXTimeDurationFormatter],
|
1583
1647
|
})] }); }
|
1584
1648
|
}
|
1585
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
1649
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: AXDateTimeModule, decorators: [{
|
1586
1650
|
type: NgModule,
|
1587
1651
|
args: [{
|
1588
1652
|
imports: [
|