File

src/lib/components/template-field/template-field.component.ts

Description

Angular Component for the TemplateField Control.

Extends

DataControlFieldComponent

Metadata

Index

Properties
Methods
Inputs

Constructor

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

Creates an instance of TemplateFieldComponent.

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

Inputs

headerText
Type : string

Gets/sets the headerText property.

sortExpression
Type : string

Gets/sets the sortExpression property.

visible
Type : boolean

Gets/sets the visible property.

Methods

setItemTemplateModels
setItemTemplateModels(controlsIds: any[])

Resolves and sets the models for each child item in the ItemTemplate.

Parameters :
Name Type Optional
controlsIds any[] No
Returns : void
isBindedEvent
isBindedEvent(event: string)

Override the isBindedEvent to get the event from the Field model

Parameters :
Name Type Optional
event string No
Returns : boolean

{boolean}

Properties

itemTemplate
Type : TemplateRef<any>
Decorators :
@ContentChild('ItemTemplate')

ItemTemplate reference.

itemTemplateModels
Type : any[]
Default value : []

ItemTemplate children models.

Private headerTextInternal
Type : string
Default value : ''

Property to save the headerText value.

Private sortExpressionInternal
Type : string
Default value : ''

Property to save the sortExpression value.

Private visibleInternal
Default value : true

Property to save the visible value.

import {
  ChangeDetectorRef,
  Component,
  ContentChild,
  ElementRef,
  Optional,
  Renderer2,
  TemplateRef
} from '@angular/core';
import { dataTransfer, BringTopService } from '@mobilize/base-components';
import { WebMapService } from '@mobilize/angularclient';
import { ErrorCodes, ExceptionHandlerClass } from '@mobilize/webmap-core';
import { WebComponentsService } from '@mobilize/winforms-components';
import { DataControlFieldComponent } from '../data-control-field/data-control-field.component';

/**
 * Angular Component for the TemplateField Control.
 *
 * @export
 * @class TemplateFieldComponent
 * @extends {DataControlFieldComponent}
 */
@Component({
  selector: 'wm-template-field',
  templateUrl: './template-field.component.html',
  styleUrls: ['./template-field.component.scss'],
  providers: [
    { provide: DataControlFieldComponent, useExisting: TemplateFieldComponent }
  ],
  inputs: ['model']
})
@dataTransfer(['tmpltfld'])
@ExceptionHandlerClass(ErrorCodes.Winforms)
export class TemplateFieldComponent extends DataControlFieldComponent {
  /**
   * ItemTemplate reference.
   *
   * @type {TemplateRef<any>}
   * @memberof TemplateFieldComponent
   */
  @ContentChild('ItemTemplate')
  itemTemplate!: TemplateRef<any>;

  /**
   * ItemTemplate children models.
   *
   * @type {any[]}
   * @memberof TemplateFieldComponent
   */
  itemTemplateModels: any[] = [];

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

  /**
   * Resolves and sets the models for each child item in the ItemTemplate.
   *
   * @param {any[]} controlsIds. Collection of {"name": "id"} objects to resolve the models.
   * @memberof TemplateFieldComponent
   */
  setItemTemplateModels(controlsIds: any[]): void {
    this.itemTemplateModels = [];
    controlsIds.forEach((iteration: any) => {
      const iterationKeys = Object.keys(iteration);
      const iterationModels: any = {};
      iterationKeys.forEach((controlName) => {
        iterationModels[controlName] = this.wmService.core.getModel(
          iteration[controlName]
        );
      });
      this.itemTemplateModels.push(iterationModels);
    });
  }
}
<ng-content></ng-content>

./template-field.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""