diff --git a/docs/development.md b/docs/development.md index 372bfa9..ade502e 100644 --- a/docs/development.md +++ b/docs/development.md @@ -9,7 +9,7 @@ $ lerna bootstrap # ./node_modules/.bin/lerna bootstrap ``` ### Development ```bash -$ npm start +$ npm run storybook ``` ### Launch StoryBook diff --git a/package.json b/package.json index 8b0833c..c26123c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "scripts": { "postinstall": "lerna bootstrap", "build": "./node_modules/.bin/gulp prod", - "start": "node -r babel-register ./node_modules/.bin/webpack-dev-server --config webpack.config.babel.js", "lint": "eslint ./packages --ext .js --ext .jsx --ignore-path .gitignore", "pretest": "yarn lint --cache", "test": "jest", diff --git a/packages/react-bootstrap-table2-example/src/index.html b/packages/react-bootstrap-table2-example/src/index.html deleted file mode 100644 index 810cd7c..0000000 --- a/packages/react-bootstrap-table2-example/src/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - react-bootstrap-table demo - - - - - - -
- - diff --git a/packages/react-bootstrap-table2-example/src/index.js b/packages/react-bootstrap-table2-example/src/index.js deleted file mode 100644 index 10b6085..0000000 --- a/packages/react-bootstrap-table2-example/src/index.js +++ /dev/null @@ -1,118 +0,0 @@ -/* eslint no-unused-vars: 0 */ -/* eslint no-debugger: 0 */ -/* eslint arrow-body-style: 0 */ -import React from 'react'; -import ReactDom from 'react-dom'; - -import BootstrapTable from 'react-bootstrap-table2'; - -require('react-bootstrap-table2/style/react-bootstrap-table.scss'); - -const products = []; - -function addProducts(quantity) { - const startId = products.length; - for (let i = 0; i < quantity; i += 1) { - const id = startId + i; - products.push({ - id, - name: `Item name ${id}`, - price: 2100 + i, - nest: { - address: 'Address 1', - postcal: '0922-1234' - } - }); - } -} - -addProducts(5); - -const columns = [{ - dataField: 'id', - text: 'Product ID', - style: { - backgroundColor: 'red' - }, - classes: 'my-xxx' -}, { - dataField: 'name', - text: 'Product Name', - headerTitle: true, - formatter: (cell, row) => - (

{ cell }::: ${ row.price }

), - validator: (newValue, row, column) => { - const validationForm = { - valid: true, - message: null - }; - validationForm.valid = false; - validationForm.message = 'Invalid message'; - return validationForm; - } -}, { - dataField: 'price', - text: 'Product Price', - validator: (newValue, row, column) => { - if (newValue < 2000) { - return { - valid: false, - message: 'Price should bigger than 2000' - }; - } - return true; - } -}, { - dataField: 'nest.address', - text: 'Address' -}, { - dataField: 'nest.postcal', - text: 'Postal', - editable: true, - validator: (newValue, row, column) => true -}]; - -const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); - -const cellEdit = { - mode: 'click', - blurToSave: true, - // beforeSaveCell: (oldValue, newValue, row, column) => { - // console.log('beforeSavecell'); - // // console.log(oldValue); - // // console.log(newValue); - // // console.log(row); - // // console.log(column); - // }, - // afterSaveCell: (oldValue, newValue, row, column) => { - // console.log('aftersavecell'); - // // console.log(oldValue); - // // console.log(newValue); - // // console.log(row); - // // console.log(column); - // } - onUpdate: (rowId, dataField, newValue) => { - return sleep(1000).then(() => { - // return { forceUpdate: true }; - throw new Error('test is not successfully'); - }); - } - // nonEditableRows: () => [1, 3, 7] -}; - - -// let Table = withCellEdit({ -// mode: 'click', -// blurToSave: true, -// onEditing: (rowId, dataField, newValue) => { -// return sleep(1000).then(() => { -// // return { forceUpdate: true }; -// throw new Error('test is not successfully'); -// }); -// } -// })(BootstrapTable); -// Table = createTable(Table); - -ReactDom.render( - , - document.getElementById('example')); diff --git a/webpack.config.babel.js b/webpack.config.babel.js deleted file mode 100644 index bc25d70..0000000 --- a/webpack.config.babel.js +++ /dev/null @@ -1,50 +0,0 @@ -import * as path from 'path'; -import webpack from 'webpack'; - -import HtmlWebpackPlugin from 'html-webpack-plugin'; - -const sourcePath = path.join(__dirname, 'packages/react-bootstrap-table2/src'); -const sourceStylePath = path.join(__dirname, 'packages/react-bootstrap-table2/style'); -const examplePath = path.join(__dirname, 'packages/react-bootstrap-table2-example/src'); -const exampleHTMLPath = path.join(__dirname, 'packages/react-bootstrap-table2-example/src/index.html'); - -module.exports = { - entry: examplePath, - devtool: '#eval-source-map', - devServer: { - historyApiFallback: true, - hot: true, - inline: true, - // progress: true, - noInfo: true, - stats: 'errors-only' - }, - output: { - path: path.join(__dirname, 'examples'), - filename: '[name].bundle.js' - }, - module: { - rules: [{ - enforce: 'pre', - test: /\.js?$/, - exclude: /node_modules/, - include: [sourcePath], - loader: 'eslint-loader' - }, { - test: /\.js?$/, - use: ['babel-loader'], - exclude: /node_modules/, - include: [sourcePath, examplePath] - }, { - test: /\.scss$/, - use: ['style-loader', 'css-loader', 'sass-loader'], - include: [sourceStylePath] - }] - }, - plugins: [ - new HtmlWebpackPlugin({ - template: exampleHTMLPath - }), - new webpack.HotModuleReplacementPlugin() - ] -};