pagamio-frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
56 lines (55 loc) • 2.54 kB
TypeScript
import React from 'react';
import type { QueryProps } from '../../shared/types';
import type { ChartToolTipProps, DistributionChartTooltip, DistributionQueryProps, MetricData, StatisticsQueryProps, TableColumn, TooltipField } from '../types';
import { processTooltipFields } from '../utils/tooltipUtils';
interface BaseChartProps<TData extends {
id: string | number;
}> {
title?: string;
url?: string;
query: QueryProps;
chartDetails?: {
columns?: any[];
data?: any[];
};
children: (props: {
loading: boolean;
error: any;
isEmpty: boolean;
refresh: () => void;
metricData: any[];
tooltipFormatterFn?: (params: any) => string;
processedTooltipFields?: ReturnType<typeof processTooltipFields>;
}) => React.ReactNode;
detailsModalTitle: string;
statisticsUrl?: string;
itemStatisticsQuery: StatisticsQueryProps;
valueMetricsQuery: StatisticsQueryProps;
averageMetricsQuery: StatisticsQueryProps;
distributionMetricsQuery: DistributionQueryProps;
yAxisDataNameKey: string;
xAxisNameKey: string;
xAxisLabel: string;
yAxisLabel: string;
nameKey: string;
valueKey: string;
dataGridSearchKey: string;
dataGridColumns: TableColumn<TData>[];
dataSearchInputPlaceHolder: string;
chartToolTip?: ChartToolTipProps;
detailsTableTitle?: string;
getChartOptions: (data: MetricData[]) => void;
tooltipValueFormat?: string;
tooltipTitle?: string;
tooltipUnit?: string;
tooltipAdditionalFields?: (string | TooltipField)[];
topFivePerformingChartTitle?: string;
bottomFivePerformingChartTitle?: string;
distributionChartTooltip: DistributionChartTooltip;
showDetailsModal?: boolean;
currencyDisplaySymbol?: string;
}
declare const BaseChart: <TData extends {
id: string | number;
}>({ title, url, query, chartDetails, children, detailsModalTitle, statisticsUrl, itemStatisticsQuery, valueMetricsQuery, averageMetricsQuery, distributionMetricsQuery, yAxisDataNameKey, xAxisNameKey, xAxisLabel, yAxisLabel, nameKey, valueKey, dataGridSearchKey, dataGridColumns, dataSearchInputPlaceHolder, chartToolTip, detailsTableTitle, getChartOptions, tooltipValueFormat, tooltipTitle, tooltipUnit, tooltipAdditionalFields, topFivePerformingChartTitle, bottomFivePerformingChartTitle, distributionChartTooltip, showDetailsModal, currencyDisplaySymbol, ...props }: BaseChartProps<TData>) => import("react/jsx-runtime").JSX.Element;
export default BaseChart;