@acorex/core 7.0.20 → 7.0.22

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/index.d.ts +5 -0
  2. package/config/public-api.d.ts +1 -0
  3. package/config/src/configs.d.ts +9 -0
  4. package/dateTime/index.d.ts +5 -0
  5. package/dateTime/{public-api.ts → public-api.d.ts} +1 -1
  6. package/dateTime/src/datetime.class.d.ts +100 -0
  7. package/dateTime/src/datetime.module.d.ts +8 -0
  8. package/dateTime/src/datetime.pipe.d.ts +8 -0
  9. package/dateTime/src/georgian.calendar.d.ts +20 -0
  10. package/dateTime/src/jalali.calendar.d.ts +35 -0
  11. package/esm2020/acorex-core.mjs +5 -0
  12. package/esm2020/config/acorex-core-config.mjs +5 -0
  13. package/esm2020/config/public-api.mjs +2 -0
  14. package/esm2020/config/src/configs.mjs +32 -0
  15. package/esm2020/dateTime/acorex-core-dateTime.mjs +5 -0
  16. package/esm2020/dateTime/public-api.mjs +6 -0
  17. package/esm2020/dateTime/src/datetime.class.mjs +288 -0
  18. package/esm2020/dateTime/src/datetime.module.mjs +39 -0
  19. package/esm2020/dateTime/src/datetime.pipe.mjs +26 -0
  20. package/esm2020/dateTime/src/georgian.calendar.mjs +189 -0
  21. package/esm2020/dateTime/src/jalali.calendar.mjs +359 -0
  22. package/esm2020/events/acorex-core-events.mjs +5 -0
  23. package/esm2020/events/public-api.mjs +2 -0
  24. package/esm2020/events/src/event.service.mjs +36 -0
  25. package/esm2020/file/acorex-core-file.mjs +5 -0
  26. package/esm2020/file/public-api.mjs +5 -0
  27. package/esm2020/file/src/file-download-ref.class.mjs +12 -0
  28. package/esm2020/file/src/file-download-result.class.mjs +47 -0
  29. package/esm2020/file/src/file-upload-ref.class.mjs +12 -0
  30. package/esm2020/file/src/file.service.mjs +101 -0
  31. package/esm2020/http/acorex-core-http.mjs +5 -0
  32. package/esm2020/http/public-api.mjs +6 -0
  33. package/esm2020/http/src/http-error.class.mjs +2 -0
  34. package/esm2020/http/src/http-events.interceptor.mjs +3 -0
  35. package/esm2020/http/src/http-request.class.mjs +2 -0
  36. package/esm2020/http/src/http-result.class.mjs +21 -0
  37. package/esm2020/http/src/http.module.mjs +29 -0
  38. package/esm2020/http/src/http.service.mjs +148 -0
  39. package/esm2020/image/acorex-core-image.mjs +5 -0
  40. package/esm2020/image/public-api.mjs +2 -0
  41. package/esm2020/image/src/image.service.mjs +43 -0
  42. package/esm2020/pipes/acorex-core-pipes.mjs +5 -0
  43. package/esm2020/pipes/public-api.mjs +3 -0
  44. package/esm2020/pipes/src/pipes.module.mjs +19 -0
  45. package/esm2020/pipes/src/safe.pipe.mjs +30 -0
  46. package/esm2020/platform/acorex-core-platform.mjs +5 -0
  47. package/esm2020/platform/public-api.mjs +2 -0
  48. package/esm2020/platform/src/platform.service.mjs +153 -0
  49. package/esm2020/public-api.mjs +5 -0
  50. package/esm2020/translation/acorex-core-translation.mjs +5 -0
  51. package/esm2020/translation/public-api.mjs +4 -0
  52. package/esm2020/translation/src/translation.module.mjs +18 -0
  53. package/esm2020/translation/src/translator.mjs +43 -0
  54. package/esm2020/translation/src/translator.pipe.mjs +15 -0
  55. package/esm2020/utils/acorex-core-utils.mjs +5 -0
  56. package/esm2020/utils/public-api.mjs +5 -0
  57. package/esm2020/utils/src/color-util.mjs +71 -0
  58. package/esm2020/utils/src/drawing-util.mjs +27 -0
  59. package/esm2020/utils/src/object-util.mjs +39 -0
  60. package/esm2020/utils/src/string-util.mjs +19 -0
  61. package/events/index.d.ts +5 -0
  62. package/events/public-api.d.ts +1 -0
  63. package/events/src/event.service.d.ts +9 -0
  64. package/fesm2015/acorex-core-config.mjs +40 -0
  65. package/fesm2015/acorex-core-config.mjs.map +1 -0
  66. package/fesm2015/acorex-core-dateTime.mjs +899 -0
  67. package/fesm2015/acorex-core-dateTime.mjs.map +1 -0
  68. package/fesm2015/acorex-core-events.mjs +44 -0
  69. package/fesm2015/acorex-core-events.mjs.map +1 -0
  70. package/fesm2015/acorex-core-file.mjs +177 -0
  71. package/fesm2015/acorex-core-file.mjs.map +1 -0
  72. package/fesm2015/acorex-core-http.mjs +203 -0
  73. package/fesm2015/acorex-core-http.mjs.map +1 -0
  74. package/fesm2015/acorex-core-image.mjs +54 -0
  75. package/fesm2015/acorex-core-image.mjs.map +1 -0
  76. package/fesm2015/acorex-core-pipes.mjs +54 -0
  77. package/fesm2015/acorex-core-pipes.mjs.map +1 -0
  78. package/fesm2015/acorex-core-platform.mjs +161 -0
  79. package/fesm2015/acorex-core-platform.mjs.map +1 -0
  80. package/fesm2015/acorex-core-translation.mjs +81 -0
  81. package/fesm2015/acorex-core-translation.mjs.map +1 -0
  82. package/fesm2015/acorex-core-utils.mjs +164 -0
  83. package/fesm2015/acorex-core-utils.mjs.map +1 -0
  84. package/fesm2015/acorex-core.mjs +12 -0
  85. package/fesm2015/acorex-core.mjs.map +1 -0
  86. package/fesm2020/acorex-core-config.mjs +40 -0
  87. package/fesm2020/acorex-core-config.mjs.map +1 -0
  88. package/fesm2020/acorex-core-dateTime.mjs +899 -0
  89. package/fesm2020/acorex-core-dateTime.mjs.map +1 -0
  90. package/fesm2020/acorex-core-events.mjs +44 -0
  91. package/fesm2020/acorex-core-events.mjs.map +1 -0
  92. package/fesm2020/acorex-core-file.mjs +177 -0
  93. package/fesm2020/acorex-core-file.mjs.map +1 -0
  94. package/fesm2020/acorex-core-http.mjs +202 -0
  95. package/fesm2020/acorex-core-http.mjs.map +1 -0
  96. package/fesm2020/acorex-core-image.mjs +51 -0
  97. package/fesm2020/acorex-core-image.mjs.map +1 -0
  98. package/fesm2020/acorex-core-pipes.mjs +54 -0
  99. package/fesm2020/acorex-core-pipes.mjs.map +1 -0
  100. package/fesm2020/acorex-core-platform.mjs +161 -0
  101. package/fesm2020/acorex-core-platform.mjs.map +1 -0
  102. package/fesm2020/acorex-core-translation.mjs +80 -0
  103. package/fesm2020/acorex-core-translation.mjs.map +1 -0
  104. package/fesm2020/acorex-core-utils.mjs +164 -0
  105. package/fesm2020/acorex-core-utils.mjs.map +1 -0
  106. package/fesm2020/acorex-core.mjs +12 -0
  107. package/fesm2020/acorex-core.mjs.map +1 -0
  108. package/file/index.d.ts +5 -0
  109. package/file/public-api.d.ts +4 -0
  110. package/file/src/file-download-ref.class.d.ts +6 -0
  111. package/file/src/file-download-result.class.d.ts +8 -0
  112. package/file/src/file-upload-ref.class.d.ts +5 -0
  113. package/file/src/file.service.d.ts +18 -0
  114. package/http/index.d.ts +5 -0
  115. package/http/{public-api.ts → public-api.d.ts} +1 -1
  116. package/http/src/{http-error.class.ts → http-error.class.d.ts} +2 -2
  117. package/http/src/{http-events.interceptor.ts → http-events.interceptor.d.ts} +3 -7
  118. package/http/src/{http-request.class.ts → http-request.class.d.ts} +5 -5
  119. package/http/src/http-result.class.d.ts +11 -0
  120. package/http/src/http.module.d.ts +8 -0
  121. package/http/src/http.service.d.ts +23 -0
  122. package/image/index.d.ts +5 -0
  123. package/image/public-api.d.ts +1 -0
  124. package/image/src/image.service.d.ts +12 -0
  125. package/index.d.ts +5 -0
  126. package/package.json +115 -16
  127. package/pipes/index.d.ts +5 -0
  128. package/pipes/public-api.d.ts +2 -0
  129. package/pipes/src/pipes.module.d.ts +8 -0
  130. package/pipes/src/safe.pipe.d.ts +10 -0
  131. package/platform/index.d.ts +5 -0
  132. package/platform/public-api.d.ts +1 -0
  133. package/platform/src/platform.service.d.ts +26 -0
  134. package/public-api.d.ts +1 -0
  135. package/translation/index.d.ts +5 -0
  136. package/translation/{public-api.ts → public-api.d.ts} +1 -1
  137. package/translation/src/translation.module.d.ts +7 -0
  138. package/translation/src/translator.d.ts +11 -0
  139. package/translation/src/translator.pipe.d.ts +7 -0
  140. package/utils/index.d.ts +5 -0
  141. package/utils/{public-api.ts → public-api.d.ts} +1 -1
  142. package/utils/src/color-util.d.ts +20 -0
  143. package/utils/src/drawing-util.d.ts +17 -0
  144. package/utils/src/object-util.d.ts +4 -0
  145. package/utils/src/string-util.d.ts +6 -0
  146. package/config/ax-preset.js +0 -186
  147. package/config/index.ts +0 -1
  148. package/config/ng-package.json +0 -6
  149. package/config/public-api.ts +0 -1
  150. package/config/src/configs.ts +0 -37
  151. package/dateTime/index.ts +0 -1
  152. package/dateTime/ng-package.json +0 -6
  153. package/dateTime/src/datetime.class.ts +0 -449
  154. package/dateTime/src/datetime.module.ts +0 -35
  155. package/dateTime/src/datetime.pipe.ts +0 -21
  156. package/dateTime/src/georgian.calendar.ts +0 -205
  157. package/dateTime/src/jalali.calendar.ts +0 -416
  158. package/events/index.ts +0 -1
  159. package/events/ng-package.json +0 -6
  160. package/events/public-api.ts +0 -1
  161. package/events/src/event.service.ts +0 -31
  162. package/file/index.ts +0 -1
  163. package/file/ng-package.json +0 -7
  164. package/file/public-api.ts +0 -4
  165. package/file/src/file-download-ref.class.ts +0 -16
  166. package/file/src/file-download-result.class.ts +0 -56
  167. package/file/src/file-upload-ref.class.ts +0 -14
  168. package/file/src/file.service.ts +0 -104
  169. package/http/index.ts +0 -1
  170. package/http/ng-package.json +0 -6
  171. package/http/src/http-result.class.ts +0 -34
  172. package/http/src/http.module.ts +0 -25
  173. package/http/src/http.service.ts +0 -161
  174. package/image/index.ts +0 -1
  175. package/image/ng-package.json +0 -7
  176. package/image/public-api.ts +0 -1
  177. package/image/src/image.service.ts +0 -42
  178. package/index.ts +0 -1
  179. package/karma.conf.js +0 -44
  180. package/ng-package.json +0 -7
  181. package/pipes/index.ts +0 -1
  182. package/pipes/ng-package.json +0 -6
  183. package/pipes/public-api.ts +0 -2
  184. package/pipes/src/pipes.module.ts +0 -11
  185. package/pipes/src/safe.pipe.ts +0 -24
  186. package/platform/index.ts +0 -1
  187. package/platform/ng-package.json +0 -6
  188. package/platform/public-api.ts +0 -1
  189. package/platform/src/platform.service.ts +0 -223
  190. package/public-api.ts +0 -4
  191. package/test.ts +0 -27
  192. package/translation/index.ts +0 -1
  193. package/translation/ng-package.json +0 -6
  194. package/translation/src/translation.module.ts +0 -12
  195. package/translation/src/translator.pipe.ts +0 -9
  196. package/translation/src/translator.ts +0 -49
  197. package/tsconfig.lib.json +0 -15
  198. package/tsconfig.lib.prod.json +0 -10
  199. package/tsconfig.spec.json +0 -17
  200. package/utils/index.ts +0 -1
  201. package/utils/ng-package.json +0 -6
  202. package/utils/src/color-util.ts +0 -83
  203. package/utils/src/drawing-util.ts +0 -43
  204. package/utils/src/object-util.ts +0 -82
  205. package/utils/src/string-util.ts +0 -25
@@ -1,223 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { fromEvent, Subject } from 'rxjs';
3
- import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
4
-
5
- export type AXPlatforms = 'Android' | 'Desktop' | 'iOS' | 'Mobile';
6
- export type AXBrowsers =
7
- | 'Chrome'
8
- | 'Safari'
9
- | 'Edge'
10
- | 'Firefox'
11
- | 'Opera'
12
- | 'MSIE';
13
- export type AXTechnologies = 'PWA' | 'Hybrid' | 'Electron';
14
-
15
- export type AXScreenSizes = 'SM' | 'MD' | 'LG' | 'XL' | '2XL';
16
-
17
- const isChrome = (win: Window): boolean => testUserAgent(win, /Chrome/i);
18
-
19
- const isFirefox = (win: Window): boolean => testUserAgent(win, /Firefox/i);
20
-
21
- const isEdge = (win: Window): boolean => testUserAgent(win, /Edge/i);
22
-
23
- const isSafari = (win: Window): boolean => testUserAgent(win, /Safari/i);
24
-
25
- const isOpera = (win: Window): boolean =>
26
- testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);
27
-
28
- const isMSIE = (win: Window): boolean =>
29
- testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);
30
-
31
- const isMobileWeb = (win: Window): boolean => isMobile(win) && !isHybrid(win);
32
-
33
- const isIpad = (win: Window) => {
34
- // iOS 12 and below
35
- if (testUserAgent(win, /iPad/i)) {
36
- return true;
37
- }
38
-
39
- // iOS 13+
40
- if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
41
- return true;
42
- }
43
-
44
- return false;
45
- };
46
-
47
- const isIphone = (win: Window) => testUserAgent(win, /iPhone/i);
48
-
49
- const isIOS = (win: Window) =>
50
- testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
51
-
52
- const isAndroid = (win: Window) => testUserAgent(win, /android|sink/i);
53
-
54
- const isAndroidTablet = (win: Window) => {
55
- return isAndroid(win) && !testUserAgent(win, /mobile/i);
56
- };
57
-
58
- const isPhablet = (win: Window) => {
59
- const width = win.innerWidth;
60
- const height = win.innerHeight;
61
- const smallest = Math.min(width, height);
62
- const largest = Math.max(width, height);
63
-
64
- return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;
65
- };
66
-
67
- const isTablet = (win: Window) => {
68
- const width = win.innerWidth;
69
- const height = win.innerHeight;
70
- const smallest = Math.min(width, height);
71
- const largest = Math.max(width, height);
72
-
73
- return (
74
- isIpad(win) ||
75
- isAndroidTablet(win) ||
76
- (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400)
77
- );
78
- };
79
-
80
- const isMobile = (win: Window) => matchMedia(win, '(any-pointer:coarse)');
81
- const isTouch = (win: Window) => matchMedia(win, '(any-pointer:coarse)');
82
-
83
- const isDesktop = (win: Window) => !isMobile(win);
84
-
85
- const isHybrid = (win: Window) => isCordova(win) || isCapacitorNative(win);
86
-
87
- const isCordova = (win: any): boolean =>
88
- !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
89
-
90
- const isCapacitorNative = (win: any): boolean => {
91
- const capacitor = win['Capacitor'];
92
- return !!(capacitor && capacitor.isNative);
93
- };
94
-
95
- const isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);
96
-
97
- const isPWA = (win: Window): boolean =>
98
- !!(
99
- win.matchMedia('(display-mode: standalone)').matches ||
100
- (win.navigator as any).standalone
101
- );
102
-
103
- export const testUserAgent = (win: Window, expr: RegExp) =>
104
- expr.test(win.navigator.userAgent);
105
-
106
- const matchMedia = (win: Window, query: string): boolean =>
107
- win.matchMedia(query).matches;
108
-
109
-
110
- const isSMScreen = (win: Window) => matchMedia(win, '(max-width: 640px)');
111
- const isMDScreen = (win: Window) => matchMedia(win, '(max-width: 768px)');
112
- const isLGScreen = (win: Window) => matchMedia(win, '(max-width: 1024px)');
113
- const isXLScreen = (win: Window) => matchMedia(win, '(max-width: 1280px)');
114
- const is2XLScreen = (win: Window) => matchMedia(win, '(max-width: 1536px)');
115
-
116
- const PLATFORMS_MAP: any = {
117
- Android: isAndroid,
118
- iOS: isIOS,
119
- Desktop: isDesktop,
120
- Mobile: isMobile,
121
- Touch: isTouch,
122
- Chrome: isChrome,
123
- Firefox: isFirefox,
124
- Safari: isSafari,
125
- Edge: isEdge,
126
- Opera: isOpera,
127
- Hybrid: isHybrid,
128
- PWA: isPWA,
129
- Electron: isElectron,
130
- SM: isSMScreen,
131
- MD: isMDScreen,
132
- LG: isLGScreen,
133
- XL: isXLScreen,
134
- "2XL": is2XLScreen,
135
- };
136
-
137
- export class AXPlatformEvent<T extends Event = Event> {
138
- nativeEvent!: T;
139
- source!: AXPlatform;
140
- }
141
-
142
- @Injectable({
143
- providedIn: 'root',
144
- })
145
- export class AXPlatform {
146
- resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();
147
- click: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();
148
- scroll: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();
149
-
150
- isRtl(): boolean {
151
- return (
152
- document.dir == 'rtl' ||
153
- document.body.dir == 'rtl' ||
154
- document.body.style.direction == 'rtl'
155
- );
156
- }
157
-
158
- isLandscape(): boolean {
159
- return window.innerHeight < window.innerWidth;
160
- }
161
-
162
- isPortrate(): boolean {
163
- return !this.isLandscape();
164
- }
165
-
166
- is(name: AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes): boolean {
167
- return PLATFORMS_MAP[name](window) || false;
168
- }
169
-
170
- switchDarkMode() {
171
- const _html = document.getElementsByTagName('html')[0];
172
- _html.classList.add('ax-dark');
173
- }
174
-
175
- switchLightMode() {
176
- const _html = document.getElementsByTagName('html')[0];
177
- _html.classList.remove('ax-dark');
178
- }
179
-
180
- private _setFullHeightRatio() {
181
- document
182
- .querySelector<HTMLElement>(':root')
183
- ?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
184
- }
185
-
186
- constructor() {
187
- fromEvent<UIEvent>(window, 'resize')
188
- .pipe(debounceTime(100))
189
- .pipe(distinctUntilChanged())
190
- .subscribe((e) => {
191
- this.resize.next({
192
- nativeEvent: e,
193
- source: this,
194
- });
195
- //
196
- this._setFullHeightRatio();
197
- });
198
-
199
- document.addEventListener(
200
- 'click',
201
- (e) => {
202
- this.click.next({
203
- nativeEvent: e,
204
- source: this,
205
- });
206
- },
207
- true
208
- );
209
-
210
- document.addEventListener(
211
- 'scroll',
212
- (e) => {
213
- this.scroll.next({
214
- nativeEvent: e,
215
- source: this,
216
- });
217
- },
218
- true
219
- );
220
- // init functions
221
- this._setFullHeightRatio();
222
- }
223
- }
package/public-api.ts DELETED
@@ -1,4 +0,0 @@
1
- /*
2
- * Public API Surface of core
3
- */
4
- export const ACOREX_CORE = "@acorex/core";
package/test.ts DELETED
@@ -1,27 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'zone.js';
4
- import 'zone.js/testing';
5
- import { getTestBed } from '@angular/core/testing';
6
- import {
7
- BrowserDynamicTestingModule,
8
- platformBrowserDynamicTesting
9
- } from '@angular/platform-browser-dynamic/testing';
10
-
11
- declare const require: {
12
- context(path: string, deep?: boolean, filter?: RegExp): {
13
- <T>(id: string): T;
14
- keys(): string[];
15
- };
16
- };
17
-
18
- // First, initialize the Angular testing environment.
19
- getTestBed().initTestEnvironment(
20
- BrowserDynamicTestingModule,
21
- platformBrowserDynamicTesting(),
22
- );
23
-
24
- // Then we find all the tests.
25
- const context = require.context('./', true, /\.spec\.ts$/);
26
- // And load the modules.
27
- context.keys().forEach(context);
@@ -1 +0,0 @@
1
- export * from './public-api'
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json",
3
- "lib": {
4
- "entryFile": "public-api.ts"
5
- }
6
- }
@@ -1,12 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { AXTranslatorPipe } from './translator.pipe';
3
-
4
- @NgModule({
5
- imports: [],
6
- exports: [AXTranslatorPipe],
7
- declarations: [AXTranslatorPipe],
8
- providers: [],
9
- })
10
- export class AXTranslationModule {
11
-
12
- }
@@ -1,9 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import { AXTranslator } from './translator';
3
-
4
- @Pipe({ name: 'trans', pure: true })
5
- export class AXTranslatorPipe implements PipeTransform {
6
- transform(value: string, arg1?: object | string, arg2?: object): string {
7
- return AXTranslator.get(value, arg1, arg2);
8
- }
9
- }
@@ -1,49 +0,0 @@
1
- import { Subject, Observable } from 'rxjs';
2
- import merge from 'lodash-es/merge';
3
- import * as _ from 'lodash';
4
-
5
- // @dynamic
6
- export class AXTranslator {
7
- private static lang: string = 'en';
8
- private static dataChangeSubject = new Subject<any>();
9
- private static _varsRegx = /((\$\{[a-zA-Z_0-9\.]+\})+)/gm;
10
- private static _varNameRegx = /[a-zA-Z_0-9\.]+/gm;
11
-
12
-
13
- static get onChange(): Observable<any> {
14
- return AXTranslator.dataChangeSubject.asObservable();
15
- }
16
-
17
- public static load(lang: string, value: any) {
18
- if (typeof value === 'object') {
19
- if (!AXTranslator[`__data__${lang}`]) {
20
- AXTranslator[`__data__${lang}`] = {};
21
- }
22
- AXTranslator[`__data__${lang}`] = merge(AXTranslator[`__data__${lang}`], value);
23
- }
24
- }
25
-
26
- public static use(lang: string) {
27
- AXTranslator.lang = lang;
28
- }
29
-
30
- public static get(key: string, arg1?: object | string, arg2?: object): string {
31
-
32
- const lang = arg1 && typeof arg1 == 'string' ? arg1 : AXTranslator.lang;
33
- const params = arg1 && typeof arg1 == 'object' ? arg1 : arg2;
34
- let result = _.get(AXTranslator[`__data__${lang}`], key, key);
35
- const vars = typeof (result) == 'string' ? result?.match(this._varsRegx) : [];
36
- if (vars?.length) {
37
- vars.forEach((v:any) => {
38
- const varKey = v.match(this._varNameRegx)?.length ? v.match(this._varNameRegx)[0] : null;
39
- if (varKey) {
40
- const p = _.get(params, varKey) || this.get(varKey, lang);
41
- if (p) {
42
- result = result.replace(v, p);
43
- }
44
- }
45
- })
46
- }
47
- return typeof (result) == 'string' ? result : JSON.stringify(result);
48
- }
49
- }
package/tsconfig.lib.json DELETED
@@ -1,15 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../../out-tsc/lib",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "inlineSources": true,
9
- "types": []
10
- },
11
- "exclude": [
12
- "src/test.ts",
13
- "**/*.spec.ts"
14
- ]
15
- }
@@ -1,10 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.lib.json",
4
- "compilerOptions": {
5
- "declarationMap": false
6
- },
7
- "angularCompilerOptions": {
8
- "compilationMode": "partial"
9
- }
10
- }
@@ -1,17 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../../out-tsc/spec",
6
- "types": [
7
- "jasmine"
8
- ]
9
- },
10
- "files": [
11
- "src/test.ts"
12
- ],
13
- "include": [
14
- "**/*.spec.ts",
15
- "**/*.d.ts"
16
- ]
17
- }
package/utils/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './public-api';
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json",
3
- "lib": {
4
- "entryFile": "public-api.ts"
5
- }
6
- }
@@ -1,83 +0,0 @@
1
- export type AXColorMode = 'rgba' | 'hex' | 'hsla' | 'hsva';
2
-
3
- import tinycolor, { ColorInput } from 'tinycolor2';
4
- import tinygradient from 'tinygradient'
5
-
6
- export type AXColorFormat = ColorInput;
7
-
8
- export class AXColorUtil {
9
-
10
-
11
- static to(color: AXColorFormat, mode: AXColorMode): AXColorFormat {
12
- const _color = tinycolor(color)
13
- switch (mode) {
14
- case 'rgba': ;
15
- return _color.toRgb();
16
- case 'hsla':
17
- return _color.toHsl();
18
- case 'hsva':
19
- return _color.toHsv();
20
- default:
21
- return _color.toHex();
22
- }
23
- };
24
-
25
- static toString(color: AXColorFormat, mode: AXColorMode): string {
26
- const _color = tinycolor(color)
27
- switch (mode) {
28
- case 'rgba':
29
- return _color.toRgbString();
30
- case 'hsla':
31
- return _color.toHslString();
32
- case 'hsva':
33
- return _color.toHsvString();
34
- default:
35
- return _color.toHexString();
36
- }
37
- };
38
-
39
- static mix(baseColor: AXColorFormat, hex: AXColorFormat, percentage: number): string {
40
- return tinycolor.mix(baseColor, hex, percentage).toString('rgb');
41
- }
42
-
43
- static multiply(color1: AXColorFormat, color2: AXColorFormat): string {
44
- let rgb1 = tinycolor(color1).toRgb();
45
- let rgb2 = tinycolor(color2).toRgb();
46
- rgb1.b = Math.floor(rgb1.b * rgb2.b / 255);
47
- rgb1.g = Math.floor(rgb1.g * rgb2.g / 255);
48
- rgb1.r = Math.floor(rgb1.r * rgb2.r / 255);
49
- return tinycolor('rgb ' + rgb1.r + ' ' + rgb1.g + ' ' + rgb1.b).toString('rgb');
50
- }
51
- static toHexSting(color: string): string {
52
- const _color = tinycolor(color)
53
- return _color.toHexString()
54
- };
55
-
56
- static toRGBString(color: AXColorFormat): string {
57
- const _color = tinycolor(color)
58
- return _color.toRgbString()
59
- };
60
-
61
- static contrastToWhite(color: AXColorFormat): number {
62
- return tinycolor.readability("#fff", color);
63
- };
64
-
65
-
66
- static lighten(hex: AXColorFormat, percentage?: number) {
67
- return tinycolor(hex).lighten(percentage)
68
- }
69
-
70
- static darken(hex: AXColorFormat, percentage?: number) {
71
- return tinycolor(hex).darken(percentage)
72
- }
73
-
74
- static equal(color1: AXColorFormat, color2: AXColorFormat): boolean {
75
- return tinycolor.equals(color1, color2);
76
- }
77
-
78
-
79
- static gradient(values: any[] | { color: any, pos: number }[]): tinygradient.Instance {
80
- return tinygradient([...values])
81
- }
82
-
83
- }
@@ -1,43 +0,0 @@
1
- export interface AXPoint {
2
- x: number;
3
- y: number;
4
- }
5
-
6
- export interface AXBoundingClientRect {
7
- left?: number;
8
- top?: number;
9
- width?: number;
10
- height?: number;
11
- bottom?: number;
12
- right?: number;
13
- }
14
- // @dynamic
15
- export class AXDrawingUtil {
16
- static collision(a: HTMLElement, b: HTMLElement): boolean {
17
- const ac = a.getBoundingClientRect();
18
- const bc = b.getBoundingClientRect();
19
-
20
- if (ac.left < bc.left + bc.width && ac.left + ac.width > bc.left &&
21
- ac.top < bc.top + bc.height && ac.top + ac.height > bc.top) {
22
- return true;
23
- }
24
- else {
25
- return false;
26
- }
27
- }
28
-
29
- static isInElementBound(pos: AXPoint, element: HTMLElement): boolean {
30
- const elBound = element.getBoundingClientRect();
31
- return AXDrawingUtil.isInRecPoint(pos, {
32
- left: elBound.x,
33
- width: elBound.width,
34
- top: elBound.y,
35
- height: elBound.height
36
- });
37
- }
38
-
39
- static isInRecPoint(pos: AXPoint, rec: AXBoundingClientRect | any): boolean {
40
- return pos.x >= rec.left && pos.x <= (rec.left + rec.width) && pos.y >= rec.top && (pos.y <= (rec.top + rec.height));
41
- }
42
-
43
- }
@@ -1,82 +0,0 @@
1
- // @dynamic
2
- export class AXObjectUtil {
3
- static deepJSONClone(obj: any): any {
4
- return obj ? JSON.parse(JSON.stringify(obj)) : null;
5
- }
6
-
7
- static deepCopy(obj) {
8
- let copy;
9
- // Handle the 3 simple types, and null or undefined
10
- if (null == obj || 'object' !== typeof obj) { return obj; }
11
- // Handle Date
12
- if (obj instanceof Date) {
13
- copy = new Date();
14
- copy.setTime(obj.getTime());
15
- return copy;
16
- }
17
- // Handle Array
18
- if (obj instanceof Array) {
19
- copy = [];
20
- for (let i = 0, len = obj.length; i < len; i++) {
21
- copy[i] = AXObjectUtil.deepCopy(obj[i]);
22
- }
23
- return copy;
24
- }
25
- // Handle Object
26
- if (obj instanceof Object) {
27
- copy = {};
28
- for (const attr in obj) {
29
- if (obj.hasOwnProperty(attr)) { copy[attr] = AXObjectUtil.deepCopy(obj[attr]); }
30
- }
31
- return copy;
32
- }
33
- throw new Error('Unable to copy obj! Its type isn\'t supported.');
34
- }
35
-
36
- // static fetchProp(obj, prop: string) {
37
- // if (typeof obj === 'undefined') {
38
- // return false;
39
- // }
40
- // const index = prop.indexOf('.');
41
-
42
- // if (index > -1) {
43
- // return AXObjectUtil.fetchProp(obj[prop.substring(0, index)], prop.substr(index + 1));
44
- // }
45
-
46
- // return obj[prop];
47
- // }
48
-
49
- // static getPropByPath(obj, path, defaultVal?) {
50
- // path = path
51
- // .replace(/\[/g, '.')
52
- // .replace(/]/g, '')
53
- // .split('.');
54
-
55
- // path.forEach((level) => {
56
- // if (obj) {
57
- // obj = obj[level];
58
- // }
59
- // });
60
-
61
- // if (obj === undefined) {
62
- // return defaultVal;
63
- // }
64
- // return obj;
65
- // }
66
-
67
- // static setPropByPath(obj, path, value) {
68
- // if (Object(obj) !== obj) { return obj; } // When obj is not an object
69
- // // If not yet an array, get the keys from the string-path
70
- // if (!Array.isArray(path)) { path = path.toString().match(/[^.[\]]+/g) || []; }
71
- // path.slice(0, -1).reduce((a, c, i) => // Iterate all of them except the last one
72
- // Object(a[c]) === a[c] // Does the key exist and is its value an object?
73
- // // Yes: then follow that path
74
- // ? a[c]
75
- // // No: create the key. Is the next key a potential array-index?
76
- // : a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1]
77
- // ? [] // Yes: assign a new array object
78
- // : {}, // No: assign a new plain object
79
- // obj)[path[path.length - 1]] = value; // Finally assign the value to the last key
80
- // return obj; // Return the top-level object to allow chaining
81
- // }
82
- }
@@ -1,25 +0,0 @@
1
- // @dynamic
2
- export class AXStringUtil {
3
-
4
- static getWordBoundsAtPosition(str: string, position: number): { start: number, end: number } {
5
- const isSpace = (c) => /[^a-zA-Z0-9]+/i.test(c);
6
- let start = position - 1;
7
-
8
- while (start >= 0 && !isSpace(str[start])) {
9
- start -= 1;
10
- }
11
- start = Math.max(0, start + 1);
12
- const leftSideString:any = str.slice(start).match(/[a-zA-Z0-9]+/i);
13
- start += leftSideString.index;
14
- let end = start + leftSideString[0].length;
15
- return {
16
- start,
17
- end
18
- };
19
- }
20
-
21
-
22
-
23
-
24
-
25
- }