From 113a53f1d58abd99fccd26a44996983d15ac996c Mon Sep 17 00:00:00 2001 From: siemiatj Date: Mon, 25 Nov 2019 15:07:08 +0100 Subject: [PATCH] #2436 add missing props, small adjustments --- src/components/table/Table.js | 13 +++++++++---- src/components/tabs/Tab.js | 5 ++++- src/components/widget/Attributes/Attributes.js | 8 +++----- src/components/widget/List/List.js | 7 ++++++- src/components/widget/MasterWidget.js | 18 ++++++++++++++++-- src/components/widget/RawWidget.js | 3 +++ 6 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/components/table/Table.js b/src/components/table/Table.js index b696365e4..82c12062e 100644 --- a/src/components/table/Table.js +++ b/src/components/table/Table.js @@ -319,8 +319,12 @@ class Table extends Component { this.selectRangeProduct(leafsIds); }; - changeListen = listenOnKeys => { - this.setState({ listenOnKeys: !!listenOnKeys }); + setListenTrue = () => { + this.setState({ listenOnKeys: true }); + }; + + setListenFalse = () => { + this.setState({ listenOnKeys: false }); }; selectProduct = (id, idFocused, idFocusedDown) => { @@ -1045,8 +1049,8 @@ class Table extends Component { onDoubleClick={this.handleDoubleClick} onClick={this.handleClick} handleRightClick={this.handleRightClick} - changeListenOnTrue={() => this.changeListen(true)} - changeListenOnFalse={() => this.changeListen(false)} + changeListenOnTrue={this.setListenTrue} + changeListenOnFalse={this.setListenFalse} newRow={i === rows.length - 1 ? newRow : false} isSelected={ (selected && @@ -1349,6 +1353,7 @@ const clickOutsideConfig = { excludeScrollbar: true, }; +export { Table }; export default connect( mapStateToProps, false, diff --git a/src/components/tabs/Tab.js b/src/components/tabs/Tab.js index bb6ef90bf..e8133f023 100644 --- a/src/components/tabs/Tab.js +++ b/src/components/tabs/Tab.js @@ -53,13 +53,16 @@ class Tab extends Component { } Tab.propTypes = { + children: PropTypes.any, dispatch: PropTypes.func.isRequired, onChange: PropTypes.func, - children: PropTypes.any, singleRowView: PropTypes.bool, windowId: PropTypes.string, tabId: PropTypes.string, docId: PropTypes.string, + queryOnActivate: PropTypes.bool, + orderBy: PropTypes.array, }; +export { Tab }; export default connect()(Tab); diff --git a/src/components/widget/Attributes/Attributes.js b/src/components/widget/Attributes/Attributes.js index fc9f631dd..c763465c2 100644 --- a/src/components/widget/Attributes/Attributes.js +++ b/src/components/widget/Attributes/Attributes.js @@ -148,11 +148,9 @@ export default class Attributes extends Component { * @todo Write the documentation */ handleKeyDown = e => { - switch (e.key) { - case 'Escape': - e.preventDefault(); - this.handleCompletion(); - break; + if (e.key === 'Escape') { + e.preventDefault(); + this.handleCompletion(); } }; diff --git a/src/components/widget/List/List.js b/src/components/widget/List/List.js index ee0ac263a..ee708cd0c 100644 --- a/src/components/widget/List/List.js +++ b/src/components/widget/List/List.js @@ -354,11 +354,16 @@ ListWidget.propTypes = { initialFocus: PropTypes.any, doNotOpenOnFocus: PropTypes.bool, setNextProperty: PropTypes.func, - disableAutoFocus: PropTypes.func, + disableAutofocus: PropTypes.func, enableAutofocus: PropTypes.func, onChange: PropTypes.func, onFocus: PropTypes.func, onBlur: PropTypes.func, + widgetField: PropTypes.string, + id: PropTypes.string, + field: PropTypes.string, + mandatory: PropTypes.bool, + lastProperty: PropTypes.string, }; const mapStateToProps = state => ({ diff --git a/src/components/widget/MasterWidget.js b/src/components/widget/MasterWidget.js index 4c187328b..6c692adef 100644 --- a/src/components/widget/MasterWidget.js +++ b/src/components/widget/MasterWidget.js @@ -268,7 +268,7 @@ class MasterWidget extends Component { * @summary ToDo: Describe the method. */ render() { - const { handleBackdropLock } = this.props; + const { handleBackdropLock, onClickOutside } = this.props; const { updated, data } = this.state; const handleFocusFn = handleBackdropLock ? handleBackdropLock : () => {}; @@ -279,7 +279,7 @@ class MasterWidget extends Component { data={data} handleFocus={() => handleFocusFn(true)} handleBlur={() => handleFocusFn(false)} - onClickOutside={this.props.onClickOutside} + onClickOutside={onClickOutside} handlePatch={this.handlePatch} handleChange={this.handleChange} handleProcess={this.handleProcess} @@ -306,6 +306,20 @@ MasterWidget.propTypes = { handleBackdropLock: PropTypes.func, updatePropertyValue: PropTypes.func, openModal: PropTypes.func.isRequired, + data: PropTypes.object, + widgetData: PropTypes.array, + widgetType: PropTypes.string, + dataId: PropTypes.string, + windowType: PropTypes.string, + patch: PropTypes.func, + rowId: PropTypes.string, + tabId: PropTypes.string, + onChange: PropTypes.func, + relativeDocId: PropTypes.number, + isAdvanced: PropTypes.bool, + viewId: PropTypes.bool, + entity: PropTypes.string, + precision: PropTypes.bool, }; export default connect( diff --git a/src/components/widget/RawWidget.js b/src/components/widget/RawWidget.js index b175d8f89..21930b7ce 100644 --- a/src/components/widget/RawWidget.js +++ b/src/components/widget/RawWidget.js @@ -129,6 +129,7 @@ export class RawWidget extends Component { handleBlur, listenOnKeysTrue, enableOnClickOutside, + onClickOutside, } = this.props; this.setState( @@ -145,6 +146,8 @@ export class RawWidget extends Component { if (widgetField) { this.handlePatch(widgetField, value, id); } + + onClickOutside && onClickOutside(); } ); };