20240103.3 (#19263)

This commit is contained in:
Bram Kragten 2024-01-03 15:03:00 +01:00 committed by GitHub
commit b99b13251f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 12 deletions

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "home-assistant-frontend" name = "home-assistant-frontend"
version = "20240103.1" version = "20240103.3"
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

@ -83,9 +83,12 @@ export const updateItem = (
item: item.uid, item: item.uid,
rename: item.summary, rename: item.summary,
status: item.status, status: item.status,
description: item.description || null, description: item.description,
due_datetime: item.due?.includes("T") ? item.due : undefined, due_datetime: item.due?.includes("T") ? item.due : undefined,
due_date: item.due?.includes("T") ? undefined : item.due || null, due_date:
item.due === undefined || item.due?.includes("T")
? undefined
: item.due,
}, },
{ entity_id } { entity_id }
); );
@ -102,7 +105,10 @@ export const createItem = (
item: item.summary, item: item.summary,
description: item.description || undefined, description: item.description || undefined,
due_datetime: item.due?.includes("T") ? item.due : undefined, due_datetime: item.due?.includes("T") ? item.due : undefined,
due_date: item.due?.includes("T") ? undefined : item.due, due_date:
item.due === undefined || item.due?.includes("T")
? undefined
: item.due,
}, },
{ entity_id } { entity_id }
); );

View File

@ -287,21 +287,40 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
@eventOptions({ passive: true }) @eventOptions({ passive: true })
private handleRippleActivate(evt?: Event) { private handleRippleActivate(evt?: Event) {
if (!this.hasCardAction) return;
this._rippleHandlers.startPress(evt); this._rippleHandlers.startPress(evt);
} }
private handleRippleDeactivate() { private handleRippleDeactivate() {
if (!this.hasCardAction) return;
this._rippleHandlers.endPress(); this._rippleHandlers.endPress();
} }
private handleRippleMouseEnter() { private handleRippleMouseEnter() {
if (!this.hasCardAction) return;
this._rippleHandlers.startHover(); this._rippleHandlers.startHover();
} }
private handleRippleMouseLeave() { private handleRippleMouseLeave() {
if (!this.hasCardAction) return;
this._rippleHandlers.endHover(); this._rippleHandlers.endHover();
} }
get hasCardAction() {
return (
!this._config?.tap_action ||
hasAction(this._config?.tap_action) ||
hasAction(this._config?.hold_action) ||
hasAction(this._config?.double_tap_action)
);
}
get hasIconAction() {
return (
!this._config?.icon_tap_action || hasAction(this._config?.icon_tap_action)
);
}
protected render() { protected render() {
if (!this._config || !this.hass) { if (!this._config || !this.hass) {
return nothing; return nothing;
@ -368,8 +387,8 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
hasHold: hasAction(this._config!.hold_action), hasHold: hasAction(this._config!.hold_action),
hasDoubleClick: hasAction(this._config!.double_tap_action), hasDoubleClick: hasAction(this._config!.double_tap_action),
})} })}
role="button" role=${ifDefined(this.hasCardAction ? "button" : undefined)}
tabindex="0" tabindex=${ifDefined(this.hasCardAction ? "0" : undefined)}
aria-labelledby="info" aria-labelledby="info"
@mousedown=${this.handleRippleActivate} @mousedown=${this.handleRippleActivate}
@mouseup=${this.handleRippleDeactivate} @mouseup=${this.handleRippleDeactivate}
@ -386,8 +405,8 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
<div class="content ${classMap(contentClasses)}"> <div class="content ${classMap(contentClasses)}">
<div <div
class="icon-container" class="icon-container"
role="button" role=${ifDefined(this.hasIconAction ? "button" : undefined)}
tabindex="0" tabindex=${ifDefined(this.hasIconAction ? "0" : undefined)}
@action=${this._handleIconAction} @action=${this._handleIconAction}
.actionHandler=${actionHandler()} .actionHandler=${actionHandler()}
> >

View File

@ -476,7 +476,8 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
return; return;
} }
await updateItem(this.hass!, this._entityId!, { await updateItem(this.hass!, this._entityId!, {
...item, uid: item.uid,
summary: item.summary,
status: status:
item.status === TodoItemStatus.NeedsAction item.status === TodoItemStatus.NeedsAction
? TodoItemStatus.Completed ? TodoItemStatus.Completed

View File

@ -81,6 +81,7 @@ const EDITABLES_FEATURE_TYPES = new Set<UiFeatureTypes>([
"humidifier-modes", "humidifier-modes",
"water-heater-operation-modes", "water-heater-operation-modes",
"lawn-mower-commands", "lawn-mower-commands",
"climate-fan-modes",
"climate-preset-modes", "climate-preset-modes",
"numeric-input", "numeric-input",
"update-actions", "update-actions",

View File

@ -324,14 +324,20 @@ class DialogTodoItemEditor extends LitElement {
(this._todoListSupportsFeature( (this._todoListSupportsFeature(
TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM
) )
? // backend should accept null to clear the field, but it doesn't now ? null
null
: undefined), : undefined),
due: this._due due: this._due
? this._hasTime ? this._hasTime
? this._due.toISOString() ? this._due.toISOString()
: this._formatDate(this._due) : this._formatDate(this._due)
: null, : this._todoListSupportsFeature(
TodoListEntityFeature.SET_DUE_DATETIME_ON_ITEM
) ||
this._todoListSupportsFeature(
TodoListEntityFeature.SET_DUE_DATE_ON_ITEM
)
? null
: undefined,
status: this._checked status: this._checked
? TodoItemStatus.Completed ? TodoItemStatus.Completed
: TodoItemStatus.NeedsAction, : TodoItemStatus.NeedsAction,