@nosferatu500/react-dnd-scrollzone
Advanced tools
Comparing version 2.0.0-beta.0 to 2.0.0-beta.1
/// <reference types="react" /> | ||
export declare const createHorizontalStrength: (_buffer: any) => ({ x, w, y, h, }: { | ||
x: any; | ||
w: any; | ||
y: any; | ||
h: any; | ||
}, point: any) => number; | ||
export declare const createVerticalStrength: (_buffer: any) => ({ y, h, x, w, }: { | ||
y: any; | ||
h: any; | ||
x: any; | ||
w: any; | ||
}, point: any) => number; | ||
export declare const defaultHorizontalStrength: ({ x, w, y, h, }: { | ||
x: any; | ||
w: any; | ||
y: any; | ||
h: any; | ||
}, point: any) => number; | ||
export declare const defaultVerticalStrength: ({ y, h, x, w, }: { | ||
y: any; | ||
h: any; | ||
x: any; | ||
w: any; | ||
}, point: any) => number; | ||
export declare const createScrollingComponent: (WrappedComponent: any) => any; | ||
import hoist from 'hoist-non-react-statics'; | ||
export declare type Point = { | ||
x: number; | ||
y: number; | ||
}; | ||
export declare type Size = { | ||
x: number; | ||
w: number; | ||
y: number; | ||
h: number; | ||
}; | ||
export declare const createHorizontalStrength: (_buffer: number) => ({ x, w, y, h, }: Size, point: Point) => number; | ||
export declare const createVerticalStrength: (_buffer: number) => ({ y, h, x, w, }: Size, point: Point) => number; | ||
export declare const defaultHorizontalStrength: ({ x, w, y, h, }: Size, point: Point) => number; | ||
export declare const defaultVerticalStrength: ({ y, h, x, w, }: Size, point: Point) => number; | ||
export declare const createScrollingComponent: (WrappedComponent: any) => ((props: any) => JSX.Element) & hoist.NonReactStatics<any, {}>; | ||
declare const createScrollingComponentWithConsumer: (WrappedComponent: any) => (props: any) => JSX.Element; | ||
export default createScrollingComponentWithConsumer; |
216
esm/index.js
@@ -1,6 +0,3 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import React, { createRef, useEffect } from 'react'; | ||
import throttle from 'lodash.throttle'; | ||
import raf from 'raf'; | ||
import getDisplayName from 'react-display-name'; | ||
import { DndContext } from 'react-dnd'; | ||
@@ -91,84 +88,85 @@ import hoist from 'hoist-non-react-statics'; | ||
const defaultVerticalStrength = createVerticalStrength(DEFAULT_BUFFER); | ||
const defaultProps = { | ||
onScrollChange: noop, | ||
verticalStrength: defaultVerticalStrength, | ||
horizontalStrength: defaultHorizontalStrength, | ||
strengthMultiplier: 30 | ||
}; | ||
const createScrollingComponent = (WrappedComponent) => { | ||
class ScrollingComponent extends Component { | ||
constructor(props, ctx) { | ||
super(props, ctx); | ||
this.updateScrolling = throttle((evt) => { | ||
const { | ||
left: x, | ||
top: y, | ||
width: w, | ||
height: h | ||
} = this.container.getBoundingClientRect(); | ||
const box = { | ||
x, | ||
y, | ||
w, | ||
h | ||
}; | ||
const coords = getCoords(evt); | ||
const { horizontalStrength, verticalStrength } = this.props; | ||
this.scaleX = horizontalStrength(box, coords); | ||
this.scaleY = verticalStrength(box, coords); | ||
if (!this.frame && (this.scaleX || this.scaleY)) { | ||
this.startScrolling(); | ||
const ScrollingComponent = (props) => { | ||
props = __spreadValues(__spreadValues({}, defaultProps), props); | ||
let clearMonitorSubscription = null; | ||
let container = null; | ||
const wrappedInstance = createRef(); | ||
let frame = null; | ||
let scaleX = 0; | ||
let scaleY = 0; | ||
let attached = false; | ||
let dragging = false; | ||
const updateScrolling = throttle((evt) => { | ||
const { | ||
left: x, | ||
top: y, | ||
width: w, | ||
height: h | ||
} = container.getBoundingClientRect(); | ||
const box = { | ||
x, | ||
y, | ||
w, | ||
h | ||
}; | ||
const coords = getCoords(evt); | ||
scaleX = props.horizontalStrength(box, coords); | ||
scaleY = props.verticalStrength(box, coords); | ||
if (!frame && (scaleX || scaleY)) { | ||
startScrolling(); | ||
} | ||
}, 100, { trailing: false }); | ||
useEffect(() => { | ||
container = wrappedInstance.current; | ||
if (container && typeof container.addEventListener === "function") { | ||
container.addEventListener("dragover", handleEvent); | ||
} | ||
window.document.body.addEventListener("touchmove", handleEvent); | ||
clearMonitorSubscription = props.dragDropManager.getMonitor().subscribeToStateChange(() => handleMonitorChange()); | ||
return () => { | ||
if (container && typeof container.removeEventListener === "function") { | ||
container.removeEventListener("dragover", handleEvent); | ||
} | ||
}, 100, { trailing: false }); | ||
this.handleEvent = (evt) => { | ||
if (this.dragging && !this.attached) { | ||
this.attach(); | ||
this.updateScrolling(evt); | ||
} | ||
window.document.body.removeEventListener("touchmove", handleEvent); | ||
clearMonitorSubscription(); | ||
stopScrolling(); | ||
}; | ||
this.wrappedInstance = React.createRef(); | ||
this.scaleX = 0; | ||
this.scaleY = 0; | ||
this.frame = null; | ||
this.attached = false; | ||
this.dragging = false; | ||
} | ||
componentDidMount() { | ||
this.container = this.wrappedInstance.current; | ||
if (this.container && typeof this.container.addEventListener === "function") { | ||
this.container.addEventListener("dragover", this.handleEvent); | ||
}, []); | ||
const handleEvent = (evt) => { | ||
if (dragging && !attached) { | ||
attach(); | ||
updateScrolling(evt); | ||
} | ||
window.document.body.addEventListener("touchmove", this.handleEvent); | ||
const { dragDropManager } = this.props; | ||
this.clearMonitorSubscription = dragDropManager.getMonitor().subscribeToStateChange(() => this.handleMonitorChange()); | ||
} | ||
componentWillUnmount() { | ||
if (this.container && typeof this.container.removeEventListener === "function") { | ||
this.container.removeEventListener("dragover", this.handleEvent); | ||
}; | ||
const handleMonitorChange = () => { | ||
const isDragging = props.dragDropManager.getMonitor().isDragging(); | ||
if (!dragging && isDragging) { | ||
dragging = true; | ||
} else if (dragging && !isDragging) { | ||
dragging = false; | ||
stopScrolling(); | ||
} | ||
window.document.body.removeEventListener("touchmove", this.handleEvent); | ||
this.clearMonitorSubscription(); | ||
this.stopScrolling(); | ||
} | ||
handleMonitorChange() { | ||
const { dragDropManager } = this.props; | ||
const isDragging = dragDropManager.getMonitor().isDragging(); | ||
if (!this.dragging && isDragging) { | ||
this.dragging = true; | ||
} else if (this.dragging && !isDragging) { | ||
this.dragging = false; | ||
this.stopScrolling(); | ||
} | ||
} | ||
attach() { | ||
this.attached = true; | ||
window.document.body.addEventListener("dragover", this.updateScrolling); | ||
window.document.body.addEventListener("touchmove", this.updateScrolling); | ||
} | ||
detach() { | ||
this.attached = false; | ||
window.document.body.removeEventListener("dragover", this.updateScrolling); | ||
window.document.body.removeEventListener("touchmove", this.updateScrolling); | ||
} | ||
startScrolling() { | ||
}; | ||
const attach = () => { | ||
attached = true; | ||
window.document.body.addEventListener("dragover", updateScrolling); | ||
window.document.body.addEventListener("touchmove", updateScrolling); | ||
}; | ||
const detach = () => { | ||
attached = false; | ||
window.document.body.removeEventListener("dragover", updateScrolling); | ||
window.document.body.removeEventListener("touchmove", updateScrolling); | ||
}; | ||
const startScrolling = () => { | ||
let i = 0; | ||
const tick = () => { | ||
const { scaleX, scaleY, container } = this; | ||
const { strengthMultiplier, onScrollChange } = this.props; | ||
if (strengthMultiplier === 0 || scaleX + scaleY === 0) { | ||
this.stopScrolling(); | ||
if (props.strengthMultiplier === 0 || scaleX + scaleY === 0) { | ||
stopScrolling(); | ||
return; | ||
@@ -186,45 +184,29 @@ } | ||
} = container; | ||
const newLeft = scaleX ? container.scrollLeft = intBetween(0, scrollWidth - clientWidth, scrollLeft + scaleX * strengthMultiplier) : scrollLeft; | ||
const newTop = scaleY ? container.scrollTop = intBetween(0, scrollHeight - clientHeight, scrollTop + scaleY * strengthMultiplier) : scrollTop; | ||
onScrollChange(newLeft, newTop); | ||
const newLeft = scaleX ? container.scrollLeft = intBetween(0, scrollWidth - clientWidth, scrollLeft + scaleX * props.strengthMultiplier) : scrollLeft; | ||
const newTop = scaleY ? container.scrollTop = intBetween(0, scrollHeight - clientHeight, scrollTop + scaleY * props.strengthMultiplier) : scrollTop; | ||
props.onScrollChange(newLeft, newTop); | ||
} | ||
this.frame = raf(tick); | ||
frame = requestAnimationFrame(tick); | ||
}; | ||
tick(); | ||
} | ||
stopScrolling() { | ||
this.detach(); | ||
this.scaleX = 0; | ||
this.scaleY = 0; | ||
if (this.frame) { | ||
raf.cancel(this.frame); | ||
this.frame = null; | ||
}; | ||
const stopScrolling = () => { | ||
detach(); | ||
scaleX = 0; | ||
scaleY = 0; | ||
if (frame) { | ||
cancelAnimationFrame(frame); | ||
frame = null; | ||
} | ||
} | ||
render() { | ||
const _a = this.props, props = __objRest(_a, [ | ||
"strengthMultiplier", | ||
"verticalStrength", | ||
"horizontalStrength", | ||
"onScrollChange" | ||
]); | ||
return /* @__PURE__ */ React.createElement(WrappedComponent, __spreadValues({ | ||
ref: this.wrappedInstance | ||
}, props)); | ||
} | ||
} | ||
ScrollingComponent.displayName = `Scrolling(${getDisplayName(WrappedComponent)})`; | ||
ScrollingComponent.propTypes = { | ||
dragDropManager: PropTypes.object.isRequired, | ||
onScrollChange: PropTypes.func, | ||
verticalStrength: PropTypes.func, | ||
horizontalStrength: PropTypes.func, | ||
strengthMultiplier: PropTypes.number | ||
}; | ||
const _a = props, other = __objRest(_a, [ | ||
"strengthMultiplier", | ||
"verticalStrength", | ||
"horizontalStrength", | ||
"onScrollChange" | ||
]); | ||
return /* @__PURE__ */ React.createElement(WrappedComponent, __spreadValues({ | ||
ref: wrappedInstance | ||
}, other)); | ||
}; | ||
ScrollingComponent.defaultProps = { | ||
onScrollChange: noop, | ||
verticalStrength: defaultVerticalStrength, | ||
horizontalStrength: defaultHorizontalStrength, | ||
strengthMultiplier: 30 | ||
}; | ||
return hoist(ScrollingComponent, WrappedComponent); | ||
@@ -231,0 +213,0 @@ }; |
/// <reference types="react" /> | ||
export declare const createHorizontalStrength: (_buffer: any) => ({ x, w, y, h, }: { | ||
x: any; | ||
w: any; | ||
y: any; | ||
h: any; | ||
}, point: any) => number; | ||
export declare const createVerticalStrength: (_buffer: any) => ({ y, h, x, w, }: { | ||
y: any; | ||
h: any; | ||
x: any; | ||
w: any; | ||
}, point: any) => number; | ||
export declare const defaultHorizontalStrength: ({ x, w, y, h, }: { | ||
x: any; | ||
w: any; | ||
y: any; | ||
h: any; | ||
}, point: any) => number; | ||
export declare const defaultVerticalStrength: ({ y, h, x, w, }: { | ||
y: any; | ||
h: any; | ||
x: any; | ||
w: any; | ||
}, point: any) => number; | ||
export declare const createScrollingComponent: (WrappedComponent: any) => any; | ||
import hoist from 'hoist-non-react-statics'; | ||
export declare type Point = { | ||
x: number; | ||
y: number; | ||
}; | ||
export declare type Size = { | ||
x: number; | ||
w: number; | ||
y: number; | ||
h: number; | ||
}; | ||
export declare const createHorizontalStrength: (_buffer: number) => ({ x, w, y, h, }: Size, point: Point) => number; | ||
export declare const createVerticalStrength: (_buffer: number) => ({ y, h, x, w, }: Size, point: Point) => number; | ||
export declare const defaultHorizontalStrength: ({ x, w, y, h, }: Size, point: Point) => number; | ||
export declare const defaultVerticalStrength: ({ y, h, x, w, }: Size, point: Point) => number; | ||
export declare const createScrollingComponent: (WrappedComponent: any) => ((props: any) => JSX.Element) & hoist.NonReactStatics<any, {}>; | ||
declare const createScrollingComponentWithConsumer: (WrappedComponent: any) => (props: any) => JSX.Element; | ||
export default createScrollingComponentWithConsumer; |
276
index.js
@@ -6,7 +6,4 @@ 'use strict'; | ||
var jsxRuntime = require('react/jsx-runtime'); | ||
var React = require('react'); | ||
var PropTypes = require('prop-types'); | ||
var react = require('react'); | ||
var throttle = require('lodash.throttle'); | ||
var raf = require('raf'); | ||
var getDisplayName = require('react-display-name'); | ||
var reactDnd = require('react-dnd'); | ||
@@ -17,23 +14,21 @@ var hoist = require('hoist-non-react-statics'); | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes); | ||
var throttle__default = /*#__PURE__*/_interopDefaultLegacy(throttle); | ||
var raf__default = /*#__PURE__*/_interopDefaultLegacy(raf); | ||
var getDisplayName__default = /*#__PURE__*/_interopDefaultLegacy(getDisplayName); | ||
var hoist__default = /*#__PURE__*/_interopDefaultLegacy(hoist); | ||
function _inheritsLoose(subClass, superClass) { | ||
subClass.prototype = Object.create(superClass.prototype); | ||
subClass.prototype.constructor = subClass; | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
_setPrototypeOf(subClass, superClass); | ||
} | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
return target; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
return _extends.apply(this, arguments); | ||
} | ||
@@ -124,122 +119,100 @@ | ||
var defaultVerticalStrength = createVerticalStrength(DEFAULT_BUFFER); | ||
var defaultProps = { | ||
onScrollChange: noop, | ||
verticalStrength: defaultVerticalStrength, | ||
horizontalStrength: defaultHorizontalStrength, | ||
strengthMultiplier: 30 | ||
}; | ||
var createScrollingComponent = function createScrollingComponent(WrappedComponent) { | ||
var ScrollingComponent = function (_Component) { | ||
_inheritsLoose(ScrollingComponent, _Component); | ||
var ScrollingComponent = function ScrollingComponent(props) { | ||
props = _extends({}, defaultProps, props); | ||
var clearMonitorSubscription = null; | ||
var container = null; | ||
var wrappedInstance = react.createRef(); | ||
var frame = null; | ||
var scaleX = 0; | ||
var scaleY = 0; | ||
var attached = false; | ||
var dragging = false; | ||
var updateScrolling = throttle__default['default'](function (evt) { | ||
var _container$getBoundin = container.getBoundingClientRect(), | ||
x = _container$getBoundin.left, | ||
y = _container$getBoundin.top, | ||
w = _container$getBoundin.width, | ||
h = _container$getBoundin.height; | ||
function ScrollingComponent(props, ctx) { | ||
var _this; | ||
var box = { | ||
x: x, | ||
y: y, | ||
w: w, | ||
h: h | ||
}; | ||
var coords = getCoords(evt); | ||
scaleX = props.horizontalStrength(box, coords); | ||
scaleY = props.verticalStrength(box, coords); | ||
_this = _Component.call(this, props, ctx) || this; | ||
_this.updateScrolling = throttle__default['default'](function (evt) { | ||
var _this$container$getBo = _this.container.getBoundingClientRect(), | ||
x = _this$container$getBo.left, | ||
y = _this$container$getBo.top, | ||
w = _this$container$getBo.width, | ||
h = _this$container$getBo.height; | ||
if (!frame && (scaleX || scaleY)) { | ||
startScrolling(); | ||
} | ||
}, 100, { | ||
trailing: false | ||
}); | ||
react.useEffect(function () { | ||
container = wrappedInstance.current; | ||
var box = { | ||
x: x, | ||
y: y, | ||
w: w, | ||
h: h | ||
}; | ||
var coords = getCoords(evt); | ||
var _this$props = _this.props, | ||
horizontalStrength = _this$props.horizontalStrength, | ||
verticalStrength = _this$props.verticalStrength; | ||
_this.scaleX = horizontalStrength(box, coords); | ||
_this.scaleY = verticalStrength(box, coords); | ||
if (container && typeof container.addEventListener === 'function') { | ||
container.addEventListener('dragover', handleEvent); | ||
} | ||
if (!_this.frame && (_this.scaleX || _this.scaleY)) { | ||
_this.startScrolling(); | ||
window.document.body.addEventListener('touchmove', handleEvent); | ||
clearMonitorSubscription = props.dragDropManager.getMonitor().subscribeToStateChange(function () { | ||
return handleMonitorChange(); | ||
}); | ||
return function () { | ||
if (container && typeof container.removeEventListener === 'function') { | ||
container.removeEventListener('dragover', handleEvent); | ||
} | ||
}, 100, { | ||
trailing: false | ||
}); | ||
_this.handleEvent = function (evt) { | ||
if (_this.dragging && !_this.attached) { | ||
_this.attach(); | ||
_this.updateScrolling(evt); | ||
} | ||
window.document.body.removeEventListener('touchmove', handleEvent); | ||
clearMonitorSubscription(); | ||
stopScrolling(); | ||
}; | ||
}, []); | ||
_this.wrappedInstance = React__default['default'].createRef(); | ||
_this.scaleX = 0; | ||
_this.scaleY = 0; | ||
_this.frame = null; | ||
_this.attached = false; | ||
_this.dragging = false; | ||
return _this; | ||
} | ||
var _proto = ScrollingComponent.prototype; | ||
_proto.componentDidMount = function componentDidMount() { | ||
var _this2 = this; | ||
this.container = this.wrappedInstance.current; | ||
if (this.container && typeof this.container.addEventListener === 'function') { | ||
this.container.addEventListener('dragover', this.handleEvent); | ||
var handleEvent = function handleEvent(evt) { | ||
if (dragging && !attached) { | ||
attach(); | ||
updateScrolling(evt); | ||
} | ||
window.document.body.addEventListener('touchmove', this.handleEvent); | ||
var dragDropManager = this.props.dragDropManager; | ||
this.clearMonitorSubscription = dragDropManager.getMonitor().subscribeToStateChange(function () { | ||
return _this2.handleMonitorChange(); | ||
}); | ||
}; | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
if (this.container && typeof this.container.removeEventListener === 'function') { | ||
this.container.removeEventListener('dragover', this.handleEvent); | ||
} | ||
var handleMonitorChange = function handleMonitorChange() { | ||
var isDragging = props.dragDropManager.getMonitor().isDragging(); | ||
window.document.body.removeEventListener('touchmove', this.handleEvent); | ||
this.clearMonitorSubscription(); | ||
this.stopScrolling(); | ||
}; | ||
_proto.handleMonitorChange = function handleMonitorChange() { | ||
var dragDropManager = this.props.dragDropManager; | ||
var isDragging = dragDropManager.getMonitor().isDragging(); | ||
if (!this.dragging && isDragging) { | ||
this.dragging = true; | ||
} else if (this.dragging && !isDragging) { | ||
this.dragging = false; | ||
this.stopScrolling(); | ||
if (!dragging && isDragging) { | ||
dragging = true; | ||
} else if (dragging && !isDragging) { | ||
dragging = false; | ||
stopScrolling(); | ||
} | ||
}; | ||
_proto.attach = function attach() { | ||
this.attached = true; | ||
window.document.body.addEventListener('dragover', this.updateScrolling); | ||
window.document.body.addEventListener('touchmove', this.updateScrolling); | ||
var attach = function attach() { | ||
attached = true; | ||
window.document.body.addEventListener('dragover', updateScrolling); | ||
window.document.body.addEventListener('touchmove', updateScrolling); | ||
}; | ||
_proto.detach = function detach() { | ||
this.attached = false; | ||
window.document.body.removeEventListener('dragover', this.updateScrolling); | ||
window.document.body.removeEventListener('touchmove', this.updateScrolling); | ||
var detach = function detach() { | ||
attached = false; | ||
window.document.body.removeEventListener('dragover', updateScrolling); | ||
window.document.body.removeEventListener('touchmove', updateScrolling); | ||
}; | ||
_proto.startScrolling = function startScrolling() { | ||
var _this3 = this; | ||
var startScrolling = function startScrolling() { | ||
var i = 0; | ||
var tick = function tick() { | ||
var scaleX = _this3.scaleX, | ||
scaleY = _this3.scaleY, | ||
container = _this3.container; | ||
var _this3$props = _this3.props, | ||
strengthMultiplier = _this3$props.strengthMultiplier, | ||
onScrollChange = _this3$props.onScrollChange; | ||
if (strengthMultiplier === 0 || scaleX + scaleY === 0) { | ||
_this3.stopScrolling(); | ||
if (props.strengthMultiplier === 0 || scaleX + scaleY === 0) { | ||
stopScrolling(); | ||
return; | ||
@@ -251,14 +224,15 @@ } | ||
if (i % 2) { | ||
var scrollLeft = container.scrollLeft, | ||
scrollTop = container.scrollTop, | ||
scrollWidth = container.scrollWidth, | ||
scrollHeight = container.scrollHeight, | ||
clientWidth = container.clientWidth, | ||
clientHeight = container.clientHeight; | ||
var newLeft = scaleX ? container.scrollLeft = intBetween(0, scrollWidth - clientWidth, scrollLeft + scaleX * strengthMultiplier) : scrollLeft; | ||
var newTop = scaleY ? container.scrollTop = intBetween(0, scrollHeight - clientHeight, scrollTop + scaleY * strengthMultiplier) : scrollTop; | ||
onScrollChange(newLeft, newTop); | ||
var _container = container, | ||
scrollLeft = _container.scrollLeft, | ||
scrollTop = _container.scrollTop, | ||
scrollWidth = _container.scrollWidth, | ||
scrollHeight = _container.scrollHeight, | ||
clientWidth = _container.clientWidth, | ||
clientHeight = _container.clientHeight; | ||
var newLeft = scaleX ? container.scrollLeft = intBetween(0, scrollWidth - clientWidth, scrollLeft + scaleX * props.strengthMultiplier) : scrollLeft; | ||
var newTop = scaleY ? container.scrollTop = intBetween(0, scrollHeight - clientHeight, scrollTop + scaleY * props.strengthMultiplier) : scrollTop; | ||
props.onScrollChange(newLeft, newTop); | ||
} | ||
_this3.frame = raf__default['default'](tick); | ||
frame = requestAnimationFrame(tick); | ||
}; | ||
@@ -269,43 +243,25 @@ | ||
_proto.stopScrolling = function stopScrolling() { | ||
this.detach(); | ||
this.scaleX = 0; | ||
this.scaleY = 0; | ||
var stopScrolling = function stopScrolling() { | ||
detach(); | ||
scaleX = 0; | ||
scaleY = 0; | ||
if (this.frame) { | ||
raf__default['default'].cancel(this.frame); | ||
this.frame = null; | ||
if (frame) { | ||
cancelAnimationFrame(frame); | ||
frame = null; | ||
} | ||
}; | ||
_proto.render = function render() { | ||
var _this$props2 = this.props; | ||
_this$props2.strengthMultiplier; | ||
_this$props2.verticalStrength; | ||
_this$props2.horizontalStrength; | ||
_this$props2.onScrollChange; | ||
var props = _objectWithoutPropertiesLoose(_this$props2, _excluded); | ||
var _props = props; | ||
_props.strengthMultiplier; | ||
_props.verticalStrength; | ||
_props.horizontalStrength; | ||
_props.onScrollChange; | ||
var other = _objectWithoutPropertiesLoose(_props, _excluded); | ||
return jsxRuntime.jsx(WrappedComponent, Object.assign({ | ||
ref: this.wrappedInstance | ||
}, props), void 0); | ||
}; | ||
return jsxRuntime.jsx(WrappedComponent, Object.assign({ | ||
ref: wrappedInstance | ||
}, other), void 0); | ||
}; | ||
return ScrollingComponent; | ||
}(React.Component); | ||
ScrollingComponent.displayName = "Scrolling(" + getDisplayName__default['default'](WrappedComponent) + ")"; | ||
ScrollingComponent.propTypes = { | ||
dragDropManager: PropTypes__default['default'].object.isRequired, | ||
onScrollChange: PropTypes__default['default'].func, | ||
verticalStrength: PropTypes__default['default'].func, | ||
horizontalStrength: PropTypes__default['default'].func, | ||
strengthMultiplier: PropTypes__default['default'].number | ||
}; | ||
ScrollingComponent.defaultProps = { | ||
onScrollChange: noop, | ||
verticalStrength: defaultVerticalStrength, | ||
horizontalStrength: defaultHorizontalStrength, | ||
strengthMultiplier: 30 | ||
}; | ||
return hoist__default['default'](ScrollingComponent, WrappedComponent); | ||
@@ -312,0 +268,0 @@ }; |
{ | ||
"name": "@nosferatu500/react-dnd-scrollzone", | ||
"version": "2.0.0-beta.0", | ||
"version": "2.0.0-beta.1", | ||
"description": "A cross browser solution to scrolling during drag and drop.", | ||
@@ -38,3 +38,2 @@ "main": "./index.js", | ||
"drag and drop", | ||
"polyfill", | ||
"auto" | ||
@@ -49,6 +48,3 @@ ], | ||
"hoist-non-react-statics": "^3.3.2", | ||
"lodash.throttle": "^4.1.1", | ||
"prop-types": "^15.7.2", | ||
"raf": "^3.4.1", | ||
"react-display-name": "^0.2.5" | ||
"lodash.throttle": "^4.1.1" | ||
}, | ||
@@ -55,0 +51,0 @@ "peerDependencies": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5
0
26809
507
- Removedprop-types@^15.7.2
- Removedraf@^3.4.1
- Removedreact-display-name@^0.2.5
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedraf@3.4.1(transitive)
- Removedreact-display-name@0.2.5(transitive)