mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2026-06-28 13:10:03 +00:00
drop start scripts
This commit is contained in:
@@ -9,7 +9,7 @@ $ lerna bootstrap # ./node_modules/.bin/lerna bootstrap
|
||||
```
|
||||
### Development
|
||||
```bash
|
||||
$ npm start
|
||||
$ npm run storybook
|
||||
```
|
||||
|
||||
### Launch StoryBook
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>react-bootstrap-table demo</title>
|
||||
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
|
||||
<script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
|
||||
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.js"></script>
|
||||
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
|
||||
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
|
||||
<script src="https://use.fontawesome.com/f52b8fd2c4.js"></script> -->
|
||||
</head>
|
||||
<body>
|
||||
<div id="example"></div>
|
||||
</body>
|
||||
</html>
|
||||
118
packages/react-bootstrap-table2-example/src/index.js
vendored
118
packages/react-bootstrap-table2-example/src/index.js
vendored
@@ -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) =>
|
||||
(<h3>{ cell }::: ${ row.price }</h3>),
|
||||
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(
|
||||
<BootstrapTable keyField="id" data={ products } columns={ columns } cellEdit={ cellEdit } />,
|
||||
document.getElementById('example'));
|
||||
@@ -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()
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user