mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Added hold and double tap actions for tile card icon (#21947)
This commit is contained in:
parent
9078ab4026
commit
68a0d04f04
@ -136,8 +136,10 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
|
|||||||
const config = {
|
const config = {
|
||||||
entity: this._config!.entity,
|
entity: this._config!.entity,
|
||||||
tap_action: this._config!.icon_tap_action,
|
tap_action: this._config!.icon_tap_action,
|
||||||
|
hold_action: this._config!.icon_hold_action,
|
||||||
|
double_tap_action: this._config!.icon_double_tap_action,
|
||||||
};
|
};
|
||||||
handleAction(this, this.hass!, config, "tap");
|
handleAction(this, this.hass!, config, ev.detail.action!);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getImageUrl(entity: HassEntity): string | undefined {
|
private _getImageUrl(entity: HassEntity): string | undefined {
|
||||||
@ -286,7 +288,10 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
|
|||||||
role=${ifDefined(this.hasIconAction ? "button" : undefined)}
|
role=${ifDefined(this.hasIconAction ? "button" : undefined)}
|
||||||
tabindex=${ifDefined(this.hasIconAction ? "0" : undefined)}
|
tabindex=${ifDefined(this.hasIconAction ? "0" : undefined)}
|
||||||
@action=${this._handleIconAction}
|
@action=${this._handleIconAction}
|
||||||
.actionHandler=${actionHandler()}
|
.actionHandler=${actionHandler({
|
||||||
|
hasHold: hasAction(this._config!.icon_hold_action),
|
||||||
|
hasDoubleClick: hasAction(this._config!.icon_double_tap_action),
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
${imageUrl
|
${imageUrl
|
||||||
? html`
|
? html`
|
||||||
|
@ -498,5 +498,7 @@ export interface TileCardConfig extends LovelaceCardConfig {
|
|||||||
hold_action?: ActionConfig;
|
hold_action?: ActionConfig;
|
||||||
double_tap_action?: ActionConfig;
|
double_tap_action?: ActionConfig;
|
||||||
icon_tap_action?: ActionConfig;
|
icon_tap_action?: ActionConfig;
|
||||||
|
icon_hold_action?: ActionConfig;
|
||||||
|
icon_double_tap_action?: ActionConfig;
|
||||||
features?: LovelaceCardFeatureConfig[];
|
features?: LovelaceCardFeatureConfig[];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user