import React from 'react'; import { FilterTypeProps, ValueMatcher } from 'common/src/components/Filter'; import { RowProps } from 'common/src/components/TableView'; import { Field } from 'common/src/components/types'; import { UserSettings } from './types'; /** * @param T type to be displayed in the list */ export interface StandardPageProps { /** * Component displayed close to the top right corner. By convention it's usually "add" or "create" button. */ addButton?: JSX.Element; /** * Source of data. Tuple should consist of: * @param T[] array of items * @param loading flag that indicates if loading is in progress * @param error flag indicating error */ dataSource: [T[], boolean, boolean]; /** * Fields to be displayed (from the provided type T). */ fieldsMetadata: Field[]; /** * Currently used namespace. */ namespace: string; /** * Maps entity of type T to a table row. */ RowMapper: React.FunctionComponent>; /** * Filter types that will be used. * Default are: EnumFilter and FreetextFilter */ supportedFilters?: { [type: string]: (props: FilterTypeProps) => JSX.Element; }; /** * Extract value from fields and compare to selected filter. * The default matchers support the default filters. */ supportedMatchers?: ValueMatcher[]; title: string; /** * Information displayed when the data source returned no items. */ customNoResultsFound?: JSX.Element; /** * Information displayed when the data source returned some items but due to applied filters no items can be shown. */ customNoResultsMatchFilter?: JSX.Element; /** * 1. 'on' - always show pagination controls * 2. 'off' - disable * 3. auto - display if unfiltered number of items is greater than provided threshold * * Default value: 10 */ pagination?: number | 'on' | 'off'; /** * Prefix for filters stored in the query params part of the URL. * By default no prefix is used - the field ID is used directly. */ filterPrefix?: string; /** * User settings store to initialize the page according to user preferences. */ userSettings?: UserSettings; } /** * Standard list page. */ export declare function StandardPage({ namespace, dataSource: [flattenData, loaded, error], RowMapper, title, addButton, fieldsMetadata, supportedFilters, customNoResultsFound, customNoResultsMatchFilter, pagination, userSettings, filterPrefix, supportedMatchers, }: StandardPageProps): JSX.Element; export default StandardPage;