mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix: events sorting with compact=true is broken (#2141)
* fix: use default sorting for <Events/> as on "timeline" (fresh on top) Signed-off-by: Roman <ixrock@gmail.com> * responding to comments Signed-off-by: Roman <ixrock@gmail.com> * convert comments to jsdoc (table.tsx) Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
4d6cba4741
commit
5029196d15
8 files changed
+101
-61
No files matched your search
@@ -16,6 +16,7 @@ export type TableSortBy = string;
|
||||
export type TableOrderBy = "asc" | "desc" | string;
|
||||
export type TableSortParams = { sortBy: TableSortBy; orderBy: TableOrderBy };
|
||||
export type TableSortCallback<D = any> = (data: D) => string | number | (string | number)[];
|
||||
export type TableSortCallbacks = { [columnId: string]: TableSortCallback };
|
||||
|
||||
export interface TableProps extends React.DOMAttributes<HTMLDivElement> {
|
||||
items?: ItemObject[]; // Raw items data
|
||||
@@ -24,11 +25,11 @@ export interface TableProps extends React.DOMAttributes<HTMLDivElement> {
|
||||
selectable?: boolean; // Highlight rows on hover
|
||||
scrollable?: boolean; // Use scrollbar if content is bigger than parent's height
|
||||
storageKey?: string; // Keep some data in localStorage & restore on page reload, e.g sorting params
|
||||
sortable?: {
|
||||
// Define sortable callbacks for every column in <TableHead><TableCell sortBy="someCol"><TableHead>
|
||||
// @sortItem argument in the callback is an object, provided in <TableRow sortItem={someColDataItem}/>
|
||||
[sortBy: string]: TableSortCallback;
|
||||
};
|
||||
/**
|
||||
* Define sortable callbacks for every column in <TableHead><TableCell sortBy="someCol"><TableHead>
|
||||
* @sortItem argument in the callback is an object, provided in <TableRow sortItem={someColDataItem}/>
|
||||
*/
|
||||
sortable?: TableSortCallbacks;
|
||||
sortSyncWithUrl?: boolean; // sorting state is managed globally from url params
|
||||
sortByDefault?: Partial<TableSortParams>; // default sorting params
|
||||
onSort?: (params: TableSortParams) => void; // callback on sort change, default: global sync with url
|
||||
|
||||
Reference in new issue
Block a user