projects/i-components/src/lib/components/grid-column-definitions/grid-column-definitions.component.ts
Angular Component for the ColumnDefinitionCollection.
selector | wm-grid-column-definitions |
styleUrls | ./grid-column-definitions.component.scss |
templateUrl | ./grid-column-definitions.component.html |
Properties |
|
Methods |
Inputs |
Accessors |
constructor(injector: Injector, injectedModel: GridColumnDefinitions)
|
|||||||||
Creates an instance of GridColumnDefinitionsComponent.
Parameters :
|
model | |
Type : GridColumnDefinitions
|
|
Object with properties and events for the GridColumnDefinitions. |
ngOnInit |
ngOnInit()
|
Angular lifecycle.
Returns :
void
|
items |
Type : QueryList<GridColumnDefinitionComponent>
|
Decorators :
@ContentChildren(GridColumnDefinitionComponent)
|
List of GridColumnDefinition Components inside the GridColumnDefinitions Component. |
model |
Type : GridColumnDefinitions
|
Decorators :
@Input()
|
Object with properties and events for the GridColumnDefinitions. |
Private modelProxy |
Type : GridColumnDefinitions
|
Default value : ModelProxy.create<GridColumnDefinitions>()
|
ModelProxy is a copy of the model, used on the component initial building to prevent crashes with external bindings. |
itemsArray |
getitemsArray()
|
Returns the list of GridColumnDefinition Components or Objects(if it was set using the model input). |
import {
Component,
ContentChildren,
Injector,
Input,
OnInit,
Optional,
QueryList,
} from '@angular/core';
import {
GridColumnDefinitions,
GridModel,
ModelProxy,
} from '@mobilize/wms-framework';
import { GridColumnDefinitionComponent } from '../grid-column-definition/grid-column-definition.component';
/**
* Angular Component for the ColumnDefinitionCollection.
*
* @export
* @class GridColumnDefinitionsComponent
* @implements {OnInit}
*/
@Component({
selector: 'wm-grid-column-definitions',
templateUrl: './grid-column-definitions.component.html',
styleUrls: ['./grid-column-definitions.component.scss'],
})
export class GridColumnDefinitionsComponent implements OnInit {
/**
* Object with properties and events for the GridColumnDefinitions.
*
* @type {GridColumnDefinitions}
* @memberof GridColumnDefinitionsComponent
*/
@Input()
model: GridColumnDefinitions;
/**
* List of GridColumnDefinition Components inside the GridColumnDefinitions Component.
*
* @type {QueryList<GridColumnDefinitionComponent>}
* @memberof GridColumnDefinitionsComponent
*/
@ContentChildren(GridColumnDefinitionComponent)
items: QueryList<GridColumnDefinitionComponent>;
/**
* ModelProxy is a copy of the model, used on the component initial building to prevent crashes with external bindings.
*
* @private
* @type {GridColumnDefinitions}
* @memberof GridColumnDefinitionsComponent
*/
private modelProxy: GridColumnDefinitions =
ModelProxy.create<GridColumnDefinitions>();
/**
* Creates an instance of GridColumnDefinitionsComponent.
*
* @param {Injector} injector
* @param {GridColumnDefinitions} [injectedModel=null]
* @memberof GridColumnDefinitionsComponent
*/
/* istanbul ignore next */
constructor(
private injector: Injector,
@Optional() protected injectedModel: GridColumnDefinitions = null
) {
this.model = injectedModel;
}
/**
* Returns the list of GridColumnDefinition Components or Objects(if it was set using the model input).
*
* @readonly
* @memberof GridColumnDefinitionsComponent
*/
get itemsArray() {
/* istanbul ignore next */
return this.items.length > 0
? this.items.toArray()
: this.model.internalArray;
}
/**
* Angular lifecycle.
*
* @memberof GridColumnDefinitionsComponent
*/
ngOnInit(): void {
this.model =
this.model ||
this.injectedModel ||
new GridColumnDefinitions(new GridModel());
ModelProxy.copy(this.modelProxy, this.model);
this.modelProxy = this.model;
}
}
<div></div>
./grid-column-definitions.component.scss