/* eslint react/prefer-stateless-function: 0 */ /* eslint no-return-assign: 0 */ /* eslint no-unused-vars: 0 */ import React from 'react'; import PropTypes from 'prop-types'; import BootstrapTable from 'react-bootstrap-table-next'; import cellEditFactory from 'react-bootstrap-table2-editor'; import Code from 'components/common/code-block'; import { productsQualityGenerator } from 'utils/common'; const products = productsQualityGenerator(); class QualityRanger extends React.Component { static propTypes = { value: PropTypes.number, onUpdate: PropTypes.func.isRequired } static defaultProps = { value: 0 } getValue() { return parseInt(this.range.value, 10); } render() { const { value, onUpdate, ...rest } = this.props; return [ this.range = node } type="range" min="0" max="100" />, ]; } } const columns = [{ dataField: 'id', text: 'Product ID' }, { dataField: 'name', text: 'Product Name' }, { dataField: 'quality', text: 'Product Quality', editorRenderer: (editorProps, value, row, column, rowIndex, columnIndex) => ( ) }]; const sourceCode = `\ import BootstrapTable from 'react-bootstrap-table-next'; import cellEditFactory from 'react-bootstrap-table2-editor'; class QualityRanger extends React.Component { static propTypes = { value: PropTypes.number, onUpdate: PropTypes.func.isRequired } static defaultProps = { value: 0 } getValue() { return parseInt(this.range.value, 10); } render() { const { value, onUpdate, ...rest } = this.props; return [ this.range = node } type="range" min="0" max="100" />, ]; } } const columns = [{ dataField: 'id', text: 'Product ID' }, { dataField: 'name', text: 'Product Name' }, { dataField: 'quality', text: 'Product Quality', editorRenderer: (editorProps, value, row, column, rowIndex, columnIndex) => ( ) }]; `; export default () => (

Custom Editor

{ sourceCode }
);