react-sortablejs
Advanced tools
Comparing version
@@ -1,5 +0,5 @@ | ||
var $1ZQrD$sortablejs = require("sortablejs"); | ||
var $1ZQrD$classnames = require("classnames"); | ||
var $1ZQrD$react = require("react"); | ||
var $1ZQrD$tinyinvariant = require("tiny-invariant"); | ||
var $8zHUo$sortablejs = require("sortablejs"); | ||
var $8zHUo$classnames = require("classnames"); | ||
var $8zHUo$react = require("react"); | ||
var $8zHUo$tinyinvariant = require("tiny-invariant"); | ||
@@ -29,14 +29,14 @@ function $parcel$interopDefault(a) { | ||
$parcel$export(module.exports, "Sortable", () => $5e2f01247a5d6f10$re_export$Sortable); | ||
$parcel$export(module.exports, "Direction", () => $5e2f01247a5d6f10$re_export$Direction); | ||
$parcel$export(module.exports, "DOMRect", () => $5e2f01247a5d6f10$re_export$DOMRect); | ||
$parcel$export(module.exports, "GroupOptions", () => $5e2f01247a5d6f10$re_export$GroupOptions); | ||
$parcel$export(module.exports, "MoveEvent", () => $5e2f01247a5d6f10$re_export$MoveEvent); | ||
$parcel$export(module.exports, "Options", () => $5e2f01247a5d6f10$re_export$Options); | ||
$parcel$export(module.exports, "PullResult", () => $5e2f01247a5d6f10$re_export$PullResult); | ||
$parcel$export(module.exports, "PutResult", () => $5e2f01247a5d6f10$re_export$PutResult); | ||
$parcel$export(module.exports, "SortableEvent", () => $5e2f01247a5d6f10$re_export$SortableEvent); | ||
$parcel$export(module.exports, "SortableOptions", () => $5e2f01247a5d6f10$re_export$SortableOptions); | ||
$parcel$export(module.exports, "Utils", () => $5e2f01247a5d6f10$re_export$Utils); | ||
$parcel$export(module.exports, "ReactSortable", () => $c99785ec5604a382$export$11bbed9ee0012c13); | ||
$parcel$export(module.exports, "Sortable", () => $882b6d93070905b3$re_export$Sortable); | ||
$parcel$export(module.exports, "Direction", () => $882b6d93070905b3$re_export$Direction); | ||
$parcel$export(module.exports, "DOMRect", () => $882b6d93070905b3$re_export$DOMRect); | ||
$parcel$export(module.exports, "GroupOptions", () => $882b6d93070905b3$re_export$GroupOptions); | ||
$parcel$export(module.exports, "MoveEvent", () => $882b6d93070905b3$re_export$MoveEvent); | ||
$parcel$export(module.exports, "Options", () => $882b6d93070905b3$re_export$Options); | ||
$parcel$export(module.exports, "PullResult", () => $882b6d93070905b3$re_export$PullResult); | ||
$parcel$export(module.exports, "PutResult", () => $882b6d93070905b3$re_export$PutResult); | ||
$parcel$export(module.exports, "SortableEvent", () => $882b6d93070905b3$re_export$SortableEvent); | ||
$parcel$export(module.exports, "SortableOptions", () => $882b6d93070905b3$re_export$SortableOptions); | ||
$parcel$export(module.exports, "Utils", () => $882b6d93070905b3$re_export$Utils); | ||
$parcel$export(module.exports, "ReactSortable", () => $7fe8e3ea572bda7a$export$11bbed9ee0012c13); | ||
@@ -47,24 +47,24 @@ | ||
function $38186c783ba0d7b3$export$1d0aa160432dfea5(node) { | ||
function $eb03e74f8f7db1f3$export$1d0aa160432dfea5(node) { | ||
if (node.parentElement !== null) node.parentElement.removeChild(node); | ||
} | ||
function $38186c783ba0d7b3$export$6d240faa51aa562f(parent, newChild, index) { | ||
function $eb03e74f8f7db1f3$export$6d240faa51aa562f(parent, newChild, index) { | ||
const refChild = parent.children[index] || null; | ||
parent.insertBefore(newChild, refChild); | ||
} | ||
function $38186c783ba0d7b3$export$d7d742816c28cf91(customs) { | ||
$38186c783ba0d7b3$export$77f49a256021c8de(customs); | ||
$38186c783ba0d7b3$export$a6177d5829f70ebc(customs); | ||
function $eb03e74f8f7db1f3$export$d7d742816c28cf91(customs) { | ||
$eb03e74f8f7db1f3$export$77f49a256021c8de(customs); | ||
$eb03e74f8f7db1f3$export$a6177d5829f70ebc(customs); | ||
} | ||
function $38186c783ba0d7b3$export$77f49a256021c8de(customs) { | ||
customs.forEach((curr)=>$38186c783ba0d7b3$export$1d0aa160432dfea5(curr.element) | ||
function $eb03e74f8f7db1f3$export$77f49a256021c8de(customs) { | ||
customs.forEach((curr)=>$eb03e74f8f7db1f3$export$1d0aa160432dfea5(curr.element) | ||
); | ||
} | ||
function $38186c783ba0d7b3$export$a6177d5829f70ebc(customs) { | ||
function $eb03e74f8f7db1f3$export$a6177d5829f70ebc(customs) { | ||
customs.forEach((curr)=>{ | ||
$38186c783ba0d7b3$export$6d240faa51aa562f(curr.parentElement, curr.element, curr.oldIndex); | ||
$eb03e74f8f7db1f3$export$6d240faa51aa562f(curr.parentElement, curr.element, curr.oldIndex); | ||
}); | ||
} | ||
function $38186c783ba0d7b3$export$4655efe700f887a(evt, list) { | ||
const mode = $38186c783ba0d7b3$export$1fc0f6205829e19c(evt); | ||
function $eb03e74f8f7db1f3$export$4655efe700f887a(evt, list) { | ||
const mode = $eb03e74f8f7db1f3$export$1fc0f6205829e19c(evt); | ||
const parentElement = { | ||
@@ -114,11 +114,11 @@ parentElement: evt.from | ||
} | ||
/* eslint-enable */ const customs = $38186c783ba0d7b3$export$bc06a3af7dc65f53(custom, list); | ||
/* eslint-enable */ const customs = $eb03e74f8f7db1f3$export$bc06a3af7dc65f53(custom, list); | ||
return customs; | ||
} | ||
function $38186c783ba0d7b3$export$c25cf8080bd305ec(normalized, list) { | ||
const a = $38186c783ba0d7b3$export$be2da95e6167b0bd(normalized, list); | ||
const b = $38186c783ba0d7b3$export$eca851ee65ae17e4(normalized, a); | ||
function $eb03e74f8f7db1f3$export$c25cf8080bd305ec(normalized, list) { | ||
const a = $eb03e74f8f7db1f3$export$be2da95e6167b0bd(normalized, list); | ||
const b = $eb03e74f8f7db1f3$export$eca851ee65ae17e4(normalized, a); | ||
return b; | ||
} | ||
function $38186c783ba0d7b3$export$be2da95e6167b0bd(normalized, list) { | ||
function $eb03e74f8f7db1f3$export$be2da95e6167b0bd(normalized, list) { | ||
const newList = [ | ||
@@ -131,3 +131,3 @@ ...list | ||
} | ||
function $38186c783ba0d7b3$export$eca851ee65ae17e4(normalized, list, evt, clone) { | ||
function $eb03e74f8f7db1f3$export$eca851ee65ae17e4(normalized, list, evt, clone) { | ||
const newList = [ | ||
@@ -142,3 +142,3 @@ ...list | ||
} | ||
function $38186c783ba0d7b3$export$1fc0f6205829e19c(evt) { | ||
function $eb03e74f8f7db1f3$export$1fc0f6205829e19c(evt) { | ||
if (evt.oldIndicies && evt.oldIndicies.length > 0) return "multidrag"; | ||
@@ -148,3 +148,3 @@ if (evt.swapItem) return "swap"; | ||
} | ||
function $38186c783ba0d7b3$export$bc06a3af7dc65f53(inputs, list) { | ||
function $eb03e74f8f7db1f3$export$bc06a3af7dc65f53(inputs, list) { | ||
const normalized = inputs.map((curr)=>({ | ||
@@ -158,3 +158,3 @@ ...curr, | ||
} | ||
function $38186c783ba0d7b3$export$7553c81e62e31b7e(props) { | ||
function $eb03e74f8f7db1f3$export$7553c81e62e31b7e(props) { | ||
/* eslint-disable */ const { list: // react sortable props | ||
@@ -168,19 +168,22 @@ list , setList: setList , children: children , tag: tag , style: style , className: className , clone: clone , onAdd: // sortable options that have methods we want to overwrite | ||
/** Holds a global reference for which react element is being dragged */ // @todo - use context to manage this. How does one use 2 different providers? | ||
const $c99785ec5604a382$var$store = { | ||
const $7fe8e3ea572bda7a$var$store = { | ||
dragging: null | ||
}; | ||
class $c99785ec5604a382$export$11bbed9ee0012c13 extends $1ZQrD$react.Component { | ||
class $7fe8e3ea572bda7a$export$11bbed9ee0012c13 extends $8zHUo$react.Component { | ||
constructor(props){ | ||
super(props); | ||
// @todo forward ref this component | ||
this.ref = /*#__PURE__*/ $1ZQrD$react.createRef(); | ||
this.ref = /*#__PURE__*/ $8zHUo$react.createRef(); | ||
// make all state false because we can't change sortable unless a mouse gesture is made. | ||
const newList = props.list.map((item)=>({ | ||
...item, | ||
const newList = [ | ||
...props.list | ||
]; | ||
newList.forEach((item)=>{ | ||
Object.assign(item, { | ||
chosen: false, | ||
selected: false | ||
}) | ||
); | ||
props.setList(newList, this.sortable, $c99785ec5604a382$var$store); | ||
($parcel$interopDefault($1ZQrD$tinyinvariant))(//@ts-expect-error: Doesn't exist. Will deprecate soon. | ||
}); | ||
}); | ||
props.setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store); | ||
($parcel$interopDefault($8zHUo$tinyinvariant))(//@ts-expect-error: Doesn't exist. Will deprecate soon. | ||
!props.plugins, ` | ||
@@ -195,3 +198,3 @@ Plugins prop is no longer supported. | ||
const newOptions = this.makeOptions(); | ||
($parcel$interopDefault($1ZQrD$sortablejs)).create(this.ref.current, newOptions); | ||
($parcel$interopDefault($8zHUo$sortablejs)).create(this.ref.current, newOptions); | ||
} | ||
@@ -210,3 +213,3 @@ componentDidUpdate(prevProps) { | ||
const newTag = !tag || tag === null ? "div" : tag; | ||
return(/*#__PURE__*/ $1ZQrD$react.createElement(newTag, { | ||
return(/*#__PURE__*/ $8zHUo$react.createElement(newTag, { | ||
// @todo - find a way (perhaps with the callback) to allow AntD components to work | ||
@@ -222,3 +225,3 @@ ref: this.ref, | ||
const dataid = dataIdAttr || "data-id"; | ||
/* eslint-disable-next-line */ return $1ZQrD$react.Children.map(children, (child, index)=>{ | ||
/* eslint-disable-next-line */ return $8zHUo$react.Children.map(children, (child, index)=>{ | ||
if (child === undefined) return undefined; | ||
@@ -232,3 +235,3 @@ const item = list[index] || { | ||
}; | ||
const className = ($parcel$interopDefault($1ZQrD$classnames))(prevClassName, { | ||
const className = ($parcel$interopDefault($8zHUo$classnames))(prevClassName, { | ||
[selectedClass]: item.selected, | ||
@@ -238,3 +241,3 @@ [chosenClass]: item.chosen, | ||
}); | ||
return(/*#__PURE__*/ $1ZQrD$react.cloneElement(child, { | ||
return(/*#__PURE__*/ $8zHUo$react.cloneElement(child, { | ||
[dataid]: child.key, | ||
@@ -273,3 +276,3 @@ className: className | ||
]; | ||
const newOptions = $38186c783ba0d7b3$export$7553c81e62e31b7e(this.props); | ||
const newOptions = $eb03e74f8f7db1f3$export$7553c81e62e31b7e(this.props); | ||
DOMHandlers.forEach((name)=>newOptions[name] = this.prepareOnHandlerPropAndDOM(name) | ||
@@ -283,3 +286,3 @@ ); | ||
if (!onMove) return defaultValue; | ||
const result = onMove(evt, originalEvt, this.sortable, $c99785ec5604a382$var$store); | ||
const result = onMove(evt, originalEvt, this.sortable, $7fe8e3ea572bda7a$var$store); | ||
if (typeof result === "undefined") return false; | ||
@@ -310,3 +313,3 @@ return result; | ||
const propEvent = this.props[evtName]; | ||
if (propEvent) propEvent(evt, this.sortable, $c99785ec5604a382$var$store); | ||
if (propEvent) propEvent(evt, this.sortable, $7fe8e3ea572bda7a$var$store); | ||
} | ||
@@ -317,18 +320,19 @@ // SORTABLE DOM HANDLING | ||
/* eslint-disable-next-line */ const otherList = [ | ||
...$c99785ec5604a382$var$store.dragging.props.list | ||
...$7fe8e3ea572bda7a$var$store.dragging.props.list | ||
]; | ||
const customs = $38186c783ba0d7b3$export$4655efe700f887a(evt, otherList); | ||
$38186c783ba0d7b3$export$77f49a256021c8de(customs); | ||
const newList = $38186c783ba0d7b3$export$eca851ee65ae17e4(customs, list, evt, clone).map((item)=>({ | ||
...item, | ||
const customs = $eb03e74f8f7db1f3$export$4655efe700f887a(evt, otherList); | ||
$eb03e74f8f7db1f3$export$77f49a256021c8de(customs); | ||
const newList = $eb03e74f8f7db1f3$export$eca851ee65ae17e4(customs, list, evt, clone); | ||
newList.forEach((item)=>{ | ||
Object.assign(item, { | ||
selected: false | ||
}) | ||
); | ||
setList(newList, this.sortable, $c99785ec5604a382$var$store); | ||
}); | ||
}); | ||
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store); | ||
} | ||
onRemove(evt) { | ||
const { list: list , setList: setList } = this.props; | ||
const mode = $38186c783ba0d7b3$export$1fc0f6205829e19c(evt); | ||
const customs = $38186c783ba0d7b3$export$4655efe700f887a(evt, list); | ||
$38186c783ba0d7b3$export$a6177d5829f70ebc(customs); | ||
const mode = $eb03e74f8f7db1f3$export$1fc0f6205829e19c(evt); | ||
const customs = $eb03e74f8f7db1f3$export$4655efe700f887a(evt, list); | ||
$eb03e74f8f7db1f3$export$a6177d5829f70ebc(customs); | ||
let newList = [ | ||
@@ -338,3 +342,3 @@ ...list | ||
// remove state if not in clone mode. otherwise, keep. | ||
if (evt.pullMode !== "clone") newList = $38186c783ba0d7b3$export$be2da95e6167b0bd(customs, newList); | ||
if (evt.pullMode !== "clone") newList = $eb03e74f8f7db1f3$export$be2da95e6167b0bd(customs, newList); | ||
else { | ||
@@ -360,5 +364,5 @@ // switch used to get the clone | ||
default: | ||
($parcel$interopDefault($1ZQrD$tinyinvariant))(true, `mode "${mode}" cannot clone. Please remove "props.clone" from <ReactSortable/> when using the "${mode}" plugin`); | ||
($parcel$interopDefault($8zHUo$tinyinvariant))(true, `mode "${mode}" cannot clone. Please remove "props.clone" from <ReactSortable/> when using the "${mode}" plugin`); | ||
} | ||
$38186c783ba0d7b3$export$77f49a256021c8de(customClones); | ||
$eb03e74f8f7db1f3$export$77f49a256021c8de(customClones); | ||
// replace selected items with cloned items | ||
@@ -372,22 +376,22 @@ customs.forEach((curr)=>{ | ||
// remove item.selected from list | ||
newList = newList.map((item)=>({ | ||
...item, | ||
newList.forEach((item)=>{ | ||
Object.assign(item, { | ||
selected: false | ||
}) | ||
); | ||
setList(newList, this.sortable, $c99785ec5604a382$var$store); | ||
}); | ||
}); | ||
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store); | ||
} | ||
onUpdate(evt) { | ||
const { list: list , setList: setList } = this.props; | ||
const customs = $38186c783ba0d7b3$export$4655efe700f887a(evt, list); | ||
$38186c783ba0d7b3$export$77f49a256021c8de(customs); | ||
$38186c783ba0d7b3$export$a6177d5829f70ebc(customs); | ||
const newList = $38186c783ba0d7b3$export$c25cf8080bd305ec(customs, list); | ||
return setList(newList, this.sortable, $c99785ec5604a382$var$store); | ||
const customs = $eb03e74f8f7db1f3$export$4655efe700f887a(evt, list); | ||
$eb03e74f8f7db1f3$export$77f49a256021c8de(customs); | ||
$eb03e74f8f7db1f3$export$a6177d5829f70ebc(customs); | ||
const newList = $eb03e74f8f7db1f3$export$c25cf8080bd305ec(customs, list); | ||
return setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store); | ||
} | ||
onStart() { | ||
$c99785ec5604a382$var$store.dragging = this; | ||
$7fe8e3ea572bda7a$var$store.dragging = this; | ||
} | ||
onEnd() { | ||
$c99785ec5604a382$var$store.dragging = null; | ||
$7fe8e3ea572bda7a$var$store.dragging = null; | ||
} | ||
@@ -397,9 +401,8 @@ onChoose(evt) { | ||
const newList = list.map((item, index)=>{ | ||
if (index === evt.oldIndex) return { | ||
...item, | ||
if (index === evt.oldIndex) Object.assign(item, { | ||
chosen: true | ||
}; | ||
}); | ||
return item; | ||
}); | ||
setList(newList, this.sortable, $c99785ec5604a382$var$store); | ||
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store); | ||
} | ||
@@ -409,21 +412,23 @@ onUnchoose(evt) { | ||
const newList = list.map((item, index)=>{ | ||
if (index === evt.oldIndex) return { | ||
...item, | ||
if (index === evt.oldIndex) Object.assign(item, { | ||
chosen: false | ||
}; | ||
}); | ||
return item; | ||
}); | ||
setList(newList, this.sortable, $c99785ec5604a382$var$store); | ||
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store); | ||
} | ||
onSpill(evt) { | ||
const { removeOnSpill: removeOnSpill , revertOnSpill: revertOnSpill } = this.props; | ||
if (removeOnSpill && !revertOnSpill) $38186c783ba0d7b3$export$1d0aa160432dfea5(evt.item); | ||
if (removeOnSpill && !revertOnSpill) $eb03e74f8f7db1f3$export$1d0aa160432dfea5(evt.item); | ||
} | ||
onSelect(evt) { | ||
const { list: list , setList: setList } = this.props; | ||
const newList = list.map((item)=>({ | ||
...item, | ||
selected: false | ||
}) | ||
); | ||
const newList = [ | ||
...list | ||
]; | ||
newList.forEach((item)=>{ | ||
Object.assign(item, { | ||
chosen: false | ||
}); | ||
}); | ||
evt.newIndicies.forEach((curr)=>{ | ||
@@ -438,11 +443,14 @@ const index = curr.index; | ||
}); | ||
setList(newList, this.sortable, $c99785ec5604a382$var$store); | ||
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store); | ||
} | ||
onDeselect(evt) { | ||
const { list: list , setList: setList } = this.props; | ||
const newList = list.map((item)=>({ | ||
...item, | ||
selected: false | ||
}) | ||
); | ||
const newList = [ | ||
...list | ||
]; | ||
newList.forEach((item)=>{ | ||
Object.assign(item, { | ||
chosen: false | ||
}); | ||
}); | ||
evt.newIndicies.forEach((curr)=>{ | ||
@@ -453,6 +461,6 @@ const index = curr.index; | ||
}); | ||
setList(newList, this.sortable, $c99785ec5604a382$var$store); | ||
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store); | ||
} | ||
} | ||
$c99785ec5604a382$export$11bbed9ee0012c13.defaultProps = { | ||
$7fe8e3ea572bda7a$export$11bbed9ee0012c13.defaultProps = { | ||
clone: (item)=>item | ||
@@ -462,8 +470,8 @@ }; | ||
var $926f150b8c018491$exports = {}; | ||
var $faefaad95e5fcca0$exports = {}; | ||
$parcel$exportWildcard(module.exports, $926f150b8c018491$exports); | ||
$parcel$exportWildcard(module.exports, $faefaad95e5fcca0$exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "react-sortablejs", | ||
"version": "6.0.3", | ||
"version": "6.1.0", | ||
"author": { | ||
@@ -45,7 +45,6 @@ "name": "Wayne Van Son", | ||
"@commitlint/config-conventional": "11", | ||
"@parcel/packager-ts": "2.2.0", | ||
"@parcel/transformer-typescript-types": "2.2.0", | ||
"@parcel/packager-ts": "2.2.1", | ||
"@parcel/transformer-typescript-types": "2.2.1", | ||
"@semantic-release/changelog": "5", | ||
"@semantic-release/git": "9", | ||
"@types/classnames": "^2.2.10", | ||
"@types/jest": "^26.0.14", | ||
@@ -52,0 +51,0 @@ "@types/node": "14.11.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
74055
0.97%30
-3.23%555
1.46%0
-100%