make help mode service optional when help module is not initialized
This commit is contained in:
parent
66450fc194
commit
0fe38910be
@ -1,4 +1,4 @@
|
||||
import { Directive, ElementRef, Input, OnInit, Renderer2 } from '@angular/core';
|
||||
import { Directive, ElementRef, Input, OnInit, Optional, Renderer2 } from '@angular/core';
|
||||
import { HelpModeService, ScrollableParentView } from './help-mode.service';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@ -15,14 +15,14 @@ export class HelpModeDirective implements OnInit {
|
||||
constructor(
|
||||
private readonly _elementRef: ElementRef,
|
||||
private readonly _renderer: Renderer2,
|
||||
private readonly _helpModeService: HelpModeService,
|
||||
@Optional() private readonly _helpModeService: HelpModeService,
|
||||
private readonly _router: Router,
|
||||
) {
|
||||
this._path = this._router.url.split('/').pop() as string;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.elementName) {
|
||||
if (this.elementName && this._helpModeService) {
|
||||
this._createHelperElement();
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
(mouseenter)="itemMouseEnterFn && itemMouseEnterFn(entity)"
|
||||
(mouseleave)="itemMouseLeaveFn && itemMouseLeaveFn(entity)"
|
||||
*ngIf="itemMouseEnterFn || itemMouseLeaveFn; else withoutMouseEvents"
|
||||
[class.help-mode]="helpModeService.isHelpModeActive$ | async"
|
||||
[class.help-mode]="helpModeService?.isHelpModeActive$ | async"
|
||||
[id]="'item-' + entity.id"
|
||||
[ngClass]="getTableItemClasses(entity)"
|
||||
[routerLink]="entity.routerLink"
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
<ng-template #withoutMouseEvents>
|
||||
<div
|
||||
[class.help-mode]="helpModeService.isHelpModeActive$ | async"
|
||||
[class.help-mode]="helpModeService?.isHelpModeActive$ | async"
|
||||
[id]="'item-' + entity.id"
|
||||
[ngClass]="getTableItemClasses(entity)"
|
||||
[routerLink]="entity.routerLink"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @angular-eslint/prefer-on-push-component-change-detection */
|
||||
import { AfterViewInit, Component, forwardRef, HostListener, Inject, Input, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { AfterViewInit, Component, forwardRef, HostListener, Inject, Input, OnDestroy, Optional, ViewChild } from '@angular/core';
|
||||
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
||||
import { delay, tap } from 'rxjs/operators';
|
||||
import { AutoUnsubscribe, trackByFactory } from '../../utils';
|
||||
@ -35,7 +35,7 @@ export class TableContentComponent<Class extends IListable<PrimaryKey>, PrimaryK
|
||||
constructor(
|
||||
@Inject(forwardRef(() => ListingComponent)) readonly listingComponent: ListingComponent<Class>,
|
||||
readonly listingService: ListingService<Class>,
|
||||
readonly helpModeService: HelpModeService,
|
||||
@Optional() readonly helpModeService: HelpModeService,
|
||||
) {
|
||||
super();
|
||||
this.addSubscription = this.listingComponent.noContent$.subscribe(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user