UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

138 lines (137 loc) 4.35 kB
import { IgrDataGridColumn } from './igr-data-grid-column'; import { GridCellValueChangingEventArgs as GridCellValueChangingEventArgs_internal } from "./GridCellValueChangingEventArgs"; import { IgrDateTimeCellInfo } from "./igr-date-time-cell-info"; import { IgrImageCellInfo } from "./igr-image-cell-info"; import { IgrNumericCellInfo } from "./igr-numeric-cell-info"; import { IgrRowSeparatorInfo } from "./igr-row-separator-info"; import { IgrSectionHeaderCellInfo } from "./igr-section-header-cell-info"; import { IgrTemplateCellInfo } from "./igr-template-cell-info"; import { IgrTemplateHeaderCellInfo } from "./igr-template-header-cell-info"; import { IgrTemplateSectionHeaderCellInfo } from "./igr-template-section-header-cell-info"; import { IgrTextCellInfo } from "./igr-text-cell-info"; import { IgrTextHeaderCellInfo } from "./igr-text-header-cell-info"; /** * Event arguments for the CellValueChanging event */ export class IgrGridCellValueChangingEventArgs { createImplementation() { return new GridCellValueChangingEventArgs_internal(); } get i() { return this._implementation; } onImplementationCreated() { } constructor() { this._implementation = this.createImplementation(); this._implementation.externalObject = this; this.onImplementationCreated(); } _provideImplementation(i) { this._implementation = i; this._implementation.externalObject = this; this.onImplementationCreated(); } /** * The backing information for the current cell. */ get cellInfo() { if (this.i.cellInfo == null) { return null; } if (!this.i.cellInfo.externalObject) { let ext = null; switch (this.i.cellInfo.$type.name) { case "DateTimeCellModel": ext = new IgrDateTimeCellInfo(); break; case "ImageCellModel": ext = new IgrImageCellInfo(); break; case "NumericCellModel": ext = new IgrNumericCellInfo(); break; case "RowSeparatorModel": ext = new IgrRowSeparatorInfo(); break; case "SectionHeaderCellModel": ext = new IgrSectionHeaderCellInfo(); break; case "TemplateCellModel": ext = new IgrTemplateCellInfo(); break; case "TemplateHeaderCellModel": ext = new IgrTemplateHeaderCellInfo(); break; case "TemplateSectionHeaderCellModel": ext = new IgrTemplateSectionHeaderCellInfo(); break; case "TextCellModel": ext = new IgrTextCellInfo(); break; case "TextHeaderCellModel": ext = new IgrTextHeaderCellInfo(); break; } ext._implementation = this.i.cellInfo; this.i.cellInfo.externalObject = ext; } return this.i.cellInfo.externalObject; } /** * Gets the edit ID for this value change. */ get editID() { return this.i.c; } set editID(v) { this.i.c = +v; } /** * Gets the column the cell belongs to. */ get column() { const r = this.i.b; if (r == null) { return null; } if (!r.externalObject) { let e = IgrDataGridColumn._createFromInternal(r); if (e) { e._implementation = r; } r.externalObject = e; } return r.externalObject; } set column(v) { v == null ? this.i.b = null : this.i.b = v.i; } /** * Gets the row item associated with the change. */ get item() { return this.i.item; } set item(v) { this.i.item = v; } /** * Gets the old cell value. */ get oldValue() { return this.i.f; } set oldValue(v) { this.i.f = v; } /** * Gets the new cell value. */ get newValue() { return this.i.e; } set newValue(v) { this.i.e = v; } }