@acorex/core 7.0.19 → 7.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/config/ax-preset.js +186 -0
  2. package/config/index.ts +1 -0
  3. package/config/ng-package.json +6 -0
  4. package/config/public-api.ts +1 -0
  5. package/config/src/configs.ts +37 -0
  6. package/dateTime/index.ts +1 -0
  7. package/dateTime/ng-package.json +6 -0
  8. package/dateTime/{public-api.d.ts → public-api.ts} +1 -1
  9. package/dateTime/src/datetime.class.ts +449 -0
  10. package/dateTime/src/datetime.module.ts +35 -0
  11. package/dateTime/src/datetime.pipe.ts +21 -0
  12. package/dateTime/src/georgian.calendar.ts +205 -0
  13. package/dateTime/src/jalali.calendar.ts +416 -0
  14. package/events/index.ts +1 -0
  15. package/events/ng-package.json +6 -0
  16. package/events/public-api.ts +1 -0
  17. package/events/src/event.service.ts +31 -0
  18. package/file/index.ts +1 -0
  19. package/file/ng-package.json +7 -0
  20. package/file/public-api.ts +4 -0
  21. package/file/src/file-download-ref.class.ts +16 -0
  22. package/file/src/file-download-result.class.ts +56 -0
  23. package/file/src/file-upload-ref.class.ts +14 -0
  24. package/file/src/file.service.ts +104 -0
  25. package/http/index.ts +1 -0
  26. package/http/ng-package.json +6 -0
  27. package/http/{public-api.d.ts → public-api.ts} +1 -1
  28. package/http/src/{http-error.class.d.ts → http-error.class.ts} +2 -2
  29. package/http/src/{http-events.interceptor.d.ts → http-events.interceptor.ts} +7 -3
  30. package/http/src/{http-request.class.d.ts → http-request.class.ts} +5 -5
  31. package/http/src/http-result.class.ts +34 -0
  32. package/http/src/http.module.ts +25 -0
  33. package/http/src/http.service.ts +161 -0
  34. package/image/index.ts +1 -0
  35. package/image/ng-package.json +7 -0
  36. package/image/public-api.ts +1 -0
  37. package/image/src/image.service.ts +42 -0
  38. package/index.ts +1 -0
  39. package/karma.conf.js +44 -0
  40. package/ng-package.json +7 -0
  41. package/package.json +16 -115
  42. package/pipes/index.ts +1 -0
  43. package/pipes/ng-package.json +6 -0
  44. package/pipes/public-api.ts +2 -0
  45. package/pipes/src/pipes.module.ts +11 -0
  46. package/pipes/src/safe.pipe.ts +24 -0
  47. package/platform/index.ts +1 -0
  48. package/platform/ng-package.json +6 -0
  49. package/platform/public-api.ts +1 -0
  50. package/platform/src/platform.service.ts +223 -0
  51. package/public-api.ts +4 -0
  52. package/test.ts +27 -0
  53. package/translation/index.ts +1 -0
  54. package/translation/ng-package.json +6 -0
  55. package/translation/{public-api.d.ts → public-api.ts} +1 -1
  56. package/translation/src/translation.module.ts +12 -0
  57. package/translation/src/translator.pipe.ts +9 -0
  58. package/translation/src/translator.ts +49 -0
  59. package/tsconfig.lib.json +15 -0
  60. package/tsconfig.lib.prod.json +10 -0
  61. package/tsconfig.spec.json +17 -0
  62. package/utils/index.ts +1 -0
  63. package/utils/ng-package.json +6 -0
  64. package/utils/{public-api.d.ts → public-api.ts} +1 -1
  65. package/utils/src/color-util.ts +83 -0
  66. package/utils/src/drawing-util.ts +43 -0
  67. package/utils/src/object-util.ts +82 -0
  68. package/utils/src/string-util.ts +25 -0
  69. package/config/index.d.ts +0 -5
  70. package/config/public-api.d.ts +0 -1
  71. package/config/src/configs.d.ts +0 -9
  72. package/dateTime/index.d.ts +0 -5
  73. package/dateTime/src/datetime.class.d.ts +0 -100
  74. package/dateTime/src/datetime.module.d.ts +0 -8
  75. package/dateTime/src/datetime.pipe.d.ts +0 -8
  76. package/dateTime/src/georgian.calendar.d.ts +0 -20
  77. package/dateTime/src/jalali.calendar.d.ts +0 -35
  78. package/esm2020/acorex-core.mjs +0 -5
  79. package/esm2020/config/acorex-core-config.mjs +0 -5
  80. package/esm2020/config/public-api.mjs +0 -2
  81. package/esm2020/config/src/configs.mjs +0 -32
  82. package/esm2020/dateTime/acorex-core-dateTime.mjs +0 -5
  83. package/esm2020/dateTime/public-api.mjs +0 -6
  84. package/esm2020/dateTime/src/datetime.class.mjs +0 -288
  85. package/esm2020/dateTime/src/datetime.module.mjs +0 -39
  86. package/esm2020/dateTime/src/datetime.pipe.mjs +0 -26
  87. package/esm2020/dateTime/src/georgian.calendar.mjs +0 -189
  88. package/esm2020/dateTime/src/jalali.calendar.mjs +0 -359
  89. package/esm2020/events/acorex-core-events.mjs +0 -5
  90. package/esm2020/events/public-api.mjs +0 -2
  91. package/esm2020/events/src/event.service.mjs +0 -36
  92. package/esm2020/file/acorex-core-file.mjs +0 -5
  93. package/esm2020/file/public-api.mjs +0 -5
  94. package/esm2020/file/src/file-download-ref.class.mjs +0 -12
  95. package/esm2020/file/src/file-download-result.class.mjs +0 -47
  96. package/esm2020/file/src/file-upload-ref.class.mjs +0 -12
  97. package/esm2020/file/src/file.service.mjs +0 -101
  98. package/esm2020/http/acorex-core-http.mjs +0 -5
  99. package/esm2020/http/public-api.mjs +0 -6
  100. package/esm2020/http/src/http-error.class.mjs +0 -2
  101. package/esm2020/http/src/http-events.interceptor.mjs +0 -3
  102. package/esm2020/http/src/http-request.class.mjs +0 -2
  103. package/esm2020/http/src/http-result.class.mjs +0 -21
  104. package/esm2020/http/src/http.module.mjs +0 -29
  105. package/esm2020/http/src/http.service.mjs +0 -148
  106. package/esm2020/image/acorex-core-image.mjs +0 -5
  107. package/esm2020/image/public-api.mjs +0 -2
  108. package/esm2020/image/src/image.service.mjs +0 -43
  109. package/esm2020/pipes/acorex-core-pipes.mjs +0 -5
  110. package/esm2020/pipes/public-api.mjs +0 -3
  111. package/esm2020/pipes/src/pipes.module.mjs +0 -19
  112. package/esm2020/pipes/src/safe.pipe.mjs +0 -30
  113. package/esm2020/platform/acorex-core-platform.mjs +0 -5
  114. package/esm2020/platform/public-api.mjs +0 -2
  115. package/esm2020/platform/src/platform.service.mjs +0 -153
  116. package/esm2020/public-api.mjs +0 -5
  117. package/esm2020/translation/acorex-core-translation.mjs +0 -5
  118. package/esm2020/translation/public-api.mjs +0 -4
  119. package/esm2020/translation/src/translation.module.mjs +0 -18
  120. package/esm2020/translation/src/translator.mjs +0 -43
  121. package/esm2020/translation/src/translator.pipe.mjs +0 -15
  122. package/esm2020/utils/acorex-core-utils.mjs +0 -5
  123. package/esm2020/utils/public-api.mjs +0 -5
  124. package/esm2020/utils/src/color-util.mjs +0 -71
  125. package/esm2020/utils/src/drawing-util.mjs +0 -27
  126. package/esm2020/utils/src/object-util.mjs +0 -39
  127. package/esm2020/utils/src/string-util.mjs +0 -19
  128. package/events/index.d.ts +0 -5
  129. package/events/public-api.d.ts +0 -1
  130. package/events/src/event.service.d.ts +0 -9
  131. package/fesm2015/acorex-core-config.mjs +0 -40
  132. package/fesm2015/acorex-core-config.mjs.map +0 -1
  133. package/fesm2015/acorex-core-dateTime.mjs +0 -899
  134. package/fesm2015/acorex-core-dateTime.mjs.map +0 -1
  135. package/fesm2015/acorex-core-events.mjs +0 -44
  136. package/fesm2015/acorex-core-events.mjs.map +0 -1
  137. package/fesm2015/acorex-core-file.mjs +0 -177
  138. package/fesm2015/acorex-core-file.mjs.map +0 -1
  139. package/fesm2015/acorex-core-http.mjs +0 -203
  140. package/fesm2015/acorex-core-http.mjs.map +0 -1
  141. package/fesm2015/acorex-core-image.mjs +0 -54
  142. package/fesm2015/acorex-core-image.mjs.map +0 -1
  143. package/fesm2015/acorex-core-pipes.mjs +0 -54
  144. package/fesm2015/acorex-core-pipes.mjs.map +0 -1
  145. package/fesm2015/acorex-core-platform.mjs +0 -161
  146. package/fesm2015/acorex-core-platform.mjs.map +0 -1
  147. package/fesm2015/acorex-core-translation.mjs +0 -81
  148. package/fesm2015/acorex-core-translation.mjs.map +0 -1
  149. package/fesm2015/acorex-core-utils.mjs +0 -164
  150. package/fesm2015/acorex-core-utils.mjs.map +0 -1
  151. package/fesm2015/acorex-core.mjs +0 -12
  152. package/fesm2015/acorex-core.mjs.map +0 -1
  153. package/fesm2020/acorex-core-config.mjs +0 -40
  154. package/fesm2020/acorex-core-config.mjs.map +0 -1
  155. package/fesm2020/acorex-core-dateTime.mjs +0 -899
  156. package/fesm2020/acorex-core-dateTime.mjs.map +0 -1
  157. package/fesm2020/acorex-core-events.mjs +0 -44
  158. package/fesm2020/acorex-core-events.mjs.map +0 -1
  159. package/fesm2020/acorex-core-file.mjs +0 -177
  160. package/fesm2020/acorex-core-file.mjs.map +0 -1
  161. package/fesm2020/acorex-core-http.mjs +0 -202
  162. package/fesm2020/acorex-core-http.mjs.map +0 -1
  163. package/fesm2020/acorex-core-image.mjs +0 -51
  164. package/fesm2020/acorex-core-image.mjs.map +0 -1
  165. package/fesm2020/acorex-core-pipes.mjs +0 -54
  166. package/fesm2020/acorex-core-pipes.mjs.map +0 -1
  167. package/fesm2020/acorex-core-platform.mjs +0 -161
  168. package/fesm2020/acorex-core-platform.mjs.map +0 -1
  169. package/fesm2020/acorex-core-translation.mjs +0 -80
  170. package/fesm2020/acorex-core-translation.mjs.map +0 -1
  171. package/fesm2020/acorex-core-utils.mjs +0 -164
  172. package/fesm2020/acorex-core-utils.mjs.map +0 -1
  173. package/fesm2020/acorex-core.mjs +0 -12
  174. package/fesm2020/acorex-core.mjs.map +0 -1
  175. package/file/index.d.ts +0 -5
  176. package/file/public-api.d.ts +0 -4
  177. package/file/src/file-download-ref.class.d.ts +0 -6
  178. package/file/src/file-download-result.class.d.ts +0 -8
  179. package/file/src/file-upload-ref.class.d.ts +0 -5
  180. package/file/src/file.service.d.ts +0 -18
  181. package/http/index.d.ts +0 -5
  182. package/http/src/http-result.class.d.ts +0 -11
  183. package/http/src/http.module.d.ts +0 -8
  184. package/http/src/http.service.d.ts +0 -23
  185. package/image/index.d.ts +0 -5
  186. package/image/public-api.d.ts +0 -1
  187. package/image/src/image.service.d.ts +0 -12
  188. package/index.d.ts +0 -5
  189. package/pipes/index.d.ts +0 -5
  190. package/pipes/public-api.d.ts +0 -2
  191. package/pipes/src/pipes.module.d.ts +0 -8
  192. package/pipes/src/safe.pipe.d.ts +0 -10
  193. package/platform/index.d.ts +0 -5
  194. package/platform/public-api.d.ts +0 -1
  195. package/platform/src/platform.service.d.ts +0 -26
  196. package/public-api.d.ts +0 -1
  197. package/translation/index.d.ts +0 -5
  198. package/translation/src/translation.module.d.ts +0 -7
  199. package/translation/src/translator.d.ts +0 -11
  200. package/translation/src/translator.pipe.d.ts +0 -7
  201. package/utils/index.d.ts +0 -5
  202. package/utils/src/color-util.d.ts +0 -20
  203. package/utils/src/drawing-util.d.ts +0 -17
  204. package/utils/src/object-util.d.ts +0 -4
  205. package/utils/src/string-util.d.ts +0 -6
@@ -3,5 +3,5 @@ export interface IHttpError {
3
3
  status?: number;
4
4
  code?: string;
5
5
  handled: boolean;
6
- error: any | null;
7
- }
6
+ error: any | null
7
+ }
@@ -1,10 +1,14 @@
1
1
  import { IHttpError } from './http-error.class';
2
2
  import { InjectionToken } from '@angular/core';
3
3
  import { AXHttpRequestOptions } from './http-request.class';
4
- export declare const AX_HTTP_EVENT_INTERCEPTOR: InjectionToken<AXHttpEventInterceptor>;
4
+
5
+ export const AX_HTTP_EVENT_INTERCEPTOR = new InjectionToken<AXHttpEventInterceptor>('ax.http.events');
6
+
5
7
  export interface AXHttpEventInterceptor {
6
8
  begin(request: AXHttpRequestOptions): Promise<AXHttpRequestOptions>;
7
9
  success(request: AXHttpRequestOptions, result: any): Promise<any>;
8
- complete(request: AXHttpRequestOptions): any;
9
- error(request: AXHttpRequestOptions, error: IHttpError): any;
10
+ complete(request: AXHttpRequestOptions);
11
+ error(request: AXHttpRequestOptions, error: IHttpError);
10
12
  }
13
+
14
+
@@ -1,14 +1,14 @@
1
1
  export interface AXHttpRequestOptions {
2
- url?: any;
2
+ url?: any,
3
3
  params?: {
4
4
  [param: string]: any;
5
- };
5
+ },
6
6
  body?: {
7
7
  [param: string]: any;
8
- };
8
+ },
9
9
  headers?: {
10
10
  [header: string]: any;
11
- };
11
+ },
12
12
  method?: 'get' | 'post' | 'put' | 'delete';
13
13
  responseType?: any;
14
- }
14
+ }
@@ -0,0 +1,34 @@
1
+ import { IHttpError } from './http-error.class';
2
+
3
+ export class HttpResult<T> {
4
+ private _executor: (result: (e?: T) => void, error: (e?: IHttpError) => void, complete: () => void) => void;
5
+ constructor(
6
+ executor: (
7
+ result: (e?: T) => void,
8
+ error: (e?: IHttpError) => void,
9
+ complete: () => void
10
+ ) => void
11
+ ) {
12
+ this._executor = executor;
13
+ setTimeout(() => {
14
+ this._executor(this.resultAction, this.errorAction, this.completeAction);
15
+ }, 50);
16
+ }
17
+
18
+ private resultAction: (e?: T) => void;
19
+ private errorAction: (e?: IHttpError) => void;
20
+ private completeAction: () => void;
21
+
22
+ result(action: (e?: T) => void): HttpResult<T> {
23
+ this.resultAction = action;
24
+ return this;
25
+ }
26
+ error(action: (e?: IHttpError) => void): HttpResult<T> {
27
+ this.errorAction = action;
28
+ return this;
29
+ }
30
+ complete(action: () => void): HttpResult<T> {
31
+ this.completeAction = action;
32
+ return this;
33
+ }
34
+ }
@@ -0,0 +1,25 @@
1
+ import { NgModule, ModuleWithProviders } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { HttpClientModule } from '@angular/common/http';
4
+ import { AXHttpService } from './http.service';
5
+
6
+
7
+ @NgModule({
8
+ declarations: [],
9
+ imports: [
10
+ CommonModule,
11
+ HttpClientModule
12
+ ],
13
+ exports: [HttpClientModule],
14
+ providers: [
15
+ AXHttpService
16
+ ]
17
+ })
18
+ export class AXHttpModule {
19
+ // static forRoot(): ModuleWithProviders {
20
+ // return {
21
+ // ngModule: AXHttpModule,
22
+ // providers: [AXHttpService]
23
+ // };
24
+ // }
25
+ }
@@ -0,0 +1,161 @@
1
+ import { Injectable, Injector, InjectFlags } from '@angular/core';
2
+ import { HttpClient, HttpHeaders, HttpParams, HttpErrorResponse } from '@angular/common/http';
3
+ import { HttpResult } from './http-result.class';
4
+ import { IHttpError } from './http-error.class';
5
+ import { AXHttpRequestOptions } from './http-request.class';
6
+ import {
7
+ AX_HTTP_EVENT_INTERCEPTOR, AXHttpEventInterceptor
8
+ } from './http-events.interceptor';
9
+ // import { catchError, retry, retryWhen, mergeMap, delay, switchMap, scan, takeWhile, flatMap } from 'rxjs/operators';
10
+ // import { of, concat, throwError } from 'rxjs';
11
+
12
+
13
+ @Injectable({ providedIn: 'root' })
14
+ export class AXHttpService {
15
+
16
+ private interceptor: AXHttpEventInterceptor;
17
+ constructor(private http: HttpClient, private injector: Injector) {
18
+ this.interceptor = this.injector.get(AX_HTTP_EVENT_INTERCEPTOR);
19
+ }
20
+
21
+
22
+ get<T>(url: string, config: AXHttpRequestOptions = {}): HttpResult<T> {
23
+ config.url = url;
24
+ config.method = "get";
25
+ return this.request(config);
26
+ }
27
+
28
+ post<T>(url: string, config: AXHttpRequestOptions = {}): HttpResult<T> {
29
+ config.url = url;
30
+ config.method = "post";
31
+ return this.request(config);
32
+ }
33
+
34
+ delete<T>(url: string, config: AXHttpRequestOptions = {}): HttpResult<T> {
35
+ config.url = url;
36
+ config.method = "delete";
37
+ return this.request(config);
38
+ }
39
+
40
+ put<T>(url: string, config: AXHttpRequestOptions = {}): HttpResult<T> {
41
+ config.url = url;
42
+ config.method = "put";
43
+ return this.request(config);
44
+ }
45
+
46
+
47
+ request<T>(config: AXHttpRequestOptions): HttpResult<T> {
48
+ return new HttpResult<T>((result?, error?, complete?) => {
49
+ this.handleBegin(config).then(c => {
50
+ this.http
51
+ //TODO: check ts error
52
+ //@ts-ignore
53
+ .request<T>(config.method, config.url, this.mapOptions(config))
54
+ //.pipe(this.retry)
55
+ .subscribe(data => {
56
+ this.handleResult(data, result, complete, config);
57
+ }, c => {
58
+ this.handleError(c, error, complete, config);
59
+ });
60
+ });
61
+ })
62
+ }
63
+
64
+
65
+ private handleResult(data, result, complete, config: AXHttpRequestOptions) {
66
+ if (this.interceptor) {
67
+ this.interceptor.success(config, data).then(c => {
68
+ if (result)
69
+ result(c);
70
+ this.handleComplete(complete, config);
71
+ });
72
+ }
73
+ else {
74
+ //
75
+ if (result)
76
+ result(data);
77
+ this.handleComplete(complete, config);
78
+ }
79
+ }
80
+
81
+ private handleBegin(config: AXHttpRequestOptions): Promise<AXHttpRequestOptions> {
82
+ return new Promise((resolve) => {
83
+ if (!config.headers)
84
+ config.headers = {};
85
+ if (!config.params)
86
+ config.params = {};
87
+ //
88
+ if (this.interceptor) {
89
+ this.interceptor.begin(config).then(c => {
90
+ resolve(c);
91
+ });
92
+ }
93
+ else {
94
+ resolve(config)
95
+ }
96
+ })
97
+ }
98
+
99
+ private handleComplete(complete: Function, config: AXHttpRequestOptions) {
100
+ if (complete)
101
+ complete();
102
+ if (this.interceptor)
103
+ this.interceptor.complete(config);
104
+ }
105
+
106
+ private handleError(c: HttpErrorResponse, error: Function, complete: Function, config: AXHttpRequestOptions) {
107
+ let r: IHttpError = {
108
+ message: c.message,
109
+ status: c.status,
110
+ code: c.status?.toString(),
111
+ handled: false,
112
+ error: c.error
113
+ }
114
+ if (error) {
115
+ error(r);
116
+ }
117
+ if (!r.handled) {
118
+ if (this.interceptor)
119
+ this.interceptor.error(config, r);
120
+ }
121
+ this.handleComplete(complete, config);
122
+ }
123
+
124
+ private mapOptions(options: AXHttpRequestOptions) {
125
+ let headers = new HttpHeaders();
126
+
127
+ for (const key in options.headers) {
128
+ if (options.headers.hasOwnProperty(key)) {
129
+ const value = options.headers[key];
130
+ headers = headers.set(key, value)
131
+ }
132
+ }
133
+ let params = new HttpParams();
134
+ for (const key in options.params) {
135
+ if (options.params.hasOwnProperty(key)) {
136
+ const value = options.params[key];
137
+ params = params.set(key, value);
138
+ }
139
+ }
140
+ return {
141
+ headers: headers,
142
+ params: params,
143
+ body: options.body,
144
+ responseType: options.responseType || 'json'
145
+ };
146
+ // if (options.method == "get") {
147
+ // return {
148
+ // headers: headers,
149
+ // params: params
150
+ // };
151
+ // }
152
+ // else {
153
+ // return {
154
+ // headers: headers,
155
+ // params: params,
156
+ // body: options.body
157
+ // };
158
+ // }
159
+ }
160
+
161
+ }
package/image/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './public-api';
@@ -0,0 +1,7 @@
1
+
2
+ {
3
+ "$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json",
4
+ "lib": {
5
+ "entryFile": "public-api.ts"
6
+ }
7
+ }
@@ -0,0 +1 @@
1
+ export * from './src/image.service';
@@ -0,0 +1,42 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ @Injectable({ providedIn: 'root' })
4
+ export class AXImageService {
5
+ constructor() { }
6
+
7
+
8
+ async resize(options: { maxSize: number, source: HTMLImageElement | File, type?: 'image/png' | 'image/jpeg' | 'image/webp', quality?: number }): Promise<Blob> {
9
+ options = Object.assign({ type: 'image/png', quality: 1 }, options);
10
+
11
+ let image: HTMLImageElement;
12
+ if (options.source instanceof File) {
13
+ var a = new Image()
14
+ a.src = URL.createObjectURL(options.source);
15
+ await new Promise<Event>((res) => a.onload = res);
16
+ image = a;
17
+ }
18
+ else {
19
+ image = options.source;
20
+ }
21
+
22
+ // Resize the image
23
+ var canvas = document.createElement('canvas'),
24
+ width = image.width,
25
+ height = image.height;
26
+ if (width > height) {
27
+ if (width > options.maxSize) {
28
+ height *= options.maxSize / width;
29
+ width = options.maxSize;
30
+ }
31
+ } else {
32
+ if (height > options.maxSize) {
33
+ width *= options.maxSize / height;
34
+ height = options.maxSize;
35
+ }
36
+ }
37
+ canvas.width = width;
38
+ canvas.height = height;
39
+ canvas.getContext('2d').drawImage(image, 0, 0, width, height);
40
+ return new Promise((resolve) => canvas.toBlob(resolve, options.type, options.quality));
41
+ }
42
+ }
package/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './public-api'
package/karma.conf.js ADDED
@@ -0,0 +1,44 @@
1
+ // Karma configuration file, see link for more information
2
+ // https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+ module.exports = function (config) {
5
+ config.set({
6
+ basePath: '',
7
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+ plugins: [
9
+ require('karma-jasmine'),
10
+ require('karma-chrome-launcher'),
11
+ require('karma-jasmine-html-reporter'),
12
+ require('karma-coverage'),
13
+ require('@angular-devkit/build-angular/plugins/karma')
14
+ ],
15
+ client: {
16
+ jasmine: {
17
+ // you can add configuration options for Jasmine here
18
+ // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
+ // for example, you can disable the random execution with `random: false`
20
+ // or set a specific seed with `seed: 4321`
21
+ },
22
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
23
+ },
24
+ jasmineHtmlReporter: {
25
+ suppressAll: true // removes the duplicated traces
26
+ },
27
+ coverageReporter: {
28
+ dir: require('path').join(__dirname, '../../../coverage/acorex/core'),
29
+ subdir: '.',
30
+ reporters: [
31
+ { type: 'html' },
32
+ { type: 'text-summary' }
33
+ ]
34
+ },
35
+ reporters: ['progress', 'kjhtml'],
36
+ port: 9876,
37
+ colors: true,
38
+ logLevel: config.LOG_INFO,
39
+ autoWatch: true,
40
+ browsers: ['Chrome'],
41
+ singleRun: false,
42
+ restartOnFileChange: true
43
+ });
44
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../../dist/acorex/core",
4
+ "lib": {
5
+ "entryFile": "public-api.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,115 +1,16 @@
1
- {
2
- "name": "@acorex/core",
3
- "version": "7.0.19",
4
- "dependencies": {
5
- "tslib": "^2.3.0"
6
- },
7
- "peerDependencies": {
8
- "@angular/common": "^15.0.4",
9
- "@angular/core": "^15.0.4",
10
- "lodash-es": "^4.17.21",
11
- "tinycolor2": "^1.4.2",
12
- "tinygradient": "^1.1.5"
13
- },
14
- "peerDependenciesMeta": {},
15
- "module": "fesm2015/acorex-core.mjs",
16
- "es2020": "fesm2020/acorex-core.mjs",
17
- "esm2020": "esm2020/acorex-core.mjs",
18
- "fesm2020": "fesm2020/acorex-core.mjs",
19
- "fesm2015": "fesm2015/acorex-core.mjs",
20
- "typings": "index.d.ts",
21
- "exports": {
22
- "./package.json": {
23
- "default": "./package.json"
24
- },
25
- ".": {
26
- "types": "./index.d.ts",
27
- "esm2020": "./esm2020/acorex-core.mjs",
28
- "es2020": "./fesm2020/acorex-core.mjs",
29
- "es2015": "./fesm2015/acorex-core.mjs",
30
- "node": "./fesm2015/acorex-core.mjs",
31
- "default": "./fesm2020/acorex-core.mjs"
32
- },
33
- "./config": {
34
- "types": "./config/index.d.ts",
35
- "esm2020": "./esm2020/config/acorex-core-config.mjs",
36
- "es2020": "./fesm2020/acorex-core-config.mjs",
37
- "es2015": "./fesm2015/acorex-core-config.mjs",
38
- "node": "./fesm2015/acorex-core-config.mjs",
39
- "default": "./fesm2020/acorex-core-config.mjs"
40
- },
41
- "./dateTime": {
42
- "types": "./dateTime/index.d.ts",
43
- "esm2020": "./esm2020/dateTime/acorex-core-dateTime.mjs",
44
- "es2020": "./fesm2020/acorex-core-dateTime.mjs",
45
- "es2015": "./fesm2015/acorex-core-dateTime.mjs",
46
- "node": "./fesm2015/acorex-core-dateTime.mjs",
47
- "default": "./fesm2020/acorex-core-dateTime.mjs"
48
- },
49
- "./events": {
50
- "types": "./events/index.d.ts",
51
- "esm2020": "./esm2020/events/acorex-core-events.mjs",
52
- "es2020": "./fesm2020/acorex-core-events.mjs",
53
- "es2015": "./fesm2015/acorex-core-events.mjs",
54
- "node": "./fesm2015/acorex-core-events.mjs",
55
- "default": "./fesm2020/acorex-core-events.mjs"
56
- },
57
- "./file": {
58
- "types": "./file/index.d.ts",
59
- "esm2020": "./esm2020/file/acorex-core-file.mjs",
60
- "es2020": "./fesm2020/acorex-core-file.mjs",
61
- "es2015": "./fesm2015/acorex-core-file.mjs",
62
- "node": "./fesm2015/acorex-core-file.mjs",
63
- "default": "./fesm2020/acorex-core-file.mjs"
64
- },
65
- "./http": {
66
- "types": "./http/index.d.ts",
67
- "esm2020": "./esm2020/http/acorex-core-http.mjs",
68
- "es2020": "./fesm2020/acorex-core-http.mjs",
69
- "es2015": "./fesm2015/acorex-core-http.mjs",
70
- "node": "./fesm2015/acorex-core-http.mjs",
71
- "default": "./fesm2020/acorex-core-http.mjs"
72
- },
73
- "./image": {
74
- "types": "./image/index.d.ts",
75
- "esm2020": "./esm2020/image/acorex-core-image.mjs",
76
- "es2020": "./fesm2020/acorex-core-image.mjs",
77
- "es2015": "./fesm2015/acorex-core-image.mjs",
78
- "node": "./fesm2015/acorex-core-image.mjs",
79
- "default": "./fesm2020/acorex-core-image.mjs"
80
- },
81
- "./pipes": {
82
- "types": "./pipes/index.d.ts",
83
- "esm2020": "./esm2020/pipes/acorex-core-pipes.mjs",
84
- "es2020": "./fesm2020/acorex-core-pipes.mjs",
85
- "es2015": "./fesm2015/acorex-core-pipes.mjs",
86
- "node": "./fesm2015/acorex-core-pipes.mjs",
87
- "default": "./fesm2020/acorex-core-pipes.mjs"
88
- },
89
- "./platform": {
90
- "types": "./platform/index.d.ts",
91
- "esm2020": "./esm2020/platform/acorex-core-platform.mjs",
92
- "es2020": "./fesm2020/acorex-core-platform.mjs",
93
- "es2015": "./fesm2015/acorex-core-platform.mjs",
94
- "node": "./fesm2015/acorex-core-platform.mjs",
95
- "default": "./fesm2020/acorex-core-platform.mjs"
96
- },
97
- "./translation": {
98
- "types": "./translation/index.d.ts",
99
- "esm2020": "./esm2020/translation/acorex-core-translation.mjs",
100
- "es2020": "./fesm2020/acorex-core-translation.mjs",
101
- "es2015": "./fesm2015/acorex-core-translation.mjs",
102
- "node": "./fesm2015/acorex-core-translation.mjs",
103
- "default": "./fesm2020/acorex-core-translation.mjs"
104
- },
105
- "./utils": {
106
- "types": "./utils/index.d.ts",
107
- "esm2020": "./esm2020/utils/acorex-core-utils.mjs",
108
- "es2020": "./fesm2020/acorex-core-utils.mjs",
109
- "es2015": "./fesm2015/acorex-core-utils.mjs",
110
- "node": "./fesm2015/acorex-core-utils.mjs",
111
- "default": "./fesm2020/acorex-core-utils.mjs"
112
- }
113
- },
114
- "sideEffects": false
115
- }
1
+ {
2
+ "name": "@acorex/core",
3
+ "version": "7.0.20",
4
+ "dependencies": {
5
+ "tslib": "^2.3.0"
6
+ },
7
+ "ngPackage": {},
8
+ "peerDependencies": {
9
+ "@angular/common": "^15.0.4",
10
+ "@angular/core": "^15.0.4",
11
+ "lodash-es": "^4.17.21",
12
+ "tinycolor2": "^1.4.2",
13
+ "tinygradient": "^1.1.5"
14
+ },
15
+ "peerDependenciesMeta": {}
16
+ }
package/pipes/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './public-api'
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "lib": {
4
+ "entryFile": "public-api.ts"
5
+ }
6
+ }
@@ -0,0 +1,2 @@
1
+ export * from './src/safe.pipe'
2
+ export * from './src/pipes.module'
@@ -0,0 +1,11 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { AXSafePipe } from './safe.pipe';
4
+
5
+ @NgModule({
6
+ declarations: [AXSafePipe],
7
+ imports: [CommonModule],
8
+ exports: [AXSafePipe],
9
+ providers: [],
10
+ })
11
+ export class AXPipesModule {}
@@ -0,0 +1,24 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+ import { DomSanitizer, SafeHtml, SafeStyle, SafeScript, SafeUrl, SafeResourceUrl } from '@angular/platform-browser';
3
+
4
+ @Pipe({
5
+ name: 'safe',
6
+ pure: true
7
+ })
8
+ export class AXSafePipe implements PipeTransform {
9
+
10
+ constructor(protected sanitizer: DomSanitizer) { }
11
+
12
+ public transform(value: any, type: string): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl {
13
+ if (value == null || value == undefined || value == '')
14
+ return '';
15
+ switch (type) {
16
+ case 'html': return this.sanitizer.bypassSecurityTrustHtml(value);
17
+ case 'style': return this.sanitizer.bypassSecurityTrustStyle(value);
18
+ case 'script': return this.sanitizer.bypassSecurityTrustScript(value);
19
+ case 'url': return this.sanitizer.bypassSecurityTrustUrl(value);
20
+ case 'resourceUrl': return this.sanitizer.bypassSecurityTrustResourceUrl(value);
21
+ default: throw new Error(`Invalid safe type specified: ${type}`);
22
+ }
23
+ }
24
+ }
@@ -0,0 +1 @@
1
+ export * from './public-api'
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "lib": {
4
+ "entryFile": "public-api.ts"
5
+ }
6
+ }
@@ -0,0 +1 @@
1
+ export * from './src/platform.service';