@gooddata/react-components
Version:
GoodData React Components
110 lines (109 loc) • 4 kB
TypeScript
/// <reference types="react" />
/// <reference types="react-intl" />
import * as React from 'react';
import { InjectedIntlProps, InjectedIntl } from 'react-intl';
import * as GoodData from 'gooddata';
import { IAttributeDisplayForm, IAttributeElement } from './model';
export declare const VISIBLE_ITEMS_COUNT = 10;
export declare const LIMIT = 50;
export interface IValidElementsItem {
uri: string;
title: string;
}
export interface IAttributeMetadata {
getValidElements: (projectId: string, objectId: string, options: Object) => Promise<GoodData.IValidElementsResponse>;
}
export interface IAttributeDropdownProps {
attributeDisplayForm: IAttributeDisplayForm;
projectId: string;
onApply: Function;
fullscreenOnMobile?: boolean;
isUsingIdentifier: boolean;
metadata?: IAttributeMetadata;
getListItem?: Function;
getListLoading?: Function;
getListError?: Function;
getListNoResults?: Function;
}
export interface IAttributeDropdownStateItem {
title: string;
uri: string;
selected?: boolean;
}
export interface IAttributeDropdownState {
items: IAttributeDropdownStateItem[];
totalCount?: number;
selection: IAttributeElement[];
isListReady: boolean;
isListInitialising: boolean;
listError?: any;
isInverted: 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: {}[];
totalCount: number;
};
}>;
export declare function createAfmFilter(id: string, selection: IAttributeElement[], isInverted: boolean): {
[x: string]: string | string[];
id: string;
type: string;
};
export declare class AttributeDropdownWrapped extends React.PureComponent<IAttributeDropdownProps & InjectedIntlProps, IAttributeDropdownState> {
static propTypes: {
attributeDisplayForm: React.Validator<any>;
projectId: React.Validator<any>;
isUsingIdentifier: React.Requireable<any>;
intl: React.Validator<any>;
onApply: React.Validator<any>;
fullscreenOnMobile: React.Requireable<any>;
getListItem: React.Requireable<any>;
getListLoading: React.Requireable<any>;
getListError: React.Requireable<any>;
getListNoResults: React.Requireable<any>;
metadata: React.Requireable<any>;
};
static defaultProps: {
fullscreenOnMobile: boolean;
isUsingIdentifier: boolean;
metadata: typeof GoodData.md;
getListItem: () => JSX.Element;
getListLoading: (_listError: any, {intl}: {
intl: InjectedIntl;
}) => JSX.Element;
getListError: (_listError: any, {intl}: {
intl: InjectedIntl;
}) => JSX.Element;
getListNoResults: (_listError: any, {intl}: {
intl: InjectedIntl;
}) => JSX.Element;
};
private dataSource;
private dropdownRef;
private MediaQuery;
constructor(props: IAttributeDropdownProps & InjectedIntlProps);
componentWillReceiveProps(nextProps: IAttributeDropdownProps): void;
render(): JSX.Element;
private createMediaQuery(fullscreenOnMobile);
private onApply();
private onClose();
private getAttributeElements(uri, query);
private setupDataSource(uri);
private onSelect;
private onSearch;
private onRangeChange;
private onDropdownToggle(isDropdownOpen);
private renderOverlayWrap(overlayContent, applyDisabled?);
private renderList();
private renderButtons(applyDisabled);
}
export declare const AttributeDropdown: React.ComponentClass<IAttributeDropdownProps> & {
WrappedComponent: ReactIntl.ComponentConstructor<IAttributeDropdownProps & InjectedIntlProps>;
};