/**
 * ldesign v0.2.22
 * (c) 2022/12/7 16:21 built by swimly
 * @license MIT
 */

import { ref } from '@vue/composition-api';

function useDrag(props) {
  const target = ref(null);
  const dragActive = ref(false);
  const handleDrop = event => {
    event.preventDefault();
    props.onDragFileChange?.(event);
    props.onDrop?.({
      e: event
    });
    dragActive.value = false;
  };
  const handleDragenter = event => {
    event.preventDefault();
    target.value = event.target;
    props.onDragenter?.({
      e: event
    });
    dragActive.value = true;
  };
  const handleDragleave = event => {
    if (event.target !== target.value) return;
    event.preventDefault();
    props.onDragleave?.({
      e: event
    });
    dragActive.value = false;
  };
  const handleDragover = event => {
    event.preventDefault();
  };
  return {
    target,
    dragActive,
    handleDrop,
    handleDragenter,
    handleDragleave,
    handleDragover
  };
}

export { useDrag as default };
//# sourceMappingURL=use-drag.js.map
