Et2Date._inputNode can sometimes be just an input tag

This commit is contained in:
nathan 2024-12-11 14:32:17 -07:00
parent a2b8ba300c
commit 2075bbe64c

View File

@ -418,11 +418,14 @@ export class Et2Date extends Et2InputWidget(LitFlatpickr)
super.update(changedProperties); super.update(changedProperties);
// Flatpickr puts some inputs we don't have direct control over // Flatpickr puts some inputs we don't have direct control over
if(changedProperties.has("disabled")) if(changedProperties.has("disabled") && this._inputNode)
{ {
this._inputNode.disabled = this.disabled; this._inputNode.disabled = this.disabled;
this._inputNode.requestUpdate("disabled"); if(typeof this._inputNode.requestUpdate == "function")
this._inputNode.shadowRoot.querySelectorAll("input").forEach(i => i.disabled = this.disabled); {
this._inputNode?.requestUpdate("disabled");
this._inputNode.shadowRoot.querySelectorAll("input").forEach(i => i.disabled = this.disabled);
}
} }
} }