Merge pull request #684 from dermotduffy/state-color
Fix state color in submenu items
This commit is contained in:
@@ -366,6 +366,7 @@ export class FrigateCard extends LitElement {
|
||||
camera: camera,
|
||||
});
|
||||
return {
|
||||
enabled: true,
|
||||
icon: getCameraIcon(this._hass, config),
|
||||
entity: config.camera_entity,
|
||||
state_color: true,
|
||||
@@ -538,6 +539,8 @@ export class FrigateCard extends LitElement {
|
||||
});
|
||||
|
||||
return {
|
||||
enabled: true,
|
||||
selected: false,
|
||||
icon: getEntityIcon(this._hass, playerEntityID) || 'mdi:cast',
|
||||
entity: playerEntityID,
|
||||
state_color: false,
|
||||
|
||||
+11
-10
@@ -1,12 +1,12 @@
|
||||
import type { Corner } from '@material/mwc-menu';
|
||||
import { HomeAssistant } from 'custom-card-helpers';
|
||||
import {
|
||||
CSSResultGroup,
|
||||
html,
|
||||
LitElement,
|
||||
PropertyValues,
|
||||
TemplateResult,
|
||||
unsafeCSS
|
||||
CSSResultGroup,
|
||||
html,
|
||||
LitElement,
|
||||
PropertyValues,
|
||||
TemplateResult,
|
||||
unsafeCSS
|
||||
} from 'lit';
|
||||
import { customElement, property } from 'lit/decorators.js';
|
||||
import { ifDefined } from 'lit/directives/if-defined.js';
|
||||
@@ -15,8 +15,8 @@ import { actionHandler } from '../action-handler-directive.js';
|
||||
import submenuStyle from '../scss/submenu.scss';
|
||||
import { MenuSubmenu, MenuSubmenuItem, MenuSubmenuSelect } from '../types.js';
|
||||
import {
|
||||
frigateCardHasAction,
|
||||
stopEventFromActivatingCardWideActions
|
||||
frigateCardHasAction,
|
||||
stopEventFromActivatingCardWideActions
|
||||
} from '../utils/action.js';
|
||||
import { isHassDifferent, refreshDynamicStateParameters } from '../utils/ha';
|
||||
import { domainIcon } from '../utils/icons/domain-icon.js';
|
||||
@@ -138,8 +138,7 @@ export class FrigateCardSubmenuSelect extends LitElement {
|
||||
return (
|
||||
changedProps.size != 1 ||
|
||||
!this.submenuSelect ||
|
||||
(!!oldHass &&
|
||||
isHassDifferent(this.hass, oldHass, [this.submenuSelect.entity]))
|
||||
(!!oldHass && isHassDifferent(this.hass, oldHass, [this.submenuSelect.entity]))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -187,7 +186,9 @@ export class FrigateCardSubmenuSelect extends LitElement {
|
||||
)
|
||||
: option;
|
||||
submenu.items.push({
|
||||
state_color: true,
|
||||
selected: stateObj.state === option,
|
||||
enabled: true,
|
||||
title: title || option,
|
||||
...((entity.startsWith('select.') || entity.startsWith('input_select.')) && {
|
||||
tap_action: {
|
||||
|
||||
+3
-3
@@ -466,10 +466,10 @@ export type MenuStateIcon = z.infer<typeof menuStateIconSchema>;
|
||||
const menuSubmenuItemSchema = elementsBaseSchema.extend({
|
||||
entity: z.string().optional(),
|
||||
icon: z.string().optional(),
|
||||
state_color: z.boolean().default(true).optional(),
|
||||
selected: z.boolean().default(false).optional(),
|
||||
state_color: z.boolean().default(true),
|
||||
selected: z.boolean().default(false),
|
||||
subtitle: z.string().optional(),
|
||||
enabled: z.boolean().default(true).optional(),
|
||||
enabled: z.boolean().default(true),
|
||||
});
|
||||
export type MenuSubmenuItem = z.infer<typeof menuSubmenuItemSchema>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user