mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
More scrolling restore fixes, and fix custom panel iframe check (#6290)
This commit is contained in:
parent
b881adb853
commit
1f15094da7
@ -185,8 +185,7 @@ class PartialPanelResolver extends HassRouterPage {
|
||||
curPanel.component_name !== "iframe" &&
|
||||
// Do not disconnect any custom panel that embeds into iframe (ie hassio)
|
||||
(curPanel.component_name !== "custom" ||
|
||||
!(curPanel.config as CustomPanelInfo).config._panel_custom
|
||||
.embed_iframe)
|
||||
!(curPanel as CustomPanelInfo).config._panel_custom.embed_iframe)
|
||||
) {
|
||||
this._disconnectedPanel = this.lastChild as HTMLElement;
|
||||
const activeEl = deepActiveElement(
|
||||
|
@ -62,7 +62,7 @@ class PanelCalendar extends LitElement {
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<app-header-layout has-scrolling-region>
|
||||
<app-header-layout>
|
||||
<app-header fixed slot="header">
|
||||
<app-toolbar>
|
||||
<ha-menu-button
|
||||
|
@ -127,7 +127,7 @@ class HaConfigDashboard extends LitElement {
|
||||
}
|
||||
|
||||
return html`
|
||||
<app-header-layout has-scrolling-region>
|
||||
<app-header-layout>
|
||||
<app-header fixed slot="header">
|
||||
<app-toolbar>
|
||||
<ha-menu-button
|
||||
|
@ -89,7 +89,7 @@ class HaConfigZwave extends LocalizeMixin(EventsMixin(PolymerElement)) {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
</style>
|
||||
<ha-app-layout has-scrolling-region="">
|
||||
<ha-app-layout>
|
||||
<app-header slot="header" fixed="">
|
||||
<app-toolbar>
|
||||
<ha-icon-button-arrow-prev
|
||||
|
@ -36,7 +36,7 @@ class PanelDeveloperTools extends LitElement {
|
||||
protected render(): TemplateResult {
|
||||
const page = this._page;
|
||||
return html`
|
||||
<app-header-layout has-scrolling-region>
|
||||
<app-header-layout>
|
||||
<app-header fixed slot="header">
|
||||
<app-toolbar>
|
||||
<ha-menu-button
|
||||
|
@ -50,7 +50,7 @@ class HaPanelHistory extends LitElement {
|
||||
|
||||
protected render() {
|
||||
return html`
|
||||
<app-header-layout has-scrolling-region>
|
||||
<app-header-layout>
|
||||
<app-header slot="header" fixed>
|
||||
<app-toolbar>
|
||||
<ha-menu-button
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
property,
|
||||
PropertyValues,
|
||||
TemplateResult,
|
||||
eventOptions,
|
||||
} from "lit-element";
|
||||
import { scroll } from "lit-virtualizer";
|
||||
import { formatDate } from "../../common/datetime/format_date";
|
||||
@ -17,6 +18,7 @@ import { computeRTL } from "../../common/util/compute_rtl";
|
||||
import "../../components/ha-icon";
|
||||
import { LogbookEntry } from "../../data/logbook";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { restoreScroll } from "../../common/decorators/restore-scroll";
|
||||
|
||||
class HaLogbook extends LitElement {
|
||||
@property() public hass!: HomeAssistant;
|
||||
@ -29,6 +31,9 @@ class HaLogbook extends LitElement {
|
||||
// @ts-ignore
|
||||
private _rtl = false;
|
||||
|
||||
// @ts-ignore
|
||||
@restoreScroll(".container") private _savedScrollPos?: number;
|
||||
|
||||
protected shouldUpdate(changedProps: PropertyValues) {
|
||||
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
||||
const languageChanged =
|
||||
@ -50,7 +55,7 @@ class HaLogbook extends LitElement {
|
||||
}
|
||||
|
||||
return html`
|
||||
<div class="container">
|
||||
<div class="container" @scroll=${this._saveScrollPos}>
|
||||
${scroll({
|
||||
items: this.entries,
|
||||
renderItem: (item: LogbookEntry, index?: number) =>
|
||||
@ -116,6 +121,11 @@ class HaLogbook extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
@eventOptions({ passive: true })
|
||||
private _saveScrollPos(e: Event) {
|
||||
this._savedScrollPos = (e.target as HTMLDivElement).scrollTop;
|
||||
}
|
||||
|
||||
private _entityClicked(ev: Event) {
|
||||
ev.preventDefault();
|
||||
fireEvent(this, "hass-more-info", {
|
||||
|
@ -72,7 +72,7 @@ export class HaPanelLogbook extends LitElement {
|
||||
|
||||
protected render() {
|
||||
return html`
|
||||
<app-header-layout has-scrolling-region>
|
||||
<app-header-layout>
|
||||
<app-header slot="header" fixed>
|
||||
<app-toolbar>
|
||||
<ha-menu-button
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
mdiPencil,
|
||||
mdiHelpCircle,
|
||||
} from "@mdi/js";
|
||||
import "@polymer/app-layout/app-header-layout/app-header-layout";
|
||||
import "@polymer/app-layout/app-header/app-header";
|
||||
import "@polymer/app-layout/app-scroll-effects/effects/waterfall";
|
||||
import "@polymer/app-layout/app-toolbar/app-toolbar";
|
||||
|
@ -76,7 +76,7 @@ class HaPanelMailbox extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
||||
}
|
||||
</style>
|
||||
|
||||
<app-header-layout has-scrolling-region>
|
||||
<app-header-layout>
|
||||
<app-header slot="header" fixed>
|
||||
<app-toolbar>
|
||||
<ha-menu-button
|
||||
|
@ -68,7 +68,7 @@ class HaPanelProfile extends LitElement {
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<app-header-layout has-scrolling-region>
|
||||
<app-header-layout>
|
||||
<app-header slot="header" fixed>
|
||||
<app-toolbar>
|
||||
<ha-menu-button
|
||||
|
@ -68,7 +68,7 @@ class HaPanelShoppingList extends LocalizeMixin(PolymerElement) {
|
||||
}
|
||||
</style>
|
||||
|
||||
<app-header-layout has-scrolling-region>
|
||||
<app-header-layout>
|
||||
<app-header slot="header" fixed>
|
||||
<app-toolbar>
|
||||
<ha-menu-button
|
||||
|
Loading…
x
Reference in New Issue
Block a user