update listing and entities map services
This commit is contained in:
parent
64d1cb8be6
commit
b638c5f074
@ -15,11 +15,11 @@ export class ListingService<Class extends IListable<PrimaryKey>, PrimaryKey exte
|
||||
readonly areAllSelected$: Observable<boolean>;
|
||||
readonly areSomeSelected$: Observable<boolean>;
|
||||
readonly notAllSelected$: Observable<boolean>;
|
||||
readonly selected$: Observable<(string | number)[]>;
|
||||
readonly selected$: Observable<PrimaryKey[]>;
|
||||
readonly selectedEntities$: Observable<Class[]>;
|
||||
readonly selectedLength$: Observable<number>;
|
||||
private _displayed: Class[] = [];
|
||||
private readonly _selected$ = new BehaviorSubject<(string | number)[]>([]);
|
||||
private readonly _selected$ = new BehaviorSubject<PrimaryKey[]>([]);
|
||||
|
||||
constructor(
|
||||
protected readonly _filterService: FilterService,
|
||||
@ -46,7 +46,7 @@ export class ListingService<Class extends IListable<PrimaryKey>, PrimaryKey exte
|
||||
return this._entitiesService.all.filter(a => selectedIds.includes(a.id));
|
||||
}
|
||||
|
||||
get selectedIds(): (string | number)[] {
|
||||
get selectedIds(): PrimaryKey[] {
|
||||
return this._selected$.getValue();
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ export abstract class EntitiesMapService<Interface, Class extends Entity<Interfa
|
||||
}
|
||||
|
||||
delete(keys: List<Id>): void;
|
||||
delete(key: Id, entity: PrimaryKey | Class): void;
|
||||
delete(key: Id, entityId: PrimaryKey | Class): void;
|
||||
delete(keys: List<Id> | Id, entity?: PrimaryKey | Class): void {
|
||||
if (isArray(keys)) {
|
||||
return keys.forEach(key => this._map.delete(key));
|
||||
@ -29,7 +29,7 @@ export abstract class EntitiesMapService<Interface, Class extends Entity<Interfa
|
||||
if (entity) {
|
||||
const entityId = typeof entity === 'string' || typeof entity === 'number' ? entity : entity.id;
|
||||
const entities = this.get(keys).filter(entity => entity.id !== entityId);
|
||||
this.set(keys, entities);
|
||||
return this.set(keys, entities);
|
||||
}
|
||||
|
||||
console.error('entityId is null when deleting from EntitiesMapService');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user