@iankibetsh/shframework 1.1.8 → 1.1.9
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/dist/dist/library.mjs.css +15 -15
- package/dist/library.js +36 -7
- package/dist/library.mjs +36 -7
- package/package.json +1 -1
|
@@ -63,21 +63,6 @@
|
|
|
63
63
|
color: white;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.sh-selected-item{
|
|
67
|
-
line-height: unset!important;
|
|
68
|
-
}
|
|
69
|
-
.sh-suggestion-input{
|
|
70
|
-
padding: 0.375rem 0.75rem;
|
|
71
|
-
}
|
|
72
|
-
.sh-suggest{
|
|
73
|
-
margin-bottom: 1rem;
|
|
74
|
-
}
|
|
75
|
-
.sh-suggest-control::after{
|
|
76
|
-
margin-top: auto;
|
|
77
|
-
margin-bottom: auto;
|
|
78
|
-
margin-right: 0.255em;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
66
|
:root {
|
|
82
67
|
--ck-z-default: 10555 !important;
|
|
83
68
|
--ck-z-modal: calc(var(--ck-z-default) + 999) !important;
|
|
@@ -99,6 +84,21 @@
|
|
|
99
84
|
}
|
|
100
85
|
}
|
|
101
86
|
|
|
87
|
+
.sh-selected-item{
|
|
88
|
+
line-height: unset!important;
|
|
89
|
+
}
|
|
90
|
+
.sh-suggestion-input{
|
|
91
|
+
padding: 0.375rem 0.75rem;
|
|
92
|
+
}
|
|
93
|
+
.sh-suggest{
|
|
94
|
+
margin-bottom: 1rem;
|
|
95
|
+
}
|
|
96
|
+
.sh-suggest-control::after{
|
|
97
|
+
margin-top: auto;
|
|
98
|
+
margin-bottom: auto;
|
|
99
|
+
margin-right: 0.255em;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
102
|
.sh-forgot-link, .sh-register-link{
|
|
103
103
|
cursor: pointer;
|
|
104
104
|
}
|
package/dist/library.js
CHANGED
|
@@ -209,6 +209,15 @@ function formatDate(date, format) {
|
|
|
209
209
|
}
|
|
210
210
|
return moment__default["default"](date).format(format)
|
|
211
211
|
}
|
|
212
|
+
function formatNumber(amount,decimalPoints = 0){
|
|
213
|
+
return numberFormat(amount,decimalPoints)
|
|
214
|
+
}
|
|
215
|
+
function numberFormat(amount,decimalPoints = 0) {
|
|
216
|
+
let formatted = parseFloat(amount).toFixed(decimalPoints);
|
|
217
|
+
formatted = new Intl.NumberFormat().format(formatted);
|
|
218
|
+
const formattedArr = formatted.split('.');
|
|
219
|
+
return decimalPoints === 0 ? formattedArr[0] : formattedArr[0] +'.' + (formattedArr[1] || '0').padEnd(decimalPoints,0)
|
|
220
|
+
}
|
|
212
221
|
|
|
213
222
|
var shRepo = {
|
|
214
223
|
swalSuccess,
|
|
@@ -221,7 +230,9 @@ var shRepo = {
|
|
|
221
230
|
runSilentRequest,
|
|
222
231
|
swalHttpError,
|
|
223
232
|
formatHttpCatchError,
|
|
224
|
-
formatDate
|
|
233
|
+
formatDate,
|
|
234
|
+
numberFormat,
|
|
235
|
+
formatNumber
|
|
225
236
|
};
|
|
226
237
|
|
|
227
238
|
startSession();
|
|
@@ -232,10 +243,16 @@ function logoutUser(){
|
|
|
232
243
|
ShStorage.removeItem('access_token');
|
|
233
244
|
ShStorage.removeItem('user');
|
|
234
245
|
ShStorage.removeItem('last_activity');
|
|
246
|
+
if(window.shInterval){
|
|
247
|
+
clearInterval(window.shInterval);
|
|
248
|
+
}
|
|
235
249
|
window.location.href = loginUrl;
|
|
236
250
|
}).catch(ex=>{
|
|
237
251
|
ShStorage.removeItem('access_token');
|
|
238
252
|
ShStorage.removeItem('user');
|
|
253
|
+
if(window.shInterval){
|
|
254
|
+
clearInterval(window.shInterval);
|
|
255
|
+
}
|
|
239
256
|
window.location.href = loginUrl;
|
|
240
257
|
});
|
|
241
258
|
ShStorage.getItem('user');
|
|
@@ -248,13 +265,13 @@ const checkSession = function (isCheking) {
|
|
|
248
265
|
const pastSeconds = moment__default["default"]().diff(last_activity, 'seconds');
|
|
249
266
|
if(pastMinutes >= timeout) {
|
|
250
267
|
const gracePeriod = pastSeconds - (timeout * 60);
|
|
251
|
-
if (gracePeriod >=
|
|
268
|
+
if (gracePeriod >= 60 ) {
|
|
252
269
|
logoutUser();
|
|
253
270
|
}
|
|
254
271
|
else {
|
|
255
272
|
if (!window.ShConfirmation)
|
|
256
273
|
{
|
|
257
|
-
window.ShConfirmation = shSwalLogout();
|
|
274
|
+
window.ShConfirmation = shSwalLogout(30);
|
|
258
275
|
}
|
|
259
276
|
}
|
|
260
277
|
}
|
|
@@ -264,23 +281,35 @@ const checkSession = function (isCheking) {
|
|
|
264
281
|
}
|
|
265
282
|
}
|
|
266
283
|
};
|
|
267
|
-
|
|
268
|
-
|
|
284
|
+
async function shSwalLogout (seconds = 30) {
|
|
285
|
+
let timerInterval;
|
|
269
286
|
return Swal__default["default"].fire({
|
|
270
287
|
title: 'Your session is about to Expire!',
|
|
271
|
-
html: 'You will be
|
|
288
|
+
html: 'You will be logged out in <strong></strong> seconds due to inactivity!',
|
|
272
289
|
showCancelButton: true,
|
|
273
290
|
cancelButtonColor: '#32c787',
|
|
274
291
|
confirmButtonColor: '#000',
|
|
275
292
|
cancelButtonText: 'Stay signed in',
|
|
276
293
|
confirmButtonText: 'Sign out now!',
|
|
277
|
-
timer:
|
|
294
|
+
timer: seconds * 1000,
|
|
278
295
|
allowOutsideClick: false,
|
|
279
296
|
reverseButtons: true,
|
|
280
297
|
showLoaderOnConfirm: true,
|
|
298
|
+
didOpen(popup) {
|
|
299
|
+
timerInterval = setInterval(() => {
|
|
300
|
+
Swal__default["default"].getHtmlContainer().querySelector('strong')
|
|
301
|
+
.textContent = (Swal__default["default"].getTimerLeft() / 1000)
|
|
302
|
+
.toFixed(0);
|
|
303
|
+
}, 100);
|
|
304
|
+
},
|
|
305
|
+
willClose: () => {
|
|
306
|
+
clearInterval(timerInterval);
|
|
307
|
+
}
|
|
281
308
|
}).then((result) => {
|
|
282
309
|
if (result.isConfirmed) {
|
|
283
310
|
logoutUser();
|
|
311
|
+
} else if(result.dismiss === 'timer'){
|
|
312
|
+
logoutUser();
|
|
284
313
|
} else {
|
|
285
314
|
window.ShConfirmation = null;
|
|
286
315
|
clearInterval(window.shInterval);
|
package/dist/library.mjs
CHANGED
|
@@ -197,6 +197,15 @@ function formatDate(date, format) {
|
|
|
197
197
|
}
|
|
198
198
|
return moment(date).format(format)
|
|
199
199
|
}
|
|
200
|
+
function formatNumber(amount,decimalPoints = 0){
|
|
201
|
+
return numberFormat(amount,decimalPoints)
|
|
202
|
+
}
|
|
203
|
+
function numberFormat(amount,decimalPoints = 0) {
|
|
204
|
+
let formatted = parseFloat(amount).toFixed(decimalPoints);
|
|
205
|
+
formatted = new Intl.NumberFormat().format(formatted);
|
|
206
|
+
const formattedArr = formatted.split('.');
|
|
207
|
+
return decimalPoints === 0 ? formattedArr[0] : formattedArr[0] +'.' + (formattedArr[1] || '0').padEnd(decimalPoints,0)
|
|
208
|
+
}
|
|
200
209
|
|
|
201
210
|
var shRepo = {
|
|
202
211
|
swalSuccess,
|
|
@@ -209,7 +218,9 @@ var shRepo = {
|
|
|
209
218
|
runSilentRequest,
|
|
210
219
|
swalHttpError,
|
|
211
220
|
formatHttpCatchError,
|
|
212
|
-
formatDate
|
|
221
|
+
formatDate,
|
|
222
|
+
numberFormat,
|
|
223
|
+
formatNumber
|
|
213
224
|
};
|
|
214
225
|
|
|
215
226
|
startSession();
|
|
@@ -220,10 +231,16 @@ function logoutUser(){
|
|
|
220
231
|
ShStorage.removeItem('access_token');
|
|
221
232
|
ShStorage.removeItem('user');
|
|
222
233
|
ShStorage.removeItem('last_activity');
|
|
234
|
+
if(window.shInterval){
|
|
235
|
+
clearInterval(window.shInterval);
|
|
236
|
+
}
|
|
223
237
|
window.location.href = loginUrl;
|
|
224
238
|
}).catch(ex=>{
|
|
225
239
|
ShStorage.removeItem('access_token');
|
|
226
240
|
ShStorage.removeItem('user');
|
|
241
|
+
if(window.shInterval){
|
|
242
|
+
clearInterval(window.shInterval);
|
|
243
|
+
}
|
|
227
244
|
window.location.href = loginUrl;
|
|
228
245
|
});
|
|
229
246
|
ShStorage.getItem('user');
|
|
@@ -236,13 +253,13 @@ const checkSession = function (isCheking) {
|
|
|
236
253
|
const pastSeconds = moment().diff(last_activity, 'seconds');
|
|
237
254
|
if(pastMinutes >= timeout) {
|
|
238
255
|
const gracePeriod = pastSeconds - (timeout * 60);
|
|
239
|
-
if (gracePeriod >=
|
|
256
|
+
if (gracePeriod >= 60 ) {
|
|
240
257
|
logoutUser();
|
|
241
258
|
}
|
|
242
259
|
else {
|
|
243
260
|
if (!window.ShConfirmation)
|
|
244
261
|
{
|
|
245
|
-
window.ShConfirmation = shSwalLogout();
|
|
262
|
+
window.ShConfirmation = shSwalLogout(30);
|
|
246
263
|
}
|
|
247
264
|
}
|
|
248
265
|
}
|
|
@@ -252,23 +269,35 @@ const checkSession = function (isCheking) {
|
|
|
252
269
|
}
|
|
253
270
|
}
|
|
254
271
|
};
|
|
255
|
-
|
|
256
|
-
|
|
272
|
+
async function shSwalLogout (seconds = 30) {
|
|
273
|
+
let timerInterval;
|
|
257
274
|
return Swal.fire({
|
|
258
275
|
title: 'Your session is about to Expire!',
|
|
259
|
-
html: 'You will be
|
|
276
|
+
html: 'You will be logged out in <strong></strong> seconds due to inactivity!',
|
|
260
277
|
showCancelButton: true,
|
|
261
278
|
cancelButtonColor: '#32c787',
|
|
262
279
|
confirmButtonColor: '#000',
|
|
263
280
|
cancelButtonText: 'Stay signed in',
|
|
264
281
|
confirmButtonText: 'Sign out now!',
|
|
265
|
-
timer:
|
|
282
|
+
timer: seconds * 1000,
|
|
266
283
|
allowOutsideClick: false,
|
|
267
284
|
reverseButtons: true,
|
|
268
285
|
showLoaderOnConfirm: true,
|
|
286
|
+
didOpen(popup) {
|
|
287
|
+
timerInterval = setInterval(() => {
|
|
288
|
+
Swal.getHtmlContainer().querySelector('strong')
|
|
289
|
+
.textContent = (Swal.getTimerLeft() / 1000)
|
|
290
|
+
.toFixed(0);
|
|
291
|
+
}, 100);
|
|
292
|
+
},
|
|
293
|
+
willClose: () => {
|
|
294
|
+
clearInterval(timerInterval);
|
|
295
|
+
}
|
|
269
296
|
}).then((result) => {
|
|
270
297
|
if (result.isConfirmed) {
|
|
271
298
|
logoutUser();
|
|
299
|
+
} else if(result.dismiss === 'timer'){
|
|
300
|
+
logoutUser();
|
|
272
301
|
} else {
|
|
273
302
|
window.ShConfirmation = null;
|
|
274
303
|
clearInterval(window.shInterval);
|