@melodicdev/components 1.0.13 → 1.0.15
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/assets/melodic-components.js +25 -7
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.js +19 -8
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts +2 -1
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog-ref.class.js +7 -0
- package/lib/components/overlays/dialog/dialog.component.d.ts +3 -2
- package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.component.js +8 -0
- package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.service.js +20 -12
- package/package.json +1 -1
|
@@ -18538,6 +18538,13 @@ var DialogRef = class {
|
|
|
18538
18538
|
this._dialogEl.addEventListener("cancel", this._handleCancel);
|
|
18539
18539
|
this._dialogEl.addEventListener("click", this._handleBackdropClick);
|
|
18540
18540
|
}
|
|
18541
|
+
updateDialogElement(dialogEl) {
|
|
18542
|
+
this._dialogEl.removeEventListener("cancel", this._handleCancel);
|
|
18543
|
+
this._dialogEl.removeEventListener("click", this._handleBackdropClick);
|
|
18544
|
+
this._dialogEl = dialogEl;
|
|
18545
|
+
this._dialogEl.addEventListener("cancel", this._handleCancel);
|
|
18546
|
+
this._dialogEl.addEventListener("click", this._handleBackdropClick);
|
|
18547
|
+
}
|
|
18541
18548
|
get dialogID() {
|
|
18542
18549
|
return this._dialogID;
|
|
18543
18550
|
}
|
|
@@ -18622,16 +18629,19 @@ var DialogService = class DialogService$1 {
|
|
|
18622
18629
|
return dialogElements.dialogRef;
|
|
18623
18630
|
}
|
|
18624
18631
|
findDialogElement(dialogID) {
|
|
18625
|
-
|
|
18632
|
+
for (const child of document.body.querySelectorAll("*")) if (child.shadowRoot) {
|
|
18633
|
+
const result = this.deepFindDialog(child, dialogID);
|
|
18634
|
+
if (result) return result;
|
|
18635
|
+
}
|
|
18636
|
+
return null;
|
|
18626
18637
|
}
|
|
18627
18638
|
deepFindDialog(root, dialogID) {
|
|
18628
18639
|
const shadowRoot = root.shadowRoot;
|
|
18629
|
-
if (shadowRoot)
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18633
|
-
|
|
18634
|
-
}
|
|
18640
|
+
if (!shadowRoot) return null;
|
|
18641
|
+
for (const el of shadowRoot.querySelectorAll("ml-dialog")) if (el.hasAttribute(`#${dialogID}`)) return el;
|
|
18642
|
+
for (const child of shadowRoot.querySelectorAll("*")) if (child.shadowRoot) {
|
|
18643
|
+
const result = this.deepFindDialog(child, dialogID);
|
|
18644
|
+
if (result) return result;
|
|
18635
18645
|
}
|
|
18636
18646
|
return null;
|
|
18637
18647
|
}
|
|
@@ -18660,6 +18670,9 @@ var DialogComponent = class DialogComponent$1 {
|
|
|
18660
18670
|
this._dialogID = newID();
|
|
18661
18671
|
this._registered = false;
|
|
18662
18672
|
}
|
|
18673
|
+
onCreate() {
|
|
18674
|
+
this.registerDialog();
|
|
18675
|
+
}
|
|
18663
18676
|
registerDialog() {
|
|
18664
18677
|
if (this._registered) return;
|
|
18665
18678
|
const dialogEl = this.elementRef.shadowRoot?.querySelector("dialog");
|
|
@@ -18675,6 +18688,11 @@ var DialogComponent = class DialogComponent$1 {
|
|
|
18675
18688
|
}
|
|
18676
18689
|
open() {
|
|
18677
18690
|
this.registerDialog();
|
|
18691
|
+
const dialogEl = this.elementRef.shadowRoot?.querySelector("dialog");
|
|
18692
|
+
if (dialogEl && dialogEl !== this._dialogEl) {
|
|
18693
|
+
this._dialogEl = dialogEl;
|
|
18694
|
+
this._dialogRef.updateDialogElement(dialogEl);
|
|
18695
|
+
}
|
|
18678
18696
|
this._dialogRef.open();
|
|
18679
18697
|
}
|
|
18680
18698
|
close(result) {
|