@northlight/ui 1.5.7 → 1.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/umd/northlight.js
CHANGED
|
@@ -5958,12 +5958,6 @@
|
|
|
5958
5958
|
const [items, setItems] = React.useState(sortableItems);
|
|
5959
5959
|
const [activeItem, setActiveItem] = React.useState(null);
|
|
5960
5960
|
const identifierItems = React.useMemo(() => ramda.map(createKey, items), [items]);
|
|
5961
|
-
React.useEffect(() => {
|
|
5962
|
-
onChange(items);
|
|
5963
|
-
}, [items]);
|
|
5964
|
-
React.useEffect(() => {
|
|
5965
|
-
setItems(sortableItems);
|
|
5966
|
-
}, [sortableItems]);
|
|
5967
5961
|
const customSensors = core.useSensors(
|
|
5968
5962
|
core.useSensor(core.PointerSensor),
|
|
5969
5963
|
core.useSensor(core.KeyboardSensor, {
|
|
@@ -5984,7 +5978,9 @@
|
|
|
5984
5978
|
const oldIndex = ramda.indexOf(active.id, prevIds);
|
|
5985
5979
|
const newIndex = ramda.indexOf(over.id, prevIds);
|
|
5986
5980
|
onMovedItem({ item: prev[oldIndex], oldIndex, newIndex });
|
|
5987
|
-
|
|
5981
|
+
const newItems = sortable.arrayMove(prev, oldIndex, newIndex);
|
|
5982
|
+
onChange(newItems);
|
|
5983
|
+
return newItems;
|
|
5988
5984
|
});
|
|
5989
5985
|
}
|
|
5990
5986
|
};
|