coer-elements 1.0.18 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. package/README.md +63 -1
  2. package/components/index.d.ts +5 -0
  3. package/components/lib/coer-accordion/coer-accordion.component.d.ts +32 -0
  4. package/components/lib/coer-button/coer-button.component.d.ts +46 -0
  5. package/components/lib/coer-checkbox/coer-checkbox.component.d.ts +29 -0
  6. package/components/lib/coer-datebox/coer-datebox.component.d.ts +58 -0
  7. package/components/lib/coer-dropdown/coer-dropdown.component.d.ts +69 -0
  8. package/components/lib/coer-filebox/coer-filebox.component.d.ts +36 -0
  9. package/components/lib/coer-form/coer-form.component.d.ts +36 -0
  10. package/components/lib/coer-grid/coer-grid.component.d.ts +53 -0
  11. package/components/lib/coer-grid/coer-grid.extension.d.ts +111 -0
  12. package/components/lib/coer-list/coer-list.component.d.ts +57 -0
  13. package/components/lib/coer-modal/coer-modal.component.d.ts +38 -0
  14. package/components/lib/coer-numberbox/coer-numberbox.component.d.ts +56 -0
  15. package/components/lib/coer-page-title/coer-page-title.component.d.ts +14 -0
  16. package/components/lib/coer-selectbox/coer-selectbox.component.d.ts +79 -0
  17. package/components/lib/coer-sidenav/coer-menu-option/coer-menu-option.component.d.ts +22 -0
  18. package/components/lib/coer-sidenav/coer-sidenav.component.d.ts +49 -0
  19. package/components/lib/coer-sidenav/coer-toolbar/coer-toolbar.component.d.ts +32 -0
  20. package/components/lib/coer-sidenav/coer-tree-accordion/coer-tree-accordion.component.d.ts +43 -0
  21. package/components/lib/coer-switch/coer-switch.component.d.ts +32 -0
  22. package/components/lib/coer-tab/coer-tab.component.d.ts +36 -0
  23. package/components/lib/coer-textarea/coer-textarea.component.d.ts +52 -0
  24. package/components/lib/coer-textbox/coer-textbox.component.d.ts +66 -0
  25. package/components/lib/components.module.d.ts +46 -0
  26. package/components/public-api.d.ts +21 -0
  27. package/directives/index.d.ts +5 -0
  28. package/directives/lib/coer-ref.directive.d.ts +14 -0
  29. package/directives/lib/directives.module.d.ts +8 -0
  30. package/directives/lib/life-cycle.directive.d.ts +16 -0
  31. package/directives/public-api.d.ts +3 -0
  32. package/extensions/index.d.ts +5 -0
  33. package/extensions/lib/object.extension.d.ts +1 -0
  34. package/extensions/lib/string.extension.d.ts +19 -0
  35. package/extensions/public-api.d.ts +2 -0
  36. package/fesm2022/coer-elements-components.mjs +4040 -0
  37. package/fesm2022/coer-elements-components.mjs.map +1 -0
  38. package/fesm2022/coer-elements-directives.mjs +84 -0
  39. package/fesm2022/coer-elements-directives.mjs.map +1 -0
  40. package/fesm2022/coer-elements-extensions.mjs +68 -0
  41. package/fesm2022/coer-elements-extensions.mjs.map +1 -0
  42. package/fesm2022/coer-elements-guards.mjs +28 -0
  43. package/fesm2022/coer-elements-guards.mjs.map +1 -0
  44. package/fesm2022/coer-elements-interceptors.mjs +64 -0
  45. package/fesm2022/coer-elements-interceptors.mjs.map +1 -0
  46. package/fesm2022/coer-elements-interfaces.mjs +6 -0
  47. package/fesm2022/coer-elements-interfaces.mjs.map +1 -0
  48. package/fesm2022/coer-elements-pages.mjs +441 -0
  49. package/fesm2022/coer-elements-pages.mjs.map +1 -0
  50. package/fesm2022/coer-elements-pipes.mjs +87 -0
  51. package/fesm2022/coer-elements-pipes.mjs.map +1 -0
  52. package/fesm2022/coer-elements-signals.mjs +35 -0
  53. package/fesm2022/coer-elements-signals.mjs.map +1 -0
  54. package/fesm2022/coer-elements-tools.mjs +1960 -0
  55. package/fesm2022/coer-elements-tools.mjs.map +1 -0
  56. package/fesm2022/coer-elements.mjs +68 -0
  57. package/fesm2022/coer-elements.mjs.map +1 -0
  58. package/guards/index.d.ts +5 -0
  59. package/guards/lib/login.guard.d.ts +2 -0
  60. package/guards/lib/page.guard.d.ts +2 -0
  61. package/guards/public-api.d.ts +2 -0
  62. package/images/loading.gif +0 -0
  63. package/images/no-image.png +0 -0
  64. package/images/no-user.png +0 -0
  65. package/index.d.ts +12 -0
  66. package/interceptors/index.d.ts +5 -0
  67. package/interceptors/lib/user.interceptor.d.ts +8 -0
  68. package/interceptors/lib/utc-offset.interceptor.d.ts +8 -0
  69. package/interceptors/public-api.d.ts +1 -0
  70. package/interfaces/index.d.ts +5 -0
  71. package/interfaces/lib/app-source.interface.d.ts +4 -0
  72. package/interfaces/lib/box-button.interface.d.ts +6 -0
  73. package/interfaces/lib/bulk-load.interface.d.ts +5 -0
  74. package/interfaces/lib/coer-filebox/file-image.interface.d.ts +14 -0
  75. package/interfaces/lib/coer-filebox/file.interface.d.ts +5 -0
  76. package/interfaces/lib/coer-grid/grid-button-by-row.interface.d.ts +6 -0
  77. package/interfaces/lib/coer-grid/grid-checkbox.interface.d.ts +5 -0
  78. package/interfaces/lib/coer-grid/grid-coer-numberbox.interface.d.ts +12 -0
  79. package/interfaces/lib/coer-grid/grid-coer-selectbox.interface.d.ts +9 -0
  80. package/interfaces/lib/coer-grid/grid-coer-switch.interface.d.ts +6 -0
  81. package/interfaces/lib/coer-grid/grid-coer-textbox.interface.d.ts +11 -0
  82. package/interfaces/lib/coer-grid/grid-column.interface.d.ts +24 -0
  83. package/interfaces/lib/coer-grid/grid-data-source.interface.d.ts +6 -0
  84. package/interfaces/lib/coer-grid/grid-header-button.interface.d.ts +8 -0
  85. package/interfaces/lib/coer-grid/grid-header-export-button.interface.d.ts +10 -0
  86. package/interfaces/lib/coer-grid/grid-header.interface.d.ts +5 -0
  87. package/interfaces/lib/coer-grid/grid-import.interface.d.ts +4 -0
  88. package/interfaces/lib/coer-grid/grid-input-checkbox.interface.d.ts +5 -0
  89. package/interfaces/lib/coer-grid/grid-input-switch-change.interface.d.ts +5 -0
  90. package/interfaces/lib/coer-grid/grid-input-textbox.interface.d.ts +5 -0
  91. package/interfaces/lib/coer-grid/grid-item.interface.d.ts +5 -0
  92. package/interfaces/lib/coer-grid/grid-keyup-enter.interface.d.ts +6 -0
  93. package/interfaces/lib/coer-grid/grid-length.interface.d.ts +5 -0
  94. package/interfaces/lib/coer-grid/grid-search.interface.d.ts +5 -0
  95. package/interfaces/lib/coer-grid/grid-sort.interface.d.ts +5 -0
  96. package/interfaces/lib/coer-menu/menu-access.interface.d.ts +7 -0
  97. package/interfaces/lib/coer-menu/menu-option-selected.interface.d.ts +9 -0
  98. package/interfaces/lib/coer-menu/menu-selected.interface.d.ts +10 -0
  99. package/interfaces/lib/coer-menu/menu.interface.d.ts +10 -0
  100. package/interfaces/lib/coer-ref.interface.d.ts +10 -0
  101. package/interfaces/lib/image.interface.d.ts +11 -0
  102. package/interfaces/lib/login-response.interface.d.ts +10 -0
  103. package/interfaces/lib/login.interface.d.ts +4 -0
  104. package/interfaces/lib/page-title/breadcrumb.interface.d.ts +6 -0
  105. package/interfaces/lib/page-title/go-back.interface.d.ts +6 -0
  106. package/interfaces/lib/page-title/information.interface.d.ts +4 -0
  107. package/interfaces/lib/screen-size.interface.d.ts +5 -0
  108. package/interfaces/lib/service/http-request.interface.d.ts +12 -0
  109. package/interfaces/lib/service/http-response.interface.d.ts +6 -0
  110. package/interfaces/lib/service/patch.interface.d.ts +5 -0
  111. package/interfaces/lib/toolbar-menu.interface.d.ts +5 -0
  112. package/interfaces/public-api.d.ts +41 -0
  113. package/package.json +67 -38
  114. package/pages/index.d.ts +5 -0
  115. package/pages/lib/coer-loading/loading.component.d.ts +5 -0
  116. package/pages/lib/coer-menu/coer-menu.component.d.ts +12 -0
  117. package/pages/lib/coer-system/coer-system.component.d.ts +64 -0
  118. package/pages/lib/coer-system/login/login.component.d.ts +31 -0
  119. package/pages/lib/home/home.component.d.ts +7 -0
  120. package/pages/lib/pages.module.d.ts +18 -0
  121. package/pages/public-api.d.ts +5 -0
  122. package/pipes/index.d.ts +5 -0
  123. package/pipes/lib/html.pipe.d.ts +10 -0
  124. package/pipes/lib/no-image.pipe.d.ts +7 -0
  125. package/pipes/lib/numeric-format.pipe.d.ts +7 -0
  126. package/pipes/lib/pipes.module.d.ts +9 -0
  127. package/pipes/public-api.d.ts +4 -0
  128. package/signals/index.d.ts +5 -0
  129. package/signals/lib/breakpoint.signal.d.ts +1 -0
  130. package/signals/lib/is-loading.signal.d.ts +1 -0
  131. package/signals/lib/is-menu-open.signal.d.ts +1 -0
  132. package/signals/lib/is-modal-open.signal.d.ts +1 -0
  133. package/signals/lib/menu-selected.signal.d.ts +2 -0
  134. package/signals/lib/navigation.signal.d.ts +2 -0
  135. package/signals/public-api.d.ts +6 -0
  136. package/styles/angular-material.scss +20 -0
  137. package/styles/animations.scss +11 -0
  138. package/styles/bootstrap.scss +1 -14
  139. package/styles/coer-elements.css +2054 -0
  140. package/styles/colors.scss +90 -49
  141. package/styles/containers.scss +44 -0
  142. package/styles/cursores.scss +19 -0
  143. package/styles/index.scss +58 -0
  144. package/styles/layout.scss +49 -0
  145. package/styles/position.scss +7 -0
  146. package/styles/scroll-bar.scss +20 -0
  147. package/tools/index.d.ts +5 -0
  148. package/tools/lib/breadcrumbs.class.d.ts +18 -0
  149. package/tools/lib/coer-alert/coer-alert.component.d.ts +23 -0
  150. package/tools/lib/coer-grid.templates.d.ts +11 -0
  151. package/tools/lib/colors.class.d.ts +21 -0
  152. package/tools/lib/control-value.class.d.ts +25 -0
  153. package/tools/lib/date-time.class.d.ts +21 -0
  154. package/tools/lib/elements-html.class.d.ts +8 -0
  155. package/tools/lib/files.class.d.ts +16 -0
  156. package/tools/lib/filters.class.d.ts +11 -0
  157. package/tools/lib/menu.class.d.ts +9 -0
  158. package/tools/lib/page.class.d.ts +83 -0
  159. package/tools/lib/screen.class.d.ts +13 -0
  160. package/tools/lib/section.class.d.ts +33 -0
  161. package/tools/lib/service.class.d.ts +42 -0
  162. package/tools/lib/source.class.d.ts +20 -0
  163. package/tools/lib/tools.d.ts +42 -0
  164. package/tools/lib/user.class.d.ts +11 -0
  165. package/tools/public-api.d.ts +17 -0
  166. package/Signals/index.ts +0 -7
  167. package/Tools/Breadcrumbs.class.ts +0 -84
  168. package/Tools/ControlValue.ts +0 -63
  169. package/Tools/DateTime.class.ts +0 -27
  170. package/Tools/Files.class.ts +0 -119
  171. package/Tools/Page.class.ts +0 -197
  172. package/Tools/Screen.class.ts +0 -50
  173. package/Tools/Source.class.ts +0 -107
  174. package/Tools/Tools.ts +0 -212
  175. package/components/coer-alert/coer-alert.component.html +0 -56
  176. package/components/coer-alert/coer-alert.component.scss +0 -100
  177. package/components/coer-alert/coer-alert.component.ts +0 -249
  178. package/components/index.ts +0 -96
  179. package/dist_browser/Tools/Breadcrumbs.class.js +0 -66
  180. package/dist_browser/Tools/ControlValue.js +0 -49
  181. package/dist_browser/Tools/DateTime.class.js +0 -25
  182. package/dist_browser/Tools/Files.class.js +0 -99
  183. package/dist_browser/Tools/Page.class.js +0 -213
  184. package/dist_browser/Tools/Screen.class.js +0 -68
  185. package/dist_browser/Tools/Source.class.js +0 -83
  186. package/dist_browser/Tools/Tools.js +0 -227
  187. package/dist_browser/components/coer-alert/coer-alert.component.js +0 -314
  188. package/dist_browser/index.js +0 -8
  189. package/dist_node/Tools/Breadcrumbs.class.js +0 -69
  190. package/dist_node/Tools/ControlValue.js +0 -53
  191. package/dist_node/Tools/DateTime.class.js +0 -28
  192. package/dist_node/Tools/Files.class.js +0 -102
  193. package/dist_node/Tools/Page.class.js +0 -216
  194. package/dist_node/Tools/Screen.class.js +0 -71
  195. package/dist_node/Tools/Source.class.js +0 -86
  196. package/dist_node/Tools/Tools.js +0 -230
  197. package/dist_node/components/coer-alert/coer-alert.component.js +0 -317
  198. package/dist_node/index.js +0 -24
  199. package/dist_node/interfaces/index.js +0 -2
  200. package/index.ts +0 -8
  201. package/interfaces/index.ts +0 -47
  202. package/styles/coer.scss +0 -95
  203. package/tsconfig.json +0 -29
@@ -1,197 +0,0 @@
1
- import { AfterViewInit, Component, Inject, inject, OnDestroy } from '@angular/core';
2
- import { Breadcrumbs } from "./Breadcrumbs.class";
3
- import { Source } from './Source.class';
4
- import { CoerAlert } from '../components/coer-alert/coer-alert.component';
5
- import { IAppSource, IBreadcrumb, IGoBack } from '../interfaces';
6
- import { ActivatedRoute, Router } from '@angular/router';
7
- import { Tools } from './Tools';
8
-
9
- @Component({ template: '' })
10
- export class Page implements AfterViewInit, OnDestroy {
11
-
12
- //Injection
13
- protected readonly alert = inject(CoerAlert);
14
- protected readonly router = inject(Router);
15
- private readonly activatedRoute = inject(ActivatedRoute);
16
-
17
- /** */
18
- protected isUpdate: boolean = false;
19
-
20
- /** */
21
- protected isLoading: boolean = false;
22
-
23
- /** */
24
- protected isReady: boolean = false;
25
-
26
- /** */
27
- protected enableAnimations: boolean = false;
28
-
29
- /** */
30
- protected routeParams: any;
31
-
32
- /** */
33
- protected queryParams: any;
34
-
35
- /** */
36
- protected breadcrumbs: IBreadcrumb[] = [];
37
-
38
- /** */
39
- protected pageResponse: any = null;
40
-
41
- /** */
42
- protected goBack: IGoBack = { show: false };
43
-
44
- //Private Variables
45
- private _page: string = '';
46
- private _source: IAppSource | null = null;
47
- private _preventDestroy: boolean = false;
48
-
49
-
50
- constructor(@Inject(String) page: string) {
51
- this.SetPageName(page);
52
- this.SetSource();
53
- this.GetSource();
54
- this.GetNavigation();
55
- this.SetGoBack();
56
- this.GetPageResponse();
57
- }
58
-
59
- ngAfterViewInit() {
60
- this.routeParams = this.activatedRoute.snapshot.params;
61
- this.queryParams = this.activatedRoute.snapshot.queryParams;
62
-
63
- setTimeout(() => {
64
- this.isReady = true;
65
- this.RunPage();
66
- setTimeout(() => { this.enableAnimations = true }, 1000);
67
- });
68
-
69
- }
70
-
71
- ngOnDestroy() {
72
- if (!this._preventDestroy) Source.ClearPageResponse();
73
- }
74
-
75
- /** Main method. Starts after ngAfterViewInit() */
76
- protected RunPage(): void {};
77
-
78
-
79
- /** Rename the last breadcrumb and update the url id */
80
- protected SetPageName(name: string, id: string | number | null = null): void {
81
- this._page = name;
82
-
83
- let path = this.router.url;
84
- if (path.includes('?')) path = path.split('?')[0];
85
-
86
- if (id) {
87
- const PATH_ARRAY = path.split('/');
88
- const PATH_ID = Tools.BreakReference(PATH_ARRAY).pop();
89
- if (PATH_ID) {
90
- PATH_ARRAY[PATH_ARRAY.length - 1] = String(id);
91
- path = PATH_ARRAY.join('/');
92
- }
93
- }
94
-
95
- if (this.breadcrumbs.length > 0) {
96
- this.breadcrumbs[this.breadcrumbs.length - 1].page = name;
97
- this.breadcrumbs[this.breadcrumbs.length - 1].path = path;
98
- Breadcrumbs.SetLast(name, path);
99
- }
100
-
101
- this.router.navigateByUrl(path)
102
- }
103
-
104
-
105
- /** */
106
- private SetSource(): void {
107
- Source.Set(this._page);
108
- }
109
-
110
-
111
- /** */
112
- private GetSource(): void {
113
- this._source = Source.Get();
114
- }
115
-
116
-
117
- /** */
118
- protected GetPageResponse(): void {
119
- this.pageResponse = Source.GetPageResponse();
120
- }
121
-
122
-
123
- /** */
124
- private GetNavigation(): void {
125
- if (this._source) {
126
- this.breadcrumbs = Breadcrumbs.Get().map(item => Object.assign({
127
- page: item.page,
128
- path: item.path,
129
- click: this.GoBack(item.path)
130
- }));
131
- }
132
-
133
- else this.breadcrumbs = [{ page: this._page }];
134
- }
135
-
136
-
137
- /** */
138
- private SetGoBack(): void {
139
- if (this._source) {
140
- this.goBack = {
141
- show: true,
142
- path: this._source.path,
143
- click: this.GoBack()
144
- };
145
- }
146
- }
147
-
148
-
149
- /** */
150
- private GoBack = (path?: string) => (() => {
151
- if (path) Breadcrumbs.Remove(path);
152
- else Breadcrumbs.RemoveLast();
153
- });
154
-
155
-
156
- /** Navigate to previous page */
157
- protected GoToSource<T>(pageResponse: T | null = null): void {
158
- if(this._source) {
159
- Breadcrumbs.RemoveLast();
160
- this.SetPageResponse(pageResponse);
161
- Tools.Sleep().then(_ => this.router.navigateByUrl(this._source!.path));
162
- }
163
- };
164
-
165
-
166
- /** */
167
- protected SetPageResponse<T>(pageResponse: T | null = null): void {
168
- if (Tools.IsNotNull(pageResponse)) {
169
- this._preventDestroy = true;
170
- Source.SetPageResponse(pageResponse);
171
- }
172
- };
173
-
174
-
175
- /** */
176
- protected ReloadPage(): void {
177
- Breadcrumbs.RemoveLast();
178
- Tools.Sleep().then(_ => window.location.reload());
179
- }
180
-
181
-
182
- /** */
183
- protected Log(value: any, log: string | null = null): void {
184
- if (Tools.IsNotNull(log)) console.log({ log, value });
185
- else console.log(value);
186
- }
187
-
188
-
189
- /** Returns true if the value is null or undefined, false otherwise */
190
- protected IsNotNull = Tools.IsNotNull;
191
-
192
- /** Returns true if the value is null or undefined, false otherwise */
193
- protected IsNull = Tools.IsNull;
194
-
195
- /** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
196
- protected IsOnlyWhiteSpace = Tools.IsOnlyWhiteSpace;
197
- }
@@ -1,50 +0,0 @@
1
- import { IScreenSize } from "../interfaces";
2
- import { Observable } from "rxjs";
3
-
4
- export class Screen {
5
-
6
- public static get WINDOW_WIDTH(): number {
7
- return window.innerWidth;
8
- }
9
-
10
-
11
- public static get WINDOW_HEIGHT(): number {
12
- return window.innerHeight;
13
- }
14
-
15
-
16
- public static get DEVICE_WIDTH(): number {
17
- return window.screen.width;
18
- }
19
-
20
-
21
- public static get DEVICE_HEIGHT(): number {
22
- return window.screen.height;
23
- }
24
-
25
-
26
- public static get BREAKPOINT(): 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' {
27
- if (window.innerWidth < 576) return 'xs';
28
- else if (window.innerWidth >= 576 && window.innerWidth < 768) return 'sm';
29
- else if (window.innerWidth >= 768 && window.innerWidth < 992) return 'md';
30
- else if (window.innerWidth >= 992 && window.innerWidth < 1200) return 'lg';
31
- else if (window.innerWidth >= 1200 && window.innerWidth < 1400) return 'xl';
32
- else return 'xxl';
33
- }
34
-
35
-
36
- /** */
37
- public static Resize = new Observable<IScreenSize>(subscriber => {
38
- window.addEventListener("load", () => {
39
- window.dispatchEvent(new Event('resize'));
40
- });
41
-
42
- window.onresize = () => {
43
- subscriber.next({
44
- width: window.innerWidth,
45
- height: window.innerHeight,
46
- breakpoin: this.BREAKPOINT
47
- });
48
- }
49
- });
50
- }
@@ -1,107 +0,0 @@
1
- import { Breadcrumbs } from "./Breadcrumbs.class";
2
- import { IAppSource } from '../interfaces';
3
- import { Router } from '@angular/router';
4
- import { inject } from "@angular/core";
5
- import { Tools } from './Tools';
6
-
7
- export class Source {
8
-
9
- private static readonly storage = 'COER-System';
10
-
11
- /** */
12
- public static Set(page: string): void {
13
- const ROUTER = inject(Router);
14
-
15
- let path = ROUTER.url;
16
- if (path.includes('?')) path = path.split('?')[0];
17
-
18
- Breadcrumbs.Add(page, path);
19
-
20
- const breadcrumbs = Breadcrumbs.Get();
21
-
22
- if(breadcrumbs.length >= 2) {
23
- breadcrumbs.pop();
24
- const breadcrumb = breadcrumbs.pop()!;
25
- this.Save({ page: breadcrumb.page, path: breadcrumb.path });
26
- }
27
-
28
- else this.Save(null);
29
- }
30
-
31
-
32
- /** */
33
- private static Save(source: IAppSource | null): void {
34
- let storage = sessionStorage.getItem(this.storage) as any;
35
- if (storage) storage = JSON.parse(storage);
36
- storage = Object.assign({}, storage, { source });
37
- sessionStorage.setItem(this.storage, JSON.stringify(storage));
38
- }
39
-
40
-
41
- /** */
42
- public static Get(): IAppSource | null {
43
- let storage = sessionStorage.getItem(this.storage) as any;
44
-
45
- if (storage) {
46
- storage = JSON.parse(storage);
47
-
48
- if (storage.hasOwnProperty('source')) {
49
- return storage.source;
50
- }
51
- }
52
-
53
- return null;
54
- }
55
-
56
-
57
- /** */
58
- public static GetRoot(): IAppSource | null {
59
- const breadcrumbs = Breadcrumbs.Get();
60
- return (breadcrumbs.length > 0) ? breadcrumbs.shift()! : null;
61
- }
62
-
63
-
64
- /** */
65
- public static SetPageResponse<T>(pageResponse: T): void {
66
- let storage = sessionStorage.getItem(this.storage) as any;
67
- storage = JSON.parse(storage);
68
- storage = Object.assign({}, storage, { pageResponse });
69
- sessionStorage.setItem(this.storage, JSON.stringify(storage));
70
- }
71
-
72
-
73
- /** */
74
- public static GetPageResponse<T>(): T | null {
75
- let storage = sessionStorage.getItem(this.storage) as any;
76
-
77
- if (storage) {
78
- storage = JSON.parse(storage);
79
-
80
- if (storage.hasOwnProperty('pageResponse')) {
81
- return Tools.BreakReference(storage.pageResponse);
82
- }
83
- }
84
-
85
- return null;
86
- }
87
-
88
-
89
- /** */
90
- public static ClearPageResponse(): void {
91
- let storage = sessionStorage.getItem(this.storage) as any;
92
- storage = JSON.parse(storage);
93
-
94
- if (storage.hasOwnProperty('pageResponse')) {
95
- delete storage.pageResponse;
96
- }
97
-
98
- storage = Object.assign({}, storage);
99
- sessionStorage.setItem(this.storage, JSON.stringify(storage));
100
- }
101
-
102
-
103
- /** Clear Source */
104
- public static Reset(): void {
105
- sessionStorage.removeItem(this.storage);
106
- }
107
- }
package/Tools/Tools.ts DELETED
@@ -1,212 +0,0 @@
1
- import { Guid } from "guid-typescript";
2
- import { signal } from "@angular/core";
3
- const reference_signal = signal<any>({});
4
-
5
- export const Tools = {
6
- /** Generate a Guid */
7
- GetGuid: (seed: string = 'coer-system') => {
8
- return `${seed}-${Guid.create().toString()}`;
9
- },
10
-
11
-
12
- /** Returns true if the value is null or undefined, false otherwise */
13
- IsNull: <T>(value: T | null | undefined): boolean => {
14
- if (value === undefined) return true;
15
- if (value === null) return true;
16
- return false;
17
- },
18
-
19
-
20
- /** Returns true if the value is not null or undefined, false otherwise */
21
- IsNotNull: <T>(value: T | null | undefined): boolean => {
22
- if (value === undefined) return false;
23
- if (value === null) return false;
24
- return true;
25
- },
26
-
27
-
28
- /** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
29
- IsOnlyWhiteSpace: <T>(value: T | null | undefined): boolean => {
30
- if (value === undefined) return true;
31
- if (value === null) return true;
32
- if((value as string).toString().trim() === '') return true;
33
- return false;
34
- },
35
-
36
-
37
- /** Break reference of a object or array */
38
- BreakReference: <T>(object: T): T => {
39
- if (object === undefined) return undefined as T;
40
- if (object === null) return null as T;
41
- const OBJECT = JSON.parse(JSON.stringify(object))
42
- return (Array.isArray(OBJECT)) ? [...OBJECT] : { ...OBJECT }
43
- },
44
-
45
-
46
- /** Clean extra whitespaces */
47
- CleanUpBlanks: (text: string | number): string => {
48
- if(Tools.IsNull(text)) return '';
49
- let worlds: string[] = String(text).split(' ');
50
- worlds = worlds.filter(x => x.length > 0);
51
- return worlds.join(' ');
52
- },
53
-
54
-
55
- /** Get properties of an object */
56
- GetObjectProperties: <T>(obj: T | null | undefined): string[] => {
57
- const properties: string[] = [];
58
- if(Tools.IsNull(obj)) return properties;
59
- for(const property in obj) properties.push(String(property));
60
- return properties;
61
- },
62
-
63
-
64
- /**
65
- * Set an index and merge more arrays of the same type
66
- * @returns A new array
67
- * */
68
- SetIndex: <T>(array: T[], ...args: T[][]): T[] => {
69
- let index = 0;
70
- for (const arg of args) {
71
- array = Tools.BreakReference(array).concat(Tools.BreakReference(arg));
72
- }
73
-
74
- return Tools.BreakReference(array).map(item => Object.assign({ index: index++ }, item));
75
- },
76
-
77
-
78
- /** Set First Char To Lower */
79
- FirstCharToLower: (text: string | null | undefined): string => {
80
- if (Tools.IsNull(text)) return '';
81
-
82
- const textArray: string[] = [];
83
- for(let i = 0; i < text!.length; i++) {
84
- if(i === 0) textArray.push(text![i].toLowerCase());
85
- else textArray.push(text![i]);
86
- }
87
-
88
- return textArray.join('');
89
- },
90
-
91
-
92
- /** Set First Char To Upper */
93
- FirstCharToUpper: (text: string | null | undefined): string => {
94
- if (Tools.IsNull(text)) return '';
95
-
96
- const textArray: string[] = [];
97
- for(let i = 0; i < text!.length; i++) {
98
- if(i === 0) textArray.push(text![i].toUpperCase());
99
- else textArray.push(text![i]);
100
- }
101
-
102
- return textArray.join('');
103
- },
104
-
105
-
106
- /** Sort an array in ascending order by property */
107
- SortBy: <T>(array: T[], property: string, propertyType: 'string' | 'number' = 'string'): T[] => {
108
- switch (propertyType) {
109
- case 'string': {
110
- return array.sort((x: any, y: any) => {
111
- if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim()) return -1;
112
- else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim()) return 1;
113
- else return 0;
114
- });
115
- }
116
-
117
- case 'number': {
118
- return array.sort((x: any, y: any) => Number(x[property] - Number(y[property])));
119
- }
120
- }
121
- },
122
-
123
-
124
- /** Sort an array in descending order by property */
125
- SortByDesc: <T>(array: T[], property: string, propertyType: 'string' | 'number' = 'string'): T[] => {
126
- switch (propertyType) {
127
- case 'string': {
128
- return array.sort((x: any, y: any) => {
129
- if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim()) return 1;
130
- else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim()) return -1;
131
- else return 0;
132
- });
133
- }
134
-
135
- case 'number': {
136
- return array.sort((x: any, y: any) => Number(Number(y[property])) - x[property]);
137
- }
138
- }
139
- },
140
-
141
-
142
- /** Return a string with forman numeric */
143
- GetNumericFormat: (value: string | number | null | undefined, decimals: number = 0): string => {
144
- if (value == undefined
145
- || value == null
146
- || value.toString().trim() == ''
147
- || isNaN(Number(value))) {
148
- return '0';
149
- }
150
-
151
- let valueInteger = '';
152
- let valueDecimal = '';
153
- value = value.toString().replaceAll(' ', '');
154
-
155
- if (value.includes('.') || (decimals > 0)) {
156
- valueInteger = value.includes('.') ? value.split('.')[0] : value;
157
-
158
- if (decimals > 0) {
159
- const PADDING = decimals - valueDecimal.length;
160
- valueDecimal = value.includes('.') ? value.split('.')[1] : '';
161
- for(let i = 0; i < PADDING; i++) valueDecimal += '0';
162
- valueDecimal = valueDecimal.substring(0, decimals);
163
- valueDecimal = `.${valueDecimal}`;
164
- }
165
- }
166
-
167
- else {
168
- valueInteger = value;
169
- }
170
-
171
- let counter = 0;
172
- const VALUE_INTEGER_ARRAY: string[] = [];
173
- for(const char of valueInteger.split('').reverse()) {
174
- if (counter == 3) {
175
- VALUE_INTEGER_ARRAY.push(',');
176
- counter = 0;
177
- }
178
-
179
- VALUE_INTEGER_ARRAY.push(char);
180
- ++counter;
181
- }
182
-
183
- valueInteger = VALUE_INTEGER_ARRAY.reverse().join('');
184
- return `${valueInteger}${valueDecimal}`;
185
- },
186
-
187
-
188
- /** Wait the time indicated */
189
- Sleep: (milliseconds: number = 0, reference: string | null = null) => {
190
- if (Tools.IsNull(reference)) {
191
- return new Promise(Resolve => setTimeout(Resolve, milliseconds));
192
- }
193
-
194
- else return new Promise<void>(Resolve => {
195
- reference = reference!.replaceAll(' ', '_').toLowerCase();
196
-
197
- if (reference_signal().hasOwnProperty(reference)) {
198
- clearInterval(reference_signal()[reference!]);
199
- }
200
-
201
- reference_signal.set(Object.assign(reference_signal(), {
202
- [reference!]: setTimeout(() => {
203
- Resolve();
204
- clearInterval(reference_signal()[reference!]);
205
- const _reference = { ...reference_signal() };
206
- delete _reference[reference!];
207
- reference_signal.set({ ..._reference });
208
- }, milliseconds)
209
- }));
210
- });
211
- }
212
- };
@@ -1,56 +0,0 @@
1
- <aside class="toast-container coer-alert">
2
- <!-- Success -->
3
- <div id="alert-success" role="alert" aria-live="assertive" aria-atomic="true" class="toast">
4
- <div class="toast-header">
5
- <i id="alert-success-icon"></i>
6
- <strong id="alert-success-title"></strong>
7
- <button type="button" (click)="Close('alert-success')" class="btn-close btn-close-white"></button>
8
- </div>
9
-
10
- <div class="toast-body">
11
- <pre id="alert-success-message"></pre>
12
- </div>
13
- </div>
14
-
15
-
16
- <!-- Error -->
17
- <div id="alert-error" role="alert" aria-live="assertive" aria-atomic="true" class="toast">
18
- <div class="toast-header">
19
- <i id="alert-error-icon"></i>
20
- <strong id="alert-error-title"></strong>
21
- <button type="button" (click)="Close('alert-error')" class="btn-close btn-close-white"></button>
22
- </div>
23
-
24
- <div class="toast-body">
25
- <pre id="alert-error-message"></pre>
26
- </div>
27
- </div>
28
-
29
-
30
- <!-- Info -->
31
- <div id="alert-info" role="alert" aria-live="assertive" aria-atomic="true" class="toast">
32
- <div class="toast-header">
33
- <i id="alert-info-icon"></i>
34
- <strong id="alert-info-title"></strong>
35
- <button type="button" (click)="Close('alert-info')" class="btn-close btn-close-white"></button>
36
- </div>
37
-
38
- <div class="toast-body">
39
- <pre id="alert-info-message"></pre>
40
- </div>
41
- </div>
42
-
43
-
44
- <!-- Warning -->
45
- <div id="alert-warning" role="alert" aria-live="assertive" aria-atomic="true" class="toast">
46
- <div class="toast-header">
47
- <i id="alert-warning-icon"></i>
48
- <strong id="alert-warning-title"></strong>
49
- <button type="button" (click)="Close('alert-warning')" class="btn-close"></button>
50
- </div>
51
-
52
- <div class="toast-body">
53
- <pre id="alert-warning-message"></pre>
54
- </div>
55
- </div>
56
- </aside>