File

src/lib/components/link-button/link-button.component.ts

Description

Angular Component for the LinkButton Component.

Extends

ControlComponent

Implements

OnInit WebControlComponent

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(wmService: WebMapService, refChange: ChangeDetectorRef, render2: Renderer2, elem: ElementRef, webComponents: WebComponentsService, bringTopServ1: BringTopService, baseValidatorService: WebFormsBaseValidatorService, defaultButtonService: DefaultButtonService)

Creates an instance of LinkButtonComponent.

Parameters :
Name Type Optional
wmService WebMapService No
refChange ChangeDetectorRef No
render2 Renderer2 No
elem ElementRef No
webComponents WebComponentsService No
bringTopServ1 BringTopService No
baseValidatorService WebFormsBaseValidatorService No
defaultButtonService DefaultButtonService No

Inputs

causesValidation
Type : boolean

Sets/gets the causesValidation property

validationGroup
Type : string

Sets/gets the validationGroup property

Outputs

OnClick
Type : EventEmitter<EventData>

Emitter of the OnClick event.

Methods

click
click(event: any)
Decorators :
@serverEvent('Click')

Triggers the OnClientClick and OnClick emitters.

Parameters :
Name Type Optional
event any No
Returns : void
ngOnInit
ngOnInit()

ngOnInit of AjaxModalPopUpExtenderComponent

Returns : void

Properties

causesValidationInternal
Default value : true

Property that indicates if the control causes a validation.

isClickStopped
Default value : false

Property that permit trigger onClick event.

Private validationGroupInternal
Type : string
Default value : ''

Property with the validation group.

Private webFormsIntercepted
Default value : false

Property that triggers the webForms validation.

Accessors

displayElementPanel
setdisplayElementPanel(value: ElementRef | null)

Sets the displayElement

Parameters :
Name Type Optional
value ElementRef | null No
Returns : void
validationGroup
getvalidationGroup()
setvalidationGroup(value: string)

Sets/gets the validationGroup property

Parameters :
Name Type Optional
value string No
Returns : void
causesValidation
getcausesValidation()
setcausesValidation(value: boolean)

Sets/gets the causesValidation property

Parameters :
Name Type Optional
value boolean No
Returns : void
import {
  ChangeDetectorRef,
  Component,
  ElementRef,
  EventEmitter,
  Input,
  OnInit,
  Optional,
  Output,
  Renderer2,
  ViewChild
} from '@angular/core';
import { WebMapService } from '@mobilize/angularclient';
import {
  BringTopService,
  dataTransfer,
  EventData,
  serverEvent
} from '@mobilize/base-components';
import {
  BaseValidatorService,
  ControlComponent,
  WebComponentsService
} from '@mobilize/winforms-components';
import { ErrorCodes, ExceptionHandlerClass } from '@mobilize/webmap-core';
import {
  DefaultButtonService,
  WebFormsBaseValidatorService
} from '../../services';
import { WebControlComponent } from '../../contracts';

/**
 * Angular Component for the LinkButton Component.
 *
 * @export
 * @class LinkButtonComponent
 * @extends {ControlComponent}
 */
@Component({
  selector: 'wm-link-button',
  templateUrl: './link-button.component.html',
  styleUrls: ['./link-button.component.scss'],
  inputs: ['model'],
  providers: [
    {
      provide: BaseValidatorService,
      useExisting: WebFormsBaseValidatorService
    }
  ]
})
@dataTransfer(['lnkBtn'])
@ExceptionHandlerClass(ErrorCodes.Winforms)
export class LinkButtonComponent
  extends ControlComponent
  implements OnInit, WebControlComponent
{
  /**
   * Property that indicates if the control causes a validation.
   *
   * @memberof LinkButtonComponent
   */
  causesValidationInternal = true;

  /**
   * Property with the validation group.
   *
   * @memberof LinkButtonComponent
   */
  private validationGroupInternal = '';

  /**
   * Property that triggers the webForms validation.
   *
   * @private
   * @memberof LinkButtonComponent
   */
  private webFormsIntercepted = false;

  /**
   * Property that permit trigger onClick event.
   */
  isClickStopped = false;

  /**
   * Creates an instance of LinkButtonComponent.
   * @param {WebMapService} wmService
   * @param {ChangeDetectorRef} refChange
   * @param {Renderer2} render2
   * @param {ElementRef} elem
   * @param {WebComponentsService} webComponents
   * @param {BringTopService} bringTopServ1
   * @param {WebFormsBaseValidatorService} baseValidatorService
   * @param {DefaultButtonService} defaultButtonService
   * @memberof LinkButtonComponent
   */
  constructor(
    private wmService: WebMapService,
    private refChange: ChangeDetectorRef,
    private render2: Renderer2,
    private elem: ElementRef,
    webComponents: WebComponentsService,
    @Optional() private bringTopServ1: BringTopService,
    private baseValidatorService: WebFormsBaseValidatorService,
    @Optional() private defaultButtonService: DefaultButtonService
  ) {
    super(refChange, render2, elem, webComponents, bringTopServ1);
  }

  /**
   * ngOnInit of AjaxModalPopUpExtenderComponent
   *
   * @memberof AjaxModalPopUpExtenderComponent
   */
  ngOnInit(): void {
    super.ngOnInit();
    /* c8 ignore start */
    this.defaultButtonService?.ClickEmittedNotification.subscribe(
      (event: EventData) => {
        if (event.args === this.id && this.displayElement !== undefined) {
          this.displayElement.focus();
          this.displayElement.click();
        }
      }
    ); /* c8 ignore stop */
  }

  /**
   * Sets the displayElement
   *
   * @memberof DropdownListComponent
   */
  @ViewChild('displayElement', { static: false })
  set displayElementPanel(value: ElementRef | null) {
    this.displayElement = value != null ? value.nativeElement : null;
  }

  /**
   * Emitter of the OnClick event.
   *
   * @memberof LinkButtonComponent
   */
  @Output()
  OnClick: EventEmitter<EventData> = new EventEmitter<EventData>();

  /**
   * Triggers the OnClientClick and OnClick emitters.
   *
   * @memberof LinkButtonComponent
   */
  @serverEvent('Click')
  click(event: any): void {
    this.webFormsIntercepted = this.causesValidation;
    /* c8 ignore else */
    if (!this.isClickStopped) {
      this.OnClick.emit(new EventData(event, this.id));
    }
  }

  /**
   * Sets/gets the validationGroup property
   *
   * @memberof LinkButtonComponent
   */
  @Input()
  set validationGroup(value: string) {
    this.validationGroupInternal = value;
  }

  get validationGroup() {
    return this.model.ValidationGroup ?? this.validationGroupInternal;
  }

  /**
   * Sets/gets the causesValidation property
   *
   * @memberof LinkButtonComponent
   */
  @Input()
  set causesValidation(value: boolean) {
    this.causesValidationInternal = value;
  }

  get causesValidation() {
    return this.model.CausesValidation ?? this.causesValidationInternal;
  }
}
<a #displayElement (click)='click($event)' href='javascript:window.scrollTo(0, 0)' *ngIf='model && visible'
   [ngClass]='class' wmControls [hostComponent]='this'> {{text}} </a>

./link-button.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""