Restore default hold action for some cards (#24947)

This commit is contained in:
Paul Bottein 2025-04-07 13:18:05 +02:00 committed by GitHub
parent 2ccc5355c4
commit dec968af54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 106 additions and 40 deletions

View File

@ -106,6 +106,7 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
this._config = {
tap_action: { action: "more-info" },
hold_action: { action: "more-info" },
...config,
};
}

View File

@ -39,20 +39,28 @@ const SCHEMA = [
},
},
},
{
name: "hold_action",
selector: {
ui_action: {
default_action: "more-info",
},
},
},
{
name: "",
type: "optional_actions",
flatten: true,
schema: (["hold_action", "double_tap_action"] as const).map(
(action) => ({
name: action,
schema: [
{
name: "double_tap_action",
selector: {
ui_action: {
default_action: "none" as const,
default_action: "none",
},
},
})
),
},
],
},
],
},

View File

@ -44,20 +44,28 @@ const SCHEMA = [
},
},
},
{
name: "hold_action",
selector: {
ui_action: {
default_action: "more-info",
},
},
},
{
name: "",
type: "optional_actions",
flatten: true,
schema: (["hold_action", "double_tap_action"] as const).map(
(action) => ({
name: action,
schema: [
{
name: "double_tap_action",
selector: {
ui_action: {
default_action: "none" as const,
default_action: "none",
},
},
})
),
},
],
},
],
},

View File

@ -37,20 +37,28 @@ const SCHEMA = [
},
},
},
{
name: "hold_action",
selector: {
ui_action: {
default_action: "more-info",
},
},
},
{
name: "",
type: "optional_actions",
flatten: true,
schema: (["hold_action", "double_tap_action"] as const).map(
(action) => ({
name: action,
schema: [
{
name: "double_tap_action",
selector: {
ui_action: {
default_action: "none" as const,
default_action: "none",
},
},
})
),
},
],
},
],
},

View File

@ -49,20 +49,28 @@ const SCHEMA = [
},
},
},
{
name: "hold_action",
selector: {
ui_action: {
default_action: "more-info",
},
},
},
{
name: "",
type: "optional_actions",
flatten: true,
schema: (["hold_action", "double_tap_action"] as const).map(
(action) => ({
name: action,
schema: [
{
name: "double_tap_action",
selector: {
ui_action: {
default_action: "none" as const,
default_action: "none",
},
},
})
),
},
],
},
],
},

View File

@ -49,20 +49,28 @@ const SCHEMA = [
},
},
},
{
name: "hold_action",
selector: {
ui_action: {
default_action: "more-info",
},
},
},
{
name: "",
type: "optional_actions",
flatten: true,
schema: (["hold_action", "double_tap_action"] as const).map(
(action) => ({
name: action,
schema: [
{
name: "double_tap_action",
selector: {
ui_action: {
default_action: "none" as const,
default_action: "none",
},
},
})
),
},
],
},
],
},

View File

@ -71,20 +71,28 @@ const SCHEMA = [
},
},
},
{
name: "hold_action",
selector: {
ui_action: {
default_action: "more-info",
},
},
},
{
name: "",
type: "optional_actions",
flatten: true,
schema: (["hold_action", "double_tap_action"] as const).map(
(action) => ({
name: action,
schema: [
{
name: "double_tap_action",
selector: {
ui_action: {
default_action: "none" as const,
default_action: "none",
},
},
})
),
},
],
},
],
},

View File

@ -31,7 +31,11 @@ export class HuiIconElement extends LitElement implements LovelaceElement {
throw Error("Icon required");
}
this._config = { tap_action: { action: "more-info" }, ...config };
this._config = {
tap_action: { action: "more-info" },
hold_action: { action: "more-info" },
...config,
};
}
protected render() {

View File

@ -29,7 +29,11 @@ export class HuiImageElement extends LitElement implements LovelaceElement {
throw Error("Invalid configuration");
}
this._config = { tap_action: { action: "more-info" }, ...config };
this._config = {
tap_action: { action: "more-info" },
hold_action: { action: "more-info" },
...config,
};
this.classList.toggle(
"clickable",

View File

@ -60,7 +60,11 @@ export class HuiStateBadgeElement
throw Error("Entity required");
}
this._config = { tap_action: { action: "more-info" }, ...config };
this._config = {
tap_action: { action: "more-info" },
hold_action: { action: "more-info" },
...config,
};
}
protected shouldUpdate(changedProps: PropertyValues): boolean {

View File

@ -60,6 +60,7 @@ export class HuiStateIconElement extends LitElement implements LovelaceElement {
this._config = {
state_color: true,
tap_action: { action: "more-info" },
hold_action: { action: "more-info" },
...config,
};
}

View File

@ -56,7 +56,11 @@ class HuiStateLabelElement extends LitElement implements LovelaceElement {
throw Error("Entity required");
}
this._config = { tap_action: { action: "more-info" }, ...config };
this._config = {
tap_action: { action: "more-info" },
hold_action: { action: "more-info" },
...config,
};
}
protected shouldUpdate(changedProps: PropertyValues): boolean {