mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Add hold and double tap actions in hui-entity-heading-badge (#24707)
* feat: Add support for hold and double tap actions in hui-entity-heading-badge * fix: Add hold_action and double_tap_action to config struct and interactions to allow GUI editor to work for badge interactions * chore: Remove hold and double_tap from UI editor schema on entity heading badge editor
This commit is contained in:
parent
9f05f4df50
commit
e0fbd3cd1f
@ -44,6 +44,8 @@ const entityConfigStruct = object({
|
||||
show_icon: optional(boolean()),
|
||||
color: optional(string()),
|
||||
tap_action: optional(actionConfigStruct),
|
||||
hold_action: optional(actionConfigStruct),
|
||||
double_tap_action: optional(actionConfigStruct),
|
||||
visibility: optional(array(any())),
|
||||
});
|
||||
|
||||
|
@ -49,6 +49,12 @@ export class HuiEntityHeadingBadge
|
||||
tap_action: {
|
||||
action: "none",
|
||||
},
|
||||
hold_action: {
|
||||
action: "none",
|
||||
},
|
||||
double_tap_action: {
|
||||
action: "none",
|
||||
},
|
||||
...config,
|
||||
};
|
||||
}
|
||||
@ -58,6 +64,12 @@ export class HuiEntityHeadingBadge
|
||||
tap_action: {
|
||||
action: "none",
|
||||
},
|
||||
hold_action: {
|
||||
action: "none",
|
||||
},
|
||||
double_tap_action: {
|
||||
action: "none",
|
||||
},
|
||||
...this._config!,
|
||||
};
|
||||
handleAction(this, this.hass!, config, ev.detail.action!);
|
||||
@ -135,7 +147,10 @@ export class HuiEntityHeadingBadge
|
||||
<ha-heading-badge
|
||||
.type=${hasAction(config.tap_action) ? "button" : "text"}
|
||||
@action=${this._handleAction}
|
||||
.actionHandler=${actionHandler()}
|
||||
.actionHandler=${actionHandler({
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
style=${styleMap(style)}
|
||||
.title=${name}
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user