mirror of
				https://github.com/home-assistant/frontend.git
				synced 2025-10-29 21:49:45 +00:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			20230306.0
			...
			fix-search
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 21e441b682 | ||
|   | 737f7ba6b9 | ||
|   | a5862b86ca | 
| @@ -1,5 +1,3 @@ | ||||
| import "@polymer/paper-item/paper-icon-item"; | ||||
| import "@polymer/paper-item/paper-item-body"; | ||||
| import Fuse from "fuse.js"; | ||||
| import { | ||||
|   css, | ||||
| @@ -22,6 +20,7 @@ import { HomeAssistant } from "../../types"; | ||||
| import { brandsUrl } from "../../util/brands-url"; | ||||
| import { documentationUrl } from "../../util/documentation-url"; | ||||
| import { configFlowContentStyles } from "./styles"; | ||||
| import "@material/mwc-list/mwc-list-item"; | ||||
|  | ||||
| interface HandlerObj { | ||||
|   name: string; | ||||
| @@ -97,12 +96,14 @@ class StepFlowPickHandler extends LitElement { | ||||
|           ? handlers.map( | ||||
|               (handler: HandlerObj) => | ||||
|                 html` | ||||
|                   <paper-icon-item | ||||
|                   <mwc-list-item | ||||
|                     graphic="medium" | ||||
|                     hasMeta | ||||
|                     @click=${this._handlerPicked} | ||||
|                     .handler=${handler} | ||||
|                   > | ||||
|                     <img | ||||
|                       slot="item-icon" | ||||
|                       slot="graphic" | ||||
|                       loading="lazy" | ||||
|                       src=${brandsUrl({ | ||||
|                         domain: handler.slug, | ||||
| @@ -113,9 +114,9 @@ class StepFlowPickHandler extends LitElement { | ||||
|                       referrerpolicy="no-referrer" | ||||
|                     /> | ||||
|  | ||||
|                     <paper-item-body> ${handler.name} </paper-item-body> | ||||
|                     <ha-icon-next></ha-icon-next> | ||||
|                   </paper-icon-item> | ||||
|                     ${handler.name} | ||||
|                     <ha-icon-next slot="meta"></ha-icon-next> | ||||
|                   </mwc-list-item> | ||||
|                 ` | ||||
|             ) | ||||
|           : html` | ||||
| @@ -145,10 +146,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("div")!.getBoundingClientRect(); | ||||
|       this._width = boundingRect.width; | ||||
|       this._height = boundingRect.height; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   protected firstUpdated(changedProps) { | ||||
| @@ -159,24 +176,6 @@ class StepFlowPickHandler extends LitElement { | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   protected updated(changedProps) { | ||||
|     super.updated(changedProps); | ||||
|     // Store the width and height so that when we search, box doesn't jump | ||||
|     const div = this.shadowRoot!.querySelector("div")!; | ||||
|     if (!this._width) { | ||||
|       const width = div.clientWidth; | ||||
|       if (width) { | ||||
|         this._width = width; | ||||
|       } | ||||
|     } | ||||
|     if (!this._height) { | ||||
|       const height = div.clientHeight; | ||||
|       if (height) { | ||||
|         this._height = height; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   private _getHandlers() { | ||||
|     return this._filterHandlers( | ||||
|       this.handlers, | ||||
| @@ -219,7 +218,7 @@ class StepFlowPickHandler extends LitElement { | ||||
|         } | ||||
|         search-input { | ||||
|           display: block; | ||||
|           margin: -12px 16px 0; | ||||
|           margin: 8px 16px 0; | ||||
|         } | ||||
|         ha-icon-next { | ||||
|           margin-right: 8px; | ||||
| @@ -236,10 +235,6 @@ class StepFlowPickHandler extends LitElement { | ||||
|             max-height: calc(100vh - 134px); | ||||
|           } | ||||
|         } | ||||
|         paper-icon-item { | ||||
|           cursor: pointer; | ||||
|           margin-bottom: 4px; | ||||
|         } | ||||
|         p { | ||||
|           text-align: center; | ||||
|           padding: 16px; | ||||
|   | ||||
| @@ -352,6 +352,10 @@ export class MoreInfoDialog extends LitElement { | ||||
|             var(--mdc-dialog-scroll-divider-color, rgba(0, 0, 0, 0.12)); | ||||
|         } | ||||
|  | ||||
|         .content { | ||||
|           outline: none; | ||||
|         } | ||||
|  | ||||
|         @media all and (min-width: 451px) and (min-height: 501px) { | ||||
|           ha-dialog { | ||||
|             --mdc-dialog-max-width: 90vw; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user