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

@ -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 {
@ -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,7 +620,9 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
} }
static get styles(): CSSResultGroup { static get styles(): CSSResultGroup {
return css` return [
sortableStyles,
css`
ha-card { ha-card {
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
@ -727,7 +744,8 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
} }
.handle { .handle {
cursor: move; cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
height: 24px; height: 24px;
padding: 16px 4px; padding: 16px 4px;
} }
@ -759,7 +777,8 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
.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?",