coer-elements 1.0.15 → 1.0.16
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +5 -2
- 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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "coer-elements",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.16",
|
4
4
|
"author": "Christian Omar Escamilla Rodríguez",
|
5
5
|
"keywords": [
|
6
6
|
"coer",
|
@@ -23,7 +23,9 @@
|
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
25
|
"@angular/animations": "^17.3.0",
|
26
|
+
"@angular/cdk": "^17.3.0",
|
26
27
|
"@angular/common": "^17.3.0",
|
28
|
+
"@angular/compiler": "^17.3.0",
|
27
29
|
"@angular/core": "^17.3.0",
|
28
30
|
"@angular/forms": "^17.3.0",
|
29
31
|
"@angular/platform-browser": "^17.3.0",
|
@@ -37,7 +39,8 @@
|
|
37
39
|
"moment": "^2.30.1",
|
38
40
|
"rxjs": "^7.8.1",
|
39
41
|
"sweetalert2": "^11.13.3",
|
40
|
-
"xlsx": "^0.18.5"
|
42
|
+
"xlsx": "^0.18.5",
|
43
|
+
"zone.js": "^0.14.3"
|
41
44
|
},
|
42
45
|
"devDependencies": {
|
43
46
|
"@types/bootstrap": "^5.2.10",
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import { Tools } from './Tools';
|
2
|
-
var Breadcrumbs = /** @class */ (function () {
|
3
|
-
function Breadcrumbs() {
|
4
|
-
}
|
5
|
-
/** */
|
6
|
-
Breadcrumbs.Add = function (page, path) {
|
7
|
-
var breadcrumbs = this.Get();
|
8
|
-
var paths = breadcrumbs.map(function (item) { return item.path; });
|
9
|
-
if (!paths.includes(path)) {
|
10
|
-
breadcrumbs.push({ page: page, path: path });
|
11
|
-
this.Save(breadcrumbs);
|
12
|
-
}
|
13
|
-
};
|
14
|
-
/** */
|
15
|
-
Breadcrumbs.Get = function () {
|
16
|
-
var storage = sessionStorage.getItem(this.storage);
|
17
|
-
if (storage) {
|
18
|
-
storage = JSON.parse(storage);
|
19
|
-
if (storage.hasOwnProperty('breadcrumbs')) {
|
20
|
-
return Tools.BreakReference(storage.breadcrumbs);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
return [];
|
24
|
-
};
|
25
|
-
/** Source */
|
26
|
-
Breadcrumbs.GetFirst = function () {
|
27
|
-
var breadcrumbs = this.Get();
|
28
|
-
return (breadcrumbs.length > 0) ? breadcrumbs.shift() : null;
|
29
|
-
};
|
30
|
-
/** */
|
31
|
-
Breadcrumbs.Save = function (breadcrumbs) {
|
32
|
-
var storage = sessionStorage.getItem(this.storage);
|
33
|
-
if (storage)
|
34
|
-
storage = JSON.parse(storage);
|
35
|
-
storage = Object.assign({}, storage, { breadcrumbs: breadcrumbs });
|
36
|
-
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
37
|
-
};
|
38
|
-
/** */
|
39
|
-
Breadcrumbs.Remove = function (path) {
|
40
|
-
var breadcrumbs = this.Get();
|
41
|
-
var index = breadcrumbs.findIndex(function (x) { return x.path.toLowerCase().trim() === path.toLowerCase().trim(); });
|
42
|
-
if (index >= 0) {
|
43
|
-
breadcrumbs = Tools.BreakReference(breadcrumbs).splice(0, index + 1);
|
44
|
-
this.Save(breadcrumbs);
|
45
|
-
}
|
46
|
-
};
|
47
|
-
/** */
|
48
|
-
Breadcrumbs.SetLast = function (page, path) {
|
49
|
-
var breadcrumbs = this.Get();
|
50
|
-
if (breadcrumbs.length > 0) {
|
51
|
-
breadcrumbs[breadcrumbs.length - 1] = { page: page, path: path };
|
52
|
-
this.Save(breadcrumbs);
|
53
|
-
}
|
54
|
-
};
|
55
|
-
/** */
|
56
|
-
Breadcrumbs.RemoveLast = function () {
|
57
|
-
var breadcrumbs = this.Get();
|
58
|
-
if (breadcrumbs.length > 0) {
|
59
|
-
breadcrumbs.pop();
|
60
|
-
this.Save(breadcrumbs);
|
61
|
-
}
|
62
|
-
};
|
63
|
-
Breadcrumbs.storage = 'COER-System';
|
64
|
-
return Breadcrumbs;
|
65
|
-
}());
|
66
|
-
export { Breadcrumbs };
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
2
|
-
import { forwardRef } from "@angular/core";
|
3
|
-
export var CONTROL_VALUE = function (component) {
|
4
|
-
return {
|
5
|
-
provide: NG_VALUE_ACCESSOR,
|
6
|
-
useExisting: forwardRef(function () { return component; }),
|
7
|
-
multi: true
|
8
|
-
};
|
9
|
-
};
|
10
|
-
var ControlValue = /** @class */ (function () {
|
11
|
-
function ControlValue() {
|
12
|
-
this._isTouched = false;
|
13
|
-
}
|
14
|
-
Object.defineProperty(ControlValue.prototype, "isTouched", {
|
15
|
-
get: function () {
|
16
|
-
return this._isTouched;
|
17
|
-
},
|
18
|
-
enumerable: false,
|
19
|
-
configurable: true
|
20
|
-
});
|
21
|
-
/** */
|
22
|
-
ControlValue.prototype.SetValue = function (value) {
|
23
|
-
if (typeof this._UpdateValue === 'function') {
|
24
|
-
this._UpdateValue(value);
|
25
|
-
}
|
26
|
-
this._value = value;
|
27
|
-
};
|
28
|
-
/** */
|
29
|
-
ControlValue.prototype.SetTouched = function (isTouched) {
|
30
|
-
if (typeof this._IsTouched === 'function') {
|
31
|
-
this._IsTouched(isTouched);
|
32
|
-
}
|
33
|
-
this._isTouched = isTouched;
|
34
|
-
};
|
35
|
-
/** */
|
36
|
-
ControlValue.prototype.writeValue = function (value) {
|
37
|
-
this._value = value;
|
38
|
-
};
|
39
|
-
/** */
|
40
|
-
ControlValue.prototype.registerOnChange = function (callback) {
|
41
|
-
this._UpdateValue = callback;
|
42
|
-
};
|
43
|
-
/** */
|
44
|
-
ControlValue.prototype.registerOnTouched = function (callback) {
|
45
|
-
this._IsTouched = callback;
|
46
|
-
};
|
47
|
-
return ControlValue;
|
48
|
-
}());
|
49
|
-
export { ControlValue };
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import moment from "moment";
|
2
|
-
var DateTime = /** @class */ (function () {
|
3
|
-
function DateTime() {
|
4
|
-
}
|
5
|
-
/** Get UTC Offset */
|
6
|
-
DateTime.GetUTCOffset = function () {
|
7
|
-
return moment().utcOffset();
|
8
|
-
};
|
9
|
-
/** Convert UTC Date to Local Zone */
|
10
|
-
DateTime.ToLocalZone = function (utcDate) {
|
11
|
-
return moment(utcDate).add(DateTime.GetUTCOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
|
12
|
-
};
|
13
|
-
/** Convert Local Zone Date to UTC */
|
14
|
-
DateTime.ToUTC = function (utcDate) {
|
15
|
-
return moment(utcDate).subtract(DateTime.GetUTCOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
|
16
|
-
};
|
17
|
-
/** DD MMM YYYY */
|
18
|
-
DateTime.GetDateFormat = function (date) {
|
19
|
-
if ((typeof date === 'string'))
|
20
|
-
date = date.replaceAll('/', '-');
|
21
|
-
return moment(date).parseZone().local(true).format('DD MMM YYYY');
|
22
|
-
};
|
23
|
-
return DateTime;
|
24
|
-
}());
|
25
|
-
export { DateTime };
|
@@ -1,99 +0,0 @@
|
|
1
|
-
import { Tools } from "./Tools";
|
2
|
-
import * as XLSX from 'xlsx';
|
3
|
-
var Files = /** @class */ (function () {
|
4
|
-
function Files() {
|
5
|
-
}
|
6
|
-
/** Get Extension File */
|
7
|
-
Files.GetExtension = function (file) {
|
8
|
-
var fileName = file.name;
|
9
|
-
if (fileName.includes('.')) {
|
10
|
-
var worlds = fileName.split('.');
|
11
|
-
if (worlds.length > 0) {
|
12
|
-
var extension = worlds.pop();
|
13
|
-
extension = extension.trim().toLowerCase();
|
14
|
-
if (extension.length > 0)
|
15
|
-
return extension;
|
16
|
-
}
|
17
|
-
}
|
18
|
-
return null;
|
19
|
-
};
|
20
|
-
/** Is Excel File */
|
21
|
-
Files.IsExcel = function (file) {
|
22
|
-
var EXTENSION = Files.GetExtension(file);
|
23
|
-
return Tools.IsNotNull(EXTENSION)
|
24
|
-
? this.EXCEL_EXTENSIONS.includes(EXTENSION)
|
25
|
-
: false;
|
26
|
-
};
|
27
|
-
/** Read excel file */
|
28
|
-
Files.ReadExcel = function (file) {
|
29
|
-
return new Promise(function (Resolve) {
|
30
|
-
var columns = [];
|
31
|
-
var rows = [];
|
32
|
-
var reader = new FileReader();
|
33
|
-
reader.readAsArrayBuffer(file);
|
34
|
-
reader.onload = function () {
|
35
|
-
var dataBytes = new Uint8Array(reader.result);
|
36
|
-
if (dataBytes) {
|
37
|
-
var workbook = XLSX.read(dataBytes, {});
|
38
|
-
var sheet = workbook.Sheets[workbook.SheetNames[0]];
|
39
|
-
var dataSheet = XLSX.utils.sheet_to_json(sheet, {
|
40
|
-
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']
|
41
|
-
});
|
42
|
-
//Get Headers
|
43
|
-
for (var column in dataSheet[0]) {
|
44
|
-
columns.push(Tools.FirstCharToLower(String(dataSheet[0][column]).replaceAll(' ', '')));
|
45
|
-
}
|
46
|
-
//Get Rows
|
47
|
-
rows = XLSX.utils.sheet_to_json(sheet, { header: columns });
|
48
|
-
rows.shift();
|
49
|
-
rows = rows.map(function (row) {
|
50
|
-
var item = Tools.BreakReference(row);
|
51
|
-
delete item['__rowNum__'];
|
52
|
-
return item;
|
53
|
-
});
|
54
|
-
}
|
55
|
-
Resolve({ columns: columns, rows: rows });
|
56
|
-
};
|
57
|
-
reader.onerror = function () { Resolve({ columns: columns, rows: rows }); };
|
58
|
-
});
|
59
|
-
};
|
60
|
-
/** Export to excel file */
|
61
|
-
Files.ExportExcel = function (data, fileName, sheetName) {
|
62
|
-
if (fileName === void 0) { fileName = 'coer_report'; }
|
63
|
-
if (sheetName === void 0) { sheetName = 'Sheet1'; }
|
64
|
-
sheetName = Tools.CleanUpBlanks(sheetName);
|
65
|
-
fileName = Tools.CleanUpBlanks(fileName);
|
66
|
-
if (fileName.endsWith('.xls') || fileName.endsWith('.xlsx') || fileName.endsWith('.csv')) {
|
67
|
-
if (fileName.includes('.xls')) {
|
68
|
-
fileName = fileName.replaceAll('.xls', '.xlsx');
|
69
|
-
}
|
70
|
-
if (fileName.includes('.csv')) {
|
71
|
-
fileName = fileName.replaceAll('.csv', '.xlsx');
|
72
|
-
}
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
fileName += '.xlsx';
|
76
|
-
}
|
77
|
-
var WORK_SHEET = XLSX.utils.json_to_sheet(data);
|
78
|
-
var WORK_BOOK = XLSX.utils.book_new();
|
79
|
-
XLSX.utils.book_append_sheet(WORK_BOOK, WORK_SHEET, 'Sheet1');
|
80
|
-
XLSX.writeFile(WORK_BOOK, fileName);
|
81
|
-
};
|
82
|
-
/** Convert file to string base64 */
|
83
|
-
Files.ConvertToBase64 = function (file) {
|
84
|
-
return new Promise(function (Resolve) {
|
85
|
-
var reader = new FileReader();
|
86
|
-
reader.readAsDataURL(file);
|
87
|
-
reader.onload = function () {
|
88
|
-
var _a;
|
89
|
-
Resolve(((_a = reader.result) === null || _a === void 0 ? void 0 : _a.toString()) || '');
|
90
|
-
};
|
91
|
-
reader.onerror = function () {
|
92
|
-
Resolve('');
|
93
|
-
};
|
94
|
-
});
|
95
|
-
};
|
96
|
-
Files.EXCEL_EXTENSIONS = ['xls', 'xlsx', 'csv'];
|
97
|
-
return Files;
|
98
|
-
}());
|
99
|
-
export { Files };
|
@@ -1,213 +0,0 @@
|
|
1
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
2
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
3
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
4
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
5
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
6
|
-
var _, done = false;
|
7
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
8
|
-
var context = {};
|
9
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
10
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
11
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
12
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
13
|
-
if (kind === "accessor") {
|
14
|
-
if (result === void 0) continue;
|
15
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
16
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
17
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
18
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
19
|
-
}
|
20
|
-
else if (_ = accept(result)) {
|
21
|
-
if (kind === "field") initializers.unshift(_);
|
22
|
-
else descriptor[key] = _;
|
23
|
-
}
|
24
|
-
}
|
25
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
26
|
-
done = true;
|
27
|
-
};
|
28
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
29
|
-
var useValue = arguments.length > 2;
|
30
|
-
for (var i = 0; i < initializers.length; i++) {
|
31
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
32
|
-
}
|
33
|
-
return useValue ? value : void 0;
|
34
|
-
};
|
35
|
-
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
36
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
37
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
38
|
-
};
|
39
|
-
import { Component, inject } from '@angular/core';
|
40
|
-
import { Breadcrumbs } from "./Breadcrumbs.class";
|
41
|
-
import { Source } from './Source.class';
|
42
|
-
import { CoerAlert } from '../components/coer-alert/coer-alert.component';
|
43
|
-
import { ActivatedRoute, Router } from '@angular/router';
|
44
|
-
import { Tools } from './Tools';
|
45
|
-
var Page = function () {
|
46
|
-
var _classDecorators = [Component({ template: '' })];
|
47
|
-
var _classDescriptor;
|
48
|
-
var _classExtraInitializers = [];
|
49
|
-
var _classThis;
|
50
|
-
var Page = _classThis = /** @class */ (function () {
|
51
|
-
function Page_1(page) {
|
52
|
-
//Injection
|
53
|
-
this.alert = inject(CoerAlert);
|
54
|
-
this.router = inject(Router);
|
55
|
-
this.activatedRoute = inject(ActivatedRoute);
|
56
|
-
/** */
|
57
|
-
this.isUpdate = false;
|
58
|
-
/** */
|
59
|
-
this.isLoading = false;
|
60
|
-
/** */
|
61
|
-
this.isReady = false;
|
62
|
-
/** */
|
63
|
-
this.enableAnimations = false;
|
64
|
-
/** */
|
65
|
-
this.breadcrumbs = [];
|
66
|
-
/** */
|
67
|
-
this.pageResponse = null;
|
68
|
-
/** */
|
69
|
-
this.goBack = { show: false };
|
70
|
-
//Private Variables
|
71
|
-
this._page = '';
|
72
|
-
this._source = null;
|
73
|
-
this._preventDestroy = false;
|
74
|
-
/** */
|
75
|
-
this.GoBack = function (path) { return (function () {
|
76
|
-
if (path)
|
77
|
-
Breadcrumbs.Remove(path);
|
78
|
-
else
|
79
|
-
Breadcrumbs.RemoveLast();
|
80
|
-
}); };
|
81
|
-
/** Returns true if the value is null or undefined, false otherwise */
|
82
|
-
this.IsNotNull = Tools.IsNotNull;
|
83
|
-
/** Returns true if the value is null or undefined, false otherwise */
|
84
|
-
this.IsNull = Tools.IsNull;
|
85
|
-
/** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
|
86
|
-
this.IsOnlyWhiteSpace = Tools.IsOnlyWhiteSpace;
|
87
|
-
this.SetPageName(page);
|
88
|
-
this.SetSource();
|
89
|
-
this.GetSource();
|
90
|
-
this.GetNavigation();
|
91
|
-
this.SetGoBack();
|
92
|
-
this.GetPageResponse();
|
93
|
-
}
|
94
|
-
Page_1.prototype.ngAfterViewInit = function () {
|
95
|
-
var _this = this;
|
96
|
-
this.routeParams = this.activatedRoute.snapshot.params;
|
97
|
-
this.queryParams = this.activatedRoute.snapshot.queryParams;
|
98
|
-
setTimeout(function () {
|
99
|
-
_this.isReady = true;
|
100
|
-
_this.RunPage();
|
101
|
-
setTimeout(function () { _this.enableAnimations = true; }, 1000);
|
102
|
-
});
|
103
|
-
};
|
104
|
-
Page_1.prototype.ngOnDestroy = function () {
|
105
|
-
if (!this._preventDestroy)
|
106
|
-
Source.ClearPageResponse();
|
107
|
-
};
|
108
|
-
/** Main method. Starts after ngAfterViewInit() */
|
109
|
-
Page_1.prototype.RunPage = function () { };
|
110
|
-
;
|
111
|
-
/** Rename the last breadcrumb and update the url id */
|
112
|
-
Page_1.prototype.SetPageName = function (name, id) {
|
113
|
-
if (id === void 0) { id = null; }
|
114
|
-
this._page = name;
|
115
|
-
var path = this.router.url;
|
116
|
-
if (path.includes('?'))
|
117
|
-
path = path.split('?')[0];
|
118
|
-
if (id) {
|
119
|
-
var PATH_ARRAY = path.split('/');
|
120
|
-
var PATH_ID = Tools.BreakReference(PATH_ARRAY).pop();
|
121
|
-
if (PATH_ID) {
|
122
|
-
PATH_ARRAY[PATH_ARRAY.length - 1] = String(id);
|
123
|
-
path = PATH_ARRAY.join('/');
|
124
|
-
}
|
125
|
-
}
|
126
|
-
if (this.breadcrumbs.length > 0) {
|
127
|
-
this.breadcrumbs[this.breadcrumbs.length - 1].page = name;
|
128
|
-
this.breadcrumbs[this.breadcrumbs.length - 1].path = path;
|
129
|
-
Breadcrumbs.SetLast(name, path);
|
130
|
-
}
|
131
|
-
this.router.navigateByUrl(path);
|
132
|
-
};
|
133
|
-
/** */
|
134
|
-
Page_1.prototype.SetSource = function () {
|
135
|
-
Source.Set(this._page);
|
136
|
-
};
|
137
|
-
/** */
|
138
|
-
Page_1.prototype.GetSource = function () {
|
139
|
-
this._source = Source.Get();
|
140
|
-
};
|
141
|
-
/** */
|
142
|
-
Page_1.prototype.GetPageResponse = function () {
|
143
|
-
this.pageResponse = Source.GetPageResponse();
|
144
|
-
};
|
145
|
-
/** */
|
146
|
-
Page_1.prototype.GetNavigation = function () {
|
147
|
-
var _this = this;
|
148
|
-
if (this._source) {
|
149
|
-
this.breadcrumbs = Breadcrumbs.Get().map(function (item) { return Object.assign({
|
150
|
-
page: item.page,
|
151
|
-
path: item.path,
|
152
|
-
click: _this.GoBack(item.path)
|
153
|
-
}); });
|
154
|
-
}
|
155
|
-
else
|
156
|
-
this.breadcrumbs = [{ page: this._page }];
|
157
|
-
};
|
158
|
-
/** */
|
159
|
-
Page_1.prototype.SetGoBack = function () {
|
160
|
-
if (this._source) {
|
161
|
-
this.goBack = {
|
162
|
-
show: true,
|
163
|
-
path: this._source.path,
|
164
|
-
click: this.GoBack()
|
165
|
-
};
|
166
|
-
}
|
167
|
-
};
|
168
|
-
/** Navigate to previous page */
|
169
|
-
Page_1.prototype.GoToSource = function (pageResponse) {
|
170
|
-
var _this = this;
|
171
|
-
if (pageResponse === void 0) { pageResponse = null; }
|
172
|
-
if (this._source) {
|
173
|
-
Breadcrumbs.RemoveLast();
|
174
|
-
this.SetPageResponse(pageResponse);
|
175
|
-
Tools.Sleep().then(function (_) { return _this.router.navigateByUrl(_this._source.path); });
|
176
|
-
}
|
177
|
-
};
|
178
|
-
;
|
179
|
-
/** */
|
180
|
-
Page_1.prototype.SetPageResponse = function (pageResponse) {
|
181
|
-
if (pageResponse === void 0) { pageResponse = null; }
|
182
|
-
if (Tools.IsNotNull(pageResponse)) {
|
183
|
-
this._preventDestroy = true;
|
184
|
-
Source.SetPageResponse(pageResponse);
|
185
|
-
}
|
186
|
-
};
|
187
|
-
;
|
188
|
-
/** */
|
189
|
-
Page_1.prototype.ReloadPage = function () {
|
190
|
-
Breadcrumbs.RemoveLast();
|
191
|
-
Tools.Sleep().then(function (_) { return window.location.reload(); });
|
192
|
-
};
|
193
|
-
/** */
|
194
|
-
Page_1.prototype.Log = function (value, log) {
|
195
|
-
if (log === void 0) { log = null; }
|
196
|
-
if (Tools.IsNotNull(log))
|
197
|
-
console.log({ log: log, value: value });
|
198
|
-
else
|
199
|
-
console.log(value);
|
200
|
-
};
|
201
|
-
return Page_1;
|
202
|
-
}());
|
203
|
-
__setFunctionName(_classThis, "Page");
|
204
|
-
(function () {
|
205
|
-
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
206
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
207
|
-
Page = _classThis = _classDescriptor.value;
|
208
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
209
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
210
|
-
})();
|
211
|
-
return Page = _classThis;
|
212
|
-
}();
|
213
|
-
export { Page };
|
@@ -1,68 +0,0 @@
|
|
1
|
-
import { Observable } from "rxjs";
|
2
|
-
var Screen = /** @class */ (function () {
|
3
|
-
function Screen() {
|
4
|
-
}
|
5
|
-
Object.defineProperty(Screen, "WINDOW_WIDTH", {
|
6
|
-
get: function () {
|
7
|
-
return window.innerWidth;
|
8
|
-
},
|
9
|
-
enumerable: false,
|
10
|
-
configurable: true
|
11
|
-
});
|
12
|
-
Object.defineProperty(Screen, "WINDOW_HEIGHT", {
|
13
|
-
get: function () {
|
14
|
-
return window.innerHeight;
|
15
|
-
},
|
16
|
-
enumerable: false,
|
17
|
-
configurable: true
|
18
|
-
});
|
19
|
-
Object.defineProperty(Screen, "DEVICE_WIDTH", {
|
20
|
-
get: function () {
|
21
|
-
return window.screen.width;
|
22
|
-
},
|
23
|
-
enumerable: false,
|
24
|
-
configurable: true
|
25
|
-
});
|
26
|
-
Object.defineProperty(Screen, "DEVICE_HEIGHT", {
|
27
|
-
get: function () {
|
28
|
-
return window.screen.height;
|
29
|
-
},
|
30
|
-
enumerable: false,
|
31
|
-
configurable: true
|
32
|
-
});
|
33
|
-
Object.defineProperty(Screen, "BREAKPOINT", {
|
34
|
-
get: function () {
|
35
|
-
if (window.innerWidth < 576)
|
36
|
-
return 'xs';
|
37
|
-
else if (window.innerWidth >= 576 && window.innerWidth < 768)
|
38
|
-
return 'sm';
|
39
|
-
else if (window.innerWidth >= 768 && window.innerWidth < 992)
|
40
|
-
return 'md';
|
41
|
-
else if (window.innerWidth >= 992 && window.innerWidth < 1200)
|
42
|
-
return 'lg';
|
43
|
-
else if (window.innerWidth >= 1200 && window.innerWidth < 1400)
|
44
|
-
return 'xl';
|
45
|
-
else
|
46
|
-
return 'xxl';
|
47
|
-
},
|
48
|
-
enumerable: false,
|
49
|
-
configurable: true
|
50
|
-
});
|
51
|
-
var _a;
|
52
|
-
_a = Screen;
|
53
|
-
/** */
|
54
|
-
Screen.Resize = new Observable(function (subscriber) {
|
55
|
-
window.addEventListener("load", function () {
|
56
|
-
window.dispatchEvent(new Event('resize'));
|
57
|
-
});
|
58
|
-
window.onresize = function () {
|
59
|
-
subscriber.next({
|
60
|
-
width: window.innerWidth,
|
61
|
-
height: window.innerHeight,
|
62
|
-
breakpoin: _a.BREAKPOINT
|
63
|
-
});
|
64
|
-
};
|
65
|
-
});
|
66
|
-
return Screen;
|
67
|
-
}());
|
68
|
-
export { Screen };
|
@@ -1,83 +0,0 @@
|
|
1
|
-
import { Breadcrumbs } from "./Breadcrumbs.class";
|
2
|
-
import { Router } from '@angular/router';
|
3
|
-
import { inject } from "@angular/core";
|
4
|
-
import { Tools } from './Tools';
|
5
|
-
var Source = /** @class */ (function () {
|
6
|
-
function Source() {
|
7
|
-
}
|
8
|
-
/** */
|
9
|
-
Source.Set = function (page) {
|
10
|
-
var ROUTER = inject(Router);
|
11
|
-
var path = ROUTER.url;
|
12
|
-
if (path.includes('?'))
|
13
|
-
path = path.split('?')[0];
|
14
|
-
Breadcrumbs.Add(page, path);
|
15
|
-
var breadcrumbs = Breadcrumbs.Get();
|
16
|
-
if (breadcrumbs.length >= 2) {
|
17
|
-
breadcrumbs.pop();
|
18
|
-
var breadcrumb = breadcrumbs.pop();
|
19
|
-
this.Save({ page: breadcrumb.page, path: breadcrumb.path });
|
20
|
-
}
|
21
|
-
else
|
22
|
-
this.Save(null);
|
23
|
-
};
|
24
|
-
/** */
|
25
|
-
Source.Save = function (source) {
|
26
|
-
var storage = sessionStorage.getItem(this.storage);
|
27
|
-
if (storage)
|
28
|
-
storage = JSON.parse(storage);
|
29
|
-
storage = Object.assign({}, storage, { source: source });
|
30
|
-
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
31
|
-
};
|
32
|
-
/** */
|
33
|
-
Source.Get = function () {
|
34
|
-
var storage = sessionStorage.getItem(this.storage);
|
35
|
-
if (storage) {
|
36
|
-
storage = JSON.parse(storage);
|
37
|
-
if (storage.hasOwnProperty('source')) {
|
38
|
-
return storage.source;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
return null;
|
42
|
-
};
|
43
|
-
/** */
|
44
|
-
Source.GetRoot = function () {
|
45
|
-
var breadcrumbs = Breadcrumbs.Get();
|
46
|
-
return (breadcrumbs.length > 0) ? breadcrumbs.shift() : null;
|
47
|
-
};
|
48
|
-
/** */
|
49
|
-
Source.SetPageResponse = function (pageResponse) {
|
50
|
-
var storage = sessionStorage.getItem(this.storage);
|
51
|
-
storage = JSON.parse(storage);
|
52
|
-
storage = Object.assign({}, storage, { pageResponse: pageResponse });
|
53
|
-
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
54
|
-
};
|
55
|
-
/** */
|
56
|
-
Source.GetPageResponse = function () {
|
57
|
-
var storage = sessionStorage.getItem(this.storage);
|
58
|
-
if (storage) {
|
59
|
-
storage = JSON.parse(storage);
|
60
|
-
if (storage.hasOwnProperty('pageResponse')) {
|
61
|
-
return Tools.BreakReference(storage.pageResponse);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
return null;
|
65
|
-
};
|
66
|
-
/** */
|
67
|
-
Source.ClearPageResponse = function () {
|
68
|
-
var storage = sessionStorage.getItem(this.storage);
|
69
|
-
storage = JSON.parse(storage);
|
70
|
-
if (storage.hasOwnProperty('pageResponse')) {
|
71
|
-
delete storage.pageResponse;
|
72
|
-
}
|
73
|
-
storage = Object.assign({}, storage);
|
74
|
-
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
75
|
-
};
|
76
|
-
/** Clear Source */
|
77
|
-
Source.Reset = function () {
|
78
|
-
sessionStorage.removeItem(this.storage);
|
79
|
-
};
|
80
|
-
Source.storage = 'COER-System';
|
81
|
-
return Source;
|
82
|
-
}());
|
83
|
-
export { Source };
|