Option to hide create box on todo card (#23571)

This commit is contained in:
karwosts 2025-01-05 22:45:53 -08:00 committed by GitHub
parent 334c87b194
commit e9f3f71be1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 8 deletions

View File

@ -195,11 +195,10 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
"has-header": "title" in this._config, "has-header": "title" in this._config,
})} })}
> >
<div class="addRow"> ${!this._config.hide_create &&
${this._todoListSupportsFeature( this._todoListSupportsFeature(TodoListEntityFeature.CREATE_TODO_ITEM)
TodoListEntityFeature.CREATE_TODO_ITEM ? html`
) <div class="addRow">
? html`
<ha-textfield <ha-textfield
class="addBox" class="addBox"
.placeholder=${this.hass!.localize( .placeholder=${this.hass!.localize(
@ -218,9 +217,9 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
@click=${this._addItem} @click=${this._addItem}
> >
</ha-icon-button> </ha-icon-button>
` </div>
: nothing} `
</div> : nothing}
<ha-sortable <ha-sortable
handle-selector="ha-svg-icon" handle-selector="ha-svg-icon"
draggable-selector=".draggable" draggable-selector=".draggable"

View File

@ -478,6 +478,7 @@ export interface TodoListCardConfig extends LovelaceCardConfig {
theme?: string; theme?: string;
entity?: string; entity?: string;
hide_completed?: boolean; hide_completed?: boolean;
hide_create?: boolean;
} }
export interface StackCardConfig extends LovelaceCardConfig { export interface StackCardConfig extends LovelaceCardConfig {

View File

@ -20,6 +20,7 @@ const cardConfigStruct = assign(
theme: optional(string()), theme: optional(string()),
entity: optional(string()), entity: optional(string()),
hide_completed: optional(boolean()), hide_completed: optional(boolean()),
hide_create: optional(boolean()),
}) })
); );