Merge pull request #276 from dermotduffy/null-action
Add support for the 'none' action
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
|||||||
LovelaceCardEditor,
|
LovelaceCardEditor,
|
||||||
MoreInfoActionConfig,
|
MoreInfoActionConfig,
|
||||||
NavigateActionConfig,
|
NavigateActionConfig,
|
||||||
|
NoActionConfig,
|
||||||
ToggleActionConfig,
|
ToggleActionConfig,
|
||||||
UrlActionConfig,
|
UrlActionConfig,
|
||||||
} from 'custom-card-helpers';
|
} from 'custom-card-helpers';
|
||||||
@@ -103,6 +104,12 @@ const customActionSchema = schemaForType<CustomActionConfig>()(
|
|||||||
action: z.literal('fire-dom-event'),
|
action: z.literal('fire-dom-event'),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
const noActionSchema = schemaForType<NoActionConfig>()(
|
||||||
|
z.object({
|
||||||
|
action: z.literal('none'),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
const frigateCardCustomActionBaseSchema = customActionSchema.extend({
|
const frigateCardCustomActionBaseSchema = customActionSchema.extend({
|
||||||
// Syntactic sugar to avoid 'fire-dom-event' as part of an external API.
|
// Syntactic sugar to avoid 'fire-dom-event' as part of an external API.
|
||||||
action: z
|
action: z
|
||||||
@@ -145,6 +152,7 @@ const actionSchema = z.union([
|
|||||||
navigateActionSchema,
|
navigateActionSchema,
|
||||||
urlActionSchema,
|
urlActionSchema,
|
||||||
moreInfoActionSchema,
|
moreInfoActionSchema,
|
||||||
|
noActionSchema,
|
||||||
frigateCardCustomActionSchema,
|
frigateCardCustomActionSchema,
|
||||||
]);
|
]);
|
||||||
export type ActionType = z.infer<typeof actionSchema>;
|
export type ActionType = z.infer<typeof actionSchema>;
|
||||||
|
|||||||
Reference in New Issue
Block a user