-
Notifications
You must be signed in to change notification settings - Fork 3.6k
mwc-select -> ha-select #11806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
mwc-select -> ha-select #11806
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a23b50e
mwc-select -> ha-select
bramkragten 57f484c
Allow icon in select
bramkragten 0592990
review
bramkragten 4c1b0fb
Update select options when translations change
bramkragten 4081de6
add debounce
bramkragten ba17d8f
rename
bramkragten 9aea464
make icon boolean
bramkragten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| import "@material/mwc-select/mwc-select"; | ||
| import { mdiMenuDown, mdiMenuUp } from "@mdi/js"; | ||
| import { | ||
| css, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { SelectBase } from "@material/mwc-select/mwc-select-base"; | ||
| import { styles } from "@material/mwc-select/mwc-select.css"; | ||
| import { html, nothing } from "lit"; | ||
| import { customElement, property } from "lit/decorators"; | ||
| import { debounce } from "../common/util/debounce"; | ||
| import { nextRender } from "../common/util/render-status"; | ||
|
|
||
| @customElement("ha-select") | ||
| export class HaSelect extends SelectBase { | ||
bramkragten marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // @ts-ignore | ||
| @property({ type: Boolean }) public icon?: boolean; | ||
|
|
||
| protected override renderLeadingIcon() { | ||
| if (!this.icon) { | ||
| return nothing; | ||
| } | ||
|
|
||
| return html`<span class="mdc-select__icon" | ||
| ><slot name="icon"></slot | ||
| ></span>`; | ||
| } | ||
|
|
||
| static override styles = [styles]; | ||
|
|
||
| connectedCallback() { | ||
| super.connectedCallback(); | ||
| window.addEventListener("translations-updated", this._translationsUpdated); | ||
| } | ||
|
|
||
| disconnectedCallback() { | ||
| super.disconnectedCallback(); | ||
| window.removeEventListener( | ||
| "translations-updated", | ||
| this._translationsUpdated | ||
| ); | ||
| } | ||
|
|
||
| private _translationsUpdated = debounce(async () => { | ||
| await nextRender(); | ||
| this.layoutOptions(); | ||
| }, 500); | ||
| } | ||
| declare global { | ||
| interface HTMLElementTagNameMap { | ||
| "ha-select": HaSelect; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.