Fix disabled users picker (#19590)

fix disabled users picker
This commit is contained in:
Bram Kragten 2024-01-31 16:26:37 +01:00 committed by GitHub
parent ed888200f9
commit c97c3f2fc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -24,6 +24,8 @@ class HaUsersPickerLight extends LitElement {
@property({ attribute: false })
public users?: User[];
@property({ type: Boolean }) public disabled = false;
protected firstUpdated(changedProps) {
super.firstUpdated(changedProps);
if (this.users === undefined) {
@ -57,6 +59,7 @@ class HaUsersPickerLight extends LitElement {
this.users,
notSelectedUsers
)}
.disabled=${this.disabled}
@value-changed=${this._userChanged}
></ha-user-picker>
<ha-icon-button
@ -78,7 +81,7 @@ class HaUsersPickerLight extends LitElement {
this.hass!.localize("ui.components.user-picker.add_user")}
.hass=${this.hass}
.users=${notSelectedUsers}
.disabled=${!notSelectedUsers?.length}
.disabled=${this.disabled || !notSelectedUsers?.length}
@value-changed=${this._addUser}
></ha-user-picker>
`;