mirror of
				https://github.com/home-assistant/frontend.git
				synced 2025-10-31 14:39:38 +00:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			20230201.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 Fuse from "fuse.js"; | ||||||
| import { | import { | ||||||
|   css, |   css, | ||||||
| @@ -22,6 +20,7 @@ import { HomeAssistant } from "../../types"; | |||||||
| import { brandsUrl } from "../../util/brands-url"; | import { brandsUrl } from "../../util/brands-url"; | ||||||
| import { documentationUrl } from "../../util/documentation-url"; | import { documentationUrl } from "../../util/documentation-url"; | ||||||
| import { configFlowContentStyles } from "./styles"; | import { configFlowContentStyles } from "./styles"; | ||||||
|  | import "@material/mwc-list/mwc-list-item"; | ||||||
|  |  | ||||||
| interface HandlerObj { | interface HandlerObj { | ||||||
|   name: string; |   name: string; | ||||||
| @@ -97,12 +96,14 @@ class StepFlowPickHandler extends LitElement { | |||||||
|           ? handlers.map( |           ? handlers.map( | ||||||
|               (handler: HandlerObj) => |               (handler: HandlerObj) => | ||||||
|                 html` |                 html` | ||||||
|                   <paper-icon-item |                   <mwc-list-item | ||||||
|  |                     graphic="medium" | ||||||
|  |                     hasMeta | ||||||
|                     @click=${this._handlerPicked} |                     @click=${this._handlerPicked} | ||||||
|                     .handler=${handler} |                     .handler=${handler} | ||||||
|                   > |                   > | ||||||
|                     <img |                     <img | ||||||
|                       slot="item-icon" |                       slot="graphic" | ||||||
|                       loading="lazy" |                       loading="lazy" | ||||||
|                       src=${brandsUrl({ |                       src=${brandsUrl({ | ||||||
|                         domain: handler.slug, |                         domain: handler.slug, | ||||||
| @@ -113,9 +114,9 @@ class StepFlowPickHandler extends LitElement { | |||||||
|                       referrerpolicy="no-referrer" |                       referrerpolicy="no-referrer" | ||||||
|                     /> |                     /> | ||||||
|  |  | ||||||
|                     <paper-item-body> ${handler.name} </paper-item-body> |                     ${handler.name} | ||||||
|                     <ha-icon-next></ha-icon-next> |                     <ha-icon-next slot="meta"></ha-icon-next> | ||||||
|                   </paper-icon-item> |                   </mwc-list-item> | ||||||
|                 ` |                 ` | ||||||
|             ) |             ) | ||||||
|           : html` |           : html` | ||||||
| @@ -145,10 +146,26 @@ class StepFlowPickHandler extends LitElement { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   public willUpdate(changedProps: PropertyValues): void { |   public willUpdate(changedProps: PropertyValues): void { | ||||||
|  |     super.willUpdate(changedProps); | ||||||
|     if (this._filter === undefined && this.initialFilter !== undefined) { |     if (this._filter === undefined && this.initialFilter !== undefined) { | ||||||
|       this._filter = this.initialFilter; |       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) { |   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() { |   private _getHandlers() { | ||||||
|     return this._filterHandlers( |     return this._filterHandlers( | ||||||
|       this.handlers, |       this.handlers, | ||||||
| @@ -219,7 +218,7 @@ class StepFlowPickHandler extends LitElement { | |||||||
|         } |         } | ||||||
|         search-input { |         search-input { | ||||||
|           display: block; |           display: block; | ||||||
|           margin: -12px 16px 0; |           margin: 8px 16px 0; | ||||||
|         } |         } | ||||||
|         ha-icon-next { |         ha-icon-next { | ||||||
|           margin-right: 8px; |           margin-right: 8px; | ||||||
| @@ -236,10 +235,6 @@ class StepFlowPickHandler extends LitElement { | |||||||
|             max-height: calc(100vh - 134px); |             max-height: calc(100vh - 134px); | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|         paper-icon-item { |  | ||||||
|           cursor: pointer; |  | ||||||
|           margin-bottom: 4px; |  | ||||||
|         } |  | ||||||
|         p { |         p { | ||||||
|           text-align: center; |           text-align: center; | ||||||
|           padding: 16px; |           padding: 16px; | ||||||
|   | |||||||
| @@ -352,6 +352,10 @@ export class MoreInfoDialog extends LitElement { | |||||||
|             var(--mdc-dialog-scroll-divider-color, rgba(0, 0, 0, 0.12)); |             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) { |         @media all and (min-width: 451px) and (min-height: 501px) { | ||||||
|           ha-dialog { |           ha-dialog { | ||||||
|             --mdc-dialog-max-width: 90vw; |             --mdc-dialog-max-width: 90vw; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user