UNPKG

@logilab/cwelements

Version:

Library of reusable React components for building web application with cubicweb

88 lines (87 loc) 4.22 kB
import * as React from 'react'; import { providers } from '@logilab/cwclientlibjs'; import { EntityRelationsGroupProps, EntityRelationsGroup } from './EntityRelationsGroup'; import { ProvidersContext } from './commons'; /** * The props for this component */ export interface MergedEntityRelationsGroupProps extends EntityRelationsGroupProps { /** * Renders the edit button for the group * @param component The current component (this) */ renderEditButton: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps>) => JSX.Element; /** * Renders the title for the group * @param component The current component (this) */ renderTitle: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps>) => JSX.Element; /** * Renders a particular relation value * @param component The current component (this) */ renderValue: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps>, index: number) => JSX.Element; } /** * State for this component */ export interface MergedEntityRelationsGroupState { /** * The starting index of values for a specific relation in the common arrays of values and names */ relationsStart: number[]; /** * The number of values of each specific relation in the common arrays of values and names */ relationsCount: number[]; /** * The EID of the related entities */ values: number[]; /** * The displayable names of the related entities */ displays: (JSX.Element | null)[]; } /** * Default props for a merged entity relations group */ export declare const MERGED_ENTITY_RELATIONS_GROUP_DEFAULT_PROPS: { renderEditButton: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps>) => JSX.Element; renderTitle: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps>) => JSX.Element; renderValue: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps, MergedEntityRelationsGroupState>, index: number) => JSX.Element; render: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps, MergedEntityRelationsGroupState>) => JSX.Element; editable: boolean; className: string; onClickGotoTarget: (eid: number) => void; onClickEdit: (relations: providers.EntityRelationSchema[]) => void; getTargetLink: (eid: number) => string; renderDisplayValue: (entity: providers.Entity, schema: providers.EntitySchema) => JSX.Element; renderRelation: (component: EntityRelationsGroup<EntityRelationsGroupProps, {}>, relation: providers.EntityRelationSchema) => JSX.Element; }; /** * Component for rendering an arbitrary entity relation */ export declare class MergedEntityRelationsGroup extends EntityRelationsGroup<MergedEntityRelationsGroupProps, MergedEntityRelationsGroupState> { static contextType: React.Context<import("./commons").ProvidersContextType>; context: React.ContextType<typeof ProvidersContext>; static defaultProps: { renderEditButton: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps, {}>) => JSX.Element; renderTitle: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps, {}>) => JSX.Element; renderValue: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps, MergedEntityRelationsGroupState>, index: number) => JSX.Element; render: (component: EntityRelationsGroup<MergedEntityRelationsGroupProps, MergedEntityRelationsGroupState>) => JSX.Element; editable: boolean; className: string; onClickGotoTarget: (eid: number) => void; onClickEdit: (relations: providers.EntityRelationSchema[]) => void; getTargetLink: (eid: number) => string; renderDisplayValue: (entity: providers.Entity, schema: providers.EntitySchema) => JSX.Element; renderRelation: (component: EntityRelationsGroup<EntityRelationsGroupProps, {}>, relation: providers.EntityRelationSchema) => JSX.Element; }; state: MergedEntityRelationsGroupState; _isMounted: boolean; constructor(props: Readonly<MergedEntityRelationsGroupProps>); componentDidMount(): void; componentWillUnmount(): void; render(): JSX.Element; }