mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2026-06-29 05:30:05 +00:00
Compare commits
8 Commits
react-boot
...
feat/dnd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d2a6a1b23 | ||
|
|
bb752fcec8 | ||
|
|
5a6b7e122d | ||
|
|
a7ae524c49 | ||
|
|
a23599f52f | ||
|
|
c50853b16d | ||
|
|
3f74542c98 | ||
|
|
47aa41b8fa |
@@ -103,7 +103,7 @@ const columns = [{
|
||||
}, {
|
||||
dataField: 'quality',
|
||||
text: 'Product Quality',
|
||||
editorRenderer: (editorProps, value, row, rowIndex, columnIndex) => (
|
||||
editorRenderer: (editorProps, value, row, column, rowIndex, columnIndex) => (
|
||||
<QualityRanger { ...editorProps } value={ value } />
|
||||
)
|
||||
}];
|
||||
|
||||
@@ -2,9 +2,9 @@ import React from 'react';
|
||||
|
||||
import BootstrapTable from 'react-bootstrap-table-next';
|
||||
import Code from 'components/common/code-block';
|
||||
import { productsGenerator } from 'utils/common';
|
||||
import { productsGenerator, withOnSale } from 'utils/common';
|
||||
|
||||
const products = productsGenerator();
|
||||
const products = withOnSale(productsGenerator());
|
||||
|
||||
function priceFormatter(cell, row) {
|
||||
if (row.onSale) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-bootstrap-table2-example",
|
||||
"version": "1.0.10",
|
||||
"version": "1.0.11",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* eslint no-mixed-operators: 0 */
|
||||
/* eslint no-param-reassign: 0 */
|
||||
|
||||
/**
|
||||
* products generator for stories
|
||||
@@ -22,6 +23,12 @@ export const productsGenerator = (quantity = 5, callback) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const withOnSale = rows => rows.map((row) => {
|
||||
if (row.id > 2) row.onSale = false;
|
||||
else row.onSale = true;
|
||||
return row;
|
||||
});
|
||||
|
||||
export const productsQualityGenerator = (quantity = 5) =>
|
||||
Array.from({ length: quantity }, (value, index) => ({
|
||||
id: index,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-bootstrap-table-next",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"description": "Next generation of react-bootstrap-table",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
|
||||
@@ -43,12 +43,13 @@ class SelectionProvider extends React.Component {
|
||||
|
||||
let currSelected = [...this.state.selected];
|
||||
|
||||
this.setState(() => {
|
||||
let result = true;
|
||||
if (onSelect) {
|
||||
const row = dataOperator.getRowByRowId(data, keyField, rowKey);
|
||||
result = onSelect(row, checked, rowIndex, e);
|
||||
}
|
||||
|
||||
this.setState(() => {
|
||||
if (result === true || result === undefined) {
|
||||
if (mode === ROW_SELECT_SINGLE) { // when select mode is radio
|
||||
currSelected = [rowKey];
|
||||
@@ -81,7 +82,6 @@ class SelectionProvider extends React.Component {
|
||||
currSelected = selected.filter(s => typeof data.find(d => d[keyField] === s) === 'undefined');
|
||||
}
|
||||
|
||||
this.setState(() => {
|
||||
let result;
|
||||
if (onSelectAll) {
|
||||
result = onSelectAll(
|
||||
@@ -97,8 +97,7 @@ class SelectionProvider extends React.Component {
|
||||
currSelected = result;
|
||||
}
|
||||
}
|
||||
return { selected: currSelected };
|
||||
});
|
||||
this.setState(() => ({ selected: currSelected }));
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -18,8 +18,7 @@ const Header = (props) => {
|
||||
sortOrder,
|
||||
selectRow,
|
||||
onExternalFilter,
|
||||
expandRow,
|
||||
bootstrap4
|
||||
expandRow
|
||||
} = props;
|
||||
|
||||
let SelectionHeaderCellComp = () => null;
|
||||
@@ -50,7 +49,6 @@ const Header = (props) => {
|
||||
return (
|
||||
<HeaderCell
|
||||
index={ i }
|
||||
bootstrap4={ bootstrap4 }
|
||||
key={ column.dataField }
|
||||
column={ column }
|
||||
onSort={ onSort }
|
||||
@@ -78,8 +76,7 @@ Header.propTypes = {
|
||||
selectRow: PropTypes.object,
|
||||
onExternalFilter: PropTypes.func,
|
||||
className: PropTypes.string,
|
||||
expandRow: PropTypes.object,
|
||||
bootstrap4: PropTypes.bool
|
||||
expandRow: PropTypes.object
|
||||
};
|
||||
|
||||
export default Header;
|
||||
|
||||
@@ -33,7 +33,7 @@ export default class ExpandCell extends Component {
|
||||
|
||||
handleClick(e) {
|
||||
const { rowKey, expanded, onRowExpand, rowIndex } = this.props;
|
||||
|
||||
e.stopPropagation();
|
||||
onRowExpand(rowKey, !expanded, rowIndex, e);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user