1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-13 06:54:07 +00:00

fix option, select, and chip-select

This commit is contained in:
Vicki League
2025-06-25 12:17:16 -04:00
parent e25d7cf45e
commit 7f97c4aeb6
6 changed files with 33 additions and 19 deletions

View File

@@ -77,7 +77,14 @@ export class SelectComponent<T> implements BitFormFieldControl, ControlValueAcce
if (value == null || value.length == 0) {
return;
}
this.items.set(value.toArray());
this.items.set(
value.toArray().map((c) => ({
icon: c.icon(),
value: c.value(),
label: c.label(),
disabled: c.disabled(),
})),
);
}
@HostBinding("class") protected classes = ["tw-block", "tw-w-full", "tw-h-full"];
@@ -120,13 +127,13 @@ export class SelectComponent<T> implements BitFormFieldControl, ControlValueAcce
/**Implemented as part of NG_VALUE_ACCESSOR */
protected onChange(option: Option<T> | null) {
this.selectedValue.set(option?.value());
this.selectedValue.set(option?.value);
if (!this.notifyOnChange) {
return;
}
this.notifyOnChange(option?.value());
this.notifyOnChange(option?.value);
}
/**Implemented as part of NG_VALUE_ACCESSOR */
@@ -182,7 +189,7 @@ export class SelectComponent<T> implements BitFormFieldControl, ControlValueAcce
}
private findSelectedOption(items: Option<T>[], value: T): Option<T> | undefined {
return items.find((item) => item.value() === value);
return items.find((item) => item.value === value);
}
/**Emits the closed event. */