0.0.2-beta.63 • Published 6 years ago

react-jsonschema-table v0.0.2-beta.63

Weekly downloads
37
License
MIT
Repository
github
Last release
6 years ago

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: 'jhon@doe.com',
      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

0.0.2-beta.63

6 years ago

0.0.2-beta.62

6 years ago

0.0.2-beta.61

6 years ago

0.0.3-beta.3

6 years ago

0.0.3-beta.2

6 years ago

0.0.3-beta.1

6 years ago

0.0.3-beta.0

6 years ago

0.0.2-beta.58

6 years ago

0.0.2-beta.57

6 years ago

0.0.2-beta.56

6 years ago

0.0.2-beta.55

6 years ago

0.0.2-beta.54

6 years ago

0.0.2-beta.53

6 years ago

0.0.2-beta.52

6 years ago

0.0.2-beta.51

6 years ago

0.0.2-beta.50

6 years ago

0.0.2-beta.49

6 years ago

0.0.2-beta.48

6 years ago

0.0.2-beta.47

6 years ago

0.0.2-beta.46

6 years ago

0.0.2-beta.45

6 years ago

0.0.2-beta.44

6 years ago

0.0.2-beta.43

6 years ago

0.0.2-beta.42

6 years ago

0.0.2-beta.41

6 years ago

0.0.2-beta.40

6 years ago

0.0.2-beta.39

6 years ago

0.0.2-beta.38

6 years ago

0.0.2-beta.37

6 years ago

0.0.2-beta.36

6 years ago

0.0.2-beta.33

6 years ago

0.0.2-beta.32

6 years ago

0.0.2-beta.31

6 years ago

0.0.2-beta.30

6 years ago

0.0.2-beta.29

6 years ago

0.0.2-beta.28

6 years ago

0.0.2-beta.27

6 years ago

0.0.2-beta.26

6 years ago

0.0.2-beta.25

6 years ago

0.0.2-beta.24

6 years ago

0.0.2-beta.23

6 years ago

0.0.2-beta.22

6 years ago

0.0.2-beta.21

6 years ago

0.0.2-beta.20

6 years ago

0.0.2-beta.19

6 years ago

0.0.2-beta.18

6 years ago

0.0.2-beta.17

6 years ago

0.0.2-beta.16

6 years ago

0.0.2-beta.15

6 years ago

0.0.2-beta.14

6 years ago

0.0.2-beta.13

6 years ago

0.0.2-beta.12

6 years ago

0.0.2-beta.11

6 years ago

0.0.2-beta.10

6 years ago

0.0.2-beta.9

6 years ago

0.0.2-beta.7

6 years ago

0.0.2-beta.6

6 years ago

0.0.2-beta.5

6 years ago

0.0.2-beta.4

6 years ago

0.0.2-beta.3

6 years ago

0.0.2-beta.2

6 years ago

0.0.2-beta.1

6 years ago

0.0.2-beta.0

6 years ago

0.0.2-beta

6 years ago

0.0.1

6 years ago