mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Add hide completed option to hui-todo-list-card (#22323)
This commit is contained in:
parent
3f0ec03a14
commit
07e5aa30c6
@ -275,7 +275,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
|
|||||||
"ui.panel.lovelace.cards.todo-list.no_unchecked_items"
|
"ui.panel.lovelace.cards.todo-list.no_unchecked_items"
|
||||||
)}
|
)}
|
||||||
</p>`}
|
</p>`}
|
||||||
${checkedItems.length
|
${!this._config.hide_completed && checkedItems.length
|
||||||
? html`
|
? html`
|
||||||
<div role="separator">
|
<div role="separator">
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
@ -453,6 +453,7 @@ export interface TodoListCardConfig extends LovelaceCardConfig {
|
|||||||
title?: string;
|
title?: string;
|
||||||
theme?: string;
|
theme?: string;
|
||||||
entity?: string;
|
entity?: string;
|
||||||
|
hide_completed?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StackCardConfig extends LovelaceCardConfig {
|
export interface StackCardConfig extends LovelaceCardConfig {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { CSSResultGroup, html, LitElement, nothing } from "lit";
|
import { CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { assert, assign, object, optional, string } from "superstruct";
|
import { assert, assign, boolean, object, optional, string } from "superstruct";
|
||||||
import { isComponentLoaded } from "../../../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../../../common/config/is_component_loaded";
|
||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
import "../../../../components/ha-alert";
|
import "../../../../components/ha-alert";
|
||||||
@ -18,6 +18,7 @@ const cardConfigStruct = assign(
|
|||||||
title: optional(string()),
|
title: optional(string()),
|
||||||
theme: optional(string()),
|
theme: optional(string()),
|
||||||
entity: optional(string()),
|
entity: optional(string()),
|
||||||
|
hide_completed: optional(boolean()),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ const SCHEMA = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ name: "theme", selector: { theme: {} } },
|
{ name: "theme", selector: { theme: {} } },
|
||||||
|
{ name: "hide_completed", selector: { boolean: {} } },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
@customElement("hui-todo-list-card-editor")
|
@customElement("hui-todo-list-card-editor")
|
||||||
@ -87,6 +89,10 @@ export class HuiTodoListEditor
|
|||||||
)} (${this.hass!.localize(
|
)} (${this.hass!.localize(
|
||||||
"ui.panel.lovelace.editor.card.config.optional"
|
"ui.panel.lovelace.editor.card.config.optional"
|
||||||
)})`;
|
)})`;
|
||||||
|
case "hide_completed":
|
||||||
|
return this.hass!.localize(
|
||||||
|
"ui.panel.lovelace.editor.card.todo-list.hide_completed"
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return this.hass!.localize(
|
return this.hass!.localize(
|
||||||
`ui.panel.lovelace.editor.card.generic.${schema.name}`
|
`ui.panel.lovelace.editor.card.generic.${schema.name}`
|
||||||
|
@ -6132,7 +6132,8 @@
|
|||||||
"todo-list": {
|
"todo-list": {
|
||||||
"name": "To-do list",
|
"name": "To-do list",
|
||||||
"description": "The to-do list card allows you to add, edit, check-off, and clear items from your to-do list.",
|
"description": "The to-do list card allows you to add, edit, check-off, and clear items from your to-do list.",
|
||||||
"integration_not_loaded": "This card requires the `todo` integration to be set up."
|
"integration_not_loaded": "This card requires the `todo` integration to be set up.",
|
||||||
|
"hide_completed": "Hide completed items"
|
||||||
},
|
},
|
||||||
"thermostat": {
|
"thermostat": {
|
||||||
"name": "Thermostat",
|
"name": "Thermostat",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user