|
| 1 | +import { callMemoOrStaticFn } from '../../utils' |
| 2 | +import { row_getValue } from '../rows/Rows.utils' |
1 | 3 | import type { CellData, RowData } from '../../types/type-utils' |
2 | 4 | import type { TableFeatures } from '../../types/TableFeatures' |
3 | | -import type { Table } from '../../types/Table' |
4 | 5 | import type { Cell } from '../../types/Cell' |
5 | 6 |
|
6 | 7 | export function cell_getValue< |
7 | 8 | TFeatures extends TableFeatures, |
8 | 9 | TData extends RowData, |
9 | 10 | TValue extends CellData = CellData, |
10 | 11 | >(cell: Cell<TFeatures, TData, TValue>): TValue { |
11 | | - return cell.row.getValue(cell.column.id) |
| 12 | + return callMemoOrStaticFn(cell.row, row_getValue, [cell.column.id]) |
12 | 13 | } |
13 | 14 |
|
14 | 15 | export function cell_renderValue< |
15 | 16 | TFeatures extends TableFeatures, |
16 | 17 | TData extends RowData, |
17 | 18 | TValue extends CellData = CellData, |
18 | | ->(cell: Cell<TFeatures, TData, TValue>, table: Table<TFeatures, TData>) { |
19 | | - return cell.getValue() ?? table.options.renderFallbackValue |
| 19 | +>(cell: Cell<TFeatures, TData, TValue>) { |
| 20 | + return cell.getValue() ?? cell.table.options.renderFallbackValue |
20 | 21 | } |
21 | 22 |
|
22 | 23 | export function cell_getContext< |
23 | 24 | TFeatures extends TableFeatures, |
24 | 25 | TData extends RowData, |
25 | 26 | TValue extends CellData = CellData, |
26 | | ->(cell: Cell<TFeatures, TData, TValue>, table: Table<TFeatures, TData>) { |
| 27 | +>(cell: Cell<TFeatures, TData, TValue>) { |
27 | 28 | return { |
28 | | - table, |
| 29 | + table: cell.table, |
29 | 30 | column: cell.column, |
30 | 31 | row: cell.row, |
31 | 32 | cell: cell, |
|
0 commit comments