droppable.js 744 B

123456789101112131415161718192021222324
  1. // TODO: This file was created by bulk-decaffeinate.
  2. // Fix any style issues and re-enable lint.
  3. /*
  4. * decaffeinate suggestions:
  5. * DS102: Remove unnecessary code created because of implicit returns
  6. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  7. */
  8. import App from '../../../base'
  9. export default App.directive('droppable', () => ({
  10. link(scope, element, attrs) {
  11. return scope.$watch(attrs.droppable, function(droppable) {
  12. if (droppable) {
  13. return element.droppable({
  14. greedy: true,
  15. hoverClass: 'droppable-hover',
  16. tolerance: 'pointer',
  17. accept: attrs.accept,
  18. drop: scope.$eval(attrs.onDropCallback)
  19. })
  20. }
  21. })
  22. }
  23. }))