autoselect + small fixes

This commit is contained in:
lotte
2019-11-18 11:24:01 +01:00
parent 3b4d8598d5
commit efc2c9933a
7 changed files with 17 additions and 15 deletions

View File

@@ -85,9 +85,7 @@ export class SelectableListService {
*/
isObjectSelected(id: string, object: ListableObject): Observable<boolean> {
return this.getSelectableList(id).pipe(
filter((state: SelectableListState) => hasValue(state)),
map((state: SelectableListState) => isNotEmpty(state.selection) && hasValue(state.selection.find((selected) => selected.equals(object)))),
startWith(false),
map((state: SelectableListState) => hasValue(state) && isNotEmpty(state.selection) && hasValue(state.selection.find((selected) => selected.equals(object)))),
distinctUntilChanged()
);
}