From b7b91f27db26121cad669665bcd257f41dd1477a Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 23 Jun 2015 23:43:14 -0700 Subject: [PATCH] Frontend: fix bug where title was not shown for states partial --- homeassistant/components/frontend/version.py | 2 +- .../frontend/www_static/frontend.html | 122 +++++++++++++----- .../polymer/layouts/partial-states.html | 7 +- 3 files changed, 99 insertions(+), 32 deletions(-) diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index 044c8d1ff62..e3e2ae2bf01 100644 --- a/homeassistant/components/frontend/version.py +++ b/homeassistant/components/frontend/version.py @@ -1,2 +1,2 @@ """ DO NOT MODIFY. Auto-generated by build_frontend script """ -VERSION = "0a0110c72a6db31f3fa069a053363d05" +VERSION = "a44970ec771fb08baa6b54ff00a4e223" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index e8ef155378e..149052babc5 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -13661,9 +13661,21 @@ is separate from validation, and `allowed-pattern` does not affect how the input **/ Polymer.IronResizableBehavior = { properties: { + /** + * The closest ancestor element that implements `IronResizableBehavior`. + */ _parentResizable: { type: Object, observer: '_parentResizableChanged' + }, + + /** + * True if this element is currently notifying its descedant elements of + * resize. + */ + _notifyingDescendant: { + type: Boolean, + value: false } }, @@ -13681,7 +13693,8 @@ is separate from validation, and `allowed-pattern` does not affect how the input attached: function() { this.fire('iron-request-resize-notifications', null, { node: this, - bubbles: true + bubbles: true, + cancelable: true }); if (!this._parentResizable) { @@ -13710,16 +13723,12 @@ is separate from validation, and `allowed-pattern` does not affect how the input } this._interestedResizables.forEach(function(resizable) { - // TODO(cdata): Currently behaviors cannot define "abstract" methods.. - if (!this.resizerShouldNotify || this.resizerShouldNotify(resizable)) { - resizable.notifyResize(); + if (this.resizerShouldNotify(resizable)) { + this._notifyDescendant(resizable); } }, this); - this.fire('iron-resize', null, { - node: this, - bubbles: false - }); + this._fireResize(); }, /** @@ -13739,16 +13748,40 @@ is separate from validation, and `allowed-pattern` does not affect how the input if (index > -1) { this._interestedResizables.splice(index, 1); + this.unlisten(target, 'iron-resize', '_onDescendantIronResize'); } }, - // TODO(cdata): Currently behaviors cannot define "abstract" methods. - // resizerShouldNotify: function(el) { return true; }, + /** + * This method can be overridden to filter nested elements that should or + * should not be notified by the current element. Return true if an element + * should be notified, or false if it should not be notified. + * + * @param {HTMLElement} element A candidate descendant element that + * implements `IronResizableBehavior`. + * @return {boolean} True if the `element` should be notified of resize. + */ + resizerShouldNotify: function(element) { return true; }, - _parentResizableChanged: function(parentResizable) { - if (parentResizable) { - window.removeEventListener('resize', this._boundNotifyResize); + _onDescendantIronResize: function(event) { + if (this._notifyingDescendant) { + event.stopPropagation(); + return; } + + // NOTE(cdata): In ShadowDOM, event retargetting makes echoing of the + // otherwise non-bubbling event "just work." We do it manually here for + // the case where Polymer is not using shadow roots for whatever reason: + if (!Polymer.Settings.useShadow) { + this._fireResize(); + } + }, + + _fireResize: function() { + this.fire('iron-resize', null, { + node: this, + bubbles: false + }); }, _onIronRequestResizeNotifications: function(event) { @@ -13760,11 +13793,32 @@ is separate from validation, and `allowed-pattern` does not affect how the input if (this._interestedResizables.indexOf(target) === -1) { this._interestedResizables.push(target); + this.listen(target, 'iron-resize', '_onDescendantIronResize'); } target.assignParentResizable(this); + this._notifyDescendant(target); event.stopPropagation(); + }, + + _parentResizableChanged: function(parentResizable) { + if (parentResizable) { + window.removeEventListener('resize', this._boundNotifyResize); + } + }, + + _notifyDescendant: function(descendant) { + // NOTE(cdata): In IE10, attached is fired on children first, so it's + // important not to notify them if the parent is not attached yet (or + // else they will get redundantly notified when the parent attaches). + if (!this.isAttached) { + return; + } + + this._notifyingDescendant = true; + descendant.notifyResize(); + this._notifyingDescendant = false; } }; @@ -15409,6 +15463,10 @@ CSS properties | Action var target = window.getComputedStyle(this); var sizer = window.getComputedStyle(this.sizingTarget); this._fitInfo = { + inlineStyle: { + top: this.style.top || '', + left: this.style.left || '' + }, positionedBy: { vertically: target.top !== 'auto' ? 'top' : (target.bottom !== 'auto' ? 'bottom' : null), @@ -15436,11 +15494,11 @@ CSS properties | Action resetFit: function() { if (!this._fitInfo || !this._fitInfo.sizedBy.height) { this.sizingTarget.style.maxHeight = ''; - this.style.top = ''; + this.style.top = this._fitInfo ? this._fitInfo.inlineStyle.top : ''; } if (!this._fitInfo || !this._fitInfo.sizedBy.width) { this.sizingTarget.style.maxWidth = ''; - this.style.left = ''; + this.style.left = this._fitInfo ? this._fitInfo.inlineStyle.left : ''; } if (this._fitInfo) { this.style.position = this._fitInfo.positionedBy.css; @@ -15661,7 +15719,8 @@ context. You should place this element as a child of `` whenever possible. opened: { observer: '_openedChanged', type: Boolean, - value: false + value: false, + notify: true }, /** @@ -16071,7 +16130,7 @@ Custom property | Description | Default ### Accessibility This element has `role="dialog"` by default. Depending on the context, it may be more appropriate -to override this attribute with `role="alertdialog"`. The header (a `

` element) will +to override this attribute with `role="alertdialog"`. If `modal` is set, the element will set `aria-modal` and prevent the focus from exiting the element. It will also ensure that focus remains in the dialog. @@ -16192,15 +16251,17 @@ The `aria-labelledby` attribute will be set to the header element, if one exists _onDialogClick: function(event) { var target = event.target; - while (target !== this) { - if (target.hasAttribute('dialog-dismiss')) { - this._updateClosingReasonConfirmed(false); - this.close(); - break; - } else if (target.hasAttribute('dialog-confirm')) { - this._updateClosingReasonConfirmed(true); - this.close(); - break; + while (target && target !== this) { + if (target.hasAttribute) { + if (target.hasAttribute('dialog-dismiss')) { + this._updateClosingReasonConfirmed(false); + this.close(); + break; + } else if (target.hasAttribute('dialog-confirm')) { + this._updateClosingReasonConfirmed(true); + this.close(); + break; + } } target = target.parentNode; } @@ -22306,7 +22367,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN