synapse-react-client
Version:
[](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [](https://badge.fury.io/js/synaps
112 lines (111 loc) • 4.48 kB
TypeScript
import * as React from 'react';
import { EntityHeader, FacetColumnResultValues, QueryBundleRequest, Row, SortItem, UserGroupHeader, UserProfile, FacetColumnRequest, ColumnType, ColumnModel } from '../../utils/synapseTypes/';
import { QueryWrapperChildProps } from '../QueryWrapper';
import { LabelLinkConfig } from '../CardContainerLogic';
export declare const EMPTY_HEADER: EntityHeader;
declare type Direction = '' | 'ASC' | 'DESC';
export declare const SORT_STATE: Direction[];
export declare const DOWNLOAD_OPTIONS_CONTAINER_CLASS = "SRC-download-options-container";
declare type Info = {
index: number;
name: string;
};
export declare type SynapseTableState = {
sortedColumnSelection: SortItem[];
columnIconSortState: number[];
isExportTableDownloadOpen: boolean;
isExpanded: boolean;
isEntityView: boolean;
isFileView: boolean;
mapEntityIdToHeader: Record<string, EntityHeader>;
mapUserIdToHeader: Record<string, Partial<UserGroupHeader & UserProfile>>;
isColumnSelectionOpen: boolean;
isFetchingEntityHeaders: boolean;
isFetchingEntityVersion: boolean;
};
export declare type SynapseTableProps = {
visibleColumnCount?: number;
title?: string;
showAccessColumn?: boolean;
showDownloadColumn?: boolean;
columnLinks?: LabelLinkConfig;
hideDownload?: boolean;
isRowSelectionVisible?: boolean;
};
export default class SynapseTable extends React.Component<QueryWrapperChildProps & SynapseTableProps, SynapseTableState> {
constructor(props: QueryWrapperChildProps & SynapseTableProps);
static contextType: React.Context<import("../../utils/SynapseContext").SynapseContextType | undefined>;
resizer: any;
tableElement: HTMLTableElement | null | undefined;
componentWillUnmount(): void;
componentDidMount(): void;
shouldComponentUpdate(nextProps: QueryWrapperChildProps & SynapseTableProps, nextState: Readonly<SynapseTableState>, nextContext: any): boolean;
componentDidUpdate(prevProps: QueryWrapperChildProps & SynapseTableProps): void;
getTableConcreteType(prevProps: QueryWrapperChildProps & SynapseTableProps): Promise<void>;
enableResize(): void;
disableResize(): void;
getEntityHeadersInData(forceRefresh: boolean): Promise<void>;
/**
* Display the view
*/
render(): JSX.Element;
private showGroupRowData;
private renderTable;
/**
* Return the select column indexes for columns that use the aggregate count function.
* If sql does not have a GROUP BY, this returns an empty array.
* @param originalSql
*/
getCountFunctionColumnIndexes(originalSql: string): number[];
getSqlUnderlyingDataForRow(selectedRow: Row, originalSql: string): {
synId: string;
newSql: string;
};
/**
* Handle a click on next or previous
*
* @memberof SynapseTable
*/
private handlePaginationClick;
/**
* Handle a column having been selected
*
* @memberof SynapseTable
*/
handleColumnSortPress: (dict: Info) => (_: React.SyntheticEvent) => void;
private createTableRows;
isSortableColumn(column: ColumnType): boolean;
private createTableHeader;
/**
* Utility to search through array of objects and find object with key "column"
* equal to input parameter "name"
*
* @param {*} sortedColumnSelection
* @param {*} name
* @returns -1 if not present, otherwise the index of the object
* @memberof SynapseTable
*/
private findSelectionIndex;
private advancedSearch;
private getLengthOfPropsData;
/**
* Handles the toggle of a column select, this will cause the table to
* either show the column or hide depending on the prior state of the column
*
* @memberof SynapseTable
*/
toggleColumnSelection: (columnName: string) => void;
/**
* Show the dropdown menu for a column that has been faceted
*
* @param {number} index this is column index of the query table data
* @param {string} columnName this is the name of the column
* @param {FacetColumnResult[]} facetColumnResults
* @param {number} facetIndex
* @returns
* @memberof SynapseTable
*/
configureFacetDropdown(facetColumnResult: FacetColumnResultValues, columnModel: ColumnModel, lastQueryRequest: QueryBundleRequest, facetAliases?: {}): JSX.Element;
applyChangesFromQueryFilter: (facets: FacetColumnRequest[]) => void;
}
export {};