mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-14 05:20:31 +00:00
25 lines
719 B
TypeScript
25 lines
719 B
TypeScript
import type { PropertyValues } from "lit";
|
|
import { customElement, property } from "lit/decorators";
|
|
import { HaTextField } from "./ha-textfield";
|
|
|
|
@customElement("ha-combo-box-textfield")
|
|
export class HaComboBoxTextField extends HaTextField {
|
|
@property({ type: Boolean, attribute: "force-blank-value" })
|
|
public forceBlankValue = false;
|
|
|
|
protected willUpdate(changedProps: PropertyValues): void {
|
|
super.willUpdate(changedProps);
|
|
if (changedProps.has("value") || changedProps.has("forceBlankValue")) {
|
|
if (this.forceBlankValue && this.value) {
|
|
this.value = "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
"ha-combo-box-textfield": HaComboBoxTextField;
|
|
}
|
|
}
|