synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
101 lines • 4.07 kB
TypeScript
import { CardConfiguration } from '@/components/CardContainer/CardConfiguration';
import { CardLink } from '@/components/CardContainer/CardLink';
import { LockedColumn, UniqueFacetIdentifier } from '@/utils';
import { SQLOperator } from '@/utils/functions/SqlFunctions';
import { Query, SelectColumn, SortDirection } from '@sage-bionetworks/synapse-types';
import React from 'react';
import { SxProps } from '@mui/material';
import { IconSvgProps } from '../IconSvg';
import { QueryVisualizationWrapperProps } from '../QueryVisualizationWrapper';
/**
* Used when a column value should link to an external URL defined by a value in another column.
* Currently only works in SynapseTable (not cards!)
*/
export interface ColumnSpecifiedLink {
isMarkdown: false;
matchColumnName: string;
linkColumnName: string;
tooltipText?: string;
}
/**
* Used when a column value should be previewed
* Currently only works in SynapseTable (not cards!)
*/
export interface EntityImage {
matchColumnName: string;
isEntityImage: boolean;
}
export type MarkdownLink = {
isMarkdown: true;
matchColumnName: string;
tooltipText?: string;
};
export type SortConfiguration = {
defaultColumn: string;
defaultDirection: SortDirection;
sortableColumns: string[];
};
export type CTACardLink = {
text: string;
link: string;
};
export type DescriptionConfig = {
isMarkdown?: boolean;
showFullDescriptionByDefault?: boolean;
};
export type MapValueToReactComponentConfig = {
matchColumnName: string;
Component: React.ComponentType<{
value: string | string[] | null;
selectColumn: SelectColumn;
}>;
isMapValueToReactNodeConfig: true;
};
export type LabelLinkConfig = (MarkdownLink | CardLink | ColumnSpecifiedLink | EntityImage | MapValueToReactComponentConfig)[];
export type ColumnIconConfig = IconSvgProps & {
containerSx?: SxProps;
};
export type ColumnIconConfigs = {
columns: {
[index: string]: {
[index: string]: ColumnIconConfig;
};
};
};
export type QueryOrDeprecatedSearchParams = {
/** The initial SQL query which will be used to populate the data in the component */
query?: Query;
/** @deprecated use `query` */
sql?: string;
/** Optional limit for the number of cards shown per page
* @deprecated use `query */
limit?: number;
/** Applies filters to the query where the key is the column name and the value is the value to filter on.
* The filter function is controlled by sqlOperator.
* @deprecated use `query` */
searchParams?: Record<string, string>;
/** Operator used in the filter created using the searchParams prop
* @deprecated use `query` */
sqlOperator?: SQLOperator;
};
export type CardContainerLogicProps = QueryOrDeprecatedSearchParams & {
/** Optional title to display above the component */
title?: string;
isAlignToLeftNav?: boolean;
/** Provide a `SortConfiguration` that can be used to render UI to toggle the sorting of the cards. */
sortConfig?: SortConfiguration;
/** Configuration used to render UI that can be used to alter a filter against a column with enumerated facets. */
topLevelEnumeratedFacetToFilter?: UniqueFacetIdentifier;
/** Optional column to 'lock'; Values and filter controls for a locked column will not be displayed in the UI. */
lockedColumn?: LockedColumn;
/** Optionally limit the initial number of cards shown on the first page */
initialLimit?: number;
multiCardList?: boolean;
cardConfiguration: CardConfiguration;
} & Pick<QueryVisualizationWrapperProps, 'rgbIndex' | 'unitDescription' | 'columnAliases' | 'noContentPlaceholderType' | 'additionalFiltersSessionStorageKey'>;
/**
* Class wraps around CardContainer and serves as a standalone logic container for rendering cards.
*/
export declare function CardContainerLogic(props: CardContainerLogicProps): import("react/jsx-runtime").JSX.Element;
export default CardContainerLogic;
//# sourceMappingURL=CardContainerLogic.d.ts.map