|
|
@@ -50,6 +50,8 @@ type Props<T extends Record<string, unknown>> = {
|
|
|
setRowSelection?: Dispatch<SetStateAction<RowSelectionState>>;
|
|
|
disabledHeadSort?: boolean;
|
|
|
disabledSizeChange?: boolean;
|
|
|
+ highlightValue?: unknown;
|
|
|
+ hightlightKey?: keyof T;
|
|
|
};
|
|
|
|
|
|
function LDTable<T extends Record<string, any>>(props: Props<T>): ReactElement {
|
|
|
@@ -66,6 +68,8 @@ function LDTable<T extends Record<string, any>>(props: Props<T>): ReactElement {
|
|
|
settingContext,
|
|
|
disabledHeadSort,
|
|
|
disabledSizeChange,
|
|
|
+ highlightValue,
|
|
|
+ hightlightKey,
|
|
|
} = props;
|
|
|
const [{page, pageSize}, {setPageContext}] = useTablePageContext(pageContext);
|
|
|
const [{isSearching}] = useTableSearchContext(searchContext);
|
|
|
@@ -150,9 +154,17 @@ function LDTable<T extends Record<string, any>>(props: Props<T>): ReactElement {
|
|
|
>
|
|
|
<tbody className="ld-table-body">
|
|
|
{getRowModel().rows.length > 0 ? (
|
|
|
- getRowModel().rows.map(function({id, getVisibleCells}) {
|
|
|
+ getRowModel().rows.map(function({
|
|
|
+ id,
|
|
|
+ getVisibleCells,
|
|
|
+ original,
|
|
|
+ }) {
|
|
|
return (
|
|
|
- <BodyTr getVisibleCells={getVisibleCells} key={id} />
|
|
|
+ <BodyTr
|
|
|
+ getVisibleCells={getVisibleCells}
|
|
|
+ key={id}
|
|
|
+ highlight={original[hightlightKey as string ?? 'id'] === highlightValue}
|
|
|
+ />
|
|
|
);
|
|
|
})
|
|
|
) : (
|