rez-table-listing-mui
Version:
A rez table listing component built on TanStack Table
114 lines (101 loc) • 2.51 kB
text/typescript
export interface defaultColumnsProps {
id: number;
name: string;
department: string;
position: string;
email: string;
location: string;
phone: string;
dateOfJoining: string;
salary: number;
performanceRating: string;
subRows?: any;
}
export interface amountFormatProps {
amount: number;
decimal?: boolean;
removeFloat?: boolean;
compactFormat?: "crore" | "10lakh" | "lakh";
}
export interface formatDateProps {
date: string;
style: string;
}
export type alignProps = "left" | "center" | "right";
export interface align {
align: alignProps;
}
export const camelCaseToTitle = (str: string): string => {
if (!str) return "";
return str
.replace(/_/g, " ") // Replace underscores with spaces
.replace(/([a-z])([A-Z])/g, "$1 $2") // Add space between camelCase transitions
.replace(/\b\w/g, (char) => char.toUpperCase()) // Capitalize each word's first letter
.trim();
};
//API INTEGRATION
export interface EntityTableAPIProps {
entity_type?: string;
page: number;
size: number;
tabs?: {
columnName: string;
sortBy: "ASC" | "DSC";
value?: string;
};
sortby?: {
sortColum: string;
sortType: "ASC" | "DSC";
}[];
quickFilter?: {
filter_attribute: string;
filter_operator: string;
filter_value: string[] | string;
}[];
attributeFilter?: {
filter_attribute: string;
filter_operator: string;
filter_value: string[] | string;
}[];
}
export interface viewSettingsDropDownAPIProps {
entity_type: string;
column: string | undefined;
sort_by: string | undefined;
}
interface EntityListTab {
tab_value: string | null;
tab_value_count: string | number;
}
interface EntityList {
id: string;
entity_type: string;
name: string;
status: string | null;
parent_type: string | null;
parent_id: string | null;
code: string;
created_by: string | null;
created_date: string | null;
modified_by: string | null;
modified_date: string | null;
enterprise_id: string | null;
organization_id: number | null;
app_code: string | null;
is_system: number | null;
description: string | null;
}
export interface EntityListingResponse {
data: {
entity_tabs: EntityListTab[];
entity_list: EntityList[];
};
}
export interface APIParamsProps {
page?: number;
size?: number;
}
export type DropdownOption = {
value: string | number;
label: string;
};