@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
|
@@ -16709,6 +16709,9 @@ var Bi = class {
|
|
|
16709
16709
|
constructor(e, t) {
|
|
16710
16710
|
this._dialogID = e, this._dialogEl = t, this._afterOpenedCallback = null, this._afterClosedCallback = null, this._disableClose = !1, this._handleCancel = this.onCancel.bind(this), this._handleBackdropClick = this.onBackdropClick.bind(this), this._dialogEl.addEventListener("cancel", this._handleCancel), this._dialogEl.addEventListener("click", this._handleBackdropClick);
|
|
16711
16711
|
}
|
|
16712
|
+
updateDialogElement(e) {
|
|
16713
|
+
this._dialogEl.removeEventListener("cancel", this._handleCancel), this._dialogEl.removeEventListener("click", this._handleBackdropClick), this._dialogEl = e, this._dialogEl.addEventListener("cancel", this._handleCancel), this._dialogEl.addEventListener("click", this._handleBackdropClick);
|
|
16714
|
+
}
|
|
16712
16715
|
get dialogID() {
|
|
16713
16716
|
return this._dialogID;
|
|
16714
16717
|
}
|
|
@@ -16774,16 +16777,19 @@ var Bi = class {
|
|
|
16774
16777
|
return a.dialogRef.open(), a.dialogRef;
|
|
16775
16778
|
}
|
|
16776
16779
|
findDialogElement(t) {
|
|
16777
|
-
|
|
16780
|
+
for (const r of document.body.querySelectorAll("*")) if (r.shadowRoot) {
|
|
16781
|
+
const l = this.deepFindDialog(r, t);
|
|
16782
|
+
if (l) return l;
|
|
16783
|
+
}
|
|
16784
|
+
return null;
|
|
16778
16785
|
}
|
|
16779
16786
|
deepFindDialog(t, r) {
|
|
16780
16787
|
const l = t.shadowRoot;
|
|
16781
|
-
if (l)
|
|
16782
|
-
|
|
16783
|
-
|
|
16784
|
-
|
|
16785
|
-
|
|
16786
|
-
}
|
|
16788
|
+
if (!l) return null;
|
|
16789
|
+
for (const a of l.querySelectorAll("ml-dialog")) if (a.hasAttribute(`#${r}`)) return a;
|
|
16790
|
+
for (const a of l.querySelectorAll("*")) if (a.shadowRoot) {
|
|
16791
|
+
const o = this.deepFindDialog(a, r);
|
|
16792
|
+
if (o) return o;
|
|
16787
16793
|
}
|
|
16788
16794
|
return null;
|
|
16789
16795
|
}
|
|
@@ -16806,6 +16812,9 @@ var nr, Re = class {
|
|
|
16806
16812
|
constructor() {
|
|
16807
16813
|
this._dialogID = Zl(), this._registered = !1;
|
|
16808
16814
|
}
|
|
16815
|
+
onCreate() {
|
|
16816
|
+
this.registerDialog();
|
|
16817
|
+
}
|
|
16809
16818
|
registerDialog() {
|
|
16810
16819
|
if (this._registered) return;
|
|
16811
16820
|
const t = this.elementRef.shadowRoot?.querySelector("dialog");
|
|
@@ -16815,7 +16824,9 @@ var nr, Re = class {
|
|
|
16815
16824
|
this._dialogService.removeDialog(this._dialogID);
|
|
16816
16825
|
}
|
|
16817
16826
|
open() {
|
|
16818
|
-
this.registerDialog()
|
|
16827
|
+
this.registerDialog();
|
|
16828
|
+
const t = this.elementRef.shadowRoot?.querySelector("dialog");
|
|
16829
|
+
t && t !== this._dialogEl && (this._dialogEl = t, this._dialogRef.updateDialogElement(t)), this._dialogRef.open();
|
|
16819
16830
|
}
|
|
16820
16831
|
close(t) {
|
|
16821
16832
|
this._dialogRef.close(t);
|
|
@@ -2,7 +2,7 @@ import type { UniqueID } from '../../../functions';
|
|
|
2
2
|
import type { IDialogConfig } from './dialog-config.interface';
|
|
3
3
|
export declare class DialogRef<TResult = unknown, TData = unknown> {
|
|
4
4
|
private readonly _dialogID;
|
|
5
|
-
private
|
|
5
|
+
private _dialogEl;
|
|
6
6
|
private _afterOpenedCallback;
|
|
7
7
|
private _afterClosedCallback;
|
|
8
8
|
private _data;
|
|
@@ -10,6 +10,7 @@ export declare class DialogRef<TResult = unknown, TData = unknown> {
|
|
|
10
10
|
private readonly _handleCancel;
|
|
11
11
|
private readonly _handleBackdropClick;
|
|
12
12
|
constructor(_dialogID: UniqueID, _dialogEl: HTMLDialogElement);
|
|
13
|
+
updateDialogElement(dialogEl: HTMLDialogElement): void;
|
|
13
14
|
get dialogID(): UniqueID;
|
|
14
15
|
get data(): TData | undefined;
|
|
15
16
|
get disableClose(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-ref.class.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dialog/dialog-ref.class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,qBAAa,SAAS,CAAC,OAAO,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO;IASvD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"dialog-ref.class.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dialog/dialog-ref.class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,qBAAa,SAAS,CAAC,OAAO,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO;IASvD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,SAAS;IATlB,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,oBAAoB,CAAwD;IACpF,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAmC;gBAGtD,SAAS,EAAE,QAAQ,EAC5B,SAAS,EAAE,iBAAiB;IAMrC,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAUtD,IAAI,QAAQ,IAAI,QAAQ,CAEvB;IAED,IAAI,IAAI,IAAI,KAAK,GAAG,SAAS,CAE5B;IAED,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI;IAyB/C,IAAI,IAAI,IAAI;IAKZ,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAK7B,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAIvC,WAAW,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,KAAK,IAAI,GAAG,IAAI;IAIlE,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,eAAe;CAKvB"}
|
|
@@ -10,6 +10,13 @@ export class DialogRef {
|
|
|
10
10
|
this._dialogEl.addEventListener('cancel', this._handleCancel);
|
|
11
11
|
this._dialogEl.addEventListener('click', this._handleBackdropClick);
|
|
12
12
|
}
|
|
13
|
+
updateDialogElement(dialogEl) {
|
|
14
|
+
this._dialogEl.removeEventListener('cancel', this._handleCancel);
|
|
15
|
+
this._dialogEl.removeEventListener('click', this._handleBackdropClick);
|
|
16
|
+
this._dialogEl = dialogEl;
|
|
17
|
+
this._dialogEl.addEventListener('cancel', this._handleCancel);
|
|
18
|
+
this._dialogEl.addEventListener('click', this._handleBackdropClick);
|
|
19
|
+
}
|
|
13
20
|
get dialogID() {
|
|
14
21
|
return this._dialogID;
|
|
15
22
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { OnDestroy, IElementRef } from '@melodicdev/core';
|
|
2
|
-
export declare class DialogComponent implements IElementRef, OnDestroy {
|
|
1
|
+
import type { OnCreate, OnDestroy, IElementRef } from '@melodicdev/core';
|
|
2
|
+
export declare class DialogComponent implements IElementRef, OnCreate, OnDestroy {
|
|
3
3
|
elementRef: HTMLElement;
|
|
4
4
|
private readonly _dialogService;
|
|
5
5
|
private _dialogID;
|
|
6
6
|
private _dialogEl;
|
|
7
7
|
private _dialogRef;
|
|
8
8
|
private _registered;
|
|
9
|
+
onCreate(): void;
|
|
9
10
|
private registerDialog;
|
|
10
11
|
onDestroy(): void;
|
|
11
12
|
open(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.component.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dialog/dialog.component.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"dialog.component.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dialog/dialog.component.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKzE,qBAMa,eAAgB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IAChE,UAAU,EAAG,WAAW,CAAC;IAGhC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAEhD,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,WAAW,CAAS;IAE5B,QAAQ,IAAI,IAAI;IAIhB,OAAO,CAAC,cAAc;IAatB,SAAS,IAAI,IAAI;IAIjB,IAAI,IAAI,IAAI;IAaZ,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI;IAIpC,OAAO,CAAC,cAAc;CAQtB"}
|
|
@@ -17,6 +17,9 @@ let DialogComponent = class DialogComponent {
|
|
|
17
17
|
this._dialogID = newID();
|
|
18
18
|
this._registered = false;
|
|
19
19
|
}
|
|
20
|
+
onCreate() {
|
|
21
|
+
this.registerDialog();
|
|
22
|
+
}
|
|
20
23
|
registerDialog() {
|
|
21
24
|
if (this._registered)
|
|
22
25
|
return;
|
|
@@ -34,6 +37,11 @@ let DialogComponent = class DialogComponent {
|
|
|
34
37
|
}
|
|
35
38
|
open() {
|
|
36
39
|
this.registerDialog();
|
|
40
|
+
const dialogEl = this.elementRef.shadowRoot?.querySelector('dialog');
|
|
41
|
+
if (dialogEl && dialogEl !== this._dialogEl) {
|
|
42
|
+
this._dialogEl = dialogEl;
|
|
43
|
+
this._dialogRef.updateDialogElement(dialogEl);
|
|
44
|
+
}
|
|
37
45
|
this._dialogRef.open();
|
|
38
46
|
}
|
|
39
47
|
close(result) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.service.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dialog/dialog.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAW/D,qBACa,aAAa;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwC;IAEjE,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,SAAS;IAerE,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAItC,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO,EAAE,eAAe,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,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;IAOxD,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,aAAa;CAGrB"}
|
|
@@ -57,22 +57,30 @@ let DialogService = class DialogService {
|
|
|
57
57
|
return dialogElements.dialogRef;
|
|
58
58
|
}
|
|
59
59
|
findDialogElement(dialogID) {
|
|
60
|
-
|
|
60
|
+
// Traverse all shadow roots starting from document.body's children
|
|
61
|
+
for (const child of document.body.querySelectorAll('*')) {
|
|
62
|
+
if (child.shadowRoot) {
|
|
63
|
+
const result = this.deepFindDialog(child, dialogID);
|
|
64
|
+
if (result)
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
61
69
|
}
|
|
62
70
|
deepFindDialog(root, dialogID) {
|
|
63
71
|
const shadowRoot = root.shadowRoot;
|
|
64
|
-
if (shadowRoot)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
if (!shadowRoot)
|
|
73
|
+
return null;
|
|
74
|
+
for (const el of shadowRoot.querySelectorAll('ml-dialog')) {
|
|
75
|
+
if (el.hasAttribute(`#${dialogID}`)) {
|
|
76
|
+
return el;
|
|
69
77
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
}
|
|
79
|
+
for (const child of shadowRoot.querySelectorAll('*')) {
|
|
80
|
+
if (child.shadowRoot) {
|
|
81
|
+
const result = this.deepFindDialog(child, dialogID);
|
|
82
|
+
if (result)
|
|
83
|
+
return result;
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
86
|
return null;
|