ng2-smart-table-custom
Version:
Angular Smart Table with inline-validations support
45 lines • 1.49 kB
JavaScript
var Cell = (function () {
function Cell(value, row, column, dataSet) {
this.value = value;
this.row = row;
this.column = column;
this.dataSet = dataSet;
this.newValue = '';
this.newValue = value;
}
Cell.prototype.getColumn = function () {
return this.column;
};
Cell.prototype.getValidator = function () {
return this.dataSet.getRowValidator(this.getRow().index).controls[this.getId()];
};
Cell.prototype.getRow = function () {
return this.row;
};
Cell.prototype.getValue = function () {
var valid = this.column.getValuePrepareFunction() instanceof Function;
var prepare = valid ? this.column.getValuePrepareFunction() : Cell.PREPARE;
return prepare.call(null, this.value, this.row.getData());
};
Cell.prototype.setValue = function (value) {
this.newValue = value;
};
Cell.prototype.getId = function () {
return this.getColumn().id;
};
Cell.prototype.getTitle = function () {
return this.getColumn().title;
};
Cell.prototype.isEditable = function () {
if (this.getRow().index === -1) {
return this.getColumn().isAddable;
}
else {
return this.getColumn().isEditable;
}
};
return Cell;
}());
export { Cell };
Cell.PREPARE = function (value) { return value; };
//# sourceMappingURL=cell.js.map