Socket
Socket
Sign inDemoInstall

react-sortablejs

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-sortablejs - npm Package Compare versions

Comparing version 5.0.4 to 5.0.5

CHANGELOG.md

2

dist/index.d.ts

@@ -1,4 +0,4 @@

export { default as Sortable, Direction, DOMRect, GroupOptions, MoveEvent, MultiDrag, Options, PullResult, PutResult, SortableEvent, SortableOptions, Swap, Utils } from "sortablejs";
export { default as Sortable, Direction, DOMRect, GroupOptions, MoveEvent, MultiDrag, Options, PullResult, PutResult, SortableEvent, SortableOptions, Swap, Utils, } from "sortablejs";
export { ReactSortable } from "./react-sortable";
export * from "./types";
//# sourceMappingURL=index.d.ts.map

@@ -114,2 +114,3 @@ import Sortable from 'sortablejs';

case "normal":
/* eslint-disable */
var item = {

@@ -119,3 +120,3 @@ element: evt.item,

oldIndex: evt.oldIndex,
parentElement: evt.from
parentElement: evt.from,
};

@@ -133,2 +134,3 @@ custom = [item];

}
/* eslint-enable */
var customs = createNormalized(custom, list);

@@ -154,3 +156,3 @@ return customs;

normalized.forEach(function (curr) {
var newItem = (clone && evt) && clone(curr.item, evt);
var newItem = clone && evt && clone(curr.item, evt);
newList.splice(curr.newIndex, 0, newItem || curr.item);

@@ -179,2 +181,3 @@ });

function destructurePropsForOptions(props) {
/* eslint-disable */
var

@@ -185,2 +188,3 @@ // react sortable props

onAdd = props.onAdd, onChange = props.onChange, onChoose = props.onChoose, onClone = props.onClone, onEnd = props.onEnd, onFilter = props.onFilter, onRemove = props.onRemove, onSort = props.onSort, onStart = props.onStart, onUnchoose = props.onUnchoose, onUpdate = props.onUpdate, onMove = props.onMove, onSpill = props.onSpill, onSelect = props.onSelect, onDeselect = props.onDeselect, options = __rest(props, ["list", "setList", "children", "tag", "style", "className", "clone", "onAdd", "onChange", "onChoose", "onClone", "onEnd", "onFilter", "onRemove", "onSort", "onStart", "onUnchoose", "onUpdate", "onMove", "onSpill", "onSelect", "onDeselect"]);
/* eslint-enable */
return options;

@@ -202,3 +206,3 @@ }

invariant(
//@ts-ignore
//@ts-expect-error: Doesn't exist. Will deprecate soon.
!props.plugins, "\nPlugins prop is no longer supported.\nInstead, mount it with \"Sortable.mount(new MultiDrag())\"\nPlease read the updated README.md at https://github.com/SortableJS/react-sortablejs.\n ");

@@ -223,3 +227,9 @@ return _this;

ReactSortable.prototype.getChildren = function () {
var _a = this.props, children = _a.children, dataIdAttr = _a.dataIdAttr, _b = _a.selectedClass, selectedClass = _b === void 0 ? "sortable-selected" : _b, _c = _a.chosenClass, chosenClass = _c === void 0 ? "sortable-chosen" : _c, _d = _a.dragClass, _e = _a.fallbackClass, _f = _a.ghostClass, _g = _a.swapClass, _h = _a.filter, filter = _h === void 0 ? "sortable-filter" : _h, list = _a.list;
var _a = this.props, children = _a.children, dataIdAttr = _a.dataIdAttr, _b = _a.selectedClass, selectedClass = _b === void 0 ? "sortable-selected" : _b, _c = _a.chosenClass, chosenClass = _c === void 0 ? "sortable-chosen" : _c,
/* eslint-disable */
_d = _a.dragClass,
_e = _a.fallbackClass, _f = _a.ghostClass, _g = _a.swapClass, /* eslint-enable */
_h = _a.filter,
/* eslint-enable */
filter = _h === void 0 ? "sortable-filter" : _h, list = _a.list;
// if no children, don't do anything.

@@ -229,2 +239,3 @@ if (!children || children == null)

var dataid = dataIdAttr || "data-id";
/* eslint-disable-next-line */
return Children.map(children, function (child, index) {

@@ -238,8 +249,3 @@ var _a, _b, _c;

_a);
var className = classNames(prevClassName, __assign((_b = {}, _b[selectedClass] = item.selected, _b[chosenClass] = item.chosen, _b), filtered
// [dragClass]: true,
// [fallbackClass]: true,
// [ghostClass]: true,
// [swapClass]: true
));
var className = classNames(prevClassName, __assign((_b = {}, _b[selectedClass] = item.selected, _b[chosenClass] = item.chosen, _b), filtered));
return cloneElement(child, (_c = {},

@@ -260,3 +266,3 @@ _c[dataid] = child.key,

return null;
//@ts-ignore - I know what I'm doing.
//@ts-expect-error: fix me.
return el[key];

@@ -280,3 +286,3 @@ },

"onUnchoose",
"onUpdate"
"onUpdate",
];

@@ -287,3 +293,3 @@ var NonDOMHandlers = [

"onFilter",
"onSort"
"onSort",
];

@@ -300,3 +306,3 @@ var newOptions = destructurePropsForOptions(this.props);

var result = onMove(evt, originalEvt, _this.sortable, store);
if (typeof result === 'undefined')
if (typeof result === "undefined")
return false;

@@ -314,3 +320,3 @@ return result;

// calls state change
//@ts-ignore - until @types multidrag item is in
//@ts-expect-error: until @types multidrag item is in
_this[evtName](evt);

@@ -336,2 +342,3 @@ };

var _a = this.props, list = _a.list, setList = _a.setList, clone = _a.clone;
/* eslint-disable-next-line */
var otherList = __spread(store.dragging.props.list);

@@ -363,3 +370,3 @@ var customs = createCustoms(evt, otherList);

case "normal":
customClones = customs.map(function (item, index) { return (__assign(__assign({}, item), { element: evt.clone })); });
customClones = customs.map(function (item) { return (__assign(__assign({}, item), { element: evt.clone })); });
break;

@@ -375,2 +382,3 @@ case "swap":

var index = curr.oldIndex;
/* eslint-disable-next-line */
var newItem = _this.props.clone(curr.item, evt);

@@ -392,6 +400,6 @@ newList.splice(index, 1, newItem);

};
ReactSortable.prototype.onStart = function (evt) {
ReactSortable.prototype.onStart = function () {
store.dragging = this;
};
ReactSortable.prototype.onEnd = function (evt) {
ReactSortable.prototype.onEnd = function () {
store.dragging = null;

@@ -449,4 +457,5 @@ };

};
/* eslint-disable-next-line */
ReactSortable.defaultProps = {
clone: function (item) { return item; }
clone: function (item) { return item; },
};

@@ -453,0 +462,0 @@ return ReactSortable;

@@ -123,2 +123,3 @@ 'use strict';

case "normal":
/* eslint-disable */
var item = {

@@ -128,3 +129,3 @@ element: evt.item,

oldIndex: evt.oldIndex,
parentElement: evt.from
parentElement: evt.from,
};

@@ -142,2 +143,3 @@ custom = [item];

}
/* eslint-enable */
var customs = createNormalized(custom, list);

@@ -163,3 +165,3 @@ return customs;

normalized.forEach(function (curr) {
var newItem = (clone && evt) && clone(curr.item, evt);
var newItem = clone && evt && clone(curr.item, evt);
newList.splice(curr.newIndex, 0, newItem || curr.item);

@@ -188,2 +190,3 @@ });

function destructurePropsForOptions(props) {
/* eslint-disable */
var

@@ -194,2 +197,3 @@ // react sortable props

onAdd = props.onAdd, onChange = props.onChange, onChoose = props.onChoose, onClone = props.onClone, onEnd = props.onEnd, onFilter = props.onFilter, onRemove = props.onRemove, onSort = props.onSort, onStart = props.onStart, onUnchoose = props.onUnchoose, onUpdate = props.onUpdate, onMove = props.onMove, onSpill = props.onSpill, onSelect = props.onSelect, onDeselect = props.onDeselect, options = __rest(props, ["list", "setList", "children", "tag", "style", "className", "clone", "onAdd", "onChange", "onChoose", "onClone", "onEnd", "onFilter", "onRemove", "onSort", "onStart", "onUnchoose", "onUpdate", "onMove", "onSpill", "onSelect", "onDeselect"]);
/* eslint-enable */
return options;

@@ -211,3 +215,3 @@ }

invariant__default['default'](
//@ts-ignore
//@ts-expect-error: Doesn't exist. Will deprecate soon.
!props.plugins, "\nPlugins prop is no longer supported.\nInstead, mount it with \"Sortable.mount(new MultiDrag())\"\nPlease read the updated README.md at https://github.com/SortableJS/react-sortablejs.\n ");

@@ -232,3 +236,9 @@ return _this;

ReactSortable.prototype.getChildren = function () {
var _a = this.props, children = _a.children, dataIdAttr = _a.dataIdAttr, _b = _a.selectedClass, selectedClass = _b === void 0 ? "sortable-selected" : _b, _c = _a.chosenClass, chosenClass = _c === void 0 ? "sortable-chosen" : _c, _d = _a.dragClass, _e = _a.fallbackClass, _f = _a.ghostClass, _g = _a.swapClass, _h = _a.filter, filter = _h === void 0 ? "sortable-filter" : _h, list = _a.list;
var _a = this.props, children = _a.children, dataIdAttr = _a.dataIdAttr, _b = _a.selectedClass, selectedClass = _b === void 0 ? "sortable-selected" : _b, _c = _a.chosenClass, chosenClass = _c === void 0 ? "sortable-chosen" : _c,
/* eslint-disable */
_d = _a.dragClass,
_e = _a.fallbackClass, _f = _a.ghostClass, _g = _a.swapClass, /* eslint-enable */
_h = _a.filter,
/* eslint-enable */
filter = _h === void 0 ? "sortable-filter" : _h, list = _a.list;
// if no children, don't do anything.

@@ -238,2 +248,3 @@ if (!children || children == null)

var dataid = dataIdAttr || "data-id";
/* eslint-disable-next-line */
return react.Children.map(children, function (child, index) {

@@ -247,8 +258,3 @@ var _a, _b, _c;

_a);
var className = classNames__default['default'](prevClassName, __assign((_b = {}, _b[selectedClass] = item.selected, _b[chosenClass] = item.chosen, _b), filtered
// [dragClass]: true,
// [fallbackClass]: true,
// [ghostClass]: true,
// [swapClass]: true
));
var className = classNames__default['default'](prevClassName, __assign((_b = {}, _b[selectedClass] = item.selected, _b[chosenClass] = item.chosen, _b), filtered));
return react.cloneElement(child, (_c = {},

@@ -269,3 +275,3 @@ _c[dataid] = child.key,

return null;
//@ts-ignore - I know what I'm doing.
//@ts-expect-error: fix me.
return el[key];

@@ -289,3 +295,3 @@ },

"onUnchoose",
"onUpdate"
"onUpdate",
];

@@ -296,3 +302,3 @@ var NonDOMHandlers = [

"onFilter",
"onSort"
"onSort",
];

@@ -309,3 +315,3 @@ var newOptions = destructurePropsForOptions(this.props);

var result = onMove(evt, originalEvt, _this.sortable, store);
if (typeof result === 'undefined')
if (typeof result === "undefined")
return false;

@@ -323,3 +329,3 @@ return result;

// calls state change
//@ts-ignore - until @types multidrag item is in
//@ts-expect-error: until @types multidrag item is in
_this[evtName](evt);

@@ -345,2 +351,3 @@ };

var _a = this.props, list = _a.list, setList = _a.setList, clone = _a.clone;
/* eslint-disable-next-line */
var otherList = __spread(store.dragging.props.list);

@@ -372,3 +379,3 @@ var customs = createCustoms(evt, otherList);

case "normal":
customClones = customs.map(function (item, index) { return (__assign(__assign({}, item), { element: evt.clone })); });
customClones = customs.map(function (item) { return (__assign(__assign({}, item), { element: evt.clone })); });
break;

@@ -384,2 +391,3 @@ case "swap":

var index = curr.oldIndex;
/* eslint-disable-next-line */
var newItem = _this.props.clone(curr.item, evt);

@@ -401,6 +409,6 @@ newList.splice(index, 1, newItem);

};
ReactSortable.prototype.onStart = function (evt) {
ReactSortable.prototype.onStart = function () {
store.dragging = this;
};
ReactSortable.prototype.onEnd = function (evt) {
ReactSortable.prototype.onEnd = function () {
store.dragging = null;

@@ -458,4 +466,5 @@ };

};
/* eslint-disable-next-line */
ReactSortable.defaultProps = {
clone: function (item) { return item; }
clone: function (item) { return item; },
};

@@ -462,0 +471,0 @@ return ReactSortable;

@@ -1,2 +0,2 @@

import { Component, ReactElement } from "react";
import { Component } from "react";
import { Options, SortableEvent } from "sortablejs";

@@ -9,3 +9,3 @@ import { AllMethodsExceptMove, HandledMethodNames, ItemInterface, ReactSortableProps } from "./types";

componentDidMount(): void;
render(): ReactElement<import("react").RefAttributes<any>, string | ((props: any) => ReactElement<any, string | any | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>;
render(): JSX.Element;
private getChildren;

@@ -25,4 +25,4 @@ /** Appends the `sortable` property to this component */

onUpdate(evt: MultiDragEvent): void;
onStart(evt: SortableEvent): void;
onEnd(evt: SortableEvent): void;
onStart(): void;
onEnd(): void;
onChoose(evt: SortableEvent): void;

@@ -29,0 +29,0 @@ onUnchoose(evt: SortableEvent): void;

import { CSSProperties, ForwardRefExoticComponent, ReactHTML, RefAttributes } from "react";
import Sortable, { MoveEvent, Options, SortableEvent } from "sortablejs";
import { ReactSortable } from "./react-sortable";
import { Omit } from './util';
import { Omit } from "./util";
export interface ItemInterface {

@@ -6,0 +6,0 @@ /** The unique id associated with your item. It's recommended this is the same as the key prop for your list item. */

@@ -47,3 +47,3 @@ import { PropsWithChildren } from "react";

*/
export declare type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
//# sourceMappingURL=util.d.ts.map

@@ -8,3 +8,3 @@ {

"license": "MIT",
"version": "5.0.4",
"version": "5.0.5",
"private": false,

@@ -15,4 +15,3 @@ "main": "dist/index.js",

"files": [
"dist",
"local-types"
"dist"
],

@@ -25,34 +24,40 @@ "scripts": {

"build:rollup": " rollup --config config/rollup.config.js",
"build:tsc": "ts-node config/move-files.ts"
"build:tsc": "ts-node config/move-files.ts",
"build:storybook": "build-storybook",
"storybook": "start-storybook -p 6006",
"style": "yarn style:format && yarn style:lint",
"style:format": "prettier -w src",
"style:lint": "eslint src/**"
},
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/github",
{
"assets": [
"dist/**"
]
}
],
"@semantic-release/npm",
"@semantic-release/git",
[
"release": {
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/github",
{
"assets": [
"dist/**"
]
}
],
"@semantic-release/npm",
"@semantic-release/git",
{
"assets": [
"dist/**",
"package.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
[
"@semantic-release/git",
{
"assets": [
"package.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
],
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "yarn build",
"pre-push": "yarn build"
"pre-commit": "yarn style && yarn build",
"pre-push": "yarn style && yarn build"
}

@@ -81,6 +86,13 @@ },

"devDependencies": {
"@babel/core": "^7.11.6",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@storybook/addon-actions": "^6.0.21",
"@storybook/addon-essentials": "^6.0.21",
"@storybook/addon-links": "^6.0.21",
"@storybook/react": "^6.0.21",
"@types/classnames": "^2.2.10",
"@types/jest": "^26.0.14",
"@types/node": "14.11.2",

@@ -90,9 +102,17 @@ "@types/react": "16.9.49",

"@types/sortablejs": "^1.10.0",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"babel-loader": "^8.1.0",
"commitizen": "^4.2.1",
"copy-dir": "^1.3.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.9.0",
"eslint-plugin-react": "^7.21.2",
"husky": "^4.3.0",
"jest": "^26.4.2",
"parcel-bundler": "^1.12.4",
"prettier": "^2.1.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-is": "^16.13.1",
"rollup": "^2.28.2",

@@ -103,2 +123,4 @@ "rollup-plugin-commonjs": "^10.1.0",

"sortablejs": "^1.10.0",
"storybook": "^6.0.21",
"ts-jest": "^26.4.0",
"ts-node": "^9.0.0",

@@ -105,0 +127,0 @@ "typescript": "^4.0.3"

@@ -5,2 +5,4 @@ # `react-sortablejs`

[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
## Features

@@ -7,0 +9,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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