20231228.0 (#19170)

This commit is contained in:
Bram Kragten 2023-12-28 15:34:42 +01:00 committed by GitHub
commit 7b4ecfd30a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 202 additions and 169 deletions

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "home-assistant-frontend" name = "home-assistant-frontend"
version = "20231227.0" version = "20231228.0"
license = {text = "Apache-2.0"} license = {text = "Apache-2.0"}
description = "The Home Assistant frontend" description = "The Home Assistant frontend"
readme = "README.md" readme = "README.md"

View File

@ -46,6 +46,7 @@ export class HaListItem extends ListItemBase {
.mdc-deprecated-list-item__meta { .mdc-deprecated-list-item__meta {
display: var(--mdc-list-item-meta-display); display: var(--mdc-list-item-meta-display);
align-items: center; align-items: center;
flex-shrink: 0;
} }
:host([graphic="icon"]:not([twoline])) :host([graphic="icon"]:not([twoline]))
.mdc-deprecated-list-item__graphic { .mdc-deprecated-list-item__graphic {

View File

@ -67,6 +67,7 @@ export const ACTION_GROUPS: AutomationElementGroup = {
icon: mdiDotsHorizontal, icon: mdiDotsHorizontal,
members: { members: {
event: {}, event: {},
service: {},
}, },
}, },
} as const; } as const;

View File

@ -207,7 +207,8 @@ export class DialogAreaFilter
color: var(--disabled-text-color); color: var(--disabled-text-color);
} }
.handle { .handle {
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
} }
.actions { .actions {
display: flex; display: flex;

View File

@ -319,7 +319,8 @@ export default class HaAutomationAction extends LitElement {
overflow: hidden; overflow: hidden;
} }
.handle { .handle {
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
padding: 12px; padding: 12px;
} }
.handle ha-svg-icon { .handle ha-svg-icon {

View File

@ -543,7 +543,8 @@ export class HaChooseAction extends LitElement implements ActionElement {
padding: 0 16px 16px 16px; padding: 0 16px 16px 16px;
} }
.handle { .handle {
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
padding: 12px; padding: 12px;
} }
.handle ha-svg-icon { .handle ha-svg-icon {

View File

@ -452,8 +452,8 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
itemRoles="option" itemRoles="option"
rootTabbable rootTabbable
style=${styleMap({ style=${styleMap({
width: `${this._width}px`, width: this._width ? `${this._width}px` : "auto",
height: `${this._height}px`, height: this._height ? `${Math.min(468, this._height)}px` : "auto",
})} })}
> >
${this._params.clipboardItem && ${this._params.clipboardItem &&

View File

@ -358,7 +358,8 @@ export default class HaAutomationCondition extends LitElement {
overflow: hidden; overflow: hidden;
} }
.handle { .handle {
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
padding: 12px; padding: 12px;
} }
.handle ha-svg-icon { .handle ha-svg-icon {

View File

@ -328,7 +328,7 @@ class HaAutomationPicker extends LitElement {
> >
</ha-button-related-filter-menu> </ha-button-related-filter-menu>
${!this.automations.length ${!this.automations.length
? html` <div class="empty" slot="empty"> ? html`<div class="empty" slot="empty">
<ha-svg-icon .path=${mdiRobotHappy}></ha-svg-icon> <ha-svg-icon .path=${mdiRobotHappy}></ha-svg-icon>
<h1> <h1>
${this.hass.localize( ${this.hass.localize(
@ -338,7 +338,9 @@ class HaAutomationPicker extends LitElement {
<p> <p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.picker.empty_text_1" "ui.panel.config.automation.picker.empty_text_1"
)}<br /> )}
</p>
<p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.picker.empty_text_2" "ui.panel.config.automation.picker.empty_text_2"
)} )}
@ -349,9 +351,7 @@ class HaAutomationPicker extends LitElement {
rel="noreferrer" rel="noreferrer"
> >
<ha-button> <ha-button>
${this.hass.localize( ${this.hass.localize("ui.panel.config.common.learn_more")}
"ui.panel.config.automation.picker.learn_more"
)}
</ha-button> </ha-button>
</a> </a>
</div>` </div>`
@ -513,7 +513,9 @@ class HaAutomationPicker extends LitElement {
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
${this.hass.localize("ui.panel.config.common.learn_more")} ${this.hass.localize(
"ui.panel.config.automation.picker.learn_more"
)}
</a> </a>
</p> </p>
`, `,

View File

@ -85,8 +85,7 @@ export class HaManualAutomationEditor extends LitElement {
></ha-icon-button> ></ha-icon-button>
</a> </a>
</div> </div>
${!this.hass.userData?.showAdvanced && ${!ensureArray(this.config.trigger)?.length
!ensureArray(this.config.trigger)?.length
? html`<p> ? html`<p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.triggers.description" "ui.panel.config.automation.editor.triggers.description"
@ -125,8 +124,7 @@ export class HaManualAutomationEditor extends LitElement {
></ha-icon-button> ></ha-icon-button>
</a> </a>
</div> </div>
${!this.hass.userData?.showAdvanced && ${!ensureArray(this.config.condition)?.length
!ensureArray(this.config.condition)?.length
? html`<p> ? html`<p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.conditions.description", "ui.panel.config.automation.editor.conditions.description",
@ -165,8 +163,7 @@ export class HaManualAutomationEditor extends LitElement {
</a> </a>
</div> </div>
</div> </div>
${!this.hass.userData?.showAdvanced && ${!ensureArray(this.config.action)?.length
!ensureArray(this.config.action)?.length
? html`<p> ? html`<p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.actions.description" "ui.panel.config.automation.editor.actions.description"

View File

@ -298,7 +298,8 @@ export default class HaAutomationTrigger extends LitElement {
overflow: hidden; overflow: hidden;
} }
.handle { .handle {
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
padding: 12px; padding: 12px;
} }
.handle ha-svg-icon { .handle ha-svg-icon {

View File

@ -285,7 +285,8 @@ class HaInputSelectForm extends LitElement {
margin-bottom: 8px; margin-bottom: 8px;
} }
.handle { .handle {
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
padding-right: 12px; padding-right: 12px;
} }
.handle ha-svg-icon { .handle ha-svg-icon {

View File

@ -265,9 +265,7 @@ class HaSceneDashboard extends LitElement {
rel="noreferrer" rel="noreferrer"
> >
<ha-button> <ha-button>
${this.hass.localize( ${this.hass.localize("ui.panel.config.common.learn_more")}
"ui.panel.config.scene.picker.learn_more"
)}
</ha-button> </ha-button>
</a> </a>
</div>` </div>`
@ -370,7 +368,7 @@ class HaSceneDashboard extends LitElement {
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
${this.hass.localize("ui.panel.config.common.learn_more")} ${this.hass.localize("ui.panel.config.scene.picker.learn_more")}
</a> </a>
</p> </p>
`, `,

View File

@ -294,9 +294,7 @@ class HaScriptPicker extends LitElement {
rel="noreferrer" rel="noreferrer"
> >
<ha-button> <ha-button>
${this.hass.localize( ${this.hass.localize("ui.panel.config.common.learn_more")}
"ui.panel.config.script.picker.learn_more"
)}
</ha-button> </ha-button>
</a> </a>
</div>` </div>`
@ -420,7 +418,7 @@ class HaScriptPicker extends LitElement {
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
${this.hass.localize("ui.panel.config.common.learn_more")} ${this.hass.localize("ui.panel.config.script.picker.learn_more")}
</a> </a>
</p> </p>
`, `,

View File

@ -1,4 +1,5 @@
import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list";
import type { List } from "@material/mwc-list/mwc-list";
import { import {
mdiClock, mdiClock,
mdiDelete, mdiDelete,
@ -56,6 +57,7 @@ import { findEntities } from "../common/find-entities";
import { createEntityNotFoundWarning } from "../components/hui-warning"; import { createEntityNotFoundWarning } from "../components/hui-warning";
import { LovelaceCard, LovelaceCardEditor } from "../types"; import { LovelaceCard, LovelaceCardEditor } from "../types";
import { TodoListCardConfig } from "./types"; import { TodoListCardConfig } from "./types";
import { sortableStyles } from "../../../resources/ha-sortable-style";
@customElement("hui-todo-list-card") @customElement("hui-todo-list-card")
export class HuiTodoListCard extends LitElement implements LovelaceCard { export class HuiTodoListCard extends LitElement implements LovelaceCard {
@ -229,7 +231,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
: nothing} : nothing}
</div> </div>
${uncheckedItems.length ${uncheckedItems.length
? html` <div class="header"> ? html`<div class="header">
<span> <span>
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.lovelace.cards.todo-list.unchecked_items" "ui.panel.lovelace.cards.todo-list.unchecked_items"
@ -248,7 +250,9 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
graphic="icon" graphic="icon"
> >
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.lovelace.cards.todo-list.reorder_items" this._reordering
? "ui.panel.lovelace.cards.todo-list.exit_reorder_items"
: "ui.panel.lovelace.cards.todo-list.reorder_items"
)} )}
<ha-svg-icon <ha-svg-icon
slot="graphic" slot="graphic"
@ -466,18 +470,29 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
}); });
} }
private _completeItem(ev): void { private async _completeItem(ev): Promise<void> {
const item = this._getItem(ev.currentTarget.itemId); const item = this._getItem(ev.currentTarget.itemId);
if (!item) { if (!item) {
return; return;
} }
updateItem(this.hass!, this._entityId!, { await updateItem(this.hass!, this._entityId!, {
...item, ...item,
status: status:
item.status === TodoItemStatus.NeedsAction item.status === TodoItemStatus.NeedsAction
? TodoItemStatus.Completed ? TodoItemStatus.Completed
: TodoItemStatus.NeedsAction, : TodoItemStatus.NeedsAction,
}); });
await this.updateComplete;
const newList: List = this.shadowRoot!.querySelector(
item.status === TodoItemStatus.NeedsAction ? "#checked" : "#unchecked"
)!;
await newList.updateComplete;
const items =
item.status === TodoItemStatus.NeedsAction
? this._getCheckedItems(this._items)
: this._getUncheckedItems(this._items);
const index = items.findIndex((itm) => itm.uid === item.uid);
newList.focusItemAtIndex(index);
} }
private async _clearCompletedItems(): Promise<void> { private async _clearCompletedItems(): Promise<void> {
@ -605,161 +620,165 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
} }
static get styles(): CSSResultGroup { static get styles(): CSSResultGroup {
return css` return [
ha-card { sortableStyles,
height: 100%; css`
box-sizing: border-box; ha-card {
} height: 100%;
box-sizing: border-box;
}
.has-header { .has-header {
padding-top: 0; padding-top: 0;
} }
.addRow { .addRow {
padding: 16px; padding: 16px;
padding-bottom: 0; padding-bottom: 0;
position: relative; position: relative;
} }
.addRow ha-icon-button { .addRow ha-icon-button {
position: absolute; position: absolute;
right: 16px; right: 16px;
inset-inline-start: initial; inset-inline-start: initial;
inset-inline-end: 16px; inset-inline-end: 16px;
} }
.addRow, .addRow,
.header { .header {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
} }
.header { .header {
padding-left: 30px; padding-left: 30px;
padding-right: 16px; padding-right: 16px;
padding-inline-start: 30px; padding-inline-start: 30px;
padding-inline-end: 16px; padding-inline-end: 16px;
margin-top: 8px; margin-top: 8px;
justify-content: space-between; justify-content: space-between;
direction: var(--direction); direction: var(--direction);
} }
.header span { .header span {
color: var(--primary-text-color); color: var(--primary-text-color);
font-weight: 500; font-weight: 500;
} }
.empty { .empty {
padding: 16px 32px; padding: 16px 32px;
} }
.item { .item {
margin-top: 8px; margin-top: 8px;
} }
ha-check-list-item { ha-check-list-item {
--mdc-list-item-meta-size: 56px; --mdc-list-item-meta-size: 56px;
min-height: 56px; min-height: 56px;
height: auto; height: auto;
} }
ha-check-list-item.multiline { ha-check-list-item.multiline {
align-items: flex-start; align-items: flex-start;
--check-list-item-graphic-margin-top: 8px; --check-list-item-graphic-margin-top: 8px;
} }
.row { .row {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.multiline .column { .multiline .column {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-top: 18px; margin-top: 18px;
margin-bottom: 12px; margin-bottom: 12px;
} }
.completed .summary { .completed .summary {
text-decoration: line-through; text-decoration: line-through;
} }
.description, .description,
.due { .due {
font-size: 12px; font-size: 12px;
color: var(--secondary-text-color); color: var(--secondary-text-color);
} }
.description { .description {
white-space: initial; white-space: initial;
overflow: hidden; overflow: hidden;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 3; -webkit-line-clamp: 3;
line-clamp: 3; line-clamp: 3;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
.description p { .description p {
margin: 0; margin: 0;
} }
.description a { .description a {
color: var(--primary-color); color: var(--primary-color);
} }
.due { .due {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.due ha-svg-icon { .due ha-svg-icon {
margin-right: 4px; margin-right: 4px;
--mdc-icon-size: 14px; --mdc-icon-size: 14px;
} }
.due.overdue { .due.overdue {
color: var(--warning-color); color: var(--warning-color);
} }
.completed .due.overdue { .completed .due.overdue {
color: var(--secondary-text-color); color: var(--secondary-text-color);
} }
.handle { .handle {
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
height: 24px; cursor: grab;
padding: 16px 4px; height: 24px;
} padding: 16px 4px;
}
.deleteItemButton { .deleteItemButton {
position: relative; position: relative;
left: 8px; left: 8px;
} }
ha-textfield { ha-textfield {
flex-grow: 1; flex-grow: 1;
} }
.divider { .divider {
height: 1px; height: 1px;
background-color: var(--divider-color); background-color: var(--divider-color);
margin: 10px 0; margin: 10px 0;
} }
.clearall { .clearall {
cursor: pointer; cursor: pointer;
} }
.todoList { .todoList {
display: block; display: block;
padding: 8px; padding: 8px;
} }
.warning { .warning {
color: var(--error-color); color: var(--error-color);
} }
`; `,
];
} }
} }

View File

@ -181,7 +181,8 @@ export class HuiEntityEditor extends LitElement {
} }
.entity .handle { .entity .handle {
padding-right: 8px; padding-right: 8px;
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
padding-inline-end: 8px; padding-inline-end: 8px;
padding-inline-start: initial; padding-inline-start: initial;
direction: var(--direction); direction: var(--direction);

View File

@ -460,7 +460,8 @@ export class HuiCardFeaturesEditor extends LitElement {
} }
.feature .handle { .feature .handle {
padding-right: 8px; padding-right: 8px;
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
padding-inline-end: 8px; padding-inline-end: 8px;
padding-inline-start: initial; padding-inline-start: initial;
direction: var(--direction); direction: var(--direction);

View File

@ -243,7 +243,8 @@ export class HuiEntitiesCardRowEditor extends LitElement {
.entity .handle { .entity .handle {
padding-right: 8px; padding-right: 8px;
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
padding-inline-end: 8px; padding-inline-end: 8px;
padding-inline-start: initial; padding-inline-start: initial;
direction: var(--direction); direction: var(--direction);

View File

@ -99,7 +99,6 @@ class DialogTodoItemEditor extends LitElement {
open open
@closed=${this.closeDialog} @closed=${this.closeDialog}
scrimClickAction scrimClickAction
escapeKeyAction
.heading=${createCloseHeading( .heading=${createCloseHeading(
this.hass, this.hass,
isCreate isCreate

View File

@ -34,14 +34,22 @@ export const sortableStyles = css`
.sortable-fallback { .sortable-fallback {
display: none; display: none;
opacity: 0;
} }
.sortable-ghost { .sortable-ghost {
border: 2px solid var(--primary-color);
background: rgba(var(--rgb-primary-color), 0.25);
border-radius: 4px;
opacity: 0.4; opacity: 0.4;
} }
.sortable-fallback { .sortable-drag {
opacity: 0; border-radius: 4px;
opacity: 1;
background: var(--card-background-color);
box-shadow: 0px 4px 8px 3px #00000026;
cursor: grabbing;
} }
@keyframes keyframes1 { @keyframes keyframes1 {

View File

@ -1119,8 +1119,8 @@
}, },
"valve": { "valve": {
"switch_mode": { "switch_mode": {
"button": "[%key:ui::dialogs::more_info_control::valve::switch_mode::button%]", "button": "[%key:ui::dialogs::more_info_control::cover::switch_mode::button%]",
"position": "[%key:ui::dialogs::more_info_control::valve::switch_mode::position%]" "position": "[%key:ui::dialogs::more_info_control::cover::switch_mode::position%]"
} }
} }
}, },
@ -2759,7 +2759,7 @@
"preset_mode": "Preset mode" "preset_mode": "Preset mode"
}, },
"description": { "description": {
"picker": "If something happens to a device. Great way to start." "picker": "If a device is in a certain state. Great way to start."
} }
}, },
"not": { "not": {
@ -4768,6 +4768,7 @@
"add_item": "Add item", "add_item": "Add item",
"today": "Today", "today": "Today",
"reorder_items": "Reorder items", "reorder_items": "Reorder items",
"exit_reorder_items": "Exit reorder mode",
"drag_and_drop": "Drag and drop", "drag_and_drop": "Drag and drop",
"delete_item": "Delete item", "delete_item": "Delete item",
"delete_confirm_title": "Remove completed items?", "delete_confirm_title": "Remove completed items?",