coer-elements 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. package/Signals/{index.d.ts → index.ts} +3 -3
  2. package/Signals/src/breakpoint.signal.ts +3 -0
  3. package/Signals/src/isLoading.signal.ts +2 -0
  4. package/Signals/src/isModalOpen.signal.ts +2 -0
  5. package/Tools/{index.d.ts → index.ts} +8 -8
  6. package/Tools/src/Breadcrumbs.class.ts +84 -0
  7. package/Tools/src/ControlValue.ts +63 -0
  8. package/Tools/src/DateTime.class.ts +27 -0
  9. package/Tools/src/Files.class.ts +119 -0
  10. package/Tools/src/Page.class.ts +195 -0
  11. package/Tools/src/Screen.class.ts +50 -0
  12. package/Tools/src/Source.class.ts +106 -0
  13. package/Tools/src/Tools.ts +217 -0
  14. package/components/index.ts +2 -0
  15. package/components/src/coer-alert/coer-alert.component.html +56 -0
  16. package/components/src/coer-alert/coer-alert.component.scss +100 -0
  17. package/components/src/coer-alert/coer-alert.component.ts +249 -0
  18. package/components/src/components.module.ts +97 -0
  19. package/esm2022/index.mjs +2 -4
  20. package/fesm2022/coer-elements.mjs +0 -1006
  21. package/fesm2022/coer-elements.mjs.map +1 -1
  22. package/index.d.ts +1 -3
  23. package/package.json +14 -1
  24. package/styles/index.css +249 -17
  25. package/styles/index.scss +98 -2
  26. package/README.md +0 -24
  27. package/Signals/src/breakpoint.signal.d.ts +0 -1
  28. package/Signals/src/isLoading.signal.d.ts +0 -1
  29. package/Signals/src/isModalOpen.signal.d.ts +0 -1
  30. package/Tools/src/Breadcrumbs.class.d.ts +0 -18
  31. package/Tools/src/ControlValue.d.ts +0 -23
  32. package/Tools/src/DateTime.class.d.ts +0 -11
  33. package/Tools/src/Files.class.d.ts +0 -16
  34. package/Tools/src/Page.class.d.ts +0 -66
  35. package/Tools/src/Screen.class.d.ts +0 -11
  36. package/Tools/src/Source.class.d.ts +0 -20
  37. package/Tools/src/Tools.d.ts +0 -33
  38. package/components/index.d.ts +0 -2
  39. package/components/src/coer-alert/coer-alert.component.d.ts +0 -23
  40. package/components/src/components.module.d.ts +0 -10
  41. package/esm2022/Signals/index.mjs +0 -4
  42. package/esm2022/Signals/src/breakpoint.signal.mjs +0 -4
  43. package/esm2022/Signals/src/isLoading.signal.mjs +0 -3
  44. package/esm2022/Signals/src/isModalOpen.signal.mjs +0 -3
  45. package/esm2022/Tools/index.mjs +0 -9
  46. package/esm2022/Tools/src/Breadcrumbs.class.mjs +0 -63
  47. package/esm2022/Tools/src/ControlValue.mjs +0 -44
  48. package/esm2022/Tools/src/DateTime.class.mjs +0 -22
  49. package/esm2022/Tools/src/Files.class.mjs +0 -93
  50. package/esm2022/Tools/src/Page.class.mjs +0 -160
  51. package/esm2022/Tools/src/Screen.class.mjs +0 -43
  52. package/esm2022/Tools/src/Source.class.mjs +0 -79
  53. package/esm2022/Tools/src/Tools.mjs +0 -200
  54. package/esm2022/components/index.mjs +0 -3
  55. package/esm2022/components/src/coer-alert/coer-alert.component.mjs +0 -227
  56. package/esm2022/components/src/components.module.mjs +0 -92
  57. package/esm2022/interfaces/index.mjs +0 -7
  58. package/esm2022/interfaces/src/IAppSource.interface.mjs +0 -2
  59. package/esm2022/interfaces/src/IBreadcrumb.interface.mjs +0 -2
  60. package/esm2022/interfaces/src/ICoerRef.interface.mjs +0 -2
  61. package/esm2022/interfaces/src/IGoBack.interface.mjs +0 -2
  62. package/esm2022/interfaces/src/IPatch.interface.mjs +0 -2
  63. package/esm2022/interfaces/src/IScreenSize.interface.mjs +0 -2
  64. package/interfaces/index.d.ts +0 -6
  65. package/interfaces/src/IAppSource.interface.d.ts +0 -4
  66. package/interfaces/src/IBreadcrumb.interface.d.ts +0 -6
  67. package/interfaces/src/ICoerRef.interface.d.ts +0 -10
  68. package/interfaces/src/IGoBack.interface.d.ts +0 -6
  69. package/interfaces/src/IPatch.interface.d.ts +0 -5
  70. package/interfaces/src/IScreenSize.interface.d.ts +0 -5
  71. package/styles/coer.scss +0 -96
@@ -1,1010 +1,4 @@
1
- import * as i0 from '@angular/core';
2
- import { Component, NgModule, forwardRef, inject, Inject, signal } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { RouterModule, Router, ActivatedRoute } from '@angular/router';
5
- import { FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
6
- import * as bootstrap from 'bootstrap';
7
- import Swal from 'sweetalert2';
8
- import moment from 'moment';
9
- import * as XLSX from 'xlsx';
10
- import { Observable } from 'rxjs';
11
-
12
- class CoerAlert {
13
- /** */
14
- Success(message = null, title = null, icon = null, autohide = 3000) {
15
- //Title
16
- if (!title || title == '')
17
- title = 'Success';
18
- const alertSuccessTitle = document.getElementById('alert-success-title');
19
- alertSuccessTitle.textContent = title;
20
- //Icon
21
- icon = this.GetIcon(title, icon, 'bi-check-circle fa-beat');
22
- const alertSuccessIcon = document.getElementById('alert-success-icon');
23
- this.SetIcon(alertSuccessIcon, icon);
24
- //Message
25
- if (!message)
26
- message = '';
27
- const alertSuccessMessage = document.getElementById('alert-success-message');
28
- alertSuccessMessage.innerHTML = message;
29
- //Toast
30
- const alertSuccess = document.getElementById('alert-success');
31
- this.SetAutoHide(alertSuccess, autohide);
32
- const toast = bootstrap.Toast.getOrCreateInstance(alertSuccess);
33
- toast.show();
34
- }
35
- /** */
36
- Error(message = null, title = null, icon = null, autohide = 3000) {
37
- //Title
38
- if (!title || title == '')
39
- title = 'Error';
40
- const alertErrorTitle = document.getElementById('alert-error-title');
41
- alertErrorTitle.textContent = title;
42
- //Icon
43
- icon = this.GetIcon(title, icon, 'bi-exclamation-octagon fa-beat');
44
- const alertErrorIcon = document.getElementById('alert-error-icon');
45
- this.SetIcon(alertErrorIcon, icon);
46
- //Message
47
- if (!message)
48
- message = '';
49
- const alertErrorBody = document.getElementById('alert-error-message');
50
- alertErrorBody.innerHTML = message;
51
- //Toast
52
- const alertError = document.getElementById('alert-error');
53
- this.SetAutoHide(alertError, autohide);
54
- const toast = bootstrap.Toast.getOrCreateInstance(alertError);
55
- toast.show();
56
- }
57
- /** */
58
- Info(message = null, title = null, icon = null, autohide = 3000) {
59
- //Title
60
- if (!title || title == '')
61
- title = 'Info';
62
- const alertInfoTitle = document.getElementById('alert-info-title');
63
- alertInfoTitle.textContent = title;
64
- //Icon
65
- icon = this.GetIcon(title, icon, 'bi-info-circle fa-beat');
66
- const alertInfoIcon = document.getElementById('alert-info-icon');
67
- this.SetIcon(alertInfoIcon, icon);
68
- //Message
69
- if (!message)
70
- message = '';
71
- const alertInfoBody = document.getElementById('alert-info-message');
72
- alertInfoBody.innerHTML = message;
73
- //Toast
74
- const alertInfo = document.getElementById('alert-info');
75
- this.SetAutoHide(alertInfo, autohide);
76
- const toast = bootstrap.Toast.getOrCreateInstance(alertInfo);
77
- toast.show();
78
- }
79
- /** */
80
- Warning(message = null, title = null, icon = null, autohide = 3000) {
81
- //Title
82
- if (!title || title == '')
83
- title = 'Warning';
84
- const alertWarningTitle = document.getElementById('alert-warning-title');
85
- alertWarningTitle.textContent = title;
86
- //Icon
87
- icon = this.GetIcon(title, icon, 'bi-exclamation-triangle-fill fa-beat');
88
- const alertWarningIcon = document.getElementById('alert-warning-icon');
89
- this.SetIcon(alertWarningIcon, icon);
90
- //Message
91
- if (!message)
92
- message = '';
93
- const alertWarningBody = document.getElementById('alert-warning-message');
94
- alertWarningBody.innerHTML = message;
95
- //Toast
96
- const alertWarning = document.getElementById('alert-warning');
97
- this.SetAutoHide(alertWarning, autohide);
98
- const toast = bootstrap.Toast.getOrCreateInstance(alertWarning);
99
- toast.show();
100
- }
101
- /** */
102
- Close(alert) {
103
- return new Promise(Resolve => {
104
- const element = document.getElementById(alert);
105
- const toast = bootstrap.Toast.getOrCreateInstance(element);
106
- toast.hide();
107
- setTimeout(() => { Resolve(); }, 200);
108
- });
109
- }
110
- /** */
111
- Confirm(message = 'Proceed?', alertType = 'warning', icon = null) {
112
- return new Promise(Resolve => {
113
- let color;
114
- let iconType;
115
- switch (alertType) {
116
- case 'danger':
117
- {
118
- if (icon == null)
119
- icon = 'bi-exclamation-octagon';
120
- iconType = 'error';
121
- color = '#dc3545'; //red
122
- break;
123
- }
124
- ;
125
- case 'success':
126
- {
127
- if (icon == null)
128
- icon = 'bi-check-circle';
129
- iconType = 'info';
130
- color = '#198754'; //green
131
- break;
132
- }
133
- ;
134
- case 'info':
135
- {
136
- if (icon == null)
137
- icon = 'bi-info-circle';
138
- iconType = 'error';
139
- color = '#0d6efd'; //blue
140
- break;
141
- }
142
- ;
143
- default: {
144
- if (icon == null)
145
- icon = 'bi-exclamation-triangle-fill';
146
- iconType = 'warning';
147
- color = '#ffc107'; //yellow
148
- break;
149
- }
150
- }
151
- switch (icon) {
152
- case 'delete':
153
- icon = 'fa-regular fa-trash-can';
154
- break;
155
- }
156
- Swal.fire({
157
- icon: iconType,
158
- iconColor: 'transparent',
159
- iconHtml: `<i class="${icon}" style="color: ${color};"></i>`,
160
- html: message,
161
- showConfirmButton: true,
162
- confirmButtonText: 'Yes',
163
- confirmButtonColor: color,
164
- focusConfirm: true,
165
- showDenyButton: true,
166
- denyButtonColor: color,
167
- focusDeny: false,
168
- reverseButtons: true,
169
- allowOutsideClick: false,
170
- allowEscapeKey: false,
171
- allowEnterKey: true,
172
- customClass: {
173
- denyButton: 'sweet-alert-button',
174
- confirmButton: 'sweet-alert-button'
175
- }
176
- }).then(({ value }) => setTimeout(() => Resolve(value)));
177
- });
178
- }
179
- /** */
180
- SetIcon(element, icon) {
181
- for (const item of [...element.classList.value.split(' ')]) {
182
- if (item.length > 0) {
183
- element.classList.remove(item);
184
- element.classList.remove('q');
185
- }
186
- }
187
- icon = icon.trim();
188
- const hasWhiteSpaces = / /;
189
- if (hasWhiteSpaces.test(icon)) {
190
- const classes = icon.split(' ');
191
- for (const icon of classes)
192
- element.classList.add(icon);
193
- }
194
- else
195
- element.classList.add(icon);
196
- }
197
- /** */
198
- SetAutoHide(element, autohide) {
199
- element.removeAttribute('data-bs-autohide');
200
- element.removeAttribute('data-bs-delay');
201
- if (autohide && autohide > 0) {
202
- if (autohide < 1000)
203
- autohide = 1000;
204
- element.setAttribute('data-bs-autohide', 'true');
205
- element.setAttribute('data-bs-delay', String(autohide));
206
- }
207
- else
208
- element.setAttribute('data-bs-autohide', 'false');
209
- }
210
- /** */
211
- GetIcon(title, icon, iconDefault) {
212
- if (icon == null || icon == '') {
213
- title = title.replaceAll(' ', '').toUpperCase();
214
- switch (title) {
215
- case 'ENABLED': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
216
- case 'ACTIVE': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
217
- case 'ACTIVED': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
218
- case 'DISABLE': return 'fa-solid fa-thumbs-down fa-flip-horizontal';
219
- case 'DISABLED': return 'fa-solid fa-thumbs-down fa-flip-horizontal';
220
- case 'DELETE': return 'fa-regular fa-trash-can';
221
- case 'DELETED': return 'fa-regular fa-trash-can';
222
- default: return iconDefault;
223
- }
224
- }
225
- return icon;
226
- }
227
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerAlert, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
228
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CoerAlert, selector: "coer-alert", ngImport: i0, template: "<aside class=\"toast-container coer-alert\">\r\n <!-- Success -->\r\n <div id=\"alert-success\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" class=\"toast\">\r\n <div class=\"toast-header\">\r\n <i id=\"alert-success-icon\"></i>\r\n <strong id=\"alert-success-title\"></strong>\r\n <button type=\"button\" (click)=\"Close('alert-success')\" class=\"btn-close btn-close-white\"></button>\r\n </div>\r\n\r\n <div class=\"toast-body\">\r\n <pre id=\"alert-success-message\"></pre>\r\n </div>\r\n </div>\r\n\r\n\r\n <!-- Error -->\r\n <div id=\"alert-error\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" class=\"toast\">\r\n <div class=\"toast-header\">\r\n <i id=\"alert-error-icon\"></i>\r\n <strong id=\"alert-error-title\"></strong>\r\n <button type=\"button\" (click)=\"Close('alert-error')\" class=\"btn-close btn-close-white\"></button>\r\n </div>\r\n\r\n <div class=\"toast-body\">\r\n <pre id=\"alert-error-message\"></pre>\r\n </div>\r\n </div>\r\n\r\n\r\n <!-- Info -->\r\n <div id=\"alert-info\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" class=\"toast\">\r\n <div class=\"toast-header\">\r\n <i id=\"alert-info-icon\"></i>\r\n <strong id=\"alert-info-title\"></strong>\r\n <button type=\"button\" (click)=\"Close('alert-info')\" class=\"btn-close btn-close-white\"></button>\r\n </div>\r\n\r\n <div class=\"toast-body\">\r\n <pre id=\"alert-info-message\"></pre>\r\n </div>\r\n </div>\r\n\r\n\r\n <!-- Warning -->\r\n <div id=\"alert-warning\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" class=\"toast\">\r\n <div class=\"toast-header\">\r\n <i id=\"alert-warning-icon\"></i>\r\n <strong id=\"alert-warning-title\"></strong>\r\n <button type=\"button\" (click)=\"Close('alert-warning')\" class=\"btn-close\"></button>\r\n </div>\r\n\r\n <div class=\"toast-body\">\r\n <pre id=\"alert-warning-message\"></pre>\r\n </div>\r\n </div>\r\n</aside>", styles: [".text-blue{color:#0d6efd!important}.text-blue-bold{color:#0d6efd!important;font-weight:700!important}.background-blue{background-color:#0d6efd!important}.background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}.text-gray{color:#6c757d!important}.text-gray-bold{color:#6c757d!important;font-weight:700!important}.background-gray{background-color:#6c757d!important}.background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}.text-green{color:#198754!important}.text-green-bold{color:#198754!important;font-weight:700!important}.background-green{background-color:#198754!important}.background-border-green{background-color:#198754!important;border-color:#198754!important}.text-yellow{color:#ffc107!important}.text-yellow-bold{color:#ffc107!important;font-weight:700!important}.background-yellow{background-color:#ffc107!important}.background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}.text-red{color:#dc3545!important}.text-red-bold{color:#dc3545!important;font-weight:700!important}.background-red{background-color:#dc3545!important}.background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}.text-white{color:#f5f5f5!important}.text-white-bold{color:#f5f5f5!important;font-weight:700!important}.background-white{background-color:#f5f5f5!important}.background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}.text-black{color:#252525!important}.text-black-bold{color:#252525!important;font-weight:700!important}.background-black{background-color:#252525!important}.background-border-black{background-color:#252525!important;border-color:#252525!important}.text-orange{color:#fd6031!important}.text-orange-bold{color:#fd6031!important;font-weight:700!important}.background-orange{background-color:#fd6031!important}.background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}aside.toast-container{position:fixed;bottom:0;right:0;padding:15px!important;z-index:2000!important}aside.toast-container i,aside.toast-container svg{display:flex;align-items:center}aside.toast-container strong{margin:0 auto 0 5px}aside.toast-container div.toast,aside.toast-container div.toast-header{border-top-left-radius:10px;border-top-right-radius:10px;color:#f5f5f5}aside.toast-container div.toast,aside.toast-container div.toast-body{border-bottom-left-radius:10px;border-bottom-right-radius:10px;color:#f5f5f5}aside.toast-container div.toast-body{min-height:36px}aside.toast-container pre{font-family:Roboto,RobotoFallback,Noto Kufi Arabic,Helvetica,Arial,sans-serif;white-space:pre-wrap;font-size:medium}aside.toast-container button{margin:0 2px!important;width:10px!important;height:10px!important;box-shadow:none!important;outline:none!important;border:none!important}aside.toast-container div#alert-success div.toast-header,aside.toast-container div#alert-success div.toast-body{background-color:#198754}aside.toast-container div#alert-info div.toast-header,aside.toast-container div#alert-info div.toast-body{background-color:#0d6efd}aside.toast-container div#alert-error div.toast-header,aside.toast-container div#alert-error div.toast-body{background-color:#dc3545}aside.toast-container div#alert-warning div.toast-header,aside.toast-container div#alert-warning div.toast-body{background-color:#ffc107;border-color:#252525;color:#252525}aside.toast-container div#alert-success:hover,aside.toast-container div#alert-info:hover,aside.toast-container div#alert-error:hover,aside.toast-container div#alert-warning:hover{transform:scale(1.01);box-shadow:2px 2px 10px #789;cursor:default}button.sweet-alert-button{width:100px!important;height:40px!important;display:flex!important;align-items:center!important;justify-content:center!important;margin:0 5px!important;outline:none!important;border:none!important;box-shadow:none!important}aside.toast-container>*{border:none!important;z-index:2000!important;margin:15px 0 0!important}\n"] }); }
229
- }
230
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerAlert, decorators: [{
231
- type: Component,
232
- args: [{ selector: 'coer-alert', template: "<aside class=\"toast-container coer-alert\">\r\n <!-- Success -->\r\n <div id=\"alert-success\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" class=\"toast\">\r\n <div class=\"toast-header\">\r\n <i id=\"alert-success-icon\"></i>\r\n <strong id=\"alert-success-title\"></strong>\r\n <button type=\"button\" (click)=\"Close('alert-success')\" class=\"btn-close btn-close-white\"></button>\r\n </div>\r\n\r\n <div class=\"toast-body\">\r\n <pre id=\"alert-success-message\"></pre>\r\n </div>\r\n </div>\r\n\r\n\r\n <!-- Error -->\r\n <div id=\"alert-error\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" class=\"toast\">\r\n <div class=\"toast-header\">\r\n <i id=\"alert-error-icon\"></i>\r\n <strong id=\"alert-error-title\"></strong>\r\n <button type=\"button\" (click)=\"Close('alert-error')\" class=\"btn-close btn-close-white\"></button>\r\n </div>\r\n\r\n <div class=\"toast-body\">\r\n <pre id=\"alert-error-message\"></pre>\r\n </div>\r\n </div>\r\n\r\n\r\n <!-- Info -->\r\n <div id=\"alert-info\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" class=\"toast\">\r\n <div class=\"toast-header\">\r\n <i id=\"alert-info-icon\"></i>\r\n <strong id=\"alert-info-title\"></strong>\r\n <button type=\"button\" (click)=\"Close('alert-info')\" class=\"btn-close btn-close-white\"></button>\r\n </div>\r\n\r\n <div class=\"toast-body\">\r\n <pre id=\"alert-info-message\"></pre>\r\n </div>\r\n </div>\r\n\r\n\r\n <!-- Warning -->\r\n <div id=\"alert-warning\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" class=\"toast\">\r\n <div class=\"toast-header\">\r\n <i id=\"alert-warning-icon\"></i>\r\n <strong id=\"alert-warning-title\"></strong>\r\n <button type=\"button\" (click)=\"Close('alert-warning')\" class=\"btn-close\"></button>\r\n </div>\r\n\r\n <div class=\"toast-body\">\r\n <pre id=\"alert-warning-message\"></pre>\r\n </div>\r\n </div>\r\n</aside>", styles: [".text-blue{color:#0d6efd!important}.text-blue-bold{color:#0d6efd!important;font-weight:700!important}.background-blue{background-color:#0d6efd!important}.background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}.text-gray{color:#6c757d!important}.text-gray-bold{color:#6c757d!important;font-weight:700!important}.background-gray{background-color:#6c757d!important}.background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}.text-green{color:#198754!important}.text-green-bold{color:#198754!important;font-weight:700!important}.background-green{background-color:#198754!important}.background-border-green{background-color:#198754!important;border-color:#198754!important}.text-yellow{color:#ffc107!important}.text-yellow-bold{color:#ffc107!important;font-weight:700!important}.background-yellow{background-color:#ffc107!important}.background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}.text-red{color:#dc3545!important}.text-red-bold{color:#dc3545!important;font-weight:700!important}.background-red{background-color:#dc3545!important}.background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}.text-white{color:#f5f5f5!important}.text-white-bold{color:#f5f5f5!important;font-weight:700!important}.background-white{background-color:#f5f5f5!important}.background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}.text-black{color:#252525!important}.text-black-bold{color:#252525!important;font-weight:700!important}.background-black{background-color:#252525!important}.background-border-black{background-color:#252525!important;border-color:#252525!important}.text-orange{color:#fd6031!important}.text-orange-bold{color:#fd6031!important;font-weight:700!important}.background-orange{background-color:#fd6031!important}.background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}aside.toast-container{position:fixed;bottom:0;right:0;padding:15px!important;z-index:2000!important}aside.toast-container i,aside.toast-container svg{display:flex;align-items:center}aside.toast-container strong{margin:0 auto 0 5px}aside.toast-container div.toast,aside.toast-container div.toast-header{border-top-left-radius:10px;border-top-right-radius:10px;color:#f5f5f5}aside.toast-container div.toast,aside.toast-container div.toast-body{border-bottom-left-radius:10px;border-bottom-right-radius:10px;color:#f5f5f5}aside.toast-container div.toast-body{min-height:36px}aside.toast-container pre{font-family:Roboto,RobotoFallback,Noto Kufi Arabic,Helvetica,Arial,sans-serif;white-space:pre-wrap;font-size:medium}aside.toast-container button{margin:0 2px!important;width:10px!important;height:10px!important;box-shadow:none!important;outline:none!important;border:none!important}aside.toast-container div#alert-success div.toast-header,aside.toast-container div#alert-success div.toast-body{background-color:#198754}aside.toast-container div#alert-info div.toast-header,aside.toast-container div#alert-info div.toast-body{background-color:#0d6efd}aside.toast-container div#alert-error div.toast-header,aside.toast-container div#alert-error div.toast-body{background-color:#dc3545}aside.toast-container div#alert-warning div.toast-header,aside.toast-container div#alert-warning div.toast-body{background-color:#ffc107;border-color:#252525;color:#252525}aside.toast-container div#alert-success:hover,aside.toast-container div#alert-info:hover,aside.toast-container div#alert-error:hover,aside.toast-container div#alert-warning:hover{transform:scale(1.01);box-shadow:2px 2px 10px #789;cursor:default}button.sweet-alert-button{width:100px!important;height:40px!important;display:flex!important;align-items:center!important;justify-content:center!important;margin:0 5px!important;outline:none!important;border:none!important;box-shadow:none!important}aside.toast-container>*{border:none!important;z-index:2000!important;margin:15px 0 0!important}\n"] }]
233
- }] });
234
-
235
- //import { CoerButton } from './coer-button/coer-button.component';
236
- //import { CoerCheckbox } from './coer-checkbox/coer-checkbox.component';
237
- //import { CoerFilebox } from './coer-filebox/coer-filebox.component';
238
- //import { CoerForm } from './coer-form/coer-form.component';
239
- //import { CoerGrid } from './coer-grid/coer-grid.component';
240
- //import { CoerModal } from './coer-modal/coer-modal.component';
241
- //import { CoerNumberBox } from './coer-numberbox/coer-numberbox.component';
242
- //import { CoerPageTitle } from './coer-page-title/coer-page-title.component';
243
- //import { CoerSelectbox } from './coer-selectbox/coer-selectbox.component';
244
- //import { CoerSwitch } from './coer-switch/coer-switch.component';
245
- //import { CoerTab } from './coer-tab/coer-tab.component';
246
- //import { CoerTextarea } from './coer-textarea/coer-textarea.component';
247
- //import { CoerTextBox } from './coer-textbox/coer-textbox.component';
248
- class ComponentsModule {
249
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
250
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: ComponentsModule, declarations: [CoerAlert], imports: [CommonModule,
251
- RouterModule,
252
- FormsModule,
253
- ReactiveFormsModule], exports: [CoerAlert] }); }
254
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ComponentsModule, imports: [CommonModule,
255
- RouterModule,
256
- FormsModule,
257
- ReactiveFormsModule] }); }
258
- }
259
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ComponentsModule, decorators: [{
260
- type: NgModule,
261
- args: [{
262
- imports: [
263
- CommonModule,
264
- RouterModule,
265
- FormsModule,
266
- ReactiveFormsModule,
267
- //PipesModule,
268
- //MatButtonModule,
269
- //MatCheckboxModule,
270
- //MatInputModule,
271
- //MatFormFieldModule,
272
- //MatSlideToggleModule,
273
- //MatTabsModule,
274
- //DirectivesModule
275
- ],
276
- declarations: [
277
- CoerAlert,
278
- //CoerButton,
279
- //CoerCheckbox,
280
- //CoerFilebox,
281
- //CoerForm,
282
- //CoerGrid,
283
- //CoerModal,
284
- //CoerNumberBox,
285
- //CoerPageTitle,
286
- //CoerSelectbox,
287
- //CoerSwitch,
288
- //CoerTextarea,
289
- //CoerTab,
290
- //CoerTextBox,
291
- ],
292
- exports: [
293
- CoerAlert,
294
- //CoerButton,
295
- //CoerCheckbox,
296
- //CoerFilebox,
297
- //CoerForm,
298
- //CoerGrid,
299
- //CoerModal,
300
- //CoerNumberBox,
301
- //CoerPageTitle,
302
- //CoerSelectbox,
303
- //CoerSwitch,
304
- //CoerTextarea,
305
- //CoerTab,
306
- //CoerTextBox,
307
- ]
308
- }]
309
- }] });
310
-
311
- class Breadcrumbs {
312
- static { this.storage = 'COER-System'; }
313
- /** */
314
- static Add(page, path) {
315
- const breadcrumbs = this.Get();
316
- const paths = breadcrumbs.map(item => item.path);
317
- if (!paths.includes(path)) {
318
- breadcrumbs.push({ page, path });
319
- this.Save(breadcrumbs);
320
- }
321
- }
322
- /** */
323
- static Get() {
324
- let storage = sessionStorage.getItem(this.storage);
325
- if (storage) {
326
- storage = JSON.parse(storage);
327
- if (storage.hasOwnProperty('breadcrumbs')) {
328
- return Tools.BreakReference(storage.breadcrumbs);
329
- }
330
- }
331
- return [];
332
- }
333
- /** Source */
334
- static GetFirst() {
335
- const breadcrumbs = this.Get();
336
- return (breadcrumbs.length > 0) ? breadcrumbs.shift() : null;
337
- }
338
- /** */
339
- static Save(breadcrumbs) {
340
- let storage = sessionStorage.getItem(this.storage);
341
- if (storage)
342
- storage = JSON.parse(storage);
343
- storage = Object.assign({}, storage, { breadcrumbs });
344
- sessionStorage.setItem(this.storage, JSON.stringify(storage));
345
- }
346
- /** */
347
- static Remove(path) {
348
- let breadcrumbs = this.Get();
349
- const index = breadcrumbs.findIndex(x => x.path.toLowerCase().trim() === path.toLowerCase().trim());
350
- if (index >= 0) {
351
- breadcrumbs = Tools.BreakReference(breadcrumbs).splice(0, index + 1);
352
- this.Save(breadcrumbs);
353
- }
354
- }
355
- /** */
356
- static SetLast(page, path) {
357
- const breadcrumbs = this.Get();
358
- if (breadcrumbs.length > 0) {
359
- breadcrumbs[breadcrumbs.length - 1] = { page, path };
360
- this.Save(breadcrumbs);
361
- }
362
- }
363
- /** */
364
- static RemoveLast() {
365
- const breadcrumbs = this.Get();
366
- if (breadcrumbs.length > 0) {
367
- breadcrumbs.pop();
368
- this.Save(breadcrumbs);
369
- }
370
- }
371
- }
372
-
373
- const CONTROL_VALUE = (component) => {
374
- return {
375
- provide: NG_VALUE_ACCESSOR,
376
- useExisting: forwardRef(() => component),
377
- multi: true
378
- };
379
- };
380
- class ControlValue {
381
- constructor() {
382
- this._isTouched = false;
383
- }
384
- get isTouched() {
385
- return this._isTouched;
386
- }
387
- /** */
388
- SetValue(value) {
389
- if (typeof this._UpdateValue === 'function') {
390
- this._UpdateValue(value);
391
- }
392
- this._value = value;
393
- }
394
- /** */
395
- SetTouched(isTouched) {
396
- if (typeof this._IsTouched === 'function') {
397
- this._IsTouched(isTouched);
398
- }
399
- this._isTouched = isTouched;
400
- }
401
- /** */
402
- writeValue(value) {
403
- this._value = value;
404
- }
405
- /** */
406
- registerOnChange(callback) {
407
- this._UpdateValue = callback;
408
- }
409
- /** */
410
- registerOnTouched(callback) {
411
- this._IsTouched = callback;
412
- }
413
- }
414
-
415
- class DateTime {
416
- /** Get UTC Offset */
417
- static GetUTCOffset() {
418
- return moment().utcOffset();
419
- }
420
- /** Convert UTC Date to Local Zone */
421
- static ToLocalZone(utcDate) {
422
- return moment(utcDate).add(DateTime.GetUTCOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
423
- }
424
- /** Convert Local Zone Date to UTC */
425
- static ToUTC(utcDate) {
426
- return moment(utcDate).subtract(DateTime.GetUTCOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
427
- }
428
- /** DD MMM YYYY */
429
- static GetDateFormat(date) {
430
- if ((typeof date === 'string'))
431
- date = date.replaceAll('/', '-');
432
- return moment(date).parseZone().local(true).format('DD MMM YYYY');
433
- }
434
- }
435
-
436
- class Files {
437
- static { this.EXCEL_EXTENSIONS = ['xls', 'xlsx', 'csv']; }
438
- /** Get Extension File */
439
- static GetExtension(file) {
440
- const fileName = file.name;
441
- if (fileName.includes('.')) {
442
- let worlds = fileName.split('.');
443
- if (worlds.length > 0) {
444
- let extension = worlds.pop();
445
- extension = extension.trim().toLowerCase();
446
- if (extension.length > 0)
447
- return extension;
448
- }
449
- }
450
- return null;
451
- }
452
- /** Is Excel File */
453
- static IsExcel(file) {
454
- const EXTENSION = Files.GetExtension(file);
455
- return Tools.IsNotNull(EXTENSION)
456
- ? this.EXCEL_EXTENSIONS.includes(EXTENSION)
457
- : false;
458
- }
459
- /** Read excel file */
460
- static ReadExcel(file) {
461
- return new Promise(Resolve => {
462
- let columns = [];
463
- let rows = [];
464
- const reader = new FileReader();
465
- reader.readAsArrayBuffer(file);
466
- reader.onload = () => {
467
- const dataBytes = new Uint8Array(reader.result);
468
- if (dataBytes) {
469
- const workbook = XLSX.read(dataBytes, {});
470
- const sheet = workbook.Sheets[workbook.SheetNames[0]];
471
- let dataSheet = XLSX.utils.sheet_to_json(sheet, {
472
- header: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
473
- });
474
- //Get Headers
475
- for (const column in dataSheet[0]) {
476
- columns.push(Tools.FirstCharToLower(String(dataSheet[0][column]).replaceAll(' ', '')));
477
- }
478
- //Get Rows
479
- rows = XLSX.utils.sheet_to_json(sheet, { header: columns });
480
- rows.shift();
481
- rows = rows.map(row => {
482
- const item = Tools.BreakReference(row);
483
- delete item['__rowNum__'];
484
- return item;
485
- });
486
- }
487
- Resolve({ columns, rows });
488
- };
489
- reader.onerror = () => { Resolve({ columns, rows }); };
490
- });
491
- }
492
- /** Export to excel file */
493
- static ExportExcel(data, fileName = 'coer_report', sheetName = 'Sheet1') {
494
- sheetName = Tools.CleanUpBlanks(sheetName);
495
- fileName = Tools.CleanUpBlanks(fileName);
496
- if (fileName.endsWith('.xls') || fileName.endsWith('.xlsx') || fileName.endsWith('.csv')) {
497
- if (fileName.includes('.xls')) {
498
- fileName = fileName.replaceAll('.xls', '.xlsx');
499
- }
500
- if (fileName.includes('.csv')) {
501
- fileName = fileName.replaceAll('.csv', '.xlsx');
502
- }
503
- }
504
- else {
505
- fileName += '.xlsx';
506
- }
507
- const WORK_SHEET = XLSX.utils.json_to_sheet(data);
508
- const WORK_BOOK = XLSX.utils.book_new();
509
- XLSX.utils.book_append_sheet(WORK_BOOK, WORK_SHEET, 'Sheet1');
510
- XLSX.writeFile(WORK_BOOK, fileName);
511
- }
512
- /** Convert file to string base64 */
513
- static ConvertToBase64(file) {
514
- return new Promise(Resolve => {
515
- const reader = new FileReader();
516
- reader.readAsDataURL(file);
517
- reader.onload = () => {
518
- Resolve(reader.result?.toString() || '');
519
- };
520
- reader.onerror = () => {
521
- Resolve('');
522
- };
523
- });
524
- }
525
- }
526
-
527
- class Page {
528
- constructor(page) {
529
- //Injection
530
- this.alert = inject(CoerAlert);
531
- this.router = inject(Router);
532
- this.activatedRoute = inject(ActivatedRoute);
533
- /** */
534
- this.isUpdate = false;
535
- /** */
536
- this.isLoading = false;
537
- /** */
538
- this.isReady = false;
539
- /** */
540
- this.enableAnimations = false;
541
- /** */
542
- this.breadcrumbs = [];
543
- /** */
544
- this.pageResponse = null;
545
- /** */
546
- this.goBack = { show: false };
547
- //Private Variables
548
- this._page = '';
549
- this._source = null;
550
- this._preventDestroy = false;
551
- /** */
552
- this.GoBack = (path) => (() => {
553
- if (path)
554
- Breadcrumbs.Remove(path);
555
- else
556
- Breadcrumbs.RemoveLast();
557
- });
558
- /** Returns true if the value is null or undefined, false otherwise */
559
- this.IsNotNull = Tools.IsNotNull;
560
- /** Returns true if the value is null or undefined, false otherwise */
561
- this.IsNull = Tools.IsNull;
562
- /** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
563
- this.IsOnlyWhiteSpace = Tools.IsOnlyWhiteSpace;
564
- this.SetPageName(page);
565
- this.SetSource();
566
- this.GetSource();
567
- this.GetNavigation();
568
- this.SetGoBack();
569
- this.GetPageResponse();
570
- }
571
- ngAfterViewInit() {
572
- this.routeParams = this.activatedRoute.snapshot.params;
573
- this.queryParams = this.activatedRoute.snapshot.queryParams;
574
- setTimeout(() => {
575
- this.isReady = true;
576
- this.RunPage();
577
- setTimeout(() => { this.enableAnimations = true; }, 1000);
578
- });
579
- }
580
- ngOnDestroy() {
581
- if (!this._preventDestroy)
582
- Source.ClearPageResponse();
583
- }
584
- /** Main method. Starts after ngAfterViewInit() */
585
- RunPage() { }
586
- ;
587
- /** Rename the last breadcrumb and update the url id */
588
- SetPageName(name, id = null) {
589
- this._page = name;
590
- let path = this.router.url;
591
- if (path.includes('?'))
592
- path = path.split('?')[0];
593
- if (id) {
594
- const PATH_ARRAY = path.split('/');
595
- const PATH_ID = Tools.BreakReference(PATH_ARRAY).pop();
596
- if (PATH_ID) {
597
- PATH_ARRAY[PATH_ARRAY.length - 1] = String(id);
598
- path = PATH_ARRAY.join('/');
599
- }
600
- }
601
- if (this.breadcrumbs.length > 0) {
602
- this.breadcrumbs[this.breadcrumbs.length - 1].page = name;
603
- this.breadcrumbs[this.breadcrumbs.length - 1].path = path;
604
- Breadcrumbs.SetLast(name, path);
605
- }
606
- this.router.navigateByUrl(path);
607
- }
608
- /** */
609
- SetSource() {
610
- Source.Set(this._page);
611
- }
612
- /** */
613
- GetSource() {
614
- this._source = Source.Get();
615
- }
616
- /** */
617
- GetPageResponse() {
618
- this.pageResponse = Source.GetPageResponse();
619
- }
620
- /** */
621
- GetNavigation() {
622
- if (this._source) {
623
- this.breadcrumbs = Breadcrumbs.Get().map(item => Object.assign({
624
- page: item.page,
625
- path: item.path,
626
- click: this.GoBack(item.path)
627
- }));
628
- }
629
- else
630
- this.breadcrumbs = [{ page: this._page }];
631
- }
632
- /** */
633
- SetGoBack() {
634
- if (this._source) {
635
- this.goBack = {
636
- show: true,
637
- path: this._source.path,
638
- click: this.GoBack()
639
- };
640
- }
641
- }
642
- /** Navigate to previous page */
643
- GoToSource(pageResponse = null) {
644
- if (this._source) {
645
- Breadcrumbs.RemoveLast();
646
- this.SetPageResponse(pageResponse);
647
- Tools.Sleep().then(_ => this.router.navigateByUrl(this._source.path));
648
- }
649
- }
650
- ;
651
- /** */
652
- SetPageResponse(pageResponse = null) {
653
- if (Tools.IsNotNull(pageResponse)) {
654
- this._preventDestroy = true;
655
- Source.SetPageResponse(pageResponse);
656
- }
657
- }
658
- ;
659
- /** */
660
- ReloadPage() {
661
- Breadcrumbs.RemoveLast();
662
- Tools.Sleep().then(_ => window.location.reload());
663
- }
664
- /** */
665
- Log(value, log = null) {
666
- if (Tools.IsNotNull(log))
667
- console.log({ log, value });
668
- else
669
- console.log(value);
670
- }
671
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Page, deps: [{ token: String }], target: i0.ɵɵFactoryTarget.Component }); }
672
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: Page, selector: "ng-component", ngImport: i0, template: '', isInline: true }); }
673
- }
674
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Page, decorators: [{
675
- type: Component,
676
- args: [{ template: '' }]
677
- }], ctorParameters: () => [{ type: undefined, decorators: [{
678
- type: Inject,
679
- args: [String]
680
- }] }] });
681
-
682
- class Screen {
683
- static get WINDOW_WIDTH() {
684
- return window.innerWidth;
685
- }
686
- static get WINDOW_HEIGHT() {
687
- return window.innerHeight;
688
- }
689
- static get DEVICE_WIDTH() {
690
- return window.screen.width;
691
- }
692
- static get DEVICE_HEIGHT() {
693
- return window.screen.height;
694
- }
695
- static get BREAKPOINT() {
696
- if (window.innerWidth < 576)
697
- return 'xs';
698
- else if (window.innerWidth >= 576 && window.innerWidth < 768)
699
- return 'sm';
700
- else if (window.innerWidth >= 768 && window.innerWidth < 992)
701
- return 'md';
702
- else if (window.innerWidth >= 992 && window.innerWidth < 1200)
703
- return 'lg';
704
- else if (window.innerWidth >= 1200 && window.innerWidth < 1400)
705
- return 'xl';
706
- else
707
- return 'xxl';
708
- }
709
- /** */
710
- static { this.Resize = new Observable(subscriber => {
711
- window.addEventListener("load", () => {
712
- window.dispatchEvent(new Event('resize'));
713
- });
714
- window.onresize = () => {
715
- subscriber.next({
716
- width: window.innerWidth,
717
- height: window.innerHeight,
718
- breakpoin: this.BREAKPOINT
719
- });
720
- };
721
- }); }
722
- }
723
-
724
- class Source {
725
- static { this.storage = 'COER-System'; }
726
- /** */
727
- static Set(page) {
728
- const ROUTER = inject(Router);
729
- let path = ROUTER.url;
730
- if (path.includes('?'))
731
- path = path.split('?')[0];
732
- Breadcrumbs.Add(page, path);
733
- const breadcrumbs = Breadcrumbs.Get();
734
- if (breadcrumbs.length >= 2) {
735
- breadcrumbs.pop();
736
- const breadcrumb = breadcrumbs.pop();
737
- this.Save({ page: breadcrumb.page, path: breadcrumb.path });
738
- }
739
- else
740
- this.Save(null);
741
- }
742
- /** */
743
- static Save(source) {
744
- let storage = sessionStorage.getItem(this.storage);
745
- if (storage)
746
- storage = JSON.parse(storage);
747
- storage = Object.assign({}, storage, { source });
748
- sessionStorage.setItem(this.storage, JSON.stringify(storage));
749
- }
750
- /** */
751
- static Get() {
752
- let storage = sessionStorage.getItem(this.storage);
753
- if (storage) {
754
- storage = JSON.parse(storage);
755
- if (storage.hasOwnProperty('source')) {
756
- return storage.source;
757
- }
758
- }
759
- return null;
760
- }
761
- /** */
762
- static GetRoot() {
763
- const breadcrumbs = Breadcrumbs.Get();
764
- return (breadcrumbs.length > 0) ? breadcrumbs.shift() : null;
765
- }
766
- /** */
767
- static SetPageResponse(pageResponse) {
768
- let storage = sessionStorage.getItem(this.storage);
769
- storage = JSON.parse(storage);
770
- storage = Object.assign({}, storage, { pageResponse });
771
- sessionStorage.setItem(this.storage, JSON.stringify(storage));
772
- }
773
- /** */
774
- static GetPageResponse() {
775
- let storage = sessionStorage.getItem(this.storage);
776
- if (storage) {
777
- storage = JSON.parse(storage);
778
- if (storage.hasOwnProperty('pageResponse')) {
779
- return Tools.BreakReference(storage.pageResponse);
780
- }
781
- }
782
- return null;
783
- }
784
- /** */
785
- static ClearPageResponse() {
786
- let storage = sessionStorage.getItem(this.storage);
787
- storage = JSON.parse(storage);
788
- if (storage.hasOwnProperty('pageResponse')) {
789
- delete storage.pageResponse;
790
- }
791
- storage = Object.assign({}, storage);
792
- sessionStorage.setItem(this.storage, JSON.stringify(storage));
793
- }
794
- /** Clear Source */
795
- static Reset() {
796
- sessionStorage.removeItem(this.storage);
797
- }
798
- }
799
-
800
- const reference_signal = signal({});
801
- const Tools = {
802
- /** Generate a Guid */
803
- GetGuid: (seed = 'coer-system') => {
804
- let time = new Date().getTime();
805
- seed = seed.toString().trim();
806
- return seed + `-xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g, (c) => {
807
- const random = (time + Math.random() * 16) % 16 | 0;
808
- time = Math.floor(time / 16);
809
- return (c == 'x' ? random : (random & 0x3 | 0x8)).toString(16);
810
- });
811
- },
812
- /** Returns true if the value is null or undefined, false otherwise */
813
- IsNull: (value) => {
814
- if (value === undefined)
815
- return true;
816
- if (value === null)
817
- return true;
818
- return false;
819
- },
820
- /** Returns true if the value is not null or undefined, false otherwise */
821
- IsNotNull: (value) => {
822
- if (value === undefined)
823
- return false;
824
- if (value === null)
825
- return false;
826
- return true;
827
- },
828
- /** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
829
- IsOnlyWhiteSpace: (value) => {
830
- if (value === undefined)
831
- return true;
832
- if (value === null)
833
- return true;
834
- if (value.toString().trim() === '')
835
- return true;
836
- return false;
837
- },
838
- /** Break reference of a object or array */
839
- BreakReference: (object) => {
840
- if (object === undefined)
841
- return undefined;
842
- if (object === null)
843
- return null;
844
- const OBJECT = JSON.parse(JSON.stringify(object));
845
- return (Array.isArray(OBJECT)) ? [...OBJECT] : { ...OBJECT };
846
- },
847
- /** Clean extra whitespaces */
848
- CleanUpBlanks: (text) => {
849
- if (Tools.IsNull(text))
850
- return '';
851
- let worlds = String(text).split(' ');
852
- worlds = worlds.filter(x => x.length > 0);
853
- return worlds.join(' ');
854
- },
855
- /** Get properties of an object */
856
- GetObjectProperties: (obj) => {
857
- const properties = [];
858
- if (Tools.IsNull(obj))
859
- return properties;
860
- for (const property in obj)
861
- properties.push(String(property));
862
- return properties;
863
- },
864
- /**
865
- * Set an index and merge more arrays of the same type
866
- * @returns A new array
867
- * */
868
- SetIndex: (array, ...args) => {
869
- let index = 0;
870
- for (const arg of args) {
871
- array = Tools.BreakReference(array).concat(Tools.BreakReference(arg));
872
- }
873
- return Tools.BreakReference(array).map(item => Object.assign({ index: index++ }, item));
874
- },
875
- /** Set First Char To Lower */
876
- FirstCharToLower: (text) => {
877
- if (Tools.IsNull(text))
878
- return '';
879
- const textArray = [];
880
- for (let i = 0; i < text.length; i++) {
881
- if (i === 0)
882
- textArray.push(text[i].toLowerCase());
883
- else
884
- textArray.push(text[i]);
885
- }
886
- return textArray.join('');
887
- },
888
- /** Set First Char To Upper */
889
- FirstCharToUpper: (text) => {
890
- if (Tools.IsNull(text))
891
- return '';
892
- const textArray = [];
893
- for (let i = 0; i < text.length; i++) {
894
- if (i === 0)
895
- textArray.push(text[i].toUpperCase());
896
- else
897
- textArray.push(text[i]);
898
- }
899
- return textArray.join('');
900
- },
901
- /** Sort an array in ascending order by property */
902
- SortBy: (array, property, propertyType = 'string') => {
903
- switch (propertyType) {
904
- case 'string': {
905
- return array.sort((x, y) => {
906
- if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim())
907
- return -1;
908
- else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim())
909
- return 1;
910
- else
911
- return 0;
912
- });
913
- }
914
- case 'number': {
915
- return array.sort((x, y) => Number(x[property] - Number(y[property])));
916
- }
917
- }
918
- },
919
- /** Sort an array in descending order by property */
920
- SortByDesc: (array, property, propertyType = 'string') => {
921
- switch (propertyType) {
922
- case 'string': {
923
- return array.sort((x, y) => {
924
- if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim())
925
- return 1;
926
- else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim())
927
- return -1;
928
- else
929
- return 0;
930
- });
931
- }
932
- case 'number': {
933
- return array.sort((x, y) => Number(Number(y[property])) - x[property]);
934
- }
935
- }
936
- },
937
- /** Return a string with forman numeric */
938
- GetNumericFormat: (value, decimals = 0) => {
939
- if (value == undefined
940
- || value == null
941
- || value.toString().trim() == ''
942
- || isNaN(Number(value))) {
943
- return '0';
944
- }
945
- let valueInteger = '';
946
- let valueDecimal = '';
947
- value = value.toString().replaceAll(' ', '');
948
- if (value.includes('.') || (decimals > 0)) {
949
- valueInteger = value.includes('.') ? value.split('.')[0] : value;
950
- if (decimals > 0) {
951
- const PADDING = decimals - valueDecimal.length;
952
- valueDecimal = value.includes('.') ? value.split('.')[1] : '';
953
- for (let i = 0; i < PADDING; i++)
954
- valueDecimal += '0';
955
- valueDecimal = valueDecimal.substring(0, decimals);
956
- valueDecimal = `.${valueDecimal}`;
957
- }
958
- }
959
- else {
960
- valueInteger = value;
961
- }
962
- let counter = 0;
963
- const VALUE_INTEGER_ARRAY = [];
964
- for (const char of valueInteger.split('').reverse()) {
965
- if (counter == 3) {
966
- VALUE_INTEGER_ARRAY.push(',');
967
- counter = 0;
968
- }
969
- VALUE_INTEGER_ARRAY.push(char);
970
- ++counter;
971
- }
972
- valueInteger = VALUE_INTEGER_ARRAY.reverse().join('');
973
- return `${valueInteger}${valueDecimal}`;
974
- },
975
- /** Wait the time indicated */
976
- Sleep: (milliseconds = 0, reference = null) => {
977
- if (Tools.IsNull(reference)) {
978
- return new Promise(Resolve => setTimeout(Resolve, milliseconds));
979
- }
980
- else
981
- return new Promise(Resolve => {
982
- reference = reference.replaceAll(' ', '_').toLowerCase();
983
- if (reference_signal().hasOwnProperty(reference)) {
984
- clearInterval(reference_signal()[reference]);
985
- }
986
- reference_signal.set(Object.assign(reference_signal(), {
987
- [reference]: setTimeout(() => {
988
- Resolve();
989
- clearInterval(reference_signal()[reference]);
990
- const _reference = { ...reference_signal() };
991
- delete _reference[reference];
992
- reference_signal.set({ ..._reference });
993
- }, milliseconds)
994
- }));
995
- });
996
- }
997
- };
998
-
999
- const breakpointSIG = signal(Screen?.BREAKPOINT || 'xs');
1000
-
1001
- const isLoadingSIG = signal(false);
1002
-
1003
- const isModalOpenSIG = signal(false);
1004
-
1005
1
  /**
1006
2
  * Generated bundle index. Do not edit.
1007
3
  */
1008
-
1009
- export { Breadcrumbs, CONTROL_VALUE, CoerAlert, ComponentsModule, ControlValue, DateTime, Files, Page, Screen, Source, Tools, breakpointSIG, isLoadingSIG, isModalOpenSIG };
1010
4
  //# sourceMappingURL=coer-elements.mjs.map