1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| import { ROW_KEY } from './const';
| import type { BasicTableProps } from './types/table';
|
| export function parseRowKey<RecordType = any>(
| rowKey: BasicTableProps['rowKey'],
| record: RecordType,
| autoCreateKey?: boolean,
| ): number | string {
| if (autoCreateKey) {
| return ROW_KEY;
| } else {
| if (typeof rowKey === 'string') {
| return rowKey;
| } else if (rowKey) {
| return rowKey(record);
| } else {
| return ROW_KEY;
| }
| }
| }
|
| export function parseRowKeyValue<RecordType = any>(
| rowKey: BasicTableProps['rowKey'],
| record: RecordType,
| autoCreateKey?: boolean,
| ): number | string {
| return record[parseRowKey(rowKey, record, autoCreateKey)];
| }
|
|