@justjarethb/table-core
Version:
Fork of @tanstack/table-core with support for event listeners in different windows
48 lines (43 loc) • 1.28 kB
JavaScript
/**
* 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
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
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
}), {
key: process.env.NODE_ENV === 'development' && 'cell.getContext',
debug: () => table.options.debugAll
})
};
table._features.forEach(feature => {
Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table));
}, {});
return cell;
}
exports.createCell = createCell;
//# sourceMappingURL=cell.js.map