react-beautiful-dnd
Advanced tools
Comparing version 12.0.0-beta.9 to 12.0.0-beta.10
{ | ||
"name": "react-beautiful-dnd", | ||
"version": "12.0.0-beta.9", | ||
"version": "12.0.0-beta.10", | ||
"description": "Beautiful and accessible drag and drop for lists with React", | ||
@@ -80,4 +80,4 @@ "author": "Alex Reardon <areardon@atlassian.com>", | ||
"@emotion/styled": "^10.0.17", | ||
"@storybook/react": "^5.2.4", | ||
"@storybook/theming": "^5.2.4", | ||
"@storybook/react": "^5.2.5", | ||
"@storybook/theming": "^5.2.5", | ||
"@testing-library/react": "^9.3.0", | ||
@@ -102,12 +102,12 @@ "babel-core": "^7.0.0-bridge.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-jest": "^22.19.0", | ||
"eslint-plugin-jest": "^22.20.0", | ||
"eslint-plugin-jsx-a11y": "^6.2.1", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"eslint-plugin-react": "^7.16.0", | ||
"eslint-plugin-react-hooks": "^2.1.2", | ||
"flow-bin": "0.109.0", | ||
"eslint-plugin-react-hooks": "^2.2.0", | ||
"flow-bin": "0.110.0", | ||
"fs-extra": "^8.0.1", | ||
"globby": "^10.0.1", | ||
"jest": "^24.9.0", | ||
"jest-junit": "^8.0.0", | ||
"jest-junit": "^9.0.0", | ||
"jest-watch-typeahead": "^0.4.0", | ||
@@ -118,5 +118,5 @@ "lighthouse": "^5.6.0", | ||
"raf-stub": "^3.0.0", | ||
"react": "^16.10.2", | ||
"react-dom": "^16.10.2", | ||
"react-test-renderer": "^16.10.2", | ||
"react": "^16.11.0", | ||
"react-dom": "^16.11.0", | ||
"react-test-renderer": "^16.11.0", | ||
"react-virtualized": "^9.21.1", | ||
@@ -126,3 +126,3 @@ "react-window": "^1.8.5", | ||
"rimraf": "^3.0.0", | ||
"rollup": "^1.24.0", | ||
"rollup": "^1.25.2", | ||
"rollup-plugin-babel": "^4.3.3", | ||
@@ -129,0 +129,0 @@ "rollup-plugin-commonjs": "^10.1.0", |
@@ -18,3 +18,3 @@ // @flow | ||
const liftInstruction: string = `Draggable item. Ensure your screen reader is not in browse mode and then press spacebar to lift.`; | ||
const liftInstruction: string = `Draggable item. Ensure your screen reader is not in browse mode and then press space bar to lift.`; | ||
@@ -21,0 +21,0 @@ const position = (index: number): number => index + 1; |
@@ -7,4 +7,3 @@ // @flow | ||
stop: () => void, | ||
cancelPending: () => void, | ||
scroll: (state: State) => void, | ||
|}; |
@@ -18,3 +18,2 @@ // @flow | ||
stop: () => void, | ||
cancelPending: () => void, | ||
|}; | ||
@@ -48,8 +47,2 @@ | ||
const cancelPending = () => { | ||
invariant(dragging, 'Cannot cancel pending fluid scroll when not started'); | ||
scheduleWindowScroll.cancel(); | ||
scheduleDroppableScroll.cancel(); | ||
}; | ||
const start = (state: DraggingState) => { | ||
@@ -89,3 +82,4 @@ timings.start('starting fluid scroller'); | ||
} | ||
cancelPending(); | ||
scheduleWindowScroll.cancel(); | ||
scheduleDroppableScroll.cancel(); | ||
dragging = null; | ||
@@ -97,5 +91,4 @@ }; | ||
stop, | ||
cancelPending, | ||
scroll: tryScroll, | ||
}; | ||
}; |
@@ -51,3 +51,2 @@ // @flow | ||
scroll, | ||
cancelPending: fluidScroller.cancelPending, | ||
start: fluidScroller.start, | ||
@@ -54,0 +53,0 @@ stop: fluidScroller.stop, |
@@ -12,5 +12,2 @@ // @flow | ||
const shouldCancelPending = (action: Action): boolean => | ||
action.type === 'COLLECTION_STARTING'; | ||
export default (autoScroller: AutoScroller) => (store: MiddlewareStore) => ( | ||
@@ -25,8 +22,2 @@ next: Dispatch, | ||
if (shouldCancelPending(action)) { | ||
autoScroller.cancelPending(); | ||
next(action); | ||
return; | ||
} | ||
if (action.type === 'INITIAL_PUBLISH') { | ||
@@ -33,0 +24,0 @@ // letting the action go first to hydrate the state |
@@ -15,2 +15,5 @@ // @flow | ||
DroppablePublish, | ||
DisplacementMap, | ||
Displacement, | ||
DroppableId, | ||
} from '../../types'; | ||
@@ -23,2 +26,4 @@ import * as timings from '../../debug/timings'; | ||
import scrollDroppable from '../droppable/scroll-droppable'; | ||
import whatIsDraggedOver from '../droppable/what-is-dragged-over'; | ||
import { values } from '../../native-with-fallback'; | ||
@@ -63,11 +68,13 @@ type Args = {| | ||
const updated: DraggableDimension[] = adjustAdditionsForScrollChanges({ | ||
additions: published.additions, | ||
updatedDroppables: droppables, | ||
viewport: state.viewport, | ||
}); | ||
const updatedAdditions: DraggableDimensionMap = toDraggableMap( | ||
adjustAdditionsForScrollChanges({ | ||
additions: published.additions, | ||
updatedDroppables: droppables, | ||
viewport: state.viewport, | ||
}), | ||
); | ||
const draggables: DraggableDimensionMap = { | ||
...state.dimensions.draggables, | ||
...toDraggableMap(updated), | ||
...updatedAdditions, | ||
}; | ||
@@ -99,14 +106,56 @@ | ||
const impact: DragImpact = getDragImpact({ | ||
pageBorderBoxCenter: state.current.page.borderBoxCenter, | ||
draggable: dimensions.draggables[state.critical.draggable.id], | ||
draggables: dimensions.draggables, | ||
droppables: dimensions.droppables, | ||
// starting from a fresh slate | ||
previousImpact: state.impact, | ||
viewport: state.viewport, | ||
userDirection: state.userDirection, | ||
afterCritical, | ||
}); | ||
const impact: DragImpact = (() => { | ||
const previousImpact: DragImpact = (() => { | ||
const wasOver: ?DroppableId = whatIsDraggedOver(state.impact); | ||
if (!wasOver) { | ||
return onLiftImpact; | ||
} | ||
const droppable: DroppableDimension = dimensions.droppables[wasOver]; | ||
if (!droppable.isCombineEnabled) { | ||
return onLiftImpact; | ||
} | ||
// Cheating here | ||
// TODO: pursue a more robust approach | ||
return state.impact; | ||
})(); | ||
const base: DragImpact = getDragImpact({ | ||
pageBorderBoxCenter: state.current.page.borderBoxCenter, | ||
draggable: dimensions.draggables[state.critical.draggable.id], | ||
draggables: dimensions.draggables, | ||
droppables: dimensions.droppables, | ||
previousImpact, | ||
viewport: state.viewport, | ||
userDirection: state.userDirection, | ||
afterCritical, | ||
}); | ||
// strip animation of anything added | ||
const visible: DisplacementMap = values(base.displaced.visible) | ||
.map((displacement: Displacement) => { | ||
if (!updatedAdditions[displacement.draggableId]) { | ||
return displacement; | ||
} | ||
return { | ||
...displacement, | ||
shouldAnimate: false, | ||
}; | ||
}) | ||
.reduce((acc: DisplacementMap, current: Displacement) => { | ||
acc[current.draggableId] = current; | ||
return acc; | ||
}, {}); | ||
const patched: DragImpact = { | ||
...base, | ||
displaced: { | ||
...base.displaced, | ||
visible, | ||
}, | ||
}; | ||
return patched; | ||
})(); | ||
timings.finish(timingsKey); | ||
@@ -113,0 +162,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1409544
38824
284