mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +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()),
|
show_icon: optional(boolean()),
|
||||||
color: optional(string()),
|
color: optional(string()),
|
||||||
tap_action: optional(actionConfigStruct),
|
tap_action: optional(actionConfigStruct),
|
||||||
|
hold_action: optional(actionConfigStruct),
|
||||||
|
double_tap_action: optional(actionConfigStruct),
|
||||||
visibility: optional(array(any())),
|
visibility: optional(array(any())),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -49,6 +49,12 @@ export class HuiEntityHeadingBadge
|
|||||||
tap_action: {
|
tap_action: {
|
||||||
action: "none",
|
action: "none",
|
||||||
},
|
},
|
||||||
|
hold_action: {
|
||||||
|
action: "none",
|
||||||
|
},
|
||||||
|
double_tap_action: {
|
||||||
|
action: "none",
|
||||||
|
},
|
||||||
...config,
|
...config,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -58,6 +64,12 @@ export class HuiEntityHeadingBadge
|
|||||||
tap_action: {
|
tap_action: {
|
||||||
action: "none",
|
action: "none",
|
||||||
},
|
},
|
||||||
|
hold_action: {
|
||||||
|
action: "none",
|
||||||
|
},
|
||||||
|
double_tap_action: {
|
||||||
|
action: "none",
|
||||||
|
},
|
||||||
...this._config!,
|
...this._config!,
|
||||||
};
|
};
|
||||||
handleAction(this, this.hass!, config, ev.detail.action!);
|
handleAction(this, this.hass!, config, ev.detail.action!);
|
||||||
@ -135,7 +147,10 @@ export class HuiEntityHeadingBadge
|
|||||||
<ha-heading-badge
|
<ha-heading-badge
|
||||||
.type=${hasAction(config.tap_action) ? "button" : "text"}
|
.type=${hasAction(config.tap_action) ? "button" : "text"}
|
||||||
@action=${this._handleAction}
|
@action=${this._handleAction}
|
||||||
.actionHandler=${actionHandler()}
|
.actionHandler=${actionHandler({
|
||||||
|
hasHold: hasAction(this._config!.hold_action),
|
||||||
|
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||||
|
})}
|
||||||
style=${styleMap(style)}
|
style=${styleMap(style)}
|
||||||
.title=${name}
|
.title=${name}
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user