drop start scripts

This commit is contained in:
AllenFang
2018-01-20 15:27:08 +08:00
parent b4f7028b8b
commit 5f7c55aad4
5 changed files with 1 additions and 188 deletions
@@ -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
View File
@@ -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'));