UNPKG

alinea

Version:

[![npm](https://img.shields.io/npm/v/alinea.svg)](https://npmjs.org/package/alinea) [![install size](https://packagephobia.com/badge?p=alinea)](https://packagephobia.com/result?p=alinea)

29 lines (28 loc) 1.43 kB
import type { ListRow, Picker, WithoutLabel } from 'alinea/core'; import { FieldOptions, Reference } from 'alinea/core'; import { ListField } from 'alinea/core/field/ListField'; import { UnionField } from 'alinea/core/field/UnionField'; import { UnionRow } from 'alinea/core/shape/UnionShape'; /** Optional settings to configure a link field */ export interface LinkFieldOptions<Value> extends FieldOptions<Value> { /** Width of the field in the dashboard UI (0-1) */ width?: number; /** Add instructional text to a field */ help?: string; /** Field is optional */ optional?: boolean; /** Display a minimal version */ inline?: boolean; max?: number; } export interface LinkOptions<Value> extends LinkFieldOptions<Value> { pickers: Record<string, Picker<any, any>>; } export declare class LinkField<Row extends Reference & UnionRow> extends UnionField<Row, LinkOptions<Row>> { } export declare function createLink<Row extends Reference & UnionRow>(label: string, options: WithoutLabel<LinkOptions<Row>>): LinkField<Row>; /** Internal representation of a link field */ export declare class LinksField<Row extends Reference & ListRow> extends ListField<Row, LinkOptions<Array<Row>>> { } /** Create a link field configuration */ export declare function createLinks<Row extends Reference & ListRow>(label: string, options: WithoutLabel<LinkOptions<Array<ListRow & Row>>>): LinksField<Row>;