@acorex/core 18.4.4 → 18.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/date-time/index.d.ts +2 -2
- package/esm2022/config/lib/configs.mjs +1 -1
- package/esm2022/date-time/index.mjs +3 -3
- package/esm2022/date-time/lib/dateTime.config.mjs +1 -1
- package/esm2022/date-time/lib/datetime.pipe.mjs +1 -1
- package/esm2022/date-time/lib/formatters/datetime-formatter.mjs +1 -1
- package/esm2022/date-time/lib/georgian.calendar.mjs +4 -9
- package/esm2022/date-time/lib/holidays.loader.mjs +1 -1
- package/esm2022/date-time/lib/jalali.calendar.mjs +10 -33
- package/esm2022/file/index.mjs +3 -3
- package/esm2022/file/lib/file-download-ref.class.mjs +1 -1
- package/esm2022/file/lib/file-upload-ref.class.mjs +1 -1
- package/esm2022/format/index.mjs +2 -2
- package/esm2022/format/lib/format.module.mjs +2 -2
- package/esm2022/format/lib/format.pipe.mjs +4 -8
- package/esm2022/image/lib/image.service.mjs +1 -1
- package/esm2022/pipes/lib/safe/safe.pipe.mjs +2 -2
- package/esm2022/platform/lib/platform.service.mjs +2 -1
- package/esm2022/storage/cookie-storage.service.mjs +5 -11
- package/esm2022/translation/index.mjs +3 -3
- package/esm2022/translation/lib/translation-scope.resolver.mjs +2 -2
- package/esm2022/translation/lib/translation.config.mjs +1 -1
- package/esm2022/translation/lib/translation.loader.mjs +1 -1
- package/esm2022/translation/lib/translation.module.mjs +4 -4
- package/esm2022/translation/lib/translator.directive.mjs +2 -2
- package/esm2022/translation/lib/translator.pipe.mjs +2 -2
- package/esm2022/utils/lib/auto-unsubscribe.mjs +1 -1
- package/esm2022/utils/lib/color-util.mjs +2 -4
- package/esm2022/utils/lib/drawing-util.mjs +4 -10
- package/esm2022/utils/lib/string-util.mjs +1 -1
- package/esm2022/validation/lib/rules/between-rule.mjs +2 -2
- package/esm2022/validation/lib/rules/equal-rule.mjs +2 -2
- package/esm2022/validation/lib/rules/greater-than.mjs +3 -7
- package/esm2022/validation/lib/rules/length-rule.mjs +2 -5
- package/esm2022/validation/lib/rules/less-than-rule.mjs +3 -7
- package/esm2022/validation/lib/rules/maxlength-rule.mjs +3 -6
- package/esm2022/validation/lib/rules/minlength-rule.mjs +3 -6
- package/esm2022/validation/lib/rules/regex-rule.mjs +5 -8
- package/esm2022/validation/lib/rules/required-rule.mjs +6 -4
- package/esm2022/validation/lib/validation.config.mjs +1 -1
- package/esm2022/validation/lib/validation.module.mjs +10 -10
- package/esm2022/validation/lib/validation.service.mjs +3 -3
- package/esm2022/validation/lib/validation.types.mjs +1 -1
- package/fesm2022/acorex-core-config.mjs.map +1 -1
- package/fesm2022/acorex-core-date-time.mjs +87 -115
- package/fesm2022/acorex-core-date-time.mjs.map +1 -1
- package/fesm2022/acorex-core-file.mjs +42 -42
- package/fesm2022/acorex-core-file.mjs.map +1 -1
- package/fesm2022/acorex-core-format.mjs +2 -6
- package/fesm2022/acorex-core-format.mjs.map +1 -1
- package/fesm2022/acorex-core-image.mjs.map +1 -1
- package/fesm2022/acorex-core-pipes.mjs.map +1 -1
- package/fesm2022/acorex-core-platform.mjs +1 -0
- package/fesm2022/acorex-core-platform.mjs.map +1 -1
- package/fesm2022/acorex-core-storage.mjs +4 -10
- package/fesm2022/acorex-core-storage.mjs.map +1 -1
- package/fesm2022/acorex-core-translation.mjs +27 -27
- package/fesm2022/acorex-core-translation.mjs.map +1 -1
- package/fesm2022/acorex-core-utils.mjs +4 -12
- package/fesm2022/acorex-core-utils.mjs.map +1 -1
- package/fesm2022/acorex-core-validation.mjs +11 -29
- package/fesm2022/acorex-core-validation.mjs.map +1 -1
- package/file/index.d.ts +2 -2
- package/format/index.d.ts +1 -1
- package/format/lib/format.pipe.d.ts +1 -1
- package/package.json +12 -12
- package/platform/lib/platform.service.d.ts +1 -1
- package/translation/index.d.ts +2 -2
- package/translation/lib/translation.loader.d.ts +1 -1
- package/translation/lib/translator.pipe.d.ts +1 -1
- package/validation/lib/validation.service.d.ts +2 -2
@@ -1,31 +1,9 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
2
|
import { Injectable, NgModule } from '@angular/core';
|
3
|
-
import * as i1 from '@
|
4
|
-
import { HttpRequest } from '@angular/common/http';
|
5
|
-
import * as i1$1 from '@acorex/core/format';
|
3
|
+
import * as i1 from '@acorex/core/format';
|
6
4
|
import { AXFormatModule } from '@acorex/core/format';
|
7
|
-
|
8
|
-
|
9
|
-
get name() {
|
10
|
-
return 'filesize';
|
11
|
-
}
|
12
|
-
format(value) {
|
13
|
-
const size = Number(value);
|
14
|
-
if (size === 0)
|
15
|
-
return '0 Bytes';
|
16
|
-
if (Number.isNaN(size))
|
17
|
-
return 'Unknown';
|
18
|
-
const k = 1024;
|
19
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
20
|
-
const i = Math.floor(Math.log(size) / Math.log(k));
|
21
|
-
return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
22
|
-
}
|
23
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileSizeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
24
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileSizeFormatter }); }
|
25
|
-
}
|
26
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileSizeFormatter, decorators: [{
|
27
|
-
type: Injectable
|
28
|
-
}] });
|
5
|
+
import * as i1$1 from '@angular/common/http';
|
6
|
+
import { HttpRequest } from '@angular/common/http';
|
29
7
|
|
30
8
|
class AXFileDownloadRef extends Promise {
|
31
9
|
constructor(executor) {
|
@@ -84,6 +62,28 @@ class AXFileDownloadResult {
|
|
84
62
|
}
|
85
63
|
}
|
86
64
|
|
65
|
+
class AXFileSizeFormatter {
|
66
|
+
get name() {
|
67
|
+
return 'filesize';
|
68
|
+
}
|
69
|
+
format(value) {
|
70
|
+
const size = Number(value);
|
71
|
+
if (size === 0)
|
72
|
+
return '0 Bytes';
|
73
|
+
if (Number.isNaN(size))
|
74
|
+
return 'Unknown';
|
75
|
+
const k = 1024;
|
76
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
77
|
+
const i = Math.floor(Math.log(size) / Math.log(k));
|
78
|
+
return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
79
|
+
}
|
80
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileSizeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
81
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileSizeFormatter }); }
|
82
|
+
}
|
83
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileSizeFormatter, decorators: [{
|
84
|
+
type: Injectable
|
85
|
+
}] });
|
86
|
+
|
87
87
|
class AXFileUploadRef extends Promise {
|
88
88
|
constructor(executor) {
|
89
89
|
super(executor);
|
@@ -96,6 +96,21 @@ class AXFileUploadRef extends Promise {
|
|
96
96
|
}
|
97
97
|
}
|
98
98
|
|
99
|
+
class AXFileModule {
|
100
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
101
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.2", ngImport: i0, type: AXFileModule, imports: [i1.AXFormatModule] }); }
|
102
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileModule, providers: [AXFileSizeFormatter], imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })] }); }
|
103
|
+
}
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileModule, decorators: [{
|
105
|
+
type: NgModule,
|
106
|
+
args: [{
|
107
|
+
imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })],
|
108
|
+
exports: [],
|
109
|
+
declarations: [],
|
110
|
+
providers: [AXFileSizeFormatter],
|
111
|
+
}]
|
112
|
+
}] });
|
113
|
+
|
99
114
|
class AXFileService {
|
100
115
|
constructor(_httpClient) {
|
101
116
|
this._httpClient = _httpClient;
|
@@ -221,7 +236,7 @@ class AXFileService {
|
|
221
236
|
getBase64Size(base64) {
|
222
237
|
return atob(base64.substring(base64.indexOf(',') + 1)).length;
|
223
238
|
}
|
224
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
239
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
225
240
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileService, providedIn: 'root' }); }
|
226
241
|
}
|
227
242
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileService, decorators: [{
|
@@ -229,22 +244,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
229
244
|
args: [{
|
230
245
|
providedIn: 'root',
|
231
246
|
}]
|
232
|
-
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
233
|
-
|
234
|
-
class AXFileModule {
|
235
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
236
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.2", ngImport: i0, type: AXFileModule, imports: [i1$1.AXFormatModule] }); }
|
237
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileModule, providers: [AXFileSizeFormatter], imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })] }); }
|
238
|
-
}
|
239
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXFileModule, decorators: [{
|
240
|
-
type: NgModule,
|
241
|
-
args: [{
|
242
|
-
imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })],
|
243
|
-
exports: [],
|
244
|
-
declarations: [],
|
245
|
-
providers: [AXFileSizeFormatter],
|
246
|
-
}]
|
247
|
-
}] });
|
247
|
+
}], ctorParameters: () => [{ type: i1$1.HttpClient }] });
|
248
248
|
|
249
249
|
/**
|
250
250
|
* Generated bundle index. Do not edit.
|
@@ -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\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,IA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nB,iBAAA,CAAA;;;MCCY,YAAY,CAAA;8GAAZ,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;+GAAZ,YAAY,EAAA,OAAA,EAAA,CAAAA,IAAA,CAAA,cAAA,CAAA,EAAA,CAAA,CAAA,EAAA;AAAZ,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,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-download-ref.class.ts","../../../../libs/core/file/src/lib/file-download-result.class.ts","../../../../libs/core/file/src/lib/file-size-formatter.ts","../../../../libs/core/file/src/lib/file-upload-ref.class.ts","../../../../libs/core/file/src/lib/file.module.ts","../../../../libs/core/file/src/lib/file.service.ts","../../../../libs/core/file/src/acorex-core-file.ts"],"sourcesContent":["import { AXFileDownloadResult } from './file-download-result.class';\n\nexport class AXFileDownloadRef extends Promise<AXFileDownloadResult> {\n public abortMethod: () => void;\n constructor(executor: (resolve: (value?: PromiseLike<AXFileDownloadResult>) => void, reject: (reason?: any) => void) => void) {\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","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","export class AXFileUploadRef<T = any> extends Promise<T> {\n public abortMethod: () => void;\n constructor(executor: (resolve: (value?: PromiseLike<T>) => void, reject: (reason?: any) => void) => void) {\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 { AXFormatModule } from '@acorex/core/format';\nimport { NgModule } from '@angular/core';\nimport { AXFileSizeFormatter } from './file-size-formatter';\n\n@NgModule({\n imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })],\n exports: [],\n declarations: [],\n providers: [AXFileSizeFormatter],\n})\nexport class AXFileModule {}\n","import { 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","/**\n * Generated bundle index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AA,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAc,CAAC,EAAE;AACjC,YAAA,OAAO,IAAI,CAAC,aAAa,CAAC,IAAc,CAAC,CAAC;SAC3C;AACD,QAAA,OAAO,KAAK,CAAC;KACd;AAEM,IAAA,QAAQ,CAAC,MAAc,EAAA;QAC5B,MAAM,IAAI,GAAG,4BAA4B,CAAC;AAC1C,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAC1B;AAEM,IAAA,aAAa,CAAC,MAAc,EAAA;AACjC,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;KAC/D;8GAvIU,aAAa,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAA,IAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAAb,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cAFZ,MAAM,EAAA,CAAA,CAAA,EAAA;;2FAEP,aAAa,EAAA,UAAA,EAAA,CAAA;kBAHzB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;ACTD;;AAEG;;;;"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
2
|
import { Injector, Injectable, inject, Pipe, NgModule, Inject } from '@angular/core';
|
3
|
-
import { Subject, filter, startWith, switchMap, of } from 'rxjs';
|
4
3
|
import { AXEventService } from '@acorex/core/events';
|
4
|
+
import { Subject, filter, startWith, switchMap, of } from 'rxjs';
|
5
5
|
import { defaults, padStart, isInteger, get } from 'lodash-es';
|
6
6
|
|
7
7
|
class AXFormatter {
|
@@ -101,11 +101,7 @@ class AXFormatPipe {
|
|
101
101
|
constructor() {
|
102
102
|
this.formatService = inject(AXFormatService);
|
103
103
|
this.eventService = inject(AXEventService);
|
104
|
-
this.triggers = [
|
105
|
-
'AX_CALENDAR_CHANGED',
|
106
|
-
'AX_LANGUAGE_CHANGED',
|
107
|
-
'AX_LANGUAGE_LOADED',
|
108
|
-
];
|
104
|
+
this.triggers = ['AX_CALENDAR_CHANGED', 'AX_LANGUAGE_CHANGED', 'AX_LANGUAGE_LOADED'];
|
109
105
|
}
|
110
106
|
transform(value, name, options) {
|
111
107
|
// Initial formatted value
|
@@ -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 = 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,C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GAAG,CAAC,GAAG,cAAc,EAAE,IAAI,OAAO,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,CACvD,CAAC;qBACH;oBACD,IAAI,EAAE,CAAC,0BAA0B,CAAC;AAClC,oBAAA,KAAK,EAAE,IAAI;AACZ,iBAAA;AACF,aAAA;SACF,CAAC;KACH;AAED;;AAEG;AACH,IAAA,WAAA,CAA6C,SAAgB,EAAA;AAC3D,QAAA,SAAS,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;;;;"}
|
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 { AXEventData, AXEventService } from '@acorex/core/events';\nimport { Pipe, PipeTransform, inject } from '@angular/core';\nimport { Observable, filter, of, startWith, switchMap } from 'rxjs';\nimport { AXFormatService } from './format.service';\nimport { AXFormatOptions } from './format.types';\n\n@Pipe({\n name: 'format',\n pure: true,\n})\nexport class AXFormatPipe implements PipeTransform {\n private formatService = inject(AXFormatService);\n private eventService = inject(AXEventService);\n\n private triggers = ['AX_CALENDAR_CHANGED', 'AX_LANGUAGE_CHANGED', 'AX_LANGUAGE_LOADED'];\n\n transform(value: unknown, name: string, options?: AXFormatOptions | string): Observable<string> {\n // Initial formatted value\n const initialFormattedValue = this.formatService.format(value, name as any, options);\n\n // React to language changes and re-format the value\n return this.eventService.onEvent.pipe(\n filter((event: AXEventData) => this.triggers.includes(event.type)),\n startWith(initialFormattedValue), // Emit the initial formatted value immediately\n switchMap((event) => {\n // Re-call format method on every language change\n const formattedValue = this.formatService.format(value, name as any, options);\n return of(formattedValue);\n }),\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { defaults, isInteger, padStart } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXNumberFormatterOptions extends AXFormatOptions {\n decimalPlaces?: number;\n thousandSeparator?: string;\n decimalSeparator?: string;\n zeroPadLength?: number; // New option for zero padding,\n locale?: string;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n number: AXNumberFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXNumberFormatter implements AXFormatter {\n private separatorsCache: any = {};\n\n get name(): string {\n return 'number';\n }\n\n format(value: number, options: AXNumberFormatterOptions): string {\n const { thousandSeparator, decimalSeparator } = this.getLocaleSeparators(options?.locale);\n // Merge user options with default options\n const effectiveOptions = defaults({}, options, {\n thousandSeparator,\n decimalSeparator,\n zeroPadLength: 0,\n locale: navigator.language,\n });\n\n const sign = value < 0 ? '-' : '';\n const absoluteValue = Math.abs(value);\n\n // Handling zero padding for integer part\n let integerPart = Math.floor(absoluteValue).toString();\n if (effectiveOptions.zeroPadLength && effectiveOptions.zeroPadLength > integerPart.length) {\n integerPart = padStart(integerPart, effectiveOptions.zeroPadLength, '0');\n }\n\n // Applying thousand separator to integer part\n if (effectiveOptions.thousandSeparator) {\n integerPart = integerPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, effectiveOptions.thousandSeparator);\n }\n\n // Constructing the final formatted value\n let formattedValue = sign + integerPart;\n if (effectiveOptions.decimalPlaces !== undefined) {\n // Limiting decimal places if specified\n const decimalPart = absoluteValue.toFixed(effectiveOptions.decimalPlaces).split('.')[1];\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n } else if (!isInteger(value)) {\n // Showing full decimal part if decimalPlaces is not specified\n const decimalPart = absoluteValue.toString().split('.')[1] || '';\n if (decimalPart.length > 0) {\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n }\n }\n\n return formattedValue;\n }\n\n private getLocaleSeparators(locale = navigator.language): {\n thousandSeparator: string;\n decimalSeparator: string;\n } {\n // Use cache if available\n if (this.separatorsCache[locale]) {\n return this.separatorsCache[locale];\n }\n\n const numberFormat = new Intl.NumberFormat(locale);\n const parts = numberFormat.formatToParts(1234567.89);\n let thousandSeparator = '';\n let decimalSeparator = '';\n\n for (const part of parts) {\n if (part.type === 'group') {\n thousandSeparator = part.value;\n } else if (part.type === 'decimal') {\n decimalSeparator = part.value;\n }\n }\n\n // Cache the result\n this.separatorsCache[locale] = { thousandSeparator, decimalSeparator };\n return this.separatorsCache[locale];\n }\n}\n","import { get } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXStringFormatterOptions extends AXFormatOptions {\n [key: string]: any;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n string: AXStringFormatterOptions;\n }\n}\n\nexport class AXStringFormatter implements AXFormatter {\n get name(): string {\n return 'string';\n }\n\n format(value: unknown, options: AXStringFormatterOptions): string {\n if (typeof value != 'string') return String(value);\n const result = get(options, value)\n ? get(options, value)\n : value.replace(/{{\\s*([^}]+)\\s*}}/g, (match, path: string) => {\n return (get(options, path.trim()) as string) ?? match;\n });\n\n return result;\n }\n}\n","import { Inject, ModuleWithProviders, NgModule } from '@angular/core';\nimport { AXFormatter } from './format.config';\nimport { AXFormatPipe } from './format.pipe';\nimport { AXFormatterRegistryService } from './format.service';\nimport { AXNumberFormatter } from './formatters/number-formatter';\nimport { AXStringFormatter } from './formatters/string-formatter';\n\nconst BUILT_IN_RULES = [AXNumberFormatter, AXStringFormatter];\n\nexport interface AXFormatModuleConfigs {\n formatters: (new () => AXFormatter)[];\n}\n\n@NgModule({\n imports: [],\n exports: [AXFormatPipe],\n declarations: [AXFormatPipe],\n})\nexport class AXFormatModule {\n static forRoot(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Inject('AXFormatModuleFactory') instances: any[]) {\n instances.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"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,0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AAA,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;;0BAuCc,MAAM;2BAAC,uBAAuB,CAAA;;;ACxD7C;;AAEG;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-image.mjs","sources":["../../../../libs/core/image/src/lib/image.service.ts","../../../../libs/core/image/src/acorex-core-image.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable()\nexport class AXImageService {\n async resize(options: {\n maxSize: number;\n source: HTMLImageElement | File;\n type?: 'image/png' | 'image/jpeg' | 'image/webp';\n quality?: number;\n }): Promise<Blob> {\n options = Object.assign({ type: 'image/png', quality: 1 }, options);\n\n let image: HTMLImageElement;\n if (options.source instanceof File) {\n const a = new Image();\n a.src = URL.createObjectURL(options.source);\n await new Promise<Event>((res) => (a.onload = res));\n image = a;\n } else {\n image = options.source;\n }\n\n // Resize the image\n const canvas: any = document.createElement('canvas');\n let width = image.width;\n let height = image.height;\n if (width > height) {\n if (width > options.maxSize) {\n height *= options.maxSize / width;\n width = options.maxSize;\n }\n } else {\n if (height > options.maxSize) {\n width *= options.maxSize / height;\n height = options.maxSize;\n }\n }\n canvas.width = width;\n canvas.height = height;\n canvas.getContext('2d').drawImage(image, 0, 0, width, height);\n return new Promise((resolve)
|
1
|
+
{"version":3,"file":"acorex-core-image.mjs","sources":["../../../../libs/core/image/src/lib/image.service.ts","../../../../libs/core/image/src/acorex-core-image.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable()\nexport class AXImageService {\n async resize(options: {\n maxSize: number;\n source: HTMLImageElement | File;\n type?: 'image/png' | 'image/jpeg' | 'image/webp';\n quality?: number;\n }): Promise<Blob> {\n options = Object.assign({ type: 'image/png', quality: 1 }, options);\n\n let image: HTMLImageElement;\n if (options.source instanceof File) {\n const a = new Image();\n a.src = URL.createObjectURL(options.source);\n await new Promise<Event>((res) => (a.onload = res));\n image = a;\n } else {\n image = options.source;\n }\n\n // Resize the image\n const canvas: any = document.createElement('canvas');\n let width = image.width;\n let height = image.height;\n if (width > height) {\n if (width > options.maxSize) {\n height *= options.maxSize / width;\n width = options.maxSize;\n }\n } else {\n if (height > options.maxSize) {\n width *= options.maxSize / height;\n height = options.maxSize;\n }\n }\n canvas.width = width;\n canvas.height = height;\n canvas.getContext('2d').drawImage(image, 0, 0, width, height);\n return new Promise((resolve) => canvas.toBlob(resolve, options.type, options.quality));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAGa,cAAc,CAAA;IACzB,MAAM,MAAM,CAAC,OAKZ,EAAA;AACC,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AAEpE,QAAA,IAAI,KAAuB,CAAC;AAC5B,QAAA,IAAI,OAAO,CAAC,MAAM,YAAY,IAAI,EAAE;AAClC,YAAA,MAAM,CAAC,GAAG,IAAI,KAAK,EAAE,CAAC;YACtB,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC5C,YAAA,MAAM,IAAI,OAAO,CAAQ,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;YACpD,KAAK,GAAG,CAAC,CAAC;SACX;aAAM;AACL,YAAA,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;SACxB;;QAGD,MAAM,MAAM,GAAQ,QAAQ,CAAC,aAAa,CA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.ts","../../../../libs/core/pipes/src/acorex-core-pipes.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport {
|
1
|
+
{"version":3,"file":"acorex-core-pipes.mjs","sources":["../../../../libs/core/pipes/src/lib/safe/safe.pipe.ts","../../../../libs/core/pipes/src/acorex-core-pipes.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport { DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl } from '@angular/platform-browser';\n\n@Pipe({\n name: 'safe',\n pure: true,\n standalone: true,\n})\nexport class AXSafePipe implements PipeTransform {\n constructor(protected sanitizer: DomSanitizer) {}\n\n public transform(value: any, type: string): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl {\n if (value == null || value == undefined || value == '') return '';\n switch (type) {\n case 'html':\n return this.sanitizer.bypassSecurityTrustHtml(value);\n case 'style':\n return this.sanitizer.bypassSecurityTrustStyle(value);\n case 'script':\n return this.sanitizer.bypassSecurityTrustScript(value);\n case 'url':\n return this.sanitizer.bypassSecurityTrustUrl(value);\n case 'resourceUrl':\n return this.sanitizer.bypassSecurityTrustResourceUrl(value);\n default:\n throw new Error(`Invalid safe type specified: ${type}`);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAQa,UAAU,CAAA;AACrB,IAAA,WAAA,CAAsB,SAAuB,EAAA;QAAvB,IAAS,CAAA,SAAA,GAAT,SAAS,CAAc;KAAI;IAE1C,SAAS,CAAC,KAAU,EAAE,IAAY,EAAA;QACvC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,EAAE;AAAE,YAAA,OAAO,EAAE,CAAC;QAClE,QAAQ,IAAI;AACV,YAAA,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;AACvD,YAAA,KAAK,OAAO;gBACV,OAAO,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;AACxD,YAAA,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;AACzD,YAAA,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACtD,YAAA,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC;AAC9D,YAAA;AACE,gBAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAA,CAAE,CAAC,CAAC;SAC3D;KACF;8GAnBU,UAAU,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,YAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA,EAAA;4GAAV,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,CAAA,EAAA;;2FAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBALtB,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,MAAM;AACZ,oBAAA,IAAI,EAAE,IAAI;AACV,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA,CAAA;;;ACPD;;AAEG;;;;"}
|
@@ -124,6 +124,7 @@ class AXPlatform {
|
|
124
124
|
localStorage.setItem('AX_THEME_MODE', 'dark');
|
125
125
|
this.themeMode$.next('dark');
|
126
126
|
this.themeMode.set('dark');
|
127
|
+
return 'dark';
|
127
128
|
}
|
128
129
|
switchSystemMode() {
|
129
130
|
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-platform.mjs","sources":["../../../../libs/core/platform/src/lib/platform.service.ts","../../../../libs/core/platform/src/acorex-core-platform.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\nimport { BehaviorSubject, Subject, fromEvent } from 'rxjs';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\nexport type AXThemeMode = 'light' | 'dark' | 'system';\nexport type AXPlatforms = 'Android' | 'Desktop' | 'iOS' | 'Mobile';\nexport type AXBrowsers = 'Chrome' | 'Safari' | 'Edge' | 'Firefox' | 'Opera' | 'MSIE';\nexport type AXTechnologies = 'PWA' | 'Hybrid' | 'Electron';\n\nexport type AXScreenSizes = 'SM' | 'MD' | 'LG' | 'XL' | '2XL' | '3XL' | '4XL' | '5XL';\n\nconst isChrome = (win: Window): boolean => testUserAgent(win, /Chrome/i);\n\nconst isFirefox = (win: Window): boolean => testUserAgent(win, /Firefox/i);\n\nconst isEdge = (win: Window): boolean => testUserAgent(win, /Edge/i);\n\nconst isSafari = (win: Window): boolean => testUserAgent(win, /Safari/i);\n\nconst isOpera = (win: Window): boolean => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);\n\nconst isMSIE = (win: Window): boolean => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);\n\nconst isMobileWeb = (win: Window): boolean => isMobile(win) && !isHybrid(win);\n\nconst isIpad = (win: Window) => {\n // iOS 12 and below\n if (testUserAgent(win, /iPad/i)) {\n return true;\n }\n\n // iOS 13+\n if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {\n return true;\n }\n\n return false;\n};\n\nconst isIphone = (win: Window) => testUserAgent(win, /iPhone/i);\n\nconst isIOS = (win: Window) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);\n\nconst isAndroid = (win: Window) => testUserAgent(win, /android|sink/i);\n\nconst isAndroidTablet = (win: Window) => {\n return isAndroid(win) && !testUserAgent(win, /mobile/i);\n};\n\nconst isPhablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;\n};\n\nconst isTablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return isIpad(win) || isAndroidTablet(win) || (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400);\n};\n\nconst isMobile = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\nconst isTouch = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\n\nconst isDesktop = (win: Window) => !isMobile(win);\n\nconst isHybrid = (win: Window) => isCordova(win) || isCapacitorNative(win);\n\nconst isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);\n\nconst isCapacitorNative = (win: any): boolean => {\n const capacitor = win['Capacitor'];\n return !!(capacitor && capacitor.isNative);\n};\n\nconst isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);\n\nconst isPWA = (win: Window): boolean => !!(win.matchMedia('(display-mode: standalone)').matches || (win.navigator as any).standalone);\n\nexport const testUserAgent = (win: Window, expr: RegExp) => expr.test(win.navigator.userAgent);\n\nexport const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');\nexport const isServer = new Function('try {return this===global;}catch(e){return false;}');\n\nconst matchMedia = (win: Window, query: string): boolean => {\n return win.matchMedia(query).matches;\n};\n\nconst isSMScreen = (win: Window) => matchMedia(win, '(max-width: 578px)');\nconst isMDScreen = (win: Window) => matchMedia(win, '(max-width: 768px)');\nconst isLGScreen = (win: Window) => matchMedia(win, '(max-width: 992px)');\nconst isXLScreen = (win: Window) => matchMedia(win, '(max-width: 1200px)');\nconst is2XLScreen = (win: Window) => matchMedia(win, '(max-width: 1440px)');\nconst is3XLScreen = (win: Window) => matchMedia(win, '(max-width: 1920px)');\nconst is4XLScreen = (win: Window) => matchMedia(win, '(max-width: 2560px)');\n\nconst PLATFORMS_MAP: any = {\n Android: isAndroid,\n iOS: isIOS,\n Desktop: isDesktop,\n Mobile: isMobile,\n Touch: isTouch,\n Chrome: isChrome,\n Firefox: isFirefox,\n Safari: isSafari,\n Edge: isEdge,\n Opera: isOpera,\n Hybrid: isHybrid,\n PWA: isPWA,\n Electron: isElectron,\n SM: isSMScreen,\n MD: isMDScreen,\n LG: isLGScreen,\n XL: isXLScreen,\n '2XL': is2XLScreen,\n '3XL': is3XLScreen,\n '4XL': is4XLScreen,\n};\n\nexport class AXPlatformEvent<T extends Event = Event> {\n nativeEvent!: T;\n source!: AXPlatform;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPlatform {\n resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n click: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n scroll: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n /**\n * @deprecated The themeMode property is deprecated, use themeMode\n */\n themeMode$: BehaviorSubject<AXThemeMode> = new BehaviorSubject<AXThemeMode>('system');\n\n themeMode = signal<AXThemeMode>('system');\n\n isRtl(): boolean {\n return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';\n }\n\n isLandscape(): boolean {\n return window.innerHeight < window.innerWidth;\n }\n\n isPortrate(): boolean {\n return !this.isLandscape();\n }\n\n is(name: AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes): boolean {\n if (isBrowser()) {\n return PLATFORMS_MAP[name](window) || false;\n } else {\n return false;\n }\n }\n\n get screenSize(): AXScreenSizes {\n return (['SM', 'MD', 'LG', 'XL', '2XL', '3XL', '4XL'].find((name) => PLATFORMS_MAP[name](window) == true) || '5XL') as AXScreenSizes;\n }\n\n switchLightMode() {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n localStorage.setItem('AX_THEME_MODE', 'light');\n this.themeMode$.next('light');\n this.themeMode.set('light');\n return 'light';\n }\n\n switchDarkMode() {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n localStorage.setItem('AX_THEME_MODE', 'dark');\n this.themeMode$.next('dark');\n this.themeMode.set('dark');\n }\n\n switchSystemMode() {\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n localStorage.setItem('AX_THEME_MODE', 'system');\n this.themeMode$.next('system');\n this.themeMode.set('system');\n }\n\n autoDetectThemeMode() {\n const mode = localStorage.getItem('AX_THEME_MODE') || 'system';\n switch (mode) {\n case 'light':\n return this.switchLightMode();\n\n case 'dark':\n return this.switchDarkMode();\n\n case 'system':\n return this.switchSystemMode();\n }\n }\n\n private _setFullHeightRatio() {\n if (isBrowser()) {\n try {\n document.querySelector<HTMLElement>(':root')?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');\n } catch (error) {\n console.error(error);\n }\n }\n }\n\n private autoSystemModeDetection(event) {\n if (this.themeMode() === 'system') {\n const themeMode = event.matches ? 'dark' : 'light';\n\n if (themeMode === 'dark') {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n }\n }\n\n constructor() {\n if (isBrowser()) {\n fromEvent<UIEvent>(window, 'resize')\n .pipe(debounceTime(100))\n .pipe(distinctUntilChanged())\n .subscribe((e) => {\n this.resize.next({\n nativeEvent: e,\n source: this,\n });\n //\n this._setFullHeightRatio();\n });\n if (window?.matchMedia('(prefers-color-scheme: dark)').matches) {\n window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', (event) => {\n // Detect System color mode\n this.autoSystemModeDetection(event);\n });\n }\n document.addEventListener(\n 'click',\n (e) => {\n this.click.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n\n document.addEventListener(\n 'scroll',\n (e) => {\n this.scroll.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n\n // init functions\n this._setFullHeightRatio();\n }\n }\n}\n","/**\n * Generated bundle index.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AC,KAAI;AACJ,gBAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AACf,oBAAA,WAAW,EAAE,CAAC;AACd,oBAAA,MAAM,EAAE,IAAI;AACb,iBAAA,CAAC,CAAC;aACJ,EACD,IAAI,CACL,CAAC;;YAGF,IAAI,CAAC,mBAAmB,EAAE,CAAC;SAC5B;KACF;8GAnJU,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAAV,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cAFT,MAAM,EAAA,CAAA,CAAA,EAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;ACpID;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-core-platform.mjs","sources":["../../../../libs/core/platform/src/lib/platform.service.ts","../../../../libs/core/platform/src/acorex-core-platform.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\nimport { BehaviorSubject, Subject, fromEvent } from 'rxjs';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\nexport type AXThemeMode = 'light' | 'dark' | 'system';\nexport type AXPlatforms = 'Android' | 'Desktop' | 'iOS' | 'Mobile';\nexport type AXBrowsers = 'Chrome' | 'Safari' | 'Edge' | 'Firefox' | 'Opera' | 'MSIE';\nexport type AXTechnologies = 'PWA' | 'Hybrid' | 'Electron';\n\nexport type AXScreenSizes = 'SM' | 'MD' | 'LG' | 'XL' | '2XL' | '3XL' | '4XL' | '5XL';\n\nconst isChrome = (win: Window): boolean => testUserAgent(win, /Chrome/i);\n\nconst isFirefox = (win: Window): boolean => testUserAgent(win, /Firefox/i);\n\nconst isEdge = (win: Window): boolean => testUserAgent(win, /Edge/i);\n\nconst isSafari = (win: Window): boolean => testUserAgent(win, /Safari/i);\n\nconst isOpera = (win: Window): boolean => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);\n\nconst isMSIE = (win: Window): boolean => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);\n\nconst isMobileWeb = (win: Window): boolean => isMobile(win) && !isHybrid(win);\n\nconst isIpad = (win: Window) => {\n // iOS 12 and below\n if (testUserAgent(win, /iPad/i)) {\n return true;\n }\n\n // iOS 13+\n if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {\n return true;\n }\n\n return false;\n};\n\nconst isIphone = (win: Window) => testUserAgent(win, /iPhone/i);\n\nconst isIOS = (win: Window) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);\n\nconst isAndroid = (win: Window) => testUserAgent(win, /android|sink/i);\n\nconst isAndroidTablet = (win: Window) => {\n return isAndroid(win) && !testUserAgent(win, /mobile/i);\n};\n\nconst isPhablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;\n};\n\nconst isTablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return isIpad(win) || isAndroidTablet(win) || (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400);\n};\n\nconst isMobile = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\nconst isTouch = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\n\nconst isDesktop = (win: Window) => !isMobile(win);\n\nconst isHybrid = (win: Window) => isCordova(win) || isCapacitorNative(win);\n\nconst isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);\n\nconst isCapacitorNative = (win: any): boolean => {\n const capacitor = win['Capacitor'];\n return !!(capacitor && capacitor.isNative);\n};\n\nconst isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);\n\nconst isPWA = (win: Window): boolean => !!(win.matchMedia('(display-mode: standalone)').matches || (win.navigator as any).standalone);\n\nexport const testUserAgent = (win: Window, expr: RegExp) => expr.test(win.navigator.userAgent);\n\nexport const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');\nexport const isServer = new Function('try {return this===global;}catch(e){return false;}');\n\nconst matchMedia = (win: Window, query: string): boolean => {\n return win.matchMedia(query).matches;\n};\n\nconst isSMScreen = (win: Window) => matchMedia(win, '(max-width: 578px)');\nconst isMDScreen = (win: Window) => matchMedia(win, '(max-width: 768px)');\nconst isLGScreen = (win: Window) => matchMedia(win, '(max-width: 992px)');\nconst isXLScreen = (win: Window) => matchMedia(win, '(max-width: 1200px)');\nconst is2XLScreen = (win: Window) => matchMedia(win, '(max-width: 1440px)');\nconst is3XLScreen = (win: Window) => matchMedia(win, '(max-width: 1920px)');\nconst is4XLScreen = (win: Window) => matchMedia(win, '(max-width: 2560px)');\n\nconst PLATFORMS_MAP: any = {\n Android: isAndroid,\n iOS: isIOS,\n Desktop: isDesktop,\n Mobile: isMobile,\n Touch: isTouch,\n Chrome: isChrome,\n Firefox: isFirefox,\n Safari: isSafari,\n Edge: isEdge,\n Opera: isOpera,\n Hybrid: isHybrid,\n PWA: isPWA,\n Electron: isElectron,\n SM: isSMScreen,\n MD: isMDScreen,\n LG: isLGScreen,\n XL: isXLScreen,\n '2XL': is2XLScreen,\n '3XL': is3XLScreen,\n '4XL': is4XLScreen,\n};\n\nexport class AXPlatformEvent<T extends Event = Event> {\n nativeEvent!: T;\n source!: AXPlatform;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPlatform {\n resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n click: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n scroll: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n /**\n * @deprecated The themeMode property is deprecated, use themeMode\n */\n themeMode$: BehaviorSubject<AXThemeMode> = new BehaviorSubject<AXThemeMode>('system');\n\n themeMode = signal<AXThemeMode>('system');\n\n isRtl(): boolean {\n return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';\n }\n\n isLandscape(): boolean {\n return window.innerHeight < window.innerWidth;\n }\n\n isPortrate(): boolean {\n return !this.isLandscape();\n }\n\n is(name: AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes): boolean {\n if (isBrowser()) {\n return PLATFORMS_MAP[name](window) || false;\n } else {\n return false;\n }\n }\n\n get screenSize(): AXScreenSizes {\n return (['SM', 'MD', 'LG', 'XL', '2XL', '3XL', '4XL'].find((name) => PLATFORMS_MAP[name](window) == true) || '5XL') as AXScreenSizes;\n }\n\n switchLightMode() {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n localStorage.setItem('AX_THEME_MODE', 'light');\n this.themeMode$.next('light');\n this.themeMode.set('light');\n return 'light';\n }\n\n switchDarkMode() {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n localStorage.setItem('AX_THEME_MODE', 'dark');\n this.themeMode$.next('dark');\n this.themeMode.set('dark');\n return 'dark';\n }\n\n switchSystemMode() {\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n localStorage.setItem('AX_THEME_MODE', 'system');\n this.themeMode$.next('system');\n this.themeMode.set('system');\n }\n\n autoDetectThemeMode() {\n const mode = localStorage.getItem('AX_THEME_MODE') || 'system';\n switch (mode) {\n case 'light':\n return this.switchLightMode();\n\n case 'dark':\n return this.switchDarkMode();\n\n case 'system':\n return this.switchSystemMode();\n }\n }\n\n private _setFullHeightRatio() {\n if (isBrowser()) {\n try {\n document.querySelector<HTMLElement>(':root')?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');\n } catch (error) {\n console.error(error);\n }\n }\n }\n\n private autoSystemModeDetection(event) {\n if (this.themeMode() === 'system') {\n const themeMode = event.matches ? 'dark' : 'light';\n\n if (themeMode === 'dark') {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n }\n }\n\n constructor() {\n if (isBrowser()) {\n fromEvent<UIEvent>(window, 'resize')\n .pipe(debounceTime(100))\n .pipe(distinctUntilChanged())\n .subscribe((e) => {\n this.resize.next({\n nativeEvent: e,\n source: this,\n });\n //\n this._setFullHeightRatio();\n });\n if (window?.matchMedia('(prefers-color-scheme: dark)').matches) {\n window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', (event) => {\n // Detect System color mode\n this.autoSystemModeDetection(event);\n });\n }\n document.addEventListener(\n 'click',\n (e) => {\n this.click.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n\n document.addEventListener(\n 'scroll',\n (e) => {\n this.scroll.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n\n // init functions\n this._setFullHeightRatio();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAWA,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAEzE,MAAM,SAAS,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAE3E,MAAM,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAErE,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAEzE,MAAM,OAAO,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,QA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OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cAFT,MAAM,EAAA,CAAA,CAAA,EAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;ACpID;;AAEG;;;;"}
|
@@ -67,9 +67,7 @@ class AXCookieStorageService {
|
|
67
67
|
name = encodeURIComponent(name);
|
68
68
|
const regExp = AXCookieStorageService.getCookieRegExp(name);
|
69
69
|
const result = regExp.exec(this.document.cookie);
|
70
|
-
return result[1]
|
71
|
-
? AXCookieStorageService.safeDecodeURIComponent(result[1])
|
72
|
-
: '';
|
70
|
+
return result[1] ? AXCookieStorageService.safeDecodeURIComponent(result[1]) : '';
|
73
71
|
}
|
74
72
|
else {
|
75
73
|
return '';
|
@@ -90,7 +88,8 @@ class AXCookieStorageService {
|
|
90
88
|
if (document.cookie && document.cookie !== '') {
|
91
89
|
document.cookie.split(';').forEach((currentCookie) => {
|
92
90
|
const [cookieName, cookieValue] = currentCookie.split('=');
|
93
|
-
cookies[AXCookieStorageService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] =
|
91
|
+
cookies[AXCookieStorageService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] =
|
92
|
+
AXCookieStorageService.safeDecodeURIComponent(cookieValue);
|
94
93
|
});
|
95
94
|
}
|
96
95
|
return cookies;
|
@@ -99,12 +98,7 @@ class AXCookieStorageService {
|
|
99
98
|
if (!this.documentIsAccessible) {
|
100
99
|
return;
|
101
100
|
}
|
102
|
-
if (typeof expiresOrOptions === 'number' ||
|
103
|
-
expiresOrOptions instanceof Date ||
|
104
|
-
path ||
|
105
|
-
domain ||
|
106
|
-
secure ||
|
107
|
-
sameSite) {
|
101
|
+
if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) {
|
108
102
|
const optionsBody = {
|
109
103
|
expires: expiresOrOptions,
|
110
104
|
path,
|
@@ -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 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,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;A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AC,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
|
+
{"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('(?:^' + escapedName + '|;\\\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');\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] ? AXCookieStorageService.safeDecodeURIComponent(result[1]) : '';\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[AXCookieStorageService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] =\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 (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) {\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 = 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(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24);\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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