@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
110 lines (109 loc) • 4.18 kB
TypeScript
import * as React from "react";
import * as PropTypes from "prop-types";
import { WrappedComponentProps } from "react-intl";
import { IValidElementsResponse } from "@gooddata/gooddata-js";
import { IAttributeDisplayForm, IAttributeElement, IAttribute } from "./model";
export declare const VISIBLE_ITEMS_COUNT = 10;
export interface IValidElementsItem {
uri: string;
title: string;
}
export interface IAttributeMetadata {
getValidElements: (projectId: string, objectId: string, options: object) => Promise<IValidElementsResponse>;
}
export interface IAttributeDropdownProps {
attribute: IAttribute;
attributeDisplayForm: IAttributeDisplayForm;
projectId?: string;
selection: IAttributeElement[];
isInverted: boolean;
onApply: (selection: IAttributeElement[], isInverted: boolean) => void;
fullscreenOnMobile?: boolean;
metadata: IAttributeMetadata;
title?: string;
numericSymbols: string[];
emptyHeaderString: string;
isMobile: boolean;
getListItem?: (...params: any[]) => any;
getListError?: (...params: any[]) => any;
}
export interface IAttributeDropdownStateItem {
title: string;
uri: string;
}
export interface IAttributeDropdownState {
items: IAttributeDropdownStateItem[];
totalCount?: string;
filteredItemsCount?: string;
selection: IAttributeElement[];
prevSelection: IAttributeElement[];
isListReady: boolean;
isListInitialising: boolean;
listError?: any;
isInverted: boolean;
wasInverted: boolean;
filterError?: any;
searchString?: string;
}
export declare function getObjectIdFromUri(uri: string): string;
export declare function getProjectIdFromUri(uri: string): string;
export declare function loadAttributeElements(metadata: IAttributeMetadata, uri: string, searchString: string, offset?: number, limit?: number): Promise<{
data: {
offset: number;
limit: number;
items: Pick<{
uri: string;
title: string;
}, "title" | "uri">[];
totalCount: string;
totalCountWithoutFilters: string;
};
}>;
export declare class AttributeDropdownWrapped extends React.PureComponent<IAttributeDropdownProps & WrappedComponentProps, IAttributeDropdownState> {
static propTypes: {
attribute: PropTypes.Validator<any>;
attributeDisplayForm: PropTypes.Validator<any>;
projectId: PropTypes.Requireable<any>;
selection: PropTypes.Requireable<any>;
isInverted: PropTypes.Requireable<any>;
isMobile: PropTypes.Requireable<any>;
onApply: PropTypes.Validator<any>;
onApplyWithFilterDefinition: PropTypes.Requireable<any>;
fullscreenOnMobile: PropTypes.Requireable<any>;
title: PropTypes.Requireable<any>;
getListItem: PropTypes.Requireable<any>;
getListError: PropTypes.Requireable<any>;
numericSymbols: PropTypes.Requireable<any>;
emptyHeaderString: PropTypes.Requireable<any>;
metadata: PropTypes.Validator<any>;
};
static defaultProps: Partial<IAttributeDropdownProps & WrappedComponentProps>;
private dataSource;
private dropdownRef;
private MediaQuery;
constructor(props: IAttributeDropdownProps & WrappedComponentProps);
componentWillReceiveProps(nextProps: IAttributeDropdownProps): void;
render(): JSX.Element;
onSearch: (searchString: string) => void;
private createMediaQuery;
private backupSelection;
private restoreSelection;
private resetSearchString;
private onApply;
private onCancel;
private getAttributeElements;
private updateSelectionByData;
private setupDataSource;
private onSelect;
private onRangeChange;
private onDropdownToggle;
private getListWidth;
private renderOverlayWrap;
private emptyValueItem;
private getItemKey;
private renderList;
private renderButtons;
}
export declare const AttributeDropdown: React.FunctionComponent<import("react-intl").WithIntlProps<IAttributeDropdownProps & WrappedComponentProps<"intl">>> & {
WrappedComponent: React.ComponentType<IAttributeDropdownProps & WrappedComponentProps<"intl">>;
};