coer-elements 0.0.7 → 0.0.9

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 (44) hide show
  1. package/components/index.d.ts +2 -0
  2. package/components/lib/coer-alert/coer-alert.component.d.ts +23 -0
  3. package/components/lib/components.module.d.ts +10 -0
  4. package/esm2022/coer-elements.mjs +2 -2
  5. package/esm2022/components/index.mjs +3 -0
  6. package/esm2022/components/lib/coer-alert/coer-alert.component.mjs +227 -0
  7. package/esm2022/components/lib/components.module.mjs +92 -0
  8. package/esm2022/public_api.mjs +2 -0
  9. package/fesm2022/coer-elements.mjs +309 -0
  10. package/fesm2022/coer-elements.mjs.map +1 -1
  11. package/index.d.ts +5 -1
  12. package/package.json +1 -1
  13. package/public_api.d.ts +1 -0
  14. package/src/styles/bootstrap.scss +15 -0
  15. package/src/styles/coer-elements.scss +29 -0
  16. package/{styles → src/styles}/colors.scss +27 -1
  17. package/src/styles/containers.scss +34 -0
  18. package/src/styles/cursores.scss +11 -0
  19. package/src/styles/layout.scss +21 -0
  20. package/src/styles/scroll-bar.scss +20 -0
  21. package/styles/{index.css → coer-elements.css} +268 -26
  22. package/components/index.ts +0 -2
  23. package/components/src/coer-alert/coer-alert.component.html +0 -56
  24. package/components/src/coer-alert/coer-alert.component.scss +0 -100
  25. package/components/src/coer-alert/coer-alert.component.ts +0 -249
  26. package/components/src/components.module.ts +0 -97
  27. package/esm2022/index.mjs +0 -2
  28. package/interfaces/index.ts +0 -6
  29. package/interfaces/src/IAppSource.interface.ts +0 -4
  30. package/interfaces/src/IBreadcrumb.interface.ts +0 -6
  31. package/interfaces/src/ICoerRef.interface.ts +0 -11
  32. package/interfaces/src/IGoBack.interface.ts +0 -6
  33. package/interfaces/src/IPatch.interface.ts +0 -5
  34. package/interfaces/src/IScreenSize.interface.ts +0 -5
  35. package/styles/index.scss +0 -98
  36. package/tools/index.ts +0 -8
  37. package/tools/src/Breadcrumbs.class.ts +0 -84
  38. package/tools/src/ControlValue.ts +0 -63
  39. package/tools/src/DateTime.class.ts +0 -27
  40. package/tools/src/Files.class.ts +0 -119
  41. package/tools/src/Page.class.ts +0 -197
  42. package/tools/src/Screen.class.ts +0 -50
  43. package/tools/src/Source.class.ts +0 -107
  44. package/tools/src/Tools.ts +0 -217
@@ -1,249 +0,0 @@
1
- import { Component } from '@angular/core';
2
- import * as bootstrap from 'bootstrap';
3
- import Swal from 'sweetalert2'
4
-
5
- @Component({
6
- selector: 'coer-alert',
7
- templateUrl: './coer-alert.component.html',
8
- styleUrls: ['./coer-alert.component.scss']
9
- })
10
- export class CoerAlert {
11
-
12
- /** */
13
- public Success(message: string | null = null, title: string | null = null, icon: string | null = null, autohide: number | null = 3000): void {
14
- //Title
15
- if (!title || title == '') title = 'Success';
16
- const alertSuccessTitle = document.getElementById('alert-success-title')!;
17
- alertSuccessTitle.textContent = title;
18
-
19
- //Icon
20
- icon = this.GetIcon(title, icon, 'bi-check-circle fa-beat');
21
- const alertSuccessIcon = document.getElementById('alert-success-icon')!;
22
- this.SetIcon(alertSuccessIcon, icon);
23
-
24
- //Message
25
- if (!message) message = '';
26
- const alertSuccessMessage = document.getElementById('alert-success-message')!;
27
- alertSuccessMessage.innerHTML = message;
28
-
29
- //Toast
30
- const alertSuccess = document.getElementById('alert-success')!;
31
- this.SetAutoHide(alertSuccess, autohide);
32
-
33
- const toast = bootstrap.Toast.getOrCreateInstance(alertSuccess);
34
- toast.show();
35
- }
36
-
37
-
38
- /** */
39
- public Error(message: string | null = null, title: string | null = null, icon: string | null = null, autohide: number | null = 3000): void {
40
- //Title
41
- if (!title || title == '') title = 'Error';
42
- const alertErrorTitle = document.getElementById('alert-error-title')!;
43
- alertErrorTitle.textContent = title;
44
-
45
- //Icon
46
- icon = this.GetIcon(title, icon, 'bi-exclamation-octagon fa-beat');
47
- const alertErrorIcon = document.getElementById('alert-error-icon')!;
48
- this.SetIcon(alertErrorIcon, icon);
49
-
50
- //Message
51
- if (!message) message = '';
52
- const alertErrorBody = document.getElementById('alert-error-message')!;
53
- alertErrorBody.innerHTML = message;
54
-
55
- //Toast
56
- const alertError = document.getElementById('alert-error')!;
57
- this.SetAutoHide(alertError, autohide);
58
-
59
- const toast = bootstrap.Toast.getOrCreateInstance(alertError);
60
- toast.show();
61
- }
62
-
63
-
64
- /** */
65
- public Info(message: string | null = null, title: string | null = null, icon: string | null = null, autohide: number | null = 3000): void {
66
- //Title
67
- if (!title || title == '') title = 'Info';
68
- const alertInfoTitle = document.getElementById('alert-info-title')!;
69
- alertInfoTitle.textContent = title;
70
-
71
- //Icon
72
- icon = this.GetIcon(title, icon, 'bi-info-circle fa-beat');
73
- const alertInfoIcon = document.getElementById('alert-info-icon')!;
74
- this.SetIcon(alertInfoIcon, icon);
75
-
76
- //Message
77
- if (!message) message = '';
78
- const alertInfoBody = document.getElementById('alert-info-message')!;
79
- alertInfoBody.innerHTML = message;
80
-
81
- //Toast
82
- const alertInfo = document.getElementById('alert-info')!;
83
- this.SetAutoHide(alertInfo, autohide);
84
-
85
- const toast = bootstrap.Toast.getOrCreateInstance(alertInfo);
86
- toast.show();
87
- }
88
-
89
-
90
- /** */
91
- public Warning(message: string | null = null, title: string | null = null, icon: string | null = null, autohide: number | null = 3000): void {
92
- //Title
93
- if (!title || title == '') title = 'Warning';
94
- const alertWarningTitle = document.getElementById('alert-warning-title')!;
95
- alertWarningTitle.textContent = title;
96
-
97
- //Icon
98
- icon = this.GetIcon(title, icon, 'bi-exclamation-triangle-fill fa-beat');
99
- const alertWarningIcon = document.getElementById('alert-warning-icon')!;
100
- this.SetIcon(alertWarningIcon, icon);
101
-
102
- //Message
103
- if (!message) message = '';
104
- const alertWarningBody = document.getElementById('alert-warning-message')!;
105
- alertWarningBody.innerHTML = message;
106
-
107
- //Toast
108
- const alertWarning = document.getElementById('alert-warning')!;
109
- this.SetAutoHide(alertWarning, autohide);
110
-
111
- const toast = bootstrap.Toast.getOrCreateInstance(alertWarning);
112
- toast.show();
113
- }
114
-
115
-
116
- /** */
117
- protected Close(alert: 'alert-success' | 'alert-error' | 'alert-info' | 'alert-warning') {
118
- return new Promise<void>(Resolve => {
119
- const element = document.getElementById(alert)!;
120
- const toast = bootstrap.Toast.getOrCreateInstance(element);
121
- toast.hide();
122
-
123
- setTimeout(() => { Resolve() }, 200);
124
- })
125
- }
126
-
127
-
128
- /** */
129
- public Confirm(
130
- message: string = 'Proceed?',
131
- alertType: 'warning' | 'danger' | 'success' | 'info' = 'warning',
132
- icon: string | null = null) {
133
- return new Promise<boolean>(Resolve => {
134
- let color: string;
135
- let iconType: 'warning' | 'error' | 'success' | 'info';
136
- switch(alertType) {
137
- case 'danger': {
138
- if (icon == null) icon = 'bi-exclamation-octagon';
139
- iconType = 'error';
140
- color = '#dc3545'; //red
141
- break;
142
- };
143
-
144
- case 'success': {
145
- if (icon == null) icon = 'bi-check-circle';
146
- iconType = 'info';
147
- color = '#198754'; //green
148
- break;
149
- };
150
-
151
- case 'info': {
152
- if (icon == null) icon = 'bi-info-circle';
153
- iconType = 'error';
154
- color = '#0d6efd'; //blue
155
- break
156
- };
157
-
158
- default: {
159
- if (icon == null) icon = 'bi-exclamation-triangle-fill';
160
- iconType = 'warning';
161
- color = '#ffc107'; //yellow
162
- break;
163
- }
164
- }
165
-
166
- switch(icon) {
167
- case 'delete': icon = 'fa-regular fa-trash-can'; break;
168
- }
169
-
170
- Swal.fire({
171
- icon: iconType,
172
- iconColor: 'transparent',
173
- iconHtml: `<i class="${icon}" style="color: ${color};"></i>`,
174
- html: message,
175
- showConfirmButton: true,
176
- confirmButtonText: 'Yes',
177
- confirmButtonColor: color,
178
- focusConfirm: true,
179
- showDenyButton: true,
180
- denyButtonColor: color,
181
- focusDeny: false,
182
- reverseButtons: true,
183
- allowOutsideClick: false,
184
- allowEscapeKey: false,
185
- allowEnterKey: true,
186
- customClass: {
187
- denyButton: 'sweet-alert-button',
188
- confirmButton: 'sweet-alert-button'
189
- }
190
- }).then(({ value }) => setTimeout(() => Resolve(value)));
191
- });
192
- }
193
-
194
-
195
- /** */
196
- private SetIcon(element: HTMLElement, icon: string): void {
197
- for (const item of [...element.classList.value.split(' ')]) {
198
- if (item.length > 0) {
199
- element.classList.remove(item);
200
- element.classList.remove('q');
201
- }
202
- }
203
-
204
- icon = icon.trim();
205
- const hasWhiteSpaces: RegExp = / /;
206
- if (hasWhiteSpaces.test(icon)) {
207
- const classes = icon.split(' ');
208
- for (const icon of classes) element.classList.add(icon);
209
- }
210
-
211
- else element.classList.add(icon);
212
- }
213
-
214
-
215
- /** */
216
- private SetAutoHide(element: HTMLElement, autohide: number | null): void {
217
- element.removeAttribute('data-bs-autohide');
218
- element.removeAttribute('data-bs-delay');
219
-
220
- if (autohide && autohide > 0) {
221
- if (autohide < 1000) autohide = 1000;
222
- element.setAttribute('data-bs-autohide', 'true');
223
- element.setAttribute('data-bs-delay', String(autohide));
224
- }
225
-
226
- else element.setAttribute('data-bs-autohide', 'false');
227
- }
228
-
229
-
230
- /** */
231
- private GetIcon(title: string, icon: string | null, iconDefault: string): string {
232
- if (icon == null || icon == '') {
233
- title = title.replaceAll(' ', '').toUpperCase();
234
-
235
- switch(title) {
236
- case 'ENABLED': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
237
- case 'ACTIVE': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
238
- case 'ACTIVED': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
239
- case 'DISABLE': return 'fa-solid fa-thumbs-down fa-flip-horizontal';
240
- case 'DISABLED': return 'fa-solid fa-thumbs-down fa-flip-horizontal';
241
- case 'DELETE': return 'fa-regular fa-trash-can';
242
- case 'DELETED': return 'fa-regular fa-trash-can';
243
- default: return iconDefault;
244
- }
245
- }
246
-
247
- return icon;
248
- }
249
- }
@@ -1,97 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { RouterModule } from '@angular/router';
4
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
5
- //import { DirectivesModule } from 'src/app/shared/directives/directives.module';
6
- //import { PipesModule } from 'src/app/shared/pipes/pipes.module';
7
-
8
- //Angular Material
9
- //import { MatButtonModule } from '@angular/material/button';
10
- //import { MatCheckboxModule } from '@angular/material/checkbox';
11
- //import { MatInputModule } from '@angular/material/input';
12
- //import { MatFormFieldModule } from '@angular/material/form-field';
13
- //import { MatSlideToggleModule } from '@angular/material/slide-toggle';
14
- //import { MatTabsModule } from '@angular/material/tabs';
15
-
16
- //Components
17
- import { CoerAlert } from './coer-alert/coer-alert.component';
18
- //import { CoerButton } from './coer-button/coer-button.component';
19
- //import { CoerCheckbox } from './coer-checkbox/coer-checkbox.component';
20
- //import { CoerFilebox } from './coer-filebox/coer-filebox.component';
21
- //import { CoerForm } from './coer-form/coer-form.component';
22
- //import { CoerGrid } from './coer-grid/coer-grid.component';
23
- //import { CoerModal } from './coer-modal/coer-modal.component';
24
- //import { CoerNumberBox } from './coer-numberbox/coer-numberbox.component';
25
- //import { CoerPageTitle } from './coer-page-title/coer-page-title.component';
26
- //import { CoerSelectbox } from './coer-selectbox/coer-selectbox.component';
27
- //import { CoerSwitch } from './coer-switch/coer-switch.component';
28
- //import { CoerTab } from './coer-tab/coer-tab.component';
29
- //import { CoerTextarea } from './coer-textarea/coer-textarea.component';
30
- //import { CoerTextBox } from './coer-textbox/coer-textbox.component';
31
-
32
- @NgModule({
33
- imports: [
34
- CommonModule,
35
- RouterModule,
36
- FormsModule,
37
- ReactiveFormsModule,
38
- //PipesModule,
39
- //MatButtonModule,
40
- //MatCheckboxModule,
41
- //MatInputModule,
42
- //MatFormFieldModule,
43
- //MatSlideToggleModule,
44
- //MatTabsModule,
45
- //DirectivesModule
46
- ],
47
- declarations: [
48
- CoerAlert,
49
- //CoerButton,
50
- //CoerCheckbox,
51
- //CoerFilebox,
52
- //CoerForm,
53
- //CoerGrid,
54
- //CoerModal,
55
- //CoerNumberBox,
56
- //CoerPageTitle,
57
- //CoerSelectbox,
58
- //CoerSwitch,
59
- //CoerTextarea,
60
- //CoerTab,
61
- //CoerTextBox,
62
- ],
63
- exports: [
64
- CoerAlert,
65
- //CoerButton,
66
- //CoerCheckbox,
67
- //CoerFilebox,
68
- //CoerForm,
69
- //CoerGrid,
70
- //CoerModal,
71
- //CoerNumberBox,
72
- //CoerPageTitle,
73
- //CoerSelectbox,
74
- //CoerSwitch,
75
- //CoerTextarea,
76
- //CoerTab,
77
- //CoerTextBox,
78
- ]
79
- })
80
- export class ComponentsModule { }
81
- //export * from './coer-alert/coer-alert.component';
82
- //export * from './coer-button/coer-button.component';
83
- //export * from './coer-checkbox/coer-checkbox.component';
84
- //export * from './coer-filebox/coer-filebox.component';
85
- //export * from './coer-filebox/coer-filebox.interface';
86
- //export * from './coer-form/coer-form.component';
87
- //export * from './coer-grid/coer-grid.component';
88
- //export * from './coer-grid/coer-grid.interface';
89
- //export * from './coer-grid/coer-grid.templates';
90
- //export * from './coer-modal/coer-modal.component';
91
- //export * from './coer-numberbox/coer-numberbox.component';
92
- //export * from './coer-page-title/coer-page-title.component';
93
- //export * from './coer-page-title/pageTitle.interface';
94
- //export * from './coer-selectbox/coer-selectbox.component';
95
- //export * from './coer-switch/coer-switch.component';
96
- //export * from './coer-tab/coer-tab.component';
97
- //export * from './coer-textbox/coer-textbox.component';
package/esm2022/index.mjs DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9jb2VyLWVsZW1lbnRzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQge307Il19
@@ -1,6 +0,0 @@
1
- export * from './src/IAppSource.interface';
2
- export * from './src/IBreadcrumb.interface';
3
- export * from './src/ICoerRef.interface';
4
- export * from './src/IGoBack.interface';
5
- export * from './src/IPatch.interface';
6
- export * from './src/IScreenSize.interface';
@@ -1,4 +0,0 @@
1
- export interface IAppSource {
2
- page: string;
3
- path: string;
4
- }
@@ -1,6 +0,0 @@
1
- export interface IBreadcrumb {
2
- page: string;
3
- path?: string | null;
4
- queryParams?: any;
5
- click?: (() => any);
6
- }
@@ -1,11 +0,0 @@
1
- import { TemplateRef, WritableSignal } from '@angular/core';
2
-
3
- export interface ICoerRef {
4
- coerRef: WritableSignal<string>;
5
- title: WritableSignal<string>;
6
- icon: WritableSignal<string>;
7
- isDisabled: WritableSignal<boolean>;
8
- show: WritableSignal<boolean>;
9
- tooltip: WritableSignal<string>;
10
- template: TemplateRef<any>;
11
- }
@@ -1,6 +0,0 @@
1
- export interface IGoBack {
2
- show: boolean;
3
- path?: string | null;
4
- queryParams?: any;
5
- click?: (() => any);
6
- }
@@ -1,5 +0,0 @@
1
- export interface IPatch {
2
- op: 'remove' | 'add' | 'replace';
3
- path: string;
4
- value: any;
5
- }
@@ -1,5 +0,0 @@
1
- export interface IScreenSize {
2
- width: number;
3
- height: number;
4
- breakpoin: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
5
- }
package/styles/index.scss DELETED
@@ -1,98 +0,0 @@
1
- @import "./colors.scss";
2
-
3
- * {
4
- font-family: sans-serif;
5
- letter-spacing: normal;
6
- }
7
-
8
- .fill-space {
9
- flex: 1 1 auto;
10
- }
11
-
12
- h1, h2, h3, h4, h5, h6, p, pre, hr, figure, fieldset {
13
- margin: 0px;
14
- padding: 0px;
15
- }
16
-
17
- //Containers
18
- @mixin Container() {
19
- margin: 15px 30px 0px 30px;
20
- padding: 10px;
21
- box-shadow: 0px 0px 10px -10px black;
22
- border-radius: 8px;
23
- background-color: white;
24
- animation-name: fadeId;
25
- animation-duration: 1.5s;
26
- animation-iteration-count: 1;
27
- animation-fill-mode: both;
28
- }
29
-
30
- .coer-container {
31
- @include Container();
32
- }
33
-
34
- .coer-container-tab {
35
- @include Container();
36
- padding: 0px;
37
-
38
- .row {
39
- margin: 12px 0px;
40
- }
41
- }
42
-
43
- .coer-container-grid {
44
- @include Container();
45
- padding-bottom: 5px;
46
- }
47
-
48
- @keyframes fadeId {
49
- from { opacity: 0; }
50
- to { opacity: 1; }
51
- }
52
-
53
- //Cursor
54
- .cursor-default {
55
- cursor: default !important;
56
- }
57
-
58
- .cursor-pointer {
59
- cursor: pointer !important;
60
- }
61
-
62
- .cursor-wait {
63
- cursor: wait !important;
64
- }
65
-
66
- //Input
67
- input[type="file"] {
68
- display: none !important;
69
- }
70
-
71
- .readonly {
72
- color: black !important;
73
- background-color: #bbbbbb83 !important;
74
- }
75
-
76
- //Scrollbar
77
- .no-selection::selection {
78
- background-color: transparent !important;
79
- }
80
-
81
- *::-webkit-scrollbar {
82
- background-color: lighten($gray, 48%);
83
- width: 5px;
84
- height: 5px;
85
- }
86
-
87
- *::-webkit-scrollbar-thumb{
88
- background-color: lighten($gray, 35%);
89
- border-radius: 4px;
90
- }
91
-
92
- *::-webkit-scrollbar-thumb:hover {
93
- background-color: $gray;
94
- }
95
-
96
- *::-webkit-scrollbar-thumb:active {
97
- background-color: $gray;
98
- }
package/tools/index.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from './src/Breadcrumbs.class';
2
- export * from './src/ControlValue';
3
- export * from './src/DateTime.class';
4
- export * from './src/Files.class';
5
- export * from './src/Page.class';
6
- export * from './src/Screen.class';
7
- export * from './src/Source.class';
8
- export * from './src/Tools';
@@ -1,84 +0,0 @@
1
- import { IAppSource } from "../../interfaces";
2
- import { Tools } from "./Tools";
3
-
4
- export class Breadcrumbs {
5
-
6
- private static readonly storage = 'COER-System';
7
-
8
- /** */
9
- public static Add(page: string, path: string): void {
10
- const breadcrumbs = this.Get();
11
- const paths = breadcrumbs.map(item => item.path);
12
-
13
- if (!paths.includes(path)) {
14
- breadcrumbs.push({ page, path });
15
- this.Save(breadcrumbs);
16
- }
17
- }
18
-
19
-
20
- /** */
21
- public static Get(): IAppSource[] {
22
- let storage = sessionStorage.getItem(this.storage) as any;
23
-
24
- if (storage) {
25
- storage = JSON.parse(storage);
26
-
27
- if (storage.hasOwnProperty('breadcrumbs')) {
28
- return Tools.BreakReference(storage.breadcrumbs);
29
- }
30
- }
31
-
32
- return [];
33
- }
34
-
35
-
36
- /** Source */
37
- public static GetFirst(): IAppSource | null {
38
- const breadcrumbs = this.Get();
39
- return (breadcrumbs.length > 0) ? breadcrumbs.shift()! : null;
40
- }
41
-
42
-
43
- /** */
44
- public static Save(breadcrumbs: IAppSource[]): void {
45
- let storage = sessionStorage.getItem(this.storage) as any;
46
- if (storage) storage = JSON.parse(storage);
47
- storage = Object.assign({}, storage, { breadcrumbs });
48
- sessionStorage.setItem(this.storage, JSON.stringify(storage));
49
- }
50
-
51
-
52
- /** */
53
- public static Remove(path: string): void {
54
- let breadcrumbs = this.Get();
55
- const index = breadcrumbs.findIndex(x => x.path.toLowerCase().trim() === path.toLowerCase().trim());
56
-
57
- if (index >= 0) {
58
- breadcrumbs = Tools.BreakReference(breadcrumbs).splice(0, index + 1);
59
- this.Save(breadcrumbs);
60
- }
61
- }
62
-
63
-
64
- /** */
65
- public static SetLast(page: string, path: string): void {
66
- const breadcrumbs = this.Get();
67
-
68
- if (breadcrumbs.length > 0) {
69
- breadcrumbs[breadcrumbs.length - 1] = { page, path };
70
- this.Save(breadcrumbs);
71
- }
72
- }
73
-
74
-
75
- /** */
76
- public static RemoveLast(): void {
77
- const breadcrumbs = this.Get();
78
-
79
- if (breadcrumbs.length > 0) {
80
- breadcrumbs.pop();
81
- this.Save(breadcrumbs);
82
- }
83
- }
84
- }
@@ -1,63 +0,0 @@
1
- import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
2
- import { forwardRef } from "@angular/core";
3
-
4
- export const CONTROL_VALUE = <T>(component: T) => {
5
- return {
6
- provide: NG_VALUE_ACCESSOR,
7
- useExisting: forwardRef(() => component),
8
- multi: true
9
- }
10
- }
11
-
12
-
13
- export class ControlValue implements ControlValueAccessor {
14
-
15
- //Variables
16
- protected _value: any;
17
- private _isTouched: boolean = false;
18
- protected _UpdateValue!: Function;
19
- private _IsTouched!: Function;
20
-
21
-
22
- public get isTouched() {
23
- return this._isTouched;
24
- }
25
-
26
-
27
- /** */
28
- protected SetValue(value: any): void {
29
- if(typeof this._UpdateValue === 'function') {
30
- this._UpdateValue(value);
31
- }
32
-
33
- this._value = value;
34
- }
35
-
36
-
37
- /** */
38
- public SetTouched(isTouched: boolean): void {
39
- if(typeof this._IsTouched === 'function') {
40
- this._IsTouched(isTouched);
41
- }
42
-
43
- this._isTouched = isTouched;
44
- }
45
-
46
-
47
- /** */
48
- public writeValue(value: any): void {
49
- this._value = value;
50
- }
51
-
52
-
53
- /** */
54
- public registerOnChange(callback: Function): void {
55
- this._UpdateValue = callback;
56
- }
57
-
58
-
59
- /** */
60
- public registerOnTouched(callback: Function): void {
61
- this._IsTouched = callback;
62
- }
63
- }
@@ -1,27 +0,0 @@
1
- import moment from "moment";
2
-
3
- export class DateTime {
4
- /** Get UTC Offset */
5
- public static GetUTCOffset(): number {
6
- return moment().utcOffset();
7
- }
8
-
9
-
10
- /** Convert UTC Date to Local Zone */
11
- public static ToLocalZone(utcDate: string | Date | moment.Moment): string {
12
- return moment(utcDate).add(DateTime.GetUTCOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
13
- }
14
-
15
-
16
- /** Convert Local Zone Date to UTC */
17
- public static ToUTC(utcDate: string | Date | moment.Moment): string {
18
- return moment(utcDate).subtract(DateTime.GetUTCOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
19
- }
20
-
21
-
22
- /** DD MMM YYYY */
23
- public static GetDateFormat(date: string | Date | moment.Moment): string {
24
- if ((typeof date === 'string')) date = date.replaceAll('/', '-');
25
- return moment(date).parseZone().local(true).format('DD MMM YYYY');
26
- }
27
- }