alinea
Version:
Headless git-based CMS
31 lines (30 loc) • 2.77 kB
TypeScript
import type { WithoutLabel } from 'alinea/core/Field';
import type { InferStoredValue } from 'alinea/core/Infer';
import type { Label } from 'alinea/core/Label';
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 FileLink<InferredFields = undefined> extends EntryReference {
title: string;
href: string;
extension: string;
size: number;
fields: InferredFields;
}
export declare namespace FileLink {
const title: import("alinea/core/Expr").Expr<string>;
const url: import("../hidden").HiddenField<string>;
const href: import("../hidden").HiddenField<string>;
const extension: import("../hidden").HiddenField<string>;
const size: import("../hidden").HiddenField<number>;
}
export declare function filePicker<Fields>(multiple: boolean, options: Omit<EntryPickerOptions<Fields>, 'selection'>): import("alinea/core/Picker").Picker<EntryReference, EntryPickerOptions<Fields>>;
export interface FileOptions<Fields> extends LinkFieldOptions<EntryReference & InferStoredValue<Fields>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
}
export declare function file<Fields = undefined>(label: Label, options?: WithoutLabel<FileOptions<Fields>>): import("alinea/field/link/LinkField").LinkField<EntryReference & InferStoredValue<Fields>, FileLink<{ [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 file {
interface FilesOptions<Fields> extends LinkFieldOptions<Array<EntryReference & ListRow & InferStoredValue<Fields>>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
}
function multiple<Fields = undefined>(label: Label, options?: WithoutLabel<FilesOptions<Fields>>): import("alinea/field/link/LinkField").LinksField<EntryReference & ListRow & InferStoredValue<Fields>, FileLink<{ [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>>;
}