Skip to content

Commit

Permalink
Update fan-control-entity-row.js
Browse files Browse the repository at this point in the history
  • Loading branch information
finity69x2 authored Feb 16, 2022
1 parent 4003d37 commit d95b2f7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions dist/fan-control-entity-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CustomFanRow extends Polymer.Element {
<div class='horizontal justified layout' on-click="stopPropagation">
<button
class='speed'
style='[[_leftColor]];min-width:[[_width]];max-width:[[_width]];height:[[_height]]'
style='[[_leftColor]];min-width:[[_width]];max-width:[[_width]];height:[[_height]];[[_hideLeft]]'
toggles name="[[_leftName]]"
on-click='setSpeed'
disabled='[[_leftState]]'>[[_leftText]]</button>
Expand All @@ -51,7 +51,7 @@ class CustomFanRow extends Polymer.Element {
disabled='[[_midRightState]]'>[[_midRightText]]</button>
<button
class='speed'
style='[[_rightColor]];min-width:[[_width]];max-width:[[_width]];height:[[_height]]'
style='[[_rightColor]];min-width:[[_width]];max-width:[[_width]];height:[[_height]];[[_hideRight]]'
toggles name="[[_rightName]]"
on-click='setSpeed'
disabled='[[_rightState]]'>[[_rightText]]</button>
Expand Down Expand Up @@ -82,8 +82,10 @@ class CustomFanRow extends Polymer.Element {
_midLeftName: String,
_midRightName: String,
_rightName: String,
_hideLeft: String,
_hideMidLeft: String,
_hideMidRight: String,
_hideRight: String,
_leftState: Boolean,
_midLeftState: Boolean,
_midRightState: Boolean,
Expand All @@ -100,6 +102,7 @@ class CustomFanRow extends Polymer.Element {
sendStateWithSpeed: false,
reverseButtons: false,
isTwoSpeedFan: false,
hideOff: false,
width: '30px',
height: '30px',
isOffColor: '#f44c09',
Expand All @@ -123,6 +126,7 @@ class CustomFanRow extends Polymer.Element {
const sendStateWithSpeed = config.sendStateWithSpeed;
const revButtons = config.reverseButtons;
const twoSpdFan = config.isTwoSpeedFan;
const hide_Off = config.hideOff;
const buttonWidth = config.width;
const buttonHeight = config.height;
const custOnLowClr = config.isOnLowColor;
Expand Down Expand Up @@ -227,6 +231,7 @@ class CustomFanRow extends Polymer.Element {
let lowname = 'low';
let offname = 'off';

let hideoff = 'display:block';
let hidemedium = 'display:block';
let nohide = 'display:block';

Expand All @@ -236,6 +241,11 @@ class CustomFanRow extends Polymer.Element {
hidemedium = 'display:block';
}

if (hide_Off) {
hideoff = 'display:none';
} else {
hideoff = 'display:block';
}

if (revButtons) {
this.setProperties({
Expand All @@ -258,8 +268,10 @@ class CustomFanRow extends Polymer.Element {
_midLeftName: lowname,
_midRightName: medname,
_rightName: hiname,
_hideLeft: hideoff,
_hideMidLeft: nohide,
_hideMidRight: hidemedium,
_hideRight: nohide,
});
} else {
this.setProperties({
Expand All @@ -282,8 +294,10 @@ class CustomFanRow extends Polymer.Element {
_midLeftName: medname,
_midRightName: lowname,
_rightName: offname,
_hideRight: hideoff,
_hideMidRight: nohide,
_hideMidLeft: hidemedium,
_hideLeft: nohide,
});
}
}
Expand Down

0 comments on commit d95b2f7

Please sign in to comment.