Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-dnd

Package Overview
Dependencies
Maintainers
3
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dnd - npm Package Compare versions

Comparing version 7.4.1 to 7.4.2

lib/cjs/utils/isRefable.d.ts

6

lib/cjs/decorateHandler.js

@@ -30,3 +30,3 @@ "use strict";

var disposables_1 = require("./utils/disposables");
var isClassComponent = require('recompose/isClassComponent').default;
var isRefable_1 = require("./utils/isRefable");
var isPlainObject = require('lodash/isPlainObject');

@@ -61,3 +61,3 @@ var invariant = require('invariant');

DragDropContainer.prototype.getDecoratedComponentInstance = function () {
invariant(this.decoratedRef.current, 'In order to access an instance of the decorated component it can not be a stateless component.');
invariant(this.decoratedRef.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
return this.decoratedRef.current;

@@ -135,3 +135,3 @@ };

// NOTE: if Decorated is a Function Component, decoratedRef will not be populated unless it's a refforwarding component.
ref: isClassComponent(Decorated) ? _this.decoratedRef : null })));
ref: isRefable_1.isRefable(Decorated) ? _this.decoratedRef : null })));
}));

@@ -138,0 +138,0 @@ };

@@ -30,2 +30,3 @@ "use strict";

var checkDecoratorArguments_1 = require("./utils/checkDecoratorArguments");
var isRefable_1 = require("./utils/isRefable");
var invariant = require('invariant');

@@ -80,3 +81,3 @@ var hoistStatics = require('hoist-non-react-statics');

DragDropContextContainer.prototype.getDecoratedComponentInstance = function () {
invariant(this.ref.current, 'In order to access an instance of the decorated component it can not be a stateless component.');
invariant(this.ref.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
return this.ref.current;

@@ -86,3 +87,3 @@ };

return (React.createElement(exports.Provider, { value: childContext },
React.createElement(Decorated, __assign({}, this.props, { ref: this.ref }))));
React.createElement(Decorated, __assign({}, this.props, { ref: isRefable_1.isRefable(Decorated) ? this.ref : null }))));
};

@@ -89,0 +90,0 @@ DragDropContextContainer.DecoratedComponent = DecoratedComponent;

@@ -30,2 +30,3 @@ "use strict";

var DragDropContext_1 = require("./DragDropContext");
var isRefable_1 = require("./utils/isRefable");
var hoistStatics = require('hoist-non-react-statics');

@@ -63,3 +64,3 @@ var isPlainObject = require('lodash/isPlainObject');

DragLayerContainer.prototype.getDecoratedComponentInstance = function () {
invariant(this.ref.current, 'In order to access an instance of the decorated component it can not be a stateless component.');
invariant(this.ref.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
return this.ref.current;

@@ -98,3 +99,3 @@ };

}
return (React.createElement(Decorated, __assign({}, _this.props, _this.state, { ref: _this.ref })));
return (React.createElement(Decorated, __assign({}, _this.props, _this.state, { ref: isRefable_1.isRefable(Decorated) ? _this.ref : null })));
}));

@@ -101,0 +102,0 @@ };

@@ -33,4 +33,11 @@ "use strict";

canDrag: function () {
var canDrag = spec.current.canDrag;
return canDrag ? canDrag(monitor) : true;
if (typeof spec.current.canDrag === 'boolean') {
return spec.current.canDrag;
}
else if (typeof spec.current.canDrag === 'function') {
return spec.current.canDrag(monitor);
}
else {
return true;
}
},

@@ -37,0 +44,0 @@ isDragging: function (globalMonitor, target) {

@@ -44,3 +44,3 @@ import { TargetType, SourceType } from 'dnd-core';

*/
canDrag?: (monitor: DragSourceMonitor) => boolean;
canDrag?: boolean | ((monitor: DragSourceMonitor) => boolean);
/**

@@ -47,0 +47,0 @@ * Optional.

import * as React from 'react';
import { Consumer } from './DragDropContext';
import { Disposable, CompositeDisposable, SerialDisposable, } from './utils/disposables';
const isClassComponent = require('recompose/isClassComponent').default;
import { isRefable } from './utils/isRefable';
const isPlainObject = require('lodash/isPlainObject');

@@ -31,3 +31,3 @@ const invariant = require('invariant');

getDecoratedComponentInstance() {
invariant(this.decoratedRef.current, 'In order to access an instance of the decorated component it can not be a stateless component.');
invariant(this.decoratedRef.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
return this.decoratedRef.current;

@@ -103,3 +103,3 @@ }

// NOTE: if Decorated is a Function Component, decoratedRef will not be populated unless it's a refforwarding component.
ref: isClassComponent(Decorated) ? this.decoratedRef : null })));
ref: isRefable(Decorated) ? this.decoratedRef : null })));
}));

@@ -106,0 +106,0 @@ }

import * as React from 'react';
import { createDragDropManager, } from 'dnd-core';
import checkDecoratorArguments from './utils/checkDecoratorArguments';
import { isRefable } from './utils/isRefable';
const invariant = require('invariant');

@@ -49,3 +50,3 @@ const hoistStatics = require('hoist-non-react-statics');

getDecoratedComponentInstance() {
invariant(this.ref.current, 'In order to access an instance of the decorated component it can not be a stateless component.');
invariant(this.ref.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
return this.ref.current;

@@ -55,3 +56,3 @@ }

return (React.createElement(Provider, { value: childContext },
React.createElement(Decorated, Object.assign({}, this.props, { ref: this.ref }))));
React.createElement(Decorated, Object.assign({}, this.props, { ref: isRefable(Decorated) ? this.ref : null }))));
}

@@ -58,0 +59,0 @@ }

import * as React from 'react';
import checkDecoratorArguments from './utils/checkDecoratorArguments';
import { Consumer } from './DragDropContext';
import { isRefable } from './utils/isRefable';
const hoistStatics = require('hoist-non-react-statics');

@@ -33,3 +34,3 @@ const isPlainObject = require('lodash/isPlainObject');

getDecoratedComponentInstance() {
invariant(this.ref.current, 'In order to access an instance of the decorated component it can not be a stateless component.');
invariant(this.ref.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
return this.ref.current;

@@ -66,3 +67,3 @@ }

}
return (React.createElement(Decorated, Object.assign({}, this.props, this.state, { ref: this.ref })));
return (React.createElement(Decorated, Object.assign({}, this.props, this.state, { ref: isRefable(Decorated) ? this.ref : null })));
}));

@@ -69,0 +70,0 @@ }

@@ -30,4 +30,11 @@ import { useEffect, useMemo } from 'react';

canDrag() {
const { canDrag } = spec.current;
return canDrag ? canDrag(monitor) : true;
if (typeof spec.current.canDrag === 'boolean') {
return spec.current.canDrag;
}
else if (typeof spec.current.canDrag === 'function') {
return spec.current.canDrag(monitor);
}
else {
return true;
}
},

@@ -34,0 +41,0 @@ isDragging(globalMonitor, target) {

@@ -44,3 +44,3 @@ import { TargetType, SourceType } from 'dnd-core';

*/
canDrag?: (monitor: DragSourceMonitor) => boolean;
canDrag?: boolean | ((monitor: DragSourceMonitor) => boolean);
/**

@@ -47,0 +47,0 @@ * Optional.

{
"name": "react-dnd",
"version": "7.4.1",
"version": "7.4.2",
"description": "Drag and Drop for React",

@@ -28,3 +28,2 @@ "main": "lib/cjs/index.js",

"lodash": "^4.17.11",
"recompose": "^0.30.0",
"shallowequal": "^1.1.0"

@@ -52,3 +51,3 @@ },

},
"gitHead": "383a7f63566db164afde549f33fd20676059a339"
"gitHead": "30579d2e2680f12be8c2589509069100f289ab3c"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc