react-csv-importer
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -16,2 +16,3 @@ // Generated by dts-bundle-generator v5.4.0 | ||
delimitersToGuess?: Papa.ParseConfig["delimitersToGuess"]; | ||
chunkSize?: Papa.ParseConfig["chunkSize"]; | ||
} | ||
@@ -51,3 +52,2 @@ export declare type BaseRow = { | ||
export interface ImporterProps<Row extends BaseRow> extends CustomizablePapaParseConfig { | ||
chunkSize?: number; | ||
assumeNoHeaders?: boolean; | ||
@@ -62,4 +62,4 @@ restartable?: boolean; | ||
export declare const ImporterField: React.FC<ImporterFieldProps>; | ||
export declare function Importer<Row extends BaseRow>({ chunkSize, assumeNoHeaders, restartable, processChunk, onStart, onComplete, onClose, children: content, ...customPapaParseConfig }: React.PropsWithChildren<ImporterProps<Row>>): React.ReactElement; | ||
export declare function Importer<Row extends BaseRow>({ assumeNoHeaders, restartable, processChunk, onStart, onComplete, onClose, children: content, ...customPapaParseConfig }: React.PropsWithChildren<ImporterProps<Row>>): React.ReactElement; | ||
export {}; |
{ | ||
"name": "react-csv-importer", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "React CSV import widget with user-customizable mapping", | ||
@@ -37,2 +37,7 @@ "keywords": [ | ||
"license": "MIT", | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
@@ -61,3 +66,3 @@ "src/**/*.{ts,tsx}": "eslint --max-warnings=0", | ||
"chai": "^4.2.0", | ||
"chromedriver": "^89.0.0", | ||
"chromedriver": "^94.0.0", | ||
"clean-webpack-plugin": "^3.0.0", | ||
@@ -75,2 +80,3 @@ "cross-env": "^7.0.3", | ||
"file-loader": "^6.1.0", | ||
"husky": "^4.3.0", | ||
"lint-staged": "^10.3.0", | ||
@@ -77,0 +83,0 @@ "mini-css-extract-plugin": "^0.11.1", |
# React CSV Importer | ||
![https://www.npmjs.com/package/react-csv-importer](https://img.shields.io/npm/v/react-csv-importer) ![https://github.com/beamworks/react-csv-importer/actions](https://github.com/beamworks/react-csv-importer/actions/workflows/test.yml/badge.svg) | ||
[![https://www.npmjs.com/package/react-csv-importer](https://img.shields.io/npm/v/react-csv-importer)](https://www.npmjs.com/package/react-csv-importer) [![https://github.com/beamworks/react-csv-importer/actions](https://github.com/beamworks/react-csv-importer/actions/workflows/test.yml/badge.svg)](https://github.com/beamworks/react-csv-importer/actions) | ||
This library combines an uploader + CSV parser + raw file preview + UI for custom user column | ||
mapping, all in one. Relies on the popular PapaParse CSV library to preview and process file contents directly in the browser. | ||
mapping, all in one. Relies on the popular PapaParse CSV library to preview and process file contents directly in-browser. | ||
Use this in your web app's bulk data import screen to allow users to drop a file for upload, | ||
preview the raw uploaded data before parsing and pick which columns to import. Your front-end application logic directly receives the resulting array of JSON objects in reasonable-sized chunks: you can then validate and send the data to the backend in any final format it requires instead of raw CSV. | ||
Use this to implement bulk data import in your app: let users to drop a file for upload, | ||
preview the raw uploaded data before parsing and pick which columns to import. Your front-end application logic directly receives the resulting array of JSON objects in streamed reasonable-sized chunks: you can then validate and send the data to the backend in any final format it requires instead of raw CSV. | ||
@@ -21,3 +21,3 @@ [Try the live editable code sandbox](https://codesandbox.io/s/github/beamworks/react-csv-importer/tree/master/demo-sandbox) or see the [themed demo app](https://react-csv-importer.vercel.app/). | ||
- uses Papa Parse library | ||
- uses Papa Parse CSV library | ||
- raw file preview | ||
@@ -34,2 +34,4 @@ - auto-map fields to matching column names | ||
**New:** this package is now easier to fork with your own customizations, so that you can use that fork as a [direct Git dependency](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#git-urls-as-dependencies) in your `package.json`. You may need to manually generate and commit the `dist` folder directly to your Git fork for convenience. Of course if your custom fixes could be useful to the rest of us then please submit a PR to this repo! | ||
## Install | ||
@@ -55,3 +57,2 @@ | ||
<Importer | ||
chunkSize={10000} // optional, internal parsing chunk size in bytes | ||
assumeNoHeaders={false} // optional, keeps "data has headers" checkbox off by default | ||
@@ -89,2 +90,3 @@ restartable={false} // optional, lets user choose to upload another file when import is complete | ||
// delimitersToGuess={...} | ||
// chunkSize={...} // defaults to 10000 | ||
> | ||
@@ -126,9 +128,5 @@ <ImporterField name="name" label="Name" /> | ||
```sh | ||
yarn # root folder only needs this for Husky pre-commit triggers | ||
cd package-core | ||
yarn # main package dev dependencies | ||
yarn | ||
``` | ||
Most of the interesting stuff is inside `package-core` folder. | ||
To start Storybook to have a hot-reloaded local sandbox: | ||
@@ -148,2 +146,6 @@ | ||
- 0.5.1 | ||
- correctly use custom Papa Parse config for the main processing stream | ||
- drag-drop fixes on scrolled pages | ||
- bug fixes for older Safari, mobile issues | ||
- 0.5.0 | ||
@@ -150,0 +152,0 @@ - report file preview to callbacks and render-prop |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175028
8
1353
171
53