@acorex/core 19.14.0-next.2 → 19.14.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 +2 -1
- package/date-time/lib/calendar.service.d.ts +1 -1
- package/date-time/lib/formatters/date.formatter.d.ts +3 -3
- package/date-time/lib/formatters/time-duration.formatter.d.ts +3 -0
- package/fesm2022/acorex-core-components.mjs.map +1 -1
- package/fesm2022/acorex-core-config.mjs.map +1 -1
- package/fesm2022/acorex-core-constants.mjs +1 -16
- package/fesm2022/acorex-core-constants.mjs.map +1 -1
- package/fesm2022/acorex-core-date-time.mjs +135 -103
- package/fesm2022/acorex-core-date-time.mjs.map +1 -1
- package/fesm2022/acorex-core-events.mjs.map +1 -1
- package/fesm2022/acorex-core-file.mjs.map +1 -1
- package/fesm2022/acorex-core-format.mjs +39 -39
- package/fesm2022/acorex-core-format.mjs.map +1 -1
- package/fesm2022/acorex-core-image.mjs.map +1 -1
- package/fesm2022/acorex-core-locale-en-AU.profile-DNjKIaZS.mjs.map +1 -1
- package/fesm2022/acorex-core-locale.mjs +110 -110
- package/fesm2022/acorex-core-locale.mjs.map +1 -1
- package/fesm2022/acorex-core-memoize.mjs.map +1 -1
- package/fesm2022/acorex-core-network.mjs +42 -43
- package/fesm2022/acorex-core-network.mjs.map +1 -1
- package/fesm2022/acorex-core-pipes.mjs.map +1 -1
- package/fesm2022/acorex-core-platform.mjs +4 -7
- package/fesm2022/acorex-core-platform.mjs.map +1 -1
- package/fesm2022/acorex-core-storage.mjs +14 -16
- package/fesm2022/acorex-core-storage.mjs.map +1 -1
- package/fesm2022/acorex-core-translation.mjs +59 -25
- package/fesm2022/acorex-core-translation.mjs.map +1 -1
- package/fesm2022/acorex-core-types.mjs +1 -7
- package/fesm2022/acorex-core-types.mjs.map +1 -1
- package/fesm2022/acorex-core-utils.mjs +120 -115
- package/fesm2022/acorex-core-utils.mjs.map +1 -1
- package/fesm2022/acorex-core-validation.mjs +12 -8
- package/fesm2022/acorex-core-validation.mjs.map +1 -1
- package/fesm2022/acorex-core.mjs.map +1 -1
- package/format/index.d.ts +1 -1
- package/locale/index.d.ts +4 -4
- package/locale/lib/locale-profile-provider.service.d.ts +2 -2
- package/locale/lib/locale.config.d.ts +1 -1
- package/locale/lib/profiles/en-AU.profile.d.ts +1 -1
- package/locale/lib/profiles/en-US.profile.d.ts +1 -1
- package/locale/lib/profiles/fa-IR.profile.d.ts +1 -1
- package/network/index.d.ts +2 -2
- package/network/lib/download-task.d.ts +1 -1
- package/package.json +1 -1
- package/storage/cookie-storage.service.d.ts +2 -2
- package/translation/index.d.ts +1 -1
- package/translation/lib/translation.parser.d.ts +1 -1
- package/translation/lib/translation.resolver.d.ts +1 -1
- package/translation/lib/translation.service.d.ts +1 -1
- package/utils/index.d.ts +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-file.mjs","sources":["../../../../
|
1
|
+
{"version":3,"file":"acorex-core-file.mjs","sources":["../../../../packages/core/file/src/lib/file-size-formatter.ts","../../../../packages/core/file/src/lib/file.module.ts","../../../../packages/core/file/src/lib/file.service.ts","../../../../packages/core/file/src/acorex-core-file.ts"],"sourcesContent":["import { AXFormatOptions, AXFormatter } from '@acorex/core/format';\nimport { Injectable } from '@angular/core';\n\nexport interface AXFileSizeFormatterOptions extends AXFormatOptions {\n format: string;\n}\n\ndeclare module '@acorex/core/format' {\n interface AXFormatOptionsMap {\n filesize: AXFileSizeFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXFileSizeFormatter implements AXFormatter {\n get name(): string {\n return 'filesize';\n }\n\n format(value: number): string {\n const size = Number(value);\n\n if (size === 0) return '0 Bytes';\n if (Number.isNaN(size)) return 'Unknown';\n\n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const i = Math.floor(Math.log(size) / Math.log(k));\n\n return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n }\n}\n","import { AXFormatModule } from '@acorex/core/format';\nimport { NgModule } from '@angular/core';\nimport { AXFileSizeFormatter } from './file-size-formatter';\n\n@NgModule({\n imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })],\n exports: [],\n declarations: [],\n providers: [AXFileSizeFormatter],\n})\nexport class AXFileModule {}\n","import { DOCUMENT } from '@angular/common';\nimport { inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFileService {\n private document = inject(DOCUMENT);\n private platformID = inject(PLATFORM_ID);\n\n public choose(options?: { accept?: string; multiple?: boolean }): Promise<File[]> {\n return new Promise<File[]>((resolve, reject) => {\n options = Object.assign({ multiple: false }, options);\n const input: HTMLInputElement = this.document.createElement('input');\n input.style.display = 'none';\n this.document.body.appendChild(input);\n input.type = 'file';\n input.accept = options.accept || '';\n input.multiple = options.multiple || false;\n //\n const onError = (e) => {\n reject(e);\n this.document.body.removeChild(input);\n input.remove();\n input.removeEventListener('change', onChange);\n input.removeEventListener('error', onError);\n };\n //\n const onChange = () => {\n resolve(Array.from(input.files || []));\n this.document.body.removeChild(input);\n input.remove();\n input.removeEventListener('change', onChange);\n input.removeEventListener('error', onError);\n };\n //\n input.addEventListener('change', onChange);\n input.addEventListener('error', onError);\n input.click();\n });\n }\n\n public blobToBase64 = (blob: Blob) => {\n if (blob instanceof Blob) {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = reject;\n reader.onload = () => {\n resolve(reader.result as string);\n };\n reader.readAsDataURL(blob);\n });\n } else {\n return Promise.reject('input is not blob');\n }\n };\n\n public getSize(file: File | Blob | string) {\n if (this.isBase64(file as string)) {\n return this.getBase64Size(file as string);\n }\n return false;\n }\n\n public isBase64(base64: string) {\n const regx = /[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/;\n return regx.test(base64);\n }\n\n public getBase64Size(base64: string) {\n return atob(base64.substring(base64.indexOf(',') + 1)).length;\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
|
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 { defaults, padStart, isInteger, get } from 'lodash-es';
|
5
4
|
import { AXEventService } from '@acorex/core/events';
|
5
|
+
import { defaults, padStart, isInteger, get } from 'lodash-es';
|
6
6
|
|
7
7
|
class AXFormatter {
|
8
8
|
}
|
@@ -122,6 +122,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
122
122
|
}]
|
123
123
|
}], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: AXFormatService }] });
|
124
124
|
|
125
|
+
var AXLocaleEvents;
|
126
|
+
(function (AXLocaleEvents) {
|
127
|
+
AXLocaleEvents["AXLocaleChanged"] = "AX_LOCALE_CHANGED";
|
128
|
+
AXLocaleEvents["AXLocaleLoaded"] = "AX_LOCALE_LOADED";
|
129
|
+
//
|
130
|
+
AXLocaleEvents["AXCalendarChanged"] = "AX_CALENDAR_CHANGED";
|
131
|
+
//
|
132
|
+
AXLocaleEvents["AXLanguageChanged"] = "AX_LANGUAGE_CHANGED";
|
133
|
+
AXLocaleEvents["AXLanguageLoaded"] = "AX_LANGUAGE_LOADED";
|
134
|
+
})(AXLocaleEvents || (AXLocaleEvents = {}));
|
135
|
+
class AXFormatPipe {
|
136
|
+
constructor() {
|
137
|
+
this.formatService = inject(AXFormatService);
|
138
|
+
this.eventService = inject(AXEventService);
|
139
|
+
this.triggers = [...Object.values(AXLocaleEvents).map((event) => event)];
|
140
|
+
}
|
141
|
+
transform(value, name, options) {
|
142
|
+
// Initial formatted value
|
143
|
+
const initialFormattedValue = this.formatService.format(value, name, options);
|
144
|
+
// React to language changes and re-format the value
|
145
|
+
return this.eventService.onEvent.pipe(filter((event) => this.triggers.includes(event.type)), startWith(initialFormattedValue), // Emit the initial formatted value immediately
|
146
|
+
switchMap((event) => {
|
147
|
+
// Re-call format method on every language change
|
148
|
+
const formattedValue = this.formatService.format(value, name, options);
|
149
|
+
return of(formattedValue);
|
150
|
+
}));
|
151
|
+
}
|
152
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
153
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: AXFormatPipe, isStandalone: true, name: "format" }); }
|
154
|
+
}
|
155
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXFormatPipe, decorators: [{
|
156
|
+
type: Pipe,
|
157
|
+
args: [{
|
158
|
+
name: 'format',
|
159
|
+
pure: true,
|
160
|
+
}]
|
161
|
+
}] });
|
162
|
+
|
125
163
|
class AXNumberFormatter {
|
126
164
|
constructor() {
|
127
165
|
this.separatorsCache = {};
|
@@ -209,44 +247,6 @@ class AXStringFormatter {
|
|
209
247
|
}
|
210
248
|
}
|
211
249
|
|
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.10", ngImport: i0, type: AXFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
240
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: AXFormatPipe, isStandalone: true, name: "format" }); }
|
241
|
-
}
|
242
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXFormatPipe, decorators: [{
|
243
|
-
type: Pipe,
|
244
|
-
args: [{
|
245
|
-
name: 'format',
|
246
|
-
pure: true,
|
247
|
-
}]
|
248
|
-
}] });
|
249
|
-
|
250
250
|
const BUILT_IN_RULES = [AXNumberFormatter, AXStringFormatter];
|
251
251
|
class AXFormatModule {
|
252
252
|
static forRoot(configs) {
|
@@ -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/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 * 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 get(name: string): AXFormatter {\n const formatter = this.formatters.find((c) => c.name == name);\n if (!formatter) {\n throw new Error(`Formatter not found: ${name}`);\n }\n return formatter;\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\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.pluginRegistry.get(formatter);\n return formatterRef.format(value, options);\n } else {\n return new AXFormatFluent(this, this.pluginRegistry, value);\n }\n }\n}\n\nclass AXFormatFluent {\n constructor(\n private formatService: AXFormatService,\n private pluginRegistry: AXFormatterRegistryService,\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.pluginRegistry.get(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})\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>(\n value: unknown,\n formatter: K,\n options?: AXFormatOptionsMap[K],\n ) => {\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@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 = [...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,M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A,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,kBAsCL,uBAAuB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAtChC,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,YAHf,oBAAoB,EAAE,YAAY,CAClC,EAAA,OAAA,EAAA,CAAA,oBAAoB,EAAE,YAAY,CAAA,EAAA,CAAA,CAAA;gHAEjC,cAAc,EAAA,CAAA,CAAA;;4FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAJ1B,QAAQ;AAAC,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;;;;"}
|
1
|
+
{"version":3,"file":"acorex-core-format.mjs","sources":["../../../../packages/core/format/src/lib/format.config.ts","../../../../packages/core/format/src/lib/format.service.ts","../../../../packages/core/format/src/lib/format.directive.ts","../../../../packages/core/format/src/lib/format.pipe.ts","../../../../packages/core/format/src/lib/formatters/number.formatter.ts","../../../../packages/core/format/src/lib/formatters/string.formatter.ts","../../../../packages/core/format/src/lib/format.module.ts","../../../../packages/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 * 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 get(name: string): AXFormatter {\n const formatter = this.formatters.find((c) => c.name == name);\n if (!formatter) {\n throw new Error(`Formatter not found: ${name}`);\n }\n return formatter;\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 // 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>(\n value: unknown,\n formatter?: K,\n options?: AXFormatOptionsMap[K],\n ): string | AXFormatFluent {\n if (typeof formatter === 'string') {\n const formatterRef = this.pluginRegistry.get(formatter);\n return formatterRef.format(value, options);\n } else {\n return new AXFormatFluent(this, this.pluginRegistry, value);\n }\n }\n}\n\nclass AXFormatFluent {\n constructor(\n private formatService: AXFormatService,\n private pluginRegistry: AXFormatterRegistryService,\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.pluginRegistry.get(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})\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>(\n value: unknown,\n formatter: K,\n options?: AXFormatOptionsMap[K],\n ) => {\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\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@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 = [...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 { 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: [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,a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EAAA,CAAA,CAAA;AAtChC,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,YAHf,oBAAoB,EAAE,YAAY,CAClC,EAAA,OAAA,EAAA,CAAA,oBAAoB,EAAE,YAAY,CAAA,EAAA,CAAA,CAAA;gHAEjC,cAAc,EAAA,CAAA,CAAA;;4FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAJ1B,QAAQ;AAAC,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;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-image.mjs","sources":["../../../../
|
1
|
+
{"version":3,"file":"acorex-core-image.mjs","sources":["../../../../packages/core/image/src/lib/image.service.ts","../../../../packages/core/image/src/acorex-core-image.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n@Injectable()\nexport class AXImageService {\n private document = inject(DOCUMENT);\n private platformID = inject(PLATFORM_ID);\n async resize(options: {\n maxSize: number;\n source: HTMLImageElement | File;\n type?: 'image/png' | 'image/jpeg' | 'image/webp';\n quality?: number;\n }): Promise<Blob> {\n options = Object.assign({ type: 'image/png', quality: 1 }, options);\n\n let image: HTMLImageElement;\n if (options.source instanceof File) {\n const a = new Image();\n a.src = URL.createObjectURL(options.source);\n await new Promise<Event>((res) => (a.onload = res));\n image = a;\n } else {\n image = options.source;\n }\n\n // Resize the image\n const canvas: any = this.document.createElement('canvas');\n let width = image.width;\n let height = image.height;\n if (width > height) {\n if (width > options.maxSize) {\n height *= options.maxSize / width;\n width = options.maxSize;\n }\n } else {\n if (height > options.maxSize) {\n width *= options.maxSize / height;\n height = options.maxSize;\n }\n }\n canvas.width = width;\n canvas.height = height;\n canvas.getContext('2d').drawImage(image, 0, 0, width, height);\n return new Promise((resolve) => canvas.toBlob(resolve, options.type, options.quality));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAIa,cAAc,CAAA;AAD3B,IAAA,WAAA,GAAA;AAEU,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAuCzC;IAtCC,MAAM,MAAM,CAAC,OAKZ,EAAA;AACC,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC;AAEnE,QAAA,IAAI,KAAuB;AAC3B,QAAA,IAAI,OAAO,CAAC,MAAM,YAAY,IAAI,EAAE;AAClC,YAAA,MAAM,CAAC,GAAG,IAAI,KAAK,EAAE;YACrB,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC;AAC3C,YAAA,MAAM,IAAI,OAAO,CAAQ,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;YACnD,KAAK,GAAG,CAAC;;aACJ;AACL,YAAA,KAAK,GAAG,OAAO,CAAC,MAAM;;;QAIxB,MAAM,MAAM,GAAQ,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;AACzD,QAAA,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK;AACvB,QAAA,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM;AACzB,QAAA,IAAI,KAAK,GAAG,MAAM,EAAE;AAClB,YAAA,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE;AAC3B,gBAAA,MAAM,IAAI,OAAO,CAAC,OAAO,GAAG,KAAK;AACjC,gBAAA,KAAK,GAAG,OAAO,CAAC,OAAO;;;aAEpB;AACL,YAAA,IAAI,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE;AAC5B,gBAAA,KAAK,IAAI,OAAO,CAAC,OAAO,GAAG,MAAM;AACjC,gBAAA,MAAM,GAAG,OAAO,CAAC,OAAO;;;AAG5B,QAAA,MAAM,CAAC,KAAK,GAAG,KAAK;AACpB,QAAA,MAAM,CAAC,MAAM,GAAG,MAAM;AACtB,QAAA,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC;QAC7D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;;+GAvC7E,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;mHAAd,cAAc,EAAA,CAAA,CAAA;;4FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B;;;ACHD;;AAEG;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-locale-en-AU.profile-DNjKIaZS.mjs","sources":["../../../../
|
1
|
+
{"version":3,"file":"acorex-core-locale-en-AU.profile-DNjKIaZS.mjs","sources":["../../../../packages/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: 'kmh',\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;AACjD,IAAA,UAAU,EAAE;AACV,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,QAAQ,EAAE,kBAAkB;AAC7B,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,MAAM,EAAE,WAAW;AACnB,QAAA,IAAI,EAAE;YACJ,QAAQ,EAAE,CAAC;AACX,YAAA,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACjB,SAAA;AACD,QAAA,KAAK,EAAE;AACL,YAAA,YAAY,EAAE,IAAI;AACnB,SAAA;AACF,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE;AACJ,YAAA,KAAK,EAAE,UAAU;AACjB,YAAA,MAAM,EAAE,aAAa;AACrB,YAAA,IAAI,EAAE,cAAc;AACpB,YAAA,IAAI,EAAE,oBAAoB;AAC3B,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,KAAK,EAAE,OAAO;AACd,YAAA,MAAM,EAAE,UAAU;AAClB,YAAA,IAAI,EAAE,YAAY;AAClB,YAAA,IAAI,EAAE,eAAe;AACtB,SAAA;AACD,QAAA,QAAQ,EAAE;AACR,YAAA,KAAK,EAAE,gBAAgB;AACvB,YAAA,MAAM,EAAE,sBAAsB;AAC9B,YAAA,IAAI,EAAE,yBAAyB;AAC/B,YAAA,IAAI,EAAE,kCAAkC;AACzC,SAAA;AACD,QAAA,OAAO,EAAE;AACP,YAAA,cAAc,EAAE,UAAU;AAC1B,YAAA,QAAQ,EAAE;AACR,gBAAA,IAAI,EAAE,KAAK;AACZ,aAAA;AACF,SAAA;AACD,QAAA,QAAQ,EAAE;AACR,YAAA,KAAK,EAAE,cAAc;AACrB,YAAA,UAAU,EAAE,MAAM;AACnB,SAAA;AACF,KAAA;AAED,IAAA,KAAK,EAAE;AACL,QAAA,WAAW,EAAE,SAAS;AACtB,QAAA,QAAQ,EAAE,YAAY;AACtB,QAAA,MAAM,EAAE,WAAW;AACnB,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,KAAK,EAAE,KAAK;AACZ,QAAA,IAAI,EAAE,eAAe;AACtB,KAAA;AAED,IAAA,QAAQ,EAAE;AACR,QAAA,GAAG,EAAE,KAAK;QACV,eAAe,EAAE,CAAC,OAAO,CAAC;QAC1B,kBAAkB,EAAE,CAAC,OAAO,CAAC;AAC9B,KAAA;;;;;"}
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { InjectionToken, inject, Injectable,
|
3
|
-
import { toObservable } from '@angular/core/rxjs-interop';
|
4
|
-
import { cloneDeep, set, merge } from 'lodash-es';
|
2
|
+
import { InjectionToken, inject, Injectable, NgModule, signal } from '@angular/core';
|
5
3
|
import * as i1 from '@acorex/core/format';
|
6
4
|
import { AXFormatModule } from '@acorex/core/format';
|
5
|
+
import { toObservable } from '@angular/core/rxjs-interop';
|
6
|
+
import { cloneDeep, set, merge } from 'lodash-es';
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
8
|
+
// @Injectable()
|
9
|
+
// export class AXCurrencyFormatter implements AXFormatter {
|
10
|
+
// get name(): string {
|
11
|
+
// return 'currency';
|
12
|
+
// }
|
13
|
+
// format(value: number, options: AXCurrencyFormatterOptions): string {
|
14
|
+
// return value.toLocaleString(options.locale, { style: 'currency', currency: options.currency });
|
15
|
+
// }
|
16
|
+
// }
|
16
17
|
|
17
18
|
const AX_LOCALE_PROFILE_PROVIDERS = new InjectionToken('AX_LOCALE_PROFILE_PROVIDERS', {
|
18
19
|
providedIn: 'root',
|
@@ -22,9 +23,9 @@ const AX_LOCALE_PROFILE_PROVIDERS = new InjectionToken('AX_LOCALE_PROFILE_PROVID
|
|
22
23
|
class AXLocaleProfileProviderDefault {
|
23
24
|
async provide() {
|
24
25
|
return {
|
25
|
-
'en-AU': () => import('./acorex-core-locale-en-AU.profile-DNjKIaZS.mjs').then(m => m.AXAURegionalConfig),
|
26
|
-
'en-US': () => Promise.resolve().then(function () { return enUS_profile; }).then(m => m.AXUSLocaleProfile),
|
27
|
-
'fa-IR': () => Promise.resolve().then(function () { return faIR_profile; }).then(m => m.AXIRLocaleProfile),
|
26
|
+
'en-AU': () => import('./acorex-core-locale-en-AU.profile-DNjKIaZS.mjs').then((m) => m.AXAURegionalConfig),
|
27
|
+
'en-US': () => Promise.resolve().then(function () { return enUS_profile; }).then((m) => m.AXUSLocaleProfile),
|
28
|
+
'fa-IR': () => Promise.resolve().then(function () { return faIR_profile; }).then((m) => m.AXIRLocaleProfile),
|
28
29
|
};
|
29
30
|
}
|
30
31
|
}
|
@@ -99,16 +100,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
99
100
|
}]
|
100
101
|
}] });
|
101
102
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
103
|
+
const AX_LOCALE_CONFIG = new InjectionToken('AX_LOCALE_CONFIG', {
|
104
|
+
providedIn: 'root',
|
105
|
+
factory: () => {
|
106
|
+
return {
|
107
|
+
default: 'en-US',
|
108
|
+
};
|
109
|
+
},
|
110
|
+
});
|
111
|
+
|
112
|
+
class AXLocaleModule {
|
113
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
114
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleModule, imports: [i1.AXFormatModule] }); }
|
115
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleModule, imports: [AXFormatModule.forChild({
|
116
|
+
formatters: [],
|
117
|
+
})] }); }
|
118
|
+
}
|
119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleModule, decorators: [{
|
120
|
+
type: NgModule,
|
121
|
+
args: [{
|
122
|
+
imports: [
|
123
|
+
AXFormatModule.forChild({
|
124
|
+
formatters: [],
|
125
|
+
}),
|
126
|
+
],
|
127
|
+
}]
|
128
|
+
}] });
|
112
129
|
|
113
130
|
const AXUSLocaleProfile = {
|
114
131
|
localeInfo: {
|
@@ -177,6 +194,75 @@ var enUS_profile = /*#__PURE__*/Object.freeze({
|
|
177
194
|
AXUSLocaleProfile: AXUSLocaleProfile
|
178
195
|
});
|
179
196
|
|
197
|
+
class AXLocaleService {
|
198
|
+
async setProfile(localeCode) {
|
199
|
+
const profile = await this.provider.getByLocale(localeCode);
|
200
|
+
if (profile) {
|
201
|
+
this.originalProfile = cloneDeep(profile);
|
202
|
+
this._activeProfile.set(cloneDeep(profile));
|
203
|
+
}
|
204
|
+
else {
|
205
|
+
console.warn(`[AXLocaleService] Locale not found: ${localeCode}`);
|
206
|
+
}
|
207
|
+
}
|
208
|
+
/**
|
209
|
+
*
|
210
|
+
*/
|
211
|
+
constructor() {
|
212
|
+
this.provider = inject(AXLocaleProfileProviderService);
|
213
|
+
this.config = inject(AX_LOCALE_CONFIG);
|
214
|
+
this._activeProfile = signal(AXUSLocaleProfile);
|
215
|
+
this.activeProfile = this._activeProfile.asReadonly();
|
216
|
+
this.profileChanged$ = toObservable(this._activeProfile);
|
217
|
+
this.originalProfile = cloneDeep(AXUSLocaleProfile);
|
218
|
+
this.setProfile(this.config.default);
|
219
|
+
}
|
220
|
+
apply(arg1, arg2) {
|
221
|
+
const current = this.activeProfile();
|
222
|
+
if (!current) {
|
223
|
+
console.warn('[AXLocaleService] No active profile found');
|
224
|
+
return;
|
225
|
+
}
|
226
|
+
const updated = cloneDeep(current);
|
227
|
+
if (typeof arg1 === 'string' && arg2 !== undefined) {
|
228
|
+
// Overload: updateProfile('formats.date.full', 'YYYY-MM-DD')
|
229
|
+
set(updated, arg1, arg2);
|
230
|
+
}
|
231
|
+
else if (typeof arg1 === 'object') {
|
232
|
+
// Overload: updateProfile({ formats: { date: { short: '...' } } })
|
233
|
+
merge(updated, arg1);
|
234
|
+
}
|
235
|
+
else {
|
236
|
+
console.warn('[AXLocaleService] Invalid arguments passed to updateProfile()');
|
237
|
+
return;
|
238
|
+
}
|
239
|
+
}
|
240
|
+
reset() {
|
241
|
+
if (this.originalProfile) {
|
242
|
+
this._activeProfile.set(cloneDeep(this.originalProfile));
|
243
|
+
}
|
244
|
+
}
|
245
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
246
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleService, providedIn: 'root' }); }
|
247
|
+
}
|
248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleService, decorators: [{
|
249
|
+
type: Injectable,
|
250
|
+
args: [{
|
251
|
+
providedIn: 'root',
|
252
|
+
}]
|
253
|
+
}], ctorParameters: () => [] });
|
254
|
+
|
255
|
+
var AXLocaleEvents;
|
256
|
+
(function (AXLocaleEvents) {
|
257
|
+
AXLocaleEvents["AXLocaleChanged"] = "AX_LOCALE_CHANGED";
|
258
|
+
AXLocaleEvents["AXLocaleLoaded"] = "AX_LOCALE_LOADED";
|
259
|
+
//
|
260
|
+
AXLocaleEvents["AXCalendarChanged"] = "AX_CALENDAR_CHANGED";
|
261
|
+
//
|
262
|
+
AXLocaleEvents["AXLanguageChanged"] = "AX_LANGUAGE_CHANGED";
|
263
|
+
AXLocaleEvents["AXLanguageLoaded"] = "AX_LANGUAGE_LOADED";
|
264
|
+
})(AXLocaleEvents || (AXLocaleEvents = {}));
|
265
|
+
|
180
266
|
const AXIRLocaleProfile = {
|
181
267
|
localeInfo: {
|
182
268
|
code: 'fa-IR',
|
@@ -244,92 +330,6 @@ var faIR_profile = /*#__PURE__*/Object.freeze({
|
|
244
330
|
AXIRLocaleProfile: AXIRLocaleProfile
|
245
331
|
});
|
246
332
|
|
247
|
-
class AXLocaleService {
|
248
|
-
async setProfile(localeCode) {
|
249
|
-
const profile = await this.provider.getByLocale(localeCode);
|
250
|
-
if (profile) {
|
251
|
-
this.originalProfile = cloneDeep(profile);
|
252
|
-
this._activeProfile.set(cloneDeep(profile));
|
253
|
-
}
|
254
|
-
else {
|
255
|
-
console.warn(`[AXLocaleService] Locale not found: ${localeCode}`);
|
256
|
-
}
|
257
|
-
}
|
258
|
-
/**
|
259
|
-
*
|
260
|
-
*/
|
261
|
-
constructor() {
|
262
|
-
this.provider = inject(AXLocaleProfileProviderService);
|
263
|
-
this.config = inject(AX_LOCALE_CONFIG);
|
264
|
-
this._activeProfile = signal(AXUSLocaleProfile);
|
265
|
-
this.activeProfile = this._activeProfile.asReadonly();
|
266
|
-
this.profileChanged$ = toObservable(this._activeProfile);
|
267
|
-
this.originalProfile = cloneDeep(AXUSLocaleProfile);
|
268
|
-
this.setProfile(this.config.default);
|
269
|
-
}
|
270
|
-
apply(arg1, arg2) {
|
271
|
-
const current = this.activeProfile();
|
272
|
-
if (!current) {
|
273
|
-
console.warn('[AXLocaleService] No active profile found');
|
274
|
-
return;
|
275
|
-
}
|
276
|
-
const updated = cloneDeep(current);
|
277
|
-
if (typeof arg1 === 'string' && arg2 !== undefined) {
|
278
|
-
// Overload: updateProfile('formats.date.full', 'YYYY-MM-DD')
|
279
|
-
set(updated, arg1, arg2);
|
280
|
-
}
|
281
|
-
else if (typeof arg1 === 'object') {
|
282
|
-
// Overload: updateProfile({ formats: { date: { short: '...' } } })
|
283
|
-
merge(updated, arg1);
|
284
|
-
}
|
285
|
-
else {
|
286
|
-
console.warn('[AXLocaleService] Invalid arguments passed to updateProfile()');
|
287
|
-
return;
|
288
|
-
}
|
289
|
-
}
|
290
|
-
reset() {
|
291
|
-
if (this.originalProfile) {
|
292
|
-
this._activeProfile.set(cloneDeep(this.originalProfile));
|
293
|
-
}
|
294
|
-
}
|
295
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
296
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleService, providedIn: 'root' }); }
|
297
|
-
}
|
298
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleService, decorators: [{
|
299
|
-
type: Injectable,
|
300
|
-
args: [{
|
301
|
-
providedIn: 'root',
|
302
|
-
}]
|
303
|
-
}], ctorParameters: () => [] });
|
304
|
-
|
305
|
-
class AXLocaleModule {
|
306
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
307
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleModule, imports: [i1.AXFormatModule] }); }
|
308
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleModule, imports: [AXFormatModule.forChild({
|
309
|
-
formatters: [],
|
310
|
-
})] }); }
|
311
|
-
}
|
312
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLocaleModule, decorators: [{
|
313
|
-
type: NgModule,
|
314
|
-
args: [{
|
315
|
-
imports: [
|
316
|
-
AXFormatModule.forChild({
|
317
|
-
formatters: [],
|
318
|
-
}),
|
319
|
-
],
|
320
|
-
}]
|
321
|
-
}] });
|
322
|
-
|
323
|
-
// @Injectable()
|
324
|
-
// export class AXCurrencyFormatter implements AXFormatter {
|
325
|
-
// get name(): string {
|
326
|
-
// return 'currency';
|
327
|
-
// }
|
328
|
-
// format(value: number, options: AXCurrencyFormatterOptions): string {
|
329
|
-
// return value.toLocaleString(options.locale, { style: 'currency', currency: options.currency });
|
330
|
-
// }
|
331
|
-
// }
|
332
|
-
|
333
333
|
/**
|
334
334
|
* Generated bundle index. Do not edit.
|
335
335
|
*/
|