UNPKG

@netgrif/components-core

Version:

Netgrif Application engine frontend core Angular library

53 lines (52 loc) 2.68 kB
import { OnDestroy } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; import { Case } from '../../resources/interface/case'; import { NextGroupService } from './next-group.service'; import * as i0 from "@angular/core"; /** * This service to the groups that are "active" for the logged user. * * The meaning of "active" can wary from application to application. And this service provides the utility to track this state. * * The active groups are assumed to be a subset of the groups the logged user is a member of, * but this assumption is not enforced nor checked. * * If at most one group can be active at a time, this service provides utility methods to access this group directly. * * The groups are assumed to be instances of the engine group process, this is never checked nor enforced. * * In the default implementation the initially active groups are all the groups the logged user is a member of. */ export declare class ActiveGroupService implements OnDestroy { protected _groupService: NextGroupService; protected _activeGroups$: BehaviorSubject<Array<Case>>; private _groupSub; constructor(_groupService: NextGroupService); ngOnDestroy(): void; /** * In the default implementation this stream copies the values of the [memberGroups$]{@link NextGroupService#memberGroups$} stream * of the {@link NextGroupService}. Whenever the copies stream emits, the underlying stream in this class emits the same value. * * @returns an Observable of all the groups that are currently active */ get activeGroups$(): Observable<Array<Case>>; get activeGroups(): Array<Case>; set activeGroups(activeGroups: Array<Case>); /** * @returns an Observable containing the first element of the [activeGroups$]{@link ActiveGroupService#activeGroups$} observable, * or `undefined` if the contained array is empty */ get activeGroup$(): Observable<Case | undefined>; /** * @returns the first element of the [activeGroups]{@link ActiveGroupService#activeGroups} array, or `undefined` if the array is empty */ get activeGroup(): Case | undefined; /** * Emits a new array into the [activeGroups$]{@link ActiveGroupService#activeGroups$} observable, that contains only * the provided {@link Case} object. If `undefined` is passed as argument, an empty array will be pushed into the observable. * @param activeGroup the new active group case reference */ set activeGroup(activeGroup: Case); static ɵfac: i0.ɵɵFactoryDeclaration<ActiveGroupService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ActiveGroupService>; }