@acorex/core 18.14.0 → 18.14.1-next.1
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/translation/lib/translation.service.mjs +100 -7
- package/esm2022/translation/lib/translation.types.mjs +1 -1
- package/esm2022/translation/lib/translator.pipe.mjs +4 -13
- package/esm2022/utils/index.mjs +3 -1
- package/esm2022/utils/lib/resize.directive.mjs +117 -0
- package/esm2022/utils/lib/utils.module.mjs +18 -0
- package/esm2022/validation/lib/rules/required-rule.mjs +4 -3
- package/fesm2022/acorex-core-format.mjs +1 -1
- package/fesm2022/acorex-core-storage.mjs +1 -1
- package/fesm2022/acorex-core-translation.mjs +102 -18
- package/fesm2022/acorex-core-translation.mjs.map +1 -1
- package/fesm2022/acorex-core-utils.mjs +132 -2
- package/fesm2022/acorex-core-utils.mjs.map +1 -1
- package/fesm2022/acorex-core-validation.mjs +4 -3
- package/fesm2022/acorex-core-validation.mjs.map +1 -1
- package/package.json +1 -1
- package/translation/lib/translation.service.d.ts +2 -0
- package/translation/lib/translator.pipe.d.ts +0 -1
- package/utils/index.d.ts +2 -0
- package/utils/lib/resize.directive.d.ts +19 -0
- package/utils/lib/utils.module.d.ts +8 -0
@@ -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,12 +168,29 @@ class AXTranslationService {
|
|
168
168
|
return translation;
|
169
169
|
}
|
170
170
|
translate(key, options) {
|
171
|
-
|
172
|
-
|
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
196
|
const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};
|
@@ -212,6 +229,82 @@ class AXTranslationService {
|
|
212
229
|
// Perform parameter replacement
|
213
230
|
return this.getTranslation((translation || key), lang, scope, options?.params);
|
214
231
|
}
|
232
|
+
findAXTranslateOptionsFromKey(inputString) {
|
233
|
+
const regex = /<axt(?:\s+lang="([^"]*)")?(?:\s+scope="([^"]*)")?>(.*?)<\/axt>/g;
|
234
|
+
const result = [];
|
235
|
+
let match;
|
236
|
+
// Loop through all matches in the input string
|
237
|
+
while ((match = regex.exec(inputString)) !== null) {
|
238
|
+
result.push({
|
239
|
+
lang: match[1] || undefined,
|
240
|
+
scope: match[2] || undefined,
|
241
|
+
key: match[3] || undefined,
|
242
|
+
});
|
243
|
+
}
|
244
|
+
return result;
|
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
|
+
}
|
215
308
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
216
309
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTranslationService, providedIn: 'root' }); }
|
217
310
|
}
|
@@ -257,19 +350,10 @@ class AXTranslatorPipe {
|
|
257
350
|
this.service = service;
|
258
351
|
}
|
259
352
|
transform(key, options) {
|
260
|
-
if (!key)
|
261
|
-
return of('');
|
262
|
-
const splitKey = this.splitString(key);
|
263
|
-
return Array.isArray(splitKey)
|
264
|
-
? this.service.translate(splitKey[1], { ...options, scope: splitKey[0] })
|
265
|
-
: this.service.translate(key, options);
|
266
|
-
}
|
267
|
-
splitString(value) {
|
268
|
-
if (value.startsWith('#')) {
|
269
|
-
const [first, ...rest] = value.slice(1).split('.');
|
270
|
-
return [first, rest.join('.')];
|
353
|
+
if (!key) {
|
354
|
+
return of(''); // Return an empty observable if the key is not provided
|
271
355
|
}
|
272
|
-
return
|
356
|
+
return this.service.translate(key, options);
|
273
357
|
}
|
274
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 }); }
|
275
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 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}\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,GAAG,EAAE,OAAO,CAAC;AAC5C;MAGa,oBAAoB,CAAA;AAc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EU,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
|
+
{"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,GAAw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 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Injectable } from '@angular/core';
|
2
|
+
import { Injectable, HostListener, Input, Directive, NgModule } from '@angular/core';
|
3
3
|
import { Subject, takeUntil } from 'rxjs';
|
4
4
|
import tinycolor from 'tinycolor2';
|
5
5
|
import tinygradient from 'tinygradient-es';
|
6
6
|
import { isBrowser } from '@acorex/core/platform';
|
7
|
+
import { CommonModule } from '@angular/common';
|
7
8
|
|
8
9
|
function AXAutoUnsubscriber() {
|
9
10
|
return function (constructor) {
|
@@ -254,6 +255,121 @@ class AXHtmlUtil {
|
|
254
255
|
}
|
255
256
|
}
|
256
257
|
|
258
|
+
class AXResizableDirective {
|
259
|
+
constructor(el, renderer, zone) {
|
260
|
+
this.el = el;
|
261
|
+
this.renderer = renderer;
|
262
|
+
this.zone = zone;
|
263
|
+
this.minWidth = 100; // Minimum width for the resizable element
|
264
|
+
this.isResizing = false;
|
265
|
+
this.createResizeHandle(); // Initialize the resize handle
|
266
|
+
}
|
267
|
+
// Create the resize handle element and apply inline styles
|
268
|
+
createResizeHandle() {
|
269
|
+
// Apply position relative to the container to allow the absolute positioning of the handle
|
270
|
+
this.renderer.setStyle(this.el.nativeElement, 'position', 'relative');
|
271
|
+
// Create the resize handle dynamically
|
272
|
+
this.resizeHandle = this.renderer.createElement('div');
|
273
|
+
this.renderer.addClass(this.resizeHandle, 'resize-handle');
|
274
|
+
this.renderer.appendChild(this.el.nativeElement, this.resizeHandle);
|
275
|
+
// Apply inline styles for the resize handle
|
276
|
+
this.renderer.setStyle(this.resizeHandle, 'width', '6px'); // Resize handle width
|
277
|
+
this.renderer.setStyle(this.resizeHandle, 'background-color', 'rgba(0, 0, 0, 0.2)');
|
278
|
+
this.renderer.setStyle(this.resizeHandle, 'position', 'absolute');
|
279
|
+
this.renderer.setStyle(this.resizeHandle, 'top', '0');
|
280
|
+
this.renderer.setStyle(this.resizeHandle, 'right', '0');
|
281
|
+
this.renderer.setStyle(this.resizeHandle, 'bottom', '0');
|
282
|
+
this.renderer.setStyle(this.resizeHandle, 'cursor', 'ew-resize'); // Horizontal resize cursor
|
283
|
+
this.renderer.setStyle(this.resizeHandle, 'z-index', '10');
|
284
|
+
this.renderer.setStyle(this.resizeHandle, 'transition', 'background-color 0.2s ease');
|
285
|
+
this.renderer.setStyle(this.resizeHandle, 'border-radius', '4px');
|
286
|
+
}
|
287
|
+
// Mouse down event: Start resizing
|
288
|
+
onMouseDown(event) {
|
289
|
+
// Only allow resizing when clicking on the handle
|
290
|
+
const handleRect = this.resizeHandle.getBoundingClientRect();
|
291
|
+
if (event.clientX >= handleRect.left && event.clientX <= handleRect.right) {
|
292
|
+
this.zone.runOutsideAngular(() => {
|
293
|
+
this.isResizing = true;
|
294
|
+
document.body.style.cursor = 'ew-resize'; // Change cursor to resize mode
|
295
|
+
// Change resize handle color to blue when resizing starts
|
296
|
+
this.renderer.setStyle(this.resizeHandle, 'background-color', '#007bff');
|
297
|
+
event.preventDefault();
|
298
|
+
});
|
299
|
+
}
|
300
|
+
}
|
301
|
+
// Mouse move event: Resize the element
|
302
|
+
onMouseMove(event) {
|
303
|
+
this.zone.runOutsideAngular(() => {
|
304
|
+
if (this.isResizing) {
|
305
|
+
const rect = this.el.nativeElement.getBoundingClientRect();
|
306
|
+
let newWidth;
|
307
|
+
// Resize logic (LTR or RTL support)
|
308
|
+
if (document.documentElement.dir === 'rtl') {
|
309
|
+
newWidth = rect.right - event.clientX;
|
310
|
+
}
|
311
|
+
else {
|
312
|
+
newWidth = event.clientX - rect.left;
|
313
|
+
}
|
314
|
+
// Ensure the width does not go below the minimum width
|
315
|
+
if (newWidth > this.minWidth) {
|
316
|
+
this.renderer.setStyle(this.el.nativeElement, 'width', `${newWidth}px`);
|
317
|
+
}
|
318
|
+
}
|
319
|
+
});
|
320
|
+
}
|
321
|
+
// Mouse up event: End resizing
|
322
|
+
onMouseUp() {
|
323
|
+
this.zone.runOutsideAngular(() => {
|
324
|
+
if (this.isResizing) {
|
325
|
+
this.isResizing = false;
|
326
|
+
document.body.style.cursor = 'default'; // Reset the cursor
|
327
|
+
// Reset the resize handle color to default when resizing ends
|
328
|
+
this.renderer.setStyle(this.resizeHandle, 'background-color', 'rgba(0, 0, 0, 0.2)');
|
329
|
+
}
|
330
|
+
});
|
331
|
+
}
|
332
|
+
// Mouse enter event to change the background color (hover effect)
|
333
|
+
onMouseEnter() {
|
334
|
+
// Only change color to blue if not resizing
|
335
|
+
if (!this.isResizing) {
|
336
|
+
this.renderer.setStyle(this.resizeHandle, 'background-color', '#007bff'); // Blue color on hover
|
337
|
+
}
|
338
|
+
}
|
339
|
+
// Mouse leave event to reset the background color
|
340
|
+
onMouseLeave() {
|
341
|
+
// Only reset to default color if not resizing
|
342
|
+
if (!this.isResizing) {
|
343
|
+
this.renderer.setStyle(this.resizeHandle, 'background-color', 'rgba(0, 0, 0, 0.2)'); // Default background color
|
344
|
+
}
|
345
|
+
}
|
346
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXResizableDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
347
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.0", type: AXResizableDirective, selector: "[axResizable]", inputs: { minWidth: "minWidth" }, host: { listeners: { "mousedown": "onMouseDown($event)", "document:mousemove": "onMouseMove($event)", "document:mouseup": "onMouseUp()", "mouseenter": "onMouseEnter($event)", "mouseleave": "onMouseLeave($event)" } }, ngImport: i0 }); }
|
348
|
+
}
|
349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXResizableDirective, decorators: [{
|
350
|
+
type: Directive,
|
351
|
+
args: [{
|
352
|
+
selector: '[axResizable]', // Apply this directive on any element like <div axResizable></div>
|
353
|
+
}]
|
354
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }], propDecorators: { minWidth: [{
|
355
|
+
type: Input
|
356
|
+
}], onMouseDown: [{
|
357
|
+
type: HostListener,
|
358
|
+
args: ['mousedown', ['$event']]
|
359
|
+
}], onMouseMove: [{
|
360
|
+
type: HostListener,
|
361
|
+
args: ['document:mousemove', ['$event']]
|
362
|
+
}], onMouseUp: [{
|
363
|
+
type: HostListener,
|
364
|
+
args: ['document:mouseup']
|
365
|
+
}], onMouseEnter: [{
|
366
|
+
type: HostListener,
|
367
|
+
args: ['mouseenter', ['$event']]
|
368
|
+
}], onMouseLeave: [{
|
369
|
+
type: HostListener,
|
370
|
+
args: ['mouseleave', ['$event']]
|
371
|
+
}] } });
|
372
|
+
|
257
373
|
// @dynamic
|
258
374
|
class AXStringUtil {
|
259
375
|
static getWordBoundsAtPosition(str, position) {
|
@@ -273,9 +389,23 @@ class AXStringUtil {
|
|
273
389
|
}
|
274
390
|
}
|
275
391
|
|
392
|
+
class UtilsModule {
|
393
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: UtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
394
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: UtilsModule, declarations: [AXResizableDirective], imports: [CommonModule], exports: [AXResizableDirective] }); }
|
395
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: UtilsModule, imports: [CommonModule] }); }
|
396
|
+
}
|
397
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: UtilsModule, decorators: [{
|
398
|
+
type: NgModule,
|
399
|
+
args: [{
|
400
|
+
declarations: [AXResizableDirective],
|
401
|
+
imports: [CommonModule],
|
402
|
+
exports: [AXResizableDirective],
|
403
|
+
}]
|
404
|
+
}] });
|
405
|
+
|
276
406
|
/**
|
277
407
|
* Generated bundle index. Do not edit.
|
278
408
|
*/
|
279
409
|
|
280
|
-
export { AXAutoUnsubscriber, AXColorUtil, AXDrawingUtil, AXHtmlUtil, AXStringUtil, AXUnsubscriber };
|
410
|
+
export { AXAutoUnsubscriber, AXColorUtil, AXDrawingUtil, AXHtmlUtil, AXResizableDirective, AXStringUtil, AXUnsubscriber, UtilsModule };
|
281
411
|
//# sourceMappingURL=acorex-core-utils.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-utils.mjs","sources":["../../../../libs/core/utils/src/lib/auto-unsubscribe.ts","../../../../libs/core/utils/src/lib/color-util.ts","../../../../libs/core/utils/src/lib/drawing-util.ts","../../../../libs/core/utils/src/lib/html-util.ts","../../../../libs/core/utils/src/lib/string-util.ts","../../../../libs/core/utils/src/acorex-core-utils.ts"],"sourcesContent":["import { Injectable, OnDestroy } from '@angular/core';\nimport { Observable, Subject, takeUntil } from 'rxjs';\n\nexport function AXAutoUnsubscriber() {\n return function (constructor) {\n const orig = constructor.prototype.ngOnDestroy;\n constructor.prototype.ngOnDestroy = function () {\n for (const prop in this) {\n const property = this[prop];\n if (typeof property.subscribe === 'function') {\n property.unsubscribe();\n }\n }\n orig.apply();\n };\n };\n}\n\n@Injectable()\nexport class AXUnsubscriber implements OnDestroy {\n private readonly _destroy$ = new Subject<void>();\n\n public readonly takeUntilDestroy = <T>(origin: Observable<T> | Subject<T>): Observable<T> | Subject<T> =>\n origin.pipe(takeUntil(this._destroy$));\n\n public unsubscribe(): void {\n this._destroy$.next();\n this._destroy$.complete();\n }\n\n public ngOnDestroy(): void {\n this.unsubscribe();\n }\n}\n","export type AXColorMode = 'rgba' | 'hex' | 'hsla' | 'hsva' | null;\n\nimport tinycolor, { ColorInput } from 'tinycolor2';\nimport tinygradient, { Instance } from 'tinygradient-es';\n\nexport type AXColorFormat = ColorInput;\n\nexport class AXColorUtil {\n static to(color: AXColorFormat, mode: AXColorMode): AXColorFormat {\n const _color = tinycolor(color);\n switch (mode) {\n case 'rgba':\n return _color.toRgb();\n case 'hsla':\n return _color.toHsl();\n case 'hsva':\n return _color.toHsv();\n default:\n return _color.toHex();\n }\n }\n\n static toString(color: AXColorFormat, mode: AXColorMode = null): string {\n const _color = tinycolor(color);\n switch (mode) {\n case 'rgba':\n return _color.toRgbString();\n case 'hsla':\n return _color.toHslString();\n case 'hsva':\n return _color.toHsvString();\n\n case 'hex': {\n const rgba = _color.toRgb();\n return rgba.a != 1 ? _color.toHex8String() : _color.toHexString();\n }\n default: {\n if (typeof color == 'string') {\n if (color.toLowerCase().startsWith('#')) return this.toString(color, 'hex');\n else return this.toString(color, 'rgba');\n } else {\n return this.toString(color, 'rgba');\n }\n }\n }\n }\n\n static isValid(color: AXColorFormat): boolean {\n const _color = tinycolor(color);\n return _color.isValid();\n }\n\n static mix(baseColor: AXColorFormat, hex: AXColorFormat, percentage: number): string {\n return tinycolor.mix(baseColor, hex, percentage).toString('rgb');\n }\n\n static multiply(color1: AXColorFormat, color2: AXColorFormat): string {\n const rgb1 = tinycolor(color1).toRgb();\n const rgb2 = tinycolor(color2).toRgb();\n rgb1.b = Math.floor((rgb1.b * rgb2.b) / 255);\n rgb1.g = Math.floor((rgb1.g * rgb2.g) / 255);\n rgb1.r = Math.floor((rgb1.r * rgb2.r) / 255);\n return tinycolor('rgb ' + rgb1.r + ' ' + rgb1.g + ' ' + rgb1.b).toString('rgb');\n }\n\n static contrastToWhite(color: AXColorFormat): number {\n return tinycolor.readability('#fff', color);\n }\n\n static lighten(hex: AXColorFormat, percentage?: number) {\n return tinycolor(hex).lighten(percentage);\n }\n\n static darken(hex: AXColorFormat, percentage?: number) {\n return tinycolor(hex).darken(percentage);\n }\n\n static brighten(hex: AXColorFormat, percentage?: number) {\n return tinycolor(hex).brighten(percentage);\n }\n\n static saturate(hex: AXColorFormat, percentage?: number) {\n return tinycolor(hex).saturate(percentage);\n }\n\n static desaturate(hex: AXColorFormat) {\n return tinycolor(hex).getLuminance();\n }\n\n static equal(color1: AXColorFormat, color2: AXColorFormat): boolean {\n return tinycolor.equals(color1, color2);\n }\n\n static gradient(values: unknown[] | { color: unknown; pos: number }[]): Instance {\n return tinygradient([...values]);\n }\n\n static getLuminance(hex: AXColorFormat) {\n return tinycolor(hex).getLuminance();\n }\n\n static xyToRgb(vX, vY): string {\n vY = vY || 0.00000000001;\n const Y = 1;\n const X = (Y / vY) * vX;\n const Z = (Y / vY) * (1 - vX - vY);\n\n // Convert to RGB using Wide RGB D65 conversion.\n let rgb = [\n X * 1.656492 - Y * 0.354851 - Z * 0.255038,\n -X * 0.707196 + Y * 1.655397 + Z * 0.036152,\n X * 0.051713 - Y * 0.121364 + Z * 1.01153,\n ];\n\n // Apply reverse gamma correction.\n rgb = rgb.map((x) => (x <= 0.0031308 ? 12.92 * x : (1.0 + 0.055) * Math.pow(x, 1.0 / 2.4) - 0.055));\n\n // Bring all negative components to zero.\n rgb = rgb.map((x) => Math.max(0, x));\n\n // If one component is greater than 1, weight components by that value.\n const max = Math.max(...rgb);\n if (max > 1) {\n rgb = rgb.map((x) => x / max);\n }\n\n rgb = rgb.map((x) => Math.round(x * 255));\n\n return 'rgb(' + rgb.join(',') + ')';\n }\n\n static colorStringToHex(color) {\n // Check if the input is an RGBA color string\n const rgbaMatch = color.match(/^rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*([\\d.]+))?\\s*\\)$/i);\n if (rgbaMatch) {\n let [_, r, g, b, a] = rgbaMatch;\n r = parseInt(r, 10);\n g = parseInt(g, 10);\n b = parseInt(b, 10);\n a = a ? parseFloat(a) : 1;\n\n // Convert RGB to hex\n let hexColor = `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`;\n\n // Include alpha if present\n if (a < 1) {\n const alphaHex = Math.round(a * 255)\n .toString(16)\n .padStart(2, '0');\n hexColor += alphaHex;\n }\n\n return hexColor;\n }\n\n // Check if the input is a hex color string\n const hexMatch = color.match(/^#([0-9a-fA-F]{3}){1,2}$/);\n if (hexMatch) {\n return color;\n }\n\n throw new Error('Invalid color format');\n }\n}\n","export interface AXPoint {\n x: number;\n y: number;\n}\n\nexport interface AXBoundingClientRect {\n left?: number;\n top?: number;\n width?: number;\n height?: number;\n bottom?: number;\n right?: number;\n}\n// @dynamic\nexport class AXDrawingUtil {\n static collision(a: HTMLElement, b: HTMLElement): boolean {\n const ac = a.getBoundingClientRect();\n const bc = b.getBoundingClientRect();\n\n if (ac.left < bc.left + bc.width && ac.left + ac.width > bc.left && ac.top < bc.top + bc.height && ac.top + ac.height > bc.top) {\n return true;\n } else {\n return false;\n }\n }\n\n static isInElementBound(pos: AXPoint, element: HTMLElement): boolean {\n const elBound = element.getBoundingClientRect();\n return AXDrawingUtil.isInRecPoint(pos, {\n left: elBound.x,\n width: elBound.width,\n top: elBound.y,\n height: elBound.height,\n });\n }\n\n static isInRecPoint(pos: AXPoint, rec: AXBoundingClientRect | any): boolean {\n return pos.x >= rec.left && pos.x <= rec.left + rec.width && pos.y >= rec.top && pos.y <= rec.top + rec.height;\n }\n\n static convertRemToPixels(rem: number): number {\n return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\n\n// @dynamic\nexport class AXHtmlUtil {\n\n static focusElement(element: HTMLElement): HTMLElement {\n const list = ['button', 'input', '[href]', 'select', 'textarea', '[tabindex]'].map((c) => c + ':not([tabindex=\"-1\"])');\n const focusable = element.querySelector<HTMLElement>(list.join(', '));\n if (focusable) {\n focusable.focus();\n return focusable;\n }\n return null;\n }\n\n static blurElement(element: HTMLElement): HTMLElement {\n const list = ['button', 'input', '[href]', 'select', 'textarea', '[tabindex]'].map((c) => c + ':not([tabindex=\"-1\"])');\n const focusable = element.querySelector<HTMLElement>(list.join(', '));\n if (focusable) {\n focusable.blur();\n return focusable;\n }\n return null;\n }\n\n static hasFocus(element: HTMLElement) {\n return element.matches(':focus-within') || element.matches(':focus');\n }\n\n static isRtl(element: HTMLElement) {\n if (isBrowser()) {\n const rtl = element.classList.contains('ax-rtl') || window.getComputedStyle(element, null).getPropertyValue('direction') === 'rtl';\n return rtl;\n }\n\n return false;\n }\n\n /**\n * Helper function to check if an element is scrollable\n */\n static isScrollable(element: HTMLElement): boolean {\n const overflowY = window.getComputedStyle(element).overflowY;\n return (overflowY === 'auto' || overflowY === 'scroll') && element.scrollHeight > element.clientHeight;\n }\n\n /**\n * Utility function to find scrollable parent elements\n */\n static getScrollableParents(element: HTMLElement): HTMLElement[] {\n const parents: HTMLElement[] = [];\n let currentElement: HTMLElement | null = element;\n\n while (currentElement) {\n if (AXHtmlUtil.isScrollable(currentElement)) {\n parents.push(currentElement);\n }\n currentElement = currentElement.parentElement;\n }\n\n return parents;\n }\n}\n","// @dynamic\nexport class AXStringUtil {\n static getWordBoundsAtPosition(str: string, position: number): { start: number; end: number } {\n const isSpace = (c) => /[^a-zA-Z0-9]+/i.test(c);\n let start = position - 1;\n\n while (start >= 0 && !isSpace(str[start])) {\n start -= 1;\n }\n start = Math.max(0, start + 1);\n const leftSideString: any = str.slice(start).match(/[a-zA-Z0-9]+/i);\n start += leftSideString.index;\n let end = start + leftSideString[0].length;\n return {\n start,\n end,\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;SAGgB,kBAAkB,GAAA;AAChC,IAAA,OAAO,UAAU,WAAW,EAAA;AAC1B,QAAA,MAAM,IAAI,GAAG,WAAW,CAAC,SAAS,CAAC,WAAW;AAC9C,QAAA,WAAW,CAAC,SAAS,CAAC,WAAW,GAAG,YAAA;AAClC,YAAA,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;AACvB,gBAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;AAC3B,gBAAA,IAAI,OAAO,QAAQ,CAAC,SAAS,KAAK,UAAU,EAAE;oBAC5C,QAAQ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AExB,QAAA,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;YACzC,KAAK,IAAI,CAAC;;QAEZ,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;AAC9B,QAAA,MAAM,cAAc,GAAQ,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;AACnE,QAAA,KAAK,IAAI,cAAc,CAAC,KAAK;QAC7B,IAAI,GAAG,GAAG,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM;QAC1C,OAAO;YACL,KAAK;YACL,GAAG;SACJ;;AAEJ;;AClBD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-core-utils.mjs","sources":["../../../../libs/core/utils/src/lib/auto-unsubscribe.ts","../../../../libs/core/utils/src/lib/color-util.ts","../../../../libs/core/utils/src/lib/drawing-util.ts","../../../../libs/core/utils/src/lib/html-util.ts","../../../../libs/core/utils/src/lib/resize.directive.ts","../../../../libs/core/utils/src/lib/string-util.ts","../../../../libs/core/utils/src/lib/utils.module.ts","../../../../libs/core/utils/src/acorex-core-utils.ts"],"sourcesContent":["import { Injectable, OnDestroy } from '@angular/core';\nimport { Observable, Subject, takeUntil } from 'rxjs';\n\nexport function AXAutoUnsubscriber() {\n return function (constructor) {\n const orig = constructor.prototype.ngOnDestroy;\n constructor.prototype.ngOnDestroy = function () {\n for (const prop in this) {\n const property = this[prop];\n if (typeof property.subscribe === 'function') {\n property.unsubscribe();\n }\n }\n orig.apply();\n };\n };\n}\n\n@Injectable()\nexport class AXUnsubscriber implements OnDestroy {\n private readonly _destroy$ = new Subject<void>();\n\n public readonly takeUntilDestroy = <T>(origin: Observable<T> | Subject<T>): Observable<T> | Subject<T> =>\n origin.pipe(takeUntil(this._destroy$));\n\n public unsubscribe(): void {\n this._destroy$.next();\n this._destroy$.complete();\n }\n\n public ngOnDestroy(): void {\n this.unsubscribe();\n }\n}\n","export type AXColorMode = 'rgba' | 'hex' | 'hsla' | 'hsva' | null;\n\nimport tinycolor, { ColorInput } from 'tinycolor2';\nimport tinygradient, { Instance } from 'tinygradient-es';\n\nexport type AXColorFormat = ColorInput;\n\nexport class AXColorUtil {\n static to(color: AXColorFormat, mode: AXColorMode): AXColorFormat {\n const _color = tinycolor(color);\n switch (mode) {\n case 'rgba':\n return _color.toRgb();\n case 'hsla':\n return _color.toHsl();\n case 'hsva':\n return _color.toHsv();\n default:\n return _color.toHex();\n }\n }\n\n static toString(color: AXColorFormat, mode: AXColorMode = null): string {\n const _color = tinycolor(color);\n switch (mode) {\n case 'rgba':\n return _color.toRgbString();\n case 'hsla':\n return _color.toHslString();\n case 'hsva':\n return _color.toHsvString();\n\n case 'hex': {\n const rgba = _color.toRgb();\n return rgba.a != 1 ? _color.toHex8String() : _color.toHexString();\n }\n default: {\n if (typeof color == 'string') {\n if (color.toLowerCase().startsWith('#')) return this.toString(color, 'hex');\n else return this.toString(color, 'rgba');\n } else {\n return this.toString(color, 'rgba');\n }\n }\n }\n }\n\n static isValid(color: AXColorFormat): boolean {\n const _color = tinycolor(color);\n return _color.isValid();\n }\n\n static mix(baseColor: AXColorFormat, hex: AXColorFormat, percentage: number): string {\n return tinycolor.mix(baseColor, hex, percentage).toString('rgb');\n }\n\n static multiply(color1: AXColorFormat, color2: AXColorFormat): string {\n const rgb1 = tinycolor(color1).toRgb();\n const rgb2 = tinycolor(color2).toRgb();\n rgb1.b = Math.floor((rgb1.b * rgb2.b) / 255);\n rgb1.g = Math.floor((rgb1.g * rgb2.g) / 255);\n rgb1.r = Math.floor((rgb1.r * rgb2.r) / 255);\n return tinycolor('rgb ' + rgb1.r + ' ' + rgb1.g + ' ' + rgb1.b).toString('rgb');\n }\n\n static contrastToWhite(color: AXColorFormat): number {\n return tinycolor.readability('#fff', color);\n }\n\n static lighten(hex: AXColorFormat, percentage?: number) {\n return tinycolor(hex).lighten(percentage);\n }\n\n static darken(hex: AXColorFormat, percentage?: number) {\n return tinycolor(hex).darken(percentage);\n }\n\n static brighten(hex: AXColorFormat, percentage?: number) {\n return tinycolor(hex).brighten(percentage);\n }\n\n static saturate(hex: AXColorFormat, percentage?: number) {\n return tinycolor(hex).saturate(percentage);\n }\n\n static desaturate(hex: AXColorFormat) {\n return tinycolor(hex).getLuminance();\n }\n\n static equal(color1: AXColorFormat, color2: AXColorFormat): boolean {\n return tinycolor.equals(color1, color2);\n }\n\n static gradient(values: unknown[] | { color: unknown; pos: number }[]): Instance {\n return tinygradient([...values]);\n }\n\n static getLuminance(hex: AXColorFormat) {\n return tinycolor(hex).getLuminance();\n }\n\n static xyToRgb(vX, vY): string {\n vY = vY || 0.00000000001;\n const Y = 1;\n const X = (Y / vY) * vX;\n const Z = (Y / vY) * (1 - vX - vY);\n\n // Convert to RGB using Wide RGB D65 conversion.\n let rgb = [\n X * 1.656492 - Y * 0.354851 - Z * 0.255038,\n -X * 0.707196 + Y * 1.655397 + Z * 0.036152,\n X * 0.051713 - Y * 0.121364 + Z * 1.01153,\n ];\n\n // Apply reverse gamma correction.\n rgb = rgb.map((x) => (x <= 0.0031308 ? 12.92 * x : (1.0 + 0.055) * Math.pow(x, 1.0 / 2.4) - 0.055));\n\n // Bring all negative components to zero.\n rgb = rgb.map((x) => Math.max(0, x));\n\n // If one component is greater than 1, weight components by that value.\n const max = Math.max(...rgb);\n if (max > 1) {\n rgb = rgb.map((x) => x / max);\n }\n\n rgb = rgb.map((x) => Math.round(x * 255));\n\n return 'rgb(' + rgb.join(',') + ')';\n }\n\n static colorStringToHex(color) {\n // Check if the input is an RGBA color string\n const rgbaMatch = color.match(/^rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*([\\d.]+))?\\s*\\)$/i);\n if (rgbaMatch) {\n let [_, r, g, b, a] = rgbaMatch;\n r = parseInt(r, 10);\n g = parseInt(g, 10);\n b = parseInt(b, 10);\n a = a ? parseFloat(a) : 1;\n\n // Convert RGB to hex\n let hexColor = `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`;\n\n // Include alpha if present\n if (a < 1) {\n const alphaHex = Math.round(a * 255)\n .toString(16)\n .padStart(2, '0');\n hexColor += alphaHex;\n }\n\n return hexColor;\n }\n\n // Check if the input is a hex color string\n const hexMatch = color.match(/^#([0-9a-fA-F]{3}){1,2}$/);\n if (hexMatch) {\n return color;\n }\n\n throw new Error('Invalid color format');\n }\n}\n","export interface AXPoint {\n x: number;\n y: number;\n}\n\nexport interface AXBoundingClientRect {\n left?: number;\n top?: number;\n width?: number;\n height?: number;\n bottom?: number;\n right?: number;\n}\n// @dynamic\nexport class AXDrawingUtil {\n static collision(a: HTMLElement, b: HTMLElement): boolean {\n const ac = a.getBoundingClientRect();\n const bc = b.getBoundingClientRect();\n\n if (ac.left < bc.left + bc.width && ac.left + ac.width > bc.left && ac.top < bc.top + bc.height && ac.top + ac.height > bc.top) {\n return true;\n } else {\n return false;\n }\n }\n\n static isInElementBound(pos: AXPoint, element: HTMLElement): boolean {\n const elBound = element.getBoundingClientRect();\n return AXDrawingUtil.isInRecPoint(pos, {\n left: elBound.x,\n width: elBound.width,\n top: elBound.y,\n height: elBound.height,\n });\n }\n\n static isInRecPoint(pos: AXPoint, rec: AXBoundingClientRect | any): boolean {\n return pos.x >= rec.left && pos.x <= rec.left + rec.width && pos.y >= rec.top && pos.y <= rec.top + rec.height;\n }\n\n static convertRemToPixels(rem: number): number {\n return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\n\n// @dynamic\nexport class AXHtmlUtil {\n\n static focusElement(element: HTMLElement): HTMLElement {\n const list = ['button', 'input', '[href]', 'select', 'textarea', '[tabindex]'].map((c) => c + ':not([tabindex=\"-1\"])');\n const focusable = element.querySelector<HTMLElement>(list.join(', '));\n if (focusable) {\n focusable.focus();\n return focusable;\n }\n return null;\n }\n\n static blurElement(element: HTMLElement): HTMLElement {\n const list = ['button', 'input', '[href]', 'select', 'textarea', '[tabindex]'].map((c) => c + ':not([tabindex=\"-1\"])');\n const focusable = element.querySelector<HTMLElement>(list.join(', '));\n if (focusable) {\n focusable.blur();\n return focusable;\n }\n return null;\n }\n\n static hasFocus(element: HTMLElement) {\n return element.matches(':focus-within') || element.matches(':focus');\n }\n\n static isRtl(element: HTMLElement) {\n if (isBrowser()) {\n const rtl = element.classList.contains('ax-rtl') || window.getComputedStyle(element, null).getPropertyValue('direction') === 'rtl';\n return rtl;\n }\n\n return false;\n }\n\n /**\n * Helper function to check if an element is scrollable\n */\n static isScrollable(element: HTMLElement): boolean {\n const overflowY = window.getComputedStyle(element).overflowY;\n return (overflowY === 'auto' || overflowY === 'scroll') && element.scrollHeight > element.clientHeight;\n }\n\n /**\n * Utility function to find scrollable parent elements\n */\n static getScrollableParents(element: HTMLElement): HTMLElement[] {\n const parents: HTMLElement[] = [];\n let currentElement: HTMLElement | null = element;\n\n while (currentElement) {\n if (AXHtmlUtil.isScrollable(currentElement)) {\n parents.push(currentElement);\n }\n currentElement = currentElement.parentElement;\n }\n\n return parents;\n }\n}\n","import { Directive, ElementRef, HostListener, Input, NgZone, Renderer2 } from '@angular/core';\n\n@Directive({\n selector: '[axResizable]', // Apply this directive on any element like <div axResizable></div>\n})\nexport class AXResizableDirective {\n @Input() minWidth = 100; // Minimum width for the resizable element\n private isResizing = false;\n private resizeHandle: HTMLElement;\n\n constructor(\n private el: ElementRef,\n private renderer: Renderer2,\n private zone: NgZone,\n ) {\n this.createResizeHandle(); // Initialize the resize handle\n }\n\n // Create the resize handle element and apply inline styles\n private createResizeHandle(): void {\n // Apply position relative to the container to allow the absolute positioning of the handle\n this.renderer.setStyle(this.el.nativeElement, 'position', 'relative');\n\n // Create the resize handle dynamically\n this.resizeHandle = this.renderer.createElement('div');\n this.renderer.addClass(this.resizeHandle, 'resize-handle');\n this.renderer.appendChild(this.el.nativeElement, this.resizeHandle);\n\n // Apply inline styles for the resize handle\n this.renderer.setStyle(this.resizeHandle, 'width', '6px'); // Resize handle width\n this.renderer.setStyle(this.resizeHandle, 'background-color', 'rgba(0, 0, 0, 0.2)');\n this.renderer.setStyle(this.resizeHandle, 'position', 'absolute');\n this.renderer.setStyle(this.resizeHandle, 'top', '0');\n this.renderer.setStyle(this.resizeHandle, 'right', '0');\n this.renderer.setStyle(this.resizeHandle, 'bottom', '0');\n this.renderer.setStyle(this.resizeHandle, 'cursor', 'ew-resize'); // Horizontal resize cursor\n this.renderer.setStyle(this.resizeHandle, 'z-index', '10');\n this.renderer.setStyle(this.resizeHandle, 'transition', 'background-color 0.2s ease');\n this.renderer.setStyle(this.resizeHandle, 'border-radius', '4px');\n }\n\n // Mouse down event: Start resizing\n @HostListener('mousedown', ['$event'])\n onMouseDown(event: MouseEvent): void {\n // Only allow resizing when clicking on the handle\n const handleRect = this.resizeHandle.getBoundingClientRect();\n if (event.clientX >= handleRect.left && event.clientX <= handleRect.right) {\n this.zone.runOutsideAngular(() => {\n this.isResizing = true;\n document.body.style.cursor = 'ew-resize'; // Change cursor to resize mode\n // Change resize handle color to blue when resizing starts\n this.renderer.setStyle(this.resizeHandle, 'background-color', '#007bff');\n event.preventDefault();\n });\n }\n }\n\n // Mouse move event: Resize the element\n @HostListener('document:mousemove', ['$event'])\n onMouseMove(event: MouseEvent): void {\n this.zone.runOutsideAngular(() => {\n if (this.isResizing) {\n const rect = this.el.nativeElement.getBoundingClientRect();\n let newWidth: number;\n\n // Resize logic (LTR or RTL support)\n if (document.documentElement.dir === 'rtl') {\n newWidth = rect.right - event.clientX;\n } else {\n newWidth = event.clientX - rect.left;\n }\n\n // Ensure the width does not go below the minimum width\n if (newWidth > this.minWidth) {\n this.renderer.setStyle(this.el.nativeElement, 'width', `${newWidth}px`);\n }\n }\n });\n }\n\n // Mouse up event: End resizing\n @HostListener('document:mouseup')\n onMouseUp(): void {\n this.zone.runOutsideAngular(() => {\n if (this.isResizing) {\n this.isResizing = false;\n document.body.style.cursor = 'default'; // Reset the cursor\n // Reset the resize handle color to default when resizing ends\n this.renderer.setStyle(this.resizeHandle, 'background-color', 'rgba(0, 0, 0, 0.2)');\n }\n });\n }\n\n // Mouse enter event to change the background color (hover effect)\n @HostListener('mouseenter', ['$event'])\n onMouseEnter(): void {\n // Only change color to blue if not resizing\n if (!this.isResizing) {\n this.renderer.setStyle(this.resizeHandle, 'background-color', '#007bff'); // Blue color on hover\n }\n }\n\n // Mouse leave event to reset the background color\n @HostListener('mouseleave', ['$event'])\n onMouseLeave(): void {\n // Only reset to default color if not resizing\n if (!this.isResizing) {\n this.renderer.setStyle(this.resizeHandle, 'background-color', 'rgba(0, 0, 0, 0.2)'); // Default background color\n }\n }\n}\n","// @dynamic\nexport class AXStringUtil {\n static getWordBoundsAtPosition(str: string, position: number): { start: number; end: number } {\n const isSpace = (c) => /[^a-zA-Z0-9]+/i.test(c);\n let start = position - 1;\n\n while (start >= 0 && !isSpace(str[start])) {\n start -= 1;\n }\n start = Math.max(0, start + 1);\n const leftSideString: any = str.slice(start).match(/[a-zA-Z0-9]+/i);\n start += leftSideString.index;\n let end = start + leftSideString[0].length;\n return {\n start,\n end,\n };\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXResizableDirective } from './resize.directive';\n\n@NgModule({\n declarations: [AXResizableDirective],\n imports: [CommonModule],\n exports: [AXResizableDirective],\n})\nexport class UtilsModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;SAGgB,kBAAkB,GAAA;AAChC,IAAA,OAAO,UAAU,WAAW,EAAA;AAC1B,QAAA,MAAM,IAAI,GAAG,WAAW,CAAC,SAAS,CAAC,WAAW;AAC9C,QAAA,WAAW,CAAC,SAAS,CAAC,WAAW,GAAG,YAAA;AAClC,YAAA,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;AACvB,gBAAA,MAAM,QAAQ,GAA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
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Injectable, inject, InjectionToken, Injector,
|
2
|
+
import { Injectable, inject, InjectionToken, Injector, Inject, NgModule } from '@angular/core';
|
3
3
|
import * as i1 from '@acorex/core/translation';
|
4
4
|
import { AXTranslationService } from '@acorex/core/translation';
|
5
|
-
import { isString, isEmpty, isNull, isUndefined, isNumber, isArray,
|
5
|
+
import { isString, isEmpty, find, isBoolean, isNull, isUndefined, isNumber, isArray, 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,
|