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

Commit

Permalink
#630 Removing includedView (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Apr 18, 2017
1 parent 1d21983 commit 85ed309
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
30 changes: 22 additions & 8 deletions src/components/app/DocumentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ class DocumentList extends Component {
})
}
}

if(
JSON.stringify(selected) != JSON.stringify(this.props.selected) &&
includedView && includedView.windowType && includedView.viewId
){
//TODO: we need here close includedView when supportIncludedView will be available
}
}

shouldComponentUpdate(nextProps, nextState) {
Expand All @@ -159,10 +166,14 @@ class DocumentList extends Component {
});
}

doesSelectionExist(selected) {
doesSelectionExist(selected, hasIncluded) {
const {data} = this.state;
// When the rows are changing we should ensure
// that selection still exist

if(hasIncluded){
return true;
}

let rows = [];

Expand Down Expand Up @@ -358,7 +369,8 @@ class DocumentList extends Component {

render() {
const {
layout, data, viewId, clickOutsideLock, refresh, page, filters
layout, data, viewId, clickOutsideLock, refresh, page, filters,
cachedSelection
} = this.state;

const {
Expand All @@ -367,8 +379,10 @@ class DocumentList extends Component {
includedView, children, isIncluded
} = this.props;

const selectionValid = this.doesSelectionExist(selected);

const hasIncluded = true && includedView &&
includedView.windowType && includedView.viewId;
const selectionValid = this.doesSelectionExist(selected, hasIncluded);
hasIncluded && console.log(selected)
if(layout && data) {
return (
<div
Expand Down Expand Up @@ -409,7 +423,7 @@ class DocumentList extends Component {
}
selected={selectionValid ? selected : undefined}
refresh={refresh}
shouldNotUpdate={inBackground}
shouldNotUpdate={inBackground && !hasIncluded}
fetchOnInit={fetchQuickActionsOnInit}
processStatus={processStatus}
/>
Expand Down Expand Up @@ -445,9 +459,10 @@ class DocumentList extends Component {
closeOverlays={closeOverlays}
indentSupported={layout.supportTree}
disableOnClickOutside={clickOutsideLock}
defaultSelected={selected}
defaultSelected={cachedSelection ? cachedSelection : selected}
queryLimitHit={data.queryLimitHit}
doesSelectionExist={this.doesSelectionExist}
inBackground={inBackground}
>
{layout.supportAttributes && !isIncluded &&
<DataLayoutWrapper
Expand All @@ -470,8 +485,7 @@ class DocumentList extends Component {
/>
</DataLayoutWrapper>
}
{!layout.supportIncludedView && includedView &&
includedView.windowType && includedView.viewId &&
{hasIncluded &&
<div
className="table-flex-wrapper document-list-included js-not-unselect"
>
Expand Down
3 changes: 1 addition & 2 deletions src/components/table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ class Table extends Component {
}

componentWillUpdate(nextProps, nextState) {
const {dispatch, type} = this.props;
const {dispatch, type, inBackground} = this.props;

if(
JSON.stringify(nextState.selected) !==
JSON.stringify(this.state.selected)
){
console.log('tabela')
dispatch(selectTableItems(nextState.selected, type));
}
}
Expand Down

0 comments on commit 85ed309

Please sign in to comment.