Skip to content

Commit

Permalink
chore: review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayushi Sharma committed Sep 21, 2023
1 parent 1b2bf1e commit fb1a0f3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
13 changes: 9 additions & 4 deletions packages/apsara-ui/src/Listing/Listing.types.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { IVirtualTable } from "../Table/VirtualisedTable";
import { Column } from "../TableV2/VirtualisedTable";

export type ColumnRenderFunc<T> = (path: string, x: any) => Column<T>[];

export interface ListingProps<T> {
list?: T[];
loading?: boolean;
Expand All @@ -8,7 +11,7 @@ export interface ListingProps<T> {
rowKey?: string;
className?: string;
tableProps?: {
getColumnList?: (path: string, sortedInfo: any) => Column<T>[];
getColumnList?: ColumnRenderFunc<T> | undefined;
selectedRowId?: number;
scroll?: any;
} & Omit<IVirtualTable, "columns" | "items">;
Expand All @@ -18,9 +21,11 @@ export interface ListingProps<T> {
searchFields?: string[];
disabled?: boolean;
};
renderExtraFilters?: React.ReactNode | null;
renderHeader?: React.ReactNode | null;
renderBody?: React.ReactNode | null;
calculateRowHeight?: (index: number, defaultRowHeight: number) => number;
calculateColumnWidth?: (index: number, defaultColumnWidth: number) => number;
renderExtraFilters?: React.ReactNode;
renderHeader?: React.ReactNode;
renderBody?: React.ReactNode;
rowClick?: (props: any) => any;
sortable?: boolean;
defaultSearchTerm?: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/apsara-ui/src/Table/VirtualisedTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export interface IVirtualTable extends TableProps<any> {
};
loadMore?: () => Promise<void> | null;
onRowClick?: (event: any, rowIndexData: any) => void;
calculateRowHeight?: any;
calculateColumnWidth?: any;
calculateRowHeight?: (index: number, defaultRowHeight: number) => number;
calculateColumnWidth?: (index: number, defaultRowHeight: number) => number;
alternate?: boolean;
alternateHover?: boolean;
className?: string;
Expand Down
12 changes: 7 additions & 5 deletions packages/apsara-ui/src/TableV2/VirtualisedTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ interface ITableProps {
loading?: boolean;
}

type RenderFunction<T, U = T> = (props: { row: { original: U } }) => any;

export type Column<T> = {
key: string;
title: string;
dataIndex: string;
sorter?: (a: T, b: T) => number;
key?: string | undefined;
title?: string;
dataIndex?: string;
sorter?: (a: any, b: any) => number;
sortOrder?: any;
ellipsis?: boolean;
width?: number;
render?: React.ReactNode | null;
render?: RenderFunction<T>;
};

function VirtualisedTable({
Expand Down

0 comments on commit fb1a0f3

Please sign in to comment.