@pagamio/frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
84 lines (83 loc) • 2.19 kB
TypeScript
import type { MRT_ColumnDef } from 'mantine-react-table';
import type { QueryProps } from 'src/shared/types';
export interface MetricData {
[key: string]: any;
}
export type ChartToolTipProps<T = any> = {
[key: string]: T;
};
export interface TableColumn<TData extends Record<string, any>> extends MRT_ColumnDef<TData> {
header: string;
accessor: keyof TData;
enableCopy?: boolean;
formattedCellElement?: (value: string | number) => React.ReactNode;
}
export interface DistributionChartTooltip {
treeMapSegmentLabel: string;
tooltipValueFormat: string;
tooltipTitle: string;
tooltipUnit: string;
tooltipAdditionalFields: (string | TooltipField)[];
}
export type ChartOptionsProps<TData> = {
tooltip?: {
trigger: string;
[key: string]: unknown;
};
legend?: {
orient?: string;
top?: number | string;
left?: string;
padding?: number[];
type?: string;
textStyle?: {
fontSize: number;
};
[key: string]: unknown;
};
color?: string[];
series?: Array<{
name?: string;
type?: string;
radius?: string[];
center?: string[];
data?: TData[];
emphasis?: {
itemStyle?: {
shadowBlur?: number;
shadowOffsetX?: number;
shadowColor?: string;
[key: string]: unknown;
};
};
[key: string]: unknown;
}>;
grid?: {
containLabel: boolean;
};
[key: string]: unknown;
};
export type StatisticsQueryProps = {
title: string;
format: string;
valueKey: string;
previousValueKey?: string;
changeKey: string;
query: QueryProps;
};
export type DistributionQueryProps = {
title: string;
query: QueryProps;
seriesDataValueKey: string;
xAxisDataValueKey: string;
chartToolTip?: ChartToolTipProps;
};
export interface TooltipField {
toolTipkey: string;
valueKey: string;
nameKey: string;
label?: string;
suffix?: string;
format?: string;
formatter?: (value: any, currency?: string, displaySymbol?: string) => string;
}