coer-elements 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- package/components/index.d.ts +1 -0
- package/components/lib/coer-button/coer-button.component.d.ts +44 -0
- package/components/lib/components.module.d.ts +6 -4
- package/esm2022/components/index.mjs +2 -1
- package/esm2022/components/lib/coer-button/coer-button.component.mjs +133 -0
- package/esm2022/components/lib/components.module.mjs +15 -9
- package/esm2022/interfaces/index.mjs +7 -0
- package/esm2022/interfaces/lib/app-source.interface.mjs +2 -0
- package/esm2022/interfaces/lib/breadcrumb.interface.mjs +2 -0
- package/esm2022/interfaces/lib/coer-ref.interface.mjs +2 -0
- package/esm2022/interfaces/lib/go-back.interface.mjs +2 -0
- package/esm2022/interfaces/lib/patch.interface.mjs +2 -0
- package/esm2022/interfaces/lib/screen-size.interface.mjs +2 -0
- package/esm2022/public_api.mjs +2 -1
- package/esm2022/signals/index.mjs +4 -0
- package/esm2022/signals/lib/breakpoint.signal.mjs +4 -0
- package/esm2022/signals/lib/is-loading.signal.mjs +3 -0
- package/esm2022/signals/lib/is-modal-open.signal.mjs +3 -0
- package/esm2022/tools/index.mjs +9 -2
- package/esm2022/tools/lib/breadcrumbs.class.mjs +63 -0
- package/esm2022/tools/lib/control-value.class.mjs +46 -0
- package/esm2022/tools/lib/date-time.class.mjs +22 -0
- package/esm2022/tools/lib/files.class.mjs +91 -0
- package/esm2022/tools/lib/generi-tools.mjs +199 -0
- package/esm2022/tools/lib/page.class.mjs +156 -0
- package/esm2022/tools/lib/screen.class.mjs +43 -0
- package/esm2022/tools/lib/source.class.mjs +80 -0
- package/fesm2022/coer-elements.mjs +836 -54
- package/fesm2022/coer-elements.mjs.map +1 -1
- package/interfaces/index.d.ts +6 -0
- package/interfaces/lib/app-source.interface.d.ts +4 -0
- package/interfaces/lib/breadcrumb.interface.d.ts +6 -0
- package/interfaces/lib/coer-ref.interface.d.ts +10 -0
- package/interfaces/lib/go-back.interface.d.ts +6 -0
- package/interfaces/lib/patch.interface.d.ts +5 -0
- package/interfaces/lib/screen-size.interface.d.ts +5 -0
- package/package.json +1 -1
- package/public_api.d.ts +1 -0
- package/signals/index.d.ts +3 -0
- package/signals/lib/breakpoint.signal.d.ts +1 -0
- package/signals/lib/is-loading.signal.d.ts +1 -0
- package/signals/lib/is-modal-open.signal.d.ts +1 -0
- package/src/interfaces/index.ts +6 -0
- package/src/interfaces/lib/app-source.interface.ts +4 -0
- package/src/interfaces/lib/breadcrumb.interface.ts +6 -0
- package/src/interfaces/lib/coer-ref.interface.ts +11 -0
- package/src/interfaces/lib/go-back.interface.ts +6 -0
- package/src/interfaces/lib/patch.interface.ts +5 -0
- package/src/interfaces/lib/screen-size.interface.ts +5 -0
- package/tools/index.d.ts +8 -1
- package/tools/lib/breadcrumbs.class.d.ts +18 -0
- package/tools/lib/date-time.class.d.ts +11 -0
- package/tools/lib/files.class.d.ts +16 -0
- package/tools/lib/generi-tools.d.ts +32 -0
- package/tools/lib/page.class.d.ts +60 -0
- package/tools/lib/screen.class.d.ts +11 -0
- package/tools/lib/source.class.d.ts +20 -0
- package/esm2022/tools/lib/controlValue.mjs +0 -46
- /package/tools/lib/{controlValue.d.ts → control-value.class.d.ts} +0 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
2
|
+
import { forwardRef } from "@angular/core";
|
3
|
+
export const CONTROL_VALUE = (component) => {
|
4
|
+
return {
|
5
|
+
provide: NG_VALUE_ACCESSOR,
|
6
|
+
useExisting: forwardRef(() => component),
|
7
|
+
multi: true
|
8
|
+
};
|
9
|
+
};
|
10
|
+
export class ControlValue {
|
11
|
+
constructor() {
|
12
|
+
this._isTouched = false;
|
13
|
+
}
|
14
|
+
get isTouched() {
|
15
|
+
return this._isTouched;
|
16
|
+
}
|
17
|
+
/** */
|
18
|
+
SetValue(value) {
|
19
|
+
if (typeof this._UpdateValue === 'function') {
|
20
|
+
this._UpdateValue(value);
|
21
|
+
}
|
22
|
+
this._value = value;
|
23
|
+
}
|
24
|
+
/** */
|
25
|
+
SetTouched(isTouched) {
|
26
|
+
if (typeof this._IsTouched === 'function') {
|
27
|
+
this._IsTouched(isTouched);
|
28
|
+
}
|
29
|
+
this._isTouched = isTouched;
|
30
|
+
}
|
31
|
+
/** */
|
32
|
+
writeValue(value) {
|
33
|
+
this._value = value;
|
34
|
+
}
|
35
|
+
/** */
|
36
|
+
registerOnChange(callback) {
|
37
|
+
this._UpdateValue = callback;
|
38
|
+
}
|
39
|
+
/** */
|
40
|
+
registerOnTouched(callback) {
|
41
|
+
this._IsTouched = callback;
|
42
|
+
}
|
43
|
+
/** */
|
44
|
+
setDisabledState(isDisabled) { }
|
45
|
+
}
|
46
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJvbC12YWx1ZS5jbGFzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NvZXItZWxlbWVudHMvc3JjL3Rvb2xzL2xpYi9jb250cm9sLXZhbHVlLmNsYXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBd0IsaUJBQWlCLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUN6RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRTNDLE1BQU0sQ0FBQyxNQUFNLGFBQWEsR0FBRyxDQUFJLFNBQVksRUFBRSxFQUFFO0lBQzdDLE9BQU87UUFDSCxPQUFPLEVBQUUsaUJBQWlCO1FBQzFCLFdBQVcsRUFBRSxVQUFVLENBQUMsR0FBRyxFQUFFLENBQUMsU0FBUyxDQUFDO1FBQ3hDLEtBQUssRUFBRSxJQUFJO0tBQ2QsQ0FBQTtBQUNMLENBQUMsQ0FBQTtBQUdELE1BQU0sT0FBTyxZQUFZO0lBQXpCO1FBSVksZUFBVSxHQUFZLEtBQUssQ0FBQztJQWtEeE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XG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogKi9cclxuICAgIHB1YmxpYyBTZXRUb3VjaGVkKGlzVG91Y2hlZDogYm9vbGVhbik6IHZvaWQge1xyXG4gICAgICAgIGlmKHR5cGVvZiB0aGlzLl9Jc1RvdWNoZWQgPT09ICdmdW5jdGlvbicpIHtcclxuICAgICAgICAgICAgdGhpcy5fSXNUb3VjaGVkKGlzVG91Y2hlZCk7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICB0aGlzLl9pc1RvdWNoZWQgPSBpc1RvdWNoZWQ7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiAqL1xyXG4gICAgcHVibGljIHdyaXRlVmFsdWUodmFsdWU6IGFueSk6IHZvaWQge1xyXG4gICAgICAgIHRoaXMuX3ZhbHVlID0gdmFsdWU7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiAqL1xyXG4gICAgcHVibGljIHJlZ2lzdGVyT25DaGFuZ2UoY2FsbGJhY2s6IEZ1bmN0aW9uKTogdm9pZCB7XHJcbiAgICAgICAgdGhpcy5fVXBkYXRlVmFsdWUgPSBjYWxsYmFjaztcclxuICAgIH1cclxuXHJcblxyXG4gICAgLyoqICovXHJcbiAgICBwdWJsaWMgcmVnaXN0ZXJPblRvdWNoZWQoY2FsbGJhY2s6IEZ1bmN0aW9uKTogdm9pZCB7XHJcbiAgICAgICAgdGhpcy5fSXNUb3VjaGVkID0gY2FsbGJhY2s7XHJcbiAgICB9XHJcblxyXG4gICAgXHJcbiAgICAvKiogKi9cclxuICAgIHB1YmxpYyBzZXREaXNhYmxlZFN0YXRlKGlzRGlzYWJsZWQ6IGJvb2xlYW4pOiB2b2lkIHt9XHJcbn0iXX0=
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import moment from "moment";
|
2
|
+
export class DateTime {
|
3
|
+
/** Get UTC Offset */
|
4
|
+
static GetOffset() {
|
5
|
+
return moment().utcOffset();
|
6
|
+
}
|
7
|
+
/** Convert UTC Date to Local Zone */
|
8
|
+
static ToLocalZone(utcDate) {
|
9
|
+
return moment(utcDate).add(DateTime.GetOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
|
10
|
+
}
|
11
|
+
/** Convert Local Zone Date to UTC */
|
12
|
+
static ToUTC(utcDate) {
|
13
|
+
return moment(utcDate).subtract(DateTime.GetOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
|
14
|
+
}
|
15
|
+
/** DD MMM YYYY */
|
16
|
+
static GetDateFormat(date) {
|
17
|
+
if ((typeof date === 'string'))
|
18
|
+
date = date.replaceAll('/', '-');
|
19
|
+
return moment(date).parseZone().local(true).format('DD MMM YYYY');
|
20
|
+
}
|
21
|
+
}
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZS10aW1lLmNsYXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY29lci1lbGVtZW50cy9zcmMvdG9vbHMvbGliL2RhdGUtdGltZS5jbGFzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLE1BQU0sTUFBTSxRQUFRLENBQUM7QUFFNUIsTUFBTSxPQUFPLFFBQVE7SUFDakIscUJBQXFCO0lBQ2QsTUFBTSxDQUFDLFNBQVM7UUFDbkIsT0FBTyxNQUFNLEVBQUUsQ0FBQyxTQUFTLEVBQUUsQ0FBQztJQUNoQyxDQUFDO0lBR0QscUNBQXFDO0lBQzlCLE1BQU0sQ0FBQyxXQUFXLENBQUMsT0FBc0M7UUFDNUQsT0FBTyxNQUFNLENBQUMsT0FBTyxDQUFDLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxTQUFTLEVBQUUsRUFBRSxTQUFTLENBQUMsQ0FBQyxNQUFNLENBQUMscUJBQXFCLENBQUMsQ0FBQztJQUM5RixDQUFDO0lBR0QscUNBQXFDO0lBQzlCLE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2Zmc2V0KCksICdtaW51dGVzJykuZm9ybWF0KCdZWVlZLU1NLUREIEhIOm1tOnNzJyk7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiBDb252ZXJ0IExvY2FsIFpvbmUgRGF0ZSB0byBVVEMgKi9cclxuICAgIHB1YmxpYyBzdGF0aWMgVG9VVEModXRjRGF0ZTogc3RyaW5nIHwgRGF0ZSB8IG1vbWVudC5Nb21lbnQpOiBzdHJpbmcge1xyXG4gICAgICAgIHJldHVybiBtb21lbnQodXRjRGF0ZSkuc3VidHJhY3QoRGF0ZVRpbWUuR2V0T2Zmc2V0KCksICdtaW51dGVzJykuZm9ybWF0KCdZWVlZLU1NLUREIEhIOm1tOnNzJyk7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiBERCBNTU0gWVlZWSAqL1xyXG4gICAgcHVibGljIHN0YXRpYyBHZXREYXRlRm9ybWF0KGRhdGU6IHN0cmluZyB8IERhdGUgfCBtb21lbnQuTW9tZW50KTogc3RyaW5nIHtcclxuICAgICAgICBpZiAoKHR5cGVvZiBkYXRlID09PSAnc3RyaW5nJykpIGRhdGUgPSBkYXRlLnJlcGxhY2VBbGwoJy8nLCAnLScpO1xyXG4gICAgICAgIHJldHVybiBtb21lbnQoZGF0ZSkucGFyc2Vab25lKCkubG9jYWwodHJ1ZSkuZm9ybWF0KCdERCBNTU0gWVlZWScpO1xyXG4gICAgfVxyXG59Il19
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import { Tools } from "../";
|
2
|
+
import * as XLSX from 'xlsx';
|
3
|
+
export class Files {
|
4
|
+
static { this.EXCEL_EXTENSIONS = ['xls', 'xlsx', 'csv']; }
|
5
|
+
/** Get Extension File */
|
6
|
+
static GetExtension(file) {
|
7
|
+
const fileName = file.name;
|
8
|
+
if (fileName.includes('.')) {
|
9
|
+
let worlds = fileName.split('.');
|
10
|
+
if (worlds.length > 0) {
|
11
|
+
let extension = worlds.pop();
|
12
|
+
extension = extension.trim().toLowerCase();
|
13
|
+
if (extension.length > 0)
|
14
|
+
return extension;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
/** Is Excel File */
|
20
|
+
static IsExcel(file) {
|
21
|
+
const EXTENSION = Files.GetExtension(file);
|
22
|
+
return Tools.IsNotNull(EXTENSION)
|
23
|
+
? this.EXCEL_EXTENSIONS.includes(EXTENSION)
|
24
|
+
: false;
|
25
|
+
}
|
26
|
+
/** Read excel file */
|
27
|
+
static ReadExcel(file) {
|
28
|
+
return new Promise(Resolve => {
|
29
|
+
let columns = [];
|
30
|
+
let rows = [];
|
31
|
+
const reader = new FileReader();
|
32
|
+
reader.readAsArrayBuffer(file);
|
33
|
+
reader.onload = () => {
|
34
|
+
const dataBytes = new Uint8Array(reader.result);
|
35
|
+
if (dataBytes) {
|
36
|
+
const workbook = XLSX.read(dataBytes, {});
|
37
|
+
const sheet = workbook.Sheets[workbook.SheetNames[0]];
|
38
|
+
let dataSheet = XLSX.utils.sheet_to_json(sheet, {
|
39
|
+
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']
|
40
|
+
});
|
41
|
+
//Get Headers
|
42
|
+
for (const column in dataSheet[0]) {
|
43
|
+
columns.push(Tools.FirstCharToLower(String(dataSheet[0][column]).replaceAll(' ', '')));
|
44
|
+
}
|
45
|
+
//Get Rows
|
46
|
+
rows = XLSX.utils.sheet_to_json(sheet, { header: columns });
|
47
|
+
rows.shift();
|
48
|
+
rows = rows.map(row => {
|
49
|
+
const item = Tools.BreakReference(row);
|
50
|
+
delete item['__rowNum__'];
|
51
|
+
return item;
|
52
|
+
});
|
53
|
+
}
|
54
|
+
Resolve({ columns, rows });
|
55
|
+
};
|
56
|
+
reader.onerror = () => { Resolve({ columns, rows }); };
|
57
|
+
});
|
58
|
+
}
|
59
|
+
/** Export to excel file */
|
60
|
+
static ExportExcel(data, fileName = 'coer_report', sheetName = 'Sheet1') {
|
61
|
+
sheetName = Tools.CleanUpBlanks(sheetName);
|
62
|
+
fileName = Tools.CleanUpBlanks(fileName);
|
63
|
+
if (fileName.endsWith('.xls') || fileName.endsWith('.xlsx') || fileName.endsWith('.csv')) {
|
64
|
+
if (fileName.includes('.xls')) {
|
65
|
+
fileName = fileName.replaceAll('.xls', '.xlsx');
|
66
|
+
}
|
67
|
+
if (fileName.includes('.csv')) {
|
68
|
+
fileName = fileName.replaceAll('.csv', '.xlsx');
|
69
|
+
}
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
fileName += '.xlsx';
|
73
|
+
}
|
74
|
+
const WORK_SHEET = XLSX.utils.json_to_sheet(data);
|
75
|
+
const WORK_BOOK = XLSX.utils.book_new();
|
76
|
+
XLSX.utils.book_append_sheet(WORK_BOOK, WORK_SHEET, sheetName);
|
77
|
+
XLSX.writeFile(WORK_BOOK, fileName);
|
78
|
+
}
|
79
|
+
/** Convert file to string base64 */
|
80
|
+
static ConvertToBase64(file) {
|
81
|
+
return new Promise(Resolve => {
|
82
|
+
const reader = new FileReader();
|
83
|
+
reader.readAsDataURL(file);
|
84
|
+
reader.onload = () => {
|
85
|
+
Resolve(reader.result?.toString() || '');
|
86
|
+
};
|
87
|
+
reader.onerror = () => Resolve('');
|
88
|
+
});
|
89
|
+
}
|
90
|
+
}
|
91
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZXMuY2xhc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb2VyLWVsZW1lbnRzL3NyYy90b29scy9saWIvZmlsZXMuY2xhc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssRUFBRSxNQUFNLEtBQUssQ0FBQztBQUM1QixPQUFPLEtBQUssSUFBSSxN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k6IHN0cmluZyB8IG51bGwge1xyXG4gICAgICAgIGNvbnN0IGZpbGVOYW1lID0gZmlsZS5uYW1lO1xyXG5cclxuICAgICAgICBpZiAoZmlsZU5hbWUuaW5jbHVkZXMoJy4nKSkge1xyXG4gICAgICAgICAgICBsZXQgd29ybGRzID0gZmlsZU5hbWUuc3BsaXQoJy4nKSBhcyBzdHJpbmdbXTtcclxuXHJcbiAgICAgICAgICAgIGlmICh3b3JsZHMubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgbGV0IGV4dGVuc2lvbiA9IHdvcmxkcy5wb3AoKSE7XHJcbiAgICAgICAgICAgICAgICBleHRlbnNpb24gPSBleHRlbnNpb24udHJpbSgpLnRvTG93ZXJDYXNlKCk7XHJcbiAgICAgICAgICAgICAgICBpZiAoZXh0ZW5zaW9uLmxlbmd0aCA+IDApIHJldHVybiBleHRlbnNpb247XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIHJldHVybiBudWxsO1xyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogSXMgRXhjZWwgRmlsZSAqL1xyXG4gICAgcHVibGljIHN0YXRpYyBJc0V4Y2VsKGZpbGU6IEZpbGUpOiBib29sZWFuIHtcclxuICAgICAgICBjb25zdCBFWFRFTlNJT04gPSBGaWxlcy5HZXRFeHRlbnNpb24oZmlsZSk7XHJcblxyXG4gICAgICAgIHJldHVybiBUb29scy5Jc05vdE51bGwoRVhURU5TSU9OKVxyXG4gICAgICAgICAgICA/IHRoaXMuRVhDRUxfRVhURU5TSU9OUy5pbmNsdWRlcyhFWFRFTlNJT04hKVxyXG4gICAgICAgICAgICA6IGZhbHNlO1xyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogUmVhZCBleGNlbCBmaWxlICovXHJcbiAgICBwdWJsaWMgc3RhdGljIFJlYWRFeGNlbDxUPihmaWxlOiBGaWxlKSB7XHJcbiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlPHsgY29sdW1uczogc3RyaW5nW107IHJvd3M6IFRbXTsgfT4oUmVzb2x2ZSA9PiB7XHJcbiAgICAgICAgICAgIGxldCBjb2x1bW5zOiBzdHJpbmdbXSA9IFtdO1xyXG4gICAgICAgICAgICBsZXQgcm93czogVFtdID0gW107XHJcblxyXG4gICAgICAgICAgICBjb25zdCByZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpO1xyXG4gICAgICAgICAgICByZWFkZXIucmVhZEFzQXJyYXlCdWZmZXIoZmlsZSk7XHJcblxyXG4gICAgICAgICAgICByZWFkZXIub25sb2FkID0gKCkgPT4ge1xyXG4gICAgICAgICAgICAgICAgY29uc3QgZGF0YUJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkocmVhZGVyLnJlc3VsdCBhcyBhbnkpO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmIChkYXRhQnl0ZXMpIHtcclxuICAgICAgICAgICAgICAgICAgICBjb25zdCB3b3JrYm9vayA9IFhMU1gucmVhZChkYXRhQnl0ZXMsIHt9KTtcclxuICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGVldCA9IHdvcmtib29rLlNoZWV0c1t3b3JrYm9vay5TaGVldE5hbWVzWzBdXTtcclxuICAgICAgICAgICAgICAgICAgICBsZXQgZGF0YVNoZWV0OiBhbnlbXSA9IFhMU1gudXRpbHMuc2hlZXRfdG9fanNvbihzaGVldCwge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXI6IFsnQScsICdCJywgJ0MnLCAnRCcsICdFJywgJ0YnLCAnRycsICdIJywgJ0knLCAnSicsICdLJywgJ0wnLCAnTScsICdOJywgJ08nLCAnUCcsICdRJywgJ1InLCAnUycsICdUJywgJ1UnLCAnVicsICdXJywgJ1gnLCAnWScsICdaJ11cclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgLy9HZXQgSGVhZGVyc1xyXG4gICAgICAgICAgICAgICAgICAgIGZvcihjb25zdCBjb2x1bW4gaW4gZGF0YVNoZWV0WzBdKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbnMucHVzaChUb29scy5GaXJzdENoYXJUb0xvd2VyKFN0cmluZyhkYXRhU2hlZXRbMF1bY29sdW1uXSkucmVwbGFjZUFsbCgnICcsICcnKSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgLy9HZXQgUm93c1xyXG4gICAgICAgICAgICAgICAgICAgIHJvd3MgPSBYTFNYLnV0aWxzLnNoZWV0X3RvX2pzb24oc2hlZXQsIHsgaGVhZGVyOiBjb2x1bW5zIH0pO1xyXG4gICAgICAgICAgICAgICAgICAgIHJvd3Muc2hpZnQoKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgcm93cyA9IHJvd3MubWFwKHJvdyA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGl0ZW0gPSBUb29scy5CcmVha1JlZmVyZW5jZTxhbnk+KHJvdyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBpdGVtWydfX3Jvd051bV9fJ107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpdGVtO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgIFJlc29sdmUoeyBjb2x1bW5zLCByb3dzIH0pO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICByZWFkZXIub25lcnJvciA9ICgpID0+IHsgUmVzb2x2ZSh7IGNvbHVtbnMsIHJvd3MgfSkgfVxyXG4gICAgICAgIH0pO1xyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogRXhwb3J0IHRvIGV4Y2VsIGZpbGUgKi9cclxuICAgIHB1YmxpYyBzdGF0aWMgRXhwb3J0RXhjZWw8VD4oZGF0YTogVFtdLCBmaWxlTmFtZTogc3RyaW5nID0gJ2NvZXJfcmVwb3J0Jywgc2hlZXROYW1lOiBzdHJpbmcgPSAnU2hlZXQxJykge1xyXG4gICAgICAgIHNoZWV0TmFtZSA9IFRvb2xzLkNsZWFuVXBCbGFua3Moc2hlZXROYW1lKTtcclxuICAgICAgICBmaWxlTmFtZSA9IFRvb2xzLkNsZWFuVXBCbGFua3MoZmlsZU5hbWUpO1xyXG5cclxuICAgICAgICBpZihmaWxlTmFtZS5lbmRzV2l0aCgnLnhscycpIHx8IGZpbGVOYW1lLmVuZHNXaXRoKCcueGxzeCcpIHx8IGZpbGVOYW1lLmVuZHNXaXRoKCcuY3N2JykpIHtcclxuICAgICAgICAgICAgaWYgKGZpbGVOYW1lLmluY2x1ZGVzKCcueGxzJykpIHtcclxuICAgICAgICAgICAgICAgIGZpbGVOYW1lID0gZmlsZU5hbWUucmVwbGFjZUFsbCgnLnhscycsICcueGxzeCcpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBpZiAoZmlsZU5hbWUuaW5jbHVkZXMoJy5jc3YnKSkge1xyXG4gICAgICAgICAgICAgICAgZmlsZU5hbWUgPSBmaWxlTmFtZS5yZXBsYWNlQWxsKCcuY3N2JywgJy54bHN4Jyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICBmaWxlTmFtZSArPSAnLnhsc3gnO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgY29uc3QgV09SS19TSEVFVCA9IFhMU1gudXRpbHMuanNvbl90b19zaGVldChkYXRhKTtcclxuICAgICAgICBjb25zdCBXT1JLX0JPT0sgPSBYTFNYLnV0aWxzLmJvb2tfbmV3KCk7XHJcbiAgICAgICAgWExTWC51dGlscy5ib29rX2FwcGVuZF9zaGVldChXT1JLX0JPT0ssIFdPUktfU0hFRVQsIHNoZWV0TmFtZSk7XHJcbiAgICAgICAgWExTWC53cml0ZUZpbGUoV09SS19CT09LLCBmaWxlTmFtZSk7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiBDb252ZXJ0IGZpbGUgdG8gc3RyaW5nIGJhc2U2NCAqL1xyXG4gICAgcHVibGljIHN0YXRpYyBDb252ZXJ0VG9CYXNlNjQoZmlsZTogRmlsZSkge1xyXG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZTxzdHJpbmc+KFJlc29sdmUgPT4ge1xyXG4gICAgICAgICAgICBjb25zdCByZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpO1xyXG4gICAgICAgICAgICByZWFkZXIucmVhZEFzRGF0YVVSTChmaWxlKTtcclxuXHJcbiAgICAgICAgICAgIHJlYWRlci5vbmxvYWQgPSAoKSA9PiB7XHJcbiAgICAgICAgICAgICAgICBSZXNvbHZlKHJlYWRlci5yZXN1bHQ/LnRvU3RyaW5nKCkgfHwgJycpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICByZWFkZXIub25lcnJvciA9ICgpID0+IFJlc29sdmUoJycpO1xyXG4gICAgICAgIH0pO1xyXG4gICAgfVxyXG59Il19
|
@@ -0,0 +1,199 @@
|
|
1
|
+
import { signal } from "@angular/core";
|
2
|
+
const reference_signal = signal({});
|
3
|
+
export const Tools = {
|
4
|
+
/** Generate a Guid */
|
5
|
+
GetGuid: (seed = 'coer-system') => {
|
6
|
+
let time = new Date().getTime();
|
7
|
+
seed = seed.toString().trim();
|
8
|
+
return seed + `-xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g, (c) => {
|
9
|
+
const random = (time + Math.random() * 16) % 16 | 0;
|
10
|
+
time = Math.floor(time / 16);
|
11
|
+
return (c == 'x' ? random : (random & 0x3 | 0x8)).toString(16);
|
12
|
+
});
|
13
|
+
},
|
14
|
+
/** Returns true if the value is null or undefined, false otherwise */
|
15
|
+
IsNull: (value) => {
|
16
|
+
if (value === undefined)
|
17
|
+
return true;
|
18
|
+
if (value === null)
|
19
|
+
return true;
|
20
|
+
return false;
|
21
|
+
},
|
22
|
+
/** Returns true if the value is not null or undefined, false otherwise */
|
23
|
+
IsNotNull: (value) => {
|
24
|
+
if (value === undefined)
|
25
|
+
return false;
|
26
|
+
if (value === null)
|
27
|
+
return false;
|
28
|
+
return true;
|
29
|
+
},
|
30
|
+
/** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
|
31
|
+
IsOnlyWhiteSpace: (value) => {
|
32
|
+
if (value === undefined)
|
33
|
+
return true;
|
34
|
+
if (value === null)
|
35
|
+
return true;
|
36
|
+
if (value.toString().trim() === '')
|
37
|
+
return true;
|
38
|
+
return false;
|
39
|
+
},
|
40
|
+
/** Break reference of a object or array */
|
41
|
+
BreakReference: (object) => {
|
42
|
+
if (object === undefined)
|
43
|
+
return undefined;
|
44
|
+
if (object === null)
|
45
|
+
return null;
|
46
|
+
const OBJECT = JSON.parse(JSON.stringify(object));
|
47
|
+
return (Array.isArray(OBJECT)) ? [...OBJECT] : { ...OBJECT };
|
48
|
+
},
|
49
|
+
/** Clean extra whitespaces */
|
50
|
+
CleanUpBlanks: (text) => {
|
51
|
+
if (Tools.IsNull(text))
|
52
|
+
return '';
|
53
|
+
let worlds = String(text).split(' ');
|
54
|
+
worlds = worlds.filter(x => x.length > 0);
|
55
|
+
return worlds.join(' ');
|
56
|
+
},
|
57
|
+
/** Get properties of an object */
|
58
|
+
GetObjectProperties: (obj) => {
|
59
|
+
const properties = [];
|
60
|
+
if (Tools.IsNull(obj))
|
61
|
+
return properties;
|
62
|
+
for (const property in obj)
|
63
|
+
properties.push(String(property));
|
64
|
+
return properties;
|
65
|
+
},
|
66
|
+
/**
|
67
|
+
* Set an index and merge more arrays of the same type
|
68
|
+
* */
|
69
|
+
SetIndex: (array, ...args) => {
|
70
|
+
let index = 0;
|
71
|
+
for (const arg of args) {
|
72
|
+
array = Tools.BreakReference(array).concat(Tools.BreakReference(arg));
|
73
|
+
}
|
74
|
+
return Tools.BreakReference(array).map(item => Object.assign({ index: index++ }, item));
|
75
|
+
},
|
76
|
+
/** Set First Char To Lower */
|
77
|
+
FirstCharToLower: (text) => {
|
78
|
+
if (Tools.IsNull(text))
|
79
|
+
return '';
|
80
|
+
const textArray = [];
|
81
|
+
for (let i = 0; i < text.length; i++) {
|
82
|
+
if (i === 0)
|
83
|
+
textArray.push(text[i].toLowerCase());
|
84
|
+
else
|
85
|
+
textArray.push(text[i]);
|
86
|
+
}
|
87
|
+
return textArray.join('');
|
88
|
+
},
|
89
|
+
/** Set First Char To Upper */
|
90
|
+
FirstCharToUpper: (text) => {
|
91
|
+
if (Tools.IsNull(text))
|
92
|
+
return '';
|
93
|
+
const textArray = [];
|
94
|
+
for (let i = 0; i < text.length; i++) {
|
95
|
+
if (i === 0)
|
96
|
+
textArray.push(text[i].toUpperCase());
|
97
|
+
else
|
98
|
+
textArray.push(text[i]);
|
99
|
+
}
|
100
|
+
return textArray.join('');
|
101
|
+
},
|
102
|
+
/** Sort an array in ascending order by property */
|
103
|
+
SortBy: (array, property, propertyType = 'string') => {
|
104
|
+
switch (propertyType) {
|
105
|
+
case 'string': {
|
106
|
+
return array.sort((x, y) => {
|
107
|
+
if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim())
|
108
|
+
return -1;
|
109
|
+
else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim())
|
110
|
+
return 1;
|
111
|
+
else
|
112
|
+
return 0;
|
113
|
+
});
|
114
|
+
}
|
115
|
+
case 'number': {
|
116
|
+
return array.sort((x, y) => Number(x[property] - Number(y[property])));
|
117
|
+
}
|
118
|
+
}
|
119
|
+
},
|
120
|
+
/** Sort an array in descending order by property */
|
121
|
+
SortByDesc: (array, property, propertyType = 'string') => {
|
122
|
+
switch (propertyType) {
|
123
|
+
case 'string': {
|
124
|
+
return array.sort((x, y) => {
|
125
|
+
if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim())
|
126
|
+
return 1;
|
127
|
+
else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim())
|
128
|
+
return -1;
|
129
|
+
else
|
130
|
+
return 0;
|
131
|
+
});
|
132
|
+
}
|
133
|
+
case 'number': {
|
134
|
+
return array.sort((x, y) => Number(Number(y[property])) - x[property]);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
},
|
138
|
+
/** Return a string with forman numeric */
|
139
|
+
GetNumericFormat: (value, decimals = 0) => {
|
140
|
+
if (value == undefined
|
141
|
+
|| value == null
|
142
|
+
|| value.toString().trim() == ''
|
143
|
+
|| isNaN(Number(value))) {
|
144
|
+
return '0';
|
145
|
+
}
|
146
|
+
let valueInteger = '';
|
147
|
+
let valueDecimal = '';
|
148
|
+
value = value.toString().replaceAll(' ', '');
|
149
|
+
if (value.includes('.') || (decimals > 0)) {
|
150
|
+
valueInteger = value.includes('.') ? value.split('.')[0] : value;
|
151
|
+
if (decimals > 0) {
|
152
|
+
const PADDING = decimals - valueDecimal.length;
|
153
|
+
valueDecimal = value.includes('.') ? value.split('.')[1] : '';
|
154
|
+
for (let i = 0; i < PADDING; i++)
|
155
|
+
valueDecimal += '0';
|
156
|
+
valueDecimal = valueDecimal.substring(0, decimals);
|
157
|
+
valueDecimal = `.${valueDecimal}`;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
else {
|
161
|
+
valueInteger = value;
|
162
|
+
}
|
163
|
+
let counter = 0;
|
164
|
+
const VALUE_INTEGER_ARRAY = [];
|
165
|
+
for (const char of valueInteger.split('').reverse()) {
|
166
|
+
if (counter == 3) {
|
167
|
+
VALUE_INTEGER_ARRAY.push(',');
|
168
|
+
counter = 0;
|
169
|
+
}
|
170
|
+
VALUE_INTEGER_ARRAY.push(char);
|
171
|
+
++counter;
|
172
|
+
}
|
173
|
+
valueInteger = VALUE_INTEGER_ARRAY.reverse().join('');
|
174
|
+
return `${valueInteger}${valueDecimal}`;
|
175
|
+
},
|
176
|
+
/** Wait the time indicated */
|
177
|
+
Sleep: (milliseconds = 0, reference = null) => {
|
178
|
+
if (Tools.IsNull(reference)) {
|
179
|
+
return new Promise(Resolve => setTimeout(Resolve, milliseconds));
|
180
|
+
}
|
181
|
+
else
|
182
|
+
return new Promise(Resolve => {
|
183
|
+
reference = reference.replaceAll(' ', '_').toLowerCase();
|
184
|
+
if (reference_signal().hasOwnProperty(reference)) {
|
185
|
+
clearInterval(reference_signal()[reference]);
|
186
|
+
}
|
187
|
+
reference_signal.set(Object.assign(reference_signal(), {
|
188
|
+
[reference]: setTimeout(() => {
|
189
|
+
Resolve();
|
190
|
+
clearInterval(reference_signal()[reference]);
|
191
|
+
const _reference = { ...reference_signal() };
|
192
|
+
delete _reference[reference];
|
193
|
+
reference_signal.set({ ..._reference });
|
194
|
+
}, milliseconds)
|
195
|
+
}));
|
196
|
+
});
|
197
|
+
}
|
198
|
+
};
|
199
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJpLXRvb2xzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY29lci1lbGVtZW50cy9zcmMvdG9vbHMvbGliL2dlbmVyaS10b29scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3ZDLE1BQU0sZ0JBQWdCLEdBQUcsTUFBTSxDQUFNLEVBQUUsQ0FBQyxDQUFDO0FBRXpDLE1BQU0sQ0FBQyxNQUFNLEtBQUssR0FBRztJQUNqQixzQkFBc0I7SUFDdEIsT0FBTyxFQUFFLENBQUMsT0FBZSxhQUFhLEVBQUUsRUFBRTtRQUN0QyxJQUFJLElBQUksR0FBRyxJQUFJLElBQUksRUFBRSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ2hDLElBQUksR0FBRyxJQUFJLENBQUMsUUFBUSxFQUFFLENBQUMsSUFBSSxFQUFFLENBQUE7UUFDN0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cnRCeTogPFQ+KGFycmF5OiBUW10sIHByb3BlcnR5OiBzdHJpbmcsIHByb3BlcnR5VHlwZTogJ3N0cmluZycgfCAnbnVtYmVyJyA9ICdzdHJpbmcnKTogVFtdID0+IHtcclxuICAgICAgICBzd2l0Y2ggKHByb3BlcnR5VHlwZSkge1xyXG4gICAgICAgICAgICBjYXNlICdzdHJpbmcnOiB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gYXJyYXkuc29ydCgoeDogYW55LCB5OiBhbnkpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoU3RyaW5nKHhbcHJvcGVydHldKS50b1VwcGVyQ2FzZSgpLnRyaW0oKSA8IFN0cmluZyh5W3Byb3BlcnR5XSkudG9VcHBlckNhc2UoKS50cmltKCkpIHJldHVybiAtMTtcclxuICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChTdHJpbmcoeFtwcm9wZXJ0eV0pLnRvVXBwZXJDYXNlKCkudHJpbSgpID4gU3RyaW5nKHlbcHJvcGVydHldKS50b1VwcGVyQ2FzZSgpLnRyaW0oKSkgcmV0dXJuIDE7XHJcbiAgICAgICAgICAgICAgICAgICAgZWxzZSByZXR1cm4gMDtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBjYXNlICdudW1iZXInOiB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gYXJyYXkuc29ydCgoeDogYW55LCB5OiBhbnkpID0+IE51bWJlcih4W3Byb3BlcnR5XSAtIE51bWJlcih5W3Byb3BlcnR5XSkpKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcblxyXG5cclxuICAgIC8qKiBTb3J0IGFuIGFycmF5IGluIGRlc2NlbmRpbmcgb3JkZXIgYnkgcHJvcGVydHkgKi9cclxuICAgIFNvcnRCeURlc2M6IDxUPihhcnJheTogVFtdLCBwcm9wZXJ0eTogc3RyaW5nLCBwcm9wZXJ0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hbHVlRGVjaW1hbH1gO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgdmFsdWVJbnRlZ2VyID0gdmFsdWU7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBsZXQgY291bnRlciA9IDA7XHJcbiAgICAgICAgY29uc3QgVkFMVUVfSU5URUdFUl9BUlJBWTogc3RyaW5nW10gPSBbXTtcclxuICAgICAgICBmb3IoY29uc3QgY2hhciBvZiB2YWx1ZUludGVnZXIuc3BsaXQoJycpLnJldmVyc2UoKSkge1xyXG4gICAgICAgICAgICBpZiAoY291bnRlciA9PSAzKSB7XHJcbiAgICAgICAgICAgICAgICBWQUxVRV9JTlRFR0VSX0FSUkFZLnB1c2goJywnKTtcclxuICAgICAgICAgICAgICAgIGNvdW50ZXIgPSAwO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICBWQUxVRV9JTlRFR0VSX0FSUkFZLnB1c2goY2hhcik7XHJcbiAgICAgICAgICAgICsrY291bnRlcjtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIHZhbHVlSW50ZWdlciA9IFZBTFVFX0lOVEVHRVJfQVJSQVkucmV2ZXJzZSgpLmpvaW4oJycpO1xyXG4gICAgICAgIHJldHVybiBgJHt2YWx1ZUludGVnZXJ9JHt2YWx1ZURlY2ltYWx9YDtcclxuICAgIH0sXHJcblxyXG5cclxuICAgIC8qKiBXYWl0IHRoZSB0aW1lIGluZGljYXRlZCAqL1xyXG4gICAgU2xlZXA6IChtaWxsaXNlY29uZHM6IG51bWJlciA9IDAsIHJlZmVyZW5jZTogc3RyaW5nIHwgbnVsbCA9IG51bGwpID0+IHtcclxuICAgICAgICBpZiAoVG9vbHMuSXNOdWxsKHJlZmVyZW5jZSkpIHtcclxuICAgICAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKFJlc29sdmUgPT4gc2V0VGltZW91dChSZXNvbHZlLCBtaWxsaXNlY29uZHMpKTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGVsc2UgcmV0dXJuIG5ldyBQcm9taXNlPHZvaWQ+KFJlc29sdmUgPT4ge1xyXG4gICAgICAgICAgICByZWZlcmVuY2UgPSByZWZlcmVuY2UhLnJlcGxhY2VBbGwoJyAnLCAnXycpLnRvTG93ZXJDYXNlKCk7XHJcblxyXG4gICAgICAgICAgICBpZiAocmVmZXJlbmNlX3NpZ25hbCgpLmhhc093blByb3BlcnR5KHJlZmVyZW5jZSkpIHtcclxuICAgICAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwocmVmZXJlbmNlX3NpZ25hbCgpW3JlZmVyZW5jZSFdKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgcmVmZXJlbmNlX3NpZ25hbC5zZXQoT2JqZWN0LmFzc2lnbihyZWZlcmVuY2Vfc2lnbmFsKCksIHtcclxuICAgICAgICAgICAgICAgIFtyZWZlcmVuY2UhXTogc2V0VGltZW91dCgoKSA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgUmVzb2x2ZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwocmVmZXJlbmNlX3NpZ25hbCgpW3JlZmVyZW5jZSFdKTtcclxuICAgICAgICAgICAgICAgICAgICBjb25zdCBfcmVmZXJlbmNlID0geyAuLi5yZWZlcmVuY2Vfc2lnbmFsKCkgfTtcclxuICAgICAgICAgICAgICAgICAgICBkZWxldGUgX3JlZmVyZW5jZVtyZWZlcmVuY2UhXTtcclxuICAgICAgICAgICAgICAgICAgICByZWZlcmVuY2Vfc2lnbmFsLnNldCh7IC4uLl9yZWZlcmVuY2UgfSk7XHJcbiAgICAgICAgICAgICAgICB9LCBtaWxsaXNlY29uZHMpXHJcbiAgICAgICAgICAgIH0pKTtcclxuICAgICAgICB9KTtcclxuICAgIH1cclxufTsiXX0=
|
@@ -0,0 +1,156 @@
|
|
1
|
+
import { Component, Inject, inject } from '@angular/core';
|
2
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
3
|
+
import { CoerAlert } from '../../components';
|
4
|
+
import { Breadcrumbs } from './breadcrumbs.class';
|
5
|
+
import { Source } from './source.class';
|
6
|
+
import { Tools } from './generi-tools';
|
7
|
+
import * as i0 from "@angular/core";
|
8
|
+
export class Page {
|
9
|
+
constructor(page) {
|
10
|
+
//Injection
|
11
|
+
this.alert = inject(CoerAlert);
|
12
|
+
this.router = inject(Router);
|
13
|
+
this.activatedRoute = inject(ActivatedRoute);
|
14
|
+
/** */
|
15
|
+
this.isUpdate = false;
|
16
|
+
/** */
|
17
|
+
this.isLoading = false;
|
18
|
+
/** */
|
19
|
+
this.isReadyPage = false;
|
20
|
+
/** */
|
21
|
+
this.enableAnimations = false;
|
22
|
+
/** */
|
23
|
+
this.breadcrumbs = [];
|
24
|
+
/** */
|
25
|
+
this.pageResponse = null;
|
26
|
+
/** */
|
27
|
+
this.goBack = { show: false };
|
28
|
+
//Private Variables
|
29
|
+
this._page = '';
|
30
|
+
this._source = null;
|
31
|
+
this._preventDestroy = false;
|
32
|
+
/** */
|
33
|
+
this.GoBack = (path) => (() => {
|
34
|
+
if (path)
|
35
|
+
Breadcrumbs.Remove(path);
|
36
|
+
else
|
37
|
+
Breadcrumbs.RemoveLast();
|
38
|
+
});
|
39
|
+
this.SetPageName(page);
|
40
|
+
this.SetSource();
|
41
|
+
this.GetSource();
|
42
|
+
this.GetNavigation();
|
43
|
+
this.SetGoBack();
|
44
|
+
this.GetPageResponse();
|
45
|
+
}
|
46
|
+
ngAfterViewInit() {
|
47
|
+
this.routeParams = this.activatedRoute.snapshot.params;
|
48
|
+
this.queryParams = this.activatedRoute.snapshot.queryParams;
|
49
|
+
setTimeout(() => {
|
50
|
+
this.isReadyPage = true;
|
51
|
+
this.RunPage();
|
52
|
+
setTimeout(() => { this.enableAnimations = true; }, 1000);
|
53
|
+
});
|
54
|
+
}
|
55
|
+
ngOnDestroy() {
|
56
|
+
if (!this._preventDestroy)
|
57
|
+
Source.ClearPageResponse();
|
58
|
+
}
|
59
|
+
/** Main method. Starts after ngAfterViewInit() */
|
60
|
+
RunPage() { }
|
61
|
+
;
|
62
|
+
/** Rename the last breadcrumb and update the url id */
|
63
|
+
SetPageName(name, id = null) {
|
64
|
+
this._page = name;
|
65
|
+
let path = this.router.url;
|
66
|
+
if (path.includes('?'))
|
67
|
+
path = path.split('?')[0];
|
68
|
+
if (id) {
|
69
|
+
const PATH_ARRAY = path.split('/');
|
70
|
+
const PATH_ID = Tools.BreakReference(PATH_ARRAY).pop();
|
71
|
+
if (PATH_ID) {
|
72
|
+
PATH_ARRAY[PATH_ARRAY.length - 1] = String(id);
|
73
|
+
path = PATH_ARRAY.join('/');
|
74
|
+
}
|
75
|
+
}
|
76
|
+
if (this.breadcrumbs.length > 0) {
|
77
|
+
this.breadcrumbs[this.breadcrumbs.length - 1].page = name;
|
78
|
+
this.breadcrumbs[this.breadcrumbs.length - 1].path = path;
|
79
|
+
Breadcrumbs.SetLast(name, path);
|
80
|
+
}
|
81
|
+
this.router.navigateByUrl(path);
|
82
|
+
}
|
83
|
+
/** */
|
84
|
+
SetSource() {
|
85
|
+
Source.Set(this._page);
|
86
|
+
}
|
87
|
+
/** */
|
88
|
+
GetSource() {
|
89
|
+
this._source = Source.Get();
|
90
|
+
}
|
91
|
+
/** */
|
92
|
+
GetPageResponse() {
|
93
|
+
this.pageResponse = Source.GetPageResponse();
|
94
|
+
}
|
95
|
+
/** */
|
96
|
+
GetNavigation() {
|
97
|
+
if (this._source) {
|
98
|
+
this.breadcrumbs = Breadcrumbs.Get().map(item => Object.assign({
|
99
|
+
page: item.page,
|
100
|
+
path: item.path,
|
101
|
+
click: this.GoBack(item.path)
|
102
|
+
}));
|
103
|
+
}
|
104
|
+
else
|
105
|
+
this.breadcrumbs = [{ page: this._page }];
|
106
|
+
}
|
107
|
+
/** */
|
108
|
+
SetGoBack() {
|
109
|
+
if (this._source) {
|
110
|
+
this.goBack = {
|
111
|
+
show: true,
|
112
|
+
path: this._source.path,
|
113
|
+
click: this.GoBack()
|
114
|
+
};
|
115
|
+
}
|
116
|
+
}
|
117
|
+
/** Navigate to previous page */
|
118
|
+
GoToSource(pageResponse = null) {
|
119
|
+
if (this._source) {
|
120
|
+
Breadcrumbs.RemoveLast();
|
121
|
+
this.SetPageResponse(pageResponse);
|
122
|
+
Tools.Sleep().then(_ => this.router.navigateByUrl(this._source.path));
|
123
|
+
}
|
124
|
+
}
|
125
|
+
;
|
126
|
+
/** */
|
127
|
+
SetPageResponse(pageResponse = null) {
|
128
|
+
if (Tools.IsNotNull(pageResponse)) {
|
129
|
+
this._preventDestroy = true;
|
130
|
+
Source.SetPageResponse(pageResponse);
|
131
|
+
}
|
132
|
+
}
|
133
|
+
;
|
134
|
+
/** */
|
135
|
+
ReloadPage() {
|
136
|
+
Breadcrumbs.RemoveLast();
|
137
|
+
setTimeout(() => window.location.reload());
|
138
|
+
}
|
139
|
+
/** */
|
140
|
+
Log(value, log = null) {
|
141
|
+
if (Tools.IsNotNull(log))
|
142
|
+
console.log({ log, value });
|
143
|
+
else
|
144
|
+
console.log(value);
|
145
|
+
}
|
146
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Page, deps: [{ token: String }], target: i0.ɵɵFactoryTarget.Component }); }
|
147
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: Page, selector: "ng-component", ngImport: i0, template: '', isInline: true }); }
|
148
|
+
}
|
149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Page, decorators: [{
|
150
|
+
type: Component,
|
151
|
+
args: [{ template: '' }]
|
152
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
153
|
+
type: Inject,
|
154
|
+
args: [String]
|
155
|
+
}] }] });
|
156
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2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xuICAgIC8qKiAqL1xyXG4gICAgcHJvdGVjdGVkIEdldFBhZ2VSZXNwb25zZSgpOiB2b2lkIHtcclxuICAgICAgICB0aGlzLnBhZ2VSZXNwb25zZSA9IFNvdXJjZS5HZXRQYWdlUmVzcG9uc2UoKTtcclxuICAgIH1cclxuXHJcblxyXG4gICAgLyoqICovXHJcbiAgICBwcml2YXRlIEdldE5hdmlnYXRpb24oKTogdm9pZCB7XHJcbiAgICAgICAgaWYgKHRoaXMuX3NvdXJjZSkge1xyXG4gICAgICAgICAgICB0aGlzLmJyZWFkY3J1bWJzID0gQnJlYWRjcnVtYnMuR2V0KCkubWFwKGl0ZW0gPT4gT2JqZWN0LmFzc2lnbih7XHJcbiAgICAgICAgICAgICAgICBwYWdlOiBpdGVtLnBhZ2UsXHJcbiAgICAgICAgICAgICAgICBwYXRoOiBpdGVtLnBhdGgsXHJcbiAgICAgICAgICAgICAgICBjbGljazogdGhpcy5Hb0JhY2soaXRlbS5wYXRoKVxyXG4gICAgICAgICAgICB9KSk7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBlbHNlIHRoaXMuYnJlYWRjcnVtYnMgPSBbeyBwYWdlOiB0aGlzLl9wYWdlIH1dO1xyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogKi9cclxuICAgIHByaXZhdGUgU2V0R29CYWNrKCk6IHZvaWQge1xyXG4gICAgICAgIGlmICh0aGlzLl9zb3VyY2UpIHtcclxuICAgICAgICAgICAgdGhpcy5nb0JhY2sgPSB7XHJcbiAgICAgICAgICAgICAgICBzaG93OiB0cnVlLFxyXG4gICAgICAgICAgICAgICAgcGF0aDogdGhpcy5fc291cmNlLnBhdGgsXHJcbiAgICAgICAgICAgICAgICBjbGljazogdGhpcy5Hb0JhY2soKVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuXHJcblxyXG4gICAgLyoqICovXHJcbiAgICBwcml2YXRlIEdvQmFjayA9IChwYXRoPzogc3RyaW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