File

projects/i-components/src/lib/components/data-grid-template-column/data-grid-template-column.component.ts

Extends

BaseDataGridColumnsComponent

Implements

OnInit AfterContentInit OnDestroy

Metadata

providers { provide: BaseDataGridColumnsComponent, useExisting: forwardRef(() => DataGridTemplateColumnComponent), }
selector wm-data-grid-template-column
styleUrls ./data-grid-template-column.component.scss

Index

Properties
Methods
Inputs

Constructor

constructor(injector: Injector, injectedModel: DataGridTemplateColumnModel)

Creates an instance of DataGridTemplateColumnComponent.

Parameters :
Name Type Optional
injector Injector No
injectedModel DataGridTemplateColumnModel No

Inputs

model
Type : DataGridTemplateColumnModel

Object with properties and events for the DataGridTemplateColumnComponent.

canUserReorder
Type : boolean
canUserResize
Type : boolean
canUserSort
Type : boolean
header
Type : any
isReadOnly
Type : boolean

sets the readonly property of the datagrid cells

maxWidth
Type : any
minWidth
Type : any
sortMemberPath
Type : string
visibility
Type : boolean

sets the visibility property of the column

width
Type : DataGridLengthModel | string

Gets/sets the width of the column.

Methods

ngAfterContentInit
ngAfterContentInit()

Angular lifecycle

Returns : void
ngOnDestroy
ngOnDestroy()

Angular lifecycle hook.

Returns : void
ngOnInit
ngOnInit()

Angular lifecycle

Returns : void
Protected applyPendingResourceAssignment
applyPendingResourceAssignment(model: DependencyObject)
Inherited from BaseWrapperComponent

Apply pending resource assignments

Parameters :
Name Type Optional
model DependencyObject No
Returns : void
Protected checkForStaticResourceReference
checkForStaticResourceReference(property: DependencyProperty, obj: any)
Inherited from BaseWrapperComponent

Verifies if the given value is a resource value

Parameters :
Name Type Optional Description
property DependencyProperty No

property to assign

obj any No

static resource reference candidate

Returns : boolean

{boolean} true if the value was assigned

Protected resolveResource
resolveResource(key: any)
Inherited from BaseWrapperComponent

Resolve the resource in the current context

Parameters :
Name Type Optional
key any No
Returns : any

Properties

cellEditingTemplate
Type : QueryList<TemplateRef<any>>
Decorators :
@ContentChildren('cellEditingTemplate', {descendants: false})

Template for the edit mode of the cells

cellTemplate
Type : QueryList<TemplateRef<any>>
Decorators :
@ContentChildren('cellTemplate', {descendants: false})

Template for the non edit mode of the cells

model
Type : DataGridTemplateColumnModel
Decorators :
@Input()

Object with properties and events for the DataGridTemplateColumnComponent.

Protected modelProxy
Type : DataGridTemplateColumnModel
Default value : ModelProxy.create<DataGridTemplateColumnModel>()

ModelProxy is a copy of the model, used on the component initial building to prevent crashes with external bindings.

Protected pendingResourceValues
Type : Array<>
Inherited from BaseWrapperComponent

Pending resource assignments

These assignments are performed when the model is available

Protected pendingSetValuesColumns
Type : Array<>
Default value : []
Inherited from BaseWrapperComponent

A collection of pending values to assign to the model

import {
  forwardRef,
  AfterContentInit,
  Component,
  ContentChildren,
  Injector,
  Input,
  OnInit,
  Optional,
  QueryList,
  TemplateRef,
  OnDestroy,
} from '@angular/core';
import {
  DataGridTemplateColumnModel,
  DataTemplate,
  ModelProxy,
} from '@mobilize/wms-framework';
import { BaseDataGridColumnsComponent } from '../data-grid-columns/base-data-grid-columns/base-data-grid-columns.component';

@Component({
  selector: 'wm-data-grid-template-column',
  template: '',
  styleUrls: ['./data-grid-template-column.component.scss'],
  providers: [
    {
      provide: BaseDataGridColumnsComponent,
      useExisting: forwardRef(() => DataGridTemplateColumnComponent),
    },
  ],
})
export class DataGridTemplateColumnComponent
  extends BaseDataGridColumnsComponent
  implements OnInit, AfterContentInit, OnDestroy
{
  /**
   * Template for the edit mode of the cells
   *
   * @type {QueryList<any>}
   * @memberof DataGridTemplateColumnComponent
   */
  @ContentChildren('cellEditingTemplate', { descendants: false })
  cellEditingTemplate: QueryList<TemplateRef<any>>;

  /**
   * Template for the non edit mode of the cells
   *
   * @type {QueryList<any>}
   * @memberof DataGridTemplateColumnComponent
   */
  @ContentChildren('cellTemplate', { descendants: false })
  cellTemplate: QueryList<TemplateRef<any>>;

  /**
   * Object with properties and events for the DataGridTemplateColumnComponent.
   *
   * @type {DataGridTemplateColumnModel}
   * @memberof DataGridTemplateColumnComponent
   */
  @Input()
  model: DataGridTemplateColumnModel;

  /**
   * ModelProxy is a copy of the model, used on the component initial building to prevent crashes with external bindings.
   *
   * @private
   * @type {DataGridTemplateColumnModel}
   * @memberof DataGridTemplateColumnComponent
   */
  protected modelProxy: DataGridTemplateColumnModel =
    ModelProxy.create<DataGridTemplateColumnModel>();

  /**
   * Creates an instance of DataGridTemplateColumnComponent.
   *
   * @param {Injector} injector
   * @param {DataGridTemplateColumnModel} [injectedModel=null]
   * @memberof DataGridTemplateColumnComponent
   */
  constructor(
    private injector: Injector,
    @Optional() protected injectedModel: DataGridTemplateColumnModel = null
  ) {
    super();
    this.model = injectedModel;
  }

  /**
   * Angular lifecycle
   *
   * @memberof DataGridTemplateColumnComponent
   */
  ngOnInit() {
    this.model =
      this.model || this.injectedModel || new DataGridTemplateColumnModel();
    ModelProxy.copy(this.modelProxy, this.model);
    this.modelProxy = this.model;
  }

  /**
   * Angular lifecycle
   *
   * @memberof DataGridTemplateColumnComponent
   */
  ngAfterContentInit() {
    const cellEdTemp = this.cellEditingTemplate.toArray()[0];
    if (cellEdTemp) {
      this.model.CellEditingTemplate = new DataTemplate(cellEdTemp);
    }

    const cellTemp = this.cellTemplate.toArray()[0];
    if (cellTemp) {
      this.model.CellTemplate = new DataTemplate(cellTemp);
    }

    if (!this.model.Visibility) {
      this.model.MaxWidth = 0;
    }
  }

  /**
   * Angular lifecycle hook.
   *
   * @memberof DataGridTemplateColumnComponent
   */
  ngOnDestroy(): void {}
}

./data-grid-template-column.component.scss

Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""