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

View File

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

View File

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