GithubHelp home page GithubHelp logo

isabella232 / ember-dragula Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zestia/ember-dragula

0.0 0.0 0.0 15.13 MB

๐Ÿ–ฑ๏ธ An ember addon for drag and drop via dragula

License: MIT License

JavaScript 76.84% HTML 8.79% CSS 0.71% Handlebars 13.65%

ember-dragula's Introduction

@zestia/ember-dragula

This Ember addon provides support for drag and drop using dragula

Installation

ember install @zestia/ember-dragula

Demo

https://zestia.github.io/ember-dragula

Example

<EmberDragula as |d|>
  <d.Container>
    {{#each this.listOne as |item|}}
      {{item}}
    {{/each}}
  </d.Container>

  <d.Container>
    {{#each this.listTwo as |item|}}
      {{item}}
    {{/each}}
  </d.Container>
</EmberDragula>

Options

The full range of options that dragula accepts are supported, see: https://github.com/bevacqua/dragula#dragulacontainers-options

To supply options:

<EmberDragula @options={{hash option=value}} as |d|>
  ...
</EmberDragula>

Events

The full range of events that dragula emits are supported, see: https://github.com/bevacqua/dragula#drakeon-events. These can be accessed by prefixing the event name with "on":

<EmberDragula
  @onDrag={{this.onDrag}}
  @onDrop={{this.drop}}
  @onCancel={{this.cancel}}
  ...
  as |d|
>
  <d.Container>
    {{#each this.listOne as |item|}}
      {{item}}
    {{/each}}
  </d.Container>

  <d.Container>
    {{#each this.listTwo as |item|}}
      {{item}}
    {{/each}}
  </d.Container>
</EmberDragula>

The dragula instance is emitted via an onReady action, and allows access to all functions and fields on drake (https://github.com/bevacqua/dragula#api):

<EmberDragula @onReady={{this.ready}} as |d|>
  ...
</EmberDragula>

Test helpers

To simulate dragging and dropping, test helpers are provided:

import { simulateDragDrop } from '@zestia/ember-dragula/test-support/helpers/simulate-drag-drop';

Within a test:

const dragMe = find('.drag-me');
const dropHere = find('.drop-here');

await simulateDrag(dragMe);
await simulateDrop(dragMe, dropHere);
await simulateDragDrop(dragMe, dropHere);

ember-dragula's People

Contributors

amk221 avatar dependabot[bot] avatar ember-tomster avatar karl-sjogren avatar lvegerano avatar mikerhyssm avatar philliphaines avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.