import * as React from 'react'; import { providers } from '@logilab/cwclientlibjs'; import { EntityRelationsEditor, RelationStatus, EntityRelationsEditorProps, EntityRelationsEditorState, EntityRelationsSpecification } from './EntityRelationsEditor'; import { TranslationContext } from './commons'; /** * The props for a relation editor for selecting a single related entity */ export interface SingleEntityRelationsEditorProps extends EntityRelationsEditorProps { /** * Lookups relatable entities using the specified input * @param specification The specification for the related entities */ lookupRelatableEntities: (specification: EntityRelationsSpecification) => Promise; } /** * The state for a relation editor for selecting a single related entity */ export interface SingleEntityRelationsEditorState extends EntityRelationsEditorState { /** * The currently selected entity */ selected: providers.Entity | null; } /** * The default props for an editor of entity relations */ export declare const ENTITY_RELATIONS_EDITOR_SINGLE_PROPS: { className: string; lookupLimitRelatable: number; lookupLimitRelated: number; baseChanges: { added: never[]; removed: never[]; }; lookupRelatableEntities: (specification: EntityRelationsSpecification) => Promise; renderLookup: (component: EntityRelationsEditor) => null; renderRelatable: (component: EntityRelationsEditor, entity: providers.Entity, status: RelationStatus) => JSX.Element; renderContentRelatables: (component: SingleEntityRelationsEditor) => JSX.Element; renderContentLoading: (component: EntityRelationsEditor) => JSX.Element; renderButtonValidate: (component: EntityRelationsEditor) => JSX.Element; renderButtonCancel: (component: EntityRelationsEditor) => JSX.Element; render: (component: EntityRelationsEditor) => JSX.Element; }; /** * The editor of entity relations in the special case of * a cardinality of max 1 for the relatables */ export declare class SingleEntityRelationsEditor extends React.Component implements EntityRelationsEditor { static contextType: React.Context; context: React.ContextType; static defaultProps: { className: string; lookupLimitRelatable: number; lookupLimitRelated: number; baseChanges: { added: never[]; removed: never[]; }; lookupRelatableEntities: (specification: EntityRelationsSpecification) => Promise; renderLookup: (component: EntityRelationsEditor) => null; renderRelatable: (component: EntityRelationsEditor, entity: providers.Entity, status: RelationStatus) => JSX.Element; renderContentRelatables: (component: SingleEntityRelationsEditor) => JSX.Element; renderContentLoading: (component: EntityRelationsEditor) => JSX.Element; renderButtonValidate: (component: EntityRelationsEditor) => JSX.Element; renderButtonCancel: (component: EntityRelationsEditor) => JSX.Element; render: (component: EntityRelationsEditor) => JSX.Element; }; state: SingleEntityRelationsEditorState; _isMounted: boolean; constructor(props: Readonly); componentDidMount(): void; componentWillUnmount(): void; onLookupLoading(): void; onLookupResult(result: providers.Entity[]): void; onSelect(event: React.FormEvent): void; onToggle(entity: providers.Entity, isRelated: boolean): void; render(): JSX.Element; }