ehsas_react-papaparse
Version:
The fastest in-browser CSV (or delimited text) parser for React. It is full of useful features such as CSVReader, CSVDownloader, readString, jsonToCSV, readRemoteFile, ... etc.
64 lines (63 loc) • 2.55 kB
TypeScript
export declare const FILE_INVALID_TYPE = "file-invalid-type";
export declare const FILE_TOO_LARGE = "file-too-large";
export declare const FILE_TOO_SMALL = "file-too-small";
export declare const TOO_MANY_FILES = "too-many-files";
export declare function formatFileSize(size: number): string;
export declare function lightenDarkenColor(col: string, amt: number): string;
export declare function isIeOrEdge(userAgent?: string): boolean;
export declare function isPropagationStopped(event: any): any;
/**
* This is intended to be used to compose event handlers
* They are executed in order until one of them calls `event.isPropagationStopped()`.
* Note that the check is done on the first invoke too,
* meaning that if propagation was stopped before invoking the fns,
* no handlers will be executed.
*
* @param {Function} fns the event hanlder functions
* @return {Function} the event handler to add to an element
*/
export declare function composeEventHandlers(...fns: any[]): (event: any, ...args: any[]) => boolean;
export declare function isEventWithFiles(event: any): boolean;
/**
* Check if the provided file type should be accepted by the input with accept attribute.
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#attr-accept
*
* Inspired by https://github.com/enyo/dropzone
*
* @param file {File} https://developer.mozilla.org/en-US/docs/Web/API/File
* @param acceptedFiles {string}
* @returns {boolean}
*/
export declare function accepts(file: any, acceptedFiles: any): any;
export declare const getInvalidTypeRejectionErr: (accept: any) => {
code: string;
message: string;
};
export declare function fileAccepted(file: any, accept: any): any[];
export declare function fileMatchSize(file: any, minSize: any, maxSize: any): (boolean | {
code: string;
message: string;
})[] | (boolean | null)[];
export declare const getTooLargeRejectionErr: (maxSize: any) => {
code: string;
message: string;
};
export declare const getTooSmallRejectionErr: (minSize: any) => {
code: string;
message: string;
};
export declare const TOO_MANY_FILES_REJECTION: {
code: string;
message: string;
};
export declare function onDocumentDragOver(event: any): void;
interface Params {
files?: any;
accept?: any;
minSize?: number;
maxSize?: number;
multiple?: any;
maxFiles?: any;
}
export declare function allFilesAccepted({ files, accept, minSize, maxSize, multiple, maxFiles, }: Params): any;
export {};