Skip to content

Commit b5e8620

Browse files
author
Clauderic Demers
committed
Minor tweaks
1 parent caab67d commit b5e8620

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/.stories/index.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class FlexTableWrapper extends Component {
104104
const {
105105
className,
106106
height,
107+
helperClass,
107108
itemClass,
108109
itemHeight,
109110
items,
@@ -117,14 +118,15 @@ class FlexTableWrapper extends Component {
117118
gridClassName={className}
118119
headerHeight={itemHeight}
119120
height={height}
121+
helperClass={helperClass}
120122
onSortEnd={onSortEnd}
121123
rowClassName={itemClass}
122124
rowCount={items.length}
123125
rowGetter={({ index }) => items[index]}
124126
rowHeight={itemHeight}
125127
rowRenderer={(props) => <SortableRowRenderer {...props} />}
126128
width={width}
127-
>
129+
>
128130
<FlexColumn
129131
label='Index'
130132
dataKey='value'
@@ -140,14 +142,23 @@ class FlexTableWrapper extends Component {
140142
}
141143
}
142144

143-
const SortableInfiniteList = SortableContainer(({className, items, itemClass, sortingIndex, useWindowAsScrollContainer}) => {
145+
const SortableInfiniteList = SortableContainer(({className, items, itemClass, sortingIndex}) => {
144146
return (
145147
<Infinite
146148
className={className}
147149
containerHeight={600}
148150
elementHeight={items.map(({height}) => height)}
149151
>
150-
{items.map(({value, height}, index) => <Item key={`item-${index}`} className={itemClass} sortingIndex={sortingIndex} index={index} value={value} height={height}/>)}
152+
{items.map(({value, height}, index) =>
153+
<Item
154+
key={`item-${index}`}
155+
className={itemClass}
156+
sortingIndex={sortingIndex}
157+
index={index}
158+
value={value}
159+
height={height}
160+
/>
161+
)}
151162
</Infinite>
152163
)
153164
});
@@ -272,7 +283,7 @@ storiesOf('React Virtualized', module)
272283
.add('FlexTable usage', () => {
273284
return (
274285
<div className={style.root}>
275-
<ListWrapper component={FlexTableWrapper} items={getItems(500, 40)} itemHeight={40} helperClass={style.stylizedHelper} />
286+
<ListWrapper component={FlexTableWrapper} items={getItems(500, 50)} itemHeight={50} helperClass={style.stylizedHelper} />
276287
</div>
277288
);
278289
})

src/SortableContainer/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ export default function SortableContainer(WrappedComponent, config = {withRef: f
2626
hideSortableGhost: true,
2727
contentWindow: window,
2828
lockToContainerEdges: false,
29-
lockOffset: '50%',
29+
lockOffset: '50%'
3030
};
3131
static propTypes = {
32-
axis: PropTypes.string,
32+
axis: PropTypes.oneOf(['x', 'y']),
3333
lockAxis: PropTypes.string,
3434
helperClass: PropTypes.string,
3535
transitionDuration: PropTypes.number,
@@ -88,7 +88,7 @@ export default function SortableContainer(WrappedComponent, config = {withRef: f
8888
this.pressTimer = setTimeout(() => this.handlePress(e), this.props.pressDelay);
8989
}
9090
};
91-
cancel = (e) => {
91+
cancel = () => {
9292
if (!this.state.sorting) {
9393
clearTimeout(this.pressTimer);
9494
this.manager.active = null;
@@ -250,7 +250,7 @@ export default function SortableContainer(WrappedComponent, config = {withRef: f
250250

251251
return [
252252
this.getLockPixelOffset(minLockOffset),
253-
this.getLockPixelOffset(maxLockOffset),
253+
this.getLockPixelOffset(maxLockOffset)
254254
];
255255
}
256256
getLockPixelOffset(lockOffset) {

src/SortableElement/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,11 @@ export default function SortableElement (WrappedComponent, config = {withRef: fa
4242
}
4343
}
4444
}
45-
4645
componentWillUnmount() {
4746
let {collection, disabled} = this.props;
4847

4948
if (!disabled) this.removeDraggable(collection);
5049
}
51-
52-
5350
setDraggable(collection, index){
5451
let node = this.node = findDOMNode(this);
5552

@@ -58,11 +55,9 @@ export default function SortableElement (WrappedComponent, config = {withRef: fa
5855
this.ref = {node};
5956
this.context.manager.add(collection, this.ref);
6057
}
61-
6258
removeDraggable(collection) {
6359
this.context.manager.remove(collection, this.ref);
6460
}
65-
6661
getWrappedInstance() {
6762
invariant(config.withRef, 'To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call');
6863
return this.refs.wrappedInstance;

0 commit comments

Comments
 (0)