mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 16:26:43 +00:00
commit
49f90671fb
@ -10,6 +10,7 @@ import "./hassio-pages-with-tabs";
|
||||
import applyThemesOnElement from "../../src/common/dom/apply_themes_on_element";
|
||||
import EventsMixin from "../../src/mixins/events-mixin";
|
||||
import NavigateMixin from "../../src/mixins/navigate-mixin";
|
||||
import { fireEvent } from "../../src/common/dom/fire_event";
|
||||
|
||||
class HassioMain extends EventsMixin(NavigateMixin(PolymerElement)) {
|
||||
static get template() {
|
||||
@ -90,6 +91,15 @@ class HassioMain extends EventsMixin(NavigateMixin(PolymerElement)) {
|
||||
this.hass.dockedSidebar ? "hass-close-menu" : "hass-open-menu"
|
||||
);
|
||||
});
|
||||
// Paulus - March 19, 2019
|
||||
// We changed the navigate event to fire directly on the window, as that's
|
||||
// where we are listening for it. However, the older panel_custom will
|
||||
// listen on this element for navigation events, so we need to forward them.
|
||||
window.addEventListener("location-changed", (ev) =>
|
||||
fireEvent(this, ev.type, ev.detail, {
|
||||
bubbles: false,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
|
@ -74,7 +74,7 @@
|
||||
"es6-object-assign": "^1.1.0",
|
||||
"fecha": "^3.0.0",
|
||||
"hls.js": "^0.12.3",
|
||||
"home-assistant-js-websocket": "^3.3.0",
|
||||
"home-assistant-js-websocket": "^3.4.0",
|
||||
"intl-messageformat": "^2.2.0",
|
||||
"jquery": "^3.3.1",
|
||||
"js-yaml": "^3.12.0",
|
||||
|
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="home-assistant-frontend",
|
||||
version="20190318.0",
|
||||
version="20190319.0",
|
||||
description="The Home Assistant frontend",
|
||||
url="https://github.com/home-assistant/home-assistant-polymer",
|
||||
author="The Home Assistant Authors",
|
||||
|
@ -1,5 +1,14 @@
|
||||
import { fireEvent } from "./dom/fire_event";
|
||||
|
||||
declare global {
|
||||
// for fire event
|
||||
interface HASSDomEvents {
|
||||
"location-changed": {
|
||||
replace: boolean;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export const navigate = (
|
||||
_node: any,
|
||||
path: string,
|
||||
@ -18,5 +27,7 @@ export const navigate = (
|
||||
history.pushState(null, "", path);
|
||||
}
|
||||
}
|
||||
fireEvent(window, "location-changed");
|
||||
fireEvent(window, "location-changed", {
|
||||
replace,
|
||||
});
|
||||
};
|
||||
|
@ -56,8 +56,11 @@ function initialize(panel, properties) {
|
||||
const forwardEvent = (ev) =>
|
||||
window.parent.customPanel.fire(ev.type, ev.detail);
|
||||
root.addEventListener("hass-toggle-menu", forwardEvent);
|
||||
window.addEventListener("location-changed", () =>
|
||||
window.parent.customPanel.navigate(window.location.pathname)
|
||||
window.addEventListener("location-changed", (ev) =>
|
||||
window.parent.customPanel.navigate(
|
||||
window.location.pathname,
|
||||
ev.detail ? ev.detail.replace : false
|
||||
)
|
||||
);
|
||||
setProperties(Object.assign({ panel }, properties));
|
||||
document.body.appendChild(root);
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
html,
|
||||
PropertyValues,
|
||||
TemplateResult,
|
||||
PropertyDeclarations,
|
||||
property,
|
||||
} from "lit-element";
|
||||
import { showSaveDialog } from "./editor/show-save-config-dialog";
|
||||
import { generateLovelaceConfig } from "./common/generate-lovelace-config";
|
||||
@ -23,31 +23,27 @@ interface LovelacePanelConfig {
|
||||
let editorLoaded = false;
|
||||
|
||||
class LovelacePanel extends LitElement {
|
||||
public panel?: PanelInfo<LovelacePanelConfig>;
|
||||
public hass?: HomeAssistant;
|
||||
public narrow?: boolean;
|
||||
public route?: Route;
|
||||
private _columns?: number;
|
||||
private _state?: "loading" | "loaded" | "error" | "yaml-editor";
|
||||
private _errorMsg?: string;
|
||||
private lovelace?: Lovelace;
|
||||
private mqls?: MediaQueryList[];
|
||||
@property() public panel?: PanelInfo<LovelacePanelConfig>;
|
||||
|
||||
static get properties(): PropertyDeclarations {
|
||||
return {
|
||||
hass: {},
|
||||
lovelace: {},
|
||||
route: {},
|
||||
_columns: {},
|
||||
_state: {},
|
||||
_errorMsg: {},
|
||||
_config: {},
|
||||
};
|
||||
}
|
||||
@property() public hass?: HomeAssistant;
|
||||
|
||||
@property() public narrow?: boolean;
|
||||
|
||||
public route?: Route;
|
||||
|
||||
@property() private _columns?: number;
|
||||
|
||||
@property()
|
||||
private _state?: "loading" | "loaded" | "error" | "yaml-editor" = "loading";
|
||||
|
||||
@property() private _errorMsg?: string;
|
||||
|
||||
private lovelace?: Lovelace;
|
||||
|
||||
private mqls?: MediaQueryList[];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this._state = "loading";
|
||||
this._closeEditor = this._closeEditor.bind(this);
|
||||
}
|
||||
|
||||
@ -61,6 +57,7 @@ class LovelacePanel extends LitElement {
|
||||
.lovelace="${this.lovelace}"
|
||||
.route="${this.route}"
|
||||
.columns="${this._columns}"
|
||||
.narrow=${this.narrow}
|
||||
@config-refresh="${this._forceFetchConfig}"
|
||||
></hui-root>
|
||||
`;
|
||||
|
@ -25,7 +25,6 @@ declare global {
|
||||
"iron-resize": undefined;
|
||||
"config-refresh": undefined;
|
||||
"ha-refresh-cloud-status": undefined;
|
||||
"location-changed": undefined;
|
||||
"hass-notification": {
|
||||
message: string;
|
||||
};
|
||||
|
@ -7230,10 +7230,10 @@ hoek@4.x.x:
|
||||
resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb"
|
||||
integrity sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==
|
||||
|
||||
home-assistant-js-websocket@^3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/home-assistant-js-websocket/-/home-assistant-js-websocket-3.3.0.tgz#c8bb211c06ff7f8f9ca8391482b0a5e6c7f78711"
|
||||
integrity sha512-3ObNSMwv9EG+7emcGVOg/QWSTdZ8tCaLTrKCM6LEelefybQPbeZWcW37PzZ5wZxXuTOxSSQhGrvTFS8vubpYfw==
|
||||
home-assistant-js-websocket@^3.4.0:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/home-assistant-js-websocket/-/home-assistant-js-websocket-3.4.0.tgz#3ba47cc8f8b7620619a675e7488d6108e8733a70"
|
||||
integrity sha512-Uq5/KIAh4kF13MKzMyd0efBDoU+pNF0O1CfdGpSmT3La3tpt5h+ykpUYlq/vEBj6WwzU6iv3Czt4UK1o0IJHcA==
|
||||
|
||||
homedir-polyfill@^1.0.0, homedir-polyfill@^1.0.1:
|
||||
version "1.0.1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user