File

projects/i-components/src/lib/components/outlook-bar-popup/outlook-bar-popup.component.ts

Description

Angular Component for the OutlookBarPopup.

Implements

AfterContentInit

Metadata

changeDetection ChangeDetectionStrategy.OnPush
selector wm-outlook-bar-popup
styleUrls ./outlook-bar-popup.component.scss
templateUrl ./outlook-bar-popup.component.html

Index

Properties
Methods
HostBindings

Constructor

constructor(cd: ChangeDetectorRef, element: ElementRef)

Creates a new instance of OutlookBarPopupComponent component.

Parameters :
Name Type Optional
cd ChangeDetectorRef No
element ElementRef No

HostBindings

style.height
Type : string

Binding to set the height of the container

style.left
Type : string

Binding to position the popup

style.top
Type : string

Binding to position the popup

Methods

calcPositioning
calcPositioning()

Based on the Outlookbar naviagtion pane positiong, sets left, top and height to position the container.

Returns : void
detectChanges
detectChanges()

Trigger a new detectChange.

Returns : void
ngAfterContentInit
ngAfterContentInit()

Angular lifecycle.

Returns : void

Properties

dynamicTemplate
Type : any

Dynamic template

Public element
Type : ElementRef
height
Type : string
Decorators :
@HostBinding('style.height')

Binding to set the height of the container

left
Type : string
Decorators :
@HostBinding('style.left')

Binding to position the popup

outlookBarItem
Type : any

OulookBar item template

outlookBarRef
Type : Element

Oulookbar element reference

templateContext
Type : any

Dynamic template context

top
Type : string
Decorators :
@HostBinding('style.top')

Binding to position the popup

import {
  ChangeDetectionStrategy,
  Component,
  AfterContentInit,
  ChangeDetectorRef,
  HostBinding,
  ElementRef,
} from '@angular/core';

/**
 * Angular Component for the OutlookBarPopup.
 *
 * @export
 * @class OutlookBarPopupComponent
 * @implements {AfterContentInit}
 */
@Component({
  selector: 'wm-outlook-bar-popup',
  templateUrl: './outlook-bar-popup.component.html',
  styleUrls: ['./outlook-bar-popup.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class OutlookBarPopupComponent implements AfterContentInit {
  /**
   * Binding to position the popup
   *
   * @memberof OutlookBarPopupComponent
   */
  @HostBinding('style.top')
  top: string;

  /**
   * Binding to position the popup
   *
   * @memberof OutlookBarPopupComponent
   */
  @HostBinding('style.left')
  left: string;

  /**
   * Binding to set the height of the container
   *
   * @memberof OutlookBarPopupComponent
   */
  @HostBinding('style.height')
  height: string;

  /**
   * Oulookbar element reference
   *
   * @type {Element}
   * @memberof OutlookBarPopupComponent
   */
  outlookBarRef: Element;

  /**
   * Dynamic template
   *
   * @type {*}
   * @memberof OutlookBarPopupComponent
   */
  dynamicTemplate: any;

  /**
   * Dynamic template context
   *
   * @type {*}
   * @memberof OutlookBarPopupComponent
   */
  templateContext: any;

  /**
   * OulookBar item template
   *
   * @type {*}
   * @memberof OutlookBarPopupComponent
   */
  outlookBarItem: any;

  /**
   * Creates a new instance of OutlookBarPopupComponent component.
   *
   * @param {ChangeDetectorRef} cd
   * @param {ElementRef} element
   * @memberof OutlookBarPopupComponent
   */
  /* istanbul ignore next */
  constructor(private cd: ChangeDetectorRef, public element: ElementRef) {}

  /**
   * Angular lifecycle.
   *
   * @type {void}
   * @memberof OutlookBarPopupComponent
   */
  ngAfterContentInit(): void {
    this.calcPositioning();
  }

  /**
   * Based on the Outlookbar naviagtion pane positiong, sets left, top and height to position the container.
   *
   * @type {void}
   * @memberof OutlookBarPopupComponent
   */
  calcPositioning(): void {
    if (!this.outlookBarRef) return;
    const outlookBarRect = this.outlookBarRef.getBoundingClientRect();
    this.top = outlookBarRect.top + 'px';
    this.left = outlookBarRect.right + 3 + 'px';
    this.height = outlookBarRect.height + 'px';
  }

  /**
   * Trigger a new detectChange.
   *
   * @type {void}
   * @memberof OutlookBarPopupComponent
   */
  detectChanges(): void {
    this.cd.detectChanges();
  }
}
<ng-container>
  <ng-container *ngIf="dynamicTemplate">
    <ng-container *ngTemplateOutlet="dynamicTemplate; context: templateContext">
    </ng-container>
  </ng-container>
  <ng-container *ngIf="!dynamicTemplate">
    <ng-container *ngTemplateOutlet="outlookBarItem"> </ng-container>
  </ng-container>
</ng-container>

./outlook-bar-popup.component.scss

@import '../../scss/variables';

:host {
  resize: horizontal;
  overflow-x: auto;
  position: fixed;
  border-radius: $overlay-border-radius;
  border: $overlay-border;
  box-sizing: border-box;
  background-color: $outlookBar-default-background;
  padding: $outlookBar-popup-padding;
  height: 100%;
  min-width: max-content;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""