|
|
@ -5,11 +5,12 @@ import type { Row } from '~/lib' |
|
|
|
|
|
|
|
|
|
|
|
export const extractPkFromRow = (row: Record<string, any>, columns: ColumnType[]) => { |
|
|
|
export const extractPkFromRow = (row: Record<string, any>, columns: ColumnType[]) => { |
|
|
|
if (!row || !columns) return null |
|
|
|
if (!row || !columns) return null |
|
|
|
return columns |
|
|
|
|
|
|
|
.filter((c) => c.pk) |
|
|
|
const pkColumns = columns.filter((c) => c.pk) |
|
|
|
.map((c) => row?.[c.title as string]) |
|
|
|
|
|
|
|
.filter((v) => v) |
|
|
|
if (!pkColumns.some((c) => row?.[c.title as string])) return null |
|
|
|
.join('___') |
|
|
|
|
|
|
|
|
|
|
|
return pkColumns.map((c) => row?.[c.title as string]).join('___') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const rowPkData = (row: Record<string, any>, columns: ColumnType[]) => { |
|
|
|
export const rowPkData = (row: Record<string, any>, columns: ColumnType[]) => { |
|
|
|