coer-elements 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,230 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
3
|
+
__assign = Object.assign || function(t) {
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
+
s = arguments[i];
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
+
t[p] = s[p];
|
8
|
+
}
|
9
|
+
return t;
|
10
|
+
};
|
11
|
+
return __assign.apply(this, arguments);
|
12
|
+
};
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
15
|
+
if (ar || !(i in from)) {
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
17
|
+
ar[i] = from[i];
|
18
|
+
}
|
19
|
+
}
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
21
|
+
};
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
23
|
+
exports.Tools = void 0;
|
24
|
+
var guid_typescript_1 = require("guid-typescript");
|
25
|
+
var core_1 = require("@angular/core");
|
26
|
+
var reference_signal = (0, core_1.signal)({});
|
27
|
+
exports.Tools = {
|
28
|
+
/** Generate a Guid */
|
29
|
+
GetGuid: function (seed) {
|
30
|
+
if (seed === void 0) { seed = 'coer-system'; }
|
31
|
+
return "".concat(seed, "-").concat(guid_typescript_1.Guid.create().toString());
|
32
|
+
},
|
33
|
+
/** Returns true if the value is null or undefined, false otherwise */
|
34
|
+
IsNull: function (value) {
|
35
|
+
if (value === undefined)
|
36
|
+
return true;
|
37
|
+
if (value === null)
|
38
|
+
return true;
|
39
|
+
return false;
|
40
|
+
},
|
41
|
+
/** Returns true if the value is not null or undefined, false otherwise */
|
42
|
+
IsNotNull: function (value) {
|
43
|
+
if (value === undefined)
|
44
|
+
return false;
|
45
|
+
if (value === null)
|
46
|
+
return false;
|
47
|
+
return true;
|
48
|
+
},
|
49
|
+
/** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
|
50
|
+
IsOnlyWhiteSpace: function (value) {
|
51
|
+
if (value === undefined)
|
52
|
+
return true;
|
53
|
+
if (value === null)
|
54
|
+
return true;
|
55
|
+
if (value.toString().trim() === '')
|
56
|
+
return true;
|
57
|
+
return false;
|
58
|
+
},
|
59
|
+
/** Break reference of a object or array */
|
60
|
+
BreakReference: function (object) {
|
61
|
+
if (object === undefined)
|
62
|
+
return undefined;
|
63
|
+
if (object === null)
|
64
|
+
return null;
|
65
|
+
var OBJECT = JSON.parse(JSON.stringify(object));
|
66
|
+
return (Array.isArray(OBJECT)) ? __spreadArray([], OBJECT, true) : __assign({}, OBJECT);
|
67
|
+
},
|
68
|
+
/** Clean extra whitespaces */
|
69
|
+
CleanUpBlanks: function (text) {
|
70
|
+
if (exports.Tools.IsNull(text))
|
71
|
+
return '';
|
72
|
+
var worlds = String(text).split(' ');
|
73
|
+
worlds = worlds.filter(function (x) { return x.length > 0; });
|
74
|
+
return worlds.join(' ');
|
75
|
+
},
|
76
|
+
/** Get properties of an object */
|
77
|
+
GetObjectProperties: function (obj) {
|
78
|
+
var properties = [];
|
79
|
+
if (exports.Tools.IsNull(obj))
|
80
|
+
return properties;
|
81
|
+
for (var property in obj)
|
82
|
+
properties.push(String(property));
|
83
|
+
return properties;
|
84
|
+
},
|
85
|
+
/**
|
86
|
+
* Set an index and merge more arrays of the same type
|
87
|
+
* @returns A new array
|
88
|
+
* */
|
89
|
+
SetIndex: function (array) {
|
90
|
+
var args = [];
|
91
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
92
|
+
args[_i - 1] = arguments[_i];
|
93
|
+
}
|
94
|
+
var index = 0;
|
95
|
+
for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
|
96
|
+
var arg = args_1[_a];
|
97
|
+
array = exports.Tools.BreakReference(array).concat(exports.Tools.BreakReference(arg));
|
98
|
+
}
|
99
|
+
return exports.Tools.BreakReference(array).map(function (item) { return Object.assign({ index: index++ }, item); });
|
100
|
+
},
|
101
|
+
/** Set First Char To Lower */
|
102
|
+
FirstCharToLower: function (text) {
|
103
|
+
if (exports.Tools.IsNull(text))
|
104
|
+
return '';
|
105
|
+
var textArray = [];
|
106
|
+
for (var i = 0; i < text.length; i++) {
|
107
|
+
if (i === 0)
|
108
|
+
textArray.push(text[i].toLowerCase());
|
109
|
+
else
|
110
|
+
textArray.push(text[i]);
|
111
|
+
}
|
112
|
+
return textArray.join('');
|
113
|
+
},
|
114
|
+
/** Set First Char To Upper */
|
115
|
+
FirstCharToUpper: function (text) {
|
116
|
+
if (exports.Tools.IsNull(text))
|
117
|
+
return '';
|
118
|
+
var textArray = [];
|
119
|
+
for (var i = 0; i < text.length; i++) {
|
120
|
+
if (i === 0)
|
121
|
+
textArray.push(text[i].toUpperCase());
|
122
|
+
else
|
123
|
+
textArray.push(text[i]);
|
124
|
+
}
|
125
|
+
return textArray.join('');
|
126
|
+
},
|
127
|
+
/** Sort an array in ascending order by property */
|
128
|
+
SortBy: function (array, property, propertyType) {
|
129
|
+
if (propertyType === void 0) { propertyType = 'string'; }
|
130
|
+
switch (propertyType) {
|
131
|
+
case 'string': {
|
132
|
+
return array.sort(function (x, y) {
|
133
|
+
if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim())
|
134
|
+
return -1;
|
135
|
+
else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim())
|
136
|
+
return 1;
|
137
|
+
else
|
138
|
+
return 0;
|
139
|
+
});
|
140
|
+
}
|
141
|
+
case 'number': {
|
142
|
+
return array.sort(function (x, y) { return Number(x[property] - Number(y[property])); });
|
143
|
+
}
|
144
|
+
}
|
145
|
+
},
|
146
|
+
/** Sort an array in descending order by property */
|
147
|
+
SortByDesc: function (array, property, propertyType) {
|
148
|
+
if (propertyType === void 0) { propertyType = 'string'; }
|
149
|
+
switch (propertyType) {
|
150
|
+
case 'string': {
|
151
|
+
return array.sort(function (x, y) {
|
152
|
+
if (String(x[property]).toUpperCase().trim() < String(y[property]).toUpperCase().trim())
|
153
|
+
return 1;
|
154
|
+
else if (String(x[property]).toUpperCase().trim() > String(y[property]).toUpperCase().trim())
|
155
|
+
return -1;
|
156
|
+
else
|
157
|
+
return 0;
|
158
|
+
});
|
159
|
+
}
|
160
|
+
case 'number': {
|
161
|
+
return array.sort(function (x, y) { return Number(Number(y[property])) - x[property]; });
|
162
|
+
}
|
163
|
+
}
|
164
|
+
},
|
165
|
+
/** Return a string with forman numeric */
|
166
|
+
GetNumericFormat: function (value, decimals) {
|
167
|
+
if (decimals === void 0) { decimals = 0; }
|
168
|
+
if (value == undefined
|
169
|
+
|| value == null
|
170
|
+
|| value.toString().trim() == ''
|
171
|
+
|| isNaN(Number(value))) {
|
172
|
+
return '0';
|
173
|
+
}
|
174
|
+
var valueInteger = '';
|
175
|
+
var valueDecimal = '';
|
176
|
+
value = value.toString().replaceAll(' ', '');
|
177
|
+
if (value.includes('.') || (decimals > 0)) {
|
178
|
+
valueInteger = value.includes('.') ? value.split('.')[0] : value;
|
179
|
+
if (decimals > 0) {
|
180
|
+
var PADDING = decimals - valueDecimal.length;
|
181
|
+
valueDecimal = value.includes('.') ? value.split('.')[1] : '';
|
182
|
+
for (var i = 0; i < PADDING; i++)
|
183
|
+
valueDecimal += '0';
|
184
|
+
valueDecimal = valueDecimal.substring(0, decimals);
|
185
|
+
valueDecimal = ".".concat(valueDecimal);
|
186
|
+
}
|
187
|
+
}
|
188
|
+
else {
|
189
|
+
valueInteger = value;
|
190
|
+
}
|
191
|
+
var counter = 0;
|
192
|
+
var VALUE_INTEGER_ARRAY = [];
|
193
|
+
for (var _i = 0, _a = valueInteger.split('').reverse(); _i < _a.length; _i++) {
|
194
|
+
var char = _a[_i];
|
195
|
+
if (counter == 3) {
|
196
|
+
VALUE_INTEGER_ARRAY.push(',');
|
197
|
+
counter = 0;
|
198
|
+
}
|
199
|
+
VALUE_INTEGER_ARRAY.push(char);
|
200
|
+
++counter;
|
201
|
+
}
|
202
|
+
valueInteger = VALUE_INTEGER_ARRAY.reverse().join('');
|
203
|
+
return "".concat(valueInteger).concat(valueDecimal);
|
204
|
+
},
|
205
|
+
/** Wait the time indicated */
|
206
|
+
Sleep: function (milliseconds, reference) {
|
207
|
+
if (milliseconds === void 0) { milliseconds = 0; }
|
208
|
+
if (reference === void 0) { reference = null; }
|
209
|
+
if (exports.Tools.IsNull(reference)) {
|
210
|
+
return new Promise(function (Resolve) { return setTimeout(Resolve, milliseconds); });
|
211
|
+
}
|
212
|
+
else
|
213
|
+
return new Promise(function (Resolve) {
|
214
|
+
var _a;
|
215
|
+
reference = reference.replaceAll(' ', '_').toLowerCase();
|
216
|
+
if (reference_signal().hasOwnProperty(reference)) {
|
217
|
+
clearInterval(reference_signal()[reference]);
|
218
|
+
}
|
219
|
+
reference_signal.set(Object.assign(reference_signal(), (_a = {},
|
220
|
+
_a[reference] = setTimeout(function () {
|
221
|
+
Resolve();
|
222
|
+
clearInterval(reference_signal()[reference]);
|
223
|
+
var _reference = __assign({}, reference_signal());
|
224
|
+
delete _reference[reference];
|
225
|
+
reference_signal.set(__assign({}, _reference));
|
226
|
+
}, milliseconds),
|
227
|
+
_a)));
|
228
|
+
});
|
229
|
+
}
|
230
|
+
};
|
@@ -0,0 +1,317 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
7
|
+
var _, done = false;
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
9
|
+
var context = {};
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
14
|
+
if (kind === "accessor") {
|
15
|
+
if (result === void 0) continue;
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
20
|
+
}
|
21
|
+
else if (_ = accept(result)) {
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
23
|
+
else descriptor[key] = _;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
27
|
+
done = true;
|
28
|
+
};
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
30
|
+
var useValue = arguments.length > 2;
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
33
|
+
}
|
34
|
+
return useValue ? value : void 0;
|
35
|
+
};
|
36
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
37
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
38
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
39
|
+
};
|
40
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
41
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
42
|
+
if (ar || !(i in from)) {
|
43
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
44
|
+
ar[i] = from[i];
|
45
|
+
}
|
46
|
+
}
|
47
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
48
|
+
};
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
50
|
+
exports.CoerAlert = void 0;
|
51
|
+
var core_1 = require("@angular/core");
|
52
|
+
var bootstrap = require("bootstrap");
|
53
|
+
var sweetalert2_1 = require("sweetalert2");
|
54
|
+
var CoerAlert = function () {
|
55
|
+
var _classDecorators = [(0, core_1.Component)({
|
56
|
+
selector: 'coer-alert',
|
57
|
+
templateUrl: './coer-alert.component.html',
|
58
|
+
styleUrls: ['./coer-alert.component.scss']
|
59
|
+
})];
|
60
|
+
var _classDescriptor;
|
61
|
+
var _classExtraInitializers = [];
|
62
|
+
var _classThis;
|
63
|
+
var CoerAlert = _classThis = /** @class */ (function () {
|
64
|
+
function CoerAlert_1() {
|
65
|
+
}
|
66
|
+
/** */
|
67
|
+
CoerAlert_1.prototype.Success = function (message, title, icon, autohide) {
|
68
|
+
if (message === void 0) { message = null; }
|
69
|
+
if (title === void 0) { title = null; }
|
70
|
+
if (icon === void 0) { icon = null; }
|
71
|
+
if (autohide === void 0) { autohide = 3000; }
|
72
|
+
//Title
|
73
|
+
if (!title || title == '')
|
74
|
+
title = 'Success';
|
75
|
+
var alertSuccessTitle = document.getElementById('alert-success-title');
|
76
|
+
alertSuccessTitle.textContent = title;
|
77
|
+
//Icon
|
78
|
+
icon = this.GetIcon(title, icon, 'bi-check-circle fa-beat');
|
79
|
+
var alertSuccessIcon = document.getElementById('alert-success-icon');
|
80
|
+
this.SetIcon(alertSuccessIcon, icon);
|
81
|
+
//Message
|
82
|
+
if (!message)
|
83
|
+
message = '';
|
84
|
+
var alertSuccessMessage = document.getElementById('alert-success-message');
|
85
|
+
alertSuccessMessage.innerHTML = message;
|
86
|
+
//Toast
|
87
|
+
var alertSuccess = document.getElementById('alert-success');
|
88
|
+
this.SetAutoHide(alertSuccess, autohide);
|
89
|
+
var toast = bootstrap.Toast.getOrCreateInstance(alertSuccess);
|
90
|
+
toast.show();
|
91
|
+
};
|
92
|
+
/** */
|
93
|
+
CoerAlert_1.prototype.Error = function (message, title, icon, autohide) {
|
94
|
+
if (message === void 0) { message = null; }
|
95
|
+
if (title === void 0) { title = null; }
|
96
|
+
if (icon === void 0) { icon = null; }
|
97
|
+
if (autohide === void 0) { autohide = 3000; }
|
98
|
+
//Title
|
99
|
+
if (!title || title == '')
|
100
|
+
title = 'Error';
|
101
|
+
var alertErrorTitle = document.getElementById('alert-error-title');
|
102
|
+
alertErrorTitle.textContent = title;
|
103
|
+
//Icon
|
104
|
+
icon = this.GetIcon(title, icon, 'bi-exclamation-octagon fa-beat');
|
105
|
+
var alertErrorIcon = document.getElementById('alert-error-icon');
|
106
|
+
this.SetIcon(alertErrorIcon, icon);
|
107
|
+
//Message
|
108
|
+
if (!message)
|
109
|
+
message = '';
|
110
|
+
var alertErrorBody = document.getElementById('alert-error-message');
|
111
|
+
alertErrorBody.innerHTML = message;
|
112
|
+
//Toast
|
113
|
+
var alertError = document.getElementById('alert-error');
|
114
|
+
this.SetAutoHide(alertError, autohide);
|
115
|
+
var toast = bootstrap.Toast.getOrCreateInstance(alertError);
|
116
|
+
toast.show();
|
117
|
+
};
|
118
|
+
/** */
|
119
|
+
CoerAlert_1.prototype.Info = function (message, title, icon, autohide) {
|
120
|
+
if (message === void 0) { message = null; }
|
121
|
+
if (title === void 0) { title = null; }
|
122
|
+
if (icon === void 0) { icon = null; }
|
123
|
+
if (autohide === void 0) { autohide = 3000; }
|
124
|
+
//Title
|
125
|
+
if (!title || title == '')
|
126
|
+
title = 'Info';
|
127
|
+
var alertInfoTitle = document.getElementById('alert-info-title');
|
128
|
+
alertInfoTitle.textContent = title;
|
129
|
+
//Icon
|
130
|
+
icon = this.GetIcon(title, icon, 'bi-info-circle fa-beat');
|
131
|
+
var alertInfoIcon = document.getElementById('alert-info-icon');
|
132
|
+
this.SetIcon(alertInfoIcon, icon);
|
133
|
+
//Message
|
134
|
+
if (!message)
|
135
|
+
message = '';
|
136
|
+
var alertInfoBody = document.getElementById('alert-info-message');
|
137
|
+
alertInfoBody.innerHTML = message;
|
138
|
+
//Toast
|
139
|
+
var alertInfo = document.getElementById('alert-info');
|
140
|
+
this.SetAutoHide(alertInfo, autohide);
|
141
|
+
var toast = bootstrap.Toast.getOrCreateInstance(alertInfo);
|
142
|
+
toast.show();
|
143
|
+
};
|
144
|
+
/** */
|
145
|
+
CoerAlert_1.prototype.Warning = function (message, title, icon, autohide) {
|
146
|
+
if (message === void 0) { message = null; }
|
147
|
+
if (title === void 0) { title = null; }
|
148
|
+
if (icon === void 0) { icon = null; }
|
149
|
+
if (autohide === void 0) { autohide = 3000; }
|
150
|
+
//Title
|
151
|
+
if (!title || title == '')
|
152
|
+
title = 'Warning';
|
153
|
+
var alertWarningTitle = document.getElementById('alert-warning-title');
|
154
|
+
alertWarningTitle.textContent = title;
|
155
|
+
//Icon
|
156
|
+
icon = this.GetIcon(title, icon, 'bi-exclamation-triangle-fill fa-beat');
|
157
|
+
var alertWarningIcon = document.getElementById('alert-warning-icon');
|
158
|
+
this.SetIcon(alertWarningIcon, icon);
|
159
|
+
//Message
|
160
|
+
if (!message)
|
161
|
+
message = '';
|
162
|
+
var alertWarningBody = document.getElementById('alert-warning-message');
|
163
|
+
alertWarningBody.innerHTML = message;
|
164
|
+
//Toast
|
165
|
+
var alertWarning = document.getElementById('alert-warning');
|
166
|
+
this.SetAutoHide(alertWarning, autohide);
|
167
|
+
var toast = bootstrap.Toast.getOrCreateInstance(alertWarning);
|
168
|
+
toast.show();
|
169
|
+
};
|
170
|
+
/** */
|
171
|
+
CoerAlert_1.prototype.Close = function (alert) {
|
172
|
+
return new Promise(function (Resolve) {
|
173
|
+
var element = document.getElementById(alert);
|
174
|
+
var toast = bootstrap.Toast.getOrCreateInstance(element);
|
175
|
+
toast.hide();
|
176
|
+
setTimeout(function () { Resolve(); }, 200);
|
177
|
+
});
|
178
|
+
};
|
179
|
+
/** */
|
180
|
+
CoerAlert_1.prototype.Confirm = function (message, alertType, icon) {
|
181
|
+
if (message === void 0) { message = 'Proceed?'; }
|
182
|
+
if (alertType === void 0) { alertType = 'warning'; }
|
183
|
+
if (icon === void 0) { icon = null; }
|
184
|
+
return new Promise(function (Resolve) {
|
185
|
+
var color;
|
186
|
+
var iconType;
|
187
|
+
switch (alertType) {
|
188
|
+
case 'danger':
|
189
|
+
{
|
190
|
+
if (icon == null)
|
191
|
+
icon = 'bi-exclamation-octagon';
|
192
|
+
iconType = 'error';
|
193
|
+
color = '#dc3545';
|
194
|
+
break;
|
195
|
+
}
|
196
|
+
;
|
197
|
+
case 'success':
|
198
|
+
{
|
199
|
+
if (icon == null)
|
200
|
+
icon = 'bi-check-circle';
|
201
|
+
iconType = 'info';
|
202
|
+
color = '#198754';
|
203
|
+
break;
|
204
|
+
}
|
205
|
+
;
|
206
|
+
case 'info':
|
207
|
+
{
|
208
|
+
if (icon == null)
|
209
|
+
icon = 'bi-info-circle';
|
210
|
+
iconType = 'error';
|
211
|
+
color = '#0d6efd';
|
212
|
+
break;
|
213
|
+
}
|
214
|
+
;
|
215
|
+
default: {
|
216
|
+
if (icon == null)
|
217
|
+
icon = 'bi-exclamation-triangle-fill';
|
218
|
+
iconType = 'warning';
|
219
|
+
color = '#ffc107';
|
220
|
+
break;
|
221
|
+
}
|
222
|
+
}
|
223
|
+
switch (icon) {
|
224
|
+
case 'delete':
|
225
|
+
icon = 'fa-regular fa-trash-can';
|
226
|
+
break;
|
227
|
+
}
|
228
|
+
sweetalert2_1.default.fire({
|
229
|
+
icon: iconType,
|
230
|
+
iconColor: 'transparent',
|
231
|
+
iconHtml: "<i class=\"".concat(icon, "\" style=\"color: ").concat(color, ";\"></i>"),
|
232
|
+
html: message,
|
233
|
+
showConfirmButton: true,
|
234
|
+
confirmButtonText: 'Yes',
|
235
|
+
confirmButtonColor: color,
|
236
|
+
focusConfirm: true,
|
237
|
+
showDenyButton: true,
|
238
|
+
denyButtonColor: color,
|
239
|
+
focusDeny: false,
|
240
|
+
reverseButtons: true,
|
241
|
+
allowOutsideClick: false,
|
242
|
+
allowEscapeKey: false,
|
243
|
+
allowEnterKey: true,
|
244
|
+
customClass: {
|
245
|
+
denyButton: 'sweet-alert-button',
|
246
|
+
confirmButton: 'sweet-alert-button'
|
247
|
+
}
|
248
|
+
}).then(function (_a) {
|
249
|
+
var value = _a.value;
|
250
|
+
return setTimeout(function () { return Resolve(value); });
|
251
|
+
});
|
252
|
+
});
|
253
|
+
};
|
254
|
+
/** */
|
255
|
+
CoerAlert_1.prototype.SetIcon = function (element, icon) {
|
256
|
+
for (var _i = 0, _a = __spreadArray([], element.classList.value.split(' '), true); _i < _a.length; _i++) {
|
257
|
+
var item = _a[_i];
|
258
|
+
if (item.length > 0) {
|
259
|
+
element.classList.remove(item);
|
260
|
+
element.classList.remove('q');
|
261
|
+
}
|
262
|
+
}
|
263
|
+
icon = icon.trim();
|
264
|
+
var hasWhiteSpaces = / /;
|
265
|
+
if (hasWhiteSpaces.test(icon)) {
|
266
|
+
var classes = icon.split(' ');
|
267
|
+
for (var _b = 0, classes_1 = classes; _b < classes_1.length; _b++) {
|
268
|
+
var icon_1 = classes_1[_b];
|
269
|
+
element.classList.add(icon_1);
|
270
|
+
}
|
271
|
+
}
|
272
|
+
else
|
273
|
+
element.classList.add(icon);
|
274
|
+
};
|
275
|
+
/** */
|
276
|
+
CoerAlert_1.prototype.SetAutoHide = function (element, autohide) {
|
277
|
+
element.removeAttribute('data-bs-autohide');
|
278
|
+
element.removeAttribute('data-bs-delay');
|
279
|
+
if (autohide && autohide > 0) {
|
280
|
+
if (autohide < 1000)
|
281
|
+
autohide = 1000;
|
282
|
+
element.setAttribute('data-bs-autohide', 'true');
|
283
|
+
element.setAttribute('data-bs-delay', String(autohide));
|
284
|
+
}
|
285
|
+
else
|
286
|
+
element.setAttribute('data-bs-autohide', 'false');
|
287
|
+
};
|
288
|
+
/** */
|
289
|
+
CoerAlert_1.prototype.GetIcon = function (title, icon, iconDefault) {
|
290
|
+
if (icon == null || icon == '') {
|
291
|
+
title = title.replaceAll(' ', '').toUpperCase();
|
292
|
+
switch (title) {
|
293
|
+
case 'ENABLED': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
|
294
|
+
case 'ACTIVE': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
|
295
|
+
case 'ACTIVED': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
|
296
|
+
case 'DISABLE': return 'fa-solid fa-thumbs-down fa-flip-horizontal';
|
297
|
+
case 'DISABLED': return 'fa-solid fa-thumbs-down fa-flip-horizontal';
|
298
|
+
case 'DELETE': return 'fa-regular fa-trash-can';
|
299
|
+
case 'DELETED': return 'fa-regular fa-trash-can';
|
300
|
+
default: return iconDefault;
|
301
|
+
}
|
302
|
+
}
|
303
|
+
return icon;
|
304
|
+
};
|
305
|
+
return CoerAlert_1;
|
306
|
+
}());
|
307
|
+
__setFunctionName(_classThis, "CoerAlert");
|
308
|
+
(function () {
|
309
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
310
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
311
|
+
CoerAlert = _classThis = _classDescriptor.value;
|
312
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
313
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
314
|
+
})();
|
315
|
+
return CoerAlert = _classThis;
|
316
|
+
}();
|
317
|
+
exports.CoerAlert = CoerAlert;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./Tools/Breadcrumbs.class"), exports);
|
18
|
+
__exportStar(require("./Tools/ControlValue"), exports);
|
19
|
+
__exportStar(require("./Tools/DateTime.class"), exports);
|
20
|
+
__exportStar(require("./Tools/Files.class"), exports);
|
21
|
+
__exportStar(require("./Tools/Page.class"), exports);
|
22
|
+
__exportStar(require("./Tools/Screen.class"), exports);
|
23
|
+
__exportStar(require("./Tools/Source.class"), exports);
|
24
|
+
__exportStar(require("./Tools/Tools"), exports);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "coer-elements",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.18",
|
4
4
|
"author": "Christian Omar Escamilla Rodríguez",
|
5
5
|
"keywords": [
|
6
6
|
"coer",
|
@@ -23,11 +23,12 @@
|
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
25
|
"@angular/animations": "^17.3.0",
|
26
|
-
"@angular/cdk": "^17.3.
|
26
|
+
"@angular/cdk": "^17.3.3",
|
27
27
|
"@angular/common": "^17.3.0",
|
28
28
|
"@angular/compiler": "^17.3.0",
|
29
29
|
"@angular/core": "^17.3.0",
|
30
30
|
"@angular/forms": "^17.3.0",
|
31
|
+
"@angular/material": "^17.3.3",
|
31
32
|
"@angular/platform-browser": "^17.3.0",
|
32
33
|
"@angular/platform-browser-dynamic": "^17.3.0",
|
33
34
|
"@angular/router": "^17.3.0",
|
@@ -38,13 +39,16 @@
|
|
38
39
|
"guid-typescript": "^1.0.9",
|
39
40
|
"moment": "^2.30.1",
|
40
41
|
"rxjs": "^7.8.1",
|
41
|
-
"sweetalert2": "^11.13
|
42
|
+
"sweetalert2": "^11.6.13",
|
42
43
|
"xlsx": "^0.18.5",
|
43
44
|
"zone.js": "^0.14.3"
|
44
45
|
},
|
45
46
|
"devDependencies": {
|
47
|
+
"@angular-devkit/build-angular": "^17.3.3",
|
48
|
+
"@angular/cli": "^17.3.3",
|
49
|
+
"@angular/compiler-cli": "^17.3.0",
|
46
50
|
"@types/bootstrap": "^5.2.10",
|
47
|
-
"@types/xlsx": "^0.0.
|
48
|
-
"typescript": "^5.
|
51
|
+
"@types/xlsx": "^0.0.35",
|
52
|
+
"typescript": "^5.4.2"
|
49
53
|
}
|
50
54
|
}
|