@easyquery/core
Version:
EasyQuery.JS core modules
79 lines • 2.83 kB
JavaScript
import { ValueEditor } from "./value_editor";
import { DataType } from "../types/data_type";
var Entity = /** @class */ (function () {
function Entity() {
this.name = "";
this.caption = "";
this.description = "";
this.useInConditions = false;
this.useInResult = false;
this.attributes = new Array();
this.subEntities = new Array();
}
Entity.prototype.loadFromData = function (model, data) {
if (data) {
this.name = data.name;
this.caption = data.name;
this.description = data.desc;
this.useInConditions = data.uic;
this.useInResult = data.uir;
this.useInSorting = data.uis;
this.subEntities = new Array();
if (data.ents) {
for (var i = 0; i < data.ents.length; i++) {
var newEntity = new Entity();
newEntity.loadFromData(model, data.ents[i]);
this.subEntities.push(newEntity);
}
}
this.attributes = new Array();
if (data.attrs) {
for (var i = 0; i < data.attrs.length; i++) {
var newAttr = new EntityAttr();
newAttr.loadFromData(model, data.attrs[i]);
this.attributes.push(newAttr);
}
}
}
};
return Entity;
}());
export { Entity };
var EntityAttr = /** @class */ (function () {
function EntityAttr() {
this.params = [];
this.id = "";
this.caption = "{Unrecognized attribute}";
this.dataType = DataType.String;
this.size = 0;
this.usedInCondition = false;
this.usedInResult = false;
this.usedInSorting = false;
this.defaultOperator = "";
this.operators = new Array();
this.lookupAttr = "";
this.sqlExpr = "";
}
EntityAttr.prototype.loadFromData = function (model, data) {
if (data) {
this.id = data.id;
this.description = data.desc;
this.caption = data.cptn;
this.dataType = data.dtype;
this.usedInCondition = data.uic;
this.usedInResult = data.uir;
this.usedInSorting = data.uis;
this.size = data.size;
this.sqlExpr = data.sqlExpr;
this.defaultOperator = data.defOperator;
this.operators = data.ops;
this.lookupAttr = data.lookupAttr;
if (data.edtr) {
this.defaultEditor = model.getEditorById(data.edtr) || new ValueEditor();
}
}
};
return EntityAttr;
}());
export { EntityAttr };
//# sourceMappingURL=entity.js.map