Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
#2436 add missing props, small adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
siemiatj committed Nov 27, 2019
1 parent c8e8dd9 commit 113a53f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 13 deletions.
13 changes: 9 additions & 4 deletions src/components/table/Table.js
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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 &&
Expand Down Expand Up @@ -1349,6 +1353,7 @@ const clickOutsideConfig = {
excludeScrollbar: true,
};

export { Table };
export default connect(
mapStateToProps,
false,
Expand Down
5 changes: 4 additions & 1 deletion src/components/tabs/Tab.js
Expand Up @@ -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);
8 changes: 3 additions & 5 deletions src/components/widget/Attributes/Attributes.js
Expand Up @@ -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();
}
};

Expand Down
7 changes: 6 additions & 1 deletion src/components/widget/List/List.js
Expand Up @@ -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 => ({
Expand Down
18 changes: 16 additions & 2 deletions src/components/widget/MasterWidget.js
Expand Up @@ -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 : () => {};

Expand All @@ -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}
Expand All @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions src/components/widget/RawWidget.js
Expand Up @@ -129,6 +129,7 @@ export class RawWidget extends Component {
handleBlur,
listenOnKeysTrue,
enableOnClickOutside,
onClickOutside,
} = this.props;

this.setState(
Expand All @@ -145,6 +146,8 @@ export class RawWidget extends Component {
if (widgetField) {
this.handlePatch(widgetField, value, id);
}

onClickOutside && onClickOutside();
}
);
};
Expand Down

0 comments on commit 113a53f

Please sign in to comment.