react-dnd
Advanced tools
Comparing version
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var wrapConnectorHooks_1 = __importDefault(require("./wrapConnectorHooks")); | ||
var shallowequal_1 = __importDefault(require("shallowequal")); | ||
var wrapConnectorHooks_1 = require("./wrapConnectorHooks"); | ||
var shallowEqual = require('shallowequal'); | ||
function createSourceConnector(backend) { | ||
@@ -45,3 +42,3 @@ var currentHandlerId; | ||
if (node === currentDragSourceNode && | ||
shallowequal_1.default(options, currentDragSourceOptions)) { | ||
shallowEqual(options, currentDragSourceOptions)) { | ||
return; | ||
@@ -55,3 +52,3 @@ } | ||
if (node === currentDragPreviewNode && | ||
shallowequal_1.default(options, currentDragPreviewOptions)) { | ||
shallowEqual(options, currentDragPreviewOptions)) { | ||
return; | ||
@@ -58,0 +55,0 @@ } |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var invariant_1 = __importDefault(require("invariant")); | ||
var isPlainObject_1 = __importDefault(require("lodash/isPlainObject")); | ||
var invariant = require('invariant'); | ||
var isPlainObject = require('lodash/isPlainObject'); | ||
var ALLOWED_SPEC_METHODS = ['canDrag', 'beginDrag', 'isDragging', 'endDrag']; | ||
@@ -12,7 +9,7 @@ var REQUIRED_SPEC_METHODS = ['beginDrag']; | ||
Object.keys(spec).forEach(function (key) { | ||
invariant_1.default(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drag source specification to only have ' + | ||
invariant(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drag source specification to only have ' + | ||
'some of the following keys: %s. ' + | ||
'Instead received a specification with an unexpected "%s" key. ' + | ||
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', ALLOWED_SPEC_METHODS.join(', '), key); | ||
invariant_1.default(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + | ||
invariant(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + | ||
'Instead received a specification with %s: %s. ' + | ||
@@ -22,3 +19,3 @@ 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', key, key, spec[key]); | ||
REQUIRED_SPEC_METHODS.forEach(function (key) { | ||
invariant_1.default(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + | ||
invariant(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + | ||
'Instead received a specification with %s: %s. ' + | ||
@@ -63,3 +60,3 @@ 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', key, key, spec[key]); | ||
if (process.env.NODE_ENV !== 'production') { | ||
invariant_1.default(isPlainObject_1.default(item), 'beginDrag() must return a plain object that represents the dragged item. ' + | ||
invariant(isPlainObject(item), 'beginDrag() must return a plain object that represents the dragged item. ' + | ||
'Instead received %s. ' + | ||
@@ -66,0 +63,0 @@ 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', item); |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var invariant_1 = __importDefault(require("invariant")); | ||
var invariant = require('invariant'); | ||
var isCallingCanDrag = false; | ||
@@ -17,3 +14,3 @@ var isCallingIsDragging = false; | ||
SourceMonitor.prototype.canDrag = function () { | ||
invariant_1.default(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' + | ||
invariant(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' + | ||
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source-monitor.html'); | ||
@@ -29,3 +26,3 @@ try { | ||
SourceMonitor.prototype.isDragging = function () { | ||
invariant_1.default(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' + | ||
invariant(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' + | ||
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source-monitor.html'); | ||
@@ -32,0 +29,0 @@ try { |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var wrapConnectorHooks_1 = __importDefault(require("./wrapConnectorHooks")); | ||
var shallowequal_1 = __importDefault(require("shallowequal")); | ||
var wrapConnectorHooks_1 = require("./wrapConnectorHooks"); | ||
var shallowEqual = require('shallowequal'); | ||
function createTargetConnector(backend) { | ||
@@ -32,3 +29,3 @@ var currentHandlerId; | ||
if (node === currentDropTargetNode && | ||
shallowequal_1.default(options, currentDropTargetOptions)) { | ||
shallowEqual(options, currentDropTargetOptions)) { | ||
return; | ||
@@ -35,0 +32,0 @@ } |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var invariant_1 = __importDefault(require("invariant")); | ||
var isPlainObject_1 = __importDefault(require("lodash/isPlainObject")); | ||
var invariant = require('invariant'); | ||
var isPlainObject = require('lodash/isPlainObject'); | ||
var ALLOWED_SPEC_METHODS = ['canDrop', 'hover', 'drop']; | ||
function createTargetFactory(spec) { | ||
Object.keys(spec).forEach(function (key) { | ||
invariant_1.default(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drop target specification to only have ' + | ||
invariant(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drop target specification to only have ' + | ||
'some of the following keys: %s. ' + | ||
'Instead received a specification with an unexpected "%s" key. ' + | ||
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', ALLOWED_SPEC_METHODS.join(', '), key); | ||
invariant_1.default(typeof spec[key] === 'function', 'Expected %s in the drop target specification to be a function. ' + | ||
invariant(typeof spec[key] === 'function', 'Expected %s in the drop target specification to be a function. ' + | ||
'Instead received a specification with %s: %s. ' + | ||
@@ -52,3 +49,3 @@ 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', key, key, spec[key]); | ||
if (process.env.NODE_ENV !== 'production') { | ||
invariant_1.default(typeof dropResult === 'undefined' || isPlainObject_1.default(dropResult), 'drop() must either return undefined, or an object that represents the drop result. ' + | ||
invariant(typeof dropResult === 'undefined' || isPlainObject(dropResult), 'drop() must either return undefined, or an object that represents the drop result. ' + | ||
'Instead received %s. ' + | ||
@@ -55,0 +52,0 @@ 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', dropResult); |
@@ -1,2 +0,2 @@ | ||
import { DragDropManager, XYCoord } from 'dnd-core'; | ||
import { DragDropManager } from 'dnd-core'; | ||
import { DropTargetMonitor } from './interfaces'; | ||
@@ -16,8 +16,8 @@ export declare class TargetMonitor implements DropTargetMonitor { | ||
didDrop(): boolean; | ||
getInitialClientOffset(): XYCoord | null; | ||
getInitialSourceClientOffset(): XYCoord | null; | ||
getSourceClientOffset(): XYCoord | null; | ||
getClientOffset(): XYCoord | null; | ||
getDifferenceFromInitialOffset(): XYCoord | null; | ||
getInitialClientOffset(): import("../../dnd-core/lib/interfaces").XYCoord | null; | ||
getInitialSourceClientOffset(): import("../../dnd-core/lib/interfaces").XYCoord | null; | ||
getSourceClientOffset(): import("../../dnd-core/lib/interfaces").XYCoord | null; | ||
getClientOffset(): import("../../dnd-core/lib/interfaces").XYCoord | null; | ||
getDifferenceFromInitialOffset(): import("../../dnd-core/lib/interfaces").XYCoord | null; | ||
} | ||
export default function createTargetMonitor<Context>(manager: DragDropManager<Context>): DropTargetMonitor; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var invariant_1 = __importDefault(require("invariant")); | ||
var invariant = require('invariant'); | ||
var isCallingCanDrop = false; | ||
@@ -16,3 +13,3 @@ var TargetMonitor = /** @class */ (function () { | ||
TargetMonitor.prototype.canDrop = function () { | ||
invariant_1.default(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + | ||
invariant(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + | ||
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target-monitor.html'); | ||
@@ -19,0 +16,0 @@ try { |
@@ -20,23 +20,13 @@ "use strict"; | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var React = __importStar(require("react")); | ||
var isPlainObject_1 = __importDefault(require("lodash/isPlainObject")); | ||
var invariant_1 = __importDefault(require("invariant")); | ||
var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics")); | ||
var React = require("react"); | ||
var DragDropContext_1 = require("./DragDropContext"); | ||
var shallowequal_1 = __importDefault(require("shallowequal")); | ||
var disposables_1 = require("./utils/disposables"); | ||
var isPlainObject = require('lodash/isPlainObject'); | ||
var invariant = require('invariant'); | ||
var hoistStatics = require('hoist-non-react-statics'); | ||
var shallowEqual = require('shallowequal'); | ||
function decorateHandler(_a) { | ||
var DecoratedComponent = _a.DecoratedComponent, createHandler = _a.createHandler, createMonitor = _a.createMonitor, createConnector = _a.createConnector, registerHandler = _a.registerHandler, containerDisplayName = _a.containerDisplayName, getType = _a.getType, collect = _a.collect, options = _a.options; | ||
var _b = options.arePropsEqual, arePropsEqual = _b === void 0 ? shallowequal_1.default : _b; | ||
var _b = options.arePropsEqual, arePropsEqual = _b === void 0 ? shallowEqual : _b; | ||
var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component'; | ||
@@ -63,3 +53,3 @@ var DragDropContainer = /** @class */ (function (_super) { | ||
return (!arePropsEqual(nextProps, this.props) || | ||
!shallowequal_1.default(nextState, this.state)); | ||
!shallowEqual(nextState, this.state)); | ||
}; | ||
@@ -111,3 +101,3 @@ DragDropContainer.prototype.componentDidMount = function () { | ||
var nextState = this.getCurrentState(); | ||
if (!shallowequal_1.default(nextState, this.state)) { | ||
if (!shallowEqual(nextState, this.state)) { | ||
this.setState(nextState); | ||
@@ -135,3 +125,3 @@ } | ||
if (process.env.NODE_ENV !== 'production') { | ||
invariant_1.default(isPlainObject_1.default(nextState), 'Expected `collect` specified as the second argument to ' + | ||
invariant(isPlainObject(nextState), 'Expected `collect` specified as the second argument to ' + | ||
'%s for %s to return a plain object of props to inject. ' + | ||
@@ -162,3 +152,3 @@ 'Instead, received %s.', containerDisplayName, displayName, nextState); | ||
this.manager = dragDropManager; | ||
invariant_1.default(typeof dragDropManager === 'object', 'Could not find the drag and drop manager in the context of %s. ' + | ||
invariant(typeof dragDropManager === 'object', 'Could not find the drag and drop manager in the context of %s. ' + | ||
'Make sure to wrap the top-level component of your app with DragDropContext. ' + | ||
@@ -174,4 +164,4 @@ 'Read more: http://react-dnd.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName); | ||
}(React.Component)); | ||
return hoist_non_react_statics_1.default(DragDropContainer, DecoratedComponent); | ||
return hoistStatics(DragDropContainer, DecoratedComponent); | ||
} | ||
exports.default = decorateHandler; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import * as React from 'react'; | ||
import { DragDropManager, BackendFactory } from 'dnd-core'; | ||
@@ -3,0 +3,0 @@ import { ContextComponent } from './interfaces'; |
@@ -20,16 +20,13 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var _a; | ||
var react_1 = __importDefault(require("react")); | ||
var React = require("react"); | ||
var dnd_core_1 = require("dnd-core"); | ||
var invariant_1 = __importDefault(require("invariant")); | ||
var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics")); | ||
var checkDecoratorArguments_1 = __importDefault(require("./utils/checkDecoratorArguments")); | ||
var checkDecoratorArguments_1 = require("./utils/checkDecoratorArguments"); | ||
var invariant = require('invariant'); | ||
var hoistStatics = require('hoist-non-react-statics'); | ||
/** | ||
* Create the React Context | ||
*/ | ||
exports.Consumer = (_a = react_1.default.createContext({ dragDropManager: undefined }), _a.Consumer), exports.Provider = _a.Provider; | ||
exports.Consumer = (_a = React.createContext({ dragDropManager: undefined }), _a.Consumer), exports.Provider = _a.Provider; | ||
/** | ||
@@ -52,3 +49,3 @@ * Creates the context object we're providing | ||
var contextValue = createChildContext(backend, context); | ||
return react_1.default.createElement(exports.Provider, { value: contextValue }, children); | ||
return React.createElement(exports.Provider, { value: contextValue }, children); | ||
}; | ||
@@ -72,3 +69,3 @@ /** | ||
DragDropContextContainer.prototype.getDecoratedComponentInstance = function () { | ||
invariant_1.default(this.child, 'In order to access an instance of the decorated component it can not be a stateless component.'); | ||
invariant(this.child, 'In order to access an instance of the decorated component it can not be a stateless component.'); | ||
return this.child; | ||
@@ -81,4 +78,4 @@ }; | ||
var _this = this; | ||
return (react_1.default.createElement(exports.Provider, { value: childContext }, | ||
react_1.default.createElement(DecoratedComponent, __assign({}, this.props, { ref: function (child) { return (_this.child = child); } })))); | ||
return (React.createElement(exports.Provider, { value: childContext }, | ||
React.createElement(DecoratedComponent, __assign({}, this.props, { ref: function (child) { return (_this.child = child); } })))); | ||
}; | ||
@@ -88,6 +85,6 @@ DragDropContextContainer.DecoratedComponent = DecoratedComponent; | ||
return DragDropContextContainer; | ||
}(react_1.default.Component)); | ||
return hoist_non_react_statics_1.default(DragDropContextContainer, DecoratedComponent); | ||
}(React.Component)); | ||
return hoistStatics(DragDropContextContainer, DecoratedComponent); | ||
}; | ||
} | ||
exports.DragDropContext = DragDropContext; |
@@ -1,3 +0,3 @@ | ||
import React from 'react'; | ||
import * as React from 'react'; | ||
import { DragLayerCollector, DndOptions, DndComponentClass } from './interfaces'; | ||
export default function DragLayer<P, S, TargetComponent extends React.Component<P, S> | React.StatelessComponent<P>, CollectedProps>(collect: DragLayerCollector<P, CollectedProps>, options?: DndOptions<P>): <TargetClass extends React.ComponentClass<P>>(DecoratedComponent: TargetClass) => TargetClass & DndComponentClass<P, TargetComponent, TargetClass>; |
@@ -20,21 +20,18 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var react_1 = __importDefault(require("react")); | ||
var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics")); | ||
var isPlainObject_1 = __importDefault(require("lodash/isPlainObject")); | ||
var invariant_1 = __importDefault(require("invariant")); | ||
var checkDecoratorArguments_1 = __importDefault(require("./utils/checkDecoratorArguments")); | ||
var React = require("react"); | ||
var checkDecoratorArguments_1 = require("./utils/checkDecoratorArguments"); | ||
var DragDropContext_1 = require("./DragDropContext"); | ||
var shallowequal_1 = __importDefault(require("shallowequal")); | ||
var hoistStatics = require('hoist-non-react-statics'); | ||
var isPlainObject = require('lodash/isPlainObject'); | ||
var invariant = require('invariant'); | ||
var shallowEqual = require('shallowequal'); | ||
function DragLayer(collect, options) { | ||
if (options === void 0) { options = {}; } | ||
checkDecoratorArguments_1.default('DragLayer', 'collect[, options]', collect, options); | ||
invariant_1.default(typeof collect === 'function', 'Expected "collect" provided as the first argument to DragLayer to be a function that collects props to inject into the component. ', 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs-drag-layer.html', collect); | ||
invariant_1.default(isPlainObject_1.default(options), 'Expected "options" provided as the second argument to DragLayer to be a plain object when specified. ' + | ||
invariant(typeof collect === 'function', 'Expected "collect" provided as the first argument to DragLayer to be a function that collects props to inject into the component. ', 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs-drag-layer.html', collect); | ||
invariant(isPlainObject(options), 'Expected "options" provided as the second argument to DragLayer to be a plain object when specified. ' + | ||
'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs-drag-layer.html', options); | ||
return function decorateLayer(DecoratedComponent) { | ||
var _a = options.arePropsEqual, arePropsEqual = _a === void 0 ? shallowequal_1.default : _a; | ||
var _a = options.arePropsEqual, arePropsEqual = _a === void 0 ? shallowEqual : _a; | ||
var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component'; | ||
@@ -57,3 +54,3 @@ var DragLayerContainer = /** @class */ (function (_super) { | ||
DragLayerContainer.prototype.getDecoratedComponentInstance = function () { | ||
invariant_1.default(this.child, 'In order to access an instance of the decorated component it can not be a stateless component.'); | ||
invariant(this.child, 'In order to access an instance of the decorated component it can not be a stateless component.'); | ||
return this.child; | ||
@@ -63,3 +60,3 @@ }; | ||
return (!arePropsEqual(nextProps, this.props) || | ||
!shallowequal_1.default(nextState, this.state)); | ||
!shallowEqual(nextState, this.state)); | ||
}; | ||
@@ -83,3 +80,3 @@ DragLayerContainer.prototype.componentDidMount = function () { | ||
var _this = this; | ||
return (react_1.default.createElement(DragDropContext_1.Consumer, null, function (_a) { | ||
return (React.createElement(DragDropContext_1.Consumer, null, function (_a) { | ||
var dragDropManager = _a.dragDropManager; | ||
@@ -94,3 +91,3 @@ if (dragDropManager === undefined) { | ||
} | ||
return (react_1.default.createElement(DecoratedComponent, __assign({}, _this.props, _this.state, { ref: function (child) { | ||
return (React.createElement(DecoratedComponent, __assign({}, _this.props, _this.state, { ref: function (child) { | ||
_this.child = child; | ||
@@ -105,3 +102,3 @@ } }))); | ||
this.manager = dragDropManager; | ||
invariant_1.default(typeof dragDropManager === 'object', 'Could not find the drag and drop manager in the context of %s. ' + | ||
invariant(typeof dragDropManager === 'object', 'Could not find the drag and drop manager in the context of %s. ' + | ||
'Make sure to wrap the top-level component of your app with DragDropContext. ' + | ||
@@ -118,3 +115,3 @@ 'Read more: http://react-dnd.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName); | ||
var nextState = this.getCurrentState(); | ||
if (!shallowequal_1.default(nextState, this.state)) { | ||
if (!shallowEqual(nextState, this.state)) { | ||
this.setState(nextState); | ||
@@ -132,6 +129,6 @@ } | ||
return DragLayerContainer; | ||
}(react_1.default.Component)); | ||
return hoist_non_react_statics_1.default(DragLayerContainer, DecoratedComponent); | ||
}(React.Component)); | ||
return hoistStatics(DragLayerContainer, DecoratedComponent); | ||
}; | ||
} | ||
exports.default = DragLayer; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import * as React from 'react'; | ||
import { SourceType } from 'dnd-core'; | ||
@@ -3,0 +3,0 @@ import { DragSourceSpec, DragSourceCollector, DndOptions, DndComponentClass } from './interfaces'; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var invariant_1 = __importDefault(require("invariant")); | ||
var isPlainObject_1 = __importDefault(require("lodash/isPlainObject")); | ||
var checkDecoratorArguments_1 = __importDefault(require("./utils/checkDecoratorArguments")); | ||
var decorateHandler_1 = __importDefault(require("./decorateHandler")); | ||
var registerSource_1 = __importDefault(require("./registerSource")); | ||
var createSourceFactory_1 = __importDefault(require("./createSourceFactory")); | ||
var createSourceMonitor_1 = __importDefault(require("./createSourceMonitor")); | ||
var createSourceConnector_1 = __importDefault(require("./createSourceConnector")); | ||
var isValidType_1 = __importDefault(require("./utils/isValidType")); | ||
var checkDecoratorArguments_1 = require("./utils/checkDecoratorArguments"); | ||
var decorateHandler_1 = require("./decorateHandler"); | ||
var registerSource_1 = require("./registerSource"); | ||
var createSourceFactory_1 = require("./createSourceFactory"); | ||
var createSourceMonitor_1 = require("./createSourceMonitor"); | ||
var createSourceConnector_1 = require("./createSourceConnector"); | ||
var isValidType_1 = require("./utils/isValidType"); | ||
var invariant = require('invariant'); | ||
var isPlainObject = require('lodash/isPlainObject'); | ||
/** | ||
@@ -27,3 +24,3 @@ * Decorates a component as a dragsource | ||
if (typeof type !== 'function') { | ||
invariant_1.default(isValidType_1.default(type), 'Expected "type" provided as the first argument to DragSource to be ' + | ||
invariant(isValidType_1.default(type), 'Expected "type" provided as the first argument to DragSource to be ' + | ||
'a string, or a function that returns a string given the current props. ' + | ||
@@ -34,11 +31,11 @@ 'Instead, received %s. ' + | ||
} | ||
invariant_1.default(isPlainObject_1.default(spec), 'Expected "spec" provided as the second argument to DragSource to be ' + | ||
invariant(isPlainObject(spec), 'Expected "spec" provided as the second argument to DragSource to be ' + | ||
'a plain object. Instead, received %s. ' + | ||
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', spec); | ||
var createSource = createSourceFactory_1.default(spec); | ||
invariant_1.default(typeof collect === 'function', 'Expected "collect" provided as the third argument to DragSource to be ' + | ||
invariant(typeof collect === 'function', 'Expected "collect" provided as the third argument to DragSource to be ' + | ||
'a function that returns a plain object of props to inject. ' + | ||
'Instead, received %s. ' + | ||
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', collect); | ||
invariant_1.default(isPlainObject_1.default(options), 'Expected "options" provided as the fourth argument to DragSource to be ' + | ||
invariant(isPlainObject(options), 'Expected "options" provided as the fourth argument to DragSource to be ' + | ||
'a plain object when specified. ' + | ||
@@ -45,0 +42,0 @@ 'Instead, received %s. ' + |
@@ -1,4 +0,4 @@ | ||
import React from 'react'; | ||
import * as React from 'react'; | ||
import { TargetType } from 'dnd-core'; | ||
import { DropTargetSpec, DndOptions, DropTargetCollector, DndComponentClass } from './interfaces'; | ||
export default function DropTarget<P, S, TargetComponent extends React.Component<P, S> | React.StatelessComponent<P>, CollectedProps>(type: TargetType | ((props: P) => TargetType), spec: DropTargetSpec<P, S, TargetComponent>, collect: DropTargetCollector<CollectedProps>, options?: DndOptions<P>): <TargetClass extends React.ComponentClass<P>>(DecoratedComponent: TargetClass) => TargetClass & DndComponentClass<P, TargetComponent, TargetClass>; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var invariant_1 = __importDefault(require("invariant")); | ||
var isPlainObject_1 = __importDefault(require("lodash/isPlainObject")); | ||
var checkDecoratorArguments_1 = __importDefault(require("./utils/checkDecoratorArguments")); | ||
var decorateHandler_1 = __importDefault(require("./decorateHandler")); | ||
var registerTarget_1 = __importDefault(require("./registerTarget")); | ||
var createTargetFactory_1 = __importDefault(require("./createTargetFactory")); | ||
var createTargetMonitor_1 = __importDefault(require("./createTargetMonitor")); | ||
var createTargetConnector_1 = __importDefault(require("./createTargetConnector")); | ||
var isValidType_1 = __importDefault(require("./utils/isValidType")); | ||
var checkDecoratorArguments_1 = require("./utils/checkDecoratorArguments"); | ||
var decorateHandler_1 = require("./decorateHandler"); | ||
var registerTarget_1 = require("./registerTarget"); | ||
var createTargetFactory_1 = require("./createTargetFactory"); | ||
var createTargetMonitor_1 = require("./createTargetMonitor"); | ||
var createTargetConnector_1 = require("./createTargetConnector"); | ||
var isValidType_1 = require("./utils/isValidType"); | ||
var invariant = require('invariant'); | ||
var isPlainObject = require('lodash/isPlainObject'); | ||
function DropTarget(type, spec, collect, options) { | ||
@@ -20,3 +17,3 @@ if (options === void 0) { options = {}; } | ||
if (typeof type !== 'function') { | ||
invariant_1.default(isValidType_1.default(type, true), 'Expected "type" provided as the first argument to DropTarget to be ' + | ||
invariant(isValidType_1.default(type, true), 'Expected "type" provided as the first argument to DropTarget to be ' + | ||
'a string, an array of strings, or a function that returns either given ' + | ||
@@ -27,11 +24,11 @@ 'the current props. Instead, received %s. ' + | ||
} | ||
invariant_1.default(isPlainObject_1.default(spec), 'Expected "spec" provided as the second argument to DropTarget to be ' + | ||
invariant(isPlainObject(spec), 'Expected "spec" provided as the second argument to DropTarget to be ' + | ||
'a plain object. Instead, received %s. ' + | ||
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', spec); | ||
var createTarget = createTargetFactory_1.default(spec); | ||
invariant_1.default(typeof collect === 'function', 'Expected "collect" provided as the third argument to DropTarget to be ' + | ||
invariant(typeof collect === 'function', 'Expected "collect" provided as the third argument to DropTarget to be ' + | ||
'a function that returns a plain object of props to inject. ' + | ||
'Instead, received %s. ' + | ||
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', collect); | ||
invariant_1.default(isPlainObject_1.default(options), 'Expected "options" provided as the fourth argument to DropTarget to be ' + | ||
invariant(isPlainObject(options), 'Expected "options" provided as the fourth argument to DropTarget to be ' + | ||
'a plain object when specified. ' + | ||
@@ -38,0 +35,0 @@ 'Instead, received %s. ' + |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import * as React from 'react'; | ||
import { XYCoord, DragDropMonitor, Identifier, DragDropManager } from 'dnd-core'; | ||
@@ -3,0 +3,0 @@ export { XYCoord }; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var invariant_1 = __importDefault(require("invariant")); | ||
var react_1 = require("react"); | ||
var invariant = require('invariant'); | ||
function cloneWithRef(element, newRef) { | ||
var previousRef = element.ref; | ||
invariant_1.default(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' + | ||
invariant(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' + | ||
'Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. ' + | ||
@@ -12,0 +9,0 @@ 'Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute'); |
@@ -11,3 +11,3 @@ /** | ||
static empty: { | ||
dispose: (...args: any[]) => void; | ||
dispose: any; | ||
}; | ||
@@ -19,3 +19,3 @@ /** | ||
*/ | ||
static isDisposable(d: any): boolean; | ||
static isDisposable(d: any): any; | ||
static _fixup(result: any): any; | ||
@@ -22,0 +22,0 @@ /** |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// tslint:disable max-classes-per-file | ||
var isFunction_1 = __importDefault(require("lodash/isFunction")); | ||
var noop_1 = __importDefault(require("lodash/noop")); | ||
var isFunction = require('lodash/isFunction'); | ||
var noop = require('lodash/noop'); | ||
/** | ||
@@ -17,3 +13,3 @@ * Provides a set of static methods for creating Disposables. | ||
this.isDisposed = false; | ||
this.action = isFunction_1.default(action) ? action : noop_1.default; | ||
this.action = isFunction(action) ? action : noop; | ||
} | ||
@@ -26,3 +22,3 @@ /** | ||
Disposable.isDisposable = function (d) { | ||
return d && isFunction_1.default(d.dispose); | ||
return d && isFunction(d.dispose); | ||
}; | ||
@@ -51,5 +47,5 @@ Disposable._fixup = function (result) { | ||
*/ | ||
Disposable.empty = { dispose: noop_1.default }; | ||
Disposable.empty = { dispose: noop }; | ||
return Disposable; | ||
}()); | ||
exports.Disposable = Disposable; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var isArray_1 = __importDefault(require("lodash/isArray")); | ||
function isValidType(type, allowArray) { | ||
return (typeof type === 'string' || | ||
typeof type === 'symbol' || | ||
(!!allowArray && isArray_1.default(type) && type.every(function (t) { return isValidType(t, false); }))); | ||
(!!allowArray && | ||
Array.isArray(type) && | ||
type.every(function (t) { return isValidType(t, false); }))); | ||
} | ||
exports.default = isValidType; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var react_1 = require("react"); | ||
var cloneWithRef_1 = __importDefault(require("./utils/cloneWithRef")); | ||
var cloneWithRef_1 = require("./utils/cloneWithRef"); | ||
function throwIfCompositeComponentElement(element) { | ||
@@ -9,0 +6,0 @@ // Custom components can no longer be wrapped directly in React DnD 2.0 |
{ | ||
"name": "react-dnd", | ||
"version": "4.0.4", | ||
"version": "4.0.5", | ||
"description": "Drag and Drop for React", | ||
@@ -23,17 +23,13 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@types/invariant": "^2.2.29", | ||
"@types/lodash": "^4.14.109", | ||
"@types/node": "^10.3.0", | ||
"@types/prop-types": "^15.5.3", | ||
"@types/react": "^16.3.14", | ||
"@types/react-dom": "^16.0.5", | ||
"@types/shallowequal": "^0.2.2", | ||
"dnd-core": "^4.0.4", | ||
"dnd-core": "^4.0.5", | ||
"hoist-non-react-statics": "^2.5.0", | ||
"invariant": "^2.1.0", | ||
"lodash": "^4.17.10", | ||
"prop-types": "^15.6.1", | ||
"shallowequal": "^1.0.2" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "10.3.2", | ||
"@types/react": "^16.3.14", | ||
"@types/react-dom": "^16.0.5", | ||
"@types/shallowequal": "^0.2.2", | ||
"babel-cli": "^6.26.0", | ||
@@ -40,0 +36,0 @@ "babel-loader": "^7.1.1", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance 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
6
-57.14%424195
-3.22%13
44.44%3790
-2.04%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated