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.
- package/README.md +63 -1
- package/components/index.d.ts +5 -0
- package/components/lib/coer-accordion/coer-accordion.component.d.ts +32 -0
- package/components/lib/coer-button/coer-button.component.d.ts +46 -0
- package/components/lib/coer-checkbox/coer-checkbox.component.d.ts +29 -0
- package/components/lib/coer-datebox/coer-datebox.component.d.ts +58 -0
- package/components/lib/coer-dropdown/coer-dropdown.component.d.ts +69 -0
- package/components/lib/coer-filebox/coer-filebox.component.d.ts +36 -0
- package/components/lib/coer-form/coer-form.component.d.ts +36 -0
- package/components/lib/coer-grid/coer-grid.component.d.ts +53 -0
- package/components/lib/coer-grid/coer-grid.extension.d.ts +111 -0
- package/components/lib/coer-list/coer-list.component.d.ts +57 -0
- package/components/lib/coer-modal/coer-modal.component.d.ts +38 -0
- package/components/lib/coer-numberbox/coer-numberbox.component.d.ts +56 -0
- package/components/lib/coer-page-title/coer-page-title.component.d.ts +14 -0
- package/components/lib/coer-selectbox/coer-selectbox.component.d.ts +79 -0
- package/components/lib/coer-sidenav/coer-menu-option/coer-menu-option.component.d.ts +22 -0
- package/components/lib/coer-sidenav/coer-sidenav.component.d.ts +49 -0
- package/components/lib/coer-sidenav/coer-toolbar/coer-toolbar.component.d.ts +32 -0
- package/components/lib/coer-sidenav/coer-tree-accordion/coer-tree-accordion.component.d.ts +43 -0
- package/components/lib/coer-switch/coer-switch.component.d.ts +32 -0
- package/components/lib/coer-tab/coer-tab.component.d.ts +36 -0
- package/components/lib/coer-textarea/coer-textarea.component.d.ts +52 -0
- package/components/lib/coer-textbox/coer-textbox.component.d.ts +66 -0
- package/components/lib/components.module.d.ts +46 -0
- package/components/public-api.d.ts +21 -0
- package/directives/index.d.ts +5 -0
- package/directives/lib/coer-ref.directive.d.ts +14 -0
- package/directives/lib/directives.module.d.ts +8 -0
- package/directives/lib/life-cycle.directive.d.ts +16 -0
- package/directives/public-api.d.ts +3 -0
- package/extensions/index.d.ts +5 -0
- package/extensions/lib/object.extension.d.ts +1 -0
- package/extensions/lib/string.extension.d.ts +19 -0
- package/extensions/public-api.d.ts +2 -0
- package/fesm2022/coer-elements-components.mjs +4040 -0
- package/fesm2022/coer-elements-components.mjs.map +1 -0
- package/fesm2022/coer-elements-directives.mjs +84 -0
- package/fesm2022/coer-elements-directives.mjs.map +1 -0
- package/fesm2022/coer-elements-extensions.mjs +68 -0
- package/fesm2022/coer-elements-extensions.mjs.map +1 -0
- package/fesm2022/coer-elements-guards.mjs +28 -0
- package/fesm2022/coer-elements-guards.mjs.map +1 -0
- package/fesm2022/coer-elements-interceptors.mjs +64 -0
- package/fesm2022/coer-elements-interceptors.mjs.map +1 -0
- package/fesm2022/coer-elements-interfaces.mjs +6 -0
- package/fesm2022/coer-elements-interfaces.mjs.map +1 -0
- package/fesm2022/coer-elements-pages.mjs +441 -0
- package/fesm2022/coer-elements-pages.mjs.map +1 -0
- package/fesm2022/coer-elements-pipes.mjs +87 -0
- package/fesm2022/coer-elements-pipes.mjs.map +1 -0
- package/fesm2022/coer-elements-signals.mjs +35 -0
- package/fesm2022/coer-elements-signals.mjs.map +1 -0
- package/fesm2022/coer-elements-tools.mjs +1960 -0
- package/fesm2022/coer-elements-tools.mjs.map +1 -0
- package/fesm2022/coer-elements.mjs +68 -0
- package/fesm2022/coer-elements.mjs.map +1 -0
- package/guards/index.d.ts +5 -0
- package/guards/lib/login.guard.d.ts +2 -0
- package/guards/lib/page.guard.d.ts +2 -0
- package/guards/public-api.d.ts +2 -0
- package/images/loading.gif +0 -0
- package/images/no-image.png +0 -0
- package/images/no-user.png +0 -0
- package/index.d.ts +12 -0
- package/interceptors/index.d.ts +5 -0
- package/interceptors/lib/user.interceptor.d.ts +8 -0
- package/interceptors/lib/utc-offset.interceptor.d.ts +8 -0
- package/interceptors/public-api.d.ts +1 -0
- package/interfaces/index.d.ts +5 -0
- package/interfaces/lib/app-source.interface.d.ts +4 -0
- package/interfaces/lib/box-button.interface.d.ts +6 -0
- package/interfaces/lib/bulk-load.interface.d.ts +5 -0
- package/interfaces/lib/coer-filebox/file-image.interface.d.ts +14 -0
- package/interfaces/lib/coer-filebox/file.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-button-by-row.interface.d.ts +6 -0
- package/interfaces/lib/coer-grid/grid-checkbox.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-coer-numberbox.interface.d.ts +12 -0
- package/interfaces/lib/coer-grid/grid-coer-selectbox.interface.d.ts +9 -0
- package/interfaces/lib/coer-grid/grid-coer-switch.interface.d.ts +6 -0
- package/interfaces/lib/coer-grid/grid-coer-textbox.interface.d.ts +11 -0
- package/interfaces/lib/coer-grid/grid-column.interface.d.ts +24 -0
- package/interfaces/lib/coer-grid/grid-data-source.interface.d.ts +6 -0
- package/interfaces/lib/coer-grid/grid-header-button.interface.d.ts +8 -0
- package/interfaces/lib/coer-grid/grid-header-export-button.interface.d.ts +10 -0
- package/interfaces/lib/coer-grid/grid-header.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-import.interface.d.ts +4 -0
- package/interfaces/lib/coer-grid/grid-input-checkbox.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-input-switch-change.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-input-textbox.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-item.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-keyup-enter.interface.d.ts +6 -0
- package/interfaces/lib/coer-grid/grid-length.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-search.interface.d.ts +5 -0
- package/interfaces/lib/coer-grid/grid-sort.interface.d.ts +5 -0
- package/interfaces/lib/coer-menu/menu-access.interface.d.ts +7 -0
- package/interfaces/lib/coer-menu/menu-option-selected.interface.d.ts +9 -0
- package/interfaces/lib/coer-menu/menu-selected.interface.d.ts +10 -0
- package/interfaces/lib/coer-menu/menu.interface.d.ts +10 -0
- package/interfaces/lib/coer-ref.interface.d.ts +10 -0
- package/interfaces/lib/image.interface.d.ts +11 -0
- package/interfaces/lib/login-response.interface.d.ts +10 -0
- package/interfaces/lib/login.interface.d.ts +4 -0
- package/interfaces/lib/page-title/breadcrumb.interface.d.ts +6 -0
- package/interfaces/lib/page-title/go-back.interface.d.ts +6 -0
- package/interfaces/lib/page-title/information.interface.d.ts +4 -0
- package/interfaces/lib/screen-size.interface.d.ts +5 -0
- package/interfaces/lib/service/http-request.interface.d.ts +12 -0
- package/interfaces/lib/service/http-response.interface.d.ts +6 -0
- package/interfaces/lib/service/patch.interface.d.ts +5 -0
- package/interfaces/lib/toolbar-menu.interface.d.ts +5 -0
- package/interfaces/public-api.d.ts +41 -0
- package/package.json +67 -38
- package/pages/index.d.ts +5 -0
- package/pages/lib/coer-loading/loading.component.d.ts +5 -0
- package/pages/lib/coer-menu/coer-menu.component.d.ts +12 -0
- package/pages/lib/coer-system/coer-system.component.d.ts +64 -0
- package/pages/lib/coer-system/login/login.component.d.ts +31 -0
- package/pages/lib/home/home.component.d.ts +7 -0
- package/pages/lib/pages.module.d.ts +18 -0
- package/pages/public-api.d.ts +5 -0
- package/pipes/index.d.ts +5 -0
- package/pipes/lib/html.pipe.d.ts +10 -0
- package/pipes/lib/no-image.pipe.d.ts +7 -0
- package/pipes/lib/numeric-format.pipe.d.ts +7 -0
- package/pipes/lib/pipes.module.d.ts +9 -0
- package/pipes/public-api.d.ts +4 -0
- package/signals/index.d.ts +5 -0
- package/signals/lib/breakpoint.signal.d.ts +1 -0
- package/signals/lib/is-loading.signal.d.ts +1 -0
- package/signals/lib/is-menu-open.signal.d.ts +1 -0
- package/signals/lib/is-modal-open.signal.d.ts +1 -0
- package/signals/lib/menu-selected.signal.d.ts +2 -0
- package/signals/lib/navigation.signal.d.ts +2 -0
- package/signals/public-api.d.ts +6 -0
- package/styles/angular-material.scss +20 -0
- package/styles/animations.scss +11 -0
- package/styles/bootstrap.scss +1 -14
- package/styles/coer-elements.css +2054 -0
- package/styles/colors.scss +90 -49
- package/styles/containers.scss +44 -0
- package/styles/cursores.scss +19 -0
- package/styles/index.scss +58 -0
- package/styles/layout.scss +49 -0
- package/styles/position.scss +7 -0
- package/styles/scroll-bar.scss +20 -0
- package/tools/index.d.ts +5 -0
- package/tools/lib/breadcrumbs.class.d.ts +18 -0
- package/tools/lib/coer-alert/coer-alert.component.d.ts +23 -0
- package/tools/lib/coer-grid.templates.d.ts +11 -0
- package/tools/lib/colors.class.d.ts +21 -0
- package/tools/lib/control-value.class.d.ts +25 -0
- package/tools/lib/date-time.class.d.ts +21 -0
- package/tools/lib/elements-html.class.d.ts +8 -0
- package/tools/lib/files.class.d.ts +16 -0
- package/tools/lib/filters.class.d.ts +11 -0
- package/tools/lib/menu.class.d.ts +9 -0
- package/tools/lib/page.class.d.ts +83 -0
- package/tools/lib/screen.class.d.ts +13 -0
- package/tools/lib/section.class.d.ts +33 -0
- package/tools/lib/service.class.d.ts +42 -0
- package/tools/lib/source.class.d.ts +20 -0
- package/tools/lib/tools.d.ts +42 -0
- package/tools/lib/user.class.d.ts +11 -0
- package/tools/public-api.d.ts +17 -0
- package/Signals/index.ts +0 -7
- package/Tools/Breadcrumbs.class.ts +0 -84
- package/Tools/ControlValue.ts +0 -63
- package/Tools/DateTime.class.ts +0 -27
- package/Tools/Files.class.ts +0 -119
- package/Tools/Page.class.ts +0 -197
- package/Tools/Screen.class.ts +0 -50
- package/Tools/Source.class.ts +0 -107
- package/Tools/Tools.ts +0 -212
- package/components/coer-alert/coer-alert.component.html +0 -56
- package/components/coer-alert/coer-alert.component.scss +0 -100
- package/components/coer-alert/coer-alert.component.ts +0 -249
- package/components/index.ts +0 -96
- package/dist_browser/Tools/Breadcrumbs.class.js +0 -66
- package/dist_browser/Tools/ControlValue.js +0 -49
- package/dist_browser/Tools/DateTime.class.js +0 -25
- package/dist_browser/Tools/Files.class.js +0 -99
- package/dist_browser/Tools/Page.class.js +0 -213
- package/dist_browser/Tools/Screen.class.js +0 -68
- package/dist_browser/Tools/Source.class.js +0 -83
- package/dist_browser/Tools/Tools.js +0 -227
- package/dist_browser/components/coer-alert/coer-alert.component.js +0 -314
- package/dist_browser/index.js +0 -8
- package/dist_node/Tools/Breadcrumbs.class.js +0 -69
- package/dist_node/Tools/ControlValue.js +0 -53
- package/dist_node/Tools/DateTime.class.js +0 -28
- package/dist_node/Tools/Files.class.js +0 -102
- package/dist_node/Tools/Page.class.js +0 -216
- package/dist_node/Tools/Screen.class.js +0 -71
- package/dist_node/Tools/Source.class.js +0 -86
- package/dist_node/Tools/Tools.js +0 -230
- package/dist_node/components/coer-alert/coer-alert.component.js +0 -317
- package/dist_node/index.js +0 -24
- package/dist_node/interfaces/index.js +0 -2
- package/index.ts +0 -8
- package/interfaces/index.ts +0 -47
- package/styles/coer.scss +0 -95
- package/tsconfig.json +0 -29
package/Tools/Page.class.ts
DELETED
@@ -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
|
-
}
|
package/Tools/Screen.class.ts
DELETED
@@ -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
|
-
}
|
package/Tools/Source.class.ts
DELETED
@@ -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>
|