@acorex/core 18.2.0 → 18.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/file/lib/file.service.mjs +1 -1
- package/esm2022/format/lib/formatters/string-formatter.mjs +6 -4
- package/esm2022/storage/local-storage.service.mjs +2 -2
- package/fesm2022/acorex-core-file.mjs.map +1 -1
- package/fesm2022/acorex-core-format.mjs +5 -3
- package/fesm2022/acorex-core-format.mjs.map +1 -1
- package/fesm2022/acorex-core-storage.mjs +1 -1
- package/fesm2022/acorex-core-storage.mjs.map +1 -1
- package/fesm2022/acorex-core-validation.mjs.map +1 -1
- package/package.json +2 -2
@@ -139,4 +139,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
139
139
|
providedIn: 'root',
|
140
140
|
}]
|
141
141
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
142
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL2ZpbGUvc3JjL2xpYi9maWxlLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxXQUFXLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUMvRCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRTNDLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQzlELE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBQ3BFLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQzs7O0FBSzFELE1BQU0sT0FBTyxhQUFhO0lBQ3hCLFlBQW9CLFdBQXVCO1FBQXZCLGdC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Bpc0Jhc2U2NChiYXNlNjQ6IHN0cmluZykge1xuICAgIGNvbnN0IHJlZ3ggPSAvW146XVxcdytcXC9bXFx3LStcXGQuXSsoPz07fCwpLztcbiAgICByZXR1cm4gcmVneC50ZXN0KGJhc2U2NCk7XG4gIH1cblxuICBwdWJsaWMgZ2V0QmFzZTY0U2l6ZShiYXNlNjQ6IHN0cmluZykge1xuICAgIHJldHVybiBhdG9iKGJhc2U2NC5zdWJzdHJpbmcoYmFzZTY0LmluZGV4T2YoJywnKSArIDEpKS5sZW5ndGg7XG4gIH1cbn1cbiJdfQ==
|
@@ -6,10 +6,12 @@ export class AXStringFormatter {
|
|
6
6
|
format(value, options) {
|
7
7
|
if (typeof value != 'string')
|
8
8
|
return String(value);
|
9
|
-
const result =
|
10
|
-
|
11
|
-
|
9
|
+
const result = get(options, value)
|
10
|
+
? get(options, value)
|
11
|
+
: value.replace(/{{\s*([^}]+)\s*}}/g, (match, path) => {
|
12
|
+
return get(options, path.trim()) ?? match;
|
13
|
+
});
|
12
14
|
return result;
|
13
15
|
}
|
14
16
|
}
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5nLWZvcm1hdHRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS9mb3JtYXQvc3JjL2xpYi9mb3JtYXR0ZXJzL3N0cmluZy1mb3JtYXR0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLFdBQVcsQ0FBQztBQWNoQyxNQUFNLE9BQU8saUJBQWlCO0lBQzVCLElBQUksSUFBSTtRQUNOLE9BQU8sUUFBUSxDQUFDO0lBQ2xCLENBQUM7SUFFRCxNQUFNLENBQUMsS0FBYyxFQUFFLE9BQWlDO1FB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ZXIge1xuICBnZXQgbmFtZSgpOiBzdHJpbmcge1xuICAgIHJldHVybiAnc3RyaW5nJztcbiAgfVxuXG4gIGZvcm1hdCh2YWx1ZTogdW5rbm93biwgb3B0aW9uczogQVhTdHJpbmdGb3JtYXR0ZXJPcHRpb25zKTogc3RyaW5nIHtcbiAgICBpZiAodHlwZW9mIHZhbHVlICE9ICdzdHJpbmcnKSByZXR1cm4gU3RyaW5nKHZhbHVlKTtcbiAgICBjb25zdCByZXN1bHQgPSBnZXQob3B0aW9ucywgdmFsdWUpXG4gICAgICA/IGdldChvcHRpb25zLCB2YWx1ZSlcbiAgICAgIDogdmFsdWUucmVwbGFjZSgve3tcXHMqKFtefV0rKVxccyp9fS9nLCAobWF0Y2gsIHBhdGg6IHN0cmluZykgPT4ge1xuICAgICAgICAgIHJldHVybiAoZ2V0KG9wdGlvbnMsIHBhdGgudHJpbSgpKSBhcyBzdHJpbmcpID8/IG1hdGNoO1xuICAgICAgICB9KTtcblxuICAgIHJldHVybiByZXN1bHQ7XG4gIH1cbn1cbiJdfQ==
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { isBrowser } from '@acorex/core/platform';
|
2
2
|
import { Inject, Injectable, InjectionToken } from '@angular/core';
|
3
|
-
import
|
3
|
+
import CryptoJS from 'crypto-es';
|
4
4
|
import * as i0 from "@angular/core";
|
5
5
|
export const AX_LOCALSTORAGE_SECRET_KEY = new InjectionToken('AX_LOCALSTORAGE_SECRET_KEY');
|
6
6
|
export class AXLocalStorageService {
|
@@ -56,4 +56,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
56
56
|
type: Inject,
|
57
57
|
args: [AX_LOCALSTORAGE_SECRET_KEY]
|
58
58
|
}] }] });
|
59
|
-
//# sourceMappingURL=data:application/json;base64,
|
59
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtc3RvcmFnZS5zZXJ2aWNlLmp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IGNvbnN0IGVuY3J5cHRlZCA9IGxvY2FsU3RvcmFnZS5nZXRJdGVtKGtleSkgfHwgJyc7XG4gICAgICBjb25zdCBkZWNyeXB0ZWQgPSBDcnlwdG9KUy5BRVMuZGVjcnlwdChlbmNyeXB0ZWQsIHRoaXMuc2VjcmV0X2tleSkudG9TdHJpbmcoQ3J5cHRvSlMuZW5jLlV0ZjgpO1xuICAgICAgcmV0dXJuIGVuY3J5cHRlZCA/IEpTT04ucGFyc2UoZGVjcnlwdGVkKSA6IHt9O1xuICAgIH0gZWxzZSB7XG4gICAgICByZXR1cm4gbnVsbDtcbiAgICB9XG4gIH1cbn1cbiJdfQ==
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-file.mjs","sources":["../../../../libs/core/file/src/lib/file-size-formatter.ts","../../../../libs/core/file/src/lib/file-download-ref.class.ts","../../../../libs/core/file/src/lib/file-download-result.class.ts","../../../../libs/core/file/src/lib/file-upload-ref.class.ts","../../../../libs/core/file/src/lib/file.service.ts","../../../../libs/core/file/src/lib/file.module.ts","../../../../libs/core/file/src/acorex-core-file.ts"],"sourcesContent":["import { AXFormatOptions, AXFormatter } from '@acorex/core/format';\nimport { Injectable } from '@angular/core';\n\nexport interface AXFileSizeFormatterOptions extends AXFormatOptions {\n format: string;\n}\n\ndeclare module '@acorex/core/format' {\n interface AXFormatOptionsMap {\n filesize: AXFileSizeFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXFileSizeFormatter implements AXFormatter {\n get name(): string {\n return 'filesize';\n }\n\n format(value: number): string {\n const size = Number(value);\n\n if (size === 0) return '0 Bytes';\n if (Number.isNaN(size)) return 'Unknown';\n\n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const i = Math.floor(Math.log(size) / Math.log(k));\n\n return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n }\n}\n","import { AXFileDownloadResult } from './file-download-result.class';\n\nexport class AXFileDownloadRef extends Promise<AXFileDownloadResult> {\n public abortMethod: () => void;\n constructor(\n executor: (\n resolve: (value?: PromiseLike<AXFileDownloadResult>) => void,\n reject: (reason?: any) => void\n ) => void\n ) {\n super(executor as any);\n }\n //abort the operation\n public abort() {\n if (this.abortMethod) {\n this.abortMethod();\n }\n }\n}\n","export class AXFileDownloadResult {\n _response: Blob;\n\n constructor(response: Blob) {\n this._response = response;\n }\n\n save(filename?: string): Promise<void> {\n this._defaultBrowserDownload(filename);\n return Promise.resolve();\n // else {\n // return new Promise((resolve, reject) => {\n // const button = document.createElement(\"button\");\n // button.addEventListener('click', async () => {\n // button.remove();\n // const opts = {\n // types: [{\n // description: 'Save File',\n // suggestedName: filename\n // // accept: {'text/plain': ['.txt']},\n // }],\n // };\n // const result = await window['showSaveFilePicker'](opts);\n\n // resolve();\n // });\n // button.click();\n // });\n\n // }\n }\n\n blob() {\n return this._response;\n }\n\n base64(): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new window.FileReader();\n reader.onloadend = () => resolve(reader.result as string);\n reader.onerror = (e) => reject(e);\n reader.readAsDataURL(this._response);\n });\n }\n\n private _defaultBrowserDownload(filename = 'download') {\n const link = document.createElement('a');\n link.href = URL.createObjectURL(this._response);\n link.download = filename;\n link.click();\n }\n}\n","export class AXFileUploadRef<T = any> extends Promise<T> {\n public abortMethod: () => void;\n constructor(\n executor: (\n resolve: (value?: PromiseLike<T>) => void,\n reject: (reason?: any) => void\n ) => void\n ) {\n super(executor as any);\n }\n //abort the operation\n public abort() {\n if (this.abortMethod) {\n this.abortMethod();\n }\n }\n}\n","import { HttpClient, HttpRequest } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, Subscription } from 'rxjs';\nimport { AXFileDownloadRef } from './file-download-ref.class';\nimport { AXFileDownloadResult } from './file-download-result.class';\nimport { AXFileUploadRef } from './file-upload-ref.class';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFileService {\n constructor(private _httpClient: HttpClient) {}\n\n public download(request: string | Blob | HttpRequest<any>) {\n let s: Subscription;\n\n const promiseFunc = (resolve, reject) => {\n if (typeof request == 'string') {\n //\n }\n if (request instanceof Blob) {\n //\n }\n if (request instanceof HttpRequest) {\n const b = this._httpClient.request(request);\n b.subscribe({\n next: (v: any) => resolve(new AXFileDownloadResult(v)),\n error: (e) => reject(e),\n });\n }\n };\n\n const a = new AXFileDownloadRef(promiseFunc);\n a.abort = () => {\n s?.unsubscribe();\n };\n\n return a;\n\n // let s: Subscription;\n // const promiseFunc = (resolve, reject) => {\n // //TODO: add custome http request\n // //const headers = new HttpHeaders().set('authorization','Bearer '+token);\n // let b!: Observable<Blob>;\n // if (typeof request === 'string') {\n // b = this._httpClient.get(request, { responseType: 'blob' });\n // } else if (isObservable(b)) {\n // b = request;\n // }\n // s = b?.subscribe({\n // next: (v) => resolve(new AXFileDownloadResult(v)),\n // error: (e) => reject(e),\n // });\n // };\n\n // const a = new AXFileDownloadRef(promiseFunc);\n // a.abort = () => {\n // s?.unsubscribe();\n // };\n\n // return a;\n }\n\n public upload<T = any>(url: string, files: File[]): AXFileUploadRef<T> {\n let s: Subscription;\n const formData = new FormData();\n files.forEach((f) => {\n formData.append('files', f);\n });\n const promiseFunc = (resolve, reject) => {\n const b: Observable<T> = this._httpClient.post<T>(url, formData);\n s = b?.subscribe({\n next: (v) => resolve(v),\n error: (e) => reject(e),\n });\n };\n\n const a = new AXFileUploadRef(promiseFunc);\n a.abort = () => {\n s?.unsubscribe();\n };\n return a;\n }\n\n public choose(options?: { accept?: string; multiple?: boolean }): Promise<File[]> {\n return new Promise<File[]>((resolve, reject) => {\n options = Object.assign({ multiple: false }, options);\n const input: HTMLInputElement = document.createElement('input');\n input.style.display = 'none';\n document.body.appendChild(input);\n input.type = 'file';\n input.accept = options.accept || '';\n input.multiple = options.multiple || false;\n //\n const onError = (e) => {\n reject(e);\n document.body.removeChild(input);\n input.remove();\n input.removeEventListener('change', onChange);\n input.removeEventListener('error', onError);\n };\n //\n const onChange = () => {\n resolve(Array.from(input.files || []));\n document.body.removeChild(input);\n input.remove();\n input.removeEventListener('change', onChange);\n input.removeEventListener('error', onError);\n };\n //\n input.addEventListener('change', onChange);\n input.addEventListener('error', onError);\n input.click();\n });\n }\n\n public blobToBase64 = (blob: Blob) => {\n if (blob instanceof Blob) {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = reject;\n reader.onload = () => {\n resolve(reader.result as string);\n };\n reader.readAsDataURL(blob);\n });\n } else {\n return Promise.reject('input is not blob');\n }\n };\n public getSize(file: File | Blob | string) {\n if (this.isBase64(file as string)) {\n return this.getBase64Size(file as string);\n }\n return false;\n }\n\n public isBase64(base64: string) {\n const regx = /[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/;\n return regx.test(base64);\n }\n\n public getBase64Size(base64: string) {\n return atob(base64.substring(base64.indexOf(',') + 1)).length;\n }\n}\n","import { AXFormatModule } from '@acorex/core/format';\nimport { NgModule } from '@angular/core';\nimport { AXFileSizeFormatter } from './file-size-formatter';\n\n@NgModule({\n imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })],\n exports: [],\n declarations: [],\n providers: [AXFileSizeFormatter],\n})\nexport class AXFileModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;MAca,mBAAmB,CAAA;AAC9B,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,OAAO,UAAU,CAAC;KACnB;AAED,IAAA,MAAM,CAAC,KAAa,EAAA;AAClB,QAAA,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAE3B,IAAI,IAAI,KAAK,CAAC;AAAE,YAAA,OAAO,SAAS,CAAC;AACjC,QAAA,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;AAAE,YAAA,OAAO,SAAS,CAAC;QAEzC,MAAM,CAAC,GAAG,IAAI,CAAC;QACf,MAAM,KAAK,GAAG,C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QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,aAFZ,CAAC,mBAAmB,CAAC,EAAA,OAAA,EAAA,CAHtB,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAK7D,YAAY,EAAA,UAAA,EAAA,CAAA;kBANxB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;AACzE,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,YAAY,EAAE,EAAE;oBAChB,SAAS,EAAE,CAAC,mBAAmB,CAAC;AACjC,iBAAA,CAAA;;;ACTD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-core-file.mjs","sources":["../../../../libs/core/file/src/lib/file-size-formatter.ts","../../../../libs/core/file/src/lib/file-download-ref.class.ts","../../../../libs/core/file/src/lib/file-download-result.class.ts","../../../../libs/core/file/src/lib/file-upload-ref.class.ts","../../../../libs/core/file/src/lib/file.service.ts","../../../../libs/core/file/src/lib/file.module.ts","../../../../libs/core/file/src/acorex-core-file.ts"],"sourcesContent":["import { AXFormatOptions, AXFormatter } from '@acorex/core/format';\nimport { Injectable } from '@angular/core';\n\nexport interface AXFileSizeFormatterOptions extends AXFormatOptions {\n format: string;\n}\n\ndeclare module '@acorex/core/format' {\n interface AXFormatOptionsMap {\n filesize: AXFileSizeFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXFileSizeFormatter implements AXFormatter {\n get name(): string {\n return 'filesize';\n }\n\n format(value: number): string {\n const size = Number(value);\n\n if (size === 0) return '0 Bytes';\n if (Number.isNaN(size)) return 'Unknown';\n\n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const i = Math.floor(Math.log(size) / Math.log(k));\n\n return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n }\n}\n","import { AXFileDownloadResult } from './file-download-result.class';\n\nexport class AXFileDownloadRef extends Promise<AXFileDownloadResult> {\n public abortMethod: () => void;\n constructor(\n executor: (\n resolve: (value?: PromiseLike<AXFileDownloadResult>) => void,\n reject: (reason?: any) => void\n ) => void\n ) {\n super(executor as any);\n }\n //abort the operation\n public abort() {\n if (this.abortMethod) {\n this.abortMethod();\n }\n }\n}\n","export class AXFileDownloadResult {\n _response: Blob;\n\n constructor(response: Blob) {\n this._response = response;\n }\n\n save(filename?: string): Promise<void> {\n this._defaultBrowserDownload(filename);\n return Promise.resolve();\n // else {\n // return new Promise((resolve, reject) => {\n // const button = document.createElement(\"button\");\n // button.addEventListener('click', async () => {\n // button.remove();\n // const opts = {\n // types: [{\n // description: 'Save File',\n // suggestedName: filename\n // // accept: {'text/plain': ['.txt']},\n // }],\n // };\n // const result = await window['showSaveFilePicker'](opts);\n\n // resolve();\n // });\n // button.click();\n // });\n\n // }\n }\n\n blob() {\n return this._response;\n }\n\n base64(): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new window.FileReader();\n reader.onloadend = () => resolve(reader.result as string);\n reader.onerror = (e) => reject(e);\n reader.readAsDataURL(this._response);\n });\n }\n\n private _defaultBrowserDownload(filename = 'download') {\n const link = document.createElement('a');\n link.href = URL.createObjectURL(this._response);\n link.download = filename;\n link.click();\n }\n}\n","export class AXFileUploadRef<T = any> extends Promise<T> {\n public abortMethod: () => void;\n constructor(\n executor: (\n resolve: (value?: PromiseLike<T>) => void,\n reject: (reason?: any) => void\n ) => void\n ) {\n super(executor as any);\n }\n //abort the operation\n public abort() {\n if (this.abortMethod) {\n this.abortMethod();\n }\n }\n}\n","import { HttpClient, HttpRequest } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, Subscription } from 'rxjs';\nimport { AXFileDownloadRef } from './file-download-ref.class';\nimport { AXFileDownloadResult } from './file-download-result.class';\nimport { AXFileUploadRef } from './file-upload-ref.class';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFileService {\n constructor(private _httpClient: HttpClient) {}\n\n public download(request: string | Blob | HttpRequest<any>) {\n let s: Subscription;\n\n const promiseFunc = (resolve, reject) => {\n if (typeof request == 'string') {\n //\n }\n if (request instanceof Blob) {\n //\n }\n if (request instanceof HttpRequest) {\n const b = this._httpClient.request(request);\n b.subscribe({\n next: (v: any) => resolve(new AXFileDownloadResult(v)),\n error: (e) => reject(e),\n });\n }\n };\n\n const a = new AXFileDownloadRef(promiseFunc);\n a.abort = () => {\n s?.unsubscribe();\n };\n\n return a;\n\n // let s: Subscription;\n // const promiseFunc = (resolve, reject) => {\n // //TODO: add custome http request\n // //const headers = new HttpHeaders().set('authorization','Bearer '+token);\n // let b!: Observable<Blob>;\n // if (typeof request === 'string') {\n // b = this._httpClient.get(request, { responseType: 'blob' });\n // } else if (isObservable(b)) {\n // b = request;\n // }\n // s = b?.subscribe({\n // next: (v) => resolve(new AXFileDownloadResult(v)),\n // error: (e) => reject(e),\n // });\n // };\n\n // const a = new AXFileDownloadRef(promiseFunc);\n // a.abort = () => {\n // s?.unsubscribe();\n // };\n\n // return a;\n }\n\n public upload<T = any>(url: string, files: File[]): AXFileUploadRef<T> {\n let s: Subscription;\n const formData = new FormData();\n files.forEach((f) => {\n formData.append('files', f);\n });\n const promiseFunc = (resolve, reject) => {\n const b: Observable<T> = this._httpClient.post<T>(url, formData);\n s = b?.subscribe({\n next: (v) => resolve(v),\n error: (e) => reject(e),\n });\n };\n\n const a = new AXFileUploadRef(promiseFunc);\n a.abort = () => {\n s?.unsubscribe();\n };\n return a;\n }\n\n public choose(options?: { accept?: string; multiple?: boolean }): Promise<File[]> {\n return new Promise<File[]>((resolve, reject) => {\n options = Object.assign({ multiple: false }, options);\n const input: HTMLInputElement = document.createElement('input');\n input.style.display = 'none';\n document.body.appendChild(input);\n input.type = 'file';\n input.accept = options.accept || '';\n input.multiple = options.multiple || false;\n //\n const onError = (e) => {\n reject(e);\n document.body.removeChild(input);\n input.remove();\n input.removeEventListener('change', onChange);\n input.removeEventListener('error', onError);\n };\n //\n const onChange = () => {\n resolve(Array.from(input.files || []));\n document.body.removeChild(input);\n input.remove();\n input.removeEventListener('change', onChange);\n input.removeEventListener('error', onError);\n };\n //\n input.addEventListener('change', onChange);\n input.addEventListener('error', onError);\n input.click();\n });\n }\n\n public blobToBase64 = (blob: Blob) => {\n if (blob instanceof Blob) {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = reject;\n reader.onload = () => {\n resolve(reader.result as string);\n };\n reader.readAsDataURL(blob);\n });\n } else {\n return Promise.reject('input is not blob');\n }\n };\n\n public getSize(file: File | Blob | string) {\n if (this.isBase64(file as string)) {\n return this.getBase64Size(file as string);\n }\n return false;\n }\n\n public isBase64(base64: string) {\n const regx = /[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/;\n return regx.test(base64);\n }\n\n public getBase64Size(base64: string) {\n return atob(base64.substring(base64.indexOf(',') + 1)).length;\n }\n}\n","import { AXFormatModule } from '@acorex/core/format';\nimport { NgModule } from '@angular/core';\nimport { AXFileSizeFormatter } from './file-size-formatter';\n\n@NgModule({\n imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })],\n exports: [],\n declarations: [],\n providers: [AXFileSizeFormatter],\n})\nexport class AXFileModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;MAca,mBAAmB,CAAA;AAC9B,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,OAAO,UAAU,CAAC;KACnB;AAED,IAAA,MAAM,CAAC,KAAa,EAAA;AAClB,QAAA,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAE3B,IAAI,IAAI,KAAK,CAAC;AAAE,YAAA,OAAO,SAAS,CAAC;AACjC,QAAA,IAAI,MAAM,CAAC,KAA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A,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,aAFZ,CAAC,mBAAmB,CAAC,EAAA,OAAA,EAAA,CAHtB,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAK7D,YAAY,EAAA,UAAA,EAAA,CAAA;kBANxB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;AACzE,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,YAAY,EAAE,EAAE;oBAChB,SAAS,EAAE,CAAC,mBAAmB,CAAC;AACjC,iBAAA,CAAA;;;ACTD;;AAEG;;;;"}
|
@@ -207,9 +207,11 @@ class AXStringFormatter {
|
|
207
207
|
format(value, options) {
|
208
208
|
if (typeof value != 'string')
|
209
209
|
return String(value);
|
210
|
-
const result =
|
211
|
-
|
212
|
-
|
210
|
+
const result = get(options, value)
|
211
|
+
? get(options, value)
|
212
|
+
: value.replace(/{{\s*([^}]+)\s*}}/g, (match, path) => {
|
213
|
+
return get(options, path.trim()) ?? match;
|
214
|
+
});
|
213
215
|
return result;
|
214
216
|
}
|
215
217
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-format.mjs","sources":["../../../../libs/core/format/src/lib/format.config.ts","../../../../libs/core/format/src/lib/format.service.ts","../../../../libs/core/format/src/lib/format.pipe.ts","../../../../libs/core/format/src/lib/formatters/number-formatter.ts","../../../../libs/core/format/src/lib/formatters/string-formatter.ts","../../../../libs/core/format/src/lib/format.module.ts","../../../../libs/core/format/src/acorex-core-format.ts"],"sourcesContent":["import { AXFormatOptions } from './format.types';\n\nexport abstract class AXFormatter {\n abstract get name(): string;\n abstract format(value: unknown, options?: AXFormatOptions | string): string;\n}\n","import { Injectable, Injector } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { AXFormatter } from './format.config';\nimport { AXFormatOptionsMap } from './format.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFormatterRegistryService {\n private plugins: AXFormatter[] = [];\n\n private injector: Injector;\n\n constructor(injector: Injector) {\n this.injector = injector;\n }\n\n register(...plugins: (new () => AXFormatter)[]) {\n plugins.forEach((t) => {\n const childInjector = Injector.create({\n providers: [{ provide: t, useClass: t, deps: [] }],\n parent: this.injector,\n });\n const v = childInjector.get(t);\n\n if (v && !this.plugins.some((p) => p.name == v.name)) {\n this.plugins.push(v);\n }\n });\n }\n\n get formatters(): AXFormatter[] {\n return this.plugins;\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXFormatService {\n constructor(private pluginRegistry: AXFormatterRegistryService) {}\n\n private renderSubject = new Subject<void>();\n\n // Observable that other services/components can subscribe to\n onRender = this.renderSubject.asObservable();\n\n render() {\n this.renderSubject.next();\n }\n\n /**\n * Resolves a formatter by its name.\n * @param name The name of the formatter.\n * @returns The formatter if found, otherwise throws an error.\n */\n resolveFormatter(name: string): AXFormatter {\n const formatter = this.pluginRegistry.formatters.find((c) => c.name == name);\n if (!formatter) {\n throw new Error(`Formatter not found: ${name}`);\n }\n return formatter;\n }\n\n // Overload for traditional formatting\n format<K extends keyof AXFormatOptionsMap>(value: unknown, name: K, options?: AXFormatOptionsMap[K]): string;\n\n // Overload for starting fluent API chain\n format(value: unknown): AXFormatFluent;\n\n // Implementation of the format method\n format<K extends keyof AXFormatOptionsMap>(value: unknown, formatter?: K, options?: AXFormatOptionsMap[K]): string | AXFormatFluent {\n if (typeof formatter === 'string') {\n const formatterRef = this.resolveFormatter(formatter);\n return formatterRef.format(value, options);\n } else {\n return new AXFormatFluent(this, value);\n }\n }\n}\n\nclass AXFormatFluent {\n constructor(\n private formatService: AXFormatService,\n private initialValue: unknown,\n ) {}\n\n /**\n * Formats the value using the specified formatter and options.\n * @param formatter The name of the formatter to use.\n * @param options The options to pass to the formatter.\n * @returns The formatted string.\n */\n to<K extends keyof AXFormatOptionsMap>(formatter: K, options?: AXFormatOptionsMap[K]): string {\n try {\n const formatterRef = this.formatService.resolveFormatter(formatter);\n return formatterRef.format(this.initialValue, options);\n } catch (error) {\n return String(this.initialValue);\n }\n }\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { AXFormatService } from './format.service';\nimport { AXFormatOptions } from './format.types';\nimport { Observable, filter, of, startWith, switchMap } from 'rxjs';\nimport { AXEventService, AXEventData } from '@acorex/core/events';\n\n@Pipe({\n name: 'format',\n pure: true,\n})\nexport class AXFormatPipe implements PipeTransform {\n private formatService = inject(AXFormatService);\n private eventService = inject(AXEventService);\n\n private triggers = [\n 'AX_CALENDAR_CHANGED',\n 'AX_LANGUAGE_CHANGED',\n 'AX_LANGUAGE_LOADED',\n ];\n\n transform(\n value: unknown,\n name: string,\n options?: AXFormatOptions | string\n ): Observable<string> {\n // Initial formatted value\n const initialFormattedValue = this.formatService.format(\n value,\n name as any,\n options\n );\n\n // React to language changes and re-format the value\n return this.eventService.onEvent.pipe(\n filter((event: AXEventData) => this.triggers.includes(event.type)),\n startWith(initialFormattedValue), // Emit the initial formatted value immediately\n switchMap((event) => {\n // Re-call format method on every language change\n const formattedValue = this.formatService.format(\n value,\n name as any,\n options\n );\n return of(formattedValue);\n })\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { defaults, isInteger, padStart } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXNumberFormatterOptions extends AXFormatOptions {\n decimalPlaces?: number;\n thousandSeparator?: string;\n decimalSeparator?: string;\n zeroPadLength?: number; // New option for zero padding,\n locale?: string;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n number: AXNumberFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXNumberFormatter implements AXFormatter {\n private separatorsCache: any = {};\n\n get name(): string {\n return 'number';\n }\n\n format(value: number, options: AXNumberFormatterOptions): string {\n const { thousandSeparator, decimalSeparator } = this.getLocaleSeparators(options?.locale);\n // Merge user options with default options\n const effectiveOptions = defaults({}, options, {\n thousandSeparator,\n decimalSeparator,\n zeroPadLength: 0,\n locale: navigator.language,\n });\n\n const sign = value < 0 ? '-' : '';\n const absoluteValue = Math.abs(value);\n\n // Handling zero padding for integer part\n let integerPart = Math.floor(absoluteValue).toString();\n if (effectiveOptions.zeroPadLength && effectiveOptions.zeroPadLength > integerPart.length) {\n integerPart = padStart(integerPart, effectiveOptions.zeroPadLength, '0');\n }\n\n // Applying thousand separator to integer part\n if (effectiveOptions.thousandSeparator) {\n integerPart = integerPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, effectiveOptions.thousandSeparator);\n }\n\n // Constructing the final formatted value\n let formattedValue = sign + integerPart;\n if (effectiveOptions.decimalPlaces !== undefined) {\n // Limiting decimal places if specified\n const decimalPart = absoluteValue.toFixed(effectiveOptions.decimalPlaces).split('.')[1];\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n } else if (!isInteger(value)) {\n // Showing full decimal part if decimalPlaces is not specified\n const decimalPart = absoluteValue.toString().split('.')[1] || '';\n if (decimalPart.length > 0) {\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n }\n }\n\n return formattedValue;\n }\n\n private getLocaleSeparators(locale = navigator.language): {\n thousandSeparator: string;\n decimalSeparator: string;\n } {\n // Use cache if available\n if (this.separatorsCache[locale]) {\n return this.separatorsCache[locale];\n }\n\n const numberFormat = new Intl.NumberFormat(locale);\n const parts = numberFormat.formatToParts(1234567.89);\n let thousandSeparator = '';\n let decimalSeparator = '';\n\n for (const part of parts) {\n if (part.type === 'group') {\n thousandSeparator = part.value;\n } else if (part.type === 'decimal') {\n decimalSeparator = part.value;\n }\n }\n\n // Cache the result\n this.separatorsCache[locale] = { thousandSeparator, decimalSeparator };\n return this.separatorsCache[locale];\n }\n}\n","import { get } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXStringFormatterOptions extends AXFormatOptions {\n [key: string]: any;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n string: AXStringFormatterOptions;\n }\n}\n\nexport class AXStringFormatter implements AXFormatter {\n get name(): string {\n return 'string';\n }\n\n format(value: unknown, options: AXStringFormatterOptions): string {\n if (typeof value != 'string') return String(value);\n const result = value.replace(/{{\\s*([^}]+)\\s*}}/g, (match, path: string) => {\n return get(options, path.trim()) as string ?? match;\n });\n return result;\n }\n}\n","import { Inject, ModuleWithProviders, NgModule } from '@angular/core';\nimport { AXFormatPipe } from './format.pipe';\nimport { AXNumberFormatter } from './formatters/number-formatter';\nimport { AXFormatterRegistryService } from './format.service';\nimport { AXFormatter } from './format.config';\nimport { AXStringFormatter } from './formatters/string-formatter';\n\nconst BUILT_IN_RULES = [AXNumberFormatter, AXStringFormatter];\n\nexport interface AXFormatModuleConfigs {\n formatters: (new () => AXFormatter)[];\n}\n\n@NgModule({\n imports: [],\n exports: [AXFormatPipe],\n declarations: [AXFormatPipe],\n})\nexport class AXFormatModule {\n static forRoot(\n configs?: AXFormatModuleConfigs\n ): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(\n ...[...BUILT_IN_RULES, ...(configs?.formatters || [])]\n );\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(\n configs?: AXFormatModuleConfigs\n ): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(\n ...[...BUILT_IN_RULES, ...(configs?.formatters || [])]\n );\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Inject('AXFormatModuleFactory') instances: any[]) {\n instances.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAEsB,WAAW,CAAA;AAGhC;;MCGY,0BAA0B,CAAA;AAKrC,IAAA,WAAA,CAAY,QAAkB,EAAA;QAJtB,IAAO,CAAA,OAAA,GAAkB,EAAE,CAAC;AAKlC,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;KAC1B;IAED,QAAQ,CAAC,GAAG,OAAkC,EAAA;AAC5C,QAAA,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AACpB,YAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC;AACpC,gBAAA,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;gBAClD,MAAM,EAAE,IAAI,CAAC,QAAQ;AACtB,aAAA,CAAC,CAAC;YACH,MAAM,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAE/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;AACpD,gBAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACtB;AACH,SAAC,CAAC,CAAC;KACJ;AAED,IAAA,IAAI,UAAU,GAAA;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC;KACrB;8GAzBU,0BAA0B,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,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ACR,oBAAA,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,YAAY,EAAE,CAAC,YAAY,CAAC;AAC7B,iBAAA,CAAA;;0BA+Cc,MAAM;2BAAC,uBAAuB,CAAA;;;AChE7C;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-core-format.mjs","sources":["../../../../libs/core/format/src/lib/format.config.ts","../../../../libs/core/format/src/lib/format.service.ts","../../../../libs/core/format/src/lib/format.pipe.ts","../../../../libs/core/format/src/lib/formatters/number-formatter.ts","../../../../libs/core/format/src/lib/formatters/string-formatter.ts","../../../../libs/core/format/src/lib/format.module.ts","../../../../libs/core/format/src/acorex-core-format.ts"],"sourcesContent":["import { AXFormatOptions } from './format.types';\n\nexport abstract class AXFormatter {\n abstract get name(): string;\n abstract format(value: unknown, options?: AXFormatOptions | string): string;\n}\n","import { Injectable, Injector } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { AXFormatter } from './format.config';\nimport { AXFormatOptionsMap } from './format.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFormatterRegistryService {\n private plugins: AXFormatter[] = [];\n\n private injector: Injector;\n\n constructor(injector: Injector) {\n this.injector = injector;\n }\n\n register(...plugins: (new () => AXFormatter)[]) {\n plugins.forEach((t) => {\n const childInjector = Injector.create({\n providers: [{ provide: t, useClass: t, deps: [] }],\n parent: this.injector,\n });\n const v = childInjector.get(t);\n\n if (v && !this.plugins.some((p) => p.name == v.name)) {\n this.plugins.push(v);\n }\n });\n }\n\n get formatters(): AXFormatter[] {\n return this.plugins;\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXFormatService {\n constructor(private pluginRegistry: AXFormatterRegistryService) {}\n\n private renderSubject = new Subject<void>();\n\n // Observable that other services/components can subscribe to\n onRender = this.renderSubject.asObservable();\n\n render() {\n this.renderSubject.next();\n }\n\n /**\n * Resolves a formatter by its name.\n * @param name The name of the formatter.\n * @returns The formatter if found, otherwise throws an error.\n */\n resolveFormatter(name: string): AXFormatter {\n const formatter = this.pluginRegistry.formatters.find((c) => c.name == name);\n if (!formatter) {\n throw new Error(`Formatter not found: ${name}`);\n }\n return formatter;\n }\n\n // Overload for traditional formatting\n format<K extends keyof AXFormatOptionsMap>(value: unknown, name: K, options?: AXFormatOptionsMap[K]): string;\n\n // Overload for starting fluent API chain\n format(value: unknown): AXFormatFluent;\n\n // Implementation of the format method\n format<K extends keyof AXFormatOptionsMap>(value: unknown, formatter?: K, options?: AXFormatOptionsMap[K]): string | AXFormatFluent {\n if (typeof formatter === 'string') {\n const formatterRef = this.resolveFormatter(formatter);\n return formatterRef.format(value, options);\n } else {\n return new AXFormatFluent(this, value);\n }\n }\n}\n\nclass AXFormatFluent {\n constructor(\n private formatService: AXFormatService,\n private initialValue: unknown,\n ) {}\n\n /**\n * Formats the value using the specified formatter and options.\n * @param formatter The name of the formatter to use.\n * @param options The options to pass to the formatter.\n * @returns The formatted string.\n */\n to<K extends keyof AXFormatOptionsMap>(formatter: K, options?: AXFormatOptionsMap[K]): string {\n try {\n const formatterRef = this.formatService.resolveFormatter(formatter);\n return formatterRef.format(this.initialValue, options);\n } catch (error) {\n return String(this.initialValue);\n }\n }\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { AXFormatService } from './format.service';\nimport { AXFormatOptions } from './format.types';\nimport { Observable, filter, of, startWith, switchMap } from 'rxjs';\nimport { AXEventService, AXEventData } from '@acorex/core/events';\n\n@Pipe({\n name: 'format',\n pure: true,\n})\nexport class AXFormatPipe implements PipeTransform {\n private formatService = inject(AXFormatService);\n private eventService = inject(AXEventService);\n\n private triggers = [\n 'AX_CALENDAR_CHANGED',\n 'AX_LANGUAGE_CHANGED',\n 'AX_LANGUAGE_LOADED',\n ];\n\n transform(\n value: unknown,\n name: string,\n options?: AXFormatOptions | string\n ): Observable<string> {\n // Initial formatted value\n const initialFormattedValue = this.formatService.format(\n value,\n name as any,\n options\n );\n\n // React to language changes and re-format the value\n return this.eventService.onEvent.pipe(\n filter((event: AXEventData) => this.triggers.includes(event.type)),\n startWith(initialFormattedValue), // Emit the initial formatted value immediately\n switchMap((event) => {\n // Re-call format method on every language change\n const formattedValue = this.formatService.format(\n value,\n name as any,\n options\n );\n return of(formattedValue);\n })\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { defaults, isInteger, padStart } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXNumberFormatterOptions extends AXFormatOptions {\n decimalPlaces?: number;\n thousandSeparator?: string;\n decimalSeparator?: string;\n zeroPadLength?: number; // New option for zero padding,\n locale?: string;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n number: AXNumberFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXNumberFormatter implements AXFormatter {\n private separatorsCache: any = {};\n\n get name(): string {\n return 'number';\n }\n\n format(value: number, options: AXNumberFormatterOptions): string {\n const { thousandSeparator, decimalSeparator } = this.getLocaleSeparators(options?.locale);\n // Merge user options with default options\n const effectiveOptions = defaults({}, options, {\n thousandSeparator,\n decimalSeparator,\n zeroPadLength: 0,\n locale: navigator.language,\n });\n\n const sign = value < 0 ? '-' : '';\n const absoluteValue = Math.abs(value);\n\n // Handling zero padding for integer part\n let integerPart = Math.floor(absoluteValue).toString();\n if (effectiveOptions.zeroPadLength && effectiveOptions.zeroPadLength > integerPart.length) {\n integerPart = padStart(integerPart, effectiveOptions.zeroPadLength, '0');\n }\n\n // Applying thousand separator to integer part\n if (effectiveOptions.thousandSeparator) {\n integerPart = integerPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, effectiveOptions.thousandSeparator);\n }\n\n // Constructing the final formatted value\n let formattedValue = sign + integerPart;\n if (effectiveOptions.decimalPlaces !== undefined) {\n // Limiting decimal places if specified\n const decimalPart = absoluteValue.toFixed(effectiveOptions.decimalPlaces).split('.')[1];\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n } else if (!isInteger(value)) {\n // Showing full decimal part if decimalPlaces is not specified\n const decimalPart = absoluteValue.toString().split('.')[1] || '';\n if (decimalPart.length > 0) {\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n }\n }\n\n return formattedValue;\n }\n\n private getLocaleSeparators(locale = navigator.language): {\n thousandSeparator: string;\n decimalSeparator: string;\n } {\n // Use cache if available\n if (this.separatorsCache[locale]) {\n return this.separatorsCache[locale];\n }\n\n const numberFormat = new Intl.NumberFormat(locale);\n const parts = numberFormat.formatToParts(1234567.89);\n let thousandSeparator = '';\n let decimalSeparator = '';\n\n for (const part of parts) {\n if (part.type === 'group') {\n thousandSeparator = part.value;\n } else if (part.type === 'decimal') {\n decimalSeparator = part.value;\n }\n }\n\n // Cache the result\n this.separatorsCache[locale] = { thousandSeparator, decimalSeparator };\n return this.separatorsCache[locale];\n }\n}\n","import { get } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXStringFormatterOptions extends AXFormatOptions {\n [key: string]: any;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n string: AXStringFormatterOptions;\n }\n}\n\nexport class AXStringFormatter implements AXFormatter {\n get name(): string {\n return 'string';\n }\n\n format(value: unknown, options: AXStringFormatterOptions): string {\n if (typeof value != 'string') return String(value);\n const result = get(options, value)\n ? get(options, value)\n : value.replace(/{{\\s*([^}]+)\\s*}}/g, (match, path: string) => {\n return (get(options, path.trim()) as string) ?? match;\n });\n\n return result;\n }\n}\n","import { Inject, ModuleWithProviders, NgModule } from '@angular/core';\nimport { AXFormatPipe } from './format.pipe';\nimport { AXNumberFormatter } from './formatters/number-formatter';\nimport { AXFormatterRegistryService } from './format.service';\nimport { AXFormatter } from './format.config';\nimport { AXStringFormatter } from './formatters/string-formatter';\n\nconst BUILT_IN_RULES = [AXNumberFormatter, AXStringFormatter];\n\nexport interface AXFormatModuleConfigs {\n formatters: (new () => AXFormatter)[];\n}\n\n@NgModule({\n imports: [],\n exports: [AXFormatPipe],\n declarations: [AXFormatPipe],\n})\nexport class AXFormatModule {\n static forRoot(\n configs?: AXFormatModuleConfigs\n ): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(\n ...[...BUILT_IN_RULES, ...(configs?.formatters || [])]\n );\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(\n configs?: AXFormatModuleConfigs\n ): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(\n ...[...BUILT_IN_RULES, ...(configs?.formatters || [])]\n );\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Inject('AXFormatModuleFactory') instances: any[]) {\n instances.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAEsB,WAAW,CAAA;AAGhC;;MCGY,0BAA0B,CAAA;AAKrC,IAAA,WAAA,CAAY,QAAkB,EAAA;QAJtB,IAAO,CAAA,OAAA,GAAkB,EAAE,CAAC;AAKlC,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;KAC1B;IAED,QAAQ,CAAC,GAAG,OAAkC,EAAA;AAC5C,QAAA,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AACpB,YAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC;AACpC,gBAAA,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;gBAClD,MAAM,EAAE,IAA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CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AACtB,YAAA,CAAC,EAAE,CAAC;AACN,SAAC,CAAC,CAAC;KACJ;AAlDU,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,cAAc,kBA8CL,uBAAuB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;+GA9ChC,cAAc,EAAA,YAAA,EAAA,CAFV,YAAY,CAAA,EAAA,OAAA,EAAA,CADjB,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;+GAGX,cAAc,EAAA,CAAA,CAAA,EAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAL1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,YAAY,EAAE,CAAC,YAAY,CAAC;AAC7B,iBAAA,CAAA;;0BA+Cc,MAAM;2BAAC,uBAAuB,CAAA;;;AChE7C;;AAEG;;;;"}
|
@@ -2,7 +2,7 @@ import { isPlatformBrowser, DOCUMENT } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
3
3
|
import { PLATFORM_ID, Injectable, Inject, InjectionToken } from '@angular/core';
|
4
4
|
import { isBrowser } from '@acorex/core/platform';
|
5
|
-
import
|
5
|
+
import CryptoJS from 'crypto-es';
|
6
6
|
|
7
7
|
class AXCookieStorageService {
|
8
8
|
constructor(document,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-storage.mjs","sources":["../../../../libs/core/storage/src/cookie-storage.service.ts","../../../../libs/core/storage/src/local-storage.service.ts","../../../../libs/core/storage/src/session-storage.service.ts","../../../../libs/core/storage/src/acorex-core-storage.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Inject, Injectable, PLATFORM_ID } from '@angular/core';\nimport { AXCookieOptions, AXSameSite } from './storage.interface';\n\n@Injectable()\nexport class AXCookieStorageService {\n private readonly documentIsAccessible: boolean;\n\n constructor(\n @Inject(DOCUMENT) private document: Document,\n // Get the `PLATFORM_ID` so we can check if we're in a browser.\n @Inject(PLATFORM_ID) private platformId\n ) {\n this.documentIsAccessible = isPlatformBrowser(this.platformId);\n }\n\n /**\n * Get cookie Regular Expression\n *\n * @param name Cookie name\n * @returns property RegExp\n *\n */\n private static getCookieRegExp(name: string): RegExp {\n const escapedName: string = name.replace(/([[\\]{}()|=;+?,.*^$])/gi, '\\\\$1');\n\n return new RegExp(\n '(?:^' + escapedName + '|;\\\\s*' + escapedName + ')=(.*?)(?:;|$)',\n 'g'\n );\n }\n\n /**\n * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n * @param encodedURIComponent A value representing an encoded URI component.\n *\n * @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n */\n private static safeDecodeURIComponent(encodedURIComponent: string): string {\n try {\n return decodeURIComponent(encodedURIComponent);\n } catch {\n // probably it is not uri encoded. return as is\n return encodedURIComponent;\n }\n }\n\n /**\n * Return `true` if {@link Document} is accessible, otherwise return `false`\n *\n * @param name Cookie name\n * @returns boolean - whether cookie with specified name exists\n *\n */\n check(name: string): boolean {\n if (!this.documentIsAccessible) {\n return false;\n }\n name = encodeURIComponent(name);\n const regExp: RegExp = AXCookieStorageService.getCookieRegExp(name);\n return regExp.test(this.document.cookie);\n }\n\n /**\n * Get cookies by name\n *\n * @param name Cookie name\n * @returns property value\n *\n */\n get(name: string): string {\n if (this.documentIsAccessible && this.check(name)) {\n name = encodeURIComponent(name);\n\n const regExp: RegExp = AXCookieStorageService.getCookieRegExp(name);\n const result: RegExpExecArray = regExp.exec(this.document.cookie);\n\n return result[1]\n ? AXCookieStorageService.safeDecodeURIComponent(result[1])\n : '';\n } else {\n return '';\n }\n }\n\n /**\n * Get all cookies in JSON format\n *\n * @returns all the cookies in json\n *\n */\n getAll(): { [key: string]: string } {\n if (!this.documentIsAccessible) {\n return {};\n }\n\n const cookies: { [key: string]: string } = {};\n const document: any = this.document;\n\n if (document.cookie && document.cookie !== '') {\n document.cookie.split(';').forEach((currentCookie) => {\n const [cookieName, cookieValue] = currentCookie.split('=');\n cookies[\n AXCookieStorageService.safeDecodeURIComponent(\n cookieName.replace(/^ /, '')\n )\n ] = AXCookieStorageService.safeDecodeURIComponent(cookieValue);\n });\n }\n\n return cookies;\n }\n\n /**\n * Set cookie based on provided information\n *\n * @param name Cookie name\n * @param value Cookie value\n * @param expires Number of days until the cookies expires or an actual `Date`\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Secure flag\n * @param sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`\n *\n */\n set(\n name: string,\n value: string,\n expires?: AXCookieOptions['expires'],\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite?: AXSameSite\n ): void;\n\n /**\n * Set cookie based on provided information\n *\n * Cookie's parameters:\n * <pre>\n * expires Number of days until the cookies expires or an actual `Date`\n * path Cookie path\n * domain Cookie domain\n * secure Secure flag\n * sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`\n * </pre>\n *\n * @param name Cookie name\n * @param value Cookie value\n * @param options Body with cookie's params\n *\n */\n set(name: string, value: string, options?: AXCookieOptions): void;\n\n set(\n name: string,\n value: string,\n expiresOrOptions?: AXCookieOptions['expires'] | AXCookieOptions,\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite?: AXSameSite\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n if (\n typeof expiresOrOptions === 'number' ||\n expiresOrOptions instanceof Date ||\n path ||\n domain ||\n secure ||\n sameSite\n ) {\n const optionsBody = {\n expires: expiresOrOptions as AXCookieOptions['expires'],\n path,\n domain,\n secure,\n sameSite: sameSite ? sameSite : 'Lax',\n };\n\n this.set(name, value, optionsBody);\n return;\n }\n\n let cookieString: string =\n encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';\n\n const options = expiresOrOptions ? expiresOrOptions : {};\n\n if (options.expires) {\n if (typeof options.expires === 'number') {\n const dateExpires: Date = new Date(\n new Date().getTime() + options.expires * 1000 * 60 * 60 * 24\n );\n\n cookieString += 'expires=' + dateExpires.toUTCString() + ';';\n } else {\n cookieString += 'expires=' + options.expires.toUTCString() + ';';\n }\n }\n\n if (options.path) {\n cookieString += 'path=' + options.path + ';';\n }\n\n if (options.domain) {\n cookieString += 'domain=' + options.domain + ';';\n }\n\n if (options.secure === false && options.sameSite === 'None') {\n options.secure = true;\n console.warn(\n `[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +\n `More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`\n );\n }\n if (options.secure) {\n cookieString += 'secure;';\n }\n\n if (!options.sameSite) {\n options.sameSite = 'Lax';\n }\n\n cookieString += 'sameSite=' + options.sameSite + ';';\n\n this.document.cookie = cookieString;\n }\n\n /**\n * Delete cookie by name\n *\n * @param name Cookie name\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Cookie secure flag\n * @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite\n *\n */\n delete(\n name: string,\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite: AXSameSite = 'Lax'\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');\n this.set(name, '', {\n expires: expiresDate,\n path,\n domain,\n secure,\n sameSite,\n });\n }\n\n /**\n * Delete all cookies\n *\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Is the Cookie secure\n * @param sameSite Is the cookie same site\n *\n */\n deleteAll(\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite: AXSameSite = 'Lax'\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n const cookies = this.getAll();\n\n for (const cookieName in cookies) {\n // eslint-disable-next-line no-prototype-builtins\n if (cookies.hasOwnProperty(cookieName)) {\n this.delete(cookieName, path, domain, secure, sameSite);\n }\n }\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { Inject, Injectable, InjectionToken } from '@angular/core';\nimport * as CryptoJS from 'crypto-js';\nimport { AXStorage } from './storage.interface';\n\nexport const AX_LOCALSTORAGE_SECRET_KEY: InjectionToken<string> = new InjectionToken('AX_LOCALSTORAGE_SECRET_KEY');\n\n@Injectable()\nexport class AXLocalStorageService implements AXStorage {\n constructor(@Inject(AX_LOCALSTORAGE_SECRET_KEY) private secret_key: string) {}\n\n get<T = unknown>(key: string): T {\n if (isBrowser()) {\n const value = localStorage.getItem(key);\n return value ? JSON.parse(value) : null;\n } else {\n return null;\n }\n }\n\n set<T = unknown>(key: string, value: T): void {\n if (isBrowser()) {\n return localStorage.setItem(key, JSON.stringify(value));\n }\n }\n\n clear(): void {\n if (isBrowser()) {\n return localStorage.clear();\n }\n }\n\n removeItem(key: string) {\n if (isBrowser()) {\n return localStorage.removeItem(key);\n }\n }\n\n setWithEncryption<T = unknown>(key: string, value: T) {\n if (isBrowser()) {\n const encrypted = CryptoJS.AES.encrypt(JSON.stringify(value), this.secret_key).toString();\n return localStorage.setItem(key, encrypted);\n }\n }\n\n getWithEncription<T = unknown>(key: string): T {\n if (isBrowser()) {\n const encrypted = localStorage.getItem(key) || '';\n const decrypted = CryptoJS.AES.decrypt(encrypted, this.secret_key).toString(CryptoJS.enc.Utf8);\n return encrypted ? JSON.parse(decrypted) : {};\n } else {\n return null;\n }\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { Injectable } from '@angular/core';\nimport { AXStorage } from './storage.interface';\n\n@Injectable()\nexport class AXSessionStorageService implements AXStorage {\n get<T = unknown>(key: string): T {\n if (isBrowser()) {\n const value = sessionStorage.getItem(key);\n return value ? JSON.parse(value) : null;\n } else {\n return null;\n }\n }\n\n set<T = unknown>(key: string, value: T): void {\n if (isBrowser()) {\n return sessionStorage.setItem(key, JSON.stringify(value));\n }\n }\n\n clear(): void {\n if (isBrowser()) {\n return sessionStorage.clear();\n }\n }\n\n removeItem(key: string) {\n if (isBrowser()) {\n return sessionStorage.removeItem(key);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAKa,sBAAsB,CAAA;AAGjC,IAAA,WAAA,CAC4B,QAAkB;;IAEf,UAAU,EAAA;QAFb,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;QAEf,IAAU,CAAA,UAAA,GAAV,UAAU,CAAA;QAEvC,IAAI,CAAC,oBAAoB,GAAG,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KAChE;AAED;;;;;;AAMG;IACK,OAAO,eAAe,CAAC,IAAY,EAAA;QACzC,MAAM,WAAW,GAAW,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;AAE5E,QAAA,OAAO,IAAI,MAAM,CACf,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,gBAAgB,EAChE,GAAG,CACJ,CAAC;KACH;AAED;;;;;;;AAOG;IACK,OAAO,sBAAsB,CAAC,mBAA2B,EAAA;AAC/D,QAAA,IAAI;AACF,YAAA,OAAO,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;SAChD;AAAC,QAAA,MAAM;;AAEN,YAAA,OAAO,mBAAmB,CAAC;SAC5B;KACF;AAED;;;;;;AAMG;AACH,IAAA,KAAK,CAAC,IAAY,EAAA;AAChB,QAAA,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;A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O,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SACvC;KACF;8GA1BU,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;kHAAvB,uBAAuB,EAAA,CAAA,CAAA,EAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;;;ACJX;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-core-storage.mjs","sources":["../../../../libs/core/storage/src/cookie-storage.service.ts","../../../../libs/core/storage/src/local-storage.service.ts","../../../../libs/core/storage/src/session-storage.service.ts","../../../../libs/core/storage/src/acorex-core-storage.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Inject, Injectable, PLATFORM_ID } from '@angular/core';\nimport { AXCookieOptions, AXSameSite } from './storage.interface';\n\n@Injectable()\nexport class AXCookieStorageService {\n private readonly documentIsAccessible: boolean;\n\n constructor(\n @Inject(DOCUMENT) private document: Document,\n // Get the `PLATFORM_ID` so we can check if we're in a browser.\n @Inject(PLATFORM_ID) private platformId\n ) {\n this.documentIsAccessible = isPlatformBrowser(this.platformId);\n }\n\n /**\n * Get cookie Regular Expression\n *\n * @param name Cookie name\n * @returns property RegExp\n *\n */\n private static getCookieRegExp(name: string): RegExp {\n const escapedName: string = name.replace(/([[\\]{}()|=;+?,.*^$])/gi, '\\\\$1');\n\n return new RegExp(\n '(?:^' + escapedName + '|;\\\\s*' + escapedName + ')=(.*?)(?:;|$)',\n 'g'\n );\n }\n\n /**\n * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n * @param encodedURIComponent A value representing an encoded URI component.\n *\n * @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n */\n private static safeDecodeURIComponent(encodedURIComponent: string): string {\n try {\n return decodeURIComponent(encodedURIComponent);\n } catch {\n // probably it is not uri encoded. return as is\n return encodedURIComponent;\n }\n }\n\n /**\n * Return `true` if {@link Document} is accessible, otherwise return `false`\n *\n * @param name Cookie name\n * @returns boolean - whether cookie with specified name exists\n *\n */\n check(name: string): boolean {\n if (!this.documentIsAccessible) {\n return false;\n }\n name = encodeURIComponent(name);\n const regExp: RegExp = AXCookieStorageService.getCookieRegExp(name);\n return regExp.test(this.document.cookie);\n }\n\n /**\n * Get cookies by name\n *\n * @param name Cookie name\n * @returns property value\n *\n */\n get(name: string): string {\n if (this.documentIsAccessible && this.check(name)) {\n name = encodeURIComponent(name);\n\n const regExp: RegExp = AXCookieStorageService.getCookieRegExp(name);\n const result: RegExpExecArray = regExp.exec(this.document.cookie);\n\n return result[1]\n ? AXCookieStorageService.safeDecodeURIComponent(result[1])\n : '';\n } else {\n return '';\n }\n }\n\n /**\n * Get all cookies in JSON format\n *\n * @returns all the cookies in json\n *\n */\n getAll(): { [key: string]: string } {\n if (!this.documentIsAccessible) {\n return {};\n }\n\n const cookies: { [key: string]: string } = {};\n const document: any = this.document;\n\n if (document.cookie && document.cookie !== '') {\n document.cookie.split(';').forEach((currentCookie) => {\n const [cookieName, cookieValue] = currentCookie.split('=');\n cookies[\n AXCookieStorageService.safeDecodeURIComponent(\n cookieName.replace(/^ /, '')\n )\n ] = AXCookieStorageService.safeDecodeURIComponent(cookieValue);\n });\n }\n\n return cookies;\n }\n\n /**\n * Set cookie based on provided information\n *\n * @param name Cookie name\n * @param value Cookie value\n * @param expires Number of days until the cookies expires or an actual `Date`\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Secure flag\n * @param sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`\n *\n */\n set(\n name: string,\n value: string,\n expires?: AXCookieOptions['expires'],\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite?: AXSameSite\n ): void;\n\n /**\n * Set cookie based on provided information\n *\n * Cookie's parameters:\n * <pre>\n * expires Number of days until the cookies expires or an actual `Date`\n * path Cookie path\n * domain Cookie domain\n * secure Secure flag\n * sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`\n * </pre>\n *\n * @param name Cookie name\n * @param value Cookie value\n * @param options Body with cookie's params\n *\n */\n set(name: string, value: string, options?: AXCookieOptions): void;\n\n set(\n name: string,\n value: string,\n expiresOrOptions?: AXCookieOptions['expires'] | AXCookieOptions,\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite?: AXSameSite\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n if (\n typeof expiresOrOptions === 'number' ||\n expiresOrOptions instanceof Date ||\n path ||\n domain ||\n secure ||\n sameSite\n ) {\n const optionsBody = {\n expires: expiresOrOptions as AXCookieOptions['expires'],\n path,\n domain,\n secure,\n sameSite: sameSite ? sameSite : 'Lax',\n };\n\n this.set(name, value, optionsBody);\n return;\n }\n\n let cookieString: string =\n encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';\n\n const options = expiresOrOptions ? expiresOrOptions : {};\n\n if (options.expires) {\n if (typeof options.expires === 'number') {\n const dateExpires: Date = new Date(\n new Date().getTime() + options.expires * 1000 * 60 * 60 * 24\n );\n\n cookieString += 'expires=' + dateExpires.toUTCString() + ';';\n } else {\n cookieString += 'expires=' + options.expires.toUTCString() + ';';\n }\n }\n\n if (options.path) {\n cookieString += 'path=' + options.path + ';';\n }\n\n if (options.domain) {\n cookieString += 'domain=' + options.domain + ';';\n }\n\n if (options.secure === false && options.sameSite === 'None') {\n options.secure = true;\n console.warn(\n `[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +\n `More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`\n );\n }\n if (options.secure) {\n cookieString += 'secure;';\n }\n\n if (!options.sameSite) {\n options.sameSite = 'Lax';\n }\n\n cookieString += 'sameSite=' + options.sameSite + ';';\n\n this.document.cookie = cookieString;\n }\n\n /**\n * Delete cookie by name\n *\n * @param name Cookie name\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Cookie secure flag\n * @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite\n *\n */\n delete(\n name: string,\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite: AXSameSite = 'Lax'\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');\n this.set(name, '', {\n expires: expiresDate,\n path,\n domain,\n secure,\n sameSite,\n });\n }\n\n /**\n * Delete all cookies\n *\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Is the Cookie secure\n * @param sameSite Is the cookie same site\n *\n */\n deleteAll(\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite: AXSameSite = 'Lax'\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n const cookies = this.getAll();\n\n for (const cookieName in cookies) {\n // eslint-disable-next-line no-prototype-builtins\n if (cookies.hasOwnProperty(cookieName)) {\n this.delete(cookieName, path, domain, secure, sameSite);\n }\n }\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { Inject, Injectable, InjectionToken } from '@angular/core';\nimport CryptoJS from 'crypto-es';\nimport { AXStorage } from './storage.interface';\n\nexport const AX_LOCALSTORAGE_SECRET_KEY: InjectionToken<string> = new InjectionToken('AX_LOCALSTORAGE_SECRET_KEY');\n\n@Injectable()\nexport class AXLocalStorageService implements AXStorage {\n constructor(@Inject(AX_LOCALSTORAGE_SECRET_KEY) private secret_key: string) {}\n\n get<T = unknown>(key: string): T {\n if (isBrowser()) {\n const value = localStorage.getItem(key);\n return value ? JSON.parse(value) : null;\n } else {\n return null;\n }\n }\n\n set<T = unknown>(key: string, value: T): void {\n if (isBrowser()) {\n return localStorage.setItem(key, JSON.stringify(value));\n }\n }\n\n clear(): void {\n if (isBrowser()) {\n return localStorage.clear();\n }\n }\n\n removeItem(key: string) {\n if (isBrowser()) {\n return localStorage.removeItem(key);\n }\n }\n\n setWithEncryption<T = unknown>(key: string, value: T) {\n if (isBrowser()) {\n const encrypted = CryptoJS.AES.encrypt(JSON.stringify(value), this.secret_key).toString();\n return localStorage.setItem(key, encrypted);\n }\n }\n\n getWithEncription<T = unknown>(key: string): T {\n if (isBrowser()) {\n const encrypted = localStorage.getItem(key) || '';\n const decrypted = CryptoJS.AES.decrypt(encrypted, this.secret_key).toString(CryptoJS.enc.Utf8);\n return encrypted ? JSON.parse(decrypted) : {};\n } else {\n return null;\n }\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { Injectable } from '@angular/core';\nimport { AXStorage } from './storage.interface';\n\n@Injectable()\nexport class AXSessionStorageService implements AXStorage {\n get<T = unknown>(key: string): T {\n if (isBrowser()) {\n const value = sessionStorage.getItem(key);\n return value ? JSON.parse(value) : null;\n } else {\n return null;\n }\n }\n\n set<T = unknown>(key: string, value: T): void {\n if (isBrowser()) {\n return sessionStorage.setItem(key, JSON.stringify(value));\n }\n }\n\n clear(): void {\n if (isBrowser()) {\n return sessionStorage.clear();\n }\n }\n\n removeItem(key: string) {\n if (isBrowser()) {\n return sessionStorage.removeItem(key);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAKa,sBAAsB,CAAA;AAGjC,IAAA,WAAA,CAC4B,QAAkB;;IAEf,UAAU,EAAA;QAFb,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;QAEf,IAAU,CAAA,UAAA,GAAV,UAAU,CAAA;QAEvC,IAAI,CAAC,oBAAoB,GAAG,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KAChE;AAED;;;;;;AAMG;IACK,OAAO,eAAe,CAAC,IAAY,EAAA;QACzC,MAAM,WAAW,GAAW,IAAI,CAAC,OAAO,CAAC,yBAAyB,E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AK,CAAC,GAAG,IAAI,CAAC;SACzC;aAAM;AACL,YAAA,OAAO,IAAI,CAAC;SACb;KACF;IAED,GAAG,CAAc,GAAW,EAAE,KAAQ,EAAA;QACpC,IAAI,SAAS,EAAE,EAAE;AACf,YAAA,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;SAC3D;KACF;IAED,KAAK,GAAA;QACH,IAAI,SAAS,EAAE,EAAE;AACf,YAAA,OAAO,cAAc,CAAC,KAAK,EAAE,CAAC;SAC/B;KACF;AAED,IAAA,UAAU,CAAC,GAAW,EAAA;QACpB,IAAI,SAAS,EAAE,EAAE;AACf,YAAA,OAAO,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SACvC;KACF;8GA1BU,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;kHAAvB,uBAAuB,EAAA,CAAA,CAAA,EAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;;;ACJX;;AAEG;;;;"}
|
@@ -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 { isEmpty, isString } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable, inject } from '@angular/core';\nimport { AXTranslationService } from '@acorex/core/translation';\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(\n value: string,\n options: AXRegexValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n // Convert string pattern to RegExp if necessary\n const regexPattern =\n typeof options.pattern === 'string'\n ? new RegExp(options.pattern)\n : 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 ??\n `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 {\n find,\n isArray,\n isEmpty,\n isNull,\n isNumber,\n isString,\n isUndefined,\n} from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable, inject } from '@angular/core';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { firstValueFrom, lastValueFrom } from 'rxjs';\n\nexport interface AXRequiredValidationRuleOptions\n 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) => 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(\n '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 {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} 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(\n value: string,\n options: AXLengthValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValid =\n value?.length >= options.min && value?.length <= options.max;\n return {\n rule: this.name,\n result: isValid,\n message: isValid\n ? null\n : options?.message ??\n `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 { isEmpty } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\n\nexport interface AXMaxLengthValidationRuleOptions\n 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(\n value: string,\n options: AXMaxLengthValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValid = isEmpty(value) ? true : value?.length <= options.value;\n return {\n rule: this.name,\n result: isValid,\n message: isValid\n ? ''\n : options?.message ??\n `The value must not exceed ${options.value} characters.`,\n value: value,\n };\n }\n}\n","import { isEmpty } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\n\nexport interface AXMinLengthValidationRuleOptions\n 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(\n value: string,\n options: AXMinLengthValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValid = isEmpty(value) ? true : value?.length >= options.value;\n return {\n rule: this.name,\n result: isValid,\n message: isValid\n ? ''\n : options?.message ??\n `The value must be at least ${options.value} characters long.`,\n value: value,\n };\n }\n}\n","import { isEmpty } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\n\nexport interface AXBetweenValidationRuleOptions<T = number | Date>\n 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>\n implements AXValidationRule\n{\n get name(): string {\n return 'between';\n }\n\n async validate(\n value: T,\n options: AXBetweenValidationRuleOptions<T>\n ): 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 { isEqual } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\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(\n value: any,\n options: AXEqualValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValueEqual = isEqual(value, options.value);\n const isValid = options.not ? !isValueEqual : isValueEqual;\n\n const defaultMessage = `The value must ${\n options.not ? 'not ' : ''\n }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 { isNull, isUndefined } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\n\nexport interface AXGreaterThanValidationRuleOptions\n 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(\n value: number,\n options: AXGreaterThanValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValid =\n isNull(value) || isUndefined(value)\n ? true\n : options.inclusive\n ? value >= options.value\n : value > options.value;\n const baseMessage = `The value must be ${\n options.inclusive ? 'greater than or equal to' : 'greater than'\n } ${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 { isNull, isUndefined } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\n\nexport interface AXLessThanValidationRuleOptions\n 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(\n value: number,\n options: AXLessThanValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValid =\n isNull(value) || isUndefined(value)\n ? true\n : options.inclusive\n ? value <= options.value\n : value < options.value;\n const baseMessage = `The value must be ${\n options.inclusive ? 'less than or equal to' : 'less than'\n } ${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 {\n AXValidationRuleOptions,\n AXValidationRuleOptionsMap,\n} 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>(\n 'AX_VALIDATION_CONFIG',\n {\n providedIn: 'root',\n factory: () => {\n return AXValidationDefaultConfig;\n },\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(\n config: AXPartialValidationConfig = {}\n): AXValidationConfig {\n const result = {\n ...AXValidationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { Injectable, Injector, inject } from '@angular/core';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleOptionsMap,\n AXValidationRuleResult,\n AXValidationSummary,\n} from './validation.types';\nimport {\n AXValidationConfigRules,\n AX_VALIDATION_CONFIG,\n} from './validation.config';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { merge } from 'lodash-es';\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(\n ruleName: string,\n value: unknown,\n options?: AXValidationRuleOptions\n ): 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(\n 'validation.messages.invalid-rull-name',\n { params: { name: ruleName } }\n ),\n value,\n };\n }\n\n if (options?.message) {\n options.message = await this.translationService.translateAsync(\n options.message\n );\n }\n //\n if (validator) return validator.validate(value, options);\n else {\n return this.validate(\n customRule.rule,\n value,\n merge(options, customRule.options)\n );\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>(\n name: K,\n options?: AXValidationRuleOptionsMap[K]\n ): 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(\n rule.name,\n this.initialValue,\n rule.options\n );\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 {\n APP_INITIALIZER,\n Inject,\n Injector,\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport { AXValidationRegistryService } from './validation.service';\nimport { AXValidationRule } from './validation.types';\nimport { AXRegexValidationRule } from './rules/regex-rule';\nimport { AXRequiredValidationRule } from './rules/required-rule';\nimport { AXCallbackValidationRule } from './rules/callback-rule';\nimport { AXMinLengthValidationRule } from './rules/minlength-rule';\nimport { AXMaxLengthValidationRule } from './rules/maxlength-rule';\nimport { AXLengthValidationRule } from './rules/length-rule';\nimport { AXEqualValidationRule } from './rules/equal-rule';\nimport { AXLessThanValidationRule } from './rules/less-than-rule';\nimport { AXGreaterThanValidationRule } from './rules/greater-than';\nimport { AXBetweenValidationRule } from './rules/between-rule';\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(\n configs?: AXValidationModuleConfigs\n ): ModuleWithProviders<AXValidationModule> {\n return {\n ngModule: AXValidationModule,\n providers: [\n ...(configs?.rules || []),\n {\n provide: 'AXValidationModuleFactory',\n useFactory: (pluginRegistry: AXValidationRegistryService) => () => {\n pluginRegistry.register(\n ...[...BUILT_IN_RULES, ...(configs?.rules || [])]\n );\n },\n deps: [AXValidationRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(\n configs?: AXValidationModuleConfigs\n ): ModuleWithProviders<AXValidationModule> {\n return {\n ngModule: AXValidationModule,\n providers: [\n ...(configs?.rules || []),\n {\n provide: 'AXValidationModuleFactory',\n useFactory: (pluginRegistry: AXValidationRegistryService) => () => {\n pluginRegistry.register(\n ...[...BUILT_IN_RULES, ...(configs?.rules || [])]\n );\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(\n value: unknown,\n options?: AXValidationRuleOptions\n ): 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,CAAC;KACnB;AAED,IAAA,MAAM,QAAQ,CAAC,KAAQ,EAAE,OAA2C,EAAA;AAClE,QAAA,MAAM,gBAAgB,GAAG,OAAO,EAAE,QAAQ;cACtC,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;AACnC,cAAE;AACE,gBAAA,MAAM,EAAE,KAAK;AACb,gBAAA,OAAO,EAAE,2BAA2B;aACrC,CAAC;AACN,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,CAAC;AAEH,QAAA,IAAI,OAAO,gBAAgB,KAAK,SAAS,EAAE;AACzC,YAAA,OAAO,YAAY,CAAC;AAClB,gBAAA,MAAM,EAAE,gBAAgB;AACzB,aAAA,CAAC,CAAC;SACJ;AAED,QAAA,IAAI,gBAAgB,YAAY,OAAO,EAAE;AACvC,YAAA,OAAO,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC5C;AAED,QAAA,OAAO,YAAY,CAAC,gBAAgB,CAAC,CAAC;KACvC;8GA9BU,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;kHAAxB,wBAAwB,EAAA,CAAA,CAAA,EAAA;;2FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC,UAAU;;;MCAE,qBAAqB,CAAA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,CAAC,GAAG,cAAc,CAAC,EAAA,CAAA,CAAA,EAAA;;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,CAAA;;0BA+Cc,MAAM;2BAAC,2BAA2B,CAAA;;;MCjF3B,gBAAgB,CAAA;AAMrC;;ACfD;;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 { isEmpty, isString } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable, inject } from '@angular/core';\nimport { AXTranslationService } from '@acorex/core/translation';\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(\n value: string,\n options: AXRegexValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n // Convert string pattern to RegExp if necessary\n const regexPattern =\n typeof options.pattern === 'string'\n ? new RegExp(options.pattern)\n : 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 ??\n `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 {\n find,\n isArray,\n isEmpty,\n isNull,\n isNumber,\n isString,\n isUndefined,\n} from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable, inject } from '@angular/core';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { firstValueFrom, lastValueFrom } from 'rxjs';\n\nexport interface AXRequiredValidationRuleOptions\n 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) => 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(\n '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 {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} 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(\n value: string,\n options: AXLengthValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValid =\n value?.length >= options.min && value?.length <= options.max;\n return {\n rule: this.name,\n result: isValid,\n message: isValid\n ? null\n : options?.message ??\n `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 { isEmpty } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\n\nexport interface AXMaxLengthValidationRuleOptions\n 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(\n value: string,\n options: AXMaxLengthValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValid = isEmpty(value) ? true : value?.length <= options.value;\n return {\n rule: this.name,\n result: isValid,\n message: isValid\n ? ''\n : options?.message ??\n `The value must not exceed ${options.value} characters.`,\n value: value,\n };\n }\n}\n","import { isEmpty } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\n\nexport interface AXMinLengthValidationRuleOptions\n 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(\n value: string,\n options: AXMinLengthValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValid = isEmpty(value) ? true : value?.length >= options.value;\n return {\n rule: this.name,\n result: isValid,\n message: isValid\n ? ''\n : options?.message ??\n `The value must be at least ${options.value} characters long.`,\n value: value,\n };\n }\n}\n","import { isEmpty } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\n\nexport interface AXBetweenValidationRuleOptions<T = number | Date>\n 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>\n implements AXValidationRule\n{\n get name(): string {\n return 'between';\n }\n\n async validate(\n value: T,\n options: AXBetweenValidationRuleOptions<T>\n ): 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 { isEqual } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\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(\n value: any,\n options: AXEqualValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValueEqual = isEqual(value, options.value);\n const isValid = options.not ? !isValueEqual : isValueEqual;\n\n const defaultMessage = `The value must ${\n options.not ? 'not ' : ''\n }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 { isNull, isUndefined } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\n\nexport interface AXGreaterThanValidationRuleOptions\n 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(\n value: number,\n options: AXGreaterThanValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValid =\n isNull(value) || isUndefined(value)\n ? true\n : options.inclusive\n ? value >= options.value\n : value > options.value;\n const baseMessage = `The value must be ${\n options.inclusive ? 'greater than or equal to' : 'greater than'\n } ${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 { isNull, isUndefined } from 'lodash-es';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleResult,\n} from '../validation.types';\nimport { Injectable } from '@angular/core';\n\nexport interface AXLessThanValidationRuleOptions\n 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(\n value: number,\n options: AXLessThanValidationRuleOptions\n ): Promise<AXValidationRuleResult> {\n const isValid =\n isNull(value) || isUndefined(value)\n ? true\n : options.inclusive\n ? value <= options.value\n : value < options.value;\n const baseMessage = `The value must be ${\n options.inclusive ? 'less than or equal to' : 'less than'\n } ${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 {\n AXValidationRuleOptions,\n AXValidationRuleOptionsMap,\n} 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>(\n 'AX_VALIDATION_CONFIG',\n {\n providedIn: 'root',\n factory: () => {\n return AXValidationDefaultConfig;\n },\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(\n config: AXPartialValidationConfig = {}\n): AXValidationConfig {\n const result = {\n ...AXValidationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { Injectable, Injector, inject } from '@angular/core';\nimport {\n AXValidationRule,\n AXValidationRuleOptions,\n AXValidationRuleOptionsMap,\n AXValidationRuleResult,\n AXValidationSummary,\n} from './validation.types';\nimport {\n AXValidationConfigRules,\n AX_VALIDATION_CONFIG,\n} from './validation.config';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { merge } from 'lodash-es';\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(\n ruleName: string,\n value: unknown,\n options?: AXValidationRuleOptions\n ): 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(\n 'validation.messages.invalid-rull-name',\n { params: { name: ruleName } }\n ),\n value,\n };\n }\n\n if (options?.message) {\n options.message = await this.translationService.translateAsync(\n options.message\n );\n }\n //\n if (validator) return validator.validate(value, options);\n else {\n return this.validate(\n customRule.rule,\n value,\n merge(options, customRule.options)\n );\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>(\n name: K,\n options?: AXValidationRuleOptionsMap[K]\n ): 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(\n rule.name,\n this.initialValue,\n rule.options\n );\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 {\n APP_INITIALIZER,\n Inject,\n Injector,\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport { AXValidationRegistryService } from './validation.service';\nimport { AXValidationRule } from './validation.types';\nimport { AXRegexValidationRule } from './rules/regex-rule';\nimport { AXRequiredValidationRule } from './rules/required-rule';\nimport { AXCallbackValidationRule } from './rules/callback-rule';\nimport { AXMinLengthValidationRule } from './rules/minlength-rule';\nimport { AXMaxLengthValidationRule } from './rules/maxlength-rule';\nimport { AXLengthValidationRule } from './rules/length-rule';\nimport { AXEqualValidationRule } from './rules/equal-rule';\nimport { AXLessThanValidationRule } from './rules/less-than-rule';\nimport { AXGreaterThanValidationRule } from './rules/greater-than';\nimport { AXBetweenValidationRule } from './rules/between-rule';\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(\n configs?: AXValidationModuleConfigs\n ): ModuleWithProviders<AXValidationModule> {\n return {\n ngModule: AXValidationModule,\n providers: [\n ...(configs?.rules || []),\n {\n provide: 'AXValidationModuleFactory',\n useFactory: (pluginRegistry: AXValidationRegistryService) => () => {\n pluginRegistry.register(\n ...[...BUILT_IN_RULES, ...(configs?.rules || [])]\n );\n },\n deps: [AXValidationRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(\n configs?: AXValidationModuleConfigs\n ): ModuleWithProviders<AXValidationModule> {\n return {\n ngModule: AXValidationModule,\n providers: [\n ...(configs?.rules || []),\n {\n provide: 'AXValidationModuleFactory',\n useFactory: (pluginRegistry: AXValidationRegistryService) => () => {\n pluginRegistry.register(\n ...[...BUILT_IN_RULES, ...(configs?.rules || [])]\n );\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(\n value: unknown,\n options?: AXValidationRuleOptions\n ): 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,CAAC;KACnB;AAED,IAAA,MAAM,QAAQ,CAAC,KAAQ,EAAE,OAA2C,EAAA;AAClE,QAAA,MAAM,gBAAgB,GAAG,OAAO,EAAE,QAAQ;cACtC,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;AACnC,cAAE;AACE,gBAAA,MAAM,EAAE,KAAK;AACb,gBAAA,OAAO,EAAE,2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core",
|
3
|
-
"version": "18.
|
3
|
+
"version": "18.3.0",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@angular/common": ">=18.0.0",
|
6
6
|
"@angular/core": ">=18.0.0",
|
7
7
|
"lodash-es": ">=4.17.21",
|
8
8
|
"memoizee": ">=0.4.15",
|
9
|
-
"crypto-
|
9
|
+
"crypto-es": ">=2.1.0",
|
10
10
|
"wavesurfer.js": "^7.7.15",
|
11
11
|
"tinygradient-es": "^1.0.0"
|
12
12
|
},
|