import { SchemaTypes } from '@vinejs/vine/types'; import { Serializable } from '../types.js'; export type FieldVisibility = { create: boolean; index: boolean; detail: boolean; edit: boolean; }; type FieldType = 'field' | 'panel'; export declare abstract class Field implements Serializable { $type: FieldType; $initialValue?: Value; $name: string; $label: string; $sortable: boolean; $filterable: boolean; $attributes: Record; $searchable: boolean; protected $visibility: FieldVisibility; constructor(name: string); renderCell?(value?: string): Promise<[string, any]>; renderField?(value?: string): Promise<[string, any]>; tableHeadTemplate(): string; /** * Returns the component name for the index vue. */ indexComponent?(): string; /** * Returns the component name for the form vue. */ formComponent?(): string; /** * Returns the component name for the detail vue. */ detailComponent?(): string; /** * Defines the name of this field. */ name(name: string): this; /** * Defines the label of this field. */ label(label: string): this; /** * Defines the default value. */ default(value: Value): this; /** * Makes this field sortable in the index view. */ sortable(sortable?: boolean): this; /** * Makes this field filterable in the index view. */ filterable(filterable?: boolean): this; /** * Makes this field searchable. */ searchable(searchable?: boolean): this; /** * Defines an attribute to the field. * * @example Text.make('title').attribute('placeholder', 'Insert title') */ attribute(name: string, value: any): this; /** * Display the field on specific views. * * @example Text.make('email').showOn('create', 'index') */ showOn(...visibilities: (keyof FieldVisibility)[]): this; /** * Hide the field on specific views. * * @example Text.make('email').hideOn('create', 'index') */ hideOn(...visibilities: (keyof FieldVisibility)[]): this; /** * Show this field on index view. * * @example Text.make('email').showOnIndex() */ showOnIndex(): this; /** * Show this field on detail view. * * @example Text.make('email').showOnIndex() */ showOnDetail(): this; /** * Show this field on create view. * * @example Text.make('email').showOnCreate() */ showOnCreate(): this; /** * Show this field on edit view. * * @example Text.make('email').showOnEdit() */ showOnEdit(): this; /** * Hide this field from index view. * * @example Text.make('email').hideFromIndex() */ hideFromIndex(): this; /** * Hide this field from create view. * * @example Text.make('email').hideFromCreate() */ hideFromCreate(): this; /** * Hide this field from edit view. * * @example Text.make('email').hideFromEdit() */ hideFromEdit(): this; /** * Only show this field on index view. * * @example Text.make('email').onlyOnIndex() */ onlyOnIndex(): this; /** * Only show this field on detail view. * * @example Text.make('email').onlyOnDetail() */ onlyOnDetail(): this; /** * Only show this field on form views. * * @example Text.make('email').onlyOnForms() */ onlyOnForms(): this; /** * Show this field on every view except forms. * * @example Text.make('email').exceptOnForms() */ exceptOnForms(): this; /** * Returns the Vine schema to validate the value. */ $validator(): SchemaTypes | undefined; toJSON(): { type: FieldType; fieldComponent: string | undefined; indexComponent: string | undefined; detailComponent: string | undefined; attributes: Record; visibility: FieldVisibility; sortable: boolean; name: string; label: string; initialValue: Value | undefined; }; } export {};