You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.6 KiB
78 lines
1.6 KiB
6 years ago
|
import PropTypes from 'prop-types';
|
||
|
import React, { Component } from 'react';
|
||
|
import FormGroup from 'Components/Form/FormGroup';
|
||
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||
4 years ago
|
import FormLabel from 'Components/Form/FormLabel';
|
||
|
import { inputTypes } from 'Helpers/Props';
|
||
4 years ago
|
import translate from 'Utilities/String/translate';
|
||
6 years ago
|
|
||
3 years ago
|
class IndexerIndexTableOptions extends Component {
|
||
6 years ago
|
|
||
|
//
|
||
|
// Lifecycle
|
||
|
|
||
|
constructor(props, context) {
|
||
|
super(props, context);
|
||
|
|
||
|
this.state = {
|
||
|
showSearchAction: props.showSearchAction
|
||
|
};
|
||
|
}
|
||
|
|
||
|
componentDidUpdate(prevProps) {
|
||
|
const { showSearchAction } = this.props;
|
||
|
|
||
|
if (showSearchAction !== prevProps.showSearchAction) {
|
||
|
this.setState({
|
||
|
showSearchAction
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// Listeners
|
||
|
|
||
|
onTableOptionChange = ({ name, value }) => {
|
||
|
this.setState({
|
||
|
[name]: value
|
||
|
}, () => {
|
||
|
this.props.onTableOptionChange({
|
||
|
tableOptions: {
|
||
|
...this.state,
|
||
|
[name]: value
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// Render
|
||
|
|
||
|
render() {
|
||
|
const {
|
||
|
showSearchAction
|
||
|
} = this.state;
|
||
|
|
||
|
return (
|
||
|
<FormGroup>
|
||
4 years ago
|
<FormLabel>{translate('ShowSearch')}</FormLabel>
|
||
6 years ago
|
|
||
|
<FormInputGroup
|
||
|
type={inputTypes.CHECK}
|
||
|
name="showSearchAction"
|
||
|
value={showSearchAction}
|
||
4 years ago
|
helpText={translate('ShowSearchHelpText')}
|
||
6 years ago
|
onChange={this.onTableOptionChange}
|
||
|
/>
|
||
|
</FormGroup>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
IndexerIndexTableOptions.propTypes = {
|
||
6 years ago
|
showSearchAction: PropTypes.bool.isRequired,
|
||
|
onTableOptionChange: PropTypes.func.isRequired
|
||
|
};
|
||
|
|
||
3 years ago
|
export default IndexerIndexTableOptions;
|