Another fix for app-header-layout (#738)

This commit is contained in:
Andrey 2017-12-23 07:07:46 +02:00 committed by Paulus Schoutsen
parent f0f1a56537
commit 60ac82edc5
5 changed files with 39 additions and 36 deletions

View File

@ -1,5 +1,4 @@
<link rel="import" href="../../../bower_components/polymer/polymer-element.html"> <link rel="import" href="../../../bower_components/polymer/polymer-element.html">
<link rel="import" href="../../../bower_components/app-layout/app-header-layout/app-header-layout.html">
<link rel="import" href="../../../bower_components/app-layout/app-header/app-header.html"> <link rel="import" href="../../../bower_components/app-layout/app-header/app-header.html">
<link rel="import" href="../../../bower_components/app-layout/app-toolbar/app-toolbar.html"> <link rel="import" href="../../../bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../../../bower_components/paper-card/paper-card.html"> <link rel="import" href="../../../bower_components/paper-card/paper-card.html">
@ -19,6 +18,7 @@
<link rel='import' href='../../../src/components/entity/ha-entity-picker.html'> <link rel='import' href='../../../src/components/entity/ha-entity-picker.html'>
<link rel='import' href='../../../src/components/ha-combo-box.html'> <link rel='import' href='../../../src/components/ha-combo-box.html'>
<link rel='import' href='../../../src/components/ha-service-picker.html'> <link rel='import' href='../../../src/components/ha-service-picker.html'>
<link rel='import' href='../../../src/layouts/ha-app-layout.html'>
<link rel='import' href='../../../src/util/hass-mixins.html'> <link rel='import' href='../../../src/util/hass-mixins.html'>
<link rel="import" href="../ha-config-section.html"> <link rel="import" href="../ha-config-section.html">
@ -82,7 +82,7 @@
} }
</style> </style>
<app-header-layout has-scrolling-region> <ha-app-layout has-scrolling-region>
<app-header slot="header" fixed> <app-header slot="header" fixed>
<app-toolbar> <app-toolbar>
<paper-icon-button <paper-icon-button
@ -98,15 +98,15 @@
<div class='errors'>[[errors]]</div> <div class='errors'>[[errors]]</div>
</template> </template>
<div id='root'></div> <div id='root'></div>
<paper-fab </div>
<paper-fab slot="fab"
is-wide$='[[isWide]]' is-wide$='[[isWide]]'
dirty$='[[dirty]]' dirty$='[[dirty]]'
icon='mdi:content-save' icon='mdi:content-save'
title='Save' title='Save'
on-tap='saveAutomation' on-tap='saveAutomation'
></paper-fab> ></paper-fab>
</div> </ha-app-layout>
</app-header-layout>
</template> </template>
</dom-module> </dom-module>

View File

@ -1,5 +1,4 @@
<link rel="import" href="../../../bower_components/polymer/polymer-element.html"> <link rel="import" href="../../../bower_components/polymer/polymer-element.html">
<link rel="import" href="../../../bower_components/app-layout/app-header-layout/app-header-layout.html">
<link rel="import" href="../../../bower_components/app-layout/app-header/app-header.html"> <link rel="import" href="../../../bower_components/app-layout/app-header/app-header.html">
<link rel="import" href="../../../bower_components/app-layout/app-toolbar/app-toolbar.html"> <link rel="import" href="../../../bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../../../bower_components/paper-card/paper-card.html"> <link rel="import" href="../../../bower_components/paper-card/paper-card.html">
@ -8,6 +7,7 @@
<link rel="import" href="../../../bower_components/paper-fab/paper-fab.html"> <link rel="import" href="../../../bower_components/paper-fab/paper-fab.html">
<link rel="import" href="../../../bower_components/paper-icon-button/paper-icon-button.html"> <link rel="import" href="../../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel='import' href='../../../src/layouts/ha-app-layout.html'>
<link rel='import' href='../../../src/util/hass-mixins.html'> <link rel='import' href='../../../src/util/hass-mixins.html'>
<link rel="import" href="../ha-config-section.html"> <link rel="import" href="../ha-config-section.html">
@ -44,7 +44,7 @@
} }
</style> </style>
<app-header-layout has-scrolling-region> <ha-app-layout has-scrolling-region>
<app-header slot="header" fixed> <app-header slot="header" fixed>
<app-toolbar> <app-toolbar>
<paper-icon-button <paper-icon-button
@ -82,13 +82,13 @@
</paper-card> </paper-card>
</ha-config-section> </ha-config-section>
<paper-fab <paper-fab slot="fab"
is-wide$='[[isWide]]' is-wide$='[[isWide]]'
icon='mdi:plus' icon='mdi:plus'
title='Add Automation' title='Add Automation'
on-tap='addAutomation' on-tap='addAutomation'
></paper-fab> ></paper-fab>
</app-header-layout> </ha-app-layout>
</template> </template>
</dom-module> </dom-module>

View File

@ -91,20 +91,19 @@
<div main-title>Script [[name]]</div> <div main-title>Script [[name]]</div>
</app-toolbar> </app-toolbar>
</app-header> </app-header>
<div class='content'> <div class='content'>
<template is='dom-if' if='[[errors]]'> <template is='dom-if' if='[[errors]]'>
<div class='errors'>[[errors]]</div> <div class='errors'>[[errors]]</div>
</template> </template>
<div id='root'></div> <div id='root'></div>
<paper-fab </div>
<paper-fab slot="fab"
is-wide$='[[isWide]]' is-wide$='[[isWide]]'
dirty$='[[dirty]]' dirty$='[[dirty]]'
icon='mdi:content-save' icon='mdi:content-save'
title='Save' title='Save'
on-tap='saveScript' on-tap='saveScript'
></paper-fab> ></paper-fab>
</div>
</ha-app-layout> </ha-app-layout>
</template> </template>

View File

@ -1,5 +1,4 @@
<link rel="import" href="../../../bower_components/polymer/polymer-element.html"> <link rel="import" href="../../../bower_components/polymer/polymer-element.html">
<link rel="import" href="../../../bower_components/app-layout/app-header-layout/app-header-layout.html">
<link rel="import" href="../../../bower_components/app-layout/app-header/app-header.html"> <link rel="import" href="../../../bower_components/app-layout/app-header/app-header.html">
<link rel="import" href="../../../bower_components/app-layout/app-toolbar/app-toolbar.html"> <link rel="import" href="../../../bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../../../bower_components/paper-card/paper-card.html"> <link rel="import" href="../../../bower_components/paper-card/paper-card.html">
@ -8,6 +7,7 @@
<link rel="import" href="../../../bower_components/paper-fab/paper-fab.html"> <link rel="import" href="../../../bower_components/paper-fab/paper-fab.html">
<link rel="import" href="../../../bower_components/paper-icon-button/paper-icon-button.html"> <link rel="import" href="../../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel='import' href='../../../src/layouts/ha-app-layout.html'>
<link rel='import' href='../../../src/util/hass-mixins.html'> <link rel='import' href='../../../src/util/hass-mixins.html'>
<link rel="import" href="../ha-config-section.html"> <link rel="import" href="../ha-config-section.html">
@ -40,7 +40,7 @@
} }
</style> </style>
<app-header-layout has-scrolling-region> <ha-app-layout has-scrolling-region>
<app-header slot="header" fixed> <app-header slot="header" fixed>
<app-toolbar> <app-toolbar>
<paper-icon-button <paper-icon-button
@ -78,13 +78,13 @@
</paper-card> </paper-card>
</ha-config-section> </ha-config-section>
<paper-fab <paper-fab slot="fab"
is-wide$='[[isWide]]' is-wide$='[[isWide]]'
icon='mdi:plus' icon='mdi:plus'
title='Add Script' title='Add Script'
on-tap='addScript' on-tap='addScript'
></paper-fab> ></paper-fab>
</app-header-layout> </ha-app-layout>
</template> </template>
</dom-module> </dom-module>

View File

@ -30,58 +30,62 @@ transform: translate(0) is added.
position: relative; position: relative;
z-index: 0; z-index: 0;
} }
#wrapper ::slotted([slot=header]) { #wrapper ::slotted([slot=header]) {
@apply --layout-fixed-top; @apply --layout-fixed-top;
z-index: 1; z-index: 1;
} }
#wrapper.initializing ::slotted([slot=header]) { #wrapper.initializing ::slotted([slot=header]) {
position: relative; position: relative;
} }
:host([has-scrolling-region]) { :host([has-scrolling-region]) {
height: 100%; height: 100%;
} }
:host([has-scrolling-region]) #wrapper ::slotted([slot=header]) { :host([has-scrolling-region]) #wrapper ::slotted([slot=header]) {
position: absolute; position: absolute;
} }
:host([has-scrolling-region]) #wrapper.initializing ::slotted([slot=header]) { :host([has-scrolling-region]) #wrapper.initializing ::slotted([slot=header]) {
position: relative; position: relative;
} }
:host([has-scrolling-region]) #wrapper #contentContainer { :host([has-scrolling-region]) #wrapper #contentContainer {
@apply --layout-fit; @apply --layout-fit;
overflow-y: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
} }
:host([has-scrolling-region]) #wrapper.initializing #contentContainer { :host([has-scrolling-region]) #wrapper.initializing #contentContainer {
position: relative; position: relative;
} }
#contentContainer { #contentContainer {
/* Create a stacking context here so that all children appear below the header. */ /* Create a stacking context here so that all children appear below the header. */
position: relative; position: relative;
z-index: 0; z-index: 0;
}
.scroll-limiter {
/* Using 'transform' will cause 'position: fixed' elements to behave like /* Using 'transform' will cause 'position: fixed' elements to behave like
'position: absolute' relative to this element. */ 'position: absolute' relative to this element. */
transform: translate(0); transform: translate(0);
} }
:host([has-scrolling-region]) .scroll-limiter {
overflow-y: auto;
height: 100%
}
@media print { @media print {
:host([has-scrolling-region]) .scroll-limiter { :host([has-scrolling-region]) #wrapper #contentContainer {
overflow-y: visible; overflow-y: visible;
} }
} }
</style> </style>
<div id="wrapper" class="initializing"> <div id="wrapper" class="initializing">
<slot id="headerSlot" name="header"></slot> <slot id="headerSlot" name="header"></slot>
<div id="contentContainer"> <div id="contentContainer">
<div class="scroll-limiter">
<slot></slot> <slot></slot>
</div> </div>
</div> <slot id="fab" name="fab"></slot>
</div> </div>
</template> </template>