This commit is contained in:
72
node_modules/dnd-core/dist/cjs/utils/coords.js
generated
vendored
Normal file
72
node_modules/dnd-core/dist/cjs/utils/coords.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.add = add;
|
||||
exports.subtract = subtract;
|
||||
exports.getSourceClientOffset = getSourceClientOffset;
|
||||
exports.getDifferenceFromInitialOffset = getDifferenceFromInitialOffset;
|
||||
|
||||
/**
|
||||
* Coordinate addition
|
||||
* @param a The first coordinate
|
||||
* @param b The second coordinate
|
||||
*/
|
||||
function add(a, b) {
|
||||
return {
|
||||
x: a.x + b.x,
|
||||
y: a.y + b.y
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Coordinate subtraction
|
||||
* @param a The first coordinate
|
||||
* @param b The second coordinate
|
||||
*/
|
||||
|
||||
|
||||
function subtract(a, b) {
|
||||
return {
|
||||
x: a.x - b.x,
|
||||
y: a.y - b.y
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Returns the cartesian distance of the drag source component's position, based on its position
|
||||
* at the time when the current drag operation has started, and the movement difference.
|
||||
*
|
||||
* Returns null if no item is being dragged.
|
||||
*
|
||||
* @param state The offset state to compute from
|
||||
*/
|
||||
|
||||
|
||||
function getSourceClientOffset(state) {
|
||||
var clientOffset = state.clientOffset,
|
||||
initialClientOffset = state.initialClientOffset,
|
||||
initialSourceClientOffset = state.initialSourceClientOffset;
|
||||
|
||||
if (!clientOffset || !initialClientOffset || !initialSourceClientOffset) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return subtract(add(clientOffset, initialSourceClientOffset), initialClientOffset);
|
||||
}
|
||||
/**
|
||||
* Determines the x,y offset between the client offset and the initial client offset
|
||||
*
|
||||
* @param state The offset state to compute from
|
||||
*/
|
||||
|
||||
|
||||
function getDifferenceFromInitialOffset(state) {
|
||||
var clientOffset = state.clientOffset,
|
||||
initialClientOffset = state.initialClientOffset;
|
||||
|
||||
if (!clientOffset || !initialClientOffset) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return subtract(clientOffset, initialClientOffset);
|
||||
}
|
||||
35
node_modules/dnd-core/dist/cjs/utils/dirtiness.js
generated
vendored
Normal file
35
node_modules/dnd-core/dist/cjs/utils/dirtiness.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.areDirty = areDirty;
|
||||
exports.ALL = exports.NONE = void 0;
|
||||
|
||||
var _js_utils = require("./js_utils");
|
||||
|
||||
var NONE = [];
|
||||
exports.NONE = NONE;
|
||||
var ALL = [];
|
||||
exports.ALL = ALL;
|
||||
NONE.__IS_NONE__ = true;
|
||||
ALL.__IS_ALL__ = true;
|
||||
/**
|
||||
* Determines if the given handler IDs are dirty or not.
|
||||
*
|
||||
* @param dirtyIds The set of dirty handler ids
|
||||
* @param handlerIds The set of handler ids to check
|
||||
*/
|
||||
|
||||
function areDirty(dirtyIds, handlerIds) {
|
||||
if (dirtyIds === NONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dirtyIds === ALL || typeof handlerIds === 'undefined') {
|
||||
return true;
|
||||
}
|
||||
|
||||
var commonIds = (0, _js_utils.intersection)(handlerIds, dirtyIds);
|
||||
return commonIds.length > 0;
|
||||
}
|
||||
52
node_modules/dnd-core/dist/cjs/utils/equality.js
generated
vendored
Normal file
52
node_modules/dnd-core/dist/cjs/utils/equality.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.areCoordsEqual = areCoordsEqual;
|
||||
exports.areArraysEqual = areArraysEqual;
|
||||
exports.strictEquality = void 0;
|
||||
|
||||
var strictEquality = function strictEquality(a, b) {
|
||||
return a === b;
|
||||
};
|
||||
/**
|
||||
* Determine if two cartesian coordinate offsets are equal
|
||||
* @param offsetA
|
||||
* @param offsetB
|
||||
*/
|
||||
|
||||
|
||||
exports.strictEquality = strictEquality;
|
||||
|
||||
function areCoordsEqual(offsetA, offsetB) {
|
||||
if (!offsetA && !offsetB) {
|
||||
return true;
|
||||
} else if (!offsetA || !offsetB) {
|
||||
return false;
|
||||
} else {
|
||||
return offsetA.x === offsetB.x && offsetA.y === offsetB.y;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Determines if two arrays of items are equal
|
||||
* @param a The first array of items
|
||||
* @param b The second array of items
|
||||
*/
|
||||
|
||||
|
||||
function areArraysEqual(a, b) {
|
||||
var isEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : strictEquality;
|
||||
|
||||
if (a.length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < a.length; ++i) {
|
||||
if (!isEqual(a[i], b[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
11
node_modules/dnd-core/dist/cjs/utils/getNextUniqueId.js
generated
vendored
Normal file
11
node_modules/dnd-core/dist/cjs/utils/getNextUniqueId.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getNextUniqueId = getNextUniqueId;
|
||||
var nextUniqueId = 0;
|
||||
|
||||
function getNextUniqueId() {
|
||||
return nextUniqueId++;
|
||||
}
|
||||
91
node_modules/dnd-core/dist/cjs/utils/js_utils.js
generated
vendored
Normal file
91
node_modules/dnd-core/dist/cjs/utils/js_utils.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.get = get;
|
||||
exports.without = without;
|
||||
exports.isString = isString;
|
||||
exports.isObject = isObject;
|
||||
exports.xor = xor;
|
||||
exports.intersection = intersection;
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
// cheap lodash replacements
|
||||
|
||||
/**
|
||||
* drop-in replacement for _.get
|
||||
* @param obj
|
||||
* @param path
|
||||
* @param defaultValue
|
||||
*/
|
||||
function get(obj, path, defaultValue) {
|
||||
return path.split('.').reduce(function (a, c) {
|
||||
return a && a[c] ? a[c] : defaultValue || null;
|
||||
}, obj);
|
||||
}
|
||||
/**
|
||||
* drop-in replacement for _.without
|
||||
*/
|
||||
|
||||
|
||||
function without(items, item) {
|
||||
return items.filter(function (i) {
|
||||
return i !== item;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* drop-in replacement for _.isString
|
||||
* @param input
|
||||
*/
|
||||
|
||||
|
||||
function isString(input) {
|
||||
return typeof input === 'string';
|
||||
}
|
||||
/**
|
||||
* drop-in replacement for _.isString
|
||||
* @param input
|
||||
*/
|
||||
|
||||
|
||||
function isObject(input) {
|
||||
return _typeof(input) === 'object';
|
||||
}
|
||||
/**
|
||||
* repalcement for _.xor
|
||||
* @param itemsA
|
||||
* @param itemsB
|
||||
*/
|
||||
|
||||
|
||||
function xor(itemsA, itemsB) {
|
||||
var map = new Map();
|
||||
|
||||
var insertItem = function insertItem(item) {
|
||||
map.set(item, map.has(item) ? map.get(item) + 1 : 1);
|
||||
};
|
||||
|
||||
itemsA.forEach(insertItem);
|
||||
itemsB.forEach(insertItem);
|
||||
var result = [];
|
||||
map.forEach(function (count, key) {
|
||||
if (count === 1) {
|
||||
result.push(key);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* replacement for _.intersection
|
||||
* @param itemsA
|
||||
* @param itemsB
|
||||
*/
|
||||
|
||||
|
||||
function intersection(itemsA, itemsB) {
|
||||
return itemsA.filter(function (t) {
|
||||
return itemsB.indexOf(t) > -1;
|
||||
});
|
||||
}
|
||||
16
node_modules/dnd-core/dist/cjs/utils/matchesType.js
generated
vendored
Normal file
16
node_modules/dnd-core/dist/cjs/utils/matchesType.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.matchesType = matchesType;
|
||||
|
||||
function matchesType(targetType, draggedItemType) {
|
||||
if (draggedItemType === null) {
|
||||
return targetType === null;
|
||||
}
|
||||
|
||||
return Array.isArray(targetType) ? targetType.some(function (t) {
|
||||
return t === draggedItemType;
|
||||
}) : targetType === draggedItemType;
|
||||
}
|
||||
Reference in New Issue
Block a user