Giter Club home page Giter Club logo

openscript-ch / react-dsv-import Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 14.92 MB

Flexible, typed and easy to use React Component ⚛ to provide CSV, TSV and other delimiter-separated values formats (DSV) import functionality.

Home Page: https://openscript-ch.github.io/react-dsv-import/

License: GNU Affero General Public License v3.0

JavaScript 6.82% TypeScript 84.40% Dockerfile 1.92% Shell 0.15% MDX 6.71%
react typescript storybook react-component codeclimate dsv csv tsv vitejs

react-dsv-import's Introduction

react-dsv-import

Flexible, typed and easy to use React Component ⚛ to provide CSV, TSV and other delimiter-separated values formats (DSV) import functionality.

npm npm peer dependency version GitHub Maintainability Test Coverage

Demonstration

Getting started

Add the package with the package manager of choice to your project:

  • yarn: yarn add react-dsv-import
  • npm: npm install react-dsv-import
  • npx: npx -p react-dsv-import

TypeScript

import { DSVImport, ColumnsType } from 'react-dsv-import';

type BasicType = { forename: string; surname: string; email: string };

const columns: ColumnsType<BasicType> = [
  { key: 'forename', label: 'Forename' },
  { key: 'surname', label: 'Surname' },
  { key: 'email', label: 'Email' }
];

<DSVImport<BasicType> columns={columns}>
  <DSVImport.TextareaInput />
  <DSVImport.TablePreview />
</DSVImport>

JavaScript

import { DSVImport } from 'react-dsv-import';

const columns = [
  { key: 'forename', label: 'Forename' },
  { key: 'surname', label: 'Surname' },
  { key: 'email', label: 'Email' }
];

<DSVImport columns={columns}>
  <DSVImport.TextareaInput />
  <DSVImport.TablePreview />
</DSVImport>

API

The <DSVImport<T>> components has the following API:

Property Type Description
columns ColumnType Description of the expected columns
transformers? Transformer[] Globally applied transformers
onChange? (value: T[]) => void Callback which is called after parsing the input
onValidation? (errors: Error<T>[]) => void Callback which is called if there are validation errors

Types

Within this section additional types are explained.

ColumnType

Property Type Description
key string Key of the current column
label string Label of the current column, which can be shown to the user
rules? Rule[] Validation rules which are applied to this column
transformers? Transformer[] Transformers which are applied to this column

Rule

Property Type Description
message string Error message
contraint { unique: boolean } | { constraint: Constraint} Constraint for this rule

Constraint

(value: string) => boolean

Transformer

(value: string) => string

Project

This section describes the status of the project.

Features

The most important features of this component are:

  • ✅ Type definitions and type safety
  • ✅ DSV format detection
  • ✅ Fully compositable
  • ✅ Automatic testing with >90% coverage
  • ✅ Input validation
  • Ant Design integration (see storybook)
  • ✅ Input transformation (e.g. trim, ...)
  • Material UI integration (see storybook)

✅ means the feature is implemented and released. ❌ indicates that a feature is planned.

Links

Tools

Resources

react-dsv-import's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar openscript avatar renovate[bot] avatar stampaaaron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-dsv-import's Issues

Architecture review

A review of the overall architecture would be great. The following questions are interesting:

  • Is the component composable?
  • Currently the middleware handles the onChange event. Is this okay?

.. plus other findings.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency eslint-config-airbnb-typescript to v18
  • chore(deps): update dependency eslint-config-prettier to v9
  • chore(deps): update dependency eslint-plugin-prettier to v5
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency size-limit to v11
  • chore(deps): update dependency vite to v5
  • chore(deps): update dependency vite-plugin-dts to v4
  • chore(deps): update dependency vitest to v2
  • chore(deps): update google-github-actions/release-please-action action to v4
  • chore(deps): update mcr.microsoft.com/vscode/devcontainers/typescript-node docker tag to v1
  • chore(deps): update storybook monorepo to v8 (major) (@storybook/addon-actions, @storybook/addon-docs, @storybook/addon-essentials, @storybook/addon-links, @storybook/addon-storysource, @storybook/builder-vite, @storybook/react)
  • chore(deps): update testing-library monorepo (major) (@testing-library/jest-dom, @testing-library/react)
  • chore(deps): update typescript-eslint monorepo to v8 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
.devcontainer/Dockerfile
  • mcr.microsoft.com/vscode/devcontainers/typescript-node 0-18-bullseye
github-actions
.github/workflows/cd-storybook.yml
  • actions/checkout v3
  • actions/setup-node v3
  • JamesIves/github-pages-deploy-action v4.3.4
.github/workflows/check-size.yml
  • actions/checkout v3
  • andresz1/size-limit-action v1
.github/workflows/ci.yml
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/release-management.yml
  • google-github-actions/release-please-action v3
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • @babel/core 7.18.6
  • @emotion/babel-plugin 11.9.2
  • @emotion/react 11.9.3
  • @size-limit/preset-small-lib 7.0.8
  • @storybook/addon-actions 6.5.9
  • @storybook/addon-docs 6.5.9
  • @storybook/addon-essentials 6.5.9
  • @storybook/addon-links 6.5.9
  • @storybook/addon-storysource 6.5.9
  • @storybook/builder-vite 0.1.39
  • @storybook/react 6.5.9
  • @testing-library/jest-dom 5.16.4
  • @testing-library/react 13.3.0
  • @types/react 18.0.15
  • @types/react-dom 18.0.6
  • @typescript-eslint/eslint-plugin 5.30.6
  • @typescript-eslint/parser 5.30.6
  • @vitejs/plugin-react 1.3.2
  • babel-loader 8.2.5
  • eslint 8.19.0
  • eslint-config-airbnb 19.0.4
  • eslint-config-airbnb-typescript 17.0.0
  • eslint-config-prettier 8.5.0
  • eslint-plugin-import 2.26.0
  • eslint-plugin-jsx-a11y 6.6.0
  • eslint-plugin-prettier 4.2.1
  • eslint-plugin-react 7.30.1
  • eslint-plugin-react-hooks 4.6.0
  • eslint-plugin-storybook 0.6.1
  • jest 28.1.2
  • jest-environment-jsdom 28.1.2
  • npm-check 5.9.2
  • prettier 2.7.1
  • react 18.2.0
  • react-dom 18.2.0
  • size-limit 7.0.8
  • ts-jest 28.0.5
  • typescript 4.7.4
  • vite 2.9.18
  • vite-plugin-dts 1.3.0
  • vite-plugin-markdown 2.0.2
  • vitest 0.18.0
  • react ^17.0.0 || ^18.0.0
  • react-dom ^17.0.0 || ^18.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.