File

src/lib/components/master-page/master-page.component.ts

Description

Angular Component for the MasterPage Control.

Extends

ControlComponent

Implements

AfterViewInit

Metadata

Index

Properties
Methods

Constructor

constructor(wmService: WebMapService, refChange: ChangeDetectorRef, render2: Renderer2, elem: ElementRef, pRendererService: PagesRendererService)

Creates an instance of MasterPageComponent.

Parameters :
Name Type Optional
wmService WebMapService No
refChange ChangeDetectorRef No
render2 Renderer2 No
elem ElementRef No
pRendererService PagesRendererService No

Methods

initializeContainers
initializeContainers(page: any)

Method to be overwritten with the container initialization.

Parameters :
Name Type Optional
page any No
Returns : void
ngAfterViewInit
ngAfterViewInit()

AfterViewInit lifecycle hook.

Returns : void
setContext
setContext()

Sets the context for the child page if available.

Returns : void

Properties

childModel
Type : any

Child model to send as context.

container
Type : ContainerComponent
Decorators :
@ViewChild(ContainerComponent)

Container reference.

initializeEvent
Type : EventEmitter<any>
Default value : new EventEmitter<any>()

Component is initialized event emitter.

import {
  AfterViewInit,
  ChangeDetectionStrategy,
  ChangeDetectorRef,
  Component,
  ElementRef,
  EventEmitter,
  Renderer2,
  ViewChild
} from '@angular/core';
import { WebMapService } from '@mobilize/angularclient';
import { ContainerComponent } from '@mobilize/base-components';
import { ControlComponent } from '@mobilize/winforms-components';
import { PagesRendererService } from '../../services';

/**
 * Angular Component for the MasterPage Control.
 *
 * @export
 * @class MasterPageComponent
 * @extends {ControlComponent}
 * @implements {AfterViewInit}
 */
@Component({
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: ''
})
export class MasterPageComponent
  extends ControlComponent
  implements AfterViewInit
{
  /**
   * Container reference.
   *
   * @type {ContainerComponent}
   * @memberof MasterPageComponent
   */
  @ViewChild(ContainerComponent)
  container!: ContainerComponent;

  /**
   * Component is initialized event emitter.
   *
   * @type {EventEmitter<any>}
   * @memberof MasterPageComponent
   */
  initializeEvent: EventEmitter<any> = new EventEmitter<any>();

  /**
   * Child model to send as context.
   *
   * @type {*}
   * @memberof MasterPageComponent
   */
  childModel: any;

  /**
   * Creates an instance of MasterPageComponent.
   * @param {WebMapService} wmService
   * @param {ChangeDetectorRef} refChange
   * @param {Renderer2} render2
   * @param {ElementRef} elem
   * @param {PagesRendererService} pRendererService
   * @memberof MasterPageComponent
   */
  constructor(
    private wmService: WebMapService,
    private refChange: ChangeDetectorRef,
    private render2: Renderer2,
    private elem: ElementRef,
    private pRendererService: PagesRendererService
  ) {
    super(refChange, render2, elem);
  }

  /**
   * Method to be overwritten with the container initialization.
   *
   * @param {*} page
   * @memberof MasterPageComponent
   */
  /* c8 ignore next 3 */
  initializeContainers(page: any): void {
    this.setContext();
  }

  /**
   * Sets the context for the child page if available.
   *
   * @memberof MasterPageComponent
   */
  setContext(): void {
    /* c8 ignore else */
    if (this.model?.Parent) {
      this.childModel = this.wmService.core.getModel(this.model.Parent);
    }
  }

  /**
   * AfterViewInit lifecycle hook.
   *
   * @memberof MasterPageComponent
   */
  ngAfterViewInit() {
    this.pRendererService.loadPages(this.container, this);
    setTimeout(() => {
      this.initializeEvent.emit(this);
    }, 0);
  }
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""