Comparing version 1.2.2 to 1.3.0
@@ -20,9 +20,9 @@ 'use strict'; | ||
var _lodashLangIsArray = require('lodash/lang/isArray'); | ||
var _lodashIsArray = require('lodash/isArray'); | ||
var _lodashLangIsArray2 = _interopRequireDefault(_lodashLangIsArray); | ||
var _lodashIsArray2 = _interopRequireDefault(_lodashIsArray); | ||
var _lodashLangIsObject = require('lodash/lang/isObject'); | ||
var _lodashIsObject = require('lodash/isObject'); | ||
var _lodashLangIsObject2 = _interopRequireDefault(_lodashLangIsObject); | ||
var _lodashIsObject2 = _interopRequireDefault(_lodashIsObject); | ||
@@ -50,3 +50,3 @@ var BEGIN_DRAG = 'dnd-core/BEGIN_DRAG'; | ||
_invariant2['default'](_lodashLangIsArray2['default'](sourceIds), 'Expected sourceIds to be an array.'); | ||
_invariant2['default'](_lodashIsArray2['default'](sourceIds), 'Expected sourceIds to be an array.'); | ||
@@ -80,3 +80,3 @@ var monitor = this.getMonitor(); | ||
var item = source.beginDrag(monitor, sourceId); | ||
_invariant2['default'](_lodashLangIsObject2['default'](item), 'Item must be an object.'); | ||
_invariant2['default'](_lodashIsObject2['default'](item), 'Item must be an object.'); | ||
@@ -114,3 +114,3 @@ registry.pinSource(sourceId); | ||
_invariant2['default'](_lodashLangIsArray2['default'](targetIds), 'Expected targetIds to be an array.'); | ||
_invariant2['default'](_lodashIsArray2['default'](targetIds), 'Expected targetIds to be an array.'); | ||
targetIds = targetIds.slice(0); | ||
@@ -159,3 +159,3 @@ | ||
var dropResult = target.drop(monitor, targetId); | ||
_invariant2['default'](typeof dropResult === 'undefined' || _lodashLangIsObject2['default'](dropResult), 'Drop result must either be an object or undefined.'); | ||
_invariant2['default'](typeof dropResult === 'undefined' || _lodashIsObject2['default'](dropResult), 'Drop result must either be an object or undefined.'); | ||
if (typeof dropResult === 'undefined') { | ||
@@ -162,0 +162,0 @@ dropResult = index === 0 ? {} : monitor.getDropResult(); |
@@ -10,5 +10,5 @@ 'use strict'; | ||
var _lodashUtilityNoop = require('lodash/utility/noop'); | ||
var _lodashNoop = require('lodash/noop'); | ||
var _lodashUtilityNoop2 = _interopRequireDefault(_lodashUtilityNoop); | ||
var _lodashNoop2 = _interopRequireDefault(_lodashNoop); | ||
@@ -31,11 +31,11 @@ var TestBackend = (function () { | ||
TestBackend.prototype.connectDragSource = function connectDragSource() { | ||
return _lodashUtilityNoop2['default']; | ||
return _lodashNoop2['default']; | ||
}; | ||
TestBackend.prototype.connectDragPreview = function connectDragPreview() { | ||
return _lodashUtilityNoop2['default']; | ||
return _lodashNoop2['default']; | ||
}; | ||
TestBackend.prototype.connectDropTarget = function connectDropTarget() { | ||
return _lodashUtilityNoop2['default']; | ||
return _lodashNoop2['default']; | ||
}; | ||
@@ -42,0 +42,0 @@ |
@@ -17,5 +17,5 @@ 'use strict'; | ||
var _lodashLangIsArray = require('lodash/lang/isArray'); | ||
var _lodashIsArray = require('lodash/isArray'); | ||
var _lodashLangIsArray2 = _interopRequireDefault(_lodashLangIsArray); | ||
var _lodashIsArray2 = _interopRequireDefault(_lodashIsArray); | ||
@@ -46,7 +46,16 @@ var _HandlerRegistry = require('./HandlerRegistry'); | ||
_invariant2['default'](typeof listener === 'function', 'listener must be a function.'); | ||
_invariant2['default'](typeof handlerIds === 'undefined' || _lodashLangIsArray2['default'](handlerIds), 'handlerIds, when specified, must be an array of strings.'); | ||
_invariant2['default'](typeof handlerIds === 'undefined' || _lodashIsArray2['default'](handlerIds), 'handlerIds, when specified, must be an array of strings.'); | ||
var prevStateId = this.store.getState().stateId; | ||
var handleChange = function handleChange() { | ||
if (_reducersDirtyHandlerIds.areDirty(_this.store.getState().dirtyHandlerIds, handlerIds)) { | ||
listener(); | ||
var state = _this.store.getState(); | ||
var currentStateId = state.stateId; | ||
try { | ||
var canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !_reducersDirtyHandlerIds.areDirty(state.dirtyHandlerIds, handlerIds); | ||
if (!canSkipListener) { | ||
listener(); | ||
} | ||
} finally { | ||
prevStateId = currentStateId; | ||
} | ||
@@ -53,0 +62,0 @@ }; |
@@ -15,5 +15,5 @@ 'use strict'; | ||
var _lodashLangIsArray = require('lodash/lang/isArray'); | ||
var _lodashIsArray = require('lodash/isArray'); | ||
var _lodashLangIsArray2 = _interopRequireDefault(_lodashLangIsArray); | ||
var _lodashIsArray2 = _interopRequireDefault(_lodashIsArray); | ||
@@ -44,3 +44,3 @@ var _utilsGetNextUniqueId = require('./utils/getNextUniqueId'); | ||
function validateType(type, allowArray) { | ||
if (allowArray && _lodashLangIsArray2['default'](type)) { | ||
if (allowArray && _lodashIsArray2['default'](type)) { | ||
type.forEach(function (t) { | ||
@@ -47,0 +47,0 @@ return validateType(t, false); |
@@ -9,9 +9,9 @@ 'use strict'; | ||
var _lodashArrayXor = require('lodash/array/xor'); | ||
var _lodashXor = require('lodash/xor'); | ||
var _lodashArrayXor2 = _interopRequireDefault(_lodashArrayXor); | ||
var _lodashXor2 = _interopRequireDefault(_lodashXor); | ||
var _lodashArrayIntersection = require('lodash/array/intersection'); | ||
var _lodashIntersection = require('lodash/intersection'); | ||
var _lodashArrayIntersection2 = _interopRequireDefault(_lodashArrayIntersection); | ||
var _lodashIntersection2 = _interopRequireDefault(_lodashIntersection); | ||
@@ -47,3 +47,3 @@ var _actionsDragDrop = require('../actions/dragDrop'); | ||
var dirtyHandlerIds = _lodashArrayXor2['default'](targetIds, prevTargetIds); | ||
var dirtyHandlerIds = _lodashXor2['default'](targetIds, prevTargetIds); | ||
@@ -90,3 +90,3 @@ var didChange = false; | ||
return _lodashArrayIntersection2['default'](handlerIds, state).length > 0; | ||
return _lodashIntersection2['default'](handlerIds, state).length > 0; | ||
} |
@@ -15,5 +15,5 @@ 'use strict'; | ||
var _lodashArrayWithout = require('lodash/array/without'); | ||
var _lodashWithout = require('lodash/without'); | ||
var _lodashArrayWithout2 = _interopRequireDefault(_lodashArrayWithout); | ||
var _lodashWithout2 = _interopRequireDefault(_lodashWithout); | ||
@@ -60,3 +60,3 @@ var initialState = { | ||
return _extends({}, state, { | ||
targetIds: _lodashArrayWithout2['default'](state.targetIds, action.targetId) | ||
targetIds: _lodashWithout2['default'](state.targetIds, action.targetId) | ||
}); | ||
@@ -63,0 +63,0 @@ case _actionsDragDrop.DROP: |
@@ -23,2 +23,6 @@ 'use strict'; | ||
var _stateId = require('./stateId'); | ||
var _stateId2 = _interopRequireDefault(_stateId); | ||
exports['default'] = function (state, action) { | ||
@@ -31,3 +35,4 @@ if (state === undefined) state = {}; | ||
refCount: _refCount2['default'](state.refCount, action), | ||
dragOperation: _dragOperation2['default'](state.dragOperation, action) | ||
dragOperation: _dragOperation2['default'](state.dragOperation, action), | ||
stateId: _stateId2['default'](state.stateId) | ||
}; | ||
@@ -34,0 +39,0 @@ }; |
@@ -8,8 +8,8 @@ 'use strict'; | ||
var _lodashLangIsArray = require('lodash/lang/isArray'); | ||
var _lodashIsArray = require('lodash/isArray'); | ||
var _lodashLangIsArray2 = _interopRequireDefault(_lodashLangIsArray); | ||
var _lodashIsArray2 = _interopRequireDefault(_lodashIsArray); | ||
function matchesType(targetType, draggedItemType) { | ||
if (_lodashLangIsArray2['default'](targetType)) { | ||
if (_lodashIsArray2['default'](targetType)) { | ||
return targetType.some(function (t) { | ||
@@ -16,0 +16,0 @@ return t === draggedItemType; |
{ | ||
"name": "dnd-core", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Drag and drop sans the GUI", | ||
@@ -34,5 +34,5 @@ "main": "lib/index.js", | ||
"invariant": "^2.0.0", | ||
"lodash": "^3.10.1", | ||
"redux": "^3.0.0" | ||
"lodash": "^4.2.0", | ||
"redux": "^3.2.0" | ||
} | ||
} |
import matchesType from '../utils/matchesType'; | ||
import invariant from 'invariant'; | ||
import isArray from 'lodash/lang/isArray'; | ||
import isObject from 'lodash/lang/isObject'; | ||
import isArray from 'lodash/isArray'; | ||
import isObject from 'lodash/isObject'; | ||
@@ -6,0 +6,0 @@ export const BEGIN_DRAG = 'dnd-core/BEGIN_DRAG'; |
@@ -1,2 +0,2 @@ | ||
import noop from 'lodash/utility/noop'; | ||
import noop from 'lodash/noop'; | ||
@@ -51,2 +51,2 @@ class TestBackend { | ||
return new TestBackend(manager); | ||
} | ||
} |
import invariant from 'invariant'; | ||
import matchesType from './utils/matchesType'; | ||
import isArray from 'lodash/lang/isArray'; | ||
import isArray from 'lodash/isArray'; | ||
import HandlerRegistry from './HandlerRegistry'; | ||
@@ -26,5 +26,17 @@ import { getSourceClientOffset, getDifferenceFromInitialOffset } from './reducers/dragOffset'; | ||
let prevStateId = this.store.getState().stateId; | ||
const handleChange = () => { | ||
if (areDirty(this.store.getState().dirtyHandlerIds, handlerIds)) { | ||
listener(); | ||
const state = this.store.getState(); | ||
const currentStateId = state.stateId; | ||
try { | ||
const canSkipListener = currentStateId === prevStateId || ( | ||
currentStateId === prevStateId + 1 && | ||
!areDirty(state.dirtyHandlerIds, handlerIds) | ||
) | ||
if (!canSkipListener) { | ||
listener(); | ||
} | ||
} finally { | ||
prevStateId = currentStateId; | ||
} | ||
@@ -175,2 +187,2 @@ }; | ||
} | ||
} | ||
} |
import invariant from 'invariant'; | ||
import isArray from 'lodash/lang/isArray'; | ||
import isArray from 'lodash/isArray'; | ||
import getNextUniqueId from './utils/getNextUniqueId'; | ||
@@ -163,2 +163,2 @@ import { addSource, addTarget, removeSource, removeTarget } from './actions/registry'; | ||
} | ||
} | ||
} |
@@ -1,3 +0,3 @@ | ||
import xor from 'lodash/array/xor'; | ||
import intersection from 'lodash/array/intersection'; | ||
import xor from 'lodash/xor'; | ||
import intersection from 'lodash/intersection'; | ||
import { BEGIN_DRAG, PUBLISH_DRAG_SOURCE, HOVER, END_DRAG, DROP } from '../actions/dragDrop'; | ||
@@ -4,0 +4,0 @@ import { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET } from '../actions/registry'; |
import { BEGIN_DRAG, PUBLISH_DRAG_SOURCE, HOVER, END_DRAG, DROP } from '../actions/dragDrop'; | ||
import { REMOVE_TARGET } from '../actions/registry'; | ||
import without from 'lodash/array/without'; | ||
import without from 'lodash/without'; | ||
@@ -64,2 +64,2 @@ const initialState = { | ||
} | ||
} | ||
} |
@@ -5,2 +5,3 @@ import { default as dragOffset } from './dragOffset'; | ||
import { default as dirtyHandlerIds } from './dirtyHandlerIds'; | ||
import { default as stateId } from './stateId'; | ||
@@ -12,4 +13,5 @@ export default function (state = {}, action) { | ||
refCount: refCount(state.refCount, action), | ||
dragOperation: dragOperation(state.dragOperation, action) | ||
dragOperation: dragOperation(state.dragOperation, action), | ||
stateId: stateId(state.stateId) | ||
}; | ||
} |
@@ -1,2 +0,2 @@ | ||
import isArray from 'lodash/lang/isArray'; | ||
import isArray from 'lodash/isArray'; | ||
@@ -9,2 +9,2 @@ export default function matchesType(targetType, draggedItemType) { | ||
} | ||
} | ||
} |
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
64344
43
1684
- Removedlodash@3.10.1(transitive)
Updatedlodash@^4.2.0
Updatedredux@^3.2.0