mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1329] Fix grid style in the activiti form (#2223)
* Fix form grid style * Tests
This commit is contained in:
committed by
Mario Romano
parent
f797e7df6a
commit
9e5b19e34c
@@ -19,6 +19,7 @@
|
||||
|
||||
import { AfterViewInit, Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { FormService } from './../../../services/form.service';
|
||||
import { FormFieldModel } from './../core/form-field.model';
|
||||
import { baseHost , WidgetComponent } from './../widget.component';
|
||||
import { ContainerWidgetComponentModel } from './container.widget.model';
|
||||
|
||||
@@ -48,4 +49,39 @@ export class ContainerWidgetComponent extends WidgetComponent implements OnInit,
|
||||
this.content = new ContainerWidgetComponentModel(this.field);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes column fields
|
||||
*/
|
||||
get fields(): FormFieldModel[] {
|
||||
const fields = [];
|
||||
|
||||
let rowContainsElement = true,
|
||||
rowIndex = 0;
|
||||
|
||||
while (rowContainsElement) {
|
||||
rowContainsElement = false;
|
||||
for (let i = 0; i < this.content.columns.length; i++ ) {
|
||||
let field = this.content.columns[i].fields[rowIndex];
|
||||
if (field) {
|
||||
rowContainsElement = true;
|
||||
}
|
||||
|
||||
fields.push(field);
|
||||
}
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the column width based on the numberOfColumns and current field's colspan property
|
||||
*
|
||||
* @param field
|
||||
*/
|
||||
getColumnWith(field: FormFieldModel): string {
|
||||
const colspan = field ? field.colspan : 1;
|
||||
return (100 / this.content.json.numberOfColumns) * colspan + '%';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user