react-grid-layout
Advanced tools
+23
-7
@@ -8,2 +8,3 @@ "use strict"; | ||
| var _react = _interopRequireDefault(require("react")); | ||
| var _reactDom = require("react-dom"); | ||
| var _propTypes = _interopRequireDefault(require("prop-types")); | ||
@@ -170,4 +171,5 @@ var _reactDraggable = require("react-draggable"); | ||
| * @param {Object} callbackData an object with node, delta and position information | ||
| * @param {boolean} dontFlush if true, will not call flushSync | ||
| */ | ||
| _defineProperty(this, "onDrag", (e, _ref2) => { | ||
| _defineProperty(this, "onDrag", (e, _ref2, dontFlush) => { | ||
| let { | ||
@@ -218,6 +220,16 @@ node, | ||
| }; | ||
| this.setState({ | ||
| dragging: newPosition | ||
| }); | ||
| // dontFlush is set if we're calling from inside | ||
| if (dontFlush) { | ||
| this.setState({ | ||
| dragging: newPosition | ||
| }); | ||
| } else { | ||
| (0, _reactDom.flushSync)(() => { | ||
| this.setState({ | ||
| dragging: newPosition | ||
| }); | ||
| }); | ||
| } | ||
| // Call callback with this data | ||
@@ -335,5 +347,7 @@ const { | ||
| deltaY | ||
| }); | ||
| }, true // dontFLush: avoid flushSync to temper warnings | ||
| ); | ||
| } | ||
| } | ||
| getPositionParams() /*: PositionParams*/{ | ||
@@ -488,4 +502,6 @@ let props /*: Props*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; | ||
| updatedSize = (0, _utils.resizeItemInDirection)(handle, position, size, containerWidth); | ||
| this.setState({ | ||
| resizing: handlerName === "onResizeStop" ? null : updatedSize | ||
| (0, _reactDom.flushSync)(() => { | ||
| this.setState({ | ||
| resizing: handlerName === "onResizeStop" ? null : updatedSize | ||
| }); | ||
| }); | ||
@@ -492,0 +508,0 @@ } |
+27
-10
| // @flow | ||
| import React from "react"; | ||
| import { flushSync } from "react-dom"; | ||
| import PropTypes from "prop-types"; | ||
@@ -296,7 +297,11 @@ import { DraggableCore } from "react-draggable"; | ||
| this.onDrag(droppingPosition.e, { | ||
| node, | ||
| deltaX, | ||
| deltaY | ||
| }); | ||
| this.onDrag( | ||
| droppingPosition.e, | ||
| { | ||
| node, | ||
| deltaX, | ||
| deltaY | ||
| }, | ||
| true // dontFLush: avoid flushSync to temper warnings | ||
| ); | ||
| } | ||
@@ -485,6 +490,8 @@ } | ||
| * @param {Object} callbackData an object with node, delta and position information | ||
| * @param {boolean} dontFlush if true, will not call flushSync | ||
| */ | ||
| onDrag: (Event, ReactDraggableCallbackData) => void = ( | ||
| onDrag: (Event, ReactDraggableCallbackData, boolean) => void = ( | ||
| e, | ||
| { node, deltaX, deltaY } | ||
| { node, deltaX, deltaY }, | ||
| dontFlush | ||
| ) => { | ||
@@ -521,4 +528,12 @@ const { onDrag } = this.props; | ||
| const newPosition: PartialPosition = { top, left }; | ||
| this.setState({ dragging: newPosition }); | ||
| // dontFlush is set if we're calling from inside | ||
| if (dontFlush) { | ||
| this.setState({ dragging: newPosition }); | ||
| } else { | ||
| flushSync(() => { | ||
| this.setState({ dragging: newPosition }); | ||
| }); | ||
| } | ||
| // Call callback with this data | ||
@@ -598,4 +613,6 @@ const { x, y } = calcXY(positionParams, top, left, w, h); | ||
| ); | ||
| this.setState({ | ||
| resizing: handlerName === "onResizeStop" ? null : updatedSize | ||
| flushSync(() => { | ||
| this.setState({ | ||
| resizing: handlerName === "onResizeStop" ? null : updatedSize | ||
| }); | ||
| }); | ||
@@ -602,0 +619,0 @@ } |
+1
-1
| { | ||
| "name": "react-grid-layout", | ||
| "version": "1.5.0", | ||
| "version": "1.5.1", | ||
| "description": "A draggable and resizable grid layout with responsive breakpoints, for React.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
526942
0.22%6641
0.45%28
12%