Fix incompatible object/array property types (1 of 3) (#19450)

This commit is contained in:
Steve Repsher 2024-01-19 15:16:15 -05:00 committed by GitHub
parent 45398f84cb
commit dcb3accdb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
45 changed files with 62 additions and 62 deletions

View File

@ -13,7 +13,7 @@ export interface DemoCardConfig {
class DemoCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public config!: DemoCardConfig;
@property({ attribute: false }) public config!: DemoCardConfig;
@property({ type: Boolean }) public showConfig = false;

View File

@ -25,7 +25,7 @@ export abstract class HaDeviceAutomationPicker<
@property() public deviceId?: string;
@property() public value?: T;
@property({ type: Object }) public value?: T;
@state() private _automations: T[] = [];

View File

@ -31,11 +31,11 @@ export class HaFileUpload extends LitElement {
@property() public supports?: string;
@property() public value?: File | File[] | FileList | string;
@property({ type: Object }) public value?: File | File[] | FileList | string;
@property({ type: Boolean }) public multiple = false;
@property({ type: Boolean, reflect: true }) public disabled: boolean = false;
@property({ type: Boolean, reflect: true }) public disabled = false;
@property({ type: Boolean }) public uploading = false;

View File

@ -11,7 +11,7 @@ export class HaActionSelector extends LitElement {
@property({ attribute: false }) public selector!: ActionSelector;
@property() public value?: Action;
@property({ attribute: false }) public value?: Action;
@property() public label?: string;

View File

@ -11,7 +11,7 @@ export class HaConditionSelector extends LitElement {
@property({ attribute: false }) public selector!: ConditionSelector;
@property() public value?: Condition;
@property({ attribute: false }) public value?: Condition;
@property() public label?: string;

View File

@ -16,7 +16,7 @@ export class HaLocationSelector extends LitElement {
@property({ attribute: false }) public selector!: LocationSelector;
@property() public value?: LocationSelectorValue;
@property({ type: Object }) public value?: LocationSelectorValue;
@property() public label?: string;

View File

@ -32,7 +32,7 @@ export class HaTargetSelector extends LitElement {
@property({ attribute: false }) public selector!: TargetSelector;
@property() public value?: HassServiceTarget;
@property({ type: Object }) public value?: HassServiceTarget;
@property() public label?: string;

View File

@ -11,7 +11,7 @@ export class HaTriggerSelector extends LitElement {
@property({ attribute: false }) public selector!: TriggerSelector;
@property() public value?: Trigger;
@property({ attribute: false }) public value?: Trigger;
@property() public label?: string;

View File

@ -12,7 +12,7 @@ export class HaSelectorUiAction extends LitElement {
@property({ attribute: false }) public selector!: UiActionSelector;
@property() public value?: ActionConfig;
@property({ attribute: false }) public value?: ActionConfig;
@property() public label?: string;

View File

@ -125,7 +125,7 @@ const preventDefault = (ev) => ev.preventDefault();
export default class HaAutomationActionRow extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public action!: Action;
@property({ attribute: false }) public action!: Action;
@property({ type: Boolean }) public narrow = false;
@ -133,7 +133,7 @@ export default class HaAutomationActionRow extends LitElement {
@property({ type: Boolean }) public hideMenu = false;
@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;
@storage({
key: "automationClipboard",

View File

@ -33,9 +33,9 @@ export default class HaAutomationAction extends LitElement {
@property({ type: Boolean }) public disabled = false;
@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;
@property() public actions!: Action[];
@property({ attribute: false }) public actions!: Action[];
@state()
@consume({ context: reorderModeContext, subscribe: true })

View File

@ -29,7 +29,7 @@ export class HaRepeatAction extends LitElement implements ActionElement {
@property({ attribute: false }) public action!: RepeatAction;
@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;
public static get defaultConfig() {
return { repeat: { count: 2, sequence: [] } };

View File

@ -30,9 +30,9 @@ export class HaBlueprintAutomationEditor extends ReorderModeMixin(LitElement) {
@property({ type: Boolean }) public disabled = false;
@property({ reflect: true, type: Boolean }) public narrow = false;
@property({ type: Boolean, reflect: true }) public narrow = false;
@property() public config!: BlueprintAutomationConfig;
@property({ attribute: false }) public config!: BlueprintAutomationConfig;
@property({ attribute: false }) public stateObj?: HassEntity;

View File

@ -30,7 +30,7 @@ export default class HaAutomationConditionEditor extends LitElement {
@property({ type: Boolean }) public yamlMode = false;
@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;
private _processedCondition = memoizeOne((condition) =>
expandConditionWithShorthand(condition)

View File

@ -81,13 +81,13 @@ export const handleChangeEvent = (
export default class HaAutomationConditionRow extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public condition!: Condition;
@property({ attribute: false }) public condition!: Condition;
@property({ type: Boolean }) public hideMenu = false;
@property({ type: Boolean }) public disabled = false;
@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;
@storage({
key: "automationClipboard",

View File

@ -38,11 +38,11 @@ import type HaAutomationConditionRow from "./ha-automation-condition-row";
export default class HaAutomationCondition extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public conditions!: Condition[];
@property({ attribute: false }) public conditions!: Condition[];
@property({ type: Boolean }) public disabled = false;
@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;
@state()
@consume({ context: reorderModeContext, subscribe: true })

View File

@ -112,7 +112,7 @@ export default class HaAutomationTriggerRow extends LitElement {
@property({ type: Boolean }) public disabled = false;
@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;
@state() private _warnings?: string[];

View File

@ -28,11 +28,11 @@ import type HaAutomationTriggerRow from "./ha-automation-trigger-row";
export default class HaAutomationTrigger extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public triggers!: Trigger[];
@property({ attribute: false }) public triggers!: Trigger[];
@property({ type: Boolean }) public disabled = false;
@property() public path?: ItemPath;
@property({ type: Array }) public path?: ItemPath;
@state()
@consume({ context: reorderModeContext, subscribe: true })

View File

@ -15,7 +15,7 @@ import {
export class HaEventTrigger extends LitElement implements TriggerElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public trigger!: EventTrigger;
@property({ attribute: false }) public trigger!: EventTrigger;
@property({ type: Boolean }) public disabled = false;

View File

@ -23,7 +23,8 @@ export class HaPersistentNotificationTrigger
{
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public trigger!: PersistentNotificationTrigger;
@property({ attribute: false })
public trigger!: PersistentNotificationTrigger;
@property({ type: Boolean }) public disabled = false;

View File

@ -13,7 +13,7 @@ import { TriggerElement } from "../ha-automation-trigger-row";
export class HaTagTrigger extends LitElement implements TriggerElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public trigger!: TagTrigger;
@property({ attribute: false }) public trigger!: TagTrigger;
@property({ type: Boolean }) public disabled = false;

View File

@ -27,7 +27,7 @@ const DEFAULT_WEBHOOK_ID = "";
export class HaWebhookTrigger extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public trigger!: WebhookTrigger;
@property({ attribute: false }) public trigger!: WebhookTrigger;
@property({ type: Boolean }) public disabled = false;

View File

@ -19,7 +19,7 @@ const includeDomains = ["zone"];
export class HaZoneTrigger extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public trigger!: ZoneTrigger;
@property({ attribute: false }) public trigger!: ZoneTrigger;
@property({ type: Boolean }) public disabled = false;

View File

@ -22,7 +22,7 @@ import { showCloudCertificateDialog } from "../dialog-cloud-certificate/show-dia
export class CloudRemotePref extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public cloudStatus?: CloudStatusLoggedIn;
@property({ attribute: false }) public cloudStatus?: CloudStatusLoggedIn;
protected render() {
if (!this.cloudStatus) {

View File

@ -24,7 +24,7 @@ import { showTryTtsDialog } from "./show-dialog-cloud-tts-try";
export class CloudTTSPref extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public cloudStatus?: CloudStatusLoggedIn;
@property({ attribute: false }) public cloudStatus?: CloudStatusLoggedIn;
@state() private savingPreferences = false;

View File

@ -22,7 +22,7 @@ class HaConfigCloud extends HassRouterPage {
@property({ attribute: false }) public route!: Route;
@property() public cloudStatus!: CloudStatus;
@property({ attribute: false }) public cloudStatus!: CloudStatus;
protected routerOptions: RouterOptions = {
defaultPage: "login",

View File

@ -118,7 +118,7 @@ class HaConfigDashboard extends SubscribeMixin(LitElement) {
@property({ type: Boolean }) public isWide = false;
@property() public cloudStatus?: CloudStatus;
@property({ attribute: false }) public cloudStatus?: CloudStatus;
@property({ type: Boolean }) public showAdvanced = false;

View File

@ -13,7 +13,7 @@ import { HomeAssistant } from "../../../../types";
export class HaDeviceCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public device!: DeviceRegistryEntry;
@property({ attribute: false }) public device!: DeviceRegistryEntry;
@property({ type: Boolean }) public narrow = false;

View File

@ -18,7 +18,7 @@ import { formatAsPaddedHex } from "../../../../integrations/integration-panels/z
export class HaDeviceInfoZha extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public device!: DeviceRegistryEntry;
@property({ attribute: false }) public device!: DeviceRegistryEntry;
@state() private _zhaDevice?: ZHADevice;

View File

@ -33,9 +33,9 @@ import { ItemSelectedEvent, SetAttributeServiceData } from "./types";
export class ZHAClusterAttributes extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;
@property() public selectedCluster?: Cluster;
@property({ type: Object }) public selectedCluster?: Cluster;
@state() private _attributes: Attribute[] | undefined;

View File

@ -30,9 +30,9 @@ export class ZHAClusterCommands extends LitElement {
@property({ type: Boolean }) public isWide = false;
@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;
@property() public selectedCluster?: Cluster;
@property({ type: Object }) public selectedCluster?: Cluster;
@state() private _commands: Command[] | undefined;

View File

@ -21,7 +21,7 @@ import { ItemSelectedEvent } from "./types";
export class ZHADeviceBindingControl extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;
@state() private _bindTargetIndex = -1;

View File

@ -29,7 +29,7 @@ import { getIeeeTail } from "./functions";
class ZHADeviceCard extends SubscribeMixin(LitElement) {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;
@property({ type: Boolean }) public narrow = false;

View File

@ -26,7 +26,7 @@ class ZHADeviceNeighbors extends LitElement {
@property({ type: Boolean }) public narrow = false;
@property() public device: ZHADevice | undefined;
@property({ attribute: false }) public device?: ZHADevice;
@state() private _devices: Map<string, ZHADevice> | undefined;

View File

@ -18,7 +18,7 @@ import "./zha-device-card";
class ZHADevicePairingStatusCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;
@property({ type: Boolean }) public narrow = false;

View File

@ -8,7 +8,7 @@ import { HomeAssistant } from "../../../../../types";
class ZHADeviceZigbeeInfo extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public device: ZHADevice | undefined;
@property({ attribute: false }) public device?: ZHADevice;
@state() private _signature: any;

View File

@ -31,7 +31,7 @@ import "@material/mwc-list/mwc-list-item";
export class ZHAGroupBindingControl extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;
@state() private _bindTargetIndex = -1;

View File

@ -42,7 +42,7 @@ export class ZHAManageClusters extends LitElement {
@property({ type: Boolean }) public isWide = false;
@property() public device?: ZHADevice;
@property({ attribute: false }) public device?: ZHADevice;
@state() private _selectedClusterIndex = -1;

View File

@ -1,7 +1,7 @@
import "@material/mwc-list/mwc-list";
import { mdiHelpCircle, mdiPlus, mdiStar } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
import { property, state } from "lit/decorators";
import { CSSResultGroup, LitElement, PropertyValues, css, html } from "lit";
import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
import { formatLanguageCode } from "../../../common/language/format_language";
import "../../../components/ha-alert";
@ -26,9 +26,10 @@ import { ExposeEntitySettings } from "../../../data/expose";
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
import type { HomeAssistant } from "../../../types";
import { brandsUrl } from "../../../util/brands-url";
import { showVoiceAssistantPipelineDetailDialog } from "./show-dialog-voice-assistant-pipeline-detail";
import { documentationUrl } from "../../../util/documentation-url";
import { showVoiceAssistantPipelineDetailDialog } from "./show-dialog-voice-assistant-pipeline-detail";
@customElement("assist-pref")
export class AssistPref extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@ -37,14 +38,14 @@ export class AssistPref extends LitElement {
ExposeEntitySettings
>;
@property({ attribute: false }) public cloudStatus?: CloudStatus;
@state() private _pipelines: AssistPipeline[] = [];
@state() private _preferred: string | null = null;
@state() private _devices: AssistDevice[] = [];
@property() public cloudStatus?: CloudStatus;
protected firstUpdated(changedProps: PropertyValues) {
super.firstUpdated(changedProps);
@ -277,5 +278,3 @@ declare global {
"assist-pref": AssistPref;
}
}
customElements.define("assist-pref", AssistPref);

View File

@ -27,7 +27,7 @@ export class CloudAlexaPref extends LitElement {
ExposeEntitySettings
>;
@property() public cloudStatus?: CloudStatusLoggedIn;
@property({ attribute: false }) public cloudStatus?: CloudStatusLoggedIn;
@state() private _exposeNew?: boolean;

View File

@ -72,13 +72,13 @@ const ASSIST_SCHEMA = [
@customElement("hui-action-editor")
export class HuiActionEditor extends LitElement {
@property() public config?: ActionConfig;
@property({ attribute: false }) public config?: ActionConfig;
@property() public label?: string;
@property() public actions?: UiAction[];
@property({ attribute: false }) public actions?: UiAction[];
@property() public defaultAction?: UiAction;
@property({ attribute: false }) public defaultAction?: UiAction;
@property() public tooltipText?: string;

View File

@ -54,7 +54,7 @@ export class HuiCardOptions extends LitElement {
@property({ attribute: false }) public lovelace?: Lovelace;
@property() public path?: [number, number];
@property({ type: Array }) public path?: [number, number];
@queryAssignedNodes() private _assignedNodes?: NodeListOf<LovelaceCard>;

View File

@ -28,7 +28,7 @@ import { createEntityNotFoundWarning } from "./hui-warning";
export class HuiGenericEntityRow extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public config?: EntitiesCardEntityConfig;
@property({ attribute: false }) public config?: EntitiesCardEntityConfig;
@property() public secondaryText?: string;

View File

@ -10,7 +10,7 @@ import { LovelaceCard } from "../../types";
export class HuiCardPreview extends ReactiveElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public config?: LovelaceCardConfig;
@property({ attribute: false }) public config?: LovelaceCardConfig;
private _element?: LovelaceCard;

View File

@ -18,7 +18,7 @@ declare global {
export class HuiLovelaceEditor extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public config?: LovelaceConfig;
@property({ attribute: false }) public config?: LovelaceConfig;
get _title(): string {
if (!this.config) {