UNPKG

ra-core

Version:

Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React

60 lines 2.54 kB
import React, { ReactNode } from 'react'; import { type UseReferenceManyFieldControllerParams } from './useReferenceManyFieldController'; import type { RaRecord } from '../../types'; import { ListControllerResult } from '../list'; /** * Render related records to the current one. * * You must define the fields to be passed to the iterator component as children. * * @example Display all the comments of the current post as a datagrid * <ReferenceManyFieldBase reference="comments" target="post_id"> * <Datagrid> * <TextField source="id" /> * <TextField source="body" /> * <DateField source="created_at" /> * <EditButton /> * </Datagrid> * </ReferenceManyFieldBase> * * @example Display all the books by the current author, only the title * <ReferenceManyFieldBase reference="books" target="author_id"> * <SingleFieldList> * <ChipField source="title" /> * </SingleFieldList> * </ReferenceManyFieldBase> * * By default, restricts the displayed values to 25. You can extend this limit * by setting the `perPage` prop. * * @example * <ReferenceManyFieldBase perPage={10} reference="comments" target="post_id"> * ... * </ReferenceManyFieldBase> * * By default, orders the possible values by id desc. You can change this order * by setting the `sort` prop (an object with `field` and `order` properties). * * @example * <ReferenceManyFieldBase sort={{ field: 'created_at', order: 'DESC' }} reference="comments" target="post_id"> * ... * </ReferenceManyFieldBase> * * Also, you can filter the query used to populate the possible values. Use the * `filter` prop for that. * * @example * <ReferenceManyFieldBase filter={{ is_published: true }} reference="comments" target="post_id"> * ... * </ReferenceManyFieldBase> */ export declare const ReferenceManyFieldBase: <RecordType extends RaRecord = RaRecord, ReferenceRecordType extends RaRecord = RaRecord>(props: ReferenceManyFieldBaseProps<RecordType, ReferenceRecordType>) => React.JSX.Element; export interface ReferenceManyFieldBaseProps<RecordType extends Record<string, any> = Record<string, any>, ReferenceRecordType extends RaRecord = RaRecord> extends UseReferenceManyFieldControllerParams<RecordType, ReferenceRecordType> { children?: ReactNode; render?: (props: ListControllerResult<ReferenceRecordType>) => ReactNode; empty?: ReactNode; error?: ReactNode; loading?: ReactNode; offline?: ReactNode; } //# sourceMappingURL=ReferenceManyFieldBase.d.ts.map