mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Remove polymer types, cleanups (#16385)
* Remove polymer types, cleanups * Delete updated.ts
This commit is contained in:
parent
ab237f19c0
commit
4e5a18d272
@ -1,5 +1,3 @@
|
||||
import "@polymer/polymer/lib/elements/dom-if";
|
||||
import "@polymer/polymer/lib/elements/dom-repeat";
|
||||
import "../../src/resources/ha-style";
|
||||
import "../../src/resources/roboto";
|
||||
import "./ha-gallery";
|
||||
|
@ -5,8 +5,8 @@ import {
|
||||
CSSResultGroup,
|
||||
html,
|
||||
LitElement,
|
||||
TemplateResult,
|
||||
nothing,
|
||||
TemplateResult,
|
||||
} from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import { atLeastVersion } from "../../../src/common/config/version";
|
||||
@ -23,8 +23,11 @@ import {
|
||||
HassioPartialBackupCreateParams,
|
||||
} from "../../../src/data/hassio/backup";
|
||||
import { Supervisor } from "../../../src/data/supervisor/supervisor";
|
||||
import { PolymerChangedEvent } from "../../../src/polymer-types";
|
||||
import { HomeAssistant, TranslationDict } from "../../../src/types";
|
||||
import {
|
||||
HomeAssistant,
|
||||
TranslationDict,
|
||||
ValueChangedEvent,
|
||||
} from "../../../src/types";
|
||||
import "./supervisor-formfield-label";
|
||||
|
||||
type BackupOrRestoreKey = keyof TranslationDict["supervisor"]["backup"] &
|
||||
@ -416,7 +419,7 @@ export class SupervisorBackupContent extends LitElement {
|
||||
this[input.name] = input.value;
|
||||
}
|
||||
|
||||
private _handleTextValueChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _handleTextValueChanged(ev: ValueChangedEvent<string>) {
|
||||
const input = ev.currentTarget as PaperInputElement;
|
||||
this[input.name!] = ev.detail.value;
|
||||
}
|
||||
|
@ -21,8 +21,7 @@ import {
|
||||
subscribeEntityRegistry,
|
||||
} from "../../data/entity_registry";
|
||||
import { SubscribeMixin } from "../../mixins/subscribe-mixin";
|
||||
import { PolymerChangedEvent } from "../../polymer-types";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../types";
|
||||
import "../ha-icon-button";
|
||||
import "../ha-svg-icon";
|
||||
import "./ha-devices-picker";
|
||||
@ -291,7 +290,7 @@ export class HaAreaDevicesPicker extends SubscribeMixin(LitElement) {
|
||||
this._areaPicker = !this._areaPicker;
|
||||
}
|
||||
|
||||
private async _areaPicked(ev: PolymerChangedEvent<string>) {
|
||||
private async _areaPicked(ev: ValueChangedEvent<string>) {
|
||||
const value = ev.detail.value;
|
||||
let selectedDevices = [];
|
||||
const target = ev.target as any;
|
||||
|
@ -22,8 +22,7 @@ import {
|
||||
subscribeEntityRegistry,
|
||||
} from "../../data/entity_registry";
|
||||
import { SubscribeMixin } from "../../mixins/subscribe-mixin";
|
||||
import { PolymerChangedEvent } from "../../polymer-types";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../types";
|
||||
import "../ha-combo-box";
|
||||
import type { HaComboBox } from "../ha-combo-box";
|
||||
|
||||
@ -330,7 +329,7 @@ export class HaDevicePicker extends SubscribeMixin(LitElement) {
|
||||
return this.value || "";
|
||||
}
|
||||
|
||||
private _deviceChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _deviceChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
let newValue = ev.detail.value;
|
||||
|
||||
@ -343,7 +342,7 @@ export class HaDevicePicker extends SubscribeMixin(LitElement) {
|
||||
}
|
||||
}
|
||||
|
||||
private _openedChanged(ev: PolymerChangedEvent<boolean>) {
|
||||
private _openedChanged(ev: ValueChangedEvent<boolean>) {
|
||||
this._opened = ev.detail.value;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
import { PolymerChangedEvent } from "../../polymer-types";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../types";
|
||||
import "./ha-device-picker";
|
||||
import type {
|
||||
HaDevicePickerDeviceFilterFunc,
|
||||
@ -108,7 +107,7 @@ class HaDevicesPicker extends LitElement {
|
||||
this.value = devices;
|
||||
}
|
||||
|
||||
private _deviceChanged(event: PolymerChangedEvent<string>) {
|
||||
private _deviceChanged(event: ValueChangedEvent<string>) {
|
||||
event.stopPropagation();
|
||||
const curValue = (event.currentTarget as any).curValue;
|
||||
const newValue = event.detail.value;
|
||||
@ -126,7 +125,7 @@ class HaDevicesPicker extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private async _addDevice(event: PolymerChangedEvent<string>) {
|
||||
private async _addDevice(event: ValueChangedEvent<string>) {
|
||||
event.stopPropagation();
|
||||
const toAdd = event.detail.value;
|
||||
(event.currentTarget as any).value = "";
|
||||
|
@ -4,8 +4,7 @@ import { customElement, property } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
import { isValidEntityId } from "../../common/entity/valid_entity_id";
|
||||
import type { PolymerChangedEvent } from "../../polymer-types";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import type { ValueChangedEvent, HomeAssistant } from "../../types";
|
||||
import "./ha-entity-picker";
|
||||
import type { HaEntityPickerEntityFilterFunc } from "./ha-entity-picker";
|
||||
|
||||
@ -151,7 +150,7 @@ class HaEntitiesPickerLight extends LitElement {
|
||||
});
|
||||
}
|
||||
|
||||
private _entityChanged(event: PolymerChangedEvent<string>) {
|
||||
private _entityChanged(event: ValueChangedEvent<string>) {
|
||||
event.stopPropagation();
|
||||
const curValue = (event.currentTarget as any).curValue;
|
||||
const newValue = event.detail.value;
|
||||
@ -171,7 +170,7 @@ class HaEntitiesPickerLight extends LitElement {
|
||||
);
|
||||
}
|
||||
|
||||
private async _addEntity(event: PolymerChangedEvent<string>) {
|
||||
private async _addEntity(event: ValueChangedEvent<string>) {
|
||||
event.stopPropagation();
|
||||
const toAdd = event.detail.value;
|
||||
if (!toAdd) {
|
||||
|
@ -2,8 +2,7 @@ import { HassEntity } from "home-assistant-js-websocket";
|
||||
import { html, LitElement, PropertyValues, nothing } from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import { computeAttributeNameDisplay } from "../../common/entity/compute_attribute_display";
|
||||
import { PolymerChangedEvent } from "../../polymer-types";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../types";
|
||||
import "../ha-combo-box";
|
||||
import type { HaComboBox } from "../ha-combo-box";
|
||||
|
||||
@ -99,11 +98,11 @@ class HaEntityAttributePicker extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
private _openedChanged(ev: PolymerChangedEvent<boolean>) {
|
||||
private _openedChanged(ev: ValueChangedEvent<boolean>) {
|
||||
this._opened = ev.detail.value;
|
||||
}
|
||||
|
||||
private _valueChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _valueChanged(ev: ValueChangedEvent<string>) {
|
||||
this.value = ev.detail.value;
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,7 @@ import { fireEvent } from "../../common/dom/fire_event";
|
||||
import { computeDomain } from "../../common/entity/compute_domain";
|
||||
import { computeStateName } from "../../common/entity/compute_state_name";
|
||||
import { caseInsensitiveStringCompare } from "../../common/string/compare";
|
||||
import { PolymerChangedEvent } from "../../polymer-types";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../types";
|
||||
import "../ha-combo-box";
|
||||
import type { HaComboBox } from "../ha-combo-box";
|
||||
import "../ha-icon-button";
|
||||
@ -325,11 +324,11 @@ export class HaEntityPicker extends LitElement {
|
||||
return this.value || "";
|
||||
}
|
||||
|
||||
private _openedChanged(ev: PolymerChangedEvent<boolean>) {
|
||||
private _openedChanged(ev: ValueChangedEvent<boolean>) {
|
||||
this._opened = ev.detail.value;
|
||||
}
|
||||
|
||||
private _valueChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _valueChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
const newValue = ev.detail.value;
|
||||
if (newValue !== this._value) {
|
||||
|
@ -5,8 +5,7 @@ import { fireEvent } from "../../common/dom/fire_event";
|
||||
import { computeStateDisplay } from "../../common/entity/compute_state_display";
|
||||
import { getStates } from "../../common/entity/get_states";
|
||||
import { computeAttributeValueDisplay } from "../../common/entity/compute_attribute_display";
|
||||
import { PolymerChangedEvent } from "../../polymer-types";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../types";
|
||||
import "../ha-combo-box";
|
||||
import type { HaComboBox } from "../ha-combo-box";
|
||||
|
||||
@ -100,11 +99,11 @@ class HaEntityStatePicker extends LitElement {
|
||||
return this.value || "";
|
||||
}
|
||||
|
||||
private _openedChanged(ev: PolymerChangedEvent<boolean>) {
|
||||
private _openedChanged(ev: ValueChangedEvent<boolean>) {
|
||||
this._opened = ev.detail.value;
|
||||
}
|
||||
|
||||
private _valueChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _valueChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
const newValue = ev.detail.value;
|
||||
if (newValue !== this._value) {
|
||||
|
@ -11,8 +11,7 @@ import {
|
||||
getStatisticLabel,
|
||||
StatisticsMetaData,
|
||||
} from "../../data/recorder";
|
||||
import { PolymerChangedEvent } from "../../polymer-types";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../types";
|
||||
import { documentationUrl } from "../../util/documentation-url";
|
||||
import "../ha-combo-box";
|
||||
import type { HaComboBox } from "../ha-combo-box";
|
||||
@ -266,7 +265,7 @@ export class HaStatisticPicker extends LitElement {
|
||||
return this.value || "";
|
||||
}
|
||||
|
||||
private _statisticChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _statisticChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
let newValue = ev.detail.value;
|
||||
if (newValue === "__missing") {
|
||||
@ -278,7 +277,7 @@ export class HaStatisticPicker extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private _openedChanged(ev: PolymerChangedEvent<boolean>) {
|
||||
private _openedChanged(ev: ValueChangedEvent<boolean>) {
|
||||
this._opened = ev.detail.value;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
import type { PolymerChangedEvent } from "../../polymer-types";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import type { ValueChangedEvent, HomeAssistant } from "../../types";
|
||||
import "./ha-statistic-picker";
|
||||
|
||||
@customElement("ha-statistics-picker")
|
||||
@ -130,7 +129,7 @@ class HaStatisticsPicker extends LitElement {
|
||||
});
|
||||
}
|
||||
|
||||
private _statisticChanged(event: PolymerChangedEvent<string>) {
|
||||
private _statisticChanged(event: ValueChangedEvent<string>) {
|
||||
event.stopPropagation();
|
||||
const oldValue = (event.currentTarget as any).curValue;
|
||||
const newValue = event.detail.value;
|
||||
@ -149,7 +148,7 @@ class HaStatisticsPicker extends LitElement {
|
||||
);
|
||||
}
|
||||
|
||||
private async _addStatistic(event: PolymerChangedEvent<string>) {
|
||||
private async _addStatistic(event: ValueChangedEvent<string>) {
|
||||
event.stopPropagation();
|
||||
const toAdd = event.detail.value;
|
||||
if (!toAdd) {
|
||||
|
@ -6,8 +6,7 @@ import { fireEvent } from "../common/dom/fire_event";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
import { fetchHassioAddonsInfo, HassioAddonInfo } from "../data/hassio/addon";
|
||||
import { showAlertDialog } from "../dialogs/generic/show-dialog-box";
|
||||
import { PolymerChangedEvent } from "../polymer-types";
|
||||
import { HomeAssistant } from "../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../types";
|
||||
import { HaComboBox } from "./ha-combo-box";
|
||||
|
||||
const rowRenderer: ComboBoxLitRenderer<HassioAddonInfo> = (
|
||||
@ -113,7 +112,7 @@ class HaAddonPicker extends LitElement {
|
||||
return this.value || "";
|
||||
}
|
||||
|
||||
private _addonChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _addonChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
const newValue = ev.detail.value;
|
||||
|
||||
|
@ -21,8 +21,7 @@ import {
|
||||
showAlertDialog,
|
||||
showPromptDialog,
|
||||
} from "../dialogs/generic/show-dialog-box";
|
||||
import { PolymerChangedEvent } from "../polymer-types";
|
||||
import { HomeAssistant } from "../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../types";
|
||||
import type { HaDevicePickerDeviceFilterFunc } from "./device/ha-device-picker";
|
||||
import "./ha-combo-box";
|
||||
import type { HaComboBox } from "./ha-combo-box";
|
||||
@ -370,11 +369,11 @@ export class HaAreaPicker extends LitElement {
|
||||
return this.value || "";
|
||||
}
|
||||
|
||||
private _openedChanged(ev: PolymerChangedEvent<boolean>) {
|
||||
private _openedChanged(ev: ValueChangedEvent<boolean>) {
|
||||
this._opened = ev.detail.value;
|
||||
}
|
||||
|
||||
private _areaChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _areaChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
let newValue = ev.detail.value;
|
||||
|
||||
|
@ -6,8 +6,7 @@ import { fireEvent } from "../common/dom/fire_event";
|
||||
import { caseInsensitiveStringCompare } from "../common/string/compare";
|
||||
import { ConfigEntry, getConfigEntries } from "../data/config_entries";
|
||||
import { domainToName } from "../data/integration";
|
||||
import { PolymerChangedEvent } from "../polymer-types";
|
||||
import { HomeAssistant } from "../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../types";
|
||||
import { brandsUrl } from "../util/brands-url";
|
||||
import "./ha-combo-box";
|
||||
import type { HaComboBox } from "./ha-combo-box";
|
||||
@ -133,7 +132,7 @@ class HaConfigEntryPicker extends LitElement {
|
||||
return this.value || "";
|
||||
}
|
||||
|
||||
private _valueChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _valueChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
const newValue = ev.detail.value;
|
||||
|
||||
|
@ -8,8 +8,7 @@ import { customElement, property } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { customIcons } from "../data/custom_icons";
|
||||
import { PolymerChangedEvent } from "../polymer-types";
|
||||
import { HomeAssistant } from "../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../types";
|
||||
import "./ha-combo-box";
|
||||
import "./ha-icon";
|
||||
|
||||
@ -173,7 +172,7 @@ export class HaIconPicker extends LitElement {
|
||||
callback(filteredItems.slice(iStart, iEnd), filteredItems.length);
|
||||
};
|
||||
|
||||
private async _openedChanged(ev: PolymerChangedEvent<boolean>) {
|
||||
private async _openedChanged(ev: ValueChangedEvent<boolean>) {
|
||||
const opened = ev.detail.value;
|
||||
if (opened && !ICONS_LOADED) {
|
||||
await loadIcons();
|
||||
@ -181,7 +180,7 @@ export class HaIconPicker extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private _valueChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _valueChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
this._setValue(ev.detail.value);
|
||||
}
|
||||
|
@ -8,8 +8,7 @@ import {
|
||||
LovelaceConfig,
|
||||
LovelaceViewConfig,
|
||||
} from "../data/lovelace";
|
||||
import { PolymerChangedEvent } from "../polymer-types";
|
||||
import { HomeAssistant, PanelInfo } from "../types";
|
||||
import { ValueChangedEvent, HomeAssistant, PanelInfo } from "../types";
|
||||
import "./ha-combo-box";
|
||||
import type { HaComboBox } from "./ha-combo-box";
|
||||
import "./ha-icon";
|
||||
@ -96,7 +95,7 @@ export class HaNavigationPicker extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
private async _openedChanged(ev: PolymerChangedEvent<boolean>) {
|
||||
private async _openedChanged(ev: ValueChangedEvent<boolean>) {
|
||||
this._opened = ev.detail.value;
|
||||
if (this._opened && !this.navigationItemsLoaded) {
|
||||
this._loadNavigationItems();
|
||||
@ -152,7 +151,7 @@ export class HaNavigationPicker extends LitElement {
|
||||
return !this._opened || changedProps.has("_opened");
|
||||
}
|
||||
|
||||
private _valueChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _valueChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
this._setValue(ev.detail.value);
|
||||
}
|
||||
|
@ -15,8 +15,7 @@ import {
|
||||
IntegrationManifest,
|
||||
} from "../data/integration";
|
||||
import { Selector } from "../data/selector";
|
||||
import { PolymerChangedEvent } from "../polymer-types";
|
||||
import { HomeAssistant } from "../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../types";
|
||||
import { documentationUrl } from "../util/documentation-url";
|
||||
import "./ha-checkbox";
|
||||
import "./ha-icon-button";
|
||||
@ -397,7 +396,7 @@ export class HaServiceControl extends LitElement {
|
||||
this.requestUpdate("_checkedKeys");
|
||||
}
|
||||
|
||||
private _serviceChanged(ev: PolymerChangedEvent<string>) {
|
||||
private _serviceChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
if (ev.detail.value === this._value?.service) {
|
||||
return;
|
||||
|
@ -5,8 +5,7 @@ import { guard } from "lit/directives/guard";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
import { fetchUsers, User } from "../../data/user";
|
||||
import type { PolymerChangedEvent } from "../../polymer-types";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import type { ValueChangedEvent, HomeAssistant } from "../../types";
|
||||
import "../ha-icon-button";
|
||||
import "./ha-user-picker";
|
||||
|
||||
@ -117,7 +116,7 @@ class HaUsersPickerLight extends LitElement {
|
||||
});
|
||||
}
|
||||
|
||||
private _userChanged(event: PolymerChangedEvent<string>) {
|
||||
private _userChanged(event: ValueChangedEvent<string>) {
|
||||
event.stopPropagation();
|
||||
const index = (event.currentTarget as any).index;
|
||||
const newValue = event.detail.value;
|
||||
@ -130,7 +129,7 @@ class HaUsersPickerLight extends LitElement {
|
||||
this._updateUsers(newUsers);
|
||||
}
|
||||
|
||||
private async _addUser(event: PolymerChangedEvent<string>) {
|
||||
private async _addUser(event: ValueChangedEvent<string>) {
|
||||
event.stopPropagation();
|
||||
const toAdd = event.detail.value;
|
||||
(event.currentTarget as any).value = "";
|
||||
|
@ -33,8 +33,7 @@ import {
|
||||
} from "../data/core";
|
||||
import { SYMBOL_TO_ISO } from "../data/currency";
|
||||
import { onboardCoreConfigStep } from "../data/onboarding";
|
||||
import type { PolymerChangedEvent } from "../polymer-types";
|
||||
import type { HomeAssistant } from "../types";
|
||||
import type { ValueChangedEvent, HomeAssistant } from "../types";
|
||||
import { getLocalLanguage } from "../util/common-translation";
|
||||
|
||||
const amsterdam: [number, number] = [52.3731339, 4.8903147];
|
||||
@ -368,7 +367,7 @@ class OnboardingCoreConfig extends LitElement {
|
||||
]
|
||||
);
|
||||
|
||||
private _handleChange(ev: PolymerChangedEvent<string>) {
|
||||
private _handleChange(ev: ValueChangedEvent<string>) {
|
||||
const target = ev.currentTarget as HaTextField;
|
||||
|
||||
let value = target.value;
|
||||
|
@ -15,7 +15,7 @@ import "../components/ha-form/ha-form";
|
||||
import type { HaForm } from "../components/ha-form/ha-form";
|
||||
import { HaFormDataContainer, HaFormSchema } from "../components/ha-form/types";
|
||||
import { onboardUserStep } from "../data/onboarding";
|
||||
import { PolymerChangedEvent } from "../polymer-types";
|
||||
import { ValueChangedEvent } from "../types";
|
||||
|
||||
const CREATE_USER_SCHEMA: HaFormSchema[] = [
|
||||
{
|
||||
@ -112,7 +112,7 @@ class OnboardingCreateUser extends LitElement {
|
||||
}
|
||||
|
||||
private _handleValueChanged(
|
||||
ev: PolymerChangedEvent<HaFormDataContainer>
|
||||
ev: ValueChangedEvent<HaFormDataContainer>
|
||||
): void {
|
||||
const nameChanged = ev.detail.value.name !== this._newUser.name;
|
||||
this._newUser = ev.detail.value;
|
||||
|
@ -13,9 +13,8 @@ import "../../../components/ha-textfield";
|
||||
import { AreaRegistryEntryMutableParams } from "../../../data/area_registry";
|
||||
import { showAliasesDialog } from "../../../dialogs/aliases/show-dialog-aliases";
|
||||
import { CropOptions } from "../../../dialogs/image-cropper-dialog/show-image-cropper-dialog";
|
||||
import { PolymerChangedEvent } from "../../../polymer-types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../../types";
|
||||
import { haStyleDialog } from "../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { AreaRegistryDetailDialogParams } from "./show-dialog-area-registry-detail";
|
||||
|
||||
const cropOptions: CropOptions = {
|
||||
@ -187,7 +186,7 @@ class DialogAreaDetail extends LitElement {
|
||||
this._name = ev.target.value;
|
||||
}
|
||||
|
||||
private _pictureChanged(ev: PolymerChangedEvent<string | null>) {
|
||||
private _pictureChanged(ev: ValueChangedEvent<string | null>) {
|
||||
this._error = undefined;
|
||||
this._picture = (ev.target as HaPictureUpload).value;
|
||||
}
|
||||
|
@ -3,8 +3,7 @@ import { customElement, property } from "lit/decorators";
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
import "../../../../../components/entity/ha-entity-picker";
|
||||
import { SceneAction } from "../../../../../data/script";
|
||||
import { PolymerChangedEvent } from "../../../../../polymer-types";
|
||||
import { HomeAssistant } from "../../../../../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../../../../types";
|
||||
import { ActionElement } from "../ha-automation-action-row";
|
||||
|
||||
const includeDomains = ["scene"];
|
||||
@ -51,7 +50,7 @@ export class HaSceneAction extends LitElement implements ActionElement {
|
||||
`;
|
||||
}
|
||||
|
||||
private _entityPicked(ev: PolymerChangedEvent<string>) {
|
||||
private _entityPicked(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
fireEvent(this, "value-changed", {
|
||||
value: {
|
||||
|
@ -5,8 +5,7 @@ import { computeStateDomain } from "../../../../../common/entity/compute_state_d
|
||||
import { hasLocation } from "../../../../../common/entity/has_location";
|
||||
import "../../../../../components/entity/ha-entity-picker";
|
||||
import { ZoneCondition } from "../../../../../data/automation";
|
||||
import { PolymerChangedEvent } from "../../../../../polymer-types";
|
||||
import { HomeAssistant } from "../../../../../types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../../../../types";
|
||||
|
||||
function zoneAndLocationFilter(stateObj) {
|
||||
return hasLocation(stateObj) && computeStateDomain(stateObj) !== "zone";
|
||||
@ -62,14 +61,14 @@ export class HaZoneCondition extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
private _entityPicked(ev: PolymerChangedEvent<string>) {
|
||||
private _entityPicked(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
fireEvent(this, "value-changed", {
|
||||
value: { ...this.condition, entity_id: ev.detail.value },
|
||||
});
|
||||
}
|
||||
|
||||
private _zonePicked(ev: PolymerChangedEvent<string>) {
|
||||
private _zonePicked(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
fireEvent(this, "value-changed", {
|
||||
value: { ...this.condition, zone: ev.detail.value },
|
||||
|
@ -6,8 +6,7 @@ import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
import { computeStateDomain } from "../../../../../common/entity/compute_state_domain";
|
||||
import { hasLocation } from "../../../../../common/entity/has_location";
|
||||
import type { ZoneTrigger } from "../../../../../data/automation";
|
||||
import type { PolymerChangedEvent } from "../../../../../polymer-types";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
import type { ValueChangedEvent, HomeAssistant } from "../../../../../types";
|
||||
import type { HaRadio } from "../../../../../components/ha-radio";
|
||||
|
||||
function zoneAndLocationFilter(stateObj) {
|
||||
@ -94,14 +93,14 @@ export class HaZoneTrigger extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
private _entityPicked(ev: PolymerChangedEvent<string>) {
|
||||
private _entityPicked(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
fireEvent(this, "value-changed", {
|
||||
value: { ...this.trigger, entity_id: ev.detail.value },
|
||||
});
|
||||
}
|
||||
|
||||
private _zonePicked(ev: PolymerChangedEvent<string>) {
|
||||
private _zonePicked(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
fireEvent(this, "value-changed", {
|
||||
value: { ...this.trigger, zone: ev.detail.value },
|
||||
|
@ -6,8 +6,7 @@ import {
|
||||
HassRouterPage,
|
||||
RouterOptions,
|
||||
} from "../../../layouts/hass-router-page";
|
||||
import { PolymerChangedEvent } from "../../../polymer-types";
|
||||
import { HomeAssistant, Route } from "../../../types";
|
||||
import { ValueChangedEvent, HomeAssistant, Route } from "../../../types";
|
||||
import "./account/cloud-account";
|
||||
import "./login/cloud-login";
|
||||
|
||||
@ -95,10 +94,10 @@ class HaConfigCloud extends HassRouterPage {
|
||||
protected createElement(tag: string) {
|
||||
const el = super.createElement(tag);
|
||||
el.addEventListener("email-changed", (ev) => {
|
||||
this._loginEmail = (ev as PolymerChangedEvent<string>).detail.value;
|
||||
this._loginEmail = (ev as ValueChangedEvent<string>).detail.value;
|
||||
});
|
||||
el.addEventListener("flash-message-changed", (ev) => {
|
||||
this._flashMessage = (ev as PolymerChangedEvent<string>).detail.value;
|
||||
this._flashMessage = (ev as ValueChangedEvent<string>).detail.value;
|
||||
});
|
||||
return el;
|
||||
}
|
||||
|
@ -14,8 +14,7 @@ import {
|
||||
ZHAGroup,
|
||||
} from "../../../../../data/zha";
|
||||
import "../../../../../layouts/hass-subpage";
|
||||
import type { PolymerChangedEvent } from "../../../../../polymer-types";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
import type { ValueChangedEvent, HomeAssistant } from "../../../../../types";
|
||||
import "../../../ha-config-section";
|
||||
import "./zha-device-endpoint-data-table";
|
||||
import type { ZHADeviceEndpointDataTable } from "./zha-device-endpoint-data-table";
|
||||
@ -140,7 +139,7 @@ export class ZHAAddGroupPage extends LitElement {
|
||||
navigate(`/config/zha/group/${group.group_id}`, { replace: true });
|
||||
}
|
||||
|
||||
private _handleNameChange(ev: PolymerChangedEvent<string>) {
|
||||
private _handleNameChange(ev: ValueChangedEvent<string>) {
|
||||
const target = ev.currentTarget as PaperInputElement;
|
||||
this._groupName = target.value || "";
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import {
|
||||
ZHADevice,
|
||||
} from "../../../../../data/zha";
|
||||
import "../../../../../layouts/hass-tabs-subpage";
|
||||
import { PolymerChangedEvent } from "../../../../../polymer-types";
|
||||
import { ValueChangedEvent } from "../../../../../types";
|
||||
import type { HomeAssistant, Route } from "../../../../../types";
|
||||
import { formatAsPaddedHex } from "./functions";
|
||||
import { zhaTabs } from "./zha-config-dashboard";
|
||||
@ -339,7 +339,7 @@ export class ZHANetworkVisualizationPage extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private _onZoomToDevice(event: PolymerChangedEvent<string>) {
|
||||
private _onZoomToDevice(event: ValueChangedEvent<string>) {
|
||||
event.stopPropagation();
|
||||
this.zoomedDeviceId = event.detail.value;
|
||||
if (!this._network) {
|
||||
|
@ -18,8 +18,7 @@ import "../../../components/ha-textfield";
|
||||
import type { HaTextField } from "../../../components/ha-textfield";
|
||||
import { CloudStatus, fetchCloudStatus } from "../../../data/cloud";
|
||||
import { saveCoreConfig } from "../../../data/core";
|
||||
import type { PolymerChangedEvent } from "../../../polymer-types";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import type { ValueChangedEvent, HomeAssistant } from "../../../types";
|
||||
|
||||
@customElement("ha-config-url-form")
|
||||
class ConfigUrlForm extends LitElement {
|
||||
@ -291,7 +290,7 @@ class ConfigUrlForm extends LitElement {
|
||||
this._showCustomInternalUrl = !ev.currentTarget.checked;
|
||||
}
|
||||
|
||||
private _handleChange(ev: PolymerChangedEvent<string>) {
|
||||
private _handleChange(ev: ValueChangedEvent<string>) {
|
||||
const target = ev.currentTarget as HaTextField;
|
||||
this[`_${target.name}`] = target.value || null;
|
||||
}
|
||||
|
@ -21,9 +21,8 @@ import {
|
||||
showConfirmationDialog,
|
||||
} from "../../../dialogs/generic/show-dialog-box";
|
||||
import { CropOptions } from "../../../dialogs/image-cropper-dialog/show-image-cropper-dialog";
|
||||
import { PolymerChangedEvent } from "../../../polymer-types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../../types";
|
||||
import { haStyleDialog } from "../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { documentationUrl } from "../../../util/documentation-url";
|
||||
import { showAddUserDialog } from "../users/show-dialog-add-user";
|
||||
import { showAdminChangePasswordDialog } from "../users/show-dialog-admin-change-password";
|
||||
@ -325,12 +324,12 @@ class DialogPersonDetail extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private _deviceTrackersChanged(ev: PolymerChangedEvent<string[]>) {
|
||||
private _deviceTrackersChanged(ev: ValueChangedEvent<string[]>) {
|
||||
this._error = undefined;
|
||||
this._deviceTrackers = ev.detail.value;
|
||||
}
|
||||
|
||||
private _pictureChanged(ev: PolymerChangedEvent<string | null>) {
|
||||
private _pictureChanged(ev: ValueChangedEvent<string | null>) {
|
||||
this._error = undefined;
|
||||
this._picture = (ev.target as HaPictureUpload).value;
|
||||
}
|
||||
|
@ -22,9 +22,8 @@ import {
|
||||
SYSTEM_GROUP_ID_USER,
|
||||
User,
|
||||
} from "../../../data/user";
|
||||
import { PolymerChangedEvent } from "../../../polymer-types";
|
||||
import { ValueChangedEvent, HomeAssistant } from "../../../types";
|
||||
import { haStyleDialog } from "../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { AddUserDialogParams } from "./show-dialog-add-user";
|
||||
|
||||
@customElement("dialog-add-user")
|
||||
@ -231,7 +230,7 @@ export class DialogAddUser extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private _handleValueChanged(ev: PolymerChangedEvent<string>): void {
|
||||
private _handleValueChanged(ev: ValueChangedEvent<string>): void {
|
||||
this._error = undefined;
|
||||
const name = (ev.target as any).name;
|
||||
this[`_${name}`] = ev.detail.value;
|
||||
|
@ -11,12 +11,13 @@ import {
|
||||
string,
|
||||
} from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { hasLocation } from "../../../../common/entity/has_location";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import { SchemaUnion } from "../../../../components/ha-form/types";
|
||||
import "../../../../components/ha-formfield";
|
||||
import "../../../../components/ha-switch";
|
||||
import { PolymerChangedEvent } from "../../../../polymer-types";
|
||||
import { HomeAssistant } from "../../../../types";
|
||||
import { HomeAssistant, ValueChangedEvent } from "../../../../types";
|
||||
import { DEFAULT_HOURS_TO_SHOW, DEFAULT_ZOOM } from "../../cards/hui-map-card";
|
||||
import { MapCardConfig } from "../../cards/types";
|
||||
import "../../components/hui-entity-editor";
|
||||
import "../../components/hui-input-list-editor";
|
||||
@ -27,8 +28,6 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||
import { entitiesConfigStruct } from "../structs/entities-struct";
|
||||
import { EntitiesEditorEvent } from "../types";
|
||||
import { configElementStyle } from "./config-elements-style";
|
||||
import { hasLocation } from "../../../../common/entity/has_location";
|
||||
import { DEFAULT_HOURS_TO_SHOW, DEFAULT_ZOOM } from "../../cards/hui-map-card";
|
||||
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
@ -134,7 +133,7 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
}
|
||||
}
|
||||
|
||||
private _geoSourcesChanged(ev: PolymerChangedEvent<any>): void {
|
||||
private _geoSourcesChanged(ev: ValueChangedEvent<any>): void {
|
||||
if (!this._config || !this.hass) {
|
||||
return;
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ import {
|
||||
showPromptDialog,
|
||||
} from "../../dialogs/generic/show-dialog-box";
|
||||
import { haStyle } from "../../resources/styles";
|
||||
import "../../styles/polymer-ha-style";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { showLongLivedAccessTokenDialog } from "./show-long-lived-access-token-dialog";
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
export const applyPolymerEvent = <T>(
|
||||
ev: PolymerChangedEvent<T>,
|
||||
curValue: T
|
||||
): T => {
|
||||
const { path, value } = ev.detail;
|
||||
if (!path) {
|
||||
return value;
|
||||
}
|
||||
const propName = path.split(".")[1];
|
||||
return { ...curValue, [propName]: value };
|
||||
};
|
||||
|
||||
export interface PolymerChangedEvent<T> extends Event {
|
||||
detail: {
|
||||
value: T;
|
||||
path?: string;
|
||||
queueProperty: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PolymerIronSelectEvent<T> extends Event {
|
||||
detail: {
|
||||
item: T;
|
||||
};
|
||||
}
|
||||
|
||||
declare global {
|
||||
// for fire event
|
||||
interface HASSDomEvents {
|
||||
"hass-logout": undefined;
|
||||
"iron-resize": undefined;
|
||||
"config-refresh": undefined;
|
||||
"hass-api-called": {
|
||||
success: boolean;
|
||||
response: unknown;
|
||||
};
|
||||
}
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
import "@polymer/iron-flex-layout/iron-flex-layout-classes";
|
||||
import type { HassEntity } from "home-assistant-js-websocket";
|
||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
|
14
src/types.ts
14
src/types.ts
@ -40,12 +40,20 @@ declare global {
|
||||
getComputedStyleValue(element, propertyName);
|
||||
};
|
||||
}
|
||||
|
||||
// for fire event
|
||||
interface HASSDomEvents {
|
||||
"value-changed": {
|
||||
value: unknown;
|
||||
};
|
||||
change: undefined;
|
||||
"hass-logout": undefined;
|
||||
"iron-resize": undefined;
|
||||
"config-refresh": undefined;
|
||||
"hass-api-called": {
|
||||
success: boolean;
|
||||
response: unknown;
|
||||
};
|
||||
}
|
||||
|
||||
// For loading workers in webpack
|
||||
@ -54,6 +62,12 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
export interface ValueChangedEvent<T> extends CustomEvent {
|
||||
detail: {
|
||||
value: T;
|
||||
};
|
||||
}
|
||||
|
||||
export type Constructor<T = any> = new (...args: any[]) => T;
|
||||
|
||||
export interface ClassElement {
|
||||
|
Loading…
x
Reference in New Issue
Block a user