UNPKG

handsontable

Version:

Handsontable is a JavaScript Data Grid available for React, Angular and Vue.

19 lines 649 B
import { isKeyValueObject } from "../../../helpers/object.mjs"; /** * Defines what value is set to an autocomplete-typed cell. * * @param {*} newValue The value to be set. * @param {number} row The visual row index. * @param {number} column The visual column index. * @returns {*} The new value to be set. */ export function valueSetter(newValue, row, column) { const sourceDataAtCell = this.getSourceDataAtCell(this.toPhysicalRow(row), this.toPhysicalColumn(column)); if (isKeyValueObject(sourceDataAtCell)) { return isKeyValueObject(newValue) ? newValue : { key: newValue, value: newValue }; } return newValue; }