UNPKG

subhasmitalmg-react-spreadsheet-import

Version:

React spreadsheet import for xlsx and csv files with column matching and validation steps

40 lines (39 loc) 1.66 kB
import type { Data, Fields, RowHook, TableHook } from "../../../types"; import type { Meta } from "../types"; export declare const addErrorsAndRunHooks: <T extends string>(data: (Data<T> & Partial<Meta>)[], fields: readonly { readonly label: string; readonly key: import("ts-essentials").DeepReadonly<T>; readonly description?: string | undefined; readonly alternateMatches?: readonly string[] | undefined; readonly validations?: readonly ({ readonly rule: "required"; readonly errorMessage?: string | undefined; readonly level?: import("../../../types").ErrorLevel | undefined; } | { readonly rule: "unique"; readonly allowEmpty?: boolean | undefined; readonly errorMessage?: string | undefined; readonly level?: import("../../../types").ErrorLevel | undefined; } | { readonly rule: "regex"; readonly value: string; readonly flags?: string | undefined; readonly errorMessage: string; readonly level?: import("../../../types").ErrorLevel | undefined; })[] | undefined; readonly fieldType: { readonly type: "checkbox"; readonly booleanMatches?: { readonly [x: string]: boolean; } | undefined; } | { readonly type: "select"; readonly options: readonly { readonly label: string; readonly value: string; }[]; } | { readonly type: "input"; }; readonly example?: string | undefined; }[], rowHook?: RowHook<T> | undefined, tableHook?: TableHook<T> | undefined) => (Data<T> & Meta)[];