react-reorder-list
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -6,4 +6,5 @@ import React, { DetailedHTMLProps, HTMLAttributes, ReactNode } from "react"; | ||
end?: number; | ||
oldItems?: ReactNode; | ||
newItems?: ReactNode; | ||
oldItems?: ReactNode[]; | ||
newItems?: ReactNode[]; | ||
revert?: () => void; | ||
}) => void; | ||
@@ -10,0 +11,0 @@ export type ReorderListProps = { |
@@ -44,3 +44,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
if (end !== start) | ||
onPositionChange === null || onPositionChange === void 0 ? void 0 : onPositionChange({ start, end, oldItems: temp.items, newItems: items }); | ||
onPositionChange === null || onPositionChange === void 0 ? void 0 : onPositionChange({ start, end, oldItems: temp.items, newItems: items, revert: () => setItems(temp.items) }); | ||
setStart(-1); | ||
@@ -47,0 +47,0 @@ setSelected(-1); |
{ | ||
"name": "react-reorder-list", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "A simple react component that facilitates the reordering of JSX/HTML elements through drag-and-drop functionality, allowing for easy position changes.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -140,5 +140,13 @@ # react-reorder-list | ||
import { ReactNode } from 'react'; | ||
type PositionChangeHandler = (params?: { start?: number, end?: number, oldItems?: ReactNode, newItems?: ReactNode }) => void | ||
type RevertHandler = () => void | ||
type PositionChangeParams = { | ||
start?: number // Index of the item being dragged | ||
end?: number // Index of the item being displaced by the starting item | ||
oldItems?: ReactNode[] // Array of children before reordering | ||
newItems?: ReactNode[] // Array of children after reordering | ||
revert: RevertHandler // A fallback handler to revert the reordering | ||
} | ||
type PositionChangeHandler = (params?: PositionChangeParams) => void | ||
``` | ||
## Author | ||
[Sahil Aggarwal](https://www.github.com/SahilAggarwal2004) |
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
17940
180
151