react-sortablejs
Advanced tools
Comparing version 5.0.3 to 5.0.4
@@ -148,5 +148,8 @@ import Sortable from 'sortablejs'; | ||
} | ||
function handleStateAdd(normalized, list) { | ||
function handleStateAdd(normalized, list, evt, clone) { | ||
var newList = __spread(list); | ||
normalized.forEach(function (curr) { return newList.splice(curr.newIndex, 0, curr.item); }); | ||
normalized.forEach(function (curr) { | ||
var newItem = (clone && evt) && clone(curr.item, evt); | ||
newList.splice(curr.newIndex, 0, newItem || curr.item); | ||
}); | ||
return newList; | ||
@@ -318,7 +321,7 @@ } | ||
ReactSortable.prototype.onAdd = function (evt) { | ||
var _a = this.props, list = _a.list, setList = _a.setList; | ||
var _a = this.props, list = _a.list, setList = _a.setList, clone = _a.clone; | ||
var otherList = __spread(store.dragging.props.list); | ||
var customs = createCustoms(evt, otherList); | ||
removeNodes(customs); | ||
var newList = handleStateAdd(customs, list); | ||
var newList = handleStateAdd(customs, list, evt, clone).map(function (item) { return (__assign(__assign({}, item), { selected: false })); }); | ||
setList(newList, this.sortable, store); | ||
@@ -325,0 +328,0 @@ }; |
@@ -157,5 +157,8 @@ 'use strict'; | ||
} | ||
function handleStateAdd(normalized, list) { | ||
function handleStateAdd(normalized, list, evt, clone) { | ||
var newList = __spread(list); | ||
normalized.forEach(function (curr) { return newList.splice(curr.newIndex, 0, curr.item); }); | ||
normalized.forEach(function (curr) { | ||
var newItem = (clone && evt) && clone(curr.item, evt); | ||
newList.splice(curr.newIndex, 0, newItem || curr.item); | ||
}); | ||
return newList; | ||
@@ -327,7 +330,7 @@ } | ||
ReactSortable.prototype.onAdd = function (evt) { | ||
var _a = this.props, list = _a.list, setList = _a.setList; | ||
var _a = this.props, list = _a.list, setList = _a.setList, clone = _a.clone; | ||
var otherList = __spread(store.dragging.props.list); | ||
var customs = createCustoms(evt, otherList); | ||
removeNodes(customs); | ||
var newList = handleStateAdd(customs, list); | ||
var newList = handleStateAdd(customs, list, evt, clone).map(function (item) { return (__assign(__assign({}, item), { selected: false })); }); | ||
setList(newList, this.sortable, store); | ||
@@ -334,0 +337,0 @@ }; |
import { PropsWithChildren } from "react"; | ||
import { Options } from "sortablejs"; | ||
import Sortable, { Options } from "sortablejs"; | ||
import { MultiDragEvent } from "./react-sortable"; | ||
@@ -25,3 +25,3 @@ import { AllMethodNames, ItemInterface, ReactSortableProps } from "./types"; | ||
export declare function handleStateRemove<T extends ItemInterface>(normalized: Normalized<T>[], list: T[]): T[]; | ||
export declare function handleStateAdd<T extends ItemInterface>(normalized: Normalized<T>[], list: T[]): T[]; | ||
export declare function handleStateAdd<T extends ItemInterface>(normalized: Normalized<T>[], list: T[], evt?: Sortable.SortableEvent, clone?: ((currentItem: T, evt: Sortable.SortableEvent) => T) | undefined): T[]; | ||
export declare function getMode(evt: MultiDragEvent): "multidrag" | "swap" | "normal"; | ||
@@ -28,0 +28,0 @@ export declare function createNormalized<T extends ItemInterface>(inputs: Input[], list: T[]): Normalized<T>[]; |
@@ -8,3 +8,3 @@ { | ||
"license": "MIT", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"private": false, | ||
@@ -81,2 +81,3 @@ "main": "dist/index.js", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@semantic-release/git": "^9.0.0", | ||
"@types/classnames": "^2.2.10", | ||
@@ -83,0 +84,0 @@ "@types/node": "14.11.2", |
Sorry, the diff of this file is not supported yet
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
86624
1605
22