@melodicdev/components 1.0.10 → 1.0.11
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 +30 -0
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.js +81 -55
- package/lib/components/overlays/dialog/dialog.service.d.ts +2 -0
- package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.service.js +45 -0
- package/package.json +1 -1
|
@@ -18609,9 +18609,39 @@ var DialogService = class DialogService$1 {
|
|
|
18609
18609
|
if (config) dialogElements.dialogRef.applyConfig(config);
|
|
18610
18610
|
dialogComponent.component.onDialogRefSet?.(dialogElements.dialogRef);
|
|
18611
18611
|
}
|
|
18612
|
+
if (!dialogElements) {
|
|
18613
|
+
const mlDialog = this.findDialogElement(dialogID);
|
|
18614
|
+
if (mlDialog) {
|
|
18615
|
+
mlDialog.open();
|
|
18616
|
+
dialogElements = this._dialogs.get(dialogID);
|
|
18617
|
+
}
|
|
18618
|
+
if (!dialogElements) throw new Error(`Dialog "${dialogID}" not found. Ensure an <ml-dialog #${dialogID}> exists in the DOM.`);
|
|
18619
|
+
return dialogElements.dialogRef;
|
|
18620
|
+
}
|
|
18612
18621
|
dialogElements.dialogRef.open();
|
|
18613
18622
|
return dialogElements.dialogRef;
|
|
18614
18623
|
}
|
|
18624
|
+
findDialogElement(dialogID) {
|
|
18625
|
+
const allDialogs = document.querySelectorAll("ml-dialog");
|
|
18626
|
+
for (const dialog of allDialogs) if (dialog.hasAttribute(`#${dialogID}`)) return dialog;
|
|
18627
|
+
return this.deepFindDialog(document.body, dialogID);
|
|
18628
|
+
}
|
|
18629
|
+
deepFindDialog(root, dialogID) {
|
|
18630
|
+
const shadowRoot = root.shadowRoot;
|
|
18631
|
+
if (shadowRoot) {
|
|
18632
|
+
const match = shadowRoot.querySelector(`ml-dialog[\\#${dialogID}]`);
|
|
18633
|
+
if (match) return match;
|
|
18634
|
+
for (const child of shadowRoot.querySelectorAll("*")) {
|
|
18635
|
+
const result = this.deepFindDialog(child, dialogID);
|
|
18636
|
+
if (result) return result;
|
|
18637
|
+
}
|
|
18638
|
+
}
|
|
18639
|
+
for (const child of root.querySelectorAll("*")) if (child.shadowRoot) {
|
|
18640
|
+
const result = this.deepFindDialog(child, dialogID);
|
|
18641
|
+
if (result) return result;
|
|
18642
|
+
}
|
|
18643
|
+
return null;
|
|
18644
|
+
}
|
|
18615
18645
|
close(dialogID, result) {
|
|
18616
18646
|
if (this._dialogs.has(dialogID)) this._dialogs.get(dialogID).dialogRef.close(result);
|
|
18617
18647
|
}
|