From 447dd6640f7681c89d2c540f33074b988c3e0018 Mon Sep 17 00:00:00 2001 From: Victor Cerutti Date: Sun, 21 Jan 2018 06:47:15 +0100 Subject: [PATCH] feature : display input number next to slider (#808) * feature : display input number next to slider * Improvements for Box mode of input number Add unit when available and align the value to the right * fix for small width cards hide state if slider width<100px * add a space between if and ( * Fix value display after a window resize State value is now hiding or showing correctly after a window resize, using iron-resize component * fixes eslint validator * Fix a typo in state-card * Improvement : Apply all properties altogether As suggered by @andrey-git, I made use of setProperties * Watch for mode update of input_number If a mode is updated and the box switches from "box" to "slider", it now also update the visibility of the state value depending on the slider width * Update width showing state value * Use ResizeObserver when available * Fix conditionnal mistake Related @andrey-git review here https://github.com/home-assistant/home-assistant-polymer/pull/808#pullrequestreview-90048982 --- .eslintrc-hound.json | 3 +- src/more-infos/more-info-climate.html | 34 +++++--- .../state-card-input_number.html | 79 +++++++++++++++---- 3 files changed, 90 insertions(+), 26 deletions(-) diff --git a/.eslintrc-hound.json b/.eslintrc-hound.json index 59177faee8..b5ede0d746 100644 --- a/.eslintrc-hound.json +++ b/.eslintrc-hound.json @@ -16,7 +16,8 @@ "__DEMO__": false, "__BUILD__": false, "Polymer": true, - "webkitSpeechRecognition": false + "webkitSpeechRecognition": false, + "ResizeObserver": false }, "env": { "browser": true, diff --git a/src/more-infos/more-info-climate.html b/src/more-infos/more-info-climate.html index 9206a9defb..05e7e40909 100644 --- a/src/more-infos/more-info-climate.html +++ b/src/more-infos/more-info-climate.html @@ -66,6 +66,17 @@ width: 100%; } + .container-humidity .single-row { + display: flex; + height: 50px; + } + + .target-humidity { + width: 90px; + font-size: 200%; + margin: auto; + } + ha-climate-control.range-control-left, ha-climate-control.range-control-right { float: left; @@ -144,17 +155,18 @@
-
-
Target Humidity
- - +
Target Humidity
+
+
[[stateObj.attributes.humidity]] %
+ +
diff --git a/src/state-summary/state-card-input_number.html b/src/state-summary/state-card-input_number.html index 0874b3f67c..dbdcb8941f 100644 --- a/src/state-summary/state-card-input_number.html +++ b/src/state-summary/state-card-input_number.html @@ -6,6 +6,8 @@ + + @@ -15,17 +17,31 @@
+ +