From 85e247d4d6df2856ad3738ef4c94647ddc273211 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 23 Mar 2022 09:48:45 -0600 Subject: [PATCH] Legacy dialog - Fix load event was not bubbling through to the listener - Fix value was missing --- api/js/etemplate/et2_widget_dialog.ts | 5 +++++ api/js/etemplate/etemplate2.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_widget_dialog.ts b/api/js/etemplate/et2_widget_dialog.ts index c44540c076..41e639f620 100644 --- a/api/js/etemplate/et2_widget_dialog.ts +++ b/api/js/etemplate/et2_widget_dialog.ts @@ -38,6 +38,10 @@ export class et2_dialog extends Et2Dialog super.template = value; } + /** + * @deprecated + * @returns {any} + */ get div() { return this; @@ -82,6 +86,7 @@ for(const [key, value] of Object.entries(et2_dialog.properties)) attrs[key] = {type: type_map[attr.type?.name || attr.name] || "string"}; } +attrs["value"] = {type: "any"}; et2_attribute_registry[et2_dialog.name] = attrs customElements.define("legacy-dialog", et2_dialog); \ No newline at end of file diff --git a/api/js/etemplate/etemplate2.ts b/api/js/etemplate/etemplate2.ts index d54547d47d..47a0a4f706 100644 --- a/api/js/etemplate/etemplate2.ts +++ b/api/js/etemplate/etemplate2.ts @@ -696,7 +696,12 @@ export class etemplate2 app[this.app].et2_ready(this, this.name); } - jQuery(this._DOMContainer).trigger('load', this); + // Dispatch an event that will bubble through shadow DOM boundary (pass through custom elements) + this._DOMContainer.dispatchEvent(new CustomEvent('load', { + bubbles: true, + composed: true, + detail: this + })); if(etemplate2.templates[this.name].attributes.onload) {