mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Focus search input on integrations dashboard when using search shotcut (#23647)
Focus search input on integrations dashboard when using search shortcut
This commit is contained in:
parent
f8264e4500
commit
712817df65
@ -5,7 +5,7 @@ import Fuse from "fuse.js";
|
|||||||
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
|
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||||
import type { CSSResultGroup, PropertyValues } from "lit";
|
import type { CSSResultGroup, PropertyValues } from "lit";
|
||||||
import { LitElement, css, html, nothing } from "lit";
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { ifDefined } from "lit/directives/if-defined";
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
||||||
@ -70,6 +70,7 @@ import "./ha-integration-overflow-menu";
|
|||||||
import { showAddIntegrationDialog } from "./show-add-integration-dialog";
|
import { showAddIntegrationDialog } from "./show-add-integration-dialog";
|
||||||
import { fetchEntitySourcesWithCache } from "../../../data/entity_sources";
|
import { fetchEntitySourcesWithCache } from "../../../data/entity_sources";
|
||||||
import type { ImprovDiscoveredDevice } from "../../../external_app/external_messaging";
|
import type { ImprovDiscoveredDevice } from "../../../external_app/external_messaging";
|
||||||
|
import { KeyboardShortcutMixin } from "../../../mixins/keyboard-shortcut-mixin";
|
||||||
|
|
||||||
export interface ConfigEntryExtended extends Omit<ConfigEntry, "entry_id"> {
|
export interface ConfigEntryExtended extends Omit<ConfigEntry, "entry_id"> {
|
||||||
entry_id?: string;
|
entry_id?: string;
|
||||||
@ -90,7 +91,9 @@ const groupByIntegration = (
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@customElement("ha-config-integrations-dashboard")
|
@customElement("ha-config-integrations-dashboard")
|
||||||
class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
|
class HaConfigIntegrationsDashboard extends KeyboardShortcutMixin(
|
||||||
|
SubscribeMixin(LitElement)
|
||||||
|
) {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property({ type: Boolean, reflect: true }) public narrow = false;
|
@property({ type: Boolean, reflect: true }) public narrow = false;
|
||||||
@ -135,6 +138,8 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
|
|||||||
[integration: string]: IntegrationLogInfo;
|
[integration: string]: IntegrationLogInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@query("search-input-outlined") private _searchInput!: HTMLElement;
|
||||||
|
|
||||||
public disconnectedCallback(): void {
|
public disconnectedCallback(): void {
|
||||||
super.disconnectedCallback();
|
super.disconnectedCallback();
|
||||||
window.removeEventListener(
|
window.removeEventListener(
|
||||||
@ -946,6 +951,12 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected supportedShortcuts(): SupportedShortcuts {
|
||||||
|
return {
|
||||||
|
f: () => this._searchInput.focus(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return [
|
return [
|
||||||
haStyle,
|
haStyle,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user