@bizy/core 20.1.0 → 20.1.1
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/fesm2022/bizy-core.mjs +31 -9
- package/fesm2022/bizy-core.mjs.map +1 -1
- package/index.d.ts +4 -1
- package/package.json +1 -1
- package/styles/toast.css +4 -2
package/fesm2022/bizy-core.mjs
CHANGED
|
@@ -6667,7 +6667,7 @@ var TOAST;
|
|
|
6667
6667
|
class BizyToastService {
|
|
6668
6668
|
#document = inject(DOCUMENT);
|
|
6669
6669
|
#dialog = inject(Dialog);
|
|
6670
|
-
static toasts =
|
|
6670
|
+
static toasts = [];
|
|
6671
6671
|
duration = 3000;
|
|
6672
6672
|
defaultDebugTitle = 'Ha sucedido un evento';
|
|
6673
6673
|
defaultInfoTitle = 'Observación';
|
|
@@ -6694,8 +6694,30 @@ class BizyToastService {
|
|
|
6694
6694
|
disableClose: false,
|
|
6695
6695
|
panelClass: ['bizy-toast', 'bizy-toast--in']
|
|
6696
6696
|
});
|
|
6697
|
-
|
|
6697
|
+
setTimeout(() => {
|
|
6698
|
+
const container = this.#document.getElementById(id);
|
|
6699
|
+
if (!container || !container.parentElement) {
|
|
6700
|
+
return;
|
|
6701
|
+
}
|
|
6702
|
+
const offset = this.#calculateOffset();
|
|
6703
|
+
container.parentElement.style.top = `${offset}px`;
|
|
6704
|
+
_a.toasts.push({ ref: toastRef, element: container.parentElement });
|
|
6705
|
+
}, 100);
|
|
6698
6706
|
}
|
|
6707
|
+
#calculateOffset = () => {
|
|
6708
|
+
let offset = 10;
|
|
6709
|
+
for (const toast of _a.toasts) {
|
|
6710
|
+
offset += toast.element.offsetHeight + 10;
|
|
6711
|
+
}
|
|
6712
|
+
return offset;
|
|
6713
|
+
};
|
|
6714
|
+
#repositionToasts = () => {
|
|
6715
|
+
let offset = 10;
|
|
6716
|
+
for (const toast of _a.toasts) {
|
|
6717
|
+
toast.element.style.top = `${offset}px`;
|
|
6718
|
+
offset += toast.element.offsetHeight + 10;
|
|
6719
|
+
}
|
|
6720
|
+
};
|
|
6699
6721
|
config(data) {
|
|
6700
6722
|
if (!data) {
|
|
6701
6723
|
return;
|
|
@@ -6739,14 +6761,14 @@ class BizyToastService {
|
|
|
6739
6761
|
if (!id) {
|
|
6740
6762
|
return;
|
|
6741
6763
|
}
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
toastRef.addPanelClass('bizy-toast--out');
|
|
6764
|
+
const toast = _a.toasts.find(_toastRef => _toastRef.ref.id === id);
|
|
6765
|
+
if (toast.ref) {
|
|
6766
|
+
toast.ref.removePanelClass('bizy-toast--in');
|
|
6767
|
+
toast.ref.addPanelClass('bizy-toast--out');
|
|
6747
6768
|
setTimeout(() => {
|
|
6748
|
-
|
|
6749
|
-
_a.toasts.
|
|
6769
|
+
toast.ref.close();
|
|
6770
|
+
_a.toasts = _a.toasts.filter(t => t.ref !== toast.ref);
|
|
6771
|
+
this.#repositionToasts();
|
|
6750
6772
|
}, 500);
|
|
6751
6773
|
}
|
|
6752
6774
|
};
|