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.
- package/components/index.d.ts +2 -2
- package/esm2022/coer-elements.mjs +2 -2
- package/esm2022/components/index.mjs +3 -3
- package/esm2022/components/lib/coer-alert/coer-alert.component.mjs +227 -0
- package/esm2022/components/lib/components.module.mjs +92 -0
- package/esm2022/public_api.mjs +2 -0
- package/fesm2022/coer-elements.mjs +6 -697
- package/fesm2022/coer-elements.mjs.map +1 -1
- package/index.d.ts +5 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -0
- package/src/styles/bootstrap.scss +15 -0
- package/src/styles/coer-elements.scss +29 -0
- package/{styles → src/styles}/colors.scss +27 -1
- package/src/styles/containers.scss +34 -0
- package/src/styles/cursores.scss +11 -0
- package/src/styles/layout.scss +21 -0
- package/src/styles/scroll-bar.scss +20 -0
- package/styles/{index.css → coer-elements.css} +268 -26
- package/components/index.ts +0 -2
- package/components/src/coer-alert/coer-alert.component.html +0 -56
- package/components/src/coer-alert/coer-alert.component.scss +0 -100
- package/components/src/coer-alert/coer-alert.component.ts +0 -249
- package/components/src/components.module.ts +0 -97
- package/esm2022/components/src/coer-alert/coer-alert.component.mjs +0 -227
- package/esm2022/components/src/components.module.mjs +0 -92
- package/esm2022/index.mjs +0 -2
- package/esm2022/interfaces/index.mjs +0 -7
- package/esm2022/interfaces/src/IAppSource.interface.mjs +0 -2
- package/esm2022/interfaces/src/IBreadcrumb.interface.mjs +0 -2
- package/esm2022/interfaces/src/ICoerRef.interface.mjs +0 -2
- package/esm2022/interfaces/src/IGoBack.interface.mjs +0 -2
- package/esm2022/interfaces/src/IPatch.interface.mjs +0 -2
- package/esm2022/interfaces/src/IScreenSize.interface.mjs +0 -2
- package/esm2022/tools/index.mjs +0 -9
- package/esm2022/tools/src/Breadcrumbs.class.mjs +0 -63
- package/esm2022/tools/src/ControlValue.mjs +0 -44
- package/esm2022/tools/src/DateTime.class.mjs +0 -22
- package/esm2022/tools/src/Files.class.mjs +0 -93
- package/esm2022/tools/src/Page.class.mjs +0 -162
- package/esm2022/tools/src/Screen.class.mjs +0 -43
- package/esm2022/tools/src/Source.class.mjs +0 -80
- package/esm2022/tools/src/Tools.mjs +0 -200
- package/interfaces/index.d.ts +0 -6
- package/interfaces/index.ts +0 -6
- package/interfaces/src/IAppSource.interface.d.ts +0 -4
- package/interfaces/src/IAppSource.interface.ts +0 -4
- package/interfaces/src/IBreadcrumb.interface.d.ts +0 -6
- package/interfaces/src/IBreadcrumb.interface.ts +0 -6
- package/interfaces/src/ICoerRef.interface.d.ts +0 -10
- package/interfaces/src/ICoerRef.interface.ts +0 -11
- package/interfaces/src/IGoBack.interface.d.ts +0 -6
- package/interfaces/src/IGoBack.interface.ts +0 -6
- package/interfaces/src/IPatch.interface.d.ts +0 -5
- package/interfaces/src/IPatch.interface.ts +0 -5
- package/interfaces/src/IScreenSize.interface.d.ts +0 -5
- package/interfaces/src/IScreenSize.interface.ts +0 -5
- package/styles/index.scss +0 -98
- package/tools/index.d.ts +0 -8
- package/tools/index.ts +0 -8
- package/tools/src/Breadcrumbs.class.d.ts +0 -18
- package/tools/src/Breadcrumbs.class.ts +0 -84
- package/tools/src/ControlValue.d.ts +0 -23
- package/tools/src/ControlValue.ts +0 -63
- package/tools/src/DateTime.class.d.ts +0 -11
- package/tools/src/DateTime.class.ts +0 -27
- package/tools/src/Files.class.d.ts +0 -16
- package/tools/src/Files.class.ts +0 -119
- package/tools/src/Page.class.d.ts +0 -66
- package/tools/src/Page.class.ts +0 -197
- package/tools/src/Screen.class.d.ts +0 -11
- package/tools/src/Screen.class.ts +0 -50
- package/tools/src/Source.class.d.ts +0 -20
- package/tools/src/Source.class.ts +0 -107
- package/tools/src/Tools.d.ts +0 -33
- package/tools/src/Tools.ts +0 -217
- /package/components/{src → lib}/coer-alert/coer-alert.component.d.ts +0 -0
- /package/components/{src → lib}/components.module.d.ts +0 -0
@@ -1,107 +0,0 @@
|
|
1
|
-
import { Router } from '@angular/router';
|
2
|
-
import { inject } from "@angular/core";
|
3
|
-
import { IAppSource } from '../../interfaces';
|
4
|
-
import { Breadcrumbs } from './Breadcrumbs.class';
|
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/src/Tools.d.ts
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
export declare const Tools: {
|
2
|
-
/** Generate a Guid */
|
3
|
-
GetGuid: (seed?: string) => string;
|
4
|
-
/** Returns true if the value is null or undefined, false otherwise */
|
5
|
-
IsNull: <T>(value: T | null | undefined) => boolean;
|
6
|
-
/** Returns true if the value is not null or undefined, false otherwise */
|
7
|
-
IsNotNull: <T_1>(value: T_1 | null | undefined) => boolean;
|
8
|
-
/** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
|
9
|
-
IsOnlyWhiteSpace: <T_2>(value: T_2 | null | undefined) => boolean;
|
10
|
-
/** Break reference of a object or array */
|
11
|
-
BreakReference: <T_3>(object: T_3) => T_3;
|
12
|
-
/** Clean extra whitespaces */
|
13
|
-
CleanUpBlanks: (text: string | number) => string;
|
14
|
-
/** Get properties of an object */
|
15
|
-
GetObjectProperties: <T_4>(obj: T_4 | null | undefined) => string[];
|
16
|
-
/**
|
17
|
-
* Set an index and merge more arrays of the same type
|
18
|
-
* @returns A new array
|
19
|
-
* */
|
20
|
-
SetIndex: <T_5>(array: T_5[], ...args: T_5[][]) => T_5[];
|
21
|
-
/** Set First Char To Lower */
|
22
|
-
FirstCharToLower: (text: string | null | undefined) => string;
|
23
|
-
/** Set First Char To Upper */
|
24
|
-
FirstCharToUpper: (text: string | null | undefined) => string;
|
25
|
-
/** Sort an array in ascending order by property */
|
26
|
-
SortBy: <T_6>(array: T_6[], property: string, propertyType?: 'string' | 'number') => T_6[];
|
27
|
-
/** Sort an array in descending order by property */
|
28
|
-
SortByDesc: <T_7>(array: T_7[], property: string, propertyType?: 'string' | 'number') => T_7[];
|
29
|
-
/** Return a string with forman numeric */
|
30
|
-
GetNumericFormat: (value: string | number | null | undefined, decimals?: number) => string;
|
31
|
-
/** Wait the time indicated */
|
32
|
-
Sleep: (milliseconds?: number, reference?: string | null) => Promise<unknown>;
|
33
|
-
};
|
package/tools/src/Tools.ts
DELETED
@@ -1,217 +0,0 @@
|
|
1
|
-
import { signal } from "@angular/core";
|
2
|
-
const reference_signal = signal<any>({});
|
3
|
-
|
4
|
-
export const Tools = {
|
5
|
-
/** Generate a Guid */
|
6
|
-
GetGuid: (seed: string = 'coer-system') => {
|
7
|
-
let time = new Date().getTime();
|
8
|
-
seed = seed.toString().trim()
|
9
|
-
return seed + `-xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g, (c) => {
|
10
|
-
const random = (time + Math.random() * 16) % 16 | 0
|
11
|
-
time = Math.floor(time / 16)
|
12
|
-
return (c == 'x' ? random : (random & 0x3 | 0x8)).toString(16)
|
13
|
-
})
|
14
|
-
},
|
15
|
-
|
16
|
-
|
17
|
-
/** Returns true if the value is null or undefined, false otherwise */
|
18
|
-
IsNull: <T>(value: T | null | undefined): boolean => {
|
19
|
-
if (value === undefined) return true;
|
20
|
-
if (value === null) return true;
|
21
|
-
return false;
|
22
|
-
},
|
23
|
-
|
24
|
-
|
25
|
-
/** Returns true if the value is not null or undefined, false otherwise */
|
26
|
-
IsNotNull: <T>(value: T | null | undefined): boolean => {
|
27
|
-
if (value === undefined) return false;
|
28
|
-
if (value === null) return false;
|
29
|
-
return true;
|
30
|
-
},
|
31
|
-
|
32
|
-
|
33
|
-
/** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
|
34
|
-
IsOnlyWhiteSpace: <T>(value: T | null | undefined): boolean => {
|
35
|
-
if (value === undefined) return true;
|
36
|
-
if (value === null) return true;
|
37
|
-
if((value as string).toString().trim() === '') return true;
|
38
|
-
return false;
|
39
|
-
},
|
40
|
-
|
41
|
-
|
42
|
-
/** Break reference of a object or array */
|
43
|
-
BreakReference: <T>(object: T): T => {
|
44
|
-
if (object === undefined) return undefined as T;
|
45
|
-
if (object === null) return null as T;
|
46
|
-
const OBJECT = JSON.parse(JSON.stringify(object))
|
47
|
-
return (Array.isArray(OBJECT)) ? [...OBJECT] : { ...OBJECT }
|
48
|
-
},
|
49
|
-
|
50
|
-
|
51
|
-
/** Clean extra whitespaces */
|
52
|
-
CleanUpBlanks: (text: string | number): string => {
|
53
|
-
if(Tools.IsNull(text)) return '';
|
54
|
-
let worlds: string[] = String(text).split(' ');
|
55
|
-
worlds = worlds.filter(x => x.length > 0);
|
56
|
-
return worlds.join(' ');
|
57
|
-
},
|
58
|
-
|
59
|
-
|
60
|
-
/** Get properties of an object */
|
61
|
-
GetObjectProperties: <T>(obj: T | null | undefined): string[] => {
|
62
|
-
const properties: string[] = [];
|
63
|
-
if(Tools.IsNull(obj)) return properties;
|
64
|
-
for(const property in obj) properties.push(String(property));
|
65
|
-
return properties;
|
66
|
-
},
|
67
|
-
|
68
|
-
|
69
|
-
/**
|
70
|
-
* Set an index and merge more arrays of the same type
|
71
|
-
* @returns A new array
|
72
|
-
* */
|
73
|
-
SetIndex: <T>(array: T[], ...args: T[][]): T[] => {
|
74
|
-
let index = 0;
|
75
|
-
for (const arg of args) {
|
76
|
-
array = Tools.BreakReference(array).concat(Tools.BreakReference(arg));
|
77
|
-
}
|
78
|
-
|
79
|
-
return Tools.BreakReference(array).map(item => Object.assign({ index: index++ }, item));
|
80
|
-
},
|
81
|
-
|
82
|
-
|
83
|
-
/** Set First Char To Lower */
|
84
|
-
FirstCharToLower: (text: string | null | undefined): string => {
|
85
|
-
if (Tools.IsNull(text)) return '';
|
86
|
-
|
87
|
-
const textArray: string[] = [];
|
88
|
-
for(let i = 0; i < text!.length; i++) {
|
89
|
-
if(i === 0) textArray.push(text![i].toLowerCase());
|
90
|
-
else textArray.push(text![i]);
|
91
|
-
}
|
92
|
-
|
93
|
-
return textArray.join('');
|
94
|
-
},
|
95
|
-
|
96
|
-
|
97
|
-
/** Set First Char To Upper */
|
98
|
-
FirstCharToUpper: (text: string | null | undefined): string => {
|
99
|
-
if (Tools.IsNull(text)) return '';
|
100
|
-
|
101
|
-
const textArray: string[] = [];
|
102
|
-
for(let i = 0; i < text!.length; i++) {
|
103
|
-
if(i === 0) textArray.push(text![i].toUpperCase());
|
104
|
-
else textArray.push(text![i]);
|
105
|
-
}
|
106
|
-
|
107
|
-
return textArray.join('');
|
108
|
-
},
|
109
|
-
|
110
|
-
|
111
|
-
/** Sort an array in ascending order by property */
|
112
|
-
SortBy: <T>(array: T[], property: string, propertyType: 'string' | 'number' = 'string'): T[] => {
|
113
|
-
switch (propertyType) {
|
114
|
-
case 'string': {
|
115
|
-
return array.sort((x: any, y: any) => {
|
116
|
-
if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim()) return -1;
|
117
|
-
else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim()) return 1;
|
118
|
-
else return 0;
|
119
|
-
});
|
120
|
-
}
|
121
|
-
|
122
|
-
case 'number': {
|
123
|
-
return array.sort((x: any, y: any) => Number(x[property] - Number(y[property])));
|
124
|
-
}
|
125
|
-
}
|
126
|
-
},
|
127
|
-
|
128
|
-
|
129
|
-
/** Sort an array in descending order by property */
|
130
|
-
SortByDesc: <T>(array: T[], property: string, propertyType: 'string' | 'number' = 'string'): T[] => {
|
131
|
-
switch (propertyType) {
|
132
|
-
case 'string': {
|
133
|
-
return array.sort((x: any, y: any) => {
|
134
|
-
if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim()) return 1;
|
135
|
-
else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim()) return -1;
|
136
|
-
else return 0;
|
137
|
-
});
|
138
|
-
}
|
139
|
-
|
140
|
-
case 'number': {
|
141
|
-
return array.sort((x: any, y: any) => Number(Number(y[property])) - x[property]);
|
142
|
-
}
|
143
|
-
}
|
144
|
-
},
|
145
|
-
|
146
|
-
|
147
|
-
/** Return a string with forman numeric */
|
148
|
-
GetNumericFormat: (value: string | number | null | undefined, decimals: number = 0): string => {
|
149
|
-
if (value == undefined
|
150
|
-
|| value == null
|
151
|
-
|| value.toString().trim() == ''
|
152
|
-
|| isNaN(Number(value))) {
|
153
|
-
return '0';
|
154
|
-
}
|
155
|
-
|
156
|
-
let valueInteger = '';
|
157
|
-
let valueDecimal = '';
|
158
|
-
value = value.toString().replaceAll(' ', '');
|
159
|
-
|
160
|
-
if (value.includes('.') || (decimals > 0)) {
|
161
|
-
valueInteger = value.includes('.') ? value.split('.')[0] : value;
|
162
|
-
|
163
|
-
if (decimals > 0) {
|
164
|
-
const PADDING = decimals - valueDecimal.length;
|
165
|
-
valueDecimal = value.includes('.') ? value.split('.')[1] : '';
|
166
|
-
for(let i = 0; i < PADDING; i++) valueDecimal += '0';
|
167
|
-
valueDecimal = valueDecimal.substring(0, decimals);
|
168
|
-
valueDecimal = `.${valueDecimal}`;
|
169
|
-
}
|
170
|
-
}
|
171
|
-
|
172
|
-
else {
|
173
|
-
valueInteger = value;
|
174
|
-
}
|
175
|
-
|
176
|
-
let counter = 0;
|
177
|
-
const VALUE_INTEGER_ARRAY: string[] = [];
|
178
|
-
for(const char of valueInteger.split('').reverse()) {
|
179
|
-
if (counter == 3) {
|
180
|
-
VALUE_INTEGER_ARRAY.push(',');
|
181
|
-
counter = 0;
|
182
|
-
}
|
183
|
-
|
184
|
-
VALUE_INTEGER_ARRAY.push(char);
|
185
|
-
++counter;
|
186
|
-
}
|
187
|
-
|
188
|
-
valueInteger = VALUE_INTEGER_ARRAY.reverse().join('');
|
189
|
-
return `${valueInteger}${valueDecimal}`;
|
190
|
-
},
|
191
|
-
|
192
|
-
|
193
|
-
/** Wait the time indicated */
|
194
|
-
Sleep: (milliseconds: number = 0, reference: string | null = null) => {
|
195
|
-
if (Tools.IsNull(reference)) {
|
196
|
-
return new Promise(Resolve => setTimeout(Resolve, milliseconds));
|
197
|
-
}
|
198
|
-
|
199
|
-
else return new Promise<void>(Resolve => {
|
200
|
-
reference = reference!.replaceAll(' ', '_').toLowerCase();
|
201
|
-
|
202
|
-
if (reference_signal().hasOwnProperty(reference)) {
|
203
|
-
clearInterval(reference_signal()[reference!]);
|
204
|
-
}
|
205
|
-
|
206
|
-
reference_signal.set(Object.assign(reference_signal(), {
|
207
|
-
[reference!]: setTimeout(() => {
|
208
|
-
Resolve();
|
209
|
-
clearInterval(reference_signal()[reference!]);
|
210
|
-
const _reference = { ...reference_signal() };
|
211
|
-
delete _reference[reference!];
|
212
|
-
reference_signal.set({ ..._reference });
|
213
|
-
}, milliseconds)
|
214
|
-
}));
|
215
|
-
});
|
216
|
-
}
|
217
|
-
};
|
File without changes
|
File without changes
|