mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
Menu button simplify (#2930)
* Simplify the hass-menu button * Purge showMenu boolean
This commit is contained in:
parent
92e6c5adfd
commit
8785b03fd8
@ -60,11 +60,7 @@ class HassioAddonView extends PolymerElement {
|
|||||||
<app-header-layout has-scrolling-region="">
|
<app-header-layout has-scrolling-region="">
|
||||||
<app-header fixed="" slot="header">
|
<app-header fixed="" slot="header">
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button hassio></ha-menu-button>
|
||||||
hassio
|
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<paper-icon-button
|
<paper-icon-button
|
||||||
icon="hassio:arrow-left"
|
icon="hassio:arrow-left"
|
||||||
on-click="backTapped"
|
on-click="backTapped"
|
||||||
@ -119,8 +115,6 @@ class HassioAddonView extends PolymerElement {
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
showMenu: Boolean,
|
|
||||||
narrow: Boolean,
|
|
||||||
route: Object,
|
route: Object,
|
||||||
routeData: {
|
routeData: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -8,12 +8,7 @@ class HassioApp extends PolymerElement {
|
|||||||
static get template() {
|
static get template() {
|
||||||
return html`
|
return html`
|
||||||
<template is="dom-if" if="[[hass]]">
|
<template is="dom-if" if="[[hass]]">
|
||||||
<hassio-main
|
<hassio-main hass="[[hass]]" route="[[route]]"></hassio-main>
|
||||||
hass="[[hass]]"
|
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
route="[[route]]"
|
|
||||||
></hassio-main>
|
|
||||||
</template>
|
</template>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -21,8 +16,6 @@ class HassioApp extends PolymerElement {
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
narrow: Boolean,
|
|
||||||
showMenu: Boolean,
|
|
||||||
route: Object,
|
route: Object,
|
||||||
hassioPanel: {
|
hassioPanel: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@ -35,12 +28,9 @@ class HassioApp extends PolymerElement {
|
|||||||
super.ready();
|
super.ready();
|
||||||
window.setProperties = this.setProperties.bind(this);
|
window.setProperties = this.setProperties.bind(this);
|
||||||
this.addEventListener("location-changed", () => this._locationChanged());
|
this.addEventListener("location-changed", () => this._locationChanged());
|
||||||
this.addEventListener("hass-open-menu", () => this._menuEvent(true));
|
this.addEventListener("hass-toggle-menu", (ev) =>
|
||||||
this.addEventListener("hass-close-menu", () => this._menuEvent(false));
|
this.hassioPanel.fire("hass-toggle-menu", ev.detail)
|
||||||
}
|
);
|
||||||
|
|
||||||
_menuEvent(shouldOpen) {
|
|
||||||
this.hassioPanel.fire(shouldOpen ? "hass-open-menu" : "hass-close-menu");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_locationChanged() {
|
_locationChanged() {
|
||||||
|
@ -28,18 +28,13 @@ class HassioMain extends EventsMixin(NavigateMixin(PolymerElement)) {
|
|||||||
></hassio-data>
|
></hassio-data>
|
||||||
|
|
||||||
<template is="dom-if" if="[[!loaded]]">
|
<template is="dom-if" if="[[!loaded]]">
|
||||||
<hass-loading-screen
|
<hass-loading-screen></hass-loading-screen>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></hass-loading-screen>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template is="dom-if" if="[[loaded]]">
|
<template is="dom-if" if="[[loaded]]">
|
||||||
<template is="dom-if" if="[[!equalsAddon(routeData.page)]]">
|
<template is="dom-if" if="[[!equalsAddon(routeData.page)]]">
|
||||||
<hassio-pages-with-tabs
|
<hassio-pages-with-tabs
|
||||||
hass="[[hass]]"
|
hass="[[hass]]"
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
page="[[routeData.page]]"
|
page="[[routeData.page]]"
|
||||||
supervisor-info="[[supervisorInfo]]"
|
supervisor-info="[[supervisorInfo]]"
|
||||||
hass-info="[[hassInfo]]"
|
hass-info="[[hassInfo]]"
|
||||||
@ -49,8 +44,6 @@ class HassioMain extends EventsMixin(NavigateMixin(PolymerElement)) {
|
|||||||
<template is="dom-if" if="[[equalsAddon(routeData.page)]]">
|
<template is="dom-if" if="[[equalsAddon(routeData.page)]]">
|
||||||
<hassio-addon-view
|
<hassio-addon-view
|
||||||
hass="[[hass]]"
|
hass="[[hass]]"
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
route="[[route]]"
|
route="[[route]]"
|
||||||
></hassio-addon-view>
|
></hassio-addon-view>
|
||||||
</template>
|
</template>
|
||||||
@ -61,8 +54,6 @@ class HassioMain extends EventsMixin(NavigateMixin(PolymerElement)) {
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
narrow: Boolean,
|
|
||||||
showMenu: Boolean,
|
|
||||||
route: {
|
route: {
|
||||||
type: Object,
|
type: Object,
|
||||||
// Fake route object
|
// Fake route object
|
||||||
|
@ -37,11 +37,7 @@ class HassioPagesWithTabs extends NavigateMixin(PolymerElement) {
|
|||||||
<app-header-layout id="layout" has-scrolling-region>
|
<app-header-layout id="layout" has-scrolling-region>
|
||||||
<app-header fixed slot="header">
|
<app-header fixed slot="header">
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button hassio></ha-menu-button>
|
||||||
hassio
|
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>Hass.io</div>
|
<div main-title>Hass.io</div>
|
||||||
<template is="dom-if" if="[[showRefreshButton(page)]]">
|
<template is="dom-if" if="[[showRefreshButton(page)]]">
|
||||||
<paper-icon-button
|
<paper-icon-button
|
||||||
@ -107,8 +103,6 @@ class HassioPagesWithTabs extends NavigateMixin(PolymerElement) {
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
showMenu: Boolean,
|
|
||||||
narrow: Boolean,
|
|
||||||
page: String,
|
page: String,
|
||||||
supervisorInfo: Object,
|
supervisorInfo: Object,
|
||||||
hostInfo: Object,
|
hostInfo: Object,
|
||||||
|
@ -11,9 +11,6 @@ import { fireEvent } from "../common/dom/fire_event";
|
|||||||
|
|
||||||
@customElement("ha-menu-button")
|
@customElement("ha-menu-button")
|
||||||
class HaMenuButton extends LitElement {
|
class HaMenuButton extends LitElement {
|
||||||
@property({ type: Boolean })
|
|
||||||
public showMenu = false;
|
|
||||||
|
|
||||||
@property({ type: Boolean })
|
@property({ type: Boolean })
|
||||||
public hassio = false;
|
public hassio = false;
|
||||||
|
|
||||||
@ -33,7 +30,7 @@ class HaMenuButton extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _toggleMenu(): void {
|
private _toggleMenu(): void {
|
||||||
fireEvent(this, this.showMenu ? "hass-close-menu" : "hass-open-menu");
|
fireEvent(this, "hass-toggle-menu");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,8 +55,7 @@ function initialize(panel, properties) {
|
|||||||
|
|
||||||
const forwardEvent = (ev) =>
|
const forwardEvent = (ev) =>
|
||||||
window.parent.customPanel.fire(ev.type, ev.detail);
|
window.parent.customPanel.fire(ev.type, ev.detail);
|
||||||
root.addEventListener("hass-open-menu", forwardEvent);
|
root.addEventListener("hass-toggle-menu", forwardEvent);
|
||||||
root.addEventListener("hass-close-menu", forwardEvent);
|
|
||||||
root.addEventListener("location-changed", () =>
|
root.addEventListener("location-changed", () =>
|
||||||
window.parent.customPanel.navigate(window.location.pathname)
|
window.parent.customPanel.navigate(window.location.pathname)
|
||||||
);
|
);
|
||||||
|
@ -4,7 +4,6 @@ import {
|
|||||||
LitElement,
|
LitElement,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
html,
|
html,
|
||||||
property,
|
|
||||||
CSSResultArray,
|
CSSResultArray,
|
||||||
css,
|
css,
|
||||||
customElement,
|
customElement,
|
||||||
@ -14,19 +13,10 @@ import { haStyle } from "../resources/styles";
|
|||||||
|
|
||||||
@customElement("hass-loading-screen")
|
@customElement("hass-loading-screen")
|
||||||
class HassLoadingScreen extends LitElement {
|
class HassLoadingScreen extends LitElement {
|
||||||
@property({ type: Boolean })
|
|
||||||
public narrow?: boolean;
|
|
||||||
|
|
||||||
@property({ type: Boolean })
|
|
||||||
public showMenu?: boolean;
|
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult | void {
|
||||||
return html`
|
return html`
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
.narrow=${this.narrow}
|
|
||||||
.showMenu=${this.showMenu}
|
|
||||||
></ha-menu-button>
|
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<paper-spinner-lite active></paper-spinner-lite>
|
<paper-spinner-lite active></paper-spinner-lite>
|
||||||
|
@ -25,8 +25,7 @@ const NON_SWIPABLE_PANELS = ["kiosk", "map"];
|
|||||||
declare global {
|
declare global {
|
||||||
// for fire event
|
// for fire event
|
||||||
interface HASSDomEvents {
|
interface HASSDomEvents {
|
||||||
"hass-open-menu": undefined;
|
"hass-toggle-menu": undefined;
|
||||||
"hass-close-menu": undefined;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +69,6 @@ class HomeAssistantMain extends LitElement {
|
|||||||
.narrow=${this._narrow}
|
.narrow=${this._narrow}
|
||||||
.hass=${hass}
|
.hass=${hass}
|
||||||
.route=${this.route}
|
.route=${this.route}
|
||||||
.showMenu=${hass.dockedSidebar}
|
|
||||||
></partial-panel-resolver>
|
></partial-panel-resolver>
|
||||||
</app-drawer-layout>
|
</app-drawer-layout>
|
||||||
`;
|
`;
|
||||||
@ -79,17 +77,20 @@ class HomeAssistantMain extends LitElement {
|
|||||||
protected firstUpdated() {
|
protected firstUpdated() {
|
||||||
import(/* webpackChunkName: "ha-sidebar" */ "../components/ha-sidebar");
|
import(/* webpackChunkName: "ha-sidebar" */ "../components/ha-sidebar");
|
||||||
|
|
||||||
this.addEventListener("hass-open-menu", () => {
|
this.addEventListener("hass-toggle-menu", () => {
|
||||||
if (this._narrow) {
|
const shouldOpen = !this.drawer.opened;
|
||||||
this.drawer.open();
|
|
||||||
|
if (shouldOpen) {
|
||||||
|
if (this._narrow) {
|
||||||
|
this.drawer.open();
|
||||||
|
} else {
|
||||||
|
fireEvent(this, "hass-dock-sidebar", { dock: true });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fireEvent(this, "hass-dock-sidebar", { dock: true });
|
this.drawer.close();
|
||||||
}
|
if (this.hass!.dockedSidebar) {
|
||||||
});
|
fireEvent(this, "hass-dock-sidebar", { dock: false });
|
||||||
this.addEventListener("hass-close-menu", () => {
|
}
|
||||||
this.drawer.close();
|
|
||||||
if (this.hass!.dockedSidebar) {
|
|
||||||
fireEvent(this, "hass-dock-sidebar", { dock: false });
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,7 @@ class HaPanelCalendar extends LocalizeMixin(PolymerElement) {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>[[localize('panel.calendar')]]</div>
|
<div main-title>[[localize('panel.calendar')]]</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
@ -145,11 +142,6 @@ class HaPanelCalendar extends LocalizeMixin(PolymerElement) {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
reflectToAttribute: true,
|
reflectToAttribute: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,15 +128,6 @@ class HaAutomationPicker extends LocalizeMixin(NavigateMixin(PolymerElement)) {
|
|||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
automations: {
|
automations: {
|
||||||
type: Array,
|
type: Array,
|
||||||
},
|
},
|
||||||
|
@ -31,8 +31,6 @@ class HaConfigAutomation extends PolymerElement {
|
|||||||
<template is="dom-if" if="[[!showEditor]]">
|
<template is="dom-if" if="[[!showEditor]]">
|
||||||
<ha-automation-picker
|
<ha-automation-picker
|
||||||
hass="[[hass]]"
|
hass="[[hass]]"
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
automations="[[automations]]"
|
automations="[[automations]]"
|
||||||
is-wide="[[isWide]]"
|
is-wide="[[isWide]]"
|
||||||
></ha-automation-picker>
|
></ha-automation-picker>
|
||||||
@ -52,8 +50,6 @@ class HaConfigAutomation extends PolymerElement {
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
narrow: Boolean,
|
|
||||||
showMenu: Boolean,
|
|
||||||
route: Object,
|
route: Object,
|
||||||
isWide: Boolean,
|
isWide: Boolean,
|
||||||
_routeData: Object,
|
_routeData: Object,
|
||||||
|
@ -40,7 +40,7 @@ class HaConfigDashboard extends NavigateMixin(LocalizeMixin(PolymerElement)) {
|
|||||||
<app-header-layout has-scrolling-region="">
|
<app-header-layout has-scrolling-region="">
|
||||||
<app-header slot="header" fixed="">
|
<app-header slot="header" fixed="">
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button narrow="[[narrow]]" show-menu="[[showMenu]]"></ha-menu-button>
|
<ha-menu-button></ha-menu-button>
|
||||||
<div main-title="">[[localize('panel.config')]]</div>
|
<div main-title="">[[localize('panel.config')]]</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
@ -111,8 +111,6 @@ class HaConfigDashboard extends NavigateMixin(LocalizeMixin(PolymerElement)) {
|
|||||||
hass: Object,
|
hass: Object,
|
||||||
isWide: Boolean,
|
isWide: Boolean,
|
||||||
cloudStatus: Object,
|
cloudStatus: Object,
|
||||||
narrow: Boolean,
|
|
||||||
showMenu: Boolean,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,11 +75,6 @@ class HaConfigSection extends PolymerElement {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
},
|
},
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
isWide: {
|
isWide: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: false,
|
value: false,
|
||||||
|
@ -32,8 +32,6 @@ class HaConfigScript extends PolymerElement {
|
|||||||
<template is="dom-if" if="[[!showEditor]]">
|
<template is="dom-if" if="[[!showEditor]]">
|
||||||
<ha-script-picker
|
<ha-script-picker
|
||||||
hass="[[hass]]"
|
hass="[[hass]]"
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
scripts="[[scripts]]"
|
scripts="[[scripts]]"
|
||||||
is-wide="[[isWide]]"
|
is-wide="[[isWide]]"
|
||||||
></ha-script-picker>
|
></ha-script-picker>
|
||||||
@ -53,8 +51,6 @@ class HaConfigScript extends PolymerElement {
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
narrow: Boolean,
|
|
||||||
showMenu: Boolean,
|
|
||||||
route: Object,
|
route: Object,
|
||||||
isWide: Boolean,
|
isWide: Boolean,
|
||||||
_routeData: Object,
|
_routeData: Object,
|
||||||
|
@ -130,15 +130,6 @@ class HaScriptEditor extends LocalizeMixin(NavigateMixin(PolymerElement)) {
|
|||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
type: Object,
|
type: Object,
|
||||||
value: null,
|
value: null,
|
||||||
|
@ -124,15 +124,6 @@ class HaScriptPicker extends LocalizeMixin(NavigateMixin(PolymerElement)) {
|
|||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
scripts: {
|
scripts: {
|
||||||
type: Array,
|
type: Array,
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,6 @@ class HaPanelCustom extends NavigateMixin(EventsMixin(PolymerElement)) {
|
|||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
narrow: Boolean,
|
narrow: Boolean,
|
||||||
showMenu: Boolean,
|
|
||||||
route: Object,
|
route: Object,
|
||||||
panel: {
|
panel: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@ -26,7 +25,7 @@ class HaPanelCustom extends NavigateMixin(EventsMixin(PolymerElement)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static get observers() {
|
static get observers() {
|
||||||
return ["_dataChanged(hass, narrow, showMenu, route)"];
|
return ["_dataChanged(hass, narrow, route)"];
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -74,7 +73,6 @@ It will have access to all data in Home Assistant.
|
|||||||
panel,
|
panel,
|
||||||
hass: this.hass,
|
hass: this.hass,
|
||||||
narrow: this.narrow,
|
narrow: this.narrow,
|
||||||
showMenu: this.showMenu,
|
|
||||||
route: this.route,
|
route: this.route,
|
||||||
});
|
});
|
||||||
this.appendChild(element);
|
this.appendChild(element);
|
||||||
@ -109,16 +107,15 @@ It will have access to all data in Home Assistant.
|
|||||||
delete window.customPanel;
|
delete window.customPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
_dataChanged(hass, narrow, showMenu, route) {
|
_dataChanged(hass, narrow, route) {
|
||||||
if (!this._setProperties) return;
|
if (!this._setProperties) return;
|
||||||
this._setProperties({ hass, narrow, showMenu, route });
|
this._setProperties({ hass, narrow, route });
|
||||||
}
|
}
|
||||||
|
|
||||||
registerIframe(initialize, setProperties) {
|
registerIframe(initialize, setProperties) {
|
||||||
initialize(this.panel, {
|
initialize(this.panel, {
|
||||||
hass: this.hass,
|
hass: this.hass,
|
||||||
narrow: this.narrow,
|
narrow: this.narrow,
|
||||||
showMenu: this.showMenu,
|
|
||||||
route: this.route,
|
route: this.route,
|
||||||
});
|
});
|
||||||
this._setProperties = setProperties;
|
this._setProperties = setProperties;
|
||||||
|
@ -52,10 +52,7 @@ class HaPanelDevEvent extends EventsMixin(PolymerElement) {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>Events</div>
|
<div main-title>Events</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
@ -100,16 +97,6 @@ class HaPanelDevEvent extends EventsMixin(PolymerElement) {
|
|||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
eventType: {
|
eventType: {
|
||||||
type: String,
|
type: String,
|
||||||
value: "",
|
value: "",
|
||||||
|
@ -23,14 +23,10 @@ const OPT_IN_PANEL = "states";
|
|||||||
|
|
||||||
class HaPanelDevInfo extends LitElement {
|
class HaPanelDevInfo extends LitElement {
|
||||||
public hass?: HomeAssistant;
|
public hass?: HomeAssistant;
|
||||||
public narrow?: boolean;
|
|
||||||
public showMenu?: boolean;
|
|
||||||
|
|
||||||
static get properties(): PropertyDeclarations {
|
static get properties(): PropertyDeclarations {
|
||||||
return {
|
return {
|
||||||
hass: {},
|
hass: {},
|
||||||
narrow: {},
|
|
||||||
showMenu: {},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,10 +56,7 @@ class HaPanelDevInfo extends LitElement {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
.narrow="${this.narrow}"
|
|
||||||
.showMenu="${this.showMenu}"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>About</div>
|
<div main-title>About</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
|
@ -41,10 +41,7 @@ class HaPanelDevMqtt extends PolymerElement {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>MQTT</div>
|
<div main-title>MQTT</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
@ -80,8 +77,6 @@ class HaPanelDevMqtt extends PolymerElement {
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
narrow: Boolean,
|
|
||||||
showMenu: Boolean,
|
|
||||||
topic: String,
|
topic: String,
|
||||||
payload: String,
|
payload: String,
|
||||||
};
|
};
|
||||||
|
@ -84,10 +84,7 @@ class HaPanelDevService extends PolymerElement {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>Services</div>
|
<div main-title>Services</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
@ -187,16 +184,6 @@ class HaPanelDevService extends PolymerElement {
|
|||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
domainService: {
|
domainService: {
|
||||||
type: String,
|
type: String,
|
||||||
observer: "_domainServiceChanged",
|
observer: "_domainServiceChanged",
|
||||||
|
@ -73,10 +73,7 @@ class HaPanelDevState extends EventsMixin(PolymerElement) {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>States</div>
|
<div main-title>States</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
@ -183,16 +180,6 @@ class HaPanelDevState extends EventsMixin(PolymerElement) {
|
|||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
_entityId: {
|
_entityId: {
|
||||||
type: String,
|
type: String,
|
||||||
value: "",
|
value: "",
|
||||||
|
@ -70,10 +70,7 @@ class HaPanelDevTemplate extends PolymerElement {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>Templates</div>
|
<div main-title>Templates</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
@ -125,16 +122,6 @@ class HaPanelDevTemplate extends PolymerElement {
|
|||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
error: {
|
error: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: false,
|
value: false,
|
||||||
|
@ -65,10 +65,7 @@ class HaPanelHistory extends LocalizeMixin(PolymerElement) {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>[[localize('panel.history')]]</div>
|
<div main-title>[[localize('panel.history')]]</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
@ -123,15 +120,6 @@ class HaPanelHistory extends LocalizeMixin(PolymerElement) {
|
|||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
stateHistory: {
|
stateHistory: {
|
||||||
type: Object,
|
type: Object,
|
||||||
value: null,
|
value: null,
|
||||||
|
@ -16,10 +16,7 @@ class HaPanelIframe extends PolymerElement {
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>[[panel.title]]</div>
|
<div main-title>[[panel.title]]</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
|
|
||||||
@ -38,14 +35,6 @@ class HaPanelIframe extends PolymerElement {
|
|||||||
panel: {
|
panel: {
|
||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,10 +89,7 @@ class HaPanelLogbook extends LocalizeMixin(PolymerElement) {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>[[localize('panel.logbook')]]</div>
|
<div main-title>[[localize('panel.logbook')]]</div>
|
||||||
<paper-icon-button
|
<paper-icon-button
|
||||||
icon="hass:refresh"
|
icon="hass:refresh"
|
||||||
@ -164,16 +161,6 @@ class HaPanelLogbook extends LocalizeMixin(PolymerElement) {
|
|||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
// ISO8601 formatted date string
|
// ISO8601 formatted date string
|
||||||
_currentDate: {
|
_currentDate: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -26,7 +26,6 @@ class LovelacePanel extends LitElement {
|
|||||||
public panel?: PanelInfo<LovelacePanelConfig>;
|
public panel?: PanelInfo<LovelacePanelConfig>;
|
||||||
public hass?: HomeAssistant;
|
public hass?: HomeAssistant;
|
||||||
public narrow?: boolean;
|
public narrow?: boolean;
|
||||||
public showMenu?: boolean;
|
|
||||||
public route?: Route;
|
public route?: Route;
|
||||||
private _columns?: number;
|
private _columns?: number;
|
||||||
private _state?: "loading" | "loaded" | "error" | "yaml-editor";
|
private _state?: "loading" | "loaded" | "error" | "yaml-editor";
|
||||||
@ -38,8 +37,6 @@ class LovelacePanel extends LitElement {
|
|||||||
return {
|
return {
|
||||||
hass: {},
|
hass: {},
|
||||||
lovelace: {},
|
lovelace: {},
|
||||||
narrow: {},
|
|
||||||
showMenu: {},
|
|
||||||
route: {},
|
route: {},
|
||||||
_columns: {},
|
_columns: {},
|
||||||
_state: {},
|
_state: {},
|
||||||
@ -60,8 +57,6 @@ class LovelacePanel extends LitElement {
|
|||||||
if (state === "loaded") {
|
if (state === "loaded") {
|
||||||
return html`
|
return html`
|
||||||
<hui-root
|
<hui-root
|
||||||
.narrow="${this.narrow}"
|
|
||||||
.showMenu="${this.showMenu}"
|
|
||||||
.hass="${this.hass}"
|
.hass="${this.hass}"
|
||||||
.lovelace="${this.lovelace}"
|
.lovelace="${this.lovelace}"
|
||||||
.route="${this.route}"
|
.route="${this.route}"
|
||||||
@ -73,12 +68,7 @@ class LovelacePanel extends LitElement {
|
|||||||
|
|
||||||
if (state === "error") {
|
if (state === "error") {
|
||||||
return html`
|
return html`
|
||||||
<hass-error-screen
|
<hass-error-screen title="Lovelace" .error="${this._errorMsg}">
|
||||||
title="Lovelace"
|
|
||||||
.error="${this._errorMsg}"
|
|
||||||
.narrow="${this.narrow}"
|
|
||||||
.showMenu="${this.showMenu}"
|
|
||||||
>
|
|
||||||
<mwc-button on-click="_forceFetchConfig">Reload Lovelace</mwc-button>
|
<mwc-button on-click="_forceFetchConfig">Reload Lovelace</mwc-button>
|
||||||
</hass-error-screen>
|
</hass-error-screen>
|
||||||
`;
|
`;
|
||||||
@ -95,16 +85,25 @@ class LovelacePanel extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<hass-loading-screen
|
<hass-loading-screen></hass-loading-screen>
|
||||||
.narrow="${this.narrow}"
|
|
||||||
.showMenu="${this.showMenu}"
|
|
||||||
></hass-loading-screen>
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updated(changedProps: PropertyValues): void {
|
public updated(changedProps: PropertyValues): void {
|
||||||
super.updated(changedProps);
|
super.updated(changedProps);
|
||||||
if (changedProps.has("narrow") || changedProps.has("showMenu")) {
|
|
||||||
|
if (changedProps.has("narrow")) {
|
||||||
|
this._updateColumns();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!changedProps.has("hass")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const oldHass = changedProps.get("hass") as this["hass"];
|
||||||
|
|
||||||
|
if (oldHass && this.hass!.dockedSidebar !== oldHass.dockedSidebar) {
|
||||||
this._updateColumns();
|
this._updateColumns();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,7 +143,7 @@ class LovelacePanel extends LitElement {
|
|||||||
// Do -1 column if the menu is docked and open
|
// Do -1 column if the menu is docked and open
|
||||||
this._columns = Math.max(
|
this._columns = Math.max(
|
||||||
1,
|
1,
|
||||||
matchColumns - Number(!this.narrow && this.showMenu)
|
matchColumns - Number(!this.narrow && this.hass!.dockedSidebar)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
TemplateResult,
|
TemplateResult,
|
||||||
CSSResult,
|
CSSResult,
|
||||||
css,
|
css,
|
||||||
|
property,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { classMap } from "lit-html/directives/class-map";
|
import { classMap } from "lit-html/directives/class-map";
|
||||||
import "@polymer/app-layout/app-header-layout/app-header-layout";
|
import "@polymer/app-layout/app-header-layout/app-header-layout";
|
||||||
@ -60,39 +61,21 @@ const JS_CACHE = {};
|
|||||||
let loadedUnusedEntities = false;
|
let loadedUnusedEntities = false;
|
||||||
|
|
||||||
class HUIRoot extends LitElement {
|
class HUIRoot extends LitElement {
|
||||||
public narrow?: boolean;
|
@property() public hass?: HomeAssistant;
|
||||||
public showMenu?: boolean;
|
@property() public lovelace?: Lovelace;
|
||||||
public hass?: HomeAssistant;
|
@property() public columns?: number;
|
||||||
public lovelace?: Lovelace;
|
@property() public route?: { path: string; prefix: string };
|
||||||
public columns?: number;
|
@property() private _routeData?: { view: string };
|
||||||
public route?: { path: string; prefix: string };
|
@property() private _curView?: number | "hass-unused-entities";
|
||||||
private _routeData?: { view: string };
|
@property() private _notificationsOpen = false;
|
||||||
private _curView?: number | "hass-unused-entities";
|
@property() private _persistentNotifications?: Notification[];
|
||||||
private _notificationsOpen: boolean;
|
|
||||||
private _persistentNotifications?: Notification[];
|
|
||||||
private _viewCache?: { [viewId: string]: HUIView };
|
private _viewCache?: { [viewId: string]: HUIView };
|
||||||
|
|
||||||
private _debouncedConfigChanged: () => void;
|
private _debouncedConfigChanged: () => void;
|
||||||
private _unsubNotifications?: () => void;
|
private _unsubNotifications?: () => void;
|
||||||
|
|
||||||
static get properties(): PropertyDeclarations {
|
|
||||||
return {
|
|
||||||
narrow: {},
|
|
||||||
showMenu: {},
|
|
||||||
hass: {},
|
|
||||||
lovelace: {},
|
|
||||||
columns: {},
|
|
||||||
route: {},
|
|
||||||
_routeData: {},
|
|
||||||
_curView: {},
|
|
||||||
_notificationsOpen: {},
|
|
||||||
_persistentNotifications: {},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this._notificationsOpen = false;
|
|
||||||
// The view can trigger a re-render when it knows that certain
|
// The view can trigger a re-render when it knows that certain
|
||||||
// web components have been loaded.
|
// web components have been loaded.
|
||||||
this._debouncedConfigChanged = debounce(
|
this._debouncedConfigChanged = debounce(
|
||||||
@ -181,10 +164,7 @@ class HUIRoot extends LitElement {
|
|||||||
`
|
`
|
||||||
: html`
|
: html`
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
.narrow="${this.narrow}"
|
|
||||||
.showMenu="${this.showMenu}"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>${this.config.title || "Home Assistant"}</div>
|
<div main-title>${this.config.title || "Home Assistant"}</div>
|
||||||
<hui-notifications-button
|
<hui-notifications-button
|
||||||
.hass="${this.hass}"
|
.hass="${this.hass}"
|
||||||
|
@ -80,10 +80,7 @@ class HaPanelMailbox extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>[[localize('panel.mailbox')]]</div>
|
<div main-title>[[localize('panel.mailbox')]]</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
<div sticky hidden$="[[areTabsHidden(platforms)]]">
|
<div sticky hidden$="[[areTabsHidden(platforms)]]">
|
||||||
@ -135,16 +132,6 @@ class HaPanelMailbox extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
|||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
platforms: {
|
platforms: {
|
||||||
type: Array,
|
type: Array,
|
||||||
},
|
},
|
||||||
|
@ -27,10 +27,7 @@ class HaPanelMap extends LocalizeMixin(PolymerElement) {
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>[[localize('panel.map')]]</div>
|
<div main-title>[[localize('panel.map')]]</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
|
|
||||||
@ -44,15 +41,6 @@ class HaPanelMap extends LocalizeMixin(PolymerElement) {
|
|||||||
type: Object,
|
type: Object,
|
||||||
observer: "drawEntities",
|
observer: "drawEntities",
|
||||||
},
|
},
|
||||||
|
|
||||||
narrow: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,10 +52,7 @@ class HaPanelProfile extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>[[localize('panel.profile')]]</div>
|
<div main-title>[[localize('panel.profile')]]</div>
|
||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
@ -121,7 +118,6 @@ class HaPanelProfile extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
|||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
narrow: Boolean,
|
narrow: Boolean,
|
||||||
showMenu: Boolean,
|
|
||||||
_refreshTokens: Array,
|
_refreshTokens: Array,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -70,10 +70,7 @@ class HaPanelShoppingList extends LocalizeMixin(PolymerElement) {
|
|||||||
<app-header-layout has-scrolling-region>
|
<app-header-layout has-scrolling-region>
|
||||||
<app-header slot="header" fixed>
|
<app-header slot="header" fixed>
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title>[[localize('panel.shopping_list')]]</div>
|
<div main-title>[[localize('panel.shopping_list')]]</div>
|
||||||
<ha-start-voice-button
|
<ha-start-voice-button
|
||||||
hass="[[hass]]"
|
hass="[[hass]]"
|
||||||
@ -145,8 +142,6 @@ class HaPanelShoppingList extends LocalizeMixin(PolymerElement) {
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
narrow: Boolean,
|
|
||||||
showMenu: Boolean,
|
|
||||||
canListen: Boolean,
|
canListen: Boolean,
|
||||||
items: {
|
items: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
@ -65,10 +65,7 @@ class PartialCards extends EventsMixin(NavigateMixin(PolymerElement)) {
|
|||||||
<ha-app-layout id="layout">
|
<ha-app-layout id="layout">
|
||||||
<app-header effects="waterfall" condenses="" fixed="" slot="header">
|
<app-header effects="waterfall" condenses="" fixed="" slot="header">
|
||||||
<app-toolbar>
|
<app-toolbar>
|
||||||
<ha-menu-button
|
<ha-menu-button></ha-menu-button>
|
||||||
narrow="[[narrow]]"
|
|
||||||
show-menu="[[showMenu]]"
|
|
||||||
></ha-menu-button>
|
|
||||||
<div main-title="">
|
<div main-title="">
|
||||||
[[computeTitle(views, defaultView, locationName)]]
|
[[computeTitle(views, defaultView, locationName)]]
|
||||||
</div>
|
</div>
|
||||||
@ -160,10 +157,6 @@ class PartialCards extends EventsMixin(NavigateMixin(PolymerElement)) {
|
|||||||
value: false,
|
value: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
|
|
||||||
panelVisible: {
|
panelVisible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: false,
|
value: false,
|
||||||
@ -215,7 +208,7 @@ class PartialCards extends EventsMixin(NavigateMixin(PolymerElement)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static get observers() {
|
static get observers() {
|
||||||
return ["_updateColumns(narrow, showMenu)"];
|
return ["_updateColumns(narrow, hass.dockedSidebar)"];
|
||||||
}
|
}
|
||||||
|
|
||||||
ready() {
|
ready() {
|
||||||
@ -239,7 +232,10 @@ class PartialCards extends EventsMixin(NavigateMixin(PolymerElement)) {
|
|||||||
_updateColumns() {
|
_updateColumns() {
|
||||||
const matchColumns = this.mqls.reduce((cols, mql) => cols + mql.matches, 0);
|
const matchColumns = this.mqls.reduce((cols, mql) => cols + mql.matches, 0);
|
||||||
// Do -1 column if the menu is docked and open
|
// Do -1 column if the menu is docked and open
|
||||||
this._columns = Math.max(1, matchColumns - (!this.narrow && this.showMenu));
|
this._columns = Math.max(
|
||||||
|
1,
|
||||||
|
matchColumns - (!this.narrow && this.hass.dockedSidebar)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
areTabsHidden(views, showTabs) {
|
areTabsHidden(views, showTabs) {
|
||||||
|
@ -225,7 +225,6 @@ export interface Route {
|
|||||||
export interface PanelElement extends HTMLElement {
|
export interface PanelElement extends HTMLElement {
|
||||||
hass?: HomeAssistant;
|
hass?: HomeAssistant;
|
||||||
narrow?: boolean;
|
narrow?: boolean;
|
||||||
showMenu?: boolean;
|
|
||||||
route?: Route | null;
|
route?: Route | null;
|
||||||
panel?: Panel;
|
panel?: Panel;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user