UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

127 lines (126 loc) 4.28 kB
import { IgrDataGrid } from './igr-data-grid'; import { DataGridCellEventArgs as DataGridCellEventArgs_internal } from "./DataGridCellEventArgs"; 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"; import { MouseButton_$type } from "igniteui-react-core"; import { ensureBool, ensureEnum } from "igniteui-react-core"; /** * Information about the cell in context. */ export class IgrDataGridCellEventArgs { createImplementation() { return new DataGridCellEventArgs_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 grid owning the cell. */ get grid() { const r = this.i.grid; if (r == null) { return null; } if (!r.externalObject) { let e = new IgrDataGrid({}); if (r.$type) { e._implementation = r; } else { if (e.i.setNativeElement) { e.i.setNativeElement(r); } } r.externalObject = e; } return r.externalObject; } set grid(v) { v == null ? this.i.grid = null : this.i.grid = v.i; } /** * Gets which click type it is. */ get button() { return this.i.button; } set button(v) { this.i.button = ensureEnum(MouseButton_$type, v); } /** * Is this a double click? */ get isDoubleClick() { return this.i.isDoubleClick; } set isDoubleClick(v) { this.i.isDoubleClick = ensureBool(v); } }