Skip to content

Commit 28b976e

Browse files
committed
bump version to 2.1.5 and update setItems signature to include event
1 parent c69e10c commit 28b976e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.1.4",
2+
"version": "2.1.5",
33
"name": "solid-sortablejs",
44
"description": "A sortable library for solid",
55
"license": "MIT",

src/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import SortableJs from "sortablejs";
1313
export type SortableEvent = SortableJs.SortableEvent;
1414
interface SortableProps<T> extends SortableJs.Options {
1515
items: T[];
16-
setItems: Setter<T[]>;
16+
setItems: (items: T[], event: SortableEvent) => void;
1717
idField: keyof T;
1818
class?: string;
1919
style?: JSX.CSSProperties;
@@ -112,7 +112,7 @@ export default function Sortable<T>(props: SortableProps<T>) {
112112
children.splice(event.newIndex!, 1);
113113
event.to?.replaceChildren(...children);
114114

115-
ourProps.setItems(newItems as T[]);
115+
ourProps.setItems(newItems as T[], event);
116116
options.onAdd?.(event);
117117
},
118118
onRemove(event) {
@@ -128,7 +128,7 @@ export default function Sortable<T>(props: SortableProps<T>) {
128128

129129
children.splice(event.oldIndex!, 0, event.item);
130130
event.from.replaceChildren(...children);
131-
ourProps.setItems(newItems as T[]);
131+
ourProps.setItems(newItems as T[], event);
132132
options.onRemove?.(event);
133133
},
134134
onEnd(event) {
@@ -145,7 +145,7 @@ export default function Sortable<T>(props: SortableProps<T>) {
145145
(a, b) => parseInt(a.dataset.index!) - parseInt(b.dataset.index!)
146146
);
147147
sortableContainerRef?.replaceChildren(...children);
148-
ourProps.setItems(newItems as T[]);
148+
ourProps.setItems(newItems as T[], event);
149149
dragging.item = undefined;
150150
options.onEnd?.(event);
151151
},

0 commit comments

Comments
 (0)