diff --git a/.gitignore b/.gitignore
index 0d373cb..f3a4805 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
labextension/lib/
nbextension/lib/
+component/lib/
nbextension/embed/
node_modules/
npm-debug.log
diff --git a/README.md b/README.md
index 308d915..22ef3b0 100755
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ A JupyterLab and Jupyter Notebook extension for rendering [JSON Table Schema](ht
## Prerequisites
-* JupyterLab ^0.18.0 and/or Notebook >=4.3.0
+* JupyterLab ^0.20.0 and/or Notebook >=4.3.0
## Usage
@@ -86,12 +86,11 @@ To render a .table.json file as a tree, simply open it:
## Install
```bash
-pip install jupyterlab_table
# For JupyterLab
-jupyter labextension install --symlink --py --sys-prefix jupyterlab_table
-jupyter labextension enable --py --sys-prefix jupyterlab_table
+jupyter labextension install jupyterlab_table
# For Notebook
-jupyter nbextension install --symlink --py --sys-prefix jupyterlab_table
+pip install jupyterlab_table
+jupyter nbextension install --py --sys-prefix jupyterlab_table
jupyter nbextension enable --py --sys-prefix jupyterlab_table
```
@@ -100,8 +99,8 @@ jupyter nbextension enable --py --sys-prefix jupyterlab_table
```bash
pip install -e .
# For JupyterLab
-jupyter labextension install --symlink --py --sys-prefix jupyterlab_table
-jupyter labextension enable --py --sys-prefix jupyterlab_table
+cd labextension
+jupyter labextension link .
# For Notebook
jupyter nbextension install --symlink --py --sys-prefix jupyterlab_table
jupyter nbextension enable --py --sys-prefix jupyterlab_table
diff --git a/build.sh b/build.sh
deleted file mode 100644
index 17c92e2..0000000
--- a/build.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-
-npm -v
-if [ $? -eq 0 ]; then
- echo npm is installed
-else
- echo "'npm -v' failed, therefore npm is not installed. In order to perform a
- developer install of jupyterlab_table you must have npm installed
- on your machine! See http://blog.npmjs.org/post/85484771375/how-to-install-npm
- for installation instructions."
- exit 1
-fi
-
-cd labextension
-npm install
-cd ..
-
-cd nbextension
-npm install
-cd ..
diff --git a/component/.babelrc b/component/.babelrc
new file mode 100644
index 0000000..d4d2df4
--- /dev/null
+++ b/component/.babelrc
@@ -0,0 +1,3 @@
+{
+ "presets": ["latest", "stage-0", "react"]
+}
diff --git a/component/fixed-data-table.js b/component/fixed-data-table.js
deleted file mode 100644
index f419f83..0000000
--- a/component/fixed-data-table.js
+++ /dev/null
@@ -1,68 +0,0 @@
-import React from 'react';
-import {
- Table,
- Column,
- Cell
-} from 'fixed-data-table';
-import 'fixed-data-table/dist/fixed-data-table.min.css';
-// hack: `stream.Transform` (stream-browserify) is undefined in `csv-parse` when
-// built with @jupyterlabextension-builder
-import infer from 'jsontableschema/lib/infer';
-// import { infer } from 'jsontableschema';
-import './index.css';
-
-const ROW_HEIGHT = 34;
-
-function inferSchema(data) {
- const headers = data.reduce((result, row) => [...new Set([...result, ...Object.keys(row)])], []);
- const values = data.map(row => Object.values(row));
- return infer(headers, values);
-}
-
-export default class FixedDataTable extends React.Component {
-
- state = {
- columnWidths: {}
- }
-
- render() {
- let { schema, data } = this.props;
- if (!schema) schema = inferSchema(data);
- return (
-
{
- this.setState(({columnWidths}) => ({
- columnWidths: {
- ...columnWidths,
- [columnKey]: columnWidth,
- }
- }));
- }}
- >
- {
- schema.fields.map((field, fieldIndex) =>
-
- | {field.name} |
- }
- cell={props =>
- {data[props.rowIndex][field.name]} |
- }
- fixed={false}
- isResizable={true}
- />
- )
- }
-
- );
- }
-
-}
diff --git a/component/package.json b/component/package.json
index 73a50b4..f49bfbc 100644
--- a/component/package.json
+++ b/component/package.json
@@ -1,10 +1,15 @@
{
"name": "jupyterlab_table_react",
"version": "1.0.0",
- "description": "A React component for rendering JSON schema table",
- "main": "index.js",
+ "description": "A React component for rendering JSONTable",
+ "main": "lib/index.js",
+ "files": [
+ "lib/*.js",
+ "*.css"
+ ],
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "build": "babel src --out-dir lib",
+ "prepublishOnly": "npm run build"
},
"keywords": [
"jupyter",
@@ -13,10 +18,17 @@
"author": "Grant Nestor",
"license": "ISC",
"dependencies": {
- "fixed-data-table": "^0.6.3",
"jsontableschema": "^0.2.2",
- "react": "^15.3.2",
- "react-addons-shallow-compare": "^15.4.2",
- "react-virtualized": "^8.11.4"
+ "react-virtualized": "^9.7.3"
+ },
+ "peerDependencies": {
+ "react": "^15.3.2"
+ },
+ "devDependencies": {
+ "babel-cli": "^6.24.0",
+ "babel-core": "^6.18.2",
+ "babel-preset-latest": "^6.16.0",
+ "babel-preset-react": "^6.16.0",
+ "babel-preset-stage-0": "^6.16.0"
}
}
diff --git a/component/index.js b/component/src/index.js
similarity index 52%
rename from component/index.js
rename to component/src/index.js
index e8dab11..94ab5c1 100644
--- a/component/index.js
+++ b/component/src/index.js
@@ -1,4 +1,2 @@
export VirtualizedTable from './virtualized-table';
export VirtualizedGrid from './virtualized-grid';
-export FixedDataTable from './fixed-data-table';
-export VanillaTable from './vanilla-table';
diff --git a/component/virtualized-grid.js b/component/src/virtualized-grid.js
similarity index 54%
rename from component/virtualized-grid.js
rename to component/src/virtualized-grid.js
index cbe3344..1d41e28 100644
--- a/component/virtualized-grid.js
+++ b/component/src/virtualized-grid.js
@@ -1,31 +1,29 @@
/* @flow */
import React from 'react';
-import { MultiGrid, AutoSizer } from 'react-virtualized';
+import { MultiGrid, AutoSizer, ColumnSizer } from 'react-virtualized';
// hack: `stream.Transform` (stream-browserify) is undefined in `csv-parse` when
// built with @jupyterlabextension-builder
import infer from 'jsontableschema/lib/infer';
// import { infer } from 'jsontableschema';
-import './index.css';
-
-const ROW_HEIGHT = 36;
-const COLUMN_WIDTH = 72;
-const GRID_MAX_HEIGHT = ROW_HEIGHT * 10;
-// The width per text character for calculating widths for columns
-const COLUMN_CHARACTER_WIDTH = 14;
-// The number of sample rows that should be used to infer types for columns
-// and widths for columns
-const SAMPLE_SIZE = 10;
type Props = {
data: Array