import { Component, Input, Output, EventEmitter } from '@angular/core'; import { Grid } from '../../lib/grid'; import { Cell } from '../../lib/data-set/cell'; import { Row } from '../../lib/data-set/row'; @Component({ selector: 'ng2-smart-table-cell', template: ` `, }) export class CellComponent { @Input() grid: Grid; @Input() row: Row; @Input() editConfirm: EventEmitter; @Input() createConfirm: EventEmitter; @Input() isNew: boolean; @Input() cell: Cell; @Input() inputClass: string = ''; @Input() mode: string = 'inline'; @Input() isInEditing: boolean = false; @Output() edited = new EventEmitter(); onEdited(event: any) { if (this.isNew) { this.grid.create(this.grid.getNewRow(), this.createConfirm); } else { this.grid.save(this.row, this.editConfirm); } } }