mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Add interactions for weather card editor (#24864)
This commit is contained in:
parent
c4b5882b2d
commit
94ced8af32
@ -1,3 +1,4 @@
|
|||||||
|
import { mdiGestureTap } from "@mdi/js";
|
||||||
import { html, LitElement, nothing } from "lit";
|
import { html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
@ -5,12 +6,13 @@ import {
|
|||||||
assert,
|
assert,
|
||||||
assign,
|
assign,
|
||||||
boolean,
|
boolean,
|
||||||
|
number,
|
||||||
object,
|
object,
|
||||||
optional,
|
optional,
|
||||||
string,
|
string,
|
||||||
number,
|
|
||||||
} from "superstruct";
|
} from "superstruct";
|
||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
|
import { supportsFeature } from "../../../../common/entity/supports-feature";
|
||||||
import type { LocalizeFunc } from "../../../../common/translations/localize";
|
import type { LocalizeFunc } from "../../../../common/translations/localize";
|
||||||
import "../../../../components/ha-form/ha-form";
|
import "../../../../components/ha-form/ha-form";
|
||||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||||
@ -22,7 +24,6 @@ import type { WeatherForecastCardConfig } from "../../cards/types";
|
|||||||
import type { LovelaceCardEditor } from "../../types";
|
import type { LovelaceCardEditor } from "../../types";
|
||||||
import { actionConfigStruct } from "../structs/action-struct";
|
import { actionConfigStruct } from "../structs/action-struct";
|
||||||
import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||||
import { supportsFeature } from "../../../../common/entity/supports-feature";
|
|
||||||
|
|
||||||
const cardConfigStruct = assign(
|
const cardConfigStruct = assign(
|
||||||
baseLovelaceCardConfig,
|
baseLovelaceCardConfig,
|
||||||
@ -239,6 +240,37 @@ export class HuiWeatherForecastCardEditor
|
|||||||
selector: { number: { min: 1, max: 12 } },
|
selector: { number: { min: 1, max: 12 } },
|
||||||
default: 5,
|
default: 5,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "interactions",
|
||||||
|
type: "expandable",
|
||||||
|
flatten: true,
|
||||||
|
iconPath: mdiGestureTap,
|
||||||
|
schema: [
|
||||||
|
{
|
||||||
|
name: "tap_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,
|
||||||
|
selector: {
|
||||||
|
ui_action: {
|
||||||
|
default_action: "none" as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
] as const)
|
] as const)
|
||||||
: []),
|
: []),
|
||||||
] as const
|
] as const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user