delete file

This commit is contained in:
annampak 2017-09-21 13:34:55 +03:00
parent 5c5bf3bfd0
commit 6d5ef47405
1 changed files with 0 additions and 127 deletions

View File

@ -1,127 +0,0 @@
import { Injectable } from '@angular/core';
import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown';
import { FieldBase } from '../../app/form/fields/field-base';
import { TextboxField } from '../../app/form/fields/textbox/field-textbox';
import { CheckBoxField } from '../../app/form/fields/checkbox/field-checkbox';
import { DataModel } from '../entities/DataModel';
import {Rule} from '../entities/common/rule';
import { GroupBase } from '../form/dynamic-form-group/group-base';
@Injectable()
export class FieldVisibility {
private dataModel : DataModel;
public getDataModel(fields:any[]){
if(this.dataModel != null)
return this.dataModel;
this.dataModel = new DataModel();
this.dataModel.fields = this.getFieldVisibility(fields);
this.dataModel.groups = this.getGroups();
return this.dataModel;
}
private getFieldVisibility(fields:any[]) {
console.log(fields);
let fieldsVisible :FieldBase<any>[] =[];
fields.forEach(element => {
if (element.viewStyle._renderstyle == "freetext"){
let newfield:FieldBase <any>;
let rule = new Rule();
//rule.target = element.visible.rule._target;
//rule.ruleType = element.visible.rule._type;
newfield = new TextboxField({
label: element._id,
key:element.title.__cdata,
value: 'DMP1',
required: true,
ordinal:element._ordinal,
rules: new Array(),
visible: true,
group : element._group
});
if (element.visible.rule)
if(element.visible.rule.length){
element.visible.rule.forEach(rule => {
newfield.rules.push(rule)
});
}
else {
newfield.rules.push(element.visible.rule)
}
fieldsVisible.push(newfield);
}
if (element.viewStyle._renderstyle == "combobox"){
let newfield:DropdownField;
let rule = new Rule();
//rule.target = element.visible.rule._target;
//rule.ruleType = element.visible.rule._type;
newfield = new DropdownField({
label: element._id,
key:element.title.__cdata,
value: 'DMP1',
required: true,
ordinal:element._ordinal,
rule: element.visible.rule,
visible: true
});
fieldsVisible.push(newfield);
}
});
fieldsVisible.sort((a, b) => a.order - b.order);
return fieldsVisible;
}
private getGroups(){
let groups :GroupBase<any>[] =[];
let group: GroupBase<any>;
group = new GroupBase<any>({
key: "adfgadfsg",
title: "GroupA",
rules: new Array(),
groupFields: new Array(),
//value = "value",
visible: true,
order: 1
//,
//controlType: "none"
});
let newfield1:FieldBase <any>;
newfield1 = new TextboxField({
key:"tf1-455",
label: "Field from group1",
value: 'this is a groupfield',
required: true,
ordinal:1
});
group.groupFields.push(newfield1);
let newfield2:FieldBase <any>;
newfield2 = new TextboxField({
key:"tf1-443",
label: "Another field from group1",
value: 'this is a groupfield',
required: true,
ordinal:2
});
group.groupFields.push(newfield2);
groups.push(group);
return groups;
}
}