igniteui-react-grids
Version: 
Ignite UI React grid components.
172 lines (171 loc) • 4.51 kB
JavaScript
import { IgrGridCellIdentifier } from "./igr-grid-cell-identifier";
import { IgrColumn } from "./igr-column";
import { IgrBaseEventArgsDetail } from "./igr-base-event-args-detail";
import { GridEditDoneEventArgsDetail as GridEditDoneEventArgsDetail_internal } from "./GridEditDoneEventArgsDetail";
import { ensureBool } from "igniteui-react-core";
/**
 * Represents event arguments related to grid editing completion.
*/
export class IgrGridEditDoneEventArgsDetail extends IgrBaseEventArgsDetail {
    createImplementation() {
        return new GridEditDoneEventArgsDetail_internal();
    }
    /**
                                 * @hidden
                                 */
    get i() {
        return this._implementation;
    }
    constructor() {
        super();
    }
    /**
     * @deprecated Use the `rowKey` property instead.
    */
    get rowID() {
        return this.i.p;
    }
    set rowID(v) {
        this.i.p = v;
    }
    /**
     * @deprecated Use the `rowKey` property instead.
    */
    get primaryKey() {
        return this.i.n;
    }
    set primaryKey(v) {
        this.i.n = v;
    }
    get rowKey() {
        return this.i.q;
    }
    set rowKey(v) {
        this.i.q = v;
    }
    get cellID() {
        const r = this.i.i;
        if (r == null) {
            return null;
        }
        if (!r.externalObject) {
            let e = new IgrGridCellIdentifier();
            if (r.$type) {
                e._implementation = r;
            }
            else {
                if (e.i.setNativeElement) {
                    e.i.setNativeElement(r);
                }
            }
            r.externalObject = e;
        }
        return r.externalObject;
    }
    set cellID(v) {
        v == null ? this.i.i = null : this.i.i = v.i;
    }
    /**
     * `rowData` represents the updated/committed data of the row after the edit (newValue)
     * The only case rowData (of the current object) is used directly, is when there is no rowEditing or transactions enabled
    */
    get rowData() {
        return this.i.o;
    }
    set rowData(v) {
        this.i.o = v;
    }
    /**
     * Represents the previous (before editing) value of the edited cell.
     * It's used when the event has been stopped/exited.
    */
    get oldValue() {
        return this.i.m;
    }
    set oldValue(v) {
        this.i.m = v;
    }
    /**
     * Optional
     * Represents the value, that is being entered in the edited cell
     * When there is no `newValue` and the event has ended, the value of the cell returns to the `oldValue`
    */
    get newValue() {
        return this.i.l;
    }
    set newValue(v) {
        this.i.l = v;
    }
    /**
     * Optional
     * Represents the column information of the edited cell
    */
    get column() {
        const r = this.i.g;
        if (r == null) {
            return null;
        }
        if (!r.externalObject) {
            let e = IgrColumn._createFromInternal(r);
            if (e) {
                e._implementation = r;
            }
            r.externalObject = e;
        }
        return r.externalObject;
    }
    set column(v) {
        v == null ? this.i.g = null : this.i.g = v.i;
    }
    /**
     * Optional
     * Represents the grid instance that owns the edit event.
    */
    get owner() {
        const r = this.i.h;
        if (r == null) {
            return null;
        }
        return r.externalObject;
    }
    set owner(v) {
        v == null ? this.i.h = null : this.i.h = v.i;
    }
    /**
     * Optional
     * Indicates if the editing consists of adding a new row
    */
    get isAddRow() {
        return this.i.j;
    }
    set isAddRow(v) {
        this.i.j = ensureBool(v);
    }
    /**
     * Optional
     * Indicates if the new value would be valid.
     * It can be set to return the result of the methods for validation of the grid
    */
    get valid() {
        return this.i.k;
    }
    set valid(v) {
        this.i.k = ensureBool(v);
    }
    findByName(name) {
        var baseResult = super.findByName(name);
        if (baseResult) {
            return baseResult;
        }
        if (this.cellID && this.cellID.name && this.cellID.name == name) {
            return this.cellID;
        }
        if (this.column && this.column.name && this.column.name == name) {
            return this.column;
        }
        if (this.owner && this.owner.name && this.owner.name == name) {
            return this.owner;
        }
        return null;
    }
}