import React from 'react'; import { ColumnProps, TableProps } from 'antd/es/table'; import { WrappedComponentProps } from 'react-intl'; import { MainStoreInjected, MetadataInjected, HasId, MayHaveInstanceName, PaginationChangeCallback, JmixSortOrder, SortOrderChangeCallback, FilterChangeCallback, JmixEntityFilter } from '@haulmont/jmix-react-core'; import { ApolloError } from "@apollo/client"; /** * @typeparam TEntity - entity type. */ export interface DataTableProps extends MainStoreInjected, MetadataInjected, WrappedComponentProps { items?: TEntity[]; count?: number; relationOptions?: Map>; current?: number; pageSize?: number; loading: boolean; error?: ApolloError; /** * Initial state of table filters. * Can be used to set a filtering condition on an entity attribute that is not displayed. */ initialFilter?: JmixEntityFilter[]; onFilterChange: FilterChangeCallback; defaultSortOrder?: JmixSortOrder; onSortOrderChange: SortOrderChangeCallback; onPaginationChange: PaginationChangeCallback; entityName: string; /** * Names of columns that should have filters enabled. * Default: filters will be enabled on all columns. Pass empty array to disable all filters. */ enableFiltersOnColumns?: string[]; enableSortingOnColumns?: string[]; /** * By default, when any number of filters is active, a `Clear filters` control will be displayed above the * table. When clicked, this control disables all filters at once. * If `hideClearFilters` is `true`, then the `Clear filters` control won't be displayed. * Default: `false` */ hideClearFilters?: boolean; /** * A callback that takes the ids of the selected rows. * Can be used together with {@link buttons} to facilitate CRUD operations or other functionality. * * @param selectedRowKeys - entity ids corresponding to the selected rows. */ onRowSelectionChange?: (selectedRowKeys: string[]) => void; /** * `single` allows to select one row at a time. * `multi` allows to select multiple rows. * `none` disables row selection. * Default: `single`. */ rowSelectionMode?: 'single' | 'multi' | 'none'; /** * When `true`, hides the {@link https://ant.design/components/table | selection column}. * Default: `false`. */ hideSelectionColumn?: boolean; /** * When `true`, a row can be selected by clicking on it. * When `false`, a row can only be selected using * the {@link https://ant.design/components/table | selection column}. * Default: `true`. */ canSelectRowByClick?: boolean; /** * Controls that will be rendered above the table. */ buttons?: JSX.Element[]; /** * Can be used to override any of the underlying * {@link https://ant.design/components/table/#Table | Table properties}. */ tableProps?: TableProps; /** * @deprecated use `columnDefinitions` instead. If used together, `columnDefinitions` will take precedence. */ columnProps?: ColumnProps; /** * Describes the columns to be displayed. An element of this array can be * a property name (which will render a column displaying that property; * the column will have the default look&feel) * or a {@link ColumnDefinition} object (which allows creating a custom column). */ columnDefinitions: Array>; } export interface ColumnDefinition { /** * Entity property name. * Use it if you want to create a custom variant of the default property-bound column. * In this case the properties in {@link columnProps} will override the default * look&feel (defaults will still apply to the properties not contained in {@link columnProps}). * If you want to create a custom column that is not bound to an entity property * (e.g. an action button column or a calculated field column), do not use this prop. */ field?: string; /** * If {@link field} is provided, then these properties will override the default look&feel * (defaults will still apply to the properties not contained in {@link columnProps}). * If you want to create a custom column that is not bound to an entity property * (e.g. an action button column or a calculated field column) use this prop only and do not use {@link field}. * In this case only the properties present in {@link columnProps} will be applied to the column. */ columnProps: ColumnProps; } declare const dataTable: React.FC, "metadata">>> & { WrappedComponent: React.ComponentType, "metadata">>; }; export { dataTable as DataTable };