Don't die if CustomFilterHeader is for a component that isn't a webcomponent, just error & use a select

This commit is contained in:
nathan 2023-01-05 16:36:03 -07:00
parent c403edc49a
commit 39ab880188

View File

@ -58,6 +58,11 @@ export class Et2CustomFilterHeader extends FilterMixin(Et2InputWidget(LitElement
this.widgetType = "et2-" + this.widgetType; this.widgetType = "et2-" + this.widgetType;
} }
} }
if(!window.customElements.get(this.widgetType))
{
console.error("Unknown widget type '%s'", this.widgetType);
this.widgetType = 'et2-select';
}
// @ts-ignore TS doesn't know about this.getParent() // @ts-ignore TS doesn't know about this.getParent()
this.filter_node = <LitElement>loadWebComponent(this.widgetType, {...attrs, ...this.widgetOptions}, this); this.filter_node = <LitElement>loadWebComponent(this.widgetType, {...attrs, ...this.widgetOptions}, this);
if(this.filter_node instanceof Et2Select) if(this.filter_node instanceof Et2Select)