UNPKG

@tanstack/table-core

Version:

Headless UI for building powerful tables & datagrids for TS/JS.

43 lines (39 loc) 1.16 kB
/** * table-core * * Copyright (c) TanStack * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ 'use strict'; var utils = require('../utils.js'); function createCell(table, row, column, columnId) { const getRenderValue = () => { var _cell$getValue; return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue; }; const cell = { id: `${row.id}_${column.id}`, row, column, getValue: () => row.getValue(columnId), renderValue: getRenderValue, getContext: utils.memo(() => [table, column, row, cell], (table, column, row, cell) => ({ table, column, row, cell: cell, getValue: cell.getValue, renderValue: cell.renderValue }), utils.getMemoOptions(table.options, 'debugCells', 'cell.getContext')) }; table._features.forEach(feature => { feature.createCell == null || feature.createCell(cell, column, row, table); }, {}); return cell; } exports.createCell = createCell; //# sourceMappingURL=cell.js.map