/// import { EnumValues, Properties, PropertiesOrBuilder } from "./properties"; /** * Specification for defining an entity * @category Models */ export interface EntitySchema { /** * Singular name of the entity as displayed in an Add button . E.g. Product */ name: string; /** * Description of this entity */ description?: string; /** * If this prop is not set, the ID of the document will be created by the * datasource. * * You can set the value to 'true' to force the users to choose the ID. * * You can set the value to 'optional' to allow the users to choose the ID, * If the ID is empty, an automatic ID will be set. * * You can also pass a set of values (as an {@link EnumValues} object) to * allow users to pick from only those. */ customId?: boolean | "optional" | EnumValues; /** * Set of properties that compose an entity */ properties: PropertiesOrBuilder; /** * When creating a new entity, set some values as already initialized */ defaultValues?: any; /** * Array of builders for rendering additional panels in an entity view. * Useful if you need to render custom views */ views?: EntityCustomView[]; } /** * @category Models */ export declare type EntitySchemaResolverProps = { entityId?: string | undefined; values?: Partial>; previousValues?: Partial>; }; /** * Use to resolve the schema properties for specific path, entity id or values. * @category Models */ export declare type EntitySchemaResolver = ({ entityId, values, previousValues }: EntitySchemaResolverProps) => ResolvedEntitySchema; /** * This is the same entity schema you define, only all the property builders * are resolved to regular `Property` objects. * @category Models */ export declare type ResolvedEntitySchema = Omit, "properties"> & { properties: Properties; originalSchema: EntitySchema; }; /** * New or existing status * @category Models */ export declare type EntityStatus = "new" | "existing" | "copy"; /** * Representation of an entity fetched from the datasource * @category Models */ export interface Entity { /** * Id of the entity */ id: string; /** * A string representing the path of the referenced document (relative * to the root of the database). */ path: string; /** * Current values */ values: EntityValues; } /** * This type represents a record of key value pairs as described in an * entity schema. * @category Models */ export declare type EntityValues = M; /** * Class used to create a reference to an entity in a different path */ export declare class EntityReference { /** * Id of the entity */ readonly id: string; /** * A string representing the path of the referenced document (relative * to the root of the database). */ readonly path: string; constructor(id: string, path: string); get pathWithId(): string; } export declare class GeoPoint { /** * The latitude of this GeoPoint instance. */ readonly latitude: number; /** * The longitude of this GeoPoint instance. */ readonly longitude: number; constructor(latitude: number, longitude: number); } /** * @ignore */ export declare type InferSchemaType = S extends EntitySchema ? M : never; /** * You can use this builder to render a custom panel in the entity detail view. * It gets rendered as a tab. * @category Models */ export declare type EntityCustomView = { path: string; name: string; builder: (extraActionsParams: EntityCustomViewParams) => React.ReactNode; }; /** * Parameters passed to the builder in charge of rendering a custom panel for * an entity view. * @category Models */ export interface EntityCustomViewParams { /** * Schema used by this entity */ schema: ResolvedEntitySchema; /** * Entity that this view refers to. It can be undefined if the entity is new */ entity?: Entity; /** * Modified values in the form that have not been saved yet. * If the entity is not new and the values are not modified, these values * are the same as in `entity` */ modifiedValues?: EntityValues; }