@acorex/core 18.14.1-next.0 → 18.14.1-next.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  import { AXEventService, AXEventTypes } from '@acorex/core/events';
2
2
  import { Injectable, inject } from '@angular/core';
3
3
  import { get as lodashGet, set as lodashSet } from 'lodash-es';
4
- import { BehaviorSubject, catchError, finalize, firstValueFrom, forkJoin, lastValueFrom, map, of, shareReplay, startWith, switchMap, take, tap, } from 'rxjs';
4
+ import { BehaviorSubject, catchError, finalize, first, firstValueFrom, forkJoin, lastValueFrom, map, of, shareReplay, startWith, switchMap, take, tap, } from 'rxjs';
5
5
  import { AX_TRANSLATION_CONFIG } from './translation.config';
6
6
  import { AX_TRANSLATION_LOADER } from './translation.loader';
7
7
  import * as i0 from "@angular/core";
@@ -138,71 +138,47 @@ export class AXTranslationService {
138
138
  return translation;
139
139
  }
140
140
  translate(key, options) {
141
- if (options?.lang) {
142
- return this.load(key, options);
141
+ const result = this.findAXTranslateOptionsFromKey(key);
142
+ if (result.length) {
143
+ // result.forEach((item) => {
144
+ // this.langChanges$.pipe(
145
+ // switchMap((lang) => {
146
+ // return this.load(item.key, {
147
+ // params: options.params,
148
+ // scope: item.scope || options.scope || this.config.defaultScope,
149
+ // lang: item.lang || options.lang || this.config.defaultLang,
150
+ // });
151
+ // }),
152
+ // );
153
+ // });
154
+ return this.translateAsyncAXTranslate(key, options);
155
+ }
156
+ else {
157
+ if (options?.lang) {
158
+ return this.load(key, options);
159
+ }
160
+ return this.langChanges$.pipe(startWith(this.getActiveLang()), switchMap((lang) => {
161
+ return this.load(key, { ...options, lang: lang });
162
+ }));
143
163
  }
144
- return this.langChanges$.pipe(startWith(this.getActiveLang()), switchMap((lang) => {
145
- return this.load(key, { ...options, lang: lang });
146
- }));
147
164
  }
148
165
  async translateAsync(key, options) {
149
- // debugger;
150
- if (this.findAXTranslateOptions(key).length > 0) {
151
- // Use findAXTranslateOptions to parse all <axt> tags in the input string
152
- const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
153
- const splitParts = key.split(regex); // Split into <axt> parts and text parts
154
- let translatedResult = '';
155
- for (const part of splitParts) {
156
- // Check if the part is an <axt> tag by using the findAXTranslateOptions function
157
- const optionsFromKey = this.findAXTranslateOptions(part);
158
- if (optionsFromKey.length > 0) {
159
- // This is an <axt> part, translate it
160
- for (const parsed of optionsFromKey) {
161
- const parsedLang = parsed.lang ?? this.getActiveLang();
162
- const parsedScope = parsed.scope ?? this.config.defaultScope;
163
- const parsedKey = parsed.key;
164
- let translation = lodashGet(this.translationCache, `${parsedLang}.${parsedScope}.${parsedKey}`);
165
- if (!translation) {
166
- await firstValueFrom(this.load(parsedKey, { lang: parsedLang, scope: parsedScope }).pipe(take(1)));
167
- translation = lodashGet(this.translationCache, `${parsedLang}.${parsedScope}.${parsedKey}`);
168
- }
169
- if (!translation && this.lastActiveLang) {
170
- translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${parsedScope}.${parsedKey}`);
171
- }
172
- if (!translation) {
173
- translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${parsedScope}.${parsedKey}`);
174
- }
175
- // Get the final translation, applying any params if needed
176
- const newTranslation = this.getTranslation((translation || parsedKey), parsedLang, parsedScope, options?.params);
177
- // Append the translated text
178
- translatedResult += `${newTranslation}`;
179
- }
180
- }
181
- else {
182
- // This is plain text, so add it as-is
183
- translatedResult += part;
184
- }
185
- }
186
- return translatedResult;
166
+ const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};
167
+ let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);
168
+ if (!translation) {
169
+ // If the translation is not in the cache, load it
170
+ await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));
171
+ translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);
187
172
  }
188
- else {
189
- const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};
190
- let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);
191
- if (!translation) {
192
- // If the translation is not in the cache, load it
193
- await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));
194
- translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);
195
- }
196
- // If still not available, try the last active language or default language
197
- if (!translation && this.lastActiveLang) {
198
- translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);
199
- }
200
- if (!translation) {
201
- translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);
202
- }
203
- // Perform parameter replacement
204
- return this.getTranslation((translation || key), lang, scope, options?.params);
173
+ // If still not available, try the last active language or default language
174
+ if (!translation && this.lastActiveLang) {
175
+ translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);
176
+ }
177
+ if (!translation) {
178
+ translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);
205
179
  }
180
+ // Perform parameter replacement
181
+ return this.getTranslation((translation || key), lang, scope, options?.params);
206
182
  }
207
183
  translateSync(key, options) {
208
184
  const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};
@@ -223,7 +199,7 @@ export class AXTranslationService {
223
199
  // Perform parameter replacement
224
200
  return this.getTranslation((translation || key), lang, scope, options?.params);
225
201
  }
226
- findAXTranslateOptions(inputString) {
202
+ findAXTranslateOptionsFromKey(inputString) {
227
203
  const regex = /<axt(?:\s+lang="([^"]*)")?(?:\s+scope="([^"]*)")?>(.*?)<\/axt>/g;
228
204
  const result = [];
229
205
  let match;
@@ -237,6 +213,68 @@ export class AXTranslationService {
237
213
  }
238
214
  return result;
239
215
  }
216
+ // private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions) {
217
+ // // Use findAXTranslateOptions to parse all <axt> tags in the input string
218
+ // const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
219
+ // const splitParts = key.split(regex); // Split into <axt> parts and text parts
220
+ // let translatedResult = '';
221
+ // for (const part of splitParts) {
222
+ // // Check if the part is an <axt> tag by using the findAXTranslateOptions function
223
+ // const optionsFromKey = this.findAXTranslateOptionsFromKey(part);
224
+ // if (optionsFromKey.length > 0) {
225
+ // // This is an <axt> part, translate it
226
+ // for (const parsed of optionsFromKey) {
227
+ // const parsedLang = parsed.lang || options.lang || this.getActiveLang();
228
+ // const parsedScope = parsed.scope || options.scope || this.config.defaultScope;
229
+ // const parsedKey = parsed.key;
230
+ // // Get the final translation, applying any params if needed
231
+ // const newTranslation = this.load(parsedKey, {
232
+ // lang: parsedLang,
233
+ // scope: parsedScope,
234
+ // params: options?.params,
235
+ // });
236
+ // newTranslation.pipe(first()).subscribe((translatedText) => {
237
+ // translatedResult += `${translatedText}`;
238
+ // });
239
+ // // Append the translated text
240
+ // }
241
+ // } else {
242
+ // // This is plain text, so add it as-is
243
+ // translatedResult += part;
244
+ // }
245
+ // console.log(translatedResult);
246
+ // }
247
+ // return of(translatedResult);
248
+ // }
249
+ translateAsyncAXTranslate(key, options) {
250
+ const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
251
+ const splitParts = key.split(regex); // Split into <axt> parts and text parts
252
+ const translationObservables = [];
253
+ for (const part of splitParts) {
254
+ const optionsFromKey = this.findAXTranslateOptionsFromKey(part);
255
+ if (optionsFromKey.length > 0) {
256
+ // This is an <axt> part, translate it
257
+ for (const parsed of optionsFromKey) {
258
+ const parsedLang = parsed.lang || options?.lang || this.getActiveLang();
259
+ const parsedScope = parsed.scope || options?.scope || this.config.defaultScope;
260
+ const parsedKey = parsed.key;
261
+ // Push the translation observable to the array
262
+ translationObservables.push(this.load(parsedKey, {
263
+ lang: parsedLang,
264
+ scope: parsedScope,
265
+ params: options?.params,
266
+ }).pipe(first()));
267
+ }
268
+ }
269
+ else {
270
+ // This is plain text, so wrap it in an observable
271
+ translationObservables.push(of(part));
272
+ }
273
+ }
274
+ // Use forkJoin to wait for all observables to complete
275
+ return forkJoin(translationObservables).pipe(map((translatedParts) => translatedParts.join('')) // Join all translated parts
276
+ );
277
+ }
240
278
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
241
279
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, providedIn: 'root' }); }
242
280
  }
@@ -244,4 +282,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
244
282
  type: Injectable,
245
283
  args: [{ providedIn: 'root' }]
246
284
  }], ctorParameters: () => [] });
247
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRpb24uc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS90cmFuc2xhdGlvbi9zcmMvbGliL3RyYW5zbGF0aW9uLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGNBQWMsRUFBRSxZQUFZLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNuRSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUNuRCxPQUFPLEVBQUUsR0FBRyxJQUFJLFNBQVMsRUFBRSxHQUFHLElBQUksU0FBUyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBQy9ELE9BQU8sRUFDTCxlQUFlLEVBRWYsVUFBVSxFQUNWLFFBQVEsRUFDUixjQUFjLEVBQ2QsUUFBUSxFQUNSLGFBQWEsRUFDYixHQUFHLEVBQ0gsRUFBRSxFQUNGLFdBQVcsRUFDWCxTQUFTLEVBQ1QsU0FBUyxFQUNULElBQUksRUFDSixHQUFHLEdBQ0osTUFBTSxNQUFNLENBQUM7QUFD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JzZWRMYW5nfS4ke3BhcnNlZFNjb3BlfS4ke3BhcnNlZEtleX1gKTtcblxuICAgICAgICAgICAgaWYgKCF0cmFuc2xhdGlvbikge1xuICAgICAgICAgICAgICBhd2FpdCBmaXJzdFZhbHVlRnJvbShcbiAgICAgICAgICAgICAgICB0aGlzLmxvYWQocGFyc2VkS2V5LCB7IGxhbmc6IHBhcnNlZExhbmcsIHNjb3BlOiBwYXJzZWRTY29wZSB9KS5waXBlKHRha2UoMSkpLFxuICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICB0cmFuc2xhdGlvbiA9IGxvZGFzaEdldCh0aGlzLnRyYW5zbGF0aW9uQ2FjaGUsIGAke3BhcnNlZExhbmd9LiR7cGFyc2VkU2NvcGV9LiR7cGFyc2VkS2V5fWApO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoIXRyYW5zbGF0aW9uICYmIHRoaXMubGFzdEFjdGl2ZUxhbmcpIHtcbiAgICAgICAgICAgICAgdHJhbnNsYXRpb24gPSBsb2Rhc2hHZXQoXG4gICAgICAgICAgICAgICAgdGhpcy50cmFuc2xhdGlvbkNhY2hlLFxuICAgICAgICAgICAgICAgIGAke3RoaXMubGFzdEFjdGl2ZUxhbmd9LiR7cGFyc2VkU2NvcGV9LiR7cGFyc2VkS2V5fWAsXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghdHJhbnNsYXRpb24pIHtcbiAgICAgICAgICAgICAgdHJhbnNsYXRpb24gPSBsb2Rhc2hHZXQoXG4gICAgICAgICAgICAgICAgdGhpcy50cmFuc2xhdGlvbkNhY2hlLFxuICAgICAgICAgICAgICAgIGAke3RoaXMuZ2V0RGVmYXVsdExhbmcoKX0uJHtwYXJzZWRTY29wZX0uJHtwYXJzZWRLZXl9YCxcbiAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gR2V0IHRoZSBmaW5hbCB0cmFuc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ZXR1cm4gZm9ya0pvaW4odHJhbnNsYXRpb25PYnNlcnZhYmxlcykucGlwZShcbiAgICAgIG1hcCgodHJhbnNsYXRlZFBhcnRzKSA9PiB0cmFuc2xhdGVkUGFydHMuam9pbignJykpIC8vIEpvaW4gYWxsIHRyYW5zbGF0ZWQgcGFydHNcbiAgICApO1xuICB9XG4gIFxufVxuIl19
@@ -8,19 +8,10 @@ export class AXTranslatorPipe {
8
8
  this.service = service;
9
9
  }
10
10
  transform(key, options) {
11
- if (!key)
12
- return of('');
13
- const splitKey = this.splitString(key);
14
- return Array.isArray(splitKey)
15
- ? this.service.translate(splitKey[1], { ...options, scope: splitKey[0] })
16
- : this.service.translate(key, options);
17
- }
18
- splitString(value) {
19
- if (value.startsWith('#')) {
20
- const [first, ...rest] = value.slice(1).split('.');
21
- return [first, rest.join('.')];
11
+ if (!key) {
12
+ return of(''); // Return an empty observable if the key is not provided
22
13
  }
23
- return value;
14
+ return this.service.translate(key, options);
24
15
  }
25
16
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslatorPipe, deps: [{ token: i1.AXTranslationService }], target: i0.ɵɵFactoryTarget.Pipe }); }
26
17
  static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXTranslatorPipe, name: "translate" }); }
@@ -29,4 +20,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
29
20
  type: Pipe,
30
21
  args: [{ name: 'translate', pure: true }]
31
22
  }], ctorParameters: () => [{ type: i1.AXTranslationService }] });
32
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRvci5waXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL3RyYW5zbGF0aW9uL3NyYy9saWIvdHJ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ZU9wdGlvbnMpOiBPYnNlcnZhYmxlPHN0cmluZz4ge1xuICAgIGlmICgha2V5KSB7XG4gICAgICByZXR1cm4gb2YoJycpOyAvLyBSZXR1cm4gYW4gZW1wdHkgb2JzZXJ2YWJsZSBpZiB0aGUga2V5IGlzIG5vdCBwcm92aWRlZFxuICAgIH1cbiAgICByZXR1cm4gdGhpcy5zZXJ2aWNlLnRyYW5zbGF0ZShrZXksIG9wdGlvbnMpO1xuICB9XG59XG4iXX0=
@@ -1,6 +1,6 @@
1
1
  import { AXTranslationService } from '@acorex/core/translation';
2
2
  import { Injectable, inject } from '@angular/core';
3
- import { find, isArray, isEmpty, isNull, isNumber, isString, isUndefined } from 'lodash-es';
3
+ import { find, isArray, isBoolean, isEmpty, isNull, isNumber, isString, isUndefined } from 'lodash-es';
4
4
  import * as i0 from "@angular/core";
5
5
  export class AXRequiredValidationRule {
6
6
  constructor() {
@@ -11,6 +11,7 @@ export class AXRequiredValidationRule {
11
11
  }
12
12
  async validate(value, options) {
13
13
  const rules = [
14
+ { test: (val) => isBoolean(val) || !val },
14
15
  { test: (val) => isNull(val) || isUndefined(val) },
15
16
  { test: (val) => isString(val) && isEmpty(val.trim()) },
16
17
  { test: (val) => isNumber(val) && isNaN(val) },
@@ -21,7 +22,7 @@ export class AXRequiredValidationRule {
21
22
  const translatedMessage = await this.traslationService.translateAsync('validation.messages.required', {
22
23
  params: { title: options?.['title'] },
23
24
  });
24
- const message = failedRule ? options?.message ?? translatedMessage : null;
25
+ const message = failedRule ? (options?.message ?? translatedMessage) : null;
25
26
  return {
26
27
  rule: this.name,
27
28
  result: isValid,
@@ -35,4 +36,4 @@ export class AXRequiredValidationRule {
35
36
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXRequiredValidationRule, decorators: [{
36
37
  type: Injectable
37
38
  }] });
38
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWlyZWQt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ob3B0aW9ucz8ubWVzc2FnZSA/PyB0cmFuc2xhdGVkTWVzc2FnZSkgOiBudWxsO1xuXG4gICAgcmV0dXJuIHtcbiAgICAgIHJ1bGU6IHRoaXMubmFtZSxcbiAgICAgIHJlc3VsdDogaXNWYWxpZCxcbiAgICAgIG1lc3NhZ2U6IG1lc3NhZ2UsXG4gICAgICB2YWx1ZSxcbiAgICB9O1xuICB9XG59XG4iXX0=
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injector, Injectable, inject, Pipe, Inject, NgModule } from '@angular/core';
2
+ import { Injector, Injectable, inject, Pipe, NgModule, Inject } from '@angular/core';
3
3
  import { AXEventService } from '@acorex/core/events';
4
4
  import { Subject, filter, startWith, switchMap, of } from 'rxjs';
5
5
  import { defaults, padStart, isInteger, get } from 'lodash-es';
@@ -1,6 +1,6 @@
1
1
  import { isPlatformBrowser, DOCUMENT } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { PLATFORM_ID, Inject, Injectable, InjectionToken } from '@angular/core';
3
+ import { PLATFORM_ID, Injectable, Inject, InjectionToken } from '@angular/core';
4
4
  import { isBrowser } from '@acorex/core/platform';
5
5
  import CryptoJS from 'crypto-es';
6
6
 
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { InjectionToken, inject, Injectable, Directive, Pipe, APP_INITIALIZER, NgModule } from '@angular/core';
3
3
  import { AXEventService, AXEventTypes } from '@acorex/core/events';
4
4
  import { set, get } from 'lodash-es';
5
- import { of, BehaviorSubject, forkJoin, tap, catchError, finalize, shareReplay, map, switchMap, startWith, firstValueFrom, take, lastValueFrom } from 'rxjs';
5
+ import { of, BehaviorSubject, forkJoin, tap, catchError, finalize, shareReplay, map, switchMap, startWith, firstValueFrom, take, lastValueFrom, first } from 'rxjs';
6
6
 
7
7
  const AX_TRANSLATION_CONFIG = new InjectionToken('AX_TRANSLATION_CONFIG', {
8
8
  providedIn: 'root',
@@ -168,71 +168,47 @@ class AXTranslationService {
168
168
  return translation;
169
169
  }
170
170
  translate(key, options) {
171
- if (options?.lang) {
172
- return this.load(key, options);
171
+ const result = this.findAXTranslateOptionsFromKey(key);
172
+ if (result.length) {
173
+ // result.forEach((item) => {
174
+ // this.langChanges$.pipe(
175
+ // switchMap((lang) => {
176
+ // return this.load(item.key, {
177
+ // params: options.params,
178
+ // scope: item.scope || options.scope || this.config.defaultScope,
179
+ // lang: item.lang || options.lang || this.config.defaultLang,
180
+ // });
181
+ // }),
182
+ // );
183
+ // });
184
+ return this.translateAsyncAXTranslate(key, options);
185
+ }
186
+ else {
187
+ if (options?.lang) {
188
+ return this.load(key, options);
189
+ }
190
+ return this.langChanges$.pipe(startWith(this.getActiveLang()), switchMap((lang) => {
191
+ return this.load(key, { ...options, lang: lang });
192
+ }));
173
193
  }
174
- return this.langChanges$.pipe(startWith(this.getActiveLang()), switchMap((lang) => {
175
- return this.load(key, { ...options, lang: lang });
176
- }));
177
194
  }
178
195
  async translateAsync(key, options) {
179
- // debugger;
180
- if (this.findAXTranslateOptions(key).length > 0) {
181
- // Use findAXTranslateOptions to parse all <axt> tags in the input string
182
- const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
183
- const splitParts = key.split(regex); // Split into <axt> parts and text parts
184
- let translatedResult = '';
185
- for (const part of splitParts) {
186
- // Check if the part is an <axt> tag by using the findAXTranslateOptions function
187
- const optionsFromKey = this.findAXTranslateOptions(part);
188
- if (optionsFromKey.length > 0) {
189
- // This is an <axt> part, translate it
190
- for (const parsed of optionsFromKey) {
191
- const parsedLang = parsed.lang ?? this.getActiveLang();
192
- const parsedScope = parsed.scope ?? this.config.defaultScope;
193
- const parsedKey = parsed.key;
194
- let translation = get(this.translationCache, `${parsedLang}.${parsedScope}.${parsedKey}`);
195
- if (!translation) {
196
- await firstValueFrom(this.load(parsedKey, { lang: parsedLang, scope: parsedScope }).pipe(take(1)));
197
- translation = get(this.translationCache, `${parsedLang}.${parsedScope}.${parsedKey}`);
198
- }
199
- if (!translation && this.lastActiveLang) {
200
- translation = get(this.translationCache, `${this.lastActiveLang}.${parsedScope}.${parsedKey}`);
201
- }
202
- if (!translation) {
203
- translation = get(this.translationCache, `${this.getDefaultLang()}.${parsedScope}.${parsedKey}`);
204
- }
205
- // Get the final translation, applying any params if needed
206
- const newTranslation = this.getTranslation((translation || parsedKey), parsedLang, parsedScope, options?.params);
207
- // Append the translated text
208
- translatedResult += `${newTranslation}`;
209
- }
210
- }
211
- else {
212
- // This is plain text, so add it as-is
213
- translatedResult += part;
214
- }
215
- }
216
- return translatedResult;
196
+ const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};
197
+ let translation = get(this.translationCache, `${lang}.${scope}.${key}`);
198
+ if (!translation) {
199
+ // If the translation is not in the cache, load it
200
+ await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));
201
+ translation = get(this.translationCache, `${lang}.${scope}.${key}`);
217
202
  }
218
- else {
219
- const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};
220
- let translation = get(this.translationCache, `${lang}.${scope}.${key}`);
221
- if (!translation) {
222
- // If the translation is not in the cache, load it
223
- await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));
224
- translation = get(this.translationCache, `${lang}.${scope}.${key}`);
225
- }
226
- // If still not available, try the last active language or default language
227
- if (!translation && this.lastActiveLang) {
228
- translation = get(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);
229
- }
230
- if (!translation) {
231
- translation = get(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);
232
- }
233
- // Perform parameter replacement
234
- return this.getTranslation((translation || key), lang, scope, options?.params);
203
+ // If still not available, try the last active language or default language
204
+ if (!translation && this.lastActiveLang) {
205
+ translation = get(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);
235
206
  }
207
+ if (!translation) {
208
+ translation = get(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);
209
+ }
210
+ // Perform parameter replacement
211
+ return this.getTranslation((translation || key), lang, scope, options?.params);
236
212
  }
237
213
  translateSync(key, options) {
238
214
  const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};
@@ -253,7 +229,7 @@ class AXTranslationService {
253
229
  // Perform parameter replacement
254
230
  return this.getTranslation((translation || key), lang, scope, options?.params);
255
231
  }
256
- findAXTranslateOptions(inputString) {
232
+ findAXTranslateOptionsFromKey(inputString) {
257
233
  const regex = /<axt(?:\s+lang="([^"]*)")?(?:\s+scope="([^"]*)")?>(.*?)<\/axt>/g;
258
234
  const result = [];
259
235
  let match;
@@ -267,6 +243,68 @@ class AXTranslationService {
267
243
  }
268
244
  return result;
269
245
  }
246
+ // private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions) {
247
+ // // Use findAXTranslateOptions to parse all <axt> tags in the input string
248
+ // const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
249
+ // const splitParts = key.split(regex); // Split into <axt> parts and text parts
250
+ // let translatedResult = '';
251
+ // for (const part of splitParts) {
252
+ // // Check if the part is an <axt> tag by using the findAXTranslateOptions function
253
+ // const optionsFromKey = this.findAXTranslateOptionsFromKey(part);
254
+ // if (optionsFromKey.length > 0) {
255
+ // // This is an <axt> part, translate it
256
+ // for (const parsed of optionsFromKey) {
257
+ // const parsedLang = parsed.lang || options.lang || this.getActiveLang();
258
+ // const parsedScope = parsed.scope || options.scope || this.config.defaultScope;
259
+ // const parsedKey = parsed.key;
260
+ // // Get the final translation, applying any params if needed
261
+ // const newTranslation = this.load(parsedKey, {
262
+ // lang: parsedLang,
263
+ // scope: parsedScope,
264
+ // params: options?.params,
265
+ // });
266
+ // newTranslation.pipe(first()).subscribe((translatedText) => {
267
+ // translatedResult += `${translatedText}`;
268
+ // });
269
+ // // Append the translated text
270
+ // }
271
+ // } else {
272
+ // // This is plain text, so add it as-is
273
+ // translatedResult += part;
274
+ // }
275
+ // console.log(translatedResult);
276
+ // }
277
+ // return of(translatedResult);
278
+ // }
279
+ translateAsyncAXTranslate(key, options) {
280
+ const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
281
+ const splitParts = key.split(regex); // Split into <axt> parts and text parts
282
+ const translationObservables = [];
283
+ for (const part of splitParts) {
284
+ const optionsFromKey = this.findAXTranslateOptionsFromKey(part);
285
+ if (optionsFromKey.length > 0) {
286
+ // This is an <axt> part, translate it
287
+ for (const parsed of optionsFromKey) {
288
+ const parsedLang = parsed.lang || options?.lang || this.getActiveLang();
289
+ const parsedScope = parsed.scope || options?.scope || this.config.defaultScope;
290
+ const parsedKey = parsed.key;
291
+ // Push the translation observable to the array
292
+ translationObservables.push(this.load(parsedKey, {
293
+ lang: parsedLang,
294
+ scope: parsedScope,
295
+ params: options?.params,
296
+ }).pipe(first()));
297
+ }
298
+ }
299
+ else {
300
+ // This is plain text, so wrap it in an observable
301
+ translationObservables.push(of(part));
302
+ }
303
+ }
304
+ // Use forkJoin to wait for all observables to complete
305
+ return forkJoin(translationObservables).pipe(map((translatedParts) => translatedParts.join('')) // Join all translated parts
306
+ );
307
+ }
270
308
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
271
309
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, providedIn: 'root' }); }
272
310
  }
@@ -312,19 +350,10 @@ class AXTranslatorPipe {
312
350
  this.service = service;
313
351
  }
314
352
  transform(key, options) {
315
- if (!key)
316
- return of('');
317
- const splitKey = this.splitString(key);
318
- return Array.isArray(splitKey)
319
- ? this.service.translate(splitKey[1], { ...options, scope: splitKey[0] })
320
- : this.service.translate(key, options);
321
- }
322
- splitString(value) {
323
- if (value.startsWith('#')) {
324
- const [first, ...rest] = value.slice(1).split('.');
325
- return [first, rest.join('.')];
353
+ if (!key) {
354
+ return of(''); // Return an empty observable if the key is not provided
326
355
  }
327
- return value;
356
+ return this.service.translate(key, options);
328
357
  }
329
358
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslatorPipe, deps: [{ token: AXTranslationService }], target: i0.ɵɵFactoryTarget.Pipe }); }
330
359
  static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXTranslatorPipe, name: "translate" }); }
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-translation.mjs","sources":["../../../../libs/core/translation/src/lib/translation.config.ts","../../../../libs/core/translation/src/lib/translation.loader.ts","../../../../libs/core/translation/src/lib/translation.service.ts","../../../../libs/core/translation/src/lib/translation-scope.resolver.ts","../../../../libs/core/translation/src/lib/translator.directive.ts","../../../../libs/core/translation/src/lib/translator.pipe.ts","../../../../libs/core/translation/src/lib/translation.module.ts","../../../../libs/core/translation/src/acorex-core-translation.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { AXTranslateLang, AXTranslateScope } from './translation.types';\n\nexport interface AXTranslationConfig {\n defaultLang: AXTranslateLang;\n defaultScope: AXTranslateScope;\n preloadLangs?: AXTranslateLang[];\n preloadScopes?: AXTranslateLang[];\n availableLangs?: AXTranslateLang[];\n scopeResolverKey: string;\n}\n\nexport const AX_TRANSLATION_CONFIG = new InjectionToken<AXTranslationConfig>('AX_TRANSLATION_CONFIG', {\n providedIn: 'root',\n factory: () => {\n return AXTranslationDefaultConfig;\n },\n});\n\nexport const AXTranslationDefaultConfig: AXTranslationConfig = {\n defaultLang: 'en',\n defaultScope: 'common',\n scopeResolverKey: 'scope',\n};\n\nexport type AXPartialTranslationConfig = Partial<AXTranslationConfig>;\n\nexport function translationConfig(config: AXPartialTranslationConfig = {}): AXTranslationConfig {\n const result = {\n ...AXTranslationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslateLang, AXTranslateScope, AXTranslation } from './translation.types';\n\nexport interface AXTranslationLoaderOptions {\n lang: AXTranslateLang;\n scope?: AXTranslateScope;\n}\n\nexport interface AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation>;\n}\n\nexport class AXTranslationLoaderDefault implements AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation> {\n return of({});\n }\n}\n\nexport const AX_TRANSLATION_LOADER = new InjectionToken<AXTranslationLoader>('AX_TRANSLATION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXTranslationLoaderDefault();\n },\n});\n","import { AXEventService, AXEventTypes } from '@acorex/core/events';\nimport { Injectable, inject } from '@angular/core';\nimport { get as lodashGet, set as lodashSet } from 'lodash-es';\nimport {\n BehaviorSubject,\n Observable,\n catchError,\n finalize,\n firstValueFrom,\n forkJoin,\n lastValueFrom,\n map,\n of,\n shareReplay,\n startWith,\n switchMap,\n take,\n tap,\n} from 'rxjs';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AX_TRANSLATION_LOADER } from './translation.loader';\nimport {\n AXTranslateHashMap,\n AXTranslateLang,\n AXTranslateOptions,\n AXTranslateParams,\n} from './translation.types';\n\nlet service: AXTranslationService;\n\nexport function translateSync(key: string, options?: AXTranslateOptions): string {\n return service.translateSync(key, options);\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXTranslationService {\n private loader = inject(AX_TRANSLATION_LOADER);\n private config = inject(AX_TRANSLATION_CONFIG);\n\n private eventService = inject(AXEventService);\n\n private translationCache: AXTranslateHashMap<AXTranslateHashMap<string>> = {};\n private ongoingRequests: Map<string, Observable<any>> = new Map();\n\n private activeLang: BehaviorSubject<string> = new BehaviorSubject<string>(this.getDefaultLang());\n langChanges$: Observable<string> = this.activeLang.asObservable();\n\n private lastActiveLang: string | null = null;\n\n /**\n * @ignore\n */\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n service = this;\n }\n\n public loadLanguagesAndScopes(languages: string[], scopes: string[]): Observable<unknown> {\n const requests = languages.flatMap((lang) =>\n scopes.map((scope) => {\n // Check if translations are already cached\n if (this.translationCache[lang]?.[scope]) {\n return of(this.translationCache[lang][scope]);\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(lang, scope);\n }),\n );\n\n return forkJoin(requests);\n }\n\n private getOrLoadTranslations(lang: string, scope: string): Observable<AXTranslateHashMap<string>> {\n const requestKey = `${lang}_${scope}`;\n\n // Return existing observable if the request is already in progress\n if (this.ongoingRequests.has(requestKey)) {\n return this.ongoingRequests.get(requestKey);\n }\n\n // Load translations if not in cache or ongoing requests\n const translationObservable = this.loader.getTranslation({ lang, scope }).pipe(\n tap((translations) => this.cacheTranslations(lang, scope, translations)),\n catchError((error) => {\n console.error(`Error loading translations for lang: ${lang}, scope: ${scope}`, error);\n return of(null);\n }),\n finalize(() => {\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageLoaded,\n payload: lang,\n });\n this.ongoingRequests.delete(requestKey);\n }),\n shareReplay(1),\n );\n\n this.ongoingRequests.set(requestKey, translationObservable);\n return translationObservable;\n }\n\n private cacheTranslations(lang: string, scope: string, translations: AXTranslateHashMap<string>): void {\n lodashSet(this.translationCache, `${lang}.${scope}`, translations);\n }\n\n public getDefaultLang(): string {\n return this.config.defaultLang;\n }\n\n public getActiveLang(): string {\n return this.activeLang.getValue();\n }\n\n public setActiveLang(lang: string): void {\n if (lang != this.getActiveLang()) {\n this.lastActiveLang = this.getActiveLang(); // Update last active language\n this.activeLang.next(lang);\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageChanged,\n payload: lang,\n });\n }\n }\n\n public isLangAvailable(lang: string, scope: string = null): boolean {\n return !this.translationCache[lang] && (!scope || !this.translationCache[lang][scope]);\n }\n\n public getLangAvailable(): AXTranslateLang[] | undefined {\n return this.config.availableLangs;\n }\n\n private load(key: string, options: AXTranslateOptions = {}): Observable<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options;\n\n // Function to fetch translation\n const fetchTranslation = (language: string): Observable<string> => {\n // Check if translations are available in the cache\n if (this.translationCache[language]?.[scope]) {\n return of(this.getTranslation(key, language, scope, options.params));\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(language, scope).pipe(\n map(() => {\n const translation = this.translationCache[language]?.[scope]?.[key] || key;\n return this.getTranslation(translation, language, scope, options.params);\n }),\n switchMap((translatedText) => {\n if (translatedText === key && language !== this.getDefaultLang()) {\n // If the translation is not found and the language is not default,\n // try fetching from the default language\n return fetchTranslation(this.getDefaultLang());\n }\n return of(translatedText);\n }),\n );\n };\n\n // First, try to fetch the translation for the requested language\n const translationForRequestedLang = fetchTranslation(lang);\n\n // If lastActiveLang is available and different from the requested language, use it as a fallback\n if (this.lastActiveLang && this.lastActiveLang !== lang) {\n const translationForLastActiveLang = this.getTranslation(\n key,\n this.lastActiveLang,\n scope,\n options.params,\n );\n return translationForRequestedLang.pipe(startWith(translationForLastActiveLang));\n }\n\n return translationForRequestedLang;\n }\n\n private getTranslation(key: string, lang: string, scope: string, params?: AXTranslateParams): string {\n let translation: string = (lodashGet(this.translationCache, `${lang}.${scope}.${key}`) || key) as string;\n\n // Replace params like {{ name }}\n if (params) {\n Object.keys(params).forEach((paramKey) => {\n const paramValue = params[paramKey] as string;\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n translation = translation.replace(new RegExp(`{{\\\\s*${paramKey}\\\\s*}}`, 'g'), paramValue);\n }\n });\n }\n\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n // Replace translations like {{ t('key') }}\n const translationPattern = /{{\\s*t\\('([^']+)'\\)\\s*}}/g;\n translation = translation.replace(translationPattern, (match, innerKey) => {\n return this.getTranslation(innerKey, lang, scope, params);\n });\n }\n\n return translation;\n }\n\n public translate(key: string, options?: AXTranslateOptions): Observable<string> {\n if (options?.lang) {\n return this.load(key, options);\n }\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.load(key, { ...options, lang: lang });\n }),\n );\n }\n\n public async translateAsync(key: string, options?: AXTranslateOptions): Promise<string> {\n // debugger;\n if (this.findAXTranslateOptions(key).length > 0) {\n // Use findAXTranslateOptions to parse all <axt> tags in the input string\n const regex = /(<axt(?:\\s+lang=\"[^\"]*\")?(?:\\s+scope=\"[^\"]*\")?>.*?<\\/axt>)/g;\n const splitParts = key.split(regex); // Split into <axt> parts and text parts\n\n let translatedResult = '';\n\n for (const part of splitParts) {\n // Check if the part is an <axt> tag by using the findAXTranslateOptions function\n const optionsFromKey = this.findAXTranslateOptions(part);\n\n if (optionsFromKey.length > 0) {\n // This is an <axt> part, translate it\n for (const parsed of optionsFromKey) {\n const parsedLang = parsed.lang ?? this.getActiveLang();\n const parsedScope = parsed.scope ?? this.config.defaultScope;\n const parsedKey = parsed.key;\n\n let translation = lodashGet(this.translationCache, `${parsedLang}.${parsedScope}.${parsedKey}`);\n\n if (!translation) {\n await firstValueFrom(\n this.load(parsedKey, { lang: parsedLang, scope: parsedScope }).pipe(take(1)),\n );\n translation = lodashGet(this.translationCache, `${parsedLang}.${parsedScope}.${parsedKey}`);\n }\n\n if (!translation && this.lastActiveLang) {\n translation = lodashGet(\n this.translationCache,\n `${this.lastActiveLang}.${parsedScope}.${parsedKey}`,\n );\n }\n\n if (!translation) {\n translation = lodashGet(\n this.translationCache,\n `${this.getDefaultLang()}.${parsedScope}.${parsedKey}`,\n );\n }\n\n // Get the final translation, applying any params if needed\n const newTranslation = this.getTranslation(\n (translation || parsedKey) as any,\n parsedLang,\n parsedScope,\n options?.params,\n );\n\n // Append the translated text\n translatedResult += `${newTranslation}`;\n }\n } else {\n // This is plain text, so add it as-is\n translatedResult += part;\n }\n }\n\n return translatedResult;\n } else {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n if (!translation) {\n // If the translation is not in the cache, load it\n await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));\n translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n }\n\n // If still not available, try the last active language or default language\n if (!translation && this.lastActiveLang) {\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n if (!translation) {\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n }\n\n public translateSync(key: string, options?: AXTranslateOptions): string {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n\n // Check if the translation for the active language is available\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n //\n const loadLang = () => lastValueFrom(this.getOrLoadTranslations(lang, scope));\n // If not available, check lastActiveLang\n if (!translation && this.lastActiveLang) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n\n // If still not available, use the default language\n if (!translation) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n\n findAXTranslateOptions(inputString: string): (Omit<AXTranslateOptions, 'params'> & { key: string })[] {\n const regex = /<axt(?:\\s+lang=\"([^\"]*)\")?(?:\\s+scope=\"([^\"]*)\")?>(.*?)<\\/axt>/g;\n const result: (Omit<AXTranslateOptions, 'params'> & { key: string })[] = [];\n let match;\n\n // Loop through all matches in the input string\n while ((match = regex.exec(inputString)) !== null) {\n result.push({\n lang: match[1] || undefined,\n scope: match[2] || undefined,\n key: match[3] || undefined,\n });\n }\n\n return result;\n }\n}\n","import { inject } from '@angular/core';\nimport { ResolveFn } from '@angular/router';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\n\nexport const loadTranslationScope: ResolveFn<unknown> = (route, state) => {\n const translatorService = inject(AXTranslationService);\n const config = inject(AX_TRANSLATION_CONFIG);\n const scopeValue = route.data[config.scopeResolverKey];\n const scopes = Array.isArray(scopeValue) ? scopeValue : [scopeValue];\n return translatorService.loadLanguagesAndScopes([translatorService.getActiveLang()], scopes);\n};\n","import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Directive({\n selector: '[translate]',\n})\nexport class AXTranslatorDirective implements OnInit {\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private translationService: AXTranslationService,\n ) {}\n\n ngOnInit() {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: (key: string, options?: AXTranslateOptions) => {\n return this.translationService.translate(key, options);\n },\n });\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Pipe({ name: 'translate', pure: true })\nexport class AXTranslatorPipe implements PipeTransform {\n constructor(private service: AXTranslationService) {}\n\n transform(key: string, options?: AXTranslateOptions): Observable<string> {\n if (!key) return of('');\n\n const splitKey = this.splitString(key);\n return Array.isArray(splitKey)\n ? this.service.translate(splitKey[1], { ...options, scope: splitKey[0] })\n : this.service.translate(key, options);\n }\n\n private splitString(value: string): [string, string] | string {\n if (value.startsWith('#')) {\n const [first, ...rest] = value.slice(1).split('.');\n return [first, rest.join('.')];\n }\n return value;\n }\n}\n","import { APP_INITIALIZER, NgModule } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AXTranslationConfig, AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslatorDirective } from './translator.directive';\nimport { AXTranslatorPipe } from './translator.pipe';\n\nfunction initializeApp(translatorService: AXTranslationService, config: AXTranslationConfig) {\n return (): Observable<any> => {\n return translatorService.loadLanguagesAndScopes(\n config.preloadLangs ?? [config.defaultLang],\n config.preloadScopes ?? [config.defaultScope],\n );\n };\n}\n\n@NgModule({\n imports: [],\n exports: [AXTranslatorPipe, AXTranslatorDirective],\n declarations: [AXTranslatorPipe, AXTranslatorDirective],\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: initializeApp,\n deps: [AXTranslationService, AX_TRANSLATION_CONFIG],\n multi: true,\n },\n ],\n})\nexport class AXTranslationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["lodashSet","lodashGet","i1.AXTranslationService"],"mappings":";;;;;;MAYa,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;AACZ,QAAA,OAAO,0BAA0B;KAClC;AACF,CAAA;AAEY,MAAA,0BAA0B,GAAwB;AAC7D,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,YAAY,EAAE,QAAQ;AACtB,IAAA,gBAAgB,EAAE,OAAO;;AAKX,SAAA,iBAAiB,CAAC,MAAA,GAAqC,EAAE,EAAA;AACvE,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,GAAG,0BAA0B;AAC7B,QAAA,GAAG,MAAM;KACV;AACD,IAAA,OAAO,MAAM;AACf;;MCpBa,0BAA0B,CAAA;AACrC,IAAA,cAAc,CAAC,OAAmC,EAAA;AAChD,QAAA,OAAO,EAAE,CAAC,EAAE,CAAC;;AAEhB;MAEY,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;QACZ,OAAO,IAAI,0BAA0B,EAAE;KACxC;AACF,CAAA;;ACID,IAAI,OAA6B;AAEjB,SAAA,aAAa,CAAC,GAAW,EAAE,OAA4B,EAAA;IACrE,OAAO,OAAO,CAAC,aAAa,CAAC,GA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,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;AAClD,oBAAA,YAAY,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;AACvD,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,eAAe;AACxB,4BAAA,UAAU,EAAE,aAAa;AACzB,4BAAA,IAAI,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;AACnD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA;AACF,iBAAA;;;AC5BD;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-translation.mjs","sources":["../../../../libs/core/translation/src/lib/translation.config.ts","../../../../libs/core/translation/src/lib/translation.loader.ts","../../../../libs/core/translation/src/lib/translation.service.ts","../../../../libs/core/translation/src/lib/translation-scope.resolver.ts","../../../../libs/core/translation/src/lib/translator.directive.ts","../../../../libs/core/translation/src/lib/translator.pipe.ts","../../../../libs/core/translation/src/lib/translation.module.ts","../../../../libs/core/translation/src/acorex-core-translation.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { AXTranslateLang, AXTranslateScope } from './translation.types';\n\nexport interface AXTranslationConfig {\n defaultLang: AXTranslateLang;\n defaultScope: AXTranslateScope;\n preloadLangs?: AXTranslateLang[];\n preloadScopes?: AXTranslateLang[];\n availableLangs?: AXTranslateLang[];\n scopeResolverKey: string;\n}\n\nexport const AX_TRANSLATION_CONFIG = new InjectionToken<AXTranslationConfig>('AX_TRANSLATION_CONFIG', {\n providedIn: 'root',\n factory: () => {\n return AXTranslationDefaultConfig;\n },\n});\n\nexport const AXTranslationDefaultConfig: AXTranslationConfig = {\n defaultLang: 'en',\n defaultScope: 'common',\n scopeResolverKey: 'scope',\n};\n\nexport type AXPartialTranslationConfig = Partial<AXTranslationConfig>;\n\nexport function translationConfig(config: AXPartialTranslationConfig = {}): AXTranslationConfig {\n const result = {\n ...AXTranslationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslateLang, AXTranslateScope, AXTranslation } from './translation.types';\n\nexport interface AXTranslationLoaderOptions {\n lang: AXTranslateLang;\n scope?: AXTranslateScope;\n}\n\nexport interface AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation>;\n}\n\nexport class AXTranslationLoaderDefault implements AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation> {\n return of({});\n }\n}\n\nexport const AX_TRANSLATION_LOADER = new InjectionToken<AXTranslationLoader>('AX_TRANSLATION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXTranslationLoaderDefault();\n },\n});\n","import { AXEventService, AXEventTypes } from '@acorex/core/events';\nimport { Injectable, inject } from '@angular/core';\nimport { get as lodashGet, set as lodashSet } from 'lodash-es';\nimport {\n BehaviorSubject,\n Observable,\n catchError,\n finalize,\n first,\n firstValueFrom,\n forkJoin,\n lastValueFrom,\n map,\n of,\n shareReplay,\n startWith,\n switchMap,\n take,\n tap,\n} from 'rxjs';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AX_TRANSLATION_LOADER } from './translation.loader';\nimport {\n AXTranslateHashMap,\n AXTranslateLang,\n AXTranslateOptions,\n AXTranslateParams,\n} from './translation.types';\n\nlet service: AXTranslationService;\n\nexport function translateSync(key: string, options?: AXTranslateOptions): string {\n return service.translateSync(key, options);\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXTranslationService {\n private loader = inject(AX_TRANSLATION_LOADER);\n private config = inject(AX_TRANSLATION_CONFIG);\n\n private eventService = inject(AXEventService);\n\n private translationCache: AXTranslateHashMap<AXTranslateHashMap<string>> = {};\n private ongoingRequests: Map<string, Observable<any>> = new Map();\n\n private activeLang: BehaviorSubject<string> = new BehaviorSubject<string>(this.getDefaultLang());\n langChanges$: Observable<string> = this.activeLang.asObservable();\n\n private lastActiveLang: string | null = null;\n\n /**\n * @ignore\n */\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n service = this;\n }\n\n public loadLanguagesAndScopes(languages: string[], scopes: string[]): Observable<unknown> {\n const requests = languages.flatMap((lang) =>\n scopes.map((scope) => {\n // Check if translations are already cached\n if (this.translationCache[lang]?.[scope]) {\n return of(this.translationCache[lang][scope]);\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(lang, scope);\n }),\n );\n\n return forkJoin(requests);\n }\n\n private getOrLoadTranslations(lang: string, scope: string): Observable<AXTranslateHashMap<string>> {\n const requestKey = `${lang}_${scope}`;\n\n // Return existing observable if the request is already in progress\n if (this.ongoingRequests.has(requestKey)) {\n return this.ongoingRequests.get(requestKey);\n }\n\n // Load translations if not in cache or ongoing requests\n const translationObservable = this.loader.getTranslation({ lang, scope }).pipe(\n tap((translations) => this.cacheTranslations(lang, scope, translations)),\n catchError((error) => {\n console.error(`Error loading translations for lang: ${lang}, scope: ${scope}`, error);\n return of(null);\n }),\n finalize(() => {\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageLoaded,\n payload: lang,\n });\n this.ongoingRequests.delete(requestKey);\n }),\n shareReplay(1),\n );\n\n this.ongoingRequests.set(requestKey, translationObservable);\n return translationObservable;\n }\n\n private cacheTranslations(lang: string, scope: string, translations: AXTranslateHashMap<string>): void {\n lodashSet(this.translationCache, `${lang}.${scope}`, translations);\n }\n\n public getDefaultLang(): string {\n return this.config.defaultLang;\n }\n\n public getActiveLang(): string {\n return this.activeLang.getValue();\n }\n\n public setActiveLang(lang: string): void {\n if (lang != this.getActiveLang()) {\n this.lastActiveLang = this.getActiveLang(); // Update last active language\n this.activeLang.next(lang);\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageChanged,\n payload: lang,\n });\n }\n }\n\n public isLangAvailable(lang: string, scope: string = null): boolean {\n return !this.translationCache[lang] && (!scope || !this.translationCache[lang][scope]);\n }\n\n public getLangAvailable(): AXTranslateLang[] | undefined {\n return this.config.availableLangs;\n }\n\n private load(key: string, options: AXTranslateOptions = {}): Observable<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options;\n\n // Function to fetch translation\n const fetchTranslation = (language: string): Observable<string> => {\n // Check if translations are available in the cache\n if (this.translationCache[language]?.[scope]) {\n return of(this.getTranslation(key, language, scope, options.params));\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(language, scope).pipe(\n map(() => {\n const translation = this.translationCache[language]?.[scope]?.[key] || key;\n return this.getTranslation(translation, language, scope, options.params);\n }),\n switchMap((translatedText) => {\n if (translatedText === key && language !== this.getDefaultLang()) {\n // If the translation is not found and the language is not default,\n // try fetching from the default language\n return fetchTranslation(this.getDefaultLang());\n }\n return of(translatedText);\n }),\n );\n };\n\n // First, try to fetch the translation for the requested language\n const translationForRequestedLang = fetchTranslation(lang);\n\n // If lastActiveLang is available and different from the requested language, use it as a fallback\n if (this.lastActiveLang && this.lastActiveLang !== lang) {\n const translationForLastActiveLang = this.getTranslation(\n key,\n this.lastActiveLang,\n scope,\n options.params,\n );\n return translationForRequestedLang.pipe(startWith(translationForLastActiveLang));\n }\n\n return translationForRequestedLang;\n }\n\n private getTranslation(key: string, lang: string, scope: string, params?: AXTranslateParams): string {\n let translation: string = (lodashGet(this.translationCache, `${lang}.${scope}.${key}`) || key) as string;\n\n // Replace params like {{ name }}\n if (params) {\n Object.keys(params).forEach((paramKey) => {\n const paramValue = params[paramKey] as string;\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n translation = translation.replace(new RegExp(`{{\\\\s*${paramKey}\\\\s*}}`, 'g'), paramValue);\n }\n });\n }\n\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n // Replace translations like {{ t('key') }}\n const translationPattern = /{{\\s*t\\('([^']+)'\\)\\s*}}/g;\n translation = translation.replace(translationPattern, (match, innerKey) => {\n return this.getTranslation(innerKey, lang, scope, params);\n });\n }\n\n return translation;\n }\n\n public translate(key: string, options?: AXTranslateOptions): Observable<string> {\n const result = this.findAXTranslateOptionsFromKey(key);\n if (result.length) {\n // result.forEach((item) => {\n // this.langChanges$.pipe(\n // switchMap((lang) => {\n // return this.load(item.key, {\n // params: options.params,\n // scope: item.scope || options.scope || this.config.defaultScope,\n // lang: item.lang || options.lang || this.config.defaultLang,\n // });\n // }),\n // );\n // });\n return this.translateAsyncAXTranslate(key, options);\n } else {\n if (options?.lang) {\n return this.load(key, options);\n }\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.load(key, { ...options, lang: lang });\n }),\n );\n }\n }\n\n public async translateAsync(key: string, options?: AXTranslateOptions): Promise<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n if (!translation) {\n // If the translation is not in the cache, load it\n await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));\n translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n }\n\n // If still not available, try the last active language or default language\n if (!translation && this.lastActiveLang) {\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n if (!translation) {\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n\n public translateSync(key: string, options?: AXTranslateOptions): string {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n\n // Check if the translation for the active language is available\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n //\n const loadLang = () => lastValueFrom(this.getOrLoadTranslations(lang, scope));\n // If not available, check lastActiveLang\n if (!translation && this.lastActiveLang) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n\n // If still not available, use the default language\n if (!translation) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n private findAXTranslateOptionsFromKey(\n inputString: string,\n ): (Omit<AXTranslateOptions, 'params'> & { key: string })[] {\n const regex = /<axt(?:\\s+lang=\"([^\"]*)\")?(?:\\s+scope=\"([^\"]*)\")?>(.*?)<\\/axt>/g;\n const result: (Omit<AXTranslateOptions, 'params'> & { key: string })[] = [];\n let match;\n\n // Loop through all matches in the input string\n while ((match = regex.exec(inputString)) !== null) {\n result.push({\n lang: match[1] || undefined,\n scope: match[2] || undefined,\n key: match[3] || undefined,\n });\n }\n return result;\n }\n\n // private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions) {\n // // Use findAXTranslateOptions to parse all <axt> tags in the input string\n // const regex = /(<axt(?:\\s+lang=\"[^\"]*\")?(?:\\s+scope=\"[^\"]*\")?>.*?<\\/axt>)/g;\n // const splitParts = key.split(regex); // Split into <axt> parts and text parts\n\n // let translatedResult = '';\n\n // for (const part of splitParts) {\n // // Check if the part is an <axt> tag by using the findAXTranslateOptions function\n // const optionsFromKey = this.findAXTranslateOptionsFromKey(part);\n\n // if (optionsFromKey.length > 0) {\n // // This is an <axt> part, translate it\n // for (const parsed of optionsFromKey) {\n // const parsedLang = parsed.lang || options.lang || this.getActiveLang();\n // const parsedScope = parsed.scope || options.scope || this.config.defaultScope;\n // const parsedKey = parsed.key;\n\n // // Get the final translation, applying any params if needed\n // const newTranslation = this.load(parsedKey, {\n // lang: parsedLang,\n // scope: parsedScope,\n // params: options?.params,\n // });\n // newTranslation.pipe(first()).subscribe((translatedText) => {\n // translatedResult += `${translatedText}`;\n // });\n\n // // Append the translated text\n // }\n // } else {\n // // This is plain text, so add it as-is\n // translatedResult += part;\n // }\n // console.log(translatedResult);\n // }\n\n // return of(translatedResult);\n // }\n private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions): Observable<string> {\n const regex = /(<axt(?:\\s+lang=\"[^\"]*\")?(?:\\s+scope=\"[^\"]*\")?>.*?<\\/axt>)/g;\n const splitParts = key.split(regex); // Split into <axt> parts and text parts\n \n const translationObservables: Observable<string>[] = [];\n \n for (const part of splitParts) {\n const optionsFromKey = this.findAXTranslateOptionsFromKey(part);\n \n if (optionsFromKey.length > 0) {\n // This is an <axt> part, translate it\n for (const parsed of optionsFromKey) {\n const parsedLang = parsed.lang || options?.lang || this.getActiveLang();\n const parsedScope = parsed.scope || options?.scope || this.config.defaultScope;\n const parsedKey = parsed.key;\n \n // Push the translation observable to the array\n translationObservables.push(\n this.load(parsedKey, {\n lang: parsedLang,\n scope: parsedScope,\n params: options?.params,\n }).pipe(first())\n );\n }\n } else {\n // This is plain text, so wrap it in an observable\n translationObservables.push(of(part));\n }\n }\n \n // Use forkJoin to wait for all observables to complete\n return forkJoin(translationObservables).pipe(\n map((translatedParts) => translatedParts.join('')) // Join all translated parts\n );\n }\n \n}\n","import { inject } from '@angular/core';\nimport { ResolveFn } from '@angular/router';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\n\nexport const loadTranslationScope: ResolveFn<unknown> = (route, state) => {\n const translatorService = inject(AXTranslationService);\n const config = inject(AX_TRANSLATION_CONFIG);\n const scopeValue = route.data[config.scopeResolverKey];\n const scopes = Array.isArray(scopeValue) ? scopeValue : [scopeValue];\n return translatorService.loadLanguagesAndScopes([translatorService.getActiveLang()], scopes);\n};\n","import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Directive({\n selector: '[translate]',\n})\nexport class AXTranslatorDirective implements OnInit {\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private translationService: AXTranslationService,\n ) {}\n\n ngOnInit() {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: (key: string, options?: AXTranslateOptions) => {\n return this.translationService.translate(key, options);\n },\n });\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Pipe({ name: 'translate', pure: true }) // The pipe can now be pure\nexport class AXTranslatorPipe implements PipeTransform {\n constructor(private service: AXTranslationService) {}\n\n transform(key: string, options?: AXTranslateOptions): Observable<string> {\n if (!key) {\n return of(''); // Return an empty observable if the key is not provided\n }\n return this.service.translate(key, options);\n }\n}\n","import { APP_INITIALIZER, NgModule } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AXTranslationConfig, AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslatorDirective } from './translator.directive';\nimport { AXTranslatorPipe } from './translator.pipe';\n\nfunction initializeApp(translatorService: AXTranslationService, config: AXTranslationConfig) {\n return (): Observable<any> => {\n return translatorService.loadLanguagesAndScopes(\n config.preloadLangs ?? [config.defaultLang],\n config.preloadScopes ?? [config.defaultScope],\n );\n };\n}\n\n@NgModule({\n imports: [],\n exports: [AXTranslatorPipe, AXTranslatorDirective],\n declarations: [AXTranslatorPipe, AXTranslatorDirective],\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: initializeApp,\n deps: [AXTranslationService, AX_TRANSLATION_CONFIG],\n multi: true,\n },\n ],\n})\nexport class AXTranslationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["lodashSet","lodashGet","i1.AXTranslationService"],"mappings":";;;;;;MAYa,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;AACZ,QAAA,OAAO,0BAA0B;KAClC;AACF,CAAA;AAEY,MAAA,0BAA0B,GAAwB;AAC7D,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,YAAY,EAAE,QAAQ;AACtB,IAAA,gBAAgB,EAAE,OAAO;;AAKX,SAAA,iBAAiB,CAAC,MAAA,GA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AA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,iBAVf,gBAAgB,EAAE,qBAAqB,CAD5C,EAAA,OAAA,EAAA,CAAA,gBAAgB,EAAE,qBAAqB,CAAA,EAAA,CAAA,CAAA;AAWtC,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,EATnB,SAAA,EAAA;AACT,YAAA;AACE,gBAAA,OAAO,EAAE,eAAe;AACxB,gBAAA,UAAU,EAAE,aAAa;AACzB,gBAAA,IAAI,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;AACnD,gBAAA,KAAK,EAAE,IAAI;AACZ,aAAA;AACF,SAAA,EAAA,CAAA,CAAA;;2FAEU,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAb/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;AAClD,oBAAA,YAAY,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;AACvD,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,eAAe;AACxB,4BAAA,UAAU,EAAE,aAAa;AACzB,4BAAA,IAAI,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;AACnD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA;AACF,iBAAA;;;AC5BD;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, HostListener, Input, Directive, NgModule } from '@angular/core';
2
+ import { Injectable, Directive, Input, HostListener, NgModule } from '@angular/core';
3
3
  import { Subject, takeUntil } from 'rxjs';
4
4
  import tinycolor from 'tinycolor2';
5
5
  import tinygradient from 'tinygradient-es';
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, InjectionToken, Injector, Inject, NgModule } from '@angular/core';
2
+ import { Injectable, inject, InjectionToken, Injector, NgModule, Inject } from '@angular/core';
3
3
  import * as i1 from '@acorex/core/translation';
4
4
  import { AXTranslationService } from '@acorex/core/translation';
5
- import { isString, isEmpty, find, isNull, isUndefined, isNumber, isArray, isEqual, merge } from 'lodash-es';
5
+ import { isString, isEmpty, isBoolean, isNull, isUndefined, isNumber, isArray, find, isEqual, merge } from 'lodash-es';
6
6
 
7
7
  class AXCallbackValidationRule {
8
8
  get name() {
@@ -89,6 +89,7 @@ class AXRequiredValidationRule {
89
89
  }
90
90
  async validate(value, options) {
91
91
  const rules = [
92
+ { test: (val) => isBoolean(val) || !val },
92
93
  { test: (val) => isNull(val) || isUndefined(val) },
93
94
  { test: (val) => isString(val) && isEmpty(val.trim()) },
94
95
  { test: (val) => isNumber(val) && isNaN(val) },
@@ -99,7 +100,7 @@ class AXRequiredValidationRule {
99
100
  const translatedMessage = await this.traslationService.translateAsync('validation.messages.required', {
100
101
  params: { title: options?.['title'] },
101
102
  });
102
- const message = failedRule ? options?.message ?? translatedMessage : null;
103
+ const message = failedRule ? (options?.message ?? translatedMessage) : null;
103
104
  return {
104
105
  rule: this.name,
105
106
  result: isValid,
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-validation.mjs","sources":["../../../../libs/core/validation/src/lib/rules/callback-rule.ts","../../../../libs/core/validation/src/lib/rules/regex-rule.ts","../../../../libs/core/validation/src/lib/rules/required-rule.ts","../../../../libs/core/validation/src/lib/rules/length-rule.ts","../../../../libs/core/validation/src/lib/rules/maxlength-rule.ts","../../../../libs/core/validation/src/lib/rules/minlength-rule.ts","../../../../libs/core/validation/src/lib/rules/between-rule.ts","../../../../libs/core/validation/src/lib/rules/equal-rule.ts","../../../../libs/core/validation/src/lib/rules/greater-than.ts","../../../../libs/core/validation/src/lib/rules/less-than-rule.ts","../../../../libs/core/validation/src/lib/validation.config.ts","../../../../libs/core/validation/src/lib/validation.service.ts","../../../../libs/core/validation/src/lib/validation.module.ts","../../../../libs/core/validation/src/lib/validation.types.ts","../../../../libs/core/validation/src/acorex-core-validation.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport type AXCallbackValidationRuleResult =\n | Promise<{ result: boolean; message?: string }>\n | { result: boolean; message?: string }\n | boolean;\n\nexport type AXCallbackValidation<T> = (value: T, options?: AXCallbackValidationRuleOptions<T>) => AXCallbackValidationRuleResult;\n\nexport interface AXCallbackValidationRuleOptions<T> extends AXValidationRuleOptions {\n validate: AXCallbackValidation<T>;\n}\n\n// Augment the AXValidationRuleOptionsMap\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n callback: AXCallbackValidationRuleOptions<unknown>;\n }\n}\n\n@Injectable()\nexport class AXCallbackValidationRule<T> implements AXValidationRule {\n get name(): string {\n return 'callback';\n }\n\n async validate(value: T, options: AXCallbackValidationRuleOptions<T>): Promise<AXValidationRuleResult> {\n const validationResult = options?.validate\n ? options?.validate(value, options)\n : {\n result: false,\n message: 'Invalid callback function',\n };\n const createResult = (result: { result: boolean; message?: string }) => ({\n rule: this.name,\n result: result.result,\n message: result.message ?? options?.message ?? '',\n value: value,\n });\n\n if (typeof validationResult === 'boolean') {\n return createResult({\n result: validationResult,\n });\n }\n\n if (validationResult instanceof Promise) {\n return validationResult.then(createResult);\n }\n\n return createResult(validationResult);\n }\n}\n","import { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { isEmpty, isString } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXRegexValidationRuleOptions extends AXValidationRuleOptions {\n pattern: string | RegExp;\n}\n\n// Augment the AXValidationRuleOptionsMap\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n regex: AXRegexValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXRegexValidationRule implements AXValidationRule {\n private traslationService = inject(AXTranslationService);\n\n get name(): string {\n return 'regex';\n }\n\n async validate(value: string, options: AXRegexValidationRuleOptions): Promise<AXValidationRuleResult> {\n // Convert string pattern to RegExp if necessary\n const regexPattern = typeof options.pattern === 'string' ? new RegExp(options.pattern) : options.pattern;\n\n if (!value || (isString(value) && isEmpty(value.trim()))) {\n return {\n rule: this.name,\n result: true,\n message: null,\n value: value,\n };\n } else if (!isString(value)) {\n return {\n rule: this.name,\n result: false,\n message: `${value} is not string value.`,\n value: value,\n };\n }\n\n const isValid = regexPattern.test(value);\n const translatedMessage = await this.traslationService.translateAsync(\n options?.message ?? `The value does not match the pattern ${regexPattern}.`,\n { params: { title: options?.['title'] } },\n );\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? null : translatedMessage,\n value: value,\n };\n }\n}\n","import { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { find, isArray, isEmpty, isNull, isNumber, isString, isUndefined } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXRequiredValidationRuleOptions extends AXValidationRuleOptions {}\n\n// Augment the AXValidationRuleOptionsMap\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n required: AXRequiredValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXRequiredValidationRule implements AXValidationRule {\n private traslationService = inject(AXTranslationService);\n\n get name(): string {\n return 'required';\n }\n\n async validate(value?: unknown, options?: AXRequiredValidationRuleOptions): Promise<AXValidationRuleResult> {\n const rules = [\n { test: (val) => isNull(val) || isUndefined(val) },\n { test: (val) => isString(val) && isEmpty(val.trim()) },\n { test: (val) => isNumber(val) && isNaN(val) },\n { test: (val) => isArray(val) && isEmpty(val) },\n ];\n\n const failedRule = find(rules, (rule) => rule.test(value));\n const isValid = !failedRule;\n const translatedMessage = await this.traslationService.translateAsync('validation.messages.required', {\n params: { title: options?.['title'] },\n });\n const message = failedRule ? options?.message ?? translatedMessage : null;\n\n return {\n rule: this.name,\n result: isValid,\n message: message,\n value,\n };\n }\n}\n","// ax-max-length-validation-rule.ts\nimport { Injectable } from '@angular/core';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXLengthValidationRuleOptions extends AXValidationRuleOptions {\n min: number;\n max: number;\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n length: AXLengthValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXLengthValidationRule implements AXValidationRule {\n get name(): string {\n return 'length';\n }\n\n async validate(value: string, options: AXLengthValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValid = value?.length >= options.min && value?.length <= options.max;\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? null : options?.message ?? `The value must be between ${options.min} and ${options.max} chars`,\n value: value,\n };\n }\n}\n","// ax-max-length-validation-rule.ts\nimport { Injectable } from '@angular/core';\nimport { isEmpty } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXMaxLengthValidationRuleOptions extends AXValidationRuleOptions {\n value: number;\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n maxLength: AXMaxLengthValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXMaxLengthValidationRule implements AXValidationRule {\n get name(): string {\n return 'maxLength';\n }\n\n async validate(value: string, options: AXMaxLengthValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValid = isEmpty(value) ? true : value?.length <= options.value;\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? '' : options?.message ?? `The value must not exceed ${options.value} characters.`,\n value: value,\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { isEmpty } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXMinLengthValidationRuleOptions extends AXValidationRuleOptions {\n value: number;\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n minLength: AXMinLengthValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXMinLengthValidationRule implements AXValidationRule {\n get name(): string {\n return 'minLength';\n }\n\n async validate(value: string, options: AXMinLengthValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValid = isEmpty(value) ? true : value?.length >= options.value;\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? '' : options?.message ?? `The value must be at least ${options.value} characters long.`,\n value: value,\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { isEmpty } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXBetweenValidationRuleOptions<T = number | Date> extends AXValidationRuleOptions {\n lowerValue: T;\n upperValue: T;\n inclusive?: boolean; // Optional flag for inclusiveness\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n between: AXBetweenValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXBetweenValidationRule<T = number | Date> implements AXValidationRule {\n get name(): string {\n return 'between';\n }\n\n async validate(value: T, options: AXBetweenValidationRuleOptions<T>): Promise<AXValidationRuleResult> {\n let isValid;\n if (options.inclusive) {\n isValid = value >= options.lowerValue && value <= options.upperValue;\n } else {\n isValid = value > options.lowerValue && value < options.upperValue;\n }\n\n const rangeType = options.inclusive ? 'inclusive' : 'exclusive';\n const baseMessage = `The value must be within the ${rangeType} range of ${options.lowerValue} to ${options.upperValue}.`;\n\n return {\n rule: this.name,\n result: isValid || isEmpty(value),\n message: isValid ? '' : options?.message ?? baseMessage,\n value: value,\n };\n }\n}\n","// ax-equal-validation-rule.ts\nimport { Injectable } from '@angular/core';\nimport { isEqual } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXEqualValidationRuleOptions extends AXValidationRuleOptions {\n value: any;\n not?: boolean; // Optional flag to invert the validation logic\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n equal: AXEqualValidationRuleOptions;\n }\n}\n@Injectable()\nexport class AXEqualValidationRule implements AXValidationRule {\n get name(): string {\n return 'equal';\n }\n\n async validate(value: any, options: AXEqualValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValueEqual = isEqual(value, options.value);\n const isValid = options.not ? !isValueEqual : isValueEqual;\n\n const defaultMessage = `The value must ${options.not ? 'not ' : ''}be equal to ${options.value}.`;\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? '' : options?.message ?? defaultMessage,\n value: value,\n };\n }\n}\n","// ax-greater-than-validation-rule.ts\nimport { Injectable } from '@angular/core';\nimport { isNull, isUndefined } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXGreaterThanValidationRuleOptions extends AXValidationRuleOptions {\n value: number;\n inclusive?: boolean; // Optional flag for inclusiveness\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n greaterThan: AXGreaterThanValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXGreaterThanValidationRule implements AXValidationRule {\n get name(): string {\n return 'greaterThan';\n }\n\n async validate(value: number, options: AXGreaterThanValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValid = isNull(value) || isUndefined(value) ? true : options.inclusive ? value >= options.value : value > options.value;\n const baseMessage = `The value must be ${options.inclusive ? 'greater than or equal to' : 'greater than'} ${options.value}.`;\n\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? '' : options?.message ?? baseMessage,\n value: value,\n };\n }\n}\n","// ax-less-than-validation-rule.ts\nimport { Injectable } from '@angular/core';\nimport { isNull, isUndefined } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXLessThanValidationRuleOptions extends AXValidationRuleOptions {\n value: number;\n inclusive?: boolean; // Optional flag for inclusiveness\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n lessThan: AXLessThanValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXLessThanValidationRule implements AXValidationRule {\n get name(): string {\n return 'lessThan';\n }\n\n async validate(value: number, options: AXLessThanValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValid = isNull(value) || isUndefined(value) ? true : options.inclusive ? value <= options.value : value < options.value;\n const baseMessage = `The value must be ${options.inclusive ? 'less than or equal to' : 'less than'} ${options.value}.`;\n\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? '' : options?.message ?? baseMessage,\n value: value,\n };\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { AXValidationRuleOptions, AXValidationRuleOptionsMap } from './validation.types';\n\nexport type AXValidationConfigRules = {\n [key: string]: {\n rule: keyof AXValidationRuleOptionsMap;\n options: AXValidationRuleOptions;\n };\n};\n\nexport interface AXValidationConfig {\n rules: AXValidationConfigRules;\n}\n\nexport const AX_VALIDATION_CONFIG = new InjectionToken<AXValidationConfig>('AX_VALIDATION_CONFIG', {\n providedIn: 'root',\n factory: () => {\n return AXValidationDefaultConfig;\n },\n});\n\nexport const AXValidationDefaultConfig: AXValidationConfig = {\n rules: {\n email: {\n rule: 'regex',\n options: {\n pattern:\n /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n message: 'validation.messages.email',\n },\n },\n phone: {\n rule: 'regex',\n options: {\n pattern: /^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\\s\\./0-9]*$/,\n message: 'validation.messages.phone',\n },\n },\n },\n};\n\nexport type AXPartialValidationConfig = Partial<AXValidationConfig>;\n\nexport function validationConfig(config: AXPartialValidationConfig = {}): AXValidationConfig {\n const result = {\n ...AXValidationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, Injector, inject } from '@angular/core';\nimport { merge } from 'lodash-es';\nimport { AXValidationConfigRules, AX_VALIDATION_CONFIG } from './validation.config';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleOptionsMap,\n AXValidationRuleResult,\n AXValidationSummary,\n} from './validation.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXValidationRegistryService {\n private plugins: AXValidationRule[] = [];\n\n private configs = inject(AX_VALIDATION_CONFIG);\n\n public get customRules(): AXValidationConfigRules {\n return this.configs.rules;\n }\n\n private injector: Injector;\n\n constructor(injector: Injector) {\n this.injector = injector;\n }\n\n register(...plugins: (new () => AXValidationRule)[]) {\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(ruleName: string): AXValidationRule | undefined {\n return this.plugins.find((c) => c.name == ruleName);\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXValidationService {\n constructor(\n private pluginRegistry: AXValidationRegistryService,\n private translationService: AXTranslationService,\n ) {}\n\n async validate(ruleName: string, value: unknown, options?: AXValidationRuleOptions): Promise<AXValidationRuleResult> {\n const customRule = this.pluginRegistry.customRules[ruleName];\n const validator = this.pluginRegistry.get(ruleName);\n\n if (!validator && !customRule) {\n return {\n rule: ruleName,\n result: false,\n message: await this.translationService.translateAsync('validation.messages.invalid-rull-name', { params: { name: ruleName } }),\n value,\n };\n }\n\n if (options?.message) {\n options.message = await this.translationService.translateAsync(options.message);\n }\n //\n if (validator) return validator.validate(value, options);\n else {\n return this.validate(customRule.rule, value, merge(options, customRule.options));\n }\n }\n\n ruleFor(value: unknown): AXValidationRuleChain {\n return new AXValidationRuleChain(this, value);\n }\n}\n\nclass AXValidationRuleChain {\n private rules: { name: string; options?: AXValidationRuleOptions }[] = [];\n private validationSummary: AXValidationSummary = { result: true, rules: [] };\n\n constructor(\n private validationService: AXValidationService,\n private initialValue: unknown,\n ) {}\n\n addRule<K extends keyof AXValidationRuleOptionsMap>(name: K, options?: AXValidationRuleOptionsMap[K]): AXValidationRuleChain {\n this.rules.push({ name, options });\n return this;\n }\n\n async validate(): Promise<AXValidationSummary> {\n for (const rule of this.rules) {\n const result = await this.validationService.validate(rule.name, this.initialValue, rule.options);\n this.validationSummary.rules.push(result);\n if (!result.result) {\n this.validationSummary.result = false;\n }\n }\n return this.validationSummary;\n }\n}\n","import { Inject, ModuleWithProviders, NgModule } from '@angular/core';\nimport { AXBetweenValidationRule } from './rules/between-rule';\nimport { AXCallbackValidationRule } from './rules/callback-rule';\nimport { AXEqualValidationRule } from './rules/equal-rule';\nimport { AXGreaterThanValidationRule } from './rules/greater-than';\nimport { AXLengthValidationRule } from './rules/length-rule';\nimport { AXLessThanValidationRule } from './rules/less-than-rule';\nimport { AXMaxLengthValidationRule } from './rules/maxlength-rule';\nimport { AXMinLengthValidationRule } from './rules/minlength-rule';\nimport { AXRegexValidationRule } from './rules/regex-rule';\nimport { AXRequiredValidationRule } from './rules/required-rule';\nimport { AXValidationRegistryService } from './validation.service';\nimport { AXValidationRule } from './validation.types';\n\nconst BUILT_IN_RULES = [\n AXRequiredValidationRule,\n AXRegexValidationRule,\n AXRequiredValidationRule,\n AXCallbackValidationRule,\n //\n AXMinLengthValidationRule,\n AXMaxLengthValidationRule,\n AXLengthValidationRule,\n //\n AXEqualValidationRule,\n AXLessThanValidationRule,\n AXGreaterThanValidationRule,\n AXBetweenValidationRule,\n];\n\nexport interface AXValidationModuleConfigs {\n rules: (new () => AXValidationRule)[];\n}\n\n@NgModule({\n imports: [],\n providers: [...BUILT_IN_RULES],\n})\nexport class AXValidationModule {\n static forRoot(configs?: AXValidationModuleConfigs): ModuleWithProviders<AXValidationModule> {\n return {\n ngModule: AXValidationModule,\n providers: [\n ...(configs?.rules || []),\n {\n provide: 'AXValidationModuleFactory',\n useFactory: (pluginRegistry: AXValidationRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.rules || [])]);\n },\n deps: [AXValidationRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(configs?: AXValidationModuleConfigs): ModuleWithProviders<AXValidationModule> {\n return {\n ngModule: AXValidationModule,\n providers: [\n ...(configs?.rules || []),\n {\n provide: 'AXValidationModuleFactory',\n useFactory: (pluginRegistry: AXValidationRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.rules || [])]);\n },\n deps: [AXValidationRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Inject('AXValidationModuleFactory') instances: any[]) {\n instances.forEach((f) => {\n f();\n });\n }\n}\n","export interface AXValidationRuleOptions {\n message?: string;\n [key: string]: unknown;\n}\n\nexport interface AXValidationRuleOptionsMap {\n // initially empty, but will be extended by other modules\n}\n\nexport abstract class AXValidationRule {\n abstract get name(): string;\n abstract validate(value: unknown, options?: AXValidationRuleOptions): Promise<AXValidationRuleResult>;\n}\n\nexport interface AXValidationRuleResult {\n rule: string;\n value?: unknown;\n message?: string | null;\n result: boolean;\n [key: string]: unknown;\n}\n\nexport interface AXValidationSummary {\n result: boolean;\n rules: AXValidationRuleResult[];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAsBa,wBAAwB,CAAA;AACnC,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,OAAO,UAAU;;AAGnB,IAAA,MAAM,QAAQ,CAAC,KAAQ,EAAE,OAA2C,EAAA;AAClE,QAAA,MAAM,gBAAgB,GAAG,OAAO,EAAE;cAC9B,OAAO,EAAE,QAAQ,CAAC,KAAK,EAA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,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,SAAS,EAAE,CAAC,GAAG,cAAc,CAAC;AAC/B,iBAAA;;0BAuCc,MAAM;2BAAC,2BAA2B;;;MCnE3B,gBAAgB,CAAA;AAGrC;;ACZD;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-validation.mjs","sources":["../../../../libs/core/validation/src/lib/rules/callback-rule.ts","../../../../libs/core/validation/src/lib/rules/regex-rule.ts","../../../../libs/core/validation/src/lib/rules/required-rule.ts","../../../../libs/core/validation/src/lib/rules/length-rule.ts","../../../../libs/core/validation/src/lib/rules/maxlength-rule.ts","../../../../libs/core/validation/src/lib/rules/minlength-rule.ts","../../../../libs/core/validation/src/lib/rules/between-rule.ts","../../../../libs/core/validation/src/lib/rules/equal-rule.ts","../../../../libs/core/validation/src/lib/rules/greater-than.ts","../../../../libs/core/validation/src/lib/rules/less-than-rule.ts","../../../../libs/core/validation/src/lib/validation.config.ts","../../../../libs/core/validation/src/lib/validation.service.ts","../../../../libs/core/validation/src/lib/validation.module.ts","../../../../libs/core/validation/src/lib/validation.types.ts","../../../../libs/core/validation/src/acorex-core-validation.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport type AXCallbackValidationRuleResult =\n | Promise<{ result: boolean; message?: string }>\n | { result: boolean; message?: string }\n | boolean;\n\nexport type AXCallbackValidation<T> = (value: T, options?: AXCallbackValidationRuleOptions<T>) => AXCallbackValidationRuleResult;\n\nexport interface AXCallbackValidationRuleOptions<T> extends AXValidationRuleOptions {\n validate: AXCallbackValidation<T>;\n}\n\n// Augment the AXValidationRuleOptionsMap\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n callback: AXCallbackValidationRuleOptions<unknown>;\n }\n}\n\n@Injectable()\nexport class AXCallbackValidationRule<T> implements AXValidationRule {\n get name(): string {\n return 'callback';\n }\n\n async validate(value: T, options: AXCallbackValidationRuleOptions<T>): Promise<AXValidationRuleResult> {\n const validationResult = options?.validate\n ? options?.validate(value, options)\n : {\n result: false,\n message: 'Invalid callback function',\n };\n const createResult = (result: { result: boolean; message?: string }) => ({\n rule: this.name,\n result: result.result,\n message: result.message ?? options?.message ?? '',\n value: value,\n });\n\n if (typeof validationResult === 'boolean') {\n return createResult({\n result: validationResult,\n });\n }\n\n if (validationResult instanceof Promise) {\n return validationResult.then(createResult);\n }\n\n return createResult(validationResult);\n }\n}\n","import { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { isEmpty, isString } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXRegexValidationRuleOptions extends AXValidationRuleOptions {\n pattern: string | RegExp;\n}\n\n// Augment the AXValidationRuleOptionsMap\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n regex: AXRegexValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXRegexValidationRule implements AXValidationRule {\n private traslationService = inject(AXTranslationService);\n\n get name(): string {\n return 'regex';\n }\n\n async validate(value: string, options: AXRegexValidationRuleOptions): Promise<AXValidationRuleResult> {\n // Convert string pattern to RegExp if necessary\n const regexPattern = typeof options.pattern === 'string' ? new RegExp(options.pattern) : options.pattern;\n\n if (!value || (isString(value) && isEmpty(value.trim()))) {\n return {\n rule: this.name,\n result: true,\n message: null,\n value: value,\n };\n } else if (!isString(value)) {\n return {\n rule: this.name,\n result: false,\n message: `${value} is not string value.`,\n value: value,\n };\n }\n\n const isValid = regexPattern.test(value);\n const translatedMessage = await this.traslationService.translateAsync(\n options?.message ?? `The value does not match the pattern ${regexPattern}.`,\n { params: { title: options?.['title'] } },\n );\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? null : translatedMessage,\n value: value,\n };\n }\n}\n","import { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { find, isArray, isBoolean, isEmpty, isNull, isNumber, isString, isUndefined } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXRequiredValidationRuleOptions extends AXValidationRuleOptions {}\n\n// Augment the AXValidationRuleOptionsMap\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n required: AXRequiredValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXRequiredValidationRule implements AXValidationRule {\n private traslationService = inject(AXTranslationService);\n\n get name(): string {\n return 'required';\n }\n\n async validate(\n value?: unknown,\n options?: AXRequiredValidationRuleOptions,\n ): Promise<AXValidationRuleResult> {\n const rules = [\n { test: (val) => isBoolean(val) || !val },\n { test: (val) => isNull(val) || isUndefined(val) },\n { test: (val) => isString(val) && isEmpty(val.trim()) },\n { test: (val) => isNumber(val) && isNaN(val) },\n { test: (val) => isArray(val) && isEmpty(val) },\n ];\n\n const failedRule = find(rules, (rule) => rule.test(value));\n const isValid = !failedRule;\n const translatedMessage = await this.traslationService.translateAsync('validation.messages.required', {\n params: { title: options?.['title'] },\n });\n const message = failedRule ? (options?.message ?? translatedMessage) : null;\n\n return {\n rule: this.name,\n result: isValid,\n message: message,\n value,\n };\n }\n}\n","// ax-max-length-validation-rule.ts\nimport { Injectable } from '@angular/core';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXLengthValidationRuleOptions extends AXValidationRuleOptions {\n min: number;\n max: number;\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n length: AXLengthValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXLengthValidationRule implements AXValidationRule {\n get name(): string {\n return 'length';\n }\n\n async validate(value: string, options: AXLengthValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValid = value?.length >= options.min && value?.length <= options.max;\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? null : options?.message ?? `The value must be between ${options.min} and ${options.max} chars`,\n value: value,\n };\n }\n}\n","// ax-max-length-validation-rule.ts\nimport { Injectable } from '@angular/core';\nimport { isEmpty } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXMaxLengthValidationRuleOptions extends AXValidationRuleOptions {\n value: number;\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n maxLength: AXMaxLengthValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXMaxLengthValidationRule implements AXValidationRule {\n get name(): string {\n return 'maxLength';\n }\n\n async validate(value: string, options: AXMaxLengthValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValid = isEmpty(value) ? true : value?.length <= options.value;\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? '' : options?.message ?? `The value must not exceed ${options.value} characters.`,\n value: value,\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { isEmpty } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXMinLengthValidationRuleOptions extends AXValidationRuleOptions {\n value: number;\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n minLength: AXMinLengthValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXMinLengthValidationRule implements AXValidationRule {\n get name(): string {\n return 'minLength';\n }\n\n async validate(value: string, options: AXMinLengthValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValid = isEmpty(value) ? true : value?.length >= options.value;\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? '' : options?.message ?? `The value must be at least ${options.value} characters long.`,\n value: value,\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { isEmpty } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXBetweenValidationRuleOptions<T = number | Date> extends AXValidationRuleOptions {\n lowerValue: T;\n upperValue: T;\n inclusive?: boolean; // Optional flag for inclusiveness\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n between: AXBetweenValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXBetweenValidationRule<T = number | Date> implements AXValidationRule {\n get name(): string {\n return 'between';\n }\n\n async validate(value: T, options: AXBetweenValidationRuleOptions<T>): Promise<AXValidationRuleResult> {\n let isValid;\n if (options.inclusive) {\n isValid = value >= options.lowerValue && value <= options.upperValue;\n } else {\n isValid = value > options.lowerValue && value < options.upperValue;\n }\n\n const rangeType = options.inclusive ? 'inclusive' : 'exclusive';\n const baseMessage = `The value must be within the ${rangeType} range of ${options.lowerValue} to ${options.upperValue}.`;\n\n return {\n rule: this.name,\n result: isValid || isEmpty(value),\n message: isValid ? '' : options?.message ?? baseMessage,\n value: value,\n };\n }\n}\n","// ax-equal-validation-rule.ts\nimport { Injectable } from '@angular/core';\nimport { isEqual } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXEqualValidationRuleOptions extends AXValidationRuleOptions {\n value: any;\n not?: boolean; // Optional flag to invert the validation logic\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n equal: AXEqualValidationRuleOptions;\n }\n}\n@Injectable()\nexport class AXEqualValidationRule implements AXValidationRule {\n get name(): string {\n return 'equal';\n }\n\n async validate(value: any, options: AXEqualValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValueEqual = isEqual(value, options.value);\n const isValid = options.not ? !isValueEqual : isValueEqual;\n\n const defaultMessage = `The value must ${options.not ? 'not ' : ''}be equal to ${options.value}.`;\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? '' : options?.message ?? defaultMessage,\n value: value,\n };\n }\n}\n","// ax-greater-than-validation-rule.ts\nimport { Injectable } from '@angular/core';\nimport { isNull, isUndefined } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXGreaterThanValidationRuleOptions extends AXValidationRuleOptions {\n value: number;\n inclusive?: boolean; // Optional flag for inclusiveness\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n greaterThan: AXGreaterThanValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXGreaterThanValidationRule implements AXValidationRule {\n get name(): string {\n return 'greaterThan';\n }\n\n async validate(value: number, options: AXGreaterThanValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValid = isNull(value) || isUndefined(value) ? true : options.inclusive ? value >= options.value : value > options.value;\n const baseMessage = `The value must be ${options.inclusive ? 'greater than or equal to' : 'greater than'} ${options.value}.`;\n\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? '' : options?.message ?? baseMessage,\n value: value,\n };\n }\n}\n","// ax-less-than-validation-rule.ts\nimport { Injectable } from '@angular/core';\nimport { isNull, isUndefined } from 'lodash-es';\nimport { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';\n\nexport interface AXLessThanValidationRuleOptions extends AXValidationRuleOptions {\n value: number;\n inclusive?: boolean; // Optional flag for inclusiveness\n}\n\ndeclare module '../validation.types' {\n interface AXValidationRuleOptionsMap {\n lessThan: AXLessThanValidationRuleOptions;\n }\n}\n\n@Injectable()\nexport class AXLessThanValidationRule implements AXValidationRule {\n get name(): string {\n return 'lessThan';\n }\n\n async validate(value: number, options: AXLessThanValidationRuleOptions): Promise<AXValidationRuleResult> {\n const isValid = isNull(value) || isUndefined(value) ? true : options.inclusive ? value <= options.value : value < options.value;\n const baseMessage = `The value must be ${options.inclusive ? 'less than or equal to' : 'less than'} ${options.value}.`;\n\n return {\n rule: this.name,\n result: isValid,\n message: isValid ? '' : options?.message ?? baseMessage,\n value: value,\n };\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { AXValidationRuleOptions, AXValidationRuleOptionsMap } from './validation.types';\n\nexport type AXValidationConfigRules = {\n [key: string]: {\n rule: keyof AXValidationRuleOptionsMap;\n options: AXValidationRuleOptions;\n };\n};\n\nexport interface AXValidationConfig {\n rules: AXValidationConfigRules;\n}\n\nexport const AX_VALIDATION_CONFIG = new InjectionToken<AXValidationConfig>('AX_VALIDATION_CONFIG', {\n providedIn: 'root',\n factory: () => {\n return AXValidationDefaultConfig;\n },\n});\n\nexport const AXValidationDefaultConfig: AXValidationConfig = {\n rules: {\n email: {\n rule: 'regex',\n options: {\n pattern:\n /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n message: 'validation.messages.email',\n },\n },\n phone: {\n rule: 'regex',\n options: {\n pattern: /^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\\s\\./0-9]*$/,\n message: 'validation.messages.phone',\n },\n },\n },\n};\n\nexport type AXPartialValidationConfig = Partial<AXValidationConfig>;\n\nexport function validationConfig(config: AXPartialValidationConfig = {}): AXValidationConfig {\n const result = {\n ...AXValidationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, Injector, inject } from '@angular/core';\nimport { merge } from 'lodash-es';\nimport { AXValidationConfigRules, AX_VALIDATION_CONFIG } from './validation.config';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleOptionsMap,\n AXValidationRuleResult,\n AXValidationSummary,\n} from './validation.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXValidationRegistryService {\n private plugins: AXValidationRule[] = [];\n\n private configs = inject(AX_VALIDATION_CONFIG);\n\n public get customRules(): AXValidationConfigRules {\n return this.configs.rules;\n }\n\n private injector: Injector;\n\n constructor(injector: Injector) {\n this.injector = injector;\n }\n\n register(...plugins: (new () => AXValidationRule)[]) {\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(ruleName: string): AXValidationRule | undefined {\n return this.plugins.find((c) => c.name == ruleName);\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXValidationService {\n constructor(\n private pluginRegistry: AXValidationRegistryService,\n private translationService: AXTranslationService,\n ) {}\n\n async validate(ruleName: string, value: unknown, options?: AXValidationRuleOptions): Promise<AXValidationRuleResult> {\n const customRule = this.pluginRegistry.customRules[ruleName];\n const validator = this.pluginRegistry.get(ruleName);\n\n if (!validator && !customRule) {\n return {\n rule: ruleName,\n result: false,\n message: await this.translationService.translateAsync('validation.messages.invalid-rull-name', { params: { name: ruleName } }),\n value,\n };\n }\n\n if (options?.message) {\n options.message = await this.translationService.translateAsync(options.message);\n }\n //\n if (validator) return validator.validate(value, options);\n else {\n return this.validate(customRule.rule, value, merge(options, customRule.options));\n }\n }\n\n ruleFor(value: unknown): AXValidationRuleChain {\n return new AXValidationRuleChain(this, value);\n }\n}\n\nclass AXValidationRuleChain {\n private rules: { name: string; options?: AXValidationRuleOptions }[] = [];\n private validationSummary: AXValidationSummary = { result: true, rules: [] };\n\n constructor(\n private validationService: AXValidationService,\n private initialValue: unknown,\n ) {}\n\n addRule<K extends keyof AXValidationRuleOptionsMap>(name: K, options?: AXValidationRuleOptionsMap[K]): AXValidationRuleChain {\n this.rules.push({ name, options });\n return this;\n }\n\n async validate(): Promise<AXValidationSummary> {\n for (const rule of this.rules) {\n const result = await this.validationService.validate(rule.name, this.initialValue, rule.options);\n this.validationSummary.rules.push(result);\n if (!result.result) {\n this.validationSummary.result = false;\n }\n }\n return this.validationSummary;\n }\n}\n","import { Inject, ModuleWithProviders, NgModule } from '@angular/core';\nimport { AXBetweenValidationRule } from './rules/between-rule';\nimport { AXCallbackValidationRule } from './rules/callback-rule';\nimport { AXEqualValidationRule } from './rules/equal-rule';\nimport { AXGreaterThanValidationRule } from './rules/greater-than';\nimport { AXLengthValidationRule } from './rules/length-rule';\nimport { AXLessThanValidationRule } from './rules/less-than-rule';\nimport { AXMaxLengthValidationRule } from './rules/maxlength-rule';\nimport { AXMinLengthValidationRule } from './rules/minlength-rule';\nimport { AXRegexValidationRule } from './rules/regex-rule';\nimport { AXRequiredValidationRule } from './rules/required-rule';\nimport { AXValidationRegistryService } from './validation.service';\nimport { AXValidationRule } from './validation.types';\n\nconst BUILT_IN_RULES = [\n AXRequiredValidationRule,\n AXRegexValidationRule,\n AXRequiredValidationRule,\n AXCallbackValidationRule,\n //\n AXMinLengthValidationRule,\n AXMaxLengthValidationRule,\n AXLengthValidationRule,\n //\n AXEqualValidationRule,\n AXLessThanValidationRule,\n AXGreaterThanValidationRule,\n AXBetweenValidationRule,\n];\n\nexport interface AXValidationModuleConfigs {\n rules: (new () => AXValidationRule)[];\n}\n\n@NgModule({\n imports: [],\n providers: [...BUILT_IN_RULES],\n})\nexport class AXValidationModule {\n static forRoot(configs?: AXValidationModuleConfigs): ModuleWithProviders<AXValidationModule> {\n return {\n ngModule: AXValidationModule,\n providers: [\n ...(configs?.rules || []),\n {\n provide: 'AXValidationModuleFactory',\n useFactory: (pluginRegistry: AXValidationRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.rules || [])]);\n },\n deps: [AXValidationRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(configs?: AXValidationModuleConfigs): ModuleWithProviders<AXValidationModule> {\n return {\n ngModule: AXValidationModule,\n providers: [\n ...(configs?.rules || []),\n {\n provide: 'AXValidationModuleFactory',\n useFactory: (pluginRegistry: AXValidationRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.rules || [])]);\n },\n deps: [AXValidationRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Inject('AXValidationModuleFactory') instances: any[]) {\n instances.forEach((f) => {\n f();\n });\n }\n}\n","export interface AXValidationRuleOptions {\n message?: string;\n [key: string]: unknown;\n}\n\nexport interface AXValidationRuleOptionsMap {\n // initially empty, but will be extended by other modules\n}\n\nexport abstract class AXValidationRule {\n abstract get name(): string;\n abstract validate(value: unknown, options?: AXValidationRuleOptions): Promise<AXValidationRuleResult>;\n}\n\nexport interface AXValidationRuleResult {\n rule: string;\n value?: unknown;\n message?: string | null;\n result: boolean;\n [key: string]: unknown;\n}\n\nexport interface AXValidationSummary {\n result: boolean;\n rules: AXValidationRuleResult[];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAsBa,wBAAwB,CAAA;AACnC,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,OAAO,UAAU;;AAGnB,IAAA,MAAM,QAAQ,CAAC,KAAQ,EAAE,OAA2C,EAAA;AAClE,QAAA,MAAM,gBAAgB,GAAG,OAAO,EAAE;cAC9B,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO;AAClC,cAAE;AACE,gBAAA,MAAM,EAAE,KAAK;AACb,gBAAA,OAAO,EAAE,2BAA2B;aACrC;AACL,QAAA,MAAM,YAAY,GAAG,CAAC,MAA6C,MAAM;YACvE,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,OAAO,EAAE,OAAO,IAAI,EAAE;AACjD,YAAA,KAAK,EAAE,KAAK;AACb,SAAA,CAAC;AAEF,QAAA,IAAI,OAAO,gBAAgB,KAAK,SAAS,EAAE;AACzC,YAAA,OAAO,YAAY,CAAC;AAClB,gBAAA,MAAM,EAAE,gBAAgB;AACzB,aAAA,CAAC;;AAGJ,QAAA,IAAI,gBAAgB,YAAY,OAAO,EAAE;AACvC,YAAA,OAAO,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC;;AAG5C,QAAA,OAAO,YAAY,CAAC,gBAAgB,CAAC;;8GA7B5B,wBAAwB,EAAA,IAAA,EAAA,EAAA,EA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AS,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AACtB,YAAA,CAAC,EAAE;AACL,SAAC,CAAC;;AAzCO,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,kBAsCT,2BAA2B,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAtCpC,kBAAkB,EAAA,CAAA,CAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAFlB,SAAA,EAAA,CAAC,GAAG,cAAc,CAAC,EAAA,CAAA,CAAA;;2FAEnB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,SAAS,EAAE,CAAC,GAAG,cAAc,CAAC;AAC/B,iBAAA;;0BAuCc,MAAM;2BAAC,2BAA2B;;;MCnE3B,gBAAgB,CAAA;AAGrC;;ACZD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acorex/core",
3
- "version": "18.14.1-next.0",
3
+ "version": "18.14.1-next.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.2.0",
6
6
  "@angular/core": ">=18.2.0",
@@ -28,9 +28,8 @@ export declare class AXTranslationService {
28
28
  translate(key: string, options?: AXTranslateOptions): Observable<string>;
29
29
  translateAsync(key: string, options?: AXTranslateOptions): Promise<string>;
30
30
  translateSync(key: string, options?: AXTranslateOptions): string;
31
- findAXTranslateOptions(inputString: string): (Omit<AXTranslateOptions, 'params'> & {
32
- key: string;
33
- })[];
31
+ private findAXTranslateOptionsFromKey;
32
+ private translateAsyncAXTranslate;
34
33
  static ɵfac: i0.ɵɵFactoryDeclaration<AXTranslationService, never>;
35
34
  static ɵprov: i0.ɵɵInjectableDeclaration<AXTranslationService>;
36
35
  }
@@ -7,7 +7,6 @@ export declare class AXTranslatorPipe implements PipeTransform {
7
7
  private service;
8
8
  constructor(service: AXTranslationService);
9
9
  transform(key: string, options?: AXTranslateOptions): Observable<string>;
10
- private splitString;
11
10
  static ɵfac: i0.ɵɵFactoryDeclaration<AXTranslatorPipe, never>;
12
11
  static ɵpipe: i0.ɵɵPipeDeclaration<AXTranslatorPipe, "translate", false>;
13
12
  }