@s-chat/form-manager
Version:
38 lines • 1.03 kB
TypeScript
export type UniversalValuesType = Record<string, any>;
export type FieldOptionType = {
label: string | number;
value: string | number;
image?: string;
description?: string;
};
export type ErrorListType = {
[errorKey: string]: string;
};
export type FieldSchema<ValueType = any> = {
label: string;
type: string;
validationRules: any;
defaultValue?: ValueType;
options?: FieldOptionType[];
showIf?: {
[fieldName: string]: ValueType;
};
htmlAttr?: {
[htmlAttr: string]: any;
};
errorMessages?: ErrorListType;
onBeforeChange?: (value: ValueType) => void;
onAfterChange?: (value: ValueType) => void;
required?: boolean;
className?: string;
};
export type FormSchema<ValuesType = UniversalValuesType> = {
[key in keyof ValuesType]: FieldSchema<ValuesType[key]>;
};
export type ValidatorDataType<ValuesType> = {
rules: {
[key in keyof ValuesType]: any;
};
data: ValuesType;
};
//# sourceMappingURL=FormManager.d.ts.map