@vtaits/form-schema
Version:
Serialization and parsing form values by schema
29 lines (23 loc) • 1.23 kB
TypeScript
import { o as FieldType } from './types-DafXrhi5.js';
import { LoadOptions } from 'select-async-paginate-model';
import { B as BaseFieldSchema } from './types-BSr5Y0bw.js';
type AsyncSelectParams<OptionType, Additional> = {
loadOptions: LoadOptions<OptionType, Additional>;
loadSingleOption?: (rawValue: unknown) => OptionType | Promise<OptionType>;
initialAdditional?: Additional;
additional?: Additional;
valueKey?: string;
labelKey?: string;
getOptionValue?: (option: unknown) => string | number;
getOptionLabel?: (option: unknown) => string;
};
type AsyncSelectSchema<FormApi> = BaseFieldSchema<FormApi, unknown> & AsyncSelectParams<unknown, unknown>;
type AsyncMultiSelectSchema<FormApi> = BaseFieldSchema<FormApi, readonly unknown[]> & AsyncSelectParams<unknown, unknown> & {
minLength?: number;
maxLength?: number;
};
declare const asyncMultiSelect: FieldType<AsyncMultiSelectSchema<unknown>>;
declare const asyncSelect: FieldType<AsyncSelectSchema<unknown>>;
declare const DEFAULT_VALUE_KEY = "value";
declare const DEFAULT_LABEL_KEY = "label";
export { type AsyncMultiSelectSchema, type AsyncSelectSchema, DEFAULT_LABEL_KEY, DEFAULT_VALUE_KEY, asyncMultiSelect, asyncSelect };