@netgrif/components-core
Version:
Netgrif Application engine frontend core Angular library
153 lines (152 loc) • 7.84 kB
TypeScript
import { EventEmitter, OnDestroy } from '@angular/core';
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
import { LoadingEmitter } from "../../../utility/loading-emitter";
import { Case } from "../../../resources/interface/case";
import { LoggerService } from "../../../logger/services/logger.service";
import { Page } from "../../../resources/interface/page";
import { CaseResourceService } from "../../../resources/engine-endpoint/case-resource.service";
import { I18nFieldValue } from "../../../data-fields/i18n-field/models/i18n-field-value";
import { TranslateService } from "@ngx-translate/core";
import { DynamicNavigationRouteProviderService } from "../../../routing/dynamic-navigation-route-provider/dynamic-navigation-route-provider.service";
import { RedirectService } from "../../../routing/redirect-service/redirect.service";
import { AccessService } from "../../../authorization/permission/access.service";
import { ActivatedRoute } from "@angular/router";
import { ConfigurationService } from "../../../configuration/configuration.service";
import { View } from "../../../../commons/schema";
import { MenuOrder, NavigationItem } from '../../model/navigation-configs';
import { UriNodeResource } from '../../model/uri-resource';
import { MenuItemClickEvent, MenuItemLoadedEvent } from '../../model/navigation-menu-events';
import { PathService } from "../../service/path.service";
import { UserService } from "../../../user/services/user.service";
import * as i0 from "@angular/core";
/**
* Service for managing navigation in double-drawer
* */
export declare class DoubleDrawerNavigationService implements OnDestroy {
protected _log: LoggerService;
protected _config: ConfigurationService;
protected _activatedRoute: ActivatedRoute;
protected _caseResourceService: CaseResourceService;
protected _accessService: AccessService;
protected _translateService: TranslateService;
protected _dynamicRoutingService: DynamicNavigationRouteProviderService;
protected _redirectService: RedirectService;
protected _pathService: PathService;
protected _userService: UserService;
/**
* List of displayed items on the left side
* */
protected _leftItems$: BehaviorSubject<Array<NavigationItem>>;
/**
* List of displayed items on the right side
* */
protected _rightItems$: BehaviorSubject<Array<NavigationItem>>;
/**
* List of hidden items
* */
protected _moreItems$: BehaviorSubject<Array<NavigationItem>>;
/**
* List of custom items in more menu
* */
protected _hiddenCustomItems$: BehaviorSubject<Array<NavigationItem>>;
/**
* List of custom items
* */
protected _childCustomViews: {
[uri: string]: {
[key: string]: NavigationItem;
};
};
protected itemsOrder: MenuOrder;
protected _leftLoading$: LoadingEmitter;
protected _rightLoading$: LoadingEmitter;
protected _nodeLoading$: LoadingEmitter;
protected _currentPathSubscription: Subscription;
/**
* Currently display uri
* Siblings of the node are on the left, children are on the right
*/
protected _currentPath: string;
private _fromResolver;
/**
* Currently selected navigation item
*/
protected _currentNavigationItem: NavigationItem | undefined;
protected defaultViewIcon: string;
protected customItemsInitialized: boolean;
protected hiddenCustomItemsInitialized: boolean;
protected itemClicked: EventEmitter<MenuItemClickEvent>;
protected itemLoaded: EventEmitter<MenuItemLoadedEvent>;
constructor(_log: LoggerService, _config: ConfigurationService, _activatedRoute: ActivatedRoute, _caseResourceService: CaseResourceService, _accessService: AccessService, _translateService: TranslateService, _dynamicRoutingService: DynamicNavigationRouteProviderService, _redirectService: RedirectService, _pathService: PathService, _userService: UserService);
ngOnDestroy(): void;
get canGoBackLoading$(): Observable<boolean>;
get currentPath(): string;
set currentPath(path: string);
set currentNavigationItem(item: NavigationItem | undefined);
protected resolveMenuItems(path: string): void;
get itemClicked$(): EventEmitter<MenuItemClickEvent>;
get itemLoaded$(): EventEmitter<MenuItemLoadedEvent>;
get rightItems$(): BehaviorSubject<Array<NavigationItem>>;
get leftItems$(): BehaviorSubject<Array<NavigationItem>>;
get moreItems$(): BehaviorSubject<Array<NavigationItem>>;
get hiddenCustomItems$(): BehaviorSubject<Array<NavigationItem>>;
get rightItems(): Array<NavigationItem>;
get leftItems(): Array<NavigationItem>;
get moreItems(): Array<NavigationItem>;
get hiddenCustomItems(): Array<NavigationItem>;
get leftLoading$(): LoadingEmitter;
get rightLoading$(): LoadingEmitter;
get nodeLoading$(): LoadingEmitter;
set fromResolver(value: boolean);
loadNavigationItems(node: UriNodeResource): void;
/**
* On home click, the current level is set to 0, and current parent is
* set to root node.
* */
onHomeClick(): void;
/**
* On back click, the parent is set to parent of left nodes, that will solve
* the right side menu (elements that were in left side, after backward
* navigation will be on the right side).
* Current level is set to a lower number in order to set the left side menu.
* */
onBackClick(): void;
/**
* On item click, the selected item's view is rendered (by routerLink). If the selected item has children items, the menu is updated
* and view, that is rendered is selected by the defined rule. The rule is: On first check for default view in children.
* On second check if the clicked item has a view. On third, pick any other children's view, else show nothing.
* */
onItemClick(item: NavigationItem): void;
/**
* Opens a view of the current right items in the menu by defined rule. The rule is: First, it checks whether a navigation
* item was clicked. Second, check for default view in children.
* Third check if the clicked item has a view. Fourth, pick any other children's view, else
* show nothing.
* */
openAvailableView(): void;
loadMoreItems(): void;
initializeCustomViewsOfView(view: View, viewConfigPath: string): void;
switchOrder(): void;
isAscending(): boolean;
protected loadLeftSide(): void;
protected loadRightSide(): void;
protected getItemCasesByIdsInOnePage(caseIds: string[]): Observable<Page<Case>>;
protected getItemCasesByIds(caseIds: string[], pageNumber: number, pageSize: string | number): Observable<Page<Case>>;
resolveItemCaseToNavigationItem(itemCase: Case): NavigationItem | undefined;
protected resolveCustomViewsInLeftSide(): void;
protected resolveCustomViewsInRightSide(): void;
protected resolveUriForChildViews(configPath: string, childView: View): void;
protected resolveHiddenMenuItemFromChildViews(configPath: string, childView: View): void;
protected getTranslation(value: I18nFieldValue): string;
getItemRoutingPath(itemCase: Case): string;
private processLeftItems;
/**
* Retrieves a case item based on the given path.
* @param {string} [path] - The identifier path to locate the specific case item. If undefined, it defaults to searching without a specific path.
* @return {Observable<Page<Case>>} An observable stream containing the page of case items which match the provided path.
*/
getItemCaseByPath(path?: string): Observable<Page<Case>>;
extractParentPath(path: string): string;
static ɵfac: i0.ɵɵFactoryDeclaration<DoubleDrawerNavigationService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<DoubleDrawerNavigationService>;
}