droppable.js 765 B

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