import React from "react"; import { CascadingRefAnswerValue, CascadingRefsAnswerValue } from "../response"; import { CascadingRefQuestion } from "../formDesign"; import { Expr, Row, Schema } from "@mwater/expressions"; /** Localizes strings. Must be called as T("some string") or someThing.T("some string") */ type LocalizeString = (str: string, ...args: any[]) => string; export interface Props { question: CascadingRefQuestion; /** Row _id, or array of row _ids if question.multiSelectLast */ value?: CascadingRefAnswerValue | CascadingRefsAnswerValue; onValueChange: (value?: CascadingRefAnswerValue | CascadingRefsAnswerValue) => void; /** Schema which includes the custom tableset */ schema: Schema; /** Localizer to use */ T: LocalizeString; /** Locale to use */ locale?: string; /** Get all rows of a custom table * @param tableId table id e.g. custom.abc.xyz */ getCustomTableRows: (tableId: string, filter: Expr, locale?: string) => Promise; /** Get a specific row of a custom table */ getCustomTableRow: (tableId: string, rowId: string) => Promise; /** * entityType: e.g. "water_point" * entityId: _id of entity * callback: called with an entity e.g. { _id: some id, a: "abc", b: 123 } or callback null if entity not found */ getEntityById: (entityType: string, entityId: string, callback: (entity: any) => void) => void; /** True if an alternate is selected. Resets editing mode */ alternateSelected?: boolean; } export interface CascadingRefAnswerComponentRef { validate: () => string | boolean | null; } export declare const CascadingRefAnswerComponent: React.ForwardRefExoticComponent>; export {};