sources for comboboxes
This commit is contained in:
parent
d6a4ba6fec
commit
77b44527b5
|
@ -0,0 +1 @@
|
||||||
|
dmp-frontend/dist.7z
|
|
@ -1,10 +1,12 @@
|
||||||
import { GroupBase } from '../form/dynamic-form-group/group-base';
|
import { GroupBase } from '../form/dynamic-form-group/group-base';
|
||||||
import { FieldBase } from '../form/fields/field-base';
|
import { FieldBase } from '../form/fields/field-base';
|
||||||
import { Attribute } from './model/attribute';
|
import { Attribute } from './model/attribute';
|
||||||
|
import { Source } from './model/source';
|
||||||
|
|
||||||
export class DataModel {
|
export class DataModel {
|
||||||
|
|
||||||
private fIndex : Map<string, FieldBase<any>>;
|
private fIndex : Map<string, FieldBase<any>>;
|
||||||
|
private fIndSources : Map<string, Source>;
|
||||||
|
|
||||||
groups: GroupBase<any>[] = [];
|
groups: GroupBase<any>[] = [];
|
||||||
fields: FieldBase<any>[] = [];
|
fields: FieldBase<any>[] = [];
|
||||||
|
@ -24,6 +26,7 @@ export class DataModel {
|
||||||
|
|
||||||
|
|
||||||
this.fIndex = new Map<string, FieldBase<any>>();
|
this.fIndex = new Map<string, FieldBase<any>>();
|
||||||
|
this.fIndSources = new Map<string, Source>();
|
||||||
|
|
||||||
this.fields.forEach((field) => {
|
this.fields.forEach((field) => {
|
||||||
console.log("fieldid:" +field.key);
|
console.log("fieldid:" +field.key);
|
||||||
|
@ -37,6 +40,14 @@ export class DataModel {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.semanticAttr.forEach((attr) => {
|
||||||
|
attr.sources.forEach(src => {
|
||||||
|
this.fIndSources.set(attr.id, src);
|
||||||
|
console.log("fieldid: "+attr.id + "attr:" +src);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getFieldByKey(key){
|
public getFieldByKey(key){
|
||||||
|
|
|
@ -12,6 +12,6 @@ export class Attribute {
|
||||||
multiplicityMax: number;
|
multiplicityMax: number;
|
||||||
validationType: any;
|
validationType: any;
|
||||||
validation : Rule[];
|
validation : Rule[];
|
||||||
source: Source[];
|
sources: Source[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { RadioBoxField } from '../../app/form/fields/radiobox/field-radiobox';
|
||||||
import { DataModel } from '../entities/DataModel';
|
import { DataModel } from '../entities/DataModel';
|
||||||
import {Rule} from '../entities/common/rule';
|
import {Rule} from '../entities/common/rule';
|
||||||
import { GroupBase } from '../form/dynamic-form-group/group-base';
|
import { GroupBase } from '../form/dynamic-form-group/group-base';
|
||||||
|
import { Attribute } from '../entities/model/attribute';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class dataModelBuilder {
|
export class dataModelBuilder {
|
||||||
|
@ -20,10 +21,11 @@ export class dataModelBuilder {
|
||||||
return this.dataModel;
|
return this.dataModel;
|
||||||
|
|
||||||
this.dataModel = new DataModel();
|
this.dataModel = new DataModel();
|
||||||
//this.dataModel.fields = this.getFieldVisibility(data.dataset.profile.viewstyle.definition.root.fields.field);
|
|
||||||
this.fields = this.buildFields(data.dataset.profile.viewstyle.definition.root.fields.field);
|
this.fields = this.buildFields(data.dataset.profile.viewstyle.definition.root.fields.field);
|
||||||
this.dataModel.groups = this.getGroups(data.dataset.profile.viewstyle.definition.root.fieldGroups.fieldGroup, this.fields);
|
this.dataModel.groups = this.getGroups(data.dataset.profile.viewstyle.definition.root.fieldGroups.fieldGroup, this.fields);debugger;
|
||||||
//this.getDummyGroups();
|
this.dataModel.semanticAttr = new Array(new Attribute);
|
||||||
|
//this.dataModel.semanticAttr = data.dataset.profile.definition.root.fields.field;
|
||||||
|
this.dataModel.semanticAttr = this.getFieldsAttributes(data.dataset.profile.definition.root.fields.field, this.fields) ;
|
||||||
this.dataModel.buildIndex();
|
this.dataModel.buildIndex();
|
||||||
|
|
||||||
return this.dataModel;
|
return this.dataModel;
|
||||||
|
@ -31,7 +33,6 @@ export class dataModelBuilder {
|
||||||
|
|
||||||
|
|
||||||
private buildFields(fields:any[]) {
|
private buildFields(fields:any[]) {
|
||||||
console.log(fields);
|
|
||||||
let fieldsVisible :FieldBase<any>[] =[];
|
let fieldsVisible :FieldBase<any>[] =[];
|
||||||
fields.forEach(element => {
|
fields.forEach(element => {
|
||||||
if (element.viewStyle._renderstyle == "freetext"){
|
if (element.viewStyle._renderstyle == "freetext"){
|
||||||
|
@ -45,7 +46,8 @@ export class dataModelBuilder {
|
||||||
order:element._ordinal,
|
order:element._ordinal,
|
||||||
rules: element.visible.rule != undefined ? element.visible.rule: rule,
|
rules: element.visible.rule != undefined ? element.visible.rule: rule,
|
||||||
visible: element._defaultVisibility,
|
visible: element._defaultVisibility,
|
||||||
group : element._group
|
group : element._group,
|
||||||
|
description: element.description.__cdata
|
||||||
});
|
});
|
||||||
|
|
||||||
fieldsVisible.push(newfield);
|
fieldsVisible.push(newfield);
|
||||||
|
@ -61,6 +63,7 @@ export class dataModelBuilder {
|
||||||
order:element._ordinal,
|
order:element._ordinal,
|
||||||
rules: element.visible.rule != undefined ? element.visible.rule: rule,
|
rules: element.visible.rule != undefined ? element.visible.rule: rule,
|
||||||
visible: element._defaultVisibility,
|
visible: element._defaultVisibility,
|
||||||
|
description: element.description.__cdata,
|
||||||
group : element._group
|
group : element._group
|
||||||
});
|
});
|
||||||
fieldsVisible.push(newfield);
|
fieldsVisible.push(newfield);
|
||||||
|
@ -77,6 +80,7 @@ export class dataModelBuilder {
|
||||||
rules: element.visible.rule != undefined ? element.visible.rule: rule,
|
rules: element.visible.rule != undefined ? element.visible.rule: rule,
|
||||||
visible: element._defaultVisibility,
|
visible: element._defaultVisibility,
|
||||||
group : element._group,
|
group : element._group,
|
||||||
|
description: element.description.__cdata,
|
||||||
type: "checkbox"
|
type: "checkbox"
|
||||||
});
|
});
|
||||||
fieldsVisible.push(newfield);
|
fieldsVisible.push(newfield);
|
||||||
|
@ -198,5 +202,26 @@ export class dataModelBuilder {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getFieldsAttributes(attributes:any, fields:any[]){
|
||||||
|
let attribute:Attribute[]=[];
|
||||||
|
attributes.forEach(attr => {
|
||||||
|
let newAttribute = new Attribute();
|
||||||
|
newAttribute.datatype = attr._datatype;
|
||||||
|
newAttribute.defaultValue = attr.defaultValue._value;
|
||||||
|
newAttribute.id = attr._id;
|
||||||
|
newAttribute.multiplicityMax = attr.multiplicity._max;
|
||||||
|
newAttribute.multiplicityMin = attr.multiplicity._min;
|
||||||
|
newAttribute.ordinal = attr._ordinal;
|
||||||
|
newAttribute.sources = new Array();
|
||||||
|
newAttribute.sources.push(attr.sources.source)
|
||||||
|
newAttribute.validation = attr.validation;
|
||||||
|
|
||||||
|
console.log(newAttribute);
|
||||||
|
attribute.push(newAttribute);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return attribute;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -19,7 +19,8 @@ export class ServerService {
|
||||||
xml2jsonOBJ: any;
|
xml2jsonOBJ: any;
|
||||||
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a868dbbb-ee37-4ce6-81c8-27048e0599a9';
|
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a868dbbb-ee37-4ce6-81c8-27048e0599a9';
|
||||||
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a71a6a92-5c23-40d7-ab87-e30bc860f5a4';//include rules!
|
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a71a6a92-5c23-40d7-ab87-e30bc860f5a4';//include rules!
|
||||||
fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/d597c26e-3d8b-416a-bc07-1734d68c79c9';//'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/d619d418-88be-4f2c-9dcc-db7ad4fc60b3';//include sections!
|
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/d597c26e-3d8b-416a-bc07-1734d68c79c9';//include sections! + 3groupfields
|
||||||
|
fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/9a4a4a57-4d01-465e-9887-254534f31600';
|
||||||
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/6c845c42-dc09-42ed-9959-cceb3b616364';
|
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/6c845c42-dc09-42ed-9959-cceb3b616364';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue