Skip to content

Commit accf376

Browse files
authored
Using frontend-collect-react-dnd-scrollzone (#437)
* using frontend-collect-react-dnd-scrollzone * updating scrollzone
1 parent 4017a08 commit accf376

File tree

6 files changed

+62
-739
lines changed

6 files changed

+62
-739
lines changed

package.json

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"version": "2.5.0",
44
"description": "Drag-and-drop sortable component for nested data and hierarchies",
55
"scripts": {
6-
"prepare": "patch-package",
76
"prebuild": "npm run lint && npm run clean",
87
"build": "rollup -c",
98
"build:storybook": "npm run clean:storybook && build-storybook -o build",
@@ -58,11 +57,11 @@
5857
"> 1%"
5958
],
6059
"dependencies": {
60+
"frontend-collective-react-dnd-scrollzone": "^1.0.1",
6161
"lodash.isequal": "^4.5.0",
6262
"prop-types": "^15.6.1",
6363
"react-dnd": "^7.0.1",
6464
"react-dnd-html5-backend": "^7.0.1",
65-
"react-dnd-scrollzone": "4.0.0",
6665
"react-lifecycles-compat": "^3.0.4",
6766
"react-virtualized": "^9.19.1"
6867
},
@@ -84,11 +83,9 @@
8483
"babel-core": "^7.0.0-bridge.0",
8584
"babel-eslint": "^10.0.1",
8685
"babel-jest": "^23.6.0",
87-
"babel-loader": "^8.0.4",
8886
"codesandbox": "^1.2.10",
8987
"coveralls": "^3.0.1",
9088
"cross-env": "^5.1.6",
91-
"css-loader": "^1.0.1",
9289
"enzyme": "^3.3.0",
9390
"enzyme-adapter-react-16": "^1.1.1",
9491
"eslint": "^5.9.0",
@@ -97,16 +94,9 @@
9794
"eslint-plugin-import": "^2.12.0",
9895
"eslint-plugin-jsx-a11y": "^6.0.3",
9996
"eslint-plugin-react": "^7.8.2",
100-
"extract-text-webpack-plugin": "^4.0.0-beta.0",
101-
"file-loader": "^2.0.0",
10297
"gh-pages": "^2.0.1",
103-
"html-webpack-plugin": "^3.2.0",
10498
"jest": "^23.1.0",
10599
"jest-enzyme": "^7.0.1",
106-
"json-loader": "^0.5.7",
107-
"patch-package": "^5.1.1",
108-
"postcss-loader": "^3.0.0",
109-
"postinstall-postinstall": "^2.0.0",
110100
"prettier": "^1.13.3",
111101
"react": "^16.4.0",
112102
"react-addons-shallow-compare": "^15.6.2",
@@ -122,12 +112,7 @@
122112
"rollup-plugin-commonjs": "^9.1.3",
123113
"rollup-plugin-node-resolve": "^3.3.0",
124114
"rollup-plugin-postcss": "^1.6.2",
125-
"standard-version": "^4.4.0",
126-
"style-loader": "^0.23.1",
127-
"webpack": "^4.10.2",
128-
"webpack-cli": "^3.1.2",
129-
"webpack-dev-server": "^3.1.4",
130-
"webpack-node-externals": "^1.7.2"
115+
"standard-version": "^4.4.0"
131116
},
132117
"keywords": [
133118
"react",

patches/react-dnd-scrollzone+4.0.0.patch

Lines changed: 0 additions & 71 deletions
This file was deleted.

rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default {
2626
'react-dnd/lib/DragDropContext',
2727
'prop-types',
2828
'react-dnd-html5-backend',
29+
'frontend-collective-react-dnd-scrollzone',
2930
'react-virtualized',
3031
'lodash.isequal',
3132
],

src/react-sortable-tree.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import withScrolling, {
66
createScrollingComponent,
77
createVerticalStrength,
88
createHorizontalStrength,
9-
} from 'react-dnd-scrollzone';
10-
import { Consumer as DragDropContextConsumer } from 'react-dnd/lib/DragDropContext'
9+
} from 'frontend-collective-react-dnd-scrollzone';
10+
import { Consumer as DragDropContextConsumer } from 'react-dnd/lib/DragDropContext';
1111
import { polyfill } from 'react-lifecycles-compat';
1212
import 'react-virtualized/styles.css';
1313
import TreeNode from './tree-node';
@@ -98,7 +98,9 @@ class ReactSortableTree extends Component {
9898

9999
// Prepare scroll-on-drag options for this list
100100
if (isVirtualized) {
101-
this.scrollZoneVirtualList = (createScrollingComponent || withScrolling)(List);
101+
this.scrollZoneVirtualList = (createScrollingComponent || withScrolling)(
102+
List
103+
);
102104
this.vStrength = createVerticalStrength(slideRegionSize);
103105
this.hStrength = createHorizontalStrength(slideRegionSize);
104106
}
@@ -931,14 +933,15 @@ ReactSortableTree.defaultProps = {
931933

932934
polyfill(ReactSortableTree);
933935

934-
const SortableTreeWithoutDndContext = (props) =>
936+
const SortableTreeWithoutDndContext = props => (
935937
<DragDropContextConsumer>
936-
{({ dragDropManager }) => (
937-
dragDropManager === undefined
938-
? null
939-
: <ReactSortableTree {...props} dragDropManager={dragDropManager} />
940-
)}
938+
{({ dragDropManager }) =>
939+
dragDropManager === undefined ? null : (
940+
<ReactSortableTree {...props} dragDropManager={dragDropManager} />
941+
)
942+
}
941943
</DragDropContextConsumer>
944+
);
942945

943946
// Export the tree component without the react-dnd DragDropContext,
944947
// for when component is used with other components using react-dnd.

src/react-sortable-tree.test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('<SortableTree />', () => {
2424
});
2525

2626
it('should render nodes for flat data', () => {
27-
let wrapper
27+
let wrapper;
2828

2929
// No nodes
3030
wrapper = mount(<SortableTree treeData={[]} onChange={() => {}} />);
@@ -40,7 +40,7 @@ describe('<SortableTree />', () => {
4040
});
4141

4242
it('should render nodes for nested, expanded data', () => {
43-
let wrapper
43+
let wrapper;
4444

4545
// Single Nested
4646
wrapper = mount(
@@ -76,7 +76,7 @@ describe('<SortableTree />', () => {
7676
});
7777

7878
it('should render nodes for nested, collapsed data', () => {
79-
let wrapper
79+
let wrapper;
8080

8181
// Single Nested
8282
wrapper = mount(
@@ -438,9 +438,8 @@ describe('<SortableTree />', () => {
438438
.getBackend();
439439

440440
// Retrieve our DnD-wrapped node component type
441-
const wrappedNodeType = wrapper
442-
.find('ReactSortableTree')
443-
.instance().nodeContentRenderer;
441+
const wrappedNodeType = wrapper.find('ReactSortableTree').instance()
442+
.nodeContentRenderer;
444443

445444
// And get the first such component
446445
const nodeInstance = wrapper

0 commit comments

Comments
 (0)