Giter Club home page Giter Club logo

react-jsonschema-table's Introduction

react-jsonschema-table

Simple usage react component stylesheet table with inifnite scroll for massive data consumption and line editing using JSONSchema as data structure.

Work In Progress !

NPM JavaScript Style Guide

Install

npm install --save react-jsonschema-table

Simple Usage

import React, { Component } from 'react'

import Table from 'react-jsonschema-table'

const schema = {
  properties: {
    name: {
      type: 'string',
      title: 'Name',
    },
    lastName: {
      type: 'string',
      title: 'LastName',
    },
    email: {
      type: 'string',
      format: 'email',
      title: 'Email',
    }
  }
}

class Example extends Component {
  render () {
    return (
      <Table schema={schema} />
    )
  }
}

API

schema: Is the JSONSchema that contains the estructure and validation rules of the rendered data.

items: An array of document objectcs compliant to the schema format. exemple:

  items: [{
    virtualId: 0, // integer
    document: { // actual document
      name: 'Jhon',
      lastName: 'Doe',
      email: '[email protected]',
      id: '2a08db19-894c-4d1a-82b6-f4abe2ebbe33'
    }, // compliant to schema, you can have extra fields, they will not show on the Table but will be considered in callbacks
    status: 'loaded' // string (one of 'loaded', 'loading', 'lazzy','new','invalid')
  }]

pagination: boolean default true. If JsonschemaTable should paginate items for better handling massive amounts of items. (callback will be called when user has scrolled until 80% of items)

getMoreItems: function callback so JsonschemaTable can let you know it needs to load more items if pagination is activated

shouldSaveData: boolean default true that activates the save feature. (which can be configured with the following function)

stagingItemsCallback: function that return all the staging documents when 'save' button is clicked, so you can save them to your API or whatever.

checkedItemsCallback: function that return all the checked documents when 'delete' button is clicked, so you can delete them in your API or whatever.

toolbarConfigs: object to configure and toggle toolbar functions. example:

toolbarConfigs: {
  hideStateFilterBtn: true,
  hideColumnsVisibilityBtn: true,
  hideDownloadBtn: true,
  hideNewLineBtn: true,
  hideDeleteBtn: true,
  hideUndoBtn: true,
  hideSaveBtn: true,
}

Local setup for developing

Setup project

npm i

Run example

npm start

License

MIT © VTEX

react-jsonschema-table's People

Contributors

alejandro-osorio avatar ohmyguigs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ghas-results

react-jsonschema-table's Issues

Can't see the selected text

In the screenshot below I have selected part of the current cell text, but it doesn't highlight that portion:

image

The same problem occurs on the original Alejandro version:

image

When fixed, it should look like this:

image

Fix multicell select

Selecting multiple cells doesn't highlight them correctly.
Please consider the screenshot below, where the little blue square signals (in a too subtle way) that I'm selecting multiple cells.

image

I think that original version by Alejandro already had this behavior, I guess it's just a matter of bringing that back. :)

image

Final ctrl+z bug

Doing a ctrl+z past the initial UI state breaks everything.

How to replicate

  1. Select any cell
    image

  2. Press ctrl+z (command+z on Mac)
    image

"Select all lines" button

This button should toggle between "select all lines" and "deselect lines", but currently only deselects lines.

image

Take as an example this Airtable interaction, where clicking on the left-most column header selects all lines.

image

Clicking on it again will deselect all, going back to the previous state.

image

Refactor

Clean project

  • Split components into modules
  • Remove ReactDOM.findDOMNode improper calls
  • Remove unecessary var that = this;(should simply use arrow func instead)
  • Use webpack instead of rollup (maybe?)
  • Refactor style ( #6 and #7 )
  • Update to React 16

Clean dependencies:

  • react-bootsrap
  • bootstrap
  • react-widget
  • react-widget-moment
  • moment
  • redux-logger (use only in dev)
  • redux-thunk (change it for redux-logic)
  • reflux
  • underscore
  • fontawesome
  • fontawesome-free-solid

Add option for pagination (instead of lazy loading)

There's a PR for a pagination component in the Styleguide, but it's ok to use a simple Bootstrap pagination for now. The important thing is to have the pagination behavior instead of lazy loading, which is a very confusing UX for a Spreadsheet app.

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.