coer-elements 1.0.16 → 1.0.18
Sign up to get free protection for your applications and to get access to all the features.
- package/components/index.ts +2 -2
- package/dist_browser/Tools/Breadcrumbs.class.js +66 -0
- package/dist_browser/Tools/ControlValue.js +49 -0
- package/dist_browser/Tools/DateTime.class.js +25 -0
- package/dist_browser/Tools/Files.class.js +99 -0
- package/dist_browser/Tools/Page.class.js +213 -0
- package/dist_browser/Tools/Screen.class.js +68 -0
- package/dist_browser/Tools/Source.class.js +83 -0
- package/dist_browser/Tools/Tools.js +227 -0
- package/dist_browser/components/coer-alert/coer-alert.component.js +314 -0
- package/dist_browser/index.js +8 -0
- package/dist_node/Tools/Breadcrumbs.class.js +69 -0
- package/dist_node/Tools/ControlValue.js +53 -0
- package/dist_node/Tools/DateTime.class.js +28 -0
- package/dist_node/Tools/Files.class.js +102 -0
- package/dist_node/Tools/Page.class.js +216 -0
- package/dist_node/Tools/Screen.class.js +71 -0
- package/dist_node/Tools/Source.class.js +86 -0
- package/dist_node/Tools/Tools.js +230 -0
- package/dist_node/components/coer-alert/coer-alert.component.js +317 -0
- package/dist_node/index.js +24 -0
- package/dist_node/interfaces/index.js +2 -0
- package/package.json +9 -5
@@ -0,0 +1,227 @@
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
14
|
+
if (ar || !(i in from)) {
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
16
|
+
ar[i] = from[i];
|
17
|
+
}
|
18
|
+
}
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
20
|
+
};
|
21
|
+
import { Guid } from "guid-typescript";
|
22
|
+
import { signal } from "@angular/core";
|
23
|
+
var reference_signal = signal({});
|
24
|
+
export var Tools = {
|
25
|
+
/** Generate a Guid */
|
26
|
+
GetGuid: function (seed) {
|
27
|
+
if (seed === void 0) { seed = 'coer-system'; }
|
28
|
+
return "".concat(seed, "-").concat(Guid.create().toString());
|
29
|
+
},
|
30
|
+
/** Returns true if the value is null or undefined, false otherwise */
|
31
|
+
IsNull: function (value) {
|
32
|
+
if (value === undefined)
|
33
|
+
return true;
|
34
|
+
if (value === null)
|
35
|
+
return true;
|
36
|
+
return false;
|
37
|
+
},
|
38
|
+
/** Returns true if the value is not null or undefined, false otherwise */
|
39
|
+
IsNotNull: function (value) {
|
40
|
+
if (value === undefined)
|
41
|
+
return false;
|
42
|
+
if (value === null)
|
43
|
+
return false;
|
44
|
+
return true;
|
45
|
+
},
|
46
|
+
/** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
|
47
|
+
IsOnlyWhiteSpace: function (value) {
|
48
|
+
if (value === undefined)
|
49
|
+
return true;
|
50
|
+
if (value === null)
|
51
|
+
return true;
|
52
|
+
if (value.toString().trim() === '')
|
53
|
+
return true;
|
54
|
+
return false;
|
55
|
+
},
|
56
|
+
/** Break reference of a object or array */
|
57
|
+
BreakReference: function (object) {
|
58
|
+
if (object === undefined)
|
59
|
+
return undefined;
|
60
|
+
if (object === null)
|
61
|
+
return null;
|
62
|
+
var OBJECT = JSON.parse(JSON.stringify(object));
|
63
|
+
return (Array.isArray(OBJECT)) ? __spreadArray([], OBJECT, true) : __assign({}, OBJECT);
|
64
|
+
},
|
65
|
+
/** Clean extra whitespaces */
|
66
|
+
CleanUpBlanks: function (text) {
|
67
|
+
if (Tools.IsNull(text))
|
68
|
+
return '';
|
69
|
+
var worlds = String(text).split(' ');
|
70
|
+
worlds = worlds.filter(function (x) { return x.length > 0; });
|
71
|
+
return worlds.join(' ');
|
72
|
+
},
|
73
|
+
/** Get properties of an object */
|
74
|
+
GetObjectProperties: function (obj) {
|
75
|
+
var properties = [];
|
76
|
+
if (Tools.IsNull(obj))
|
77
|
+
return properties;
|
78
|
+
for (var property in obj)
|
79
|
+
properties.push(String(property));
|
80
|
+
return properties;
|
81
|
+
},
|
82
|
+
/**
|
83
|
+
* Set an index and merge more arrays of the same type
|
84
|
+
* @returns A new array
|
85
|
+
* */
|
86
|
+
SetIndex: function (array) {
|
87
|
+
var args = [];
|
88
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
89
|
+
args[_i - 1] = arguments[_i];
|
90
|
+
}
|
91
|
+
var index = 0;
|
92
|
+
for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
|
93
|
+
var arg = args_1[_a];
|
94
|
+
array = Tools.BreakReference(array).concat(Tools.BreakReference(arg));
|
95
|
+
}
|
96
|
+
return Tools.BreakReference(array).map(function (item) { return Object.assign({ index: index++ }, item); });
|
97
|
+
},
|
98
|
+
/** Set First Char To Lower */
|
99
|
+
FirstCharToLower: function (text) {
|
100
|
+
if (Tools.IsNull(text))
|
101
|
+
return '';
|
102
|
+
var textArray = [];
|
103
|
+
for (var i = 0; i < text.length; i++) {
|
104
|
+
if (i === 0)
|
105
|
+
textArray.push(text[i].toLowerCase());
|
106
|
+
else
|
107
|
+
textArray.push(text[i]);
|
108
|
+
}
|
109
|
+
return textArray.join('');
|
110
|
+
},
|
111
|
+
/** Set First Char To Upper */
|
112
|
+
FirstCharToUpper: function (text) {
|
113
|
+
if (Tools.IsNull(text))
|
114
|
+
return '';
|
115
|
+
var textArray = [];
|
116
|
+
for (var i = 0; i < text.length; i++) {
|
117
|
+
if (i === 0)
|
118
|
+
textArray.push(text[i].toUpperCase());
|
119
|
+
else
|
120
|
+
textArray.push(text[i]);
|
121
|
+
}
|
122
|
+
return textArray.join('');
|
123
|
+
},
|
124
|
+
/** Sort an array in ascending order by property */
|
125
|
+
SortBy: function (array, property, propertyType) {
|
126
|
+
if (propertyType === void 0) { propertyType = 'string'; }
|
127
|
+
switch (propertyType) {
|
128
|
+
case 'string': {
|
129
|
+
return array.sort(function (x, y) {
|
130
|
+
if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim())
|
131
|
+
return -1;
|
132
|
+
else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim())
|
133
|
+
return 1;
|
134
|
+
else
|
135
|
+
return 0;
|
136
|
+
});
|
137
|
+
}
|
138
|
+
case 'number': {
|
139
|
+
return array.sort(function (x, y) { return Number(x[property] - Number(y[property])); });
|
140
|
+
}
|
141
|
+
}
|
142
|
+
},
|
143
|
+
/** Sort an array in descending order by property */
|
144
|
+
SortByDesc: function (array, property, propertyType) {
|
145
|
+
if (propertyType === void 0) { propertyType = 'string'; }
|
146
|
+
switch (propertyType) {
|
147
|
+
case 'string': {
|
148
|
+
return array.sort(function (x, y) {
|
149
|
+
if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim())
|
150
|
+
return 1;
|
151
|
+
else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim())
|
152
|
+
return -1;
|
153
|
+
else
|
154
|
+
return 0;
|
155
|
+
});
|
156
|
+
}
|
157
|
+
case 'number': {
|
158
|
+
return array.sort(function (x, y) { return Number(Number(y[property])) - x[property]; });
|
159
|
+
}
|
160
|
+
}
|
161
|
+
},
|
162
|
+
/** Return a string with forman numeric */
|
163
|
+
GetNumericFormat: function (value, decimals) {
|
164
|
+
if (decimals === void 0) { decimals = 0; }
|
165
|
+
if (value == undefined
|
166
|
+
|| value == null
|
167
|
+
|| value.toString().trim() == ''
|
168
|
+
|| isNaN(Number(value))) {
|
169
|
+
return '0';
|
170
|
+
}
|
171
|
+
var valueInteger = '';
|
172
|
+
var valueDecimal = '';
|
173
|
+
value = value.toString().replaceAll(' ', '');
|
174
|
+
if (value.includes('.') || (decimals > 0)) {
|
175
|
+
valueInteger = value.includes('.') ? value.split('.')[0] : value;
|
176
|
+
if (decimals > 0) {
|
177
|
+
var PADDING = decimals - valueDecimal.length;
|
178
|
+
valueDecimal = value.includes('.') ? value.split('.')[1] : '';
|
179
|
+
for (var i = 0; i < PADDING; i++)
|
180
|
+
valueDecimal += '0';
|
181
|
+
valueDecimal = valueDecimal.substring(0, decimals);
|
182
|
+
valueDecimal = ".".concat(valueDecimal);
|
183
|
+
}
|
184
|
+
}
|
185
|
+
else {
|
186
|
+
valueInteger = value;
|
187
|
+
}
|
188
|
+
var counter = 0;
|
189
|
+
var VALUE_INTEGER_ARRAY = [];
|
190
|
+
for (var _i = 0, _a = valueInteger.split('').reverse(); _i < _a.length; _i++) {
|
191
|
+
var char = _a[_i];
|
192
|
+
if (counter == 3) {
|
193
|
+
VALUE_INTEGER_ARRAY.push(',');
|
194
|
+
counter = 0;
|
195
|
+
}
|
196
|
+
VALUE_INTEGER_ARRAY.push(char);
|
197
|
+
++counter;
|
198
|
+
}
|
199
|
+
valueInteger = VALUE_INTEGER_ARRAY.reverse().join('');
|
200
|
+
return "".concat(valueInteger).concat(valueDecimal);
|
201
|
+
},
|
202
|
+
/** Wait the time indicated */
|
203
|
+
Sleep: function (milliseconds, reference) {
|
204
|
+
if (milliseconds === void 0) { milliseconds = 0; }
|
205
|
+
if (reference === void 0) { reference = null; }
|
206
|
+
if (Tools.IsNull(reference)) {
|
207
|
+
return new Promise(function (Resolve) { return setTimeout(Resolve, milliseconds); });
|
208
|
+
}
|
209
|
+
else
|
210
|
+
return new Promise(function (Resolve) {
|
211
|
+
var _a;
|
212
|
+
reference = reference.replaceAll(' ', '_').toLowerCase();
|
213
|
+
if (reference_signal().hasOwnProperty(reference)) {
|
214
|
+
clearInterval(reference_signal()[reference]);
|
215
|
+
}
|
216
|
+
reference_signal.set(Object.assign(reference_signal(), (_a = {},
|
217
|
+
_a[reference] = setTimeout(function () {
|
218
|
+
Resolve();
|
219
|
+
clearInterval(reference_signal()[reference]);
|
220
|
+
var _reference = __assign({}, reference_signal());
|
221
|
+
delete _reference[reference];
|
222
|
+
reference_signal.set(__assign({}, _reference));
|
223
|
+
}, milliseconds),
|
224
|
+
_a)));
|
225
|
+
});
|
226
|
+
}
|
227
|
+
};
|
@@ -0,0 +1,314 @@
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
40
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
41
|
+
if (ar || !(i in from)) {
|
42
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
43
|
+
ar[i] = from[i];
|
44
|
+
}
|
45
|
+
}
|
46
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
47
|
+
};
|
48
|
+
import { Component } from '@angular/core';
|
49
|
+
import * as bootstrap from 'bootstrap';
|
50
|
+
import Swal from 'sweetalert2';
|
51
|
+
var CoerAlert = function () {
|
52
|
+
var _classDecorators = [Component({
|
53
|
+
selector: 'coer-alert',
|
54
|
+
templateUrl: './coer-alert.component.html',
|
55
|
+
styleUrls: ['./coer-alert.component.scss']
|
56
|
+
})];
|
57
|
+
var _classDescriptor;
|
58
|
+
var _classExtraInitializers = [];
|
59
|
+
var _classThis;
|
60
|
+
var CoerAlert = _classThis = /** @class */ (function () {
|
61
|
+
function CoerAlert_1() {
|
62
|
+
}
|
63
|
+
/** */
|
64
|
+
CoerAlert_1.prototype.Success = function (message, title, icon, autohide) {
|
65
|
+
if (message === void 0) { message = null; }
|
66
|
+
if (title === void 0) { title = null; }
|
67
|
+
if (icon === void 0) { icon = null; }
|
68
|
+
if (autohide === void 0) { autohide = 3000; }
|
69
|
+
//Title
|
70
|
+
if (!title || title == '')
|
71
|
+
title = 'Success';
|
72
|
+
var alertSuccessTitle = document.getElementById('alert-success-title');
|
73
|
+
alertSuccessTitle.textContent = title;
|
74
|
+
//Icon
|
75
|
+
icon = this.GetIcon(title, icon, 'bi-check-circle fa-beat');
|
76
|
+
var alertSuccessIcon = document.getElementById('alert-success-icon');
|
77
|
+
this.SetIcon(alertSuccessIcon, icon);
|
78
|
+
//Message
|
79
|
+
if (!message)
|
80
|
+
message = '';
|
81
|
+
var alertSuccessMessage = document.getElementById('alert-success-message');
|
82
|
+
alertSuccessMessage.innerHTML = message;
|
83
|
+
//Toast
|
84
|
+
var alertSuccess = document.getElementById('alert-success');
|
85
|
+
this.SetAutoHide(alertSuccess, autohide);
|
86
|
+
var toast = bootstrap.Toast.getOrCreateInstance(alertSuccess);
|
87
|
+
toast.show();
|
88
|
+
};
|
89
|
+
/** */
|
90
|
+
CoerAlert_1.prototype.Error = function (message, title, icon, autohide) {
|
91
|
+
if (message === void 0) { message = null; }
|
92
|
+
if (title === void 0) { title = null; }
|
93
|
+
if (icon === void 0) { icon = null; }
|
94
|
+
if (autohide === void 0) { autohide = 3000; }
|
95
|
+
//Title
|
96
|
+
if (!title || title == '')
|
97
|
+
title = 'Error';
|
98
|
+
var alertErrorTitle = document.getElementById('alert-error-title');
|
99
|
+
alertErrorTitle.textContent = title;
|
100
|
+
//Icon
|
101
|
+
icon = this.GetIcon(title, icon, 'bi-exclamation-octagon fa-beat');
|
102
|
+
var alertErrorIcon = document.getElementById('alert-error-icon');
|
103
|
+
this.SetIcon(alertErrorIcon, icon);
|
104
|
+
//Message
|
105
|
+
if (!message)
|
106
|
+
message = '';
|
107
|
+
var alertErrorBody = document.getElementById('alert-error-message');
|
108
|
+
alertErrorBody.innerHTML = message;
|
109
|
+
//Toast
|
110
|
+
var alertError = document.getElementById('alert-error');
|
111
|
+
this.SetAutoHide(alertError, autohide);
|
112
|
+
var toast = bootstrap.Toast.getOrCreateInstance(alertError);
|
113
|
+
toast.show();
|
114
|
+
};
|
115
|
+
/** */
|
116
|
+
CoerAlert_1.prototype.Info = function (message, title, icon, autohide) {
|
117
|
+
if (message === void 0) { message = null; }
|
118
|
+
if (title === void 0) { title = null; }
|
119
|
+
if (icon === void 0) { icon = null; }
|
120
|
+
if (autohide === void 0) { autohide = 3000; }
|
121
|
+
//Title
|
122
|
+
if (!title || title == '')
|
123
|
+
title = 'Info';
|
124
|
+
var alertInfoTitle = document.getElementById('alert-info-title');
|
125
|
+
alertInfoTitle.textContent = title;
|
126
|
+
//Icon
|
127
|
+
icon = this.GetIcon(title, icon, 'bi-info-circle fa-beat');
|
128
|
+
var alertInfoIcon = document.getElementById('alert-info-icon');
|
129
|
+
this.SetIcon(alertInfoIcon, icon);
|
130
|
+
//Message
|
131
|
+
if (!message)
|
132
|
+
message = '';
|
133
|
+
var alertInfoBody = document.getElementById('alert-info-message');
|
134
|
+
alertInfoBody.innerHTML = message;
|
135
|
+
//Toast
|
136
|
+
var alertInfo = document.getElementById('alert-info');
|
137
|
+
this.SetAutoHide(alertInfo, autohide);
|
138
|
+
var toast = bootstrap.Toast.getOrCreateInstance(alertInfo);
|
139
|
+
toast.show();
|
140
|
+
};
|
141
|
+
/** */
|
142
|
+
CoerAlert_1.prototype.Warning = function (message, title, icon, autohide) {
|
143
|
+
if (message === void 0) { message = null; }
|
144
|
+
if (title === void 0) { title = null; }
|
145
|
+
if (icon === void 0) { icon = null; }
|
146
|
+
if (autohide === void 0) { autohide = 3000; }
|
147
|
+
//Title
|
148
|
+
if (!title || title == '')
|
149
|
+
title = 'Warning';
|
150
|
+
var alertWarningTitle = document.getElementById('alert-warning-title');
|
151
|
+
alertWarningTitle.textContent = title;
|
152
|
+
//Icon
|
153
|
+
icon = this.GetIcon(title, icon, 'bi-exclamation-triangle-fill fa-beat');
|
154
|
+
var alertWarningIcon = document.getElementById('alert-warning-icon');
|
155
|
+
this.SetIcon(alertWarningIcon, icon);
|
156
|
+
//Message
|
157
|
+
if (!message)
|
158
|
+
message = '';
|
159
|
+
var alertWarningBody = document.getElementById('alert-warning-message');
|
160
|
+
alertWarningBody.innerHTML = message;
|
161
|
+
//Toast
|
162
|
+
var alertWarning = document.getElementById('alert-warning');
|
163
|
+
this.SetAutoHide(alertWarning, autohide);
|
164
|
+
var toast = bootstrap.Toast.getOrCreateInstance(alertWarning);
|
165
|
+
toast.show();
|
166
|
+
};
|
167
|
+
/** */
|
168
|
+
CoerAlert_1.prototype.Close = function (alert) {
|
169
|
+
return new Promise(function (Resolve) {
|
170
|
+
var element = document.getElementById(alert);
|
171
|
+
var toast = bootstrap.Toast.getOrCreateInstance(element);
|
172
|
+
toast.hide();
|
173
|
+
setTimeout(function () { Resolve(); }, 200);
|
174
|
+
});
|
175
|
+
};
|
176
|
+
/** */
|
177
|
+
CoerAlert_1.prototype.Confirm = function (message, alertType, icon) {
|
178
|
+
if (message === void 0) { message = 'Proceed?'; }
|
179
|
+
if (alertType === void 0) { alertType = 'warning'; }
|
180
|
+
if (icon === void 0) { icon = null; }
|
181
|
+
return new Promise(function (Resolve) {
|
182
|
+
var color;
|
183
|
+
var iconType;
|
184
|
+
switch (alertType) {
|
185
|
+
case 'danger':
|
186
|
+
{
|
187
|
+
if (icon == null)
|
188
|
+
icon = 'bi-exclamation-octagon';
|
189
|
+
iconType = 'error';
|
190
|
+
color = '#dc3545';
|
191
|
+
break;
|
192
|
+
}
|
193
|
+
;
|
194
|
+
case 'success':
|
195
|
+
{
|
196
|
+
if (icon == null)
|
197
|
+
icon = 'bi-check-circle';
|
198
|
+
iconType = 'info';
|
199
|
+
color = '#198754';
|
200
|
+
break;
|
201
|
+
}
|
202
|
+
;
|
203
|
+
case 'info':
|
204
|
+
{
|
205
|
+
if (icon == null)
|
206
|
+
icon = 'bi-info-circle';
|
207
|
+
iconType = 'error';
|
208
|
+
color = '#0d6efd';
|
209
|
+
break;
|
210
|
+
}
|
211
|
+
;
|
212
|
+
default: {
|
213
|
+
if (icon == null)
|
214
|
+
icon = 'bi-exclamation-triangle-fill';
|
215
|
+
iconType = 'warning';
|
216
|
+
color = '#ffc107';
|
217
|
+
break;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
switch (icon) {
|
221
|
+
case 'delete':
|
222
|
+
icon = 'fa-regular fa-trash-can';
|
223
|
+
break;
|
224
|
+
}
|
225
|
+
Swal.fire({
|
226
|
+
icon: iconType,
|
227
|
+
iconColor: 'transparent',
|
228
|
+
iconHtml: "<i class=\"".concat(icon, "\" style=\"color: ").concat(color, ";\"></i>"),
|
229
|
+
html: message,
|
230
|
+
showConfirmButton: true,
|
231
|
+
confirmButtonText: 'Yes',
|
232
|
+
confirmButtonColor: color,
|
233
|
+
focusConfirm: true,
|
234
|
+
showDenyButton: true,
|
235
|
+
denyButtonColor: color,
|
236
|
+
focusDeny: false,
|
237
|
+
reverseButtons: true,
|
238
|
+
allowOutsideClick: false,
|
239
|
+
allowEscapeKey: false,
|
240
|
+
allowEnterKey: true,
|
241
|
+
customClass: {
|
242
|
+
denyButton: 'sweet-alert-button',
|
243
|
+
confirmButton: 'sweet-alert-button'
|
244
|
+
}
|
245
|
+
}).then(function (_a) {
|
246
|
+
var value = _a.value;
|
247
|
+
return setTimeout(function () { return Resolve(value); });
|
248
|
+
});
|
249
|
+
});
|
250
|
+
};
|
251
|
+
/** */
|
252
|
+
CoerAlert_1.prototype.SetIcon = function (element, icon) {
|
253
|
+
for (var _i = 0, _a = __spreadArray([], element.classList.value.split(' '), true); _i < _a.length; _i++) {
|
254
|
+
var item = _a[_i];
|
255
|
+
if (item.length > 0) {
|
256
|
+
element.classList.remove(item);
|
257
|
+
element.classList.remove('q');
|
258
|
+
}
|
259
|
+
}
|
260
|
+
icon = icon.trim();
|
261
|
+
var hasWhiteSpaces = / /;
|
262
|
+
if (hasWhiteSpaces.test(icon)) {
|
263
|
+
var classes = icon.split(' ');
|
264
|
+
for (var _b = 0, classes_1 = classes; _b < classes_1.length; _b++) {
|
265
|
+
var icon_1 = classes_1[_b];
|
266
|
+
element.classList.add(icon_1);
|
267
|
+
}
|
268
|
+
}
|
269
|
+
else
|
270
|
+
element.classList.add(icon);
|
271
|
+
};
|
272
|
+
/** */
|
273
|
+
CoerAlert_1.prototype.SetAutoHide = function (element, autohide) {
|
274
|
+
element.removeAttribute('data-bs-autohide');
|
275
|
+
element.removeAttribute('data-bs-delay');
|
276
|
+
if (autohide && autohide > 0) {
|
277
|
+
if (autohide < 1000)
|
278
|
+
autohide = 1000;
|
279
|
+
element.setAttribute('data-bs-autohide', 'true');
|
280
|
+
element.setAttribute('data-bs-delay', String(autohide));
|
281
|
+
}
|
282
|
+
else
|
283
|
+
element.setAttribute('data-bs-autohide', 'false');
|
284
|
+
};
|
285
|
+
/** */
|
286
|
+
CoerAlert_1.prototype.GetIcon = function (title, icon, iconDefault) {
|
287
|
+
if (icon == null || icon == '') {
|
288
|
+
title = title.replaceAll(' ', '').toUpperCase();
|
289
|
+
switch (title) {
|
290
|
+
case 'ENABLED': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
|
291
|
+
case 'ACTIVE': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
|
292
|
+
case 'ACTIVED': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
|
293
|
+
case 'DISABLE': return 'fa-solid fa-thumbs-down fa-flip-horizontal';
|
294
|
+
case 'DISABLED': return 'fa-solid fa-thumbs-down fa-flip-horizontal';
|
295
|
+
case 'DELETE': return 'fa-regular fa-trash-can';
|
296
|
+
case 'DELETED': return 'fa-regular fa-trash-can';
|
297
|
+
default: return iconDefault;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
return icon;
|
301
|
+
};
|
302
|
+
return CoerAlert_1;
|
303
|
+
}());
|
304
|
+
__setFunctionName(_classThis, "CoerAlert");
|
305
|
+
(function () {
|
306
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
307
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
308
|
+
CoerAlert = _classThis = _classDescriptor.value;
|
309
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
310
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
311
|
+
})();
|
312
|
+
return CoerAlert = _classThis;
|
313
|
+
}();
|
314
|
+
export { CoerAlert };
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export * from './Tools/Breadcrumbs.class';
|
2
|
+
export * from './Tools/ControlValue';
|
3
|
+
export * from './Tools/DateTime.class';
|
4
|
+
export * from './Tools/Files.class';
|
5
|
+
export * from './Tools/Page.class';
|
6
|
+
export * from './Tools/Screen.class';
|
7
|
+
export * from './Tools/Source.class';
|
8
|
+
export * from './Tools/Tools';
|
@@ -0,0 +1,69 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Breadcrumbs = void 0;
|
4
|
+
var Tools_1 = require("./Tools");
|
5
|
+
var Breadcrumbs = /** @class */ (function () {
|
6
|
+
function Breadcrumbs() {
|
7
|
+
}
|
8
|
+
/** */
|
9
|
+
Breadcrumbs.Add = function (page, path) {
|
10
|
+
var breadcrumbs = this.Get();
|
11
|
+
var paths = breadcrumbs.map(function (item) { return item.path; });
|
12
|
+
if (!paths.includes(path)) {
|
13
|
+
breadcrumbs.push({ page: page, path: path });
|
14
|
+
this.Save(breadcrumbs);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
/** */
|
18
|
+
Breadcrumbs.Get = function () {
|
19
|
+
var storage = sessionStorage.getItem(this.storage);
|
20
|
+
if (storage) {
|
21
|
+
storage = JSON.parse(storage);
|
22
|
+
if (storage.hasOwnProperty('breadcrumbs')) {
|
23
|
+
return Tools_1.Tools.BreakReference(storage.breadcrumbs);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return [];
|
27
|
+
};
|
28
|
+
/** Source */
|
29
|
+
Breadcrumbs.GetFirst = function () {
|
30
|
+
var breadcrumbs = this.Get();
|
31
|
+
return (breadcrumbs.length > 0) ? breadcrumbs.shift() : null;
|
32
|
+
};
|
33
|
+
/** */
|
34
|
+
Breadcrumbs.Save = function (breadcrumbs) {
|
35
|
+
var storage = sessionStorage.getItem(this.storage);
|
36
|
+
if (storage)
|
37
|
+
storage = JSON.parse(storage);
|
38
|
+
storage = Object.assign({}, storage, { breadcrumbs: breadcrumbs });
|
39
|
+
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
40
|
+
};
|
41
|
+
/** */
|
42
|
+
Breadcrumbs.Remove = function (path) {
|
43
|
+
var breadcrumbs = this.Get();
|
44
|
+
var index = breadcrumbs.findIndex(function (x) { return x.path.toLowerCase().trim() === path.toLowerCase().trim(); });
|
45
|
+
if (index >= 0) {
|
46
|
+
breadcrumbs = Tools_1.Tools.BreakReference(breadcrumbs).splice(0, index + 1);
|
47
|
+
this.Save(breadcrumbs);
|
48
|
+
}
|
49
|
+
};
|
50
|
+
/** */
|
51
|
+
Breadcrumbs.SetLast = function (page, path) {
|
52
|
+
var breadcrumbs = this.Get();
|
53
|
+
if (breadcrumbs.length > 0) {
|
54
|
+
breadcrumbs[breadcrumbs.length - 1] = { page: page, path: path };
|
55
|
+
this.Save(breadcrumbs);
|
56
|
+
}
|
57
|
+
};
|
58
|
+
/** */
|
59
|
+
Breadcrumbs.RemoveLast = function () {
|
60
|
+
var breadcrumbs = this.Get();
|
61
|
+
if (breadcrumbs.length > 0) {
|
62
|
+
breadcrumbs.pop();
|
63
|
+
this.Save(breadcrumbs);
|
64
|
+
}
|
65
|
+
};
|
66
|
+
Breadcrumbs.storage = 'COER-System';
|
67
|
+
return Breadcrumbs;
|
68
|
+
}());
|
69
|
+
exports.Breadcrumbs = Breadcrumbs;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ControlValue = exports.CONTROL_VALUE = void 0;
|
4
|
+
var forms_1 = require("@angular/forms");
|
5
|
+
var core_1 = require("@angular/core");
|
6
|
+
var CONTROL_VALUE = function (component) {
|
7
|
+
return {
|
8
|
+
provide: forms_1.NG_VALUE_ACCESSOR,
|
9
|
+
useExisting: (0, core_1.forwardRef)(function () { return component; }),
|
10
|
+
multi: true
|
11
|
+
};
|
12
|
+
};
|
13
|
+
exports.CONTROL_VALUE = CONTROL_VALUE;
|
14
|
+
var ControlValue = /** @class */ (function () {
|
15
|
+
function ControlValue() {
|
16
|
+
this._isTouched = false;
|
17
|
+
}
|
18
|
+
Object.defineProperty(ControlValue.prototype, "isTouched", {
|
19
|
+
get: function () {
|
20
|
+
return this._isTouched;
|
21
|
+
},
|
22
|
+
enumerable: false,
|
23
|
+
configurable: true
|
24
|
+
});
|
25
|
+
/** */
|
26
|
+
ControlValue.prototype.SetValue = function (value) {
|
27
|
+
if (typeof this._UpdateValue === 'function') {
|
28
|
+
this._UpdateValue(value);
|
29
|
+
}
|
30
|
+
this._value = value;
|
31
|
+
};
|
32
|
+
/** */
|
33
|
+
ControlValue.prototype.SetTouched = function (isTouched) {
|
34
|
+
if (typeof this._IsTouched === 'function') {
|
35
|
+
this._IsTouched(isTouched);
|
36
|
+
}
|
37
|
+
this._isTouched = isTouched;
|
38
|
+
};
|
39
|
+
/** */
|
40
|
+
ControlValue.prototype.writeValue = function (value) {
|
41
|
+
this._value = value;
|
42
|
+
};
|
43
|
+
/** */
|
44
|
+
ControlValue.prototype.registerOnChange = function (callback) {
|
45
|
+
this._UpdateValue = callback;
|
46
|
+
};
|
47
|
+
/** */
|
48
|
+
ControlValue.prototype.registerOnTouched = function (callback) {
|
49
|
+
this._IsTouched = callback;
|
50
|
+
};
|
51
|
+
return ControlValue;
|
52
|
+
}());
|
53
|
+
exports.ControlValue = ControlValue;
|