Fix alignment of toggles
This commit is contained in:
parent
d3a35345ae
commit
5e75f8b19e
@ -11,6 +11,9 @@ class SliderEntityRow extends Polymer.Element {
|
|||||||
min-width: 45px;
|
min-width: 45px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.toggle {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<template is="dom-if" if="{{!displayRow}}">
|
<template is="dom-if" if="{{!displayRow}}">
|
||||||
<style>
|
<style>
|
||||||
@ -23,8 +26,8 @@ class SliderEntityRow extends Polymer.Element {
|
|||||||
|
|
||||||
const input = Polymer.html`
|
const input = Polymer.html`
|
||||||
<div>
|
<div>
|
||||||
<template is="dom-if" if="{{displaySlider}}">
|
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
|
<template is="dom-if" if="{{displaySlider}}">
|
||||||
<ha-slider
|
<ha-slider
|
||||||
min="0"
|
min="0"
|
||||||
max="100"
|
max="100"
|
||||||
@ -35,19 +38,22 @@ class SliderEntityRow extends Polymer.Element {
|
|||||||
on-click="stopPropagation"
|
on-click="stopPropagation"
|
||||||
ignore-bar-touch
|
ignore-bar-touch
|
||||||
></ha-slider>
|
></ha-slider>
|
||||||
<span class="state" on-click="stopPropagation">
|
<template is="dom-if" if="{{displayValue}}">
|
||||||
<template is="dom-if" if="{{displayValue}}">
|
<span class="state" on-click="stopPropagation">
|
||||||
[[statusString(stateObj)]]
|
[[statusString(stateObj)]]
|
||||||
</template>
|
</span>
|
||||||
<template is="dom-if" if="{{displayToggle}}">
|
</template>
|
||||||
|
</template>
|
||||||
|
<template is="dom-if" if="{{displayToggle}}">
|
||||||
|
<span class="toggle" on-click="stopPropagation">
|
||||||
<ha-entity-toggle
|
<ha-entity-toggle
|
||||||
state-obj="[[stateObj]]"
|
state-obj="[[stateObj]]"
|
||||||
hass="[[_hass]]"
|
hass="[[_hass]]"
|
||||||
></ha-entity-toggle>
|
></ha-entity-toggle>
|
||||||
</template>
|
</span>
|
||||||
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -83,6 +89,7 @@ class SliderEntityRow extends Polymer.Element {
|
|||||||
return (stateObj.state === 'on')?Math.ceil(stateObj.attributes.brightness*100.0/255):0;
|
return (stateObj.state === 'on')?Math.ceil(stateObj.attributes.brightness*100.0/255):0;
|
||||||
},
|
},
|
||||||
supported: (stateObj) => {
|
supported: (stateObj) => {
|
||||||
|
if(stateObj.state === 'off' && this._config.hide_when_off) return false;
|
||||||
if('brightness' in stateObj.attributes) return true;
|
if('brightness' in stateObj.attributes) return true;
|
||||||
if(('supported_features' in stateObj.attributes) &&
|
if(('supported_features' in stateObj.attributes) &&
|
||||||
(stateObj.attributes.supported_features & 1)) return true;
|
(stateObj.attributes.supported_features & 1)) return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user