infinity-forge
Version:
33 lines (32 loc) • 1.14 kB
TypeScript
import { IconsNames } from '../../../../../ui/icons/index.js';
import { IFormHandler } from '../interfaces.js';
import * as Inputs from '../../index.js';
import { IInputSearch } from '../../../../../system/components/data/input-search/interfaces.js';
export type InputPropsDynamic<T = any> = {
name: keyof T;
InputComponent: keyof typeof Inputs;
} & Partial<Omit<Inputs.InputProps, 'name'>> & Partial<Omit<Pick<IInputSearch, 'enableSubmitForm'>, 'onChange'>>;
export type DynamicFormHandlerProps<T = any> = Partial<IFormHandler> & {
button?: {
text?: string;
icon?: IconsNames;
};
initialDataIsTableItem?: boolean;
tableItem?: any;
title?: string;
subtitle?: string;
inputs?: InputPropsDynamic<T>[][];
getDetails?: {
key: (params: {
[key in keyof T]: T[key];
}) => string;
fetcher: (params: {
[key in keyof T]: T[key];
}) => Promise<any>;
};
modifier?: {
[key in InputPropsDynamic["name"]]: {
[key in keyof Partial<InputPropsDynamic>]: (value: any, initialValue: any) => any;
};
};
};