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