Fix incompatible object/array property types (2 of 3) (#19482)

This commit is contained in:
Steve Repsher 2024-01-22 10:04:58 -05:00 committed by GitHub
parent 28a8863f45
commit 349344161a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
58 changed files with 97 additions and 89 deletions

View File

@ -31,11 +31,11 @@ import "./hc-layout";
@customElement("hc-cast")
class HcCast extends LitElement {
@property() public auth!: Auth;
@property({ attribute: false }) public auth!: Auth;
@property() public connection!: Connection;
@property({ attribute: false }) public connection!: Connection;
@property() public castManager!: CastManager;
@property({ attribute: false }) public castManager!: CastManager;
@state() private askWrite = false;

View File

@ -10,13 +10,13 @@ import "../../../../src/components/ha-card";
@customElement("hc-layout")
class HcLayout extends LitElement {
@property() public subtitle?: string | undefined;
@property() public subtitle?: string;
@property() public auth?: Auth;
@property({ attribute: false }) public auth?: Auth;
@property() public connection?: Connection;
@property({ attribute: false }) public connection?: Connection;
@property() public user?: HassUser;
@property({ attribute: false }) public user?: HassUser;
protected render(): TemplateResult {
return html`

View File

@ -10,7 +10,7 @@ import "../ha-demo-options";
@customElement("demo-cards")
class DemoCards extends LitElement {
@property() public configs!: DemoCardConfig[];
@property({ attribute: false }) public configs!: DemoCardConfig[];
@property({ attribute: false }) public hass!: HomeAssistant;

View File

@ -11,7 +11,7 @@ import "./demo-more-info";
class DemoMoreInfos extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public entities!: [];
@property({ type: Array }) public entities!: string[];
@state() private _showConfig = false;

View File

@ -72,7 +72,7 @@ const _computeAddons = (addons): AddonCheckboxItem[] =>
export class SupervisorBackupContent extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public localize?: LocalizeFunc;
@property({ attribute: false }) public localize?: LocalizeFunc;
@property({ attribute: false }) public supervisor?: Supervisor;

View File

@ -34,7 +34,7 @@ export class HaAuthFlow extends LitElement {
@property() public oauth2State?: string;
@property() public localize!: LocalizeFunc;
@property({ attribute: false }) public localize!: LocalizeFunc;
@property({ attribute: false }) public step?: DataEntryFlowStep;

View File

@ -18,9 +18,9 @@ declare global {
@customElement("ha-pick-auth-provider")
export class HaPickAuthProvider extends LitElement {
@property() public authProviders: AuthProvider[] = [];
@property({ attribute: false }) public authProviders: AuthProvider[] = [];
@property() public localize!: LocalizeFunc;
@property({ attribute: false }) public localize!: LocalizeFunc;
protected render() {
return html`

View File

@ -84,9 +84,11 @@ export class HaDevicePicker extends LitElement {
@property({ type: Array, attribute: "exclude-devices" })
public excludeDevices?: string[];
@property() public deviceFilter?: HaDevicePickerDeviceFilterFunc;
@property({ attribute: false })
public deviceFilter?: HaDevicePickerDeviceFilterFunc;
@property() public entityFilter?: HaDevicePickerEntityFilterFunc;
@property({ attribute: false })
public entityFilter?: HaDevicePickerEntityFilterFunc;
@property({ type: Boolean }) public disabled = false;

View File

@ -12,7 +12,7 @@ import type {
class HaDevicesPicker extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public value?: string[];
@property({ type: Array }) public value?: string[];
@property() public helper?: string;
@ -36,17 +36,19 @@ class HaDevicesPicker extends LitElement {
@property({ type: Array, attribute: "exclude-domains" })
public excludeDomains?: string[];
@property({ attribute: "picked-device-label" })
@property({ type: Array, attribute: "include-device-classes" })
public includeDeviceClasses?: string[];
@property({ attribute: "picked-device-label" })
public pickedDeviceLabel?: string;
@property({ attribute: "pick-device-label" }) public pickDeviceLabel?: string;
@property() public deviceFilter?: HaDevicePickerDeviceFilterFunc;
@property({ attribute: false })
public deviceFilter?: HaDevicePickerDeviceFilterFunc;
@property() public entityFilter?: HaDevicePickerEntityFilterFunc;
@property({ attribute: false })
public entityFilter?: HaDevicePickerEntityFilterFunc;
protected render() {
if (!this.hass) {

View File

@ -73,7 +73,8 @@ class HaEntitiesPickerLight extends LitElement {
@property({ attribute: "pick-entity-label" }) public pickEntityLabel?: string;
@property() public entityFilter?: HaEntityPickerEntityFilterFunc;
@property({ attribute: false })
public entityFilter?: HaEntityPickerEntityFilterFunc;
protected render() {
if (!this.hass) {

View File

@ -92,7 +92,8 @@ export class HaEntityPicker extends LitElement {
@property({ type: Array, attribute: "exclude-entities" })
public excludeEntities?: string[];
@property() public entityFilter?: HaEntityPickerEntityFilterFunc;
@property({ attribute: false })
public entityFilter?: HaEntityPickerEntityFilterFunc;
@property({ type: Boolean }) public hideClearIcon = false;

View File

@ -8,7 +8,7 @@ import "./ha-multi-textfield";
class AliasesEditor extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public aliases!: string[];
@property({ type: Array }) public aliases!: string[];
@property({ type: Boolean }) public disabled = false;

View File

@ -88,9 +88,11 @@ export class HaAreaPicker extends LitElement {
@property({ type: Array, attribute: "exclude-areas" })
public excludeAreas?: string[];
@property() public deviceFilter?: HaDevicePickerDeviceFilterFunc;
@property({ attribute: false })
public deviceFilter?: HaDevicePickerDeviceFilterFunc;
@property() public entityFilter?: (entity: HassEntity) => boolean;
@property({ attribute: false })
public entityFilter?: (entity: HassEntity) => boolean;
@property({ type: Boolean }) public disabled = false;

View File

@ -13,7 +13,7 @@ export class HaAreasPicker extends SubscribeMixin(LitElement) {
@property() public label?: string;
@property() public value?: string[];
@property({ type: Array }) public value?: string[];
@property() public helper?: string;
@ -46,9 +46,11 @@ export class HaAreasPicker extends SubscribeMixin(LitElement) {
@property({ type: Array, attribute: "include-device-classes" })
public includeDeviceClasses?: string[];
@property() public deviceFilter?: HaDevicePickerDeviceFilterFunc;
@property({ attribute: false })
public deviceFilter?: HaDevicePickerDeviceFilterFunc;
@property() public entityFilter?: (entity: HassEntity) => boolean;
@property({ attribute: false })
public entityFilter?: (entity: HassEntity) => boolean;
@property({ attribute: "picked-area-label" })
public pickedAreaLabel?: string;

View File

@ -10,7 +10,7 @@ import { attributeIconPath } from "../common/entity/attribute_icon_path";
@customElement("ha-attribute-icon")
export class HaAttributeIcon extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: false }) public stateObj?: HassEntity;

View File

@ -24,7 +24,7 @@ class HaBluePrintPicker extends LitElement {
@property() public domain: BlueprintDomain = "automation";
@property() public blueprints?: Blueprints;
@property({ attribute: false }) public blueprints?: Blueprints;
@property({ type: Boolean }) public disabled = false;

View File

@ -95,7 +95,7 @@ export class HaComboBox extends LitElement {
@property({ attribute: "item-id-path" }) public itemIdPath?: string;
@property() public renderer?: ComboBoxLitRenderer<any>;
@property({ attribute: false }) public renderer?: ComboBoxLitRenderer<any>;
@property({ type: Boolean }) public disabled = false;

View File

@ -269,7 +269,7 @@ export class HaCountryPicker extends LitElement {
@property() public label?: string;
@property() public countries?: string[];
@property({ type: Array }) public countries?: string[];
@property() public helper?: string;

View File

@ -47,11 +47,11 @@ export interface DateRangePickerRanges {
export class HaDateRangePicker extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public startDate!: Date;
@property({ attribute: false }) public startDate!: Date;
@property() public endDate!: Date;
@property({ attribute: false }) public endDate!: Date;
@property() public ranges?: DateRangePickerRanges | false;
@property({ attribute: false }) public ranges?: DateRangePickerRanges | false;
@state() private _ranges?: DateRangePickerRanges;

View File

@ -29,7 +29,7 @@ export class HaFormString extends LitElement implements HaFormElement {
@property() public localizeBaseKey = "ui.components.selectors.text";
@property() public schema!: HaFormStringSchema;
@property({ attribute: false }) public schema!: HaFormStringSchema;
@property() public data!: HaFormStringData;

View File

@ -31,11 +31,11 @@ export class HaGauge extends LitElement {
@property({ type: String }) public valueText?: string;
@property() public locale!: FrontendLocaleData;
@property({ attribute: false }) public locale!: FrontendLocaleData;
@property({ type: Boolean }) public needle = false;
@property() public levels?: LevelDefinition[];
@property({ type: Array }) public levels?: LevelDefinition[];
@property() public label = "";

View File

@ -19,7 +19,7 @@ export class HaLanguagePicker extends LitElement {
@property() public label?: string;
@property() public languages?: string[];
@property({ type: Array }) public languages?: string[];
@property({ attribute: false }) public hass?: HomeAssistant;

View File

@ -14,7 +14,7 @@ import type { HaTextField } from "./ha-textfield";
@customElement("ha-qr-scanner")
class HaQrScanner extends LitElement {
@property() localize!: LocalizeFunc;
@property({ attribute: false }) public localize!: LocalizeFunc;
@state() private _cameras?: QrScanner.Camera[];

View File

@ -62,9 +62,11 @@ export class HaTargetPicker extends LitElement {
@property({ type: Array, attribute: "include-device-classes" })
public includeDeviceClasses?: string[];
@property() public deviceFilter?: HaDevicePickerDeviceFilterFunc;
@property({ attribute: false })
public deviceFilter?: HaDevicePickerDeviceFilterFunc;
@property() public entityFilter?: HaEntityPickerEntityFilterFunc;
@property({ attribute: false })
public entityFilter?: HaEntityPickerEntityFilterFunc;
@property({ type: Boolean, reflect: true }) public disabled = false;

View File

@ -33,7 +33,7 @@ declare global {
class BrowseMediaTTS extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public item!: MediaPlayerItem;
@property({ attribute: false }) public item!: MediaPlayerItem;
@property() public action!: MediaPlayerBrowseAction;

View File

@ -19,7 +19,7 @@ declare global {
class MediaManageButton extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() currentItem?: MediaPlayerItem;
@property({ attribute: false }) currentItem?: MediaPlayerItem;
@state() _uploading = 0;

View File

@ -24,7 +24,7 @@ declare global {
class MediaUploadButton extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() currentItem?: MediaPlayerItem;
@property({ attribute: false }) currentItem?: MediaPlayerItem;
@state() _uploading = 0;

View File

@ -25,7 +25,7 @@ class HassSubpage extends LitElement {
@property({ type: String, attribute: "back-path" }) public backPath?: string;
@property() public backCallback?: () => void;
@property({ attribute: false }) public backCallback?: () => void;
@property({ type: Boolean, reflect: true }) public narrow = false;

View File

@ -13,7 +13,7 @@ export const litLocalizeLiteMixin = <T extends Constructor<LitElement>>(
) => {
class LitLocalizeLiteClass extends superClass {
// Initialized to empty will prevent undefined errors if called before connected to DOM.
@property() public localize: LocalizeFunc = empty;
@property({ attribute: false }) public localize: LocalizeFunc = empty;
// Use browser language setup before login.
@property() public language?: string = getLocalLanguage();

View File

@ -16,7 +16,7 @@ import { onBoardingStyles } from "./styles";
class OnboardingAnalytics extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public localize!: LocalizeFunc;
@property({ attribute: false }) public localize!: LocalizeFunc;
@state() private _error?: string;

View File

@ -26,7 +26,7 @@ import "./onboarding-location";
class OnboardingCoreConfig extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public onboardingLocalize!: LocalizeFunc;
@property({ attribute: false }) public onboardingLocalize!: LocalizeFunc;
@state() private _working = false;

View File

@ -43,7 +43,7 @@ const CREATE_USER_SCHEMA: HaFormSchema[] = [
@customElement("onboarding-create-user")
class OnboardingCreateUser extends LitElement {
@property() public localize!: LocalizeFunc;
@property({ attribute: false }) public localize!: LocalizeFunc;
@property() public language!: string;

View File

@ -36,7 +36,7 @@ const HIDDEN_DOMAINS = new Set([
class OnboardingIntegrations extends SubscribeMixin(LitElement) {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public onboardingLocalize!: LocalizeFunc;
@property({ attribute: false }) public onboardingLocalize!: LocalizeFunc;
@state() private _entries: ConfigEntry[] = [];

View File

@ -48,7 +48,7 @@ const LOCATION_MARKER_ID = "location";
class OnboardingLocation extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public onboardingLocalize!: LocalizeFunc;
@property({ attribute: false }) public onboardingLocalize!: LocalizeFunc;
@state() private _working = false;

View File

@ -19,7 +19,7 @@ import "./onboarding-welcome-link";
class OnboardingWelcomeLinks extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public localize!: LocalizeFunc;
@property({ attribute: false }) public localize!: LocalizeFunc;
@property({ type: Boolean }) public mobileApp = false;

View File

@ -17,7 +17,7 @@ import "../components/ha-button";
class OnboardingWelcome extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public localize!: LocalizeFunc;
@property({ attribute: false }) public localize!: LocalizeFunc;
@property({ type: Boolean }) public supervisor = false;

View File

@ -5,7 +5,7 @@ import { classMap } from "lit/directives/class-map";
@customElement("mqtt-discovery-payload")
class MQTTDiscoveryPayload extends LitElement {
@property() public payload!: Record<string, unknown>;
@property({ attribute: false }) public payload!: Record<string, unknown>;
@property({ type: Boolean }) public showAsYaml = false;

View File

@ -10,7 +10,7 @@ import { HomeAssistant } from "../../../../../../types";
class MQTTMessages extends LitElement {
public hass!: HomeAssistant;
@property() public messages!: MQTTMessage[];
@property({ attribute: false }) public messages!: MQTTMessage[];
@property() public direction!: string;

View File

@ -6,11 +6,9 @@ import { HomeAssistant } from "../../../../types";
@customElement("ha-energy-validation-result")
class EnergyValidationMessage extends LitElement {
@property({ attribute: false })
public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property()
public issues!: EnergyValidationIssue[];
@property({ attribute: false }) public issues!: EnergyValidationIssue[];
public render() {
if (this.issues.length === 0) {

View File

@ -22,7 +22,7 @@ export class ZHAClustersDataTable extends LitElement {
@property({ type: Boolean }) public narrow = false;
@property() public clusters: Cluster[] = [];
@property({ attribute: false }) public clusters: Cluster[] = [];
@query("ha-data-table", true) private _dataTable!: HaDataTable;

View File

@ -30,7 +30,7 @@ class HaConfigScene extends HassRouterPage {
@property({ type: Boolean }) public showAdvanced = false;
@property() public scenes: SceneEntity[] = [];
@property({ attribute: false }) public scenes: SceneEntity[] = [];
protected routerOptions: RouterOptions = {
defaultPage: "dashboard",

View File

@ -70,7 +70,7 @@ class HaSceneDashboard extends LitElement {
@property({ attribute: false }) public route!: Route;
@property() public scenes!: SceneEntity[];
@property({ attribute: false }) public scenes!: SceneEntity[];
@state() private _activeFilters?: string[];

View File

@ -95,7 +95,7 @@ export class HaSceneEditor extends SubscribeMixin(
@property() public sceneId: string | null = null;
@property() public scenes!: SceneEntity[];
@property({ attribute: false }) public scenes!: SceneEntity[];
@property({ type: Boolean }) public showAdvanced = false;

View File

@ -33,7 +33,7 @@ class HaConfigScript extends HassRouterPage {
@property({ type: Boolean }) public showAdvanced = false;
@property() public scripts: ScriptEntity[] = [];
@property({ attribute: false }) public scripts: ScriptEntity[] = [];
@state()
@consume({ context: fullEntitiesContext, subscribe: true })

View File

@ -27,9 +27,9 @@ export default class HaScriptFieldRow extends LitElement {
@property() public key!: string;
@property() public excludeKeys: string[] = [];
@property({ type: Array }) public excludeKeys: string[] = [];
@property() public field!: Field;
@property({ attribute: false }) public field!: Field;
@property({ type: Boolean }) public disabled = false;

View File

@ -24,7 +24,7 @@ export default class HaScriptFields extends LitElement {
@property({ type: Boolean }) public disabled = false;
@property() public fields!: Fields;
@property({ attribute: false }) public fields!: Fields;
private _focusLastActionOnChange = false;

View File

@ -68,7 +68,7 @@ type ScriptItem = ScriptEntity & {
class HaScriptPicker extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public scripts!: ScriptEntity[];
@property({ attribute: false }) public scripts!: ScriptEntity[];
@property({ type: Boolean }) public isWide = false;

View File

@ -6,7 +6,7 @@ import { TagRowData } from "./ha-config-tags";
@customElement("tag-image")
export class HaTagImage extends LitElement {
@property() public tag?: TagRowData;
@property({ attribute: false }) public tag?: TagRowData;
private _timeout?: number;

View File

@ -27,7 +27,7 @@ export class HaPanelCustom extends ReactiveElement {
@property({ attribute: false }) public route!: Route;
@property() public panel!: CustomPanelInfo;
@property({ attribute: false }) public panel!: CustomPanelInfo;
private _setProperties?: (props: Record<string, unknown>) => void | undefined;

View File

@ -13,7 +13,7 @@ interface EventListenerCount {
class EventsList extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public events: EventListenerCount[] = [];
@property({ attribute: false }) public events: EventListenerCount[] = [];
protected render(): TemplateResult {
return html`

View File

@ -11,7 +11,7 @@ class HaPanelIframe extends LitElement {
@property({ type: Boolean }) public narrow = false;
@property() panel!: PanelInfo<{ url: string }>;
@property({ attribute: false }) panel!: PanelInfo<{ url: string }>;
render() {
if (

View File

@ -41,28 +41,24 @@ const idsChanged = (oldIds?: string[], newIds?: string[]) => {
export class HaLogbook extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public time!:
@property({ attribute: false }) public time!:
| { range: [Date, Date] }
| {
// Seconds
recent: number;
};
@property() public entityIds?: string[];
@property({ attribute: false }) public entityIds?: string[];
@property() public deviceIds?: string[];
@property({ attribute: false }) public deviceIds?: string[];
@property({ type: Boolean, attribute: "narrow" })
public narrow = false;
@property({ type: Boolean }) public narrow = false;
@property({ type: Boolean, attribute: "virtualize", reflect: true })
public virtualize = false;
@property({ type: Boolean, reflect: true }) public virtualize = false;
@property({ type: Boolean, attribute: "no-icon" })
public noIcon = false;
@property({ type: Boolean, attribute: "no-icon" }) public noIcon = false;
@property({ type: Boolean, attribute: "no-name" })
public noName = false;
@property({ type: Boolean, attribute: "no-name" }) public noName = false;
@property({ type: Boolean, attribute: "show-indicator" })
public showIndicator = false;

View File

@ -17,7 +17,8 @@ import { haStyleScrollbar } from "../../../resources/styles";
export class HuiButtonsBase extends LitElement {
@state() public hass!: HomeAssistant;
@property() public configEntities?: EntitiesCardEntityConfig[];
@property({ attribute: false })
public configEntities?: EntitiesCardEntityConfig[];
protected render(): TemplateResult {
return html`

View File

@ -19,7 +19,8 @@ export class HuiEntityEditor extends LitElement {
@property({ attribute: false }) public entities?: EntityConfig[];
@property() public entityFilter?: HaEntityPickerEntityFilterFunc;
@property({ attribute: false })
public entityFilter?: HaEntityPickerEntityFilterFunc;
@property() public label?: string;

View File

@ -27,7 +27,7 @@ const INTERVAL_FORMAT = ["relative", "total"];
class HuiTimestampDisplay extends LitElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public ts?: Date;
@property({ attribute: false }) public ts?: Date;
@property() public format?: TimestampRenderingFormat;

View File

@ -52,7 +52,7 @@ let resourcesLoaded = false;
@customElement("ha-panel-lovelace")
export class LovelacePanel extends LitElement {
@property() public panel?: PanelInfo<LovelacePanelConfig>;
@property({ attribute: false }) public panel?: PanelInfo<LovelacePanelConfig>;
@property({ attribute: false }) public hass?: HomeAssistant;

View File

@ -49,7 +49,7 @@ class LovelaceFullConfigEditor extends LitElement {
@property({ attribute: false }) public lovelace?: Lovelace;
@property() public closeEditor?: () => void;
@property({ attribute: false }) public closeEditor?: () => void;
@state() private _saving?: boolean;

View File

@ -15,7 +15,7 @@ class AdvancedModeRow extends LitElement {
@property({ type: Boolean }) public narrow = false;
@property() public coreUserData?: CoreFrontendUserData;
@property({ attribute: false }) public coreUserData?: CoreFrontendUserData;
protected render(): TemplateResult {
return html`