Skip to content

Commit

Permalink
Merge pull request #415 from Kitware/proxy-panel
Browse files Browse the repository at this point in the history
fix(ProxyEditorWidget): Add autoApply option
  • Loading branch information
jourdain authored Jan 4, 2018
2 parents ed43866 + a9158c8 commit b11c216
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/React/Widgets/ProxyEditorWidget/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ export default class ProxyEditorWidget extends React.Component {

updateChangeSet(change) {
const changeSet = Object.assign({}, this.state.changeSet, change);
this.setState({ changeSet });
if (this.props.autoApply) {
if (this.props.onApply) {
this.props.onApply(changeSet);
}
this.setState({ changeSet: {} });
} else {
this.setState({ changeSet });
}
}

applyChanges() {
Expand All @@ -58,10 +65,13 @@ export default class ProxyEditorWidget extends React.Component {
onChange={this.updateFilter}
className={style.filter}
/>
<i
className={changeCount ? style.validateButtonOn : style.validateButton}
onClick={this.applyChanges}
/>
{this.props.autoApply ?
null :
<i
className={changeCount ? style.validateButtonOn : style.validateButton}
onClick={this.applyChanges}
/>
}
</div>
<div className={style.contentContainer}>
{this.props.children}
Expand All @@ -87,9 +97,11 @@ ProxyEditorWidget.propTypes = {
onApply: PropTypes.func,
sections: PropTypes.array.isRequired,
onCollapseChange: PropTypes.func,
autoApply: PropTypes.bool,
};

ProxyEditorWidget.defaultProps = {
advanced: false,
autoApply: false,
};

0 comments on commit b11c216

Please sign in to comment.