UNPKG

handsontable

Version:

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

45 lines (43 loc) 1.14 kB
"use strict"; exports.__esModule = true; exports.getValueGetterValue = getValueGetterValue; exports.getValueSetterValue = getValueSetterValue; var _function = require("../helpers/function"); /** * Get the value to be set in the cell. * * @param {*} value Initial value. * @param {object} cellMeta The cell meta object. * @returns {*} The value to be set in the cell. */ function getValueSetterValue(value, cellMeta) { const { instance, visualRow, visualCol, valueSetter } = cellMeta; if ((0, _function.isFunction)(valueSetter)) { return valueSetter.call(instance, value, visualRow, visualCol, cellMeta); } return value; } /** * Get the value to be displayed in the cell. * * @param {*} value Initial value. * @param {object} cellMeta The cell meta object. * @returns {*} The value to be displayed in the cell. */ function getValueGetterValue(value, cellMeta) { const { instance, visualRow, visualCol, valueGetter } = cellMeta; if ((0, _function.isFunction)(valueGetter)) { return valueGetter.call(instance, value, visualRow, visualCol, cellMeta); } return value; }