climb-onyx-gui
Version:
Onyx Graphical User Interface
54 lines (53 loc) • 3.14 kB
TypeScript
import { CustomCellRendererProps } from '@ag-grid-community/react';
import { ColDef } from '@ag-grid-community/core';
import { ExportHandlerProps, OnyxProps } from '../interfaces';
import { Field, RecordType, DetailResponse, ErrorResponse, FilterConfig, Theme, TableRow, InputRow } from '../types';
/** Returns a random hexadecimal string. */
export declare function generateKey(): string;
/** Generate a default file name prefix based on the project code and search parameters. */
export declare function getDefaultFileNamePrefix(project: string, searchParameters: string): string;
interface DetailResponseProps extends OnyxProps {
response: DetailResponse<RecordType> | ErrorResponse | undefined;
}
/** Handler for converting JSON data to a string for file export. */
export declare function handleJSONExport(props: DetailResponseProps): (exportProps: ExportHandlerProps) => void;
/** Takes an array of FilterConfig objects and formats into an array of field (+lookup), value pairs. */
export declare function formatFilters(filters: FilterConfig[]): string[][];
/** Takes a Response object and returns its status code, formatted as a string. */
export declare function formatResponseStatus(response: Response): string;
export declare function formatTimeAgo(timestamp: string): string;
export declare function formatField(field: string): string;
export declare function formatLookup(lookup: string): string;
export declare function formatValue(value: string): string;
/** Converts a string theme value to a Theme enum value, or null if invalid. */
export declare function getTheme(theme: string | null | undefined): Theme | null;
/** Get optimal fields, alongside their `include`/`exclude` operator, to match a set of requested fields. */
export declare function getIncludeExclude(includeList: string[], columnOptions: Field[]): {
operator: string;
fields: string[];
};
/** Get an array of string fields corresponding to the column names in a results table. */
export declare function getColumns(fieldList: string[], columnOptions: Field[]): string[];
/** Get the columns for a table in the (current) accepted format for `getColDefs`. */
export declare function getTableColumns(fieldList: string[], columnOptions: Field[]): TableRow[];
/** Converts InputRow[] to TableRow[]. All non-string/number values are converted to strings. */
export declare function formatData(data: InputRow[]): TableRow[];
/** Sorts TableRow[] in-place, on the specified field and direction. */
export declare function sortData(data: TableRow[], field: string, direction: string): void;
interface ColDefProps {
data: InputRow[];
isServerTable: boolean;
includeOnly?: string[];
flexOnly?: string[];
headerNames?: Map<string, string>;
headerTooltips?: Map<string, string>;
headerTooltipPrefix?: string;
cellRenderers?: Map<string, (params: CustomCellRendererProps) => JSX.Element>;
order?: string;
recordPrimaryID?: string;
analysisPrimaryID?: string;
tooltipFields?: string[];
}
/** Generates column definitions for a table. */
export declare function getColDefs(props: ColDefProps): ColDef[];
export {};