coer-elements 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. package/components/index.d.ts +2 -2
  2. package/esm2022/coer-elements.mjs +2 -2
  3. package/esm2022/components/index.mjs +3 -3
  4. package/esm2022/components/lib/coer-alert/coer-alert.component.mjs +227 -0
  5. package/esm2022/components/lib/components.module.mjs +92 -0
  6. package/esm2022/public_api.mjs +2 -0
  7. package/fesm2022/coer-elements.mjs +6 -697
  8. package/fesm2022/coer-elements.mjs.map +1 -1
  9. package/index.d.ts +5 -1
  10. package/package.json +1 -1
  11. package/public_api.d.ts +1 -0
  12. package/src/styles/bootstrap.scss +15 -0
  13. package/src/styles/coer-elements.scss +29 -0
  14. package/{styles → src/styles}/colors.scss +27 -1
  15. package/src/styles/containers.scss +34 -0
  16. package/src/styles/cursores.scss +11 -0
  17. package/src/styles/layout.scss +21 -0
  18. package/src/styles/scroll-bar.scss +20 -0
  19. package/styles/{index.css → coer-elements.css} +268 -26
  20. package/components/index.ts +0 -2
  21. package/components/src/coer-alert/coer-alert.component.html +0 -56
  22. package/components/src/coer-alert/coer-alert.component.scss +0 -100
  23. package/components/src/coer-alert/coer-alert.component.ts +0 -249
  24. package/components/src/components.module.ts +0 -97
  25. package/esm2022/components/src/coer-alert/coer-alert.component.mjs +0 -227
  26. package/esm2022/components/src/components.module.mjs +0 -92
  27. package/esm2022/index.mjs +0 -2
  28. package/esm2022/interfaces/index.mjs +0 -7
  29. package/esm2022/interfaces/src/IAppSource.interface.mjs +0 -2
  30. package/esm2022/interfaces/src/IBreadcrumb.interface.mjs +0 -2
  31. package/esm2022/interfaces/src/ICoerRef.interface.mjs +0 -2
  32. package/esm2022/interfaces/src/IGoBack.interface.mjs +0 -2
  33. package/esm2022/interfaces/src/IPatch.interface.mjs +0 -2
  34. package/esm2022/interfaces/src/IScreenSize.interface.mjs +0 -2
  35. package/esm2022/tools/index.mjs +0 -9
  36. package/esm2022/tools/src/Breadcrumbs.class.mjs +0 -63
  37. package/esm2022/tools/src/ControlValue.mjs +0 -44
  38. package/esm2022/tools/src/DateTime.class.mjs +0 -22
  39. package/esm2022/tools/src/Files.class.mjs +0 -93
  40. package/esm2022/tools/src/Page.class.mjs +0 -162
  41. package/esm2022/tools/src/Screen.class.mjs +0 -43
  42. package/esm2022/tools/src/Source.class.mjs +0 -80
  43. package/esm2022/tools/src/Tools.mjs +0 -200
  44. package/interfaces/index.d.ts +0 -6
  45. package/interfaces/index.ts +0 -6
  46. package/interfaces/src/IAppSource.interface.d.ts +0 -4
  47. package/interfaces/src/IAppSource.interface.ts +0 -4
  48. package/interfaces/src/IBreadcrumb.interface.d.ts +0 -6
  49. package/interfaces/src/IBreadcrumb.interface.ts +0 -6
  50. package/interfaces/src/ICoerRef.interface.d.ts +0 -10
  51. package/interfaces/src/ICoerRef.interface.ts +0 -11
  52. package/interfaces/src/IGoBack.interface.d.ts +0 -6
  53. package/interfaces/src/IGoBack.interface.ts +0 -6
  54. package/interfaces/src/IPatch.interface.d.ts +0 -5
  55. package/interfaces/src/IPatch.interface.ts +0 -5
  56. package/interfaces/src/IScreenSize.interface.d.ts +0 -5
  57. package/interfaces/src/IScreenSize.interface.ts +0 -5
  58. package/styles/index.scss +0 -98
  59. package/tools/index.d.ts +0 -8
  60. package/tools/index.ts +0 -8
  61. package/tools/src/Breadcrumbs.class.d.ts +0 -18
  62. package/tools/src/Breadcrumbs.class.ts +0 -84
  63. package/tools/src/ControlValue.d.ts +0 -23
  64. package/tools/src/ControlValue.ts +0 -63
  65. package/tools/src/DateTime.class.d.ts +0 -11
  66. package/tools/src/DateTime.class.ts +0 -27
  67. package/tools/src/Files.class.d.ts +0 -16
  68. package/tools/src/Files.class.ts +0 -119
  69. package/tools/src/Page.class.d.ts +0 -66
  70. package/tools/src/Page.class.ts +0 -197
  71. package/tools/src/Screen.class.d.ts +0 -11
  72. package/tools/src/Screen.class.ts +0 -50
  73. package/tools/src/Source.class.d.ts +0 -20
  74. package/tools/src/Source.class.ts +0 -107
  75. package/tools/src/Tools.d.ts +0 -33
  76. package/tools/src/Tools.ts +0 -217
  77. /package/components/{src → lib}/coer-alert/coer-alert.component.d.ts +0 -0
  78. /package/components/{src → lib}/components.module.d.ts +0 -0
@@ -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,23 +0,0 @@
1
- import { ControlValueAccessor } from "@angular/forms";
2
- export declare const CONTROL_VALUE: <T>(component: T) => {
3
- provide: import("@angular/core").InjectionToken<readonly ControlValueAccessor[]>;
4
- useExisting: import("@angular/core").Type<any>;
5
- multi: boolean;
6
- };
7
- export declare class ControlValue implements ControlValueAccessor {
8
- protected _value: any;
9
- private _isTouched;
10
- protected _UpdateValue: Function;
11
- private _IsTouched;
12
- get isTouched(): boolean;
13
- /** */
14
- protected SetValue(value: any): void;
15
- /** */
16
- SetTouched(isTouched: boolean): void;
17
- /** */
18
- writeValue(value: any): void;
19
- /** */
20
- registerOnChange(callback: Function): void;
21
- /** */
22
- registerOnTouched(callback: Function): void;
23
- }
@@ -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,11 +0,0 @@
1
- import moment from "moment";
2
- export declare class DateTime {
3
- /** Get UTC Offset */
4
- static GetUTCOffset(): number;
5
- /** Convert UTC Date to Local Zone */
6
- static ToLocalZone(utcDate: string | Date | moment.Moment): string;
7
- /** Convert Local Zone Date to UTC */
8
- static ToUTC(utcDate: string | Date | moment.Moment): string;
9
- /** DD MMM YYYY */
10
- static GetDateFormat(date: string | Date | moment.Moment): string;
11
- }
@@ -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
- }
@@ -1,16 +0,0 @@
1
- export declare class Files {
2
- static readonly EXCEL_EXTENSIONS: string[];
3
- /** Get Extension File */
4
- static GetExtension(file: File): string | null;
5
- /** Is Excel File */
6
- static IsExcel(file: File): boolean;
7
- /** Read excel file */
8
- static ReadExcel<T>(file: File): Promise<{
9
- columns: string[];
10
- rows: T[];
11
- }>;
12
- /** Export to excel file */
13
- static ExportExcel<T>(data: T[], fileName?: string, sheetName?: string): void;
14
- /** Convert file to string base64 */
15
- static ConvertToBase64(file: File): Promise<string>;
16
- }
@@ -1,119 +0,0 @@
1
- import * as XLSX from 'xlsx';
2
- import { Tools } from './Tools';
3
-
4
- export class Files {
5
- public static readonly EXCEL_EXTENSIONS: string[] = ['xls', 'xlsx', 'csv'];
6
-
7
- /** Get Extension File */
8
- public static GetExtension(file: File): string | null {
9
- const fileName = file.name;
10
-
11
- if (fileName.includes('.')) {
12
- let worlds = fileName.split('.') as string[];
13
-
14
- if (worlds.length > 0) {
15
- let extension = worlds.pop()!;
16
- extension = extension.trim().toLowerCase();
17
- if (extension.length > 0) return extension;
18
- }
19
- }
20
-
21
- return null;
22
- }
23
-
24
-
25
- /** Is Excel File */
26
- public static IsExcel(file: File): boolean {
27
- const EXTENSION = Files.GetExtension(file);
28
-
29
- return Tools.IsNotNull(EXTENSION)
30
- ? this.EXCEL_EXTENSIONS.includes(EXTENSION!)
31
- : false;
32
- }
33
-
34
-
35
- /** Read excel file */
36
- public static ReadExcel<T>(file: File) {
37
- return new Promise<{ columns: string[]; rows: T[]; }>(Resolve => {
38
- let columns: string[] = [];
39
- let rows: T[] = [];
40
-
41
- const reader = new FileReader();
42
- reader.readAsArrayBuffer(file);
43
-
44
- reader.onload = () => {
45
- const dataBytes = new Uint8Array(reader.result as any);
46
-
47
- if (dataBytes) {
48
- const workbook = XLSX.read(dataBytes, {});
49
- const sheet = workbook.Sheets[workbook.SheetNames[0]];
50
- let dataSheet: any[] = XLSX.utils.sheet_to_json(sheet, {
51
- 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']
52
- });
53
-
54
- //Get Headers
55
- for(const column in dataSheet[0]) {
56
- columns.push(Tools.FirstCharToLower(String(dataSheet[0][column]).replaceAll(' ', '')));
57
- }
58
-
59
- //Get Rows
60
- rows = XLSX.utils.sheet_to_json(sheet, { header: columns });
61
- rows.shift();
62
-
63
- rows = rows.map(row => {
64
- const item = Tools.BreakReference<any>(row);
65
- delete item['__rowNum__'];
66
- return item;
67
- });
68
- }
69
-
70
- Resolve({ columns, rows });
71
- }
72
-
73
- reader.onerror = () => { Resolve({ columns, rows }) }
74
- });
75
- }
76
-
77
-
78
- /** Export to excel file */
79
- public static ExportExcel<T>(data: T[], fileName: string = 'coer_report', sheetName: string = 'Sheet1') {
80
- sheetName = Tools.CleanUpBlanks(sheetName);
81
- fileName = Tools.CleanUpBlanks(fileName);
82
-
83
- if(fileName.endsWith('.xls') || fileName.endsWith('.xlsx') || fileName.endsWith('.csv')) {
84
- if (fileName.includes('.xls')) {
85
- fileName = fileName.replaceAll('.xls', '.xlsx');
86
- }
87
-
88
- if (fileName.includes('.csv')) {
89
- fileName = fileName.replaceAll('.csv', '.xlsx');
90
- }
91
- }
92
-
93
- else {
94
- fileName += '.xlsx';
95
- }
96
-
97
- const WORK_SHEET = XLSX.utils.json_to_sheet(data);
98
- const WORK_BOOK = XLSX.utils.book_new();
99
- XLSX.utils.book_append_sheet(WORK_BOOK, WORK_SHEET, 'Sheet1');
100
- XLSX.writeFile(WORK_BOOK, fileName);
101
- }
102
-
103
-
104
- /** Convert file to string base64 */
105
- public static ConvertToBase64(file: File) {
106
- return new Promise<string>(Resolve => {
107
- const reader = new FileReader();
108
- reader.readAsDataURL(file);
109
-
110
- reader.onload = () => {
111
- Resolve(reader.result?.toString() || '');
112
- }
113
-
114
- reader.onerror = () => {
115
- Resolve('');
116
- }
117
- });
118
- }
119
- }
@@ -1,66 +0,0 @@
1
- import { Router } from '@angular/router';
2
- import { AfterViewInit, OnDestroy } from '@angular/core';
3
- import { IBreadcrumb, IGoBack } from '../../interfaces';
4
- import { CoerAlert } from '../../components';
5
- import * as i0 from "@angular/core";
6
- export declare class Page implements AfterViewInit, OnDestroy {
7
- protected readonly alert: CoerAlert;
8
- protected readonly router: Router;
9
- private readonly activatedRoute;
10
- /** */
11
- protected isUpdate: boolean;
12
- /** */
13
- protected isLoading: boolean;
14
- /** */
15
- protected isReady: boolean;
16
- /** */
17
- protected enableAnimations: boolean;
18
- /** */
19
- protected routeParams: any;
20
- /** */
21
- protected queryParams: any;
22
- /** */
23
- protected breadcrumbs: IBreadcrumb[];
24
- /** */
25
- protected pageResponse: any;
26
- /** */
27
- protected goBack: IGoBack;
28
- private _page;
29
- private _source;
30
- private _preventDestroy;
31
- constructor(page: string);
32
- ngAfterViewInit(): void;
33
- ngOnDestroy(): void;
34
- /** Main method. Starts after ngAfterViewInit() */
35
- protected RunPage(): void;
36
- /** Rename the last breadcrumb and update the url id */
37
- protected SetPageName(name: string, id?: string | number | null): void;
38
- /** */
39
- private SetSource;
40
- /** */
41
- private GetSource;
42
- /** */
43
- protected GetPageResponse(): void;
44
- /** */
45
- private GetNavigation;
46
- /** */
47
- private SetGoBack;
48
- /** */
49
- private GoBack;
50
- /** Navigate to previous page */
51
- protected GoToSource<T>(pageResponse?: T | null): void;
52
- /** */
53
- protected SetPageResponse<T>(pageResponse?: T | null): void;
54
- /** */
55
- protected ReloadPage(): void;
56
- /** */
57
- protected Log(value: any, log?: string | null): void;
58
- /** Returns true if the value is null or undefined, false otherwise */
59
- protected IsNotNull: <T>(value: T | null | undefined) => boolean;
60
- /** Returns true if the value is null or undefined, false otherwise */
61
- protected IsNull: <T>(value: T | null | undefined) => boolean;
62
- /** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
63
- protected IsOnlyWhiteSpace: <T>(value: T | null | undefined) => boolean;
64
- static ɵfac: i0.ɵɵFactoryDeclaration<Page, never>;
65
- static ɵcmp: i0.ɵɵComponentDeclaration<Page, "ng-component", never, {}, {}, never, never, false, never>;
66
- }
@@ -1,197 +0,0 @@
1
- import { ActivatedRoute, Router } from '@angular/router';
2
- import { AfterViewInit, Component, Inject, inject, OnDestroy } from '@angular/core';
3
- import { IAppSource, IBreadcrumb, IGoBack } from '../../interfaces';
4
- import { CoerAlert } from '../../components';
5
- import { Source } from './Source.class';
6
- import { Tools } from './Tools';
7
- import { Breadcrumbs } from './Breadcrumbs.class';
8
-
9
- @Component({ template: '' })
10
- export class Page implements AfterViewInit, OnDestroy {
11
-
12
- //Injection
13
- protected readonly alert = inject(CoerAlert);
14
- protected readonly router = inject(Router);
15
- private readonly activatedRoute = inject(ActivatedRoute);
16
-
17
- /** */
18
- protected isUpdate: boolean = false;
19
-
20
- /** */
21
- protected isLoading: boolean = false;
22
-
23
- /** */
24
- protected isReady: boolean = false;
25
-
26
- /** */
27
- protected enableAnimations: boolean = false;
28
-
29
- /** */
30
- protected routeParams: any;
31
-
32
- /** */
33
- protected queryParams: any;
34
-
35
- /** */
36
- protected breadcrumbs: IBreadcrumb[] = [];
37
-
38
- /** */
39
- protected pageResponse: any = null;
40
-
41
- /** */
42
- protected goBack: IGoBack = { show: false };
43
-
44
- //Private Variables
45
- private _page: string = '';
46
- private _source: IAppSource | null = null;
47
- private _preventDestroy: boolean = false;
48
-
49
-
50
- constructor(@Inject(String) page: string) {
51
- this.SetPageName(page);
52
- this.SetSource();
53
- this.GetSource();
54
- this.GetNavigation();
55
- this.SetGoBack();
56
- this.GetPageResponse();
57
- }
58
-
59
- ngAfterViewInit() {
60
- this.routeParams = this.activatedRoute.snapshot.params;
61
- this.queryParams = this.activatedRoute.snapshot.queryParams;
62
-
63
- setTimeout(() => {
64
- this.isReady = true;
65
- this.RunPage();
66
- setTimeout(() => { this.enableAnimations = true }, 1000);
67
- });
68
-
69
- }
70
-
71
- ngOnDestroy() {
72
- if (!this._preventDestroy) Source.ClearPageResponse();
73
- }
74
-
75
- /** Main method. Starts after ngAfterViewInit() */
76
- protected RunPage(): void {};
77
-
78
-
79
- /** Rename the last breadcrumb and update the url id */
80
- protected SetPageName(name: string, id: string | number | null = null): void {
81
- this._page = name;
82
-
83
- let path = this.router.url;
84
- if (path.includes('?')) path = path.split('?')[0];
85
-
86
- if (id) {
87
- const PATH_ARRAY = path.split('/');
88
- const PATH_ID = Tools.BreakReference(PATH_ARRAY).pop();
89
- if (PATH_ID) {
90
- PATH_ARRAY[PATH_ARRAY.length - 1] = String(id);
91
- path = PATH_ARRAY.join('/');
92
- }
93
- }
94
-
95
- if (this.breadcrumbs.length > 0) {
96
- this.breadcrumbs[this.breadcrumbs.length - 1].page = name;
97
- this.breadcrumbs[this.breadcrumbs.length - 1].path = path;
98
- Breadcrumbs.SetLast(name, path);
99
- }
100
-
101
- this.router.navigateByUrl(path)
102
- }
103
-
104
-
105
- /** */
106
- private SetSource(): void {
107
- Source.Set(this._page);
108
- }
109
-
110
-
111
- /** */
112
- private GetSource(): void {
113
- this._source = Source.Get();
114
- }
115
-
116
-
117
- /** */
118
- protected GetPageResponse(): void {
119
- this.pageResponse = Source.GetPageResponse();
120
- }
121
-
122
-
123
- /** */
124
- private GetNavigation(): void {
125
- if (this._source) {
126
- this.breadcrumbs = Breadcrumbs.Get().map(item => Object.assign({
127
- page: item.page,
128
- path: item.path,
129
- click: this.GoBack(item.path)
130
- }));
131
- }
132
-
133
- else this.breadcrumbs = [{ page: this._page }];
134
- }
135
-
136
-
137
- /** */
138
- private SetGoBack(): void {
139
- if (this._source) {
140
- this.goBack = {
141
- show: true,
142
- path: this._source.path,
143
- click: this.GoBack()
144
- };
145
- }
146
- }
147
-
148
-
149
- /** */
150
- private GoBack = (path?: string) => (() => {
151
- if (path) Breadcrumbs.Remove(path);
152
- else Breadcrumbs.RemoveLast();
153
- });
154
-
155
-
156
- /** Navigate to previous page */
157
- protected GoToSource<T>(pageResponse: T | null = null): void {
158
- if(this._source) {
159
- Breadcrumbs.RemoveLast();
160
- this.SetPageResponse(pageResponse);
161
- Tools.Sleep().then(_ => this.router.navigateByUrl(this._source!.path));
162
- }
163
- };
164
-
165
-
166
- /** */
167
- protected SetPageResponse<T>(pageResponse: T | null = null): void {
168
- if (Tools.IsNotNull(pageResponse)) {
169
- this._preventDestroy = true;
170
- Source.SetPageResponse(pageResponse);
171
- }
172
- };
173
-
174
-
175
- /** */
176
- protected ReloadPage(): void {
177
- Breadcrumbs.RemoveLast();
178
- Tools.Sleep().then(_ => window.location.reload());
179
- }
180
-
181
-
182
- /** */
183
- protected Log(value: any, log: string | null = null): void {
184
- if (Tools.IsNotNull(log)) console.log({ log, value });
185
- else console.log(value);
186
- }
187
-
188
-
189
- /** Returns true if the value is null or undefined, false otherwise */
190
- protected IsNotNull = Tools.IsNotNull;
191
-
192
- /** Returns true if the value is null or undefined, false otherwise */
193
- protected IsNull = Tools.IsNull;
194
-
195
- /** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
196
- protected IsOnlyWhiteSpace = Tools.IsOnlyWhiteSpace;
197
- }
@@ -1,11 +0,0 @@
1
- import { IScreenSize } from "../../interfaces";
2
- import { Observable } from "rxjs";
3
- export declare class Screen {
4
- static get WINDOW_WIDTH(): number;
5
- static get WINDOW_HEIGHT(): number;
6
- static get DEVICE_WIDTH(): number;
7
- static get DEVICE_HEIGHT(): number;
8
- static get BREAKPOINT(): 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
9
- /** */
10
- static Resize: Observable<IScreenSize>;
11
- }
@@ -1,50 +0,0 @@
1
- import { IScreenSize } from "../../interfaces";
2
- import { Observable } from "rxjs";
3
-
4
- export class Screen {
5
-
6
- public static get WINDOW_WIDTH(): number {
7
- return window.innerWidth;
8
- }
9
-
10
-
11
- public static get WINDOW_HEIGHT(): number {
12
- return window.innerHeight;
13
- }
14
-
15
-
16
- public static get DEVICE_WIDTH(): number {
17
- return window.screen.width;
18
- }
19
-
20
-
21
- public static get DEVICE_HEIGHT(): number {
22
- return window.screen.height;
23
- }
24
-
25
-
26
- public static get BREAKPOINT(): 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' {
27
- if (window.innerWidth < 576) return 'xs';
28
- else if (window.innerWidth >= 576 && window.innerWidth < 768) return 'sm';
29
- else if (window.innerWidth >= 768 && window.innerWidth < 992) return 'md';
30
- else if (window.innerWidth >= 992 && window.innerWidth < 1200) return 'lg';
31
- else if (window.innerWidth >= 1200 && window.innerWidth < 1400) return 'xl';
32
- else return 'xxl';
33
- }
34
-
35
-
36
- /** */
37
- public static Resize = new Observable<IScreenSize>(subscriber => {
38
- window.addEventListener("load", () => {
39
- window.dispatchEvent(new Event('resize'));
40
- });
41
-
42
- window.onresize = () => {
43
- subscriber.next({
44
- width: window.innerWidth,
45
- height: window.innerHeight,
46
- breakpoin: this.BREAKPOINT
47
- });
48
- }
49
- });
50
- }
@@ -1,20 +0,0 @@
1
- import { IAppSource } from '../../interfaces';
2
- export declare class Source {
3
- private static readonly storage;
4
- /** */
5
- static Set(page: string): void;
6
- /** */
7
- private static Save;
8
- /** */
9
- static Get(): IAppSource | null;
10
- /** */
11
- static GetRoot(): IAppSource | null;
12
- /** */
13
- static SetPageResponse<T>(pageResponse: T): void;
14
- /** */
15
- static GetPageResponse<T>(): T | null;
16
- /** */
17
- static ClearPageResponse(): void;
18
- /** Clear Source */
19
- static Reset(): void;
20
- }