UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

143 lines (142 loc) 3.49 kB
import { IgrCellInfo } from "./igr-cell-info"; import { DataSourceSchemaPropertyType_$type } from "igniteui-react-core"; import { EditorType_$type } from "./EditorType"; import { EditorCellModel as EditorCellModel_internal } from "./EditorCellModel"; import { ensureBool, ensureEnum } from "igniteui-react-core"; /** * Represents info about the current cell. */ export class IgrEditorCellInfo extends IgrCellInfo { createImplementation() { return new EditorCellModel_internal(); } /** * @hidden */ get i() { return this._implementation; } constructor() { super(); } /** * Gets whether the editor cell is hidden or not. */ get isHidden() { return this.i.mr; } /** * Gets or sets the edit target for this cell. */ get editTarget() { const r = this.i.mk; if (r == null) { return null; } return r.externalObject; } set editTarget(v) { v == null ? this.i.mk = null : this.i.mk = v.i; } /** * Gets or sets the data type associated with the cell being edited. */ get dataType() { return this.i.mi; } set dataType(v) { this.i.mi = ensureEnum(DataSourceSchemaPropertyType_$type, v); } /** * Gets or sets the error message to display in the editor cell. */ get errorMessage() { return this.i.nn; } set errorMessage(v) { this.i.nn = v; } /** * Gets or sets the user selected value. */ get editValue() { return this.i.na; } set editValue(v) { this.i.na = v; } /** * Gets or sets the type of editor to use while cell editing. */ get editorType() { return this.i.mm; } set editorType(v) { this.i.mm = ensureEnum(EditorType_$type, v); } /** * Gets or sets the data source to use for the editor where it makes sense. */ get editorDataSource() { return this.i.m9; } set editorDataSource(v) { this.i.m9 = v; } /** * Gets or sets the editors display member. */ get editorTextField() { return this.i.ni; } set editorTextField(v) { this.i.ni = v; } /** * Gets or sets the editors value member. */ get editorValueField() { return this.i.mg; } set editorValueField(v) { if (v && !Array.isArray(v) && typeof (v) == "string") { const re = /\s*(?:,|\s|$)\s*/gm; v = v.split(re); } this.i.mg = v; } get dateFormatString() { return this.i.nf; } set dateFormatString(v) { this.i.nf = v; } get showTodayButton() { return this.i.ms; } set showTodayButton(v) { this.i.ms = ensureBool(v); } /** * Gets the row index that the editor cell is targeting for edit. */ get targetRow() { return this.i.m7; } /** * Gets the column index that the editor cell is targeting for edit. */ get targetColumn() { return this.i.m6; } findByName(name) { var baseResult = super.findByName(name); if (baseResult) { return baseResult; } if (this.editTarget && this.editTarget.name && this.editTarget.name == name) { return this.editTarget; } return null; } }