@easyquery/core
Version:
EasyQuery.JS core modules
68 lines • 2.51 kB
JavaScript
import { equtils } from '../utils/utils';
import { ValueEditor } from './value_editor';
import { DataKind } from '../types/data_kind';
import { DataType } from '../types/data_type';
var Operator = /** @class */ (function () {
function Operator() {
this.id = "";
this.caption = "{Unrecognized operator}";
this.displayFormat = "{expr1} [[{unrecognized operator}]] {expr2}";
this.isRange = false;
this.caseIns = false;
this.paramCount = 2;
this.defaultOperand = new Operand();
this.operands = new Array();
}
Operator.prototype.loadFromData = function (model, data) {
if (data) {
this.id = data.id;
this.caption = data.cptn;
this.caseIns = data.caseIns;
this.isRange = data.isRange;
this.displayFormat = data.fmt;
this.paramCount = data.pcnt;
if (data.defOperand) {
this.defaultOperand.loadFromData(model, data.defOperand);
}
if (data.editor) {
this.defaultOperand.editor = model.getEditorById(data.editor) || new ValueEditor();
}
if (data.operands) {
for (var i = 0; i < data.operands.length; i++) {
var newOperand = new Operand();
newOperand.loadFromData(model, data.operands[i]);
if (data.editor) {
newOperand.editor = model.getEditorById(data.editor) || new ValueEditor();
}
this.operands.push(newOperand);
}
}
}
};
return Operator;
}());
export { Operator };
var Operand = /** @class */ (function () {
function Operand() {
this.kind = DataKind.Scalar;
this.dataType = DataType.Unknown;
this.editor = new ValueEditor();
this.defValue = "";
}
Operand.prototype.loadFromData = function (model, operand) {
this.kind = operand.kind;
this.dataType = operand.dtype;
this.defValue = operand.val;
this.defText = operand.txt;
;
if (operand.editor) {
this.editor = model.getEditorById(operand.editor) || new ValueEditor();
}
};
Operand.prototype.copyFrom = function (src) {
equtils.assign(this, src);
};
return Operand;
}());
export { Operand };
//# sourceMappingURL=operator.js.map