mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +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"
|
||||
)}
|
||||
</p>`}
|
||||
${checkedItems.length
|
||||
${!this._config.hide_completed && checkedItems.length
|
||||
? html`
|
||||
<div role="separator">
|
||||
<div class="divider"></div>
|
||||
|
@ -453,6 +453,7 @@ export interface TodoListCardConfig extends LovelaceCardConfig {
|
||||
title?: string;
|
||||
theme?: string;
|
||||
entity?: string;
|
||||
hide_completed?: boolean;
|
||||
}
|
||||
|
||||
export interface StackCardConfig extends LovelaceCardConfig {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
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 { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import "../../../../components/ha-alert";
|
||||
@ -18,6 +18,7 @@ const cardConfigStruct = assign(
|
||||
title: optional(string()),
|
||||
theme: optional(string()),
|
||||
entity: optional(string()),
|
||||
hide_completed: optional(boolean()),
|
||||
})
|
||||
);
|
||||
|
||||
@ -30,6 +31,7 @@ const SCHEMA = [
|
||||
},
|
||||
},
|
||||
{ name: "theme", selector: { theme: {} } },
|
||||
{ name: "hide_completed", selector: { boolean: {} } },
|
||||
] as const;
|
||||
|
||||
@customElement("hui-todo-list-card-editor")
|
||||
@ -87,6 +89,10 @@ export class HuiTodoListEditor
|
||||
)} (${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.card.config.optional"
|
||||
)})`;
|
||||
case "hide_completed":
|
||||
return this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.card.todo-list.hide_completed"
|
||||
);
|
||||
default:
|
||||
return this.hass!.localize(
|
||||
`ui.panel.lovelace.editor.card.generic.${schema.name}`
|
||||
|
@ -6132,7 +6132,8 @@
|
||||
"todo-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.",
|
||||
"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": {
|
||||
"name": "Thermostat",
|
||||
|
Loading…
x
Reference in New Issue
Block a user