@konoma-development/react-components 0.0.6 → 0.0.7

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.
@@ -54535,7 +54535,10 @@ function Table({
54535
54535
  noEntryLabel,
54536
54536
  allowReorder,
54537
54537
  showFilters,
54538
- onMoveRow = () => {
54538
+ onDragRow = () => {
54539
+ return;
54540
+ },
54541
+ onDropRow = () => {
54539
54542
  return;
54540
54543
  },
54541
54544
  onRowClick = () => {
@@ -54739,7 +54742,8 @@ function Table({
54739
54742
  {
54740
54743
  index: i,
54741
54744
  entry,
54742
- moveRow: onMoveRow,
54745
+ onDragRow,
54746
+ onDropRow,
54743
54747
  currentColumnsCenter,
54744
54748
  currentColumnsLeft,
54745
54749
  currentColumnsRight,
@@ -54825,7 +54829,8 @@ function Table({
54825
54829
  function Row({
54826
54830
  index,
54827
54831
  entry,
54828
- moveRow,
54832
+ onDragRow,
54833
+ onDropRow,
54829
54834
  onRowClick,
54830
54835
  onRowDoubleClick,
54831
54836
  currentColumnsLeft,
@@ -54865,12 +54870,21 @@ function Row({
54865
54870
  if (dragIndex > hoverIndex && hoverClientY > hoverMiddleY) {
54866
54871
  return;
54867
54872
  }
54868
- moveRow(dragIndex, hoverIndex);
54873
+ onDragRow(dragIndex, hoverIndex);
54869
54874
  item.index = hoverIndex;
54870
54875
  }
54871
54876
  });
54872
54877
  const [{ opacity }, drag, preview] = useDrag({
54873
54878
  type: "row",
54879
+ end: (item, monitor) => {
54880
+ if (!monitor.didDrop()) {
54881
+ return;
54882
+ }
54883
+ const dropResult = monitor.getDropResult();
54884
+ if (dropResult) {
54885
+ onDropRow(item.index, dropResult.index);
54886
+ }
54887
+ },
54874
54888
  item: () => {
54875
54889
  return { id: entry.index, index };
54876
54890
  },