UNPKG

@vtaits/form-schema

Version:

Serialization and parsing form values by schema

25 lines (19 loc) 881 B
import { o as FieldType } from './types-DafXrhi5.js'; import { B as BaseFieldSchema } from './types-BSr5Y0bw.js'; declare const DEFAULT_VALUE_KEY = "value"; declare const DEFAULT_LABEL_KEY = "label"; type SelectParams = { options: readonly unknown[]; valueKey?: string; labelKey?: string; getOptionValue?: (option: unknown) => string | number; getOptionLabel?: (option: unknown) => string; }; type SelectSchema<FormApi> = BaseFieldSchema<FormApi, unknown> & SelectParams; type MultiSelectSchema<FormApi> = BaseFieldSchema<FormApi, readonly unknown[]> & SelectParams & { minLength?: number; maxLength?: number; }; declare const multiSelect: FieldType<MultiSelectSchema<unknown>>; declare const select: FieldType<SelectSchema<unknown>>; export { DEFAULT_LABEL_KEY, DEFAULT_VALUE_KEY, type MultiSelectSchema, type SelectSchema, multiSelect, select };