Skip to content

Commit a17bd83

Browse files
committed
fix(sortable): unify sortableMove arguments
1 parent 1bce610 commit a17bd83

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

src/core/components/sortable/sortable.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export namespace Sortable {
1212
'sortable:disable': (event: any) => void;
1313
/** Event will be triggered after user release currently sorting element in new position. event.detail will contain object with from and to properties with from/to index numbers of sorted list item */
1414
'sortable:sort': (event: any, indexes: SortIndexes) => void;
15+
/** Event will be triggered on every list item move during sorting */
16+
'sortable:move': (event: any) => void;
1517
}
1618
interface AppMethods {
1719
sortable: {

src/core/components/sortable/sortable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const Sortable = {
151151

152152
if (prevTranslate !== currentTranslate) {
153153
$currentEl.trigger('sortable:move');
154-
app.emit('sortableMove', $sortableContainer[0], $currentEl[0]);
154+
app.emit('sortableMove', $currentEl[0], $sortableContainer[0]);
155155
}
156156

157157
$currentEl[0].f7Translate = currentTranslate;

src/react/components/list.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const List = forwardRef((props, ref) => {
127127

128128
const onSortableMove = (el, listEl) => {
129129
if (elRef.current !== listEl) return;
130-
emit(props, 'sortableMove', el);
130+
emit(props, 'sortableMove', el, listEl);
131131
};
132132

133133
useImperativeHandle(ref, () => ({

src/svelte/components/list.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
}
134134
function onSortableMove(listItemEl, listEl) {
135135
if (listEl !== el) return;
136-
emit('sortableMove', [listEl]);
136+
emit('sortableMove', [listItemEl, listEl]);
137137
}
138138
139139
useTab(() => el, emit);

src/vue/components/list.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default {
9191
};
9292
const onSortableMove = (el, listEl) => {
9393
if (elRef.value !== listEl) return;
94-
emit(props, 'sortable:move', el);
94+
emit(props, 'sortable:move', el, listEl);
9595
};
9696
9797
useTab(elRef, emit);

0 commit comments

Comments
 (0)