Fix select issues (#13839)

This commit is contained in:
Bram Kragten 2022-09-22 15:19:59 +02:00 committed by GitHub
parent 8e245c8a83
commit 7336c1280f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,7 @@ export class HaSelectSelector extends LitElement {
); );
if (!this.selector.select.custom_value && this._mode === "list") { if (!this.selector.select.custom_value && this._mode === "list") {
if (!this.selector.select.multiple || this.required) { if (!this.selector.select.multiple) {
return html` return html`
<div> <div>
${this.label} ${this.label}
@ -64,7 +64,8 @@ export class HaSelectSelector extends LitElement {
return html` return html`
<div> <div>
${this.label}${options.map( ${this.label}
${options.map(
(item: SelectOption) => html` (item: SelectOption) => html`
<ha-formfield .label=${item.label}> <ha-formfield .label=${item.label}>
<ha-checkbox <ha-checkbox
@ -114,7 +115,7 @@ export class HaSelectSelector extends LitElement {
.required=${this.required && !value.length} .required=${this.required && !value.length}
.value=${this._filter} .value=${this._filter}
.items=${options.filter( .items=${options.filter(
(item) => !item.disabled && !this.value?.includes(item.value) (option) => !option.disabled && !value?.includes(option.value)
)} )}
@filter-changed=${this._filterChanged} @filter-changed=${this._filterChanged}
@value-changed=${this._comboBoxValueChanged} @value-changed=${this._comboBoxValueChanged}
@ -290,6 +291,9 @@ export class HaSelectSelector extends LitElement {
ha-formfield { ha-formfield {
display: block; display: block;
} }
mwc-list-item[disabled] {
--mdc-theme-text-primary-on-background: var(--disabled-text-color);
}
`; `;
} }