@acorex/core 19.12.0 → 19.13.0-next.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/date-time/index.d.ts +5 -5
- package/date-time/lib/calendar.service.d.ts +8 -3
- package/date-time/lib/dateTime.config.d.ts +1 -1
- package/date-time/lib/datetime.pipe.d.ts +2 -1
- package/date-time/lib/{datetime.class.d.ts → datetime.types.d.ts} +2 -2
- package/date-time/lib/formatters/date.formatter.d.ts +12 -0
- package/date-time/lib/formatters/{datetime-formatter.d.ts → datetime.formatter.d.ts} +3 -1
- package/date-time/lib/formatters/time.formatter.d.ts +12 -0
- package/date-time/lib/{georgian.calendar.d.ts → gregorian.calendar.d.ts} +2 -2
- package/date-time/lib/{jalali.calendar.d.ts → solar-hijri.calendar.d.ts} +8 -8
- package/events/index.d.ts +0 -1
- package/fesm2022/acorex-core-date-time.mjs +263 -100
- package/fesm2022/acorex-core-date-time.mjs.map +1 -1
- package/fesm2022/acorex-core-events.mjs +1 -7
- package/fesm2022/acorex-core-events.mjs.map +1 -1
- package/fesm2022/acorex-core-format.mjs +47 -33
- package/fesm2022/acorex-core-format.mjs.map +1 -1
- package/fesm2022/acorex-core-locale-en-AU.profile-BW-_9tgT.mjs +64 -0
- package/fesm2022/acorex-core-locale-en-AU.profile-BW-_9tgT.mjs.map +1 -0
- package/fesm2022/acorex-core-locale.mjs +341 -0
- package/fesm2022/acorex-core-locale.mjs.map +1 -0
- package/fesm2022/acorex-core-translation.mjs +12 -4
- package/fesm2022/acorex-core-translation.mjs.map +1 -1
- package/format/index.d.ts +2 -2
- package/format/lib/format.directive.d.ts +1 -1
- package/format/lib/format.module.d.ts +3 -3
- package/locale/README.md +3 -0
- package/locale/index.d.ts +8 -0
- package/locale/lib/formatters/currency.formatter.d.ts +10 -0
- package/locale/lib/locale-profile-provider.service.d.ts +24 -0
- package/locale/lib/locale.config.d.ts +5 -0
- package/locale/lib/locale.module.d.ts +7 -0
- package/locale/lib/locale.service.d.ts +20 -0
- package/locale/lib/locale.types.d.ts +61 -0
- package/locale/lib/profiles/en-AU.profile.d.ts +2 -0
- package/locale/lib/profiles/en-US.profile.d.ts +2 -0
- package/locale/lib/profiles/fa-IR.profile.d.ts +2 -0
- package/package.json +5 -1
- package/translation/lib/translation.service.d.ts +1 -0
- package/types/README.md +2 -2
- package/events/lib/event.type.d.ts +0 -5
- package/i18n/en/common.json +0 -191
- package/i18n/fa/common.json +0 -190
- /package/date-time/lib/formatters/{time-duration-formatter.d.ts → time-duration.formatter.d.ts} +0 -0
- /package/date-time/lib/formatters/{timeleft-formatter.d.ts → timeleft.formatter.d.ts} +0 -0
- /package/format/lib/formatters/{number-formatter.d.ts → number.formatter.d.ts} +0 -0
- /package/format/lib/formatters/{string-formatter.d.ts → string.formatter.d.ts} +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
2
|
import { Injector, Injectable, Directive, inject, Pipe, Inject, NgModule } from '@angular/core';
|
3
3
|
import { Subject, filter, startWith, switchMap, of } from 'rxjs';
|
4
|
-
import { AXEventService } from '@acorex/core/events';
|
5
4
|
import { defaults, padStart, isInteger, get } from 'lodash-es';
|
5
|
+
import { AXEventService } from '@acorex/core/events';
|
6
6
|
|
7
7
|
class AXFormatter {
|
8
8
|
}
|
@@ -112,40 +112,15 @@ class AXFormatterDirective {
|
|
112
112
|
});
|
113
113
|
}
|
114
114
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXFormatterDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: AXFormatService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
115
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.5", type: AXFormatterDirective, isStandalone: true, selector: "[
|
115
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.5", type: AXFormatterDirective, isStandalone: true, selector: "[formatter]", ngImport: i0 }); }
|
116
116
|
}
|
117
117
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXFormatterDirective, decorators: [{
|
118
118
|
type: Directive,
|
119
|
-
args: [{ selector: '[format]' }]
|
120
|
-
}], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: AXFormatService }] });
|
121
|
-
|
122
|
-
class AXFormatPipe {
|
123
|
-
constructor() {
|
124
|
-
this.formatService = inject(AXFormatService);
|
125
|
-
this.eventService = inject(AXEventService);
|
126
|
-
this.triggers = ['AX_CALENDAR_CHANGED', 'AX_LANGUAGE_CHANGED', 'AX_LANGUAGE_LOADED'];
|
127
|
-
}
|
128
|
-
transform(value, name, options) {
|
129
|
-
// Initial formatted value
|
130
|
-
const initialFormattedValue = this.formatService.format(value, name, options);
|
131
|
-
// React to language changes and re-format the value
|
132
|
-
return this.eventService.onEvent.pipe(filter((event) => this.triggers.includes(event.type)), startWith(initialFormattedValue), // Emit the initial formatted value immediately
|
133
|
-
switchMap((event) => {
|
134
|
-
// Re-call format method on every language change
|
135
|
-
const formattedValue = this.formatService.format(value, name, options);
|
136
|
-
return of(formattedValue);
|
137
|
-
}));
|
138
|
-
}
|
139
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
140
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: AXFormatPipe, isStandalone: true, name: "format" }); }
|
141
|
-
}
|
142
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXFormatPipe, decorators: [{
|
143
|
-
type: Pipe,
|
144
119
|
args: [{
|
145
|
-
|
146
|
-
|
120
|
+
selector: '[formatter]',
|
121
|
+
standalone: true,
|
147
122
|
}]
|
148
|
-
}] });
|
123
|
+
}], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: AXFormatService }] });
|
149
124
|
|
150
125
|
class AXNumberFormatter {
|
151
126
|
constructor() {
|
@@ -234,6 +209,45 @@ class AXStringFormatter {
|
|
234
209
|
}
|
235
210
|
}
|
236
211
|
|
212
|
+
var AXLocaleEvents;
|
213
|
+
(function (AXLocaleEvents) {
|
214
|
+
AXLocaleEvents["AXLocaleChanged"] = "AX_LOCALE_CHANGED";
|
215
|
+
AXLocaleEvents["AXLocaleLoaded"] = "AX_LOCALE_LOADED";
|
216
|
+
//
|
217
|
+
AXLocaleEvents["AXCalendarChanged"] = "AX_CALENDAR_CHANGED";
|
218
|
+
//
|
219
|
+
AXLocaleEvents["AXLanguageChanged"] = "AX_LANGUAGE_CHANGED";
|
220
|
+
AXLocaleEvents["AXLanguageLoaded"] = "AX_LANGUAGE_LOADED";
|
221
|
+
})(AXLocaleEvents || (AXLocaleEvents = {}));
|
222
|
+
class AXFormatPipe {
|
223
|
+
constructor() {
|
224
|
+
this.formatService = inject(AXFormatService);
|
225
|
+
this.eventService = inject(AXEventService);
|
226
|
+
this.triggers = [...Object.values(AXLocaleEvents).map((event) => event)];
|
227
|
+
}
|
228
|
+
transform(value, name, options) {
|
229
|
+
// Initial formatted value
|
230
|
+
const initialFormattedValue = this.formatService.format(value, name, options);
|
231
|
+
// React to language changes and re-format the value
|
232
|
+
return this.eventService.onEvent.pipe(filter((event) => this.triggers.includes(event.type)), startWith(initialFormattedValue), // Emit the initial formatted value immediately
|
233
|
+
switchMap((event) => {
|
234
|
+
// Re-call format method on every language change
|
235
|
+
const formattedValue = this.formatService.format(value, name, options);
|
236
|
+
return of(formattedValue);
|
237
|
+
}));
|
238
|
+
}
|
239
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
240
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: AXFormatPipe, isStandalone: true, name: "format" }); }
|
241
|
+
}
|
242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXFormatPipe, decorators: [{
|
243
|
+
type: Pipe,
|
244
|
+
args: [{
|
245
|
+
name: 'format',
|
246
|
+
standalone: true,
|
247
|
+
pure: true,
|
248
|
+
}]
|
249
|
+
}] });
|
250
|
+
|
237
251
|
const BUILT_IN_RULES = [AXNumberFormatter, AXStringFormatter];
|
238
252
|
class AXFormatModule {
|
239
253
|
static forRoot(configs) {
|
@@ -277,14 +291,14 @@ class AXFormatModule {
|
|
277
291
|
});
|
278
292
|
}
|
279
293
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXFormatModule, deps: [{ token: 'AXFormatModuleFactory' }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
280
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: AXFormatModule, imports: [
|
294
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: AXFormatModule, imports: [AXFormatterDirective, AXFormatPipe], exports: [AXFormatterDirective, AXFormatPipe] }); }
|
281
295
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXFormatModule }); }
|
282
296
|
}
|
283
297
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXFormatModule, decorators: [{
|
284
298
|
type: NgModule,
|
285
299
|
args: [{
|
286
|
-
imports: [
|
287
|
-
exports: [
|
300
|
+
imports: [AXFormatterDirective, AXFormatPipe],
|
301
|
+
exports: [AXFormatterDirective, AXFormatPipe],
|
288
302
|
}]
|
289
303
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
290
304
|
type: Inject,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-format.mjs","sources":["../../../../libs/core/format/src/lib/format.config.ts","../../../../libs/core/format/src/lib/format.service.ts","../../../../libs/core/format/src/lib/format.directive.ts","../../../../libs/core/format/src/lib/format.pipe.ts","../../../../libs/core/format/src/lib/formatters/number-formatter.ts","../../../../libs/core/format/src/lib/formatters/string-formatter.ts","../../../../libs/core/format/src/lib/format.module.ts","../../../../libs/core/format/src/acorex-core-format.ts"],"sourcesContent":["import { AXFormatOptions } from './format.types';\n\nexport abstract class AXFormatter {\n abstract get name(): string;\n abstract format(value: unknown, options?: AXFormatOptions | string): string;\n}\n","import { Injectable, Injector } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { AXFormatter } from './format.config';\nimport { AXFormatOptionsMap } from './format.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFormatterRegistryService {\n private plugins: AXFormatter[] = [];\n\n private injector: Injector;\n\n constructor(injector: Injector) {\n this.injector = injector;\n }\n\n register(...plugins: (new () => AXFormatter)[]) {\n plugins.forEach((t) => {\n const childInjector = Injector.create({\n providers: [{ provide: t, useClass: t, deps: [] }],\n parent: this.injector,\n });\n const v = childInjector.get(t);\n\n if (v && !this.plugins.some((p) => p.name == v.name)) {\n this.plugins.push(v);\n }\n });\n }\n\n get formatters(): AXFormatter[] {\n return this.plugins;\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXFormatService {\n constructor(private pluginRegistry: AXFormatterRegistryService) {}\n\n private renderSubject = new Subject<void>();\n\n // Observable that other services/components can subscribe to\n onRender = this.renderSubject.asObservable();\n\n render() {\n this.renderSubject.next();\n }\n\n /**\n * Resolves a formatter by its name.\n * @param name The name of the formatter.\n * @returns The formatter if found, otherwise throws an error.\n */\n resolveFormatter(name: string): AXFormatter {\n const formatter = this.pluginRegistry.formatters.find((c) => c.name == name);\n if (!formatter) {\n throw new Error(`Formatter not found: ${name}`);\n }\n return formatter;\n }\n\n // Overload for traditional formatting\n format<K extends keyof AXFormatOptionsMap>(value: unknown, formatter: K, options?: AXFormatOptionsMap[K]): string;\n\n // Overload for starting fluent API chain\n format(value: unknown): AXFormatFluent;\n\n // Implementation of the format method\n format<K extends keyof AXFormatOptionsMap>(value: unknown, formatter?: K, options?: AXFormatOptionsMap[K]): string | AXFormatFluent {\n if (typeof formatter === 'string') {\n const formatterRef = this.resolveFormatter(formatter);\n return formatterRef.format(value, options);\n } else {\n return new AXFormatFluent(this, value);\n }\n }\n}\n\nclass AXFormatFluent {\n constructor(\n private formatService: AXFormatService,\n private initialValue: unknown,\n ) {}\n\n /**\n * Formats the value using the specified formatter and options.\n * @param formatter The name of the formatter to use.\n * @param options The options to pass to the formatter.\n * @returns The formatted string.\n */\n to<K extends keyof AXFormatOptionsMap>(formatter: K, options?: AXFormatOptionsMap[K]): string {\n try {\n const formatterRef = this.formatService.resolveFormatter(formatter);\n return formatterRef.format(this.initialValue, options);\n } catch (error) {\n return String(this.initialValue);\n }\n }\n}\n","import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AXFormatService } from './format.service';\nimport { AXFormatOptionsMap } from './format.types';\n\n@Directive({ selector: '[format]' })\nexport class AXFormatterDirective implements OnInit {\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private formatService: AXFormatService,\n ) {}\n\n ngOnInit() {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: <K extends keyof AXFormatOptionsMap>(value: unknown, formatter: K, options?: AXFormatOptionsMap[K]) => {\n return this.formatService.format(value, formatter, options);\n },\n });\n }\n}\n","import { AXEventData, AXEventService } from '@acorex/core/events';\nimport { Pipe, PipeTransform, inject } from '@angular/core';\nimport { Observable, filter, of, startWith, switchMap } from 'rxjs';\nimport { AXFormatService } from './format.service';\nimport { AXFormatOptions } from './format.types';\n\n@Pipe({\n name: 'format',\n pure: true,\n})\nexport class AXFormatPipe implements PipeTransform {\n private formatService = inject(AXFormatService);\n private eventService = inject(AXEventService);\n\n private triggers = ['AX_CALENDAR_CHANGED', 'AX_LANGUAGE_CHANGED', 'AX_LANGUAGE_LOADED'];\n\n transform(value: unknown, name: string, options?: AXFormatOptions | string): Observable<string> {\n // Initial formatted value\n const initialFormattedValue = this.formatService.format(value, name as any, options);\n\n // React to language changes and re-format the value\n return this.eventService.onEvent.pipe(\n filter((event: AXEventData) => this.triggers.includes(event.type)),\n startWith(initialFormattedValue), // Emit the initial formatted value immediately\n switchMap((event) => {\n // Re-call format method on every language change\n const formattedValue = this.formatService.format(value, name as any, options);\n return of(formattedValue);\n }),\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { defaults, isInteger, padStart } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXNumberFormatterOptions extends AXFormatOptions {\n decimalPlaces?: number;\n thousandSeparator?: string;\n decimalSeparator?: string;\n zeroPadLength?: number; // New option for zero padding,\n locale?: string;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n number: AXNumberFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXNumberFormatter implements AXFormatter {\n private separatorsCache: any = {};\n\n get name(): string {\n return 'number';\n }\n\n format(value: number, options: AXNumberFormatterOptions): string {\n const { thousandSeparator, decimalSeparator } = this.getLocaleSeparators(options?.locale);\n // Merge user options with default options\n const effectiveOptions = defaults({}, options, {\n thousandSeparator,\n decimalSeparator,\n zeroPadLength: 0,\n locale: navigator.language,\n });\n\n const sign = value < 0 ? '-' : '';\n const absoluteValue = Math.abs(value);\n\n // Handling zero padding for integer part\n let integerPart = Math.floor(absoluteValue).toString();\n if (effectiveOptions.zeroPadLength && effectiveOptions.zeroPadLength > integerPart.length) {\n integerPart = padStart(integerPart, effectiveOptions.zeroPadLength, '0');\n }\n\n // Applying thousand separator to integer part\n if (effectiveOptions.thousandSeparator) {\n integerPart = integerPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, effectiveOptions.thousandSeparator);\n }\n\n // Constructing the final formatted value\n let formattedValue = sign + integerPart;\n if (effectiveOptions.decimalPlaces !== undefined) {\n // Limiting decimal places if specified\n const decimalPart = absoluteValue.toFixed(effectiveOptions.decimalPlaces).split('.')[1];\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n } else if (!isInteger(value)) {\n // Showing full decimal part if decimalPlaces is not specified\n const decimalPart = absoluteValue.toString().split('.')[1] || '';\n if (decimalPart.length > 0) {\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n }\n }\n\n return formattedValue;\n }\n\n private getLocaleSeparators(locale = navigator.language): {\n thousandSeparator: string;\n decimalSeparator: string;\n } {\n // Use cache if available\n if (this.separatorsCache[locale]) {\n return this.separatorsCache[locale];\n }\n\n const numberFormat = new Intl.NumberFormat(locale);\n const parts = numberFormat.formatToParts(1234567.89);\n let thousandSeparator = '';\n let decimalSeparator = '';\n\n for (const part of parts) {\n if (part.type === 'group') {\n thousandSeparator = part.value;\n } else if (part.type === 'decimal') {\n decimalSeparator = part.value;\n }\n }\n\n // Cache the result\n this.separatorsCache[locale] = { thousandSeparator, decimalSeparator };\n return this.separatorsCache[locale];\n }\n}\n","import { get } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXStringFormatterOptions extends AXFormatOptions {\n [key: string]: any;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n string: AXStringFormatterOptions;\n }\n}\n\nexport class AXStringFormatter implements AXFormatter {\n get name(): string {\n return 'string';\n }\n\n format(value: unknown, options: AXStringFormatterOptions): string {\n if (typeof value != 'string') return String(value);\n const result = get(options, value)\n ? get(options, value)\n : value.replace(/{{\\s*([^}]+)\\s*}}/g, (match, path: string) => {\n return (get(options, path.trim()) as string) ?? match;\n });\n\n return result;\n }\n}\n","import { Inject, ModuleWithProviders, NgModule } from '@angular/core';\nimport { AXFormatter } from './format.config';\nimport { AXFormatterDirective } from './format.directive';\nimport { AXFormatPipe } from './format.pipe';\nimport { AXFormatterRegistryService } from './format.service';\nimport { AXNumberFormatter } from './formatters/number-formatter';\nimport { AXStringFormatter } from './formatters/string-formatter';\n\nconst BUILT_IN_RULES = [AXNumberFormatter, AXStringFormatter];\n\nexport interface AXFormatModuleConfigs {\n formatters: (new () => AXFormatter)[];\n}\n\n@NgModule({\n imports: [AXFormatPipe, AXFormatterDirective],\n exports: [AXFormatPipe, AXFormatterDirective],\n})\nexport class AXFormatModule {\n static forRoot(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Inject('AXFormatModuleFactory') instances: any[]) {\n instances.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AXFormatService"],"mappings":";;;;;;MAEsB,WAAW,CAAA;AAGhC;;MCGY,0BAA0B,CAAA;AAKrC,IAAA,WAAA,CAAY,QAAkB,EAAA;QAJtB,IAAO,CAAA,OAAA,GAAkB,EAAE;AAKjC,Q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A,cAAc,YAHf,YAAY,EAAE,oBAAoB,CAClC,EAAA,OAAA,EAAA,CAAA,YAAY,EAAE,oBAAoB,CAAA,EAAA,CAAA,CAAA;+GAEjC,cAAc,EAAA,CAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAJ1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,oBAAoB,CAAC;AAC7C,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,oBAAoB,CAAC;AAC9C,iBAAA;;0BAuCc,MAAM;2BAAC,uBAAuB;;;ACxD7C;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-core-format.mjs","sources":["../../../../libs/core/format/src/lib/format.config.ts","../../../../libs/core/format/src/lib/format.service.ts","../../../../libs/core/format/src/lib/format.directive.ts","../../../../libs/core/format/src/lib/formatters/number.formatter.ts","../../../../libs/core/format/src/lib/formatters/string.formatter.ts","../../../../libs/core/format/src/lib/format.pipe.ts","../../../../libs/core/format/src/lib/format.module.ts","../../../../libs/core/format/src/acorex-core-format.ts"],"sourcesContent":["import { AXFormatOptions } from './format.types';\n\nexport abstract class AXFormatter {\n abstract get name(): string;\n abstract format(value: unknown, options?: AXFormatOptions | string): string;\n}\n","import { Injectable, Injector } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { AXFormatter } from './format.config';\nimport { AXFormatOptionsMap } from './format.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFormatterRegistryService {\n private plugins: AXFormatter[] = [];\n\n private injector: Injector;\n\n constructor(injector: Injector) {\n this.injector = injector;\n }\n\n register(...plugins: (new () => AXFormatter)[]) {\n plugins.forEach((t) => {\n const childInjector = Injector.create({\n providers: [{ provide: t, useClass: t, deps: [] }],\n parent: this.injector,\n });\n const v = childInjector.get(t);\n\n if (v && !this.plugins.some((p) => p.name == v.name)) {\n this.plugins.push(v);\n }\n });\n }\n\n get formatters(): AXFormatter[] {\n return this.plugins;\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXFormatService {\n constructor(private pluginRegistry: AXFormatterRegistryService) {}\n\n private renderSubject = new Subject<void>();\n\n // Observable that other services/components can subscribe to\n onRender = this.renderSubject.asObservable();\n\n render() {\n this.renderSubject.next();\n }\n\n /**\n * Resolves a formatter by its name.\n * @param name The name of the formatter.\n * @returns The formatter if found, otherwise throws an error.\n */\n resolveFormatter(name: string): AXFormatter {\n const formatter = this.pluginRegistry.formatters.find((c) => c.name == name);\n if (!formatter) {\n throw new Error(`Formatter not found: ${name}`);\n }\n return formatter;\n }\n\n // Overload for traditional formatting\n format<K extends keyof AXFormatOptionsMap>(value: unknown, formatter: K, options?: AXFormatOptionsMap[K]): string;\n\n // Overload for starting fluent API chain\n format(value: unknown): AXFormatFluent;\n\n // Implementation of the format method\n format<K extends keyof AXFormatOptionsMap>(value: unknown, formatter?: K, options?: AXFormatOptionsMap[K]): string | AXFormatFluent {\n if (typeof formatter === 'string') {\n const formatterRef = this.resolveFormatter(formatter);\n return formatterRef.format(value, options);\n } else {\n return new AXFormatFluent(this, value);\n }\n }\n}\n\nclass AXFormatFluent {\n constructor(\n private formatService: AXFormatService,\n private initialValue: unknown,\n ) {}\n\n /**\n * Formats the value using the specified formatter and options.\n * @param formatter The name of the formatter to use.\n * @param options The options to pass to the formatter.\n * @returns The formatted string.\n */\n to<K extends keyof AXFormatOptionsMap>(formatter: K, options?: AXFormatOptionsMap[K]): string {\n try {\n const formatterRef = this.formatService.resolveFormatter(formatter);\n return formatterRef.format(this.initialValue, options);\n } catch (error) {\n return String(this.initialValue);\n }\n }\n}\n","import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AXFormatService } from './format.service';\nimport { AXFormatOptionsMap } from './format.types';\n\n@Directive({\n selector: '[formatter]',\n standalone: true,\n})\nexport class AXFormatterDirective implements OnInit {\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private formatService: AXFormatService,\n ) { }\n\n ngOnInit() {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: <K extends keyof AXFormatOptionsMap>(value: unknown, formatter: K, options?: AXFormatOptionsMap[K]) => {\n return this.formatService.format(value, formatter, options);\n },\n });\n }\n}\n","import { Injectable } from '@angular/core';\nimport { defaults, isInteger, padStart } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXNumberFormatterOptions extends AXFormatOptions {\n decimalPlaces?: number;\n thousandSeparator?: string;\n decimalSeparator?: string;\n zeroPadLength?: number; // New option for zero padding,\n locale?: string;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n number: AXNumberFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXNumberFormatter implements AXFormatter {\n private separatorsCache: any = {};\n\n get name(): string {\n return 'number';\n }\n\n format(value: number, options: AXNumberFormatterOptions): string {\n const { thousandSeparator, decimalSeparator } = this.getLocaleSeparators(options?.locale);\n // Merge user options with default options\n const effectiveOptions = defaults({}, options, {\n thousandSeparator,\n decimalSeparator,\n zeroPadLength: 0,\n locale: navigator.language,\n });\n\n const sign = value < 0 ? '-' : '';\n const absoluteValue = Math.abs(value);\n\n // Handling zero padding for integer part\n let integerPart = Math.floor(absoluteValue).toString();\n if (effectiveOptions.zeroPadLength && effectiveOptions.zeroPadLength > integerPart.length) {\n integerPart = padStart(integerPart, effectiveOptions.zeroPadLength, '0');\n }\n\n // Applying thousand separator to integer part\n if (effectiveOptions.thousandSeparator) {\n integerPart = integerPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, effectiveOptions.thousandSeparator);\n }\n\n // Constructing the final formatted value\n let formattedValue = sign + integerPart;\n if (effectiveOptions.decimalPlaces !== undefined) {\n // Limiting decimal places if specified\n const decimalPart = absoluteValue.toFixed(effectiveOptions.decimalPlaces).split('.')[1];\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n } else if (!isInteger(value)) {\n // Showing full decimal part if decimalPlaces is not specified\n const decimalPart = absoluteValue.toString().split('.')[1] || '';\n if (decimalPart.length > 0) {\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n }\n }\n\n return formattedValue;\n }\n\n private getLocaleSeparators(locale = navigator.language): {\n thousandSeparator: string;\n decimalSeparator: string;\n } {\n // Use cache if available\n if (this.separatorsCache[locale]) {\n return this.separatorsCache[locale];\n }\n\n const numberFormat = new Intl.NumberFormat(locale);\n const parts = numberFormat.formatToParts(1234567.89);\n let thousandSeparator = '';\n let decimalSeparator = '';\n\n for (const part of parts) {\n if (part.type === 'group') {\n thousandSeparator = part.value;\n } else if (part.type === 'decimal') {\n decimalSeparator = part.value;\n }\n }\n\n // Cache the result\n this.separatorsCache[locale] = { thousandSeparator, decimalSeparator };\n return this.separatorsCache[locale];\n }\n}\n","import { get } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXStringFormatterOptions extends AXFormatOptions {\n [key: string]: any;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n string: AXStringFormatterOptions;\n }\n}\n\nexport class AXStringFormatter implements AXFormatter {\n get name(): string {\n return 'string';\n }\n\n format(value: unknown, options: AXStringFormatterOptions): string {\n if (typeof value != 'string') return String(value);\n const result = get(options, value)\n ? get(options, value)\n : value.replace(/{{\\s*([^}]+)\\s*}}/g, (match, path: string) => {\n return (get(options, path.trim()) as string) ?? match;\n });\n\n return result;\n }\n}\n","import { AXEventData, AXEventService } from '@acorex/core/events';\nimport { Pipe, PipeTransform, inject } from '@angular/core';\nimport { Observable, filter, of, startWith, switchMap } from 'rxjs';\nimport { AXFormatService } from './format.service';\nimport { AXFormatOptions } from './format.types';\n\nenum AXLocaleEvents {\n AXLocaleChanged = 'AX_LOCALE_CHANGED',\n AXLocaleLoaded = 'AX_LOCALE_LOADED',\n //\n AXCalendarChanged = 'AX_CALENDAR_CHANGED',\n //\n AXLanguageChanged = 'AX_LANGUAGE_CHANGED',\n AXLanguageLoaded = 'AX_LANGUAGE_LOADED',\n}\n\n\n@Pipe({\n name: 'format',\n standalone: true,\n pure: true,\n})\nexport class AXFormatPipe implements PipeTransform {\n private formatService = inject(AXFormatService);\n private eventService = inject(AXEventService);\n\n private triggers = [...Object.values(AXLocaleEvents).map((event) => event as string)];\n\n transform(value: unknown, name: string, options?: AXFormatOptions | string): Observable<string> {\n // Initial formatted value\n const initialFormattedValue = this.formatService.format(value, name as any, options);\n\n // React to language changes and re-format the value\n return this.eventService.onEvent.pipe(\n filter((event: AXEventData) => this.triggers.includes(event.type as AXLocaleEvents)),\n startWith(initialFormattedValue), // Emit the initial formatted value immediately\n switchMap((event) => {\n // Re-call format method on every language change\n const formattedValue = this.formatService.format(value, name as any, options);\n return of(formattedValue);\n }),\n );\n }\n}\n","import { Inject, ModuleWithProviders, NgModule } from '@angular/core';\nimport { AXFormatter } from './format.config';\nimport { AXFormatterDirective } from './format.directive';\nimport { AXFormatterRegistryService } from './format.service';\nimport { AXNumberFormatter } from './formatters/number.formatter';\nimport { AXStringFormatter } from './formatters/string.formatter';\nimport { AXFormatPipe } from './format.pipe';\n\nconst BUILT_IN_RULES = [AXNumberFormatter, AXStringFormatter];\n\nexport interface AXFormatModuleConfigs {\n formatters: (new () => AXFormatter)[];\n}\n\n@NgModule({\n imports: [AXFormatterDirective, AXFormatPipe],\n exports: [AXFormatterDirective, AXFormatPipe],\n})\nexport class AXFormatModule {\n static forRoot(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Inject('AXFormatModuleFactory') instances: any[]) {\n instances.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AXFormatService"],"mappings":";;;;;;MAEsB,WAAW,CAAA;AAGhC;;MCGY,0BAA0B,CAAA;AAKrC,IAAA,WAAA,CAAY,QAAkB,EAAA;QAJtB,IAAO,CAAA,OAAA,GAAkB,EAAE;AAKjC,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;;IAG1B,QAAQ,CAAC,GAAG,OAAkC,EAAA;AAC5C,QAAA,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AACpB,YAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC;AACpC,gBAAA,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;gBAClD,MAAM,EAAE,IAAI,CAAC,QAAQ;AACtB,aAAA,CAAC;YACF,MAAM,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;YAE9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;AACpD,gBAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;;AAExB,SAAC,CAAC;;AAGJ,IAAA,IAAI,UAAU,GAAA;QACZ,OAAO,IAAI,CAAC,OAAO;;8GAxBV,0BAA0B,EA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,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,oBAAoB,EAAE,YAAY,CAAC;AAC7C,oBAAA,OAAO,EAAE,CAAC,oBAAoB,EAAE,YAAY,CAAC;AAC9C,iBAAA;;0BAuCc,MAAM;2BAAC,uBAAuB;;;ACxD7C;;AAEG;;;;"}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
const AXAURegionalConfig = {
|
2
|
+
localeInfo: {
|
3
|
+
code: 'en-AU',
|
4
|
+
language: 'en',
|
5
|
+
region: 'AU',
|
6
|
+
timezone: 'Australia/Sydney',
|
7
|
+
},
|
8
|
+
calendar: {
|
9
|
+
system: 'gregorian',
|
10
|
+
week: {
|
11
|
+
startsOn: 1, // Monday
|
12
|
+
weekends: [0, 6], // Sunday + Saturday
|
13
|
+
},
|
14
|
+
clock: {
|
15
|
+
format24Hour: true,
|
16
|
+
},
|
17
|
+
},
|
18
|
+
formats: {
|
19
|
+
date: {
|
20
|
+
short: 'DD/MM/YY',
|
21
|
+
medium: 'DD MMM YYYY',
|
22
|
+
long: 'DD MMMM YYYY',
|
23
|
+
full: 'dddd, DD MMMM YYYY',
|
24
|
+
},
|
25
|
+
time: {
|
26
|
+
short: 'HH:mm',
|
27
|
+
medium: 'HH:mm:ss',
|
28
|
+
long: 'HH:mm:ss Z',
|
29
|
+
full: 'HH:mm:ss ZZZZ',
|
30
|
+
},
|
31
|
+
datetime: {
|
32
|
+
short: 'DD/MM/YY HH:mm',
|
33
|
+
medium: 'DD MMM YYYY HH:mm:ss',
|
34
|
+
long: 'DD MMMM YYYY HH:mm:ss Z',
|
35
|
+
full: 'dddd, DD MMMM YYYY HH:mm:ss ZZZZ',
|
36
|
+
},
|
37
|
+
numbers: {
|
38
|
+
decimalPattern: '1,000.00',
|
39
|
+
currency: {
|
40
|
+
code: 'AUD',
|
41
|
+
},
|
42
|
+
},
|
43
|
+
contacts: {
|
44
|
+
phone: '04XX XXX XXX',
|
45
|
+
postalCode: '0000',
|
46
|
+
},
|
47
|
+
},
|
48
|
+
units: {
|
49
|
+
temperature: 'celsius',
|
50
|
+
distance: 'kilometers',
|
51
|
+
weight: 'kilograms',
|
52
|
+
volume: 'liters',
|
53
|
+
speed: 'km/h',
|
54
|
+
area: 'square-meters',
|
55
|
+
},
|
56
|
+
i18nMeta: {
|
57
|
+
rtl: false,
|
58
|
+
fallbackLocales: ['en-AU'],
|
59
|
+
supportedLanguages: ['en-AU'],
|
60
|
+
},
|
61
|
+
};
|
62
|
+
|
63
|
+
export { AXAURegionalConfig };
|
64
|
+
//# sourceMappingURL=acorex-core-locale-en-AU.profile-BW-_9tgT.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"acorex-core-locale-en-AU.profile-BW-_9tgT.mjs","sources":["../../../../libs/core/locale/src/lib/profiles/en-AU.profile.ts"],"sourcesContent":["import { AXLocaleProfile } from \"../locale.types\";\n\nexport const AXAURegionalConfig: AXLocaleProfile = {\n localeInfo: {\n code: 'en-AU',\n language: 'en',\n region: 'AU',\n timezone: 'Australia/Sydney',\n },\n calendar: {\n system: 'gregorian',\n week: {\n startsOn: 1, // Monday\n weekends: [0, 6], // Sunday + Saturday\n },\n clock: {\n format24Hour: true,\n },\n },\n formats: {\n date: {\n short: 'DD/MM/YY',\n medium: 'DD MMM YYYY',\n long: 'DD MMMM YYYY',\n full: 'dddd, DD MMMM YYYY',\n },\n time: {\n short: 'HH:mm',\n medium: 'HH:mm:ss',\n long: 'HH:mm:ss Z',\n full: 'HH:mm:ss ZZZZ',\n },\n datetime: {\n short: 'DD/MM/YY HH:mm',\n medium: 'DD MMM YYYY HH:mm:ss',\n long: 'DD MMMM YYYY HH:mm:ss Z',\n full: 'dddd, DD MMMM YYYY HH:mm:ss ZZZZ',\n },\n numbers: {\n decimalPattern: '1,000.00',\n currency: {\n code: 'AUD',\n },\n },\n contacts: {\n phone: '04XX XXX XXX',\n postalCode: '0000',\n },\n },\n\n units: {\n temperature: 'celsius',\n distance: 'kilometers',\n weight: 'kilograms',\n volume: 'liters',\n speed: 'km/h',\n area: 'square-meters',\n },\n\n i18nMeta: {\n rtl: false,\n fallbackLocales: ['en-AU'],\n supportedLanguages: ['en-AU'],\n },\n};\n"],"names":[],"mappings":"AAEa,MAAA,kBAAkB,GAAoB;AAC/C,IAAA,UAAU,EAAE;AACR,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,QAAQ,EAAE,kBAAkB;AAC/B,KAAA;AACD,IAAA,QAAQ,EAAE;AACN,QAAA,MAAM,EAAE,WAAW;AACnB,QAAA,IAAI,EAAE;YACF,QAAQ,EAAE,CAAC;AACX,YAAA,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACnB,SAAA;AACD,QAAA,KAAK,EAAE;AACH,YAAA,YAAY,EAAE,IAAI;AACrB,SAAA;AACJ,KAAA;AACD,IAAA,OAAO,EAAE;AACL,QAAA,IAAI,EAAE;AACF,YAAA,KAAK,EAAE,UAAU;AACjB,YAAA,MAAM,EAAE,aAAa;AACrB,YAAA,IAAI,EAAE,cAAc;AACpB,YAAA,IAAI,EAAE,oBAAoB;AAC7B,SAAA;AACD,QAAA,IAAI,EAAE;AACF,YAAA,KAAK,EAAE,OAAO;AACd,YAAA,MAAM,EAAE,UAAU;AAClB,YAAA,IAAI,EAAE,YAAY;AAClB,YAAA,IAAI,EAAE,eAAe;AACxB,SAAA;AACD,QAAA,QAAQ,EAAE;AACN,YAAA,KAAK,EAAE,gBAAgB;AACvB,YAAA,MAAM,EAAE,sBAAsB;AAC9B,YAAA,IAAI,EAAE,yBAAyB;AAC/B,YAAA,IAAI,EAAE,kCAAkC;AAC3C,SAAA;AACD,QAAA,OAAO,EAAE;AACL,YAAA,cAAc,EAAE,UAAU;AAC1B,YAAA,QAAQ,EAAE;AACN,gBAAA,IAAI,EAAE,KAAK;AACd,aAAA;AACJ,SAAA;AACD,QAAA,QAAQ,EAAE;AACN,YAAA,KAAK,EAAE,cAAc;AACrB,YAAA,UAAU,EAAE,MAAM;AACrB,SAAA;AACJ,KAAA;AAED,IAAA,KAAK,EAAE;AACH,QAAA,WAAW,EAAE,SAAS;AACtB,QAAA,QAAQ,EAAE,YAAY;AACtB,QAAA,MAAM,EAAE,WAAW;AACnB,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,IAAI,EAAE,eAAe;AACxB,KAAA;AAED,IAAA,QAAQ,EAAE;AACN,QAAA,GAAG,EAAE,KAAK;QACV,eAAe,EAAE,CAAC,OAAO,CAAC;QAC1B,kBAAkB,EAAE,CAAC,OAAO,CAAC;AAChC,KAAA;;;;;"}
|
@@ -0,0 +1,341 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { InjectionToken, inject, Injectable, signal, NgModule } from '@angular/core';
|
3
|
+
import cloneDeep from 'lodash/cloneDeep';
|
4
|
+
import merge from 'lodash/merge';
|
5
|
+
import set from 'lodash/set';
|
6
|
+
import { toObservable } from '@angular/core/rxjs-interop';
|
7
|
+
import * as i1 from '@acorex/core/format';
|
8
|
+
import { AXFormatModule } from '@acorex/core/format';
|
9
|
+
|
10
|
+
const AX_LOCALE_CONFIG = new InjectionToken('AX_LOCALE_CONFIG', {
|
11
|
+
providedIn: 'root',
|
12
|
+
factory: () => {
|
13
|
+
return {
|
14
|
+
default: 'en-US',
|
15
|
+
};
|
16
|
+
},
|
17
|
+
});
|
18
|
+
|
19
|
+
const AX_LOCALE_PROFILE_PROVIDERS = new InjectionToken('AX_LOCALE_PROFILE_PROVIDERS', {
|
20
|
+
providedIn: 'root',
|
21
|
+
factory: () => [new AXLocaleProfileProviderDefault()],
|
22
|
+
});
|
23
|
+
// ✅ Lazy-loaded default provider
|
24
|
+
class AXLocaleProfileProviderDefault {
|
25
|
+
async provide() {
|
26
|
+
return {
|
27
|
+
'en-AU': () => import('./acorex-core-locale-en-AU.profile-BW-_9tgT.mjs').then(m => m.AXAURegionalConfig),
|
28
|
+
'en-US': () => Promise.resolve().then(function () { return enUS_profile; }).then(m => m.AXUSLocaleProfile),
|
29
|
+
'fa-IR': () => Promise.resolve().then(function () { return faIR_profile; }).then(m => m.AXIRLocaleProfile),
|
30
|
+
};
|
31
|
+
}
|
32
|
+
}
|
33
|
+
class AXLocaleProfileProviderService {
|
34
|
+
constructor() {
|
35
|
+
this.providers = inject(AX_LOCALE_PROFILE_PROVIDERS);
|
36
|
+
this.registry = new Map();
|
37
|
+
this.resolvedCache = new Map();
|
38
|
+
this.isInitialized = false;
|
39
|
+
}
|
40
|
+
async init() {
|
41
|
+
if (this.isInitialized)
|
42
|
+
return;
|
43
|
+
for (const provider of this.providers) {
|
44
|
+
const result = await provider.provide();
|
45
|
+
for (const [localeCode, loaderFn] of Object.entries(result)) {
|
46
|
+
if (typeof loaderFn === 'function') {
|
47
|
+
this.registry.set(localeCode, async () => {
|
48
|
+
const profile = await loaderFn();
|
49
|
+
return profile;
|
50
|
+
});
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
console.warn(`[AXLocaleService] Profile for "${localeCode}" is not a function. Skipped.`);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
this.isInitialized = true;
|
58
|
+
}
|
59
|
+
async getList() {
|
60
|
+
await this.init();
|
61
|
+
const profiles = [];
|
62
|
+
for (const localeCode of this.registry.keys()) {
|
63
|
+
const profile = await this.getByLocale(localeCode);
|
64
|
+
if (profile)
|
65
|
+
profiles.push(profile);
|
66
|
+
}
|
67
|
+
return profiles;
|
68
|
+
}
|
69
|
+
async getByLocale(localeCode) {
|
70
|
+
await this.init();
|
71
|
+
// If already loaded, return from cache
|
72
|
+
if (this.resolvedCache.has(localeCode)) {
|
73
|
+
return this.resolvedCache.get(localeCode);
|
74
|
+
}
|
75
|
+
// Otherwise, try to load it
|
76
|
+
const loader = this.registry.get(localeCode);
|
77
|
+
if (!loader) {
|
78
|
+
console.warn(`[AXLocaleService] No profile loader found for locale: "${localeCode}"`);
|
79
|
+
return undefined;
|
80
|
+
}
|
81
|
+
const profile = await loader();
|
82
|
+
this.resolvedCache.set(localeCode, profile);
|
83
|
+
return profile;
|
84
|
+
}
|
85
|
+
async reload() {
|
86
|
+
this.registry.clear();
|
87
|
+
this.resolvedCache.clear();
|
88
|
+
this.isInitialized = false;
|
89
|
+
await this.init();
|
90
|
+
}
|
91
|
+
has(localeCode) {
|
92
|
+
return this.registry.has(localeCode);
|
93
|
+
}
|
94
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXLocaleProfileProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
95
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXLocaleProfileProviderService, providedIn: 'root' }); }
|
96
|
+
}
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXLocaleProfileProviderService, decorators: [{
|
98
|
+
type: Injectable,
|
99
|
+
args: [{
|
100
|
+
providedIn: 'root',
|
101
|
+
}]
|
102
|
+
}] });
|
103
|
+
|
104
|
+
var AXLocaleEvents;
|
105
|
+
(function (AXLocaleEvents) {
|
106
|
+
AXLocaleEvents["AXLocaleChanged"] = "AX_LOCALE_CHANGED";
|
107
|
+
AXLocaleEvents["AXLocaleLoaded"] = "AX_LOCALE_LOADED";
|
108
|
+
//
|
109
|
+
AXLocaleEvents["AXCalendarChanged"] = "AX_CALENDAR_CHANGED";
|
110
|
+
//
|
111
|
+
AXLocaleEvents["AXLanguageChanged"] = "AX_LANGUAGE_CHANGED";
|
112
|
+
AXLocaleEvents["AXLanguageLoaded"] = "AX_LANGUAGE_LOADED";
|
113
|
+
})(AXLocaleEvents || (AXLocaleEvents = {}));
|
114
|
+
|
115
|
+
const AXUSLocaleProfile = {
|
116
|
+
localeInfo: {
|
117
|
+
code: 'en-US',
|
118
|
+
language: 'en',
|
119
|
+
region: 'US',
|
120
|
+
timezone: 'America/New_York',
|
121
|
+
},
|
122
|
+
calendar: {
|
123
|
+
system: 'gregorian',
|
124
|
+
week: {
|
125
|
+
startsOn: 0, // Sunday
|
126
|
+
weekends: [0, 6], // Sunday + Saturday
|
127
|
+
},
|
128
|
+
clock: {
|
129
|
+
format24Hour: false,
|
130
|
+
},
|
131
|
+
},
|
132
|
+
formats: {
|
133
|
+
date: {
|
134
|
+
short: 'MM/DD/YY',
|
135
|
+
medium: 'MMM DD, YYYY',
|
136
|
+
long: 'MMMM DD, YYYY',
|
137
|
+
full: 'dddd, MMMM DD, YYYY',
|
138
|
+
},
|
139
|
+
time: {
|
140
|
+
short: 'hh:mm A',
|
141
|
+
medium: 'hh:mm:ss A',
|
142
|
+
long: 'hh:mm:ss A Z',
|
143
|
+
full: 'hh:mm:ss A ZZZZ',
|
144
|
+
},
|
145
|
+
datetime: {
|
146
|
+
short: 'MM/DD/YY hh:mm A',
|
147
|
+
medium: 'MMM DD, YYYY hh:mm:ss A',
|
148
|
+
long: 'MMMM DD, YYYY hh:mm:ss A Z',
|
149
|
+
full: 'dddd, MMMM DD, YYYY hh:mm:ss A ZZZZ',
|
150
|
+
},
|
151
|
+
numbers: {
|
152
|
+
decimalPattern: '1,000.00',
|
153
|
+
currency: {
|
154
|
+
code: 'USD',
|
155
|
+
},
|
156
|
+
},
|
157
|
+
contacts: {
|
158
|
+
phone: '(000) 000-0000',
|
159
|
+
postalCode: '00000',
|
160
|
+
},
|
161
|
+
},
|
162
|
+
units: {
|
163
|
+
temperature: 'fahrenheit',
|
164
|
+
distance: 'miles',
|
165
|
+
weight: 'pounds',
|
166
|
+
volume: 'gallons',
|
167
|
+
speed: 'mph',
|
168
|
+
area: 'square-feet',
|
169
|
+
},
|
170
|
+
i18nMeta: {
|
171
|
+
rtl: false,
|
172
|
+
fallbackLocales: ['en-US'],
|
173
|
+
supportedLanguages: ['en-US'],
|
174
|
+
},
|
175
|
+
};
|
176
|
+
|
177
|
+
var enUS_profile = /*#__PURE__*/Object.freeze({
|
178
|
+
__proto__: null,
|
179
|
+
AXUSLocaleProfile: AXUSLocaleProfile
|
180
|
+
});
|
181
|
+
|
182
|
+
const AXIRLocaleProfile = {
|
183
|
+
localeInfo: {
|
184
|
+
code: 'fa-IR',
|
185
|
+
language: 'fa',
|
186
|
+
region: 'IR',
|
187
|
+
timezone: 'Asia/Tehran',
|
188
|
+
},
|
189
|
+
calendar: {
|
190
|
+
system: 'solar-hijri',
|
191
|
+
week: {
|
192
|
+
startsOn: 6, // Saturday
|
193
|
+
weekends: [5], // Friday
|
194
|
+
},
|
195
|
+
clock: {
|
196
|
+
format24Hour: true,
|
197
|
+
},
|
198
|
+
},
|
199
|
+
formats: {
|
200
|
+
date: {
|
201
|
+
short: 'YY/MM/DD',
|
202
|
+
medium: 'YYYY/MM/DD',
|
203
|
+
long: 'dddd، D MMMM YYYY',
|
204
|
+
full: 'dddd، D MMMM YYYY',
|
205
|
+
},
|
206
|
+
time: {
|
207
|
+
short: 'HH:mm',
|
208
|
+
medium: 'HH:mm:ss',
|
209
|
+
long: 'HH:mm:ss Z',
|
210
|
+
full: 'HH:mm:ss ZZZZ',
|
211
|
+
},
|
212
|
+
datetime: {
|
213
|
+
short: 'YY/MM/DD HH:mm',
|
214
|
+
medium: 'YYYY/MM/DD HH:mm:ss',
|
215
|
+
long: 'dddd، D MMMM YYYY HH:mm:ss Z',
|
216
|
+
full: 'dddd، D MMMM YYYY HH:mm:ss ZZZZ',
|
217
|
+
},
|
218
|
+
numbers: {
|
219
|
+
decimalPattern: '1٬000٫00',
|
220
|
+
currency: {
|
221
|
+
code: 'IRR',
|
222
|
+
},
|
223
|
+
},
|
224
|
+
contacts: {
|
225
|
+
phone: '09XX XXX XXXX',
|
226
|
+
postalCode: 'XXXXX-XXXXX',
|
227
|
+
},
|
228
|
+
},
|
229
|
+
units: {
|
230
|
+
temperature: 'celsius',
|
231
|
+
distance: 'kilometers',
|
232
|
+
weight: 'kilograms',
|
233
|
+
volume: 'liters',
|
234
|
+
speed: 'km/h',
|
235
|
+
area: 'square-meters',
|
236
|
+
},
|
237
|
+
i18nMeta: {
|
238
|
+
rtl: true,
|
239
|
+
fallbackLocales: ['en-IR'],
|
240
|
+
supportedLanguages: ['fa-IR', 'en-IR'],
|
241
|
+
},
|
242
|
+
};
|
243
|
+
|
244
|
+
var faIR_profile = /*#__PURE__*/Object.freeze({
|
245
|
+
__proto__: null,
|
246
|
+
AXIRLocaleProfile: AXIRLocaleProfile
|
247
|
+
});
|
248
|
+
|
249
|
+
class AXLocaleService {
|
250
|
+
async setProfile(localeCode) {
|
251
|
+
const profile = await this.provider.getByLocale(localeCode);
|
252
|
+
if (profile) {
|
253
|
+
this.originalProfile = cloneDeep(profile);
|
254
|
+
this._activeProfile.set(cloneDeep(profile));
|
255
|
+
}
|
256
|
+
else {
|
257
|
+
console.warn(`[AXLocaleService] Locale not found: ${localeCode}`);
|
258
|
+
}
|
259
|
+
}
|
260
|
+
/**
|
261
|
+
*
|
262
|
+
*/
|
263
|
+
constructor() {
|
264
|
+
this.provider = inject(AXLocaleProfileProviderService);
|
265
|
+
this.config = inject(AX_LOCALE_CONFIG);
|
266
|
+
this._activeProfile = signal(AXUSLocaleProfile);
|
267
|
+
this.activeProfile = this._activeProfile.asReadonly();
|
268
|
+
this.profileChanged$ = toObservable(this._activeProfile);
|
269
|
+
this.originalProfile = cloneDeep(AXUSLocaleProfile);
|
270
|
+
this.setProfile(this.config.default);
|
271
|
+
}
|
272
|
+
apply(arg1, arg2) {
|
273
|
+
const current = this.activeProfile();
|
274
|
+
if (!current) {
|
275
|
+
console.warn('[AXLocaleService] No active profile found');
|
276
|
+
return;
|
277
|
+
}
|
278
|
+
;
|
279
|
+
const updated = cloneDeep(current);
|
280
|
+
if (typeof arg1 === 'string' && arg2 !== undefined) {
|
281
|
+
// Overload: updateProfile('formats.date.full', 'YYYY-MM-DD')
|
282
|
+
set(updated, arg1, arg2);
|
283
|
+
}
|
284
|
+
else if (typeof arg1 === 'object') {
|
285
|
+
// Overload: updateProfile({ formats: { date: { short: '...' } } })
|
286
|
+
merge(updated, arg1);
|
287
|
+
}
|
288
|
+
else {
|
289
|
+
console.warn('[AXLocaleService] Invalid arguments passed to updateProfile()');
|
290
|
+
return;
|
291
|
+
}
|
292
|
+
}
|
293
|
+
reset() {
|
294
|
+
if (this.originalProfile) {
|
295
|
+
this._activeProfile.set(cloneDeep(this.originalProfile));
|
296
|
+
}
|
297
|
+
}
|
298
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXLocaleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
299
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXLocaleService, providedIn: 'root' }); }
|
300
|
+
}
|
301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXLocaleService, decorators: [{
|
302
|
+
type: Injectable,
|
303
|
+
args: [{
|
304
|
+
providedIn: 'root',
|
305
|
+
}]
|
306
|
+
}], ctorParameters: () => [] });
|
307
|
+
|
308
|
+
class AXLocaleModule {
|
309
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXLocaleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
310
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: AXLocaleModule, imports: [i1.AXFormatModule] }); }
|
311
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXLocaleModule, imports: [AXFormatModule.forChild({
|
312
|
+
formatters: [],
|
313
|
+
})] }); }
|
314
|
+
}
|
315
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AXLocaleModule, decorators: [{
|
316
|
+
type: NgModule,
|
317
|
+
args: [{
|
318
|
+
imports: [
|
319
|
+
AXFormatModule.forChild({
|
320
|
+
formatters: [],
|
321
|
+
}),
|
322
|
+
],
|
323
|
+
}]
|
324
|
+
}] });
|
325
|
+
|
326
|
+
// @Injectable()
|
327
|
+
// export class AXCurrencyFormatter implements AXFormatter {
|
328
|
+
// get name(): string {
|
329
|
+
// return 'currency';
|
330
|
+
// }
|
331
|
+
// format(value: number, options: AXCurrencyFormatterOptions): string {
|
332
|
+
// return value.toLocaleString(options.locale, { style: 'currency', currency: options.currency });
|
333
|
+
// }
|
334
|
+
// }
|
335
|
+
|
336
|
+
/**
|
337
|
+
* Generated bundle index. Do not edit.
|
338
|
+
*/
|
339
|
+
|
340
|
+
export { AXIRLocaleProfile, AXLocaleEvents, AXLocaleModule, AXLocaleProfileProviderDefault, AXLocaleProfileProviderService, AXLocaleService, AXUSLocaleProfile, AX_LOCALE_CONFIG, AX_LOCALE_PROFILE_PROVIDERS };
|
341
|
+
//# sourceMappingURL=acorex-core-locale.mjs.map
|