1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-02-15 07:25:54 +00:00

hui-gauge-card-editor: use imported code for actions (#29326)

use imported code for actions
This commit is contained in:
ildar170975
2026-02-02 16:02:22 +03:00
committed by GitHub
parent 847a040fa7
commit 14f8d982a9

View File

@@ -10,7 +10,6 @@ import {
number,
object,
optional,
refine,
string,
} from "superstruct";
import { fireEvent } from "../../../../common/dom/fire_event";
@@ -23,6 +22,7 @@ import type { GaugeCardConfig } from "../../cards/types";
import {
ACTION_RELATED_CONTEXT,
type UiAction,
supportedActions,
} from "../../components/hui-action-editor";
import type { LovelaceCardEditor } from "../../types";
import { actionConfigStruct } from "../structs/action-struct";
@@ -57,13 +57,11 @@ const cardConfigStruct = assign(
theme: optional(string()),
needle: optional(boolean()),
segments: optional(array(gaugeSegmentStruct)),
tap_action: optional(
refine(actionConfigStruct, TAP_ACTIONS.toString(), (value) =>
TAP_ACTIONS.includes(value.action)
)
tap_action: optional(supportedActions(actionConfigStruct, TAP_ACTIONS)),
hold_action: optional(supportedActions(actionConfigStruct, TAP_ACTIONS)),
double_tap_action: optional(
supportedActions(actionConfigStruct, TAP_ACTIONS)
),
hold_action: optional(actionConfigStruct),
double_tap_action: optional(actionConfigStruct),
})
);