Skip to content

Commit

Permalink
chore: optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Sep 21, 2024
1 parent c0b03a2 commit a2f7a03
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/table/TR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default function TR(props: TrProps) {
);

const classes = useMemo(() => {
const customClasses = formatRowClassNames(rowClassName, { row, rowIndex, type: 'body' }, rowKey || 'id');
const customClasses = formatRowClassNames(rowClassName, { row, rowIndex, rowKey, type: 'body' }, rowKey || 'id');
return [trStyles?.classes, customClasses];
}, [row, rowClassName, rowIndex, rowKey, trStyles?.classes]);

Expand Down
2 changes: 1 addition & 1 deletion src/table/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ export type TableRowAttributes<T> =
export interface RowClassNameParams<T> {
row: T;
rowIndex: number;
rowKey: string;
rowKey?: string;
type?: 'body' | 'foot';
}

Expand Down
2 changes: 1 addition & 1 deletion src/table/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function formatRowClassNames(
let customClasses: ClassName = [];
for (let i = 0, len = rowClassList.length; i < len; i++) {
const rName = rowClassList[i];
let tClass = isFunction(rName) ? rName({ ...params, rowKey }) : rName;
let tClass = isFunction(rName) ? rName(params) : rName;
if (isObject(tClass) && !(tClass instanceof Array)) {
// 根据下标设置行类名
tClass[rowIndex] && (tClass = tClass[rowIndex]);
Expand Down

0 comments on commit a2f7a03

Please sign in to comment.