import { Paths, Get, OmitIndexSignature } from 'type-fest'; import { ToString } from 'type-fest/source/internal'; import { LiteralStringUnion } from 'type-fest/source/literal-union'; import { PathsOptions, DefaultPathsOptions } from 'type-fest/source/paths'; import { VNode } from 'vue'; import { BagelInputShellProps } from '../components/form/inputs/bagelInputShell'; interface Option { label: string; value: any; } export type _Path = ToString, PO>>; type IndexSignaturePaths = { [K in keyof T]: T[K] extends { [key: string]: any; } ? `${K & string}.${string}` : never; }[keyof T]; export type Path = FieldVal> extends Array ? LiteralStringUnion<_Path> : _Path | IndexSignaturePaths | `${keyof T & string}.more_info.${string}`; /** The value type at path P in object T. Falls back to unknown if resolution fails. */ export type FieldVal> = unknown extends Get ? unknown : Get; /** Field value type that preserves type information when possible. */ export type SmartFieldVal> = P extends string ? P extends keyof T ? T[P] : any : FieldVal; export type AttributeValue = string | number | boolean | undefined | { [key: string]: any; }; export type AttributeFn> = (field: SmartFieldVal, row?: T) => AttributeValue; export interface Attributes> { [key: string]: AttributeValue | AttributeFn; } export type FieldOptions> = string | ({ label?: string; value: string | number; } | string | number | boolean | { [key: string]: any; })[] | ((val?: SmartFieldVal, rowData?: T) => Option[] | ((query: string) => Promise)) | ((query: string, val?: SmartFieldVal, rowData?: T) => Promise); export type VIfType> = string | boolean | ((val?: SmartFieldVal, rowData?: T) => boolean); export type ValidationFn> = (val?: SmartFieldVal, rowData?: T) => string | undefined; export type TransformFn> = (val?: SmartFieldVal, rowData?: T) => any; export type UpdateFn> = (val?: SmartFieldVal, rowData?: T) => unknown; export type VNodeFn> = (props: { row?: T; field: BaseBagelField; }) => VNode; export interface ElementField { $el: any; id?: Path | string; class?: any; vIf?: any; style?: Record; attrs?: Record; onClick?: (val?: any, rowData?: T) => void; transform?: (val?: any, rowData?: T) => any; children?: ElementField[]; } type ValidBaseBagelField = { [P in Path]: BaseBagelField; }[Path]; export type SchemaChild, PO extends PathsOptions = DefaultPathsOptions> = Field | ElementField | VNode | VNodeFn | string | ValidBaseBagelField; export interface BaseBagelField, PO extends PathsOptions = DefaultPathsOptions> { '$el'?: string | any; 'id'?: P; 'label'?: string; 'placeholder'?: string; 'class'?: AttributeValue | AttributeFn; 'attrs'?: Attributes; 'required'?: boolean; 'disabled'?: boolean; 'helptext'?: string; 'options'?: FieldOptions; 'children'?: SchemaChild, PO>[]; 'slots'?: { [key: string]: SchemaChild, PO>[]; }; 'defaultValue'?: any; 'vIf'?: VIfType; 'v-if'?: VIfType; 'transform'?: TransformFn; 'onUpdate'?: UpdateFn; 'validate'?: ValidationFn; } export type Field = ValidBaseBagelField; export type SchemaField = Field | ElementField; export type BglFormSchemaT = (SchemaField | BaseBagelField, PO>)[]; export interface ValidateInputBaseT { validate?: ValidationFn<{ [key: string]: unknown; }, string>; getFormData?: () => any; } export interface UploadInputProps extends BagelInputShellProps { id?: string; name?: string; label?: string; multiple?: boolean; modelValue?: string | string[]; width?: string; height?: string | 'auto'; dirPath?: string; fill?: boolean; oval?: boolean; theme?: 'dropzone' | 'basic'; accept?: string; capture?: boolean | 'user' | 'environment'; required?: boolean; disabled?: boolean; baseURL?: string; placeholder?: string; /** Alias for dropzone placeholder text (same as `placeholder` when theme is dropzone). */ dropPlaceholder?: string; noFilePlaceholder?: string; btnPlaceholder?: string; error?: string; showIcon?: boolean; icon?: string; iconSize?: number | string; iconMobileSize?: number | string; } export {}; //# sourceMappingURL=BagelForm.d.ts.map