historyDroppableArea.js 810 B

123456789101112131415161718192021222324
  1. import App from '../../../base'
  2. export default App.directive('historyDroppableArea', () => ({
  3. scope: {
  4. historyDroppableAreaOnDrop: '&',
  5. historyDroppableAreaOnOver: '&',
  6. historyDroppableAreaOnOut: '&',
  7. },
  8. restrict: 'A',
  9. link(scope, element, attrs) {
  10. element.droppable({
  11. accept: e => '.history-entry-toV-handle, .history-entry-fromV-handle',
  12. drop: (e, ui) => {
  13. const draggedBoundary = ui.draggable.data('selectionBoundary').boundary
  14. ui.helper.data('wasProperlyDropped', true)
  15. scope.historyDroppableAreaOnDrop({ boundary: draggedBoundary })
  16. },
  17. over: (e, ui) => {
  18. const draggedBoundary = ui.draggable.data('selectionBoundary').boundary
  19. scope.historyDroppableAreaOnOver({ boundary: draggedBoundary })
  20. },
  21. })
  22. },
  23. }))