UNPKG

alinea

Version:
36 lines (35 loc) 2.37 kB
import type { WithoutLabel } from 'alinea/core/Field'; import type { InferStoredValue } from 'alinea/core/Infer'; import type { Label } from 'alinea/core/Label'; import type { Type } from 'alinea/core/Type'; import type { ListRow } from 'alinea/core/shape/ListShape'; import { type LinkFieldOptions } from 'alinea/field/link/LinkField'; import { type EntryPickerOptions } from 'alinea/picker/entry'; import type { EntryReference } from 'alinea/picker/entry/EntryReference'; export interface EntryLink<InferredFields = undefined> extends EntryReference { entryId: string; entryType: string; title: string; path: string; href: string; fields: InferredFields; } export declare namespace EntryLink { const entryId: import("alinea/core/Expr").Expr<string>; const title: import("alinea/core/Expr").Expr<string>; const entryType: import("alinea/core/Expr").Expr<string>; const url: import("alinea/core/Expr").Expr<string>; const href: import("alinea/core/Expr").Expr<string>; const path: import("alinea/core/Expr").Expr<string>; } interface EntryOptions<Fields> extends LinkFieldOptions<EntryReference & InferStoredValue<Fields>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> { } export declare function entry<Fields = undefined>(label: Label, options?: WithoutLabel<EntryOptions<Fields>>): import("alinea/field/link/LinkField").LinkField<EntryReference & InferStoredValue<Fields>, EntryLink<{ [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: { [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; }[K]; } : never>>; export declare namespace entry { type EntryRow<Fields> = EntryLink<Type.Infer<Fields>> & ListRow; interface EntryOptions<Fields> extends LinkFieldOptions<Array<EntryReference & ListRow & InferStoredValue<Fields>>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> { } export function multiple<Fields = undefined>(label: Label, options?: WithoutLabel<EntryOptions<Fields>>): import("alinea/field/link/LinkField").LinksField<EntryReference & ListRow, EntryRow<Fields>>; export {}; } export {};