@kalel1500/kalion-js 0.14.0-beta.1 → 0.15.0-beta.0
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/kalion-js.common.js +30 -68
- package/dist/kalion-js.common.js.map +1 -1
- package/dist/kalion-js.d.ts +18 -27
- package/dist/kalion-js.js +30 -67
- package/dist/kalion-js.js.map +1 -1
- package/package.json +1 -1
package/dist/kalion-js.common.js
CHANGED
|
@@ -440,22 +440,6 @@ var Component = class {
|
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
//#endregion
|
|
443
|
-
//#region src/app/exceptions/CannotOpenModalException.ts
|
|
444
|
-
var CannotOpenModalException = class extends Error {
|
|
445
|
-
constructor(msg) {
|
|
446
|
-
super(msg);
|
|
447
|
-
this.name = "CannotOpenModalException";
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
//#endregion
|
|
451
|
-
//#region src/app/exceptions/CannotOpenModalWarning.ts
|
|
452
|
-
var CannotOpenModalWarning = class extends Error {
|
|
453
|
-
constructor(msg) {
|
|
454
|
-
super(msg);
|
|
455
|
-
this.name = "CannotOpenModalWarning";
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
//#endregion
|
|
459
443
|
//#region src/app/exceptions/InvalidValueException.ts
|
|
460
444
|
var InvalidValueException = class extends Error {
|
|
461
445
|
constructor(message) {
|
|
@@ -4441,26 +4425,20 @@ var SModal = class SModal {
|
|
|
4441
4425
|
static colorRed = "#d33";
|
|
4442
4426
|
static colorGray = "#aaa";
|
|
4443
4427
|
static isPendingLoading = false;
|
|
4444
|
-
static
|
|
4445
|
-
if (g.errorModalIsShowed)
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
return callback();
|
|
4451
|
-
} catch (e) {
|
|
4452
|
-
if (e instanceof CannotOpenModalException || e instanceof CannotOpenModalWarning) g.consoleInfo(e.message);
|
|
4453
|
-
else throw e;
|
|
4454
|
-
return Promise.reject();
|
|
4428
|
+
static tryOpen(callback, { isUpdate = false, ignorePendingLoading = false } = {}) {
|
|
4429
|
+
if (g.errorModalIsShowed) {
|
|
4430
|
+
g.consoleInfo("Se ha intentado abrir un modal cuando hay un modal de error abierto");
|
|
4431
|
+
const rejected = Promise.reject();
|
|
4432
|
+
rejected.catch(() => {});
|
|
4433
|
+
return rejected;
|
|
4455
4434
|
}
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
if (e instanceof CannotOpenModalException || e instanceof CannotOpenModalWarning) g.consoleInfo(e.message);
|
|
4462
|
-
else throw e;
|
|
4435
|
+
if (!ignorePendingLoading && !isUpdate && SModal.isPendingLoading) {
|
|
4436
|
+
g.consoleInfo("Se ha intentado abrir un modal cuando hay un modal de loading pendiente");
|
|
4437
|
+
const rejected = Promise.reject();
|
|
4438
|
+
rejected.catch(() => {});
|
|
4439
|
+
return rejected;
|
|
4463
4440
|
}
|
|
4441
|
+
return callback();
|
|
4464
4442
|
}
|
|
4465
4443
|
static Toast = import_sweetalert2.default.mixin({
|
|
4466
4444
|
toast: true,
|
|
@@ -4474,8 +4452,7 @@ var SModal = class SModal {
|
|
|
4474
4452
|
}
|
|
4475
4453
|
});
|
|
4476
4454
|
static toastInfo(options = {}) {
|
|
4477
|
-
return
|
|
4478
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4455
|
+
return this.tryOpen(() => {
|
|
4479
4456
|
return SModal.Toast.fire({
|
|
4480
4457
|
icon: "info",
|
|
4481
4458
|
title: "Your work has been saved",
|
|
@@ -4484,8 +4461,7 @@ var SModal = class SModal {
|
|
|
4484
4461
|
});
|
|
4485
4462
|
}
|
|
4486
4463
|
static toastSuccess(options = {}) {
|
|
4487
|
-
return
|
|
4488
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4464
|
+
return this.tryOpen(() => {
|
|
4489
4465
|
return SModal.Toast.fire({
|
|
4490
4466
|
icon: "success",
|
|
4491
4467
|
title: "Your work has been saved",
|
|
@@ -4494,8 +4470,7 @@ var SModal = class SModal {
|
|
|
4494
4470
|
});
|
|
4495
4471
|
}
|
|
4496
4472
|
static toastError(options = {}) {
|
|
4497
|
-
return
|
|
4498
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4473
|
+
return this.tryOpen(() => {
|
|
4499
4474
|
return SModal.Toast.fire({
|
|
4500
4475
|
icon: "error",
|
|
4501
4476
|
title: "Something error occurred",
|
|
@@ -4504,8 +4479,7 @@ var SModal = class SModal {
|
|
|
4504
4479
|
});
|
|
4505
4480
|
}
|
|
4506
4481
|
static toastBottom(options = {}) {
|
|
4507
|
-
return
|
|
4508
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4482
|
+
return this.tryOpen(() => {
|
|
4509
4483
|
return SModal.Toast.fire({
|
|
4510
4484
|
icon: "success",
|
|
4511
4485
|
title: "Your work has been saved",
|
|
@@ -4520,8 +4494,7 @@ var SModal = class SModal {
|
|
|
4520
4494
|
* del objeto los sobreescribe directamente.
|
|
4521
4495
|
*/
|
|
4522
4496
|
static toastBoth({ success, iconOk = "success", iconNok = "error", titleOk = "Your work has been saved", titleNok = "Something error occurred", timerOk = 3e3, timerNok = 4e3, ...swalOptions }) {
|
|
4523
|
-
return
|
|
4524
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4497
|
+
return this.tryOpen(() => {
|
|
4525
4498
|
return SModal.Toast.fire({
|
|
4526
4499
|
icon: success ? iconOk : iconNok,
|
|
4527
4500
|
title: success ? titleOk : titleNok,
|
|
@@ -4532,14 +4505,12 @@ var SModal = class SModal {
|
|
|
4532
4505
|
});
|
|
4533
4506
|
}
|
|
4534
4507
|
static basic(options = {}) {
|
|
4535
|
-
return
|
|
4536
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4508
|
+
return this.tryOpen(() => {
|
|
4537
4509
|
return import_sweetalert2.default.fire(options);
|
|
4538
4510
|
});
|
|
4539
4511
|
}
|
|
4540
4512
|
static success(options = {}) {
|
|
4541
|
-
return
|
|
4542
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4513
|
+
return this.tryOpen(() => {
|
|
4543
4514
|
return import_sweetalert2.default.fire({
|
|
4544
4515
|
icon: "success",
|
|
4545
4516
|
title: "Correcto",
|
|
@@ -4552,8 +4523,7 @@ var SModal = class SModal {
|
|
|
4552
4523
|
});
|
|
4553
4524
|
}
|
|
4554
4525
|
static error(options = {}, ignorePendingLoading = false) {
|
|
4555
|
-
return
|
|
4556
|
-
SModal.mustAbortIfIsAlreadyOpen({ ignorePendingLoading });
|
|
4526
|
+
return this.tryOpen(() => {
|
|
4557
4527
|
return import_sweetalert2.default.fire({
|
|
4558
4528
|
icon: "error",
|
|
4559
4529
|
title: "Ups... Algo ha ido mal",
|
|
@@ -4563,11 +4533,10 @@ var SModal = class SModal {
|
|
|
4563
4533
|
allowOutsideClick: false,
|
|
4564
4534
|
...options
|
|
4565
4535
|
});
|
|
4566
|
-
});
|
|
4536
|
+
}, { ignorePendingLoading });
|
|
4567
4537
|
}
|
|
4568
4538
|
static confirm(options = {}) {
|
|
4569
|
-
return
|
|
4570
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4539
|
+
return this.tryOpen(() => {
|
|
4571
4540
|
return import_sweetalert2.default.fire({
|
|
4572
4541
|
title: "Confirmar",
|
|
4573
4542
|
html: "¿Seguro que quieres realizar la acción?",
|
|
@@ -4584,8 +4553,7 @@ var SModal = class SModal {
|
|
|
4584
4553
|
});
|
|
4585
4554
|
}
|
|
4586
4555
|
static loading(options = {}) {
|
|
4587
|
-
return
|
|
4588
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4556
|
+
return this.tryOpen(() => {
|
|
4589
4557
|
SModal.isPendingLoading = true;
|
|
4590
4558
|
const callerWillOpen = options.willOpen;
|
|
4591
4559
|
const willOpen = async (popup) => {
|
|
@@ -4604,8 +4572,7 @@ var SModal = class SModal {
|
|
|
4604
4572
|
});
|
|
4605
4573
|
}
|
|
4606
4574
|
static doActionWhileLoading({ ajaxUrl, ajaxType, ajaxParams, footerOnFail, ...swalOptions }) {
|
|
4607
|
-
return
|
|
4608
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4575
|
+
return this.tryOpen(() => {
|
|
4609
4576
|
SModal.isPendingLoading = true;
|
|
4610
4577
|
return import_sweetalert2.default.fire({
|
|
4611
4578
|
title: "Calculando...",
|
|
@@ -4644,8 +4611,7 @@ var SModal = class SModal {
|
|
|
4644
4611
|
});
|
|
4645
4612
|
}
|
|
4646
4613
|
static confirmAfterFetchSuccess({ ajaxUrl, ajaxType = "GET", ajaxParams, footerOnFail, ...swalOptions }) {
|
|
4647
|
-
return
|
|
4648
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4614
|
+
return this.tryOpen(() => {
|
|
4649
4615
|
return import_sweetalert2.default.fire({
|
|
4650
4616
|
title: "Confirmar",
|
|
4651
4617
|
width: 850,
|
|
@@ -4687,11 +4653,10 @@ var SModal = class SModal {
|
|
|
4687
4653
|
});
|
|
4688
4654
|
}
|
|
4689
4655
|
static update({ hideLoading, ...swalOptions } = {}) {
|
|
4690
|
-
|
|
4691
|
-
SModal.mustAbortIfIsAlreadyOpen({ isUpdate: true });
|
|
4656
|
+
this.tryOpen(() => {
|
|
4692
4657
|
if (hideLoading === true) import_sweetalert2.default.hideLoading();
|
|
4693
4658
|
import_sweetalert2.default.update(swalOptions);
|
|
4694
|
-
});
|
|
4659
|
+
}, { isUpdate: true });
|
|
4695
4660
|
}
|
|
4696
4661
|
static updateSuccess(options = {}) {
|
|
4697
4662
|
SModal.update({
|
|
@@ -4714,8 +4679,7 @@ var SModal = class SModal {
|
|
|
4714
4679
|
});
|
|
4715
4680
|
}
|
|
4716
4681
|
static input({ liveValidationEnabled = false, getValidationMessage = () => null, preConfirm_url, preConfirm_type = "GET", preConfirm_params = {}, preConfirm_inputParamName = void 0, preConfirm_keepOpenOnSuccess = false, preConfirm_ajaxOkCode = void 0, ...swalOptions }) {
|
|
4717
|
-
return
|
|
4718
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4682
|
+
return this.tryOpen(() => {
|
|
4719
4683
|
const inputId = swalOptions.inputAttributes?.["data-id"] ?? "inpName";
|
|
4720
4684
|
const inputType = swalOptions.input ?? "textarea";
|
|
4721
4685
|
const inputPassValidation = (value) => getValidationMessage(value) === null;
|
|
@@ -4801,8 +4765,7 @@ var SModal = class SModal {
|
|
|
4801
4765
|
});
|
|
4802
4766
|
}
|
|
4803
4767
|
static blade({ ajaxUrl, jsActionsInModal = () => {}, funcParam = {}, ...swalOptions }) {
|
|
4804
|
-
return
|
|
4805
|
-
SModal.mustAbortIfIsAlreadyOpen();
|
|
4768
|
+
return this.tryOpen(() => {
|
|
4806
4769
|
return import_sweetalert2.default.fire({
|
|
4807
4770
|
width: 850,
|
|
4808
4771
|
showConfirmButton: false,
|
|
@@ -6493,8 +6456,6 @@ var UtilitiesServiceProvider = class {
|
|
|
6493
6456
|
//#endregion
|
|
6494
6457
|
exports.AlertType = AlertType;
|
|
6495
6458
|
exports.Btn = Btn;
|
|
6496
|
-
exports.CannotOpenModalException = CannotOpenModalException;
|
|
6497
|
-
exports.CannotOpenModalWarning = CannotOpenModalWarning;
|
|
6498
6459
|
exports.CheckableProcess = CheckableProcess;
|
|
6499
6460
|
exports.Component = Component;
|
|
6500
6461
|
exports.Constants = Constants;
|
|
@@ -6529,5 +6490,6 @@ exports.Ttable = Ttable;
|
|
|
6529
6490
|
exports.Url = Url;
|
|
6530
6491
|
exports.UtilitiesServiceProvider = UtilitiesServiceProvider;
|
|
6531
6492
|
exports.g = g;
|
|
6493
|
+
exports.handleFlowbiteInit = handleFlowbiteInit;
|
|
6532
6494
|
|
|
6533
6495
|
//# sourceMappingURL=kalion-js.common.js.map
|