diff --git a/src/components/ha-button-related-filter-menu.ts b/src/components/ha-button-related-filter-menu.ts index 9eb28c7bb7..bc0a7c26b3 100644 --- a/src/components/ha-button-related-filter-menu.ts +++ b/src/components/ha-button-related-filter-menu.ts @@ -4,6 +4,7 @@ import { mdiFilterVariant } from "@mdi/js"; import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; +import { stopPropagation } from "../common/dom/stop_propagation"; import { computeStateName } from "../common/entity/compute_state_name"; import { computeDeviceName } from "../data/device_registry"; import { findRelated, RelatedResult } from "../data/search"; @@ -65,6 +66,7 @@ export class HaRelatedFilterButtonMenu extends LitElement { .fullwidth=${this.narrow} .corner=${this.corner} @closed=${this._onClosed} + @input=${stopPropagation} > `; @@ -110,7 +115,12 @@ export class HaRelatedFilterButtonMenu extends LitElement { this._open = false; } + private _preventDefault(ev) { + ev.preventDefault(); + } + private async _entityPicked(ev: CustomEvent) { + ev.stopPropagation(); const entityId = ev.detail.value; if (!entityId) { fireEvent(this, "related-changed", { value: undefined }); @@ -130,6 +140,7 @@ export class HaRelatedFilterButtonMenu extends LitElement { } private async _devicePicked(ev: CustomEvent) { + ev.stopPropagation(); const deviceId = ev.detail.value; if (!deviceId) { fireEvent(this, "related-changed", { value: undefined }); @@ -153,6 +164,7 @@ export class HaRelatedFilterButtonMenu extends LitElement { } private async _areaPicked(ev: CustomEvent) { + ev.stopPropagation(); const areaId = ev.detail.value; if (!areaId) { fireEvent(this, "related-changed", { value: undefined }); @@ -176,7 +188,7 @@ export class HaRelatedFilterButtonMenu extends LitElement { :host { display: inline-block; position: relative; - --mdc-menu-min-width: 200px; + --mdc-menu-min-width: 250px; } ha-area-picker, ha-device-picker, @@ -186,6 +198,12 @@ export class HaRelatedFilterButtonMenu extends LitElement { padding: 4px 16px; box-sizing: border-box; } + ha-area-picker { + padding-top: 16px; + } + ha-entity-picker { + padding-bottom: 16px; + } :host([narrow]) ha-area-picker, :host([narrow]) ha-device-picker, :host([narrow]) ha-entity-picker { diff --git a/src/dialogs/config-flow/step-flow-pick-handler.ts b/src/dialogs/config-flow/step-flow-pick-handler.ts index cd0652bcc2..d40b8dad64 100644 --- a/src/dialogs/config-flow/step-flow-pick-handler.ts +++ b/src/dialogs/config-flow/step-flow-pick-handler.ts @@ -1,3 +1,4 @@ +import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list-item"; import Fuse from "fuse.js"; import { @@ -5,8 +6,8 @@ import { CSSResultGroup, html, LitElement, - TemplateResult, PropertyValues, + TemplateResult, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; @@ -102,8 +103,7 @@ class StepFlowPickHandler extends LitElement { .label=${this.hass.localize("ui.panel.config.integrations.search")} @keypress=${this._maybeSubmit} > -
this._renderRow(handler))} -
+ ` : ""} ${handlers.length @@ -139,7 +139,7 @@ class StepFlowPickHandler extends LitElement { >.

`} -
+ `; } @@ -169,10 +169,26 @@ class StepFlowPickHandler extends LitElement { } public willUpdate(changedProps: PropertyValues): void { + super.willUpdate(changedProps); if (this._filter === undefined && this.initialFilter !== undefined) { this._filter = this.initialFilter; } - super.willUpdate(changedProps); + if (this.initialFilter !== undefined && this._filter === "") { + this.initialFilter = undefined; + this._filter = ""; + this._width = undefined; + this._height = undefined; + } else if ( + this.hasUpdated && + changedProps.has("_filter") && + (!this._width || !this._height) + ) { + // Store the width and height so that when we search, box doesn't jump + const boundingRect = + this.shadowRoot!.querySelector("mwc-list")!.getBoundingClientRect(); + this._width = boundingRect.width; + this._height = boundingRect.height; + } } protected firstUpdated(changedProps) { @@ -183,21 +199,6 @@ class StepFlowPickHandler extends LitElement { ); } - protected updated(changedProps) { - super.updated(changedProps); - if (!changedProps.has("handlers")) { - return; - } - // Wait until list item initialized - const firstListItem = this.shadowRoot!.querySelector("mwc-list-item")!; - firstListItem.updateComplete.then(() => { - // Store the width and height so that when we search, box doesn't jump - const div = this.shadowRoot!.querySelector("div.container")!; - this._width = div.clientWidth; - this._height = div.clientHeight; - }); - } - private _getHandlers() { return this._filterHandlers( this.handlers, @@ -263,31 +264,26 @@ class StepFlowPickHandler extends LitElement { } search-input { display: block; - margin-top: 8px; - } - .divider { - margin: 8px 0; - border-top: 1px solid var(--divider-color); + margin: 16px 16px 0; } ha-icon-next { margin-right: 8px; } - div { + mwc-list { overflow: auto; max-height: 600px; } + .divider { + border-bottom-color: var(--divider-color); + } h2 { padding-right: 66px; } @media all and (max-height: 900px) { - div { + mwc-list { max-height: calc(100vh - 134px); } } - paper-icon-item { - cursor: pointer; - margin-bottom: 4px; - } p { text-align: center; padding: 16px; diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index dd33958584..2198a69a9e 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -338,7 +338,9 @@ export class MoreInfoDialog extends LitElement { flex-shrink: 0; display: block; } - + .content { + outline: none; + } @media all and (max-width: 450px), all and (max-height: 500px) { ha-header-bar { --mdc-theme-primary: var(--app-header-background-color); diff --git a/src/layouts/hass-tabs-subpage-data-table.ts b/src/layouts/hass-tabs-subpage-data-table.ts index 3d22846a62..1e44c0fafd 100644 --- a/src/layouts/hass-tabs-subpage-data-table.ts +++ b/src/layouts/hass-tabs-subpage-data-table.ts @@ -164,7 +164,11 @@ export class HaTabsSubpageDataTable extends LitElement { this.hass.localize("ui.components.data-table.search")} > ${!this.narrow - ? html`
+ ? html`
${filterInfo ? html`
${filterInfo} @@ -194,10 +198,10 @@ export class HaTabsSubpageDataTable extends LitElement {
${this.narrow ? html`
- ${this.numHidden || - this.activeFilters + ${this.numHidden || this.activeFilters ? html`${this.numHidden || "!"}` : ""} +
` : ""}
@@ -238,6 +242,10 @@ export class HaTabsSubpageDataTable extends LitElement { `; } + private _preventDefault(ev) { + ev.preventDefault(); + } + private _handleSearchChange(ev: CustomEvent) { if (this.filter === ev.detail.value) { return; @@ -292,12 +300,14 @@ export class HaTabsSubpageDataTable extends LitElement { --mdc-ripple-color: transparant; } .filters { - --mdc-text-field-fill-color: initial; - --mdc-text-field-idle-line-color: initial; + --mdc-text-field-fill-color: var(--input-fill-color); + --mdc-text-field-idle-line-color: var(--input-idle-line-color); + --mdc-shape-small: 4px; --text-field-overflow: initial; display: flex; justify-content: flex-end; margin-right: 8px; + color: var(--primary-text-color); } .active-filters { color: var(--primary-text-color); @@ -308,6 +318,7 @@ export class HaTabsSubpageDataTable extends LitElement { margin-left: 4px; font-size: 14px; width: max-content; + cursor: initial; } .active-filters ha-svg-icon { color: var(--primary-color); diff --git a/src/panels/config/integrations/ha-config-integrations.ts b/src/panels/config/integrations/ha-config-integrations.ts index 3c8dbe1f1e..b8fb03c40d 100644 --- a/src/panels/config/integrations/ha-config-integrations.ts +++ b/src/panels/config/integrations/ha-config-integrations.ts @@ -300,10 +300,14 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) { const filterMenu = html`
+ ${!this._showDisabled && this.narrow && disabledCount + ? html`${disabledCount}` + : ""} - ${!this._showDisabled && this.narrow && disabledCount - ? html`${disabledCount}` - : ""}
`; return html` @@ -362,7 +363,11 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) { )} > ${!this._showDisabled && disabledCount - ? html`
+ ? html`
${this.hass.localize( "ui.panel.config.integrations.disable.disabled_integrations", { number: disabledCount } @@ -507,6 +512,10 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) { `; } + private _preventDefault(ev) { + ev.preventDefault(); + } + private _loadConfigEntries() { getConfigEntries(this.hass).then((configEntries) => { this._configEntries = configEntries @@ -724,6 +733,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) { padding: 2px 2px 2px 8px; font-size: 14px; width: max-content; + cursor: initial; } .active-filters mwc-button { margin-left: 8px; @@ -754,6 +764,9 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) { top: 8px; font-size: 0.65em; } + ha-button-menu { + color: var(--primary-text-color); + } `, ]; }