Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Add valid property to or-input

Rich Turner75ac053b8ec1
diff --git a/ui/component/or-input/src/index.ts b/ui/component/or-input/src/index.ts
index b2a0dda11..ff9d8a1c4 100644
--- a/ui/component/or-input/src/index.ts
+++ b/ui/component/or-input/src/index.ts
@@ -792,4 +792,13 @@ export class OrInput extends LitElement {
this.dispatchEvent(new OrInputChangedEvent(this.value, previousValue));
}
}
+
+ public get valid(): boolean {
+ const elem = this.shadowRoot!.getElementById("elem") as any;
+ if (elem && elem.checkValidity) {
+ return elem.checkValidity();
+ }
+ return true;
+ }
+
}