UNPKG

angular4-material-table

Version:

Angular 4 table based on @angular/cdk table structure, to allow row insertion, edition, validation and deletion.

29 lines 946 B
import cloneDeep from 'lodash.clonedeep'; var TableElement = /** @class */ (function () { function TableElement() { } TableElement.prototype.delete = function () { this.source.delete(this.id); }; TableElement.prototype.confirmEditCreate = function () { if (this.id == -1) return this.source.confirmCreate(this); else return this.source.confirmEdit(this); }; TableElement.prototype.startEdit = function () { this.originalData = cloneDeep(this.currentData); this.editing = true; }; TableElement.prototype.cancelOrDelete = function () { if (this.id == -1 || !this.editing) this.delete(); else { this.currentData = this.originalData; this.editing = false; } }; return TableElement; }()); export { TableElement }; //# sourceMappingURL=table-element.js.map